diff --git a/Control/SMSCB.cpp b/Control/SMSCB.cpp index b1a8ef09..1547223b 100644 --- a/Control/SMSCB.cpp +++ b/Control/SMSCB.cpp @@ -124,7 +124,7 @@ void SMSCBSendMessage(sqlite3* DB, sqlite3_stmt* stmt, GSM::CBCHLogicalChannel* while (dp<82) { thisPage[dp++] = 0; thisPage[dp++]='\r'; } } else { // 03.38 section 5 - codingScheme = 0x10; // 7' + codingScheme = 0x01; // 7' int buf = 0; int shift = 0; // The spec (above) says to put this language stuff in, but it doesn't work on my samsung galaxy y. @@ -176,11 +176,13 @@ void* Control::SMSCBSender(void*) while (1) { // Get the next message ready to send. - const char* query = + char query[200]; + sprintf(query, "SELECT" " GS,MESSAGE_CODE,UPDATE_NUMBER,MSGID,MESSAGE,LANGUAGE_CODE,SEND_COUNT,ROWID" " FROM SMSCB" - " WHERE SEND_TIME==(SELECT min(SEND_TIME) FROM SMSCB)"; + " WHERE SEND_TIME==(SELECT min(SEND_TIME) FROM SMSCB)" + " AND SEND_TIME<=%u", (unsigned)time(NULL)); sqlite3_stmt *stmt; if (sqlite3_prepare_statement(DB,&stmt,query)) { LOG(ALERT) << "Cannot access SMSCB database: " << sqlite3_errmsg(DB); diff --git a/GSM/GSML2LAPDm.cpp b/GSM/GSML2LAPDm.cpp index 496d6dab..a8a42344 100644 --- a/GSM/GSML2LAPDm.cpp +++ b/GSM/GSML2LAPDm.cpp @@ -1071,13 +1071,19 @@ void CBCHL2::l2WriteHighSide(const GSM::L3Frame& l3) assert(l3.primitive()==UNIT_DATA); assert(l3.size()==88*8); L2Frame outFrame(DATA); - // Chop the L3 frame into 4 L2 frames. + // Chop the L3 frame into 4 L2 frames. for (unsigned i=0; i<4; i++) { - outFrame.fillField(0,0x02,4); + // If it is the fourth frame, set the Last Block Bit to 0x03. + if(i==3){ + outFrame.fillField(0,0x03,4); + } + else { + outFrame.fillField(0,0x02,4); + } outFrame.fillField(4,i,4); const BitVector2 thisSeg = l3.cloneSegment(i*22*8,22*8); thisSeg.copyToSegment(outFrame,8); - OBJLOG(DEBUG) << "CBCHL2 outgoing L2 frame: " << outFrame; + OBJLOG(DEBUG) <<"Frame "<< i <<" of 4 " << "CBCHL2 outgoing L2 frame: " << outFrame; mL2Downstream->writeHighSide(outFrame); } } diff --git a/GSM/GSMTAPDump.cpp b/GSM/GSMTAPDump.cpp index 6190353c..0fd1837c 100644 --- a/GSM/GSMTAPDump.cpp +++ b/GSM/GSMTAPDump.cpp @@ -57,6 +57,11 @@ void gWriteGSMTAP(unsigned ARFCN, unsigned TS, unsigned FN, case GSM::SDCCH_4_0: case GSM::SDCCH_4_1: case GSM::SDCCH_4_2: + if(gConfig.getStr("Control.SMSCB.Table").length() != 0){ + stype = GSMTAP_CHANNEL_CBCH52; + scn = to - GSM::SDCCH_4_0; + break; + } case GSM::SDCCH_4_3: stype = GSMTAP_CHANNEL_SDCCH4; scn = to - GSM::SDCCH_4_0;