[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] Additional programs and language bindings branch, master, updated.
From: |
Daniele Forsi |
Subject: |
[SCM] Additional programs and language bindings branch, master, updated. 090fd7edadebffe651d9096cfb78d601733c9463 |
Date: |
Sat, 24 Mar 2012 10:52:26 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Additional programs and language bindings".
The branch, master has been updated
via 090fd7edadebffe651d9096cfb78d601733c9463 (commit)
from 6137b9d2e5df7338589da7d52b1449042b526756 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii/gnokii-extras.git/commit/?id=090fd7edadebffe651d9096cfb78d601733c9463
commit 090fd7edadebffe651d9096cfb78d601733c9463
Author: Daniele Forsi <address@hidden>
Date: Sat Mar 24 11:49:23 2012 +0100
Change phonebook_status to show all memories supported by the phone
diff --git a/snippets/ChangeLog b/snippets/ChangeLog
index 46d5b3d..69d209d 100644
--- a/snippets/ChangeLog
+++ b/snippets/ChangeLog
@@ -2,6 +2,9 @@
* monitor/
o fix compiler warning in cellid.c (Daniele Forsi)
o fix build failure in waitcall.c due to changed API (Daniele Forsi)
+ * phonebook/
+ o change phonebook_status to show all memories supported by the phone
+ (Daniele Forsi)
2010/02/12
* monitor/
diff --git a/snippets/phonebook/phonebook_status.c
b/snippets/phonebook/phonebook_status.c
index 1671ad9..45d5439 100644
--- a/snippets/phonebook/phonebook_status.c
+++ b/snippets/phonebook/phonebook_status.c
@@ -22,7 +22,7 @@
along with gnokii; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Copyright (C) 2006 by Daniele Forsi
+ Copyright (C) 2006, 2012 by Daniele Forsi
Prints the number of used and free phonebook locations.
@@ -76,27 +76,52 @@ int main(int argc, char *argv[]) {
gn_data data;
gn_error error;
gn_memory_status memorystatus = {0, 0, 0};
-
- if (argc != 2) {
- fprintf(stderr, _("Usage: %s {ME|SM|..}\nPurpose: print the
number of used and free phonebook locations\n"), argv[0]);
- exit(-1);
- }
-
- memorystatus.memory_type = gn_str2memory_type(argv[1]);
- if (memorystatus.memory_type == GN_MT_XX) {
- fprintf(stderr, _("Unknown memory type %s (use ME, SM,
...)!\n"), argv[1]);
+ unsigned int i;
+ gn_memory_type mt[] = {
+ GN_MT_ME, /* Internal memory of the mobile equipment */
+ GN_MT_SM, /* SIM card memory */
+ GN_MT_FD, /* Fixed dial numbers */
+ GN_MT_ON, /* Own numbers */
+ GN_MT_EN, /* Emergency numbers */
+ GN_MT_DC, /* Dialled numbers */
+ GN_MT_RC, /* Received numbers */
+ GN_MT_MC, /* Missed numbers */
+ GN_MT_LD, /* Last dialled */
+ GN_MT_BD, /* Barred Dialling Numbers */
+ GN_MT_SD, /* Service Dialling Numbers */
+ GN_MT_MT, /* combined ME and SIM phonebook */
+ GN_MT_TA, /* for compatibility only: TA=computer memory */
+ GN_MT_CB, /* Currently selected memory */
+ GN_MT_BM, /* Cell Broadcast Messages */
+ GN_MT_MR, /* Message Recipients */
+ GN_MT_CL, /* Call Log (DC + RC + MC) */
+ };
+
+ if (argc != 1) {
+ fprintf(stderr, _("Usage: %s\nPurpose: print the number of used
and free phonebook locations\n"), argv[0]);
exit(-1);
}
businit();
-
+
signal(SIGINT, signal_handler);
gn_data_clear(&data);
data.memory_status = &memorystatus;
- error = gn_sm_functions(GN_OP_GetMemoryStatus, &data, state);
- if (error == GN_ERR_NONE) {
- printf("%d %d\n", memorystatus.used, memorystatus.free);
+ printf("used free type\tname\n");
+ for (i = 0; i < sizeof(mt) / sizeof(*mt); i++) {
+ memorystatus.memory_type = mt[i];
+ error = gn_sm_functions(GN_OP_GetMemoryStatus, &data, state);
+ switch (error) {
+ case GN_ERR_NONE:
+ printf("%5d %5d %s\t%s\n", memorystatus.used,
memorystatus.free, gn_memory_type2str(mt[i]), gn_memory_type_print(mt[i]));
+ break;
+ case GN_ERR_INVALIDMEMORYTYPE:
+ break;
+ default:
+ fprintf(stderr, "%s\n", gn_error_print(error));
+ exit(error);
+ }
}
exit(error);
-----------------------------------------------------------------------
Summary of changes:
snippets/ChangeLog | 3 ++
snippets/phonebook/phonebook_status.c | 53 ++++++++++++++++++++++++---------
2 files changed, 42 insertions(+), 14 deletions(-)
hooks/post-receive
--
Additional programs and language bindings
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] Additional programs and language bindings branch, master, updated. 090fd7edadebffe651d9096cfb78d601733c9463,
Daniele Forsi <=