diff options
author | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-08-17 08:32:14 +0000 |
---|---|---|
committer | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-08-17 08:32:14 +0000 |
commit | 86c7ff07f100489d085efd6541b8c104a44209e0 (patch) | |
tree | c22d7172cec161430b130032f7b3ec8678d34afa /src/libgsmd | |
parent | 34fbfd275b710d3662eb490f6a59f58285892f70 (diff) |
From: Andrzej Zaborowski <balrog@zabor.org>
Date: Tue, 31 Jul 2007 22:26:36 +0200
Subject: [PATCH] Operations on the preferred operators list.
This makes use of the AT+CPOL variants to add / delete / list entries in the
preferred operators list on the SIM. There's some inconsistency, similarly as
with operator selection, in that we return operator names in long
alphanumeric format but we take only operators in numeric format as
parameters. Either the client will have to convert between the formats or
we should always use for example the long alphanumeric format, or maybe
do something else.
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2725 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/libgsmd')
-rw-r--r-- | src/libgsmd/libgsmd_network.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/libgsmd/libgsmd_network.c b/src/libgsmd/libgsmd_network.c index 9a21fb5..0b458de 100644 --- a/src/libgsmd/libgsmd_network.c +++ b/src/libgsmd/libgsmd_network.c @@ -78,3 +78,53 @@ int lgsm_signal_quality(struct lgsm_handle *lh) { return lgsm_send_simple(lh, GSMD_MSG_NETWORK, GSMD_NETWORK_SIGQ_GET); } + +int lgsm_prefoper_list(struct lgsm_handle *lh) +{ + return lgsm_send_simple(lh, GSMD_MSG_NETWORK, GSMD_NETWORK_PREF_LIST); +} + +int lgsm_prefoper_delete(struct lgsm_handle *lh, int index) +{ + struct gsmd_msg_hdr *gmh; + + gmh = lgsm_gmh_fill(GSMD_MSG_NETWORK, GSMD_NETWORK_PREF_DEL, + sizeof(int)); + if (!gmh) + return -ENOMEM; + + memcpy(gmh->data, &index, sizeof(int)); + + if (lgsm_send(lh, gmh) < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh); + return -EIO; + } + + lgsm_gmh_free(gmh); + return 0; +} + +int lgsm_prefoper_add(struct lgsm_handle *lh, gsmd_oper_numeric oper) +{ + struct gsmd_msg_hdr *gmh; + + gmh = lgsm_gmh_fill(GSMD_MSG_NETWORK, GSMD_NETWORK_PREF_ADD, + sizeof(gsmd_oper_numeric)); + if (!gmh) + return -ENOMEM; + + memcpy(gmh->data, oper, sizeof(gsmd_oper_numeric)); + + if (lgsm_send(lh, gmh) < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh); + return -EIO; + } + + lgsm_gmh_free(gmh); + return 0; +} + +int lgsm_prefoper_get_space(struct lgsm_handle *lh) +{ + return lgsm_send_simple(lh, GSMD_MSG_NETWORK, GSMD_NETWORK_PREF_SPACE); +} |