summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common
Unidiff
Diffstat (limited to 'gammu/emb/common') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/common.pro22
-rw-r--r--gammu/emb/common/commonE.pro14
-rw-r--r--gammu/emb/common/device/serial/ser_djg.c399
-rw-r--r--gammu/emb/common/device/serial/ser_djg.h37
-rw-r--r--gammu/emb/common/device/serial/ser_unx.c27
-rw-r--r--gammu/emb/common/device/serial/ser_w32.c9
-rw-r--r--gammu/emb/common/gsmstate.c7
-rw-r--r--gammu/emb/common/gsmstate.h30
-rw-r--r--gammu/emb/common/phone/alcatel/alcatel.c6
-rw-r--r--gammu/emb/common/phone/at/atgen.c8
-rw-r--r--gammu/emb/common/phone/at/sonyeric.c19
-rw-r--r--gammu/emb/common/phone/nokia/dct3/dct3func.c17
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n0650.c150
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n0650.h18
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n6110.c17
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n7110.c15
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n9210.c6
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n3320.c6
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n3650.c6
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n6510.c142
-rw-r--r--gammu/emb/common/phone/nokia/nauto.c6
-rw-r--r--gammu/emb/common/phone/obex/obexgen.c6
-rw-r--r--gammu/emb/common/phone/pfunc.c1
-rw-r--r--gammu/emb/common/phone/symbian/mroutgen.c6
-rw-r--r--gammu/emb/common/protocol/nokia/fbus2.c10
-rw-r--r--gammu/emb/common/protocol/nokia/fbus2.h9
-rw-r--r--gammu/emb/common/protocol/nokia/phonet.c9
-rw-r--r--gammu/emb/common/protocol/nokia/phonet.h9
-rw-r--r--gammu/emb/common/service/backup/backgen.h2
-rw-r--r--gammu/emb/common/service/backup/backtext.c12
-rw-r--r--gammu/emb/common/service/gsmring.h2
31 files changed, 948 insertions, 79 deletions
diff --git a/gammu/emb/common/common.pro b/gammu/emb/common/common.pro
index 797199b..af45382 100644
--- a/gammu/emb/common/common.pro
+++ b/gammu/emb/common/common.pro
@@ -50,139 +50,145 @@ INCLUDEPATH += . \
50 service/backup \ 50 service/backup \
51 phone/nokia \ 51 phone/nokia \
52 phone 52 phone
53 53
54# Input 54# Input
55HEADERS += config.h \ 55HEADERS += config.h \
56 gammu.h \ 56 gammu.h \
57 gsmcomon.h \ 57 gsmcomon.h \
58 gsmstate.h \ 58 gsmstate.h \
59 device/devfunc.h \ 59 device/devfunc.h \
60 misc/cfg.h \ 60 misc/cfg.h \
61 misc/misc.h \ 61 misc/misc.h \
62 phone/pfunc.h \ 62 phone/pfunc.h \
63 protocol/protocol.h \ 63 protocol/protocol.h \
64 service/gsmcal.h \ 64 service/gsmcal.h \
65 service/gsmcall.h \ 65 service/gsmcall.h \
66 service/gsmdata.h \ 66 service/gsmdata.h \
67 service/gsmlogo.h \ 67 service/gsmlogo.h \
68 service/gsmmisc.h \ 68 service/gsmmisc.h \
69 service/gsmnet.h \ 69 service/gsmnet.h \
70 service/gsmpbk.h \ 70 service/gsmpbk.h \
71 service/gsmprof.h \ 71 service/gsmprof.h \
72 service/gsmring.h \ 72 service/gsmring.h \
73 device/bluetoth/affix.h \ 73 device/bluetoth/affix.h \
74 device/bluetoth/blue_w32.h \
75 device/bluetoth/bluetoth.h \ 74 device/bluetoth/bluetoth.h \
76 device/bluetoth/bluez.h \ 75 device/bluetoth/bluez.h \
77 device/irda/irda.h \ 76 device/irda/irda.h \
78 device/irda/irda_unx.h \
79 device/irda/irda_w32.h \
80 device/serial/ser_djg.h \ 77 device/serial/ser_djg.h \
81 device/serial/ser_unx.h \
82 device/serial/ser_w32.h \
83 misc/coding/coding.h \ 78 misc/coding/coding.h \
84 misc/coding/md5.h \ 79 misc/coding/md5.h \
85 phone/alcatel/alcatel.h \ 80 phone/alcatel/alcatel.h \
86 phone/at/atgen.h \ 81 phone/at/atgen.h \
87 phone/nokia/ncommon.h \ 82 phone/nokia/ncommon.h \
88 phone/nokia/nfunc.h \ 83 phone/nokia/nfunc.h \
89 phone/nokia/nfuncold.h \ 84 phone/nokia/nfuncold.h \
90 phone/obex/obexgen.h \ 85 phone/obex/obexgen.h \
91 phone/symbian/mroutgen.h \ 86 phone/symbian/mroutgen.h \
92 protocol/alcatel/alcabus.h \ 87 protocol/alcatel/alcabus.h \
93 protocol/at/at.h \ 88 protocol/at/at.h \
94 protocol/nokia/fbus2.h \ 89 protocol/nokia/fbus2.h \
95 protocol/nokia/mbus2.h \ 90 protocol/nokia/mbus2.h \
96 protocol/nokia/phonet.h \ 91 protocol/nokia/phonet.h \
97 protocol/obex/obex.h \ 92 protocol/obex/obex.h \
98 protocol/symbian/mrouter.h \ 93 protocol/symbian/mrouter.h \
99 service/backup/backgen.h \ 94 service/backup/backgen.h \
100 service/backup/backics.h \ 95 service/backup/backics.h \
101 service/backup/backldif.h \ 96 service/backup/backldif.h \
102 service/backup/backlmb.h \ 97 service/backup/backlmb.h \
103 service/backup/backtext.h \ 98 service/backup/backtext.h \
104 service/backup/backvcf.h \ 99 service/backup/backvcf.h \
105 service/backup/backvcs.h \ 100 service/backup/backvcs.h \
106 service/backup/gsmback.h \ 101 service/backup/gsmback.h \
107 service/sms/gsmems.h \ 102 service/sms/gsmems.h \
108 service/sms/gsmmulti.h \ 103 service/sms/gsmmulti.h \
109 service/sms/gsmsms.h \ 104 service/sms/gsmsms.h \
110 phone/nokia/dct3/dct3comm.h \ 105 phone/nokia/dct3/dct3comm.h \
111 phone/nokia/dct3/dct3func.h \ 106 phone/nokia/dct3/dct3func.h \
112 phone/nokia/dct3/n6110.h \ 107 phone/nokia/dct3/n6110.h \
113 phone/nokia/dct3/n7110.h \ 108 phone/nokia/dct3/n7110.h \
109 phone/nokia/dct3/n0650.h \
114 phone/nokia/dct3/n9210.h \ 110 phone/nokia/dct3/n9210.h \
115 phone/nokia/dct4/dct4func.h \ 111 phone/nokia/dct4/dct4func.h \
116 phone/nokia/dct4/n3320.h \ 112 phone/nokia/dct4/n3320.h \
117 phone/nokia/dct4/n3650.h \ 113 phone/nokia/dct4/n3650.h \
118 phone/nokia/dct4/n6510.h 114 phone/nokia/dct4/n6510.h
119SOURCES +=gsmcomon.c \ 115SOURCES +=gsmcomon.c \
120gsmstate.c \ 116gsmstate.c \
121misc/misc.c \ 117misc/misc.c \
122misc/cfg.c \ 118misc/cfg.c \
123misc/coding/coding.c \ 119misc/coding/coding.c \
124misc/coding/md5.c \ 120misc/coding/md5.c \
125service/sms/gsmsms.c \ 121service/sms/gsmsms.c \
126service/sms/gsmems.c \ 122service/sms/gsmems.c \
127service/sms/gsmmulti.c \ 123service/sms/gsmmulti.c \
128service/gsmcal.c \ 124service/gsmcal.c \
129service/gsmdata.c \ 125service/gsmdata.c \
130service/gsmpbk.c \ 126service/gsmpbk.c \
131service/gsmring.c \ 127service/gsmring.c \
132service/gsmlogo.c \ 128service/gsmlogo.c \
133service/gsmmisc.c \ 129service/gsmmisc.c \
134service/gsmnet.c \ 130service/gsmnet.c \
135service/backup/gsmback.c \ 131service/backup/gsmback.c \
136service/backup/backldif.c \ 132service/backup/backldif.c \
137service/backup/backlmb.c \ 133service/backup/backlmb.c \
138service/backup/backtext.c \ 134service/backup/backtext.c \
139service/backup/backvcs.c \ 135service/backup/backvcs.c \
140service/backup/backvcf.c \ 136service/backup/backvcf.c \
141service/backup/backics.c \ 137service/backup/backics.c \
142device/bluetoth/affix.c \ 138device/bluetoth/affix.c \
143device/bluetoth/bluez.c \ 139device/bluetoth/bluez.c \
144device/bluetoth/blue_w32.c \
145device/bluetoth/bluetoth.c \ 140device/bluetoth/bluetoth.c \
146device/serial/ser_djg.c \ 141device/serial/ser_djg.c \
147device/irda/irda.c \ 142device/irda/irda.c \
148device/devfunc.c \ 143device/devfunc.c \
149protocol/at/at.c \ 144protocol/at/at.c \
150protocol/alcatel/alcabus.c \ 145protocol/alcatel/alcabus.c \
151protocol/nokia/mbus2.c \ 146protocol/nokia/mbus2.c \
152protocol/nokia/fbus2.c \ 147protocol/nokia/fbus2.c \
153protocol/nokia/phonet.c \ 148protocol/nokia/phonet.c \
154protocol/obex/obex.c \ 149protocol/obex/obex.c \
155protocol/symbian/mrouter.c \ 150protocol/symbian/mrouter.c \
156phone/pfunc.c \ 151phone/pfunc.c \
157phone/at/atgen.c \ 152phone/at/atgen.c \
158phone/at/siemens.c \ 153phone/at/siemens.c \
159phone/at/samsung.c \ 154phone/at/samsung.c \
160phone/at/sonyeric.c \ 155phone/at/sonyeric.c \
161phone/alcatel/alcatel.c \ 156phone/alcatel/alcatel.c \
162phone/nokia/dct3/n6110.c \ 157phone/nokia/dct3/n6110.c \
163phone/nokia/dct3/n7110.c \ 158phone/nokia/dct3/n7110.c \
159phone/nokia/dct3/n0650.c \
164phone/nokia/dct3/n9210.c \ 160phone/nokia/dct3/n9210.c \
165phone/nokia/dct3/dct3func.c \ 161phone/nokia/dct3/dct3func.c \
166phone/nokia/dct4/n3320.c \ 162phone/nokia/dct4/n3320.c \
167phone/nokia/dct4/n3650.c \ 163phone/nokia/dct4/n3650.c \
168phone/nokia/dct4/n6510.c \ 164phone/nokia/dct4/n6510.c \
169phone/nokia/dct4/dct4func.c \ 165phone/nokia/dct4/dct4func.c \
170phone/nokia/nauto.c \ 166phone/nokia/nauto.c \
171phone/nokia/nfunc.c \ 167phone/nokia/nfunc.c \
172phone/nokia/nfuncold.c \ 168phone/nokia/nfuncold.c \
173phone/obex/obexgen.c \ 169phone/obex/obexgen.c \
174phone/symbian/mroutgen.c 170phone/symbian/mroutgen.c
175 171
176DEFINES += DESKTOP_VERSION 172DEFINES += DESKTOP_VERSION
177TARGET = microgammu 173TARGET = microgammu
178CONFIG = warn_off release console 174CONFIG = warn_off release console
179DESTDIR = ../../../bin 175DESTDIR = ../../../bin
180OBJECTS_DIR = obj/unix 176OBJECTS_DIR = obj/unix
181MOC_DIR = moc/unix 177MOC_DIR = moc/unix
182 178
183unix: { 179unix: {
184SOURCES += device/serial/ser_unx.c 180HEADERS += device/serial/ser_unx.h \
181 device/irda/irda_unx.h
182
183SOURCES += device/serial/ser_unx.c \
184
185} 185}
186win32:{ 186win32:{
187SOURCES += device/serial/ser_w32.c 187
188HEADERS += device/serial/ser_w32.h \
189 device/irda/irda_w32.h \
190 device/bluetoth/blue_w32.h
191
192SOURCES += device/serial/ser_w32.c \
193 device/bluetoth/blue_w32.c
188} 194}
diff --git a/gammu/emb/common/commonE.pro b/gammu/emb/common/commonE.pro
index f5b559d..1512814 100644
--- a/gammu/emb/common/commonE.pro
+++ b/gammu/emb/common/commonE.pro
@@ -50,132 +50,138 @@ INCLUDEPATH += . \
50 service/backup \ 50 service/backup \
51 phone/nokia \ 51 phone/nokia \
52 phone 52 phone
53 53
54# Input 54# Input
55HEADERS += config.h \ 55HEADERS += config.h \
56 gammu.h \ 56 gammu.h \
57 gsmcomon.h \ 57 gsmcomon.h \
58 gsmstate.h \ 58 gsmstate.h \
59 device/devfunc.h \ 59 device/devfunc.h \
60 misc/cfg.h \ 60 misc/cfg.h \
61 misc/misc.h \ 61 misc/misc.h \
62 phone/pfunc.h \ 62 phone/pfunc.h \
63 protocol/protocol.h \ 63 protocol/protocol.h \
64 service/gsmcal.h \ 64 service/gsmcal.h \
65 service/gsmcall.h \ 65 service/gsmcall.h \
66 service/gsmdata.h \ 66 service/gsmdata.h \
67 service/gsmlogo.h \ 67 service/gsmlogo.h \
68 service/gsmmisc.h \ 68 service/gsmmisc.h \
69 service/gsmnet.h \ 69 service/gsmnet.h \
70 service/gsmpbk.h \ 70 service/gsmpbk.h \
71 service/gsmprof.h \ 71 service/gsmprof.h \
72 service/gsmring.h \ 72 service/gsmring.h \
73 device/bluetoth/affix.h \ 73 device/bluetoth/affix.h \
74 device/bluetoth/blue_w32.h \
75 device/bluetoth/bluetoth.h \ 74 device/bluetoth/bluetoth.h \
76 device/bluetoth/bluez.h \ 75 device/bluetoth/bluez.h \
77 device/irda/irda.h \ 76 device/irda/irda.h \
78 device/irda/irda_unx.h \ 77 device/irda/irda_unx.h \
79 device/irda/irda_w32.h \
80 device/serial/ser_djg.h \ 78 device/serial/ser_djg.h \
81 device/serial/ser_unx.h \ 79 device/serial/ser_unx.h \
82 device/serial/ser_w32.h \
83 misc/coding/coding.h \ 80 misc/coding/coding.h \
84 misc/coding/md5.h \ 81 misc/coding/md5.h \
85 phone/alcatel/alcatel.h \ 82 phone/alcatel/alcatel.h \
86 phone/at/atgen.h \ 83 phone/at/atgen.h \
87 phone/nokia/ncommon.h \ 84 phone/nokia/ncommon.h \
88 phone/nokia/nfunc.h \ 85 phone/nokia/nfunc.h \
89 phone/nokia/nfuncold.h \ 86 phone/nokia/nfuncold.h \
90 phone/obex/obexgen.h \ 87 phone/obex/obexgen.h \
91 phone/symbian/mroutgen.h \ 88 phone/symbian/mroutgen.h \
92 protocol/alcatel/alcabus.h \ 89 protocol/alcatel/alcabus.h \
93 protocol/at/at.h \ 90 protocol/at/at.h \
94 protocol/nokia/fbus2.h \ 91 protocol/nokia/fbus2.h \
95 protocol/nokia/mbus2.h \ 92 protocol/nokia/mbus2.h \
96 protocol/nokia/phonet.h \ 93 protocol/nokia/phonet.h \
97 protocol/obex/obex.h \ 94 protocol/obex/obex.h \
98 protocol/symbian/mrouter.h \ 95 protocol/symbian/mrouter.h \
99 service/backup/backgen.h \ 96 service/backup/backgen.h \
100 service/backup/backics.h \ 97 service/backup/backics.h \
101 service/backup/backldif.h \ 98 service/backup/backldif.h \
102 service/backup/backlmb.h \ 99 service/backup/backlmb.h \
103 service/backup/backtext.h \ 100 service/backup/backtext.h \
104 service/backup/backvcf.h \ 101 service/backup/backvcf.h \
105 service/backup/backvcs.h \ 102 service/backup/backvcs.h \
106 service/backup/gsmback.h \ 103 service/backup/gsmback.h \
107 service/sms/gsmems.h \ 104 service/sms/gsmems.h \
108 service/sms/gsmmulti.h \ 105 service/sms/gsmmulti.h \
109 service/sms/gsmsms.h \ 106 service/sms/gsmsms.h \
110 phone/nokia/dct3/dct3comm.h \ 107 phone/nokia/dct3/dct3comm.h \
111 phone/nokia/dct3/dct3func.h \ 108 phone/nokia/dct3/dct3func.h \
112 phone/nokia/dct3/n6110.h \ 109 phone/nokia/dct3/n6110.h \
113 phone/nokia/dct3/n7110.h \ 110 phone/nokia/dct3/n7110.h \
114 phone/nokia/dct3/n9210.h \ 111 phone/nokia/dct3/n9210.h \
115 phone/nokia/dct4/dct4func.h \ 112 phone/nokia/dct4/dct4func.h \
116 phone/nokia/dct4/n3320.h \ 113 phone/nokia/dct4/n3320.h \
114 phone/nokia/dct3/n0650.h \
117 phone/nokia/dct4/n3650.h \ 115 phone/nokia/dct4/n3650.h \
118 phone/nokia/dct4/n6510.h 116 phone/nokia/dct4/n6510.h
119SOURCES +=gsmcomon.c \ 117SOURCES +=gsmcomon.c \
120gsmstate.c \ 118gsmstate.c \
121misc/misc.c \ 119misc/misc.c \
122misc/cfg.c \ 120misc/cfg.c \
123misc/coding/coding.c \ 121misc/coding/coding.c \
124misc/coding/md5.c \ 122misc/coding/md5.c \
125service/sms/gsmsms.c \ 123service/sms/gsmsms.c \
126service/sms/gsmems.c \ 124service/sms/gsmems.c \
127service/sms/gsmmulti.c \ 125service/sms/gsmmulti.c \
128service/gsmcal.c \ 126service/gsmcal.c \
129service/gsmdata.c \ 127service/gsmdata.c \
130service/gsmpbk.c \ 128service/gsmpbk.c \
131service/gsmring.c \ 129service/gsmring.c \
132service/gsmlogo.c \ 130service/gsmlogo.c \
133service/gsmmisc.c \ 131service/gsmmisc.c \
134service/gsmnet.c \ 132service/gsmnet.c \
135service/backup/gsmback.c \ 133service/backup/gsmback.c \
136service/backup/backldif.c \ 134service/backup/backldif.c \
137service/backup/backlmb.c \ 135service/backup/backlmb.c \
138service/backup/backtext.c \ 136service/backup/backtext.c \
139service/backup/backvcs.c \ 137service/backup/backvcs.c \
140service/backup/backvcf.c \ 138service/backup/backvcf.c \
141service/backup/backics.c \ 139service/backup/backics.c \
142device/bluetoth/affix.c \ 140device/bluetoth/affix.c \
143device/bluetoth/bluez.c \ 141device/bluetoth/bluez.c \
144device/bluetoth/blue_w32.c \
145device/bluetoth/bluetoth.c \ 142device/bluetoth/bluetoth.c \
146device/serial/ser_unx.c \ 143device/serial/ser_unx.c \
147device/serial/ser_djg.c \ 144device/serial/ser_djg.c \
148device/irda/irda.c \ 145device/irda/irda.c \
149device/devfunc.c \ 146device/devfunc.c \
150protocol/at/at.c \ 147protocol/at/at.c \
151protocol/alcatel/alcabus.c \ 148protocol/alcatel/alcabus.c \
152protocol/nokia/mbus2.c \ 149protocol/nokia/mbus2.c \
153protocol/nokia/fbus2.c \ 150protocol/nokia/fbus2.c \
154protocol/nokia/phonet.c \ 151protocol/nokia/phonet.c \
155protocol/obex/obex.c \ 152protocol/obex/obex.c \
156protocol/symbian/mrouter.c \ 153protocol/symbian/mrouter.c \
157phone/pfunc.c \ 154phone/pfunc.c \
158phone/at/atgen.c \ 155phone/at/atgen.c \
159phone/at/siemens.c \ 156phone/at/siemens.c \
160phone/at/samsung.c \ 157phone/at/samsung.c \
161phone/at/sonyeric.c \ 158phone/at/sonyeric.c \
162phone/alcatel/alcatel.c \ 159phone/alcatel/alcatel.c \
163phone/nokia/dct3/n6110.c \ 160phone/nokia/dct3/n6110.c \
164phone/nokia/dct3/n7110.c \ 161phone/nokia/dct3/n7110.c \
165phone/nokia/dct3/n9210.c \ 162phone/nokia/dct3/n9210.c \
166phone/nokia/dct3/dct3func.c \ 163phone/nokia/dct3/dct3func.c \
167phone/nokia/dct4/n3320.c \ 164phone/nokia/dct4/n3320.c \
168phone/nokia/dct4/n3650.c \ 165phone/nokia/dct4/n3650.c \
169phone/nokia/dct4/n6510.c \ 166phone/nokia/dct4/n6510.c \
167phone/nokia/dct3/n0650.c \
170phone/nokia/dct4/dct4func.c \ 168phone/nokia/dct4/dct4func.c \
171phone/nokia/nauto.c \ 169phone/nokia/nauto.c \
172phone/nokia/nfunc.c \ 170phone/nokia/nfunc.c \
173phone/nokia/nfuncold.c \ 171phone/nokia/nfuncold.c \
174phone/obex/obexgen.c \ 172phone/obex/obexgen.c \
175phone/symbian/mroutgen.c 173phone/symbian/mroutgen.c
176 174
177TARGET = kammu 175TARGET = kammu
178DESTDIR = $(QPEDIR)/lib 176DESTDIR = $(QPEDIR)/lib
179OBJECTS_DIR = obj/$(PLATFORM) 177OBJECTS_DIR = obj/$(PLATFORM)
180MOC_DIR = moc/$(PLATFORM) 178MOC_DIR = moc/$(PLATFORM)
181 CONFIG = warn_off release console 179 CONFIG = warn_off release console
180
181
182
183
184 # device/bluetoth/blue_w32.h \
185 # device/irda/irda_w32.h \
186 # device/serial/ser_w32.h \
187 # device/bluetoth/blue_w32.c \ \ No newline at end of file
diff --git a/gammu/emb/common/device/serial/ser_djg.c b/gammu/emb/common/device/serial/ser_djg.c
index 2524187..609deb8 100644
--- a/gammu/emb/common/device/serial/ser_djg.c
+++ b/gammu/emb/common/device/serial/ser_djg.c
@@ -1,74 +1,443 @@
1/* Some sources from SVAsync (c) 1996, 1997, Samuel Vincent
2 * 7337 Carioca Ct, Rohnert Park, Ca 94928
3 * "you may freely use it in your programs without paying me anything"
4 */
5/* Some sources from DZCOMM */
1 6
2#include "../../gsmstate.h" 7#include "../../gsmstate.h"
3 8
4#ifdef GSM_ENABLE_SERIALDEVICE 9#ifdef GSM_ENABLE_SERIALDEVICE
5#ifdef DJGPP 10#ifdef DJGPP
6 11
7#include "../../gsmcomon.h" 12#include "../../gsmcomon.h"
13#include "../../misc/coding/coding.h"
8#include "ser_djg.h" 14#include "ser_djg.h"
9 15
16#include <stdlib.h>
17#include <stdio.h>
18#include <string.h>
19#include <dos.h>
20#include <dpmi.h>
21#include <pc.h>
22#include <go32.h>
23#include <sys/farptr.h>
24#include <sys/movedata.h>
25#include <conio.h>
26
27extern unsigned short __djgpp_ds_alias;
28extern void SVAsyncProtISR(void);
29
30static unsigned char SVAsyncStatus=0;
31
32static void lock_interrupt_memory(void);
33static void unlock_interrupt_memory(void);
34
35 #define Ctrl8259_0 0x020 /* 8259 port */
36 #define Ctrl8259_1 0x021 /* 8259 port (Masks) */
37 #define BufSize 32768 /* Buffer Size */
38
39static unsigned char VectorNum; /* Vector Number */
40static unsigned char EnableIRQ; /* Mask to enable 8259 IRQ */
41static unsigned char DisableIRQ; /* Mask to disable 8259 IRQ */
42static _go32_dpmi_seginfo ProtVector; /* Old Protmode Vector */
43static _go32_dpmi_seginfo info; /* New Protmode Vector */
44
45/* Register Addresses for the UART */
46static unsigned short Port; /* Port Base Address */
47unsigned short THR; /* Transmitter Holding Register */
48unsigned short RDR; /* Reciever Data Register */
49unsigned short BRDL; /* Baud Rate Divisor, Low byte */
50unsigned short BRDH; /* Baud Rate Divisor, High Byte */
51unsigned short IER; /* Interupt Enable Register */
52unsigned short IIR; /* Interupt Identification Register */
53unsigned short FCR; /* FIFO Control Register */
54unsigned short LCR; /* Line Control Register */
55unsigned short MCR; /* Modem Control Register */
56unsigned short LSR; /* Line Status Register */
57unsigned short MSR; /* Modem Status Register */
58unsigned short SCR; /* SCR Register */
59
60/* Data Buffer */
61 unsigned volatile char RecBuffer[BufSize] = { 0 };
62 unsigned volatile int RecHead, RecTail;
63
64/* This uninstalls the ISR and resets the serial port. */
65static void SVAsyncStop(void)
66{
67 if(!SVAsyncStatus) return;
68 SVAsyncStatus = 0;
69
70 /***** Mask (disable) 8259 IRQ Interrupt */
71 outportb(Ctrl8259_1, (inportb(Ctrl8259_1) | DisableIRQ));
72
73 /***** Disable 8250 interrupt */
74 outportb(LCR, (inportb(LCR) & 0x7F));
75 outportb(IER, 0);
76
77 /***** Set bit 3 in MCR to 0 */
78 outportb(MCR, (inportb(MCR) & 0xF7));
79
80 /***** Interrupts are disabled. Restore saved interrupt vector. */
81 _go32_dpmi_set_protected_mode_interrupt_vector(VectorNum, &ProtVector);
82}
83
84/* This will empty the receive buffer */
85static void SVAsyncClear(void)
86{
87 disable();
88 RecHead = 0;
89 RecTail = 0;
90 enable();
91}
92
93
94/* Sets communication parameters
95 * Baud = 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 28800, 38400, 57600
96 * Control = The value to place in the LCR
97 */
98void SVAsyncSet(unsigned int Baud, unsigned int Control)
99{
100 int divisor;
101 unsigned char divlow, divhigh;
102
103 if (!Baud) return;
104
105 divisor = 115200 / Baud;
106
107 disable();
108
109 outportb(LCR, Control | 0x80); /* Set Port Toggle to BRDL/BRDH registers */
110 divlow = divisor & 0x000000ff;
111 divhigh = (divisor >> 8) & 0x000000ff;
112 outportb(BRDL, divlow); /* Set Baud Rate */
113 outportb(BRDH, divhigh);
114
115 outportb(LCR, Control & 0x007F); /* Set LCR and Port Toggle */
116
117 enable();
118}
119
120/* Sets various handshaking lines */
121void SVAsyncHand(unsigned int Hand)
122{
123 outportb(MCR, Hand | 0x08); /* Keep interrupt enable ON */
124}
125
126static void lock_interrupt_memory(void)
127{
128 int errval;
129 __dpmi_meminfo info;
130 unsigned long address;
131
132 __dpmi_get_segment_base_address(_my_ds(), &address);
133
134 info.address = (int) address + (int) &RDR;
135 info.size = sizeof(RDR);
136 errval = __dpmi_lock_linear_region(&info);
137 if(errval == -1) printf("Error in locking memory\n!");
138
139 info.address = (int) address + (int) &LSR;
140 info.size = sizeof(LSR);
141 errval = __dpmi_lock_linear_region(&info);
142 if(errval == -1) printf("Error in locking memory\n!");
143
144 info.address = (int) address + (int) &RecHead;
145 info.size = sizeof(RecHead);
146 errval = __dpmi_lock_linear_region(&info);
147 if(errval == -1) printf("Error in locking memory\n!");
148
149 info.address = (int) address + (int) &RecBuffer;
150 info.size = sizeof(RecBuffer);
151 errval = __dpmi_lock_linear_region(&info);
152 if(errval == -1) printf("Error in locking memory\n!");
153
154 info.address = (int) address + (int) RecBuffer;
155 info.size = BufSize;
156 errval = __dpmi_lock_linear_region(&info);
157 if(errval == -1) printf("Error in locking memory\n!");
158
159 __dpmi_get_segment_base_address(_my_cs(), &address);
160
161 info.address = (int) address + (int) SVAsyncProtISR;
162 info.size = 4096; /* 4096 bytes is probably overkill. */
163 errval = __dpmi_lock_linear_region(&info);
164 if(errval == -1) printf("Error in locking memory\n!");
165}
166
167static void unlock_interrupt_memory(void)
168{
169 __dpmi_meminfo info;
170 unsigned long address;
171
172 __dpmi_get_segment_base_address(_my_ds(), &address);
173 info.address = (int) address + (int) &RDR;
174 info.size = sizeof(RDR);
175 __dpmi_unlock_linear_region(&info);
176 info.address = (int) address + (int) &LSR;
177 info.size = sizeof(LSR);
178 __dpmi_unlock_linear_region(&info);
179 info.address = (int) address + (int) &RecHead;
180 info.size = sizeof(RecHead);
181 __dpmi_unlock_linear_region(&info);
182 info.address = (int) address + (int) &RecBuffer;
183 info.size = sizeof(RecBuffer);
184 __dpmi_unlock_linear_region(&info);
185 info.address = (int) address + (int) RecBuffer;
186 info.size = BufSize;
187 __dpmi_unlock_linear_region(&info);
188
189 __dpmi_get_segment_base_address(_my_cs(), &address);
190
191 info.address = (int) address + (int) SVAsyncProtISR;
192 info.size = 4096; /* probably overkill */
193 __dpmi_unlock_linear_region(&info);
194}
195
10static GSM_Error serial_close(GSM_StateMachine *s) 196static GSM_Error serial_close(GSM_StateMachine *s)
11{ 197{
12 GSM_Device_SerialData *d = &s->Device.Data.Serial; 198 SVAsyncStop();
13 199
14 return ERR_NOTIMPLEMENTED; 200 return ERR_NONE;
15} 201}
16 202
17static GSM_Error serial_open (GSM_StateMachine *s) 203static GSM_Error serial_open (GSM_StateMachine *s)
18{ 204{
19 GSM_Device_SerialData *d = &s->Device.Data.Serial; 205 GSM_Device_SerialData *d = &s->Device.Data.Serial;
20 206 unsigned char temp;
21 return ERR_NOTIMPLEMENTED; 207 int i;
208
209 /**** Set various things according to com port number */
210 if (mystrncasecmp(s->CurrentConfig->Device,"com1:",0)) {
211 Port = 0x03F8;
212 VectorNum = 0x0C;
213 EnableIRQ = 0xEF;
214 DisableIRQ = 0x10;
215 } else if (mystrncasecmp(s->CurrentConfig->Device,"com2:",0)) {
216 Port = 0x02F8;
217 VectorNum = 0x0B;
218 EnableIRQ = 0xF7;
219 DisableIRQ = 0x08;
220 } else if (mystrncasecmp(s->CurrentConfig->Device,"com3:",0)) {
221 Port = 0x03E8;
222 VectorNum = 0x0C;
223 EnableIRQ = 0xEF;
224 DisableIRQ = 0x10;
225 } else if (mystrncasecmp(s->CurrentConfig->Device,"com4:",0)) {
226 Port = 0x02E8;
227 VectorNum = 0x0B;
228 EnableIRQ = 0xF7;
229 DisableIRQ = 0x08;
230 } else return ERR_NOTSUPPORTED;
231
232 /**** Compute Register locations */
233 THR = Port;
234 RDR = Port;
235 BRDL = Port;
236 BRDH = 1 + Port;
237 IER = 1 + Port;
238 IIR = 2 + Port;
239 FCR = 2 + Port;
240 LCR = 3 + Port;
241 MCR = 4 + Port;
242 LSR = 5 + Port;
243 MSR = 6 + Port;
244 SCR = 7 + Port;
245
246 /***** Initalize Buffer */
247 SVAsyncClear();
248
249 lock_interrupt_memory();
250 atexit(unlock_interrupt_memory);
251 /***** Set bit 3 in MCR to 0 */
252 outportb(MCR, (inportb(MCR) & 0xF7));
253
254 /*** Save and reassign interrupt vectors */
255
256 _go32_dpmi_get_protected_mode_interrupt_vector(VectorNum, &ProtVector);
257
258 info.pm_offset = (int) SVAsyncProtISR;
259 info.pm_selector = _my_cs();
260 _go32_dpmi_set_protected_mode_interrupt_vector(VectorNum, &info);
261
262 atexit(SVAsyncStop);
263
264 /***** Enable 8259 interrupt (IRQ) line for this async adapter */
265 outportb(Ctrl8259_1, (inportb(Ctrl8259_1) & EnableIRQ));
266
267 /***** Enable 8250 Interrupt-on-data-ready */
268 outportb(LCR, (inportb(LCR) & 0x7F));
269
270 outportb(IER, 0);
271 if (inportb(IER)) {
272 SVAsyncStatus = 0;
273 return ERR_UNKNOWN;
274 }
275 outportb(IER, 0x01);
276
277 /***** Clear 8250 Status and data registers */
278 do {
279 temp=inportb(RDR);
280 temp=inportb(LSR);
281 temp=inportb(MSR);
282 temp=inportb(IIR);
283 } while(!(temp & 1));
284
285 /***** Set Bit 3 of MCR -- Enable interupts */
286 outportb(MCR, (inportb(MCR) | 0x08));
287
288 SVAsyncStatus = 1;
289 /***** Clear Buffer Just in case */
290 SVAsyncClear();
291
292 /* Code based on stuff from SVAsync lib.
293 * Clear UART Status and data registers
294 * setting up FIFO if possible
295 */
296 outportb(SCR, 0x55);
297 if (inportb(SCR) == 0x55) {
298 /* On the off chance that SCR is actually hardwired to 0x55,
299 * do the same check with a different value.
300 */
301 outportb(SCR, 0xAA);
302 if (inportb(SCR) == 0xAA) {
303 /* The chip is better than an 8250 - it has a scratch pad */
304 outportb(SCR, i); /* Set SCR back to what it was before */
305 inportb(SCR); /* Give slow motherboards a chance */
306
307 /* Is there a FIFO ? - go through twice for slow motherboards */
308 outportb(FCR, 0x01);
309 i = inportb(FCR);
310 outportb(FCR, 0x01);
311 i = inportb(FCR);
312
313 /* Some old stuff relies on this (no idea why) */
314 outportb(FCR, 0x00);
315 inportb(FCR); /* Give slow motherboards a chance */
316
317 if ((i&0x80) == 0) {
318 smprintf(s,"UART 16450 or UART 8250 with scratch pad\n");
319 } else if ((i&0x40) == 0) {
320 smprintf(s,"UART 16550 - broken FIFO\n");
321 } else {
322 /* It's a 16450A series : try and start the FIFO.
323 * It appears that some chips need a two call protocol, but
324 * those that don't seem to work even if you do start it
325 * twice. The first call is simply to start it, the second
326 * starts it and sets an 8 byte FIFO trigger level.
327 */
328 outportb(FCR, 0x01);
329 inportb(FCR); /* Give slow motherboards a chance */
330 outportb(FCR, 0x87);
331 inportb(FCR); /* Give slow motherboards a chance */
332
333 /* Check that the FIFO initialised */
334 if ((inportb(IIR) & 0xc0) != 0xc0) {
335 /*
336 * It didn't so we assume it isn't there but disable it to
337 * be on the safe side.
338 */
339 outportb(IIR, 0xfe);
340 inportb(IIR); /* Give slow motherboards a chance */
341 smprintf(s,"UART 16450A - FIFO disabled\n");
342 } else {
343 smprintf(s,"UART 16450A - FIFO enabled\n");
344 }
345 }
346 } else {
347 smprintf(s,"UART 8250\n");
348 }
349 }
350
351 d->Control = BITS_8 | STOP_1;
352 d->Parity = false;
353 d->Speed = 9600;
354 SVAsyncSet(d->Speed,d->Control | NO_PARITY);
355
356 return ERR_NONE;
22} 357}
23 358
24static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) 359static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity)
25{ 360{
26 GSM_Device_SerialData *d = &s->Device.Data.Serial; 361 GSM_Device_SerialData *d = &s->Device.Data.Serial;
27 362
28 return ERR_NOTIMPLEMENTED; 363 d->Parity = parity;
364
365 if (parity) {
366 SVAsyncSet(d->Speed, d->Control | ODD_PARITY);
367 } else {
368 SVAsyncSet(d->Speed, d->Control | NO_PARITY);
369 }
370
371 return ERR_NONE;
29} 372}
30 373
31static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) 374static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts)
32{ 375{
33 GSM_Device_SerialData *d = &s->Device.Data.Serial; 376 if (dtr && rts) {
377 SVAsyncHand(DTR | RTS);
378 } else if (dtr) {
379 SVAsyncHand(DTR);
380 } else if (rts) {
381 SVAsyncHand(RTS);
382 } else {
383 SVAsyncHand(0);
384 }
34 385
35 return ERR_NOTIMPLEMENTED; 386 return ERR_NONE;
36} 387}
37 388
38static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) 389static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
39{ 390{
40 GSM_Device_SerialData *d = &s->Device.Data.Serial; 391 GSM_Device_SerialData *d = &s->Device.Data.Serial;
41 392
42 return ERR_NOTIMPLEMENTED; 393 d->Speed = speed;
394
395 if (d->Parity) {
396 SVAsyncSet(d->Speed, d->Control | ODD_PARITY);
397 } else {
398 SVAsyncSet(d->Speed, d->Control | NO_PARITY);
399 }
400
401 return ERR_NONE;
43} 402}
44 403
45static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) 404static int serial_read(GSM_StateMachine *s, char *buf, size_t nbytes)
46{ 405{
47 GSM_Device_SerialData *d = &s->Device.Data.Serial; 406 if(RecTail == RecHead) return 0;
407
408 disable();
409 buf[0] = RecBuffer[RecTail++];
410 if(RecTail >= BufSize) RecTail = 0;
411 enable();
48 412
49 return 0; 413 return 1;
50} 414}
51 415
52static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes) 416static int serial_write(GSM_StateMachine *s, char *buf, size_t nbytes)
53{ 417{
54 GSM_Device_SerialData *d = &s->Device.Data.Serial; 418 int i;
419
420 for (i=0;i<nbytes;i++) {
421 while(~inportb(LSR) & 0x20);
422 outportb(THR, buf[i]);
423 }
55 424
56 return 0; 425 return i;
57} 426}
58 427
59GSM_Device_Functions SerialDevice = { 428GSM_Device_Functions SerialDevice = {
60 serial_open, 429 serial_open,
61 serial_close, 430 serial_close,
62 serial_setparity, 431 serial_setparity,
63 serial_setdtrrts, 432 serial_setdtrrts,
64 serial_setspeed, 433 serial_setspeed,
65 serial_read, 434 serial_read,
66 serial_write 435 serial_write
67}; 436};
68 437
69#endif 438#endif
70#endif 439#endif
71 440
72/* How should editor hadle tabs in this file? Add editor commands here. 441/* How should editor hadle tabs in this file? Add editor commands here.
73 * vim: noexpandtab sw=8 ts=8 sts=8: 442 * vim: noexpandtab sw=8 ts=8 sts=8:
74 */ 443 */
diff --git a/gammu/emb/common/device/serial/ser_djg.h b/gammu/emb/common/device/serial/ser_djg.h
index b35b282..3bb2a5b 100644
--- a/gammu/emb/common/device/serial/ser_djg.h
+++ b/gammu/emb/common/device/serial/ser_djg.h
@@ -1,15 +1,50 @@
1/* Some sources from SVAsync (c) 1996, 1997, Samuel Vincent
2 * 7337 Carioca Ct, Rohnert Park, Ca 94928
3 * "you may freely use it in your programs without paying me anything"
4 */
1 5
2#ifdef DJGPP 6#ifdef DJGPP
3#ifndef djgppserial_h 7#ifndef djgppserial_h
4#define djgppserial_h 8#define djgppserial_h
5 9
6typedef struct { 10typedef struct {
7 int hPhone; 11 int hPhone;
12 int Speed;
13 unsigned int Control;
14 bool Parity;
8} GSM_Device_SerialData; 15} GSM_Device_SerialData;
9 16
17/* Defines for Com Port Paramaters, the second paramater to SVAsyncSet() */
18#define BITS_8 0x03
19#define BITS_7 0x02
20#define STOP_1 0x00
21#define STOP_2 0x04
22#define EVEN_PARITY 0x18
23#define ODD_PARITY 0x08
24#define NO_PARITY 0x00
25
26/* Defines for SVAsyncHand() */
27#define DTR 0x01
28#define RTS 0x02
29#define USER 0x04
30#define LOOPBACK 0x10
31
32/* Defines for SVAsyncStat() */
33 #define D_CTS 0x0100
34 #define D_DSR 0x0200
35#define D_RI 0x0400
36 #define D_DCD 0x0800
37#define CTS 0x1000
38#define DSR 0x2000
39#define RI 0x4000
40#define DCD 0x8000
41 #define PARITY 0x0004
42#define THREMPTY 0x0020
43#define BREAKDET 0x1000
44
10#endif 45#endif
11#endif 46#endif
12 47
13/* How should editor hadle tabs in this file? Add editor commands here. 48/* How should editor hadle tabs in this file? Add editor commands here.
14 * vim: noexpandtab sw=8 ts=8 sts=8: 49 * vim: noexpandtab sw=8 ts=8 sts=8:
15 */ 50 */
diff --git a/gammu/emb/common/device/serial/ser_unx.c b/gammu/emb/common/device/serial/ser_unx.c
index 69c7515..18b5f6f 100644
--- a/gammu/emb/common/device/serial/ser_unx.c
+++ b/gammu/emb/common/device/serial/ser_unx.c
@@ -1,30 +1,39 @@
1/* (c) 2002-2004 by Marcin Wiacek */ 1/* (c) 2002-2004 by Marcin Wiacek */
2/* locking device and settings all speeds by Michal Cihar */ 2/* locking device and settings all speeds by Michal Cihar */
3/* based on some work from Gnokii (www.gnokii.org) 3/* based on some work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include "../../gsmstate.h" 17#include "../../gsmstate.h"
9 18
10#ifdef GSM_ENABLE_SERIALDEVICE 19#ifdef GSM_ENABLE_SERIALDEVICE
11#ifndef WIN32 20#ifndef WIN32
12#ifndef DJGPP 21#ifndef DJGPP
13 22
14#include <sys/file.h> 23#include <sys/file.h>
15#include <sys/time.h> 24#include <sys/time.h>
16#include <string.h> 25#include <string.h>
17#include <termios.h> 26#include <termios.h>
18#include <errno.h> 27#include <errno.h>
19 28
20#include "../../gsmcomon.h" 29#include "../../gsmcomon.h"
21#include "ser_unx.h" 30#include "ser_unx.h"
22 31
23#ifndef O_NONBLOCK 32#ifndef O_NONBLOCK
24# define O_NONBLOCK 0 33# define O_NONBLOCK 0
25#endif 34#endif
26 35
27#ifdef __NetBSD__ 36#ifdef __NetBSD__
28# define FNONBLOCK O_NONBLOCK 37# define FNONBLOCK O_NONBLOCK
29 38
30# define B57600 0010001 39# define B57600 0010001
@@ -39,50 +48,50 @@
39# define B1500000 0010012 48# define B1500000 0010012
40# define B2000000 0010013 49# define B2000000 0010013
41# define B2500000 0010014 50# define B2500000 0010014
42# define B3000000 0010015 51# define B3000000 0010015
43# define B3500000 0010016 52# define B3500000 0010016
44# define B4000000 0010017 53# define B4000000 0010017
45#endif 54#endif
46 55
47static GSM_Error serial_close(GSM_StateMachine *s) 56static GSM_Error serial_close(GSM_StateMachine *s)
48{ 57{
49 GSM_Device_SerialData *d = &s->Device.Data.Serial; 58 GSM_Device_SerialData *d = &s->Device.Data.Serial;
50 59
51 /* Restores old settings */ 60 /* Restores old settings */
52 tcsetattr(d->hPhone, TCSANOW, &d->old_settings); 61 tcsetattr(d->hPhone, TCSANOW, &d->old_settings);
53 62
54 /* Closes device */ 63 /* Closes device */
55 close(d->hPhone); 64 close(d->hPhone);
56 65
57 return ERR_NONE; 66 return ERR_NONE;
58} 67}
59 68
60static GSM_Error serial_open (GSM_StateMachine *s) 69static GSM_Error serial_open (GSM_StateMachine *s)
61{ 70{
62 GSM_Device_SerialData *d = &s->Device.Data.Serial; 71 GSM_Device_SerialData *d = &s->Device.Data.Serial;
63 struct termios t; 72 struct termios t;
64 int i; 73 int i;
65 74
66 /* O_NONBLOCK MUST is required to avoid waiting for DCD */ 75 /* O_NONBLOCK MUST is required to avoid waiting for DCD */
67 d->hPhone = open(s->CurrentConfig->Device, O_RDWR | O_NOCTTY | O_NONBLOCK); 76 d->hPhone = open(s->CurrentConfig->Device, O_RDWR | O_NOCTTY | O_NONBLOCK);
68 if (d->hPhone < 0) { 77 if (d->hPhone < 0) {
69 i = errno; 78 i = errno;
70 GSM_OSErrorInfo(s,"open in serial_open"); 79 GSM_OSErrorInfo(s,"open in serial_open");
71 if (i == 2) return ERR_DEVICENOTEXIST; //no such file or directory 80 if (i == 2) return ERR_DEVICENOTEXIST; //no such file or directory
72 if (i == 13) return ERR_DEVICENOPERMISSION;//permission denied 81 if (i == 13) return ERR_DEVICENOPERMISSION;//permission denied
73 return ERR_DEVICEOPENERROR; 82 return ERR_DEVICEOPENERROR;
74 } 83 }
75 84
76#ifdef TIOCEXCL 85#ifdef TIOCEXCL
77 /* open() calls from other applications shall fail now */ 86 /* open() calls from other applications shall fail now */
78 ioctl(d->hPhone, TIOCEXCL, (char *) 0); 87 ioctl(d->hPhone, TIOCEXCL, (char *) 0);
79#endif 88#endif
80 89
81 if (tcgetattr(d->hPhone, &d->old_settings) == -1) { 90 if (tcgetattr(d->hPhone, &d->old_settings) == -1) {
82 close(d->hPhone); 91 close(d->hPhone);
83 GSM_OSErrorInfo(s,"tcgetattr in serial_open"); 92 GSM_OSErrorInfo(s,"tcgetattr in serial_open");
84 return ERR_DEVICEREADERROR; 93 return ERR_DEVICEREADERROR;
85 } 94 }
86 95
87 if (tcflush(d->hPhone, TCIOFLUSH) == -1) { 96 if (tcflush(d->hPhone, TCIOFLUSH) == -1) {
88 serial_close(s); 97 serial_close(s);
@@ -103,76 +112,76 @@ static GSM_Error serial_open (GSM_StateMachine *s)
103 /* t.c_cflag |= CRTSCTS; */ 112 /* t.c_cflag |= CRTSCTS; */
104 t.c_lflag = 0; 113 t.c_lflag = 0;
105 t.c_cc[VMIN] = 1; 114 t.c_cc[VMIN] = 1;
106 t.c_cc[VTIME] = 0; 115 t.c_cc[VTIME] = 0;
107 116
108 if (tcsetattr(d->hPhone, TCSANOW, &t) == -1) { 117 if (tcsetattr(d->hPhone, TCSANOW, &t) == -1) {
109 serial_close(s); 118 serial_close(s);
110 GSM_OSErrorInfo(s,"tcsetattr in serial_open"); 119 GSM_OSErrorInfo(s,"tcsetattr in serial_open");
111 return ERR_DEVICEOPENERROR; 120 return ERR_DEVICEOPENERROR;
112 } 121 }
113 122
114 /* Making file descriptor asynchronous. */ 123 /* Making file descriptor asynchronous. */
115 if (fcntl(d->hPhone, F_SETFL, FASYNC | FNONBLOCK) == -1) { 124 if (fcntl(d->hPhone, F_SETFL, FASYNC | FNONBLOCK) == -1) {
116 serial_close(s); 125 serial_close(s);
117 GSM_OSErrorInfo(s,"fcntl in serial_open"); 126 GSM_OSErrorInfo(s,"fcntl in serial_open");
118 return ERR_DEVICEOPENERROR; 127 return ERR_DEVICEOPENERROR;
119 } 128 }
120 129
121 return ERR_NONE; 130 return ERR_NONE;
122} 131}
123 132
124static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) 133static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity)
125{ 134{
126 GSM_Device_SerialData *d = &s->Device.Data.Serial; 135 GSM_Device_SerialData *d = &s->Device.Data.Serial;
127 struct termios t; 136 struct termios t;
128 137
129 if (tcgetattr(d->hPhone, &t)) { 138 if (tcgetattr(d->hPhone, &t)) {
130 GSM_OSErrorInfo(s,"tcgetattr in serial_setparity"); 139 GSM_OSErrorInfo(s,"tcgetattr in serial_setparity");
131 return ERR_DEVICEREADERROR; 140 return ERR_DEVICEREADERROR;
132 } 141 }
133 142
134 if (parity) { 143 if (parity) {
135 t.c_cflag |= (PARENB | PARODD); 144 t.c_cflag |= (PARENB | PARODD);
136 t.c_iflag = 0; 145 t.c_iflag = 0;
137 } else { 146 } else {
138 t.c_iflag = IGNPAR; 147 t.c_iflag = IGNPAR;
139 } 148 }
140 149
141 if (tcsetattr(d->hPhone, TCSANOW, &t) == -1){ 150 if (tcsetattr(d->hPhone, TCSANOW, &t) == -1){
142 serial_close(s); 151 serial_close(s);
143 GSM_OSErrorInfo(s,"tcsetattr in serial_setparity"); 152 GSM_OSErrorInfo(s,"tcsetattr in serial_setparity");
144 return ERR_DEVICEPARITYERROR; 153 return ERR_DEVICEPARITYERROR;
145 } 154 }
146 155
147 return ERR_NONE; 156 return ERR_NONE;
148} 157}
149 158
150static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) 159static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts)
151{ 160{
152 GSM_Device_SerialData *d = &s->Device.Data.Serial; 161 GSM_Device_SerialData *d = &s->Device.Data.Serial;
153 struct termios t; 162 struct termios t;
154 unsigned int flags; 163 unsigned int flags;
155 164
156 if (tcgetattr(d->hPhone, &t)) { 165 if (tcgetattr(d->hPhone, &t)) {
157 GSM_OSErrorInfo(s,"tcgetattr in serial_setdtrrts"); 166 GSM_OSErrorInfo(s,"tcgetattr in serial_setdtrrts");
158 return ERR_DEVICEREADERROR; 167 return ERR_DEVICEREADERROR;
159 } 168 }
160 169
161#ifdef CRTSCTS 170#ifdef CRTSCTS
162 /* Disabling hardware flow control */ 171 /* Disabling hardware flow control */
163 t.c_cflag &= ~CRTSCTS; 172 t.c_cflag &= ~CRTSCTS;
164#endif 173#endif
165 174
166 if (tcsetattr(d->hPhone, TCSANOW, &t) == -1) { 175 if (tcsetattr(d->hPhone, TCSANOW, &t) == -1) {
167 serial_close(s); 176 serial_close(s);
168 GSM_OSErrorInfo(s,"tcsetattr in serial_setdtrrts"); 177 GSM_OSErrorInfo(s,"tcsetattr in serial_setdtrrts");
169 return ERR_DEVICEDTRRTSERROR; 178 return ERR_DEVICEDTRRTSERROR;
170 } 179 }
171 180
172 flags = TIOCM_DTR; 181 flags = TIOCM_DTR;
173 if (dtr) { 182 if (dtr) {
174 ioctl(d->hPhone, TIOCMBIS, &flags); 183 ioctl(d->hPhone, TIOCMBIS, &flags);
175 } else { 184 } else {
176 ioctl(d->hPhone, TIOCMBIC, &flags); 185 ioctl(d->hPhone, TIOCMBIC, &flags);
177 } 186 }
178 187
@@ -243,69 +252,69 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
243 case 3000000: speed2 = B3000000;break; 252 case 3000000: speed2 = B3000000;break;
244 case 3500000: speed2 = B3500000;break; 253 case 3500000: speed2 = B3500000;break;
245 case 4000000: speed2 = B4000000; break; 254 case 4000000: speed2 = B4000000; break;
246#endif 255#endif
247#endif 256#endif
248 } 257 }
249 258
250 /* This should work on all systems because it is done according to POSIX */ 259 /* This should work on all systems because it is done according to POSIX */
251 cfsetispeed(&t, speed2); 260 cfsetispeed(&t, speed2);
252 cfsetospeed(&t, speed2); 261 cfsetospeed(&t, speed2);
253 262
254 if (tcsetattr(d->hPhone, TCSADRAIN, &t) == -1) { 263 if (tcsetattr(d->hPhone, TCSADRAIN, &t) == -1) {
255 serial_close(s); 264 serial_close(s);
256 GSM_OSErrorInfo(s,"tcsetattr in serial_setspeed"); 265 GSM_OSErrorInfo(s,"tcsetattr in serial_setspeed");
257 return ERR_DEVICECHANGESPEEDERROR; 266 return ERR_DEVICECHANGESPEEDERROR;
258 } 267 }
259 268
260 return ERR_NONE; 269 return ERR_NONE;
261} 270}
262 271
263static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) 272static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes)
264{ 273{
265 GSM_Device_SerialData *d = &s->Device.Data.Serial; 274 GSM_Device_SerialData *d = &s->Device.Data.Serial;
266 struct timeval timeout2; 275 struct timeval timeout2;
267 fd_set readfds; 276 fd_set readfds;
268 int actual = 0; 277 int actual = 0;
269 278
270 FD_ZERO(&readfds); 279 FD_ZERO(&readfds);
271 FD_SET(d->hPhone, &readfds); 280 FD_SET(d->hPhone, &readfds);
272 281
273 timeout2.tv_sec = 0; 282 timeout2.tv_sec = 0;
274 timeout2.tv_usec = 1; 283 timeout2.tv_usec = 1;
275 284
276 if (select(d->hPhone+1, &readfds, NULL, NULL, &timeout2)) { 285 if (select(d->hPhone+1, &readfds, NULL, NULL, &timeout2)) {
277 actual = read(d->hPhone, buf, nbytes); 286 actual = read(d->hPhone, buf, nbytes);
278 if (actual == -1) GSM_OSErrorInfo(s,"serial_read"); 287 if (actual == -1) GSM_OSErrorInfo(s,"serial_read");
279 } 288 }
280 return actual; 289 return actual;
281} 290}
282 291
283static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes) 292static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes)
284{ 293{
285 GSM_Device_SerialData *d = &s->Device.Data.Serial; 294 GSM_Device_SerialData *d = &s->Device.Data.Serial;
286 int ret; 295 int ret;
287 size_t actual = 0; 296 size_t actual = 0;
288 297
289 do { 298 do {
290 ret = write(d->hPhone, (unsigned char *)buf, nbytes - actual); 299 ret = write(d->hPhone, (unsigned char *)buf, nbytes - actual);
291 if (ret < 0 && errno == EAGAIN) continue; 300 if (ret < 0 && errno == EAGAIN) continue;
292 if (ret < 0) { 301 if (ret < 0) {
293 if (actual != nbytes) GSM_OSErrorInfo(s,"serial_write"); 302 if (actual != nbytes) GSM_OSErrorInfo(s,"serial_write");
294 return actual; 303 return actual;
295 } 304 }
296 actual += ret; 305 actual += ret;
297 buf += ret; 306 buf += ret;
298 if (s->ConnectionType == GCT_FBUS2PL2303) my_sleep(1); 307 if (s->ConnectionType == GCT_FBUS2PL2303) my_sleep(1);
299 } while (actual < nbytes); 308 } while (actual < nbytes);
300 return actual; 309 return actual;
301} 310}
302 311
303GSM_Device_Functions SerialDevice = { 312GSM_Device_Functions SerialDevice = {
304 serial_open, 313 serial_open,
305 serial_close, 314 serial_close,
306 serial_setparity, 315 serial_setparity,
307 serial_setdtrrts, 316 serial_setdtrrts,
308 serial_setspeed, 317 serial_setspeed,
309 serial_read, 318 serial_read,
310 serial_write 319 serial_write
311}; 320};
diff --git a/gammu/emb/common/device/serial/ser_w32.c b/gammu/emb/common/device/serial/ser_w32.c
index 7d88fc7..a7919fe 100644
--- a/gammu/emb/common/device/serial/ser_w32.c
+++ b/gammu/emb/common/device/serial/ser_w32.c
@@ -1,30 +1,39 @@
1/* (c) 2002-2004 by Marcin Wiacek */ 1/* (c) 2002-2004 by Marcin Wiacek */
2/* based on some work from MSDN and others */ 2/* based on some work from MSDN and others */
3/* based on some work from Gnokii (www.gnokii.org) 3/* based on some work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include "../../gsmstate.h" 17#include "../../gsmstate.h"
9 18
10#ifdef GSM_ENABLE_SERIALDEVICE 19#ifdef GSM_ENABLE_SERIALDEVICE
11#ifdef WIN32 20#ifdef WIN32
12 21
13#include <windows.h> 22#include <windows.h>
14#include <string.h> 23#include <string.h>
15#include <stdio.h> 24#include <stdio.h>
16#include <io.h> 25#include <io.h>
17#include <memory.h> 26#include <memory.h>
18 27
19#include "../../gsmcomon.h" 28#include "../../gsmcomon.h"
20#include "ser_w32.h" 29#include "ser_w32.h"
21 30
22static GSM_Error serial_close(GSM_StateMachine *s) 31static GSM_Error serial_close(GSM_StateMachine *s)
23{ 32{
24 GSM_Device_SerialData *d = &s->Device.Data.Serial; 33 GSM_Device_SerialData *d = &s->Device.Data.Serial;
25 34
26 /* Disables all monitored events for device */ 35 /* Disables all monitored events for device */
27 SetCommMask(d->hPhone, 0); 36 SetCommMask(d->hPhone, 0);
28 37
29 /* Discards all characters from input/output buffer and terminates 38 /* Discards all characters from input/output buffer and terminates
30 * pending read/write operations 39 * pending read/write operations
diff --git a/gammu/emb/common/gsmstate.c b/gammu/emb/common/gsmstate.c
index 31e365d..c65dc01 100644
--- a/gammu/emb/common/gsmstate.c
+++ b/gammu/emb/common/gsmstate.c
@@ -533,49 +533,49 @@ GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer,
533 if (reply!=0) { 533 if (reply!=0) {
534 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR || 534 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR ||
535 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE) 535 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE)
536 { 536 {
537 smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type); 537 smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type);
538 } 538 }
539 } 539 }
540 error = s->Protocol.Functions->WriteMessage(s, buffer, length, type); 540 error = s->Protocol.Functions->WriteMessage(s, buffer, length, type);
541 if (error!=ERR_NONE) return error; 541 if (error!=ERR_NONE) return error;
542 542
543 error = GSM_WaitForOnce(s, buffer, length, type, time); 543 error = GSM_WaitForOnce(s, buffer, length, type, time);
544 if (error != ERR_TIMEOUT) return error; 544 if (error != ERR_TIMEOUT) return error;
545 } 545 }
546 546
547 return Phone->DispatchError; 547 return Phone->DispatchError;
548} 548}
549 549
550static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Reply, int *reply) 550static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Reply, int *reply)
551{ 551{
552 GSM_Phone_Data *Data = &s->Phone.Data; 552 GSM_Phone_Data *Data = &s->Phone.Data;
553 GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; 553 GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg;
554 bool execute; 554 bool execute;
555 bool available = false; 555 bool available = false;
556 int i = 0; 556 int i = 0;
557 //int j; 557 // int j;
558 558
559 while (Reply[i].requestID!=ID_None) { 559 while (Reply[i].requestID!=ID_None) {
560 execute=false; 560 execute=false;
561 /* Binary frames like in Nokia */ 561 /* Binary frames like in Nokia */
562 if (strlen(Reply[i].msgtype) < 2) { 562 if (strlen(Reply[i].msgtype) < 2) {
563 if (Reply[i].msgtype[0]==msg->Type) { 563 if (Reply[i].msgtype[0]==msg->Type) {
564 if (Reply[i].subtypechar!=0) { 564 if (Reply[i].subtypechar!=0) {
565 if (Reply[i].subtypechar<=msg->Length) { 565 if (Reply[i].subtypechar<=msg->Length) {
566 if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype) 566 if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype)
567 execute=true; 567 execute=true;
568 } 568 }
569 } else execute=true; 569 } else execute=true;
570 } 570 }
571 } else { 571 } else {
572 // printf("msg length %i %i\n",strlen(Reply[i].msgtype),msg->Length); 572 // printf("msg length %i %i\n",strlen(Reply[i].msgtype),msg->Length);
573 if ((int)strlen(Reply[i].msgtype)<msg->Length) { 573 if ((int)strlen(Reply[i].msgtype)<msg->Length) {
574 // printf("Comparing \"%s\" and \"",Reply[i].msgtype); 574 // printf("Comparing \"%s\" and \"",Reply[i].msgtype);
575 // for (j=0;j<strlen(Reply[i].msgtype);j++) { 575 // for (j=0;j<strlen(Reply[i].msgtype);j++) {
576 // if (msg->Buffer[j]!=13 && msg->Buffer[j]!=10) { 576 // if (msg->Buffer[j]!=13 && msg->Buffer[j]!=10) {
577 // printf("%c",msg->Buffer[j]); 577 // printf("%c",msg->Buffer[j]);
578 // } 578 // }
579 // } 579 // }
580 // printf("\"\n"); 580 // printf("\"\n");
581 if (strncmp(Reply[i].msgtype,msg->Buffer,strlen(Reply[i].msgtype))==0) { 581 if (strncmp(Reply[i].msgtype,msg->Buffer,strlen(Reply[i].msgtype))==0) {
@@ -849,48 +849,49 @@ bool GSM_ReadConfig(INI_Section *cfg_info, GSM_Config *cfg, int num)
849 if (!cfg->StartInfo) { 849 if (!cfg->StartInfo) {
850 free(cfg->StartInfo); 850 free(cfg->StartInfo);
851 cfg->StartInfo = strdup(DefaultStartInfo); 851 cfg->StartInfo = strdup(DefaultStartInfo);
852 } else { 852 } else {
853 cfg->DefaultStartInfo = false; 853 cfg->DefaultStartInfo = false;
854 } 854 }
855 return true; 855 return true;
856} 856}
857 857
858static OnePhoneModel allmodels[] = { 858static OnePhoneModel allmodels[] = {
859#ifdef GSM_ENABLE_NOKIA650 859#ifdef GSM_ENABLE_NOKIA650
860 {"0650" ,"THF-12","", {0}}, 860 {"0650" ,"THF-12","", {0}},
861#endif 861#endif
862#ifdef GSM_ENABLE_NOKIA6510 862#ifdef GSM_ENABLE_NOKIA6510
863 {"1100" ,"RH-18" ,"", {0}}, 863 {"1100" ,"RH-18" ,"", {0}},
864 {"1100a","RH-38" ,"", {0}}, 864 {"1100a","RH-38" ,"", {0}},
865 {"1100b","RH-36" ,"", {0}}, 865 {"1100b","RH-36" ,"", {0}},
866#endif 866#endif
867#ifdef GSM_ENABLE_NOKIA6110 867#ifdef GSM_ENABLE_NOKIA6110
868 {"2100" ,"NAM-2" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess 868 {"2100" ,"NAM-2" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess
869#endif 869#endif
870#ifdef GSM_ENABLE_NOKIA6510 870#ifdef GSM_ENABLE_NOKIA6510
871 {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme 871 {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme
872 {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme 872 {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme
873 {"3105" ,"RH-48" ,"Nokia 3105",{F_PBKTONEGAL,F_PBKSMSLIST,F_VOICETAGS,0}},//fixme
873 {"3108", "RH-6", "Nokia 3108",{0}}, //does it have irda ? 874 {"3108", "RH-6", "Nokia 3108",{0}}, //does it have irda ?
874 {"3200", "RH-30" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme 875 {"3200", "RH-30" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme
875 {"3200a","RH-31" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme 876 {"3200a","RH-31" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme
876#endif 877#endif
877#ifdef GSM_ENABLE_NOKIA6110 878#ifdef GSM_ENABLE_NOKIA6110
878 {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, 879 {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}},
879 {"3210" ,"NSE-9" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, 880 {"3210" ,"NSE-9" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}},
880#endif 881#endif
881#ifdef GSM_ENABLE_NOKIA6510 882#ifdef GSM_ENABLE_NOKIA6510
882 {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme 883 {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme
883 {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme 884 {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme
884#endif 885#endif
885#ifdef GSM_ENABLE_NOKIA6110 886#ifdef GSM_ENABLE_NOKIA6110
886 {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, 887 {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},
887#endif 888#endif
888#ifdef GSM_ENABLE_NOKIA3320 889#ifdef GSM_ENABLE_NOKIA3320
889 {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme 890 {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme
890#endif 891#endif
891#ifdef GSM_ENABLE_NOKIA6110 892#ifdef GSM_ENABLE_NOKIA6110
892 {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, 893 {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}},
893 {"3390" ,"NPB-1" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, 894 {"3390" ,"NPB-1" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}},
894 {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, 895 {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},
895#endif 896#endif
896#ifdef GSM_ENABLE_NOKIA6510 897#ifdef GSM_ENABLE_NOKIA6510
@@ -933,50 +934,50 @@ static OnePhoneModel allmodels[] = {
933#ifdef GSM_ENABLE_NOKIA6110 934#ifdef GSM_ENABLE_NOKIA6110
934 {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, 935 {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}},
935 {"6130" ,"NSK-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, 936 {"6130" ,"NSK-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}},
936 {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}}, 937 {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}},
937 {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, 938 {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}},
938#endif 939#endif
939#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 940#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
940 {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}}, 941 {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}},
941 {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, 942 {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}},
942#endif 943#endif
943#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) 944#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110)
944 {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}}, 945 {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}},
945 {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}}, 946 {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}},
946#endif 947#endif
947#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 948#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
948 {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, 949 {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}},
949 {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, 950 {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}},
950 {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}}, 951 {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}},
951 {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, 952 {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}},
952 {"6510" ,"NPM-9" ,"Nokia 6510", {F_TODO63,F_CAL65,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, 953 {"6510" ,"NPM-9" ,"Nokia 6510", {F_TODO63,F_CAL65,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}},
953 {"6610" ,"NHL-4U","Nokia 6610", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, 954 {"6610" ,"NHL-4U","Nokia 6610", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}},
954 {"6610i","RM-37" ,"Nokia 6610i",{F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, 955 {"6610i","RM-37" ,"Nokia 6610i",{F_PBKTONEGAL,F_TODO66,F_RADIO,0}},
955 {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, 956 {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},
956 {"6800" ,"NHL-6" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, 957 {"6800" ,"NHL-6" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},
957 {"6810" ,"RM-2" ,"Nokia 6810", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess 958 {"6810" ,"RM-2" ,"Nokia 6810", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_NOTES,0}},//quess
958 {"6820" ,"NHL-9" ,"Nokia 6820", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess 959 {"6820" ,"NHL-9" ,"Nokia 6820", {F_PBKTONEGAL,F_TODO66,F_PBKSMSLIST,F_NOTES,0}},//quess
959#endif 960#endif
960#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) 961#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110)
961 {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}}, 962 {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}},
962 {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}}, 963 {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}},
963#endif 964#endif
964#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 965#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
965 {"7200" ,"RH-23" ,"Nokia 7200", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,0}},//quess 966 {"7200" ,"RH-23" ,"Nokia 7200", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,0}},//quess
966 {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, 967 {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}},
967 {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, 968 {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}},
968 {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, 969 {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}},
969 {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}}, 970 {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}},
970#endif 971#endif
971#if defined(GSM_ENABLE_ATGEN) 972#if defined(GSM_ENABLE_ATGEN)
972 {"7650" ,"NHL-2" ,"Nokia 7650", {0}}, 973 {"7650" ,"NHL-2" ,"Nokia 7650", {0}},
973#endif 974#endif
974#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) 975#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110)
975 {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, 976 {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}},
976 {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}}, 977 {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}},
977 {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, 978 {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}},
978#endif 979#endif
979#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 980#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
980 {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, 981 {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}},
981 {"8390" ,"NSB-8" ,"Nokia 8390", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, 982 {"8390" ,"NSB-8" ,"Nokia 8390", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}},
982#endif 983#endif
diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h
index 2b4806c..6861fbc 100644
--- a/gammu/emb/common/gsmstate.h
+++ b/gammu/emb/common/gsmstate.h
@@ -357,48 +357,49 @@ typedef struct {
357 357
358/* -------------------------- Phone layer ---------------------------------- */ 358/* -------------------------- Phone layer ---------------------------------- */
359 359
360/** 360/**
361 * Phone requests identificators, these are used for internally identifying 361 * Phone requests identificators, these are used for internally identifying
362 * which operation is being performed. 362 * which operation is being performed.
363 */ 363 */
364typedef enum { 364typedef enum {
365 ID_None=1, 365 ID_None=1,
366 ID_GetModel, 366 ID_GetModel,
367 ID_GetFirmware, 367 ID_GetFirmware,
368 ID_EnableSecurity, 368 ID_EnableSecurity,
369 ID_GetIMEI, 369 ID_GetIMEI,
370 ID_GetDateTime, 370 ID_GetDateTime,
371 ID_GetAlarm, 371 ID_GetAlarm,
372 ID_GetMemory, 372 ID_GetMemory,
373 ID_GetMemoryStatus, 373 ID_GetMemoryStatus,
374 ID_GetSMSC, 374 ID_GetSMSC,
375 ID_GetSMSMessage, 375 ID_GetSMSMessage,
376 ID_EnableEcho, 376 ID_EnableEcho,
377 ID_EnableErrorInfo, 377 ID_EnableErrorInfo,
378 ID_SetOBEX, 378 ID_SetOBEX,
379 ID_SetUSSD, 379 ID_SetUSSD,
380 ID_GetNote, 380 ID_GetNote,
381 ID_SetNote,
381 ID_GetSignalQuality, 382 ID_GetSignalQuality,
382 ID_GetBatteryCharge, 383 ID_GetBatteryCharge,
383 ID_GetSMSFolders, 384 ID_GetSMSFolders,
384 ID_GetSMSFolderStatus, 385 ID_GetSMSFolderStatus,
385 ID_GetSMSStatus, 386 ID_GetSMSStatus,
386 ID_AddSMSFolder, 387 ID_AddSMSFolder,
387 ID_GetNetworkInfo, 388 ID_GetNetworkInfo,
388 ID_GetRingtone, 389 ID_GetRingtone,
389 ID_DialVoice, 390 ID_DialVoice,
390 ID_GetCalendarNotesInfo, 391 ID_GetCalendarNotesInfo,
391 ID_GetCalendarNote, 392 ID_GetCalendarNote,
392 ID_GetSecurityCode, 393 ID_GetSecurityCode,
393 ID_GetWAPBookmark, 394 ID_GetWAPBookmark,
394 ID_GetBitmap, 395 ID_GetBitmap,
395 ID_SaveSMSMessage, 396 ID_SaveSMSMessage,
396 ID_CancelCall, 397 ID_CancelCall,
397 ID_SetDateTime, 398 ID_SetDateTime,
398 ID_SetAlarm, 399 ID_SetAlarm,
399 ID_DisableConnectFunc, 400 ID_DisableConnectFunc,
400 ID_EnableConnectFunc, 401 ID_EnableConnectFunc,
401 ID_AnswerCall, 402 ID_AnswerCall,
402 ID_SetBitmap, 403 ID_SetBitmap,
403 ID_SetRingtone, 404 ID_SetRingtone,
404 ID_DeleteSMSMessage, 405 ID_DeleteSMSMessage,
@@ -1269,51 +1270,76 @@ typedef struct {
1269 * Sets calendar entry 1270 * Sets calendar entry
1270 */ 1271 */
1271 GSM_Error (*SetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); 1272 GSM_Error (*SetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note);
1272 /** 1273 /**
1273 * Adds calendar entry. 1274 * Adds calendar entry.
1274 */ 1275 */
1275 GSM_Error (*AddCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); 1276 GSM_Error (*AddCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note);
1276 /** 1277 /**
1277 * Deletes calendar entry. 1278 * Deletes calendar entry.
1278 */ 1279 */
1279 GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); 1280 GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note);
1280 /** 1281 /**
1281 * Deletes all calendar entries. 1282 * Deletes all calendar entries.
1282 */ 1283 */
1283 GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s); 1284 GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s);
1284 /** 1285 /**
1285 * Reads calendar settings. 1286 * Reads calendar settings.
1286 */ 1287 */
1287 GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); 1288 GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings);
1288 /** 1289 /**
1289 * Sets calendar settings. 1290 * Sets calendar settings.
1290 */ 1291 */
1291 GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); 1292 GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings);
1292 /** 1293 /**
1293 * Gets note. 1294 * Retrieves notes status (number of used entries).
1294 */ 1295 */
1295 GSM_Error (*GetNextNote)(GSM_StateMachine *s, GSM_NoteEntry *Note, bool refresh); 1296 GSM_Error (*GetNotesStatus) (GSM_StateMachine *s, GSM_ToDoStatus *status);
1297 /**
1298 * Retrieves notes entry.
1299 */
1300 GSM_Error (*GetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1301 /**
1302 * Retrieves note entry. This is useful for continuous reading of all
1303 * notes entries.
1304 */
1305 GSM_Error (*GetNextNote) (GSM_StateMachine *s, GSM_NoteEntry *Note, bool start);
1306 /**
1307 * Sets note entry
1308 */
1309 GSM_Error (*SetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1310 /**
1311 * Adds note entry.
1312 */
1313 GSM_Error (*AddNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1314 /**
1315 * Deletes note entry.
1316 */
1317 GSM_Error (*DeleteNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1318 /**
1319 * Deletes all notes entries.
1320 */
1321 GSM_Error (*DeleteAllNotes) (GSM_StateMachine *s);
1296 /** 1322 /**
1297 * Reads profile. 1323 * Reads profile.
1298 */ 1324 */
1299 GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); 1325 GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile);
1300 /** 1326 /**
1301 * Updates profile. 1327 * Updates profile.
1302 */ 1328 */
1303 GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); 1329 GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile);
1304 /** 1330 /**
1305 * Reads FM station. 1331 * Reads FM station.
1306 */ 1332 */
1307 GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); 1333 GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation);
1308 /** 1334 /**
1309 * Sets FM station. 1335 * Sets FM station.
1310 */ 1336 */
1311 GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); 1337 GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation);
1312 /** 1338 /**
1313 * Clears defined FM stations. 1339 * Clears defined FM stations.
1314 */ 1340 */
1315 GSM_Error (*ClearFMStations) (GSM_StateMachine *s); 1341 GSM_Error (*ClearFMStations) (GSM_StateMachine *s);
1316 /** 1342 /**
1317 * Gets next filename from filesystem. 1343 * Gets next filename from filesystem.
1318 */ 1344 */
1319 GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start); 1345 GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start);
diff --git a/gammu/emb/common/phone/alcatel/alcatel.c b/gammu/emb/common/phone/alcatel/alcatel.c
index 3821f13..b75077f 100644
--- a/gammu/emb/common/phone/alcatel/alcatel.c
+++ b/gammu/emb/common/phone/alcatel/alcatel.c
@@ -3958,46 +3958,52 @@ GSM_Phone_Functions ALCATELPhone = {
3958 NOTSUPPORTED, /* GetMMSSettings */ 3958 NOTSUPPORTED, /* GetMMSSettings */
3959 NOTSUPPORTED, /* SetMMSSettings */ 3959 NOTSUPPORTED, /* SetMMSSettings */
3960 NOTSUPPORTED, /* GetSyncMLSettings*/ 3960 NOTSUPPORTED, /* GetSyncMLSettings*/
3961 NOTSUPPORTED, /* SetSyncMLSettings*/ 3961 NOTSUPPORTED, /* SetSyncMLSettings*/
3962 NOTSUPPORTED, /* GetChatSettings */ 3962 NOTSUPPORTED, /* GetChatSettings */
3963 NOTSUPPORTED, /* SetChatSettings */ 3963 NOTSUPPORTED, /* SetChatSettings */
3964 NOTSUPPORTED, /* GetBitmap */ 3964 NOTSUPPORTED, /* GetBitmap */
3965 NOTSUPPORTED, /* SetBitmap */ 3965 NOTSUPPORTED, /* SetBitmap */
3966 ALCATEL_GetToDoStatus, 3966 ALCATEL_GetToDoStatus,
3967 ALCATEL_GetToDo, 3967 ALCATEL_GetToDo,
3968 ALCATEL_GetNextToDo, 3968 ALCATEL_GetNextToDo,
3969 ALCATEL_SetToDo, 3969 ALCATEL_SetToDo,
3970 ALCATEL_AddToDo, 3970 ALCATEL_AddToDo,
3971 ALCATEL_DeleteToDo, 3971 ALCATEL_DeleteToDo,
3972 ALCATEL_DeleteAllToDo, 3972 ALCATEL_DeleteAllToDo,
3973 ALCATEL_GetCalendarStatus, 3973 ALCATEL_GetCalendarStatus,
3974 ALCATEL_GetCalendar, 3974 ALCATEL_GetCalendar,
3975 ALCATEL_GetNextCalendar, 3975 ALCATEL_GetNextCalendar,
3976 ALCATEL_SetCalendar, 3976 ALCATEL_SetCalendar,
3977 ALCATEL_AddCalendar, 3977 ALCATEL_AddCalendar,
3978 ALCATEL_DeleteCalendar, 3978 ALCATEL_DeleteCalendar,
3979 ALCATEL_DeleteAllCalendar, 3979 ALCATEL_DeleteAllCalendar,
3980 NOTSUPPORTED, /* GetCalendarSettings*/ 3980 NOTSUPPORTED, /* GetCalendarSettings*/
3981 NOTSUPPORTED, /* SetCalendarSettings*/ 3981 NOTSUPPORTED, /* SetCalendarSettings*/
3982 NOTSUPPORTED, /* GetNoteStatus */
3983 NOTSUPPORTED, /* GetNote */
3982 NOTSUPPORTED, /* GetNextNote */ 3984 NOTSUPPORTED, /* GetNextNote */
3985 NOTSUPPORTED, /* SetNote */
3986 NOTSUPPORTED, /* AddNote */
3987 NOTSUPPORTED, /* DeleteNote */
3988 NOTSUPPORTED, /* DeleteAllNotes */
3983 NOTSUPPORTED, /* GetProfile */ 3989 NOTSUPPORTED, /* GetProfile */
3984 NOTSUPPORTED, /* SetProfile */ 3990 NOTSUPPORTED, /* SetProfile */
3985 NOTSUPPORTED, /* GetFMStation */ 3991 NOTSUPPORTED, /* GetFMStation */
3986 NOTSUPPORTED, /* SetFMStation */ 3992 NOTSUPPORTED, /* SetFMStation */
3987 NOTSUPPORTED, /* ClearFMStations */ 3993 NOTSUPPORTED, /* ClearFMStations */
3988 NOTSUPPORTED, /* GetNextFileFolder*/ 3994 NOTSUPPORTED, /* GetNextFileFolder*/
3989 NOTSUPPORTED, /* GetFilePart */ 3995 NOTSUPPORTED, /* GetFilePart */
3990 NOTSUPPORTED, /* AddFilePart */ 3996 NOTSUPPORTED, /* AddFilePart */
3991 NOTSUPPORTED, /* GetFileSystemStatus*/ 3997 NOTSUPPORTED, /* GetFileSystemStatus*/
3992 NOTSUPPORTED, /* DeleteFile */ 3998 NOTSUPPORTED, /* DeleteFile */
3993 NOTSUPPORTED, /* AddFolder */ 3999 NOTSUPPORTED, /* AddFolder */
3994 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 4000 NOTSUPPORTED, /* GetGPRSAccessPoint*/
3995 NOTSUPPORTED /* SetGPRSAccessPoint*/ 4001 NOTSUPPORTED /* SetGPRSAccessPoint*/
3996}; 4002};
3997 4003
3998#endif 4004#endif
3999#endif 4005#endif
4000 4006
4001/* How should editor hadle tabs in this file? Add editor commands here. 4007/* How should editor hadle tabs in this file? Add editor commands here.
4002 * vim: noexpandtab sw=8 ts=8 sts=8: 4008 * vim: noexpandtab sw=8 ts=8 sts=8:
4003 */ 4009 */
diff --git a/gammu/emb/common/phone/at/atgen.c b/gammu/emb/common/phone/at/atgen.c
index ba23eb2..a875f0a 100644
--- a/gammu/emb/common/phone/at/atgen.c
+++ b/gammu/emb/common/phone/at/atgen.c
@@ -675,49 +675,49 @@ GSM_Error ATGEN_Initialise(GSM_StateMachine *s)
675 675
676 smprintf(s, "Enabling CME errors\n"); 676 smprintf(s, "Enabling CME errors\n");
677 /* Try numeric errors */ 677 /* Try numeric errors */
678 if (GSM_WaitFor (s, "AT+CMEE=1\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) { 678 if (GSM_WaitFor (s, "AT+CMEE=1\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) {
679 /* Try textual errors */ 679 /* Try textual errors */
680 if (GSM_WaitFor (s, "AT+CMEE=2\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) { 680 if (GSM_WaitFor (s, "AT+CMEE=2\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) {
681 smprintf(s, "CME errors could not be enabled, some error types won't be detected.\n"); 681 smprintf(s, "CME errors could not be enabled, some error types won't be detected.\n");
682 } 682 }
683 } 683 }
684 684
685 error = ATGEN_GetModel(s); 685 error = ATGEN_GetModel(s);
686 if (error != ERR_NONE) return error; 686 if (error != ERR_NONE) return error;
687 687
688 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_SLOWWRITE)) { 688 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_SLOWWRITE)) {
689 s->Protocol.Data.AT.FastWrite = true; 689 s->Protocol.Data.AT.FastWrite = true;
690 } 690 }
691 691
692 return error; 692 return error;
693} 693}
694 694
695GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) 695GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
696{ 696{
697 unsigned char req[50]; 697 unsigned char req[50];
698 698
699 if (smsc->Location!=1) return ERR_NOTSUPPORTED; 699 if (smsc->Location!=1) return ERR_INVALIDLOCATION;
700 700
701 sprintf(req, "AT+CSCA=\"%s\"\r",DecodeUnicodeString(smsc->Number)); 701 sprintf(req, "AT+CSCA=\"%s\"\r",DecodeUnicodeString(smsc->Number));
702 702
703 smprintf(s, "Setting SMSC\n"); 703 smprintf(s, "Setting SMSC\n");
704 return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetSMSC); 704 return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetSMSC);
705} 705}
706 706
707GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *s) 707GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *s)
708{ 708{
709 switch (s->Phone.Data.Priv.ATGEN.ReplyState) { 709 switch (s->Phone.Data.Priv.ATGEN.ReplyState) {
710 case AT_Reply_OK: 710 case AT_Reply_OK:
711 /* Reply here is: 711 /* Reply here is:
712 * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] 712 * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]]
713 * each memory is in quotes, 713 * each memory is in quotes,
714 * Example: ("SM"), ("SM"), ("SM") 714 * Example: ("SM"), ("SM"), ("SM")
715 * 715 *
716 * We need to get from this supported memories. For this case 716 * We need to get from this supported memories. For this case
717 * we assume, that just appearence of memory makes it 717 * we assume, that just appearence of memory makes it
718 * available for everything. Then we need to find out whether 718 * available for everything. Then we need to find out whether
719 * phone supports writing to memory. This is done by searching 719 * phone supports writing to memory. This is done by searching
720 * for "), (", which will appear between lists. 720 * for "), (", which will appear between lists.
721 */ 721 */
722 s->Phone.Data.Priv.ATGEN.CanSaveSMS = false; 722 s->Phone.Data.Priv.ATGEN.CanSaveSMS = false;
723 if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) { 723 if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) {
@@ -3818,45 +3818,51 @@ GSM_Phone_Functions ATGENPhone = {
3818 NOTSUPPORTED, /* GetMMSSettings */ 3818 NOTSUPPORTED, /* GetMMSSettings */
3819 NOTSUPPORTED, /* SetMMSSettings */ 3819 NOTSUPPORTED, /* SetMMSSettings */
3820 NOTSUPPORTED, /* GetSyncMLSettings*/ 3820 NOTSUPPORTED, /* GetSyncMLSettings*/
3821 NOTSUPPORTED, /* SetSyncMLSettings*/ 3821 NOTSUPPORTED, /* SetSyncMLSettings*/
3822 NOTSUPPORTED, /* GetChatSettings */ 3822 NOTSUPPORTED, /* GetChatSettings */
3823 NOTSUPPORTED, /* SetChatSettings */ 3823 NOTSUPPORTED, /* SetChatSettings */
3824 ATGEN_GetBitmap, /* GetBitmap */ 3824 ATGEN_GetBitmap, /* GetBitmap */
3825 ATGEN_SetBitmap, /* SetBitmap */ 3825 ATGEN_SetBitmap, /* SetBitmap */
3826 SONYERIC_GetToDoStatus, 3826 SONYERIC_GetToDoStatus,
3827 NOTSUPPORTED, /* GetToDo */ 3827 NOTSUPPORTED, /* GetToDo */
3828 SONYERIC_GetNextToDo, 3828 SONYERIC_GetNextToDo,
3829 NOTSUPPORTED, /* SetToDo */ 3829 NOTSUPPORTED, /* SetToDo */
3830 SONYERIC_AddToDo, 3830 SONYERIC_AddToDo,
3831 NOTSUPPORTED, /* DeleteToDo */ 3831 NOTSUPPORTED, /* DeleteToDo */
3832 SONYERIC_DeleteAllToDo, 3832 SONYERIC_DeleteAllToDo,
3833 SONYERIC_GetCalendarStatus, 3833 SONYERIC_GetCalendarStatus,
3834 NOTIMPLEMENTED, /* GetCalendar */ 3834 NOTIMPLEMENTED, /* GetCalendar */
3835 ATGEN_GetNextCalendar, 3835 ATGEN_GetNextCalendar,
3836 NOTIMPLEMENTED, /* SetCalendar */ 3836 NOTIMPLEMENTED, /* SetCalendar */
3837 ATGEN_AddCalendarNote, 3837 ATGEN_AddCalendarNote,
3838 ATGEN_DelCalendarNote, 3838 ATGEN_DelCalendarNote,
3839 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 3839 NOTIMPLEMENTED, /* DeleteAllCalendar*/
3840 NOTSUPPORTED, /* GetCalendarSettings*/ 3840 NOTSUPPORTED, /* GetCalendarSettings*/
3841 NOTSUPPORTED, /* SetCalendarSettings*/ 3841 NOTSUPPORTED, /* SetCalendarSettings*/
3842 NOTSUPPORTED, /* GetNoteStatus */
3843 NOTSUPPORTED, /* GetNote */
3842 NOTSUPPORTED, /* GetNextNote */ 3844 NOTSUPPORTED, /* GetNextNote */
3845 NOTSUPPORTED, /* SetNote */
3846 NOTSUPPORTED, /* AddNote */
3847 NOTSUPPORTED, /* DeleteNote */
3848 NOTSUPPORTED, /* DeleteAllNotes */
3843 NOTSUPPORTED, /* GetProfile */ 3849 NOTSUPPORTED, /* GetProfile */
3844 NOTSUPPORTED, /* SetProfile */ 3850 NOTSUPPORTED, /* SetProfile */
3845 NOTSUPPORTED, /* GetFMStation */ 3851 NOTSUPPORTED, /* GetFMStation */
3846 NOTSUPPORTED, /* SetFMStation */ 3852 NOTSUPPORTED, /* SetFMStation */
3847 NOTSUPPORTED, /* ClearFMStations */ 3853 NOTSUPPORTED, /* ClearFMStations */
3848 NOTSUPPORTED, /* GetNextFileFolder*/ 3854 NOTSUPPORTED, /* GetNextFileFolder*/
3849 NOTSUPPORTED, /* GetFilePart */ 3855 NOTSUPPORTED, /* GetFilePart */
3850 NOTSUPPORTED, /* AddFile */ 3856 NOTSUPPORTED, /* AddFile */
3851 NOTSUPPORTED, /* GetFileSystemStatus*/ 3857 NOTSUPPORTED, /* GetFileSystemStatus*/
3852 NOTSUPPORTED, /* DeleteFile */ 3858 NOTSUPPORTED, /* DeleteFile */
3853 NOTSUPPORTED, /* AddFolder */ 3859 NOTSUPPORTED, /* AddFolder */
3854 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 3860 NOTSUPPORTED, /* GetGPRSAccessPoint*/
3855 NOTSUPPORTED /* SetGPRSAccessPoint*/ 3861 NOTSUPPORTED /* SetGPRSAccessPoint*/
3856}; 3862};
3857 3863
3858#endif 3864#endif
3859 3865
3860/* How should editor hadle tabs in this file? Add editor commands here. 3866/* How should editor hadle tabs in this file? Add editor commands here.
3861 * vim: noexpandtab sw=8 ts=8 sts=8: 3867 * vim: noexpandtab sw=8 ts=8 sts=8:
3862 */ 3868 */
diff --git a/gammu/emb/common/phone/at/sonyeric.c b/gammu/emb/common/phone/at/sonyeric.c
index 8eeb39b..363e043 100644
--- a/gammu/emb/common/phone/at/sonyeric.c
+++ b/gammu/emb/common/phone/at/sonyeric.c
@@ -1,44 +1,45 @@
1/* (c) 2003 by Marcin Wiacek */ 1/* (c) 2003 by Marcin Wiacek */
2 2
3#include "../../gsmstate.h" 3#include "../../gsmstate.h"
4 4
5#ifdef GSM_ENABLE_ATGEN 5#ifdef GSM_ENABLE_ATGEN
6 6
7#include <string.h> 7#include <string.h>
8#include <time.h> 8#include <time.h>
9#include <ctype.h> 9#include <ctype.h>
10 10
11#include "../../gsmcomon.h" 11#include "../../gsmcomon.h"
12#include "../../misc/coding/coding.h" 12#include "../../misc/coding/coding.h"
13 13
14#include "atgen.h" 14#include "atgen.h"
15#include "sonyeric.h" 15#include "sonyeric.h"
16 16
17#ifdef GSM_ENABLE_OBEXGEN 17#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
18 18
19#include "../obex/obexgen.h" 19#include "../obex/obexgen.h"
20 20
21 extern GSM_Protocol_Functions OBEXProtocol;
21 extern GSM_Reply_FunctionOBEXGENReplyFunctions[]; 22 extern GSM_Reply_FunctionOBEXGENReplyFunctions[];
22 extern GSM_Reply_FunctionATGENReplyFunctions[]; 23 extern GSM_Reply_FunctionATGENReplyFunctions[];
23 24
24static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s) 25static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s)
25{ 26{
26 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 27 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
27 GSM_Error error; 28 GSM_Error error;
28 29
29 if (Priv->OBEX) return ERR_NONE; 30 if (Priv->OBEX) return ERR_NONE;
30 31
31 dbgprintf ("Changing to OBEX\n"); 32 dbgprintf ("Changing to OBEX\n");
32 33
33 error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX); 34 error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX);
34 if (error != ERR_NONE) return error; 35 if (error != ERR_NONE) return error;
35 36
36 error = s->Protocol.Functions->Terminate(s); 37 error = s->Protocol.Functions->Terminate(s);
37 if (error != ERR_NONE) return error; 38 if (error != ERR_NONE) return error;
38 39
39 s->Protocol.Functions = &OBEXProtocol; 40 s->Protocol.Functions = &OBEXProtocol;
40 error = s->Protocol.Functions->Initialise(s); 41 error = s->Protocol.Functions->Initialise(s);
41 if (error != ERR_NONE) { 42 if (error != ERR_NONE) {
42 s->Protocol.Functions = &ATProtocol; 43 s->Protocol.Functions = &ATProtocol;
43 return error; 44 return error;
44 } 45 }
@@ -103,190 +104,190 @@ static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName,
103 GSM_File File; 104 GSM_File File;
104 int Pos = 0; 105 int Pos = 0;
105 106
106 error = SONYERIC_SetOBEXMode(s); 107 error = SONYERIC_SetOBEXMode(s);
107 if (error != ERR_NONE) return error; 108 if (error != ERR_NONE) return error;
108 109
109 strcpy(File.ID_FullName,FileName); 110 strcpy(File.ID_FullName,FileName);
110 EncodeUnicode(File.Name,FileName,strlen(FileName)); 111 EncodeUnicode(File.Name,FileName,strlen(FileName));
111 File.Used = Length; 112 File.Used = Length;
112 File.Buffer = malloc(Length); 113 File.Buffer = malloc(Length);
113 memcpy(File.Buffer,Buffer,Length); 114 memcpy(File.Buffer,Buffer,Length);
114 115
115 error = ERR_NONE; 116 error = ERR_NONE;
116 while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos); 117 while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos);
117 free(File.Buffer); 118 free(File.Buffer);
118 if (error != ERR_EMPTY) return error; 119 if (error != ERR_EMPTY) return error;
119 120
120 return SONYERIC_SetATMode(s); 121 return SONYERIC_SetATMode(s);
121} 122}
122 123
123#endif 124#endif
124 125
125GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) 126GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start)
126{ 127{
127#ifdef GSM_ENABLE_OBEXGEN 128#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
128 GSM_Error error; 129 GSM_Error error;
129 GSM_ToDoEntry ToDo; 130 GSM_ToDoEntry ToDo;
130 int Pos, num, Loc; 131 int Pos, num, Loc;
131 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 132 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
132 133
133 if (start) { 134 if (start) {
134 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); 135 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
135 if (error != ERR_NONE) return error; 136 if (error != ERR_NONE) return error;
136 137
137 Note->Location = 1; 138 Note->Location = 1;
138 } else { 139 } else {
139 Note->Location++; 140 Note->Location++;
140 } 141 }
141 smprintf(s, "Getting calendar note %i\n",Note->Location); 142 smprintf(s, "Getting calendar note %i\n",Note->Location);
142 143
143 Loc = Note->Location; 144 Loc = Note->Location;
144 Pos = 0; 145 Pos = 0;
145 num = 0; 146 num = 0;
146 while (1) { 147 while (1) {
147 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, Note, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); 148 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, Note, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
148 if (error == ERR_EMPTY) break; 149 if (error == ERR_EMPTY) break;
149 if (error != ERR_NONE) return error; 150 if (error != ERR_NONE) return error;
150 if (Note->EntriesNum != 0) { 151 if (Note->EntriesNum != 0) {
151 num++; 152 num++;
152 if (num == Loc) return ERR_NONE; 153 if (num == Loc) return ERR_NONE;
153 } 154 }
154 } 155 }
155 return ERR_EMPTY; 156 return ERR_EMPTY;
156#else 157#else
157 return ERR_SOURCENOTAVAILABLE; 158 return ERR_SOURCENOTAVAILABLE;
158#endif 159#endif
159} 160}
160 161
161GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start) 162GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start)
162{ 163{
163#ifdef GSM_ENABLE_OBEXGEN 164#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
164 GSM_Error error; 165 GSM_Error error;
165 GSM_CalendarEntryCalendar; 166 GSM_CalendarEntryCalendar;
166 int Pos, num, Loc; 167 int Pos, num, Loc;
167 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 168 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
168 169
169 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; 170 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
170 171
171 if (start) { 172 if (start) {
172 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); 173 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
173 if (error != ERR_NONE) return error; 174 if (error != ERR_NONE) return error;
174 175
175 ToDo->Location = 1; 176 ToDo->Location = 1;
176 } else { 177 } else {
177 ToDo->Location++; 178 ToDo->Location++;
178 } 179 }
179 smprintf(s,"Getting ToDo %i\n",ToDo->Location); 180 smprintf(s,"Getting ToDo %i\n",ToDo->Location);
180 181
181 Loc = ToDo->Location; 182 Loc = ToDo->Location;
182 Pos = 0; 183 Pos = 0;
183 num = 0; 184 num = 0;
184 while (1) { 185 while (1) {
185 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); 186 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
186 if (error == ERR_EMPTY) break; 187 if (error == ERR_EMPTY) break;
187 if (error != ERR_NONE) return error; 188 if (error != ERR_NONE) return error;
188 if (ToDo->EntriesNum != 0) { 189 if (ToDo->EntriesNum != 0) {
189 num++; 190 num++;
190 if (num == Loc) return ERR_NONE; 191 if (num == Loc) return ERR_NONE;
191 } 192 }
192 } 193 }
193 194
194 return ERR_EMPTY; 195 return ERR_EMPTY;
195#else 196#else
196 return ERR_SOURCENOTAVAILABLE; 197 return ERR_SOURCENOTAVAILABLE;
197#endif 198#endif
198} 199}
199 200
200GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) 201GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
201{ 202{
202#ifdef GSM_ENABLE_OBEXGEN 203#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
203 GSM_Error error; 204 GSM_Error error;
204 GSM_ToDoEntry ToDo; 205 GSM_ToDoEntry ToDo;
205 GSM_CalendarEntry Calendar; 206 GSM_CalendarEntry Calendar;
206 int Pos; 207 int Pos;
207 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 208 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
208 209
209 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; 210 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
210 211
211 smprintf(s,"Getting ToDo status\n"); 212 smprintf(s,"Getting ToDo status\n");
212 213
213 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); 214 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
214 if (error != ERR_NONE) return error; 215 if (error != ERR_NONE) return error;
215 216
216 status->Used = 0; 217 status->Used = 0;
217 Pos = 0; 218 Pos = 0;
218 while (1) { 219 while (1) {
219 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); 220 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
220 if (error == ERR_EMPTY) break; 221 if (error == ERR_EMPTY) break;
221 if (error != ERR_NONE) return error; 222 if (error != ERR_NONE) return error;
222 if (ToDo.EntriesNum != 0) status->Used++; 223 if (ToDo.EntriesNum != 0) status->Used++;
223 } 224 }
224 225
225 return ERR_NONE; 226 return ERR_NONE;
226#else 227#else
227 return ERR_SOURCENOTAVAILABLE; 228 return ERR_SOURCENOTAVAILABLE;
228#endif 229#endif
229} 230}
230 231
231GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) 232GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
232{ 233{
233#ifdef GSM_ENABLE_OBEXGEN 234#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
234 unsigned char req[5000]; 235 unsigned char req[5000];
235 int size=0; 236 int size=0;
236 237
237 smprintf(s,"Adding calendar note\n"); 238 smprintf(s,"Adding calendar note\n");
238 239
239 GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar); 240 GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar);
240 241
241 return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); 242 return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size);
242#else 243#else
243 return ERR_SOURCENOTAVAILABLE; 244 return ERR_SOURCENOTAVAILABLE;
244#endif 245#endif
245} 246}
246 247
247GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) 248GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
248{ 249{
249#ifdef GSM_ENABLE_OBEXGEN 250#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
250 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 251 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
251 unsigned char req[5000]; 252 unsigned char req[5000];
252 int size=0; 253 int size=0;
253 254
254 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; 255 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
255 256
256 smprintf(s,"Adding ToDo\n"); 257 smprintf(s,"Adding ToDo\n");
257 258
258 GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo); 259 GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo);
259 260
260 return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); 261 return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size);
261#else 262#else
262 return ERR_SOURCENOTAVAILABLE; 263 return ERR_SOURCENOTAVAILABLE;
263#endif 264#endif
264} 265}
265 266
266GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) 267GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s)
267{ 268{
268#ifdef GSM_ENABLE_OBEXGEN 269#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
269 GSM_Error error; 270 GSM_Error error;
270 int Pos,Level = 0,Used; 271 int Pos,Level = 0,Used;
271 unsigned char *Buf; 272 unsigned char *Buf;
272 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 273 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
273 unsigned char Line[2000]; 274 unsigned char Line[2000];
274 275
275 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; 276 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
276 277
277 smprintf(s,"Deleting all ToDo\n"); 278 smprintf(s,"Deleting all ToDo\n");
278 279
279 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); 280 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
280 if (error != ERR_NONE) return error; 281 if (error != ERR_NONE) return error;
281 282
282 Pos = 0; 283 Pos = 0;
283 Buf = NULL; 284 Buf = NULL;
284 Used = 0; 285 Used = 0;
285 while (1) { 286 while (1) {
286 MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); 287 MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used);
287 if (strlen(Line) == 0) break; 288 if (strlen(Line) == 0) break;
288 dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); 289 dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos);
289 switch (Level) { 290 switch (Level) {
290 case 0: 291 case 0:
291 if (strstr(Line,"BEGIN:VTODO")) { 292 if (strstr(Line,"BEGIN:VTODO")) {
292 Level = 2; 293 Level = 2;
@@ -296,49 +297,49 @@ GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s)
296 strcpy(Buf+Used,Line); 297 strcpy(Buf+Used,Line);
297 Used=Used+strlen(Line)+3; 298 Used=Used+strlen(Line)+3;
298 Buf[Used-3] = 13; 299 Buf[Used-3] = 13;
299 Buf[Used-2] = 10; 300 Buf[Used-2] = 10;
300 Buf[Used-1] = 0x00; 301 Buf[Used-1] = 0x00;
301 break; 302 break;
302 case 2: /* ToDo note */ 303 case 2: /* ToDo note */
303 if (strstr(Line,"END:VTODO")) { 304 if (strstr(Line,"END:VTODO")) {
304 Level = 0; 305 Level = 0;
305 } 306 }
306 break; 307 break;
307 } 308 }
308 } 309 }
309 310
310 error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); 311 error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used);
311 //if (Buf != NULL) free(Buf); 312 //if (Buf != NULL) free(Buf);
312 return error; 313 return error;
313#else 314#else
314 return ERR_SOURCENOTAVAILABLE; 315 return ERR_SOURCENOTAVAILABLE;
315#endif 316#endif
316} 317}
317 318
318GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) 319GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
319{ 320{
320#ifdef GSM_ENABLE_OBEXGEN 321#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
321 GSM_Error error; 322 GSM_Error error;
322 int Pos,Level = 0,Loc=0,Used; 323 int Pos,Level = 0,Loc=0,Used;
323 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 324 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
324 unsigned char Line[2000]; 325 unsigned char Line[2000];
325 unsigned char *Buf; 326 unsigned char *Buf;
326 327
327 smprintf(s, "Deleting calendar note %i\n",Note->Location); 328 smprintf(s, "Deleting calendar note %i\n",Note->Location);
328 329
329 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); 330 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
330 if (error != ERR_NONE) return error; 331 if (error != ERR_NONE) return error;
331 332
332 Pos = 0; 333 Pos = 0;
333 Buf = NULL; 334 Buf = NULL;
334 Used = 0; 335 Used = 0;
335 while (1) { 336 while (1) {
336 MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); 337 MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used);
337 if (strlen(Line) == 0) break; 338 if (strlen(Line) == 0) break;
338 dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); 339 dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos);
339 switch (Level) { 340 switch (Level) {
340 case 0: 341 case 0:
341 if (strstr(Line,"BEGIN:VEVENT")) { 342 if (strstr(Line,"BEGIN:VEVENT")) {
342 Loc++; 343 Loc++;
343 if (Loc == Note->Location) { 344 if (Loc == Note->Location) {
344 Level = 1; 345 Level = 1;
@@ -351,49 +352,49 @@ GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
351 Buf[Used-3] = 13; 352 Buf[Used-3] = 13;
352 Buf[Used-2] = 10; 353 Buf[Used-2] = 10;
353 Buf[Used-1] = 0x00; 354 Buf[Used-1] = 0x00;
354 break; 355 break;
355 case 1: /* Calendar note */ 356 case 1: /* Calendar note */
356 if (strstr(Line,"END:VEVENT")) { 357 if (strstr(Line,"END:VEVENT")) {
357 Level = 0; 358 Level = 0;
358 } 359 }
359 break; 360 break;
360 } 361 }
361 } 362 }
362 363
363 DumpMessage(s->di.df, s->di.dl, Buf, Used); 364 DumpMessage(s->di.df, s->di.dl, Buf, Used);
364 365
365 error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); 366 error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used);
366 if (Buf != NULL) free(Buf); 367 if (Buf != NULL) free(Buf);
367 return error; 368 return error;
368#else 369#else
369 return ERR_SOURCENOTAVAILABLE; 370 return ERR_SOURCENOTAVAILABLE;
370#endif 371#endif
371} 372}
372 373
373GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) 374GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
374{ 375{
375#ifdef GSM_ENABLE_OBEXGEN 376#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
376 GSM_Error error; 377 GSM_Error error;
377 GSM_ToDoEntry ToDo; 378 GSM_ToDoEntry ToDo;
378 GSM_CalendarEntry Calendar; 379 GSM_CalendarEntry Calendar;
379 int Pos; 380 int Pos;
380 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 381 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
381 382
382 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; 383 if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
383 384
384 smprintf(s, "Getting calendar status\n"); 385 smprintf(s, "Getting calendar status\n");
385 386
386 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); 387 error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
387 if (error != ERR_NONE) return error; 388 if (error != ERR_NONE) return error;
388 389
389 Status->Used = 0; 390 Status->Used = 0;
390 Pos = 0; 391 Pos = 0;
391 while (1) { 392 while (1) {
392 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); 393 error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
393 if (error == ERR_EMPTY) break; 394 if (error == ERR_EMPTY) break;
394 if (error != ERR_NONE) return error; 395 if (error != ERR_NONE) return error;
395 if (Calendar.EntriesNum != 0) Status->Used++; 396 if (Calendar.EntriesNum != 0) Status->Used++;
396 } 397 }
397 398
398 return ERR_NONE; 399 return ERR_NONE;
399#else 400#else
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.c b/gammu/emb/common/phone/nokia/dct3/dct3func.c
index 17cd0a4..9810a35 100644
--- a/gammu/emb/common/phone/nokia/dct3/dct3func.c
+++ b/gammu/emb/common/phone/nokia/dct3/dct3func.c
@@ -1,30 +1,39 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* resetting DCT4 phones settings (c) by Walek */ 2/* resetting DCT4 phones settings (c) by Walek */
3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) 3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include <string.h> /* memcpy only */ 17#include <string.h> /* memcpy only */
9#include <stdio.h> 18#include <stdio.h>
10#include <ctype.h> 19#include <ctype.h>
11 20
12#include "../../../gsmstate.h" 21#include "../../../gsmstate.h"
13#include "../../../misc/coding/coding.h" 22#include "../../../misc/coding/coding.h"
14#include "../../../service/sms/gsmsms.h" 23#include "../../../service/sms/gsmsms.h"
15#include "../../pfunc.h" 24#include "../../pfunc.h"
16#include "../nfunc.h" 25#include "../nfunc.h"
17#include "dct3func.h" 26#include "dct3func.h"
18 27
19#ifdef GSM_ENABLE_NOKIA_DCT3 28#ifdef GSM_ENABLE_NOKIA_DCT3
20 29
21GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) 30GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
22{ 31{
23 GSM_Error error; 32 GSM_Error error;
24 33
25 /* We have to enable WAP frames in phone */ 34 /* We have to enable WAP frames in phone */
26 error=DCT3DCT4_EnableWAPFunctions(s); 35 error=DCT3DCT4_EnableWAPFunctions(s);
27 if (error!=ERR_NONE) return error; 36 if (error!=ERR_NONE) return error;
28 37
29 return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark); 38 return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark);
30} 39}
@@ -436,52 +445,52 @@ GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
436 smprintf(s, "Getting SMSC\n"); 445 smprintf(s, "Getting SMSC\n");
437 return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC); 446 return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC);
438} 447}
439 448
440GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 449GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
441{ 450{
442 int count; 451 int count;
443 GSM_Phone_Data*Data = &s->Phone.Data; 452 GSM_Phone_Data*Data = &s->Phone.Data;
444#ifdef DEBUG 453#ifdef DEBUG
445 GSM_NetworkInfo NetInfo; 454 GSM_NetworkInfo NetInfo;
446 char name[100]; 455 char name[100];
447 456
448 smprintf(s, "Network info received\n"); 457 smprintf(s, "Network info received\n");
449 smprintf(s, "Status : "); 458 smprintf(s, "Status : ");
450 switch (msg.Buffer[8]) { 459 switch (msg.Buffer[8]) {
451 case 0x01: smprintf(s, "home network"); break; 460 case 0x01: smprintf(s, "home network"); break;
452 case 0x02: smprintf(s, "roaming network"); break; 461 case 0x02: smprintf(s, "roaming network"); break;
453 case 0x03: smprintf(s, "requesting network"); break; 462 case 0x03: smprintf(s, "requesting network"); break;
454 case 0x04: smprintf(s, "not registered in the network");break; 463 case 0x04: smprintf(s, "not registered in the network");break;
455 default : smprintf(s, "unknown"); 464 default : smprintf(s, "unknown");
456 } 465 }
457 smprintf(s, "\n"); 466 smprintf(s, "\n");
458 smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); 467 smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic");
459 if (msg.Buffer[8]<0x03) { 468 if (msg.Buffer[8]<0x03) {
460 sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); 469 sprintf(NetInfo.CID, "%02X%02X", msg.Buffer[10], msg.Buffer[11]);
461 smprintf(s, "CID : %s\n", NetInfo.CID); 470 smprintf(s, "CID : %s\n", NetInfo.CID);
462 471
463 sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); 472 sprintf(NetInfo.LAC, "%02X%02X", msg.Buffer[12], msg.Buffer[13]);
464 smprintf(s, "LAC : %s\n", NetInfo.LAC); 473 smprintf(s, "LAC : %s\n", NetInfo.LAC);
465 474
466 NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); 475 NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode);
467 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); 476 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
468 smprintf(s, "Network name for Gammu : %s ", 477 smprintf(s, "Network name for Gammu : %s ",
469 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); 478 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode)));
470 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); 479 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode)));
471 480
472 if (msg.Length>18) { 481 if (msg.Length>18) {
473 if (msg.Buffer[18]==0x00) { 482 if (msg.Buffer[18]==0x00) {
474 /* In 6210 name is in "normal" Unicode */ 483 /* In 6210 name is in "normal" Unicode */
475 memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); 484 memcpy(name,msg.Buffer+18,msg.Buffer[17]*2);
476 name[msg.Buffer[17]*2]=0x00; 485 name[msg.Buffer[17]*2]=0x00;
477 name[msg.Buffer[17]*2+1]=0x00; 486 name[msg.Buffer[17]*2+1]=0x00;
478 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); 487 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
479 } else { 488 } else {
480 /* In 9210 first 0x00 is cut from Unicode string */ 489 /* In 9210 first 0x00 is cut from Unicode string */
481 name[0] = 0; 490 name[0] = 0;
482 memcpy(name+1,msg.Buffer+18,msg.Buffer[17]*2); 491 memcpy(name+1,msg.Buffer+18,msg.Buffer[17]*2);
483 name[msg.Buffer[17]*2+1]=0x00; 492 name[msg.Buffer[17]*2+1]=0x00;
484 name[msg.Buffer[17]*2+2]=0x00; 493 name[msg.Buffer[17]*2+2]=0x00;
485 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); 494 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
486 } 495 }
487 } 496 }
@@ -490,50 +499,50 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s
490 if (Data->RequestID==ID_GetNetworkInfo) { 499 if (Data->RequestID==ID_GetNetworkInfo) {
491 Data->NetworkInfo->NetworkName[0] = 0x00; 500 Data->NetworkInfo->NetworkName[0] = 0x00;
492 Data->NetworkInfo->NetworkName[1] = 0x00; 501 Data->NetworkInfo->NetworkName[1] = 0x00;
493 Data->NetworkInfo->State = 0; 502 Data->NetworkInfo->State = 0;
494 switch (msg.Buffer[8]) { 503 switch (msg.Buffer[8]) {
495 case 0x01: Data->NetworkInfo->State = GSM_HomeNetwork; break; 504 case 0x01: Data->NetworkInfo->State = GSM_HomeNetwork; break;
496 case 0x02: Data->NetworkInfo->State = GSM_RoamingNetwork;break; 505 case 0x02: Data->NetworkInfo->State = GSM_RoamingNetwork;break;
497 case 0x03: Data->NetworkInfo->State = GSM_RequestingNetwork;break; 506 case 0x03: Data->NetworkInfo->State = GSM_RequestingNetwork;break;
498 case 0x04: Data->NetworkInfo->State = GSM_NoNetwork; break; 507 case 0x04: Data->NetworkInfo->State = GSM_NoNetwork; break;
499 } 508 }
500 if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) { 509 if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) {
501 if (msg.Buffer[18]==0x00) { 510 if (msg.Buffer[18]==0x00) {
502 /* In 6210 name is in "normal" Unicode */ 511 /* In 6210 name is in "normal" Unicode */
503 memcpy(Data->NetworkInfo->NetworkName,msg.Buffer+18,msg.Buffer[17]*2); 512 memcpy(Data->NetworkInfo->NetworkName,msg.Buffer+18,msg.Buffer[17]*2);
504 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2] = 0x00; 513 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2] = 0x00;
505 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1] = 0x00; 514 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1] = 0x00;
506 } else { 515 } else {
507 /* In 9210 first 0x00 is cut from Unicode string */ 516 /* In 9210 first 0x00 is cut from Unicode string */
508 Data->NetworkInfo->NetworkName[0] = 0; 517 Data->NetworkInfo->NetworkName[0] = 0;
509 memcpy(Data->NetworkInfo->NetworkName+1,msg.Buffer+18,msg.Buffer[17]*2); 518 memcpy(Data->NetworkInfo->NetworkName+1,msg.Buffer+18,msg.Buffer[17]*2);
510 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1]=0x00; 519 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1]=0x00;
511 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+2]=0x00; 520 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+2]=0x00;
512 } 521 }
513 NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->NetworkInfo->NetworkCode); 522 NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->NetworkInfo->NetworkCode);
514 sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); 523 sprintf(Data->NetworkInfo->CID, "%02X%02X", msg.Buffer[10], msg.Buffer[11]);
515 sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); 524 sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg.Buffer[12], msg.Buffer[13]);
516 } 525 }
517 } 526 }
518 /* 6210/6250/7110 */ 527 /* 6210/6250/7110 */
519 if (Data->RequestID==ID_GetBitmap) { 528 if (Data->RequestID==ID_GetBitmap) {
520 if (msg.Buffer[4]==0x02) { 529 if (msg.Buffer[4]==0x02) {
521 smprintf(s, "Operator logo available\n"); 530 smprintf(s, "Operator logo available\n");
522 count = 7; 531 count = 7;
523 /* skip network info */ 532 /* skip network info */
524 count += msg.Buffer[count]; 533 count += msg.Buffer[count];
525 count ++; 534 count ++;
526 Data->Bitmap->BitmapWidth= msg.Buffer[count++]; 535 Data->Bitmap->BitmapWidth= msg.Buffer[count++];
527 Data->Bitmap->BitmapHeight= msg.Buffer[count++]; 536 Data->Bitmap->BitmapHeight= msg.Buffer[count++];
528 count+=4; 537 count+=4;
529 PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo,msg.Buffer+count,Data->Bitmap); 538 PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo,msg.Buffer+count,Data->Bitmap);
530 NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->Bitmap->NetworkCode); 539 NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->Bitmap->NetworkCode);
531 } else { 540 } else {
532 Data->Bitmap->BitmapWidth= 78; 541 Data->Bitmap->BitmapWidth= 78;
533 Data->Bitmap->BitmapHeight= 21; 542 Data->Bitmap->BitmapHeight= 21;
534 GSM_ClearBitmap(Data->Bitmap); 543 GSM_ClearBitmap(Data->Bitmap);
535 strcpy(Data->Bitmap->NetworkCode,"000 00"); 544 strcpy(Data->Bitmap->NetworkCode,"000 00");
536 } 545 }
537 } 546 }
538 return ERR_NONE; 547 return ERR_NONE;
539} 548}
diff --git a/gammu/emb/common/phone/nokia/dct3/n0650.c b/gammu/emb/common/phone/nokia/dct3/n0650.c
new file mode 100644
index 0000000..3899a16
--- a/dev/null
+++ b/gammu/emb/common/phone/nokia/dct3/n0650.c
@@ -0,0 +1,150 @@
1/* (c) 2004 by Marcin Wiacek */
2
3#include <string.h>
4#include <time.h>
5
6#include "../../../gsmcomon.h"
7#include "../../../gsmstate.h"
8#include "../nfunc.h"
9
10#ifdef GSM_ENABLE_NOKIA650
11
12static GSM_Reply_Function N650ReplyFunctions[] = {
13 {DCT3DCT4_ReplyGetModelFirmware,"\xD2",0x02,0x00,ID_GetModel },
14 {DCT3DCT4_ReplyGetModelFirmware,"\xD2",0x02,0x00,ID_GetFirmware },
15
16 {NULL, "\x00",0x00,0x00,ID_None }
17};
18
19GSM_Phone_Functions N650Phone = {
20 "0650",
21 N650ReplyFunctions,
22 NONEFUNCTION, /* Initialise */
23 NONEFUNCTION, /* Terminate */
24 GSM_DispatchMessage,
25 NOTSUPPORTED, /* ShowStartInfo */
26 NOKIA_GetManufacturer,
27 DCT3DCT4_GetModel,
28 DCT3DCT4_GetFirmware,
29 NOTSUPPORTED, /* GetIMEI */
30 NOTSUPPORTED, /* GetOriginalIMEI */
31 NOTSUPPORTED, /* GetManufactureMonth*/
32 NOTSUPPORTED, /* GetProductCode */
33 NOTSUPPORTED, /* GetHardware */
34 NOTSUPPORTED, /* GetPPM */
35 NOTSUPPORTED, /* GetSIMIMSI */
36 NOTSUPPORTED, /* GetDateTime */
37 NOTSUPPORTED, /* SetDateTime */
38 NOTSUPPORTED, /* GetAlarm */
39 NOTSUPPORTED, /* SetAlarm */
40 NOTSUPPORTED, /* GetLocale */
41 NOTSUPPORTED, /* SetLocale */
42 NOTSUPPORTED, /* PressKey */
43 NOTSUPPORTED, /* Reset */
44 NOTSUPPORTED, /* ResetPhoneSettings*/
45 NOTSUPPORTED, /* EnterSecurityCode*/
46 NOTSUPPORTED, /* GetSecurityStatus*/
47 NOTSUPPORTED, /* GetDisplayStatus*/
48 NOTSUPPORTED, /* SetAutoNetworkLogin*/
49 NOTSUPPORTED, /* GetBatteryCharge*/
50 NOTSUPPORTED, /* GetSignalQuality*/
51 NOTSUPPORTED, /* GetNetworkInfo */
52 NOTSUPPORTED, /* GetCategory */
53 NOTSUPPORTED, /* AddCategory */
54 NOTSUPPORTED, /* GetCategoryStatus */
55 NOTSUPPORTED, /* GetMemoryStatus */
56 NOTSUPPORTED, /* GetMemory */
57 NOTSUPPORTED, /* GetNextMemory */
58 NOTSUPPORTED, /* SetMemory */
59 NOTSUPPORTED, /* AddMemory */
60 NOTSUPPORTED, /* DeleteMemory */
61 NOTIMPLEMENTED, /* DeleteAllMemory */
62 NOTSUPPORTED, /* GetSpeedDial */
63 NOTSUPPORTED, /* SetSpeedDial */
64 NOTSUPPORTED, /* GetSMSC */
65 NOTSUPPORTED, /* SetSMSC */
66 NOTSUPPORTED, /* GetSMSStatus */
67 NOTSUPPORTED, /* GetSMS */
68 NOTSUPPORTED, /* GetNextSMS */
69 NOTSUPPORTED, /* SetSMS */
70 NOTSUPPORTED, /* AddSMS */
71 NOTSUPPORTED, /* DeleteSMS */
72 NOTSUPPORTED, /* SendSMSMessage */
73 NOTSUPPORTED, /* SendSavedSMS */
74 NOTSUPPORTED, /* SetIncomingSMS */
75 NOTSUPPORTED, /* SetIncomingCB */
76 NOTSUPPORTED, /* GetSMSFolders */
77 NOTSUPPORTED, /* AddSMSFolder */
78 NOTSUPPORTED, /* DeleteSMSFolder */
79 NOTSUPPORTED, /* DialVoice */
80 NOTSUPPORTED, /* AnswerCall */
81 NOTSUPPORTED, /* CancelCall */
82 NOTSUPPORTED, /* HoldCall */
83 NOTSUPPORTED, /* UnholdCall */
84 NOTSUPPORTED, /* ConferenceCall */
85 NOTSUPPORTED, /* SplitCall */
86 NOTSUPPORTED, /* TransferCall */
87 NOTSUPPORTED, /* SwitchCall */
88 NOTSUPPORTED, /* GetCallDivert */
89 NOTSUPPORTED, /* SetCallDivert */
90 NOTSUPPORTED, /* CancelAllDiverts*/
91 NOTSUPPORTED, /* SetIncomingCall */
92 NOTSUPPORTED, /* SetIncomingUSSD */
93 NOTSUPPORTED, /* SendDTMF */
94 NOTSUPPORTED, /* GetRingtone */
95 NOTSUPPORTED, /* SetRingtone */
96 NOTSUPPORTED, /* GetRingtonesInfo*/
97 NOTSUPPORTED, /* DeleteUserRingtones*/
98 NOTSUPPORTED, /* PlayTone */
99 NOTSUPPORTED, /* GetWAPBookmark */
100 NOTSUPPORTED, /* SetWAPBookmark */
101 NOTSUPPORTED, /* DeleteWAPBookmark */
102 NOTSUPPORTED, /* GetWAPSettings */
103 NOTSUPPORTED, /* SetWAPSettings */
104 NOTSUPPORTED, /* GetMMSSettings */
105 NOTSUPPORTED, /* SetMMSSettings */
106 NOTSUPPORTED, /* GetBitmap */
107 NOTSUPPORTED, /* SetBitmap */
108 NOTSUPPORTED, /* GetToDoStatus */
109 NOTSUPPORTED, /* GetToDo */
110 NOTSUPPORTED, /* GetNextToDo */
111 NOTSUPPORTED, /* SetToDo */
112 NOTSUPPORTED, /* AddToDo */
113 NOTSUPPORTED, /* DeleteToDo */
114 NOTSUPPORTED, /* DeleteAllToDo */
115 NOTSUPPORTED, /* GetCalendarStatus*/
116 NOTSUPPORTED, /* GetCalendar */
117 NOTSUPPORTED, /* GetNextCalendar */
118 NOTSUPPORTED, /* SetCalendar */
119 NOTSUPPORTED, /* AddCalendar */
120 NOTSUPPORTED, /* DeleteCalendar */
121 NOTSUPPORTED, /* DeleteAllCalendar*/
122 NOTSUPPORTED, /* GetCalendarSettings*/
123 NOTSUPPORTED, /* SetCalendarSettings*/
124 NOTSUPPORTED, /* GetNoteStatus */
125 NOTSUPPORTED, /* GetNote */
126 NOTSUPPORTED, /* GetNextNote */
127 NOTSUPPORTED, /* SetNote */
128 NOTSUPPORTED, /* AddNote */
129 NOTSUPPORTED, /* DeleteNote */
130 NOTSUPPORTED, /* DeleteAllNotes */
131 NOTSUPPORTED, /* GetProfile */
132 NOTSUPPORTED, /* SetProfile */
133 NOTSUPPORTED, /* GetFMStation */
134 NOTSUPPORTED, /* SetFMStation */
135 NOTSUPPORTED, /* ClearFMStations */
136 NOTSUPPORTED, /* GetNextFileFolder*/
137 NOTSUPPORTED, /* GetFilePart */
138 NOTSUPPORTED, /* AddFilePart */
139 NOTSUPPORTED, /* GetFileSystemStatus*/
140 NOTSUPPORTED, /* DeleteFile */
141 NOTSUPPORTED, /* AddFolder */
142 NOTSUPPORTED, /* GetGPRSAccessPoint*/
143 NOTSUPPORTED /* SetGPRSAccessPoint*/
144};
145
146#endif
147
148/* How should editor hadle tabs in this file? Add editor commands here.
149 * vim: noexpandtab sw=8 ts=8 sts=8:
150 */
diff --git a/gammu/emb/common/phone/nokia/dct3/n0650.h b/gammu/emb/common/phone/nokia/dct3/n0650.h
new file mode 100644
index 0000000..be491eb
--- a/dev/null
+++ b/gammu/emb/common/phone/nokia/dct3/n0650.h
@@ -0,0 +1,18 @@
1/* (c) 2004 by Marcin Wiacek */
2
3#ifndef n650_h
4#define n650_h
5
6typedef struct {
7 int fake;
8} GSM_Phone_N650Data;
9
10#ifndef GSM_USED_MBUS2
11# define GSM_USED_MBUS2
12#endif
13
14#endif
15
16/* How should editor hadle tabs in this file? Add editor commands here.
17 * vim: noexpandtab sw=8 ts=8 sts=8:
18 */
diff --git a/gammu/emb/common/phone/nokia/dct3/n6110.c b/gammu/emb/common/phone/nokia/dct3/n6110.c
index dac6c12..c3ddfb6 100644
--- a/gammu/emb/common/phone/nokia/dct3/n6110.c
+++ b/gammu/emb/common/phone/nokia/dct3/n6110.c
@@ -1,30 +1,39 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* 5210 calendar IDs by Frederick Ros */ 2/* 5210 calendar IDs by Frederick Ros */
3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) 3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include "../../../gsmstate.h" 17#include "../../../gsmstate.h"
9 18
10#ifdef GSM_ENABLE_NOKIA6110 19#ifdef GSM_ENABLE_NOKIA6110
11 20
12#include <string.h> 21#include <string.h>
13 22
14#include "../../../../cfg/config.h" 23#include "../../../../cfg/config.h"
15#include "../../../misc/coding/coding.h" 24#include "../../../misc/coding/coding.h"
16#include "../../../service/sms/gsmsms.h" 25#include "../../../service/sms/gsmsms.h"
17#include "../../../gsmcomon.h" 26#include "../../../gsmcomon.h"
18#include "../../pfunc.h" 27#include "../../pfunc.h"
19#include "../nfunc.h" 28#include "../nfunc.h"
20#include "n6110.h" 29#include "n6110.h"
21#include "dct3func.h" 30#include "dct3func.h"
22 31
23static unsigned char N6110_MEMORY_TYPES[] = { 32static unsigned char N6110_MEMORY_TYPES[] = {
24 MEM_ME, 0x02, 33 MEM_ME, 0x02,
25 MEM_SM, 0x03, 34 MEM_SM, 0x03,
26 MEM_ON, 0x05, 35 MEM_ON, 0x05,
27 MEM_DC, 0x07, 36 MEM_DC, 0x07,
28 MEM_RC, 0x08, 37 MEM_RC, 0x08,
29 MEM_MC, 0x09, 38 MEM_MC, 0x09,
30 MEM_VM, 0x0b, 39 MEM_VM, 0x0b,
@@ -2847,45 +2856,51 @@ GSM_Phone_Functions N6110Phone = {
2847 NOTSUPPORTED, /* GetMMSSettings */ 2856 NOTSUPPORTED, /* GetMMSSettings */
2848 NOTSUPPORTED, /* SetMMSSettings */ 2857 NOTSUPPORTED, /* SetMMSSettings */
2849 NOTSUPPORTED, /* GetSyncMLSettings*/ 2858 NOTSUPPORTED, /* GetSyncMLSettings*/
2850 NOTSUPPORTED, /* SetSyncMLSettings*/ 2859 NOTSUPPORTED, /* SetSyncMLSettings*/
2851 NOTSUPPORTED, /* GetChatSettings */ 2860 NOTSUPPORTED, /* GetChatSettings */
2852 NOTSUPPORTED, /* SetChatSettings */ 2861 NOTSUPPORTED, /* SetChatSettings */
2853 N6110_GetBitmap, 2862 N6110_GetBitmap,
2854 N6110_SetBitmap, 2863 N6110_SetBitmap,
2855 NOTSUPPORTED, /* GetToDoStatus */ 2864 NOTSUPPORTED, /* GetToDoStatus */
2856 NOTSUPPORTED, /* GetToDo */ 2865 NOTSUPPORTED, /* GetToDo */
2857 NOTSUPPORTED, /* GetNextToDo */ 2866 NOTSUPPORTED, /* GetNextToDo */
2858 NOTSUPPORTED, /* SetToDo */ 2867 NOTSUPPORTED, /* SetToDo */
2859 NOTSUPPORTED, /* AddToDo */ 2868 NOTSUPPORTED, /* AddToDo */
2860 NOTSUPPORTED, /* DeleteToDo */ 2869 NOTSUPPORTED, /* DeleteToDo */
2861 NOTSUPPORTED, /* DeleteAllToDo */ 2870 NOTSUPPORTED, /* DeleteAllToDo */
2862 NOTIMPLEMENTED, /* GetCalendarStatus */ 2871 NOTIMPLEMENTED, /* GetCalendarStatus */
2863 NOTIMPLEMENTED, /* GetCalendar */ 2872 NOTIMPLEMENTED, /* GetCalendar */
2864 N6110_GetNextCalendarNote, 2873 N6110_GetNextCalendarNote,
2865 NOTIMPLEMENTED, /* SetCalendar */ 2874 NOTIMPLEMENTED, /* SetCalendar */
2866 N6110_AddCalendarNote, 2875 N6110_AddCalendarNote,
2867 N6110_DeleteCalendarNote, 2876 N6110_DeleteCalendarNote,
2868 NOTIMPLEMENTED, /* DeleteAllCalendar */ 2877 NOTIMPLEMENTED, /* DeleteAllCalendar */
2869 NOTSUPPORTED, /* GetCalendarSettings */ 2878 NOTSUPPORTED, /* GetCalendarSettings */
2870 NOTSUPPORTED, /* SetCalendarSettings */ 2879 NOTSUPPORTED, /* SetCalendarSettings */
2871 NOTSUPPORTED, /* GetNextNote */ 2880 NOTSUPPORTED, /* GetNoteStatus */
2881 NOTSUPPORTED, /* GetNote */
2882 NOTSUPPORTED, /* GetNextNote */
2883 NOTSUPPORTED, /* SetNote */
2884 NOTSUPPORTED, /* AddNote */
2885 NOTSUPPORTED, /* DeleteNote */
2886 NOTSUPPORTED, /* DeleteAllNotes */
2872 N6110_GetProfile, 2887 N6110_GetProfile,
2873 N6110_SetProfile, 2888 N6110_SetProfile,
2874 NOTSUPPORTED, /* GetFMStation */ 2889 NOTSUPPORTED, /* GetFMStation */
2875 NOTSUPPORTED, /* SetFMStation */ 2890 NOTSUPPORTED, /* SetFMStation */
2876 NOTSUPPORTED, /* ClearFMStations */ 2891 NOTSUPPORTED, /* ClearFMStations */
2877 NOTSUPPORTED, /* GetNextFileFolder */ 2892 NOTSUPPORTED, /* GetNextFileFolder */
2878 NOTSUPPORTED, /* GetFilePart */ 2893 NOTSUPPORTED, /* GetFilePart */
2879 NOTSUPPORTED, /* AddFile */ 2894 NOTSUPPORTED, /* AddFile */
2880 NOTSUPPORTED, /* GetFileSystemStatus */ 2895 NOTSUPPORTED, /* GetFileSystemStatus */
2881 NOTSUPPORTED, /* DeleteFile */ 2896 NOTSUPPORTED, /* DeleteFile */
2882 NOTSUPPORTED, /* AddFolder */ 2897 NOTSUPPORTED, /* AddFolder */
2883 NOTSUPPORTED, /* GetGPRSAccessPoint */ 2898 NOTSUPPORTED, /* GetGPRSAccessPoint */
2884 NOTSUPPORTED /* SetGPRSAccessPoint */ 2899 NOTSUPPORTED /* SetGPRSAccessPoint */
2885}; 2900};
2886 2901
2887#endif 2902#endif
2888 2903
2889/* How should editor hadle tabs in this file? Add editor commands here. 2904/* How should editor hadle tabs in this file? Add editor commands here.
2890 * vim: noexpandtab sw=8 ts=8 sts=8: 2905 * vim: noexpandtab sw=8 ts=8 sts=8:
2891 */ 2906 */
diff --git a/gammu/emb/common/phone/nokia/dct3/n7110.c b/gammu/emb/common/phone/nokia/dct3/n7110.c
index b597f9b..a8e0545 100644
--- a/gammu/emb/common/phone/nokia/dct3/n7110.c
+++ b/gammu/emb/common/phone/nokia/dct3/n7110.c
@@ -1,29 +1,38 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some Markus Plail work from Gnokii (www.gnokii.org) 2/* based on some Markus Plail work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later 4 * GNU GPL version 2 or later
5 */ 5 */
6/* Due to a problem in the source code management, the names of some of
7 * the authors have unfortunately been lost. We do not mean to belittle
8 * their efforts and hope they will contact us to see their names
9 * properly added to the Copyright notice above.
10 * Having published their contributions under the terms of the GNU
11 * General Public License (GPL) [version 2], the Copyright of these
12 * authors will remain respected by adhering to the license they chose
13 * to publish their code under.
14 */
6 15
7#include "../../../gsmstate.h" 16#include "../../../gsmstate.h"
8 17
9#ifdef GSM_ENABLE_NOKIA7110 18#ifdef GSM_ENABLE_NOKIA7110
10 19
11#include <string.h> 20#include <string.h>
12#include <time.h> 21#include <time.h>
13 22
14#include "../../../misc/coding/coding.h" 23#include "../../../misc/coding/coding.h"
15#include "../../../gsmcomon.h" 24#include "../../../gsmcomon.h"
16#include "../../../service/gsmlogo.h" 25#include "../../../service/gsmlogo.h"
17#include "../../pfunc.h" 26#include "../../pfunc.h"
18#include "../nfunc.h" 27#include "../nfunc.h"
19#include "../nfuncold.h" 28#include "../nfuncold.h"
20#include "n7110.h" 29#include "n7110.h"
21#include "dct3func.h" 30#include "dct3func.h"
22 31
23static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) 32static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
24{ 33{
25 return DCT3_GetAlarm(s, alarm, 0x19); 34 return DCT3_GetAlarm(s, alarm, 0x19);
26} 35}
27 36
28static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) 37static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
29{ 38{
@@ -1685,45 +1694,51 @@ GSM_Phone_Functions N7110Phone = {
1685 NOTSUPPORTED, /* GetMMSSettings */ 1694 NOTSUPPORTED, /* GetMMSSettings */
1686 NOTSUPPORTED, /* SetMMSSettings */ 1695 NOTSUPPORTED, /* SetMMSSettings */
1687 NOTSUPPORTED, /* GetSyncMLSettings*/ 1696 NOTSUPPORTED, /* GetSyncMLSettings*/
1688 NOTSUPPORTED, /* SetSyncMLSettings*/ 1697 NOTSUPPORTED, /* SetSyncMLSettings*/
1689 NOTSUPPORTED, /* GetChatSettings */ 1698 NOTSUPPORTED, /* GetChatSettings */
1690 NOTSUPPORTED, /* SetChatSettings */ 1699 NOTSUPPORTED, /* SetChatSettings */
1691 N7110_GetBitmap, 1700 N7110_GetBitmap,
1692 N7110_SetBitmap, 1701 N7110_SetBitmap,
1693 NOTSUPPORTED, /* GetToDoStatus */ 1702 NOTSUPPORTED, /* GetToDoStatus */
1694 NOTSUPPORTED, /* GetToDo */ 1703 NOTSUPPORTED, /* GetToDo */
1695 NOTSUPPORTED, /* GetNextToDo */ 1704 NOTSUPPORTED, /* GetNextToDo */
1696 NOTSUPPORTED, /* SetToDo */ 1705 NOTSUPPORTED, /* SetToDo */
1697 NOTSUPPORTED, /* AddToDo */ 1706 NOTSUPPORTED, /* AddToDo */
1698 NOTSUPPORTED, /* DeleteToDo */ 1707 NOTSUPPORTED, /* DeleteToDo */
1699 NOTSUPPORTED, /* DeleteAllToDo */ 1708 NOTSUPPORTED, /* DeleteAllToDo */
1700 N7110_GetCalendarStatus, 1709 N7110_GetCalendarStatus,
1701 NOTIMPLEMENTED, /* GetCalendar */ 1710 NOTIMPLEMENTED, /* GetCalendar */
1702 N7110_GetNextCalendar, 1711 N7110_GetNextCalendar,
1703 NOTIMPLEMENTED, /* SetCalendar */ 1712 NOTIMPLEMENTED, /* SetCalendar */
1704 N7110_AddCalendar, 1713 N7110_AddCalendar,
1705 N71_65_DelCalendar, 1714 N71_65_DelCalendar,
1706 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 1715 NOTIMPLEMENTED, /* DeleteAllCalendar*/
1707 NOTSUPPORTED, /* GetCalendarSettings*/ 1716 NOTSUPPORTED, /* GetCalendarSettings*/
1708 NOTSUPPORTED, /* SetCalendarSettings*/ 1717 NOTSUPPORTED, /* SetCalendarSettings*/
1718 NOTSUPPORTED, /* GetNoteStatus */
1719 NOTSUPPORTED, /* GetNote */
1709 NOTSUPPORTED, /* GetNextNote */ 1720 NOTSUPPORTED, /* GetNextNote */
1721 NOTSUPPORTED, /* SetNote */
1722 NOTSUPPORTED, /* AddNote */
1723 NOTSUPPORTED, /* DeleteNote */
1724 NOTSUPPORTED, /* DeleteAllNotes */
1710 N7110_GetProfile, 1725 N7110_GetProfile,
1711 N7110_SetProfile, 1726 N7110_SetProfile,
1712 NOTSUPPORTED, /* GetFMStation */ 1727 NOTSUPPORTED, /* GetFMStation */
1713 NOTSUPPORTED, /* SetFMStation */ 1728 NOTSUPPORTED, /* SetFMStation */
1714 NOTSUPPORTED, /* ClearFMStations */ 1729 NOTSUPPORTED, /* ClearFMStations */
1715 NOTSUPPORTED, /* GetNextFileFolder*/ 1730 NOTSUPPORTED, /* GetNextFileFolder*/
1716 NOTSUPPORTED, /* GetFilePart */ 1731 NOTSUPPORTED, /* GetFilePart */
1717 NOTSUPPORTED, /* AddFile */ 1732 NOTSUPPORTED, /* AddFile */
1718 NOTSUPPORTED, /* GetFileSystemStatus*/ 1733 NOTSUPPORTED, /* GetFileSystemStatus*/
1719 NOTSUPPORTED, /* DeleteFile */ 1734 NOTSUPPORTED, /* DeleteFile */
1720 NOTSUPPORTED, /* AddFolder */ 1735 NOTSUPPORTED, /* AddFolder */
1721 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 1736 NOTSUPPORTED, /* GetGPRSAccessPoint*/
1722 NOTSUPPORTED /* SetGPRSAccessPoint*/ 1737 NOTSUPPORTED /* SetGPRSAccessPoint*/
1723}; 1738};
1724 1739
1725#endif 1740#endif
1726 1741
1727/* How should editor hadle tabs in this file? Add editor commands here. 1742/* How should editor hadle tabs in this file? Add editor commands here.
1728 * vim: noexpandtab sw=8 ts=8 sts=8: 1743 * vim: noexpandtab sw=8 ts=8 sts=8:
1729 */ 1744 */
diff --git a/gammu/emb/common/phone/nokia/dct3/n9210.c b/gammu/emb/common/phone/nokia/dct3/n9210.c
index ff71ad3..f535c2a 100644
--- a/gammu/emb/common/phone/nokia/dct3/n9210.c
+++ b/gammu/emb/common/phone/nokia/dct3/n9210.c
@@ -353,45 +353,51 @@ GSM_Phone_Functions N9210Phone = {
353 NOTSUPPORTED, /* GetMMSSettings */ 353 NOTSUPPORTED, /* GetMMSSettings */
354 NOTSUPPORTED, /* SetMMSSettings */ 354 NOTSUPPORTED, /* SetMMSSettings */
355 NOTSUPPORTED, /* GetSyncMLSettings*/ 355 NOTSUPPORTED, /* GetSyncMLSettings*/
356 NOTSUPPORTED, /* SetSyncMLSettings*/ 356 NOTSUPPORTED, /* SetSyncMLSettings*/
357 NOTSUPPORTED, /* GetChatSettings */ 357 NOTSUPPORTED, /* GetChatSettings */
358 NOTSUPPORTED, /* SetChatSettings */ 358 NOTSUPPORTED, /* SetChatSettings */
359 N9210_GetBitmap, 359 N9210_GetBitmap,
360 N9210_SetBitmap, 360 N9210_SetBitmap,
361 NOTSUPPORTED, /* GetToDoStatus */ 361 NOTSUPPORTED, /* GetToDoStatus */
362 NOTSUPPORTED, /* GetToDo */ 362 NOTSUPPORTED, /* GetToDo */
363 NOTSUPPORTED, /* GetNextToDo */ 363 NOTSUPPORTED, /* GetNextToDo */
364 NOTSUPPORTED, /* SetToDo */ 364 NOTSUPPORTED, /* SetToDo */
365 NOTSUPPORTED, /* AddToDo */ 365 NOTSUPPORTED, /* AddToDo */
366 NOTSUPPORTED, /* DeleteToDo */ 366 NOTSUPPORTED, /* DeleteToDo */
367 NOTSUPPORTED, /* DeleteAllToDo */ 367 NOTSUPPORTED, /* DeleteAllToDo */
368 NOTSUPPORTED, /* GetCalendarStatus*/ 368 NOTSUPPORTED, /* GetCalendarStatus*/
369 NOTSUPPORTED, /* GetCalendar */ 369 NOTSUPPORTED, /* GetCalendar */
370 NOTSUPPORTED, /* GetNextCalendar */ 370 NOTSUPPORTED, /* GetNextCalendar */
371 NOTSUPPORTED, /* SetCalendar */ 371 NOTSUPPORTED, /* SetCalendar */
372 NOTSUPPORTED, /* AddCalendar */ 372 NOTSUPPORTED, /* AddCalendar */
373 NOTSUPPORTED, /* DeleteCalendar */ 373 NOTSUPPORTED, /* DeleteCalendar */
374 NOTSUPPORTED, /* DeleteAllCalendar*/ 374 NOTSUPPORTED, /* DeleteAllCalendar*/
375 NOTSUPPORTED, /* GetCalendarSettings*/ 375 NOTSUPPORTED, /* GetCalendarSettings*/
376 NOTSUPPORTED, /* SetCalendarSettings*/ 376 NOTSUPPORTED, /* SetCalendarSettings*/
377 NOTSUPPORTED, /* GetNoteStatus */
378 NOTSUPPORTED, /* GetNote */
377 NOTSUPPORTED, /* GetNextNote */ 379 NOTSUPPORTED, /* GetNextNote */
380 NOTSUPPORTED, /* SetNote */
381 NOTSUPPORTED, /* AddNote */
382 NOTSUPPORTED, /* DeleteNote */
383 NOTSUPPORTED, /* DeleteAllNotes */
378 NOTIMPLEMENTED, /* GetProfile */ 384 NOTIMPLEMENTED, /* GetProfile */
379 NOTSUPPORTED, /* SetProfile */ 385 NOTSUPPORTED, /* SetProfile */
380 NOTSUPPORTED, /* GetFMStation */ 386 NOTSUPPORTED, /* GetFMStation */
381 NOTSUPPORTED, /* SetFMStation */ 387 NOTSUPPORTED, /* SetFMStation */
382 NOTSUPPORTED, /* ClearFMStations */ 388 NOTSUPPORTED, /* ClearFMStations */
383 NOTSUPPORTED, /* GetNextFileFolder*/ 389 NOTSUPPORTED, /* GetNextFileFolder*/
384 NOTSUPPORTED, /* GetFilePart */ 390 NOTSUPPORTED, /* GetFilePart */
385 NOTSUPPORTED, /* AddFile */ 391 NOTSUPPORTED, /* AddFile */
386 NOTSUPPORTED, /* GetFileSystemStatus*/ 392 NOTSUPPORTED, /* GetFileSystemStatus*/
387 NOTSUPPORTED, /* DeleteFile */ 393 NOTSUPPORTED, /* DeleteFile */
388 NOTSUPPORTED, /* AddFolder */ 394 NOTSUPPORTED, /* AddFolder */
389 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 395 NOTSUPPORTED, /* GetGPRSAccessPoint*/
390 NOTSUPPORTED /* SetGPRSAccessPoint*/ 396 NOTSUPPORTED /* SetGPRSAccessPoint*/
391}; 397};
392 398
393#endif 399#endif
394 400
395/* How should editor hadle tabs in this file? Add editor commands here. 401/* How should editor hadle tabs in this file? Add editor commands here.
396 * vim: noexpandtab sw=8 ts=8 sts=8: 402 * vim: noexpandtab sw=8 ts=8 sts=8:
397 */ 403 */
diff --git a/gammu/emb/common/phone/nokia/dct4/n3320.c b/gammu/emb/common/phone/nokia/dct4/n3320.c
index 9b1d6cd..9dd9ffb 100644
--- a/gammu/emb/common/phone/nokia/dct4/n3320.c
+++ b/gammu/emb/common/phone/nokia/dct4/n3320.c
@@ -228,45 +228,51 @@ GSM_Phone_Functions N3320Phone = {
228 NOTSUPPORTED, /* GetMMSSettings */ 228 NOTSUPPORTED, /* GetMMSSettings */
229 NOTSUPPORTED, /* SetMMSSettings */ 229 NOTSUPPORTED, /* SetMMSSettings */
230 NOTSUPPORTED, /* GetSyncMLSettings*/ 230 NOTSUPPORTED, /* GetSyncMLSettings*/
231 NOTSUPPORTED, /* SetSyncMLSettings*/ 231 NOTSUPPORTED, /* SetSyncMLSettings*/
232 NOTSUPPORTED, /* GetChatSettings */ 232 NOTSUPPORTED, /* GetChatSettings */
233 NOTSUPPORTED, /* SetChatSettings */ 233 NOTSUPPORTED, /* SetChatSettings */
234 NOTSUPPORTED, /* GetBitmap */ 234 NOTSUPPORTED, /* GetBitmap */
235 NOTSUPPORTED, /* SetBitmap */ 235 NOTSUPPORTED, /* SetBitmap */
236 NOTSUPPORTED, /* GetToDoStatus */ 236 NOTSUPPORTED, /* GetToDoStatus */
237 NOTSUPPORTED, /* GetToDo */ 237 NOTSUPPORTED, /* GetToDo */
238 NOTSUPPORTED, /* GetNextToDo */ 238 NOTSUPPORTED, /* GetNextToDo */
239 NOTSUPPORTED, /* SetToDo */ 239 NOTSUPPORTED, /* SetToDo */
240 NOTSUPPORTED, /* AddToDo */ 240 NOTSUPPORTED, /* AddToDo */
241 NOTSUPPORTED, /* DeleteToDo */ 241 NOTSUPPORTED, /* DeleteToDo */
242 NOTSUPPORTED, /* DeleteAllToDo */ 242 NOTSUPPORTED, /* DeleteAllToDo */
243 N3320_GetCalendarStatus, 243 N3320_GetCalendarStatus,
244 NOTIMPLEMENTED, /* GetCalendar */ 244 NOTIMPLEMENTED, /* GetCalendar */
245 N3320_GetNextCalendar, 245 N3320_GetNextCalendar,
246 NOTIMPLEMENTED, /* SetCalendar */ 246 NOTIMPLEMENTED, /* SetCalendar */
247 NOTSUPPORTED, /* AddCalendar */ 247 NOTSUPPORTED, /* AddCalendar */
248 NOTSUPPORTED, /* DeleteCalendar */ 248 NOTSUPPORTED, /* DeleteCalendar */
249 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 249 NOTIMPLEMENTED, /* DeleteAllCalendar*/
250 NOTSUPPORTED, /* GetCalendarSettings*/ 250 NOTSUPPORTED, /* GetCalendarSettings*/
251 NOTSUPPORTED, /* SetCalendarSettings*/ 251 NOTSUPPORTED, /* SetCalendarSettings*/
252 NOTSUPPORTED, /* GetNoteStatus */
253 NOTSUPPORTED, /* GetNote */
252 NOTSUPPORTED, /* GetNextNote */ 254 NOTSUPPORTED, /* GetNextNote */
255 NOTSUPPORTED, /* SetNote */
256 NOTSUPPORTED, /* AddNote */
257 NOTSUPPORTED, /* DeleteNote */
258 NOTSUPPORTED, /* DeleteAllNotes */
253 NOTSUPPORTED, /* GetProfile */ 259 NOTSUPPORTED, /* GetProfile */
254 NOTSUPPORTED, /* SetProfile */ 260 NOTSUPPORTED, /* SetProfile */
255 NOTSUPPORTED, /* GetFMStation */ 261 NOTSUPPORTED, /* GetFMStation */
256 NOTSUPPORTED, /* SetFMStation */ 262 NOTSUPPORTED, /* SetFMStation */
257 NOTSUPPORTED, /* ClearFMStations */ 263 NOTSUPPORTED, /* ClearFMStations */
258 NOTSUPPORTED, /* GetNextFileFolder*/ 264 NOTSUPPORTED, /* GetNextFileFolder*/
259 NOTSUPPORTED, /* GetFilePart */ 265 NOTSUPPORTED, /* GetFilePart */
260 NOTIMPLEMENTED, /* AddFilePart */ 266 NOTIMPLEMENTED, /* AddFilePart */
261 NOTSUPPORTED, /* GetFileSystemStatus*/ 267 NOTSUPPORTED, /* GetFileSystemStatus*/
262 NOTIMPLEMENTED, /* DeleteFile */ 268 NOTIMPLEMENTED, /* DeleteFile */
263 NOTIMPLEMENTED, /* AddFolder */ 269 NOTIMPLEMENTED, /* AddFolder */
264 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 270 NOTSUPPORTED, /* GetGPRSAccessPoint*/
265 NOTSUPPORTED /* SetGPRSAccessPoint*/ 271 NOTSUPPORTED /* SetGPRSAccessPoint*/
266}; 272};
267 273
268#endif 274#endif
269 275
270/* How should editor hadle tabs in this file? Add editor commands here. 276/* How should editor hadle tabs in this file? Add editor commands here.
271 * vim: noexpandtab sw=8 ts=8 sts=8: 277 * vim: noexpandtab sw=8 ts=8 sts=8:
272 */ 278 */
diff --git a/gammu/emb/common/phone/nokia/dct4/n3650.c b/gammu/emb/common/phone/nokia/dct4/n3650.c
index d4746a7..f1fa826 100644
--- a/gammu/emb/common/phone/nokia/dct4/n3650.c
+++ b/gammu/emb/common/phone/nokia/dct4/n3650.c
@@ -349,45 +349,51 @@ GSM_Phone_Functions N3650Phone = {
349 NOTSUPPORTED, /* GetMMSSettings */ 349 NOTSUPPORTED, /* GetMMSSettings */
350 NOTSUPPORTED, /* SetMMSSettings */ 350 NOTSUPPORTED, /* SetMMSSettings */
351 NOTSUPPORTED, /* GetSyncMLSettings*/ 351 NOTSUPPORTED, /* GetSyncMLSettings*/
352 NOTSUPPORTED, /* SetSyncMLSettings*/ 352 NOTSUPPORTED, /* SetSyncMLSettings*/
353 NOTSUPPORTED, /* GetChatSettings */ 353 NOTSUPPORTED, /* GetChatSettings */
354 NOTSUPPORTED, /* SetChatSettings */ 354 NOTSUPPORTED, /* SetChatSettings */
355 NOTSUPPORTED, /* GetBitmap */ 355 NOTSUPPORTED, /* GetBitmap */
356 NOTSUPPORTED, /* SetBitmap */ 356 NOTSUPPORTED, /* SetBitmap */
357 NOTSUPPORTED, /* GetToDoStatus */ 357 NOTSUPPORTED, /* GetToDoStatus */
358 NOTSUPPORTED, /* GetToDo */ 358 NOTSUPPORTED, /* GetToDo */
359 NOTSUPPORTED, /* GetNextToDo */ 359 NOTSUPPORTED, /* GetNextToDo */
360 NOTSUPPORTED, /* SetToDo */ 360 NOTSUPPORTED, /* SetToDo */
361 NOTSUPPORTED, /* AddToDo */ 361 NOTSUPPORTED, /* AddToDo */
362 NOTSUPPORTED, /* DeleteToDo */ 362 NOTSUPPORTED, /* DeleteToDo */
363 NOTSUPPORTED, /* DeleteAllToDo */ 363 NOTSUPPORTED, /* DeleteAllToDo */
364 NOTIMPLEMENTED, /* GetCalendarStatus*/ 364 NOTIMPLEMENTED, /* GetCalendarStatus*/
365 NOTIMPLEMENTED, /* GetCalendar */ 365 NOTIMPLEMENTED, /* GetCalendar */
366 NOTSUPPORTED, /* GetNextCalendar */ 366 NOTSUPPORTED, /* GetNextCalendar */
367 NOTIMPLEMENTED, /* SetCalendar */ 367 NOTIMPLEMENTED, /* SetCalendar */
368 NOTSUPPORTED, /* AddCalendar */ 368 NOTSUPPORTED, /* AddCalendar */
369 NOTSUPPORTED, /* DeleteCalendar */ 369 NOTSUPPORTED, /* DeleteCalendar */
370 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 370 NOTIMPLEMENTED, /* DeleteAllCalendar*/
371 NOTSUPPORTED, /* GetCalendarSettings*/ 371 NOTSUPPORTED, /* GetCalendarSettings*/
372 NOTSUPPORTED, /* SetCalendarSettings*/ 372 NOTSUPPORTED, /* SetCalendarSettings*/
373 NOTSUPPORTED, /* GetNoteStatus */
374 NOTSUPPORTED, /* GetNote */
373 NOTSUPPORTED, /* GetNextNote */ 375 NOTSUPPORTED, /* GetNextNote */
376 NOTSUPPORTED, /* SetNote */
377 NOTSUPPORTED, /* AddNote */
378 NOTSUPPORTED, /* DeleteNote */
379 NOTSUPPORTED, /* DeleteAllNotes */
374 NOTSUPPORTED, /* GetProfile */ 380 NOTSUPPORTED, /* GetProfile */
375 NOTSUPPORTED, /* SetProfile */ 381 NOTSUPPORTED, /* SetProfile */
376 NOTSUPPORTED, /* GetFMStation */ 382 NOTSUPPORTED, /* GetFMStation */
377 NOTSUPPORTED, /* SetFMStation */ 383 NOTSUPPORTED, /* SetFMStation */
378 NOTSUPPORTED, /* ClearFMStations */ 384 NOTSUPPORTED, /* ClearFMStations */
379 N3650_GetNextFileFolder, 385 N3650_GetNextFileFolder,
380 N3650_GetFilePart, 386 N3650_GetFilePart,
381 NOTIMPLEMENTED, /* AddFilePart */ 387 NOTIMPLEMENTED, /* AddFilePart */
382 NOTSUPPORTED, /* GetFileSystemStatus*/ 388 NOTSUPPORTED, /* GetFileSystemStatus*/
383 NOTIMPLEMENTED, /* DeleteFile */ 389 NOTIMPLEMENTED, /* DeleteFile */
384 NOTIMPLEMENTED, /* AddFolder */ 390 NOTIMPLEMENTED, /* AddFolder */
385 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 391 NOTSUPPORTED, /* GetGPRSAccessPoint*/
386 NOTSUPPORTED /* SetGPRSAccessPoint*/ 392 NOTSUPPORTED /* SetGPRSAccessPoint*/
387}; 393};
388 394
389#endif 395#endif
390 396
391/* How should editor hadle tabs in this file? Add editor commands here. 397/* How should editor hadle tabs in this file? Add editor commands here.
392 * vim: noexpandtab sw=8 ts=8 sts=8: 398 * vim: noexpandtab sw=8 ts=8 sts=8:
393 */ 399 */
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.c b/gammu/emb/common/phone/nokia/dct4/n6510.c
index 2208def..c481863 100644
--- a/gammu/emb/common/phone/nokia/dct4/n6510.c
+++ b/gammu/emb/common/phone/nokia/dct4/n6510.c
@@ -1,30 +1,39 @@
1/* (c) 2002-2004 by Marcin Wiacek */ 1/* (c) 2002-2004 by Marcin Wiacek */
2/* based on some Markus Plail, Pawel Kot work from Gnokii (www.gnokii.org) 2/* based on some Markus Plail, Pawel Kot work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later 4 * GNU GPL version 2 or later
5 */ 5 */
6/* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ 6/* function for making CRC for filesystem (c) 2003 by Michael Schroeder */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include "../../../gsmstate.h" 17#include "../../../gsmstate.h"
9 18
10#ifdef GSM_ENABLE_NOKIA6510 19#ifdef GSM_ENABLE_NOKIA6510
11 20
12#include <string.h> 21#include <string.h>
13#include <time.h> 22#include <time.h>
14 23
15#include "../../../misc/coding/coding.h" 24#include "../../../misc/coding/coding.h"
16#include "../../../gsmcomon.h" 25#include "../../../gsmcomon.h"
17#include "../../../service/gsmlogo.h" 26#include "../../../service/gsmlogo.h"
18#include "../nfunc.h" 27#include "../nfunc.h"
19#include "../nfuncold.h" 28#include "../nfuncold.h"
20#include "../../pfunc.h" 29#include "../../pfunc.h"
21#include "dct4func.h" 30#include "dct4func.h"
22#include "n6510.h" 31#include "n6510.h"
23 32
24static GSM_Error N6510_Initialise (GSM_StateMachine *s) 33static GSM_Error N6510_Initialise (GSM_StateMachine *s)
25{ 34{
26 s->Phone.Data.Priv.N6510.CalendarIconsNum = 0; 35 s->Phone.Data.Priv.N6510.CalendarIconsNum = 0;
27 36
28 /* Enables various things like incoming SMS, call info, etc. */ 37 /* Enables various things like incoming SMS, call info, etc. */
29 return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17\x39", 7); 38 return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17\x39", 7);
30} 39}
@@ -265,75 +274,75 @@ static GSM_Error N6510_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
265static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 274static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
266{ 275{
267 int current = msg.Buffer[7]+7, tmp; 276 int current = msg.Buffer[7]+7, tmp;
268 GSM_Phone_Data*Data = &s->Phone.Data; 277 GSM_Phone_Data*Data = &s->Phone.Data;
269#ifdef DEBUG 278#ifdef DEBUG
270 char name[100]; 279 char name[100];
271 GSM_NetworkInfo NetInfo; 280 GSM_NetworkInfo NetInfo;
272 281
273 smprintf(s, "Network status : "); 282 smprintf(s, "Network status : ");
274 switch (msg.Buffer[8]) { 283 switch (msg.Buffer[8]) {
275 case 0x00 : smprintf(s, "home network\n"); break; 284 case 0x00 : smprintf(s, "home network\n"); break;
276 case 0x01 : smprintf(s, "roaming network\n"); break; 285 case 0x01 : smprintf(s, "roaming network\n"); break;
277 case 0x04 : smprintf(s, "not logged"); break; 286 case 0x04 : smprintf(s, "not logged"); break;
278 case 0x06 : smprintf(s, "SIM card rejected\n"); break; 287 case 0x06 : smprintf(s, "SIM card rejected\n"); break;
279 case 0x09 : smprintf(s, "not logged"); break; 288 case 0x09 : smprintf(s, "not logged"); break;
280 default : smprintf(s, "unknown %i!\n",msg.Buffer[8]); break; 289 default : smprintf(s, "unknown %i!\n",msg.Buffer[8]); break;
281 } 290 }
282 if (msg.Buffer[8]==0x00 || msg.Buffer[8] == 0x01) { 291 if (msg.Buffer[8]==0x00 || msg.Buffer[8] == 0x01) {
283 NOKIA_DecodeNetworkCode(msg.Buffer + (current + 7),NetInfo.NetworkCode); 292 NOKIA_DecodeNetworkCode(msg.Buffer + (current + 7),NetInfo.NetworkCode);
284 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); 293 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
285 smprintf(s, "Network name for Gammu : %s ", 294 smprintf(s, "Network name for Gammu : %s ",
286 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); 295 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode)));
287 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); 296 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode)));
288 297
289 sprintf(NetInfo.LAC,"%02x%02x", msg.Buffer[current+1], msg.Buffer[current+2]); 298 sprintf(NetInfo.LAC,"%02X%02X", msg.Buffer[current+1], msg.Buffer[current+2]);
290 smprintf(s, "LAC : %s\n", NetInfo.LAC); 299 smprintf(s, "LAC : %s\n", NetInfo.LAC);
291 300
292 sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[current+5], msg.Buffer[current+6]); 301 sprintf(NetInfo.CID, "%02X%02X", msg.Buffer[current+5], msg.Buffer[current+6]);
293 smprintf(s, "CID : %s\n", NetInfo.CID); 302 smprintf(s, "CID : %s\n", NetInfo.CID);
294 303
295 tmp = 10; 304 tmp = 10;
296 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,name,true); 305 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,name,true);
297 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); 306 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
298 } 307 }
299#endif 308#endif
300 if (Data->RequestID==ID_GetNetworkInfo) { 309 if (Data->RequestID==ID_GetNetworkInfo) {
301 Data->NetworkInfo->NetworkName[0] = 0x00; 310 Data->NetworkInfo->NetworkName[0] = 0x00;
302 Data->NetworkInfo->NetworkName[1] = 0x00; 311 Data->NetworkInfo->NetworkName[1] = 0x00;
303 Data->NetworkInfo->State = 0; 312 Data->NetworkInfo->State = 0;
304 switch (msg.Buffer[8]) { 313 switch (msg.Buffer[8]) {
305 case 0x00: Data->NetworkInfo->State = GSM_HomeNetwork; break; 314 case 0x00: Data->NetworkInfo->State = GSM_HomeNetwork; break;
306 case 0x01: Data->NetworkInfo->State = GSM_RoamingNetwork;break; 315 case 0x01: Data->NetworkInfo->State = GSM_RoamingNetwork;break;
307 case 0x04: 316 case 0x04:
308 case 0x06: 317 case 0x06:
309 case 0x09: Data->NetworkInfo->State = GSM_NoNetwork; break; 318 case 0x09: Data->NetworkInfo->State = GSM_NoNetwork; break;
310 } 319 }
311 if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) { 320 if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) {
312 tmp = 10; 321 tmp = 10;
313 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,Data->NetworkInfo->NetworkName,true); 322 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,Data->NetworkInfo->NetworkName,true);
314 sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[current+1], msg.Buffer[current+2]); 323 sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg.Buffer[current+1], msg.Buffer[current+2]);
315 sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[current+5], msg.Buffer[current+6]); 324 sprintf(Data->NetworkInfo->CID, "%02X%02X", msg.Buffer[current+5], msg.Buffer[current+6]);
316 NOKIA_DecodeNetworkCode(msg.Buffer + (current+7),Data->NetworkInfo->NetworkCode); 325 NOKIA_DecodeNetworkCode(msg.Buffer + (current+7),Data->NetworkInfo->NetworkCode);
317 } 326 }
318 } 327 }
319 return ERR_NONE; 328 return ERR_NONE;
320} 329}
321 330
322static GSM_Error N6510_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo) 331static GSM_Error N6510_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
323{ 332{
324 unsigned char req[] = {N6110_FRAME_HEADER, 0x00, 0x00}; 333 unsigned char req[] = {N6110_FRAME_HEADER, 0x00, 0x00};
325 334
326 s->Phone.Data.NetworkInfo=netinfo; 335 s->Phone.Data.NetworkInfo=netinfo;
327 smprintf(s, "Getting network info\n"); 336 smprintf(s, "Getting network info\n");
328 return GSM_WaitFor (s, req, 5, 0x0a, 4, ID_GetNetworkInfo); 337 return GSM_WaitFor (s, req, 5, 0x0a, 4, ID_GetNetworkInfo);
329} 338}
330 339
331static GSM_Error N6510_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char *req, GSM_SMSMessageLayout *Layout, int *length) 340static GSM_Error N6510_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char *req, GSM_SMSMessageLayout *Layout, int *length)
332{ 341{
333 int start, count = 0, pos1, pos2, pos3, pos4, pos5; 342 int start, count = 0, pos1, pos2, pos3, pos4, pos5;
334 GSM_Error error; 343 GSM_Error error;
335 344
336 memset(Layout,255,sizeof(GSM_SMSMessageLayout)); 345 memset(Layout,255,sizeof(GSM_SMSMessageLayout));
337 346
338 start = *length; 347 start = *length;
339 348
@@ -1106,52 +1115,50 @@ static GSM_Error N6510_SetCallerLogo(GSM_StateMachine *s, GSM_Bitmap *bitmap)
1106 string[1] = Height; 1115 string[1] = Height;
1107 string[2] = 0; 1116 string[2] = 0;
1108 string[3] = 0; 1117 string[3] = 0;
1109 string[4] = PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0); 1118 string[4] = PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0);
1110 PHONE_EncodeBitmap(GSM_NokiaCallerLogo, string + 5, bitmap); 1119 PHONE_EncodeBitmap(GSM_NokiaCallerLogo, string + 5, bitmap);
1111 count += N71_65_PackPBKBlock(s, N7110_PBK_GROUPLOGO, PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0) + 5, block++, string, req + count); 1120 count += N71_65_PackPBKBlock(s, N7110_PBK_GROUPLOGO, PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0) + 5, block++, string, req + count);
1112 } 1121 }
1113 1122
1114 req[21] = block; 1123 req[21] = block;
1115 1124
1116 return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetBitmap); 1125 return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetBitmap);
1117} 1126}
1118 1127
1119static GSM_Error N6510_ReplySetPicture(GSM_Protocol_Message msg, GSM_StateMachine *s) 1128static GSM_Error N6510_ReplySetPicture(GSM_Protocol_Message msg, GSM_StateMachine *s)
1120{ 1129{
1121 //smprintf(s, "Picture Image written OK, folder %i, location %i\n",msg.Buffer[4],msg.Buffer[5]*256+msg.Buffer[6]); 1130 //smprintf(s, "Picture Image written OK, folder %i, location %i\n",msg.Buffer[4],msg.Buffer[5]*256+msg.Buffer[6]);
1122 return ERR_NONE; 1131 return ERR_NONE;
1123} 1132}
1124 1133
1125static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) 1134static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
1126{ 1135{
1127 GSM_SMSMessage sms; 1136 GSM_SMSMessage sms;
1128 GSM_Phone_Bitmap_TypesType; 1137 GSM_Phone_Bitmap_TypesType;
1129 int Width, Height, i, count; 1138 int Width, Height, i, count;
1130#ifdef DEVELOP
1131 unsigned char folderid; 1139 unsigned char folderid;
1132 int location; 1140 int location;
1133#endif
1134 GSM_NetworkInfo NetInfo; 1141 GSM_NetworkInfo NetInfo;
1135 GSM_Error error; 1142 GSM_Error error;
1136 unsigned char reqStartup[1000] = { 1143 unsigned char reqStartup[1000] = {
1137 N7110_FRAME_HEADER, 0x04, 0x0F, 1144 N7110_FRAME_HEADER, 0x04, 0x0F,
1138 0x00, 0x00, 0x00, 1145 0x00, 0x00, 0x00,
1139 0x04, 0xC0, 0x02, 0x00, 1146 0x04, 0xC0, 0x02, 0x00,
1140 0x41, 0xC0, 0x03, 0x00, 1147 0x41, 0xC0, 0x03, 0x00,
1141 0x60, 0xC0, 0x04}; 1148 0x60, 0xC0, 0x04};
1142 unsigned char reqColourWallPaper[200] = { 1149 unsigned char reqColourWallPaper[200] = {
1143 N6110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0xD5, 1150 N6110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0xD5,
1144 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 1151 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
1145 0x00, 0x00, 0x00, 0x01, 0x00, 1152 0x00, 0x00, 0x00, 0x01, 0x00,
1146 0x18}; /* Bitmap ID */ 1153 0x18}; /* Bitmap ID */
1147 unsigned char reqColourStartup[200] = { 1154 unsigned char reqColourStartup[200] = {
1148 N6110_FRAME_HEADER, 0x04, 0x25, 0x00, 0x01, 0x00, 0x18}; 1155 N6110_FRAME_HEADER, 0x04, 0x25, 0x00, 0x01, 0x00, 0x18};
1149 unsigned char reqOp[1000] = { 1156 unsigned char reqOp[1000] = {
1150 N7110_FRAME_HEADER, 0x25, 0x01, 1157 N7110_FRAME_HEADER, 0x25, 0x01,
1151 0x55, 0x00, 0x00, 0x55, 1158 0x55, 0x00, 0x00, 0x55,
1152 0x01, /* 0x01 - not set, 0x02 - set */ 1159 0x01, /* 0x01 - not set, 0x02 - set */
1153 0x0C, 0x08, 1160 0x0C, 0x08,
1154 0x62, 0xF0, 0x10,/* Network code */ 1161 0x62, 0xF0, 0x10,/* Network code */
1155 0x03, 0x55, 0x55}; 1162 0x03, 0x55, 0x55};
1156 unsigned char reqColourOp[200] = { 1163 unsigned char reqColourOp[200] = {
1157 N6110_FRAME_HEADER, 1164 N6110_FRAME_HEADER,
@@ -1234,61 +1241,57 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
1234 case GSM_ColourOperatorLogo_ID: 1241 case GSM_ColourOperatorLogo_ID:
1235 /* We want to set operator logo, not clear */ 1242 /* We want to set operator logo, not clear */
1236 if (strcmp(Bitmap->NetworkCode,"000 00")) { 1243 if (strcmp(Bitmap->NetworkCode,"000 00")) {
1237 EncodeBCD(reqColourOp+23, Bitmap->NetworkCode, 6, false); 1244 EncodeBCD(reqColourOp+23, Bitmap->NetworkCode, 6, false);
1238 reqColourOp[21] = Bitmap->ID; 1245 reqColourOp[21] = Bitmap->ID;
1239 } 1246 }
1240 smprintf(s, "Setting colour operator logo\n"); 1247 smprintf(s, "Setting colour operator logo\n");
1241 return GSM_WaitFor (s, reqColourOp, 26, 0x43, 4, ID_SetBitmap); 1248 return GSM_WaitFor (s, reqColourOp, 26, 0x43, 4, ID_SetBitmap);
1242 case GSM_ColourStartupLogo_ID: 1249 case GSM_ColourStartupLogo_ID:
1243 switch (Bitmap->Location) { 1250 switch (Bitmap->Location) {
1244 case 0: reqColourStartup[6] = 0x00; 1251 case 0: reqColourStartup[6] = 0x00;
1245 reqColourStartup[8] = 0x00; 1252 reqColourStartup[8] = 0x00;
1246 smprintf(s, "Setting colour startup logo\n"); 1253 smprintf(s, "Setting colour startup logo\n");
1247 return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap); 1254 return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap);
1248 case 1: reqColourStartup[8] = Bitmap->ID; 1255 case 1: reqColourStartup[8] = Bitmap->ID;
1249 smprintf(s, "Setting colour startup logo\n"); 1256 smprintf(s, "Setting colour startup logo\n");
1250 return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap); 1257 return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap);
1251 default:return ERR_NOTSUPPORTED; 1258 default:return ERR_NOTSUPPORTED;
1252 } 1259 }
1253 case GSM_CallerGroupLogo: 1260 case GSM_CallerGroupLogo:
1254 return N6510_SetCallerLogo(s,Bitmap); 1261 return N6510_SetCallerLogo(s,Bitmap);
1255 case GSM_PictureImage: 1262 case GSM_PictureImage:
1256 error = N6510_GetPictureImage(s, Bitmap, &sms.Location); 1263 error = N6510_GetPictureImage(s, Bitmap, &sms.Location);
1257 if (error == ERR_NONE) { 1264 if (error == ERR_NONE) {
1258#ifdef DEVELOP
1259 sms.Folder = 0; 1265 sms.Folder = 0;
1260 N6510_GetSMSLocation(s, &sms, &folderid, &location); 1266 N6510_GetSMSLocation(s, &sms, &folderid, &location);
1261 switch (folderid) { 1267 switch (folderid) {
1262 case 0x01: reqPicture[5] = 0x02; break; /* INBOX SIM */ 1268 case 0x01: reqPicture[5] = 0x02; break; /* INBOX SIM */
1263 case 0x02: reqPicture[5] = 0x03; break; /* OUTBOX SIM */ 1269 case 0x02: reqPicture[5] = 0x03; break; /* OUTBOX SIM */
1264 default : reqPicture[5] = folderid - 1; reqPicture[4] = 0x02; break; /* ME folders*/ 1270 default : reqPicture[5] = folderid - 1; reqPicture[4] = 0x02; break; /* ME folders*/
1265 } 1271 }
1266 reqPicture[6]=location / 256; 1272 reqPicture[6]=location / 256;
1267 reqPicture[7]=location; 1273 reqPicture[7]=location;
1268#else
1269 return ERR_NOTSUPPORTED;
1270#endif
1271 } 1274 }
1272 Type = GSM_NokiaPictureImage; 1275 Type = GSM_NokiaPictureImage;
1273 count = 78; 1276 count = 78;
1274 PHONE_EncodeBitmap(Type, reqPicture + count, Bitmap); 1277 PHONE_EncodeBitmap(Type, reqPicture + count, Bitmap);
1275 count += PHONE_GetBitmapSize(Type,0,0); 1278 count += PHONE_GetBitmapSize(Type,0,0);
1276 smprintf(s, "Setting Picture Image\n"); 1279 smprintf(s, "Setting Picture Image\n");
1277 return GSM_WaitFor (s, reqPicture, count, 0x14, 4, ID_SetBitmap); 1280 return GSM_WaitFor (s, reqPicture, count, 0x14, 4, ID_SetBitmap);
1278 default: 1281 default:
1279 break; 1282 break;
1280 } 1283 }
1281 return ERR_NOTSUPPORTED; 1284 return ERR_NOTSUPPORTED;
1282} 1285}
1283 1286
1284static GSM_Error N6510_ReplyGetRingtoneID(GSM_Protocol_Message msg, GSM_StateMachine *s) 1287static GSM_Error N6510_ReplyGetRingtoneID(GSM_Protocol_Message msg, GSM_StateMachine *s)
1285{ 1288{
1286 GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; 1289 GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
1287 1290
1288 smprintf(s, "Ringtone ID received\n"); 1291 smprintf(s, "Ringtone ID received\n");
1289 Priv->RingtoneID = msg.Buffer[15]; 1292 Priv->RingtoneID = msg.Buffer[15];
1290 return ERR_NONE; 1293 return ERR_NONE;
1291} 1294}
1292 1295
1293static GSM_Error N6510_ReplySetBinRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) 1296static GSM_Error N6510_ReplySetBinRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
1294{ 1297{
@@ -2398,48 +2401,51 @@ static GSM_Error N6510_ReplySaveSMSMessage(GSM_Protocol_Message msg, GSM_StateMa
2398 smprintf(s, "Done OK\n"); 2401 smprintf(s, "Done OK\n");
2399 smprintf(s, "Folder info: %i %i\n",msg.Buffer[5],msg.Buffer[8]); 2402 smprintf(s, "Folder info: %i %i\n",msg.Buffer[5],msg.Buffer[8]);
2400 switch (msg.Buffer[8]) { 2403 switch (msg.Buffer[8]) {
2401 case 0x02 : if (msg.Buffer[5] == 0x02) { 2404 case 0x02 : if (msg.Buffer[5] == 0x02) {
2402 folder = 0x03; /* INBOX ME */ 2405 folder = 0x03; /* INBOX ME */
2403 } else { 2406 } else {
2404 folder = 0x01; /* INBOX SIM */ 2407 folder = 0x01; /* INBOX SIM */
2405 } 2408 }
2406 break; 2409 break;
2407 case 0x03 : if (msg.Buffer[5] == 0x02) { 2410 case 0x03 : if (msg.Buffer[5] == 0x02) {
2408 folder = 0x04; /* OUTBOX ME */ 2411 folder = 0x04; /* OUTBOX ME */
2409 } else { 2412 } else {
2410 folder = 0x02; /* OUTBOX SIM */ 2413 folder = 0x02; /* OUTBOX SIM */
2411 } 2414 }
2412 break; 2415 break;
2413 default : folder = msg.Buffer[8] + 1; 2416 default : folder = msg.Buffer[8] + 1;
2414 } 2417 }
2415 N6510_SetSMSLocation(s, Data->SaveSMSMessage,folder,msg.Buffer[6]*256+msg.Buffer[7]); 2418 N6510_SetSMSLocation(s, Data->SaveSMSMessage,folder,msg.Buffer[6]*256+msg.Buffer[7]);
2416 smprintf(s, "Saved in folder %i at location %i\n",folder, msg.Buffer[6]*256+msg.Buffer[7]); 2419 smprintf(s, "Saved in folder %i at location %i\n",folder, msg.Buffer[6]*256+msg.Buffer[7]);
2417 Data->SaveSMSMessage->Folder = folder; 2420 Data->SaveSMSMessage->Folder = folder;
2418 return ERR_NONE; 2421 return ERR_NONE;
2419 case 0x02: 2422 case 0x02:
2420 printf("Incorrect location\n"); 2423 printf("Incorrect location\n");
2421 return ERR_INVALIDLOCATION; 2424 return ERR_INVALIDLOCATION;
2425 case 0x03:
2426 printf("Memory full (for example no empty space in SIM)\n");
2427 return ERR_FULL;
2422 case 0x05: 2428 case 0x05:
2423 printf("Incorrect folder\n"); 2429 printf("Incorrect folder\n");
2424 return ERR_INVALIDLOCATION; 2430 return ERR_INVALIDLOCATION;
2425 default: 2431 default:
2426 smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]); 2432 smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
2427 return ERR_UNKNOWNRESPONSE; 2433 return ERR_UNKNOWNRESPONSE;
2428 } 2434 }
2429 case 0x17: 2435 case 0x17:
2430 smprintf(s, "SMS name changed\n"); 2436 smprintf(s, "SMS name changed\n");
2431 return ERR_NONE; 2437 return ERR_NONE;
2432 } 2438 }
2433 return ERR_UNKNOWNRESPONSE; 2439 return ERR_UNKNOWNRESPONSE;
2434} 2440}
2435 2441
2436static GSM_Error N6510_PrivSetSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) 2442static GSM_Error N6510_PrivSetSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
2437{ 2443{
2438 int location, length = 11; 2444 int location, length = 11;
2439 unsigned char folderid, folder; 2445 unsigned char folderid, folder;
2440 GSM_SMSMessageLayout Layout; 2446 GSM_SMSMessageLayout Layout;
2441 GSM_Error error; 2447 GSM_Error error;
2442 unsigned char req [300] = { 2448 unsigned char req [300] = {
2443 N6110_FRAME_HEADER, 0x00, 2449 N6110_FRAME_HEADER, 0x00,
2444 0x01, /* 1 = SIM, 2 = ME */ 2450 0x01, /* 1 = SIM, 2 = ME */
2445 0x02, /* Folder */ 2451 0x02, /* Folder */
@@ -2655,48 +2661,50 @@ static GSM_Error N6510_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
2655 unsigned char req[] = {N6110_FRAME_HEADER, 2661 unsigned char req[] = {N6110_FRAME_HEADER,
2656 0x11, 0x00, 0x01, 0x01, 0x0c, 0x02, 2662 0x11, 0x00, 0x01, 0x01, 0x0c, 0x02,
2657 0x01, 0x00, 0x00, 0x00, 0x00, 2663 0x01, 0x00, 0x00, 0x00, 0x00,
2658 0x00, 0x00, /* Hours, Minutes */ 2664 0x00, 0x00, /* Hours, Minutes */
2659 0x00, 0x00, 0x00 }; 2665 0x00, 0x00, 0x00 };
2660 2666
2661 if (alarm->Location != 1) return ERR_NOTSUPPORTED; 2667 if (alarm->Location != 1) return ERR_NOTSUPPORTED;
2662 2668
2663 req[14] = alarm->DateTime.Hour; 2669 req[14] = alarm->DateTime.Hour;
2664 req[15] = alarm->DateTime.Minute; 2670 req[15] = alarm->DateTime.Minute;
2665 2671
2666 smprintf(s, "Setting alarm\n"); 2672 smprintf(s, "Setting alarm\n");
2667 return GSM_WaitFor (s, req, 19, 0x19, 4, ID_SetAlarm); 2673 return GSM_WaitFor (s, req, 19, 0x19, 4, ID_SetAlarm);
2668} 2674}
2669 2675
2670static GSM_Error N6510_ReplyGetRingtonesInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 2676static GSM_Error N6510_ReplyGetRingtonesInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
2671{ 2677{
2672 int tmp,i; 2678 int tmp,i;
2673 GSM_Phone_Data *Data = &s->Phone.Data; 2679 GSM_Phone_Data *Data = &s->Phone.Data;
2674 2680
2675 smprintf(s, "Ringtones info received\n"); 2681 smprintf(s, "Ringtones info received\n");
2676 memset(Data->RingtonesInfo,0,sizeof(GSM_AllRingtonesInfo)); 2682 memset(Data->RingtonesInfo,0,sizeof(GSM_AllRingtonesInfo));
2677 if (msg.Buffer[4] * 256 + msg.Buffer[5] == 0x00) return ERR_EMPTY; 2683 if (msg.Buffer[4] * 256 + msg.Buffer[5] == 0x00) return ERR_EMPTY;
2678 Data->RingtonesInfo->Number = msg.Buffer[4] * 256 + msg.Buffer[5]; 2684 Data->RingtonesInfo->Number = msg.Buffer[4] * 256 + msg.Buffer[5];
2685 // allocate array of ringtones based on number
2686 Data->RingtonesInfo->Ringtone = calloc(Data->RingtonesInfo->Number, sizeof(GSM_RingtoneInfo));
2679 tmp = 6; 2687 tmp = 6;
2680 for (i=0;i<Data->RingtonesInfo->Number;i++) { 2688 for (i=0;i<Data->RingtonesInfo->Number;i++) {
2681 Data->RingtonesInfo->Ringtone[i].Group = msg.Buffer[tmp+4]; 2689 Data->RingtonesInfo->Ringtone[i].Group = msg.Buffer[tmp+4];
2682 Data->RingtonesInfo->Ringtone[i].ID = msg.Buffer[tmp+2] * 256 + msg.Buffer[tmp+3]; 2690 Data->RingtonesInfo->Ringtone[i].ID = msg.Buffer[tmp+2] * 256 + msg.Buffer[tmp+3];
2683 memcpy(Data->RingtonesInfo->Ringtone[i].Name,msg.Buffer+tmp+8,(msg.Buffer[tmp+6]*256+msg.Buffer[tmp+7])*2); 2691 memcpy(Data->RingtonesInfo->Ringtone[i].Name,msg.Buffer+tmp+8,(msg.Buffer[tmp+6]*256+msg.Buffer[tmp+7])*2);
2684 smprintf(s, "%5i (%5i). \"%s\"\n", 2692 smprintf(s, "%5i (%5i). \"%s\"\n",
2685 Data->RingtonesInfo->Ringtone[i].ID, 2693 Data->RingtonesInfo->Ringtone[i].ID,
2686 Data->RingtonesInfo->Ringtone[i].Group, 2694 Data->RingtonesInfo->Ringtone[i].Group,
2687 DecodeUnicodeString(Data->RingtonesInfo->Ringtone[i].Name)); 2695 DecodeUnicodeString(Data->RingtonesInfo->Ringtone[i].Name));
2688 tmp = tmp + (msg.Buffer[tmp]*256+msg.Buffer[tmp+1]); 2696 tmp = tmp + (msg.Buffer[tmp]*256+msg.Buffer[tmp+1]);
2689 } 2697 }
2690 return ERR_NONE; 2698 return ERR_NONE;
2691} 2699}
2692 2700
2693static GSM_Error N6510_PrivGetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info, bool AllRingtones) 2701static GSM_Error N6510_PrivGetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info, bool AllRingtones)
2694{ 2702{
2695 GSM_Errorerror; 2703 GSM_Errorerror;
2696 unsigned char UserReq[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x02}; 2704 unsigned char UserReq[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x02};
2697 // unsigned char All_Req[9] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x7D}; 2705 // unsigned char All_Req[9] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x7D};
2698 unsigned char All_Req[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x00}; 2706 unsigned char All_Req[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x00};
2699 2707
2700 s->Phone.Data.RingtonesInfo=Info; 2708 s->Phone.Data.RingtonesInfo=Info;
2701 smprintf(s, "Getting binary ringtones ID\n"); 2709 smprintf(s, "Getting binary ringtones ID\n");
2702 if (AllRingtones) { 2710 if (AllRingtones) {
@@ -2733,69 +2741,71 @@ static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi
2733 smprintf(s,"MIDI\n"); 2741 smprintf(s,"MIDI\n");
2734 tmp = msg.Buffer[7]*2+10; 2742 tmp = msg.Buffer[7]*2+10;
2735 i = msg.Length - 2; /* ?????? */ 2743 i = msg.Length - 2; /* ?????? */
2736 Data->Ringtone->Format = RING_MIDI; 2744 Data->Ringtone->Format = RING_MIDI;
2737 } else { 2745 } else {
2738 /* Looking for end */ 2746 /* Looking for end */
2739 i=8+msg.Buffer[7]*2+3; 2747 i=8+msg.Buffer[7]*2+3;
2740 tmp = i; 2748 tmp = i;
2741 while (true) { 2749 while (true) {
2742 if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) { 2750 if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) {
2743 i=i+2; break; 2751 i=i+2; break;
2744 } 2752 }
2745 i++; 2753 i++;
2746 if (i==msg.Length) return ERR_EMPTY; 2754 if (i==msg.Length) return ERR_EMPTY;
2747 } 2755 }
2748 } 2756 }
2749 /* Copying frame */ 2757 /* Copying frame */
2750 memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+tmp,i-tmp); 2758 memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+tmp,i-tmp);
2751 Data->Ringtone->NokiaBinary.Length=i-tmp; 2759 Data->Ringtone->NokiaBinary.Length=i-tmp;
2752 return ERR_NONE; 2760 return ERR_NONE;
2753} 2761}
2754 2762
2755static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) 2763static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone)
2756{ 2764{
2757 GSM_AllRingtonesInfo Info; 2765 GSM_AllRingtonesInfo Info = {0, NULL};
2758 GSM_Error error; 2766 GSM_Error error;
2759 unsigned char req2[6] = {N7110_FRAME_HEADER, 0x12, 2767 unsigned char req2[6] = {N7110_FRAME_HEADER, 0x12,
2760 0x00, 0xe7}; /* Location */ 2768 0x00, 0xe7}; /* Location */
2761 2769
2762 if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; 2770 if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY;
2763 2771
2764 switch (Ringtone->Format) { 2772 switch (Ringtone->Format) {
2765 case RING_NOTETONE: 2773 case RING_NOTETONE:
2766 /* In the future get binary and convert */ 2774 /* In the future get binary and convert */
2767 return ERR_NOTSUPPORTED; 2775 return ERR_NOTSUPPORTED;
2768 case RING_NOKIABINARY: 2776 case RING_NOKIABINARY:
2769 s->Phone.Data.Ringtone= Ringtone; 2777 s->Phone.Data.Ringtone= Ringtone;
2770 Info.Number = 0; 2778 Info.Number = 0;
2771 error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); 2779 error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone);
2772 if (error != ERR_NONE) return error; 2780 if (error != ERR_NONE) return error;
2773 if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; 2781 if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION;
2774 req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; 2782 req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256;
2775 req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; 2783 req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256;
2776 smprintf(s, "Getting binary ringtone\n"); 2784 smprintf(s, "Getting binary ringtone\n");
2777 return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); 2785 error = GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone);
2786 if (Info.Ringtone) free(Info.Ringtone);
2787 return error;
2778 case RING_MIDI: 2788 case RING_MIDI:
2779 case RING_MMF: 2789 case RING_MMF:
2780 return ERR_NOTSUPPORTED; 2790 return ERR_NOTSUPPORTED;
2781 } 2791 }
2782 return ERR_NOTSUPPORTED; 2792 return ERR_NOTSUPPORTED;
2783} 2793}
2784 2794
2785static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) 2795static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start)
2786{ 2796{
2787 GSM_Error error; 2797 GSM_Error error;
2788 unsigned char reqStart[] = { 2798 unsigned char reqStart[] = {
2789 0x00,0x06,0x01,0x00,0x07,0x00 }; 2799 0x00,0x06,0x01,0x00,0x07,0x00 };
2790 unsigned char reqPlay[] = { 2800 unsigned char reqPlay[] = {
2791 0x00,0x06,0x01,0x14,0x05,0x04, 2801 0x00,0x06,0x01,0x14,0x05,0x04,
2792 0x00,0x00,0x00,0x03,0x03,0x08, 2802 0x00,0x00,0x00,0x03,0x03,0x08,
2793 0x00,0x00,0x00,0x01,0x00,0x00, 2803 0x00,0x00,0x00,0x01,0x00,0x00,
2794 0x03,0x08,0x01,0x00, 2804 0x03,0x08,0x01,0x00,
2795 0x07,0xd0,/*Frequency */ 2805 0x07,0xd0,/*Frequency */
2796 0x00,0x00,0x03,0x08,0x02,0x00,0x00, 2806 0x00,0x00,0x03,0x08,0x02,0x00,0x00,
2797 0x05, /*Volume */ 2807 0x05, /*Volume */
2798 0x00,0x00}; 2808 0x00,0x00};
2799 unsigned char reqOff[] = { 2809 unsigned char reqOff[] = {
2800 0x00,0x06,0x01,0x14,0x05,0x05, 2810 0x00,0x06,0x01,0x14,0x05,0x05,
2801 0x00,0x00,0x00,0x01,0x03,0x08, 2811 0x00,0x00,0x00,0x01,0x03,0x08,
@@ -4033,48 +4043,139 @@ static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *
4033} 4043}
4034 4044
4035GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start) 4045GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start)
4036{ 4046{
4037 GSM_Error error; 4047 GSM_Error error;
4038 GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; 4048 GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote;
4039 4049
4040 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED; 4050 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED;
4041 4051
4042 if (start) { 4052 if (start) {
4043 error=N6510_GetCalendarInfo3(s,LastNote,2); 4053 error=N6510_GetCalendarInfo3(s,LastNote,2);
4044 if (error!=ERR_NONE) return error; 4054 if (error!=ERR_NONE) return error;
4045 Note->Location = 1; 4055 Note->Location = 1;
4046 } else { 4056 } else {
4047 Note->Location++; 4057 Note->Location++;
4048 } 4058 }
4049 4059
4050 if (Note->Location > LastNote->Number) return ERR_EMPTY; 4060 if (Note->Location > LastNote->Number) return ERR_EMPTY;
4051 4061
4052 s->Phone.Data.Note = Note; 4062 s->Phone.Data.Note = Note;
4053 smprintf(s, "Getting note\n"); 4063 smprintf(s, "Getting note\n");
4054 return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote); 4064 return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote);
4055} 4065}
4056 4066
4067static GSM_Error N6510_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *Not)
4068{
4069 GSM_Error error;
4070 GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote;
4071 GSM_CalendarEntry Note;
4072
4073 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED;
4074
4075 error=N6510_GetCalendarInfo3(s,LastNote,2);
4076 if (error!=ERR_NONE) return error;
4077
4078 smprintf(s, "Deleting Note\n");
4079
4080 if (Not->Location > LastNote->Number || Not->Location == 0) return ERR_INVALIDLOCATION;
4081
4082 Note.Location = LastNote->Location[Not->Location-1];
4083 return N71_65_DelCalendar(s,&Note);
4084}
4085
4086static GSM_Error N6510_ReplyGetNoteFirstLoc(GSM_Protocol_Message msg, GSM_StateMachine *s)
4087{
4088 smprintf(s, "First Note location: %i\n",msg.Buffer[8]*256+msg.Buffer[9]);
4089 s->Phone.Data.Note->Location = msg.Buffer[8]*256+msg.Buffer[9];
4090 return ERR_NONE;
4091}
4092
4093static GSM_Error N6510_ReplyAddNote(GSM_Protocol_Message msg, GSM_StateMachine *s)
4094{
4095 smprintf(s, "ToDo added\n");
4096 return ERR_NONE;
4097}
4098
4099static GSM_Error N6510_AddNote(GSM_StateMachine *s, GSM_NoteEntry *Not)
4100{
4101 GSM_Error error;
4102 int count=54;
4103 unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95,
4104 0x02};/* 1 = todo, 2 = note */
4105 unsigned char req[5000] = {
4106 N6110_FRAME_HEADER, 0x65,
4107 0x02, /* 0 = calendar, 1 = todo, 2 = note */
4108 0x00, 0x00, 0x00,
4109 0x00, 0x00, /* location */
4110 0x00, 0x00, 0x00, 0x00,
4111 0xFF, 0xFF, 0xFF, 0xFF, /* alarm */
4112 0x80, 0x00, 0x00,
4113 0xA9, /* note icon */
4114 0x00, 0x00, 0x00, 0x00, /* alarm type */
4115 0x00, /* 0x02 or 0x00 */
4116 0x80, /* note type */
4117 0x07, 0xD2, 0x01, 0x01, 0x00, 0x00, /* start date/time */
4118 0x07, 0xD2, 0x01, 0x11, 0x00, 0x00, /* end date/time */
4119 0x00, 0x00, /* recurrance */
4120 0xFF, 0xFF, /* birth year */
4121 0x00, /* ToDo priority */
4122 0x00, /* ToDo completed ? */
4123 0x00, 0x00, 0x00,
4124 0x00, /* note text length */
4125 0x00, /* phone length/meeting place */
4126 0x00, 0x00, 0x00};
4127
4128 s->Phone.Data.Note = Not;
4129
4130 smprintf(s, "Getting first free Note location\n");
4131 error = GSM_WaitFor (s, reqLoc, 5, 0x13, 4, ID_SetNote);
4132 if (error!=ERR_NONE) return error;
4133 req[8] = Not->Location/256;
4134 req[9] = Not->Location%256;
4135
4136 req[49] = UnicodeLength(Not->Text);
4137 CopyUnicodeString(req+54,Not->Text);
4138 count+= req[49]*2;
4139
4140 req[count++] = 0x00;
4141
4142 smprintf(s, "Adding Note\n");
4143 return GSM_WaitFor (s, req, count, 0x13, 4, ID_SetNote);
4144}
4145
4146static GSM_Error N6510_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
4147{
4148 GSM_NOKIACalToDoLocations*LastNote = &s->Phone.Data.Priv.N6510.LastNote;
4149 GSM_Error error;
4150
4151 error = N6510_GetCalendarInfo3(s,LastNote,2);
4152 if (error!=ERR_NONE) return error;
4153
4154 status->Used = LastNote->Number;
4155 return ERR_NONE;
4156}
4157
4057static int N6510_FindFileCheckSum(unsigned char *ptr, int len) 4158static int N6510_FindFileCheckSum(unsigned char *ptr, int len)
4058{ 4159{
4059 int acc, i, accx; 4160 int acc, i, accx;
4060 4161
4061 accx = 0; 4162 accx = 0;
4062 acc = 0xffff; 4163 acc = 0xffff;
4063 while (len--) { 4164 while (len--) {
4064 accx = (accx & 0xffff00ff) | (acc & 0xff00); 4165 accx = (accx & 0xffff00ff) | (acc & 0xff00);
4065 acc = (acc & 0xffff00ff) | *ptr++ << 8; 4166 acc = (acc & 0xffff00ff) | *ptr++ << 8;
4066 for (i = 0; i < 8; i++) { 4167 for (i = 0; i < 8; i++) {
4067 acc <<= 1; 4168 acc <<= 1;
4068 if (acc & 0x10000) acc ^= 0x1021; 4169 if (acc & 0x10000) acc ^= 0x1021;
4069 if (accx & 0x80000000) acc ^= 0x1021; 4170 if (accx & 0x80000000) acc ^= 0x1021;
4070 accx <<= 1; 4171 accx <<= 1;
4071 } 4172 }
4072 } 4173 }
4073 dbgprintf("Checksum from Gammu is %04X\n",(acc & 0xffff)); 4174 dbgprintf("Checksum from Gammu is %04X\n",(acc & 0xffff));
4074 return (acc & 0xffff); 4175 return (acc & 0xffff);
4075} 4176}
4076 4177
4077static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 4178static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
4078{ 4179{
4079 GSM_File *File = s->Phone.Data.FileInfo; 4180 GSM_File *File = s->Phone.Data.FileInfo;
4080 GSM_Phone_N6510Data*Priv = &s->Phone.Data.Priv.N6510; 4181 GSM_Phone_N6510Data*Priv = &s->Phone.Data.Priv.N6510;
@@ -5168,61 +5269,62 @@ static GSM_Error N6510_AddToDo1(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
5168 case GSM_Priority_High: reqSet[4] = 1; break; 5269 case GSM_Priority_High: reqSet[4] = 1; break;
5169 } 5270 }
5170 5271
5171 GSM_ToDoFindDefaultTextTimeAlarmCompleted(ToDo, &Text, &Alarm, &Completed, &EndTime, &Phone); 5272 GSM_ToDoFindDefaultTextTimeAlarmCompleted(ToDo, &Text, &Alarm, &Completed, &EndTime, &Phone);
5172 5273
5173 if (Text == -1) return ERR_NOTSUPPORTED; /* XXX: shouldn't this be handled different way? */ 5274 if (Text == -1) return ERR_NOTSUPPORTED; /* XXX: shouldn't this be handled different way? */
5174 ulen = UnicodeLength(ToDo->Entries[Text].Text); 5275 ulen = UnicodeLength(ToDo->Entries[Text].Text);
5175 reqSet[5] = ulen+1; 5276 reqSet[5] = ulen+1;
5176 CopyUnicodeString(reqSet+10,ToDo->Entries[Text].Text); 5277 CopyUnicodeString(reqSet+10,ToDo->Entries[Text].Text);
5177 reqSet[10+ulen*2] = 0x00; 5278 reqSet[10+ulen*2] = 0x00;
5178 reqSet[10+ulen*2+1] = 0x00; 5279 reqSet[10+ulen*2+1] = 0x00;
5179 smprintf(s, "Adding ToDo method 1\n"); 5280 smprintf(s, "Adding ToDo method 1\n");
5180 return GSM_WaitFor (s, reqSet, 12+ulen*2, 0x55, 4, ID_SetToDo); 5281 return GSM_WaitFor (s, reqSet, 12+ulen*2, 0x55, 4, ID_SetToDo);
5181} 5282}
5182 5283
5183static GSM_Error N6510_ReplyAddToDo2(GSM_Protocol_Message msg, GSM_StateMachine *s) 5284static GSM_Error N6510_ReplyAddToDo2(GSM_Protocol_Message msg, GSM_StateMachine *s)
5184{ 5285{
5185 smprintf(s, "ToDo added method 2\n"); 5286 smprintf(s, "ToDo added method 2\n");
5186 return ERR_NONE; 5287 return ERR_NONE;
5187} 5288}
5188 5289
5189static GSM_Error N6510_ReplyGetToDoFirstLoc2(GSM_Protocol_Message msg, GSM_StateMachine *s) 5290static GSM_Error N6510_ReplyGetToDoFirstLoc2(GSM_Protocol_Message msg, GSM_StateMachine *s)
5190{ 5291{
5191 smprintf(s, "First ToDo location method 2: %i\n",msg.Buffer[8]*256+msg.Buffer[9]); 5292 smprintf(s, "First ToDo location method 2: %i\n",msg.Buffer[8]*256+msg.Buffer[9]);
5192 s->Phone.Data.ToDo->Location = msg.Buffer[9]; 5293 s->Phone.Data.ToDo->Location = msg.Buffer[8]*256+msg.Buffer[9];
5193 return ERR_NONE; 5294 return ERR_NONE;
5194} 5295}
5195 5296
5196static GSM_Error N6510_AddToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) 5297static GSM_Error N6510_AddToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
5197{ 5298{
5198 GSM_CalendarEntryNote; 5299 GSM_CalendarEntryNote;
5199 time_t t_time1,t_time2; 5300 time_t t_time1,t_time2;
5200 long diff; 5301 long diff;
5201 GSM_Error error; 5302 GSM_Error error;
5202 GSM_DateTime DT; 5303 GSM_DateTime DT;
5203 int Text, Alarm, EndTime, Completed, count=54, Phone; 5304 int Text, Alarm, EndTime, Completed, count=54, Phone;
5204 unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95, 0x01}; 5305 unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95,
5306 0x01};/* 1 = todo, 2 = note */
5205 unsigned char req[5000] = { 5307 unsigned char req[5000] = {
5206 N6110_FRAME_HEADER, 0x65, 5308 N6110_FRAME_HEADER, 0x65,
5207 0x01, /* 0 = calendar, 1 = todo */ 5309 0x01, /* 0 = calendar, 1 = todo */
5208 0x00, 0x00, 0x00, 5310 0x00, 0x00, 0x00,
5209 0x00, 0x00, /* location */ 5311 0x00, 0x00, /* location */
5210 0x00, 0x00, 0x00, 0x00, 5312 0x00, 0x00, 0x00, 0x00,
5211 0xFF, 0xFF, 0xFF, 0xFF, /* alarm */ 5313 0xFF, 0xFF, 0xFF, 0xFF, /* alarm */
5212 0x80, 0x00, 0x00, 5314 0x80, 0x00, 0x00,
5213 0x01, /* note icon */ 5315 0x01, /* note icon */
5214 0xFF, 0xFF, 0xFF, 0xFF, /* alarm type */ 5316 0xFF, 0xFF, 0xFF, 0xFF, /* alarm type */
5215 0x00, /* 0x02 or 0x00 */ 5317 0x00, /* 0x02 or 0x00 */
5216 0x01, /* note type */ 5318 0x01, /* note type */
5217 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* start date/time */ 5319 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* start date/time */
5218 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* end date/time */ 5320 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* end date/time */
5219 0x00, 0x00, /* recurrance */ 5321 0x00, 0x00, /* recurrance */
5220 0x00, 0x00, /* birth year */ 5322 0x00, 0x00, /* birth year */
5221 0x20, /* ToDo priority */ 5323 0x20, /* ToDo priority */
5222 0x00, /* ToDo completed ? */ 5324 0x00, /* ToDo completed ? */
5223 0x00, 0x00, 0x00, 5325 0x00, 0x00, 0x00,
5224 0x00, /* note text length */ 5326 0x00, /* note text length */
5225 0x00, /* phone length/meeting place*/ 5327 0x00, /* phone length/meeting place*/
5226 0x00, 0x00, 0x00}; 5328 0x00, 0x00, 0x00};
5227 5329
5228 s->Phone.Data.ToDo = ToDo; 5330 s->Phone.Data.ToDo = ToDo;
@@ -5564,56 +5666,58 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5564 {N6510_ReplyGetSignalQuality, "\x0A",0x03,0x0C,ID_GetSignalQuality }, 5666 {N6510_ReplyGetSignalQuality, "\x0A",0x03,0x0C,ID_GetSignalQuality },
5565 {N6510_ReplyGetIncSignalQuality, "\x0A",0x03,0x1E,ID_IncomingFrame }, 5667 {N6510_ReplyGetIncSignalQuality, "\x0A",0x03,0x1E,ID_IncomingFrame },
5566 {NoneReply, "\x0A",0x03,0x20,ID_IncomingFrame }, 5668 {NoneReply, "\x0A",0x03,0x20,ID_IncomingFrame },
5567 {N6510_ReplyGetOperatorLogo, "\x0A",0x03,0x24,ID_GetBitmap }, 5669 {N6510_ReplyGetOperatorLogo, "\x0A",0x03,0x24,ID_GetBitmap },
5568 {N6510_ReplySetOperatorLogo, "\x0A",0x03,0x26,ID_SetBitmap }, 5670 {N6510_ReplySetOperatorLogo, "\x0A",0x03,0x26,ID_SetBitmap },
5569 5671
5570 {NoneReply, "\x0B",0x03,0x01,ID_PlayTone }, 5672 {NoneReply, "\x0B",0x03,0x01,ID_PlayTone },
5571 {NoneReply, "\x0B",0x03,0x15,ID_PlayTone }, 5673 {NoneReply, "\x0B",0x03,0x15,ID_PlayTone },
5572 {NoneReply, "\x0B",0x03,0x16,ID_PlayTone }, 5674 {NoneReply, "\x0B",0x03,0x16,ID_PlayTone },
5573 5675
5574 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote }, 5676 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote },
5575 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote }, 5677 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote },
5576 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote }, 5678 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote },
5577 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote }, 5679 {N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote },
5578 {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, 5680 {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote },
5579 {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ 5681 {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/
5580 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ 5682 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/
5581 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ 5683 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/
5582#ifdef DEBUG 5684#ifdef DEBUG
5583 {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, 5685 {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote },
5584#endif 5686#endif
5585 {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ 5687 {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/
5586 {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ 5688 {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/
5587 {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, 5689 {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo },
5690 {N6510_ReplyAddNote, "\x13",0x03,0x66,ID_SetNote },
5588 {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ 5691 {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/
5589 {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, 5692 {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo },
5590 {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote }, 5693 {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote },
5591 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, 5694 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings },
5592 {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, 5695 {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale },
5593 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, 5696 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings },
5594 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ 5697 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/
5595 {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, 5698 {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo },
5699 {N6510_ReplyGetNoteFirstLoc, "\x13",0x03,0x96,ID_SetNote },
5596 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ 5700 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/
5597 {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, 5701 {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo },
5598 {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote }, 5702 {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote },
5599 5703
5600 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, 5704 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage },
5601 {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, 5705 {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap },
5602 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, 5706 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage },
5603 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, 5707 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage },
5604 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, 5708 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage },
5605 {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, 5709 {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus },
5606 {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, 5710 {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus },
5607 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, 5711 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage },
5608 {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, 5712 {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder },
5609 {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, 5713 {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders },
5610 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, 5714 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage },
5611 {N6510_ReplyGetSMSStatus, "\x14",0x03,0x1a,ID_GetSMSStatus }, 5715 {N6510_ReplyGetSMSStatus, "\x14",0x03,0x1a,ID_GetSMSStatus },
5612 5716
5613 {DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset }, 5717 {DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset },
5614 {DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset }, 5718 {DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset },
5615 {NoneReply, "\x15",0x03,0x68,ID_Reset }, 5719 {NoneReply, "\x15",0x03,0x68,ID_Reset },
5616 5720
5617 {N6510_ReplyGetBatteryCharge, "\x17",0x03,0x0B,ID_GetBatteryCharge }, 5721 {N6510_ReplyGetBatteryCharge, "\x17",0x03,0x0B,ID_GetBatteryCharge },
5618 5722
5619 {N6510_ReplySetDateTime, "\x19",0x03,0x02,ID_SetDateTime }, 5723 {N6510_ReplySetDateTime, "\x19",0x03,0x02,ID_SetDateTime },
@@ -5711,49 +5815,49 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5711 {N6510_ReplyAddFilePart, "\x6D",0x03,0x41,ID_AddFile }, 5815 {N6510_ReplyAddFilePart, "\x6D",0x03,0x41,ID_AddFile },
5712 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_AddFile }, 5816 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_AddFile },
5713 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFile }, 5817 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFile },
5714 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFileInfo }, 5818 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFileInfo },
5715 5819
5716 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_GetBitmap }, 5820 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_GetBitmap },
5717 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_SetBitmap }, 5821 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_SetBitmap },
5718 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_GetBitmap }, 5822 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_GetBitmap },
5719 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_SetBitmap }, 5823 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_SetBitmap },
5720 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_GetBitmap }, 5824 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_GetBitmap },
5721 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_SetBitmap }, 5825 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_SetBitmap },
5722 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x25,ID_SetBitmap }, 5826 {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x25,ID_SetBitmap },
5723 5827
5724 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, 5828 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
5725 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, 5829 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
5726 5830
5727 /* 0xD7 - Bluetooth */ 5831 /* 0xD7 - Bluetooth */
5728 5832
5729 {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, 5833 {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone },
5730 5834
5731 {NULL, "\x00",0x00,0x00,ID_None } 5835 {NULL, "\x00",0x00,0x00,ID_None }
5732}; 5836};
5733 5837
5734GSM_Phone_Functions N6510Phone = { 5838GSM_Phone_Functions N6510Phone = {
5735 "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i", 5839 "1100|1100a|1100b|3100|3100b|3105|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i",
5736 N6510ReplyFunctions, 5840 N6510ReplyFunctions,
5737 N6510_Initialise, 5841 N6510_Initialise,
5738 NONEFUNCTION, /* Terminate */ 5842 NONEFUNCTION, /* Terminate */
5739 GSM_DispatchMessage, 5843 GSM_DispatchMessage,
5740 N6510_ShowStartInfo, 5844 N6510_ShowStartInfo,
5741 NOKIA_GetManufacturer, 5845 NOKIA_GetManufacturer,
5742 DCT3DCT4_GetModel, 5846 DCT3DCT4_GetModel,
5743 DCT3DCT4_GetFirmware, 5847 DCT3DCT4_GetFirmware,
5744 DCT4_GetIMEI, 5848 DCT4_GetIMEI,
5745 N6510_GetOriginalIMEI, 5849 N6510_GetOriginalIMEI,
5746 N6510_GetManufactureMonth, 5850 N6510_GetManufactureMonth,
5747 DCT4_GetProductCode, 5851 DCT4_GetProductCode,
5748 DCT4_GetHardware, 5852 DCT4_GetHardware,
5749 N6510_GetPPM, 5853 N6510_GetPPM,
5750 NOTSUPPORTED, /* GetSIMIMSI */ 5854 NOTSUPPORTED, /* GetSIMIMSI */
5751 N6510_GetDateTime, 5855 N6510_GetDateTime,
5752 N6510_SetDateTime, 5856 N6510_SetDateTime,
5753 N6510_GetAlarm, 5857 N6510_GetAlarm,
5754 N6510_SetAlarm, 5858 N6510_SetAlarm,
5755 N6510_GetLocale, 5859 N6510_GetLocale,
5756 NOTSUPPORTED, /* SetLocale */ 5860 NOTSUPPORTED, /* SetLocale */
5757 N6510_PressKey, 5861 N6510_PressKey,
5758 DCT4_Reset, 5862 DCT4_Reset,
5759 NOTIMPLEMENTED, /* ResetPhoneSettings*/ 5863 NOTIMPLEMENTED, /* ResetPhoneSettings*/
@@ -5820,45 +5924,51 @@ GSM_Phone_Functions N6510Phone = {
5820 N6510_GetMMSSettings, 5924 N6510_GetMMSSettings,
5821 N6510_SetMMSSettings, 5925 N6510_SetMMSSettings,
5822 N6510_GetSyncMLSettings, 5926 N6510_GetSyncMLSettings,
5823 NOTSUPPORTED, /* SetSyncMLSettings*/ 5927 NOTSUPPORTED, /* SetSyncMLSettings*/
5824 N6510_GetChatSettings, 5928 N6510_GetChatSettings,
5825 NOTSUPPORTED, /* SetChatSettings */ 5929 NOTSUPPORTED, /* SetChatSettings */
5826 N6510_GetBitmap, 5930 N6510_GetBitmap,
5827 N6510_SetBitmap, 5931 N6510_SetBitmap,
5828 N6510_GetToDoStatus, 5932 N6510_GetToDoStatus,
5829 NOTIMPLEMENTED, /* GetToDo */ 5933 NOTIMPLEMENTED, /* GetToDo */
5830 N6510_GetNextToDo, 5934 N6510_GetNextToDo,
5831 NOTIMPLEMENTED, /* SetToDo */ 5935 NOTIMPLEMENTED, /* SetToDo */
5832 N6510_AddToDo, 5936 N6510_AddToDo,
5833 N6510_DeleteToDo2, 5937 N6510_DeleteToDo2,
5834 N6510_DeleteAllToDo1, 5938 N6510_DeleteAllToDo1,
5835 N6510_GetCalendarStatus, 5939 N6510_GetCalendarStatus,
5836 NOTIMPLEMENTED, /* GetCalendar */ 5940 NOTIMPLEMENTED, /* GetCalendar */
5837 N6510_GetNextCalendar, 5941 N6510_GetNextCalendar,
5838 NOTIMPLEMENTED, /* SetCalendar */ 5942 NOTIMPLEMENTED, /* SetCalendar */
5839 N6510_AddCalendar, 5943 N6510_AddCalendar,
5840 N71_65_DelCalendar, 5944 N71_65_DelCalendar,
5841 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 5945 NOTIMPLEMENTED, /* DeleteAllCalendar*/
5842 N6510_GetCalendarSettings, 5946 N6510_GetCalendarSettings,
5843 NOTSUPPORTED, /* SetCalendarSettings*/ 5947 NOTSUPPORTED, /* SetCalendarSettings*/
5948 N6510_GetNoteStatus,
5949 NOTIMPLEMENTED, /* GetNote */
5844 N6510_GetNextNote, 5950 N6510_GetNextNote,
5951 NOTIMPLEMENTED, /* SetNote */
5952 N6510_AddNote,
5953 N6510_DeleteNote,
5954 NOTSUPPORTED, /* DeleteAllNotes */
5845 N6510_GetProfile, 5955 N6510_GetProfile,
5846 N6510_SetProfile, 5956 N6510_SetProfile,
5847 N6510_GetFMStation, 5957 N6510_GetFMStation,
5848 N6510_SetFMStation, 5958 N6510_SetFMStation,
5849 N6510_ClearFMStations, 5959 N6510_ClearFMStations,
5850 N6510_GetNextFileFolder, 5960 N6510_GetNextFileFolder,
5851 N6510_GetFilePart, 5961 N6510_GetFilePart,
5852 N6510_AddFilePart, 5962 N6510_AddFilePart,
5853 N6510_GetFileSystemStatus, 5963 N6510_GetFileSystemStatus,
5854 N6510_DeleteFile, 5964 N6510_DeleteFile,
5855 N6510_AddFolder, 5965 N6510_AddFolder,
5856 N6510_GetGPRSAccessPoint, 5966 N6510_GetGPRSAccessPoint,
5857 N6510_SetGPRSAccessPoint 5967 N6510_SetGPRSAccessPoint
5858}; 5968};
5859 5969
5860#endif 5970#endif
5861 5971
5862/* How should editor hadle tabs in this file? Add editor commands here. 5972/* How should editor hadle tabs in this file? Add editor commands here.
5863 * vim: noexpandtab sw=8 ts=8 sts=8: 5973 * vim: noexpandtab sw=8 ts=8 sts=8:
5864 */ 5974 */
diff --git a/gammu/emb/common/phone/nokia/nauto.c b/gammu/emb/common/phone/nokia/nauto.c
index 3bb53ec..3c7f2cd 100644
--- a/gammu/emb/common/phone/nokia/nauto.c
+++ b/gammu/emb/common/phone/nokia/nauto.c
@@ -100,45 +100,51 @@ GSM_Phone_Functions NAUTOPhone = {
100 NOTSUPPORTED, /* SetWAPBookmark */ 100 NOTSUPPORTED, /* SetWAPBookmark */
101 NOTSUPPORTED, /* DeleteWAPBookmark */ 101 NOTSUPPORTED, /* DeleteWAPBookmark */
102 NOTSUPPORTED, /* GetWAPSettings */ 102 NOTSUPPORTED, /* GetWAPSettings */
103 NOTSUPPORTED, /* SetWAPSettings */ 103 NOTSUPPORTED, /* SetWAPSettings */
104 NOTSUPPORTED, /* GetMMSSettings */ 104 NOTSUPPORTED, /* GetMMSSettings */
105 NOTSUPPORTED, /* SetMMSSettings */ 105 NOTSUPPORTED, /* SetMMSSettings */
106 NOTSUPPORTED, /* GetBitmap */ 106 NOTSUPPORTED, /* GetBitmap */
107 NOTSUPPORTED, /* SetBitmap */ 107 NOTSUPPORTED, /* SetBitmap */
108 NOTSUPPORTED, /* GetToDoStatus */ 108 NOTSUPPORTED, /* GetToDoStatus */
109 NOTSUPPORTED, /* GetToDo */ 109 NOTSUPPORTED, /* GetToDo */
110 NOTSUPPORTED, /* GetNextToDo */ 110 NOTSUPPORTED, /* GetNextToDo */
111 NOTSUPPORTED, /* SetToDo */ 111 NOTSUPPORTED, /* SetToDo */
112 NOTSUPPORTED, /* AddToDo */ 112 NOTSUPPORTED, /* AddToDo */
113 NOTSUPPORTED, /* DeleteToDo */ 113 NOTSUPPORTED, /* DeleteToDo */
114 NOTSUPPORTED, /* DeleteAllToDo */ 114 NOTSUPPORTED, /* DeleteAllToDo */
115 NOTSUPPORTED, /* GetCalendarStatus*/ 115 NOTSUPPORTED, /* GetCalendarStatus*/
116 NOTSUPPORTED, /* GetCalendar */ 116 NOTSUPPORTED, /* GetCalendar */
117 NOTSUPPORTED, /* GetNextCalendar */ 117 NOTSUPPORTED, /* GetNextCalendar */
118 NOTSUPPORTED, /* SetCalendar */ 118 NOTSUPPORTED, /* SetCalendar */
119 NOTSUPPORTED, /* AddCalendar */ 119 NOTSUPPORTED, /* AddCalendar */
120 NOTSUPPORTED, /* DeleteCalendar */ 120 NOTSUPPORTED, /* DeleteCalendar */
121 NOTSUPPORTED, /* DeleteAllCalendar*/ 121 NOTSUPPORTED, /* DeleteAllCalendar*/
122 NOTSUPPORTED, /* GetCalendarSettings*/ 122 NOTSUPPORTED, /* GetCalendarSettings*/
123 NOTSUPPORTED, /* SetCalendarSettings*/ 123 NOTSUPPORTED, /* SetCalendarSettings*/
124 NOTSUPPORTED, /* GetNoteStatus */
125 NOTSUPPORTED, /* GetNote */
124 NOTSUPPORTED, /* GetNextNote */ 126 NOTSUPPORTED, /* GetNextNote */
127 NOTSUPPORTED, /* SetNote */
128 NOTSUPPORTED, /* AddNote */
129 NOTSUPPORTED, /* DeleteNote */
130 NOTSUPPORTED, /* DeleteAllNotes */
125 NOTSUPPORTED, /* GetProfile */ 131 NOTSUPPORTED, /* GetProfile */
126 NOTSUPPORTED, /* SetProfile */ 132 NOTSUPPORTED, /* SetProfile */
127 NOTSUPPORTED, /* GetFMStation */ 133 NOTSUPPORTED, /* GetFMStation */
128 NOTSUPPORTED, /* SetFMStation */ 134 NOTSUPPORTED, /* SetFMStation */
129 NOTSUPPORTED, /* ClearFMStations */ 135 NOTSUPPORTED, /* ClearFMStations */
130 NOTSUPPORTED, /* GetNextFileFolder*/ 136 NOTSUPPORTED, /* GetNextFileFolder*/
131 NOTSUPPORTED, /* GetFilePart */ 137 NOTSUPPORTED, /* GetFilePart */
132 NOTSUPPORTED, /* AddFilePart */ 138 NOTSUPPORTED, /* AddFilePart */
133 NOTSUPPORTED, /* GetFileSystemStatus*/ 139 NOTSUPPORTED, /* GetFileSystemStatus*/
134 NOTSUPPORTED, /* DeleteFile */ 140 NOTSUPPORTED, /* DeleteFile */
135 NOTSUPPORTED, /* AddFolder */ 141 NOTSUPPORTED, /* AddFolder */
136 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 142 NOTSUPPORTED, /* GetGPRSAccessPoint*/
137 NOTSUPPORTED /* SetGPRSAccessPoint*/ 143 NOTSUPPORTED /* SetGPRSAccessPoint*/
138}; 144};
139 145
140#endif 146#endif
141 147
142/* How should editor hadle tabs in this file? Add editor commands here. 148/* How should editor hadle tabs in this file? Add editor commands here.
143 * vim: noexpandtab sw=8 ts=8 sts=8: 149 * vim: noexpandtab sw=8 ts=8 sts=8:
144 */ 150 */
diff --git a/gammu/emb/common/phone/obex/obexgen.c b/gammu/emb/common/phone/obex/obexgen.c
index 3106369..b91afac 100644
--- a/gammu/emb/common/phone/obex/obexgen.c
+++ b/gammu/emb/common/phone/obex/obexgen.c
@@ -808,45 +808,51 @@ GSM_Phone_Functions OBEXGENPhone = {
808 NOTIMPLEMENTED, /* GetMMSSettings */ 808 NOTIMPLEMENTED, /* GetMMSSettings */
809 NOTIMPLEMENTED, /* SetMMSSettings */ 809 NOTIMPLEMENTED, /* SetMMSSettings */
810 NOTSUPPORTED, /* GetSyncMLSettings*/ 810 NOTSUPPORTED, /* GetSyncMLSettings*/
811 NOTSUPPORTED, /* SetSyncMLSettings*/ 811 NOTSUPPORTED, /* SetSyncMLSettings*/
812 NOTSUPPORTED, /* GetChatSettings */ 812 NOTSUPPORTED, /* GetChatSettings */
813 NOTSUPPORTED, /* SetChatSettings */ 813 NOTSUPPORTED, /* SetChatSettings */
814 NOTIMPLEMENTED, /* GetBitmap */ 814 NOTIMPLEMENTED, /* GetBitmap */
815 NOTIMPLEMENTED, /* SetBitmap */ 815 NOTIMPLEMENTED, /* SetBitmap */
816 NOTIMPLEMENTED, /* GetToDoStatus */ 816 NOTIMPLEMENTED, /* GetToDoStatus */
817 NOTIMPLEMENTED, /* GetToDo */ 817 NOTIMPLEMENTED, /* GetToDo */
818 NOTIMPLEMENTED, /* GetNextToDo */ 818 NOTIMPLEMENTED, /* GetNextToDo */
819 NOTIMPLEMENTED, /* SetToDo */ 819 NOTIMPLEMENTED, /* SetToDo */
820 NOTIMPLEMENTED, /* AddToDo */ 820 NOTIMPLEMENTED, /* AddToDo */
821 NOTIMPLEMENTED, /* DeleteToDo */ 821 NOTIMPLEMENTED, /* DeleteToDo */
822 NOTIMPLEMENTED, /* DeleteAllToDo */ 822 NOTIMPLEMENTED, /* DeleteAllToDo */
823 NOTIMPLEMENTED, /* GetCalendarStatus*/ 823 NOTIMPLEMENTED, /* GetCalendarStatus*/
824 NOTIMPLEMENTED, /* GetCalendar */ 824 NOTIMPLEMENTED, /* GetCalendar */
825 NOTIMPLEMENTED, /* GetNextCalendar */ 825 NOTIMPLEMENTED, /* GetNextCalendar */
826 NOTIMPLEMENTED, /* SetCalendar */ 826 NOTIMPLEMENTED, /* SetCalendar */
827 NOTIMPLEMENTED, /* AddCalendar */ 827 NOTIMPLEMENTED, /* AddCalendar */
828 NOTIMPLEMENTED, /* DeleteCalendar */ 828 NOTIMPLEMENTED, /* DeleteCalendar */
829 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 829 NOTIMPLEMENTED, /* DeleteAllCalendar*/
830 NOTSUPPORTED, /* GetCalendarSettings*/ 830 NOTSUPPORTED, /* GetCalendarSettings*/
831 NOTSUPPORTED, /* SetCalendarSettings*/ 831 NOTSUPPORTED, /* SetCalendarSettings*/
832 NOTSUPPORTED, /* GetNoteStatus */
833 NOTSUPPORTED, /* GetNote */
832 NOTSUPPORTED, /* GetNextNote */ 834 NOTSUPPORTED, /* GetNextNote */
835 NOTSUPPORTED, /* SetNote */
836 NOTSUPPORTED, /* AddNote */
837 NOTSUPPORTED, /* DeleteNote */
838 NOTSUPPORTED, /* DeleteAllNotes */
833 NOTIMPLEMENTED, /* GetProfile */ 839 NOTIMPLEMENTED, /* GetProfile */
834 NOTIMPLEMENTED, /* SetProfile */ 840 NOTIMPLEMENTED, /* SetProfile */
835 NOTIMPLEMENTED, /* GetFMStation */ 841 NOTIMPLEMENTED, /* GetFMStation */
836 NOTIMPLEMENTED, /* SetFMStation */ 842 NOTIMPLEMENTED, /* SetFMStation */
837 NOTIMPLEMENTED, /* ClearFMStations */ 843 NOTIMPLEMENTED, /* ClearFMStations */
838 OBEXGEN_GetNextFileFolder, 844 OBEXGEN_GetNextFileFolder,
839 OBEXGEN_GetFilePart, 845 OBEXGEN_GetFilePart,
840 OBEXGEN_AddFilePart, 846 OBEXGEN_AddFilePart,
841 NOTIMPLEMENTED, /* GetFileSystemStatus*/ 847 NOTIMPLEMENTED, /* GetFileSystemStatus*/
842 OBEXGEN_DeleteFile, 848 OBEXGEN_DeleteFile,
843 OBEXGEN_AddFolder, 849 OBEXGEN_AddFolder,
844 NOTIMPLEMENTED, /* GetGPRSAccessPoint*/ 850 NOTIMPLEMENTED, /* GetGPRSAccessPoint*/
845 NOTIMPLEMENTED /* SetGPRSAccessPoint*/ 851 NOTIMPLEMENTED /* SetGPRSAccessPoint*/
846}; 852};
847 853
848#endif 854#endif
849 855
850/* How should editor hadle tabs in this file? Add editor commands here. 856/* How should editor hadle tabs in this file? Add editor commands here.
851 * vim: noexpandtab sw=8 ts=8 sts=8: 857 * vim: noexpandtab sw=8 ts=8 sts=8:
852 */ 858 */
diff --git a/gammu/emb/common/phone/pfunc.c b/gammu/emb/common/phone/pfunc.c
index a03a81d..fe890fc 100644
--- a/gammu/emb/common/phone/pfunc.c
+++ b/gammu/emb/common/phone/pfunc.c
@@ -40,48 +40,49 @@ GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
40 folders->Folder[0].InboxFolder = true; 40 folders->Folder[0].InboxFolder = true;
41 folders->Folder[1].InboxFolder = false; 41 folders->Folder[1].InboxFolder = false;
42 folders->Folder[0].Memory = MEM_SM; 42 folders->Folder[0].Memory = MEM_SM;
43 folders->Folder[1].Memory = MEM_SM; 43 folders->Folder[1].Memory = MEM_SM;
44 return ERR_NONE; 44 return ERR_NONE;
45} 45}
46 46
47void GSM_CreateFirmwareNumber(GSM_StateMachine *s) 47void GSM_CreateFirmwareNumber(GSM_StateMachine *s)
48{ 48{
49 StringToDouble(s->Phone.Data.Version, &s->Phone.Data.VerNum); 49 StringToDouble(s->Phone.Data.Version, &s->Phone.Data.VerNum);
50 dbgprintf("Number version is \"%f\"\n", s->Phone.Data.VerNum); 50 dbgprintf("Number version is \"%f\"\n", s->Phone.Data.VerNum);
51} 51}
52 52
53GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, bool clear) 53GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, bool clear)
54{ 54{
55 GSM_Error error; 55 GSM_Error error;
56 56
57 if (SMS->SMSC.Location!=0) { 57 if (SMS->SMSC.Location!=0) {
58 error = s->Phone.Functions->GetSMSC(s, &SMS->SMSC); 58 error = s->Phone.Functions->GetSMSC(s, &SMS->SMSC);
59 if (error != ERR_NONE) return error; 59 if (error != ERR_NONE) return error;
60 SMS->SMSC.Location = 0; 60 SMS->SMSC.Location = 0;
61 } 61 }
62 if (SMS->PDU == SMS_Deliver) { 62 if (SMS->PDU == SMS_Deliver) {
63 if (SMS->SMSC.Number[0] == 0x00 && SMS->SMSC.Number[1] == 0x00) { 63 if (SMS->SMSC.Number[0] == 0x00 && SMS->SMSC.Number[1] == 0x00) {
64 smprintf(s,"No SMSC in SMS Deliver\n");
64 return ERR_EMPTYSMSC; 65 return ERR_EMPTYSMSC;
65 } 66 }
66 } 67 }
67 return GSM_EncodeSMSFrame(SMS, buffer, Layout, length, clear); 68 return GSM_EncodeSMSFrame(SMS, buffer, Layout, length, clear);
68} 69}
69 70
70GSM_Error PHONE_Terminate(GSM_StateMachine *s) 71GSM_Error PHONE_Terminate(GSM_StateMachine *s)
71{ 72{
72 GSM_Error error; 73 GSM_Error error;
73 74
74 if (s->Phone.Data.EnableIncomingCB==true) { 75 if (s->Phone.Data.EnableIncomingCB==true) {
75 error=s->Phone.Functions->SetIncomingCB(s,false); 76 error=s->Phone.Functions->SetIncomingCB(s,false);
76 if (error!=ERR_NONE) return error; 77 if (error!=ERR_NONE) return error;
77 } 78 }
78 if (s->Phone.Data.EnableIncomingSMS==true) { 79 if (s->Phone.Data.EnableIncomingSMS==true) {
79 error=s->Phone.Functions->SetIncomingSMS(s,false); 80 error=s->Phone.Functions->SetIncomingSMS(s,false);
80 if (error!=ERR_NONE) return error; 81 if (error!=ERR_NONE) return error;
81 } 82 }
82 return ERR_NONE; 83 return ERR_NONE;
83} 84}
84 85
85GSM_Error PHONE_RTTLPlayOneNote(GSM_StateMachine *s, GSM_RingNote note, bool first) 86GSM_Error PHONE_RTTLPlayOneNote(GSM_StateMachine *s, GSM_RingNote note, bool first)
86{ 87{
87 int duration, Hz; 88 int duration, Hz;
diff --git a/gammu/emb/common/phone/symbian/mroutgen.c b/gammu/emb/common/phone/symbian/mroutgen.c
index a7382cf..63d26cf 100644
--- a/gammu/emb/common/phone/symbian/mroutgen.c
+++ b/gammu/emb/common/phone/symbian/mroutgen.c
@@ -177,45 +177,51 @@ GSM_Phone_Functions MROUTERGENPhone = {
177 NOTSUPPORTED, /* GetMMSSettings */ 177 NOTSUPPORTED, /* GetMMSSettings */
178 NOTSUPPORTED, /* SetMMSSettings */ 178 NOTSUPPORTED, /* SetMMSSettings */
179 NOTSUPPORTED, /* GetSyncMLSettings*/ 179 NOTSUPPORTED, /* GetSyncMLSettings*/
180 NOTSUPPORTED, /* SetSyncMLSettings*/ 180 NOTSUPPORTED, /* SetSyncMLSettings*/
181 NOTSUPPORTED, /* GetChatSettings */ 181 NOTSUPPORTED, /* GetChatSettings */
182 NOTSUPPORTED, /* SetChatSettings */ 182 NOTSUPPORTED, /* SetChatSettings */
183 NOTSUPPORTED, /* GetBitmap */ 183 NOTSUPPORTED, /* GetBitmap */
184 NOTSUPPORTED, /* SetBitmap */ 184 NOTSUPPORTED, /* SetBitmap */
185 NOTSUPPORTED, /* GetToDoStatus */ 185 NOTSUPPORTED, /* GetToDoStatus */
186 NOTSUPPORTED, /* GetToDo */ 186 NOTSUPPORTED, /* GetToDo */
187 NOTSUPPORTED, /* GetNextToDo */ 187 NOTSUPPORTED, /* GetNextToDo */
188 NOTSUPPORTED, /* SetToDo */ 188 NOTSUPPORTED, /* SetToDo */
189 NOTSUPPORTED, /* AddToDo */ 189 NOTSUPPORTED, /* AddToDo */
190 NOTSUPPORTED, /* DeleteToDo */ 190 NOTSUPPORTED, /* DeleteToDo */
191 NOTSUPPORTED, /* DeleteAllToDo */ 191 NOTSUPPORTED, /* DeleteAllToDo */
192 NOTSUPPORTED, /* GetCalendarStatus*/ 192 NOTSUPPORTED, /* GetCalendarStatus*/
193 NOTSUPPORTED, /* GetCalendar */ 193 NOTSUPPORTED, /* GetCalendar */
194 NOTSUPPORTED, /* GetNextCalendar */ 194 NOTSUPPORTED, /* GetNextCalendar */
195 NOTSUPPORTED, /* SetCalendar */ 195 NOTSUPPORTED, /* SetCalendar */
196 NOTSUPPORTED, /* AddCalendar */ 196 NOTSUPPORTED, /* AddCalendar */
197 NOTSUPPORTED, /* DeleteCalendar */ 197 NOTSUPPORTED, /* DeleteCalendar */
198 NOTSUPPORTED, /* DeleteAllCalendar*/ 198 NOTSUPPORTED, /* DeleteAllCalendar*/
199 NOTSUPPORTED, /* GetCalendarSettings*/ 199 NOTSUPPORTED, /* GetCalendarSettings*/
200 NOTSUPPORTED, /* SetCalendarSettings*/ 200 NOTSUPPORTED, /* SetCalendarSettings*/
201 NOTSUPPORTED, /* GetNoteStatus */
202 NOTSUPPORTED, /* GetNote */
201 NOTSUPPORTED, /* GetNextNote */ 203 NOTSUPPORTED, /* GetNextNote */
204 NOTSUPPORTED, /* SetNote */
205 NOTSUPPORTED, /* AddNote */
206 NOTSUPPORTED, /* DeleteNote */
207 NOTSUPPORTED, /* DeleteAllNotes */
202 NOTSUPPORTED, /* GetProfile */ 208 NOTSUPPORTED, /* GetProfile */
203 NOTSUPPORTED, /* SetProfile */ 209 NOTSUPPORTED, /* SetProfile */
204 NOTSUPPORTED, /* GetFMStation */ 210 NOTSUPPORTED, /* GetFMStation */
205 NOTSUPPORTED, /* SetFMStation */ 211 NOTSUPPORTED, /* SetFMStation */
206 NOTSUPPORTED, /* ClearFMStations */ 212 NOTSUPPORTED, /* ClearFMStations */
207 NOTSUPPORTED, /* GetNextFileFolder*/ 213 NOTSUPPORTED, /* GetNextFileFolder*/
208 NOTSUPPORTED, /* GetFilePart */ 214 NOTSUPPORTED, /* GetFilePart */
209 NOTSUPPORTED, /* AddFilePart */ 215 NOTSUPPORTED, /* AddFilePart */
210 NOTSUPPORTED, /* GetFileSystemStatus*/ 216 NOTSUPPORTED, /* GetFileSystemStatus*/
211 NOTSUPPORTED, /* DeleteFile */ 217 NOTSUPPORTED, /* DeleteFile */
212 NOTSUPPORTED, /* AddFolder */ 218 NOTSUPPORTED, /* AddFolder */
213 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 219 NOTSUPPORTED, /* GetGPRSAccessPoint*/
214 NOTSUPPORTED /* SetGPRSAccessPoint*/ 220 NOTSUPPORTED /* SetGPRSAccessPoint*/
215}; 221};
216 222
217#endif 223#endif
218 224
219/* How should editor hadle tabs in this file? Add editor commands here. 225/* How should editor hadle tabs in this file? Add editor commands here.
220 * vim: noexpandtab sw=8 ts=8 sts=8: 226 * vim: noexpandtab sw=8 ts=8 sts=8:
221 */ 227 */
diff --git a/gammu/emb/common/protocol/nokia/fbus2.c b/gammu/emb/common/protocol/nokia/fbus2.c
index 2b41f8b..967eaa4 100644
--- a/gammu/emb/common/protocol/nokia/fbus2.c
+++ b/gammu/emb/common/protocol/nokia/fbus2.c
@@ -1,30 +1,39 @@
1/* (c) 2002-2003 by Marcin Wiacek */ 1/* (c) 2002-2003 by Marcin Wiacek */
2/* based on some work from MyGnokii (www.mwiacek.com) */ 2/* based on some work from MyGnokii (www.mwiacek.com) */
3/* Based on some work from Gnokii (www.gnokii.org) 3/* Based on some work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include "../../gsmstate.h" 17#include "../../gsmstate.h"
9 18
10#if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) 19#if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303)
11 20
12#include <stdio.h> 21#include <stdio.h>
13#include <string.h> 22#include <string.h>
14 23
15#include "../../gsmcomon.h" 24#include "../../gsmcomon.h"
16#include "fbus2.h" 25#include "fbus2.h"
17 26
18 static GSM_Error FBUS2_WriteFrame(GSM_StateMachine *s, 27 static GSM_Error FBUS2_WriteFrame(GSM_StateMachine *s,
19 unsigned char *MsgBuffer, 28 unsigned char *MsgBuffer,
20 int MsgLength, 29 int MsgLength,
21 unsigned char MsgType) 30 unsigned char MsgType)
22{ 31{
23 unsigned char buffer2[FBUS2_MAX_TRANSMIT_LENGTH + 10]; 32 unsigned char buffer2[FBUS2_MAX_TRANSMIT_LENGTH + 10];
24 unsigned char checksum=0; 33 unsigned char checksum=0;
25 int i, len, sent; 34 int i, len, sent;
26 35
27 buffer2[0] = FBUS2_FRAME_ID; 36 buffer2[0] = FBUS2_FRAME_ID;
28 if (s->ConnectionType==GCT_FBUS2IRDA) buffer2[0] = FBUS2_IRDA_FRAME_ID; 37 if (s->ConnectionType==GCT_FBUS2IRDA) buffer2[0] = FBUS2_IRDA_FRAME_ID;
29 38
30 buffer2[1] = FBUS2_DEVICE_PHONE; //destination 39 buffer2[1] = FBUS2_DEVICE_PHONE; //destination
@@ -124,48 +133,49 @@ static GSM_Error FBUS2_StateMachine(GSM_StateMachine *s, unsigned char rx_char)
124 /* This is not last byte in frame */ 133 /* This is not last byte in frame */
125 if (d->Msg.Count != d->Msg.Length+(d->Msg.Length%2)+2) return ERR_NONE; 134 if (d->Msg.Count != d->Msg.Length+(d->Msg.Length%2)+2) return ERR_NONE;
126 135
127 /* Checksum is incorrect */ 136 /* Checksum is incorrect */
128 if (d->Msg.CheckSum[0] != d->Msg.CheckSum[1]) { 137 if (d->Msg.CheckSum[0] != d->Msg.CheckSum[1]) {
129 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR || 138 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR ||
130 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) { 139 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) {
131 smprintf(s,"[ERROR: checksum]\n"); 140 smprintf(s,"[ERROR: checksum]\n");
132 } 141 }
133 free(d->Msg.Buffer); 142 free(d->Msg.Buffer);
134 d->Msg.Length = 0; 143 d->Msg.Length = 0;
135 d->Msg.Buffer = NULL; 144 d->Msg.Buffer = NULL;
136 145
137 d->MsgRXState = RX_Sync; 146 d->MsgRXState = RX_Sync;
138 return ERR_NONE; 147 return ERR_NONE;
139 } 148 }
140 149
141 seq_num = d->Msg.Buffer[d->Msg.Length-1]; 150 seq_num = d->Msg.Buffer[d->Msg.Length-1];
142 151
143 if (d->Msg.Type == FBUS2_ACK_BYTE) { 152 if (d->Msg.Type == FBUS2_ACK_BYTE) {
144 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || 153 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL ||
145 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { 154 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) {
146 smprintf(s, "[Received Ack of type %02x, seq %02x]\n",d->Msg.Buffer[0],seq_num); 155 smprintf(s, "[Received Ack of type %02x, seq %02x]\n",d->Msg.Buffer[0],seq_num);
147 } 156 }
157 free(d->Msg.Buffer);
148 158
149 d->MsgRXState = RX_Sync; 159 d->MsgRXState = RX_Sync;
150 return ERR_NONE; 160 return ERR_NONE;
151 } 161 }
152 162
153 frm_num = d->Msg.Buffer[d->Msg.Length-2]; 163 frm_num = d->Msg.Buffer[d->Msg.Length-2];
154 164
155 if ((seq_num & 0x40) == 0x40) { 165 if ((seq_num & 0x40) == 0x40) {
156 d->FramesToGo = frm_num; 166 d->FramesToGo = frm_num;
157 d->MultiMsg.Length= 0; 167 d->MultiMsg.Length= 0;
158 d->MultiMsg.Type= d->Msg.Type; 168 d->MultiMsg.Type= d->Msg.Type;
159 d->MultiMsg.Destination= d->Msg.Destination; 169 d->MultiMsg.Destination= d->Msg.Destination;
160 d->MultiMsg.Source= d->Msg.Source; 170 d->MultiMsg.Source= d->Msg.Source;
161 } 171 }
162 172
163 if ((seq_num & 0x40) != 0x40 && d->FramesToGo != frm_num) { 173 if ((seq_num & 0x40) != 0x40 && d->FramesToGo != frm_num) {
164 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR || 174 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR ||
165 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) { 175 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) {
166 smprintf(s, "[ERROR: Missed part of multiframe msg]\n"); 176 smprintf(s, "[ERROR: Missed part of multiframe msg]\n");
167 } 177 }
168 178
169 free(d->Msg.Buffer); 179 free(d->Msg.Buffer);
170 d->Msg.Length = 0; 180 d->Msg.Length = 0;
171 d->Msg.Buffer = NULL; 181 d->Msg.Buffer = NULL;
diff --git a/gammu/emb/common/protocol/nokia/fbus2.h b/gammu/emb/common/protocol/nokia/fbus2.h
index 8dbcb07..3d31006 100644
--- a/gammu/emb/common/protocol/nokia/fbus2.h
+++ b/gammu/emb/common/protocol/nokia/fbus2.h
@@ -1,30 +1,39 @@
1/* (c) 2002-2003 by Marcin Wiacek */ 1/* (c) 2002-2003 by Marcin Wiacek */
2/* based on some work from MyGnokii (www.mwiacek.com) */ 2/* based on some work from MyGnokii (www.mwiacek.com) */
3/* Based on some work from Gnokii (www.gnokii.org) 3/* Based on some work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#ifndef fbus2_h 17#ifndef fbus2_h
9#define fbus2_h 18#define fbus2_h
10 19
11#include "../protocol.h" 20#include "../protocol.h"
12 21
13 #define FBUS2_FRAME_ID 0x1e 22 #define FBUS2_FRAME_ID 0x1e
14 #define FBUS2_IRDA_FRAME_ID 0x1c 23 #define FBUS2_IRDA_FRAME_ID 0x1c
15 #define FBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */ 24 #define FBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */
16 #define FBUS2_DEVICE_PC 0x0c /* Our PC */ 25 #define FBUS2_DEVICE_PC 0x0c /* Our PC */
17 #define FBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */ 26 #define FBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */
18 27
19#define FBUS2_MAX_TRANSMIT_LENGTH 120 28#define FBUS2_MAX_TRANSMIT_LENGTH 120
20 29
21typedef struct { 30typedef struct {
22 int MsgSequenceNumber; 31 int MsgSequenceNumber;
23 int MsgRXState; 32 int MsgRXState;
24 int FramesToGo; 33 int FramesToGo;
25 GSM_Protocol_MessageMultiMsg; 34 GSM_Protocol_MessageMultiMsg;
26 GSM_Protocol_MessageMsg; 35 GSM_Protocol_MessageMsg;
27} GSM_Protocol_FBUS2Data; 36} GSM_Protocol_FBUS2Data;
28 37
29#ifndef GSM_USED_SERIALDEVICE 38#ifndef GSM_USED_SERIALDEVICE
30# define GSM_USED_SERIALDEVICE 39# define GSM_USED_SERIALDEVICE
diff --git a/gammu/emb/common/protocol/nokia/phonet.c b/gammu/emb/common/protocol/nokia/phonet.c
index db5bd72..495a1bf 100644
--- a/gammu/emb/common/protocol/nokia/phonet.c
+++ b/gammu/emb/common/protocol/nokia/phonet.c
@@ -1,29 +1,38 @@
1/* (c) 2002-2003 by Marcin Wiacek */ 1/* (c) 2002-2003 by Marcin Wiacek */
2/* Based on some work from Gnokii (www.gnokii.org) 2/* Based on some work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later 4 * GNU GPL version 2 or later
5 */ 5 */
6/* Due to a problem in the source code management, the names of some of
7 * the authors have unfortunately been lost. We do not mean to belittle
8 * their efforts and hope they will contact us to see their names
9 * properly added to the Copyright notice above.
10 * Having published their contributions under the terms of the GNU
11 * General Public License (GPL) [version 2], the Copyright of these
12 * authors will remain respected by adhering to the license they chose
13 * to publish their code under.
14 */
6 15
7#include "../../gsmstate.h" 16#include "../../gsmstate.h"
8 17
9#if defined(GSM_ENABLE_IRDA) || defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_BLUEPHONET) 18#if defined(GSM_ENABLE_IRDA) || defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_BLUEPHONET)
10 19
11#include <stdio.h> 20#include <stdio.h>
12#include <string.h> 21#include <string.h>
13 22
14#include "../../gsmcomon.h" 23#include "../../gsmcomon.h"
15#include "phonet.h" 24#include "phonet.h"
16 25
17 static GSM_Error PHONET_WriteMessage (GSM_StateMachine *s, 26 static GSM_Error PHONET_WriteMessage (GSM_StateMachine *s,
18 unsigned char *MsgBuffer, 27 unsigned char *MsgBuffer,
19 int MsgLength, 28 int MsgLength,
20 unsigned char MsgType) 29 unsigned char MsgType)
21{ 30{
22 unsigned char *buffer2; 31 unsigned char *buffer2;
23 int sent; 32 int sent;
24 33
25 GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType); 34 GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType);
26 35
27 buffer2 = (unsigned char *)malloc(MsgLength + 6); 36 buffer2 = (unsigned char *)malloc(MsgLength + 6);
28 37
29 buffer2[0] = PHONET_FRAME_ID, 38 buffer2[0] = PHONET_FRAME_ID,
diff --git a/gammu/emb/common/protocol/nokia/phonet.h b/gammu/emb/common/protocol/nokia/phonet.h
index e750bbd..7626c23 100644
--- a/gammu/emb/common/protocol/nokia/phonet.h
+++ b/gammu/emb/common/protocol/nokia/phonet.h
@@ -1,29 +1,38 @@
1/* (c) 2002-2003 by Marcin Wiacek */ 1/* (c) 2002-2003 by Marcin Wiacek */
2/* Based on some work from Gnokii (www.gnokii.org) 2/* Based on some work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later 4 * GNU GPL version 2 or later
5 */ 5 */
6/* Due to a problem in the source code management, the names of some of
7 * the authors have unfortunately been lost. We do not mean to belittle
8 * their efforts and hope they will contact us to see their names
9 * properly added to the Copyright notice above.
10 * Having published their contributions under the terms of the GNU
11 * General Public License (GPL) [version 2], the Copyright of these
12 * authors will remain respected by adhering to the license they chose
13 * to publish their code under.
14 */
6 15
7#ifndef PHONET_h 16#ifndef PHONET_h
8#define PHONET_h 17#define PHONET_h
9 18
10#include "../protocol.h" 19#include "../protocol.h"
11 20
12 #define PHONET_FRAME_ID 0x14 21 #define PHONET_FRAME_ID 0x14
13 #define PHONET_BLUE_FRAME_ID0x19 22 #define PHONET_BLUE_FRAME_ID0x19
14 #define PHONET_DEVICE_PHONE 0x00 /* Nokia mobile phone */ 23 #define PHONET_DEVICE_PHONE 0x00 /* Nokia mobile phone */
15 #define PHONET_DEVICE_PC 0x0c /* Our PC */ 24 #define PHONET_DEVICE_PC 0x0c /* Our PC */
16#define PHONET_BLUE_DEVICE_PC 0x10 /* Our PC */ 25#define PHONET_BLUE_DEVICE_PC 0x10 /* Our PC */
17 26
18typedef struct { 27typedef struct {
19 int MsgRXState; 28 int MsgRXState;
20 GSM_Protocol_MessageMsg; 29 GSM_Protocol_MessageMsg;
21} GSM_Protocol_PHONETData; 30} GSM_Protocol_PHONETData;
22 31
23#if defined(GSM_ENABLE_IRDAPHONET) 32#if defined(GSM_ENABLE_IRDAPHONET)
24# ifndef GSM_USED_IRDADEVICE 33# ifndef GSM_USED_IRDADEVICE
25# define GSM_USED_IRDADEVICE 34# define GSM_USED_IRDADEVICE
26# endif 35# endif
27#endif 36#endif
28#if defined(GSM_ENABLE_BLUEPHONET) 37#if defined(GSM_ENABLE_BLUEPHONET)
29# ifndef GSM_USED_BLUETOOTHDEVICE 38# ifndef GSM_USED_BLUETOOTHDEVICE
diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h
index 9a930fc..9d97954 100644
--- a/gammu/emb/common/service/backup/backgen.h
+++ b/gammu/emb/common/service/backup/backgen.h
@@ -43,31 +43,31 @@ typedef struct {
43 GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; 43 GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1];
44 GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; 44 GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1];
45 GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; 45 GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1];
46 GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; 46 GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1];
47 GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1]; 47 GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1];
48 GSM_SyncMLSettings*SyncMLSettings [GSM_BACKUP_MAX_SYNCMLSETTINGS + 1]; 48 GSM_SyncMLSettings*SyncMLSettings [GSM_BACKUP_MAX_SYNCMLSETTINGS + 1];
49 GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; 49 GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1];
50 GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; 50 GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1];
51 GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; 51 GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1];
52 GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; 52 GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1];
53 GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; 53 GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1];
54 GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; 54 GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1];
55 GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; 55 GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1];
56 GSM_Bitmap *StartupLogo; 56 GSM_Bitmap *StartupLogo;
57 GSM_Bitmap *OperatorLogo; 57 GSM_Bitmap *OperatorLogo;
58} GSM_Backup; 58} GSM_Backup;
59 59
60 #define GSM_BACKUP_MAX_SMS500 60 #define GSM_BACKUP_MAX_SMS500
61 61
62typedef struct { 62typedef struct {
63 GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; 63 GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS];
64} GSM_SMS_Backup; 64} GSM_SMS_Backup;
65 65
66extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); 66extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup);
67extern GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); 67extern GSM_Error GSM_AddSMSBackupFile (char *FileName, GSM_SMS_Backup *backup);
68 68
69#endif 69#endif
70 70
71/* How should editor hadle tabs in this file? Add editor commands here. 71/* How should editor hadle tabs in this file? Add editor commands here.
72 * vim: noexpandtab sw=8 ts=8 sts=8: 72 * vim: noexpandtab sw=8 ts=8 sts=8:
73 */ 73 */
diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c
index 4cb1bb7..07a3b22 100644
--- a/gammu/emb/common/service/backup/backtext.c
+++ b/gammu/emb/common/service/backup/backtext.c
@@ -2975,57 +2975,61 @@ static GSM_Error GSM_ReadSMSBackupTextFile(char *FileName, GSM_SMS_Backup *backu
2975 return ERR_MOREMEMORY; 2975 return ERR_MOREMEMORY;
2976 } 2976 }
2977 backup->SMS[num]->Location = num + 1; 2977 backup->SMS[num]->Location = num + 1;
2978 ReadSMSBackupEntry(file_info, h->SectionName, backup->SMS[num]); 2978 ReadSMSBackupEntry(file_info, h->SectionName, backup->SMS[num]);
2979 num++; 2979 num++;
2980 } 2980 }
2981 } 2981 }
2982 return ERR_NONE; 2982 return ERR_NONE;
2983} 2983}
2984 2984
2985GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) 2985GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup)
2986{ 2986{
2987 FILE *file; 2987 FILE *file;
2988 2988
2989 backup->SMS[0] = NULL; 2989 backup->SMS[0] = NULL;
2990 2990
2991 file = fopen(FileName, "rb"); 2991 file = fopen(FileName, "rb");
2992 if (file == NULL) return(ERR_CANTOPENFILE); 2992 if (file == NULL) return(ERR_CANTOPENFILE);
2993 2993
2994 fclose(file); 2994 fclose(file);
2995 2995
2996 return GSM_ReadSMSBackupTextFile(FileName, backup); 2996 return GSM_ReadSMSBackupTextFile(FileName, backup);
2997} 2997}
2998 2998
2999GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) 2999static GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup)
3000{ 3000{
3001 int i,w,current; 3001 int i,w,current;
3002 unsigned char buffer[10000]; 3002 unsigned char buffer[10000];
3003 GSM_DateTimeDT; 3003 GSM_DateTimeDT;
3004 3004
3005 fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION); 3005 fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION);
3006 GSM_GetCurrentDateTime (&DT); 3006 GSM_GetCurrentDateTime (&DT);
3007 fprintf(file,"# Saved %s\n\n",OSDateTime(DT,false)); 3007 fprintf(file,"# Saved ");
3008 fprintf(file, "%04d%02d%02dT%02d%02d%02d",
3009 DT.Year, DT.Month, DT.Day,
3010 DT.Hour, DT.Minute, DT.Second);
3011 fprintf(file," (%s)\n\n",OSDateTime(DT,false));
3008 3012
3009 i=0; 3013 i=0;
3010 while (backup->SMS[i]!=NULL) { 3014 while (backup->SMS[i]!=NULL) {
3011 fprintf(file,"[SMSBackup%03i]\n",i); 3015 fprintf(file,"[SMSBackup%03i]\n",i);
3012 switch (backup->SMS[i]->Coding) { 3016 switch (backup->SMS[i]->Coding) {
3013 case SMS_Coding_Unicode: 3017 case SMS_Coding_Unicode:
3014 case SMS_Coding_Default: 3018 case SMS_Coding_Default:
3015 sprintf(buffer,"%s",DecodeUnicodeString(backup->SMS[i]->Text)); 3019 sprintf(buffer,"%s",DecodeUnicodeString(backup->SMS[i]->Text));
3016 fprintf(file,"#"); 3020 fprintf(file,"#");
3017 current = 0; 3021 current = 0;
3018 for (w=0;w<(int)(strlen(buffer));w++) { 3022 for (w=0;w<(int)(strlen(buffer));w++) {
3019 switch (buffer[w]) { 3023 switch (buffer[w]) {
3020 case 10: 3024 case 10:
3021 fprintf(file,"\n#"); 3025 fprintf(file,"\n#");
3022 current = 0; 3026 current = 0;
3023 break; 3027 break;
3024 case 13: 3028 case 13:
3025 break; 3029 break;
3026 default: 3030 default:
3027 if (isprint(buffer[w])) { 3031 if (isprint(buffer[w])) {
3028 fprintf(file,"%c",buffer[w]); 3032 fprintf(file,"%c",buffer[w]);
3029 current ++; 3033 current ++;
3030 } 3034 }
3031 if (current == 75) { 3035 if (current == 75) {
@@ -3067,43 +3071,43 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup)
3067 EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length); 3071 EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length);
3068 break; 3072 break;
3069 } 3073 }
3070 SaveLinkedBackupText(file, "Text", buffer, false); 3074 SaveLinkedBackupText(file, "Text", buffer, false);
3071 switch (backup->SMS[i]->Coding) { 3075 switch (backup->SMS[i]->Coding) {
3072 case SMS_Coding_Unicode : fprintf(file,"Coding = Unicode\n"); break; 3076 case SMS_Coding_Unicode : fprintf(file,"Coding = Unicode\n"); break;
3073 case SMS_Coding_Default : fprintf(file,"Coding = Default\n"); break; 3077 case SMS_Coding_Default : fprintf(file,"Coding = Default\n"); break;
3074 case SMS_Coding_8bit : fprintf(file,"Coding = 8bit\n"); break; 3078 case SMS_Coding_8bit : fprintf(file,"Coding = 8bit\n"); break;
3075 } 3079 }
3076 fprintf(file,"Folder = %i\n",backup->SMS[i]->Folder); 3080 fprintf(file,"Folder = %i\n",backup->SMS[i]->Folder);
3077 fprintf(file,"Length = %i\n",backup->SMS[i]->Length); 3081 fprintf(file,"Length = %i\n",backup->SMS[i]->Length);
3078 fprintf(file,"Class = %i\n",backup->SMS[i]->Class); 3082 fprintf(file,"Class = %i\n",backup->SMS[i]->Class);
3079 fprintf(file,"ReplySMSC = "); 3083 fprintf(file,"ReplySMSC = ");
3080 if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"True\n"); else fprintf(file,"False\n"); 3084 if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"True\n"); else fprintf(file,"False\n");
3081 fprintf(file,"RejectDuplicates = "); 3085 fprintf(file,"RejectDuplicates = ");
3082 if (backup->SMS[i]->RejectDuplicates) fprintf(file,"True\n"); else fprintf(file,"False\n"); 3086 if (backup->SMS[i]->RejectDuplicates) fprintf(file,"True\n"); else fprintf(file,"False\n");
3083 fprintf(file,"ReplaceMessage = %i\n",backup->SMS[i]->ReplaceMessage); 3087 fprintf(file,"ReplaceMessage = %i\n",backup->SMS[i]->ReplaceMessage);
3084 fprintf(file,"MessageReference = %i\n",backup->SMS[i]->MessageReference); 3088 fprintf(file,"MessageReference = %i\n",backup->SMS[i]->MessageReference);
3085 fprintf(file,"\n"); 3089 fprintf(file,"\n");
3086 i++; 3090 i++;
3087 } 3091 }
3088 return ERR_NONE; 3092 return ERR_NONE;
3089} 3093}
3090 3094
3091GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) 3095GSM_Error GSM_AddSMSBackupFile(char *FileName, GSM_SMS_Backup *backup)
3092{ 3096{
3093 FILE *file; 3097 FILE *file;
3094 3098
3095 file = fopen(FileName, "wb"); 3099 file = fopen(FileName, "ab");
3096 if (file == NULL) return(ERR_CANTOPENFILE); 3100 if (file == NULL) return(ERR_CANTOPENFILE);
3097 3101
3098 SaveSMSBackupTextFile(file,backup); 3102 SaveSMSBackupTextFile(file,backup);
3099 3103
3100 fclose(file); 3104 fclose(file);
3101 3105
3102 return ERR_NONE; 3106 return ERR_NONE;
3103} 3107}
3104 3108
3105#endif 3109#endif
3106 3110
3107/* How should editor hadle tabs in this file? Add editor commands here. 3111/* How should editor hadle tabs in this file? Add editor commands here.
3108 * vim: noexpandtab sw=8 ts=8 sts=8: 3112 * vim: noexpandtab sw=8 ts=8 sts=8:
3109 */ 3113 */
diff --git a/gammu/emb/common/service/gsmring.h b/gammu/emb/common/service/gsmring.h
index 2d2dd7a..33e5424 100644
--- a/gammu/emb/common/service/gsmring.h
+++ b/gammu/emb/common/service/gsmring.h
@@ -150,49 +150,49 @@ typedef struct {
150 GSM_BinaryTone BinaryTone; 150 GSM_BinaryTone BinaryTone;
151 GSM_NoteRingtone NoteTone; 151 GSM_NoteRingtone NoteTone;
152 /** 152 /**
153 * Ringtone format 153 * Ringtone format
154 */ 154 */
155 GSM_RingtoneFormat Format; 155 GSM_RingtoneFormat Format;
156 /** 156 /**
157 * Ringtone name 157 * Ringtone name
158 */ 158 */
159 char Name[20*2]; 159 char Name[20*2];
160 /** 160 /**
161 * Ringtone location 161 * Ringtone location
162 */ 162 */
163 int Location; 163 int Location;
164} GSM_Ringtone; 164} GSM_Ringtone;
165 165
166typedef struct { 166typedef struct {
167 int Group;//Nokia specific 167 int Group;//Nokia specific
168 int ID; 168 int ID;
169 char Name[30*2]; 169 char Name[30*2];
170} GSM_RingtoneInfo; 170} GSM_RingtoneInfo;
171 171
172typedef struct { 172typedef struct {
173 int Number; 173 int Number;
174 GSM_RingtoneInfo Ringtone[100]; 174 GSM_RingtoneInfo *Ringtone;
175} GSM_AllRingtonesInfo; 175} GSM_AllRingtonesInfo;
176 176
177GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone); 177GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone);
178GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone); 178GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone);
179 179
180void saveott(FILE *file, GSM_Ringtone *ringtone); 180void saveott(FILE *file, GSM_Ringtone *ringtone);
181void savemid(FILE *file, GSM_Ringtone *ringtone); 181void savemid(FILE *file, GSM_Ringtone *ringtone);
182void saverng(FILE *file, GSM_Ringtone *ringtone); 182void saverng(FILE *file, GSM_Ringtone *ringtone);
183void saveimelody(FILE *file, GSM_Ringtone *ringtone); 183void saveimelody(FILE *file, GSM_Ringtone *ringtone);
184GSM_Error savewav(FILE *file, GSM_Ringtone *ringtone); 184GSM_Error savewav(FILE *file, GSM_Ringtone *ringtone);
185GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone); 185GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone);
186 186
187 unsigned char GSM_EncodeNokiaRTTLRingtone(GSM_Ringtone ringtone, unsigned char *package, int *maxlength); 187 unsigned char GSM_EncodeNokiaRTTLRingtone(GSM_Ringtone ringtone, unsigned char *package, int *maxlength);
188 unsigned char GSM_EncodeEMSSound (GSM_Ringtone ringtone, unsigned char *package, int *maxlength, double version, bool start); 188 unsigned char GSM_EncodeEMSSound (GSM_Ringtone ringtone, unsigned char *package, int *maxlength, double version, bool start);
189 189
190 GSM_Error GSM_DecodeNokiaRTTLRingtone(GSM_Ringtone *ringtone, unsigned char *package, int maxlength); 190 GSM_Error GSM_DecodeNokiaRTTLRingtone(GSM_Ringtone *ringtone, unsigned char *package, int maxlength);
191 191
192 GSM_Error GSM_RingtoneConvert(GSM_Ringtone *dest, GSM_Ringtone *src, GSM_RingtoneFormatFormat); 192 GSM_Error GSM_RingtoneConvert(GSM_Ringtone *dest, GSM_Ringtone *src, GSM_RingtoneFormatFormat);
193 193
194 int GSM_RTTLGetTempo (int Beats); 194 int GSM_RTTLGetTempo (int Beats);
195 int GSM_RingNoteGetFrequency(GSM_RingNote Note); 195 int GSM_RingNoteGetFrequency(GSM_RingNote Note);
196 int GSM_RingNoteGetFullDuration(GSM_RingNote Note); 196 int GSM_RingNoteGetFullDuration(GSM_RingNote Note);
197 197
198char *GSM_GetRingtoneName(GSM_AllRingtonesInfo *Info, int ID); 198char *GSM_GetRingtoneName(GSM_AllRingtonesInfo *Info, int ID);