summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-25 08:56:23 (UTC)
committer zautrix <zautrix>2004-10-25 08:56:23 (UTC)
commit62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 (patch) (unidiff)
treec2b7a41b0c8fffdc0786b84ff86724ea8f08d6a1
parentfeff0930372dd51af24dc3b46697e70838277ea5 (diff)
downloadkdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.zip
kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.tar.gz
kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.tar.bz2
gammu updates
Diffstat (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
-rw-r--r--gammu/emb/gammu/gammu.c121
-rw-r--r--gammu/emb/gammu/smsd/s_files.c2
-rw-r--r--gammu/emb/gammu/smsd/smsdcore.c31
34 files changed, 1065 insertions, 116 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
@@ -26,163 +26,169 @@ DEPENDPATH += device \
26 service/sms \ 26 service/sms \
27 phone/nokia/dct3 \ 27 phone/nokia/dct3 \
28 phone/nokia/dct4 28 phone/nokia/dct4
29INCLUDEPATH += . \ 29INCLUDEPATH += . \
30 misc/coding \ 30 misc/coding \
31 misc \ 31 misc \
32 device \ 32 device \
33 phone/nokia/dct4 \ 33 phone/nokia/dct4 \
34 phone/nokia/dct3 \ 34 phone/nokia/dct3 \
35 phone/at \ 35 phone/at \
36 phone/alcatel \ 36 phone/alcatel \
37 phone/obex \ 37 phone/obex \
38 phone/symbian \ 38 phone/symbian \
39 protocol \ 39 protocol \
40 protocol/nokia \ 40 protocol/nokia \
41 protocol/at \ 41 protocol/at \
42 protocol/alcatel \ 42 protocol/alcatel \
43 protocol/obex \ 43 protocol/obex \
44 protocol/symbian \ 44 protocol/symbian \
45 device/serial \ 45 device/serial \
46 device/irda \ 46 device/irda \
47 device/bluetoth \ 47 device/bluetoth \
48 service \ 48 service \
49 service/sms \ 49 service/sms \
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
@@ -26,156 +26,162 @@ DEPENDPATH += device \
26 service/sms \ 26 service/sms \
27 phone/nokia/dct3 \ 27 phone/nokia/dct3 \
28 phone/nokia/dct4 28 phone/nokia/dct4
29INCLUDEPATH += . \ 29INCLUDEPATH += . \
30 misc/coding \ 30 misc/coding \
31 misc \ 31 misc \
32 device \ 32 device \
33 phone/nokia/dct4 \ 33 phone/nokia/dct4 \
34 phone/nokia/dct3 \ 34 phone/nokia/dct3 \
35 phone/at \ 35 phone/at \
36 phone/alcatel \ 36 phone/alcatel \
37 phone/obex \ 37 phone/obex \
38 phone/symbian \ 38 phone/symbian \
39 protocol \ 39 protocol \
40 protocol/nokia \ 40 protocol/nokia \
41 protocol/at \ 41 protocol/at \
42 protocol/alcatel \ 42 protocol/alcatel \
43 protocol/obex \ 43 protocol/obex \
44 protocol/symbian \ 44 protocol/symbian \
45 device/serial \ 45 device/serial \
46 device/irda \ 46 device/irda \
47 device/bluetoth \ 47 device/bluetoth \
48 service \ 48 service \
49 service/sms \ 49 service/sms \
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,202 +1,211 @@
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
31# define B115200 0010002 40# define B115200 0010002
32# define B230400 0010003 41# define B230400 0010003
33# define B460800 0010004 42# define B460800 0010004
34# define B500000 0010005 43# define B500000 0010005
35# define B576000 0010006 44# define B576000 0010006
36# define B921600 0010007 45# define B921600 0010007
37# define B1000000 0010010 46# define B1000000 0010010
38# define B1152000 0010011 47# define B1152000 0010011
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);
89 GSM_OSErrorInfo(s,"tcflush in serial_open"); 98 GSM_OSErrorInfo(s,"tcflush in serial_open");
90 return ERR_DEVICEOPENERROR; 99 return ERR_DEVICEOPENERROR;
91 } 100 }
92 101
93 memcpy(&t, &d->old_settings, sizeof(struct termios)); 102 memcpy(&t, &d->old_settings, sizeof(struct termios));
94 103
95 /* Opening without parity */ 104 /* Opening without parity */
96 t.c_iflag = IGNPAR; 105 t.c_iflag = IGNPAR;
97 t.c_oflag = 0; 106 t.c_oflag = 0;
98 /* disconnect line, 8 bits, enable receiver, 107 /* disconnect line, 8 bits, enable receiver,
99 * ignore modem lines,lower modem line after disconnect 108 * ignore modem lines,lower modem line after disconnect
100 */ 109 */
101 t.c_cflag = B0 | CS8 | CREAD | CLOCAL | HUPCL; 110 t.c_cflag = B0 | CS8 | CREAD | CLOCAL | HUPCL;
102 /* enable hardware (RTS/CTS) flow control (NON POSIX) */ 111 /* enable hardware (RTS/CTS) flow control (NON POSIX) */
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
179 flags = TIOCM_RTS; 188 flags = TIOCM_RTS;
180 if (rts) { 189 if (rts) {
181 ioctl(d->hPhone, TIOCMBIS, &flags); 190 ioctl(d->hPhone, TIOCMBIS, &flags);
182 } else { 191 } else {
183 ioctl(d->hPhone, TIOCMBIC, &flags); 192 ioctl(d->hPhone, TIOCMBIC, &flags);
184 } 193 }
185 194
186 flags = 0; 195 flags = 0;
187 ioctl(d->hPhone, TIOCMGET, &flags); 196 ioctl(d->hPhone, TIOCMGET, &flags);
188 197
189 dbgprintf("Serial device:"); 198 dbgprintf("Serial device:");
190 dbgprintf(" DTR is %s", flags&TIOCM_DTR?"up":"down"); 199 dbgprintf(" DTR is %s", flags&TIOCM_DTR?"up":"down");
191 dbgprintf(", RTS is %s", flags&TIOCM_RTS?"up":"down"); 200 dbgprintf(", RTS is %s", flags&TIOCM_RTS?"up":"down");
192 dbgprintf(", CAR is %s", flags&TIOCM_CAR?"up":"down"); 201 dbgprintf(", CAR is %s", flags&TIOCM_CAR?"up":"down");
193 dbgprintf(", CTS is %s\n", flags&TIOCM_CTS?"up":"down"); 202 dbgprintf(", CTS is %s\n", flags&TIOCM_CTS?"up":"down");
194 if (((flags&TIOCM_DTR)==TIOCM_DTR) != dtr) return ERR_DEVICEDTRRTSERROR; 203 if (((flags&TIOCM_DTR)==TIOCM_DTR) != dtr) return ERR_DEVICEDTRRTSERROR;
195 if (((flags&TIOCM_RTS)==TIOCM_RTS) != rts) return ERR_DEVICEDTRRTSERROR; 204 if (((flags&TIOCM_RTS)==TIOCM_RTS) != rts) return ERR_DEVICEDTRRTSERROR;
196 205
197 return ERR_NONE; 206 return ERR_NONE;
198} 207}
199 208
200static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) 209static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
201{ 210{
202 GSM_Device_SerialData *d = &s->Device.Data.Serial; 211 GSM_Device_SerialData *d = &s->Device.Data.Serial;
@@ -219,101 +228,101 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed)
219 case 200: speed2 = B200; break; 228 case 200: speed2 = B200; break;
220 case 300: speed2 = B300; break; 229 case 300: speed2 = B300; break;
221 case 600: speed2 = B600; break; 230 case 600: speed2 = B600; break;
222 case 1200: speed2 = B1200; break; 231 case 1200: speed2 = B1200; break;
223 case 1800: speed2 = B1800; break; 232 case 1800: speed2 = B1800; break;
224 case 2400: speed2 = B2400; break; 233 case 2400: speed2 = B2400; break;
225 case 4800: speed2 = B4800; break; 234 case 4800: speed2 = B4800; break;
226 case 9600: speed2 = B9600; break; 235 case 9600: speed2 = B9600; break;
227 case 19200: speed2 = B19200;break; 236 case 19200: speed2 = B19200;break;
228 case 38400: speed2 = B38400;break; 237 case 38400: speed2 = B38400;break;
229#ifdef B57600 238#ifdef B57600
230 case 57600: speed2 = B57600;break; 239 case 57600: speed2 = B57600;break;
231 case 115200: speed2 = B115200;break; 240 case 115200: speed2 = B115200;break;
232 case 230400: speed2 = B230400;break; 241 case 230400: speed2 = B230400;break;
233 case 460800: speed2 = B460800;break; 242 case 460800: speed2 = B460800;break;
234#ifdef B500000 243#ifdef B500000
235 case 500000: speed2 = B500000;break; 244 case 500000: speed2 = B500000;break;
236 case 576000: speed2 = B576000;break; 245 case 576000: speed2 = B576000;break;
237 case 921600: speed2 = B921600;break; 246 case 921600: speed2 = B921600;break;
238 case 1000000: speed2 = B1000000;break; 247 case 1000000: speed2 = B1000000;break;
239 case 1152000: speed2 = B1152000;break; 248 case 1152000: speed2 = B1152000;break;
240 case 1500000: speed2 = B1500000;break; 249 case 1500000: speed2 = B1500000;break;
241 case 2000000: speed2 = B2000000;break; 250 case 2000000: speed2 = B2000000;break;
242 case 2500000: speed2 = B2500000;break; 251 case 2500000: speed2 = B2500000;break;
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};
312 321
313#endif 322#endif
314#endif 323#endif
315#endif 324#endif
316 325
317/* How should editor hadle tabs in this file? Add editor commands here. 326/* How should editor hadle tabs in this file? Add editor commands here.
318 * vim: noexpandtab sw=8 ts=8 sts=8: 327 * vim: noexpandtab sw=8 ts=8 sts=8:
319 */ 328 */
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,54 +1,63 @@
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
31 */ 40 */
32 PurgeComm(d->hPhone, PURGE_TXABORT | PURGE_RXABORT | 41 PurgeComm(d->hPhone, PURGE_TXABORT | PURGE_RXABORT |
33 PURGE_TXCLEAR | PURGE_RXCLEAR); 42 PURGE_TXCLEAR | PURGE_RXCLEAR);
34 43
35 /* Clears the DTR (data-terminal-ready) signal */ 44 /* Clears the DTR (data-terminal-ready) signal */
36 EscapeCommFunction(d->hPhone, CLRDTR); 45 EscapeCommFunction(d->hPhone, CLRDTR);
37 46
38 /* Restores old settings */ 47 /* Restores old settings */
39 if (SetCommState(d->hPhone, &d->old_settings)==0) { 48 if (SetCommState(d->hPhone, &d->old_settings)==0) {
40 GSM_OSErrorInfo(s, "SetCommState in serial_close"); 49 GSM_OSErrorInfo(s, "SetCommState in serial_close");
41 } 50 }
42 51
43 /* Closes device */ 52 /* Closes device */
44 if (CloseHandle(d->hPhone)==0) { 53 if (CloseHandle(d->hPhone)==0) {
45 GSM_OSErrorInfo(s, "CloseHandle in serial_close"); 54 GSM_OSErrorInfo(s, "CloseHandle in serial_close");
46 } 55 }
47 56
48 return ERR_NONE; 57 return ERR_NONE;
49} 58}
50 59
51static GSM_Error serial_open (GSM_StateMachine *s) 60static GSM_Error serial_open (GSM_StateMachine *s)
52{ 61{
53 GSM_Device_SerialData *d = &s->Device.Data.Serial; 62 GSM_Device_SerialData *d = &s->Device.Data.Serial;
54 DCB dcb; 63 DCB dcb;
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
@@ -509,97 +509,97 @@ GSM_Error GSM_WaitForOnce(GSM_StateMachine *s, unsigned char *buffer,
509 } while (i<time); 509 } while (i<time);
510 510
511 return ERR_TIMEOUT; 511 return ERR_TIMEOUT;
512} 512}
513 513
514GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, 514GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer,
515 int length, unsigned char type, int time, 515 int length, unsigned char type, int time,
516 GSM_Phone_RequestID request) 516 GSM_Phone_RequestID request)
517{ 517{
518 GSM_Phone_Data *Phone = &s->Phone.Data; 518 GSM_Phone_Data *Phone = &s->Phone.Data;
519 GSM_Error error; 519 GSM_Error error;
520 int reply; 520 int reply;
521 521
522 if (mystrncasecmp(s->CurrentConfig->StartInfo,"yes",0)) { 522 if (mystrncasecmp(s->CurrentConfig->StartInfo,"yes",0)) {
523 if (Phone->StartInfoCounter > 0) { 523 if (Phone->StartInfoCounter > 0) {
524 Phone->StartInfoCounter--; 524 Phone->StartInfoCounter--;
525 if (Phone->StartInfoCounter == 0) s->Phone.Functions->ShowStartInfo(s,false); 525 if (Phone->StartInfoCounter == 0) s->Phone.Functions->ShowStartInfo(s,false);
526 } 526 }
527 } 527 }
528 528
529 Phone->RequestID= request; 529 Phone->RequestID= request;
530 Phone->DispatchError= ERR_TIMEOUT; 530 Phone->DispatchError= ERR_TIMEOUT;
531 531
532 for (reply=0;reply<s->ReplyNum;reply++) { 532 for (reply=0;reply<s->ReplyNum;reply++) {
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) {
582 execute=true; 582 execute=true;
583 } 583 }
584 } 584 }
585 } 585 }
586 586
587 if (execute) { 587 if (execute) {
588 *reply=i; 588 *reply=i;
589 if (Reply[i].requestID == ID_IncomingFrame || 589 if (Reply[i].requestID == ID_IncomingFrame ||
590 Reply[i].requestID == Data->RequestID || 590 Reply[i].requestID == Data->RequestID ||
591 Data->RequestID== ID_EachFrame) { 591 Data->RequestID== ID_EachFrame) {
592 return ERR_NONE; 592 return ERR_NONE;
593 } 593 }
594 available=true; 594 available=true;
595 } 595 }
596 i++; 596 i++;
597 } 597 }
598 598
599 if (available) { 599 if (available) {
600 return ERR_FRAMENOTREQUESTED; 600 return ERR_FRAMENOTREQUESTED;
601 } else { 601 } else {
602 return ERR_UNKNOWNFRAME; 602 return ERR_UNKNOWNFRAME;
603 } 603 }
604} 604}
605 605
@@ -825,182 +825,183 @@ bool GSM_ReadConfig(INI_Section *cfg_info, GSM_Config *cfg, int num)
825 cfg->DefaultDebugFile = false; 825 cfg->DefaultDebugFile = false;
826 } 826 }
827 cfg->LockDevice = INI_GetValue(cfg_info, section, "use_locking", false); 827 cfg->LockDevice = INI_GetValue(cfg_info, section, "use_locking", false);
828 if (!cfg->LockDevice) { 828 if (!cfg->LockDevice) {
829 free(cfg->LockDevice); 829 free(cfg->LockDevice);
830 cfg->LockDevice = strdup(DefaultLockDevice); 830 cfg->LockDevice = strdup(DefaultLockDevice);
831 } else { 831 } else {
832 cfg->DefaultLockDevice = false; 832 cfg->DefaultLockDevice = false;
833 } 833 }
834 Temp = INI_GetValue(cfg_info, section, "model", false); 834 Temp = INI_GetValue(cfg_info, section, "model", false);
835 if (!Temp) { 835 if (!Temp) {
836 strcpy(cfg->Model,DefaultModel); 836 strcpy(cfg->Model,DefaultModel);
837 } else { 837 } else {
838 cfg->DefaultModel = false; 838 cfg->DefaultModel = false;
839 strcpy(cfg->Model,Temp); 839 strcpy(cfg->Model,Temp);
840 } 840 }
841 Temp = INI_GetValue(cfg_info, section, "logformat", false); 841 Temp = INI_GetValue(cfg_info, section, "logformat", false);
842 if (!Temp) { 842 if (!Temp) {
843 strcpy(cfg->DebugLevel,DefaultDebugLevel); 843 strcpy(cfg->DebugLevel,DefaultDebugLevel);
844 } else { 844 } else {
845 cfg->DefaultDebugLevel = false; 845 cfg->DefaultDebugLevel = false;
846 strcpy(cfg->DebugLevel,Temp); 846 strcpy(cfg->DebugLevel,Temp);
847 } 847 }
848 cfg->StartInfo = INI_GetValue(cfg_info, section, "startinfo", false); 848 cfg->StartInfo = INI_GetValue(cfg_info, section, "startinfo", false);
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
897 {"3510" ,"NHM-8" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, 898 {"3510" ,"NHM-8" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}},
898 {"3510i","RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, 899 {"3510i","RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}},
899 {"3530" ,"RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, 900 {"3530" ,"RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}},
900 {"3589i","RH-44" ,"", {F_VOICETAGS,0}}, 901 {"3589i","RH-44" ,"", {F_VOICETAGS,0}},
901 {"3590" ,"NPM-8" ,"", {0}},//irda? 902 {"3590" ,"NPM-8" ,"", {0}},//irda?
902 {"3595" ,"NPM-10" ,"", {0}},//irda? 903 {"3595" ,"NPM-10" ,"", {0}},//irda?
903#endif 904#endif
904#ifdef GSM_ENABLE_NOKIA6110 905#ifdef GSM_ENABLE_NOKIA6110
905 {"3610" ,"NAM-1" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess 906 {"3610" ,"NAM-1" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess
906#endif 907#endif
907#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA3650) 908#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA3650)
908 {"3650" ,"NHL-8" ,"Nokia 3650", {0}}, 909 {"3650" ,"NHL-8" ,"Nokia 3650", {0}},
909 {"NGAGE","NEM-4" ,"", {F_RADIO,0}}, 910 {"NGAGE","NEM-4" ,"", {F_RADIO,0}},
910#endif 911#endif
911#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 912#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
912 {"5100" ,"NPM-6" ,"Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, 913 {"5100" ,"NPM-6" ,"Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}},
913 {"5100" ,"NPM-6U","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, 914 {"5100" ,"NPM-6U","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}},
914 {"5100" ,"NPM-6X","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, 915 {"5100" ,"NPM-6X","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}},
915 {"5140" ,"NPL-4" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}}, 916 {"5140" ,"NPL-4" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}},
916 {"5140" ,"NPL-5" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}}, 917 {"5140" ,"NPL-5" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}},
917#endif 918#endif
918#ifdef GSM_ENABLE_NOKIA6110 919#ifdef GSM_ENABLE_NOKIA6110
919 {"5110" ,"NSE-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, 920 {"5110" ,"NSE-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}},
920 {"5110i","NSE-2" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, 921 {"5110i","NSE-2" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}},
921 {"5130" ,"NSK-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, 922 {"5130" ,"NSK-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}},
922 {"5190" ,"NSB-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, 923 {"5190" ,"NSB-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}},
923#endif 924#endif
924#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) 925#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110)
925 {"5210" ,"NSM-5" ,"Nokia 5210", {F_CAL52,F_NOSTARTANI,F_NOPICTUREUNI,F_NODTMF,0}}, 926 {"5210" ,"NSM-5" ,"Nokia 5210", {F_CAL52,F_NOSTARTANI,F_NOPICTUREUNI,F_NODTMF,0}},
926#endif 927#endif
927#ifdef GSM_ENABLE_NOKIA6110 928#ifdef GSM_ENABLE_NOKIA6110
928 {"5510" ,"NPM-5" ,"", {F_NOCALLER,F_PROFILES33,F_NOPICTUREUNI,0}}, 929 {"5510" ,"NPM-5" ,"", {F_NOCALLER,F_PROFILES33,F_NOPICTUREUNI,0}},
929#endif 930#endif
930#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 931#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
931 {"6100" ,"NPL-2" ,"Nokia 6100", {F_PBKTONEGAL,F_TODO66,0}}, 932 {"6100" ,"NPL-2" ,"Nokia 6100", {F_PBKTONEGAL,F_TODO66,0}},
932#endif 933#endif
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
983#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) 984#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110)
984 {"8850" ,"NSM-2" ,"Nokia 8850", {0}}, 985 {"8850" ,"NSM-2" ,"Nokia 8850", {0}},
985 {"8855" ,"NSM-4" ,"Nokia 8855", {0}}, 986 {"8855" ,"NSM-4" ,"Nokia 8855", {0}},
986 {"8890" ,"NSB-6" ,"Nokia 8890", {0}}, 987 {"8890" ,"NSB-6" ,"Nokia 8890", {0}},
987#endif 988#endif
988#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) 989#if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510)
989 {"8910" ,"NHM-4" ,"Nokia 8910", {F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, 990 {"8910" ,"NHM-4" ,"Nokia 8910", {F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}},
990 {"8910i","NHM-4" ,"Nokia 8910i",{F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, 991 {"8910i","NHM-4" ,"Nokia 8910i",{F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}},
991#endif 992#endif
992#ifdef GSM_ENABLE_NOKIA9210 993#ifdef GSM_ENABLE_NOKIA9210
993 {"9210" ,"RAE-3" ,"", {0}}, 994 {"9210" ,"RAE-3" ,"", {0}},
994 {"9210i","RAE-5" ,"", {0}}, 995 {"9210i","RAE-5" ,"", {0}},
995#endif 996#endif
996#ifdef GSM_ENABLE_ATGEN 997#ifdef GSM_ENABLE_ATGEN
997 {"at" , "at", "", {0}}, 998 {"at" , "at", "", {0}},
998 /* Siemens */ 999 /* Siemens */
999 {"M20" , "M20", "", {F_M20SMS,F_SLOWWRITE,0}}, 1000 {"M20" , "M20", "", {F_M20SMS,F_SLOWWRITE,0}},
1000 {"MC35" , "MC35", "", {0}}, 1001 {"MC35" , "MC35", "", {0}},
1001 {"TC35" , "TC35", "", {0}}, 1002 {"TC35" , "TC35", "", {0}},
1002 {"S25", "S25", "SIEMENS S25", {0}}, 1003 {"S25", "S25", "SIEMENS S25", {0}},
1003 {"C35i" , "C35i", "", {0}}, 1004 {"C35i" , "C35i", "", {0}},
1004 {"S35i" , "S35i", "", {0}}, 1005 {"S35i" , "S35i", "", {0}},
1005 {"M35i" , "M35i", "", {0}}, 1006 {"M35i" , "M35i", "", {0}},
1006 {"S40" , "Siemens S40", "", {0}}, 1007 {"S40" , "Siemens S40", "", {0}},
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
@@ -333,96 +333,97 @@ typedef struct {
333#ifdef GSM_ENABLE_MBUS2 333#ifdef GSM_ENABLE_MBUS2
334 GSM_Protocol_MBUS2Data MBUS2; 334 GSM_Protocol_MBUS2Data MBUS2;
335#endif 335#endif
336#if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) 336#if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2)
337 GSM_Protocol_FBUS2Data FBUS2; 337 GSM_Protocol_FBUS2Data FBUS2;
338#endif 338#endif
339#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) 339#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
340 GSM_Protocol_PHONETData PHONET; 340 GSM_Protocol_PHONETData PHONET;
341#endif 341#endif
342#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) 342#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
343 GSM_Protocol_ATData AT; 343 GSM_Protocol_ATData AT;
344#endif 344#endif
345#ifdef GSM_ENABLE_ALCABUS 345#ifdef GSM_ENABLE_ALCABUS
346 GSM_Protocol_ALCABUSDataALCABUS; 346 GSM_Protocol_ALCABUSDataALCABUS;
347#endif 347#endif
348#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) 348#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
349 GSM_Protocol_OBEXData OBEX; 349 GSM_Protocol_OBEXData OBEX;
350#endif 350#endif
351#if defined(GSM_ENABLE_MROUTERBLUE) 351#if defined(GSM_ENABLE_MROUTERBLUE)
352 GSM_Protocol_MROUTERDataMROUTER; 352 GSM_Protocol_MROUTERDataMROUTER;
353#endif 353#endif
354 } Data; 354 } Data;
355 GSM_Protocol_Functions *Functions; 355 GSM_Protocol_Functions *Functions;
356} GSM_Protocol; 356} GSM_Protocol;
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,
405 ID_DeleteCalendarNote, 406 ID_DeleteCalendarNote,
406 ID_SetPath, 407 ID_SetPath,
407 ID_SetSMSC, 408 ID_SetSMSC,
408 ID_SetProfile, 409 ID_SetProfile,
409 ID_SetMemory, 410 ID_SetMemory,
410 ID_DeleteMemory, 411 ID_DeleteMemory,
411 ID_SetCalendarNote, 412 ID_SetCalendarNote,
412 ID_SetIncomingSMS, 413 ID_SetIncomingSMS,
413 ID_SetIncomingCB, 414 ID_SetIncomingCB,
414 ID_GetCalendarNotePos, 415 ID_GetCalendarNotePos,
415 ID_Initialise, 416 ID_Initialise,
416 ID_GetConnectSet, 417 ID_GetConnectSet,
417 ID_SetWAPBookmark, 418 ID_SetWAPBookmark,
418 ID_GetLocale, 419 ID_GetLocale,
419 ID_SetLocale, 420 ID_SetLocale,
420 ID_GetCalendarSettings, 421 ID_GetCalendarSettings,
421 ID_SetCalendarSettings, 422 ID_SetCalendarSettings,
422 ID_GetGPRSPoint, 423 ID_GetGPRSPoint,
423 ID_SetGPRSPoint, 424 ID_SetGPRSPoint,
424 ID_EnableGPRSPoint, 425 ID_EnableGPRSPoint,
425 ID_DeleteWAPBookmark, 426 ID_DeleteWAPBookmark,
426 ID_Netmonitor, 427 ID_Netmonitor,
427 ID_HoldCall, 428 ID_HoldCall,
428 ID_UnholdCall, 429 ID_UnholdCall,
@@ -1245,99 +1246,124 @@ typedef struct {
1245 */ 1246 */
1246 GSM_Error (*AddToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); 1247 GSM_Error (*AddToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1247 /** 1248 /**
1248 * Deletes ToDo entry in phone. 1249 * Deletes ToDo entry in phone.
1249 */ 1250 */
1250 GSM_Error (*DeleteToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); 1251 GSM_Error (*DeleteToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1251 /** 1252 /**
1252 * Deletes all todo entries in phone. 1253 * Deletes all todo entries in phone.
1253 */ 1254 */
1254 GSM_Error (*DeleteAllToDo) (GSM_StateMachine *s); 1255 GSM_Error (*DeleteAllToDo) (GSM_StateMachine *s);
1255 /** 1256 /**
1256 * Retrieves calendar status (number of used entries). 1257 * Retrieves calendar status (number of used entries).
1257 */ 1258 */
1258 GSM_Error (*GetCalendarStatus) (GSM_StateMachine *s, GSM_CalendarStatus *Status); 1259 GSM_Error (*GetCalendarStatus) (GSM_StateMachine *s, GSM_CalendarStatus *Status);
1259 /** 1260 /**
1260 * Retrieves calendar entry. 1261 * Retrieves calendar entry.
1261 */ 1262 */
1262 GSM_Error (*GetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); 1263 GSM_Error (*GetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note);
1263 /** 1264 /**
1264 * Retrieves calendar entry. This is useful for continuous reading of all 1265 * Retrieves calendar entry. This is useful for continuous reading of all
1265 * calendar entries. 1266 * calendar entries.
1266 */ 1267 */
1267 GSM_Error (*GetNextCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); 1268 GSM_Error (*GetNextCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start);
1268 /** 1269 /**
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);
1320 /** 1346 /**
1321 * Gets file part from filesystem. 1347 * Gets file part from filesystem.
1322 */ 1348 */
1323 GSM_Error (*GetFilePart)(GSM_StateMachine *s, GSM_File *File); 1349 GSM_Error (*GetFilePart)(GSM_StateMachine *s, GSM_File *File);
1324 /** 1350 /**
1325 * Adds file part to filesystem. 1351 * Adds file part to filesystem.
1326 */ 1352 */
1327 GSM_Error (*AddFilePart)(GSM_StateMachine *s, GSM_File *File, int *Pos); 1353 GSM_Error (*AddFilePart)(GSM_StateMachine *s, GSM_File *File, int *Pos);
1328 /** 1354 /**
1329 * Acquires filesystem status. 1355 * Acquires filesystem status.
1330 */ 1356 */
1331 GSM_Error (*GetFileSystemStatus)(GSM_StateMachine *s, GSM_FileSystemStatus *Status); 1357 GSM_Error (*GetFileSystemStatus)(GSM_StateMachine *s, GSM_FileSystemStatus *Status);
1332 /** 1358 /**
1333 * Deletes file from filessytem. 1359 * Deletes file from filessytem.
1334 */ 1360 */
1335 GSM_Error (*DeleteFile) (GSM_StateMachine *s, unsigned char *ID); 1361 GSM_Error (*DeleteFile) (GSM_StateMachine *s, unsigned char *ID);
1336 /** 1362 /**
1337 * Adds folder to filesystem. 1363 * Adds folder to filesystem.
1338 */ 1364 */
1339 GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File); 1365 GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File);
1340 /** 1366 /**
1341 * Gets GPRS access point. 1367 * Gets GPRS access point.
1342 */ 1368 */
1343 GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); 1369 GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point);
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
@@ -3934,70 +3934,76 @@ GSM_Phone_Functions ALCATELPhone = {
3934 ALCATEL_AnswerCall, 3934 ALCATEL_AnswerCall,
3935 ALCATEL_CancelCall, 3935 ALCATEL_CancelCall,
3936 NOTSUPPORTED, /* HoldCall */ 3936 NOTSUPPORTED, /* HoldCall */
3937 NOTSUPPORTED, /* UnholdCall */ 3937 NOTSUPPORTED, /* UnholdCall */
3938 NOTSUPPORTED, /* ConferenceCall */ 3938 NOTSUPPORTED, /* ConferenceCall */
3939 NOTSUPPORTED, /* SplitCall */ 3939 NOTSUPPORTED, /* SplitCall */
3940 NOTSUPPORTED, /* TransferCall */ 3940 NOTSUPPORTED, /* TransferCall */
3941 NOTSUPPORTED, /* SwitchCall */ 3941 NOTSUPPORTED, /* SwitchCall */
3942 NOTSUPPORTED, /* GetCallDivert */ 3942 NOTSUPPORTED, /* GetCallDivert */
3943 NOTSUPPORTED, /* SetCallDivert */ 3943 NOTSUPPORTED, /* SetCallDivert */
3944 NOTSUPPORTED, /* CancelAllDiverts*/ 3944 NOTSUPPORTED, /* CancelAllDiverts*/
3945 NONEFUNCTION, /* SetIncomingCall */ 3945 NONEFUNCTION, /* SetIncomingCall */
3946 NOTSUPPORTED, /* SetIncomingUSSD */ 3946 NOTSUPPORTED, /* SetIncomingUSSD */
3947 ALCATEL_SendDTMF, 3947 ALCATEL_SendDTMF,
3948 NOTSUPPORTED, /* GetRingtone */ 3948 NOTSUPPORTED, /* GetRingtone */
3949 NOTSUPPORTED, /* SetRingtone */ 3949 NOTSUPPORTED, /* SetRingtone */
3950 NOTSUPPORTED, /* GetRingtonesInfo*/ 3950 NOTSUPPORTED, /* GetRingtonesInfo*/
3951 NOTSUPPORTED, /* DeleteUserRingtones*/ 3951 NOTSUPPORTED, /* DeleteUserRingtones*/
3952 NOTSUPPORTED, /* PlayTone */ 3952 NOTSUPPORTED, /* PlayTone */
3953 NOTSUPPORTED, /* GetWAPBookmark */ 3953 NOTSUPPORTED, /* GetWAPBookmark */
3954 NOTSUPPORTED, /* SetWAPBookmark */ 3954 NOTSUPPORTED, /* SetWAPBookmark */
3955 NOTSUPPORTED, /* DeleteWAPBookmark*/ 3955 NOTSUPPORTED, /* DeleteWAPBookmark*/
3956 NOTSUPPORTED, /* GetWAPSettings */ 3956 NOTSUPPORTED, /* GetWAPSettings */
3957 NOTSUPPORTED, /* SetWAPSettings */ 3957 NOTSUPPORTED, /* SetWAPSettings */
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
@@ -651,97 +651,97 @@ GSM_Error ATGEN_Initialise(GSM_StateMachine *s)
651 651
652 if (s->ConnectionType != GCT_IRDAAT && s->ConnectionType != GCT_BLUEAT) { 652 if (s->ConnectionType != GCT_IRDAAT && s->ConnectionType != GCT_BLUEAT) {
653 /* We try to escape AT+CMGS mode, at least Siemens M20 653 /* We try to escape AT+CMGS mode, at least Siemens M20
654 * then needs to get some rest 654 * then needs to get some rest
655 */ 655 */
656 smprintf(s, "Escaping SMS mode\n"); 656 smprintf(s, "Escaping SMS mode\n");
657 error = s->Protocol.Functions->WriteMessage(s, "\x1B\r", 2, 0x00); 657 error = s->Protocol.Functions->WriteMessage(s, "\x1B\r", 2, 0x00);
658 if (error!=ERR_NONE) return error; 658 if (error!=ERR_NONE) return error;
659 659
660 /* Grab any possible garbage */ 660 /* Grab any possible garbage */
661 while (s->Device.Functions->ReadDevice(s, buff, 2) > 0) my_sleep(10); 661 while (s->Device.Functions->ReadDevice(s, buff, 2) > 0) my_sleep(10);
662 } 662 }
663 663
664 /* When some phones (Alcatel BE5) is first time connected, it needs extra 664 /* When some phones (Alcatel BE5) is first time connected, it needs extra
665 * time to react, sending just AT wakes up the phone and it then can react 665 * time to react, sending just AT wakes up the phone and it then can react
666 * to ATE1. We don't need to check whether this fails as it is just to 666 * to ATE1. We don't need to check whether this fails as it is just to
667 * wake up the phone and does nothing. 667 * wake up the phone and does nothing.
668 */ 668 */
669 smprintf(s, "Sending simple AT command to wake up some devices\n"); 669 smprintf(s, "Sending simple AT command to wake up some devices\n");
670 GSM_WaitFor (s, "AT\r", 3, 0x00, 2, ID_IncomingFrame); 670 GSM_WaitFor (s, "AT\r", 3, 0x00, 2, ID_IncomingFrame);
671 671
672 smprintf(s, "Enabling echo\n"); 672 smprintf(s, "Enabling echo\n");
673 error = GSM_WaitFor (s, "ATE1\r", 5, 0x00, 3, ID_EnableEcho); 673 error = GSM_WaitFor (s, "ATE1\r", 5, 0x00, 3, ID_EnableEcho);
674 if (error != ERR_NONE) return error; 674 if (error != ERR_NONE) return error;
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) {
724 s->Phone.Data.Priv.ATGEN.CanSaveSMS = true; 724 s->Phone.Data.Priv.ATGEN.CanSaveSMS = true;
725 } 725 }
726 726
727 if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE; 727 if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE;
728 else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; 728 else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE;
729 729
730 if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE; 730 if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE;
731 else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; 731 else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE;
732 732
733 smprintf(s, "Available SMS memories received, ME = %d, SM = %d, cansavesms =", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory); 733 smprintf(s, "Available SMS memories received, ME = %d, SM = %d, cansavesms =", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory);
734 if (s->Phone.Data.Priv.ATGEN.CanSaveSMS) smprintf(s, "true"); 734 if (s->Phone.Data.Priv.ATGEN.CanSaveSMS) smprintf(s, "true");
735 smprintf(s, "\n"); 735 smprintf(s, "\n");
736 return ERR_NONE; 736 return ERR_NONE;
737 case AT_Reply_Error: 737 case AT_Reply_Error:
738 case AT_Reply_CMSError: 738 case AT_Reply_CMSError:
739 return ATGEN_HandleCMSError(s); 739 return ATGEN_HandleCMSError(s);
740 case AT_Reply_CMEError: 740 case AT_Reply_CMEError:
741 return ATGEN_HandleCMEError(s); 741 return ATGEN_HandleCMEError(s);
742 default: 742 default:
743 return ERR_UNKNOWNRESPONSE; 743 return ERR_UNKNOWNRESPONSE;
744 } 744 }
745} 745}
746 746
747GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) 747GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s)
@@ -3794,69 +3794,75 @@ GSM_Phone_Functions ATGENPhone = {
3794 ATGEN_AnswerCall, 3794 ATGEN_AnswerCall,
3795 ATGEN_CancelCall, 3795 ATGEN_CancelCall,
3796 NOTSUPPORTED, /* HoldCall */ 3796 NOTSUPPORTED, /* HoldCall */
3797 NOTSUPPORTED, /* UnholdCall */ 3797 NOTSUPPORTED, /* UnholdCall */
3798 NOTSUPPORTED, /* ConferenceCall */ 3798 NOTSUPPORTED, /* ConferenceCall */
3799 NOTSUPPORTED, /* SplitCall */ 3799 NOTSUPPORTED, /* SplitCall */
3800 NOTSUPPORTED, /* TransferCall */ 3800 NOTSUPPORTED, /* TransferCall */
3801 NOTSUPPORTED, /* SwitchCall */ 3801 NOTSUPPORTED, /* SwitchCall */
3802 NOTSUPPORTED, /* GetCallDivert */ 3802 NOTSUPPORTED, /* GetCallDivert */
3803 NOTSUPPORTED, /* SetCallDivert */ 3803 NOTSUPPORTED, /* SetCallDivert */
3804 NOTSUPPORTED, /* CancelAllDiverts*/ 3804 NOTSUPPORTED, /* CancelAllDiverts*/
3805 NONEFUNCTION, /* SetIncomingCall */ 3805 NONEFUNCTION, /* SetIncomingCall */
3806 ATGEN_SetIncomingUSSD, 3806 ATGEN_SetIncomingUSSD,
3807 ATGEN_SendDTMF, 3807 ATGEN_SendDTMF,
3808 ATGEN_GetRingtone, 3808 ATGEN_GetRingtone,
3809 ATGEN_SetRingtone, 3809 ATGEN_SetRingtone,
3810 NOTSUPPORTED, /* GetRingtonesInfo*/ 3810 NOTSUPPORTED, /* GetRingtonesInfo*/
3811 NOTSUPPORTED, /* DeleteUserRingtones*/ 3811 NOTSUPPORTED, /* DeleteUserRingtones*/
3812 NOTSUPPORTED, /* PlayTone */ 3812 NOTSUPPORTED, /* PlayTone */
3813 NOTSUPPORTED, /* GetWAPBookmark */ 3813 NOTSUPPORTED, /* GetWAPBookmark */
3814 NOTSUPPORTED, /* SetWAPBookmark */ 3814 NOTSUPPORTED, /* SetWAPBookmark */
3815 NOTSUPPORTED, /* DeleteWAPBookmark */ 3815 NOTSUPPORTED, /* DeleteWAPBookmark */
3816 NOTSUPPORTED, /* GetWAPSettings */ 3816 NOTSUPPORTED, /* GetWAPSettings */
3817 NOTSUPPORTED, /* SetWAPSettings */ 3817 NOTSUPPORTED, /* SetWAPSettings */
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,68 +1,69 @@
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 }
45 strcpy(s->CurrentConfig->Model,"seobex"); 46 strcpy(s->CurrentConfig->Model,"seobex");
46 s->Phone.Data.Priv.OBEXGEN.Service = 0; 47 s->Phone.Data.Priv.OBEXGEN.Service = 0;
47 s->Phone.Functions->DispatchMessage= GSM_DispatchMessage; 48 s->Phone.Functions->DispatchMessage= GSM_DispatchMessage;
48 s->Phone.Functions->ReplyFunctions= OBEXGENReplyFunctions; 49 s->Phone.Functions->ReplyFunctions= OBEXGENReplyFunctions;
49 Priv->OBEX = true; 50 Priv->OBEX = true;
50 return ERR_NONE; 51 return ERR_NONE;
51} 52}
52 53
53static GSM_Error SONYERIC_SetATMode(GSM_StateMachine *s) 54static GSM_Error SONYERIC_SetATMode(GSM_StateMachine *s)
54{ 55{
55 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; 56 GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN;
56 GSM_Error error; 57 GSM_Error error;
57 58
58 if (!Priv->OBEX) return ERR_NONE; 59 if (!Priv->OBEX) return ERR_NONE;
59 60
60 dbgprintf ("Changing to AT\n"); 61 dbgprintf ("Changing to AT\n");
61 62
62 error = OBEXGEN_Disconnect(s); 63 error = OBEXGEN_Disconnect(s);
63 if (error != ERR_NONE) return error; 64 if (error != ERR_NONE) return error;
64 65
65 error = s->Protocol.Functions->Terminate(s); 66 error = s->Protocol.Functions->Terminate(s);
66 if (error != ERR_NONE) return error; 67 if (error != ERR_NONE) return error;
67 68
68 s->Protocol.Functions = &ATProtocol; 69 s->Protocol.Functions = &ATProtocol;
@@ -79,345 +80,345 @@ static GSM_Error SONYERIC_SetATMode(GSM_StateMachine *s)
79} 80}
80 81
81static GSM_Error SONYERIC_GetFile(GSM_StateMachine *s, GSM_File *File, unsigned char *FileName) 82static GSM_Error SONYERIC_GetFile(GSM_StateMachine *s, GSM_File *File, unsigned char *FileName)
82{ 83{
83 GSM_Error error; 84 GSM_Error error;
84 85
85 strcpy(File->ID_FullName,FileName); 86 strcpy(File->ID_FullName,FileName);
86 File->Used = 0; 87 File->Used = 0;
87 if (File->Buffer != NULL) free(File->Buffer); 88 if (File->Buffer != NULL) free(File->Buffer);
88 File->Buffer = NULL; 89 File->Buffer = NULL;
89 90
90 error = SONYERIC_SetOBEXMode(s); 91 error = SONYERIC_SetOBEXMode(s);
91 if (error != ERR_NONE) return error; 92 if (error != ERR_NONE) return error;
92 93
93 error = ERR_NONE; 94 error = ERR_NONE;
94 while (error == ERR_NONE) error = OBEXGEN_GetFilePart(s,File); 95 while (error == ERR_NONE) error = OBEXGEN_GetFilePart(s,File);
95 if (error != ERR_EMPTY) return error; 96 if (error != ERR_EMPTY) return error;
96 97
97 return SONYERIC_SetATMode(s); 98 return SONYERIC_SetATMode(s);
98} 99}
99 100
100static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName, unsigned char *Buffer, int Length) 101static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName, unsigned char *Buffer, int Length)
101{ 102{
102 GSM_Errorerror; 103 GSM_Errorerror;
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;
293 break; 294 break;
294 } 295 }
295 Buf=(unsigned char *)realloc(Buf,Used+strlen(Line)+3); 296 Buf=(unsigned char *)realloc(Buf,Used+strlen(Line)+3);
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;
345 break; 346 break;
346 } 347 }
347 } 348 }
348 Buf=(unsigned char *)realloc(Buf,Used+strlen(Line)+3); 349 Buf=(unsigned char *)realloc(Buf,Used+strlen(Line)+3);
349 strcpy(Buf+Used,Line); 350 strcpy(Buf+Used,Line);
350 Used=Used+strlen(Line)+3; 351 Used=Used+strlen(Line)+3;
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
400 return ERR_SOURCENOTAVAILABLE; 401 return ERR_SOURCENOTAVAILABLE;
401#endif 402#endif
402} 403}
403 404
404GSM_Error ERICSSON_ReplyGetDateLocale(GSM_Protocol_Message msg, GSM_StateMachine *s) 405GSM_Error ERICSSON_ReplyGetDateLocale(GSM_Protocol_Message msg, GSM_StateMachine *s)
405 { /*Author: Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar 406 { /*Author: Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar
406 License: Whatever the current maintainer of gammulib chooses, as long as there 407 License: Whatever the current maintainer of gammulib chooses, as long as there
407 is an easy way to obtain the source under GPL, otherwise the author's parts 408 is an easy way to obtain the source under GPL, otherwise the author's parts
408 of this function are GPL 2.0. 409 of this function are GPL 2.0.
409 */ 410 */
410 GSM_Locale*locale = s->Phone.Data.Locale; 411 GSM_Locale*locale = s->Phone.Data.Locale;
411 char format; 412 char format;
412 413
413 switch (s->Phone.Data.Priv.ATGEN.ReplyState) { 414 switch (s->Phone.Data.Priv.ATGEN.ReplyState) {
414 case AT_Reply_OK: 415 case AT_Reply_OK:
415 smprintf(s, "Date settings received\n"); 416 smprintf(s, "Date settings received\n");
416 format=atoi(msg.Buffer); 417 format=atoi(msg.Buffer);
417 switch (format) { 418 switch (format) {
418 case 0: locale->DateFormat = GSM_Date_OFF; 419 case 0: locale->DateFormat = GSM_Date_OFF;
419 locale->DateSeparator = 0; 420 locale->DateSeparator = 0;
420 break; 421 break;
421 case 1: locale->DateFormat = GSM_Date_DDMMMYY; 422 case 1: locale->DateFormat = GSM_Date_DDMMMYY;
422 locale->DateSeparator = '-'; 423 locale->DateSeparator = '-';
423 break; 424 break;
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,54 +1,63 @@
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}
31 40
32GSM_Error DCT3_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) 41GSM_Error DCT3_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
33{ 42{
34 GSM_Error error; 43 GSM_Error error;
35 44
36 /* We have to enable WAP frames in phone */ 45 /* We have to enable WAP frames in phone */
37 error=DCT3DCT4_EnableWAPFunctions(s); 46 error=DCT3DCT4_EnableWAPFunctions(s);
38 if (error!=ERR_NONE) return error; 47 if (error!=ERR_NONE) return error;
39 48
40 return DCT3DCT4_GetWAPBookmarkPart(s,bookmark); 49 return DCT3DCT4_GetWAPBookmarkPart(s,bookmark);
41} 50}
42 51
43GSM_Error DCT3_ReplyPressKey(GSM_Protocol_Message msg, GSM_StateMachine *s) 52GSM_Error DCT3_ReplyPressKey(GSM_Protocol_Message msg, GSM_StateMachine *s)
44{ 53{
45 GSM_Phone_Data *Data = &s->Phone.Data; 54 GSM_Phone_Data *Data = &s->Phone.Data;
46 55
47 switch (msg.Buffer[2]) { 56 switch (msg.Buffer[2]) {
48 case 0x46: 57 case 0x46:
49 smprintf(s, "Pressing key OK\n"); 58 smprintf(s, "Pressing key OK\n");
50 if (Data->PressKey) return ERR_NONE; 59 if (Data->PressKey) return ERR_NONE;
51 break; 60 break;
52 case 0x47: 61 case 0x47:
53 smprintf(s, "Releasing key OK\n"); 62 smprintf(s, "Releasing key OK\n");
54 if (!Data->PressKey) return ERR_NONE; 63 if (!Data->PressKey) return ERR_NONE;
@@ -412,152 +421,152 @@ GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s)
412 GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true); 421 GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true);
413 smprintf(s, "Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber)); 422 smprintf(s, "Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber));
414 423
415 GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+21,false); 424 GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+21,false);
416 smprintf(s, "Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number)); 425 smprintf(s, "Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number));
417 426
418 return ERR_NONE; 427 return ERR_NONE;
419 case 0x35: 428 case 0x35:
420 smprintf(s, "Getting SMSC failed\n"); 429 smprintf(s, "Getting SMSC failed\n");
421 return ERR_INVALIDLOCATION; 430 return ERR_INVALIDLOCATION;
422 } 431 }
423 return ERR_UNKNOWNRESPONSE; 432 return ERR_UNKNOWNRESPONSE;
424} 433}
425 434
426GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) 435GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
427{ 436{
428 unsigned char req[] = {N6110_FRAME_HEADER, 0x33, 0x64, 437 unsigned char req[] = {N6110_FRAME_HEADER, 0x33, 0x64,
429 0x00}; /* Location */ 438 0x00}; /* Location */
430 439
431 if (smsc->Location==0x00) return ERR_INVALIDLOCATION; 440 if (smsc->Location==0x00) return ERR_INVALIDLOCATION;
432 441
433 req[5]=smsc->Location; 442 req[5]=smsc->Location;
434 443
435 s->Phone.Data.SMSC=smsc; 444 s->Phone.Data.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 }
488 } 497 }
489#endif 498#endif
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}
540 549
541GSM_Error DCT3_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo) 550GSM_Error DCT3_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
542{ 551{
543 unsigned char req[] = {N6110_FRAME_HEADER, 0x70}; 552 unsigned char req[] = {N6110_FRAME_HEADER, 0x70};
544 553
545 s->Phone.Data.NetworkInfo=netinfo; 554 s->Phone.Data.NetworkInfo=netinfo;
546 smprintf(s, "Getting network info\n"); 555 smprintf(s, "Getting network info\n");
547 return GSM_WaitFor (s, req, 4, 0x0a, 4, ID_GetNetworkInfo); 556 return GSM_WaitFor (s, req, 4, 0x0a, 4, ID_GetNetworkInfo);
548} 557}
549 558
550GSM_Error DCT3_ReplyDialCommand(GSM_Protocol_Message msg, GSM_StateMachine *s) 559GSM_Error DCT3_ReplyDialCommand(GSM_Protocol_Message msg, GSM_StateMachine *s)
551{ 560{
552 smprintf(s, "Answer for call commands\n"); 561 smprintf(s, "Answer for call commands\n");
553 return ERR_NONE; 562 return ERR_NONE;
554} 563}
555 564
556GSM_Error DCT3_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) 565GSM_Error DCT3_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
557{ 566{
558 unsigned inti = 0; 567 unsigned inti = 0;
559 GSM_Errorerror; 568 GSM_Errorerror;
560 unsigned char req[100] = {0x00, 0x01, 0x7c, 569 unsigned char req[100] = {0x00, 0x01, 0x7c,
561 0x01}; /* call command */ 570 0x01}; /* call command */
562 571
563 if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED; 572 if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED;
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,54 +1,63 @@
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,
31 0x00, 0x00 40 0x00, 0x00
32}; 41};
33 42
34static GSM_Error N6110_ReplyGetPhoneLanguage(GSM_Protocol_Message msg, GSM_StateMachine *s) 43static GSM_Error N6110_ReplyGetPhoneLanguage(GSM_Protocol_Message msg, GSM_StateMachine *s)
35{ 44{
36 N6110_Language lang = N6110_Auto; 45 N6110_Language lang = N6110_Auto;
37 46
38 if (msg.Buffer[3] == 0x15) return ERR_NONE; 47 if (msg.Buffer[3] == 0x15) return ERR_NONE;
39 48
40 smprintf(s, "Phone language is %02x\n",msg.Buffer[6]); 49 smprintf(s, "Phone language is %02x\n",msg.Buffer[6]);
41 switch (msg.Buffer[6]) { 50 switch (msg.Buffer[6]) {
42 case 0x21: lang = N6110_Europe; break; //Polish 51 case 0x21: lang = N6110_Europe; break; //Polish
43 } 52 }
44 s->Phone.Data.Priv.N6110.PhoneLanguage = lang; 53 s->Phone.Data.Priv.N6110.PhoneLanguage = lang;
45 return ERR_NONE; 54 return ERR_NONE;
46} 55}
47 56
48static GSM_Error N6110_GetPhoneLanguage(GSM_StateMachine *s) 57static GSM_Error N6110_GetPhoneLanguage(GSM_StateMachine *s)
49{ 58{
50 unsigned char feat_req[] = {N6110_FRAME_HEADER, 0x13, 0x01, 59 unsigned char feat_req[] = {N6110_FRAME_HEADER, 0x13, 0x01,
51 0x00, /* Profile location */ 60 0x00, /* Profile location */
52 0x00}; /* Feature number */ 61 0x00}; /* Feature number */
53 62
54 s->Phone.Data.Priv.N6110.PhoneLanguage = N6110_Auto; 63 s->Phone.Data.Priv.N6110.PhoneLanguage = N6110_Auto;
@@ -2823,69 +2832,75 @@ GSM_Phone_Functions N6110Phone = {
2823 N6110_AnswerCall, 2832 N6110_AnswerCall,
2824 DCT3_CancelCall, 2833 DCT3_CancelCall,
2825 N6110_HoldCall, 2834 N6110_HoldCall,
2826 N6110_UnholdCall, 2835 N6110_UnholdCall,
2827 N6110_ConferenceCall, 2836 N6110_ConferenceCall,
2828 N6110_SplitCall, 2837 N6110_SplitCall,
2829 N6110_TransferCall, 2838 N6110_TransferCall,
2830 N6110_SwitchCall, 2839 N6110_SwitchCall,
2831 DCT3DCT4_GetCallDivert, 2840 DCT3DCT4_GetCallDivert,
2832 DCT3DCT4_SetCallDivert, 2841 DCT3DCT4_SetCallDivert,
2833 DCT3DCT4_CancelAllDiverts, 2842 DCT3DCT4_CancelAllDiverts,
2834 NOKIA_SetIncomingCall, 2843 NOKIA_SetIncomingCall,
2835 NOKIA_SetIncomingUSSD, 2844 NOKIA_SetIncomingUSSD,
2836 DCT3DCT4_SendDTMF, 2845 DCT3DCT4_SendDTMF,
2837 N6110_GetRingtone, 2846 N6110_GetRingtone,
2838 N6110_SetRingtone, 2847 N6110_SetRingtone,
2839 NOTSUPPORTED, /* GetRingtonesInfo */ 2848 NOTSUPPORTED, /* GetRingtonesInfo */
2840 NOTSUPPORTED, /* DeleteUserRingtones */ 2849 NOTSUPPORTED, /* DeleteUserRingtones */
2841 DCT3_PlayTone, 2850 DCT3_PlayTone,
2842 DCT3_GetWAPBookmark, 2851 DCT3_GetWAPBookmark,
2843 DCT3_SetWAPBookmark, 2852 DCT3_SetWAPBookmark,
2844 DCT3_DeleteWAPBookmark, 2853 DCT3_DeleteWAPBookmark,
2845 DCT3_GetWAPSettings, 2854 DCT3_GetWAPSettings,
2846 DCT3_SetWAPSettings, 2855 DCT3_SetWAPSettings,
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,53 +1,62 @@
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{
30 return DCT3_SetAlarm(s, alarm, 0x19); 39 return DCT3_SetAlarm(s, alarm, 0x19);
31} 40}
32 41
33static GSM_Error N7110_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) 42static GSM_Error N7110_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
34{ 43{
35 GSM_Phone_Data *Data = &s->Phone.Data; 44 GSM_Phone_Data *Data = &s->Phone.Data;
36 45
37 smprintf(s, "Phonebook entry received\n"); 46 smprintf(s, "Phonebook entry received\n");
38 switch (msg.Buffer[6]) { 47 switch (msg.Buffer[6]) {
39 case 0x0f: 48 case 0x0f:
40 return N71_65_ReplyGetMemoryError(msg.Buffer[10], s); 49 return N71_65_ReplyGetMemoryError(msg.Buffer[10], s);
41 default: 50 default:
42 return N71_65_DecodePhonebook(s, Data->Memory,Data->Bitmap,Data->SpeedDial,msg.Buffer+18,msg.Length-18,false); 51 return N71_65_DecodePhonebook(s, Data->Memory,Data->Bitmap,Data->SpeedDial,msg.Buffer+18,msg.Length-18,false);
43 } 52 }
44 return ERR_UNKNOWN; 53 return ERR_UNKNOWN;
45} 54}
46 55
47static GSM_Error N7110_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry) 56static GSM_Error N7110_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
48{ 57{
49 unsigned char req[] = {N7110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01, 58 unsigned char req[] = {N7110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01,
50 0x02, /* memory type */ 59 0x02, /* memory type */
51 0x05, 60 0x05,
52 0x00, 0x00,/* location */ 61 0x00, 0x00,/* location */
53 0x00, 0x00}; 62 0x00, 0x00};
@@ -1661,69 +1670,75 @@ GSM_Phone_Functions N7110Phone = {
1661 N7110_AnswerCall, 1670 N7110_AnswerCall,
1662 DCT3_CancelCall, 1671 DCT3_CancelCall,
1663 NOTIMPLEMENTED, /* HoldCall */ 1672 NOTIMPLEMENTED, /* HoldCall */
1664 NOTIMPLEMENTED, /* UnholdCall */ 1673 NOTIMPLEMENTED, /* UnholdCall */
1665 NOTIMPLEMENTED, /* ConferenceCall */ 1674 NOTIMPLEMENTED, /* ConferenceCall */
1666 NOTIMPLEMENTED, /* SplitCall */ 1675 NOTIMPLEMENTED, /* SplitCall */
1667 NOTIMPLEMENTED, /* TransferCall */ 1676 NOTIMPLEMENTED, /* TransferCall */
1668 NOTIMPLEMENTED, /* SwitchCall */ 1677 NOTIMPLEMENTED, /* SwitchCall */
1669 NOTSUPPORTED, /* GetCallDivert */ 1678 NOTSUPPORTED, /* GetCallDivert */
1670 N7110_SetCallDivert, 1679 N7110_SetCallDivert,
1671 N7110_CancelAllDiverts, 1680 N7110_CancelAllDiverts,
1672 N7110_SetIncomingCall, 1681 N7110_SetIncomingCall,
1673 N7110_SetIncomingUSSD, 1682 N7110_SetIncomingUSSD,
1674 DCT3DCT4_SendDTMF, 1683 DCT3DCT4_SendDTMF,
1675 N7110_GetRingtone, 1684 N7110_GetRingtone,
1676 N7110_SetRingtone, 1685 N7110_SetRingtone,
1677 NOTSUPPORTED, /* GetRingtonesInfo*/ 1686 NOTSUPPORTED, /* GetRingtonesInfo*/
1678 NOTSUPPORTED, /* DeleteUserRingtones*/ 1687 NOTSUPPORTED, /* DeleteUserRingtones*/
1679 DCT3_PlayTone, 1688 DCT3_PlayTone,
1680 DCT3_GetWAPBookmark, 1689 DCT3_GetWAPBookmark,
1681 DCT3_SetWAPBookmark, 1690 DCT3_SetWAPBookmark,
1682 DCT3_DeleteWAPBookmark, 1691 DCT3_DeleteWAPBookmark,
1683 DCT3_GetWAPSettings, 1692 DCT3_GetWAPSettings,
1684 DCT3_SetWAPSettings, 1693 DCT3_SetWAPSettings,
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
@@ -329,69 +329,75 @@ GSM_Phone_Functions N9210Phone = {
329 N9210_AnswerCall, 329 N9210_AnswerCall,
330 DCT3_CancelCall, 330 DCT3_CancelCall,
331 NOTSUPPORTED, /* HoldCall */ 331 NOTSUPPORTED, /* HoldCall */
332 NOTSUPPORTED, /* UnholdCall */ 332 NOTSUPPORTED, /* UnholdCall */
333 NOTSUPPORTED, /* ConferenceCall */ 333 NOTSUPPORTED, /* ConferenceCall */
334 NOTSUPPORTED, /* SplitCall */ 334 NOTSUPPORTED, /* SplitCall */
335 NOTSUPPORTED, /* TransferCall */ 335 NOTSUPPORTED, /* TransferCall */
336 NOTSUPPORTED, /* SwitchCall */ 336 NOTSUPPORTED, /* SwitchCall */
337 NOTSUPPORTED, /* GetCallDivert */ 337 NOTSUPPORTED, /* GetCallDivert */
338 NOTSUPPORTED, /* SetCallDivert */ 338 NOTSUPPORTED, /* SetCallDivert */
339 NOTSUPPORTED, /* CancelAllDiverts*/ 339 NOTSUPPORTED, /* CancelAllDiverts*/
340 NOTSUPPORTED, /* SetIncomingCall */ 340 NOTSUPPORTED, /* SetIncomingCall */
341 NOTIMPLEMENTED, /* SetIncomingUSSD */ 341 NOTIMPLEMENTED, /* SetIncomingUSSD */
342 NOTSUPPORTED, /* SendDTMF */ 342 NOTSUPPORTED, /* SendDTMF */
343 NOTIMPLEMENTED, /* GetRingtone */ 343 NOTIMPLEMENTED, /* GetRingtone */
344 NOTIMPLEMENTED, /* SetRingtone */ 344 NOTIMPLEMENTED, /* SetRingtone */
345 NOTSUPPORTED, /* GetRingtonesInfo*/ 345 NOTSUPPORTED, /* GetRingtonesInfo*/
346 NOTSUPPORTED, /* DeleteUserRingtones*/ 346 NOTSUPPORTED, /* DeleteUserRingtones*/
347 NOTSUPPORTED, /* PlayTone */ 347 NOTSUPPORTED, /* PlayTone */
348 NOTIMPLEMENTED, /* GetWAPBookmark */ 348 NOTIMPLEMENTED, /* GetWAPBookmark */
349 NOTIMPLEMENTED, /* SetWAPBookmark */ 349 NOTIMPLEMENTED, /* SetWAPBookmark */
350 NOTIMPLEMENTED, /* DeleteWAPBookmark */ 350 NOTIMPLEMENTED, /* DeleteWAPBookmark */
351 NOTIMPLEMENTED, /* GetWAPSettings */ 351 NOTIMPLEMENTED, /* GetWAPSettings */
352 NOTSUPPORTED, /* SetWAPSettings */ 352 NOTSUPPORTED, /* SetWAPSettings */
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
@@ -204,69 +204,75 @@ GSM_Phone_Functions N3320Phone = {
204 NOTIMPLEMENTED, /* AnswerCall */ 204 NOTIMPLEMENTED, /* AnswerCall */
205 NOTIMPLEMENTED, /* CancelCall */ 205 NOTIMPLEMENTED, /* CancelCall */
206 NOTIMPLEMENTED, /* HoldCall */ 206 NOTIMPLEMENTED, /* HoldCall */
207 NOTIMPLEMENTED, /* UnholdCall */ 207 NOTIMPLEMENTED, /* UnholdCall */
208 NOTIMPLEMENTED, /* ConferenceCall */ 208 NOTIMPLEMENTED, /* ConferenceCall */
209 NOTIMPLEMENTED, /* SplitCall */ 209 NOTIMPLEMENTED, /* SplitCall */
210 NOTIMPLEMENTED, /* TransferCall */ 210 NOTIMPLEMENTED, /* TransferCall */
211 NOTIMPLEMENTED, /* SwitchCall */ 211 NOTIMPLEMENTED, /* SwitchCall */
212 NOTSUPPORTED, /* GetCallDivert */ 212 NOTSUPPORTED, /* GetCallDivert */
213 NOTSUPPORTED, /* SetCallDivert */ 213 NOTSUPPORTED, /* SetCallDivert */
214 NOTSUPPORTED, /* CancelAllDiverts*/ 214 NOTSUPPORTED, /* CancelAllDiverts*/
215 NOTIMPLEMENTED, /* SetIncomingCall */ 215 NOTIMPLEMENTED, /* SetIncomingCall */
216 NOTIMPLEMENTED, /* SetIncomingUSSD */ 216 NOTIMPLEMENTED, /* SetIncomingUSSD */
217 NOTSUPPORTED, /* SendDTMF */ 217 NOTSUPPORTED, /* SendDTMF */
218 NOTSUPPORTED, /* GetRingtone */ 218 NOTSUPPORTED, /* GetRingtone */
219 NOTSUPPORTED, /* SetRingtone */ 219 NOTSUPPORTED, /* SetRingtone */
220 NOTSUPPORTED, /* GetRingtonesInfo*/ 220 NOTSUPPORTED, /* GetRingtonesInfo*/
221 NOTIMPLEMENTED, /* DeleteUserRingtones*/ 221 NOTIMPLEMENTED, /* DeleteUserRingtones*/
222 NOTSUPPORTED, /* PlayTone */ 222 NOTSUPPORTED, /* PlayTone */
223 NOTSUPPORTED, /* GetWAPBookmark */ 223 NOTSUPPORTED, /* GetWAPBookmark */
224 NOTSUPPORTED, /* SetWAPBookmark */ 224 NOTSUPPORTED, /* SetWAPBookmark */
225 NOTSUPPORTED, /* DeleteWAPBookmark */ 225 NOTSUPPORTED, /* DeleteWAPBookmark */
226 NOTSUPPORTED, /* GetWAPSettings */ 226 NOTSUPPORTED, /* GetWAPSettings */
227 NOTSUPPORTED, /* SetWAPSettings */ 227 NOTSUPPORTED, /* SetWAPSettings */
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
@@ -325,69 +325,75 @@ GSM_Phone_Functions N3650Phone = {
325 NOTIMPLEMENTED, /* AnswerCall */ 325 NOTIMPLEMENTED, /* AnswerCall */
326 NOTIMPLEMENTED, /* CancelCall */ 326 NOTIMPLEMENTED, /* CancelCall */
327 NOTIMPLEMENTED, /* HoldCall */ 327 NOTIMPLEMENTED, /* HoldCall */
328 NOTIMPLEMENTED, /* UnholdCall */ 328 NOTIMPLEMENTED, /* UnholdCall */
329 NOTIMPLEMENTED, /* ConferenceCall */ 329 NOTIMPLEMENTED, /* ConferenceCall */
330 NOTIMPLEMENTED, /* SplitCall */ 330 NOTIMPLEMENTED, /* SplitCall */
331 NOTIMPLEMENTED, /* TransferCall */ 331 NOTIMPLEMENTED, /* TransferCall */
332 NOTIMPLEMENTED, /* SwitchCall */ 332 NOTIMPLEMENTED, /* SwitchCall */
333 NOTSUPPORTED, /* GetCallDivert */ 333 NOTSUPPORTED, /* GetCallDivert */
334 NOTSUPPORTED, /* SetCallDivert */ 334 NOTSUPPORTED, /* SetCallDivert */
335 NOTSUPPORTED, /* CancelAllDiverts*/ 335 NOTSUPPORTED, /* CancelAllDiverts*/
336 NOTIMPLEMENTED, /* SetIncomingCall */ 336 NOTIMPLEMENTED, /* SetIncomingCall */
337 NOTIMPLEMENTED, /* SetIncomingUSSD */ 337 NOTIMPLEMENTED, /* SetIncomingUSSD */
338 NOTSUPPORTED, /* SendDTMF */ 338 NOTSUPPORTED, /* SendDTMF */
339 NOTSUPPORTED, /* GetRingtone */ 339 NOTSUPPORTED, /* GetRingtone */
340 NOTSUPPORTED, /* SetRingtone */ 340 NOTSUPPORTED, /* SetRingtone */
341 NOTSUPPORTED, /* GetRingtonesInfo*/ 341 NOTSUPPORTED, /* GetRingtonesInfo*/
342 NOTIMPLEMENTED, /* DeleteUserRingtones*/ 342 NOTIMPLEMENTED, /* DeleteUserRingtones*/
343 NOTSUPPORTED, /* PlayTone */ 343 NOTSUPPORTED, /* PlayTone */
344 NOTSUPPORTED, /* GetWAPBookmark */ 344 NOTSUPPORTED, /* GetWAPBookmark */
345 NOTSUPPORTED, /* SetWAPBookmark */ 345 NOTSUPPORTED, /* SetWAPBookmark */
346 NOTSUPPORTED, /* DeleteWAPBookmark */ 346 NOTSUPPORTED, /* DeleteWAPBookmark */
347 NOTSUPPORTED, /* GetWAPSettings */ 347 NOTSUPPORTED, /* GetWAPSettings */
348 NOTSUPPORTED, /* SetWAPSettings */ 348 NOTSUPPORTED, /* SetWAPSettings */
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,54 +1,63 @@
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}
31 40
32static GSM_Error N6510_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) 41static GSM_Error N6510_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
33{ 42{
34 smprintf(s, "Phonebook entry received\n"); 43 smprintf(s, "Phonebook entry received\n");
35 switch (msg.Buffer[6]) { 44 switch (msg.Buffer[6]) {
36 case 0x0f: 45 case 0x0f:
37 return N71_65_ReplyGetMemoryError(msg.Buffer[10], s); 46 return N71_65_ReplyGetMemoryError(msg.Buffer[10], s);
38 default: 47 default:
39 return N71_65_DecodePhonebook(s, s->Phone.Data.Memory, s->Phone.Data.Bitmap, s->Phone.Data.SpeedDial, msg.Buffer+22, msg.Length-22,false); 48 return N71_65_DecodePhonebook(s, s->Phone.Data.Memory, s->Phone.Data.Bitmap, s->Phone.Data.SpeedDial, msg.Buffer+22, msg.Length-22,false);
40 } 49 }
41 return ERR_UNKNOWN; 50 return ERR_UNKNOWN;
42} 51}
43 52
44static GSM_Error N6510_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry) 53static GSM_Error N6510_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
45{ 54{
46 unsigned char req[] = {N6110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01, 55 unsigned char req[] = {N6110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01,
47 0xfe, 0x10, /* memory type */ 56 0xfe, 0x10, /* memory type */
48 0x00, 0x00, 0x00, 0x00, 57 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x01, /* location */ 58 0x00, 0x01, /* location */
50 0x00, 0x00, 0x01}; 59 0x00, 0x00, 0x01};
51 60
52 req[9] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES); 61 req[9] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
53 if (req[9]==0xff) return ERR_NOTSUPPORTED; 62 if (req[9]==0xff) return ERR_NOTSUPPORTED;
54 63
@@ -241,123 +250,123 @@ static GSM_Error N6510_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
241 req[count] = GSM_PackSemiOctetNumber(smsc->DefaultNumber, req+count+2, true) + 1; 250 req[count] = GSM_PackSemiOctetNumber(smsc->DefaultNumber, req+count+2, true) + 1;
242 if (req[count]*2>12) { 251 if (req[count]*2>12) {
243 smprintf(s, "Too long SMSC number in frame\n"); 252 smprintf(s, "Too long SMSC number in frame\n");
244 return ERR_UNKNOWN; 253 return ERR_UNKNOWN;
245 } 254 }
246 req[count+1] = req[count] - 1; 255 req[count+1] = req[count] - 1;
247 count += 17; 256 count += 17;
248 257
249 /* -------------- SMSC name ------------------- */ 258 /* -------------- SMSC name ------------------- */
250 req[count++] = 0x81; 259 req[count++] = 0x81;
251 req[count++] = UnicodeLength(smsc->Name)*2 + 2 + 4; 260 req[count++] = UnicodeLength(smsc->Name)*2 + 2 + 4;
252 req[count++] = UnicodeLength(smsc->Name)*2 + 2; 261 req[count++] = UnicodeLength(smsc->Name)*2 + 2;
253 req[count++] = 0x00; 262 req[count++] = 0x00;
254 /* Can't make CopyUnicodeString(req+count,sms->Name) !!!! 263 /* Can't make CopyUnicodeString(req+count,sms->Name) !!!!
255 * with MSVC6 count is changed then 264 * with MSVC6 count is changed then
256 */ 265 */
257 i = count; 266 i = count;
258 CopyUnicodeString(req+i,smsc->Name); 267 CopyUnicodeString(req+i,smsc->Name);
259 count += UnicodeLength(smsc->Name)*2 + 2; 268 count += UnicodeLength(smsc->Name)*2 + 2;
260 269
261 smprintf(s, "Setting SMSC\n"); 270 smprintf(s, "Setting SMSC\n");
262 return GSM_WaitFor (s, req, count, 0x02, 4, ID_SetSMSC); 271 return GSM_WaitFor (s, req, count, 0x02, 4, ID_SetSMSC);
263} 272}
264 273
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
340 req[count++] = 0x01; 349 req[count++] = 0x01;
341 if (sms->PDU != SMS_Deliver) { 350 if (sms->PDU != SMS_Deliver) {
342 req[count++] = 0x02; 351 req[count++] = 0x02;
343 } else { 352 } else {
344 req[count++] = 0x00; 353 req[count++] = 0x00;
345 } 354 }
346 355
347 pos1 = count; count++; 356 pos1 = count; count++;
348 /* firstbyte set in SMS Layout */ 357 /* firstbyte set in SMS Layout */
349 Layout->firstbyte = count; count++; 358 Layout->firstbyte = count; count++;
350 if (sms->PDU != SMS_Deliver) { 359 if (sms->PDU != SMS_Deliver) {
351 Layout->TPMR = count; count++; 360 Layout->TPMR = count; count++;
352 361
353 Layout->TPPID = count; count++; 362 Layout->TPPID = count; count++;
354 363
355 /* TP.DCS set in SMS layout */ 364 /* TP.DCS set in SMS layout */
356 Layout->TPDCS = count; count++; 365 Layout->TPDCS = count; count++;
357 req[count++] = 0x00; 366 req[count++] = 0x00;
358 } else { 367 } else {
359 Layout->TPPID = count; count++; 368 Layout->TPPID = count; count++;
360 /* TP.DCS set in SMS layout */ 369 /* TP.DCS set in SMS layout */
361 Layout->TPDCS = count; count++; 370 Layout->TPDCS = count; count++;
362 Layout->DateTime = count; count += 7; 371 Layout->DateTime = count; count += 7;
363 req[count++] = 0x55; 372 req[count++] = 0x55;
@@ -1082,100 +1091,98 @@ static GSM_Error N6510_SetCallerLogo(GSM_StateMachine *s, GSM_Bitmap *bitmap)
1082 count += N71_65_PackPBKBlock(s, N7110_PBK_RINGTONE_ID, 3, block++, string, req + count); 1091 count += N71_65_PackPBKBlock(s, N7110_PBK_RINGTONE_ID, 3, block++, string, req + count);
1083 count --; 1092 count --;
1084 req[count-5] = 8; 1093 req[count-5] = 8;
1085 } 1094 }
1086 } 1095 }
1087 1096
1088 /* Number of group */ 1097 /* Number of group */
1089 string[0] = bitmap->Location; 1098 string[0] = bitmap->Location;
1090 string[1] = 0; 1099 string[1] = 0;
1091 count += N71_65_PackPBKBlock(s, N7110_PBK_GROUP, 2, block++, string, req + count); 1100 count += N71_65_PackPBKBlock(s, N7110_PBK_GROUP, 2, block++, string, req + count);
1092 1101
1093 /* Name */ 1102 /* Name */
1094 if (!bitmap->DefaultName) { 1103 if (!bitmap->DefaultName) {
1095 i = UnicodeLength(bitmap->Text) * 2; 1104 i = UnicodeLength(bitmap->Text) * 2;
1096 string[0] = i + 2; 1105 string[0] = i + 2;
1097 memcpy(string + 1, bitmap->Text, i); 1106 memcpy(string + 1, bitmap->Text, i);
1098 string[i + 1] = 0; 1107 string[i + 1] = 0;
1099 count += N71_65_PackPBKBlock(s, N7110_PBK_NAME, i + 2, block++, string, req + count); 1108 count += N71_65_PackPBKBlock(s, N7110_PBK_NAME, i + 2, block++, string, req + count);
1100 } 1109 }
1101 1110
1102 /* Logo */ 1111 /* Logo */
1103 if (!bitmap->DefaultBitmap) { 1112 if (!bitmap->DefaultBitmap) {
1104 PHONE_GetBitmapWidthHeight(GSM_NokiaCallerLogo, &Width, &Height); 1113 PHONE_GetBitmapWidthHeight(GSM_NokiaCallerLogo, &Width, &Height);
1105 string[0] = Width; 1114 string[0] = Width;
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,
1158 0x07, 0x00, 0x00, 0x00, 0xE7, 0x00, 0x00, 0x00, 0xF9, 0x00, 1165 0x07, 0x00, 0x00, 0x00, 0xE7, 0x00, 0x00, 0x00, 0xF9, 0x00,
1159 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 1166 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00,
1160 0x18, /* File ID */ 1167 0x18, /* File ID */
1161 0x00, 1168 0x00,
1162 0x00, 0x00, 0x00};/* Network code */ 1169 0x00, 0x00, 0x00};/* Network code */
1163 unsigned char reqNote[200] = {N6110_FRAME_HEADER, 0x04, 0x01}; 1170 unsigned char reqNote[200] = {N6110_FRAME_HEADER, 0x04, 0x01};
1164 unsigned char reqPicture[2000] = { 1171 unsigned char reqPicture[2000] = {
1165 N6110_FRAME_HEADER, 0x00, 1172 N6110_FRAME_HEADER, 0x00,
1166 0x02, 0x05, /* SMS folder */ 1173 0x02, 0x05, /* SMS folder */
1167 0x00, 0x00, /* location */ 1174 0x00, 0x00, /* location */
1168 0x01, 0x01, 0xa0, 0x02, 0x01, 0x40, 0x00, 0x34, 1175 0x01, 0x01, 0xa0, 0x02, 0x01, 0x40, 0x00, 0x34,
1169 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1176 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1170 0x00, 0x00, 0x55, 0x55, 0x55, 0x03, 0x82, 0x10, 1177 0x00, 0x00, 0x55, 0x55, 0x55, 0x03, 0x82, 0x10,
1171 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1178 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x10, 1179 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x10,
1173 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1180 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 1181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04,
1175 0x00, 0x00, 0xa1, 0x55, 0x01, 0x08, 0x00, 0x00, 1182 0x00, 0x00, 0xa1, 0x55, 0x01, 0x08, 0x00, 0x00,
1176 0x00, 0x01, 0x48, 0x1c, 0x00, 0xfc, 0x00}; 1183 0x00, 0x01, 0x48, 0x1c, 0x00, 0xfc, 0x00};
1177 1184
1178 switch (Bitmap->Type) { 1185 switch (Bitmap->Type) {
1179 case GSM_ColourWallPaper_ID: 1186 case GSM_ColourWallPaper_ID:
1180 reqColourWallPaper[21] = Bitmap->ID; 1187 reqColourWallPaper[21] = Bitmap->ID;
1181 smprintf(s, "Setting colour wall paper\n"); 1188 smprintf(s, "Setting colour wall paper\n");
@@ -1210,109 +1217,105 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
1210 if (strcmp(Bitmap->NetworkCode,"000 00")) { 1217 if (strcmp(Bitmap->NetworkCode,"000 00")) {
1211 memset(reqOp + 19, 0, 281); 1218 memset(reqOp + 19, 0, 281);
1212 NOKIA_EncodeNetworkCode(reqOp+12, Bitmap->NetworkCode); 1219 NOKIA_EncodeNetworkCode(reqOp+12, Bitmap->NetworkCode);
1213 Type = GSM_Nokia6510OperatorLogo; 1220 Type = GSM_Nokia6510OperatorLogo;
1214 reqOp[9] = 0x02;/* Logo enabled */ 1221 reqOp[9] = 0x02;/* Logo enabled */
1215 reqOp[18] = 0x1a;/* FIXME */ 1222 reqOp[18] = 0x1a;/* FIXME */
1216 reqOp[19] = PHONE_GetBitmapSize(Type,0,0) + 8 + 29 + 2; 1223 reqOp[19] = PHONE_GetBitmapSize(Type,0,0) + 8 + 29 + 2;
1217 PHONE_GetBitmapWidthHeight(Type, &Width, &Height); 1224 PHONE_GetBitmapWidthHeight(Type, &Width, &Height);
1218 reqOp[20] = Width; 1225 reqOp[20] = Width;
1219 reqOp[21] = Height; 1226 reqOp[21] = Height;
1220 reqOp[22] = 0x00; 1227 reqOp[22] = 0x00;
1221 reqOp[23] = PHONE_GetBitmapSize(Type,0,0) + 29; 1228 reqOp[23] = PHONE_GetBitmapSize(Type,0,0) + 29;
1222 reqOp[24] = 0x00; 1229 reqOp[24] = 0x00;
1223 reqOp[25] = PHONE_GetBitmapSize(Type,0,0) + 29; 1230 reqOp[25] = PHONE_GetBitmapSize(Type,0,0) + 29;
1224 PHONE_EncodeBitmap(Type, reqOp + 26, Bitmap); 1231 PHONE_EncodeBitmap(Type, reqOp + 26, Bitmap);
1225 smprintf(s, "Setting operator logo\n"); 1232 smprintf(s, "Setting operator logo\n");
1226 return GSM_WaitFor (s, reqOp, reqOp[19]+reqOp[11]+10, 0x0A, 4, ID_SetBitmap); 1233 return GSM_WaitFor (s, reqOp, reqOp[19]+reqOp[11]+10, 0x0A, 4, ID_SetBitmap);
1227 } else { 1234 } else {
1228 error=N6510_GetNetworkInfo(s,&NetInfo); 1235 error=N6510_GetNetworkInfo(s,&NetInfo);
1229 if (error != ERR_NONE) return error; 1236 if (error != ERR_NONE) return error;
1230 NOKIA_EncodeNetworkCode(reqOp+12, NetInfo.NetworkCode); 1237 NOKIA_EncodeNetworkCode(reqOp+12, NetInfo.NetworkCode);
1231 smprintf(s, "Clearing operator logo\n"); 1238 smprintf(s, "Clearing operator logo\n");
1232 return GSM_WaitFor (s, reqOp, 18, 0x0A, 4, ID_SetBitmap); 1239 return GSM_WaitFor (s, reqOp, 18, 0x0A, 4, ID_SetBitmap);
1233 } 1240 }
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{
1295 smprintf(s, "Binary ringtone set\n"); 1298 smprintf(s, "Binary ringtone set\n");
1296 return ERR_NONE; 1299 return ERR_NONE;
1297} 1300}
1298 1301
1299static GSM_Error N6510_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) 1302static GSM_Error N6510_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
1300{ 1303{
1301 GSM_Error error; 1304 GSM_Error error;
1302 GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; 1305 GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
1303 GSM_NetworkInfo NetInfo; 1306 GSM_NetworkInfo NetInfo;
1304 int size=200, current; 1307 int size=200, current;
1305 unsigned char GetIDReq[] = { 1308 unsigned char GetIDReq[] = {
1306 N7110_FRAME_HEADER, 0x01, 0x00, 0x00, 1309 N7110_FRAME_HEADER, 0x01, 0x00, 0x00,
1307 0x00, 0xFF, 0x06, 0xE1, 0x00, 1310 0x00, 0xFF, 0x06, 0xE1, 0x00,
1308 0xFF, 0x06, 0xE1, 0x01, 0x42}; 1311 0xFF, 0x06, 0xE1, 0x01, 0x42};
1309 unsigned char SetPreviewReq[1000] = { 1312 unsigned char SetPreviewReq[1000] = {
1310 0xAE, /* Ringtone ID */ 1313 0xAE, /* Ringtone ID */
1311 0x01, 0x00, 0x0D, 0x00, 1314 0x01, 0x00, 0x0D, 0x00,
1312 0x00, 0x00, 0x00, 0x00, 0x00, 1315 0x00, 0x00, 0x00, 0x00, 0x00,
1313 0x00}; /*Length*/ 1316 0x00}; /*Length*/
1314 unsigned char AddBinaryReq[33000] = { 1317 unsigned char AddBinaryReq[33000] = {
1315 N7110_FRAME_HEADER, 0x0E, 0x7F, 0xFF, 0xFE}; 1318 N7110_FRAME_HEADER, 0x0E, 0x7F, 0xFF, 0xFE};
1316 1319
1317 if (Ringtone->Format == RING_NOTETONE && Ringtone->Location==255) 1320 if (Ringtone->Format == RING_NOTETONE && Ringtone->Location==255)
1318 { 1321 {
@@ -2374,96 +2377,99 @@ static GSM_Error N6510_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode C
2374 2377
2375 switch (Code.Type) { 2378 switch (Code.Type) {
2376 case SEC_Pin: req[4] = 0x02; break; 2379 case SEC_Pin: req[4] = 0x02; break;
2377 case SEC_Puk: req[4] = 0x03; break;/* FIXME */ 2380 case SEC_Puk: req[4] = 0x03; break;/* FIXME */
2378 default : return ERR_NOTSUPPORTED; 2381 default : return ERR_NOTSUPPORTED;
2379 } 2382 }
2380 2383
2381 len = strlen(Code.Code); 2384 len = strlen(Code.Code);
2382 memcpy(req+5,Code.Code,len); 2385 memcpy(req+5,Code.Code,len);
2383 req[5+len]=0x00; 2386 req[5+len]=0x00;
2384 2387
2385 smprintf(s, "Entering security code\n"); 2388 smprintf(s, "Entering security code\n");
2386 return GSM_WaitFor (s, req, 6+len, 0x08, 4, ID_EnterSecurityCode); 2389 return GSM_WaitFor (s, req, 6+len, 0x08, 4, ID_EnterSecurityCode);
2387} 2390}
2388 2391
2389static GSM_Error N6510_ReplySaveSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) 2392static GSM_Error N6510_ReplySaveSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s)
2390{ 2393{
2391 unsigned char folder; 2394 unsigned char folder;
2392 GSM_Phone_Data *Data = &s->Phone.Data; 2395 GSM_Phone_Data *Data = &s->Phone.Data;
2393 2396
2394 switch (msg.Buffer[3]) { 2397 switch (msg.Buffer[3]) {
2395 case 0x01: 2398 case 0x01:
2396 switch (msg.Buffer[4]) { 2399 switch (msg.Buffer[4]) {
2397 case 0x00: 2400 case 0x00:
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 */
2446 0x00, 0x01, /* Location */ 2452 0x00, 0x01, /* Location */
2447 0x01}; /* SMS state */ 2453 0x01}; /* SMS state */
2448 unsigned char NameReq[200] = { 2454 unsigned char NameReq[200] = {
2449 N6110_FRAME_HEADER, 0x16, 2455 N6110_FRAME_HEADER, 0x16,
2450 0x01, /* 1 = SIM, 2 = ME */ 2456 0x01, /* 1 = SIM, 2 = ME */
2451 0x02, /* Folder */ 2457 0x02, /* Folder */
2452 0x00, 0x01}; /* Location */ 2458 0x00, 0x01}; /* Location */
2453 2459
2454 N6510_GetSMSLocation(s, sms, &folderid, &location); 2460 N6510_GetSMSLocation(s, sms, &folderid, &location);
2455 switch (folderid) { 2461 switch (folderid) {
2456 case 0x01: req[5] = 0x02; break; /* INBOX SIM */ 2462 case 0x01: req[5] = 0x02; break; /* INBOX SIM */
2457 case 0x02: req[5] = 0x03; break; /* OUTBOX SIM */ 2463 case 0x02: req[5] = 0x03; break; /* OUTBOX SIM */
2458 default : req[5] = folderid - 1; req[4] = 0x02; break; /* ME folders*/ 2464 default : req[5] = folderid - 1; req[4] = 0x02; break; /* ME folders*/
2459 } 2465 }
2460 req[6]=location / 256; 2466 req[6]=location / 256;
2461 req[7]=location; 2467 req[7]=location;
2462 2468
2463 switch (sms->PDU) { 2469 switch (sms->PDU) {
2464 case SMS_Submit: 2470 case SMS_Submit:
2465 /* Inbox */ 2471 /* Inbox */
2466 if (folderid == 0x01 || folderid == 0x03) sms->PDU = SMS_Deliver; 2472 if (folderid == 0x01 || folderid == 0x03) sms->PDU = SMS_Deliver;
2467 break; 2473 break;
2468 case SMS_Deliver: 2474 case SMS_Deliver:
2469 /* SIM Outbox */ 2475 /* SIM Outbox */
@@ -2631,195 +2637,199 @@ static GSM_Error N6510_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
2631{ 2637{
2632 unsigned char StateReq[] = {N6110_FRAME_HEADER, 0x1f, 0x01, 0x00}; 2638 unsigned char StateReq[] = {N6110_FRAME_HEADER, 0x1f, 0x01, 0x00};
2633 unsigned char GetReq [] = {N6110_FRAME_HEADER, 0x19, 0x00, 0x02}; 2639 unsigned char GetReq [] = {N6110_FRAME_HEADER, 0x19, 0x00, 0x02};
2634 GSM_Errorerror; 2640 GSM_Errorerror;
2635 2641
2636 if (alarm->Location != 1) return ERR_NOTSUPPORTED; 2642 if (alarm->Location != 1) return ERR_NOTSUPPORTED;
2637 2643
2638 s->Phone.Data.Alarm=alarm; 2644 s->Phone.Data.Alarm=alarm;
2639 smprintf(s, "Getting alarm state\n"); 2645 smprintf(s, "Getting alarm state\n");
2640 error = GSM_WaitFor (s, StateReq, 6, 0x19, 4, ID_GetAlarm); 2646 error = GSM_WaitFor (s, StateReq, 6, 0x19, 4, ID_GetAlarm);
2641 if (error != ERR_NONE) return error; 2647 if (error != ERR_NONE) return error;
2642 2648
2643 smprintf(s, "Getting alarm\n"); 2649 smprintf(s, "Getting alarm\n");
2644 return GSM_WaitFor (s, GetReq, 6, 0x19, 4, ID_GetAlarm); 2650 return GSM_WaitFor (s, GetReq, 6, 0x19, 4, ID_GetAlarm);
2645} 2651}
2646 2652
2647static GSM_Error N6510_ReplySetAlarm(GSM_Protocol_Message msg, GSM_StateMachine *s) 2653static GSM_Error N6510_ReplySetAlarm(GSM_Protocol_Message msg, GSM_StateMachine *s)
2648{ 2654{
2649 smprintf(s, "Alarm set\n"); 2655 smprintf(s, "Alarm set\n");
2650 return ERR_NONE; 2656 return ERR_NONE;
2651} 2657}
2652 2658
2653static GSM_Error N6510_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) 2659static GSM_Error N6510_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
2654{ 2660{
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) {
2703 // error = GSM_WaitFor (s, All_Req, 9, 0x1f, 4, ID_GetRingtonesInfo); 2711 // error = GSM_WaitFor (s, All_Req, 9, 0x1f, 4, ID_GetRingtonesInfo);
2704 error = GSM_WaitFor (s, All_Req, 8, 0x1f, 4, ID_GetRingtonesInfo); 2712 error = GSM_WaitFor (s, All_Req, 8, 0x1f, 4, ID_GetRingtonesInfo);
2705 if (error == ERR_EMPTY && Info->Number == 0) return ERR_NOTSUPPORTED; 2713 if (error == ERR_EMPTY && Info->Number == 0) return ERR_NOTSUPPORTED;
2706 return error; 2714 return error;
2707 } else { 2715 } else {
2708 error = GSM_WaitFor (s, UserReq, 8, 0x1f, 4, ID_GetRingtonesInfo); 2716 error = GSM_WaitFor (s, UserReq, 8, 0x1f, 4, ID_GetRingtonesInfo);
2709 if (error == ERR_EMPTY && Info->Number == 0) return ERR_NOTSUPPORTED; 2717 if (error == ERR_EMPTY && Info->Number == 0) return ERR_NOTSUPPORTED;
2710 return error; 2718 return error;
2711 } 2719 }
2712} 2720}
2713 2721
2714static GSM_Error N6510_GetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info) 2722static GSM_Error N6510_GetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info)
2715{ 2723{
2716 return N6510_PrivGetRingtonesInfo(s, Info, true); 2724 return N6510_PrivGetRingtonesInfo(s, Info, true);
2717} 2725}
2718 2726
2719static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) 2727static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
2720{ 2728{
2721 int tmp,i; 2729 int tmp,i;
2722 GSM_Phone_Data *Data = &s->Phone.Data; 2730 GSM_Phone_Data *Data = &s->Phone.Data;
2723 2731
2724 smprintf(s, "Ringtone received\n"); 2732 smprintf(s, "Ringtone received\n");
2725 memcpy(Data->Ringtone->Name,msg.Buffer+8,msg.Buffer[7]*2); 2733 memcpy(Data->Ringtone->Name,msg.Buffer+8,msg.Buffer[7]*2);
2726 Data->Ringtone->Name[msg.Buffer[7]*2]=0; 2734 Data->Ringtone->Name[msg.Buffer[7]*2]=0;
2727 Data->Ringtone->Name[msg.Buffer[7]*2+1]=0; 2735 Data->Ringtone->Name[msg.Buffer[7]*2+1]=0;
2728 smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name)); 2736 smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name));
2729 if (msg.Buffer[msg.Buffer[7]*2+10] == 'M' && 2737 if (msg.Buffer[msg.Buffer[7]*2+10] == 'M' &&
2730 msg.Buffer[msg.Buffer[7]*2+11] == 'T' && 2738 msg.Buffer[msg.Buffer[7]*2+11] == 'T' &&
2731 msg.Buffer[msg.Buffer[7]*2+12] == 'h' && 2739 msg.Buffer[msg.Buffer[7]*2+12] == 'h' &&
2732 msg.Buffer[msg.Buffer[7]*2+13] == 'd') { 2740 msg.Buffer[msg.Buffer[7]*2+13] == 'd') {
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,
2802 0x05,0x00,0x00,0x08,0x00,0x00}; 2812 0x05,0x00,0x00,0x08,0x00,0x00};
2803 // unsigned char reqOff2[] = { 2813 // unsigned char reqOff2[] = {
2804 // 0x00,0x06,0x01,0x14,0x05,0x04, 2814 // 0x00,0x06,0x01,0x14,0x05,0x04,
2805 // 0x00,0x00,0x00,0x01,0x03,0x08, 2815 // 0x00,0x00,0x00,0x01,0x03,0x08,
2806 // 0x00,0x00,0x00,0x00,0x00,0x00}; 2816 // 0x00,0x00,0x00,0x00,0x00,0x00};
2807 2817
2808 if (start) { 2818 if (start) {
2809 smprintf(s, "Enabling sound - part 1\n"); 2819 smprintf(s, "Enabling sound - part 1\n");
2810 error=GSM_WaitFor (s, reqStart, 6, 0x0b, 4, ID_PlayTone); 2820 error=GSM_WaitFor (s, reqStart, 6, 0x0b, 4, ID_PlayTone);
2811 if (error!=ERR_NONE) return error; 2821 if (error!=ERR_NONE) return error;
2812 smprintf(s, "Enabling sound - part 2 (disabling sound command)\n"); 2822 smprintf(s, "Enabling sound - part 2 (disabling sound command)\n");
2813 error=GSM_WaitFor (s, reqOff, 18, 0x0b, 4, ID_PlayTone); 2823 error=GSM_WaitFor (s, reqOff, 18, 0x0b, 4, ID_PlayTone);
2814 if (error!=ERR_NONE) return error; 2824 if (error!=ERR_NONE) return error;
2815 } 2825 }
2816 2826
2817 /* For Herz==255*255 we have silent */ 2827 /* For Herz==255*255 we have silent */
2818 if (Herz!=255*255) { 2828 if (Herz!=255*255) {
2819 reqPlay[23] = Herz%256; 2829 reqPlay[23] = Herz%256;
2820 reqPlay[22] = Herz/256; 2830 reqPlay[22] = Herz/256;
2821 reqPlay[31] = Volume; 2831 reqPlay[31] = Volume;
2822 smprintf(s, "Playing sound\n"); 2832 smprintf(s, "Playing sound\n");
2823 return GSM_WaitFor (s, reqPlay, 34, 0x0b, 4, ID_PlayTone); 2833 return GSM_WaitFor (s, reqPlay, 34, 0x0b, 4, ID_PlayTone);
2824 } else { 2834 } else {
2825 reqPlay[23] = 0; 2835 reqPlay[23] = 0;
@@ -4009,96 +4019,187 @@ static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable)
4009 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true); 4019 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true);
4010 } else { 4020 } else {
4011 error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false); 4021 error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false);
4012 if (error != ERR_NONE) return error; 4022 if (error != ERR_NONE) return error;
4013 4023
4014 error=N6510_SetLight(s,N6510_LIGHT_TORCH,false); 4024 error=N6510_SetLight(s,N6510_LIGHT_TORCH,false);
4015 if (error != ERR_NONE) return error; 4025 if (error != ERR_NONE) return error;
4016 4026
4017 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false); 4027 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false);
4018 } 4028 }
4019} 4029}
4020 4030
4021static GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 4031static GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
4022{ 4032{
4023 return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastNote); 4033 return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastNote);
4024} 4034}
4025 4035
4026static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *s) 4036static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *s)
4027{ 4037{
4028 smprintf(s, "Note received\n"); 4038 smprintf(s, "Note received\n");
4029 memcpy(s->Phone.Data.Note->Text,msg.Buffer+54,(msg.Buffer[50]*256+msg.Buffer[51])*2); 4039 memcpy(s->Phone.Data.Note->Text,msg.Buffer+54,(msg.Buffer[50]*256+msg.Buffer[51])*2);
4030 s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2] = 0; 4040 s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2] = 0;
4031 s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2+1] = 0; 4041 s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2+1] = 0;
4032 return ERR_NONE; 4042 return ERR_NONE;
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;
4081 int i; 4182 int i;
4082 4183
4083 switch (msg.Buffer[3]) { 4184 switch (msg.Buffer[3]) {
4084 case 0x15: 4185 case 0x15:
4085 smprintf(s,"File or folder details received\n"); 4186 smprintf(s,"File or folder details received\n");
4086 CopyUnicodeString(File->Name,msg.Buffer+10); 4187 CopyUnicodeString(File->Name,msg.Buffer+10);
4087 if (!strncmp(DecodeUnicodeString(File->Name),"GMSTemp",7)) return ERR_EMPTY; 4188 if (!strncmp(DecodeUnicodeString(File->Name),"GMSTemp",7)) return ERR_EMPTY;
4088 if (File->Name[0] == 0x00 && File->Name[1] == 0x00) return ERR_UNKNOWN; 4189 if (File->Name[0] == 0x00 && File->Name[1] == 0x00) return ERR_UNKNOWN;
4089 4190
4090 i = msg.Buffer[8]*256+msg.Buffer[9]; 4191 i = msg.Buffer[8]*256+msg.Buffer[9];
4091 dbgprintf("%02x %02x %02x %02x %02x %02x %02x %02x %02x\n", 4192 dbgprintf("%02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
4092 msg.Buffer[i-5],msg.Buffer[i-4],msg.Buffer[i-3], 4193 msg.Buffer[i-5],msg.Buffer[i-4],msg.Buffer[i-3],
4093 msg.Buffer[i-2],msg.Buffer[i-1],msg.Buffer[i], 4194 msg.Buffer[i-2],msg.Buffer[i-1],msg.Buffer[i],
4094 msg.Buffer[i+1],msg.Buffer[i+2],msg.Buffer[i+3]); 4195 msg.Buffer[i+1],msg.Buffer[i+2],msg.Buffer[i+3]);
4095 4196
4096 File->Folder = false; 4197 File->Folder = false;
4097 if (msg.Buffer[i-5] == 0x00) File->Folder = true; 4198 if (msg.Buffer[i-5] == 0x00) File->Folder = true;
4098 4199
4099 File->ReadOnly = false; 4200 File->ReadOnly = false;
4100 File->Protected = false; 4201 File->Protected = false;
4101 File->System= false; 4202 File->System= false;
4102 File->Hidden= false; 4203 File->Hidden= false;
4103 if (msg.Buffer[i+2] == 0x01) File->Protected = true; 4204 if (msg.Buffer[i+2] == 0x01) File->Protected = true;
4104 if (msg.Buffer[i+4] == 0x01) File->ReadOnly = true; 4205 if (msg.Buffer[i+4] == 0x01) File->ReadOnly = true;
@@ -5144,109 +5245,110 @@ static GSM_Error N6510_ReplyAddToDo1(GSM_Protocol_Message msg, GSM_StateMachine
5144 5245
5145/* ToDo support - 6310 style */ 5246/* ToDo support - 6310 style */
5146static GSM_Error N6510_AddToDo1(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) 5247static GSM_Error N6510_AddToDo1(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
5147{ 5248{
5148 int Text, Alarm, EndTime, Completed, ulen, Phone; 5249 int Text, Alarm, EndTime, Completed, ulen, Phone;
5149 GSM_Error error; 5250 GSM_Error error;
5150 unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x0F}; 5251 unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x0F};
5151 unsigned char reqSet[500] = { 5252 unsigned char reqSet[500] = {
5152 N6110_FRAME_HEADER, 0x01, 5253 N6110_FRAME_HEADER, 0x01,
5153 0x03, /* Priority */ 5254 0x03, /* Priority */
5154 0x00, /* Length of text */ 5255 0x00, /* Length of text */
5155 0x80,0x00,0x00, 5256 0x80,0x00,0x00,
5156 0x18}; /* Location */ 5257 0x18}; /* Location */
5157 5258
5158 s->Phone.Data.ToDo = ToDo; 5259 s->Phone.Data.ToDo = ToDo;
5159 5260
5160 smprintf(s, "Getting first ToDo location\n"); 5261 smprintf(s, "Getting first ToDo location\n");
5161 error = GSM_WaitFor (s, reqLoc, 4, 0x55, 4, ID_SetToDo); 5262 error = GSM_WaitFor (s, reqLoc, 4, 0x55, 4, ID_SetToDo);
5162 if (error != ERR_NONE) return error; 5263 if (error != ERR_NONE) return error;
5163 reqSet[9] = ToDo->Location; 5264 reqSet[9] = ToDo->Location;
5164 5265
5165 switch (ToDo->Priority) { 5266 switch (ToDo->Priority) {
5166 case GSM_Priority_Low: reqSet[4] = 3; break; 5267 case GSM_Priority_Low: reqSet[4] = 3; break;
5167 case GSM_Priority_Medium: reqSet[4] = 2; break; 5268 case GSM_Priority_Medium: reqSet[4] = 2; break;
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;
5229 5331
5230 smprintf(s, "Getting first free ToDo location method 2\n"); 5332 smprintf(s, "Getting first free ToDo location method 2\n");
5231 error = GSM_WaitFor (s, reqLoc, 5, 0x13, 4, ID_SetToDo); 5333 error = GSM_WaitFor (s, reqLoc, 5, 0x13, 4, ID_SetToDo);
5232 if (error!=ERR_NONE) return error; 5334 if (error!=ERR_NONE) return error;
5233 req[8] = ToDo->Location/256; 5335 req[8] = ToDo->Location/256;
5234 req[9] = ToDo->Location%256; 5336 req[9] = ToDo->Location%256;
5235 5337
5236 Note.Type = GSM_CAL_MEETING; 5338 Note.Type = GSM_CAL_MEETING;
5237 DT.Year = 2004; DT.Month = 1; DT.Day = 1; 5339 DT.Year = 2004; DT.Month = 1; DT.Day = 1;
5238 DT.Hour = 12; DT.Minute = 12; DT.Second = 0; 5340 DT.Hour = 12; DT.Minute = 12; DT.Second = 0;
5239 memcpy(&Note.Entries[0].Date,&DT,sizeof(GSM_DateTime)); 5341 memcpy(&Note.Entries[0].Date,&DT,sizeof(GSM_DateTime));
5240 Note.Entries[0].EntryType = CAL_START_DATETIME; 5342 Note.Entries[0].EntryType = CAL_START_DATETIME;
5241 memcpy(&Note.Entries[1].Date,&DT,sizeof(GSM_DateTime)); 5343 memcpy(&Note.Entries[1].Date,&DT,sizeof(GSM_DateTime));
5242 Note.Entries[1].EntryType = CAL_END_DATETIME; 5344 Note.Entries[1].EntryType = CAL_END_DATETIME;
5243 EncodeUnicode(Note.Entries[2].Text,"ala",3); 5345 EncodeUnicode(Note.Entries[2].Text,"ala",3);
5244 Note.Entries[2].EntryType = CAL_TEXT; 5346 Note.Entries[2].EntryType = CAL_TEXT;
5245 Note.EntriesNum = 3; 5347 Note.EntriesNum = 3;
5246 error=N6510_FindCalendarIconID3(s, &Note, &req[21]); 5348 error=N6510_FindCalendarIconID3(s, &Note, &req[21]);
5247 if (error!=ERR_NONE) return error; 5349 if (error!=ERR_NONE) return error;
5248 5350
5249 switch (ToDo->Priority) { 5351 switch (ToDo->Priority) {
5250 case GSM_Priority_Low: req[44] = 0x10; break; 5352 case GSM_Priority_Low: req[44] = 0x10; break;
5251 case GSM_Priority_Medium: req[44] = 0x20; break; 5353 case GSM_Priority_Medium: req[44] = 0x20; break;
5252 case GSM_Priority_High: req[44] = 0x30; break; 5354 case GSM_Priority_High: req[44] = 0x30; break;
@@ -5540,104 +5642,106 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5540 5642
5541 {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame }, 5643 {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame },
5542 {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame }, 5644 {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame },
5543 {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC }, 5645 {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC },
5544 {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC }, 5646 {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC },
5545 5647
5546 {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus }, 5648 {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus },
5547 {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory }, 5649 {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory },
5548 {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory }, 5650 {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory },
5549 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap }, 5651 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap },
5550 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory }, 5652 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory },
5551 5653
5552 {DCT3DCT4_ReplyCallDivert, "\x06",0x03,0x02,ID_Divert }, 5654 {DCT3DCT4_ReplyCallDivert, "\x06",0x03,0x02,ID_Divert },
5553 {N71_65_ReplyUSSDInfo, "\x06",0x03,0x03,ID_IncomingFrame }, 5655 {N71_65_ReplyUSSDInfo, "\x06",0x03,0x03,ID_IncomingFrame },
5554 {NoneReply, "\x06",0x03,0x06,ID_IncomingFrame }, 5656 {NoneReply, "\x06",0x03,0x06,ID_IncomingFrame },
5555 {NoneReply, "\x06",0x03,0x09,ID_IncomingFrame }, 5657 {NoneReply, "\x06",0x03,0x09,ID_IncomingFrame },
5556 5658
5557 {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x08,ID_EnterSecurityCode }, 5659 {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x08,ID_EnterSecurityCode },
5558 {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x09,ID_EnterSecurityCode }, 5660 {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x09,ID_EnterSecurityCode },
5559 {N6510_ReplyGetSecurityStatus, "\x08",0x03,0x12,ID_GetSecurityStatus }, 5661 {N6510_ReplyGetSecurityStatus, "\x08",0x03,0x12,ID_GetSecurityStatus },
5560 5662
5561 {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_GetNetworkInfo }, 5663 {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_GetNetworkInfo },
5562 {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_IncomingFrame }, 5664 {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_IncomingFrame },
5563 {N6510_ReplyLogIntoNetwork, "\x0A",0x03,0x02,ID_IncomingFrame }, 5665 {N6510_ReplyLogIntoNetwork, "\x0A",0x03,0x02,ID_IncomingFrame },
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 },
5620 {N6510_ReplyGetDateTime, "\x19",0x03,0x0B,ID_GetDateTime }, 5724 {N6510_ReplyGetDateTime, "\x19",0x03,0x0B,ID_GetDateTime },
5621 {N6510_ReplySetAlarm, "\x19",0x03,0x12,ID_SetAlarm }, 5725 {N6510_ReplySetAlarm, "\x19",0x03,0x12,ID_SetAlarm },
5622 {N6510_ReplyGetAlarm, "\x19",0x03,0x1A,ID_GetAlarm }, 5726 {N6510_ReplyGetAlarm, "\x19",0x03,0x1A,ID_GetAlarm },
5623 {N6510_ReplyGetAlarm, "\x19",0x03,0x20,ID_GetAlarm }, 5727 {N6510_ReplyGetAlarm, "\x19",0x03,0x20,ID_GetAlarm },
5624 5728
5625 {DCT4_ReplyGetIMEI, "\x1B",0x03,0x01,ID_GetIMEI }, 5729 {DCT4_ReplyGetIMEI, "\x1B",0x03,0x01,ID_GetIMEI },
5626 {NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x08,ID_GetHardware }, 5730 {NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x08,ID_GetHardware },
5627 {N6510_ReplyGetPPM, "\x1B",0x03,0x08,ID_GetPPM }, 5731 {N6510_ReplyGetPPM, "\x1B",0x03,0x08,ID_GetPPM },
5628 {NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x0C,ID_GetProductCode }, 5732 {NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x0C,ID_GetProductCode },
5629 5733
5630 /* 0x1C - vibra */ 5734 /* 0x1C - vibra */
5631 5735
5632 {N6510_ReplyGetRingtonesInfo, "\x1f",0x03,0x08,ID_GetRingtonesInfo }, 5736 {N6510_ReplyGetRingtonesInfo, "\x1f",0x03,0x08,ID_GetRingtonesInfo },
5633 {N6510_ReplyDeleteRingtones, "\x1f",0x03,0x11,ID_SetRingtone }, 5737 {N6510_ReplyDeleteRingtones, "\x1f",0x03,0x11,ID_SetRingtone },
5634 {N6510_ReplyGetRingtone, "\x1f",0x03,0x13,ID_GetRingtone }, 5738 {N6510_ReplyGetRingtone, "\x1f",0x03,0x13,ID_GetRingtone },
5635 {N6510_ReplySetBinRingtone, "\x1f",0x03,0x0F,ID_SetRingtone }, 5739 {N6510_ReplySetBinRingtone, "\x1f",0x03,0x0F,ID_SetRingtone },
5636 5740
5637 /* 0x23 - voice records */ 5741 /* 0x23 - voice records */
5638 5742
5639 {N6510_ReplyGetProfile, "\x39",0x03,0x02,ID_GetProfile }, 5743 {N6510_ReplyGetProfile, "\x39",0x03,0x02,ID_GetProfile },
5640 {N6510_ReplySetProfile, "\x39",0x03,0x04,ID_SetProfile }, 5744 {N6510_ReplySetProfile, "\x39",0x03,0x04,ID_SetProfile },
5641 {N6510_ReplyGetProfile, "\x39",0x03,0x06,ID_GetProfile }, 5745 {N6510_ReplyGetProfile, "\x39",0x03,0x06,ID_GetProfile },
5642 5746
5643 {N6510_ReplySetLight, "\x3A",0x03,0x06,ID_SetLight }, 5747 {N6510_ReplySetLight, "\x3A",0x03,0x06,ID_SetLight },
@@ -5687,97 +5791,97 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5687 5791
5688 /* 0x53 - simlock */ 5792 /* 0x53 - simlock */
5689 5793
5690 {N6510_ReplyAddToDo1, "\x55",0x03,0x02,ID_SetToDo }, 5794 {N6510_ReplyAddToDo1, "\x55",0x03,0x02,ID_SetToDo },
5691 {N6510_ReplyGetToDo1, "\x55",0x03,0x04,ID_GetToDo }, 5795 {N6510_ReplyGetToDo1, "\x55",0x03,0x04,ID_GetToDo },
5692 {N6510_ReplyGetToDoFirstLoc1, "\x55",0x03,0x10,ID_SetToDo }, 5796 {N6510_ReplyGetToDoFirstLoc1, "\x55",0x03,0x10,ID_SetToDo },
5693 {N6510_ReplyDeleteAllToDo1, "\x55",0x03,0x12,ID_DeleteAllToDo }, 5797 {N6510_ReplyDeleteAllToDo1, "\x55",0x03,0x12,ID_DeleteAllToDo },
5694 {N6510_ReplyGetToDoStatus1, "\x55",0x03,0x16,ID_GetToDo }, 5798 {N6510_ReplyGetToDoStatus1, "\x55",0x03,0x16,ID_GetToDo },
5695 5799
5696 {N6510_ReplyAddFileHeader, "\x6D",0x03,0x03,ID_AddFile }, 5800 {N6510_ReplyAddFileHeader, "\x6D",0x03,0x03,ID_AddFile },
5697 {N6510_ReplyAddFolder, "\x6D",0x03,0x05,ID_AddFolder }, 5801 {N6510_ReplyAddFolder, "\x6D",0x03,0x05,ID_AddFolder },
5698 {N6510_ReplyGetFilePart, "\x6D",0x03,0x0F,ID_GetFile }, 5802 {N6510_ReplyGetFilePart, "\x6D",0x03,0x0F,ID_GetFile },
5699 {N6510_ReplyAddFileHeader, "\x6D",0x03,0x13,ID_AddFile }, 5803 {N6510_ReplyAddFileHeader, "\x6D",0x03,0x13,ID_AddFile },
5700 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_GetFileInfo }, 5804 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_GetFileInfo },
5701 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_GetFile }, 5805 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_GetFile },
5702 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_AddFile }, 5806 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_AddFile },
5703 {N6510_ReplyDeleteFile, "\x6D",0x03,0x19,ID_DeleteFile }, 5807 {N6510_ReplyDeleteFile, "\x6D",0x03,0x19,ID_DeleteFile },
5704 {N6510_ReplyDeleteFile, "\x6D",0x03,0x1F,ID_DeleteFile }, 5808 {N6510_ReplyDeleteFile, "\x6D",0x03,0x1F,ID_DeleteFile },
5705 {N6510_ReplyGetFileSystemStatus, "\x6D",0x03,0x23,ID_FileSystemStatus }, 5809 {N6510_ReplyGetFileSystemStatus, "\x6D",0x03,0x23,ID_FileSystemStatus },
5706 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x2F,ID_GetFileInfo }, 5810 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x2F,ID_GetFileInfo },
5707 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x2F,ID_GetFile }, 5811 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x2F,ID_GetFile },
5708 {N6510_ReplyGetFileSystemStatus, "\x6D",0x03,0x2F,ID_FileSystemStatus }, 5812 {N6510_ReplyGetFileSystemStatus, "\x6D",0x03,0x2F,ID_FileSystemStatus },
5709 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x33,ID_GetFileInfo }, 5813 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x33,ID_GetFileInfo },
5710 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x33,ID_GetFile }, 5814 {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x33,ID_GetFile },
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*/
5760 N6510_EnterSecurityCode, 5864 N6510_EnterSecurityCode,
5761 N6510_GetSecurityStatus, 5865 N6510_GetSecurityStatus,
5762 NOTSUPPORTED, /* GetDisplayStatus*/ 5866 NOTSUPPORTED, /* GetDisplayStatus*/
5763 NOTIMPLEMENTED, /* SetAutoNetworkLogin*/ 5867 NOTIMPLEMENTED, /* SetAutoNetworkLogin*/
5764 N6510_GetBatteryCharge, 5868 N6510_GetBatteryCharge,
5765 N6510_GetSignalQuality, 5869 N6510_GetSignalQuality,
5766 N6510_GetNetworkInfo, 5870 N6510_GetNetworkInfo,
5767 NOTSUPPORTED, /* GetCategory */ 5871 NOTSUPPORTED, /* GetCategory */
5768 NOTSUPPORTED, /* AddCategory */ 5872 NOTSUPPORTED, /* AddCategory */
5769 NOTSUPPORTED, /* GetCategoryStatus */ 5873 NOTSUPPORTED, /* GetCategoryStatus */
5770 N6510_GetMemoryStatus, 5874 N6510_GetMemoryStatus,
5771 N6510_GetMemory, 5875 N6510_GetMemory,
5772 NOTIMPLEMENTED, /* GetNextMemory */ 5876 NOTIMPLEMENTED, /* GetNextMemory */
5773 N6510_SetMemory, 5877 N6510_SetMemory,
5774 NOTIMPLEMENTED, /* AddMemory */ 5878 NOTIMPLEMENTED, /* AddMemory */
5775 N6510_DeleteMemory, 5879 N6510_DeleteMemory,
5776 NOTIMPLEMENTED, /* DeleteAllMemory */ 5880 NOTIMPLEMENTED, /* DeleteAllMemory */
5777 N6510_GetSpeedDial, 5881 N6510_GetSpeedDial,
5778 NOTIMPLEMENTED, /* SetSpeedDial */ 5882 NOTIMPLEMENTED, /* SetSpeedDial */
5779 N6510_GetSMSC, 5883 N6510_GetSMSC,
5780 N6510_SetSMSC, 5884 N6510_SetSMSC,
5781 N6510_GetSMSStatus, 5885 N6510_GetSMSStatus,
5782 N6510_GetSMSMessage, 5886 N6510_GetSMSMessage,
5783 N6510_GetNextSMSMessage, 5887 N6510_GetNextSMSMessage,
@@ -5796,69 +5900,75 @@ GSM_Phone_Functions N6510Phone = {
5796 N6510_AnswerCall, 5900 N6510_AnswerCall,
5797 N6510_CancelCall, 5901 N6510_CancelCall,
5798 NOTIMPLEMENTED, /* HoldCall */ 5902 NOTIMPLEMENTED, /* HoldCall */
5799 NOTIMPLEMENTED, /* UnholdCall */ 5903 NOTIMPLEMENTED, /* UnholdCall */
5800 NOTIMPLEMENTED, /* ConferenceCall */ 5904 NOTIMPLEMENTED, /* ConferenceCall */
5801 NOTIMPLEMENTED, /* SplitCall */ 5905 NOTIMPLEMENTED, /* SplitCall */
5802 NOTIMPLEMENTED, /* TransferCall */ 5906 NOTIMPLEMENTED, /* TransferCall */
5803 NOTIMPLEMENTED, /* SwitchCall */ 5907 NOTIMPLEMENTED, /* SwitchCall */
5804 DCT3DCT4_GetCallDivert, 5908 DCT3DCT4_GetCallDivert,
5805 DCT3DCT4_SetCallDivert, 5909 DCT3DCT4_SetCallDivert,
5806 DCT3DCT4_CancelAllDiverts, 5910 DCT3DCT4_CancelAllDiverts,
5807 NOKIA_SetIncomingCall, 5911 NOKIA_SetIncomingCall,
5808 NOKIA_SetIncomingUSSD, 5912 NOKIA_SetIncomingUSSD,
5809 DCT3DCT4_SendDTMF, 5913 DCT3DCT4_SendDTMF,
5810 N6510_GetRingtone, 5914 N6510_GetRingtone,
5811 N6510_SetRingtone, 5915 N6510_SetRingtone,
5812 N6510_GetRingtonesInfo, 5916 N6510_GetRingtonesInfo,
5813 N6510_DeleteUserRingtones, 5917 N6510_DeleteUserRingtones,
5814 N6510_PlayTone, 5918 N6510_PlayTone,
5815 N6510_GetWAPBookmark, 5919 N6510_GetWAPBookmark,
5816 N6510_SetWAPBookmark, 5920 N6510_SetWAPBookmark,
5817 N6510_DeleteWAPBookmark, 5921 N6510_DeleteWAPBookmark,
5818 N6510_GetWAPSettings, 5922 N6510_GetWAPSettings,
5819 N6510_SetWAPSettings, 5923 N6510_SetWAPSettings,
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
@@ -76,69 +76,75 @@ GSM_Phone_Functions NAUTOPhone = {
76 NOTSUPPORTED, /* GetSMSFolders */ 76 NOTSUPPORTED, /* GetSMSFolders */
77 NOTSUPPORTED, /* AddSMSFolder */ 77 NOTSUPPORTED, /* AddSMSFolder */
78 NOTSUPPORTED, /* DeleteSMSFolder */ 78 NOTSUPPORTED, /* DeleteSMSFolder */
79 NOTSUPPORTED, /* DialVoice */ 79 NOTSUPPORTED, /* DialVoice */
80 NOTSUPPORTED, /* AnswerCall */ 80 NOTSUPPORTED, /* AnswerCall */
81 NOTSUPPORTED, /* CancelCall */ 81 NOTSUPPORTED, /* CancelCall */
82 NOTSUPPORTED, /* HoldCall */ 82 NOTSUPPORTED, /* HoldCall */
83 NOTSUPPORTED, /* UnholdCall */ 83 NOTSUPPORTED, /* UnholdCall */
84 NOTSUPPORTED, /* ConferenceCall */ 84 NOTSUPPORTED, /* ConferenceCall */
85 NOTSUPPORTED, /* SplitCall */ 85 NOTSUPPORTED, /* SplitCall */
86 NOTSUPPORTED, /* TransferCall */ 86 NOTSUPPORTED, /* TransferCall */
87 NOTSUPPORTED, /* SwitchCall */ 87 NOTSUPPORTED, /* SwitchCall */
88 NOTSUPPORTED, /* GetCallDivert */ 88 NOTSUPPORTED, /* GetCallDivert */
89 NOTSUPPORTED, /* SetCallDivert */ 89 NOTSUPPORTED, /* SetCallDivert */
90 NOTSUPPORTED, /* CancelAllDiverts*/ 90 NOTSUPPORTED, /* CancelAllDiverts*/
91 NOTSUPPORTED, /* SetIncomingCall */ 91 NOTSUPPORTED, /* SetIncomingCall */
92 NOTSUPPORTED, /* SetIncomingUSSD */ 92 NOTSUPPORTED, /* SetIncomingUSSD */
93 NOTSUPPORTED, /* SendDTMF */ 93 NOTSUPPORTED, /* SendDTMF */
94 NOTSUPPORTED, /* GetRingtone */ 94 NOTSUPPORTED, /* GetRingtone */
95 NOTSUPPORTED, /* SetRingtone */ 95 NOTSUPPORTED, /* SetRingtone */
96 NOTSUPPORTED, /* GetRingtonesInfo*/ 96 NOTSUPPORTED, /* GetRingtonesInfo*/
97 NOTSUPPORTED, /* DeleteUserRingtones*/ 97 NOTSUPPORTED, /* DeleteUserRingtones*/
98 NOTSUPPORTED, /* PlayTone */ 98 NOTSUPPORTED, /* PlayTone */
99 NOTSUPPORTED, /* GetWAPBookmark */ 99 NOTSUPPORTED, /* GetWAPBookmark */
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
@@ -784,69 +784,75 @@ GSM_Phone_Functions OBEXGENPhone = {
784 NOTIMPLEMENTED, /* AnswerCall */ 784 NOTIMPLEMENTED, /* AnswerCall */
785 NOTIMPLEMENTED, /* CancelCall */ 785 NOTIMPLEMENTED, /* CancelCall */
786 NOTIMPLEMENTED, /* HoldCall */ 786 NOTIMPLEMENTED, /* HoldCall */
787 NOTIMPLEMENTED, /* UnholdCall */ 787 NOTIMPLEMENTED, /* UnholdCall */
788 NOTIMPLEMENTED, /* ConferenceCall */ 788 NOTIMPLEMENTED, /* ConferenceCall */
789 NOTIMPLEMENTED, /* SplitCall */ 789 NOTIMPLEMENTED, /* SplitCall */
790 NOTIMPLEMENTED, /* TransferCall */ 790 NOTIMPLEMENTED, /* TransferCall */
791 NOTIMPLEMENTED, /* SwitchCall */ 791 NOTIMPLEMENTED, /* SwitchCall */
792 NOTIMPLEMENTED, /* GetCallDivert */ 792 NOTIMPLEMENTED, /* GetCallDivert */
793 NOTIMPLEMENTED, /* SetCallDivert */ 793 NOTIMPLEMENTED, /* SetCallDivert */
794 NOTIMPLEMENTED, /* CancelAllDiverts*/ 794 NOTIMPLEMENTED, /* CancelAllDiverts*/
795 NOTIMPLEMENTED, /* SetIncomingCall */ 795 NOTIMPLEMENTED, /* SetIncomingCall */
796 NOTIMPLEMENTED, /* SetIncomingUSSD */ 796 NOTIMPLEMENTED, /* SetIncomingUSSD */
797 NOTIMPLEMENTED, /* SendDTMF */ 797 NOTIMPLEMENTED, /* SendDTMF */
798 NOTIMPLEMENTED, /* GetRingtone */ 798 NOTIMPLEMENTED, /* GetRingtone */
799 NOTIMPLEMENTED, /* SetRingtone */ 799 NOTIMPLEMENTED, /* SetRingtone */
800 NOTIMPLEMENTED, /* GetRingtonesInfo*/ 800 NOTIMPLEMENTED, /* GetRingtonesInfo*/
801 NOTIMPLEMENTED, /* DeleteUserRingtones*/ 801 NOTIMPLEMENTED, /* DeleteUserRingtones*/
802 NOTIMPLEMENTED, /* PlayTone */ 802 NOTIMPLEMENTED, /* PlayTone */
803 NOTIMPLEMENTED, /* GetWAPBookmark */ 803 NOTIMPLEMENTED, /* GetWAPBookmark */
804 NOTIMPLEMENTED, /* SetWAPBookmark */ 804 NOTIMPLEMENTED, /* SetWAPBookmark */
805 NOTIMPLEMENTED, /* DeleteWAPBookmark */ 805 NOTIMPLEMENTED, /* DeleteWAPBookmark */
806 NOTIMPLEMENTED, /* GetWAPSettings */ 806 NOTIMPLEMENTED, /* GetWAPSettings */
807 NOTIMPLEMENTED, /* SetWAPSettings */ 807 NOTIMPLEMENTED, /* SetWAPSettings */
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
@@ -16,96 +16,97 @@ GSM_SMSMessageLayout PHONE_SMSDeliver = {
16 28 /* SendingDateTime */, 255 /* SMSCDateTime*/, 16 28 /* SendingDateTime */, 255 /* SMSCDateTime*/,
17 255 /* TPStatus */, 15 /* TPUDL */, 17 255 /* TPStatus */, 15 /* TPUDL */,
18 255 /* TPVP */, 12 /* firstbyte*/, 18 255 /* TPVP */, 12 /* firstbyte*/,
19 255 /* TPMR */, 13 /* TPPID */}; 19 255 /* TPMR */, 13 /* TPPID */};
20GSM_SMSMessageLayout PHONE_SMSSubmit = { 20GSM_SMSMessageLayout PHONE_SMSSubmit = {
21 36 /* SMS Text */, 17 /* Phone number*/, 21 36 /* SMS Text */, 17 /* Phone number*/,
22 0 /* SMSC Number */, 15 /* TPDCS */, 22 0 /* SMSC Number */, 15 /* TPDCS */,
23 255 /* SendingDateTime */, 255 /* SMSCDateTime*/, 23 255 /* SendingDateTime */, 255 /* SMSCDateTime*/,
24 255 /* TPStatus */, 16 /* TPUDL */, 24 255 /* TPStatus */, 16 /* TPUDL */,
25 29 /* TPVP */, 12 /* firstbyte*/, 25 29 /* TPVP */, 12 /* firstbyte*/,
26 13 /* TPMR */, 14 /* TPPID */}; 26 13 /* TPMR */, 14 /* TPPID */};
27GSM_SMSMessageLayout PHONE_SMSStatusReport = { 27GSM_SMSMessageLayout PHONE_SMSStatusReport = {
28 255 /* SMS Text */, 15 /* Phone number*/, 28 255 /* SMS Text */, 15 /* Phone number*/,
29 0 /* SMSC Number */, 255 /* TPDCS */, 29 0 /* SMSC Number */, 255 /* TPDCS */,
30 27 /* SendingDateTime */, 34 /* SMSCDateTime*/, 30 27 /* SendingDateTime */, 34 /* SMSCDateTime*/,
31 14 /* TPStatus */, 255 /* TPUDL */, 31 14 /* TPStatus */, 255 /* TPUDL */,
32 255 /* TPVP */, 12 /* firstbyte*/, 32 255 /* TPVP */, 12 /* firstbyte*/,
33 13 /* TPMR */, 255 /* TPPID?? */}; 33 13 /* TPMR */, 255 /* TPPID?? */};
34 34
35GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders) 35GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
36{ 36{
37 folders->Number=2; 37 folders->Number=2;
38 EncodeUnicode(folders->Folder[0].Name,GetMsg(s->msg,"Inbox"),strlen(GetMsg(s->msg,"Inbox"))); 38 EncodeUnicode(folders->Folder[0].Name,GetMsg(s->msg,"Inbox"),strlen(GetMsg(s->msg,"Inbox")));
39 EncodeUnicode(folders->Folder[1].Name,GetMsg(s->msg,"Outbox"),strlen(GetMsg(s->msg,"Outbox"))); 39 EncodeUnicode(folders->Folder[1].Name,GetMsg(s->msg,"Outbox"),strlen(GetMsg(s->msg,"Outbox")));
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;
88 GSM_Error error; 89 GSM_Error error;
89 90
90 Hz=GSM_RingNoteGetFrequency(note); 91 Hz=GSM_RingNoteGetFrequency(note);
91 92
92 error=s->Phone.Functions->PlayTone(s,Hz,5,first); 93 error=s->Phone.Functions->PlayTone(s,Hz,5,first);
93 if (error!=ERR_NONE) return error; 94 if (error!=ERR_NONE) return error;
94 95
95 duration = GSM_RingNoteGetFullDuration(note); 96 duration = GSM_RingNoteGetFullDuration(note);
96 97
97 /* Is it correct ? Experimental values here */ 98 /* Is it correct ? Experimental values here */
98 switch (note.Style) { 99 switch (note.Style) {
99 case StaccatoStyle: 100 case StaccatoStyle:
100 my_sleep (7500); 101 my_sleep (7500);
101 error=s->Phone.Functions->PlayTone(s,0,0,false); 102 error=s->Phone.Functions->PlayTone(s,0,0,false);
102 if (error != ERR_NONE) return error; 103 if (error != ERR_NONE) return error;
103 my_sleep ((1400000/note.Tempo*duration)-(7500)); 104 my_sleep ((1400000/note.Tempo*duration)-(7500));
104 break; 105 break;
105 case ContinuousStyle: 106 case ContinuousStyle:
106 my_sleep (1400000/note.Tempo*duration); 107 my_sleep (1400000/note.Tempo*duration);
107 break; 108 break;
108 case NaturalStyle: 109 case NaturalStyle:
109 my_sleep (1400000/note.Tempo*duration-50); 110 my_sleep (1400000/note.Tempo*duration-50);
110 error=s->Phone.Functions->PlayTone(s,0,0,false); 111 error=s->Phone.Functions->PlayTone(s,0,0,false);
111 if (error != ERR_NONE) return error; 112 if (error != ERR_NONE) return error;
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
@@ -153,69 +153,75 @@ GSM_Phone_Functions MROUTERGENPhone = {
153 NOTSUPPORTED, /* AnswerCall */ 153 NOTSUPPORTED, /* AnswerCall */
154 NOTSUPPORTED, /* CancelCall */ 154 NOTSUPPORTED, /* CancelCall */
155 NOTSUPPORTED, /* HoldCall */ 155 NOTSUPPORTED, /* HoldCall */
156 NOTSUPPORTED, /* UnholdCall */ 156 NOTSUPPORTED, /* UnholdCall */
157 NOTSUPPORTED, /* ConferenceCall */ 157 NOTSUPPORTED, /* ConferenceCall */
158 NOTSUPPORTED, /* SplitCall */ 158 NOTSUPPORTED, /* SplitCall */
159 NOTSUPPORTED, /* TransferCall */ 159 NOTSUPPORTED, /* TransferCall */
160 NOTSUPPORTED, /* SwitchCall */ 160 NOTSUPPORTED, /* SwitchCall */
161 NOTSUPPORTED, /* GetCallDivert */ 161 NOTSUPPORTED, /* GetCallDivert */
162 NOTSUPPORTED, /* SetCallDivert */ 162 NOTSUPPORTED, /* SetCallDivert */
163 NOTSUPPORTED, /* CancelAllDiverts*/ 163 NOTSUPPORTED, /* CancelAllDiverts*/
164 NOTSUPPORTED, /* SetIncomingCall */ 164 NOTSUPPORTED, /* SetIncomingCall */
165 NOTSUPPORTED, /* SetIncomingUSSD */ 165 NOTSUPPORTED, /* SetIncomingUSSD */
166 NOTSUPPORTED, /* SendDTMF */ 166 NOTSUPPORTED, /* SendDTMF */
167 NOTSUPPORTED, /* GetRingtone */ 167 NOTSUPPORTED, /* GetRingtone */
168 NOTSUPPORTED, /* SetRingtone */ 168 NOTSUPPORTED, /* SetRingtone */
169 NOTSUPPORTED, /* GetRingtonesInfo*/ 169 NOTSUPPORTED, /* GetRingtonesInfo*/
170 NOTSUPPORTED, /* DeleteUserRingtones*/ 170 NOTSUPPORTED, /* DeleteUserRingtones*/
171 NOTSUPPORTED, /* PlayTone */ 171 NOTSUPPORTED, /* PlayTone */
172 NOTSUPPORTED, /* GetWAPBookmark */ 172 NOTSUPPORTED, /* GetWAPBookmark */
173 NOTSUPPORTED, /* SetWAPBookmark */ 173 NOTSUPPORTED, /* SetWAPBookmark */
174 NOTSUPPORTED, /* DeleteWAPBookmark */ 174 NOTSUPPORTED, /* DeleteWAPBookmark */
175 NOTSUPPORTED, /* GetWAPSettings */ 175 NOTSUPPORTED, /* GetWAPSettings */
176 NOTSUPPORTED, /* SetWAPSettings */ 176 NOTSUPPORTED, /* SetWAPSettings */
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,54 +1,63 @@
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
31 buffer2[2] = FBUS2_DEVICE_PC; //source 40 buffer2[2] = FBUS2_DEVICE_PC; //source
32 buffer2[3]= MsgType; 41 buffer2[3]= MsgType;
33 buffer2[4]= MsgLength / 256; 42 buffer2[4]= MsgLength / 256;
34 buffer2[5]= MsgLength % 256; 43 buffer2[5]= MsgLength % 256;
35 44
36 memcpy(buffer2 + 6, MsgBuffer, MsgLength); 45 memcpy(buffer2 + 6, MsgBuffer, MsgLength);
37 len = MsgLength + 6; 46 len = MsgLength + 6;
38 47
39 /* Odd messages require additional 0x00 byte */ 48 /* Odd messages require additional 0x00 byte */
40 if (MsgLength % 2) buffer2[len++] = 0x00; 49 if (MsgLength % 2) buffer2[len++] = 0x00;
41 50
42 checksum = 0; 51 checksum = 0;
43 for (i = 0; i < len; i+=2) checksum ^= buffer2[i]; 52 for (i = 0; i < len; i+=2) checksum ^= buffer2[i];
44 buffer2[len++] = checksum; 53 buffer2[len++] = checksum;
45 54
46 checksum = 0; 55 checksum = 0;
47 for (i = 1; i < len; i+=2) checksum ^= buffer2[i]; 56 for (i = 1; i < len; i+=2) checksum ^= buffer2[i];
48 buffer2[len++] = checksum; 57 buffer2[len++] = checksum;
49 58
50 /* Sending to phone */ 59 /* Sending to phone */
51 sent=s->Device.Functions->WriteDevice(s,buffer2,len); 60 sent=s->Device.Functions->WriteDevice(s,buffer2,len);
52 if (sent!=len) return ERR_DEVICEWRITEERROR; 61 if (sent!=len) return ERR_DEVICEWRITEERROR;
53 62
54 return ERR_NONE; 63 return ERR_NONE;
@@ -100,96 +109,97 @@ static GSM_Error FBUS2_SendAck(GSM_StateMachine *s,
100 buffer2[1] = MsgSequence; 109 buffer2[1] = MsgSequence;
101 110
102 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || 111 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL ||
103 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { 112 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) {
104 smprintf(s,"[Sending Ack of type %02x, seq %x]\n",buffer2[0],buffer2[1]); 113 smprintf(s,"[Sending Ack of type %02x, seq %x]\n",buffer2[0],buffer2[1]);
105 } 114 }
106 115
107 /* Sending to phone */ 116 /* Sending to phone */
108 return FBUS2_WriteFrame(s, buffer2, 2, FBUS2_ACK_BYTE); 117 return FBUS2_WriteFrame(s, buffer2, 2, FBUS2_ACK_BYTE);
109} 118}
110 119
111static GSM_Error FBUS2_StateMachine(GSM_StateMachine *s, unsigned char rx_char) 120static GSM_Error FBUS2_StateMachine(GSM_StateMachine *s, unsigned char rx_char)
112{ 121{
113 GSM_Protocol_FBUS2Data *d = &s->Protocol.Data.FBUS2; 122 GSM_Protocol_FBUS2Data *d = &s->Protocol.Data.FBUS2;
114 unsigned char frm_num, seq_num; 123 unsigned char frm_num, seq_num;
115 bool correct = false; 124 bool correct = false;
116 125
117 /* XOR the byte with the earlier checksum */ 126 /* XOR the byte with the earlier checksum */
118 d->Msg.CheckSum[d->Msg.Count & 1] ^= rx_char; 127 d->Msg.CheckSum[d->Msg.Count & 1] ^= rx_char;
119 128
120 if (d->MsgRXState == RX_GetMessage) { 129 if (d->MsgRXState == RX_GetMessage) {
121 d->Msg.Buffer[d->Msg.Count] = rx_char; 130 d->Msg.Buffer[d->Msg.Count] = rx_char;
122 d->Msg.Count++; 131 d->Msg.Count++;
123 132
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;
172 182
173 d->MsgRXState = RX_Sync; 183 d->MsgRXState = RX_Sync;
174 return ERR_NONE; 184 return ERR_NONE;
175 } 185 }
176 186
177 if ((seq_num & 0x40) != 0x40 && d->Msg.Type != d->MultiMsg.Type) { 187 if ((seq_num & 0x40) != 0x40 && d->Msg.Type != d->MultiMsg.Type) {
178 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR || 188 if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR ||
179 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) { 189 s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) {
180 smprintf(s, "[ERROR: Multiframe msg in multiframe msg]\n"); 190 smprintf(s, "[ERROR: Multiframe msg in multiframe msg]\n");
181 } 191 }
182 192
183 free(d->Msg.Buffer); 193 free(d->Msg.Buffer);
184 d->Msg.Length = 0; 194 d->Msg.Length = 0;
185 d->Msg.Buffer = NULL; 195 d->Msg.Buffer = NULL;
186 196
187 d->MsgRXState = RX_Sync; 197 d->MsgRXState = RX_Sync;
188 return ERR_NONE; 198 return ERR_NONE;
189 } 199 }
190 200
191 if (d->MultiMsg.BufferUsed < d->MultiMsg.Length+d->Msg.Length-2) { 201 if (d->MultiMsg.BufferUsed < d->MultiMsg.Length+d->Msg.Length-2) {
192 d->MultiMsg.BufferUsed = d->MultiMsg.Length+d->Msg.Length-2; 202 d->MultiMsg.BufferUsed = d->MultiMsg.Length+d->Msg.Length-2;
193 d->MultiMsg.Buffer = (unsigned char *)realloc(d->MultiMsg.Buffer,d->MultiMsg.BufferUsed); 203 d->MultiMsg.Buffer = (unsigned char *)realloc(d->MultiMsg.Buffer,d->MultiMsg.BufferUsed);
194 } 204 }
195 memcpy(d->MultiMsg.Buffer+d->MultiMsg.Length,d->Msg.Buffer,d->Msg.Length-2); 205 memcpy(d->MultiMsg.Buffer+d->MultiMsg.Length,d->Msg.Buffer,d->Msg.Length-2);
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,42 +1,51 @@
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
31#endif 40#endif
32#if defined(GSM_ENABLE_BLUEFBUS2) 41#if defined(GSM_ENABLE_BLUEFBUS2)
33# ifndef GSM_USED_BLUETOOTHDEVICE 42# ifndef GSM_USED_BLUETOOTHDEVICE
34# define GSM_USED_BLUETOOTHDEVICE 43# define GSM_USED_BLUETOOTHDEVICE
35# endif 44# endif
36#endif 45#endif
37 46
38#endif 47#endif
39 48
40/* How should editor hadle tabs in this file? Add editor commands here. 49/* How should editor hadle tabs in this file? Add editor commands here.
41 * vim: noexpandtab sw=8 ts=8 sts=8: 50 * vim: noexpandtab sw=8 ts=8 sts=8:
42 */ 51 */
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,53 +1,62 @@
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,
30 buffer2[1] = PHONET_DEVICE_PHONE; //destination 39 buffer2[1] = PHONET_DEVICE_PHONE; //destination
31 buffer2[2] = PHONET_DEVICE_PC; //source 40 buffer2[2] = PHONET_DEVICE_PC; //source
32 41
33 if (s->ConnectionType==GCT_PHONETBLUE || s->ConnectionType==GCT_BLUEPHONET) { 42 if (s->ConnectionType==GCT_PHONETBLUE || s->ConnectionType==GCT_BLUEPHONET) {
34 buffer2[0] = PHONET_BLUE_FRAME_ID; 43 buffer2[0] = PHONET_BLUE_FRAME_ID;
35 buffer2[1] = PHONET_DEVICE_PHONE;//destination 44 buffer2[1] = PHONET_DEVICE_PHONE;//destination
36 buffer2[2] = PHONET_BLUE_DEVICE_PC;//source 45 buffer2[2] = PHONET_BLUE_DEVICE_PC;//source
37 } 46 }
38 47
39 buffer2[3] = MsgType; 48 buffer2[3] = MsgType;
40 buffer2[4] = MsgLength / 256; 49 buffer2[4] = MsgLength / 256;
41 buffer2[5] = MsgLength % 256; 50 buffer2[5] = MsgLength % 256;
42 51
43 memcpy(buffer2 + 6, MsgBuffer, MsgLength); 52 memcpy(buffer2 + 6, MsgBuffer, MsgLength);
44 53
45 GSM_DumpMessageLevel2(s, buffer2+6, MsgLength, MsgType); 54 GSM_DumpMessageLevel2(s, buffer2+6, MsgLength, MsgType);
46 55
47 /* Sending to phone */ 56 /* Sending to phone */
48 sent = s->Device.Functions->WriteDevice(s,buffer2,MsgLength+6); 57 sent = s->Device.Functions->WriteDevice(s,buffer2,MsgLength+6);
49 58
50 free(buffer2); 59 free(buffer2);
51 60
52 if (sent!=MsgLength+6) return ERR_DEVICEWRITEERROR; 61 if (sent!=MsgLength+6) return ERR_DEVICEWRITEERROR;
53 return ERR_NONE; 62 return ERR_NONE;
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,38 +1,47 @@
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
30# define GSM_USED_BLUETOOTHDEVICE 39# define GSM_USED_BLUETOOTHDEVICE
31# endif 40# endif
32#endif 41#endif
33 42
34#endif 43#endif
35 44
36/* How should editor hadle tabs in this file? Add editor commands here. 45/* How should editor hadle tabs in this file? Add editor commands here.
37 * vim: noexpandtab sw=8 ts=8 sts=8: 46 * vim: noexpandtab sw=8 ts=8 sts=8:
38 */ 47 */
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
@@ -19,55 +19,55 @@
19 #define GSM_BACKUP_MAX_CALLER 6 19 #define GSM_BACKUP_MAX_CALLER 6
20 #define GSM_BACKUP_MAX_SMSC 10 20 #define GSM_BACKUP_MAX_SMSC 10
21 #define GSM_BACKUP_MAX_WAPBOOKMARK40 21 #define GSM_BACKUP_MAX_WAPBOOKMARK40
22 #define GSM_BACKUP_MAX_WAPSETTINGS30 22 #define GSM_BACKUP_MAX_WAPSETTINGS30
23 #define GSM_BACKUP_MAX_MMSSETTINGS30 23 #define GSM_BACKUP_MAX_MMSSETTINGS30
24 #define GSM_BACKUP_MAX_SYNCMLSETTINGS10 24 #define GSM_BACKUP_MAX_SYNCMLSETTINGS10
25 #define GSM_BACKUP_MAX_CHATSETTINGS10 25 #define GSM_BACKUP_MAX_CHATSETTINGS10
26 #define GSM_BACKUP_MAX_RINGTONES30 26 #define GSM_BACKUP_MAX_RINGTONES30
27 #define GSM_BACKUP_MAX_PROFILES 10 27 #define GSM_BACKUP_MAX_PROFILES 10
28 #define GSM_BACKUP_MAX_FMSTATIONS20 28 #define GSM_BACKUP_MAX_FMSTATIONS20
29 #define GSM_BACKUP_MAX_GPRSPOINT10 29 #define GSM_BACKUP_MAX_GPRSPOINT10
30 #define GSM_BACKUP_MAX_NOTE 10/* FIXME */ 30 #define GSM_BACKUP_MAX_NOTE 10/* FIXME */
31 31
32typedef struct { 32typedef struct {
33 char IMEI [MAX_IMEI_LENGTH]; 33 char IMEI [MAX_IMEI_LENGTH];
34 char Model [MAX_MODEL_LENGTH+MAX_VERSION_LENGTH]; 34 char Model [MAX_MODEL_LENGTH+MAX_VERSION_LENGTH];
35 char Creator [80]; 35 char Creator [80];
36 GSM_DateTime DateTime; 36 GSM_DateTime DateTime;
37 bool DateTimeAvailable; 37 bool DateTimeAvailable;
38 char MD5Original[100]; 38 char MD5Original[100];
39 char MD5Calculated[100]; 39 char MD5Calculated[100];
40 GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1]; 40 GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1];
41 GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1]; 41 GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1];
42 GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1]; 42 GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1];
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
@@ -2951,159 +2951,163 @@ static void ReadSMSBackupEntry(INI_Section *file_info, char *section, GSM_SMSMes
2951 } 2951 }
2952} 2952}
2953 2953
2954static GSM_Error GSM_ReadSMSBackupTextFile(char *FileName, GSM_SMS_Backup *backup) 2954static GSM_Error GSM_ReadSMSBackupTextFile(char *FileName, GSM_SMS_Backup *backup)
2955{ 2955{
2956 INI_Section*file_info, *h; 2956 INI_Section*file_info, *h;
2957 char *readvalue; 2957 char *readvalue;
2958 int num; 2958 int num;
2959 2959
2960 backup->SMS[0] = NULL; 2960 backup->SMS[0] = NULL;
2961 2961
2962 file_info = INI_ReadFile(FileName, false); 2962 file_info = INI_ReadFile(FileName, false);
2963 2963
2964 num = 0; 2964 num = 0;
2965 for (h = file_info; h != NULL; h = h->Next) { 2965 for (h = file_info; h != NULL; h = h->Next) {
2966 if (mystrncasecmp("SMSBackup", h->SectionName, 9)) { 2966 if (mystrncasecmp("SMSBackup", h->SectionName, 9)) {
2967 readvalue = ReadCFGText(file_info, h->SectionName, "Number", false); 2967 readvalue = ReadCFGText(file_info, h->SectionName, "Number", false);
2968 if (readvalue==NULL) break; 2968 if (readvalue==NULL) break;
2969 if (num < GSM_BACKUP_MAX_SMS) { 2969 if (num < GSM_BACKUP_MAX_SMS) {
2970 backup->SMS[num] = malloc(sizeof(GSM_SMSMessage)); 2970 backup->SMS[num] = malloc(sizeof(GSM_SMSMessage));
2971 if (backup->SMS[num] == NULL) return ERR_MOREMEMORY; 2971 if (backup->SMS[num] == NULL) return ERR_MOREMEMORY;
2972 backup->SMS[num + 1] = NULL; 2972 backup->SMS[num + 1] = NULL;
2973 } else { 2973 } else {
2974 dbgprintf("Increase GSM_BACKUP_MAX_SMS\n"); 2974 dbgprintf("Increase GSM_BACKUP_MAX_SMS\n");
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) {
3032 fprintf(file,"\n#"); 3036 fprintf(file,"\n#");
3033 current = 0; 3037 current = 0;
3034 } 3038 }
3035 } 3039 }
3036 } 3040 }
3037 fprintf(file,"\n"); 3041 fprintf(file,"\n");
3038 break; 3042 break;
3039 default: 3043 default:
3040 break; 3044 break;
3041 } 3045 }
3042 if (backup->SMS[i]->PDU == SMS_Deliver) { 3046 if (backup->SMS[i]->PDU == SMS_Deliver) {
3043 SaveBackupText(file, "SMSC", backup->SMS[i]->SMSC.Number, false); 3047 SaveBackupText(file, "SMSC", backup->SMS[i]->SMSC.Number, false);
3044 if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"SMSCReply = true\n"); 3048 if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"SMSCReply = true\n");
3045 fprintf(file,"Sent"); 3049 fprintf(file,"Sent");
3046 SaveVCalDateTime(file,&backup->SMS[i]->DateTime, false); 3050 SaveVCalDateTime(file,&backup->SMS[i]->DateTime, false);
3047 } 3051 }
3048 fprintf(file,"State = "); 3052 fprintf(file,"State = ");
3049 switch (backup->SMS[i]->State) { 3053 switch (backup->SMS[i]->State) {
3050 case SMS_UnRead : fprintf(file,"UnRead\n");break; 3054 case SMS_UnRead : fprintf(file,"UnRead\n");break;
3051 case SMS_Read : fprintf(file,"Read\n");break; 3055 case SMS_Read : fprintf(file,"Read\n");break;
3052 case SMS_Sent : fprintf(file,"Sent\n");break; 3056 case SMS_Sent : fprintf(file,"Sent\n");break;
3053 case SMS_UnSent : fprintf(file,"UnSent\n");break; 3057 case SMS_UnSent : fprintf(file,"UnSent\n");break;
3054 } 3058 }
3055 SaveBackupText(file, "Number", backup->SMS[i]->Number, false); 3059 SaveBackupText(file, "Number", backup->SMS[i]->Number, false);
3056 SaveBackupText(file, "Name", backup->SMS[i]->Name, false); 3060 SaveBackupText(file, "Name", backup->SMS[i]->Name, false);
3057 if (backup->SMS[i]->UDH.Type != UDH_NoUDH) { 3061 if (backup->SMS[i]->UDH.Type != UDH_NoUDH) {
3058 EncodeHexBin(buffer,backup->SMS[i]->UDH.Text,backup->SMS[i]->UDH.Length); 3062 EncodeHexBin(buffer,backup->SMS[i]->UDH.Text,backup->SMS[i]->UDH.Length);
3059 fprintf(file,"UDH = %s\n",buffer); 3063 fprintf(file,"UDH = %s\n",buffer);
3060 } 3064 }
3061 switch (backup->SMS[i]->Coding) { 3065 switch (backup->SMS[i]->Coding) {
3062 case SMS_Coding_Unicode: 3066 case SMS_Coding_Unicode:
3063 case SMS_Coding_Default: 3067 case SMS_Coding_Default:
3064 EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length*2); 3068 EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length*2);
3065 break; 3069 break;
3066 default: 3070 default:
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
@@ -126,79 +126,79 @@ typedef struct {
126 unsigned char Frame[50000]; 126 unsigned char Frame[50000];
127 int Length; 127 int Length;
128} GSM_NokiaBinaryRingtone; 128} GSM_NokiaBinaryRingtone;
129 129
130typedef struct { 130typedef struct {
131 unsigned char *Buffer; 131 unsigned char *Buffer;
132 int Length; 132 int Length;
133} GSM_BinaryTone; 133} GSM_BinaryTone;
134 134
135typedef enum { 135typedef enum {
136 RING_NOTETONE = 1, 136 RING_NOTETONE = 1,
137 RING_NOKIABINARY, 137 RING_NOKIABINARY,
138 RING_MIDI, 138 RING_MIDI,
139 RING_MMF 139 RING_MMF
140} GSM_RingtoneFormat; 140} GSM_RingtoneFormat;
141 141
142/** 142/**
143 * Structure for saving various ringtones formats 143 * Structure for saving various ringtones formats
144 */ 144 */
145typedef struct { 145typedef struct {
146 /** 146 /**
147 * Ringtone saved in one of three formats 147 * Ringtone saved in one of three formats
148 */ 148 */
149 GSM_NokiaBinaryRingtone NokiaBinary; 149 GSM_NokiaBinaryRingtone NokiaBinary;
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);
199 199
200#endif 200#endif
201 201
202/* How should editor hadle tabs in this file? Add editor commands here. 202/* How should editor hadle tabs in this file? Add editor commands here.
203 * vim: noexpandtab sw=8 ts=8 sts=8: 203 * vim: noexpandtab sw=8 ts=8 sts=8:
204 */ 204 */
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c
index 684e67c..4c6486d 100644
--- a/gammu/emb/gammu/gammu.c
+++ b/gammu/emb/gammu/gammu.c
@@ -390,97 +390,97 @@ static void GetAlarm(int argc, char *argv[])
390 390
391 GSM_Init(true); 391 GSM_Init(true);
392 392
393 alarm.Location = 1; 393 alarm.Location = 1;
394 error=Phone->GetAlarm(&s, &alarm); 394 error=Phone->GetAlarm(&s, &alarm);
395 switch (error) { 395 switch (error) {
396 case ERR_EMPTY: 396 case ERR_EMPTY:
397 printmsg("Alarm not set in phone\n"); 397 printmsg("Alarm not set in phone\n");
398 break; 398 break;
399 case ERR_NONE: 399 case ERR_NONE:
400 if (alarm.Repeating) { 400 if (alarm.Repeating) {
401 printmsg("Date: %s\n","Every day"); 401 printmsg("Date: %s\n","Every day");
402 } else { 402 } else {
403 printmsg("Date: %s\n",OSDate(alarm.DateTime)); 403 printmsg("Date: %s\n",OSDate(alarm.DateTime));
404 } 404 }
405 printmsg("Time: %02d:%02d\n",alarm.DateTime.Hour, alarm.DateTime.Minute); 405 printmsg("Time: %02d:%02d\n",alarm.DateTime.Hour, alarm.DateTime.Minute);
406 if (alarm.Text[0] != 0 || alarm.Text[1] != 0) { 406 if (alarm.Text[0] != 0 || alarm.Text[1] != 0) {
407 printmsg("Text: \"%s\"\n", DecodeUnicodeConsole(alarm.Text)); 407 printmsg("Text: \"%s\"\n", DecodeUnicodeConsole(alarm.Text));
408 } 408 }
409 break; 409 break;
410 default: 410 default:
411 Print_Error(error); 411 Print_Error(error);
412 } 412 }
413 413
414 GSM_Terminate(); 414 GSM_Terminate();
415} 415}
416 416
417static void SetAlarm(int argc, char *argv[]) 417static void SetAlarm(int argc, char *argv[])
418{ 418{
419 GSM_Alarm alarm; 419 GSM_Alarm alarm;
420 420
421 alarm.DateTime.Hour = atoi(argv[2]); 421 alarm.DateTime.Hour = atoi(argv[2]);
422 alarm.DateTime.Minute = atoi(argv[3]); 422 alarm.DateTime.Minute = atoi(argv[3]);
423 alarm.DateTime.Second = 0; 423 alarm.DateTime.Second = 0;
424 alarm.Location = 1; 424 alarm.Location = 1;
425 alarm.Repeating = true; 425 alarm.Repeating = true;
426 alarm.Text[0] = 0; 426 alarm.Text[0] = 0;
427 alarm.Text[1] = 0; 427 alarm.Text[1] = 0;
428 428
429 GSM_Init(true); 429 GSM_Init(true);
430 430
431 error=Phone->SetAlarm(&s, &alarm); 431 error=Phone->SetAlarm(&s, &alarm);
432 Print_Error(error); 432 Print_Error(error);
433 433
434 GSM_Terminate(); 434 GSM_Terminate();
435} 435}
436 436
437 GSM_Bitmap caller[5]; 437 GSM_Bitmap caller[5];
438 GSM_AllRingtonesInfo Info; 438 GSM_AllRingtonesInfo Info = {0, NULL};
439 bool callerinit[5] = {false, false, false, false, false}; 439 bool callerinit[5] = {false, false, false, false, false};
440 bool ringinit = false; 440 bool ringinit = false;
441 441
442static void PrintMemoryEntry(GSM_MemoryEntry *entry) 442static void PrintMemoryEntry(GSM_MemoryEntry *entry)
443{ 443{
444 GSM_Category Category; 444 GSM_Category Category;
445 bool unknown; 445 bool unknown;
446 int z; 446 int z;
447 447
448 for (i=0;i<entry->EntriesNum;i++) { 448 for (i=0;i<entry->EntriesNum;i++) {
449 unknown = false; 449 unknown = false;
450 switch (entry->Entries[i].EntryType) { 450 switch (entry->Entries[i].EntryType) {
451 case PBK_Date: 451 case PBK_Date:
452 printmsg("Date and time : %s\n",OSDateTime(entry->Entries[i].Date,false)); 452 printmsg("Date and time : %s\n",OSDateTime(entry->Entries[i].Date,false));
453 continue; 453 continue;
454 case PBK_Category: 454 case PBK_Category:
455 Category.Location = entry->Entries[i].Number; 455 Category.Location = entry->Entries[i].Number;
456 Category.Type = Category_Phonebook; 456 Category.Type = Category_Phonebook;
457 error=Phone->GetCategory(&s, &Category); 457 error=Phone->GetCategory(&s, &Category);
458 if (error == ERR_NONE) { 458 if (error == ERR_NONE) {
459 printmsg("Category : \"%s\" (%i)\n", DecodeUnicodeConsole(Category.Name), entry->Entries[i].Number); 459 printmsg("Category : \"%s\" (%i)\n", DecodeUnicodeConsole(Category.Name), entry->Entries[i].Number);
460 } else { 460 } else {
461 printmsg("Category : %i\n", entry->Entries[i].Number); 461 printmsg("Category : %i\n", entry->Entries[i].Number);
462 } 462 }
463 continue; 463 continue;
464 case PBK_Private: 464 case PBK_Private:
465 printmsg("Private : %s\n", entry->Entries[i].Number == 1 ? "Yes" : "No"); 465 printmsg("Private : %s\n", entry->Entries[i].Number == 1 ? "Yes" : "No");
466 continue; 466 continue;
467 case PBK_Number_General : printmsg("General number "); break; 467 case PBK_Number_General : printmsg("General number "); break;
468 case PBK_Number_Mobile : printmsg("Mobile number "); break; 468 case PBK_Number_Mobile : printmsg("Mobile number "); break;
469 case PBK_Number_Work : printmsg("Work number "); break; 469 case PBK_Number_Work : printmsg("Work number "); break;
470 case PBK_Number_Fax : printmsg("Fax number "); break; 470 case PBK_Number_Fax : printmsg("Fax number "); break;
471 case PBK_Number_Home : printmsg("Home number "); break; 471 case PBK_Number_Home : printmsg("Home number "); break;
472 case PBK_Number_Pager : printmsg("Pager number "); break; 472 case PBK_Number_Pager : printmsg("Pager number "); break;
473 case PBK_Number_Other : printmsg("Other number "); break; 473 case PBK_Number_Other : printmsg("Other number "); break;
474 case PBK_Text_Note : printmsg("Text "); break; 474 case PBK_Text_Note : printmsg("Text "); break;
475 case PBK_Text_Postal : printmsg("Snail address "); break; 475 case PBK_Text_Postal : printmsg("Snail address "); break;
476 case PBK_Text_Email : printmsg("Email address 1 "); break; 476 case PBK_Text_Email : printmsg("Email address 1 "); break;
477 case PBK_Text_Email2 : printmsg("Email address 2 "); break; 477 case PBK_Text_Email2 : printmsg("Email address 2 "); break;
478 case PBK_Text_URL : printmsg("URL address "); break; 478 case PBK_Text_URL : printmsg("URL address "); break;
479 case PBK_Text_Name : printmsg("Name "); break; 479 case PBK_Text_Name : printmsg("Name "); break;
480 case PBK_Text_LastName : printmsg("Last name "); break; 480 case PBK_Text_LastName : printmsg("Last name "); break;
481 case PBK_Text_FirstName : printmsg("First name "); break; 481 case PBK_Text_FirstName : printmsg("First name "); break;
482 case PBK_Text_Company : printmsg("Company "); break; 482 case PBK_Text_Company : printmsg("Company "); break;
483 case PBK_Text_JobTitle : printmsg("Job title "); break; 483 case PBK_Text_JobTitle : printmsg("Job title "); break;
484 case PBK_Text_StreetAddress : printmsg("Street address "); break; 484 case PBK_Text_StreetAddress : printmsg("Street address "); break;
485 case PBK_Text_City : printmsg("City "); break; 485 case PBK_Text_City : printmsg("City "); break;
486 case PBK_Text_State : printmsg("State "); break; 486 case PBK_Text_State : printmsg("State "); break;
@@ -519,165 +519,173 @@ static void PrintMemoryEntry(GSM_MemoryEntry *entry)
519 } 519 }
520 } 520 }
521 } else { 521 } else {
522 printmsg("Ringtone ID : %i\n",entry->Entries[i].Number); 522 printmsg("Ringtone ID : %i\n",entry->Entries[i].Number);
523 } 523 }
524 break; 524 break;
525 case PBK_PictureID : 525 case PBK_PictureID :
526 unknown = true; 526 unknown = true;
527 printmsg("Picture ID : 0x%x\n",entry->Entries[i].Number); 527 printmsg("Picture ID : 0x%x\n",entry->Entries[i].Number);
528 break; 528 break;
529 default : 529 default :
530 printmsg("UNKNOWN\n"); 530 printmsg("UNKNOWN\n");
531 unknown = true; 531 unknown = true;
532 break; 532 break;
533 } 533 }
534 if (!unknown) printmsg(" : \"%s\"\n", DecodeUnicodeConsole(entry->Entries[i].Text)); 534 if (!unknown) printmsg(" : \"%s\"\n", DecodeUnicodeConsole(entry->Entries[i].Text));
535 } 535 }
536 printf("\n"); 536 printf("\n");
537} 537}
538 538
539static void GetAllMemory(int argc, char *argv[]) 539static void GetAllMemory(int argc, char *argv[])
540{ 540{
541 GSM_MemoryEntry Entry; 541 GSM_MemoryEntry Entry;
542 bool start = true; 542 bool start = true;
543 543
544 signal(SIGINT, interrupt); 544 signal(SIGINT, interrupt);
545 printmsgerr("Press Ctrl+C to break...\n"); 545 printmsgerr("Press Ctrl+C to break...\n");
546 546
547 Entry.MemoryType = 0; 547 Entry.MemoryType = 0;
548 548
549 if (mystrncasecmp(argv[2],"DC",0)) Entry.MemoryType=MEM_DC; 549 if (mystrncasecmp(argv[2],"DC",0)) Entry.MemoryType=MEM_DC;
550 if (mystrncasecmp(argv[2],"ON",0)) Entry.MemoryType=MEM_ON; 550 if (mystrncasecmp(argv[2],"ON",0)) Entry.MemoryType=MEM_ON;
551 if (mystrncasecmp(argv[2],"RC",0)) Entry.MemoryType=MEM_RC; 551 if (mystrncasecmp(argv[2],"RC",0)) Entry.MemoryType=MEM_RC;
552 if (mystrncasecmp(argv[2],"MC",0)) Entry.MemoryType=MEM_MC; 552 if (mystrncasecmp(argv[2],"MC",0)) Entry.MemoryType=MEM_MC;
553 if (mystrncasecmp(argv[2],"ME",0)) Entry.MemoryType=MEM_ME; 553 if (mystrncasecmp(argv[2],"ME",0)) Entry.MemoryType=MEM_ME;
554 if (mystrncasecmp(argv[2],"SM",0)) Entry.MemoryType=MEM_SM; 554 if (mystrncasecmp(argv[2],"SM",0)) Entry.MemoryType=MEM_SM;
555 if (mystrncasecmp(argv[2],"VM",0)) Entry.MemoryType=MEM_VM; 555 if (mystrncasecmp(argv[2],"VM",0)) Entry.MemoryType=MEM_VM;
556 if (mystrncasecmp(argv[2],"FD",0)) Entry.MemoryType=MEM_FD; 556 if (mystrncasecmp(argv[2],"FD",0)) Entry.MemoryType=MEM_FD;
557 if (Entry.MemoryType==0) { 557 if (Entry.MemoryType==0) {
558 printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); 558 printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]);
559 exit (-1); 559 exit (-1);
560 } 560 }
561 561
562 GSM_Init(true); 562 GSM_Init(true);
563 563
564 while (!gshutdown) { 564 while (!gshutdown) {
565 error = Phone->GetNextMemory(&s, &Entry, start); 565 error = Phone->GetNextMemory(&s, &Entry, start);
566 if (error == ERR_EMPTY) break; 566 if (error == ERR_EMPTY) break;
567 if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone);
567 Print_Error(error); 568 Print_Error(error);
568 printmsg("Memory %s, Location %i\n",argv[2],Entry.Location); 569 printmsg("Memory %s, Location %i\n",argv[2],Entry.Location);
569 PrintMemoryEntry(&Entry); 570 PrintMemoryEntry(&Entry);
570 start = false; 571 start = false;
571 } 572 }
572 573
574 if (Info.Ringtone) free(Info.Ringtone);
575
573 GSM_Terminate(); 576 GSM_Terminate();
574} 577}
575 578
576static void GetMemory(int argc, char *argv[]) 579static void GetMemory(int argc, char *argv[])
577{ 580{
578 int j, start, stop, emptynum = 0, fillednum = 0; 581 int j, start, stop, emptynum = 0, fillednum = 0;
579 GSM_MemoryEntry entry; 582 GSM_MemoryEntry entry;
580 bool empty = true; 583 bool empty = true;
581 584
582 entry.MemoryType=0; 585 entry.MemoryType=0;
583 586
584 if (mystrncasecmp(argv[2],"DC",0)) entry.MemoryType=MEM_DC; 587 if (mystrncasecmp(argv[2],"DC",0)) entry.MemoryType=MEM_DC;
585 if (mystrncasecmp(argv[2],"ON",0)) entry.MemoryType=MEM_ON; 588 if (mystrncasecmp(argv[2],"ON",0)) entry.MemoryType=MEM_ON;
586 if (mystrncasecmp(argv[2],"RC",0)) entry.MemoryType=MEM_RC; 589 if (mystrncasecmp(argv[2],"RC",0)) entry.MemoryType=MEM_RC;
587 if (mystrncasecmp(argv[2],"MC",0)) entry.MemoryType=MEM_MC; 590 if (mystrncasecmp(argv[2],"MC",0)) entry.MemoryType=MEM_MC;
588 if (mystrncasecmp(argv[2],"ME",0)) entry.MemoryType=MEM_ME; 591 if (mystrncasecmp(argv[2],"ME",0)) entry.MemoryType=MEM_ME;
589 if (mystrncasecmp(argv[2],"SM",0)) entry.MemoryType=MEM_SM; 592 if (mystrncasecmp(argv[2],"SM",0)) entry.MemoryType=MEM_SM;
590 if (mystrncasecmp(argv[2],"VM",0)) entry.MemoryType=MEM_VM; 593 if (mystrncasecmp(argv[2],"VM",0)) entry.MemoryType=MEM_VM;
591 if (mystrncasecmp(argv[2],"FD",0)) entry.MemoryType=MEM_FD; 594 if (mystrncasecmp(argv[2],"FD",0)) entry.MemoryType=MEM_FD;
592 if (entry.MemoryType==0) { 595 if (entry.MemoryType==0) {
593 printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); 596 printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]);
594 exit (-1); 597 exit (-1);
595 } 598 }
596 599
597 GetStartStop(&start, &stop, 3, argc, argv); 600 GetStartStop(&start, &stop, 3, argc, argv);
598 601
599 if (argc > 5 && strcmp(argv[5],"")) { 602 if (argc > 5 && strcmp(argv[5],"")) {
600 if (mystrncasecmp(argv[5],"-nonempty",0)) { 603 if (mystrncasecmp(argv[5],"-nonempty",0)) {
601 empty = false; 604 empty = false;
602 } else { 605 } else {
603 printmsg("ERROR: unknown parameter \"%s\"\n",argv[5]); 606 printmsg("ERROR: unknown parameter \"%s\"\n",argv[5]);
604 exit (-1); 607 exit (-1);
605 } 608 }
606 } 609 }
607 610
608 GSM_Init(true); 611 GSM_Init(true);
609 612
610 if (!strcmp(s.Phone.Data.ModelInfo->model,"3310")) { 613 if (!strcmp(s.Phone.Data.ModelInfo->model,"3310")) {
611 if (s.Phone.Data.VerNum<=4.06) printmsg("WARNING: you will have null names in entries. Upgrade firmware in phone to higher than 4.06\n"); 614 if (s.Phone.Data.VerNum<=4.06) printmsg("WARNING: you will have null names in entries. Upgrade firmware in phone to higher than 4.06\n");
612 } 615 }
613 616
614 for (j=start;j<=stop;j++) { 617 for (j=start;j<=stop;j++) {
615 if (empty) printmsg("Memory %s, Location %i\n",argv[2],j); 618 if (empty) printmsg("Memory %s, Location %i\n",argv[2],j);
616 619
617 entry.Location=j; 620 entry.Location=j;
618 621
619 error=Phone->GetMemory(&s, &entry); 622 error=Phone->GetMemory(&s, &entry);
620 if (error != ERR_EMPTY) Print_Error(error); 623 if (error != ERR_EMPTY) {
624 if (Info.Ringtone) free(Info.Ringtone);
625 Print_Error(error);
626 }
621 627
622 if (error == ERR_EMPTY) { 628 if (error == ERR_EMPTY) {
623 emptynum++; 629 emptynum++;
624 if (empty) { 630 if (empty) {
625 printmsg("Entry is empty\n"); 631 printmsg("Entry is empty\n");
626 printf("\n"); 632 printf("\n");
627 } 633 }
628 } else { 634 } else {
629 fillednum++; 635 fillednum++;
630 if (!empty) printmsg("Memory %s, Location %i\n",argv[2],j); 636 if (!empty) printmsg("Memory %s, Location %i\n",argv[2],j);
631 PrintMemoryEntry(&entry); 637 PrintMemoryEntry(&entry);
632 } 638 }
633 } 639 }
634 640
635 printmsg("%i entries empty, %i entries filled\n",emptynum,fillednum); 641 printmsg("%i entries empty, %i entries filled\n",emptynum,fillednum);
642
643 if (Info.Ringtone) free(Info.Ringtone);
636 644
637 GSM_Terminate(); 645 GSM_Terminate();
638} 646}
639 647
640#define MemoryLocationToString(x) ( \ 648#define MemoryLocationToString(x) ( \
641 x == MEM_ON ? "ON" : \ 649 x == MEM_ON ? "ON" : \
642 x == MEM_RC ? "RC" : \ 650 x == MEM_RC ? "RC" : \
643 x == MEM_MC ? "MC" : \ 651 x == MEM_MC ? "MC" : \
644 x == MEM_ME ? "ME" : \ 652 x == MEM_ME ? "ME" : \
645 x == MEM_SM ? "SM" : \ 653 x == MEM_SM ? "SM" : \
646 x == MEM_VM ? "VM" : \ 654 x == MEM_VM ? "VM" : \
647 x == MEM_FD ? "FD" : "XX") 655 x == MEM_FD ? "FD" : "XX")
648 656
649static void SearchOneEntry(GSM_MemoryEntry *Entry, unsigned char *Text) 657static void SearchOneEntry(GSM_MemoryEntry *Entry, unsigned char *Text)
650{ 658{
651 int i; 659 int i;
652 660
653 for (i=0;i<Entry->EntriesNum;i++) { 661 for (i=0;i<Entry->EntriesNum;i++) {
654 switch (Entry->Entries[i].EntryType) { 662 switch (Entry->Entries[i].EntryType) {
655 case PBK_Number_General : 663 case PBK_Number_General :
656 case PBK_Number_Mobile : 664 case PBK_Number_Mobile :
657 case PBK_Number_Work : 665 case PBK_Number_Work :
658 case PBK_Number_Fax : 666 case PBK_Number_Fax :
659 case PBK_Number_Home : 667 case PBK_Number_Home :
660 case PBK_Number_Pager : 668 case PBK_Number_Pager :
661 case PBK_Number_Other : 669 case PBK_Number_Other :
662 case PBK_Text_Note : 670 case PBK_Text_Note :
663 case PBK_Text_Postal : 671 case PBK_Text_Postal :
664 case PBK_Text_Email : 672 case PBK_Text_Email :
665 case PBK_Text_Email2 : 673 case PBK_Text_Email2 :
666 case PBK_Text_URL : 674 case PBK_Text_URL :
667 case PBK_Text_Name : 675 case PBK_Text_Name :
668 case PBK_Text_LastName : 676 case PBK_Text_LastName :
669 case PBK_Text_FirstName : 677 case PBK_Text_FirstName :
670 case PBK_Text_Company : 678 case PBK_Text_Company :
671 case PBK_Text_JobTitle : 679 case PBK_Text_JobTitle :
672 case PBK_Text_StreetAddress : 680 case PBK_Text_StreetAddress :
673 case PBK_Text_City : 681 case PBK_Text_City :
674 case PBK_Text_State : 682 case PBK_Text_State :
675 case PBK_Text_Zip : 683 case PBK_Text_Zip :
676 case PBK_Text_Country : 684 case PBK_Text_Country :
677 case PBK_Text_Custom1 : 685 case PBK_Text_Custom1 :
678 case PBK_Text_Custom2 : 686 case PBK_Text_Custom2 :
679 case PBK_Text_Custom3 : 687 case PBK_Text_Custom3 :
680 case PBK_Text_Custom4 : 688 case PBK_Text_Custom4 :
681 case PBK_Caller_Group : 689 case PBK_Caller_Group :
682 if (mywstrstr(Entry->Entries[i].Text, Text) != NULL) { 690 if (mywstrstr(Entry->Entries[i].Text, Text) != NULL) {
683 fprintf(stderr,"\n"); 691 fprintf(stderr,"\n");
@@ -1578,107 +1586,110 @@ static void GetSMSFolders(int argc, char *argv[])
1578 printmsg("%i. \"%30s\"",i+1,DecodeUnicodeConsole(folders.Folder[i].Name)); 1586 printmsg("%i. \"%30s\"",i+1,DecodeUnicodeConsole(folders.Folder[i].Name));
1579 switch(folders.Folder[i].Memory) { 1587 switch(folders.Folder[i].Memory) {
1580 case MEM_SM: printmsg(", SIM memory"); break; 1588 case MEM_SM: printmsg(", SIM memory"); break;
1581 case MEM_ME: printmsg(", phone memory"); break; 1589 case MEM_ME: printmsg(", phone memory"); break;
1582 case MEM_MT: printmsg(", phone or SIM memory"); break; 1590 case MEM_MT: printmsg(", phone or SIM memory"); break;
1583 default : break; 1591 default : break;
1584 } 1592 }
1585 if (folders.Folder[i].InboxFolder) printmsg(", Inbox folder"); 1593 if (folders.Folder[i].InboxFolder) printmsg(", Inbox folder");
1586 printf("\n"); 1594 printf("\n");
1587 } 1595 }
1588 1596
1589 GSM_Terminate(); 1597 GSM_Terminate();
1590} 1598}
1591 1599
1592static void GetRingtone(int argc, char *argv[]) 1600static void GetRingtone(int argc, char *argv[])
1593{ 1601{
1594 GSM_Ringtone ringtone; 1602 GSM_Ringtone ringtone;
1595 bool PhoneRingtone = false; 1603 bool PhoneRingtone = false;
1596 1604
1597 if (mystrncasecmp(argv[1],"--getphoneringtone",0)) PhoneRingtone = true; 1605 if (mystrncasecmp(argv[1],"--getphoneringtone",0)) PhoneRingtone = true;
1598 1606
1599 GetStartStop(&ringtone.Location, NULL, 2, argc, argv); 1607 GetStartStop(&ringtone.Location, NULL, 2, argc, argv);
1600 1608
1601 GSM_Init(true); 1609 GSM_Init(true);
1602 1610
1603 ringtone.Format=0; 1611 ringtone.Format=0;
1604 1612
1605 error=Phone->GetRingtone(&s,&ringtone,PhoneRingtone); 1613 error=Phone->GetRingtone(&s,&ringtone,PhoneRingtone);
1606 Print_Error(error); 1614 Print_Error(error);
1607 1615
1608 switch (ringtone.Format) { 1616 switch (ringtone.Format) {
1609 case RING_NOTETONE : printmsg("Smart Messaging");break; 1617 case RING_NOTETONE : printmsg("Smart Messaging");break;
1610 case RING_NOKIABINARY : printmsg("Nokia binary");break; 1618 case RING_NOKIABINARY : printmsg("Nokia binary");break;
1611 case RING_MIDI : printmsg("MIDI"); break; 1619 case RING_MIDI : printmsg("MIDI"); break;
1612 case RING_MMF : printmsg("SMAF (MMF)");break; 1620 case RING_MMF : printmsg("SMAF (MMF)");break;
1613 } 1621 }
1614 printmsg(" format, ringtone \"%s\"\n",DecodeUnicodeConsole(ringtone.Name)); 1622 printmsg(" format, ringtone \"%s\"\n",DecodeUnicodeConsole(ringtone.Name));
1615 1623
1616 if (argc==4) { 1624 if (argc==4) {
1617 error=GSM_SaveRingtoneFile(argv[3], &ringtone); 1625 error=GSM_SaveRingtoneFile(argv[3], &ringtone);
1618 Print_Error(error); 1626 Print_Error(error);
1619 } 1627 }
1620 1628
1621 GSM_Terminate(); 1629 GSM_Terminate();
1622} 1630}
1623 1631
1624static void GetRingtonesList(int argc, char *argv[]) 1632static void GetRingtonesList(int argc, char *argv[])
1625{ 1633{
1626 GSM_AllRingtonesInfo Info; 1634 GSM_AllRingtonesInfo Info = {0, NULL};
1627 int i; 1635 int i;
1628 1636
1629 GSM_Init(true); 1637 GSM_Init(true);
1630 1638
1631 error=Phone->GetRingtonesInfo(&s,&Info); 1639 error=Phone->GetRingtonesInfo(&s,&Info);
1640 if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone);
1632 Print_Error(error); 1641 Print_Error(error);
1633 1642
1634 GSM_Terminate(); 1643 GSM_Terminate();
1635 1644
1636 for (i=0;i<Info.Number;i++) printmsg("%i. \"%s\"\n",i,DecodeUnicodeConsole(Info.Ringtone[i].Name)); 1645 for (i=0;i<Info.Number;i++) printmsg("%i. \"%s\"\n",i,DecodeUnicodeConsole(Info.Ringtone[i].Name));
1646
1647 if (Info.Ringtone) free(Info.Ringtone);
1637} 1648}
1638 1649
1639static void DialVoice(int argc, char *argv[]) 1650static void DialVoice(int argc, char *argv[])
1640{ 1651{
1641 GSM_CallShowNumber ShowNumber = GSM_CALL_DefaultNumberPresence; 1652 GSM_CallShowNumber ShowNumber = GSM_CALL_DefaultNumberPresence;
1642 1653
1643 if (argc > 3) { 1654 if (argc > 3) {
1644 if (mystrncasecmp(argv[3],"show",0)) { ShowNumber = GSM_CALL_ShowNumber; 1655 if (mystrncasecmp(argv[3],"show",0)) { ShowNumber = GSM_CALL_ShowNumber;
1645 } else if (mystrncasecmp(argv[3],"hide",0)) {ShowNumber = GSM_CALL_HideNumber; 1656 } else if (mystrncasecmp(argv[3],"hide",0)) {ShowNumber = GSM_CALL_HideNumber;
1646 } else { 1657 } else {
1647 printmsg("Unknown parameter (\"%s\")\n",argv[3]); 1658 printmsg("Unknown parameter (\"%s\")\n",argv[3]);
1648 exit(-1); 1659 exit(-1);
1649 } 1660 }
1650 } 1661 }
1651 1662
1652 GSM_Init(true); 1663 GSM_Init(true);
1653 1664
1654 error=Phone->DialVoice(&s, argv[2], ShowNumber); 1665 error=Phone->DialVoice(&s, argv[2], ShowNumber);
1655 Print_Error(error); 1666 Print_Error(error);
1656 1667
1657 GSM_Terminate(); 1668 GSM_Terminate();
1658} 1669}
1659 1670
1660static void CancelCall(int argc, char *argv[]) 1671static void CancelCall(int argc, char *argv[])
1661{ 1672{
1662 GSM_Init(true); 1673 GSM_Init(true);
1663 1674
1664 if (argc>2) { 1675 if (argc>2) {
1665 error=Phone->CancelCall(&s,atoi(argv[2]),false); 1676 error=Phone->CancelCall(&s,atoi(argv[2]),false);
1666 } else { 1677 } else {
1667 error=Phone->CancelCall(&s,0,true); 1678 error=Phone->CancelCall(&s,0,true);
1668 } 1679 }
1669 Print_Error(error); 1680 Print_Error(error);
1670 1681
1671 GSM_Terminate(); 1682 GSM_Terminate();
1672} 1683}
1673 1684
1674static void AnswerCall(int argc, char *argv[]) 1685static void AnswerCall(int argc, char *argv[])
1675{ 1686{
1676 GSM_Init(true); 1687 GSM_Init(true);
1677 1688
1678 if (argc>2) { 1689 if (argc>2) {
1679 error=Phone->AnswerCall(&s,atoi(argv[2]),false); 1690 error=Phone->AnswerCall(&s,atoi(argv[2]),false);
1680 } else { 1691 } else {
1681 error=Phone->AnswerCall(&s,0,true); 1692 error=Phone->AnswerCall(&s,0,true);
1682 } 1693 }
1683 Print_Error(error); 1694 Print_Error(error);
1684 1695
@@ -2132,167 +2143,169 @@ static void DeleteWAPBookmark(int argc, char *argv[])
2132 2143
2133 GetStartStop(&start, &stop, 2, argc, argv); 2144 GetStartStop(&start, &stop, 2, argc, argv);
2134 2145
2135 GSM_Init(true); 2146 GSM_Init(true);
2136 2147
2137 for (i=start;i<=stop;i++) { 2148 for (i=start;i<=stop;i++) {
2138 bookmark.Location=i; 2149 bookmark.Location=i;
2139 error=Phone->DeleteWAPBookmark(&s, &bookmark); 2150 error=Phone->DeleteWAPBookmark(&s, &bookmark);
2140 Print_Error(error); 2151 Print_Error(error);
2141 } 2152 }
2142 2153
2143 GSM_Terminate(); 2154 GSM_Terminate();
2144} 2155}
2145 2156
2146static void GetGPRSPoint(int argc, char *argv[]) 2157static void GetGPRSPoint(int argc, char *argv[])
2147{ 2158{
2148 GSM_GPRSAccessPointpoint; 2159 GSM_GPRSAccessPointpoint;
2149 int start,stop; 2160 int start,stop;
2150 2161
2151 GetStartStop(&start, &stop, 2, argc, argv); 2162 GetStartStop(&start, &stop, 2, argc, argv);
2152 2163
2153 GSM_Init(true); 2164 GSM_Init(true);
2154 2165
2155 for (i=start;i<=stop;i++) { 2166 for (i=start;i<=stop;i++) {
2156 point.Location=i; 2167 point.Location=i;
2157 error=Phone->GetGPRSAccessPoint(&s,&point); 2168 error=Phone->GetGPRSAccessPoint(&s,&point);
2158 if (error != ERR_EMPTY) { 2169 if (error != ERR_EMPTY) {
2159 Print_Error(error); 2170 Print_Error(error);
2160 printmsg("%i. \"%s\"",point.Location,DecodeUnicodeConsole(point.Name)); 2171 printmsg("%i. \"%s\"",point.Location,DecodeUnicodeConsole(point.Name));
2161 } else { 2172 } else {
2162 printmsg("%i. Access point %i",point.Location,point.Location); 2173 printmsg("%i. Access point %i",point.Location,point.Location);
2163 } 2174 }
2164 if (point.Active) printmsg(" (active)"); 2175 if (point.Active) printmsg(" (active)");
2165 if (error != ERR_EMPTY) { 2176 if (error != ERR_EMPTY) {
2166 printmsg("\nAddress : \"%s\"\n\n",DecodeUnicodeConsole(point.URL)); 2177 printmsg("\nAddress : \"%s\"\n\n",DecodeUnicodeConsole(point.URL));
2167 } else { 2178 } else {
2168 printmsg("\n\n"); 2179 printmsg("\n\n");
2169 } 2180 }
2170 } 2181 }
2171 2182
2172 GSM_Terminate(); 2183 GSM_Terminate();
2173} 2184}
2174 2185
2175static void GetBitmap(int argc, char *argv[]) 2186static void GetBitmap(int argc, char *argv[])
2176{ 2187{
2177 GSM_File File; 2188 GSM_File File;
2178 GSM_MultiBitmap MultiBitmap; 2189 GSM_MultiBitmap MultiBitmap;
2179 int location=0; 2190 int location=0;
2180 GSM_AllRingtonesInfo Info; 2191 GSM_AllRingtonesInfo Info = {0, NULL};
2181 2192
2182 if (mystrncasecmp(argv[2],"STARTUP",0)) { 2193 if (mystrncasecmp(argv[2],"STARTUP",0)) {
2183 MultiBitmap.Bitmap[0].Type=GSM_StartupLogo; 2194 MultiBitmap.Bitmap[0].Type=GSM_StartupLogo;
2184 } else if (mystrncasecmp(argv[2],"CALLER",0)) { 2195 } else if (mystrncasecmp(argv[2],"CALLER",0)) {
2185 MultiBitmap.Bitmap[0].Type=GSM_CallerGroupLogo; 2196 MultiBitmap.Bitmap[0].Type=GSM_CallerGroupLogo;
2186 GetStartStop(&location, NULL, 3, argc, argv); 2197 GetStartStop(&location, NULL, 3, argc, argv);
2187 if (location>5) { 2198 if (location>5) {
2188 printmsg("Maximal location for caller logo can be 5\n"); 2199 printmsg("Maximal location for caller logo can be 5\n");
2189 exit (-1); 2200 exit (-1);
2190 } 2201 }
2191 } else if (mystrncasecmp(argv[2],"PICTURE",0)) { 2202 } else if (mystrncasecmp(argv[2],"PICTURE",0)) {
2192 MultiBitmap.Bitmap[0].Type=GSM_PictureImage; 2203 MultiBitmap.Bitmap[0].Type=GSM_PictureImage;
2193 GetStartStop(&location, NULL, 3, argc, argv); 2204 GetStartStop(&location, NULL, 3, argc, argv);
2194 } else if (mystrncasecmp(argv[2],"TEXT",0)) { 2205 } else if (mystrncasecmp(argv[2],"TEXT",0)) {
2195 MultiBitmap.Bitmap[0].Type=GSM_WelcomeNote_Text; 2206 MultiBitmap.Bitmap[0].Type=GSM_WelcomeNote_Text;
2196 } else if (mystrncasecmp(argv[2],"DEALER",0)) { 2207 } else if (mystrncasecmp(argv[2],"DEALER",0)) {
2197 MultiBitmap.Bitmap[0].Type=GSM_DealerNote_Text; 2208 MultiBitmap.Bitmap[0].Type=GSM_DealerNote_Text;
2198 } else if (mystrncasecmp(argv[2],"OPERATOR",0)) { 2209 } else if (mystrncasecmp(argv[2],"OPERATOR",0)) {
2199 MultiBitmap.Bitmap[0].Type=GSM_OperatorLogo; 2210 MultiBitmap.Bitmap[0].Type=GSM_OperatorLogo;
2200 } else { 2211 } else {
2201 printmsg("What type of logo do you want to get (\"%s\") ?\n",argv[2]); 2212 printmsg("What type of logo do you want to get (\"%s\") ?\n",argv[2]);
2202 exit(-1); 2213 exit(-1);
2203 } 2214 }
2204 MultiBitmap.Bitmap[0].Location=location; 2215 MultiBitmap.Bitmap[0].Location=location;
2205 2216
2206 GSM_Init(true); 2217 GSM_Init(true);
2207 2218
2208 error=Phone->GetBitmap(&s,&MultiBitmap.Bitmap[0]); 2219 error=Phone->GetBitmap(&s,&MultiBitmap.Bitmap[0]);
2209 Print_Error(error); 2220 Print_Error(error);
2210 2221
2211 MultiBitmap.Number = 1; 2222 MultiBitmap.Number = 1;
2212 2223
2213 error=ERR_NONE; 2224 error=ERR_NONE;
2214 switch (MultiBitmap.Bitmap[0].Type) { 2225 switch (MultiBitmap.Bitmap[0].Type) {
2215 case GSM_CallerGroupLogo: 2226 case GSM_CallerGroupLogo:
2216 if (!MultiBitmap.Bitmap[0].DefaultBitmap) GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); 2227 if (!MultiBitmap.Bitmap[0].DefaultBitmap) GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
2217 printmsg("Group name : \"%s\"",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); 2228 printmsg("Group name : \"%s\"",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
2218 if (MultiBitmap.Bitmap[0].DefaultName) printmsg(" (default)"); 2229 if (MultiBitmap.Bitmap[0].DefaultName) printmsg(" (default)");
2219 printf("\n"); 2230 printf("\n");
2220 if (MultiBitmap.Bitmap[0].DefaultRingtone) { 2231 if (MultiBitmap.Bitmap[0].DefaultRingtone) {
2221 printmsg("Ringtone : default\n"); 2232 printmsg("Ringtone : default\n");
2222 } else if (MultiBitmap.Bitmap[0].FileSystemRingtone) { 2233 } else if (MultiBitmap.Bitmap[0].FileSystemRingtone) {
2223 sprintf(File.ID_FullName,"%i",MultiBitmap.Bitmap[0].RingtoneID); 2234 sprintf(File.ID_FullName,"%i",MultiBitmap.Bitmap[0].RingtoneID);
2224 2235
2225 File.Buffer = NULL; 2236 File.Buffer = NULL;
2226 File.Used = 0; 2237 File.Used = 0;
2227 2238
2228 error = ERR_NONE; 2239 error = ERR_NONE;
2229 // while (error == ERR_NONE) { 2240 // while (error == ERR_NONE) {
2230 error = Phone->GetFilePart(&s,&File); 2241 error = Phone->GetFilePart(&s,&File);
2231 // } 2242 // }
2232 if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error); 2243 if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error);
2233 error = ERR_NONE; 2244 error = ERR_NONE;
2234 2245
2235 printmsg("Ringtone : \"%s\" (file with ID %i)\n", 2246 printmsg("Ringtone : \"%s\" (file with ID %i)\n",
2236 DecodeUnicodeString(File.Name), 2247 DecodeUnicodeString(File.Name),
2237 MultiBitmap.Bitmap[0].RingtoneID); 2248 MultiBitmap.Bitmap[0].RingtoneID);
2238 } else { 2249 } else {
2239 error = Phone->GetRingtonesInfo(&s,&Info); 2250 error = Phone->GetRingtonesInfo(&s,&Info);
2240 if (error != ERR_NONE) Info.Number = 0; 2251 if (error != ERR_NONE) Info.Number = 0;
2241 error = ERR_NONE; 2252 error = ERR_NONE;
2242 2253
2243 printmsg("Ringtone : "); 2254 printmsg("Ringtone : ");
2244 if (UnicodeLength(GSM_GetRingtoneName(&Info,MultiBitmap.Bitmap[0].RingtoneID))!=0) { 2255 if (UnicodeLength(GSM_GetRingtoneName(&Info,MultiBitmap.Bitmap[0].RingtoneID))!=0) {
2245 printmsg("\"%s\" (ID %i)\n", 2256 printmsg("\"%s\" (ID %i)\n",
2246 DecodeUnicodeConsole(GSM_GetRingtoneName(&Info,MultiBitmap.Bitmap[0].RingtoneID)), 2257 DecodeUnicodeConsole(GSM_GetRingtoneName(&Info,MultiBitmap.Bitmap[0].RingtoneID)),
2247 MultiBitmap.Bitmap[0].RingtoneID); 2258 MultiBitmap.Bitmap[0].RingtoneID);
2248 } else { 2259 } else {
2249 printmsg("ID %i\n",MultiBitmap.Bitmap[0].RingtoneID); 2260 printmsg("ID %i\n",MultiBitmap.Bitmap[0].RingtoneID);
2250 } 2261 }
2262
2263 if (Info.Ringtone) free(Info.Ringtone);
2251 } 2264 }
2252 if (MultiBitmap.Bitmap[0].BitmapEnabled) { 2265 if (MultiBitmap.Bitmap[0].BitmapEnabled) {
2253 printmsg("Bitmap : enabled\n"); 2266 printmsg("Bitmap : enabled\n");
2254 } else { 2267 } else {
2255 printmsg("Bitmap : disabled\n"); 2268 printmsg("Bitmap : disabled\n");
2256 } 2269 }
2257 if (argc>4 && !MultiBitmap.Bitmap[0].DefaultBitmap) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); 2270 if (argc>4 && !MultiBitmap.Bitmap[0].DefaultBitmap) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap);
2258 break; 2271 break;
2259 case GSM_StartupLogo: 2272 case GSM_StartupLogo:
2260 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); 2273 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
2261 if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); 2274 if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap);
2262 break; 2275 break;
2263 case GSM_OperatorLogo: 2276 case GSM_OperatorLogo:
2264 if (strcmp(MultiBitmap.Bitmap[0].NetworkCode,"000 00")!=0) { 2277 if (strcmp(MultiBitmap.Bitmap[0].NetworkCode,"000 00")!=0) {
2265 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); 2278 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
2266 if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); 2279 if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap);
2267 } else { 2280 } else {
2268 printmsg("No operator logo in phone\n"); 2281 printmsg("No operator logo in phone\n");
2269 } 2282 }
2270 break; 2283 break;
2271 case GSM_PictureImage: 2284 case GSM_PictureImage:
2272 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); 2285 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
2273 printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); 2286 printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
2274 printmsg("Sender : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Sender)); 2287 printmsg("Sender : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Sender));
2275 if (MultiBitmap.Bitmap[0].Name) 2288 if (MultiBitmap.Bitmap[0].Name)
2276 printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Name)); 2289 printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Name));
2277 if (argc>4) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); 2290 if (argc>4) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap);
2278 break; 2291 break;
2279 case GSM_WelcomeNote_Text: 2292 case GSM_WelcomeNote_Text:
2280 printmsg("Welcome note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); 2293 printmsg("Welcome note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
2281 break; 2294 break;
2282 case GSM_DealerNote_Text: 2295 case GSM_DealerNote_Text:
2283 printmsg("Dealer note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); 2296 printmsg("Dealer note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
2284 break; 2297 break;
2285 default: 2298 default:
2286 break; 2299 break;
2287 } 2300 }
2288 Print_Error(error); 2301 Print_Error(error);
2289 2302
2290 GSM_Terminate(); 2303 GSM_Terminate();
2291} 2304}
2292 2305
2293static void SetBitmap(int argc, char *argv[]) 2306static void SetBitmap(int argc, char *argv[])
2294{ 2307{
2295 GSM_Bitmap Bitmap, NewBitmap; 2308 GSM_Bitmap Bitmap, NewBitmap;
2296 GSM_MultiBitmap MultiBitmap; 2309 GSM_MultiBitmap MultiBitmap;
2297 GSM_NetworkInfo NetInfo; 2310 GSM_NetworkInfo NetInfo;
2298 bool init = true; 2311 bool init = true;
@@ -4600,96 +4613,97 @@ static void Backup(int argc, char *argv[])
4600 if (error == ERR_NONE || error == ERR_EMPTY) { 4613 if (error == ERR_NONE || error == ERR_EMPTY) {
4601 if (answer_yes(" Backup GPRS access points")) DoBackup = true; 4614 if (answer_yes(" Backup GPRS access points")) DoBackup = true;
4602 } 4615 }
4603 } 4616 }
4604 if (DoBackup) { 4617 if (DoBackup) {
4605 used= 0; 4618 used= 0;
4606 i = 1; 4619 i = 1;
4607 printmsgerr(" Reading: "); 4620 printmsgerr(" Reading: ");
4608 while (error == ERR_NONE || error == ERR_EMPTY) { 4621 while (error == ERR_NONE || error == ERR_EMPTY) {
4609 error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); 4622 error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint);
4610 if (error == ERR_NONE) { 4623 if (error == ERR_NONE) {
4611 if (used < GSM_BACKUP_MAX_GPRSPOINT) { 4624 if (used < GSM_BACKUP_MAX_GPRSPOINT) {
4612 Backup.GPRSPoint[used] = malloc(sizeof(GSM_GPRSAccessPoint)); 4625 Backup.GPRSPoint[used] = malloc(sizeof(GSM_GPRSAccessPoint));
4613 if (Backup.GPRSPoint[used] == NULL) Print_Error(ERR_MOREMEMORY); 4626 if (Backup.GPRSPoint[used] == NULL) Print_Error(ERR_MOREMEMORY);
4614 Backup.GPRSPoint[used + 1] = NULL; 4627 Backup.GPRSPoint[used + 1] = NULL;
4615 } else { 4628 } else {
4616 printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_GPRSPOINT"); 4629 printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_GPRSPOINT");
4617 GSM_Terminate(); 4630 GSM_Terminate();
4618 exit(-1); 4631 exit(-1);
4619 } 4632 }
4620 *Backup.GPRSPoint[used]=GPRSPoint; 4633 *Backup.GPRSPoint[used]=GPRSPoint;
4621 used++; 4634 used++;
4622 } 4635 }
4623 i++; 4636 i++;
4624 GPRSPoint.Location = i; 4637 GPRSPoint.Location = i;
4625 printmsgerr("*"); 4638 printmsgerr("*");
4626 } 4639 }
4627 printmsgerr("\n"); 4640 printmsgerr("\n");
4628 } 4641 }
4629 4642
4630 GSM_Terminate(); 4643 GSM_Terminate();
4631 4644
4632 GSM_SaveBackupFile(argv[2],&Backup, Info.UseUnicode); 4645 GSM_SaveBackupFile(argv[2],&Backup, Info.UseUnicode);
4633 GSM_FreeBackup(&Backup); 4646 GSM_FreeBackup(&Backup);
4634} 4647}
4635 4648
4636static void Restore(int argc, char *argv[]) 4649static void Restore(int argc, char *argv[])
4637{ 4650{
4638 GSM_Backup Backup; 4651 GSM_Backup Backup;
4639 GSM_FMStation FMStation; 4652 GSM_FMStation FMStation;
4640 GSM_DateTime date_time; 4653 GSM_DateTime date_time;
4641 GSM_CalendarEntryCalendar; 4654 GSM_CalendarEntryCalendar;
4642 GSM_Bitmap Bitmap; 4655 GSM_Bitmap Bitmap;
4643 GSM_Ringtone Ringtone; 4656 GSM_Ringtone Ringtone;
4644 GSM_MemoryEntry Pbk; 4657 GSM_MemoryEntry Pbk;
4645 GSM_MemoryStatusMemStatus; 4658 GSM_MemoryStatusMemStatus;
4646 GSM_ToDoEntry ToDo; 4659 GSM_ToDoEntry ToDo;
4647 GSM_ToDoStatus ToDoStatus; 4660 GSM_ToDoStatus ToDoStatus;
4661 GSM_NoteEntry Note;
4648 GSM_Profile Profile; 4662 GSM_Profile Profile;
4649 GSM_MultiWAPSettingsSettings; 4663 GSM_MultiWAPSettingsSettings;
4650 GSM_GPRSAccessPointGPRSPoint; 4664 GSM_GPRSAccessPointGPRSPoint;
4651 GSM_WAPBookmark Bookmark; 4665 GSM_WAPBookmark Bookmark;
4652 int i, used, max = 0; 4666 int i, used, max = 0;
4653 bool Past = true; 4667 bool Past = true;
4654 bool Found, DoRestore; 4668 bool Found, DoRestore;
4655 4669
4656 error=GSM_ReadBackupFile(argv[2],&Backup); 4670 error=GSM_ReadBackupFile(argv[2],&Backup);
4657 if (error!=ERR_NOTIMPLEMENTED) { 4671 if (error!=ERR_NOTIMPLEMENTED) {
4658 Print_Error(error); 4672 Print_Error(error);
4659 } else { 4673 } else {
4660 printmsgerr("WARNING: Some data not read from file. It can be damaged or restoring some settings from this file format not implemented (maybe higher Gammu required ?)\n"); 4674 printmsgerr("WARNING: Some data not read from file. It can be damaged or restoring some settings from this file format not implemented (maybe higher Gammu required ?)\n");
4661 } 4675 }
4662 4676
4663 signal(SIGINT, interrupt); 4677 signal(SIGINT, interrupt);
4664 printmsgerr("Press Ctrl+C to break...\n"); 4678 printmsgerr("Press Ctrl+C to break...\n");
4665 4679
4666 if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); 4680 if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false));
4667 if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); 4681 if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model);
4668 if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); 4682 if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI);
4669 if (Backup.Creator[0]!=0) printmsgerr("File created by : %s\n",Backup.Creator); 4683 if (Backup.Creator[0]!=0) printmsgerr("File created by : %s\n",Backup.Creator);
4670 4684
4671 if (Backup.MD5Calculated[0]!=0) { 4685 if (Backup.MD5Calculated[0]!=0) {
4672 dbgprintf("\"%s\"\n",Backup.MD5Original); 4686 dbgprintf("\"%s\"\n",Backup.MD5Original);
4673 dbgprintf("\"%s\"\n",Backup.MD5Calculated); 4687 dbgprintf("\"%s\"\n",Backup.MD5Calculated);
4674 if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) { 4688 if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) {
4675 if (!answer_yes("Checksum in backup file do not match. Continue")) return; 4689 if (!answer_yes("Checksum in backup file do not match. Continue")) return;
4676 } 4690 }
4677 } 4691 }
4678 4692
4679 GSM_Init(true); 4693 GSM_Init(true);
4680 4694
4681 DoRestore = false; 4695 DoRestore = false;
4682 if (Backup.PhonePhonebook[0] != NULL) { 4696 if (Backup.PhonePhonebook[0] != NULL) {
4683 MemStatus.MemoryType = MEM_ME; 4697 MemStatus.MemoryType = MEM_ME;
4684 error=Phone->GetMemoryStatus(&s, &MemStatus); 4698 error=Phone->GetMemoryStatus(&s, &MemStatus);
4685 if (error==ERR_NONE) { 4699 if (error==ERR_NONE) {
4686 max = 0; 4700 max = 0;
4687 while (Backup.PhonePhonebook[max]!=NULL) max++; 4701 while (Backup.PhonePhonebook[max]!=NULL) max++;
4688 printmsgerr("%i entries in backup file\n",max); 4702 printmsgerr("%i entries in backup file\n",max);
4689 /* LR if (answer_yes("Restore phone phonebook")) */DoRestore = true; 4703 /* LR if (answer_yes("Restore phone phonebook")) */DoRestore = true;
4690 } 4704 }
4691 } 4705 }
4692 if (DoRestore) { 4706 if (DoRestore) {
4693 used = 0; 4707 used = 0;
4694 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { 4708 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) {
4695 Pbk.MemoryType = MEM_ME; 4709 Pbk.MemoryType = MEM_ME;
@@ -4869,96 +4883,132 @@ static void Restore(int argc, char *argv[])
4869 Print_Error(error); 4883 Print_Error(error);
4870 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4884 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4871 if (gshutdown) { 4885 if (gshutdown) {
4872 GSM_Terminate(); 4886 GSM_Terminate();
4873 exit(0); 4887 exit(0);
4874 } 4888 }
4875 } 4889 }
4876 printmsgerr("\n"); 4890 printmsgerr("\n");
4877 } else if (DoRestore) { 4891 } else if (DoRestore) {
4878 /* At first delete entries, that were deleted */ 4892 /* At first delete entries, that were deleted */
4879 used = 0; 4893 used = 0;
4880 error = Phone->GetNextToDo(&s,&ToDo,true); 4894 error = Phone->GetNextToDo(&s,&ToDo,true);
4881 while (error == ERR_NONE) { 4895 while (error == ERR_NONE) {
4882 used++; 4896 used++;
4883 Found = false; 4897 Found = false;
4884 for (i=0;i<max;i++) { 4898 for (i=0;i<max;i++) {
4885 if (Backup.ToDo[i]->Location == ToDo.Location) { 4899 if (Backup.ToDo[i]->Location == ToDo.Location) {
4886 Found = true; 4900 Found = true;
4887 break; 4901 break;
4888 } 4902 }
4889 } 4903 }
4890 if (!Found) { 4904 if (!Found) {
4891 error=Phone->DeleteToDo(&s,&ToDo); 4905 error=Phone->DeleteToDo(&s,&ToDo);
4892 Print_Error(error); 4906 Print_Error(error);
4893 } 4907 }
4894 error = Phone->GetNextToDo(&s,&ToDo,false); 4908 error = Phone->GetNextToDo(&s,&ToDo,false);
4895 printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used); 4909 printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used);
4896 if (gshutdown) { 4910 if (gshutdown) {
4897 GSM_Terminate(); 4911 GSM_Terminate();
4898 exit(0); 4912 exit(0);
4899 } 4913 }
4900 } 4914 }
4901 printmsgerr("\n"); 4915 printmsgerr("\n");
4902 4916
4903 /* Now write modified/new entries */ 4917 /* Now write modified/new entries */
4904 for (i=0;i<max;i++) { 4918 for (i=0;i<max;i++) {
4905 ToDo = *Backup.ToDo[i]; 4919 ToDo = *Backup.ToDo[i];
4906 error = Phone->SetToDo(&s,&ToDo); 4920 error = Phone->SetToDo(&s,&ToDo);
4907 Print_Error(error); 4921 Print_Error(error);
4908 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4922 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4909 if (gshutdown) { 4923 if (gshutdown) {
4910 GSM_Terminate(); 4924 GSM_Terminate();
4911 exit(0); 4925 exit(0);
4912 } 4926 }
4913 } 4927 }
4914 printmsgerr("\n"); 4928 printmsgerr("\n");
4915 } 4929 }
4916 4930
4931 DoRestore = false;
4932 if (Backup.ToDo[0] != NULL) {
4933 error = Phone->GetNotesStatus(&s,&ToDoStatus);
4934 if (error == ERR_NONE) {
4935 max = 0;
4936 while (Backup.Note[max]!=NULL) max++;
4937 printmsgerr("%i entries in backup file\n",max);
4938
4939 if (answer_yes("Restore Notes")) DoRestore = true;
4940 }
4941 }
4942 if (DoRestore) {
4943 printmsgerr("Deleting old Notes: ");
4944 while (1) {
4945 error = Phone->GetNextNote(&s,&Note,true);
4946 if (error != ERR_NONE) break;
4947 error = Phone->DeleteNote(&s,&Note);
4948 Print_Error(error);
4949 printmsgerr("*");
4950 }
4951 printmsgerr("\n");
4952
4953 for (i=0;i<max;i++) {
4954 Note = *Backup.Note[i];
4955 Note.Location = 0;
4956 error=Phone->AddNote(&s,&Note);
4957 Print_Error(error);
4958 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4959 if (gshutdown) {
4960 GSM_Terminate();
4961 exit(0);
4962 }
4963 }
4964 printmsgerr("\n");
4965 }
4966
4917 if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) { 4967 if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) {
4918 max = 0; 4968 max = 0;
4919 while (Backup.SMSC[max]!=NULL) max++; 4969 while (Backup.SMSC[max]!=NULL) max++;
4920 for (i=0;i<max;i++) { 4970 for (i=0;i<max;i++) {
4921 error=Phone->SetSMSC(&s,Backup.SMSC[i]); 4971 error=Phone->SetSMSC(&s,Backup.SMSC[i]);
4922 Print_Error(error); 4972 Print_Error(error);
4923 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4973 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4924 if (gshutdown) { 4974 if (gshutdown) {
4925 GSM_Terminate(); 4975 GSM_Terminate();
4926 exit(0); 4976 exit(0);
4927 } 4977 }
4928 } 4978 }
4929 printmsgerr("\n"); 4979 printmsgerr("\n");
4930 } 4980 }
4931 if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) { 4981 if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) {
4932 error=Phone->SetBitmap(&s,Backup.StartupLogo); 4982 error=Phone->SetBitmap(&s,Backup.StartupLogo);
4933 Print_Error(error); 4983 Print_Error(error);
4934 } 4984 }
4935 if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) { 4985 if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) {
4936 error=Phone->SetBitmap(&s,Backup.OperatorLogo); 4986 error=Phone->SetBitmap(&s,Backup.OperatorLogo);
4937 Print_Error(error); 4987 Print_Error(error);
4938 } 4988 }
4939 DoRestore = false; 4989 DoRestore = false;
4940 if (Backup.WAPBookmark[0] != NULL) { 4990 if (Backup.WAPBookmark[0] != NULL) {
4941 Bookmark.Location = 1; 4991 Bookmark.Location = 1;
4942 error = Phone->GetWAPBookmark(&s,&Bookmark); 4992 error = Phone->GetWAPBookmark(&s,&Bookmark);
4943 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { 4993 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) {
4944 if (answer_yes("Restore WAP bookmarks")) DoRestore = true; 4994 if (answer_yes("Restore WAP bookmarks")) DoRestore = true;
4945 } 4995 }
4946 } 4996 }
4947 if (DoRestore) { 4997 if (DoRestore) {
4948 printmsgerr("Deleting old bookmarks: "); 4998 printmsgerr("Deleting old bookmarks: ");
4949 /* One thing to explain: DCT4 phones seems to have bug here. 4999 /* One thing to explain: DCT4 phones seems to have bug here.
4950 * When delete for example first bookmark, phone change 5000 * When delete for example first bookmark, phone change
4951 * numeration for getting frame, not for deleting. So, we try to 5001 * numeration for getting frame, not for deleting. So, we try to
4952 * get 1'st bookmark. Inside frame is "correct" location. We use 5002 * get 1'st bookmark. Inside frame is "correct" location. We use
4953 * it later 5003 * it later
4954 */ 5004 */
4955 while (error==ERR_NONE) { 5005 while (error==ERR_NONE) {
4956 error = Phone->DeleteWAPBookmark(&s,&Bookmark); 5006 error = Phone->DeleteWAPBookmark(&s,&Bookmark);
4957 Bookmark.Location = 1; 5007 Bookmark.Location = 1;
4958 error = Phone->GetWAPBookmark(&s,&Bookmark); 5008 error = Phone->GetWAPBookmark(&s,&Bookmark);
4959 printmsgerr("*"); 5009 printmsgerr("*");
4960 } 5010 }
4961 printmsgerr("\n"); 5011 printmsgerr("\n");
4962 max = 0; 5012 max = 0;
4963 while (Backup.WAPBookmark[max]!=NULL) max++; 5013 while (Backup.WAPBookmark[max]!=NULL) max++;
4964 for (i=0;i<max;i++) { 5014 for (i=0;i<max;i++) {
@@ -5242,96 +5292,97 @@ static void AddNew(int argc, char *argv[])
5242 while (Backup.ToDo[max]!=NULL) max++; 5292 while (Backup.ToDo[max]!=NULL) max++;
5243 for (i=0;i<max;i++) { 5293 for (i=0;i<max;i++) {
5244 ToDo = *Backup.ToDo[i]; 5294 ToDo = *Backup.ToDo[i];
5245 error = Phone->AddToDo(&s,&ToDo); 5295 error = Phone->AddToDo(&s,&ToDo);
5246 Print_Error(error); 5296 Print_Error(error);
5247 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 5297 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
5248 if (gshutdown) { 5298 if (gshutdown) {
5249 GSM_Terminate(); 5299 GSM_Terminate();
5250 exit(0); 5300 exit(0);
5251 } 5301 }
5252 } 5302 }
5253 printmsgerr("\n"); 5303 printmsgerr("\n");
5254 } 5304 }
5255 } 5305 }
5256 } 5306 }
5257 if (Backup.WAPBookmark[0] != NULL) { 5307 if (Backup.WAPBookmark[0] != NULL) {
5258 Bookmark.Location = 1; 5308 Bookmark.Location = 1;
5259 error = Phone->GetWAPBookmark(&s,&Bookmark); 5309 error = Phone->GetWAPBookmark(&s,&Bookmark);
5260 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { 5310 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) {
5261 if (answer_yes("Add WAP bookmarks")) { 5311 if (answer_yes("Add WAP bookmarks")) {
5262 max = 0; 5312 max = 0;
5263 while (Backup.WAPBookmark[max]!=NULL) max++; 5313 while (Backup.WAPBookmark[max]!=NULL) max++;
5264 for (i=0;i<max;i++) { 5314 for (i=0;i<max;i++) {
5265 Bookmark = *Backup.WAPBookmark[i]; 5315 Bookmark = *Backup.WAPBookmark[i];
5266 Bookmark.Location = 0; 5316 Bookmark.Location = 0;
5267 error=Phone->SetWAPBookmark(&s,&Bookmark); 5317 error=Phone->SetWAPBookmark(&s,&Bookmark);
5268 Print_Error(error); 5318 Print_Error(error);
5269 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 5319 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
5270 if (gshutdown) { 5320 if (gshutdown) {
5271 GSM_Terminate(); 5321 GSM_Terminate();
5272 exit(0); 5322 exit(0);
5273 } 5323 }
5274 } 5324 }
5275 printmsgerr("\n"); 5325 printmsgerr("\n");
5276 } 5326 }
5277 } 5327 }
5278 } 5328 }
5279 5329
5280 GSM_Terminate(); 5330 GSM_Terminate();
5281} 5331}
5282#endif 5332#endif
5283 5333
5284static void ClearAll(int argc, char *argv[]) 5334static void ClearAll(int argc, char *argv[])
5285{ 5335{
5286 GSM_MemoryStatusMemStatus; 5336 GSM_MemoryStatusMemStatus;
5287 GSM_ToDoStatus ToDoStatus; 5337 GSM_ToDoStatus ToDoStatus;
5288 GSM_CalendarEntryCalendar; 5338 GSM_CalendarEntryCalendar;
5289 GSM_ToDoEntry ToDo; 5339 GSM_ToDoEntry ToDo;
5340 GSM_NoteEntry Note;
5290 GSM_WAPBookmark Bookmark; 5341 GSM_WAPBookmark Bookmark;
5291 GSM_FMStation Station; 5342 GSM_FMStation Station;
5292 GSM_MemoryEntry Pbk; 5343 GSM_MemoryEntry Pbk;
5293 bool DoClear; 5344 bool DoClear;
5294 5345
5295 GSM_Init(true); 5346 GSM_Init(true);
5296 5347
5297 DoClear = false; 5348 DoClear = false;
5298 MemStatus.MemoryType = MEM_ME; 5349 MemStatus.MemoryType = MEM_ME;
5299 error=Phone->GetMemoryStatus(&s, &MemStatus); 5350 error=Phone->GetMemoryStatus(&s, &MemStatus);
5300 if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { 5351 if (error==ERR_NONE && MemStatus.MemoryUsed !=0) {
5301 if (answer_yes("Delete phone phonebook")) DoClear = true; 5352 if (answer_yes("Delete phone phonebook")) DoClear = true;
5302 } 5353 }
5303 if (DoClear) { 5354 if (DoClear) {
5304 error = Phone->DeleteAllMemory(&s,MEM_ME); 5355 error = Phone->DeleteAllMemory(&s,MEM_ME);
5305 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { 5356 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
5306 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { 5357 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) {
5307 Pbk.MemoryType = MEM_ME; 5358 Pbk.MemoryType = MEM_ME;
5308 Pbk.Location= i + 1; 5359 Pbk.Location= i + 1;
5309 Pbk.EntriesNum= 0; 5360 Pbk.EntriesNum= 0;
5310 error=Phone->DeleteMemory(&s, &Pbk); 5361 error=Phone->DeleteMemory(&s, &Pbk);
5311 Print_Error(error); 5362 Print_Error(error);
5312 printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); 5363 printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree));
5313 if (gshutdown) { 5364 if (gshutdown) {
5314 GSM_Terminate(); 5365 GSM_Terminate();
5315 exit(0); 5366 exit(0);
5316 } 5367 }
5317 } 5368 }
5318 printmsgerr("\n"); 5369 printmsgerr("\n");
5319 } else { 5370 } else {
5320 printmsgerr("Done\n"); 5371 printmsgerr("Done\n");
5321 Print_Error(error); 5372 Print_Error(error);
5322 } 5373 }
5323 } 5374 }
5324 5375
5325 DoClear = false; 5376 DoClear = false;
5326 MemStatus.MemoryType = MEM_SM; 5377 MemStatus.MemoryType = MEM_SM;
5327 error=Phone->GetMemoryStatus(&s, &MemStatus); 5378 error=Phone->GetMemoryStatus(&s, &MemStatus);
5328 if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { 5379 if (error==ERR_NONE && MemStatus.MemoryUsed !=0) {
5329 if (answer_yes("Delete SIM phonebook")) DoClear = true; 5380 if (answer_yes("Delete SIM phonebook")) DoClear = true;
5330 } 5381 }
5331 if (DoClear) { 5382 if (DoClear) {
5332 error = Phone->DeleteAllMemory(&s,MEM_SM); 5383 error = Phone->DeleteAllMemory(&s,MEM_SM);
5333 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { 5384 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
5334 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { 5385 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) {
5335 Pbk.MemoryType = MEM_SM; 5386 Pbk.MemoryType = MEM_SM;
5336 Pbk.Location= i + 1; 5387 Pbk.Location= i + 1;
5337 Pbk.EntriesNum= 0; 5388 Pbk.EntriesNum= 0;
@@ -5351,96 +5402,113 @@ static void ClearAll(int argc, char *argv[])
5351 } 5402 }
5352 5403
5353 DoClear = false; 5404 DoClear = false;
5354 error = Phone->GetNextCalendar(&s,&Calendar,true); 5405 error = Phone->GetNextCalendar(&s,&Calendar,true);
5355 if (error == ERR_NONE) { 5406 if (error == ERR_NONE) {
5356 if (answer_yes("Delete calendar notes")) DoClear = true; 5407 if (answer_yes("Delete calendar notes")) DoClear = true;
5357 } 5408 }
5358 if (DoClear) { 5409 if (DoClear) {
5359 printmsgerr("Deleting: "); 5410 printmsgerr("Deleting: ");
5360 error=Phone->DeleteAllCalendar(&s); 5411 error=Phone->DeleteAllCalendar(&s);
5361 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { 5412 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
5362 while (1) { 5413 while (1) {
5363 error = Phone->GetNextCalendar(&s,&Calendar,true); 5414 error = Phone->GetNextCalendar(&s,&Calendar,true);
5364 if (error != ERR_NONE) break; 5415 if (error != ERR_NONE) break;
5365 error = Phone->DeleteCalendar(&s,&Calendar); 5416 error = Phone->DeleteCalendar(&s,&Calendar);
5366 Print_Error(error); 5417 Print_Error(error);
5367 printmsgerr("*"); 5418 printmsgerr("*");
5368 } 5419 }
5369 printmsgerr("\n"); 5420 printmsgerr("\n");
5370 } else { 5421 } else {
5371 printmsgerr("Done\n"); 5422 printmsgerr("Done\n");
5372 Print_Error(error); 5423 Print_Error(error);
5373 } 5424 }
5374 } 5425 }
5375 5426
5376 DoClear = false; 5427 DoClear = false;
5377 error = Phone->GetToDoStatus(&s,&ToDoStatus); 5428 error = Phone->GetToDoStatus(&s,&ToDoStatus);
5378 if (error == ERR_NONE && ToDoStatus.Used != 0) { 5429 if (error == ERR_NONE && ToDoStatus.Used != 0) {
5379 if (answer_yes("Delete ToDo")) DoClear = true; 5430 if (answer_yes("Delete ToDo")) DoClear = true;
5380 } 5431 }
5381 if (DoClear) { 5432 if (DoClear) {
5382 printmsgerr("Deleting: "); 5433 printmsgerr("Deleting: ");
5383 error=Phone->DeleteAllToDo(&s); 5434 error=Phone->DeleteAllToDo(&s);
5384 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { 5435 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
5385 while (1) { 5436 while (1) {
5386 error = Phone->GetNextToDo(&s,&ToDo,true); 5437 error = Phone->GetNextToDo(&s,&ToDo,true);
5387 if (error != ERR_NONE) break; 5438 if (error != ERR_NONE) break;
5388 error = Phone->DeleteToDo(&s,&ToDo); 5439 error = Phone->DeleteToDo(&s,&ToDo);
5389 Print_Error(error); 5440 Print_Error(error);
5390 printmsgerr("*"); 5441 printmsgerr("*");
5391 } 5442 }
5392 printmsgerr("\n"); 5443 printmsgerr("\n");
5393 } else { 5444 } else {
5394 printmsgerr("Done\n"); 5445 printmsgerr("Done\n");
5395 Print_Error(error); 5446 Print_Error(error);
5396 } 5447 }
5397 } 5448 }
5398 5449
5450 DoClear = false;
5451 error = Phone->GetNotesStatus(&s,&ToDoStatus);
5452 if (error == ERR_NONE && ToDoStatus.Used != 0) {
5453 if (answer_yes("Delete Notes")) DoClear = true;
5454 }
5455 if (DoClear) {
5456 printmsgerr("Deleting: ");
5457 while (1) {
5458 error = Phone->GetNextNote(&s,&Note,true);
5459 if (error != ERR_NONE) break;
5460 error = Phone->DeleteNote(&s,&Note);
5461 Print_Error(error);
5462 printmsgerr("*");
5463 }
5464 printmsgerr("\n");
5465 }
5466
5399 Bookmark.Location = 1; 5467 Bookmark.Location = 1;
5400 error = Phone->GetWAPBookmark(&s,&Bookmark); 5468 error = Phone->GetWAPBookmark(&s,&Bookmark);
5401 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { 5469 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) {
5402 if (answer_yes("Delete WAP bookmarks")) { 5470 if (answer_yes("Delete WAP bookmarks")) {
5403 printmsgerr("Deleting: "); 5471 printmsgerr("Deleting: ");
5404 /* One thing to explain: DCT4 phones seems to have bug here. 5472 /* One thing to explain: DCT4 phones seems to have bug here.
5405 * When delete for example first bookmark, phone change 5473 * When delete for example first bookmark, phone change
5406 * numeration for getting frame, not for deleting. So, we try to 5474 * numeration for getting frame, not for deleting. So, we try to
5407 * get 1'st bookmark. Inside frame is "correct" location. We use 5475 * get 1'st bookmark. Inside frame is "correct" location. We use
5408 * it later 5476 * it later
5409 */ 5477 */
5410 while (error==ERR_NONE) { 5478 while (error==ERR_NONE) {
5411 error = Phone->DeleteWAPBookmark(&s,&Bookmark); 5479 error = Phone->DeleteWAPBookmark(&s,&Bookmark);
5412 Bookmark.Location = 1; 5480 Bookmark.Location = 1;
5413 error = Phone->GetWAPBookmark(&s,&Bookmark); 5481 error = Phone->GetWAPBookmark(&s,&Bookmark);
5414 printmsgerr("*"); 5482 printmsgerr("*");
5415 } 5483 }
5416 printmsgerr("\n"); 5484 printmsgerr("\n");
5417 } 5485 }
5418 } 5486 }
5419 if (Phone->DeleteUserRingtones != NOTSUPPORTED) { 5487 if (Phone->DeleteUserRingtones != NOTSUPPORTED) {
5420 if (answer_yes("Delete all user ringtones")) { 5488 if (answer_yes("Delete all user ringtones")) {
5421 printmsgerr("Deleting: "); 5489 printmsgerr("Deleting: ");
5422 error=Phone->DeleteUserRingtones(&s); 5490 error=Phone->DeleteUserRingtones(&s);
5423 Print_Error(error); 5491 Print_Error(error);
5424 printmsgerr("Done\n"); 5492 printmsgerr("Done\n");
5425 } 5493 }
5426 } 5494 }
5427 Station.Location=i; 5495 Station.Location=i;
5428 error=Phone->GetFMStation(&s,&Station); 5496 error=Phone->GetFMStation(&s,&Station);
5429 if (error == ERR_NONE || error == ERR_EMPTY) { 5497 if (error == ERR_NONE || error == ERR_EMPTY) {
5430 if (answer_yes("Delete all FM station")) { 5498 if (answer_yes("Delete all FM station")) {
5431 error=Phone->ClearFMStations(&s); 5499 error=Phone->ClearFMStations(&s);
5432 Print_Error(error); 5500 Print_Error(error);
5433 } 5501 }
5434 } 5502 }
5435 5503
5436 GSM_Terminate(); 5504 GSM_Terminate();
5437} 5505}
5438 5506
5439static void DisplayConnectionSettings(GSM_MultiWAPSettings *settings,int j) 5507static void DisplayConnectionSettings(GSM_MultiWAPSettings *settings,int j)
5440{ 5508{
5441 if (settings->Settings[j].IsContinuous) { 5509 if (settings->Settings[j].IsContinuous) {
5442 printmsg("Connection type : Continuous\n"); 5510 printmsg("Connection type : Continuous\n");
5443 } else { 5511 } else {
5444 printmsg("Connection type : Temporary\n"); 5512 printmsg("Connection type : Temporary\n");
5445 } 5513 }
5446 if (settings->Settings[j].IsSecurity) { 5514 if (settings->Settings[j].IsSecurity) {
@@ -5597,225 +5665,229 @@ static void GetChatSettings(int argc, char *argv[])
5597 DisplayConnectionSettings(&settings.Connection,j); 5665 DisplayConnectionSettings(&settings.Connection,j);
5598 printf("\n"); 5666 printf("\n");
5599 } 5667 }
5600 } 5668 }
5601 GSM_Terminate(); 5669 GSM_Terminate();
5602} 5670}
5603 5671
5604static void GetWAPMMSSettings(int argc, char *argv[]) 5672static void GetWAPMMSSettings(int argc, char *argv[])
5605{ 5673{
5606 GSM_MultiWAPSettingssettings; 5674 GSM_MultiWAPSettingssettings;
5607 int start,stop,j; 5675 int start,stop,j;
5608 5676
5609 GetStartStop(&start, &stop, 2, argc, argv); 5677 GetStartStop(&start, &stop, 2, argc, argv);
5610 5678
5611 GSM_Init(true); 5679 GSM_Init(true);
5612 5680
5613 for (i=start;i<=stop;i++) { 5681 for (i=start;i<=stop;i++) {
5614 settings.Location=i; 5682 settings.Location=i;
5615 if (mystrncasecmp(argv[1],"--getwapsettings",0)) { 5683 if (mystrncasecmp(argv[1],"--getwapsettings",0)) {
5616 error=Phone->GetWAPSettings(&s,&settings); 5684 error=Phone->GetWAPSettings(&s,&settings);
5617 } else { 5685 } else {
5618 error=Phone->GetMMSSettings(&s,&settings); 5686 error=Phone->GetMMSSettings(&s,&settings);
5619 } 5687 }
5620 Print_Error(error); 5688 Print_Error(error);
5621 for (j=0;j<settings.Number;j++) { 5689 for (j=0;j<settings.Number;j++) {
5622 printmsg("%i. ",i); 5690 printmsg("%i. ",i);
5623 if (settings.Settings[j].Title[0]==0 && settings.Settings[j].Title[1]==0) { 5691 if (settings.Settings[j].Title[0]==0 && settings.Settings[j].Title[1]==0) {
5624 printmsg("Set %i",i); 5692 printmsg("Set %i",i);
5625 } else { 5693 } else {
5626 printmsg("%s",DecodeUnicodeConsole(settings.Settings[j].Title)); 5694 printmsg("%s",DecodeUnicodeConsole(settings.Settings[j].Title));
5627 } 5695 }
5628 if (settings.Active) printmsg(" (active)"); 5696 if (settings.Active) printmsg(" (active)");
5629 if (settings.ReadOnly) printmsg("\nRead only : yes"); 5697 if (settings.ReadOnly) printmsg("\nRead only : yes");
5630 printmsg("\nHomepage : \"%s\"\n",DecodeUnicodeConsole(settings.Settings[j].HomePage)); 5698 printmsg("\nHomepage : \"%s\"\n",DecodeUnicodeConsole(settings.Settings[j].HomePage));
5631 DisplayConnectionSettings(&settings,j); 5699 DisplayConnectionSettings(&settings,j);
5632 printf("\n"); 5700 printf("\n");
5633 } 5701 }
5634 } 5702 }
5635 GSM_Terminate(); 5703 GSM_Terminate();
5636} 5704}
5637 5705
5638#ifdef GSM_ENABLE_BACKUP 5706#ifdef GSM_ENABLE_BACKUP
5639static void BackupSMS(int argc, char *argv[]) 5707static void BackupSMS(int argc, char *argv[])
5640{ 5708{
5641 GSM_SMS_Backup Backup; 5709 GSM_SMS_Backup Backup;
5642 GSM_MultiSMSMessage sms; 5710 GSM_MultiSMSMessage sms;
5643 GSM_SMSFolders folders; 5711 GSM_SMSFolders folders;
5644 bool BackupFromFolder[GSM_MAX_SMS_FOLDERS]; 5712 bool BackupFromFolder[GSM_MAX_SMS_FOLDERS];
5645 bool start = true; 5713 bool start = true;
5646 bool DeleteAfter; 5714 bool DeleteAfter;
5647 int j, smsnum; 5715 int j, smsnum = 0;
5648 char buffer[200]; 5716 char buffer[200];
5649 5717
5650 /* We ignore return code, because (when file doesn't exist) we
5651 * will create new later
5652 */
5653 GSM_ReadSMSBackupFile(argv[2], &Backup);
5654 smsnum = 0;
5655 while (Backup.SMS[smsnum]!=NULL) smsnum++;
5656
5657 GSM_Init(true); 5718 GSM_Init(true);
5658 5719
5659 error=Phone->GetSMSFolders(&s, &folders); 5720 error=Phone->GetSMSFolders(&s, &folders);
5660 Print_Error(error); 5721 Print_Error(error);
5661 5722
5662 DeleteAfter=answer_yes("Delete each sms after backup"); 5723 DeleteAfter=answer_yes("Delete each sms after backup");
5663 5724
5664 for (j=0;j<folders.Number;j++) { 5725 for (j=0;j<folders.Number;j++) {
5665 BackupFromFolder[j] = false; 5726 BackupFromFolder[j] = false;
5666 sprintf(buffer,"Backup sms from folder \"%s\"",DecodeUnicodeConsole(folders.Folder[j].Name)); 5727 sprintf(buffer,"Backup sms from folder \"%s\"",DecodeUnicodeConsole(folders.Folder[j].Name));
5728 if (folders.Folder[j].Memory == MEM_SM) strcat(buffer," (SIM)");
5667 if (answer_yes(buffer)) BackupFromFolder[j] = true; 5729 if (answer_yes(buffer)) BackupFromFolder[j] = true;
5668 } 5730 }
5669 5731
5670 while (error == ERR_NONE) { 5732 while (error == ERR_NONE) {
5671 sms.SMS[0].Folder=0x00; 5733 sms.SMS[0].Folder=0x00;
5672 error=Phone->GetNextSMS(&s, &sms, start); 5734 error=Phone->GetNextSMS(&s, &sms, start);
5673 switch (error) { 5735 switch (error) {
5674 case ERR_EMPTY: 5736 case ERR_EMPTY:
5675 break; 5737 break;
5676 default: 5738 default:
5677 Print_Error(error); 5739 Print_Error(error);
5678 for (j=0;j<sms.Number;j++) { 5740 for (j=0;j<sms.Number;j++) {
5679 if (BackupFromFolder[sms.SMS[j].Folder-1]) { 5741 if (BackupFromFolder[sms.SMS[j].Folder-1]) {
5680 switch (sms.SMS[j].PDU) { 5742 switch (sms.SMS[j].PDU) {
5681 case SMS_Status_Report: 5743 case SMS_Status_Report:
5682 break; 5744 break;
5683 case SMS_Submit: 5745 case SMS_Submit:
5684 case SMS_Deliver: 5746 case SMS_Deliver:
5685 if (sms.SMS[j].Length == 0) break; 5747 if (sms.SMS[j].Length == 0) break;
5686 if (smsnum < GSM_BACKUP_MAX_SMS) { 5748 if (smsnum < GSM_BACKUP_MAX_SMS) {
5687 Backup.SMS[smsnum] = malloc(sizeof(GSM_SMSMessage)); 5749 Backup.SMS[smsnum] = malloc(sizeof(GSM_SMSMessage));
5688 if (Backup.SMS[smsnum] == NULL) Print_Error(ERR_MOREMEMORY); 5750 if (Backup.SMS[smsnum] == NULL) Print_Error(ERR_MOREMEMORY);
5689 Backup.SMS[smsnum+1] = NULL; 5751 Backup.SMS[smsnum+1] = NULL;
5690 } else { 5752 } else {
5691 printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMS"); 5753 printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMS");
5692 GSM_Terminate(); 5754 GSM_Terminate();
5693 exit(-1); 5755 exit(-1);
5694 } 5756 }
5695 *Backup.SMS[smsnum] = sms.SMS[j]; 5757 *Backup.SMS[smsnum] = sms.SMS[j];
5696 smsnum++; 5758 smsnum++;
5697 break; 5759 break;
5698 } 5760 }
5699 } 5761 }
5700 } 5762 }
5701 } 5763 }
5702 start=false; 5764 start=false;
5703 } 5765 }
5704 5766
5705 error = GSM_SaveSMSBackupFile(argv[2],&Backup); 5767 error = GSM_AddSMSBackupFile(argv[2],&Backup);
5706 Print_Error(error); 5768 Print_Error(error);
5707 5769
5708 if (DeleteAfter) { 5770 if (DeleteAfter) {
5709 for (j=0;j<smsnum;j++) { 5771 for (j=0;j<smsnum;j++) {
5710 Backup.SMS[j]->Folder = 0; 5772 Backup.SMS[j]->Folder = 0;
5711 error=Phone->DeleteSMS(&s, Backup.SMS[j]); 5773 error=Phone->DeleteSMS(&s, Backup.SMS[j]);
5712 Print_Error(error); 5774 Print_Error(error);
5713 printmsgerr("%cDeleting: %i percent",13,(j+1)*100/smsnum); 5775 printmsgerr("%cDeleting: %i percent",13,(j+1)*100/smsnum);
5714 } 5776 }
5715 } 5777 }
5716 5778
5717 GSM_Terminate(); 5779 GSM_Terminate();
5718} 5780}
5719 5781
5720static void AddSMS(int argc, char *argv[]) 5782static void AddSMS(int argc, char *argv[])
5721{ 5783{
5722 GSM_MultiSMSMessage SMS; 5784 GSM_MultiSMSMessage SMS;
5723 GSM_SMS_Backup Backup; 5785 GSM_SMS_Backup Backup;
5724 int smsnum = 0; 5786 int smsnum = 0;
5725 int folder; 5787 int folder;
5726 5788
5727 folder = atoi(argv[2]); 5789 folder = atoi(argv[2]);
5728 5790
5729 error = GSM_ReadSMSBackupFile(argv[3], &Backup); 5791 error = GSM_ReadSMSBackupFile(argv[3], &Backup);
5730 Print_Error(error); 5792 Print_Error(error);
5731 5793
5732 GSM_Init(true); 5794 GSM_Init(true);
5733 5795
5734 while (Backup.SMS[smsnum] != NULL) { 5796 while (Backup.SMS[smsnum] != NULL) {
5735 Backup.SMS[smsnum]->Folder = folder; 5797 Backup.SMS[smsnum]->Folder = folder;
5736 Backup.SMS[smsnum]->SMSC.Location = 1; 5798 Backup.SMS[smsnum]->SMSC.Location = 1;
5737 SMS.Number = 1; 5799 SMS.Number = 1;
5738 SMS.SMS[0] = *Backup.SMS[smsnum]; 5800 SMS.SMS[0] = *Backup.SMS[smsnum];
5739 displaymultismsinfo(SMS,false,false); 5801 displaymultismsinfo(SMS,false,false);
5740 if (answer_yes("Restore sms")) { 5802 if (answer_yes("Restore sms")) {
5741 error=Phone->AddSMS(&s, Backup.SMS[smsnum]); 5803 error=Phone->AddSMS(&s, Backup.SMS[smsnum]);
5742 Print_Error(error); 5804 Print_Error(error);
5743 } 5805 }
5744 smsnum++; 5806 smsnum++;
5745 } 5807 }
5746 5808
5747 GSM_Terminate(); 5809 GSM_Terminate();
5748} 5810}
5749 5811
5750static void RestoreSMS(int argc, char *argv[]) 5812static void RestoreSMS(int argc, char *argv[])
5751{ 5813{
5752 GSM_MultiSMSMessage SMS; 5814 GSM_MultiSMSMessage SMS;
5753 GSM_SMS_Backup Backup; 5815 GSM_SMS_Backup Backup;
5754 GSM_SMSFolders folders; 5816 GSM_SMSFolders folders;
5755 int smsnum = 0; 5817 int smsnum = 0;
5756 char buffer[200]; 5818 char buffer[200];
5819 bool restore8bit,doit;
5757 5820
5758 error=GSM_ReadSMSBackupFile(argv[2], &Backup); 5821 error=GSM_ReadSMSBackupFile(argv[2], &Backup);
5759 Print_Error(error); 5822 Print_Error(error);
5760 5823
5824 sprintf(buffer,"Do you want to restore binary SMS");
5825 restore8bit = answer_yes(buffer);
5826
5761 GSM_Init(true); 5827 GSM_Init(true);
5762 5828
5763 error=Phone->GetSMSFolders(&s, &folders); 5829 error=Phone->GetSMSFolders(&s, &folders);
5764 Print_Error(error); 5830 Print_Error(error);
5765 5831
5766 while (Backup.SMS[smsnum] != NULL) { 5832 while (Backup.SMS[smsnum] != NULL) {
5767 SMS.Number = 1; 5833 doit = true;
5768 memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); 5834 if (!restore8bit && Backup.SMS[smsnum]->Coding == SMS_Coding_8bit) doit = false;
5769 displaymultismsinfo(SMS,false,false); 5835 if (doit) {
5770 sprintf(buffer,"Restore sms to folder \"%s\"",DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name)); 5836 SMS.Number = 1;
5771 if (answer_yes(buffer)) { 5837 memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage));
5772 error=Phone->AddSMS(&s, Backup.SMS[smsnum]); 5838 displaymultismsinfo(SMS,false,false);
5773 Print_Error(error); 5839 sprintf(buffer,"Restore %03i sms to folder \"%s\"",smsnum+1,DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name));
5840 if (folders.Folder[Backup.SMS[smsnum]->Folder-1].Memory == MEM_SM) strcat(buffer," (SIM)");
5841 if (answer_yes(buffer)) {
5842 smprintf(&s,"saving %i SMS\n",smsnum);
5843 error=Phone->AddSMS(&s, Backup.SMS[smsnum]);
5844 Print_Error(error);
5845 }
5774 } 5846 }
5775 smsnum++; 5847 smsnum++;
5776 } 5848 }
5777 5849
5778 GSM_Terminate(); 5850 GSM_Terminate();
5779} 5851}
5780#endif 5852#endif
5781 5853
5782static void CopyBitmap(int argc, char *argv[]) 5854static void CopyBitmap(int argc, char *argv[])
5783{ 5855{
5784 GSM_MultiBitmap Bitmap; 5856 GSM_MultiBitmap Bitmap;
5785 int i; 5857 int i;
5786 5858
5787 Bitmap.Bitmap[0].Type = GSM_None; 5859 Bitmap.Bitmap[0].Type = GSM_None;
5788 5860
5789 error=GSM_ReadBitmapFile(argv[2],&Bitmap); 5861 error=GSM_ReadBitmapFile(argv[2],&Bitmap);
5790 Print_Error(error); 5862 Print_Error(error);
5791 5863
5792 if (argc==3) { 5864 if (argc==3) {
5793 for (i=0;i<Bitmap.Number;i++) { 5865 for (i=0;i<Bitmap.Number;i++) {
5794 switch (Bitmap.Bitmap[i].Type) { 5866 switch (Bitmap.Bitmap[i].Type) {
5795 case GSM_StartupLogo : printmsg("Startup logo"); break; 5867 case GSM_StartupLogo : printmsg("Startup logo"); break;
5796 case GSM_OperatorLogo: printmsg("Operator logo"); break; 5868 case GSM_OperatorLogo: printmsg("Operator logo"); break;
5797 case GSM_PictureImage: printmsg("Picture Image"); break; 5869 case GSM_PictureImage: printmsg("Picture Image"); break;
5798 case GSM_CallerGroupLogo : printmsg("Caller group logo"); break; 5870 case GSM_CallerGroupLogo : printmsg("Caller group logo"); break;
5799 default : break; 5871 default : break;
5800 } 5872 }
5801 printmsg(", width %i, height %i\n",Bitmap.Bitmap[i].BitmapWidth,Bitmap.Bitmap[i].BitmapHeight); 5873 printmsg(", width %i, height %i\n",Bitmap.Bitmap[i].BitmapWidth,Bitmap.Bitmap[i].BitmapHeight);
5802 GSM_PrintBitmap(stdout,&Bitmap.Bitmap[i]); 5874 GSM_PrintBitmap(stdout,&Bitmap.Bitmap[i]);
5803 } 5875 }
5804 } else { 5876 } else {
5805 if (argc == 5) { 5877 if (argc == 5) {
5806 for (i=0;i<Bitmap.Number;i++) { 5878 for (i=0;i<Bitmap.Number;i++) {
5807 if (mystrncasecmp(argv[4],"PICTURE",0)) { 5879 if (mystrncasecmp(argv[4],"PICTURE",0)) {
5808 Bitmap.Bitmap[i].Type = GSM_PictureImage; 5880 Bitmap.Bitmap[i].Type = GSM_PictureImage;
5809 } else if (mystrncasecmp(argv[4],"STARTUP",0)) { 5881 } else if (mystrncasecmp(argv[4],"STARTUP",0)) {
5810 Bitmap.Bitmap[i].Type = GSM_StartupLogo; 5882 Bitmap.Bitmap[i].Type = GSM_StartupLogo;
5811 } else if (mystrncasecmp(argv[4],"CALLER",0)) { 5883 } else if (mystrncasecmp(argv[4],"CALLER",0)) {
5812 Bitmap.Bitmap[i].Type = GSM_CallerGroupLogo; 5884 Bitmap.Bitmap[i].Type = GSM_CallerGroupLogo;
5813 } else if (mystrncasecmp(argv[4],"OPERATOR",0)) { 5885 } else if (mystrncasecmp(argv[4],"OPERATOR",0)) {
5814 Bitmap.Bitmap[i].Type = GSM_OperatorLogo; 5886 Bitmap.Bitmap[i].Type = GSM_OperatorLogo;
5815 } else { 5887 } else {
5816 printmsg("What format of output file logo (\"%s\") ?\n",argv[4]); 5888 printmsg("What format of output file logo (\"%s\") ?\n",argv[4]);
5817 exit(-1); 5889 exit(-1);
5818 } 5890 }
5819 } 5891 }
5820 } 5892 }
5821 error=GSM_SaveBitmapFile(argv[3],&Bitmap); 5893 error=GSM_SaveBitmapFile(argv[3],&Bitmap);
@@ -6315,110 +6387,111 @@ static void GetAllNotes(int argc, char *argv[])
6315 error = Phone->GetNextNote(&s, &Note, start); 6387 error = Phone->GetNextNote(&s, &Note, start);
6316 if (error == ERR_EMPTY) break; 6388 if (error == ERR_EMPTY) break;
6317 Print_Error(error); 6389 Print_Error(error);
6318 printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(Note.Text)); 6390 printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(Note.Text));
6319 printf("\n"); 6391 printf("\n");
6320 start = false; 6392 start = false;
6321 } 6393 }
6322 GSM_Terminate(); 6394 GSM_Terminate();
6323} 6395}
6324 6396
6325static void GetSecurityStatus(int argc, char *argv[]) 6397static void GetSecurityStatus(int argc, char *argv[])
6326{ 6398{
6327 GSM_Init(true); 6399 GSM_Init(true);
6328 6400
6329 PrintSecurityStatus(); 6401 PrintSecurityStatus();
6330 6402
6331 GSM_Terminate(); 6403 GSM_Terminate();
6332} 6404}
6333 6405
6334static void EnterSecurityCode(int argc, char *argv[]) 6406static void EnterSecurityCode(int argc, char *argv[])
6335{ 6407{
6336 GSM_SecurityCode Code; 6408 GSM_SecurityCode Code;
6337 6409
6338 if (mystrncasecmp(argv[2],"PIN",0)) { Code.Type = SEC_Pin; 6410 if (mystrncasecmp(argv[2],"PIN",0)) { Code.Type = SEC_Pin;
6339 } else if (mystrncasecmp(argv[2],"PUK",0)) {Code.Type = SEC_Puk; 6411 } else if (mystrncasecmp(argv[2],"PUK",0)) {Code.Type = SEC_Puk;
6340 } else if (mystrncasecmp(argv[2],"PIN2",0)) {Code.Type = SEC_Pin2; 6412 } else if (mystrncasecmp(argv[2],"PIN2",0)) {Code.Type = SEC_Pin2;
6341 } else if (mystrncasecmp(argv[2],"PUK2",0)) {Code.Type = SEC_Puk2; 6413 } else if (mystrncasecmp(argv[2],"PUK2",0)) {Code.Type = SEC_Puk2;
6342 } else { 6414 } else {
6343 printmsg("What security code (\"%s\") ?\n",argv[2]); 6415 printmsg("What security code (\"%s\") ?\n",argv[2]);
6344 exit(-1); 6416 exit(-1);
6345 } 6417 }
6346 6418
6347 strcpy(Code.Code,argv[3]); 6419 strcpy(Code.Code,argv[3]);
6348 6420
6349 GSM_Init(true); 6421 GSM_Init(true);
6350 6422
6351 error=Phone->EnterSecurityCode(&s,Code); 6423 error=Phone->EnterSecurityCode(&s,Code);
6352 Print_Error(error); 6424 Print_Error(error);
6353 6425
6354 GSM_Terminate(); 6426 GSM_Terminate();
6355} 6427}
6356 6428
6357static void GetProfile(int argc, char *argv[]) 6429static void GetProfile(int argc, char *argv[])
6358{ 6430{
6359 GSM_Profile Profile; 6431 GSM_Profile Profile;
6360 int start,stop,j,k; 6432 int start,stop,j,k;
6361 GSM_Bitmap caller[5]; 6433 GSM_Bitmap caller[5];
6362 bool callerinit[5],special; 6434 bool callerinit[5],special;
6363 GSM_AllRingtonesInfo Info; 6435 GSM_AllRingtonesInfo Info = {0, NULL};
6364 6436
6365 GetStartStop(&start, &stop, 2, argc, argv); 6437 GetStartStop(&start, &stop, 2, argc, argv);
6366 6438
6367 for (i=0;i<5;i++) callerinit[i] = false; 6439 for (i=0;i<5;i++) callerinit[i] = false;
6368 6440
6369 GSM_Init(true); 6441 GSM_Init(true);
6370 6442
6371 error=Phone->GetRingtonesInfo(&s,&Info); 6443 error=Phone->GetRingtonesInfo(&s,&Info);
6372 if (error != ERR_NONE) Info.Number = 0; 6444 if (error != ERR_NONE) Info.Number = 0;
6373 6445
6374 for (i=start;i<=stop;i++) { 6446 for (i=start;i<=stop;i++) {
6375 Profile.Location=i; 6447 Profile.Location=i;
6376 error=Phone->GetProfile(&s,&Profile); 6448 error=Phone->GetProfile(&s,&Profile);
6449 if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone);
6377 Print_Error(error); 6450 Print_Error(error);
6378 6451
6379 printmsg("%i. \"%s\"",i,DecodeUnicodeConsole(Profile.Name)); 6452 printmsg("%i. \"%s\"",i,DecodeUnicodeConsole(Profile.Name));
6380 if (Profile.Active) printmsg(" (active)"); 6453 if (Profile.Active) printmsg(" (active)");
6381 if (Profile.DefaultName) printmsg(" (default name)"); 6454 if (Profile.DefaultName) printmsg(" (default name)");
6382 if (Profile.HeadSetProfile) printmsg(" (HeadSet profile)"); 6455 if (Profile.HeadSetProfile) printmsg(" (HeadSet profile)");
6383 if (Profile.CarKitProfile) printmsg(" (CarKit profile)"); 6456 if (Profile.CarKitProfile) printmsg(" (CarKit profile)");
6384 printf("\n"); 6457 printf("\n");
6385 for (j=0;j<Profile.FeaturesNumber;j++) { 6458 for (j=0;j<Profile.FeaturesNumber;j++) {
6386 special = false; 6459 special = false;
6387 switch (Profile.FeatureID[j]) { 6460 switch (Profile.FeatureID[j]) {
6388 case Profile_MessageToneID: 6461 case Profile_MessageToneID:
6389 case Profile_RingtoneID: 6462 case Profile_RingtoneID:
6390 special = true; 6463 special = true;
6391 if (Profile.FeatureID[j] == Profile_RingtoneID) { 6464 if (Profile.FeatureID[j] == Profile_RingtoneID) {
6392 printmsg("Ringtone ID : "); 6465 printmsg("Ringtone ID : ");
6393 } else { 6466 } else {
6394 printmsg("Message alert tone ID : "); 6467 printmsg("Message alert tone ID : ");
6395 } 6468 }
6396 if (UnicodeLength(GSM_GetRingtoneName(&Info,Profile.FeatureValue[j]))!=0) { 6469 if (UnicodeLength(GSM_GetRingtoneName(&Info,Profile.FeatureValue[j]))!=0) {
6397 printmsg("\"%s\"\n",DecodeUnicodeConsole(GSM_GetRingtoneName(&Info,Profile.FeatureValue[j]))); 6470 printmsg("\"%s\"\n",DecodeUnicodeConsole(GSM_GetRingtoneName(&Info,Profile.FeatureValue[j])));
6398 } else { 6471 } else {
6399 printmsg("%i\n",Profile.FeatureValue[j]); 6472 printmsg("%i\n",Profile.FeatureValue[j]);
6400 } 6473 }
6401 break; 6474 break;
6402 case Profile_CallerGroups: 6475 case Profile_CallerGroups:
6403 special = true; 6476 special = true;
6404 printmsg("Call alert for :"); 6477 printmsg("Call alert for :");
6405 for (k=0;k<5;k++) { 6478 for (k=0;k<5;k++) {
6406 if (Profile.CallerGroups[k]) { 6479 if (Profile.CallerGroups[k]) {
6407 if (!callerinit[k]) { 6480 if (!callerinit[k]) {
6408 caller[k].Type = GSM_CallerGroupLogo; 6481 caller[k].Type = GSM_CallerGroupLogo;
6409 caller[k].Location = k + 1; 6482 caller[k].Location = k + 1;
6410 error=Phone->GetBitmap(&s,&caller[k]); 6483 error=Phone->GetBitmap(&s,&caller[k]);
6411 if (error == ERR_SECURITYERROR) { 6484 if (error == ERR_SECURITYERROR) {
6412 NOKIA_GetDefaultCallerGroupName(&s,&caller[k]); 6485 NOKIA_GetDefaultCallerGroupName(&s,&caller[k]);
6413 } else { 6486 } else {
6414 Print_Error(error); 6487 Print_Error(error);
6415 } 6488 }
6416 callerinit[k]= true; 6489 callerinit[k]= true;
6417 } 6490 }
6418 printmsg(" \"%s\"",DecodeUnicodeConsole(caller[k].Text)); 6491 printmsg(" \"%s\"",DecodeUnicodeConsole(caller[k].Text));
6419 } 6492 }
6420 } 6493 }
6421 printf("\n"); 6494 printf("\n");
6422 break; 6495 break;
6423 case Profile_ScreenSaverNumber: 6496 case Profile_ScreenSaverNumber:
6424 special = true; 6497 special = true;
@@ -6442,96 +6515,98 @@ static void GetProfile(int argc, char *argv[])
6442 if (!special) { 6515 if (!special) {
6443 switch (Profile.FeatureValue[j]) { 6516 switch (Profile.FeatureValue[j]) {
6444 case PROFILE_VOLUME_LEVEL1 : 6517 case PROFILE_VOLUME_LEVEL1 :
6445 case PROFILE_KEYPAD_LEVEL1 : printmsg("Level 1\n"); break; 6518 case PROFILE_KEYPAD_LEVEL1 : printmsg("Level 1\n"); break;
6446 case PROFILE_VOLUME_LEVEL2 : 6519 case PROFILE_VOLUME_LEVEL2 :
6447 case PROFILE_KEYPAD_LEVEL2 : printmsg("Level 2\n"); break; 6520 case PROFILE_KEYPAD_LEVEL2 : printmsg("Level 2\n"); break;
6448 case PROFILE_VOLUME_LEVEL3 : 6521 case PROFILE_VOLUME_LEVEL3 :
6449 case PROFILE_KEYPAD_LEVEL3 : printmsg("Level 3\n"); break; 6522 case PROFILE_KEYPAD_LEVEL3 : printmsg("Level 3\n"); break;
6450 case PROFILE_VOLUME_LEVEL4 : printmsg("Level 4\n"); break; 6523 case PROFILE_VOLUME_LEVEL4 : printmsg("Level 4\n"); break;
6451 case PROFILE_VOLUME_LEVEL5 : printmsg("Level 5\n"); break; 6524 case PROFILE_VOLUME_LEVEL5 : printmsg("Level 5\n"); break;
6452 case PROFILE_MESSAGE_NOTONE : 6525 case PROFILE_MESSAGE_NOTONE :
6453 case PROFILE_AUTOANSWER_OFF : 6526 case PROFILE_AUTOANSWER_OFF :
6454 case PROFILE_LIGHTS_OFF : 6527 case PROFILE_LIGHTS_OFF :
6455 case PROFILE_SAVER_OFF : 6528 case PROFILE_SAVER_OFF :
6456 case PROFILE_WARNING_OFF : 6529 case PROFILE_WARNING_OFF :
6457 case PROFILE_CALLALERT_OFF : 6530 case PROFILE_CALLALERT_OFF :
6458 case PROFILE_VIBRATION_OFF : 6531 case PROFILE_VIBRATION_OFF :
6459 case PROFILE_KEYPAD_OFF : printmsg("Off\n"); break; 6532 case PROFILE_KEYPAD_OFF : printmsg("Off\n"); break;
6460 case PROFILE_CALLALERT_RINGING : printmsg("Ringing\n"); break; 6533 case PROFILE_CALLALERT_RINGING : printmsg("Ringing\n"); break;
6461 case PROFILE_CALLALERT_BEEPONCE : 6534 case PROFILE_CALLALERT_BEEPONCE :
6462 case PROFILE_MESSAGE_BEEPONCE : printmsg("Beep once\n"); break; 6535 case PROFILE_MESSAGE_BEEPONCE : printmsg("Beep once\n"); break;
6463 case PROFILE_CALLALERT_RINGONCE : printmsg("Ring once\n");break; 6536 case PROFILE_CALLALERT_RINGONCE : printmsg("Ring once\n");break;
6464 case PROFILE_CALLALERT_ASCENDING : printmsg("Ascending\n"); break; 6537 case PROFILE_CALLALERT_ASCENDING : printmsg("Ascending\n"); break;
6465 case PROFILE_CALLALERT_CALLERGROUPS : printmsg("Caller groups\n");break; 6538 case PROFILE_CALLALERT_CALLERGROUPS : printmsg("Caller groups\n");break;
6466 case PROFILE_MESSAGE_STANDARD : printmsg("Standard\n"); break; 6539 case PROFILE_MESSAGE_STANDARD : printmsg("Standard\n"); break;
6467 case PROFILE_MESSAGE_SPECIAL : printmsg("Special\n"); break; 6540 case PROFILE_MESSAGE_SPECIAL : printmsg("Special\n"); break;
6468 case PROFILE_MESSAGE_ASCENDING : printmsg("Ascending\n"); break; 6541 case PROFILE_MESSAGE_ASCENDING : printmsg("Ascending\n"); break;
6469 case PROFILE_MESSAGE_PERSONAL : printmsg("Personal\n"); break; 6542 case PROFILE_MESSAGE_PERSONAL : printmsg("Personal\n"); break;
6470 case PROFILE_AUTOANSWER_ON : 6543 case PROFILE_AUTOANSWER_ON :
6471 case PROFILE_WARNING_ON : 6544 case PROFILE_WARNING_ON :
6472 case PROFILE_SAVER_ON : 6545 case PROFILE_SAVER_ON :
6473 case PROFILE_VIBRATION_ON : printmsg("On\n"); break; 6546 case PROFILE_VIBRATION_ON : printmsg("On\n"); break;
6474 case PROFILE_VIBRATION_FIRST : printmsg("Vibrate first\n");break; 6547 case PROFILE_VIBRATION_FIRST : printmsg("Vibrate first\n");break;
6475 case PROFILE_LIGHTS_AUTO : printmsg("Auto\n"); break; 6548 case PROFILE_LIGHTS_AUTO : printmsg("Auto\n"); break;
6476 case PROFILE_SAVER_TIMEOUT_5SEC : printmsg("5 seconds\n"); break; 6549 case PROFILE_SAVER_TIMEOUT_5SEC : printmsg("5 seconds\n"); break;
6477 case PROFILE_SAVER_TIMEOUT_20SEC : printmsg("20 seconds\n"); break; 6550 case PROFILE_SAVER_TIMEOUT_20SEC : printmsg("20 seconds\n"); break;
6478 case PROFILE_SAVER_TIMEOUT_1MIN : printmsg("1 minute\n"); break; 6551 case PROFILE_SAVER_TIMEOUT_1MIN : printmsg("1 minute\n"); break;
6479 case PROFILE_SAVER_TIMEOUT_2MIN : printmsg("2 minutes\n");break; 6552 case PROFILE_SAVER_TIMEOUT_2MIN : printmsg("2 minutes\n");break;
6480 case PROFILE_SAVER_TIMEOUT_5MIN : printmsg("5 minutes\n");break; 6553 case PROFILE_SAVER_TIMEOUT_5MIN : printmsg("5 minutes\n");break;
6481 case PROFILE_SAVER_TIMEOUT_10MIN : printmsg("10 minutes\n");break; 6554 case PROFILE_SAVER_TIMEOUT_10MIN : printmsg("10 minutes\n");break;
6482 default : printmsg("UNKNOWN\n"); 6555 default : printmsg("UNKNOWN\n");
6483 } 6556 }
6484 } 6557 }
6485 } 6558 }
6486 printf("\n"); 6559 printf("\n");
6487 } 6560 }
6488 6561
6489 GSM_Terminate(); 6562 GSM_Terminate();
6563
6564 if (Info.Ringtone) free(Info.Ringtone);
6490} 6565}
6491 6566
6492static void GetSpeedDial(int argc, char *argv[]) 6567static void GetSpeedDial(int argc, char *argv[])
6493{ 6568{
6494 GSM_SpeedDial SpeedDial; 6569 GSM_SpeedDial SpeedDial;
6495 GSM_MemoryEntry Phonebook; 6570 GSM_MemoryEntry Phonebook;
6496 int start,stop,Name,Number,Group; 6571 int start,stop,Name,Number,Group;
6497 6572
6498 GetStartStop(&start, &stop, 2, argc, argv); 6573 GetStartStop(&start, &stop, 2, argc, argv);
6499 6574
6500 GSM_Init(true); 6575 GSM_Init(true);
6501 6576
6502 for (i=start;i<=stop;i++) { 6577 for (i=start;i<=stop;i++) {
6503 SpeedDial.Location=i; 6578 SpeedDial.Location=i;
6504 error=Phone->GetSpeedDial(&s,&SpeedDial); 6579 error=Phone->GetSpeedDial(&s,&SpeedDial);
6505 printmsg("%i.",i); 6580 printmsg("%i.",i);
6506 switch (error) { 6581 switch (error) {
6507 case ERR_EMPTY: 6582 case ERR_EMPTY:
6508 printmsg(" speed dial not assigned\n"); 6583 printmsg(" speed dial not assigned\n");
6509 break; 6584 break;
6510 default: 6585 default:
6511 Print_Error(error); 6586 Print_Error(error);
6512 6587
6513 Phonebook.Location= SpeedDial.MemoryLocation; 6588 Phonebook.Location= SpeedDial.MemoryLocation;
6514 Phonebook.MemoryType = SpeedDial.MemoryType; 6589 Phonebook.MemoryType = SpeedDial.MemoryType;
6515 error=Phone->GetMemory(&s,&Phonebook); 6590 error=Phone->GetMemory(&s,&Phonebook);
6516 6591
6517 GSM_PhonebookFindDefaultNameNumberGroup(&Phonebook, &Name, &Number, &Group); 6592 GSM_PhonebookFindDefaultNameNumberGroup(&Phonebook, &Name, &Number, &Group);
6518 6593
6519 if (Name != -1) printmsg(" Name \"%s\",",DecodeUnicodeConsole(Phonebook.Entries[Name].Text)); 6594 if (Name != -1) printmsg(" Name \"%s\",",DecodeUnicodeConsole(Phonebook.Entries[Name].Text));
6520 printmsg(" Number \"%s\"",DecodeUnicodeConsole(Phonebook.Entries[SpeedDial.MemoryNumberID-1].Text)); 6595 printmsg(" Number \"%s\"",DecodeUnicodeConsole(Phonebook.Entries[SpeedDial.MemoryNumberID-1].Text));
6521 } 6596 }
6522 printf("\n"); 6597 printf("\n");
6523 } 6598 }
6524 6599
6525 GSM_Terminate(); 6600 GSM_Terminate();
6526} 6601}
6527 6602
6528static void ResetPhoneSettings(int argc, char *argv[]) 6603static void ResetPhoneSettings(int argc, char *argv[])
6529{ 6604{
6530 GSM_ResetSettingsType Type; 6605 GSM_ResetSettingsType Type;
6531 6606
6532 if (mystrncasecmp(argv[2],"PHONE",0)) { Type = GSM_RESET_PHONESETTINGS; 6607 if (mystrncasecmp(argv[2],"PHONE",0)) { Type = GSM_RESET_PHONESETTINGS;
6533 } else if (mystrncasecmp(argv[2],"UIF",0)) { Type = GSM_RESET_USERINTERFACE; 6608 } else if (mystrncasecmp(argv[2],"UIF",0)) { Type = GSM_RESET_USERINTERFACE;
6534 } else if (mystrncasecmp(argv[2],"ALL",0)) { Type = GSM_RESET_USERINTERFACE_PHONESETTINGS; 6609 } else if (mystrncasecmp(argv[2],"ALL",0)) { Type = GSM_RESET_USERINTERFACE_PHONESETTINGS;
6535 } else if (mystrncasecmp(argv[2],"DEV",0)) { Type = GSM_RESET_DEVICE; 6610 } else if (mystrncasecmp(argv[2],"DEV",0)) { Type = GSM_RESET_DEVICE;
6536 } else if (mystrncasecmp(argv[2],"FACTORY",0)) { Type = GSM_RESET_FULLFACTORY; 6611 } else if (mystrncasecmp(argv[2],"FACTORY",0)) { Type = GSM_RESET_FULLFACTORY;
6537 } else { 6612 } else {
@@ -7934,97 +8009,97 @@ static void NokiaDisplayTest(int argc, char *argv[])
7934 8009
7935static void NokiaGetT9(int argc, char *argv[]) 8010static void NokiaGetT9(int argc, char *argv[])
7936{ 8011{
7937 GSM_Init(true); 8012 GSM_Init(true);
7938 8013
7939#ifdef GSM_ENABLE_NOKIA_DCT3 8014#ifdef GSM_ENABLE_NOKIA_DCT3
7940 DCT3GetT9(argc,argv); 8015 DCT3GetT9(argc,argv);
7941#endif 8016#endif
7942#ifdef GSM_ENABLE_NOKIA_DCT4 8017#ifdef GSM_ENABLE_NOKIA_DCT4
7943 DCT4GetT9(argc, argv); 8018 DCT4GetT9(argc, argv);
7944#endif 8019#endif
7945 8020
7946 GSM_Terminate(); 8021 GSM_Terminate();
7947} 8022}
7948 8023
7949static void NokiaVibraTest(int argc, char *argv[]) 8024static void NokiaVibraTest(int argc, char *argv[])
7950{ 8025{
7951 GSM_Init(true); 8026 GSM_Init(true);
7952 8027
7953#ifdef GSM_ENABLE_NOKIA_DCT3 8028#ifdef GSM_ENABLE_NOKIA_DCT3
7954 DCT3VibraTest(argc,argv); 8029 DCT3VibraTest(argc,argv);
7955#endif 8030#endif
7956#ifdef GSM_ENABLE_NOKIA_DCT4 8031#ifdef GSM_ENABLE_NOKIA_DCT4
7957 DCT4VibraTest(argc, argv); 8032 DCT4VibraTest(argc, argv);
7958#endif 8033#endif
7959 8034
7960 GSM_Terminate(); 8035 GSM_Terminate();
7961} 8036}
7962 8037
7963static GSM_Parameters Parameters[] = { 8038static GSM_Parameters Parameters[] = {
7964 {"--identify", 0, 0, Identify, {H_Info,0}, ""}, 8039 {"--identify", 0, 0, Identify, {H_Info,0}, ""},
7965 {"--version", 0, 0, Version, {H_Other,0}, ""}, 8040 {"--version", 0, 0, Version, {H_Other,0}, ""},
7966 {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""}, 8041 {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""},
7967 {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"}, 8042 {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"},
7968 {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""}, 8043 {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""},
7969 {"--listnetworks", 0, 1, ListNetworks, {H_Network,0}, "[country]"}, 8044 {"--listnetworks", 0, 1, ListNetworks, {H_Network,0}, "[country]"},
7970 {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"}, 8045 {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"},
7971 {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"}, 8046 {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"},
7972 {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"}, 8047 {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"},
7973 {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""}, 8048 {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""},
7974 {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."}, 8049 {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."},
7975 {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."}, 8050 {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."},
7976 {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"}, 8051 {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"},
7977 {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"}, 8052 {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"},
7978 {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"}, 8053 {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"},
7979 {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, 8054 {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"},
7980 {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, 8055 {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"},
7981 {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, 8056 {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"},
7982 {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, 8057 {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, "number"},
7983 {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, 8058 {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""},
7984 {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, 8059 {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""},
7985 {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, 8060 {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""},
7986 {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"}, 8061 {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"},
7987 {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"}, 8062 {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"},
7988 {"--getmemory", 2, 4, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop [-nonempty]]"}, 8063 {"--getmemory", 2, 4, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop [-nonempty]]"},
7989 {"--getallmemory", 1, 2, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"}, 8064 {"--getallmemory", 1, 2, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"},
7990 {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"}, 8065 {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"},
7991 {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"}, 8066 {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"},
7992 {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"}, 8067 {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"},
7993 {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"}, 8068 {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"},
7994 {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"}, 8069 {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"},
7995 {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"}, 8070 {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"},
7996 {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"}, 8071 {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"},
7997 {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""}, 8072 {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""},
7998 {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""}, 8073 {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""},
7999 {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""}, 8074 {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""},
8000 8075
8001 #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]" 8076 #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]"
8002 #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]" 8077 #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]"
8003 #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]" 8078 #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]"
8004 #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]" 8079 #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]"
8005 #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]" 8080 #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]"
8006 #define SMS_ANIMATION_OPTIONS"" 8081 #define SMS_ANIMATION_OPTIONS""
8007 #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]" 8082 #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]"
8008 #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]" 8083 #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]"
8009 #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]" 8084 #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]"
8010 #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]" 8085 #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]"
8011 8086
8012 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, 8087 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS},
8013 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8088 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8014 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, 8089 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS},
8015 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8090 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8016 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, 8091 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS},
8017 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, 8092 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS},
8018 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8093 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8019 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPINDICATOR URL Title " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8094 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPINDICATOR URL Title " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8020#ifdef GSM_ENABLE_BACKUP 8095#ifdef GSM_ENABLE_BACKUP
8021 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8096 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8022 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8097 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8023 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8098 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8024 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8099 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8025 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8100 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8026 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, 8101 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS},
8027#endif 8102#endif
8028 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS}, 8103 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS},
8029 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, 8104 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS},
8030 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, 8105 {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS},
diff --git a/gammu/emb/gammu/smsd/s_files.c b/gammu/emb/gammu/smsd/s_files.c
index b791e58..e1c626f 100644
--- a/gammu/emb/gammu/smsd/s_files.c
+++ b/gammu/emb/gammu/smsd/s_files.c
@@ -21,97 +21,97 @@
21static GSM_Error SMSDFiles_SaveInboxSMS(GSM_MultiSMSMessage sms, GSM_SMSDConfig *Config) 21static GSM_Error SMSDFiles_SaveInboxSMS(GSM_MultiSMSMessage sms, GSM_SMSDConfig *Config)
22{ 22{
23 GSM_Errorerror = ERR_NONE; 23 GSM_Errorerror = ERR_NONE;
24 int i,j; 24 int i,j;
25 unsigned char FileName[100], FullName[400], ext[4], buffer[64],buffer2[400]; 25 unsigned char FileName[100], FullName[400], ext[4], buffer[64],buffer2[400];
26 bool done; 26 bool done;
27 FILE *file; 27 FILE *file;
28#ifdef GSM_ENABLE_BACKUP 28#ifdef GSM_ENABLE_BACKUP
29 GSM_SMS_Backup backup; 29 GSM_SMS_Backup backup;
30#endif 30#endif
31 31
32 j = 0; 32 j = 0;
33 done = false; 33 done = false;
34 for (i=0;i<sms.Number && !done;i++) { 34 for (i=0;i<sms.Number && !done;i++) {
35 strcpy(ext, "txt"); 35 strcpy(ext, "txt");
36 if (sms.SMS[i].Coding == SMS_Coding_8bit) strcpy(ext, "bin"); 36 if (sms.SMS[i].Coding == SMS_Coding_8bit) strcpy(ext, "bin");
37 DecodeUnicode(sms.SMS[i].Number,buffer2); 37 DecodeUnicode(sms.SMS[i].Number,buffer2);
38 /* we loop on yy for the first SMS assuming that if xxxx_yy_00.ext is absent, 38 /* we loop on yy for the first SMS assuming that if xxxx_yy_00.ext is absent,
39 any xxxx_yy_01,02, must be garbage, that can be overwritten */ 39 any xxxx_yy_01,02, must be garbage, that can be overwritten */
40 file = NULL; 40 file = NULL;
41 do { 41 do {
42 sprintf(FileName, 42 sprintf(FileName,
43 "IN%02d%02d%02d_%02d%02d%02d_%02i_%s_%02i.%s", 43 "IN%02d%02d%02d_%02d%02d%02d_%02i_%s_%02i.%s",
44 sms.SMS[i].DateTime.Year, sms.SMS[i].DateTime.Month, sms.SMS[i].DateTime.Day, 44 sms.SMS[i].DateTime.Year, sms.SMS[i].DateTime.Month, sms.SMS[i].DateTime.Day,
45 sms.SMS[i].DateTime.Hour, sms.SMS[i].DateTime.Minute, sms.SMS[i].DateTime.Second, 45 sms.SMS[i].DateTime.Hour, sms.SMS[i].DateTime.Minute, sms.SMS[i].DateTime.Second,
46 j, buffer2, i, ext); 46 j, buffer2, i, ext);
47 strcpy(FullName, Config->inboxpath); 47 strcpy(FullName, Config->inboxpath);
48 strcat(FullName, FileName); 48 strcat(FullName, FileName);
49 if (file) fclose(file); 49 if (file) fclose(file);
50 file = fopen(FullName, "r"); 50 file = fopen(FullName, "r");
51 } while ((i == 0) && (file && (++j < 100))); 51 } while ((i == 0) && (file && (++j < 100)));
52 if (file) { 52 if (file) {
53 fclose(file); 53 fclose(file);
54 if (i == 0) { 54 if (i == 0) {
55 WriteSMSDLog("Cannot save %s. No available file names", FileName); 55 WriteSMSDLog("Cannot save %s. No available file names", FileName);
56 return ERR_CANTOPENFILE; 56 return ERR_CANTOPENFILE;
57 } 57 }
58 } 58 }
59 errno = 0; 59 errno = 0;
60 60
61 if ((sms.SMS[i].PDU == SMS_Status_Report) && mystrncasecmp(Config->deliveryreport, "log", 3)) { 61 if ((sms.SMS[i].PDU == SMS_Status_Report) && mystrncasecmp(Config->deliveryreport, "log", 3)) {
62 strcpy(buffer, DecodeUnicodeString(sms.SMS[i].Number)); 62 strcpy(buffer, DecodeUnicodeString(sms.SMS[i].Number));
63 WriteSMSDLog("Delivery report: %s to %s", DecodeUnicodeString(sms.SMS[i].Text), buffer); 63 WriteSMSDLog("Delivery report: %s to %s", DecodeUnicodeString(sms.SMS[i].Text), buffer);
64 } else { 64 } else {
65#ifdef GSM_ENABLE_BACKUP 65#ifdef GSM_ENABLE_BACKUP
66 if (mystrncasecmp(Config->inboxformat, "detail", 0)) { 66 if (mystrncasecmp(Config->inboxformat, "detail", 0)) {
67 for (j=0;j<sms.Number;j++) backup.SMS[j] = &sms.SMS[j]; 67 for (j=0;j<sms.Number;j++) backup.SMS[j] = &sms.SMS[j];
68 backup.SMS[sms.Number] = NULL; 68 backup.SMS[sms.Number] = NULL;
69 error = GSM_SaveSMSBackupFile(FullName, &backup); 69 error = GSM_AddSMSBackupFile(FullName, &backup);
70 done = true; 70 done = true;
71 } 71 }
72#endif 72#endif
73 if (!mystrncasecmp(Config->inboxformat, "detail", 0)) { 73 if (!mystrncasecmp(Config->inboxformat, "detail", 0)) {
74 file = fopen(FullName, "wb"); 74 file = fopen(FullName, "wb");
75 if (file) { 75 if (file) {
76 switch (sms.SMS[i].Coding) { 76 switch (sms.SMS[i].Coding) {
77 case SMS_Coding_Unicode: 77 case SMS_Coding_Unicode:
78 case SMS_Coding_Default: 78 case SMS_Coding_Default:
79 79
80 DecodeUnicode(sms.SMS[i].Text,buffer2); 80 DecodeUnicode(sms.SMS[i].Text,buffer2);
81 if (mystrncasecmp(Config->inboxformat, "unicode", 0)) { 81 if (mystrncasecmp(Config->inboxformat, "unicode", 0)) {
82 buffer[0] = 0xFE; 82 buffer[0] = 0xFE;
83 buffer[1] = 0xFF; 83 buffer[1] = 0xFF;
84 fwrite(buffer,1,2,file); 84 fwrite(buffer,1,2,file);
85 fwrite(sms.SMS[i].Text,1,strlen(buffer2)*2,file); 85 fwrite(sms.SMS[i].Text,1,strlen(buffer2)*2,file);
86 } else { 86 } else {
87 fwrite(buffer2,1,strlen(buffer2),file); 87 fwrite(buffer2,1,strlen(buffer2),file);
88 } 88 }
89 break; 89 break;
90 case SMS_Coding_8bit: 90 case SMS_Coding_8bit:
91 fwrite(sms.SMS[i].Text,1,sms.SMS[i].Length,file); 91 fwrite(sms.SMS[i].Text,1,sms.SMS[i].Length,file);
92 } 92 }
93 fclose(file); 93 fclose(file);
94 } else error = ERR_CANTOPENFILE; 94 } else error = ERR_CANTOPENFILE;
95 } 95 }
96 if (error == ERR_NONE) { 96 if (error == ERR_NONE) {
97 WriteSMSDLog("%s %s", (sms.SMS[i].PDU == SMS_Status_Report?"Delivery report":"Received"), FileName); 97 WriteSMSDLog("%s %s", (sms.SMS[i].PDU == SMS_Status_Report?"Delivery report":"Received"), FileName);
98 } else { 98 } else {
99 WriteSMSDLog("Cannot save %s (%i)", FileName, errno); 99 WriteSMSDLog("Cannot save %s (%i)", FileName, errno);
100 return ERR_CANTOPENFILE; 100 return ERR_CANTOPENFILE;
101 } 101 }
102 } 102 }
103 } 103 }
104 return ERR_NONE; 104 return ERR_NONE;
105} 105}
106 106
107/* Find one multi SMS to sending and return it (or return ERR_EMPTY) 107/* Find one multi SMS to sending and return it (or return ERR_EMPTY)
108 * There is also set ID for SMS 108 * There is also set ID for SMS
109 * File extension convention: 109 * File extension convention:
110 * OUTxxxxx.txt : normal text SMS 110 * OUTxxxxx.txt : normal text SMS
111 * Options appended to the extension applying to this SMS only: 111 * Options appended to the extension applying to this SMS only:
112 * d: delivery report requested 112 * d: delivery report requested
113 * f: flash SMS 113 * f: flash SMS
114 * b: WAP bookmark as name,URL 114 * b: WAP bookmark as name,URL
115 * e.g. OUTG20040620_193810_123_+4512345678_xpq.txtdf 115 * e.g. OUTG20040620_193810_123_+4512345678_xpq.txtdf
116 * is a flash text SMS requesting delivery reports 116 * is a flash text SMS requesting delivery reports
117 */ 117 */
diff --git a/gammu/emb/gammu/smsd/smsdcore.c b/gammu/emb/gammu/smsd/smsdcore.c
index cc9accc..e69a6e7 100644
--- a/gammu/emb/gammu/smsd/smsdcore.c
+++ b/gammu/emb/gammu/smsd/smsdcore.c
@@ -65,101 +65,101 @@ void WriteSMSDLog(char *format, ...)
65 va_start(argp, format); 65 va_start(argp, format);
66 result = vsprintf(Buffer,GetMsg(s.msg,format),argp); 66 result = vsprintf(Buffer,GetMsg(s.msg,format),argp);
67 va_end(argp); 67 va_end(argp);
68 68
69 GSM_GetCurrentDateTime(&date_time); 69 GSM_GetCurrentDateTime(&date_time);
70 70
71 fprintf(smsd_log_file,"%s %4d/%02d/%02d %02d:%02d:%02d : %s\n", 71 fprintf(smsd_log_file,"%s %4d/%02d/%02d %02d:%02d:%02d : %s\n",
72 DayOfWeek(date_time.Year, date_time.Month, date_time.Day), 72 DayOfWeek(date_time.Year, date_time.Month, date_time.Day),
73 date_time.Year, date_time.Month, date_time.Day, 73 date_time.Year, date_time.Month, date_time.Day,
74 date_time.Hour, date_time.Minute, date_time.Second,Buffer); 74 date_time.Hour, date_time.Minute, date_time.Second,Buffer);
75 fflush(smsd_log_file); 75 fflush(smsd_log_file);
76 } 76 }
77} 77}
78 78
79void SMSD_ReadConfig(char *filename, GSM_SMSDConfig *Config, bool log, char *service) 79void SMSD_ReadConfig(char *filename, GSM_SMSDConfig *Config, bool log, char *service)
80{ 80{
81 INI_Section *smsdcfgfile = NULL; 81 INI_Section *smsdcfgfile = NULL;
82 GSM_Config smsdcfg; 82 GSM_Config smsdcfg;
83 unsigned char *str; 83 unsigned char *str;
84 static unsigned charemptyPath[1] = "\0"; 84 static unsigned charemptyPath[1] = "\0";
85 85
86 smsdcfgfile=INI_ReadFile(filename, false); 86 smsdcfgfile=INI_ReadFile(filename, false);
87 if (smsdcfgfile==NULL) { 87 if (smsdcfgfile==NULL) {
88 fprintf(stderr,"Can't find file \"%s\"\n",filename); 88 fprintf(stderr,"Can't find file \"%s\"\n",filename);
89 exit(-1); 89 exit(-1);
90 } 90 }
91 91
92 Config->logfilename=INI_GetValue(smsdcfgfile, "smsd", "logfile", false); 92 Config->logfilename=INI_GetValue(smsdcfgfile, "smsd", "logfile", false);
93 if (Config->logfilename != NULL) { 93 if (Config->logfilename != NULL) {
94 smsd_log_file=fopen(Config->logfilename,"ab"); 94 smsd_log_file=fopen(Config->logfilename,"ab");
95 if (smsd_log_file == NULL) { 95 if (smsd_log_file == NULL) {
96 fprintf(stderr,"Can't open file \"%s\"\n",Config->logfilename); 96 fprintf(stderr,"Can't open file \"%s\"\n",Config->logfilename);
97 exit(-1); 97 exit(-1);
98 } 98 }
99 fprintf(stderr,"Log filename is \"%s\"\n",Config->logfilename); 99 fprintf(stderr,"Log filename is \"%s\"\n",Config->logfilename);
100 } 100 }
101 if (log) WriteSMSDLog("Start GAMMU smsd"); 101 if (log) WriteSMSDLog("Start GAMMU smsd");
102 102
103 /* Include Numbers used, because we don't want create new variable */ 103 /* Include Numbers used, because we don't want create new variable */
104 Config->IncludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "gammu", false); 104 Config->IncludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "gammu", false);
105 if (Config->IncludeNumbers) { 105 if (Config->IncludeNumbers) {
106 GSM_ReadConfig(smsdcfgfile, &smsdcfg, 0); 106 GSM_ReadConfig(smsdcfgfile, &smsdcfg, 0);
107 memcpy(&s.Config,&smsdcfg,sizeof(GSM_Config)); 107 memcpy(&s.Config,&smsdcfg,sizeof(GSM_Config));
108 error=GSM_SetDebugFile(s.Config[0].DebugFile, &di); 108 error=GSM_SetDebugFile(s.Config[0].DebugFile, &di);
109 } 109 }
110 110
111 Config->PINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false); 111 Config->PINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false);
112 if (Config->PINCode == NULL) { 112 if (Config->PINCode == NULL) {
113 if (log) WriteSMSDLog("No PIN code in %s file",filename); 113 if (log) WriteSMSDLog("Warning: No PIN code in %s file",filename);
114 fprintf(stderr,"No PIN code in %s file\n",filename); 114 fprintf(stderr,"Warning: No PIN code in %s file\n",filename);
115 exit(-1); 115 } else {
116 if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode);
116 } 117 }
117 if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode);
118 118
119 str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false); 119 str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false);
120 if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1; 120 if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1;
121 str = INI_GetValue(smsdcfgfile, "smsd", "sendtimeout", false); 121 str = INI_GetValue(smsdcfgfile, "smsd", "sendtimeout", false);
122 if (str) Config->sendtimeout=atoi(str); else Config->sendtimeout = 10; 122 if (str) Config->sendtimeout=atoi(str); else Config->sendtimeout = 10;
123 str = INI_GetValue(smsdcfgfile, "smsd", "receivefrequency", false); 123 str = INI_GetValue(smsdcfgfile, "smsd", "receivefrequency", false);
124 if (str) Config->receivefrequency=atoi(str); else Config->receivefrequency = 0; 124 if (str) Config->receivefrequency=atoi(str); else Config->receivefrequency = 0;
125 str = INI_GetValue(smsdcfgfile, "smsd", "resetfrequency", false); 125 str = INI_GetValue(smsdcfgfile, "smsd", "resetfrequency", false);
126 if (str) Config->resetfrequency=atoi(str); else Config->resetfrequency = 0; 126 if (str) Config->resetfrequency=atoi(str); else Config->resetfrequency = 0;
127 if (log) WriteSMSDLog("commtimeout=%i, sendtimeout=%i, receivefrequency=%i, resetfrequency=%i", 127 if (log) WriteSMSDLog("commtimeout=%i, sendtimeout=%i, receivefrequency=%i, resetfrequency=%i",
128 Config->commtimeout, Config->sendtimeout, Config->receivefrequency, Config->resetfrequency); 128 Config->commtimeout, Config->sendtimeout, Config->receivefrequency, Config->resetfrequency);
129 129
130 Config->deliveryreport = INI_GetValue(smsdcfgfile, "smsd", "deliveryreport", false); 130 Config->deliveryreport = INI_GetValue(smsdcfgfile, "smsd", "deliveryreport", false);
131 if (Config->deliveryreport == NULL || (!mystrncasecmp(Config->deliveryreport, "log", 3) && !mystrncasecmp(Config->deliveryreport, "sms", 3))) { 131 if (Config->deliveryreport == NULL || (!mystrncasecmp(Config->deliveryreport, "log", 3) && !mystrncasecmp(Config->deliveryreport, "sms", 3))) {
132 Config->deliveryreport = "no"; 132 Config->deliveryreport = "no";
133 } 133 }
134 if (log) WriteSMSDLog("deliveryreport = %s", Config->deliveryreport); 134 if (log) WriteSMSDLog("deliveryreport = %s", Config->deliveryreport);
135 135
136 Config->PhoneID = INI_GetValue(smsdcfgfile, "smsd", "phoneid", false); 136 Config->PhoneID = INI_GetValue(smsdcfgfile, "smsd", "phoneid", false);
137 if (Config->PhoneID == NULL) Config->PhoneID = ""; 137 if (Config->PhoneID == NULL) Config->PhoneID = "";
138 if (log) WriteSMSDLog("phoneid = %s", Config->PhoneID); 138 if (log) WriteSMSDLog("phoneid = %s", Config->PhoneID);
139 139
140 if (!strcmp(service,"FILES")) { 140 if (!strcmp(service,"FILES")) {
141 Config->inboxpath=INI_GetValue(smsdcfgfile, "smsd", "inboxpath", false); 141 Config->inboxpath=INI_GetValue(smsdcfgfile, "smsd", "inboxpath", false);
142 if (Config->inboxpath == NULL) Config->inboxpath = emptyPath; 142 if (Config->inboxpath == NULL) Config->inboxpath = emptyPath;
143 143
144 Config->inboxformat=INI_GetValue(smsdcfgfile, "smsd", "inboxformat", false); 144 Config->inboxformat=INI_GetValue(smsdcfgfile, "smsd", "inboxformat", false);
145 if (Config->inboxformat == NULL || (!mystrncasecmp(Config->inboxformat, "detail", 6) && !mystrncasecmp(Config->inboxformat, "unicode", 7))) { 145 if (Config->inboxformat == NULL || (!mystrncasecmp(Config->inboxformat, "detail", 6) && !mystrncasecmp(Config->inboxformat, "unicode", 7))) {
146 Config->inboxformat = "standard"; 146 Config->inboxformat = "standard";
147 } 147 }
148 if (log) WriteSMSDLog("Inbox is \"%s\" with format \"%s\"", Config->inboxpath, Config->inboxformat); 148 if (log) WriteSMSDLog("Inbox is \"%s\" with format \"%s\"", Config->inboxpath, Config->inboxformat);
149 149
150 Config->outboxpath=INI_GetValue(smsdcfgfile, "smsd", "outboxpath", false); 150 Config->outboxpath=INI_GetValue(smsdcfgfile, "smsd", "outboxpath", false);
151 if (Config->outboxpath == NULL) Config->outboxpath = emptyPath; 151 if (Config->outboxpath == NULL) Config->outboxpath = emptyPath;
152 152
153 Config->transmitformat=INI_GetValue(smsdcfgfile, "smsd", "transmitformat", false); 153 Config->transmitformat=INI_GetValue(smsdcfgfile, "smsd", "transmitformat", false);
154 if (Config->transmitformat == NULL || (!mystrncasecmp(Config->transmitformat, "auto", 4) && !mystrncasecmp(Config->transmitformat, "unicode", 7))) { 154 if (Config->transmitformat == NULL || (!mystrncasecmp(Config->transmitformat, "auto", 4) && !mystrncasecmp(Config->transmitformat, "unicode", 7))) {
155 Config->transmitformat = "7bit"; 155 Config->transmitformat = "7bit";
156 } 156 }
157 if (log) WriteSMSDLog("Outbox is \"%s\" with transmission format \"%s\"", Config->outboxpath, Config->transmitformat); 157 if (log) WriteSMSDLog("Outbox is \"%s\" with transmission format \"%s\"", Config->outboxpath, Config->transmitformat);
158 158
159 Config->sentsmspath=INI_GetValue(smsdcfgfile, "smsd", "sentsmspath", false); 159 Config->sentsmspath=INI_GetValue(smsdcfgfile, "smsd", "sentsmspath", false);
160 if (Config->sentsmspath == NULL) Config->sentsmspath = Config->outboxpath; 160 if (Config->sentsmspath == NULL) Config->sentsmspath = Config->outboxpath;
161 if (log) WriteSMSDLog("Sent SMS moved to \"%s\"",Config->sentsmspath); 161 if (log) WriteSMSDLog("Sent SMS moved to \"%s\"",Config->sentsmspath);
162 162
163 Config->errorsmspath=INI_GetValue(smsdcfgfile, "smsd", "errorsmspath", false); 163 Config->errorsmspath=INI_GetValue(smsdcfgfile, "smsd", "errorsmspath", false);
164 if (Config->errorsmspath == NULL) Config->errorsmspath = Config->sentsmspath; 164 if (Config->errorsmspath == NULL) Config->errorsmspath = Config->sentsmspath;
165 if (log) WriteSMSDLog("SMS with errors moved to \"%s\"",Config->errorsmspath); 165 if (log) WriteSMSDLog("SMS with errors moved to \"%s\"",Config->errorsmspath);
@@ -172,106 +172,111 @@ void SMSD_ReadConfig(char *filename, GSM_SMSDConfig *Config, bool log, char *ser
172 Config->user = INI_GetValue(smsdcfgfile, "smsd", "user", false); 172 Config->user = INI_GetValue(smsdcfgfile, "smsd", "user", false);
173 if (Config->user == NULL) Config->user="root"; 173 if (Config->user == NULL) Config->user="root";
174 Config->password = INI_GetValue(smsdcfgfile, "smsd", "password", false); 174 Config->password = INI_GetValue(smsdcfgfile, "smsd", "password", false);
175 if (Config->password == NULL) Config->password=""; 175 if (Config->password == NULL) Config->password="";
176 Config->PC = INI_GetValue(smsdcfgfile, "smsd", "pc", false); 176 Config->PC = INI_GetValue(smsdcfgfile, "smsd", "pc", false);
177 if (Config->PC == NULL) Config->PC="localhost"; 177 if (Config->PC == NULL) Config->PC="localhost";
178 Config->database = INI_GetValue(smsdcfgfile, "smsd", "database", false); 178 Config->database = INI_GetValue(smsdcfgfile, "smsd", "database", false);
179 if (Config->database == NULL) Config->database="sms"; 179 if (Config->database == NULL) Config->database="sms";
180 } 180 }
181#endif 181#endif
182 182
183 Config->IncludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "include_numbers", false); 183 Config->IncludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "include_numbers", false);
184 Config->ExcludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "exclude_numbers", false); 184 Config->ExcludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "exclude_numbers", false);
185 if (Config->IncludeNumbers != NULL) { 185 if (Config->IncludeNumbers != NULL) {
186 if (log) WriteSMSDLog("Include numbers available"); 186 if (log) WriteSMSDLog("Include numbers available");
187 } 187 }
188 if (Config->ExcludeNumbers != NULL) { 188 if (Config->ExcludeNumbers != NULL) {
189 if (Config->IncludeNumbers == NULL) { 189 if (Config->IncludeNumbers == NULL) {
190 if (log) WriteSMSDLog("Exclude numbers available"); 190 if (log) WriteSMSDLog("Exclude numbers available");
191 } else { 191 } else {
192 if (log) WriteSMSDLog("Exclude numbers available, but IGNORED"); 192 if (log) WriteSMSDLog("Exclude numbers available, but IGNORED");
193 } 193 }
194 } 194 }
195 195
196 Config->retries = 0; 196 Config->retries = 0;
197 Config->prevSMSID[0] = 0; 197 Config->prevSMSID[0] = 0;
198 Config->SMSC.Location = 0; 198 Config->SMSC.Location = 0;
199 Config->relativevalidity = -1; 199 Config->relativevalidity = -1;
200} 200}
201 201
202bool SMSD_CheckSecurity(GSM_SMSDConfig *Config) 202bool SMSD_CheckSecurity(GSM_SMSDConfig *Config)
203{ 203{
204 GSM_SecurityCode SecurityCode; 204 GSM_SecurityCode SecurityCode;
205 GSM_Error error; 205 GSM_Error error;
206 206
207 /* Need PIN ? */ 207 /* Need PIN ? */
208 error=Phone->GetSecurityStatus(&s,&SecurityCode.Type); 208 error=Phone->GetSecurityStatus(&s,&SecurityCode.Type);
209 /* Unknown error */ 209 /* Unknown error */
210 if (error != ERR_NOTSUPPORTED && error != ERR_NONE) { 210 if (error != ERR_NOTSUPPORTED && error != ERR_NONE) {
211 WriteSMSDLog("Error getting security status (%i)", error); 211 WriteSMSDLog("Error getting security status (%i)", error);
212 return false; 212 return false;
213 } 213 }
214 /* No supported - do not check more */ 214 /* No supported - do not check more */
215 if (error == ERR_NOTSUPPORTED) return true; 215 if (error == ERR_NOTSUPPORTED) return true;
216 216
217 /* If PIN, try to enter */ 217 /* If PIN, try to enter */
218 switch (SecurityCode.Type) { 218 switch (SecurityCode.Type) {
219 case SEC_Pin: 219 case SEC_Pin:
220 WriteSMSDLog("Trying to enter PIN"); 220 if (Config->PINCode==NULL) {
221 strcpy(SecurityCode.Code,Config->PINCode); 221 WriteSMSDLog("Warning: no PIN in config");
222 error=Phone->EnterSecurityCode(&s,SecurityCode);
223 if (error == ERR_SECURITYERROR) {
224 GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1);
225 }
226 if (error != ERR_NONE) {
227 WriteSMSDLog("Error entering PIN (%i)", error);
228 return false; 222 return false;
229 } 223 } else {
224 WriteSMSDLog("Trying to enter PIN");
225 strcpy(SecurityCode.Code,Config->PINCode);
226 error=Phone->EnterSecurityCode(&s,SecurityCode);
227 if (error == ERR_SECURITYERROR) {
228 GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1);
229 }
230 if (error != ERR_NONE) {
231 WriteSMSDLog("Error entering PIN (%i)", error);
232 return false;
233 }
234 }
230 break; 235 break;
231 case SEC_SecurityCode: 236 case SEC_SecurityCode:
232 case SEC_Pin2: 237 case SEC_Pin2:
233 case SEC_Puk: 238 case SEC_Puk:
234 case SEC_Puk2: 239 case SEC_Puk2:
235 GSM_Terminate_SMSD("ERROR: phone requires not supported code type", 0, true, -1); 240 GSM_Terminate_SMSD("ERROR: phone requires not supported code type", 0, true, -1);
236 case SEC_None: 241 case SEC_None:
237 break; 242 break;
238 } 243 }
239 return true; 244 return true;
240} 245}
241 246
242bool SMSD_ReadDeleteSMS(GSM_SMSDConfig *Config, GSM_SMSDService *Service) 247bool SMSD_ReadDeleteSMS(GSM_SMSDConfig *Config, GSM_SMSDService *Service)
243{ 248{
244 bool start,process; 249 bool start,process;
245 GSM_MultiSMSMessage sms; 250 GSM_MultiSMSMessage sms;
246 unsigned char buffer[100]; 251 unsigned char buffer[100];
247 GSM_Error error=ERR_NONE; 252 GSM_Error error=ERR_NONE;
248 INI_Entry *e; 253 INI_Entry *e;
249 int i; 254 int i;
250 255
251 start=true; 256 start=true;
252 while (error == ERR_NONE && !gshutdown) { 257 while (error == ERR_NONE && !gshutdown) {
253 sms.SMS[0].Folder=0x00; 258 sms.SMS[0].Folder=0x00;
254 error=Phone->GetNextSMS(&s, &sms, start); 259 error=Phone->GetNextSMS(&s, &sms, start);
255 switch (error) { 260 switch (error) {
256 case ERR_EMPTY: 261 case ERR_EMPTY:
257 break; 262 break;
258 case ERR_NONE: 263 case ERR_NONE:
259 /* Not Inbox SMS - exit */ 264 /* Not Inbox SMS - exit */
260 if (!sms.SMS[0].InboxFolder) break; 265 if (!sms.SMS[0].InboxFolder) break;
261 process=true; 266 process=true;
262 DecodeUnicode(sms.SMS[0].Number,buffer); 267 DecodeUnicode(sms.SMS[0].Number,buffer);
263 if (Config->IncludeNumbers != NULL) { 268 if (Config->IncludeNumbers != NULL) {
264 e=Config->IncludeNumbers; 269 e=Config->IncludeNumbers;
265 process=false; 270 process=false;
266 while (1) { 271 while (1) {
267 if (e == NULL) break; 272 if (e == NULL) break;
268 if (strcmp(buffer,e->EntryValue)==0) { 273 if (strcmp(buffer,e->EntryValue)==0) {
269 process=true; 274 process=true;
270 break; 275 break;
271 } 276 }
272 e = e->Prev; 277 e = e->Prev;
273 } 278 }
274 } else if (Config->ExcludeNumbers != NULL) { 279 } else if (Config->ExcludeNumbers != NULL) {
275 e=Config->ExcludeNumbers; 280 e=Config->ExcludeNumbers;
276 process=true; 281 process=true;
277 while (1) { 282 while (1) {