summaryrefslogtreecommitdiff
path: root/src/gsmd/vendor_ti.c
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2006-10-24 13:07:08 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2006-10-24 13:07:08 +0000
commit23dfcf4ff925f61bcb2c3bdd712ff0f70bde4fcb (patch)
tree97c62e6b7bc73cd4be3961ed2a253504381841c3 /src/gsmd/vendor_ti.c
parent3c4d2776058a440bb8d406cd85783898c14b2403 (diff)
- clean up header files (all in include/gmsd now)
- finish vendor plugin support - add call progress indicator and signal quality unsolicited support to vendor_ti.c git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@120 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/gsmd/vendor_ti.c')
-rw-r--r--src/gsmd/vendor_ti.c91
1 files changed, 85 insertions, 6 deletions
diff --git a/src/gsmd/vendor_ti.c b/src/gsmd/vendor_ti.c
index ac67b92..53ca7ed 100644
--- a/src/gsmd/vendor_ti.c
+++ b/src/gsmd/vendor_ti.c
@@ -5,6 +5,15 @@
#include <string.h>
#include <errno.h>
+#include "gsmd.h"
+
+#include <gsmd/gsmd.h>
+#include <gsmd/usock.h>
+#include <gsmd/event.h>
+#include <gsmd/vendorplugin.h>
+#include <gsmd/unsolicited.h>
+
+#if 0
#include "vendorplugin.h"
static int
@@ -31,8 +40,60 @@ ti_setopt(struct gsmd *gh, int optname, const void *optval, int optlen)
}
}
-static int ti_parseunsolicit(struct gsmd *gh)
+#endif
+
+
+static int csq_parse(char *buf, int len, char *param,
+ struct gsmd *gsmd)
+{
+ char *tok;
+ struct gsmd_evt_auxdata *aux;
+ struct gsmd_ucmd *ucmd = usock_build_event(GSMD_MSG_EVENT, GSMD_EVT_SIGNAL,
+ sizeof(*aux));
+
+ DEBUGP("entering csq_parse param=`%s'\n", param);
+ if (!ucmd)
+ return -EINVAL;
+
+
+ aux = (struct gsmd_evt_auxdata *) ucmd->buf;
+ tok = strtok(param, ",");
+ if (!tok)
+ goto out_free_io;
+
+ aux->u.signal.sigq.rssi = atoi(tok);
+
+ tok = strtok(NULL, ",");
+ if (!tok)
+ goto out_free_io;
+
+ aux->u.signal.sigq.ber = atoi(tok);
+
+ DEBUGP("sending EVT_SIGNAL\n");
+ usock_evt_send(gsmd, ucmd, GSMD_EVT_SIGNAL);
+
+ return 0;
+
+out_free_io:
+ free(ucmd);
+ return -EIO;
+}
+
+static int cpri_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
+{
+
+}
+
+static int cpi_parse(char *buf, int len, const char *param, struct gsmd *gsmd)
{
+
+}
+
+static const struct gsmd_unsolicit ticalypso_unsolicit[] = {
+ { "\%CSQ", &csq_parse }, /* Signal Quality */
+ { "\%CPRI", &cpri_parse }, /* Ciphering Indication */
+ { "\%CPI", &cpi_parse }, /* Call Progress Information */
+
/* FIXME: parse all the below and generate the respective events */
/* %CPROAM: CPHS Home Country Roaming Indicator */
@@ -43,11 +104,29 @@ static int ti_parseunsolicit(struct gsmd *gh)
/* %CPKY: Press Key */
/* %CMGRS: Message Retransmission Service */
/* %CGEV: reports GPRS network events */
- return -EINVAL;
+};
+
+static int ticalypso_detect(struct gsmd *g)
+{
+ /* FIXME: do actual detection of vendor if we have multiple vendors */
+ return 1;
}
-struct gsmd_vendorspecific ti_vendorspec = {
- .getopt = &ti_getopt,
- .setopt = &ti_setopt,
- .parse_unsolicit = &ti_parseunsolicit,
+static int ticalypso_initsettings(struct gsmd *g)
+{
+ return gsmd_simplecmd(g, "AT\%CPI=3;\%CPRI=1;\%CSQ=1");
+}
+
+static struct gsmd_vendor_plugin plugin_ticalypso = {
+ .name = "TI Calypso",
+ .num_unsolicit = ARRAY_SIZE(ticalypso_unsolicit),
+ .unsolicit = &ticalypso_unsolicit,
+ .detect = &ticalypso_detect,
+ .initsettings = &ticalypso_initsettings,
};
+
+/* FIXME: this will be _init() when we make this a plugin */
+int ticalypso_init(void)
+{
+ return gsmd_vendor_plugin_register(&plugin_ticalypso);
+}
personal git repositories of Harald Welte. Your mileage may vary