From 08e6075437cee1e4a408242e46e27fffda3c514e Mon Sep 17 00:00:00 2001 From: laforge Date: Wed, 28 Mar 2007 11:46:45 +0000 Subject: add parsing of +CMS errors according to GSM 07.05 (Philipp Zabel) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1529 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/Makefile.am | 2 +- include/gsmd/ts0705.h | 35 +++++++++++++++++++++++++++++++++++ src/gsmd/atcmd.c | 14 +++++++++++++- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 include/gsmd/ts0705.h diff --git a/include/gsmd/Makefile.am b/include/gsmd/Makefile.am index f3090f3..0484472 100644 --- a/include/gsmd/Makefile.am +++ b/include/gsmd/Makefile.am @@ -1,4 +1,4 @@ pkginclude_HEADERS = event.h usock.h -noinst_HEADERS = atcmd.h gsmd.h select.h ts0707.h unsolicited.h usock.h vendorplugin.h +noinst_HEADERS = atcmd.h gsmd.h select.h ts0705.h ts0707.h unsolicited.h usock.h vendorplugin.h diff --git a/include/gsmd/ts0705.h b/include/gsmd/ts0705.h new file mode 100644 index 0000000..f96d21b --- /dev/null +++ b/include/gsmd/ts0705.h @@ -0,0 +1,35 @@ +#ifndef _GSM_0705_H +#define _GSM_0705_H + +/* Section 3.2.5 */ +enum gsm0705_cms_error { + /* 000..127 GSM 04.11 Annex E-2 values */ + /* 128..255 GSM 03.40 subclause 9.2.3.22 values */ + GSM0705_CMS_ME_FAILURE = 300, + GSM0705_CMS_SMS_SERVICE_OF_ME_RESERVED = 301, + GSM0705_CMS_OPERATION_NOT_ALLOWED = 302, + GSM0705_CMS_OPERATION_NOT_SUPPORTED = 303, + GSM0705_CMS_INVALID_PDU_PARAMETER = 304, + GSM0705_CMS_INVALID_TEXT_PARAMETER = 305, + GSM0705_CMS_SIM_NOT_INSERTED = 310, + GSM0705_CMS_SIM_PIN_REQUIRED = 311, + GSM0705_CMS_PH_SIM_PIN_REQUIRED = 312, + GSM0705_CMS_SIM_FAILURE = 313, + GSM0705_CMS_SIM_BUSY = 314, + GSM0705_CMS_SIM_WRONG = 315, + GSM0705_CMS_SIM_PUK_REQUIRED = 316, + GSM0705_CMS_SIM_PIN2_REQUIRED = 317, + GSM0705_CMS_SIM_PUK2_REQUIRED = 318, + GSM0705_CMS_MEMORY_FAILURE = 320, + GSM0705_CMS_INVALID_MEMORY_INDEX = 321, + GSM0705_CMS_MEMORY_FULL = 322, + GSM0705_CMS_SMSC_ADDRESS_UNKNOWN = 330, + GSM0705_CMS_NO_NETWORK_SERVICE = 331, + GSM0705_CMS_NETWORK_TIMEOUT = 332, + GSM0705_CMS_NO_CNMA_ACK_EXPECTED = 340, + GSM0705_CMS_UNKNOWN_ERROR = 500, + /* 501..511 reserved */ + /* 512..xxx manufacturer specific */ +}; + +#endif /* _GSM_0705_H */ diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c index 11e9251..53a7501 100644 --- a/src/gsmd/atcmd.c +++ b/src/gsmd/atcmd.c @@ -33,6 +33,7 @@ #include "gsmd.h" +#include #include #include #include @@ -50,7 +51,8 @@ enum final_result_codes { static const char *final_results[] = { "OK", "ERROR", - "+CME ERROR:" + "+CME ERROR:", + "+CMS ERROR:", }; /* we basically implement a parse that can deal with @@ -223,6 +225,16 @@ static int ml_parse(const char *buf, int len, void *ctx) final = 1; goto final_cb; } + if (!strncmp(buf+1, "CMS ERROR", 9)) { + /* Part of Case 'C' */ + unsigned long err_nr; + err_nr = strtoul(colon+1, NULL, 10); + DEBUGP("error number %lu\n", err_nr); + if (cmd) + cmd->ret = err_nr; + final = 1; + goto final_cb; + } if (!cmd || strncmp(buf, &cmd->buf[2], colon-buf)) { /* Assuming Case 'B' */ -- cgit v1.2.3