| 645 | } |
| 646 | |
| 647 | bool Transceiver::driveTransmitPriorityQueue() |
| 648 | { |
| 649 | |
| 650 | char buffer[gSlotLen+50]; |
| 651 | |
| 652 | // check data socket |
| 653 | size_t msgLen = mDataSocket.read(buffer); |
| 654 | |
| 655 | if (msgLen!=gSlotLen+1+4+1) { |
| 656 | LOG(ERR) << "badly formatted packet on GSM->TRX interface"; |
| 657 | return false; |
| 658 | } |
| 659 | |
| 660 | int timeSlot = (int) buffer[0]; |
| 661 | int fillerFlag = timeSlot & SET_FILLER_FRAME; // Magic flag says this is a filler burst. |
| 662 | timeSlot = timeSlot & 0x7; |
| 663 | uint64_t frameNum = 0; |
| 664 | for (int i = 0; i < 4; i++) |
| 665 | frameNum = (frameNum << 8) | (0x0ff & buffer[i+1]); |
| 666 | |
| 667 | |
| 668 | /* |
| 669 | if (GSM::Time(frameNum,timeSlot) > mTransmitDeadlineClock + GSM::Time(51,0)) { |
| 670 | // stale burst |
| 671 | //LOG(DEBUG) << "FAST! "<< GSM::Time(frameNum,timeSlot); |
| 672 | //writeClockInterface(); |
| 673 | }*/ |
| 674 | |
| 675 | /* |
| 676 | DAB -- Just let these go through the demod. |
| 677 | if (GSM::Time(frameNum,timeSlot) < mTransmitDeadlineClock) { |
| 678 | // stale burst from GSM core |
| 679 | LOG(NOTICE) << "STALE packet on GSM->TRX interface at time "<< GSM::Time(frameNum,timeSlot); |
| 680 | return false; |
| 681 | } |
| 682 | */ |
| 683 | |
| 684 | // periodically update GSM core clock |
| 685 | //LOG(DEBUG) << "mTransmitDeadlineClock " << mTransmitDeadlineClock |
| 686 | // << " mLastClockUpdateTime " << mLastClockUpdateTime; |
| 687 | if (mTransmitDeadlineClock > mLastClockUpdateTime + GSM::Time(216,0)) |
| 688 | writeClockInterface(); |
| 689 | |
| 690 | LOG(DEBUG) << "rcvd. burst at: " << GSM::Time(frameNum,timeSlot) <<LOGVAR(fillerFlag); |
| 691 | |
| 692 | int RSSI = (int) buffer[5]; |
| 693 | static BitVector newBurst(gSlotLen); |
| 694 | BitVector::iterator itr = newBurst.begin(); |
| 695 | char *bufferItr = buffer+6; |
| 696 | while (itr < newBurst.end()) |
| 697 | *itr++ = *bufferItr++; |
| 698 | |
| 699 | GSM::Time currTime = GSM::Time(frameNum,timeSlot); |
| 700 | |
| 701 | radioVector *newVec = fixRadioVector(newBurst,RSSI,currTime); |
| 702 | |
| 703 | if (false && fillerFlag) { |
| 704 | setFiller(newVec,false,true); |