| 452 | |
| 453 | |
| 454 | void Transceiver::driveControl(unsigned ARFCN) |
| 455 | { |
| 456 | |
| 457 | int MAX_PACKET_LENGTH = 100; |
| 458 | |
| 459 | // check control socket |
| 460 | char buffer[MAX_PACKET_LENGTH]; |
| 461 | int msgLen = -1; |
| 462 | buffer[0] = '\0'; |
| 463 | |
| 464 | msgLen = mControlSocket[ARFCN]->read(buffer); |
| 465 | |
| 466 | mControlLock.lock(); |
| 467 | |
| 468 | if (msgLen < 1) { |
| 469 | mControlLock.unlock(); |
| 470 | return; |
| 471 | } |
| 472 | |
| 473 | char cmdcheck[4]; |
| 474 | char command[MAX_PACKET_LENGTH]; |
| 475 | char response[MAX_PACKET_LENGTH]; |
| 476 | |
| 477 | sscanf(buffer,"%3s %s",cmdcheck,command); |
| 478 | |
| 479 | writeClockInterface(); |
| 480 | |
| 481 | if (strcmp(cmdcheck,"CMD")!=0) { |
| 482 | LOG(ERR) << "bogus message on control interface"; |
| 483 | mControlLock.unlock(); |
| 484 | return; |
| 485 | } |
| 486 | LOG(INFO) << "command is " << buffer; |
| 487 | |
| 488 | if (strcmp(command,"POWEROFF")==0) { |
| 489 | // turn off transmitter/demod |
| 490 | sprintf(response,"RSP POWEROFF 0"); |
| 491 | } |
| 492 | else if (strcmp(command,"POWERON")==0) { |
| 493 | // turn on transmitter/demod |
| 494 | if (!mTxFreq || !mRxFreq) |
| 495 | sprintf(response,"RSP POWERON 1"); |
| 496 | else { |
| 497 | sprintf(response,"RSP POWERON 0"); |
| 498 | if (!mOn) { |
| 499 | // Prepare for thread start |
| 500 | mPower = -20; |
| 501 | mRadioInterface->start(); |
| 502 | |
| 503 | // Start radio interface threads. |
| 504 | writeClockInterface(); |
| 505 | generateRACHSequence(*gsmPulse,mSamplesPerSymbol); |
| 506 | |
| 507 | mRFIFOServiceLoopThread->start((void * (*)(void*))RFIFOServiceLoopAdapter,(void*) this); |
| 508 | mFIFOServiceLoopThread->start((void * (*)(void*))FIFOServiceLoopAdapter,(void*) this); |
| 509 | |
| 510 | for (int i = 0; i < mNumARFCNs; i++) { |
| 511 | ThreadStruct *cs = new ThreadStruct; |
no test coverage detected