| 490 | } |
| 491 | |
| 492 | void TLUserData::encode7bit(const char *text) |
| 493 | { |
| 494 | size_t wp = 0; |
| 495 | |
| 496 | // 1. Prepare. |
| 497 | // Default alphabet (7-bit) |
| 498 | mDCS = 0; |
| 499 | // With 7-bit encoding TP-User-Data-Length count septets, i.e. just number |
| 500 | // of characters. |
| 501 | mLength = strlen(text); |
| 502 | int bytes = (mLength*7+7)/8; |
| 503 | int filler_bits = bytes*8-mLength*7; |
| 504 | mRawData.resize(bytes*8); |
| 505 | |
| 506 | // 2. Write TP-UD |
| 507 | // This tail() works because UD is always the last field in the PDU. |
| 508 | BitVector2 chars = mRawData.tail(wp); |
| 509 | for (unsigned i=0; i<mLength; i++) { |
| 510 | char gsm = encodeGSMChar(text[i]); |
| 511 | mRawData.writeFieldReversed(wp,gsm,7); |
| 512 | } |
| 513 | mRawData.writeField(wp,0,filler_bits); |
| 514 | } |
| 515 | |
| 516 | std::string TLUserData::decode() const |
| 517 | { |
nothing calls this directly
no test coverage detected