From 4eedacac20cd0386aaf2c3af6a0eea3945e4da1f Mon Sep 17 00:00:00 2001 From: Aki Niemi Date: Mon, 7 Feb 2011 09:49:27 +0200 Subject: [PATCH] gisi: Add new API for setting modem remote device --- gisi/modem.c | 22 ++++++++++++++++++++++ gisi/modem.h | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/gisi/modem.c b/gisi/modem.c index 8c9eb1d..691cecd 100644 --- a/gisi/modem.c +++ b/gisi/modem.c @@ -59,6 +59,7 @@ typedef struct _GIsiServiceMux GIsiServiceMux; struct _GIsiModem { unsigned index; + uint8_t device; GHashTable *services; gboolean subs_source; int req_fd; @@ -537,6 +538,27 @@ void g_isi_modem_set_flags(GIsiModem *modem, unsigned long flags) modem->flags = flags; } +uint8_t g_isi_modem_device(GIsiModem *modem) +{ + if (modem == NULL) + return 0; + + return modem->device; +} + +int g_isi_modem_set_device(GIsiModem *modem, uint8_t remote) +{ + if (modem == NULL) + return -EINVAL; + + if (remote != PN_DEV_HOST && remote != PN_DEV_MODEM) + return -EINVAL; + + modem->device = remote; + + return 0; +} + static uint8_t service_next_utid(GIsiServiceMux *mux) { if (mux->last_utid == 0x00 || mux->last_utid == 0xFF) diff --git a/gisi/modem.h b/gisi/modem.h index ae90046..0397a87 100644 --- a/gisi/modem.h +++ b/gisi/modem.h @@ -48,9 +48,15 @@ typedef void (*GIsiDebugFunc)(const char *fmt, ...); GIsiModem *g_isi_modem_create(unsigned index); GIsiModem *g_isi_modem_create_by_name(const char *name); void g_isi_modem_destroy(GIsiModem *modem); + unsigned g_isi_modem_index(GIsiModem *modem); + +uint8_t g_isi_modem_device(GIsiModem *modem); +int g_isi_modem_set_device(GIsiModem *modem, uint8_t dev); + void g_isi_modem_set_trace(GIsiModem *modem, GIsiNotifyFunc notify); void g_isi_modem_set_debug(GIsiModem *modem, GIsiDebugFunc debug); + void *g_isi_modem_set_userdata(GIsiModem *modem, void *data); void *g_isi_modem_get_userdata(GIsiModem *modem); -- 2.7.4