From a2dfc99dc499ea8600bf5178f8122125d7d7d557 Mon Sep 17 00:00:00 2001 From: short <> Date: Mon, 18 Feb 2002 02:06:50 +0000 Subject: [PATCH] http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz md5sum: b14eeefdf274009e844ac6424b45d9ef length: 1078794 --- COPYING | 2 +- Docs/CREDITS | 58 +- Docs/Makefile | 86 +- Docs/man/gnokii.1 | 10 +- Docs/man/todologo.1 | 5 +- Docs/man/xgnokii.1x | 2 +- Makefile | 46 +- Makefile.global.in | 2 +- VERSION | 2 +- common/Makefile | 85 +- common/data/at-emulator.c | 21 +- common/data/datapump.c | 98 +- common/data/rlp-common.c | 22 - common/data/rlp-crc24.c | 10 - common/data/virtmodem.c | 49 +- common/devices/tekram.c | 52 +- common/devices/unixirda.c | 137 +- common/devices/unixserial.c | 376 +- common/gsm-api.c | 841 ++- common/gsm-bitmaps.c | 428 +- common/gsm-networks.c | 87 +- common/gsm-ringtones.c | 1403 +++-- common/gsm-sms.c | 1657 +++--- common/misc.c | 350 +- configure.in | 18 +- getopt/Makefile | 2 +- gnokii/Makefile | 33 +- gnokii/gnokii.c | 10758 +++++++++++++++++++++++++++--------- gnokiid/Makefile | 23 +- gnokiid/gnokiid.c | 146 +- include/config.h.in.in | 16 +- include/data/at-emulator.h | 14 - include/data/datapump.h | 10 - include/data/rlp-common.h | 193 +- include/data/rlp-crc24.h | 17 +- include/data/virtmodem.h | 22 +- include/devices/tekram.h | 30 +- include/devices/unixirda.h | 32 +- include/devices/unixserial.h | 27 +- include/gsm-api.h | 538 +- include/gsm-bitmaps.h | 69 +- include/gsm-common.h | 881 +-- include/gsm-networks.h | 38 +- include/gsm-ringtones.h | 110 +- include/gsm-sms.h | 581 +- include/misc.h | 211 +- packaging/Debian/README.debian | 3 +- packaging/Debian/control | 13 +- packaging/Debian/copyright | 42 +- packaging/Debian/docs | 7 + packaging/Debian/menu | 2 +- packaging/Debian/postinst | 7 +- packaging/Debian/preinst | 9 +- packaging/Debian/rules | 44 +- packaging/RedHat/gnokii.spec.in | 19 +- packaging/Slackware/SlackBuild.in | 29 +- packaging/make_dist | 1 - po/Makefile.in.in | 11 +- po/POTFILES.in | 32 +- po/et.po | 2897 +++++----- po/pl.po | 2 +- utils/Makefile | 25 +- utils/mgnokiidev.c | 18 +- xgnokii/Makefile | 144 +- xgnokii/VERSION | 2 +- xgnokii/xgnokii.c | 291 +- xgnokii/xgnokii.h | 13 +- xgnokii/xgnokii_calendar.c | 15 +- xgnokii/xgnokii_calendar.h | 5 - xgnokii/xgnokii_cfg.c | 5 - xgnokii/xgnokii_cfg.h | 5 - xgnokii/xgnokii_common.c | 8 +- xgnokii/xgnokii_common.h | 21 +- xgnokii/xgnokii_contacts.c | 69 +- xgnokii/xgnokii_contacts.h | 6 +- xgnokii/xgnokii_data.c | 13 +- xgnokii/xgnokii_data.h | 5 - xgnokii/xgnokii_dtmf.c | 8 +- xgnokii/xgnokii_dtmf.h | 5 - xgnokii/xgnokii_logos.c | 620 ++- xgnokii/xgnokii_lowlevel.c | 387 +- xgnokii/xgnokii_lowlevel.h | 13 +- xgnokii/xgnokii_netmon.c | 8 +- xgnokii/xgnokii_netmon.h | 5 - xgnokii/xgnokii_sms.c | 400 +- xgnokii/xgnokii_sms.h | 5 - xgnokii/xgnokii_speed.c | 8 +- xgnokii/xgnokii_speed.h | 5 - xgnokii/xgnokii_xkeyb.c | 134 +- xgnokii/xgnokii_xkeyb.h | 5 - 90 files changed, 15625 insertions(+), 9339 deletions(-) diff --git a/COPYING b/COPYING index 99a8ab6..049061c 100644 --- a/COPYING +++ b/COPYING @@ -17,7 +17,7 @@ Place - Suite 330, Boston, MA 02111-1307, USA. You can contact authors by mail at -hugh@blemings.org Pavel.Janik@suse.cz +hugh@linuxcare.com Pavel.Janik@suse.cz Hugh Blemings Mgr. Pavel Janík, SuSE CR, s.r.o. PO Box 234 Pod Pekárnami 338/12 Belconnen ACT 2616 190 00 Praha 9 diff --git a/Docs/CREDITS b/Docs/CREDITS index 820c4af..8232bd3 100644 --- a/Docs/CREDITS +++ b/Docs/CREDITS @@ -56,7 +56,7 @@ Thank you to, in no particular order... * Goran Dokic, Samuli Sorvakko and anonymous for gettext files for Dutch, Finnish and German translations. -* Marcel Holtmann for RLP FCS code, the irda code and other misc stuff. +* Marcel Holtmann for RLP FCS code and misc stuff. * Chris Kemp for logo stuff and a big part of the RLP code. @@ -73,54 +73,38 @@ Thank you to, in no particular order... * Alessandro Zummo for reset and getopts code. -* Manfred Jonsson for his manufacturer and windows patch, and AT command - support. - * Mark Looi for Cell Broadcast code - based on protocol decoded by - Colin Paton. - -* Sebastian Zagrodzki and Jacek Fiok for Polish .po file. - -* Marcin Wi±cek for all his work and tons of patches. - -* Gabriele Zappi for testing, general help and bug fixes. - -* Erik Rossen for help with documentation and debian packaging support. + Colin Paton -* Marian Jancar for patches on 7110 series. +* Sebastian Zagrodzki and Jacek Fiok for Polish .po file -* Tamar Bondar for updates on SMS handling on 3810 series. - -* Marek Rogoziñski for help in tracing some nasty bugs. - -* Pavel Machek for developing 2110 and Duncall support and many clever - hints. - -* Bo¹tjan Müller for Slovenian translation and other things. - -* Hans Motshärg for Estonian translation. +* Lucy for making pizza and putting up with Hugh disappearing to + work on this. Rachael for new parent induced insomnia... -* Marcin P³awiñski for preview logos. +* Last not least: Mirka for allowing Pavel to work on gnokii + and for _great_ gnokii operator logos... -* Martin Lucina for any kind of help he is providing ;-) +* Hendrik Spohr for getting 7110 functions and DLR-3 to work (one small step + for Hendrik, big step for (my)gnokii :-)) + +* Balazs Nagy for frames list and long hacker's work... -* Gabriele Stella for Italian translation. +* Ladislav Michl & Manfred Jonsson for support for various AT phones... -* Andrea Scopece for bug reports and other help. - -* Panagiotis Astithas, Daniel O'Connor, Sheldon Hearn for help with FreeBSD. +* Manfred Jonsson for idea of programming, which looks for me good -* Artur Kubiak for help with Solaris. +* Michael Hund for many improvements and progress in 7110/6210 source... -* Markus Plail for work on 7110 support. +* Ralf Thelen for very required by many, many people patch and getting + infrared sockets to work -> small changes, few days of hard searching :-). + Also sms stuff is OK now -* Simon Huggins for help with 6210 and IrDA. +* Gabriele Zappi for many 6210 improvements and big calendar source -* Lucy for making pizza and putting up with Hugh disappearing to - work on this. Rachael for new parent induced insomnia... +* Andrea Scopece for 61xx source for netmonitor and other improvements -* Last not least: Mirka for allowing Pavel to work on gnokii - and for _great_ gnokii operator logos... +* ....and other people, who reported me bugs or want(ed) to use mygnokii + and help me in making it the best ! We tried to mentioned everyone who contributed to gnokii project but we might to forgot someone. If anyone does feel that we missed him and his diff --git a/Docs/Makefile b/Docs/Makefile index d5666ac..8dd1724 100644 --- a/Docs/Makefile +++ b/Docs/Makefile @@ -1,47 +1,63 @@ # -# Makefile for the GNOKII tool suite's documentation directory -# -# Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. -# 2000 Karel Zak +# Makefile for the xGNOKII tool suite. # -TOPDIR=../ -include ${TOPDIR}/Makefile.global +TOPDIR=.. +include $(TOPDIR)/Makefile.global -# -# Documentation for gnokii (xgnokii install documentation files itself). -# +HELP1_DIR = en_US +HELP11_DIR = pl_PL +HELP2_DIR = examples +HELP3_DIR = default + +GNOKII1_MAN1 = "man/gnokii.1" +GNOKII1_MAN2 = "man/todologo.1" +GNOKII8_MAN1 = "man/gnokiid.8" +GNOKII8_MAN2 = "man/mgnokiidev.8" +XGNOKII_MAN = "man/xgnokii.1x" -INSTALL_DOCS = README \ - README-3810 \ - README-6110 \ - CREDITS \ - DataCalls-QuickStart \ - README-WIN32 \ - gettext-howto \ - gnokii.nol \ - gnokii-ir-howto \ - packaging-howto \ - sample.gnokiirc - -GNOKII1_MAN = "man/gnokii.1 man/todologo.1" -GNOKII8_MAN = "man/gnokiid.8 man/mgnokiidev.8" -XGNOKII_MAN = man/xgnokii.1x - -all: +all: @echo +makelib: + @echo + install: $(INSTALL) -d $(docdir) - @for xxx in $(INSTALL_DOCS); do \ - if [ -e $$xxx ]; then \ - $(INSTALL) -m 0444 $$xxx $(docdir)/$$xxx; \ - fi; \ - done - $(INSTALL) $(GNOKII1_MAN) $(man1dir) - $(INSTALL) $(GNOKII8_MAN) $(man8dir) - if [ "x$HAVE_XGNOKII" = xyes ]; then \ - $(INSTALL) $(XGNOKII_MAN) $(xmandir) \ + + ( cd $(HELP1_DIR); \ + $(FIND) . -type d \! -path "*CVS*" \ + -exec $(INSTALL) -d $(docdir)/en_US/{} \; ; \ + $(FIND) . -type f \! -path "*CVS*" \ + -exec $(INSTALL) -m 0444 {} $(docdir)/en_US/{} \; \ + ) + ( cd $(HELP11_DIR); \ + $(FIND) . -type d \! -path "*CVS*" \ + -exec $(INSTALL) -d $(docdir)/pl_PL/{} \; ; \ + $(FIND) . -type f \! -path "*CVS*" \ + -exec $(INSTALL) -m 0444 {} $(docdir)/pl_PL/{} \; \ + ) + + ( cd $(HELP2_DIR); \ + $(FIND) . -type d \! -path "*CVS*" \ + -exec $(INSTALL) -d $(docdir)/examples/{} \; ; \ + $(FIND) . -type f \! -path "*CVS*" \ + -exec $(INSTALL) -m 0444 {} $(docdir)/examples/{} \; \ + ) + ( cd $(HELP3_DIR); \ + $(FIND) . -type d \! -path "*CVS*" \ + -exec $(INSTALL) -d $(docdir)/default/{} \; ; \ + $(FIND) . -type f \! -path "*CVS*" \ + -exec $(INSTALL) -m 0444 {} $(docdir)/default/{} \; \ + ) + $(INSTALL) -m 0444 CREDITS $(docdir) + $(INSTALL) -m 0444 ../COPYING $(docdir) + $(INSTALL) $(GNOKII1_MAN1) $(man1dir) + $(INSTALL) $(GNOKII1_MAN2) $(man1dir) + $(INSTALL) $(GNOKII8_MAN1) $(man8dir) + $(INSTALL) $(GNOKII8_MAN2) $(man8dir) + if [ "x$(HAVE_XGNOKII)" = xyes ]; then \ + ($(INSTALL) $(XGNOKII_MAN) $(xmandir)) \ fi @echo "done" diff --git a/Docs/man/gnokii.1 b/Docs/man/gnokii.1 index 1c9e4a2..214d696 100644 --- a/Docs/man/gnokii.1 +++ b/Docs/man/gnokii.1 @@ -61,16 +61,16 @@ resets the phone. .SS CALENDAR .TP -.BR "\-\-getcalendarnote \fIstart\fP [\fIsend\fP] [\-v]" -get the note with numbers from \fIstart\fR to \fIend\fR from calendar. +.BR "\-\-getcalendarnote \fIindex\fP [\-v]" +get the note with number \fIindex\fR from calendar. .PP [\-v] \- output in vCalendar 1.0 format .TP .BR "\-\-writecalendarnote" write the note to calendar. .TP -.BR "\-\-deletecalendarnote \fIstart\fP [\fIend\fP]" -delete the note with numbers from \fIstart\fR to \fIend\fR from calendar. +.BR "\-\-deletecalendarnote \fIindex\fP" +delete the note with number [\fIindex\fR] from calendar. .SS SMS .TP @@ -193,4 +193,4 @@ See also Docs/CREDITS from Gnokii sources. This program is distributed under the GNU Public License. .SH "SEE ALSO" -gnokiid, xgnokii +gnokiid, xgnokii, xlogos diff --git a/Docs/man/todologo.1 b/Docs/man/todologo.1 index db9b969..c66955b 100644 --- a/Docs/man/todologo.1 +++ b/Docs/man/todologo.1 @@ -33,7 +33,7 @@ from \fIgnokii.nol\fR that is distributed with mobile phone. Use .B gnokii or -.B xgnokii +.B xlogos to do the uploading. .SH EXAMPLES @@ -52,5 +52,6 @@ Tomi Ollila This program is distributed under the GNU Public License. .SH SEE ALSO -.BR gnokii(1), xgnokii(1x) +.BR gnokii(1), +xlogos diff --git a/Docs/man/xgnokii.1x b/Docs/man/xgnokii.1x index 16f1037..5fad541 100644 --- a/Docs/man/xgnokii.1x +++ b/Docs/man/xgnokii.1x @@ -36,4 +36,4 @@ See also Docs/CREDITS from the Gnokii sources. This program is distributed under the GNU Public License. .SH "SEE ALSO" -gnokii, gnokiid +gnokii, gnokiid, xlogos diff --git a/Makefile b/Makefile index cfef684..1feaf9c 100644 --- a/Makefile +++ b/Makefile @@ -18,17 +18,26 @@ include ${TOPDIR}/Makefile.global BIN_DIRS = gnokii ifndef WIN32 -BIN_DIRS += gnokiid utils +BIN_DIRS += gnokiid +BIN_DIRS += mgnetd +BIN_DIRS += mgnetd/mg_demo_client endif -DIRS = common/phones \ - common/links \ - common/devices \ - common/data \ - common \ +DIRS = common \ + Docs \ $(BIN_DIRS) -GTK_DIRS = xgnokii +# +# For now gnokiid and utils only make sense on Unix like systems. +# Some other stuff that makes only sense on Win32 platform. +# + +ifndef WIN32 +DIRS += utils +endif + +GTK_DIRS = xgnokii \ + xlogos PO_DIR = po DOCS_DIR = Docs @@ -47,6 +56,25 @@ all: $(DIRS) fi @echo "done" +makelib: + @for dir in $(DIRS); do \ + if [ -e $$dir/Makefile ]; then \ + $(MAKE) -C $$dir makelib; \ + fi; \ + done + @if [ "x$(USE_NLS)" = xyes ]; then \ + $(MAKE) -C $(PO_DIR) makelib; \ + fi + + @if [ "$(GTK_LIBS)" ]; then \ + for dir in $(GTK_DIRS); do \ + if [ -e $$dir/Makefile ]; then \ + $(MAKE) -C $$dir makelib; \ + fi; \ + done \ + fi + @echo "done" + dummy: $(DIRS): dummy @@ -90,8 +118,6 @@ distclean: clean packaging/Slackware/SlackBuild \ po/Makefile.in \ debian - $(RM) `$(FIND) . -name "*~"` - @echo "done" dep: @for dir in $(DIRS); do \ @@ -109,7 +135,7 @@ dep: fi @echo "done" -install: all +install: @for dir in $(DIRS); do \ if [ -e $$dir/Makefile ]; then \ $(MAKE) -C $$dir install; \ diff --git a/Makefile.global.in b/Makefile.global.in index 05f4a5a..23fa672 100644 --- a/Makefile.global.in +++ b/Makefile.global.in @@ -27,7 +27,7 @@ libdir = @libdir@ xgnokii_libdir = @XGNOKIIDIR@/@XPACKAGE@ man1dir = @mandir@/man1/ man8dir = @mandir@/man8/ -xmandir = ${prefix}/X11R6/man/man1/ +xmandir = @mandir@/man1/ docdir = ${prefix}/doc/${PACKAGE} locdir = @datadir@/locale diff --git a/VERSION b/VERSION index 15a1a14..4735d92 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0pre5 +0.3.3_pre8-gold_2002_02_16 diff --git a/common/Makefile b/common/Makefile index 9b44ad1..e396803 100644 --- a/common/Makefile +++ b/common/Makefile @@ -1,12 +1,7 @@ # -# $Id$ -# # Makefile for the GNOKII tool suite. # -# Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. -# 2000 Karel Zak -# # # For this common directory is used "subsystem.o" .o files concept. @@ -17,46 +12,73 @@ TOPDIR=.. include $(TOPDIR)/Makefile.global -OBJS = cfgreader.o \ - device.o \ +CFLAGS += $(PTHREAD_CFLAGS) + +DIRS = protocol \ + oldmodules \ + newmodules + +OBJS = devices/device.o \ + data/rlp-common.o \ + data/rlp-crc24.o \ + files/midifile.o \ gsm-ringtones.o \ + gsm-coding.o \ + gsm-datetime.o \ + gsm-wap.o \ gsm-api.o \ + gsm-phonebook.o \ + gsm-calendar.o \ gsm-networks.o \ - vcal.o \ - misc.o \ - gsm-sms.o \ gsm-bitmaps.o \ - gsm-common.o \ - gsm-encoding.o \ - gsm-error.o \ - gsm-statemachine.o - -all: libgnokii.so gsm-filetypes.o + gsm-sms.o \ + files/cfgreader.o \ + misc.o \ + protocol/fbus.o \ + protocol/fbusirda.o \ + protocol/mbus.o \ + protocol/at.o \ + newmodules/sniff/sniff.o \ + newmodules/newat.o \ + newmodules/n6110.o \ + newmodules/n7110.o + +DATA_OBJS = data/virtmodem.o \ + data/at-emulator.o \ + data/datapump.o + +ifdef WIN32 + OBJS += $(TOPDIR)/win32/winserial.o +else + OBJS += devices/unixserial.o \ + devices/unixirda.o \ + devices/tekram.o +endif -phones/PHONES.o: - $(MAKE) -C phones PHONES.o +ifdef XPM_CFLAGS + CFLAGS += $(XPM_CFLAGS) +endif -links/LINKS.o: - $(MAKE) -C links LINKS.o +all: COMMON.o DATA.o gsm-filetypes.o -devices/DEVICES.o: - $(MAKE) -C devices DEVICES.o +COMMON.o: $(OBJS) + $(LD) $(LDREL) $(LDOUT) COMMON.o $(OBJS) -libgnokii.so: $(OBJS) phones/PHONES.o links/LINKS.o devices/DEVICES.o - $(CC) -shared -o libgnokii.so $(OBJS) phones/PHONES.o links/LINKS.o devices/DEVICES.o +DATA.o: $(DATA_OBJS) + $(LD) $(LDREL) $(LDOUT) DATA.o $(DATA_OBJS) -gsm-filetypes.o: gsm-filetypes.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(XPM_CFLAGS) -c gsm-filetypes.c +gsm-filetypes.o: files/gsm-filetypes.c + $(CC) $(CFLAGS) -c files/gsm-filetypes.c -vcal.c: vcal.lx - $(LEX) -ovcal.c vcal.lx +makelib: $(OBJS) DATA.o gsm-filetypes.o + $(CC) -shared -o libmygnokii.so $(OBJS) DATA.o gsm-filetypes.o clean: - $(RM) $(OBJS) *~ depend libgnokii.so gsm-filetypes.o vcal.c phones/PHONES.o links/LINKS.o devices/DEVICES.o - + $(RM) $(OBJS) $(DATA_OBJS) *~ depend libmygnokii.so COMMON.o gsm-filetypes.o DATA.o + install: $(INSTALL) -d $(libdir) - $(INSTALL) libgnokii.so $(libdir) + $(INSTALL) libmygnokii.so $(libdir) @echo depend dep: @@ -68,4 +90,3 @@ endif .PHONY: all install clean dep depend - diff --git a/common/data/at-emulator.c b/common/data/at-emulator.c index e952df2..41445c8 100644 --- a/common/data/at-emulator.c +++ b/common/data/at-emulator.c @@ -6,8 +6,6 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. This file provides a virtual modem or "AT" interface to the GSM phone by @@ -33,7 +31,7 @@ #ifndef WIN32 -# include + #include #endif @@ -307,7 +305,7 @@ static GSM_Error ATEM_ReadSMS(int number, GSM_MemoryType type, GSM_SMSMessage *m GSM_Error error; message->MemoryType = type; - message->Number = number; + message->Location = number; error = GSM->GetSMSMessage(message); return error; @@ -317,14 +315,13 @@ static void ATEM_PrintSMS(char *line, GSM_SMSMessage *message, int mode) { switch (mode) { case INTERACT_MODE: - gsprintf(line, MAX_LINE_LENGTH, _("\n\rDate/time: %d/%d/%d %d:%02d:%02d Sender: %s Msg Center: %s\n\rText: %s\n\r"), message->Time.Day, message->Time.Month, message->Time.Year, message->Time.Hour, message->Time.Minute, message->Time.Second, message->RemoteNumber.number, message->MessageCenter.Number, message->MessageText); + gsprintf(line, MAX_LINE_LENGTH, _("\n\rDate/time: %d/%d/%d %d:%02d:%02d Sender: %s Msg Center: %s\n\rText: %s\n\r"), message->Time.Day, message->Time.Month, message->Time.Year, message->Time.Hour, message->Time.Minute, message->Time.Second, message->Sender, message->MessageCenter.Number, message->MessageText); break; case TEXT_MODE: - if ((message->DCS.Type == SMS_GeneralDataCoding) && - (message->DCS.u.General.Alphabet == SMS_8bit)) - gsprintf(line, MAX_LINE_LENGTH, _("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\n\r%s"), (message->Status ? _("REC READ") : _("REC UNREAD")), message->RemoteNumber.number, message->Time.Year, message->Time.Month, message->Time.Day, message->Time.Hour, message->Time.Minute, message->Time.Second, message->Time.Timezone, _("")); + if (message->Coding==GSM_Coding_8bit) + gsprintf(line, MAX_LINE_LENGTH, _("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\n\r%s"), (message->Status ? _("REC READ") : _("REC UNREAD")), message->Sender, message->Time.Year, message->Time.Month, message->Time.Day, message->Time.Hour, message->Time.Minute, message->Time.Second, message->Time.Timezone, _("")); else - gsprintf(line, MAX_LINE_LENGTH, _("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\n\r%s"), (message->Status ? _("REC READ") : _("REC UNREAD")), message->RemoteNumber.number, message->Time.Year, message->Time.Month, message->Time.Day, message->Time.Hour, message->Time.Minute, message->Time.Second, message->Time.Timezone, message->MessageText); + gsprintf(line, MAX_LINE_LENGTH, _("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\n\r%s"), (message->Status ? _("REC READ") : _("REC UNREAD")), message->Sender, message->Time.Year, message->Time.Month, message->Time.Day, message->Time.Hour, message->Time.Minute, message->Time.Second, message->Time.Timezone, message->MessageText); break; case PDU_MODE: gsprintf(line, MAX_LINE_LENGTH, _("")); @@ -339,7 +336,7 @@ static void ATEM_EraseSMS(int number, GSM_MemoryType type) { GSM_SMSMessage message; message.MemoryType = type; - message.Number = number; + message.Location = number; if (GSM->DeleteSMSMessage(&message) == GE_NONE) { ATEM_ModemResult(MR_OK); } else { @@ -555,12 +552,12 @@ bool ATEM_CommandPlusC(char **buf) strcasecmp(*buf, "3") == 0 || strcasecmp(*buf, "\"REC READ\"") == 0 || strcasecmp(*buf, "\"STO SENT\"") == 0) { - status = SMS_Sent; + status = GSS_SENTREAD; } else if (strcasecmp(*buf, "0") == 0 || strcasecmp(*buf, "2") == 0 || strcasecmp(*buf, "\"REC UNREAD\"") == 0 || strcasecmp(*buf, "\"STO UNSENT\"") == 0) { - status = SMS_Unsent; + status = GSS_NOTSENTREAD; } else if (strcasecmp(*buf, "4") == 0 || strcasecmp(*buf, "\"ALL\"") == 0) { status = 4; /* ALL */ diff --git a/common/data/datapump.c b/common/data/datapump.c index 969091a..4eede53 100644 --- a/common/data/datapump.c +++ b/common/data/datapump.c @@ -6,28 +6,12 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. This file provides routines to handle processing of data when connected in fax or data mode. Converts data from/to GSM phone to virtual modem interface. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:07 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.4 2001/11/17 16:41:35 pkot - Cleanup - - Revision 1.3 2001/02/21 19:57:00 chris - More fiddling with the directory layout - - Revision 1.2 2001/02/17 22:40:51 chris - ATA support - - */ #define __data_datapump_c @@ -69,12 +53,12 @@ bool DP_Initialise(int read_fd, int write_fd) { PtyRDFD = read_fd; PtyWRFD = write_fd; - ufds.fd = PtyRDFD; - ufds.events = POLLIN; + ufds.fd=PtyRDFD; + ufds.events=POLLIN; RLP_Initialise(GSM->SendRLPFrame, DP_CallBack); - RLP_SetUserRequest(Attach_Req, true); - pluscount = 0; - connected = false; + RLP_SetUserRequest(Attach_Req,true); + pluscount=0; + connected=false; return true; } @@ -85,76 +69,78 @@ int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length) switch(ind) { case Data: - if (CommandMode == false) write(PtyWRFD, buffer, length); + if (CommandMode==false) write(PtyWRFD, buffer, length); break; case Conn_Ind: - if (CommandMode == false) ATEM_ModemResult(MR_CARRIER); - RLP_SetUserRequest(Conn_Req, true); + if (CommandMode==false) ATEM_ModemResult(MR_CARRIER); + RLP_SetUserRequest(Conn_Req,true); break; case StatusChange: - if (buffer[0] == 0) { - connected = true; - if (CommandMode == false) ATEM_ModemResult(MR_CONNECT); + if (buffer[0]==0) { + connected=true; + if (CommandMode==false) ATEM_ModemResult(MR_CONNECT); } break; case Disc_Ind: - if (CommandMode == false) ATEM_ModemResult(MR_NOCARRIER); - connected = false; + if (CommandMode==false) ATEM_ModemResult(MR_NOCARRIER); + connected=false; /* Set the call passup back to the at emulator */ - GSM->DialData(NULL, -1, &ATEM_CallPassup); - CommandMode = true; + GSM->DialData(NULL,-1,&ATEM_CallPassup); + CommandMode=true; break; case Reset_Ind: - RLP_SetUserRequest(Reset_Resp, true); + RLP_SetUserRequest(Reset_Resp,true); break; case GetData: - if (poll(&ufds, 1, 0)) { + if (poll(&ufds,1,0)) { /* Check if the program has closed */ /* Return to command mode */ /* Note that the call will still be in progress, */ /* as with a normal modem (I think) */ - if (ufds.revents != POLLIN) { - CommandMode = true; + if (ufds.revents!=POLLIN) { + CommandMode=true; /* Set the call passup back to the at emulator */ - GSM->DialData(NULL, -1, &ATEM_CallPassup); + GSM->DialData(NULL,-1,&ATEM_CallPassup); return 0; } temp = read(PtyRDFD, buffer, length); - if (temp < 0) return 0; /* FIXME - what do we do now? */ + if (temp<0) return 0; /* FIXME - what do we do now? */ /* This will only check +++ and the beginning of a read */ /* But there should be a pause before it anyway */ - if (buffer[0] == '+') { + if (buffer[0]=='+') { pluscount++; - if (temp > 1) { - if (buffer[1] == '+') pluscount++; - else pluscount = 0; - if (temp > 2) { - if (buffer[2] == '+') pluscount++; - else pluscount = 0; - if (temp > 3) pluscount = 0; + if (temp>1) { + if (buffer[1]=='+') pluscount++; + else pluscount=0; + if (temp>2) { + if (buffer[2]=='+') pluscount++; + else pluscount=0; + if (temp>3) pluscount=0; } } - } else pluscount = 0; + } else pluscount=0; - if (pluscount == 3) { - CommandMode = true; + if (pluscount==3) { + CommandMode=true; /* Set the call passup back to the at emulator */ - GSM->DialData(NULL, -1, &ATEM_CallPassup); + GSM->DialData(NULL,-1,&ATEM_CallPassup); ATEM_ModemResult(MR_OK); break; } return temp; } + return 0; break; + default: - break; + } return 0; } @@ -163,17 +149,17 @@ void DP_CallPassup(char c) { switch (c) { case 'D': - if (CommandMode == false) ATEM_ModemResult(MR_CARRIER); - RLP_SetUserRequest(Conn_Req, true); - connected = true; + if (CommandMode==false) ATEM_ModemResult(MR_CARRIER); + RLP_SetUserRequest(Conn_Req,true); + connected=true; break; case ' ': - CommandMode = true; + CommandMode=true; /* Set the call passup back to the at emulator */ - GSM->DialData(NULL, -1, &ATEM_CallPassup); + GSM->DialData(NULL,-1,&ATEM_CallPassup); ATEM_ModemResult(MR_NOCARRIER); RLP_SetUserRequest(Disc_Req, true); - connected = false; + connected=false; break; default: break; diff --git a/common/data/rlp-common.c b/common/data/rlp-common.c index 599ab6a..9c46e0d 100644 --- a/common/data/rlp-common.c +++ b/common/data/rlp-common.c @@ -6,8 +6,6 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. The development of RLP protocol is sponsored by SuSE CR, s.r.o. (Pavel use @@ -16,26 +14,6 @@ Actual implementation of RLP protocol. Based on GSM 04.22 version 7.1.0, downloadable from www.etsi.org (if you register with them) - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:08 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.5 2001/03/26 23:39:36 pkot - Minor updates: - - Windows INLINE patch (Manfred Jonsson) - - patch to configure.in to compile under FreeBSD (Panagiotis Astithas) - - other cleanups (me) - - Revision 1.4 2001/03/13 01:23:18 pkot - Windows updates (Manfred Jonsson) - - Revision 1.3 2001/02/21 19:57:00 chris - More fiddling with the directory layout - - Revision 1.2 2001/02/17 22:40:51 chris - ATA support - - */ #include diff --git a/common/data/rlp-crc24.c b/common/data/rlp-crc24.c index 3b7108e..cc8af90 100644 --- a/common/data/rlp-crc24.c +++ b/common/data/rlp-crc24.c @@ -6,20 +6,10 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. CRC24 (aka FCS) implementation in RLP. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:08 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.2 2001/02/21 19:57:02 chris - More fiddling with the directory layout - - */ #include "data/rlp-crc24.h" diff --git a/common/data/virtmodem.c b/common/data/virtmodem.c index fe18f6b..7c7f4e2 100644 --- a/common/data/virtmodem.c +++ b/common/data/virtmodem.c @@ -5,8 +5,6 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. This file provides a virtual modem interface to the GSM phone by calling @@ -15,39 +13,6 @@ (AT-emulator) and "online" mode where the data pump code translates data from/to the GSM handset and the modem data/fax stream. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:08 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.4 2001/04/14 23:23:43 pkot - Fixed problems with grantpt - - Revision 1.3 2001/03/21 23:36:04 chris - Added the statemachine - This will break gnokii --identify and --monitor except for 6210/7110 - - Revision 1.2 2001/02/21 19:57:02 chris - More fiddling with the directory layout - - Revision 1.1 2001/02/16 14:29:51 chris - Restructure of common/. Fixed a problem in fbus-phonet.c - Lots of dprintfs for Marcin - Any size xpm can now be loaded (eg for 7110 startup logos) - nk7110 code detects 7110/6210 and alters startup logo size to suit - Moved Marcin's extended phonebook code into gnokii.c - - Revision 1.5 2001/01/08 15:11:37 pkot - Documentation updates. - Fixed some bugs and removed FIXMEs. - We need to move some stuff from configure.in to aclocal.m4 - - Revision 1.4 2001/01/02 09:09:09 pkot - Misc fixes and updates. - - Revision 1.3 2000/12/27 10:54:14 pkot - Added Unix98 PTYs support (Michael Mráka). - - */ #define __virtmodem_c @@ -84,7 +49,7 @@ /* Global variables */ -extern bool TerminateThread; +//extern bool TerminateThread; int ConnectCount; /* Local variables */ @@ -101,7 +66,7 @@ bool RequestTerminate; /* If initialised in debug mode, stdin/out is used instead of ptys for interface. */ -bool VM_Initialise(char *model,char *port, char *initlength, GSM_ConnectionType connection, char *bindir, bool debug_mode, bool GSMInit) +bool VM_Initialise(char *model,char *port, char *initlength, GSM_ConnectionType connection, char *bindir, bool debug_mode, bool GSMInit,char *synchronizetime) { int rtn; @@ -120,9 +85,10 @@ bool VM_Initialise(char *model,char *port, char *initlength, GSM_ConnectionType #ifdef DEBUG fprintf (stderr , "Initialising GSM\n"); #endif /* DEBUG */ - if ((VM_GSMInitialise(model, port, initlength, connection) != GE_NONE)) { + if ((VM_GSMInitialise(model, port, initlength, connection, synchronizetime) != GE_NONE)) { fprintf (stderr, _("VM_Initialise - VM_GSMInitialise failed!\n")); return (false); + } } GSMInit=false; @@ -275,7 +241,7 @@ void VM_CharHandler(void) /* Note that file closure etc. should have been dealt with in ThreadLoop */ if (res < 0) { - TerminateThread=true; +// TerminateThread=true; return; } @@ -284,15 +250,14 @@ void VM_CharHandler(void) } /* Initialise GSM interface, returning GSM_Error as appropriate */ -GSM_Error VM_GSMInitialise(char *model, char *port, char *initlength, GSM_ConnectionType connection) +GSM_Error VM_GSMInitialise(char *model, char *port, char *initlength, GSM_ConnectionType connection, char *synchronizetime) { int count=0; GSM_Error error; - static GSM_Statemachine sm; /* Initialise the code for the GSM interface. */ - error = GSM_Initialise(model,port, initlength, connection, RLP_DisplayF96Frame, &sm); + error = GSM_Initialise(model,port, initlength, connection, RLP_DisplayF96Frame, synchronizetime); if (error != GE_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); diff --git a/common/devices/tekram.c b/common/devices/tekram.c index 21b5b6f..5da6097 100644 --- a/common/devices/tekram.c +++ b/common/devices/tekram.c @@ -6,9 +6,6 @@ * * A Linux/Unix toolset and driver for Nokia mobile phones. * - * Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - * Copyright (C) 2000-2001 Marcel Holtmann - * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -23,45 +20,23 @@ * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Log$ - * Revision 1.1.1.1 2001/11/25 21:59:08 short - * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - * - * Revision 1.2 2001/02/21 19:57:03 chris - * More fiddling with the directory layout - * - * Revision 1.1 2001/02/16 14:29:51 chris - * Restructure of common/. Fixed a problem in fbus-phonet.c - * Lots of dprintfs for Marcin - * Any size xpm can now be loaded (eg for 7110 startup logos) - * nk7110 code detects 7110/6210 and alters startup logo size to suit - * Moved Marcin's extended phonebook code into gnokii.c - * - * Revision 1.2 2001/02/12 15:13:46 chris - * Fixed my bug in xgnokii_contacts.c and added to tekram.c - * - * Revision 1.1 2001/02/09 18:12:53 chris - * Marcel's tekram support - * */ #include -#include -#include -#include #include #ifndef WIN32 -#include "devices/unixserial.h" + #include + #include + #include + #include "devices/unixserial.h" #else -#include "winserial.h" + #include + #include "devices/winserial.h" #endif #include "devices/tekram.h" - - - int tekram_open(__const char *__file) { return (serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK)); @@ -76,18 +51,9 @@ void tekram_close(int __fd) { void tekram_reset(int __fd) { - serial_setdtrrts(__fd, 0, 0); - - usleep(50000); - - serial_setdtrrts(__fd, 1, 0); - - usleep(1000); - - serial_setdtrrts(__fd, 1, 1); - - usleep(50); - + serial_setdtrrts(__fd, 0, 0); usleep(50000); + serial_setdtrrts(__fd, 1, 0); usleep(1000); + serial_setdtrrts(__fd, 1, 1); usleep(50); serial_changespeed(__fd, 9600); } diff --git a/common/devices/unixirda.c b/common/devices/unixirda.c index 2931d11..cfbf39a 100644 --- a/common/devices/unixirda.c +++ b/common/devices/unixirda.c @@ -1,14 +1,10 @@ /* * $Id$ * - * * G N O K I I * * A Linux/Unix toolset and driver for Nokia mobile phones. * - * Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - * Copyright (C) 2000-2001 Marcel Holtmann - * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -23,45 +19,22 @@ * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Log$ - * Revision 1.1.1.1 2001/11/25 21:59:09 short - * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - * - * Revision 1.7 2001/11/08 16:49:19 pkot - * Cleanups - * - * Revision 1.6 2001/08/17 00:18:12 pkot - * Removed recv() from IrDA initializing procedure (many people) - * - * Revision 1.5 2001/06/27 23:52:48 pkot - * 7110/6210 updates (Marian Jancar) - * - * Revision 1.4 2001/06/20 21:27:34 pkot - * IrDA patch (Marian Jancar) - * - * Revision 1.3 2001/02/21 19:57:04 chris - * More fiddling with the directory layout - * - * Revision 1.2 2001/02/20 21:55:10 pkot - * Small #include updates - * - * Revision 1.1 2001/02/16 14:29:52 chris - * Restructure of common/. Fixed a problem in fbus-phonet.c - * Lots of dprintfs for Marcin - * Any size xpm can now be loaded (eg for 7110 startup logos) - * nk7110 code detects 7110/6210 and alters startup logo size to suit - * Moved Marcin's extended phonebook code into gnokii.c - * - * Revision 1.2 2001/02/06 21:15:35 chris - * Preliminary irda support for 7110 etc. Not well tested! - * - * Revision 1.1 2001/02/03 23:56:17 chris - * Start of work on irda support (now we just need fbus-irda.c!) - * Proper unicode support in 7110 code (from pkot) - * */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "devices/unixirda.h" +#include "devices/linuxirda.h" + #ifndef AF_IRDA #define AF_IRDA 23 @@ -72,7 +45,10 @@ #define DISCOVERY_SLEEP 0.4 static char *phone[] = { - "Nokia 7110", "Nokia 6210" + "Nokia 5210", + "Nokia 6210", "Nokia 6250", "Nokia 6310", + "Nokia 7110", + "Nokia 8210", "Nokia 8310", "Nokia 8850" }; double d_time(void) @@ -101,18 +77,17 @@ double d_sleep(double s) return time; } -static int irda_discover_device(void) +static int irda_discover_device(int fd) { struct irda_device_list *list; struct irda_device_info *dev; unsigned char *buf; - int s, len, i, j, daddr = -1, fd; + int s, len, i, j; + int daddr = -1; double t1, t2; int phones = sizeof(phone) / sizeof(*phone); - fd = socket(AF_IRDA, SOCK_STREAM, 0); - len = sizeof(*list) + sizeof(*dev) * 10; // 10 = max devices in discover buf = malloc(len); list = (struct irda_device_list *)buf; @@ -129,11 +104,15 @@ static int irda_discover_device(void) for (j = 0; (j < phones) && (daddr == -1); j++) { if (strncmp(dev[i].info, phone[j], INFO_LEN) == 0) { daddr = dev[i].daddr; - dprintf("%s\t%x\n", dev[i].info, dev[i].daddr); +#ifdef DEBUG + fprintf(stdout,_("%s\t%x\n"), dev[i].info, dev[i].daddr); +#endif } } if (daddr == -1) { - dprintf("unknown: %s\t%x\n", dev[i].info, dev[i].daddr); +#ifdef DEBUG + fprintf(stdout,_("unknown: %s\t%x\n"), dev[i].info, dev[i].daddr); +#endif } } } @@ -147,7 +126,6 @@ static int irda_discover_device(void) } while ((t2 - t1 < DISCOVERY_TIMEOUT) && (daddr == -1)); free(buf); - close(fd); return daddr; } @@ -156,24 +134,44 @@ int irda_open(void) { struct sockaddr_irda peer; int fd = -1, daddr; + int pgrp; - daddr = irda_discover_device(); /* discover the devices */ - if (daddr != -1) { - fd = socket(AF_IRDA, SOCK_STREAM, 0); /* Create socket */ - peer.sir_family = AF_IRDA; - peer.sir_lsap_sel = LSAP_ANY; - peer.sir_addr = daddr; - strcpy(peer.sir_name, "Nokia:PhoNet"); + fd = socket(AF_IRDA, SOCK_STREAM, 0); /* Create socket */ + if (fd == -1) { + perror("socket"); + exit(1); + } + + /* discover the devices */ + daddr = irda_discover_device(fd); + if (daddr == -1) { + printf("irda_discover: no nokia devices found"); + exit(1); + } + + /* Arrange for the current process to receive + SIGIO when the state of the socket changes. */ + pgrp = getpid(); + if (fcntl (fd, F_SETOWN, pgrp) < 0) + perror("F_SETOWN"); + + /* Set the socket state for Asynchronous */ + if (fcntl (fd, F_SETFL, FASYNC) < 0) { + perror("fcntl"); + exit(1); + } + + peer.sir_family = AF_IRDA; + peer.sir_lsap_sel = LSAP_ANY; + peer.sir_addr = daddr; + strcpy(peer.sir_name, "Nokia:PhoNet"); - if (connect(fd, (struct sockaddr *)&peer, sizeof(peer))) { /* Connect to service "Nokia:PhoNet" */ - perror("connect"); - close(fd); - fd = -1; -/* } else { FIXME: It does not work in most cases. Why? Or why it should work? - recv(fd, NULL, 0, 0); call recv first to make select work correctly */ + if (connect(fd, (struct sockaddr *)&peer, sizeof(peer))) { /* Connect to service "Nokia:PhoNet" */ + perror("connect"); + close(fd); + fd = -1; } - } return fd; } @@ -186,7 +184,20 @@ int irda_close(int fd) int irda_write(int __fd, __const __ptr_t __bytes, int __size) { - return (send(__fd, __bytes, __size, 0)); + int actual,ret; + + actual = 0; + + do { + if ((ret = send(__fd, __bytes, __size - actual, 0)) < 0) + return(actual); + + actual += ret; + __bytes += ret; + + } while (actual < __size); + + return (actual); } int irda_read(int __fd, __ptr_t __bytes, int __size) diff --git a/common/devices/unixserial.c b/common/devices/unixserial.c index 916ba4a..bc7e37e 100644 --- a/common/devices/unixserial.c +++ b/common/devices/unixserial.c @@ -6,48 +6,8 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. - $Log$ - Revision 1.1.1.3 2001/12/05 03:16:40 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Dec 4 22:45 CET 2001 - - Revision 1.12 2001/11/29 17:54:56 pkot - Cleanup. Removed cvs logs. - - Revision 1.11 2001/11/27 12:19:01 pkot - Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me) - - Revision 1.10 2001/11/14 10:46:12 pkot - Small cleanup with __unices__ - - Revision 1.9 2001/09/14 12:15:28 pkot - Cleanups from 0.3.3 (part1) - - Revision 1.8 2001/08/20 23:27:37 pkot - Add hardware shakehand to the link layer (Manfred Jonsson) - - Revision 1.7 2001/07/03 00:03:36 pkot - Small fixes to let gnokii compile and work under solaris (thanks to Artur Kubiak) - - Revision 1.6 2001/03/21 23:36:04 chris - Added the statemachine - This will break gnokii --identify and --monitor except for 6210/7110 - - Revision 1.5 2001/03/19 23:43:46 pkot - Solaris/ *BSD '#if defined' cleanup - - Revision 1.4 2001/03/13 01:21:38 pkot - *BSD updates (Bert Driehuis) - - Revision 1.3 2001/03/06 22:27:46 pkot - Misc docs and Makefiles updates and cleanups - - Revision 1.2 2001/02/21 19:57:05 chris - More fiddling with the directory layout - */ #include "misc.h" @@ -61,234 +21,246 @@ #include #include +#if __unices__ +# include +#endif + #include #include "devices/unixserial.h" #ifdef HAVE_SYS_IOCTL_COMPAT_H -# include + #include #endif #ifdef HAVE_SYS_SELECT_H -# include +#include #endif /* If the target operating system does not have cfsetspeed, we can emulate it. */ #ifndef HAVE_CFSETSPEED -# if defined(HAVE_CFSETISPEED) && defined(HAVE_CFSETOSPEED) -# define cfsetspeed(t, speed) \ - (cfsetispeed(t, speed) || cfsetospeed(t, speed)) -# else -static int cfsetspeed(struct termios *t, int speed) -{ -# ifdef HAVE_TERMIOS_CSPEED - t->c_ispeed = speed; - t->c_ospeed = speed; -# else - t->c_cflag |= speed; -# endif /* HAVE_TERMIOS_CSPEED */ - return 0; -} -# endif /* HAVE_CFSETISPEED && HAVE_CFSETOSPEED */ -#endif /* HAVE_CFSETSPEED */ + #if defined(HAVE_CFSETISPEED) && defined(HAVE_CFSETOSPEED) + #define cfsetspeed(t, speed) \ + (cfsetispeed(t, speed) || cfsetospeed(t, speed)) + #else + static int cfsetspeed(struct termios *t, int speed) { + #ifdef HAVE_TERMIOS_CSPEED + t->c_ispeed = speed; + t->c_ospeed = speed; + #else + t->c_cflag |= speed; + #endif + return 0; + } + #endif +#endif #ifndef O_NONBLOCK -# define O_NONBLOCK 0 + #define O_NONBLOCK 0 #endif /* Structure to backup the setting of the terminal. */ + struct termios serial_termios; /* Open the serial port and store the settings. */ -int serial_open(__const char *__file, int __oflag) -{ - int __fd; - int retcode; - - __fd = open(__file, __oflag); - if (__fd == -1) { - perror("Gnokii serial_open: open"); - return (-1); - } - - retcode = tcgetattr(__fd, &serial_termios); - if (retcode == -1) { - perror("Gnokii serial_open:tcgetattr"); - /* Don't call serial_close since serial_termios is not valid */ - close(__fd); - return (-1); - } - - return __fd; + +int serial_open(__const char *__file, int __oflag) { + + int __fd; + int retcode; + + __fd = open(__file, __oflag); + if (__fd == -1) { + perror("Gnokii serial_open: open"); + return (-1); + } + + retcode=tcgetattr(__fd, &serial_termios); + if(retcode==-1) { + perror("Gnokii serial_open:tcgetattr"); + /* Don't call serial_close since serial_termios is not valid */ + close(__fd); + return(-1); + } + + return __fd; } /* Close the serial port and restore old settings. */ -int serial_close(int __fd) -{ - if (__fd >= 0) - tcsetattr(__fd, TCSANOW, &serial_termios); - return (close(__fd)); +int serial_close(int __fd) { + + if (__fd >= 0) + tcsetattr(__fd, TCSANOW, &serial_termios); + + return (close(__fd)); } /* Open a device with standard options. */ -int serial_opendevice(__const char *__file, int __with_odd_parity, - int __with_async, int __with_hw_handshake) -{ - int fd; - int retcode; - struct termios tp; - /* Open device */ - fd = serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK); +int serial_opendevice(__const char *__file, int __with_odd_parity, int __with_async, int __with_hw_handshake) { + + int fd; + int retcode; + struct termios tp; + + /* Open device */ + + fd = serial_open(__file, O_RDWR | O_NOCTTY | O_NONBLOCK); + + if (fd < 0) + return fd; - if (fd < 0) return fd; + /* Allow process/thread to receive SIGIO */ - /* Allow process/thread to receive SIGIO */ #if !(__unices__) - retcode = fcntl(fd, F_SETOWN, getpid()); - if (retcode == -1) { - perror("Gnokii serial_opendevice: fnctl(F_SETOWN)"); - serial_close(fd); - return (-1); - } + retcode = fcntl(fd, F_SETOWN, getpid()); + if (retcode == -1){ + perror("Gnokii serial_opendevice: fnctl(F_SETOWN)"); + serial_close(fd); + return(-1); + } #endif - /* Make filedescriptor asynchronous. */ - if (__with_async) { - retcode = fcntl(fd, F_SETFL, FASYNC); - if (retcode == -1) { - perror("Gnokii serial_opendevice: fnctl(F_SETFL)"); - serial_close(fd); - return (-1); - } - } - - /* Initialise the port settings */ - memcpy(&tp, &serial_termios, sizeof(struct termios)); - - /* Set port settings for canonical input processing */ - tp.c_cflag = B0 | CS8 | CLOCAL | CREAD; - if (__with_odd_parity) { - tp.c_cflag |= (PARENB | PARODD); - tp.c_iflag = 0; - } else - tp.c_iflag = IGNPAR; - if (__with_hw_handshake) - tp.c_cflag |= CRTSCTS; - else - tp.c_cflag &= ~CRTSCTS; - - tp.c_oflag = 0; - tp.c_lflag = 0; - tp.c_cc[VMIN] = 1; - tp.c_cc[VTIME] = 0; - - retcode = tcflush(fd, TCIFLUSH); - if (retcode == -1) { - perror("Gnokii serial_opendevice: tcflush"); - serial_close(fd); - return (-1); - } - - retcode = tcsetattr(fd, TCSANOW, &tp); - if (retcode == -1) { - perror("Gnokii serial_opendevice: tcsetattr"); - serial_close(fd); - return (-1); - } - - return fd; + /* Make filedescriptor asynchronous. */ + + if (__with_async) { + retcode=fcntl(fd, F_SETFL, FASYNC); + if (retcode == -1){ + perror("Gnokii serial_opendevice: fnctl(F_SETFL)"); + serial_close(fd); + return(-1); + } + } + + /* Initialise the port settings */ + + memcpy(&tp, &serial_termios, sizeof(struct termios)); + + /* Set port settings for canonical input processing */ + + tp.c_cflag = B0 | CS8 | CLOCAL | CREAD; + if (__with_odd_parity) { + tp.c_cflag |= (PARENB | PARODD); + tp.c_iflag = 0; + } + else + tp.c_iflag = IGNPAR; + if (__with_hw_handshake) + tp.c_cflag |= CRTSCTS; + else + tp.c_cflag &= ~CRTSCTS; + + tp.c_oflag = 0; + tp.c_lflag = 0; + tp.c_cc[VMIN] = 1; + tp.c_cc[VTIME] = 0; + + retcode=tcflush(fd, TCIFLUSH); + if (retcode == -1) { + perror("Gnokii serial_opendevice: tcflush"); + serial_close(fd); + return(-1); + } + + retcode=tcsetattr(fd, TCSANOW, &tp); + if (retcode == -1){ + perror("Gnokii serial_opendevice: tcsetattr"); + serial_close(fd); + return(-1); + } + + return fd; } /* Set the DTR and RTS bit of the serial device. */ -void serial_setdtrrts(int __fd, int __dtr, int __rts) -{ - unsigned int flags; - flags = TIOCM_DTR; +void serial_setdtrrts(int __fd, int __dtr, int __rts) { + + unsigned int flags; - if (__dtr) - ioctl(__fd, TIOCMBIS, &flags); - else - ioctl(__fd, TIOCMBIC, &flags); + flags = TIOCM_DTR; - flags = TIOCM_RTS; + if (__dtr) ioctl(__fd, TIOCMBIS, &flags); + else ioctl(__fd, TIOCMBIC, &flags); - if (__rts) - ioctl(__fd, TIOCMBIS, &flags); - else - ioctl(__fd, TIOCMBIC, &flags); + flags = TIOCM_RTS; + + if (__rts) ioctl(__fd, TIOCMBIS, &flags); + else ioctl(__fd, TIOCMBIC, &flags); } -int serial_select(int fd, struct timeval *timeout) -{ - fd_set readfds; +int serial_select(int fd, struct timeval *timeout) { + + fd_set readfds; - FD_ZERO(&readfds); - FD_SET(fd, &readfds); + FD_ZERO(&readfds); + FD_SET(fd, &readfds); + + return (select(fd + 1, &readfds, NULL, NULL, timeout)); - return (select(fd + 1, &readfds, NULL, NULL, timeout)); } /* Change the speed of the serial device. */ -void serial_changespeed(int __fd, int __speed) -{ + +void serial_changespeed(int __fd, int __speed) { + #ifndef SGTTY - struct termios t; + struct termios t; #else - struct sgttyb t; + struct sgttyb t; #endif - int speed = B9600; - - switch (__speed) { - case 9600: - speed = B9600; - break; - case 19200: - speed = B19200; - break; - case 38400: - speed = B38400; - break; - case 57600: - speed = B57600; - break; - case 115200: - speed = B115200; - break; - } -#ifndef SGTTY - tcgetattr(__fd, &t); + int speed=B9600; - if (cfsetspeed(&t, speed) == -1) - dprintf("Serial port speed setting failed\n"); + switch (__speed) { + case 9600: speed = B9600; break; + case 19200: speed = B19200; break; + case 38400: speed = B38400; break; + case 57600: speed = B57600; break; + case 115200: speed = B115200; break; + } - tcsetattr(__fd, TCSADRAIN, &t); +#ifndef SGTTY + tcgetattr(__fd, &t); + + // This is not needed! We set up the speed via cfsetspeed + // t.c_cflag &= ~CBAUD; + // t.c_cflag |= speed; +#ifdef DEBUG + if (cfsetspeed(&t, speed) == -1) + fprintf(stdout,_("Serial port speed setting failed\n")); #else - ioctl(__fd, TIOCGETP, &t); + cfsetspeed(&t, speed); +#endif - t.sg_ispeed = speed; - t.sg_ospeed = speed; + tcsetattr(__fd, TCSADRAIN, &t); +#else + ioctl(__fd, TIOCGETP, &t); + + t.sg_ispeed = speed; + t.sg_ospeed = speed; - ioctl(__fd, TIOCSETN, &t); + ioctl(__fd, TIOCSETN, &t); #endif } /* Read from serial device. */ -size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) -{ - return (read(__fd, __buf, __nbytes)); + +size_t serial_read(int __fd, __ptr_t __buf, size_t __nbytes) { + + return (read(__fd, __buf, __nbytes)); } /* Write to serial device. */ -size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n) -{ + +size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n) { + return (write(__fd, __buf, __n)); } -#endif /* WIN32 */ +#endif /* WIN32 */ diff --git a/common/gsm-api.c b/common/gsm-api.c index e967946..99b73d7 100644 --- a/common/gsm-api.c +++ b/common/gsm-api.c @@ -1,13 +1,9 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Provides a generic API for accessing functions on the phone, wherever @@ -20,62 +16,45 @@ Unless otherwise noted, all functions herein block until they complete. The functions themselves are defined in a structure in gsm-common.h. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:04 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.32 2001/11/14 11:26:18 pkot - Getting SMS in 6210/7110 does finally work in some cases :) - - Revision 1.31 2001/11/08 16:45:58 pkot - Obsolete old structure, kill treads where possible and make shared library - - Revision 1.30 2001/08/09 11:51:38 pkot - Generic AT support updates and cleanup (Manfred Jonsson) - - Revision 1.29 2001/07/27 00:02:20 pkot - Generic AT support for the new structure (Manfred Jonsson) - - Revision 1.28 2001/06/06 09:05:56 machek - Convert Grab/Release display to new structure. - - Revision 1.27 2001/05/07 14:13:06 machek - nokia-2110 module converted to suit new API better. --identify now works. - - Revision 1.26 2001/04/25 12:54:47 machek - Partly converted nokia 2110 to "new" form, and moved it to phone - directory. - - Revision 1.25 2001/03/26 23:39:21 pkot - Minor updates: - - Windows INLINE patch (Manfred Jonsson) - - patch to configure.in to compile under FreeBSD (Panagiotis Astithas) - - other cleanups (me) - - */ #include #include - -#include "misc.h" -#include "gsm-common.h" -#include "data/rlp-common.h" -#include "gsm-statemachine.h" -#include "phones/nk7110.h" -#include "phones/nk6100.h" -#include "phones/nk3110.h" -#include "phones/nk2110.h" - -GSM_Statemachine GSM_SM; -GSM_Error (*GSM_F)(GSM_Operation op, GSM_Data *data, GSM_Statemachine *state); - +#include +#include + +#ifdef WIN32 + #include + #include "misc_win32.h" +#endif + +#include "gsm-api.h" + +#include "newmodules/n6110.h" +#include "newmodules/n7110.h" +#include "newmodules/newat.h" +#ifdef DEBUG + #include "newmodules/sniff/sniff.h" +#endif +#include "protocol/fbusirda.h" +#include "protocol/fbus.h" +#include "protocol/mbus.h" +#include "protocol/at.h" +#include "files/cfgreader.h" + +#ifndef WIN32 + #include "devices/device.h" +#endif + +#ifdef VC6 + /* for VC6 make scripts save VERSION constant in mversion.h file */ + #include "mversion.h" +#endif /* GSM_LinkOK is set to true once normal communications with the phone have been established. */ bool *GSM_LinkOK; -bool LinkAlwaysOK = true; /* Define pointer to the GSM_Functions structure used by external code to call relevant API functions. This structure is defined in gsm-common.h. */ @@ -92,62 +71,722 @@ GSM_Information *GSM_Info; 3810, 5110, 6110 etc. Device is the serial port to use e.g. /dev/ttyS0, the user must have write permission to the device. */ -static GSM_Error register_phone(GSM_Phone *phone, char *model, char *setupmodel, GSM_Statemachine *sm) +GSM_Protocol *Protocol; + +/* Local variables used by get/set phonebook entry code. Buffer is used as a + source or destination for phonebook data and other functions... Error is + set to GE_NONE by calling function, set to GE_COMPLETE or an error code by + handler routines as appropriate. */ + +GSM_PhonebookEntry *CurrentPhonebookEntry; +GSM_Error CurrentPhonebookError; + +GSM_SpeedDial *CurrentSpeedDialEntry; +GSM_Error CurrentSpeedDialError; + +unsigned char Current_IMEI[GSM_MAX_IMEI_LENGTH]; +unsigned char Current_Revision[GSM_MAX_REVISION_LENGTH]; +unsigned char Current_Model[GSM_MAX_MODEL_LENGTH]; + +GSM_SMSMessage *CurrentSMSMessage; +GSM_Error CurrentSMSMessageError; +int CurrentSMSPointer; + +GSM_SMSFolders *CurrentSMSFolders; +GSM_Error CurrentSMSFoldersError; +int CurrentSMSFoldersCount; + +GSM_OneSMSFolder CurrentSMSFolder; +GSM_Error CurrentSMSFolderError; +int CurrentSMSFolderID; + +GSM_MemoryStatus *CurrentMemoryStatus; +GSM_Error CurrentMemoryStatusError; + +GSM_NetworkInfo *CurrentNetworkInfo; +GSM_Error CurrentNetworkInfoError; + +GSM_SMSStatus *CurrentSMSStatus; +GSM_Error CurrentSMSStatusError; + +GSM_MessageCenter *CurrentMessageCenter; +GSM_Error CurrentMessageCenterError; + +int *CurrentSecurityCodeStatus; +GSM_Error CurrentSecurityCodeError; +GSM_SecurityCode *CurrentSecurityCode; + +GSM_DateTime *CurrentDateTime; +GSM_Error CurrentDateTimeError; + +GSM_DateTime *CurrentAlarm; +GSM_Error CurrentAlarmError; + +GSM_CalendarNote *CurrentCalendarNote; +GSM_Error CurrentCalendarNoteError; + +GSM_NotesInfo CurrentCalendarNotesInfo,*CurrentCalendarNotesInfo2; +GSM_Error CurrentCalendarNotesInfoError; + +GSM_Error CurrentSetDateTimeError; +GSM_Error CurrentSetAlarmError; + +GSM_Error CurrentEnableExtendedCommandsError; + +int CurrentRFLevel, + CurrentBatteryLevel, + CurrentPowerSource; + +int CurrentDisplayStatus; +GSM_Error CurrentDisplayStatusError; + +GSM_Error CurrentResetPhoneSettingsError; + +char *CurrentNetmonitor; +GSM_Error CurrentNetmonitorError; + +GSM_Bitmap *CurrentGetBitmap=NULL; +GSM_Error CurrentGetBitmapError; + +GSM_Error CurrentSetBitmapError; + +GSM_Error CurrentSendDTMFError; + +GSM_Profile *CurrentProfile; +GSM_Error CurrentProfileError; + +GSM_Error CurrentDisplayOutputError; + +GSM_CBMessage *CurrentCBMessage; +GSM_Error CurrentCBError; + +int CurrentPressKeyEvent; +GSM_Error CurrentPressKeyError; + +GSM_Error CurrentPlayToneError=GE_UNKNOWN; + +GSM_Error CurrentDialVoiceError; + +GSM_Error CurrentGetOperatorNameError; +GSM_Network *CurrentGetOperatorNameNetwork; +GSM_Error CurrentSetOperatorNameError; + +GSM_Error CurrentGetIMEIError; + +GSM_Error CurrentGetHWError; + +unsigned char CurrentPPS[4]; +GSM_Error CurrentProductProfileSettingsError; + +char CurrentIncomingCall[20]; + +GSM_Error CurrentBinRingtoneError; +GSM_BinRingtone *CurrentGetBinRingtone=NULL; + +GSM_Error CurrentRingtoneError; + +GSM_Error CurrentMagicError; + +GSM_Error CurrentSimlockInfoError; +GSM_AllSimlocks *CurrentSimLock; + +GSM_Error CurrentGetWAPBookmarkError; +GSM_Error CurrentSetWAPBookmarkError; +GSM_WAPBookmark *WAPBookmark; + +GSM_Error CurrentGetWAPSettingsError; +GSM_WAPSettings *WAPSettings; + +GSM_Error CurrentCallDivertError; +GSM_CallDivert *CurrentCallDivert; + +char *CurrentManufacturer; + +/* This is the connection type used in gnokii. */ +GSM_ConnectionType CurrentConnectionType; + +/* Pointer to a callback function used to return changes to a calls status */ +/* This saves unreliable polling */ +void (*CurrentCallPassup)(char c); + +/* Pointer to callback function in user code to be called when RLP frames + are received. */ +void (*CurrentRLP_RXCallback)(RLP_F96Frame *frame); + +/* Used to disconnect the call */ +u8 CurrentCallSequenceNumber; + +bool CurrentLinkOK; + +bool CurrentRequestTerminate; + +bool CurrentDisableKeepAlive; + +bool CheckModel (GSM_Information InfoToCheck, char *model, GSM_ConnectionType connection) { + + bool found_match=false; + + if (strstr(InfoToCheck.FBUSModels, model) != NULL) { + if (connection==GCT_FBUS) found_match=true; + } + if (strstr(InfoToCheck.MBUSModels, model) != NULL) { + if (connection==GCT_MBUS) found_match=true; + } + if (strstr(InfoToCheck.InfraredModels, model) != NULL) { + if (connection==GCT_Infrared) found_match=true; + } + if (strstr(InfoToCheck.DLR3Models, model) != NULL) { + if (connection==GCT_DLR3) found_match=true; + } + if (strstr(InfoToCheck.IrdaModels, model) != NULL) { + if (connection==GCT_Irda) found_match=true; + } + if (strstr(InfoToCheck.ATModels, model) != NULL) { + if (connection==GCT_AT) found_match=true; + } + if (strstr(InfoToCheck.TekramModels, model) != NULL) { + if (connection==GCT_Tekram) found_match=true; + } + + return found_match; +} + +GSM_Error TryNewNokia(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_callback)(RLP_F96Frame *frame)) { + int InitLength; + int count; + unsigned char init_char = N6110_SYNC_BYTE; + + /* Hopefully is 64 larger as FB38_MAX* / N6110_MAX* */ + char phonemodel[64]; + + if (Protocol->Initialise(device,initlength,connection,rlp_callback)!=GE_NONE) + { + return GE_NOTSUPPORTED; + } + + if (connection!=GCT_MBUS) { + InitLength = atoi(initlength); + + if ((strcmp(initlength, "default") == 0) || (InitLength == 0)) { + InitLength = 250; /* This is the usual value, lower may work. */ + } + +#ifdef DEBUG + fprintf(stdout,_("Writing init chars....")); +#endif + + /* Initialise link with phone or what have you */ + /* Send init string to phone, this is a bunch of 0x55 characters. Timing is + empirical. */ + for (count = 0; count < InitLength; count ++) { + usleep(100); + Protocol->WritePhone(1,&init_char); + } + +#ifdef DEBUG + fprintf(stdout,_("Done\n")); +#endif + + N6110_SendStatusRequest(); + } + + usleep(100); + + if (N6110_SendIDFrame()!=GE_NONE) + return GE_TIMEOUT; + + while (N6110_GetModel(phonemodel) != GE_NONE) + sleep(1); + + if (!strcmp(phonemodel,"NPE-3") || !strcmp(phonemodel,"NSE-5")) + { + GSM->Terminate(); + + /* Set pointers to relevant addresses */ + GSM = &N7110_Functions; + GSM_Info = &N7110_Information; + GSM_LinkOK = &CurrentLinkOK; + return GE_NONE; + } + + return GE_NONE; +} + +GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_callback)(RLP_F96Frame *frame), char* SynchronizeTime) { - GSM_Data data; - GSM_Data *p_data; - if (setupmodel) { - GSM_DataClear(&data); - data.Model = setupmodel; - p_data = &data; - } else { - p_data = NULL; - } - if (strstr(phone->Info.Models, model) != NULL) - return phone->Functions(GOP_Init, p_data, sm); - return GE_UNKNOWNMODEL; + bool found_match=false; + + GSM_ConnectionType connection2; + + struct tm *now; + time_t nowh; + GSM_DateTime Date; + GSM_Error error; + + connection2=connection; + + CurrentRLP_RXCallback = rlp_callback; + CurrentCallPassup=NULL; + CurrentPhonebookEntry=NULL; + CurrentNetworkInfo = NULL; + CurrentGetBitmap=NULL; + CurrentPlayToneError=GE_UNKNOWN; + strcpy(CurrentIncomingCall," "); + CurrentGetBinRingtone=NULL; + CurrentNetworkInfo=NULL; + CurrentRequestTerminate=false; + CurrentDisableKeepAlive=false; + CurrentCalendarNotesInfo.HowMany=2000; + CurrentMagicError = GE_BUSY; + + if (!strcmp(model,"auto")) { + + /* For now */ + GSM = &N6110_Functions; + GSM_Info = &N6110_Information; + GSM_LinkOK = &CurrentLinkOK; +#ifdef DEBUG + fprintf(stdout,_("Trying FBUS for new Nokia phones...\n")); +#endif + /* Trying FBUS */ + Protocol = &FBUS_Functions; + CurrentConnectionType=GCT_FBUS; + connection2=GCT_FBUS; + if (TryNewNokia(model,device,initlength,CurrentConnectionType,rlp_callback)==GE_NONE) + { + found_match=true; + } else { + GSM->Terminate(); + } + + if (!found_match) { + usleep(100); + + /* For now */ + GSM = &N6110_Functions; + GSM_Info = &N6110_Information; + GSM_LinkOK = &CurrentLinkOK; +#ifdef DEBUG + fprintf(stdout,_("Trying DLR3 for new Nokia phones...\n")); +#endif + /* Trying DLR3 */ + Protocol = &FBUS_Functions; + CurrentConnectionType=GCT_DLR3; + connection2=GCT_DLR3; + if (TryNewNokia(model,device,initlength,CurrentConnectionType,rlp_callback)==GE_NONE) + { + found_match=true; + } else { + GSM->Terminate(); + } + } + + if (!found_match) { + usleep(100); + + /* For now */ + GSM = &N6110_Functions; + GSM_Info = &N6110_Information; + GSM_LinkOK = &CurrentLinkOK; +#ifdef DEBUG + fprintf(stdout,_("Trying MBUS for new Nokia phones...\n")); +#endif + /* Trying MBUS */ + Protocol = &MBUS_Functions; + CurrentConnectionType=GCT_MBUS; + connection2=GCT_MBUS; + if (TryNewNokia(model,device,initlength,CurrentConnectionType,rlp_callback)==GE_NONE) + { + found_match=true; + } else { + GSM->Terminate(); + } + } + + if (!found_match) return GE_NOTSUPPORTED; + + usleep(50); + + } else { +#ifdef DEBUG + if (CheckModel (Nsniff_Information, model, connection)) { + /* Set pointers to relevant addresses */ + GSM = &Nsniff_Functions; + GSM_Info = &Nsniff_Information; + GSM_LinkOK = &CurrentLinkOK; + found_match=true; + } +#endif + + if (CheckModel (N6110_Information, model, connection)) { + /* Set pointers to relevant addresses */ + GSM = &N6110_Functions; + GSM_Info = &N6110_Information; + GSM_LinkOK = &CurrentLinkOK; + found_match=true; + } + if (CheckModel (N7110_Information, model, connection)) { + /* Set pointers to relevant addresses */ + GSM = &N7110_Functions; + GSM_Info = &N7110_Information; + GSM_LinkOK = &CurrentLinkOK; + found_match=true; + } + if (CheckModel (Nat_Information, model, connection)) { + /* Set pointers to relevant addresses */ + GSM = &Nat_Functions; + GSM_Info = &Nat_Information; + GSM_LinkOK = &CurrentLinkOK; + found_match=true; + } + + if (found_match) { + switch (connection) { + case GCT_FBUS : Protocol = &FBUS_Functions; break; + case GCT_Infrared: Protocol = &FBUS_Functions; break; + case GCT_Tekram : Protocol = &FBUS_Functions; break; + case GCT_DLR3 : Protocol = &FBUS_Functions; break; + case GCT_MBUS : Protocol = &MBUS_Functions; break; + case GCT_Irda : Protocol = &FBUSIRDA_Functions;break; + case GCT_AT : Protocol = &AT_Functions; break; + case GCT_Default : Protocol = NULL; break; + } + } else + return GE_NOTSUPPORTED; + } + + + /* Now call model specific initialisation code. */ + error=(GSM->Initialise(device, initlength, connection2, rlp_callback)); + + /* RTH: FIXME: second try for Irda (6210 only?)*/ + if ( error!=GE_NONE && connection == GCT_Irda) + { + #ifdef DEBUG + fprintf(stdout,"Irda connection: second try!\n"); + #endif + device_close(); + error=(GSM->Initialise(device, initlength, connection2, rlp_callback)); + } + + if (error==GE_NONE && !strcmp(SynchronizeTime,"yes")) + { + nowh=time(NULL); + now=localtime(&nowh); + + Date.Year = now->tm_year; + Date.Month = now->tm_mon+1; + Date.Day = now->tm_mday; + Date.Hour = now->tm_hour; + Date.Minute = now->tm_min; + Date.Second = now->tm_sec; + + if (Date.Year<1900) + { + + /* Well, this thing is copyrighted in U.S. This technique is known as + Windowing and you can read something about it in LinuxWeekly News: + http://lwn.net/1999/features/Windowing.phtml. This thing is beeing + written in Czech republic and Poland where algorithms are not allowed + to be patented. */ + + if (Date.Year>90) + Date.Year = Date.Year+1900; + else + Date.Year = Date.Year+2000; + } + + /* FIXME: Error checking should be here. */ + GSM->SetDateTime(&Date); + } + + return error; } -#define MODULE(x) { \ - extern GSM_Functions x##_Functions; \ - extern GSM_Information x##_Information; \ - extern bool x##_LinkOK; \ - if (strstr(x##_Information.Models, model) != NULL) { \ - GSM = & x##_Functions; \ - GSM_Info = & x##_Information; \ - GSM_LinkOK = & x##_LinkOK; \ - return (GSM->Initialise(device, initlength, connection, rlp_callback)); \ - } \ +GSM_Error Unimplemented(void) +{ + return GE_NOTIMPLEMENTED; } -#define REGISTER_PHONE(x, y) { \ - extern GSM_Phone phone_##x; \ - if ((ret = register_phone(&phone_##x, model, y, sm)) != GE_UNKNOWNMODEL) \ - return ret; \ - } +GSM_Error NotSupported(void) +{ + return GE_NOTSUPPORTED; +} - -GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_callback)(RLP_F96Frame *frame), GSM_Statemachine *sm) -{ - GSM_Error ret; -#ifndef WIN32 /* MB21 not supported in win32 */ - if (strstr("2110", model)) { - extern GSM_Phone phone_nokia_2110; - memcpy(&(sm->Phone), &phone_nokia_2110, sizeof(GSM_Phone)); - sm->Phone.Functions(GOP_Init, NULL, sm); +/* Applications should call N6110_Terminate to shut down the N6110 thread and + close the serial port. */ +void NULL_Terminate(void) +{ + Protocol->Terminate(); +} + +#ifdef WIN32 +/* Here are things made for keeping connecting */ +void NULL_KeepAlive() +{ +} +#else +/* Here are things made for keeping connecting */ +void NULL_KeepAlive() +{ +} +#endif + +#ifdef DEBUG +void NULL_TX_DisplayMessage(u16 MessageLength, u8 *MessageBuffer) +{ + fprintf(stdout, _("PC: ")); + + txhexdump(MessageLength,MessageBuffer); +} +#endif + +bool NULL_WritePhone (u16 length, u8 *buffer) { + if (device_write(buffer,length)!=length) return false; + else return true; +} + +GSM_Error NULL_WaitUntil (int time, GSM_Error *value) +{ + int timeout; + + timeout=time; + + /* Wait for timeout or other error. */ + while (timeout != 0 && *value == GE_BUSY ) { + + if (--timeout == 0) + return (GE_TIMEOUT); + + usleep (100000); + } + + return *value; +} + +GSM_Error NULL_SendMessageSequence (int time, GSM_Error *value, + u16 message_length, u8 message_type, u8 *buffer) +{ + *value=GE_BUSY; + + Protocol->SendMessage(message_length, message_type, buffer); + + return NULL_WaitUntil (time, value); +} + +GSM_ConnectionType GetConnectionTypeFromString(char *Connection) { + + GSM_ConnectionType connection=GCT_FBUS; + + if (!strcmp(Connection, "irda")) connection=GCT_Irda; + if (!strcmp(Connection, "infrared")) connection=GCT_Infrared; + if (!strcmp(Connection, "mbus")) connection=GCT_MBUS; + if (!strcmp(Connection, "dlr3")) connection=GCT_DLR3; + if (!strcmp(Connection, "at")) connection=GCT_AT; + if (!strcmp(Connection, "tekram210"))connection=GCT_Tekram; + + return connection; +} + +bool GetMemoryTypeString(char *memorytext, GSM_MemoryType *type) +{ + int i=0; + + typedef struct { + GSM_MemoryType type; + char *name; + } GSM_MTStrings; + + GSM_MTStrings mystring[] = { + {GMT_ME,"ME"}, + {GMT_SM,"SM"}, + {GMT_FD,"FD"}, + {GMT_ON,"ON"}, + {GMT_EN,"EN"}, + {GMT_DC,"DC"}, + {GMT_RC,"RC"}, + {GMT_MC,"MC"}, + {GMT_LD,"LD"}, + {GMT_MT,"MT"}, + {GMT_ME,"undefined"} + }; + + while (strcmp(mystring[i].name,"undefined")) { + if (*type==mystring[i].type) { + strcpy(memorytext,mystring[i].name); + return true; + } + i++; + } + return false; +} + +bool GetMemoryTypeID(char *memorytext, GSM_MemoryType *type) +{ + int i=0; + + typedef struct { + GSM_MemoryType type; + char *name; + } GSM_MTStrings; + + GSM_MTStrings mystring[] = { + {GMT_ME,"ME"}, + {GMT_SM,"SM"}, + {GMT_FD,"FD"}, + {GMT_ON,"ON"}, + {GMT_EN,"EN"}, + {GMT_DC,"DC"}, + {GMT_RC,"RC"}, + {GMT_MC,"MC"}, + {GMT_LD,"LD"}, + {GMT_MT,"MT"}, + {GMT_ME,"undefined"} + }; + + while (strcmp(mystring[i].name,"undefined")) { + if (strcmp(mystring[i].name,memorytext)==0) { + *type=mystring[i].type; + return true; + } + i++; + } + + return false; +} + +char *GetMygnokiiVersion() { + + static char Buffer[1000]=""; + + sprintf(Buffer, "%s",VERSION); + + return Buffer; +} + +/* +1.Name,2.CodeName,3.Calendar,4.Netmonitor,5.Caller groups,6.Phonebook, +7.Authentication 8.Datacalls 9.KeysPressing 10.SMSC Default Recipient +11.SpeedDials 12.ScreenSavers 13.DTMF 14.SMS 15.NoPowerFrame 16.StartUpLogo +17.Profiles 18.Ringtones 19.WAP +*/ + +static OnePhoneModel allmodels[] = { + +/*1, 2, 3, 4, 5, 6 7 8 9 10 11 12 13 14 15 16 17 18 19 */ +{"3210","NSE-8",{ 0,F_NETMON, 0, 0, 0, 0, 0,F_SMSCDEF,F_SPEED, 0, 0,F_SMS ,F_NOPOWER,F_STANIM,F_PROF51,F_RINGBIN, 0}}, +{"3210","NSE-9",{ 0,F_NETMON, 0, 0, 0, 0, 0,F_SMSCDEF,F_SPEED, 0, 0,F_SMS ,F_NOPOWER,F_STANIM,F_PROF51,F_RINGBIN, 0}}, +{"3310","NHM-5",{F_CAL33,F_NETMON, 0,F_PBK33, 0, 0, 0,F_SMSCDEF,F_SPEED,F_SCRSAV, 0,F_SMS ,F_NOPOWER,F_STANIM,F_PROF33,F_RING_SM, 0}}, +{"3330","NHM-6",{F_CAL33,F_NETMON, 0,F_PBK33, 0, 0,F_KEYB,F_SMSCDEF,F_SPEED,F_SCRSAV, 0,F_SMS , 0,F_STANIM,F_PROF33,F_RING_SM,F_WAP}}, +{"5110","NSE-1",{ 0,F_NETMON, 0, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0, 0,F_PROF51, 0, 0}}, +{"5130","NSK-1",{ 0,F_NETMON, 0, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0, 0,F_PROF51, 0, 0}}, +{"5190","NSB-1",{ 0,F_NETMON, 0, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0, 0,F_PROF51, 0, 0}}, +{"6110","NSE-3",{F_CAL61,F_NETMON,F_CALER61, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}}, +{"6130","NSK-3",{F_CAL61,F_NETMON,F_CALER61, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}}, +{"6150","NSM-1",{F_CAL61,F_NETMON,F_CALER61, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}}, +{"6190","NSB-3",{F_CAL61,F_NETMON,F_CALER61, 0,F_AUTH,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}}, +{"6210","NPE-3",{F_CAL71,F_NETMON,F_CALER61,F_PBK71, 0,F_DATA71, 0,F_SMSCDEF,F_SPEED, 0, 0,F_SMS71, 0,F_STA62 ,F_PROF61,F_RINGBIN,F_WAP}}, +{"6250","NHM-3",{F_CAL71,F_NETMON,F_CALER61,F_PBK71, 0,F_DATA71, 0,F_SMSCDEF,F_SPEED, 0, 0,F_SMS71, 0,F_STA62 ,F_PROF61,F_RINGBIN,F_WAP}}, +{"7110","NSE-5",{F_CAL71,F_NETMON,F_CALER61,F_PBK71, 0,F_DATA71, 0,F_SMSCDEF,F_SPEED, 0, 0,F_SMS71, 0,F_STA71 ,F_PROF61,F_RINGBIN,F_WAP}}, +{"8210","NSM-3",{ 0,F_NETMON,F_CALER61, 0, 0,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}}, +{"8850","NSM-2",{ 0,F_NETMON,F_CALER61, 0, 0,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}}, +{"9210","RAE-3",{ 0,F_NETMON,F_CALER61, 0, 0,F_DATA61,F_KEYB,F_SMSCDEF,F_SPEED, 0,F_DTMF,F_SMS , 0,F_STA ,F_PROF61,F_RINGBIN, 0}},//quesses only ! +{"" ,"" ,{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}} +}; + +OnePhoneModel *GetPhoneModelData (const char *num) +{ + register int i = 0; + + while (allmodels[i].number != "") { + if (strcmp (num, allmodels[i].number) == 0) { + return (&allmodels[i]); + } + i++; } - MODULE(N2110); - - GSM_LinkOK = &LinkAlwaysOK; - sm->Link.ConnectionType=connection; - sm->Link.InitLength=atoi(initlength); - strcpy(sm->Link.PortDevice,device); - - REGISTER_PHONE(nokia_7110, NULL); - REGISTER_PHONE(nokia_6100, NULL); - REGISTER_PHONE(nokia_3110, NULL); - REGISTER_PHONE(at, model); -#endif /* WIN32 */ - return (GE_UNKNOWNMODEL); + return (&allmodels[i]); +} + +char *GetModelName () +{ + static char model[64]; + + while (GSM->GetModel(model) != GE_NONE) sleep(1); + + return (GetPhoneModelData(model)->model); +} + +int GetModelFeature (featnum_index num) +{ + static char model[64]; + + while (GSM->GetModel(model) != GE_NONE) sleep(1); + + return (GetPhoneModelData(model)->features[num]); +} + +int LogAvailable=-1; //-1 not checked earlier, 0 not, 1 yes +char *logfilename; + +bool AppendLog(u8 *buffer, int length,bool format) +{ + FILE *file=NULL; + char buffer2[50001]; + int i; + + struct CFG_Header *cfg_info; + char *LogFile; + + if (LogAvailable==-1) { + + LogAvailable=0; + + cfg_info=CFG_FindGnokiirc(); + if (cfg_info==NULL) return false; + + LogFile = CFG_Get(cfg_info, "global", "logfile"); + if (LogFile) { + LogAvailable=1; + logfilename=LogFile; + + file=fopen(logfilename, "a+"); + + /* We have first entry in this session and too large file */ + if (fread( buffer2, 1, 50000,file )==50000) { + fclose(file); + file=fopen(logfilename, "w"); + } + } + } else { + if (LogAvailable==1) { + file=fopen(logfilename, "a"); + } + } + + if (LogAvailable==1) { + for (i=0;i @@ -22,232 +18,264 @@ #include "gsm-common.h" #include "gsm-bitmaps.h" -#include "gsm-api.h" - -/* A few useful functions for bitmaps */ +#include "gsm-sms.h" +#include "gsm-coding.h" +#include "gsm-networks.h" void GSM_SetPointBitmap(GSM_Bitmap *bmp, int x, int y) { - if (bmp->type == GSM_StartupLogo) bmp->bitmap[((y/8)*bmp->width)+x] |= 1 << (y%8); - if (bmp->type == GSM_OperatorLogo || bmp->type == GSM_CallerLogo) bmp->bitmap[(y*bmp->width+x)/8] |= 1 << (7-((y*bmp->width+x)%8)); - - /* Testing only! */ - if (bmp->type == GSM_PictureImage) bmp->bitmap[9*y + (x/8)] |= 1 << (7-(x%8)); + int pixel; + if (bmp->type == GSM_StartupLogo || bmp->type == GSM_6210StartupLogo || bmp->type == GSM_7110StartupLogo) + bmp->bitmap[((y/8)*bmp->width)+x] |= 1 << (y%8); + if (bmp->type == GSM_OperatorLogo || bmp->type == GSM_7110OperatorLogo || bmp->type == GSM_CallerLogo) { + pixel=bmp->width*y + x; + bmp->bitmap[pixel/8] |= 1 << (7-(pixel%8)); + } + if (bmp->type == GSM_PictureImage) bmp->bitmap[9*y + (x/8)] |= 1 << (7-(x%8)); } - + void GSM_ClearPointBitmap(GSM_Bitmap *bmp, int x, int y) { - if (bmp->type == GSM_StartupLogo) bmp->bitmap[((y/8)*bmp->width)+x] &= 255 - (1 << (y%8)); - if (bmp->type == GSM_OperatorLogo || bmp->type == GSM_CallerLogo) bmp->bitmap[(y*bmp->width+x)/8] &= 255 - (1 << (7-((y*bmp->width+x)%8))); - - /* Testing only ! */ - if (bmp->type == GSM_PictureImage) bmp->bitmap[9*y + (x/8)] &= 255 - (1 << (7-(x%8))); + int pixel; + if (bmp->type == GSM_StartupLogo || bmp->type == GSM_6210StartupLogo || bmp->type == GSM_7110StartupLogo) + bmp->bitmap[((y/8)*bmp->width)+x] &= 255 - (1 << (y%8)); + if (bmp->type == GSM_OperatorLogo || bmp->type == GSM_7110OperatorLogo || bmp->type == GSM_CallerLogo) { + pixel=bmp->width*y + x; + bmp->bitmap[pixel/8] &= ~(1 << (7-(pixel%8))); + } + if (bmp->type == GSM_PictureImage) bmp->bitmap[9*y + (x/8)] &= 255 - (1 << (7-(x%8))); } bool GSM_IsPointBitmap(GSM_Bitmap *bmp, int x, int y) { - int i = 0; - - if (bmp->type == GSM_StartupLogo) i = (bmp->bitmap[((y/8)*bmp->width) + x] & 1<<((y%8))); - if (bmp->type == GSM_OperatorLogo || bmp->type == GSM_CallerLogo) - i = (bmp->bitmap[(y*bmp->width+x)/8] & 1 << (7-((y*bmp->width+x)%8))); - /* Testing only ! */ - if (bmp->type == GSM_PictureImage) i = (bmp->bitmap[9*y + (x/8)] & 1<<(7-(x%8))); - - if (i) return true; - else return false; + int i=0; + int pixel; + + if (bmp->type == GSM_StartupLogo || bmp->type == GSM_6210StartupLogo || bmp->type == GSM_7110StartupLogo) + i=(bmp->bitmap[((y/8)*bmp->width) + x] & 1<<((y%8))); + if (bmp->type == GSM_OperatorLogo || bmp->type == GSM_7110OperatorLogo || bmp->type == GSM_CallerLogo) { + pixel=bmp->width*y + x; + i=(bmp->bitmap[pixel/8] & 1<<(7-(pixel%8))); + } + if (bmp->type == GSM_PictureImage) i=(bmp->bitmap[9*y + (x/8)] & 1<<(7-(x%8))); + + if (i) return true; else return false; } - + void GSM_ClearBitmap(GSM_Bitmap *bmp) { - int i; - - for (i = 0; i < bmp->size; i++) bmp->bitmap[i] = 0; + int i; + for (i=0;isize;i++) bmp->bitmap[i]=0; } - -void GSM_ResizeBitmap(GSM_Bitmap *bitmap, GSM_Bitmap_Types target, GSM_Information *info) +GSM_Error GSM_ReadBitmap(GSM_SMSMessage *message, GSM_Bitmap *bitmap) { - GSM_Bitmap backup; - int x,y,copywidth,copyheight; + int offset = 1; + unsigned char buffer[20]; + + switch (message->UDHType) { + case GSM_OpLogo: + EncodeUDHHeader(buffer, GSM_OperatorLogo); + if (message->Length!=133) return GE_UNKNOWN; + + bitmap->type = GSM_OperatorLogo; + + DecodeNetworkCode(message->MessageText, bitmap->netcode); + + offset = 4; + break; + + case GSM_CallerIDLogo: + EncodeUDHHeader(buffer, GSM_CallerLogo); + if (message->Length!=130) return GE_UNKNOWN; + + bitmap->type=GSM_CallerLogo; + + break; + default: /* error */ + return GE_UNKNOWN; + break; + } + bitmap->width = message->MessageText[offset]; + bitmap->height = message->MessageText[offset + 1]; + + if (bitmap->width!=72 || bitmap->height!=14) return GE_INVALIDIMAGESIZE; + + bitmap->size = (bitmap->width * bitmap->height) / 8; + memcpy(bitmap->bitmap, message->MessageText + offset + 3, bitmap->size); - /* Copy into the backup */ - memcpy(&backup,bitmap,sizeof(GSM_Bitmap)); +#ifdef DEBUG + fprintf(stdout, _("Bitmap from SMS: width %i, height %i\n"),bitmap->width,bitmap->height); +#endif + + return GE_NONE; +} + +void GSM_ResizeBitmap(GSM_Bitmap *bitmap, GSM_Bitmap_Types target) +{ + GSM_Bitmap backup; + int x,y,width,height; + + backup=*bitmap; - if (target==GSM_StartupLogo) { - bitmap->width=info->StartupLogoW; - bitmap->height=info->StartupLogoH; - bitmap->size=((bitmap->height/8)+(bitmap->height%8>0))*bitmap->width; - } - if (target==GSM_OperatorLogo) { - bitmap->width=info->OpLogoW; - bitmap->height=info->OpLogoH; - x=bitmap->width*bitmap->height; - bitmap->size=(x/8)+(x%8>0); - } - if (target==GSM_CallerLogo) { - bitmap->width=info->CallerLogoW; - bitmap->height=info->CallerLogoH; - x=bitmap->width*bitmap->height; - bitmap->size=(x/8)+(x%8>0); - } - if (target==GSM_PictureImage) { - bitmap->width=72; - bitmap->height=28; - bitmap->size=bitmap->width*bitmap->height/8; - } - bitmap->type=target; - - if (backup.width>bitmap->width) { - copywidth=bitmap->width; + if (target==GSM_StartupLogo) { + bitmap->width=84; + bitmap->height=48; + } + if (target==GSM_7110StartupLogo) { + bitmap->width=96; + bitmap->height=65; + } + if (target==GSM_6210StartupLogo) { + bitmap->width=96; + bitmap->height=60; + } + if (target==GSM_OperatorLogo || target==GSM_CallerLogo) { + bitmap->width=72; + bitmap->height=14; + } + if (target==GSM_PictureImage ) { + bitmap->width=72; + bitmap->height=28; + } + if (target==GSM_7110OperatorLogo) { + bitmap->width=78; + bitmap->height=21; + } + bitmap->type=target; + bitmap->size=(bitmap->width*bitmap->height + 7)/8; + + width=backup.width; + if (bitmap->widthwidth; #ifdef DEBUG - fprintf(stdout,_("We lost some part of image - it's cut (width from %i to %i) !\n"),backup.width,bitmap->width); + fprintf(stdout,_("We lost some part of image - it's cut (width from %i to %i) !\n"),backup.width,width); #endif /* DEBUG */ - } else copywidth=backup.width; - - if (backup.height>bitmap->height) { - copyheight=bitmap->height; + } + + height=backup.height; + if (bitmap->heightheight; #ifdef DEBUG - fprintf(stdout,_("We lost some part of image - it's cut (height from %i to %i) !\n"),backup.height,bitmap->height); + fprintf(stdout,_("We lost some part of image - it's cut (height from %i to %i) !\n"),backup.height,height); #endif /* DEBUG */ - } else copyheight=backup.height; + } - - GSM_ClearBitmap(bitmap); + GSM_ClearBitmap(bitmap); - for (y=0;yheight; y++) { - for (x = 0; x < bitmap->width; x++) { - if (GSM_IsPointBitmap(bitmap, x, y)) { - fprintf(stdout, "#"); - } else { - fprintf(stdout, " "); - } - } - fprintf(stdout, "\n"); - } + int x,y; + + for (y=0;yheight;y++) { + for (x=0;xwidth;x++) { + if (GSM_IsPointBitmap(bitmap,x,y)) { + fprintf(stdout, _("#")); + } else { + fprintf(stdout, _(" ")); + } + } + fprintf(stdout, _("\n")); + } } - -GSM_Error GSM_ReadSMSBitmap(int type, char *message, char *code, GSM_Bitmap *bitmap) +int GSM_SaveBitmapToSMS(GSM_MultiSMSMessage *SMS, GSM_Bitmap *bitmap, + bool ScreenSaver, bool UnicodeText) { - int offset = 0; - - switch (type) { - case SMS_OpLogo: - if (!code) return GE_UNKNOWN; - - bitmap->type = SMS_OpLogo; - - bitmap->netcode[0] = '0' + (message[0] & 0x0f); - bitmap->netcode[1] = '0' + (message[0] >> 4); - bitmap->netcode[2] = '0' + (message[1] & 0x0f); - bitmap->netcode[3] = ' '; - bitmap->netcode[4] = '0' + (message[2] & 0x0f); - bitmap->netcode[5] = '0' + (message[2] >> 4); - bitmap->netcode[6] = 0; - - break; - case SMS_CallerIDLogo: - bitmap->type = SMS_CallerIDLogo; - break; - case SMS_Picture: - offset = 2; - bitmap->type = GSM_PictureImage; - break; - default: /* error */ - return GE_UNKNOWN; - break; - } - bitmap->width = message[0]; - bitmap->height = message[1]; + char MessageBuffer[GSM_MAX_SMS_8_BIT_LENGTH*4]; + int MessageLength=0; + GSM_UDH UDHType=GSM_NoUDH; - bitmap->size = (bitmap->width * bitmap->height) / 8; - memcpy(bitmap->bitmap, message + offset + 2, bitmap->size); - - dprintf("Bitmap from SMS: width %i, height %i\n", bitmap->width, bitmap->height); - - return GE_NONE; -} - - -/* Returns message length */ - -int GSM_SaveSMSBitmap(GSM_SMSMessage *message, GSM_Bitmap *bitmap) -{ - int current=0; - - char UserDataHeader[7] = { 0x06, /* UDH Length */ - 0x05, /* IEI: application port addressing scheme, 16 bit address */ - 0x04, /* IEI length */ - 0x15, /* destination address: high byte */ - 0x00, /* destination address: low byte */ - 0x00, /* originator address */ - 0x00}; - - char Data[7] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - /* Default settings for SMS message: - - no delivery report - - Class Message 1 - - no compression - - 8 bit data - - SMSC no. 1 - - validity 3 days - - set UserDataHeaderIndicator - */ - - message->Status = SMS_Sent; - /* Data Coding Scheme */ - message->DCS.Type = SMS_GeneralDataCoding; - message->DCS.u.General.Class = 2; - message->DCS.u.General.Compressed = false; - message->DCS.u.General.Alphabet = SMS_8bit; - - - message->MessageCenter.No = 1; - message->Validity.VPF = SMS_RelativeFormat; - message->Validity.u.Relative = 4320; /* 4320 minutes == 72 hours */ - message->ReplyViaSameSMSC = false; - - switch (bitmap->type) { - case GSM_OperatorLogo: - message->UDH[0].Type = SMS_OpLogo; - UserDataHeader[4] = 0x82; /* NBS port 0x1582 */ - - /* Set the network code */ - Data[current++] = ((bitmap->netcode[1] & 0x0f) << 4) | (bitmap->netcode[0] & 0xf); - Data[current++] = 0xf0 | (bitmap->netcode[2] & 0x0f); - Data[current++] = ((bitmap->netcode[5] & 0x0f) << 4) | (bitmap->netcode[4] & 0xf); - - break; - case GSM_CallerLogo: - message->UDH[0].Type = SMS_CallerIDLogo; - UserDataHeader[4] = 0x83; /* NBS port 0x1583 */ - break; - default: /* error */ - break; - } + switch (bitmap->type) { + case GSM_OperatorLogo: + UDHType=GSM_OpLogo; + + EncodeNetworkCode(MessageBuffer, bitmap->netcode); + MessageLength=3; + + /* Set the logo size */ + MessageBuffer[MessageLength++] = 0x00; + MessageBuffer[MessageLength++] = bitmap->width; + MessageBuffer[MessageLength++] = bitmap->height; + MessageBuffer[MessageLength++] = 0x01; + + memcpy(MessageBuffer+MessageLength,bitmap->bitmap,bitmap->size); + MessageLength=MessageLength+bitmap->size; + + break; + case GSM_CallerLogo: + UDHType=GSM_CallerIDLogo; + + /* Set the logo size */ + MessageBuffer[MessageLength++] = 0x00; + MessageBuffer[MessageLength++] = bitmap->width; + MessageBuffer[MessageLength++] = bitmap->height; + MessageBuffer[MessageLength++] = 0x01; + + memcpy(MessageBuffer+MessageLength,bitmap->bitmap,bitmap->size); + MessageLength=MessageLength+bitmap->size; + + break; + case GSM_PictureImage: + UDHType=GSM_ProfileUDH; + + MessageBuffer[MessageLength++]=0x30; //SM version. Here 3.0 + + if (!ScreenSaver) + MessageBuffer[MessageLength++]=SM30_OTA; //ID for OTA bitmap + else + MessageBuffer[MessageLength++]=SM30_SCREENSAVER; //ID for screen saver + + /* Length for picture part */ + MessageBuffer[MessageLength++]=0x01; //length hi + MessageBuffer[MessageLength++]=0x00; //length lo + + /* Set the logo size */ + MessageBuffer[MessageLength++] = 0x00; + MessageBuffer[MessageLength++] = bitmap->width; + MessageBuffer[MessageLength++] = bitmap->height; + MessageBuffer[MessageLength++] = 0x01; + + memcpy(MessageBuffer+MessageLength,bitmap->bitmap,bitmap->size); + MessageLength=MessageLength+bitmap->size; + + if (strlen(bitmap->text)!=0) { + if (UnicodeText) { + MessageBuffer[MessageLength++]=SM30_UNICODETEXT; //ID for Unicode text + + /* Length for text part */ + MessageBuffer[MessageLength++]=0x00; //length of text1 + MessageBuffer[MessageLength++]=strlen(bitmap->text)*2;//length of text2 + + EncodeUnicode (MessageBuffer+MessageLength,bitmap->text,strlen(bitmap->text)); + MessageLength=MessageLength+2*strlen(bitmap->text); + } else { + MessageBuffer[MessageLength++]=SM30_ISOTEXT; //ID for ISO-8859-1 text + + /* Length for text part */ + MessageBuffer[MessageLength++]=0x00; //length of text1 + MessageBuffer[MessageLength++]=strlen(bitmap->text); //length of text2 + + memcpy(MessageBuffer+MessageLength,bitmap->text,strlen(bitmap->text)); + MessageLength=MessageLength+strlen(bitmap->text); + } + } + break; + + default: /* error */ + break; + } - /* Set the logo size */ - current++; - Data[current++] = bitmap->width; - Data[current++] = bitmap->height; - - Data[current++] = 0x01; - - memcpy(message->MessageText, UserDataHeader, 7); - memcpy(message->MessageText, Data, current); - memcpy(message->MessageText+current, bitmap->bitmap, bitmap->size); + GSM_MakeMultiPartSMS2(SMS,MessageBuffer,MessageLength, UDHType, GSM_Coding_Default); - return current; + return 0; } diff --git a/common/gsm-networks.c b/common/gsm-networks.c index 2ef285f..b36bcf5 100644 --- a/common/gsm-networks.c +++ b/common/gsm-networks.c @@ -1,29 +1,20 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. This file implements GSM networks searching. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:00 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.14 2001/06/28 00:28:45 pkot - Small docs updates (Pawel Kot) - - */ #include + +#include "gsm-common.h" #include "gsm-networks.h" +#include "gsm-coding.h" GSM_Country GSM_Countries[] = { @@ -277,19 +268,50 @@ GSM_Network GSM_Networks[] = { "340 01", "AMERIS" }, { "400 01", "AZERCELL GSM" }, { "400 02", "Bakcell GSM 2000" }, - { "404 07", "TATA Cellular" }, - { "404 10", "AirTel" }, - { "404 11", "Essar Cellphone" }, - { "404 12", "Escotel" }, - { "404 14", "Modicom" }, - { "404 15", "Essar Cellphone" }, - { "404 20", "Max Touch" }, - { "404 21", "BPL - Mobile" }, - { "404 27", "BPL USWEST Cellular" }, - { "404 30", "Command" }, - { "404 40", "SkyCell" }, - { "404 41", "RPG Cellular" }, - { "404 42", "AIRCEL" }, + + { "404 01", "AIRCELL"}, + { "404 02", "Evergrowth"}, + { "404 03", "Bharthi Telenet"}, + { "404 05", "Fascel"}, + { "404 07", "Tata Cell"}, //TATA Cellular + { "404 08", "Koshika"}, + { "404 09", "Reliance"}, + { "404 10", "AIRTEL"}, //AirTel + { "404 11", "Essar"}, //Essar Cellphone + { "404 12", "Escotel"}, + { "404 14", "Spice"}, //Modicom + { "404 15", "AIRCELL"}, //Essar Cellphone + { "404 18", "Reliance"}, + { "404 19", "Escotel"}, + { "404 20", "Orange"}, //Max Touch + { "404 21", "BPL Mobile"}, //BPL - Mobile + { "404 22", "Birla AT&T"}, + { "404 24", "Birla AT&T"}, + { "404 26", "Koshika"}, + { "404 27", "BPL Mobile"}, //BPL USWEST Cellular + { "404 30", "Usha"}, //Command + { "404 31", "AIRCELL"}, //? + { "404 31", "Command"}, //? + { "404 32", "Koshika"}, + { "404 34", "Koshika"}, + { "404 36", "Reliance"}, + { "404 40", "SkyCell"}, + { "404 41", "RPG"}, //RPG Cellular + { "404 42", "AIRCELL"}, //AIRCEL + { "404 43", "BPL Mobile"}, + { "404 44", "Spice"}, + { "404 45", "AIRTEL-blr"}, + { "404 46", "BPL Moibile"}, + { "404 49", "AIRTEL"}, + { "404 50", "Reliance"}, + { "404 52", "Reliance"}, + { "404 56", "Escotel"}, + { "404 60", "AIRCELL"}, + { "404 67", "Reliance"}, + { "404 70", "Hexacom"}, + { "404 78", "RPG"}, + { "404 85", "Reliance"}, + { "410 01", "Mobilink" }, { "413 02", "DIALOG GSM" }, { "415 01", "CELLIS" }, @@ -443,3 +465,18 @@ char *GSM_GetCountryCode(char *CountryName) return GSM_Countries[index].Code; } + +void EncodeNetworkCode(unsigned char* buffer, unsigned char* output) +{ + EncodeBCD (buffer, output, 6, false); + buffer[1]=buffer[1] | 0xf0; +} + +void DecodeNetworkCode(unsigned char* buffer, unsigned char* output) +{ + DecodeBCD (output, buffer, 3); + output[6]=output[5]; + output[5]=output[4]; + output[4]=output[3]; + output[3]=' '; +} diff --git a/common/gsm-ringtones.c b/common/gsm-ringtones.c index f99883e..aa68378 100644 --- a/common/gsm-ringtones.c +++ b/common/gsm-ringtones.c @@ -1,620 +1,1023 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. This file provides support for ringtones. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:00 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.3 2001/11/08 16:34:19 pkot - Updates to work with new libsms - - Revision 1.2 2001/09/20 21:46:21 pkot - Locale cleanups (Pawel Kot) +*/ +#ifdef WIN32 + #include + #include "misc_win32.h" +#else + #include +#endif -*/ +#include "gsm-api.h" -#include "gsm-ringtones.h" -#include "misc.h" +GSM_Ringtone SMringtone; +GSM_BinRingtone ringtone; /* Beats-per-Minute Encoding */ int BeatsPerMinute[] = { - 25, - 28, - 31, - 35, - 40, - 45, - 50, - 56, - 63, - 70, - 80, - 90, - 100, - 112, - 125, - 140, - 160, - 180, - 200, - 225, - 250, - 285, - 320, - 355, - 400, - 450, - 500, - 565, - 635, - 715, - 800, - 900 + 25, 28, 31, 35, 40, 45, 50, 56, 63, 70, + 80, 90, 100, 112, 125, 140, 160, 180, 200, 225, + 250, 285, 320, 355, 400, 450, 500, 565, 635, 715, + 800, 900 +}; + +struct OneRingtone RingingTones[] = { + {"",0,0}, +/* 1 */ {"Uploaded #1",0,0}, /* 2 */ {"Ring ring",0,0}, +/* 3 */ {"Low",0,0}, /* 4 */ {"Fly",0,0}, +/* 5 */ {"Mosquito",0,0}, /* 6 */ {"Bee",0,0}, +/* 7 */ {"Intro",0,0}, /* 8 */ {"Etude",0,0}, +/* 9 */ {"Hunt",0,0}, /* 10 */ {"Going up",0,0}, +/* 11 */ {"City bird",0,0}, /* 12 */ {"Chase",0,0}, +/* 13 */ {"Scifi",0,0}, /* 14 */ {"Kick",0,0}, +/* 15 */ {"Do-mi-so",0,0}, /* 16 */ {"Robo N1X",0,0}, +/* 17 */ {"Dizzy",0,0}, /* 18 */ {"Playground",0,0}, +/* 19 */ {"That's it!",0,0}, /* 20 */ {"Grande valse",0,0}, +/* 21 */ {"Knock knock",0,0}, /* 22 */ {"Knock again",0,0}, +/* 23 */ {"Helan",0,0}, /* 24 */ {"Fuga",0,0}, +/* 25 */ {"Menuet",0,0}, /* 26 */ {"Ode to Joy",0,0}, +/* 27 */ {"Elise",0,0}, /* 28 */ {"Mozart 40",0,0}, +/* 29 */ {"Piano Concerto",0,0},/* 30 */ {"William Tell",0,0}, +/* 31 */ {"Badinerie",0,0}, /* 32 */ {"Polka",0,0}, +/* 33 */ {"Attraction",0,0}, /* 34 */ {"Polite",0,0}, +/* 35 */ {"Persuasion",0,0}, /* 36 */ {"Tick tick",0,0}, +/* 37 */ {"Samba",0,0}, /* 38 */ {"Orient",0,0}, +/* 39 */ {"Charleston",0,0}, /* 40 */ {"Songette",0,0}, +/* 41 */ {"Jumping",0,0}, /* 42 */ {"Lamb",0,0}, +/* 43 */ {"Marry",0,0}, /* 44 */ {"Tango",0,0}, +/* 45 */ {"Tangoed",0,0}, /* 46 */ {"Down",0,0}, +/* 47 */ {"Polska",0,0}, /* 48 */ {"WalzeBrilliant",0,0}, +/* 49 */ {"Cicada",0,0}, /* 50 */ {"Trio",0,0}, +/* 51 */ {"Circles",0,0}, /* 52 */ {"Nokia tune",0,0}, +/* 53 */ {"Sunny walks",0,0}, /* 54 */ {"Basic rock",0,0}, +/* 55 */ {"Reveille",0,0}, /* 56 */ {"Groovy Blue",0,0}, +/* 57 */ {"Brave Scotland",0,0},/* 58 */ {"Matilda",0,0}, +/* 59 */ {"Bumblebee",0,0}, /* 60 */ {"Hungarian",0,0}, +/* 61 */ {"Valkyrie",0,0}, /* 62 */ {"Bach #3",0,0}, +/* 63 */ {"Toreador",0,0}, /* 64 */ {"9th Symphony",0,0}, +/* 65 */ {"Uploaded #2",0,0}, /* 66 */ {"Uploaded #3",0,0}, +/* 67 */ {"Uploaded #4",0,0}, /* 68 */ {"Uploaded #5",0,0}, + {"",0,0} }; int OctetAlign(unsigned char *Dest, int CurrentBit) { - int i=0; + int i=0; - while((CurrentBit+i)%8) { - ClearBit(Dest, CurrentBit+i); - i++; - } + while((CurrentBit+i)%8) { + ClearBit(Dest, CurrentBit+i); + i++; + } - return CurrentBit+i; + return CurrentBit+i; } int OctetAlignNumber(int CurrentBit) { - int i=0; + int i=0; - while((CurrentBit+i)%8) { - i++; - } + while((CurrentBit+i)%8) { i++; } - return CurrentBit+i; + return CurrentBit+i; } int BitPack(unsigned char *Dest, int CurrentBit, unsigned char *Source, int Bits) { - int i; - for (i=0; i is always - octet-aligned. */ - StartBit=OctetAlign(package, StartBit); - - StartBit=BitPackByte(package, StartBit, Sound, 7); - StartBit=BitPackByte(package, StartBit, BasicSongType, 3); - - /* Packing the name of the tune. */ - StartBit=BitPackByte(package, StartBit, strlen(ringtone->name)<<4, 4); - StartBit=BitPack(package, StartBit, ringtone->name, 8*strlen(ringtone->name)); - - /* Info about song pattern */ - StartBit=BitPackByte(package, StartBit, 0x01, 8); /* One song pattern */ - StartBit=BitPackByte(package, StartBit, PatternHeaderId, 3); - StartBit=BitPackByte(package, StartBit, A_part, 2); - StartBit=BitPackByte(package, StartBit, 0, 4); /* No loop value */ - - /* Info, how long is contents for SMS */ - HowLong=30+8*strlen(ringtone->name)+17+8+8+13; + int StartBit=0; + unsigned char CommandLength = 0x02; + unsigned char spec; + int oldscale=10, newscale=0, oldstyle=0, oldtempo=0; + int HowMany=0; /* How many instructions packed */ + int HowLong=0; /* How many bits packed */ + int StartNote=0, EndNote=0; /* First and last packed note from ringtone */ + + /* Default ringtone parameters */ + u8 DefNoteScale=2, DefNoteDuration=4; + int DefNoteTempo=63; + u8 DefNoteStyle=NaturalStyle; + + int buffer[6]; /* Used to find default ringtone parameters */ + int i,j,k=0,thisnote,thisnotelong; - /* Calculate the number of instructions in the tune. - Each Note contains Note and (sometimes) Scale. - Default Tempo and Style are instructions too. */ - HowMany=2; /* Default Tempo and Style */ - - for(i=0; iNrNotes; i++) { - - /* PC Composer 2.0.010 doesn't like, when we start ringtone from pause: - it displays that the format is invalid and - hangs, when you move mouse over place, where pause is */ - if (GSM_GetNote(ringtone->notes[i].note)==Note_Pause && oldscale==10) { - StartNote++; - } else { + /* Find the most frequently used duration and use this for the default */ + for (i=0;i<6;i++) buffer[i]=0; + for (i=0;iNrNotes;i++) { + switch (ringtone->notes[i].duration) { + case 192: buffer[0]++; break; + case 128: buffer[0]++; break; + case 96: buffer[1]++; break; + case 64: buffer[1]++; break; + case 48: buffer[2]++; break; + case 32: buffer[2]++; break; + case 24: buffer[3]++; break; + case 16: buffer[3]++; break; + case 12: buffer[4]++; break; + case 8: buffer[4]++; break; + case 6: buffer[5]++; break; + case 4: buffer[5]++; break; + } + } + + /* Now find the most frequently used */ + j=0; + for (i=0;i<6;i++) { + if (buffer[i]>j) { + k=i; + j=buffer[i]; + } + } + + /* Finally convert the default duration */ + switch (k) { + case 0: DefNoteDuration=128; break; + case 1: DefNoteDuration= 64; break; + case 2: DefNoteDuration= 32; break; + case 3: DefNoteDuration= 16; break; + case 4: DefNoteDuration= 8; break; + case 5: DefNoteDuration= 4; break; + default: DefNoteDuration= 16; break; + } + + /* Find the most frequently used scale and use this for the default */ + for (i=0;i<6;i++) buffer[i]=0; + for (i=0;iNrNotes;i++) { + if (ringtone->notes[i].note!=255) { + buffer[ringtone->notes[i].note/14]++; + } + } + j=0; + for (i=0;i<6;i++) { + if (buffer[i]>j) { + DefNoteScale=i; + j=buffer[i]; + } + } + + StartBit=BitPackByte(package, StartBit, CommandLength, 8); + StartBit=BitPackByte(package, StartBit, RingingToneProgramming, 7); + + /* The page 3-23 of the specs says that is always + octet-aligned. */ + StartBit=OctetAlign(package, StartBit); + + StartBit=BitPackByte(package, StartBit, Sound, 7); + StartBit=BitPackByte(package, StartBit, BasicSongType, 3); + + /* Set special chars in ringtone name */ + for (i=0;iname);i++) { + if (ringtone->name[i]=='~') ringtone->name[i]=1; //enables/disables blinking + if (ringtone->name[i]=='`') ringtone->name[i]=0; //hides rest ot contents + } + + /* Packing the name of the tune. */ + StartBit=BitPackByte(package, StartBit, strlen(ringtone->name)<<4, 4); + StartBit=BitPack(package, StartBit, ringtone->name, 8*strlen(ringtone->name)); + + /* Set special chars in ringtone name */ + for (i=0;iname);i++) { + if (ringtone->name[i]==1) ringtone->name[i]='~'; //enables/disables blinking + if (ringtone->name[i]==0) ringtone->name[i]='`'; //hides rest ot contents + } + + /* Info about song pattern */ + StartBit=BitPackByte(package, StartBit, 0x01, 8); /* One song pattern */ + StartBit=BitPackByte(package, StartBit, PatternHeaderId, 3); + StartBit=BitPackByte(package, StartBit, A_part, 2); + StartBit=BitPackByte(package, StartBit, ringtone->Loop<<4, 4); + + /* Info, how long is contents for SMS */ + HowLong=8+8+7+3+4+8*strlen(ringtone->name)+8+3+2+4+8+3+2+3+5; + + /* Calculating number of instructions in the tune. + Each Note contains Note and (sometimes) Scale. + Default Tempo and Style are instructions too. */ + HowMany=2; /* Default Tempo and Style */ + + /* Default style and tempo */ + DefNoteStyle=ringtone->notes[0].style; + DefNoteTempo=ringtone->notes[0].tempo; + oldstyle=DefNoteStyle; + oldtempo=DefNoteTempo; + + for(i=0; iNrNotes; i++) { + + /* PC Composer 2.0.010 doesn't like, when we start ringtone from pause: + displays, that format is invalid and + hangs, when you move mouse over place, where pause is */ + if (GSM_GetNote(ringtone->notes[i].note)==Note_Pause && oldscale==10) { + StartNote++; + } else { + + thisnote=0; + thisnotelong=0; + + /* we don't write Scale/Style info before "Pause" note - it saves place */ + if (GSM_GetNote(ringtone->notes[i].note)!=Note_Pause) { + + if (ringtone->allnotesscale || + oldscale!=(newscale=GSM_GetScale(ringtone->notes[i].note))) { + + /* We calculate, if we have space to add next scale instruction */ + if (((OctetAlignNumber(HowLong+5)+8)/8)<=(*maxlength)) { + oldscale=newscale; + HowLong+=5; + HowMany++; + thisnote++; + thisnotelong+=5; + } else { + break; + } + } + if (ringtone->notes[i].style!=oldstyle) { + /* We calculate, if we have space to add next style instruction */ + if (((OctetAlignNumber(HowLong+5)+8)/8)<=(*maxlength)) { + oldstyle=ringtone->notes[i].style; + HowLong+=5; + HowMany++; + thisnote++; + thisnotelong+=5; + } else { + HowLong=HowLong-thisnotelong; + HowMany=HowMany-thisnote; + break; + } + } + } - /* we don't write Scale info before "Pause" note - it saves space */ - if (GSM_GetNote(ringtone->notes[i].note)!=Note_Pause && - oldscale!=(newscale=GSM_GetScale(ringtone->notes[i].note))) { - - /* We calculate, if we have space to add next scale instruction */ - if (((HowLong+5)/8)<=(*maxlength-1)) { - oldscale=newscale; - HowMany++; - HowLong+=5; - } else { - break; - } - } + if (ringtone->notes[i].tempo!=oldtempo) { + /* We calculate, if we have space to add next tempo instruction */ + if (((OctetAlignNumber(HowLong+8)+8)/8)<=(*maxlength)) { + oldtempo=ringtone->notes[i].tempo; + HowLong+=8; + HowMany++; + thisnote++; + thisnotelong+=8; + } else { + HowLong=HowLong-thisnotelong; + HowMany=HowMany-thisnote; + break; + } + } - /* We calculate, if we have space to add next note instruction */ - if (((HowLong+12)/8)<=(*maxlength-1)) { - HowMany++; - EndNote++; - HowLong+=12; - } else { - break; - } - } - - /* If we are sure, we pack it for SMS or setting to phone, not for OTT file */ - if (*maxlength<1000) { - /* Pc Composer gives this as the phone limitation */ - if ((EndNote-StartNote)==GSM_MAX_RINGTONE_NOTES-1) break; - } - } - - StartBit=BitPackByte(package, StartBit, HowMany, 8); - - /* Style */ - StartBit=BitPackByte(package, StartBit, StyleInstructionId, 3); - StartBit=BitPackByte(package, StartBit, ContinuousStyle, 2); - - /* Beats per minute/tempo of the tune */ - StartBit=BitPackByte(package, StartBit, TempoInstructionId, 3); - StartBit=BitPackByte(package, StartBit, GetTempo(ringtone->tempo), 5); + /* We calculate, if we have space to add next note instruction */ + if (((OctetAlignNumber(HowLong+12)+8)/8)<=(*maxlength)) { + HowMany++; + EndNote++; + HowLong+=12; + } else { + HowLong=HowLong-thisnotelong; + HowMany=HowMany-thisnote; + break; + } + } + + /* We are sure, we pack it for SMS or setting to phone, not for OTT file */ + if (*maxlength<1000) { + /* Like Pc Composer say - before of phone limitations...*/ + if ((EndNote-StartNote)==FB61_MAX_RINGTONE_NOTES-1) break; + } + } + + StartBit=BitPackByte(package, StartBit, HowMany, 8); +#ifdef DEBUG +// fprintf(stdout,_("length of new pattern: %i %i\n"),HowMany,StartBit); +#endif + + /* Style */ + StartBit=BitPackByte(package, StartBit, StyleInstructionId, 3); + StartBit=BitPackByte(package, StartBit, DefNoteStyle, 2); + + /* Beats per minute/tempo of the tune */ + StartBit=BitPackByte(package, StartBit, TempoInstructionId, 3); + StartBit=BitPackByte(package, StartBit, GSM_GetTempo(DefNoteTempo), 5); +#ifdef DEBUG +// fprintf(stdout,_("def temp: %i %i\n"),GSM_GetTempo(DefNoteTempo),StartBit); +#endif + + /* Default scale */ + oldscale=10; + + /* Default style */ + oldstyle=DefNoteStyle; + + /* Default tempo */ + oldtempo=DefNoteTempo; + + /* Notes packing */ + for(i=StartNote; i<(EndNote+StartNote); i++) { + + /* we don't write Scale info before "Pause" note - it saves place */ + if (GSM_GetNote(ringtone->notes[i].note)!=Note_Pause) { + if (ringtone->allnotesscale || + oldscale!=(newscale=GSM_GetScale(ringtone->notes[i].note))) { +#ifdef DEBUG +// fprintf(stdout,_("Scale\n")); +#endif + oldscale=newscale; + StartBit=BitPackByte(package, StartBit, ScaleInstructionId, 3); + StartBit=BitPackByte(package, StartBit, GSM_GetScale(ringtone->notes[i].note), 2); + } + if (ringtone->notes[i].style!=oldstyle) { + /* Style */ + StartBit=BitPackByte(package, StartBit, StyleInstructionId, 3); + StartBit=BitPackByte(package, StartBit, ringtone->notes[i].style, 2); + oldstyle=ringtone->notes[i].style; + } + } + + if (ringtone->notes[i].tempo!=oldtempo) { + /* Beats per minute/tempo of the tune */ + StartBit=BitPackByte(package, StartBit, TempoInstructionId, 3); + StartBit=BitPackByte(package, StartBit, GSM_GetTempo(ringtone->notes[i].tempo), 5); + oldtempo=ringtone->notes[i].tempo; + } + + /* Note */ + StartBit=BitPackByte(package, StartBit, NoteInstructionId, 3); + StartBit=BitPackByte(package, StartBit, GSM_GetNote(ringtone->notes[i].note), 4); + StartBit=BitPackByte(package, StartBit, GSM_GetDuration(ringtone->notes[i].duration,&spec), 3); + StartBit=BitPackByte(package, StartBit, spec, 2); - /* Default scale */ - oldscale=10; +#ifdef DEBUG +// fprintf(stdout,_("note(%i): %i, scale: %i, duration: %i, spec: %i\n"),i,ringtone->notes[i].note,GSM_GetScale(ringtone->notes[i].note),GSM_GetDuration(ringtone->notes[i].duration,&spec),spec); +#endif - /* Notes packing */ - for(i=StartNote; i<(EndNote+StartNote); i++) { - - /* we don't write Scale info before "Pause" note - it saves place */ - if (GSM_GetNote(ringtone->notes[i].note)!=Note_Pause && - oldscale!=(newscale=GSM_GetScale(ringtone->notes[i].note))) { - oldscale=newscale; - StartBit=BitPackByte(package, StartBit, ScaleInstructionId, 3); - StartBit=BitPackByte(package, StartBit, GSM_GetScale(ringtone->notes[i].note), 2); - } - - /* Note */ - StartBit=BitPackByte(package, StartBit, NoteInstructionId, 3); - StartBit=BitPackByte(package, StartBit, GSM_GetNote(ringtone->notes[i].note), 4); - StartBit=BitPackByte(package, StartBit, GSM_GetDuration(ringtone->notes[i].duration,&spec), 3); - StartBit=BitPackByte(package, StartBit, spec, 2); - } + } - StartBit=OctetAlign(package, StartBit); + StartBit=OctetAlign(package, StartBit); - StartBit=BitPackByte(package, StartBit, CommandEnd, 8); + StartBit=BitPackByte(package, StartBit, CommandEnd, 8); - if (StartBit!=OctetAlignNumber(HowLong)) - dprintf("Error in PackRingtone - StartBit different to HowLong %d - %d)\n", StartBit,OctetAlignNumber(HowLong)); +#ifdef DEBUG + if (StartBit!=OctetAlignNumber(HowLong)+8) + fprintf(stdout,_("Error in PackRingtone - StartBit different to HowLong %d - %d)\n"),StartBit,OctetAlignNumber(HowLong)+8); +#endif - *maxlength=StartBit/8; + *maxlength=StartBit/8; - return(EndNote+StartNote); + return(EndNote+StartNote); } - int BitUnPack(unsigned char *Dest, int CurrentBit, unsigned char *Source, int Bits) { - int i; + int i; - for (i=0; iallnotesscale=false; + + StartBit=BitUnPackInt(package,StartBit,&l,8); +#ifdef DEBUG + if (l!=0x02) + fprintf(stdout,_("Not header\n")); +#endif + if (l!=0x02) return GE_SUBFORMATNOTSUPPORTED; + + StartBit=BitUnPackInt(package,StartBit,&l,7); +#ifdef DEBUG + if (l!=RingingToneProgramming) + fprintf(stdout,_("Not RingingToneProgramming\n")); +#endif + if (l!=RingingToneProgramming) return GE_SUBFORMATNOTSUPPORTED; + + /* The page 3-23 of the specs says that is always + octet-aligned. */ + StartBit=OctetUnAlign(StartBit); + + StartBit=BitUnPackInt(package,StartBit,&l,7); +#ifdef DEBUG + if (l!=Sound) + fprintf(stdout,_("Not Sound\n")); +#endif + if (l!=Sound) return GE_SUBFORMATNOTSUPPORTED; + + StartBit=BitUnPackInt(package,StartBit,&l,3); +#ifdef DEBUG + if (l!=BasicSongType) + fprintf(stdout,_("Not BasicSongType\n")); +#endif + if (l!=BasicSongType) return GE_SUBFORMATNOTSUPPORTED; + + /* Getting length of the tune name */ + StartBit=BitUnPackInt(package,StartBit,&l,4); + l=l>>4; +#ifdef DEBUG +// fprintf(stdout,_("Length of name: %i\n"),l); +#endif + + /* Unpacking the name of the tune. */ + StartBit=BitUnPack(package, StartBit, ringtone->name, 8*l); + ringtone->name[l]=0; + + /* Set special chars in ringtone name */ + for (i=0;iname);i++) { + if (ringtone->name[i]==1) ringtone->name[i]='~'; //enables/disables blinking + if (ringtone->name[i]==0) ringtone->name[i]='`'; //hides rest ot contents + } + +#ifdef DEBUG +// fprintf(stdout,_("Name: %s\n"),ringtone->name); +#endif + + StartBit=BitUnPackInt(package,StartBit,&l,8); +#ifdef DEBUG +// fprintf(stdout,_("Number of song patterns: %i\n"),l); +#endif + if (l!=1) return GE_SUBFORMATNOTSUPPORTED; //we support only one song pattern + + StartBit=BitUnPackInt(package,StartBit,&l,3); +#ifdef DEBUG + if (l!=PatternHeaderId) + fprintf(stdout,_("Not PatternHeaderId\n")); +#endif + if (l!=PatternHeaderId) return GE_SUBFORMATNOTSUPPORTED; + + StartBit+=2; //Pattern ID - we ignore it + + StartBit=BitUnPackInt(package,StartBit,&l,4); + l=l>>4; +#ifdef DEBUG + fprintf(stdout,_("Loop value: %i\n"),l); +#endif + ringtone->Loop=l; + + HowMany=0; + StartBit=BitUnPackInt(package, StartBit, &HowMany, 8); +#ifdef DEBUG + fprintf(stdout,_("length of new pattern: %i %i\n"),HowMany,StartBit); +#endif + + ringtone->NrNotes=0; -/* The page 3-23 of the specs says that is always - octet-aligned. */ - StartBit = OctetUnAlign(StartBit); - - StartBit = BitUnPackInt(package, StartBit, &l, 7); - if (l != Sound) { - dprintf("Not Sound\n"); - return GE_SUBFORMATNOTSUPPORTED; + for (i=0;i>6); +#endif + switch (l) { + case StaccatoStyle : DefNoteStyle=StaccatoStyle; break; + case ContinuousStyle: DefNoteStyle=ContinuousStyle; break; + case NaturalStyle : DefNoteStyle=NaturalStyle; break; } + break; + case TempoInstructionId: + StartBit=BitUnPackInt(package,StartBit,&l,5); + l=l>>3; + DefNoteTempo=BeatsPerMinute[l]; +#ifdef DEBUG +// fprintf(stdout,_("Tempo %i\n"),l); +#endif + break; + case ScaleInstructionId: + StartBit=BitUnPackInt(package,StartBit,&l,2); + DefNoteScale=l>>6; +#ifdef DEBUG +// fprintf(stdout,_("scale: %i %i\n"),DefNoteScale,ringtone->NrNotes); +#endif + break; + case NoteInstructionId: + StartBit=BitUnPackInt(package,StartBit,&l,4); + + switch (l) { + case Note_C :ringtone->notes[ringtone->NrNotes].note=0;break; + case Note_Cis:ringtone->notes[ringtone->NrNotes].note=1;break; + case Note_D :ringtone->notes[ringtone->NrNotes].note=2;break; + case Note_Dis:ringtone->notes[ringtone->NrNotes].note=3;break; + case Note_E :ringtone->notes[ringtone->NrNotes].note=4;break; + case Note_F :ringtone->notes[ringtone->NrNotes].note=6;break; + case Note_Fis:ringtone->notes[ringtone->NrNotes].note=7;break; + case Note_G :ringtone->notes[ringtone->NrNotes].note=8;break; + case Note_Gis:ringtone->notes[ringtone->NrNotes].note=9;break; + case Note_A :ringtone->notes[ringtone->NrNotes].note=10;break; + case Note_Ais:ringtone->notes[ringtone->NrNotes].note=11;break; + case Note_H :ringtone->notes[ringtone->NrNotes].note=12;break; + default :ringtone->notes[ringtone->NrNotes].note=255;break; //Pause ? + } + + if (ringtone->notes[ringtone->NrNotes].note!=255) + ringtone->notes[ringtone->NrNotes].note=ringtone->notes[ringtone->NrNotes].note+DefNoteScale*14; + + StartBit=BitUnPackInt(package,StartBit,&l,3); + DefNoteDuration=l; + + StartBit=BitUnPackInt(package,StartBit,&spec,2); + + if (DefNoteDuration==Duration_Full && spec==DottedNote) + ringtone->notes[ringtone->NrNotes].duration=128*3/2; + if (DefNoteDuration==Duration_Full && spec==Length_2_3) + ringtone->notes[ringtone->NrNotes].duration=128*2/3; + if (DefNoteDuration==Duration_Full && spec==NoSpecialDuration) + ringtone->notes[ringtone->NrNotes].duration=128; + if (DefNoteDuration==Duration_1_2 && spec==DottedNote) + ringtone->notes[ringtone->NrNotes].duration=64*3/2; + if (DefNoteDuration==Duration_1_2 && spec==Length_2_3) + ringtone->notes[ringtone->NrNotes].duration=64*2/3; + if (DefNoteDuration==Duration_1_2 && spec==NoSpecialDuration) + ringtone->notes[ringtone->NrNotes].duration=64; + if (DefNoteDuration==Duration_1_4 && spec==DottedNote) + ringtone->notes[ringtone->NrNotes].duration=32*3/2; + if (DefNoteDuration==Duration_1_4 && spec==Length_2_3) + ringtone->notes[ringtone->NrNotes].duration=32*2/3; + if (DefNoteDuration==Duration_1_4 && spec==NoSpecialDuration) + ringtone->notes[ringtone->NrNotes].duration=32; + if (DefNoteDuration==Duration_1_8 && spec==DottedNote) + ringtone->notes[ringtone->NrNotes].duration=16*3/2; + if (DefNoteDuration==Duration_1_8 && spec==Length_2_3) + ringtone->notes[ringtone->NrNotes].duration=16*2/3; + if (DefNoteDuration==Duration_1_8 && spec==NoSpecialDuration) + ringtone->notes[ringtone->NrNotes].duration=16; + if (DefNoteDuration==Duration_1_16 && spec==DottedNote) + ringtone->notes[ringtone->NrNotes].duration=8*3/2; + if (DefNoteDuration==Duration_1_16 && spec==Length_2_3) + ringtone->notes[ringtone->NrNotes].duration=8*2/3; + if (DefNoteDuration==Duration_1_16 && spec==NoSpecialDuration) + ringtone->notes[ringtone->NrNotes].duration=8; + if (DefNoteDuration==Duration_1_32 && spec==DottedNote) + ringtone->notes[ringtone->NrNotes].duration=4*3/2; + if (DefNoteDuration==Duration_1_32 && spec==Length_2_3) + ringtone->notes[ringtone->NrNotes].duration=4*2/3; + if (DefNoteDuration==Duration_1_32 && spec==NoSpecialDuration) + ringtone->notes[ringtone->NrNotes].duration=4; + + ringtone->notes[ringtone->NrNotes].style=DefNoteStyle; + + ringtone->notes[ringtone->NrNotes].tempo=DefNoteTempo; + +#ifdef DEBUG +// fprintf(stdout,_("note(%i): %i, scale: %i, duration: %i, spec: %i\n"),ringtone->NrNotes,ringtone->notes[ringtone->NrNotes].note,DefNoteScale,DefNoteDuration,spec); +#endif + if (ringtone->NrNotes==FB61_MAX_RINGTONE_NOTES) break; + + ringtone->NrNotes++; + break; + default: +#ifdef DEBUG + fprintf(stdout,_("Unsupported block %i %i\n"),q,i); +#endif + return GE_SUBFORMATNOTSUPPORTED; + } + } + +#ifdef DEBUG +// printf("Number of notes=%d\n",ringtone->NrNotes); +#endif + + return GE_NONE; +} - StartBit = BitUnPackInt(package, StartBit, &l, 3); - if (l != BasicSongType) { - dprintf("Not BasicSongType\n"); - return GE_SUBFORMATNOTSUPPORTED; - } +GSM_Error GSM_ReadRingtone(GSM_SMSMessage *message, GSM_Ringtone *ringtone) +{ + if (message->UDHType==GSM_RingtoneUDH) { + return GSM_UnPackRingtone(ringtone, message->MessageText, message->Length); + } else return GE_SUBFORMATNOTSUPPORTED; +} + +int GSM_GetFrequency(int number) { + + int freq=0; -/* Getting length of the tune name */ - StartBit = BitUnPackInt(package, StartBit, &l, 4); - l = l >> 4; + /* Values according to the software from http://iki.fi/too/sw/xring/ + generated with: + perl -e 'print int(4400 * (2 **($_/12)) + .5)/10, "\n" for(3..14)' + */ + if (number!=255) { + freq=number%14; + switch (freq) { -/* Unpacking the name of the tune. */ - StartBit = BitUnPack(package, StartBit, ringtone->name, 8*l); - ringtone->name[l] = 0; + case 0: freq=523.3; break; // C + case 1: freq=554.4; break; // Cis - StartBit = BitUnPackInt(package, StartBit, &l, 8); - if (l != 1) return GE_SUBFORMATNOTSUPPORTED; //we support only one song pattern + case 2: freq=587.3; break; //D + case 3: freq=622.3; break; //Dis + + case 4: freq=659.3; break; //E - StartBit = BitUnPackInt(package, StartBit, &l, 3); - if (l != PatternHeaderId) { - dprintf("Not PatternHeaderId\n"); - return GE_SUBFORMATNOTSUPPORTED; - } + case 6: freq=698.5; break; //F + case 7: freq=740; break; //Fis - StartBit += 2; //Pattern ID - we ignore it + case 8: freq=784; break; //G + case 9: freq=830.6; break; //Gis - StartBit = BitUnPackInt(package, StartBit, &l, 4); + case 10: freq=880; break; //A + case 11: freq=932.3; break; //Ais - HowMany = 0; - StartBit = BitUnPackInt(package, StartBit, &HowMany, 8); + case 12: freq=987.8; break; //H + + default: freq=0; break; + } + } + else freq = 0; + + if ((number/14)!=0) freq=freq*(number/14); + else freq=freq/2; + + return freq; + +} + +/* Very fast hack. It should be written correctly ! */ +void GSM_PlayOneNote (GSM_RingtoneNote note) { + int Hz; + + Hz=GSM_GetFrequency(note.note); + + GSM->PlayTone(Hz,5); + + /* Is it correct ? Experimental values here */ + switch (note.style) { + case StaccatoStyle: + usleep (7500); + GSM->PlayTone(0,0); + usleep ((1500000/note.tempo*note.duration)-(7500)); + break; + case ContinuousStyle: + usleep (1500000/note.tempo*note.duration); + break; + case NaturalStyle: + usleep (1500000/note.tempo*note.duration-50); + GSM->PlayTone(0,0); + usleep (50); + break; + } +} + +void GSM_PlayRingtone (GSM_Ringtone *ringtone) { + + int i; + + for (i=0;iNrNotes;i++) { + GSM_PlayOneNote(ringtone->notes[i]); + } + + /* Disables buzzer */ + GSM->PlayTone(255*255,0); +} - scale = 0; - ringtone->NrNotes = 0; +/* Initializes one ringtone: first is number of ringtone in + RingingTones in gnokii.h, second its' code, last position in phone menu */ +void RT(int number, int code, int menu) { + RingingTones[number].code=code; + RingingTones[number].menu=menu; +} + +/* This function initializes structures with ringtones names adequate for + your phone model and firmware; if your phone is not now supported: + 1.set first ringtone in 1'st profile in your phone + 2.make ./gnokii --getprofile 1 + 3.read ringtone code + 4.see in gnokii.h, if ringtone name is gnokii.h in RingingTones (if not, add) + 5.put here RT(a,b,c), where a is number of name in RingingTones in gnokii.h, + b is its' code and c is number of ringtone in phone menu + 6.repeat steps 1-5 for all ringtones + 7.send me (Marcin-Wiacek@Topnet.PL) all RT and phone model */ +void PrepareRingingTones(char model[64], char rev[64]) { + + char rev2[64]; + int i; + bool doit; + + if (!RingingTones[0].code) { + if (!strcmp(model,"NSE-1")) //5110 + { + RT( 2,18, 1);RT( 3,19, 2);RT( 7,23, 3);RT( 5,21, 4);RT( 9,25, 5); + RT(20,48, 7);RT(11,27, 8);RT(33,59, 9);RT(35,62,10); + RT(46,60,11);RT(16,36,12);RT(17,37,13);RT(13,32,14);RT(14,34,15); + RT(19,43,16);RT(18,39,17);RT(24,50,18);RT(31,57,19);RT(28,54,20); + RT(30,56,21);RT(40,73,22);RT(39,72,23);RT(37,69,24); + RT(23,49,26);RT(38,71,27); RT(41,74,29); + + strcpy(rev2,"05.23"); //5.24 and higher + doit=false; + for(i=0;i<5;i++) + { + if (rev[i]rev2[i]) doit=true; + } + + if (doit) { + RT(22,47, 6);RT(47,58,25);RT(45,80,28);RT(43,75,30); + } else + { + RT(21,47, 6);RT(32,58,25);RT(44,80,28);RT(42,75,30); + } + RingingTones[0].menu=30; /* How many ringtones in phone */ + } + if (!strcmp(model,"NSM-1")) //6150 + { + RT( 2,18, 1);RT( 3,19, 2);RT( 7,23, 3);RT( 6,22, 4); + RT( 4,20, 5);RT( 5,21, 6);RT(15,35, 7);RT(12,30, 8); + RT( 9,25, 9);RT(20,47,10);RT( 8,24,11);RT(11,27,12); + RT(10,26,13);RT(34,60,14);RT(33,58,15);RT(35,61,16); + RT(16,36,17);RT(13,32,18);RT(19,43,19);RT(18,39,20); + RT(24,49,21);RT(31,56,22);RT(25,50,23);RT(27,52,24); + RT(26,51,25);RT(28,53,26);RT(29,54,27);RT(30,55,28); + RT(39,71,29);RT(37,68,30);RT(47,57,31);RT(23,48,32); + RT(38,70,33);RT(36,67,34);RT(41,73,35); + /*uploadable ringtone*/ + RT( 1,17,36); + RingingTones[0].menu=36; /* How many ringtones in phone */ + } + if (!strcmp(model,"NPE-3")) //6210 + { + RT(19,64, 1);RT( 2,65, 2);RT( 3,66, 3);RT(15,67, 4);RT( 6,68, 5); + RT(49,69, 6);RT(50,70, 7);RT( 7,71, 8);RT(35,72, 9);RT(33,73,10); + RT(18,74,11);RT( 5,75,12);RT(51,76,13);RT(52,77,14);RT(53,78,15); + RT(37,79,16);RT(54,80,17);RT(55,81,18);RT(56,82,19);RT(57,83,20); + RT(58,84,21);RT(59,85,22);RT(25,86,23);RT(27,87,24);RT(30,88,25); + RT(39,89,26);RT(24,90,27);RT( 8,91,28);RT(60,92,29);RT(61,93,30); + RT(31,94,31);RT(62,95,32);RT(63,96,33);RT(64,97,34);RT(48,98,35); + /* Uploadable ringtones */ + RT( 1,137,36);RT(65,138,37);RT(66,139,38);RT(67,140,39);RT(68,141,40); + + RingingTones[0].menu=40; /* How many ringtones in phone */ + } + RingingTones[0].code=true; + } +} + +/* returns names from code or number in menu */ +char *RingingToneName(int code, int menu) +{ + int index=1,i; + GSM_Error error; + + if (code==0) + { + while (strcmp(RingingTones[index].name,"")) { + if (RingingTones[index].menu==menu) break; + index++; + } + } else + { + while (strcmp(RingingTones[index].name,"")) { + if (RingingTones[index].code==code) break; + index++; + } + } + + if (!strncmp(RingingTones[index].name,"Uploaded ",9)) { + ringtone.location=atoi(&RingingTones[index].name[10]); + + error=GSM->GetBinRingtone(&ringtone); + + if (error==GE_NONE) return ringtone.name; + if (error==GE_UNKNOWNMODEL) { - for (i = 0; i < HowMany; i++) { - - StartBit = BitUnPackInt(package, StartBit, &q, 3); - switch (q) { - case VolumeInstructionId: - StartBit += 4; - break; - case StyleInstructionId: - StartBit = BitUnPackInt(package,StartBit,&l,2); - l = l >> 3; - break; - case TempoInstructionId: - StartBit = BitUnPackInt(package, StartBit, &l, 5); - l = l >> 3; - ringtone->tempo = BeatsPerMinute[l]; - break; - case ScaleInstructionId: - StartBit = BitUnPackInt(package, StartBit, &scale, 2); - scale = scale >> 6; - break; - case NoteInstructionId: - StartBit = BitUnPackInt(package, StartBit, &l, 4); - - switch (l) { - case Note_C :ringtone->notes[ringtone->NrNotes].note = 0; break; - case Note_Cis :ringtone->notes[ringtone->NrNotes].note = 1; break; - case Note_D :ringtone->notes[ringtone->NrNotes].note = 2; break; - case Note_Dis :ringtone->notes[ringtone->NrNotes].note = 3; break; - case Note_E :ringtone->notes[ringtone->NrNotes].note = 4; break; - case Note_F :ringtone->notes[ringtone->NrNotes].note = 6; break; - case Note_Fis :ringtone->notes[ringtone->NrNotes].note = 7; break; - case Note_G :ringtone->notes[ringtone->NrNotes].note = 8; break; - case Note_Gis :ringtone->notes[ringtone->NrNotes].note = 9; break; - case Note_A :ringtone->notes[ringtone->NrNotes].note = 10; break; - case Note_Ais :ringtone->notes[ringtone->NrNotes].note = 11; break; - case Note_H :ringtone->notes[ringtone->NrNotes].note = 12; break; - default :ringtone->notes[ringtone->NrNotes].note = 255; break; //Pause ? - } + /* In 33x we have normal "Smart Messaging" format */ + if (GetModelFeature (FN_RINGTONES)==F_RING_SM) { - if (ringtone->notes[ringtone->NrNotes].note != 255) - ringtone->notes[ringtone->NrNotes].note = ringtone->notes[ringtone->NrNotes].note + scale*14; - - StartBit = BitUnPackInt(package, StartBit, &duration, 3); - - StartBit = BitUnPackInt(package, StartBit, &spec, 2); - - if (duration==Duration_Full && spec==DottedNote) - ringtone->notes[ringtone->NrNotes].duration=128*3/2; - if (duration==Duration_Full && spec==Length_2_3) - ringtone->notes[ringtone->NrNotes].duration=128*2/3; - if (duration==Duration_Full && spec==NoSpecialDuration) - ringtone->notes[ringtone->NrNotes].duration=128; - if (duration==Duration_1_2 && spec==DottedNote) - ringtone->notes[ringtone->NrNotes].duration=64*3/2; - if (duration==Duration_1_2 && spec==Length_2_3) - ringtone->notes[ringtone->NrNotes].duration=64*2/3; - if (duration==Duration_1_2 && spec==NoSpecialDuration) - ringtone->notes[ringtone->NrNotes].duration=64; - if (duration==Duration_1_4 && spec==DottedNote) - ringtone->notes[ringtone->NrNotes].duration=32*3/2; - if (duration==Duration_1_4 && spec==Length_2_3) - ringtone->notes[ringtone->NrNotes].duration=32*2/3; - if (duration==Duration_1_4 && spec==NoSpecialDuration) - ringtone->notes[ringtone->NrNotes].duration=32; - if (duration==Duration_1_8 && spec==DottedNote) - ringtone->notes[ringtone->NrNotes].duration=16*3/2; - if (duration==Duration_1_8 && spec==Length_2_3) - ringtone->notes[ringtone->NrNotes].duration=16*2/3; - if (duration==Duration_1_8 && spec==NoSpecialDuration) - ringtone->notes[ringtone->NrNotes].duration=16; - if (duration==Duration_1_16 && spec==DottedNote) - ringtone->notes[ringtone->NrNotes].duration=8*3/2; - if (duration==Duration_1_16 && spec==Length_2_3) - ringtone->notes[ringtone->NrNotes].duration=8*2/3; - if (duration==Duration_1_16 && spec==NoSpecialDuration) - ringtone->notes[ringtone->NrNotes].duration=8; - if (duration==Duration_1_32 && spec==DottedNote) - ringtone->notes[ringtone->NrNotes].duration=4*3/2; - if (duration==Duration_1_32 && spec==Length_2_3) - ringtone->notes[ringtone->NrNotes].duration=4*2/3; - if (duration==Duration_1_32 && spec==NoSpecialDuration) - ringtone->notes[ringtone->NrNotes].duration=4; - - if (ringtone->NrNotes==MAX_RINGTONE_NOTES) break; + i=7; + if (ringtone.frame[9]==0x4a && ringtone.frame[10]==0x3a) i=8; + ringtone.frame[i]=0x02; - ringtone->NrNotes++; - break; - default: - dprintf("Unsupported block\n"); - return GE_SUBFORMATNOTSUPPORTED; - } - } + GSM_UnPackRingtone(&SMringtone, ringtone.frame+i, ringtone.length-i); - return GE_NONE; + return SMringtone.name; + } + } + } + + return RingingTones[index].name; } +/* returns code from number in menu */ +int RingingToneCode(int menu) +{ + int index=1; + + while ( RingingTones[index].menu!=menu) index++; -GSM_Error GSM_ReadRingtoneFromSMS(GSM_SMSMessage *message, GSM_Ringtone *ringtone) + return RingingTones[index].code; +} + +/* returns number in menu from code */ +int RingingToneMenu(int code) { - if (message->UDH[0].Type==SMS_Ringtone) { - return GSM_UnPackRingtone(ringtone, message->MessageText, message->Length); - } else return GE_SUBFORMATNOTSUPPORTED; + int index=1; + + while ( RingingTones[index].code!=code) index++; + + return RingingTones[index].menu; } +int NumberOfRingtones() +{ + return RingingTones[0].menu; +} -int GSM_SaveRingtoneToSMS(GSM_SMSMessage *message, GSM_Ringtone *ringtone) +int GSM_SaveRingtoneToSMS(GSM_MultiSMSMessage *SMS, + GSM_Ringtone *ringtone, bool profilestyle) { - int i, j = GSM_MAX_8BIT_SMS_LENGTH; - - char UserDataHeader[7]= { 0x06, /* User Data Header Length */ - 0x05, /* IEI: application port addressing scheme, 16 bit address */ - 0x04, /* IEDL (IED length ?) */ - 0x15, /* destination address: high byte */ - 0x81, /* destination address: low byte */ - 0x15, /* originator address: high byte */ - 0x81}; /* originator address: low byte */ - - /* Default settings for SMS message: - - no delivery report - - Class Message 1 - - no compression - - 8 bit data - - SMSC no. 1 - - validity 3 days - - set UserDataHeaderIndicator - */ - - message->Type = SMS_Sent; - - /* Data Coding Scheme */ - message->DCS.Type = SMS_GeneralDataCoding; - message->DCS.u.General.Class = 2; - message->DCS.u.General.Compressed = false; - message->DCS.u.General.Alphabet = SMS_8bit; - - message->MessageCenter.No = 1; - message->Validity.VPF = SMS_RelativeFormat; - message->Validity.u.Relative = 4320; /* 4320 minutes == 72 hours */ - message->ReplyViaSameSMSC = false; - - message->UDH_No = 1; - message->UDH[0].Type = SMS_Ringtone; + int i, j; + unsigned char MessageBuffer[GSM_MAX_SMS_8_BIT_LENGTH*4]; + unsigned char MessageBuffer2[GSM_MAX_SMS_8_BIT_LENGTH*4]; + int MessageLength; + GSM_UDH UDHType; - message->Length = j; - - memcpy(message->MessageText, UserDataHeader, 7); - i = GSM_PackRingtone(ringtone, message->MessageText + 7, &j); - - return i; + EncodeUDHHeader(MessageBuffer, GSM_RingtoneUDH); + MessageLength=GSM_MAX_SMS_8_BIT_LENGTH-(MessageBuffer[0]+1); + i=GSM_PackRingtone(ringtone, MessageBuffer, &MessageLength); + + if (i!=ringtone->NrNotes && profilestyle) + { + MessageLength=0; + MessageBuffer[MessageLength++]=0x30; //SM version. Here 3.0 + MessageBuffer[MessageLength++]=SM30_RINGTONE; //ID for ringtone + + MessageBuffer[MessageLength++]=0x01; //length hi.Later changed + MessageBuffer[MessageLength++]=0x00; //length lo.Later changed + + j=SM30_MAX_RINGTONE_FRAME_LENGTH; + i=GSM_PackRingtone(ringtone, MessageBuffer2, &j); + MessageLength=MessageLength+j; + memcpy(MessageBuffer+4,MessageBuffer2,j); + + MessageBuffer[2]=j/256; + MessageBuffer[3]=j%256; + + UDHType=GSM_ProfileUDH; + } else + UDHType=GSM_RingtoneUDH; + + GSM_MakeMultiPartSMS2(SMS,MessageBuffer,MessageLength, UDHType, GSM_Coding_Default); + + return i; } diff --git a/common/gsm-sms.c b/common/gsm-sms.c index 6006de5..5a35034 100644 --- a/common/gsm-sms.c +++ b/common/gsm-sms.c @@ -1,781 +1,1020 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 2001 Pawe³ Kot - Released under the terms of the GNU GPL, see file COPYING for more details. - - Library for parsing and creating Short Messages (SMS). - + */ +#include #include #include +#include +#include -#include "gsm-common.h" -#include "gsm-encoding.h" -#include "gsm-bitmaps.h" - -SMSMessage_PhoneLayout layout; -static SMSMessage_Layout llayout; - -struct udh_data { - unsigned int length; - char *header; -}; +#include "gsm-api.h" +#include "gsm-coding.h" /* User data headers */ -static struct udh_data headers[] = { - { 0x00, "" }, - { 0x05, "\x00\x03\x01\x00\x00" }, /* Concatenated messages */ - { 0x06, "\x05\x04\x15\x82\x00\x00" }, /* Operator logos */ - { 0x06, "\x05\x04\x15\x83\x00\x00" }, /* Caller logos */ - { 0x06, "\x05\x04\x15\x81\x00\x00" }, /* Ringtones */ - { 0x04, "\x03\x01\x00\x00" }, /* Voice Messages */ - { 0x04, "\x03\x01\x01\x00" }, /* Fax Messages */ - { 0x04, "\x03\x01\x02\x00" }, /* Email Messages */ - { 0x06, "\x05\x04\x23\xf4\x00\x00" }, /* Business Card */ - { 0x00, "" } +GSM_UDHHeader UDHHeaders[] = { + { GSM_ConcatenatedMessages, 0x05, "\x00\x03\x01\x00\x00" }, + /* See GSM 03.40 section 9.2.3.24.1 */ + { GSM_DisableVoice, 0x04, "\x01\x02\x00\x00" }, + { GSM_DisableFax, 0x04, "\x01\x02\x01\x00" }, + { GSM_DisableEmail, 0x04, "\x01\x02\x02\x00" }, + { GSM_EnableVoice, 0x04, "\x01\x02\x00\x01" }, + { GSM_EnableFax, 0x04, "\x01\x02\x01\x01" }, + { GSM_EnableEmail, 0x04, "\x01\x02\x02\x01" }, + /* See GSM 03.40 section 9.2.3.24.2 for voice, fax and email messages */ + { GSM_VoidSMS, 0x08, "\x01\x02\x02\x01\x01\x02\x02\x00" }, + /* When send such SMS to some phones, they don't display anything, + only beep and enable vibra/light */ + { GSM_BugSMS, 0x09, "\x01\x02\x02\x01\x01\x02\x02\x00\xc0" }, + + /* Short Smart Messaging UDH */ + /* General format: */ + /* 1 byte 0x05 : IEI application port addressing scheme, 16 bit address */ + /* 1 byte 0x04 : IEI length */ + /* 2 bytes : destination address: high & low byte */ + /* 2 bytes 0x00 0x00: originator address: high & low byte */ + { GSM_RingtoneUDH, 0x06, "\x05\x04\x15\x81\x00\x00" }, + { GSM_OpLogo, 0x06, "\x05\x04\x15\x82\x00\x00" }, + { GSM_CallerIDLogo, 0x06, "\x05\x04\x15\x83\x00\x00" }, + { GSM_WAPBookmarkUDH, 0x06, "\x05\x04\xc3\x4f\x00\x00" }, + + /* Long Smart Messaging UDH */ + /* General format: */ + /* 1 byte 0x05 : IEI application port addressing scheme, 16 bit address */ + /* 1 byte 0x04 : IEI length */ + /* 2 bytes 0x00 0x00: destination address: high & low byte */ + /* 2 bytes 0x00 0x00: originator address: high & low byte */ + /* 1 byte 0x00 : null byte for end first part ? */ + /* 1 byte 0x03 : length for rest ? */ + /* 1 byte */ + /* 1 byte : number of all SMS */ + /* 1 byte : number of current SMS */ + { GSM_CalendarNoteUDH, 0x0b, "\x05\x04\x00\xe4\x00\x00\x00\x03\xc7\x00\x00" }, //from 3310 ? + { GSM_CalendarNoteUDH2, 0x0b, "\x05\x04\x23\xf5\x00\x00\x00\x03\x01\x00\x00" }, //from 6210 or 9210 Note: last 0x01 changes according to note type + { GSM_ProfileUDH, 0x0b, "\x05\x04\x15\x8a\x00\x00\x00\x03\xce\x00\x00" }, + { GSM_WAPBookmarkUDH, 0x0b, "\x05\x04\xc3\x4f\x00\x00\x00\x03\x01\x00\x00" },//note last 0x01 can change + { GSM_WAPSettingsUDH, 0x0b, "\x05\x04\xc3\x4f\x00\x00\x00\x03\x7f\x00\x00" }, + { GSM_PhonebookUDH, 0x0b, "\x05\x04\x23\xf4\x00\x00\x00\x03\x01\x00\x00" }, + + { GSM_NoUDH, 0x00, "" } }; +#define ByteMask ((1 << Bits) - 1) -/*** - *** Util functions - ***/ - -/* This function implements packing of numbers (SMS Center number and - destination number) for SMS sending function. */ -int SemiOctetPack(char *Number, unsigned char *Output, SMS_NumberType type) +int GSM_PackSevenBitsToEight(int offset, unsigned char *input, unsigned char *output) { - unsigned char *IN = Number; /* Pointer to the input number */ - unsigned char *OUT = Output; /* Pointer to the output */ - int count = 0; /* This variable is used to notify us about count of already - packed numbers. */ - - /* The first byte in the Semi-octet representation of the address field is - the Type-of-Address. This field is described in the official GSM - specification 03.40 version 6.1.0, section 9.1.2.5, page 33. We support - only international and unknown number. */ - - *OUT++ = type; - if (type == SMS_International) IN++; /* Skip '+' */ - if ((type == SMS_Unknown) && (*IN == '+')) IN++; /* Optional '+' in Unknown number type */ - - /* The next field is the number. It is in semi-octet representation - see - GSM scpecification 03.40 version 6.1.0, section 9.1.2.3, page 31. */ - while (*IN) { - if (count & 0x01) { - *OUT = *OUT | ((*IN - '0') << 4); - OUT++; - } - else - *OUT = *IN - '0'; - count++; IN++; - } - - /* We should also fill in the most significant bits of the last byte with - 0x0f (1111 binary) if the number is represented with odd number of - digits. */ - if (count & 0x01) { - *OUT = *OUT | 0xf0; - OUT++; - } - - return (2 * (OUT - Output - 1) - (count % 2)); + unsigned char *OUT = output; /* Current pointer to the output buffer */ + unsigned char *IN = input; /* Current pointer to the input buffer */ + int Bits; /* Number of bits directly copied to + the output buffer */ + Bits = (7 + offset) % 8; + + /* If we don't begin with 0th bit, we will write only a part of the + first octet */ + if (offset) { + *OUT = 0x00; + OUT++; + } + + while ((IN - input) < strlen(input)) { + unsigned char Byte = EncodeWithDefaultAlphabet(*IN); + + *OUT = Byte >> (7 - Bits); + /* If we don't write at 0th bit of the octet, we should write + a second part of the previous octet */ + if (Bits != 7) + *(OUT-1) |= (Byte & ((1 << (7-Bits)) - 1)) << (Bits+1); + + Bits--; + + if (Bits == -1) Bits = 7; + else OUT++; + + IN++; + } + return (OUT - output); } -char *GetBCDNumber(u8 *Number) +int GSM_UnpackEightBitsToSeven(int offset, int in_length, int out_length, + unsigned char *input, unsigned char *output) { - static char Buffer[20] = ""; - int length = Number[0]; /* This is the length of BCD coded number */ - int count, Digit; - - memset(Buffer, 0, 20); - switch (Number[1]) { - case SMS_Alphanumeric: - Unpack7BitCharacters(0, length, length, Number+2, Buffer); - Buffer[length] = 0; - break; - case SMS_International: - sprintf(Buffer, "+"); - case SMS_Unknown: - case SMS_National: - case SMS_Network: - case SMS_Subscriber: - case SMS_Abbreviated: - default: - for (count = 0; count < length - 1; count++) { - Digit = Number[count+2] & 0x0f; - if (Digit < 10) sprintf(Buffer, "%s%d", Buffer, Digit); - Digit = Number[count+2] >> 4; - if (Digit < 10) sprintf(Buffer, "%s%d", Buffer, Digit); - } - break; - } - return Buffer; + unsigned char *OUT = output; /* Current pointer to the output buffer */ + unsigned char *IN = input; /* Current pointer to the input buffer */ + unsigned char Rest = 0x00; + int Bits; + + Bits = offset ? offset : 7; + + while ((IN - input) < in_length) { + + *OUT = ((*IN & ByteMask) << (7 - Bits)) | Rest; + Rest = *IN >> Bits; + + /* If we don't start from 0th bit, we shouldn't go to the + next char. Under *OUT we have now 0 and under Rest - + _first_ part of the char. */ + if ((IN != input) || (Bits == 7)) OUT++; + IN++; + + if ((OUT - output) >= out_length) break; + + /* After reading 7 octets we have read 7 full characters but + we have 7 bits as well. This is the next character */ + if (Bits == 1) { + *OUT = Rest; + OUT++; + Bits = 7; + Rest = 0x00; + } else { + Bits--; + } + } + + return OUT - output; } -static char *PrintDateTime(u8 *Number) -{ - static char Buffer[23] = ""; - - memset(Buffer, 0, 23); - if (Number[0] < 70) sprintf(Buffer, "20"); - else sprintf(Buffer, "19"); - sprintf(Buffer, "%s%d%d-", Buffer, Number[0] & 0x0f, Number[0] >> 4); - sprintf(Buffer, "%s%d%d-", Buffer, Number[1] & 0x0f, Number[1] >> 4); - sprintf(Buffer, "%s%d%d ", Buffer, Number[2] & 0x0f, Number[2] >> 4); - sprintf(Buffer, "%s%d%d:", Buffer, Number[3] & 0x0f, Number[3] >> 4); - sprintf(Buffer, "%s%d%d:", Buffer, Number[4] & 0x0f, Number[4] >> 4); - sprintf(Buffer, "%s%d%d", Buffer, Number[5] & 0x0f, Number[5] >> 4); - if (Number[6] & 0x08) - sprintf(Buffer, "%s-", Buffer); - else - sprintf(Buffer, "%s+", Buffer); - sprintf(Buffer, "%s%02d00", Buffer, (10 * (Number[6] & 0x07) + (Number[6] >> 4)) / 4); - - return Buffer; +/* This function implements packing of numbers (SMS Center number and + destination number) for SMS sending function. */ +/* See GSM 03.40 9.1.1: + 1 byte - length of number given in semioctets or bytes (when given in bytes, + includes one byte for byte with number format. + Returned by function (set semioctet to true, if want result + in semioctets). + 1 byte - format of number. See GSM_NumberType; in gsm-common.h. Returned + in u8 *Output. + n bytes - 2n or 2n-1 semioctets with number. For some types of numbers + in the most significant bits of the last byte with 0x0f + (1111 binary) are filled if the number is represented + with odd number of digits. Returned in u8 *Output. */ +/* 1 semioctet = 4 bits = half of byte */ +int GSM_PackSemiOctetNumber(u8 *Number, u8 *Output, bool semioctet) { + + u8 *IN=Number; /* Pointer to the input number */ + u8 *OUT=Output; /* Pointer to the output */ + int length=0,j; + unsigned char format=GNT_UNKNOWN; // format of number used by us + + /* Checking for format number */ + while (*IN) { + if (length==0 && *IN=='+') + format=GNT_INTERNATIONAL; // first byte is '+'. It can be international + else { + if (*IN>'9' || *IN<'0') { + format=GNT_ALPHANUMERIC; //char is not number. It must be alphanumeric + } + } + IN++;length++; + } + + /* Now we return to first byte */ + for (j=0;jYear = 10 * (Number[0] & 0x0f) + (Number[0] >> 4); - if (dt->Year < 70) dt->Year += 2000; - else dt->Year += 1900; - dt->Month = 10 * (Number[1] & 0x0f) + (Number[1] >> 4); - dt->Day = 10 * (Number[2] & 0x0f) + (Number[2] >> 4); - dt->Hour = 10 * (Number[3] & 0x0f) + (Number[3] >> 4); - dt->Minute = 10 * (Number[4] & 0x0f) + (Number[4] >> 4); - dt->Second = 10 * (Number[5] & 0x0f) + (Number[5] >> 4); - dt->Timezone = (10 * (Number[6] & 0x07) + (Number[6] >> 4)) / 4; - if (Number[6] & 0x08) dt->Timezone = -dt->Timezone; - - return dt; -} +char *GSM_UnpackSemiOctetNumber(u8 *Number, bool semioctet) { -/*** - *** ENCODING SMS - ***/ + static char Buffer[20]=""; + int length=Number[0]; -static GSM_Error EncodeData(GSM_SMSMessage *SMS, char *dcs, char *message) -{ - SMS_AlphabetType al; - unsigned short length = strlen(SMS->MessageText); - - switch (SMS->DCS.Type) { - case SMS_GeneralDataCoding: - switch (SMS->DCS.u.General.Class) { - case 1: dcs[0] |= 0xf0; break; - case 2: dcs[0] |= 0xf1; break; - case 3: dcs[0] |= 0xf2; break; - case 4: dcs[0] |= 0xf3; break; - default: break; - } - if (SMS->DCS.u.General.Compressed) { - /* Compression not supported yet */ - /* dcs[0] |= 0x20; */ - } - al = SMS->DCS.u.General.Alphabet; - break; - case SMS_MessageWaiting: - al = SMS->DCS.u.MessageWaiting.Alphabet; - if (SMS->DCS.u.MessageWaiting.Discard) dcs[0] |= 0xc0; - else if (SMS->DCS.u.MessageWaiting.Alphabet == SMS_UCS2) dcs[0] |= 0xe0; - else dcs[0] |= 0xd0; + if (semioctet) { + /* Convert number of semioctets to number of chars */ + if (length % 2) length++; + length=length / 2 + 1; + } + + length--; //without leading byte with format of number - if (SMS->DCS.u.MessageWaiting.Active) dcs[0] |= 0x08; - dcs[0] |= (SMS->DCS.u.MessageWaiting.Type & 0x03); + switch (Number[1]) { + case GNT_ALPHANUMERIC: + GSM_UnpackEightBitsToSeven(0, length, length, Number+2, Buffer); + Buffer[length]=0; + break; - break; - default: - return GE_SMSWRONGFORMAT; - } - switch (al) { - case SMS_DefaultAlphabet: - Pack7BitCharacters((7 - (SMS->UDH_Length % 7)) % 7, SMS->MessageText, message); - SMS->Length = 8 * SMS->UDH_Length + (7 - (SMS->UDH_Length % 7)) % 7 + length; - break; - case SMS_8bit: - dcs[0] |= 0xf4; - memcpy(message, SMS->MessageText + 1, SMS->MessageText[0]); - SMS->Length = SMS->UDH_Length + SMS->MessageText[0]; - break; - case SMS_UCS2: - dcs[0] |= 0x08; - EncodeUnicode(message, SMS->MessageText, length); - SMS->Length = length; - break; - default: - return GE_SMSWRONGFORMAT; - } - return GE_NONE; + case GNT_INTERNATIONAL: + Buffer[0]='+'; + DecodeBCD (Buffer+1, Number+2, length); + break; + + default: + DecodeBCD (Buffer, Number+2, length); + break; + } + + return Buffer; } -/* This function encodes the UserDataHeader as described in: - - GSM 03.40 version 6.1.0 Release 1997, section 9.2.3.24 - - Smart Messaging Specification, Revision 1.0.0, September 15, 1997 -*/ -static GSM_Error EncodeUDH(SMS_UDHInfo UDHi, char *UDH) +/* See GSM 03.40 section 9.2.3.11 */ +GSM_Error GSM_EncodeSMSDateTime(GSM_DateTime *DT, unsigned char *req) { - unsigned char pos; +#ifdef DEBUG + fprintf(stdout,_("Date & time in saved SMS: %02i/%02i/%04i %02i:%02i:%02i\n"), + DT->Day,DT->Month,DT->Year,DT->Hour,DT->Minute,DT->Second); +#endif + + req[0]=EncodeWithBCDAlphabet(DT->Year); + req[1]=EncodeWithBCDAlphabet(DT->Month); + req[2]=EncodeWithBCDAlphabet(DT->Day); + req[3]=EncodeWithBCDAlphabet(DT->Hour); + req[4]=EncodeWithBCDAlphabet(DT->Minute); + req[5]=EncodeWithBCDAlphabet(DT->Second); + + /* FIXME: do it */ + req[6]=0; /* TimeZone = +-0 */ + + return GE_NONE; +} - pos = UDH[0]; - switch (UDHi.Type) { - case SMS_NoUDH: - break; - case SMS_VoiceMessage: - case SMS_FaxMessage: - case SMS_EmailMessage: - UDH[pos+4] = UDHi.u.SpecialSMSMessageIndication.MessageCount; - if (UDHi.u.SpecialSMSMessageIndication.Store) UDH[pos+3] |= 0x80; - case SMS_ConcatenatedMessages: - case SMS_OpLogo: - case SMS_CallerIDLogo: - case SMS_Ringtone: - UDH[0] += headers[UDHi.Type].length; - memcpy(UDH+pos+1, headers[UDHi.Type].header, headers[UDHi.Type].length); - break; - default: - dprintf("Not supported User Data Header type\n"); - break; - } - return GE_NONE; +/* See GSM 03.40 section 9.2.3.11 */ +GSM_Error GSM_DecodeSMSDateTime(GSM_DateTime *DT, unsigned char *req) +{ + DT->Year = DecodeWithBCDAlphabet(req[0]); + DT->Month = DecodeWithBCDAlphabet(req[1]); + DT->Day = DecodeWithBCDAlphabet(req[2]); + DT->Hour = DecodeWithBCDAlphabet(req[3]); + DT->Minute = DecodeWithBCDAlphabet(req[4]); + DT->Second = DecodeWithBCDAlphabet(req[5]); + + DT->Timezone=(10*(req[6]&0x07)+(req[6]>>4))/4; + if (req[6]&0x08) DT->Timezone = -DT->Timezone; + +#ifdef DEBUG + fprintf(stdout, _("%d%d-"), req[0]&0xf, req[0]>>4); + fprintf(stdout, _("%d%d-"), req[1]&0xf, req[1]>>4); + fprintf(stdout, _("%d%d "), req[2]&0xf, req[2]>>4); + fprintf(stdout, _("%d%d:"), req[3]&0xf, req[3]>>4); + fprintf(stdout, _("%d%d:"), req[4]&0xf, req[4]>>4); + fprintf(stdout, _("%d%d "), req[5]&0xf, req[5]>>4); + + if (req[6]) { + if (req[6] & 0x08) fprintf(stdout, "-"); + else fprintf(stdout, "+"); + + fprintf(stdout, _("%02d00"), (10*(req[6]&0x07)+(req[6]>>4))/4); + } + + fprintf(stdout, "\n"); +#endif + + return GE_NONE; } -static GSM_Error EncodeSMSSubmitHeader(GSM_SMSMessage *SMS, char *frame) +int GSM_EncodeETSISMSSubmitData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI) { - GSM_Error error = GE_NONE; - - /* Standard Header: */ - memcpy(frame + llayout.UserDataHeader, "\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x00\x00\x00", 24); - - /* Reply Path */ - if (llayout.ReplyViaSameSMSC > -1) { - if (SMS->ReplyViaSameSMSC) frame[llayout.ReplyViaSameSMSC] |= 0x80; - } - - /* User Data Header Indicator */ - if (llayout.UserDataHeader > -1) { - if (SMS->UDH_No) frame[llayout.UserDataHeader] |= 0x40; - } - - /* Status (Delivery) Report Request */ - if (llayout.Report > -1) { - if (SMS->Report) frame[llayout.Report] |= 0x20; - } - - /* Validity Period Format: mask - 0x00, 0x10, 0x08, 0x18 */ - if (llayout.Validity > -1) { - frame[llayout.Validity] |= ((SMS->Validity.VPF & 0x03) << 3); - } - - /* Reject Duplicates */ - if (llayout.RejectDuplicates > -1) { - if (SMS->RejectDuplicates) frame[llayout.RejectDuplicates] |= 0x04; - } - - /* Message Type is already set */ - - /* Message Reference */ - /* Can we set this? */ - - /* Protocol Identifier */ - /* FIXME: allow to change this in better way. - currently only 0x5f == `Return Call Message' is used */ - if (llayout.PID > -1) { - if (SMS->PID) frame[llayout.PID] = SMS->PID; - } - - /* Data Coding Scheme */ - if (llayout.DataCodingScheme > -1) { - switch (SMS->DCS.Type) { - case SMS_GeneralDataCoding: - if (SMS->DCS.u.General.Compressed) frame[llayout.DataCodingScheme] |= 0x20; - if (SMS->DCS.u.General.Class) frame[llayout.DataCodingScheme] |= (0x10 | (SMS->DCS.u.General.Class - 1)); - frame[llayout.DataCodingScheme] |= ((SMS->DCS.u.General.Alphabet & 0x03) << 2); - break; - case SMS_MessageWaiting: - if (SMS->DCS.u.MessageWaiting.Discard) frame[llayout.DataCodingScheme] |= 0xc0; - else if (SMS->DCS.u.MessageWaiting.Alphabet == SMS_UCS2) frame[llayout.DataCodingScheme] |= 0xe0; - else frame[llayout.DataCodingScheme] |= 0xd0; - if (SMS->DCS.u.MessageWaiting.Active) frame[llayout.DataCodingScheme] |= 0x80; - frame[llayout.DataCodingScheme] |= (SMS->DCS.u.MessageWaiting.Type & 0x03); - break; - default: - dprintf("Wrong Data Coding Scheme (DCS) format\n"); - return GE_SMSWRONGFORMAT; - } - } - - /* Destination Address */ - if (llayout.RemoteNumber > -1) { - frame[llayout.RemoteNumber] = SemiOctetPack(SMS->RemoteNumber.number, frame + llayout.RemoteNumber + 1, SMS->RemoteNumber.type); - } - - /* Validity Period */ - switch (SMS->Validity.VPF) { - case SMS_EnhancedFormat: - break; - case SMS_RelativeFormat: - break; - case SMS_AbsoluteFormat: - break; - default: - break; - } + int off,size=0,size2=0,w,i; + + /* off - length of the user data header */ + off = 0; + + if (SMS->UDHType) { + /* GSM 03.40 section 9.2.3.23 (TP-User-Data-Header-Indicator) */ + ETSI->firstbyte |= 0x40; + + /* off - length of the user data header */ + off = 1 + SMS->UDH[0]; + + /* we copy the udh */ + memcpy(ETSI->MessageText, SMS->UDH, off); + +// if (SMS->UDHType==GSM_HangSMS) ETSI->TPDCS=0x08; //Such SMS hangs phone (5110, 5.07), + //when saved to Outbox atry try to read it + /*from phone's menu*/ + } + + switch (SMS->Coding) { + /* When save SMS to SIM and it's 8 bit SMS, + "Edit" is not displayed in phone menu and + "Message cannot be displayed here" instead of message text */ + case GSM_Coding_8bit: + + /* the mask for the 8-bit data */ + /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */ + ETSI->TPDCS |= 0xf4; + + memcpy(ETSI->MessageText + off, SMS->MessageText, SMS->Length); + + size2 = size = SMS->Length+off; + + break; + + case GSM_Coding_Default: + + w=(7-off)%7; + if (w<0) w=(14-off)%14; + + size = GSM_PackSevenBitsToEight(w, SMS->MessageText, ETSI->MessageText + off); + size += off; + size2 = (off*8 + w) / 7 + strlen(SMS->MessageText); + + break; - return error; + case GSM_Coding_Unicode: + + /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */ + ETSI->TPDCS |= 0x08; + +#ifdef DEBUG + fprintf(stdout,_("SMS Length is %i\n"),strlen(SMS->MessageText)); +#endif + + EncodeUnicode (ETSI->MessageText+off,SMS->MessageText,strlen(SMS->MessageText)); + /* here we code "special" chars */ + for (i=0;iMessageText);i++) { + if (SMS->MessageText[i]=='~') ETSI->MessageText[off+1+i*2]=1; //enables/disables blinking + if (SMS->MessageText[i]=='`') ETSI->MessageText[off+1+i*2]=0; //hides rest ot contents + } + + size=size2=strlen(SMS->MessageText)*2+off; + + break; + } + + /* FIXME: support for compression */ + /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */ + /* See also GSM 03.42 */ + /* if (SMS->Compression) ETSI->TPDCS |= 0x20; */ + + /* SMS->Length is: + - integer representation of the number od octets within the user data when UD is coded using 8bit data + - the sum of the number of septets in UDH including any padding and number of septets in UD in other case */ + /* GSM 03.40 section 9.2.3.16 (TP-User-Data-Length) */ + ETSI->TPUDL = size2; + + return size; } -static GSM_Error EncodeSMSDeliverHeader() +GSM_Error GSM_DecodeETSISMSSubmitData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI) { - return GE_NONE; + int off,w,i,tmp=0; + unsigned char output[161]; + bool UDHOK; + + /* off - length of the user data header */ + off = 0; + + SMS->UDHType = GSM_NoUDH; + + if (ETSI->firstbyte & 64) { /* UDH header available */ + + off = (ETSI->MessageText[0] + 1); /* Length of UDH header */ + + /* Copy UDH header into SMS->UDH */ + for (i = 0; i < off; i++) SMS->UDH[i] = ETSI->MessageText[i]; + +#ifdef DEBUG + fprintf(stdout, " UDH header available (length %i",off); +#endif + + SMS->UDHType = GSM_UnknownUDH; + + i=-1; + while (true) { + i++; + if (UDHHeaders[i].UDHType==GSM_NoUDH) break; + tmp=UDHHeaders[i].Length; + if (tmp==SMS->UDH[0]) { //if length is the same + + if (tmp==0x05) tmp=tmp-2;/*two last bytes can be different for such UDH*/ + if (tmp==0x0b) tmp=tmp-3;/*three last bytes can be different for such UDH*/ + + UDHOK=true; + for (w=0;wUDH[w+1]) { + UDHOK=false; + break; + } + } + if (UDHOK) { + SMS->UDHType=UDHHeaders[i].UDHType; + break; + } + } + } + +#ifdef DEBUG + switch (SMS->UDHType) { + case GSM_ConcatenatedMessages: + fprintf(stdout,_(", concatenated (linked) message %d/%d"),SMS->UDH[5],SMS->UDH[4]);break; + case GSM_DisableVoice: + fprintf(stdout,_(", disables voice indicator"));break; + case GSM_EnableVoice: + fprintf(stdout,_(", enables voice indicator"));break; + case GSM_DisableFax: + fprintf(stdout,_(", disables fax indicator"));break; + case GSM_EnableFax: + fprintf(stdout,_(", enables fax indicator"));break; + case GSM_DisableEmail: + fprintf(stdout,_(", disables email indicator"));break; + case GSM_EnableEmail: + fprintf(stdout,_(", enables email indicator"));break; + case GSM_VoidSMS: + fprintf(stdout,_(", void SMS"));break; + case GSM_WAPBookmarkUDH: + fprintf(stdout,_(", WAP Bookmark"));break; + case GSM_WAPBookmarkUDHLong: + fprintf(stdout,_(", WAP Bookmark, part %i/%i"),SMS->UDH[11],SMS->UDH[10]);break; + case GSM_WAPSettingsUDH: + fprintf(stdout,_(", WAP Settings, part %i/%i"),SMS->UDH[11],SMS->UDH[10]);break; + case GSM_RingtoneUDH: + fprintf(stdout,_(", ringtone"));break; + case GSM_OpLogo: + fprintf(stdout,_(", GSM Operator Logo"));break; + case GSM_CallerIDLogo: + fprintf(stdout,_(", Caller Logo"));break; + case GSM_ProfileUDH: + fprintf(stdout,_(", Profile SMS, part %i/%i"),SMS->UDH[11],SMS->UDH[10]);break; + case GSM_CalendarNoteUDH: + fprintf(stdout,_(", Calendar note SMS, part %i/%i"),SMS->UDH[11],SMS->UDH[10]);break; + case GSM_CalendarNoteUDH2: + fprintf(stdout,_(", Calendar note SMS, part %i/%i"),SMS->UDH[11],SMS->UDH[10]);break; + case GSM_PhonebookUDH: + fprintf(stdout,_(", Phonebook Entry, part %i/%i"),SMS->UDH[11],SMS->UDH[10]);break; + default: + fprintf(stdout,_(", UNKNOWN"));break; + } + + fprintf(stdout, ")\n"); + + hexdump(off,SMS->UDH); +#endif + } + + SMS->Coding = GSM_Coding_Default; + + /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */ + if ((ETSI->TPDCS & 0xf4) == 0xf4) SMS->Coding=GSM_Coding_8bit; + if ((ETSI->TPDCS & 0x08) == 0x08) SMS->Coding=GSM_Coding_Unicode; + + switch (SMS->Coding) { + case GSM_Coding_Default: + w=(7-off)%7; + if (w<0) w=(14-off)%14; + + SMS->Length=ETSI->TPUDL - (off*8 + w) / 7; + + tmp=GSM_UnpackEightBitsToSeven(w,ETSI->TPUDL-off, SMS->Length, ETSI->MessageText+off, output); + +#ifdef DEBUG + fprintf(stdout, " 7 bit SMS, body is (length %i): ",SMS->Length); +#endif /* DEBUG */ + + DecodeDefault (SMS->MessageText, output, tmp); + +#ifdef DEBUG + fprintf(stdout, "%s\n",SMS->MessageText); +#endif + + break; + case GSM_Coding_8bit: + SMS->Length=ETSI->TPUDL - off; + + memcpy(SMS->MessageText,ETSI->MessageText+off,SMS->Length); + +#ifdef DEBUG + fprintf(stdout, " 8 bit SMS, body is (length %i)\n",SMS->Length); + hexdump(SMS->Length,SMS->MessageText); +#endif /* DEBUG */ + + break; + case GSM_Coding_Unicode: + SMS->Length=(ETSI->TPUDL - off) / 2; + +#ifdef DEBUG + fprintf(stdout, " 7 bit SMS, body is (length %i), Unicode coding: ",SMS->Length); + for (i=0; iLength;i++) { + fprintf(stdout, "[%02x %02x]", ETSI->MessageText[off+i*2] , ETSI->MessageText[off+i*2+1]); + } + fprintf(stdout, "\n"); +#endif /* DEBUG */ + + /* here we decode "special" chars */ + for (i=0; iLength;i++) { + if (ETSI->MessageText[off+i*2] ==0x00 && + ETSI->MessageText[off+i*2+1]==0x01) + ETSI->MessageText[off+i*2+1]='~'; //enables/disables blinking + if (ETSI->MessageText[off+i*2] ==0x00 && + ETSI->MessageText[off+i*2+1]==0x00) + ETSI->MessageText[off+i*2+1]='`'; //hides rest ot contents + } + + DecodeUnicode (SMS->MessageText, ETSI->MessageText+off, SMS->Length); + + break; + } + + return GE_NONE; } -static GSM_Error EncodeSMSHeader(GSM_SMSMessage *SMS, char *frame) -/* We can create either SMS DELIVER (for saving in Inbox) or SMS SUBMIT - (for sending or saving in Outbox) message */ +GSM_Error GSM_DecodeETSISMSStatusReportData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI) { - /* Set SMS type */ - switch (SMS->Type) { - case SMS_Submit: /* we send SMS or save it in Outbox */ - return EncodeSMSSubmitHeader(SMS, frame); - case SMS_Deliver: /* we save SMS in Inbox */ - return EncodeSMSDeliverHeader(SMS, frame); - default: /* we don't create other formats of SMS */ - return GE_SMSWRONGFORMAT; - } + /* See GSM 03.40 section 9.2.3.11 (TP-Service-Centre-Time-Stamp) */ +#ifdef DEBUG + fprintf(stdout, _(" SMSC response date: ")); +#endif + GSM_DecodeSMSDateTime(&SMS->SMSCTime, ETSI->SMSCDateTime); + + if (ETSI->TPStatus < 0x03) { + strcpy(SMS->MessageText,_("Delivered")); + +#ifdef DEBUG + /* more detailed reason only for debug */ + /* See GSM 03.40 section 9.2.3.15 (TP-Status) */ + switch (ETSI->TPStatus) { + case 0x00: fprintf(stdout, _(" SM received by the SME"));break; + case 0x01: fprintf(stdout, _(" SM forwarded by the SC to the SME but the SC is unable to confirm delivery"));break; + case 0x02: fprintf(stdout, _(" SM replaced by the SC"));break; + } +#endif /* DEBUG */ + + SMS->Length = 10; + + } else if (ETSI->TPStatus & 0x40) { + + strcpy(SMS->MessageText,_("Failed")); + +#ifdef DEBUG + /* more detailed reason only for debug */ + if (ETSI->TPStatus & 0x20) { + + /* See GSM 03.40 section 9.2.3.15 (TP-Status) */ + fprintf(stdout, _(" Temporary error, SC is not making any more transfer attempts\n")); + switch (ETSI->TPStatus) { + case 0x60: fprintf(stdout, _(" Congestion"));break; + case 0x61: fprintf(stdout, _(" SME busy"));break; + case 0x62: fprintf(stdout, _(" No response from SME"));break; + case 0x63: fprintf(stdout, _(" Service rejected"));break; + case 0x64: fprintf(stdout, _(" Quality of service not available"));break; + case 0x65: fprintf(stdout, _(" Error in SME"));break; + default : fprintf(stdout, _(" Reserved/Specific to SC: %x"),ETSI->TPStatus);break; + } + + } else { + + /* See GSM 03.40 section 9.2.3.15 (TP-Status) */ + fprintf(stdout, _(" Permanent error, SC is not making any more transfer attempts\n")); + switch (ETSI->TPStatus) { + case 0x40: fprintf(stdout, _(" Remote procedure error"));break; + case 0x41: fprintf(stdout, _(" Incompatibile destination"));break; + case 0x42: fprintf(stdout, _(" Connection rejected by SME"));break; + case 0x43: fprintf(stdout, _(" Not obtainable"));break; + case 0x44: fprintf(stdout, _(" Quality of service not available"));break; + case 0x45: fprintf(stdout, _(" No internetworking available"));break; + case 0x46: fprintf(stdout, _(" SM Validity Period Expired"));break; + case 0x47: fprintf(stdout, _(" SM deleted by originating SME"));break; + case 0x48: fprintf(stdout, _(" SM Deleted by SC Administration"));break; + case 0x49: fprintf(stdout, _(" SM does not exist"));break; + default : fprintf(stdout, _(" Reserved/Specific to SC: %x"),ETSI->TPStatus);break; + } + } +#endif /* DEBUG */ + + SMS->Length = 6; + } else if (ETSI->TPStatus & 0x20) { + strcpy(SMS->MessageText,_("Pending")); + +#ifdef DEBUG + /* more detailed reason only for debug */ + /* See GSM 03.40 section 9.2.3.15 (TP-Status) */ + fprintf(stdout, _(" Temporary error, SC still trying to transfer SM\n")); + switch (ETSI->TPStatus) { + case 0x20: fprintf(stdout, _(" Congestion"));break; + case 0x21: fprintf(stdout, _(" SME busy"));break; + case 0x22: fprintf(stdout, _(" No response from SME"));break; + case 0x23: fprintf(stdout, _(" Service rejected"));break; + case 0x24: fprintf(stdout, _(" Quality of service not aviable"));break; + case 0x25: fprintf(stdout, _(" Error in SME"));break; + default : fprintf(stdout, _(" Reserved/Specific to SC: %x"),ETSI->TPStatus);break; + } +#endif /* DEBUG */ + SMS->Length = 7; + } else { + strcpy(SMS->MessageText,_("Unknown")); + +#ifdef DEBUG + /* more detailed reason only for debug */ + fprintf(stdout, _(" Reserved/Specific to SC: %x"),ETSI->TPStatus); +#endif /* DEBUG */ + SMS->Length = 8; + } + +#ifdef DEBUG + fprintf(stdout, _("\n")); +#endif /* DEBUG */ + + return GE_NONE; } -/* This function encodes SMS as described in: - - GSM 03.40 version 6.1.0 Release 1997, section 9 -*/ -int EncodePDUSMS(GSM_SMSMessage *SMS, char *message) +GSM_Error GSM_EncodeETSISMSSubmitHeader(GSM_SMSMessage *SMS,GSM_ETSISMSMessage *ETSI) { - GSM_Error error = GE_NONE; - int i; - - switch (SMS->Type) { - case SMS_Submit: - llayout = layout.Submit; - dprintf("Sending SMS to %s via message center %s\n", SMS->RemoteNumber.number, SMS->MessageCenter.Number); - break; - case SMS_Deliver: - llayout = layout.Deliver; - dprintf("Saving SMS to Inbox\n"); - break; - case SMS_Picture: - llayout = layout.Picture; - dprintf("Sending Picture Message\n"); - break; - case SMS_Delivery_Report: - default: - dprintf("Not supported message type: %d\n", SMS->Type); - return GE_NOTSUPPORTED; - } - - /* SMSC number */ - if (llayout.MessageCenter > -1) { - dprintf("%d %s\n", SMS->MessageCenter.Type, SMS->MessageCenter.Number); - message[llayout.MessageCenter] = SemiOctetPack(SMS->MessageCenter.Number, message + llayout.MessageCenter + 1, SMS->MessageCenter.Type); - if (message[llayout.MessageCenter] % 2) message[llayout.MessageCenter]++; - message[llayout.MessageCenter] = message[llayout.MessageCenter] / 2 + 1; - } - - /* Common Header */ - error = EncodeSMSHeader(SMS, message); - if (error != GE_NONE) return error; - - /* User Data Header - if present */ -// for (i = 0; i < SMS->UDH_No; i++) { -// error = EncodeUDH(SMS->UDH[i], message + 24); -// if (error != GE_NONE) return error; -// } - SMS->UDH_Length = 0; - - /* User Data */ - EncodeData(SMS, message + llayout.DataCodingScheme, message + llayout.UserData + SMS->UDH_Length); - message[llayout.Length] = SMS->Length; - return SMS->Length + llayout.UserData - 1; + GSM_Error error; + + /* First of all we should get SMSC number */ + if (SMS->MessageCenter.No) { + error = GSM->GetSMSCenter(&SMS->MessageCenter); + if (error != GE_NONE) return error; + SMS->MessageCenter.No = 0; + } + +#ifdef DEBUG + fprintf(stdout, _("Packing SMS to \"%s\" via message center \"%s\"\n"), SMS->Destination, SMS->MessageCenter.Number); +#endif /* DEBUG */ + + ETSI->SMSCNumber[0]=GSM_PackSemiOctetNumber(SMS->MessageCenter.Number, ETSI->SMSCNumber+1, false); + + /* GSM 03.40 section 9.2.3.17 (TP-Reply-Path) */ + if (SMS->ReplyViaSameSMSC) ETSI->firstbyte |= 128; + + /* When save to Outbox with SMS Class, "Edit" is not displayed in phone menu + and can forward it to another phone with set class (for example, 0=Flash) */ + /* Message Class*/ + /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */ + if (SMS->Class>=0 && SMS->Class<5) ETSI->TPDCS |= (240+SMS->Class); + + /* When is not set for SMS saved for Inbox, phone displays "Message" instead + of number and doesn't display "Details" info */ + ETSI->Number[0] = GSM_PackSemiOctetNumber(SMS->Destination, ETSI->Number+1, true); + + return GE_NONE; } -/* This function does simple SMS encoding - no PDU coding */ -GSM_Error EncodeTextSMS() +GSM_Error GSM_DecodeETSISMSHeader(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI) { - return GE_NONE; -} +#ifdef DEBUG + fprintf(stdout, _(" SMS center number: %s"), GSM_UnpackSemiOctetNumber(ETSI->SMSCNumber,false)); + if (SMS->folder==0 && (ETSI->firstbyte & 128)!=0) //GST_INBOX + fprintf(stdout, _(" (centre set for reply)")); +#endif -/*** - *** DECODING SMS - ***/ + strcpy(SMS->MessageCenter.Number, GSM_UnpackSemiOctetNumber(ETSI->SMSCNumber,false)); -static GSM_Error SMSStatus(unsigned char status, GSM_SMSMessage *SMS) -{ - if (status < 0x03) { - strcpy(SMS->MessageText, _("Delivered")); - switch (status) { - case 0x00: - dprintf("SM received by the SME"); - break; - case 0x01: - dprintf("SM forwarded by the SC to the SME but the SC is unable to confirm delivery"); - break; - case 0x02: - dprintf("SM replaced by the SC"); - break; - } - SMS->Length = strlen(_("Delivered")); - } else if (status & 0x40) { - - strcpy(SMS->MessageText, _("Failed")); - - /* more detailed reason only for debug */ - - if (status & 0x20) { - dprintf("Temporary error, SC is not making any more transfer attempts\n"); - - switch (status) { - case 0x60: - dprintf("Congestion"); - break; - case 0x61: - dprintf("SME busy"); - break; - case 0x62: - dprintf("No response from SME"); - break; - case 0x63: - dprintf("Service rejected"); - break; - case 0x64: - dprintf("Quality of service not aviable"); - break; - case 0x65: - dprintf("Error in SME"); - break; - default: - dprintf("Reserved/Specific to SC: %x", status); - break; - } - } else { - dprintf("Permanent error, SC is not making any more transfer attempts\n"); - switch (status) { - case 0x40: - dprintf("Remote procedure error"); - break; - case 0x41: - dprintf("Incompatibile destination"); - break; - case 0x42: - dprintf("Connection rejected by SME"); - break; - case 0x43: - dprintf("Not obtainable"); - break; - case 0x44: - dprintf("Quality of service not aviable"); - break; - case 0x45: - dprintf("No internetworking available"); - break; - case 0x46: - dprintf("SM Validity Period Expired"); - break; - case 0x47: - dprintf("SM deleted by originating SME"); - break; - case 0x48: - dprintf("SM Deleted by SC Administration"); - break; - case 0x49: - dprintf("SM does not exist"); - break; - default: - dprintf("Reserved/Specific to SC: %x", status); - break; - } - } - SMS->Length = strlen(_("Failed")); - } else if (status & 0x20) { - strcpy(SMS->MessageText, _("Pending")); - - /* more detailed reason only for debug */ - dprintf("Temporary error, SC still trying to transfer SM\n"); - switch (status) { - case 0x20: - dprintf("Congestion"); - break; - case 0x21: - dprintf("SME busy"); - break; - case 0x22: - dprintf("No response from SME"); - break; - case 0x23: - dprintf("Service rejected"); - break; - case 0x24: - dprintf("Quality of service not aviable"); - break; - case 0x25: - dprintf("Error in SME"); - break; - default: - dprintf("Reserved/Specific to SC: %x", status); - break; - } - SMS->Length = strlen(_("Pending")); - } else { - strcpy(SMS->MessageText, _("Unknown")); - - /* more detailed reason only for debug */ - dprintf("Reserved/Specific to SC: %x", status); - SMS->Length = strlen(_("Unknown")); - } - dprintf("\n"); - return GE_NONE; + SMS->ReplyViaSameSMSC=false; + if ((ETSI->firstbyte & 128)!=0) SMS->ReplyViaSameSMSC=true; + +#ifdef DEBUG + fprintf(stdout, _("\n Remote number (recipient or sender): %s\n"), GSM_UnpackSemiOctetNumber(ETSI->Number,true)); +#endif + + strcpy(SMS->Sender, GSM_UnpackSemiOctetNumber(ETSI->Number,true)); + + return GE_NONE; } -static GSM_Error DecodeData(char *message, char *output, int length, int size, int udhlen, SMS_DataCodingScheme dcs) +/* FIXME: we should allow for all validity formats */ +GSM_Error GSM_EncodeETSISMSSubmitValidity(GSM_SMSMessage *SMS,GSM_ETSISMSMessage *ETSI) { - /* Unicode */ - if ((dcs.Type & 0x08) == 0x08) { - dprintf("Unicode message\n"); - length = (length - udhlen)/2; - DecodeUnicode(output, message, length); - } else { - /* 8bit SMS */ - if ((dcs.Type & 0xf4) == 0xf4) { - dprintf("8bit message\n"); - memcpy(output, message, length); - /* 7bit SMS */ - } else { - dprintf("Default Alphabet\n"); - length = length - (udhlen * 8 + ((7-(udhlen%7))%7)) / 7; - Unpack7BitCharacters((7-udhlen)%7, size, length, message, output); - DecodeAscii(output, output, length); - } - } - dprintf("%s\n", output); - return GE_NONE; + /* GSM 03.40 section 9.2.3.3 (TP-Validity-Period-Format) */ + /* Bits 4 and 3: 10. TP-VP field present and integer represent (relative) */ + ETSI->firstbyte |= 0x10; + + /* GSM 03.40 section 9.2.3.12 (TP-Validity Period) */ + /* FIXME: error-checking for correct Validity - it should not be bigger then + 63 weeks and smaller then 5minutes. We should also test intervals because + the SMS->Validity to TP-VP is not continuos. I think that the simplest + solution will be an array of correct values. We should parse it and if we + find the closest TP-VP value we should use it. Or is it good to take + closest smaller TP-VP as we do now? I think it is :-) */ + + /* 5 minutes intervals up to 12 hours = 720 minutes */ + if (SMS->Validity <= 720) + ETSI->TPVP = (unsigned char) (SMS->Validity/5)-1; + + /* 30 minutes intervals up to 1 day */ + else if ((SMS->Validity > 720) && (SMS->Validity <= 1440)) + ETSI->TPVP = (unsigned char) ((SMS->Validity-720)/30)+143; + + /* 1 day intervals up to 30 days */ + else if ((SMS->Validity > 1440) && (SMS->Validity <= 43200)) + ETSI->TPVP = (unsigned char) (SMS->Validity/1440)+166; + + /* 1 week intervals up to 63 weeks */ + else if ((SMS->Validity > 43200) && (SMS->Validity <= 635040)) + ETSI->TPVP = (unsigned char) (SMS->Validity/10080)+192; + + return GE_NONE; } -/* This function decodes UDH as described in: - - GSM 03.40 version 6.1.0 Release 1997, section 9.2.3.24 - - Smart Messaging Specification, Revision 1.0.0, September 15, 1997 -*/ -static GSM_Error DecodeUDH(char *message, GSM_SMSMessage *SMS) +/* FIXME: do we need more than SMS_Submit and SMS_Deliver ? */ +GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_MessageType PDU, int *length) { - unsigned char length, pos, nr; - - SMS->UDH_Length = length = message[0] + 1; - pos = 1; - nr = 0; - while (length > 1) { - unsigned char udh_length; - - udh_length = message[pos+1]; - switch (message[pos]) { - case 0x00: // Concatenated short messages - dprintf("Concatenated messages\n"); - SMS->UDH[nr].Type = SMS_ConcatenatedMessages; - SMS->UDH[nr].u.ConcatenatedShortMessage.ReferenceNumber = message[pos + 2]; - SMS->UDH[nr].u.ConcatenatedShortMessage.MaximumNumber = message[pos + 3]; - SMS->UDH[nr].u.ConcatenatedShortMessage.CurrentNumber = message[pos + 4]; - break; - case 0x01: // Special SMS Message Indication - switch (message[pos + 2] & 0x03) { - case 0x00: - dprintf("Voice Message\n"); - SMS->UDH[nr].Type = SMS_VoiceMessage; - break; - case 0x01: - dprintf("Fax Message\n"); - SMS->UDH[nr].Type = SMS_FaxMessage; - break; - case 0x02: - dprintf("Email Message\n"); - SMS->UDH[nr].Type = SMS_EmailMessage; - break; - default: - dprintf("Unknown\n"); - SMS->UDH[nr].Type = SMS_UnknownUDH; - break; - } - SMS->UDH[nr].u.SpecialSMSMessageIndication.Store = (message[pos + 2] & 0x80) >> 7; - SMS->UDH[nr].u.SpecialSMSMessageIndication.MessageCount = message[pos + 3]; - break; - case 0x04: // Application port addression scheme, 8 bit address - break; - case 0x05: // Application port addression scheme, 16 bit address - switch (((0x00ff & message[pos + 2]) << 8) | (0x00ff & message[pos + 3])) { - case 0x1581: - dprintf("Ringtone\n"); - SMS->UDH[nr].Type = SMS_Ringtone; - break; - case 0x1582: - dprintf("Operator Logo\n"); - SMS->UDH[nr].Type = SMS_OpLogo; - break; - case 0x1583: - dprintf("Caller Icon\n"); - SMS->UDH[nr].Type = SMS_CallerIDLogo; - break; - case 0x23f4: - dprintf("Business Card\n"); - SMS->UDH[nr].Type = SMS_BusinessCard; - break; - default: - dprintf("Unknown\n"); - SMS->UDH[nr].Type = SMS_UnknownUDH; - break; - } - break; - case 0x06: // SMSC Control Parameters - break; - case 0x07: // UDH Source Indicator - break; - default: - dprintf("Not supported UDH\n"); - break; - } - length -= (udh_length + 2); - pos += (udh_length + 2); - nr++; - } - SMS->UDH_No = nr; + int size=0; - return GE_NONE; + ETSI->firstbyte=0; + ETSI->TPPID=0; + ETSI->TPDCS=0; + ETSI->TPUDL=0; + ETSI->TPStatus=0; + ETSI->TPVP=0; + + switch (PDU) { + case SMS_Submit: + + /* GSM 03.40 section 9.2.3.1 (TP-Message-Type-Indicator) */ + /* Bits 1 and 0: 01. SMS-Submit */ + ETSI->firstbyte |= 0x01; + + /* GSM 03.40 section 9.2.3.5 (TP-Status-Raport-Request) */ + /* Mask for request for delivery report from SMSC */ + if (SMS->Type == GST_DR) ETSI->firstbyte |= 32; + + GSM_EncodeETSISMSSubmitHeader(SMS, ETSI); + GSM_EncodeETSISMSSubmitValidity(SMS, ETSI); + size=GSM_EncodeETSISMSSubmitData(SMS, ETSI); + + break; + case SMS_Deliver: + + /* GSM 03.40 section 9.2.3.1 (TP-Message-Type-Indicator) */ + /* Bits 1 and 0: 00. SMS-Deliver */ + ETSI->firstbyte |= 0x00; + + GSM_EncodeETSISMSSubmitHeader(SMS, ETSI); + GSM_EncodeSMSDateTime(&SMS->Time, ETSI->DeliveryDateTime); + size=GSM_EncodeETSISMSSubmitData(SMS, ETSI); + + break; + default: + break; + } + + /* size is the length of the data in octets including udh */ + *length=size; + + return GE_NONE; } -static GSM_Error DecodeSMSHeader(unsigned char *message, GSM_SMSMessage *SMS) +/* This function decodes parts of SMS coded according to GSM 03.40 + (given in GSM_ETSISMSMessage) to GSM_SMSMessage */ +GSM_Error GSM_DecodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI) { - /* Short Message Type */ - SMS->Type = message[layout.Type]; - switch (SMS->Type) { - case SMS_Deliver: - llayout = layout.Deliver; - dprintf("Mobile Terminated message:\n"); - break; - case SMS_Delivery_Report: - llayout = layout.DeliveryReport; - dprintf("Delivery Report:\n"); - break; - case SMS_Submit: - llayout = layout.Submit; - dprintf("Mobile Originated message:\n"); - break; - case SMS_Picture: - llayout = layout.Picture; - dprintf("Picture Message:\n"); - break; - default: - dprintf("Not supported message type: %d\n", SMS->Type); - return GE_NOTSUPPORTED; - } - - if (!llayout.IsSupported) return GE_NOTSUPPORTED; - - /* Delivery date */ - if (llayout.Time > -1) { - UnpackDateTime(message + llayout.Time, &(SMS->SMSCTime)); - dprintf("\tDelivery date: %s\n", PrintDateTime(message + llayout.Time)); - } - - /* Short Message location in memory */ - if (llayout.Number > -1) { - SMS->Number = message[llayout.Number]; - dprintf("\tLocation: %d\n", SMS->Number); - } - - /* Short Message Center */ - if (llayout.MessageCenter > -1) { - strcpy(SMS->MessageCenter.Number, GetBCDNumber(message + llayout.MessageCenter)); - dprintf("\tSMS center number: %s\n", SMS->MessageCenter.Number); - SMS->ReplyViaSameSMSC = false; - if (SMS->RemoteNumber.number[0] == 0 && (message[llayout.ReplyViaSameSMSC] & 0x80)) { - SMS->ReplyViaSameSMSC = true; - } - } - - /* Remote number */ - if (llayout.RemoteNumber > -1) { - message[llayout.RemoteNumber] = ((message[llayout.RemoteNumber])+1)/2+1; - strcpy(SMS->RemoteNumber.number, GetBCDNumber(message + llayout.RemoteNumber)); - dprintf("\tRemote number (recipient or sender): %s\n", SMS->RemoteNumber.number); - } - - /* Sending time */ - if (llayout.SMSCTime > -1) { - UnpackDateTime(message + llayout.SMSCTime, &(SMS->Time)); - dprintf("\tDate: %s\n", PrintDateTime(message + llayout.SMSCTime)); - } - - /* Message length */ - if (llayout.Length > -1) - SMS->Length = message[llayout.Length]; - - /* Data Coding Scheme */ - if (llayout.DataCodingScheme > -1) - SMS->DCS.Type = message[llayout.DataCodingScheme]; - - /* User Data Header */ - if (llayout.UserDataHeader > -1) - if (message[llayout.UserDataHeader] & 0x40) { /* UDH header available */ - dprintf("UDH found\n"); - DecodeUDH(message + llayout.UserData, SMS); - } + SMS_MessageType PDU=SMS_Deliver; + + /* See GSM 03.40 section 9.2.3.1 */ + if ((ETSI->firstbyte & 0x03) == 0x01) PDU=SMS_Submit; + if ((ETSI->firstbyte & 0x03) == 0x02) PDU=SMS_Status_Report; + + GSM_DecodeETSISMSHeader(SMS, ETSI); + + switch (PDU) { + case SMS_Submit: +#ifdef DEBUG + fprintf(stdout, _(" SMS submit ")); +#endif + SMS->SMSData=false; + GSM_DecodeETSISMSSubmitData(SMS,ETSI); + break; + case SMS_Deliver: +#ifdef DEBUG + fprintf(stdout, _(" SMS deliver ")); + fprintf(stdout, _(" Date: ")); +#endif + SMS->SMSData=true; + GSM_DecodeSMSDateTime(&SMS->Time, ETSI->DeliveryDateTime); + GSM_DecodeETSISMSSubmitData(SMS,ETSI); + break; + case SMS_Status_Report: +#ifdef DEBUG + fprintf(stdout, _(" SMS status report ")); + fprintf(stdout, _(" Date: ")); +#endif + SMS->SMSData=true; + GSM_DecodeSMSDateTime(&SMS->Time, ETSI->DeliveryDateTime); + GSM_DecodeETSISMSStatusReportData(SMS,ETSI); + break; + default: + break; + } + + SMS->MessageText[SMS->Length]=0; + + return GE_NONE; +} - return GE_NONE; +void GSM_SetDefaultSMSData (GSM_SMSMessage *SMS) +{ + struct tm *now; + time_t nowh; + GSM_DateTime Date; + + /* Default settings for SMS message: + - no delivery report + - Class Message 1 + - no compression + - SMSC no. 1 + - validity 3 days */ + + SMS->folder = GST_OUTBOX; + SMS->Type = GST_SMS; + SMS->Class = -1; + SMS->Compression = false; + SMS->MessageCenter.No = 1; + SMS->Validity = 4320; /* 4320 minutes == 72 hours */ + SMS->ReplyViaSameSMSC = false; + SMS->UDHType = GSM_NoUDH; + SMS->Coding=GSM_Coding_Default; + strcpy(SMS->Destination,""); + + /* This part is required to save SMS */ + + SMS->Status = GSS_NOTSENTREAD; + SMS->Location = 0; + + nowh=time(NULL); + now=localtime(&nowh); + + Date.Year = now->tm_year; + Date.Month = now->tm_mon+1; + Date.Day = now->tm_mday; + Date.Hour = now->tm_hour; + Date.Minute = now->tm_min; + Date.Second = now->tm_sec; + + /* I have 100 (for 2000) Year now :-) */ + if (Date.Year>99 && Date.Year<1900) { + Date.Year=Date.Year+1900; + } + + /* We need to have only two last digits of year */ + if (Date.Year>1900) + { + if (Date.Year<2000) Date.Year = Date.Year-1900; + else Date.Year = Date.Year-2000; + } + + SMS->Time.Year=Date.Year; + SMS->Time.Month=Date.Month; + SMS->Time.Day=Date.Day; + SMS->Time.Hour=Date.Hour; + SMS->Time.Minute=Date.Minute; + SMS->Time.Second=Date.Second; + + SMS->Name[0]=0; } -/* This function decodes SMS as described in: - - GSM 03.40 version 6.1.0 Release 1997, section 9 +/* This function encodes the UserDataHeader as described in: + - GSM 03.40 version 6.1.0 Release 1997, section 9.2.3.24 + - Smart Messaging Specification, Revision 1.0.0, September 15, 1997 */ -GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageLength) +GSM_Error EncodeUDHHeader(char *text, GSM_UDH UDHType) { - int size; - GSM_Bitmap bitmap; - GSM_Error error; - - error = DecodeSMSHeader(message, SMS); - if (error != GE_NONE) return error; - switch (SMS->Type) { - case SMS_Delivery_Report: - if (llayout.UserData > -1) SMSStatus(message[llayout.UserData], SMS); + int i=0; + + if (UDHType!=GSM_NoUDH) { + while (true) { + if (UDHHeaders[i].UDHType==GSM_NoUDH) { +#ifdef DEBUG + fprintf(stderr,_("Not supported User Data Header type\n")); +#endif break; - case SMS_Picture: - GSM_ReadSMSBitmap(SMS_Picture, message + llayout.UserData, NULL, &bitmap); - GSM_PrintBitmap(&bitmap); - size = MessageLength - llayout.UserData - 4 - bitmap.size; - SMS->Length = message[llayout.UserData + 4 + bitmap.size]; - DecodeData(message + llayout.UserData + 5 + bitmap.size, - (unsigned char *)&(SMS->MessageText), - SMS->Length, size, 0, SMS->DCS); - SMS->MessageText[SMS->Length] = 0; + } + if (UDHHeaders[i].UDHType==UDHType) { + text[0] = UDHHeaders[i].Length; // UDH Length + memcpy(text+1, UDHHeaders[i].Text, UDHHeaders[i].Length); break; - default: - size = MessageLength - - llayout.UserData + 1 - /* Header Length */ - SMS->UDH_Length; /* UDH Length */ - DecodeData(message + llayout.UserData + SMS->UDH_Length, - (unsigned char *)&(SMS->MessageText), - SMS->Length, size, SMS->UDH_Length, SMS->DCS); - /* Just in case */ - SMS->MessageText[SMS->Length] = 0; - break; - } - + } + i++; + } + } return GE_NONE; } -/* This function does simple SMS decoding - no PDU coding */ -GSM_Error DecodeTextSMS(unsigned char *message, GSM_SMSMessage *SMS) -{ - return GE_NONE; +int GSM_MakeSinglePartSMS2(GSM_SMSMessage *SMS, + unsigned char *MessageBuffer,int cur, GSM_UDH UDHType, GSM_Coding_Type Coding){ + + int j; + int current,smsudhlength; + + GSM_SetDefaultSMSData(SMS); + + EncodeUDHHeader(SMS->UDH, UDHType); + SMS->UDHType=UDHType; + + switch (UDHType) { + case GSM_EnableVoice: + case GSM_DisableVoice: + case GSM_EnableEmail: + case GSM_DisableEmail: + case GSM_EnableFax: + case GSM_DisableFax: + SMS->Class=1; + SMS->Coding=Coding; + break; + case GSM_NoUDH: + case GSM_ConcatenatedMessages: + case GSM_VoidSMS: + case GSM_HangSMS: + case GSM_BugSMS: + case GSM_PhonebookUDH: + case GSM_CalendarNoteUDH: //class=1? + SMS->Class=-1; + SMS->Coding=Coding; + break; + case GSM_OpLogo: + case GSM_CallerIDLogo: + case GSM_RingtoneUDH: + case GSM_WAPBookmarkUDH: + case GSM_WAPBookmarkUDHLong: + case GSM_WAPSettingsUDH: + case GSM_ProfileUDH: + SMS->Class=1; + SMS->Coding=GSM_Coding_8bit; + break; + default: + fprintf(stderr,_("Error in makesinglepartsms !\n\n\n")); + } + + current=cur; + + smsudhlength=0; + if (UDHType!=GSM_NoUDH) + smsudhlength=SMS->UDH[0]+1; + + j=0; + switch (SMS->Coding) { + case GSM_Coding_8bit: + j=(GSM_MAX_SMS_8_BIT_LENGTH-smsudhlength); //max=140 + break; + case GSM_Coding_Default: + j=(GSM_MAX_SMS_8_BIT_LENGTH-smsudhlength)*8/7; //max=160 + break; + case GSM_Coding_Unicode: + j=(GSM_MAX_SMS_8_BIT_LENGTH-smsudhlength)/2; //max=70 + break; + } + if (current>j) current=j; + + memcpy(SMS->MessageText,MessageBuffer,current); + SMS->MessageText[current]=0; + SMS->Length=current; + + return current; +} + +void GSM_MakeMultiPartSMS2(GSM_MultiSMSMessage *SMS, + unsigned char *MessageBuffer,int MessageLength, GSM_UDH UDHType, GSM_Coding_Type Coding){ + + int i=0,j,pos=0,current=0; + + for (i=0;i<4;i++) { + if (pos==MessageLength) break; + + current=MessageLength-pos; + + pos=pos+GSM_MakeSinglePartSMS2(&SMS->SMS[i],MessageBuffer+pos,current,UDHType,Coding); + } + + for (j=0;jSMS[j].UDH[10]=i; + SMS->SMS[j].UDH[11]=j+1; + break; + case GSM_ConcatenatedMessages: + SMS->SMS[j].UDH[4]=i; + SMS->SMS[j].UDH[5]=j+1; + break; + default: + break; + } + } + + SMS->number=i; } diff --git a/common/misc.c b/common/misc.c index 9ab975f..34d81b7 100644 --- a/common/misc.c +++ b/common/misc.c @@ -4,175 +4,237 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. - $Id$ - - $Log$ - Revision 1.1.1.2 2001/11/27 04:19:24 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 05:17 CET 2001 - - Revision 1.20 2001/11/26 18:06:08 pkot - Checking for *printf functions, N_(x) for localization, generic ARRAY_LEN, SAFE_STRNCPY, G_GNUC_PRINTF (Jan Kratochvil) - - Revision 1.19 2001/11/22 17:56:53 pkot - smslib update. sms sending - - Revision 1.18 2001/09/09 21:45:49 machek - Cleanups from Ladislav Michl : - - *) do *not* internationalize debug messages - - *) some whitespace fixes, do not use // - - *) break is unneccessary after return - - Revision 1.17 2001/08/09 12:34:34 pkot - 3330 and 6250 support - I have no idea if it does work (mygnokii) - - Revision 1.16 2001/03/21 23:36:04 chris - Added the statemachine - This will break gnokii --identify and --monitor except for 6210/7110 - - Revision 1.15 2001/03/06 10:38:52 machek - Dancall models added to the global list. - - Revision 1.14 2001/02/06 13:55:23 pkot - Enabled authentication in 51xx models - - Revision 1.13 2001/02/02 08:09:56 ja - New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code. - +*/ +#include +#include +#include + +#ifndef WIN32 + #include + #include + #include + #include + #include + #include + #include +#endif + +#include "misc.h" +#include "gsm-common.h" + +#ifndef HAVE_TIMEOPS + +/* FIXME: I have timersub defined in sys/time.h :-( PJ + FIXME: Jano wants this function too... PJ + +int timersub(struct timeval *a, struct timeval *b, struct timeval *result) { + do { + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; + if ((result)->tv_usec < 0) { + --(result)->tv_sec; + (result)->tv_usec += 1000000; + } + } while (0); +} */ -#include -#include -#include "misc.h" +#endif -int GetLine(FILE *File, char *Line, int count) -{ - char *ptr; +int GetLine(FILE *File, char *Line, int count) { - if (fgets(Line, count, File)) { - ptr = Line + strlen(Line) - 1; + char *ptr; - while ( (*ptr == '\n' || *ptr == '\r') && ptr >= Line) - *ptr-- = '\0'; + if (fgets(Line, count, File)) { + ptr=Line+strlen(Line)-1; - return strlen(Line); - } - else - return 0; + while ( (*ptr == '\n' || *ptr == '\r') && ptr>=Line) *ptr--='\0'; + + return strlen(Line); + } else return -1; } -static PhoneModel models[] = { - {NULL, "", 0 }, - {"2711", "?????", PM_SMS }, /* Dancall */ - {"2731", "?????", PM_SMS }, - {"1611", "NHE-5", 0 }, - {"2110i", "NHE-4", PM_SMS }, - {"2148i", "NHK-4", 0 }, - {"3110", "0310" , PM_SMS | PM_DTMF | PM_DATA }, /* NHE-8 */ - {"3210", "NSE-8", PM_SMS | PM_DTMF }, - {"3210", "NSE-9", PM_SMS | PM_DTMF }, - {"3310", "NHM-5", PM_SMS | PM_DTMF }, - {"3330", "NHM-6", PM_SMS | PM_DTMF }, - {"3810", "0305" , PM_SMS | PM_DTMF | PM_DATA }, /* NHE-9 */ - {"5110", "NSE-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"5130", "NSK-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"5160", "NSW-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"5190", "NSB-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6110", "NSE-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6120", "NSC-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6130", "NSK-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6150", "NSM-1", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"616x", "NSW-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6185", "NSD-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6190", "NSB-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION }, - {"6210", "NPE-3", PM_CALLERGROUP | PM_CALENDAR | PM_EXTPBK | PM_SMS}, - {"6250", "NHM-3", PM_CALLERGROUP | PM_CALENDAR | PM_EXTPBK }, - {"7110", "NSE-5", PM_CALLERGROUP | PM_SPEEDDIAL | PM_EXTPBK }, - {"8810", "NSE-6", PM_SMS | PM_DTMF | PM_DATA }, - {"8110i", "0423", PM_SMS | PM_DTMF | PM_DATA }, /* Guess for NHE-6 */ - {"8110", "0423" , PM_SMS | PM_DTMF | PM_DATA }, /* NHE-6BX */ - {"9000i", "RAE-4", 0 }, - {"9110", "RAE-2", 0 }, - {"550", "THF-10", 0 }, - {"540", "THF-11", 0 }, - {"650", "THF-12", 0 }, - {"640", "THF-13", 0 }, - {NULL, NULL, 0 } -}; - -PhoneModel *GetPhoneModel (const char *num) +/* + * like atoi, but of a non-null-terminated string of a specified portion + */ +int mem_to_int(const char str[], int len) { - register int i = 0; + char aux[81]; - while (models[i].number != NULL) { - if (strcmp (num, models[i].number) == 0) { - dprintf("Found model\n"); - return (&models[i]); - } - else { - dprintf("comparing %s and %s\n", num, models[i].number); - } - i++; - } + strncpy(aux, str, len); + aux[len]=0; + return( atoi(aux) ); +} - return (&models[0]); +/* + * make hexdump of Message + */ +#ifdef DEBUG +void hexdump(u16 MessageLength, u8 *MessageBuffer) +{ + + int count; + int n=0; + char string1[80]=""; + char string2[80]=""; + char hex1[10]; + char hex2[10]; + + for (count = 0; count < MessageLength; count ++) + { + n++; + + switch (MessageBuffer[count]) { + case 0x09: + sprintf(hex1,"%02x ",MessageBuffer[count]); + strcpy(hex2,"."); + break; + default: + if (isprint(MessageBuffer[count])) + sprintf(hex1,"%02x%c ",MessageBuffer[count],MessageBuffer[count]); + else + sprintf(hex1,"%02x ",MessageBuffer[count]); + + if (isprint(MessageBuffer[count])) sprintf(hex2,"%c",MessageBuffer[count]); + else strcpy(hex2,"."); + break; + } + + if ( n!=15 && count != MessageLength-1 ) hex1[3]='|'; + + strcat(string1,hex1); + strcat(string2,hex2); + + if ( n==15 || count == MessageLength-1 ) + { + fprintf(stdout,"%-60s%03x %s\n",string1,count+1,string2); + strcpy(string1,""); + strcpy(string2,""); + n=0; + } + }//for count + + if (n!=0) fprintf (stdout,_("\n")); + + fflush(stdout); } -inline char *GetModel (const char *num) -{ - return (GetPhoneModel(num)->model); +void txhexdump(u16 MessageLength, u8 *MessageBuffer) +{ + int count; + int n=0; + + for (count = 0; count < MessageLength; count ++) + { + n++; + fprintf(stdout,_("%02x"),MessageBuffer[count]); + switch (MessageBuffer[count]) { + case 0x09: + fprintf(stdout,_(" |")); + break; + default: + if (isprint(MessageBuffer[count])) fprintf(stdout, _("%c|"),MessageBuffer[count]); + else fprintf(stdout,_(" |")); + break; + } + + if (n==18) + { + fprintf (stdout,_("\n")); + n=0; + } + }//for count + + if (n!=0) fprintf (stdout,_("\n")); + + fflush(stdout); } +#endif -#ifndef HAVE_VASPRINTF -/* Adapted from snprintf(3) man page: */ -int gvasprintf(char **destp, const char *fmt, va_list ap) -{ - int n, size = 0x100; - char *p, *pnew; +#ifndef WIN32 + +#define max_buf_len 128 +#define lock_path "/var/lock/LCK.." - if (!(p = malloc(size))) { - *destp = NULL; - return(-1); +/* Lock the device. Return allocated string with a lock name */ +char *lock_device(const char* port) +{ + char *lock_file = NULL; + char buffer[max_buf_len]; + char *aux = rindex(port, '/'); + int fd, len = strlen(aux) + strlen(lock_path); + + memset(buffer, 0, sizeof(buffer)); + lock_file = calloc(len + 1, 1); + if (!lock_file) { + fprintf(stderr, _("Cannot lock device\n")); + return NULL; } - for (;;) { - /* Try to print in the allocated space. */ - n = gvsprintf(p, size, fmt, ap); - /* If that worked, return the string. */ - if (n > -1 && n < size) { - *destp = p; - return(n); + /* I think we don't need to use strncpy, as we should have enough + * buffer due to strlen results + */ + strcpy(lock_file, lock_path); + strcat(lock_file, aux); + + /* Check for the stale lockfile. + * The code taken from minicom by Miquel van Smoorenburg */ + if ((fd = open(lock_file, O_RDONLY)) >= 0) { + char buf[max_buf_len]; + int pid, n = 0; + + n = read(fd, buf, sizeof(buf) - 1); + close(fd); + if (n > 0) { + pid = -1; + if (n == 4) + /* Kermit-style lockfile. */ + pid = *(int *)buf; + else { + /* Ascii lockfile. */ + buf[n] = 0; + sscanf(buf, "%d", &pid); + } + if (pid > 0 && kill((pid_t)pid, 0) < 0 && errno == ESRCH) { + fprintf(stderr, _("Lockfile is stale. Overriding it..\n")); + sleep(1); + unlink(lock_file); + } else + n = 0; } - /* Else try again with more space. */ - if (n > -1) /* glibc 2.1 */ - size = n + 1; /* precisely what is needed */ - else /* glibc 2.0 */ - size *= 2; /* twice the old size */ - if (!(pnew = realloc(p, size))) { - free(p); - *destp = NULL; - return(-1); + if (n == 0) { + free(lock_file); + fprintf(stderr, _("Device is already locked.\n")); + return NULL; } - p = pnew; } + + /* Try to create a new file, with 0644 mode */ + fd = open(lock_file, O_CREAT | O_EXCL, 0644); + if (fd == -1) { + free(lock_file); + fprintf(stderr, _("Cannot lock device\n")); + return NULL; + } + sprintf(buffer, "%10ld gnokii\n", (long)getpid()); + write(fd, buffer, strlen(buffer)); + close(fd); + return lock_file; } -#endif -#ifndef HAVE_ASPRINTF -int gasprintf(char **destp, const char *fmt,...) +/* Removes lock and frees memory */ +bool unlock_device(char *lock_file) { - va_list ap; - int r; + int err; - va_start(ap,fmt); - r = gvasprintf(destp, fmt, ap); - va_end(ap); - return(r); + if (!lock_file) { + fprintf(stderr, _("Cannot unlock device\n")); + return false; + } + err = unlink(lock_file); + free(lock_file); + return (err + 1); } -#endif +#endif /* WIN32 */ diff --git a/configure.in b/configure.in index 0a30589..87ea315 100644 --- a/configure.in +++ b/configure.in @@ -16,7 +16,7 @@ AC_PREFIX_DEFAULT("/usr/local") dnl ======================== Default setting CFLAGS="-O2 -Wall" -ALL_LINGUAS="cs de et fi nl sk pl it sl" +ALL_LINGUAS="cs de et fi nl sk pl it" dnl ======================== Checks for programs. AC_PROG_CC @@ -32,9 +32,7 @@ test x"$prefix" = xNONE && prefix="$ac_default_prefix" AC_ARG_ENABLE(debug, [ --enable-debug compile with debug code], - [ if test "x$GCC" = "xyes"; then - CFLAGS="-ggdb3 -Wall" - fi + [ CFLAGS="-g -Wall" AC_DEFINE(DEBUG) debug="yes" ], [ debug="no" ] @@ -330,7 +328,7 @@ else AC_MSG_WARN(Disabling xgnokii.) else AC_CHECK_LIB(Xpm, XpmWriteFileFromXpmImage, - [ XPM_CFLAGS="-I$x_includes" XPM_LIBS="-L$x_libraries -lX11 -lXpm" + [ XPM_CFLAGS="-I$x_includes" XPM_LIBS="-L$x_libraries -lXpm -lX11" AC_DEFINE(XPM) ], AC_MSG_WARN(Cannot found library libXpm - disabling XPM support.), [ -L$x_libraries -lX11 ] @@ -439,7 +437,7 @@ AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_STRFTIME -AC_CHECK_FUNCS(mktime select strdup strstr strtol strtok strsep snprintf vsnprintf asprintf vasprintf) +AC_CHECK_FUNCS(mktime select strdup strstr strtol strtok strsep snprintf) CFLAGS="$CFLAGS $NLS_CFLAGS" LIBS="$LIBS $NLS_LIBS" @@ -522,7 +520,9 @@ echo " Win32: $win32 Prefix: $prefix - Type '${MAKE}' for compilation and then '${MAKE} install', - '${MAKE} install-suid', '${MAKE} install-strip' or '${MAKE} install-ss' to - install gnokii. + Type '${MAKE}' for compilation or '${MAKE} makelib' when want to compile + all binaries with one shared library + + After it '${MAKE} install', '${MAKE} install-suid', '${MAKE} install-strip' + or '${MAKE} install-ss' to install gnokii. " diff --git a/getopt/Makefile b/getopt/Makefile index 02def81..037269d 100644 --- a/getopt/Makefile +++ b/getopt/Makefile @@ -20,7 +20,7 @@ distclean clean:: ##### # DO NOT DELETE THIS LINE -- make depend depends on it. - + ifeq (depend,$(wildcard depend)) include depend endif diff --git a/gnokii/Makefile b/gnokii/Makefile index 8373efe..2018e7d 100644 --- a/gnokii/Makefile +++ b/gnokii/Makefile @@ -2,15 +2,16 @@ # # Makefile for the GNOKII tool suite. # -# Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. -# 2000 Karel Zak -# TOPDIR=.. include $(TOPDIR)/Makefile.global + +CFLAGS += $(PTHREAD_CFLAGS) +LDLIBS += $(PTHREAD_LIBS) + ifdef XPM_LIBS - LDFLAGS +=$(XPM_LIBS) + LDLIBS += $(XPM_LIBS) endif OBJS = gnokii.o @@ -19,28 +20,40 @@ ifdef OWN_GETOPT OBJS += $(TOPDIR)/getopt/libgetopt.a endif -LDFLAGS += -L$(TOPDIR)/common -lgnokii - all: gnokii -gnokii: $(OBJS) $(TOPDIR)/common/gsm-filetypes.o +gnokii: $(OBJS) $(TOPDIR)/common/COMMON.o $(TOPDIR)/common/gsm-filetypes.o + $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LOADLIBES) $(LDLIBS) -o $@ -$(TOPDIR)/common/gsm-filetypes.o: +$(TOPDIR)/common/COMMON.o: + $(MAKE) -C $(TOPDIR)/common COMMON.o + +$(TOPDIR)/common/gsm-filetypes.o: $(MAKE) -C $(TOPDIR)/common gsm-filetypes.o $(TOPDIR)/getopt/libgetopt.a: $(MAKE) -C $(TOPDIR)/getopt +$(TOPDIR)/common/libmygnokii.so: + $(MAKE) -C $(TOPDIR)/common makelib + +gnokiilib: $(OBJS) $(TOPDIR)/common/libmygnokii.so + $(CC) $(LDFLAGS) $(TARGET_ARCH) $(OBJS) -L$(TOPDIR)/common -lmygnokii $(LOADLIBES) $(LDLIBS) -o $@ + +makelib: gnokiilib + clean: - $(RM) $(OBJS) *~ depend gnokii *.exe core *.bak + $(RM) $(OBJS) *~ depend gnokii gnokiilib *.exe core *.bak install: all $(INSTALL) -d $(bindir) $(INSTALL) gnokii $(bindir) + $(INSTALL) gnokiilib $(bindir)/gnokii install-strip: all $(INSTALL) -d $(bindir) $(INSTALL) -s gnokii $(bindir) + $(INSTALL) -s gnokiilib $(bindir)/gnokii @echo "done" install-suid: all @@ -49,6 +62,7 @@ install-suid: all fi $(INSTALL) -d $(bindir) $(INSTALL) -o root -g gnokii -m 0750 gnokii $(bindir) + $(INSTALL) -o root -g gnokii -m 0750 gnokiilib $(bindir)/gnokii @echo install-ss: all @@ -57,6 +71,7 @@ install-ss: all fi $(INSTALL) -d $(bindir) $(INSTALL) -o root -g gnokii -m 0750 -s gnokii $(bindir) + $(INSTALL) -o root -g gnokii -m 0750 -s gnokiilib $(bindir)/gnokii @echo depend dep: diff --git a/gnokii/gnokii.c b/gnokii/gnokii.c index 120a83f..9daceb9 100644 --- a/gnokii/gnokii.c +++ b/gnokii/gnokii.c @@ -1,2978 +1,8748 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Copyright (C) 2001 Pavel Machek - Copyright (C) 2001 Pawe³ Kot - Released under the terms of the GNU GPL, see file COPYING for more details. Mainline code for gnokii utility. Handles command line parsing and reading/writing phonebook entries and other stuff. - WARNING: this code is the test tool. Well, our test tool is now - really powerful and useful :-) - */ -#include "misc.h" - #include #include #include #include -#if __unices__ -# include /* for memset */ -#endif +#include #include -#include #include +#ifndef VC6 + #if defined(__svr4__) || defined(__FreeBSD__) + # include /* for bzero */ + #endif +#else + /* for VC6 make scripts save VERSION constant in mversion.h file */ + #include "mversion.h" +#endif + #ifdef WIN32 -#include -#define sleep(x) Sleep((x) * 1000) -#define usleep(x) Sleep(((x) < 1000) ? 1 : ((x) / 1000)) -#define stat _stat -#include "win32/getopt.h" + #include + + #include "misc_win32.h" + #include "getopt.h" + + #define DEV_CONSOLE "CON:" #else -#include -#include -#include -#include + #include + #include + #include + #include + #include + #include -#endif -#ifdef USE_NLS -#include + #define DEV_CONSOLE "/dev/tty" #endif -#include "gsm-sms.h" +#include "misc.h" #include "gsm-common.h" #include "gsm-api.h" #include "gsm-networks.h" -#include "cfgreader.h" -#include "gnokii.h" -#include "gsm-filetypes.h" -#include "gsm-bitmaps.h" #include "gsm-ringtones.h" -#include "gsm-statemachine.h" +#include "gsm-bitmaps.h" +#include "gsm-wap.h" +#include "gsm-sms.h" +#include "gsm-datetime.h" +#include "gsm-phonebook.h" +#include "gsm-calendar.h" +#include "gsm-coding.h" +#include "newmodules/n6110.h" +#include "files/cfgreader.h" +#include "files/gsm-filetypes.h" +#include "gnokii.h" -char *model; /* Model from .gnokiirc file. */ -char *Port; /* Serial port from .gnokiirc file */ -char *Initlength; /* Init length from .gnokiirc file */ -char *Connection; /* Connection type from .gnokiirc file */ -char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ -/* Local variables */ +#ifdef USE_NLS + #include +#endif -char *GetProfileCallAlertString(int code) -{ - switch (code) { - case PROFILE_CALLALERT_RINGING: return "Ringing"; - case PROFILE_CALLALERT_ASCENDING: return "Ascending"; - case PROFILE_CALLALERT_RINGONCE: return "Ring once"; - case PROFILE_CALLALERT_BEEPONCE: return "Beep once"; - case PROFILE_CALLALERT_CALLERGROUPS: return "Caller groups"; - case PROFILE_CALLALERT_OFF: return "Off"; - default: return "Unknown"; - } -} +char *model; /* Model from .gnokiirc file. */ +char *Port; /* Port from .gnokiirc file */ +char *Initlength; /* Init length from .gnokiirc file */ +char *Connection; /* Connection type from .gnokiirc file */ +char *SynchronizeTime; /* If we set date and time from computer to phone (from .gnokiirc file) */ +char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ -char *GetProfileVolumeString(int code) -{ - switch (code) { - case PROFILE_VOLUME_LEVEL1: return "Level 1"; - case PROFILE_VOLUME_LEVEL2: return "Level 2"; - case PROFILE_VOLUME_LEVEL3: return "Level 3"; - case PROFILE_VOLUME_LEVEL4: return "Level 4"; - case PROFILE_VOLUME_LEVEL5: return "Level 5"; - default: return "Unknown"; - } +GSM_SMSMessage SMS[4]; + +char *GetProfileCallAlertString(int code) { + + switch (code) { + case PROFILE_CALLALERT_RINGING : return "Ringing"; + case PROFILE_CALLALERT_ASCENDING : return "Ascending"; + case PROFILE_CALLALERT_RINGONCE : return "Ring once"; + case PROFILE_CALLALERT_BEEPONCE : return "Beep once"; + case PROFILE_CALLALERT_CALLERGROUPS: return "Caller groups"; + case PROFILE_CALLALERT_OFF : return "Off"; + default : return "Unknown"; + } } -char *GetProfileKeypadToneString(int code) -{ - switch (code) { - case PROFILE_KEYPAD_OFF: return "Off"; - case PROFILE_KEYPAD_LEVEL1: return "Level 1"; - case PROFILE_KEYPAD_LEVEL2: return "Level 2"; - case PROFILE_KEYPAD_LEVEL3: return "Level 3"; - default: return "Unknown"; - } -} +char *GetProfileVolumeString(int code) { -char *GetProfileMessageToneString(int code) -{ - switch (code) { - case PROFILE_MESSAGE_NOTONE: return "No tone"; - case PROFILE_MESSAGE_STANDARD: return "Standard"; - case PROFILE_MESSAGE_SPECIAL: return "Special"; - case PROFILE_MESSAGE_BEEPONCE: return "Beep once"; - case PROFILE_MESSAGE_ASCENDING: return "Ascending"; - default: return "Unknown"; - } + switch (code) { + case PROFILE_VOLUME_LEVEL1 : return "Level 1"; + case PROFILE_VOLUME_LEVEL2 : return "Level 2"; + case PROFILE_VOLUME_LEVEL3 : return "Level 3"; + case PROFILE_VOLUME_LEVEL4 : return "Level 4"; + case PROFILE_VOLUME_LEVEL5 : return "Level 5"; + default : return "Unknown"; + } } -char *GetProfileWarningToneString(int code) -{ - switch (code) { - case PROFILE_WARNING_OFF: return "Off"; - case PROFILE_WARNING_ON: return "On"; - default: return "Unknown"; - } -} +char *GetProfileKeypadToneString(int code) { -char *GetProfileVibrationString(int code) -{ - switch (code) { - case PROFILE_VIBRATION_OFF: return "Off"; - case PROFILE_VIBRATION_ON: return "On"; - default: return "Unknown"; - } + switch (code) { + case PROFILE_KEYPAD_OFF : return "Off"; + case PROFILE_KEYPAD_LEVEL1 : return "Level 1"; + case PROFILE_KEYPAD_LEVEL2 : return "Level 2"; + case PROFILE_KEYPAD_LEVEL3 : return "Level 3"; + default : return "Unknown"; + } } -void short_version(void) -{ - fprintf(stderr, _("GNOKII Version %s\n"), VERSION); -} +char *GetProfileMessageToneString(int code) { -/* This function shows the copyright and some informations usefull for - debugging. */ -void version(void) -{ - fprintf(stderr, _("Copyright (C) Hugh Blemings , 1999, 2000\n" - "Copyright (C) Pavel Janík ml. , 1999, 2000\n" - "Copyright (C) Pavel Machek , 2001\n" - "Copyright (C) Pawe³ Kot , 2001\n" - "gnokii is free software, covered by the GNU General Public License, and you are\n" - "welcome to change it and/or distribute copies of it under certain conditions.\n" - "There is absolutely no warranty for gnokii. See GPL for details.\n" - "Built %s %s for %s on %s \n"), __TIME__, __DATE__, model, Port); + switch (code) { + case PROFILE_MESSAGE_NOTONE : return "No tone"; + case PROFILE_MESSAGE_STANDARD : return "Standard"; + case PROFILE_MESSAGE_SPECIAL : return "Special"; + case PROFILE_MESSAGE_BEEPONCE : return "Beep once"; + case PROFILE_MESSAGE_ASCENDING : return "Ascending"; + default : return "Unknown"; + } } -/* The function usage is only informative - it prints this program's usage and - command-line options. */ -int usage(void) -{ - fprintf(stderr, _(" usage: gnokii [--help|--monitor|--version]\n" - " gnokii --getmemory memory_type start [end]\n" - " gnokii --writephonebook [-i]\n" - " gnokii --getspeeddial number\n" - " gnokii --setspeeddial number memory_type location\n" - " gnokii --getsms memory_type start [end] [-f file] [-F file] [-d]\n" - " gnokii --deletesms memory_type start [end]\n" - " gnokii --sendsms destination [--smsc message_center_number |\n" - " --smscno message_center_index] [-r] [-C n] [-v n]\n" - " [--long n]\n" - " gnokii --savesms [-m] [-l n] [-i]\n" - " gnokii --getsmsc message_center_number\n" - " gnokii --setdatetime [YYYY [MM [DD [HH [MM]]]]]\n" - " gnokii --getdatetime\n" - " gnokii --setalarm HH MM\n" - " gnokii --getalarm\n" - " gnokii --dialvoice number\n" - " gnokii --getcalendarnote start [end] [-v]\n" - " gnokii --writecalendarnote vcardfile number\n" - " gnokii --deletecalendarnote start [end]\n" - " gnokii --getdisplaystatus\n" - " gnokii --netmonitor {reset|off|field|devel|next|nr}\n" - " gnokii --identify\n" - " gnokii --senddtmf string\n" - " gnokii --sendlogo {caller|op} destination logofile [network code]\n" - " gnokii --sendringtone destination rtttlfile\n" - " gnokii --setlogo op [logofile] [network code]\n" - " gnokii --setlogo startup [logofile]\n" - " gnokii --setlogo caller [logofile] [caller group number] [group name]\n" - " gnokii --setlogo {dealer|text} [text]\n" - " gnokii --getlogo op [logofile] [network code]\n" - " gnokii --getlogo startup [logofile] [network code]\n" - " gnokii --getlogo caller [logofile][caller group number][network code]\n" - " gnokii --getlogo {dealer|text}\n" - " gnokii --viewlogo logofile\n" - " gnokii --setringtone rtttlfile\n" - " gnokii --reset [soft|hard]\n" - " gnokii --getprofile [number]\n" - " gnokii --displayoutput\n" - " gnokii --keysequence\n" - " gnokii --divert {--op|-o} {register|enable|query|disable|erasure}\n" - " {--type|-t} {all|busy|noans|outofreach|notavail}\n" - " {--call|-c} {all|voice|fax|data}\n" - " [{--timeout|-m} time_in_seconds]\n" - " [{--number|-n} number]\n" - )); -#ifdef SECURITY - fprintf(stderr, _( - " gnokii --entersecuritycode PIN|PIN2|PUK|PUK2\n" - " gnokii --getsecuritycodestatus\n" - )); -#endif - exit(-1); +char *GetProfileWarningToneString(int code) { + + switch (code) { + case PROFILE_WARNING_OFF : return "Off"; + case PROFILE_WARNING_ON : return "On"; + default : return "Unknown"; + } } -/* fbusinit is the generic function which waits for the FBUS link. The limit - is 10 seconds. After 10 seconds we quit. */ +char *GetProfileOnOffString(int code) { -static GSM_Statemachine State; -static GSM_Data data; + switch (code) { + case 0x00 : return "Off"; + case 0x01 : return "On"; + default : return "Unknown"; + } +} -void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) +static char *GetProfileVibrationString(int code) { - int count = 0; - GSM_Error error; - GSM_ConnectionType connection = GCT_Serial; + switch (code) { + case PROFILE_VIBRATION_OFF: return "Off"; + case PROFILE_VIBRATION_ON: return "On"; + case PROFILE_VIBRATION_FIRST: return "Vibrate first"; + default: return "Unknown"; + } +} - GSM_DataClear(&data); +char BufferProfileGroups[90]; - if (!strcasecmp(Connection, "dau9p")) connection = GCT_DAU9P; /* Use only with 6210/7110 for faster connection with such cable */ - if (!strcasecmp(Connection, "infrared")) connection = GCT_Infrared; - if (!strcasecmp(Connection, "irda")) connection = GCT_Irda; +char *GetProfileCallerGroups(int code) +{ + static char az_group_name[5][MAX_BITMAP_TEXT_LENGTH]; + static bool enteronce=false; + register int i; + GSM_Bitmap bitmap; - /* Initialise the code for the GSM interface. */ + if( code == PROFILE_CALLERGROUPS_ALL ) + return _("All calls alert"); - error = GSM_Initialise(model, Port, Initlength, connection, rlp_handler, &State); + if( !enteronce ) { + for(i=0;i<5;i++) az_group_name[i][0]='\0'; + enteronce=true; + } - if (error != GE_NONE) { - fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); - exit(-1); - } + BufferProfileGroups[0]=0; + + for(i=0;i<5;i++) + { + int code2test; + char z_gtype[12]; + + code2test=(i==0) ? 1 : 2<<(i-1); + + if( code & code2test ) + { + if (!strcmp(az_group_name[i],"")) + { + if (GetModelFeature (FN_CALLERGROUPS)!=0) { + bitmap.type=GSM_CallerLogo; + bitmap.number=i; + strcpy(z_gtype,_("unknown")); + if (GSM->GetBitmap(&bitmap)==GE_NONE) + strcpy( az_group_name[i], bitmap.text ); + } + if ((!strcmp(az_group_name[i],""))) { + switch(i) { + case 0:strcpy(az_group_name[i],_("Family"));break; + case 1:strcpy(az_group_name[i],_("VIP"));break; + case 2:strcpy(az_group_name[i],_("Friends"));break; + case 3:strcpy(az_group_name[i],_("Colleagues"));break; + case 4:strcpy(az_group_name[i],_("Other"));break; + default:break; + } + } + } + strcpy(z_gtype,az_group_name[i]); + + if( strlen(BufferProfileGroups) ) strcat(BufferProfileGroups,"+"); + strcat(BufferProfileGroups, z_gtype); + } + + } - /* First (and important!) wait for GSM link to be active. We allow 10 - seconds... */ + return BufferProfileGroups; +} - while (count++ < 200 && *GSM_LinkOK == false) - usleep(50000); +char *print_error(GSM_Error e) +{ - if (*GSM_LinkOK == false) { - fprintf (stderr, _("Hmmm... GSM_LinkOK never went true. Quitting.\n")); - exit(-1); +// case GE_DEVICEOPENFAILED: return "Couldn't open specified serial device."; +// case GE_UNKNOWNMODEL: return "Model specified isn't known/supported."; +// case GE_NOLINK: return "Couldn't establish link with phone."; +// case GE_TRYAGAIN: return "Try again."; +// case GE_INVALIDSMSLOCATION: return "Invalid SMS location."; +// case GE_INVALIDPHBOOKLOCATION: return "Invalid phonebook location."; +// case GE_INVALIDMEMORYTYPE: return "Invalid type of memory."; +// case GE_INVALIDSPEEDDIALLOCATION: return "Invalid speed dial location."; +// case GE_INVALIDCALNOTELOCATION: return "Invalid calendar note location."; +// case GE_INVALIDDATETIME: return "Invalid date, time or alarm specification."; +// case GE_EMPTYSMSLOCATION: return "SMS location is empty."; +// case GE_PHBOOKNAMETOOLONG: return "Phonebook name is too long."; +// case GE_PHBOOKNUMBERTOOLONG: return "Phonebook number is too long."; +// case GE_PHBOOKWRITEFAILED: return "Phonebook write failed."; +// case GE_SMSSENDOK: return "SMS was send correctly."; +// case GE_SMSSENDFAILED: return "SMS send fail."; +// case GE_SMSTOOLONG: return "SMS message too long."; +// case GE_NONEWCBRECEIVED: return "Attempt to read CB when no new CB received"; +// case GE_INTERNALERROR: return "Problem occured internal to model specific code."; +// case GE_NOTSUPPORTED: return "Function not supported by the phone"; +// case GE_BUSY: return "Command is still being executed."; +// case GE_USERCANCELED: return "User has cancelled the action."; +// case GE_UNKNOWN: return "Unknown error - well better than nothing!!"; +// case GE_MEMORYFULL: return "Memory is full"; +// case GE_LINEBUSY: return "Outgoing call requested reported line busy"; +// case GE_NOCARRIER: return "No Carrier error during data call setup ?"; + + switch (e) { + case GE_NONE: return "No error, done OK"; + case GE_INVALIDSECURITYCODE: return "Invalid Security code."; + case GE_NOTIMPLEMENTED: return "Called command is not implemented for the used model. Please contact marcin-wiacek@topnet.pl, if you want to help in implementing it"; + case GE_TIMEOUT: return "Command timed out."; + case GE_CANTOPENFILE: return "Can't open file with bitmap/ringtone"; + case GE_SUBFORMATNOTSUPPORTED: return "Subformat of file not supported"; + case GE_WRONGNUMBEROFCOLORS: return "Wrong number of colors in specified bitmap file (only 2 colors files supported)"; + case GE_WRONGCOLORS: return "Wrong colors in bitmap file"; + case GE_INVALIDIMAGESIZE: return "Invalid size of bitmap (in file, sms etc.)"; + case GE_INVALIDFILEFORMAT: return "Invalid format of file"; + case GE_TOOSHORT: return "File too short"; + case GE_INSIDEBOOKMARKSMENU: return "Inside WAP Bookmarks menu. Please leave it and try again"; + case GE_INVALIDBOOKMARKLOCATION: return "Invalid or empty WAP bookmark location"; + case GE_INSIDESETTINGSMENU: return "Inside WAP Settings menu. Please leave it and try again"; + case GE_INVALIDSETTINGSLOCATION: return "Invalid or empty WAP settings location"; + default: return "Unknown error."; } } -/* This function checks that the argument count for a given options is withing - an allowed range. */ -int checkargs(int opt, struct gnokii_arg_len gals[], int argc) + +GSM_Error GSM_ReadRingtoneFileOnConsole(char *FileName, GSM_Ringtone *ringtone) { - int i; + GSM_Error error; + + error=GSM_ReadRingtoneFile(FileName, ringtone); + + switch (error) { + case GE_CANTOPENFILE: + case GE_SUBFORMATNOTSUPPORTED: + fprintf(stderr, _("File \"%s\"\nError: %s\n"),FileName,print_error(error)); + break; + default: + break; + } + + return error; +} - /* Walk through the whole array with options requiring arguments. */ - for (i = 0; !(gals[i].gal_min == 0 && gals[i].gal_max == 0); i++) { +GSM_Error GSM_SaveRingtoneFileOnConsole(char *FileName, GSM_Ringtone *ringtone) +{ + int confirm,confirm2; + char ans[4]; + struct stat buf; + GSM_Error error; - /* Current option. */ - if (gals[i].gal_opt == opt) { + /* Ask before overwriting */ + while (stat(FileName, &buf) == 0) { + + confirm=-1; + confirm2=-1; + + while (confirm < 0) { + fprintf(stderr, _("Saving ringtone. File \"%s\" exists. (O)verwrite, create (n)ew or (s)kip ? "),FileName); + GetLine(stdin, ans, 4); + if (!strcmp(ans, "O") || !strcmp(ans, "o")) confirm = 1; + if (!strcmp(ans, "N") || !strcmp(ans, "n")) confirm = 2; + if (!strcmp(ans, "S") || !strcmp(ans, "s")) return GE_USERCANCELED; + } + if (confirm==1) break; + if (confirm==2) { + while (confirm2 < 0) { + fprintf(stderr, _("Enter name of new file: ")); + GetLine(stdin, FileName, 50); + if (&FileName[0]==0) return GE_USERCANCELED; + confirm2=1; + } + } + } + + error=GSM_SaveRingtoneFile(FileName,ringtone); + + switch (error) { + case GE_CANTOPENFILE: fprintf(stderr, _("Failed to write file \"%s\"\n"),FileName); + break; + default: break; + } + + return error; +} - /* Argument count checking. */ - if (gals[i].gal_flags == GAL_XOR) { - if (gals[i].gal_min == argc || gals[i].gal_max == argc) - return 0; - } else { - if (gals[i].gal_min <= argc && gals[i].gal_max >= argc) - return 0; - } +GSM_Error GSM_ReadBitmapFileOnConsole(char *FileName, GSM_Bitmap *bitmap) +{ + GSM_Error error; + + error=GSM_ReadBitmapFile(FileName, bitmap); + + switch (error) { + case GE_CANTOPENFILE: + case GE_WRONGNUMBEROFCOLORS: + case GE_WRONGCOLORS: + case GE_INVALIDFILEFORMAT: + case GE_SUBFORMATNOTSUPPORTED: + case GE_TOOSHORT: + case GE_INVALIDIMAGESIZE: + fprintf(stderr, _("File \"%s\"\nError: %s\n"),FileName,print_error(error)); + break; + default: + break; + } + + return error; +} - return 1; - } - } +GSM_Error GSM_SaveBitmapFileOnConsole(char *FileName, GSM_Bitmap *bitmap) +{ + int confirm,confirm2; + char ans[4]; + struct stat buf; + GSM_Error error; - /* We do not have options without arguments in the array, so check them. */ - if (argc == 0) return 0; - else return 1; + /* Ask before overwriting */ + while (stat(FileName, &buf) == 0) { + + confirm=-1; + confirm2=-1; + + while (confirm < 0) { + fprintf(stderr, _("Saving logo. File \"%s\" exists. (O)verwrite, create (n)ew or (s)kip ? "),FileName); + GetLine(stdin, ans, 4); + if (!strcmp(ans, "O") || !strcmp(ans, "o")) confirm = 1; + if (!strcmp(ans, "N") || !strcmp(ans, "n")) confirm = 2; + if (!strcmp(ans, "S") || !strcmp(ans, "s")) return GE_USERCANCELED; + } + if (confirm==1) break; + if (confirm==2) { + while (confirm2 < 0) { + fprintf(stderr, _("Enter name of new file: ")); + GetLine(stdin, FileName, 50); + if (&FileName[0]==0) return GE_USERCANCELED; + confirm2=1; + } + } + } + + error=GSM_SaveBitmapFile(FileName,bitmap); + + switch (error) { + case GE_CANTOPENFILE: fprintf(stderr, _("Failed to write file \"%s\"\n"),FileName); + break; + default: break; + } + + return error; } -/* Main function - handles command line arguments, passes them to separate - functions accordingly. */ -int main(int argc, char *argv[]) +/* mode == 0 -> overwrite + * mode == 1 -> ask + * mode == 2 -> append + */ +int GSM_SaveTextFileOnConsole(char *FileName, char *text, int mode) { - int c, i, rc = -1; - int nargc = argc-2; - char **nargv; + int confirm, confirm2; + char ans[4]; + struct stat buf; + int error; + + /* Ask before overwriting */ + if (mode==1) { + while (stat(FileName, &buf) == 0 && mode==1) { + + confirm=-1; + confirm2=-1; + + while (confirm < 0) { + fprintf(stderr, _("File \"%s\" exists. (O)verwrite, (a)ppend, create (n)ew or (s)kip ? "),FileName); + GetLine(stdin, ans, 4); + if (!strcmp(ans, "O") || !strcmp(ans, "o")) { + mode = 0; + confirm = 1; + } + if (!strcmp(ans, "A") || !strcmp(ans, "a")) { + mode = 2; + confirm = 1; + } + if (!strcmp(ans, "N") || !strcmp(ans, "n")) confirm=2; + if (!strcmp(ans, "S") || !strcmp(ans, "s")) return -1; + } + + if (confirm==2) { + while (confirm2 < 0) { + fprintf(stderr, _("Enter name of new file: ")); + GetLine(stdin, FileName, 50); + if (&FileName[0]==0) return -1; + mode=1; + confirm2=1; + } + } + + } + } + + error=GSM_SaveTextFile(FileName, text, mode); + + switch (error) { + case -1: fprintf(stderr, _("Failed to write file \"%s\"\n"), FileName); + break; + default: break; + } - /* Every option should be in this array. */ - static struct option long_options[] = - { - /* FIXME: these comments are nice, but they would be more usefull as docs for the user */ - /* Display usage. */ - { "help", no_argument, NULL, OPT_HELP }, + return error; +} - /* Display version and build information. */ - { "version", no_argument, NULL, OPT_VERSION }, +int GSM_SendMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[], + bool unicode, bool profile, bool scale) { - /* Monitor mode */ - { "monitor", no_argument, NULL, OPT_MONITOR }, + int w,i; + + struct option options[] = { + { "smscno", required_argument, NULL, '1'}, + { "smsc", required_argument, NULL, '2'}, + { "name", required_argument, NULL, '3'}, + { "unicode", no_argument, NULL, '4'}, + { "profilestyle", no_argument, NULL, '5'}, + { "scale", no_argument, NULL, '6'}, + { NULL, 0, NULL, 0 } + }; + + GSM_Error error; + + for (w=0;wnumber;w++) { + + if (argnum!=0) { + optarg = NULL; + + /* We check optional parameters from ... */ + optind = argnum; -#ifdef SECURITY + while ((i = getopt_long(argc, argv, "v:ds", options, NULL)) != -1) { + switch (i) { - /* Enter Security Code mode */ - { "entersecuritycode", required_argument, NULL, OPT_ENTERSECURITYCODE }, + case '1': /* SMSC number */ + MultiSMS->SMS[w].MessageCenter.No = 0; + strcpy(MultiSMS->SMS[w].MessageCenter.Number,optarg); + break; - // Get Security Code status - { "getsecuritycodestatus", no_argument, NULL, OPT_GETSECURITYCODESTATUS }, + case '2': /* SMSC number index in phone memory */ + MultiSMS->SMS[w].MessageCenter.No = atoi(optarg); -#endif + if (MultiSMS->SMS[w].MessageCenter.No < 1 || MultiSMS->SMS[w].MessageCenter.No > 5) { + fprintf(stderr, _("Incorrect SMSC number with \"smscno\" option (can't be <1 and >5) !\n")); + GSM->Terminate(); + return -1; + } + break; - // Set date and time - { "setdatetime", optional_argument, NULL, OPT_SETDATETIME }, + case '3': /* Receiver/recipient */ + strncpy(MultiSMS->SMS[w].Destination,optarg,11); break; - // Get date and time mode - { "getdatetime", no_argument, NULL, OPT_GETDATETIME }, + case '4': /* Unicode */ + if (unicode) break; - // Set alarm - { "setalarm", required_argument, NULL, OPT_SETALARM }, + case '5': /* Profile */ + if (profile) break; - // Get alarm - { "getalarm", no_argument, NULL, OPT_GETALARM }, + case '6': /* Scale */ + if (scale) break; - // Voice call mode - { "dialvoice", required_argument, NULL, OPT_DIALVOICE }, + case 'v': /* Set validaty of SMS */ + MultiSMS->SMS[w].Validity = atoi(optarg); + break; - // Get calendar note mode - { "getcalendarnote", required_argument, NULL, OPT_GETCALENDARNOTE }, + case 'd': /* delivery report */ + MultiSMS->SMS[w].Type=GST_DR; + break; - // Write calendar note mode - { "writecalendarnote", required_argument, NULL, OPT_WRITECALENDARNOTE }, + case 's': /* Set replying via the same SMSC */ + MultiSMS->SMS[w].ReplyViaSameSMSC = true; break; - // Delete calendar note mode - { "deletecalendarnote", required_argument, NULL, OPT_DELCALENDARNOTE }, + default: + fprintf(stderr,_("Unknown option number %i\n"),argc); + GSM->Terminate(); + return -1; - // Get display status mode - { "getdisplaystatus", no_argument, NULL, OPT_GETDISPLAYSTATUS }, + } + } + } - // Get memory mode - { "getmemory", required_argument, NULL, OPT_GETMEMORY }, + error=GSM->SendSMSMessage(&MultiSMS->SMS[w]); - // Write phonebook (memory) mode - { "writephonebook", optional_argument, NULL, OPT_WRITEPHONEBOOK }, + if (error == GE_SMSSENDOK) { + fprintf(stdout, _("SMS %i/%i sent OK !\n"),w+1,MultiSMS->number); + } else { + fprintf(stdout, _("SMS %i/%i, sending failed (error=%d)\n"),w+1,MultiSMS->number, error); + } - // Get speed dial mode - { "getspeeddial", required_argument, NULL, OPT_GETSPEEDDIAL }, + } - // Set speed dial mode - { "setspeeddial", required_argument, NULL, OPT_SETSPEEDDIAL }, + GSM->Terminate(); - // Get SMS message mode - { "getsms", required_argument, NULL, OPT_GETSMS }, + return 0; +} + +int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[], + bool inter, bool unicode, bool profile, bool scale) { - // Delete SMS message mode - { "deletesms", required_argument, NULL, OPT_DELETESMS }, + int w,i; + + GSM_SMSMessage SMSold; - // Send SMS message mode - { "sendsms", required_argument, NULL, OPT_SENDSMS }, + struct option options[] = { + { "smscno", required_argument, NULL, '1'}, + { "smsc", required_argument, NULL, '2'}, + { "name", required_argument, NULL, '3'}, + { "unicode", no_argument, NULL, '4'}, + { "profilestyle", no_argument, NULL, '5'}, + { "scale", no_argument, NULL, '6'}, + { NULL, 0, NULL, 0 } + }; - // Ssve SMS message mode - { "savesms", optional_argument, NULL, OPT_SAVESMS }, + int interactive; + int confirm = -1; + char ans[8]; - // Send logo as SMS message mode - { "sendlogo", required_argument, NULL, OPT_SENDLOGO }, + GSM_Error error; - // Send ringtone as SMS message - { "sendringtone", required_argument, NULL, OPT_SENDRINGTONE }, + interactive = inter; - // Set ringtone - { "setringtone", required_argument, NULL, OPT_SETRINGTONE }, + for (w=0;wnumber;w++) { - // Get SMS center number mode - { "getsmsc", required_argument, NULL, OPT_GETSMSC }, + if (argnum!=0) { + optarg = NULL; + + /* We check optional parameters from ... */ + optind = argnum; - // For development purposes: run in passive monitoring mode - { "pmon", no_argument, NULL, OPT_PMON }, + while ((i = getopt_long(argc, argv, "risal:", options, NULL)) != -1) { + switch (i) { - // NetMonitor mode - { "netmonitor", required_argument, NULL, OPT_NETMONITOR }, + case '1': /* SMSC number */ + MultiSMS->SMS[w].MessageCenter.No = 0; + strcpy(MultiSMS->SMS[w].MessageCenter.Number,optarg); + break; - // Identify - { "identify", no_argument, NULL, OPT_IDENTIFY }, + case '2': /* SMSC number index in phone memory */ + MultiSMS->SMS[w].MessageCenter.No = atoi(optarg); - // Send DTMF sequence - { "senddtmf", required_argument, NULL, OPT_SENDDTMF }, + if (MultiSMS->SMS[w].MessageCenter.No < 1 || MultiSMS->SMS[w].MessageCenter.No > 5) { + fprintf(stderr, _("Incorrect SMSC number with \"smscno\" option (can't be <1 and >5) !\n")); + GSM->Terminate(); + return -1; + } + break; - // Resets the phone - { "reset", optional_argument, NULL, OPT_RESET }, + case '3': /* Receiver/recipient */ + strncpy(MultiSMS->SMS[w].Destination,optarg,11); break; - // Set logo - { "setlogo", optional_argument, NULL, OPT_SETLOGO }, + case '4': /* Unicode */ + if (unicode) break; - // Get logo - { "getlogo", required_argument, NULL, OPT_GETLOGO }, + case '5': /* Profile */ + if (profile) break; - // View logo - { "viewlogo", required_argument, NULL, OPT_VIEWLOGO }, + case '6': /* Scale */ + if (scale) break; - // Show profile - { "getprofile", optional_argument, NULL, OPT_GETPROFILE }, + case 'r': /* mark as read */ + MultiSMS->SMS[w].Status = GSS_SENTREAD; break; - // Show texts from phone's display - { "displayoutput", no_argument, NULL, OPT_DISPLAYOUTPUT }, + case 'i': /* Save into Inbox */ + MultiSMS->SMS[w].folder = GST_INBOX; break; + + case 's': /* Set replying via the same SMSC */ + MultiSMS->SMS[w].ReplyViaSameSMSC = true; break; - // Simulate pressing the keys - { "keysequence", no_argument, NULL, OPT_KEYPRESS }, + case 'a': /* Ask before overwriting */ + interactive=true;break; + + case 'l': /* Specify location */ + MultiSMS->SMS[0].Location = atoi(optarg); break; + + default: + fprintf(stderr,_("Unknown option number %i\n"),argc); + GSM->Terminate(); + return -1; + } + } + } + + if (interactive && MultiSMS->SMS[0].Location!=0 && w==0) { + SMSold.Location=MultiSMS->SMS[0].Location; + error = GSM->GetSMSMessage(&SMSold); + switch (error) { + case GE_NONE: + fprintf(stderr, _("Message at specified location exists. ")); + while (confirm < 0) { + fprintf(stderr, _("Overwrite? (yes/no) ")); + GetLine(stdin, ans, 7); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no")) confirm = 0; + } + if (!confirm) { GSM->Terminate(); return 0; } + else break; + case GE_INVALIDSMSLOCATION: + fprintf(stderr, _("Invalid location\n")); + GSM->Terminate(); + return -1; + default: +/* FIXME: Remove this fprintf when the function is thoroughly tested */ +#ifdef DEBUG + fprintf(stderr, _("Location %d empty. Saving\n"), SMS[w].Location); +#endif + break; + } + } - /* Divert calls */ - { "divert", required_argument, NULL, OPT_DIVERT }, + error=GSM->SaveSMSMessage(&MultiSMS->SMS[w]); - // For development purposes: insert you function calls here - { "foogle", no_argument, NULL, OPT_FOOGLE }, + if (error == GE_NONE) + fprintf(stdout, _("SMS %i/%i saved at location %i !\n"),w+1,MultiSMS->number,MultiSMS->SMS[w].MessageNumber); + else + fprintf(stdout, _("SMS %i/%i saving failed (error=%d, location=%i)\n"), w+1, MultiSMS->number, error,MultiSMS->SMS[w].Location); + } - { 0, 0, 0, 0}, - }; + GSM->Terminate(); - /* Every command which requires arguments should have an appropriate entry - in this array. */ - struct gnokii_arg_len gals[] = - { + return 0; +} -#ifdef SECURITY - { OPT_ENTERSECURITYCODE, 1, 1, 0 }, +void GSM_PlayRingtoneOnConsole(GSM_Ringtone *ringtone) +{ + int i; +#ifdef VC6 + char mychar; #endif - { OPT_SETDATETIME, 0, 5, 0 }, - { OPT_SETALARM, 2, 2, 0 }, - { OPT_DIALVOICE, 1, 1, 0 }, - { OPT_GETCALENDARNOTE, 1, 3, 0 }, - { OPT_WRITECALENDARNOTE, 2, 2, 0 }, - { OPT_DELCALENDARNOTE, 1, 2, 0 }, - { OPT_GETMEMORY, 2, 3, 0 }, - { OPT_GETSPEEDDIAL, 1, 1, 0 }, - { OPT_SETSPEEDDIAL, 3, 3, 0 }, - { OPT_GETSMS, 2, 5, 0 }, - { OPT_DELETESMS, 2, 3, 0 }, - { OPT_SENDSMS, 1, 10, 0 }, - { OPT_SAVESMS, 0, 6, 0 }, - { OPT_SENDLOGO, 3, 4, GAL_XOR }, - { OPT_SENDRINGTONE, 2, 2, 0 }, - { OPT_GETSMSC, 1, 1, 0 }, - { OPT_GETWELCOMENOTE, 1, 1, 0 }, - { OPT_SETWELCOMENOTE, 1, 1, 0 }, - { OPT_NETMONITOR, 1, 1, 0 }, - { OPT_SENDDTMF, 1, 1, 0 }, - { OPT_SETLOGO, 1, 4, 0 }, - { OPT_GETLOGO, 1, 4, 0 }, - { OPT_VIEWLOGO, 1, 1, 0 }, - { OPT_SETRINGTONE, 1, 1, 0 }, - { OPT_RESET, 0, 1, 0 }, - { OPT_GETPROFILE, 0, 1, 0 }, - { OPT_WRITEPHONEBOOK, 0, 1, 0 }, - { OPT_DIVERT, 6, 10, 0 }, - - { 0, 0, 0, 0 }, - }; - - opterr = 0; - - /* For GNU gettext */ -#ifdef USE_NLS - textdomain("gnokii"); - setlocale(LC_ALL, ""); + for (i=0;iNrNotes;i++) { +#ifdef VC6 + if (_kbhit()) { + mychar=_getch(); + break; + } #endif + GSM_PlayOneNote (ringtone->notes[i]); + } + GSM->PlayTone(255*255,0); +} - /* Read config file */ - if (readconfig(&model, &Port, &Initlength, &Connection, &BinDir) < 0) { - exit(-1); - } +/* This function shows the copyright and some informations usefull for + debugging. */ +int version(void) +{ - /* Introduce yourself */ - short_version(); + fprintf(stdout, _("GNOKII Version %s\n" +"Copyright (C) Hugh Blemings , 1999, 2000\n" +"Copyright (C) Pavel Janík ml. , 1999, 2000\n" +"Built %s %s for %s on %s \n"), VERSION, __TIME__, __DATE__, model, Port); - /* Handle command line arguments. */ - c = getopt_long(argc, argv, "", long_options, NULL); - if (c == -1) /* No argument given - we should display usage. */ - usage(); + return 0; +} - switch(c) { - /* First, error conditions */ - case '?': - case ':': - fprintf(stderr, _("Use '%s --help' for usage informations.\n"), argv[0]); - exit(0); - /* Then, options with no arguments */ - case OPT_HELP: - usage(); - case OPT_VERSION: - version(); - exit(0); - } - - /* We have to build an array of the arguments which will be passed to the - functions. Please note that every text after the --command will be - passed as arguments. A syntax like gnokii --cmd1 args --cmd2 args will - not work as expected; instead args --cmd2 args is passed as a - parameter. */ - if ((nargv = malloc(sizeof(char *) * argc)) != NULL) { - for (i = 2; i < argc; i++) - nargv[i-2] = argv[i]; - - if (checkargs(c, gals, nargc)) { - free(nargv); /* Wrong number of arguments - we should display usage. */ - usage(); - } +/* The function usage is only informative - it prints this program's usage and + command-line options. */ -#ifdef __svr4__ - /* have to ignore SIGALARM */ - sigignore(SIGALRM); -#endif +int usage(void) +{ - /* Initialise the code for the GSM interface. */ - fbusinit(NULL); + fprintf(stdout, _(" usage: gnokii [--help|--monitor [-noloop|-nl]|--version]\n" +" gnokii --getmemory memory_type [start [end]] [-short|-v30|-v21|-v]\n" +" gnokii --writephonebook [-i]\n" +" gnokii --sendphonebookentry destination memory_type location\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" +" gnokii --savephonebookentry memory_type location\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [--name name]\n" +" gnokii --getvoicemailbox\n" +" gnokii --getspeeddial number\n" +" gnokii --setspeeddial number memory_type location\n\n" + +" gnokii --getsms memory_type start [end] [-f file]\n" +" gnokii --getsmsstatus\n" +" gnokii --getsmsfolders\n" +" gnokii --deletesms memory_type start [end]\n" +" gnokii --sendsms destination [--smsc message_center_number |\n" +" --smscno message_center_index] [--long n] [-s] [-C n]\n" +" [--enablevoice|--disablevoice|--enablefax|--disablefax|\n" +" --enableemail|--disableemail|--void][--unicode][-v n][-d]\n" +" gnokii --savesms destination|\"\" [--smsc \n" +" message_center_number] [--smscno message_center_index]\n" +" [--long n] [-r] [-i] [-s][-C n][-a][-l][F n][--smsname name]\n" +" [--enablevoice|--disablevoice|--enablefax|--disablefax|\n" +" --enableemail|--disableemail|--void|--hang|--bug][--unicode]\n" +" gnokii --receivesms\n" +" gnokii --getsmsc message_center_number\n" +" gnokii --renamesmsc number new_name\n\n" + +" gnokii --setdatetime [YYYY [MM [DD [HH [MM]]]]]\n" +" gnokii --getdatetime\n" +" gnokii --setalarm HH MM\n" +" gnokii --getalarm\n\n" + +" gnokii --getcalendarnote { start end [-v30|-v10] | --short|-s }\n" +" gnokii --writecalendarnote vcardfile number\n" +" gnokii --deletecalendarnote index\n" +" gnokii --sendcalendarnote destination vcardfile number\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" +" gnokii --savecalendarnote vcardfile number\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [--name name]\n\n" + +" gnokii --netmonitor {reset|off|field|devel|next|nr}\n" +" gnokii --nm_collect screen1|-d [screen2|-d]...\n" +" gnokii --netmonitordata [-S file] [-I file] [-h] [-n n] [-ts n][-tm n]\n" +" [-fs str] [-ls str] FLD1:FLD2:FLDn:... \n" +" (see files netmonitordata_????_??? for details)\n\n" + +" gnokii --bitmapconvert source destination\n" +" gnokii --bitmapconvert source destination op|7110op [network code]\n" +" gnokii --bitmapconvert source destination caller [caller group number]\n" +" gnokii --bitmapconvert source destination\n" +" startup|7110startup|6210startup\n" +" gnokii --bitmapconvert source destination picture\n" +" gnokii --showbitmap logofile\n" +" gnokii --sendlogo op destination logofile network_code\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" +" gnokii --sendlogo picture destination logofile text\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d] [--unicode]\n" +" gnokii --sendlogo screensaver destination logofile\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" +" gnokii --sendlogo caller destination logofile\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" +" gnokii --savelogo op logofile network_code\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [-l] [--name name]\n" +" gnokii --savelogo picture logofile text\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [-l] [--name name] [--unicode]\n" +" gnokii --savelogo screensaver logofile\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [-l] [--name name]\n" +" gnokii --savelogo caller logofile\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [-l] [--name name]\n" +" gnokii --setlogo op|7110op [logofile] [network code]\n" +" gnokii --setlogo startup|7110startup|6210startup [logofile]\n" +" gnokii --setlogo startup 1|2|3\n" +" gnokii --setlogo caller [logofile] [caller group number] [group name]\n" +" gnokii --setlogo picture [logofile] [number] [text] [sender]\n" +" gnokii --setlogo {dealer|text} [text]\n" +" gnokii --getlogo op|7110op [logofile] [network code]\n" +" gnokii --getlogo startup|7110startup|6210startup [logofile]\n" +" gnokii --getlogo caller [logofile][caller group number]\n" +" gnokii --getlogo picture [logofile][number]\n" +" gnokii --getlogo {dealer|text}\n\n" + +" gnokii --sendringtone destination ringtonefile\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d] [--scale] [--profilestyle]\n" +" gnokii --saveringtone ringtonefile\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [--name name] [--scale] [--profilestyle]\n" +" gnokii --setringtone ringtonefile [location]\n" +" gnokii --getringtone ringtonefile [location]\n" +" gnokii --ringtoneconvert source destination\n" +" gnokii --binringtoneconvert source destination\n" +" gnokii --playringtone ringtonefile\n" +" gnokii --composer ringtonefile\n" +" gnokii --allringtones\n\n" + +" gnokii --getprofile [number]\n" +" gnokii --setprofile number feature value\n" +" gnokii --sendprofile destination profile_name ringtonefile\n" +" picturefile [--smsc message_center_number]\n" +" [--smscno message_center_index] [-s] [-v n] [-d] [--scale]\n\n" + +" gnokii --reset [soft|hard]\n" +" gnokii --dialvoice number\n" +" gnokii --cancelcall\n" +" gnokii --displayoutput\n" +" gnokii --presskeysequence sequence\n" +" gnokii --backupsettings file\n" +" gnokii --restoresettings file\n" +" gnokii --getphoneprofile\n" +" gnokii --setphoneprofile feature value\n" +" gnokii --getoperatorname\n" +" gnokii --setoperatorname code name\n" +" gnokii --senddtmf string\n" +" gnokii --divert register|enable|query|disable|erasure\n" +" all|busy|noans|outofreach all|voice|fax|data\n" +" [number timeout]\n\n" + +" gnokii --phonetests\n" +" gnokii --simlock\n" +" gnokii --getdisplaystatus\n" +" gnokii --identify\n\n" + +" gnokii --getwapbookmark location\n" +" gnokii --setwapbookmark title url [location]\n" +" gnokii --sendwapbookmark location destination\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" +" gnokii --savewapbookmark location\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [-l] [--name name]\n" +" gnokii --getwapsettings location\n" +" gnokii --savewapsettings location\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-r] [-i] [-s] [-a] [-l] [--name name]\n" +" gnokii --sendwapsettings location destination\n" +" [--smsc message_center_number] [--smscno message_center_index]\n" +" [-s] [-v n] [-d]\n" + )); - switch(c) { - case OPT_MONITOR: - rc = monitormode(); - break; #ifdef SECURITY - case OPT_ENTERSECURITYCODE: - rc = entersecuritycode(optarg); - break; - case OPT_GETSECURITYCODESTATUS: - rc = getsecuritycodestatus(); - break; -#endif - case OPT_GETDATETIME: - rc = getdatetime(); - break; - case OPT_GETALARM: - rc = getalarm(); - break; - case OPT_GETDISPLAYSTATUS: - rc = getdisplaystatus(); - break; - case OPT_PMON: - rc = pmon(); - break; - case OPT_WRITEPHONEBOOK: - rc = writephonebook(nargc, nargv); - break; - /* Now, options with arguments */ - case OPT_SETDATETIME: - rc = setdatetime(nargc, nargv); - break; - case OPT_SETALARM: - rc = setalarm(nargv); - break; - case OPT_DIALVOICE: - rc = dialvoice(optarg); - break; - case OPT_GETCALENDARNOTE: - rc = getcalendarnote(nargc, nargv); - break; - case OPT_DELCALENDARNOTE: - rc = deletecalendarnote(nargc, nargv); - break; - case OPT_WRITECALENDARNOTE: - rc = writecalendarnote(nargv); - break; - case OPT_GETMEMORY: - rc = getmemory(nargc, nargv); - break; - case OPT_GETSPEEDDIAL: - rc = getspeeddial(optarg); - break; - case OPT_SETSPEEDDIAL: - rc = setspeeddial(nargv); - break; - case OPT_GETSMS: - rc = getsms(argc, argv); - break; - case OPT_DELETESMS: - rc = deletesms(nargc, nargv); - break; - case OPT_SENDSMS: - rc = sendsms(nargc, nargv); - break; - case OPT_SAVESMS: - rc = savesms(argc, argv); - break; - case OPT_SENDLOGO: - rc = sendlogo(nargc, nargv); - break; - case OPT_GETSMSC: - rc = getsmsc(optarg); - break; - case OPT_NETMONITOR: - rc = netmonitor(optarg); - break; - case OPT_IDENTIFY: - rc = identify(); - break; - case OPT_SETLOGO: - rc = setlogo(nargc, nargv); - break; - case OPT_GETLOGO: - rc = getlogo(nargc, nargv); - break; - case OPT_VIEWLOGO: - rc = viewlogo(optarg); - break; - case OPT_SETRINGTONE: - rc = setringtone(nargc, nargv); - break; - case OPT_SENDRINGTONE: - rc = sendringtone(nargc, nargv); - break; - case OPT_GETPROFILE: - rc = getprofile(nargc, nargv); - break; - case OPT_DISPLAYOUTPUT: - rc = displayoutput(); - break; - case OPT_KEYPRESS: - rc = presskeysequence(); - break; - case OPT_SENDDTMF: - rc = senddtmf(optarg); - break; - case OPT_RESET: - rc = reset(optarg); - break; - case OPT_DIVERT: - rc = divert(argc, argv); - break; -#ifndef WIN32 - case OPT_FOOGLE: - rc = foogle(nargv); - break; + fprintf(stdout, _( +"\n gnokii --entersecuritycode PIN|PIN2|PUK|PUK2\n" +" gnokii --getsecuritycodestatus\n" +" gnokii --getsecuritycode PIN|PIN2|PUK|PUK2|SecurityCode\n" +" gnokii --geteeprom\n" +" gnokii --resetphonesettings\n" + )); #endif - default: - fprintf(stderr, _("Unknown option: %d\n"), c); - break; - } - return(rc); - } +#ifdef DEBUG + fprintf(stdout, _( +" gnokii --sniff [port]\n" +" gnokii --decodefile file\n" + )); +#endif - fprintf(stderr, _("Wrong number of arguments\n")); - exit(-1); + return 0; } -/* Send SMS messages. */ -int sendsms(int argc, char *argv[]) -{ - GSM_SMSMessage SMS; - GSM_Error error; - // char UDH[GSM_MAX_USER_DATA_HEADER_LENGTH]; - /* The maximum length of an uncompressed concatenated short message is - 255 * 153 = 39015 default alphabet characters */ - char message_buffer[255 * GSM_MAX_SMS_LENGTH]; - int input_len, chars_read; - int i; /*, offset, nr_msg, aux;*/ - - struct option options[] = { - { "smsc", required_argument, NULL, '1'}, - { "smscno", required_argument, NULL, '2'}, - { "long", required_argument, NULL, '3'}, - { NULL, 0, NULL, 0} - }; - - input_len = GSM_MAX_SMS_LENGTH; - - /* Default settings: - - no delivery report - - no Class Message - - no compression - - 7 bit data - - SMSC no. 1 - - message validity for 3 days - - unset user data header indicator - */ - - memset(&SMS, 0, sizeof(GSM_SMSMessage)); - - SMS.Type = SMS_Submit; - SMS.DCS.Type = SMS_GeneralDataCoding; - SMS.DCS.u.General.Compressed = false; - SMS.DCS.u.General.Alphabet = SMS_DefaultAlphabet; - SMS.DCS.u.General.Class = 0; - SMS.MessageCenter.No = 1; - SMS.Validity.VPF = SMS_RelativeFormat; - SMS.Validity.u.Relative = 4320; /* 4320 minutes == 72 hours */ - SMS.UDH_No = 0; - SMS.Report = false; - - strcpy(SMS.RemoteNumber.number, argv[0]); - if (SMS.RemoteNumber.number[0] == '+') SMS.RemoteNumber.type = SMS_International; - else SMS.RemoteNumber.type = SMS_Unknown; - - optarg = NULL; - optind = 0; - - while ((i = getopt_long(argc, argv, "r8cC:v:", options, NULL)) != -1) { - switch (i) { // -8 is for 8-bit data, -c for compression. both are not yet implemented. - case '1': /* SMSC number */ - SMS.MessageCenter.No = 0; - strcpy(SMS.MessageCenter.Number, optarg); - if (SMS.MessageCenter.Number[0] == '+') SMS.MessageCenter.Type = SMS_International; - else SMS.MessageCenter.Type = SMS_Unknown; - break; - case '2': /* SMSC number index in phone memory */ - SMS.MessageCenter.No = atoi(optarg); - - if (SMS.MessageCenter.No < 1 || SMS.MessageCenter.No > 5) - usage(); - data.MessageCenter = &SMS.MessageCenter; - error = SM_Functions(GOP_GetSMSCenter, &data, &State); - break; - case '3': /* we send long message */ - input_len = atoi(optarg); - if (input_len > 255 * GSM_MAX_SMS_LENGTH) { - fprintf(stderr, _("Input too long!\n")); - exit(-1); - } - break; - case 'r': /* request for delivery report */ - SMS.Report = true; - break; - case 'C': /* class Message */ - switch (*optarg) { - case '0': - SMS.DCS.u.General.Class = 1; - break; - case '1': - SMS.DCS.u.General.Class = 2; - break; - case '2': - SMS.DCS.u.General.Class = 3; - break; - case '3': - SMS.DCS.u.General.Class = 4; - break; - default: - usage(); - } - break; - case 'v': - SMS.Validity.u.Relative = atoi(optarg); - break; - default: - usage(); /* Would be better to have an sendsms_usage() here. */ - } - } +/* fbusinit is the generic function which waits for the FBUS link. The limit + is 10 seconds. After 10 seconds we quit. */ - /* Get message text from stdin. */ - chars_read = fread(message_buffer, 1, input_len, stdin); +void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) +{ - if (chars_read == 0) { - fprintf(stderr, _("Couldn't read from stdin!\n")); - return -1; - } else if (chars_read > input_len) { - fprintf(stderr, _("Input too long!\n")); - return -1; - } + int count=0; + GSM_Error error; - /* Null terminate. */ - message_buffer[chars_read] = 0x00; - strncpy(SMS.MessageText, message_buffer, chars_read); - data.SMSMessage = &SMS; +#ifndef WIN32 + if (strcmp(GetMygnokiiVersion(),VERSION)!=0) + fprintf(stderr,_("WARNING: version of installed libmygnokii.so (%s) is different to version of gnokii (%s)\n"),GetMygnokiiVersion(),VERSION); +#endif - /* Send the message. */ - error = SM_Functions(GOP_SendSMS, &data, &State); + /* Initialise the code for the GSM interface. */ + error = GSM_Initialise(model, Port, Initlength, GetConnectionTypeFromString(Connection), rlp_handler, SynchronizeTime); - if (error == GE_SMSSENDOK) { - fprintf(stdout, _("Send succeeded!\n")); - } else { - fprintf(stdout, _("SMS Send failed (error=%d)\n"), error); - } + if (error != GE_NONE) { + fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); + exit(-1); + } - if (GSM && GSM->Terminate) GSM->Terminate(); + /* First (and important!) wait for GSM link to be active. We allow 10 + seconds... */ + while (count++ < 200 && *GSM_LinkOK == false) + usleep(50000); - return 0; + if (*GSM_LinkOK == false) { + fprintf (stderr, _("Hmmm... GSM_LinkOK never went true. Quitting.\n")); + exit(-1); + } } -int savesms(int argc, char *argv[]) +/* This function checks that the argument count for a given options is withing + an allowed range. */ + +int checkargs(int opt, struct gnokii_arg_len gals[], int argc) { - GSM_SMSMessage SMS; - GSM_Error error; - /* The maximum length of an uncompressed concatenated short message is - 255 * 153 = 39015 default alphabet characters */ - char message_buffer[255 * GSM_MAX_SMS_LENGTH]; - int input_len, chars_read; - int i, confirm = -1; - int interactive = 0; - char ans[8]; - - /* Defaults */ - SMS.Type = SMS_Deliver; - SMS.DCS.Type = SMS_GeneralDataCoding; - SMS.DCS.u.General.Compressed = false; - SMS.DCS.u.General.Alphabet = SMS_DefaultAlphabet; - SMS.DCS.u.General.Class = 0; - SMS.MessageCenter.No = 1; - SMS.Validity.VPF = SMS_RelativeFormat; - SMS.Validity.u.Relative = 4320; /* 4320 minutes == 72 hours */ - SMS.UDH_No = 0; - SMS.Status = SMS_Unsent; - SMS.Number = 0; - - input_len = GSM_MAX_SMS_LENGTH; - - /* Option parsing */ - while ((i = getopt(argc, argv, "ml:in:s:c:")) != -1) { - switch (i) { - case 'm': /* mark the message as sent */ - SMS.Status = SMS_Sent; - break; - case 'l': /* Specify the location */ - SMS.Number = atoi(optarg); - break; - case 'i': /* Ask before overwriting */ - interactive = 1; - break; - case 'n': /* Specify the from number */ - break; - case 's': /* Specify the smsc number */ - break; - case 'c': /* Specify the smsc location */ - break; - default: - usage(); - return -1; - } - } - if (interactive) { - GSM_SMSMessage aux; - - aux.Number = SMS.Number; - data.SMSMessage = &aux; - error = SM_Functions(GOP_GetSMS, &data, &State); - switch (error) { - case GE_NONE: - fprintf(stderr, _("Message at specified location exists. ")); - while (confirm < 0) { - fprintf(stderr, _("Overwrite? (yes/no) ")); - GetLine(stdin, ans, 7); - if (!strcmp(ans, _("yes"))) confirm = 1; - else if (!strcmp(ans, _("no"))) confirm = 0; - } - if (!confirm) { - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; - } - else break; - case GE_INVALIDSMSLOCATION: - fprintf(stderr, _("Invalid location\n")); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - default: - dprintf("Location %d empty. Saving\n", SMS.Number); - break; - } - } - chars_read = fread(message_buffer, 1, input_len, stdin); + int i; - if (chars_read == 0) { + /* Walk through the whole array with options requiring arguments. */ - fprintf(stderr, _("Couldn't read from stdin!\n")); - return -1; + for(i = 0;!(gals[i].gal_min == 0 && gals[i].gal_max == 0); i++) { - } else if (chars_read > input_len) { + /* Current option. */ - fprintf(stderr, _("Input too long!\n")); - return -1; + if(gals[i].gal_opt == opt) { - } + /* Argument count checking. */ - strncpy (SMS.MessageText, message_buffer, chars_read); - SMS.MessageText[chars_read] = 0; + if(gals[i].gal_flags == GAL_XOR) { + if(gals[i].gal_min == argc || gals[i].gal_max == argc) return 0; + } + else { + if(gals[i].gal_min <= argc && gals[i].gal_max >= argc) return 0; + } - error = GSM->SaveSMSMessage(&SMS); + return 1; - if (error == GE_NONE) { - fprintf(stdout, _("Saved!\n")); - } else { - fprintf(stdout, _("Saving failed (error=%d)\n"), error); - } - sleep(10); - if (GSM && GSM->Terminate) GSM->Terminate(); + } - return 0; + } + + /* We do not have options without arguments in the array, so check them. */ + + if (argc==0) return 0; + else return 1; } -/* Get SMSC number */ -int getsmsc(char *MessageCenterNumber) +/* Main function - handles command line arguments, passes them to separate + functions accordingly. */ + +int main(int argc, char *argv[]) { - SMS_MessageCenter MessageCenter; - GSM_Data data; - GSM_Error error; - - memset(&MessageCenter, 0, sizeof(MessageCenter)); - MessageCenter.No = atoi(MessageCenterNumber); - - if (GSM && GSM->GetSMSCenter && GSM->Terminate) { - error = GSM->GetSMSCenter(&MessageCenter); - GSM->Terminate(); - } else { - GSM_DataClear(&data); - data.MessageCenter = &MessageCenter; - error = SM_Functions(GOP_GetSMSCenter, &data, &State); - } + + int c, i, rc = -1; + int nargc = argc-2; + char **nargv; + + /* Every option should be in this array. */ + + static struct option long_options[] = + { + + { "help", no_argument, NULL, OPT_HELP },// Display usage. + { "version", no_argument, NULL, OPT_VERSION },// Display version and build information. + { "getsmsfolders", no_argument, NULL, OPT_GETSMSFOLDERS },// Gets SMS folders + { "getsmsstatus", no_argument, NULL, OPT_GETSMSSTATUS },// Get SMS Folder Status + { "identify", no_argument, NULL, OPT_IDENTIFY },// Identify + { "pmon", no_argument, NULL, OPT_PMON },// For development purposes: run in passive monitoring mode + { "foogle", no_argument, NULL, OPT_FOOGLE },// For development purposes: insert you function calls here + { "getdatetime", no_argument, NULL, OPT_GETDATETIME },// Get date and time mode + { "getalarm", no_argument, NULL, OPT_GETALARM },// Get alarm + { "cancelcall", no_argument, NULL, OPT_CANCELCALL },// Cancel Call + { "getdisplaystatus", no_argument, NULL, OPT_GETDISPLAYSTATUS },// Get display status mode + { "allringtones", no_argument, NULL, OPT_ALLRINGTONES },/* Displays names of available ringtones */ + { "displayoutput", no_argument, NULL, OPT_DISPLAYOUTPUT },/* Show texts from phone's display */ + { "getphoneprofile", no_argument, NULL, OPT_GETPHONEPROFILE },/* Get/Set phone profile settings */ + { "getoperatorname", no_argument, NULL, OPT_GETOPERATORNAME },/* Get downloaded operator name */ + { "getvoicemailbox", no_argument, NULL, OPT_GETVOICEMAILBOX },/* Gets voice mailbox number */ + { "phonetests", no_argument, NULL, OPT_PHONETESTS }, + { "simlockinfo", no_argument, NULL, OPT_SIMLOCKINFO }, + { "receivesms", no_argument, NULL, OPT_RECEIVESMS }, + { "setoperatorname", optional_argument, NULL, OPT_SETOPERATORNAME },/* Set downloaded operator name */ + { "setdatetime", optional_argument, NULL, OPT_SETDATETIME },// Set date and time + { "writephonebook", optional_argument, NULL, OPT_WRITEPHONEBOOK },// Write phonebook (memory) mode + { "reset", optional_argument, NULL, OPT_RESET },// Resets the phone + { "monitor", optional_argument, NULL, OPT_MONITOR },// Monitor mode + { "setlogo", optional_argument, NULL, OPT_SETLOGO },// Set logo + { "getprofile", optional_argument, NULL, OPT_GETPROFILE },// Show profile + { "setalarm", required_argument, NULL, OPT_SETALARM },// Set alarm + { "dialvoice", required_argument, NULL, OPT_DIALVOICE },// Voice call mode + { "getcalendarnote", required_argument, NULL, OPT_GETCALENDARNOTE },// Get calendar note mode + { "writecalendarnote", required_argument, NULL, OPT_WRITECALENDARNOTE},// Write calendar note mode + { "sendcalendarnote", required_argument, NULL, OPT_SENDCALENDARNOTE }, + { "savecalendarnote", required_argument, NULL, OPT_SAVECALENDARNOTE }, + { "sendphonebookentry", required_argument, NULL, OPT_SENDPHONEBOOKENTRY}, + { "savephonebookentry", required_argument, NULL, OPT_SAVEPHONEBOOKENTRY}, + { "deletecalendarnote", required_argument, NULL, OPT_DELCALENDARNOTE },// Delete calendar note mode + { "getmemory", required_argument, NULL, OPT_GETMEMORY },// Get memory mode + { "getspeeddial", required_argument, NULL, OPT_GETSPEEDDIAL },// Get speed dial mode + { "setspeeddial", required_argument, NULL, OPT_SETSPEEDDIAL },// Set speed dial mode + { "getsms", required_argument, NULL, OPT_GETSMS },// Get SMS message mode + { "deletesms", required_argument, NULL, OPT_DELETESMS },// Delete SMS message mode + { "sendsms", required_argument, NULL, OPT_SENDSMS },// Send SMS message mode + { "savesms", required_argument, NULL, OPT_SAVESMS },// Save SMS message mode + { "sendlogo", required_argument, NULL, OPT_SENDLOGO },// Send logo as SMS message mode + { "savelogo", required_argument, NULL, OPT_SAVELOGO },// Save logo on SIM + { "sendringtone", required_argument, NULL, OPT_SENDRINGTONE },// Send ringtone as SMS message + { "saveringtone", required_argument, NULL, OPT_SAVERINGTONE },// Saves ringtone on SIM + { "setringtone", required_argument, NULL, OPT_SETRINGTONE },// Set ringtone + { "getringtone", required_argument, NULL, OPT_GETRINGTONE },// Get bin/normal ringtone + { "presskeysequence", required_argument, NULL, OPT_PRESSKEYSEQUENCE },/* Presses keys in phone's display */ + { "getsmsc", required_argument, NULL, OPT_GETSMSC },// Get SMS center number mode + { "renamesmsc", required_argument, NULL, OPT_RENAMESMSC },// Rename SMSC + { "netmonitor", required_argument, NULL, OPT_NETMONITOR },// NetMonitor mode + { "senddtmf", required_argument, NULL, OPT_SENDDTMF },// Send DTMF sequence + { "getlogo", required_argument, NULL, OPT_GETLOGO },// Get logo + { "setprofile", required_argument, NULL, OPT_SETPROFILE },// Set profile feature + { "sendprofile", required_argument, NULL, OPT_SENDPROFILE },// Send profile via SMS + { "setphoneprofile", required_argument, NULL, OPT_SETPHONEPROFILE },/* Get/Set phone profile settings */ + { "restoresettings", required_argument, NULL, OPT_RESTORESETTINGS },//Restore various settings from one file + { "backupsettings", required_argument, NULL, OPT_BACKUPSETTINGS },//Backup various settings to one file + { "playringtone", required_argument, NULL, OPT_PLAYRINGTONE },/* Plays ringtones */ + { "composer", required_argument, NULL, OPT_COMPOSER },/* Shows ringtone like in Nokia Composer */ + { "ringtoneconvert", required_argument, NULL, OPT_RINGTONECONVERT },/* Convert ringtone files */ + { "binringtoneconvert", required_argument, NULL, OPT_BINRINGTONECONVERT},/* Convert binary ringtone files */ + { "bitmapconvert", required_argument, NULL, OPT_BITMAPCONVERT },/* Convert bitmap files */ + { "showbitmap", required_argument, NULL, OPT_SHOWBITMAP }, + { "nm_collect", required_argument, NULL, OPT_NM_COLLECT },// NetMonitor periodical data collection mode (newbiee) + { "netmonitordata", required_argument, NULL, OPT_NETMONITORDATA },// NetMonitor periodical data collection mode (advanced) + { "getwapbookmark", required_argument, NULL, OPT_GETWAPBOOKMARK }, + { "setwapbookmark", required_argument, NULL, OPT_SETWAPBOOKMARK }, + { "savewapbookmark", required_argument, NULL, OPT_SAVEWAPBOOKMARK }, + { "savewapsettings", required_argument, NULL, OPT_SAVEWAPSETTINGS }, + { "sendwapsettings", required_argument, NULL, OPT_SENDWAPSETTINGS }, + { "sendwapbookmark", required_argument, NULL, OPT_SENDWAPBOOKMARK }, + { "getwapsettings", required_argument, NULL, OPT_GETWAPSETTINGS }, + { "divert", required_argument, NULL, OPT_DIVERT }, + +#ifdef SECURITY + { "entersecuritycode", required_argument, NULL, OPT_ENTERSECURITYCODE },// Enter Security Code mode + { "getsecuritycode", required_argument, NULL, OPT_GETSECURITYCODE },// Get Security Code + { "getsecuritycodestatus",no_argument, NULL, OPT_GETSECURITYCODESTATUS},// Get Security Code status + { "geteeprom", no_argument, NULL, OPT_GETEEPROM },// Gets EEPROM + { "resetphonesettings", no_argument, NULL, OPT_RESETPHONESETTINGS },// Reset phone settings + { "setsimlock", no_argument, NULL, OPT_SETSIMLOCK },// Sets simlock +#endif + +#ifdef DEBUG + { "sniff", optional_argument, NULL, OPT_SNIFFER },// Will show datas from port + { "decodefile", required_argument, NULL, OPT_DECODEFILE },//decode input file +#endif + + { 0, 0, 0, 0}, + }; + + /* Every command which requires arguments should have an appropriate entry + in this array. */ - switch (error) { - case GE_NONE: - fprintf(stdout, _("%d. SMS center (%s) number is %s\n"), MessageCenter.No, MessageCenter.Name, MessageCenter.Number); - fprintf(stdout, _("Default recipient number is %s\n"), MessageCenter.Recipient); - fprintf(stdout, _("Messages sent as ")); - - switch (MessageCenter.Format) { - case SMS_Text: - fprintf(stdout, _("Text")); - break; - case SMS_VoiceMail: - fprintf(stdout, _("VoiceMail")); - break; - case SMS_Fax: - fprintf(stdout, _("Fax")); - break; - case SMS_Email: -// case GSMF_UCI: - fprintf(stdout, _("Email")); - break; -/* case GSMF_ERMES: - fprintf(stdout, _("ERMES")); - break; - case GSMF_X400: - fprintf(stdout, _("X.400")); - break; */ - default: - fprintf(stdout, _("Unknown")); - break; - } - - printf("\n"); - fprintf(stdout, _("Message validity is ")); - - switch (MessageCenter.Validity) { - case SMS_V1H: - fprintf(stdout, _("1 hour")); - break; - case SMS_V6H: - fprintf(stdout, _("6 hours")); - break; - case SMS_V24H: - fprintf(stdout, _("24 hours")); - break; - case SMS_V72H: - fprintf(stdout, _("72 hours")); - break; - case SMS_V1W: - fprintf(stdout, _("1 week")); - break; - case SMS_VMax: - fprintf(stdout, _("Maximum time")); - break; - default: - fprintf(stdout, _("Unknown")); - break; - } - - fprintf(stdout, "\n"); - - break; - case GE_NOTIMPLEMENTED: - fprintf(stderr, _("Function not implemented in %s model!\n"), model); - break; - default: - fprintf(stdout, _("SMS center can not be found :-(\n")); - break; - } + struct gnokii_arg_len gals[] = + { + + { OPT_MONITOR, 0, 1, 0 }, + +#ifdef SECURITY + { OPT_ENTERSECURITYCODE, 1, 1, 0 }, + { OPT_GETSECURITYCODE, 1, 1, 0 }, +#endif + +#ifdef DEBUG + { OPT_SNIFFER, 0, 1, 0 }, + { OPT_DECODEFILE, 1, 1, 0 }, +#endif + + { OPT_SETDATETIME, 0, 5, 0 }, + { OPT_BACKUPSETTINGS, 1, 1, 0 }, + { OPT_RESTORESETTINGS, 1, 1, 0 }, + { OPT_SETALARM, 2, 2, 0 }, + { OPT_DIALVOICE, 1, 1, 0 }, + { OPT_GETCALENDARNOTE, 1, 3, 0 }, + { OPT_WRITECALENDARNOTE, 2, 2, 0 }, + { OPT_SAVECALENDARNOTE, 2, 9, 0 }, + { OPT_SENDCALENDARNOTE, 3, 9, 0 }, + { OPT_SAVEPHONEBOOKENTRY,2, 9, 0 }, + { OPT_SENDPHONEBOOKENTRY,3, 9, 0 }, + { OPT_DELCALENDARNOTE, 1, 1, 0 }, + { OPT_GETMEMORY, 2, 4, 0 }, + { OPT_GETSPEEDDIAL, 1, 1, 0 }, + { OPT_SETSPEEDDIAL, 3, 3, 0 }, + { OPT_GETSMS, 2, 5, 0 }, + { OPT_DELETESMS, 2, 3, 0 }, + { OPT_SENDSMS, 1,10, 0 }, + { OPT_SAVESMS, 1,11, 0 }, + { OPT_SENDLOGO, 3, 9, 0 }, + { OPT_SAVELOGO, 2,10, 0 }, + { OPT_SENDRINGTONE, 2, 7, 0 }, + { OPT_SAVERINGTONE, 1, 9, 0 }, + { OPT_GETSMSC, 1, 1, 0 }, + { OPT_RENAMESMSC, 2, 2, 0 }, + { OPT_NETMONITOR, 1, 1, 0 }, + { OPT_SENDDTMF, 1, 1, 0 }, + { OPT_SETLOGO, 1, 5, 0 }, + { OPT_GETLOGO, 1, 4, 0 }, + { OPT_SETRINGTONE, 1, 3, 0 }, + { OPT_GETRINGTONE, 1, 2, 0 }, + { OPT_PRESSKEYSEQUENCE, 1, 1, 0 }, + { OPT_RESET, 0, 1, 0 }, + { OPT_GETPROFILE, 0, 1, 0 }, + { OPT_SETPROFILE, 3, 3, 0 }, + { OPT_SENDPROFILE, 4,10, 0 }, + { OPT_WRITEPHONEBOOK, 0, 1, 0 }, + { OPT_PLAYRINGTONE, 1, 1, 0 }, + { OPT_COMPOSER, 1, 1, 0 }, + { OPT_RINGTONECONVERT, 2, 2, 0 }, + { OPT_BINRINGTONECONVERT,2, 2, 0 }, + { OPT_BITMAPCONVERT, 2, 4, 0 }, + { OPT_SHOWBITMAP, 1, 1, 0 }, + { OPT_SETOPERATORNAME, 0, 2, 0 }, + { OPT_SETPHONEPROFILE, 2, 2, 0 }, + { OPT_NM_COLLECT, 1, MAX_NM_COLLECT, 0 }, + { OPT_NETMONITORDATA, 0,99, 0 }, + { OPT_GETWAPBOOKMARK, 1, 1, 0 }, + { OPT_SETWAPBOOKMARK, 2, 3, 0 }, + { OPT_SAVEWAPBOOKMARK, 1, 9, 0 }, + { OPT_SENDWAPBOOKMARK, 2, 9, 0 }, + { OPT_GETWAPSETTINGS, 1, 1, 0 }, + { OPT_SAVEWAPSETTINGS, 1, 9, 0 }, + { OPT_SENDWAPSETTINGS, 2, 9, 0 }, + { OPT_DIVERT, 3, 5, 0 }, + + { 0, 0, 0, 0 }, + }; + + opterr = 0; + + /* For GNU gettext */ + +#ifdef USE_NLS +#ifndef VC6 + textdomain("gnokii"); + setlocale(LC_ALL, "pl_PL"); //here is string for Polish localisation +#else + setlocale(LC_ALL, ".852"); //Polish codepage for console, not "real" WIN CP +#endif + +#endif + + /* Read config file */ + if (CFG_ReadConfig(&model, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,false) < 0) { + exit(-1); + } + + /* Handle command line arguments. */ + + c = getopt_long(argc, argv, "", long_options, NULL); + + if (c == -1) { + + /* No argument given - we should display usage. */ + usage(); + exit(-1); + } + + /* We have to build an array of the arguments which will be passed to the + functions. Please note that every text after the --command will be + passed as arguments. A syntax like gnokii --cmd1 args --cmd2 args will + not work as expected; instead args --cmd2 args is passed as a + parameter. */ + + if((nargv = malloc(sizeof(char *) * argc)) != NULL) { + + for(i = 2; i < argc; i++) + nargv[i-2] = argv[i]; - return error; -} + if(checkargs(c, gals, nargc)) { -/* Get SMS messages. */ -int getsms(int argc, char *argv[]) -{ - int del = 0; - SMS_Folder folder; - SMS_FolderList folderlist; - GSM_SMSMessage message; - char *memory_type_string; - int start_message, end_message, count, mode = 1; - char filename[64]; - GSM_Error error; - GSM_Bitmap bitmap; - char ans[5]; - struct stat buf; - - /* Handle command line args that set type, start and end locations. */ - memory_type_string = argv[2]; - message.MemoryType = StrToMemoryType(memory_type_string); - if (message.MemoryType == GMT_XX) { - fprintf(stderr, _("Unknown memory type %s (use ME, SM, ...)!\n"), argv[2]); - return (-1); - } + free(nargv); - memset(&filename, 0, 64); + /* Wrong number of arguments - we should display usage. */ + usage(); + exit(-1); + } - start_message = end_message = atoi(argv[3]); - if (argc > 4) { - int i; +#ifndef VC6 +#if defined(__svr4__) + /* have to ignore SIGALARM */ + sigignore(SIGALRM); +#endif +#endif - /* [end] can be only argv[4] */ - if (argv[4][0] != '-') { - end_message = atoi(argv[4]); - } + switch(c) { - /* parse all options (beginning with '-' */ - while ((i = getopt(argc, argv, "f:F:d")) != -1) { - switch (i) { - case 'd': - del = 1; - break; - case 'F': - mode = 0; - case 'f': - if (optarg) { - fprintf(stderr, _("Saving into %s\n"), optarg); - strncpy(filename, optarg, 64); - if (strlen(optarg) > 63) { - fprintf(stderr, _("Filename too long - will be truncated to 63 characters.\n")); - filename[63] = 0; - } else { - filename[strlen(optarg)] = 0; - } - } else usage(); - break; - default: - usage(); - } - } - } - data.SMSFolderList = &folderlist; - folder.FolderID = 0; - data.SMSFolder = &folder; - /* Now retrieve the requested entries. */ - for (count = start_message; count <= end_message; count ++) { - int offset = 0; - - message.Number = count; - data.SMSMessage = &message; - dprintf("MemoryType (gnokii.c) : %i\n", data.SMSMessage->MemoryType); - error = SM_Functions(GOP_GetSMS, &data, &State); - - switch (error) { - case GE_NONE: - switch (message.Type) { - case SMS_Text: - fprintf(stdout, _("%d. MO Message "), message.Number); - if (message.Status) - fprintf(stdout, _("(sent)\n")); - fprintf(stdout, _("%d. MO Message "), message.Number); - if (message.Status) - fprintf(stdout, _("(not sent)\n")); - fprintf(stdout, _("Text: %s\n\n"), message.MessageText); - break; - case SMS_Delivery_Report: - fprintf(stdout, _("%d. Delivery Report "), message.Number); - if (message.Status) - fprintf(stdout, _("(read)\n")); - else - fprintf(stdout, _("(not read)\n")); - fprintf(stdout, _("Sending date/time: %02d/%02d/%04d %02d:%02d:%02d "), \ - message.Time.Day, message.Time.Month, message.Time.Year, \ - message.Time.Hour, message.Time.Minute, message.Time.Second); - if (message.Time.Timezone) { - if (message.Time.Timezone > 0) - fprintf(stdout,_("+%02d00"), message.Time.Timezone); - else - fprintf(stdout,_("%02d00"), message.Time.Timezone); - } - fprintf(stdout, "\n"); - fprintf(stdout, _("Response date/time: %02d/%02d/%04d %02d:%02d:%02d "), \ - message.SMSCTime.Day, message.SMSCTime.Month, message.SMSCTime.Year, \ - message.SMSCTime.Hour, message.SMSCTime.Minute, message.SMSCTime.Second); - if (message.SMSCTime.Timezone) { - if (message.SMSCTime.Timezone > 0) - fprintf(stdout,_("+%02d00"),message.SMSCTime.Timezone); - else - fprintf(stdout,_("%02d00"),message.SMSCTime.Timezone); - } - fprintf(stdout, "\n"); - fprintf(stdout, _("Receiver: %s Msg Center: %s\n"), message.RemoteNumber.number, message.MessageCenter.Number); - fprintf(stdout, _("Text: %s\n\n"), message.MessageText); - break; - default: - fprintf(stdout, _("%d. Inbox Message "), message.Number); - if (message.Status) - fprintf(stdout, _("(read)\n")); - else - fprintf(stdout, _("(not read)\n")); - fprintf(stdout, _("Date/time: %02d/%02d/%04d %02d:%02d:%02d "), \ - message.Time.Day, message.Time.Month, message.Time.Year, \ - message.Time.Hour, message.Time.Minute, message.Time.Second); - if (message.Time.Timezone) { - if (message.Time.Timezone > 0) - fprintf(stdout,_("+%02d00"),message.Time.Timezone); - else - fprintf(stdout,_("%02d00"),message.Time.Timezone); - } - fprintf(stdout, "\n"); - fprintf(stdout, _("Sender: %s Msg Center: %s\n"), message.RemoteNumber.number, message.MessageCenter.Number); - switch (message.UDH[0].Type) { - case SMS_OpLogo: - fprintf(stdout, _("GSM operator logo for %s (%s) network.\n"), bitmap.netcode, GSM_GetNetworkName(bitmap.netcode)); - if (!strcmp(message.RemoteNumber.number, "+998000005") && !strcmp(message.MessageCenter.Number, "+886935074443")) fprintf(stdout, _("Saved by Logo Express\n")); - if (!strcmp(message.RemoteNumber.number, "+998000002") || !strcmp(message.RemoteNumber.number, "+998000003")) fprintf(stdout, _("Saved by Operator Logo Uploader by Thomas Kessler\n")); - offset = 3; - case SMS_CallerIDLogo: - fprintf(stdout, ("Logo:\n")); - /* put bitmap into bitmap structure */ - GSM_ReadSMSBitmap(message.UDH[0].Type, message.MessageText+2+offset, message.MessageText, &bitmap); - GSM_PrintBitmap(&bitmap); - if (*filename) { - error = GE_NONE; - if ((stat(filename, &buf) == 0)) { - fprintf(stdout, _("File %s exists.\n"), filename); - fprintf(stdout, _("Overwrite? (yes/no) ")); - GetLine(stdin, ans, 4); - if (!strcmp(ans, _("yes"))) { - error = GSM_SaveBitmapFile(filename, &bitmap); - } - } else error = GSM_SaveBitmapFile(filename, &bitmap); - if (error != GE_NONE) fprintf(stderr, _("Couldn't save logofile %s!\n"), filename); - } - break; - case SMS_Ringtone: - fprintf(stdout, _("Ringtone\n")); - break; - case SMS_ConcatenatedMessages: - fprintf(stdout, _("Linked (%d/%d):\n"), - message.UDH[0].u.ConcatenatedShortMessage.CurrentNumber, - message.UDH[0].u.ConcatenatedShortMessage.MaximumNumber); - case SMS_NoUDH: - fprintf(stdout, _("Text:\n%s\n\n"), message.MessageText); - if ((mode != -1) && *filename) { - char buf[1024]; - sprintf(buf, "%s%d", filename, count); - mode = GSM_SaveTextFile(buf, message.MessageText, mode); - } - break; - case SMS_BusinessCard: - fprintf(stdout, _("Business Card:\n%s"), message.MessageText); - break; - default: - fprintf(stderr, _("Unknown\n")); - break; - } - break; - } - if (del) { - data.SMSMessage = &message; - if (GE_NONE != SM_Functions(GOP_DeleteSMS, &data, &State)) - fprintf(stdout, _("(delete failed)\n")); - else - fprintf(stdout, _("(message deleted)\n")); - } - break; - case GE_NOTIMPLEMENTED: - fprintf(stderr, _("Function not implemented in %s model!\n"), model); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - case GE_INVALIDSMSLOCATION: - fprintf(stderr, _("Invalid location: %s %d\n"), memory_type_string, count); - break; - case GE_EMPTYSMSLOCATION: - fprintf(stderr, _("SMS location %s %d empty.\n"), memory_type_string, count); - break; - default: - fprintf(stdout, _("GetSMS %s %d failed!(%s)\n\n"), memory_type_string, count, print_error(error)); - break; - } - } + // First, error conditions + case '?': + fprintf(stderr, _("Use '%s --help' for usage informations.\n"), argv[0]); + break; - if (GSM && GSM->Terminate) GSM->Terminate(); + // Then, options with no arguments + case OPT_HELP: rc = usage(); break; + case OPT_VERSION: rc = version(); break; + case OPT_MONITOR: rc = monitormode(nargc, nargv); break; + case OPT_GETSMSFOLDERS: rc = getsmsfolders(); break; + case OPT_GETDATETIME: rc = getdatetime(); break; + case OPT_GETALARM: rc = getalarm(); break; + case OPT_GETDISPLAYSTATUS: rc = getdisplaystatus(); break; + case OPT_PMON: rc = pmon(); break; + case OPT_WRITEPHONEBOOK: rc = writephonebook(nargc, nargv);break; + +#ifdef SECURITY + case OPT_ENTERSECURITYCODE: rc = entersecuritycode(optarg); break; + case OPT_GETSECURITYCODESTATUS: rc = getsecuritycodestatus(); break; + case OPT_GETSECURITYCODE: rc = getsecuritycode(optarg); break; + case OPT_GETEEPROM: rc = geteeprom(); break; + case OPT_RESETPHONESETTINGS: rc = resetphonesettings(); break; + case OPT_SETSIMLOCK: rc = setsimlock(); break; +#endif + +#ifdef DEBUG + case OPT_SNIFFER: rc = sniff(nargc, nargv); break; + case OPT_DECODEFILE: rc = decodefile(nargc, nargv); break; +#endif - return 0; + // Now, options with arguments + case OPT_SETDATETIME: rc = setdatetime(nargc, nargv); break; + case OPT_SETALARM: rc = setalarm(nargv); break; + case OPT_DIALVOICE: rc = dialvoice(optarg); break; + case OPT_CANCELCALL: rc = cancelcall(); break; + case OPT_GETCALENDARNOTE: rc = getcalendarnote(nargc, nargv);break; + case OPT_DELCALENDARNOTE: rc = deletecalendarnote(optarg);break; + case OPT_SAVECALENDARNOTE: rc = savecalendarnote(nargc, nargv);break; + case OPT_SENDCALENDARNOTE: rc = sendcalendarnote(nargc, nargv);break; + case OPT_SAVEPHONEBOOKENTRY: rc = savephonebookentry(nargc, nargv);break; + case OPT_SENDPHONEBOOKENTRY: rc = sendphonebookentry(nargc, nargv);break; + case OPT_WRITECALENDARNOTE: rc = writecalendarnote(nargv); break; + case OPT_GETMEMORY: rc = getmemory(nargc, nargv); break; + case OPT_GETSPEEDDIAL: rc = getspeeddial(optarg); break; + case OPT_SETSPEEDDIAL: rc = setspeeddial(nargv); break; + case OPT_GETSMS: rc = getsms(argc, argv); break; + case OPT_GETSMSSTATUS: rc = getsmsstatus(argc, argv); break; + case OPT_DELETESMS: rc = deletesms(nargc, nargv); break; + case OPT_SENDSMS: rc = sendsms(nargc, nargv); break; + case OPT_SAVESMS: rc = savesms(nargc, nargv); break; + case OPT_DIVERT: rc = divert(nargc, nargv); break; + case OPT_SENDLOGO: rc = sendlogo(nargc, nargv); break; + case OPT_SAVELOGO: rc = savelogo(nargc, nargv); break; + case OPT_GETSMSC: rc = getsmsc(optarg); break; + case OPT_RENAMESMSC: rc = renamesmsc(nargc,nargv); break; + case OPT_NETMONITOR: rc = netmonitor(optarg); break; + case OPT_IDENTIFY: rc = identify(); break; + case OPT_SETLOGO: rc = setlogo(nargc, nargv); break; + case OPT_GETLOGO: rc = getlogo(nargc, nargv); break; + case OPT_RECEIVESMS: rc = receivesms(nargc, nargv); break; + case OPT_SETRINGTONE: rc = setringtone(nargc, nargv); break; + case OPT_GETRINGTONE: rc = getringtone(nargc, nargv); break; + case OPT_PRESSKEYSEQUENCE: rc = presskeysequence(nargv); break; + case OPT_SENDRINGTONE: rc = sendringtone(nargc, nargv);break; + case OPT_SAVERINGTONE: rc = saveringtone(nargc, nargv);break; + case OPT_GETPROFILE: rc = getprofile(nargc, nargv); break; + case OPT_SETPROFILE: rc = setprofile(nargc, nargv); break; + case OPT_SENDPROFILE: rc = sendprofile(nargc, nargv); break; + case OPT_DISPLAYOUTPUT: rc = displayoutput(); break; + case OPT_RESTORESETTINGS: rc = restoresettings(nargv); break; + case OPT_BACKUPSETTINGS: rc = backupsettings(nargv); break; + case OPT_RINGTONECONVERT: rc = ringtoneconvert(nargc, nargv);break; + case OPT_BINRINGTONECONVERT: rc = binringtoneconvert(nargc, nargv);break; + case OPT_BITMAPCONVERT: rc = bitmapconvert(nargc, nargv);break; + case OPT_SHOWBITMAP: rc = showbitmap(nargc, nargv); break; + case OPT_PLAYRINGTONE: rc = playringtone(nargc, nargv);break; + case OPT_COMPOSER: rc = composer(nargc, nargv); break; + case OPT_FOOGLE: rc = foogle(nargv); break; + case OPT_PHONETESTS: rc = phonetests(); break; + case OPT_SIMLOCKINFO: rc = simlockinfo(); break; + case OPT_SENDDTMF: rc = senddtmf(optarg); break; + case OPT_RESET: rc = reset(nargc,nargv); break; + case OPT_GETOPERATORNAME: rc = getoperatorname(); break; + case OPT_SETOPERATORNAME: rc = setoperatorname(nargc,nargv);break; + case OPT_GETWAPBOOKMARK: rc = getwapbookmark(nargc,nargv);break; + case OPT_SETWAPBOOKMARK: rc = setwapbookmark(nargc,nargv);break; + case OPT_SAVEWAPBOOKMARK: rc = savewapbookmark(nargc,nargv);break; + case OPT_SENDWAPBOOKMARK: rc = sendwapbookmark(nargc,nargv);break; + case OPT_GETWAPSETTINGS: rc = getwapsettings(nargc,nargv);break; + case OPT_SAVEWAPSETTINGS: rc = savewapsettings(nargc,nargv);break; + case OPT_SENDWAPSETTINGS: rc = sendwapsettings(nargc,nargv);break; + case OPT_ALLRINGTONES: rc = allringtones(); break; + case OPT_GETPHONEPROFILE: rc = getphoneprofile(); break; + case OPT_SETPHONEPROFILE: rc = setphoneprofile(nargc,nargv);break; + case OPT_GETVOICEMAILBOX: rc = getvoicemailbox(); break; + case OPT_NM_COLLECT: rc = nm_collect(nargc, nargv); break; + case OPT_NETMONITORDATA: rc = netmonitordata(nargc, nargv);break; + + default: fprintf(stderr, _("Unknown option: %d\n"), c); break; + + } + + free(nargv); + + return(rc); + } + + fprintf(stderr, _("Wrong number of arguments\n")); + + exit(-1); } -/* Delete SMS messages. */ -int deletesms(int argc, char *argv[]) +/* Restores various phone settings from one file */ +int restoresettings(char *argv[]) { - GSM_SMSMessage message; - char *memory_type_string; - int start_message, end_message, count; - GSM_Error error; + fprintf(stdout,_("Work in progress. Not usefull now. Sorry\n")); + return 0; +} - /* Handle command line args that set type, start and end locations. */ - memory_type_string = argv[0]; - message.MemoryType = StrToMemoryType(memory_type_string); - if (message.MemoryType == GMT_XX) { - fprintf(stderr, _("Unknown memory type %s (use ME, SM, ...)!\n"), argv[0]); - return (-1); - } - - start_message = end_message = atoi (argv[1]); - if (argc > 2) end_message = atoi (argv[2]); - - /* Now delete the requested entries. */ - for (count = start_message; count <= end_message; count ++) { - - message.Number = count; - data.SMSMessage = &message; - error = SM_Functions(GOP_DeleteSMS, &data, &State); - - if (error == GE_NONE) - fprintf(stdout, _("Deleted SMS %s %d\n"), memory_type_string, count); - else { - if (error == GE_NOTIMPLEMENTED) { - fprintf(stderr, _("Function not implemented in %s model!\n"), model); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - } - fprintf(stdout, _("DeleteSMS %s %d failed!(%d)\n\n"), memory_type_string, count, error); - } - } +/* Backup various phone settings from one file */ +int backupsettings(char *argv[]) +{ + GSM_PhonebookEntry PbkEntry; + GSM_Error error; + GSM_Backup Backup; + int i; - if (GSM && GSM->Terminate) GSM->Terminate(); + GSM_MemoryStatus SIMMemoryStatus = {GMT_SM, 0, 0}; + GSM_MemoryStatus PhoneMemoryStatus = {GMT_ME, 0, 0}; - return 0; -} + fbusinit(NULL); -static volatile bool bshutdown = false; + fprintf(stderr,_("Backup phonebook from SIM...")); + Backup.SIMPhonebookUsed=0; + if (GSM->GetMemoryStatus(&SIMMemoryStatus) == GE_NONE) {//FIXME + Backup.SIMPhonebookSize=SIMMemoryStatus.Used+SIMMemoryStatus.Free; -/* SIGINT signal handler. */ -static void interrupted(int sig) -{ - signal(sig, SIG_IGN); - bshutdown = true; + PbkEntry.MemoryType=GMT_SM; + + for (i=0;iGetMemoryLocation(&PbkEntry); + switch (error) { + case GE_NONE: + Backup.SIMPhonebook[Backup.SIMPhonebookUsed]=PbkEntry; + Backup.SIMPhonebookUsed++; + fprintf(stderr,_(".")); + break; + default: + break; + } + } + fprintf(stderr,_("Done\n")); + } else fprintf(stderr,_("ERROR\n")); + + fprintf(stderr,_("Backup phonebook from phone...")); + Backup.PhonePhonebookUsed=0; + if (GSM->GetMemoryStatus(&PhoneMemoryStatus) == GE_NONE) { + Backup.PhonePhonebookSize=PhoneMemoryStatus.Used+PhoneMemoryStatus.Free; + + PbkEntry.MemoryType=GMT_ME; + + for (i=0;iGetMemoryLocation(&PbkEntry); + switch (error) { + case GE_NONE: + Backup.PhonePhonebook[Backup.PhonePhonebookUsed]=PbkEntry; + Backup.PhonePhonebookUsed++; + fprintf(stderr,_(".")); + break; + default: + break; + } + } + fprintf(stderr,_("Done\n")); + } else fprintf(stderr,_("ERROR\n")); + + if( GetModelFeature (FN_CALLERGROUPS)!=0) { + fprintf(stderr,_("Backup caller logos...")); + Backup.CallerAvailable=true; + for (i=0;i<5;i++) { + Backup.CallerGroups[i].number=i; + Backup.CallerGroups[i].type=GSM_CallerLogo; + if (GSM->GetBitmap(&Backup.CallerGroups[i])!=GE_NONE) return 1; + } + fprintf(stderr,_("Done\n")); + } else Backup.CallerAvailable=false; + +// fprintf(stderr,_("Backup speed dials...")); + Backup.SpeedAvailable=false; +// for (i=0;i<8;i++) { +// Backup.SpeedDials[i].Number=i+1; +// if (GSM->GetSpeedDial(&Backup.SpeedDials[i])!=GE_NONE) return 1; +// } +// fprintf(stderr,_("Done\n")); + + fprintf(stderr,_("Backup operator logo...")); + Backup.OperatorLogoAvailable=true; + Backup.OperatorLogo.type=GSM_7110OperatorLogo; + if (GSM->GetBitmap(&Backup.OperatorLogo)!=GE_NONE) { + Backup.OperatorLogoAvailable=true; + Backup.OperatorLogo.type=GSM_OperatorLogo; + if (GSM->GetBitmap(&Backup.OperatorLogo)!=GE_NONE) { + Backup.OperatorLogoAvailable=false; + fprintf(stderr,_("Error\n")); + } else fprintf(stderr,_("Done\n")); + } else fprintf(stderr,_("Done\n")); + + Backup.StartupLogoAvailable=false; + if( GetModelFeature (FN_STARTUP)!=0) { + fprintf(stderr,_("Backup startup logo...")); + Backup.StartupLogoAvailable=true; + switch (GetModelFeature (FN_STARTUP)) { + case F_STA62: Backup.StartupLogo.type=GSM_6210StartupLogo;break; + case F_STA71: Backup.StartupLogo.type=GSM_7110StartupLogo;break; + default : Backup.StartupLogo.type=GSM_StartupLogo;break; + } + if (GSM->GetBitmap(&Backup.StartupLogo)!=GE_NONE) { + Backup.StartupLogoAvailable=false; + fprintf(stderr,_("Error\n")); + } else fprintf(stderr,_("Done\n")); + } + + fprintf(stderr,_("Backup welcome note...")); + Backup.StartupText.type=GSM_WelcomeNoteText; + if (GSM->GetBitmap(&Backup.StartupText)!=GE_NONE) { + fprintf(stderr,_("Error\n")); + } else fprintf(stderr,_("Done\n")); + + GSM->Terminate(); + + GSM_SaveBackupFile(argv[0], &Backup); + + return 0; } -#ifdef SECURITY +/* Presses keys on phone's keyboard */ -/* In this mode we get the code from the keyboard and send it to the mobile - phone. */ -int entersecuritycode(char *type) +int presskeysequence(char *argv[]) { - GSM_Error test; - GSM_SecurityCode SecurityCode; - - if (!strcmp(type, "PIN")) - SecurityCode.Type = GSCT_Pin; - else if (!strcmp(type, "PUK")) - SecurityCode.Type = GSCT_Puk; - else if (!strcmp(type, "PIN2")) - SecurityCode.Type = GSCT_Pin2; - else if (!strcmp(type, "PUK2")) - SecurityCode.Type = GSCT_Puk2; - /* FIXME: Entering of SecurityCode does not work :-( - else if (!strcmp(type, "SecurityCode")) - SecurityCode.Type = GSCT_SecurityCode; - */ - else - usage(); + int i,j; + int keycode; + char key; + + sleep(1); -#ifdef WIN32 - printf("Enter your code: "); - gets(SecurityCode.Code); -#else - strcpy(SecurityCode.Code, getpass(_("Enter your code: "))); -#endif + /* We need to make sure that the init is finished to avoid interrupted */ + /* multiframe packets... */ - if (GSM && GSM->EnterSecurityCode) test = GSM->EnterSecurityCode(SecurityCode); - if (test == GE_INVALIDSECURITYCODE) - fprintf(stdout, _("Error: invalid code.\n")); - else if (test == GE_NONE) - fprintf(stdout, _("Code ok.\n")); - else if (test == GE_NOTIMPLEMENTED) - fprintf(stderr, _("Function not implemented in %s model!\n"), model); - else - fprintf(stdout, _("Other error.\n")); + fbusinit(NULL); + + for (i=0;iTerminate(); + return -1; + } + + if (GSM->PressKey(keycode,PRESSPHONEKEY)!=GE_NONE) + { + fprintf(stderr,_("Can't press key !\n")); + GSM->Terminate(); + return -1; + } + if (GSM->PressKey(keycode,RELEASEPHONEKEY)!=GE_NONE) + { + fprintf(stderr,_("Can't release key !\n")); + GSM->Terminate(); + return -1; + } + } else + { + sleep(2); + } + } + + GSM->Terminate(); - if (GSM && GSM->Terminate) GSM->Terminate(); + return 0; +} - return 0; +/* Send SMS messages. */ +int sendsms(int argc, char *argv[]) +{ + GSM_MultiSMSMessage MultiSMS; + char message_buffer[GSM_MAX_CONCATENATED_SMS_LENGTH]; + int input_len, chars_read,i,msgnum; + + GSM_SMSMessageType SMSType=GST_SMS; + int SMSValidity= 4320; /* 4320 minutes == 72 hours */ + bool SMSReply=false; + int SMSClass=-1,SMSCenter=1; + char SMSCNumber[100]; + GSM_Coding_Type SMSCoding=GSM_Coding_Default; + GSM_UDH SMSUDHType=GSM_NoUDH; + + struct option options[] = { + { "smscno", required_argument, NULL, '1'}, + { "smsc", required_argument, NULL, '2'}, + { "long", required_argument, NULL, '3'}, + { "enablevoice", no_argument, NULL, '4'}, + { "disablevoice", no_argument, NULL, '5'}, + { "enableemail", no_argument, NULL, '6'}, + { "disableemail", no_argument, NULL, '7'}, + { "enablefax", no_argument, NULL, '8'}, + { "disablefax", no_argument, NULL, '9'}, + { "unicode", no_argument, NULL, '-'}, + { "void", no_argument, NULL, '+'}, + { "hang", no_argument, NULL, '('}, + { "bug", no_argument, NULL, ')'}, + { NULL, 0, NULL, 0} + }; + + input_len = GSM_MAX_SMS_LENGTH; + + if (argc!=0) { + + optarg = NULL; + optind = 0; + + while ((i = getopt_long(argc, argv, "v:dsC:", options, NULL)) != -1) { + switch (i) { + + case '1': /* SMSC number */ + SMSCenter = 0; + strcpy(SMSCNumber,optarg); + break; + + case '2': /* SMSC number index in phone memory */ + SMSCenter = atoi(optarg); + + if (SMSCenter < 1 || SMSCenter > 5) { + fprintf(stderr, _("Incorrect SMSC number with \"smscno\" option (can't be <1 and >5) !\n")); + GSM->Terminate(); + return -1; + } + break; + + case '3': /* we send long message */ + SMSUDHType=GSM_ConcatenatedMessages; + input_len = atoi(optarg); + if (input_len > GSM_MAX_CONCATENATED_SMS_LENGTH) { + fprintf(stderr, _("Input too long, max %i!\n"),GSM_MAX_CONCATENATED_SMS_LENGTH); + exit(-1); + } + break; + + case '4': /* SMS enables voice indicator */ + SMSUDHType=GSM_EnableVoice; break; + + case '5': /* SMS disables voice indicator */ + SMSUDHType=GSM_DisableVoice; break; + + case '6': /* SMS enables email indicator */ + SMSUDHType=GSM_EnableEmail; break; + + case '7': /* SMS disables email indicator */ + SMSUDHType=GSM_DisableEmail; break; + + case '8': /* SMS enables fax indicator */ + SMSUDHType=GSM_EnableFax; break; + + case '9': /* SMS disables fax indicator */ + SMSUDHType=GSM_DisableFax; break; + + case '-': /* SMS coding type */ + SMSCoding=GSM_Coding_Unicode; break; + + case '+': /* SMS ghost */ + SMSUDHType=GSM_VoidSMS; break; + + case '(': /* SMS hanging phone, when saved to Outbox */ + SMSUDHType=GSM_HangSMS; break; + + case ')': /* SMS showed incorrectly in phone */ + SMSUDHType=GSM_BugSMS; break; + + case 'v': /* Set validaty of SMS */ + SMSValidity = atoi(optarg); break; + + case 'd': /* delivery report */ + SMSType=GST_DR; break; + + case 's': /* Set replying via the same SMSC */ + SMSReply = true; break; + + case 'C': /* class Message */ + + if (SMSUDHType!=GSM_NoUDH) { + fprintf(stderr, _("Can't specify SMS Class with --enablevoice, --disablevoice, --enableemail, --disableemail, --enablefax, --disablefax options !\n")); + return -1; + } + + switch (*optarg) { + case '0': SMSClass = 0; break; + case '1': SMSClass = 1; break; + case '2': SMSClass = 2; break; + case '3': SMSClass = 3; break; + default: + fprintf(stderr, _("SMS Class (\"C\" option) can be 0, 1, 2 or 3 only !\n")); + return -1; + } + break; + + default: + fprintf(stderr,_("Unknown option number %i\n"),argc); + return -1; + } + } + } + + /* Get message text from stdin. */ + chars_read = fread(message_buffer, 1, input_len, stdin); + + if (chars_read == 0) { + fprintf(stderr, _("Couldn't read from stdin!\n")); + return -1; + } + if (chars_read > input_len) { + fprintf(stderr, _("Input too long!\n")); + return -1; + } + + /* Null terminate. */ + message_buffer[chars_read] = 0x00; + + GSM_MakeMultiPartSMS2(&MultiSMS,message_buffer,chars_read,SMSUDHType,SMSCoding); + msgnum=MultiSMS.number; + + switch (SMSUDHType) { + case GSM_NoUDH: + case GSM_BugSMS: + case GSM_VoidSMS: + case GSM_HangSMS: + case GSM_EnableVoice: + case GSM_DisableVoice: + case GSM_EnableFax: + case GSM_DisableFax: + case GSM_EnableEmail: + case GSM_DisableEmail: + fprintf(stdout,_("Warning: saving %i chars\n"),strlen(MultiSMS.SMS[0].MessageText)); + msgnum=1; + break; + default: + break; + } + + for (i=0;iGetSecurityCodeStatus && GSM->GetSecurityCodeStatus(&Status) == GE_NONE) { + if (argc!=0) { - fprintf(stdout, _("Security code status: ")); + optarg = NULL; + optind = 0; - switch(Status) { - case GSCT_SecurityCode: - fprintf(stdout, _("waiting for Security Code.\n")); - break; - case GSCT_Pin: - fprintf(stdout, _("waiting for PIN.\n")); - break; - case GSCT_Pin2: - fprintf(stdout, _("waiting for PIN2.\n")); - break; - case GSCT_Puk: - fprintf(stdout, _("waiting for PUK.\n")); - break; - case GSCT_Puk2: - fprintf(stdout, _("waiting for PUK2.\n")); - break; - case GSCT_None: - fprintf(stdout, _("nothing to enter.\n")); - break; - default: - fprintf(stdout, _("Unknown!\n")); - break; - } - } + while ((i = getopt_long(argc, argv, "risal:C:F:", options, NULL)) != -1) { + switch (i) { - if (GSM && GSM->Terminate) GSM->Terminate(); + case '1': /* SMSC number */ + SMSCenter = 0; + strcpy(SMSCNumber,optarg); + break; - return 0; -} + case '2': /* SMSC number index in phone memory */ + SMSCenter = atoi(optarg); + if (SMSCenter < 1 || SMSCenter > 5) { + fprintf(stderr, _("Incorrect SMSC number with \"smscno\" option (can't be <1 and >5) !\n")); + GSM->Terminate(); + return -1; + } + break; -#endif + case '3': /* we send long message */ + SMSUDHType=GSM_ConcatenatedMessages; + input_len = atoi(optarg); + if (input_len > GSM_MAX_CONCATENATED_SMS_LENGTH) { + fprintf(stderr, _("Input too long, max %i!\n"),GSM_MAX_CONCATENATED_SMS_LENGTH); + exit(-1); + } + break; -/* Voice dialing mode. */ -int dialvoice(char *Number) -{ - if (GSM && GSM->DialVoice) GSM->DialVoice(Number); + case '4': /* SMS enables voice indicator */ + SMSUDHType=GSM_EnableVoice; break; - if (GSM && GSM->Terminate) GSM->Terminate(); + case '5': /* SMS disables voice indicator */ + SMSUDHType=GSM_DisableVoice; break; - return 0; + case '6': /* SMS enables email indicator */ + SMSUDHType=GSM_EnableEmail; break; + + case '7': /* SMS disables email indicator */ + SMSUDHType=GSM_DisableEmail; break; + + case '8': /* SMS enables fax indicator */ + SMSUDHType=GSM_EnableFax; break; + + case '9': /* SMS disables fax indicator */ + SMSUDHType=GSM_DisableFax; break; + + case '-': /* SMS coding type */ + SMSCoding=GSM_Coding_Unicode; break; + + case '+': /* SMS ghost */ + SMSUDHType=GSM_VoidSMS; break; + + case '(': /* SMS hanging phone, when saved to Outbox */ + SMSUDHType=GSM_HangSMS; break; + + case ')': /* SMS showed incorrectly in phone */ + SMSUDHType=GSM_BugSMS; break; + + case 'r': /* mark as read */ + SMSStatus = GSS_SENTREAD; break; + + case 'i': /* Save into Inbox */ + SMSFolder = GST_INBOX; break; + + case 's': /* Set replying via the same SMSC */ + SMSReply = true; break; + + case 'a': /* Ask before overwriting */ + interactive=true;break; + + case 'l': /* Specify location */ + SMSLocation = atoi(optarg); break; + + case '/': /* Name */ + strncpy(SMSName,optarg,25);break; + + case 'C': /* class Message */ + + if (SMSUDHType!=GSM_NoUDH) { + fprintf(stderr, _("Can't specify SMS Class with --enablevoice, --disablevoice, --enableemail, --disableemail, --enablefax, --disablefax options !\n")); + return -1; + } + + switch (*optarg) { + case '0': SMSClass = 0; break; + case '1': SMSClass = 1; break; + case '2': SMSClass = 2; break; + case '3': SMSClass = 3; break; + default: + fprintf(stderr, _("SMS Class (\"C\" option) can be 0, 1, 2 or 3 only !\n")); + return -1; + } + break; + + case 'F': /* save into folder n */ + SMSFolder = atoi(optarg); + break; + + default: + fprintf(stderr,_("Unknown option number %i\n"),argc); + return -1; + } + } + } + + /* Get message text from stdin. */ + chars_read = fread(message_buffer, 1, input_len, stdin); + + if (chars_read == 0) { + fprintf(stderr, _("Couldn't read from stdin!\n")); + return -1; + } + if (chars_read > input_len) { + fprintf(stderr, _("Input too long!\n")); + return -1; + } + + /* Null terminate. */ + message_buffer[chars_read] = 0x00; + + GSM_MakeMultiPartSMS2(&MultiSMS,message_buffer,chars_read,SMSUDHType,SMSCoding); + msgnum=MultiSMS.number; + + switch (SMSUDHType) { + case GSM_NoUDH: + case GSM_BugSMS: + case GSM_VoidSMS: + case GSM_HangSMS: + case GSM_EnableVoice: + case GSM_DisableVoice: + case GSM_EnableFax: + case GSM_DisableFax: + case GSM_EnableEmail: + case GSM_DisableEmail: + fprintf(stdout,_("Warning: saving %i chars\n"),strlen(MultiSMS.SMS[0].MessageText)); + msgnum=1; + break; + default: + break; + } + + for (i=0;i 3) { - strcpy(bitmap.netcode, argv[3]); -#ifdef DEBUG - fprintf(stdout, _("Operator code: %s\n"), argv[3]); -#endif - } + if (GSM->GetSMSCenter(&MessageCenter) == GE_NONE) { - /* Set the network code */ - Data[current++] = ((bitmap.netcode[1] & 0x0f) << 4) | (bitmap.netcode[0] & 0xf); - Data[current++] = 0xf0 | (bitmap.netcode[2] & 0x0f); - Data[current++] = ((bitmap.netcode[5] & 0x0f) << 4) | (bitmap.netcode[4] & 0xf); - } + fprintf(stdout, _("%d. SMS center ("),MessageCenter.No); + + if (!strcmp(MessageCenter.Name,"")) + fprintf(stdout,_("Set %d"),MessageCenter.No); + else fprintf(stdout,_("%s"),MessageCenter.Name); + + fprintf(stdout,_(") number is ")); - /* Set the logo size */ - current++; - Data[current++] = bitmap.width; - Data[current++] = bitmap.height; + if (!strcmp(MessageCenter.Number,"")) fprintf(stdout,_("not set\n")); + else fprintf(stdout,_("%s\n"),MessageCenter.Number); - Data[current++] = 0x01; + fprintf(stdout,_("Default recipient number is ")); - memcpy(SMS.MessageText, UserDataHeader, 7); - memcpy(SMS.MessageText, Data, current); - memcpy(SMS.MessageText+current, bitmap.bitmap, bitmap.size); + if (!strcmp(MessageCenter.DefaultRecipient,"")) + fprintf(stdout,_("not set\n")); + else fprintf(stdout,_("%s\n"),MessageCenter.DefaultRecipient); - /* Send the message. */ - error = GSM->SendSMSMessage(&SMS,current+bitmap.size); + fprintf(stdout, _("Messages sent as ")); - if (error == GE_SMSSENDOK) - fprintf(stdout, _("Send succeeded!\n")); - else - fprintf(stdout, _("SMS Send failed (error=%d)\n"), error); + switch (MessageCenter.Format) { + case GSMF_Text :fprintf(stdout, _("Text"));break; + case GSMF_Paging:fprintf(stdout, _("Paging"));break; + case GSMF_Fax :fprintf(stdout, _("Fax"));break; + case GSMF_Email : + case GSMF_UCI :fprintf(stdout, _("Email"));break; + case GSMF_ERMES :fprintf(stdout, _("ERMES"));break; + case GSMF_X400 :fprintf(stdout, _("X.400"));break; + default :fprintf(stdout, _("Unknown")); + } - GSM->Terminate(); - return 0; + printf("\n"); + + fprintf(stdout, _("Message validity is ")); + + switch (MessageCenter.Validity) { + case GSMV_1_Hour :fprintf(stdout, _("1 hour"));break; + case GSMV_6_Hours :fprintf(stdout, _("6 hours"));break; + case GSMV_24_Hours:fprintf(stdout, _("24 hours"));break; + case GSMV_72_Hours:fprintf(stdout, _("72 hours"));break; + case GSMV_1_Week :fprintf(stdout, _("1 week"));break; + case GSMV_Max_Time:fprintf(stdout, _("Maximum time"));break; + default :fprintf(stdout, _("Unknown")); + } + + fprintf(stdout, "\n"); + + } + else + fprintf(stdout, _("SMS center can not be found :-(\n")); + + GSM->Terminate(); + + return 0; } -/* Getting logos. */ -GSM_Error SaveBitmapFileOnConsole(char *FileName, GSM_Bitmap *bitmap) +/* Get SMS messages. */ +int getsms(int argc, char *argv[]) { - int confirm; - char ans[4]; - struct stat buf; - GSM_Error error; - /* Ask before overwriting */ - while (stat(FileName, &buf) == 0) { - confirm = 0; - while (!confirm) { - fprintf(stderr, _("Saving logo. File \"%s\" exists. (O)verwrite, create (n)ew or (s)kip ? "), FileName); - GetLine(stdin, ans, 4); - if (!strcmp(ans, _("O")) || !strcmp(ans, _("o"))) confirm = 1; - if (!strcmp(ans, _("N")) || !strcmp(ans, _("n"))) confirm = 2; - if (!strcmp(ans, _("S")) || !strcmp(ans, _("s"))) return GE_USERCANCELED; - } - if (confirm == 1) break; - if (confirm == 2) { - fprintf(stderr, _("Enter name of new file: ")); - GetLine(stdin, FileName, 50); - if (!FileName || (*FileName == 0)) return GE_USERCANCELED; - } - } - - error = GSM_SaveBitmapFile(FileName, bitmap); + GSM_SMSMessage message; + GSM_WAPBookmark bookmark; + char memory_type_string[20]; + int start_message, end_message, count, mode = 1; + char filename[64]; + GSM_Error error; + GSM_Bitmap bitmap; + GSM_Ringtone ringtone; + GSM_SMSFolders folders; - switch (error) { - case GE_CANTOPENFILE: - fprintf(stderr, _("Failed to write file \"%s\"\n"), FileName); - break; - default: - break; + int confirm = -1, i; + char ans[8]; + + /* Handle command line args that set type, start and end locations. */ + if (!GetMemoryTypeID(argv[2], &message.MemoryType)) + { + fprintf(stderr, _("Unknown memory type %s!\n"), argv[2]); + return (-1); + } + GetMemoryTypeString(memory_type_string, &message.MemoryType); + + for (i=0;i<64;i++) filename[i]=0; + + start_message = atoi(argv[3]); + if (argc > 4) { + int i; + + /* [end] can be only argv[4] */ + if (argv[4][0] == '-') { + end_message = start_message; + } else { + end_message = atoi(argv[4]); + } + + /* parse all options (beginning with '-' */ + while ((i = getopt(argc, argv, "f:")) != -1) { + switch (i) { + case 'f': + if (optarg) { +#ifdef DEBUG + fprintf(stderr, _("Saving into file \"%s\"\n"), optarg); +#endif /* DEBUG */ + strncpy(filename, optarg, 64); + if (strlen(optarg) > 63) { + fprintf(stderr, _("Filename too long - will be truncated to 63 characters.\n")); + filename[63] = 0; + } else { + filename[strlen(optarg)] = 0; + } + } else { + usage(); + exit(1); + } + break; + default: + usage(); + exit(1); } + } + } else { + end_message = start_message; + } + + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + GSM->GetSMSFolders(&folders); + - return error; -} + /* Now retrieve the requested entries. */ -int getlogo(int argc, char *argv[]) -{ - GSM_Bitmap bitmap; - GSM_Error error; - GSM_Statemachine *sm = &State; + for (count = start_message; count <= end_message; count ++) { - bitmap.type=GSM_None; + message.Location = count; - if (!strcmp(argv[0], "op")) - bitmap.type = GSM_OperatorLogo; - - if (!strcmp(argv[0], "caller")) { - /* There is caller group number missing in argument list. */ - if (argc == 3) { - bitmap.number=argv[2][0]-'0'; - if ((bitmap.number < 0) || (bitmap.number > 9)) bitmap.number = 0; - } else { - bitmap.number = 0; - } - bitmap.type = GSM_CallerLogo; - } - - if (!strcmp(argv[0],"startup")) - bitmap.type = GSM_StartupLogo; - else if (!strcmp(argv[0], "dealer")) - bitmap.type = GSM_DealerNoteText; - else if (!strcmp(argv[0], "text")) - bitmap.type=GSM_WelcomeNoteText; - - if (bitmap.type != GSM_None) { - - fprintf(stdout, _("Getting Logo\n")); - - data.Bitmap=&bitmap; - error=SM_Functions(GOP_GetBitmap, &data, sm); - - switch (error) { - case GE_NONE: - if (bitmap.type == GSM_DealerNoteText) fprintf(stdout, _("Dealer welcome note ")); - if (bitmap.type == GSM_WelcomeNoteText) fprintf(stdout, _("Welcome note ")); - if (bitmap.type == GSM_DealerNoteText || bitmap.type==GSM_WelcomeNoteText) { - if (bitmap.text[0]) { - fprintf(stdout, _("currently set to \"%s\"\n"), bitmap.text); - } else { - fprintf(stdout, _("currently empty\n")); - } - } else { - if (bitmap.width) { - switch (bitmap.type) { - case GSM_OperatorLogo: - fprintf(stdout,"Operator logo for %s (%s) network got succesfully\n",bitmap.netcode,GSM_GetNetworkName(bitmap.netcode)); - if (argc==3) { - strncpy(bitmap.netcode,argv[2], 7); - if (!strcmp(GSM_GetNetworkName(bitmap.netcode), "unknown")) { - fprintf(stderr, "Sorry, gnokii doesn't know %s network !\n", bitmap.netcode); - return -1; - } - } - break; - case GSM_StartupLogo: - fprintf(stdout, "Startup logo got successfully\n"); - if (argc == 3) { - strncpy(bitmap.netcode,argv[2], 7); - if (!strcmp(GSM_GetNetworkName(bitmap.netcode), "unknown")) { - fprintf(stderr, "Sorry, gnokii doesn't know %s network !\n", bitmap.netcode); - return -1; - } - } - break; - case GSM_CallerLogo: - fprintf(stdout,"Caller logo got successfully\n"); - if (argc == 4) { - strncpy(bitmap.netcode,argv[3],7); - if (!strcmp(GSM_GetNetworkName(bitmap.netcode), "unknown")) { - fprintf(stderr, "Sorry, gnokii doesn't know %s network !\n", bitmap.netcode); - return -1; - } - } - break; - default: - fprintf(stdout,"Unknown bitmap type.\n"); - break; - } - if (argc > 1) { - if (SaveBitmapFileOnConsole(argv[1], &bitmap) != GE_NONE) return (-1); - } - } else { - fprintf(stdout,"Your phone doesn't have logo uploaded !\n"); - return -1; - } - } - break; - case GE_NOTIMPLEMENTED: - fprintf(stderr, _("Function not implemented !\n")); - return -1; - case GE_NOTSUPPORTED: - fprintf(stderr, _("This kind of logo is not supported !\n")); - return -1; - default: - fprintf(stderr, _("Error getting logo !\n")); - return -1; - } - } else { - fprintf(stderr, _("What kind of logo do you want to get ?\n")); - return -1; - } + error = GSM->GetSMSMessage(&message); - return 0; -} + switch (error) { + case GE_NONE: -/* Sending logos. */ -GSM_Error ReadBitmapFileOnConsole(char *FileName, GSM_Bitmap *bitmap) -{ - GSM_Error error; - - error = GSM_ReadBitmapFile(FileName, bitmap); - - switch (error) { - case GE_CANTOPENFILE: - fprintf(stderr, _("Failed to read file \"%s\"\n"), FileName); + switch (message.Type) { + + case GST_DR: + + /* RTH FIXME: Test that out ! */ + fprintf(stdout, _("%d. Delivery Report "), message.MessageNumber); + switch (message.Status) + { + case GSS_SENTREAD: + if (message.folder==0) //GST_INBOX + fprintf(stdout, _("(read)\n")); + else + fprintf(stdout, _("(sent)\n")); break; - case GE_WRONGNUMBEROFCOLORS: - fprintf(stderr, _("Wrong number of colors in \"%s\" logofile (accepted only 2-colors files) !\n"), FileName); + case GSS_NOTSENTREAD: + if (message.folder==0) //GST_INBOX + fprintf(stdout, _("(unread)\n")); + else + fprintf(stdout, _("(not sent)\n")); break; - case GE_WRONGCOLORS: - fprintf(stderr, _("Wrong colors in \"%s\" logofile !\n"), FileName); + case GSS_UNKNOWN: + fprintf(stdout, _("(not known :-()\n")); break; - case GE_INVALIDFILEFORMAT: - fprintf(stderr, _("Invalid format of \"%s\" logofile !\n"), FileName); + case GSS_TEMPLATE: + fprintf(stdout, _("(template)\n")); break; - case GE_SUBFORMATNOTSUPPORTED: - fprintf(stderr, _("Sorry, gnokii doesn't support used subformat in file \"%s\" !\n"), FileName); + default: + fprintf(stdout, _("(unknown: %d)\n"),message.Status); break; - case GE_FILETOOSHORT: - fprintf(stderr, _("\"%s\" logofile is too short !\n"), FileName); - break; - case GE_INVALIDIMAGESIZE: - fprintf(stderr, _("Bitmap size doesn't supported by fileformat or different from 72x14, 84x48 and 72x28 !\n")); + } + + fprintf(stdout, _("Sending date/time : %s %02d/%02d/%02d %d:%02d:%02d "), \ + DayOfWeek(message.Time.Year, message.Time.Month, message.Time.Day), \ + message.Time.Day, message.Time.Month, message.Time.Year, \ + message.Time.Hour, message.Time.Minute, message.Time.Second); + + if (message.Time.Timezone) { + if (message.Time.Timezone > 0) + fprintf(stdout,_("+%02d00"), message.Time.Timezone); + else + fprintf(stdout,_("%02d00"), message.Time.Timezone); + } + + fprintf(stdout, "\n"); + + fprintf(stdout, _("Response date/time: %s %02d/%02d/%02d %d:%02d:%02d "), \ + DayOfWeek(message.SMSCTime.Year, message.SMSCTime.Month, message.SMSCTime.Day), \ + message.SMSCTime.Day, message.SMSCTime.Month, message.SMSCTime.Year, \ + message.SMSCTime.Hour, message.SMSCTime.Minute, message.SMSCTime.Second); + + if (message.SMSCTime.Timezone) { + if (message.SMSCTime.Timezone > 0) + fprintf(stdout,_("+%02d00"),message.SMSCTime.Timezone); + else + fprintf(stdout,_("%02d00"),message.SMSCTime.Timezone); + } + + fprintf(stdout, "\n"); + + fprintf(stdout, _("Receiver: %s Msg Center: %s\n"), message.Sender, message.MessageCenter.Number); + fprintf(stdout, _("Text: %s\n\n"), message.MessageText); + + break; + + case GST_SMS: + fprintf(stdout, _("%d. %s Message "), message.MessageNumber, + folders.Folder[message.folder].Name); + + switch (message.Status) + { + case GSS_SENTREAD: + if (message.folder==0) //GST_INBOX + fprintf(stdout, _("(read)\n")); + else + fprintf(stdout, _("(sent)\n")); break; - default: + case GSS_NOTSENTREAD: + if (message.folder==0) //GST_INBOX + fprintf(stdout, _("(unread)\n")); + else + fprintf(stdout, _("(not sent)\n")); + break; + case GSS_UNKNOWN: + fprintf(stdout, _("(not known :-()\n")); + break; + case GSS_TEMPLATE: + fprintf(stdout, _("(template)\n")); + break; + default: + fprintf(stdout, _("(unknown: %d)\n"),message.Status); + break; + } + + /* RTH FIXME: date for other status ok ? */ + if (message.SMSData) { + + fprintf(stdout, _("Date/time: %s %02d/%02d/%02d %d:%02d:%02d "), \ + DayOfWeek(message.Time.Year, message.Time.Month, message.Time.Day), \ + message.Time.Day, message.Time.Month, message.Time.Year, \ + message.Time.Hour, message.Time.Minute, message.Time.Second); + + if (message.Time.Timezone) { + if (message.Time.Timezone > 0) + fprintf(stdout,_("+%02d00"),message.Time.Timezone); + else + fprintf(stdout,_("%02d00"),message.Time.Timezone); + } + + fprintf(stdout, "\n"); + + fprintf(stdout, _("Msg Center: %s "), message.MessageCenter.Number); + + if (message.ReplyViaSameSMSC) + fprintf(stdout, _("(centre set for reply) ")); + } + + if (strcmp(message.Sender,"")) { + if (message.folder==1) { //GST_OUTBOX + fprintf(stdout, _("Recipient: %s"),message.Sender); + } else { + fprintf(stdout, _("Sender: %s"),message.Sender); + } + } + + if (strcmp(message.Sender,"") || message.folder==0) + fprintf(stdout, "\n"); + + switch (message.UDHType) { + + case GSM_OpLogo: + + /* put bitmap into bitmap structure */ + switch (GSM_ReadBitmap(&message, &bitmap)) { + case GE_INVALIDIMAGESIZE: + fprintf(stdout,_("Image size not supported\n")); + break; + case GE_NONE: + fprintf(stdout, _("GSM operator logo for %s (%s) network.\n"), bitmap.netcode, GSM_GetNetworkName(bitmap.netcode)); + + GSM_PrintBitmap(&bitmap); + + if (filename[0]!=0) { + GSM_SaveBitmapFileOnConsole(filename, &bitmap); + } + + break; + default: + fprintf(stdout,_("Error reading image\n")); + break; + } + +#ifdef DEBUG + if (message.folder==0) { //GST_INBOX + if (!strcmp(message.Sender, "+998000005") && + !strcmp(message.MessageCenter.Number, "+886935074443") && + message.Time.Day==27 && + message.Time.Month==7 && + message.Time.Year==99 && + message.Time.Hour==0 && + message.Time.Minute==10 && + message.Time.Second==48) fprintf(stdout, _("Saved by Logo Express\n")); + + /* Is it changed in next versions ? Or what ? */ + if (!strcmp(message.Sender, "+998000002") || + !strcmp(message.Sender, "+998000003") || + !strcmp(message.Sender, "+998000004")) fprintf(stdout, _("Saved by Operator Logo Uploader by Thomas Kessler\n")); + } else { + if (!strcmp(message.Sender, "+8861234567890") && + !strcmp(message.MessageCenter.Number, "+886935074443")) fprintf(stdout, _("Saved by Logo Express\n")); + } + if (!strncmp(message.Sender, "OpLogo",6) && + strlen(message.Sender)==11) + fprintf(stdout, _("Saved by gnokii\n")); +#endif + + break; + + case GSM_WAPBookmarkUDH: + + /* put bookmark into bookmark structure */ + switch (GSM_ReadWAPBookmark(&message, &bookmark)) { + case GE_NONE: + fprintf(stdout, ("WAP Bookmark\n")); + + fprintf(stdout,_("Address: \"%s\"\n"),bookmark.address); + + if (bookmark.title[0]==0) + fprintf(stdout,_("Title: \"%s\"\n"),bookmark.address); + else + fprintf(stdout,_("Title: \"%s\"\n"),bookmark.title); + + break; + default: + fprintf(stdout,_("Error reading WAP Bookmark\n")); + break; + } + +#ifdef DEBUG + if (!strcmp(message.Sender, "WAPBookmark")) + fprintf(stdout, _("Saved by gnokii\n")); +#endif + + break; + + case GSM_CallerIDLogo: + + /* put bitmap into bitmap structure */ + switch (GSM_ReadBitmap(&message, &bitmap)) { + case GE_INVALIDIMAGESIZE: + fprintf(stdout,_("Image size not supported\n")); + break; + case GE_NONE: + fprintf(stdout, ("Caller Logo\n")); + + GSM_PrintBitmap(&bitmap); + + if (filename[0]!=0) { + GSM_SaveBitmapFileOnConsole(filename, &bitmap); + } + + break; + default: + fprintf(stdout,_("Error reading image\n")); + break; + } + +#ifdef DEBUG + if (message.folder==0) { //GST_INBOX + if (!strcmp(message.Sender, "+998000005") && + !strcmp(message.MessageCenter.Number, "+886935074443") && + message.Time.Day==27 && + message.Time.Month==7 && + message.Time.Year==99 && + message.Time.Hour==0 && + message.Time.Minute==10 && + message.Time.Second==48) fprintf(stdout, _("Saved by Logo Express\n")); + } else { + if (!strcmp(message.Sender, "+8861234567890") && + !strcmp(message.MessageCenter.Number, "+886935074443")) fprintf(stdout, _("Saved by Logo Express\n")); + } + if (!strcmp(message.Sender, "GroupLogo")) + fprintf(stdout, _("Saved by gnokii\n")); +#endif + + break; + + case GSM_ProfileUDH: + fprintf(stdout, ("Profile SMS, part %i/%i\n"),message.UDH[11],message.UDH[10]); + break; + + case GSM_WAPBookmarkUDHLong: + fprintf(stdout, ("WAP Bookmark, part %i/%i\n"),message.UDH[11],message.UDH[10]); + break; + + case GSM_WAPSettingsUDH: + fprintf(stdout, ("WAP Settings, part %i/%i\n"),message.UDH[11],message.UDH[10]); + break; + + case GSM_RingtoneUDH: + + /* put ringtone into ringtone structure */ + switch (GSM_ReadRingtone(&message, &ringtone)) { + case GE_NONE: + + fprintf(stdout, ("Ringtone \"%s\"\n"),ringtone.name); + + while (confirm < 0) { + fprintf(stderr, _("Do you want to play it ? (yes/no) ")); + GetLine(stdin, ans, 7); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no")) confirm = 0; + } + + if (confirm==1) GSM_PlayRingtoneOnConsole(&ringtone); + + if (filename[0]!=0) GSM_SaveRingtoneFileOnConsole(filename, &ringtone); + + break; + + default: + fprintf(stdout,_("Gnokii can't read this ringtone - there is probably error inside\n")); break; + } + + break; + + case GSM_CalendarNoteUDH: + fprintf(stdout, ("Calendar note SMS, part %i/%i\n"),message.UDH[11],message.UDH[10]); + fprintf(stdout, _("Text:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_ConcatenatedMessages: + fprintf(stdout, _("Linked (%d/%d)\nText:\n%s\n\n"),message.UDH[5],message.UDH[4], message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_EnableVoice: + fprintf(stdout, _("Enables voice indicator\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_DisableVoice: + fprintf(stdout, _("Disables voice indicator\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_EnableFax: + fprintf(stdout, _("Enables fax indicator\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_DisableFax: + fprintf(stdout, _("Disables fax indicator\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_EnableEmail: + fprintf(stdout, _("Enables email indicator\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_DisableEmail: + fprintf(stdout, _("Disables email indicator\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_VoidSMS: + fprintf(stdout, _("Void SMS\nText:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + break; + + case GSM_NoUDH: + if (message.Coding!=GSM_Coding_8bit) { + fprintf(stdout, _("Text:\n%s\n\n"), message.MessageText); + if (filename[0]!=0 && mode != -1) mode = GSM_SaveTextFileOnConsole(filename, message.MessageText, mode); + } else { + fprintf(stdout, _("Message cannot be displayed here\n")); // like in phone :-) + } + break; + + default: //GSM_UnknownUDH and other + fprintf(stderr, _("Unknown\n")); + } + + break; + + default: + fprintf(stdout,_("Unknown SMS type. Report it\n")); + break; + } + + break; + + case GE_NOTIMPLEMENTED: + + fprintf(stderr, _("Function not implemented in %s model!\n"), model); + GSM->Terminate(); + return -1; + + case GE_INVALIDSMSLOCATION: + + fprintf(stderr, _("Invalid location: %s %d\n"), memory_type_string, count); + + break; + + case GE_EMPTYSMSLOCATION: + + fprintf(stderr, _("SMS location %s %d empty.\n"), memory_type_string, count); + + break; + + case GE_NOACCESS: + + fprintf(stderr, _("No access to %s memory.\n"), memory_type_string); + + break; + + default: + + fprintf(stderr, _("GetSMS %s %d failed!(%d)\n\n"), memory_type_string, count, error); + } + } + + GSM->Terminate(); + + return 0; +} + +int getsmsstatus(int argc, char *argv[]) +{ + GSM_SMSStatus SMSStatus; + GSM_SMSFolders folders; + GSM_Error error; + GSM_SMSMessage SMS; + + int i,j; + + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); + + error = GSM->GetSMSStatus(&SMSStatus); + if (error!=GE_NONE) return error; + + fprintf(stdout, _("SMS Messages: UnRead %d, Number %d\n"),SMSStatus.UnRead, SMSStatus.Number); + + error=GSM->GetSMSFolders(&folders); + if (error!=GE_NONE) return error; + + /* For not 7110 compatible phones we have to read all SMS and prepare sms table */ + if( GetModelFeature (FN_SMS)!=F_SMS71 ) + { + i=1;j=0; + while (true) { + if (j==SMSStatus.Number) break; + SMS.Location=i; + if (GSM->GetSMSMessage(&SMS)==GE_NONE) { + SMSStatus.foldertable[j].smsnum=i; + + /* We set such folders ID like in 7110 compatible phones */ + if (SMS.Status==GSS_NOTSENTREAD && SMS.folder==0) //GST_INBOX + SMSStatus.foldertable[j].folder=0; + else { + switch (SMS.folder) { + case 0://GST_INBOX + SMSStatus.foldertable[j].folder=GST_7110_INBOX; + break; + case 1://GST_OUTBOX + SMSStatus.foldertable[j].folder=GST_7110_OUTBOX; + break; + } + } + j++; + } + i++; + } + } + + printf("0.Unread : "); + for(j=0; jTerminate(); + + return 0; +} + +/* Delete SMS messages. */ +int deletesms(int argc, char *argv[]) +{ + + GSM_SMSMessage message; + char memory_type_string[20]; + int start_message, end_message, count; + GSM_Error error; + + /* Handle command line args that set type, start and end locations. */ + if (!GetMemoryTypeID(argv[0], &message.MemoryType)) + { + fprintf(stderr, _("Unknown memory type %s!\n"), argv[0]); + return (-1); + } + GetMemoryTypeString(memory_type_string, &message.MemoryType); + + start_message = atoi (argv[1]); + if (argc > 2) end_message = atoi (argv[2]); + else end_message = start_message; + + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + /* Now delete the requested entries. */ + + for (count = start_message; count <= end_message; count ++) { + + message.Location = count; + + error = GSM->DeleteSMSMessage(&message); + + if (error == GE_NONE) + fprintf(stdout, _("Deleted SMS %s %d\n"), memory_type_string, count); + else { + if (error == GE_NOTIMPLEMENTED) { + fprintf(stderr, _("Function not implemented in %s model!\n"), model); + GSM->Terminate(); + return -1; + } + fprintf(stdout, _("DeleteSMS %s %d failed!(%d)\n\n"), memory_type_string, count, error); + } + } + + GSM->Terminate(); + + return 0; +} + +static volatile bool bshutdown = false; + +/* SIGINT signal handler. */ + +static void interrupted(int sig) +{ + + signal(sig, SIG_IGN); + bshutdown = true; + +} + +#ifdef SECURITY + +/* In this mode we get the code from the keyboard and send it to the mobile + phone. */ + +int entersecuritycode(char *type) +{ + GSM_Error test; + GSM_SecurityCode SecurityCode; + + if (!strcmp(type,"PIN")) SecurityCode.Type=GSCT_Pin; + else if (!strcmp(type,"PUK")) SecurityCode.Type=GSCT_Puk; + else if (!strcmp(type,"PIN2"))SecurityCode.Type=GSCT_Pin2; + else if (!strcmp(type,"PUK2"))SecurityCode.Type=GSCT_Puk2; + + // FIXME: Entering of SecurityCode does not work :-( + // else if (!strcmp(type,"SecurityCode")) + // SecurityCode.Type=GSCT_SecurityCode; + + else { + fprintf(stdout, _("Wrong code in second parameter (allowed: PIN,PUK,PIN2,PUK2,SecurityCode)\n")); + return -1; + } + +#ifdef WIN32 + printf("Enter your code: "); + gets(SecurityCode.Code); +#else + strcpy(SecurityCode.Code,getpass(_("Enter your code: "))); +#endif + + fbusinit(NULL); + + test = GSM->EnterSecurityCode(SecurityCode); + if (test==GE_NONE) + fprintf(stdout,_("Code OK !\n")); + else + fprintf(stderr,_("%s\n"),print_error(test)); + + GSM->Terminate(); + + return 0; +} + +int getsecuritycodestatus(void) +{ + + int Status; + + fbusinit(NULL); + + if (GSM->GetSecurityCodeStatus(&Status) == GE_NONE) { + + fprintf(stdout, _("Security code status: ")); + + switch(Status) { + case GSCT_SecurityCode:fprintf(stdout, _("waiting for Security Code.\n"));break; + case GSCT_Pin: fprintf(stdout, _("waiting for PIN.\n")); break; + case GSCT_Pin2: fprintf(stdout, _("waiting for PIN2.\n")); break; + case GSCT_Puk: fprintf(stdout, _("waiting for PUK.\n")); break; + case GSCT_Puk2: fprintf(stdout, _("waiting for PUK2.\n")); break; + case GSCT_None: fprintf(stdout, _("nothing to enter.\n")); break; + default: fprintf(stdout, _("Unknown!\n")); + } + } + + GSM->Terminate(); + + return 0; +} + +int getsecuritycode(char *type) +{ + + GSM_SecurityCode SecurityCode; + GSM_Error error; + + if (!strcmp(type,"PIN")) SecurityCode.Type=GSCT_Pin; + else if (!strcmp(type,"PUK")) SecurityCode.Type=GSCT_Puk; + else if (!strcmp(type,"PIN2")) SecurityCode.Type=GSCT_Pin2; + else if (!strcmp(type,"PUK2")) SecurityCode.Type=GSCT_Puk2; + else if (!strcmp(type,"SecurityCode"))SecurityCode.Type=GSCT_SecurityCode; + else { + fprintf(stdout, _("Wrong code in second parameter (allowed: PIN,PUK,PIN2,PUK2,SecurityCode)\n")); + return -1; + } + + fbusinit(NULL); + + error=GSM->GetSecurityCode(&SecurityCode); + + switch (error) { + case GE_INVALIDSECURITYCODE: + fprintf(stdout, _("Error: getting ")); + switch (SecurityCode.Type) { + case GSCT_SecurityCode:fprintf(stdout, _("security code"));break; + case GSCT_Pin :fprintf(stdout, _("PIN"));break; + case GSCT_Pin2:fprintf(stdout, _("PIN2"));break; + case GSCT_Puk :fprintf(stdout, _("PUK"));break; + case GSCT_Puk2:fprintf(stdout, _("PUK2"));break; + default:break; + } + fprintf(stdout, _(" not allowed\n")); + break; + case GE_NONE: + switch (SecurityCode.Type) { + case GSCT_SecurityCode:fprintf(stdout, _("Security code"));break; + case GSCT_Pin :fprintf(stdout, _("PIN"));break; + case GSCT_Pin2:fprintf(stdout, _("PIN2"));break; + case GSCT_Puk :fprintf(stdout, _("PUK"));break; + case GSCT_Puk2:fprintf(stdout, _("PUK2"));break; + default:break; + } + fprintf(stdout, _(" is %s\n"),SecurityCode.Code); + break; + default: + fprintf(stderr, _("%s\n"),print_error(error)); + break; + } + + GSM->Terminate(); + + return 0; +} + +#endif + +/* Voice dialing mode. */ + +int dialvoice(char *Number) +{ + fbusinit(NULL); + + if (GSM->DialVoice(Number)!=GE_NONE) fprintf(stdout,_("Error!\n")); + + GSM->Terminate(); + + return 0; +} + +/* Cancel a call */ +int cancelcall(void) +{ + fbusinit(NULL); + + if (GSM->CancelCall()!=GE_NONE) fprintf(stdout,_("Error!\n")); + + GSM->Terminate(); + + return 0; +} + +int savelogo(int argc, char *argv[]) +{ + GSM_Bitmap bitmap; + GSM_NetworkInfo NetworkInfo; + GSM_MultiSMSMessage MultiSMS; + + /* Operator logos will be saved with this number */ + char oplogonumber[]={'O','p','L','o','g','o', + '0','0','0','0','0', /* MMC+MNC */ + '\0'}; + int i=0; + + bool UnicodeText=false; + + /* The first argument is the type of the logo. */ + if (!strcmp(argv[0], "op")) { + fprintf(stdout, _("Saving operator logo.\n")); + } else if (!strcmp(argv[0], "caller")) { + fprintf(stdout, _("Saving caller line identification logo.\n")); + } else if (!strcmp(argv[0], "startup")) { + fprintf(stderr, _("It isn't possible to save startup logo!\n")); + return (-1); + } else if (!strcmp(argv[0], "7110startup")) { + fprintf(stderr, _("It isn't possible to save startup logo!\n")); + return (-1); + } else if (!strcmp(argv[0], "6210startup")) { + fprintf(stderr, _("It isn't possible to save startup logo!\n")); + return (-1); + } else if (!strcmp(argv[0], "7110op")) { + fprintf(stderr, _("It isn't possible to save big operator logos!\n")); + return (-1); + } else if (!strcmp(argv[0], "picture")) { + fprintf(stderr, _("Saving picture image.\n")); + } else if (!strcmp(argv[0], "screensaver")) { + fprintf(stderr, _("Saving screen saver.\n")); + } else { + fprintf(stderr, _("You should specify what kind of logo to save!\n")); + return (-1); + } + + /* The second argument is the bitmap file. */ + if (GSM_ReadBitmapFileOnConsole(argv[1], &bitmap)!=GE_NONE) return -1; + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + /* We check optional parameters from 2'rd */ + optind = 2; + + if (!strcmp(argv[0], "op")) { + GSM_ResizeBitmap(&bitmap,GSM_CallerLogo); + + /* The third argument, if present, is the Network code of the operator. + * Network code is in this format: "xxx yy" */ + if (argc > 2) { + strcpy(bitmap.netcode, argv[2]); +#ifdef DEBUG + fprintf(stdout, _("Operator code: %s\n"), argv[2]); +#endif + if (!strcmp(GSM_GetNetworkName(bitmap.netcode),"unknown")) { + fprintf(stderr,"Sorry, gnokii doesn't know \"%s\" network !\n",bitmap.netcode); + GSM->Terminate(); + return -1; + } + optind++; + } else + { + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode,NetworkInfo.NetworkCode,7); + } + bitmap.type=GSM_OperatorLogo; + + /* Put bitmap into SMS structure */ + GSM_SaveBitmapToSMS(&MultiSMS,&bitmap,false,false); + + oplogonumber[6]=bitmap.netcode[0]; + oplogonumber[7]=bitmap.netcode[1]; + oplogonumber[8]=bitmap.netcode[2]; + oplogonumber[9]=bitmap.netcode[4]; + oplogonumber[10]=bitmap.netcode[5]; + for(i=0;i2) { + optind++; + if (strlen(argv[2])>121) { + fprintf(stdout,_("Sorry: length of text (parameter \"%s\") can be 121 chars or shorter only !\n"),argv[2]); + return -1; + } + strcpy(bitmap.text,argv[2]); + } + + /* Put bitmap into SMS structure */ + GSM_SaveBitmapToSMS(&MultiSMS,&bitmap,false,UnicodeText); + + for(i=0;i 3) { + strcpy(bitmap.netcode, argv[3]); +#ifdef DEBUG + fprintf(stdout, _("Operator code: %s\n"), argv[3]); +#endif + if (!strcmp(GSM_GetNetworkName(bitmap.netcode),"unknown")) { + fprintf(stderr,"Sorry, gnokii doesn't know \"%s\" network !\n",bitmap.netcode); + GSM->Terminate(); + return -1; + } + optind++; + } else + { + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode,NetworkInfo.NetworkCode,7); + } + bitmap.type=GSM_OperatorLogo; + } + if (!strcmp(argv[0], "caller")) { + GSM_ResizeBitmap(&bitmap,GSM_CallerLogo); + + bitmap.type=GSM_CallerLogo; + } + if (!strcmp(argv[0], "screensaver")) { + GSM_ResizeBitmap(&bitmap,GSM_PictureImage); + + bitmap.text[0]=0; + + for(i=0;i3) { + optind++; + if (strlen(argv[3])>121) { + fprintf(stdout,_("Sorry: length of text (parameter \"%s\") can be 121 chars or shorter only !\n"),argv[3]); + return -1; + } + strcpy(bitmap.text,argv[3]); + } + } + + /* Put bitmap into SMS structure */ + GSM_SaveBitmapToSMS(&MultiSMS,&bitmap,ScreenSaver,UnicodeText); + + /* The second argument is the destination, ie the phone number of recipient. */ + for(i=0;i9)) num=1; + bitmap.number=num; + } else + { + bitmap.number=1; + } + bitmap.number--; + bitmap.type=GSM_CallerLogo; + } + + if (!strcmp(argv[0],"picture")) { + /* There is a number missing in argument list. */ + if (argc==3) { + if (strlen(argv[2])==2) { + num=(argv[2][0]-'0')*10+(argv[2][1]-'0'); + } else { + num=argv[2][0]-'0'; + } + if (num<1) num=1; + bitmap.number=num; + } else + { + bitmap.number=1; + } + bitmap.number--; + bitmap.type=GSM_PictureImage; + } + + if (!strcmp(argv[0],"startup")) + bitmap.type=GSM_StartupLogo; + + if (!strcmp(argv[0],"7110startup")) + bitmap.type=GSM_7110StartupLogo; + + if (!strcmp(argv[0],"6210startup")) + bitmap.type=GSM_6210StartupLogo; + + if (!strcmp(argv[0],"dealer")) + bitmap.type=GSM_DealerNoteText; + + if (!strcmp(argv[0],"text")) + bitmap.type=GSM_WelcomeNoteText; + + if (bitmap.type!=GSM_None) { + + fbusinit(NULL); + + fprintf(stdout, _("Getting Logo\n")); + + error=GSM->GetBitmap(&bitmap); + + GSM->Terminate(); + + switch (error) + { + case GE_NONE: + if (bitmap.type==GSM_DealerNoteText) fprintf(stdout, _("Dealer welcome note ")); + if (bitmap.type==GSM_WelcomeNoteText) fprintf(stdout, _("Welcome note ")); + if (bitmap.type==GSM_DealerNoteText || bitmap.type==GSM_WelcomeNoteText) + { + if (bitmap.text[0]!=0) + { + fprintf(stdout, _("currently set to \"%s\"\n"), bitmap.text); + } else { + fprintf(stdout, _("currently empty\n")); + } + } else + { + if (bitmap.width!=0) + { + if (bitmap.type==GSM_OperatorLogo || bitmap.type==GSM_7110OperatorLogo) + { + fprintf(stdout,"Operator logo for %s (%s) network got succesfully\n",bitmap.netcode,GSM_GetNetworkName(bitmap.netcode)); + } + if (bitmap.type==GSM_StartupLogo || bitmap.type==GSM_7110StartupLogo || bitmap.type==GSM_6210StartupLogo) + { + fprintf(stdout,"Startup logo got successfully\n"); + } + if (bitmap.type==GSM_CallerLogo) + { + fprintf(stdout,"Caller logo got successfully\n"); + } + if (bitmap.type==GSM_PictureImage) + { + fprintf(stdout,"Picture Image got successfully"); + if (strcmp(bitmap.text,"")) + fprintf(stdout,_(", text \"%s\""),bitmap.text); + if (strcmp(bitmap.Sender,"")) + fprintf(stdout,_(", sender \"%s\""),bitmap.Sender); + fprintf(stdout,"\n"); + } + if (argc>1) + { + if (GSM_SaveBitmapFileOnConsole(argv[1], &bitmap)!=GE_NONE) return(-1); + } + } else + { + fprintf(stdout,"Your phone doesn't have logo uploaded !\n"); + return -1; + } + } + break; + case GE_NOTIMPLEMENTED: + fprintf(stderr, _("Function not implemented !\n")); + return -1; + case GE_NOTSUPPORTED: + fprintf(stderr, _("This kind of logo is not supported !\n")); + return -1; + default: + fprintf(stderr, _("Error getting logo (wrong location ?) !\n")); + return -1; + } + } else + { + fprintf(stderr, _("What kind of logo do you want to get ?\n")); + return -1; + } + + return 0; +} + +/* Setting logos. */ + +int setlogo(int argc, char *argv[]) +{ + + GSM_Bitmap bitmap,oldbit; + GSM_NetworkInfo NetworkInfo; + GSM_Error error; + char model[64]; + int num; + + bool ok=true; + + int i; + + fbusinit(NULL); + + if (!strcmp(argv[0],"text") || !strcmp(argv[0],"dealer")) + { + if (!strcmp(argv[0],"text")) bitmap.type=GSM_WelcomeNoteText; + else bitmap.type=GSM_DealerNoteText; + bitmap.text[0]=0x00; + if (argc>1) strncpy(bitmap.text,argv[1],255); + } else + { + if (!strcmp(argv[0],"op") || !strcmp(argv[0],"startup") || !strcmp(argv[0],"caller") || + !strcmp(argv[0],"7110op") || !strcmp(argv[0],"6210startup") || !strcmp(argv[0],"7110startup") || + !strcmp(argv[0],"picture")) + { + if (argc>1) + { + if (!strcmp(argv[0],"startup")) + { + bitmap.type=GSM_StartupLogo; + bitmap.width=84; + bitmap.height=48; + bitmap.size=bitmap.width*bitmap.height/8; + num=argv[1][0]-'0'; + if (num>=1 && num<=3) { + bitmap.number=num; + } else { + if (GSM_ReadBitmapFileOnConsole(argv[1], &bitmap)!=GE_NONE) { + GSM->Terminate(); + return(-1); + } + bitmap.number=0; + GSM_ResizeBitmap(&bitmap,GSM_StartupLogo); + } + } else { + if (GSM_ReadBitmapFileOnConsole(argv[1], &bitmap)!=GE_NONE) { + GSM->Terminate(); + return(-1); + } + } + if (!strcmp(argv[0],"op")) + { + if (bitmap.type!=GSM_OperatorLogo || argc<3) + { + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode,NetworkInfo.NetworkCode,7); + } + GSM_ResizeBitmap(&bitmap,GSM_OperatorLogo); + if (argc==3) + { + strncpy(bitmap.netcode,argv[2],7); + if (!strcmp(GSM_GetNetworkName(bitmap.netcode),"unknown")) + { + fprintf(stderr,"Sorry, gnokii doesn't know \"%s\" network !\n",bitmap.netcode); + return -1; + } + } + } + if (!strcmp(argv[0],"7110op")) + { + if (bitmap.type!=GSM_7110OperatorLogo || argc<3) + { + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode,NetworkInfo.NetworkCode,7); + } + GSM_ResizeBitmap(&bitmap,GSM_7110OperatorLogo); + if (argc==3) + { + strncpy(bitmap.netcode,argv[2],7); + if (!strcmp(GSM_GetNetworkName(bitmap.netcode),"unknown")) + { + fprintf(stderr,"Sorry, gnokii doesn't know \"%s\" network !\n",bitmap.netcode); + return -1; + } + } + } + if (!strcmp(argv[0],"picture")) + { + GSM_ResizeBitmap(&bitmap,GSM_PictureImage); + bitmap.number=1; + if (argc>2) + { + if (strlen(argv[2])==2) { + num=(argv[2][0]-'0')*10+(argv[2][1]-'0'); + } else { + num=argv[2][0]-'0'; + } + if (num<1) num=1; + bitmap.number=num; + } + bitmap.number--; + bitmap.text[0]=0; + if (argc>3) + strncpy(bitmap.text,argv[3],121); + strcpy(bitmap.Sender,"\0"); + if (argc>4) + strncpy(bitmap.Sender,argv[4],GSM_MAX_SENDER_LENGTH); + } + if (!strcmp(argv[0],"7110startup")) + { + GSM_ResizeBitmap(&bitmap,GSM_7110StartupLogo); + } + if (!strcmp(argv[0],"6210startup")) + { + GSM_ResizeBitmap(&bitmap,GSM_6210StartupLogo); + } + if (!strcmp(argv[0],"caller")) + { + GSM_ResizeBitmap(&bitmap,GSM_CallerLogo); + if (argc>2) + { + num=argv[2][0]-'0'; + if ((num<0)||(num>9)) num=0; + bitmap.number=num; + } else + { + bitmap.number=0; + } + oldbit.type=GSM_CallerLogo; + oldbit.number=bitmap.number; + if (GSM->GetBitmap(&oldbit)==GE_NONE) + { + /* We have to get the old name and ringtone!! */ + bitmap.ringtone=oldbit.ringtone; + strncpy(bitmap.text,oldbit.text,255); + } + if (argc>3) strncpy(bitmap.text,argv[3],255); + } + fprintf(stdout, _("Setting Logo.\n")); + } else + { + /* FIX ME: is it possible to permanently remove op logo ? */ + if (!strcmp(argv[0],"op")) + { + bitmap.type=GSM_OperatorLogo; + strncpy(bitmap.netcode,"000 00",7); + bitmap.width=72; + bitmap.height=14; + bitmap.size=bitmap.width*bitmap.height/8; + GSM_ClearBitmap(&bitmap); + } + if (!strcmp(argv[0],"7110op")) + { + bitmap.type=GSM_7110OperatorLogo; + strncpy(bitmap.netcode,"000 00",7); + bitmap.width=78; + bitmap.height=21; + bitmap.size=(bitmap.width*bitmap.height + 7)/8; + GSM_ClearBitmap(&bitmap); + } + /* FIX ME: how to remove startup and group logos ? */ + fprintf(stdout, _("Removing Logo.\n")); + } + } else + { + fprintf(stderr, _("What kind of logo do you want to set ?\n")); + GSM->Terminate(); + return -1; + } + } + + while (GSM->GetModel(model) != GE_NONE) + sleep(1); + + /* For Nokia 6110/6130/6150 we use different method of uploading. + Phone will display menu, when received it */ + if (!strcmp(model,"NSE-3") || !strcmp(model,"NSK-3") || !strcmp(model,"NSM-1")) + { + if (!strcmp(argv[0],"caller") && argc<3) + bitmap.number=255; + if (!strcmp(argv[0],"op") && argc<3) + bitmap.number=255; + } + + error=GSM->SetBitmap(&bitmap); + + switch (error) + { + case GE_NONE: oldbit.type=bitmap.type; + oldbit.number=bitmap.number; + if (GSM->GetBitmap(&oldbit)==GE_NONE) { + if (bitmap.type==GSM_WelcomeNoteText || + bitmap.type==GSM_DealerNoteText) { + if (strcmp(bitmap.text,oldbit.text)) { + fprintf(stderr, _("Error setting")); + if (bitmap.type==GSM_DealerNoteText) fprintf(stderr, _(" dealer")); + fprintf(stderr, _(" welcome note - ")); + + /* I know, it looks horrible, but... */ + /* I set it to the short string - if it won't be set */ + /* it means, PIN is required. If it will be correct, previous */ + /* (user) text was too long */ + + /* Without it, I could have such thing: */ + /* user set text to very short string (for example, "Marcin") */ + /* then enable phone without PIN and try to set it to the very long (too long for phone) */ + /* string (which start with "Marcin"). If we compare them as only length different, we could think, */ + /* that phone accepts strings 6 chars length only (length of "Marcin") */ + /* When we make it correct, we don't have this mistake */ + + strcpy(oldbit.text,"!\0"); + GSM->SetBitmap(&oldbit); + GSM->GetBitmap(&oldbit); + if (oldbit.text[0]!='!') { + fprintf(stderr, _("SIM card and PIN is required\n")); + } else { + GSM->SetBitmap(&bitmap); + GSM->GetBitmap(&oldbit); + fprintf(stderr, _("too long, truncated to \"%s\" (length %i)\n"),oldbit.text,strlen(oldbit.text)); + } + ok=false; + } + } else { + if (bitmap.type==GSM_StartupLogo) { + for (i=0;iTerminate(); + + return 0; +} + +/* Calendar notes receiving. */ + +int getcalendarnote(int argc, char *argv[]) +{ + GSM_CalendarNote CalendarNote; + GSM_NotesInfo NotesInfo; + GSM_Error error; + int i; + int vCalVer=0; + bool vInfo=false; + int start, stop; + bool was_note=false; + char z_text[MAX_CALENDAR_TEXT_LENGTH+11]; + + /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ + char model[64]; + + struct tm *now; + time_t nowh; + GSM_DateTime Date; + + nowh=time(NULL); + now=localtime(&nowh); + + Date.Year = now->tm_year; + + /* I have 100 (for 2000) Year now :-) */ + if (Date.Year>99 && Date.Year<1900) { + Date.Year=Date.Year+1900; + } + + start=atoi(argv[0]); + stop=start; + + switch (argc) { + case 2: + if (!strcmp(argv[argc-1],"-v10")) { + vCalVer=10; + } else { + if (!strcmp(argv[argc-1],"-v30")) { + vCalVer=30; + } else { + stop=atoi(argv[1]); + } + } + break; + case 3: + stop=atoi(argv[1]); + if (!strcmp(argv[argc-1],"-v10")) { + vCalVer=10; + } else { + if (!strcmp(argv[argc-1],"-v30")) { + vCalVer=30; + } else { + usage(); + return -1; + } + } + break; + } + + fbusinit(NULL); + + while (GSM->GetModel(model) != GE_NONE) + sleep(1); + + if (!strcmp(argv[0],"-s") || !strcmp(argv[0],"--short")) + vInfo=true; + else if (!isdigit(argv[0][0])) { + usage(); + return -1; + } + + error=GSM->GetCalendarNotesInfo(&NotesInfo); + if ( error == GE_NONE ) { + if( NotesInfo.HowMany == 0 ) { + fprintf(stderr, _("Sorry! No Calendar Notes present on phone.\n")); + start=0; stop=(-1); /* This for skipping next 'for' loop ;-> */ + } +#ifdef DEBUG + fprintf(stdout, _(" CALENDAR NOTES INFO \n")); + fprintf(stdout, _("---------------------\n")); + fprintf(stdout, _("How Many Locations :%d\n"), NotesInfo.HowMany); + + /* For 6210 (NPE-3) and 7110 (NSE-5), Locations have a different behaviour */ + if ( GetModelFeature (FN_CALENDAR)==F_CAL71 ) { + fprintf(stdout, _("Locations are :\n")); + for(i=0;i */ + } + } + + if (GetModelFeature (FN_CALENDAR)!=F_CAL71) { + error=GE_NONE; + NotesInfo.HowMany=200; + for (i=0;i<200;i++) { + NotesInfo.Location[i]=i+1; + } + } + + if( vInfo && stop!=(-1) && error==GE_NONE ) + { + /* Info datas (for 7110 and comp.) */ + fprintf(stdout, _(" CALENDAR NOTES SUMMARY INFORMATION \n")); + fprintf(stdout, _(" ==================================\n")); + if (GetModelFeature (FN_CALENDAR)==F_CAL71) { + fprintf(stdout, _("Calendar notes present on phone: %d\n"), NotesInfo.HowMany); + fprintf(stdout, _("Locations are :\n")); + } + fprintf(stdout, "----------------------------------------------------------------------------\n"); + fprintf(stdout,_(" Loc Phys Type Summary description Dt start Alarm Recurs\n") ); + fprintf(stdout, "----------------------------------------------------------------------------\n"); + + for(i=0;iGetCalendarNote(&CalendarNote) == GE_NONE) { + char z_type[11]; + char z_recur[15]; + switch (CalendarNote.Type) { + case GCN_REMINDER:strcpy(z_type, "REMIND"); break; + case GCN_CALL: strcpy(z_type, "CALL"); break; + case GCN_MEETING: strcpy(z_type, "MEETING"); break; + case GCN_BIRTHDAY:strcpy(z_type, "BDAY"); break; + default: strcpy(z_type, "UNKNOWN"); break; + } + + if( CalendarNote.Recurrance ) { + sprintf( z_recur,"%d ", CalendarNote.Recurrance/24 ); + strcat( z_recur, CalendarNote.Recurrance == 1 ? "day" : "days" ); + } + else + strcpy( z_recur, "No" ); + + strcpy(z_text,""); + + if( CalendarNote.Type == GCN_CALL ) + sprintf(z_text, "\"%s\"", CalendarNote.Phone ); + + if (CalendarNote.Text[0]!=0) + sprintf(z_text, "\"%s\"", CalendarNote.Text ); + + if(CalendarNote.Type == GCN_BIRTHDAY) { + int i_age; + i_age = Date.Year - CalendarNote.Time.Year; + sprintf(z_text, "\"%s (%d %s)\"", CalendarNote.Text, + i_age, (i_age==1)?"year":"years"); + strcpy( z_recur, "-" ); + if (GetModelFeature (FN_CALENDAR)==F_CAL71) + fprintf(stdout, + _("%4d %4d %-7.7s %-32.32s %04d-%02d-%02d %s %s\n"), + i+1,NotesInfo.Location[i], z_type, z_text, + CalendarNote.Time.Year, + CalendarNote.Time.Month, + CalendarNote.Time.Day, + (CalendarNote.AlarmType==0x00) ? "Tone " : "Silent", + " " ); + else + fprintf(stdout, + _("%4d %4d %-7.7s %-32.32s %04d-%02d-%02d %s %s\n"), + i+1,NotesInfo.Location[i], z_type, z_text, + CalendarNote.Time.Year, + CalendarNote.Time.Month, + CalendarNote.Time.Day, + (CalendarNote.Alarm.Year) ? "Yes" : "No ", + " " ); + } else + if (GetModelFeature (FN_CALENDAR)==F_CAL71) + fprintf(stdout, + _("%4d %4d %-7.7s %-32.32s %04d-%02d-%02d %s %s\n"), + i+1,NotesInfo.Location[i], z_type, z_text, + CalendarNote.Time.Year, + CalendarNote.Time.Month, + CalendarNote.Time.Day, + (CalendarNote.Alarm.Year) ? "Yes" : "No ", + z_recur ); + else + fprintf(stdout, + _("%4d %4d %-7.7s %-32.32s %04d-%02d-%02d %s\n"), + i+1,NotesInfo.Location[i], z_type, z_text, + CalendarNote.Time.Year, + CalendarNote.Time.Month, + CalendarNote.Time.Day, + (CalendarNote.Alarm.Year) ? "Yes" : "No "); + } else { + if (GetModelFeature (FN_CALENDAR)!=F_CAL71) break; + } + } + } + else + for (i=start;i<=stop;i++) { + if (error==GE_NONE) { + if( i>NotesInfo.HowMany ) { + fprintf(stderr, _("Only %d Calendar Notes present on phone!\n"),NotesInfo.HowMany); + break; + } + if( i==0 ) { + fprintf(stderr, _("Calendar Notes location can't be zero... skipping.\n")); + continue; + } + } + + CalendarNote.Location=i; + CalendarNote.ReadNotesInfo=false; + + if (GSM->GetCalendarNote(&CalendarNote) == GE_NONE) { + + if (vCalVer!=0) { + if (!was_note) { + fprintf(stdout, GSM_GetVCALENDARStart(vCalVer)); + was_note=true; + } + + fprintf(stdout, GSM_GetVCALENDARNote(&CalendarNote,vCalVer)); + + } else { /* not vCal */ + + if (was_note) { + fprintf(stdout, "\n"); + } else { + was_note=true; + } + + fprintf(stdout, _(" Type of the note: ")); + + switch (CalendarNote.Type) { + + case GCN_REMINDER:fprintf(stdout, _("Reminder\n"));break; + case GCN_CALL :fprintf(stdout, _("Call\n")); break; + case GCN_MEETING :fprintf(stdout, _("Meeting\n")); break; + case GCN_BIRTHDAY:fprintf(stdout, _("Birthday\n"));break; + default: fprintf(stdout, _("Unknown\n")); + + } + + /* For 3310: set date to 2090! */ + if (GetModelFeature (FN_CALENDAR)==F_CAL33) { + fprintf(stdout, _(" Date: xxxx-%02d-%02d\n"), CalendarNote.Time.Month, + CalendarNote.Time.Day); + } else { + fprintf(stdout, _(" Date: %s %d-%02d-%02d\n"), + DayOfWeek(CalendarNote.Time.Year, CalendarNote.Time.Month, CalendarNote.Time.Day), + CalendarNote.Time.Year, + CalendarNote.Time.Month, + CalendarNote.Time.Day); + } + + fprintf(stdout, _(" Time: %02d:%02d:%02d\n"), CalendarNote.Time.Hour, + CalendarNote.Time.Minute, + CalendarNote.Time.Second); + + if (CalendarNote.Alarm.Year!=0) { + fprintf(stdout, _(" Alarm date: %s %d-%02d-%02d\n"), + DayOfWeek(CalendarNote.Alarm.Year, CalendarNote.Alarm.Month, CalendarNote.Alarm.Day), + CalendarNote.Alarm.Year, + CalendarNote.Alarm.Month, + CalendarNote.Alarm.Day); + + fprintf(stdout, _(" Alarm time: %02d:%02d:%02d\n"), CalendarNote.Alarm.Hour, + CalendarNote.Alarm.Minute, + CalendarNote.Alarm.Second); + if ( GetModelFeature (FN_CALENDAR)==F_CAL71 ) + fprintf(stdout, _(" Alarm type: %s\n"), (CalendarNote.AlarmType==0x00) ? + "With Tone" : "Silent" ); + } + + if ( GetModelFeature (FN_CALENDAR)==F_CAL71 && CalendarNote.Recurrance!= 0 ) + fprintf(stdout, " It repeat every %d day%s\n", CalendarNote.Recurrance/24, + ((CalendarNote.Recurrance/24)>1) ? "s":"" ); + + if (CalendarNote.Type == GCN_BIRTHDAY) + { + int i_age; + i_age = Date.Year - CalendarNote.Time.Year; + fprintf(stdout, _(" Text: %s (%d %s)\n"), CalendarNote.Text, + i_age, (i_age==1)?"year":"years"); + } else { + if (CalendarNote.Text[0]!=0) + fprintf(stdout, _(" Text: %s\n"), CalendarNote.Text); + } + + if (CalendarNote.Type == GCN_CALL) + fprintf(stdout, _(" Phone: %s\n"), CalendarNote.Phone); + } + } else { + fprintf(stderr, _("The calendar note %i can not be read\n"),i); + } + } + + if (was_note && vCalVer!=0) { + fprintf(stdout, GSM_GetVCALENDAREnd(vCalVer)); + } + + GSM->Terminate(); + + return 0; +} + +/* Writing calendar notes. */ + +int writecalendarnote(char *argv[]) +{ + GSM_CalendarNote CalendarNote; + GSM_Error error; + int number; + + number=atoi(argv[1]); + + if (number<1) { + fprintf(stdout, _("Number of calendar note must be 1 or higher\n")); + return -1; + } + + switch ( GSM_ReadVCalendarFile(argv[0], &CalendarNote, &number) ) { + case GE_NONE: + break; + case GE_CANTOPENFILE: + fprintf(stdout, _("Failed to open vCalendar file \"%s\"\n"),argv[0]); + return -1; + case GE_TOOSHORT: + fprintf(stdout, _("Number of given calendar note is too high (max=%i)\n"),number); + return(-1); + default: + fprintf(stdout, _("Failed to parse vCalendar file \"%s\"\n"),argv[0]); + return -1; + } + + fbusinit(NULL); + + /* Error 22=Calendar full ;-) */ + + error=GSM->WriteCalendarNote(&CalendarNote); + switch (error) { + case GE_NONE: + fprintf(stdout, _("Succesfully written!\n"));break; + case GE_TOOLONG: + fprintf(stdout, _("Too long text in calendar note!\n"));break; + default: + fprintf(stdout, _("Failed to write calendar note!\n"));break; + } + + GSM->Terminate(); + + return 0; +} + +/* Calendar note deleting. */ + +int deletecalendarnote(char *Index) +{ + + GSM_CalendarNote CalendarNote; + + CalendarNote.Location=atoi(Index); + + fbusinit(NULL); + + if (GSM->DeleteCalendarNote(&CalendarNote) == GE_NONE) { + fprintf(stdout, _(" Calendar note deleted.\n")); + } + else { + fprintf(stderr, _("The calendar note can not be deleted\n")); + + GSM->Terminate(); + return -1; + } + + GSM->Terminate(); + + return 0; +} + +/* Setting the date and time. */ + +int setdatetime(int argc, char *argv[]) +{ + struct tm *now; + time_t nowh; + GSM_DateTime Date; + + fbusinit(NULL); + + nowh=time(NULL); + now=localtime(&nowh); + + Date.Year = now->tm_year; + Date.Month = now->tm_mon+1; + Date.Day = now->tm_mday; + Date.Hour = now->tm_hour; + Date.Minute = now->tm_min; + Date.Second = now->tm_sec; + + if (argc>0) Date.Year = atoi (argv[0]); + if (argc>1) Date.Month = atoi (argv[1]); + if (argc>2) Date.Day = atoi (argv[2]); + if (argc>3) Date.Hour = atoi (argv[3]); + if (argc>4) Date.Minute = atoi (argv[4]); + + if (Date.Year<1900) + { + + /* Well, this thing is copyrighted in U.S. This technique is known as + Windowing and you can read something about it in LinuxWeekly News: + http://lwn.net/1999/features/Windowing.phtml. This thing is beeing + written in Czech republic and Poland where algorithms are not allowed + to be patented. */ + + if (Date.Year>90) + Date.Year = Date.Year+1900; + else + Date.Year = Date.Year+2000; + } + + /* FIXME: Error checking should be here. */ + GSM->SetDateTime(&Date); + + GSM->Terminate(); + + return 0; +} + +/* In this mode we receive the date and time from mobile phone. */ + +int getdatetime(void) { + + GSM_DateTime date_time; + + fbusinit(NULL); + + if (GSM->GetDateTime(&date_time)==GE_NONE) { + if (date_time.IsSet) { + fprintf(stdout, _("Date: %s %4d/%02d/%02d\n"), + DayOfWeek(date_time.Year, date_time.Month, date_time.Day), + date_time.Year, date_time.Month, date_time.Day); + fprintf(stdout, _("Time: %02d:%02d:%02d\n"), date_time.Hour, date_time.Minute, date_time.Second); + } else { + fprintf(stdout, _("Date and time not set in phone\n")); + } + } else { + fprintf(stdout,_("Error!\n")); + } + + GSM->Terminate(); + + return 0; +} + +/* Setting the alarm. */ + +int setalarm(char *argv[]) +{ + + GSM_DateTime Date; + + fbusinit(NULL); + + Date.Hour = atoi(argv[0]); + Date.Minute = atoi(argv[1]); + + GSM->SetAlarm(1, &Date); + + GSM->Terminate(); + + return 0; +} + +/* Getting the alarm. */ + +int getalarm(void) { + + GSM_DateTime date_time; + + fbusinit(NULL); + + if (GSM->GetAlarm(0, &date_time)==GE_NONE) { + fprintf(stdout, _("Alarm: %s\n"), (date_time.IsSet)?"on":"off"); + fprintf(stdout, _("Time: %02d:%02d\n"), date_time.Hour, date_time.Minute); + } else { + fprintf(stdout,_("Error!\n")); + } + + GSM->Terminate(); + + return 0; +} + +/* In monitor mode we don't do much, we just initialise the fbus code. + Note that the fbus code no longer has an internal monitor mode switch, + instead compile with DEBUG enabled to get all the gumpf. */ + +int monitormode(int argc, char *argv[]) +{ + + float rflevel=-1, batterylevel=-1; + unsigned char loop=1; + + GSM_PowerSource powersource=-1; + GSM_RFUnits rf_units = GRF_Arbitrary; + GSM_BatteryUnits batt_units = GBU_Arbitrary; + + GSM_NetworkInfo NetworkInfo; + GSM_CBMessage CBMessage; + + GSM_MemoryStatus SIMMemoryStatus = {GMT_SM, 0, 0}; + GSM_MemoryStatus PhoneMemoryStatus = {GMT_ME, 0, 0}; + GSM_MemoryStatus DC_MemoryStatus = {GMT_DC, 0, 0}; + GSM_MemoryStatus EN_MemoryStatus = {GMT_EN, 0, 0}; + GSM_MemoryStatus FD_MemoryStatus = {GMT_FD, 0, 0}; + GSM_MemoryStatus LD_MemoryStatus = {GMT_LD, 0, 0}; + GSM_MemoryStatus MC_MemoryStatus = {GMT_MC, 0, 0}; + GSM_MemoryStatus ON_MemoryStatus = {GMT_ON, 0, 0}; + GSM_MemoryStatus RC_MemoryStatus = {GMT_RC, 0, 0}; + + GSM_SMSStatus SMSStatus = {0, 0}; + + char Number[20]; + + /* evaluate for presence of "-noloop" argument in parameter */ + if(argc>0) + { + if( strcmp(argv[0],"-noloop" ) && strcmp(argv[0],"-nl" )) + { + usage(); + return -1; + } + else + loop=0; + } + + /* We do not want to monitor serial line forever - press Ctrl+C to stop the + monitoring mode. */ + + signal(SIGINT, interrupted); + + fprintf (stderr, _("Entering monitor mode...\n")); + fprintf (stderr, _("Initialising GSM interface...\n")); + + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + sleep(1); + GSM->EnableCellBroadcast(); + + /* Loop here indefinitely - allows you to see messages from GSM code in + response to unknown messages etc. The loops ends after pressing the + Ctrl+C. */ + while (!bshutdown) { + if (GSM->GetRFLevel(&rf_units, &rflevel) == GE_NONE) + fprintf(stdout, _("RFLevel: %d\n"), (int)rflevel); + + if (GSM->GetBatteryLevel(&batt_units, &batterylevel) == GE_NONE) + fprintf(stdout, _("Battery: %d\n"), (int)batterylevel); + + if (GSM->GetPowerSource(&powersource) == GE_NONE) + fprintf(stdout, _("Power Source: %s\n"), (powersource==GPS_ACDC)?_("AC/DC"):_("battery")); + + if (GSM->GetMemoryStatus(&SIMMemoryStatus) == GE_NONE) + fprintf(stdout, _("SIM: Used %d, Free %d\n"), SIMMemoryStatus.Used, SIMMemoryStatus.Free); + + if (GSM->GetMemoryStatus(&PhoneMemoryStatus) == GE_NONE) + fprintf(stdout, _("Phone: Used %d, Free %d\n"), PhoneMemoryStatus.Used, PhoneMemoryStatus.Free); + + if (GSM->GetMemoryStatus(&DC_MemoryStatus) == GE_NONE) + fprintf(stdout, _("DC: Used %d, Free %d\n"), DC_MemoryStatus.Used, DC_MemoryStatus.Free); + + if (GSM->GetMemoryStatus(&EN_MemoryStatus) == GE_NONE) + fprintf(stdout, _("EN: Used %d, Free %d\n"), EN_MemoryStatus.Used, EN_MemoryStatus.Free); + + if (GSM->GetMemoryStatus(&FD_MemoryStatus) == GE_NONE) + fprintf(stdout, _("FD: Used %d, Free %d\n"), FD_MemoryStatus.Used, FD_MemoryStatus.Free); + + if (GSM->GetMemoryStatus(&LD_MemoryStatus) == GE_NONE) + fprintf(stdout, _("LD: Used %d, Free %d\n"), LD_MemoryStatus.Used, LD_MemoryStatus.Free); + + if (GSM->GetMemoryStatus(&MC_MemoryStatus) == GE_NONE) + fprintf(stdout, _("MC: Used %d, Free %d\n"), MC_MemoryStatus.Used, MC_MemoryStatus.Free); + + if (GSM->GetMemoryStatus(&ON_MemoryStatus) == GE_NONE) + fprintf(stdout, _("ON: Used %d, Free %d\n"), ON_MemoryStatus.Used, ON_MemoryStatus.Free); + + if (GSM->GetMemoryStatus(&RC_MemoryStatus) == GE_NONE) + fprintf(stdout, _("RC: Used %d, Free %d\n"), RC_MemoryStatus.Used, RC_MemoryStatus.Free); + + if (GSM->GetSMSStatus(&SMSStatus) == GE_NONE) + fprintf(stdout, _("SMS Messages: UnRead %d, Number %d\n"), SMSStatus.UnRead, SMSStatus.Number); + + if (GSM->GetIncomingCallNr(Number) == GE_NONE) + fprintf(stdout, _("Incoming call: %s\n"), Number); + + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) + fprintf(stdout, _("Network: %s (%s), LAC: %s, CellID: %s\n"), GSM_GetNetworkName (NetworkInfo.NetworkCode), GSM_GetCountryName(NetworkInfo.NetworkCode), NetworkInfo.LAC, NetworkInfo.CellID); + + if (GSM->ReadCellBroadcast(&CBMessage) == GE_NONE) + fprintf(stdout, _("Cell broadcast received on channel %d: %s\n"), CBMessage.Channel, CBMessage.Message); + + if( !loop ) break; + + sleep(1); + } + + if( loop ) fprintf (stderr, _("Leaving monitor mode...\n")); + + GSM->Terminate(); + + return 0; +} + +/* Shows texts from phone's display */ + +int displayoutput() +{ + + GSM_Error error; + + fbusinit(NULL); + + error=GSM->EnableDisplayOutput(); + + if (error == GE_NONE) + { + + /* We do not want to see texts forever - press Ctrl+C to stop. */ + + signal(SIGINT, interrupted); + + fprintf (stderr, _("Entering display monitoring mode...\n")); + + /* Loop here indefinitely - allows you to read texts from phone's + display. The loops ends after pressing the Ctrl+C. */ + + while (!bshutdown) + sleep(1); + + fprintf (stderr, _("Leaving display monitor mode...\n")); + + error=GSM->DisableDisplayOutput(); + if (error!=GE_NONE) + fprintf (stderr, _("Error!\n")); + } else + fprintf (stderr, _("Error!\n")); + + GSM->Terminate(); + + return 0; +} + +/* Displays names of available ringtones */ +int allringtones() +{ + char model[64], rev[64]; + int i; + + fbusinit(NULL); + + while (GSM->GetRevision(rev) != GE_NONE) + sleep(1); + + while (GSM->GetModel(model) != GE_NONE) + sleep(1); + + strncpy(rev,rev+2,5); + rev[5]=0; + PrepareRingingTones(model,rev); + + for (i=1;i<=NumberOfRingtones();i++) + { + fprintf(stdout,_("%i. %s\n"),i,RingingToneName(0,i)); + } + + GSM->Terminate(); + + return 0; + +} + +/* Reads profile from phone and displays its' settings */ + +int getprofile(int argc, char *argv[]) +{ + + int max_profiles; + int start, stop, i; + GSM_Profile profile; + GSM_Error error; + + /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ + char model[64], rev[64]; + + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + profile.Number = 0; + error=GSM->GetProfile(&profile); + + if (error == GE_NONE) + { + + while (GSM->GetModel(model) != GE_NONE) sleep(1); + + while (GSM->GetRevision(rev) != GE_NONE) sleep(1); + + strncpy(rev,rev+2,5); + rev[5]=0; + PrepareRingingTones(model,rev); + + switch(GetModelFeature (FN_PROFILES)) { + case F_PROF33:max_profiles=6;break; + case F_PROF51:max_profiles=3;break; + default :max_profiles=7;break; + } + + if (argc>0) + { + profile.Number=atoi(argv[0])-1; + start=profile.Number; + stop=start+1; + + if (profile.Number < 0) + { + fprintf(stderr, _("Profile number must be value from 1 to %d!\n"), max_profiles); + GSM->Terminate(); + return -1; + } + + if (profile.Number >= max_profiles) + { + fprintf(stderr, _("This phone supports only %d profiles!\n"), max_profiles); + GSM->Terminate(); + return -1; + } + } else { + start=0; + stop=max_profiles; + } + + i=start; + while (iGetProfile(&profile); + + printf("%d. \"%s\"", (profile.Number+1), profile.Name); + if (profile.DefaultName==-1) printf(" (name defined)"); + printf("\n"); + +#ifdef DEBUG + printf("Incoming call alert: %d\n", profile.CallAlert); + printf("Ringtone ID: %d\n", profile.Ringtone); + printf("Ringing volume: %d\n", profile.Volume); + printf("Message alert tone: %d\n", profile.MessageTone); + printf("Keypad tones: %d\n", profile.KeypadTone); + printf("Warning and game tones: %d\n", profile.WarningTone); + printf("Lights: %d\n", profile.Lights); + printf("Vibration: %d\n", profile.Vibration); + printf("Caller groups: 0x%02x\n", profile.CallerGroups); + printf("Automatic answer: %d\n", profile.AutomaticAnswer); + printf("Screen saver: %d\n", profile.ScreenSaver); + printf("\n"); +#endif + + printf("Incoming call alert: %s\n", GetProfileCallAlertString(profile.CallAlert)); + + /* For different phones different ringtones names */ + if (strcmp(RingingToneName(profile.Ringtone,0),"")) + printf(_("Ringing tone: %s (number %d in phone menu)\n"), + RingingToneName(profile.Ringtone,0), RingingToneMenu(profile.Ringtone)); + else + printf(_("Ringtone number: %d\n"), profile.Ringtone); + + printf(_("Ringing volume: %s\n"), GetProfileVolumeString(profile.Volume)); + + printf(_("Message alert tone: %s\n"), GetProfileMessageToneString(profile.MessageTone)); + + printf(_("Keypad tones: %s\n"), GetProfileKeypadToneString(profile.KeypadTone)); + + printf(_("Warning and game tones: %s\n"), GetProfileWarningToneString(profile.WarningTone)); + + if (GetModelFeature (FN_SCREENSAVER)!=0) + printf(_("Screen saver: %s\n"), GetProfileOnOffString(profile.ScreenSaver)); + + printf(_("Vibration: %s\n"), GetProfileVibrationString(profile.Vibration)); + + /* It has been nice to add here reading caller group name. ;^) */ + if (GetModelFeature (FN_CALENDAR)==F_CAL71) + printf(_("Caller groups: %s\n"), + GetProfileCallerGroups(profile.CallerGroups) ); + + /* FIXME: need make investigation for 3310 for these features. For now unknown */ + if (GetModelFeature (FN_PROFILES)!=F_PROF33) { + /* FIXME: Light settings is only used for Car */ + if (profile.Number==(max_profiles-2)) printf(_("Lights: %s\n"), profile.Lights ? _("On") : _("Automatic")); + + /* FIXME: Automatic answer is only used for Car and Headset. */ + if (profile.Number>=(max_profiles-2)) printf(_("Automatic answer: %s\n"), GetProfileOnOffString(profile.AutomaticAnswer)); + } + + printf("\n"); + + i++; + } + } else { + if (error == GE_NOTIMPLEMENTED) { + fprintf(stderr, _("Function not implemented in %s model!\n"), model); + GSM->Terminate(); + return -1; + } else + { + fprintf(stderr, _("Unspecified error\n")); + GSM->Terminate(); + return -1; + } + } + + GSM->Terminate(); + + return 0; + +} + +/* Sets profile feature */ + +int setprofile(int argc, char *argv[]) +{ + +/* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ + char model[64], rev[64]; + + int max_profiles; + GSM_Profile profile; + GSM_Profile profile2, profile3; + GSM_Error error; + bool correct_arg1; + bool correct_arg2; + +/* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + profile.Number = 0; + + error = GSM->GetProfile(&profile); + + if (error == GE_NONE) + { + + while (GSM->GetModel(model) != GE_NONE) sleep(1); + + while (GSM->GetRevision(rev) != GE_NONE) sleep(1); + + strncpy(rev,rev+2,5); + rev[5]=0; + PrepareRingingTones(model,rev); + + switch(GetModelFeature (FN_PROFILES)) { + case F_PROF33:max_profiles=6;break; + case F_PROF51:max_profiles=3;break; + default :max_profiles=7;break; + } + + profile.Number=atoi (argv[0]); + profile.Number=profile.Number-1; + + if (profile.Number < 0) + { + fprintf(stderr, _("Profile number must be value from 1 to %i!\n"), max_profiles); + GSM->Terminate(); + return -1; + } + + if (profile.Number >= max_profiles) + { + fprintf(stderr, _("This phone supports only %i profiles!\n"), max_profiles); + GSM->Terminate(); + return -1; + } + + if (profile.Number!=0) GSM->GetProfile(&profile); + + correct_arg1=false; + correct_arg2=false; + + if (strcmp(argv[1], "callalert")==0) + { + if (strcmp(argv[2], "ringing")==0) {profile.CallAlert=PROFILE_CALLALERT_RINGING;correct_arg2=true;} + if (strcmp(argv[2], "ascending")==0) {profile.CallAlert=PROFILE_CALLALERT_ASCENDING;correct_arg2=true;} + if (strcmp(argv[2], "ringonce")==0) {profile.CallAlert=PROFILE_CALLALERT_RINGONCE;correct_arg2=true;} + if (strcmp(argv[2], "beeponce")==0) {profile.CallAlert=PROFILE_CALLALERT_BEEPONCE;correct_arg2=true;} + if (strcmp(argv[2], "groups")==0) + { + profile.CallAlert=PROFILE_CALLALERT_CALLERGROUPS; + correct_arg2=true; + /*Ignored by N5110*/ + /*FIX ME: it's ignored by N5130 and 3210 too*/ + if (max_profiles==3) fprintf(stdout, _("Warning: value \"groups\" for profile feature \"callalert\" will be ignored in this phone model !\n")); + } + if (strcmp(argv[2], "off")==0 || strcmp(argv[2], "0")==0) {profile.CallAlert=PROFILE_CALLALERT_OFF;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"callalert\" are ringing|ascending|ringonce|beeponce|groups|off|0 !\n")); + GSM->Terminate(); + return -1; + } + correct_arg1=true; + } + if (strcmp(argv[1], "volume")==0) + { + if (strcmp(argv[2], "1")==0) {profile.Volume=PROFILE_VOLUME_LEVEL1;correct_arg2=true;} + if (strcmp(argv[2], "2")==0) {profile.Volume=PROFILE_VOLUME_LEVEL2;correct_arg2=true;} + if (strcmp(argv[2], "3")==0) {profile.Volume=PROFILE_VOLUME_LEVEL3;correct_arg2=true;} + if (strcmp(argv[2], "4")==0) {profile.Volume=PROFILE_VOLUME_LEVEL4;correct_arg2=true;} + if (strcmp(argv[2], "5")==0) {profile.Volume=PROFILE_VOLUME_LEVEL5;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"volume\" are 0|1|2|3|4|5 !\n")); + GSM->Terminate(); + return -1; + } + correct_arg1=true; + } + if (strcmp(argv[1], "keypad")==0 || strcmp(argv[1], "keypadtone")==0) + { + if (strcmp(argv[2], "0")==0 || strcmp(argv[2], "off")==0) {profile.KeypadTone=PROFILE_KEYPAD_OFF;correct_arg2=true;} + if (strcmp(argv[2], "1")==0) {profile.KeypadTone=PROFILE_KEYPAD_LEVEL1;correct_arg2=true;} + if (strcmp(argv[2], "2")==0) {profile.KeypadTone=PROFILE_KEYPAD_LEVEL2;correct_arg2=true;} + if (strcmp(argv[2], "3")==0) {profile.KeypadTone=PROFILE_KEYPAD_LEVEL3;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"keypad|keypadtone\" are off|0|1|2|3 !\n")); + GSM->Terminate(); + return -1; + } + correct_arg1=true; + } + if (strcmp(argv[1], "messagetone")==0 || strcmp(argv[1], "smstone")==0 || strcmp(argv[1], "sms")==0 || strcmp(argv[1], "message")==0) + { + if (strcmp(argv[2], "0")==0 || strcmp(argv[2], "off")==0) {profile.MessageTone=PROFILE_MESSAGE_NOTONE;correct_arg2=true;} + if (strcmp(argv[2], "standard")==0) {profile.MessageTone=PROFILE_MESSAGE_STANDARD;correct_arg2=true;} + if (strcmp(argv[2], "special")==0) {profile.MessageTone=PROFILE_MESSAGE_SPECIAL;correct_arg2=true;} + if (strcmp(argv[2], "beeponce")==0 || strcmp(argv[2], "once")==0) {profile.MessageTone=PROFILE_MESSAGE_BEEPONCE;correct_arg2=true;} + if (strcmp(argv[2], "ascending")==0) {profile.MessageTone=PROFILE_MESSAGE_ASCENDING;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"messagetone|smstone|message|sms\" are 0|off|standard|special|beeponce|once|ascending !\n")); + GSM->Terminate(); + return -1; + } + correct_arg1=true; + } + if (strcmp(argv[1], "warningtone")==0 || strcmp(argv[1], "warning")==0) + { + if (strcmp(argv[2], "0")==0 || strcmp(argv[2], "off")==0) {profile.WarningTone=PROFILE_WARNING_OFF;correct_arg2=true;} + if (strcmp(argv[2], "1")==0 || strcmp(argv[2], "on")==0) {profile.WarningTone=PROFILE_WARNING_ON;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"warningtone|warning\" are 0|off|1|on !\n")); + GSM->Terminate(); + return -1; + } + correct_arg1=true; + } + if (strcmp(argv[1], "vibra")==0 || strcmp(argv[1], "vibration")==0) + { + if (strcmp(argv[2], "0")==0 || strcmp(argv[2], "off")==0) {profile.Vibration=PROFILE_VIBRATION_OFF;correct_arg2=true;} + if (strcmp(argv[2], "1")==0 || strcmp(argv[2], "on")==0) {profile.Vibration=PROFILE_VIBRATION_ON;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"vibration|vibra\" are 0|off|1|on !\n")); + GSM->Terminate(); + return -1; + } + correct_arg1=true; + } + if (strcmp(argv[1], "lights")==0) + { + if (strcmp(argv[2], "0")==0 || strcmp(argv[2], "off")==0) {profile.Lights=-1;correct_arg2=true;} + if (strcmp(argv[2], "1")==0 || strcmp(argv[2], "on")==0) {profile.Lights=0;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"lights\" are 0|off|1|on !\n")); + GSM->Terminate(); + return -1; + } + if (profile.Number!=(max_profiles-2)) + { + profile2.Number=max_profiles-2; + if (GSM->GetProfile(&profile2)==GE_NONE) + { + fprintf(stdout, _("Warning: \"Lights\" feature is ignored in this profile (only setting it for \"%s\" profile get some results) !\n"), profile2.Name); + } + } + correct_arg1=true; + } + if (strcmp(argv[1], "answer")==0) + { + if (strcmp(argv[2], "0")==0 || strcmp(argv[2], "off")==0) {profile.AutomaticAnswer=-1;correct_arg2=true;} + if (strcmp(argv[2], "1")==0 || strcmp(argv[2], "on")==0) {profile.AutomaticAnswer=0;correct_arg2=true;} + if (!correct_arg2) + { + fprintf(stderr, _("Correct parameters for profile feature \"answer\" are 0|off|1|on !\n")); + GSM->Terminate(); + return -1; + } + if (profile.Number<(max_profiles-2)) + { + profile2.Number=max_profiles-2; + if (GSM->GetProfile(&profile2)==GE_NONE) + { + profile3.Number=max_profiles-1; + if (GSM->GetProfile(&profile3)==GE_NONE) + { + fprintf(stdout, _("Warning: \"Automatic Answer\" feature is ignored in this profile (only setting it for \"%s\" and \"%s\" profiles get some results) !\n"), profile2.Name, profile3.Name); + } + } + } + correct_arg1=true; + } + if (strcmp(argv[1], "name")==0) + { + strcpy(profile.Name,argv[2]); + /*Ignored by N5110*/ + /*FIX ME: it's ignored by N5130 and 3210 too*/ + if (max_profiles==3) fprintf(stdout, _("Warning: this phone model doesn't allow to change profile name !\n")); + correct_arg1=true; + } + if (strcmp(argv[1], "ringtone")==0) + { + profile.Ringtone=atoi(argv[2]); + if (profile.Ringtone<1) + { + /*With value 0 results are interesting in N5110, but can't be used for anything*/ + fprintf(stderr, _("Ringtone number must be higher than 0 !\n")); + GSM->Terminate(); + return -1; + } else + { + if (profile.Ringtone>NumberOfRingtones()) + { + fprintf(stderr, _("Ringtone number too high (max %i) !\n"),NumberOfRingtones()); + GSM->Terminate(); + return -1; + } + profile.Ringtone=RingingToneCode(profile.Ringtone); + if (profile.Ringtone==0) + { + fprintf(stderr, _("Warning: we don't know ringtones codes for this model ! Can you contact with gnokii authors to add it into source ?\n")); + GSM->Terminate(); + return -1; + } + if (max_profiles==3) fprintf(stdout, _("Warning: ringtone is changed for all profiles. You must reset phone or select profile in phone againg to see result.\n")); + } + correct_arg1=true; + } + if (strcmp(argv[1], "groups")==0) + { + /*Ignored by N5110*/ + /*FIX ME: it's ignored by N5130 and 3210 too*/ + if (max_profiles==3) fprintf(stdout, _("Warning: this phone model doesn't allow to change caller group name !\n")); + profile.CallerGroups=atoi(argv[2]); + correct_arg1=true; + } + + if (!correct_arg1) + { + fprintf(stderr, _("Correct profile feature names are callalert|volume|keypad|keypadtone|messagetone|smstone|message|sms|warningtone|warning|vibra|vibration|lights|answer|name|groups !\n")); + GSM->Terminate(); + return -1; + } + + GSM->SetProfile(&profile); + + } else { + if (error == GE_NOTIMPLEMENTED) { + fprintf(stderr, _("Function not implemented in %s model!\n"), model); + GSM->Terminate(); + return -1; + } else + { + fprintf(stderr, _("Unspecified error\n")); + GSM->Terminate(); + return -1; + } + } + + GSM->Terminate(); + + return 0; + +} + +/* Get requested range of memory storage entries and output to stdout in + easy-to-parse format */ + +int getmemory(int argc, char *argv[]) +{ + + GSM_PhonebookEntry entry; + int count; + register int i; + GSM_Error error; + GSM_Bitmap bitmap; + char memory_type_string[20]; + int start_entry; + int end_entry; + int i_used = 0, n_used=0; + int do_all; + char *output_opt = NULL; + bool wasdate=false; + char az_group_name[5][MAX_BITMAP_TEXT_LENGTH]; + bool formatdone=false; + char buf[64]; + + /* group names init */ + for(i=0;i<5;i++) az_group_name[i][0]='\0'; + + /* Handle command line args that set type, start and end locations. */ + if (!GetMemoryTypeID(argv[0], &entry.MemoryType)) + { + fprintf(stderr, _("Unknown memory type %s!\n"), argv[0]); + return (-1); + } + GetMemoryTypeString(memory_type_string, &entry.MemoryType); + + if (argv[argc-1][0] == '-') + output_opt = argv[--argc]; + + /* Do generic initialisation routine */ + + fbusinit(NULL); + + while ((error = GSM->GetModel(buf)) != GE_NONE && i++ < 15) + sleep(1); + + if (argc > 1) { + do_all = 0; + start_entry = atoi (argv[1]); + end_entry = argc > 2 ? atoi( argv[2]) : start_entry; + } else { + GSM_MemoryStatus stats = {entry.MemoryType, 0, 0}; + + do_all = 1; + start_entry = 1; + if (GSM->GetMemoryStatus( &stats) != GE_NONE) { + fprintf( stderr, _("Error reading memory status.\n")); + GSM->Terminate(); + return -1; + } + n_used = stats.Used; + end_entry = stats.Used + stats.Free; + } + + + /* Now retrieve the requested entries. */ + + for (count = start_entry; + count <= end_entry && (!do_all || i_used < n_used); + count++) { + + entry.Location=count; + + error=GSM->GetMemoryLocation(&entry); + + switch (error) { + case GE_NONE: + if (entry.SubEntriesCount || strcmp( entry.Number, "")) + i_used++; + else if (do_all) + break; + if (output_opt && !strcmp( output_opt,"-v30")) { + semicolon_pipe_substitution( &entry, 0 ); + fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,30)); + formatdone=true; + } + if (output_opt && !strcmp(output_opt,"-v21")) { + semicolon_pipe_substitution( &entry, 0 ); + fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,21)); + formatdone=true; + } + if (output_opt && !strcmp(output_opt,"-v")) { + semicolon_pipe_substitution( &entry, 0 ); + fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,10)); + formatdone=true; + } + if (output_opt && !strcmp(output_opt,"-short")) { + semicolon_pipe_substitution( &entry, 0 ); + fprintf(stdout, "%s;%s;%s;%d;%d;", entry.Name, entry.Number, memory_type_string, entry.Location, entry.Group); + for( i = 0; i < entry.SubEntriesCount; i++ ) + { + if( entry.SubEntries[i].EntryType == GSM_Date ) + fprintf(stdout,_("%u;%u;%u;%02u.%02u.%04u;%02u:%02u:%02u;"), + entry.SubEntries[i].EntryType, + entry.SubEntries[i].NumberType, + entry.SubEntries[i].BlockNumber, + entry.SubEntries[i].data.Date.Day, + entry.SubEntries[i].data.Date.Month, + entry.SubEntries[i].data.Date.Year, + entry.SubEntries[i].data.Date.Hour, + entry.SubEntries[i].data.Date.Minute, + entry.SubEntries[i].data.Date.Second ); + else + fprintf(stdout,_("%u;%u;%u;%s;"), + entry.SubEntries[i].EntryType, + entry.SubEntries[i].NumberType, + entry.SubEntries[i].BlockNumber, + entry.SubEntries[i].data.Number ); + } + fprintf(stdout,_("\n")); + formatdone=true; + } + if (!formatdone) { + char z_gtype[12]; + wasdate=false; + fprintf(stdout, "Memory %s, location %d\n",memory_type_string, entry.Location); + + // check if some info in subentries + for( i = 0; i < entry.SubEntriesCount; i++ ) + if( entry.SubEntries[i].EntryType != GSM_Date && + strcmp(entry.SubEntries[i].data.Number,"") ) + break; + + if (strcmp(entry.Number,"") || i < entry.SubEntriesCount) { + if (strcmp(entry.Name,"")) fprintf(stdout,_(" Name: %s\n"),entry.Name); + if (strcmp(entry.Number,"")) fprintf(stdout,_(" Number: %s\n"),entry.Number); + bitmap.type=GSM_CallerLogo; + bitmap.number=entry.Group; + strcpy(z_gtype,"unknown"); + if (entry.Group==5) strcpy(z_gtype,"No group"); + if (entry.Group<5 && entry.Group>=0) { + if (!strcmp(az_group_name[entry.Group],"")) { + if (GetModelFeature (FN_CALLERGROUPS)!=0) { + if (GSM->GetBitmap(&bitmap)==GE_NONE) + strcpy( az_group_name[entry.Group], bitmap.text ); + } + if ((!strcmp(az_group_name[entry.Group],""))) { + switch(entry.Group) { + case 0:strcpy(az_group_name[entry.Group],"Family");break; + case 1:strcpy(az_group_name[entry.Group],"VIP");break; + case 2:strcpy(az_group_name[entry.Group],"Friends");break; + case 3:strcpy(az_group_name[entry.Group],"Colleagues");break; + case 4:strcpy(az_group_name[entry.Group],"Other");break; + default:break; + } + } + } + strcpy(z_gtype,az_group_name[entry.Group]); + } + fprintf(stdout,_(" Group: %d (%s)\n"),entry.Group+1,z_gtype); + for( i = 0; i < entry.SubEntriesCount; i++ ) + { + if( entry.SubEntries[i].EntryType == GSM_Date ) { + fprintf(stdout, " Date and time: %s %02u.%02u.%04u %02u:%02u:%02u\n", + DayOfWeek(entry.SubEntries[i].data.Date.Year, + entry.SubEntries[i].data.Date.Month, + entry.SubEntries[i].data.Date.Day), + entry.SubEntries[i].data.Date.Day, + entry.SubEntries[i].data.Date.Month, + entry.SubEntries[i].data.Date.Year, + entry.SubEntries[i].data.Date.Hour, + entry.SubEntries[i].data.Date.Minute, + entry.SubEntries[i].data.Date.Second); + wasdate=true; + } else { + if( strcmp(entry.SubEntries[i].data.Number,"") ) { + char z_etype[19]; + switch( entry.SubEntries[i].EntryType ) { + case GSM_Number: + switch( entry.SubEntries[i].NumberType ) { + case GSM_General: strcpy(z_etype,"General "); break; + case GSM_Home: strcpy(z_etype,"Home "); break; + case GSM_Mobile: strcpy(z_etype,"Mobile "); break; + case GSM_Work: strcpy(z_etype,"Work "); break; + case GSM_Fax: strcpy(z_etype,"Fax "); break; + default: strcpy(z_etype,""); break; + } + strcat(z_etype,"Number"); break; + case GSM_Note: + strcpy(z_etype,"Note"); break; + case GSM_Postal: + strcpy(z_etype,"Postal"); break; + case GSM_Email: + strcpy(z_etype,"E-Mail"); break; + default: + strcpy(z_etype,"unknown data"); break; + } +#ifdef DEBUG + fprintf(stdout,_(" ---> Subentry: %u\n"),i+1); + fprintf(stdout,_(" Entry type: %u (%s)\n"),entry.SubEntries[i].EntryType,z_etype); + fprintf(stdout,_(" Number type: %u\n"),entry.SubEntries[i].NumberType); + fprintf(stdout,_(" Block Number: %u\n"),entry.SubEntries[i].BlockNumber); +#endif + fprintf(stdout,_(" %s: %s\n"),z_etype,entry.SubEntries[i].data.Number); + } + } + } + if ((entry.MemoryType==GMT_DC || + entry.MemoryType==GMT_RC || + entry.MemoryType==GMT_MC) && !wasdate) + fprintf(stdout,_(" Date and time not available\n")); + } else + fprintf(stdout,_(" Location empty\n")); + } + break; + case GE_NOTIMPLEMENTED: + fprintf( stderr, _("Function not implemented in %s model!\n"), model); + GSM->Terminate(); + return -1; + case GE_INVALIDMEMORYTYPE: + fprintf( stderr, _("Memory type %s not supported!\n"), + memory_type_string); + GSM->Terminate(); + return -1; + default: + fprintf(stdout, _("%s|%d|Bad location or other error!(%d)\n"), + memory_type_string, count, error); + } + } + + GSM->Terminate(); + + return 0; +} + +/* Read data from stdin, parse and write to phone. The parsing is relatively + crude and doesn't allow for much variation from the stipulated format. */ + +int writephonebook(int argc, char *args[]) +{ + + GSM_PhonebookEntry entry; + GSM_Error error; + char *memory_type_string; + int line_count=0,current,i; + int subentry; + + char *Line, OLine[1024], BackLine[1024]; + char *ptr; + + /* Check argument */ + if (argc) { + if (strcmp("-i", args[0])) { + usage(); + return 0; + } + } + /* Initialise fbus code */ + + fbusinit(NULL); + + Line = OLine; + + /* Go through data from stdin. */ + + while (GetLine(stdin, Line, sizeof(OLine))!=-1) { + + current=0;BackLine[current++]=Line[0]; + for (i=1;iGetMemoryLocation(&tmp_entry); + if (error == GE_NONE) { + if (!tmp_entry.Empty) { + int confirm = -1; + char ans[8]; + FILE *input_flow; //for reading from console, even when input redir. + + input_flow = fopen(DEV_CONSOLE, "r"); + + if (!input_flow) { + fprintf(stderr, _("Can't open \"%s\" for input !\n"),DEV_CONSOLE); + return(-1); + } + + fprintf(stderr, _("Location busy. ")); + while (confirm < 0) { + fprintf(stderr, _("Overwrite? (yes/no) ")); + GetLine(input_flow, ans, 7); + if (!strcmp(ans, "yes")) confirm = 1; + else if (!strcmp(ans, "no")) confirm = 0; + } + if (!confirm) continue; + } + } else { + fprintf(stderr, _("Unknown error (%d)\n"), error); + GSM->Terminate(); + return 0; + } + } + + /* Do write and report success/failure. */ + semicolon_pipe_substitution( &entry, 1 ); + + error = GSM->WritePhonebookLocation(&entry); + + if (error == GE_NONE) + fprintf (stdout, _("Write Succeeded: memory type: %s, loc: %d, name: %s, number: %s\n"), memory_type_string, entry.Location, entry.Name, entry.Number); + else + fprintf (stdout, _("Write FAILED(%d): memory type: %s, loc: %d, name: %s, number: %s\n"), error, memory_type_string, entry.Location, entry.Name, entry.Number); + + } + + GSM->Terminate(); + + return 0; +} + +/* Getting speed dials. */ + +int getspeeddial(char *Number) { + + GSM_SpeedDial entry; + GSM_Error error; + GSM_PhonebookEntry pbentry; + + entry.Number = atoi(Number); + + fbusinit(NULL); + + if (GSM->GetSpeedDial(&entry)==GE_NONE) { + pbentry.Location=entry.Location; + if (pbentry.Location==0) pbentry.Location=entry.Number; + pbentry.MemoryType=entry.MemoryType; + + error=GSM->GetMemoryLocation(&pbentry); + + if (error == GE_NONE) + { + fprintf(stdout, _("SpeedDial nr. %d: %d:%d (%s)\n"), entry.Number, entry.MemoryType, entry.Location,pbentry.Name); + } else + fprintf(stdout, _("Error\n")); + } else { + fprintf(stdout, _("Error\n")); + } + + GSM->Terminate(); + + return 0; +} + +/* Setting speed dials. */ + +int setspeeddial(char *argv[]) { + + GSM_SpeedDial entry; + + char *memory_type_string; + + /* Handle command line args that set type, start and end locations. */ + + if (strcmp(argv[1], "ME") == 0) { + entry.MemoryType = GMT_ME; + memory_type_string = "ME"; + } + else if (strcmp(argv[1], "SM") == 0) { + entry.MemoryType = GMT_SM; + memory_type_string = "SM"; + } + else { + fprintf(stderr, _("Unknown memory type %s!\n"), argv[1]); + + return -1; + } + + entry.Number = atoi(argv[0]); + entry.Location = atoi(argv[2]); + + fbusinit(NULL); + + if (GSM->SetSpeedDial(&entry) == GE_NONE) { + fprintf(stdout, _("Succesfully written!\n")); + } + + GSM->Terminate(); + + return 0; +} + +/* Getting the status of the display. */ + +int getdisplaystatus() +{ + + int Status; + + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + if (GSM->GetDisplayStatus(&Status)==GE_NONE) { + + printf(_("Call in progress: %s\n"), Status & (1<Terminate(); + + return 0; +} + +int netmonitor(char *Mode) +{ + + unsigned char mode=atoi(Mode); + char Screen[NM_MAX_SCREEN_WIDTH]; + int i; + + fbusinit(NULL); + + if (!strcmp(Mode,"reset")) mode=0xf0; + else if (!strcmp(Mode,"off")) mode=0xf1; + else if (!strcmp(Mode,"field"))mode=0xf2; + else if (!strcmp(Mode,"devel"))mode=0xf3; + else if (!strcmp(Mode,"next")) mode=0x00; + + /* We clear it */ + for (i=0;iNetMonitor(mode, Screen); + + if (Screen) + printf("%s\n", Screen); + + GSM->Terminate(); + + return 0; +} + +int identify( void ) +{ + /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ + char imei[64], model[64], rev[64], manufacturer[64]; + + fbusinit(NULL); + + while (GSM->GetIMEI(imei) != GE_NONE) sleep(1); + while (GSM->GetRevision(rev) != GE_NONE) sleep(1); + while (GSM->GetModel(model) != GE_NONE) sleep(1); + + strcpy(manufacturer, "(unknown)"); + GSM->GetManufacturer(manufacturer); + + fprintf(stdout, _("IMEI: %s\n"), imei); + fprintf(stdout, _("Model: %s %s (%s)\n"), manufacturer, GetModelName (model), model); + fprintf(stdout, _("Revision: %s\n"), rev); + + GSM->Terminate(); + + return 0; +} + +int senddtmf(char *String) +{ + + fbusinit(NULL); + + if (GSM->SendDTMF(String)!=GE_NONE) fprintf(stdout,_("Error!\n")); + + GSM->Terminate(); + + return 0; +} + +/* Resets the phone */ +int reset(int argc, char *argv[]) +{ + + unsigned char _type=0x03; + + if (argc>0) { + _type=0x10; + + if (!strcmp(argv[0],"soft")) _type = 0x03; + + /* Doesn't work with 5110 */ + if (!strcmp(argv[0],"hard")) _type = 0x04; + + if (_type==0x10) { + fprintf(stderr, _("What kind of reset do you want (second parameter can be \"soft\" or \"hard\") ?\n")); + return -1; + } + } + + fbusinit(NULL); + + GSM->Reset(_type); + + GSM->Terminate(); + + return 0; +} + +/* This is a "convenience" function to allow quick test of new API stuff which + doesn't warrant a "proper" command line function. */ + +int foogle(char *argv[]) +{ + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + // Fill in what you would like to test here... + + sleep(5); + + GSM->Terminate(); + + return 0; +} + +int phonetests() +{ + /* Initialise the code for the GSM interface. */ + + fbusinit(NULL); + + if (GSM->PhoneTests()!=GE_NONE) fprintf(stderr,_("Error\n")); + + GSM->Terminate(); + + return 0; +} + +/* pmon allows fbus code to run in a passive state - it doesn't worry about + whether comms are established with the phone. A debugging/development + tool. */ + +int pmon() +{ + + GSM_Error error; + GSM_ConnectionType connection=GCT_FBUS; + + /* Initialise the code for the GSM interface. */ + + error = GSM_Initialise(model, Port, Initlength, connection, RLP_DisplayF96Frame, SynchronizeTime); + + if (error != GE_NONE) { + fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); + return -1; + } + + + while (1) { + usleep(50000); + } + + return 0; +} + +int setringtone(int argc, char *argv[]) +{ + GSM_Ringtone ringtone; + GSM_BinRingtone binringtone,binringtone2; + + GSM_Error error; + + int current=0; //number of packed notes or location + int i; + + char model[64]; + + /* If not binary ringtone */ + if (GSM_ReadBinRingtoneFile(argv[0],&binringtone2)!=GE_NONE) { + fprintf(stdout,_("Not binary ringtone, trying RTTL\n")); + + if (GSM_ReadRingtoneFileOnConsole(argv[0], &ringtone)!=GE_NONE) return(-1); + + ringtone.location=1; + if (argc>1) ringtone.location=atoi(argv[1]); + + ringtone.allnotesscale=false; + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + while (GSM->GetModel(model) != GE_NONE) + sleep(1); + + /* For Nokia 6110/6130/6150/6210 we use different method of uploading. + Phone will display menu, when received it */ + if ( !strcmp(model,"NSE-3") || !strcmp(model,"NSK-3") || + !strcmp(model,"NSM-1") || !strcmp(model,"NPE-3") ) { + if (argc==1) ringtone.location=255; + } + + error=GSM->SetRingtone(&ringtone,¤t); + + if (current!=ringtone.NrNotes) { + if (current>FB61_MAX_RINGTONE_NOTES) { + fprintf(stderr,_("Warning: due to phone limitation")); + } else { + fprintf(stderr,_("Warning: ringtone was too long to be saved into frame,")); + } + fprintf(stderr, _(" only %i first notes were packed (%i cut)\n"),current,ringtone.NrNotes-current); + } + + if (error==GE_NONE) + fprintf(stdout, _("Set succeeded!\n")); + else + fprintf(stdout, _("Setting failed\n")); + + } else { /* This IS binary ringtone */ + fprintf(stdout,_("Binary ringtone format\n")); + + if (argc==3) { + binringtone.frame[current++]=0x00; + binringtone.frame[current++]=0x00; + binringtone.frame[current++]=0x0c; + binringtone.frame[current++]=0x01; + binringtone.frame[current++]=0x2c; + + //copy new name + memcpy(binringtone.frame+current,argv[2],strlen(argv[2])); + current=current+strlen(argv[2]); + + /*don't use old*/ + i=2; + while(binringtone2.frame[i]!=0x00) { + if (i==binringtone.length) break; + i++; + } + + //copy binringtone + memcpy(binringtone.frame+current,binringtone2.frame+i,binringtone2.length-i); + binringtone.length=binringtone2.length-i+current; + } else + { + memcpy(binringtone.frame+current,binringtone2.frame,binringtone2.length); + binringtone.length=binringtone2.length; + } + + binringtone.location=1; + if (argc>1) binringtone.location=atoi(argv[1]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + error=GSM->SetBinRingtone(&binringtone); + + switch (error) { + case GE_NONE: + fprintf(stdout, _("Set succeeded!\n")); + break; + case GE_INVALIDRINGLOCATION: + fprintf(stdout, _("Invalid location %i!\n"),binringtone.location); + break; + case GE_UNKNOWNMODEL: + fprintf(stdout, _("Mygnokii doesn't know format for this model!\n")); + break; + case GE_NOTIMPLEMENTED: + fprintf(stdout, _("Not implemented for this model!\n")); + break; + default: + fprintf(stdout, _("Not supported by this model!\n")); + break; + } + } + + GSM->Terminate(); + + return 0; +} + +int ringtoneconvert(int argc, char *argv[]) +{ + GSM_Ringtone ringtone; + + if (!strcmp(argv[0],argv[1])) + { + fprintf(stderr, _("Files can't have the same names !\n")); + return -1; + } + + if (GSM_ReadRingtoneFileOnConsole(argv[0], &ringtone)!=GE_NONE) return(-1); + + ringtone.allnotesscale=false; + + GSM_SaveRingtoneFileOnConsole(argv[1], &ringtone); + + return 0; +} + +int playringtone(int argc, char *argv[]) +{ + GSM_Ringtone ringtone; + + GSM_BinRingtone binringtone; + + int i,j,z; + int Hz; + bool isok; + +//{ "c", "c#", "d", "d#", "e", "f", "f#", "g", "g#", "a", "a#", "h" }; + int binary_notes[12] = + { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11 , 12}; + + if (GSM_ReadBinRingtoneFile(argv[0],&binringtone)!=GE_NONE) { + fprintf(stdout,_("Not binary ringtone, trying RTTL\n")); + + if (GSM_ReadRingtoneFileOnConsole(argv[0], &ringtone)!=GE_NONE) return(-1); + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + fprintf(stdout,_("Playing \"%s\" (%i notes)\n"),ringtone.name,ringtone.NrNotes); + + GSM_PlayRingtoneOnConsole(&ringtone); + + } else { + + fprintf(stdout,_("Binary ringtone format\n")); + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + i=5; + while (true) { //skipping name + if (binringtone.frame[i]==0) break; + i++; + } + + i=i+5;j=0;z=0; + while (true) { + if (binringtone.frame[i]!=j) { + if (j!=0) { +//#ifdef DEBUG + fprintf(stdout,_("Block in binary ringtone %i %i\n"),j,z); +//#endif + isok=false; + if (j==64) { + j=255;//Pause + isok=true; + } + if (!isok && j>=114 && j<=125) { + j=14*3+binary_notes[j-114]; + isok=true; + } + if (!isok && j>=126 && j<=137) { + j=14*1+binary_notes[j-126]; + isok=true; + } + if (!isok && j>=138 && j<=149) { + j=14*2+binary_notes[j-138]; + isok=true; + } + if (!isok && j>=150 && j<=161) { + j=14*4+binary_notes[j-150]; + isok=true; + } + if (!isok) { +//#ifdef DEBUG + fprintf(stdout,_("Unknown block in binary ringtone %i %i\n"),j,z); +//#endif + } else { + Hz=GSM_GetFrequency(j); + if (GSM->PlayTone(Hz,5)!=GE_NONE) fprintf(stdout,_("error during playing\n")); + usleep(z*5000); + } + } + j=binringtone.frame[i]; + z=binringtone.frame[i+1]; + } else { + z=z+binringtone.frame[i+1]; + } + i=i+2; + if (i>=binringtone.length) break; + } + + GSM->PlayTone(0,0); + } + + GSM->Terminate(); + + return 0; +} + +int composer(int argc, char *argv[]) +{ + GSM_Ringtone ringtone; + int i; + bool unknown; + int oldnoteslen=4,nownoteslen,oldnoteslen2; + int oldnotesscale=1,nownotesscale; + bool firstnote=true; + int DefNoteTempo=63; + + if (GSM_ReadRingtoneFileOnConsole(argv[0], &ringtone)!=GE_NONE) return(-1); + + if (ringtone.NrNotes!=0) + DefNoteTempo=ringtone.notes[0].tempo; + + fprintf(stdout,_("Ringtone \"%s\" (tempo = %i Beats Per Minute)\n\n"),ringtone.name,GSM_GetTempo(DefNoteTempo)); + + for (i=0;i50) + fprintf(stdout,_("WARNING: LENGTH=%i, BUT YOU WILL ENTER ONLY FIRST 50 TONES. TO ENTER FULL RINGTONE MUST SEND IT (--sendringtone) OR DOWNLOAD (--setringtone)\n\n"),ringtone.NrNotes-i); + + fprintf(stdout,_("This ringtone in Nokia Composer in phone should look: ")); + + firstnote=true; + + for (i=0;ioldnoteslen) { + while (oldnoteslen!=nownoteslen) { + fprintf(stdout,_("8")); + oldnoteslen=oldnoteslen*2; + } + } + + if (nownoteslenFB61_MAX_RINGTONE_NOTES) { + fprintf(stderr,_("Warning: due to phone limitation")); + } else { + fprintf(stderr,_("Warning: ringtone was too long to be saved into SMS,")); + } + fprintf(stderr, _(" only %i first notes were packed (%i cut)\n"),current,ringtone.NrNotes-current); + } + + for (i=0;iFB61_MAX_RINGTONE_NOTES) { + fprintf(stderr,_("Warning: due to phone limitation")); + } else { + fprintf(stderr,_("Warning: ringtone was too long to be saved into SMS,")); + } + fprintf(stderr, _(" only %i first notes were packed (%i cut)\n"),current,ringtone.NrNotes-current); + } + + for (i=0;i2) + { + doit=false; + if (!strcmp(argv[2],"op")) + { + doit=false; + if (argc<4) doit=true; + if (argc<4 && bitmap.type!=GSM_OperatorLogo) doit=true; + if (doit) + { + fbusinit(NULL); + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode,NetworkInfo.NetworkCode,7); + GSM->Terminate(); + } + GSM_ResizeBitmap(&bitmap,GSM_OperatorLogo); + if (argc==4) + { + strncpy(bitmap.netcode,argv[3],7); + if (!strcmp(GSM_GetNetworkName(bitmap.netcode),"unknown")) + { + fprintf(stderr,"Sorry, gnokii doesn't know \"%s\" network !\n",bitmap.netcode); + return -1; + } + } + doit=true; + } + if (!strcmp(argv[2],"7110op")) + { + doit=false; + if (argc<4) doit=true; + if (argc<4 && bitmap.type!=GSM_7110OperatorLogo) doit=true; + if (doit) + { + fbusinit(NULL); + if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode,NetworkInfo.NetworkCode,7); + GSM->Terminate(); + } + GSM_ResizeBitmap(&bitmap,GSM_7110OperatorLogo); + if (argc==4) + { + strncpy(bitmap.netcode,argv[3],7); + if (!strcmp(GSM_GetNetworkName(bitmap.netcode),"unknown")) + { + fprintf(stderr,"Sorry, gnokii doesn't know \"%s\" network !\n",bitmap.netcode); + return -1; + } + } + doit=true; + } + if (!strcmp(argv[2],"caller")) + { + GSM_ResizeBitmap(&bitmap,GSM_CallerLogo); + if (argc>3) + { + num=argv[3][0]-'0'; + if ((num<0)||(num>9)) num=0; + bitmap.number=num; + } else + { + bitmap.number=0; + } + doit=true; + } + if (!strcmp(argv[2],"startup")) + { + GSM_ResizeBitmap(&bitmap,GSM_StartupLogo); + doit=true; + } + if (!strcmp(argv[2],"7110startup")) + { + GSM_ResizeBitmap(&bitmap,GSM_7110StartupLogo); + doit=true; + } + if (!strcmp(argv[2],"6210startup")) + { + GSM_ResizeBitmap(&bitmap,GSM_6210StartupLogo); + doit=true; + } + if (!strcmp(argv[2],"picture")) + { + GSM_ResizeBitmap(&bitmap,GSM_PictureImage); + doit=true; + } + if (!doit) + { + fprintf(stderr,"Unknown type of logo: %s !\n",argv[2]); + return -1; + } + } + + if (GSM_SaveBitmapFileOnConsole(argv[1], &bitmap)!=GE_NONE) return(-1); + + return 0; +} + +int getphoneprofile() +{ + GSM_PPS PPS; + GSM_Error error; + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + PPS.Name=PPS_ALS; + error=GSM->GetProductProfileSetting(&PPS); + if (error!=GE_NONE) { + fprintf(stdout,_("Error!\n")); + GSM->Terminate(); + return -1; + } + fprintf(stdout,_("ALS : ")); + if (PPS.bool_value) fprintf(stdout,_("on\n")); + else fprintf(stdout,_("off\n")); + + PPS.Name=PPS_VibraMenu; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("Vibra menu : ")); + if (PPS.bool_value) fprintf(stdout,_("on\n")); + else fprintf(stdout,_("off\n")); + + PPS.Name=PPS_GamesMenu; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("Games menu : ")); + if (PPS.bool_value) fprintf(stdout,_("on\n")); + else fprintf(stdout,_("off\n")); + + PPS.Name=PPS_HRData; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("HR Data : ")); + if (PPS.bool_value) fprintf(stdout,_("on\n")); + else fprintf(stdout,_("off\n")); + + PPS.Name=PPS_14400Data; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("14400 Data : ")); + if (PPS.bool_value) fprintf(stdout,_("on\n")); + else fprintf(stdout,_("off\n")); + + PPS.Name=PPS_LCDContrast; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("LCD Contrast : %i%%\n"),PPS.int_value); + + PPS.Name=PPS_EFR; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("EFR : ")); + switch (PPS.int_value) { + case 0: fprintf(stdout,_("off\n")); break; + case 1: fprintf(stdout,_("last\n")); break; + case 2: fprintf(stdout,_("second\n"));break; + case 3: fprintf(stdout,_("first\n")); break; + } + + PPS.Name=PPS_FR; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("FR : ")); + switch (PPS.int_value) { + case 0: fprintf(stdout,_("off\n")); break; + case 1: fprintf(stdout,_("last\n")); break; + case 2: fprintf(stdout,_("second\n"));break; + case 3: fprintf(stdout,_("first\n")); break; + } + + PPS.Name=PPS_HR; + GSM->GetProductProfileSetting(&PPS); + fprintf(stdout,_("HR : ")); + switch (PPS.int_value) { + case 0: fprintf(stdout,_("off\n")); break; + case 1: fprintf(stdout,_("last\n")); break; + case 2: fprintf(stdout,_("second\n"));break; + case 3: fprintf(stdout,_("first\n")); break; + } + + GSM->Terminate(); + + return 0; + +} + +int setphoneprofile(int argc, char *argv[]) +{ + GSM_PPS PPS; + GSM_Error error; + bool correct_arg1=false, correct_arg2=false; + + if (!strcmp(argv[0],"ALS")) { + PPS.Name=PPS_ALS; + correct_arg1=true; + if (!strcmp(argv[1],"1")) { + PPS.bool_value=true; + correct_arg2=true; + } + if (!strcmp(argv[1],"0")) { + PPS.bool_value=false; + correct_arg2=true; + } + if (!correct_arg2) { + fprintf(stdout,_("Settings for ALS parameter can be \"0\" or \"1\" !\n")); + return -1; + } + } + if (!strcmp(argv[0],"HRData")) { + PPS.Name=PPS_HRData; + correct_arg1=true; + if (!strcmp(argv[1],"1")) { + PPS.bool_value=true; + correct_arg2=true; + } + if (!strcmp(argv[1],"0")) { + PPS.bool_value=false; + correct_arg2=true; + } + if (!correct_arg2) { + fprintf(stdout,_("Settings for HRData parameter can be \"0\" or \"1\" !\n")); + return -1; + } + } + if (!correct_arg1) { + fprintf(stdout,_("First parameter can be \"ALS\" or \"HRData\" only !\n")); + return -1; + } + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + error=GSM->SetProductProfileSetting(&PPS); + + if (error!=GE_NONE) { + fprintf(stdout,_("Error!\n")); + GSM->Terminate(); + return -1; + } + + GSM->Reset(0x03); + + GSM->Terminate(); + + return 0; + +} + +int getoperatorname() +{ + + GSM_Network network; + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + if (GSM->GetOperatorName(&network)==GE_NONE) + { + if (!strcmp(network.Name,"")) { + fprintf(stdout,_("Phone doesn't have downloaded operator name\n")); + } else { + fprintf(stdout,_("Phone has downloaded operator name (\"%s\") for \"%s\" (\"%s\") network\n"), + network.Name,network.Code,GSM_GetNetworkName(network.Code)); + } + } + + GSM->Terminate(); + + return 0; + +} + +int setoperatorname(int argc, char *argv[]) +{ + + GSM_Network network; + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + if (argc==2) { + strncpy(network.Code,argv[0],7); + strncpy(network.Name,argv[1],50); + } else { + strcpy(network.Code,"000 00\0"); + strcpy(network.Name,"\0"); + } + + if (GSM->SetOperatorName(&network)==GE_NONE) { + if (GSM->GetOperatorName(&network)==GE_NONE) { + if (!strcmp(network.Name,"")) { + fprintf(stdout,_("Downloaded operator name is removed\n")); + } else { + fprintf(stdout,_("Downloaded operator name changed for \"%s\" network (\"%s\") to \"%s\"\n"), + network.Code,GSM_GetNetworkName(network.Code),network.Name); + } + } + } + + GSM->Terminate(); + + return 0; + +} + +int getvoicemailbox() +{ + GSM_PhonebookEntry entry; + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + if (GSM->GetVoiceMailbox(&entry)==GE_NONE) { + fprintf(stdout,_("Voice mailbox number is ")); + if (!strcmp(entry.Number,"")) + fprintf(stdout,_("not set\n")); + else + fprintf(stdout,_("\"%s\"\n"),entry.Number); + } + + GSM->Terminate(); + + return 0; + +} + +/////////////////////////////////////////////////////////////////////////////// +// flow diagram of netmonitordata(): +/////////////////////////////////////////////////////////////////////////////// +// +// get command line argument +// | +// v +// +// if specific phone model +// use that model +// else +// identify-phone: (((((((( TO DO ))))))))))))) +// +// | +// v +// get_mon_param_info() get phone netmonitor parameters name +// specifically to a 'model' +// | +// v +// parse_check() check command line arguments +// | if all OK, go on else stop. +// | because we can have a input file +// v containing multiple +// parse_process() command lines, we process each at once +// so we can exit early on errors. +// +/////////////////////////////////////////////////////////////////////////////// + +// private functions, see netmonitordata() +void free_nm_info(PARAM_INFO_MON *info) +{ + PARAM_INFO_MON *tmp; // pointer, iterator on info + + // go to end of list + + while (info->next != NULL) + { tmp = info->next; + free(info->name); + free(info->mname); + free(info); + info = tmp; + } + free(info); +} + +/////////////////////////////////////////////////////////////////////////////// +// this func retrieve parameters info from a file +// and load it in a dynamic array, NULL terminated, +// if 2rd parameter is not NULL, it load also description of screen +// return (PARAM_INFO_MON *start) if all is OK, else NULL +/////////////////////////////////////////////////////////////////////////////// +// start->->next->next->next-> ...->next->NULL +// | | | | | +// V V V V V +// par0 par1 par2 parN +/////////////////////////////////////////////////////////////////////////////// +// this should be de-allocated from calling function, +// also, screen_name should be deallocated from calling function +/////////////////////////////////////////////////////////////////////////////// + +PARAM_INFO_MON *get_mon_param_info(char *f_name, char *screen_name[NM_MAX_SCREEN+1]) +{ + PARAM_INFO_MON *start; // pointer to netmonitor parameters info + PARAM_INFO_MON *info; // pointer, iterator on info + PARAM_INFO_MON *check; // pointer, iterator on info, for check usage + + FILE *f_info; + + char buf[256]; + char *param; + char *param_name; + char *tmp; + + char tmp_mname[55]; // very larger, but if netmon bug ... + int x, y, len, s, t; // x & y coord, len, screen nr, type + int i; + + if (screen_name != NULL) + for (i = 0; i <= NM_MAX_SCREEN; i++) + screen_name[i] = NULL; + + + if ((f_info = fopen(f_name, "r")) == NULL) + { fprintf(stderr, "Can' t open file parameter info: <%s>\n", f_name); + return(NULL); + } + + if ((start = malloc(sizeof(PARAM_INFO_MON))) == NULL) + { fprintf(stderr, "no mem\n"); + return(NULL); + } + else + { start->next = NULL; + } + + info = start; + while (fgets(buf, 256, f_info) != NULL) + { + param = buf; + + // Truncate from '#' at right of comments + if ((tmp = strchr(param, '#')) != NULL) + *tmp = '\0'; + + // Strip leading, trailing whitespace + while(isspace((int) *param)) + param++; + + while((strlen(param) > 0) && isspace((int) param[strlen(param) - 1])) + param[strlen(param) - 1] = '\0'; + + // Ignore blank lines + if ((*param == '\n') || (*param == '\0')) + continue; + + +#ifdef DEBUG + fprintf(stderr, "%s: info line: <%s>\n", f_name, param); +#endif + // check for param name + if ((param_name = strtok(param, "=\t\n")) == NULL) + continue; + + // check if screen name + if (strncmp("SCREEN", param_name, 6) == 0) + { + // if we do not want screen names ... + if (screen_name == NULL) + continue; + +// FIXME check for screen nr + if ((tmp = strtok(NULL, ":\n")) == NULL) + continue; + + i = atoi(tmp); +// FIXME: check if already defined screen + + if ((i <= 0) || (i > NM_MAX_SCREEN)) + continue; + // check for screen name + if ((tmp = strtok(NULL, ":\n")) == NULL) + continue; + + screen_name[i] = strdup(tmp); + } + else + { + // parameter + +// FIXME: check for NM_MAX_FIELDS + + // check for x coord + if ((tmp = strtok(NULL, ":\t\n")) == NULL) + continue; + x = atoi(tmp); + + // check for y coord + if ((tmp = strtok(NULL, ":\t\n")) == NULL) + continue; + y = atoi(tmp); + + // check for len + if ((tmp = strtok(NULL, ":\t\n")) == NULL) + continue; + len = atoi(tmp); + + // check for screen + if ((tmp = strtok(NULL, ":\t\n")) == NULL) + continue; + s = atoi(tmp); + + // check for netmon manual name + if ((tmp = strtok(NULL, ":\t\n")) == NULL) + { fprintf(stderr, + "%s: PARAMETER <%s> in screen <%d>, not have netmon manual reference\n", + f_name, param_name, s); + free_nm_info(start); + return(NULL); + } + strcpy(tmp_mname, tmp); + + // check for data type (optional) + if ((tmp = strtok(NULL, ":\t\n")) != NULL) + t = *tmp; + else + t = '\0'; + + // check len, here, so we print parameter name + if (len == 0) + { fprintf(stderr, + "%s: PARAMETER <%s> in screen <%d>, has invalid data lenght\n", + f_name, param_name, s); + free_nm_info(start); + return(NULL); + } + + // check if already defined same param_name + check = start; + while (check->next != NULL) + { check = check->next; + if (strcmp(param_name, check->name) == 0) + { + fprintf(stderr, + "%s: PARAMETER <%s> in screen <%d> already defined as in screen <%d>\n", + f_name, param_name, s, check->s_nr); + free_nm_info(start); + return(NULL); + } + } + + // make space, and add parameter + if ((info->next = malloc(sizeof(PARAM_INFO_MON))) != NULL) + { + info = info->next; + info->name = strdup(param_name); + info->x = x; + info->y = y; + info->len = len; + info->s_nr = s; + info->mname = strdup(tmp_mname); + info->type = t; + + info->next = NULL; // mark end + } + else + { + fprintf(stderr, "no mem"); + free_nm_info(start); + return(NULL); + } + + } + + } + + fclose(f_info); + +#ifdef DEBUG + info = start; + while (info->next != NULL) + { + info = info->next; + fprintf(stderr, "info name %s\n", info->name); + } +#endif + return(start); +} + +// 2, parse the arguments and check command(s) line +// command line, phone spec input, and output are complex, +// so we exit printing info about error instead of std help +/////////////////////////////////////////////////////////////////////////////// + +int parse_check(int argc, char *argv[], PARAM_INFO_MON *start, char *f_name, int line) +{ + int ctr; + int i; + int time_spec; + int found_data; + char *p; + char *tmp; + char *o; + PARAM_INFO_MON *info; // iterator on this list + +#ifdef DEBUG + for (i = 0; i < argc; i++) + fprintf(stderr, "argv[%d] = <%s>\n",i, argv[i]); +#endif + + time_spec = 0; + ctr = 0; + i = 0; + while (i < argc) + { + p = argv[i]; + if (*p == '-') + { // should be one of the short option + if (strcmp(argv[i], "-fs") == 0) + { // field separator, next arg should be a string + if (((i+1) < argc) && (strlen(argv[i+1]) < 10)) + { i++; + // arg OK, do nothing + } + else + { if (line) + fprintf(stderr, + "-fs: Invalid field separator in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-fs: Invalid field separator\n"); + return(-1); + } + } + else if (strcmp(argv[i], "-ls") == 0) + { // line separator, next arg should be a string + if (((i+1) < argc) && (strlen(argv[i+1]) < 10)) + { i++; + // arg OK, do nothing + } + else + { if (line) + fprintf(stderr, + "-ls: Invalid line separator in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-ls: Invalid line separator\n"); + return(-1); + } + } + else if (strcmp(argv[i], "-tm") == 0) + { // time separator, next arg should be a millisecond (200-10000) + if (time_spec) + { if (line) + fprintf(stderr, + "-tm, -ts, are mutually exclusive in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-tm, -ts, are mutually exclusive\n"); + return(-1); + } + + if (((i+1) < argc) && (atoi(argv[i+1]) >= 200) && (atoi(argv[i+1]) <= 10000)) + { i++; + time_spec = 1; + // arg OK, do nothing + } + else + { if (line) + fprintf(stderr, + "-tm: Invalid argument (200-10000 milliseconds), in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-tm: Invalid argument (200-10000 milliseconds)\n"); + return(-1); + } + } + else if (strcmp(argv[i], "-ts") == 0) + { // time separator, next arg should be a seconds (1-3600) + if (time_spec) + { if (line) + fprintf(stderr, + "-tm, -ts, are mutually exclusive, in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-tm, -ts, are mutually exclusive\n"); + return(-1); + } + + if (((i+1) < argc) && (atoi(argv[i+1]) >= 1) && (atoi(argv[i+1]) <= 3600)) + { i++; + time_spec = 1; + // arg OK, do nothing + } + else + { if (line) + fprintf(stderr, + "-ts: Invalid argument (1-3600 seconds) in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-ts: Invalid argument (1-3600 seconds)\n"); + return(-1); + } + } + else if (strcmp(argv[i], "-n") == 0) + { // nr of data pump, before stop collection, + // next arg should be a int > 0 + if (((i+1) < argc) && (atoi(argv[i+1]) >= 1) && (atoi(argv[i+1]) <= 99999)) + { i++; + // arg OK, do nothing + } + else + { if (line) + fprintf(stderr, + "-n: Invalid argument (1-99999 times) in <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "-n: Invalid argument (1-99999 times)\n"); + return(-1); + } + } + else if (strcmp(argv[i], "-h") == 0) + { // we do NOT want header (default with header) + // arg OK, do nothing + } + else if (strcmp(argv[i], "-S") == 0) + { // we have used use specs from a file instead of standard info, + // next arg is an existing readable filename + // as already parsed correctly, we skip here. + i++; + } + else if (strcmp(argv[i], "-I") == 0) + { // we have used input from a file instead of command line + // next arg is an existing readable filename + // as already parsed correctly, we skip here. + i++; + } + else + { + if (line) + fprintf(stderr, "Unrecognized option %s in <%s> at line %d\n", + argv[i], f_name, line); + else + fprintf(stderr, "Unrecognized option %s\n", argv[i]); + return(-1); + } + } + else + { // should be required data + tmp = strdup(argv[i]); + p = strtok(tmp, ":\t\n"); + while (p != NULL) + { + // check if there is an output format specification + o = p; + while (*o) + { + o++; + if (*o == '-') + { *o = '\0'; + o++; + if (strlen(o) == 0) + { + // we have 'minus', so, probably forget format ... + + if (line) + fprintf(stderr, + "Required data <%s->, without format specifiers in <%s> at line %d\n", + p, f_name, line); + else + fprintf(stderr, + "Required data <%s->, without format specifiers\n", p); + return(-1); + } + } + } + + // we check for params + found_data = 0; + info = start; + while (info->next != NULL) + { + info = info->next; + if (strcmp(p, info->name) == 0) + { + if (ctr > NM_MAX_FIELDS) + { + if (line) + fprintf(stderr, + "too much data field ... in file <%s> at line %d\n", + f_name, line); + else + fprintf(stderr, "too much data field ...\n"); + return (-1); + } +/* + data[ctr] = info; + out_f[ctr] = *o; +*/ + found_data = 1; + ctr++; + break; + } + } + + if (found_data == 0) + { + if (line) + fprintf(stderr, + "Required data <%s>, not found in info-mon specifications in <%s> at line %d\n", + p, f_name, line); + else + fprintf(stderr, + "Required data <%s>, not found in info-mon specifications\n", p); + return(-1); + } + + p = strtok(NULL, ":\t\n"); + + } // end while strtok + + } // end else '-' (short options) + + i++; + + } // end while + + if (ctr == 0) + { + if (line) + fprintf(stderr, "no required data! in <%s> at line %d\n", f_name, line); + else + fprintf(stderr, "no required data!\n"); + return(-1); + } + + return 0; +} + +// 2, parse the arguments and process the command line +// no checks are needed here, because already do in parse_check +// it return a pointer to info needed for make output, or NULL if errors +/////////////////////////////////////////////////////////////////////////////// +OUT_INFO_MON *parse_process(int argc, char *argv[], PARAM_INFO_MON *start) +{ + int ctr; + int i; + int time_spec; + int found_data; + int req_tm; + int req_ts; + char *p; + char *tmp; + char *o; + PARAM_INFO_MON *info; // iterator on this list + OUT_INFO_MON *out_param; // iterator on this list + + if ((out_param = malloc(sizeof(OUT_INFO_MON))) == NULL) + { fprintf(stderr, "no mem\n"); + return(NULL); + } + +#ifdef DEBUG + fprintf(stderr, "parse_process: argc = %d\n", argc); + for (i = 0; i < argc; i++) + fprintf(stderr, "argv[%d] = <%s>\n",i, argv[i]); +#endif + + for (i = 0; i < NM_MAX_FIELDS; i++) + out_param->data[i] = NULL; + + strcpy(out_param->req_fs, " "); +#ifdef WIN32 + strcpy(out_param->req_ls, "\n\r"); +#else + strcpy(out_param->req_ls, "\n"); +#endif + time_spec = 0; + out_param->req_n = 0; + out_param->req_header = 1; + + time_spec = 0; + req_tm = 200; /* default wait */ + req_ts = 0; + + ctr = 0; + i = 0; + while (i < argc) + { + p = argv[i]; + if (*p == '-') + { // should be one of the short option + if (strcmp(argv[i], "-fs") == 0) + { // field separator, next arg should be a string + if (((i+1) < argc) && (strlen(argv[i+1]) < 10)) + { i++; + strcpy(out_param->req_fs, argv[i]); + } + else + { fprintf(stderr, "NEVER BE:-fs: Invalid field separator\n"); + return(NULL); + } + } + else if (strcmp(argv[i], "-ls") == 0) + { // line separator, next arg should be a string + if (((i+1) < argc) && (strlen(argv[i+1]) < 10)) + { i++; + strcpy(out_param->req_ls, argv[i]); + } + else + { fprintf(stderr, "NEVER BE:-ls: Invalid line separator\n"); + return(NULL); + } + } + else if (strcmp(argv[i], "-tm") == 0) + { // time separator, next arg should be a millisecond (200-10000) + if (time_spec) + { fprintf(stderr, "NEVER BE:-tm, -ts, are mutually exclusive"); + return(NULL); + } + + if (((i+1) < argc) && (atoi(argv[i+1]) >= 200) && (atoi(argv[i+1]) <= 10000)) + { i++; + req_tm = atoi(argv[i]); + time_spec = 1; + } + else + { fprintf(stderr, "NEVER BE:-tm: Invalid argument (200-10000 milliseconds)\n"); + return(NULL); + } + } + else if (strcmp(argv[i], "-ts") == 0) + { // time separator, next arg should be a seconds (1-3600) + if (time_spec) + { fprintf(stderr, "NEVER BE:-tm, -ts, are mutually exclusive"); + return(NULL); + } + + if (((i+1) < argc) && (atoi(argv[i+1]) >= 1) && (atoi(argv[i+1]) <= 3600)) + { i++; + req_ts = atoi(argv[i]); + time_spec = 1; + + // delete default + req_tm = 0; + } + else + { fprintf(stderr, "NEVER BE:-ts: Invalid argument (1-3600 seconds)\n"); + return(NULL); + } + } + else if (strcmp(argv[i], "-n") == 0) + { // nr of data pump, before stop collection, + // next arg should be a int > 0 + if (((i+1) < argc) && (atoi(argv[i+1]) >= 1) && (atoi(argv[i+1]) <= 99999)) + { i++; + out_param->req_n = atoi(argv[i]); + } + else + { fprintf(stderr, "NEVER BE:-n: Invalid argument (1-99999 times)\n"); + return(NULL); + } + } + else if (strcmp(argv[i], "-h") == 0) + { // we do NOT want header (default with header) + out_param->req_header = 0; + } + else if (strcmp(argv[i], "-S") == 0) + { // we have used use specs from a file instead of standard info, + // next arg is an existing readable filename + // as already parsed correctly, we skip here. + i++; + } + else if (strcmp(argv[i], "-I") == 0) + { // we have used input from a file instead of command line + // next arg is an existing readable filename + // as already parsed correctly, we skip here. + i++; + } + else + { + fprintf(stderr, "NEVER BE:Unrecognized option %s\n", argv[i]); + return(NULL); + } + } + else + { // should be required data + tmp = strdup(argv[i]); + p = strtok(tmp, ":\t\n"); + while (p != NULL) + { + // check if there is an output format specification + o = p; + while (*o) + { + o++; + if (*o == '-') + { *o = '\0'; + o++; + if (strlen(o) == 0) + { + // we have 'minus', so, probably forget format ... + + fprintf(stderr, + "NEVER BE:Required data <%s->, without format specifiers\n", p); + return(NULL); + } + } + } + + // we check for params + found_data = 0; + info = start; + while (info->next != NULL) + { + info = info->next; + if (strcmp(p, info->name) == 0) + { + if (ctr > NM_MAX_FIELDS) + { + fprintf(stderr, "NEVER BE:too much data field ..."); + return(NULL); + } + out_param->data[ctr] = info; + out_param->out_f[ctr] = *o; + found_data = 1; + ctr++; + break; + } + } + + if (found_data == 0) + { + fprintf(stderr, + "NEVER BE:Required data <%s>, not found in info-mon specifications\n", p); + return(NULL); + } + + + p = strtok(NULL, ":\t\n"); + + } // end while strtok + + // here, we have an array of pointers to required data + // and an array of output specifiers, from 0 to [ctr-1] + + } // end else '-' (short options) + + i++; + + } // end while + + if (ctr == 0) + { + fprintf(stderr, "NEVER BE:no required data!\n"); + return(NULL); + } + + // now, what netmon screen we need to retrieve ? + // we need somewhat were checking is faster, as our goal is lower cicle time + + // we can have NM_MAX_SCREEN=254 screens, so we use an array, of unsigned char, + // each char contain number of needed screen, 255 is list terminator + + for (i = 0; i <= NM_MAX_SCREEN; i++) + out_param->req_screen[i] = 255; + + ctr = 0; +#ifdef DEBUG +fprintf(stderr, "Start Required data %s screen %d\n", out_param->data[ctr]->name, out_param->data[ctr]->s_nr); +#endif + while (out_param->data[ctr] != NULL) + { +#ifdef DEBUG +fprintf(stderr, "Required data %s screen %d\n", out_param->data[ctr]->name, out_param->data[ctr]->s_nr); +#endif + // check if screen already in + found_data = 0; + i = 0; + while (out_param->req_screen[i] != 255) + { + if (out_param->req_screen[i] == out_param->data[ctr]->s_nr) + { // already load, skip + found_data = 1; + break; + } + i++; + } + + if (found_data == 0) + { +#ifdef DEBUG +fprintf(stderr, "i = %d, out_param->req_screen[%d] = %d\n", i, i, out_param->data[ctr]->s_nr); +#endif + out_param->req_screen[i] = out_param->data[ctr]->s_nr; + i++; + } + + ctr++; } - - return error; + +#ifdef DEBUG +i = 0; +while (out_param->req_screen[i] != 255) +{ + fprintf(stderr, "Required screen %d\n", out_param->req_screen[i]); + i++; } +#endif + + if (req_tm) + out_param->req_wait = req_tm * 1000; + else if (req_ts) + out_param->req_wait = req_ts * 1000000; + else + out_param->req_wait = req_tm * 1000; + + return(out_param); +} -int setlogo(int argc, char *argv[]) +int nmd_output(OUT_INFO_MON *out_param) { - GSM_Bitmap bitmap,oldbit; - GSM_NetworkInfo NetworkInfo; - GSM_Error error; - - bool ok = true; + int d; + int len; + int ctr; int i; - - if (!strcmp(argv[0],"text") || !strcmp(argv[0],"dealer")) { - if (!strcmp(argv[0], "text")) bitmap.type = GSM_WelcomeNoteText; - else bitmap.type = GSM_DealerNoteText; - bitmap.text[0] = 0x00; - if (argc > 1) strncpy(bitmap.text, argv[1], 255); - } else { - if (!strcmp(argv[0], "op") || !strcmp(argv[0], "startup") || !strcmp(argv[0], "caller")) { - if (argc > 1) { - if (ReadBitmapFileOnConsole(argv[1], &bitmap) != GE_NONE) { - if (GSM && GSM->Terminate) GSM->Terminate(); - return(-1); - } + int nr_line; + char *p; + int nr_chr; + int n; + char Screen[NM_MAX_SCREEN_WIDTH]; + time_t sec; + struct tm *date_time; + + if (out_param->req_header) + { +// print phone help header + d = 0; + while (out_param->data[d] != NULL) + { len = out_param->data[d]->len; + if (strlen(out_param->data[d]->name) > len) + len = strlen(out_param->data[d]->name); + if (strlen(out_param->data[d]->mname) > len) + len = strlen(out_param->data[d]->mname); + printf("%*.*s%s", len, len, out_param->data[d]->name, out_param->req_fs); + d++; + } + printf("%s", out_param->req_ls); + +// print netmon manual header + d = 0; + while (out_param->data[d] != NULL) + { len = out_param->data[d]->len; + if (strlen(out_param->data[d]->name) > len) + len = strlen(out_param->data[d]->name); + if (strlen(out_param->data[d]->mname) > len) + len = strlen(out_param->data[d]->mname); + printf("%*.*s%s", len, len, out_param->data[d]->mname, out_param->req_fs); + d++; + } + printf("%s", out_param->req_ls); + printf("%s", out_param->req_ls); + } - if (!strcmp(argv[0], "op")) { - if (bitmap.type != GSM_OperatorLogo || argc < 3) { - if (GSM && GSM->GetNetworkInfo && GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) strncpy(bitmap.netcode, NetworkInfo.NetworkCode, 7); - } - GSM_ResizeBitmap(&bitmap, GSM_OperatorLogo, GSM_Info); - if (argc == 3) { - strncpy(bitmap.netcode, argv[2], 7); - if (!strcmp(GSM_GetNetworkName(bitmap.netcode), "unknown")) { - fprintf(stderr, "Sorry, gnokii doesn't know %s network !\n", bitmap.netcode); - return -1; + ctr = 0; + while (!bshutdown) + { +// stop after n data punp + + ctr++; + if ((out_param->req_n) && (ctr > out_param->req_n)) + break; + +// datapump: for each screen, for each required data, load data info->value + + i = 0; + while(out_param->req_screen[i] != 255) + { + if (out_param->req_screen[i] == 0) + { + sec = time(0); + date_time = localtime(&sec); + sprintf(Screen, "%02d-%02d-%04d\n%02d:%02d:%02d\n", + date_time->tm_mday, + date_time->tm_mon+1, + date_time->tm_year+1900, + date_time->tm_hour, + date_time->tm_min, + date_time->tm_sec); +#ifdef DEBUG + fprintf(stderr, "%02d-%02d-%04d\n%02d:%02d:%02d\n", + date_time->tm_mday, + date_time->tm_mon+1, + date_time->tm_year+1900, + date_time->tm_hour, + date_time->tm_min, + date_time->tm_sec); +#endif + } + else + { + GSM->NetMonitor(out_param->req_screen[i], Screen); + } + +// we have one screen of data, load those required + + d = 0; + while (out_param->data[d] != NULL) + { + if (out_param->data[d]->s_nr == out_param->req_screen[i]) + { + p = Screen; +// goto req y + nr_line = out_param->data[d]->y; + while ((*p) && (nr_line)) + { + if (*p == '\n') + { nr_line--; } + p++; } - } - if (!strcmp(argv[0], "startup")) { - GSM_ResizeBitmap(&bitmap, GSM_StartupLogo, GSM_Info); - } - if (!strcmp(argv[0],"caller")) { - GSM_ResizeBitmap(&bitmap, GSM_CallerLogo, GSM_Info); - if (argc > 2) { - bitmap.number = argv[2][0] - '0'; - if ((bitmap.number < 0) || (bitmap.number > 9)) bitmap.number = 0; - } else { - bitmap.number = 0; - } - oldbit.type = GSM_CallerLogo; - oldbit.number = bitmap.number; - if (GSM && GSM->GetBitmap && GSM->GetBitmap(&oldbit) == GE_NONE) { - /* We have to get the old name and ringtone!! */ - bitmap.ringtone = oldbit.ringtone; - strncpy(bitmap.text, oldbit.text, 255); +#ifdef DEBUG +fprintf(stderr, "\nthis line: %s\n\n", p); +#endif + +// goto req x + nr_chr = out_param->data[d]->x; + while ((*p) && (nr_chr)) + { p++; + nr_chr--; } - if (argc > 3) strncpy(bitmap.text, argv[3], 255); - } - fprintf(stdout, _("Setting Logo.\n")); - } else { - /* FIX ME: is it possible to permanently remove op logo ? */ - if (!strcmp(argv[0], "op")) - { - bitmap.type = GSM_OperatorLogo; - strncpy(bitmap.netcode, "000 00", 7); - bitmap.width = 72; - bitmap.height = 14; - bitmap.size = bitmap.width * bitmap.height / 8; - GSM_ClearBitmap(&bitmap); - } - /* FIX ME: how to remove startup and group logos ? */ - fprintf(stdout, _("Removing Logo.\n")); - } - } else { - fprintf(stderr, _("What kind of logo do you want to set ?\n")); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - } - } - - if (GSM && GSM->SetBitmap) error = GSM->SetBitmap(&bitmap); - - switch (error) { - case GE_NONE: - oldbit.type = bitmap.type; - oldbit.number = bitmap.number; - if (GSM && GSM->GetBitmap && GSM->GetBitmap(&oldbit) == GE_NONE) { - if (bitmap.type == GSM_WelcomeNoteText || - bitmap.type == GSM_DealerNoteText) { - if (strcmp(bitmap.text, oldbit.text)) { - fprintf(stderr, _("Error setting")); - if (bitmap.type == GSM_DealerNoteText) fprintf(stderr, _(" dealer")); - fprintf(stderr, _(" welcome note - ")); - - /* I know, it looks horrible, but... */ - /* I set it to the short string - if it won't be set */ - /* it means, PIN is required. If it will be correct, previous */ - /* (user) text was too long */ - - /* Without it, I could have such thing: */ - /* user set text to very short string (for example, "Marcin") */ - /* then enable phone without PIN and try to set it to the very long (too long for phone) */ - /* string (which start with "Marcin"). If we compare them as only length different, we could think, */ - /* that phone accepts strings 6 chars length only (length of "Marcin") */ - /* When we make it correct, we don't have this mistake */ - - strcpy(oldbit.text, "!\0"); - if (GSM && GSM->SetBitmap) GSM->SetBitmap(&oldbit); - if (GSM && GSM->GetBitmap) GSM->GetBitmap(&oldbit); - if (oldbit.text[0]!='!') { - fprintf(stderr, _("SIM card and PIN is required\n")); - } else { - if (GSM && GSM->SetBitmap) GSM->SetBitmap(&bitmap); - if (GSM && GSM->GetBitmap) GSM->GetBitmap(&oldbit); - fprintf(stderr, _("too long, truncated to \"%s\" (length %i)\n"),oldbit.text,strlen(oldbit.text)); +// this the start of data + n = 0; + len = out_param->data[d]->len; + while ((*p) && (len)) + { out_param->data[d]->value[n] = *p; + p++; + n++; + len--; } - ok = false; - } - } else { - if (bitmap.type == GSM_StartupLogo) { - for (i = 0; i < oldbit.size; i++) { - if (oldbit.bitmap[i] != bitmap.bitmap[i]) { - fprintf(stderr, _("Error setting startup logo - SIM card and PIN is required\n")); - ok = false; - break; - } +// pad with space if shorter than presumed + while ((*p) && (len)) + { out_param->data[d]->value[n] = ' '; + n++; + len--; } + + out_param->data[d]->value[n] = '\0'; } + + d++; // next screen } + + i++; // next screen } - if (ok) fprintf(stdout, _("Done.\n")); - break; - case GE_NOTIMPLEMENTED: - fprintf(stderr, _("Function not implemented.\n")); - break; - case GE_NOTSUPPORTED: - fprintf(stderr, _("This kind of logo is not supported.\n")); - break; - default: - fprintf(stderr, _("Error !\n")); - break; - } - - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; -} +// print row of data + d = 0; + while (out_param->data[d] != NULL) + { + len = out_param->data[d]->len; + if (out_param->req_header) + { if (strlen(out_param->data[d]->name) > len) + len = strlen(out_param->data[d]->name); + if (strlen(out_param->data[d]->mname) > len) + len = strlen(out_param->data[d]->mname); + } +// FIXME check format + printf("%*.*s%s", len, len, out_param->data[d]->value, out_param->req_fs); + d++; + } + printf("%s", out_param->req_ls); + usleep(out_param->req_wait); + + } -int viewlogo(char *filename) -{ - GSM_Error error; + printf("%s%s", out_param->req_ls, out_param->req_ls); - error = GSM_ShowBitmapFile(filename); - return 0; + return(0); } -/* Calendar notes receiving. */ -int getcalendarnote(int argc, char *argv[]) +// main func +/////////////////////////////////////////////////////////////////////////////// +int netmonitordata(int argc, char *argv[]) { - GSM_CalendarNote CalendarNote; - GSM_Data data; - GSM_Error error = GE_NONE; - int i, first_location, last_location; - bool vCal = false; + char *loc_info = NULL; // path to --netmonitordata directory + char *f_name; // absolute path of phone info-file + int flag_phone_spec = 0; // flags, set if used -S option + + char model[20] = "phonepar"; // TO DO: PHONE AUTODETECTION +// char phver[20] = ""; + + PARAM_INFO_MON *start; // pointer to list of parsed phone params + OUT_INFO_MON *out_param; // pointer to struct of output data + + char *f_commands = NULL; // file containings input line arguments + FILE *commands; // Handle for this file + char buf[1024]; // buffer + char *f_argv[NM_MAX_FIELDS+30]; // space for parameters and cmdline options + int f_argc; + char *p, *tmp; // various counter, flags, tmp area ... + int i; + int line; - struct option options[] = { - { "vCard", optional_argument, NULL, '1'}, - { NULL, 0, NULL, 0} - }; + + fbusinit(NULL); + + signal(SIGINT, interrupted); - optarg = NULL; - optind = 0; +// FIXME model, phone_version + + // before parsing phone-info-file, we check for user specified phone-info-file + + i = 0; + while (i < argc) + { + if (strcmp(argv[i], "-S") == 0) + { + if ((i+1) < argc) + { + flag_phone_spec = 1; + loc_info = strdup(argv[i+1]); + break; + } + else + { fprintf(stderr, "option -S require an argument ...\n"); + return -1; + } + } - first_location = last_location = atoi(argv[0]); - if ((argc > 1) && (argv[1][0] != '-')) { - last_location = atoi(argv[1]); + i++; } - while ((i = getopt_long(argc, argv, "v", options, NULL)) != -1) { - switch (i) { - case 'v': - vCal=true; - break; - default: - usage(); /* Would be better to have an calendar_usage() here. */ - return -1; - } + if (loc_info != NULL) + { f_name = strdup(loc_info); } - - - for (i = first_location; i <= last_location; i++) { - CalendarNote.Location = i; - if (GSM && GSM->GetCalendarNote && GSM->Terminate) { - error = GSM->GetCalendarNote(&CalendarNote); - GSM->Terminate(); - } else { - GSM_DataClear(&data); - data.CalendarNote = &CalendarNote; - - error = SM_Functions(GOP_GetCalendarNote, &data, &State); + else // we use standard file specification + { + if ((tmp = getenv("INFOMONPATH")) == NULL) + { loc_info = strdup("."); + } + else + { loc_info = strdup(tmp); } - switch (error) { - case GE_NONE: - if (vCal) { - fprintf(stdout, "BEGIN:VCALENDAR\n"); - fprintf(stdout, "VERSION:1.0\n"); - fprintf(stdout, "BEGIN:VEVENT\n"); - fprintf(stdout, "CATEGORIES:"); - switch (CalendarNote.Type) { - case GCN_REMINDER: - fprintf(stdout, "MISCELLANEOUS\n"); - break; - case GCN_CALL: - fprintf(stdout, "PHONE CALL\n"); - break; - case GCN_MEETING: - fprintf(stdout, "MEETING\n"); - break; - case GCN_BIRTHDAY: - fprintf(stdout, "SPECIAL OCCASION\n"); - break; - default: - fprintf(stdout, "UNKNOWN\n"); - break; - } - fprintf(stdout, "SUMMARY:%s\n",CalendarNote.Text); - fprintf(stdout, "DTSTART:%04d%02d%02dT%02d%02d%02d\n", CalendarNote.Time.Year, - CalendarNote.Time.Month, CalendarNote.Time.Day, CalendarNote.Time.Hour, - CalendarNote.Time.Minute, CalendarNote.Time.Second); - if (CalendarNote.Alarm.Year!=0) { - fprintf(stdout, "DALARM:%04d%02d%02dT%02d%02d%02d\n", CalendarNote.Alarm.Year, - CalendarNote.Alarm.Month, CalendarNote.Alarm.Day, CalendarNote.Alarm.Hour, - CalendarNote.Alarm.Minute, CalendarNote.Alarm.Second); - } - fprintf(stdout, "END:VEVENT\n"); - fprintf(stdout, "END:VCALENDAR\n"); - - } else { /* not vCal */ - fprintf(stdout, _(" Type of the note: ")); - - switch (CalendarNote.Type) { - case GCN_REMINDER: - fprintf(stdout, _("Reminder\n")); - break; - case GCN_CALL: - fprintf(stdout, _("Call\n")); - break; - case GCN_MEETING: - fprintf(stdout, _("Meeting\n")); - break; - case GCN_BIRTHDAY: - fprintf(stdout, _("Birthday\n")); - break; - default: - fprintf(stdout, _("Unknown\n")); - break; - } - - fprintf(stdout, _(" Date: %d-%02d-%02d\n"), CalendarNote.Time.Year, - CalendarNote.Time.Month, - CalendarNote.Time.Day); - fprintf(stdout, _(" Time: %02d:%02d:%02d\n"), CalendarNote.Time.Hour, - CalendarNote.Time.Minute, - CalendarNote.Time.Second); + f_name = malloc(strlen(loc_info)+strlen(model)+10); + sprintf(f_name, "%s/%s", loc_info, model); + } - if (CalendarNote.Alarm.AlarmEnabled == 1) { - fprintf(stdout, _(" Alarm date: %d-%02d-%02d\n"), CalendarNote.Alarm.Year, - CalendarNote.Alarm.Month, - CalendarNote.Alarm.Day); - fprintf(stdout, _(" Alarm time: %02d:%02d:%02d\n"), CalendarNote.Alarm.Hour, - CalendarNote.Alarm.Minute, - CalendarNote.Alarm.Second); +#ifdef DEBUG +// fprintf(stderr, "Loc_info <%s> model <%s> version <%s>\n", loc_info, model, phver); + fprintf(stderr, "Info file: <%s>\n", f_name); +#endif + if ((start = get_mon_param_info(f_name, NULL)) == NULL) + return(-1); + + // option -I give us the possibility of specify a filename, + // containing a "sequence" of command line args. + // if you specify this option, you can use (on command line) only -S option. + // other options may be specified inside the input-file. + // contents of this file as the same sintax as the command line, + // except it must not contain "--netmonitordata" or "-I" or "-S" options + /////////////////////////////////////////////////////////////////////// + + i = 0; + while (i < argc) + { + if (strcmp(argv[i], "-I") == 0) + { + if ((i+1) < argc) + { + if ((argc == 2) || ((argc == 4) && flag_phone_spec == 1)) + { f_commands = strdup(argv[i+1]); + } + else + { fprintf(stderr, "option -I accept only additional -S option.\n"); + return -1; } - fprintf(stdout, _(" Text: %s\n"), CalendarNote.Text); - - if (CalendarNote.Type == GCN_CALL) - fprintf(stdout, _(" Phone: %s\n"), CalendarNote.Phone); + break; + } + else + { fprintf(stderr, "option -I require an argument ...\n"); + return -1; } - break; - case GE_NOTIMPLEMENTED: - fprintf(stderr, _("Function not implemented.\n")); - break; - default: - fprintf(stderr, _("The calendar note can not be read\n")); - break; } + + i++; } - if (GSM && GSM->Terminate) GSM->Terminate(); - return error; -} - -/* Writing calendar notes. */ -int writecalendarnote(char *argv[]) -{ - GSM_CalendarNote CalendarNote; + // before all, we check all command line + + if (f_commands != NULL) + { +#ifdef DEBUG + fprintf(stderr, "netmonitordata(check): commands from <%s>\n", f_commands); +#endif + // for each line + // do + // read line, make array f_argv, and counter f_argc + // parse & check args, so errors are checked before real processing + // (-I option here is ignored) + // (-S option can be here, and it is used) + // done + + if ((commands = fopen(f_commands, "r")) == NULL) + { fprintf(stderr, "Can' t open file commands input :<%s>n", f_commands); + return(-1); + } + +// FIXME line may be be splitted + line = 0; + while (fgets(buf, 1024, commands) != NULL) + { + p = buf; + line++; + + // Truncate from '#' at right of comments + if ((tmp = strchr(p, '#')) != NULL) + *tmp = '\0'; + + // Strip leading, trailing whitespace + while(isspace((int) *p)) + p++; + + while((strlen(p) > 0) && isspace((int) p[strlen(p) - 1])) + p[strlen(p) - 1] = '\0'; + + // Ignore blank lines + if ((*p == '\n') || (*p == '\0')) + continue; + +#ifdef DEBUG +fprintf(stderr, "netmonitordata(check): row <%s>\n", p); +#endif + // make args + f_argc = 0; - if (GSM_ReadVCalendarFile(argv[0], &CalendarNote, atoi(argv[1]))) { - fprintf(stdout, _("Failed to load vCalendar file.\n")); - return(-1); + p = strtok(p, " \t"); + do + { f_argv[f_argc++] = strdup(p); +#ifdef DEBUG +fprintf(stderr, "netmonitordata(check): token <%s>\n", p); +#endif + p = strtok(NULL, " \t"); // OK p, (NULL) + } + while ((p != NULL) && (*p)); + + // here we have f_argc, f_argv, this line is OK + + if (parse_check(f_argc, f_argv, start, f_commands, line) != 0) + { free_nm_info(start); + return(-1); + } + } + + fclose(commands); + } + else // as above, but we have only command line, argv, argc. + { + if (parse_check(argc, argv, start, NULL, 0) != 0) + { free_nm_info(start); + return(-1); + } } + + // here, all commands line are checked, and are correct - /* Error 22=Calendar full ;-) */ - if (GSM && GSM->WriteCalendarNote && GSM->WriteCalendarNote(&CalendarNote) == GE_NONE) - fprintf(stdout, _("Succesfully written!\n")); - else - fprintf(stdout, _("Failed to write calendar note!\n")); + if (f_commands != NULL) + { +#ifdef DEBUG + fprintf(stderr, "netmonitordata(process): commands from <%s>\n", f_commands); +#endif - if (GSM && GSM->Terminate) GSM->Terminate(); + // for each line + // do + // read line, make array f_argv, and counter f_argc + // parse_process argument, (-I option here is ignored) + // (-S option can be here, and it is used) + // (make header // these are in nmd_output(); + // loop + // get net-mon-info + // make output + // done) + // done + + if ((commands = fopen(f_commands, "r")) == NULL) + { fprintf(stderr, "Can' t open file commands input :<%s>n", f_commands); + return(-1); + } + +// FIXME line may be be splitted + while (fgets(buf, 1024, commands) != NULL) + { + p = buf; - return 0; -} + // Truncate from '#' at right of comments + if ((tmp = strchr(p, '#')) != NULL) + *tmp = '\0'; -/* Calendar note deleting. */ -int deletecalendarnote(int argc, char *argv[]) -{ - GSM_CalendarNote CalendarNote; - int i, first_location, last_location; + // Strip leading, trailing whitespace + while(isspace((int) *p)) + p++; + + while((strlen(p) > 0) && isspace((int) p[strlen(p) - 1])) + p[strlen(p) - 1] = '\0'; + + // Ignore blank lines + if ((*p == '\n') || (*p == '\0')) + continue; + + // make args - first_location = last_location = atoi(argv[0]); - if (argc > 1) last_location = atoi(argv[1]); + f_argc = 0; + p = strtok(p, " \t"); + do + { f_argv[f_argc++] = strdup(p); + p = strtok(NULL, " \t"); // OK p, (NULL) + } + while ((p != NULL) && (*p)); - for (i = first_location; i <= last_location; i++) { + // here we have f_argc, f_argv, this line is OK + + if ((out_param = parse_process(f_argc, f_argv, start)) == NULL) + { free_nm_info(start); + return(-1); /* NEVER BE */ + } + + // here, command line has no error ... - CalendarNote.Location = i; + nmd_output(out_param); - if (GSM && GSM->DeleteCalendarNote && GSM->DeleteCalendarNote(&CalendarNote) == GE_NONE) { - fprintf(stdout, _(" Calendar note deleted.\n")); - } else { - fprintf(stderr, _("The calendar note can not be deleted\n")); + free(out_param); + } + + fclose(commands); + } + else // as above, but we have only command line, argv, argc. + { + if ((out_param = parse_process(argc, argv, start)) == NULL) + { free_nm_info(start); + return(-1); /* NEVER BE */ } + nmd_output(out_param); + free(out_param); } + GSM->Terminate(); - if (GSM && GSM->Terminate) GSM->Terminate(); + free(loc_info); + free(f_name); - return 0; +/* I analised this source and this should be done. But when compile with VC6 */ +/* I have error. So, commented... MW */ +#ifndef VC6 + free_nm_info(start); +#endif + + return(0); } -/* Setting the date and time. */ -int setdatetime(int argc, char *argv[]) + +// used by nm_collect() +/////////////////////////////////////////////////////////////////////////////// +char *rowScreen(char *s) { - struct tm *now; - time_t nowh; - GSM_DateTime Date; + char *p; + + // make Screen in one row + p = s; + while(*p) + { + if (*p == '\n') + *p = ' '; + p++; + } - nowh = time(NULL); - now = localtime(&nowh); + return(s); +} - Date.Year = now->tm_year; - Date.Month = now->tm_mon+1; - Date.Day = now->tm_mday; - Date.Hour = now->tm_hour; - Date.Minute = now->tm_min; - Date.Second = now->tm_sec; +void printtime(void) +{ - if (argc > 0) Date.Year = atoi (argv[0]); - if (argc > 1) Date.Month = atoi (argv[1]); - if (argc > 2) Date.Day = atoi (argv[2]); - if (argc > 3) Date.Hour = atoi (argv[3]); - if (argc > 4) Date.Minute = atoi (argv[4]); + struct mydate { + int Year; /* The complete year specification - e.g. 1999. Y2K :-) */ + int Month; /* January = 1 */ + int Day; + int Hour; + int Minute; + int Second; + int Timezone; /* The difference between local time and GMT */ + } Date; + + struct tm *now; + time_t nowh; + nowh=time(NULL); + now=localtime(&nowh); + + Date.Year = now->tm_year; + Date.Month = now->tm_mon+1; + Date.Day = now->tm_mday; + Date.Hour = now->tm_hour; + Date.Minute = now->tm_min; + Date.Second = now->tm_sec; + + /* I have 100 (for 2000) Year now :-) */ + if (Date.Year>99 && Date.Year<1900) { + Date.Year=Date.Year+1900; + } + + printf("%d:%d:%d:%d:%d:%d ",Date.Day,Date.Month,Date.Year,Date.Hour,Date.Minute,Date.Second); - if (Date.Year < 1900) { +} - /* Well, this thing is copyrighted in U.S. This technique is known as - Windowing and you can read something about it in LinuxWeekly News: - http://lwn.net/1999/features/Windowing.phtml. This thing is beeing - written in Czech republic and Poland where algorithms are not allowed - to be patented. */ +// like netmonitor(), but print in one row, 1, 2 or 3 screen, every ~0.3 s +/////////////////////////////////////////////////////////////////////////////// +int nm_collect(int argc, char *argv[]) +{ + int mode[MAX_NM_COLLECT]; + char Screen[NM_MAX_SCREEN_WIDTH]; + int i; - if (Date.Year > 90) - Date.Year = Date.Year + 1900; - else - Date.Year = Date.Year + 2000; + for (i=0;i i ? (mode[i] = atoi(argv[i])): (mode[i] = 0); } - /* FIXME: Error checking should be here. */ - if (GSM && GSM->SetDateTime) GSM->SetDateTime(&Date); + for (i=0;iTerminate) GSM->Terminate(); + signal(SIGINT, interrupted); - return 0; -} + fbusinit(NULL); -/* In this mode we receive the date and time from mobile phone. */ -int getdatetime(void) -{ - GSM_Data data; - GSM_DateTime date_time; - GSM_Error error; - - if (GSM && GSM->GetDateTime && GSM->Terminate) { - error = GSM->GetDateTime(&date_time); - GSM->Terminate(); - } else { - GSM_DataClear(&data); - data.DateTime = &date_time; + // end on CTRL-C + while (!bshutdown) + { + for (i=0;iNetMonitor(mode[i], Screen); + printf("%s::", rowScreen(Screen)); + } + } + + printf("\n\n"); + + usleep(150000); } - - return error; + + GSM->Terminate(); + + return 0; } -/* Setting the alarm. */ -int setalarm(char *argv[]) +#ifdef DEBUG +int sniff(int argc, char *argv[]) { - GSM_DateTime Date; + /* base model comes from gnokiirc */ + strcat(model,"sniff"); + + if (argc>0) strcpy(Port,argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); - Date.Hour = atoi(argv[0]); - Date.Minute = atoi(argv[1]); + /* Loop here indefinitely - allows you to see messages from GSM code in + response to unknown messages etc. The loops ends after pressing the + Ctrl+C. */ + while (!bshutdown) { + sleep(1); + } - if (GSM && GSM->SetAlarm) GSM->SetAlarm(1, &Date); + GSM->Terminate(); - if (GSM && GSM->Terminate) GSM->Terminate(); + return 0; - return 0; } -/* Getting the alarm. */ -int getalarm(void) +int decodefile(int argc, char *argv[]) { - GSM_Error error; - GSM_Data data; - GSM_DateTime date_time; - - if (GSM && GSM->GetAlarm && GSM->Terminate) { - error = GSM->GetAlarm(0, &date_time); - GSM->Terminate(); - } else { - GSM_DataClear(&data); - data.DateTime = &date_time; - - error = SM_Functions(GOP_GetAlarm, &data, &State); - } - - switch (error) { - case GE_NONE: - fprintf(stdout, _("Alarm: %s\n"), (date_time.AlarmEnabled==0)?"off":"on"); - fprintf(stdout, _("Time: %02d:%02d\n"), date_time.Hour, date_time.Minute); - break; - case GE_NOTIMPLEMENTED: - fprintf(stdout, _("Function not implemented in %s !\n"), model); - break; - default: - fprintf(stdout, _("Internal error\n")); - break; - } - - return error; + FILE *infile; + unsigned char in_buffer[255]; + int nr_read = 0; + int i = 0; + + /* base model comes from gnokiirc */ + strcat(model,"decode"); + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + printf ("open InPutFile: %s\n", argv[0]); + if ( (infile = fopen( argv[0], "rb")) == NULL ) { + printf ("Failed to open InPutFile: %s\n", argv[0]); + exit (1); } + + while ( (nr_read = fread(in_buffer, 1, 16, infile)) > 0 ) { + for (i=0; i < nr_read; i++) + Protocol->StateMachine(in_buffer[i]); + } + + return 0; } -/* In monitor mode we don't do much, we just initialise the fbus code. - Note that the fbus code no longer has an internal monitor mode switch, - instead compile with DEBUG enabled to get all the gumpf. */ -int monitormode(void) -{ - float rflevel = -1, batterylevel = -1; -// GSM_PowerSource powersource = -1; - GSM_RFUnits rf_units = GRF_Arbitrary; - GSM_BatteryUnits batt_units = GBU_Arbitrary; - GSM_Statemachine *sm = &State; - GSM_Data data; - -// GSM_NetworkInfo NetworkInfo; -// GSM_CBMessage CBMessage; - - GSM_MemoryStatus SIMMemoryStatus = {GMT_SM, 0, 0}; - GSM_MemoryStatus PhoneMemoryStatus = {GMT_ME, 0, 0}; - GSM_MemoryStatus DC_MemoryStatus = {GMT_DC, 0, 0}; - GSM_MemoryStatus EN_MemoryStatus = {GMT_EN, 0, 0}; - GSM_MemoryStatus FD_MemoryStatus = {GMT_FD, 0, 0}; - GSM_MemoryStatus LD_MemoryStatus = {GMT_LD, 0, 0}; - GSM_MemoryStatus MC_MemoryStatus = {GMT_MC, 0, 0}; - GSM_MemoryStatus ON_MemoryStatus = {GMT_ON, 0, 0}; - GSM_MemoryStatus RC_MemoryStatus = {GMT_RC, 0, 0}; - -// GSM_SMSStatus SMSStatus = {0, 0}; - -// char Number[20]; - - GSM_DataClear(&data); +#endif - /* We do not want to monitor serial line forever - press Ctrl+C to stop the - monitoring mode. */ - signal(SIGINT, interrupted); +int getringtone(int argc, char *argv[]) +{ + GSM_BinRingtone ringtone; + GSM_Error error; + GSM_Ringtone SMringtone; - fprintf (stderr, _("Entering monitor mode...\n")); + int i; + + char model[64]; + + FILE *file; - //sleep(1); - //GSM->EnableCellBroadcast(); + ringtone.location=1; + if (argc>1) ringtone.location=atoi(argv[1]); - /* Loop here indefinitely - allows you to see messages from GSM code in - response to unknown messages etc. The loops ends after pressing the - Ctrl+C. */ - data.RFUnits = &rf_units; - data.RFLevel = &rflevel; - data.BatteryUnits = &batt_units; - data.BatteryLevel = &batterylevel; + /* Initialise the GSM interface. */ + fbusinit(NULL); - while (!bshutdown) { - if (SM_Functions(GOP_GetRFLevel, &data, sm) == GE_NONE) - fprintf(stdout, _("RFLevel: %d\n"), (int)rflevel); + error=GSM->GetBinRingtone(&ringtone); - if (SM_Functions(GOP_GetBatteryLevel, &data, sm) == GE_NONE) - fprintf(stdout, _("Battery: %d\n"), (int)batterylevel); + while (GSM->GetModel(model) != GE_NONE) + sleep(1); -// if (GSM->GetPowerSource(&powersource) == GE_NONE) -// fprintf(stdout, _("Power Source: %s\n"), (powersource==GPS_ACDC)?_("AC/DC"):_("battery")); + GSM->Terminate(); + + fprintf(stdout, _("Downloaded ringtone, location %i: "),ringtone.location); + + switch (error) { + case GE_NONE: + fprintf(stdout, _("get succeeded!\n")); + fprintf(stdout, _("Name: %s (binary format)\n"),ringtone.name); + break; + case GE_INVALIDRINGLOCATION: + fprintf(stdout, _("invalid location %i!\n"),ringtone.location); + break; + case GE_UNKNOWNMODEL: + + /* In 3310 we have normal "Smart Messaging" format */ + if (GetModelFeature (FN_RINGTONES)==F_RING_SM) { + + i=7; + if (ringtone.frame[9]==0x4a && ringtone.frame[10]==0x3a) i=8; + ringtone.frame[i]=0x02; + + GSM_UnPackRingtone(&SMringtone, ringtone.frame+i, ringtone.length-i); - data.MemoryStatus = &SIMMemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("SIM: Used %d, Free %d\n"), SIMMemoryStatus.Used, SIMMemoryStatus.Free); + fprintf(stdout, _("Name: %s (normal format)\n"),SMringtone.name); - data.MemoryStatus = &PhoneMemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("Phone: Used %d, Free %d\n"), PhoneMemoryStatus.Used, PhoneMemoryStatus.Free); + GSM_SaveRingtoneFileOnConsole(argv[0], &SMringtone); + + return 0; + } + + fprintf(stdout, _("mygnokii doesn't know format for this model!\n")); + break; + case GE_NOTIMPLEMENTED: + fprintf(stdout, _("not implemented for this model!\n")); + break; + default: + fprintf(stdout, _("not supported by this model!\n")); + break; + } + + if (error!=GE_NONE) + return(-1); + + file = fopen(argv[0], "wb"); + + if (!file) + return(GE_CANTOPENFILE); - data.MemoryStatus = &DC_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("DC: Used %d, Free %d\n"), DC_MemoryStatus.Used, DC_MemoryStatus.Free); + fwrite(ringtone.frame, 1, ringtone.length, file); + + fclose(file); + + return 0; - data.MemoryStatus = &EN_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("EN: Used %d, Free %d\n"), EN_MemoryStatus.Used, EN_MemoryStatus.Free); +} - data.MemoryStatus = &FD_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("FD: Used %d, Free %d\n"), FD_MemoryStatus.Used, FD_MemoryStatus.Free); +int binringtoneconvert(int argc, char *argv[]) +{ + GSM_BinRingtone ringtone; + + int i,j,z; + bool isok; + int deflen=7,m,w; + bool pause; - data.MemoryStatus = &LD_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("LD: Used %d, Free %d\n"), LD_MemoryStatus.Used, LD_MemoryStatus.Free); + FILE *file; + +//{ "c", "c#", "d", "d#", "e", "f", "f#", "g", "g#", "a", "a#", "h" }; + int binary_notes[12] = + { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11 , 12}; + + if (GSM_ReadBinRingtoneFile(argv[0],&ringtone)!=GE_NONE) { + fprintf(stdout,_("Failed to read %s file!\n"),argv[0]); + return -1; + } + + file = fopen(argv[1], "wb"); + + if (!file) + return(GE_CANTOPENFILE); + + i=5; + while (true) { + if (ringtone.frame[i]==0) break; + fprintf(file,_("%c"),ringtone.frame[i]); + i++; + } + + fprintf(file,_(":d=32,o=5,b=300:")); + + i=i+5;j=0;z=0; + while (true) { + if (ringtone.frame[i]!=j) { + if (j!=0) { + isok=false; + if (j==64) { + j=255;//Pause + isok=true; + } + if (!isok && j>=114 && j<=125) { + j=14*3+binary_notes[j-114]; + isok=true; + } + if (!isok && j>=126 && j<=137) { + j=14*1+binary_notes[j-126]; + isok=true; + } + if (!isok && j>=138 && j<=149) { + j=14*2+binary_notes[j-138]; + isok=true; + } + if (!isok && j>=150 && j<=161) { + j=14*4+binary_notes[j-150]; + isok=true; + } + if (!isok) { + if (j!=10) { + fprintf(stdout,_("Unknown block in binary ringtone %i %i\n"),j,z); + } + } else { + w=deflen; + for (m=0;m<6;m++) { + w=w*2; + if (w>z && (w/2)<=z) { + switch (m) { + case 1:fprintf(file,_("16"));break; + case 2:fprintf(file,_("8"));break; + case 3:fprintf(file,_("4"));break; + case 4:fprintf(file,_("2"));break; + case 5:fprintf(file,_("1"));break; + } + break; + } + } + if (z>w) fprintf(file,_("1")); + pause=false; + switch (GSM_GetNote(j)) { + case Note_C :fprintf(file,_("c"));break; + case Note_Cis:fprintf(file,_("c#"));break; + case Note_D :fprintf(file,_("d"));break; + case Note_Dis:fprintf(file,_("d#"));break; + case Note_E :fprintf(file,_("e"));break; + case Note_F :fprintf(file,_("f"));break; + case Note_Fis:fprintf(file,_("f#"));break; + case Note_G :fprintf(file,_("g"));break; + case Note_Gis:fprintf(file,_("g#"));break; + case Note_A :fprintf(file,_("a"));break; + case Note_Ais:fprintf(file,_("a#"));break; + case Note_H :fprintf(file,_("h"));break; + default :pause=true;fprintf(file,_("p"));break; //Pause ? + } + w=deflen*1.5; + for (m=0;m<6;m++) { + w=w*2; + if (w>z && (w/2)<=z) { + fprintf(file,_(".")); + break; + } + } + if ((j/14)!=1 && !pause) fprintf(file,_("%i"),j/14); + fprintf(file,_(",")); + } + } + j=ringtone.frame[i]; + z=ringtone.frame[i+1]; + } else { + z=z+ringtone.frame[i+1]; + } + i=i+2; + if (i>=ringtone.length) break; + } + + fclose(file); + + return 0; - data.MemoryStatus = &MC_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("MC: Used %d, Free %d\n"), MC_MemoryStatus.Used, MC_MemoryStatus.Free); +} - data.MemoryStatus = &ON_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("ON: Used %d, Free %d\n"), ON_MemoryStatus.Used, ON_MemoryStatus.Free); +int renamesmsc(int argc, char *argv[]) +{ + GSM_MessageCenter MessageCenter; + + MessageCenter.No=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + if (GSM->GetSMSCenter(&MessageCenter) == GE_NONE) { + fprintf(stdout,_("SMSC number %i get OK\n"),MessageCenter.No); + } else { + GSM->Terminate(); + fprintf(stdout,_("Error getting SMSC number %i\n"),MessageCenter.No); + return 0; + } + + strncpy(MessageCenter.Name,argv[1],10); + + if (GSM->SetSMSCenter(&MessageCenter) == GE_NONE) { + fprintf(stdout,_("SMSC number %i set OK (renamed to \"%s\")\n"),MessageCenter.No,MessageCenter.Name); + } else { + GSM->Terminate(); + fprintf(stdout,_("Error setting SMSC number %i\n"),MessageCenter.No); + return 0; + } + + GSM->Terminate(); - data.MemoryStatus = &RC_MemoryStatus; - if (SM_Functions(GOP_GetMemoryStatus, &data, sm) == GE_NONE) - fprintf(stdout, _("RC: Used %d, Free %d\n"), RC_MemoryStatus.Used, RC_MemoryStatus.Free); + return 0; +} -// if (GSM->GetSMSStatus(&SMSStatus) == GE_NONE) -// fprintf(stdout, _("SMS Messages: UnRead %d, Number %d\n"), SMSStatus.UnRead, SMSStatus.Number); +/* + * Returns number of sostituited characters. + * ... may be useful one day ?? + */ +int semicolon_pipe_substitution( GSM_PhonebookEntry *pentry, unsigned int direction ) + /* direction = 0 : after reading phone memory ( + * 1 : writing phone memory + */ +{ + register int i; + register int count=0; + char charfrom, charto; -// if (GSM->GetIncomingCallNr(Number) == GE_NONE) -// fprintf(stdout, _("Incoming call: %s\n"), Number); + charfrom= (direction==0) ? ';' : '|'; + charto = (direction==0) ? '|' : ';'; -// if (GSM->GetNetworkInfo(&NetworkInfo) == GE_NONE) -// fprintf(stdout, _("Network: %s (%s), LAC: %s, CellID: %s\n"), GSM_GetNetworkName (NetworkInfo.NetworkCode), GSM_GetCountryName(NetworkInfo.NetworkCode), NetworkInfo.LAC, NetworkInfo.CellID); + count+=str_substch(pentry->Name, charfrom, charto ); + count+=str_substch(pentry->Number, charfrom, charto ); -// if (GSM->ReadCellBroadcast(&CBMessage) == GE_NONE) -// fprintf(stdout, _("Cell broadcast received on channel %d: %s\n"), CBMessage.Channel, CBMessage.Message); - - sleep(1); + for( i = 0; i < pentry->SubEntriesCount; i++ ) + { + if( pentry->SubEntries[i].EntryType != GSM_Date ) + count+=str_substch(pentry->SubEntries[i].data.Number ,charfrom,charto); } - fprintf(stderr, _("Leaving monitor mode...\n")); - - return 0; + return( count ); } - -#define ESC "\e" - -static GSM_Error PrettyOutputFn(char *Display, char *Indicators) +int str_substch( char *str, const char toric, const char sost ) { - if (Display) - printf(ESC "[10;0H Display is:\n%s\n", Display); - if (Indicators) - printf(ESC "[9;0H Indicators: %s \n", Indicators); - printf(ESC "[1;1H"); - return GE_NONE; -} - -#if 0 -/* Uncomment it if used */ -static GSM_Error OutputFn(char *Display, char *Indicators) + unsigned int ct; + int i_sost=0; + + for( ct = 0; ct < strlen(str); ct++ ) + if( str[ct] == (unsigned char) toric ) + { str[ct] = sost; i_sost++; } + + return( i_sost ); +} + +/* Allows to set simlock state. + With older phone (older 51xx, 61xx) can open them, with older + and newer should be able to close them */ +/* DO NOT TRY, IF DON'T WANT, WHAT YOU DO !!!!!!!!!! */ +int setsimlock() { - if (Display) - printf("New display is:\n%s\n", Display); - if (Indicators) - printf("Indicators: %s\n", Indicators); - return GE_NONE; + GSM_AllSimlocks siml; + + unsigned char closebuffer[20]= + { 0x00, 0x01, 0x82, 0x01, + 0x00, /* which simlock */ + 0x00, 0x00, + 0x00, 0x00, 0x00, /* lock 1 info */ + 0x00, 0x00, 0x00, 0x00, 0x00, /* lock 4 info */ + 0x00, 0x00, /* lock 2 info */ + 0x00, 0x00, /* lock 3 info */ + 0x00}; + unsigned char openbuffer[10]= { 0x00, 0x01, 0x81, 0x01, + 0x00, /* lock number */ + 0x10, 0x10, 0x10, 0x10, 0x10 }; + unsigned char openbuffer0[10]= {0x00, 0x01, 0x02, 0x03, 0x1f, 0x11, 0x01, 0x01, 0x10, 0x00 }; + + unsigned char info[120]; + int i,j; + + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); + if (strstr(GSM_Info->FBUSModels, "3310") == NULL) + { + fprintf(stderr,("Not supported\n")); + GSM->Terminate(); + return -1; + } + N6110_EnableExtendedCommands(0x02); + /* Initial info */ + if (GSM->SimlockInfo(&siml)!=GE_NONE) { + fprintf(stderr,_("Error getting simlock info\n"));GSM->Terminate();return -1; + } + /* Opening all locks (we must check, if we can open them) */ + NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer0); + openbuffer[4]=1;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=2;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=4;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=8;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + if (GSM->SimlockInfo(&siml)!=GE_NONE) { + fprintf(stderr,_("Error getting simlock info\n"));GSM->Terminate();return -1; + } + for (i=0;i<4;i++) { + if (siml.simlocks[i].enabled) { + fprintf(stderr,_("Can not open simlock %i\n"),i+1);GSM->Terminate();return -1; + } + } + /* Making frame for closing simlocks */ + strcpy(info,"00101"); + j=0;i=7; + while (j!=strlen(info)) { + if (j+2<=strlen(info)) { + closebuffer[i]=((info[j] & 0x0f)<<4) | (info[j+1] & 0x0f);j=j+2; + } else { + closebuffer[i]=(info[j] & 0x0f) << 4;j++; + }i++; + } + strcpy(info,"0000");j=0;i=15; + while (j!=strlen(info)) { + if (j+2<=strlen(info)) { + closebuffer[i]=((info[j] & 0x0f)<<4) | (info[j+1] & 0x0f);j=j+2; + } else { + closebuffer[i]=(info[j] & 0x0f) << 4;j++; + }i++; + } + strcpy(info,"0000");j=0;i=17; + while (j!=strlen(info)) { + if (j+2<=strlen(info)) { + closebuffer[i]=((info[j] & 0x0f)<<4) | (info[j+1] & 0x0f);j=j+2; + } else { + closebuffer[i]=(info[j] & 0x0f) << 4;j++; + }i++; + } + strcpy(info,"0000000001");j=0;i=9; + while (j!=strlen(info)) { + if (j+2<=strlen(info)) { + if (j==0) { + closebuffer[i]=closebuffer[i] | (info[j] & 0x0f);j++; + } else { + closebuffer[i]=((info[j] & 0x0f)<<4) | (info[j+1] & 0x0f);j=j+2; + } + } else { + closebuffer[i]=(info[j] & 0x0f) << 4;j++; + }i++; + } + /* Closing simlock with given values */ + closebuffer[4]=1+2+4+8; + NULL_SendMessageSequence (50, &CurrentMagicError, 20, 0x40,closebuffer); + /* Opening all locks */ + NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer0); + openbuffer[4]=1;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=2;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=4;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=8;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + GSM->Reset(0x03); + GSM->Terminate(); + return 0; } -#endif -void console_raw(void) +int simlockinfo() { -#ifndef WIN32 - struct termios it; - - tcgetattr(fileno(stdin), &it); - it.c_lflag &= ~(ICANON); - //it.c_iflag &= ~(INPCK|ISTRIP|IXON); - it.c_cc[VMIN] = 1; - it.c_cc[VTIME] = 0; - - tcsetattr(fileno(stdin), TCSANOW, &it); -#endif + GSM_AllSimlocks siml; + char s[7]; + + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); + + if (GSM->SimlockInfo(&siml)!=GE_NONE) fprintf(stderr,_("Error\n")); + + fprintf(stdout,_("MCC + MNC : %s ("),siml.simlocks[0].data); + if (siml.simlocks[0].enabled) fprintf(stdout,_("CLOSED")); + else fprintf(stdout,_("opened")); + if (siml.simlocks[0].factory) fprintf(stdout,_(") (factory")); + else fprintf(stdout,_(") (user")); + fprintf(stdout,_(") (counter %i"),siml.simlocks[0].counter); + + s[0]=siml.simlocks[0].data[0]; + s[1]=siml.simlocks[0].data[1]; + s[2]=siml.simlocks[0].data[2]; + s[3]=' '; + s[4]=siml.simlocks[0].data[3]; + s[5]=siml.simlocks[0].data[4]; + s[6]=0; + + if (strcmp(GSM_GetNetworkName(s),"unknown")) + fprintf(stdout,_(") (network \"%s\""),GSM_GetNetworkName(s)); + + fprintf(stdout,_(")\n")); + + fprintf(stdout,_("GID1 : %s ("),siml.simlocks[1].data); + if (siml.simlocks[1].enabled) fprintf(stdout,_("CLOSED")); + else fprintf(stdout,_("opened")); + if (siml.simlocks[1].factory) fprintf(stdout,_(") (factory")); + else fprintf(stdout,_(") (user")); + fprintf(stdout,_(") (counter %i"),siml.simlocks[1].counter); + fprintf(stdout,_(")\n")); + + fprintf(stdout,_("GID2 : %s ("),siml.simlocks[2].data); + if (siml.simlocks[2].enabled) fprintf(stdout,_("CLOSED")); + else fprintf(stdout,_("opened")); + if (siml.simlocks[2].factory) fprintf(stdout,_(") (factory")); + else fprintf(stdout,_(") (user")); + fprintf(stdout,_(") (counter %i"),siml.simlocks[2].counter); + fprintf(stdout,_(")\n")); + + fprintf(stdout,_("MSIN : %s ("),siml.simlocks[3].data); + if (siml.simlocks[3].enabled) fprintf(stdout,_("CLOSED")); + else fprintf(stdout,_("opened")); + if (siml.simlocks[3].factory) fprintf(stdout,_(") (factory")); + else fprintf(stdout,_(") (user")); + fprintf(stdout,_(") (counter %i"),siml.simlocks[3].counter); + fprintf(stdout,_(")\n")); + + GSM->Terminate(); + + return 0; } -int displayoutput(void) +/* Getting EEPROM from older phones */ +/* Tested with N5110 5.07, 6150 5.22 */ +int geteeprom() { - GSM_Data data; - GSM_Statemachine *sm = &State; - GSM_Error error; - - data.OutputFn = PrettyOutputFn; + int i=0x40; - error = SM_Functions(GOP_DisplayOutput, &data, sm); - console_raw(); - fcntl(fileno(stdin), F_SETFL, O_NONBLOCK); + unsigned char buffer[1000]={ 0x00, 0x01, 0xd4, 0x02, 0x00, 0xa0, + 0x00, 0x00, /* location Lo and Hi */ + 0x10 }; /* how many bytes */ - if (error == GE_NONE) { + strcpy(Connection,"mbus"); + fprintf(stderr,_("Switching connection type to MBUS\n")); - /* We do not want to see texts forever - press Ctrl+C to stop. */ - signal(SIGINT, interrupted); - - fprintf (stderr, _("Entered display monitoring mode...\n")); - fprintf (stderr, ESC "c" ); - - /* Loop here indefinitely - allows you to read texts from phone's - display. The loops ends after pressing the Ctrl+C. */ - while (!bshutdown) { - char buf[105]; - memset(&buf[0], 0, 102); - while (read(0, buf, 100) > 0) { - fprintf(stderr, "handling keys (%d).\n", strlen(buf)); - if (GSM && GSM->HandleString && GSM->HandleString(buf) != GE_NONE) - fprintf(stdout, _("Key press simulation failed.\n")); - memset(buf, 0, 102); - } - SM_Loop(sm, 1); - } - fprintf (stderr, "Shutting down\n"); + strcpy(model,"5110"); + + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); + + if (strstr(GSM_Info->FBUSModels, "3310") == NULL) + { + fprintf(stderr,("Not supported\n")); + GSM->Terminate(); + return -1; + } + + for (i=0;i<64;i++) { + fprintf(stdout,_("%c"),0xff); + } + + while (i<300000) { + buffer[6] = i/256; + buffer[7] = i%256; + + if ((i/256)!=((i-1)/256)) fprintf(stderr,_(".")); + + if (NULL_SendMessageSequence(50, &CurrentMagicError, 9, 0x40,buffer)!=GE_NONE) break; - fprintf (stderr, _("Leaving display monitor mode...\n")); - data.OutputFn = NULL; + i=i+0x10; + } - error = SM_Functions(GOP_DisplayOutput, &data, sm); - if (error != GE_NONE) - fprintf (stderr, _("Error!\n")); - } else - fprintf (stderr, _("Error!\n")); + fprintf(stderr,_("\n")); + + GSM->Terminate(); - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; + return 0; } -/* Reads profile from phone and displays its' settings */ -int getprofile(int argc, char *argv[]) +int getsmsfolders() { - int max_profiles; - int start, stop, i; - GSM_Profile profile; - GSM_Error error; - - /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ - char model[64]; + GSM_SMSFolders folders; + GSM_Error error; - profile.Number = 0; - if (GSM && GSM->GetProfile) error = GSM->GetProfile(&profile); + int i; + + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); - if (error == GE_NONE) { - - while (GSM && GSM->GetModel && GSM->GetModel(model) != GE_NONE) - sleep(1); + folders.number = 0; - max_profiles = 7; /* This is correct for 6110 (at least my). How do we get - the number of profiles? */ + error=GSM->GetSMSFolders(&folders); + + GSM->Terminate(); - /* For N5110 */ - /* FIXME: It should be set to 3 for N5130 and 3210 too */ - if (!strcmp(model, "NSE-1")) - max_profiles = 3; + if (error!=GE_NONE && !folders.number) { + fprintf(stdout,_("Error!\n")); + return -1; + } + + for (i=0;i 0) { - profile.Number = atoi(argv[0]) - 1; - start = profile.Number; - stop = start + 1; +int resetphonesettings() +{ + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); - if (profile.Number < 0) { - fprintf(stderr, _("Profile number must be value from 1 to %d!\n"), max_profiles); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - } + GSM->ResetPhoneSettings(); - if (profile.Number >= max_profiles) { - fprintf(stderr, _("This phone supports only %d profiles!\n"), max_profiles); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - } - } else { - start = 0; - stop = max_profiles; - } + GSM->Reset(0x03); + + GSM->Terminate(); - i = start; - while (i < stop) { - profile.Number = i; + return 0; +} - if (profile.Number != 0) - if (GSM && GSM->GetProfile) GSM->GetProfile(&profile); +/* Checked on 3310 4.02 and doesn't work. + Possible reasons: SMSC has problems (possible), bug in phone firmware + (very possible) or here in code. + I quess, that the second is the most possible - 3310 treat only 3 SMS + as linked (the most often profile needs 4 - 2 and few bytes in 3'th + for screen saver, few bytes for profile name and 1 or 2 sms for ringtone). + When send separate ringtone (see --sendringtone with --profilestyle) + and screen saver (--sendlogo screensaver...), it's received OK. + It's for checking in higher firmware. */ +int sendprofile(int argc, char *argv[]) +{ + GSM_Ringtone ringtone; + GSM_Bitmap bitmap; + GSM_MultiSMSMessage MultiSMS; - fprintf(stdout, "%d. \"%s\"\n", profile.Number + 1, profile.Name); - if (profile.DefaultName == -1) fprintf(stdout, _(" (name defined)\n")); + int current=0,i,j; - fprintf(stdout, _("Incoming call alert: %s\n"), GetProfileCallAlertString(profile.CallAlert)); + u8 MessageBuffer[140*4]; + u16 MessageLength=0; + + char profilename[10+1]; + + if (GSM_ReadRingtoneFileOnConsole(argv[2], &ringtone)!=GE_NONE) return(-1); - /* For different phones different ringtones names */ + ringtone.allnotesscale=false; + for (i=0;iFB61_MAX_RINGTONE_NOTES) { + fprintf(stderr,_("Warning: due to phone limitation")); + } else { + fprintf(stderr,_("Warning: ringtone was too long to be saved into SMS,")); + } + fprintf(stderr, _(" only %i first notes were packed (%i cut)\n"),current,ringtone.NrNotes-current); + } + + MessageBuffer[i]=(j)/256; + MessageBuffer[i+1]=(j)%256; - /* FIXME: Light settings is only used for Car */ - if (profile.Number == (max_profiles - 2)) fprintf(stdout, _("Lights: %s\n"), profile.Lights ? _("On") : _("Automatic")); + MessageBuffer[MessageLength++]=SM30_SCREENSAVER; //ID for OTA screen saver + MessageBuffer[MessageLength++]=0x01; //length hi + MessageBuffer[MessageLength++]=0x00; //length lo + MessageBuffer[MessageLength++]=0x00; + MessageBuffer[MessageLength++]=bitmap.width; + MessageBuffer[MessageLength++]=bitmap.height; + MessageBuffer[MessageLength++]=0x01; - fprintf(stdout, _("Vibration: %s\n"), GetProfileVibrationString(profile.Vibration)); + memcpy(MessageBuffer+MessageLength,bitmap.bitmap,bitmap.size); + MessageLength=MessageLength+bitmap.size; - /* FIXME: it will be nice to add here reading caller group name. */ - if (max_profiles != 3) fprintf(stdout, _("Caller groups: 0x%02x\n"), profile.CallerGroups); + GSM_MakeMultiPartSMS2(&MultiSMS,MessageBuffer,MessageLength, GSM_ProfileUDH, GSM_Coding_Default); - /* FIXME: Automatic answer is only used for Car and Headset. */ - if (profile.Number >= (max_profiles - 2)) fprintf(stdout, _("Automatic answer: %s\n"), profile.AutomaticAnswer ? _("On") : _("Off")); + optind = 4; - fprintf(stdout, "\n"); + /* Initialise the GSM interface. */ + fbusinit(NULL); - i++; - } - } else { - if (error == GE_NOTIMPLEMENTED) { - fprintf(stderr, _("Function not implemented in %s model!\n"), model); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - } else { - fprintf(stderr, _("Unspecified error\n")); - if (GSM && GSM->Terminate) GSM->Terminate(); - return -1; - } - } + for (i=0;iTerminate) GSM->Terminate(); - return 0; + return GSM_SaveMultiPartSMSOnConsole(&MultiSMS, optind,argc,argv,false,false,false,false); } -/* Get requested range of memory storage entries and output to stdout in - easy-to-parse format */ -int getmemory(int argc, char *argv[]) +int showbitmap(int argc, char *argv[]) { - GSM_PhonebookEntry entry; - int count; - GSM_Error error; - char *memory_type_string; - int start_entry; - int end_entry; - GSM_Statemachine *sm = &State; - - /* Handle command line args that set type, start and end locations. */ - memory_type_string = argv[0]; - entry.MemoryType = StrToMemoryType(memory_type_string); - if (entry.MemoryType == GMT_XX) { - fprintf(stderr, _("Unknown memory type %s (use ME, SM, ...)!\n"), argv[0]); - return (-1); - } + GSM_Bitmap bitmap; - start_entry = atoi (argv[1]); - if (argc > 2) end_entry = atoi (argv[2]); - else end_entry = start_entry; + if (GSM_ReadBitmapFileOnConsole(argv[0], &bitmap)!=GE_NONE) return(-1); - /* Now retrieve the requested entries. */ - for (count = start_entry; count <= end_entry; count ++) { + GSM_PrintBitmap(&bitmap); - entry.Location = count; + return 0; +} - data.PhonebookEntry = &entry; - error = SM_Functions(GOP_ReadPhonebook, &data, sm); +int getwapsettings(int argc, char *argv[]) +{ + GSM_WAPSettings settings; + GSM_Error error; - if (error == GE_NONE) { - fprintf(stdout, "%s;%s;%s;%d;%d\n", entry.Name, entry.Number, memory_type_string, entry.Location, entry.Group); - if (entry.MemoryType == GMT_MC || entry.MemoryType == GMT_DC || entry.MemoryType == GMT_RC) - fprintf(stdout, "%02u.%02u.%04u %02u:%02u:%02u\n", entry.Date.Day, entry.Date.Month, entry.Date.Year, entry.Date.Hour, entry.Date.Minute, entry.Date.Second); - } - else { - if (error == GE_NOTIMPLEMENTED) { - fprintf(stderr, _("Function not implemented in %s model!\n"), model); - return -1; - } - else if (error == GE_INVALIDMEMORYTYPE) { - fprintf(stderr, _("Memory type %s not supported!\n"), memory_type_string); - return -1; - } + settings.location=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); + + error=GSM->GetWAPSettings(&settings); + + switch (error) { + case GE_NONE: + fprintf(stdout,_("%s."),argv[0]); + if (!(strcmp(settings.title,""))) fprintf(stdout,_("Set %s\n"),argv[0]); + else fprintf(stdout,_("%s\n"),settings.title); + fprintf(stdout,_("Homepage: %s\n"),settings.homepage); + if (settings.iscontinuous) fprintf(stdout,_("Connection type: continuous\n")); + else fprintf(stdout,_("Connection type: temporary\n")); + if (settings.issecurity) fprintf(stdout,_("Connection security: on\n")); + else fprintf(stdout,_("Connection security: off\n")); + switch (settings.bearer) { + case WAPSETTINGS_BEARER_SMS: + fprintf(stdout,_("Bearer: SMS\n")); + fprintf(stdout,_("Server number: %s\n"),settings.server); + fprintf(stdout,_("Service number: %s\n"),settings.service); + break; + case WAPSETTINGS_BEARER_DATA: + fprintf(stdout,_("Bearer: Data (CSD)\n")); + fprintf(stdout,_("Dial-up number: %s\n"),settings.dialup); + fprintf(stdout,_("IP address: %s\n"),settings.ipaddress); + if (settings.isnormalauthentication) fprintf(stdout,_("Authentication type: normal\n")); + else fprintf(stdout,_("Authentication type: secure\n")); + if (settings.isISDNcall) fprintf(stdout,_("Data call type: ISDN\n")); + else fprintf(stdout,_("Data call type: analogue\n")); + if (settings.isspeed14400) fprintf(stdout,_("Data call speed: 14400\n")); + else fprintf(stdout,_("Data call speed: 9600\n")); + fprintf(stdout,_("User name: %s\n"),settings.user); + fprintf(stdout,_("Password: %s\n"),settings.password); + break; + case WAPSETTINGS_BEARER_USSD: + fprintf(stdout,_("Bearer: USSD\n")); + fprintf(stdout,_("Service code: %s\n"),settings.code); + if (settings.isIP) fprintf(stdout,_("Address type: IP address\nIPaddress: %s\n"),settings.service); + else fprintf(stdout,_("Address type: service number\nService number: %s\n"),settings.service); + break; + } + break; + default: + fprintf(stderr,_("%s\n"),print_error(error)); + } + + GSM->Terminate(); + + return 0; - fprintf(stdout, _("%s|%d|Bad location or other error!(%d)\n"), memory_type_string, count, error); - } - } - return 0; } -/* Read data from stdin, parse and write to phone. The parsing is relatively - crude and doesn't allow for much variation from the stipulated format. */ -/* FIXME: I guess there's *very* similar code in xgnokii */ -int writephonebook(int argc, char *args[]) +/* Not full done now */ +int savewapsettings(int argc, char *argv[]) { - GSM_PhonebookEntry entry; - GSM_Error error; - char *memory_type_string; - int line_count=0; - int subentry; + GSM_WAPSettings settings; + GSM_MultiSMSMessage MultiSMS; + GSM_Error error; + int w; - char *Line, OLine[100], BackLine[100]; - char *ptr; + settings.location=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); - /* Check argument */ - if (argc && (strcmp("-i", args[0]))) - usage(); + error=GSM->GetWAPSettings(&settings); +// strcpy(settings.homepage,"http://OtherSites/"); +// strcpy(settings.title,"Orange"); - Line = OLine; + error=GE_NONE; + + switch (error) { + case GE_NONE: + /* Put settings into SMS structure */ + GSM_SaveWAPSettingsToSMS(&MultiSMS,&settings); - /* Go through data from stdin. */ - while (GetLine(stdin, Line, 99)) { - strcpy(BackLine, Line); - line_count++; + for (w=0;wTerminate(); - if (!ptr) { - fprintf(stderr, _("Format problem on line %d [%s]\n"), line_count, BackLine); - Line = OLine; - continue; - } + return 0; +} - if (!strncmp(ptr,"ME", 2)) { - memory_type_string = "int"; - entry.MemoryType = GMT_ME; - } else { - if (!strncmp(ptr,"SM", 2)) { - memory_type_string = "sim"; - entry.MemoryType = GMT_SM; - } else { - fprintf(stderr, _("Format problem on line %d [%s]\n"), line_count, BackLine); - break; - } - } +int sendwapsettings(int argc, char *argv[]) +{ + GSM_WAPSettings settings; + GSM_MultiSMSMessage MultiSMS; + GSM_Error error; + int w; - ptr = strtok(NULL, ";"); - if (ptr) entry.Location = atoi(ptr); - else entry.Location = 0; + settings.location=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); - ptr = strtok(NULL, ";"); - if (ptr) entry.Group = atoi(ptr); - else entry.Group = 0; + error=GSM->GetWAPSettings(&settings); +// strcpy(settings.homepage,"http://OtherSites/"); +// strcpy(settings.title,"Orange"); - if (!ptr) { - fprintf(stderr, _("Format problem on line %d [%s]\n"), line_count, BackLine); - continue; - } + error=GE_NONE; + + switch (error) { + case GE_NONE: + /* Put settings into SMS structure */ + GSM_SaveWAPSettingsToSMS(&MultiSMS,&settings); - for (subentry = 0; ; subentry++) { - ptr = strtok(NULL, ";"); + for (w=0;wTerminate(); - ptr = strtok(NULL, ";"); + return 0; +} - /* 0x13 Date Type; it is only for Dailed Numbers, etc. - we don't store to this memories so it's an error to use it. */ - if (!ptr || entry.SubEntries[subentry].EntryType == GSM_Date) { - fprintf(stdout, _("There is no phone number on line %d entry %d [%s]\n"), - line_count, subentry, BackLine); - subentry--; - break; - } else - strcpy(entry.SubEntries[subentry].data.Number, ptr); - } +int getwapbookmark(int argc, char *argv[]) +{ + GSM_WAPBookmark bookmark; + GSM_Error error; - entry.SubEntriesCount = subentry; + bookmark.location=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); - /* This is to send other exports (like from 6110) to 7110 */ - if (!entry.SubEntriesCount) { - entry.SubEntriesCount = 1; - entry.SubEntries[subentry].EntryType = GSM_Number; - entry.SubEntries[subentry].NumberType = GSM_General; - entry.SubEntries[subentry].BlockNumber = 2; - strcpy(entry.SubEntries[subentry].data.Number, entry.Number); - } + error=GSM->GetWAPBookmark(&bookmark); + + switch (error) { + case GE_NONE: + if (bookmark.address[0]==0) { + fprintf(stdout,_("Empty bookmark location\n")); + } else { + fprintf(stdout,_("Address: \"%s\"\n"),bookmark.address); + if (bookmark.title[0]==0) + fprintf(stdout,_("Title: \"%s\"\n"),bookmark.address); + else + fprintf(stdout,_("Title: \"%s\"\n"),bookmark.title); + } + break; + default: + fprintf(stderr,_("%s\n"),print_error(error)); + } + + GSM->Terminate(); + + return 0; - Line = OLine; +} - if (argc) { - GSM_PhonebookEntry aux; +int setwapbookmark(int argc, char *argv[]) +{ + GSM_WAPBookmark bookmark; + GSM_Error error; - aux.Location = entry.Location; - if (GSM && GSM->GetMemoryLocation) error = GSM->GetMemoryLocation(&aux); - - if (error == GE_NONE) { - if (!aux.Empty) { - int confirm = -1; - char ans[8]; - - fprintf(stdout, _("Location busy. ")); - while (confirm < 0) { - fprintf(stdout, _("Overwrite? (yes/no) ")); - GetLine(stdin, ans, 7); - if (!strcmp(ans, _("yes"))) confirm = 1; - else if (!strcmp(ans, _("no"))) confirm = 0; - } - if (!confirm) continue; - } - } else { - fprintf(stderr, _("Unknown error (%d)\n"), error); - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; - } - } + if (argc == 3) /* if location given, use it */ + bookmark.location=atoi(argv[2]); + else /* else use first empty location */ + bookmark.location=0xffff; - /* Do write and report success/failure. */ - if (GSM && GSM->WritePhonebookLocation) error = GSM->WritePhonebookLocation(&entry); + strcpy(bookmark.title, argv[0]); + strcpy(bookmark.address, argv[1]); - if (error == GE_NONE) - fprintf (stdout, _("Write Succeeded: memory type: %s, loc: %d, name: %s, number: %s\n"), memory_type_string, entry.Location, entry.Name, entry.Number); - else - fprintf (stdout, _("Write FAILED(%d): memory type: %s, loc: %d, name: %s, number: %s\n"), error, memory_type_string, entry.Location, entry.Name, entry.Number); + /* Initialise the GSM interface. */ + fbusinit(NULL); - } + error=GSM->SetWAPBookmark(&bookmark); + + switch (error) { + case GE_NONE: + fprintf(stdout,_("No errors\n")); + break; + default: + fprintf(stderr,_("%s\n"),print_error(error)); + } - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; -} + GSM->Terminate(); + + return 0; -/* Getting speed dials. */ -int getspeeddial(char *Number) -{ - GSM_SpeedDial SpeedDial; - GSM_Data data; - GSM_Error error; - - SpeedDial.Number = atoi(Number); - - if (GSM && GSM->GetSpeedDial && GSM->Terminate) { - error = GSM->GetSpeedDial(&SpeedDial); - GSM->Terminate(); - } else { - GSM_DataClear(&data); - data.SpeedDial = &SpeedDial; - - error = SM_Functions(GOP_GetSpeedDial, &data, &State); - } - - switch (error) { - case GE_NONE: - fprintf(stdout, _("SpeedDial nr. %d: %d:%d\n"), SpeedDial.Number, SpeedDial.MemoryType, SpeedDial.Location); - break; - case GE_NOTIMPLEMENTED: - fprintf(stdout, _("Function not implemented in %s !\n"), model); - break; - default: - fprintf(stdout, _("Internal error\n")); - break; - } - - return error; } -/* Setting speed dials. */ -int setspeeddial(char *argv[]) +int savewapbookmark(int argc, char *argv[]) { - GSM_SpeedDial entry; + GSM_WAPBookmark bookmark; + GSM_MultiSMSMessage MultiSMS; + GSM_Error error; + int w; + + bookmark.location=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); - char *memory_type_string; + error=GSM->GetWAPBookmark(&bookmark); - /* Handle command line args that set type, start and end locations. */ +// strcpy(bookmark.title,"tytulagagagagagagagagagagagagagagagagagagagagagend"); +// strcpy(bookmark.address,"http://jajajajajajajajajajajajagagagagagagagagagagagagagagagagagagagagagpapapapapapapapapapapapapapapapapapapapapapapapapapapapapapapapap¥papapapapapapapapagagagagagagagagagagagagagagagagagagagagagagagagagadadadadadadadajdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdstp"); + error=GE_NONE; - if (strcmp(argv[1], "ME") == 0) { - entry.MemoryType = 0x02; - memory_type_string = "ME"; - } else if (strcmp(argv[1], "SM") == 0) { - entry.MemoryType = 0x03; - memory_type_string = "SM"; - } else { - fprintf(stderr, _("Unknown memory type %s!\n"), argv[1]); - return -1; - } + switch (error) { + case GE_NONE: - entry.Number = atoi(argv[0]); - entry.Location = atoi(argv[2]); + if (bookmark.address[0]==0) { + fprintf(stdout,_("Empty bookmark location\n")); + GSM->Terminate(); + return 1; + } - if (GSM && GSM->SetSpeedDial && GSM->SetSpeedDial(&entry) == GE_NONE) { - fprintf(stdout, _("Succesfully written!\n")); - } + /* Put bookmark into SMS structure */ + GSM_SaveWAPBookmarkToSMS(&MultiSMS,&bookmark); - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; -} + for (w=0;wGetDisplayStatus) GSM->GetDisplayStatus(&Status); + break; + default: + fprintf(stderr,_("%s\n"),print_error(error)); + } - fprintf(stdout, _("Call in progress: %s\n"), Status & (1<Terminate(); + + return 0; - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; } -int netmonitor(char *Mode) +int sendwapbookmark(int argc, char *argv[]) { - unsigned char mode = atoi(Mode); - char Screen[50]; - - if (!strcmp(Mode, "reset")) - mode = 0xf0; - else if (!strcmp(Mode, "off")) - mode = 0xf1; - else if (!strcmp(Mode, "field")) - mode = 0xf2; - else if (!strcmp(Mode, "devel")) - mode = 0xf3; - else if (!strcmp(Mode, "next")) - mode = 0x00; + GSM_WAPBookmark bookmark; + GSM_MultiSMSMessage MultiSMS; + GSM_Error error; + int w; - memset(&Screen, 0, 50); - if (GSM && GSM->NetMonitor) GSM->NetMonitor(mode, Screen); + bookmark.location=atoi(argv[0]); + + /* Initialise the GSM interface. */ + fbusinit(NULL); - if (Screen) - fprintf(stdout, "%s\n", Screen); + error=GSM->GetWAPBookmark(&bookmark); + + switch (error) { + case GE_NONE: - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; -} + if (bookmark.address[0]==0) { + fprintf(stdout,_("Empty bookmark location\n")); + GSM->Terminate(); + return 1; + } -int identify(void) -{ - /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ - char imei[64], model[64], rev[64], manufacturer[64]; - GSM_Statemachine *sm = &State; + /* Put bookmark into SMS structure */ + GSM_SaveWAPBookmarkToSMS(&MultiSMS,&bookmark); - data.Manufacturer = manufacturer; - data.Model = model; - data.Revision = rev; - data.Imei = imei; + for (w=0;wTerminate(); - fprintf(stdout, _("IMEI: %s\n"), imei); - fprintf(stdout, _("Manufacturer: %s\n"), manufacturer); - fprintf(stdout, _("Model: %s\n"), model); - fprintf(stdout, _("Revision: %s\n"), rev); + return 0; - return 0; } -int senddtmf(char *String) +int savecalendarnote(int argc, char *argv[]) { - if (GSM && GSM->SendDTMF) GSM->SendDTMF(String); - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; + GSM_MultiSMSMessage MultiSMS; + int w; + GSM_CalendarNote CalendarNote; + int number; + + number=atoi(argv[1]); + + if (number<1) { + fprintf(stdout, _("Number of calendar note must be 1 or higher\n")); + return -1; + } + + switch ( GSM_ReadVCalendarFile(argv[0], &CalendarNote, &number) ) { + case GE_NONE: + break; + case GE_CANTOPENFILE: + fprintf(stdout, _("Failed to open vCalendar file \"%s\"\n"),argv[0]); + return -1; + case GE_TOOSHORT: + fprintf(stdout, _("Number of given calendar note is too high (max=%i)\n"),number); + return(-1); + default: + fprintf(stdout, _("Failed to parse vCalendar file \"%s\"\n"),argv[0]); + return -1; + } + + fbusinit(NULL); + + /* Put note into SMS structure */ + GSM_SaveCalendarNoteToSMS(&MultiSMS,&CalendarNote); + + for (w=0;wReset) GSM->Reset(_type); - if (GSM && GSM->Terminate) GSM->Terminate(); + number=atoi(argv[2]); + + if (number<1) { + fprintf(stdout, _("Number of calendar note must be 1 or higher\n")); + return -1; + } + + switch ( GSM_ReadVCalendarFile(argv[1], &CalendarNote, &number) ) { + case GE_NONE: + break; + case GE_CANTOPENFILE: + fprintf(stdout, _("Failed to open vCalendar file \"%s\"\n"),argv[1]); + return -1; + case GE_TOOSHORT: + fprintf(stdout, _("Number of given calendar note is too high (max=%i)\n"),number); + return(-1); + default: + fprintf(stdout, _("Failed to parse vCalendar file \"%s\"\n"),argv[1]); + return -1; + } + + fbusinit(NULL); + + /* Put note into SMS structure */ + GSM_SaveCalendarNoteToSMS(&MultiSMS,&CalendarNote); + + for (w=0;wGetSMSStatus(&SMSStatus) == GE_NONE) { + if (SMSStatus.Number!=0) { + + GetMachineDateTime(nowdate, nowtime ); + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile, _("%s %s SMS Messages: UnRead %d, Number %d\n"), + nowdate, nowtime, SMSStatus.UnRead, SMSStatus.Number); + fclose(logfile); + } + + read=0; + location=1; + + while (!bshutdown) { + + SMS.Location=location; + if (GSM->GetSMSMessage(&SMS)==GE_NONE) { + if (SMS.folder==0 || SMS.folder==0x08) { //GST_7110_INBOX + + GetMachineDateTime(nowdate, nowtime ); + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile,_("%s %s SMS on location %i\n"), + nowdate,nowtime,SMS.MessageNumber); + fclose(logfile); + } + + number= 16*(SMS.MessageText[2] >> 4)+ (SMS.MessageText[2] & 0x0f); + number=number+ 256*16*(SMS.MessageText[1] >> 4)+ 256*(SMS.MessageText[1] & 0x0f); + number=number+65536*16*(SMS.MessageText[0] >> 4)+65536*(SMS.MessageText[0] & 0x0f); + + sprintf( name, "%07i_%02d%02d%02d_%02d%02d%02d.sms", number, + SMS.Time.Year, SMS.Time.Month, SMS.Time.Day, + SMS.Time.Hour, SMS.Time.Minute, SMS.Time.Second); + + strcpy(filename,Dir); + strcat(filename,name); + + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile,_("%s %s Name is \"%s\"\n"),nowdate,nowtime,filename); + fclose(logfile); + } + + file = fopen(filename, "rb"); + if (!file) { + file = fopen(filename, "wb"); + if (!file) { + GetMachineDateTime(nowdate, nowtime ); + fprintf(stderr,_("%s %s ERROR: opening file \"%s\" failed !\n"),nowdate,nowtime,filename); + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile,_("%s %s ERROR: opening file \"%s\" failed !\n"),nowdate,nowtime,filename); + fclose(logfile); + } + } else { + fwrite(SMS.MessageText,1,SMS.Length,file); + fclose(file); + } + } else { + fclose(file); + + GetMachineDateTime(nowdate, nowtime ); + fprintf(stderr,_("%s %s ERROR: file \"%s\" already exist !\n"),nowdate,nowtime,filename); + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile,_("%s %s ERROR: file \"%s\" already exist !\n"),nowdate,nowtime,filename); + fclose(logfile); + } + } + + SMS.Location=SMS.MessageNumber; + if (GSM->DeleteSMSMessage(&SMS)!=GE_NONE) { + GetMachineDateTime(nowdate, nowtime ); + fprintf(stderr,_("%s %s ERROR: Deleting SMS location %i failed !\n"),nowdate,nowtime,SMS.MessageNumber); + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile,_("%s %s ERROR: Deleting SMS location %i failed !\n"),nowdate,nowtime,SMS.MessageNumber); + fclose(logfile); + } + } + } + read++; + } + location++; + if (read==SMSStatus.Number) break; + } + } + } else { + GetMachineDateTime(nowdate, nowtime ); + fprintf(stderr,_("%s %s ERROR: Can't get SMS status !\n"),nowdate,nowtime); + logfile = fopen("log", "a"); + if (logfile) { + fprintf(logfile,_("%s %s ERROR: Can't get SMS status !\n"),nowdate,nowtime); + fclose(logfile); + } + } + + sleep(1); + } + + fprintf (stderr, _("Leaving monitor mode...\n")); + + GSM->Terminate(); + + return 0; } -/* pmon allows fbus code to run in a passive state - it doesn't worry about - whether comms are established with the phone. A debugging/development - tool. */ -int pmon(void) -{ +int divert(int argc, char *argv[]) +{ + GSM_CallDivert cd; GSM_Error error; - GSM_ConnectionType connection=GCT_Serial; - GSM_Statemachine sm; - /* Initialise the code for the GSM interface. */ - error = GSM_Initialise(model, Port, Initlength, connection, NULL, &sm); + memset(&cd, 0, sizeof(GSM_CallDivert)); + + if (!strcmp("register", argv[0])){cd.Operation = GSM_CDV_Register ;} + else if (!strcmp("enable" , argv[0])){cd.Operation = GSM_CDV_Enable ;} + else if (!strcmp("disable" , argv[0])){cd.Operation = GSM_CDV_Disable ;} + else if (!strcmp("erasure" , argv[0])){cd.Operation = GSM_CDV_Erasure ;} + else if (!strcmp("query" , argv[0])){cd.Operation = GSM_CDV_Query ;} + else { + usage(); + exit(-1); + } - if (error != GE_NONE) { - fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); - return -1; + if (!strcmp("all" , argv[1])) {cd.DType = GSM_CDV_AllTypes ;} + else if (!strcmp("busy" , argv[1])) {cd.DType = GSM_CDV_Busy ;} + else if (!strcmp("noans" , argv[1])) {cd.DType = GSM_CDV_NoAnswer ;} + else if (!strcmp("outofreach", argv[1])) {cd.DType = GSM_CDV_OutOfReach;} + else { + usage(); + exit(-1); } - while (1) { - usleep(50000); + if (!strcmp("all" , argv[2])) {cd.CType = GSM_CDV_AllCalls ;} + else if (!strcmp("voice", argv[2])) {cd.CType = GSM_CDV_VoiceCalls;} + else if (!strcmp("fax" , argv[2])) {cd.CType = GSM_CDV_FaxCalls ;} + else if (!strcmp("data" , argv[2])) {cd.CType = GSM_CDV_DataCalls ;} + else { + usage(); + exit(-1); } + if (argc>3) strcpy(cd.Number, argv[3]); + + if (argc>4) cd.Timeout = atoi(argv[4]); + + /* Initialise the code for the GSM interface. */ + fbusinit(NULL); + + error=GSM->CallDivert(&cd); + + if (error == GE_NONE) { + switch (cd.Operation) + { + case GSM_CDV_Query: + fprintf(stdout, _("Divert type: ")); + switch (cd.DType) { + case GSM_CDV_Busy :fprintf(stdout, _("when busy"));break; + case GSM_CDV_NoAnswer :fprintf(stdout, _("when not answered"));break; + case GSM_CDV_OutOfReach:fprintf(stdout, _("when phone off or no coverage"));break; + case GSM_CDV_AllTypes :fprintf(stdout, _("all call diverts"));break; //? + default: fprintf(stdout, _("unknown %i"),cd.DType);break; + } + + fprintf(stdout, _("\nCalls type : ")); + switch (cd.CType) { + case GSM_CDV_VoiceCalls: fprintf(stdout, _("voice"));break; + case GSM_CDV_FaxCalls : fprintf(stdout, _("fax"));break; + case GSM_CDV_DataCalls : fprintf(stdout, _("data"));break; + case GSM_CDV_AllCalls : fprintf(stdout, _("voice, fax & data"));break; + default: fprintf(stdout, _("unknown %i"),cd.CType);break; + } + fprintf(stdout, _("\n")); + + if (cd.Enabled) { + fprintf(stdout, _("Status : active\n")); + fprintf(stdout, _("Timeout : %i seconds\n"),cd.Timeout); + fprintf(stdout, _("Number : %s\n"),cd.Number); + } else { + fprintf(stdout, _("Status : deactivated\n")); + } + + break; + default: + fprintf(stdout,_("Divert done\n")); + } + } else + fprintf(stderr,_("%s\n"),print_error(error)); + + GSM->Terminate(); + return 0; } -int sendringtone(int argc, char *argv[]) +int savephonebookentry(int argc, char *argv[]) { - GSM_Ringtone ringtone; - GSM_Error error; + GSM_MultiSMSMessage MultiSMS; + GSM_PhonebookEntry entry; + GSM_Error error; + int w; - if (GSM_ReadRingtoneFile(argv[0], &ringtone)) { - fprintf(stdout, _("Failed to load ringtone.\n")); - return(-1); - } + fbusinit(NULL); - if (GSM && GSM->SendRingtone) error = GSM->SendRingtone(&ringtone,argv[1]); + /* Handle command line args that set type, start and end locations. */ + if (!GetMemoryTypeID(argv[0], &entry.MemoryType)) + { + fprintf(stderr, _("Unknown memory type %s!\n"), argv[0]); + return (-1); + } - if (error == GE_NONE) - fprintf(stdout, _("Send succeeded!\n")); - else - fprintf(stdout, _("SMS Send failed (error=%d)\n"), error); + entry.Location=atoi(argv[1]); - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; -} + fbusinit(NULL); + error=GSM->GetMemoryLocation(&entry); -int setringtone(int argc, char *argv[]) -{ - GSM_Ringtone ringtone; - GSM_Error error; + switch (error) { + case GE_NONE: - if (GSM_ReadRingtoneFile(argv[0], &ringtone)) { - fprintf(stdout, _("Failed to load ringtone.\n")); - return(-1); - } + /* Put entry into SMS structure */ + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { + GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,21); + } else { + GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,10); + } - if (GSM && GSM->SetRingtone) error = GSM->SetRingtone(&ringtone); + for (w=0;wTerminate) GSM->Terminate(); - return 0; + default: + fprintf(stdout,_("Error\n"));break; + } + + return 0; } -int presskeysequence(void) +int sendphonebookentry(int argc, char *argv[]) { - char buf[105]; + GSM_MultiSMSMessage MultiSMS; + GSM_PhonebookEntry entry; + GSM_Error error; + int w; - console_raw(); + fbusinit(NULL); - memset(&buf[0], 0, 102); - while (read(0, buf, 100) > 0) { - fprintf(stderr, "handling keys (%d).\n", strlen(buf)); - if (GSM && GSM->HandleString && GSM->HandleString(buf) != GE_NONE) - fprintf(stdout, _("Key press simulation failed.\n")); - memset(buf, 0, 102); - } + /* Handle command line args that set type, start and end locations. */ + if (!GetMemoryTypeID(argv[1], &entry.MemoryType)) + { + fprintf(stderr, _("Unknown memory type %s!\n"), argv[1]); + return (-1); + } - if (GSM && GSM->Terminate) GSM->Terminate(); - return 0; -} + entry.Location=atoi(argv[2]); -/* Options for --divert: - --op, -o [register|enable|query|disable|erasure] REQ - --type, -t [all|busy|noans|outofreach|notavail] REQ - --call, -c [all|voice|fax|data] REQ - --timeout, m time_in_seconds OPT - --number, -n number OPT - */ -int divert(int argc, char **argv) -{ - int opt; - GSM_CallDivert cd; - GSM_Statemachine *sm = &State; - GSM_Data data; - GSM_Error error; - struct option options[] = { - { "op", required_argument, NULL, 'o'}, - { "type", required_argument, NULL, 't'}, - { "call", required_argument, NULL, 'c'}, - { "number", required_argument, NULL, 'n'}, - { "timeout", required_argument, NULL, 'm'}, - { NULL, 0, NULL, 0} - }; + fbusinit(NULL); - optarg = NULL; - optind = 0; + error=GSM->GetMemoryLocation(&entry); - /* Skip --divert */ - argc--; argv++; + switch (error) { + case GE_NONE: - memset(&cd, 0, sizeof(GSM_CallDivert)); + /* Put entry into SMS structure */ + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { + GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,21); + } else { + GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,10); + } - while ((opt = getopt_long(argc, argv, "o:t:n:c:m:", options, NULL)) != -1) { - switch (opt) { - case 'o': - if (!strcmp("register", optarg)) { - cd.Operation = GSM_CDV_Register; - } else if (!strcmp("enable", optarg)) { - cd.Operation = GSM_CDV_Enable; - } else if (!strcmp("disable", optarg)) { - cd.Operation = GSM_CDV_Disable; - } else if (!strcmp("erasure", optarg)) { - cd.Operation = GSM_CDV_Erasure; - } else if (!strcmp("query", optarg)) { - cd.Operation = GSM_CDV_Query; - } else { - usage(); - exit(-1); - } - break; - case 't': - if (!strcmp("all", optarg)) { - cd.DType = GSM_CDV_AllTypes; - } else if (!strcmp("busy", optarg)) { - cd.DType = GSM_CDV_Busy; - } else if (!strcmp("noans", optarg)) { - cd.DType = GSM_CDV_NoAnswer; - } else if (!strcmp("outofreach", optarg)) { - cd.DType = GSM_CDV_OutOfReach; - } else if (!strcmp("notavail", optarg)) { - cd.DType = GSM_CDV_NotAvailable; - } else { - usage(); - exit(-1); - } - break; - case 'c': - if (!strcmp("all", optarg)) { - cd.CType = GSM_CDV_AllCalls; - } else if (!strcmp("voice", optarg)) { - cd.CType = GSM_CDV_VoiceCalls; - } else if (!strcmp("fax", optarg)) { - cd.CType = GSM_CDV_FaxCalls; - } else if (!strcmp("data", optarg)) { - cd.CType = GSM_CDV_DataCalls; - } else { - usage(); - exit(-1); - } - break; - case 'm': - cd.Timeout = atoi(optarg); - break; - case 'n': - strcpy(cd.Number.number, optarg); - if (cd.Number.number[0] == '+') cd.Number.type = SMS_International; - else cd.Number.type = SMS_Unknown; - break; - default: - usage(); - exit(-1); - } - } - data.CallDivert = &cd; - error = SM_Functions(GOP_CallDivert, &data, sm); + for (w=0;w @@ -40,31 +22,28 @@ #include #include "misc.h" -#include "cfgreader.h" +#include "files/cfgreader.h" #include "gsm-common.h" #include "gsm-api.h" #include "data/virtmodem.h" - /* Global variables */ -bool DebugMode; /* When true, run in debug mode */ -char *Model; /* Model from .gnokiirc file. */ -char *Port; /* Serial port from .gnokiirc file */ -char *Initlength; /* Init length from .gnokiirc file */ -char *Connection; /* Connection type from .gnokiirc file */ -char *BinDir; /* Directory of the mgnokiidev command */ -bool TerminateThread; - -/* Local variables */ -char *DefaultConnection = "serial"; -char *DefaultBinDir = "/usr/local/sbin"; +bool DebugMode; /* When true, run in debug mode */ +char *Model; /* Model from .gnokiirc file. */ +char *Port; /* Port from .gnokiirc file */ +char *Initlength; /* Init length from .gnokiirc file */ +char *Connection; /* Connection type from .gnokiirc file */ +char *SynchronizeTime; +char *BinDir; /* Directory of the mgnokiidev command */ + +bool TerminateThread; void version(void) { - fprintf(stdout, _("gnokiid Version %s\n" -"Copyright (C) Hugh Blemings , 1999\n" -"Copyright (C) Pavel Janík ml. , 1999\n" + fprintf(stdout, _("gnokiid Version %s\n" +"Copyright (C) Hugh Blemings , 1999\n" +"Copyright (C) Pavel Janík ml. , 1999\n" "Built %s %s for %s on %s \n"), VERSION, __TIME__, __DATE__, Model, Port); } @@ -74,7 +53,7 @@ void version(void) void usage(void) { - fprintf(stdout, _(" usage: gnokiid {--help|--version}\n" + fprintf(stdout, _(" usage: gnokiid {--help|--version}\n" " --help display usage information." " --version displays version and copyright information." " --debug uses stdin/stdout for virtual modem comms.\n")); @@ -86,55 +65,64 @@ void usage(void) int main(int argc, char *argv[]) { - GSM_ConnectionType connection = GCT_Serial; + GSM_ConnectionType connection; + + /* For GNU gettext */ - /* For GNU gettext */ + #ifdef USE_NLS + textdomain("gnokii"); + #endif -#ifdef USE_NLS - textdomain("gnokii"); +#ifndef WIN32 + if (strcmp(GetMygnokiiVersion(),VERSION)!=0) + fprintf(stderr,_("WARNING: version of installed libmygnokii.so (%s) is different to version of gnokiid (%s)\n"),GetMygnokiiVersion(),VERSION); #endif - if (readconfig(&Model, &Port, &Initlength, &Connection, &BinDir) < 0) { + if (CFG_ReadConfig(&Model, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,true) < 0) { exit(-1); } - - /* Handle command line arguments. */ - - if (argc >= 2 && strcmp(argv[1], "--help") == 0) { - usage(); - exit(0); - } - - /* Display version, copyright and build information. */ - - if (argc >= 2 && strcmp(argv[1], "--version") == 0) { - version(); - exit(0); - } - - if (argc >= 2 && strcmp(argv[1], "--debug") == 0) { - DebugMode = true; - } else { - DebugMode = false; - } - - if (!strcmp(Connection, "infrared")) { - connection=GCT_Infrared; - } - - TerminateThread=false; - - if (VM_Initialise(Model, Port, Initlength, connection, BinDir, DebugMode, true) == false) { - exit (-1); - } - - while (1) { - if (TerminateThread==true) { - VM_Terminate(); - exit(1); - } - sleep (1); - } - exit (0); + /* Handle command line arguments. */ + + if (argc >= 2 && strcmp(argv[1], "--help") == 0) { + usage(); + exit(0); + } + + /* Display version, copyright and build information. */ + + if (argc >= 2 && strcmp(argv[1], "--version") == 0) { + version(); + exit(0); + } + + if (argc >= 2 && strcmp(argv[1], "--debug") == 0) { + DebugMode = true; + } + else { + DebugMode = false; + } + + connection=GetConnectionTypeFromString(Connection); + + /* MBUS wasn't tested */ + if (connection!=GCT_FBUS && connection!=GCT_MBUS && + connection!=GCT_Infrared && connection!=GCT_Tekram) { + fprintf(stdout,_("Incorrect connection type!\n")); + exit(0); + } + + TerminateThread=false; + + if (VM_Initialise(Model, Port, Initlength, connection, BinDir, DebugMode, true, SynchronizeTime) == false) + exit (-1); + + while (1) { + if (TerminateThread==true) { + VM_Terminate(); + exit(1); + } + sleep (1); + } + exit (0); } diff --git a/include/config.h.in.in b/include/config.h.in.in index cf4812f..a5dae23 100644 --- a/include/config.h.in.in +++ b/include/config.h.in.in @@ -6,22 +6,8 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:19 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.2 2001/06/20 22:34:45 pkot - Updated Debian packaging system (Erik Rossen) - Updated Makefiles to let packaging process be easier (Pawel Kot) - - Revision 1.1 2001/01/02 09:09:09 pkot - Misc fixes and updates. - - */ /* DO NOT EDIT MANUALLY !!! */ @@ -31,7 +17,7 @@ #define VERSION "@VERSION@" #define XVERSION "@XVERSION@" -#define XGNOKIIDIR "@XGNOKIIPATH@/@XPACKAGE@" +#define XGNOKIIDIR "@XGNOKIIDIR@/@XPACKAGE@" /* Define if you have timersub() */ #undef HAVE_TIMEOPS diff --git a/include/data/at-emulator.h b/include/data/at-emulator.h index 2048de6..3f95297 100644 --- a/include/data/at-emulator.h +++ b/include/data/at-emulator.h @@ -6,24 +6,10 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for AT emulator code. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:21 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.2 2001/07/03 15:27:24 pkot - AT commands for SMS handling support (Tamas Bondar) - Small at-emulator code cleanup (me) - - Revision 1.1 2001/02/21 19:57:11 chris - More fiddling with the directory layout - - */ #ifndef __data_at_emulator_h diff --git a/include/data/datapump.h b/include/data/datapump.h index c52ebc2..c1e48d1 100644 --- a/include/data/datapump.h +++ b/include/data/datapump.h @@ -6,20 +6,10 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for data pump code. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:21 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.1 2001/02/21 19:57:11 chris - More fiddling with the directory layout - - */ #ifndef __data_datapump_h diff --git a/include/data/rlp-common.h b/include/data/rlp-common.h index 31323eb..a03a497 100644 --- a/include/data/rlp-common.h +++ b/include/data/rlp-common.h @@ -6,37 +6,20 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. The development of RLP protocol is sponsored by SuSE CR, s.r.o. (Pavel use the SIM card from SuSE for testing purposes). - This file: rlp-common.h Version 0.3.1 - Header file for RLP protocol. - $Log$ - Revision 1.1.1.2 2001/11/27 22:01:28 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001 - - Revision 1.3 2001/11/27 12:19:01 pkot - Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me) - - Revision 1.2 2001/06/10 11:29:49 machek - It is very bad idea to name enum "Data", because it is then impossible - to use variable called "Data". - - Revision 1.1 2001/02/21 19:57:11 chris - More fiddling with the directory layout */ #ifndef __data_rlp_common_h #define __data_rlp_common_h #ifndef __misc_h -# include "misc.h" + #include "misc.h" #endif /* Global variables */ @@ -46,134 +29,148 @@ /* Data types */ /* Typedef for frame type - they are the same for RLP version 0, 1 and 2. */ + typedef enum { - RLPFT_X, /* Unknown. */ - RLPFT_U, /* Unnumbered frame. */ - RLPFT_S, /* Supervisory frame. */ - RLPFT_IS /* Information plus Supervisory (I+S) frame. */ + RLPFT_X, /* Unknown. */ + RLPFT_U, /* Unnumbered frame. */ + RLPFT_S, /* Supervisory frame. */ + RLPFT_IS /* Information plus Supervisory (I+S) frame. */ } RLP_FrameType; /* Define the various Unnumbered frame types. Numbering is bit reversed relative to ETSI GSM 04.22 for easy parsing. */ + typedef enum { - RLPU_SABM = 0x07, /* Set Asynchronous Balanced Mode. */ - RLPU_UA = 0x0c, /* Unnumbered Acknowledge. */ - RLPU_DISC = 0x08, /* Disconnect. */ - RLPU_DM = 0x03, /* Disconnected Mode. */ - RLPU_NULL = 0x0f, /* Null information. */ - RLPU_UI = 0x00, /* Unnumbered Information. */ - RLPU_XID = 0x17, /* Exchange Identification. */ - RLPU_TEST = 0x1c, /* Test. */ - RLPU_REMAP = 0x11 /* Remap. */ + RLPU_SABM = 0x07, /* Set Asynchronous Balanced Mode. */ + RLPU_UA = 0x0c, /* Unnumbered Acknowledge. */ + RLPU_DISC = 0x08, /* Disconnect. */ + RLPU_DM = 0x03, /* Disconnected Mode. */ + RLPU_NULL = 0x0f, /* Null information. */ + RLPU_UI = 0x00, /* Unnumbered Information. */ + RLPU_XID = 0x17, /* Exchange Identification. */ + RLPU_TEST = 0x1c, /* Test. */ + RLPU_REMAP = 0x11 /* Remap. */ } RLP_UFrameType; /* Define supervisory frame field. */ + typedef enum { - RLPS_RR = 0x00, /* Receive Ready. */ - RLPS_REJ = 0x02, /* Reject. */ - RLPS_RNR = 0x01, /* Receive Not Ready. */ - RLPS_SREJ = 0x03 /* Selective Reject. */ + RLPS_RR = 0x00, /* Receive Ready. */ + RLPS_REJ = 0x02, /* Reject. */ + RLPS_RNR = 0x01, /* Receive Not Ready. */ + RLPS_SREJ = 0x03 /* Selective Reject. */ } RLP_SFrameField; /* Used for CurrentFrameType. */ + typedef enum { - RLPFT_U_SABM = 0x00, - RLPFT_U_UA, - RLPFT_U_DISC, - RLPFT_U_DM, - RLPFT_U_NULL, - RLPFT_U_UI, - RLPFT_U_XID, - RLPFT_U_TEST, - RLPFT_U_REMAP, - RLPFT_S_RR, - RLPFT_S_REJ, - RLPFT_S_RNR, - RLPFT_S_SREJ, - RLPFT_SI_RR, - RLPFT_SI_REJ, - RLPFT_SI_RNR, - RLPFT_SI_SREJ, - RLPFT_BAD + RLPFT_U_SABM = 0x00, + RLPFT_U_UA, + RLPFT_U_DISC, + RLPFT_U_DM, + RLPFT_U_NULL, + RLPFT_U_UI, + RLPFT_U_XID, + RLPFT_U_TEST, + RLPFT_U_REMAP, + RLPFT_S_RR, + RLPFT_S_REJ, + RLPFT_S_RNR, + RLPFT_S_SREJ, + RLPFT_SI_RR, + RLPFT_SI_REJ, + RLPFT_SI_RNR, + RLPFT_SI_SREJ, + RLPFT_BAD } RLP_FrameTypes; /* Frame definition for TCH/F9.6 frame. */ + typedef struct { - u8 Header[2]; - u8 Data[25]; - u8 FCS[3]; + u8 Header[2]; + u8 Data[25]; + u8 FCS[3]; } RLP_F96Frame; /* Header data "split up" for TCH/F9.6 frame. */ + typedef struct { - u8 Ns; /* Send sequence number. */ - u8 Nr; /* Receive sequence number. */ - u8 M; /* Unumbered frame type. */ - u8 S; /* Status. */ - bool PF; /* Poll/Final. */ - bool CR; /* Command/Response. */ - RLP_FrameType Type; /* Frame type. */ + u8 Ns; /* Send sequence number. */ + u8 Nr; /* Receive sequence number. */ + u8 M; /* Unumbered frame type. */ + u8 S; /* Status. */ + bool PF; /* Poll/Final. */ + bool CR; /* Command/Response. */ + RLP_FrameType Type; /* Frame type. */ } RLP_F96Header; /* RLP User requests */ + typedef struct { - bool Conn_Req; - bool Attach_Req; - bool Conn_Req_Neg; - bool Reset_Resp; - bool Disc_Req; + bool Conn_Req; + bool Attach_Req; + bool Conn_Req_Neg; + bool Reset_Resp; + bool Disc_Req; } RLP_UserRequestStore; typedef enum { - Conn_Req, - Attach_Req, - Conn_Req_Neg, - Reset_Resp, - Disc_Req + Conn_Req, + Attach_Req, + Conn_Req_Neg, + Reset_Resp, + Disc_Req } RLP_UserRequests; typedef enum { - Conn_Ind, - Conn_Conf, - Disc_Ind, - Reset_Ind, - Data, /* FIXME: This should really be called RLP_Data, otherwise it hogs name "Data"! */ - StatusChange, - GetData + Conn_Ind, + Conn_Conf, + Disc_Ind, + Reset_Ind, + Data, /* FIXME: This should really be called RLP_Data, otherwise it hogs name "Data"! */ + StatusChange, + GetData } RLP_UserInds; /* RLP (main) states. See GSM specification 04.22 Annex A, Section A.1.1. */ + typedef enum { - RLP_S0, /* ADM and Detached */ - RLP_S1, /* ADM and Attached */ - RLP_S2, /* Pending Connect Request */ - RLP_S3, /* Pending Connect Indication */ - RLP_S4, /* ABM and Connection Established */ - RLP_S5, /* Disconnect Initiated */ - RLP_S6, /* Pending Reset Request */ - RLP_S7, /* Pending Reset Indication */ - RLP_S8 /* Error */ + RLP_S0, /* ADM and Detached */ + RLP_S1, /* ADM and Attached */ + RLP_S2, /* Pending Connect Request */ + RLP_S3, /* Pending Connect Indication */ + RLP_S4, /* ABM and Connection Established */ + RLP_S5, /* Disconnect Initiated */ + RLP_S6, /* Pending Reset Request */ + RLP_S7, /* Pending Reset Indication */ + RLP_S8 /* Error */ } RLP_State; /* RLP specification defines several states in which variables can be. */ + typedef enum { - _idle=0, - _send, - _wait, - _rcvd, - _ackn, - _rej, - _srej + _idle=0, + _send, + _wait, + _rcvd, + _ackn, + _rej, + _srej } RLP_StateVariable; + /* RLP Data */ + typedef struct { - u8 Data[25]; - RLP_StateVariable State; + u8 Data[25]; + RLP_StateVariable State; } RLP_Data; + + /* Prototypes for functions. */ + void RLP_DisplayF96Frame(RLP_F96Frame *frame); void RLP_DecodeF96Header(RLP_F96Frame *frame, RLP_F96Header *header); void RLP_DisplayXID(u8 *frame); diff --git a/include/data/rlp-crc24.h b/include/data/rlp-crc24.h index 121caff..6789510 100644 --- a/include/data/rlp-crc24.h +++ b/include/data/rlp-crc24.h @@ -6,32 +6,17 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. - This file: rlp-crc24.h Version 0.3.1 - Header file for CRC24 (aka FCS) implementation in RLP. - $Log$ - Revision 1.1.1.2 2001/11/27 22:01:28 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001 - - Revision 1.2 2001/11/27 12:19:01 pkot - Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me) - - Revision 1.1 2001/02/21 19:57:11 chris - More fiddling with the directory layout - - */ #ifndef __data_rlp_crc24_h #define __data_rlp_crc24_h #ifndef __misc_h -# include "misc.h" + #include "misc.h" #endif /* Prototypes for functions */ diff --git a/include/data/virtmodem.h b/include/data/virtmodem.h index 456f880..6fe838d 100644 --- a/include/data/virtmodem.h +++ b/include/data/virtmodem.h @@ -1,29 +1,17 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for virtmodem code in virtmodem.c - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:21 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.1 2001/02/21 19:57:11 chris - More fiddling with the directory layout - - */ -#ifndef __data_virtmodem_h -#define __data_virtmodem_h +#ifndef __virtmodem_h +#define __virtmodem_h /* Prototypes */ @@ -33,7 +21,8 @@ bool VM_Initialise(char *model, GSM_ConnectionType connection, char *bindir, bool debug_mode, - bool GSM_Init); + bool GSM_Init, + char *synchronizetime); int VM_PtySetup(char *bindir); void VM_ThreadLoop(void); void VM_CharHandler(void); @@ -42,6 +31,7 @@ void VM_Terminate(void); GSM_Error VM_GSMInitialise(char *model, char *port, char *initlength, - GSM_ConnectionType connection); + GSM_ConnectionType connection, + char *synchronizetime); #endif /* __virtmodem_h */ diff --git a/include/devices/tekram.h b/include/devices/tekram.h index f4cf441..36dfaf0 100644 --- a/include/devices/tekram.h +++ b/include/devices/tekram.h @@ -6,9 +6,6 @@ * * A Linux/Unix toolset and driver for Nokia mobile phones. * - * Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - * Copyright (C) 2000-2001 Marcel Holtmann - * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -23,35 +20,23 @@ * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Log$ - * Revision 1.1.1.2 2001/11/27 22:01:28 short - * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001 - * - * Revision 1.2 2001/11/27 12:19:01 pkot - * Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me) - * - * Revision 1.1 2001/02/21 19:57:11 chris - * More fiddling with the directory layout - * - * Revision 1.1 2001/02/09 18:12:54 chris - * Marcel's tekram support - * */ #ifndef __devices_tekram_h #define __devices_tekram_h #ifdef WIN32 -# include + #include /* FIXME: this should be solved in config.h in 0.4.0 */ -# define __const const - typedef void * __ptr_t; + #define __const const + typedef void * __ptr_t; #else -# include + #include #endif /* WIN32 */ #include "misc.h" + #define TEKRAM_B115200 0x00 #define TEKRAM_B57600 0x01 #define TEKRAM_B38400 0x02 @@ -60,6 +45,7 @@ #define TEKRAM_PW 0x10 /* Pulse select bit */ + int tekram_open(__const char *__file); void tekram_close(int __fd); @@ -72,3 +58,7 @@ size_t tekram_write(int __fd, __const __ptr_t __buf, size_t __n); int tekram_select(int fd, struct timeval *timeout); #endif /* __devices_tekram_h */ + + + + diff --git a/include/devices/unixirda.h b/include/devices/unixirda.h index d08c132..a852f39 100644 --- a/include/devices/unixirda.h +++ b/include/devices/unixirda.h @@ -5,9 +5,6 @@ * * A Linux/Unix toolset and driver for Nokia mobile phones. * - * Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - * Copyright (C) 2000-2001 Marcel Holtmann - * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -22,34 +19,8 @@ * License along with this library; if not, write to the Free * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Log$ - * Revision 1.1.1.1 2001/11/25 21:59:21 short - * :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - * - * Revision 1.2 2001/11/08 16:49:20 pkot - * Cleanups - * - * Revision 1.1 2001/02/21 19:57:11 chris - * More fiddling with the directory layout - * - * Revision 1.4 2001/02/20 21:55:12 pkot - * Small #include updates - * - * Revision 1.3 2001/02/06 21:15:37 chris - * Preliminary irda support for 7110 etc. Not well tested! - * - * Revision 1.2 2001/02/06 15:15:25 pkot - * FreeBSD unixirda.h fix (Panagiotis Astithas) - * - * Revision 1.1 2001/02/03 23:56:18 chris - * Start of work on irda support (now we just need fbus-irda.c!) - * Proper unicode support in 7110 code (from pkot) - * */ -#ifndef __unix_irda_h_ -#define __unix_irda_h_ - #include #include #include @@ -57,6 +28,7 @@ #include #include #include +#include #include #include "linuxirda.h" @@ -67,5 +39,3 @@ int irda_close(int fd); int irda_write(int __fd, __const __ptr_t __bytes, int __size); int irda_read(int __fd, __ptr_t __bytes, int __size); int irda_select(int fd, struct timeval *timeout); - -#endif diff --git a/include/devices/unixserial.h b/include/devices/unixserial.h index 1d098bd..b044d43 100644 --- a/include/devices/unixserial.h +++ b/include/devices/unixserial.h @@ -6,35 +6,20 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. - $Log$ - Revision 1.1.1.2 2001/11/27 22:01:28 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001 - - Revision 1.3 2001/11/27 12:19:01 pkot - Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me) - - Revision 1.2 2001/08/20 23:27:37 pkot - Add hardware shakehand to the link layer (Manfred Jonsson) - - Revision 1.1 2001/02/21 19:57:12 chris - More fiddling with the directory layout - */ #ifndef __devices_unixserial_h #define __devices_unixserial_h #ifdef WIN32 -# include + #include /* FIXME: this should be solved in config.h in 0.4.0 */ -# define __const const - typedef void * __ptr_t; + #define __const const + typedef void * __ptr_t; #else -# include + #include #endif /* WIN32 */ #include "misc.h" @@ -53,3 +38,7 @@ size_t serial_write(int __fd, __const __ptr_t __buf, size_t __n); int serial_select(int fd, struct timeval *timeout); #endif /* __devices_unixserial_h */ + + + + diff --git a/include/gsm-api.h b/include/gsm-api.h index be82e64..0ab7718 100644 --- a/include/gsm-api.h +++ b/include/gsm-api.h @@ -1,60 +1,542 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for the various functions, definitions etc. used to implement the handset interface. See gsm-api.c for more details. - $Log$ - Revision 1.1.1.2 2001/11/27 22:01:26 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001 +*/ - Revision 1.15 2001/11/27 12:19:01 pkot - Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me) +#ifndef __gsm_api_h +#define __gsm_api_h + +#include "misc.h" +#include "gsm-common.h" +#include "data/rlp-common.h" +#include "devices/device.h" +#include "gsm-phonebook.h" +#include "gsm-networks.h" +#include "gsm-bitmaps.h" +#include "gsm-datetime.h" +#include "gsm-calendar.h" +#include "gsm-sms.h" +#include "gsm-ringtones.h" +#include "gsm-wap.h" - Revision 1.14 2001/06/28 00:28:45 pkot - Small docs updates (Pawel Kot) +/* Undefined functions in fbus/mbus files */ +extern GSM_Error Unimplemented(void); +#define UNIMPLEMENTED (void *) Unimplemented +extern GSM_Error NotSupported(void); +#define NOTSUPPORTED (void *) NotSupported +/* Define the structure used to hold pointers to the various API functions. + This is in effect the master list of functions provided by the gnokii API. + Modules containing the model specific code each contain one of these + structures which is "filled in" with the corresponding function within the + model specific code. If a function is not supported or not implemented, a + generic not implemented function is used to return a GE_NOTIMPLEMENTED + error code. */ -*/ +typedef struct { -#ifndef __gsm_api_h -#define __gsm_api_h + /* FIXME: comment this. */ + + GSM_Error (*Initialise)( char *port_device, char *initlength, + GSM_ConnectionType connection, + void (*rlp_callback)(RLP_F96Frame *frame)); + + void (*DispatchMessage) (u16 MessageLength, u8 *MessageBuffer, u8 MessageType); + + void (*Terminate)(void); + + void (*KeepAlive)(void); + + GSM_Error (*GetMemoryLocation)( GSM_PhonebookEntry *entry ); + + GSM_Error (*WritePhonebookLocation)( GSM_PhonebookEntry *entry ); + + GSM_Error (*GetSpeedDial)( GSM_SpeedDial *entry); + + GSM_Error (*SetSpeedDial)( GSM_SpeedDial *entry); + + GSM_Error (*GetMemoryStatus)( GSM_MemoryStatus *Status); + + GSM_Error (*GetSMSStatus)( GSM_SMSStatus *Status); + + GSM_Error (*GetSMSCenter)( GSM_MessageCenter *MessageCenter ); + + GSM_Error (*SetSMSCenter)( GSM_MessageCenter *MessageCenter ); + + GSM_Error (*GetSMSMessage)( GSM_SMSMessage *Message ); + + GSM_Error (*DeleteSMSMessage)( GSM_SMSMessage *Message ); + + GSM_Error (*SendSMSMessage)( GSM_SMSMessage *Message); + + GSM_Error (*SaveSMSMessage)( GSM_SMSMessage *Message); + + /* If units is set to a valid GSM_RFUnits value, the code + will return level in these units if it is able. Otherwise + value will be returned as GRF_Arbitary. If phone doesn't + support GetRFLevel, function returns GE_NOTSUPPORTED */ + GSM_Error (*GetRFLevel)( GSM_RFUnits *units, float *level ); + + /* Works the same as GetRFLevel, except returns battery + level if known. */ + GSM_Error (*GetBatteryLevel)( GSM_BatteryUnits *units, float *level ); + + GSM_Error (*GetPowerSource)( GSM_PowerSource *source); + + GSM_Error (*GetDisplayStatus)( int *Status); + + GSM_Error (*EnterSecurityCode)( GSM_SecurityCode Code); + + GSM_Error (*GetSecurityCodeStatus)( int *Status ); + + GSM_Error (*GetSecurityCode)( GSM_SecurityCode *Code); + + GSM_Error (*GetIMEI)( char *imei ); + + GSM_Error (*GetRevision)( char *revision ); + + GSM_Error (*GetModel)( char *model ); + + GSM_Error (*GetDateTime)( GSM_DateTime *date_time); + + GSM_Error (*SetDateTime)( GSM_DateTime *date_time); + + GSM_Error (*GetAlarm)( int alarm_number, GSM_DateTime *date_time ); + + GSM_Error (*SetAlarm)( int alarm_number, GSM_DateTime *date_time ); + + GSM_Error (*DialVoice)( char *Number); + + GSM_Error (*DialData)( char *Number, char type, void (* callpassup)(char c)); + + GSM_Error (*GetIncomingCallNr)( char *Number ); + + GSM_Error (*GetNetworkInfo) ( GSM_NetworkInfo *NetworkInfo ); + + GSM_Error (*GetCalendarNote) ( GSM_CalendarNote *CalendarNote); + + GSM_Error (*WriteCalendarNote) ( GSM_CalendarNote *CalendarNote); + + GSM_Error (*DeleteCalendarNote) ( GSM_CalendarNote *CalendarNote); + + GSM_Error (*NetMonitor) ( unsigned char mode, char *Screen ); + + GSM_Error (*SendDTMF) ( char *String ); + + GSM_Error (*GetBitmap) ( GSM_Bitmap *Bitmap ); + + GSM_Error (*SetBitmap) ( GSM_Bitmap *Bitmap ); + + GSM_Error (*SetRingtone) ( GSM_Ringtone *ringtone , int *maxlength); + + GSM_Error (*SetBinRingtone) ( GSM_BinRingtone *ringtone); + + GSM_Error (*GetBinRingtone) ( GSM_BinRingtone *ringtone); + + GSM_Error (*Reset) ( unsigned char type ); + + GSM_Error (*GetProfile) ( GSM_Profile *Profile ); + + GSM_Error (*SetProfile) ( GSM_Profile *Profile ); + + bool (*SendRLPFrame) ( RLP_F96Frame *frame, bool out_dtx ); + + GSM_Error (*CancelCall) (); + + GSM_Error (*PressKey) (int key, int event); + + GSM_Error (*EnableDisplayOutput) (); + + GSM_Error (*DisableDisplayOutput) (); + + GSM_Error (*EnableCellBroadcast) (); + + GSM_Error (*DisableCellBroadcast) (); + + GSM_Error (*ReadCellBroadcast) ( GSM_CBMessage *Message ); + + GSM_Error (*PlayTone) (int Herz, u8 Volume); + + GSM_Error (*GetProductProfileSetting) ( GSM_PPS *PPS); + + GSM_Error (*SetProductProfileSetting) ( GSM_PPS *PPS); + + GSM_Error (*GetOperatorName) ( GSM_Network *operator); + + GSM_Error (*SetOperatorName) ( GSM_Network *operator); + + GSM_Error (*GetVoiceMailbox) ( GSM_PhonebookEntry *entry); + + GSM_Error (*PhoneTests) (); + + GSM_Error (*SimlockInfo) ( GSM_AllSimlocks *siml); + + GSM_Error (*GetCalendarNotesInfo) (GSM_NotesInfo *NotesInfo); + + GSM_Error (*GetSMSFolders) ( GSM_SMSFolders *folders); + + GSM_Error (*ResetPhoneSettings) (); + + GSM_Error (*GetWAPBookmark) ( GSM_WAPBookmark *bookmark); + + GSM_Error (*SetWAPBookmark) ( GSM_WAPBookmark *bookmark); + + GSM_Error (*GetWAPSettings) ( GSM_WAPSettings *settings); + + GSM_Error (*CallDivert) ( GSM_CallDivert *cd ); + + GSM_Error (*AnswerCall) (char s); + + GSM_Error (*GetManufacturer)( char *manufacturer ); + +} GSM_Functions; + +typedef struct { + + /* FIXME: comment this. */ + + GSM_Error (*Initialise)( char *port_device, char *initlength, + GSM_ConnectionType connection, + void (*rlp_callback)(RLP_F96Frame *frame)); + + int (*SendMessage) (u16 message_length, u8 message_type, u8 *buffer); + + int (*SendFrame) (u16 message_length, u8 message_type, u8 *buffer); + + int (*WritePhone) (u16 length, u8 *buffer); + + void (*Terminate)(void); + + void (*StateMachine)(unsigned char rx_byte); + +} GSM_Protocol; + +/* This structure is provided to allow common information about the particular + model to be looked up in a model independant way. Some of the values here + define minimum and maximum levels for values retrieved by the various Get + functions for example battery level. They are not defined as constants to + allow model specific code to set them during initialisation */ + +typedef struct { + + char *FBUSModels; /* Models covered by this type, pipe '|' delimited. */ + + char *MBUSModels; /* Models covered by this type, pipe '|' delimited. */ -/* If gsm-common.h isn't included at this point, little in this file will make - sense so we include it here if required. */ + char *InfraredModels; /* Models covered by this type, pipe '|' delimited. */ + + char *DLR3Models; /* Models covered by this type, pipe '|' delimited. */ -#ifndef __gsm_common_h -# include "gsm-common.h" -#endif + char *ATModels; /* Models covered by this type, pipe '|' delimited. */ -/* Ditto rlp_common.h... */ -#ifndef __data_rlp_common_h -# include "data/rlp-common.h" -#endif + char *IrdaModels; /* Models covered by this type, pipe '|' delimited. */ -#include "gsm-statemachine.h" + char *TekramModels; /* Models covered by this type, pipe '|' delimited. */ + +/* Minimum and maximum levels for RF signal strength. Units are as per the + setting of RFLevelUnits. The setting of RFLevelUnits indicates the + default or "native" units used. In the case of the 3110 and 6110 series + these are arbitrary, ranging from 0 to 4. */ + + float MaxRFLevel; + float MinRFLevel; + GSM_RFUnits RFLevelUnits; + +/* Minimum and maximum levels for battery level. Again, units are as per the + setting of GSM_BatteryLevelUnits. The value that BatteryLevelUnits is set + to indicates the "native" or default value that the phone supports. In the + case of the 3110 and 6110 series these are arbitrary, ranging from 0 to 4. */ + + float MaxBatteryLevel; + float MinBatteryLevel; + GSM_BatteryUnits BatteryLevelUnits; + +/* Information about date, time and alarm support. In case of alarm + information we provide value for the number of alarms supported. */ + + GSM_DateTimeSupport DateTimeSupport; + GSM_DateTimeSupport AlarmSupport; + int MaximumAlarms; +} GSM_Information; + +void NULL_Terminate(void); +void NULL_KeepAlive(); +bool NULL_WritePhone (u16 length, u8 *buffer); +void NULL_TX_DisplayMessage(u16 MessageLength, u8 *MessageBuffer); + +GSM_Error NULL_WaitUntil (int time, GSM_Error *value); +GSM_Error NULL_SendMessageSequence (int time, GSM_Error *value, + u16 message_length, u8 message_type, u8 *buffer); + +GSM_ConnectionType GetConnectionTypeFromString(char *Connection); + +bool GetMemoryTypeString(char *memorytext, GSM_MemoryType *type); +bool GetMemoryTypeID(char *memorytext, GSM_MemoryType *type); /* Define these as externs so that app code can pick them up. */ extern bool *GSM_LinkOK; extern GSM_Information *GSM_Info; extern GSM_Functions *GSM; -extern GSM_Error (*GSM_F)(GSM_Operation op, GSM_Data *data, GSM_Statemachine *state); +extern GSM_Protocol *Protocol; + +GSM_PhonebookEntry *CurrentPhonebookEntry; +GSM_Error CurrentPhonebookError; + +GSM_SpeedDial *CurrentSpeedDialEntry; +GSM_Error CurrentSpeedDialError; + +unsigned char Current_IMEI[GSM_MAX_IMEI_LENGTH]; +unsigned char Current_Revision[GSM_MAX_REVISION_LENGTH]; +unsigned char Current_Model[GSM_MAX_MODEL_LENGTH]; + +GSM_SMSMessage *CurrentSMSMessage; +GSM_Error CurrentSMSMessageError; +int CurrentSMSPointer; + +GSM_SMSFolders *CurrentSMSFolders; +GSM_Error CurrentSMSFoldersError; +int CurrentSMSFoldersCount; + +GSM_OneSMSFolder CurrentSMSFolder; +GSM_Error CurrentSMSFolderError; +int CurrentSMSFolderID; + +GSM_MemoryStatus *CurrentMemoryStatus; +GSM_Error CurrentMemoryStatusError; + +GSM_NetworkInfo *CurrentNetworkInfo; +GSM_Error CurrentNetworkInfoError; + +GSM_SMSStatus *CurrentSMSStatus; +GSM_Error CurrentSMSStatusError; + +GSM_MessageCenter *CurrentMessageCenter; +GSM_Error CurrentMessageCenterError; + +int *CurrentSecurityCodeStatus; +GSM_Error CurrentSecurityCodeError; +GSM_SecurityCode *CurrentSecurityCode; + +GSM_DateTime *CurrentDateTime; +GSM_Error CurrentDateTimeError; + +GSM_Error CurrentResetPhoneSettingsError; + +GSM_DateTime *CurrentAlarm; +GSM_Error CurrentAlarmError; + +GSM_CalendarNote *CurrentCalendarNote; +GSM_Error CurrentCalendarNoteError; + +GSM_NotesInfo CurrentCalendarNotesInfo,*CurrentCalendarNotesInfo2; +GSM_Error CurrentCalendarNotesInfoError; + +int *CurrentFirstCalendarFreePos; +GSM_Error CurrentFirstCalendarFreePosError; + +GSM_Error CurrentSetDateTimeError; +GSM_Error CurrentSetAlarmError; + +GSM_Error CurrentEnableExtendedCommandsError; + +int CurrentRFLevel, + CurrentBatteryLevel, + CurrentPowerSource; + +int CurrentDisplayStatus; +GSM_Error CurrentDisplayStatusError; + +char *CurrentNetmonitor; +GSM_Error CurrentNetmonitorError; + +GSM_Bitmap *CurrentGetBitmap; +GSM_Error CurrentGetBitmapError; + +GSM_Error CurrentSetBitmapError; + +GSM_Error CurrentSendDTMFError; + +GSM_Profile *CurrentProfile; +GSM_Error CurrentProfileError; + +GSM_Error CurrentDisplayOutputError; + +GSM_CBMessage *CurrentCBMessage; +GSM_Error CurrentCBError; + +int CurrentPressKeyEvent; +GSM_Error CurrentPressKeyError; + +GSM_Error CurrentPlayToneError; + +GSM_Error CurrentDialVoiceError; + +GSM_Error CurrentGetOperatorNameError; +GSM_Network *CurrentGetOperatorNameNetwork; +GSM_Error CurrentSetOperatorNameError; + +GSM_Error CurrentGetIMEIError; + +GSM_Error CurrentGetHWError; + +unsigned char CurrentPPS[4]; +GSM_Error CurrentProductProfileSettingsError; + +char CurrentIncomingCall[20]; + +GSM_Error CurrentBinRingtoneError; +GSM_BinRingtone *CurrentGetBinRingtone; + +GSM_Error CurrentRingtoneError; + +GSM_Error CurrentMagicError; + +GSM_Error CurrentSimlockInfoError; +GSM_AllSimlocks *CurrentSimLock; + +GSM_Error CurrentGetWAPBookmarkError; +GSM_Error CurrentSetWAPBookmarkError; +GSM_WAPBookmark *WAPBookmark; + +GSM_Error CurrentGetWAPSettingsError; +GSM_WAPSettings *WAPSettings; + +GSM_Error CurrentCallDivertError; +GSM_CallDivert *CurrentCallDivert; + +char *CurrentManufacturer; + +/* This is the connection type used in gnokii. */ +GSM_ConnectionType CurrentConnectionType; + +/* Pointer to a callback function used to return changes to a calls status */ +/* This saves unreliable polling */ +void (*CurrentCallPassup)(char c); + +/* Pointer to callback function in user code to be called when RLP frames + are received. */ +void (*CurrentRLP_RXCallback)(RLP_F96Frame *frame); + +/* Used to disconnect the call */ +u8 CurrentCallSequenceNumber; + +bool CurrentLinkOK; + +bool CurrentRequestTerminate; + +bool CurrentDisableKeepAlive; /* Prototype for the functions actually provided by gsm-api.c. */ -GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_handler)(RLP_F96Frame *frame), GSM_Statemachine *sm); +GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_callback)(RLP_F96Frame *frame), char* SynchronizeTime); + +bool CheckModel (GSM_Information InfoToCheck, char *model, GSM_ConnectionType connection); + +char *GetMygnokiiVersion(); + +typedef enum { + F_CAL61=0,/*Calendar in 6110 style - 4 types,...*/ + F_CAL33, /*Calendar in 3310 style - 10 reminders, Unicode, 3 coding types*/ + F_CAL71, /*Calendar in 7110 style - 4 types, recurrance, etc.*/ + + F_PBK33, /*Phonebook in Unicode. 3310 style - name and entry*/ + F_PBK71, /*Extended phonebook - multiple numbers,Unicode.Like in 7110*/ + + F_DATA61, /*We can make data calls using gnokiid. Like in 6110*/ + F_DATA71, /*Datacalls using AT commands*/ + + F_SMS, /*SMS with Inbox, Outbox*/ + F_SMS71, /*SMS with SMS folders like in 7110*/ + + F_AUTH, /*We can make authentication and have "Accessory connected" like in 6110*/ + F_NETMON, /*Netmonitor available*/ /*10*/ + F_CALER61,/*Caller groups in 6110 style - 5 groups with members*/ + F_KEYB, /*We can press keys*/ + F_SMSCDEF,/*SMSC can have default recipient*/ + F_SPEED, /*We can handle speed dials*/ + F_SCRSAV, /*We have screen savers*/ + F_DTMF, /*We can handle DTMF sequences*/ + F_NOPOWER,/*We must get power/battery info from netmonitor*/ + + F_STANIM, /*Startup logo animated or static*/ + F_STA , /*Startup logo static*/ + F_STA62 , /*Startup logo static size 6210*/ /*20*/ + F_STA71 , /*Startup logo static size 7110*/ + + F_PROF61, /*Profiles numbered like in N6110*/ + F_PROF51, /*Profiles numbered like in N5110*/ + F_PROF33, /*Profiles numbered like in N3310.Unicode names*/ + + F_RING_SM,/*Binary ringtone in Smart Messaging*/ + F_RINGBIN,/*Binary ringtone in binary format*/ + + F_WAP /*WAP functions available*/ +} feat_index; + +typedef enum { + FN_CALENDAR=0, + FN_NETMONITOR, + FN_CALLERGROUPS, + FN_PHONEBOOK, + FN_AUTHENTICATION, + FN_DATACALLS, + FN_KEYPRESS, + FN_SMSCDEFAULT, + FN_SPEEDDIAL, + FN_SCREENSAVER, + FN_DTMF, /*10*/ + FN_SMS, + FN_NOPOWERFRAME, + FN_STARTUP, + FN_PROFILES, + FN_RINGTONES, + FN_WAP +} featnum_index; + +/* For models table */ +typedef struct { + char *model; + char *number; + feat_index features[17]; +} OnePhoneModel; + +extern char *GetModelName (); +int GetModelFeature (featnum_index num); + +extern bool AppendLog(u8 *buffer, int length,bool format); +extern bool AppendLogText(u8 *buffer,bool format); + +typedef struct { + int SIMPhonebookUsed; + int SIMPhonebookSize; + GSM_PhonebookEntry SIMPhonebook[250]; + + int PhonePhonebookUsed; + int PhonePhonebookSize; + GSM_PhonebookEntry PhonePhonebook[500]; + + bool CallerAvailable; + GSM_Bitmap CallerGroups[5]; + + bool SpeedAvailable; + GSM_SpeedDial SpeedDials[8]; + + bool OperatorLogoAvailable; + GSM_Bitmap OperatorLogo; + + bool StartupLogoAvailable; + GSM_Bitmap StartupLogo; -/* All the rest of the API functions are contained in the GSM_Function - structure which ultimately points into the model specific code. */ + GSM_Bitmap StartupText; +} GSM_Backup; #endif /* __gsm_api_h */ diff --git a/include/gsm-bitmaps.h b/include/gsm-bitmaps.h index b0b7628..f65acc2 100644 --- a/include/gsm-bitmaps.h +++ b/include/gsm-bitmaps.h @@ -1,48 +1,59 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. - Functions for common bitmap operations. - - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:19 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.4 2001/11/20 16:22:22 pkot - First attempt to read Picture Messages. They should appear when you enable DEBUG. Nokia seems to break own standards. :/ (Markus Plail) - - Revision 1.3 2001/06/28 00:28:45 pkot - Small docs updates (Pawel Kot) - + Functions for manipulating bitmaps */ -#ifndef __gsm_bitmaps_h__ -#define __gsm_bitmaps_h__ +#ifndef __gsm_bitmaps_h +#define __gsm_bitmaps_h + +#include "gsm-sms.h" + +/* Bitmap types. */ +typedef enum { + GSM_None=0, + GSM_StartupLogo, /*size 84*48*/ + GSM_OperatorLogo, /*size 72*14*/ + GSM_CallerLogo, /*size 72*14*/ + GSM_PictureImage, /*size 72*28*/ + GSM_7110OperatorLogo, /*size 78*21*/ + GSM_7110StartupLogo, /*size 96*65*/ + GSM_6210StartupLogo, /*size 96*60*/ + GSM_WelcomeNoteText, + GSM_DealerNoteText +} GSM_Bitmap_Types; + +#define MAX_BITMAP_TEXT_LENGTH 256 + +/* Structure to hold incoming/outgoing bitmaps (and welcome-notes). */ +typedef struct { + u8 height; /* Bitmap height (pixels) */ + u8 width; /* Bitmap width (pixels) */ + u16 size; /* Bitmap size (bytes) */ + GSM_Bitmap_Types type; /* Bitmap type */ + char netcode[7]; /* Network operator code */ + char text[MAX_BITMAP_TEXT_LENGTH]; /* Text used for (dealer) welcome-note + or callergroup name or Picture Image text */ + unsigned char bitmap[864]; /* Actual Bitmap ((65+7)/8*96=864) */ + unsigned char number; /* Caller group number */ + char ringtone; /* Ringtone no sent with caller group */ + bool enabled; /* With caller logos = displayed or not */ + char Sender[GSM_MAX_SENDER_LENGTH+1];/* For Picture Images - number of sender */ +} GSM_Bitmap; void GSM_SetPointBitmap(GSM_Bitmap *bmp, int x, int y); void GSM_ClearPointBitmap(GSM_Bitmap *bmp, int x, int y); bool GSM_IsPointBitmap(GSM_Bitmap *bmp, int x, int y); void GSM_ClearBitmap(GSM_Bitmap *bmp); -void GSM_ResizeBitmap(GSM_Bitmap *bitmap, GSM_Bitmap_Types target, GSM_Information *info); +void GSM_ResizeBitmap(GSM_Bitmap *bitmap, GSM_Bitmap_Types target); void GSM_PrintBitmap(GSM_Bitmap *bitmap); - -/* SMS bitmap functions */ - -GSM_Error GSM_ReadSMSBitmap(int type, char *message, char *code, GSM_Bitmap *bitmap); -int GSM_SaveSMSBitmap(GSM_SMSMessage *message, GSM_Bitmap *bitmap); +GSM_Error GSM_ReadBitmap(GSM_SMSMessage *message, GSM_Bitmap *bitmap); +int GSM_SaveBitmapToSMS(GSM_MultiSMSMessage *SMS, GSM_Bitmap *bitmap,bool ScreenSaver, bool UnicodeText); #endif - - - - - diff --git a/include/gsm-common.h b/include/gsm-common.h index 96f0ead..2ae6974 100644 --- a/include/gsm-common.h +++ b/include/gsm-common.h @@ -1,13 +1,9 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for the definitions, enums etc. that are used by all models of @@ -18,402 +14,232 @@ #ifndef __gsm_common_h #define __gsm_common_h -#include - -#include "data/rlp-common.h" -#include "gsm-sms.h" - -/* Type of connection. Now we support serial connection with FBUS cable and - IR (only with 61x0 models) */ - -typedef enum { - GCT_Serial, /* Serial connection. */ - GCT_DAU9P, /* Serial connection using DAU9P cable; use only with 6210/7110 if you want faster initialization */ - GCT_Infrared, /* Infrared connection. */ - GCT_Tekram, /* Tekram Ir-Dongle */ - GCT_Irda -} GSM_ConnectionType; - -/* Maximum length of device name for serial port */ - -#define GSM_MAX_DEVICE_NAME_LENGTH (100) +#include "misc.h" + +#define MYGNOKII + +/* Maximum length of SMS center name */ +#define GSM_MAX_SMS_CENTER_NAME_LENGTH (20) + +/* Limits of SMS messages. */ +#define GSM_MAX_SMS_CENTER_LENGTH (40) +#define GSM_MAX_RECIPIENT_LENGTH (40) +#define GSM_MAX_SENDER_LENGTH (40) +#define GSM_MAX_DESTINATION_LENGTH (40) +#define GSM_MAX_SMS_LENGTH (160) +#define GSM_MAX_SMS_8_BIT_LENGTH (140) +#define GSM_MAX_USER_DATA_HEADER_LENGTH (140) +/* The maximum length of an uncompressed concatenated short message is + 255 * 153 = 39015 default alphabet characters */ +#define GSM_MAX_CONCATENATED_SMS_LENGTH (39015) + +#define GSM_MAX_CB_MESSAGE (160) + +/* Correct for phones in fbus-6110.c */ +/* For other translation could be required */ +#define PHONEKEY_1 0x01 +#define PHONEKEY_2 0x02 +#define PHONEKEY_3 0x03 +#define PHONEKEY_4 0x04 +#define PHONEKEY_5 0x05 +#define PHONEKEY_6 0x06 +#define PHONEKEY_7 0x07 +#define PHONEKEY_8 0x08 +#define PHONEKEY_9 0x09 +#define PHONEKEY_0 0x0a +#define PHONEKEY_HASH 0x0b /* # */ +#define PHONEKEY_ASTERISK 0x0c /* * */ +#define PHONEKEY_POWER 0x0d +#define PHONEKEY_INCREASEVOLUME 0x10 /* doesn't available in some phones as separate button: ie. N5110 */ +#define PHONEKEY_DECREASEVOLUME 0x11 /* doesn't available in some phones as separate button: ie. N5110 */ +#define PHONEKEY_UP 0x17 +#define PHONEKEY_DOWN 0x18 +#define PHONEKEY_MENU 0x19 +#define PHONEKEY_NAMES 0x1a /* doesn't available in some phone: ie. N5110 */ +#define PHONEKEY_GREEN 0x0e /* in some phone ie. N5110 sometimes works identical to POWER */ +#define PHONEKEY_RED 0x0f /* (c) key in some phone: ie. N5110 */ + +/* Correct for phones in fbus-6110.c */ +/* For other translation could be required */ +#define PRESSPHONEKEY 0x01 +#define RELEASEPHONEKEY 0x02 -/* Define an enum for specifying memory types for retrieving phonebook - entries, SMS messages etc. This type is not mobile specific - the model - code should take care of translation to mobile specific numbers - see 6110 - code. - 01/07/99: Two letter codes follow GSM 07.07 release 6.2.0 -*/ +/* Limits for IMEI, Revision and Model string storage. */ +#define GSM_MAX_IMEI_LENGTH (20) +#define GSM_MAX_REVISION_LENGTH (20) +#define GSM_MAX_MODEL_LENGTH (10) -typedef enum { - GMT_ME, /* Internal memory of the mobile equipment */ - GMT_SM, /* SIM card memory */ - GMT_FD, /* Fixed dial numbers */ - GMT_ON, /* Own numbers */ - GMT_EN, /* Emergency numbers */ - GMT_DC, /* Dialled numbers */ - GMT_RC, /* Received numbers */ - GMT_MC, /* Missed numbers */ - GMT_LD, /* Last dialed */ - GMT_MT, /* combined ME and SIM phonebook */ - GMT_TA, /* for compatibility only: TA=computer memory */ - GMT_CB, /* Currently selected memory */ - GMT_XX = 0xff /* Error code for unknown memory type (returned by fbus-xxxx functions). */ -} GSM_MemoryType; +/* In 6210 test 57 there seems to be 75 chars */ +#define NM_MAX_SCREEN_WIDTH 75 /* Power source types */ - typedef enum { - GPS_ACDC=1, /* AC/DC powered (charging) */ - GPS_BATTERY /* Internal battery */ + GPS_ACDC=1, /* AC/DC powered (charging) */ + GPS_BATTERY /* Internal battery */ } GSM_PowerSource; /* Definition of security codes. */ - typedef enum { - GSCT_SecurityCode = 0x01, /* Security code. */ - GSCT_Pin, /* PIN. */ - GSCT_Pin2, /* PIN 2. */ - GSCT_Puk, /* PUK. */ - GSCT_Puk2, /* PUK 2. */ - GSCT_None /* Code not needed. */ + GSCT_SecurityCode = 0x01, /* Security code. */ + GSCT_Pin, /* PIN. */ + GSCT_Pin2, /* PIN 2. */ + GSCT_Puk, /* PUK. */ + GSCT_Puk2, /* PUK 2. */ + GSCT_None /* Code not needed. */ } GSM_SecurityCodeType; /* Security code definition. */ - typedef struct { - GSM_SecurityCodeType Type; /* Type of the code. */ - char Code[10]; /* Actual code. */ + GSM_SecurityCodeType Type; /* Type of the code. */ + char Code[10]; /* Actual code. */ } GSM_SecurityCode; -/* This structure is used to get the current network status */ - -typedef struct { - char NetworkCode[10]; /* GSM network code */ - char CellID[10]; /* CellID */ - char LAC[10]; /* LAC */ -} GSM_NetworkInfo; - -/* Limits for sizing of array in GSM_PhonebookEntry. Individual handsets may - not support these lengths so they have their own limits set. */ - -#define GSM_MAX_PHONEBOOK_NAME_LENGTH (50) /* For 7110 */ -#define GSM_MAX_PHONEBOOK_NUMBER_LENGTH (48) /* For 7110 */ -#define GSM_MAX_PHONEBOOK_TEXT_LENGTH (60) /* For 7110 */ -#define GSM_MAX_PHONEBOOK_SUB_ENTRIES (8) /* For 7110 */ - /* 7110 is able to in one - * entry 5 numbers and 2 - * texts [email,notice,postal] */ - -/* Here is a macro for models that do not support caller groups. */ - -#define GSM_GROUPS_NOT_SUPPORTED -1 - -/* This data type is used to report the number of used and free positions in - memory (sim or internal). */ - -typedef struct { - GSM_MemoryType MemoryType; /* Type of the memory */ - int Used; /* Number of used positions */ - int Free; /* Number of free positions */ -} GSM_MemoryStatus; - -/* Some phones (at the moment 6210/7110) supports extended phonebook - with additional data. Here we have structures for them */ - -typedef enum { - GSM_General = 0x0a, - GSM_Mobile = 0x03, - GSM_Work = 0x06, - GSM_Fax = 0x04, - GSM_Home = 0x02 -} GSM_Number_Type; - +/* Define an enum for specifying memory types for retrieving phonebook + entries, SMS messages etc. This type is not mobile specific - the model + code should take care of translation to mobile specific numbers - see 6110 + code. + 01/07/99: Two letter codes follow GSM 07.07 release 6.2.0 +*/ typedef enum { - GSM_Number = 0x0b, - GSM_Note = 0x0a, - GSM_Postal = 0x09, - GSM_Email = 0x08, - GSM_Name = 0x07, - GSM_Date = 0x13 /* Date is used for DC,RC,etc (last calls) */ -} GSM_EntryType; - -typedef struct { - bool AlarmEnabled; /* Is alarm set ? */ - int Year; /* The complete year specification - e.g. 1999. Y2K :-) */ - int Month; /* January = 1 */ - int Day; - int Hour; - int Minute; - int Second; - int Timezone; /* The difference between local time and GMT */ -} GSM_DateTime; - -typedef struct { - GSM_EntryType EntryType; - GSM_Number_Type NumberType; - union { - char Number[GSM_MAX_PHONEBOOK_TEXT_LENGTH + 1]; /* Number */ - GSM_DateTime Date; /* or the last calls list */ - } data; - int BlockNumber; -} GSM_SubPhonebookEntry; - -/* Define datatype for phonebook entry, used for getting/writing phonebook - entries. */ - -typedef struct { - bool Empty; /* Is this entry empty? */ - char Name[GSM_MAX_PHONEBOOK_NAME_LENGTH + 1]; /* Plus 1 for - nullterminator. */ - char Number[GSM_MAX_PHONEBOOK_NUMBER_LENGTH + 1]; /* Number */ - GSM_MemoryType MemoryType; /* Type of memory */ - int Group; /* Group */ - int Location; /* Location */ - GSM_DateTime Date; /* The record date and time - of the number. */ - GSM_SubPhonebookEntry SubEntries[GSM_MAX_PHONEBOOK_SUB_ENTRIES]; - /* For phones with - * additional phonebook - * entries */ - int SubEntriesCount; /* Should be 0, if extended - phonebook is not used */ -} GSM_PhonebookEntry; + GMT_ME, /* Internal memory of the mobile equipment */ + GMT_SM, /* SIM card memory */ + GMT_FD, /* Fixed dial numbers */ + GMT_ON, /* Own numbers */ + GMT_EN, /* Emergency numbers */ + GMT_DC, /* Dialled numbers */ + GMT_RC, /* Received numbers */ + GMT_MC, /* Missed numbers */ + GMT_LD, /* Last dialed */ + GMT_MT, /* combined ME and SIM phonebook */ + GMT_TA, /* for compatibility only: TA=computer memory */ + GMT_CB, /* Currently selected memory */ + GMT_CG, /* Caller groups */ + GMT_XX = 0xff /* Error code for unknown memory type (returned by fbus-xxxx functions. */ +} GSM_MemoryType; /* This define speed dialing entries. */ - typedef struct { - int Number; /* Which number is used to dialing? */ - GSM_MemoryType MemoryType; /* Memory type of the number. */ - int Location; /* Location of the number in MemoryType. */ + int Number; /* Which number is used to dialing? */ + GSM_MemoryType MemoryType; /* Memory type of the number. */ + int Location; /* Location of the number in MemoryType. */ } GSM_SpeedDial; -/* Define enum used to describe what sort of date/time support is - available. */ - -typedef enum { - GDT_None, /* The mobile phone doesn't support time and date. */ - GDT_TimeOnly, /* The mobile phone supports only time. */ - GDT_DateOnly, /* The mobile phone supports only date. */ - GDT_DateTime /* Wonderful phone - it supports date and time. */ -} GSM_DateTimeSupport; - -/* Define enums for RF units. GRF_CSQ asks for units in form used - in AT+CSQ command as defined by GSM 07.07 */ - -typedef enum { - GRF_Arbitrary, - GRF_dBm, - GRF_mV, - GRF_uV, - GRF_CSQ, - GRF_Percentage -} GSM_RFUnits; - /* Define enums for Battery units. */ - typedef enum { - GBU_Arbitrary, - GBU_Volts, - GBU_Minutes, - GBU_Percentage + GBU_Arbitrary, + GBU_Volts, + GBU_Minutes, + GBU_Percentage } GSM_BatteryUnits; -/* Define enums for Calendar Note types */ - -typedef enum { - GCN_REMINDER=1, /* Reminder */ - GCN_CALL, /* Call */ - GCN_MEETING, /* Meeting */ - GCN_BIRTHDAY /* Birthday */ -} GSM_CalendarNoteType; - -/* Calendar note type */ - -typedef struct { - int Location; /* The number of the note in the phone memory */ - GSM_CalendarNoteType Type; /* The type of the note */ - GSM_DateTime Time; /* The time of the note */ - GSM_DateTime Alarm; /* The alarm of the note */ - char Text[20]; /* The text of the note */ - char Phone[20]; /* For Call only: the phone number */ - double Recurance; /* Recurance of the note */ -} GSM_CalendarNote; - -/* This structure is provided to allow common information about the particular - model to be looked up in a model independant way. Some of the values here - define minimum and maximum levels for values retrieved by the various Get - functions for example battery level. They are not defined as constants to - allow model specific code to set them during initialisation */ - -typedef struct { - - char *Models; /* Models covered by this type, pipe '|' delimited. */ - -/* Minimum and maximum levels for RF signal strength. Units are as per the - setting of RFLevelUnits. The setting of RFLevelUnits indicates the - default or "native" units used. In the case of the 3110 and 6110 series - these are arbitrary, ranging from 0 to 4. */ - - float MaxRFLevel; - float MinRFLevel; - GSM_RFUnits RFLevelUnits; - -/* Minimum and maximum levels for battery level. Again, units are as per the - setting of GSM_BatteryLevelUnits. The value that BatteryLevelUnits is set - to indicates the "native" or default value that the phone supports. In the - case of the 3110 and 6110 series these are arbitrary, ranging from 0 to 4. */ - - float MaxBatteryLevel; - float MinBatteryLevel; - GSM_BatteryUnits BatteryLevelUnits; - -/* FIXME: some very similar code is in common/misc.c */ - -/* Information about date, time and alarm support. In case of alarm - information we provide value for the number of alarms supported. */ - - GSM_DateTimeSupport DateTimeSupport; - GSM_DateTimeSupport AlarmSupport; - int MaximumAlarms; - u8 StartupLogoH; /* Logo Widths and Heights - if supported */ - u8 StartupLogoW; - u8 OpLogoH; - u8 OpLogoW; - u8 CallerLogoH; - u8 CallerLogoW; -} GSM_Information; - /* This enum is used for display status. */ typedef enum { - DS_Call_In_Progress, /* Call in progress. */ - DS_Unknown, /* The meaning is unknown now :-( */ - DS_Unread_SMS, /* There is Unread SMS. */ - DS_Voice_Call, /* Voice call active. */ - DS_Fax_Call, /* Fax call active. */ - DS_Data_Call, /* Data call active. */ - DS_Keyboard_Lock, /* Keyboard lock status. */ - DS_SMS_Storage_Full /* Full SMS Memory. */ + DS_Call_In_Progress, /* Call in progress. */ + DS_Unknown, /* The meaning is unknown now :-( */ + DS_Unread_SMS, /* There is Unread SMS. */ + DS_Voice_Call, /* Voice call active. */ + DS_Fax_Call, /* Fax call active. */ + DS_Data_Call, /* Data call active. */ + DS_Keyboard_Lock, /* Keyboard lock status. */ + DS_SMS_Storage_Full /* Full SMS Memory. */ } DisplayStatusEntity; -/* Bitmap types. */ - -typedef enum { - GSM_None=0, - GSM_StartupLogo, - GSM_OperatorLogo, - GSM_CallerLogo, - GSM_PictureImage, - GSM_WelcomeNoteText, - GSM_DealerNoteText -} GSM_Bitmap_Types; - -#define GSM_MAX_BITMAP_SIZE 864 +/* Constants for Profiles. */ + +#define PROFILE_MESSAGE_NOTONE 0x00 +#define PROFILE_MESSAGE_STANDARD 0x01 +#define PROFILE_MESSAGE_SPECIAL 0x02 +#define PROFILE_MESSAGE_BEEPONCE 0x03 +#define PROFILE_MESSAGE_ASCENDING 0x04 + +#define PROFILE_WARNING_OFF 0xff +#define PROFILE_WARNING_ON 0x04 + +#define PROFILE_CALLALERT_RINGING 0x01 +#define PROFILE_CALLALERT_BEEPONCE 0x02 +#define PROFILE_CALLALERT_OFF 0x04 +#define PROFILE_CALLALERT_RINGONCE 0x05 +#define PROFILE_CALLALERT_ASCENDING 0x06 +#define PROFILE_CALLALERT_CALLERGROUPS 0x07 + +#define PROFILE_KEYPAD_OFF 0xff +#define PROFILE_KEYPAD_LEVEL1 0x00 +#define PROFILE_KEYPAD_LEVEL2 0x01 +#define PROFILE_KEYPAD_LEVEL3 0x02 +//in 5110 I had also once 0x03 + +#define PROFILE_VOLUME_LEVEL1 0x06 +#define PROFILE_VOLUME_LEVEL2 0x07 +#define PROFILE_VOLUME_LEVEL3 0x08 +#define PROFILE_VOLUME_LEVEL4 0x09 +#define PROFILE_VOLUME_LEVEL5 0x0a + +#define PROFILE_CALLERGROUPS_ALL 0xff +#define PROFILE_CALLERGROUPS_FAMILY 0x01 +#define PROFILE_CALLERGROUPS_VIP 0x02 +#define PROFILE_CALLERGROUPS_FRIENDS 0x04 +#define PROFILE_CALLERGROUPS_COLLEAGUES 0x08 +#define PROFILE_CALLERGROUPS_OTHERS 0x10 + +#define PROFILE_VIBRATION_OFF 0x00 +#define PROFILE_VIBRATION_ON 0x01 +#define PROFILE_VIBRATION_FIRST 0x02 -/* Structure to hold incoming/outgoing bitmaps (and welcome-notes). */ +/* Structure to hold profile entries. */ typedef struct { - u8 height; /* Bitmap height (pixels) */ - u8 width; /* Bitmap width (pixels) */ - u16 size; /* Bitmap size (bytes) */ - GSM_Bitmap_Types type; /* Bitmap type */ - char netcode[7]; /* Network operator code */ - char text[256]; /* Text used for welcome-note or callergroup name */ - char dealertext[256]; /* Text used for dealer welcome-note */ - bool dealerset; /* Is dealer welcome-note set now ? */ - unsigned char bitmap[GSM_MAX_BITMAP_SIZE]; /* Actual Bitmap */ - char number; /* Caller group number */ - char ringtone; /* Ringtone no sent with caller group */ -} GSM_Bitmap; - - -/* NoteValue is encoded as octave(scale)*14 + note */ -/* where for note: c=0, d=2, e=4 .... */ -/* ie. c#=1 and 5 and 13 are invalid */ -/* note=255 means a pause */ - -#define MAX_RINGTONE_NOTES 256 + int Number; /* The number of the profile. */ + char Name[40]; /* The name of the profile. */ + int DefaultName; /* 0-6, when default name is used, -1, when not */ + int KeypadTone; /* Volumen level for keypad tones. */ + int Lights; /* Lights on/off. */ + int CallAlert; /* Incoming call alert. */ + int Ringtone; /* Ringtone for incoming call alert. */ + int Volume; /* Volume of the ringing. */ + int MessageTone; /* The tone for message indication. */ + int WarningTone; /* The tone for warning messages. */ + int Vibration; /* Vibration? */ + int CallerGroups; /* CallerGroups. */ + int ScreenSaver; /* ScreenSaver */ + int AutomaticAnswer; /* Does the phone auto-answer incoming call? */ +} GSM_Profile; -/* Structure to hold note of ringtone. */ +typedef enum { + PPS_ALS=0, + PPS_HRData, + PPS_14400Data, + PPS_LCDContrast, + PPS_EFR, + PPS_FR, + PPS_HR, + PPS_GamesMenu, /* N3210 5.26 and higher */ + PPS_VibraMenu /* N3210 */ +} GSM_PPS_Settings; typedef struct { - u8 duration; - u8 note; -} GSM_RingtoneNote; - -/* Structure to hold ringtones. */ + GSM_PPS_Settings Name; + bool bool_value; + int int_value; +} GSM_PPS; typedef struct { - char name[20]; - u8 tempo; - u8 NrNotes; - GSM_RingtoneNote notes[MAX_RINGTONE_NOTES]; -} GSM_Ringtone; - -/* Structure to hold profile entries. */ + char data[10+1];//detailed info about this simlock + bool enabled; //is enabled or not ? + int counter; //how many times user tried to disable simlock using keypad + bool factory; //is factory simlock ? +} GSM_OneSimlock; typedef struct { - int Number; /* The number of the profile. */ - char Name[40]; /* The name of the profile. */ - int DefaultName; /* 0-6, when default name is used, -1, when not. */ - int KeypadTone; /* Volume level for keypad tones. */ - int Lights; /* Lights on/off. */ - int CallAlert; /* Incoming call alert. */ - int Ringtone; /* Ringtone for incoming call alert. */ - int Volume; /* Volume of the ringing. */ - int MessageTone; /* The tone for message indication. */ - int WarningTone; /* The tone for warning messages. */ - int Vibration; /* Vibration? */ - int CallerGroups; /* CallerGroups. */ - int AutomaticAnswer; /* Does the phone auto-answer incoming call? */ -} GSM_Profile; - - -#define FO_SUBMIT 0x01 -#define FO_RD 0x40 -#define FO_VPF_NONE 0x00 -#define FO_VPF_REL 0x10 -#define FO_VPF_ABS 0x18 -#define FO_VPF_ENH 0x08 -#define FO_SRR 0x20 -#define FO_UDHI 0x40 -#define FO_RP 0x80 -#define FO_DEFAULT (FO_SUBMIT | FO_VPF_REL | FO_SRR) - -#define PID_DEFAULT 0x00 -#define PID_TYPE0 0x40 -#define PID_REPLACE1 0x41 -#define PID_REPLACE2 0x42 -#define PID_REPLACE3 0x43 -#define PID_REPLACE4 0x44 -#define PID_REPLACE5 0x45 -#define PID_REPLACE6 0x46 -#define PID_REPLACE7 0x47 -#define PID_RETURN_CALL 0x5f - -#define DCS_DEFAULT 0x00 -#define DCS_MSG_WAIT_VOICE_DISCARD 0xc8 -#define DCS_MSG_WAIT_VOICE_OFF 0xc0 -#define DCS_MSG_WAIT_VOICE_STORE 0xd8 -#define DCS_DATA 0xf4 -#define DCS_CLASS0 0xf0 -#define DCS_CLASS1 0xf1 -#define DCS_CLASS2 0xf2 -#define DCS_CLASS3 0xf3 - -/* Limits for IMEI, Revision and Model string storage. */ -#define GSM_MAX_IMEI_LENGTH (20) -#define GSM_MAX_REVISION_LENGTH (6) -#define GSM_MAX_MODEL_LENGTH (6) + GSM_OneSimlock simlocks[4]; +} GSM_AllSimlocks; /* Data structures for the call divert */ typedef enum { - GSM_CDV_Busy = 0x01, - GSM_CDV_NoAnswer, - GSM_CDV_OutOfReach, - GSM_CDV_NotAvailable, - GSM_CDV_AllTypes + GSM_CDV_Busy = 0x01, /* Divert when busy */ + GSM_CDV_NoAnswer, /* Divert when not answered */ + GSM_CDV_OutOfReach, /* Divert when phone off or no coverage */ + GSM_CDV_AllTypes /* Divert all calls without ringing */ } GSM_CDV_DivertTypes; typedef enum { @@ -423,302 +249,79 @@ typedef enum { GSM_CDV_AllCalls } GSM_CDV_CallTypes; +/* See GSM 02.82 for diverts types */ typedef enum { GSM_CDV_Disable = 0x00, GSM_CDV_Enable = 0x01, - GSM_CDV_Query = 0x02, - GSM_CDV_Register = 0x03, - GSM_CDV_Erasure = 0x04 + GSM_CDV_Query = 0x02, /* Is concrete divert enabled ? */ + GSM_CDV_Register = 0x03, /* Sets divert */ + GSM_CDV_Erasure = 0x04 /* Erase concrete divert */ } GSM_CDV_Opers; typedef struct { GSM_CDV_DivertTypes DType; GSM_CDV_CallTypes CType; GSM_CDV_Opers Operation; - SMS_Number Number; + char Number[GSM_MAX_SENDER_LENGTH + 1]; unsigned int Timeout; + bool Enabled; } GSM_CallDivert; -/* This is a generic holder for high level information - eg a GSM_Bitmap */ - -typedef struct { - SMS_Folder *SMSFolder; - SMS_FolderList *SMSFolderList; - GSM_SMSMessage *SMSMessage; - GSM_PhonebookEntry *PhonebookEntry; - GSM_SpeedDial *SpeedDial; - GSM_MemoryStatus *MemoryStatus; - GSM_SMSMemoryStatus *SMSStatus; - SMS_MessageCenter *MessageCenter; - char *Imei; - char *Revision; - char *Model; - char *Manufacturer; - GSM_NetworkInfo *NetworkInfo; - GSM_CalendarNote *CalendarNote; - GSM_Bitmap *Bitmap; - GSM_Ringtone *Ringtone; - GSM_Profile *Profile; - GSM_BatteryUnits *BatteryUnits; - float *BatteryLevel; - GSM_RFUnits *RFUnits; - float *RFLevel; - GSM_Error (*OutputFn)(char *Display, char *Indicators); - char *IncomingCallNr; - GSM_PowerSource *PowerSource; - GSM_DateTime *DateTime; - GSM_CallDivert *CallDivert; -} GSM_Data; - - -/* Global structures intended to be independant of phone etc */ -/* Obviously currently rather Nokia biased but I think most things */ -/* (eg at commands) can be enumerated */ - - -/* A structure to hold information about the particular link */ -/* The link comes 'under' the phone */ -typedef struct { - char PortDevice[20]; /* The port device */ - int InitLength; /* Number of chars sent to sync the serial port */ - GSM_ConnectionType ConnectionType; /* Connection type, serial, ir etc */ - - /* A regularly called loop function */ - /* timeout can be used to make the function block or not */ - GSM_Error (*Loop)(struct timeval *timeout); - - /* A pointer to the function used to send out a message */ - /* This is used by the phone specific code to send a message over the link */ - GSM_Error (*SendMessage)(u16 messagesize, u8 messagetype, void *message); - -} GSM_Link; - - -/* Small structure used in GSM_Phone */ -/* Messagetype is passed to the function in case it is a 'generic' one */ -typedef struct { - u8 MessageType; - GSM_Error (*Functions)(int messagetype, unsigned char *buffer, int length, GSM_Data *data); -} GSM_IncomingFunctionType; - -typedef enum { - GOP_Init, - GOP_GetModel, - GOP_GetRevision, - GOP_GetImei, - GOP_GetManufacturer, - GOP_Identify, - GOP_GetBitmap, - GOP_SetBitmap, - GOP_GetBatteryLevel, - GOP_GetRFLevel, - GOP_DisplayOutput, - GOP_GetMemoryStatus, - GOP_ReadPhonebook, - GOP_WritePhonebook, - GOP_GetPowersource, - GOP_GetAlarm, - GOP_GetSMSStatus, - GOP_GetIncomingCallNr, - GOP_GetNetworkInfo, - GOP_GetSMS, - GOP_DeleteSMS, - GOP_SendSMS, - GOP_GetSpeedDial, - GOP_GetSMSCenter, - GOP_GetDateTime, - GOP_GetCalendarNote, - GOP_CallDivert, - GOP_Max, /* don't append anything after this entry */ -} GSM_Operation; - -/* This structure contains the 'callups' needed by the statemachine */ -/* to deal with messages from the phone and other information */ - -typedef struct _GSM_Statemachine GSM_Statemachine; - -typedef struct { - /* These make up a list of functions, one for each message type and NULL terminated */ - GSM_IncomingFunctionType *IncomingFunctions; - GSM_Error (*DefaultFunction)(int messagetype, unsigned char *buffer, int length); - GSM_Information Info; - GSM_Error (*Functions)(GSM_Operation op, GSM_Data *data, GSM_Statemachine *state); -} GSM_Phone; - - -/* The states the statemachine can take */ +/* Define standard GSM error/return code values. These codes are also used for + some internal functions such as SIM read/write in the model specific code. */ typedef enum { - Startup, /* Not yet initialised */ - Initialised, /* Ready! */ - MessageSent, /* A command has been sent to the link(phone) */ - WaitingForResponse, /* We are waiting for a response from the link(phone) */ - ResponseReceived /* A response has been received - waiting for the phone layer to collect it */ -} GSM_State; - -/* How many message types we can wait for at one */ -#define SM_MAXWAITINGFOR 3 - - -/* All properties of the state machine */ - -struct _GSM_Statemachine{ - GSM_State CurrentState; - GSM_Link Link; - GSM_Phone Phone; - - /* Store last message for resend purposes */ - u8 LastMsgType; - u16 LastMsgSize; - void *LastMsg; - - /* The responses we are waiting for */ - unsigned char NumWaitingFor; - unsigned char NumReceived; - unsigned char WaitingFor[SM_MAXWAITINGFOR]; - GSM_Error ResponseError[SM_MAXWAITINGFOR]; - /* Data structure to be filled in with the response */ - GSM_Data *Data[SM_MAXWAITINGFOR]; -}; - - - -/* Define the structure used to hold pointers to the various API functions. - This is in effect the master list of functions provided by the gnokii API. - Modules containing the model specific code each contain one of these - structures which is "filled in" with the corresponding function within the - model specific code. If a function is not supported or not implemented, a - generic not implemented function is used to return a GE_NOTIMPLEMENTED - error code. */ - -typedef struct { - - /* FIXME: comment this. */ - - GSM_Error (*Initialise)( char *port_device, char *initlength, - GSM_ConnectionType connection, - void (*rlp_callback)(RLP_F96Frame *frame)); - - void (*Terminate)(void); - - GSM_Error (*GetMemoryLocation)( GSM_PhonebookEntry *entry ); - - GSM_Error (*WritePhonebookLocation)( GSM_PhonebookEntry *entry ); - - GSM_Error (*GetSpeedDial)( GSM_SpeedDial *entry); - - GSM_Error (*SetSpeedDial)( GSM_SpeedDial *entry); - - GSM_Error (*GetMemoryStatus)( GSM_MemoryStatus *Status); - - GSM_Error (*GetSMSStatus)( GSM_SMSMemoryStatus *Status); - - GSM_Error (*GetSMSCenter)( SMS_MessageCenter *MessageCenter ); - - GSM_Error (*SetSMSCenter)( SMS_MessageCenter *MessageCenter ); - - GSM_Error (*GetSMSMessage)( GSM_SMSMessage *Message ); - - GSM_Error (*DeleteSMSMessage)( GSM_SMSMessage *Message ); - - GSM_Error (*SendSMSMessage)( GSM_SMSMessage *Message, int size ); - - GSM_Error (*SaveSMSMessage)( GSM_SMSMessage *Message ); - - /* If units is set to a valid GSM_RFUnits value, the code - will return level in these units if it is able. Otherwise - value will be returned as GRF_Arbitary. If phone doesn't - support GetRFLevel, function returns GE_NOTSUPPORTED */ - GSM_Error (*GetRFLevel)( GSM_RFUnits *units, float *level ); - - /* Works the same as GetRFLevel, except returns battery - level if known. */ - GSM_Error (*GetBatteryLevel)( GSM_BatteryUnits *units, float *level ); - - GSM_Error (*GetPowerSource)( GSM_PowerSource *source); - - GSM_Error (*GetDisplayStatus)( int *Status); - - GSM_Error (*EnterSecurityCode)( GSM_SecurityCode Code); - - GSM_Error (*GetSecurityCodeStatus)( int *Status ); - - GSM_Error (*GetIMEI)( char *imei ); - - GSM_Error (*GetRevision)( char *revision ); - - GSM_Error (*GetModel)( char *model ); - - GSM_Error (*GetManufacturer)( char *manufacturer ); - - GSM_Error (*GetDateTime)( GSM_DateTime *date_time); - - GSM_Error (*SetDateTime)( GSM_DateTime *date_time); - - GSM_Error (*GetAlarm)( int alarm_number, GSM_DateTime *date_time ); - - GSM_Error (*SetAlarm)( int alarm_number, GSM_DateTime *date_time ); - - GSM_Error (*DialVoice)( char *Number); - - GSM_Error (*DialData)( char *Number, char type, void (* callpassup)(char c)); - - GSM_Error (*GetIncomingCallNr)( char *Number ); - - GSM_Error (*GetNetworkInfo) ( GSM_NetworkInfo *NetworkInfo ); - - GSM_Error (*GetCalendarNote) ( GSM_CalendarNote *CalendarNote); - - GSM_Error (*WriteCalendarNote) ( GSM_CalendarNote *CalendarNote); - - GSM_Error (*DeleteCalendarNote) ( GSM_CalendarNote *CalendarNote); - - GSM_Error (*NetMonitor) ( unsigned char mode, char *Screen ); - - GSM_Error (*SendDTMF) ( char *String ); - - GSM_Error (*GetBitmap) ( GSM_Bitmap *Bitmap ); - - GSM_Error (*SetBitmap) ( GSM_Bitmap *Bitmap ); - - GSM_Error (*SetRingtone) ( GSM_Ringtone *ringtone ); - - GSM_Error (*SendRingtone) ( GSM_Ringtone *ringtone, char *dest ); - - GSM_Error (*Reset) ( unsigned char type ); - - GSM_Error (*GetProfile) ( GSM_Profile *Profile ); - - GSM_Error (*SetProfile) ( GSM_Profile *Profile ); - - bool (*SendRLPFrame) ( RLP_F96Frame *frame, bool out_dtx ); - - GSM_Error (*CancelCall) (); + GE_NONE = 0, /* No error. */ + GE_DEVICEOPENFAILED, /* Couldn't open specified serial device. */ + GE_UNKNOWNMODEL, /* Model specified isn't known/supported. */ + GE_NOTSUPPORTED, /* We are sure, that function not supported by phone model */ + GE_NOLINK, /* Couldn't establish link with phone. */ + GE_TIMEOUT, /* Command timed out. */ + GE_TRYAGAIN, /* Try again. */ + GE_INVALIDSECURITYCODE, /* Invalid Security code. */ + GE_NOTIMPLEMENTED, /* Command called isn't implemented in model. */ + GE_INVALIDSMSLOCATION, /* Invalid SMS location. */ + GE_INVALIDPHBOOKLOCATION, /* Invalid phonebook location. */ /*10*/ + GE_INVALIDMEMORYTYPE, /* Invalid type of memory. */ + GE_INVALIDSPEEDDIALLOCATION, /* Invalid speed dial location. */ + GE_INVALIDCALNOTELOCATION,/* Invalid calendar note location. */ + GE_INVALIDDATETIME, /* Invalid date, time or alarm specification. */ + GE_EMPTYSMSLOCATION, /* SMS location is empty. */ + GE_PHBOOKNAMETOOLONG, /* Phonebook name is too long. */ + GE_PHBOOKNUMBERTOOLONG, /* Phonebook number is too long. */ + GE_PHBOOKWRITEFAILED, /* Phonebook write failed. */ + GE_SMSSENDOK, /* SMS was send correctly. */ + GE_SMSSENDFAILED, /* SMS send fail. */ /*20*/ + GE_SMSWAITING, /* Waiting for the next part of SMS. */ + GE_SMSTOOLONG, /* SMS message too long. */ + GE_NONEWCBRECEIVED, /* Attempt to read CB when no new CB received */ + GE_INTERNALERROR, /* Problem occured internal to model specific code. */ + GE_CANTOPENFILE, /* Can't open file with bitmap/ringtone */ + GE_WRONGNUMBEROFCOLORS, /* Wrong number of colors in specified bitmap file */ + GE_WRONGCOLORS, /* Wrong colors in bitmap file */ + GE_INVALIDFILEFORMAT, /* Invalid format of file */ + GE_SUBFORMATNOTSUPPORTED, /* Subformat of file not supported */ + GE_TOOSHORT, /* Too short file, structure, etc. to read */ + GE_TOOLONG, /* Too long file, structure, etc. to read */ + GE_INVALIDIMAGESIZE, /* Invalid size of bitmap (in file, etc.) */ + GE_BUSY, /* Command is still being executed. */ + GE_UNKNOWN, /* Unknown error - well better than nothing!! */ + GE_NOACCESS, + GE_USERCANCELED, + GE_MEMORYFULL, + GE_INVALIDRINGLOCATION, + GE_INSIDEBOOKMARKSMENU, + GE_INVALIDBOOKMARKLOCATION, + GE_INSIDESETTINGSMENU, + GE_INVALIDSETTINGSLOCATION, - GSM_Error (*EnableDisplayOutput) (); - - GSM_Error (*DisableDisplayOutput) (); - - GSM_Error (*EnableCellBroadcast) (); - - GSM_Error (*DisableCellBroadcast) (); - - GSM_Error (*ReadCellBroadcast) ( GSM_CBMessage *Message ); - - GSM_Error (*SetKey) (int c, int up); - - GSM_Error (*HandleString) (char *s); - - GSM_Error (*AnswerCall) (char s); - -} GSM_Functions; - -/* Undefined functions in fbus/mbus files */ -extern GSM_Error Unimplemented(void); -#define UNIMPLEMENTED (void *) Unimplemented - -extern GSM_MemoryType StrToMemoryType (const char *s); - -inline void GSM_DataClear(GSM_Data *data); + /* The following are here in anticipation of data call requirements. */ + + GE_LINEBUSY, /* Outgoing call requested reported line busy */ + GE_NOCARRIER, /* No Carrier error during data call setup ? */ + GE_SMSSAVEFAILED, /* save sms failed */ + GE_SMSISINMEM, /* sms is already in memory */ + GE_BUSYSMSLOCATION /* there is a sms at the requested sms location */ +} GSM_Error; #endif /* __gsm_common_h */ diff --git a/include/gsm-networks.h b/include/gsm-networks.h index 8587430..367a964 100644 --- a/include/gsm-networks.h +++ b/include/gsm-networks.h @@ -1,35 +1,42 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for GSM networks. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:20 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.5 2001/06/28 00:28:46 pkot - Small docs updates (Pawel Kot) - - */ #ifndef __gsm_networks_h #define __gsm_networks_h +/* Define enums for RF units. GRF_CSQ asks for units in form used + in AT+CSQ command as defined by GSM 07.07 */ +typedef enum { + GRF_Arbitrary, + GRF_dBm, + GRF_mV, + GRF_uV, + GRF_CSQ, + GRF_Percentage +} GSM_RFUnits; + +/* This structure is used to get the current network status */ + +typedef struct { + char NetworkCode[10]; /* GSM network code */ + char CellID[10]; /* CellID */ + char LAC[10]; /* LAC */ +} GSM_NetworkInfo; + /* This type is used to hold information about various GSM networks. */ typedef struct { - char *Code; /* GSM network code */ - char *Name; /* GSM network name */ + char Code[9+1]; /* GSM network code */ + char Name[50]; /* GSM network name */ } GSM_Network; /* This type is used to hold information about various GSM countries. */ @@ -46,4 +53,7 @@ char *GSM_GetNetworkCode(char *NetworkName); char *GSM_GetCountryName(char *CountryCode); char *GSM_GetCountryCode(char *CountryName); +void EncodeNetworkCode(unsigned char* buffer, unsigned char* output); +void DecodeNetworkCode(unsigned char* buffer, unsigned char* output); + #endif /* __gsm_networks_h */ diff --git a/include/gsm-ringtones.h b/include/gsm-ringtones.h index 11c44b5..92e439e 100644 --- a/include/gsm-ringtones.h +++ b/include/gsm-ringtones.h @@ -1,26 +1,14 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. This file provides definitions of macros from the Smart Messaging Specification. It is mainly rewrite of the spec to C :-) Viva Nokia! - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:20 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.2 2001/06/28 00:28:46 pkot - Small docs updates (Pawel Kot) - - */ #ifndef __gsm_ringtones_h @@ -32,6 +20,41 @@ #include #include "misc.h" #include "gsm-common.h" +#include "gsm-sms.h" + +#define MAX_RINGTONE_NOTES 255 + +/* Structure to hold note of ringtone. */ +/* NoteValue is encoded as octave(scale)*14 + note */ +/* where for note: c=0, d=2, e=4 .... */ +/* ie. c#=1 and 5 and 13 are invalid */ +/* note=255 means a pause */ +typedef struct { + u8 duration; + u8 note; + int tempo; + u8 style; +} GSM_RingtoneNote; + +/* Structure to hold ringtones. */ +typedef struct { + char name[20]; + unsigned char Loop; + u8 NrNotes; + GSM_RingtoneNote notes[256]; + bool allnotesscale; /* Some Nokia phones doesn't receive correctly some + ringtones without it. N3310 4.02 */ + int location; +} GSM_Ringtone; + +/* Structure to hold binary ringtones. */ + +typedef struct { + char name[20]; + unsigned char frame[1000]; + int length; + int location; +} GSM_BinRingtone; #define GetBit(Stream,BitNr) Stream[(BitNr)/8] & 1<<(7-((BitNr)%8)) #define SetBit(Stream,BitNr) Stream[(BitNr)/8] |= 1<<(7-((BitNr)%8)) @@ -45,6 +68,8 @@ #define CancelCommand (0x05<<1) /* binary 0000 101 */ #define RingingToneProgramming (0x25<<1) /* binary 0100 101 */ #define Sound (0x1d<<1) /* binary 0011 101 */ +/* MW: I didn't find phone, which can unpack ringtone with Unicode + command. Tested 3310, 6150 */ #define Unicode (0x22<<1) /* binary 0100 010 */ /* Song-Type Encoding */ @@ -61,13 +86,13 @@ #define ScaleInstructionId (0x02<<5) /* binary 010 */ #define StyleInstructionId (0x03<<5) /* binary 011 */ #define TempoInstructionId (0x04<<5) /* binary 100 */ -#define VolumeInstructionId (0x05<<5) /* binary 101 */ +#define VolumeInstructionId (0x05<<5) /* binary 101 */ /* Style-Value Encoding*/ #define NaturalStyle (0x00<<6) /* binary 00 */ #define ContinuousStyle (0x01<<6) /* binary 01 */ -#define StaccatoStyle (0x02<<6) /* binary 11 */ +#define StaccatoStyle (0x02<<6) /* binary 10 */ /* Note-Scale Encoding */ @@ -115,26 +140,55 @@ #define D_part (0x03<<6) /* binary 11 */ /* Command-End */ - #define CommandEnd (0x00) /* binary 00000000 */ -/* Definition of the Note type */ +u8 GSM_PackRingtone(GSM_Ringtone *ringtone, unsigned char *package, int *maxlength); +GSM_Error GSM_UnPackRingtone(GSM_Ringtone *ringtone, char *package, int maxlength); + +int GSM_GetDuration(int number, unsigned char *spec); +int GSM_GetNote(int number); +int GSM_GetScale(int number); +int GSM_GetTempo(int Beats); -typedef struct { - int Scale; - int NoteID; - int Duration; - int DurationSpecifier; -} Note; +void GSM_PlayOneNote (GSM_RingtoneNote note); +void GSM_PlayRingtone (GSM_Ringtone *ringtone); -#define GSM_MAX_RINGTONE_PACKAGE_LENGTH 200 +int GSM_GetFrequency(int number); -/* From PC Composer help */ -#define GSM_MAX_RINGTONE_NOTES 130 +GSM_Error GSM_ReadRingtone(GSM_SMSMessage *message, GSM_Ringtone *ringtone); -u8 GSM_PackRingtone(GSM_Ringtone *ringtone, char *package, int *maxlength); -GSM_Error GSM_UnPackRingtone(GSM_Ringtone *ringtone, char *package, int maxlength); +int GSM_SaveRingtoneToSMS(GSM_MultiSMSMessage *SMS, + GSM_Ringtone *ringtone,bool profilestyle); -int GSM_GetNote(int number); +/* FIXME: For each phone probaby different */ +#define FB61_MAX_RINGTONE_FRAME_LENGTH 200 + +/* Smart Messaging 3.0 says: 16*9=144 bytes, + but on 3310 4.02 it was possible to save about 196 chars (without cutting) */ +#define SM30_MAX_RINGTONE_FRAME_LENGTH 196 + +/* Like PC Composer help say */ +#define FB61_MAX_RINGTONE_NOTES 130 + +/* Nokia ringtones codes. */ + +struct OneRingtone { + char name[30]; + int menu; + int code; +}; + +void PrepareRingingTones(char model[64], char rev[64]); + +/* returns names from code or number in menu */ +char *RingingToneName(int code, int menu); + +/* returns code from number in menu */ +int RingingToneCode(int menu); + +/* returns number in menu from code */ +int RingingToneMenu(int code); + +int NumberOfRingtones(); #endif /* __gsm_ringtones_h */ diff --git a/include/gsm-sms.h b/include/gsm-sms.h index 3cde6f3..fac18b9 100644 --- a/include/gsm-sms.h +++ b/include/gsm-sms.h @@ -1,411 +1,292 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 2001 Pawe³ Kot - Released under the terms of the GNU GPL, see file COPYING for more details. - Include file for SMS library. - */ -#ifndef __gnokii_sms_h_ -#define __gnokii_sms_h_ - -#include "misc.h" -#include "gsm-error.h" - -/* Maximum length of SMS center name */ - -#define GSM_MAX_SMS_CENTER_NAME_LENGTH (20) - -/* Limits of SMS messages. */ - -#define GSM_MAX_SMS_CENTER_LENGTH (40) -#define GSM_MAX_SENDER_LENGTH (40) -#define GSM_MAX_DESTINATION_LENGTH (40) +#ifndef __gsm_sms_h +#define __gsm_sms_h -#define GSM_MAX_SMS_LENGTH (160) -#define GSM_MAX_8BIT_SMS_LENGTH (140) +#include "gsm-common.h" +#include "gsm-datetime.h" -#define SMS_MAX_ADDRESS_LENGTH (40) - -/* FIXME: what value should be here? (Pawel Kot) */ -#define SMS_MAX_UDH_NUMBER 10 - -/*** MEMORY INFO ***/ +/* This data-type is used to specify the type of the number. See the official + GSM specification 03.40, version 5.3.0, section 9.1.2.5, page 33. */ +typedef enum { + GNT_UNKNOWN=0x81, /* Unknown number */ + GNT_INTERNATIONAL=0x91, /* International number */ + GNT_ALPHANUMERIC=0xD0 /* Alphanumeric number */ +} GSM_NumberType; +/* For folder table */ typedef struct { - int Unread; /* Number of unread messages */ - int Number; /* Number of all messages */ -} GSM_SMSMemoryStatus; - -/*** DATE AND TIME ***/ + int smsnum; + u8 folder; + int location; +//future use GSM_SMSMessage *message; +} GSM_SMS2Foldertable; +/* This data type is used to hold the current SMS status. */ typedef struct { - int Year; /* The complete year specification - e.g. 1999. Y2K :-) */ - int Month; /* January = 1 */ - int Day; - int Hour; - int Minute; - int Second; - int Timezone; /* The difference between local time and GMT */ -} SMS_DateTime; - -/*** USER DATA HEADER ***/ + int UnRead; /* The number of unread messages */ + int Number; /* The number of messages */ + GSM_SMS2Foldertable foldertable[255]; /* for 6210/7110 */ +} GSM_SMSStatus; -/* types of User Data Header */ +/* Define datatype for SMS Message Type */ typedef enum { - SMS_NoUDH = 0x00, - SMS_ConcatenatedMessages = 0x01, - SMS_OpLogo = 0x02, - SMS_CallerIDLogo = 0x03, - SMS_Ringtone = 0x04, - SMS_VoiceMessage = 0x05, - SMS_FaxMessage = 0x06, - SMS_EmailMessage = 0x07, - SMS_OtherMessage = 0x08, - SMS_BusinessCard = 0x09, - SMS_UnknownUDH = 0x0a -} SMS_UDHType; + GST_SMS, + GST_DR, /* Delivery Report */ + GST_UN /* Unknown */ +} GSM_SMSMessageType; -typedef struct { - SMS_UDHType Type; - union { - struct { - unsigned short ReferenceNumber; - unsigned short MaximumNumber; - unsigned short CurrentNumber; - } ConcatenatedShortMessage; /* SMS_ConcatenatedMessages */ - struct { - bool Store; - unsigned short MessageCount; - } SpecialSMSMessageIndication; /* SMS_VoiceMessage, SMS_FaxMessage, SMS_EmailMessage, SMS_OtherMessage */ - struct { - char NetworkCode[6]; -// ... - } Logo; /* SMS_OpLogo, SMS_CallerIDLogo */ - struct { -// ... - } Ringtone; /* SMS_Ringtone */ - } u; -} SMS_UDHInfo; +#define GST_INBOX 0; /* Mobile Terminated (MT) message - Inbox message */ +#define GST_OUTBOX 1; /* Mobile Originated (MO) message - Outbox message */ +#define GST_7110_INBOX 0x08; /* Inbox in 6210/7110 */ +#define GST_7110_OUTBOX 0x10; /* Outbox in 6210/7110 */ +/* Datatype for SMS status */ typedef enum { - SMS_PID, /* Set Protocol Identifier to `Return Call Message' */ - SMS_DCS, /* Set Data Coding Scheme "to indicate the type of message waiting and whether there are some messages or no messages" */ - SMS_UDH /* Use User Data Header - Special SMS Message Indication; the maximium level of information, may not be supported by all phones */ -} SMS_MessageWaitingType; - -/*** DATA CODING SCHEME ***/ + GSS_SENTREAD = 0x01, /* Sent or read message */ + GSS_NOTSENTREAD = 0x03, /* Not sent or not read message */ + GSS_UNKNOWN = 0x05, /* RTH FIXME: ? */ + GSS_TEMPLATE = 0x07 /* Template ? */ +} GSM_SMSMessageStatus; +/* SMS Messages sent as... */ typedef enum { - SMS_GeneralDataCoding, - SMS_MessageWaiting -} SMS_DataCodingSchemeType; + GSMF_Text = 0x00, /* Plain text message. */ + GSMF_Fax = 0x22, /* Fax message. */ + GSMF_Voice = 0x24, /* Voice mail message. */ + GSMF_ERMES = 0x25, /* ERMES message. */ + GSMF_Paging = 0x26, /* Paging. */ + GSMF_UCI = 0x2d, /* Email message in 8110i. */ + GSMF_Email = 0x32, /* Email message. */ + GSMF_X400 = 0x31 /* X.400 message. */ +} GSM_SMSMessageFormat; +/* Validity of SMS Messages. */ +/* Ready values for TP-VP. Don't give them for function packing SMS validity + (creating TP-VP from validity value in minutes) */ typedef enum { - SMS_DefaultAlphabet = 0x00, - SMS_8bit = 0x01, - SMS_UCS2 = 0x02 -} SMS_AlphabetType; - + GSMV_1_Hour = 0x0b, + GSMV_6_Hours = 0x47, + GSMV_24_Hours = 0xa7, + GSMV_72_Hours = 0xa9, + GSMV_1_Week = 0xad, + GSMV_Max_Time = 0xff +} GSM_SMSMessageValidity; + +/* 7 bit SMS Coding type */ typedef enum { - SMS_VoiceMail = 0x00, - SMS_Fax = 0x01, - SMS_Email = 0x02, - SMS_Text = 0x03, - SMS_Other = 0x04 -} SMS_IndicationType; + GSM_Coding_Unicode = 0x01, + GSM_Coding_Default = 0x02, + GSM_Coding_8bit = 0x03 +} GSM_Coding_Type; +/* Define datatype for SMS Message Center */ typedef struct { - SMS_DataCodingSchemeType Type; - union { - struct { - unsigned short Class; /* 0 - no class - 1 - Class 0 - 2 - Class 1 - 3 - Class 2 - 4 - Class 3 */ - bool Compressed; - SMS_AlphabetType Alphabet; - } General; - struct { - bool Discard; - SMS_AlphabetType Alphabet; /* ucs16 not supported */ - bool Active; - SMS_IndicationType Type; - } MessageWaiting; - } u; -} SMS_DataCodingScheme; - -/*** VALIDITY PERIOD ***/ + int No; /* Number of the SMSC in the phone memory. */ + char Name[GSM_MAX_SMS_CENTER_NAME_LENGTH]; /* Name of the SMSC. */ + GSM_SMSMessageFormat Format; /* SMS is sent as text/fax/paging/email. */ + GSM_SMSMessageValidity Validity; /* Validity of SMS Message. */ + char Number[GSM_MAX_SMS_CENTER_LENGTH]; /* Number of the SMSC. */ + char DefaultRecipient[GSM_MAX_RECIPIENT_LENGTH]; /* Number of default recipient */ +} GSM_MessageCenter; -typedef enum { - SMS_NoValidityPeriod = 0x00, - SMS_EnhancedFormat = 0x01, - SMS_RelativeFormat = 0x02, - SMS_AbsoluteFormat = 0x03 -} SMS_ValidityPeriodFormat; +/* Define datatype for Cell Broadcast message */ +typedef struct { + int Channel; /* channel number */ + char Message[GSM_MAX_CB_MESSAGE + 1]; + int New; +} GSM_CBMessage; +/* types of User Data Header */ typedef enum { - SMS_EnhancedNoValidityPeriod = 0x00, - SMS_EnhancedRelativeFormat = 0x01, - SMS_EnhancedRelativeSeconds = 0x02, /* Only one ocetet more is used */ - SMS_EnhancedRelativeSemiOctet = 0x03 /* 3 octets contain relative time in hours, minutes and seconds in semi-octet representation */ -} SMS_EnhancedValidityPeriodType; + GSM_NoUDH, + GSM_ConcatenatedMessages, + GSM_OpLogo, + GSM_CallerIDLogo, + GSM_RingtoneUDH, + GSM_EnableVoice, + GSM_DisableVoice, + GSM_EnableEmail, + GSM_DisableEmail, + GSM_EnableFax, + GSM_DisableFax, + GSM_VoidSMS, + GSM_HangSMS, + GSM_BugSMS, + GSM_UnknownUDH, //Gnokii doesn't know this UDH + GSM_WAPBookmarkUDH, + GSM_WAPBookmarkUDHLong, + GSM_WAPSettingsUDH, + GSM_CalendarNoteUDH, + GSM_CalendarNoteUDH2, + GSM_PhonebookUDH, + GSM_ProfileUDH, +} GSM_UDH; + +/* Define datatype for SMS messages, used for getting SMS messages from the + phones memory. */ +typedef struct { + GSM_Coding_Type Coding; + GSM_DateTime Time; /* Date of reception/response of messages. */ + GSM_DateTime SMSCTime; /* Date of SMSC response if DeliveryReport messages. */ + int Length; /* Length of the SMS message. */ + int Validity; /* Validity Period of the SMS message. */ + GSM_UDH UDHType; /* If UDH is present - type of UDH */ + unsigned char UDH[GSM_MAX_USER_DATA_HEADER_LENGTH]; /* If UDH is present - content of UDH */ + unsigned char MessageText[GSM_MAX_SMS_LENGTH + 1]; /* Room for null term. */ + GSM_MessageCenter MessageCenter; /* SMS Center. */ + char Sender[GSM_MAX_SENDER_LENGTH + 1]; /* Sender of the SMS message. */ + char Destination[GSM_MAX_DESTINATION_LENGTH+1];/* Destination of the message. */ + int MessageNumber; /* Location in the memory, where SMS is saved */ + GSM_MemoryType MemoryType; /* Type of memory message is stored in. */ + GSM_SMSMessageType Type; /* Type of the SMS message */ + GSM_SMSMessageStatus Status; /* Status of the SMS message */ + int Class; /* Class Message: 0, 1, 2, 3 or none; see GSM 03.38 */ + bool Compression; /* Indicates whether SMS contains compressed data */ + int Location; /* Location in the memory, when save SMS */ + bool ReplyViaSameSMSC; /* Indicates whether "Reply via same center" is set */ + int folder; /* Folder: 0-Inbox,1-Outbox, etc. */ + bool SMSData; /* if folder contains sender, SMSC number and sending date */ + unsigned char Name[25+1]; /* Name in Nokia 6210/7110, etc. Ignored in other */ +} GSM_SMSMessage; typedef struct { - bool extension; /* we need to set it to 0 at the moment; FIXME: how to handle `1' here? */ - bool single_shot; - SMS_EnhancedValidityPeriodType type; - union { - unsigned short relative; - unsigned short seconds; - SMS_DateTime hms; - } period; -} SMS_EnhancedValidityPeriod; + int number; + GSM_SMSMessage SMS[6]; +} GSM_MultiSMSMessage; -/* Validity of SMS Messages. */ +/* Maximal number of SMS folders */ +/* #define MAX_SMS_FOLDERS 10 */ +#define MAX_SMS_FOLDERS 24 -typedef enum { - SMS_V1H = 0x0b, - SMS_V6H = 0x47, - SMS_V24H = 0xa7, - SMS_V72H = 0xa9, - SMS_V1W = 0xad, - SMS_VMax = 0xff -} SMS_ValidityPeriod; +typedef struct { + char Name[15]; /* Name for SMS folder */ + u8 locations[160]; /* locations of SMS messages in that folder (6210 specific) */ + u8 number; /* number of SMS messages in that folder*/ +} GSM_OneSMSFolder; typedef struct { - SMS_ValidityPeriodFormat VPF; - union { - SMS_EnhancedValidityPeriod Enhanced; - SMS_ValidityPeriod Relative; /* 8 bit */ - SMS_DateTime Absolute; - } u; -} SMS_MessageValidity; + GSM_OneSMSFolder Folder[MAX_SMS_FOLDERS]; + u8 FoldersID[MAX_SMS_FOLDERS]; // ID specific for this folder and phone. + // Used in internal functions. Do not use it. + u8 number; //number of SMS folders +} GSM_SMSFolders; + +/* Identifiers for Smart Messaging 3.0 multipart SMS */ +#define SM30_ISOTEXT 0 // ISO 8859-1 text +#define SM30_UNICODETEXT 1 +#define SM30_OTA 2 +#define SM30_RINGTONE 3 +#define SM30_PROFILENAME 4 +#define SM30_SCREENSAVER 6 + +/* TP-Message-Type-Indicator */ +/* See GSM 03.40 version 6.1.0 Release 1997 Section 9.2.3.1 */ +typedef enum { + SMS_Deliver = 0x00, /* when we save SMS in Inbox */ + SMS_Deliver_Report, + SMS_Status_Report, /* Delivery Report received by phone */ + SMS_Command, + SMS_Submit, /* when we send SMS or save it in Outbox */ + SMS_Submit_Report +} SMS_MessageType; +/* Structure to hold UDH Header */ +typedef struct { + GSM_UDH UDHType; /* Type */ + int Length; /* Length */ + unsigned char *Text; /* Text */ +} GSM_UDHHeader; -/* This data-type is used to specify the type of the number. See the official - GSM specification 03.40, version 6.1.0, section 9.1.2.5, page 35-37. */ -typedef enum { - SMS_Unknown = 0x81, /* Unknown number */ - SMS_International = 0x91, /* International number */ - SMS_National = 0xa1, /* National number */ - SMS_Network = 0xb1, /* Network specific number */ - SMS_Subscriber = 0xc1, /* Subscriber number */ - SMS_Alphanumeric = 0xd0, /* Alphanumeric number */ - SMS_Abbreviated = 0xe1 /* Abbreviated number */ -} SMS_NumberType; +typedef struct { + unsigned char MessageText[GSM_MAX_SMS_LENGTH + 1]; + /* TP-User-Data. See GSM 03.40 section 9.2.3.24. Room for null term. */ -/*** MESSAGE CENTER ***/ + unsigned char Number[GSM_MAX_SENDER_LENGTH + 1]; + /*In SMS-Deliver TP-Originating-Address.See GSM 03.40 section 9.2.3.7 */ + /*In SMS-Submit TP-Destination-Address.See GSM 03.40 section 9.2.3.8 */ + /*In SMS-Status-Report TP-Recipient-Address. See GSM 03.40 section 9.2.3.14*/ -typedef enum { - SMS_FText = 0x00, /* Plain text message. */ - SMS_FFax = 0x22, /* Fax message. */ - SMS_FVoice = 0x24, /* Voice mail message. */ - SMS_FERMES = 0x25, /* ERMES message. */ - SMS_FPaging = 0x26, /* Paging. */ - SMS_FUCI = 0x2d, /* Email message in 8110i. */ - SMS_FEmail = 0x32, /* Email message. */ - SMS_FX400 = 0x31 /* X.400 message. */ -} SMS_MessageFormat; + unsigned char SMSCNumber[GSM_MAX_SMS_CENTER_LENGTH]; + /* SMSC number */ -typedef struct { - int No; /* Number of the SMSC in the phone memory. */ - SMS_NumberType Type; - char Name[GSM_MAX_SMS_CENTER_NAME_LENGTH]; /* Name of the SMSC. */ - SMS_MessageFormat Format; /* SMS is sent as text/fax/paging/email. */ - SMS_ValidityPeriod Validity; /* Validity of SMS Message. */ - char Number[GSM_MAX_SMS_CENTER_LENGTH]; /* Number of the SMSC. */ - char Recipient[GSM_MAX_SMS_CENTER_LENGTH]; /* Number of the default recipient. */ -} SMS_MessageCenter; + unsigned char TPPID; + /* TP-Protocol-Identifier. See GSM 03.40 section 9.2.3.9 */ -/*** SHORT MESSAGE CORE ***/ + unsigned char TPDCS; + /* TP-Data-Coding-Scheme. See GSM 03.40 section 9.2.3.10 */ -typedef struct { - SMS_NumberType type; - char number[SMS_MAX_ADDRESS_LENGTH]; -} SMS_Number; - -typedef enum { /* Bits meaning */ - SMS_Deliver = 0x00, /* 00 0 First 2 digits are taken from */ - SMS_Delivery_Report = 0x01, /* 00 1 GSM 03.40 version 6.1.0 Release 1997 */ - SMS_Submit = 0x02, /* 01 0 */ - SMS_Submit_Report = 0x03, /* 01 1 */ - SMS_Command = 0x04, /* 10 0 mark a report */ - SMS_Status_Report = 0x05, /* 10 1 Section 9.2.3.1; 3rd digit is to */ - SMS_Picture = 0x07 /* Looks like Happy N*kia Engineers (TM) invention */ -} SMS_MessageType; + unsigned char DeliveryDateTime[7]; + /* For SMS-Submit TP-Validity-Period. See GSM 03.40 section 9.2.3.12 */ + /* For SMS-Status-Report TP-Discharge Time. See GSM 03.40 section 9.2.3.13 */ -typedef enum { - SMS_Enquiry = 0x00, /* Enquiry relating to previosly submitted short message; sets SRR to 1 */ - SMS_CancelStatusReport = 0x01, /* Cancel Status Report Request relating to previously submitted short message; sets SRR to 0 */ - SMS_DeleteSM = 0x02, /* Delete previousle submitted Short Message; sets SRR to 0 */ - SMS_EnableStatusReport = 0x03 /* Enable Status Report Request relating to previously submitted short message; sets SRR to 0 */ -} SMS_CommandType; + unsigned char SMSCDateTime[7]; + /* TP-Service-Centre-Time-Stamp in SMS-Status-Report. + See GSM 03.40 section 9.2.3.11 */ -typedef struct { - SMS_CommandType Type; -} SMS_MessageCommand; + unsigned char TPStatus; + /* TP-Status in SMS-Status-Report. See GSM 03.40 section 9.2.3.15 */ -/* Datatype for SMS status */ -typedef enum { - SMS_Read = 0x01, - SMS_Unread = 0x03, - SMS_Sent = 0x05, - SMS_Unsent = 0x07 -} SMS_MessageStatus; + unsigned char TPUDL; + /* TP-User-Data-Length. See GSM 03.40 section 9.2.3.16 */ -/* In contrast to GSM_MemoryType, SMS_MemoryType is phone dependant */ -typedef enum { - GMT_IN = 0x08, /* Inbox in 6210/7110 */ - GMT_OU = 0x10, /* Outbox in 6210/7110 */ - GMT_AR = 0x18, /* Archive in 6210/6110 */ - GMT_TE = 0x20, /* Templates in 6210/7110 */ - GMT_F1 = 0x29, /* 1st CUSTOM FOLDER in 6210/7110*/ - GMT_F2 = 0x31, - GMT_F3 = 0x39, - GMT_F4 = 0x41, - GMT_F5 = 0x49, - GMT_F6 = 0x51, - GMT_F7 = 0x59, - GMT_F8 = 0x61, - GMT_F9 = 0x69, - GMT_F10 = 0x71, - GMT_F11 = 0x79, - GMT_F12 = 0x81, - GMT_F13 = 0x89, - GMT_F14 = 0x91, - GMT_F15 = 0x99, - GMT_F16 = 0xA1, - GMT_F17 = 0xA9, - GMT_F18 = 0xB1, - GMT_F19 = 0xB9, - GMT_F20 = 0xC1 /* 20th CUSTOM FOLDER in 6210/7110 */ -} SMS_MemoryType; - -/* Define datatype for SMS messages, describes precisely GSM Spec 03.40 */ -typedef struct { - /* Specification fields */ - SMS_MessageType Type; /* Message Type Indicator - 2 bits (9.2.3.1) */ - bool MoreMessages; /* More Messages to Send (9.2.3.2) */ - bool ReplyViaSameSMSC; /* Reply Path (9.2.3.17) - `Reply via same centre' in the phone */ - bool RejectDuplicates; /* Reject Duplicates (9.2.3.25) */ - bool Report; /* Status Report (9.2.3.4, 9.2.3.5 & 9.2.3.26) - `Delivery reports' in the phone */ - - unsigned short Number; /* Message Number - 8 bits (9.2.3.18) */ - unsigned short Reference; /* Message Reference - 8 bit (9.2.3.6) */ - unsigned short PID; /* Protocol Identifier - 8 bit (9.2.3.9) */ - unsigned short ReportStatus; /* Status - 8 bit (9.2.3.15), Failure Cause (9.2.3.22) */ - unsigned short Length; /* User Data Length (9.2.3.16), Command Data Length (9.2.3.20) */ - - SMS_MessageCenter MessageCenter; /* SMSC Address (9.2.3.7, 9.2.3.8, 9.2.3.14) */ - SMS_Number RemoteNumber; /* Origination, destination, Recipient Address (9.2.3.7, 9.2.3.8, 9.2.3.14) */ - unsigned char MessageText[GSM_MAX_SMS_LENGTH]; /* User Data (9.2.3.24), Command Data (9.2.3.21) */ - SMS_DataCodingScheme DCS; /* Data Coding Scheme (9.2.3.10) */ - SMS_MessageValidity Validity; /* Validity Period Format & Validity Period (9.2.3.3 & 9.2.3.12) - `Message validity' in the phone */ - - unsigned short UDH_No; /* Number of presend UDHs */ - unsigned int UDH_Length; /* Length of the whole UDH */ - SMS_UDHInfo UDH[SMS_MAX_UDH_NUMBER]; /* User Data Header Indicator & User Data Header (9.2.3.23 & 9.2.3.24) */ - - SMS_DateTime SMSCTime; /* Service Centre Time Stamp (9.2.3.11) */ - SMS_DateTime Time; /* Discharge Time (9.2.3.13) */ - - /* Other fields */ - SMS_MemoryType MemoryType; /* memoryType (for 6210/7110: folder indicator */ - SMS_MessageStatus Status; /* Status of the message: sent/read or unsent/unread */ - -// SMS_CommandType Command; /* Command Type - 8 bits (9.2.3.19); FIXME: use it!!!! */ -// unsigned char Parameter[???]; /* Parameter Indicator (9.2.3.27); FIXME: how to use it??? */ -} GSM_SMSMessage; + unsigned char TPVP; + /* TP-Validity Period in SMS-Submit. See GSM 03.40 section 9.2.3.12 */ -/* Define the layout of the SMS message header */ -typedef struct { - bool IsSupported; - short MoreMessages; - short ReplyViaSameSMSC; - short RejectDuplicates; - short Report; - short Number; - short Reference; - short PID; - short ReportStatus; - short Length; - short DataCodingScheme; - short Validity; - short UserDataHeader; - short MessageCenter; - bool IsMessageCenterCoded; - short RemoteNumber; - bool IsRemoteNumberCoded; - short SMSCTime; - short Time; - short MemoryType; - short Status; - short UserData; - bool IsUserDataCoded; -} SMSMessage_Layout; - -/* Define set of SMS Headers for the phone series */ -typedef struct { - unsigned short Type; - SMSMessage_Layout Deliver; - SMSMessage_Layout Submit; - SMSMessage_Layout DeliveryReport; - SMSMessage_Layout Picture; -} SMSMessage_PhoneLayout; + unsigned char TPMR; + /* TP-Message Reference in SMS-Submit. See GSM 03.40 section 9.2.3.6 */ -extern SMSMessage_PhoneLayout layout; + unsigned char firstbyte; + /* Byte contains in SMS-Deliver: + TP-Message-Type-Indicator (2 bits) See GSM 03.40 section 9.2.3.1 -/*** FOLDERS ***/ + TP-More-Messages-To-Send (1 bit). See GSM 03.40 section 9.2.3.2 -/* Maximal number of SMS folders */ -#define MAX_SMS_FOLDERS 24 + TP-Reply-Path (1 bit). See GSM 03.40 section 9.2.3.17 + TP-User-Data-Header-Indicator (1 bit). See GSM 03.40 section 9.2.3.23 + TP-Status-Report-Indicator (1 bit). See GSM 03.40 section 9.2.3.4 -/* Datatype for SMS folders ins 6210/7110 */ -typedef struct { - char Name[15]; /* Name for SMS folder */ - bool SMSData; /* if folder contains sender, SMSC number and sending date */ - u8 locations[160]; /* locations of SMS messages in that folder (6210 specific) */ - u8 number; /* number of SMS messages in that folder*/ - u8 FolderID; /* ID od fthe current folder */ -} SMS_Folder; + Byte contains in SMS-Submit: -typedef struct { - SMS_Folder Folder[MAX_SMS_FOLDERS]; - u8 FolderID[MAX_SMS_FOLDERS]; /* ID specific for this folder and phone. */ - /* Used in internal functions. Do not use it. */ - u8 number; /* number of SMS folders */ -} SMS_FolderList; + TP-Message-Type-Indicator (2 bits) See GSM 03.40 section 9.2.3.1 -/*** CELL BROADCAST ***/ + TP-Reject-Duplicates (1 bit). See GSM 03.40 section + TP-Validity-Period-Format (2 bits).See GSM 03.40 section 9.2.3.3 -#define GSM_MAX_CB_MESSAGE (160) + TP-Reply-Path (1 bit). See GSM 03.40 section 9.2.3.17 + TP-User-Data-Header-Indicator (1 bit). See GSM 03.40 section 9.2.3.23 + TP-Status-Report-Request (1 bit). See GSM 03.40 section 9.2.3.5 */ +} GSM_ETSISMSMessage; -/* Define datatype for Cell Broadcast message */ -typedef struct { - int Channel; /* channel number */ - char Message[GSM_MAX_CB_MESSAGE + 1]; - int New; -} GSM_CBMessage; +int GSM_PackSemiOctetNumber (u8 *Number, u8 *Output, bool semioctet); +char *GSM_UnpackSemiOctetNumber(u8 *Number, bool semioctet); + +int GSM_UnpackEightBitsToSeven(int fillbits, int in_length, int out_length, unsigned char *input, unsigned char *output); +int GSM_PackSevenBitsToEight (int offset, unsigned char *input, unsigned char *output); + +GSM_Error GSM_EncodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI, SMS_MessageType PDU, int *length); +GSM_Error GSM_DecodeETSISMS(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI); + +GSM_Error GSM_EncodeSMSDateTime(GSM_DateTime *DT, unsigned char *req); + +GSM_Error GSM_DecodeETSISMSSubmitData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI); -extern int EncodePDUSMS(GSM_SMSMessage *SMS, char *frame); -extern GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageLength); +GSM_Error GSM_DecodeETSISMSStatusReportData(GSM_SMSMessage *SMS, GSM_ETSISMSMessage *ETSI); -/* Do not use these yet */ -extern GSM_Error EncodeTextSMS(); -extern GSM_Error DecodeTextSMS(unsigned char *message, GSM_SMSMessage *SMS); +void GSM_SetDefaultSMSData(GSM_SMSMessage *SMS); +GSM_Error EncodeUDHHeader(char *text, GSM_UDH UDHType); -/* We really do need this in the other code */ -extern char *GetBCDNumber(u8 *Number); -extern int SemiOctetPack(char *Number, unsigned char *Output, SMS_NumberType type); +int GSM_MakeSinglePartSMS2(GSM_SMSMessage *SMS, + unsigned char *MessageBuffer,int cur, GSM_UDH UDHType, GSM_Coding_Type Coding); +void GSM_MakeMultiPartSMS2(GSM_MultiSMSMessage *SMS, + unsigned char *MessageBuffer,int MessageLength, GSM_UDH UDHType, GSM_Coding_Type Coding); -#endif /* __gnokii_sms_h_ */ +#endif /* __gsm_sms_h */ diff --git a/include/misc.h b/include/misc.h index 2110b15..2a16e51 100644 --- a/include/misc.h +++ b/include/misc.h @@ -1,222 +1,125 @@ /* - $Id$ - G N O K I I A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Header file for miscellaneous defines, typedefs etc. - $Log$ - Revision 1.1.1.2 2001/11/27 04:19:40 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 05:17 CET 2001 - - Revision 1.27 2001/11/26 18:06:08 pkot - Checking for *printf functions, N_(x) for localization, generic ARRAY_LEN, SAFE_STRNCPY, G_GNUC_PRINTF (Jan Kratochvil) - - Revision 1.26 2001/11/14 10:46:12 pkot - Small cleanup with __unices__ - - Revision 1.25 2001/07/03 15:27:14 pkot - AT commands for SMS handling support (Tamas Bondar) - Small at-emulator code cleanup (me) - - Revision 1.24 2001/06/28 00:28:46 pkot - Small docs updates (Pawel Kot) - - */ #ifndef __misc_h #define __misc_h -#include "config.h" +#include +#include + +#ifndef VC6 + #include "config.h" + + /* Use gsprintf instead of sprintf and sprintf */ + #ifdef HAVE_SNPRINTF + # define gsprintf(a, b, c...) snprintf(a, b, c) + #else + # define gsprintf(a, b, c...) sprintf(a, c) + #endif + +#endif /* Some general defines. */ #ifndef false -# define false (0) + #define false (0) #endif #ifndef true -# define true (!false) + #define true (!false) #endif #ifndef bool -# define bool int + #define bool int #endif -#define ARRAY_LEN(x) (sizeof((x)) / sizeof((x)[0])) - -#define SAFE_STRNCPY(dest, src, n) do { \ - strncpy((dest), (src), (n)); \ - if ((n) > 0) \ - (dest)[(n)-1] = '\0'; \ - } while (0) - -#define SAFE_STRNCPY_SIZEOF(dest,src) \ - SAFE_STRNCPY((dest), (src), sizeof((dest))) - -/* Stolen from : */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) -# define G_GNUC_PRINTF( format_idx, arg_idx ) \ - __attribute__((format (printf, format_idx, arg_idx))) -#else /* !__GNUC__ */ -# define G_GNUC_PRINTF( format_idx, arg_idx ) -#endif /* !__GNUC__ */ - -#define GNOKII_MAX(a, b) (((a) > (b)) ? (a) : (b)) -#define GNOKII_MIN(a, b) (((a) < (b)) ? (a) : (b)) - -/* A define to make debug printfs neat */ -#ifndef DEBUG -# define dprintf(a...) do { } while (0) -#else -# define dprintf(a...) do { fprintf(stderr, a); fflush(stderr); } while (0) -#endif +/* This one is for NLS. */ -/* Use gsprintf instead of sprintf and sprintf */ -#ifdef HAVE_SNPRINTF -# define gsprintf(a, b, c...) snprintf(a, b, c) -#else -# define gsprintf(a, b, c...) sprintf(a, c) -#endif -#ifdef HAVE_VSNPRINTF -# define gvsprintf(a, b, c...) vsnprintf(a, b, c) -#else -# define gvsprintf(a, b, c...) vsprintf(a, c) -#endif -#ifdef HAVE_ASPRINTF -# define gasprintf(a...) asprintf(a) -#else -#include -extern int gasprintf(char **destp, const char *fmt,...); -#endif -#ifdef HAVE_VASPRINTF -# define gvasprintf(a...) vasprintf(a) -#else -#include -extern int gvasprintf(char **destp, const char *fmt, va_list ap); -#endif +#ifdef USE_NLS -/* Get rid of long defines. Use #if __unices__ */ -#define __unices__ defined(__svr4__) || defined(__FreeBSD__) || defined(__bsdi__) -#if __unices__ -# include -# include -#endif + #ifndef VC6 + #include + #define _(x) gettext(x) + #else + #define _(x) (x) + #endif -/* This one is for NLS. */ -#ifdef USE_NLS -# include -# define _(x) gettext(x) -# define N_(x) gettext_noop(x) #else -# define _(x) (x) -# define N_(x) (x) + #define _(x) (x) #endif /* USE_NLS */ /* Definitions for u8, u16, u32 and u64, borrowed from /usr/src/linux/include/asm-i38/types.h */ #ifndef u8 - typedef unsigned char u8; + typedef unsigned char u8; #endif #ifndef u16 - typedef unsigned short u16; + typedef unsigned short u16; #endif #ifndef u32 - typedef unsigned int u32; + typedef unsigned int u32; #endif #ifndef s32 - typedef int s32; + typedef int s32; #endif #if defined(__GNUC__) && !defined(__STRICT_ANSI__) -# ifndef u64 - typedef unsigned long long u64; -# endif + #ifndef u64 + typedef unsigned long long u64; + #endif -# ifndef s64 - typedef signed long long s64; -# endif + #ifndef s64 + typedef signed long long s64; + #endif #endif /* This one is for FreeBSD and similar systems without __ptr_t_ */ /* FIXME: autoconf should take care of this. */ + #ifndef __ptr_t - typedef void * __ptr_t; + typedef void * __ptr_t; #endif /* __ptr_t */ /* Add here any timer operations which are not supported by libc5 */ #ifndef HAVE_TIMEOPS -# ifdef WIN32 - -# include -# include -# define timersub(a, b, result) - do { - (result)->tv_sec = (a)->time - (b)->time; - (result)->tv_usec = ((a)->millitm - (b)->millitm) * 1000; - if ((result)->tv_usec < 0) { - --(result)->tv_sec; - (result)->tv_usec += 1000000; - } - } while (0) -# define gettimeofday(a, b) _ftime(a) - -# else /* !WIN32 */ -# include - -# ifndef timersub -# define timersub(a, b, result) \ - do { \ - (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ - (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ - if ((result)->tv_usec < 0) { \ - --(result)->tv_sec; \ - (result)->tv_usec += 1000000; \ - } \ - } while (0) -# endif /* timersub */ - -# endif /* WIN32 */ -#endif /* HAVE_TIMEOPS */ +#include + +#ifndef timersub +#define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif +#endif /* HAVE_TIMEOPS */ #include + extern int GetLine(FILE *File, char *Line, int count); -/* For models table */ -typedef struct { - char *model; - char *number; - int flags; -} PhoneModel; - -#define PM_CALLERGROUP 0x0001 -#define PM_NETMONITOR 0x0002 -#define PM_KEYBOARD 0x0004 -#define PM_SMS 0x0008 -#define PM_CALENDAR 0x0010 -#define PM_DTMF 0x0020 -#define PM_DATA 0x0040 -#define PM_SPEEDDIAL 0x0080 -#define PM_EXTPBK 0x0100 -#define PM_AUTHENTICATION 0x0200 - -extern char *GetModel (const char *); -extern PhoneModel *GetPhoneModel (const char *); +int mem_to_int(const char str[], int len); -#endif /* __misc_h */ +void hexdump(u16 MessageLength, u8 *MessageBuffer); +void txhexdump(u16 MessageLength, u8 *MessageBuffer); +#endif /* __misc_h */ diff --git a/packaging/Debian/README.debian b/packaging/Debian/README.debian index 7830020..97e2238 100644 --- a/packaging/Debian/README.debian +++ b/packaging/Debian/README.debian @@ -1,7 +1,6 @@ Gnokii for DEBIAN ------------------- -This package was debianized by Karel Zak and later -taken over by Erik Rossen . +This package was debianized by Karel Zak diff --git a/packaging/Debian/control b/packaging/Debian/control index d68850d..7414d1f 100644 --- a/packaging/Debian/control +++ b/packaging/Debian/control @@ -1,14 +1,11 @@ Source: gnokii Section: comm Priority: optional -Build-Depends: debhelper, libc6-dev, xlibs-dev, xutils, libgtk1.2-dev -Maintainer: Erik Rossen (Linux consultant) -Standards-Version: 3.1.0.0 +Maintainer: Karel Zak +Standards-Version: 2.4.0.0 Package: gnokii Architecture: any -Depends: adduser, ${shlibs:Depends} -Description: Linux/Unix tool suite for Nokia mobile phones - Gnokii is a Linux/Unix tool suite and (eventually) modem/fax driver - for Nokia mobile phones, released under the GPL. - +Depends: ${shlibs:Depends} +Description: Gnokii is a Linux/Unix tool suite and (eventually) + modem/fax driver for Nokia mobile phones, released under the GPL. \ No newline at end of file diff --git a/packaging/Debian/copyright b/packaging/Debian/copyright index 049061c..5b582e7 100644 --- a/packaging/Debian/copyright +++ b/packaging/Debian/copyright @@ -1,30 +1,16 @@ -GNOKII - A Linux/Unix toolset and driver for the Nokia 3x10/8110/51x0/61x0 - Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. +* Copyright (C) 1999-2000 Hugh Blemings & Pavel Janík ml. -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any later -version. +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place - Suite 330, Boston, MA 02111-1307, USA. - -You can contact authors by mail at - -hugh@linuxcare.com Pavel.Janik@suse.cz -Hugh Blemings Mgr. Pavel Janík, SuSE CR, s.r.o. -PO Box 234 Pod Pekárnami 338/12 -Belconnen ACT 2616 190 00 Praha 9 -Australia Czech Republic - -We would be delighted to receive a postcard from you if you use gnokii but -this is not a requirement of these licence terms! :) - -Any trademarks in this or other gnokii documents/files are the property of -their respective owners. diff --git a/packaging/Debian/docs b/packaging/Debian/docs index 43a1a30..8290213 100644 --- a/packaging/Debian/docs +++ b/packaging/Debian/docs @@ -4,10 +4,17 @@ Docs/README-3810 Docs/README-6110 Docs/README-2110 Docs/README-WIN32 +Docs/sample/gnokiirc +Docs/sample/options +Docs/sample/pap-secrets +Docs/sample/ppp-gnokii +Docs/sample/ppp-on Docs/DataCalls-QuickStart Docs/gettext-howto Docs/gnokii-ir-howto Docs/packaging-howto Docs/gnokii.nol Docs/FAQ +COPYING +INSTALL TODO diff --git a/packaging/Debian/menu b/packaging/Debian/menu index 2ccf430..51ae09d 100644 --- a/packaging/Debian/menu +++ b/packaging/Debian/menu @@ -1 +1 @@ -?package(gnokii):needs="X11" section="Apps/Net" title="XGnokii" command="/usr/bin/xgnokii" +?package(gnokii):needs=text section="Apps/Comm" title="XGnokii" command="/usr/bin/xgnokii" diff --git a/packaging/Debian/postinst b/packaging/Debian/postinst index 125800a..785ba4e 100644 --- a/packaging/Debian/postinst +++ b/packaging/Debian/postinst @@ -1,8 +1,3 @@ #!/bin/sh -e -echo 'Setting /usr/sbin/mgnokiidev SUID root, executable only by the "gnokii" group.' -echo 'Read /usr/share/doc/gnokii/FAQ and README concerning the security risk.' -chown root.gnokii /usr/sbin/mgnokiidev -chmod 4750 /usr/sbin/mgnokiidev - -#DEBHELPER# +/usr/sbin/groupdel gnokii diff --git a/packaging/Debian/preinst b/packaging/Debian/preinst index 82814da..593bbc7 100644 --- a/packaging/Debian/preinst +++ b/packaging/Debian/preinst @@ -1,11 +1,4 @@ #!/bin/sh -e -if [ -z "`grep -e '^gnokii:' /etc/group`" ] -then - /usr/sbin/groupadd gnokii -else - echo 'notice: group "gnokii" already exists' - echo 'I assume that you have used a gnokii before, Mr. Bond.' -fi +/usr/sbin/groupadd gnokii -#DEBHELPER# diff --git a/packaging/Debian/rules b/packaging/Debian/rules index d964aae..b48eee8 100755 --- a/packaging/Debian/rules +++ b/packaging/Debian/rules @@ -1,25 +1,16 @@ #!/usr/bin/make -f -export DH_VERBOSE=1 -export DH_COMPAT=3 - -export build_dir=$(shell pwd)/debian/gnokii +#export DH_VERBOSE=1 build: build-stamp build-stamp: dh_testdir -# if [ ! -f ./configure ] ; then autoconf ; fi ./configure --prefix=/usr --with-x -# ./configure --prefix=/usr --with-x --enable-debug --enable-xdebug --enable-rlpdebug make - touch build - touch build-stamp clean: dh_testdir dh_testroot - rm -f build build-stamp config.* - touch Makefile.global make clean dh_clean @@ -35,44 +26,27 @@ binary-arch: build dh_testdir dh_testroot dh_installdirs -# The following two lines are to prevent the install process from installing -# mgnokiidev owned by the probably not-yet-existing group "gnokii". mgnokiidev -# gets SGID after dpkg runs preinst which creates the group "gnokii". - mv utils/Makefile utils/Makefile.ORIG - sed 's#-o root -g gnokii -m 4750 ##' < utils/Makefile.ORIG > utils/Makefile -# - make install prefix=$(build_dir)/usr -# -# just to leave the sources in a pristine state... - mv utils/Makefile.ORIG utils/Makefile -# - mkdir -p $(build_dir)/etc - sed 's#/usr/local/sbin/#/usr/sbin/#' < Docs/sample/gnokiirc > $(build_dir)/etc/gnokiirc -# lintian complains if there are multiple licence files in one package, hence -# the next two commands - sed 's#"COPYING"#"file:/usr/share/doc/gnokii/copyright"#' < \ - xgnokii/docs/help/en_US/faq.html > \ - $(build_dir)/usr/share/xgnokii/help/en_US/faq.html - rm -f $(build_dir)/usr/share/xgnokii/help/en_US/COPYING -# lintian complains if there is a binary that does not have a man page. -# Pawel says that xlogos will soon be dumped anyways, so... - rm -f $(build_dir)/usr/bin/xlogos + make install prefix=`pwd`/debian/tmp/usr + mkdir -p `pwd`/debian/tmp/etc/ + sed 's#/usr/local/sbin/#/usr/sbin/#' < Docs/sample/gnokiirc > `pwd`/debian/tmp/etc/gnokiirc # dh_installdebconf - dh_installexamples +# dh_installexamples dh_installdocs dh_installmenu # dh_installemacsen # dh_installpam # dh_installinit # dh_installcron - dh_installman -# dh_installinfo +# dh_installmanpages + dh_installinfo # dh_undocumented dh_installchangelogs dh_link dh_strip dh_compress dh_fixperms + # You may want to make some executables suid here. + dh_suidregister # dh_makeshlibs dh_installdeb # dh_perl diff --git a/packaging/RedHat/gnokii.spec.in b/packaging/RedHat/gnokii.spec.in index 66f6d57..2d80a62 100644 --- a/packaging/RedHat/gnokii.spec.in +++ b/packaging/RedHat/gnokii.spec.in @@ -9,7 +9,7 @@ Release: %{release} Copyright: GPL Packager: Pavel Janik ml. , Jan Derfinak Group: Applications/Communications -Source: ftp://ftp.gnokii.org/pub/gnokii/%{name}-%{version}.tar.gz +Source: ftp://multivac.fatburen.org/pub/gnokii/%{name}-%{version}.tar.gz BuildRoot: /var/tmp/%{name}-%{version}-root %description @@ -55,11 +55,8 @@ rm -rf ${RPM_BUILD_ROOT} %doc Docs/CREDITS Docs/DataCalls-QuickStart Docs/FAQ Docs/README %doc Docs/README-3810 Docs/README-6110 Docs/README-2110 Docs/README-WIN32 %doc Docs/gettext-howto Docs/gnokii.nol Docs/gnokii-ir-howto Docs/packaging-howto -%doc Docs/README-dancall Docs/logos.txt Docs/gnokii.xpm Docs/Bugs %doc Docs/sample/gnokiirc Docs/sample/options Docs/sample/pap-secrets %doc Docs/sample/ppp-gnokii Docs/sample/ppp-on -%doc Docs/protocol/nk2110.txt Docs/protocol/nk3110.txt Docs/protocol/nk6110.txt Docs/protocol/nk6160.txt -%doc Docs/protocol/nk6185.txt Docs/protocol/nk640.txt Docs/protocol/nk7110.txt Docs/protocol/nokia.txt %attr(0750, root, gnokii) /usr/bin/gnokii %attr(0750, root, gnokii) /usr/sbin/gnokiid %attr(4750, root, gnokii) /usr/sbin/mgnokiidev @@ -67,21 +64,13 @@ rm -rf ${RPM_BUILD_ROOT} %files xgnokii %defattr(-,root,root) -/usr/X11R6/bin/xgnokii +/usr/bin/xgnokii +/usr/bin/xlogos /usr/bin/todologo -/usr/share/xgnokii +/usr/lib/xgnokii %changelog -* Fri Sep 28 2001 Pawel Kot -- last minute fixes. - -* Thu Sep 27 2001 Pawel Kot -- updates to 0.3.3 version - new docs, new ftp server - -* Sun Sep 2 2001 Pawel Kot -- removes xlogos - * Thu Jan 11 2001 Pawel Kot - misc updates diff --git a/packaging/Slackware/SlackBuild.in b/packaging/Slackware/SlackBuild.in index 0853b6a..d49b081 100644 --- a/packaging/Slackware/SlackBuild.in +++ b/packaging/Slackware/SlackBuild.in @@ -5,14 +5,11 @@ # Written by Pawe³ Kot # +ARCH=@ARCH@ PN=@PACKAGE@ PV=@VERSION@ -ARCH="i386" -BUILD=1 - -DOCS1="Docs/*" -DOCS2="Docs/protocol Docs/sample" +DOCS="COPYING ChangeLog VERSION Docs/CREDITS Docs/DataCalls-QuickStart Docs/README*" CONF="Docs/sample/gnokiirc" CWD=`pwd` @@ -37,26 +34,24 @@ tar xzvf $CWD/$PN-$PV.tar.gz cd $PN-$PV # Configure and make package -./configure --prefix=/usr --with-xgnokiidir=/usr/X11R6 i386-slackware-linux -make -make prefix=$PKG/usr xgnokii_libdir=$PKG/usr/X11R6 install +./configure --prefix=/usr --with-x --enable-nls $ARCH-slackware-linux || exit 1 +make || exit 1 +make prefix=$PKG/usr install || exit 1 # Copy the docs mkdir -p $PKG/usr/doc/$PN-$PV -cp $DOCS1 $PKG/usr/doc/$PN-$PV -cp -r $DOCS2 $PKG/usr/doc/$PN-$PV +cp -a $DOCS $PKG/usr/doc/$PN-$PV +chmod 644 $PKG/usr/doc/$PN-$PV # and the configuration mkdir -p $PKG/etc -sed "s|/usr/local/sbin|/usr/sbin|" < $CONF > $PKG/etc/gnokiirc.new +sed "s|/usr/local/sbin|/usr/sbin|" < $CONF > $PKG/etc/gnokiirc # Now, add gnokii group, set the permissions GROUPADD=`which groupadd` cd $PKG mkdir install cat > install/doinst.sh </dev/null 2>&1 chown root.gnokii /usr/bin/gnokii chmod 750 /usr/bin/gnokii @@ -64,17 +59,11 @@ chown root.gnokii /usr/sbin/gnokiid chmod 750 /usr/sbin/gnokiid chown root.gnokii /usr/sbin/mgnokiidev chmod 4750 /usr/sbin/mgnokiidev - -if [ -f /etc/gnokiirc ]; then - rm -f /etc/gnokiirc.new -else - mv /etc/gnokiirc.new /etc/gnokiirc -fi EOF # and build the package answering "yes" twice echo "y -y" | makepkg $TMP/$PN-$PV-$ARCH-$BUILD.tgz +y" | makepkg $TMP/$PN.tgz # Cleanup rm -rf $TMP/$PN-$PV diff --git a/packaging/make_dist b/packaging/make_dist index dabbd24..614d028 100755 --- a/packaging/make_dist +++ b/packaging/make_dist @@ -21,7 +21,6 @@ cp -r ../../gnokii /tmp/gnokii-${VERSION} # Some files and directories in CVS are useless rm -rf /tmp/gnokii-${VERSION}/xkeyb -rm -rf /tmp/gnokii-${VERSION}/xlogo* ( cd /tmp/gnokii-${VERSION} diff --git a/po/Makefile.in.in b/po/Makefile.in.in index f9aa397..94a1088 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.in @@ -1,6 +1,6 @@ # # -# Makefile for gnokii I18n, +# Makefile for gnokii I18n, # based on the Makefile.in.in that comes with gettext # # Erwin Dieterich, 20. 1. 1998 Erwin.Dieterich.ED@Bayer-AG.de @@ -55,7 +55,7 @@ DEFS = @DEFS@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -INCLUDES = -I.. +INCLUDES = -I.. COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) @@ -68,7 +68,7 @@ CATOBJEXT = @CATOBJEXT@ INSTOBJEXT = @INSTOBJEXT@ .SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo .mo .msg +.SUFFIXES: .c .o .po .pox .gmo .mo .msg .c.o: $(COMPILE) $< @@ -84,8 +84,6 @@ INSTOBJEXT = @INSTOBJEXT@ file=`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) -o $$file $< - - all: all-@USE_NLS@ all-yes: $(PACKAGE).pot $(CATALOGS) @@ -95,12 +93,13 @@ all-no: $(PACKAGE).pot: $(POTFILES) if test -n "$(XGETTEXT)"; then \ $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(srcdir)/.. \ - --c++ --keyword=_ --files-from=$(srcdir)/POTFILES.in; \ + --keyword=_ --files-from=$(srcdir)/POTFILES.in; \ mv $(PACKAGE).po $(PACKAGE).pot; \ else \ echo "xgettext not available: $(PACKAGE).pot not updated" 1>&2; \ fi +makelib: all-@USE_NLS@ install: install-exec install-data install-exec: diff --git a/po/POTFILES.in b/po/POTFILES.in index 4d03e12..7e766df 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,34 +1,22 @@ -common/cfgreader.c +common/protocol/fbus.c +common/protocol/mbus.c +common/newmodules/n7110.c +common/newmodules/n6110.c +common/files/cfgreader.c +common/gsm-ringtones.c +common/gsm-bitmaps.c +common/data/at-emulator.c common/data/rlp-common.c common/data/virtmodem.c -common/devices/unixserial.c -common/gsm-bitmaps.c -common/gsm-filetypes.c -common/gsm-ringtones.c -common/links/cbus.c -common/links/fbus.c -common/links/fbus-phonet.c -common/misc.c -common/phones/generic.c -common/phones/nk7110.c -common/phones/nk6100.c -common/phones/nk3110.c -common/phones/nk2110.c -common/vcal.c -common/vcal.lx -gnokiid/gnokiid.c gnokii/gnokii.c -smsd/lowlevel.c +gnokiid/gnokiid.c xgnokii/xgnokii.c -xgnokii/xgnokii_calendar.c xgnokii/xgnokii_cfg.c xgnokii/xgnokii_common.c xgnokii/xgnokii_contacts.c -xgnokii/xgnokii_data.c xgnokii/xgnokii_dtmf.c -xgnokii/xgnokii_logos.c -xgnokii/xgnokii_lowlevel.c xgnokii/xgnokii_netmon.c xgnokii/xgnokii_sms.c xgnokii/xgnokii_speed.c xgnokii/xgnokii_xkeyb.c +xgnokii/xgnokii_logos.c diff --git a/po/et.po b/po/et.po index 42417ea..9df54cb 100644 --- a/po/et.po +++ b/po/et.po @@ -1,12 +1,8 @@ -# Nokia DataSuite asendaja Linux keskkonnas GNOKII eestindus. -# Copyright (C) 2000 Free Software Foundation, Inc. -# Hans Mõtshärg ,2000 -# msgid "" msgstr "" "Project-Id-Version: gnokii\n" -"POT-Creation-Date: 2001-02-01 14:12+0200\n" -"PO-Revision-Date: 2001-01-01 11:43:00+0200\n" +"POT-Creation-Date: 2000-09-09 23:32+0200\n" +"PO-Revision-Date: 2000-09-11 06:20:00+0200\n" "Last-Translator: Hans Mõtshärg \n" "Language-Team: gnokii\n" "MIME-Version: 1.0\n" @@ -16,91 +12,91 @@ msgstr "" "Files: fbus-3810.h fbus-6110.h gsm-api.h gsm-common.h misc.h fbus-3810.c " "fbus-6110.c gnokii.c gsm-api.c\n" -#: common/fbus-3810.c:582 common/fbus-6110.c:1649 +#: common/fbus-3810.c:521 common/fbus-6110.c:2186 #, c-format msgid "Sending SMS to %s via message center %s\n" msgstr "Saadan SMS'i %s kasutades saatekeskust %s\n" -#: common/fbus-3810.c:686 +#: common/fbus-3810.c:625 #, c-format msgid "SMS Send attempt failed, trying again (%d of %d)\n" msgstr "SMS saatmine ebaõnnestus, proovin veel (katse %d %d-st)\n" -#: common/fbus-3810.c:1304 -msgid "Couldn't open FB38 device" -msgstr "Ei suuda avada FB38 seadet:" +#: common/fbus-3810.c:1196 +msgid "Couldn't open FB38 device: " +msgstr "Ei suuda avada FB38 seadet: " -#: common/fbus-3810.c:1397 +#: common/fbus-3810.c:1288 msgid "restarting.\n" msgstr "käivitun uuesti.\n" -#: common/fbus-3810.c:1453 +#: common/fbus-3810.c:1344 #, c-format msgid "MT Fail %02x" msgstr "MT Viga %02x" -#: common/fbus-3810.c:1460 common/mbus-6160.c:992 +#: common/fbus-3810.c:1351 common/mbus-6160.c:1202 #, c-format msgid "CS Fail %02x != %02x" msgstr "CS Viga %02x != %02x" -#: common/fbus-3810.c:1572 +#: common/fbus-3810.c:1465 #, c-format msgid "0x15 Registration Response 0x%02x\n" msgstr "0x15 Registreerimise vastus 0x%02x\n" -#: common/fbus-3810.c:1588 +#: common/fbus-3810.c:1481 #, c-format msgid "0x16 Registration Response 0x%02x\n" msgstr "0x15 Registreerimise vastus 0x%02x\n" -#: common/fbus-3810.c:1589 +#: common/fbus-3810.c:1482 #, c-format msgid "SIM access: %s.\n" msgstr "" -#: common/fbus-3810.c:1665 +#: common/fbus-3810.c:1558 #, c-format msgid "SMS Stored into location 0x%02x\n" msgstr "SMS salvestatud 0x%02x\n" -#: common/fbus-3810.c:1675 +#: common/fbus-3810.c:1568 #, c-format msgid "SMS Store failed: 0x%02x\n" msgstr "SMS salvestamine 0x%02x ebaõnnestus\n" -#: common/fbus-3810.c:1796 +#: common/fbus-3810.c:1689 msgid "PIN [possibly] entered.\n" msgstr "PIN [tõenäoliselt] sisestatud.\n" -#: common/fbus-3810.c:1805 +#: common/fbus-3810.c:1698 msgid "Phone powering off..." msgstr "Telefon lülitub välja" -#: common/fbus-3810.c:1834 common/mbus-6160.c:599 +#: common/fbus-3810.c:1727 common/mbus-6160.c:809 msgid "Standard Ack write failed!" msgstr "" -#: common/fbus-3810.c:1860 +#: common/fbus-3810.c:1753 msgid "Unknown: " msgstr "Tundmatu: " -#: common/fbus-3810.c:1862 +#: common/fbus-3810.c:1755 #, c-format msgid "Msg Type: %02x " msgstr "Msg Tüüp: %02x " -#: common/fbus-3810.c:1863 +#: common/fbus-3810.c:1756 #, c-format msgid "Msg Len: %02x " msgstr "Msg pikkus: %02x" -#: common/fbus-3810.c:1864 +#: common/fbus-3810.c:1757 #, c-format msgid "Sequence Number: %02x " msgstr "Järjenumber: %02x " -#: common/fbus-3810.c:1865 +#: common/fbus-3810.c:1758 #, c-format msgid "" "Checksum: %02x \n" @@ -109,130 +105,130 @@ msgstr "" "Kontrollsumma: %02x \n" " " -#: common/fbus-3810.c:1957 common/fbus-3810.c:2087 +#: common/fbus-3810.c:1850 common/fbus-3810.c:1980 msgid "Set Mem Loc Write failed!" msgstr "" -#: common/fbus-3810.c:2002 +#: common/fbus-3810.c:1895 msgid "TX_SendRLPFrame - write:" msgstr "" -#: common/fbus-3810.c:2014 +#: common/fbus-3810.c:1907 msgid "Request HangupMessage Write failed!" msgstr "" -#: common/fbus-3810.c:2026 +#: common/fbus-3810.c:1919 msgid "0x4a Write failed!" msgstr "0x4a Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2041 +#: common/fbus-3810.c:1934 msgid "Explore Write failed!" msgstr "" -#: common/fbus-3810.c:2051 +#: common/fbus-3810.c:1944 msgid "0x3f Write failed!" msgstr "0x3f Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2111 +#: common/fbus-3810.c:2004 msgid "Request Mem Loc Write failed!" msgstr "" -#: common/fbus-3810.c:2124 +#: common/fbus-3810.c:2017 msgid "Request IMEI/Revision/Model Write failed!" msgstr "" -#: common/fbus-3810.c:2167 +#: common/fbus-3810.c:2060 msgid "Send SMS header failed!" msgstr "SMS päise saatmine ebaõnnestus!" -#: common/fbus-3810.c:2226 +#: common/fbus-3810.c:2119 msgid "Store SMS header failed!" msgstr "SMS päise salvestamine ebaõnnestus!" -#: common/fbus-3810.c:2251 +#: common/fbus-3810.c:2144 #, c-format msgid "Send SMS block %d failed!" msgstr "" -#: common/fbus-3810.c:2274 +#: common/fbus-3810.c:2167 msgid "Request SMS Mem Loc Write failed!" msgstr "" -#: common/fbus-3810.c:2297 +#: common/fbus-3810.c:2190 msgid "Delete SMS Mem Loc write failed!" msgstr "SMS kustutamine mälupesast ebaõnnestus!" -#: common/fbus-3810.c:2316 +#: common/fbus-3810.c:2209 msgid "0x15 Write failed!" msgstr "0x15 Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2333 common/mbus-6160.c:1070 +#: common/fbus-3810.c:2226 common/mbus-6160.c:1280 msgid "TX_SendMessage - message too long!\n" msgstr "TX_SendMessage - sõnum on liiga pikk!\n" -#: common/fbus-3810.c:2359 common/mbus-6160.c:873 common/mbus-6160.c:1102 +#: common/fbus-3810.c:2252 common/mbus-6160.c:1083 common/mbus-6160.c:1312 msgid "TX_SendMessage - write:" msgstr "TX_SendMessage - kirjuta:" -#: common/fbus-3810.c:2372 common/fbus-3810.c:2508 common/fbus-3810.c:2526 -#: common/fbus-3810.c:2544 common/fbus-3810.c:2558 common/fbus-3810.c:2692 -#: common/fbus-3810.c:2753 common/fbus-3810.c:2812 common/fbus-3810.c:2852 +#: common/fbus-3810.c:2265 common/fbus-3810.c:2398 common/fbus-3810.c:2412 +#: common/fbus-3810.c:2426 common/fbus-3810.c:2440 common/fbus-3810.c:2574 +#: common/fbus-3810.c:2635 common/fbus-3810.c:2694 common/fbus-3810.c:2732 msgid "Write failed!" msgstr "Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2386 +#: common/fbus-3810.c:2279 #, c-format msgid "Incoming call - Type: %s. %02x, Number %s.\n" msgstr "Saabuv kõne - Tüüp: %s. %02x, Number %s.\n" -#: common/fbus-3810.c:2413 +#: common/fbus-3810.c:2306 msgid "0x27 Write failed!" msgstr "0x27 Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2461 +#: common/fbus-3810.c:2354 msgid "0x4b Write failed!" msgstr "0x4b Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2480 +#: common/fbus-3810.c:2373 #, c-format msgid "Status: %s. Batt %02x RF %02x.\n" msgstr "Olek: %s Batt %02x RF %02x.\n" -#: common/fbus-3810.c:2491 +#: common/fbus-3810.c:2384 msgid "0x10 Write failed!" msgstr "0x10 Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2495 +#: common/fbus-3810.c:2388 msgid "Call terminated from phone (0x10 message).\n" msgstr "Kõne telefonilt katkestatud (0x10 teade).\n" -#: common/fbus-3810.c:2512 +#: common/fbus-3810.c:2402 msgid "Call terminated from opposite end of line (or from network).\n" msgstr "Kõne katkestatud vastuvõtja või võrgu poolt.\n" -#: common/fbus-3810.c:2530 +#: common/fbus-3810.c:2416 msgid "Call terminated from phone (0x12 message).\n" msgstr "Väljuv kõne katkestatud (0x12 teade).\n" -#: common/fbus-3810.c:2548 +#: common/fbus-3810.c:2430 msgid "Incoming call answered from phone.\n" msgstr "Saabuv kõne vastatud.\n" -#: common/fbus-3810.c:2562 +#: common/fbus-3810.c:2444 #, c-format msgid "%s call established - status bytes %02x %02x.\n" msgstr "%s kõne moodustatud - staatuse bitid %02x %02x.\n" -#: common/fbus-3810.c:2579 +#: common/fbus-3810.c:2461 msgid "0x2c Write failed!" msgstr "0x2c Kirjutamine ebaõnnestus!" -#: common/fbus-3810.c:2666 +#: common/fbus-3810.c:2548 #, c-format msgid "PID:%02x DCS:%02x Timezone:%02x Stat1:%02x Stat2:%02x\n" msgstr "PID:%02x DCS:%02x Ajavöönd:%02x Stat1:%02x Stat2:%02x\n" -#: common/fbus-3810.c:2733 +#: common/fbus-3810.c:2615 #, c-format msgid "" "Incoming SMS %d/%d/%d %d:%02d:%02d tz:0x%02x Sender: %s(Type %02x) Msg " @@ -241,7 +237,7 @@ msgstr "" "Saabuv SMS sõnum %d/%d/%d %d:%02d:%02d AV:0x%02x Saatja: %s(%02x tüüpi) Msg " "Keskus: %s\n" -#: common/fbus-3810.c:2735 +#: common/fbus-3810.c:2617 #, c-format msgid "" " Msg Length %d, Msg memory %d Msg number %d, PID: %02x DCS: %02x Unknown: " @@ -250,1236 +246,1227 @@ msgstr "" " Msg pikkus %d, Msg mälukoht %d Msg number %d, PID: %02x DCS: %02x " "Tundmatud baidid: %02x\n" -#: common/fbus-3810.c:2828 +#: common/fbus-3810.c:2710 msgid "Mobile phone identification received:\n" msgstr "Mobiiltelefeni identifikaator saabus:\n" -#: common/fbus-3810.c:2829 +#: common/fbus-3810.c:2711 #, c-format msgid " IMEI: %s\n" msgstr " IMEI: %s\n" -#: common/fbus-3810.c:2831 +#: common/fbus-3810.c:2713 #, c-format msgid " Model: %s\n" msgstr " Mudel: %s\n" -#: common/fbus-3810.c:2833 +#: common/fbus-3810.c:2715 #, c-format msgid " Revision: %s\n" msgstr " Versioon: %s\n" -#: common/fbus-3810.c:2907 +#: common/fbus-3810.c:2783 msgid "SMS Message Center Data:\n" msgstr "SMS Keskuse info: \n" -#: common/fbus-3810.c:2908 +#: common/fbus-3810.c:2784 #, c-format msgid "Selected memory: 0x%02x\n" msgstr "Valitud mälu: 0x%02x\n" -#: common/fbus-3810.c:2909 +#: common/fbus-3810.c:2785 #, c-format msgid "Messages in Phone: 0x%02x Unread: 0x%02x\n" msgstr "Lühisõnumeid Telefonis: 0x%02x Lugemata: 0x%02x\n" -#: common/fbus-3810.c:2911 +#: common/fbus-3810.c:2787 #, c-format msgid "Messages in SIM: 0x%02x Unread: 0x%02x\n" msgstr "Lühisõnumeid SIM kaardil: 0x%02x Lugemata: 0x%02x\n" -#: common/fbus-3810.c:2913 +#: common/fbus-3810.c:2789 #, c-format msgid "Reply via own centre: 0x%02x (%s)\n" msgstr "" -#: common/fbus-3810.c:2915 +#: common/fbus-3810.c:2791 #, c-format msgid "Delivery reports: 0x%02x (%s)\n" msgstr "Saateraport: 0x%02x (%s)\n" -#: common/fbus-3810.c:2917 +#: common/fbus-3810.c:2793 #, c-format msgid "Messages sent as: 0x%02x\n" msgstr "Sõnum saadetud nagu 0x%02x\n" -#: common/fbus-3810.c:2918 +#: common/fbus-3810.c:2794 #, c-format msgid "Message validity: 0x%02x\n" msgstr "Sõnumi kehtivus on 0x%02x\n" -#: common/fbus-3810.c:2919 +#: common/fbus-3810.c:2795 #, c-format msgid "Unknown: 0x%02x\n" msgstr "Tundmatu: 0x%02x\n" -#: common/fbus-3810.c:2922 +#: common/fbus-3810.c:2798 msgid "UnknownNumber field empty." msgstr "TundmatuNumber väli on tühi." -#: common/fbus-3810.c:2924 +#: common/fbus-3810.c:2800 msgid "UnknownNumber: " msgstr "TundmatuNumber: " -#: common/fbus-3810.c:2931 +#: common/fbus-3810.c:2807 msgid "Number field empty." msgstr "Numbriväli on tühi." -#: common/fbus-3810.c:2934 xgnokii/xgnokii_calendar.c:229 +#: common/fbus-3810.c:2810 msgid "Number: " msgstr "Number: " -#: common/fbus-6110-ringtones.c:352 -#, c-format -msgid "Error in PackRingtone - StartBit different to HowLong %d - %d)\n" -msgstr "" - -#: common/fbus-6110-ringtones.c:411 -msgid "Not header\n" -msgstr "" - -#: common/fbus-6110-ringtones.c:418 -msgid "Not RingingToneProgramming\n" -msgstr "" - -#: common/fbus-6110-ringtones.c:429 -msgid "Not Sound\n" -msgstr "" - -#: common/fbus-6110-ringtones.c:436 -msgid "Not BasicSongType\n" -msgstr "" - -#: common/fbus-6110-ringtones.c:454 -msgid "Not PatternHeaderId\n" -msgstr "" - -#: common/fbus-6110-ringtones.c:556 -msgid "Unsupported block\n" -msgstr "" - -#: common/fbus-6110.c:761 +#: common/fbus-6110.c:891 msgid "Timeout in IR-mode\n" msgstr "" -#: common/fbus-6110.c:795 +#: common/fbus-6110.c:923 msgid "Couldn't open FB61 infrared device" msgstr "Ei suuda avada FB61 IR-seadet" -#: common/fbus-6110.c:875 +#: common/fbus-6110.c:991 msgid "Starting IR mode...!\n" msgstr "Alustan IR ühendust...!\n" -#: common/fbus-6110.c:2051 gnokii/gnokii.c:978 gnokii/gnokii.c:1808 -#: gnokii/gnokii.c:3215 gnokii/gnokii.c:3242 +#: common/fbus-6110.c:2570 gnokii/gnokii.c:1056 gnokii/gnokii.c:1850 +#: gnokii/gnokii.c:3291 gnokii/gnokii.c:3318 msgid "Send succeeded!\n" msgstr "Saatmine õnnestus!\n" -#: common/fbus-6110.c:2052 gnokii/gnokii.c:980 gnokii/gnokii.c:1810 -#: gnokii/gnokii.c:3217 +#: common/fbus-6110.c:2572 gnokii/gnokii.c:1058 gnokii/gnokii.c:1852 +#: gnokii/gnokii.c:3293 #, c-format msgid "SMS Send failed (error=%d)\n" msgstr "SMS saatmine ebaõnnestus (viga=%d)\n" -#: common/fbus-6110.c:2075 +#: common/fbus-6110.c:2603 msgid "Serial flags dump:\n" msgstr "Serialpordi lippude olek:\n" -#: common/fbus-6110.c:2076 common/mbus-640.c:774 +#: common/fbus-6110.c:2604 common/mbus-640.c:928 #, c-format msgid "DTR is %s.\n" msgstr "DTR on %s.\n" -#: common/fbus-6110.c:2076 common/fbus-6110.c:2077 common/fbus-6110.c:2078 -#: common/fbus-6110.c:2079 common/mbus-640.c:774 common/mbus-640.c:775 +#: common/fbus-6110.c:2604 common/fbus-6110.c:2605 common/fbus-6110.c:2606 +#: common/fbus-6110.c:2607 common/mbus-640.c:928 common/mbus-640.c:929 msgid "up" -msgstr "püsti" +msgstr "toimib" -#: common/fbus-6110.c:2076 common/fbus-6110.c:2077 common/fbus-6110.c:2078 -#: common/fbus-6110.c:2079 common/mbus-640.c:774 common/mbus-640.c:775 +#: common/fbus-6110.c:2604 common/fbus-6110.c:2605 common/fbus-6110.c:2606 +#: common/fbus-6110.c:2607 common/mbus-640.c:928 common/mbus-640.c:929 msgid "down" -msgstr "pikali" +msgstr "maas" -#: common/fbus-6110.c:2077 common/mbus-640.c:775 +#: common/fbus-6110.c:2605 common/mbus-640.c:929 #, c-format msgid "RTS is %s.\n" msgstr "RTS on %s.\n" -#: common/fbus-6110.c:2078 +#: common/fbus-6110.c:2606 #, c-format msgid "CAR is %s.\n" msgstr "CAR on %s.\n" -#: common/fbus-6110.c:2079 +#: common/fbus-6110.c:2607 #, c-format msgid "CTS is %s.\n" msgstr "CTS on %s.\n" -#: common/fbus-6110.c:2112 +#: common/fbus-6110.c:2642 msgid "Setting FBUS communication...\n" -msgstr "Seadistan FBUS ühendust...\n" +msgstr "Tekitan FBUS ühendust...\n" -#: common/fbus-6110.c:2146 +#: common/fbus-6110.c:2673 msgid "Couldn't open FB61 device" msgstr "Ei suuda avada FB61 seadet" -#: common/fbus-6110.c:2253 +#: common/fbus-6110.c:2800 msgid "Message: Call message, type 0x02:" msgstr "Teade: Kõneteade, tüüp 0x02:" -#: common/fbus-6110.c:2254 common/fbus-6110.c:2261 common/fbus-6110.c:2326 +#: common/fbus-6110.c:2801 common/fbus-6110.c:2813 common/fbus-6110.c:2915 msgid " Exact meaning not known yet, sorry :-(\n" msgstr " Täpne tagamõte hetkel tundmatu ... :-(\n" -#: common/fbus-6110.c:2259 +#: common/fbus-6110.c:2811 msgid "Message: Call message, type 0x03:" msgstr "Teade: Kõneteade, tüüp 0x03:" -#: common/fbus-6110.c:2260 common/fbus-6110.c:2271 common/fbus-6110.c:2280 -#: common/fbus-6110.c:2299 common/fbus-6110.c:2305 common/fbus-6110.c:2325 +#: common/fbus-6110.c:2812 common/fbus-6110.c:2828 common/fbus-6110.c:2846 +#: common/fbus-6110.c:2877 common/fbus-6110.c:2888 common/fbus-6110.c:2914 #, c-format msgid " Sequence nr. of the call: %d\n" msgstr " Kõne järjenumber: %d\n" -#: common/fbus-6110.c:2270 +#: common/fbus-6110.c:2827 msgid "Message: Remote end hang up.\n" msgstr "Teade: Teine pool katkestas kõne.\n" -#: common/fbus-6110.c:2277 +#: common/fbus-6110.c:2841 msgid "Message: Incoming call alert:\n" msgstr "Teade: Saabuva kõne hoiatus:\n" -#: common/fbus-6110.c:2281 common/fbus-6110.c:2476 +#: common/fbus-6110.c:2847 common/fbus-6110.c:3130 msgid " Number: " msgstr " Number: " -#: common/fbus-6110.c:2286 common/fbus-6110.c:2464 +#: common/fbus-6110.c:2855 common/fbus-6110.c:3114 msgid " Name: " msgstr " Nimi: " -#: common/fbus-6110.c:2298 +#: common/fbus-6110.c:2876 msgid "Message: Call answered.\n" msgstr "Sõnum: Kõne vastatud.\n" -#: common/fbus-6110.c:2304 +#: common/fbus-6110.c:2887 msgid "Message: Call ended by your phone.\n" msgstr "Teade: Kõne lõpetatud oma telefoni poolt.\n" -#: common/fbus-6110.c:2324 +#: common/fbus-6110.c:2913 msgid "Message: Call message, type 0x0a:" msgstr "Teade: Kõneteade, tüüp 0x0a:" -#: common/fbus-6110.c:2333 +#: common/fbus-6110.c:2926 msgid "Message: Unknown message of type 0x01\n" msgstr "Teade: Tundmatu 0x01 tüüpi sõnum\n" -#: common/fbus-6110.c:2343 +#: common/fbus-6110.c:2944 msgid "Message: SMS Message correctly sent.\n" msgstr "Teade: SMS sõnum korrektselt saadetud.\n" -#: common/fbus-6110.c:2348 +#: common/fbus-6110.c:2955 msgid "Message: Sending SMS Message failed.\n" msgstr "Teade: SMS sõnumi saatmine ebaõnnestus.\n" -#: common/fbus-6110.c:2353 +#: common/fbus-6110.c:2964 msgid "Message: SMS Message Received\n" msgstr "Teade: SMS sõnum saabus\n" -#: common/fbus-6110.c:2354 common/fbus-6110.c:3299 +#: common/fbus-6110.c:2965 common/fbus-6110.c:4407 #, c-format msgid " SMS center number: %s\n" msgstr " SMS keskuse number: %s\n" -#: common/fbus-6110.c:2358 common/fbus-6110.c:3300 +#: common/fbus-6110.c:2969 common/fbus-6110.c:4408 #, c-format msgid " Remote number: %s\n" msgstr " Teise poole number: %s\n" -#: common/fbus-6110.c:2359 +#: common/fbus-6110.c:2970 #, c-format msgid " Date: %s\n" msgstr " Kuupäev: %s\n" -#: common/fbus-6110.c:2360 +#: common/fbus-6110.c:2971 msgid " SMS: " msgstr " SMS: " -#: common/fbus-6110.c:2370 -msgid "Message: Cell Broadcast enabled/disabled successfully.\n" -msgstr "" - -#: common/fbus-6110.c:2379 -msgid "Message: CB received.\n" -msgstr "" - -#: common/fbus-6110.c:2380 -#, c-format -msgid "Message: channel number %i\n" -msgstr "Teade: kanal number %i\n" - -#: common/fbus-6110.c:2392 +#: common/fbus-6110.c:2986 msgid "Message: SMS Center correctly set.\n" msgstr "Teade: SMS keskus korrektselt paigas.\n" -#: common/fbus-6110.c:2404 +#: common/fbus-6110.c:3002 msgid "Message: SMS Center received:\n" msgstr "Teade: SMS keskus saabus:\n" -#: common/fbus-6110.c:2405 +#: common/fbus-6110.c:3003 #, c-format msgid " %d. SMS Center name is %s\n" msgstr " %d. SMS Keskuse nimi on %s\n" -#: common/fbus-6110.c:2406 +#: common/fbus-6110.c:3004 #, c-format msgid " SMS Center number is %s\n" msgstr " SMS keskuse number on %s\n" -#: common/fbus-6110.c:2407 +#: common/fbus-6110.c:3006 msgid " SMS Center message format is " msgstr " SMS keskuse teate formaat on " -#: common/fbus-6110.c:2410 gnokii/gnokii.c:1117 xgnokii/xgnokii.c:546 -#: xgnokii/xgnokii.c:575 xgnokii/xgnokii.c:1445 xgnokii/xgnokii_calendar.c:862 +#: common/fbus-6110.c:3011 gnokii/gnokii.c:1149 xgnokii/xgnokii.c:528 +#: xgnokii/xgnokii.c:557 xgnokii/xgnokii.c:1384 msgid "Text" msgstr "Tekst" -#: common/fbus-6110.c:2411 gnokii/gnokii.c:1121 xgnokii/xgnokii.c:550 -#: xgnokii/xgnokii.c:1459 +#: common/fbus-6110.c:3015 gnokii/gnokii.c:1153 xgnokii/xgnokii.c:532 +#: xgnokii/xgnokii.c:1398 msgid "Paging" -msgstr "Piipar" +msgstr "" -#: common/fbus-6110.c:2412 gnokii/gnokii.c:1125 xgnokii/xgnokii.c:554 -#: xgnokii/xgnokii.c:1452 xgnokii/xgnokii_contacts.c:1784 +#: common/fbus-6110.c:3019 gnokii/gnokii.c:1157 xgnokii/xgnokii.c:536 +#: xgnokii/xgnokii.c:1391 msgid "Fax" msgstr "Faks" -#: common/fbus-6110.c:2413 gnokii/gnokii.c:1130 +#: common/fbus-6110.c:3023 gnokii/gnokii.c:1162 msgid "Email" msgstr "" -#: common/fbus-6110.c:2414 common/fbus-6110.c:2428 common/fbus-6110.c:3467 -#: common/fbus-6110.c:3879 gnokii/gnokii.c:1142 gnokii/gnokii.c:1176 -#: xgnokii/xgnokii_calendar.c:153 +#: common/fbus-6110.c:3027 common/fbus-6110.c:3061 common/fbus-6110.c:4629 +#: common/fbus-6110.c:5167 gnokii/gnokii.c:1174 gnokii/gnokii.c:1208 msgid "Unknown" msgstr "Tundmatu" -#: common/fbus-6110.c:2419 +#: common/fbus-6110.c:3032 msgid " SMS Center message validity is " msgstr " SMS keskuse teate kehtivusaeg on " -#: common/fbus-6110.c:2422 gnokii/gnokii.c:1152 +#: common/fbus-6110.c:3037 gnokii/gnokii.c:1184 msgid "1 hour" msgstr "1 tund" -#: common/fbus-6110.c:2423 gnokii/gnokii.c:1156 +#: common/fbus-6110.c:3041 gnokii/gnokii.c:1188 msgid "6 hours" msgstr "6 tundi" -#: common/fbus-6110.c:2424 gnokii/gnokii.c:1160 +#: common/fbus-6110.c:3045 gnokii/gnokii.c:1192 msgid "24 hours" msgstr "24 tundi" -#: common/fbus-6110.c:2425 gnokii/gnokii.c:1164 +#: common/fbus-6110.c:3049 gnokii/gnokii.c:1196 msgid "72 hours" msgstr "72 tundi" -#: common/fbus-6110.c:2426 gnokii/gnokii.c:1168 xgnokii/xgnokii.c:598 -#: xgnokii/xgnokii.c:1524 +#: common/fbus-6110.c:3053 gnokii/gnokii.c:1200 xgnokii/xgnokii.c:580 +#: xgnokii/xgnokii.c:1463 msgid "1 week" msgstr "1 nädal" -#: common/fbus-6110.c:2427 gnokii/gnokii.c:1172 +#: common/fbus-6110.c:3057 gnokii/gnokii.c:1204 msgid "Maximum time" msgstr "Maksimaalne aeg" -#: common/fbus-6110.c:2438 +#: common/fbus-6110.c:3079 msgid "Message: SMS Center error received:\n" msgstr "Teade: SMS keskuse viga saabus:\n" -#: common/fbus-6110.c:2439 +#: common/fbus-6110.c:3080 msgid " The request for SMS Center failed.\n" msgstr " Sõnumikeskuse päring ebaõnnestus.\n" -#: common/fbus-6110.c:2446 +#: common/fbus-6110.c:3091 msgid "Unknown message!\n" msgstr "Tundmatu sõnum!\n" -#: common/fbus-6110.c:2463 +#: common/fbus-6110.c:3113 msgid "Message: Phonebook entry received:\n" msgstr "Teade: Telefoniraamatu kirje saabus:\n" -#: common/fbus-6110.c:2492 +#: common/fbus-6110.c:3150 msgid " Date: " msgstr " Kuupäev: " -#: common/fbus-6110.c:2494 +#: common/fbus-6110.c:3152 msgid " Time: " msgstr " Kellaaeg: " -#: common/fbus-6110.c:2504 +#: common/fbus-6110.c:3165 msgid "Message: Phonebook read entry error received:\n" msgstr "Teade: Telefoniraamatu lugemise viga saabus:\n" -#: common/fbus-6110.c:2507 +#: common/fbus-6110.c:3173 msgid " Invalid memory type!\n" msgstr " Vale mälu tüüp!\n" -#: common/fbus-6110.c:2511 common/fbus-6110.c:2534 +#: common/fbus-6110.c:3183 common/fbus-6110.c:3221 msgid " Unknown error!\n" msgstr " Tundmatu viga!\n" -#: common/fbus-6110.c:2518 +#: common/fbus-6110.c:3194 msgid "Message: Phonebook written correctly.\n" msgstr "Teade: Telefoniraamat korrektselt kirjutatud.\n" -#: common/fbus-6110.c:2529 +#: common/fbus-6110.c:3211 msgid "Message: Phonebook not written - name is too long.\n" msgstr "Teade: Telefoniraamatusse ei kirjutatud - nimi on liiga pikk.\n" -#: common/fbus-6110.c:2542 +#: common/fbus-6110.c:3232 msgid "Message: Memory status received:\n" msgstr "Teade: Mälu olek saabus:\n" -#: common/fbus-6110.c:2543 +#: common/fbus-6110.c:3234 #, c-format msgid " Memory Type: %s\n" msgstr " Mälu tüüp: %s\n" -#: common/fbus-6110.c:2544 +#: common/fbus-6110.c:3235 #, c-format msgid " Used: %d\n" msgstr " Kasutatud: %d\n" -#: common/fbus-6110.c:2545 +#: common/fbus-6110.c:3236 #, c-format msgid " Free: %d\n" msgstr " Vaba: %d\n" -#: common/fbus-6110.c:2554 +#: common/fbus-6110.c:3251 msgid "Message: Memory status error, phone is probably powered off.\n" msgstr "Teade: Mälu oleku viga, telefon on tõenäoliselt väljalülitatud.\n" -#: common/fbus-6110.c:2559 +#: common/fbus-6110.c:3258 msgid "" "Message: Memory status error, memory type not supported by phone model.\n" -msgstr "Teade: Mälu oleku viga, mälu tüüp pole telefoni poolt toetatud.\n" +msgstr "" +"Teade: Mälu oleku viga, mälu tüüp pole telefoni poolt toetatud.\n" -#: common/fbus-6110.c:2564 +#: common/fbus-6110.c:3265 msgid "Message: Memory status error, waiting for security code.\n" msgstr "Teade: Mälu oleku viga, ootan turvakoodi.\n" -#: common/fbus-6110.c:2569 +#: common/fbus-6110.c:3272 #, c-format msgid "" "Message: Unknown Memory status error, subtype (MessageBuffer[4]) = %02x\n" msgstr "" -#: common/fbus-6110.c:2584 +#: common/fbus-6110.c:3289 msgid "Message: Caller group logo etc.\n" msgstr "Teade: Helistaja grupi Logo jms.\n" -#: common/fbus-6110.c:2585 +#: common/fbus-6110.c:3290 #, c-format msgid "Caller group name: %s\n" msgstr "Helistaja grupi nimi: %s\n" -#: common/fbus-6110.c:2602 +#: common/fbus-6110.c:3310 msgid "Message: Caller group data received but not requested!\n" msgstr "Teade: Helistaja grupi andmed saabusid kuid polnud küsitud!\n" -#: common/fbus-6110.c:2608 +#: common/fbus-6110.c:3320 msgid "Message: Error attempting to get caller group data.\n" msgstr "Teade: Helistajagrupi andmete saamise viga.\n" -#: common/fbus-6110.c:2613 +#: common/fbus-6110.c:3328 msgid "Message: Caller group data set correctly.\n" msgstr "Teade: Helistaja grupi andmed korrektselt seatud.\n" -#: common/fbus-6110.c:2618 +#: common/fbus-6110.c:3336 msgid "Message: Error attempting to set caller group data\n" msgstr "Teade: Helistajagrupi andmete seadmise viga.\n" -#: common/fbus-6110.c:2624 +#: common/fbus-6110.c:3347 msgid "Message: Speed dial entry received:\n" msgstr "Teade: kiirvalimise kirje saabus:\n" -#: common/fbus-6110.c:2625 +#: common/fbus-6110.c:3348 #, c-format msgid " Location: %d\n" msgstr " Asukoht: %d\n" -#: common/fbus-6110.c:2626 +#: common/fbus-6110.c:3349 #, c-format msgid " MemoryType: %s\n" msgstr " Mälu tüüp: %s\n" -#: common/fbus-6110.c:2627 +#: common/fbus-6110.c:3350 #, c-format msgid " Number: %d\n" msgstr " Number: %d\n" -#: common/fbus-6110.c:2632 +#: common/fbus-6110.c:3360 msgid "Message: Speed dial entry error\n" msgstr "Teade: kiirvalimise sisestuse viga\n" -#: common/fbus-6110.c:2637 +#: common/fbus-6110.c:3370 msgid "Message: Speed dial entry set.\n" msgstr "Teade: kiirvalimise kirje seatud.\n" -#: common/fbus-6110.c:2642 +#: common/fbus-6110.c:3380 msgid "Message: Speed dial entry setting error.\n" msgstr "Teade: kiirvalimise kirje seade viga.\n" -#: common/fbus-6110.c:2647 +#: common/fbus-6110.c:3390 msgid "Message: Unknown message of type 0x03\n" msgstr "Teade: Tundmatu 0x03 tüüpi sõnum\n" -#: common/fbus-6110.c:2658 +#: common/fbus-6110.c:3406 msgid "Message: Phone status received:\n" msgstr "Teade: Telefoni olek saabunud:\n" -#: common/fbus-6110.c:2659 +#: common/fbus-6110.c:3407 msgid " Mode: " msgstr " Olek: " -#: common/fbus-6110.c:2661 +#: common/fbus-6110.c:3413 msgid "registered within the network\n" msgstr "registreeritud võrkku\n" -#: common/fbus-6110.c:2664 +#: common/fbus-6110.c:3422 msgid "call in progress\n" msgstr "kõne käimas\n" -#: common/fbus-6110.c:2665 +#: common/fbus-6110.c:3428 msgid "waiting for security code\n" msgstr "ootan turvakoodi.\n" -#: common/fbus-6110.c:2666 +#: common/fbus-6110.c:3434 msgid "powered off\n" msgstr "toide välja\n" -#: common/fbus-6110.c:2667 common/fbus-6110.c:2673 +#: common/fbus-6110.c:3440 common/fbus-6110.c:3462 msgid "unknown\n" msgstr "tundmatu\n" -#: common/fbus-6110.c:2669 +#: common/fbus-6110.c:3444 msgid " Power source: " msgstr " Toiteallikas: " -#: common/fbus-6110.c:2671 +#: common/fbus-6110.c:3450 msgid "AC/DC\n" msgstr "Vahelduvvool/Alalisvool\n" -#: common/fbus-6110.c:2672 +#: common/fbus-6110.c:3456 msgid "battery\n" msgstr "aku\n" -#: common/fbus-6110.c:2675 +#: common/fbus-6110.c:3466 #, c-format msgid " Battery Level: %d\n" msgstr " Aku laadumus: %d\n" -#: common/fbus-6110.c:2676 +#: common/fbus-6110.c:3467 #, c-format msgid " Signal strength: %d\n" msgstr " Signaali väljatugevus: %d\n" -#: common/fbus-6110.c:2684 +#: common/fbus-6110.c:3479 msgid "Message: Unknown message of type 0x04\n" msgstr "Teade: Tundmatu 0x04 tüüpi sõnum\n" -#: common/fbus-6110.c:2695 +#: common/fbus-6110.c:3495 msgid "Message: Profile feature change result.\n" msgstr "Teade: Profiili omadus muutis tulemust.\n" -#: common/fbus-6110.c:2737 +#: common/fbus-6110.c:3553 msgid "Message: Startup Logo, welcome note and dealer welcome note received.\n" -msgstr "Teade: Saabusid Startup Logo, Teretere teade ja diileri tervitusteade.\n" +msgstr "Teade: Saabusid Startup Logo, Teretere teade ja diileri tervitustede.\n" -#: common/fbus-6110.c:2755 +#: common/fbus-6110.c:3577 msgid "Startup logo supported - " msgstr "Startup Logo on toetatud - " -#: common/fbus-6110.c:2756 +#: common/fbus-6110.c:3580 msgid "currently set\n" msgstr "hetkel seatud\n" -#: common/fbus-6110.c:2757 common/fbus-6110.c:2772 common/fbus-6110.c:2788 -#: gnokii/gnokii.c:1913 +#: common/fbus-6110.c:3582 common/fbus-6110.c:3601 common/fbus-6110.c:3621 +#: gnokii/gnokii.c:2017 msgid "currently empty\n" msgstr "hetkel tühi\n" -#: common/fbus-6110.c:2766 +#: common/fbus-6110.c:3594 msgid "Startup Text supported - " msgstr "Startup Tekst on toetatud - " -#: common/fbus-6110.c:2768 common/fbus-6110.c:2785 +#: common/fbus-6110.c:3597 common/fbus-6110.c:3617 msgid "currently set to \"" msgstr "hetkel seatud \"" -#: common/fbus-6110.c:2769 common/fbus-6110.c:2786 +#: common/fbus-6110.c:3598 common/fbus-6110.c:3618 common/fbus-6110.c:4755 +#: common/fbus-6110.c:4759 #, c-format msgid "%c" msgstr "" -#: common/fbus-6110.c:2770 common/fbus-6110.c:2787 +#: common/fbus-6110.c:3599 common/fbus-6110.c:3619 msgid "\"\n" msgstr "" -#: common/fbus-6110.c:2783 +#: common/fbus-6110.c:3614 msgid "Dealer Welcome supported - " msgstr "" -#: common/fbus-6110.c:2796 +#: common/fbus-6110.c:3634 msgid "Message: Startup logo received but not requested!\n" msgstr "Teade: Startup logo saabus, kuid pole küsitud!\n" -#: common/fbus-6110.c:2801 +#: common/fbus-6110.c:3643 msgid "" "Message: Startup logo, welcome note or dealer welcome note correctly set.\n" msgstr "" -#: common/fbus-6110.c:2820 +#: common/fbus-6110.c:3669 msgid "Message: Operator logo correctly set.\n" msgstr "Teade: Operaatori Logo korrektselt paigas.\n" -#: common/fbus-6110.c:2826 +#: common/fbus-6110.c:3678 msgid "Message: Error setting operator logo!\n" msgstr "Teade: Viga operaatori logo kehtestamisel!\n" -#: common/fbus-6110.c:2841 +#: common/fbus-6110.c:3701 #, c-format msgid "Message: Operator Logo for %s (%s) network received.\n" msgstr "Teade: Saabus Operaatori Logo võrgule %s (%s).\n" -#: common/fbus-6110.c:2855 +#: common/fbus-6110.c:3719 msgid "Message: Operator logo received but not requested!\n" msgstr "Teade: Operaatori Logo saabunud, kuid mitte küsitud!\n" -#: common/fbus-6110.c:2859 +#: common/fbus-6110.c:3728 msgid "Message: Error getting operator logo!\n" msgstr "Teade: Viga operaatori logo võtmisel!\n" -#: common/fbus-6110.c:2871 +#: common/fbus-6110.c:3746 msgid "Message: Security Code status received: " msgstr "Teade: Security koodi olek saabus: " -#: common/fbus-6110.c:2873 gnokii/gnokii.c:1659 +#: common/fbus-6110.c:3752 gnokii/gnokii.c:1604 msgid "waiting for Security Code.\n" msgstr "ootan Security koodi.\n" -#: common/fbus-6110.c:2874 gnokii/gnokii.c:1664 +#: common/fbus-6110.c:3757 gnokii/gnokii.c:1609 msgid "waiting for PIN.\n" msgstr "ootan PIN koodi.\n" -#: common/fbus-6110.c:2875 gnokii/gnokii.c:1669 +#: common/fbus-6110.c:3762 gnokii/gnokii.c:1614 msgid "waiting for PIN2.\n" msgstr "ootan PIN2 koodi.\n" -#: common/fbus-6110.c:2876 gnokii/gnokii.c:1674 +#: common/fbus-6110.c:3767 gnokii/gnokii.c:1619 msgid "waiting for PUK.\n" msgstr "ootan PUK koodi.\n" -#: common/fbus-6110.c:2877 gnokii/gnokii.c:1679 +#: common/fbus-6110.c:3772 gnokii/gnokii.c:1624 msgid "waiting for PUK2.\n" msgstr "ootan PUK2 koodi.\n" -#: common/fbus-6110.c:2878 gnokii/gnokii.c:1684 +#: common/fbus-6110.c:3777 gnokii/gnokii.c:1629 msgid "nothing to enter.\n" msgstr "pole midagi sisestada.\n" -#: common/fbus-6110.c:2879 gnokii/gnokii.c:1689 +#: common/fbus-6110.c:3782 gnokii/gnokii.c:1634 msgid "Unknown!\n" msgstr "Tundmatu!\n" -#: common/fbus-6110.c:2885 +#: common/fbus-6110.c:3794 msgid "Message: Security code accepted.\n" msgstr "Teade: Security kood aksepteeritud.\n" -#: common/fbus-6110.c:2890 +#: common/fbus-6110.c:3804 msgid "Message: Security code is wrong. You're not my big owner :-)\n" msgstr "Teade: Security kood on vale. Sa pole telefoni õige omanik :-)\n" -#: common/fbus-6110.c:2909 -msgid "Message: Network information:\n" +#: common/fbus-6110.c:3831 +msgid "Message: Network informations:\n" msgstr "Teade: Võrgu informatsioon:\n" -#: common/fbus-6110.c:2911 +#: common/fbus-6110.c:3833 #, c-format msgid " CellID: %s\n" msgstr " KärjeID: %s\n" -#: common/fbus-6110.c:2912 +#: common/fbus-6110.c:3834 #, c-format msgid " LAC: %s\n" msgstr "" -#: common/fbus-6110.c:2913 +#: common/fbus-6110.c:3835 #, c-format msgid " Network code: %s\n" msgstr " Võrgu kood: %s\n" -#: common/fbus-6110.c:2914 +#: common/fbus-6110.c:3836 #, c-format msgid " Network name: %s (%s)\n" msgstr " Võrgu nimi: %s (%s)\n" -#: common/fbus-6110.c:2917 +#: common/fbus-6110.c:3839 msgid " Status: " msgstr " Olek: " -#: common/fbus-6110.c:2920 +#: common/fbus-6110.c:3842 msgid "home network selected" msgstr "koduvõrk valitud" -#: common/fbus-6110.c:2921 +#: common/fbus-6110.c:3843 msgid "roaming network" msgstr "roaming võrk" -#: common/fbus-6110.c:2922 +#: common/fbus-6110.c:3844 msgid "requesting network" msgstr "võrgupäring" -#: common/fbus-6110.c:2923 +#: common/fbus-6110.c:3845 msgid "not registered in the network" msgstr "pole võrkku registreerunud" -#: common/fbus-6110.c:2924 xgnokii/xgnokii_lowlevel.c:116 -#: xgnokii/xgnokii_lowlevel.c:191 xgnokii/xgnokii_lowlevel.c:193 -#: xgnokii/xgnokii_lowlevel.c:194 +#: common/fbus-6110.c:3846 msgid "unknown" msgstr "tundmatu" -#: common/fbus-6110.c:2929 +#: common/fbus-6110.c:3851 #, c-format msgid " Network selection: %s\n" msgstr " Võrgu valik: %s\n" -#: common/fbus-6110.c:2929 +#: common/fbus-6110.c:3851 msgid "manual" msgstr "käsiraamat" -#: common/fbus-6110.c:2929 +#: common/fbus-6110.c:3851 msgid "automatic" msgstr "automaatne" -#: common/fbus-6110.c:2935 +#: common/fbus-6110.c:3861 msgid "Message: Unknown message of type 0x0a\n" msgstr "Teade: Tundmatu 0x0a tüüpi sõnum\n" -#: common/fbus-6110.c:2958 gnokii/gnokii.c:3048 +#: common/fbus-6110.c:3878 +msgid "Message: Result of key " +msgstr " " + +#: common/fbus-6110.c:3881 +msgid "press\n" +msgstr "vajuta\n" + +#: common/fbus-6110.c:3882 +msgid "release\n" +msgstr "vabasta\n" + +#: common/fbus-6110.c:3883 +msgid "press or release - error\n" +msgstr "vajuta või vabasta - viga\n" + +#: common/fbus-6110.c:3890 +msgid "Message: Unknown message of type 0x0c\n" +msgstr "Teade: Tundmatu 0x0c tüüpi sõnum\n" + +#: common/fbus-6110.c:3925 gnokii/gnokii.c:3119 #, c-format msgid "Call in progress: %s\n" msgstr "Kõne on käimas: %s\n" -#: common/fbus-6110.c:2959 gnokii/gnokii.c:3049 +#: common/fbus-6110.c:3926 gnokii/gnokii.c:3120 #, c-format msgid "Unknown: %s\n" msgstr "Tundmatu: %s\n" -#: common/fbus-6110.c:2960 gnokii/gnokii.c:3050 +#: common/fbus-6110.c:3927 gnokii/gnokii.c:3121 #, c-format msgid "Unread SMS: %s\n" msgstr "Lugemata SMS: %s\n" -#: common/fbus-6110.c:2961 gnokii/gnokii.c:3051 +#: common/fbus-6110.c:3928 gnokii/gnokii.c:3122 #, c-format msgid "Voice call: %s\n" msgstr "" -#: common/fbus-6110.c:2962 gnokii/gnokii.c:3052 +#: common/fbus-6110.c:3929 gnokii/gnokii.c:3123 #, c-format msgid "Fax call active: %s\n" msgstr "Faxi kõne aktiivne: %s\n" -#: common/fbus-6110.c:2963 gnokii/gnokii.c:3053 +#: common/fbus-6110.c:3930 gnokii/gnokii.c:3124 #, c-format msgid "Data call active: %s\n" msgstr "Andmekõne aktiivne: %\n" -#: common/fbus-6110.c:2964 gnokii/gnokii.c:3054 +#: common/fbus-6110.c:3931 gnokii/gnokii.c:3125 #, c-format msgid "Keyboard lock: %s\n" msgstr "Klaviatuuri lukk: %s\n" -#: common/fbus-6110.c:2965 gnokii/gnokii.c:3055 +#: common/fbus-6110.c:3932 gnokii/gnokii.c:3126 #, c-format msgid "SMS storage full: %s\n" msgstr "SMS varamu on täis: %s\n" -#: common/fbus-6110.c:2971 +#: common/fbus-6110.c:3945 msgid "Display output successfully disabled/enabled.\n" msgstr "" -#: common/fbus-6110.c:2977 +#: common/fbus-6110.c:3955 msgid "Unknown message of type 0x0d.\n" msgstr "Tundmatu 0x0d tüüpi sõnum.\n" -#: common/fbus-6110.c:2989 +#: common/fbus-6110.c:3974 msgid "Message: Date and time set correctly\n" msgstr "Teade: Kuupäev ja kellaaeg seatud korrektselt\n" -#: common/fbus-6110.c:2994 common/fbus-6110.c:3024 +#: common/fbus-6110.c:3984 common/fbus-6110.c:4030 msgid "Message: Date and time set error\n" msgstr "Teade: Kuupäeva ja kellaaja seade viga\n" -#: common/fbus-6110.c:3009 +#: common/fbus-6110.c:4004 msgid "Message: Date and time\n" msgstr "Teade: Kuupäev ja kellaaeg\n" -#: common/fbus-6110.c:3010 common/fbus-6110.c:3109 gnokii/gnokii.c:2276 +#: common/fbus-6110.c:4005 common/fbus-6110.c:4158 gnokii/gnokii.c:2321 #, c-format msgid " Time: %02d:%02d:%02d\n" msgstr " Kellaaeg: %02d:%02d:%02d\n" -#: common/fbus-6110.c:3011 +#: common/fbus-6110.c:4006 #, c-format msgid " Date: %4d/%02d/%02d\n" msgstr " Kuupäev: %4d/%02d/%02d\n" -#: common/fbus-6110.c:3019 +#: common/fbus-6110.c:4020 msgid "Message: Alarm set correctly\n" msgstr "Teade: Äratus seatud õieti\n" -#: common/fbus-6110.c:3031 +#: common/fbus-6110.c:4042 msgid "Message: Alarm\n" msgstr "Teade: Äratus\n" -#: common/fbus-6110.c:3032 +#: common/fbus-6110.c:4043 #, c-format msgid " Alarm: %02d:%02d\n" msgstr " Äratus: %02d:%02d\n" -#: common/fbus-6110.c:3033 +#: common/fbus-6110.c:4044 #, c-format msgid " Alarm is %s\n" msgstr " Äratus on %s\n" -#: common/fbus-6110.c:3033 gnokii/gnokii.c:3048 gnokii/gnokii.c:3049 -#: gnokii/gnokii.c:3050 gnokii/gnokii.c:3051 gnokii/gnokii.c:3052 -#: gnokii/gnokii.c:3053 gnokii/gnokii.c:3054 gnokii/gnokii.c:3055 +#: common/fbus-6110.c:4044 gnokii/gnokii.c:3119 gnokii/gnokii.c:3120 +#: gnokii/gnokii.c:3121 gnokii/gnokii.c:3122 gnokii/gnokii.c:3123 +#: gnokii/gnokii.c:3124 gnokii/gnokii.c:3125 gnokii/gnokii.c:3126 msgid "on" msgstr "sisse" -#: common/fbus-6110.c:3033 gnokii/gnokii.c:3048 gnokii/gnokii.c:3049 -#: gnokii/gnokii.c:3050 gnokii/gnokii.c:3051 gnokii/gnokii.c:3052 -#: gnokii/gnokii.c:3053 gnokii/gnokii.c:3054 gnokii/gnokii.c:3055 +#: common/fbus-6110.c:4044 gnokii/gnokii.c:3119 gnokii/gnokii.c:3120 +#: gnokii/gnokii.c:3121 gnokii/gnokii.c:3122 gnokii/gnokii.c:3123 +#: gnokii/gnokii.c:3124 gnokii/gnokii.c:3125 gnokii/gnokii.c:3126 msgid "off" msgstr "välja" -#: common/fbus-6110.c:3043 +#: common/fbus-6110.c:4060 msgid "Message: Unknown message of type 0x11\n" msgstr "Teade: Tundmatu 0x11 tüüpi sõnum\n" -#: common/fbus-6110.c:3055 +#: common/fbus-6110.c:4083 msgid "Message: Calendar note write succesfull!\n" msgstr "Teade: Kalendri teate kirjutamine õnnestus!\n" -#: common/fbus-6110.c:3059 common/fbus-6110.c:3063 +#: common/fbus-6110.c:4093 common/fbus-6110.c:4103 msgid "Message: Calendar note write failed!\n" msgstr "Teade: Kalendri teate kirjutamine ebaõnnestus!\n" -#: common/fbus-6110.c:3067 +#: common/fbus-6110.c:4112 msgid "Unknown message of type 0x13 and subtype 0x65\n" msgstr "Tundmatu 0x13 tüüpi ja 0x65 alamtüüpi sõnum.\n" -#: common/fbus-6110.c:3105 +#: common/fbus-6110.c:4152 msgid "Message: Calendar note received.\n" msgstr "Teade: Kalendri teade saabus\n" -#: common/fbus-6110.c:3106 gnokii/gnokii.c:2272 +#: common/fbus-6110.c:4154 gnokii/gnokii.c:2317 #, c-format msgid " Date: %d-%02d-%02d\n" msgstr " Kuupäev: %d-%02d-%02d\n" -#: common/fbus-6110.c:3116 gnokii/gnokii.c:2281 +#: common/fbus-6110.c:4165 gnokii/gnokii.c:2326 #, c-format msgid " Alarm date: %d-%02d-%02d\n" msgstr " Äratuse kuupäev: %d-%02d-%02d\n" -#: common/fbus-6110.c:3119 gnokii/gnokii.c:2285 +#: common/fbus-6110.c:4169 gnokii/gnokii.c:2330 #, c-format msgid " Alarm time: %02d:%02d:%02d\n" msgstr " Äratusaeg: %02d:%02d:%02d\n" -#: common/fbus-6110.c:3124 +#: common/fbus-6110.c:4174 #, c-format msgid " Type: %d\n" msgstr " Tüüp: %d\n" -#: common/fbus-6110.c:3125 gnokii/gnokii.c:2290 +#: common/fbus-6110.c:4175 gnokii/gnokii.c:2335 #, c-format msgid " Text: %s\n" msgstr " Tekst: %s\n" -#: common/fbus-6110.c:3127 gnokii/gnokii.c:2293 +#: common/fbus-6110.c:4178 gnokii/gnokii.c:2338 #, c-format msgid " Phone: %s\n" msgstr " Telefon: %s\n" -#: common/fbus-6110.c:3132 +#: common/fbus-6110.c:4188 msgid "Message: Calendar note not available\n" msgstr "Teade: Kalendri teade pole võimalik\n" -#: common/fbus-6110.c:3137 +#: common/fbus-6110.c:4198 msgid "Message: Calendar note error\n" msgstr "Teade: Kalendri teate viga\n" -#: common/fbus-6110.c:3149 +#: common/fbus-6110.c:4220 msgid "Message: Calendar note deleted\n" msgstr "Teade: Kalendri teade kustutatud\n" -#: common/fbus-6110.c:3153 +#: common/fbus-6110.c:4231 msgid "Message: Calendar note can't be deleted\n" msgstr "Teade: Kalendri teadet ei saa kustutada\n" -#: common/fbus-6110.c:3157 +#: common/fbus-6110.c:4241 msgid "Message: Calendar note deleting error\n" msgstr "Teade: Kalendri teate kustutamise viga\n" -#: common/fbus-6110.c:3167 +#: common/fbus-6110.c:4257 msgid "Message: Calendar Alarm active\n" msgstr "Teade: Kalendri alarm aktiivne\n" -#: common/fbus-6110.c:3168 +#: common/fbus-6110.c:4258 #, c-format msgid " Item number: %d\n" msgstr "" -#: common/fbus-6110.c:3172 +#: common/fbus-6110.c:4266 msgid "Message: Unknown message of type 0x13\n" msgstr "Teade: Tundmatu 0x13 tüüpi sõnum\n" -#: common/fbus-6110.c:3224 +#: common/fbus-6110.c:4329 msgid "Concatenated message!!!\n" msgstr "" -#: common/fbus-6110.c:3253 +#: common/fbus-6110.c:4350 #, c-format msgid "Number: %d\n" msgstr "Number: %d\n" -#: common/fbus-6110.c:3256 +#: common/fbus-6110.c:4355 msgid "Message: Outbox message (mobile originated)\n" msgstr "" -#: common/fbus-6110.c:3258 +#: common/fbus-6110.c:4358 msgid "Sent\n" msgstr "Saadetud\n" -#: common/fbus-6110.c:3260 +#: common/fbus-6110.c:4360 msgid "Not sent\n" msgstr "Saatmata\n" -#: common/fbus-6110.c:3264 +#: common/fbus-6110.c:4364 msgid "Message: Received SMS (mobile terminated)\n" msgstr "Teade: SMS sõnum saabus (telefon katkestas)\n" -#: common/fbus-6110.c:3266 +#: common/fbus-6110.c:4367 msgid "Delivery Report\n" msgstr "Saateraport\n" -#: common/fbus-6110.c:3268 +#: common/fbus-6110.c:4369 msgid "Unknown type\n" msgstr "Tundmatu tüüp\n" -#: common/fbus-6110.c:3271 +#: common/fbus-6110.c:4372 msgid "Read\n" msgstr "Loe\n" -#: common/fbus-6110.c:3273 +#: common/fbus-6110.c:4374 msgid "Not read\n" msgstr "Lugemata\n" -#: common/fbus-6110.c:3275 +#: common/fbus-6110.c:4376 #, c-format msgid " Date: %s " msgstr " Kuupäev: %s " -#: common/fbus-6110.c:3283 common/fbus-6110.c:3295 gnokii/gnokii.c:1352 -#: gnokii/gnokii.c:1365 gnokii/gnokii.c:1392 +#: common/fbus-6110.c:4384 common/fbus-6110.c:4400 gnokii/gnokii.c:1338 +#: gnokii/gnokii.c:1351 gnokii/gnokii.c:1378 #, c-format msgid "%02d00" msgstr "" -#: common/fbus-6110.c:3288 +#: common/fbus-6110.c:4391 #, c-format msgid " SMSC response date: %s " msgstr " SMSC vastuse kuupäev: %s " -#: common/fbus-6110.c:3353 +#: common/fbus-6110.c:4475 msgid "Delivered" msgstr "Saadetud" -#: common/fbus-6110.c:3356 +#: common/fbus-6110.c:4480 msgid "SM received by the SME" msgstr "" -#: common/fbus-6110.c:3359 +#: common/fbus-6110.c:4483 msgid "" "SM forwarded by the SC to the SME but the SC is unable to confirm delivery" msgstr "" -#: common/fbus-6110.c:3362 +#: common/fbus-6110.c:4486 msgid "SM replaced by the SC" msgstr "" -#: common/fbus-6110.c:3368 +#: common/fbus-6110.c:4494 msgid "Failed" msgstr "Ebaõnnestus" -#: common/fbus-6110.c:3373 +#: common/fbus-6110.c:4501 msgid "Temporary error, SC is not making any more transfer attempts\n" msgstr "Ajutine viga, SC ei proovi enam uuesti saata\n" -#: common/fbus-6110.c:3377 common/fbus-6110.c:3444 +#: common/fbus-6110.c:4506 common/fbus-6110.c:4599 msgid "Congestion" msgstr "" -#: common/fbus-6110.c:3380 common/fbus-6110.c:3447 +#: common/fbus-6110.c:4510 common/fbus-6110.c:4603 msgid "SME busy" msgstr "SME on hõivatud" -#: common/fbus-6110.c:3383 common/fbus-6110.c:3450 +#: common/fbus-6110.c:4514 common/fbus-6110.c:4607 msgid "No response from SME" msgstr "SME ei vasta..." -#: common/fbus-6110.c:3386 common/fbus-6110.c:3453 +#: common/fbus-6110.c:4518 common/fbus-6110.c:4611 msgid "Service rejected" msgstr "Teenus tagasilykatud" -#: common/fbus-6110.c:3389 common/fbus-6110.c:3414 common/fbus-6110.c:3456 +#: common/fbus-6110.c:4522 common/fbus-6110.c:4558 common/fbus-6110.c:4615 msgid "Quality of service not aviable" msgstr "" -#: common/fbus-6110.c:3392 common/fbus-6110.c:3459 +#: common/fbus-6110.c:4526 common/fbus-6110.c:4619 msgid "Error in SME" msgstr "Viga SME-s" -#: common/fbus-6110.c:3395 common/fbus-6110.c:3432 common/fbus-6110.c:3462 -#: common/fbus-6110.c:3470 +#: common/fbus-6110.c:4530 common/fbus-6110.c:4582 common/fbus-6110.c:4623 +#: common/fbus-6110.c:4633 #, c-format msgid "Reserved/Specific to SC: %x" msgstr "" -#: common/fbus-6110.c:3399 +#: common/fbus-6110.c:4537 msgid "Permanent error, SC is not making any more transfer attempts\n" msgstr "Püsiv viga, SC ei proovi enam saatmist korrata\n" -#: common/fbus-6110.c:3402 +#: common/fbus-6110.c:4542 msgid "Remote procedure error" msgstr "" -#: common/fbus-6110.c:3405 +#: common/fbus-6110.c:4546 msgid "Incompatibile destination" msgstr "Kokkusobimatu sihtpunkt" -#: common/fbus-6110.c:3408 +#: common/fbus-6110.c:4550 msgid "Connection rejected by SME" msgstr "Ühendusest keelduti SME poolt" -#: common/fbus-6110.c:3411 +#: common/fbus-6110.c:4554 msgid "Not obtainable" msgstr "Ei saa kätte" -#: common/fbus-6110.c:3417 +#: common/fbus-6110.c:4562 msgid "No internetworking available" msgstr "" -#: common/fbus-6110.c:3420 +#: common/fbus-6110.c:4566 msgid "SM Validity Period Expired" msgstr "" -#: common/fbus-6110.c:3423 +#: common/fbus-6110.c:4570 msgid "SM deleted by originating SME" msgstr "" -#: common/fbus-6110.c:3426 +#: common/fbus-6110.c:4574 msgid "SM Deleted by SC Administration" msgstr "" -#: common/fbus-6110.c:3429 +#: common/fbus-6110.c:4578 msgid "SM does not exist" msgstr "" -#: common/fbus-6110.c:3438 +#: common/fbus-6110.c:4591 msgid "Pending" msgstr "Ootel" -#: common/fbus-6110.c:3441 +#: common/fbus-6110.c:4595 msgid "Temporary error, SC still trying to transfer SM\n" msgstr "Ajutine viga, SC püüab ikkagi saata SM'i\n" -#: common/fbus-6110.c:3489 -#, c-format -msgid "Message stored at %d\n" -msgstr "" - -#: common/fbus-6110.c:3494 -msgid "SMS saving failed\n" -msgstr "SMS salvestamine ebaõnnestus\n" - -#: common/fbus-6110.c:3497 -msgid " All locations busy.\n" -msgstr "" +#: common/fbus-6110.c:4661 +msgid "Message: SMS reading failed.\n" +msgstr "Teade: SMS lugemine ebaõnnestus.\n" -#: common/fbus-6110.c:3501 common/fbus-6110.c:3516 +#: common/fbus-6110.c:4669 msgid " Invalid location!\n" msgstr " Vale asukoht!\n" -#: common/fbus-6110.c:3505 -msgid " Unknown error.\n" -msgstr " Tundmatu viga.\n" - -#: common/fbus-6110.c:3513 -msgid "Message: SMS reading failed.\n" -msgstr "Teade: SMS lugemine ebaõnnestus.\n" - -#: common/fbus-6110.c:3520 +#: common/fbus-6110.c:4679 msgid " Empty SMS location.\n" msgstr " Tühi SMS mälupesa.\n" -#: common/fbus-6110.c:3527 +#: common/fbus-6110.c:4692 msgid "Message: SMS deleted successfully.\n" msgstr "Teade: SMS kustutamine õnnestus.\n" -#: common/fbus-6110.c:3532 +#: common/fbus-6110.c:4702 msgid "Message: SMS Status Received\n" msgstr "Teade: SMS olek saabus\n" -#: common/fbus-6110.c:3533 +#: common/fbus-6110.c:4703 #, c-format msgid " The number of messages: %d\n" msgstr " Sõnumite arv: %d\n" -#: common/fbus-6110.c:3534 +#: common/fbus-6110.c:4704 #, c-format msgid " Unread messages: %d\n" msgstr " Lugemata sõnumeid: %d\n" -#: common/fbus-6110.c:3541 +#: common/fbus-6110.c:4716 msgid "Message: SMS Status error, probably not authorized by PIN\n" msgstr "Teade: SMS oleku viga, tõenäoliselt PIN koodiga autoriseerimata\n" -#: common/fbus-6110.c:3563 +#: common/fbus-6110.c:4743 +msgid "Message: Security code received: " +msgstr "Teade: Turvakood saabus: " + +#: common/fbus-6110.c:4745 gnokii/gnokii.c:1683 +msgid "Security code" +msgstr "Turvakood" + +#: common/fbus-6110.c:4746 gnokii/gnokii.c:1673 gnokii/gnokii.c:1684 +msgid "PIN" +msgstr "" + +#: common/fbus-6110.c:4747 gnokii/gnokii.c:1674 gnokii/gnokii.c:1685 +msgid "PIN2" +msgstr "" + +#: common/fbus-6110.c:4748 gnokii/gnokii.c:1675 gnokii/gnokii.c:1686 +msgid "PUK" +msgstr "" + +#: common/fbus-6110.c:4749 gnokii/gnokii.c:1676 gnokii/gnokii.c:1687 +msgid "PUK2" +msgstr "" + +#: common/fbus-6110.c:4750 +msgid "unknown !" +msgstr "tundmatu !" + +#: common/fbus-6110.c:4753 +msgid " allowed, value \"" +msgstr "" + +#: common/fbus-6110.c:4761 +msgid "\"" +msgstr "" + +#: common/fbus-6110.c:4763 +msgid " not allowed" +msgstr "" + +#: common/fbus-6110.c:4765 +msgid "\n" +msgstr "" + +#: common/fbus-6110.c:4792 msgid "Message: Netmonitor correctly set.\n" msgstr "Teade: Võrgumonitor korrektselt paigas.\n" -#: common/fbus-6110.c:3567 +#: common/fbus-6110.c:4802 #, c-format msgid "Message: Netmonitor menu %d received:\n" msgstr "Teade: Võrgumonitori menüü %d saabunud:\n" -#: common/fbus-6110.c:3577 +#: common/fbus-6110.c:4818 msgid "Unknown message of type 0x40.\n" msgstr "Tundmatu 0x40 tüüpi sõnum.\n" -#: common/fbus-6110.c:3595 +#: common/fbus-6110.c:4840 msgid "Message: Mobile phone identification received:\n" msgstr "Teade: Mobiiltelefoni identiteet saabunud:\n" -#: common/fbus-6110.c:3596 +#: common/fbus-6110.c:4841 #, c-format msgid " IMEI: %s\n" msgstr " IMEI: %s\n" -#: common/fbus-6110.c:3597 +#: common/fbus-6110.c:4843 #, c-format msgid " Model: %s\n" msgstr " Mudel: %s\n" -#: common/fbus-6110.c:3598 +#: common/fbus-6110.c:4845 #, c-format msgid " Production Code: %s\n" msgstr " Valmistuskood: %s\n" -#: common/fbus-6110.c:3599 +#: common/fbus-6110.c:4847 #, c-format msgid " HW: %s\n" msgstr " HW: %s\n" -#: common/fbus-6110.c:3600 +#: common/fbus-6110.c:4849 #, c-format msgid " Firmware: %s\n" msgstr " Riistvara: %s\n" -#: common/fbus-6110.c:3606 +#: common/fbus-6110.c:4855 #, c-format msgid " Magic bytes: %02x %02x %02x %02x\n" msgstr " Maagilised baidid: %02x %02x %02x %02x\n" -#: common/fbus-6110.c:3617 +#: common/fbus-6110.c:4875 #, c-format msgid "[Received Ack of type %02x, seq: %2x]\n" msgstr "" -#: common/fbus-6110.c:3624 +#: common/fbus-6110.c:4893 msgid "Message: The phone is powered on - seq 1.\n" msgstr "" -#: common/fbus-6110.c:3638 -#, c-format -msgid "" -"Phone info:\n" -"%s\n" -msgstr "" -"Telefoni info:\n" -"%s\n" - -#: common/fbus-6110.c:3648 +#: common/fbus-6110.c:4917 msgid "Message: The phone is powered on - seq 2.\n" msgstr "" -#: common/fbus-6110.c:3655 +#: common/fbus-6110.c:4933 msgid "Message: Unknown message.\n" msgstr "Teade: Tundmatu sõnum.\n" -#: common/fbus-6110.c:3756 +#: common/fbus-6110.c:5031 msgid "Interrupted MultiFrame-Message - Ignoring it !!!\n" msgstr "" -#: common/fbus-6110.c:3757 +#: common/fbus-6110.c:5032 msgid "Please report it ...\n" msgstr "Palun teata sellest ... \n" -#: common/fbus-6110.c:3783 -msgid "FB61: Message buffer overun - resetting\n" -msgstr "" - -#: common/fbus-6110.c:3808 +#: common/fbus-6110.c:5099 msgid "Bad checksum!\n" msgstr "Vale kontrollsumma!\n" -#: common/fbus-6110.c:3873 xgnokii/xgnokii.c:1759 +#: common/fbus-6110.c:5161 xgnokii/xgnokii.c:1698 msgid "Phone" msgstr "Telefon" -#: common/fbus-6110.c:3876 +#: common/fbus-6110.c:5164 msgid "PC" msgstr "" -#: common/fbus-6110.c:3893 +#: common/fbus-6110.c:5182 #, c-format msgid "Msg Dest: %s\n" msgstr "Msg sihtpunkt: %s\n" -#: common/fbus-6110.c:3894 +#: common/fbus-6110.c:5183 #, c-format msgid "Msg Source: %s\n" msgstr "Msg allikas: %s\n" -#: common/fbus-6110.c:3895 +#: common/fbus-6110.c:5185 #, c-format msgid "Msg Type: %02x\n" msgstr "Msg tüüp: %02x\n" -#: common/fbus-6110.c:3896 +#: common/fbus-6110.c:5187 #, c-format msgid "Msg Unknown: %02x\n" msgstr "Msg tundmatu: %02x\n" -#: common/fbus-6110.c:3897 +#: common/fbus-6110.c:5188 #, c-format msgid "" "Msg Len: %02x\n" @@ -1488,139 +1475,130 @@ msgstr "" "Msg pikkus: %02x\n" "Telefon: " -#: common/fbus-6110.c:3963 +#: common/fbus-6110.c:5259 msgid "PC: " msgstr "" -#: common/fbus-6110.c:4029 +#: common/fbus-6110.c:5333 #, c-format msgid "[Sending Ack of type %02x, seq: %x]\n" msgstr "" -#: common/mbus-6160.c:551 +#: common/mbus-6160.c:761 msgid "Standard Ack write (0x40) failed!" msgstr "" -#: common/mbus-6160.c:577 +#: common/mbus-6160.c:787 msgid "Standard Ack write (0xd2) failed!" msgstr "" -#: common/mbus-6160.c:1022 +#: common/mbus-6160.c:1232 msgid "Couldn't open MB61 device: " msgstr "Ei suuda avada MB61 seadet: " -#: common/mbus-640.c:667 +#: common/mbus-640.c:821 msgid "Phone: " msgstr "Telefon: " -#: common/mbus-640.c:697 common/mbus-640.c:797 +#: common/mbus-640.c:851 common/mbus-640.c:951 msgid "PC : " msgstr "PC : " -#: common/mbus-640.c:707 common/mbus-640.c:810 +#: common/mbus-640.c:861 common/mbus-640.c:964 msgid "Write error!\n" msgstr "Kirjutamine ebaõnnestus!\n" -#: common/mbus-640.c:734 +#: common/mbus-640.c:888 msgid "Setting MBUS communication...\n" -msgstr "Seadistan MBUS ühendust...\n" +msgstr "Tekitan MBUS ühendust...\n" -#: common/rlp-common.c:705 +#: common/rlp-common.c:701 msgid "Unknown!!! " msgstr "Tundmatu!!!" -#: common/rlp-common.c:770 +#: common/rlp-common.c:766 msgid "BAD" msgstr "" -#: common/rlp-common.c:892 +#: common/rlp-common.c:888 msgid "Frame FCS is bad. Ignoring...\n" msgstr "FCS blokk on vigane. Ignoreerin ...\n" -#: common/rlp-common.c:1007 +#: common/rlp-common.c:1003 msgid "Send_TXU()\n" msgstr "" -#: common/rlp-common.c:1008 +#: common/rlp-common.c:1004 #, c-format msgid "XID_R_State=%d\n" msgstr "" -#: common/rlp-common.c:1380 +#: common/rlp-common.c:1375 msgid "RLP state 0.\n" msgstr "" -#: common/rlp-common.c:1417 +#: common/rlp-common.c:1412 msgid "RLP state 1.\n" msgstr "" -#: common/rlp-common.c:1465 +#: common/rlp-common.c:1477 msgid "RLP state 2.\n" msgstr "" -#: common/rlp-common.c:1499 +#: common/rlp-common.c:1511 msgid "UA received in RLP state 2.\n" msgstr "" -#: common/rlp-common.c:1556 +#: common/rlp-common.c:1568 msgid "RLP state 3.\n" msgstr "" -#: common/rlp-common.c:1614 +#: common/rlp-common.c:1626 msgid "RLP state 4.\n" msgstr "" -#: common/rlp-common.c:1753 +#: common/rlp-common.c:1764 msgid "RLP state 5.\n" msgstr "" -#: common/rlp-common.c:1812 +#: common/rlp-common.c:1823 msgid "RLP state 6 - not yet implemented!\n" msgstr "" -#: common/rlp-common.c:1843 +#: common/rlp-common.c:1853 msgid "RLP state 7.\n" msgstr "" -#: common/rlp-common.c:1885 +#: common/rlp-common.c:1894 msgid "DEBUG: Unknown RLP state!\n" msgstr "" -#: gnokii/gnokii.c:206 +#: gnokii/gnokii.c:168 #, c-format msgid "" "GNOKII Version %s\n" "Copyright (C) Hugh Blemings , 1999, 2000\n" "Copyright (C) Pavel Janík ml. , 1999, 2000\n" -"gnokii is free software, covered by the GNU General Public License, and you " -"are\n" -"welcome to change it and/or distribute copies of it under certain " -"conditions.\n" -"There is absolutely no warranty for gnokii. See GPL for details.\n" "Built %s %s for %s on %s \n" msgstr "" "GNOKII Versioon %s\n" "Copyright (C) Hugh Blemings , 1999, 2000\n" "Copyright (C) Pavel Janík ml. , 1999, 2000\n" -"gnokii on vabavara, GNU General Public License alusel, \n" -"seda võib muuta ja/või levitada programmi koopiaid vastavlt reeglitele.\n" -"gnokii ei oma mitte mingisugust garantiid toimivuse kohta. Vaata GPL tingimusi.\n" "Eestikeelne tõlge Hans Mõtshärg , 2000\n" "Kompileeritud %s %s telefonimudelile %s, ühendus pordis %s \n" -#: gnokii/gnokii.c:223 +#: gnokii/gnokii.c:182 msgid "" " usage: gnokii [--help|--monitor|--version]\n" -" gnokii --getmemory memory_type start [end]\n" -" gnokii --writephonebook [-i]\n" +" gnokii --getmemory memory_type start end\n" +" gnokii --writephonebook\n" " gnokii --getspeeddial number\n" " gnokii --setspeeddial number memory_type location\n" -" gnokii --getsms memory_type start [end] [-f file] [-d]\n" -" gnokii --deletesms memory_type start [end]\n" +" gnokii --getsms memory_type start end\n" +" gnokii --deletesms memory_type start end\n" " gnokii --sendsms destination [--smsc message_center_number |\n" " --smscno message_center_index] [-r] [-C n] [-v n]\n" " [--long n]\n" -" gnokii --savesms [-m] [-l n] [-i]\n" " gnokii --getsmsc message_center_number\n" " gnokii --setdatetime [YYYY [MM [DD [HH [MM]]]]]\n" " gnokii --getdatetime\n" @@ -1628,14 +1606,13 @@ msgid "" " gnokii --getalarm\n" " gnokii --dialvoice number\n" " gnokii --getcalendarnote index [-v]\n" -" gnokii --writecalendarnote vcardfile number\n" +" gnokii --writecalendarnote\n" " gnokii --deletecalendarnote index\n" " gnokii --getdisplaystatus\n" " gnokii --netmonitor {reset|off|field|devel|next|nr}\n" " gnokii --identify\n" " gnokii --senddtmf string\n" " gnokii --sendlogo {caller|op} destination logofile [network code]\n" -" gnokii --sendringtone destination rtttlfile\n" " gnokii --setlogo op [logofile] [network code]\n" " gnokii --setlogo startup [logofile]\n" " gnokii --setlogo caller [logofile] [caller group number] [group " @@ -1643,133 +1620,249 @@ msgid "" " gnokii --setlogo {dealer|text} [text]\n" " gnokii --getlogo op [logofile] [network code]\n" " gnokii --getlogo startup [logofile] [network code]\n" -" gnokii --getlogo caller [logofile][caller group number][network " +" gnokii --getlogo caller [logofile] [caller group number] [network " "code]\n" " gnokii --getlogo {dealer|text}\n" +" gnokii --fileconvert source destination\n" +" gnokii --fileconvert source destination op [network code]\n" +" gnokii --fileconvert source destination caller [caller group " +"number]\n" +" gnokii --fileconvert source destination startup\n" +" gnokii --sendringtone destination rtttlfile\n" " gnokii --setringtone rtttlfile\n" +" gnokii --presskeysequence sequence\n" " gnokii --reset [soft|hard]\n" " gnokii --getprofile [number]\n" " gnokii --displayoutput\n" -" gnokii --keysequence\n" msgstr "" -#: gnokii/gnokii.c:266 +#: gnokii/gnokii.c:228 msgid "" " gnokii --entersecuritycode PIN|PIN2|PUK|PUK2\n" " gnokii --getsecuritycodestatus\n" +" gnokii --getsecuritycode PIN|PIN2|PUK|PUK2|SecurityCode\n" msgstr "" -#: common/virtmodem.c:292 gnokii/gnokii.c:293 gnokii/gnokii.c:3187 -#: xgnokii/xgnokii_lowlevel.c:171 -msgid "GSM/FBUS init failed! (Unknown model ?). Quitting.\n" +#: gnokii/gnokii.c:234 +msgid "" +"\n" +" --help display usage information.\n" +"\n" +" --monitor continually updates phone status to stderr.\n" +"\n" +" --version displays version and copyright information.\n" +"\n" +" --getmemory reads specificed memory location from phone.\n" +" Valid memory types are:\n" +" ME, SM, FD, ON, EN, DC, RC, MC, LD\n" +"\n" +" --writephonebook reads data from stdin and writes to phonebook.\n" +" Uses the same format as provided by the output " +"of\n" +" the getphonebook command.\n" +"\n" +" --getspeeddial reads speed dial from the specified location.\n" +"\n" +" --setspeeddial specify speed dial.\n" +"\n" +" --getsms gets SMS messages from specified memory type\n" +" starting at entry [start] and ending at [end].\n" +" Entries are dumped to stdout.\n" +"\n" +" --deletesms deletes SMS messages from specified memory type\n" +" starting at entry [start] and ending at [end].\n" +"\n" +" --sendsms sends an SMS message to [destination] via\n" +" [message_center_number] or SMSC number taken " +"from\n" +" phone memory from address " +"[message_center_index].\n" +" If this argument is ommited SMSC number is " +"taken\n" +" from phone memory from location 1. Message text\n" +" is taken from stdin. This function has had\n" +" limited testing and may not work at all on your\n" +" network. Meaning of other optional parameters:\n" +" [-r] - request for delivery report\n" +" [-C n] - Class Message n, where n can be 0..3\n" +" [-v n] - validity in minutes\n" +" [--long n] - send no more then n characters,\n" +" default is 160\n" +"\n" +" --getsmsc show the SMSC number from location\n" +" [message_center_number].\n" +"\n" +" --setdatetime set the date and the time of the phone.\n" +"\n" +" --getdatetime shows current date and time in the phone.\n" +"\n" +" --setalarm set the alarm of the phone.\n" +"\n" +" --getalarm shows current alarm.\n" +"\n" +" --dialvoice initiate voice call.\n" +"\n" +" --getcalendarnote get the note with number index from calendar.\n" +" [-v] - output in vCalendar 1.0 format\n" +"\n" +" --writecalendarnote write the note to calendar.\n" +"\n" +" --deletecalendarnote delete the note with number [index]\n" +" from calendar.\n" +"\n" +" --getdisplaystatus shows what icons are displayed.\n" +"\n" +" --netmonitor setting/querying netmonitor mode.\n" +"\n" +" --identify get IMEI, model and revision\n" +"\n" +" --senddtmf send DTMF sequence\n" +"\n" +" --sendlogo send the logofile to destination as operator\n" +" or CLI logo\n" +"\n" +" --setlogo set caller, startup, operator logo\n" +" or (dealer) welcome note\n" +" If you will not give logofile|text, it will be\n" +" removed from phone\n" +" If you will not give network code, it will be\n" +" set to current\n" +" If you will not give caller group number, it " +"will be\n" +" set to 0\n" +"\n" +" --getlogo get caller, startup, operator logo\n" +"\n" +" or (dealer) welcome note\n" +" If you will give network code and write logo in " +"NOL\n" +" format, it will be written there\n" +" If you will not specify logofile, gnokii will " +"show\n" +" info about logo only\n" +"\n" +" --fileconvert Converts logo files\n" +"\n" +" --sendringtone send the rtttlfile to destination as ringtone\n" +"\n" +" --setringtone set the rtttlfile as ringtone (on 6110)\n" +"\n" +" --presskeysequence presses some keys in phone keyboard\n" +" available keys: 0..9, #, *, m (Menu), n " +"(Names),\n" +" p (Power), g (Green), r (Red), +, - (Volume " +"+-),\n" +" u (Up), d (Down)\n" +" w means 2 sec. pause (useful, when you " +"simulate\n" +" writing SMS)\n" +"\n" +" --reset [soft|hard] resets the phone.\n" +"\n" +" --getprofile [number] show settings for selected(all) profile(s)\n" +"\n" +" --displayoutput show texts displayed in phone's screen\n" +"\n" +msgstr "" + +#: gnokii/gnokii.c:343 +msgid "" +" --entersecuritycode asks for the code and sends it to the phone\n" +"\n" +" --getsecuritycodestatus show if a security code is needed\n" +"\n" +" --getsecuritycode gets specified code from phone\n" +"\n" msgstr "" -"GSM/FBUS initsialiseerimine ebaõnnestus! (Tundmatu mudel?). Lõpetan....)\n" -#: gnokii/gnokii.c:304 +#: gnokii/gnokii.c:371 gnokii/gnokii.c:3263 gnokiid/virtmodem.c:262 +msgid "GSM/FBUS init failed! (Unknown model ?). Quitting.\n" +msgstr "GSM/FBUS initsialiseerimine ebaõnnestus! (Tundmatu mudel?). Lõpetan....)\n" + +#: gnokii/gnokii.c:382 msgid "Hmmm... GSM_LinkOK never went true. Quitting.\n" msgstr "Hmmm... GSM_LinkOK ei tekkinud. Lõpetan.\n" -#: gnokii/gnokii.c:580 +#: gnokii/gnokii.c:653 #, c-format msgid "Use '%s --help' for usage informations.\n" msgstr "Kasuta '%s --help' kasutusinfo saamiseks.\n" -#: gnokii/gnokii.c:778 +#: gnokii/gnokii.c:856 #, c-format msgid "Unknown option: %d\n" msgstr "Tundmatu valik: %d\n" -#: gnokii/gnokii.c:788 +#: gnokii/gnokii.c:866 msgid "Wrong number of arguments\n" msgstr "Vale argumentide kogus\n" -#: gnokii/gnokii.c:859 gnokii/gnokii.c:917 gnokii/gnokii.c:1076 +#: gnokii/gnokii.c:937 gnokii/gnokii.c:995 msgid "Input too long!\n" msgstr "Sisend on liiga pikk!\n" -#: gnokii/gnokii.c:912 gnokii/gnokii.c:1071 +#: gnokii/gnokii.c:990 msgid "Couldn't read from stdin!\n" msgstr "Ei suuda lugeda standard sisendist!\n" -#: gnokii/gnokii.c:1046 -msgid "Message at specified location exists. " -msgstr "" - -#: gnokii/gnokii.c:1048 gnokii/gnokii.c:1421 gnokii/gnokii.c:2948 -msgid "Overwrite? (yes/no) " -msgstr "Kas kirjutan üle? (yes/no)" - -#: gnokii/gnokii.c:1056 -msgid "Invalid location\n" -msgstr "Vale asukoht\n" - -#: gnokii/gnokii.c:1062 +#: gnokii/gnokii.c:1101 #, c-format -msgid "Location %d empty. Saving\n" -msgstr "Asukoht %d on tühi. Salvestan\n" +msgid "Unknown key: %c !\n" +msgstr "Tundmatu võti: %c !\n" -#: gnokii/gnokii.c:1087 -msgid "Saved!\n" -msgstr "Salvestatud!\n" +#: gnokii/gnokii.c:1108 +msgid "Can't press key !\n" +msgstr "Nuppu ei saa vajutada?! \n" -#: gnokii/gnokii.c:1089 -#, c-format -msgid "Saving failed (error=%d)\n" -msgstr "" +#: gnokii/gnokii.c:1114 +msgid "Can't release key !\n" +msgstr "Nuppu ei saa vabastada?! \n" -#: gnokii/gnokii.c:1110 +#: gnokii/gnokii.c:1142 #, c-format msgid "%d. SMS center (%s) number is %s\n" msgstr "%d. SMS keskuse (%s) number on %s\n" -#: gnokii/gnokii.c:1112 +#: gnokii/gnokii.c:1144 msgid "Messages sent as " msgstr "Sõnum saadetud nagu " -#: gnokii/gnokii.c:1134 xgnokii/xgnokii.c:563 +#: gnokii/gnokii.c:1166 xgnokii/xgnokii.c:545 msgid "ERMES" msgstr "" -#: gnokii/gnokii.c:1138 xgnokii/xgnokii.c:567 +#: gnokii/gnokii.c:1170 xgnokii/xgnokii.c:549 msgid "X.400" msgstr "" -#: gnokii/gnokii.c:1147 +#: gnokii/gnokii.c:1179 msgid "Message validity is " msgstr "Sõnumi kehtivus on" -#: gnokii/gnokii.c:1183 +#: gnokii/gnokii.c:1215 msgid "SMS center can not be found :-(\n" msgstr "" -#: gnokii/gnokii.c:1256 gnokii/gnokii.c:2805 gnokii/gnokii.c:3016 +#: gnokii/gnokii.c:1284 gnokii/gnokii.c:1491 gnokii/gnokii.c:2855 +#: gnokii/gnokii.c:3040 #, c-format msgid "Unknown memory type %s!\n" msgstr "Tundmatu mälu tüüp %s!\n" -#: gnokii/gnokii.c:1283 -#, c-format -msgid "Saving into %s\n" -msgstr "" - -#: gnokii/gnokii.c:1287 -msgid "Filename too long - will be truncated to 63 charactera.\n" -msgstr "" - -#: gnokii/gnokii.c:1325 +#: gnokii/gnokii.c:1311 #, c-format msgid "%d. Outbox Message " msgstr "%d. Saadetud Sõnumid " -#: gnokii/gnokii.c:1328 +#: gnokii/gnokii.c:1314 msgid "(sent)\n" msgstr "(saadetud)\n" -#: gnokii/gnokii.c:1330 +#: gnokii/gnokii.c:1316 msgid "(not sent)\n" msgstr "(ei saadetud)\n" -#: gnokii/gnokii.c:1332 gnokii/gnokii.c:1371 +#: gnokii/gnokii.c:1318 gnokii/gnokii.c:1357 #, c-format msgid "" "Text: %s\n" @@ -1778,83 +1871,60 @@ msgstr "" "Tekst: %s\n" "\n" -#: gnokii/gnokii.c:1338 +#: gnokii/gnokii.c:1324 #, c-format msgid "%d. Delivery Report " msgstr "%d. Saateraport " -#: gnokii/gnokii.c:1340 gnokii/gnokii.c:1380 +#: gnokii/gnokii.c:1326 gnokii/gnokii.c:1366 msgid "(read)\n" msgstr "(loetud)\n" -#: gnokii/gnokii.c:1342 gnokii/gnokii.c:1382 +#: gnokii/gnokii.c:1328 gnokii/gnokii.c:1368 msgid "(not read)\n" msgstr "(ei loetud)\n" -#: gnokii/gnokii.c:1344 +#: gnokii/gnokii.c:1330 #, c-format msgid "Sending date/time: %d/%d/%d %d:%02d:%02d " msgstr "Saatmise kuupäev/kellaaeg: %d/%d/%d %d:%02d:%02d " -#: gnokii/gnokii.c:1350 gnokii/gnokii.c:1363 gnokii/gnokii.c:1390 +#: gnokii/gnokii.c:1336 gnokii/gnokii.c:1349 gnokii/gnokii.c:1376 #, c-format msgid "+%02d00" msgstr "" -#: gnokii/gnokii.c:1357 +#: gnokii/gnokii.c:1343 #, c-format msgid "Response date/time: %d/%d/%d %d:%02d:%02d " msgstr "Vastuse kuupäev/kellaaeg: %d/%d/%d %d:%02d:%02d " -#: gnokii/gnokii.c:1370 +#: gnokii/gnokii.c:1356 #, c-format msgid "Receiver: %s Msg Center: %s\n" msgstr "Saaja: %s Msg keskus: %s\n" -#: gnokii/gnokii.c:1377 +#: gnokii/gnokii.c:1363 #, c-format msgid "%d. Inbox Message " msgstr "%d. Saabunud Sõnumid " -#: gnokii/gnokii.c:1384 +#: gnokii/gnokii.c:1370 #, c-format msgid "Date/time: %d/%d/%d %d:%02d:%02d " msgstr "Kuupäv/kellaeg: %d/%d/%d %d:%02d:%02d " -#: gnokii/gnokii.c:1396 +#: gnokii/gnokii.c:1382 #, c-format msgid "Sender: %s Msg Center: %s\n" msgstr "Saatja: %s Msg kekus: %s\n" -#: gnokii/gnokii.c:1402 -#, c-format -msgid "GSM operator logo for %s (%s) network.\n" -msgstr "GSM Operaatori Logo võrgule %s (%s).\n" - -#: gnokii/gnokii.c:1404 -msgid "Saved by Logo Express\n" -msgstr "" - -#: gnokii/gnokii.c:1405 -msgid "Saved by Operator Logo Uploader by Thomas Kessler\n" -msgstr "" - -#: gnokii/gnokii.c:1420 -#, c-format -msgid "File %s exists.\n" -msgstr "Fail %s on olemas.\n" - -#: gnokii/gnokii.c:1427 -#, c-format -msgid "Couldn't save logofile %s!\n" -msgstr "Ei suuda logofaili %s salvestada!\n" - -#: gnokii/gnokii.c:1435 +#: gnokii/gnokii.c:1388 #, c-format msgid "Linked (%d/%d):\n" msgstr "Seotud (%d/%d):\n" -#: gnokii/gnokii.c:1437 +#: gnokii/gnokii.c:1394 #, c-format msgid "" "Text:\n" @@ -1865,35 +1935,23 @@ msgstr "" "%s\n" "\n" -#: gnokii/gnokii.c:1442 gnokii/gnokii.c:2268 -msgid "Unknown\n" -msgstr "Tundmatu\n" - -#: gnokii/gnokii.c:1449 -msgid "(delete failed)\n" -msgstr "(kustutamine ebaõnnestus)\n" - -#: gnokii/gnokii.c:1451 -msgid "(message deleted)\n" -msgstr "(teade kustutatud)\n" - -#: gnokii/gnokii.c:1457 gnokii/gnokii.c:1569 gnokii/gnokii.c:1635 -#: gnokii/gnokii.c:2723 gnokii/gnokii.c:2833 +#: gnokii/gnokii.c:1403 gnokii/gnokii.c:1514 gnokii/gnokii.c:1580 +#: gnokii/gnokii.c:1693 gnokii/gnokii.c:2773 gnokii/gnokii.c:2882 #, c-format msgid "Function not implemented in %s model!\n" msgstr "%s mudelis pole see funktsioon rakendatud!\n" -#: gnokii/gnokii.c:1463 +#: gnokii/gnokii.c:1409 #, c-format msgid "Invalid location: %s %d\n" msgstr "Sobimatu asukoht: %s %d\n" -#: gnokii/gnokii.c:1469 +#: gnokii/gnokii.c:1415 #, c-format msgid "SMS location %s %d empty.\n" msgstr "SMS asukoht %s %d on tühi.\n" -#: gnokii/gnokii.c:1475 +#: gnokii/gnokii.c:1421 #, c-format msgid "" "GetSMS %s %d failed!(%d)\n" @@ -1902,17 +1960,12 @@ msgstr "" "LaeSMS %s %d ebõnnestus!(%d)\n" "\n" -#: gnokii/gnokii.c:1545 -#, c-format -msgid "Unknown memory type %s (use ME,SM,....)!\n" -msgstr "Tundmatu mälu tüüp %s (kasuta ME,SM,....)!\n" - -#: gnokii/gnokii.c:1566 +#: gnokii/gnokii.c:1511 #, c-format msgid "Deleted SMS %s %d\n" msgstr "Kustutatud SMS %s %d\n" -#: gnokii/gnokii.c:1573 +#: gnokii/gnokii.c:1518 #, c-format msgid "" "DeleteSMS %s %d failed!(%d)\n" @@ -1921,445 +1974,418 @@ msgstr "" "KustutaSMS %s %d ei õnnestunud!(%d)\n" "\n" -#: gnokii/gnokii.c:1624 +#: gnokii/gnokii.c:1561 gnokii/gnokii.c:1660 +msgid "" +"Wrong code in second parameter (allowed: PIN,PUK,PIN2,PUK2,SecurityCode)\n" +msgstr "" + +#: gnokii/gnokii.c:1569 msgid "Enter your code: " msgstr "Sisesta oma kood: " -#: gnokii/gnokii.c:1631 +#: gnokii/gnokii.c:1576 msgid "Error: invalid code.\n" msgstr "VIGA: Vale kood.\n" -#: gnokii/gnokii.c:1633 +#: gnokii/gnokii.c:1578 msgid "Code ok.\n" msgstr "Kood OK.\n" -#: gnokii/gnokii.c:1637 +#: gnokii/gnokii.c:1582 gnokii/gnokii.c:1696 msgid "Other error.\n" msgstr "Muu viga.\n" -#: gnokii/gnokii.c:1653 +#: gnokii/gnokii.c:1598 msgid "Security code status: " msgstr "Turvakoodi olek:" -#: gnokii/gnokii.c:1755 +#: gnokii/gnokii.c:1670 +msgid "Error: getting " +msgstr "Viga: võtmisel n" + +#: gnokii/gnokii.c:1672 +msgid "security code" +msgstr "Turvakood" + +#: gnokii/gnokii.c:1679 +msgid " not allowed\n" +msgstr " pole lubatud\n" + +#: gnokii/gnokii.c:1690 +#, c-format +msgid " is %s\n" +msgstr " on %s\n" + +#: gnokii/gnokii.c:1762 msgid "Sending operator logo.\n" msgstr "Saadan operaatori logo.\n" -#: gnokii/gnokii.c:1759 +#: gnokii/gnokii.c:1766 msgid "Sending caller line identification logo.\n" msgstr "" -#: gnokii/gnokii.c:1761 +#: gnokii/gnokii.c:1768 +msgid "It isn't possible to send startup logo!\n" +msgstr "" + +#: gnokii/gnokii.c:1771 +msgid "Sending picture image is not implemented !\n" +msgstr "" + +#: gnokii/gnokii.c:1774 msgid "You should specify what kind of logo to send!\n" msgstr "" -#: gnokii/gnokii.c:1780 +#: gnokii/gnokii.c:1785 gnokii/gnokii.c:1876 gnokii/gnokii.c:1950 +#: gnokii/gnokii.c:2067 gnokii/gnokii.c:2125 #, c-format -msgid "Operator code: %s\n" -msgstr "Operaatori kood: %s\n" +msgid "Can't open logofile %s !\n" +msgstr "Ei suuda logofaili %s avada!\n" -#: gnokii/gnokii.c:1829 +#: gnokii/gnokii.c:1787 gnokii/gnokii.c:1878 gnokii/gnokii.c:2127 #, c-format -msgid "Saving logo. File \"%s\" exists. (O)verwrite, create (n)ew or (s)kip ? " -msgstr "" +msgid "Wrong number of colors in %s logofile (accepted only 2-colors files) !\n" +msgstr "Vale värvide kogus %s logofailis (toetatud on ainult 2 värvi)!\n" + +#: gnokii/gnokii.c:1789 gnokii/gnokii.c:1880 gnokii/gnokii.c:2129 +#, c-format +msgid "Wrong colors in %s logofile !\n" +msgstr "%s logofailis on valed värvid !\n" + +#: gnokii/gnokii.c:1791 gnokii/gnokii.c:1882 gnokii/gnokii.c:2131 +#, c-format +msgid "Invalid format of %s logofile !\n" +msgstr "Sobimatu formaat %s logofailile !\n" -#: gnokii/gnokii.c:1837 -msgid "Enter name of new file: " +#: gnokii/gnokii.c:1793 gnokii/gnokii.c:1884 gnokii/gnokii.c:2133 +#, c-format +msgid "%s logofile is too short !\n" +msgstr "% logofail on liiga lühike !\n" + +#: gnokii/gnokii.c:1795 +msgid "Bitmap size doesn't supported by fileformat or different from 72x14, 84x48 and 72x28 !\n" msgstr "" -#: gnokii/gnokii.c:1847 +#: gnokii/gnokii.c:1814 #, c-format -msgid "Failed to write file \"%s\"\n" +msgid "Operator code: %s\n" +msgstr "Operaatori kood: %s\n" + +#: gnokii/gnokii.c:1869 +msgid "Files can't have the same names !\n" +msgstr "Failidel ei saa olla sama nimi !!\n" + +#: gnokii/gnokii.c:1886 gnokii/gnokii.c:2135 +msgid "Bitmap size doesn't supported by fileformat or different from 72x14, 84x48 and 72x28!\n" msgstr "" -#: gnokii/gnokii.c:1898 +#: gnokii/gnokii.c:2000 msgid "Getting Logo\n" msgstr "Võtan logo\n" -#: gnokii/gnokii.c:1905 +#: gnokii/gnokii.c:2009 msgid "Dealer welcome note " msgstr "" -#: gnokii/gnokii.c:1906 +#: gnokii/gnokii.c:2010 msgid "Welcome note " msgstr "" -#: gnokii/gnokii.c:1911 +#: gnokii/gnokii.c:2015 #, c-format msgid "currently set to \"%s\"\n" msgstr "hetkel seatud \"%s\"\n" -#: gnokii/gnokii.c:1969 +#: gnokii/gnokii.c:2079 msgid "Function not implemented !\n" msgstr "See funktsioon pole rakendatud!\n" -#: gnokii/gnokii.c:1972 +#: gnokii/gnokii.c:2082 msgid "This kind of logo is not supported !\n" msgstr "Sellist tüüpi logo toetus pole rakendatud !\n" -#: gnokii/gnokii.c:1975 +#: gnokii/gnokii.c:2085 msgid "Error getting logo !\n" msgstr "Viga logo võtmisel !\n" -#: gnokii/gnokii.c:1981 +#: gnokii/gnokii.c:2091 msgid "What kind of logo do you want to get ?\n" msgstr "" -#: gnokii/gnokii.c:1998 -#, c-format -msgid "Failed to read file \"%s\"\n" -msgstr "" - -#: gnokii/gnokii.c:2000 -#, c-format -msgid "" -"Wrong number of colors in \"%s\" logofile (accepted only 2-colors files) !\n" -msgstr "" -"Vale värvide kogus \"%s\" logofailis (toetatud on ainult 2 värvi)!\n" - -#: gnokii/gnokii.c:2002 -#, c-format -msgid "Wrong colors in \"%s\" logofile !\n" -msgstr "\"%s\" logofailis on valed värvid !\n" - -#: gnokii/gnokii.c:2004 -#, c-format -msgid "Invalid format of \"%s\" logofile !\n" -msgstr "Sobimatu formaat \"%s\" logofailile !\n" - -#: gnokii/gnokii.c:2006 -#, c-format -msgid "Sorry, gnokii doesn't support used subformat in file \"%s\" !\n" -msgstr "" - -#: gnokii/gnokii.c:2008 -#, c-format -msgid "\"%s\" logofile is too short !\n" -msgstr "\"%s\" logofail on liiga lühike !\n" - -#: gnokii/gnokii.c:2010 -msgid "" -"Bitmap size doesn't supported by fileformat or different from 72x14, 84x48 " -"and 72x28 !\n" -msgstr "" - -#: gnokii/gnokii.c:2090 +#: gnokii/gnokii.c:2182 msgid "Setting Logo.\n" msgstr "Määran logo.\n" -#: gnokii/gnokii.c:2104 +#: gnokii/gnokii.c:2196 msgid "Removing Logo.\n" msgstr "Eemaldan logo.\n" -#: gnokii/gnokii.c:2108 +#: gnokii/gnokii.c:2200 msgid "What kind of logo do you want to set ?\n" msgstr "" -#: gnokii/gnokii.c:2124 -msgid "Error setting" -msgstr "" - -#: gnokii/gnokii.c:2125 -msgid " dealer" -msgstr "" - -#: gnokii/gnokii.c:2126 -msgid " welcome note - " -msgstr "" - -#: gnokii/gnokii.c:2144 -msgid "SIM card and PIN is required\n" -msgstr "" - -#: gnokii/gnokii.c:2148 -#, c-format -msgid "too long, truncated to \"%s\" (length %i)\n" -msgstr "liiga pikk, lühendatud \"%s\" (pikkus %i)\n" - -#: gnokii/gnokii.c:2156 -msgid "Error setting startup logo - SIM card and PIN is required\n" -msgstr "" - -#: gnokii/gnokii.c:2164 +#: gnokii/gnokii.c:2210 msgid "Done.\n" -msgstr "Tehtud.\n" +msgstr "" -#: gnokii/gnokii.c:2166 +#: gnokii/gnokii.c:2212 msgid "Function not implemented.\n" msgstr "See funktsioon pole rakendatud.\n" -#: gnokii/gnokii.c:2168 +#: gnokii/gnokii.c:2214 msgid "This kind of logo is not supported.\n" msgstr "" -#: gnokii/gnokii.c:2170 +#: gnokii/gnokii.c:2216 msgid "Error !\n" msgstr "Viga !\n" -#: gnokii/gnokii.c:2247 +#: gnokii/gnokii.c:2292 msgid " Type of the note: " msgstr " Märke tüüp :" -#: gnokii/gnokii.c:2252 +#: gnokii/gnokii.c:2297 msgid "Reminder\n" msgstr "Meeldetuletus\n" -#: gnokii/gnokii.c:2256 +#: gnokii/gnokii.c:2301 msgid "Call\n" msgstr "Kõne\n" -#: gnokii/gnokii.c:2260 +#: gnokii/gnokii.c:2305 msgid "Meeting\n" msgstr "Koosolek\n" -#: gnokii/gnokii.c:2264 +#: gnokii/gnokii.c:2309 msgid "Birthday\n" msgstr "Sünnipäev\n" -#: gnokii/gnokii.c:2297 +#: gnokii/gnokii.c:2313 +msgid "Unknown\n" +msgstr "Tundmatu\n" + +#: gnokii/gnokii.c:2342 msgid "The calendar note can not be read\n" msgstr "Kalendri kirjet ei saa lugeda\n" -#: gnokii/gnokii.c:2315 -msgid "Failed to load vCalendar file.\n" -msgstr "" - -#: gnokii/gnokii.c:2323 gnokii/gnokii.c:3027 +#: gnokii/gnokii.c:2381 gnokii/gnokii.c:3051 msgid "Succesfully written!\n" msgstr "Edukalt kirjutatud!\n" -#: gnokii/gnokii.c:2325 -msgid "Failed to write calendar note!\n" -msgstr "Kalendri kirje kirjutamine ebaõnnestus!\n" - -#: gnokii/gnokii.c:2344 +#: gnokii/gnokii.c:2401 msgid " Calendar note deleted.\n" msgstr " Kalendri kirje kustutatud.\n" -#: gnokii/gnokii.c:2347 +#: gnokii/gnokii.c:2404 msgid "The calendar note can not be deleted\n" msgstr "Kalendri kirjet ei saa kustutada\n" -#: gnokii/gnokii.c:2416 +#: gnokii/gnokii.c:2473 #, c-format msgid "Date: %4d/%02d/%02d\n" msgstr "Kuupäev: %4d/%02d/%02d\n" -#: gnokii/gnokii.c:2417 +#: gnokii/gnokii.c:2474 #, c-format msgid "Time: %02d:%02d:%02d\n" msgstr "Kellaaeg: %02d:%02d:%02d\n" -#: gnokii/gnokii.c:2453 +#: gnokii/gnokii.c:2510 #, c-format msgid "Alarm: %s\n" msgstr "Äratus: %s\n" -#: gnokii/gnokii.c:2454 +#: gnokii/gnokii.c:2511 #, c-format msgid "Time: %02d:%02d\n" msgstr "Kellaaeg: %02d:%02d\n" -#: gnokii/gnokii.c:2496 +#: gnokii/gnokii.c:2552 msgid "Entering monitor mode...\n" msgstr "Siirdun monitooringu olekusse...\n" -#: gnokii/gnokii.c:2497 +#: gnokii/gnokii.c:2553 msgid "Initialising GSM interface...\n" msgstr "Initsialiseerin GSM liidest...\n" -#: gnokii/gnokii.c:2511 +#: gnokii/gnokii.c:2564 #, c-format msgid "RFLevel: %d\n" -msgstr "Väljatugevus: %d \"pulka\"\n" +msgstr "Väljatugevus: %d\n" -#: gnokii/gnokii.c:2514 +#: gnokii/gnokii.c:2567 #, c-format msgid "Battery: %d\n" -msgstr "Aku: %d \"pulka\"\n" +msgstr "Aku: %d\n" -#: gnokii/gnokii.c:2517 +#: gnokii/gnokii.c:2570 #, c-format msgid "Power Source: %s\n" msgstr "Toiteallikas: %s\n" -#: gnokii/gnokii.c:2517 +#: gnokii/gnokii.c:2570 msgid "AC/DC" msgstr "Vahelduvvool/Alalisvool" -#: gnokii/gnokii.c:2517 +#: gnokii/gnokii.c:2570 msgid "battery" msgstr "aku" -#: gnokii/gnokii.c:2520 +#: gnokii/gnokii.c:2573 #, c-format msgid "SIM: Used %d, Free %d\n" -msgstr "Kaardi mälukasutus : kasutusel on %d mälupesa, kasutamata %d mälupesa.\n" +msgstr "SIM: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2523 +#: gnokii/gnokii.c:2576 #, c-format msgid "Phone: Used %d, Free %d\n" -msgstr "Telefoni mälukasutus: kasutusel on %d mälupesa, kasutamata %d mälupesa.\n" +msgstr "Telefon: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2526 +#: gnokii/gnokii.c:2579 #, c-format msgid "DC: Used %d, Free %d\n" msgstr "DC: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2529 +#: gnokii/gnokii.c:2582 #, c-format msgid "EN: Used %d, Free %d\n" msgstr "EN: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2532 +#: gnokii/gnokii.c:2585 #, c-format msgid "FD: Used %d, Free %d\n" msgstr "FD: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2535 +#: gnokii/gnokii.c:2588 #, c-format msgid "LD: Used %d, Free %d\n" msgstr "LD: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2538 +#: gnokii/gnokii.c:2591 #, c-format msgid "MC: Used %d, Free %d\n" msgstr "MC: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2541 +#: gnokii/gnokii.c:2594 #, c-format msgid "ON: Used %d, Free %d\n" msgstr "ON: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2544 +#: gnokii/gnokii.c:2597 #, c-format msgid "RC: Used %d, Free %d\n" msgstr "RC: Kasutusel %d, Vaba %d\n" -#: gnokii/gnokii.c:2547 +#: gnokii/gnokii.c:2600 #, c-format msgid "SMS Messages: UnRead %d, Number %d\n" -msgstr "Tekstisõnumid: lugemata sõnumeid %d, kokku sõnumeid %d.\n" +msgstr "Tekstisõnumeid: lugemata %d, number %d\n" -#: gnokii/gnokii.c:2550 +#: gnokii/gnokii.c:2603 #, c-format msgid "Incoming call: %s\n" msgstr "Saabuv kõne: %s\n" -#: gnokii/gnokii.c:2553 +#: gnokii/gnokii.c:2606 #, c-format msgid "Network: %s (%s), LAC: %s, CellID: %s\n" msgstr "Võrk: %s (%s), LAC: %s, KärjeID: %s\n" -#: gnokii/gnokii.c:2556 -#, c-format -msgid "Cell broadcast received on channel %d: %s\n" -msgstr "Kanalil %d: saabus võrguteade %s\n" - -#: gnokii/gnokii.c:2561 +#: gnokii/gnokii.c:2611 msgid "Leaving monitor mode...\n" msgstr "Lahkun monitooringu olekust...\n" -#: gnokii/gnokii.c:2586 +#: gnokii/gnokii.c:2636 msgid "Entering display monitoring mode...\n" msgstr "Siirdun monitooringu olekusse...\n" -#: gnokii/gnokii.c:2594 +#: gnokii/gnokii.c:2644 msgid "Leaving display monitor mode...\n" -msgstr "" +msgstr "Lahkun monitooringu olekust...\n" -#: gnokii/gnokii.c:2598 gnokii/gnokii.c:2600 +#: gnokii/gnokii.c:2648 gnokii/gnokii.c:2650 msgid "Error!\n" msgstr "Viga!\n" -#: gnokii/gnokii.c:2649 +#: gnokii/gnokii.c:2699 #, c-format msgid "Profile number must be value from 1 to %d!\n" -msgstr "Profiili number peab olema vahemikust 1 kuni %d!\n" +msgstr "" -#: gnokii/gnokii.c:2656 +#: gnokii/gnokii.c:2706 #, c-format msgid "This phone supports only %d profiles!\n" msgstr "See telefon toetab ainult %d profiile!\n" -#: gnokii/gnokii.c:2728 +#: gnokii/gnokii.c:2778 msgid "Unspecified error\n" msgstr "Dokumenteerimata viga\n" -#: gnokii/gnokii.c:2838 +#: gnokii/gnokii.c:2887 #, c-format msgid "Memory type %s not supported!\n" msgstr "Mälu tüüp %s pole toetatud!\n" -#: gnokii/gnokii.c:2843 +#: gnokii/gnokii.c:2892 #, c-format msgid "%s|%d|Bad location or other error!(%d)\n" msgstr "%s|%d|Vale asukoht või muu viga!(%d)\n" -#: gnokii/gnokii.c:2902 gnokii/gnokii.c:2917 gnokii/gnokii.c:2935 +#: gnokii/gnokii.c:2969 #, c-format msgid "Format problem on line %d [%s]\n" msgstr "Formaadi probleem real %d [%s]\n" -#: gnokii/gnokii.c:2946 -msgid "Location busy. " -msgstr "" - -#: gnokii/gnokii.c:2956 -#, c-format -msgid "Unknown error (%d)\n" -msgstr "Tundmatu viga (%d)\n" - -#: gnokii/gnokii.c:2967 +#: gnokii/gnokii.c:2991 #, c-format msgid "Write Succeeded: memory type: %s, loc: %d, name: %s, number: %s\n" -msgstr "" -"Salvestamine õnnestus: mälu tüüp: %s, asukoht: %d, nimi: %s, number: %s\n" +msgstr "Salvestamine õnnestus: mälu tüüp: %s, asukoht: %d, nimi: %s, number: %s\n" -#: gnokii/gnokii.c:2969 +#: gnokii/gnokii.c:2993 #, c-format msgid "Write FAILED(%d): memory type: %s, loc: %d, name: %s, number: %s\n" -msgstr "" -"Salvestamine(%d) EBAÕNNESTUS: mälu tüüp: %s, asukoht: %d, nimi: %s, number: " -"%s\n" +msgstr "Salvestamine(%d) EBAÕNNESTUS: mälu tüüp: %s, asukoht: %d, nimi: %s, number: %s\n" -#: gnokii/gnokii.c:2989 +#: gnokii/gnokii.c:3013 #, c-format msgid "SpeedDial nr. %d: %d:%d\n" msgstr "Kiirvalik nr. %d: %d:%d\n" -#: gnokii/gnokii.c:3108 +#: gnokii/gnokii.c:3085 gnokiid/gnokiid.c:148 +#, c-format +msgid "Couldn't open %s or /etc/gnokiirc, using default config\n" +msgstr "Ei suuda %s avada ega ka /etc/gnokiirc, kasutan konfiguratsiooni vaikeväärtusi!\n" + +#: gnokii/gnokii.c:3178 #, c-format msgid "IMEI: %s\n" msgstr "" -#: gnokii/gnokii.c:3109 +#: gnokii/gnokii.c:3179 #, c-format msgid "Model: %s\n" msgstr "Mudel: %s\n" -#: gnokii/gnokii.c:3110 +#: gnokii/gnokii.c:3180 #, c-format msgid "Revision: %s\n" msgstr "Versioon: %s\n" -#: gnokii/gnokii.c:3142 -msgid "What kind of reset do you want??\n" +#: gnokii/gnokii.c:3213 +msgid "" +"What kind of reset do you want (second parameter can be \"soft\" or " +"\"hard\") ?\n" msgstr "" -#: gnokii/gnokii.c:3205 gnokii/gnokii.c:3231 +#: gnokii/gnokii.c:3281 gnokii/gnokii.c:3307 msgid "Failed to load ringtone.\n" msgstr "" -#: gnokii/gnokii.c:3244 +#: gnokii/gnokii.c:3320 msgid "Send failed\n" msgstr "Saatmine ebaõnnestus!\n" -#: gnokii/gnokii.c:3271 -msgid "Key press simulation failed.\n" -msgstr "" - -#: gnokiid/gnokiid.c:56 +#: gnokiid/gnokiid.c:58 #, c-format msgid "" "gnokiid Version %s\n" @@ -2373,7 +2399,7 @@ msgstr "" "Eestikeelne tõlge Hans Mõtshärg , 2000\n" "Kompileeritud %s %s telefonimudelile %s, ühendus pordis %s \n" -#: gnokiid/gnokiid.c:68 +#: gnokiid/gnokiid.c:70 msgid "" " usage: gnokiid {--help|--version}\n" " --help display usage information. --version " @@ -2381,84 +2407,84 @@ msgid "" "uses stdin/stdout for virtual modem comms.\n" msgstr "" -#: common/virtmodem.c:119 +#: gnokiid/virtmodem.c:87 msgid "VM_Initialise - VM_GSMInitialise failed!\n" msgstr "" -#: common/virtmodem.c:126 +#: gnokiid/virtmodem.c:94 msgid "VM_Initialise - VM_PtySetup failed!\n" msgstr "" -#: common/virtmodem.c:131 +#: gnokiid/virtmodem.c:99 msgid "VM_Initialise - ATEM_Initialise failed!\n" msgstr "" -#: common/virtmodem.c:136 +#: gnokiid/virtmodem.c:104 msgid "VM_Initialise - DP_Initialise failed!\n" msgstr "" -#: common/virtmodem.c:229 +#: gnokiid/virtmodem.c:198 msgid "Couldn't open pty!\n" msgstr "" -#: common/virtmodem.c:237 +#: gnokiid/virtmodem.c:206 msgid "gnokiid should not be installed setuid root!\n" -msgstr "gnokiid ei tohiks setuid root õigusega installerida!\n" +msgstr "gnokiid ei tohiks root õigustes installerida!\n" -#: common/virtmodem.c:242 +#: gnokiid/virtmodem.c:210 #, c-format msgid "Slave pty is %s, calling %s to create /dev/gnokii.\n" msgstr "" -#: common/virtmodem.c:304 +#: gnokiid/virtmodem.c:274 msgid "Hmmm... GSM_LinkOK never went true. Quitting. \n" msgstr "Hmmm... GSM_LinkOK ei tekkinud. Lõpetan. \n" -#: xgnokii/xgnokii.c:214 +#: xgnokii/xgnokii.c:196 msgid "Reading caller groups names ..." -msgstr "Loen helistajagruppide nimesid...." +msgstr "Loen helistaja grupide nimesid...." -#: xgnokii/xgnokii.c:218 xgnokii/xgnokii.c:1045 +#: xgnokii/xgnokii.c:200 xgnokii/xgnokii.c:993 msgid "Familly" msgstr "Perekond" -#: xgnokii/xgnokii.c:219 xgnokii/xgnokii.c:1057 +#: xgnokii/xgnokii.c:201 xgnokii/xgnokii.c:1005 msgid "VIP" msgstr "" -#: xgnokii/xgnokii.c:220 xgnokii/xgnokii.c:1069 +#: xgnokii/xgnokii.c:202 xgnokii/xgnokii.c:1017 msgid "Friends" msgstr "Sõbrad" -#: xgnokii/xgnokii.c:221 xgnokii/xgnokii.c:1081 +#: xgnokii/xgnokii.c:203 xgnokii/xgnokii.c:1029 msgid "Colleagues" msgstr "Kolleegid" -#: xgnokii/xgnokii.c:222 xgnokii/xgnokii.c:1093 +#: xgnokii/xgnokii.c:204 xgnokii/xgnokii.c:1041 msgid "Other" msgstr "Muud" -#: xgnokii/xgnokii.c:223 +#: xgnokii/xgnokii.c:205 msgid "No group" msgstr "Grupita" -#: xgnokii/xgnokii.c:348 +#: xgnokii/xgnokii.c:324 msgid "Short Message received" msgstr "Saabus Lühisõnum" -#: xgnokii/xgnokii.c:354 +#: xgnokii/xgnokii.c:336 msgid "Working ..." msgstr "Toimetan..." -#: xgnokii/xgnokii.c:371 +#: xgnokii/xgnokii.c:353 msgid "Call in progress" msgstr "kõne käimas" -#: xgnokii/xgnokii.c:384 +#: xgnokii/xgnokii.c:366 msgid "Hide" msgstr "Peida" -#: xgnokii/xgnokii.c:481 +#: xgnokii/xgnokii.c:463 #, c-format msgid "" "Outgoing call in progress:\n" @@ -2467,7 +2493,7 @@ msgstr "" "Kõne on käimas:\n" "Aeg: %s" -#: xgnokii/xgnokii.c:484 +#: xgnokii/xgnokii.c:466 #, c-format msgid "" "Incomming call from: %s\n" @@ -2476,643 +2502,362 @@ msgstr "" "Saabuv kõne: %s\n" "Kellaaeg: %s" -#: xgnokii/xgnokii.c:537 xgnokii/xgnokii_sms.c:687 +#: xgnokii/xgnokii.c:519 xgnokii/xgnokii_sms.c:580 #, c-format msgid "Set %d" msgstr "Sea %d" -#: xgnokii/xgnokii.c:559 xgnokii/xgnokii.c:1466 +#: xgnokii/xgnokii.c:541 xgnokii/xgnokii.c:1405 msgid "E-Mail" msgstr "" -#: xgnokii/xgnokii.c:571 +#: xgnokii/xgnokii.c:553 msgid "Voice" msgstr "Kõne" -#: xgnokii/xgnokii.c:582 xgnokii/xgnokii.c:1496 +#: xgnokii/xgnokii.c:564 xgnokii/xgnokii.c:1435 msgid "1 h" msgstr "1 t" -#: xgnokii/xgnokii.c:586 xgnokii/xgnokii.c:1503 +#: xgnokii/xgnokii.c:568 xgnokii/xgnokii.c:1442 msgid "6 h" msgstr "6 t" -#: xgnokii/xgnokii.c:590 xgnokii/xgnokii.c:606 xgnokii/xgnokii.c:1510 +#: xgnokii/xgnokii.c:572 xgnokii/xgnokii.c:588 xgnokii/xgnokii.c:1449 msgid "24 h" msgstr "24 t" -#: xgnokii/xgnokii.c:594 xgnokii/xgnokii.c:1517 +#: xgnokii/xgnokii.c:576 xgnokii/xgnokii.c:1456 msgid "72 h" msgstr "72 t" -#: xgnokii/xgnokii.c:602 +#: xgnokii/xgnokii.c:584 msgid "Max. time" msgstr "Max. aeg" -#: xgnokii/xgnokii.c:649 +#: xgnokii/xgnokii.c:631 msgid "Reading SMS centers ..." msgstr "Laadin SMS keskusi ..." -#: xgnokii/xgnokii.c:910 -msgid "SMS not supported!" -msgstr "SMS pole toetatud!" +#: xgnokii/xgnokii.c:984 +msgid "Error saving SMS centers!" +msgstr "Viga SMS keskuste salvestamisel!" -#: xgnokii/xgnokii.c:918 -msgid "Calendar not supported!" -msgstr "Kalender pole toetatud!" - -#: xgnokii/xgnokii.c:1106 +#: xgnokii/xgnokii.c:1054 msgid "Error writing configuration file!" msgstr "Viga konfiguratsioonifaili salvestamisel!" -#: xgnokii/xgnokii.c:1118 xgnokii/xgnokii_contacts.c:3025 +#: xgnokii/xgnokii.c:1066 xgnokii/xgnokii_contacts.c:2740 msgid "Contacts" msgstr "Kontaktid" -#: xgnokii/xgnokii.c:1124 xgnokii/xgnokii.c:1902 +#: xgnokii/xgnokii.c:1072 xgnokii/xgnokii.c:1808 msgid "SMS" msgstr "Lühisõnumid" -#: xgnokii/xgnokii.c:1129 xgnokii/xgnokii_calendar.c:867 +#: xgnokii/xgnokii.c:1077 msgid "Calendar" msgstr "Kalender" -#: xgnokii/xgnokii.c:1134 xgnokii/xgnokii_logos.c:1339 +#: xgnokii/xgnokii.c:1082 xgnokii/xgnokii_logos.c:1190 msgid "Logos" msgstr "Logod" -#: xgnokii/xgnokii.c:1140 +#: xgnokii/xgnokii.c:1088 msgid "DTMF" msgstr "DTMF" -#: xgnokii/xgnokii.c:1145 xgnokii/xgnokii_speed.c:559 +#: xgnokii/xgnokii.c:1093 xgnokii/xgnokii_speed.c:560 msgid "Speed Dial" msgstr "Kiirvalik" -#: xgnokii/xgnokii.c:1150 +#: xgnokii/xgnokii.c:1098 msgid "Keyboard" msgstr "Klaviatuur" -#: xgnokii/xgnokii.c:1155 xgnokii/xgnokii_netmon.c:317 +#: xgnokii/xgnokii.c:1103 xgnokii/xgnokii_netmon.c:318 msgid "Net Monitor" msgstr "Võrgu Monitor" -#: xgnokii/xgnokii.c:1160 -msgid "Data calls" -msgstr "Andmekõned" - -#: xgnokii/xgnokii.c:1169 xgnokii/xgnokii.c:1629 +#: xgnokii/xgnokii.c:1112 xgnokii/xgnokii.c:1568 msgid "Options" msgstr "Valikud" -#: xgnokii/xgnokii.c:1179 xgnokii/xgnokii.c:2207 +#: xgnokii/xgnokii.c:1122 xgnokii/xgnokii.c:2088 msgid "Help" msgstr "Abi" -#: xgnokii/xgnokii.c:1185 xgnokii/xgnokii.c:1202 +#: xgnokii/xgnokii.c:1128 xgnokii/xgnokii.c:1145 msgid "About" msgstr "Üldist" -#: xgnokii/xgnokii.c:1206 xgnokii/xgnokii.c:1390 -#: xgnokii/xgnokii_calendar.c:495 xgnokii/xgnokii_calendar.c:541 -#: xgnokii/xgnokii_calendar.c:616 xgnokii/xgnokii_calendar.c:766 -#: xgnokii/xgnokii_contacts.c:839 xgnokii/xgnokii_contacts.c:1035 -#: xgnokii/xgnokii_contacts.c:1400 xgnokii/xgnokii_contacts.c:2846 -#: xgnokii/xgnokii_sms.c:480 +#: xgnokii/xgnokii.c:1149 xgnokii/xgnokii.c:1329 +#: xgnokii/xgnokii_contacts.c:808 xgnokii/xgnokii_contacts.c:938 +#: xgnokii/xgnokii_contacts.c:1303 xgnokii/xgnokii_contacts.c:2567 +#: xgnokii/xgnokii_sms.c:477 msgid "Ok" msgstr "Ok" -#: xgnokii/xgnokii.c:1219 +#: xgnokii/xgnokii.c:1162 #, c-format msgid "" "xgnokii version: %s\n" "gnokii version: %s\n" "\n" -"Copyright (C) 1999,2000 Pavel Janík ml.,\n" -"Hugh Blemings, Jan Derfinak and others\n" -"xgnokii is free software, covered by the GNU General Public License, and you " -"are\n" -"welcome to change it and/or distribute copies of it under certain " -"conditions.\n" -"There is absolutely no waranty for xgnokii. See GPL for details.\n" +"Copyright (C) 1999 Pavel Janík ml.,\n" +"Hugh Blemings & Jan Derfinak\n" msgstr "" +"xgnokii versioon: %s\n" +"gnokii versioon: %s\n" +"\n" +"Copyright (C) 1999 Pavel Janík ml.,\n" +"Hugh Blemings & Jan Derfinak\n" -#: xgnokii/xgnokii.c:1384 +#: xgnokii/xgnokii.c:1323 msgid "Edit SMS Setting" msgstr "Muuda SMS seadeid" -#: xgnokii/xgnokii.c:1398 xgnokii/xgnokii_calendar.c:504 -#: xgnokii/xgnokii_calendar.c:550 xgnokii/xgnokii_calendar.c:624 -#: xgnokii/xgnokii_calendar.c:774 xgnokii/xgnokii_common.c:64 -#: xgnokii/xgnokii_common.c:150 xgnokii/xgnokii_contacts.c:847 -#: xgnokii/xgnokii_contacts.c:1043 xgnokii/xgnokii_contacts.c:1272 -#: xgnokii/xgnokii_contacts.c:1318 xgnokii/xgnokii_contacts.c:1409 -#: xgnokii/xgnokii_contacts.c:1682 xgnokii/xgnokii_contacts.c:1797 -#: xgnokii/xgnokii_contacts.c:2853 xgnokii/xgnokii_sms.c:488 +#: xgnokii/xgnokii.c:1337 xgnokii/xgnokii_common.c:247 +#: xgnokii/xgnokii_common.c:333 xgnokii/xgnokii_contacts.c:816 +#: xgnokii/xgnokii_contacts.c:946 xgnokii/xgnokii_contacts.c:1175 +#: xgnokii/xgnokii_contacts.c:1221 xgnokii/xgnokii_contacts.c:1312 +#: xgnokii/xgnokii_contacts.c:1585 xgnokii/xgnokii_contacts.c:2574 +#: xgnokii/xgnokii_sms.c:485 msgid "Cancel" msgstr "Tühista" -#: xgnokii/xgnokii.c:1411 +#: xgnokii/xgnokii.c:1350 msgid "Set's name:" msgstr "Seade nimi:" -#: xgnokii/xgnokii.c:1424 +#: xgnokii/xgnokii.c:1363 msgid "Center:" msgstr "Keskus:" -#: xgnokii/xgnokii.c:1437 +#: xgnokii/xgnokii.c:1376 msgid "Sending Format:" msgstr "Saate Formaat:" -#: xgnokii/xgnokii.c:1481 +#: xgnokii/xgnokii.c:1420 msgid "Validity Period:" msgstr "Kehtivus periood:" -#: xgnokii/xgnokii.c:1489 +#: xgnokii/xgnokii.c:1428 msgid "Max. Time" msgstr "Max. Aeg" -#: xgnokii/xgnokii.c:1626 +#: xgnokii/xgnokii.c:1565 msgid "Set's name" msgstr "Seade nimi" -#: xgnokii/xgnokii.c:1626 +#: xgnokii/xgnokii.c:1565 msgid "Center number" msgstr "Keskuse number" -#: xgnokii/xgnokii.c:1626 +#: xgnokii/xgnokii.c:1565 msgid "Format" msgstr "Formaat" -#: xgnokii/xgnokii.c:1626 +#: xgnokii/xgnokii.c:1565 msgid "Validity" msgstr "Kehtivus" -#: xgnokii/xgnokii.c:1634 +#: xgnokii/xgnokii.c:1573 msgid "Apply" msgstr "Kehtesta" -#: xgnokii/xgnokii.c:1643 xgnokii/xgnokii_contacts.c:1666 +#: xgnokii/xgnokii.c:1582 xgnokii/xgnokii_contacts.c:1569 #: xgnokii/xgnokii_dtmf.c:178 msgid "Save" msgstr "Salvesta" -#: xgnokii/xgnokii.c:1650 +#: xgnokii/xgnokii.c:1589 msgid "Close" msgstr "Sulge" -#: xgnokii/xgnokii.c:1665 +#: xgnokii/xgnokii.c:1604 msgid "Phone and connection type" msgstr "Telefon ja ühenduse tüüp" -#: xgnokii/xgnokii.c:1672 +#: xgnokii/xgnokii.c:1611 msgid "Connection" msgstr "Ühendus" -#: xgnokii/xgnokii.c:1679 +#: xgnokii/xgnokii.c:1618 msgid "Port:" msgstr "Pordis:" -#: xgnokii/xgnokii.c:1694 xgnokii/xgnokii.c:1766 +#: xgnokii/xgnokii.c:1633 xgnokii/xgnokii.c:1705 msgid "Model:" msgstr "Mudel:" -#: xgnokii/xgnokii.c:1709 +#: xgnokii/xgnokii.c:1648 msgid "Init length:" msgstr "Init pikkus:" -#: xgnokii/xgnokii.c:1724 +#: xgnokii/xgnokii.c:1663 msgid "Bindir:" msgstr "BIN kataloog:" -#: xgnokii/xgnokii.c:1739 +#: xgnokii/xgnokii.c:1678 msgid "Connection:" msgstr "Ühendus:" -#: xgnokii/xgnokii.c:1743 +#: xgnokii/xgnokii.c:1682 msgid "infrared" msgstr "infrapunane" -#: xgnokii/xgnokii.c:1747 +#: xgnokii/xgnokii.c:1686 msgid "serial" -msgstr "kaabliga" +msgstr "" -#: xgnokii/xgnokii.c:1752 +#: xgnokii/xgnokii.c:1691 msgid "Phone information" msgstr "Telefoni info" -#: xgnokii/xgnokii.c:1781 +#: xgnokii/xgnokii.c:1720 msgid "Version:" msgstr "Versioon:" -#: xgnokii/xgnokii.c:1796 +#: xgnokii/xgnokii.c:1735 msgid "Revision:" msgstr "Revision:" -#: xgnokii/xgnokii.c:1811 +#: xgnokii/xgnokii.c:1750 msgid "IMEI:" msgstr "IMEI:" -#: xgnokii/xgnokii.c:1826 -msgid "Names length:" -msgstr "Nime pikkus:" - -#: xgnokii/xgnokii.c:1834 -msgid "SIM:" -msgstr "Kaardil:" - -#: xgnokii/xgnokii.c:1852 -msgid "Phone:" -msgstr "Telefonis:" - -#: xgnokii/xgnokii.c:1859 +#: xgnokii/xgnokii.c:1764 msgid "Alarm setting" msgstr "Äratuse seaded" -#: xgnokii/xgnokii.c:1866 xgnokii/xgnokii.c:1873 -#: xgnokii/xgnokii_calendar.c:688 xgnokii/xgnokii_calendar.c:863 +#: xgnokii/xgnokii.c:1771 xgnokii/xgnokii.c:1778 msgid "Alarm" -msgstr "Meenutus" +msgstr "Äratus" -#: xgnokii/xgnokii.c:1896 xgnokii/xgnokii_sms.c:1544 +#: xgnokii/xgnokii.c:1802 xgnokii/xgnokii_sms.c:1433 msgid "Short Message Service" msgstr "Lühisõnumi teenus" -#: xgnokii/xgnokii.c:1930 +#: xgnokii/xgnokii.c:1836 msgid "Edit" msgstr "Redigeeri" -#: xgnokii/xgnokii.c:1944 +#: xgnokii/xgnokii.c:1850 msgid "Business Card" msgstr "Visiitkaart" -#: xgnokii/xgnokii.c:1950 +#: xgnokii/xgnokii.c:1856 msgid "User" msgstr "Kasutaja" -#: xgnokii/xgnokii.c:1968 xgnokii/xgnokii_contacts.c:860 +#: xgnokii/xgnokii.c:1874 xgnokii/xgnokii_contacts.c:829 msgid "Name:" msgstr "Nimi:" -#: xgnokii/xgnokii.c:1994 +#: xgnokii/xgnokii.c:1900 msgid "Title:" msgstr "Amet:" -#: xgnokii/xgnokii.c:2020 +#: xgnokii/xgnokii.c:1926 msgid "Company:" msgstr "Ettevõte:" -#: xgnokii/xgnokii.c:2046 +#: xgnokii/xgnokii.c:1952 msgid "Telephone:" msgstr "Telefon:" -#: xgnokii/xgnokii.c:2071 +#: xgnokii/xgnokii.c:1977 msgid "Fax:" msgstr "Fax:" -#: xgnokii/xgnokii.c:2096 +#: xgnokii/xgnokii.c:2002 msgid "E-Mail:" msgstr "E-Mail:" -#: xgnokii/xgnokii.c:2122 +#: xgnokii/xgnokii.c:2028 msgid "Address:" msgstr "Aadress:" -#: xgnokii/xgnokii.c:2146 +#: xgnokii/xgnokii.c:2052 msgid "Caller groups names" msgstr "Helistaja grupi nimi" -#: xgnokii/xgnokii.c:2153 +#: xgnokii/xgnokii.c:2059 msgid "Groups" msgstr "Grupid" -#: xgnokii/xgnokii.c:2162 +#: xgnokii/xgnokii.c:2068 #, c-format msgid "Group %d:" msgstr "Grupp %d:" -#: xgnokii/xgnokii.c:2175 -msgid "Mailbox" -msgstr "" - -#: xgnokii/xgnokii.c:2182 -msgid "Mail" -msgstr "" - -#: xgnokii/xgnokii.c:2189 -msgid "Path to mailbox:" -msgstr "" - -#: xgnokii/xgnokii.c:2200 +#: xgnokii/xgnokii.c:2081 msgid "Help viewer" msgstr "Abi lehitseja" -#: xgnokii/xgnokii.c:2214 +#: xgnokii/xgnokii.c:2095 msgid "Viewer:" msgstr "Lehitseja:" -#: xgnokii/xgnokii_calendar.c:123 -msgid "Reminder" -msgstr "Meeldetuletus" - -#: xgnokii/xgnokii_calendar.c:130 -msgid "Call" -msgstr "Kõne" - -#: xgnokii/xgnokii_calendar.c:138 -msgid "Meeting" -msgstr "Koosolek" - -#: xgnokii/xgnokii_calendar.c:146 -msgid "Birthday" -msgstr "Sünnipäev" - -#: xgnokii/xgnokii_calendar.c:194 -msgid "Type: " -msgstr "Tüüp: " - -#: xgnokii/xgnokii_calendar.c:202 xgnokii/xgnokii_sms.c:384 -msgid "Date: " -msgstr "Kuupäev: " - -#: xgnokii/xgnokii_calendar.c:217 -msgid "Alarm: " -msgstr "Meenutus: " - -#: xgnokii/xgnokii_calendar.c:238 -msgid "Text: " -msgstr "Tekst: " - -#: xgnokii/xgnokii_calendar.c:488 xgnokii/xgnokii_calendar.c:534 -msgid "Choose date" -msgstr "Vali kuupäev" - -#: xgnokii/xgnokii_calendar.c:571 -msgid "Alarm time:" -msgstr "Meenutuse aeg:" - -#: xgnokii/xgnokii_calendar.c:609 xgnokii/xgnokii_calendar.c:929 -msgid "Add reminder" -msgstr "Lisa meenutus" - -#: xgnokii/xgnokii_calendar.c:641 -msgid "Date:" -msgstr "Kuupäev:" - -#: xgnokii/xgnokii_calendar.c:676 -msgid "Subject:" -msgstr "" - -#: xgnokii/xgnokii_calendar.c:759 -msgid "Delete calendar note" -msgstr "Kustuta kalendri kirje" - -#: xgnokii/xgnokii_calendar.c:791 -msgid "Do you want to delete selected note(s)?" -msgstr "Kas soovid valitud kirje(d) kustutada?" - -#: xgnokii/xgnokii_calendar.c:826 xgnokii/xgnokii_contacts.c:2980 -#: xgnokii/xgnokii_dtmf.c:217 xgnokii/xgnokii_logos.c:1292 -#: xgnokii/xgnokii_netmon.c:259 xgnokii/xgnokii_sms.c:1121 -#: xgnokii/xgnokii_sms.c:1507 xgnokii/xgnokii_speed.c:527 -#: xgnokii/xgnokii_xkeyb.c:242 -msgid "/_File" -msgstr "/_Fail" - -#: xgnokii/xgnokii_calendar.c:827 xgnokii/xgnokii_contacts.c:2981 -#: xgnokii/xgnokii_speed.c:528 -msgid "/File/_Read from phone" -msgstr "/Fail/Loe telefonist" - -#: xgnokii/xgnokii_calendar.c:828 xgnokii/xgnokii_contacts.c:2982 -#: xgnokii/xgnokii_speed.c:529 -msgid "/File/_Save to phone" -msgstr "/Fail/_Salvesta telefoni" - -#: xgnokii/xgnokii_calendar.c:829 xgnokii/xgnokii_contacts.c:2983 -#: xgnokii/xgnokii_dtmf.c:220 xgnokii/xgnokii_logos.c:1296 -#: xgnokii/xgnokii_sms.c:1124 xgnokii/xgnokii_sms.c:1510 -#: xgnokii/xgnokii_speed.c:530 -msgid "/File/Sep1" -msgstr "/Fail/Sep1" - -#: xgnokii/xgnokii_calendar.c:830 -msgid "/File/Send via S_MS" -msgstr "/Fail/Saada S_MS abil" - -#: xgnokii/xgnokii_calendar.c:831 xgnokii/xgnokii_contacts.c:2986 -#: xgnokii/xgnokii_logos.c:1300 xgnokii/xgnokii_sms.c:1127 -#: xgnokii/xgnokii_speed.c:533 -msgid "/File/Sep2" -msgstr "/Fail/Sep2" - -#: xgnokii/xgnokii_calendar.c:832 xgnokii/xgnokii_contacts.c:2984 -#: xgnokii/xgnokii_speed.c:531 -msgid "/File/_Import from file" -msgstr "/Fail/_Impordi failist" - -#: xgnokii/xgnokii_calendar.c:833 xgnokii/xgnokii_contacts.c:2985 -#: xgnokii/xgnokii_speed.c:532 -msgid "/File/_Export to file" -msgstr "/Fail/Salv_esta faili" - -#: xgnokii/xgnokii_calendar.c:834 -msgid "/File/Sep3" -msgstr "/Fail/Sep3" - -#: xgnokii/xgnokii_calendar.c:835 xgnokii/xgnokii_contacts.c:2987 -#: xgnokii/xgnokii_dtmf.c:221 xgnokii/xgnokii_logos.c:1301 -#: xgnokii/xgnokii_netmon.c:260 xgnokii/xgnokii_sms.c:1128 -#: xgnokii/xgnokii_sms.c:1511 xgnokii/xgnokii_speed.c:534 -#: xgnokii/xgnokii_xkeyb.c:243 -msgid "/File/_Close" -msgstr "/Fail/Sulge" - -#: xgnokii/xgnokii_calendar.c:836 xgnokii/xgnokii_contacts.c:2988 -#: xgnokii/xgnokii_logos.c:1302 xgnokii/xgnokii_speed.c:535 -msgid "/_Edit" -msgstr "/R_edigeeri" - -#: xgnokii/xgnokii_calendar.c:837 -msgid "/Edit/Add _reminder" -msgstr "/Redigeeri/Lisa meenutus" - -#: xgnokii/xgnokii_calendar.c:838 -msgid "/Edit/Add _call" -msgstr "/Redigeeri/Lisa kõne" - -#: xgnokii/xgnokii_calendar.c:839 -msgid "/Edit/Add _meeting" -msgstr "/Redigeeri/Lisa koosolek" - -#: xgnokii/xgnokii_calendar.c:840 -msgid "/Edit/Add _birthday" -msgstr "/Redigeeri/Lisa sünnipäev" - -#: xgnokii/xgnokii_calendar.c:841 xgnokii/xgnokii_contacts.c:2991 -#: xgnokii/xgnokii_speed.c:536 -msgid "/Edit/_Edit" -msgstr "/Redigeeri/Paranda" - -#: xgnokii/xgnokii_calendar.c:842 xgnokii/xgnokii_contacts.c:2992 -msgid "/Edit/_Delete" -msgstr "/Redigeeri/Kustuta" - -#: xgnokii/xgnokii_calendar.c:843 xgnokii/xgnokii_contacts.c:2995 -#: xgnokii/xgnokii_logos.c:1310 -msgid "/Edit/Sep4" -msgstr "/Redigeeri/Sep4" - -#: xgnokii/xgnokii_calendar.c:844 xgnokii/xgnokii_contacts.c:2999 -msgid "/Edit/Select _all" -msgstr "/Redigeeri/V_ali kõik" - -#: xgnokii/xgnokii_calendar.c:845 xgnokii/xgnokii_contacts.c:3002 -#: xgnokii/xgnokii_dtmf.c:222 xgnokii/xgnokii_netmon.c:264 -#: xgnokii/xgnokii_sms.c:1129 xgnokii/xgnokii_sms.c:1519 -#: xgnokii/xgnokii_speed.c:537 xgnokii/xgnokii_xkeyb.c:244 -msgid "/_Help" -msgstr "/Abi" - -#: xgnokii/xgnokii_calendar.c:846 xgnokii/xgnokii_contacts.c:3003 -#: xgnokii/xgnokii_dtmf.c:223 xgnokii/xgnokii_netmon.c:265 -#: xgnokii/xgnokii_sms.c:1130 xgnokii/xgnokii_sms.c:1520 -#: xgnokii/xgnokii_speed.c:538 xgnokii/xgnokii_xkeyb.c:245 -msgid "/Help/_Help" -msgstr "/Abi/Abi" - -#: xgnokii/xgnokii_calendar.c:847 xgnokii/xgnokii_contacts.c:3004 -#: xgnokii/xgnokii_dtmf.c:224 xgnokii/xgnokii_netmon.c:266 -#: xgnokii/xgnokii_sms.c:1131 xgnokii/xgnokii_sms.c:1521 -#: xgnokii/xgnokii_speed.c:539 xgnokii/xgnokii_xkeyb.c:246 -msgid "/Help/_About" -msgstr "/Abi/Üldine" - -#: xgnokii/xgnokii_calendar.c:862 -msgid "#" -msgstr "" - -#: xgnokii/xgnokii_calendar.c:862 -msgid "Type" -msgstr "Tüüp" - -#: xgnokii/xgnokii_calendar.c:862 -msgid "Date" -msgstr "Kuupäev" - -#: xgnokii/xgnokii_calendar.c:863 xgnokii/xgnokii_contacts.c:1350 -#: xgnokii/xgnokii_contacts.c:3020 xgnokii/xgnokii_speed.c:554 -msgid "Number" -msgstr "Number" - -#: xgnokii/xgnokii_calendar.c:896 xgnokii/xgnokii_contacts.c:3056 -#: xgnokii/xgnokii_speed.c:590 -msgid "Read from phone" -msgstr "Loe telefonist" - -#: xgnokii/xgnokii_calendar.c:900 xgnokii/xgnokii_contacts.c:3060 -#: xgnokii/xgnokii_speed.c:594 -msgid "Save to phone" -msgstr "Salvesta telefoni" - -#: xgnokii/xgnokii_calendar.c:907 -msgid "Send via SMS" -msgstr "Saada SMS abil" - -#: xgnokii/xgnokii_calendar.c:914 xgnokii/xgnokii_contacts.c:3067 -#: xgnokii/xgnokii_logos.c:1386 xgnokii/xgnokii_speed.c:601 -msgid "Import from file" -msgstr "Ava fail" - -#: xgnokii/xgnokii_calendar.c:918 xgnokii/xgnokii_contacts.c:3071 -#: xgnokii/xgnokii_logos.c:1390 xgnokii/xgnokii_speed.c:605 -msgid "Export to file" -msgstr "Salvesta fail" - -#: xgnokii/xgnokii_calendar.c:925 -msgid "Edit note" -msgstr "Muuda kirjet" - -#: xgnokii/xgnokii_calendar.c:933 -msgid "Add call" -msgstr "Lisa kõne" - -#: xgnokii/xgnokii_calendar.c:937 -msgid "Add meeting" -msgstr "Lisa koosolek" - -#: xgnokii/xgnokii_calendar.c:941 -msgid "Add birthday" -msgstr "Lisa sünnipäev" - -#: xgnokii/xgnokii_calendar.c:945 -msgid "Delete note" -msgstr "Kustuta kirje" - -#: xgnokii/xgnokii_calendar.c:1005 xgnokii/xgnokii_contacts.c:2876 -#: xgnokii/xgnokii_contacts.c:3126 xgnokii/xgnokii_sms.c:1686 -#: xgnokii/xgnokii_speed.c:637 -#, c-format -msgid "Error: %s: line %d: Can't allocate memory!\n" -msgstr "VIGA: %s: rida %d: Ei suuda eraldada mälu!\n" - -#: xgnokii/xgnokii_calendar.c:1034 xgnokii/xgnokii_sms.c:1719 -msgid "couldn't allocate colour" -msgstr "ei suuda värvi määratleda" - -#: xgnokii/xgnokii_cfg.c:80 +#: xgnokii/xgnokii.c:2256 xgnokii/xgnokii_cfg.c:71 msgid "WARNING: Can't find HOME enviroment variable!\n" msgstr "HOIATUS: Ei leia HOME keskkonnamuutujat!\n" -#: xgnokii/xgnokii_cfg.c:86 xgnokii/xgnokii_cfg.c:101 +#: xgnokii/xgnokii.c:2261 xgnokii/xgnokii_cfg.c:77 xgnokii/xgnokii_cfg.c:92 msgid "WARNING: Can't allocate memory for config reading!\n" msgstr "HOIATUS: Ei suuda eraldada mälu konfiguratsiooni lugemiseks!\n" -#: xgnokii/xgnokii_cfg.c:185 +#: xgnokii/xgnokii.c:2276 +#, c-format +msgid "Couldn't open %s or /etc/gnokiirc, using default config!\n" +msgstr "Ei suuda %s avada ega ka /etc/gnokiirc, kasutan konfiguratsiooni vaikeväärtusi!\n" + +#: xgnokii/xgnokii_cfg.c:156 msgid "ERROR: Can't find HOME enviroment variable!\n" msgstr "VIGA: Ei leia HOME keskkonnamuutujat!\n" -#: xgnokii/xgnokii_cfg.c:191 xgnokii/xgnokii_cfg.c:209 +#: xgnokii/xgnokii_cfg.c:162 xgnokii/xgnokii_cfg.c:180 msgid "ERROR: Can't allocate memory for config writing!\n" msgstr "VIGA: Ei suuda eraldada konfiguratsiooni kirjutamiseks mälu!\n" -#: xgnokii/xgnokii_cfg.c:197 +#: xgnokii/xgnokii_cfg.c:168 #, c-format msgid "ERROR: Can't open file %s for writing!\n" msgstr "VIGA: Ei suuda faili %s lugemiseks avada!\n" -#: xgnokii/xgnokii_cfg.c:215 +#: xgnokii/xgnokii_cfg.c:186 msgid "ERROR: Can't write config file!\n" -msgstr "VIGA: Ei saa kirjutada konfiguratsioonifaili!\n" +msgstr "VIGA: Ei saa kirjutada konfiguratsiooni faili!\n" -#: xgnokii/xgnokii_common.c:57 +#: xgnokii/xgnokii_common.c:240 msgid "Error" msgstr "Viga" -#: xgnokii/xgnokii_common.c:96 +#: xgnokii/xgnokii_common.c:279 msgid "Info" msgstr "Hangin Infot ...." -#: xgnokii/xgnokii_common.c:134 +#: xgnokii/xgnokii_common.c:317 msgid "Yes" msgstr "Jah" -#: xgnokii/xgnokii_common.c:143 +#: xgnokii/xgnokii_common.c:326 msgid "No" msgstr "Ei" -#: xgnokii/xgnokii_common.c:230 +#: xgnokii/xgnokii_common.c:413 #, c-format msgid "Can't exec %s\n" msgstr "Ei saa käivitada %s\n" -#: xgnokii/xgnokii_contacts.c:246 xgnokii/xgnokii_contacts.c:279 -#: xgnokii/xgnokii_contacts.c:448 xgnokii/xgnokii_contacts.c:473 -#: xgnokii/xgnokii_contacts.c:613 xgnokii/xgnokii_contacts.c:635 +#: xgnokii/xgnokii_contacts.c:232 xgnokii/xgnokii_contacts.c:265 +#: xgnokii/xgnokii_contacts.c:428 xgnokii/xgnokii_contacts.c:453 +#: xgnokii/xgnokii_contacts.c:587 xgnokii/xgnokii_contacts.c:609 msgid "Can't change memory type!" msgstr "Ei saa muuta mälu tüüpi!" -#: xgnokii/xgnokii_contacts.c:290 xgnokii/xgnokii_contacts.c:337 +#: xgnokii/xgnokii_contacts.c:276 xgnokii/xgnokii_contacts.c:323 msgid "" "Sorry, phonebook name will be truncated,\n" "because you save it into SIM memory!" @@ -3120,7 +2865,7 @@ msgstr "" "SIM kaardile ei mahu nii pikk nimi, \n" "lühendan nime, nii et mahuks kaardile!" -#: xgnokii/xgnokii_contacts.c:484 xgnokii/xgnokii_contacts.c:523 +#: xgnokii/xgnokii_contacts.c:464 xgnokii/xgnokii_contacts.c:503 msgid "" "Sorry, phonebook name will be truncated\n" "because you save it into SIM memory!" @@ -3128,65 +2873,61 @@ msgstr "" "SIM kaardile ei mahu nii pikk nimi, \n" "lühendan nime, nii et mahuks kaardile!" -#: xgnokii/xgnokii_contacts.c:729 +#: xgnokii/xgnokii_contacts.c:698 msgid "Can't find pattern!" msgstr "Ei leia sobivust!" -#: xgnokii/xgnokii_contacts.c:873 xgnokii/xgnokii_contacts.c:1418 +#: xgnokii/xgnokii_contacts.c:842 xgnokii/xgnokii_contacts.c:1321 msgid "Number:" msgstr "Number:" -#: xgnokii/xgnokii_contacts.c:888 -msgid "Extended:" -msgstr "Laiendatud:" - -#: xgnokii/xgnokii_contacts.c:905 +#: xgnokii/xgnokii_contacts.c:854 msgid "Memory:" msgstr "Mälu:" -#: xgnokii/xgnokii_contacts.c:909 +#: xgnokii/xgnokii_contacts.c:858 msgid "phone" msgstr "telefon" -#: xgnokii/xgnokii_contacts.c:922 +#: xgnokii/xgnokii_contacts.c:871 msgid "Caller group:" msgstr "Helistajagrupp:" -#: xgnokii/xgnokii_contacts.c:939 xgnokii/xgnokii_contacts.c:3086 -#: xgnokii/xgnokii_speed.c:612 +#: xgnokii/xgnokii_contacts.c:885 xgnokii/xgnokii_contacts.c:2801 +#: xgnokii/xgnokii_speed.c:613 msgid "Edit entry" msgstr "Muuda kirjet" -#: xgnokii/xgnokii_contacts.c:1028 +#: xgnokii/xgnokii_contacts.c:931 msgid "Delete entries" msgstr "Kustuta kirjed" -#: xgnokii/xgnokii_contacts.c:1060 +#: xgnokii/xgnokii_contacts.c:963 msgid "Do you want to delete selected entries?" msgstr "Kas soovid valitud kirje kustutada?" -#: xgnokii/xgnokii_contacts.c:1072 xgnokii/xgnokii_contacts.c:3078 +#: xgnokii/xgnokii_contacts.c:975 xgnokii/xgnokii_contacts.c:2793 msgid "New entry" msgstr "Uus kirje" -#: xgnokii/xgnokii_contacts.c:1111 xgnokii/xgnokii_contacts.c:3082 +#: xgnokii/xgnokii_contacts.c:1014 xgnokii/xgnokii_contacts.c:2797 msgid "Duplicate entry" msgstr "Kopeeri kirjet" -#: xgnokii/xgnokii_contacts.c:1177 xgnokii/xgnokii_contacts.c:1187 -#: xgnokii/xgnokii_contacts.c:1212 +#: xgnokii/xgnokii_contacts.c:1080 xgnokii/xgnokii_contacts.c:1090 +#: xgnokii/xgnokii_contacts.c:1115 msgid "Can't find free memory." msgstr "Ei leia vaba mälu." -#: xgnokii/xgnokii_contacts.c:1256 +#: xgnokii/xgnokii_contacts.c:1159 msgid "Changing memory type" msgstr "Muudan mälu tüüpi" -#: xgnokii/xgnokii_contacts.c:1263 +#: xgnokii/xgnokii_contacts.c:1166 msgid "Continue" msgstr "Jätka" -#: xgnokii/xgnokii_contacts.c:1283 +#: xgnokii/xgnokii_contacts.c:1186 msgid "" "If you change from phone memory to SIM memory\n" "some entries may be truncated." @@ -3194,54 +2935,59 @@ msgstr "" "Kirje muutmisel telefonimälust SIM kaardile\n" "võivad mõned kirjed muutuda lühemaks." -#: xgnokii/xgnokii_contacts.c:1303 xgnokii/xgnokii_contacts.c:1309 +#: xgnokii/xgnokii_contacts.c:1206 xgnokii/xgnokii_contacts.c:1212 msgid "Find" msgstr "Otsi" -#: xgnokii/xgnokii_contacts.c:1331 +#: xgnokii/xgnokii_contacts.c:1234 msgid "Pattern:" msgstr "Mask:" -#: xgnokii/xgnokii_contacts.c:1344 xgnokii/xgnokii_contacts.c:3020 -#: xgnokii/xgnokii_speed.c:554 +#: xgnokii/xgnokii_contacts.c:1247 xgnokii/xgnokii_contacts.c:2735 +#: xgnokii/xgnokii_speed.c:555 msgid "Name" msgstr "Nimi" -#: xgnokii/xgnokii_contacts.c:1394 xgnokii/xgnokii_contacts.c:3097 +#: xgnokii/xgnokii_contacts.c:1253 xgnokii/xgnokii_contacts.c:2735 +#: xgnokii/xgnokii_speed.c:555 +msgid "Number" +msgstr "Number" + +#: xgnokii/xgnokii_contacts.c:1297 xgnokii/xgnokii_contacts.c:2812 msgid "Dial voice" msgstr "Helista" -#: xgnokii/xgnokii_contacts.c:1520 +#: xgnokii/xgnokii_contacts.c:1423 msgid "Phone memory..." msgstr "Telefoni mälu..." -#: xgnokii/xgnokii_contacts.c:1531 +#: xgnokii/xgnokii_contacts.c:1434 msgid "SIM memory..." msgstr "SIM (kaardi) mälu..." -#: xgnokii/xgnokii_contacts.c:1560 +#: xgnokii/xgnokii_contacts.c:1463 msgid "Saving entries" msgstr "Salvestan kirjeid" -#: xgnokii/xgnokii_contacts.c:1594 +#: xgnokii/xgnokii_contacts.c:1497 #, c-format msgid "%s: line: %d:Can't write ME memory entry number %d! Error: %d\n" msgstr "%s: rida %d:Ei suuda kirjutada ME mälupessa %d! Viga: %d\n" -#: xgnokii/xgnokii_contacts.c:1636 +#: xgnokii/xgnokii_contacts.c:1539 #, c-format msgid "%s: line %d:Can't write SM memory entry number %d! Error: %d\n" msgstr "%s: rida %d:Ei suuda kirjutada SM mälupessa %d! Viga: %d\n" -#: xgnokii/xgnokii_contacts.c:1659 +#: xgnokii/xgnokii_contacts.c:1562 msgid "Save changes?" msgstr "Salvesta muudatused?" -#: xgnokii/xgnokii_contacts.c:1675 +#: xgnokii/xgnokii_contacts.c:1578 msgid "Don't save" msgstr "Ära salvesta" -#: xgnokii/xgnokii_contacts.c:1699 +#: xgnokii/xgnokii_contacts.c:1602 msgid "" "You have made changes in your\n" "contacts directory.\n" @@ -3255,33 +3001,13 @@ msgstr "" "\n" "Kas soovid muudatused telefoni salvestada?\n" -#: xgnokii/xgnokii_contacts.c:1760 -msgid "Which Extended Phonebook Entry?" -msgstr "Milline laienadatud telefoniraamatu kirje?" - -#: xgnokii/xgnokii_contacts.c:1766 -msgid "General" -msgstr "Üldine" - -#: xgnokii/xgnokii_contacts.c:1772 -msgid "Mobile" -msgstr "Mobiil" - -#: xgnokii/xgnokii_contacts.c:1778 -msgid "Work" -msgstr "Tööl" - -#: xgnokii/xgnokii_contacts.c:1790 -msgid "Home" -msgstr "Kodus" - -#: xgnokii/xgnokii_contacts.c:1883 xgnokii/xgnokii_contacts.c:1910 -#: xgnokii/xgnokii_contacts.c:2555 xgnokii/xgnokii_contacts.c:2579 +#: xgnokii/xgnokii_contacts.c:1668 xgnokii/xgnokii_contacts.c:1695 +#: xgnokii/xgnokii_contacts.c:2279 xgnokii/xgnokii_contacts.c:2302 #, c-format msgid "%s: line %d: Can't allocate memory!\n" msgstr "%s: rida %d: Ei suuda mälu eraldada!\n" -#: xgnokii/xgnokii_contacts.c:2005 +#: xgnokii/xgnokii_contacts.c:1790 msgid "" "Can't get SM memory status!\n" "\n" @@ -3291,23 +3017,23 @@ msgstr "" "\n" "oletan max SIM kirjete arvuks 100!\n" -#: xgnokii/xgnokii_contacts.c:2030 +#: xgnokii/xgnokii_contacts.c:1815 msgid "Getting entries" msgstr "Loen kirjeid ...." -#: xgnokii/xgnokii_contacts.c:2163 xgnokii/xgnokii_dtmf.c:128 -#: xgnokii/xgnokii_speed.c:426 +#: xgnokii/xgnokii_contacts.c:1948 xgnokii/xgnokii_dtmf.c:128 +#: xgnokii/xgnokii_speed.c:427 #, c-format msgid "Can't open file %s for writing!" msgstr "Ei suuda faili %s kirjutamiseks avada!" -#: xgnokii/xgnokii_contacts.c:2257 xgnokii/xgnokii_dtmf.c:161 -#: xgnokii/xgnokii_logos.c:1169 xgnokii/xgnokii_speed.c:468 +#: xgnokii/xgnokii_contacts.c:2020 xgnokii/xgnokii_dtmf.c:161 +#: xgnokii/xgnokii_speed.c:469 msgid "Overwrite file?" msgstr "Kas kirjutan faili üle?" -#: xgnokii/xgnokii_contacts.c:2258 xgnokii/xgnokii_dtmf.c:162 -#: xgnokii/xgnokii_logos.c:1170 xgnokii/xgnokii_speed.c:469 +#: xgnokii/xgnokii_contacts.c:2021 xgnokii/xgnokii_dtmf.c:162 +#: xgnokii/xgnokii_speed.c:470 #, c-format msgid "" "File %s already exist.\n" @@ -3316,17 +3042,17 @@ msgstr "" "Fail %s on olemas.\n" "Kas kirjutan üle?" -#: xgnokii/xgnokii_contacts.c:2276 xgnokii/xgnokii_speed.c:487 +#: xgnokii/xgnokii_contacts.c:2039 xgnokii/xgnokii_speed.c:488 msgid "Export" msgstr "Ekspordi" -#: xgnokii/xgnokii_contacts.c:2476 xgnokii/xgnokii_dtmf.c:90 -#: xgnokii/xgnokii_speed.c:326 +#: xgnokii/xgnokii_contacts.c:2200 xgnokii/xgnokii_dtmf.c:90 +#: xgnokii/xgnokii_speed.c:327 #, c-format msgid "Can't open file %s for reading!" msgstr "Ei suuda faili %s lugemiseks avada!" -#: xgnokii/xgnokii_contacts.c:2530 +#: xgnokii/xgnokii_contacts.c:2254 msgid "" "Can't get SM memory status!\n" "\n" @@ -3336,104 +3062,177 @@ msgstr "" "\n" "max SIM kirjete arv on 100!\n" -#: xgnokii/xgnokii_contacts.c:2645 xgnokii/xgnokii_speed.c:404 +#: xgnokii/xgnokii_contacts.c:2367 xgnokii/xgnokii_speed.c:405 msgid "Import" msgstr "Impordi" -#: xgnokii/xgnokii_contacts.c:2843 xgnokii/xgnokii_sms.c:1233 +#: xgnokii/xgnokii_contacts.c:2564 xgnokii/xgnokii_sms.c:1126 msgid "Select contacts" msgstr "Vali kontaktid" -#: xgnokii/xgnokii_contacts.c:2989 +#: xgnokii/xgnokii_contacts.c:2597 xgnokii/xgnokii_contacts.c:2841 +#: xgnokii/xgnokii_sms.c:1575 xgnokii/xgnokii_speed.c:638 +#, c-format +msgid "Error: %s: line %d: Can't allocate memory!\n" +msgstr "VIGA: %s: rida %d: Ei suuda eraldada mälu!\n" + +#: xgnokii/xgnokii_contacts.c:2695 xgnokii/xgnokii_dtmf.c:217 +#: xgnokii/xgnokii_logos.c:1143 xgnokii/xgnokii_netmon.c:260 +#: xgnokii/xgnokii_sms.c:1014 xgnokii/xgnokii_sms.c:1397 +#: xgnokii/xgnokii_speed.c:528 xgnokii/xgnokii_xkeyb.c:242 +msgid "/_File" +msgstr "/_Fail" + +#: xgnokii/xgnokii_contacts.c:2696 xgnokii/xgnokii_speed.c:529 +msgid "/File/_Read from phone" +msgstr "/Fail/Loe telefonist" + +#: xgnokii/xgnokii_contacts.c:2697 xgnokii/xgnokii_speed.c:530 +msgid "/File/_Save to phone" +msgstr "/Fail/_Salvesta telefoni" + +#: xgnokii/xgnokii_contacts.c:2698 xgnokii/xgnokii_dtmf.c:220 +#: xgnokii/xgnokii_logos.c:1147 xgnokii/xgnokii_sms.c:1017 +#: xgnokii/xgnokii_sms.c:1399 xgnokii/xgnokii_speed.c:531 +msgid "/File/Sep1" +msgstr "/Fail/Sep1" + +#: xgnokii/xgnokii_contacts.c:2699 xgnokii/xgnokii_speed.c:532 +msgid "/File/_Import from file" +msgstr "/Fail/Ava fail" + +#: xgnokii/xgnokii_contacts.c:2700 xgnokii/xgnokii_speed.c:533 +msgid "/File/_Export to file" +msgstr "/Fail/Salvesta faili" + +#: xgnokii/xgnokii_contacts.c:2701 xgnokii/xgnokii_logos.c:1151 +#: xgnokii/xgnokii_sms.c:1020 xgnokii/xgnokii_speed.c:534 +msgid "/File/Sep2" +msgstr "/Fail/Sep2" + +#: xgnokii/xgnokii_contacts.c:2702 xgnokii/xgnokii_dtmf.c:221 +#: xgnokii/xgnokii_logos.c:1152 xgnokii/xgnokii_netmon.c:261 +#: xgnokii/xgnokii_sms.c:1021 xgnokii/xgnokii_sms.c:1400 +#: xgnokii/xgnokii_speed.c:535 xgnokii/xgnokii_xkeyb.c:243 +msgid "/File/_Close" +msgstr "/Fail/Sulge" + +#: xgnokii/xgnokii_contacts.c:2703 xgnokii/xgnokii_logos.c:1153 +#: xgnokii/xgnokii_speed.c:536 +msgid "/_Edit" +msgstr "/R_edigeeri" + +#: xgnokii/xgnokii_contacts.c:2704 msgid "/Edit/_New" msgstr "/Redigeeri/Uus" -#: xgnokii/xgnokii_contacts.c:2990 +#: xgnokii/xgnokii_contacts.c:2705 msgid "/Edit/D_uplicate" msgstr "/Redigeeri/Palj_unda" -#: xgnokii/xgnokii_contacts.c:2993 xgnokii/xgnokii_logos.c:1305 +#: xgnokii/xgnokii_contacts.c:2706 xgnokii/xgnokii_speed.c:537 +msgid "/Edit/_Edit" +msgstr "/Redigeeri/Paranda" + +#: xgnokii/xgnokii_contacts.c:2707 +msgid "/Edit/_Delete" +msgstr "/Redigeeri/Kustuta" + +#: xgnokii/xgnokii_contacts.c:2708 xgnokii/xgnokii_logos.c:1156 msgid "/Edit/Sep3" msgstr "/Redigeeri/Sep3" -#: xgnokii/xgnokii_contacts.c:2994 +#: xgnokii/xgnokii_contacts.c:2709 msgid "/Edit/_Change memory type" msgstr "/Redigeeri/Muuda mälu tüüp" -#: xgnokii/xgnokii_contacts.c:2996 +#: xgnokii/xgnokii_contacts.c:2710 xgnokii/xgnokii_logos.c:1161 +msgid "/Edit/Sep4" +msgstr "/Redigeeri/Sep4" + +#: xgnokii/xgnokii_contacts.c:2711 msgid "/Edit/_Find" msgstr "/Redigeeri/Leia" -#: xgnokii/xgnokii_contacts.c:2997 +#: xgnokii/xgnokii_contacts.c:2712 msgid "/Edit/Find ne_xt" msgstr "/Redigeeri/Leia järgmine" -#: xgnokii/xgnokii_contacts.c:2998 +#: xgnokii/xgnokii_contacts.c:2713 msgid "/Edit/Sep5" msgstr "/Redigeeri/Sep5" -#: xgnokii/xgnokii_contacts.c:3000 +#: xgnokii/xgnokii_contacts.c:2714 +msgid "/Edit/Select _all" +msgstr "/Redigeeri/V_ali kõik" + +#: xgnokii/xgnokii_contacts.c:2715 msgid "/_Dial" msgstr "/Vali numbri_d" -#: xgnokii/xgnokii_contacts.c:3001 +#: xgnokii/xgnokii_contacts.c:2716 msgid "/Dial/Dial _voice" msgstr "/Vali numbrid/_Vali kõne" -#: xgnokii/xgnokii_contacts.c:3020 +#: xgnokii/xgnokii_contacts.c:2717 xgnokii/xgnokii_dtmf.c:222 +#: xgnokii/xgnokii_netmon.c:265 xgnokii/xgnokii_sms.c:1022 +#: xgnokii/xgnokii_sms.c:1408 xgnokii/xgnokii_speed.c:538 +#: xgnokii/xgnokii_xkeyb.c:244 +msgid "/_Help" +msgstr "/Abi" + +#: xgnokii/xgnokii_contacts.c:2718 xgnokii/xgnokii_dtmf.c:223 +#: xgnokii/xgnokii_netmon.c:266 xgnokii/xgnokii_sms.c:1023 +#: xgnokii/xgnokii_sms.c:1409 xgnokii/xgnokii_speed.c:539 +#: xgnokii/xgnokii_xkeyb.c:245 +msgid "/Help/_Help" +msgstr "/Abi/Abi" + +#: xgnokii/xgnokii_contacts.c:2719 xgnokii/xgnokii_dtmf.c:224 +#: xgnokii/xgnokii_netmon.c:267 xgnokii/xgnokii_sms.c:1024 +#: xgnokii/xgnokii_sms.c:1410 xgnokii/xgnokii_speed.c:540 +#: xgnokii/xgnokii_xkeyb.c:246 +msgid "/Help/_About" +msgstr "/Abi/Üldine" + +#: xgnokii/xgnokii_contacts.c:2735 msgid "Memory" msgstr "Mälu" -#: xgnokii/xgnokii_contacts.c:3020 +#: xgnokii/xgnokii_contacts.c:2735 msgid "Group" msgstr "Grupp" -#: xgnokii/xgnokii_contacts.c:3090 -msgid "Delete entry" -msgstr "Kustuta kirje" - -#: xgnokii/xgnokii_data.c:42 -msgid "" -"Data calls are currently\n" -"Disabled\n" -" " -msgstr "" -"Andmekõned on hetkel\n" -"Keelatud\n" -" " +#: xgnokii/xgnokii_contacts.c:2771 xgnokii/xgnokii_speed.c:591 +msgid "Read from phone" +msgstr "Loe telefonist" -#: xgnokii/xgnokii_data.c:44 -msgid "" -"Data calls are currently\n" -"Enabled\n" -" " -msgstr "" -"Andmekõned on hetkel\n" -"Lubatud\n" -" " +#: xgnokii/xgnokii_contacts.c:2775 xgnokii/xgnokii_speed.c:595 +msgid "Save to phone" +msgstr "Salvesta telefoni" -#: xgnokii/xgnokii_data.c:101 -msgid "Virtual Modem" -msgstr "" +#: xgnokii/xgnokii_contacts.c:2782 xgnokii/xgnokii_speed.c:602 +msgid "Import from file" +msgstr "Ava fail" -#: xgnokii/xgnokii_data.c:119 -msgid "Enable" -msgstr "Luba" +#: xgnokii/xgnokii_contacts.c:2786 xgnokii/xgnokii_speed.c:606 +msgid "Export to file" +msgstr "Salvesta fail" -#: xgnokii/xgnokii_data.c:125 -msgid "Disable" -msgstr "Keela" +#: xgnokii/xgnokii_contacts.c:2805 +msgid "Delete entry" +msgstr "Kustuta kirje" #: xgnokii/xgnokii_dtmf.c:108 msgid "Load" msgstr "Laadi" -#: xgnokii/xgnokii_dtmf.c:218 xgnokii/xgnokii_logos.c:1293 +#: xgnokii/xgnokii_dtmf.c:218 xgnokii/xgnokii_logos.c:1144 msgid "/File/_Open" msgstr "/Fail/Ava" -#: xgnokii/xgnokii_dtmf.c:219 xgnokii/xgnokii_logos.c:1294 -#: xgnokii/xgnokii_sms.c:1123 xgnokii/xgnokii_sms.c:1508 +#: xgnokii/xgnokii_dtmf.c:219 xgnokii/xgnokii_logos.c:1145 +#: xgnokii/xgnokii_sms.c:1016 xgnokii/xgnokii_sms.c:1398 msgid "/File/_Save" msgstr "/Fail/_Salvesta" @@ -3441,403 +3240,259 @@ msgstr "/Fail/_Salvesta" msgid "Dial Tone" msgstr "Vali toon" -#: xgnokii/xgnokii_logos.c:823 -#, c-format -msgid "" -"Error getting network info\n" -"(error=%d)" -msgstr "" -"Võrguinfo saamise viga\n" -"(viga=%d)" - -#: xgnokii/xgnokii_logos.c:862 -#, c-format -msgid "" -"Error getting bitmap\n" -"(error=%d)" -msgstr "" -"Pildi saamise viga\n" -"(viga=%d)" - -#: xgnokii/xgnokii_logos.c:907 -#, c-format -msgid "" -"Error setting bitmap\n" -"(error=%d)" -msgstr "" -"Pildi seadmise viga\n" -"(viga=%d)" - -#: xgnokii/xgnokii_logos.c:1141 -#, c-format -msgid "" -"Error saving file\n" -"(error=%d)" -msgstr "" -"Faili salvestamise viga\n" -"(viga=%d)" - -#: xgnokii/xgnokii_logos.c:1191 -#, c-format -msgid "Can't open file %s for reading !" -msgstr "Ei suuda faili %s lugemiseks avada!" - -#: xgnokii/xgnokii_logos.c:1200 -#, c-format -msgid "" -"Error reading file\n" -"(error=%d)" -msgstr "" -"Faili lugemise viga\n" -"(viga=%d)" - -#: xgnokii/xgnokii_logos.c:1295 -msgid "/File/Save _as ..." -msgstr "/Fail/Salvest_a nagu ..." - -#: xgnokii/xgnokii_logos.c:1297 -msgid "/File/_Get operator" -msgstr "/Fail/Tuvasta operaator" - -#: xgnokii/xgnokii_logos.c:1298 -msgid "/File/Get _logo" -msgstr "/Fail/Võta _logo" - -#: xgnokii/xgnokii_logos.c:1299 -msgid "/File/Se_t logo" -msgstr "/Fail/Sea logo" - -#: xgnokii/xgnokii_logos.c:1303 -msgid "/Edit/_Clear" -msgstr "/Redigeeri/Tühjenda" - -#: xgnokii/xgnokii_logos.c:1304 -msgid "/Edit/_Invert" -msgstr "/Redigeeri/Peegelpilt" - -#: xgnokii/xgnokii_logos.c:1306 -msgid "/Edit/_Up logo" -msgstr "/Redigeeri/Pilt samm üles" - -#: xgnokii/xgnokii_logos.c:1307 -msgid "/Edit/_Down logo" -msgstr "/Redigeeri/Pilt samm alla" - -#: xgnokii/xgnokii_logos.c:1308 -msgid "/Edit/_Left logo" -msgstr "/Redigeeri/Pi_lt samm vasakule" - -#: xgnokii/xgnokii_logos.c:1309 -msgid "/Edit/_Right logo" -msgstr "/Redigeeri/Pilt samm pa_remale" - -#: xgnokii/xgnokii_logos.c:1311 -msgid "/Edit/Flip _horizontal" -msgstr "/Redigeeri/Pööra _horisontaalis" - -#: xgnokii/xgnokii_logos.c:1312 -msgid "/Edit/Flip _vertical" -msgstr "/Redigeeri/Pööra _vertikaalis" - -#: xgnokii/xgnokii_logos.c:1604 -msgid "Load preview pixmap error, feature disabled." -msgstr "Eelvaate pildi laadimise viga, omadust ei kasutata." - -#: xgnokii/xgnokii_lowlevel.c:353 -#, c-format -msgid "%s: line %d: Can't get memory entry number %d from memory %d! %d\n" -msgstr "" - -#: xgnokii/xgnokii_lowlevel.c:874 -msgid "Connecting..." -msgstr "Kontakteerun...." - -#: xgnokii/xgnokii_lowlevel.c:907 -msgid "Refreshing SMSes..." -msgstr "Uuendan SMS'e ..." - -#: xgnokii/xgnokii_lowlevel.c:965 -msgid "Working..." -msgstr "Toimetan..." - -#: xgnokii/xgnokii_lowlevel.c:968 -#, c-format -msgid "Event %d failed with return code %d!\n" -msgstr "" - -#: xgnokii/xgnokii_netmon.c:261 +#: xgnokii/xgnokii_netmon.c:262 msgid "/_Tools" msgstr "/_Tööriistad" -#: xgnokii/xgnokii_netmon.c:262 +#: xgnokii/xgnokii_netmon.c:263 msgid "/Tools/Net monitor o_n" msgstr "/Tööriistad/Võrgu mo_nitor peale" -#: xgnokii/xgnokii_netmon.c:263 +#: xgnokii/xgnokii_netmon.c:264 msgid "/Tools/Net monitor o_ff" msgstr "/Tööriistad/Võrgu monitor maha" -#: xgnokii/xgnokii_netmon.c:380 xgnokii/xgnokii_netmon.c:383 +#: xgnokii/xgnokii_netmon.c:381 xgnokii/xgnokii_netmon.c:384 msgid "Active cell" msgstr "Aktiivne kärg" -#: xgnokii/xgnokii_netmon.c:386 +#: xgnokii/xgnokii_netmon.c:387 msgid "NCELL list I" msgstr "" -#: xgnokii/xgnokii_netmon.c:389 +#: xgnokii/xgnokii_netmon.c:390 msgid "NCELL list II" msgstr "" -#: xgnokii/xgnokii_netmon.c:392 +#: xgnokii/xgnokii_netmon.c:393 msgid "NCELL list III" msgstr "" -#: xgnokii/xgnokii_netmon.c:395 +#: xgnokii/xgnokii_netmon.c:396 msgid "Prefered/Denied networks" -msgstr "Eelistatud/keelatud võrgud" +msgstr "Eelistatud/keelatud v6rgud" -#: xgnokii/xgnokii_netmon.c:398 +#: xgnokii/xgnokii_netmon.c:399 msgid "System information bits" msgstr "Süsteemi informatsiooni bitid" -#: xgnokii/xgnokii_netmon.c:401 +#: xgnokii/xgnokii_netmon.c:402 msgid "TMSI, Paging, PLU" msgstr "" -#: xgnokii/xgnokii_netmon.c:404 +#: xgnokii/xgnokii_netmon.c:405 msgid "Cells info" msgstr "Kärje info" -#: xgnokii/xgnokii_netmon.c:407 +#: xgnokii/xgnokii_netmon.c:408 msgid "DTX, Cipher, Hopping" msgstr "" -#: xgnokii/xgnokii_netmon.c:417 +#: xgnokii/xgnokii_netmon.c:418 msgid "Uplink DTX" msgstr "" -#: xgnokii/xgnokii_netmon.c:420 +#: xgnokii/xgnokii_netmon.c:421 msgid "BTS TEST" msgstr "" -#: xgnokii/xgnokii_netmon.c:423 +#: xgnokii/xgnokii_netmon.c:424 msgid "CELL BARR-Flag" msgstr "" -#: xgnokii/xgnokii_netmon.c:426 +#: xgnokii/xgnokii_netmon.c:427 msgid "Accumulator, Charge status" msgstr "Aku, laadimise staatus" -#: xgnokii/xgnokii_netmon.c:429 +#: xgnokii/xgnokii_netmon.c:430 msgid "?Constant voltage charging display" msgstr "" -#: xgnokii/xgnokii_netmon.c:432 +#: xgnokii/xgnokii_netmon.c:433 msgid "?Battery full detection" msgstr "?Aku laadumuse proov" -#: xgnokii/xgnokii_netmon.c:435 +#: xgnokii/xgnokii_netmon.c:436 msgid "Accumulator" msgstr "Aku" -#: xgnokii/xgnokii_netmon.c:438 +#: xgnokii/xgnokii_netmon.c:439 msgid "SW-Resets" msgstr "" -#: xgnokii/xgnokii_netmon.c:441 +#: xgnokii/xgnokii_netmon.c:442 msgid "Reset-Counter" msgstr "" -#: xgnokii/xgnokii_netmon.c:444 +#: xgnokii/xgnokii_netmon.c:445 msgid "Cause codes for last connection abortion" msgstr "Viimase ühenduse katkestamise põhjuskoodid" -#: xgnokii/xgnokii_netmon.c:454 +#: xgnokii/xgnokii_netmon.c:455 msgid "Reset handover counters" msgstr "" -#: xgnokii/xgnokii_netmon.c:457 +#: xgnokii/xgnokii_netmon.c:458 msgid "Handover Counter" msgstr "" -#: xgnokii/xgnokii_netmon.c:460 +#: xgnokii/xgnokii_netmon.c:461 msgid "Handover Counter (Dual)" msgstr "" -#: xgnokii/xgnokii_netmon.c:463 +#: xgnokii/xgnokii_netmon.c:464 msgid "L2-Timeouts" msgstr "" -#: xgnokii/xgnokii_netmon.c:466 +#: xgnokii/xgnokii_netmon.c:467 msgid "SIM" msgstr "" -#: xgnokii/xgnokii_netmon.c:469 +#: xgnokii/xgnokii_netmon.c:470 msgid "?Block display 1" msgstr "" -#: xgnokii/xgnokii_netmon.c:475 +#: xgnokii/xgnokii_netmon.c:476 msgid "Memory status before reset" msgstr "Mälu olek enne resetti" -#: xgnokii/xgnokii_netmon.c:478 +#: xgnokii/xgnokii_netmon.c:479 msgid "Reset Counters" msgstr "" -#: xgnokii/xgnokii_netmon.c:481 +#: xgnokii/xgnokii_netmon.c:482 msgid "Counter for PLMN Search and Cell reselection (Singleband)" msgstr "" -#: xgnokii/xgnokii_netmon.c:491 +#: xgnokii/xgnokii_netmon.c:492 msgid "Neighbourhood measurement" msgstr "Keskkonnaparameetrite mõõtmine" -#: xgnokii/xgnokii_netmon.c:494 +#: xgnokii/xgnokii_netmon.c:495 msgid "Calls" msgstr "Kõnesid" -#: xgnokii/xgnokii_netmon.c:497 +#: xgnokii/xgnokii_netmon.c:498 msgid "Temporary counters of DSP" msgstr "DSP ajutised loendurid" -#: xgnokii/xgnokii_netmon.c:500 +#: xgnokii/xgnokii_netmon.c:501 msgid "Control of task information displays" msgstr "" -#: xgnokii/xgnokii_netmon.c:503 +#: xgnokii/xgnokii_netmon.c:504 msgid "Information about task numbers 0-7" msgstr "" -#: xgnokii/xgnokii_netmon.c:506 +#: xgnokii/xgnokii_netmon.c:507 msgid "Information about task numbers 8-15" msgstr "" -#: xgnokii/xgnokii_netmon.c:509 +#: xgnokii/xgnokii_netmon.c:510 msgid "Information about task numbers 16-23" msgstr "" -#: xgnokii/xgnokii_netmon.c:512 +#: xgnokii/xgnokii_netmon.c:513 msgid "Information about OS_SYSTEM_STACK" -msgstr "" +msgstr "OS_SYSTEM_STACK informatsioon" -#: xgnokii/xgnokii_netmon.c:515 +#: xgnokii/xgnokii_netmon.c:516 msgid "Information about current MCU and DSP software versions" msgstr "" -#: xgnokii/xgnokii_netmon.c:518 +#: xgnokii/xgnokii_netmon.c:519 msgid "Hardware version" msgstr "Riistvara versioon" -#: xgnokii/xgnokii_netmon.c:537 +#: xgnokii/xgnokii_netmon.c:538 msgid "Chan" msgstr "" -#: xgnokii/xgnokii_netmon.c:538 +#: xgnokii/xgnokii_netmon.c:539 msgid "RxLv" msgstr "" -#: xgnokii/xgnokii_netmon.c:539 +#: xgnokii/xgnokii_netmon.c:540 msgid "C1" msgstr "" -#: xgnokii/xgnokii_netmon.c:540 +#: xgnokii/xgnokii_netmon.c:541 msgid "C2" msgstr "" -#: xgnokii/xgnokii_netmon.c:541 +#: xgnokii/xgnokii_netmon.c:542 msgid "ACT" msgstr "" -#: xgnokii/xgnokii_netmon.c:542 +#: xgnokii/xgnokii_netmon.c:543 msgid "NC2" msgstr "" -#: xgnokii/xgnokii_netmon.c:543 +#: xgnokii/xgnokii_netmon.c:544 msgid "NC3" msgstr "" -#: xgnokii/xgnokii_netmon.c:544 +#: xgnokii/xgnokii_netmon.c:545 msgid "NC4" msgstr "" -#: xgnokii/xgnokii_netmon.c:545 +#: xgnokii/xgnokii_netmon.c:546 msgid "NC5" msgstr "" -#: xgnokii/xgnokii_netmon.c:546 +#: xgnokii/xgnokii_netmon.c:547 msgid "NC6" msgstr "" -#: xgnokii/xgnokii_netmon.c:547 +#: xgnokii/xgnokii_netmon.c:548 msgid "NC7" msgstr "" -#: xgnokii/xgnokii_netmon.c:578 +#: xgnokii/xgnokii_netmon.c:579 msgid "Page:" msgstr "Leht:" -#: xgnokii/xgnokii_sms.c:236 +#: xgnokii/xgnokii_sms.c:233 msgid "report" msgstr "raport" -#: xgnokii/xgnokii_sms.c:241 +#: xgnokii/xgnokii_sms.c:238 msgid "read" -msgstr "loetud" +msgstr "loe" -#: xgnokii/xgnokii_sms.c:246 +#: xgnokii/xgnokii_sms.c:243 msgid "unread" msgstr "lugemata" -#: xgnokii/xgnokii_sms.c:306 +#: xgnokii/xgnokii_sms.c:303 msgid "sent" msgstr "saadetud" -#: xgnokii/xgnokii_sms.c:308 +#: xgnokii/xgnokii_sms.c:305 msgid "unsent" msgstr "saatmata" -#: xgnokii/xgnokii_sms.c:376 +#: xgnokii/xgnokii_sms.c:373 msgid "From: " msgstr "Saatja: " -#: xgnokii/xgnokii_sms.c:473 +#: xgnokii/xgnokii_sms.c:381 +msgid "Date: " +msgstr "Kuupäev: " + +#: xgnokii/xgnokii_sms.c:470 msgid "Delete SMS" msgstr "Kustuta SMS" -#: xgnokii/xgnokii_sms.c:505 +#: xgnokii/xgnokii_sms.c:502 msgid "Do you want to delete selected SMS?" msgstr "Kas soovid valitud SMS kustutada?" -#: xgnokii/xgnokii_sms.c:529 -#, c-format -msgid "Cannot open mailbox %s for appending!" -msgstr "Ei suuda faili %s lisamiseks avada!" - -#: xgnokii/xgnokii_sms.c:543 -#, c-format -msgid "" -"Cannot save to mailbox %s.\n" -"%s is locked for process %d!" -msgstr "" -"Ei suuda salvestada %s mailbox'i.\n" -"%s on protsessi %d jaoks lukus!" - -#: xgnokii/xgnokii_sms.c:558 -#, c-format -msgid "Cannot lock mailbox %s!" -msgstr "Ei suuda %s mailbox'i lukustada!" - -#: xgnokii/xgnokii_sms.c:609 -#, c-format -msgid "Cannot unlock mailbox %s!" -msgstr "Ei suuda %s mailbox'i lukku vabastada!" - -#: xgnokii/xgnokii_sms.c:827 xgnokii/xgnokii_sms.c:958 +#: xgnokii/xgnokii_sms.c:720 xgnokii/xgnokii_sms.c:851 msgid "Address line contains illegal address!" msgstr "Aadressi real on sobimatu aadress!" -#: xgnokii/xgnokii_sms.c:930 +#: xgnokii/xgnokii_sms.c:823 #, c-format msgid "" "SMS send to %s failed\n" @@ -3846,166 +3501,166 @@ msgstr "" "SMS saatmine %s ebõnnestus!\n" "(viga=%d)" -#: xgnokii/xgnokii_sms.c:1020 xgnokii/xgnokii_sms.c:1057 +#: xgnokii/xgnokii_sms.c:913 xgnokii/xgnokii_sms.c:950 #, c-format msgid "Sending SMS to %s (%d/%d) ...\n" msgstr "Saadan SMS'i %s (%d/%d) ...\n" -#: xgnokii/xgnokii_sms.c:1084 +#: xgnokii/xgnokii_sms.c:977 #, c-format msgid "Sending SMS to %s ...\n" msgstr "Saadan SMS'i %s ...\n" -#: xgnokii/xgnokii_sms.c:1122 +#: xgnokii/xgnokii_sms.c:1015 msgid "/File/Sen_d" msgstr "/Fail/Saa_da" -#: xgnokii/xgnokii_sms.c:1125 +#: xgnokii/xgnokii_sms.c:1018 msgid "/File/Check _Names" msgstr "/Fail/_Nime kontroll" -#: xgnokii/xgnokii_sms.c:1126 +#: xgnokii/xgnokii_sms.c:1019 msgid "/File/C_ontacts" msgstr "/Fail/K_ontaktid" -#: xgnokii/xgnokii_sms.c:1185 +#: xgnokii/xgnokii_sms.c:1078 msgid "Send message" msgstr "Saada sõnum" -#: xgnokii/xgnokii_sms.c:1189 +#: xgnokii/xgnokii_sms.c:1082 msgid "Save message to outbox" msgstr "Salvesta sõnum outbox'i" -#: xgnokii/xgnokii_sms.c:1196 +#: xgnokii/xgnokii_sms.c:1089 msgid "Check names" msgstr "Kontrolli nimesid" -#: xgnokii/xgnokii_sms.c:1209 +#: xgnokii/xgnokii_sms.c:1102 msgid "To:" msgstr "Saaja:" -#: xgnokii/xgnokii_sms.c:1281 +#: xgnokii/xgnokii_sms.c:1174 msgid "Delivery report" msgstr "Saateraport" -#: xgnokii/xgnokii_sms.c:1285 +#: xgnokii/xgnokii_sms.c:1178 msgid "Send as Long SMS" msgstr "Saada pika SMS'na" -#: xgnokii/xgnokii_sms.c:1289 +#: xgnokii/xgnokii_sms.c:1182 msgid "SMS Center:" msgstr "SMS Keskus:" -#: xgnokii/xgnokii_sms.c:1308 +#: xgnokii/xgnokii_sms.c:1201 msgid "New Message" msgstr "Uus sõnum" -#: xgnokii/xgnokii_sms.c:1335 +#: xgnokii/xgnokii_sms.c:1228 msgid "Forward Message" msgstr "Edasta sõnum" -#: xgnokii/xgnokii_sms.c:1379 +#: xgnokii/xgnokii_sms.c:1272 msgid "Reply Message" msgstr "Vasta sõnumile" -#: xgnokii/xgnokii_sms.c:1415 xgnokii/xgnokii_sms.c:1586 +#: xgnokii/xgnokii_sms.c:1308 xgnokii/xgnokii_sms.c:1475 msgid "Bussiness Card" msgstr "Visiitkaart" -#: xgnokii/xgnokii_sms.c:1509 -msgid "/File/Save to mailbo_x" -msgstr "/Fail/Salvesta mailbo_xi" - -#: xgnokii/xgnokii_sms.c:1512 +#: xgnokii/xgnokii_sms.c:1401 msgid "/_Messages" msgstr "/Sõnu_mid" -#: xgnokii/xgnokii_sms.c:1513 +#: xgnokii/xgnokii_sms.c:1402 msgid "/_Messages/_New" -msgstr "/Sõnu_mid/Uus sõnum" +msgstr "/Sõnu_mid/Uued" -#: xgnokii/xgnokii_sms.c:1514 +#: xgnokii/xgnokii_sms.c:1403 msgid "/_Messages/_Forward" -msgstr "/Sõnu_mid/Saada sõnum edasi" +msgstr "/Sõnu_mid/Edasta _F" -#: xgnokii/xgnokii_sms.c:1515 +#: xgnokii/xgnokii_sms.c:1404 msgid "/_Messages/_Reply" -msgstr "/Sõnu_mid/Vasta sõnumile" +msgstr "/Sõnu_mid/Vasta _R" -#: xgnokii/xgnokii_sms.c:1516 +#: xgnokii/xgnokii_sms.c:1405 msgid "/_Messages/_Delete" -msgstr "/Sõnu_mid/Kustuta sõnum" +msgstr "/Sõnu_mid/Kustuta" -#: xgnokii/xgnokii_sms.c:1517 +#: xgnokii/xgnokii_sms.c:1406 msgid "/Messages/Sep3" msgstr "/Sõnu_mid/Sep3" -#: xgnokii/xgnokii_sms.c:1518 +#: xgnokii/xgnokii_sms.c:1407 msgid "/_Messages/_Bussiness card" msgstr "/Sõnu_mid/Visiitkaart" -#: xgnokii/xgnokii_sms.c:1539 +#: xgnokii/xgnokii_sms.c:1428 msgid "Status" msgstr "Olek" -#: xgnokii/xgnokii_sms.c:1539 +#: xgnokii/xgnokii_sms.c:1428 msgid "Date / Time" msgstr "Kuupäev/Kellaaeg" -#: xgnokii/xgnokii_sms.c:1539 +#: xgnokii/xgnokii_sms.c:1428 msgid "Sender" msgstr "Saatja" -#: xgnokii/xgnokii_sms.c:1539 +#: xgnokii/xgnokii_sms.c:1428 msgid "Message" msgstr "Sõnum" -#: xgnokii/xgnokii_sms.c:1573 +#: xgnokii/xgnokii_sms.c:1462 msgid "New message" msgstr "Uus sõnum" -#: xgnokii/xgnokii_sms.c:1577 +#: xgnokii/xgnokii_sms.c:1466 msgid "Forward message" msgstr "Saada sõnum edasi" -#: xgnokii/xgnokii_sms.c:1581 +#: xgnokii/xgnokii_sms.c:1470 msgid "Reply message" msgstr "Vasta sõnumile" -#: xgnokii/xgnokii_sms.c:1593 +#: xgnokii/xgnokii_sms.c:1482 msgid "Delete message" msgstr "Kustuta sõnum" -#: xgnokii/xgnokii_sms.c:1618 +#: xgnokii/xgnokii_sms.c:1507 msgid "SMS's" -msgstr "Lühisõnumid" +msgstr "" -#: xgnokii/xgnokii_sms.c:1627 +#: xgnokii/xgnokii_sms.c:1516 msgid "Inbox" -msgstr "Saadud lühisõnumid" +msgstr "" -#: xgnokii/xgnokii_sms.c:1633 +#: xgnokii/xgnokii_sms.c:1522 msgid "Outbox" -msgstr "Saadetud lühisõnumid" +msgstr "" -#: xgnokii/xgnokii_speed.c:180 +#: xgnokii/xgnokii_sms.c:1608 +msgid "couldn't allocate colour" +msgstr "ei suuda värvi määratleda" + +#: xgnokii/xgnokii_speed.c:181 msgid "Reading data ..." msgstr "Loen andmeid ..." -#: xgnokii/xgnokii_speed.c:191 xgnokii/xgnokii_speed.c:197 -#: xgnokii/xgnokii_speed.c:256 +#: xgnokii/xgnokii_speed.c:192 xgnokii/xgnokii_speed.c:198 +#: xgnokii/xgnokii_speed.c:257 msgid "Cannot allocate memory!" msgstr "Ei suuda mälu eraldada!" -#: xgnokii/xgnokii_speed.c:344 +#: xgnokii/xgnokii_speed.c:345 msgid "Cannot allocate memory!\n" msgstr "Ei suuda mälu eraldada!\n" -#: xgnokii/xgnokii_speed.c:356 xgnokii/xgnokii_speed.c:384 +#: xgnokii/xgnokii_speed.c:357 xgnokii/xgnokii_speed.c:385 msgid "Error reading file!" msgstr "Viga faili lugemisel!" -#: xgnokii/xgnokii_speed.c:554 +#: xgnokii/xgnokii_speed.c:555 msgid "Key" msgstr "Klahv" @@ -4017,66 +3672,84 @@ msgstr "Ei suuda laadida taustapilti!" msgid "XGnokii Keyboard" msgstr "XGnokii Klaviatuur" -#~ msgid "Alarm date:" -#~ msgstr "Meenutuse kuupäev:" - -#~ msgid "Message: Result of key " -#~ msgstr " " - -#~ msgid "press\n" -#~ msgstr "vajuta\n" - -#~ msgid "release\n" -#~ msgstr "vabasta\n" +#: xgnokii/xgnokii_logos.c:834 +#, c-format +msgid "" +"Error getting network info\n" +"(error=%d)" +msgstr "" +"Viga võrguinfo saamisel\n" +"(viga=%d)" -#~ msgid "press or release - error\n" -#~ msgstr "vajuta või vabasta - viga\n" +#: xgnokii/xgnokii_logos.c:867 +#, c-format +msgid "" +"Error getting bitmap\n" +"(error=%d)" +msgstr "" +"Viga bitmap saamisel\n" +"(viga=%d)" -#~ msgid "Message: Unknown message of type 0x0c\n" -#~ msgstr "Teade: Tundmatu 0x0c tüüpi sõnum\n" +#: xgnokii/xgnokii_logos.c:912 +#, c-format +msgid "" +"Error setting bitmap\n" +"(error=%d)" +msgstr "" +"Viga bitmap seadmisel\n" +"(viga=%d)" -#~ msgid "Message: Security code received: " -#~ msgstr "Teade: Turvakood saabus: " +#: xgnokii/xgnokii_logos.c:1146 +msgid "/File/Save _as ..." +msgstr "/Fail/Salvest_a nagu ..." -#~ msgid "Security code" -#~ msgstr "Turvakood" +#: xgnokii/xgnokii_logos.c:1148 +msgid "/File/_Get operator" +msgstr "/Fail/Tuvasta operaator" -#~ msgid "unknown !" -#~ msgstr "tundmatu !" +#: xgnokii/xgnokii_logos.c:1149 +msgid "/File/Get _logo" +msgstr "/Fail/Võta _logo" -#~ msgid "Unknown key: %c !\n" -#~ msgstr "Tundmatu võti: %c !\n" +#: xgnokii/xgnokii_logos.c:1150 +msgid "/File/Se_t logo" +msgstr "/Fail/Sea logo" -#~ msgid "Can't press key !\n" -#~ msgstr "Nuppu ei saa vajutada?! \n" +#: xgnokii/xgnokii_logos.c:1154 +msgid "/Edit/_Clear" +msgstr "/Redigeeri/Tühjenda" -#~ msgid "Can't release key !\n" -#~ msgstr "Nuppu ei saa vabastada?! \n" +#: xgnokii/xgnokii_logos.c:1155 +msgid "/Edit/_Invert" +msgstr "/Redigeeri/_Invert" -#~ msgid "security code" -#~ msgstr "Turvakood" +#: xgnokii/xgnokii_logos.c:1157 +msgid "/Edit/_Up logo" +msgstr "/Redigeeri/Logo üles" -#~ msgid " not allowed\n" -#~ msgstr " pole lubatud\n" +#: xgnokii/xgnokii_logos.c:1158 +msgid "/Edit/_Down logo" +msgstr "/Redigeeri/Logo alla" -#~ msgid " is %s\n" -#~ msgstr " on %s\n" +#: xgnokii/xgnokii_logos.c:1159 +msgid "/Edit/_Left logo" +msgstr "/Redigeeri/_Logo vasakule" -#~ msgid "Files can't have the same names !\n" -#~ msgstr "Failidel ei saa olla sama nimi !!\n" +#: xgnokii/xgnokii_logos.c:1160 +msgid "/Edit/_Right logo" +msgstr "/Redigeeri/Logo paremale" -#~ msgid "Couldn't open %s or /etc/gnokiirc, using default config\n" -#~ msgstr "" -#~ "Ei suuda %s avada ega ka /etc/gnokiirc, kasutan konfiguratsiooni " -#~ "vaikeväärtusi!\n" +#: xgnokii/xgnokii_logos.c:1162 +msgid "/Edit/Flip _horizontal" +msgstr "/Redigeeri/Pööra _horisontaalis" -#~ msgid "Error saving SMS centers!" -#~ msgstr "Viga SMS keskuste salvestamisel!" +#: xgnokii/xgnokii_logos.c:1163 +msgid "/Edit/Flip _vertical" +msgstr "/Redigeeri/Pööra _vertikaalis" -#~ msgid "Couldn't open %s or /etc/gnokiirc, using default config!\n" -#~ msgstr "" -#~ "Ei suuda %s avada ega ka /etc/gnokiirc, kasutan konfiguratsiooni " -#~ "vaikeväärtusi!\n" +#: xgnokii/xgnokii_logos.c:1442 +msgid "Load preview pixmap error, feature disabled." +msgstr "" #~ msgid "Logo file error.\n" #~ msgstr "Logo faili viga.\n" @@ -4090,12 +3763,18 @@ msgstr "XGnokii Klaviatuur" #~ msgid " usage: gnokiid {--help|--version}" #~ msgstr " kasutus: gnokiid {--help|--version}" +#~ msgid "%s: line %d: Can't get ME memory entry number %d! %d\n" +#~ msgstr "%s: rida %d: Ei saa kätte ME mälu asukoha numbrit %d! %d\n" + #~ msgid "%s: line %d: Can't get SM memory entry number %d! %d\n" #~ msgstr "%s: rida %d: Ei saa kätte SM mälu asukoha numbrit %d! %d\n" #~ msgid "0x16 Registration Response 0x%02x 0x%02x\n" #~ msgstr "0x16 Registreerimise vastus 0x%02x 0x%02x\n" +#~ msgid "Date" +#~ msgstr "Kuupäev" + #~ msgid "Groups names" #~ msgstr "Gruppide nimed" diff --git a/po/pl.po b/po/pl.po index 6d68f57..78dcadc 100644 --- a/po/pl.po +++ b/po/pl.po @@ -1676,7 +1676,7 @@ msgstr "" #: gnokii/gnokii.c:371 gnokii/gnokii.c:2634 gnokiid/virtmodem.c:282 #: xgnokii/xgnokii.c:281 xlogos/xlogos.c:139 msgid "GSM/FBUS init failed! (Unknown model ?). Quitting.\n" -msgstr "Inicjalizacja GSM/FBUS nieudana! (Nieznany model?). Koñczê pracê.\n" +msgstr "Inicjalizacha GSM/FBUS nieudana! (Nieznany model?). Koñczê pracê.\n" #: gnokii/gnokii.c:382 msgid "Hmmm... GSM_LinkOK never went true. Quitting.\n" diff --git a/utils/Makefile b/utils/Makefile index e9220d3..04af119 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -13,31 +13,38 @@ OBJS = mgnokiidev.o all: mgnokiidev -mgnokiidev: $(OBJS) +mgnokiidev: $(OBJS) +makelib: $(OBJS) + $(CC) $(LDFLAGS) $(OBJS) -o mgnokiidev + clean: $(RM) $(OBJS) *~ depend mgnokiidev *.exe core *.bak -install: +install: all $(INSTALL) -d $(sbindir) $(INSTALL) mgnokiidev $(sbindir) $(INSTALL) todologo $(bindir) - -install-strip: + $(INSTALL) sendsms $(bindir) + +install-strip: all $(INSTALL) -d $(sbindir) $(INSTALL) -s mgnokiidev $(sbindir) $(INSTALL) todologo $(bindir) - -install-suid: + $(INSTALL) sendsms $(bindir) + +install-suid: all $(INSTALL) -d $(sbindir) $(INSTALL) -o root -g gnokii -m 4750 mgnokiidev $(sbindir) $(INSTALL) todologo $(bindir) - -install-ss: + $(INSTALL) sendsms $(bindir) + +install-ss: all $(INSTALL) -d $(sbindir) $(INSTALL) -o root -g gnokii -m 4750 -s mgnokiidev $(sbindir) $(INSTALL) todologo $(bindir) - + $(INSTALL) sendsms $(bindir) + depend dep: $(CC) $(CFLAGS) -MM *.c >depend diff --git a/utils/mgnokiidev.c b/utils/mgnokiidev.c index e6b80a9..78b2090 100644 --- a/utils/mgnokiidev.c +++ b/utils/mgnokiidev.c @@ -6,24 +6,11 @@ A Linux/Unix toolset and driver for Nokia mobile phones. - Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml. - Released under the terms of the GNU GPL, see file COPYING for more details. Mgnokiidev gets passed a slave pty name by gnokiid and uses this information to create a symlink from the pty to /dev/gnokii. - $Log$ - Revision 1.1.1.1 2001/11/25 21:59:23 short - :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001 - - Revision 1.7 2001/09/14 12:38:00 pkot - More cleanups - - Revision 1.6 2000/12/27 10:54:15 pkot - Added Unix98 PTYs support (Michael Mráka). - - */ #include @@ -44,7 +31,7 @@ int main(int argc, char *argv[]) { - int count, err, aux; + int count, err; char dev_name[DEVLEN]; /* Check we have one and only one command line argument. */ @@ -62,8 +49,7 @@ int main(int argc, char *argv[]) strncpy(dev_name, argv[1], DEVLEN); /* Check for suspicious characters. */ - aux = strlen(dev_name); - for (count = 0; count < aux; count ++) + for (count = 0; count < strlen(dev_name); count ++) if (!(isalnum(dev_name[count]) || dev_name[count]=='/')) { fprintf(stderr, "Suspicious character at index %d in argument.\n", count); exit (-2); diff --git a/xgnokii/Makefile b/xgnokii/Makefile index c7d1e88..c3e220b 100644 --- a/xgnokii/Makefile +++ b/xgnokii/Makefile @@ -1,29 +1,22 @@ # -# $Id$ -# # Makefile for the xGNOKII tool suite. # -# Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. & Jan Derfinak -# 2000 Karel Zak -# TOPDIR=.. include $(TOPDIR)/Makefile.global -ifdef XPM_LIBS - LDFLAGS += $(XPM_LIBS) - CFLAGS += $(XPM_CFLAGS) -endif - -CFLAGS += $(PTHREAD_CFLAGS) \ - $(GTK_CFLAGS) +CFLAGS += -DXGNOKIIDOCSDIR=\"$(docdir)\" \ + $(PTHREAD_CFLAGS) \ + $(GTK_CFLAGS) -LDFLAGS += $(PTHREAD_LIBS) \ - $(GTK_LIBS) +LDLIBS += $(PTHREAD_LIBS) \ + $(GTK_LIBS) -LDFLAGS += -L$(TOPDIR)/common -lgnokii +ifdef XPM_LIBS + LDLIBS += $(XPM_LIBS) +endif OBJS = xgnokii.o \ xgnokii_common.o \ @@ -36,81 +29,46 @@ OBJS = xgnokii.o \ xgnokii_xkeyb.o \ xgnokii_calendar.o \ xgnokii_logos.o \ + xgnokii_xring.o \ xgnokii_lowlevel.o \ xgnokii_data.o -HELP_DIR = docs/help - - all: xgnokii +xgnokii: $(OBJS) $(TOPDIR)/common/COMMON.o $(TOPDIR)/common/DATA.o $(TOPDIR)/common/gsm-filetypes.o + $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LOADLIBES) $(LDLIBS) -o $@ -xgnokii: $(OBJS) $(TOPDIR)/common/data/DATA.o $(TOPDIR)/common/gsm-filetypes.o +$(TOPDIR)/common/COMMON.o: + $(MAKE) -C $(TOPDIR)/common COMMON.o -$(TOPDIR)/common/data/DATA.o: - $(MAKE) -C $(TOPDIR)/common/data DATA.o +$(TOPDIR)/common/DATA.o: + $(MAKE) -C $(TOPDIR)/common DATA.o -$(TOPDIR)/common/gsm-filetypes.o: +$(TOPDIR)/common/gsm-filetypes.o: $(MAKE) -C $(TOPDIR)/common gsm-filetypes.o +$(TOPDIR)/common/libmygnokii.so: + $(MAKE) -C $(TOPDIR)/common makelib + +xgnokiilib: $(OBJS) $(TOPDIR)/common/libmygnokii.so + $(CC) $(LDFLAGS) $(TARGET_ARCH) $(OBJS) -L$(TOPDIR)/common -lmygnokii $(LOADLIBES) $(LDLIBS) -o $@ + +makelib: xgnokiilib + clean: - $(RM) $(OBJS) *~ xpm/*~ depend xgnokii + $(RM) $(OBJS) *~ xpm/*~ depend xgnokii xgnokiilib install: all $(INSTALL) -d $(xbindir) $(INSTALL) xgnokii $(xbindir) - $(INSTALL) -d $(xgnokii_libdir)/help - ( cd $(HELP_DIR); \ - $(FIND) . -type d \! -path "*CVS*" \ - -exec $(INSTALL) -d $(xgnokii_libdir)/help/{} \; ; \ - $(FIND) . -type f \! -path "*CVS*" \ - -exec $(INSTALL) -m 0444 {} $(xgnokii_libdir)/help/{} \; \ - ) - $(INSTALL) -m 0444 ../Docs/CREDITS $(xgnokii_libdir)/help/en_US - $(INSTALL) -m 0444 ../COPYING $(xgnokii_libdir)/help/en_US - $(INSTALL) -d $(xgnokii_libdir)/help/en_US/sample - $(INSTALL) -m 0444 ../Docs/sample/gnokiirc $(xgnokii_libdir)/help/en_US/sample - (cd $(xgnokii_libdir)/help; ln -sf en_US C; ln -sf en_US POSIX) + $(INSTALL) xgnokiilib $(xbindir)/xgnokii $(INSTALL) -d $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_3310.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_3210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6250.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_7110.xpm $(xgnokii_libdir)/xpm install-strip: all $(INSTALL) -d $(xbindir) $(INSTALL) -s xgnokii $(xbindir) - $(INSTALL) -d $(xgnokii_libdir)/help - ( cd $(HELP_DIR); \ - $(FIND) . -type d \! -path "*CVS*" \ - -exec $(INSTALL) -d $(xgnokii_libdir)/help/{} \; ; \ - $(FIND) . -type f \! -path "*CVS*" \ - -exec $(INSTALL) -m 0444 {} $(xgnokii_libdir)/help/{} \; \ - ) - $(INSTALL) -m 0444 ../Docs/CREDITS $(xgnokii_libdir)/help/en_US - $(INSTALL) -m 0444 ../COPYING $(xgnokii_libdir)/help/en_US - $(INSTALL) -d $(xgnokii_libdir)/help/en_US/sample - $(INSTALL) -m 0444 ../Docs/sample/gnokiirc $(xgnokii_libdir)/help/en_US/sample - (cd $(xgnokii_libdir)/help; ln -sf en_US C; ln -sf en_US POSIX) + $(INSTALL) -s xgnokiilib $(xbindir)/xgnokii $(INSTALL) -d $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_3310.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_3210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_6250.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -m 0444 xpm/Preview_7110.xpm $(xgnokii_libdir)/xpm @echo "done" install-suid: all @@ -119,30 +77,8 @@ install-suid: all fi $(INSTALL) -d $(xbindir) $(INSTALL) -o root -g gnokii -m 0750 xgnokii $(xbindir) - $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/help - ( cd $(HELP_DIR); \ - $(FIND) . -type d \! -path "*CVS*" \ - -exec $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/help/{} \; ; \ - $(FIND) . -type f \! -path "*CVS*" \ - -exec $(INSTALL) -o root -g gnokii -m 0440 {} $(xgnokii_libdir)/help/{} \; \ - ) - $(INSTALL) -o root -g gnokii -m 0440 ../Docs/CREDITS $(xgnokii_libdir)/help/en_US - $(INSTALL) -o root -g gnokii -m 0440 ../COPYING $(xgnokii_libdir)/help/en_US - $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/help/en_US/sample - $(INSTALL) -o root -g gnokii -m 0440 ../Docs/sample/gnokiirc $(xgnokii_libdir)/help/en_US/sample - (cd $(xgnokii_libdir)/help; ln -sf en_US C; ln -sf en_US POSIX) + $(INSTALL) -o root -g gnokii -m 0750 xgnokiilib $(xbindir)/xgnokii $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_3310.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_3210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6250.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_7110.xpm $(xgnokii_libdir)/xpm @echo install-ss: all @@ -151,30 +87,8 @@ install-ss: all fi $(INSTALL) -o root -g gnokii -d $(xbindir) $(INSTALL) -o root -g gnokii -m 0750 -s xgnokii $(xbindir) - $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/help - ( cd $(HELP_DIR); \ - $(FIND) . -type d \! -path "*CVS*" \ - -exec $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/help/{} \; ; \ - $(FIND) . -type f \! -path "*CVS*" \ - -exec $(INSTALL) -o root -g gnokii -m 0440 {} $(xgnokii_libdir)/help/{} \; \ - ) - $(INSTALL) -o root -g gnokii -m 0440 ../Docs/CREDITS $(xgnokii_libdir)/help/en_US - $(INSTALL) -o root -g gnokii -m 0440 ../COPYING $(xgnokii_libdir)/help/en_US - $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/help/en_US/sample - $(INSTALL) -o root -g gnokii -m 0440 ../Docs/sample/gnokiirc $(xgnokii_libdir)/help/en_US/sample - (cd $(xgnokii_libdir)/help; ln -sf en_US C; ln -sf en_US POSIX) + $(INSTALL) -o root -g gnokii -m 0750 -s xgnokiilib $(xbindir)/xgnokii $(INSTALL) -o root -g gnokii -d -m 0750 $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6150.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_3310.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_5110.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_3210.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_6250.xpm $(xgnokii_libdir)/xpm - $(INSTALL) -o root -g gnokii -m 0440 xpm/Preview_7110.xpm $(xgnokii_libdir)/xpm @echo depend dep: diff --git a/xgnokii/VERSION b/xgnokii/VERSION index 36b474b..0b2c357 100644 --- a/xgnokii/VERSION +++ b/xgnokii/VERSION @@ -1 +1 @@ -20010323 \ No newline at end of file +20000715 \ No newline at end of file diff --git a/xgnokii/xgnokii.c b/xgnokii/xgnokii.c index ecfe668..233ebd6 100644 --- a/xgnokii/xgnokii.c +++ b/xgnokii/xgnokii.c @@ -1,12 +1,8 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. @@ -37,11 +33,7 @@ #include "misc.h" #include "gsm-common.h" #include "gsm-api.h" -#include "cfgreader.h" -#include "phones/nk7110.h" -#include "phones/nk6100.h" -#include "phones/nk3110.h" -#include "phones/nk2110.h" +#include "files/cfgreader.h" #include "xgnokii.h" #include "xgnokii_common.h" #include "xgnokii_lowlevel.h" @@ -53,8 +45,10 @@ #include "xgnokii_xkeyb.h" #include "xgnokii_calendar.h" #include "xgnokii_logos.h" +#include "xgnokii_xring.h" #include "xgnokii_cfg.h" #include "xgnokii_data.h" +#include "newmodules/n6110.h" #include "xpm/logo.xpm" #include "xpm/background.xpm" @@ -111,11 +105,15 @@ gint max_phonebook_sim_number_length; /* Local variables */ static char *DefaultXGnokiiDir = XGNOKIIDIR; +static char *DefaultXGnokiiDocsDir = XGNOKIIDOCSDIR; static bool SMSSettingsInitialized = FALSE; static bool CallersGroupsInitialized = FALSE; +static bool SMSFoldersInitialized = FALSE; static gint hiddenCallDialog; static guint splashRemoveHandler; +GSM_SMSFolders folders; + static struct CallDialog { GtkWidget *dialog; GtkWidget *label; @@ -132,7 +130,7 @@ typedef struct { GtkWidget *model; GtkWidget *init; GtkWidget *bindir; - GtkWidget *serial, *infrared, *irda; + GtkWidget *serial, *infrared, *mbus; } ConnectionWidgets; typedef struct { @@ -147,9 +145,10 @@ typedef struct { typedef struct { GtkWidget *set; GtkWidget *number; + GtkWidget *defaultrecipient; GtkWidget *format; GtkWidget *validity; - SMS_MessageCenter smsSetting[MAX_SMS_CENTER]; + GSM_MessageCenter smsSetting[MAX_SMS_CENTER]; } SMSWidgets; typedef struct { @@ -177,16 +176,26 @@ static struct ConfigDialogData GtkWidget *help; } configDialogData; -static SMS_MessageCenter tempMessageSettings; +static GSM_MessageCenter tempMessageSettings; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/main/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } +void GUI_InitSMSFoldersInf (void) +{ + if (SMSFoldersInitialized) + return; + + GSM->GetSMSFolders(&folders); + + SMSFoldersInitialized = TRUE; + GUIEventSend (GUI_EVENT_SMS_FOLDERS_CHANGED); +} void GUI_InitCallerGroupsInf (void) { @@ -208,7 +217,7 @@ void GUI_InitCallerGroupsInf (void) xgnokiiConfig.callerGroups[4] = g_strndup( _("Other"), MAX_CALLER_GROUP_LENGTH); xgnokiiConfig.callerGroups[5] = g_strndup( _("No group"), MAX_CALLER_GROUP_LENGTH); - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) for (i = 0; i < 5; i++) { cg = (D_CallerGroup *) g_malloc (sizeof (D_CallerGroup)); @@ -245,7 +254,6 @@ static inline void DrawBackground (GtkWidget *data) 261, 96); } - int network_levels[] = { 152, 69, 11, 3, 138, 69, 11, 3, @@ -282,7 +290,6 @@ int battery_levels[] = { 92, 69, 11, 6 }; - static inline void DrawBattery (GtkWidget *data, int batterylevel) { int i; @@ -304,7 +311,6 @@ static inline void DrawBattery (GtkWidget *data, int batterylevel) } } - static inline void DrawSMS (GtkWidget *data) { gdk_draw_pixmap (Pixmap, @@ -326,12 +332,11 @@ static inline void DrawAlarm (GtkWidget *data) 9, 9); } - static inline void DrawText (GtkWidget *data, int at, char *text) { static GdkFont *Font; - Font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-90-*-*-*-*-iso8859-*"); + Font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-90-*-*-*-*-*-*"); gdk_draw_string (Pixmap, Font, GTK_WIDGET(data)->style->fg_gc[GTK_STATE_NORMAL], @@ -411,13 +416,13 @@ static gint Update (gpointer data) DrawBackground (data); - DrawNetwork (data, phoneMonitor.rfLevel); + DrawNetwork(data, phoneMonitor.rfLevel); - DrawBattery (data, phoneMonitor.batteryLevel); + DrawBattery(data, phoneMonitor.batteryLevel); if (phoneMonitor.alarm) DrawAlarm (data); - + if (phoneMonitor.working) DrawText (data, 25, phoneMonitor.working); @@ -528,7 +533,7 @@ static void ParseSMSCenters (void) for (i = 0; i < xgnokiiConfig.smsSets; i++) { - gchar *row[4]; + gchar *row[5]; if (*(configDialogData.sms.smsSetting[i].Name) == '\0') row[0] = g_strdup_printf (_("Set %d"), i + 1); else @@ -538,32 +543,32 @@ static void ParseSMSCenters (void) switch (configDialogData.sms.smsSetting[i].Format) { - case SMS_FText: + case GSMF_Text: row[2] = g_strdup (_("Text")); break; - case SMS_FPaging: + case GSMF_Paging: row[2] = g_strdup (_("Paging")); break; - case SMS_FFax: + case GSMF_Fax: row[2] = g_strdup (_("Fax")); break; - case SMS_FEmail: - case SMS_FUCI: + case GSMF_Email: + case GSMF_UCI: row[2] = g_strdup (_("E-Mail")); break; - case SMS_FERMES: + case GSMF_ERMES: row[2] = g_strdup (_("ERMES")); break; - case SMS_FX400: + case GSMF_X400: row[2] = g_strdup (_("X.400")); break; - case SMS_FVoice: + case GSMF_Voice: row[2] = g_strdup (_("Voice")); break; @@ -574,27 +579,27 @@ static void ParseSMSCenters (void) switch (configDialogData.sms.smsSetting[i].Validity) { - case SMS_V1H: + case GSMV_1_Hour: row[3] = g_strdup (_("1 h")); break; - case SMS_V6H: + case GSMV_6_Hours: row[3] = g_strdup (_("6 h")); break; - case SMS_V24H: + case GSMV_24_Hours: row[3] = g_strdup (_("24 h")); break; - case SMS_V72H: + case GSMV_72_Hours: row[3] = g_strdup (_("72 h")); break; - case SMS_V1W: + case GSMV_1_Week: row[3] = g_strdup (_("1 week")); break; - case SMS_VMax: + case GSMV_Max_Time: row[3] = g_strdup (_("Max. time")); break; @@ -603,9 +608,11 @@ static void ParseSMSCenters (void) break; } + row[4] = g_strdup (configDialogData.sms.smsSetting[i].DefaultRecipient); + gtk_clist_append( GTK_CLIST (SMSClist), row); - for (j = 0; j < 4; j++) + for (j = 0; j < 5; j++) g_free (row[j]); } @@ -695,13 +702,14 @@ void GUI_ShowOptions (void) gtk_entry_set_text (GTK_ENTRY (configDialogData.connection.bindir), xgnokiiConfig.bindir); - if(!strcmp(xgnokiiConfig.connection, "serial")) { + if (!strcmp(xgnokiiConfig.connection, "fbus")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.serial), TRUE); - } else if(!strcmp(xgnokiiConfig.connection, "infrared")) { + + if (!strcmp(xgnokiiConfig.connection, "infrared")) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.infrared), TRUE); - } else { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.irda), TRUE); - } + + if (!strcmp(xgnokiiConfig.connection, "mbus")) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.mbus), TRUE); /* Phone */ gtk_entry_set_text (GTK_ENTRY (configDialogData.phone.model), phoneMonitor.phone.model); @@ -738,7 +746,7 @@ void GUI_ShowOptions (void) else { xgnokiiConfig.alarmSupported = TRUE; - if (alarm->time.AlarmEnabled) + if (alarm->time.IsSet) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.alarm.alarmSwitch), TRUE); else gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.alarm.alarmSwitch), FALSE); @@ -748,7 +756,7 @@ void GUI_ShowOptions (void) g_free (alarm); /* SMS */ - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) { gtk_widget_show (sms_option_frame); GUI_InitSMSSettings (); @@ -758,7 +766,7 @@ void GUI_ShowOptions (void) /* BUSINESS CARD */ - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) { gtk_widget_show (user_option_frame); @@ -784,7 +792,7 @@ void GUI_ShowOptions (void) /* Groups */ - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) { gtk_widget_show (cg_names_option_frame); GUI_InitCallerGroupsInf (); @@ -795,7 +803,7 @@ void GUI_ShowOptions (void) gtk_widget_hide (cg_names_option_frame); /* Mail */ - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) { gtk_widget_show (mail_option_frame); gtk_entry_set_text (GTK_ENTRY (configDialogData.mailbox), @@ -808,6 +816,9 @@ void GUI_ShowOptions (void) gtk_entry_set_text (GTK_ENTRY (configDialogData.help), xgnokiiConfig.helpviewer); + if (GetModelFeature(FN_SMSCDEFAULT)!=0) {} else + gtk_clist_set_column_visibility (GTK_CLIST (SMSClist), 4, (GetModelFeature(FN_SMSCDEFAULT)!=0)); + optionsDialogIsOpened = TRUE; gtk_widget_show (OptionsDialog); } @@ -833,6 +844,10 @@ static void MainExit (void) e->data = NULL; GUI_InsertEvent (e); pthread_join (monitor_th, NULL); + + //need to correctly close connection + GSM->Terminate(); + gtk_main_quit(); } @@ -841,37 +856,37 @@ static void ShowMenu (GdkEventButton *event) { GdkEventButton *bevent = (GdkEventButton *) event; - if (phoneMonitor.supported & PM_KEYBOARD) + if (GetModelFeature(FN_KEYPRESS)!=0) gtk_widget_show (xkeyb_menu_item); else gtk_widget_hide (xkeyb_menu_item); - if (phoneMonitor.supported & PM_NETMONITOR) + if (GetModelFeature(FN_NETMONITOR)!=0) gtk_widget_show (netmon_menu_item); else gtk_widget_hide (netmon_menu_item); - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) gtk_widget_show (sms_menu_item); else gtk_widget_hide (sms_menu_item); - if (phoneMonitor.supported & PM_CALENDAR) + if (GetModelFeature(FN_CALENDAR)!=0) gtk_widget_show (calendar_menu_item); else gtk_widget_hide (calendar_menu_item); - if (phoneMonitor.supported & PM_DTMF) + if (GetModelFeature(FN_DTMF)!=0) gtk_widget_show (dtmf_menu_item); else gtk_widget_hide (dtmf_menu_item); - if (phoneMonitor.supported & PM_SPEEDDIAL) + if (GetModelFeature(FN_SPEEDDIAL)!=0) gtk_widget_show (speedDial_menu_item); else gtk_widget_hide (speedDial_menu_item); - if (phoneMonitor.supported & PM_DATA) + if (GetModelFeature(FN_DATACALLS)!=0) gtk_widget_show (data_menu_item); else gtk_widget_hide (data_menu_item); @@ -905,7 +920,7 @@ static gint ButtonPressEvent (GtkWidget *widget, GdkEventButton *event) else if (event->x >= 190 && event->x <= 210 && event->y >= 70 && event->y <= 85) { - if (!phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)==0) phoneMonitor.working = _("SMS not supported!"); else GUI_ShowSMS (); @@ -913,7 +928,7 @@ static gint ButtonPressEvent (GtkWidget *widget, GdkEventButton *event) else if (event->x >= 235 && event->x <= 248 && event->y >= 27 && event->y <= 75) { - if (!phoneMonitor.supported & PM_CALENDAR) + if (GetModelFeature(FN_CALENDAR)==0) phoneMonitor.working = _("Calendar not supported!"); else GUI_ShowCalendar (); @@ -964,7 +979,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data ) } /* SMS */ - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) { for (i = 0; i < xgnokiiConfig.smsSets; i++) xgnokiiConfig.smsSetting[i] = configDialogData.sms.smsSetting[i]; @@ -972,7 +987,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data ) } /* BUSINESS CARD */ - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) { g_free(xgnokiiConfig.user.name); xgnokiiConfig.user.name = g_strdup (gtk_entry_get_text(GTK_ENTRY (configDialogData.user.name))); @@ -991,7 +1006,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data ) } /* GROUPS */ - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) { for ( i = 0; i < 6; i++) { @@ -1005,7 +1020,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data ) } /* Mail */ - if (phoneMonitor.supported & PM_SMS) + if (GetModelFeature(FN_SMS)!=0) { g_free(xgnokiiConfig.mailbox); xgnokiiConfig.mailbox = g_strdup (gtk_entry_get_text(GTK_ENTRY (configDialogData.mailbox))); @@ -1037,7 +1052,7 @@ static void OptionsSaveCallback (GtkWidget *widget, gpointer data ) GUI_InsertEvent (e); } - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) { cg = (D_CallerGroup *) g_malloc (sizeof (D_CallerGroup)); cg->number = 0; @@ -1135,7 +1150,13 @@ static GtkWidget *CreateMenu (void) gtk_signal_connect_object (GTK_OBJECT (logos_menu_item), "activate", GTK_SIGNAL_FUNC (GUI_ShowLogosWindow), NULL); gtk_widget_show(logos_menu_item); - + + logos_menu_item = gtk_menu_item_new_with_label (_("Ringtones")); + gtk_menu_append (GTK_MENU (menu), logos_menu_item); + gtk_signal_connect_object (GTK_OBJECT (logos_menu_item), "activate", + GTK_SIGNAL_FUNC (GUI_ShowRingtonesWindow), NULL); + gtk_widget_show(logos_menu_item); + dtmf_menu_item = gtk_menu_item_new_with_label (_("DTMF")); gtk_menu_append (GTK_MENU (menu), dtmf_menu_item); gtk_signal_connect_object (GTK_OBJECT (dtmf_menu_item), "activate", @@ -1195,7 +1216,7 @@ static GtkWidget *CreateAboutDialog (void) { GtkWidget *dialog; GtkWidget *button, *hbox, *label; - gchar buf[2000]; + gchar buf[200]; dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog), _("About")); @@ -1215,12 +1236,8 @@ static GtkWidget *CreateAboutDialog (void) gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); gtk_widget_show (hbox); - g_snprintf (buf, 2000, _("xgnokii version: %s\ngnokii version: %s\n\n\ -Copyright (C) 1999,2000 Pavel Janík ml.,\nHugh Blemings, Jan Derfinak and others\n\ -xgnokii is free software, covered by the GNU General Public License, and you are\n\ -welcome to change it and/or distribute copies of it under certain conditions.\n\ -There is absolutely no waranty for xgnokii. See GPL for details.\n"), - XVERSION, VERSION); + g_snprintf (buf, 200, _("xgnokii version: %s\ngnokii version: %s\n\n\ +Copyright (C) 1999 Pavel Janík ml.,\nHugh Blemings & Jan Derfinak\n"), XVERSION, VERSION); label = gtk_label_new ((gchar *) buf); gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -1346,6 +1363,13 @@ static void OkEditSMSSetDialog (GtkWidget *w, gpointer data) configDialogData.sms.smsSetting[GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Number[GSM_MAX_SMS_CENTER_LENGTH] = '\0'; + strncpy(configDialogData.sms.smsSetting + [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].DefaultRecipient, + gtk_entry_get_text(GTK_ENTRY (configDialogData.sms.defaultrecipient)), + GSM_MAX_RECIPIENT_LENGTH); + configDialogData.sms.smsSetting[GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].DefaultRecipient[GSM_MAX_RECIPIENT_LENGTH] + = '\0'; + configDialogData.sms.smsSetting[GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Format = tempMessageSettings.Format; @@ -1372,7 +1396,7 @@ static inline void EditSMSSetDialogClick (GtkWidget *clist, static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data) { static GtkWidget *dialog = NULL; - GtkWidget *button, *label, *hbox, *menu, *item; + GtkWidget *button, *label, *label2, *hbox, *hbox2, *menu, *item; if (GTK_CLIST (SMSClist)->selection == NULL) return; @@ -1429,10 +1453,25 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data) gtk_box_pack_end(GTK_BOX(hbox), configDialogData.sms.number, FALSE, FALSE, 2); gtk_widget_show (configDialogData.sms.number); + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox2, FALSE, FALSE, 9); + if (GetModelFeature(FN_SMSCDEFAULT)!=0) + gtk_widget_show (hbox2); + + label2 = gtk_label_new (_("Default recipient:")); + gtk_box_pack_start(GTK_BOX(hbox2), label2, FALSE, FALSE, 2); + if (GetModelFeature(FN_SMSCDEFAULT)!=0) + gtk_widget_show (label2); + + configDialogData.sms.defaultrecipient = gtk_entry_new_with_max_length(GSM_MAX_RECIPIENT_LENGTH - 1); + gtk_widget_set_usize (configDialogData.sms.defaultrecipient, 110, 22); + gtk_box_pack_end(GTK_BOX(hbox2), configDialogData.sms.defaultrecipient, FALSE, FALSE, 2); + if (GetModelFeature(FN_SMSCDEFAULT)!=0) + gtk_widget_show (configDialogData.sms.defaultrecipient); + hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 9); gtk_widget_show (hbox); - label = gtk_label_new (_("Sending Format:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); @@ -1444,28 +1483,28 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data) item = gtk_menu_item_new_with_label (_("Text")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetFormat), - (gpointer) SMS_FText); + (gpointer) GSMF_Text); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("Fax")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetFormat), - (gpointer) SMS_FFax); + (gpointer) GSMF_Fax); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("Paging")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetFormat), - (gpointer) SMS_FPaging); + (gpointer) GSMF_Paging); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("E-Mail")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetFormat), - (gpointer) SMS_FEmail); + (gpointer) GSMF_Email); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); @@ -1488,42 +1527,42 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data) item = gtk_menu_item_new_with_label (_("Max. Time")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetValidity), - (gpointer) SMS_VMax); + (gpointer) GSMV_Max_Time); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("1 h")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetValidity), - (gpointer) SMS_V1H); + (gpointer) GSMV_1_Hour); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("6 h")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetValidity), - (gpointer) SMS_V6H); + (gpointer) GSMV_6_Hours); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("24 h")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetValidity), - (gpointer) SMS_V24H); + (gpointer) GSMV_24_Hours); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("72 h")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetValidity), - (gpointer) SMS_V72H); + (gpointer) GSMV_72_Hours); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); item = gtk_menu_item_new_with_label (_("1 week")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(SetValidity), - (gpointer) SMS_V1W); + (gpointer) GSMV_1_Week); gtk_widget_show (item); gtk_menu_append (GTK_MENU (menu), item); @@ -1540,25 +1579,29 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data) configDialogData.sms.smsSetting [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Number); + gtk_entry_set_text (GTK_ENTRY (configDialogData.sms.defaultrecipient), + configDialogData.sms.smsSetting + [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].DefaultRecipient); + switch (configDialogData.sms.smsSetting [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Format) { - case SMS_FText: + case GSMF_Text: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format), 0); break; - case SMS_FPaging: + case GSMF_Paging: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format), 2); break; - case SMS_FFax: + case GSMF_Fax: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format), 1); break; - case SMS_FEmail: + case GSMF_Email: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format), 3); break; @@ -1571,32 +1614,32 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data) switch (configDialogData.sms.smsSetting [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Validity) { - case SMS_V1H: + case GSMV_1_Hour: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity), 1); break; - case SMS_V6H: + case GSMV_6_Hours: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity), 2); break; - case SMS_V24H: + case GSMV_24_Hours: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity), 3); break; - case SMS_V72H: + case GSMV_72_Hours: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity), 4); break; - case SMS_V1W: + case GSMV_1_Week: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity), 5); break; - case SMS_VMax: + case GSMV_Max_Time: gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity), 0); break; @@ -1622,7 +1665,7 @@ static GtkWidget *CreateOptionsDialog (void) GtkWidget *button, *hbox, *vbox, *label, *notebook, *frame, *clistScrolledWindow; register gint i; GtkAdjustment *adj; - gchar *titles[4] = { _("Set's name"), _("Center number"), _("Format"), _("Validity")}; + gchar *titles[5] = { _("Set's name"), _("Center number"), _("Format"), _("Validity"), _("Default recipient")}; dialog = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (dialog), _("Options")); @@ -1736,22 +1779,22 @@ static GtkWidget *CreateOptionsDialog (void) gtk_widget_show (hbox); label = gtk_label_new (_("Connection:")); - gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 2); + gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 3); gtk_widget_show (label); configDialogData.connection.infrared = gtk_radio_button_new_with_label (NULL, _("infrared")); gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.infrared, TRUE, FALSE, 2); gtk_widget_show (configDialogData.connection.infrared); - + configDialogData.connection.serial = gtk_radio_button_new_with_label ( - gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.infrared)), _("serial")); + gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.infrared)), _("fbus")); gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.serial, TRUE, FALSE, 2); gtk_widget_show (configDialogData.connection.serial); - - configDialogData.connection.irda = gtk_radio_button_new_with_label ( - gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.infrared)), _("irda")); - gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.irda, TRUE, FALSE, 2); - gtk_widget_show (configDialogData.connection.irda); + + configDialogData.connection.mbus = gtk_radio_button_new_with_label ( + gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.serial)), _("mbus")); + gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.mbus, TRUE, FALSE, 2); + gtk_widget_show (configDialogData.connection.mbus); /*** Phone notebook ***/ frame = gtk_frame_new (_("Phone information")); @@ -1828,7 +1871,7 @@ static GtkWidget *CreateOptionsDialog (void) gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); - label = gtk_label_new (_("Names length:")); + label = gtk_label_new ("Names length:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); @@ -1836,7 +1879,7 @@ static GtkWidget *CreateOptionsDialog (void) gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); - label = gtk_label_new (_("SIM:")); + label = gtk_label_new ("SIM:"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); @@ -1854,7 +1897,7 @@ static GtkWidget *CreateOptionsDialog (void) gtk_box_pack_end (GTK_BOX (hbox), configDialogData.phone.phoneNameLen, FALSE, FALSE, 2); gtk_widget_show (configDialogData.phone.phoneNameLen); - label = gtk_label_new (_("Phone:")); + label = gtk_label_new ("Phone:"); gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); @@ -1907,7 +1950,7 @@ static GtkWidget *CreateOptionsDialog (void) label = gtk_label_new (_("SMS")); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sms_option_frame, label); - SMSClist = gtk_clist_new_with_titles (4, titles); + SMSClist = gtk_clist_new_with_titles (5, titles); gtk_clist_set_shadow_type (GTK_CLIST (SMSClist), GTK_SHADOW_OUT); gtk_clist_column_titles_passive (GTK_CLIST (SMSClist)); gtk_clist_set_auto_sort (GTK_CLIST (SMSClist), FALSE); @@ -1916,6 +1959,7 @@ static GtkWidget *CreateOptionsDialog (void) gtk_clist_set_column_width (GTK_CLIST (SMSClist), 1, 115); gtk_clist_set_column_width (GTK_CLIST (SMSClist), 2, 40); gtk_clist_set_column_width (GTK_CLIST (SMSClist), 3, 55); + gtk_clist_set_column_width (GTK_CLIST (SMSClist), 4, 100); // gtk_clist_set_column_justification (GTK_CLIST (SMSClist), 1, GTK_JUSTIFY_RIGHT); clistScrolledWindow = gtk_scrolled_window_new (NULL, NULL); @@ -1926,6 +1970,7 @@ static GtkWidget *CreateOptionsDialog (void) TRUE, TRUE, 10); gtk_widget_show (SMSClist); + gtk_widget_show (clistScrolledWindow); hbox = gtk_hbox_new (FALSE, 0); @@ -2241,8 +2286,6 @@ static void TopLevelWindow (void) struct sigaction act; GUI_MainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_MainWindow), "MainWindow", "Xgnokii"); -/* gtk_window_set_decorated (GTK_WINDOW (GUI_MainWindow), GTK_FALSE); */ gtk_widget_realize (GUI_MainWindow); BackgroundPixmap = gdk_pixmap_create_from_xpm_d (GUI_MainWindow->window, &mask, &GUI_MainWindow->style->white, (gchar **) XPM_background); @@ -2298,6 +2341,7 @@ static void TopLevelWindow (void) GUI_CreateCalendarWindow (); GUI_CreateLogosWindow (); GUI_CreateDataWindow(); + GUI_CreateRingtonesWindow (); CreateErrorDialog (&errorDialog, GUI_MainWindow); CreateInfoDialog (&infoDialog, GUI_MainWindow); CreateInCallDialog (); @@ -2307,7 +2351,7 @@ static void TopLevelWindow (void) act.sa_flags = SA_NOCLDSTOP; sigaction (SIGCHLD, &act, NULL); -#if __unices__ +#if defined(__svr4__) || defined(__FreeBSD__) act.sa_handler = SIG_IGN; sigemptyset (&(act.sa_mask)); sigaction (SIGALRM, &act, NULL); @@ -2372,29 +2416,36 @@ static gint RemoveSplash (GtkWidget *Win) static void ReadConfig (void) { -#ifdef WIN32 - xgnokiiConfig.locale = ""; -#else + /* Read config file */ + if (CFG_ReadConfig(&xgnokiiConfig.model, &xgnokiiConfig.port, + &xgnokiiConfig.initlength, &xgnokiiConfig.connection, + &xgnokiiConfig.bindir, &xgnokiiConfig.synchronizetime,false) < 0) { + exit(-1); + } + +#ifndef WIN32 if ((xgnokiiConfig.locale = getenv ("LC_ALL")) == NULL) if ((xgnokiiConfig.locale = getenv ("LC_MESSAGES")) == NULL) if ((xgnokiiConfig.locale = getenv ("LANG")) == NULL) xgnokiiConfig.locale = "POSIX"; #endif - if (readconfig(&xgnokiiConfig.model, &xgnokiiConfig.port, - &xgnokiiConfig.initlength, &xgnokiiConfig.connection, - &xgnokiiConfig.bindir) < 0) - { - exit(-1); - } - + GUI_ReadXConfig(); max_phonebook_name_length = atoi (xgnokiiConfig.maxPhoneLen); max_phonebook_sim_name_length = atoi (xgnokiiConfig.maxSIMLen); #ifndef WIN32 xgnokiiConfig.xgnokiidir = DefaultXGnokiiDir; + xgnokiiConfig.xgnokiidocsdir = DefaultXGnokiiDocsDir; #endif - max_phonebook_number_length = max_phonebook_sim_number_length = GSM_MAX_PHONEBOOK_NUMBER_LENGTH; + if (CheckModel (N6110_Information, xgnokiiConfig.model, CurrentConnectionType)) { + max_phonebook_number_length = N6110_MAX_PHONEBOOK_NUMBER_LENGTH; + max_phonebook_sim_number_length = N6110_MAX_PHONEBOOK_NUMBER_LENGTH; + } + else + { + max_phonebook_number_length = max_phonebook_sim_number_length = GSM_MAX_PHONEBOOK_NUMBER_LENGTH; + } xgnokiiConfig.callerGroups[0] = xgnokiiConfig.callerGroups[1] = xgnokiiConfig.callerGroups[2] = xgnokiiConfig.callerGroups[3] = @@ -2426,5 +2477,5 @@ int main (int argc, char *argv[]) gtk_main (); - return (0); + return(0); } diff --git a/xgnokii/xgnokii.h b/xgnokii/xgnokii.h index f8445b7..ad79075 100644 --- a/xgnokii/xgnokii.h +++ b/xgnokii/xgnokii.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Wed Apr 26 2000 - Modified by Jan Derfinak - */ #ifndef XGNOKII_H @@ -19,7 +14,7 @@ #include #include "config.h" #include "misc.h" -#include "gsm-common.h" +#include "gsm-sms.h" #define MAX_CALLER_GROUP_LENGTH 10 #define MAX_SMS_CENTER 10 @@ -40,14 +35,16 @@ typedef struct { gchar *model; /* Model from .gnokiirc file. */ gchar *port; /* Serial port from .gnokiirc file */ gchar *connection; /* Connection type from .gnokiirc file */ + gchar *synchronizetime; gchar *bindir; gchar *xgnokiidir; + gchar *xgnokiidocsdir; gchar *helpviewer; /* Program to showing help files */ gchar *mailbox; /* Mailbox, where we can save SMS's */ gchar *maxSIMLen; /* Max length of names on SIM card */ gchar *maxPhoneLen;/* Max length of names in phone */ gchar *locale; - SMS_MessageCenter smsSetting[MAX_SMS_CENTER]; + GSM_MessageCenter smsSetting[MAX_SMS_CENTER]; UserInf user; gchar *callerGroups[6]; gint smsSets:4; @@ -61,8 +58,10 @@ extern gint max_phonebook_name_length; extern gint max_phonebook_number_length; extern gint max_phonebook_sim_name_length; extern gint max_phonebook_sim_number_length; +extern GSM_SMSFolders folders; extern void GUI_InitCallerGroupsInf (void); extern void GUI_InitSMSSettings (void); +extern void GUI_InitSMSFoldersInf (void); extern void GUI_ShowAbout (void); #endif /* XGNOKII_H */ diff --git a/xgnokii/xgnokii_calendar.c b/xgnokii/xgnokii_calendar.c index c0741e2..6c64386 100644 --- a/xgnokii/xgnokii_calendar.c +++ b/xgnokii/xgnokii_calendar.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Tue Nov 28 1999 - Modified by Jan Derfinak - */ #include @@ -117,7 +112,7 @@ static inline void CloseCalendar (GtkWidget *w, gpointer data) inline void GUI_ShowCalendar () { - if (phoneMonitor.supported & PM_CALENDAR) + if (GetModelFeature(FN_CALENDAR)!=0) gtk_widget_show (GUI_CalendarWindow); } @@ -1294,10 +1289,10 @@ static GtkItemFactoryEntry menu_items[] = { { NULL, NULL, NULL, 0, ""}, { NULL, "W", CloseCalendar, 0, NULL}, { NULL, NULL, NULL, 0, ""}, - { NULL, "N", NULL, 0, NULL}, - { NULL, "C", NULL, 0, NULL}, - { NULL, "M", NULL, 0, NULL}, - { NULL, "B", NULL, 0, NULL}, + { NULL, "N", AddReminder, 0, NULL}, + { NULL, "C", AddCall, 0, NULL}, + { NULL, "M", AddMeeting, 0, NULL}, + { NULL, "B", AddBirthday, 0, NULL}, { NULL, NULL, NULL, 0, NULL}, { NULL, "D", DeleteNote, 0, NULL}, { NULL, NULL, NULL, 0, ""}, diff --git a/xgnokii/xgnokii_calendar.h b/xgnokii/xgnokii_calendar.h index a4c5b91..d0c8b8f 100644 --- a/xgnokii/xgnokii_calendar.h +++ b/xgnokii/xgnokii_calendar.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Sun Apr 31 2000 - Modified by Jan Derfinak - */ #ifndef XGNOKII_CALENDAR_H diff --git a/xgnokii/xgnokii_cfg.c b/xgnokii/xgnokii_cfg.c index 7286ce1..c4cf9cb 100644 --- a/xgnokii/xgnokii_cfg.c +++ b/xgnokii/xgnokii_cfg.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Mon Oct 10 1999 - Modified by Jan Derfinak - */ #include diff --git a/xgnokii/xgnokii_cfg.h b/xgnokii/xgnokii_cfg.h index 75dfab9..f258a19 100644 --- a/xgnokii/xgnokii_cfg.h +++ b/xgnokii/xgnokii_cfg.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Mon Oct 10 1999 - Modified by Jan Derfinak - */ #ifndef XGNOKII_CFG_H diff --git a/xgnokii/xgnokii_common.c b/xgnokii/xgnokii_common.c index 10748f0..9f7acd4 100644 --- a/xgnokii/xgnokii_common.c +++ b/xgnokii/xgnokii_common.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Mon May 01 2000 - Modified by Jan Derfinak - */ #ifndef WIN32 @@ -28,7 +23,6 @@ #include "xpm/stop.xpm" #include "xpm/info.xpm" - typedef struct { GUIEventType type; void (*func)(void); @@ -249,7 +243,7 @@ void Help (const GtkWidget *w, const gpointer data) { gchar buf[255] = "file:"; - strncat (buf, xgnokiiConfig.xgnokiidir, 255 - strlen (buf)); + strncat (buf, xgnokiiConfig.xgnokiidocsdir, 255 - strlen (buf)); buf[254] = '\0'; strncat (buf, (gchar *) data, 255 - strlen (buf)); buf[254] = '\0'; diff --git a/xgnokii/xgnokii_common.h b/xgnokii/xgnokii_common.h index e594a38..e90439a 100644 --- a/xgnokii/xgnokii_common.h +++ b/xgnokii/xgnokii_common.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Mon May 01 2000 - Modified by Jan Derfinak - */ #ifndef XGNOKII_COMMON_H @@ -24,12 +19,6 @@ typedef struct { gint column; } SortColumn; -/* typedef struct { - gchar *model; - gchar *number; -} Model; -*/ - typedef struct { GtkWidget *dialog; GtkWidget *text; @@ -56,6 +45,7 @@ typedef enum { GUI_EVENT_SMS_NUMBER_CHANGED, GUI_EVENT_SMS_CENTERS_CHANGED, GUI_EVENT_NETMON_CHANGED, + GUI_EVENT_SMS_FOLDERS_CHANGED } GUIEventType; extern void CancelDialog (const GtkWidget *, const gpointer); @@ -70,6 +60,15 @@ extern gint LaunchProcess (const gchar *, const gchar *, const gint, extern void RemoveZombie (const gint); extern void Help (const GtkWidget *, const gpointer); extern gint strrncmp (const gchar * const, const gchar * const, size_t); +extern gchar *GetModel (const gchar *); +extern bool CallerGroupSupported (const gchar *); +extern bool NetmonitorSupported (const gchar *); +extern bool KeyboardSupported (const gchar *); +extern bool SMSSupported (const gchar *); +extern bool CalendarSupported (const gchar *); +extern bool DTMFSupported (const gchar *); +extern bool DataSupported (const gchar *); +extern bool SpeedDialSupported (const gchar *); extern void GUI_Refresh (void); extern void SetSortColumn (GtkWidget *, SortColumn *); extern void GUIEventAdd (GUIEventType, void (*)(void)); diff --git a/xgnokii/xgnokii_contacts.c b/xgnokii/xgnokii_contacts.c index 6baacfc..d7c5f78 100644 --- a/xgnokii/xgnokii_contacts.c +++ b/xgnokii/xgnokii_contacts.c @@ -1,15 +1,13 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. + $Id$ + */ @@ -29,8 +27,12 @@ #include #include +#if __unices__ +# include +#endif #include +#include "gsm-api.h" #include "gsm-common.h" #include "xgnokii_contacts.h" #include "xgnokii_lowlevel.h" @@ -249,7 +251,7 @@ static void OkEditEntryDialog (GtkWidget *widget, gpointer data) max_phonebook_name_length); entry->entry.Name[max_phonebook_name_length] = '\0'; - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -295,7 +297,7 @@ because you save it into SIM memory!")); gtk_widget_show (errorDialog.dialog); } - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -329,7 +331,7 @@ because you save it into SIM memory!")); max_phonebook_name_length); ((EditEntryData*) data)->pbEntry->entry.Name[max_phonebook_name_length] = '\0'; - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -354,7 +356,7 @@ because you save it into SIM memory!")); gtk_widget_show (errorDialog.dialog); } - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -391,7 +393,7 @@ because you save it into SIM memory!")); clist_row[2] = "P"; else clist_row[2] = "S"; - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) clist_row[3] = xgnokiiConfig.callerGroups[((EditEntryData*) data)->pbEntry->entry.Group]; else clist_row[3] = ""; @@ -471,7 +473,7 @@ static void OkNewEntryDialog(GtkWidget *widget, gpointer data ) max_phonebook_name_length); entry->entry.Name[max_phonebook_name_length] = '\0'; - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -509,7 +511,7 @@ because you save it into SIM memory!")); gtk_widget_show (errorDialog.dialog); } - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -535,7 +537,7 @@ because you save it into SIM memory!")); max_phonebook_name_length); ((EditEntryData*) data)->pbEntry->entry.Name[max_phonebook_name_length] = '\0'; - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -560,7 +562,7 @@ because you save it into SIM memory!")); gtk_widget_show (errorDialog.dialog); } - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { } else @@ -603,7 +605,7 @@ because you save it into SIM memory!")); clist_row[2] = "P"; else clist_row[2] = "S"; - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) clist_row[3] = xgnokiiConfig.callerGroups[((EditEntryData*) data)->pbEntry->entry.Group]; else clist_row[3] = ""; @@ -702,7 +704,7 @@ static void OkChangeEntryDialog( GtkWidget *widget, gpointer data) clist_row[2] = "P"; else clist_row[2] = "S"; - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) clist_row[3] = xgnokiiConfig.callerGroups[newPbEntry->entry.Group]; else clist_row[3] = ""; @@ -1075,7 +1077,7 @@ static void CreateEditDialog (EditEntryData *editEntryData, gchar *title, gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { button = gtk_button_new (); editEntryData->number = gtk_label_new (""); @@ -1095,7 +1097,7 @@ static void CreateEditDialog (EditEntryData *editEntryData, gchar *title, gtk_widget_show (editEntryData->number); } -/* if (phoneMonitor.supported & PM_EXTPBK) { +/* if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { hbox = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (GTK_DIALOG (editEntryData->dialog)->vbox), hbox); @@ -1158,7 +1160,7 @@ static void EditPbEntry(PhonebookEntry *pbEntry, gint row) gtk_entry_set_text (GTK_ENTRY (editEditEntryData.name), pbEntry->entry.Name); - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) gtk_label_set_text (GTK_LABEL (editEditEntryData.number), pbEntry->entry.Number); else gtk_entry_set_text (GTK_ENTRY (editEditEntryData.number), pbEntry->entry.Number); @@ -1171,7 +1173,7 @@ static void EditPbEntry(PhonebookEntry *pbEntry, gint row) gtk_option_menu_set_history( GTK_OPTION_MENU (editEditEntryData.group), pbEntry->entry.Group); - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) { gtk_widget_show (editEditEntryData.group); gtk_widget_show (editEditEntryData.groupLabel); @@ -1251,7 +1253,7 @@ void NewPbEntry(PhonebookEntry *pbEntry) gtk_entry_set_text (GTK_ENTRY (newEditEntryData.name), ""); - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) gtk_label_set_text (GTK_LABEL (newEditEntryData.number), ""); else gtk_entry_set_text (GTK_ENTRY (newEditEntryData.number), ""); @@ -1264,7 +1266,7 @@ void NewPbEntry(PhonebookEntry *pbEntry) gtk_option_menu_set_history( GTK_OPTION_MENU (newEditEntryData.group), pbEntry->entry.Group); - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) { gtk_widget_show (newEditEntryData.group); gtk_widget_show (newEditEntryData.groupLabel); @@ -1295,7 +1297,7 @@ void DuplicatePbEntry (PhonebookEntry *pbEntry) gtk_entry_set_text (GTK_ENTRY (duplicateEditEntryData.name), pbEntry->entry.Name); - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) gtk_label_set_text (GTK_LABEL (duplicateEditEntryData.number), pbEntry->entry.Number); else gtk_entry_set_text (GTK_ENTRY (duplicateEditEntryData.number), pbEntry->entry.Number); @@ -1308,7 +1310,7 @@ void DuplicatePbEntry (PhonebookEntry *pbEntry) gtk_option_menu_set_history( GTK_OPTION_MENU (duplicateEditEntryData.group), pbEntry->entry.Group); - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) { gtk_widget_show (duplicateEditEntryData.group); gtk_widget_show (duplicateEditEntryData.groupLabel); @@ -1892,7 +1894,7 @@ static GtkWidget *CreateSaveQuestionDialog (GtkSignalFunc SaveFunc, static void OkExtPbkDialog (GtkWidget *w, gpointer data) { ExtPbkDialog *d=(ExtPbkDialog*)data; - SMS_NumberType numtype; + GSM_NumberType numtype; gint i, found=999; gchar *chars; @@ -2028,7 +2030,7 @@ void GUI_RefreshContacts (void) row[2] = "P"; else row[2] = "S"; - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) row[3] = xgnokiiConfig.callerGroups[pbEntry->entry.Group]; else row[3] = ""; @@ -2218,6 +2220,7 @@ Setting max SIM entries to 100!\n")); mla->min = 1; mla->max = memoryStatus.MaxME; mla->type = GMT_ME; + mla->used = memoryStatus.UsedME; //MW mla->InsertEntry = InsertPBEntryME; mla->ReadFailed = ReadFailedPBEntry; @@ -2240,6 +2243,7 @@ Setting max SIM entries to 100!\n")); mla->min = 1; mla->max = memoryStatus.MaxSM; mla->type = GMT_SM; + mla->used = memoryStatus.UsedSM; //MW mla->InsertEntry = InsertPBEntrySM; mla->ReadFailed = ReadFailedPBEntry; @@ -2323,7 +2327,7 @@ inline void GUI_ShowContacts (void) GUI_Refresh (); GUI_InitCallerGroupsInf (); } - gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, phoneMonitor.supported & PM_CALLERGROUP); + gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, (GetModelFeature(FN_CALLERGROUPS)!=0)); GUI_RefreshContacts (); gtk_widget_show (GUI_ContactsWindow); // if (!contactsMemoryInitialized) @@ -2357,7 +2361,7 @@ static void ExportVCARD (FILE *f) fprintf (f, "X_GSM_CALLERGROUP:%d\n", pbEntry->entry.Group); /* Add ext. pbk info if required */ - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) for (j = 0; j < pbEntry->entry.SubEntriesCount; j++) { if (pbEntry->entry.SubEntries[j].EntryType == GSM_Number) @@ -2416,7 +2420,7 @@ static void ExportNative (FILE *f) strcat (buf, buf2); /* Add ext. pbk info if required */ - if (phoneMonitor.supported & PM_EXTPBK) + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { for (j = 0; j < pbEntry->entry.SubEntriesCount; j++) if (pbEntry->entry.SubEntries[j].EntryType==GSM_Number) @@ -2682,7 +2686,7 @@ static bool ParseLine (GSM_PhonebookEntry *entry, gint *num, gchar *buf) return FALSE; if (i >= len) return FALSE; - entry->SubEntries[entry->SubEntriesCount].NumberType=(SMS_NumberType)strtol (s_num, &endptr, 10); + entry->SubEntries[entry->SubEntriesCount].NumberType=(GSM_NumberType)strtol (s_num, &endptr, 10); if (s_num == endptr) return FALSE; buf += (i + 1); @@ -3116,7 +3120,7 @@ SelectContactData *GUI_SelectContactDialog (void) gtk_clist_set_column_width (GTK_CLIST(selectContactData.clist), 1, 115); gtk_clist_set_column_width (GTK_CLIST(selectContactData.clist), 3, 70); gtk_clist_set_column_justification (GTK_CLIST(selectContactData.clist), 2, GTK_JUSTIFY_CENTER); - gtk_clist_set_column_visibility (GTK_CLIST(selectContactData.clist), 3, phoneMonitor.supported & PM_CALLERGROUP); + gtk_clist_set_column_visibility (GTK_CLIST(selectContactData.clist), 3, (GetModelFeature(FN_CALLERGROUPS)!=0)); for (i = 0; i < 4; i++) { @@ -3170,7 +3174,7 @@ SelectContactData *GUI_SelectContactDialog (void) row[2] = "P"; else row[2] = "S"; - if (phoneMonitor.supported & PM_CALLERGROUP) + if (GetModelFeature(FN_CALLERGROUPS)!=0) row[3] = xgnokiiConfig.callerGroups[pbEntry->entry.Group]; else row[3] = ""; @@ -3271,7 +3275,6 @@ void GUI_CreateContactsWindow (void) InitMainMenu (); contactsMemoryInitialized = FALSE; GUI_ContactsWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_ContactsWindow), "ContactsWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_ContactsWindow), _("Contacts")); gtk_widget_set_usize (GTK_WIDGET (GUI_ContactsWindow), 436, 220); //gtk_container_set_border_width (GTK_CONTAINER (GUI_ContactsWindow), 10); @@ -3367,7 +3370,7 @@ void GUI_CreateContactsWindow (void) gtk_clist_set_column_width (GTK_CLIST (clist), 1, 115); gtk_clist_set_column_width (GTK_CLIST (clist), 3, 70); gtk_clist_set_column_justification (GTK_CLIST (clist), 2, GTK_JUSTIFY_CENTER); -// gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, phoneMonitor.supported & PM_CALLERGROUP); +// gtk_clist_set_column_visibility (GTK_CLIST (clist), 3, (GetModelFeature(FN_CALLERGROUPS)!=0)); for (i = 0; i < 4; i++) { diff --git a/xgnokii/xgnokii_contacts.h b/xgnokii/xgnokii_contacts.h index 7ce2616..66a4dcf 100644 --- a/xgnokii/xgnokii_contacts.h +++ b/xgnokii/xgnokii_contacts.h @@ -1,15 +1,13 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. + $Id$ + */ #ifndef XGNOKII_CONTACTS_H diff --git a/xgnokii/xgnokii_data.c b/xgnokii/xgnokii_data.c index 261f75f..fb0aa34 100644 --- a/xgnokii/xgnokii_data.c +++ b/xgnokii/xgnokii_data.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Tues 13 June 2000 - Modified by Chris Kemp - */ #include @@ -29,7 +24,7 @@ static GtkWidget *label = NULL; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/windows/data/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/data/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } @@ -52,7 +47,7 @@ static void UpdateStatus (void) inline void GUI_ShowData (void) { - if (!phoneMonitor.supported & PM_DATA) + if (GetModelFeature(FN_DATACALLS)==0) return; if (TerminateThread) @@ -87,7 +82,8 @@ static inline void EnableData (GtkWidget *widget, TerminateThread = false; VM_Initialise (xgnokiiConfig.model, xgnokiiConfig.port, - 0, 0, xgnokiiConfig.bindir, false, false); + 0, 0, xgnokiiConfig.bindir, false, false, + xgnokiiConfig.synchronizetime); enabled = true; UpdateStatus (); } @@ -98,7 +94,6 @@ void GUI_CreateDataWindow (void) GtkWidget *button, *hbox, *vbox; GUI_DataWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_DataWindow), "DataWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_DataWindow), _("Virtual Modem")); gtk_container_set_border_width (GTK_CONTAINER (GUI_DataWindow), 10); gtk_signal_connect (GTK_OBJECT (GUI_DataWindow), "delete_event", diff --git a/xgnokii/xgnokii_data.h b/xgnokii/xgnokii_data.h index d71a331..75c33a3 100644 --- a/xgnokii/xgnokii_data.h +++ b/xgnokii/xgnokii_data.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Tue Nov 27 1999 - Modified by Jan Derfinak - */ #ifndef XGNOKII_DATA_H diff --git a/xgnokii/xgnokii_dtmf.c b/xgnokii/xgnokii_dtmf.c index 54ee4bc..7022db8 100644 --- a/xgnokii/xgnokii_dtmf.c +++ b/xgnokii/xgnokii_dtmf.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Sun Apr 30 2000 - Modified by Jan Derfinak - */ #include @@ -33,7 +28,7 @@ static gchar *saveFileName; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/windows/dtmf/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/dtmf/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } @@ -242,7 +237,6 @@ void GUI_CreateDTMFWindow () InitMainMenu (); GUI_DTMFWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_DTMFWindow), "DTMFWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_DTMFWindow), _("Dial Tone")); //gtk_widget_set_usize (GTK_WIDGET (GUI_DTMFWindow), 436, 220); gtk_signal_connect (GTK_OBJECT (GUI_DTMFWindow), "delete_event", diff --git a/xgnokii/xgnokii_dtmf.h b/xgnokii/xgnokii_dtmf.h index 737c1f0..2bc2649 100644 --- a/xgnokii/xgnokii_dtmf.h +++ b/xgnokii/xgnokii_dtmf.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Tue Nov 27 1999 - Modified by Jan Derfinak - */ #ifndef XGNOKII_DTMF_H diff --git a/xgnokii/xgnokii_logos.c b/xgnokii/xgnokii_logos.c index cc221ac..5f806cf 100644 --- a/xgnokii/xgnokii_logos.c +++ b/xgnokii/xgnokii_logos.c @@ -1,31 +1,16 @@ -/* - - $Id$ - - X G N O K I I - - A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . - - Released under the terms of the GNU GPL, see file COPYING for more details. - -*/ - -#include #include #include #include #include #include #include +#include #include "misc.h" #include "gsm-common.h" #include "gsm-api.h" -#include "cfgreader.h" #include "gsm-networks.h" -#include "gsm-filetypes.h" +#include "files/gsm-filetypes.h" #include "gsm-bitmaps.h" #include "xgnokii_logos.h" @@ -44,8 +29,6 @@ #include "xpm/New.xpm" #include "xpm/Send.xpm" #include "xpm/Read.xpm" -#include "xpm/Open.xpm" -#include "xpm/Save.xpm" #include "xpm/Edit_invert.xpm" #include "xpm/Edit_flip_horizontal.xpm" @@ -57,37 +40,36 @@ #include "xpm/Tool_filled_rectangle.xpm" extern GSM_Network GSM_Networks[]; -extern GSM_Statemachine statemachine; -GtkWidget *GUI_LogosWindow; +static GtkWidget *GUI_LogosWindow; -ErrorDialog errorDialog = {NULL, NULL}; -InfoDialog infoDialog = {NULL, NULL}; +static ErrorDialog errorDialog = {NULL, NULL}; +static InfoDialog infoDialog = {NULL, NULL}; /* stuff for drawingArea */ -GtkWidget *drawingArea = NULL; -GdkPixmap *drawingPixmap = NULL; -GdkPixmap *greenPointPixmap, *blackPointPixmap; -int drawingAreaWidth, drawingAreaHeight; /* in pixels */ -int mouseButtonPushed = 0; +static GtkWidget *drawingArea = NULL; +static GdkPixmap *drawingPixmap = NULL; +static GdkPixmap *greenPointPixmap, *blackPointPixmap; +static int drawingAreaWidth, drawingAreaHeight; /* in pixels */ +static int mouseButtonPushed = 0; /* stuff for previewArea */ -GtkWidget *previewArea = NULL; -GdkPixmap *previewPixmap = NULL; -GdkPixmap *greenPixelPixmap; -int previewPixmapWidth, previewPixmapHeight; -int previewAvailable = 1, showPreviewErrorDialog = 1; -int previewPixmapNumber = 0; +static GtkWidget *previewArea = NULL; +static GdkPixmap *previewPixmap = NULL; +static GdkPixmap *greenPixelPixmap; +static int previewPixmapWidth, previewPixmapHeight; +static int previewAvailable = 1, showPreviewErrorDialog = 1; +static int previewPixmapNumber = 0; -GSM_Bitmap bitmap, oldBitmap; -GSM_NetworkInfo networkInfo; +static GSM_Bitmap bitmap, oldBitmap; +static GSM_NetworkInfo networkInfo; /* widgets for toolbar - some, need global variables */ -GtkWidget *buttonStartup, *buttonOperator, *buttonCaller; -GtkWidget *networkCombo, *callerCombo; +static GtkWidget *buttonStartup, *buttonOperator, *buttonCaller, *buttonPicture; +static GtkWidget *networkCombo, *callerCombo; -int activeTool = TOOL_BRUSH; -int toolStartX, toolStartY, toolLastX, toolLastY; +static int activeTool = TOOL_BRUSH; +static int toolStartX, toolStartY, toolLastX, toolLastY; /* tools for drawing */ static GtkWidget *buttonBrush, *buttonLine, *buttonRectangle; @@ -230,7 +212,6 @@ GdkPixmap *GetPreviewPixmap (GtkWidget *widget) { pixmap = gdk_pixmap_create_from_xpm(widget->window,&mask, &widget->style->bg[GTK_STATE_NORMAL], file); - g_free(file); return pixmap; @@ -244,7 +225,8 @@ void SetPreviewPoint(GtkWidget *widget, int x, int y, int update) { if (!previewAvailable) return; /* there is difference between positiong of startupLogo and others */ - if (bitmap.type != GSM_StartupLogo) { + if (bitmap.type != GSM_StartupLogo && bitmap.type != GSM_7110StartupLogo && + bitmap.type != GSM_6210StartupLogo) { x += PREVIEWJUMPX; y += PREVIEWJUMPY; } @@ -271,7 +253,8 @@ void ClearPreviewPoint(GtkWidget *widget, int x, int y, int update) { if (!previewAvailable) return; /* there is difference between positiong of startupLogo and others */ - if (bitmap.type != GSM_StartupLogo) { + if (bitmap.type != GSM_StartupLogo && bitmap.type != GSM_7110StartupLogo && + bitmap.type != GSM_6210StartupLogo) { x += PREVIEWJUMPX; y += PREVIEWJUMPY; } @@ -299,7 +282,7 @@ int IsPoint(int x, int y) { } void SetPoint(GtkWidget *widget, int x, int y, int update) { - /* difference between settings points in startupLogo and others */ + GSM_SetPointBitmap(&bitmap,x,y); /* draw point to pixmap */ @@ -324,7 +307,7 @@ void SetPoint(GtkWidget *widget, int x, int y, int update) { } void ClearPoint(GtkWidget *widget, int x, int y, int update) { - /* difference between settings points in startupLogo and others */ + GSM_ClearPointBitmap(&bitmap,x,y); /* clear point from pixmap */ @@ -358,7 +341,8 @@ void UpdatePointsRectangle(GtkWidget *widget, int x1, int y1, int x2, int y2) { GdkRectangle updateRect; int x, y, dx = 0, dy = 0; - if (bitmap.type != GSM_StartupLogo) { + if (bitmap.type != GSM_StartupLogo && bitmap.type != GSM_7110StartupLogo && + bitmap.type != GSM_6210StartupLogo) { dx = PREVIEWJUMPX; dy = PREVIEWJUMPY; } @@ -427,8 +411,9 @@ void UpdatePreviewPoints (void) { int x, y, dx = 0, dy = 0; if (!previewPixmap || !previewAvailable) return; - - if (bitmap.type != GSM_StartupLogo) { + + if (bitmap.type != GSM_StartupLogo && bitmap.type != GSM_7110StartupLogo && + bitmap.type != GSM_6210StartupLogo) { dx = PREVIEWJUMPX; dy = PREVIEWJUMPY; } @@ -468,81 +453,97 @@ void ToolBrush(GtkWidget *widget, int column, int row, int button) { } /* TOOL - LINE */ +/* going to rewrite to Bresenham algorithm */ +static void ToolLineUpdate(GtkWidget *widget, int column, int row) { + double delta, y, x; + int i, x1, y1, x2, y2; + + if (abs(toolStartX-toolLastX) >= abs(toolStartY-toolLastY)) { + if (toolStartX > toolLastX) { + x1 = toolLastX; + x2 = toolStartX; + y1 = toolLastY; + y2 = toolStartY; + } else { + x1 = toolStartX; + x2 = toolLastX; + y1 = toolStartY; + y2 = toolLastY; + } + + delta = ((double)(y2-y1))/((double)(x2-x1)); + y = (double)y1; + for (i = x1;i <= x2;i++) { + if (!GSM_IsPointBitmap(&oldBitmap,i,(int)y)) ClearPoint(widget,i,(int)y,0); + y += delta; + } + } else { + if (toolStartY > toolLastY) { + x1 = toolLastX; + x2 = toolStartX; + y1 = toolLastY; + y2 = toolStartY; + } else { + x1 = toolStartX; + x2 = toolLastX; + y1 = toolStartY; + y2 = toolLastY; + } + delta = ((double)(x2-x1))/((double)(y2-y1)); -/* this function clear or draw a line on the screen USED BY TOOLLINEUPDATE */ -void ToolLine(GtkWidget *widget, int x1, int y1, int x2, int y2, int draw) { - int udx, udy, dx, dy, error, loop, xadd, yadd; - - dx = x2 - x1; /* x delta */ - dy = y2 - y1; /* y delta */ - - udx = abs(dx); /* unsigned x delta */ - udy = abs(dy); /* unsigned y delta */ - - if (dx < 0) { xadd = -1; } else { xadd = 1; } /* set directions */ - if (dy < 0) { yadd = -1; } else { yadd = 1; } - - error = 0; - loop = 0; - if (udx > udy) { /* delta X > delta Y */ - do { - error += udy; - - if (error >= udx) { /* is time to move up or down? */ - error -= udx; - y1 += yadd; - } - loop++; - if (draw == 1) { - SetPoint(widget,x1,y1,0); - } else { - /* now clearing line before drawing new one, we must check */ - /* if there is a point in oldBitmap which saves bitmap before */ - /* we starting drawing new line */ - if (!GSM_IsPointBitmap(&oldBitmap,x1,y1)) { - ClearPoint(widget,x1,y1,0); - } - } - x1 += xadd; /* move horizontally */ - } while (loop < udx); /* repeat for x length */ - } else { - do { - error += udx; - if (error >= udy) { /* is time to move left or right? */ - error -= udy; - x1 += xadd; - } - loop++; - if (draw == 1) { - SetPoint(widget,x1,y1,0); - } else { - /* check comment in delta X > delta Y */ - if (!GSM_IsPointBitmap(&oldBitmap,x1,y1)) { - ClearPoint(widget,x1,y1,0); - } - } - y1 += yadd; /* move vertically */ - } while (loop < udy); /* repeat for y length */ - } -} + x = (double)x1; + for (i = y1;i <= y2;i++) { + if (!GSM_IsPointBitmap(&oldBitmap,(int)x,i)) ClearPoint(widget,(int)x,i,0); + x += delta; + } + } + + if (abs(toolStartX-column) >= abs(toolStartY-row)) { + if (toolStartX > column) { + x1 = column; + x2 = toolStartX; + y1 = row; + y2 = toolStartY; + } else { + x1 = toolStartX; + x2 = column; + y1 = toolStartY; + y2 = row; + } -/* going to rewrite to Bresenham algorithm */ -void ToolLineUpdate(GtkWidget *widget, int column, int row) { - /* clear old line */ - ToolLine(widget,toolStartX,toolStartY,toolLastX,toolLastY,0); - /* draw new one */ - ToolLine(widget,toolStartX,toolStartY,column,row,1); + delta = ((double)(y2-y1))/((double)(x2-x1)); + y = (double)y1; + for (i = x1;i <= x2;i++) { + SetPoint(widget,i,(int)y,0); + y += delta; + } + } else { + if (toolStartY > row) { + x1 = column; + x2 = toolStartX; + y1 = row; + y2 = toolStartY; + } else { + x1 = toolStartX; + x2 = column; + y1 = toolStartY; + y2 = row; + } + + delta = ((double)(x2-x1))/((double)(y2-y1)); + + x = (double)x1; + for (i = y1;i <= y2;i++) { + SetPoint(widget,(int)x,i,0); + x += delta; + } + } } /* TOOL - FILLED RECT */ - -/* FIXME - going to rewrite for optimalized version, clearing and */ -/* drawing new parts only before clearing and drawing whole */ -/* filled rectangle - it's too slow on diskless terminal ;(( */ -void ToolFilledRectangleUpdate(GtkWidget *widget, int column, int row) { +static void ToolFilledRectangleUpdate(GtkWidget *widget, int column, int row) { int i, j, x1, y1, x2, y2; - /* swap Xs to x1 < x2 */ if (toolStartX > toolLastX) { x1 = toolLastX; x2 = toolStartX; @@ -551,7 +552,6 @@ void ToolFilledRectangleUpdate(GtkWidget *widget, int column, int row) { x2 = toolLastX; } - /* swap Ys to y1 < y2 */ if (toolStartY > toolLastY) { y1 = toolLastY; y2 = toolStartY; @@ -560,12 +560,10 @@ void ToolFilledRectangleUpdate(GtkWidget *widget, int column, int row) { y2 = toolLastY; } - /* clear one now */ for (j = y1;j <= y2;j++) for (i = x1;i <= x2;i++) if (!GSM_IsPointBitmap(&oldBitmap,i,j)) ClearPoint(widget,i,j,0); - /* swap Xs to x1 < x2 */ if (toolStartX > column) { x1 = column; x2 = toolStartX; @@ -574,7 +572,6 @@ void ToolFilledRectangleUpdate(GtkWidget *widget, int column, int row) { x2 = column; } - /* swap Ys to y1 < y2 */ if (toolStartY > row) { y1 = row; y2 = toolStartY; @@ -583,18 +580,16 @@ void ToolFilledRectangleUpdate(GtkWidget *widget, int column, int row) { y2 = row; } - /* draw new one */ for (j = y1;j <= y2;j++) for (i = x1;i <= x2;i++) SetPoint(widget,i,j,0); } /* TOOL - RECTANGLE */ -void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { +static void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { int i, j, x1, y1, x2, y2; /* clear old rectangle */ - /* swap Xs to x1 < x2 */ if (toolStartX > toolLastX) { x1 = toolLastX; x2 = toolStartX; @@ -603,7 +598,6 @@ void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { x2 = toolLastX; } - /* swap Ys to y1 < y2 */ if (toolStartY > toolLastY) { y1 = toolLastY; y2 = toolStartY; @@ -612,7 +606,6 @@ void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { y2 = toolLastY; } - /* clear old one */ for (i = x1;i <= x2;i++) { if (!GSM_IsPointBitmap(&oldBitmap,i,y1)) ClearPoint(widget,i,y1,0); if (!GSM_IsPointBitmap(&oldBitmap,i,y2)) ClearPoint(widget,i,y2,0); @@ -624,7 +617,6 @@ void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { } /* draw new rectangle */ - /* swap Xs to x1 < x2 */ if (toolStartX > column) { x1 = column; x2 = toolStartX; @@ -633,7 +625,6 @@ void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { x2 = column; } - /* swap Ys to y1 < y2 */ if (toolStartY > row) { y1 = row; y2 = toolStartY; @@ -642,7 +633,6 @@ void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { y2 = row; } - /* draw new one */ for (i = x1;i <= x2;i++) { if (!IsPoint(i,y1)) SetPoint(widget,i,y1,0); if (!IsPoint(i,y2)) SetPoint(widget,i,y2,0); @@ -654,24 +644,20 @@ void ToolRectangleUpdate(GtkWidget *widget, int column, int row) { } } -/* this update tools actions on the screen - this is for optimalization */ -/* eg. for faster redrawing tools actions - we do not need redraw pixel */ -/* by pixel. Faster is redraw whole rectangle which contains all changes */ -void UpdateToolScreen(GtkWidget *widget, int x1, int y1, int x2, int y2) { +static void UpdateToolScreen(GtkWidget *widget, int x1, int y1, int x2, int y2) { GdkRectangle updateRect; /* update preview area */ - if (previewAvailable) { - updateRect.x = PREVIEWSTARTX+x1; - updateRect.y = PREVIEWSTARTY+y1; - if (bitmap.type != GSM_StartupLogo) { - updateRect.x += PREVIEWJUMPX; - updateRect.y += PREVIEWJUMPY; - } - updateRect.width = x2-x1+1; - updateRect.height = y2-y1+1; - gtk_widget_draw(previewArea,&updateRect); - } + updateRect.x = PREVIEWSTARTX+x1; + updateRect.y = PREVIEWSTARTY+y1; + if (bitmap.type != GSM_StartupLogo && bitmap.type != GSM_7110StartupLogo && + bitmap.type != GSM_6210StartupLogo) { + updateRect.x += PREVIEWJUMPX; + updateRect.y += PREVIEWJUMPY; + } + updateRect.width = x2-x1+1; + updateRect.height = y2-y1+1; + gtk_widget_draw(previewArea,&updateRect); /* update drawing area */ updateRect.x = x1 * (POINTSIZE+1); @@ -686,7 +672,7 @@ void UpdateToolScreen(GtkWidget *widget, int x1, int y1, int x2, int y2) { * ************************************* */ -gint PreviewAreaButtonPressEvent(GtkWidget *widget, GdkEventButton *event) { +static gint PreviewAreaButtonPressEvent(GtkWidget *widget, GdkEventButton *event) { previewPixmapNumber = (previewPixmapNumber % 8) + 1; gtk_drawing_area_size(GTK_DRAWING_AREA(previewArea), @@ -695,7 +681,7 @@ gint PreviewAreaButtonPressEvent(GtkWidget *widget, GdkEventButton *event) { return TRUE; } -gint PreviewAreaConfigureEvent(GtkWidget *widget, GdkEventConfigure *event) { +static gint PreviewAreaConfigureEvent(GtkWidget *widget, GdkEventConfigure *event) { if (previewPixmap) gdk_pixmap_unref(previewPixmap); previewPixmap = GetPreviewPixmap(widget); @@ -704,7 +690,7 @@ gint PreviewAreaConfigureEvent(GtkWidget *widget, GdkEventConfigure *event) { return TRUE; } -gint PreviewAreaExposeEvent(GtkWidget *widget, GdkEventExpose *event) { +static gint PreviewAreaExposeEvent(GtkWidget *widget, GdkEventExpose *event) { /* got previewPixmap? */ if (previewPixmap) /* yes - simply redraw some rectangle */ @@ -720,7 +706,7 @@ gint PreviewAreaExposeEvent(GtkWidget *widget, GdkEventExpose *event) { * ******************************** */ -gint DrawingAreaButtonPressEvent(GtkWidget *widget, GdkEventButton *event) { +static gint DrawingAreaButtonPressEvent(GtkWidget *widget, GdkEventButton *event) { /* got drawingPixmap? */ if (drawingPixmap == NULL) return TRUE; @@ -783,14 +769,14 @@ gint DrawingAreaButtonPressEvent(GtkWidget *widget, GdkEventButton *event) { return TRUE; } -gint DrawingAreaButtonReleaseEvent(GtkWidget *widget, GdkEventButton *event) { +static gint DrawingAreaButtonReleaseEvent(GtkWidget *widget, GdkEventButton *event) { if (event->button == 1) mouseButtonPushed = 0; return TRUE; } -gint DrawingAreaMotionNotifyEvent(GtkWidget *widget, GdkEventMotion *event) { +static gint DrawingAreaMotionNotifyEvent(GtkWidget *widget, GdkEventMotion *event) { int x,y; GdkModifierType state; @@ -854,7 +840,7 @@ gint DrawingAreaMotionNotifyEvent(GtkWidget *widget, GdkEventMotion *event) { } /* configureEvent? -> event when someone resize windows, ... */ -gint DrawingAreaConfigureEvent(GtkWidget *widget, GdkEventConfigure *event) { +static gint DrawingAreaConfigureEvent(GtkWidget *widget, GdkEventConfigure *event) { int x, y; /* got drawingPixmap? */ if (drawingPixmap) gdk_pixmap_unref(drawingPixmap); /* got, erase it */ @@ -876,7 +862,7 @@ gint DrawingAreaConfigureEvent(GtkWidget *widget, GdkEventConfigure *event) { return TRUE; } -gint DrawingAreaExposeEvent(GtkWidget *widget, GdkEventExpose *event) { +static gint DrawingAreaExposeEvent(GtkWidget *widget, GdkEventExpose *event) { /* got drawingPixmap? */ if (drawingPixmap) /* got - draw it */ @@ -892,7 +878,7 @@ gint DrawingAreaExposeEvent(GtkWidget *widget, GdkEventExpose *event) { * ***************************************** */ -void GetNetworkInfoEvent(GtkWidget *widget) { +static void GetNetworkInfoEvent(GtkWidget *widget) { GSM_Error error; PhoneEvent *e = (PhoneEvent *)g_malloc(sizeof(PhoneEvent)); D_NetworkInfo *data = (D_NetworkInfo *)g_malloc(sizeof(D_NetworkInfo)); @@ -923,9 +909,9 @@ void GetNetworkInfoEvent(GtkWidget *widget) { GSM_GetNetworkName(networkInfo.NetworkCode)); } -void GetLogoEvent(GtkWidget *widget) { - GSM_Error error; +static void GetLogoEvent(GtkWidget *widget) { int i; + GSM_Error error; PhoneEvent *e = (PhoneEvent *) g_malloc(sizeof(PhoneEvent)); D_Bitmap *data = (D_Bitmap *)g_malloc(sizeof(D_Bitmap)); char *operator = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(networkCombo)->entry)); @@ -935,12 +921,12 @@ void GetLogoEvent(GtkWidget *widget) { data->bitmap = &bitmap; e->event = Event_GetBitmap; e->data = data; - if (phoneMonitor.supported & PM_CALLERGROUP) { + if (GetModelFeature(FN_CALLERGROUPS)!=0) { for (i = 0;i < 6;i++) if (strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(callerCombo)->entry)), xgnokiiConfig.callerGroups[i]) == 0) bitmap.number = i; } - + /* launch event and wait for result */ GUI_InsertEvent(e); pthread_mutex_lock(&getBitmapMutex); @@ -961,7 +947,7 @@ void GetLogoEvent(GtkWidget *widget) { } } -void SetLogoEvent(GtkWidget *widget) { +static void SetLogoEvent(GtkWidget *widget) { GSM_Error error; PhoneEvent *e = (PhoneEvent *)g_malloc(sizeof(PhoneEvent)); D_Bitmap *data = (D_Bitmap *)g_malloc(sizeof(D_Bitmap)); @@ -975,12 +961,15 @@ void SetLogoEvent(GtkWidget *widget) { /* above condition must be there, because if you launch logos before * callerGroups are available, you will see segfault - callerGroups not initialized */ - if (phoneMonitor.supported & PM_CALLERGROUP) { + if (GetModelFeature(FN_CALLERGROUPS)!=0) { for (i = 0;i < 6;i++) if (strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(callerCombo)->entry)), xgnokiiConfig.callerGroups[i]) == 0) bitmap.number = i; } } + if (bitmap.type == GSM_StartupLogo) { + bitmap.number=0; + } data->bitmap = &bitmap; e->event = Event_SetBitmap; @@ -1005,14 +994,14 @@ void SetLogoEvent(GtkWidget *widget) { static void ClearLogoEvent(GtkWidget *widget) { - // bitmap.size=bitmap.width*bitmap.height/8; + bitmap.size=bitmap.width*bitmap.height/8; GSM_ClearBitmap(&bitmap); UpdatePoints(widget); } -void InvertLogoEvent(GtkWidget *widget) { +static void InvertLogoEvent(GtkWidget *widget) { int column, row; for (column = 0;column < bitmap.width;column++) @@ -1025,12 +1014,12 @@ void InvertLogoEvent(GtkWidget *widget) { UpdatePoints(widget); } -void UpLogoEvent(GtkWidget *widget) { +static void UpLogoEvent(GtkWidget *widget) { int column, row; GSM_Bitmap tbitmap; - memcpy(&tbitmap,&bitmap,sizeof(GSM_Bitmap)); + tbitmap=bitmap; for (row = 0;row < bitmap.height-1;row++) for (column = 0;column < bitmap.width;column++) @@ -1041,19 +1030,19 @@ void UpLogoEvent(GtkWidget *widget) { for (column = 0;column < bitmap.width;column++) if (GSM_IsPointBitmap(&tbitmap,column,0)) - GSM_SetPointBitmap(&bitmap,column,bitmap.height-1); + GSM_SetPointBitmap(&bitmap,column,row); else - GSM_ClearPointBitmap(&bitmap,column,bitmap.height-1); + GSM_ClearPointBitmap(&bitmap,column,row); UpdatePoints(widget); } -void DownLogoEvent(GtkWidget *widget) { +static void DownLogoEvent(GtkWidget *widget) { int column, row; GSM_Bitmap tbitmap; - memcpy(&tbitmap,&bitmap,sizeof(GSM_Bitmap)); + tbitmap=bitmap; for (row = bitmap.height-1;row > 0;row--) for (column = 0;column < bitmap.width;column++) @@ -1071,12 +1060,12 @@ void DownLogoEvent(GtkWidget *widget) { UpdatePoints(widget); } -void LeftLogoEvent(GtkWidget *widget) { +static void LeftLogoEvent(GtkWidget *widget) { int column, row; GSM_Bitmap tbitmap; - memcpy(&tbitmap,&bitmap,sizeof(GSM_Bitmap)); + tbitmap=bitmap; for (column = 0; column < bitmap.width-1;column++) for (row = 0;row < bitmap.height;row++) @@ -1094,12 +1083,12 @@ void LeftLogoEvent(GtkWidget *widget) { UpdatePoints(widget); } -void RightLogoEvent(GtkWidget *widget) { +static void RightLogoEvent(GtkWidget *widget) { int column, row; GSM_Bitmap tbitmap; - memcpy(&tbitmap,&bitmap,sizeof(GSM_Bitmap)); + tbitmap=bitmap; for (column = bitmap.width-1;column > 0;column--) for (row = 0;row < bitmap.height;row++) @@ -1117,7 +1106,7 @@ void RightLogoEvent(GtkWidget *widget) { UpdatePoints(widget); } -void FlipVerticalLogoEvent(GtkWidget *widget) { +static void FlipVerticalLogoEvent(GtkWidget *widget) { int row, column, temp; for (row = 0;row < (bitmap.height/2);row++) @@ -1137,7 +1126,7 @@ void FlipVerticalLogoEvent(GtkWidget *widget) { UpdatePoints(widget); } -void FlipHorizontalLogoEvent(GtkWidget *widget) { +static void FlipHorizontalLogoEvent(GtkWidget *widget) { int row, column, temp; for (row = 0;row < bitmap.height;row++) @@ -1159,7 +1148,7 @@ void FlipHorizontalLogoEvent(GtkWidget *widget) { } /* this is launched when tool was changed */ -gint ToolTypeEvent(GtkWidget *widget) { +static gint ToolTypeEvent(GtkWidget *widget) { if (GTK_TOGGLE_BUTTON(buttonBrush)->active) activeTool = TOOL_BRUSH; else if (GTK_TOGGLE_BUTTON(buttonLine)->active) activeTool = TOOL_LINE; else if (GTK_TOGGLE_BUTTON(buttonRectangle)->active) activeTool = TOOL_RECTANGLE; else @@ -1170,33 +1159,53 @@ gint ToolTypeEvent(GtkWidget *widget) { } /* this is launched when logo type was change by buttons on toolbar */ -gint LogoTypeEvent(GtkWidget *widget) { +static gint LogoTypeEvent(GtkWidget *widget) { int clear = 0; /* is startupLogo? */ - /* Resize and clear anyway - CK */ - if (GTK_TOGGLE_BUTTON(buttonStartup)->active) { + if (GTK_TOGGLE_BUTTON(buttonStartup)->active && + bitmap.type != GSM_StartupLogo && bitmap.type != GSM_6210StartupLogo && + bitmap.type != GSM_7110StartupLogo) { /* look for old bitmap type, clean if another */ clear = 1; - GSM_ResizeBitmap(&bitmap,GSM_StartupLogo, &statemachine.Phone.Info); - } - - /* has phone support for callerGroups? */ - if (phoneMonitor.supported & PM_CALLERGROUP) { - if (GTK_TOGGLE_BUTTON(buttonCaller)->active && bitmap.type != GSM_CallerLogo) { - /* previous was startup? clear and draw batteries, signal, ... */ - /* Clear anyway for 7110...CK */ - clear = 1; - GSM_ResizeBitmap(&bitmap,GSM_CallerLogo, &statemachine.Phone.Info); + + if (!strcmp(xgnokiiConfig.model,"7110")) { + GSM_ResizeBitmap(&bitmap,GSM_7110StartupLogo); + } else if (!strcmp(xgnokiiConfig.model,"6210") || !strcmp(xgnokiiConfig.model,"6250")) { + GSM_ResizeBitmap(&bitmap,GSM_6210StartupLogo); + } else { + GSM_ResizeBitmap(&bitmap,GSM_StartupLogo); } } + + /* new type is PictureImage */ + if (GTK_TOGGLE_BUTTON(buttonPicture)->active && bitmap.type != GSM_PictureImage) { + /* look for old bitmap type, clean if another */ + clear = 1; + GSM_ResizeBitmap(&bitmap,GSM_PictureImage); + } + + /* new type is callerLogo */ + if (GTK_TOGGLE_BUTTON(buttonCaller)->active && bitmap.type != GSM_CallerLogo) { + /* previous was startup or Picture ? clear and draw batteries, signal, ... */ + if (bitmap.type != GSM_OperatorLogo) clear = 1; + GSM_ResizeBitmap(&bitmap,GSM_CallerLogo); + } /* is new type operatorLogo? */ - if (GTK_TOGGLE_BUTTON(buttonOperator)->active && bitmap.type != GSM_OperatorLogo) { - /* previous startup? clear and draw batteries, signal, ... */ - /* Clear anyway for 7110..CK */ - clear = 1; - GSM_ResizeBitmap(&bitmap,GSM_OperatorLogo, &statemachine.Phone.Info); + if (GTK_TOGGLE_BUTTON(buttonOperator)->active && bitmap.type != GSM_OperatorLogo && + bitmap.type != GSM_7110OperatorLogo) { + + /* previous startup or Picture ? clear and draw batteries, signal, ... */ + if (bitmap.type != GSM_CallerLogo) clear = 1; + + if (!strcmp(xgnokiiConfig.model,"7110")) { + GSM_ResizeBitmap(&bitmap,GSM_7110OperatorLogo); + } else if (!strcmp(xgnokiiConfig.model,"6210") || !strcmp(xgnokiiConfig.model,"6250")) { + GSM_ResizeBitmap(&bitmap,GSM_7110OperatorLogo); + } else { + GSM_ResizeBitmap(&bitmap,GSM_OperatorLogo); + } } /* must clear? */ @@ -1218,7 +1227,7 @@ gint LogoTypeEvent(GtkWidget *widget) { return 0; } -inline void CloseLogosWindow (void) { +static inline void CloseLogosWindow (void) { gtk_widget_hide(GUI_LogosWindow); } @@ -1288,7 +1297,7 @@ void ImportFileSelected(GtkWidget *w, GtkFileSelection *fs) gtk_widget_show(errorDialog.dialog); g_free(buf); return; - } else fclose(f); + } error=GSM_ReadBitmapFile(fileName,&tbitmap); if (error!=GE_NONE) { @@ -1304,19 +1313,42 @@ void ImportFileSelected(GtkWidget *w, GtkFileSelection *fs) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonStartup),false); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonOperator),false); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonCaller),false); - - if (tbitmap.type==GSM_OperatorLogo) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonOperator),true); - if (tbitmap.type==GSM_StartupLogo) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonStartup),true); + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonPicture),false); + + if (tbitmap.type==GSM_OperatorLogo || tbitmap.type==GSM_7110OperatorLogo) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonOperator),true); + if (tbitmap.type==GSM_StartupLogo || tbitmap.type==GSM_7110StartupLogo || tbitmap.type==GSM_6210StartupLogo) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonStartup),true); if (tbitmap.type==GSM_CallerLogo) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonCaller),true); + if (tbitmap.type==GSM_PictureImage) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(buttonPicture),true); memcpy(&bitmap,&tbitmap,sizeof(GSM_Bitmap)); + + if (!strcmp(xgnokiiConfig.model,"7110")) { //7110 + if (bitmap.type==GSM_StartupLogo || bitmap.type==GSM_6210StartupLogo) + GSM_ResizeBitmap(&bitmap,GSM_7110StartupLogo); + + if (bitmap.type==GSM_OperatorLogo) + GSM_ResizeBitmap(&bitmap,GSM_7110OperatorLogo); + + } else if (!strcmp(xgnokiiConfig.model,"6210") || !strcmp(xgnokiiConfig.model,"6250")) { //6210,6250 + if (bitmap.type==GSM_StartupLogo || bitmap.type==GSM_7110StartupLogo) + GSM_ResizeBitmap(&bitmap,GSM_6210StartupLogo); + + if (bitmap.type==GSM_OperatorLogo) + GSM_ResizeBitmap(&bitmap,GSM_7110OperatorLogo); + + } else { + if (bitmap.type==GSM_6210StartupLogo || bitmap.type==GSM_7110StartupLogo) + GSM_ResizeBitmap(&bitmap,GSM_StartupLogo); + if (bitmap.type==GSM_7110OperatorLogo) + GSM_ResizeBitmap(&bitmap,GSM_OperatorLogo); + } UpdatePoints(drawingArea); } void SaveLogoAs(GtkWidget *widget) { - FileSelection=gtk_file_selection_new (_("Save logo as ...")); + FileSelection=gtk_file_selection_new ("Save logo as ..."); gtk_signal_connect ( GTK_OBJECT (GTK_FILE_SELECTION (FileSelection)->ok_button), @@ -1343,7 +1375,7 @@ void SaveLogo(GtkWidget *widget) void OpenLogo(GtkWidget *widget) { - FileSelection=gtk_file_selection_new (_("Open logo...")); + FileSelection=gtk_file_selection_new ("Open logo..."); gtk_signal_connect ( GTK_OBJECT (GTK_FILE_SELECTION (FileSelection)->ok_button), @@ -1383,7 +1415,7 @@ static GtkItemFactoryEntry logosMenuItems[] = { { NULL, "V", FlipVerticalLogoEvent, 0, NULL}, }; -void InitLogosMenu (void) { +static void InitLogosMenu (void) { logosMenuItems[0].path = g_strdup(_("/_File")); logosMenuItems[1].path = g_strdup(_("/File/_Open")); logosMenuItems[2].path = g_strdup(_("/File/_Save")); @@ -1430,105 +1462,101 @@ void GUI_CreateLogosWindow (void) { /* realize top level window for logos */ GUI_LogosWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass(GTK_WINDOW(GUI_LogosWindow), "LogosWindow", "Xgnokii"); - gtk_window_set_policy(GTK_WINDOW(GUI_LogosWindow), 1, 1, 1); - gtk_window_set_title(GTK_WINDOW(GUI_LogosWindow), _("Logos")); - gtk_signal_connect(GTK_OBJECT(GUI_LogosWindow), "delete_event", - GTK_SIGNAL_FUNC(DeleteEvent), NULL); + gtk_window_set_policy(GTK_WINDOW(GUI_LogosWindow),1,1,1); + gtk_window_set_title(GTK_WINDOW(GUI_LogosWindow),_("Logos")); + gtk_signal_connect(GTK_OBJECT(GUI_LogosWindow),"delete_event", + GTK_SIGNAL_FUNC(DeleteEvent),NULL); gtk_widget_realize(GUI_LogosWindow); - CreateErrorDialog(&errorDialog, GUI_LogosWindow); - CreateInfoDialog(&infoDialog, GUI_LogosWindow); + CreateErrorDialog(&errorDialog,GUI_LogosWindow); + CreateInfoDialog(&infoDialog,GUI_LogosWindow); accelGroup = gtk_accel_group_new(); - gtk_accel_group_attach(accelGroup, GTK_OBJECT(GUI_LogosWindow)); + gtk_accel_group_attach(accelGroup,GTK_OBJECT(GUI_LogosWindow)); /* create main vbox */ - vbox = gtk_vbox_new(FALSE, 1); - gtk_container_add(GTK_CONTAINER(GUI_LogosWindow), vbox); + vbox = gtk_vbox_new(FALSE,1); + gtk_container_add(GTK_CONTAINER(GUI_LogosWindow),vbox); gtk_widget_show(vbox); - itemFactory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accelGroup); - gtk_item_factory_create_items(itemFactory, nMenuItems, logosMenuItems, NULL); - menuBar = gtk_item_factory_get_widget(itemFactory, "
"); + itemFactory = gtk_item_factory_new(GTK_TYPE_MENU_BAR,"
",accelGroup); + gtk_item_factory_create_items(itemFactory,nMenuItems,logosMenuItems,NULL); + menuBar = gtk_item_factory_get_widget(itemFactory,"
"); - gtk_box_pack_start(GTK_BOX(vbox), menuBar, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox),menuBar,FALSE,FALSE,0); gtk_widget_show(menuBar); /* toolbar */ - toolBar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS); - gtk_toolbar_set_button_relief(GTK_TOOLBAR(toolBar), GTK_RELIEF_NORMAL); - gtk_toolbar_set_style(GTK_TOOLBAR(toolBar), GTK_TOOLBAR_ICONS); + toolBar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_ICONS); + gtk_toolbar_set_button_relief(GTK_TOOLBAR(toolBar),GTK_RELIEF_NORMAL); + gtk_toolbar_set_style(GTK_TOOLBAR(toolBar),GTK_TOOLBAR_ICONS); - gtk_toolbar_append_item(GTK_TOOLBAR(toolBar), NULL, _("Clear logo"), NULL, - NewPixmap(New_xpm, GUI_LogosWindow->window, + gtk_toolbar_append_item(GTK_TOOLBAR(toolBar),NULL,"Clear logo",NULL, + NewPixmap(New_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc)ClearLogoEvent, toolBar); + (GtkSignalFunc)ClearLogoEvent,toolBar); gtk_toolbar_append_space(GTK_TOOLBAR(toolBar)); - gtk_toolbar_append_item(GTK_TOOLBAR(toolBar), NULL, _("Get logo"), NULL, - NewPixmap(Read_xpm, GUI_LogosWindow->window, + gtk_toolbar_append_item(GTK_TOOLBAR(toolBar),NULL,"Get logo",NULL, + NewPixmap(Read_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc)GetLogoEvent, toolBar); + (GtkSignalFunc)GetLogoEvent,toolBar); - gtk_toolbar_append_item(GTK_TOOLBAR(toolBar), NULL, _("Set logo"), NULL, - NewPixmap(Send_xpm, GUI_LogosWindow->window, + gtk_toolbar_append_item(GTK_TOOLBAR(toolBar),NULL,"Set logo",NULL, + NewPixmap(Send_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc)SetLogoEvent, toolBar); + (GtkSignalFunc)SetLogoEvent,toolBar); gtk_toolbar_append_space(GTK_TOOLBAR(toolBar)); - gtk_toolbar_append_item (GTK_TOOLBAR (toolBar), NULL, _("Import from file"), NULL, - NewPixmap(Open_xpm, GUI_LogosWindow->window, - &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) OpenLogo, NULL); - gtk_toolbar_append_item (GTK_TOOLBAR (toolBar), NULL, _("Export to file"), NULL, - NewPixmap(Save_xpm, GUI_LogosWindow->window, - &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc) SaveLogo, NULL); - - gtk_toolbar_append_space (GTK_TOOLBAR (toolBar)); - buttonStartup = gtk_toolbar_append_element(GTK_TOOLBAR(toolBar), - GTK_TOOLBAR_CHILD_RADIOBUTTON, NULL, NULL, _("Startup logo"), - "", NewPixmap(Startup_logo_xpm, GUI_LogosWindow->window, + GTK_TOOLBAR_CHILD_RADIOBUTTON,NULL,NULL,"Startup logo", + "",NewPixmap(Startup_logo_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(LogoTypeEvent), NULL); + GTK_SIGNAL_FUNC(LogoTypeEvent),NULL); buttonOperator = gtk_toolbar_append_element(GTK_TOOLBAR(toolBar), - GTK_TOOLBAR_CHILD_RADIOBUTTON, buttonStartup, NULL, _("Operator logo"), - "", NewPixmap(Operator_logo_xpm, GUI_LogosWindow->window, + GTK_TOOLBAR_CHILD_RADIOBUTTON,buttonStartup,NULL,"Operator logo", + "",NewPixmap(Operator_logo_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(LogoTypeEvent), NULL); + GTK_SIGNAL_FUNC(LogoTypeEvent),NULL); buttonCaller = gtk_toolbar_append_element(GTK_TOOLBAR(toolBar), GTK_TOOLBAR_CHILD_RADIOBUTTON, buttonOperator, - NULL, _("Caller logo"), - "", NewPixmap(Caller_logo_xpm, GUI_LogosWindow->window, + NULL,"Caller logo", + "",NewPixmap(Caller_logo_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(LogoTypeEvent), NULL); + GTK_SIGNAL_FUNC(LogoTypeEvent),NULL); + + buttonPicture = gtk_toolbar_append_element(GTK_TOOLBAR(toolBar), + GTK_TOOLBAR_CHILD_RADIOBUTTON, + buttonOperator, + NULL,"Picture image", + "",NewPixmap(Caller_logo_xpm,GUI_LogosWindow->window, + &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), + GTK_SIGNAL_FUNC(LogoTypeEvent),NULL); gtk_toolbar_append_space(GTK_TOOLBAR(toolBar)); networkCombo = gtk_combo_new(); - gtk_combo_set_use_arrows_always(GTK_COMBO(networkCombo), 1); - while (strcmp(GSM_Networks[i].Name, "unknown")) - glistNetwork = g_list_insert_sorted(glistNetwork, GSM_Networks[i++].Name, + gtk_combo_set_use_arrows_always(GTK_COMBO(networkCombo),1); + while (strcmp(GSM_Networks[i].Name,"unknown")) + glistNetwork = g_list_insert_sorted(glistNetwork,GSM_Networks[i++].Name, (GCompareFunc)strcmp); - gtk_combo_set_popdown_strings(GTK_COMBO(networkCombo), glistNetwork); - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(networkCombo)->entry), FALSE); - gtk_toolbar_append_widget(GTK_TOOLBAR(toolBar), networkCombo, "", ""); + gtk_combo_set_popdown_strings(GTK_COMBO(networkCombo),glistNetwork); + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(networkCombo)->entry),FALSE); + gtk_toolbar_append_widget(GTK_TOOLBAR(toolBar),networkCombo,"",""); gtk_widget_show(networkCombo); g_list_free(glistNetwork); callerCombo = gtk_combo_new(); - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(callerCombo)->entry), FALSE); - gtk_toolbar_append_widget(GTK_TOOLBAR(toolBar), callerCombo, "", ""); + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(callerCombo)->entry),FALSE); + gtk_toolbar_append_widget(GTK_TOOLBAR(toolBar),callerCombo,"",""); gtk_widget_show(callerCombo); - gtk_box_pack_start(GTK_BOX(vbox), toolBar, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox),toolBar,FALSE,FALSE,0); gtk_widget_show(toolBar); /* vertical separator */ @@ -1543,10 +1571,17 @@ void GUI_CreateLogosWindow (void) { /* set GSM_Bitmap width,height needed for creating drawinArea * we are starting, default is startupLogo */ - bitmap.type = GSM_StartupLogo; - bitmap.height = 48; - bitmap.width = 84; + bitmap.type = GSM_7110StartupLogo; + bitmap.height = 65; + bitmap.width = 96; bitmap.size = bitmap.height * bitmap.width / 8; + if (!strcmp(xgnokiiConfig.model,"7110")) { //7110 + GSM_ResizeBitmap(&bitmap,GSM_7110StartupLogo); + } else if (!strcmp(xgnokiiConfig.model,"6210") || !strcmp(xgnokiiConfig.model,"6250")) { //6210,6250 + GSM_ResizeBitmap(&bitmap,GSM_6210StartupLogo); + } else { + GSM_ResizeBitmap(&bitmap,GSM_StartupLogo); + } drawingAreaWidth = bitmap.width * (POINTSIZE+1)+1; drawingAreaHeight = bitmap.height * (POINTSIZE+1)+1; @@ -1617,47 +1652,47 @@ void GUI_CreateLogosWindow (void) { gtk_toolbar_set_style(GTK_TOOLBAR(vertToolBar),GTK_TOOLBAR_ICONS); buttonBrush = gtk_toolbar_append_element(GTK_TOOLBAR(vertToolBar), - GTK_TOOLBAR_CHILD_RADIOBUTTON, NULL, NULL, _("Brush tool"), - "", NewPixmap(Tool_brush_xpm, GUI_LogosWindow->window, + GTK_TOOLBAR_CHILD_RADIOBUTTON,NULL,NULL,"Brush tool", + "",NewPixmap(Tool_brush_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(ToolTypeEvent), NULL); + GTK_SIGNAL_FUNC(ToolTypeEvent),NULL); buttonLine = gtk_toolbar_append_element(GTK_TOOLBAR(vertToolBar), - GTK_TOOLBAR_CHILD_RADIOBUTTON, buttonBrush, NULL, _("Line tool"), - "", NewPixmap(Tool_line_xpm, GUI_LogosWindow->window, + GTK_TOOLBAR_CHILD_RADIOBUTTON,buttonBrush,NULL,"Line tool", + "",NewPixmap(Tool_line_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(ToolTypeEvent), NULL); + GTK_SIGNAL_FUNC(ToolTypeEvent),NULL); buttonRectangle = gtk_toolbar_append_element(GTK_TOOLBAR(vertToolBar), - GTK_TOOLBAR_CHILD_RADIOBUTTON, buttonLine, NULL, _("Rectangle tool"), - "", NewPixmap(Tool_rectangle_xpm, GUI_LogosWindow->window, + GTK_TOOLBAR_CHILD_RADIOBUTTON,buttonLine,NULL,"Rectangle tool", + "",NewPixmap(Tool_rectangle_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(ToolTypeEvent), NULL); + GTK_SIGNAL_FUNC(ToolTypeEvent),NULL); buttonFilledRectangle = gtk_toolbar_append_element(GTK_TOOLBAR(vertToolBar), - GTK_TOOLBAR_CHILD_RADIOBUTTON, buttonRectangle, NULL, - _("Filled rectangle tool"), - "", NewPixmap(Tool_filled_rectangle_xpm, + GTK_TOOLBAR_CHILD_RADIOBUTTON,buttonRectangle,NULL, + "Filled rectangle tool", + "",NewPixmap(Tool_filled_rectangle_xpm, GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - GTK_SIGNAL_FUNC(ToolTypeEvent), NULL); + GTK_SIGNAL_FUNC(ToolTypeEvent),NULL); gtk_toolbar_append_space(GTK_TOOLBAR(vertToolBar)); - gtk_toolbar_append_item(GTK_TOOLBAR(vertToolBar), NULL, _("Invert logo"), NULL, - NewPixmap(Edit_invert_xpm, GUI_LogosWindow->window, + gtk_toolbar_append_item(GTK_TOOLBAR(vertToolBar),NULL,"Invert logo",NULL, + NewPixmap(Edit_invert_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc)InvertLogoEvent, vertToolBar); + (GtkSignalFunc)InvertLogoEvent,vertToolBar); - gtk_toolbar_append_item(GTK_TOOLBAR(vertToolBar), NULL, _("Horizontal flip"), NULL, - NewPixmap(Edit_flip_horizontal_xpm, GUI_LogosWindow->window, + gtk_toolbar_append_item(GTK_TOOLBAR(vertToolBar),NULL,"Horizontal flip",NULL, + NewPixmap(Edit_flip_horizontal_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc)FlipHorizontalLogoEvent, vertToolBar); + (GtkSignalFunc)FlipHorizontalLogoEvent,vertToolBar); - gtk_toolbar_append_item(GTK_TOOLBAR(vertToolBar), NULL, _("Vertical flip"), NULL, - NewPixmap(Edit_flip_vertical_xpm, GUI_LogosWindow->window, + gtk_toolbar_append_item(GTK_TOOLBAR(vertToolBar),NULL,"Vertical flip",NULL, + NewPixmap(Edit_flip_vertical_xpm,GUI_LogosWindow->window, &GUI_LogosWindow->style->bg[GTK_STATE_NORMAL]), - (GtkSignalFunc)FlipVerticalLogoEvent, vertToolBar); + (GtkSignalFunc)FlipVerticalLogoEvent,vertToolBar); gtk_box_pack_start(GTK_BOX(hbox),vertToolBar,FALSE,FALSE,0); @@ -1680,26 +1715,17 @@ void GUI_RefreshLogosGroupsCombo (void) { } void GUI_ShowLogosWindow (void) { - /* Set network name taken from the phone */ - GetNetworkInfoEvent(NULL); - /* if phone support caller groups, read callerGroups names */ - if (phoneMonitor.supported & PM_CALLERGROUP) { - if (xgnokiiConfig.callerGroups[0] == NULL) { - GUI_Refresh(); - GUI_InitCallerGroupsInf (); - } - if (!callersGroupsInitialized) GUI_RefreshLogosGroupsCombo (); - gtk_widget_show(buttonCaller); - gtk_widget_show(callerCombo); - } else { - /* if not supported, hide widget for handling callerGroups */ - gtk_widget_hide(buttonCaller); - gtk_widget_hide(callerCombo); - } - /* Call to reset Startup logo size */ - LogoTypeEvent(GUI_LogosWindow); + gtk_widget_show(buttonCaller); + gtk_widget_show(callerCombo); + + if (xgnokiiConfig.callerGroups[0] == NULL) { + GUI_Refresh(); + GUI_InitCallerGroupsInf (); + } + if (!callersGroupsInitialized) GUI_RefreshLogosGroupsCombo (); + gtk_widget_show(GUI_LogosWindow); if (!previewAvailable && showPreviewErrorDialog) { diff --git a/xgnokii/xgnokii_lowlevel.c b/xgnokii/xgnokii_lowlevel.c index a606d73..78a9ba4 100644 --- a/xgnokii/xgnokii_lowlevel.c +++ b/xgnokii/xgnokii_lowlevel.c @@ -1,12 +1,8 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. @@ -16,15 +12,10 @@ #include #include #include -#include "misc.h" -#include "gsm-common.h" #include "gsm-api.h" -//#include "6110.h" -//#include "fbus-3810.h" #include "xgnokii_lowlevel.h" #include "xgnokii.h" -#include "gsm-statemachine.h" -//#include "xgnokii_common.h" +#include "xgnokii_common.h" pthread_t monitor_th; PhoneMonitor phoneMonitor; @@ -54,13 +45,13 @@ pthread_cond_t getNetworkInfoCond; static pthread_mutex_t eventsMutex; static GSList *ScheduledEvents = NULL; -static GSM_Statemachine statemachine; -/* FIXME - don't really know what should own the statemachine in */ -/* the xgnokii scheme of things - Chris */ - inline void GUI_InsertEvent (PhoneEvent *event) { + while (phoneMonitor.working) { + usleep(1); + } + # ifdef XDEBUG g_print ("Inserting Event: %d\n", event->event); # endif @@ -94,27 +85,21 @@ static void InitModelInf (void) gchar buf[64]; GSM_Error error; register gint i = 0; - GSM_Data data; - GSM_DataClear(&data); - data.Model=buf; - while ((error = SM_Functions(GOP_GetModel,&data,&statemachine)) != GE_NONE && i++ < 15) + while ((error = GSM->GetModel(buf)) != GE_NONE && i++ < 15) sleep(1); if (error == GE_NONE) { g_free (phoneMonitor.phone.model); phoneMonitor.phone.version = g_strdup (buf); - phoneMonitor.phone.model = GetModel (buf); + phoneMonitor.phone.model = GetModelName (buf); if (phoneMonitor.phone.model == NULL) phoneMonitor.phone.model = g_strdup (_("unknown")); - - phoneMonitor.supported = GetPhoneModel(buf)->flags; } i = 0; - data.Revision=buf; - while ((error = SM_Functions(GOP_GetRevision,&data,&statemachine)) != GE_NONE && i++ < 5) + while ((error = GSM->GetRevision (buf)) != GE_NONE && i++ < 5) sleep(1); if (error == GE_NONE) @@ -124,8 +109,7 @@ static void InitModelInf (void) } i = 0; - data.Imei=buf; - while ((error = SM_Functions(GOP_GetImei,&data,&statemachine)) != GE_NONE && i++ < 5) + while ((error = GSM->GetIMEI (buf)) != GE_NONE && i++ < 5) sleep(1); if (error == GE_NONE) @@ -143,24 +127,23 @@ static void InitModelInf (void) #endif } - static GSM_Error fbusinit(bool enable_monitoring) { int count=0; static GSM_Error error=GE_NOLINK; - GSM_ConnectionType connection=GCT_Serial; - - if (!strcmp(xgnokiiConfig.connection, "infrared")) - connection = GCT_Infrared; - if (!strcmp(xgnokiiConfig.connection, "irda")) - connection = GCT_Irda; +#ifndef WIN32 + if (strcmp(GetMygnokiiVersion(),VERSION)!=0) + fprintf(stderr,_("WARNING: version of installed libmygnokii.so (%s) is different to version of xgnokii (%s)\n"),GetMygnokiiVersion(),VERSION); +#endif /* Initialise the code for the GSM interface. */ - if (error == GE_NOLINK) error = GSM_Initialise (xgnokiiConfig.model, xgnokiiConfig.port, - xgnokiiConfig.initlength, connection, RLP_DisplayF96Frame, &statemachine); + xgnokiiConfig.initlength, + GetConnectionTypeFromString(xgnokiiConfig.connection), + RLP_DisplayF96Frame, + xgnokiiConfig.synchronizetime); #ifdef XDEBUG g_print ("fbusinit: error %d\n", error); @@ -191,12 +174,11 @@ void GUI_InitPhoneMonitor (void) phoneMonitor.phone.version = phoneMonitor.phone.model; phoneMonitor.phone.revision = g_strdup (_("unknown")); phoneMonitor.phone.imei = g_strdup (_("unknown")); - phoneMonitor.supported = 0; phoneMonitor.rfLevel = phoneMonitor.batteryLevel = -1; phoneMonitor.powerSource = GPS_BATTERY; - phoneMonitor.working = NULL; + phoneMonitor.working = FALSE; phoneMonitor.alarm = FALSE; - phoneMonitor.sms.unRead = phoneMonitor.sms.number = 0; + phoneMonitor.sms.unRead = phoneMonitor.sms.number = phoneMonitor.sms.number2 = 0; phoneMonitor.sms.messages = NULL; phoneMonitor.call.callInProgress = CS_Idle; *phoneMonitor.call.callNum = '\0'; @@ -246,7 +228,7 @@ static inline void FreeArray (GSList **array) } -static void RefreshSMS (const gint number) +void RefreshSMS (const gint number) { GSM_Error error; GSM_SMSMessage *msg; @@ -259,36 +241,49 @@ static void RefreshSMS (const gint number) pthread_mutex_lock (&smsMutex); FreeArray (&(phoneMonitor.sms.messages)); phoneMonitor.sms.number = 0; + phoneMonitor.sms.number2 = 0; pthread_mutex_unlock (&smsMutex); - i = 0; + i = 1; while (1) { - GSM_Data gdat; - GSM_DataClear(&gdat); msg = g_malloc (sizeof (GSM_SMSMessage)); msg->MemoryType = GMT_SM; - msg->Number = ++i; - gdat.SMSMessage = msg; - - if ((error = SM_Functions(GOP_GetSMS, &gdat, &statemachine)) == GE_NONE) - { - pthread_mutex_lock (&smsMutex); - phoneMonitor.sms.messages = g_slist_append (phoneMonitor.sms.messages, msg); - phoneMonitor.sms.number++; - pthread_mutex_unlock (&smsMutex); - if (phoneMonitor.sms.number == number) - return; - } - else if (error == GE_INVALIDSMSLOCATION) /* All positions are readed */ - { - g_free (msg); - break; + msg->Location = i; +#ifdef XDEBUG + fprintf(stdout, _("test: %d %i %i %i\n"),msg->Location,phoneMonitor.sms.number,phoneMonitor.sms.number2,number); +#endif + pthread_mutex_lock (&smsMutex); + if( GetModelFeature(FN_SMS)==F_SMS71 ) msg->Location = 0; /* read next sms for 6210/7110 */ + error = GSM->GetSMSMessage (msg); + pthread_mutex_unlock (&smsMutex); + switch (error) { + case GE_NONE: + pthread_mutex_lock (&smsMutex); +#ifdef XDEBUG + fprintf(stdout, _("Refresh SMS: g_slist_append: sms message")); + fprintf(stdout, _(" Location: %d"),msg->Location); + fprintf(stdout, _(" folder: %d"),msg->folder); + if ( msg-> SMSData) fprintf(stdout, _(" SMSData true\n")); + else fprintf(stdout, _(" SMSData false\n")); +#endif + /* RTH: unread sms from folder 0 to INBOX */ + phoneMonitor.sms.messages = g_slist_append (phoneMonitor.sms.messages, msg); + phoneMonitor.sms.number++; + phoneMonitor.sms.number2++; + pthread_mutex_unlock (&smsMutex); + if (phoneMonitor.sms.number2 == number) return; + break; + case GE_SMSTOOLONG: /* Picture Image in 7110 comp phone */ + g_free (msg); + phoneMonitor.sms.number2++; + if (phoneMonitor.sms.number2 == number) return; + break; + default: + g_free (msg); + break; } - else - g_free (msg); - - usleep (750000); + i++; } } @@ -297,16 +292,13 @@ static gint A_GetMemoryStatus (gpointer data) { GSM_Error error; D_MemoryStatus *ms = (D_MemoryStatus *) data; - GSM_Data gdat; error = ms->status = GE_UNKNOWN; if (ms) { - GSM_DataClear(&gdat); pthread_mutex_lock (&memoryMutex); - gdat.MemoryStatus=&(ms->memoryStatus); - error = ms->status = SM_Functions(GOP_GetMemoryStatus,&gdat,&statemachine); + error = ms->status = GSM->GetMemoryStatus (&(ms->memoryStatus)); pthread_cond_signal (&memoryCond); pthread_mutex_unlock (&memoryMutex); } @@ -319,16 +311,13 @@ static gint A_GetMemoryLocation (gpointer data) { GSM_Error error; D_MemoryLocation *ml = (D_MemoryLocation *) data; - GSM_Data gdat; error = ml->status = GE_UNKNOWN; if (ml) { - GSM_DataClear(&gdat); pthread_mutex_lock (&memoryMutex); - gdat.PhonebookEntry=(ml->entry); - error = ml->status = SM_Functions(GOP_ReadPhonebook,&gdat,&statemachine); + error = ml->status = GSM->GetMemoryLocation (ml->entry); pthread_cond_signal (&memoryCond); pthread_mutex_unlock (&memoryMutex); } @@ -343,51 +332,46 @@ static gint A_GetMemoryLocationAll (gpointer data) GSM_Error error; D_MemoryLocationAll *mla = (D_MemoryLocationAll *) data; register gint i; - GSM_Data gdat; + gint readed=0; error = mla->status = GE_NONE; entry.MemoryType = mla->type; - GSM_DataClear(&gdat); - gdat.PhonebookEntry=&entry; pthread_mutex_lock (&memoryMutex); for (i = mla->min; i <= mla->max; i++) { entry.Location = i; - error = SM_Functions(GOP_ReadPhonebook,&gdat,&statemachine); - if (error != GE_NONE && error!=GE_INVALIDPHBOOKLOCATION) - { - gint err_count = 0; - - while (error != GE_NONE) + if (readedused) { + error = GSM->GetMemoryLocation (&entry); + if (error != GE_NONE) { - g_print (_("%s: line %d: Can't get memory entry number %d from memory %d! %d\n"), - __FILE__, __LINE__, i, entry.MemoryType, error); - if (err_count++ > 3) + gint err_count = 0; + + while (error != GE_NONE && + error != GE_INVALIDPHBOOKLOCATION && error != GE_UNKNOWN) //n7110.c { - mla->ReadFailed (i); - mla->status = error; - pthread_cond_signal (&memoryCond); - pthread_mutex_unlock (&memoryMutex); - return (error); + g_print (_("%s: line %d: Can't get memory entry number %d from memory %d! %d\n"), + __FILE__, __LINE__, i, entry.MemoryType, error); + if (err_count++ > 3) + { + mla->ReadFailed (i); + mla->status = error; + pthread_cond_signal (&memoryCond); + pthread_mutex_unlock (&memoryMutex); + return (error); + } + + error = GSM->GetMemoryLocation (&entry); + sleep (2); } - - error = SM_Functions(GOP_ReadPhonebook,&gdat,&statemachine); - sleep (2); } - } + + if (strcmp(entry.Number, "\0") || strcmp(entry.Name, "\0")) + readed++; - /* If the phonebook location was invalid - just fill up the rest */ - /* This works on a 7110 anyway...*/ - - if (error==GE_INVALIDPHBOOKLOCATION) { - entry.Empty=true; - entry.Name[0]=0; - entry.Number[0]=0; - for (i = mla->min; i <= mla->max; i++) { - error = mla->InsertEntry (&entry); - if (error != GE_NONE) break; - } + } else { + entry.Number[0]='\0'; + entry.Name[0]='\0'; } error = mla->InsertEntry (&entry); @@ -405,17 +389,13 @@ static gint A_WriteMemoryLocation (gpointer data) { GSM_Error error; D_MemoryLocation *ml = (D_MemoryLocation *) data; - GSM_Data gdat; error = ml->status = GE_UNKNOWN; - GSM_DataClear(&gdat); - gdat.PhonebookEntry=(ml->entry); - if (ml) { pthread_mutex_lock (&memoryMutex); - error = ml->status = SM_Functions(GOP_WritePhonebook,&gdat,&statemachine); + error = ml->status = GSM->WritePhonebookLocation (ml->entry); pthread_cond_signal (&memoryCond); pthread_mutex_unlock (&memoryMutex); } @@ -517,7 +497,6 @@ static gint A_GetCalendarNoteAll (gpointer data) return (e); } - static gint A_WriteCalendarNote (gpointer data) { GSM_Error error; @@ -556,7 +535,6 @@ static gint A_GetCallerGroup (gpointer data) GSM_Bitmap bitmap; GSM_Error error; D_CallerGroup *cg = (D_CallerGroup *) data; - GSM_Data gdat; error = cg->status = GE_UNKNOWN; @@ -566,9 +544,7 @@ static gint A_GetCallerGroup (gpointer data) bitmap.number = cg->number; pthread_mutex_lock (&callerGroupMutex); - GSM_DataClear(&gdat); - gdat.Bitmap=&bitmap; - error = cg->status = SM_Functions(GOP_GetBitmap,&gdat,&statemachine); + error = cg->status = GSM->GetBitmap (&bitmap); strncpy (cg->text, bitmap.text, 256); cg->text[255] = '\0'; pthread_cond_signal (&callerGroupCond); @@ -648,7 +624,7 @@ static gint A_SendSMSMessage (gpointer data) if (d) { pthread_mutex_lock (&sendSMSMutex); - error = d->status = GSM->SendSMSMessage (d->sms, 0); + error = d->status = GSM->SendSMSMessage (d->sms); pthread_cond_signal (&sendSMSCond); pthread_mutex_unlock (&sendSMSMutex); } @@ -667,10 +643,7 @@ static gint A_DeleteSMSMessage (gpointer data) if (sms) { - GSM_Data gdat; - GSM_DataClear(&gdat); - gdat.SMSMessage = sms; - error = SM_Functions(GOP_DeleteSMS, &gdat, &statemachine); + error = GSM->DeleteSMSMessage(sms); g_free (sms); } @@ -780,11 +753,10 @@ static gint A_GetAlarm (gpointer data) D_Alarm *a = (D_Alarm *) data; GSM_Error error; - error = GE_UNKNOWN; + error = a->status = GE_UNKNOWN; if (a) { - a->status = GE_UNKNOWN; pthread_mutex_lock (&alarmMutex); error = a->status = GSM->GetAlarm (0, &(a->time)); pthread_cond_signal (&alarmCond); @@ -814,14 +786,13 @@ static gint A_SetAlarm (gpointer data) static gint A_SendKeyStroke (gpointer data) { - /* gchar *buf = (gchar *) data;*/ + gchar *buf = (gchar *) data; - /* This is wrong. FIX IT */ - /* if (buf) + if (buf) { - FB61_TX_SendMessage(0x07, 0x0c, buf); + GSM->PressKey(buf[1], buf[0]); g_free (buf); - }*/ + } return (0); } @@ -829,12 +800,9 @@ static gint A_SendKeyStroke (gpointer data) static gint A_GetBitmap(gpointer data) { GSM_Error error; D_Bitmap *d = (D_Bitmap *)data; - GSM_Data gdat; - GSM_DataClear(&gdat); pthread_mutex_lock(&getBitmapMutex); - gdat.Bitmap=d->bitmap; - error = d->status = SM_Functions(GOP_GetBitmap,&gdat,&statemachine); + error = d->status = GSM->GetBitmap(d->bitmap); pthread_cond_signal(&getBitmapCond); pthread_mutex_unlock(&getBitmapMutex); return error; @@ -844,24 +812,19 @@ static gint A_SetBitmap(gpointer data) { GSM_Error error; D_Bitmap *d = (D_Bitmap *)data; GSM_Bitmap bitmap; - GSM_Data gdat; - GSM_DataClear(&gdat); pthread_mutex_lock(&setBitmapMutex); if (d->bitmap->type == GSM_CallerLogo) { bitmap.type = d->bitmap->type; bitmap.number = d->bitmap->number; - gdat.Bitmap=&bitmap; - error = d->status = SM_Functions(GOP_GetBitmap,&gdat,&statemachine); + error = d->status = GSM->GetBitmap(&bitmap); if (error == GE_NONE) { strncpy(d->bitmap->text,bitmap.text,sizeof(bitmap.text)); d->bitmap->ringtone = bitmap.ringtone; - gdat.Bitmap=d->bitmap; - error = d->status = SM_Functions(GOP_SetBitmap,&gdat,&statemachine); + error = d->status = GSM->SetBitmap(d->bitmap); } } else { - gdat.Bitmap=d->bitmap; - error = d->status = SM_Functions(GOP_SetBitmap,&gdat,&statemachine); + error = d->status = GSM->SetBitmap(d->bitmap); } pthread_cond_signal(&setBitmapCond); pthread_mutex_unlock(&setBitmapMutex); @@ -871,13 +834,9 @@ static gint A_SetBitmap(gpointer data) { static gint A_GetNetworkInfo(gpointer data) { GSM_Error error; D_NetworkInfo *d = (D_NetworkInfo *)data; - GSM_Data gdat; - - GSM_DataClear(&gdat); pthread_mutex_lock(&getNetworkInfoMutex); - gdat.NetworkInfo=d->info; - error = d->status = SM_Functions(GOP_GetNetworkInfo,&gdat,&statemachine); + error = d->status = GSM->GetNetworkInfo(d->info); pthread_cond_signal(&getNetworkInfoCond); pthread_mutex_unlock(&getNetworkInfoMutex); return error; @@ -921,22 +880,18 @@ gint (*DoAction[])(gpointer) = { A_Exit }; - void *GUI_Connect (void *a) { /* Define required unit types for RF and Battery level meters. */ - GSM_RFUnits rf_units = GRF_Percentage; - GSM_BatteryUnits batt_units = GBU_Percentage; + GSM_RFUnits rf_units = GRF_Arbitrary; + GSM_BatteryUnits batt_units = GBU_Arbitrary; GSM_DateTime Alarm; - GSM_SMSMemoryStatus SMSStatus = {0, 0}; gchar number[INCALL_NUMBER_LENGTH]; - PhoneEvent *event; + PhoneEvent *event=NULL; GSM_Error error; gint status; - GSM_Data data; - GSM_DataClear(&data); # ifdef XDEBUG g_print ("Initializing connection...\n"); @@ -950,104 +905,86 @@ void *GUI_Connect (void *a) g_print ("Phone connected. Starting monitoring...\n"); # endif - sleep(1); - - data.RFLevel=&phoneMonitor.rfLevel; - data.RFUnits=&rf_units; - data.PowerSource=&phoneMonitor.powerSource; - data.BatteryUnits=&batt_units; - data.BatteryLevel=&phoneMonitor.batteryLevel; - data.DateTime=&Alarm; - data.SMSStatus=&SMSStatus; - data.IncomingCallNr=number; - while (1) { - phoneMonitor.working = NULL; - - /* FIXME - this loop goes mad on my 7110 - so I've put in a usleep */ - usleep(50000); - - if (SM_Functions(GOP_GetRFLevel,&data,&statemachine) != GE_NONE) - phoneMonitor.rfLevel = -1; + if (event != NULL) { + phoneMonitor.working = _("Working..."); + } else { + phoneMonitor.working = NULL; - if (rf_units == GRF_Arbitrary) - phoneMonitor.rfLevel *= 25; + if (GSM->GetRFLevel (&rf_units, &phoneMonitor.rfLevel) != GE_NONE) + phoneMonitor.rfLevel = -1; - if (SM_Functions(GOP_GetPowersource,&data,&statemachine) == GE_NONE - && phoneMonitor.powerSource == GPS_ACDC) - phoneMonitor.batteryLevel = ((gint) phoneMonitor.batteryLevel + 25) % 125; - else - { - if (SM_Functions(GOP_GetBatteryLevel,&data,&statemachine) != GE_NONE) - phoneMonitor.batteryLevel = -1; - if (batt_units == GBU_Arbitrary) - phoneMonitor.batteryLevel *= 25; - } + if (rf_units == GRF_Arbitrary) + phoneMonitor.rfLevel *= 25; - if (SM_Functions(GOP_GetAlarm,&data,&statemachine) == GE_NONE && Alarm.AlarmEnabled != 0) - phoneMonitor.alarm = TRUE; - else - phoneMonitor.alarm = FALSE; - - if (SM_Functions(GOP_GetSMSStatus,&data,&statemachine) == GE_NONE) - { - if (phoneMonitor.sms.unRead != SMSStatus.Unread || - phoneMonitor.sms.number != SMSStatus.Number) + if (GSM->GetPowerSource (&phoneMonitor.powerSource) == GE_NONE + && phoneMonitor.powerSource == GPS_ACDC) + phoneMonitor.batteryLevel = ((gint) phoneMonitor.batteryLevel + 25) % 125; + else { - phoneMonitor.working = _("Refreshing SMSes..."); - RefreshSMS (SMSStatus.Number); - phoneMonitor.working = NULL; + if (GSM->GetBatteryLevel (&batt_units, &phoneMonitor.batteryLevel) != GE_NONE) + phoneMonitor.batteryLevel = -1; + if (batt_units == GBU_Arbitrary) + phoneMonitor.batteryLevel *= 25; } - phoneMonitor.sms.unRead = SMSStatus.Unread; - } + if (GSM->GetAlarm (0, &Alarm) == GE_NONE && Alarm.IsSet != 0) + phoneMonitor.alarm = TRUE; + else + phoneMonitor.alarm = FALSE; - if (SM_Functions(GOP_GetIncomingCallNr,&data,&statemachine) == GE_NONE) - { + if (GSM->GetIncomingCallNr (number) == GE_NONE) + { # ifdef XDEBUG - g_print ("Call in progress: %s\n", phoneMonitor.call.callNum); + g_print ("Call in progress: %s\n", phoneMonitor.call.callNum); # endif - GSM->GetDisplayStatus (&status); - if (status & (1<GetDisplayStatus (&status)==GE_NONE) { + if (status & (1<NetMonitor (phoneMonitor.netmonitor.number, - phoneMonitor.netmonitor.screen); - GSM->NetMonitor (3, phoneMonitor.netmonitor.screen3); - GSM->NetMonitor (4, phoneMonitor.netmonitor.screen4); - GSM->NetMonitor (5, phoneMonitor.netmonitor.screen5); - } - else - { - *phoneMonitor.netmonitor.screen = *phoneMonitor.netmonitor.screen3 = - *phoneMonitor.netmonitor.screen4 = *phoneMonitor.netmonitor.screen5 = '\0'; + pthread_mutex_lock (&netMonMutex); + if (phoneMonitor.netmonitor.number) + { + GSM->NetMonitor (phoneMonitor.netmonitor.number, + phoneMonitor.netmonitor.screen); + GSM->NetMonitor (3, phoneMonitor.netmonitor.screen3); + GSM->NetMonitor (4, phoneMonitor.netmonitor.screen4); + GSM->NetMonitor (5, phoneMonitor.netmonitor.screen5); + } + else + { + *phoneMonitor.netmonitor.screen = *phoneMonitor.netmonitor.screen3 = + *phoneMonitor.netmonitor.screen4 = *phoneMonitor.netmonitor.screen5 = '\0'; + } + pthread_mutex_unlock (&netMonMutex); } - pthread_mutex_unlock (&netMonMutex); - while ((event = RemoveEvent ()) != NULL) { # ifdef XDEBUG diff --git a/xgnokii/xgnokii_lowlevel.h b/xgnokii/xgnokii_lowlevel.h index bf49e28..44201fd 100644 --- a/xgnokii/xgnokii_lowlevel.h +++ b/xgnokii/xgnokii_lowlevel.h @@ -1,12 +1,8 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. @@ -17,7 +13,7 @@ #include #include -#include "gsm-common.h" +#include "gsm-api.h" #define INCALL_NUMBER_LENGTH 20 #define NETMON_SCREEN_LENGTH 60 @@ -75,7 +71,7 @@ typedef struct { } D_SMSMessage; typedef struct { - SMS_MessageCenter *center; + GSM_MessageCenter *center; GSM_Error status; } D_SMSCenter; @@ -103,6 +99,7 @@ typedef struct { typedef struct { gint min; gint max; + gint used; GSM_MemoryType type; gint status; gint (*InsertEntry)(GSM_PhonebookEntry *); @@ -145,6 +142,7 @@ typedef struct { struct { gint unRead; gint number; + gint number2; GSList *messages; } sms; struct { @@ -158,7 +156,6 @@ typedef struct { gchar screen4[NETMON_SCREEN_LENGTH]; gchar screen5[NETMON_SCREEN_LENGTH]; } netmonitor; - gint supported; } PhoneMonitor; extern pthread_t monitor_th; @@ -190,4 +187,6 @@ extern void GUI_InitPhoneMonitor (void); extern void *GUI_Connect (void *a); extern void GUI_InsertEvent (PhoneEvent *event); +extern void RefreshSMS (const gint number); + #endif diff --git a/xgnokii/xgnokii_netmon.c b/xgnokii/xgnokii_netmon.c index 53b846d..30a7be0 100644 --- a/xgnokii/xgnokii_netmon.c +++ b/xgnokii/xgnokii_netmon.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Sun Apr 30 2000 - Modified by Jan Derfinak - */ #ifndef WIN32 @@ -35,7 +30,7 @@ static GtkWidget *tableProgress[7]; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/windows/netmon/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/netmon/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } @@ -314,7 +309,6 @@ void GUI_CreateNetmonWindow () InitMainMenu (); GUI_NetmonWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_NetmonWindow), "NetmonWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_NetmonWindow), _("Net Monitor")); //gtk_widget_set_usize (GTK_WIDGET (GUI_NetmonWindow), 436, 220); gtk_signal_connect (GTK_OBJECT (GUI_NetmonWindow), "delete_event", diff --git a/xgnokii/xgnokii_netmon.h b/xgnokii/xgnokii_netmon.h index f3c57b9..c226f13 100644 --- a/xgnokii/xgnokii_netmon.h +++ b/xgnokii/xgnokii_netmon.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Tue Nov 16 1999 - Modified by Jan Derfinak - */ #ifndef XGNOKII_NETMON_H diff --git a/xgnokii/xgnokii_sms.c b/xgnokii/xgnokii_sms.c index b310434..d5da1f4 100644 --- a/xgnokii/xgnokii_sms.c +++ b/xgnokii/xgnokii_sms.c @@ -1,12 +1,8 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. @@ -23,6 +19,8 @@ #include #include "misc.h" #include "gsm-api.h" +#include "gsm-datetime.h" +#include "gsm-sms.h" #include "xgnokii_common.h" #include "xgnokii.h" #include "xgnokii_lowlevel.h" @@ -70,23 +68,26 @@ typedef struct { GtkWidget *status; GtkWidget *report; GtkWidget *longSMS; + GtkWidget *class; GtkWidget *smscOptionMenu; GtkTooltips *addrTip; gint center; GSList *addressLine; } SendSMSWidget; +int prev_num_of_folders=0; + static GtkWidget *GUI_SMSWindow; static SMSWidget SMS = {NULL, NULL, NULL}; -static SendSMSWidget sendSMS = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL}; +static SendSMSWidget sendSMS = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL}; static ErrorDialog errorDialog = {NULL, NULL}; static InfoDialog infoDialog = {NULL, NULL}; static QuestMark questMark; - +static GtkWidget *treeFolderItem[MAX_SMS_FOLDERS], *subTree; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/windows/sms/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/sms/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } @@ -205,133 +206,105 @@ static inline void DestroyMsgPtrs (gpointer data) } -static void InsertInboxElement (gpointer d, gpointer userData) +static void InsertFolderElement (gpointer d, gpointer userData) { GSM_SMSMessage *data = (GSM_SMSMessage *) d; MessagePointers *msgPtrs; - SMS_DateTime *dt; + GSM_DateTime *dt; - if (data->Type == SMS_Deliver || data->Type == SMS_Delivery_Report) + if (data->folder == SMS.currentBox) { -/* if (data->Type == GST_MT && data->UDHType == GSM_ConcatenatedMessages) + gchar *row[4]; + + if (data->Type == GST_DR) { - //FIX ME - - msgPtrs = (MessagePointers *) g_malloc (sizeof (MessagePointers)); - msgPtrs->count = data->UDH[4]; - msgPtrs->number = data->UDH[5]; - msgPtrs->validity = data->Validity; - msgPtrs->class = data->Class; - strcpy (msgPtrs->sender, data->Sender); - msgPtrs->msgPtr = (gint *) g_malloc (msgPtrs->count * sizeof (gint)); - *(msgPtrs->msgPtr + msgPtrs->number - 1) = data->MessageNumber; + row[0] = g_strdup (_("report")); + dt = &(data->SMSCTime); } - else */ + else { - gchar *row[4]; - - if (data->Type == SMS_Delivery_Report) - { - row[0] = g_strdup (_("report")); - dt = &(data->SMSCTime); - } - else if (data->Status) - { - row[0] = g_strdup (_("read")); dt = &(data->Time); - } - else - { - row[0] = g_strdup (_("unread")); - dt = &(data->Time); - } + switch (data->Status) + { + case GSS_SENTREAD: + if (data->folder==0) //GST_INBOX + row[0] = g_strdup (_("read")); + else + row[0] = g_strdup (_("sent")); + break; + case GSS_NOTSENTREAD: + if (data->folder==0) //GST_INBOX + row[0] = g_strdup (_("unread")); + else + row[0] = g_strdup (_("not sent")); + break; + case GSS_UNKNOWN: + row[0] = g_strdup (_("not known :-(")); + break; + case GSS_TEMPLATE: + row[0] = g_strdup (_("template")); + break; + default: + row[0] = g_strdup (_("unknown")); + break; + } + } + if (data->SMSData) { if (dt->Timezone) - row[1] = g_strdup_printf ("%02d/%02d/%02d %02d:%02d:%02d %c%02d00", + row[1] = g_strdup_printf ("%s %02d/%02d/%02d %02d:%02d:%02d %c%02d00", + DayOfWeek(dt->Year, dt->Month, dt->Day), dt->Day, dt->Month, dt->Year, dt->Hour, dt->Minute, dt->Second, dt->Timezone > 0 ? '+' : '-', abs (dt->Timezone)); else - row[1] = g_strdup_printf ("%02d/%02d/%02d %02d:%02d:%02d", + row[1] = g_strdup_printf ("%s %02d/%02d/%02d %02d:%02d:%02d", + DayOfWeek(dt->Year, dt->Month, dt->Day), dt->Day, dt->Month, dt->Year, dt->Hour, dt->Minute, dt->Second); + } else { + row[1] = g_strdup_printf ("unknown"); + } + + row[2] = GUI_GetName (data->Sender); + if (row[2] == NULL || row[2][0]==0) row[2] = data->Sender; - row[2] = GUI_GetName (data->RemoteNumber.number); - if (row[2] == NULL) - row[2] = data->RemoteNumber.number; - row[3] = data->MessageText; + row[3] = data->MessageText; - gtk_clist_append (GTK_CLIST (SMS.smsClist), row); - msgPtrs = (MessagePointers *) g_malloc (sizeof (MessagePointers)); + msgPtrs = (MessagePointers *) g_malloc (sizeof (MessagePointers)); + msgPtrs->validity = data->Validity; + msgPtrs->class = data->Class; + strcpy (msgPtrs->sender, data->Sender); + +// if (data->UDHType == GSM_ConcatenatedMessages) +// { +// msgPtrs->count = data->UDH[5]; +// msgPtrs->number = data->UDH[4]; +// msgPtrs->msgPtr = (gint *) g_malloc (msgPtrs->count * sizeof (gint)); +// *(msgPtrs->msgPtr + msgPtrs->number - 1) = data->MessageNumber; +// } else { msgPtrs->count = msgPtrs->number = 1; - msgPtrs->validity = data->Validity.u.Relative; - // msgPtrs->class = data->Class; - strcpy (msgPtrs->sender, data->RemoteNumber.number); msgPtrs->msgPtr = (gint *) g_malloc (sizeof (gint)); - *(msgPtrs->msgPtr) = (int)data->Number; + *(msgPtrs->msgPtr) = data->MessageNumber; + + gtk_clist_append (GTK_CLIST (SMS.smsClist), row); gtk_clist_set_row_data_full (GTK_CLIST (SMS.smsClist), SMS.row_i++, msgPtrs, DestroyMsgPtrs); - g_free (row[0]); - g_free (row[1]); - } - } -} - - -static inline void RefreshInbox (void) -{ - gtk_clist_freeze (GTK_CLIST (SMS.smsClist)); - - gtk_clist_clear (GTK_CLIST (SMS.smsClist)); - - SMS.row_i = 0; - g_slist_foreach (phoneMonitor.sms.messages, InsertInboxElement, (gpointer) NULL); - - gtk_clist_sort (GTK_CLIST (SMS.smsClist)); - gtk_clist_thaw (GTK_CLIST (SMS.smsClist)); -} - - -static void InsertOutboxElement (gpointer d, gpointer userData) -{ - GSM_SMSMessage *data = (GSM_SMSMessage *) d; - MessagePointers *msgPtrs; - - if (data->Type == SMS_Submit) - { - gchar *row[4]; - - if (data->Status) - row[0] = g_strdup (_("sent")); - else - row[0] = g_strdup (_("unsent")); - - row[1] = row[2] = g_strdup (""); - row[3] = data->MessageText; +// } - gtk_clist_append( GTK_CLIST (SMS.smsClist), row); - msgPtrs = (MessagePointers *) g_malloc (sizeof (MessagePointers)); - msgPtrs->count = msgPtrs->number = 1; - msgPtrs->validity = data->Validity.u.Relative; - // msgPtrs->class = data->Class; - strcpy (msgPtrs->sender, data->RemoteNumber.number); - msgPtrs->msgPtr = (gint *) g_malloc (sizeof (gint)); - *(msgPtrs->msgPtr) = (int)data->Number; - gtk_clist_set_row_data_full (GTK_CLIST (SMS.smsClist), SMS.row_i++, - msgPtrs, DestroyMsgPtrs); g_free (row[0]); g_free (row[1]); } } - -static inline void RefreshOutbox (void) +static inline void RefreshFolder (void) { gtk_clist_freeze (GTK_CLIST (SMS.smsClist)); + gtk_clist_clear (GTK_CLIST (SMS.smsClist)); SMS.row_i = 0; - g_slist_foreach (phoneMonitor.sms.messages, InsertOutboxElement, (gpointer) NULL); + g_slist_foreach (phoneMonitor.sms.messages, InsertFolderElement, (gpointer) NULL); gtk_clist_sort (GTK_CLIST (SMS.smsClist)); gtk_clist_thaw (GTK_CLIST (SMS.smsClist)); @@ -343,10 +316,7 @@ inline void GUI_RefreshMessageWindow (void) if (!GTK_WIDGET_VISIBLE (GUI_SMSWindow)) return; - if (SMS.currentBox) - RefreshOutbox (); - else - RefreshInbox (); + RefreshFolder(); } @@ -397,6 +367,27 @@ static void ClickEntry (GtkWidget *clist, inline void GUI_ShowSMS (void) { + int i,j; + + GUI_InitSMSFoldersInf(); + + for (i=1;iprev_num_of_folders) { + treeFolderItem[i-1] = gtk_tree_item_new_with_label (_(folders.Folder[i-1].Name)); + gtk_tree_append (GTK_TREE (subTree), treeFolderItem[i-1]); + gtk_signal_connect (GTK_OBJECT (treeFolderItem[i-1]), "select", + GTK_SIGNAL_FUNC (SelectTreeItem), GINT_TO_POINTER (i-1)); + gtk_widget_show (treeFolderItem[i-1]); + } else { + gtk_widget_set_name(treeFolderItem[i-1],_(folders.Folder[i-1].Name)); + } + } + + for (j=i+1;jnext; for (count = 0; count < ((MessagePointers *) gtk_clist_get_row_data (GTK_CLIST (SMS.smsClist), row))->count; count++) { - int number; message = (GSM_SMSMessage *) g_malloc (sizeof (GSM_SMSMessage)); - number = *(((MessagePointers *) gtk_clist_get_row_data (GTK_CLIST (SMS.smsClist), row))->msgPtr + count); - if (number == -1) + message->Location = *(((MessagePointers *) gtk_clist_get_row_data (GTK_CLIST (SMS.smsClist), row))->msgPtr + count); + if (message->Location == -1) { g_free (message); continue; } - message->Number = number; message->MemoryType = GMT_SM; e = (PhoneEvent *) g_malloc (sizeof (PhoneEvent)); @@ -462,6 +451,28 @@ static void OkDeleteSMSDialog (GtkWidget *widget, gpointer data) gtk_clist_thaw (GTK_CLIST (SMS.smsClist)); } +static void ReadFromPhone (void) +{ + GSM_SMSStatus SMSStatus; + + SMSStatus.UnRead = 0; + SMSStatus.Number = 0; + + if (GSM->GetSMSStatus (&SMSStatus) == GE_NONE) { + if (phoneMonitor.sms.unRead != SMSStatus.UnRead || + phoneMonitor.sms.number2 != SMSStatus.Number) + { + phoneMonitor.working = _("Refreshing SMSes..."); +#ifdef XDEBUG + printf("Refreshing %d SMSes...\n",SMSStatus.Number); +#endif + RefreshSMS (SMSStatus.Number); + phoneMonitor.working = NULL; + } + + phoneMonitor.sms.unRead = SMSStatus.UnRead; + } +} static void DeleteSMS (void) { @@ -917,7 +928,7 @@ static gint SendSMSCore (GSM_SMSMessage *sms) #ifdef XDEBUG g_print ("Address: %s\nText: %s\nDelivery report: %d\nSMS Center: %d\n", - sms->RemoteNumber.number, + sms->Destination, sms->MessageText, GTK_TOGGLE_BUTTON (sendSMS.report)->active, sendSMS.center); @@ -929,13 +940,13 @@ static gint SendSMSCore (GSM_SMSMessage *sms) if (error != GE_SMSSENDOK) { gchar *buf = g_strdup_printf (_("SMS send to %s failed\n(error=%d)"), - sms->RemoteNumber.number, error); + sms->Destination, error); gtk_label_set_text (GTK_LABEL(errorDialog.text), buf); gtk_widget_show (errorDialog.dialog); g_free (buf); } else - g_print ("Message sent to: %s\n", sms->RemoteNumber.number); + g_print ("Message sent to: %s\n", sms->Destination); return (error); } @@ -943,14 +954,15 @@ static gint SendSMSCore (GSM_SMSMessage *sms) static void SendSMS (void) { - GSM_SMSMessage sms; + GSM_UDH UDHType; + GSM_MultiSMSMessage Multisms; + int chars_read; AddressPar aps; - char udh[256]; GSList *r; gchar *text, *number; gchar **addresses; gchar *buf; - gint offset, nr_msg, l; + gint l; gint longSMS; register gint i = 0, j; @@ -980,124 +992,46 @@ static void SendSMS (void) else number = addresses[i]; - sms.MessageCenter = xgnokiiConfig.smsSetting[sendSMS.center]; - sms.MessageCenter.No = 0; + chars_read=strlen(text); + UDHType = GSM_NoUDH; + if (l > GSM_MAX_SMS_LENGTH && longSMS) UDHType = GSM_ConcatenatedMessages; + if (UDHType == GSM_NoUDH && chars_read>160) chars_read=160; - if (GTK_TOGGLE_BUTTON (sendSMS.report)->active) - sms.Report = true; - else - sms.Report = false; - sms.Type = SMS_Submit; - - sms.DCS.Type = SMS_GeneralDataCoding; - sms.DCS.u.General.Compressed = false; - sms.DCS.u.General.Alphabet = SMS_DefaultAlphabet; - sms.DCS.u.General.Class = 0; - sms.MessageCenter.No = 1; - sms.Validity.VPF = SMS_RelativeFormat; - sms.Validity.u.Relative = sms.MessageCenter.Validity; /* 4320 minutes == 72 hours */ - sms.UDH_No = 0; - - strncpy (sms.RemoteNumber.number, number, GSM_MAX_DESTINATION_LENGTH + 1); - sms.RemoteNumber.number[GSM_MAX_DESTINATION_LENGTH] = '\0'; - - if (l > GSM_MAX_SMS_LENGTH) - { - if (longSMS) - { - sms.UDH[0].Type = SMS_ConcatenatedMessages; - nr_msg = ((l - 1) / 153) + 1; - udh[0] = 0x05; // UDH length - udh[1] = 0x00; // concatenated messages (IEI) - udh[2] = 0x03; // IEI data length - udh[3] = 0x01; // reference number - udh[4] = nr_msg; // number of messages - udh[5] = 0x00; // message reference number - offset = 6; - - for (j = 0; j < nr_msg; j++) - { - udh[5] = j + 1; - - memcpy(sms.MessageText,udh,offset); - strncpy (sms.MessageText+offset, text + (j * 153), 153); - sms.MessageText[153] = '\0'; - - buf = g_strdup_printf (_("Sending SMS to %s (%d/%d) ...\n"), - sms.RemoteNumber.number, j + 1, nr_msg); - gtk_label_set_text (GTK_LABEL (infoDialog.text), buf); - gtk_widget_show_now (infoDialog.dialog); - g_free (buf); - GUI_Refresh (); - - if (SendSMSCore (&sms) != GE_SMSSENDOK) - { - gtk_widget_hide (infoDialog.dialog); - GUI_Refresh (); - break; - } - - gtk_widget_hide (infoDialog.dialog); - GUI_Refresh (); - - sleep (1); - } - } - else - { - sms.UDH_Length = 0; - nr_msg = ((l - 1) / 153) + 1; - if (nr_msg > 99) // We have place only for 99 messages in header. - nr_msg = 99; - for (j = 0; j < nr_msg; j++) - { - gchar header[8]; + GSM_MakeMultiPartSMS2(&Multisms,text,chars_read,UDHType,GSM_Coding_Default); + + for (j=0;jactive) Multisms.SMS[j].Type = GST_DR; - strcpy (sms.MessageText, header); - strncat (sms.MessageText, text + (j * 153), 153); - sms.MessageText[160] = '\0'; + if (GTK_TOGGLE_BUTTON (sendSMS.class)->active) Multisms.SMS[j].Class = 0; - buf = g_strdup_printf (_("Sending SMS to %s (%d/%d) ...\n"), - sms.RemoteNumber.number, j + 1, nr_msg); - gtk_label_set_text (GTK_LABEL (infoDialog.text), buf); - gtk_widget_show_now (infoDialog.dialog); - g_free (buf); - GUI_Refresh (); + Multisms.SMS[j].Validity = Multisms.SMS[j].MessageCenter.Validity; - if (SendSMSCore (&sms) != GE_SMSSENDOK) - { - gtk_widget_hide (infoDialog.dialog); - GUI_Refresh (); - break; - } - - gtk_widget_hide (infoDialog.dialog); - GUI_Refresh (); - - sleep (1); - } - } - } - else - { - sms.UDH_Length = 0; - strncpy (sms.MessageText, text, GSM_MAX_SMS_LENGTH + 1); - sms.MessageText[GSM_MAX_SMS_LENGTH] = '\0'; + strncpy (Multisms.SMS[j].Destination, number, GSM_MAX_DESTINATION_LENGTH + 1); + Multisms.SMS[j].Destination[GSM_MAX_DESTINATION_LENGTH] = '\0'; - buf = g_strdup_printf (_("Sending SMS to %s ...\n"), sms.RemoteNumber.number); + buf = g_strdup_printf (_("Sending SMS to %s (%d/%d) ...\n"), + Multisms.SMS[j].Destination, j + 1, Multisms.number); gtk_label_set_text (GTK_LABEL (infoDialog.text), buf); gtk_widget_show_now (infoDialog.dialog); g_free (buf); GUI_Refresh (); - (void) SendSMSCore (&sms); + if (SendSMSCore (&Multisms.SMS[j]) != GE_SMSSENDOK) + { + gtk_widget_hide (infoDialog.dialog); + GUI_Refresh (); + break; + } + gtk_widget_hide (infoDialog.dialog); GUI_Refresh (); - } + sleep (1); + } + i++; } @@ -1158,7 +1092,6 @@ static void CreateSMSSendWindow (void) InitSendMenu (); sendSMS.SMSSendWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW(sendSMS.SMSSendWindow), "SMSSendWindow", "Xgnokii"); //gtk_widget_set_usize (GTK_WIDGET (sendSMS.SMSSendWindow), 436, 220); gtk_signal_connect (GTK_OBJECT (sendSMS.SMSSendWindow), "delete_event", @@ -1293,6 +1226,10 @@ static void CreateSMSSendWindow (void) gtk_box_pack_start (GTK_BOX (vbox), sendSMS.longSMS, FALSE, FALSE, 3); gtk_widget_show (sendSMS.longSMS); + sendSMS.class = gtk_check_button_new_with_label (_("Send as Flash SMS (Class 0)")); + gtk_box_pack_start (GTK_BOX (vbox), sendSMS.class, FALSE, FALSE, 3); + gtk_widget_show (sendSMS.class); + label = gtk_label_new (_("SMS Center:")); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 1); gtk_widget_show (label); @@ -1366,7 +1303,7 @@ static void ForwardSMS (void) /* static inline gint CompareSMSMessageLocation (gconstpointer a, gconstpointer b) { - return !(((GSM_SMSMessage *) a)->Number == ((GSM_SMSMessage *) b)->Number); + return !(((GSM_SMSMessage *) a)->Location == ((GSM_SMSMessage *) b)->Location); } */ @@ -1398,7 +1335,7 @@ static void ReplySMS (void) gtk_text_thaw (GTK_TEXT (sendSMS.smsSendText)); - //msg.Number = *(((MessagePointers *) gtk_clist_get_row_data(GTK_CLIST (SMS.smsClist), + //msg.Location = *(((MessagePointers *) gtk_clist_get_row_data(GTK_CLIST (SMS.smsClist), // GPOINTER_TO_INT (GTK_CLIST (SMS.smsClist)->selection->data)))->msgPtr); //r = g_slist_find_custom (SMS.messages, &msg, CompareSMSMessageLocation); @@ -1490,6 +1427,8 @@ static void NewBC (void) static GtkItemFactoryEntry menu_items[] = { { NULL, NULL, NULL, 0, ""}, + { NULL, NULL, ReadFromPhone, 0, NULL}, + { NULL, NULL, NULL, 0, ""}, { NULL, "S", NULL, 0, NULL}, { NULL, "M", SaveToMailbox, 0, NULL}, { NULL, NULL, NULL, 0, ""}, @@ -1512,6 +1451,8 @@ static void InitMainMenu (void) register gint i = 0; menu_items[i++].path = g_strdup (_("/_File")); + menu_items[i++].path = g_strdup (_("/File/Read from phone")); + menu_items[i++].path = g_strdup (_("/File/Sep0")); menu_items[i++].path = g_strdup (_("/File/_Save")); menu_items[i++].path = g_strdup (_("/File/Save to mailbo_x")); menu_items[i++].path = g_strdup (_("/File/Sep1")); @@ -1539,16 +1480,14 @@ void GUI_CreateSMSWindow (void) GtkWidget *toolbar; GtkWidget *scrolledWindow; GtkWidget *vpaned, *hpaned; - GtkWidget *tree, *treeSMSItem, *treeInboxItem, *treeOutboxItem, *subTree; + GtkWidget *tree, *treeSMSItem; SortColumn *sColumn; GdkColormap *cmap; register gint i; gchar *titles[4] = { _("Status"), _("Date / Time"), _("Sender"), _("Message")}; - InitMainMenu (); GUI_SMSWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_SMSWindow), "SMSWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_SMSWindow), _("Short Message Service")); //gtk_widget_set_usize (GTK_WIDGET (GUI_SMSWindow), 436, 220); gtk_signal_connect (GTK_OBJECT (GUI_SMSWindow), "delete_event", @@ -1632,18 +1571,6 @@ void GUI_CreateSMSWindow (void) gtk_tree_set_view_mode (GTK_TREE (subTree), GTK_TREE_VIEW_ITEM); gtk_tree_item_set_subtree (GTK_TREE_ITEM (treeSMSItem), subTree); - treeInboxItem = gtk_tree_item_new_with_label (_("Inbox")); - gtk_tree_append (GTK_TREE (subTree), treeInboxItem); - gtk_signal_connect (GTK_OBJECT (treeInboxItem), "select", - GTK_SIGNAL_FUNC (SelectTreeItem), GINT_TO_POINTER (0)); - gtk_widget_show (treeInboxItem); - - treeOutboxItem = gtk_tree_item_new_with_label (_("Outbox")); - gtk_tree_append (GTK_TREE (subTree), treeOutboxItem); - gtk_signal_connect (GTK_OBJECT (treeOutboxItem), "select", - GTK_SIGNAL_FUNC (SelectTreeItem), GINT_TO_POINTER (1)); - gtk_widget_show (treeOutboxItem); - scrolledWindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_usize (scrolledWindow, 75, 80); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledWindow), @@ -1656,7 +1583,6 @@ void GUI_CreateSMSWindow (void) tree); gtk_widget_show (scrolledWindow); - /* Message viewer */ SMS.smsText = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (SMS.smsText), FALSE); diff --git a/xgnokii/xgnokii_sms.h b/xgnokii/xgnokii_sms.h index d40dea1..d03398c 100644 --- a/xgnokii/xgnokii_sms.h +++ b/xgnokii/xgnokii_sms.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Tue Nov 27 1999 - Modified by Jan Derfinak - */ #ifndef XGNOKII_SMS_H diff --git a/xgnokii/xgnokii_speed.c b/xgnokii/xgnokii_speed.c index 51db1e5..d4bb32b 100644 --- a/xgnokii/xgnokii_speed.c +++ b/xgnokii/xgnokii_speed.c @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Sun Apr 30 2000 - Modified by Jan Derfinak - */ @@ -43,7 +38,7 @@ static bool speedDialInitialized; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/windows/speeddial/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/speeddial/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } @@ -556,7 +551,6 @@ void GUI_CreateSpeedDialWindow (void) InitMainMenu (); GUI_SpeedDialWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_SpeedDialWindow), "SpeedDialWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_SpeedDialWindow), _("Speed Dial")); gtk_widget_set_usize (GTK_WIDGET (GUI_SpeedDialWindow), 332, 220); //gtk_container_set_border_width (GTK_CONTAINER (GUI_SpeedDialWindow), 10); diff --git a/xgnokii/xgnokii_speed.h b/xgnokii/xgnokii_speed.h index 7be5249..a454bf5 100644 --- a/xgnokii/xgnokii_speed.h +++ b/xgnokii/xgnokii_speed.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Sun Dec 26 1999 - Modified by Jan Derfinak - */ #ifndef XGNOKII_SPEED_H diff --git a/xgnokii/xgnokii_xkeyb.c b/xgnokii/xgnokii_xkeyb.c index 817d5c7..3ecf9f6 100644 --- a/xgnokii/xgnokii_xkeyb.c +++ b/xgnokii/xgnokii_xkeyb.c @@ -1,12 +1,8 @@ /* - $Id$ - X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. @@ -15,7 +11,6 @@ #include #include #include "misc.h" -#include "links/fbus.h" #include "xgnokii_common.h" #include "xgnokii.h" #include "xgnokii_lowlevel.h" @@ -35,79 +30,79 @@ static ErrorDialog errorDialog = {NULL, NULL}; static ButtonT *button = NULL; static ButtonT button_6110[30] = { - { 103, 91, 114, 107, 0x0d }, /* Power */ - { 28, 240, 54, 263, 0x19 }, /* Menu */ - { 84, 240, 110, 263, 0x1a }, /* Names */ - { 58, 245, 82, 258, 0x17 }, /* Up */ - { 55, 263, 85, 276, 0x18 }, /* Down */ - { 22, 271, 50, 289, 0x0e }, /* Green */ - { 91, 271, 115, 289, 0x0f }, /* Red */ - { 18, 294, 44, 310, 0x01 }, /* 1 */ - { 56, 294, 85, 310, 0x02 }, /* 2 */ - { 98, 294, 121, 310, 0x03 }, /* 3 */ - { 18, 317, 44, 333, 0x04 }, /* 4 */ - { 56, 317, 85, 333, 0x05 }, /* 5 */ - { 98, 317, 121, 333, 0x06 }, /* 6 */ - { 18, 342, 44, 356, 0x07 }, /* 7 */ - { 56, 342, 85, 356, 0x08 }, /* 8 */ - { 98, 342, 121, 356, 0x09 }, /* 9 */ - { 18, 365, 44, 380, 0x0c }, /* * */ - { 56, 365, 85, 380, 0x0a }, /* 0 */ - { 98, 365, 121, 380, 0x0b }, /* # */ - { 1, 138, 10, 150, 0x10 } , /* Volume + */ - { 1, 165, 10, 176, 0x11 } , /* Volume - */ + { 103, 91, 114, 107, PHONEKEY_POWER }, /* Power */ + { 28, 240, 54, 263, PHONEKEY_MENU }, /* Menu */ + { 84, 240, 110, 263, PHONEKEY_NAMES }, /* Names */ + { 58, 245, 82, 258, PHONEKEY_UP }, /* Up */ + { 55, 263, 85, 276, PHONEKEY_DOWN }, /* Down */ + { 22, 271, 50, 289, PHONEKEY_GREEN }, /* Green */ + { 91, 271, 115, 289, PHONEKEY_RED }, /* Red */ + { 18, 294, 44, 310, PHONEKEY_1 }, /* 1 */ + { 56, 294, 85, 310, PHONEKEY_2 }, /* 2 */ + { 98, 294, 121, 310, PHONEKEY_3 }, /* 3 */ + { 18, 317, 44, 333, PHONEKEY_4 }, /* 4 */ + { 56, 317, 85, 333, PHONEKEY_5 }, /* 5 */ + { 98, 317, 121, 333, PHONEKEY_6 }, /* 6 */ + { 18, 342, 44, 356, PHONEKEY_7 }, /* 7 */ + { 56, 342, 85, 356, PHONEKEY_8 }, /* 8 */ + { 98, 342, 121, 356, PHONEKEY_9 }, /* 9 */ + { 18, 365, 44, 380, PHONEKEY_ASTERISK }, /* * */ + { 56, 365, 85, 380, PHONEKEY_0 }, /* 0 */ + { 98, 365, 121, 380, PHONEKEY_HASH }, /* # */ + { 1, 138, 10, 150, PHONEKEY_INCREASEVOLUME }, /* Volume + */ + { 1, 165, 10, 176, PHONEKEY_DECREASEVOLUME }, /* Volume - */ { 0, 0, 0, 0, 0x00 } }; static ButtonT button_6150[30] = { - { 99, 78, 114, 93, 0x0d }, /* Power */ - { 20, 223, 49, 245, 0x19 }, /* Menu */ - { 90, 223, 120, 245, 0x1a }, /* Names */ - { 59, 230, 83, 247, 0x17 }, /* Up */ - { 56, 249, 84, 265, 0x18 }, /* Down */ - { 14, 254, 51, 273, 0x0e }, /* Green */ - { 90, 255, 126, 273, 0x0f }, /* Red */ - { 18, 281, 53, 299, 0x01 }, /* 1 */ - { 55, 280, 86, 299, 0x02 }, /* 2 */ - { 90, 281, 122, 299, 0x03 }, /* 3 */ - { 18, 303, 53, 323, 0x04 }, /* 4 */ - { 55, 303, 87, 323, 0x05 }, /* 5 */ - { 90, 303, 122, 323, 0x06 }, /* 6 */ - { 18, 327, 53, 346, 0x07 }, /* 7 */ - { 53, 327, 87, 346, 0x08 }, /* 8 */ - { 90, 327, 122, 346, 0x09 }, /* 9 */ - { 18, 349, 53, 370, 0x0c }, /* * */ - { 56, 349, 87, 370, 0x0a }, /* 0 */ - { 98, 349, 122, 370, 0x0b }, /* # */ - { 2, 131, 10, 147, 0x10 }, /* Volume + */ - { 2, 155, 10, 173, 0x11 }, /* Volume - */ + { 99, 78, 114, 93, PHONEKEY_POWER }, /* Power */ + { 20, 223, 49, 245, PHONEKEY_MENU }, /* Menu */ + { 90, 223, 120, 245, PHONEKEY_NAMES }, /* Names */ + { 59, 230, 83, 247, PHONEKEY_UP }, /* Up */ + { 56, 249, 84, 265, PHONEKEY_DOWN }, /* Down */ + { 14, 254, 51, 273, PHONEKEY_GREEN }, /* Green */ + { 90, 255, 126, 273, PHONEKEY_RED }, /* Red */ + { 18, 281, 53, 299, PHONEKEY_1 }, /* 1 */ + { 55, 280, 86, 299, PHONEKEY_2 }, /* 2 */ + { 90, 281, 122, 299, PHONEKEY_3 }, /* 3 */ + { 18, 303, 53, 323, PHONEKEY_4 }, /* 4 */ + { 55, 303, 87, 323, PHONEKEY_5 }, /* 5 */ + { 90, 303, 122, 323, PHONEKEY_6 }, /* 6 */ + { 18, 327, 53, 346, PHONEKEY_7 }, /* 7 */ + { 53, 327, 87, 346, PHONEKEY_8 }, /* 8 */ + { 90, 327, 122, 346, PHONEKEY_9 }, /* 9 */ + { 18, 349, 53, 370, PHONEKEY_ASTERISK }, /* * */ + { 56, 349, 87, 370, PHONEKEY_0 }, /* 0 */ + { 98, 349, 122, 370, PHONEKEY_HASH }, /* # */ + { 2, 131, 10, 147, PHONEKEY_INCREASEVOLUME }, /* Volume + */ + { 2, 155, 10, 173, PHONEKEY_DECREASEVOLUME }, /* Volume - */ { 0, 0, 0, 0, 0x00 } }; static ButtonT button_5110[30] = { - { 100, 85, 114, 99, 0x0d }, /* Power */ - { 50, 240, 85, 265, 0x19 }, /* Menu */ - { 20, 240, 45, 260, 0x1a }, /* Names */ - { 100, 240, 117, 258, 0x17 }, /* Up */ - { 93, 267, 112, 287, 0x18 }, /* Down */ - { 14, 294, 44, 312, 0x01 }, /* 1 */ - { 54, 294, 83, 312, 0x02 }, /* 2 */ - { 94, 294, 122, 312, 0x03 }, /* 3 */ - { 14, 320, 44, 338, 0x04 }, /* 4 */ - { 54, 320, 83, 338, 0x05 }, /* 5 */ - { 94, 320, 122, 338, 0x06 }, /* 6 */ - { 14, 345, 44, 363, 0x07 }, /* 7 */ - { 54, 345, 83, 363, 0x08 }, /* 8 */ - { 94, 345, 122, 363, 0x09 }, /* 9 */ - { 18, 374, 49, 389, 0x0c }, /* * */ - { 53, 371, 82, 387, 0x0a }, /* 0 */ - { 96, 374, 119, 389, 0x0b }, /* # */ + { 100, 85, 114, 99, PHONEKEY_POWER }, /* Power */ + { 50, 240, 85, 265, PHONEKEY_MENU }, /* Menu */ + { 20, 240, 45, 260, PHONEKEY_NAMES }, /* Names */ + { 100, 240, 117, 258, PHONEKEY_UP }, /* Up */ + { 93, 267, 112, 287, PHONEKEY_DOWN }, /* Down */ + { 14, 294, 44, 312, PHONEKEY_1 }, /* 1 */ + { 54, 294, 83, 312, PHONEKEY_2 }, /* 2 */ + { 94, 294, 122, 312, PHONEKEY_3 }, /* 3 */ + { 14, 320, 44, 338, PHONEKEY_4 }, /* 4 */ + { 54, 320, 83, 338, PHONEKEY_5 }, /* 5 */ + { 94, 320, 122, 338, PHONEKEY_6 }, /* 6 */ + { 14, 345, 44, 363, PHONEKEY_7 }, /* 7 */ + { 54, 345, 83, 363, PHONEKEY_8 }, /* 8 */ + { 94, 345, 122, 363, PHONEKEY_9 }, /* 9 */ + { 18, 374, 49, 389, PHONEKEY_ASTERISK }, /* * */ + { 53, 371, 82, 387, PHONEKEY_0 }, /* 0 */ + { 96, 374, 119, 389, PHONEKEY_HASH }, /* # */ { 0, 0, 0, 0, 0x00 } }; static inline void Help1 (GtkWidget *w, gpointer data) { - gchar *indx = g_strdup_printf ("/help/%s/windows/xkeyb/index.html", xgnokiiConfig.locale); + gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/xkeyb/index.htm", xgnokiiConfig.locale); Help (w, indx); g_free (indx); } @@ -189,7 +184,7 @@ void GUI_ShowXkeyb (void) static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event) { - unsigned char req[] = {FBUS_FRAME_HEADER, 0x42, 0x01, 0x00, 0x01}; + unsigned char req[] = {0x00,0x00}; register gint i = 0; if (button == NULL) @@ -199,9 +194,9 @@ static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event) return TRUE; if (event->type == GDK_BUTTON_PRESS) - req[4] = 0x01; + req[0] = PRESSPHONEKEY; else if (event->type == GDK_BUTTON_RELEASE) - req[4] = 0x02; + req[0] = RELEASEPHONEKEY; else return TRUE; @@ -215,7 +210,7 @@ static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event) { PhoneEvent *e = g_malloc (sizeof (PhoneEvent)); - req[5]=button[i].code; + req[1]=button[i].code; e->event = Event_SendKeyStroke; e->data = g_memdup (req, sizeof (req)); GUI_InsertEvent (e); @@ -256,7 +251,6 @@ void GUI_CreateXkeybWindow (void) InitMainMenu (); GUI_XkeybWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_wmclass (GTK_WINDOW (GUI_XkeybWindow), "XkeybWindow", "Xgnokii"); gtk_window_set_title (GTK_WINDOW (GUI_XkeybWindow), _("XGnokii Keyboard")); //gtk_widget_set_usize (GTK_WIDGET (GUI_XkeybWindow), 436, 220); gtk_signal_connect (GTK_OBJECT (GUI_XkeybWindow), "delete_event", diff --git a/xgnokii/xgnokii_xkeyb.h b/xgnokii/xgnokii_xkeyb.h index b2544bd..6060e09 100644 --- a/xgnokii/xgnokii_xkeyb.h +++ b/xgnokii/xgnokii_xkeyb.h @@ -3,14 +3,9 @@ X G N O K I I A Linux/Unix GUI for Nokia mobile phones. - Copyright (C) 1999 Pavel Janík ml., Hugh Blemings - & Ján Derfiòák . Released under the terms of the GNU GPL, see file COPYING for more details. - Last modification: Sun Mar 19 2000 - Modified by Jan Derfinak - */ #ifndef XGNOKII_XKEYB_H -- 1.8.3.1