unsigned char *uscanf(char retstr[],uint8_t elements,uint8_t onoff) { unsigned char str[50]; strcpy(str,""); switch (onoff) { case ON: for(x=0;x<elements;x++) { str[x] = rxb(); if(str[x] == '\r'){str[x] = 0;x = elements;} } break; case OFF: for(x=0;x<elements;x++) { str[x] = rxb(); } break; } strcpy(retstr,str); return str; }
// Send the specified BitVector at the specified block time. void PDCHL1Downlink::transmit(RLCBSN_t bsn, BitVector *mI, const int *qbits, int transceiverflags) { parent()->debug_test(); // Format the bits into the bursts. // GSM 05.03 4.1.5, 05.02 5.2.3 // NO! Dont do a wait here. The MAC serviceloop does this for all channels. // waitToSend(); // Don't get too far ahead of the clock. ARFCNManager *radio = getRadio(); if (!radio) { // For some testing, we might not have a radio connected. // That's OK, as long as we know it. GLOG(INFO) << "XCCHL1Encoder with no radio, dumping frames"; return; } int fn = bsn.FN(); int tn = TN(); for (int qi=0,B=0; B<4; B++) { Time nextWriteTime(fn,tn | transceiverflags); mchBurst.time(nextWriteTime); // Copy in the "encrypted" bits, GSM 05.03 4.1.5, 05.02 5.2.3. //OBJLOG(DEBUG) << "transmit mI["<<B<<"]=" << mI[B]; mI[B].segment(0,57).copyToSegment(mchBurst,3); mI[B].segment(57,57).copyToSegment(mchBurst,88); mchBurst.Hl(qbits[qi++]); mchBurst.Hu(qbits[qi++]); // Send it to the radio. //OBJLOG(DEBUG) << "transmit mchBurst=" << mchBurst; if (gConfig.getBool("Control.GSMTAP.GPRS")) { // Send to GSMTAP. gWriteGSMTAP(ARFCN(),TN(),gBSNNext.FN(), TDMA_PDCH, false, // not SACCH false, // this is a downlink mchBurst, GSMTAP_TYPE_UM_BURST); } #if FEC_DEBUG if (1) { // Try decoding the frame we just encoded to see if it is correct. devassert(mchBurst.size() == gSlotLen); RxBurst rxb(mchBurst); ChannelCodingType cc; decodeLowSide(rxb, B, debugDecoder, &cc); } #endif radio->writeHighSideTx(mchBurst,"GPRS"); fn++; // This cannot overflow because it is within an RLC block. } }