summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authortick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-04 07:22:17 +0000
committertick <tick@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-12-04 07:22:17 +0000
commitc30754e2f07d987fa60950bad385261f1144471e (patch)
tree6fe04542be1610ac4d4ebd221c3de193dc15abda /src/util
parentab2d936a07d536935c6d447caa582a24caf89e32 (diff)
gsmd: Provide Current Call status (sean_chiang)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3557 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/util')
-rw-r--r--src/util/shell.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/util/shell.c b/src/util/shell.c
index 103e161..12914d8 100644
--- a/src/util/shell.c
+++ b/src/util/shell.c
@@ -387,6 +387,37 @@ static int pin_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)
return 0;
}
+static int call_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)
+{
+ struct gsmd_call_status *gcs;
+
+ switch (gmh->msg_subtype) {
+ case GSMD_VOICECALL_GET_STAT:
+ gcs = (struct gsmd_call_status*) ((char *)gmh + sizeof(*gmh));
+
+ if (gcs->idx > 0)
+ printf("%d, %d, %d, %d, %d, %s, %d\n",
+ gcs->idx, gcs->dir,
+ gcs->stat, gcs->mode,
+ gcs->mpty, gcs->number,
+ gcs->type);
+ else if (gcs->idx < 0)
+ /* If index < 0, error happens */
+ printf("+CME ERROR %d\n", (0-(gcs->idx)));
+ else
+ /* No existing call */
+ printf("Doesn't exist\n");
+
+ if (gcs->is_last)
+ pending_responses --;
+ break;
+ default:
+ return -EINVAL;
+ }
+ pending_responses --;
+ return 0;
+}
+
static const struct msghandler_s {
int type;
lgsm_msg_handler *fn;
@@ -397,6 +428,7 @@ static const struct msghandler_s {
{ GSMD_MSG_NETWORK, net_msghandler },
{ GSMD_MSG_PHONE, phone_msghandler },
{ GSMD_MSG_PIN, pin_msghandler },
+ { GSMD_MSG_VOICECALL, call_msghandler },
{ 0, 0 }
};
@@ -437,6 +469,7 @@ static int shell_help(void)
"\tsc\tSMS Show Service Centre\n"
"\tsC\tSMS Set Service Centre (sC=number)\n"
"\tim\tGet imsi\n"
+ "\tcs\tGet Call status\n"
"\tq\tQuit\n"
);
}
@@ -724,6 +757,10 @@ int shell_main(struct lgsm_handle *lgsmh, int sync)
printf("Modem Power Off\n");
lgsm_modem_power(lgsmh, 0);
pending_responses ++;
+ } else if ( !strncmp(buf, "cs", 2)) {
+ printf("List current call status\n");
+ lgsm_voice_get_status(lgsmh);
+ pending_responses ++;
} else {
printf("Unknown command `%s'\n", buf);
}
personal git repositories of Harald Welte. Your mileage may vary