diff options
Diffstat (limited to 'src/util/event.c')
-rw-r--r-- | src/util/event.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/util/event.c b/src/util/event.c new file mode 100644 index 0000000..601ea9a --- /dev/null +++ b/src/util/event.c @@ -0,0 +1,38 @@ +#include <stdio.h> +#include <string.h> + +#include <libgsmd/libgsmd.h> +#include <libgsmd/event.h> + +static int incall_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) +{ + printf("EVENT: Incoming call type=%u!\n", aux->u.call.type); + + return 0; +} + +static int clip_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) +{ + printf("EVENT: Incoming call clip=`%s'\n", aux->u.clip.addr.number); + + return 0; +} + +static int netreg_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux) +{ + printf("EVENT: Netreg\n"); + + 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_NETREG, &netreg_handler); + + return rc; +} + |