summaryrefslogtreecommitdiff
path: root/include/libgsmd
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-08-16 04:18:54 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-08-16 04:18:54 +0000
commit66ddffab0a8fe2f517d83859ffb20467acd0cbe6 (patch)
treef207a43dddc8205763309e8b9b3bb5043f96647e /include/libgsmd
parent00361c2946aef3975e302d5a5957ae239da21de8 (diff)
From 294d27e78680d497da22e3a8ad679f50d1ba29e5 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <balrog@zabor.org> Date: Wed, 11 Jul 2007 16:11:10 +0200 Subject: [PATCH] SMS support in gsmd and in libgsmd. This adds the proper support for sms related calls in libgsmd and their implementation in gsmd. I assumed that conversion between data coding schemes is to be done on the client side because the {packing,unpacking}* calls were exported. TEXT mode support is non-functional, but the code only has to be filled in the right places to make it work, if it is ever needed. I had been lucky to be able to test with the different kinds of messages with exotic formats because I just got a bunch of network messages today (urging to top-up the credit). I tried to not modify the libgsmd api, although I would prefer to have a totally different api, possibly with synchronous calls that just return the result of an operation, for a exmaple a whole list of messages, rather than the client waiting for an unknown number of events each with one message. git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2710 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'include/libgsmd')
-rw-r--r--include/libgsmd/sms.h31
1 files changed, 8 insertions, 23 deletions
diff --git a/include/libgsmd/sms.h b/include/libgsmd/sms.h
index a07fc74..6a62c38 100644
--- a/include/libgsmd/sms.h
+++ b/include/libgsmd/sms.h
@@ -5,23 +5,6 @@
/* Short Message Service */
-/* Data Coding Scheme, refer to GSM 03.38 Clause 4 */
-#define B5_COMPRESSED (1<<5)
-#define B4_CLASSMEANING (1<<4)
-enum {
- MESSAGE_CLASS_CLASS0 = 0x00,
- MESSAGE_CLASS_CLASS1 = 0x01,
- MESSAGE_CLASS_CLASS2 = 0x10,
- MESSAGE_CLASS_CLASS3 = 0x11,
-};
-
-enum {
- ALPHABET_DEFAULT = (0x00<<2),
- ALPHABET_8BIT = (0x01<<2),
- ALPHABET_UCS2 = (0x10<<2),
- ALPHABET_RESERVED = (0x11<<2),
-};
-
/* Coding of Alpha fields in the SIM for UCS2, (3GPP TS 11.11 Annex B) */
//enum {
@@ -57,15 +40,17 @@ struct lgsm_sms_delete {
#define LGSM_SMS_ADDR_MAXLEN 12
#define LGSM_SMS_DATA_MAXLEN 140
struct lgsm_sms {
- /* FIXME: max length of data,
- * 7 bit coding - 160(140*8/7); ucs2 coding - 70(140/2) */
char addr[LGSM_SMS_ADDR_MAXLEN+1];
- char data[LGSM_SMS_DATA_MAXLEN+1];
+ /* FIXME: max length of data,
+ * 7 bit coding - 160(140*8/7); ucs2 coding - 70(140/2) */
+ enum gsmd_sms_alphabet alpha;
+ u_int8_t data[LGSM_SMS_DATA_MAXLEN+1];
+ int length;
};
/* GSM 03.40 subclause 9.2.2.2 and GSM 07.05 subclause 4.4 and subclause 3.1 */
struct lgsm_sms_write {
- enum lgsm_msg_sms_stat stat;
+ enum lgsm_msg_sms_stat stat;
struct lgsm_sms sms;
};
@@ -87,10 +72,10 @@ extern int lgsmd_sms_write(struct lgsm_handle *lh,
const struct lgsm_sms_write *sms_write);
/* Packing of 7-bit characters, refer to GSM 03.38 subclause 6.1.2.1.1 */
-extern int packing_7bit_character(char *src, char *dest);
+extern int packing_7bit_character(const char *src, struct lgsm_sms *dest);
/* Packing of 7-bit characters, refer to GSM 03.38 subclause 6.1.2.1.1 */
-extern int unpacking_7bit_character(char *src, char *dest);
+extern int unpacking_7bit_character(const struct gsmd_sms *src, char *dest);
/* Refer to 3GPP TS 11.11 Annex B */
extern int packing_UCS2_80(char *src, char *dest);
personal git repositories of Harald Welte. Your mileage may vary