[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reading the phonebook from a 7110
From: |
Lars Bjønnes |
Subject: |
Reading the phonebook from a 7110 |
Date: |
Thu, 04 Jul 2002 17:49:37 +0200 |
User-agent: |
Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu) |
Hi!
I couldn't find an option for the gnokii command line utility to read
the phonebook of my phone, a 7110 (or others). I've used the CVS
version (2 days old now), and added functionality for getting a simple
list of the entries using gnokii --getphonebook.
However, my code is far from complete and fully tested¹, with lots of
debugging information needing to be removed. Are you guys planning to
support --getphonebook, or should I continue to develop this function
and post a patch later?
(Btw, is there a "library" version of gnokii, suitable for interfacing
to a phone from Python or Perl?)
Anyway, thanks for a great program.
¹ Here's the function I'm working on. I'm no C-programmer, so this is
probably really awful code. :-) I've added the --getphonebook option
in all the appropriate places, this is just the function. I'll submit
a complete patch later if anyone is insterested.
gnokii.c
static int getphonebook()
{
GSM_PhonebookEntry entry;
GSM_Data data;
GSM_Error error = GE_NOTSUPPORTED;
int i;
/* Do I really need both memsets? */
memset(&entry, 0, sizeof(GSM_PhonebookEntry));
memset(&data, 0, sizeof(GSM_Data));
entry.Location = 100;
entry.MemoryType = GMT_SM;
data.PhonebookEntry = &entry;
/* Do write and report success/failure. */
error = SM_Functions(GOP_ReadPhonebook, &data, &State);
if (error == GE_NONE) {
fprintf (stdout, _("Name:%s\n"), entry.Name);
fprintf (stdout, _("Number:%s\n"), entry.Number);
if (entry.SubEntriesCount > 0) {
for (i = 0; i < entry.SubEntriesCount; i++) {
fprintf (stdout, _("subentry\n"));
fprintf (stdout, _("Number:%s\n"),
entry.SubEntries[i].data.Number);
}
}
} else {
fprintf (stdout, _("Read FAILED(%s)"), print_error(error));
}
return 0;
}
--
Lars
- Reading the phonebook from a 7110,
Lars Bjønnes <=