00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "PCanDevice.h"
00019 #include <errno.h>
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 int CPCanDevice::getDeviceError(int iErrorState)
00036 {
00037 int error = ERRID_DEV_WRITEERROR;
00038
00039 if(((unsigned int)iErrorState & 0xFFFF) & CAN_ERR_QRCVEMPTY)
00040 {
00041 warning("receive queue is empty");
00042 error= ERRID_DEV_WRITEERROR;
00043 }
00044 if(iErrorState & CAN_ERR_OVERRUN)
00045 {
00046 warning("receive buffer overrun");
00047 error= ERRID_DEV_READERROR;
00048 }
00049 if(iErrorState & CAN_ERR_XMTFULL)
00050 {
00051 warning("transmit buffer full");
00052 error = ERRID_DEV_WRITEERROR;
00053 }
00054 if(iErrorState & CAN_ERR_BUSOFF)
00055 {
00056 warning("CAN_ERR_OFF_BUS");
00057 error = ERRID_DEV_READERROR;
00058 }
00059 if(iErrorState & CAN_ERR_ILLPARAMTYPE )
00060 {
00061 warning("CAN_ERR_ILLPARAMTYPE");
00062 error = ERRID_DEV_READERROR;
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 if(((unsigned int)iErrorState & 0xFFFF) & CAN_ERR_QXMTFULL)
00084 {
00085 warning("transmit queue full");
00086 error = ERRID_DEV_WRITEERROR;
00087 }
00088 if(iErrorState & CAN_ERR_BUSLIGHT)
00089 {
00090 warning("bus error");
00091 error = ERRID_DEV_WRITEERROR;
00092 }
00093 if(((unsigned int)iErrorState & 0xFFFF) & CAN_ERR_BUSHEAVY)
00094 {
00095 warning("bus error");
00096 error = ERRID_DEV_WRITEERROR;
00097 }
00098 if(((unsigned int)iErrorState & 0xFFFF) & CAN_ERR_RESOURCE)
00099 {
00100 warning("can't create resource");
00101 error = ERRID_DEV_WRITEERROR;
00102 }
00103
00104 return error;
00105 }
00106
00107
00108 int CPCanDevice::setBaudRate(unsigned char iBaudRate)
00109 {
00110 m_uiBaudRate = (unsigned long) iBaudRate;
00111 return setBaudRate();
00112 }
00113
00114
00115 int CPCanDevice::setBaudRate()
00116 {
00117
00118
00119
00120
00121
00122 debug(0,"entering CPCanDevice::setBaudRate()...\n");
00123 warning("PCan Device must be reset to set the new baud rate!\n");
00124
00125 int iRetVal = 0;
00126 m_iErrorState = 0;
00127
00128 switch( m_iBaudRate )
00129 {
00130 case 125:
00131 m_uiBaudRate=CAN_BAUD_125K;
00132 break;
00133 case 250:
00134 m_uiBaudRate=CAN_BAUD_250K;
00135 break;
00136 case 500:
00137 m_uiBaudRate=CAN_BAUD_500K;
00138 break;
00139 case 1000:
00140 m_uiBaudRate=CAN_BAUD_1M;
00141 break;
00142 default:
00143 m_uiBaudRate=CAN_BAUD_250K;
00144 break;
00145 }
00146
00147
00148 if (m_bInitFlag)
00149 {
00150 CAN_Close(m_handle);
00151 }
00152 iRetVal = init(m_uiBaudRate);
00153 debug(0,"InitFlag set to %d\n",m_bInitFlag);
00154 if(iRetVal != CAN_ERR_OK)
00155 {
00156 warning("can set baudrate 0x%x failed Errorcode: %d", m_uiBaudRate, iRetVal);
00157 getDeviceError(iRetVal);
00158 m_iErrorState = ERRID_DEV_INITERROR;
00159 return m_iErrorState;
00160 }
00161 else
00162 {
00163 debug(0,"PCanDevice: setting baud rate to %d\n",m_iBaudRate);
00164 }
00165 return m_iErrorState;
00166 }
00167
00168
00169 int CPCanDevice::setMessageId(unsigned long uiMessageId)
00170 {
00171 int iRetVal = 0;
00172 m_iErrorState = 0;
00173
00174 iRetVal = CAN_MsgFilter(m_handle, uiMessageId ,uiMessageId,MSGTYPE_STANDARD);
00175 if(iRetVal != CAN_ERR_OK)
00176 {
00177 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00178 getDeviceError(iRetVal);
00179 m_iErrorState = ERRID_DEV_INITERROR;
00180 return m_iErrorState;
00181 }
00182 return m_iErrorState;
00183 }
00184
00185
00186 int CPCanDevice::clearReadQueue()
00187 {
00188 int iRetVal = 0;
00189 TPCANRdMsg TPCMsg;
00190
00191 debug(0,"entering CPCanDevice::clearReadQueue()...\n");
00192 TPCMsg.Msg.LEN = 8;
00193 TPCMsg.Msg.MSGTYPE = 0;
00194 TPCMsg.Msg.ID = 0;
00195
00196 m_iErrorState = 0;
00197 do
00198 {
00199
00200 debug(0,"Trying to read messages ...");
00201 iRetVal = LINUX_CAN_Read_Timeout(m_handle, &TPCMsg, m_uiTimeOut);
00202 debug(0," 0x%04x\n",iRetVal);
00203
00204 }while( iRetVal != CAN_ERR_QRCVEMPTY ) ;
00205
00206 return m_iErrorState;
00207 }
00208
00209
00210
00211 int CPCanDevice::reinit(unsigned char ucBaudRateId)
00212 {
00213
00214 int iRetVal = 0;
00215
00216 m_iErrorState = 0;
00217 if(!m_bInitFlag)
00218 {
00219 warning("reinit:device not initialized");
00220 m_iErrorState = ERRID_DEV_NOTINITIALIZED;
00221 return m_iErrorState;
00222 }
00223 iRetVal = setBaudRate(ucBaudRateId);
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 iRetVal = CAN_MsgFilter(m_handle, MSGID_ACK ,MSGID_ACK+m_iModuleCountMax,MSGTYPE_STANDARD);
00275 if(iRetVal != CAN_ERR_OK)
00276 {
00277 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00278 getDeviceError(iRetVal);
00279 m_iErrorState = ERRID_DEV_INITERROR;
00280 return m_iErrorState;
00281 }
00282
00283 iRetVal = CAN_MsgFilter(m_handle, MSGID_STATE ,MSGID_STATE+m_iModuleCountMax,MSGTYPE_STANDARD);
00284 if(iRetVal != CAN_ERR_OK)
00285 {
00286 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00287 getDeviceError(iRetVal);
00288 m_iErrorState = ERRID_DEV_INITERROR;
00289 return m_iErrorState;
00290 }
00291
00292
00293 iRetVal = CAN_MsgFilter(m_handle, MSGID_MP55_RECV ,MSGID_MP55_RECV+MAX_MP55,MSGTYPE_STANDARD);
00294 if(iRetVal != CAN_ERR_OK)
00295 {
00296 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00297 getDeviceError(iRetVal);
00298 m_iErrorState = ERRID_DEV_INITERROR;
00299 return m_iErrorState;
00300 }
00301
00302
00303 iRetVal = CAN_MsgFilter(m_handle, 0x180 ,0x180+MAX_MP55,MSGTYPE_STANDARD);
00304 if(iRetVal != CAN_ERR_OK)
00305 {
00306 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00307 getDeviceError(iRetVal);
00308 m_iErrorState = ERRID_DEV_INITERROR;
00309 return m_iErrorState;
00310 }
00311
00312
00313 iRetVal = CAN_MsgFilter(m_handle, MSGID_SCHUNK_RECV ,MSGID_SCHUNK_RECV+MAX_SCHUNK,MSGTYPE_STANDARD);
00314 if(iRetVal != CAN_ERR_OK)
00315 {
00316 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00317 getDeviceError(iRetVal);
00318 m_iErrorState = ERRID_DEV_INITERROR;
00319 return m_iErrorState;
00320 }
00321
00322
00323 iRetVal = CAN_MsgFilter(m_handle, MSGID_ALL ,MSGID_ALL,MSGTYPE_STANDARD);
00324 if(iRetVal != CAN_ERR_OK)
00325 {
00326 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00327 getDeviceError(iRetVal);
00328 m_iErrorState = ERRID_DEV_INITERROR;
00329 return m_iErrorState;
00330 }
00331
00332 m_iErrorState = clearReadQueue();
00333 if(m_iErrorState != 0)
00334 return m_iErrorState;
00335
00336 if(m_iErrorState == 0)
00337 {
00338 m_bInitFlag = true;
00339 }
00340
00341
00342 updateModuleIdMap();
00343 return m_iErrorState;
00344 }
00345
00346
00347
00348 int CPCanDevice::readDevice(CProtocolMessage& rclProtocolMessage)
00349 {
00350 int iRetVal = 0;
00351
00352 TPCANRdMsg TPCMsg;
00353 TPCMsg.Msg.LEN = 8;
00354 TPCMsg.Msg.MSGTYPE = 0;
00355 TPCMsg.Msg.ID = 0;
00356
00357 m_iErrorState = 0;
00358 int no = 0;
00359 do
00360 {
00361 m_iErrorState = 0;
00362 iRetVal = LINUX_CAN_Read_Timeout(m_handle, &TPCMsg, m_uiTimeOut);
00363 if (iRetVal == CAN_ERR_OK)
00364 break;
00365 else
00366 CAN_Status(m_handle);
00367 no++;
00368
00369 m_iErrorState = getDeviceError(iRetVal);
00370 debug(2,"Read error (%s), attempt %d of %d",strerror(nGetLastError()),no,m_iNoOfRetries+1);
00371
00372 }while (no <= m_iNoOfRetries);
00373 if (iRetVal == CAN_ERR_OK)
00374 {
00375 rclProtocolMessage.m_uiMessageId = TPCMsg.Msg.ID;
00376 rclProtocolMessage.m_ucMessageLength = TPCMsg.Msg.LEN;
00377 memcpy(rclProtocolMessage.m_aucMessageData, TPCMsg.Msg.DATA, rclProtocolMessage.m_ucMessageLength);
00378 printMessage(rclProtocolMessage,READ);
00379 }
00380 else
00381 {
00382
00383
00384 warning("CAN read failed Errorcode: 0x%04x", iRetVal);
00385
00386 }
00387 return m_iErrorState;
00388 }
00389
00390
00391
00392 int CPCanDevice::writeDevice(CProtocolMessage& rclProtocolMessage)
00393 {
00394 int iRetVal = 0;
00395 TPCANMsg TPCMsg;
00396
00397 TPCMsg.MSGTYPE = MSGTYPE_STANDARD;
00398 m_iErrorState = 0;
00399 TPCMsg.ID = rclProtocolMessage.m_uiMessageId;
00400 printMessage(rclProtocolMessage,WRITE);
00401
00402 TPCMsg.LEN = rclProtocolMessage.m_ucMessageLength;
00403 if(rclProtocolMessage.m_bRTRFlag)
00404 TPCMsg.MSGTYPE = MSGTYPE_RTR;
00405 memcpy(TPCMsg.DATA, rclProtocolMessage.m_aucMessageData, rclProtocolMessage.m_ucMessageLength);
00406 iRetVal = CAN_Write(m_handle, &TPCMsg);
00407 if(iRetVal != CAN_ERR_OK)
00408 {
00409 warning("can send failed Errorcode:0x%04x", iRetVal);
00410 m_iErrorState = getDeviceError(iRetVal);
00411
00412 }
00413 iRetVal = CAN_Status(m_handle);
00414 if (iRetVal < 0)
00415 {
00416 warning("Last Error reported: %s",strerror(nGetLastError()));
00417 m_iErrorState = ERRID_DEV_WRITEERROR;
00418 }
00419
00420 return m_iErrorState;
00421 }
00422
00423
00424
00425
00426
00427
00428
00429 CPCanDevice::CPCanDevice() : m_hDevice(0), m_hSyncDevice(0), m_iDeviceId(-1), m_uiBaudRate(0), m_uiQueueSize(128), m_uiTimeOut(3)
00430 {
00431 initMessage("CPCanDevice", g_iDebugLevel, g_bDebug, g_bDebugFile);
00432 m_DeviceName = (char*) malloc(200 * sizeof(char));
00433 memset(m_DeviceName,0,sizeof(m_DeviceName));
00434 }
00435
00436 CPCanDevice::CPCanDevice(const CPCanDevice& rclPCanDevice)
00437 {
00438 error(-1, "Sorry constructor is not implemented");
00439 }
00440
00441 CPCanDevice::~CPCanDevice()
00442 {
00443 free(m_DeviceName);
00444 if (m_bInitFlag)
00445 this->exit();
00446 }
00447
00448
00449
00450
00451
00452
00453
00454 CPCanDevice& CPCanDevice::operator=(const CPCanDevice& rclPCanDevice)
00455 {
00456 error(-1, "Sorry operator= is not implemented");
00457 return *this;
00458 }
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472 void CPCanDevice::setQueueSize(unsigned short uiQueueSize)
00473 {
00474 m_uiQueueSize = uiQueueSize;
00475 }
00476
00477 void CPCanDevice::setTimeOut(unsigned long uiTimeOut)
00478 {
00479 m_uiTimeOut= uiTimeOut;
00480 }
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495 int CPCanDevice::init()
00496 {
00497 return init(CAN_BAUD_250K);
00498 }
00499 int CPCanDevice::init(unsigned long baudRate)
00500 {
00501 int iRetVal = CAN_ERR_OK;
00502 printf("Initializing pcan device ...\n");
00503
00504 m_handle = LINUX_CAN_Open(m_DeviceName,0);
00505
00506 if (! m_handle)
00507 {
00508
00509 printf("Error: Cannot open CAN on USB (%s): %s\n", m_DeviceName, strerror(errno));
00510 iRetVal = -1;
00511 }
00512 else
00513 {
00514 iRetVal = CAN_Init(m_handle, baudRate, CAN_INIT_TYPE_ST);
00515 }
00516 if(iRetVal != CAN_ERR_OK)
00517 {
00518 printf("PcanDevice: error in init" );
00519 }
00520 else
00521 {
00522 printf("PcanDevice, init ok\n" );
00523 m_bInitFlag = true;
00524 }
00525 return iRetVal;
00526 }
00527
00528
00529
00530
00531 int CPCanDevice::init(const char* acInitString)
00532 {
00533 InitializeCriticalSection(&m_csDevice);
00534 int iRetVal = 0;
00535 m_uiTimeOut = 100;
00536 m_iNoOfRetries = 10;
00537 char* pcToken;
00538 char acString[128];
00539 int deb = getDebugLevel();
00540 if (deb > 0)
00541 {
00542 printf("CPCanDevice::init: DebugLevel: %d\n",deb);
00543 printf("writing debug output to file debug.txt!\n");
00544 }
00545 debug(0,"entering CPCanDevice::init(const char* acInitString) ...\n");
00546 if(m_bInitFlag)
00547 {
00548 warning("device already initialized");
00549 m_iErrorState = ERRID_DEV_ISINITIALIZED;
00550 return m_iErrorState;
00551 }
00552 m_iDeviceId = -1;
00553 m_iErrorState = 0;
00554 strncpy(m_acInitString,acInitString,128);
00555 strncpy(acString,acInitString,128);
00556 pcToken = strtok( acString, ":" );
00557 if( !pcToken )
00558 { m_iErrorState = ERRID_DEV_BADINITSTRING;
00559 return m_iErrorState;
00560 }
00561 if( strcmp( pcToken, "PCAN" ) != 0 )
00562 { m_iErrorState = ERRID_DEV_BADINITSTRING;
00563 return m_iErrorState;
00564 }
00565 pcToken = strtok( NULL, "," );
00566 if( !pcToken )
00567 { m_iErrorState = ERRID_DEV_BADINITSTRING;
00568 return m_iErrorState;
00569 }
00570
00571
00572
00573
00574 m_iDeviceId = atoi(pcToken);
00575
00576
00577
00578 strncpy(m_DeviceName,pcToken,12);
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615 pcToken = strtok( NULL, "," );
00616 if( !pcToken )
00617 { m_iErrorState = ERRID_DEV_BADINITSTRING;
00618 return m_iErrorState;
00619 }
00620 m_iBaudRate = atoi(pcToken);
00621
00622
00623 try
00624 {
00625 m_handle = LINUX_CAN_Open(m_DeviceName,0);
00626 if (! m_handle)
00627 {
00628
00629 printf("Error: Cannot open CAN on USB (%s): %s\n", m_DeviceName, strerror(errno));
00630 iRetVal = -1;
00631 }
00632 else
00633 {
00634 printf("PCanDevice successfully opened on %s\n",m_DeviceName);
00635 }
00636 }
00637 catch(...)
00638 {
00639 warning("open PCAN device failed no library found");
00640 m_iErrorState = ERRID_DEV_NOLIBRARY;
00641 return m_iErrorState;
00642 }
00643
00644
00645 iRetVal = CAN_MsgFilter(m_handle, MSGID_ACK ,MSGID_ACK+m_iModuleCountMax,MSGTYPE_STANDARD);
00646 if(iRetVal != CAN_ERR_OK)
00647 {
00648 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00649 getDeviceError(iRetVal);
00650 m_iErrorState = ERRID_DEV_INITERROR;
00651 return m_iErrorState;
00652 }
00653
00654 iRetVal = CAN_MsgFilter(m_handle, MSGID_STATE ,MSGID_STATE+m_iModuleCountMax,MSGTYPE_STANDARD);
00655 if(iRetVal != CAN_ERR_OK)
00656 {
00657 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00658 getDeviceError(iRetVal);
00659 m_iErrorState = ERRID_DEV_INITERROR;
00660 return m_iErrorState;
00661 }
00662
00663
00664 iRetVal = CAN_MsgFilter(m_handle, MSGID_MP55_RECV ,MSGID_MP55_RECV+MAX_MP55,MSGTYPE_STANDARD);
00665 if(iRetVal != CAN_ERR_OK)
00666 {
00667 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00668 getDeviceError(iRetVal);
00669 m_iErrorState = ERRID_DEV_INITERROR;
00670 return m_iErrorState;
00671 }
00672
00673
00674 iRetVal = CAN_MsgFilter(m_handle, 0x180 ,0x180+MAX_MP55,MSGTYPE_STANDARD);
00675 if(iRetVal != CAN_ERR_OK)
00676 {
00677 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00678 getDeviceError(iRetVal);
00679 m_iErrorState = ERRID_DEV_INITERROR;
00680 return m_iErrorState;
00681 }
00682
00683
00684 iRetVal = CAN_MsgFilter(m_handle, MSGID_SCHUNK_RECV ,MSGID_SCHUNK_RECV+MAX_SCHUNK,MSGTYPE_STANDARD);
00685 if(iRetVal != CAN_ERR_OK)
00686 {
00687 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00688 getDeviceError(iRetVal);
00689 m_iErrorState = ERRID_DEV_INITERROR;
00690 return m_iErrorState;
00691 }
00692
00693
00694 iRetVal = CAN_MsgFilter(m_handle, MSGID_ALL ,MSGID_ALL,MSGTYPE_STANDARD);
00695 if(iRetVal != CAN_ERR_OK)
00696 {
00697 warning("Can_MsgFilter failed Errorcode: %d", iRetVal);
00698 getDeviceError(iRetVal);
00699 m_iErrorState = ERRID_DEV_INITERROR;
00700 return m_iErrorState;
00701 }
00702
00703
00704 m_iErrorState = setBaudRate();
00705 if(m_iErrorState != 0)
00706 return m_iErrorState;
00707
00708 m_iErrorState = clearReadQueue();
00709 if(m_iErrorState != 0)
00710 return m_iErrorState;
00711
00712 if(m_iErrorState == 0)
00713 {
00714 m_bInitFlag = true;
00715 debug(0,"PCanDevice:init successfull!\n");
00716 }
00717 updateModuleIdMap();
00718
00719 return m_iErrorState;
00720 }
00721
00722
00723
00724
00725 int CPCanDevice::exit()
00726 {
00727 int iRetVal = 0;
00728 m_iErrorState = 0;
00729
00730
00731
00732 TPDIAG Diag;
00733 iRetVal = LINUX_CAN_Statistics(m_handle,&Diag);
00734 debug(0,"PCanDevice: exit():");
00735 debug(0,"--------------STATISTICS-------------------");
00736 debug(0,"Total number of reads: %d",Diag.dwReadCounter);
00737 debug(0,"Total number of writes: %d",Diag.dwWriteCounter);
00738 debug(0,"Total number of interrupts: %d",Diag.dwIRQcounter);
00739 debug(0,"Total number of errors: %d",Diag.dwErrorCounter);
00740 debug(0,"Error flag: 0x%04x",Diag.wErrorFlag);
00741
00742 if(!m_bInitFlag)
00743 {
00744 warning("exit:device not initialized");
00745 m_iErrorState = ERRID_DEV_NOTINITIALIZED;
00746 return m_iErrorState;
00747 }
00748 EnterCriticalSection(&m_csDevice);
00749 iRetVal = CAN_ERR_OK;
00750 iRetVal = CAN_Close(m_handle);
00751 if(iRetVal != CAN_ERR_OK)
00752 {
00753 warning("can close failed Errorcode: %d", iRetVal);
00754 getDeviceError(iRetVal);
00755 m_iErrorState = ERRID_DEV_EXITERROR;
00756 }
00757 m_bInitFlag = false;
00758 LeaveCriticalSection(&m_csDevice);
00759 DeleteCriticalSection(&m_csDevice);
00760 return m_iErrorState;
00761 }
00762
00763 int CPCanDevice::waitForStartMotionAll()
00764 {
00765 int iRetVal = 0;
00766 bool bRecieved = false;
00767 TPCANRdMsg TPCMsg;
00768 TPCMsg.Msg.LEN = 8;
00769 TPCMsg.Msg.MSGTYPE = 0;
00770 TPCMsg.Msg.ID = 0;
00771
00772 m_iErrorState = 0;
00773 iRetVal = LINUX_CAN_Read_Timeout(m_handle, &TPCMsg, m_uiTimeOut);
00774
00775 m_iErrorState = 0;
00776
00777 do
00778 {
00779
00780 iRetVal = LINUX_CAN_Read_Timeout(m_handle, &TPCMsg, m_uiTimeOut);
00781 if(iRetVal != CAN_ERR_OK)
00782 {
00783 warning("can read failed Errorcode: 0x%04x", iRetVal);
00784 m_iErrorState = getDeviceError(iRetVal);
00785 return m_iErrorState;
00786 }
00787 bRecieved = true;
00788 if(TPCMsg.Msg.ID != MSGID_ALL)
00789 {
00790 debug(1, "received CAN-ID %x, expected %x", TPCMsg.Msg.ID, MSGID_ALL);
00791 bRecieved = false;
00792 }
00793 if(TPCMsg.Msg.DATA[0] != CMDID_STARTMOVE)
00794 {
00795 debug(1, "wrong command ID");
00796 bRecieved = false;
00797 }
00798 }
00799 while(!bRecieved);
00800 return m_iErrorState;
00801 }
00802