nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ string_conversion_gsm7bit_to_ascii()

uint8_t string_conversion_gsm7bit_to_ascii ( const uint8_t *  data,
uint8_t *  out_data,
uint8_t  num_char,
bool  packed 
)

Convert GSM 7 bit Default Alphabet characters to ASCII characters.

gsm7bit_to_ascii_table conversion table is used. Perform also unpacking of the 7 bit string before conversion, if caller indicates that the string is packed.

References: 3GPP TS 23.038 chapter 6.2.1: GSM 7 bit Default Alphabet

Parameters
[in]dataPointer to array of characters to be converted. No null termination.
[out]out_dataPointer to buffer for the converted string. Shall have allocation of at least "num_char" bytes. Note that this function does not add null termination at the end of the string. It should be done by caller, when needed. (In that case it could be useful to actually allocate num_char+1 bytes here.)
[in]num_charNumber of 7-bit characters to be unpacked, including possible escape codes. Also indicates maximum allowed number of characters to be stored to output buffer by this function.
[in]packedTrue if the 7bit string is packed, i.e. has to be unpacked before conversion.
Returns
Number of valid bytes/characters in "out_data". May be less than "num_char" in the case that the 7 bit string contains "escape/extended code" sequences, that are converted to single ASCII characters.