From 4e578aa3ef5ec658a2ff7e8417fdbfb9d61c15f1 Mon Sep 17 00:00:00 2001 From: laforge Date: Fri, 17 Aug 2007 08:30:04 +0000 Subject: From: Andrzej Zaborowski Date: Thu, 26 Jul 2007 16:00:52 +0200 Subject: [PATCH] Cell Broadcast messages enabling/disabling and notifications. This adds GSMD_CB_SUBSCRIBE and GSMD_CB_UNSIBSCRIBE commands handling and proper handling of th +CMTI, +CMT, +CBMI, +CBM, +CDSI, +CDS unsolicited codes. It's also an overhaul of sms_cb.c which I first though stood for sms *callbacks* :) rather than "cell broadcast" so all SMS and CB related code now sits in this file. The Neo1973 modem doesn't seem to support storing CB messages and delivery status messages into memory, so the default is now set to output them directly to TE when they're enabled. None of the CB code is tested on real CBs, but I think it's a good start. git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2721 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/event.h | 2 ++ include/gsmd/sms.h | 5 +++-- include/gsmd/usock.h | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'include/gsmd') diff --git a/include/gsmd/event.h b/include/gsmd/event.h index 15d070d..395c488 100644 --- a/include/gsmd/event.h +++ b/include/gsmd/event.h @@ -16,6 +16,8 @@ enum gsmd_events { GSMD_EVT_TIMEZONE = 11, /* Timezone change */ GSMD_EVT_SUBSCRIPTIONS = 12, /* To which events are we subscribed to */ GSMD_EVT_CIPHER = 13, /* Chiphering Information */ + GSMD_EVT_IN_CBM = 14, /* Incoming Cell Broadcat message */ + GSMD_EVT_IN_DS = 15, /* SMS Status Report */ __NUM_GSMD_EVT }; diff --git a/include/gsmd/sms.h b/include/gsmd/sms.h index 3192472..f4def25 100644 --- a/include/gsmd/sms.h +++ b/include/gsmd/sms.h @@ -7,12 +7,13 @@ int sms_cb_init(struct gsmd *gsmd); +#define MAX_PDU_SIZE 180 int sms_pdu_make_smssubmit(char *dest, const struct gsmd_sms_submit *src); int sms_pdu_to_msg(struct gsmd_sms_list *dst, const u_int8_t *src, int pdulen, int len); -extern const char *ts0705_memtype_name[]; -int parse_memtype(char *memtype); +int usock_rcv_sms(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, int len); +int usock_rcv_cb(struct gsmd_user *gu, struct gsmd_msg_hdr *gph, int len); #endif /* __GSMD__ */ diff --git a/include/gsmd/usock.h b/include/gsmd/usock.h index bcff129..18ffa5e 100644 --- a/include/gsmd/usock.h +++ b/include/gsmd/usock.h @@ -22,6 +22,7 @@ enum gsmd_msg_type { GSMD_MSG_PHONE = 7, GSMD_MSG_PIN = 8, GSMD_MSG_SMS = 9, + GSMD_MSG_CB = 10, __NUM_GSMD_MSGS }; @@ -259,9 +260,20 @@ struct gsmd_evt_auxdata { struct gsmd_addr addr; } colp; struct { + int inlined; u_int8_t memtype; int index; } sms; + struct { + int inlined; + u_int8_t memtype; + int index; + } cbm; + struct { + int inlined; + u_int8_t memtype; + int index; + } ds; struct { enum gsmd_pin_type type; } pin; @@ -289,7 +301,8 @@ struct gsmd_evt_auxdata { u_int16_t net_state_gprs; } cipher; } u; -} __attribute__((packed)); + u_int8_t data[0]; +} __attribute__ ((packed)); /* Refer to GSM 07.05 subclause 3.5.4 */ struct gsmd_sms_delete { @@ -431,8 +444,10 @@ struct gsmd_ucmd { extern struct gsmd_ucmd *ucmd_alloc(int extra_size); extern int usock_init(struct gsmd *g); extern void usock_cmd_enqueue(struct gsmd_ucmd *ucmd, struct gsmd_user *gu); -extern struct gsmd_ucmd *usock_build_event(u_int8_t type, u_int8_t subtype, u_int8_t len); +extern struct gsmd_ucmd *usock_build_event(u_int8_t type, u_int8_t subtype, u_int16_t len); extern int usock_evt_send(struct gsmd *gsmd, struct gsmd_ucmd *ucmd, u_int32_t evt); +extern struct gsmd_ucmd *gsmd_ucmd_fill(int len, u_int8_t msg_type, + u_int8_t msg_subtype, u_int16_t id); #endif /* __GSMD__ */ -- cgit v1.2.3