diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-08-08 11:29:11 +0200 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2018-08-21 16:50:15 +0000 |
commit | 3bc9a2dbe2b2dd4eca1572eac5a34135d9f26cf4 (patch) | |
tree | ddabdc889eeaf3069b8a8ccde541da5dccfe6fcc /src | |
parent | 6838a3f715279831cd8667f78996c9f6891062ea (diff) |
broadband-modem,ussd: explain encoding/decoding logic
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 2b4ab264..d408d80e 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -5167,11 +5167,17 @@ modem_3gpp_ussd_encode (MMIfaceModem3gppUssd *self, ussd_command = g_byte_array_new (); - /* encode to the current charset */ + /* Encode to the current charset (as per AT+CSCS, which is what most modems + * (except for Huawei it seems) will ask for. */ if (mm_modem_charset_byte_array_append (ussd_command, command, FALSE, broadband->priv->modem_current_charset)) { + /* The scheme value does NOT represent the encoding used to encode the string + * we're giving. This scheme reflects the encoding that the modem should use when + * sending the data out to the network. We're hardcoding this to GSM-7 because + * USSD commands fit well in GSM-7, unlike USSD responses that may contain code + * points that may only be encoded in UCS-2. */ *scheme = MM_MODEM_GSM_USSD_SCHEME_7BIT; /* convert to hex representation */ hex = mm_utils_bin2hexstr (ussd_command->data, ussd_command->len); @@ -5189,8 +5195,9 @@ modem_3gpp_ussd_decode (MMIfaceModem3gppUssd *self, { MMBroadbandModem *broadband = MM_BROADBAND_MODEM (self); - return mm_modem_charset_hex_to_utf8 (reply, - broadband->priv->modem_current_charset); + /* Decode from current charset (as per AT+CSCS, which is what most modems + * (except for Huawei it seems) will ask for. */ + return mm_modem_charset_hex_to_utf8 (reply, broadband->priv->modem_current_charset); } /*****************************************************************************/ |