From cbffc8d64707828b045b679e8db0269ae362ffcf Mon Sep 17 00:00:00 2001 From: laforge Date: Mon, 23 Oct 2006 20:28:37 +0000 Subject: more gsmd/libgsm implementation git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@114 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/event.h | 1 + include/gsmd/usock.h | 10 +++------- include/libgsmd/event.h | 12 ++++++++---- include/libgsmd/libgsmd.h | 35 +++++++++++++++++++++++------------ 4 files changed, 35 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/gsmd/event.h b/include/gsmd/event.h index c6f2986..6ae4e02 100644 --- a/include/gsmd/event.h +++ b/include/gsmd/event.h @@ -14,6 +14,7 @@ enum gsmd_events { GSMD_EVT_OUT_COLP = 9, /* Outgoing COLP */ GSMD_EVT_CALL_WAIT = 10, /* Call Waiting */ GSMD_EVT_TIMEZONE = 11, /* Timezone change */ + GSMD_EVT_SUBSCRIPTIONS = 12, /* To which events are we subscribed to */ __NUM_GSMD_EVT }; diff --git a/include/gsmd/usock.h b/include/gsmd/usock.h index eced10e..f5d26ae 100644 --- a/include/gsmd/usock.h +++ b/include/gsmd/usock.h @@ -30,15 +30,10 @@ enum gsmd_passthrough_type { GSMD_PASSTHROUGH_RESP = 2, }; -enum gsmd_event_type { - GSMD_EVENT_NONE = 0, - GSMD_EVENT_SUBSCRIPTIONS= 1, - GSMD_EVENT_HAPPENED = 2, -}; - enum gsmd_msg_voicecall_type { GSMD_VOICECALL_DIAL = 1, GSMD_VOICECALL_HANGUP = 2, + GSMD_VOICECALL_ANSWER = 3, }; /* Handset / MT related commands */ @@ -53,7 +48,7 @@ enum gsmd_msg_pin_type { /* Length from 3GPP TS 04.08, Clause 10.5.4.7 */ -#define GSMD_ADDR_MAXLEN 13 +#define GSMD_ADDR_MAXLEN 32 struct gsmd_addr { u_int8_t type; char number[GSMD_ADDR_MAXLEN+1]; @@ -95,6 +90,7 @@ struct gsmd_msg_hdr { u_int8_t _pad; u_int16_t id; u_int16_t len; + u_int8_t data[]; } __attribute__((packed)); diff --git a/include/libgsmd/event.h b/include/libgsmd/event.h index d7faa9b..e1338f7 100644 --- a/include/libgsmd/event.h +++ b/include/libgsmd/event.h @@ -4,11 +4,15 @@ #include /* Prototype of libgsmd callback handler function */ -typedef int evt_cb_func(struct lgsm_handle *lh, enum gsmd_events evt, - void *user); +typedef int lgsm_evt_handler(struct lgsm_handle *lh, int evt_type, struct gsmd_evt_auxdata *aux); /* Register an event callback handler with libgsmd */ -extern int lgsm_register_evt_cb(struct lgsm_handle *lh, - evt_cb_func *cb, void *user); +extern int lgsm_evt_handler_register(struct lgsm_handle *lh, int evt_type, + lgsm_evt_handler *handler); +extern void lgsm_evt_handler_unregister(struct lgsm_handle *lh, int evt_type); + +extern int lgsm_evt_init(struct lgsm_handle *lh); +extern void lgsm_evt_exit(struct lgsm_handle *lh); + #endif diff --git a/include/libgsmd/libgsmd.h b/include/libgsmd/libgsmd.h index 7ce1a83..a89f4b6 100644 --- a/include/libgsmd/libgsmd.h +++ b/include/libgsmd/libgsmd.h @@ -9,6 +9,8 @@ #include #include +#include + /* Generic Information * * Return value: @@ -28,17 +30,6 @@ /* Opaque data structure, content only known to libgsm implementation */ struct lgsm_handle; -#define LGSMD_DEVICE_GSMD "gsmd" - -/* initialize usage of libgsmd, obtain handle for othe API calls */ -extern struct lgsm_handle *lgsm_init(const char *device); - -/* Terminate usage of libgsmd */ -extern int lgsm_exit(struct lgsm_handle *lh); - -/* Obtain file descriptor (e.g. for select-loop under app control) */ -extern int lgsm_fd(struct lgsm_handle *lh); - /* Refer to GSM 04.08 [8] subclause 10.5.4.7 */ enum lgsm_addr_type { LGSM_ATYPE_ISDN_UNKN = 161, @@ -48,9 +39,29 @@ enum lgsm_addr_type { #define LGSM_ADDR_MAXLEN 31 struct lgsm_addr { + enum lgsm_addr_type type; char addr[LGSM_ADDR_MAXLEN+1]; - enum lgsm_addr_type tyoe; }; +typedef int lgsm_msg_handler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh); + +#define LGSMD_DEVICE_GSMD "gsmd" + +/* initialize usage of libgsmd, obtain handle for othe API calls */ +extern struct lgsm_handle *lgsm_init(const char *device); + +/* Terminate usage of libgsmd */ +extern int lgsm_exit(struct lgsm_handle *lh); + +/* Obtain file descriptor (e.g. for select-loop under app control) */ +extern int lgsm_fd(struct lgsm_handle *lh); + +extern int lgsm_register_handler(struct lgsm_handle *lh, int type, lgsm_msg_handler *handler); +extern void lgsm_unregister_handler(struct lgsm_handle *lh, int type); + +extern int lgsm_passthrough_send(struct lgsm_handle *lh, const char *tx); extern int lgsm_passthrough(struct lgsm_handle *lh, const char *tx, char *rx, unsigned int *rx_len); +extern int lgsm_subscriptions(struct lgsm_handle *lh, u_int32_t subscriptions); + +extern int lgsm_pin(struct lgsm_handle *lh, char *pin); #endif -- cgit v1.2.3