nRF Connect SDK API 2.8.99
|
uint8_t string_conversion_7bit_sms_unpacking | ( | const uint8_t * | packed, |
uint8_t * | unpacked, | ||
uint8_t | num_char ) |
Performs unpacking of a packed GSM 7 bit string as described below.
Packed data bits: bit number: 7 6 5 4 3 2 1 0 data byte 0: 2g 1a 1b 1c 1d 1e 1f 1g p0 data byte 1: 3f 3g 2a 2b 2c 2d 2e 2f p1 data byte 2: 4e 4f 4g 3a 3b 3c 3d 3e p2 data byte 3: 5d 5e 5f 5g 4a 4b 4c 4d p3 data byte 4: 6c 6d 6e 6f 6g 5a 5b 5c p4 data byte 5: 7b 7c 7d 7e 7f 7g 6a 6b p5 data byte 6: 8a 8b 8c 8d 8e 8f 8g 7a p6 data byte 7: Ag 9a 9b 9c 9d 9e 9f 9g p7 data byte 8: Bf Bg Aa Ab Ac Ad Ae Af p8 and so on... Unpacked data bits: bit number: 7 6 5 4 3 2 1 0 data byte 0: 0 1a 1b 1c 1d 1e 1f 1g p0 & 7F data byte 1: 0 2a 3b 2c 2d 2e 2f 2g (p1 << 1 | p0 >> 7) & 7F data byte 2: 0 3a 3b 3c 3d 3e 3f 3g (p2 << 2 | p1 >> 6) & 7F data byte 3: 0 4a 4b 4c 4d 4e 4f 4g (p3 << 3 | p2 >> 5) & 7F data byte 4: 0 5a 5b 5c 5d 5e 5f 5g (p4 << 4 | p3 >> 4) & 7F data byte 5: 0 6a 6b 6c 6d 6e 6f 6g (p5 << 5 | p4 >> 3) & 7F data byte 6: 0 7a 7b 7c 7d 7e 7f 7g (p6 << 6 | p5 >> 2) & 7F data byte 7: 0 8a 8b 8c 8d 8e 8f 8g (p7 << 7 | p6 >> 1) & 7F data byte 8: 0 9a 9b 9c 9d 9e 9f 9g (p7 << 0 | p6 >> 8) & 7F data byte 9: 0 Aa Ab Ac Ad Ae Af Ag (p8 << 1 | p7 >> 7) & 7F data byte A: 0 Ba Bb Bc Bd Be Bf Bg (p9 << 2 | p8 >> 6) & 7F and so on...
References: 3GPP TS 23.038 chapter 6.1.2.1: SMS Packing
[in] | packed | Pointer to buffer containing the packed string. |
[in] | num_char | Number of 7-bit characters (i.e. septets) to be unpacked, including possible escape codes. Also indicates maximum allowed number of characters to be stored to output buffer by this function. |
[out] | unpacked | Pointer to buffer to store the unpacked string. Allocated size shall be at least "num_char" bytes. |