From be174b78167bf9f2b77901b4b318606144a5ae58 Mon Sep 17 00:00:00 2001 From: laforge Date: Fri, 17 Aug 2007 08:31:21 +0000 Subject: From: Andrzej Zaborowski Date: Fri, 27 Jul 2007 19:39:15 +0200 Subject: [PATCH] Cell Broadcast message decoding and presentation in libgsmd-tool. This time Cell Broadcast is tested to work, I should have made tests earlier. Now I'm correctly getting a CB message with the human readable name of the city and district when I'm connecting. In the previous patches the CB PDU was not being decoded at all. git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2723 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/libgsmd/libgsmd_sms.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libgsmd') diff --git a/src/libgsmd/libgsmd_sms.c b/src/libgsmd/libgsmd_sms.c index 72723c0..22d7dbf 100644 --- a/src/libgsmd/libgsmd_sms.c +++ b/src/libgsmd/libgsmd_sms.c @@ -283,6 +283,20 @@ int unpacking_7bit_character(const struct gsmd_sms *src, char *dest) return i; } +int cbm_unpacking_7bit_character(const char *src, char *dest) +{ + int i; + u_int8_t ch = 1; + + for (i = 0; i < 93 && ch; i ++) + *(dest ++) = ch = + ((src[(i * 7 + 7) >> 3] << (7 - ((i * 7 + 7) & 7))) | + (src[(i * 7) >> 3] >> ((i * 7) & 7))) & 0x7f; + *dest = '\0'; + + return i; +} + /* Refer to 3GPP TS 11.11 Annex B */ int packing_UCS2_80(char *src, char *dest) { -- cgit v1.2.3