Changeset 4482
- Timestamp:
- 08/04/04 16:36:29 (20 years ago)
- Location:
- trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/amcmotor.cpp
r3401 r4482 34 34 35 35 /** No descriptions */ 36 void AMCMotor::sendCommand(const QCString& p_sCommand, QCString& p_sResponse ) const36 void AMCMotor::sendCommand(const QCString& p_sCommand, QCString& p_sResponse, int p_iExpRes ) const 37 37 { 38 38 char buffer[256]; … … 58 58 { 59 59 // sleep 30 ms to be sure to get the whole response 60 usleep(30000); 60 // usleep(30000); 61 // max = p_iExpRes + iNumEcho; 61 62 max = 255; 62 63 } … … 64 65 max = iNumEcho; 65 66 // max = NUM_ECHO; 67 usleep(10000); 66 68 int rlen = m_pPort->readBlock( buffer, max ); 67 69 // set the end of the response string to a 0 char to … … 70 72 rrlen = rlen; 71 73 } 72 74 75 /* 76 if( p_sCommand.contains("B0") != 0 ) 77 { 78 QString sResult, qsTemp; 79 for( int i=0; i< rrlen; i++) 80 sResult += qsTemp.sprintf(" %02X",(unsigned char) buffer[i]); 81 qDebug( sResult ); 82 } 83 */ 84 73 85 // Reset and unselect commands will not return any status 74 86 if( (p_sCommand == IDS_COMMAND_UNSELECT_BOX) … … 81 93 (buffer[rrlen-1] != '>') ) 82 94 { 83 usleep(20000);84 int rlen = m_pPort->readBlock( buffer+rrlen, 255);95 // usleep(20000); 96 int rlen = m_pPort->readBlock( buffer+rrlen, IDS_CMD_RES_INFO ); 85 97 qDebug("Second iteration for info command. %d bytes", rlen); 86 98 buffer[rrlen+rlen] = 0; … … 150 162 // send the query command 151 163 sComm.sprintf( IDS_COMMAND_QUERY ); 152 sendCommand( sComm, sResp2 );164 sendCommand( sComm, sResp2, IDS_CMD_RES_QUERY ); 153 165 154 166 // The response should contain the error code in HEX plus '\r>' … … 187 199 // of the box are outside the range. Lets find out which. 188 200 sComm.sprintf( IDS_COMMAND_INFO ); 189 sendCommand( sComm, sResp2 );201 sendCommand( sComm, sResp2, IDS_CMD_RES_INFO ); 190 202 191 203 aErr.setCommand( p_sCommand + " - " + sComm ); … … 236 248 QCString sComm, sResp; 237 249 250 m_pPort->flush(); 238 251 sComm.sprintf( IDS_COMMAND_BOX, p_iBox ); 239 sendCommand( sComm, sResp ); 252 try 253 { 254 sendCommand( sComm, sResp, IDS_CMD_RES_BOX ); 255 } 256 catch( AMCError& e) 257 { 258 } 259 sComm.sprintf( IDS_COMMAND_QUERY, p_iBox ); 260 sendCommand( sComm, sResp, IDS_CMD_RES_QUERY ); 240 261 } 241 262 … … 247 268 248 269 sComm.sprintf( IDS_COMMAND_DRIVER, p_iDriver-1 ); 249 sendCommand( sComm, sResp );270 sendCommand( sComm, sResp, IDS_CMD_RES_DRIVER ); 250 271 m_iCurrDriver = p_iDriver; 251 272 return; … … 272 293 qDebug("Sending kill command"); 273 294 sComm.sprintf( IDS_COMMAND_KILL ); 274 sendCommand( sComm, sResp );295 sendCommand( sComm, sResp, IDS_CMD_RES_KILL ); 275 296 return; 276 297 } … … 287 308 288 309 sComm.sprintf( IDS_COMMAND_INFO ); 289 sendCommand( sComm, sResp );310 sendCommand( sComm, sResp, IDS_CMD_RES_INFO ); 290 311 sscanf( (const char*) sResp, 291 312 "T=%d\rH=%d\rI=%d\rV=%d\rS=%d\rL=%d\r", … … 306 327 307 328 sComm.sprintf( IDS_COMMAND_FREQUENCY_READ ); 308 sendCommand( sComm, sResp );329 sendCommand( sComm, sResp, IDS_CMD_RES_FREQUENCY_READ ); 309 330 310 331 int iFrequency; … … 320 341 321 342 sComm.sprintf( IDS_COMMAND_FREQUENCY_WRITE, p_iFreq ); 322 sendCommand( sComm, sResp );343 sendCommand( sComm, sResp, IDS_CMD_RES_FREQUENCY_WRITE ); 323 344 m_iCurrFreq = p_iFreq; 324 345 … … 332 353 333 354 sComm.sprintf( IDS_COMMAND_WORKING_READ ); 334 sendCommand( sComm, sResp );355 sendCommand( sComm, sResp, IDS_CMD_RES_WORKING_READ ); 335 356 336 357 int iCurrent; … … 345 366 346 367 sComm.sprintf( IDS_COMMAND_WORKING_WRITE, p_iCurrent ); 347 sendCommand( sComm, sResp );368 sendCommand( sComm, sResp, IDS_CMD_RES_WORKING_WRITE ); 348 369 349 370 return; … … 356 377 357 378 sComm.sprintf( IDS_COMMAND_HOLDING_READ ); 358 sendCommand( sComm, sResp );379 sendCommand( sComm, sResp, IDS_CMD_RES_HOLDING_READ ); 359 380 360 381 int iCurrent; … … 369 390 370 391 sComm.sprintf( IDS_COMMAND_HOLDING_WRITE, p_iCurrent ); 371 sendCommand( sComm, sResp );392 sendCommand( sComm, sResp, IDS_CMD_RES_HOLDING_READ ); 372 393 373 394 return; … … 383 404 else 384 405 sComm.sprintf( IDS_COMMAND_LASER_OFF ); 385 sendCommand( sComm, sResp );406 sendCommand( sComm, sResp, IDS_CMD_RES_LASER_ON ); 386 407 387 408 return; … … 401 422 else 402 423 sComm.sprintf( IDS_COMMAND_POWER_OFF ); 403 sendCommand( sComm, sResp );424 sendCommand( sComm, sResp, IDS_CMD_RES_POWER_ON ); 404 425 405 426 return; … … 412 433 413 434 sComm.sprintf( IDS_COMMAND_CENTER ); 414 sendCommand( sComm, sResp );435 sendCommand( sComm, sResp, IDS_CMD_RES_CENTER ); 415 436 416 437 return; … … 426 447 427 448 sComm.sprintf( IDS_COMMAND_MOVE, p_iX, p_iY ); 428 sendCommand( sComm, sResp );449 sendCommand( sComm, sResp, IDS_CMD_RES_MOVE ); 429 450 430 451 return; … … 480 501 throw aErr; 481 502 } 482 sendCommand( sComm, sResp );503 sendCommand( sComm, sResp, IDS_CMD_RES_QUERY ); 483 504 if( sResp[0] != '@' ) 484 505 { … … 514 535 515 536 sComm.sprintf( IDS_COMMAND_UNSELECT_BOX ); 516 sendCommand( sComm, sResp );537 sendCommand( sComm, sResp, IDS_CMD_RES_UNSELECT_BOX ); 517 538 518 539 return; … … 525 546 526 547 sComm.sprintf( IDS_COMMAND_RESET ); 527 sendCommand( sComm, sResp );548 sendCommand( sComm, sResp, IDS_CMD_RES_RESET ); 528 549 529 550 return; … … 536 557 537 558 sComm.sprintf( IDS_COMMAND_DRIVER_RESET ); 538 sendCommand( sComm, sResp );539 540 return; 541 } 559 sendCommand( sComm, sResp, IDS_CMD_RES_DRIVER_RESET ); 560 561 return; 562 } -
trunk/MagicSoft/AMC/activemirrorcontrol/activemirrorcontrol/amcmotor.h
r3401 r4482 122 122 private: // Private methods 123 123 /** No descriptions */ 124 void sendCommand(const QCString& p_sCommand, QCString& p_sResponse ) const;124 void sendCommand(const QCString& p_sCommand, QCString& p_sResponse, int p_iExpRes ) const; 125 125 126 126 private: // Private attributes
Note:
See TracChangeset
for help on using the changeset viewer.