summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/gsm_cp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/esp32/components/eos/gsm_cp.c')
-rw-r--r--fw/esp32/components/eos/gsm_cp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fw/esp32/components/eos/gsm_cp.c b/fw/esp32/components/eos/gsm_cp.c
index 3ab98c5..508aa54 100644
--- a/fw/esp32/components/eos/gsm_cp.c
+++ b/fw/esp32/components/eos/gsm_cp.c
@@ -15,9 +15,10 @@ static const uint16_t gsm7_to_ucs2[128] = {
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00e4, 0x00f6, 0x00f1, 0x00fc, 0x00e0
};
+// Ext table ss2 (0x1b 0x1b) is mapped to space
static const uint16_t gsm7e_to_ucs2[128] = {
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x000c, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0x005e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff, 0x005e, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0020, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x007b, 0x007d, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x005c,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x005b, 0x007e, 0x005d, 0xffff,
0x007c, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
@@ -63,7 +64,7 @@ int gsm_ucs2_to_7bit(uint16_t ucs2, char *gsm7, int gsm7_size) {
uint16_t ch = 0xffff;
int ret = 0;
- if (gsm7_size < 1) return GSM_ERR;
+ if (gsm7_size < 1) return GSM_ERR_SIZE;
if (ucs2 < 256) {
ch = ucs2_to_gsm7[ucs2];
@@ -79,7 +80,7 @@ int gsm_ucs2_to_7bit(uint16_t ucs2, char *gsm7, int gsm7_size) {
}
if (ch == 0xffff) return GSM_ERR;
if (ch & 0xff00) {
- if (gsm7_size < 2) return GSM_ERR;
+ if (gsm7_size < 2) return GSM_ERR_SIZE;
*gsm7 = 0x1b;
gsm7++;
ret++;
@@ -93,12 +94,12 @@ int gsm_ucs2_to_7bit(uint16_t ucs2, char *gsm7, int gsm7_size) {
int gsm_7bit_to_ucs2(char *gsm7, int gsm7_len, uint16_t *ucs2) {
int ret;
- if (gsm7_len < 1) return GSM_ERR;
+ if (gsm7_len < 1) return GSM_ERR_SIZE;
if (*gsm7 != 0x1b) {
*ucs2 = gsm7_to_ucs2[*gsm7 & 0x7f];
ret = 1;
} else {
- if (gsm7_len < 2) return GSM_ERR;
+ if (gsm7_len < 2) return GSM_ERR_SIZE;
gsm7++;
ret = 2;
*ucs2 = gsm7e_to_ucs2[*gsm7 & 0x7f];