C++ (Qt)void RxThread::run(){ forever{ if(!startThread){ qDebug()<<"Out of thread"; Q_EMIT receiveStop(); break; } int ret = CiWaitEvent(cw,1,500); //0.5sec if(ret > 0){ if(cw->rflags & CI_WAIT_RC){ canmsg_t msg_in; int retRd = CiRead(cw->chan,&msg_in,1); qDebug()<<"Read well done "<<retRd; if(retRd > 0){ Q_EMIT receivedMsg(&msg_in); //при приеме высылается сигнал } else{ qDebug()<<"Read Error = "<<retRd; //Q_EMIT () не считал } } if(cw->rflags & CI_WAIT_ER){ qDebug()<<"CI_WAIT_ER RECEIVE"; //canerrs_t errs; int retErr = CiErrsGetClear(cw->chan,&errs); qDebug()<<"Rx_Thrad retErr = "<<retErr; if(retErr >= 0){ if(errs.ewl){ qDebug()<<"EWL times Rx"<<errs.ewl; //общ f_err = true; qDebug()<<"Rx_Thread f_err = "<<f_err; mutex_event_tx.unlock(); } if(errs.boff){ qDebug()<<"BOFF times"<<errs.boff; //общ } if(errs.hwovr){ qDebug()<<"HOVR times"<<errs.hwovr; //rx } if(errs.swovr){ qDebug()<<"SOVR times"<<errs.swovr; //rx } if(errs.wtout){ qDebug()<<"WTOUT times Rx"<<errs.wtout; //tx f_err = true; qDebug()<<"Rx_Thread f_err = "<<f_err; mutex_event_tx.unlock(); } } } } else if(ret < 0){ qDebug()<<"Error CiWaitEvent = "<<ret; } else{ qDebug()<<"Time Out Rx"; Q_EMIT receiveTimeOut(); } qDebug()<<"receive thread go"; qDebug()<<"ret = "<<ret; }}
C++ (Qt)void SuperVisor::initStartThreadRx(){ qDebug()<<__FUNCTION__; threadRx = new ReceiveThread(&cw); connect(threadRx,SIGNAL(receivedMsg(canmsg_t*)),this,SLOT(parseFrame(canmsg_t*)),Qt::DirectConnection); connect(threadRx,SIGNAL(receivedMsg(canmsg_t*)),this,SLOT(strRxFrameData(canmsg_t*)),Qt::DirectConnection); connect(threadRx,SIGNAL(receiveTimeOut()),this,SIGNAL(timeOutReceive()),Qt::DirectConnection); connect(threadRx,SIGNAL(receiveStop()),this,SIGNAL(stopReceive()),Qt::DirectConnection); threadRx->startThread = true; threadRx->start();} void SuperVisor::parseFrame(canmsg_t *msg){ qDebug()<<__FUNCTION__; if(msg != NULL){ _u16 frameIdAdr = (_u16)(msg->id & 0x0F); switch(frameIdAdr){ case BKT:{ _u16 frameIdCop = (_u16)(msg->id >> 7); qDebug()<<"cop BKT"; switch(frameIdCop){ case status_block:{ qDebug()<<"BKT status"; Q_EMIT receiveStatusBKT(msg); break; } case current_data:{ qDebug()<<"BKT current data"; Q_EMIT receiveDataBKT(msg); break; } default:{ break; } } break; } }} BKT_Widget * MainWindow::createWidgetBKT(){ bktWidget = new BKT_Widget(); connect(superVisor,SIGNAL(receiveDataBKT(canmsg_t*)),bktWidget,SLOT(currentDataReceive(canmsg_t*))); connect(superVisor,SIGNAL(receiveStatusBKT(canmsg_t*)),bktWidget,SLOT(statusBlockReceive(canmsg_t*))); ... connect(bktWidget,SIGNAL(closeWidget()),this,SLOT(closeWidgetBKT())); return bktWidget;}
C++ (Qt)void BKT_Widget::currentDataReceive(canmsg_t *msg){ canmsg_t *msgData = NULL; msgData = msg; //little-endian if(msgData != NULL){ float T1; qDebug()<<msgData; T1 = *(float*)(&(msgData->data[0])); //!!!!! Error T2 = *(float*)(&(msgData->data[4])); qDebug()<<"T1 = "<<T1; qDebug()<<"T2 = "<<T2; ui->leT1->setText(QVariant(T1).toString()); ui->leT2->setText(QVariant(T2).toString()); }}
C++ (Qt)void SuperVisor::stopProcess(){ if(thread_Rx != NULL){ thread_Rx->startThread = false; thread_Rx->quit(); thread_Rx->wait(); delete thread_Rx; thread_Rx = NULL; } CiStop(portInstall.number); CiClose(portInstall.number); fInst = false;}
C++ (Qt)void BKT_Widget::currentDataReceive(canmsg_t *msg){ canmsg_t *msgData = NULL; msgData = msg; //little-endian if(msgData != NULL){ float T1; qDebug()<<msgData; T1 = *(float*)(&(msgData->data[0])); //!!!!! Error ВЫЛЕТАЕТ T2 = *(float*)(&(msgData->data[4])); qDebug()<<"T1 = "<<T1; qDebug()<<"T2 = "<<T2; ui->leT1->setText(QVariant(T1).toString()); ui->leT2->setText(QVariant(T2).toString()); }}
C++ (Qt)connect(threadRx,SIGNAL(receivedMsg(canmsg_t*)),this,SLOT(parseFrame(canmsg_t*)),Qt::DirectConnection);connect(threadRx,SIGNAL(receivedMsg(canmsg_t*)),this,SLOT(strRxFrameData(canmsg_t*)),Qt::DirectConnection);
C++ (Qt)connect(threadRx,SIGNAL(receivedMsg(canmsg_t )),this,SLOT(parseFrame(canmsg_t )),Qt::DirectConnection);connect(threadRx,SIGNAL(receivedMsg(canmsg_t )),this,SLOT(strRxFrameData(canmsg_t )),Qt::DirectConnection);
C++ (Qt)BKT_Widget * MainWindow::createWidgetBKT(){ bktWidget = new BKT_Widget(); connect(superVisor,SIGNAL(receiveDataBKT(canmsg_t)),bktWidget,SLOT(currentDataReceive(canmsg_t)),Qt::DirectConnection); connect(superVisor,SIGNAL(receiveStatusBKT(canmsg_t)),bktWidget,SLOT(statusBlockReceive(canmsg_t)),Qt::DirectConnection); ... connect(bktWidget,SIGNAL(closeWidget()),this,SLOT(closeWidgetBKT())); return bktWidget;}
internal error: pc 0xf in read in psymtab but not in symtab