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

◆ string_conversion_ascii_to_gsm7bit()

uint8_t string_conversion_ascii_to_gsm7bit ( const uint8_t *  data,
uint8_t  data_len,
uint8_t *  out_data,
uint8_t *  out_bytes,
uint8_t *  out_chars,
bool  packing 
)

Convert ASCII characters into GSM 7 bit Default Alphabet character set.

ascii_to_7bit_table conversion table is used. Optionally perform also packing for the resulting 7 bit string. Note that the 7 bit string may be longer than the original due to possible extension table usage. Each extended character needs an escape code in addition to the character code in extension table.

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

Input parameters:

Parameters
[in]dataPointer to array of characters to be converted. No null termination.
[in]data_lenNumber of characters to be converted, max 160.
[out]out_dataPointer to buffer for the converted string. Shall have allocation of 160 bytes, or in case of less than 80 input characters, at least 2*data_len to make sure that buffer overflow will not happen.
[out]out_bytesPointer to a byte to return number of valid bytes in out_data. May be NULL if not needed.
[out]out_charsPointer to a byte to return number of 7 bit characters, i.e. septets (including possible escape characters) in out_data. May be NULL if not needed. Same as out_bytes, when packing=false.
[in]packingTrue if the converted 7bit string has to be packed.
Returns
Number of converted characters (same as data_len if all converted successfully).