@@ -85,22 +85,22 @@ namespace pocsag {
8585 void Decoder::flushMessage () {
8686 if (!msg.empty ()) {
8787
88- // // Unpack bits
89- // std::string outStr = "";
90- // for (int i = 0; (i+7) <= msg.size(); i += 7) {
91- // uint8_t b0 = msg[i];
92- // uint8_t b1 = msg[i+1];
93- // uint8_t b2 = msg[i+2];
94- // uint8_t b3 = msg[i+3];
95- // uint8_t b4 = msg[i+4];
96- // uint8_t b5 = msg[i+5];
97- // uint8_t b6 = msg[i+6];
98- // outStr += (char)((b6<<6) | (b5<<5) | (b4<<4) | (b3<<3) | (b2<<2) | (b1<<1) | b0);
99- // }
100- // onMessage(addr, msgType, outStr);
101-
102- // Send out message
103- onMessage (addr, msgType, msg);
88+ // Unpack bits
89+ std::string outStr = " " ;
90+ for (int i = 0 ; (i+7 ) <= msg.size (); i += 7 ) {
91+ uint8_t b0 = msg[i];
92+ uint8_t b1 = msg[i+1 ];
93+ uint8_t b2 = msg[i+2 ];
94+ uint8_t b3 = msg[i+3 ];
95+ uint8_t b4 = msg[i+4 ];
96+ uint8_t b5 = msg[i+5 ];
97+ uint8_t b6 = msg[i+6 ];
98+ outStr += (char )((b6<<6 ) | (b5<<5 ) | (b4<<4 ) | (b3<<3 ) | (b2<<2 ) | (b1<<1 ) | b0);
99+ }
100+ onMessage (addr, msgType, outStr);
101+
102+ // // Send out message
103+ // onMessage(addr, msgType, msg);
104104
105105 // Reset state
106106 msg.clear ();
@@ -167,31 +167,31 @@ namespace pocsag {
167167 // msg += NUMERIC_CHARSET[data & 0b1111];
168168 }
169169 else if (msgType == MESSAGE_TYPE_ALPHANUMERIC) {
170- // Alpha messages pack 7bit characters in the entire codeword stream
171- int lasti;
172- for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7 ; i += 7 ) {
173- // Read 7 bits
174- char c = 0 ;
175- if (i < 0 ) {
176- c = (lastMsgData & ((1 << (-i)) - 1 )) << (7 +i);
177- }
178- c |= (data >> (13 - i)) & 0b1111111 ;
179-
180- // Save character
181- bitswapChar (c, c);
182- msg += c;
183-
184- // Update last successful unpack
185- lasti = i;
186- }
170+ // // Alpha messages pack 7bit characters in the entire codeword stream
171+ // int lasti;
172+ // for (int i = -leftInLast; i <= POCSAG_DATA_BITS_PER_CW-7; i += 7) {
173+ // // Read 7 bits
174+ // char c = 0;
175+ // if (i < 0) {
176+ // c = (lastMsgData & ((1 << (-i)) - 1)) << (7+i);
177+ // }
178+ // c |= (data >> (13 - i)) & 0b1111111;
179+
180+ // // Save character
181+ // bitswapChar(c, c);
182+ // msg += c;
183+
184+ // // Update last successful unpack
185+ // lasti = i;
186+ // }
187187
188- // Save how much is still left to read
189- leftInLast = 20 - (lasti + 7 );
188+ // // Save how much is still left to read
189+ // leftInLast = 20 - (lasti + 7);
190190
191- // // Pack the bits backwards
192- // for (int i = 19; i >= 0; i--) {
193- // msg += (char)((data >> i) & 1);
194- // }
191+ // Pack the bits backwards
192+ for (int i = 19 ; i >= 0 ; i--) {
193+ msg += (char )((data >> i) & 1 );
194+ }
195195 }
196196
197197 // Save last data
0 commit comments