summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-08-17 08:36:48 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-08-17 08:36:48 +0000
commitad708e46d7a8adc45aa8b9ec2ff7b110303f708f (patch)
tree5a5cc9f7679a8dec50677048d2aa6d52c0f5d9cd /src/util
parent1dc0db218c93c606e0eb3ab5d7cc2dff1677fe75 (diff)
Add retrieving phone's own subscriber number. (Andrzej Zaborowski)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2733 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/util')
-rw-r--r--src/util/event.c1
-rw-r--r--src/util/shell.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/src/util/event.c b/src/util/event.c
index a206bbc..ea8ad3b 100644
--- a/src/util/event.c
+++ b/src/util/event.c
@@ -26,6 +26,7 @@
#include <common/linux_list.h>
#include <libgsmd/libgsmd.h>
#include <libgsmd/event.h>
+#include <libgsmd/sms.h>
static int incall_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux)
{
diff --git a/src/util/shell.c b/src/util/shell.c
index 431b0aa..19abba2 100644
--- a/src/util/shell.c
+++ b/src/util/shell.c
@@ -298,12 +298,22 @@ static int net_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)
const char *oper = (char *) gmh + sizeof(*gmh);
const struct gsmd_msg_oper *opers = (struct gsmd_msg_oper *)
((void *) gmh + sizeof(*gmh));
+ const struct gsmd_own_number *num = (struct gsmd_own_number *)
+ ((void *) gmh + sizeof(*gmh));
static const char *oper_stat[] = {
[GSMD_OPER_UNKNOWN] = "of unknown status",
[GSMD_OPER_AVAILABLE] = "available",
[GSMD_OPER_CURRENT] = "our current operator",
[GSMD_OPER_FORBIDDEN] = "forbidden",
};
+ static const char *srvname[] = {
+ [GSMD_SERVICE_ASYNC_MODEM] = "asynchronous modem",
+ [GSMD_SERVICE_SYNC_MODEM] = "synchronous modem",
+ [GSMD_SERVICE_PAD_ACCESS] = "PAD Access (asynchronous)",
+ [GSMD_SERVICE_PACKET_ACCESS] = "Packet Access (synchronous)",
+ [GSMD_SERVICE_VOICE] = "voice",
+ [GSMD_SERVICE_FAX] = "fax",
+ };
switch (gmh->msg_subtype) {
case GSMD_NETWORK_SIGQ_GET:
@@ -333,6 +343,15 @@ static int net_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)
opers->opname_shortalpha,
oper_stat[opers->stat]);
break;
+ case GSMD_NETWORK_GET_NUMBER:
+ printf("\t%s\t%10s%s%s%s\n", num->addr.number, num->name,
+ (num->service == GSMD_SERVICE_UNKNOWN) ?
+ "" : " related to ",
+ (num->service == GSMD_SERVICE_UNKNOWN) ?
+ "" : srvname[num->service],
+ (num->service == GSMD_SERVICE_UNKNOWN) ?
+ "" : " services");
+ break;
default:
return -EINVAL;
}
@@ -352,6 +371,7 @@ static int shell_help(void)
"\tL\tDetect available operators\n"
"\tQ\tRead signal quality\n"
"\tT\tSend DTMF Tone\n"
+ "\tn\tPrint subscriber numbers\n"
"\tpd\tPB Delete (pb=index)\n"
"\tpr\tPB Read (pr=index)\n"
"\tprr\tPB Read Range (prr=index1,index2)\n"
@@ -630,6 +650,8 @@ int shell_main(struct lgsm_handle *lgsmh)
printf("No.\n");
else
lgsm_sms_set_smsc(lgsmh, ptr + 1);
+ } else if (!strcmp(buf, "n")) {
+ lgsm_get_subscriber_num(lgsmh);
} else {
printf("Unknown command `%s'\n", buf);
}
personal git repositories of Harald Welte. Your mileage may vary