bool KUniqueApplication::process(const TQCString &fun, const TQByteArray &data, TQCString &replyType, TQByteArray &replyData) { if (fun == "newInstance()") { delayRequest(fun, data); return true; } else return DCOPObject::process(fun, data, replyType, replyData); }
xSemaphoreTake(timeProt.synchroTimeReceive,500/portTICK_RATE_MS); Enable_global_interrupt(); while(1){ sender(); if(timeProt.synchroTimeReceive!=NULL){ if( xSemaphoreTake(timeProt.synchroTimeReceive,500/portTICK_RATE_MS) == pdTRUE ){ receiver(); } } correction(); } } void sender(void){ #ifdef MASTERMODE uint8_t i; for(i=1;i<=MAX_SLAVE_CLOCK;i++){ //taskENTER_CRITICAL(); unsigned long int timeSender=timeProt.saveTime[i].second; //taskEXIT_CRITICAL(); if(timeSender!=0){ //printf("id : %d , delay response time second : %lu",i,timeSender);
sendHMI(" end correction"); return true; } else{ sendHMI(" end correction"); return false; } } return false; } void timeProtocolTask(void){ Disable_global_interrupt(); #ifdef MASTERMODE uint8_t i ; for(i=0;i<=MAX_SLAVE_CLOCK;i++){ timeProt.saveTime[i].second=0; } #else timeProt.rx.sign=true; timeProt.rxDelay.sign=true; timeProt.rxSync.sign=true; timeProt.tx.sign=true; #endif timeProt.correction.nbCorrection=0; sumOffset.second=0; sumOffset.halfmillis=0; sumOffset.sign=true; timeProt.correction.currentTimeOffsetSync.second=0; timeProt.correction.currentTimeOffsetSync.halfmillis=0; timeProt.correction.currentTimeOffsetSync.sign=true; timeProt.correction.previoustimeOffset.second=0; timeProt.correction.previoustimeOffset.halfmillis=0; timeProt.correction.previoustimeOffset.sign=true; //timeProt.correction.timeSoftCor=0; timeProt.correction.indiceMoySoftCor=0; timeProt.correction.indiceFull=0; timeProt.delay.second=0; timeProt.delay.halfmillis=0; timeProt.delay.sign=true; timeProt.waitIdentifier=false; timeProt.synchroTime=NULL; vSemaphoreCreateBinary(timeProt.synchroTime); Enable_global_interrupt(); #ifdef SLAVEMODE delayRequest(); #else sync(); #endif while(1){ //sendHMI("time protocol task.");