diff options
author | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-01-12 23:57:33 +0000 |
---|---|---|
committer | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-01-12 23:57:33 +0000 |
commit | a04e6effed0b81ec7495df2a1448484645b20cc5 (patch) | |
tree | 6292af769d08022e68cd183358ccc78c6a27238c /src/util/event.c | |
parent | 496d202f517dbecc1be4e1afc6782c0e3dc48373 (diff) |
- use talloc (of samba project) to debug memory allocations and simplify code
- introduce new ucmd_alloc() function
- add DTMF support to gsmd, libgsmd and gsmd-util
- fix crash of libgsmd when events don't have handlers registered
- implement call progress for TI modem
- split modem init string in separate commands to fit our parser
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@544 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/util/event.c')
-rw-r--r-- | src/util/event.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/util/event.c b/src/util/event.c index bff895d..014abda 100644 --- a/src/util/event.c +++ b/src/util/event.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <string.h> +#include <common/linux_list.h> #include <libgsmd/libgsmd.h> #include <libgsmd/event.h> @@ -18,6 +19,13 @@ static int clip_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata return 0; } +static int colp_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) +{ + printf("EVENT: Outgoing call colp = %s\n", aux->u.colp.addr.number); + + return 0; +} + static int netreg_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) { printf("EVENT: Netreg "); @@ -56,14 +64,55 @@ static int sigq_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata return 0; } +static const char *cprog_names[] = { + [GSMD_CALLPROG_SETUP] = "SETUP", + [GSMD_CALLPROG_DISCONNECT] = "DISCONNECT", + [GSMD_CALLPROG_ALERT] = "ALERT", + [GSMD_CALLPROG_CALL_PROCEED] = "PROCEED", + [GSMD_CALLPROG_SYNC] = "SYNC", + [GSMD_CALLPROG_PROGRESS] = "PROGRESS", + [GSMD_CALLPROG_CONNECTED] = "CONNECTED", + [GSMD_CALLPROG_RELEASE] = "RELEASE", + [GSMD_CALLPROG_REJECT] = "REJECT", + [GSMD_CALLPROG_UNKNOWN] = "UNKNOWN", +}; + +static const char *cdir_names[] = { + [GSMD_CALL_DIR_MO] = "Outgoing", + [GSMD_CALL_DIR_MT] = "Incoming", + [GSMD_CALL_DIR_CCBS] = "CCBS", + [GSMD_CALL_DIR_MO_REDIAL] = "Outgoing Redial", +}; + +static int cprog_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) +{ + const char *name, *dir; + + if (aux->u.call_status.prog >= ARRAY_SIZE(cprog_names)) + name = "UNDEFINED"; + else + name = cprog_names[aux->u.call_status.prog]; + + if (aux->u.call_status.dir >= ARRAY_SIZE(cdir_names)) + dir = ""; + else + dir = cdir_names[aux->u.call_status.dir]; + + printf("EVENT: %s Call Progress: %s\n", dir, name); + + return 0; +} + int event_init(struct lgsm_handle *lh) { int rc; rc = lgsm_evt_handler_register(lh, GSMD_EVT_IN_CALL, &incall_handler); rc |= lgsm_evt_handler_register(lh, GSMD_EVT_IN_CLIP, &clip_handler); + rc |= lgsm_evt_handler_register(lh, GSMD_EVT_OUT_COLP, &colp_handler); rc |= lgsm_evt_handler_register(lh, GSMD_EVT_NETREG, &netreg_handler); rc |= lgsm_evt_handler_register(lh, GSMD_EVT_SIGNAL, &sigq_handler); + rc |= lgsm_evt_handler_register(lh, GSMD_EVT_OUT_STATUS, &cprog_handler); return rc; } |