iop_d3ripURT.cppGo to the documentation of this file.00001 /** @file iop_d3ripURT.cpp d3ripURT protocol and friends */ 00002 00003 /* 00004 FAU Discrete Event Systems Library (libfaudes) 00005 00006 Copyright (C) 2011, Ece Schmidt, Klaus Schmidt, Ulas Turan 00007 00008 */ 00009 00010 00011 #include "iop_d3ripURT.h" 00012 00013 00014 //only compile with D3RIP-URT protocol operation 00015 #ifdef FAUDES_IODEVICE_D3RIP_URT 00016 00017 00018 #include <sys/mman.h> 00019 #include <errno.h> 00020 #include <signal.h> 00021 namespace faudes { 00022 00023 00024 /* 00025 ********************************************** 00026 ********************************************** 00027 ********************************************** 00028 00029 implementation: AttributeD3ripURTOutput 00030 00031 ********************************************** 00032 ********************************************** 00033 ********************************************** 00034 */ 00035 00036 // faudes type std 00037 FAUDES_TYPE_IMPLEMENTATION(Void,AttributeD3ripURTOutput,AttributeVoid) 00038 00039 //DoAssign(Src) 00040 void AttributeD3ripURTOutput::DoAssign(const AttributeD3ripURTOutput& rSrcAttr) { 00041 FD_DHV("AttributeD3ripURTOutput(" << this << "):DoAssign(): assignment from " << &rSrcAttr); 00042 mChannelToTransmit=rSrcAttr.mChannelToTransmit; 00043 mParameterRecords=rSrcAttr.mParameterRecords; 00044 mEventId=rSrcAttr.mEventId; 00045 } 00046 00047 //DoWrite(rTw); 00048 void AttributeD3ripURTOutput::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const { 00049 (void) rLabel; (void) pContext; 00050 00051 FD_DHV("AttributeD3ripURTOutput::DoWrite()" ); 00052 Token ptoken; 00053 ptoken.SetEmpty("ChannelToTransmit"); 00054 ptoken.InsAttributeInteger("value",mChannelToTransmit); 00055 rTw << ptoken; 00056 } 00057 00058 00059 //DoRead(rTr) 00060 void AttributeD3ripURTOutput::DoRead(TokenReader& rTr, const std::string& rLabel, const Type* pContext) { 00061 mParameterRecords.reserve(10); 00062 (void) rLabel; (void) pContext; 00063 Token token; 00064 FD_DHV("AttributeD3ripURTOutput::DoRead()"); 00065 // loop all D3ripURT parameters 00066 while(1) { 00067 rTr.Peek(token); 00068 if(!token.IsBegin()) return; 00069 //ChannelToTransmit 00070 if(token.IsBegin("ChannelToTransmit")) { 00071 rTr.Get(token); 00072 if(token.ExistsAttributeInteger("value")) 00073 mChannelToTransmit=token.AttributeIntegerValue("value"); 00074 rTr.ReadEnd("ChannelToTransmit"); 00075 continue; 00076 } 00077 if(token.IsBegin("EventId")) { 00078 rTr.Get(token); 00079 if(token.ExistsAttributeInteger("value")) 00080 mEventId=token.AttributeIntegerValue("value"); 00081 rTr.ReadEnd("EventId"); 00082 continue; 00083 } 00084 00085 //ParameterRecord 00086 if(token.IsBegin("ParameterRecord")) { 00087 // mParameterRecords is a std::vector<ParameterRecord> 00088 mParameterRecords.resize(mParameterRecords.size()+1); //grow by one, get reference to last 00089 ParameterRecord& record = mParameterRecords.back(); 00090 rTr.ReadBegin("ParameterRecord",token); 00091 //if(token.ExistsAttributeInteger("name")) 00092 while(!rTr.Eos("ParameterRecord")) { 00093 rTr.Peek(token); 00094 //DestinationNode 00095 if(token.IsBegin("DestinationNode")) { 00096 rTr.Get(token); 00097 if(token.ExistsAttributeInteger("value")) 00098 record.destinationNode=token.AttributeIntegerValue("value"); 00099 rTr.ReadEnd("DestinationNode"); 00100 continue; 00101 } 00102 //DestinationChannel 00103 if(token.IsBegin("DestinationChannel")) { 00104 rTr.Get(token); 00105 if(token.ExistsAttributeInteger("value")) 00106 record.destinationChannel=token.AttributeIntegerValue("value"); 00107 rTr.ReadEnd("DestinationChannel"); 00108 continue; 00109 } 00110 //EligibilityTime 00111 if(token.IsBegin("EligibilityTime")) { 00112 rTr.Get(token); 00113 if(token.ExistsAttributeInteger("value")) 00114 record.eligibilityTime=token.AttributeIntegerValue("value"); 00115 rTr.ReadEnd("EligibilityTime"); 00116 continue; 00117 } 00118 //DeadlineTime 00119 if(token.IsBegin("DeadlineTime")) { 00120 rTr.Get(token); 00121 if(token.ExistsAttributeInteger("value")) 00122 record.deadlineTime=token.AttributeIntegerValue("value"); 00123 rTr.ReadEnd("DeadlineTime"); 00124 continue; 00125 } 00126 rTr.Get(token); 00127 rTr.ReadEnd(token.StringValue()); 00128 } 00129 rTr.ReadEnd("ParameterRecord"); 00130 continue; 00131 } 00132 // unknown 00133 break; 00134 } 00135 } 00136 00137 00138 00139 00140 /* 00141 ********************************************** 00142 ********************************************** 00143 ********************************************** 00144 00145 implementation: AttributeD3ripURTInput 00146 00147 ********************************************** 00148 ********************************************** 00149 ********************************************** 00150 */ 00151 00152 00153 // faudes type std 00154 FAUDES_TYPE_IMPLEMENTATION(Void,AttributeD3ripURTInput,AttributeVoid) 00155 00156 00157 //DoAssign(Src) 00158 void AttributeD3ripURTInput::DoAssign(const AttributeD3ripURTInput& rSrcAttr) { 00159 FD_DHV("AttributeD3ripURTInput(" << this << "):DoAssign(): assignment from " << &rSrcAttr); 00160 mEventId=rSrcAttr.mEventId; 00161 } 00162 00163 00164 //DoWrite(rTw,rLabel,pContext) 00165 void AttributeD3ripURTInput::DoWrite(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const { 00166 (void) rLabel; (void) pContext; 00167 }//DoWrite(rTw,rLabel,pContext) 00168 00169 00170 //DoRead(rTr,rLabel,pContext) 00171 void AttributeD3ripURTInput::DoRead(TokenReader& rTr, const std::string& rLabel, const Type* pContext) { 00172 (void) rLabel; (void) pContext; 00173 Token token; 00174 FD_DHV("AttributeD3ripURTOutput::DoRead()"); 00175 // loop all D3ripURT parameters 00176 while(1) { 00177 rTr.Peek(token); 00178 if(!token.IsBegin()) return; 00179 if(token.IsBegin("EventId")) { 00180 rTr.Get(token); 00181 if(token.ExistsAttributeInteger("value")) 00182 mEventId=token.AttributeIntegerValue("value"); 00183 rTr.ReadEnd("EventId"); 00184 continue; 00185 } 00186 00187 // unknown 00188 break; 00189 } 00190 } 00191 00192 00193 00194 /* 00195 ********************************************** 00196 ********************************************** 00197 ********************************************** 00198 00199 implementation: AttributeD3ripURTEvent 00200 00201 ********************************************** 00202 ********************************************** 00203 ********************************************** 00204 */ 00205 00206 00207 00208 // std faudes type 00209 FAUDES_TYPE_IMPLEMENTATION(Void,AttributeD3ripURTEvent,AttributeDeviceEvent) 00210 00211 // Default constructor, set my prototypes 00212 AttributeD3ripURTEvent::AttributeD3ripURTEvent(void) : AttributeDeviceEvent() { 00213 FD_DHV("AttributeD3ripURTEvent::AttributeD3ripURTEvent(" << this << ")"); 00214 pOutputPrototype=OutputPrototypep(); 00215 pInputPrototype=InputPrototypep(); 00216 } 00217 00218 // Copy constructor 00219 AttributeD3ripURTEvent::AttributeD3ripURTEvent(const AttributeD3ripURTEvent& rOtherAttr) : 00220 AttributeDeviceEvent() 00221 { 00222 FD_DHV("AttributeD3ripURTEvent(" << this << "): form other attr " << &rOtherAttr); 00223 pOutputPrototype=OutputPrototypep(); 00224 pInputPrototype=InputPrototypep(); 00225 DoAssign(rOtherAttr); 00226 } 00227 00228 00229 // autoregister event configuration (required for XML token format) 00230 AutoRegisterType< TaNameSet<AttributeD3ripURTEvent> > 00231 gRti1RegisterD3ripURTDeviceEventSet("D3ripURTDeviceEventSet"); 00232 AutoRegisterXElementTag< TaNameSet<AttributeD3ripURTEvent> > 00233 gRti1XElementTagD3ripURTDeviceEventSet("D3ripURTDeviceEventSet", "Event"); 00234 00235 // pseudo statics 00236 const AttributeD3ripURTOutput* AttributeD3ripURTEvent::OutputPrototypep(void){ 00237 AttributeD3ripURTOutput* attrp= new AttributeD3ripURTOutput(); 00238 return attrp; 00239 } 00240 00241 // pseudo statics 00242 const AttributeD3ripURTInput* AttributeD3ripURTEvent::InputPrototypep(void) { 00243 AttributeD3ripURTInput* attrp= new AttributeD3ripURTInput(); 00244 return attrp; 00245 } 00246 00247 /* 00248 ********************************************** 00249 ********************************************** 00250 ********************************************** 00251 00252 implementation: d3ripURTDevice 00253 00254 ********************************************** 00255 ********************************************** 00256 ********************************************** 00257 */ 00258 00259 00260 // autoregister 00261 AutoRegisterType<d3ripURTDevice> gRtiRegisterD3ripURTDevice("D3ripURTDevice"); 00262 00263 // faudes type std 00264 FAUDES_TYPE_IMPLEMENTATION(D3ripURTDevice,d3ripURTDevice,vDevice) 00265 void* DoListenModule(void* threadArg); 00266 00267 //////////////////////////////////////////////// 00268 // construction and destruction 00269 00270 // constructor 00271 d3ripURTDevice::d3ripURTDevice(void) : vDevice() { 00272 FD_DHV("d3ripURTDevice(" << mName << ")::d3ripURTDevice()"); 00273 // have event set with appropriate attributes 00274 mpConfiguration = new TaNameSet<AttributeD3ripURTEvent>; 00275 pConfiguration = dynamic_cast< TaNameSet<AttributeD3ripURTEvent>* >(mpConfiguration); 00276 // have appropriate default label for token io 00277 mDefaultLabel ="D3ripURTDevice"; 00278 // configuration defaults 00279 mName="D3ripURTDevice"; 00280 } 00281 00282 00283 //~d3ripURTDevice() 00284 d3ripURTDevice::~d3ripURTDevice(void) { 00285 // destructor 00286 FD_DHV("d3ripURTDevice(" << mName << ")::~d3ripURTDevice()"); 00287 } 00288 00289 00290 // Clear() 00291 void d3ripURTDevice::Clear(void) { 00292 //delete static data 00293 FD_DHV("d3ripURTDevice(" << mName << ")::Clear()"); 00294 // call base; note: clear implies stop (incl. all eventg attributes) 00295 vDevice::Clear(); 00296 // clear compiled data 00297 // xxxx 00298 } 00299 00300 00301 // Start(void) 00302 void d3ripURTDevice::Start(void) { 00303 //set device state and create thread 00304 00305 //return if device was allready started 00306 if( (mState == Up)||(mState == StartUp) ) return; 00307 FD_DHV("d3ripURTDevice("<<mName<<")::Start()"); 00308 //call base incl virtual reset 00309 vDevice::Start(); 00310 mState=StartUp; 00311 //create background for listening module 00312 if (mlockall(MCL_CURRENT | MCL_FUTURE)) {/*Lock all process memory pages in RAM(disable paging)*/ 00313 perror("mlockall failed:"); 00314 } 00315 struct sched_param scheduling_parameters; 00316 scheduling_parameters.sched_priority = sched_get_priority_max(SCHED_FIFO); 00317 sched_setscheduler(0, SCHED_FIFO, &scheduling_parameters); 00318 00319 NameSet::Iterator eit; 00320 for(eit=pConfiguration->Begin(); eit != pConfiguration->End(); eit++) { 00321 00322 AttributeD3ripURTEvent attr; 00323 attr = pConfiguration->Attribute(*eit); 00324 const AttributeD3ripURTOutput* oattr = attr.Outputp(); 00325 if(!oattr) continue; 00326 00327 FD_DHV("d3ripURTDevice("<<mName<<") demo: output idx " << *eit); 00328 FD_DHV("d3ripURTDevice("<<mName<<") demo: output name " << pConfiguration->SymbolicName(*eit)); 00329 FD_DHV("d3ripURTDevice("<<mName<<") demo: Channel To Transmit: " << oattr->mChannelToTransmit); 00330 } 00331 00332 pthread_create(&mThreadListenModule, NULL, &DoListenCLModule, this); 00333 mState=Up; 00334 00335 } 00336 00337 // Stop() 00338 void d3ripURTDevice::Stop(void) { 00339 //return if device allready got the command to shut down 00340 if(mState != Up && mState !=StartUp) return; 00341 FD_DHV("d3ripURTDevice("<<mName<<")::Stop()"); 00342 //set device state, kill thread and close message queues 00343 mContinueListening=0; 00344 mq_close(mMQueueToSend); 00345 mq_close(mMQueueToReceive); 00346 pthread_kill(mThreadListenModule, SIGTERM); 00347 // call base 00348 vDevice::Stop(); 00349 }//end Stop() 00350 00351 00352 //Reset() 00353 void d3ripURTDevice::Reset(void){ 00354 //delete dynamic data 00355 FD_DHV("d3ripURTDevice("<<mName<<")::Reset()"); 00356 // call base (resets time) 00357 vDevice::Reset(); 00358 // xxxxx 00359 } 00360 00361 //Compile(void) 00362 void d3ripURTDevice::Compile(void){ 00363 //setup up internal data structure 00364 mContinueListening=1; 00365 struct mq_attr wanted_attrs; 00366 wanted_attrs.mq_flags=0; 00367 wanted_attrs.mq_maxmsg=10; 00368 wanted_attrs.mq_msgsize=1500; 00369 wanted_attrs.mq_curmsgs=0; 00370 00371 mMQueueToSend = mq_open("/MQUEUE_AP2CL_ID", O_RDWR | O_CREAT, S_IRWXU | S_IRWXG , &wanted_attrs); 00372 00373 if(mMQueueToSend==-1 || mMQueueToReceive==-1) { 00374 FD_DHV("d3ripURTDevice("<<mName<<"): Cannot Open Message Queue"); 00375 } 00376 00377 int i=0; 00378 int j=0; 00379 NameSet::Iterator eit; 00380 for(eit=pConfiguration->Begin(); eit != pConfiguration->End(); eit++) { 00381 00382 AttributeD3ripURTEvent attr; 00383 attr = pConfiguration->Attribute(*eit); 00384 const AttributeD3ripURTOutput* oattr = attr.Outputp(); 00385 const AttributeD3ripURTInput* iattr = attr.Inputp(); 00386 00387 if(oattr) { 00388 //maps a global EventId for all output event names for the consistency between controllers 00389 mEventIdMap[mOutputs.SymbolicName(*eit)] = oattr->mEventId; 00390 //header part 00391 mEventParameters[i][D3RIP_URT_EVENT_ID]=*eit; 00392 mEventParameters[i][D3RIP_URT_CHANNEL_TO_TRANSMIT]=oattr->mChannelToTransmit; 00393 00394 //and the parameters 00395 for(j=0;j<oattr->mParameterRecords.size();j++) { 00396 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_DESTIONATION_NODE]=oattr->mParameterRecords[j].destinationNode; 00397 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_DESTIONATION_CHANNEL]=oattr->mParameterRecords[j].destinationChannel; 00398 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_ELIGIBILITY_TIME]=oattr->mParameterRecords[j].eligibilityTime; 00399 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_DEADLINE_TIME]=oattr->mParameterRecords[j].deadlineTime; 00400 } 00401 //set the parameter count field in the end 00402 mEventParameters[i][D3RIP_URT_PARAMETER_COUNT]=j; 00403 i++; 00404 } 00405 else if(iattr) { 00406 mEventIdMap[mInputs.SymbolicName(*eit)] = iattr->mEventId; 00407 } 00408 else 00409 continue; 00410 } 00411 mEventCount=i; 00412 FD_DHV("d3ripURTDevice(" << mName << ")::Compile()"); 00413 // call base 00414 vDevice::Compile(); 00415 } 00416 00417 // send/execute output event 00418 void d3ripURTDevice::WriteOutput(Idx output) { 00419 int i; 00420 int j; 00421 int messageLength=0; 00422 mEventsToSendCount=0; 00423 for(i=0;i<mEventCount;i++) { 00424 if(mEventParameters[i][D3RIP_URT_EVENT_ID]==output){ 00425 //populate the mCommunicationRequests array with Communication requests of the event(s) 00426 for(j=0;j<mEventParameters[i][D3RIP_URT_PARAMETER_COUNT];j++){ 00427 00428 mCommunicationRequests[mCommunicationRequestCount].destinationNode= 00429 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_DESTIONATION_NODE]; 00430 00431 mCommunicationRequests[mCommunicationRequestCount].destinationChannel= 00432 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_DESTIONATION_CHANNEL]; 00433 00434 mCommunicationRequests[mCommunicationRequestCount].eligibilityTime= 00435 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_ELIGIBILITY_TIME]; 00436 00437 mCommunicationRequests[mCommunicationRequestCount].deadlineTime= 00438 mEventParameters[i][D3RIP_URT_HEADER_SIZE+j*D3RIP_URT_PARAMETER_SIZE+D3RIP_URT_DEADLINE_TIME]; 00439 00440 00441 mCommunicationRequestCount++; 00442 } 00443 //store Ids for event(s) in unsigned char format 00444 mEventIdsToSend[mEventsToSendCount]=output; 00445 mEventsToSendCount++; 00446 break; 00447 } 00448 } 00449 FlushOutput(1); 00450 } 00451 00452 void d3ripURTDevice::FlushOutput(unsigned char channel) { 00453 int i; 00454 int msgLength; 00455 char msgToSend[D3RIP_RT_MESSAGE_MAX_LENGTH]; 00456 msgToSend[0]=1; 00457 msgToSend[1]=mCommunicationRequestCount; 00458 for(i=0;i<mCommunicationRequestCount;i++){ 00459 msgToSend[2+D3RIP_URT_DESTIONATION_NODE+i*D3RIP_URT_PARAMETER_SIZE]=mCommunicationRequests[i].destinationNode; 00460 msgToSend[2+D3RIP_URT_DESTIONATION_CHANNEL+i*D3RIP_URT_PARAMETER_SIZE]=mCommunicationRequests[i].destinationChannel; 00461 msgToSend[2+D3RIP_URT_ELIGIBILITY_TIME+i*D3RIP_URT_PARAMETER_SIZE]=mCommunicationRequests[i].eligibilityTime; 00462 msgToSend[2+D3RIP_URT_DEADLINE_TIME+i*D3RIP_URT_PARAMETER_SIZE]=mCommunicationRequests[i].deadlineTime; 00463 } 00464 00465 msgToSend[2+mCommunicationRequestCount*D3RIP_URT_PARAMETER_SIZE]=mEventsToSendCount; 00466 for(i=0;i<mEventsToSendCount;i++) { 00467 msgToSend[i+3+mCommunicationRequestCount*D3RIP_URT_PARAMETER_SIZE]=mEventIdMap[mOutputs.SymbolicName(mEventIdsToSend[i])]; 00468 //printf("Event Send! Idx: %d",mEventIdMap[mOutputs.SymbolicName(mEventIdsToSend[i])]); 00469 } 00470 00471 msgLength=i+3+mCommunicationRequestCount*D3RIP_URT_PARAMETER_SIZE; 00472 if(msgLength>D3RIP_RT_MESSAGE_MAX_LENGTH){ 00473 FD_DHV("RT Message Length exceeds MAX limit!"); 00474 return; 00475 } 00476 mq_send(mMQueueToSend,(char*)&msgToSend[0],msgLength,0); 00477 00478 //reset counters for events and CRs 00479 mCommunicationRequestCount=0; 00480 mEventsToSendCount=0; 00481 } 00482 00483 00484 //DoWritePreface(rTw,rLabel,pContext) 00485 void d3ripURTDevice::DoWritePreface(TokenWriter& rTw, const std::string& rLabel, const Type* pContext) const{ 00486 FD_DHV("d3ripURTDevice("<<mName<<")::DoWritePreface()"); 00487 //call base 00488 vDevice::DoWritePreface(rTw,rLabel,pContext); 00489 } 00490 00491 //DoReadPreface(rTr,rLabel,pContext) 00492 void d3ripURTDevice::DoReadPreface(TokenReader& rTr,const std::string& rLabel, const Type* pContext){ 00493 FD_DHV("d3ripURTDevice("<<mName<<")::DoReadPreface()"); 00494 // call base 00495 vDevice::DoReadPreface(rTr,rLabel,pContext); 00496 } 00497 00498 //DoListenCLModule(d3ripURTDevice) 00499 void* DoListenCLModule(void* threadArg){ 00500 d3ripURTDevice* pD3ripURTDevice = (d3ripURTDevice*)threadArg; 00501 int i; 00502 int length; 00503 int communicationRequestCount; 00504 int eventIdCount; 00505 unsigned char receivedEventId; 00506 char msg[D3RIP_RT_MESSAGE_MAX_LENGTH]; 00507 struct timespec timeout; 00508 mq_attr attr; 00509 mq_getattr(pD3ripURTDevice->mMQueueToReceive,&attr); 00510 std::map<std::string,int>::iterator ii; 00511 int evIndexToProcess; 00512 struct timespec ts,tr; 00513 ts.tv_sec = 1; 00514 ts.tv_nsec = 0; 00515 nanosleep(&ts, &tr); 00516 ts.tv_sec = 0; 00517 ts.tv_nsec = 5000; 00518 00519 fflush(stdout); 00520 mqd_t mMQueueToReceive = mq_open("/MQUEUE_CL2AP_ID", O_RDWR | O_CREAT, S_IRWXU | S_IRWXG , 0); 00521 fflush(stdout); 00522 for(;;) { 00523 00524 clock_gettime(CLOCK_REALTIME, &timeout); 00525 timeout.tv_sec += 1; 00526 length = mq_receive(mMQueueToReceive, msg, 1500, 0); 00527 nanosleep(&ts, &tr); 00528 if(length > 0) 00529 { 00530 FD_DHV("CL2AP received"); 00531 communicationRequestCount=msg[0]; 00532 if(communicationRequestCount>0) { 00533 fflush(stdout); 00534 } 00535 00536 eventIdCount=msg[1+communicationRequestCount*D3RIP_URT_PARAMETER_SIZE]; 00537 for(i=0;i<eventIdCount;i++){ 00538 receivedEventId=msg[i+2+communicationRequestCount*D3RIP_URT_PARAMETER_SIZE]; 00539 fflush(stdout); 00540 for( ii=pD3ripURTDevice->mEventIdMap.begin(); ii!=pD3ripURTDevice->mEventIdMap.end(); ++ii) 00541 { 00542 if((*ii).second==receivedEventId) { 00543 evIndexToProcess=pD3ripURTDevice->mInputs.Index((*ii).first.c_str()); 00544 if(pD3ripURTDevice->mInputs.Exists(evIndexToProcess)) { 00545 pthread_mutex_lock(pD3ripURTDevice->pBufferMutex); 00546 pD3ripURTDevice->pInputBuffer->push_back(evIndexToProcess); 00547 pthread_mutex_unlock(pD3ripURTDevice->pBufferMutex); 00548 //printf("event received! %d->%d\n",receivedEventId,evIndexToProcess); 00549 pthread_mutex_lock(pD3ripURTDevice->pWaitMutex); 00550 pthread_cond_broadcast(pD3ripURTDevice->pWaitCondition); 00551 pthread_mutex_unlock(pD3ripURTDevice->pWaitMutex); 00552 //printf("event notification sent!\n"); 00553 fflush(stdout); 00554 } 00555 } 00556 } 00557 } 00558 } 00559 if( !pD3ripURTDevice->mContinueListening ) { 00560 FD_DHV("Stopping the CL Listener"); 00561 break; 00562 }; 00563 } 00564 return NULL; 00565 } 00566 00567 }//end namespace faudes 00568 00569 #endif // configure 00570 libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |