62 files changed, 1959 insertions, 312 deletions
diff --git a/gammu/emb/common/common.pro b/gammu/emb/common/common.pro index 0e719ee..797199b 100644 --- a/gammu/emb/common/common.pro +++ b/gammu/emb/common/common.pro | |||
@@ -135,48 +135,49 @@ service/gsmnet.c \ | |||
135 | service/backup/gsmback.c \ | 135 | service/backup/gsmback.c \ |
136 | service/backup/backldif.c \ | 136 | service/backup/backldif.c \ |
137 | service/backup/backlmb.c \ | 137 | service/backup/backlmb.c \ |
138 | service/backup/backtext.c \ | 138 | service/backup/backtext.c \ |
139 | service/backup/backvcs.c \ | 139 | service/backup/backvcs.c \ |
140 | service/backup/backvcf.c \ | 140 | service/backup/backvcf.c \ |
141 | service/backup/backics.c \ | 141 | service/backup/backics.c \ |
142 | device/bluetoth/affix.c \ | 142 | device/bluetoth/affix.c \ |
143 | device/bluetoth/bluez.c \ | 143 | device/bluetoth/bluez.c \ |
144 | device/bluetoth/blue_w32.c \ | 144 | device/bluetoth/blue_w32.c \ |
145 | device/bluetoth/bluetoth.c \ | 145 | device/bluetoth/bluetoth.c \ |
146 | device/serial/ser_djg.c \ | 146 | device/serial/ser_djg.c \ |
147 | device/irda/irda.c \ | 147 | device/irda/irda.c \ |
148 | device/devfunc.c \ | 148 | device/devfunc.c \ |
149 | protocol/at/at.c \ | 149 | protocol/at/at.c \ |
150 | protocol/alcatel/alcabus.c \ | 150 | protocol/alcatel/alcabus.c \ |
151 | protocol/nokia/mbus2.c \ | 151 | protocol/nokia/mbus2.c \ |
152 | protocol/nokia/fbus2.c \ | 152 | protocol/nokia/fbus2.c \ |
153 | protocol/nokia/phonet.c \ | 153 | protocol/nokia/phonet.c \ |
154 | protocol/obex/obex.c \ | 154 | protocol/obex/obex.c \ |
155 | protocol/symbian/mrouter.c \ | 155 | protocol/symbian/mrouter.c \ |
156 | phone/pfunc.c \ | 156 | phone/pfunc.c \ |
157 | phone/at/atgen.c \ | 157 | phone/at/atgen.c \ |
158 | phone/at/siemens.c \ | 158 | phone/at/siemens.c \ |
159 | phone/at/samsung.c \ | ||
159 | phone/at/sonyeric.c \ | 160 | phone/at/sonyeric.c \ |
160 | phone/alcatel/alcatel.c \ | 161 | phone/alcatel/alcatel.c \ |
161 | phone/nokia/dct3/n6110.c \ | 162 | phone/nokia/dct3/n6110.c \ |
162 | phone/nokia/dct3/n7110.c \ | 163 | phone/nokia/dct3/n7110.c \ |
163 | phone/nokia/dct3/n9210.c \ | 164 | phone/nokia/dct3/n9210.c \ |
164 | phone/nokia/dct3/dct3func.c \ | 165 | phone/nokia/dct3/dct3func.c \ |
165 | phone/nokia/dct4/n3320.c \ | 166 | phone/nokia/dct4/n3320.c \ |
166 | phone/nokia/dct4/n3650.c \ | 167 | phone/nokia/dct4/n3650.c \ |
167 | phone/nokia/dct4/n6510.c \ | 168 | phone/nokia/dct4/n6510.c \ |
168 | phone/nokia/dct4/dct4func.c \ | 169 | phone/nokia/dct4/dct4func.c \ |
169 | phone/nokia/nauto.c \ | 170 | phone/nokia/nauto.c \ |
170 | phone/nokia/nfunc.c \ | 171 | phone/nokia/nfunc.c \ |
171 | phone/nokia/nfuncold.c \ | 172 | phone/nokia/nfuncold.c \ |
172 | phone/obex/obexgen.c \ | 173 | phone/obex/obexgen.c \ |
173 | phone/symbian/mroutgen.c | 174 | phone/symbian/mroutgen.c |
174 | 175 | ||
175 | DEFINES += DESKTOP_VERSION | 176 | DEFINES += DESKTOP_VERSION |
176 | TARGET = microgammu | 177 | TARGET = microgammu |
177 | CONFIG = warn_off release console | 178 | CONFIG = warn_off release console |
178 | DESTDIR = ../../../bin | 179 | DESTDIR = ../../../bin |
179 | OBJECTS_DIR = obj/unix | 180 | OBJECTS_DIR = obj/unix |
180 | MOC_DIR = moc/unix | 181 | MOC_DIR = moc/unix |
181 | 182 | ||
182 | unix: { | 183 | unix: { |
diff --git a/gammu/emb/common/commonE.pro b/gammu/emb/common/commonE.pro index a36947b..f5b559d 100644 --- a/gammu/emb/common/commonE.pro +++ b/gammu/emb/common/commonE.pro | |||
@@ -136,45 +136,46 @@ service/backup/gsmback.c \ | |||
136 | service/backup/backldif.c \ | 136 | service/backup/backldif.c \ |
137 | service/backup/backlmb.c \ | 137 | service/backup/backlmb.c \ |
138 | service/backup/backtext.c \ | 138 | service/backup/backtext.c \ |
139 | service/backup/backvcs.c \ | 139 | service/backup/backvcs.c \ |
140 | service/backup/backvcf.c \ | 140 | service/backup/backvcf.c \ |
141 | service/backup/backics.c \ | 141 | service/backup/backics.c \ |
142 | device/bluetoth/affix.c \ | 142 | device/bluetoth/affix.c \ |
143 | device/bluetoth/bluez.c \ | 143 | device/bluetoth/bluez.c \ |
144 | device/bluetoth/blue_w32.c \ | 144 | device/bluetoth/blue_w32.c \ |
145 | device/bluetoth/bluetoth.c \ | 145 | device/bluetoth/bluetoth.c \ |
146 | device/serial/ser_unx.c \ | 146 | device/serial/ser_unx.c \ |
147 | device/serial/ser_djg.c \ | 147 | device/serial/ser_djg.c \ |
148 | device/irda/irda.c \ | 148 | device/irda/irda.c \ |
149 | device/devfunc.c \ | 149 | device/devfunc.c \ |
150 | protocol/at/at.c \ | 150 | protocol/at/at.c \ |
151 | protocol/alcatel/alcabus.c \ | 151 | protocol/alcatel/alcabus.c \ |
152 | protocol/nokia/mbus2.c \ | 152 | protocol/nokia/mbus2.c \ |
153 | protocol/nokia/fbus2.c \ | 153 | protocol/nokia/fbus2.c \ |
154 | protocol/nokia/phonet.c \ | 154 | protocol/nokia/phonet.c \ |
155 | protocol/obex/obex.c \ | 155 | protocol/obex/obex.c \ |
156 | protocol/symbian/mrouter.c \ | 156 | protocol/symbian/mrouter.c \ |
157 | phone/pfunc.c \ | 157 | phone/pfunc.c \ |
158 | phone/at/atgen.c \ | 158 | phone/at/atgen.c \ |
159 | phone/at/siemens.c \ | 159 | phone/at/siemens.c \ |
160 | phone/at/samsung.c \ | ||
160 | phone/at/sonyeric.c \ | 161 | phone/at/sonyeric.c \ |
161 | phone/alcatel/alcatel.c \ | 162 | phone/alcatel/alcatel.c \ |
162 | phone/nokia/dct3/n6110.c \ | 163 | phone/nokia/dct3/n6110.c \ |
163 | phone/nokia/dct3/n7110.c \ | 164 | phone/nokia/dct3/n7110.c \ |
164 | phone/nokia/dct3/n9210.c \ | 165 | phone/nokia/dct3/n9210.c \ |
165 | phone/nokia/dct3/dct3func.c \ | 166 | phone/nokia/dct3/dct3func.c \ |
166 | phone/nokia/dct4/n3320.c \ | 167 | phone/nokia/dct4/n3320.c \ |
167 | phone/nokia/dct4/n3650.c \ | 168 | phone/nokia/dct4/n3650.c \ |
168 | phone/nokia/dct4/n6510.c \ | 169 | phone/nokia/dct4/n6510.c \ |
169 | phone/nokia/dct4/dct4func.c \ | 170 | phone/nokia/dct4/dct4func.c \ |
170 | phone/nokia/nauto.c \ | 171 | phone/nokia/nauto.c \ |
171 | phone/nokia/nfunc.c \ | 172 | phone/nokia/nfunc.c \ |
172 | phone/nokia/nfuncold.c \ | 173 | phone/nokia/nfuncold.c \ |
173 | phone/obex/obexgen.c \ | 174 | phone/obex/obexgen.c \ |
174 | phone/symbian/mroutgen.c | 175 | phone/symbian/mroutgen.c |
175 | 176 | ||
176 | TARGET = kammu | 177 | TARGET = kammu |
177 | DESTDIR = $(QPEDIR)/lib | 178 | DESTDIR = $(QPEDIR)/lib |
178 | OBJECTS_DIR = obj/$(PLATFORM) | 179 | OBJECTS_DIR = obj/$(PLATFORM) |
179 | MOC_DIR = moc/$(PLATFORM) | 180 | MOC_DIR = moc/$(PLATFORM) |
180 | CONFIG = warn_off release console | 181 | CONFIG = warn_off release console |
diff --git a/gammu/emb/common/device/bluetoth/bluez.c b/gammu/emb/common/device/bluetoth/bluez.c index 8a4807e..e7e8adf 100644 --- a/gammu/emb/common/device/bluetoth/bluez.c +++ b/gammu/emb/common/device/bluetoth/bluez.c | |||
@@ -1,25 +1,34 @@ | |||
1 | /* Based on work by Marcel Holtmann and other authors of Bluez */ | 1 | /* Based on some work from Bluez (www.bluez.org) |
2 | * (C) 2000-2001 Qualcomm Incorporated | ||
3 | * (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com> | ||
4 | * (C) 2002-2004 Marcel Holtmann <marcel@holtmann.org> | ||
5 | * GNU GPL version 2 | ||
6 | */ | ||
7 | /* based on some Marcel Holtmann work from Gnokii (www.gnokii.org) | ||
8 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
9 | * GNU GPL version 2 or later | ||
10 | */ | ||
2 | 11 | ||
3 | #include "../../gsmstate.h" | 12 | #include "../../gsmstate.h" |
4 | 13 | ||
5 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE | 14 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE |
6 | #ifdef GSM_ENABLE_BLUEZ | 15 | #ifdef GSM_ENABLE_BLUEZ |
7 | 16 | ||
8 | #include <stdlib.h> | 17 | #include <stdlib.h> |
9 | #include <stdio.h> | 18 | #include <stdio.h> |
10 | #include <fcntl.h> | 19 | #include <fcntl.h> |
11 | #include <errno.h> | 20 | #include <errno.h> |
12 | #include <string.h> | 21 | #include <string.h> |
13 | #include <sys/socket.h> | 22 | #include <sys/socket.h> |
14 | #include <sys/time.h> | 23 | #include <sys/time.h> |
15 | #include <unistd.h> | 24 | #include <unistd.h> |
16 | #include <bluetooth/bluetooth.h> | 25 | #include <bluetooth/bluetooth.h> |
17 | #include <bluetooth/rfcomm.h> | 26 | #include <bluetooth/rfcomm.h> |
18 | #include <bluetooth/sdp.h> | 27 | #include <bluetooth/sdp.h> |
19 | #include <bluetooth/sdp_lib.h> | 28 | #include <bluetooth/sdp_lib.h> |
20 | 29 | ||
21 | #include "../../gsmcomon.h" | 30 | #include "../../gsmcomon.h" |
22 | #include "../devfunc.h" | 31 | #include "../devfunc.h" |
23 | #include "bluetoth.h" | 32 | #include "bluetoth.h" |
24 | 33 | ||
25 | GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device) | 34 | GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device) |
@@ -60,148 +69,148 @@ GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device) | |||
60 | 69 | ||
61 | d->hPhone = fd; | 70 | d->hPhone = fd; |
62 | return ERR_NONE; | 71 | return ERR_NONE; |
63 | } | 72 | } |
64 | 73 | ||
65 | #ifdef BLUETOOTH_RF_SEARCHING | 74 | #ifdef BLUETOOTH_RF_SEARCHING |
66 | 75 | ||
67 | struct search_context { | 76 | struct search_context { |
68 | char *svc; | 77 | char *svc; |
69 | uuid_t group; | 78 | uuid_t group; |
70 | int tree; | 79 | int tree; |
71 | uint32_t handle; | 80 | uint32_t handle; |
72 | }; | 81 | }; |
73 | 82 | ||
74 | static void print_service_desc(void *value, void *user) | 83 | static void print_service_desc(void *value, void *user) |
75 | { | 84 | { |
76 | sdp_data_t *p = (sdp_data_t *)value; | 85 | sdp_data_t *p = (sdp_data_t *)value; |
77 | int i = 0, proto = 0, *channel = (int *)user; | 86 | int i = 0, proto = 0, *channel = (int *)user; |
78 | 87 | ||
79 | for (; p; p = p->next, i++) { | 88 | for (; p; p = p->next, i++) { |
80 | switch (p->dtd) { | 89 | switch (p->dtd) { |
81 | case SDP_UUID16: | 90 | case SDP_UUID16: |
82 | case SDP_UUID32: | 91 | case SDP_UUID32: |
83 | case SDP_UUID128: | 92 | case SDP_UUID128: |
84 | proto = 1;//sdp_uuid_to_proto(&p->val.uuid); | 93 | proto = sdp_uuid_to_proto(&p->val.uuid); |
85 | break; | 94 | break; |
86 | case SDP_UINT8: | 95 | case SDP_UINT8: |
87 | if (proto == RFCOMM_UUID) { | 96 | if (proto == RFCOMM_UUID) { |
88 | (*channel) = p->val.uint8; | 97 | (*channel) = p->val.uint8; |
89 | return; | 98 | return; |
90 | } | 99 | } |
91 | break; | 100 | break; |
92 | } | 101 | } |
93 | } | 102 | } |
94 | } | 103 | } |
95 | 104 | ||
96 | void print_access_protos(value, user) | 105 | void print_access_protos(value, user) |
97 | { | 106 | { |
98 | sdp_list_t *protDescSeq = (sdp_list_t *)value; | 107 | sdp_list_t *protDescSeq = (sdp_list_t *)value; |
99 | int *channel = (int *)user; | 108 | int *channel = (int *)user; |
100 | 109 | ||
101 | sdp_list_foreach(protDescSeq,print_service_desc,channel); | 110 | sdp_list_foreach(protDescSeq,print_service_desc,channel); |
102 | } | 111 | } |
103 | 112 | ||
104 | static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, struct search_context *context) | 113 | static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, bdaddr_t *bdaddr, struct search_context *context) |
105 | { | 114 | { |
106 | sdp_session_t *sess; | 115 | sdp_session_t *sess; |
107 | sdp_list_t *attrid, *search, *seq, *next, *proto = 0; | ||
108 | uint32_t range = 0x0000ffff; | ||
109 | char str[20]; | ||
110 | sdp_record_t *rec; | 116 | sdp_record_t *rec; |
117 | sdp_list_t *attrid, *search, *seq, *next, *proto = 0; | ||
111 | sdp_data_t *d; | 118 | sdp_data_t *d; |
112 | bdaddr_t interface; | 119 | bdaddr_t interface; |
120 | uint32_t range = 0x0000ffff; | ||
113 | struct search_context subcontext; | 121 | struct search_context subcontext; |
122 | char str[20]; | ||
114 | int channel,channel2; | 123 | int channel,channel2; |
115 | 124 | ||
116 | bacpy(&interface,BDADDR_ANY); | 125 | bacpy(&interface,BDADDR_ANY); |
117 | 126 | ||
118 | ba2str(bdaddr, str); | 127 | ba2str(bdaddr, str); |
119 | smprintf(s,"%s\n", str); | 128 | smprintf(s,"%s\n", str); |
120 | 129 | ||
121 | sess = sdp_connect(&interface, bdaddr, SDP_RETRY_IF_BUSY); | 130 | sess = sdp_connect(&interface, bdaddr, SDP_RETRY_IF_BUSY); |
122 | if (!sess) { | 131 | if (!sess) { |
123 | dbgprintf("Failed to connect to SDP server on %s: %s\n", str, strerror(errno)); | 132 | dbgprintf("Failed to connect to SDP server on %s: %s\n", str, strerror(errno)); |
124 | return ERR_UNKNOWN; | 133 | return ERR_UNKNOWN; |
125 | } | 134 | } |
126 | 135 | ||
127 | attrid = sdp_list_append(0, &range); | 136 | attrid = sdp_list_append(0, &range); |
128 | search = sdp_list_append(0, &context->group); | 137 | search = sdp_list_append(0, &context->group); |
129 | if (sdp_service_search_attr_req(sess, search, SDP_ATTR_REQ_RANGE, attrid, &seq)) { | 138 | if (sdp_service_search_attr_req(sess, search, SDP_ATTR_REQ_RANGE, attrid, &seq)) { |
130 | dbgprintf("Service Search failed: %s\n", strerror(errno)); | 139 | dbgprintf("Service Search failed: %s\n", strerror(errno)); |
131 | sdp_close(sess); | 140 | sdp_close(sess); |
132 | return ERR_UNKNOWN; | 141 | return ERR_UNKNOWN; |
133 | } | 142 | } |
134 | sdp_list_free(attrid, 0); | 143 | sdp_list_free(attrid, 0); |
135 | sdp_list_free(search, 0); | 144 | sdp_list_free(search, 0); |
136 | 145 | ||
137 | channel2 = -1; | 146 | channel2 = -1; |
138 | for (; seq; seq = next) { | 147 | for (; seq; seq = next) { |
139 | rec = (sdp_record_t *) seq->data; | 148 | rec = (sdp_record_t *) seq->data; |
140 | 149 | ||
141 | if (channel2 == -1) { | 150 | if (channel2 == -1) { |
142 | if (!context->tree) { | 151 | if (!context->tree) { |
143 | d = sdp_data_get(rec,SDP_ATTR_SVCNAME_PRIMARY); | 152 | d = sdp_data_get(rec,SDP_ATTR_SVCNAME_PRIMARY); |
144 | 153 | ||
145 | if (false) { | 154 | if (sdp_get_access_protos(rec,&proto) == 0) { |
146 | channel = -1; | 155 | channel = -1; |
147 | sdp_list_foreach(proto,print_access_protos,&channel); | 156 | sdp_list_foreach(proto,print_access_protos,&channel); |
148 | //sdp_list_free(proto,(sdp_free_func_t)sdp_data_free); | 157 | sdp_list_free(proto,(sdp_free_func_t)sdp_data_free); |
149 | } | 158 | } |
150 | smprintf(s,"Channel %i",channel); | 159 | smprintf(s,"Channel %i",channel); |
151 | if (d) smprintf(s," - \"%s\"",d->val.str); | 160 | if (d) smprintf(s," - \"%s\"",d->val.str); |
152 | smprintf(s,"\n"); | 161 | smprintf(s,"\n"); |
153 | if (channel2 == -1 && bluetooth_checkservicename(s, d->val.str) == ERR_NONE) { | 162 | if (channel2 == -1 && bluetooth_checkservicename(s, d->val.str) == ERR_NONE) { |
154 | channel2 = channel; | 163 | channel2 = channel; |
155 | } | 164 | } |
156 | } | 165 | } |
157 | if (sdp_get_group_id(rec,&subcontext.group) != -1) { | 166 | if (sdp_get_group_id(rec,&subcontext.group) != -1) { |
158 | memcpy(&subcontext, context, sizeof(struct search_context)); | 167 | memcpy(&subcontext, context, sizeof(struct search_context)); |
159 | if (subcontext.group.value.uuid16 != context->group.value.uuid16) bluetooth_checkdevice(s,bdaddr,&subcontext); | 168 | if (subcontext.group.value.uuid16 != context->group.value.uuid16) bluetooth_checkdevice(s,bdaddr,&subcontext); |
160 | } | 169 | } |
161 | } | 170 | } |
162 | 171 | ||
163 | next = seq->next; | 172 | next = seq->next; |
164 | free(seq); | 173 | free(seq); |
165 | //sdp_record_free(rec); | 174 | sdp_record_free(rec); |
166 | } | 175 | } |
167 | sdp_close(sess); | 176 | sdp_close(sess); |
168 | 177 | ||
169 | if (channel2 != -1) return bluetooth_connect(s, channel2, str); | 178 | if (channel2 != -1) return bluetooth_connect(s, channel2, str); |
170 | 179 | ||
171 | return ERR_UNKNOWN; | 180 | return ERR_NOTSUPPORTED; |
172 | } | 181 | } |
173 | 182 | ||
174 | GSM_Error bluetooth_findchannel(GSM_StateMachine *s) | 183 | GSM_Error bluetooth_findchannel(GSM_StateMachine *s) |
175 | { | 184 | { |
176 | inquiry_info ii[20]; | 185 | inquiry_info ii[20]; |
177 | uint8_t count = 0; | 186 | uint8_t count = 0; |
178 | int i; | 187 | int i; |
179 | struct search_context context; | 188 | struct search_context context; |
180 | GSM_Error error = ERR_NOTSUPPORTED; | 189 | GSM_Error error = ERR_NOTSUPPORTED; |
181 | 190 | ||
182 | memset(&context, '\0', sizeof(struct search_context)); | 191 | memset(&context, '\0', sizeof(struct search_context)); |
183 | //sdp_uuid16_create(&(context.group),PUBLIC_BROWSE_GROUP); | 192 | sdp_uuid16_create(&(context.group),PUBLIC_BROWSE_GROUP); |
184 | 193 | ||
185 | if (!strcmp(s->CurrentConfig->Device,"/dev/ttyS1")) { | 194 | if (!strcmp(s->CurrentConfig->Device,"/dev/ttyS1")) { |
186 | dbgprintf("Searching for devices\n"); | 195 | dbgprintf("Searching for devices\n"); |
187 | if (sdp_general_inquiry(ii, 20, 8, &count) < 0) { | 196 | if (sdp_general_inquiry(ii, 20, 8, &count) < 0) { |
188 | return ERR_UNKNOWN; | 197 | return ERR_UNKNOWN; |
189 | } | 198 | } |
190 | } else { | 199 | } else { |
191 | count = 1; | 200 | count = 1; |
192 | str2ba(s->CurrentConfig->Device,&ii[0].bdaddr); | 201 | str2ba(s->CurrentConfig->Device,&ii[0].bdaddr); |
193 | } | 202 | } |
194 | for (i=0;i<count;i++) { | 203 | for (i=0;i<count;i++) { |
195 | error = bluetooth_checkdevice(s,&ii[i].bdaddr,&context); | 204 | error = bluetooth_checkdevice(s,&ii[i].bdaddr,&context); |
196 | if (error == ERR_NONE) return error; | 205 | if (error == ERR_NONE) return error; |
197 | } | 206 | } |
198 | return error; | 207 | return error; |
199 | } | 208 | } |
200 | 209 | ||
201 | #endif | 210 | #endif |
202 | #endif | 211 | #endif |
203 | #endif | 212 | #endif |
204 | 213 | ||
205 | /* How should editor hadle tabs in this file? Add editor commands here. | 214 | /* How should editor hadle tabs in this file? Add editor commands here. |
206 | * vim: noexpandtab sw=8 ts=8 sts=8: | 215 | * vim: noexpandtab sw=8 ts=8 sts=8: |
207 | */ | 216 | */ |
diff --git a/gammu/emb/common/device/devfunc.c b/gammu/emb/common/device/devfunc.c index d31ebbf..c58a01f 100644 --- a/gammu/emb/common/device/devfunc.c +++ b/gammu/emb/common/device/devfunc.c | |||
@@ -1,24 +1,32 @@ | |||
1 | /* Some source from Gnokii (www.gnokii.org) | ||
2 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
3 | * GNU GPL version 2 or later | ||
4 | */ | ||
5 | /* Some source from Minicom (http://alioth.debian.org/projects/minicom) | ||
6 | * (C) 1991,1992,1993,1994,1995,1996 by Miquel van Smoorenburg | ||
7 | * GNU GPL version 2 | ||
8 | */ | ||
1 | 9 | ||
2 | #include <string.h> | 10 | #include <string.h> |
3 | #ifdef WIN32 | 11 | #ifdef WIN32 |
4 | # include <io.h> | 12 | # include <io.h> |
5 | #else | 13 | #else |
6 | # include <errno.h> | 14 | # include <errno.h> |
7 | # include <signal.h> | 15 | # include <signal.h> |
8 | #endif | 16 | #endif |
9 | 17 | ||
10 | #include "../gsmstate.h" | 18 | #include "../gsmstate.h" |
11 | 19 | ||
12 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE | 20 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE |
13 | #ifdef BLUETOOTH_RF_SEARCHING | 21 | #ifdef BLUETOOTH_RF_SEARCHING |
14 | 22 | ||
15 | GSM_Error bluetooth_checkservicename(GSM_StateMachine *s, char *name) | 23 | GSM_Error bluetooth_checkservicename(GSM_StateMachine *s, char *name) |
16 | { | 24 | { |
17 | if (s->ConnectionType == GCT_BLUEPHONET && strstr(name,"Nokia PC Suite")!=NULL) return ERR_NONE; | 25 | if (s->ConnectionType == GCT_BLUEPHONET && strstr(name,"Nokia PC Suite")!=NULL) return ERR_NONE; |
18 | if (s->ConnectionType == GCT_BLUEOBEX && strstr(name,"OBEX") !=NULL) return ERR_NONE; | 26 | if (s->ConnectionType == GCT_BLUEOBEX && strstr(name,"OBEX") !=NULL) return ERR_NONE; |
19 | if (s->ConnectionType == GCT_BLUEAT && strstr(name,"COM 1") !=NULL) return ERR_NONE; | 27 | if (s->ConnectionType == GCT_BLUEAT && strstr(name,"COM 1") !=NULL) return ERR_NONE; |
20 | return ERR_UNKNOWN; | 28 | return ERR_UNKNOWN; |
21 | } | 29 | } |
22 | 30 | ||
23 | #endif | 31 | #endif |
24 | #endif | 32 | #endif |
@@ -84,49 +92,49 @@ GSM_Error socket_close(GSM_StateMachine *s, int hPhone) | |||
84 | 92 | ||
85 | #ifdef ENABLE_LGPL | 93 | #ifdef ENABLE_LGPL |
86 | 94 | ||
87 | GSM_Error lock_device(const char* port, char **lock_device) | 95 | GSM_Error lock_device(const char* port, char **lock_device) |
88 | { | 96 | { |
89 | *lock_device = 0; | 97 | *lock_device = 0; |
90 | return ERR_NONE; | 98 | return ERR_NONE; |
91 | } | 99 | } |
92 | 100 | ||
93 | bool unlock_device(char **lock_file) | 101 | bool unlock_device(char **lock_file) |
94 | { | 102 | { |
95 | return true; | 103 | return true; |
96 | } | 104 | } |
97 | 105 | ||
98 | #else | 106 | #else |
99 | 107 | ||
100 | #define max_buf_len 128 | 108 | #define max_buf_len 128 |
101 | #define lock_path "/var/lock/LCK.." | 109 | #define lock_path "/var/lock/LCK.." |
102 | 110 | ||
103 | /* Lock the device. Allocated string with a lock name is returned | 111 | /* Lock the device. Allocated string with a lock name is returned |
104 | * in lock_device | 112 | * in lock_device |
105 | */ | 113 | */ |
106 | GSM_Error lock_device(const char* port, char **lock_device) | 114 | GSM_Error lock_device(const char* port, char **lock_device) |
107 | { | 115 | { |
108 | #ifndef WIN32 | 116 | #if !defined(WIN32) && !defined(DJGPP) |
109 | char *lock_file = NULL; | 117 | char *lock_file = NULL; |
110 | char buffer[max_buf_len]; | 118 | char buffer[max_buf_len]; |
111 | const char *aux; | 119 | const char *aux; |
112 | int fd, len; | 120 | int fd, len; |
113 | GSM_Errorerror = ERR_NONE; | 121 | GSM_Errorerror = ERR_NONE; |
114 | 122 | ||
115 | dbgprintf("Locking device\n"); | 123 | dbgprintf("Locking device\n"); |
116 | 124 | ||
117 | aux = strrchr(port, '/'); | 125 | aux = strrchr(port, '/'); |
118 | /* Remove leading '/' */ | 126 | /* Remove leading '/' */ |
119 | if (aux) { | 127 | if (aux) { |
120 | aux++; | 128 | aux++; |
121 | } else { | 129 | } else { |
122 | /* No / in port */ | 130 | /* No / in port */ |
123 | aux = port; | 131 | aux = port; |
124 | } | 132 | } |
125 | len = strlen(aux) + strlen(lock_path); | 133 | len = strlen(aux) + strlen(lock_path); |
126 | 134 | ||
127 | memset(buffer, 0, sizeof(buffer)); | 135 | memset(buffer, 0, sizeof(buffer)); |
128 | lock_file = calloc(len + 1, 1); | 136 | lock_file = calloc(len + 1, 1); |
129 | if (!lock_file) { | 137 | if (!lock_file) { |
130 | dbgprintf("Out of memory error while locking device\n"); | 138 | dbgprintf("Out of memory error while locking device\n"); |
131 | return ERR_MOREMEMORY; | 139 | return ERR_MOREMEMORY; |
132 | } | 140 | } |
@@ -197,49 +205,49 @@ GSM_Error lock_device(const char* port, char **lock_device) | |||
197 | } else { | 205 | } else { |
198 | dbgprintf("Unknown error with creating lockfile %s\n", lock_file); | 206 | dbgprintf("Unknown error with creating lockfile %s\n", lock_file); |
199 | error = ERR_UNKNOWN; | 207 | error = ERR_UNKNOWN; |
200 | } | 208 | } |
201 | goto failed; | 209 | goto failed; |
202 | } | 210 | } |
203 | sprintf(buffer, "%10ld gammu\n", (long)getpid()); | 211 | sprintf(buffer, "%10ld gammu\n", (long)getpid()); |
204 | write(fd, buffer, strlen(buffer)); | 212 | write(fd, buffer, strlen(buffer)); |
205 | close(fd); | 213 | close(fd); |
206 | *lock_device = lock_file; | 214 | *lock_device = lock_file; |
207 | return ERR_NONE; | 215 | return ERR_NONE; |
208 | failed: | 216 | failed: |
209 | free(lock_file); | 217 | free(lock_file); |
210 | *lock_device = 0; | 218 | *lock_device = 0; |
211 | return error; | 219 | return error; |
212 | #else | 220 | #else |
213 | *lock_device = 0; | 221 | *lock_device = 0; |
214 | return ERR_NONE; | 222 | return ERR_NONE; |
215 | #endif | 223 | #endif |
216 | } | 224 | } |
217 | 225 | ||
218 | /* Removes lock and frees memory */ | 226 | /* Removes lock and frees memory */ |
219 | bool unlock_device(char **lock_file) | 227 | bool unlock_device(char **lock_file) |
220 | { | 228 | { |
221 | #ifndef WIN32 | 229 | #if !defined(WIN32) && !defined(DJGPP) |
222 | int err; | 230 | int err; |
223 | 231 | ||
224 | if (!lock_file) { | 232 | if (!lock_file) { |
225 | dbgprintf("Cannot unlock device\n"); | 233 | dbgprintf("Cannot unlock device\n"); |
226 | return false; | 234 | return false; |
227 | } | 235 | } |
228 | err = unlink(*lock_file); | 236 | err = unlink(*lock_file); |
229 | free(*lock_file); | 237 | free(*lock_file); |
230 | *lock_file = NULL; | 238 | *lock_file = NULL; |
231 | return (err + 1); | 239 | return (err + 1); |
232 | #else | 240 | #else |
233 | return true; | 241 | return true; |
234 | #endif | 242 | #endif |
235 | } | 243 | } |
236 | 244 | ||
237 | #endif | 245 | #endif |
238 | 246 | ||
239 | int FindSerialSpeed(char *buffer) | 247 | int FindSerialSpeed(char *buffer) |
240 | { | 248 | { |
241 | switch (atoi(buffer)) { | 249 | switch (atoi(buffer)) { |
242 | case 50 : return 50; | 250 | case 50 : return 50; |
243 | case 75 : return 75; | 251 | case 75 : return 75; |
244 | case 110: return 110; | 252 | case 110: return 110; |
245 | case 134: return 134; | 253 | case 134: return 134; |
diff --git a/gammu/emb/common/device/irda/irda.c b/gammu/emb/common/device/irda/irda.c index fef50ac..e680377 100644 --- a/gammu/emb/common/device/irda/irda.c +++ b/gammu/emb/common/device/irda/irda.c | |||
@@ -1,27 +1,31 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Ralf Thelen and MyGnokii */ | 2 | /* based on some work from Ralf Thelen and MyGnokii (www.mwiacek.com) */ |
3 | /* based on some work from Gnokii and MSDN */ | 3 | /* based on some work from MSDN */ |
4 | /* based on some work from Gnokii (www.gnokii.org) | ||
5 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
6 | * GNU GPL version 2 or later | ||
7 | */ | ||
4 | 8 | ||
5 | /* You have to include wsock32.lib library to MS VC project to compile it */ | 9 | /* You have to include wsock32.lib library to MS VC project to compile it */ |
6 | 10 | ||
7 | #include "../../gsmstate.h" | 11 | #include "../../gsmstate.h" |
8 | 12 | ||
9 | #ifdef GSM_ENABLE_IRDADEVICE | 13 | #ifdef GSM_ENABLE_IRDADEVICE |
10 | #ifndef DJGPP | 14 | #ifndef DJGPP |
11 | 15 | ||
12 | #ifndef WIN32 | 16 | #ifndef WIN32 |
13 | # include <stdlib.h> | 17 | # include <stdlib.h> |
14 | # include <unistd.h> | 18 | # include <unistd.h> |
15 | # include <stdio.h> | 19 | # include <stdio.h> |
16 | # include <fcntl.h> | 20 | # include <fcntl.h> |
17 | # include <errno.h> | 21 | # include <errno.h> |
18 | # include <string.h> | 22 | # include <string.h> |
19 | # include <sys/time.h> | 23 | # include <sys/time.h> |
20 | # include <sys/poll.h> | 24 | # include <sys/poll.h> |
21 | # include <sys/socket.h> | 25 | # include <sys/socket.h> |
22 | # include <sys/ioctl.h> | 26 | # include <sys/ioctl.h> |
23 | #else | 27 | #else |
24 | # include <windows.h> | 28 | # include <windows.h> |
25 | # include <io.h> | 29 | # include <io.h> |
26 | #endif | 30 | #endif |
27 | 31 | ||
diff --git a/gammu/emb/common/device/irda/irda_unx.h b/gammu/emb/common/device/irda/irda_unx.h index 8dbcb97..7a55273 100644 --- a/gammu/emb/common/device/irda/irda_unx.h +++ b/gammu/emb/common/device/irda/irda_unx.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* part of irda.h available in Linux kernel source */ | 1 | /* part of irda.h available in Linux kernel source (www.kernel.org) */ |
2 | 2 | ||
3 | /********************************************************************* | 3 | /********************************************************************* |
4 | * | 4 | * |
5 | * Filename: irda.h | 5 | * Filename: irda.h |
6 | * Version: | 6 | * Version: |
7 | * Description: | 7 | * Description: |
8 | * Status: Experimental. | 8 | * Status: Experimental. |
9 | * Author: Dag Brattli <dagb@cs.uit.no> | 9 | * Author: Dag Brattli <dagb@cs.uit.no> |
10 | * Created at: Mon Mar 8 14:06:12 1999 | 10 | * Created at: Mon Mar 8 14:06:12 1999 |
11 | * Modified at: Sat Dec 25 16:06:42 1999 | 11 | * Modified at: Sat Dec 25 16:06:42 1999 |
12 | * Modified by: Dag Brattli <dagb@cs.uit.no> | 12 | * Modified by: Dag Brattli <dagb@cs.uit.no> |
13 | * | 13 | * |
14 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. | 14 | * Copyright (c) 1999 Dag Brattli, All Rights Reserved. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or | 16 | * This program is free software; you can redistribute it and/or |
17 | * modify it under the terms of the GNU General Public License as | 17 | * modify it under the terms of the GNU General Public License as |
18 | * published by the Free Software Foundation; either version 2 of | 18 | * published by the Free Software Foundation; either version 2 of |
19 | * the License, or (at your option) any later version. | 19 | * the License, or (at your option) any later version. |
20 | * | 20 | * |
21 | * Neither Dag Brattli nor University of Tromsø admit liability nor | 21 | * Neither Dag Brattli nor University of Tromsø admit liability nor |
22 | * provide warranty for any of this software. This material is | 22 | * provide warranty for any of this software. This material is |
23 | * provided "AS-IS" and at no charge. | 23 | * provided "AS-IS" and at no charge. |
24 | * | 24 | * |
25 | ********************************************************************/ | 25 | ********************************************************************/ |
diff --git a/gammu/emb/common/device/serial/ser_djg.c b/gammu/emb/common/device/serial/ser_djg.c index ac9d7c8..2524187 100644 --- a/gammu/emb/common/device/serial/ser_djg.c +++ b/gammu/emb/common/device/serial/ser_djg.c | |||
@@ -1,66 +1,66 @@ | |||
1 | 1 | ||
2 | #include "../../gsmstate.h" | 2 | #include "../../gsmstate.h" |
3 | 3 | ||
4 | #ifdef GSM_ENABLE_SERIALDEVICE | 4 | #ifdef GSM_ENABLE_SERIALDEVICE |
5 | #ifdef DJGPP | 5 | #ifdef DJGPP |
6 | 6 | ||
7 | #include "../../gsmcomon.h" | 7 | #include "../../gsmcomon.h" |
8 | #include "ser_djg.h" | 8 | #include "ser_djg.h" |
9 | 9 | ||
10 | static GSM_Error serial_close(GSM_StateMachine *s) | 10 | static GSM_Error serial_close(GSM_StateMachine *s) |
11 | { | 11 | { |
12 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 12 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
13 | 13 | ||
14 | return ERR_NONE; | 14 | return ERR_NOTIMPLEMENTED; |
15 | } | 15 | } |
16 | 16 | ||
17 | static GSM_Error serial_open (GSM_StateMachine *s) | 17 | static GSM_Error serial_open (GSM_StateMachine *s) |
18 | { | 18 | { |
19 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 19 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
20 | 20 | ||
21 | return ERR_NONE; | 21 | return ERR_NOTIMPLEMENTED; |
22 | } | 22 | } |
23 | 23 | ||
24 | static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) | 24 | static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) |
25 | { | 25 | { |
26 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 26 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
27 | 27 | ||
28 | return ERR_NONE; | 28 | return ERR_NOTIMPLEMENTED; |
29 | } | 29 | } |
30 | 30 | ||
31 | static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) | 31 | static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) |
32 | { | 32 | { |
33 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 33 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
34 | 34 | ||
35 | return ERR_NONE; | 35 | return ERR_NOTIMPLEMENTED; |
36 | } | 36 | } |
37 | 37 | ||
38 | static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) | 38 | static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) |
39 | { | 39 | { |
40 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 40 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
41 | 41 | ||
42 | return ERR_NONE; | 42 | return ERR_NOTIMPLEMENTED; |
43 | } | 43 | } |
44 | 44 | ||
45 | static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) | 45 | static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) |
46 | { | 46 | { |
47 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 47 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
48 | 48 | ||
49 | return 0; | 49 | return 0; |
50 | } | 50 | } |
51 | 51 | ||
52 | static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes) | 52 | static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes) |
53 | { | 53 | { |
54 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 54 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
55 | 55 | ||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | GSM_Device_Functions SerialDevice = { | 59 | GSM_Device_Functions SerialDevice = { |
60 | serial_open, | 60 | serial_open, |
61 | serial_close, | 61 | serial_close, |
62 | serial_setparity, | 62 | serial_setparity, |
63 | serial_setdtrrts, | 63 | serial_setdtrrts, |
64 | serial_setspeed, | 64 | serial_setspeed, |
65 | serial_read, | 65 | serial_read, |
66 | serial_write | 66 | serial_write |
diff --git a/gammu/emb/common/device/serial/ser_unx.c b/gammu/emb/common/device/serial/ser_unx.c index 2a87b11..69c7515 100644 --- a/gammu/emb/common/device/serial/ser_unx.c +++ b/gammu/emb/common/device/serial/ser_unx.c | |||
@@ -1,59 +1,83 @@ | |||
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) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
3 | 7 | ||
4 | #include "../../gsmstate.h" | 8 | #include "../../gsmstate.h" |
5 | 9 | ||
6 | #ifdef GSM_ENABLE_SERIALDEVICE | 10 | #ifdef GSM_ENABLE_SERIALDEVICE |
7 | #ifndef WIN32 | 11 | #ifndef WIN32 |
8 | #ifndef DJGPP | 12 | #ifndef DJGPP |
9 | 13 | ||
10 | #include <sys/file.h> | 14 | #include <sys/file.h> |
11 | #include <sys/time.h> | 15 | #include <sys/time.h> |
12 | #include <string.h> | 16 | #include <string.h> |
13 | #include <termios.h> | 17 | #include <termios.h> |
14 | #include <errno.h> | 18 | #include <errno.h> |
15 | 19 | ||
16 | #include "../../gsmcomon.h" | 20 | #include "../../gsmcomon.h" |
17 | #include "ser_unx.h" | 21 | #include "ser_unx.h" |
18 | 22 | ||
23 | #ifndef O_NONBLOCK | ||
24 | # define O_NONBLOCK 0 | ||
25 | #endif | ||
26 | |||
27 | #ifdef __NetBSD__ | ||
28 | # define FNONBLOCK O_NONBLOCK | ||
29 | |||
30 | # define B57600 0010001 | ||
31 | # define B115200 0010002 | ||
32 | # define B230400 0010003 | ||
33 | # define B460800 0010004 | ||
34 | # define B500000 0010005 | ||
35 | # define B576000 0010006 | ||
36 | # define B921600 0010007 | ||
37 | # define B1000000 0010010 | ||
38 | # define B1152000 0010011 | ||
39 | # define B1500000 0010012 | ||
40 | # define B2000000 0010013 | ||
41 | # define B2500000 0010014 | ||
42 | # define B3000000 0010015 | ||
43 | # define B3500000 0010016 | ||
44 | # define B4000000 0010017 | ||
45 | #endif | ||
46 | |||
19 | static GSM_Error serial_close(GSM_StateMachine *s) | 47 | static GSM_Error serial_close(GSM_StateMachine *s) |
20 | { | 48 | { |
21 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 49 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
22 | 50 | ||
23 | /* Restores old settings */ | 51 | /* Restores old settings */ |
24 | tcsetattr(d->hPhone, TCSANOW, &d->old_settings); | 52 | tcsetattr(d->hPhone, TCSANOW, &d->old_settings); |
25 | 53 | ||
26 | /* Closes device */ | 54 | /* Closes device */ |
27 | close(d->hPhone); | 55 | close(d->hPhone); |
28 | 56 | ||
29 | return ERR_NONE; | 57 | return ERR_NONE; |
30 | } | 58 | } |
31 | 59 | ||
32 | #ifndef O_NONBLOCK | ||
33 | # define O_NONBLOCK 0 | ||
34 | #endif | ||
35 | |||
36 | static GSM_Error serial_open (GSM_StateMachine *s) | 60 | static GSM_Error serial_open (GSM_StateMachine *s) |
37 | { | 61 | { |
38 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 62 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
39 | struct termios t; | 63 | struct termios t; |
40 | int i; | 64 | int i; |
41 | 65 | ||
42 | /* O_NONBLOCK MUST is required to avoid waiting for DCD */ | 66 | /* O_NONBLOCK MUST is required to avoid waiting for DCD */ |
43 | d->hPhone = open(s->CurrentConfig->Device, O_RDWR | O_NOCTTY | O_NONBLOCK); | 67 | d->hPhone = open(s->CurrentConfig->Device, O_RDWR | O_NOCTTY | O_NONBLOCK); |
44 | if (d->hPhone < 0) { | 68 | if (d->hPhone < 0) { |
45 | i = errno; | 69 | i = errno; |
46 | GSM_OSErrorInfo(s,"open in serial_open"); | 70 | GSM_OSErrorInfo(s,"open in serial_open"); |
47 | if (i == 2) return ERR_DEVICENOTEXIST; //no such file or directory | 71 | if (i == 2) return ERR_DEVICENOTEXIST; //no such file or directory |
48 | if (i == 13) return ERR_DEVICENOPERMISSION;//permission denied | 72 | if (i == 13) return ERR_DEVICENOPERMISSION;//permission denied |
49 | return ERR_DEVICEOPENERROR; | 73 | return ERR_DEVICEOPENERROR; |
50 | } | 74 | } |
51 | 75 | ||
52 | #ifdef TIOCEXCL | 76 | #ifdef TIOCEXCL |
53 | /* open() calls from other applications shall fail now */ | 77 | /* open() calls from other applications shall fail now */ |
54 | ioctl(d->hPhone, TIOCEXCL, (char *) 0); | 78 | ioctl(d->hPhone, TIOCEXCL, (char *) 0); |
55 | #endif | 79 | #endif |
56 | 80 | ||
57 | if (tcgetattr(d->hPhone, &d->old_settings) == -1) { | 81 | if (tcgetattr(d->hPhone, &d->old_settings) == -1) { |
58 | close(d->hPhone); | 82 | close(d->hPhone); |
59 | GSM_OSErrorInfo(s,"tcgetattr in serial_open"); | 83 | GSM_OSErrorInfo(s,"tcgetattr in serial_open"); |
@@ -181,63 +205,67 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) | |||
181 | 205 | ||
182 | if (tcgetattr(d->hPhone, &t)) { | 206 | if (tcgetattr(d->hPhone, &t)) { |
183 | GSM_OSErrorInfo(s,"tcgetattr in serial_setspeed"); | 207 | GSM_OSErrorInfo(s,"tcgetattr in serial_setspeed"); |
184 | return ERR_DEVICEREADERROR; | 208 | return ERR_DEVICEREADERROR; |
185 | } | 209 | } |
186 | 210 | ||
187 | smprintf(s, "Setting speed to %d\n", speed); | 211 | smprintf(s, "Setting speed to %d\n", speed); |
188 | 212 | ||
189 | switch (speed) { | 213 | switch (speed) { |
190 | case 50: speed2 = B50; break; | 214 | case 50: speed2 = B50; break; |
191 | case 75: speed2 = B75; break; | 215 | case 75: speed2 = B75; break; |
192 | case 110: speed2 = B110; break; | 216 | case 110: speed2 = B110; break; |
193 | case 134: speed2 = B134; break; | 217 | case 134: speed2 = B134; break; |
194 | case 150: speed2 = B150; break; | 218 | case 150: speed2 = B150; break; |
195 | case 200: speed2 = B200; break; | 219 | case 200: speed2 = B200; break; |
196 | case 300: speed2 = B300; break; | 220 | case 300: speed2 = B300; break; |
197 | case 600: speed2 = B600; break; | 221 | case 600: speed2 = B600; break; |
198 | case 1200: speed2 = B1200; break; | 222 | case 1200: speed2 = B1200; break; |
199 | case 1800: speed2 = B1800; break; | 223 | case 1800: speed2 = B1800; break; |
200 | case 2400: speed2 = B2400; break; | 224 | case 2400: speed2 = B2400; break; |
201 | case 4800: speed2 = B4800; break; | 225 | case 4800: speed2 = B4800; break; |
202 | case 9600: speed2 = B9600; break; | 226 | case 9600: speed2 = B9600; break; |
203 | case 19200: speed2 = B19200;break; | 227 | case 19200: speed2 = B19200;break; |
204 | case 38400: speed2 = B38400;break; | 228 | case 38400: speed2 = B38400;break; |
229 | #ifdef B57600 | ||
205 | case 57600: speed2 = B57600;break; | 230 | case 57600: speed2 = B57600;break; |
206 | case 115200: speed2 = B115200;break; | 231 | case 115200: speed2 = B115200;break; |
207 | case 230400: speed2 = B230400;break; | 232 | case 230400: speed2 = B230400;break; |
208 | case 460800: speed2 = B460800;break; | 233 | case 460800: speed2 = B460800;break; |
234 | #ifdef B500000 | ||
209 | case 500000: speed2 = B500000;break; | 235 | case 500000: speed2 = B500000;break; |
210 | case 576000: speed2 = B576000;break; | 236 | case 576000: speed2 = B576000;break; |
211 | case 921600: speed2 = B921600;break; | 237 | case 921600: speed2 = B921600;break; |
212 | case 1000000: speed2 = B1000000;break; | 238 | case 1000000: speed2 = B1000000;break; |
213 | case 1152000: speed2 = B1152000;break; | 239 | case 1152000: speed2 = B1152000;break; |
214 | case 1500000: speed2 = B1500000;break; | 240 | case 1500000: speed2 = B1500000;break; |
215 | case 2000000: speed2 = B2000000;break; | 241 | case 2000000: speed2 = B2000000;break; |
216 | case 2500000: speed2 = B2500000;break; | 242 | case 2500000: speed2 = B2500000;break; |
217 | case 3000000: speed2 = B3000000;break; | 243 | case 3000000: speed2 = B3000000;break; |
218 | case 3500000: speed2 = B3500000;break; | 244 | case 3500000: speed2 = B3500000;break; |
219 | case 4000000: speed2 = B4000000; break; | 245 | case 4000000: speed2 = B4000000; break; |
246 | #endif | ||
247 | #endif | ||
220 | } | 248 | } |
221 | 249 | ||
222 | /* This should work on all systems because it is done according to POSIX */ | 250 | /* This should work on all systems because it is done according to POSIX */ |
223 | cfsetispeed(&t, speed2); | 251 | cfsetispeed(&t, speed2); |
224 | cfsetospeed(&t, speed2); | 252 | cfsetospeed(&t, speed2); |
225 | 253 | ||
226 | if (tcsetattr(d->hPhone, TCSADRAIN, &t) == -1) { | 254 | if (tcsetattr(d->hPhone, TCSADRAIN, &t) == -1) { |
227 | serial_close(s); | 255 | serial_close(s); |
228 | GSM_OSErrorInfo(s,"tcsetattr in serial_setspeed"); | 256 | GSM_OSErrorInfo(s,"tcsetattr in serial_setspeed"); |
229 | return ERR_DEVICECHANGESPEEDERROR; | 257 | return ERR_DEVICECHANGESPEEDERROR; |
230 | } | 258 | } |
231 | 259 | ||
232 | return ERR_NONE; | 260 | return ERR_NONE; |
233 | } | 261 | } |
234 | 262 | ||
235 | static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) | 263 | static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) |
236 | { | 264 | { |
237 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 265 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
238 | struct timeval timeout2; | 266 | struct timeval timeout2; |
239 | fd_set readfds; | 267 | fd_set readfds; |
240 | int actual = 0; | 268 | int actual = 0; |
241 | 269 | ||
242 | FD_ZERO(&readfds); | 270 | FD_ZERO(&readfds); |
243 | FD_SET(d->hPhone, &readfds); | 271 | FD_SET(d->hPhone, &readfds); |
diff --git a/gammu/emb/common/device/serial/ser_w32.c b/gammu/emb/common/device/serial/ser_w32.c index 9fa0135..7d88fc7 100644 --- a/gammu/emb/common/device/serial/ser_w32.c +++ b/gammu/emb/common/device/serial/ser_w32.c | |||
@@ -1,26 +1,30 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | /* based on some work from Gnokii, MSDN and others */ | 2 | /* based on some work from MSDN and others */ |
3 | /* based on some work from Gnokii (www.gnokii.org) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
3 | 7 | ||
4 | #include "../../gsmstate.h" | 8 | #include "../../gsmstate.h" |
5 | 9 | ||
6 | #ifdef GSM_ENABLE_SERIALDEVICE | 10 | #ifdef GSM_ENABLE_SERIALDEVICE |
7 | #ifdef WIN32 | 11 | #ifdef WIN32 |
8 | 12 | ||
9 | #include <windows.h> | 13 | #include <windows.h> |
10 | #include <string.h> | 14 | #include <string.h> |
11 | #include <stdio.h> | 15 | #include <stdio.h> |
12 | #include <io.h> | 16 | #include <io.h> |
13 | #include <memory.h> | 17 | #include <memory.h> |
14 | 18 | ||
15 | #include "../../gsmcomon.h" | 19 | #include "../../gsmcomon.h" |
16 | #include "ser_w32.h" | 20 | #include "ser_w32.h" |
17 | 21 | ||
18 | static GSM_Error serial_close(GSM_StateMachine *s) | 22 | static GSM_Error serial_close(GSM_StateMachine *s) |
19 | { | 23 | { |
20 | GSM_Device_SerialData *d = &s->Device.Data.Serial; | 24 | GSM_Device_SerialData *d = &s->Device.Data.Serial; |
21 | 25 | ||
22 | /* Disables all monitored events for device */ | 26 | /* Disables all monitored events for device */ |
23 | SetCommMask(d->hPhone, 0); | 27 | SetCommMask(d->hPhone, 0); |
24 | 28 | ||
25 | /* Discards all characters from input/output buffer and terminates | 29 | /* Discards all characters from input/output buffer and terminates |
26 | * pending read/write operations | 30 | * pending read/write operations |
diff --git a/gammu/emb/common/gsmcomon.c b/gammu/emb/common/gsmcomon.c index d094ef3..445c3a6 100644 --- a/gammu/emb/common/gsmcomon.c +++ b/gammu/emb/common/gsmcomon.c | |||
@@ -100,89 +100,90 @@ unsigned char *GetMsg (INI_Section *cfg, unsigned char *default_string) | |||
100 | def_str[strlen(def_str)] = buff[num++]; | 100 | def_str[strlen(def_str)] = buff[num++]; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | retval = def_str; | 103 | retval = def_str; |
104 | } else { | 104 | } else { |
105 | retval = default_string; | 105 | retval = default_string; |
106 | } | 106 | } |
107 | return retval; | 107 | return retval; |
108 | } | 108 | } |
109 | } | 109 | } |
110 | e = e->Next; | 110 | e = e->Next; |
111 | } | 111 | } |
112 | return default_string; | 112 | return default_string; |
113 | } | 113 | } |
114 | 114 | ||
115 | typedef struct { | 115 | typedef struct { |
116 | GSM_Error ErrorNum; | 116 | GSM_Error ErrorNum; |
117 | unsigned char *ErrorText; | 117 | unsigned char *ErrorText; |
118 | } PrintErrorEntry; | 118 | } PrintErrorEntry; |
119 | 119 | ||
120 | static PrintErrorEntry PrintErrorEntries[] = { | 120 | static PrintErrorEntry PrintErrorEntries[] = { |
121 | {ERR_NONE, "No error."}, | 121 | {ERR_NONE, "No error."}, |
122 | {ERR_DEVICEOPENERROR, "Error opening device. Unknown/busy or no permissions."}, | 122 | {ERR_DEVICEOPENERROR, "Error opening device. Unknown/busy or no permissions."}, |
123 | {ERR_DEVICELOCKED, "Error opening device. Device locked."}, | 123 | {ERR_DEVICELOCKED, "Error opening device. Device locked."}, |
124 | {ERR_DEVICENOTEXIST, "Error opening device. Not exist."}, | 124 | {ERR_DEVICENOTEXIST, "Error opening device. Doesn't exist."}, |
125 | {ERR_DEVICEBUSY, "Error opening device. Already opened by other application."}, | 125 | {ERR_DEVICEBUSY, "Error opening device. Already opened by other application."}, |
126 | {ERR_DEVICENOPERMISSION,"Error opening device. No permissions."}, | 126 | {ERR_DEVICENOPERMISSION,"Error opening device. No permissions."}, |
127 | {ERR_DEVICENODRIVER, "Error opening device. No required driver in operating system."}, | 127 | {ERR_DEVICENODRIVER, "Error opening device. No required driver in operating system."}, |
128 | {ERR_DEVICENOTWORK, "Error opening device. Some hardware not connected/wrong configured."}, | 128 | {ERR_DEVICENOTWORK, "Error opening device. Some hardware not connected/wrong configured."}, |
129 | {ERR_DEVICEDTRRTSERROR, "Error setting device DTR or RTS."}, | 129 | {ERR_DEVICEDTRRTSERROR, "Error setting device DTR or RTS."}, |
130 | {ERR_DEVICECHANGESPEEDERROR,"Error setting device speed. Maybe speed not supported."}, | 130 | {ERR_DEVICECHANGESPEEDERROR,"Error setting device speed. Maybe speed not supported."}, |
131 | {ERR_DEVICEWRITEERROR, "Error writing device."}, | 131 | {ERR_DEVICEWRITEERROR, "Error writing device."}, |
132 | {ERR_DEVICEREADERROR, "Error during reading device"}, | 132 | {ERR_DEVICEREADERROR, "Error during reading device."}, |
133 | {ERR_DEVICEPARITYERROR, "Can't set parity on device"}, | 133 | {ERR_DEVICEPARITYERROR, "Can't set parity on device."}, |
134 | {ERR_TIMEOUT, "No response in specified timeout. Probably phone not connected."}, | 134 | {ERR_TIMEOUT, "No response in specified timeout. Probably phone not connected."}, |
135 | /* Some missed */ | 135 | /* Some missed */ |
136 | {ERR_UNKNOWNRESPONSE, "Unknown response from phone. See readme.txt, how to report it."}, | 136 | {ERR_UNKNOWNRESPONSE, "Unknown response from phone. See readme.txt, how to report it."}, |
137 | /* Some missed */ | 137 | /* Some missed */ |
138 | {ERR_UNKNOWNCONNECTIONTYPESTRING,"Unknown connection type string. Check config file."}, | 138 | {ERR_UNKNOWNCONNECTIONTYPESTRING,"Unknown connection type string. Check config file."}, |
139 | {ERR_UNKNOWNMODELSTRING,"Unknown model type string. Check config file."}, | 139 | {ERR_UNKNOWNMODELSTRING,"Unknown model type string. Check config file."}, |
140 | {ERR_SOURCENOTAVAILABLE,"Some required functions not compiled for your OS. Please contact."}, | 140 | {ERR_SOURCENOTAVAILABLE,"Some required functions not compiled for your OS. Please contact."}, |
141 | {ERR_NOTSUPPORTED, "Function not supported by phone."}, | 141 | {ERR_NOTSUPPORTED, "Function not supported by phone."}, |
142 | {ERR_EMPTY, "Entry is empty"}, | 142 | {ERR_EMPTY, "Entry is empty"}, |
143 | {ERR_SECURITYERROR, "Security error. Maybe no PIN ?"}, | 143 | {ERR_SECURITYERROR, "Security error. Maybe no PIN ?"}, |
144 | {ERR_INVALIDLOCATION, "Invalid location. Maybe too high ?"}, | 144 | {ERR_INVALIDLOCATION, "Invalid location. Maybe too high ?"}, |
145 | {ERR_NOTIMPLEMENTED, "Function not implemented. Help required."}, | 145 | {ERR_NOTIMPLEMENTED, "Function not implemented. Help required."}, |
146 | {ERR_FULL, "Memory full."}, | 146 | {ERR_FULL, "Memory full."}, |
147 | {ERR_UNKNOWN, "Unknown error."}, | 147 | {ERR_UNKNOWN, "Unknown error."}, |
148 | /* Some missed */ | 148 | /* Some missed */ |
149 | {ERR_CANTOPENFILE, "Can't open specified file. Read only ?"}, | 149 | {ERR_CANTOPENFILE, "Can't open specified file. Read only ?"}, |
150 | {ERR_MOREMEMORY, "More memory required..."}, | 150 | {ERR_MOREMEMORY, "More memory required..."}, |
151 | {ERR_PERMISSION, "Permission to file/device required..."}, | 151 | {ERR_PERMISSION, "Permission to file/device required..."}, |
152 | {ERR_EMPTYSMSC, "Empty SMSC number. Set in phone or use -smscnumber"}, | 152 | {ERR_EMPTYSMSC, "Empty SMSC number. Set in phone or use -smscnumber."}, |
153 | {ERR_INSIDEPHONEMENU, "You're inside phone menu (during editing ?). Leave it and try again."}, | 153 | {ERR_INSIDEPHONEMENU, "You're inside phone menu (during editing ?). Leave it and try again."}, |
154 | {ERR_WORKINPROGRESS, "Function is during writing. If want help, please contact with authors."}, | 154 | {ERR_WORKINPROGRESS, "Function is during writing. If want help, please contact with authors."}, |
155 | {ERR_PHONEOFF, "Phone is disabled and connected to charger"}, | 155 | {ERR_PHONEOFF, "Phone is disabled and connected to charger."}, |
156 | {ERR_FILENOTSUPPORTED, "File format not supported by Gammu"}, | 156 | {ERR_FILENOTSUPPORTED, "File format not supported by Gammu."}, |
157 | {ERR_BUG, "Nobody is perfect, some bug appeared in protocol implementation. Please contact authors."}, | 157 | {ERR_BUG, "Nobody is perfect, some bug appeared in protocol implementation. Please contact authors."}, |
158 | {ERR_CANCELED, "Transfer was canceled by phone (you pressed cancel on phone?)."}, | 158 | {ERR_CANCELED, "Transfer was canceled by phone (you pressed cancel on phone?)"}, |
159 | /* Some missed */ | 159 | /* Some missed */ |
160 | {ERR_OTHERCONNECTIONREQUIRED,"Current connection type doesn't support called function."}, | 160 | {ERR_OTHERCONNECTIONREQUIRED,"Current connection type doesn't support called function."}, |
161 | /* Some missed */ | 161 | {ERR_WRONGCRC, "CRC error."}, |
162 | {ERR_INVALIDDATETIME, "Invalid date or time specified."}, | 162 | {ERR_INVALIDDATETIME, "Invalid date or time specified."}, |
163 | {ERR_MEMORY, "Phone memory error, maybe it is read only"}, | 163 | {ERR_MEMORY, "Phone memory error, maybe it is read only."}, |
164 | {ERR_INVALIDDATA, "Invalid data"}, | 164 | {ERR_INVALIDDATA, "Invalid data."}, |
165 | {ERR_FILEALREADYEXIST, "File with specified name already exist."}, | ||
165 | 166 | ||
166 | {0, ""} | 167 | {0, ""} |
167 | }; | 168 | }; |
168 | 169 | ||
169 | unsigned char *print_error(GSM_Error e, FILE *df, INI_Section *cfg) | 170 | unsigned char *print_error(GSM_Error e, FILE *df, INI_Section *cfg) |
170 | { | 171 | { |
171 | unsigned char *def = NULL; | 172 | unsigned char *def = NULL; |
172 | int i= 0; | 173 | int i= 0; |
173 | 174 | ||
174 | while (PrintErrorEntries[i].ErrorNum != 0) { | 175 | while (PrintErrorEntries[i].ErrorNum != 0) { |
175 | if (PrintErrorEntries[i].ErrorNum == e) { | 176 | if (PrintErrorEntries[i].ErrorNum == e) { |
176 | def = PrintErrorEntries[i].ErrorText; | 177 | def = PrintErrorEntries[i].ErrorText; |
177 | break; | 178 | break; |
178 | } | 179 | } |
179 | i++; | 180 | i++; |
180 | } | 181 | } |
181 | if (def == NULL) def = "Unknown error."; | 182 | if (def == NULL) def = "Unknown error."; |
182 | if (df!=NULL && di.dl!=0) fprintf(df,"[ERROR %i: %s]\n",e,def); | 183 | if (df!=NULL && di.dl!=0) fprintf(df,"[ERROR %i: %s]\n",e,def); |
183 | 184 | ||
184 | return GetMsg(cfg,def); | 185 | return GetMsg(cfg,def); |
185 | } | 186 | } |
186 | 187 | ||
187 | const char *GetGammuLocalePath(void) | 188 | const char *GetGammuLocalePath(void) |
188 | { | 189 | { |
diff --git a/gammu/emb/common/gsmcomon.h b/gammu/emb/common/gsmcomon.h index cd36708..e067955 100644 --- a/gammu/emb/common/gsmcomon.h +++ b/gammu/emb/common/gsmcomon.h | |||
@@ -45,48 +45,49 @@ typedef enum { | |||
45 | /*20*/ ERR_SOURCENOTAVAILABLE, /* Some functions not compiled in your OS */ | 45 | /*20*/ ERR_SOURCENOTAVAILABLE, /* Some functions not compiled in your OS */ |
46 | ERR_NOTSUPPORTED, /* Not supported by phone */ | 46 | ERR_NOTSUPPORTED, /* Not supported by phone */ |
47 | ERR_EMPTY, /* Empty phonebook entry, ... */ | 47 | ERR_EMPTY, /* Empty phonebook entry, ... */ |
48 | ERR_SECURITYERROR, /* Not allowed */ | 48 | ERR_SECURITYERROR, /* Not allowed */ |
49 | ERR_INVALIDLOCATION, /* Too high or too low location... */ | 49 | ERR_INVALIDLOCATION, /* Too high or too low location... */ |
50 | ERR_NOTIMPLEMENTED, /* Function not implemented */ | 50 | ERR_NOTIMPLEMENTED, /* Function not implemented */ |
51 | ERR_FULL, /* Memory is full */ | 51 | ERR_FULL, /* Memory is full */ |
52 | ERR_UNKNOWN, | 52 | ERR_UNKNOWN, |
53 | ERR_CANTOPENFILE, /* Error during opening file */ | 53 | ERR_CANTOPENFILE, /* Error during opening file */ |
54 | ERR_MOREMEMORY, /* More memory required */ | 54 | ERR_MOREMEMORY, /* More memory required */ |
55 | /*30*/ ERR_PERMISSION, /* No permission */ | 55 | /*30*/ ERR_PERMISSION, /* No permission */ |
56 | ERR_EMPTYSMSC, /* SMSC number is empty */ | 56 | ERR_EMPTYSMSC, /* SMSC number is empty */ |
57 | ERR_INSIDEPHONEMENU, /* Inside phone menu - can't make something */ | 57 | ERR_INSIDEPHONEMENU, /* Inside phone menu - can't make something */ |
58 | ERR_NOTCONNECTED, /* Phone NOT connected - can't make something */ | 58 | ERR_NOTCONNECTED, /* Phone NOT connected - can't make something */ |
59 | ERR_WORKINPROGRESS, /* Work in progress */ | 59 | ERR_WORKINPROGRESS, /* Work in progress */ |
60 | ERR_PHONEOFF, /* Phone is disabled and connected to charger */ | 60 | ERR_PHONEOFF, /* Phone is disabled and connected to charger */ |
61 | ERR_FILENOTSUPPORTED, /* File format not supported by Gammu */ | 61 | ERR_FILENOTSUPPORTED, /* File format not supported by Gammu */ |
62 | ERR_BUG, /* Found bug in implementation or phone */ | 62 | ERR_BUG, /* Found bug in implementation or phone */ |
63 | ERR_CANCELED, /* Action was canceled by user */ | 63 | ERR_CANCELED, /* Action was canceled by user */ |
64 | ERR_NEEDANOTHERANSWER, /* Inside Gammu: phone module need to send another answer frame */ | 64 | ERR_NEEDANOTHERANSWER, /* Inside Gammu: phone module need to send another answer frame */ |
65 | /*40*/ERR_OTHERCONNECTIONREQUIRED, | 65 | /*40*/ERR_OTHERCONNECTIONREQUIRED, |
66 | ERR_WRONGCRC, | 66 | ERR_WRONGCRC, |
67 | ERR_INVALIDDATETIME, /* Invalid date/time */ | 67 | ERR_INVALIDDATETIME, /* Invalid date/time */ |
68 | ERR_MEMORY, /* Phone memory error, maybe it is read only */ | 68 | ERR_MEMORY, /* Phone memory error, maybe it is read only */ |
69 | ERR_INVALIDDATA /* Invalid data */ | 69 | ERR_INVALIDDATA, /* Invalid data */ |
70 | ERR_FILEALREADYEXIST /* File with specified name already exist */ | ||
70 | } GSM_Error; | 71 | } GSM_Error; |
71 | 72 | ||
72 | extern GSM_Error NoneFunction (void); | 73 | extern GSM_Error NoneFunction (void); |
73 | extern GSM_Error NotImplementedFunction(void); | 74 | extern GSM_Error NotImplementedFunction(void); |
74 | extern GSM_Error NotSupportedFunction(void); | 75 | extern GSM_Error NotSupportedFunction(void); |
75 | 76 | ||
76 | #define NONEFUNCTION (void *) NoneFunction | 77 | #define NONEFUNCTION (void *) NoneFunction |
77 | #define NOTIMPLEMENTED (void *) NotImplementedFunction | 78 | #define NOTIMPLEMENTED (void *) NotImplementedFunction |
78 | #define NOTSUPPORTED (void *) NotSupportedFunction | 79 | #define NOTSUPPORTED (void *) NotSupportedFunction |
79 | 80 | ||
80 | unsigned char *GetMsg (INI_Section *cfg, unsigned char *default_string); | 81 | unsigned char *GetMsg (INI_Section *cfg, unsigned char *default_string); |
81 | unsigned char *print_error(GSM_Error e, FILE *df, INI_Section *cfg); | 82 | unsigned char *print_error(GSM_Error e, FILE *df, INI_Section *cfg); |
82 | 83 | ||
83 | GSM_Error GSM_SetDebugFile(char *info, Debug_Info *privdi); | 84 | GSM_Error GSM_SetDebugFile(char *info, Debug_Info *privdi); |
84 | 85 | ||
85 | const char *GetGammuLocalePath(void); | 86 | const char *GetGammuLocalePath(void); |
86 | const char *GetGammuVersion(void); | 87 | const char *GetGammuVersion(void); |
87 | 88 | ||
88 | #endif | 89 | #endif |
89 | 90 | ||
90 | /* How should editor hadle tabs in this file? Add editor commands here. | 91 | /* How should editor hadle tabs in this file? Add editor commands here. |
91 | * vim: noexpandtab sw=8 ts=8 sts=8: | 92 | * vim: noexpandtab sw=8 ts=8 sts=8: |
92 | */ | 93 | */ |
diff --git a/gammu/emb/common/gsmstate.c b/gammu/emb/common/gsmstate.c index b8f5f89..31e365d 100644 --- a/gammu/emb/common/gsmstate.c +++ b/gammu/emb/common/gsmstate.c | |||
@@ -165,124 +165,124 @@ GSM_Error GSM_RegisterAllPhoneModules(GSM_StateMachine *s) | |||
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | if (model->model[0] == 0) return ERR_UNKNOWNMODELSTRING; | 167 | if (model->model[0] == 0) return ERR_UNKNOWNMODELSTRING; |
168 | } | 168 | } |
169 | s->Phone.Functions=NULL; | 169 | s->Phone.Functions=NULL; |
170 | #ifdef GSM_ENABLE_ATGEN | 170 | #ifdef GSM_ENABLE_ATGEN |
171 | /* AT module can have the same models ID to "normal" Nokia modules */ | 171 | /* AT module can have the same models ID to "normal" Nokia modules */ |
172 | if (s->ConnectionType==GCT_AT || s->ConnectionType==GCT_BLUEAT || s->ConnectionType==GCT_IRDAAT) { | 172 | if (s->ConnectionType==GCT_AT || s->ConnectionType==GCT_BLUEAT || s->ConnectionType==GCT_IRDAAT) { |
173 | GSM_RegisterModule(s,&ATGENPhone); | 173 | GSM_RegisterModule(s,&ATGENPhone); |
174 | if (s->Phone.Functions!=NULL) return ERR_NONE; | 174 | if (s->Phone.Functions!=NULL) return ERR_NONE; |
175 | } | 175 | } |
176 | #endif | 176 | #endif |
177 | #ifdef GSM_ENABLE_OBEXGEN | 177 | #ifdef GSM_ENABLE_OBEXGEN |
178 | GSM_RegisterModule(s,&OBEXGENPhone); | 178 | GSM_RegisterModule(s,&OBEXGENPhone); |
179 | #endif | 179 | #endif |
180 | #ifdef GSM_ENABLE_MROUTERGEN | 180 | #ifdef GSM_ENABLE_MROUTERGEN |
181 | GSM_RegisterModule(s,&MROUTERGENPhone); | 181 | GSM_RegisterModule(s,&MROUTERGENPhone); |
182 | #endif | 182 | #endif |
183 | #ifdef GSM_ENABLE_NOKIA3320 | 183 | #ifdef GSM_ENABLE_NOKIA3320 |
184 | GSM_RegisterModule(s,&N3320Phone); | 184 | GSM_RegisterModule(s,&N3320Phone); |
185 | #endif | 185 | #endif |
186 | #ifdef GSM_ENABLE_NOKIA3650 | 186 | #ifdef GSM_ENABLE_NOKIA3650 |
187 | GSM_RegisterModule(s,&N3650Phone); | 187 | GSM_RegisterModule(s,&N3650Phone); |
188 | #endif | 188 | #endif |
189 | #ifdef GSM_ENABLE_NOKIA650 | ||
190 | GSM_RegisterModule(s,&N650Phone); | ||
191 | #endif | ||
189 | #ifdef GSM_ENABLE_NOKIA6110 | 192 | #ifdef GSM_ENABLE_NOKIA6110 |
190 | GSM_RegisterModule(s,&N6110Phone); | 193 | GSM_RegisterModule(s,&N6110Phone); |
191 | #endif | 194 | #endif |
192 | #ifdef GSM_ENABLE_NOKIA6510 | 195 | #ifdef GSM_ENABLE_NOKIA6510 |
193 | GSM_RegisterModule(s,&N6510Phone); | 196 | GSM_RegisterModule(s,&N6510Phone); |
194 | #endif | 197 | #endif |
195 | #ifdef GSM_ENABLE_NOKIA7110 | 198 | #ifdef GSM_ENABLE_NOKIA7110 |
196 | GSM_RegisterModule(s,&N7110Phone); | 199 | GSM_RegisterModule(s,&N7110Phone); |
197 | #endif | 200 | #endif |
198 | #ifdef GSM_ENABLE_NOKIA9210 | 201 | #ifdef GSM_ENABLE_NOKIA9210 |
199 | GSM_RegisterModule(s,&N9210Phone); | 202 | GSM_RegisterModule(s,&N9210Phone); |
200 | #endif | 203 | #endif |
201 | #ifdef GSM_ENABLE_ALCATEL | 204 | #ifdef GSM_ENABLE_ALCATEL |
202 | GSM_RegisterModule(s,&ALCATELPhone); | 205 | GSM_RegisterModule(s,&ALCATELPhone); |
203 | #endif | 206 | #endif |
204 | if (s->Phone.Functions==NULL) return ERR_UNKNOWNMODELSTRING; | 207 | if (s->Phone.Functions==NULL) return ERR_UNKNOWNMODELSTRING; |
205 | return ERR_NONE; | 208 | return ERR_NONE; |
206 | } | 209 | } |
207 | 210 | ||
208 | GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum) | 211 | GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum) |
209 | { | 212 | { |
210 | GSM_Errorerror; | 213 | GSM_Errorerror; |
211 | GSM_DateTimetime; | 214 | GSM_DateTimetime; |
212 | int i; | 215 | int i; |
213 | char Buffer[80]; | ||
214 | 216 | ||
215 | for (i=0;i<s->ConfigNum;i++) { | 217 | for (i=0;i<s->ConfigNum;i++) { |
216 | s->CurrentConfig = &s->Config[i]; | 218 | s->CurrentConfig = &s->Config[i]; |
217 | 219 | ||
218 | s->Speed = 0; | 220 | s->Speed = 0; |
219 | s->ReplyNum = ReplyNum; | 221 | s->ReplyNum = ReplyNum; |
220 | s->Phone.Data.ModelInfo = GetModelData("unknown",NULL,NULL); | 222 | s->Phone.Data.ModelInfo = GetModelData("unknown",NULL,NULL); |
221 | s->Phone.Data.Manufacturer[0] = 0; | 223 | s->Phone.Data.Manufacturer[0] = 0; |
222 | s->Phone.Data.Model[0] = 0; | 224 | s->Phone.Data.Model[0] = 0; |
223 | s->Phone.Data.Version[0] = 0; | 225 | s->Phone.Data.Version[0] = 0; |
224 | s->Phone.Data.VerDate[0] = 0; | 226 | s->Phone.Data.VerDate[0] = 0; |
225 | s->Phone.Data.VerNum = 0; | 227 | s->Phone.Data.VerNum = 0; |
226 | s->Phone.Data.StartInfoCounter = 0; | 228 | s->Phone.Data.StartInfoCounter = 0; |
227 | s->Phone.Data.SentMsg = NULL; | 229 | s->Phone.Data.SentMsg = NULL; |
228 | 230 | ||
229 | s->Phone.Data.HardwareCache[0] = 0; | 231 | s->Phone.Data.HardwareCache[0] = 0; |
230 | s->Phone.Data.ProductCodeCache[0] = 0; | 232 | s->Phone.Data.ProductCodeCache[0] = 0; |
231 | s->Phone.Data.EnableIncomingCall = false; | 233 | s->Phone.Data.EnableIncomingCall = false; |
232 | s->Phone.Data.EnableIncomingSMS = false; | 234 | s->Phone.Data.EnableIncomingSMS = false; |
233 | s->Phone.Data.EnableIncomingCB = false; | 235 | s->Phone.Data.EnableIncomingCB = false; |
234 | s->Phone.Data.EnableIncomingUSSD = false; | 236 | s->Phone.Data.EnableIncomingUSSD = false; |
235 | s->User.UserReplyFunctions = NULL; | 237 | s->User.UserReplyFunctions = NULL; |
236 | s->User.IncomingCall = NULL; | 238 | s->User.IncomingCall = NULL; |
237 | s->User.IncomingSMS = NULL; | 239 | s->User.IncomingSMS = NULL; |
238 | s->User.IncomingCB = NULL; | 240 | s->User.IncomingCB = NULL; |
239 | s->User.IncomingUSSD = NULL; | 241 | s->User.IncomingUSSD = NULL; |
240 | s->User.SendSMSStatus = NULL; | 242 | s->User.SendSMSStatus = NULL; |
241 | s->LockFile = NULL; | 243 | s->LockFile = NULL; |
242 | s->opened = false; | 244 | s->opened = false; |
243 | s->Phone.Functions = NULL; | 245 | s->Phone.Functions = NULL; |
244 | 246 | ||
245 | s->di = di; | 247 | s->di = di; |
246 | s->di.use_global = s->CurrentConfig->UseGlobalDebugFile; | 248 | s->di.use_global = s->CurrentConfig->UseGlobalDebugFile; |
247 | GSM_SetDebugLevel(s->CurrentConfig->DebugLevel, &s->di); | 249 | GSM_SetDebugLevel(s->CurrentConfig->DebugLevel, &s->di); |
248 | error=GSM_SetDebugFile(s->CurrentConfig->DebugFile, &s->di); | 250 | error=GSM_SetDebugFile(s->CurrentConfig->DebugFile, &s->di); |
249 | if (error != ERR_NONE) return error; | 251 | if (error != ERR_NONE) return error; |
250 | 252 | ||
251 | if (s->di.dl == DL_TEXTALL || s->di.dl == DL_TEXT || s->di.dl == DL_TEXTERROR || | 253 | if (s->di.dl == DL_TEXTALL || s->di.dl == DL_TEXT || s->di.dl == DL_TEXTERROR || |
252 | s->di.dl == DL_TEXTALLDATE || s->di.dl == DL_TEXTDATE || s->di.dl == DL_TEXTERRORDATE) { | 254 | s->di.dl == DL_TEXTALLDATE || s->di.dl == DL_TEXTDATE || s->di.dl == DL_TEXTERRORDATE) { |
253 | smprintf(s,"[Gammu - version %s built %s %s]\n",VERSION,__TIME__,__DATE__); | 255 | smprintf(s,"[Gammu - %s built %s %s",VERSION,__TIME__,__DATE__); |
254 | smprintf(s,"[Connection - \"%s\"]\n",s->CurrentConfig->Connection); | 256 | if (strlen(GetCompiler()) != 0) { |
257 | smprintf(s," in %s",GetCompiler()); | ||
258 | } | ||
259 | smprintf(s,"]\n[Connection - \"%s\"]\n",s->CurrentConfig->Connection); | ||
255 | smprintf(s,"[Model type - \"%s\"]\n",s->CurrentConfig->Model); | 260 | smprintf(s,"[Model type - \"%s\"]\n",s->CurrentConfig->Model); |
256 | smprintf(s,"[Device - \"%s\"]\n",s->CurrentConfig->Device); | 261 | smprintf(s,"[Device - \"%s\"]\n",s->CurrentConfig->Device); |
257 | 262 | if (strlen(GetOS()) != 0) { | |
258 | Buffer[0] = 0; | 263 | smprintf(s,"[Run on - %s]\n",GetOS()); |
259 | if (strlen(GetOS()) != 0) sprintf(Buffer,"%s",GetOS()); | ||
260 | if (strlen(GetCompiler()) != 0) { | ||
261 | if (Buffer[0] != 0) strcat(Buffer+strlen(Buffer),", "); | ||
262 | strcat(Buffer+strlen(Buffer),GetCompiler()); | ||
263 | } | 264 | } |
264 | if (Buffer[0] != 0) smprintf(s,"[OS/compiler - %s]\n",Buffer); | ||
265 | } | 265 | } |
266 | if (s->di.dl==DL_BINARY) { | 266 | if (s->di.dl==DL_BINARY) { |
267 | smprintf(s,"%c",((unsigned char)strlen(VERSION))); | 267 | smprintf(s,"%c",((unsigned char)strlen(VERSION))); |
268 | smprintf(s,"%s",VERSION); | 268 | smprintf(s,"%s",VERSION); |
269 | } | 269 | } |
270 | 270 | ||
271 | error=GSM_RegisterAllConnections(s, s->CurrentConfig->Connection); | 271 | error=GSM_RegisterAllConnections(s, s->CurrentConfig->Connection); |
272 | if (error!=ERR_NONE) return error; | 272 | if (error!=ERR_NONE) return error; |
273 | 273 | ||
274 | /* Model auto */ | 274 | /* Model auto */ |
275 | if (s->CurrentConfig->Model[0]==0) { | 275 | if (s->CurrentConfig->Model[0]==0) { |
276 | if (mystrncasecmp(s->CurrentConfig->LockDevice,"yes",0)) { | 276 | if (mystrncasecmp(s->CurrentConfig->LockDevice,"yes",0)) { |
277 | error = lock_device(s->CurrentConfig->Device, &(s->LockFile)); | 277 | error = lock_device(s->CurrentConfig->Device, &(s->LockFile)); |
278 | if (error != ERR_NONE) return error; | 278 | if (error != ERR_NONE) return error; |
279 | } | 279 | } |
280 | 280 | ||
281 | /* Irda devices can set now model to some specific and | 281 | /* Irda devices can set now model to some specific and |
282 | * we don't have to make auto detection later */ | 282 | * we don't have to make auto detection later */ |
283 | error=s->Device.Functions->OpenDevice(s); | 283 | error=s->Device.Functions->OpenDevice(s); |
284 | if (i != s->ConfigNum - 1) { | 284 | if (i != s->ConfigNum - 1) { |
285 | if (error == ERR_DEVICEOPENERROR) continue; | 285 | if (error == ERR_DEVICEOPENERROR) continue; |
286 | if (error == ERR_DEVICELOCKED) continue; | 286 | if (error == ERR_DEVICELOCKED) continue; |
287 | if (error == ERR_DEVICENOTEXIST) continue; | 287 | if (error == ERR_DEVICENOTEXIST) continue; |
288 | if (error == ERR_DEVICEBUSY) continue; | 288 | if (error == ERR_DEVICEBUSY) continue; |
@@ -533,66 +533,77 @@ GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, | |||
533 | if (reply!=0) { | 533 | if (reply!=0) { |
534 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR || | 534 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR || |
535 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE) | 535 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE) |
536 | { | 536 | { |
537 | smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type); | 537 | smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type); |
538 | } | 538 | } |
539 | } | 539 | } |
540 | error = s->Protocol.Functions->WriteMessage(s, buffer, length, type); | 540 | error = s->Protocol.Functions->WriteMessage(s, buffer, length, type); |
541 | if (error!=ERR_NONE) return error; | 541 | if (error!=ERR_NONE) return error; |
542 | 542 | ||
543 | error = GSM_WaitForOnce(s, buffer, length, type, time); | 543 | error = GSM_WaitForOnce(s, buffer, length, type, time); |
544 | if (error != ERR_TIMEOUT) return error; | 544 | if (error != ERR_TIMEOUT) return error; |
545 | } | 545 | } |
546 | 546 | ||
547 | return Phone->DispatchError; | 547 | return Phone->DispatchError; |
548 | } | 548 | } |
549 | 549 | ||
550 | static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Reply, int *reply) | 550 | static 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 | 558 | ||
558 | while (Reply[i].requestID!=ID_None) { | 559 | while (Reply[i].requestID!=ID_None) { |
559 | execute=false; | 560 | execute=false; |
560 | /* Binary frames like in Nokia */ | 561 | /* Binary frames like in Nokia */ |
561 | if (strlen(Reply[i].msgtype) < 2) { | 562 | if (strlen(Reply[i].msgtype) < 2) { |
562 | if (Reply[i].msgtype[0]==msg->Type) { | 563 | if (Reply[i].msgtype[0]==msg->Type) { |
563 | if (Reply[i].subtypechar!=0) { | 564 | if (Reply[i].subtypechar!=0) { |
564 | if (Reply[i].subtypechar<=msg->Length) { | 565 | if (Reply[i].subtypechar<=msg->Length) { |
565 | if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype) | 566 | if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype) |
566 | execute=true; | 567 | execute=true; |
567 | } | 568 | } |
568 | } else execute=true; | 569 | } else execute=true; |
569 | } | 570 | } |
570 | } else { | 571 | } else { |
572 | // printf("msg length %i %i\n",strlen(Reply[i].msgtype),msg->Length); | ||
573 | if ((int)strlen(Reply[i].msgtype)<msg->Length) { | ||
574 | // printf("Comparing \"%s\" and \"",Reply[i].msgtype); | ||
575 | // for (j=0;j<strlen(Reply[i].msgtype);j++) { | ||
576 | // if (msg->Buffer[j]!=13 && msg->Buffer[j]!=10) { | ||
577 | // printf("%c",msg->Buffer[j]); | ||
578 | // } | ||
579 | // } | ||
580 | // printf("\"\n"); | ||
571 | 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) { |
572 | execute=true; | 582 | execute=true; |
573 | } | 583 | } |
574 | } | 584 | } |
585 | } | ||
575 | 586 | ||
576 | if (execute) { | 587 | if (execute) { |
577 | *reply=i; | 588 | *reply=i; |
578 | if (Reply[i].requestID == ID_IncomingFrame || | 589 | if (Reply[i].requestID == ID_IncomingFrame || |
579 | Reply[i].requestID == Data->RequestID || | 590 | Reply[i].requestID == Data->RequestID || |
580 | Data->RequestID== ID_EachFrame) { | 591 | Data->RequestID== ID_EachFrame) { |
581 | return ERR_NONE; | 592 | return ERR_NONE; |
582 | } | 593 | } |
583 | available=true; | 594 | available=true; |
584 | } | 595 | } |
585 | i++; | 596 | i++; |
586 | } | 597 | } |
587 | 598 | ||
588 | if (available) { | 599 | if (available) { |
589 | return ERR_FRAMENOTREQUESTED; | 600 | return ERR_FRAMENOTREQUESTED; |
590 | } else { | 601 | } else { |
591 | return ERR_UNKNOWNFRAME; | 602 | return ERR_UNKNOWNFRAME; |
592 | } | 603 | } |
593 | } | 604 | } |
594 | 605 | ||
595 | GSM_Error GSM_DispatchMessage(GSM_StateMachine *s) | 606 | GSM_Error GSM_DispatchMessage(GSM_StateMachine *s) |
596 | { | 607 | { |
597 | GSM_Error error= ERR_UNKNOWNFRAME; | 608 | GSM_Error error= ERR_UNKNOWNFRAME; |
598 | GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; | 609 | GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; |
@@ -824,207 +835,228 @@ bool GSM_ReadConfig(INI_Section *cfg_info, GSM_Config *cfg, int num) | |||
824 | if (!Temp) { | 835 | if (!Temp) { |
825 | strcpy(cfg->Model,DefaultModel); | 836 | strcpy(cfg->Model,DefaultModel); |
826 | } else { | 837 | } else { |
827 | cfg->DefaultModel = false; | 838 | cfg->DefaultModel = false; |
828 | strcpy(cfg->Model,Temp); | 839 | strcpy(cfg->Model,Temp); |
829 | } | 840 | } |
830 | Temp = INI_GetValue(cfg_info, section, "logformat", false); | 841 | Temp = INI_GetValue(cfg_info, section, "logformat", false); |
831 | if (!Temp) { | 842 | if (!Temp) { |
832 | strcpy(cfg->DebugLevel,DefaultDebugLevel); | 843 | strcpy(cfg->DebugLevel,DefaultDebugLevel); |
833 | } else { | 844 | } else { |
834 | cfg->DefaultDebugLevel = false; | 845 | cfg->DefaultDebugLevel = false; |
835 | strcpy(cfg->DebugLevel,Temp); | 846 | strcpy(cfg->DebugLevel,Temp); |
836 | } | 847 | } |
837 | cfg->StartInfo = INI_GetValue(cfg_info, section, "startinfo", false); | 848 | cfg->StartInfo = INI_GetValue(cfg_info, section, "startinfo", false); |
838 | if (!cfg->StartInfo) { | 849 | if (!cfg->StartInfo) { |
839 | free(cfg->StartInfo); | 850 | free(cfg->StartInfo); |
840 | cfg->StartInfo = strdup(DefaultStartInfo); | 851 | cfg->StartInfo = strdup(DefaultStartInfo); |
841 | } else { | 852 | } else { |
842 | cfg->DefaultStartInfo = false; | 853 | cfg->DefaultStartInfo = false; |
843 | } | 854 | } |
844 | return true; | 855 | return true; |
845 | } | 856 | } |
846 | 857 | ||
847 | static OnePhoneModel allmodels[] = { | 858 | static OnePhoneModel allmodels[] = { |
859 | #ifdef GSM_ENABLE_NOKIA650 | ||
860 | {"0650" ,"THF-12","", {0}}, | ||
861 | #endif | ||
848 | #ifdef GSM_ENABLE_NOKIA6510 | 862 | #ifdef GSM_ENABLE_NOKIA6510 |
849 | {"1100", "RH-18" ,"", {0}}, | 863 | {"1100", "RH-18" ,"", {0}}, |
850 | {"1100a","RH-38" ,"", {0}}, | 864 | {"1100a","RH-38" ,"", {0}}, |
851 | {"1100b","RH-36" ,"", {0}}, | 865 | {"1100b","RH-36" ,"", {0}}, |
852 | #endif | 866 | #endif |
853 | #ifdef GSM_ENABLE_NOKIA6110 | 867 | #ifdef GSM_ENABLE_NOKIA6110 |
854 | {"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 |
855 | #endif | 869 | #endif |
856 | #ifdef GSM_ENABLE_NOKIA6510 | 870 | #ifdef GSM_ENABLE_NOKIA6510 |
857 | {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}}, | 871 | {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme |
858 | {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}}, | 872 | {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme |
859 | {"3108", "RH-6", "Nokia 3108",{0}}, //does it have irda ? | 873 | {"3108", "RH-6", "Nokia 3108",{0}}, //does it have irda ? |
860 | {"3200", "RH-30" ,"Nokia 3200",{F_PBKTONEGAL,0}}, | 874 | {"3200", "RH-30" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme |
861 | {"3200a","RH-31" ,"Nokia 3200",{F_PBKTONEGAL,0}}, | 875 | {"3200a","RH-31" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme |
862 | #endif | 876 | #endif |
863 | #ifdef GSM_ENABLE_NOKIA6110 | 877 | #ifdef GSM_ENABLE_NOKIA6110 |
864 | {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, | 878 | {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, |
865 | {"3210" ,"NSE-9" ,"", {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}}, |
866 | #endif | 880 | #endif |
867 | #ifdef GSM_ENABLE_NOKIA6510 | 881 | #ifdef GSM_ENABLE_NOKIA6510 |
868 | {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}}, | 882 | {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme |
869 | {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}}, | 883 | {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme |
870 | #endif | 884 | #endif |
871 | #ifdef GSM_ENABLE_NOKIA6110 | 885 | #ifdef GSM_ENABLE_NOKIA6110 |
872 | {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, | 886 | {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, |
873 | #endif | 887 | #endif |
874 | #ifdef GSM_ENABLE_NOKIA3320 | 888 | #ifdef GSM_ENABLE_NOKIA3320 |
875 | {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme | 889 | {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme |
876 | #endif | 890 | #endif |
877 | #ifdef GSM_ENABLE_NOKIA6110 | 891 | #ifdef GSM_ENABLE_NOKIA6110 |
878 | {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, | 892 | {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, |
879 | {"3390" ,"NPB-1" ,"", {F_NOWAP,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}}, |
880 | {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, | 894 | {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, |
881 | #endif | 895 | #endif |
882 | #ifdef GSM_ENABLE_NOKIA6510 | 896 | #ifdef GSM_ENABLE_NOKIA6510 |
883 | {"3510" ,"NHM-8" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, | 897 | {"3510" ,"NHM-8" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, |
884 | {"3510i","RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, | 898 | {"3510i","RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, |
885 | {"3530" ,"RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, | 899 | {"3530" ,"RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, |
886 | {"3589i","RH-44" ,"", {F_VOICETAGS,0}}, | 900 | {"3589i","RH-44" ,"", {F_VOICETAGS,0}}, |
887 | {"3590" ,"NPM-8" ,"", {0}},//irda? | 901 | {"3590" ,"NPM-8" ,"", {0}},//irda? |
888 | {"3595" ,"NPM-10" ,"", {0}},//irda? | 902 | {"3595" ,"NPM-10" ,"", {0}},//irda? |
889 | #endif | 903 | #endif |
890 | #ifdef GSM_ENABLE_NOKIA6110 | 904 | #ifdef GSM_ENABLE_NOKIA6110 |
891 | {"3610" ,"NAM-1" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess | 905 | {"3610" ,"NAM-1" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess |
892 | #endif | 906 | #endif |
893 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA3650) | 907 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA3650) |
894 | {"3650" ,"NHL-8" ,"Nokia 3650", {0}}, | 908 | {"3650" ,"NHL-8" ,"Nokia 3650", {0}}, |
895 | {"NGAGE","NEM-4" ,"", {F_RADIO,0}}, | 909 | {"NGAGE","NEM-4" ,"", {F_RADIO,0}}, |
896 | #endif | 910 | #endif |
897 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 911 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
898 | {"5100" ,"NPM-6" ,"Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 912 | {"5100" ,"NPM-6" ,"Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
899 | {"5100" ,"NPM-6U","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 913 | {"5100" ,"NPM-6U","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
900 | {"5100" ,"NPM-6X","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 914 | {"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-5" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}}, | ||
901 | #endif | 917 | #endif |
902 | #ifdef GSM_ENABLE_NOKIA6110 | 918 | #ifdef GSM_ENABLE_NOKIA6110 |
903 | {"5110" ,"NSE-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, | 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}}, |
904 | {"5110i","NSE-2" ,"", {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}}, |
905 | {"5130" ,"NSK-1" ,"", {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}}, |
906 | {"5190" ,"NSB-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}}, |
907 | #endif | 923 | #endif |
908 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) | 924 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) |
909 | {"5210" ,"NSM-5" ,"Nokia 5210", {F_CAL52,F_NOSTARTANI,F_NOPICTUREUNI,F_NODTMF,0}}, | 925 | {"5210" ,"NSM-5" ,"Nokia 5210", {F_CAL52,F_NOSTARTANI,F_NOPICTUREUNI,F_NODTMF,0}}, |
910 | #endif | 926 | #endif |
911 | #ifdef GSM_ENABLE_NOKIA6110 | 927 | #ifdef GSM_ENABLE_NOKIA6110 |
912 | {"5510" ,"NPM-5" ,"", {F_NOCALLER,F_PROFILES33,F_NOPICTUREUNI,0}}, | 928 | {"5510" ,"NPM-5" ,"", {F_NOCALLER,F_PROFILES33,F_NOPICTUREUNI,0}}, |
913 | #endif | 929 | #endif |
914 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 930 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
915 | {"6100" ,"NPL-2" ,"Nokia 6100", {F_PBKTONEGAL,F_TODO66,0}}, | 931 | {"6100" ,"NPL-2" ,"Nokia 6100", {F_PBKTONEGAL,F_TODO66,0}}, |
916 | #endif | 932 | #endif |
917 | #ifdef GSM_ENABLE_NOKIA6110 | 933 | #ifdef GSM_ENABLE_NOKIA6110 |
918 | {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, | 934 | {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, |
919 | {"6130" ,"NSK-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}}, |
920 | {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}}, | 936 | {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}}, |
921 | {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, | 937 | {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, |
922 | #endif | 938 | #endif |
923 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 939 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
924 | {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}}, | 940 | {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}}, |
925 | {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,0}}, | 941 | {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, |
926 | #endif | 942 | #endif |
927 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) | 943 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) |
928 | {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}}, | 944 | {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}}, |
929 | {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}}, | 945 | {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}}, |
930 | #endif | 946 | #endif |
931 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 947 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
932 | {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,0}}, | 948 | {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, |
933 | {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, | 949 | {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, |
934 | {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}}, | 950 | {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}}, |
935 | {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, | 951 | {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, |
936 | {"6510" ,"NPM-9" ,"Nokia 6510", {F_TODO63,F_CAL65,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,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}}, |
937 | {"6610" ,"NHL-4U","Nokia 6610", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 953 | {"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}}, | ||
938 | {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, | 955 | {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, |
939 | {"6800" ,"NHL-6" ,"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 | {"6810" ,"RM-2" ,"Nokia 6810", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess | ||
958 | {"6820" ,"NHL-9" ,"Nokia 6820", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess | ||
940 | #endif | 959 | #endif |
941 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) | 960 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) |
942 | {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}}, | 961 | {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}}, |
943 | {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}}, | 962 | {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}}, |
944 | #endif | 963 | #endif |
945 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 964 | #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 | ||
946 | {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 966 | {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
947 | {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, | 967 | {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, |
948 | {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, | 968 | {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, |
949 | {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}}, | 969 | {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}}, |
950 | #endif | 970 | #endif |
951 | #if defined(GSM_ENABLE_ATGEN) | 971 | #if defined(GSM_ENABLE_ATGEN) |
952 | {"7650" ,"NHL-2" ,"Nokia 7650", {0}}, | 972 | {"7650" ,"NHL-2" ,"Nokia 7650", {0}}, |
953 | #endif | 973 | #endif |
954 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) | 974 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) |
955 | {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, | 975 | {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, |
956 | {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}}, | 976 | {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}}, |
957 | {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, | 977 | {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, |
958 | #endif | 978 | #endif |
959 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 979 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
960 | {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, | 980 | {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, |
961 | {"8390" ,"NSB-8" ,"Nokia 8390", {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}}, |
962 | #endif | 982 | #endif |
963 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) | 983 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) |
964 | {"8850" ,"NSM-2" ,"Nokia 8850", {0}}, | 984 | {"8850" ,"NSM-2" ,"Nokia 8850", {0}}, |
965 | {"8855" ,"NSM-4" ,"Nokia 8855", {0}}, | 985 | {"8855" ,"NSM-4" ,"Nokia 8855", {0}}, |
966 | {"8890" ,"NSB-6" ,"Nokia 8890", {0}}, | 986 | {"8890" ,"NSB-6" ,"Nokia 8890", {0}}, |
967 | #endif | 987 | #endif |
968 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 988 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
969 | {"8910" ,"NHM-4" ,"Nokia 8910", {F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, | 989 | {"8910" ,"NHM-4" ,"Nokia 8910", {F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, |
970 | {"8910i","NHM-4" ,"Nokia 8910i",{F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, | 990 | {"8910i","NHM-4" ,"Nokia 8910i",{F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, |
971 | #endif | 991 | #endif |
972 | #ifdef GSM_ENABLE_NOKIA9210 | 992 | #ifdef GSM_ENABLE_NOKIA9210 |
973 | {"9210" ,"RAE-3" ,"", {0}}, | 993 | {"9210" ,"RAE-3" ,"", {0}}, |
974 | {"9210i","RAE-5" ,"", {0}}, | 994 | {"9210i","RAE-5" ,"", {0}}, |
975 | #endif | 995 | #endif |
976 | #ifdef GSM_ENABLE_ATGEN | 996 | #ifdef GSM_ENABLE_ATGEN |
977 | {"at" , "at", "", {0}}, | 997 | {"at" , "at", "", {0}}, |
998 | /* Siemens */ | ||
978 | {"M20" , "M20", "", {F_M20SMS,F_SLOWWRITE,0}}, | 999 | {"M20" , "M20", "", {F_M20SMS,F_SLOWWRITE,0}}, |
979 | {"MC35" , "MC35", "", {0}}, | 1000 | {"MC35" , "MC35", "", {0}}, |
1001 | {"TC35" , "TC35", "", {0}}, | ||
980 | {"S25", "S25", "SIEMENS S25", {0}}, | 1002 | {"S25", "S25", "SIEMENS S25", {0}}, |
981 | {"C35i" , "C35i", "", {0}}, | 1003 | {"C35i" , "C35i", "", {0}}, |
982 | {"S35i" , "S35i", "", {0}}, | 1004 | {"S35i" , "S35i", "", {0}}, |
983 | {"M35i" , "M35i", "", {0}}, | 1005 | {"M35i" , "M35i", "", {0}}, |
984 | {"S40" , "Siemens S40", "", {0}}, | 1006 | {"S40" , "Siemens S40", "", {0}}, |
985 | {"C45" , "C45", "", {0}}, | 1007 | {"C45" , "C45", "", {0}}, |
986 | {"S45" , "S45", "", {0}}, | 1008 | {"S45" , "S45", "", {0}}, |
987 | {"ME45" , "ME45", "", {0}}, | 1009 | {"ME45" , "ME45", "", {0}}, |
988 | {"SL45" , "SL45", "", {0}}, | 1010 | {"SL45" , "SL45", "", {0}}, |
989 | {"SL45i" , "SL45i", "", {0}}, | 1011 | {"SL45i" , "SL45i", "", {0}}, |
990 | {"M50" , "M50", "", {0}}, | 1012 | {"M50" , "M50", "", {0}}, |
991 | {"S45" , "6618" , "", {0}}, | 1013 | {"S45" , "6618" , "", {0}}, |
992 | {"ME45" , "3618" , "", {0}}, | 1014 | {"ME45" , "3618" , "", {0}}, |
993 | {"S55" , "S55" , "", {0}}, | 1015 | {"S55" , "S55" , "", {0}}, |
1016 | /* Samsung */ | ||
1017 | {"S100" , "SGH-S100" , "", {0}}, | ||
1018 | {"S200" , "SGH-S200" , "", {0}}, | ||
1019 | {"S300" , "SGH-S300" , "", {0}}, | ||
1020 | {"S500" , "SGH-S500" , "", {0}}, | ||
1021 | {"V200" , "SGH-V200" , "", {0}}, | ||
1022 | {"T100" , "SGH-T100" , "", {0}}, | ||
1023 | {"E700" , "SGH-E700" , "", {0}}, | ||
1024 | /* Ericsson/Sony Ericsson */ | ||
994 | {"T28s", "1101101-BVT28s","", {0}}, | 1025 | {"T28s", "1101101-BVT28s","", {0}}, |
995 | {"R320s" , "1101201-BV R320s","", {0}}, | 1026 | {"R320s" , "1101201-BV R320s","", {0}}, |
996 | {"R380s", "7100101-BVR380s" ,"", {0}}, | 1027 | {"R380s", "7100101-BVR380s" ,"", {0}}, |
997 | {"R520m", "1130101-BVR520m" ,"", {0}}, | 1028 | {"R520m", "1130101-BVR520m" ,"", {0}}, |
998 | {"T39m", "1130102-BVT39m" ,"", {0}}, | 1029 | {"T39m", "1130102-BVT39m" ,"", {0}}, |
999 | {"T65", "1101901-BVT65" , "", {0}}, | 1030 | {"T65", "1101901-BVT65" , "", {0}}, |
1000 | {"T68", "1130201-BVT68" , "", {0}}, | 1031 | {"T68", "1130201-BVT68" , "", {0}}, |
1001 | {"T68i", "1130202-BVT68" , "", {0}}, | 1032 | {"T68i", "1130202-BVT68" , "", {0}}, |
1002 | {"R600", "102001-BVR600" , "", {0}}, | 1033 | {"R600", "102001-BVR600" , "", {0}}, |
1003 | {"T200", "1130501-BVT200" ,"", {0}}, | 1034 | {"T200", "1130501-BVT200" ,"", {0}}, |
1004 | {"T300", "1130601-BVT300" ,"T300", {0}}, | 1035 | {"T300", "1130601-BVT300" ,"T300", {0}}, |
1005 | {"T310", "1130602-BVT310" ,"", {0}}, | 1036 | {"T310", "1130602-BVT310" ,"", {0}}, |
1006 | {"P800", "7130501-BVP800" ,"", {0}}, | 1037 | {"P800", "7130501-BVP800" ,"", {0}}, |
1038 | /* Other */ | ||
1007 | {"iPAQ" , "iPAQ" , "" , {0}}, | 1039 | {"iPAQ" , "iPAQ" , "" , {0}}, |
1008 | {"A2D" , "A2D" , "" , {0}}, | 1040 | {"A2D" , "A2D" , "" , {0}}, |
1009 | {"9210" , "RAE-3", "Nokia Communicator GSM900/1800",{0}}, | 1041 | {"9210" , "RAE-3", "Nokia Communicator GSM900/1800",{0}}, |
1010 | {"myV-65", "myV-65 GPRS", "", {F_SMSME900,0}}, | 1042 | {"myV-65", "myV-65 GPRS", "", {F_SMSME900,0}}, |
1011 | #endif | 1043 | #endif |
1012 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_ALCATEL) | 1044 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_ALCATEL) |
1013 | {"BE5", "ONE TOUCH 500","", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, | 1045 | {"BE5", "ONE TOUCH 500","", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, |
1014 | {"BH4", "ONE TOUCH 535","ALCATEL OT535", {F_ALCATEL,F_SMSONLYSENT,0}}, | 1046 | {"BH4", "ONE TOUCH 535","ALCATEL OT535", {F_ALCATEL,F_SMSONLYSENT,0}}, |
1015 | {"BF5", "ONE TOUCH 715","ALCATEL OT715", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, | 1047 | {"BF5", "ONE TOUCH 715","ALCATEL OT715", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, |
1016 | #endif | 1048 | #endif |
1017 | {"unknown", "" ,"", {0}} | 1049 | {"unknown", "" ,"", {0}} |
1018 | }; | 1050 | }; |
1019 | 1051 | ||
1020 | OnePhoneModel *GetModelData(char *model, char *number, char *irdamodel) | 1052 | OnePhoneModel *GetModelData(char *model, char *number, char *irdamodel) |
1021 | { | 1053 | { |
1022 | int i = 0; | 1054 | int i = 0; |
1023 | 1055 | ||
1024 | while (strcmp(allmodels[i].number,"") != 0) { | 1056 | while (strcmp(allmodels[i].number,"") != 0) { |
1025 | if (model !=NULL) { | 1057 | if (model !=NULL) { |
1026 | if (strcmp (model, allmodels[i].model) == 0) { | 1058 | if (strcmp (model, allmodels[i].model) == 0) { |
1027 | return (&allmodels[i]); | 1059 | return (&allmodels[i]); |
1028 | } | 1060 | } |
1029 | } | 1061 | } |
1030 | if (number !=NULL) { | 1062 | if (number !=NULL) { |
diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h index cb17623..2b4806c 100644 --- a/gammu/emb/common/gsmstate.h +++ b/gammu/emb/common/gsmstate.h | |||
@@ -1,40 +1,48 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */ | 1 | /* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */ |
2 | 2 | ||
3 | #ifndef __gsm_state_h | 3 | #ifndef __gsm_state_h |
4 | #define __gsm_state_h | 4 | #define __gsm_state_h |
5 | 5 | ||
6 | #include <time.h> | 6 | #include <time.h> |
7 | 7 | ||
8 | #include "config.h" | 8 | #include "config.h" |
9 | #include "misc/cfg.h" | 9 | #include "misc/cfg.h" |
10 | 10 | ||
11 | typedef struct _GSM_StateMachine GSM_StateMachine; | ||
12 | typedef struct _GSM_User GSM_User; | ||
13 | typedef struct _OnePhoneModel OnePhoneModel; | ||
14 | typedef struct _GSM_Reply_FunctionGSM_Reply_Function; | ||
15 | |||
11 | #ifdef GSM_ENABLE_NOKIA3320 | 16 | #ifdef GSM_ENABLE_NOKIA3320 |
12 | # include "phone/nokia/dct4/n3320.h" | 17 | # include "phone/nokia/dct4/n3320.h" |
13 | #endif | 18 | #endif |
14 | #ifdef GSM_ENABLE_NOKIA3650 | 19 | #ifdef GSM_ENABLE_NOKIA3650 |
15 | # include "phone/nokia/dct4/n3650.h" | 20 | # include "phone/nokia/dct4/n3650.h" |
16 | #endif | 21 | #endif |
22 | #ifdef GSM_ENABLE_NOKIA650 | ||
23 | # include "phone/nokia/dct3/n0650.h" | ||
24 | #endif | ||
17 | #ifdef GSM_ENABLE_NOKIA6110 | 25 | #ifdef GSM_ENABLE_NOKIA6110 |
18 | # include "phone/nokia/dct3/n6110.h" | 26 | # include "phone/nokia/dct3/n6110.h" |
19 | #endif | 27 | #endif |
20 | #ifdef GSM_ENABLE_NOKIA6510 | 28 | #ifdef GSM_ENABLE_NOKIA6510 |
21 | # include "phone/nokia/dct4/n6510.h" | 29 | # include "phone/nokia/dct4/n6510.h" |
22 | #endif | 30 | #endif |
23 | #ifdef GSM_ENABLE_NOKIA7110 | 31 | #ifdef GSM_ENABLE_NOKIA7110 |
24 | # include "phone/nokia/dct3/n7110.h" | 32 | # include "phone/nokia/dct3/n7110.h" |
25 | #endif | 33 | #endif |
26 | #ifdef GSM_ENABLE_NOKIA9210 | 34 | #ifdef GSM_ENABLE_NOKIA9210 |
27 | # include "phone/nokia/dct3/n9210.h" | 35 | # include "phone/nokia/dct3/n9210.h" |
28 | #endif | 36 | #endif |
29 | #ifdef GSM_ENABLE_ATGEN | 37 | #ifdef GSM_ENABLE_ATGEN |
30 | # include "phone/at/atgen.h" | 38 | # include "phone/at/atgen.h" |
31 | #endif | 39 | #endif |
32 | #ifdef GSM_ENABLE_ALCATEL | 40 | #ifdef GSM_ENABLE_ALCATEL |
33 | # include "phone/alcatel/alcatel.h" | 41 | # include "phone/alcatel/alcatel.h" |
34 | #endif | 42 | #endif |
35 | #ifdef GSM_ENABLE_OBEXGEN | 43 | #ifdef GSM_ENABLE_OBEXGEN |
36 | # include "phone/obex/obexgen.h" | 44 | # include "phone/obex/obexgen.h" |
37 | #endif | 45 | #endif |
38 | #ifdef GSM_ENABLE_MROUTERGEN | 46 | #ifdef GSM_ENABLE_MROUTERGEN |
39 | # include "phone/symbian/mroutgen.h" | 47 | # include "phone/symbian/mroutgen.h" |
40 | #endif | 48 | #endif |
@@ -73,49 +81,49 @@ | |||
73 | # undef GSM_ENABLE_BLUEOBEX | 81 | # undef GSM_ENABLE_BLUEOBEX |
74 | #endif | 82 | #endif |
75 | #ifndef GSM_USED_ALCABUS | 83 | #ifndef GSM_USED_ALCABUS |
76 | # undef GSM_ENABLE_ALCABUS | 84 | # undef GSM_ENABLE_ALCABUS |
77 | #endif | 85 | #endif |
78 | #ifndef GSM_USED_IRDAPHONET | 86 | #ifndef GSM_USED_IRDAPHONET |
79 | # undef GSM_ENABLE_IRDAPHONET | 87 | # undef GSM_ENABLE_IRDAPHONET |
80 | #endif | 88 | #endif |
81 | #ifndef GSM_USED_BLUEFBUS2 | 89 | #ifndef GSM_USED_BLUEFBUS2 |
82 | # undef GSM_ENABLE_BLUEFBUS2 | 90 | # undef GSM_ENABLE_BLUEFBUS2 |
83 | #endif | 91 | #endif |
84 | #ifndef GSM_USED_BLUEPHONET | 92 | #ifndef GSM_USED_BLUEPHONET |
85 | # undef GSM_ENABLE_BLUEPHONET | 93 | # undef GSM_ENABLE_BLUEPHONET |
86 | #endif | 94 | #endif |
87 | #ifndef GSM_USED_BLUEAT | 95 | #ifndef GSM_USED_BLUEAT |
88 | # undef GSM_ENABLE_BLUEAT | 96 | # undef GSM_ENABLE_BLUEAT |
89 | #endif | 97 | #endif |
90 | #ifndef GSM_USED_IRDAAT | 98 | #ifndef GSM_USED_IRDAAT |
91 | # undef GSM_ENABLE_IRDAAT | 99 | # undef GSM_ENABLE_IRDAAT |
92 | #endif | 100 | #endif |
93 | #ifndef GSM_USED_MROUTERBLUE | 101 | #ifndef GSM_USED_MROUTERBLUE |
94 | # undef GSM_ENABLE_MROUTERBLUE | 102 | # undef GSM_ENABLE_MROUTERBLUE |
95 | #endif | 103 | #endif |
96 | 104 | ||
97 | #if defined(GSM_ENABLE_NOKIA3320) || defined(GSM_ENABLE_NOKIA6110) || defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210) | 105 | #if defined(GSM_ENABLE_NOKIA3320) || defined(GSM_ENABLE_NOKIA650) || defined(GSM_ENABLE_NOKIA6110) || defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210) |
98 | # define GSM_ENABLE_NOKIA_DCT3 | 106 | # define GSM_ENABLE_NOKIA_DCT3 |
99 | #endif | 107 | #endif |
100 | #if defined(GSM_ENABLE_NOKIA3650) || defined(GSM_ENABLE_NOKIA6510) | 108 | #if defined(GSM_ENABLE_NOKIA3650) || defined(GSM_ENABLE_NOKIA6510) |
101 | # define GSM_ENABLE_NOKIA_DCT4 | 109 | # define GSM_ENABLE_NOKIA_DCT4 |
102 | #endif | 110 | #endif |
103 | 111 | ||
104 | #include "protocol/protocol.h" | 112 | #include "protocol/protocol.h" |
105 | #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) | 113 | #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) |
106 | # include "protocol/nokia/fbus2.h" | 114 | # include "protocol/nokia/fbus2.h" |
107 | #endif | 115 | #endif |
108 | #ifdef GSM_ENABLE_MBUS2 | 116 | #ifdef GSM_ENABLE_MBUS2 |
109 | # include "protocol/nokia/mbus2.h" | 117 | # include "protocol/nokia/mbus2.h" |
110 | #endif | 118 | #endif |
111 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) | 119 | #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) |
112 | # include "protocol/nokia/phonet.h" | 120 | # include "protocol/nokia/phonet.h" |
113 | #endif | 121 | #endif |
114 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) | 122 | #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) |
115 | # include "protocol/at/at.h" | 123 | # include "protocol/at/at.h" |
116 | #endif | 124 | #endif |
117 | #ifdef GSM_ENABLE_ALCABUS | 125 | #ifdef GSM_ENABLE_ALCABUS |
118 | # include "protocol/alcatel/alcabus.h" | 126 | # include "protocol/alcatel/alcabus.h" |
119 | #endif | 127 | #endif |
120 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) | 128 | #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) |
121 | # include "protocol/obex/obex.h" | 129 | # include "protocol/obex/obex.h" |
@@ -178,51 +186,48 @@ | |||
178 | # include "device/serial/ser_unx.h" | 186 | # include "device/serial/ser_unx.h" |
179 | # include "device/serial/ser_djg.h" | 187 | # include "device/serial/ser_djg.h" |
180 | #endif | 188 | #endif |
181 | #ifdef GSM_ENABLE_IRDADEVICE | 189 | #ifdef GSM_ENABLE_IRDADEVICE |
182 | # include "device/irda/irda.h" | 190 | # include "device/irda/irda.h" |
183 | #endif | 191 | #endif |
184 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE | 192 | #ifdef GSM_ENABLE_BLUETOOTHDEVICE |
185 | # include "device/bluetoth/bluetoth.h" | 193 | # include "device/bluetoth/bluetoth.h" |
186 | #endif | 194 | #endif |
187 | 195 | ||
188 | #include "service/gsmpbk.h" | 196 | #include "service/gsmpbk.h" |
189 | #include "service/gsmnet.h" | 197 | #include "service/gsmnet.h" |
190 | #include "service/gsmring.h" | 198 | #include "service/gsmring.h" |
191 | #include "service/gsmcal.h" | 199 | #include "service/gsmcal.h" |
192 | #include "service/gsmdata.h" | 200 | #include "service/gsmdata.h" |
193 | #include "service/gsmlogo.h" | 201 | #include "service/gsmlogo.h" |
194 | #include "service/gsmmisc.h" | 202 | #include "service/gsmmisc.h" |
195 | #include "service/gsmprof.h" | 203 | #include "service/gsmprof.h" |
196 | #include "service/gsmcall.h" | 204 | #include "service/gsmcall.h" |
197 | #include "service/sms/gsmsms.h" | 205 | #include "service/sms/gsmsms.h" |
198 | #include "service/sms/gsmems.h" | 206 | #include "service/sms/gsmems.h" |
199 | #include "service/sms/gsmmulti.h" | 207 | #include "service/sms/gsmmulti.h" |
200 | #include "service/backup/gsmback.h" | 208 | #include "service/backup/gsmback.h" |
201 | 209 | ||
202 | typedef struct _GSM_StateMachine GSM_StateMachine; | ||
203 | typedef struct _GSM_User GSM_User; | ||
204 | typedef struct _OnePhoneModel OnePhoneModel; | ||
205 | 210 | ||
206 | /* ------------------------- Device layer ---------------------------------- */ | 211 | /* ------------------------- Device layer ---------------------------------- */ |
207 | 212 | ||
208 | /** | 213 | /** |
209 | * Device functions, each device has to provide these. | 214 | * Device functions, each device has to provide these. |
210 | */ | 215 | */ |
211 | typedef struct { | 216 | typedef struct { |
212 | /** | 217 | /** |
213 | * Opens device. | 218 | * Opens device. |
214 | */ | 219 | */ |
215 | GSM_Error (*OpenDevice) (GSM_StateMachine *s); | 220 | GSM_Error (*OpenDevice) (GSM_StateMachine *s); |
216 | /** | 221 | /** |
217 | * Closes device. | 222 | * Closes device. |
218 | */ | 223 | */ |
219 | GSM_Error (*CloseDevice) (GSM_StateMachine *s); | 224 | GSM_Error (*CloseDevice) (GSM_StateMachine *s); |
220 | /** | 225 | /** |
221 | * Sets parity for device. | 226 | * Sets parity for device. |
222 | */ | 227 | */ |
223 | GSM_Error (*DeviceSetParity) (GSM_StateMachine *s, bool parity); | 228 | GSM_Error (*DeviceSetParity) (GSM_StateMachine *s, bool parity); |
224 | /** | 229 | /** |
225 | * Sets dtr (data to read) and rts (ready to send) flags. | 230 | * Sets dtr (data to read) and rts (ready to send) flags. |
226 | */ | 231 | */ |
227 | GSM_Error (*DeviceSetDtrRts) (GSM_StateMachine *s, bool dtr, bool rts); | 232 | GSM_Error (*DeviceSetDtrRts) (GSM_StateMachine *s, bool dtr, bool rts); |
228 | /** | 233 | /** |
@@ -350,48 +355,50 @@ typedef struct { | |||
350 | GSM_Protocol_Functions *Functions; | 355 | GSM_Protocol_Functions *Functions; |
351 | } GSM_Protocol; | 356 | } GSM_Protocol; |
352 | 357 | ||
353 | /* -------------------------- Phone layer ---------------------------------- */ | 358 | /* -------------------------- Phone layer ---------------------------------- */ |
354 | 359 | ||
355 | /** | 360 | /** |
356 | * Phone requests identificators, these are used for internally identifying | 361 | * Phone requests identificators, these are used for internally identifying |
357 | * which operation is being performed. | 362 | * which operation is being performed. |
358 | */ | 363 | */ |
359 | typedef enum { | 364 | typedef enum { |
360 | ID_None=1, | 365 | ID_None=1, |
361 | ID_GetModel, | 366 | ID_GetModel, |
362 | ID_GetFirmware, | 367 | ID_GetFirmware, |
363 | ID_EnableSecurity, | 368 | ID_EnableSecurity, |
364 | ID_GetIMEI, | 369 | ID_GetIMEI, |
365 | ID_GetDateTime, | 370 | ID_GetDateTime, |
366 | ID_GetAlarm, | 371 | ID_GetAlarm, |
367 | ID_GetMemory, | 372 | ID_GetMemory, |
368 | ID_GetMemoryStatus, | 373 | ID_GetMemoryStatus, |
369 | ID_GetSMSC, | 374 | ID_GetSMSC, |
370 | ID_GetSMSMessage, | 375 | ID_GetSMSMessage, |
371 | ID_EnableEcho, | 376 | ID_EnableEcho, |
372 | ID_EnableErrorInfo, | 377 | ID_EnableErrorInfo, |
373 | ID_SetOBEX, | 378 | ID_SetOBEX, |
379 | ID_SetUSSD, | ||
380 | ID_GetNote, | ||
374 | ID_GetSignalQuality, | 381 | ID_GetSignalQuality, |
375 | ID_GetBatteryCharge, | 382 | ID_GetBatteryCharge, |
376 | ID_GetSMSFolders, | 383 | ID_GetSMSFolders, |
377 | ID_GetSMSFolderStatus, | 384 | ID_GetSMSFolderStatus, |
378 | ID_GetSMSStatus, | 385 | ID_GetSMSStatus, |
379 | ID_AddSMSFolder, | 386 | ID_AddSMSFolder, |
380 | ID_GetNetworkInfo, | 387 | ID_GetNetworkInfo, |
381 | ID_GetRingtone, | 388 | ID_GetRingtone, |
382 | ID_DialVoice, | 389 | ID_DialVoice, |
383 | ID_GetCalendarNotesInfo, | 390 | ID_GetCalendarNotesInfo, |
384 | ID_GetCalendarNote, | 391 | ID_GetCalendarNote, |
385 | ID_GetSecurityCode, | 392 | ID_GetSecurityCode, |
386 | ID_GetWAPBookmark, | 393 | ID_GetWAPBookmark, |
387 | ID_GetBitmap, | 394 | ID_GetBitmap, |
388 | ID_SaveSMSMessage, | 395 | ID_SaveSMSMessage, |
389 | ID_CancelCall, | 396 | ID_CancelCall, |
390 | ID_SetDateTime, | 397 | ID_SetDateTime, |
391 | ID_SetAlarm, | 398 | ID_SetAlarm, |
392 | ID_DisableConnectFunc, | 399 | ID_DisableConnectFunc, |
393 | ID_EnableConnectFunc, | 400 | ID_EnableConnectFunc, |
394 | ID_AnswerCall, | 401 | ID_AnswerCall, |
395 | ID_SetBitmap, | 402 | ID_SetBitmap, |
396 | ID_SetRingtone, | 403 | ID_SetRingtone, |
397 | ID_DeleteSMSMessage, | 404 | ID_DeleteSMSMessage, |
@@ -417,48 +424,49 @@ typedef enum { | |||
417 | ID_EnableGPRSPoint, | 424 | ID_EnableGPRSPoint, |
418 | ID_DeleteWAPBookmark, | 425 | ID_DeleteWAPBookmark, |
419 | ID_Netmonitor, | 426 | ID_Netmonitor, |
420 | ID_HoldCall, | 427 | ID_HoldCall, |
421 | ID_UnholdCall, | 428 | ID_UnholdCall, |
422 | ID_ConferenceCall, | 429 | ID_ConferenceCall, |
423 | ID_SplitCall, | 430 | ID_SplitCall, |
424 | ID_TransferCall, | 431 | ID_TransferCall, |
425 | ID_SwitchCall, | 432 | ID_SwitchCall, |
426 | ID_GetManufactureMonth, | 433 | ID_GetManufactureMonth, |
427 | ID_GetProductCode, | 434 | ID_GetProductCode, |
428 | ID_GetOriginalIMEI, | 435 | ID_GetOriginalIMEI, |
429 | ID_GetHardware, | 436 | ID_GetHardware, |
430 | ID_GetPPM, | 437 | ID_GetPPM, |
431 | ID_GetSMSMode, | 438 | ID_GetSMSMode, |
432 | ID_GetSMSMemories, | 439 | ID_GetSMSMemories, |
433 | ID_GetManufacturer, | 440 | ID_GetManufacturer, |
434 | ID_SetMemoryType, | 441 | ID_SetMemoryType, |
435 | ID_SetMemoryCharset, | 442 | ID_SetMemoryCharset, |
436 | ID_GetMMSSettings, | 443 | ID_GetMMSSettings, |
437 | ID_SetSMSParameters, | 444 | ID_SetSMSParameters, |
438 | ID_GetFMStation, | 445 | ID_GetFMStation, |
439 | ID_SetFMStation, | 446 | ID_SetFMStation, |
440 | ID_GetLanguage, | 447 | ID_GetLanguage, |
448 | ID_SetFastSMSSending, | ||
441 | ID_Reset, | 449 | ID_Reset, |
442 | ID_GetToDo, | 450 | ID_GetToDo, |
443 | ID_PressKey, | 451 | ID_PressKey, |
444 | ID_DeleteAllToDo, | 452 | ID_DeleteAllToDo, |
445 | ID_SetLight, | 453 | ID_SetLight, |
446 | ID_Divert, | 454 | ID_Divert, |
447 | ID_SetToDo, | 455 | ID_SetToDo, |
448 | ID_PlayTone, | 456 | ID_PlayTone, |
449 | ID_GetChatSettings, | 457 | ID_GetChatSettings, |
450 | ID_GetSyncMLSettings, | 458 | ID_GetSyncMLSettings, |
451 | ID_GetSyncMLName, | 459 | ID_GetSyncMLName, |
452 | ID_GetSecurityStatus, | 460 | ID_GetSecurityStatus, |
453 | ID_EnterSecurityCode, | 461 | ID_EnterSecurityCode, |
454 | ID_GetProfile, | 462 | ID_GetProfile, |
455 | ID_GetRingtonesInfo, | 463 | ID_GetRingtonesInfo, |
456 | ID_MakeAuthentication, | 464 | ID_MakeAuthentication, |
457 | ID_GetSpeedDial, | 465 | ID_GetSpeedDial, |
458 | ID_ResetPhoneSettings, | 466 | ID_ResetPhoneSettings, |
459 | ID_SendDTMF, | 467 | ID_SendDTMF, |
460 | ID_GetDisplayStatus, | 468 | ID_GetDisplayStatus, |
461 | ID_SetAutoNetworkLogin, | 469 | ID_SetAutoNetworkLogin, |
462 | ID_SetConnectSet, | 470 | ID_SetConnectSet, |
463 | ID_SetMMSSettings, | 471 | ID_SetMMSSettings, |
464 | ID_GetSIMIMSI, | 472 | ID_GetSIMIMSI, |
@@ -648,48 +656,49 @@ typedef struct { | |||
648 | /** | 656 | /** |
649 | * Pointer to structure used internally by phone drivers. | 657 | * Pointer to structure used internally by phone drivers. |
650 | */ | 658 | */ |
651 | GSM_WAPBookmark *WAPBookmark; | 659 | GSM_WAPBookmark *WAPBookmark; |
652 | /** | 660 | /** |
653 | * Pointer to structure used internally by phone drivers. | 661 | * Pointer to structure used internally by phone drivers. |
654 | */ | 662 | */ |
655 | GSM_MultiWAPSettings*WAPSettings; | 663 | GSM_MultiWAPSettings*WAPSettings; |
656 | /** | 664 | /** |
657 | * Pointer to structure used internally by phone drivers. | 665 | * Pointer to structure used internally by phone drivers. |
658 | */ | 666 | */ |
659 | GSM_Bitmap *Bitmap; | 667 | GSM_Bitmap *Bitmap; |
660 | /** | 668 | /** |
661 | * Used internally by phone drivers. | 669 | * Used internally by phone drivers. |
662 | */ | 670 | */ |
663 | unsigned char *Netmonitor; | 671 | unsigned char *Netmonitor; |
664 | /** | 672 | /** |
665 | * Pointer to structure used internally by phone drivers. | 673 | * Pointer to structure used internally by phone drivers. |
666 | */ | 674 | */ |
667 | GSM_MultiCallDivert*Divert; | 675 | GSM_MultiCallDivert*Divert; |
668 | /** | 676 | /** |
669 | * Pointer to structure used internally by phone drivers. | 677 | * Pointer to structure used internally by phone drivers. |
670 | */ | 678 | */ |
671 | GSM_ToDoEntry *ToDo; | 679 | GSM_ToDoEntry *ToDo; |
680 | GSM_NoteEntry *Note; | ||
672 | /** | 681 | /** |
673 | * Used internally by phone drivers. | 682 | * Used internally by phone drivers. |
674 | */ | 683 | */ |
675 | bool PressKey; | 684 | bool PressKey; |
676 | /** | 685 | /** |
677 | * Pointer to structure used internally by phone drivers. | 686 | * Pointer to structure used internally by phone drivers. |
678 | */ | 687 | */ |
679 | GSM_SecurityCodeType*SecurityStatus; | 688 | GSM_SecurityCodeType*SecurityStatus; |
680 | /** | 689 | /** |
681 | * Pointer to structure used internally by phone drivers. | 690 | * Pointer to structure used internally by phone drivers. |
682 | */ | 691 | */ |
683 | GSM_Profile *Profile; | 692 | GSM_Profile *Profile; |
684 | /** | 693 | /** |
685 | * Pointer to structure used internally by phone drivers. | 694 | * Pointer to structure used internally by phone drivers. |
686 | */ | 695 | */ |
687 | GSM_AllRingtonesInfo*RingtonesInfo; | 696 | GSM_AllRingtonesInfo*RingtonesInfo; |
688 | /** | 697 | /** |
689 | * Pointer to structure used internally by phone drivers. | 698 | * Pointer to structure used internally by phone drivers. |
690 | */ | 699 | */ |
691 | GSM_DisplayFeatures*DisplayFeatures; | 700 | GSM_DisplayFeatures*DisplayFeatures; |
692 | /** | 701 | /** |
693 | * Pointer to structure used internally by phone drivers. | 702 | * Pointer to structure used internally by phone drivers. |
694 | */ | 703 | */ |
695 | GSM_FMStation *FMStation; | 704 | GSM_FMStation *FMStation; |
@@ -749,107 +758,110 @@ typedef struct { | |||
749 | * Last message sent by Gammu. | 758 | * Last message sent by Gammu. |
750 | */ | 759 | */ |
751 | GSM_Protocol_Message*SentMsg; | 760 | GSM_Protocol_Message*SentMsg; |
752 | /** | 761 | /** |
753 | * What operation is being performed now, see @ref GSM_Phone_RequestID | 762 | * What operation is being performed now, see @ref GSM_Phone_RequestID |
754 | * for possible values. | 763 | * for possible values. |
755 | */ | 764 | */ |
756 | GSM_Phone_RequestIDRequestID; | 765 | GSM_Phone_RequestIDRequestID; |
757 | /** | 766 | /** |
758 | * Error returned by function in phone module. | 767 | * Error returned by function in phone module. |
759 | */ | 768 | */ |
760 | GSM_Error DispatchError; | 769 | GSM_Error DispatchError; |
761 | 770 | ||
762 | /** | 771 | /** |
763 | * Structure with private phone modules data. | 772 | * Structure with private phone modules data. |
764 | */ | 773 | */ |
765 | struct { | 774 | struct { |
766 | int fake; | 775 | int fake; |
767 | #ifdef GSM_ENABLE_NOKIA3320 | 776 | #ifdef GSM_ENABLE_NOKIA3320 |
768 | GSM_Phone_N3320Data N3320; | 777 | GSM_Phone_N3320Data N3320; |
769 | #endif | 778 | #endif |
770 | #ifdef GSM_ENABLE_NOKIA3650 | 779 | #ifdef GSM_ENABLE_NOKIA3650 |
771 | GSM_Phone_N3650Data N3650; | 780 | GSM_Phone_N3650Data N3650; |
772 | #endif | 781 | #endif |
782 | #ifdef GSM_ENABLE_NOKIA650 | ||
783 | GSM_Phone_N650Data N650; | ||
784 | #endif | ||
773 | #ifdef GSM_ENABLE_NOKIA6110 | 785 | #ifdef GSM_ENABLE_NOKIA6110 |
774 | GSM_Phone_N6110Data N6110; | 786 | GSM_Phone_N6110Data N6110; |
775 | #endif | 787 | #endif |
776 | #ifdef GSM_ENABLE_NOKIA6510 | 788 | #ifdef GSM_ENABLE_NOKIA6510 |
777 | GSM_Phone_N6510Data N6510; | 789 | GSM_Phone_N6510Data N6510; |
778 | #endif | 790 | #endif |
779 | #ifdef GSM_ENABLE_NOKIA7110 | 791 | #ifdef GSM_ENABLE_NOKIA7110 |
780 | GSM_Phone_N7110Data N7110; | 792 | GSM_Phone_N7110Data N7110; |
781 | #endif | 793 | #endif |
782 | #ifdef GSM_ENABLE_ATGEN | 794 | #ifdef GSM_ENABLE_ATGEN |
783 | GSM_Phone_ATGENData ATGEN; | 795 | GSM_Phone_ATGENData ATGEN; |
784 | #endif | 796 | #endif |
785 | #ifdef GSM_ENABLE_ALCATEL | 797 | #ifdef GSM_ENABLE_ALCATEL |
786 | GSM_Phone_ALCATELData ALCATEL; | 798 | GSM_Phone_ALCATELData ALCATEL; |
787 | #endif | 799 | #endif |
788 | #ifdef GSM_ENABLE_OBEXGEN | 800 | #ifdef GSM_ENABLE_OBEXGEN |
789 | GSM_Phone_OBEXGENData OBEXGEN; | 801 | GSM_Phone_OBEXGENData OBEXGEN; |
790 | #endif | 802 | #endif |
791 | #ifdef GSM_ENABLE_MROUTERGEN | 803 | #ifdef GSM_ENABLE_MROUTERGEN |
792 | GSM_Phone_MROUTERGENData MROUTERGEN; | 804 | GSM_Phone_MROUTERGENData MROUTERGEN; |
793 | #endif | 805 | #endif |
794 | } Priv; | 806 | } Priv; |
795 | } GSM_Phone_Data; | 807 | } GSM_Phone_Data; |
796 | 808 | ||
797 | /** | 809 | /** |
798 | * Structure for defining reply functions. | 810 | * Structure for defining reply functions. |
799 | * | 811 | * |
800 | * Function is called when requestID matches current operation or is | 812 | * Function is called when requestID matches current operation or is |
801 | * ID_IncomingFrame and msgtype matches start message and (if msgtype is just | 813 | * ID_IncomingFrame and msgtype matches start message and (if msgtype is just |
802 | * one character) subtypechar is zero or subtypechar-th character of message | 814 | * one character) subtypechar is zero or subtypechar-th character of message |
803 | * matches subtype. | 815 | * matches subtype. |
804 | * | 816 | * |
805 | * Should be used in array with last element containing ID_None as requestID. | 817 | * Should be used in array with last element containing ID_None as requestID. |
806 | */ | 818 | */ |
807 | typedef struct { | 819 | struct _GSM_Reply_Function { |
808 | /** | 820 | /** |
809 | * Pointer to function that should be executed. | 821 | * Pointer to function that should be executed. |
810 | */ | 822 | */ |
811 | GSM_Error (*Function)(GSM_Protocol_Message msg, GSM_StateMachine *s); | 823 | GSM_Error (*Function)(GSM_Protocol_Message msg, GSM_StateMachine *s); |
812 | /** | 824 | /** |
813 | * Message type, if it is longer than 1 character, it disables subtype | 825 | * Message type, if it is longer than 1 character, it disables subtype |
814 | * checking. | 826 | * checking. |
815 | */ | 827 | */ |
816 | unsigned char *msgtype; | 828 | unsigned char *msgtype; |
817 | /** | 829 | /** |
818 | * Which character of message should be checked as subtype. Zero to | 830 | * Which character of message should be checked as subtype. Zero to |
819 | * disable subtype checking. | 831 | * disable subtype checking. |
820 | */ | 832 | */ |
821 | int subtypechar; | 833 | int subtypechar; |
822 | /** | 834 | /** |
823 | * Subtype to be checked. | 835 | * Subtype to be checked. |
824 | */ | 836 | */ |
825 | unsigned char subtype; | 837 | unsigned char subtype; |
826 | /** | 838 | /** |
827 | * Phone request when this can be called, use ID_IncomingFrame when | 839 | * Phone request when this can be called, use ID_IncomingFrame when |
828 | * you want to use this in any state. | 840 | * you want to use this in any state. |
829 | */ | 841 | */ |
830 | GSM_Phone_RequestIDrequestID; | 842 | GSM_Phone_RequestIDrequestID; |
831 | } GSM_Reply_Function; | 843 | }; |
832 | 844 | ||
833 | /** | 845 | /** |
834 | * Structure defining phone functions. | 846 | * Structure defining phone functions. |
835 | */ | 847 | */ |
836 | typedef struct { | 848 | typedef struct { |
837 | /** | 849 | /** |
838 | * Names of supported models separated by |. Must contain at least one | 850 | * Names of supported models separated by |. Must contain at least one |
839 | * name. | 851 | * name. |
840 | */ | 852 | */ |
841 | char *models; | 853 | char *models; |
842 | /** | 854 | /** |
843 | * Array of reply functions for the phone, see | 855 | * Array of reply functions for the phone, see |
844 | * @ref GSM_Reply_Function for details about it. | 856 | * @ref GSM_Reply_Function for details about it. |
845 | */ | 857 | */ |
846 | GSM_Reply_Function *ReplyFunctions; | 858 | GSM_Reply_Function *ReplyFunctions; |
847 | /** | 859 | /** |
848 | * Initializes phone. | 860 | * Initializes phone. |
849 | */ | 861 | */ |
850 | GSM_Error (*Initialise) (GSM_StateMachine *s); | 862 | GSM_Error (*Initialise) (GSM_StateMachine *s); |
851 | /** | 863 | /** |
852 | * Terminates phone communication. | 864 | * Terminates phone communication. |
853 | */ | 865 | */ |
854 | GSM_Error (*Terminate) (GSM_StateMachine *s); | 866 | GSM_Error (*Terminate) (GSM_StateMachine *s); |
855 | /** | 867 | /** |
@@ -1038,48 +1050,49 @@ typedef struct { | |||
1038 | * Reads next (or first if start set) SMS message. This might be | 1050 | * Reads next (or first if start set) SMS message. This might be |
1039 | * faster for some phones than using @ref GetSMS for each message. | 1051 | * faster for some phones than using @ref GetSMS for each message. |
1040 | */ | 1052 | */ |
1041 | GSM_Error (*GetNextSMS) (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, bool start); | 1053 | GSM_Error (*GetNextSMS) (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, bool start); |
1042 | /** | 1054 | /** |
1043 | * Sets SMS. | 1055 | * Sets SMS. |
1044 | */ | 1056 | */ |
1045 | GSM_Error (*SetSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); | 1057 | GSM_Error (*SetSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); |
1046 | /** | 1058 | /** |
1047 | * Adds SMS to specified folder. | 1059 | * Adds SMS to specified folder. |
1048 | */ | 1060 | */ |
1049 | GSM_Error (*AddSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); | 1061 | GSM_Error (*AddSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); |
1050 | /** | 1062 | /** |
1051 | * Deletes SMS. | 1063 | * Deletes SMS. |
1052 | */ | 1064 | */ |
1053 | GSM_Error (*DeleteSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); | 1065 | GSM_Error (*DeleteSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); |
1054 | /** | 1066 | /** |
1055 | * Sends SMS. | 1067 | * Sends SMS. |
1056 | */ | 1068 | */ |
1057 | GSM_Error (*SendSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); | 1069 | GSM_Error (*SendSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms); |
1058 | /** | 1070 | /** |
1059 | * Sends SMS already saved in phone. | 1071 | * Sends SMS already saved in phone. |
1060 | */ | 1072 | */ |
1061 | GSM_Error (*SendSavedSMS)(GSM_StateMachine *s, int Folder, int Location); | 1073 | GSM_Error (*SendSavedSMS)(GSM_StateMachine *s, int Folder, int Location); |
1074 | GSM_Error (*SetFastSMSSending) (GSM_StateMachine *s, bool enable); | ||
1062 | /** | 1075 | /** |
1063 | * Enable/disable notification on incoming SMS. | 1076 | * Enable/disable notification on incoming SMS. |
1064 | */ | 1077 | */ |
1065 | GSM_Error (*SetIncomingSMS) (GSM_StateMachine *s, bool enable); | 1078 | GSM_Error (*SetIncomingSMS) (GSM_StateMachine *s, bool enable); |
1066 | /** | 1079 | /** |
1067 | * Gets network information from phone. | 1080 | * Gets network information from phone. |
1068 | */ | 1081 | */ |
1069 | GSM_Error (*SetIncomingCB) (GSM_StateMachine *s, bool enable); | 1082 | GSM_Error (*SetIncomingCB) (GSM_StateMachine *s, bool enable); |
1070 | /** | 1083 | /** |
1071 | * Returns SMS folders information. | 1084 | * Returns SMS folders information. |
1072 | */ | 1085 | */ |
1073 | GSM_Error (*GetSMSFolders) (GSM_StateMachine *s, GSM_SMSFolders *folders); | 1086 | GSM_Error (*GetSMSFolders) (GSM_StateMachine *s, GSM_SMSFolders *folders); |
1074 | /** | 1087 | /** |
1075 | * Creates SMS folder. | 1088 | * Creates SMS folder. |
1076 | */ | 1089 | */ |
1077 | GSM_Error (*AddSMSFolder) (GSM_StateMachine *s, unsigned char *name); | 1090 | GSM_Error (*AddSMSFolder) (GSM_StateMachine *s, unsigned char *name); |
1078 | /** | 1091 | /** |
1079 | * Deletes SMS folder. | 1092 | * Deletes SMS folder. |
1080 | */ | 1093 | */ |
1081 | GSM_Error (*DeleteSMSFolder) (GSM_StateMachine *s, int ID); | 1094 | GSM_Error (*DeleteSMSFolder) (GSM_StateMachine *s, int ID); |
1082 | /** | 1095 | /** |
1083 | * Dials number and starts voice call. | 1096 | * Dials number and starts voice call. |
1084 | */ | 1097 | */ |
1085 | GSM_Error (*DialVoice) (GSM_StateMachine *s, char *Number, GSM_CallShowNumber ShowNumber); | 1098 | GSM_Error (*DialVoice) (GSM_StateMachine *s, char *Number, GSM_CallShowNumber ShowNumber); |
@@ -1258,49 +1271,49 @@ typedef struct { | |||
1258 | GSM_Error (*SetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); | 1271 | GSM_Error (*SetCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); |
1259 | /** | 1272 | /** |
1260 | * Adds calendar entry. | 1273 | * Adds calendar entry. |
1261 | */ | 1274 | */ |
1262 | GSM_Error (*AddCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); | 1275 | GSM_Error (*AddCalendar)(GSM_StateMachine *s, GSM_CalendarEntry *Note); |
1263 | /** | 1276 | /** |
1264 | * Deletes calendar entry. | 1277 | * Deletes calendar entry. |
1265 | */ | 1278 | */ |
1266 | GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); | 1279 | GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); |
1267 | /** | 1280 | /** |
1268 | * Deletes all calendar entries. | 1281 | * Deletes all calendar entries. |
1269 | */ | 1282 | */ |
1270 | GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s); | 1283 | GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s); |
1271 | /** | 1284 | /** |
1272 | * Reads calendar settings. | 1285 | * Reads calendar settings. |
1273 | */ | 1286 | */ |
1274 | GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); | 1287 | GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); |
1275 | /** | 1288 | /** |
1276 | * Sets calendar settings. | 1289 | * Sets calendar settings. |
1277 | */ | 1290 | */ |
1278 | GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); | 1291 | GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); |
1279 | /** | 1292 | /** |
1280 | * Gets note. | 1293 | * Gets note. |
1281 | */ | 1294 | */ |
1282 | GSM_Error (*GetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note, bool refresh); | 1295 | GSM_Error (*GetNextNote)(GSM_StateMachine *s, GSM_NoteEntry *Note, bool refresh); |
1283 | /** | 1296 | /** |
1284 | * Reads profile. | 1297 | * Reads profile. |
1285 | */ | 1298 | */ |
1286 | GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); | 1299 | GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); |
1287 | /** | 1300 | /** |
1288 | * Updates profile. | 1301 | * Updates profile. |
1289 | */ | 1302 | */ |
1290 | GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); | 1303 | GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); |
1291 | /** | 1304 | /** |
1292 | * Reads FM station. | 1305 | * Reads FM station. |
1293 | */ | 1306 | */ |
1294 | GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); | 1307 | GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); |
1295 | /** | 1308 | /** |
1296 | * Sets FM station. | 1309 | * Sets FM station. |
1297 | */ | 1310 | */ |
1298 | GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); | 1311 | GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); |
1299 | /** | 1312 | /** |
1300 | * Clears defined FM stations. | 1313 | * Clears defined FM stations. |
1301 | */ | 1314 | */ |
1302 | GSM_Error (*ClearFMStations) (GSM_StateMachine *s); | 1315 | GSM_Error (*ClearFMStations) (GSM_StateMachine *s); |
1303 | /** | 1316 | /** |
1304 | * Gets next filename from filesystem. | 1317 | * Gets next filename from filesystem. |
1305 | */ | 1318 | */ |
1306 | GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start); | 1319 | GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start); |
@@ -1323,48 +1336,51 @@ typedef struct { | |||
1323 | /** | 1336 | /** |
1324 | * Adds folder to filesystem. | 1337 | * Adds folder to filesystem. |
1325 | */ | 1338 | */ |
1326 | GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File); | 1339 | GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File); |
1327 | /** | 1340 | /** |
1328 | * Gets GPRS access point. | 1341 | * Gets GPRS access point. |
1329 | */ | 1342 | */ |
1330 | GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); | 1343 | GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); |
1331 | /** | 1344 | /** |
1332 | * Sets GPRS access point. | 1345 | * Sets GPRS access point. |
1333 | */ | 1346 | */ |
1334 | GSM_Error (*SetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); | 1347 | GSM_Error (*SetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point); |
1335 | } GSM_Phone_Functions; | 1348 | } GSM_Phone_Functions; |
1336 | 1349 | ||
1337 | extern GSM_Phone_Functions NAUTOPhone; | 1350 | extern GSM_Phone_Functions NAUTOPhone; |
1338 | #ifdef GSM_ENABLE_NOKIA3320 | 1351 | #ifdef GSM_ENABLE_NOKIA3320 |
1339 | extern GSM_Phone_Functions N3320Phone; | 1352 | extern GSM_Phone_Functions N3320Phone; |
1340 | #endif | 1353 | #endif |
1341 | #ifdef GSM_ENABLE_NOKIA3650 | 1354 | #ifdef GSM_ENABLE_NOKIA3650 |
1342 | extern GSM_Phone_Functions N3650Phone; | 1355 | extern GSM_Phone_Functions N3650Phone; |
1343 | #endif | 1356 | #endif |
1344 | #ifdef GSM_ENABLE_NOKIA6110 | 1357 | #ifdef GSM_ENABLE_NOKIA6110 |
1345 | extern GSM_Phone_Functions N6110Phone; | 1358 | extern GSM_Phone_Functions N6110Phone; |
1346 | #endif | 1359 | #endif |
1360 | #ifdef GSM_ENABLE_NOKIA650 | ||
1361 | extern GSM_Phone_Functions N650Phone; | ||
1362 | #endif | ||
1347 | #ifdef GSM_ENABLE_NOKIA6510 | 1363 | #ifdef GSM_ENABLE_NOKIA6510 |
1348 | extern GSM_Phone_Functions N6510Phone; | 1364 | extern GSM_Phone_Functions N6510Phone; |
1349 | #endif | 1365 | #endif |
1350 | #ifdef GSM_ENABLE_NOKIA7110 | 1366 | #ifdef GSM_ENABLE_NOKIA7110 |
1351 | extern GSM_Phone_Functions N7110Phone; | 1367 | extern GSM_Phone_Functions N7110Phone; |
1352 | #endif | 1368 | #endif |
1353 | #ifdef GSM_ENABLE_NOKIA9210 | 1369 | #ifdef GSM_ENABLE_NOKIA9210 |
1354 | extern GSM_Phone_Functions N9210Phone; | 1370 | extern GSM_Phone_Functions N9210Phone; |
1355 | #endif | 1371 | #endif |
1356 | #ifdef GSM_ENABLE_ATGEN | 1372 | #ifdef GSM_ENABLE_ATGEN |
1357 | extern GSM_Phone_Functions ATGENPhone; | 1373 | extern GSM_Phone_Functions ATGENPhone; |
1358 | #endif | 1374 | #endif |
1359 | #ifdef GSM_ENABLE_ALCATEL | 1375 | #ifdef GSM_ENABLE_ALCATEL |
1360 | extern GSM_Phone_Functions ALCATELPhone; | 1376 | extern GSM_Phone_Functions ALCATELPhone; |
1361 | #endif | 1377 | #endif |
1362 | #ifdef GSM_ENABLE_OBEXGEN | 1378 | #ifdef GSM_ENABLE_OBEXGEN |
1363 | extern GSM_Phone_Functions OBEXGENPhone; | 1379 | extern GSM_Phone_Functions OBEXGENPhone; |
1364 | #endif | 1380 | #endif |
1365 | #ifdef GSM_ENABLE_MROUTERGEN | 1381 | #ifdef GSM_ENABLE_MROUTERGEN |
1366 | extern GSM_Phone_Functions MROUTERGENPhone; | 1382 | extern GSM_Phone_Functions MROUTERGENPhone; |
1367 | #endif | 1383 | #endif |
1368 | 1384 | ||
1369 | typedef struct { | 1385 | typedef struct { |
1370 | GSM_Phone_Data Data; | 1386 | GSM_Phone_Data Data; |
@@ -1502,48 +1518,49 @@ typedef enum { | |||
1502 | /* n3320.c */ | 1518 | /* n3320.c */ |
1503 | F_DAYMONTH, /* Day and month reversed in pbk, when compare to GSM models*/ | 1519 | F_DAYMONTH, /* Day and month reversed in pbk, when compare to GSM models*/ |
1504 | 1520 | ||
1505 | /* n6510.c */ | 1521 | /* n6510.c */ |
1506 | F_PBK35, /* Phonebook in 3510 style with ringtones ID */ | 1522 | F_PBK35, /* Phonebook in 3510 style with ringtones ID */ |
1507 | F_PBKIMG, /* Phonebook in 7250 style with picture ID */ | 1523 | F_PBKIMG, /* Phonebook in 7250 style with picture ID */ |
1508 | F_PBKTONEGAL,/* Phonebook with selecting ringtones from gallery */ | 1524 | F_PBKTONEGAL,/* Phonebook with selecting ringtones from gallery */ |
1509 | F_PBKSMSLIST, /* Phonebook with SMS list */ | 1525 | F_PBKSMSLIST, /* Phonebook with SMS list */ |
1510 | F_PBKUSER, /* Phonebook with user ID */ | 1526 | F_PBKUSER, /* Phonebook with user ID */ |
1511 | F_RADIO, /* Phone with FM radio */ | 1527 | F_RADIO, /* Phone with FM radio */ |
1512 | F_TODO63, /* ToDo in 6310 style - 0x55 msg type */ | 1528 | F_TODO63, /* ToDo in 6310 style - 0x55 msg type */ |
1513 | F_TODO66, /* ToDo in 6610 style - like calendar, with date and other*/ | 1529 | F_TODO66, /* ToDo in 6610 style - like calendar, with date and other*/ |
1514 | F_NOMIDI, /* No ringtones in MIDI */ | 1530 | F_NOMIDI, /* No ringtones in MIDI */ |
1515 | F_BLUETOOTH, /* Bluetooth support */ | 1531 | F_BLUETOOTH, /* Bluetooth support */ |
1516 | F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem*/ | 1532 | F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem*/ |
1517 | F_NOMMS, /* No MMS sets in phone */ | 1533 | F_NOMMS, /* No MMS sets in phone */ |
1518 | F_NOGPRSPOINT, /* GPRS point are not useable */ | 1534 | F_NOGPRSPOINT, /* GPRS point are not useable */ |
1519 | F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */ | 1535 | F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */ |
1520 | F_CAL65, /* Calendar,6510 style - CBMM, method 3 */ | 1536 | F_CAL65, /* Calendar,6510 style - CBMM, method 3 */ |
1521 | F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */ | 1537 | F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */ |
1522 | 1538 | ||
1523 | /* n6510.c && n7110.c */ | 1539 | /* n6510.c && n7110.c */ |
1524 | F_VOICETAGS, /* Voice tags available */ | 1540 | F_VOICETAGS, /* Voice tags available */ |
1525 | F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */ | 1541 | F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */ |
1542 | F_NOTES, | ||
1526 | 1543 | ||
1527 | /* AT modules */ | 1544 | /* AT modules */ |
1528 | F_SMSONLYSENT, /* Phone supports only sent/unsent messages */ | 1545 | F_SMSONLYSENT, /* Phone supports only sent/unsent messages */ |
1529 | F_BROKENCPBS, /* CPBS on some memories can hang phone */ | 1546 | F_BROKENCPBS, /* CPBS on some memories can hang phone */ |
1530 | F_M20SMS, /* Siemens M20 like SMS handling */ | 1547 | F_M20SMS, /* Siemens M20 like SMS handling */ |
1531 | F_SLOWWRITE, /* Use slower writing which some phone need */ | 1548 | F_SLOWWRITE, /* Use slower writing which some phone need */ |
1532 | F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */ | 1549 | F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */ |
1533 | F_ALCATEL /* Phone supports Alcatel protocol */ | 1550 | F_ALCATEL /* Phone supports Alcatel protocol */ |
1534 | } Feature; | 1551 | } Feature; |
1535 | 1552 | ||
1536 | /* For models table */ | 1553 | /* For models table */ |
1537 | struct _OnePhoneModel { | 1554 | struct _OnePhoneModel { |
1538 | char *model; | 1555 | char *model; |
1539 | char *number; | 1556 | char *number; |
1540 | char *irdamodel; | 1557 | char *irdamodel; |
1541 | Feature features[12]; | 1558 | Feature features[12]; |
1542 | }; | 1559 | }; |
1543 | 1560 | ||
1544 | bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature); | 1561 | bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature); |
1545 | OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel); | 1562 | OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel); |
1546 | 1563 | ||
1547 | #ifdef __GNUC__ | 1564 | #ifdef __GNUC__ |
1548 | __attribute__((format(printf, 2, 3))) | 1565 | __attribute__((format(printf, 2, 3))) |
1549 | #endif | 1566 | #endif |
diff --git a/gammu/emb/common/misc/coding/coding.c b/gammu/emb/common/misc/coding/coding.c index 62543ac..b30b645 100644 --- a/gammu/emb/common/misc/coding/coding.c +++ b/gammu/emb/common/misc/coding/coding.c | |||
@@ -1,42 +1,195 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek, Michal Cihar and others */ | 1 | /* (c) 2002-2004 by Marcin Wiacek, Michal Cihar and others */ |
2 | /* based on some work from MyGnokii and Gnokii */ | 2 | /* based on some work from MyGnokii (www.mwiacek.com) */ |
3 | /* based on some work from Gnokii (www.gnokii.org) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
3 | 7 | ||
4 | #include <stdio.h> | 8 | #include <stdio.h> |
5 | #include <stdlib.h> | 9 | #include <stdlib.h> |
6 | #include <string.h> | 10 | #include <string.h> |
7 | #include <ctype.h> | 11 | #include <ctype.h> |
8 | #include <locale.h> | 12 | #include <locale.h> |
9 | #ifndef __OpenBSD__ | 13 | #ifndef __OpenBSD__ |
10 | # include <wctype.h> | 14 | # include <wctype.h> |
11 | #endif | 15 | #endif |
12 | #ifdef WIN32 | 16 | #ifdef WIN32 |
13 | # include "windows.h" | 17 | # include "windows.h" |
14 | #endif | 18 | #endif |
15 | 19 | ||
16 | #include "../misc.h" | 20 | #include "../misc.h" |
17 | #include "coding.h" | 21 | #include "coding.h" |
18 | 22 | ||
23 | /* function changes #10 #13 chars to \n \r */ | ||
24 | char *EncodeUnicodeSpecialChars(unsigned char *buffer) | ||
25 | { | ||
26 | int Pos=0, Pos2=0; | ||
27 | static unsigned charBuf[20000]; | ||
28 | |||
29 | while (buffer[Pos*2]!=0x00 || buffer[Pos*2+1]!=0x00) { | ||
30 | if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == 10) { | ||
31 | Buf[Pos2*2] = 0x00; | ||
32 | Buf[Pos2*2+1] = '\\'; | ||
33 | Pos2++; | ||
34 | Buf[Pos2*2] = 0x00; | ||
35 | Buf[Pos2*2+1] = 'n'; | ||
36 | Pos2++; | ||
37 | } else if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == 13) { | ||
38 | Buf[Pos2*2] = 0x00; | ||
39 | Buf[Pos2*2+1] = '\\'; | ||
40 | Pos2++; | ||
41 | Buf[Pos2*2] = 0x00; | ||
42 | Buf[Pos2*2+1] = 'r'; | ||
43 | Pos2++; | ||
44 | } else if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == '\\') { | ||
45 | Buf[Pos2*2] = 0x00; | ||
46 | Buf[Pos2*2+1] = '\\'; | ||
47 | Pos2++; | ||
48 | Buf[Pos2*2] = 0x00; | ||
49 | Buf[Pos2*2+1] = '\\'; | ||
50 | Pos2++; | ||
51 | } else { | ||
52 | Buf[Pos2*2] = buffer[Pos*2]; | ||
53 | Buf[Pos2*2+1] = buffer[Pos*2+1]; | ||
54 | Pos2++; | ||
55 | } | ||
56 | Pos++; | ||
57 | } | ||
58 | Buf[Pos2*2] = 0; | ||
59 | Buf[Pos2*2+1] = 0; | ||
60 | return Buf; | ||
61 | } | ||
62 | |||
63 | /* function changes #10 #13 chars to \n \r */ | ||
64 | char *EncodeSpecialChars(unsigned char *buffer) | ||
65 | { | ||
66 | int Pos=0, Pos2=0; | ||
67 | static unsigned charBuf[10000]; | ||
68 | |||
69 | while (buffer[Pos]!=0x00) { | ||
70 | switch (buffer[Pos]) { | ||
71 | case 10: | ||
72 | Buf[Pos2++] = '\\'; | ||
73 | Buf[Pos2++] = 'n'; | ||
74 | break; | ||
75 | case 13: | ||
76 | Buf[Pos2++] = '\\'; | ||
77 | Buf[Pos2++] = 'r'; | ||
78 | break; | ||
79 | case '\\': | ||
80 | Buf[Pos2++] = '\\'; | ||
81 | Buf[Pos2++] = '\\'; | ||
82 | break; | ||
83 | default: | ||
84 | Buf[Pos2++] = buffer[Pos]; | ||
85 | } | ||
86 | Pos++; | ||
87 | } | ||
88 | Buf[Pos2] = 0; | ||
89 | return Buf; | ||
90 | } | ||
91 | |||
92 | char *DecodeUnicodeSpecialChars(unsigned char *buffer) | ||
93 | { | ||
94 | int Pos=0, Pos2=0, level=0; | ||
95 | static unsigned charBuf[10000]; | ||
96 | |||
97 | while (buffer[Pos*2]!=0x00 || buffer[Pos*2+1]!=0x00) { | ||
98 | Buf[Pos2*2] = buffer[Pos*2]; | ||
99 | Buf[Pos2*2+1] = buffer[Pos*2+1]; | ||
100 | switch (level) { | ||
101 | case 0: | ||
102 | if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == '\\') { | ||
103 | level = 1; | ||
104 | } else { | ||
105 | Pos2++; | ||
106 | } | ||
107 | break; | ||
108 | case 1: | ||
109 | if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == 'n') { | ||
110 | Buf[Pos2*2] = 0; | ||
111 | Buf[Pos2*2+1] = 10; | ||
112 | } | ||
113 | if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == 'r') { | ||
114 | Buf[Pos2*2] = 0; | ||
115 | Buf[Pos2*2+1] = 13; | ||
116 | } | ||
117 | if (buffer[Pos*2] == 0x00 && buffer[Pos*2+1] == '\\') { | ||
118 | Buf[Pos2*2] = 0; | ||
119 | Buf[Pos2*2+1] = '\\'; | ||
120 | } | ||
121 | Pos2++; | ||
122 | level = 0; | ||
123 | } | ||
124 | Pos++; | ||
125 | } | ||
126 | Buf[Pos2*2] = 0; | ||
127 | Buf[Pos2*2+1] = 0; | ||
128 | return Buf; | ||
129 | } | ||
130 | |||
131 | char *DecodeSpecialChars(unsigned char *buffer) | ||
132 | { | ||
133 | int Pos=0, Pos2=0, level=0; | ||
134 | static unsigned charBuf[10000]; | ||
135 | |||
136 | while (buffer[Pos]!=0x00) { | ||
137 | Buf[Pos2] = buffer[Pos]; | ||
138 | switch (level) { | ||
139 | case 0: | ||
140 | if (buffer[Pos] == '\\') { | ||
141 | level = 1; | ||
142 | } else { | ||
143 | Pos2++; | ||
144 | } | ||
145 | break; | ||
146 | case 1: | ||
147 | if (buffer[Pos] == 'n') Buf[Pos2] = 10; | ||
148 | if (buffer[Pos] == 'r') Buf[Pos2] = 13; | ||
149 | if (buffer[Pos] == '\\') Buf[Pos2] = '\\'; | ||
150 | Pos2++; | ||
151 | level = 0; | ||
152 | } | ||
153 | Pos++; | ||
154 | } | ||
155 | Buf[Pos2] = 0; | ||
156 | return Buf; | ||
157 | } | ||
158 | |||
159 | char *mystrcasestr(unsigned const char *a, unsigned const char *b) | ||
160 | { | ||
161 | unsigned char A[2000], B[200]; | ||
162 | int i; | ||
163 | |||
164 | memset(A,0,sizeof(A)); | ||
165 | memset(B,0,sizeof(B)); | ||
166 | for (i=0;i<(int)strlen(a);i++) A[i] = tolower(a[i]); | ||
167 | for (i=0;i<(int)strlen(b);i++) B[i] = tolower(b[i]); | ||
168 | |||
169 | return strstr(A,B); | ||
170 | } | ||
171 | |||
19 | unsigned int UnicodeLength(const unsigned char *str) | 172 | unsigned int UnicodeLength(const unsigned char *str) |
20 | { | 173 | { |
21 | unsigned int len = 0; | 174 | unsigned int len = 0; |
22 | 175 | ||
23 | if (str == NULL) return 0; | 176 | if (str == NULL) return 0; |
24 | 177 | ||
25 | while(str[len*2] != 0 || str[len*2+1] != 0) len++; | 178 | while(str[len*2] != 0 || str[len*2+1] != 0) len++; |
26 | 179 | ||
27 | return len; | 180 | return len; |
28 | } | 181 | } |
29 | 182 | ||
30 | /* Convert Unicode char saved in src to dest */ | 183 | /* Convert Unicode char saved in src to dest */ |
31 | unsigned int EncodeWithUnicodeAlphabet(const unsigned char *src, wchar_t *dest) | 184 | unsigned int EncodeWithUnicodeAlphabet(const unsigned char *src, wchar_t *dest) |
32 | { | 185 | { |
33 | char retval; | 186 | char retval; |
34 | 187 | ||
35 | switch (retval = mbtowc(dest, src, MB_CUR_MAX)) { | 188 | switch (retval = mbtowc(dest, src, MB_CUR_MAX)) { |
36 | case -1 : | 189 | case -1 : |
37 | case 0 : return 1; | 190 | case 0 : return 1; |
38 | default : return retval; | 191 | default : return retval; |
39 | } | 192 | } |
40 | } | 193 | } |
41 | 194 | ||
42 | /* Convert Unicode char saved in src to dest */ | 195 | /* Convert Unicode char saved in src to dest */ |
@@ -565,117 +718,117 @@ int GSM_PackSevenBitsToEight(int offset, unsigned char *input, unsigned char *ou | |||
565 | if (Bits == -1) Bits = 7; else OUTPUT++; | 718 | if (Bits == -1) Bits = 7; else OUTPUT++; |
566 | 719 | ||
567 | INPUT++; | 720 | INPUT++; |
568 | } | 721 | } |
569 | return (OUTPUT - output); | 722 | return (OUTPUT - output); |
570 | #else | 723 | #else |
571 | return 0; | 724 | return 0; |
572 | #endif | 725 | #endif |
573 | } | 726 | } |
574 | 727 | ||
575 | void GSM_UnpackSemiOctetNumber(unsigned char *retval, unsigned char *Number, bool semioctet) | 728 | void GSM_UnpackSemiOctetNumber(unsigned char *retval, unsigned char *Number, bool semioctet) |
576 | { | 729 | { |
577 | unsigned char Buffer[50]= ""; | 730 | unsigned char Buffer[50]= ""; |
578 | int length = Number[0]; | 731 | int length = Number[0]; |
579 | 732 | ||
580 | if (semioctet) { | 733 | if (semioctet) { |
581 | /* Convert number of semioctets to number of chars */ | 734 | /* Convert number of semioctets to number of chars */ |
582 | if (length % 2) length++; | 735 | if (length % 2) length++; |
583 | length=length / 2 + 1; | 736 | length=length / 2 + 1; |
584 | } | 737 | } |
585 | 738 | ||
586 | /*without leading byte with format of number*/ | 739 | /*without leading byte with format of number*/ |
587 | length--; | 740 | length--; |
588 | 741 | ||
589 | switch (Number[1]) { | 742 | switch ((Number[1] & 112)) { |
590 | case NUMBER_ALPHANUMERIC: | 743 | case (NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN & 112): |
591 | if (length > 6) length++; | 744 | if (length > 6) length++; |
592 | dbgprintf("Alphanumeric number, length %i\n",length); | 745 | dbgprintf("Alphanumeric number, length %i\n",length); |
593 | GSM_UnpackEightBitsToSeven(0, length, length, Number+2, Buffer); | 746 | GSM_UnpackEightBitsToSeven(0, length, length, Number+2, Buffer); |
594 | Buffer[length]=0; | 747 | Buffer[length]=0; |
595 | break; | 748 | break; |
596 | case NUMBER_INTERNATIONAL: | 749 | case (NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN & 112): |
597 | dbgprintf("International number\n"); | 750 | dbgprintf("International number\n"); |
598 | Buffer[0]='+'; | 751 | Buffer[0]='+'; |
599 | DecodeBCD(Buffer+1,Number+2, length); | 752 | DecodeBCD(Buffer+1,Number+2, length); |
600 | break; | 753 | break; |
601 | default: | 754 | default: |
602 | dbgprintf("Default number %02x\n",Number[1]); | 755 | dbgprintf("Default number %02x\n",Number[1]); |
603 | DecodeBCD (Buffer, Number+2, length); | 756 | DecodeBCD (Buffer, Number+2, length); |
604 | break; | 757 | break; |
605 | } | 758 | } |
606 | 759 | ||
607 | EncodeUnicode(retval,Buffer,strlen(Buffer)); | 760 | EncodeUnicode(retval,Buffer,strlen(Buffer)); |
608 | } | 761 | } |
609 | 762 | ||
610 | /** | 763 | /** |
611 | * Packing some phone numbers (SMSC, SMS destination and others) | 764 | * Packing some phone numbers (SMSC, SMS destination and others) |
612 | * | 765 | * |
613 | * See GSM 03.40 9.1.1: | 766 | * See GSM 03.40 9.1.1: |
614 | * 1 byte - length of number given in semioctets or bytes (when given in | 767 | * 1 byte - length of number given in semioctets or bytes (when given in |
615 | * bytes, includes one byte for byte with number format). | 768 | * bytes, includes one byte for byte with number format). |
616 | * Returned by function (set semioctet to true, if want result | 769 | * Returned by function (set semioctet to true, if want result |
617 | * in semioctets). | 770 | * in semioctets). |
618 | * 1 byte - format of number (see GSM_NumberType in coding.h). Returned | 771 | * 1 byte - format of number (see GSM_NumberType in coding.h). Returned |
619 | * in unsigned char *Output. | 772 | * in unsigned char *Output. |
620 | * n bytes - 2n or 2n-1 semioctets with number. Returned in unsigned char | 773 | * n bytes - 2n or 2n-1 semioctets with number. Returned in unsigned char |
621 | * *Output. | 774 | * *Output. |
622 | * | 775 | * |
623 | * 1 semioctet = 4 bits = half of byte | 776 | * 1 semioctet = 4 bits = half of byte |
624 | */ | 777 | */ |
625 | int GSM_PackSemiOctetNumber(unsigned char *Number, unsigned char *Output, bool semioctet) | 778 | int GSM_PackSemiOctetNumber(unsigned char *Number, unsigned char *Output, bool semioctet) |
626 | { | 779 | { |
627 | unsigned charformat, buffer[50]; | 780 | unsigned charformat, buffer[50]; |
628 | int length, i; | 781 | int length, i; |
629 | 782 | ||
630 | length=UnicodeLength(Number); | 783 | length=UnicodeLength(Number); |
631 | memcpy(buffer,DecodeUnicodeString(Number),length+1); | 784 | memcpy(buffer,DecodeUnicodeString(Number),length+1); |
632 | 785 | ||
633 | /* Checking for format number */ | 786 | /* Checking for format number */ |
634 | format = NUMBER_UNKNOWN; | 787 | format = NUMBER_UNKNOWN_NUMBERING_PLAN_ISDN; |
635 | for (i=0;i<length;i++) { | 788 | for (i=0;i<length;i++) { |
636 | /* first byte is '+'. Number can be international */ | 789 | /* first byte is '+'. Number can be international */ |
637 | if (i==0 && buffer[i]=='+') { | 790 | if (i==0 && buffer[i]=='+') { |
638 | format=NUMBER_INTERNATIONAL; | 791 | format=NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN; |
639 | } else { | 792 | } else { |
640 | /*char is not number. It must be alphanumeric*/ | 793 | /*char is not number. It must be alphanumeric*/ |
641 | if (!isdigit(buffer[i])) format=NUMBER_ALPHANUMERIC; | 794 | if (!isdigit(buffer[i])) format=NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN; |
642 | } | 795 | } |
643 | } | 796 | } |
644 | 797 | ||
645 | /** | 798 | /** |
646 | * First byte is used for saving type of number. See GSM 03.40 | 799 | * First byte is used for saving type of number. See GSM 03.40 |
647 | * section 9.1.2.5 | 800 | * section 9.1.2.5 |
648 | */ | 801 | */ |
649 | Output[0]=format; | 802 | Output[0]=format; |
650 | 803 | ||
651 | /* After number type we will have number. GSM 03.40 section 9.1.2 */ | 804 | /* After number type we will have number. GSM 03.40 section 9.1.2 */ |
652 | switch (format) { | 805 | switch (format) { |
653 | case NUMBER_ALPHANUMERIC: | 806 | case NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN: |
654 | length=GSM_PackSevenBitsToEight(0, buffer, Output+1, strlen(buffer))*2; | 807 | length=GSM_PackSevenBitsToEight(0, buffer, Output+1, strlen(buffer))*2; |
655 | if (strlen(buffer)==7) length--; | 808 | if (strlen(buffer)==7) length--; |
656 | break; | 809 | break; |
657 | case NUMBER_INTERNATIONAL: | 810 | case NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN: |
658 | length--; | 811 | length--; |
659 | EncodeBCD (Output+1, buffer+1, length, true); | 812 | EncodeBCD (Output+1, buffer+1, length, true); |
660 | break; | 813 | break; |
661 | default: | 814 | default: |
662 | EncodeBCD (Output+1, buffer, length, true); | 815 | EncodeBCD (Output+1, buffer, length, true); |
663 | break; | 816 | break; |
664 | } | 817 | } |
665 | 818 | ||
666 | if (semioctet) return length; | 819 | if (semioctet) return length; |
667 | 820 | ||
668 | /* Convert number of semioctets to number of chars */ | 821 | /* Convert number of semioctets to number of chars */ |
669 | if (length % 2) length++; | 822 | if (length % 2) length++; |
670 | return length / 2 + 1; | 823 | return length / 2 + 1; |
671 | } | 824 | } |
672 | 825 | ||
673 | void CopyUnicodeString(unsigned char *Dest, unsigned char *Source) | 826 | void CopyUnicodeString(unsigned char *Dest, unsigned char *Source) |
674 | { | 827 | { |
675 | int j = 0; | 828 | int j = 0; |
676 | 829 | ||
677 | while (Source[j]!=0x00 || Source[j+1]!=0x00) { | 830 | while (Source[j]!=0x00 || Source[j+1]!=0x00) { |
678 | Dest[j] = Source[j]; | 831 | Dest[j] = Source[j]; |
679 | Dest[j+1]= Source[j+1]; | 832 | Dest[j+1]= Source[j+1]; |
680 | j=j+2; | 833 | j=j+2; |
681 | } | 834 | } |
@@ -898,69 +1051,69 @@ void DecodeUnicodeSpecialNOKIAChars(unsigned char *dest, const unsigned char *sr | |||
898 | dest[current++] = '~'; | 1051 | dest[current++] = '~'; |
899 | dest[current++] = 0x00; | 1052 | dest[current++] = 0x00; |
900 | dest[current++] = '~'; | 1053 | dest[current++] = '~'; |
901 | break; | 1054 | break; |
902 | default: | 1055 | default: |
903 | dest[current++] = src[i*2]; | 1056 | dest[current++] = src[i*2]; |
904 | dest[current++] = src[i*2+1]; | 1057 | dest[current++] = src[i*2+1]; |
905 | } | 1058 | } |
906 | break; | 1059 | break; |
907 | default: | 1060 | default: |
908 | dest[current++] = src[i*2]; | 1061 | dest[current++] = src[i*2]; |
909 | dest[current++] = src[i*2+1]; | 1062 | dest[current++] = src[i*2+1]; |
910 | } | 1063 | } |
911 | } | 1064 | } |
912 | dest[current++] = 0x00; | 1065 | dest[current++] = 0x00; |
913 | dest[current++] = 0x00; | 1066 | dest[current++] = 0x00; |
914 | } | 1067 | } |
915 | 1068 | ||
916 | bool mystrncasecmp(unsigned const char *a, unsigned const char *b, int num) | 1069 | bool mystrncasecmp(unsigned const char *a, unsigned const char *b, int num) |
917 | { | 1070 | { |
918 | int i; | 1071 | int i; |
919 | 1072 | ||
920 | if (a == NULL || b == NULL) return false; | 1073 | if (a == NULL || b == NULL) return false; |
921 | 1074 | ||
922 | num--; | 1075 | if (num == 0) num = -1; |
923 | 1076 | ||
924 | for (i = 0; i != num; i++) { | 1077 | for (i = 0; i != num; i++) { |
925 | if (a[i] == 0x00 && b[i] == 0x00) return true; | 1078 | if (a[i] == 0x00 && b[i] == 0x00) return true; |
926 | if (a[i] == 0x00 || b[i] == 0x00) return false; | 1079 | if (a[i] == 0x00 || b[i] == 0x00) return false; |
927 | if (tolower(a[i]) != tolower(b[i])) return false; | 1080 | if (tolower(a[i]) != tolower(b[i])) return false; |
928 | } | 1081 | } |
929 | return true; | 1082 | return true; |
930 | } | 1083 | } |
931 | 1084 | ||
932 | /* Compares two Unicode strings without regarding to case. | 1085 | /* Compares two Unicode strings without regarding to case. |
933 | * Return true, when they're equal | 1086 | * Return true, when they're equal |
934 | */ | 1087 | */ |
935 | bool mywstrncasecmp(unsigned const char *a, unsigned const char *b, int num) | 1088 | bool mywstrncasecmp(unsigned const char *a, unsigned const char *b, int num) |
936 | { | 1089 | { |
937 | int i; | 1090 | int i; |
938 | wchar_t wc,wc2; | 1091 | wchar_t wc,wc2; |
939 | 1092 | ||
940 | if (a == NULL || b == NULL) return false; | 1093 | if (a == NULL || b == NULL) return false; |
941 | 1094 | ||
942 | num--; | 1095 | if (num == 0) num = -1; |
943 | 1096 | ||
944 | for (i = 0; i != num; i++) { | 1097 | for (i = 0; i != num; i++) { |
945 | if ((a[i*2] == 0x00 && a[i*2+1] == 0x00) && (b[i*2] == 0x00 && b[i*2+1] == 0x00)) return true; | 1098 | if ((a[i*2] == 0x00 && a[i*2+1] == 0x00) && (b[i*2] == 0x00 && b[i*2+1] == 0x00)) return true; |
946 | if ((a[i*2] == 0x00 && a[i*2+1] == 0x00) || (b[i*2] == 0x00 && b[i*2+1] == 0x00)) return false; | 1099 | if ((a[i*2] == 0x00 && a[i*2+1] == 0x00) || (b[i*2] == 0x00 && b[i*2+1] == 0x00)) return false; |
947 | wc = a[i*2+1] | (a[i*2] << 8); | 1100 | wc = a[i*2+1] | (a[i*2] << 8); |
948 | wc2 = b[i*2+1] | (b[i*2] << 8); | 1101 | wc2 = b[i*2+1] | (b[i*2] << 8); |
949 | if (mytowlower(wc) != mytowlower(wc2)) return false; | 1102 | if (mytowlower(wc) != mytowlower(wc2)) return false; |
950 | } | 1103 | } |
951 | return true; | 1104 | return true; |
952 | } | 1105 | } |
953 | 1106 | ||
954 | /* wcscmp in Mandrake 9.0 is wrong */ | 1107 | /* wcscmp in Mandrake 9.0 is wrong */ |
955 | bool mywstrncmp(unsigned const char *a, unsigned const char *b, int num) | 1108 | bool mywstrncmp(unsigned const char *a, unsigned const char *b, int num) |
956 | { | 1109 | { |
957 | int i=0; | 1110 | int i=0; |
958 | 1111 | ||
959 | while (1) { | 1112 | while (1) { |
960 | if (a[i*2] != b[i*2] || a[i*2+1] != b[i*2+1]) return false; | 1113 | if (a[i*2] != b[i*2] || a[i*2+1] != b[i*2+1]) return false; |
961 | if (a[i*2] == 0x00 && a[i*2+1] == 0x00) return true; | 1114 | if (a[i*2] == 0x00 && a[i*2+1] == 0x00) return true; |
962 | i++; | 1115 | i++; |
963 | if (num == i) return true; | 1116 | if (num == i) return true; |
964 | } | 1117 | } |
965 | } | 1118 | } |
966 | 1119 | ||
@@ -994,49 +1147,49 @@ int mytowlower(wchar_t c) | |||
994 | unsigned char dest[10]; | 1147 | unsigned char dest[10]; |
995 | 1148 | ||
996 | DecodeWithUnicodeAlphabet(c, dest); | 1149 | DecodeWithUnicodeAlphabet(c, dest); |
997 | return tolower(dest[0]); | 1150 | return tolower(dest[0]); |
998 | #else | 1151 | #else |
999 | return towlower(c); | 1152 | return towlower(c); |
1000 | #endif | 1153 | #endif |
1001 | } | 1154 | } |
1002 | 1155 | ||
1003 | /* | 1156 | /* |
1004 | * Following code is based on wcsstr from the GNU C Library, original | 1157 | * Following code is based on wcsstr from the GNU C Library, original |
1005 | * comment follows: | 1158 | * comment follows: |
1006 | */ | 1159 | */ |
1007 | /* | 1160 | /* |
1008 | * The original strstr() file contains the following comment: | 1161 | * The original strstr() file contains the following comment: |
1009 | * | 1162 | * |
1010 | * My personal strstr() implementation that beats most other algorithms. | 1163 | * My personal strstr() implementation that beats most other algorithms. |
1011 | * Until someone tells me otherwise, I assume that this is the | 1164 | * Until someone tells me otherwise, I assume that this is the |
1012 | * fastest implementation of strstr() in C. | 1165 | * fastest implementation of strstr() in C. |
1013 | * I deliberately chose not to comment it. You should have at least | 1166 | * I deliberately chose not to comment it. You should have at least |
1014 | * as much fun trying to understand it, as I had to write it :-). | 1167 | * as much fun trying to understand it, as I had to write it :-). |
1015 | * | 1168 | * |
1016 | * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ | 1169 | * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */ |
1017 | 1170 | ||
1018 | unsigned char *mystrstr (const unsigned char *haystack, const unsigned char *needle) | 1171 | unsigned char *mywstrstr (const unsigned char *haystack, const unsigned char *needle) |
1019 | { | 1172 | { |
1020 | /* One crazy define to convert unicode used in Gammu to standard wchar_t */ | 1173 | /* One crazy define to convert unicode used in Gammu to standard wchar_t */ |
1021 | #define tolowerwchar(x) (mytowlower((wchar_t)( (((&(x))[0] & 0xff) << 8) | (((&(x))[1] & 0xff)) ))) | 1174 | #define tolowerwchar(x) (mytowlower((wchar_t)( (((&(x))[0] & 0xff) << 8) | (((&(x))[1] & 0xff)) ))) |
1022 | register wchar_t b, c; | 1175 | register wchar_t b, c; |
1023 | 1176 | ||
1024 | if ((b = tolowerwchar(*needle)) != L'\0') { | 1177 | if ((b = tolowerwchar(*needle)) != L'\0') { |
1025 | haystack -= 2; /* possible ANSI violation */ | 1178 | haystack -= 2; /* possible ANSI violation */ |
1026 | do { | 1179 | do { |
1027 | haystack += 2; | 1180 | haystack += 2; |
1028 | if ((c = tolowerwchar(*haystack)) == L'\0') | 1181 | if ((c = tolowerwchar(*haystack)) == L'\0') |
1029 | goto ret0; | 1182 | goto ret0; |
1030 | } while (c != b); | 1183 | } while (c != b); |
1031 | 1184 | ||
1032 | needle += 2; | 1185 | needle += 2; |
1033 | if ((c = tolowerwchar(*needle)) == L'\0') | 1186 | if ((c = tolowerwchar(*needle)) == L'\0') |
1034 | goto foundneedle; | 1187 | goto foundneedle; |
1035 | needle += 2; | 1188 | needle += 2; |
1036 | goto jin; | 1189 | goto jin; |
1037 | 1190 | ||
1038 | for (;;) { | 1191 | for (;;) { |
1039 | register wchar_t a; | 1192 | register wchar_t a; |
1040 | register const unsigned char *rhaystack, *rneedle; | 1193 | register const unsigned char *rhaystack, *rneedle; |
1041 | 1194 | ||
1042 | do { | 1195 | do { |
diff --git a/gammu/emb/common/misc/coding/coding.h b/gammu/emb/common/misc/coding/coding.h index d0c334d..4cf0038 100644 --- a/gammu/emb/common/misc/coding/coding.h +++ b/gammu/emb/common/misc/coding/coding.h | |||
@@ -1,61 +1,68 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek and others */ | 1 | /* (c) 2002-2004 by Marcin Wiacek and others */ |
2 | 2 | ||
3 | #ifndef __coding_h | 3 | #ifndef __coding_h |
4 | #define __coding_h | 4 | #define __coding_h |
5 | 5 | ||
6 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
6 | #include <stdlib.h> | 10 | #include <stdlib.h> |
7 | 11 | ||
8 | #include "../misc.h" | 12 | #include "../misc.h" |
9 | 13 | ||
10 | #ifdef __OpenBSD__ | 14 | #ifdef __OpenBSD__ |
11 | typedef int wint_t; | 15 | typedef int wint_t; |
12 | #endif | 16 | #endif |
13 | 17 | ||
14 | /* ---------------------------- Unicode ------------------------------------ */ | 18 | /* ---------------------------- Unicode ------------------------------------ */ |
15 | bool mywstrncasecmp (unsigned const char *a, unsigned const char *b, int num); | 19 | bool mywstrncasecmp (unsigned const char *a, unsigned const char *b, int num); |
16 | unsigned char *mystrstr (unsigned const char *haystack, unsigned const char *needle); | 20 | unsigned char *mywstrstr (unsigned const char *haystack, unsigned const char *needle); |
17 | bool mywstrncmp (unsigned const char *a, unsigned const char *b, int num); | 21 | bool mywstrncmp (unsigned const char *a, unsigned const char *b, int num); |
18 | bool myiswspace (unsigned const char *src); | 22 | bool myiswspace (unsigned const char *src); |
19 | int mytowlower (wchar_t c); | 23 | int mytowlower (wchar_t c); |
20 | 24 | ||
21 | unsigned int EncodeWithUnicodeAlphabet(const unsigned char *value, wchar_t *dest); | 25 | unsigned int EncodeWithUnicodeAlphabet(const unsigned char *value, wchar_t *dest); |
22 | unsigned int DecodeWithUnicodeAlphabet(wchar_t value, unsigned char *dest); | 26 | unsigned int DecodeWithUnicodeAlphabet(wchar_t value, unsigned char *dest); |
23 | 27 | ||
24 | unsigned int UnicodeLength (const unsigned char *str); | 28 | unsigned int UnicodeLength (const unsigned char *str); |
25 | unsigned char *DecodeUnicodeString (const unsigned char *src); | 29 | unsigned char *DecodeUnicodeString (const unsigned char *src); |
26 | unsigned char *DecodeUnicodeConsole (const unsigned char *src); | 30 | unsigned char *DecodeUnicodeConsole (const unsigned char *src); |
27 | void DecodeUnicode (const unsigned char *src, unsigned char *dest); | 31 | void DecodeUnicode (const unsigned char *src, unsigned char *dest); |
28 | void EncodeUnicode (unsigned char *dest, const unsigned char *src, int len); | 32 | void EncodeUnicode (unsigned char *dest, const unsigned char *src, int len); |
29 | 33 | ||
30 | void CopyUnicodeString (unsigned char *Dest, unsigned char *Source); | 34 | void CopyUnicodeString (unsigned char *Dest, unsigned char *Source); |
31 | void ReverseUnicodeString (unsigned char *String); | 35 | void ReverseUnicodeString (unsigned char *String); |
32 | 36 | ||
33 | void ReadUnicodeFile (unsigned char *Dest, unsigned char *Source); | 37 | void ReadUnicodeFile (unsigned char *Dest, unsigned char *Source); |
34 | 38 | ||
35 | void DecodeUnicodeSpecialNOKIAChars(unsigned char *dest, const unsigned char *src, int len); | 39 | void DecodeUnicodeSpecialNOKIAChars(unsigned char *dest, const unsigned char *src, int len); |
36 | void EncodeUnicodeSpecialNOKIAChars(unsigned char *dest, const unsigned char *src, int len); | 40 | void EncodeUnicodeSpecialNOKIAChars(unsigned char *dest, const unsigned char *src, int len); |
37 | 41 | ||
42 | char *EncodeUnicodeSpecialChars(unsigned char *buffer); | ||
43 | char *DecodeUnicodeSpecialChars(unsigned char *buffer); | ||
44 | |||
38 | /* ------------------------------- BCD ------------------------------------- */ | 45 | /* ------------------------------- BCD ------------------------------------- */ |
39 | unsigned char EncodeWithBCDAlphabet (int value); | 46 | unsigned char EncodeWithBCDAlphabet (int value); |
40 | int DecodeWithBCDAlphabet (unsigned char value); | 47 | int DecodeWithBCDAlphabet (unsigned char value); |
41 | 48 | ||
42 | void DecodeBCD (unsigned char *dest, const unsigned char *src, int len); | 49 | void DecodeBCD (unsigned char *dest, const unsigned char *src, int len); |
43 | void EncodeBCD (unsigned char *dest, const unsigned char *src, int len, bool fill); | 50 | void EncodeBCD (unsigned char *dest, const unsigned char *src, int len, bool fill); |
44 | 51 | ||
45 | /* ------------------------------ UTF7 ------------------------------------- */ | 52 | /* ------------------------------ UTF7 ------------------------------------- */ |
46 | void DecodeUTF7 (unsigned char *dest, const unsigned char *src, int len); | 53 | void DecodeUTF7 (unsigned char *dest, const unsigned char *src, int len); |
47 | 54 | ||
48 | /* ------------------------------ UTF8 ------------------------------------- */ | 55 | /* ------------------------------ UTF8 ------------------------------------- */ |
49 | wchar_t DecodeWithUTF8Alphabet (unsigned char mychar3, unsigned char mychar4); | 56 | wchar_t DecodeWithUTF8Alphabet (unsigned char mychar3, unsigned char mychar4); |
50 | bool EncodeWithUTF8Alphabet (unsigned char mychar1, unsigned char mychar2, unsigned char *ret1, unsigned char *ret2); | 57 | bool EncodeWithUTF8Alphabet (unsigned char mychar1, unsigned char mychar2, unsigned char *ret1, unsigned char *ret2); |
51 | 58 | ||
52 | bool EncodeUTF8QuotedPrintable(unsigned char *dest, const unsigned char *src); | 59 | bool EncodeUTF8QuotedPrintable(unsigned char *dest, const unsigned char *src); |
53 | void DecodeUTF8QuotedPrintable(unsigned char *dest, const unsigned char *src, int len); | 60 | void DecodeUTF8QuotedPrintable(unsigned char *dest, const unsigned char *src, int len); |
54 | 61 | ||
55 | bool EncodeUTF8 (unsigned char *dest, const unsigned char *src); | 62 | bool EncodeUTF8 (unsigned char *dest, const unsigned char *src); |
56 | void DecodeUTF8 (unsigned char *dest, const unsigned char *src, int len); | 63 | void DecodeUTF8 (unsigned char *dest, const unsigned char *src, int len); |
57 | 64 | ||
58 | /* ------------------------------- BASE64 ---------------------------------- */ | 65 | /* ------------------------------- BASE64 ---------------------------------- */ |
59 | void EncodeBASE64 (const unsigned char *Input, unsigned char *Output, int Length); | 66 | void EncodeBASE64 (const unsigned char *Input, unsigned char *Output, int Length); |
60 | int DecodeBASE64 (const unsigned char *Input, unsigned char *Output, int Length); | 67 | int DecodeBASE64 (const unsigned char *Input, unsigned char *Output, int Length); |
61 | 68 | ||
@@ -65,69 +72,77 @@ void EncodeHexBin (unsigned char *dest, const unsigned char *src, int len); | |||
65 | 72 | ||
66 | /* ----------------------------- HexUnicode -------------------------------- */ | 73 | /* ----------------------------- HexUnicode -------------------------------- */ |
67 | void DecodeHexUnicode (unsigned char *dest, const unsigned char *src, int len); | 74 | void DecodeHexUnicode (unsigned char *dest, const unsigned char *src, int len); |
68 | void EncodeHexUnicode (unsigned char *dest, const unsigned char *src, int len); | 75 | void EncodeHexUnicode (unsigned char *dest, const unsigned char *src, int len); |
69 | 76 | ||
70 | /* ---------------------- DefaultAlphabet for SMS -------------------------- */ | 77 | /* ---------------------- DefaultAlphabet for SMS -------------------------- */ |
71 | void EncodeDefault (unsigned char *dest, const unsigned char *src, int *len, bool UseExtensions, unsigned char *ExtraAlphabet); | 78 | void EncodeDefault (unsigned char *dest, const unsigned char *src, int *len, bool UseExtensions, unsigned char *ExtraAlphabet); |
72 | void DecodeDefault (unsigned char *dest, const unsigned char *src, int len, bool UseExtensions, unsigned char *ExtraAlphabet); | 79 | void DecodeDefault (unsigned char *dest, const unsigned char *src, int len, bool UseExtensions, unsigned char *ExtraAlphabet); |
73 | void FindDefaultAlphabetLen (const unsigned char *src, int *srclen, int *smslen, int maxlen); | 80 | void FindDefaultAlphabetLen (const unsigned char *src, int *srclen, int *smslen, int maxlen); |
74 | 81 | ||
75 | int GSM_PackSevenBitsToEight(int offset, unsigned char *input, unsigned char *output, int length); | 82 | int GSM_PackSevenBitsToEight(int offset, unsigned char *input, unsigned char *output, int length); |
76 | int GSM_UnpackEightBitsToSeven(int offset, int in_length, int out_length, | 83 | int GSM_UnpackEightBitsToSeven(int offset, int in_length, int out_length, |
77 | unsigned char *input, unsigned char *output); | 84 | unsigned char *input, unsigned char *output); |
78 | 85 | ||
79 | /* ----------------- Phone numbers according to GSM specs ------------------ */ | 86 | /* ----------------- Phone numbers according to GSM specs ------------------ */ |
80 | 87 | ||
81 | /** | 88 | /** |
82 | * Enum to handle types of phones numbers like | 89 | * Enum to handle types of phones numbers like |
83 | * specified in GSM 03.40 section 9.1.2.5 | 90 | * specified in GSM 03.40 section 9.1.2.5 |
84 | */ | 91 | */ |
85 | typedef enum { | 92 | typedef enum { |
86 | /** | 93 | /** |
87 | * Unknown number type | 94 | * Unknown number type |
88 | */ | 95 | */ |
89 | NUMBER_UNKNOWN = 0x81, | 96 | NUMBER_UNKNOWN_NUMBERING_PLAN_ISDN = 0x81, |
90 | /** | 97 | /** |
91 | * International number (full number with code of country) | 98 | * International number (full number with code of country) |
92 | */ | 99 | */ |
93 | NUMBER_INTERNATIONAL= 0x91, | 100 | NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN= 0x91, |
94 | /** | 101 | /** |
95 | * Alphanumeric number (with chars too) | 102 | * Alphanumeric number (with chars too) |
96 | */ | 103 | */ |
97 | NUMBER_ALPHANUMERIC= 0xD0 | 104 | NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN= 0xD0 |
98 | 105 | ||
99 | /* specification give also other values */ | 106 | /* specification give also other values */ |
100 | } GSM_NumberType; | 107 | } GSM_NumberType; |
101 | 108 | ||
102 | void GSM_UnpackSemiOctetNumber(unsigned char *retval, unsigned char *Number, bool semioctet); | 109 | void GSM_UnpackSemiOctetNumber(unsigned char *retval, unsigned char *Number, bool semioctet); |
103 | int GSM_PackSemiOctetNumber (unsigned char *Number, unsigned char *Output, bool semioctet); | 110 | int GSM_PackSemiOctetNumber (unsigned char *Number, unsigned char *Output, bool semioctet); |
104 | 111 | ||
105 | /* ---------------------------- Bits --------------------------------------- */ | 112 | /* ---------------------------- Bits --------------------------------------- */ |
106 | 113 | ||
107 | void BufferAlign (unsigned char *Destination, int *CurrentBit); | 114 | void BufferAlign (unsigned char *Destination, int *CurrentBit); |
108 | void BufferAlignNumber(int *CurrentBit); | 115 | void BufferAlignNumber(int *CurrentBit); |
109 | 116 | ||
110 | void AddBuffer (unsigned char *Destination, int *CurrentBit, unsigned char *Source, int BitsToProcess); | 117 | void AddBuffer (unsigned char *Destination, int *CurrentBit, unsigned char *Source, int BitsToProcess); |
111 | void AddBufferByte(unsigned char *Destination, int *CurrentBit, unsigned char Source, int BitsToProcess); | 118 | void AddBufferByte(unsigned char *Destination, int *CurrentBit, unsigned char Source, int BitsToProcess); |
112 | 119 | ||
113 | void GetBuffer (unsigned char *Source, int *CurrentBit, unsigned char *Destination, int BitsToProcess); | 120 | void GetBuffer (unsigned char *Source, int *CurrentBit, unsigned char *Destination, int BitsToProcess); |
114 | void GetBufferInt (unsigned char *Source, int *CurrentBit, int *integer, int BitsToProcess); | 121 | void GetBufferInt (unsigned char *Source, int *CurrentBit, int *integer, int BitsToProcess); |
115 | void GetBufferI (unsigned char *Source, int *CurrentBit, int *result, int BitsToProcess); | 122 | void GetBufferI (unsigned char *Source, int *CurrentBit, int *result, int BitsToProcess); |
116 | 123 | ||
117 | int GetBit (unsigned char *Buffer, int BitNum); | 124 | int GetBit (unsigned char *Buffer, int BitNum); |
118 | int SetBit (unsigned char *Buffer, int BitNum); | 125 | int SetBit (unsigned char *Buffer, int BitNum); |
119 | int ClearBit (unsigned char *Buffer, int BitNum); | 126 | int ClearBit (unsigned char *Buffer, int BitNum); |
120 | 127 | ||
121 | /* ---------------------------- Other -------------------------------------- */ | 128 | /* ---------------------------- Other -------------------------------------- */ |
122 | 129 | ||
123 | void StringToDouble(char *text, double *d); | 130 | void StringToDouble(char *text, double *d); |
124 | 131 | ||
125 | bool mystrncasecmp (unsigned const char *a, unsigned const char *b, int num); | 132 | bool mystrncasecmp (unsigned const char *a, unsigned const char *b, int num); |
133 | char *mystrcasestr (unsigned const char *a, unsigned const char *b); | ||
126 | 134 | ||
127 | void MyGetLine(unsigned char *Buffer, int *Pos, unsigned char *OutBuffer, int MaxLen); | 135 | void MyGetLine(unsigned char *Buffer, int *Pos, unsigned char *OutBuffer, int MaxLen); |
128 | 136 | ||
137 | char *EncodeSpecialChars(unsigned char *buffer); | ||
138 | char *DecodeSpecialChars(unsigned char *buffer); | ||
139 | |||
140 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
141 | } | ||
142 | #endif | ||
143 | |||
129 | #endif | 144 | #endif |
130 | 145 | ||
131 | /* How should editor hadle tabs in this file? Add editor commands here. | 146 | /* How should editor hadle tabs in this file? Add editor commands here. |
132 | * vim: noexpandtab sw=8 ts=8 sts=8: | 147 | * vim: noexpandtab sw=8 ts=8 sts=8: |
133 | */ | 148 | */ |
diff --git a/gammu/emb/common/misc/coding/md5.c b/gammu/emb/common/misc/coding/md5.c index 30fe33f..abb61be 100644 --- a/gammu/emb/common/misc/coding/md5.c +++ b/gammu/emb/common/misc/coding/md5.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* Taken from ReHash (see http://www.reichlsoft.de.vu/) and released | 1 | /* Taken from ReHash (www.reichlsoft.de.vu) and released |
2 | * under GPL/LGPL with permission from ReHash author | 2 | * under GPL/LGPL with permission from ReHash author |
3 | * Dominik Reichl <dominik.reichl@t-online.de>, Germany | 3 | * Dominik Reichl <dominik.reichl@t-online.de>, Germany |
4 | */ | 4 | */ |
5 | 5 | ||
6 | /* | 6 | /* |
7 | ********************************************************************** | 7 | ********************************************************************** |
8 | ** MD5.cpp ** | 8 | ** MD5.cpp ** |
9 | ** ** | 9 | ** ** |
10 | ** - Style modified by Tony Ray, January 2001 ** | 10 | ** - Style modified by Tony Ray, January 2001 ** |
11 | ** Added support for randomizing initialization constants ** | 11 | ** Added support for randomizing initialization constants ** |
12 | ** - Style modified by Dominik Reichl, April 2003 ** | 12 | ** - Style modified by Dominik Reichl, April 2003 ** |
13 | ** Optimized code ** | 13 | ** Optimized code ** |
14 | ** ** | 14 | ** ** |
15 | ** MD5.c ** | 15 | ** MD5.c ** |
16 | ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** | 16 | ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** |
17 | ** Created: 2/17/90 RLR ** | 17 | ** Created: 2/17/90 RLR ** |
18 | ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version ** | 18 | ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version ** |
19 | ********************************************************************** | 19 | ********************************************************************** |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | ********************************************************************** | 23 | ********************************************************************** |
24 | ** MD5.h -- Header file for implementation of MD5 ** | 24 | ** MD5.h -- Header file for implementation of MD5 ** |
25 | ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** | 25 | ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** |
diff --git a/gammu/emb/common/misc/misc.c b/gammu/emb/common/misc/misc.c index c2f09e4..7227e7b 100644 --- a/gammu/emb/common/misc/misc.c +++ b/gammu/emb/common/misc/misc.c | |||
@@ -1,37 +1,40 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ | 1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ |
2 | /* Checking used compiler (c) 2002 by Michal Cihar */ | 2 | /* Checking used compiler (c) 2002 by Michal Cihar */ |
3 | 3 | ||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <ctype.h> | 5 | #include <ctype.h> |
6 | #include <time.h> | 6 | #include <time.h> |
7 | #include <stdarg.h> | 7 | #include <stdarg.h> |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <locale.h> | 9 | #include <locale.h> |
10 | #include <sys/timeb.h> | 10 | #include <sys/timeb.h> |
11 | #ifdef WIN32 | 11 | #ifdef WIN32 |
12 | # include "windows.h" | 12 | # include "windows.h" |
13 | #endif | 13 | #endif |
14 | #if defined(linux) || defined(__linux) || defined(__linux__) | ||
15 | # include <sys/utsname.h> | ||
16 | #endif | ||
14 | 17 | ||
15 | #include "../gsmstate.h" | 18 | #include "../gsmstate.h" |
16 | #include "misc.h" | 19 | #include "misc.h" |
17 | 20 | ||
18 | /* Based on article in Polish PC-Kurier 8/1998 page 104 | 21 | /* Based on article in Polish PC-Kurier 8/1998 page 104 |
19 | * Archive on http://www.pckurier.pl | 22 | * Archive on http://www.pckurier.pl |
20 | */ | 23 | */ |
21 | char *DayOfWeek (int year, int month, int day) | 24 | char *DayOfWeek (int year, int month, int day) |
22 | { | 25 | { |
23 | int p,q,r,w; | 26 | int p,q,r,w; |
24 | static char DayOfWeekChar[10]; | 27 | static char DayOfWeekChar[10]; |
25 | 28 | ||
26 | p=(14-month) / 12; | 29 | p=(14-month) / 12; |
27 | q=month+12*p-2; | 30 | q=month+12*p-2; |
28 | r=year-p; | 31 | r=year-p; |
29 | w=(day+(31*q) / 12 + r + r / 4 - r / 100 + r / 400) % 7; | 32 | w=(day+(31*q) / 12 + r + r / 4 - r / 100 + r / 400) % 7; |
30 | strcpy(DayOfWeekChar,""); | 33 | strcpy(DayOfWeekChar,""); |
31 | switch (w) { | 34 | switch (w) { |
32 | case 0: strcpy(DayOfWeekChar,"Sun"); break; | 35 | case 0: strcpy(DayOfWeekChar,"Sun"); break; |
33 | case 1: strcpy(DayOfWeekChar,"Mon"); break; | 36 | case 1: strcpy(DayOfWeekChar,"Mon"); break; |
34 | case 2: strcpy(DayOfWeekChar,"Tue"); break; | 37 | case 2: strcpy(DayOfWeekChar,"Tue"); break; |
35 | case 3: strcpy(DayOfWeekChar,"Wed"); break; | 38 | case 3: strcpy(DayOfWeekChar,"Wed"); break; |
36 | case 4: strcpy(DayOfWeekChar,"Thu"); break; | 39 | case 4: strcpy(DayOfWeekChar,"Thu"); break; |
37 | case 5: strcpy(DayOfWeekChar,"Fri"); break; | 40 | case 5: strcpy(DayOfWeekChar,"Fri"); break; |
@@ -210,52 +213,54 @@ char *OSDate (GSM_DateTime dt) | |||
210 | #else | 213 | #else |
211 | strftime(retval2, 200, "%x", &timeptr); | 214 | strftime(retval2, 200, "%x", &timeptr); |
212 | #endif | 215 | #endif |
213 | /* If don't have weekday name, include it */ | 216 | /* If don't have weekday name, include it */ |
214 | strftime(retval, 200, "%A", &timeptr); | 217 | strftime(retval, 200, "%A", &timeptr); |
215 | if (strstr(retval2,retval)==NULL) { | 218 | if (strstr(retval2,retval)==NULL) { |
216 | /* Check also for short name */ | 219 | /* Check also for short name */ |
217 | strftime(retval, 200, "%a", &timeptr); | 220 | strftime(retval, 200, "%a", &timeptr); |
218 | if (strstr(retval2,retval)==NULL) { | 221 | if (strstr(retval2,retval)==NULL) { |
219 | strcat(retval2," ("); | 222 | strcat(retval2," ("); |
220 | strcat(retval2,retval); | 223 | strcat(retval2,retval); |
221 | strcat(retval2,")"); | 224 | strcat(retval2,")"); |
222 | } | 225 | } |
223 | } | 226 | } |
224 | 227 | ||
225 | #ifdef WIN32 | 228 | #ifdef WIN32 |
226 | setlocale(LC_ALL, ".ACP"); | 229 | setlocale(LC_ALL, ".ACP"); |
227 | #endif | 230 | #endif |
228 | 231 | ||
229 | return retval2; | 232 | return retval2; |
230 | } | 233 | } |
231 | 234 | ||
232 | bool CheckDate(GSM_DateTime *date) | 235 | bool CheckDate(GSM_DateTime *date) |
233 | { | 236 | { |
234 | /* FIXME: This could also check if day is correct for selected month */ | 237 | const unsigned int days[]={31,29,31,30,31,30,31,31,30,31,30,31}; |
238 | |||
239 | /* FIXME: This could also check for leap years */ | ||
235 | return date->Year != 0 && | 240 | return date->Year != 0 && |
236 | date->Month >= 1 && date->Month <= 12 && | 241 | date->Month >= 1 && date->Month <= 12 && |
237 | date->Day >= 1 && date->Day <= 31; | 242 | date->Day >= 1 && date->Day <= days[date->Month]; |
238 | } | 243 | } |
239 | 244 | ||
240 | bool CheckTime(GSM_DateTime *date) | 245 | bool CheckTime(GSM_DateTime *date) |
241 | { | 246 | { |
242 | return date->Hour <= 23 && date->Hour >= 0 && | 247 | return date->Hour <= 23 && date->Hour >= 0 && |
243 | date->Minute <= 59 && date->Minute >= 0 && | 248 | date->Minute <= 59 && date->Minute >= 0 && |
244 | date->Second <= 59 && date->Second >= 0; | 249 | date->Second <= 59 && date->Second >= 0; |
245 | } | 250 | } |
246 | 251 | ||
247 | int GetLine(FILE *File, char *Line, int count) | 252 | int GetLine(FILE *File, char *Line, int count) |
248 | { | 253 | { |
249 | int num; | 254 | int num; |
250 | 255 | ||
251 | if (fgets(Line, count, File) != NULL) { | 256 | if (fgets(Line, count, File) != NULL) { |
252 | num = strlen(Line) - 1; | 257 | num = strlen(Line) - 1; |
253 | while(1) { | 258 | while(1) { |
254 | if (Line[num] != '\n' && Line[num] != '\r') break; | 259 | if (Line[num] != '\n' && Line[num] != '\r') break; |
255 | if (num == 0) break; | 260 | if (num == 0) break; |
256 | Line[num--] = 0; | 261 | Line[num--] = 0; |
257 | } | 262 | } |
258 | return strlen(Line); | 263 | return strlen(Line); |
259 | } | 264 | } |
260 | return -1; | 265 | return -1; |
261 | } | 266 | } |
@@ -430,48 +435,51 @@ void DumpMessage(FILE *df, Debug_Level dl, const unsigned char *message, int mes | |||
430 | if (j != len-1) buffer[j*4+2] = message[i]; | 435 | if (j != len-1) buffer[j*4+2] = message[i]; |
431 | buffer[(len-1)*4+j+3] = message[i]; | 436 | buffer[(len-1)*4+j+3] = message[i]; |
432 | } else { | 437 | } else { |
433 | buffer[(len-1)*4+j+3] = '.'; | 438 | buffer[(len-1)*4+j+3] = '.'; |
434 | } | 439 | } |
435 | if (j != len-1 && i != messagesize-1) buffer[j*4+3] = '|'; | 440 | if (j != len-1 && i != messagesize-1) buffer[j*4+3] = '|'; |
436 | if (j == len-1) { | 441 | if (j == len-1) { |
437 | smfprintf(df, dl, "%s\n", buffer); | 442 | smfprintf(df, dl, "%s\n", buffer); |
438 | memset(buffer,0x20,sizeof(buffer)); | 443 | memset(buffer,0x20,sizeof(buffer)); |
439 | buffer[len*5-1]=0; | 444 | buffer[len*5-1]=0; |
440 | j = 0; | 445 | j = 0; |
441 | } else { | 446 | } else { |
442 | j++; | 447 | j++; |
443 | } | 448 | } |
444 | } | 449 | } |
445 | if (j != 0) smfprintf(df, dl, "%s\n", buffer); | 450 | if (j != 0) smfprintf(df, dl, "%s\n", buffer); |
446 | } | 451 | } |
447 | 452 | ||
448 | char *GetOS(void) | 453 | char *GetOS(void) |
449 | { | 454 | { |
450 | #ifdef WIN32 | 455 | #ifdef WIN32 |
451 | OSVERSIONINFOEX Ver; | 456 | OSVERSIONINFOEX Ver; |
452 | bool Extended = true; | 457 | bool Extended = true; |
453 | #endif | 458 | #endif |
459 | #if defined(linux) || defined(__linux) || defined(__linux__) | ||
460 | struct utsnameVer; | ||
461 | #endif | ||
454 | static char Buffer[100] = {0x00}; | 462 | static char Buffer[100] = {0x00}; |
455 | 463 | ||
456 | #ifdef WIN32 | 464 | #ifdef WIN32 |
457 | memset(&Ver,sizeof(OSVERSIONINFOEX),0); | 465 | memset(&Ver,sizeof(OSVERSIONINFOEX),0); |
458 | Ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); | 466 | Ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
459 | 467 | ||
460 | if (!GetVersionEx((OSVERSIONINFO *)&Ver)) { | 468 | if (!GetVersionEx((OSVERSIONINFO *)&Ver)) { |
461 | Extended = false; | 469 | Extended = false; |
462 | Ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | 470 | Ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
463 | if (!GetVersionEx((OSVERSIONINFO *)&Ver)) { | 471 | if (!GetVersionEx((OSVERSIONINFO *)&Ver)) { |
464 | //#ifdef _MSC_VER | 472 | //#ifdef _MSC_VER |
465 | // Ver.dwMajorVersion = _winmajor; | 473 | // Ver.dwMajorVersion = _winmajor; |
466 | // Ver.dwMinorVersion = _winminor; | 474 | // Ver.dwMinorVersion = _winminor; |
467 | // Ver.dwBuildNumber = _osver; | 475 | // Ver.dwBuildNumber = _osver; |
468 | //#else | 476 | //#else |
469 | sprintf(Buffer, "Windows"); | 477 | sprintf(Buffer, "Windows"); |
470 | return Buffer; | 478 | return Buffer; |
471 | //#endif | 479 | //#endif |
472 | } | 480 | } |
473 | } | 481 | } |
474 | 482 | ||
475 | /* ----------------- 9x family ------------------ */ | 483 | /* ----------------- 9x family ------------------ */ |
476 | 484 | ||
477 | /* no info about Win95 SP1, Win95 OSR2.1, Win95 OSR2.5.... */ | 485 | /* no info about Win95 SP1, Win95 OSR2.1, Win95 OSR2.5.... */ |
@@ -499,49 +507,50 @@ char *GetOS(void) | |||
499 | 507 | ||
500 | } else if (Ver.dwMajorVersion == 5 && Ver.dwMinorVersion == 1 && Ver.dwBuildNumber == 2600) { | 508 | } else if (Ver.dwMajorVersion == 5 && Ver.dwMinorVersion == 1 && Ver.dwBuildNumber == 2600) { |
501 | sprintf(Buffer,"Win XP"); | 509 | sprintf(Buffer,"Win XP"); |
502 | #if _MSC_VER > 1200 //6.0 has it undeclared | 510 | #if _MSC_VER > 1200 //6.0 has it undeclared |
503 | if (Extended) { | 511 | if (Extended) { |
504 | if (Ver.wSuiteMask & VER_SUITE_PERSONAL) { | 512 | if (Ver.wSuiteMask & VER_SUITE_PERSONAL) { |
505 | sprintf(Buffer+strlen(Buffer)," Home"); | 513 | sprintf(Buffer+strlen(Buffer)," Home"); |
506 | } else { | 514 | } else { |
507 | sprintf(Buffer+strlen(Buffer)," Pro"); | 515 | sprintf(Buffer+strlen(Buffer)," Pro"); |
508 | } | 516 | } |
509 | } | 517 | } |
510 | #endif | 518 | #endif |
511 | 519 | ||
512 | } else if (Ver.dwMajorVersion == 5 && Ver.dwMinorVersion == 2) { | 520 | } else if (Ver.dwMajorVersion == 5 && Ver.dwMinorVersion == 2) { |
513 | sprintf(Buffer,"Win 2003"); | 521 | sprintf(Buffer,"Win 2003"); |
514 | 522 | ||
515 | } else { | 523 | } else { |
516 | sprintf(Buffer, "Windows %i.%i.%i",Ver.dwMajorVersion,Ver.dwMinorVersion,Ver.dwBuildNumber); | 524 | sprintf(Buffer, "Windows %i.%i.%i",Ver.dwMajorVersion,Ver.dwMinorVersion,Ver.dwBuildNumber); |
517 | } | 525 | } |
518 | 526 | ||
519 | if (Extended && Ver.wServicePackMajor != 0) { | 527 | if (Extended && Ver.wServicePackMajor != 0) { |
520 | sprintf(Buffer+strlen(Buffer)," SP%i",Ver.wServicePackMajor); | 528 | sprintf(Buffer+strlen(Buffer)," SP%i",Ver.wServicePackMajor); |
521 | } | 529 | } |
522 | #elif defined(linux) || defined(__linux) || defined(__linux__) | 530 | #elif defined(linux) || defined(__linux) || defined(__linux__) |
523 | sprintf(Buffer, "Linux"); | 531 | uname(&Ver); |
532 | sprintf(Buffer, "Linux, kernel %s",Ver.release); | ||
524 | #elif defined(__FreeBSD__) | 533 | #elif defined(__FreeBSD__) |
525 | sprintf(Buffer, "FreeBSD"); | 534 | sprintf(Buffer, "FreeBSD"); |
526 | #elif defined(__NetBSD__) | 535 | #elif defined(__NetBSD__) |
527 | sprintf(Buffer, "NetBSD"); | 536 | sprintf(Buffer, "NetBSD"); |
528 | #elif defined(__OpenBSD__) | 537 | #elif defined(__OpenBSD__) |
529 | sprintf(Buffer, "OpenBSD"); | 538 | sprintf(Buffer, "OpenBSD"); |
530 | #elif defined(__GNU__) | 539 | #elif defined(__GNU__) |
531 | sprintf(Buffer, "GNU/Hurd"); | 540 | sprintf(Buffer, "GNU/Hurd"); |
532 | #elif defined(sun) || defined(__sun) || defined(__sun__) | 541 | #elif defined(sun) || defined(__sun) || defined(__sun__) |
533 | # ifdef __SVR4 | 542 | # ifdef __SVR4 |
534 | sprintf(Buffer, "Sun Solaris"); | 543 | sprintf(Buffer, "Sun Solaris"); |
535 | # else | 544 | # else |
536 | sprintf(Buffer, "SunOS"); | 545 | sprintf(Buffer, "SunOS"); |
537 | # endif | 546 | # endif |
538 | #elif defined(hpux) || defined(__hpux) || defined(__hpux__) | 547 | #elif defined(hpux) || defined(__hpux) || defined(__hpux__) |
539 | sprintf(Buffer, "HP-UX"); | 548 | sprintf(Buffer, "HP-UX"); |
540 | #elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__) | 549 | #elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__) |
541 | sprintf(Buffer, "DEC Ultrix"); | 550 | sprintf(Buffer, "DEC Ultrix"); |
542 | #elif defined(sgi) || defined(__sgi) | 551 | #elif defined(sgi) || defined(__sgi) |
543 | sprintf(Buffer, "SGI Irix"); | 552 | sprintf(Buffer, "SGI Irix"); |
544 | #elif defined(__osf__) | 553 | #elif defined(__osf__) |
545 | sprintf(Buffer, "OSF Unix"); | 554 | sprintf(Buffer, "OSF Unix"); |
546 | #elif defined(bsdi) || defined(__bsdi__) | 555 | #elif defined(bsdi) || defined(__bsdi__) |
547 | sprintf(Buffer, "BSDI Unix"); | 556 | sprintf(Buffer, "BSDI Unix"); |
diff --git a/gammu/emb/common/misc/misc.h b/gammu/emb/common/misc/misc.h index 8b46170..c461001 100644 --- a/gammu/emb/common/misc/misc.h +++ b/gammu/emb/common/misc/misc.h | |||
@@ -1,29 +1,33 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef __misc_h | 3 | #ifndef __misc_h |
4 | #define __misc_h | 4 | #define __misc_h |
5 | 5 | ||
6 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
6 | #include <stdio.h> | 10 | #include <stdio.h> |
7 | #include <time.h> | 11 | #include <time.h> |
8 | #ifdef WIN32 | 12 | #ifdef WIN32 |
9 | # include <windows.h> | 13 | # include <windows.h> |
10 | #endif | 14 | #endif |
11 | 15 | ||
12 | #include "../config.h" | 16 | #include "../config.h" |
13 | 17 | ||
14 | #ifndef __cplusplus | 18 | #ifndef __cplusplus |
15 | #ifndef false | 19 | #ifndef false |
16 | # define false 0 | 20 | # define false 0 |
17 | #endif | 21 | #endif |
18 | #ifndef true | 22 | #ifndef true |
19 | # define true !0 | 23 | # define true !0 |
20 | #endif | 24 | #endif |
21 | #ifndef bool | 25 | #ifndef bool |
22 | # define boolchar | 26 | # define boolchar |
23 | #endif | 27 | #endif |
24 | #endif /* __cplusplus */ | 28 | #endif /* __cplusplus */ |
25 | 29 | ||
26 | #ifdef WIN32 | 30 | #ifdef WIN32 |
27 | # define my_sleep(x) ((x)<1000 ? Sleep(1) : Sleep((x)/1000)) | 31 | # define my_sleep(x) ((x)<1000 ? Sleep(1) : Sleep((x)/1000)) |
28 | #else | 32 | #else |
29 | # define my_sleep(x) usleep(x) | 33 | # define my_sleep(x) usleep(x) |
@@ -109,29 +113,33 @@ typedef struct { | |||
109 | unsigned int Day; | 113 | unsigned int Day; |
110 | /** | 114 | /** |
111 | * January = 1, February = 2, etc. | 115 | * January = 1, February = 2, etc. |
112 | */ | 116 | */ |
113 | unsigned int Month; | 117 | unsigned int Month; |
114 | /** | 118 | /** |
115 | * Complete year number. Not 03, but 2003 | 119 | * Complete year number. Not 03, but 2003 |
116 | */ | 120 | */ |
117 | unsigned int Year; | 121 | unsigned int Year; |
118 | } GSM_DateTime; | 122 | } GSM_DateTime; |
119 | 123 | ||
120 | void GSM_GetCurrentDateTime (GSM_DateTime *Date); | 124 | void GSM_GetCurrentDateTime (GSM_DateTime *Date); |
121 | char *OSDateTime (GSM_DateTime dt, bool TimeZone); | 125 | char *OSDateTime (GSM_DateTime dt, bool TimeZone); |
122 | char *OSDate (GSM_DateTime dt); | 126 | char *OSDate (GSM_DateTime dt); |
123 | char *DayOfWeek (int year, int month, int day); | 127 | char *DayOfWeek (int year, int month, int day); |
124 | time_t Fill_Time_T (GSM_DateTime DT, int TZ); | 128 | time_t Fill_Time_T (GSM_DateTime DT, int TZ); |
125 | void GetTimeDifference (unsigned long diff, GSM_DateTime *DT, bool Plus, int multi); | 129 | void GetTimeDifference (unsigned long diff, GSM_DateTime *DT, bool Plus, int multi); |
126 | void Fill_GSM_DateTime (GSM_DateTime *Date, time_t timet); | 130 | void Fill_GSM_DateTime (GSM_DateTime *Date, time_t timet); |
127 | bool CheckDate (GSM_DateTime *date); | 131 | bool CheckDate (GSM_DateTime *date); |
128 | bool CheckTime (GSM_DateTime *date); | 132 | bool CheckTime (GSM_DateTime *date); |
129 | 133 | ||
130 | char *GetCompiler(void); | 134 | char *GetCompiler(void); |
131 | char *GetOS(void); | 135 | char *GetOS(void); |
132 | 136 | ||
137 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
138 | } | ||
139 | #endif | ||
140 | |||
133 | #endif | 141 | #endif |
134 | 142 | ||
135 | /* How should editor hadle tabs in this file? Add editor commands here. | 143 | /* How should editor hadle tabs in this file? Add editor commands here. |
136 | * vim: noexpandtab sw=8 ts=8 sts=8: | 144 | * vim: noexpandtab sw=8 ts=8 sts=8: |
137 | */ | 145 | */ |
diff --git a/gammu/emb/common/phone/alcatel/alcatel.c b/gammu/emb/common/phone/alcatel/alcatel.c index f004ad4..3821f13 100644 --- a/gammu/emb/common/phone/alcatel/alcatel.c +++ b/gammu/emb/common/phone/alcatel/alcatel.c | |||
@@ -80,48 +80,49 @@ extern GSM_Error ATGEN_GetNextSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sm | |||
80 | extern GSM_Error ATGEN_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location); | 80 | extern GSM_Error ATGEN_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location); |
81 | extern GSM_Error ATGEN_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); | 81 | extern GSM_Error ATGEN_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); |
82 | extern GSM_Error ATGEN_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); | 82 | extern GSM_Error ATGEN_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); |
83 | extern GSM_Error ATGEN_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); | 83 | extern GSM_Error ATGEN_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); |
84 | extern GSM_Error ATGEN_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat); | 84 | extern GSM_Error ATGEN_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat); |
85 | extern GSM_Error ATGEN_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig); | 85 | extern GSM_Error ATGEN_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig); |
86 | extern GSM_Error ATGEN_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber); | 86 | extern GSM_Error ATGEN_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber); |
87 | extern GSM_Error ATGEN_AnswerCall (GSM_StateMachine *s, int ID, bool all); | 87 | extern GSM_Error ATGEN_AnswerCall (GSM_StateMachine *s, int ID, bool all); |
88 | extern GSM_Error ATGEN_CancelCall (GSM_StateMachine *s, int ID, bool all); | 88 | extern GSM_Error ATGEN_CancelCall (GSM_StateMachine *s, int ID, bool all); |
89 | extern GSM_Error ATGEN_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time); | 89 | extern GSM_Error ATGEN_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time); |
90 | extern GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code); | 90 | extern GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code); |
91 | extern GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status); | 91 | extern GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status); |
92 | extern GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type); | 92 | extern GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type); |
93 | extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence); | 93 | extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence); |
94 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); | 94 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); |
95 | extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s); | 95 | extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s); |
96 | extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo); | 96 | extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo); |
97 | extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard); | 97 | extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard); |
98 | extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press); | 98 | extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press); |
99 | extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features); | 99 | extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features); |
100 | extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); | 100 | extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); |
101 | extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); | 101 | extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); |
102 | 102 | ||
103 | extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); | 103 | extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); |
104 | extern GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable); | ||
104 | extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); | 105 | extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); |
105 | extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); | 106 | extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); |
106 | 107 | ||
107 | /** | 108 | /** |
108 | * Alcatel uses some 8-bit characters in contacts, calendar etc.. This table | 109 | * Alcatel uses some 8-bit characters in contacts, calendar etc.. This table |
109 | * attempts to decode it, it is probably not complete, here are just chars | 110 | * attempts to decode it, it is probably not complete, here are just chars |
110 | * that I found... | 111 | * that I found... |
111 | */ | 112 | */ |
112 | unsigned char GSM_AlcatelAlphabet[] = | 113 | unsigned char GSM_AlcatelAlphabet[] = |
113 | { | 114 | { |
114 | /* in phone unicode description*/ | 115 | /* in phone unicode description*/ |
115 | 0x80, 0x00,0x20, /* empty */ | 116 | 0x80, 0x00,0x20, /* empty */ |
116 | 0x81, 0x00,0x20, /* empty*/ | 117 | 0x81, 0x00,0x20, /* empty*/ |
117 | 0x82, 0x00,0x20, /* empty*/ | 118 | 0x82, 0x00,0x20, /* empty*/ |
118 | 0x83, 0x00,0x20, /* empty*/ | 119 | 0x83, 0x00,0x20, /* empty*/ |
119 | 120 | ||
120 | 0x84, 0x00,0xe7, /* c cedilla*/ | 121 | 0x84, 0x00,0xe7, /* c cedilla*/ |
121 | 0x85, 0x20,0x26, /* ... */ | 122 | 0x85, 0x20,0x26, /* ... */ |
122 | 0x86, 0x03,0xc0, /* pi */ | 123 | 0x86, 0x03,0xc0, /* pi */ |
123 | 0x87, 0x01,0x3e, /* l caron*/ | 124 | 0x87, 0x01,0x3e, /* l caron*/ |
124 | 0x88, 0x00,0xc0, /* A grave*/ | 125 | 0x88, 0x00,0xc0, /* A grave*/ |
125 | 0x89, 0x00,0xc1, /* A acute*/ | 126 | 0x89, 0x00,0xc1, /* A acute*/ |
126 | 0x8a, 0x00,0xc2, /* A circumflex*/ | 127 | 0x8a, 0x00,0xc2, /* A circumflex*/ |
127 | 0x8b, 0x00,0xc3, /* A tilde*/ | 128 | 0x8b, 0x00,0xc3, /* A tilde*/ |
@@ -523,48 +524,50 @@ static GSM_Error ALCATEL_GoToBinaryState(GSM_StateMachine *s, GSM_Alcatel_Binary | |||
523 | Priv->BinaryItem = item; | 524 | Priv->BinaryItem = item; |
524 | return ERR_NONE; | 525 | return ERR_NONE; |
525 | } | 526 | } |
526 | } | 527 | } |
527 | return ERR_NONE; | 528 | return ERR_NONE; |
528 | } | 529 | } |
529 | 530 | ||
530 | static GSM_Error ALCATEL_SetATMode(GSM_StateMachine *s) | 531 | static GSM_Error ALCATEL_SetATMode(GSM_StateMachine *s) |
531 | { | 532 | { |
532 | GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; | 533 | GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; |
533 | GSM_Error error; | 534 | GSM_Error error; |
534 | 535 | ||
535 | if (Priv->Mode == ModeAT) return ERR_NONE; | 536 | if (Priv->Mode == ModeAT) return ERR_NONE; |
536 | 537 | ||
537 | error = ALCATEL_GoToBinaryState(s, StateAttached, 0, 0); | 538 | error = ALCATEL_GoToBinaryState(s, StateAttached, 0, 0); |
538 | if (error != ERR_NONE) return error; | 539 | if (error != ERR_NONE) return error; |
539 | 540 | ||
540 | error = s->Protocol.Functions->Terminate(s); | 541 | error = s->Protocol.Functions->Terminate(s); |
541 | if (error != ERR_NONE) return error; | 542 | if (error != ERR_NONE) return error; |
542 | 543 | ||
543 | dbgprintf ("Changing protocol to AT\n"); | 544 | dbgprintf ("Changing protocol to AT\n"); |
544 | s->Protocol.Functions = &ATProtocol; | 545 | s->Protocol.Functions = &ATProtocol; |
545 | s->Phone.Functions->ReplyFunctions= ATGENReplyFunctions; | 546 | s->Phone.Functions->ReplyFunctions= ATGENReplyFunctions; |
546 | Priv->Mode = ModeAT; | 547 | Priv->Mode = ModeAT; |
548 | s->Phone.Data.Priv.ATGEN.PBKCharset= 0; | ||
549 | s->Phone.Data.Priv.ATGEN.PBKMemory= 0; | ||
547 | 550 | ||
548 | my_sleep(100); | 551 | my_sleep(100); |
549 | 552 | ||
550 | /* In case we don't send AT command short after closing binary mode, | 553 | /* In case we don't send AT command short after closing binary mode, |
551 | * phone takes VERY long to react next time. The error code in | 554 | * phone takes VERY long to react next time. The error code in |
552 | * intetionally ignored. | 555 | * intetionally ignored. |
553 | */ | 556 | */ |
554 | GSM_WaitFor (s, "AT\r", 3, 0x00, 0, ID_IncomingFrame); | 557 | GSM_WaitFor (s, "AT\r", 3, 0x00, 0, ID_IncomingFrame); |
555 | 558 | ||
556 | return ERR_NONE; | 559 | return ERR_NONE; |
557 | } | 560 | } |
558 | 561 | ||
559 | static GSM_Error ALCATEL_Initialise(GSM_StateMachine *s) | 562 | static GSM_Error ALCATEL_Initialise(GSM_StateMachine *s) |
560 | { | 563 | { |
561 | GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; | 564 | GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; |
562 | GSM_Error error; | 565 | GSM_Error error; |
563 | 566 | ||
564 | Priv->Mode = ModeAT; | 567 | Priv->Mode = ModeAT; |
565 | 568 | ||
566 | Priv->CalendarItems = NULL; | 569 | Priv->CalendarItems = NULL; |
567 | Priv->ContactsItems = NULL; | 570 | Priv->ContactsItems = NULL; |
568 | Priv->ToDoItems = NULL; | 571 | Priv->ToDoItems = NULL; |
569 | Priv->CalendarItemsCount = 0; | 572 | Priv->CalendarItemsCount = 0; |
570 | Priv->ToDoItemsCount = 0; | 573 | Priv->ToDoItemsCount = 0; |
@@ -3801,48 +3804,56 @@ static GSM_Error ALCATEL_ReplyGeneric(GSM_Protocol_Message msg, GSM_StateMachine | |||
3801 | 3804 | ||
3802 | static GSM_Error ALCATEL_ReplyCommit(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3805 | static GSM_Error ALCATEL_ReplyCommit(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3803 | { | 3806 | { |
3804 | s->Phone.Data.Priv.ALCATEL.CommitedRecord = msg.Buffer[12] + (msg.Buffer[11] << 8) + (msg.Buffer[10] << 16) + (msg.Buffer[9] << 24); | 3807 | s->Phone.Data.Priv.ALCATEL.CommitedRecord = msg.Buffer[12] + (msg.Buffer[11] << 8) + (msg.Buffer[10] << 16) + (msg.Buffer[9] << 24); |
3805 | smprintf(s, "Created record %08x\n", s->Phone.Data.Priv.ALCATEL.CommitedRecord); | 3808 | smprintf(s, "Created record %08x\n", s->Phone.Data.Priv.ALCATEL.CommitedRecord); |
3806 | return ERR_NONE; | 3809 | return ERR_NONE; |
3807 | } | 3810 | } |
3808 | 3811 | ||
3809 | static GSM_Error ALCATEL_SetIncomingCB (GSM_StateMachine *s, bool enable) | 3812 | static GSM_Error ALCATEL_SetIncomingCB (GSM_StateMachine *s, bool enable) |
3810 | { | 3813 | { |
3811 | GSM_Error error; | 3814 | GSM_Error error; |
3812 | 3815 | ||
3813 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; | 3816 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; |
3814 | return ATGEN_SetIncomingCB(s, enable); | 3817 | return ATGEN_SetIncomingCB(s, enable); |
3815 | } | 3818 | } |
3816 | 3819 | ||
3817 | static GSM_Error ALCATEL_SetIncomingSMS (GSM_StateMachine *s, bool enable) | 3820 | static GSM_Error ALCATEL_SetIncomingSMS (GSM_StateMachine *s, bool enable) |
3818 | { | 3821 | { |
3819 | GSM_Error error; | 3822 | GSM_Error error; |
3820 | 3823 | ||
3821 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; | 3824 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; |
3822 | return ATGEN_SetIncomingSMS(s, enable); | 3825 | return ATGEN_SetIncomingSMS(s, enable); |
3823 | } | 3826 | } |
3824 | 3827 | ||
3828 | static GSM_Error ALCATEL_SetFastSMSSending(GSM_StateMachine *s, bool enable) | ||
3829 | { | ||
3830 | GSM_Error error; | ||
3831 | |||
3832 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; | ||
3833 | return ATGEN_SetFastSMSSending(s, enable); | ||
3834 | } | ||
3835 | |||
3825 | static GSM_Reply_Function ALCATELReplyFunctions[] = { | 3836 | static GSM_Reply_Function ALCATELReplyFunctions[] = { |
3826 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach }, | 3837 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach }, |
3827 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach }, | 3838 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach }, |
3828 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit }, | 3839 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit }, |
3829 | {ALCATEL_ReplyCommit, "\x02",0x00,0x00, ID_AlcatelCommit2 }, | 3840 | {ALCATEL_ReplyCommit, "\x02",0x00,0x00, ID_AlcatelCommit2 }, |
3830 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelEnd }, | 3841 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelEnd }, |
3831 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelClose }, | 3842 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelClose }, |
3832 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelStart }, | 3843 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelStart }, |
3833 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect1 }, | 3844 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect1 }, |
3834 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect2 }, | 3845 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect2 }, |
3835 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect3 }, | 3846 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect3 }, |
3836 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin1 }, | 3847 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin1 }, |
3837 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin2 }, | 3848 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin2 }, |
3838 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetIds1 }, | 3849 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetIds1 }, |
3839 | {ALCATEL_ReplyGetIds, "\x02",0x00,0x00, ID_AlcatelGetIds2 }, | 3850 | {ALCATEL_ReplyGetIds, "\x02",0x00,0x00, ID_AlcatelGetIds2 }, |
3840 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetCategories1}, | 3851 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetCategories1}, |
3841 | {ALCATEL_ReplyGetCategories, "\x02",0x00,0x00, ID_AlcatelGetCategories2}, | 3852 | {ALCATEL_ReplyGetCategories, "\x02",0x00,0x00, ID_AlcatelGetCategories2}, |
3842 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetCategoryText1}, | 3853 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetCategoryText1}, |
3843 | {ALCATEL_ReplyGetCategoryText, "\x02",0x00,0x00, ID_AlcatelGetCategoryText2}, | 3854 | {ALCATEL_ReplyGetCategoryText, "\x02",0x00,0x00, ID_AlcatelGetCategoryText2}, |
3844 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAddCategoryText1}, | 3855 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAddCategoryText1}, |
3845 | {ALCATEL_ReplyAddCategoryText, "\x02",0x00,0x00, ID_AlcatelAddCategoryText2}, | 3856 | {ALCATEL_ReplyAddCategoryText, "\x02",0x00,0x00, ID_AlcatelAddCategoryText2}, |
3846 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetFields1 }, | 3857 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetFields1 }, |
3847 | {ALCATEL_ReplyGetFields, "\x02",0x00,0x00, ID_AlcatelGetFields2 }, | 3858 | {ALCATEL_ReplyGetFields, "\x02",0x00,0x00, ID_AlcatelGetFields2 }, |
3848 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetFieldValue1}, | 3859 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetFieldValue1}, |
@@ -3892,48 +3903,49 @@ GSM_Phone_Functions ALCATELPhone = { | |||
3892 | ALCATEL_GetSignalStrength, | 3903 | ALCATEL_GetSignalStrength, |
3893 | ALCATEL_GetNetworkInfo, | 3904 | ALCATEL_GetNetworkInfo, |
3894 | ALCATEL_GetCategory, | 3905 | ALCATEL_GetCategory, |
3895 | ALCATEL_AddCategory, | 3906 | ALCATEL_AddCategory, |
3896 | ALCATEL_GetCategoryStatus, | 3907 | ALCATEL_GetCategoryStatus, |
3897 | ALCATEL_GetMemoryStatus, | 3908 | ALCATEL_GetMemoryStatus, |
3898 | ALCATEL_GetMemory, | 3909 | ALCATEL_GetMemory, |
3899 | ALCATEL_GetNextMemory, | 3910 | ALCATEL_GetNextMemory, |
3900 | ALCATEL_SetMemory, | 3911 | ALCATEL_SetMemory, |
3901 | ALCATEL_AddMemory, | 3912 | ALCATEL_AddMemory, |
3902 | ALCATEL_DeleteMemory, | 3913 | ALCATEL_DeleteMemory, |
3903 | ALCATEL_DeleteAllMemory, | 3914 | ALCATEL_DeleteAllMemory, |
3904 | NOTSUPPORTED, /* GetSpeedDial */ | 3915 | NOTSUPPORTED, /* GetSpeedDial */ |
3905 | NOTSUPPORTED, /* SetSpeedDial */ | 3916 | NOTSUPPORTED, /* SetSpeedDial */ |
3906 | ALCATEL_GetSMSC, | 3917 | ALCATEL_GetSMSC, |
3907 | ALCATEL_SetSMSC, | 3918 | ALCATEL_SetSMSC, |
3908 | ALCATEL_GetSMSStatus, | 3919 | ALCATEL_GetSMSStatus, |
3909 | ALCATEL_GetSMS, | 3920 | ALCATEL_GetSMS, |
3910 | ALCATEL_GetNextSMS, | 3921 | ALCATEL_GetNextSMS, |
3911 | NOTSUPPORTED, /* SetSMS */ | 3922 | NOTSUPPORTED, /* SetSMS */ |
3912 | ALCATEL_AddSMS, | 3923 | ALCATEL_AddSMS, |
3913 | ALCATEL_DeleteSMS, | 3924 | ALCATEL_DeleteSMS, |
3914 | ALCATEL_SendSMS, | 3925 | ALCATEL_SendSMS, |
3915 | ALCATEL_SendSavedSMS, | 3926 | ALCATEL_SendSavedSMS, |
3927 | ALCATEL_SetFastSMSSending, | ||
3916 | ALCATEL_SetIncomingSMS, | 3928 | ALCATEL_SetIncomingSMS, |
3917 | ALCATEL_SetIncomingCB, | 3929 | ALCATEL_SetIncomingCB, |
3918 | ALCATEL_GetSMSFolders, | 3930 | ALCATEL_GetSMSFolders, |
3919 | NOTSUPPORTED, /* AddSMSFolder */ | 3931 | NOTSUPPORTED, /* AddSMSFolder */ |
3920 | NOTSUPPORTED, /* DeleteSMSFolder */ | 3932 | NOTSUPPORTED, /* DeleteSMSFolder */ |
3921 | ALCATEL_DialVoice, | 3933 | ALCATEL_DialVoice, |
3922 | ALCATEL_AnswerCall, | 3934 | ALCATEL_AnswerCall, |
3923 | ALCATEL_CancelCall, | 3935 | ALCATEL_CancelCall, |
3924 | NOTSUPPORTED, /* HoldCall */ | 3936 | NOTSUPPORTED, /* HoldCall */ |
3925 | NOTSUPPORTED, /* UnholdCall */ | 3937 | NOTSUPPORTED, /* UnholdCall */ |
3926 | NOTSUPPORTED, /* ConferenceCall */ | 3938 | NOTSUPPORTED, /* ConferenceCall */ |
3927 | NOTSUPPORTED, /* SplitCall */ | 3939 | NOTSUPPORTED, /* SplitCall */ |
3928 | NOTSUPPORTED, /* TransferCall */ | 3940 | NOTSUPPORTED, /* TransferCall */ |
3929 | NOTSUPPORTED, /* SwitchCall */ | 3941 | NOTSUPPORTED, /* SwitchCall */ |
3930 | NOTSUPPORTED, /* GetCallDivert */ | 3942 | NOTSUPPORTED, /* GetCallDivert */ |
3931 | NOTSUPPORTED, /* SetCallDivert */ | 3943 | NOTSUPPORTED, /* SetCallDivert */ |
3932 | NOTSUPPORTED, /* CancelAllDiverts*/ | 3944 | NOTSUPPORTED, /* CancelAllDiverts*/ |
3933 | NONEFUNCTION, /* SetIncomingCall */ | 3945 | NONEFUNCTION, /* SetIncomingCall */ |
3934 | NOTSUPPORTED, /* SetIncomingUSSD */ | 3946 | NOTSUPPORTED, /* SetIncomingUSSD */ |
3935 | ALCATEL_SendDTMF, | 3947 | ALCATEL_SendDTMF, |
3936 | NOTSUPPORTED, /* GetRingtone */ | 3948 | NOTSUPPORTED, /* GetRingtone */ |
3937 | NOTSUPPORTED, /* SetRingtone */ | 3949 | NOTSUPPORTED, /* SetRingtone */ |
3938 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 3950 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
3939 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 3951 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
@@ -3946,46 +3958,46 @@ GSM_Phone_Functions ALCATELPhone = { | |||
3946 | NOTSUPPORTED, /* GetMMSSettings */ | 3958 | NOTSUPPORTED, /* GetMMSSettings */ |
3947 | NOTSUPPORTED, /* SetMMSSettings */ | 3959 | NOTSUPPORTED, /* SetMMSSettings */ |
3948 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 3960 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
3949 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 3961 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
3950 | NOTSUPPORTED, /* GetChatSettings */ | 3962 | NOTSUPPORTED, /* GetChatSettings */ |
3951 | NOTSUPPORTED, /* SetChatSettings */ | 3963 | NOTSUPPORTED, /* SetChatSettings */ |
3952 | NOTSUPPORTED, /* GetBitmap */ | 3964 | NOTSUPPORTED, /* GetBitmap */ |
3953 | NOTSUPPORTED, /* SetBitmap */ | 3965 | NOTSUPPORTED, /* SetBitmap */ |
3954 | ALCATEL_GetToDoStatus, | 3966 | ALCATEL_GetToDoStatus, |
3955 | ALCATEL_GetToDo, | 3967 | ALCATEL_GetToDo, |
3956 | ALCATEL_GetNextToDo, | 3968 | ALCATEL_GetNextToDo, |
3957 | ALCATEL_SetToDo, | 3969 | ALCATEL_SetToDo, |
3958 | ALCATEL_AddToDo, | 3970 | ALCATEL_AddToDo, |
3959 | ALCATEL_DeleteToDo, | 3971 | ALCATEL_DeleteToDo, |
3960 | ALCATEL_DeleteAllToDo, | 3972 | ALCATEL_DeleteAllToDo, |
3961 | ALCATEL_GetCalendarStatus, | 3973 | ALCATEL_GetCalendarStatus, |
3962 | ALCATEL_GetCalendar, | 3974 | ALCATEL_GetCalendar, |
3963 | ALCATEL_GetNextCalendar, | 3975 | ALCATEL_GetNextCalendar, |
3964 | ALCATEL_SetCalendar, | 3976 | ALCATEL_SetCalendar, |
3965 | ALCATEL_AddCalendar, | 3977 | ALCATEL_AddCalendar, |
3966 | ALCATEL_DeleteCalendar, | 3978 | ALCATEL_DeleteCalendar, |
3967 | ALCATEL_DeleteAllCalendar, | 3979 | ALCATEL_DeleteAllCalendar, |
3968 | NOTSUPPORTED, /* GetCalendarSettings*/ | 3980 | NOTSUPPORTED, /* GetCalendarSettings*/ |
3969 | NOTSUPPORTED, /* SetCalendarSettings*/ | 3981 | NOTSUPPORTED, /* SetCalendarSettings*/ |
3970 | NOTSUPPORTED, /* GetNote */ | 3982 | NOTSUPPORTED, /* GetNextNote */ |
3971 | NOTSUPPORTED, /* GetProfile */ | 3983 | NOTSUPPORTED, /* GetProfile */ |
3972 | NOTSUPPORTED, /* SetProfile */ | 3984 | NOTSUPPORTED, /* SetProfile */ |
3973 | NOTSUPPORTED, /* GetFMStation */ | 3985 | NOTSUPPORTED, /* GetFMStation */ |
3974 | NOTSUPPORTED, /* SetFMStation */ | 3986 | NOTSUPPORTED, /* SetFMStation */ |
3975 | NOTSUPPORTED, /* ClearFMStations */ | 3987 | NOTSUPPORTED, /* ClearFMStations */ |
3976 | NOTSUPPORTED, /* GetNextFileFolder*/ | 3988 | NOTSUPPORTED, /* GetNextFileFolder*/ |
3977 | NOTSUPPORTED, /* GetFilePart */ | 3989 | NOTSUPPORTED, /* GetFilePart */ |
3978 | NOTSUPPORTED, /* AddFilePart */ | 3990 | NOTSUPPORTED, /* AddFilePart */ |
3979 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 3991 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
3980 | NOTSUPPORTED, /* DeleteFile */ | 3992 | NOTSUPPORTED, /* DeleteFile */ |
3981 | NOTSUPPORTED, /* AddFolder */ | 3993 | NOTSUPPORTED, /* AddFolder */ |
3982 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 3994 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
3983 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 3995 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
3984 | }; | 3996 | }; |
3985 | 3997 | ||
3986 | #endif | 3998 | #endif |
3987 | #endif | 3999 | #endif |
3988 | 4000 | ||
3989 | /* How should editor hadle tabs in this file? Add editor commands here. | 4001 | /* How should editor hadle tabs in this file? Add editor commands here. |
3990 | * vim: noexpandtab sw=8 ts=8 sts=8: | 4002 | * vim: noexpandtab sw=8 ts=8 sts=8: |
3991 | */ | 4003 | */ |
diff --git a/gammu/emb/common/phone/at/atgen.c b/gammu/emb/common/phone/at/atgen.c index 1834f15..ba23eb2 100644 --- a/gammu/emb/common/phone/at/atgen.c +++ b/gammu/emb/common/phone/at/atgen.c | |||
@@ -1,69 +1,49 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ | 1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ |
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 | #include "../../service/sms/gsmsms.h" | 13 | #include "../../service/sms/gsmsms.h" |
14 | #include "../pfunc.h" | 14 | #include "../pfunc.h" |
15 | |||
15 | #include "atgen.h" | 16 | #include "atgen.h" |
16 | 17 | ||
18 | #include "samsung.h" | ||
19 | #include "siemens.h" | ||
20 | #include "sonyeric.h" | ||
21 | |||
17 | #ifdef GSM_ENABLE_ALCATEL | 22 | #ifdef GSM_ENABLE_ALCATEL |
18 | extern GSM_Error ALCATEL_ProtocolVersionReply(GSM_Protocol_Message msg, GSM_StateMachine *s); | 23 | GSM_Error ALCATEL_ProtocolVersionReply (GSM_Protocol_Message, GSM_StateMachine *); |
19 | #endif | 24 | #endif |
20 | 25 | ||
21 | extern GSM_Error ATGEN_CMS35ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
22 | extern GSM_Error ATGEN_CMS35ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
23 | extern GSM_Error ATGEN_CMS35ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
24 | extern GSM_Error ATGEN_CMS35ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
25 | extern GSM_Error ATGEN_CMS35ReplyGetNextCal(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
26 | extern GSM_Error ATGEN_CMS35ReplySetCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
27 | extern GSM_Error ATGEN_CMS35ReplyDeleteCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
28 | extern GSM_Error ATGEN_SL45ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
29 | |||
30 | extern GSM_Error ATGEN_GetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone); | ||
31 | extern GSM_Error ATGEN_SetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength); | ||
32 | extern GSM_Error ATGEN_GetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap); | ||
33 | extern GSM_Error ATGEN_SetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap); | ||
34 | extern GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); | ||
35 | extern GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
36 | extern GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
37 | |||
38 | extern GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); | ||
39 | extern GSM_Error SONYERIC_GetNextToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start); | ||
40 | extern GSM_Error SONYERIC_GetToDoStatus (GSM_StateMachine *s, GSM_ToDoStatus *status); | ||
41 | extern GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
42 | extern GSM_Error SONYERIC_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); | ||
43 | extern GSM_Error SONYERIC_DeleteAllToDo (GSM_StateMachine *s); | ||
44 | extern GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
45 | extern GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status); | ||
46 | 26 | ||
47 | typedef struct { | 27 | typedef struct { |
48 | int Number; | 28 | int Number; |
49 | char Text[60]; | 29 | char Text[60]; |
50 | } ATErrorCode; | 30 | } ATErrorCode; |
51 | 31 | ||
52 | static ATErrorCode CMSErrorCodes[] = { | 32 | static ATErrorCode CMSErrorCodes[] = { |
53 | /* | 33 | /* |
54 | * Error codes not specified here were either undefined or reserved in my | 34 | * Error codes not specified here were either undefined or reserved in my |
55 | * copy of specifications, if you have newer one, please fill in the gaps. | 35 | * copy of specifications, if you have newer one, please fill in the gaps. |
56 | */ | 36 | */ |
57 | /* 0...127 from GSM 04.11 Annex E-2 */ | 37 | /* 0...127 from GSM 04.11 Annex E-2 */ |
58 | {1, "Unassigned (unallocated) number"}, | 38 | {1, "Unassigned (unallocated) number"}, |
59 | {8, "Operator determined barring"}, | 39 | {8, "Operator determined barring"}, |
60 | {10, "Call barred"}, | 40 | {10, "Call barred"}, |
61 | {21, "Short message transfer rejected"}, | 41 | {21, "Short message transfer rejected"}, |
62 | {27, "Destination out of service"}, | 42 | {27, "Destination out of service"}, |
63 | {28, "Unidentified subscriber"}, | 43 | {28, "Unidentified subscriber"}, |
64 | {29, "Facility rejected"}, | 44 | {29, "Facility rejected"}, |
65 | {30, "Unknown subscriber"}, | 45 | {30, "Unknown subscriber"}, |
66 | {38, "Network out of order"}, | 46 | {38, "Network out of order"}, |
67 | {41, "Temporary failure"}, | 47 | {41, "Temporary failure"}, |
68 | {42, "Congestion"}, | 48 | {42, "Congestion"}, |
69 | {47, "Resources unavailable, unspecified"}, | 49 | {47, "Resources unavailable, unspecified"}, |
@@ -154,48 +134,50 @@ static ATErrorCode CMEErrorCodes[] = { | |||
154 | {23, "memory failure"}, | 134 | {23, "memory failure"}, |
155 | {24, "text string too long"}, | 135 | {24, "text string too long"}, |
156 | {25, "invalid characters in text string"}, | 136 | {25, "invalid characters in text string"}, |
157 | {26, "dial string too long"}, | 137 | {26, "dial string too long"}, |
158 | {27, "invalid characters in dial string"}, | 138 | {27, "invalid characters in dial string"}, |
159 | {30, "no network service"}, | 139 | {30, "no network service"}, |
160 | {31, "network timeout"}, | 140 | {31, "network timeout"}, |
161 | {100, "unknown"}, | 141 | {100, "unknown"}, |
162 | }; | 142 | }; |
163 | 143 | ||
164 | 144 | ||
165 | GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s) | 145 | GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s) |
166 | { | 146 | { |
167 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 147 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
168 | 148 | ||
169 | if (Priv->ErrorCode == 0) { | 149 | if (Priv->ErrorCode == 0) { |
170 | smprintf(s, "CME Error occured, but it's type not detected\n"); | 150 | smprintf(s, "CME Error occured, but it's type not detected\n"); |
171 | } else if (Priv->ErrorText == NULL) { | 151 | } else if (Priv->ErrorText == NULL) { |
172 | smprintf(s, "CME Error %i, no description available\n", Priv->ErrorCode); | 152 | smprintf(s, "CME Error %i, no description available\n", Priv->ErrorCode); |
173 | } else { | 153 | } else { |
174 | smprintf(s, "CME Error %i: \"%s\"\n", Priv->ErrorCode, Priv->ErrorText); | 154 | smprintf(s, "CME Error %i: \"%s\"\n", Priv->ErrorCode, Priv->ErrorText); |
175 | } | 155 | } |
176 | /* For error codes descriptions see table a bit above */ | 156 | /* For error codes descriptions see table a bit above */ |
177 | switch (Priv->ErrorCode) { | 157 | switch (Priv->ErrorCode) { |
158 | case -1: | ||
159 | return ERR_EMPTY; | ||
178 | case 3: | 160 | case 3: |
179 | return ERR_PERMISSION; | 161 | return ERR_PERMISSION; |
180 | case 4: | 162 | case 4: |
181 | return ERR_NOTSUPPORTED; | 163 | return ERR_NOTSUPPORTED; |
182 | case 5: | 164 | case 5: |
183 | case 11: | 165 | case 11: |
184 | case 12: | 166 | case 12: |
185 | case 16: | 167 | case 16: |
186 | case 17: | 168 | case 17: |
187 | case 18: | 169 | case 18: |
188 | return ERR_SECURITYERROR; | 170 | return ERR_SECURITYERROR; |
189 | case 20: | 171 | case 20: |
190 | return ERR_FULL; | 172 | return ERR_FULL; |
191 | case 21: | 173 | case 21: |
192 | return ERR_INVALIDLOCATION; | 174 | return ERR_INVALIDLOCATION; |
193 | case 22: | 175 | case 22: |
194 | return ERR_EMPTY; | 176 | return ERR_EMPTY; |
195 | case 23: | 177 | case 23: |
196 | return ERR_MEMORY; | 178 | return ERR_MEMORY; |
197 | case 24: | 179 | case 24: |
198 | case 25: | 180 | case 25: |
199 | case 26: | 181 | case 26: |
200 | case 27: | 182 | case 27: |
201 | return ERR_INVALIDDATA; | 183 | return ERR_INVALIDDATA; |
@@ -235,50 +217,58 @@ GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s) | |||
235 | return ERR_UNKNOWN; | 217 | return ERR_UNKNOWN; |
236 | } | 218 | } |
237 | } | 219 | } |
238 | 220 | ||
239 | /* FIXME: Function doesn't respect quoting of parameters and thus +FOO: | 221 | /* FIXME: Function doesn't respect quoting of parameters and thus +FOO: |
240 | * "ab","cd,ef" will consider as three arguments: "ab" >> "cd >> ef" | 222 | * "ab","cd,ef" will consider as three arguments: "ab" >> "cd >> ef" |
241 | */ | 223 | */ |
242 | int ATGEN_ExtractOneParameter(unsigned char *input, unsigned char *output) | 224 | int ATGEN_ExtractOneParameter(unsigned char *input, unsigned char *output) |
243 | { | 225 | { |
244 | int position=0; | 226 | int position=0; |
245 | 227 | ||
246 | while (*input!=',' && *input!=0x0d && *input!=0x00) { | 228 | while (*input!=',' && *input!=0x0d && *input!=0x00) { |
247 | *output=*input; | 229 | *output=*input; |
248 | input++; | 230 | input++; |
249 | output++; | 231 | output++; |
250 | position++; | 232 | position++; |
251 | } | 233 | } |
252 | *output=0; | 234 | *output=0; |
253 | position++; | 235 | position++; |
254 | return position; | 236 | return position; |
255 | } | 237 | } |
256 | 238 | ||
257 | void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input) | 239 | void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input) |
258 | { | 240 | { |
259 | dt->Year=2000+(*input-'0')*10; input++; | 241 | /* Samsung phones report year as %d instead of %02d */ |
242 | if (input[2] == '/') { | ||
243 | dt->Year=(*input-'0')*10; | ||
244 | input++; | ||
245 | } else { | ||
246 | dt->Year=0; | ||
247 | } | ||
248 | |||
260 | dt->Year=dt->Year+(*input-'0'); input++; | 249 | dt->Year=dt->Year+(*input-'0'); input++; |
250 | dt->Year+=2000; | ||
261 | 251 | ||
262 | input++; | 252 | input++; |
263 | dt->Month=(*input-'0')*10; input++; | 253 | dt->Month=(*input-'0')*10; input++; |
264 | dt->Month=dt->Month+(*input-'0'); input++; | 254 | dt->Month=dt->Month+(*input-'0'); input++; |
265 | 255 | ||
266 | input++; | 256 | input++; |
267 | dt->Day=(*input-'0')*10; input++; | 257 | dt->Day=(*input-'0')*10; input++; |
268 | dt->Day=dt->Day+(*input-'0'); input++; | 258 | dt->Day=dt->Day+(*input-'0'); input++; |
269 | 259 | ||
270 | input++; | 260 | input++; |
271 | dt->Hour=(*input-'0')*10; input++; | 261 | dt->Hour=(*input-'0')*10; input++; |
272 | dt->Hour=dt->Hour+(*input-'0'); input++; | 262 | dt->Hour=dt->Hour+(*input-'0'); input++; |
273 | 263 | ||
274 | input++; | 264 | input++; |
275 | dt->Minute=(*input-'0')*10; input++; | 265 | dt->Minute=(*input-'0')*10; input++; |
276 | dt->Minute=dt->Minute+(*input-'0');input++; | 266 | dt->Minute=dt->Minute+(*input-'0');input++; |
277 | 267 | ||
278 | input++; | 268 | input++; |
279 | dt->Second=(*input-'0')*10; input++; | 269 | dt->Second=(*input-'0')*10; input++; |
280 | dt->Second=dt->Second+(*input-'0');input++; | 270 | dt->Second=dt->Second+(*input-'0');input++; |
281 | 271 | ||
282 | if (input!=NULL) { | 272 | if (input!=NULL) { |
283 | input++; | 273 | input++; |
284 | dt->Timezone=(*input-'0')*10; input++; | 274 | dt->Timezone=(*input-'0')*10; input++; |
@@ -301,124 +291,174 @@ GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s) | |||
301 | /* Find number of lines */ | 291 | /* Find number of lines */ |
302 | while (Priv->Lines.numbers[i*2+1] != 0) { | 292 | while (Priv->Lines.numbers[i*2+1] != 0) { |
303 | /* FIXME: handle special chars correctly */ | 293 | /* FIXME: handle special chars correctly */ |
304 | smprintf(s, "%i \"%s\"\n",i+1,GetLineString(msg->Buffer,Priv->Lines,i+1)); | 294 | smprintf(s, "%i \"%s\"\n",i+1,GetLineString(msg->Buffer,Priv->Lines,i+1)); |
305 | i++; | 295 | i++; |
306 | } | 296 | } |
307 | 297 | ||
308 | Priv->ReplyState = AT_Reply_Unknown; | 298 | Priv->ReplyState = AT_Reply_Unknown; |
309 | Priv->ErrorText = NULL; | 299 | Priv->ErrorText = NULL; |
310 | Priv->ErrorCode = 0; | 300 | Priv->ErrorCode = 0; |
311 | 301 | ||
312 | line = GetLineString(msg->Buffer,Priv->Lines,i); | 302 | line = GetLineString(msg->Buffer,Priv->Lines,i); |
313 | if (!strcmp(line,"OK")) Priv->ReplyState = AT_Reply_OK; | 303 | if (!strcmp(line,"OK")) Priv->ReplyState = AT_Reply_OK; |
314 | if (!strcmp(line,"> ")) Priv->ReplyState = AT_Reply_SMSEdit; | 304 | if (!strcmp(line,"> ")) Priv->ReplyState = AT_Reply_SMSEdit; |
315 | if (!strcmp(line,"CONNECT"))Priv->ReplyState = AT_Reply_Connect; | 305 | if (!strcmp(line,"CONNECT"))Priv->ReplyState = AT_Reply_Connect; |
316 | if (!strcmp(line,"ERROR" ))Priv->ReplyState = AT_Reply_Error; | 306 | if (!strcmp(line,"ERROR" ))Priv->ReplyState = AT_Reply_Error; |
317 | if (!strncmp(line,"+CME ERROR:",11)) { | 307 | if (!strncmp(line,"+CME ERROR:",11)) { |
318 | Priv->ReplyState = AT_Reply_CMEError; | 308 | Priv->ReplyState = AT_Reply_CMEError; |
319 | ErrorCodes = CMEErrorCodes; | 309 | ErrorCodes = CMEErrorCodes; |
320 | } | 310 | } |
321 | if (!strncmp(line,"+CMS ERROR:",11)) { | 311 | if (!strncmp(line,"+CMS ERROR:",11)) { |
322 | Priv->ReplyState = AT_Reply_CMSError; | 312 | Priv->ReplyState = AT_Reply_CMSError; |
323 | ErrorCodes = CMSErrorCodes; | 313 | ErrorCodes = CMSErrorCodes; |
324 | } | 314 | } |
315 | |||
316 | /* FIXME: Samsung phones can answer +CME ERROR:-1 meaning empty location */ | ||
317 | if (Priv->ReplyState == AT_Reply_CMEError && Priv->Manufacturer == AT_Samsung) { | ||
318 | err = line + 11; | ||
319 | Priv->ErrorCode = atoi(err); | ||
320 | |||
321 | if (Priv->ErrorCode == -1) { | ||
322 | Priv->ErrorText = "[Samsung] Empty location"; | ||
323 | return GSM_DispatchMessage(s); | ||
324 | } | ||
325 | } | ||
326 | |||
325 | if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) { | 327 | if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) { |
326 | j = 0; | 328 | j = 0; |
327 | /* One char behind +CM[SE] ERROR */ | 329 | /* One char behind +CM[SE] ERROR */ |
328 | err = line + 12; | 330 | err = line + 12; |
329 | while (err[j] && !isalnum(err[j])) j++; | 331 | while (err[j] && !isalnum(err[j])) j++; |
330 | if (isdigit(err[j])) { | 332 | if (isdigit(err[j])) { |
331 | Priv->ErrorCode = atoi(&(err[j])); | 333 | Priv->ErrorCode = atoi(&(err[j])); |
332 | k = 0; | 334 | k = 0; |
333 | while (ErrorCodes[k].Number != -1) { | 335 | while (ErrorCodes[k].Number != -1) { |
334 | if (ErrorCodes[k].Number == Priv->ErrorCode) { | 336 | if (ErrorCodes[k].Number == Priv->ErrorCode) { |
335 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); | 337 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); |
336 | break; | 338 | break; |
337 | } | 339 | } |
338 | k++; | 340 | k++; |
339 | } | 341 | } |
340 | } else if (isalpha(err[j])) { | 342 | } else if (isalpha(err[j])) { |
341 | k = 0; | 343 | k = 0; |
342 | while (ErrorCodes[k].Number != -1) { | 344 | while (ErrorCodes[k].Number != -1) { |
343 | if (!strncmp(err + j, ErrorCodes[k].Text, strlen(ErrorCodes[k].Text))) { | 345 | if (!strncmp(err + j, ErrorCodes[k].Text, strlen(ErrorCodes[k].Text))) { |
344 | Priv->ErrorCode = ErrorCodes[k].Number; | 346 | Priv->ErrorCode = ErrorCodes[k].Number; |
345 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); | 347 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); |
346 | break; | 348 | break; |
347 | } | 349 | } |
348 | k++; | 350 | k++; |
349 | } | 351 | } |
350 | } | 352 | } |
351 | } | 353 | } |
352 | return GSM_DispatchMessage(s); | 354 | return GSM_DispatchMessage(s); |
353 | } | 355 | } |
354 | 356 | ||
355 | GSM_Error ATGEN_GenericReply(GSM_Protocol_Message msg, GSM_StateMachine *s) | 357 | GSM_Error ATGEN_GenericReply(GSM_Protocol_Message msg, GSM_StateMachine *s) |
356 | { | 358 | { |
357 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 359 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
358 | case AT_Reply_OK: | 360 | case AT_Reply_OK: |
359 | case AT_Reply_Connect: | 361 | case AT_Reply_Connect: |
360 | return ERR_NONE; | 362 | return ERR_NONE; |
361 | case AT_Reply_Error: | 363 | case AT_Reply_Error: |
362 | return ERR_UNKNOWN; | 364 | return ERR_UNKNOWN; |
363 | case AT_Reply_CMSError: | 365 | case AT_Reply_CMSError: |
364 | return ATGEN_HandleCMSError(s); | 366 | return ATGEN_HandleCMSError(s); |
365 | case AT_Reply_CMEError: | 367 | case AT_Reply_CMEError: |
366 | return ATGEN_HandleCMEError(s); | 368 | return ATGEN_HandleCMEError(s); |
367 | default: | 369 | default: |
368 | break; | 370 | break; |
369 | } | 371 | } |
370 | return ERR_UNKNOWNRESPONSE; | 372 | return ERR_UNKNOWNRESPONSE; |
371 | } | 373 | } |
372 | 374 | ||
375 | GSM_Error ATGEN_ReplyGetUSSD(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
376 | { | ||
377 | unsigned char buffer[2000],buffer2[4000]; | ||
378 | int i = 10; | ||
379 | |||
380 | /* Ugly hack */ | ||
381 | while (msg.Buffer[i]!=13) i++; | ||
382 | i = i - 6; | ||
383 | memcpy(buffer,msg.Buffer+10,i-11); | ||
384 | buffer[i-11] = 0x00; | ||
385 | |||
386 | smprintf(s, "USSD reply: \"%s\"\n",buffer); | ||
387 | |||
388 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { | ||
389 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | ||
390 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); | ||
391 | } | ||
392 | |||
393 | return ERR_NONE; | ||
394 | } | ||
395 | |||
396 | GSM_Error ATGEN_SetIncomingUSSD(GSM_StateMachine *s, bool enable) | ||
397 | { | ||
398 | GSM_Error error; | ||
399 | |||
400 | if (enable) { | ||
401 | smprintf(s, "Enabling incoming USSD\n"); | ||
402 | error=GSM_WaitFor (s, "AT+CUSD=1\r", 10, 0x00, 3, ID_SetUSSD); | ||
403 | } else { | ||
404 | smprintf(s, "Disabling incoming USSD\n"); | ||
405 | error=GSM_WaitFor (s, "AT+CUSD=0\r", 10, 0x00, 3, ID_SetUSSD); | ||
406 | } | ||
407 | if (error==ERR_NONE) s->Phone.Data.EnableIncomingUSSD = enable; | ||
408 | return error; | ||
409 | } | ||
410 | |||
373 | GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s) | 411 | GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s) |
374 | { | 412 | { |
375 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 413 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
376 | GSM_Phone_Data *Data = &s->Phone.Data; | 414 | GSM_Phone_Data *Data = &s->Phone.Data; |
377 | 415 | ||
378 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_NOTSUPPORTED; | 416 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_NOTSUPPORTED; |
379 | 417 | ||
380 | if (strlen(GetLineString(msg.Buffer, Priv->Lines, 2)) <= MAX_MODEL_LENGTH) { | 418 | if (strlen(GetLineString(msg.Buffer, Priv->Lines, 2)) <= MAX_MODEL_LENGTH) { |
381 | CopyLineString(Data->Model, msg.Buffer, Priv->Lines, 2); | 419 | CopyLineString(Data->Model, msg.Buffer, Priv->Lines, 2); |
382 | 420 | ||
383 | /* Sometimes phone adds this before manufacturer (Sagem) */ | 421 | /* Sometimes phone adds this before manufacturer (Sagem) */ |
384 | if (strncmp("+CGMM: ", Data->Model, 7) == 0) { | 422 | if (strncmp("+CGMM: ", Data->Model, 7) == 0) { |
385 | memmove(Data->Model, Data->Model + 7, strlen(Data->Model + 7) + 1); | 423 | memmove(Data->Model, Data->Model + 7, strlen(Data->Model + 7) + 1); |
386 | } | 424 | } |
387 | 425 | ||
388 | Data->ModelInfo = GetModelData(NULL,Data->Model,NULL); | 426 | Data->ModelInfo = GetModelData(NULL,Data->Model,NULL); |
389 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(NULL,NULL,Data->Model); | 427 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(NULL,NULL,Data->Model); |
390 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(Data->Model,NULL,NULL); | 428 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(Data->Model,NULL,NULL); |
391 | 429 | ||
392 | if (Data->ModelInfo->number[0] != 0) strcpy(Data->Model,Data->ModelInfo->number); | 430 | if (Data->ModelInfo->number[0] != 0) strcpy(Data->Model,Data->ModelInfo->number); |
393 | 431 | ||
394 | if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia; | 432 | if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia; |
395 | else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens; | 433 | else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens; |
396 | else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens; | 434 | else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens; |
435 | else if (strstr(msg.Buffer,"TC35")) Priv->Manufacturer = AT_Siemens; | ||
397 | else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP; | 436 | else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP; |
398 | 437 | ||
399 | if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20"); | 438 | if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20"); |
400 | else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35"); | 439 | else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35"); |
440 | else if (strstr(msg.Buffer,"TC35")) strcpy(Data->Model,"TC35"); | ||
401 | else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ"); | 441 | else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ"); |
402 | } else { | 442 | } else { |
403 | smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2))); | 443 | smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2))); |
404 | } | 444 | } |
405 | 445 | ||
406 | return ERR_NONE; | 446 | return ERR_NONE; |
407 | } | 447 | } |
408 | 448 | ||
409 | GSM_Error ATGEN_GetModel(GSM_StateMachine *s) | 449 | GSM_Error ATGEN_GetModel(GSM_StateMachine *s) |
410 | { | 450 | { |
411 | GSM_Error error; | 451 | GSM_Error error; |
412 | 452 | ||
413 | if (s->Phone.Data.Model[0] != 0) return ERR_NONE; | 453 | if (s->Phone.Data.Model[0] != 0) return ERR_NONE; |
414 | 454 | ||
415 | smprintf(s, "Getting model\n"); | 455 | smprintf(s, "Getting model\n"); |
416 | error=GSM_WaitFor (s, "AT+CGMM\r", 8, 0x00, 3, ID_GetModel); | 456 | error=GSM_WaitFor (s, "AT+CGMM\r", 8, 0x00, 3, ID_GetModel); |
417 | if (error==ERR_NONE) { | 457 | if (error==ERR_NONE) { |
418 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || | 458 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || |
419 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { | 459 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { |
420 | smprintf(s, "[Connected model - \"%s\"]\n",s->Phone.Data.Model); | 460 | smprintf(s, "[Connected model - \"%s\"]\n",s->Phone.Data.Model); |
421 | } | 461 | } |
422 | } | 462 | } |
423 | return error; | 463 | return error; |
424 | } | 464 | } |
@@ -460,48 +500,53 @@ GSM_Error ATGEN_ReplyGetManufacturer(GSM_Protocol_Message msg, GSM_StateMachine | |||
460 | smprintf(s, "Siemens\n"); | 500 | smprintf(s, "Siemens\n"); |
461 | strcpy(s->Phone.Data.Manufacturer,"Siemens"); | 501 | strcpy(s->Phone.Data.Manufacturer,"Siemens"); |
462 | Priv->Manufacturer = AT_Siemens; | 502 | Priv->Manufacturer = AT_Siemens; |
463 | } | 503 | } |
464 | if (strstr(msg.Buffer,"ERICSSON")) { | 504 | if (strstr(msg.Buffer,"ERICSSON")) { |
465 | smprintf(s, "Ericsson\n"); | 505 | smprintf(s, "Ericsson\n"); |
466 | strcpy(s->Phone.Data.Manufacturer,"Ericsson"); | 506 | strcpy(s->Phone.Data.Manufacturer,"Ericsson"); |
467 | Priv->Manufacturer = AT_Ericsson; | 507 | Priv->Manufacturer = AT_Ericsson; |
468 | } | 508 | } |
469 | if (strstr(msg.Buffer,"iPAQ")) { | 509 | if (strstr(msg.Buffer,"iPAQ")) { |
470 | smprintf(s, "iPAQ\n"); | 510 | smprintf(s, "iPAQ\n"); |
471 | strcpy(s->Phone.Data.Manufacturer,"HP"); | 511 | strcpy(s->Phone.Data.Manufacturer,"HP"); |
472 | Priv->Manufacturer = AT_HP; | 512 | Priv->Manufacturer = AT_HP; |
473 | } | 513 | } |
474 | if (strstr(msg.Buffer,"ALCATEL")) { | 514 | if (strstr(msg.Buffer,"ALCATEL")) { |
475 | smprintf(s, "Alcatel\n"); | 515 | smprintf(s, "Alcatel\n"); |
476 | strcpy(s->Phone.Data.Manufacturer,"Alcatel"); | 516 | strcpy(s->Phone.Data.Manufacturer,"Alcatel"); |
477 | Priv->Manufacturer = AT_Alcatel; | 517 | Priv->Manufacturer = AT_Alcatel; |
478 | } | 518 | } |
479 | if (strstr(msg.Buffer,"SAGEM")) { | 519 | if (strstr(msg.Buffer,"SAGEM")) { |
480 | smprintf(s, "Sagem\n"); | 520 | smprintf(s, "Sagem\n"); |
481 | strcpy(s->Phone.Data.Manufacturer,"Sagem"); | 521 | strcpy(s->Phone.Data.Manufacturer,"Sagem"); |
482 | Priv->Manufacturer = AT_Sagem; | 522 | Priv->Manufacturer = AT_Sagem; |
483 | } | 523 | } |
524 | if (strstr(msg.Buffer,"Samsung")) { | ||
525 | smprintf(s, "Samsung\n"); | ||
526 | strcpy(s->Phone.Data.Manufacturer,"Samsung"); | ||
527 | Priv->Manufacturer = AT_Samsung; | ||
528 | } | ||
484 | return ERR_NONE; | 529 | return ERR_NONE; |
485 | case AT_Reply_CMSError: | 530 | case AT_Reply_CMSError: |
486 | return ATGEN_HandleCMSError(s); | 531 | return ATGEN_HandleCMSError(s); |
487 | default: | 532 | default: |
488 | break; | 533 | break; |
489 | } | 534 | } |
490 | return ERR_UNKNOWNRESPONSE; | 535 | return ERR_UNKNOWNRESPONSE; |
491 | } | 536 | } |
492 | 537 | ||
493 | GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s) | 538 | GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s) |
494 | { | 539 | { |
495 | if (s->Phone.Data.Manufacturer[0] != 0) return ERR_NONE; | 540 | if (s->Phone.Data.Manufacturer[0] != 0) return ERR_NONE; |
496 | 541 | ||
497 | return GSM_WaitFor (s, "AT+CGMI\r", 8, 0x00, 4, ID_GetManufacturer); | 542 | return GSM_WaitFor (s, "AT+CGMI\r", 8, 0x00, 4, ID_GetManufacturer); |
498 | } | 543 | } |
499 | 544 | ||
500 | GSM_Error ATGEN_ReplyGetFirmwareCGMR(GSM_Protocol_Message msg, GSM_StateMachine *s) | 545 | GSM_Error ATGEN_ReplyGetFirmwareCGMR(GSM_Protocol_Message msg, GSM_StateMachine *s) |
501 | { | 546 | { |
502 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 547 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
503 | unsigned int i = 0; | 548 | unsigned int i = 0; |
504 | 549 | ||
505 | strcpy(s->Phone.Data.Version,"unknown"); | 550 | strcpy(s->Phone.Data.Version,"unknown"); |
506 | s->Phone.Data.VerNum = 0; | 551 | s->Phone.Data.VerNum = 0; |
507 | if (Priv->ReplyState == AT_Reply_OK) { | 552 | if (Priv->ReplyState == AT_Reply_OK) { |
@@ -653,58 +698,68 @@ GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) | |||
653 | 698 | ||
654 | if (smsc->Location!=1) return ERR_NOTSUPPORTED; | 699 | if (smsc->Location!=1) return ERR_NOTSUPPORTED; |
655 | 700 | ||
656 | sprintf(req, "AT+CSCA=\"%s\"\r",DecodeUnicodeString(smsc->Number)); | 701 | sprintf(req, "AT+CSCA=\"%s\"\r",DecodeUnicodeString(smsc->Number)); |
657 | 702 | ||
658 | smprintf(s, "Setting SMSC\n"); | 703 | smprintf(s, "Setting SMSC\n"); |
659 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetSMSC); | 704 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetSMSC); |
660 | } | 705 | } |
661 | 706 | ||
662 | GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *s) | 707 | GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *s) |
663 | { | 708 | { |
664 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 709 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
665 | case AT_Reply_OK: | 710 | case AT_Reply_OK: |
666 | /* Reply here is: | 711 | /* Reply here is: |
667 | * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] | 712 | * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] |
668 | * each memory is in quotes, | 713 | * each memory is in quotes, |
669 | * Example: ("SM"), ("SM"), ("SM") | 714 | * Example: ("SM"), ("SM"), ("SM") |
670 | * | 715 | * |
671 | * We need to get from this supported memories. For this case | 716 | * We need to get from this supported memories. For this case |
672 | * we assume, that just appearence of memory makes it | 717 | * we assume, that just appearence of memory makes it |
673 | * available for everything. Then we need to find out whether | 718 | * available for everything. Then we need to find out whether |
674 | * phone supports writing to memory. This is done by searching | 719 | * phone supports writing to memory. This is done by searching |
675 | * for "), (", which will appear between lists. | 720 | * for "), (", which will appear between lists. |
676 | */ | 721 | */ |
677 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = (strstr(msg.Buffer, "), (") != NULL); | 722 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = false; |
723 | if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) { | ||
724 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = true; | ||
725 | } | ||
726 | |||
678 | 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; |
679 | else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; | 728 | else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; |
729 | |||
680 | 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; |
681 | else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; | 731 | else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; |
682 | smprintf(s, "Available SMS memories received, ME = %d, SM = %d\n", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory); | 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); | ||
734 | if (s->Phone.Data.Priv.ATGEN.CanSaveSMS) smprintf(s, "true"); | ||
735 | smprintf(s, "\n"); | ||
683 | return ERR_NONE; | 736 | return ERR_NONE; |
684 | case AT_Reply_Error: | 737 | case AT_Reply_Error: |
685 | case AT_Reply_CMSError: | 738 | case AT_Reply_CMSError: |
686 | return ATGEN_HandleCMSError(s); | 739 | return ATGEN_HandleCMSError(s); |
740 | case AT_Reply_CMEError: | ||
741 | return ATGEN_HandleCMEError(s); | ||
687 | default: | 742 | default: |
688 | return ERR_UNKNOWNRESPONSE; | 743 | return ERR_UNKNOWNRESPONSE; |
689 | } | 744 | } |
690 | } | 745 | } |
691 | 746 | ||
692 | GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) | 747 | GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) |
693 | { | 748 | { |
694 | smprintf(s, "Getting available SMS memories\n"); | 749 | smprintf(s, "Getting available SMS memories\n"); |
695 | return GSM_WaitFor (s, "AT+CPMS=?\r", 10, 0x00, 4, ID_GetSMSMemories); | 750 | return GSM_WaitFor (s, "AT+CPMS=?\r", 10, 0x00, 4, ID_GetSMSMemories); |
696 | } | 751 | } |
697 | 752 | ||
698 | GSM_Error ATGEN_SetSMSMemory(GSM_StateMachine *s, bool SIM) | 753 | GSM_Error ATGEN_SetSMSMemory(GSM_StateMachine *s, bool SIM) |
699 | { | 754 | { |
700 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 755 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
701 | char req[] = "AT+CPMS=\"XX\",\"XX\"\r"; | 756 | char req[] = "AT+CPMS=\"XX\",\"XX\"\r"; |
702 | int reqlen = 18; | 757 | int reqlen = 18; |
703 | GSM_Error error; | 758 | GSM_Error error; |
704 | 759 | ||
705 | if ((SIM && Priv->SIMSMSMemory == 0) || (!SIM && Priv->PhoneSMSMemory == 0)) { | 760 | if ((SIM && Priv->SIMSMSMemory == 0) || (!SIM && Priv->PhoneSMSMemory == 0)) { |
706 | /* We silently ignore error here, because when this fails, we can try to setmemory anyway */ | 761 | /* We silently ignore error here, because when this fails, we can try to setmemory anyway */ |
707 | ATGEN_GetSMSMemories(s); | 762 | ATGEN_GetSMSMemories(s); |
708 | } | 763 | } |
709 | 764 | ||
710 | /* If phone can not save SMS, don't try to set memory for saving */ | 765 | /* If phone can not save SMS, don't try to set memory for saving */ |
@@ -837,140 +892,141 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
837 | unsigned char buffer[300],smsframe[800]; | 892 | unsigned char buffer[300],smsframe[800]; |
838 | unsigned char firstbyte, TPDCS, TPUDL, TPStatus; | 893 | unsigned char firstbyte, TPDCS, TPUDL, TPStatus; |
839 | GSM_Error error; | 894 | GSM_Error error; |
840 | 895 | ||
841 | switch (Priv->ReplyState) { | 896 | switch (Priv->ReplyState) { |
842 | case AT_Reply_OK: | 897 | case AT_Reply_OK: |
843 | if (Priv->Lines.numbers[4] == 0x00) return ERR_EMPTY; | 898 | if (Priv->Lines.numbers[4] == 0x00) return ERR_EMPTY; |
844 | s->Phone.Data.GetSMSMessage->Number = 1; | 899 | s->Phone.Data.GetSMSMessage->Number = 1; |
845 | s->Phone.Data.GetSMSMessage->SMS[0].Name[0] = 0; | 900 | s->Phone.Data.GetSMSMessage->SMS[0].Name[0] = 0; |
846 | s->Phone.Data.GetSMSMessage->SMS[0].Name[1]= 0; | 901 | s->Phone.Data.GetSMSMessage->SMS[0].Name[1]= 0; |
847 | switch (Priv->SMSMode) { | 902 | switch (Priv->SMSMode) { |
848 | case SMS_AT_PDU: | 903 | case SMS_AT_PDU: |
849 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 2); | 904 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 2); |
850 | switch (buffer[7]) { | 905 | switch (buffer[7]) { |
851 | case '0': sms->State = SMS_UnRead; break; | 906 | case '0': sms->State = SMS_UnRead; break; |
852 | case '1': sms->State = SMS_Read;break; | 907 | case '1': sms->State = SMS_Read;break; |
853 | case '2': sms->State = SMS_UnSent;break; | 908 | case '2': sms->State = SMS_UnSent;break; |
854 | default : sms->State = SMS_Sent;break;//case '3' | 909 | default : sms->State = SMS_Sent;break;//case '3' |
855 | } | 910 | } |
856 | DecodeHexBin (buffer, GetLineString(msg.Buffer,Priv->Lines,3), strlen(GetLineString(msg.Buffer,Priv->Lines,3))); | 911 | DecodeHexBin (buffer, GetLineString(msg.Buffer,Priv->Lines,3), strlen(GetLineString(msg.Buffer,Priv->Lines,3))); |
857 | /* Siemens MC35 (only ?) */ | 912 | /* Siemens MC35 (only ?) */ |
858 | if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY; | 913 | if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY; |
859 | /* Siemens M20 */ | 914 | /* Siemens M20 */ |
860 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 915 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
861 | if (buffer[1]!=NUMBER_UNKNOWN && buffer[1]!=NUMBER_INTERNATIONAL && | 916 | /* we check for the most often visible */ |
862 | buffer[1]!=NUMBER_ALPHANUMERIC) { | 917 | if (buffer[1]!=NUMBER_UNKNOWN_NUMBERING_PLAN_ISDN && buffer[1]!=NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN && |
918 | buffer[1]!=NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { | ||
863 | /* Seems to be Delivery Report */ | 919 | /* Seems to be Delivery Report */ |
864 | smprintf(s, "SMS type - status report (M20 style)\n"); | 920 | smprintf(s, "SMS type - status report (M20 style)\n"); |
865 | sms->PDU = SMS_Status_Report; | 921 | sms->PDU = SMS_Status_Report; |
866 | sms->Folder = 1;/*INBOX SIM*/ | 922 | sms->Folder = 1;/*INBOX SIM*/ |
867 | sms->InboxFolder = true; | 923 | sms->InboxFolder = true; |
868 | 924 | ||
869 | smsframe[12]=buffer[current++]; | 925 | smsframe[12]=buffer[current++]; |
870 | smsframe[PHONE_SMSStatusReport.TPMR]=buffer[current++]; | 926 | smsframe[PHONE_SMSStatusReport.TPMR]=buffer[current++]; |
871 | current2=((buffer[current])+1)/2+1; | 927 | current2=((buffer[current])+1)/2+1; |
872 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; | 928 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; |
873 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; | 929 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; |
874 | smsframe[0] = 0; | 930 | smsframe[0] = 0; |
875 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; | 931 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; |
876 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; | 932 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; |
877 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); | 933 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); |
878 | return ERR_NONE; | 934 | return ERR_NONE; |
879 | } | 935 | } |
880 | } | 936 | } |
881 | /* We use locations from SMS layouts like in ../phone2.c(h) */ | 937 | /* We use locations from SMS layouts like in ../phone2.c(h) */ |
882 | for(i=0;i<buffer[0]+1;i++) smsframe[i]=buffer[current++]; | 938 | for(i=0;i<buffer[0]+1;i++) smsframe[i]=buffer[current++]; |
883 | smsframe[12]=buffer[current++]; | 939 | smsframe[12]=buffer[current++]; |
884 | /* See GSM 03.40 section 9.2.3.1 */ | 940 | /* See GSM 03.40 section 9.2.3.1 */ |
885 | switch (smsframe[12] & 0x03) { | 941 | switch (smsframe[12] & 0x03) { |
886 | case 0x00: | 942 | case 0x00: |
887 | smprintf(s, "SMS type - deliver\n"); | 943 | smprintf(s, "SMS type - deliver\n"); |
888 | sms->PDU = SMS_Deliver; | 944 | sms->PDU = SMS_Deliver; |
889 | if (Priv->SMSMemory == MEM_SM) { | 945 | if (Priv->SMSMemory == MEM_SM) { |
890 | sms->Folder = 1; /*INBOX SIM*/ | 946 | sms->Folder = 1; /*INBOX SIM*/ |
891 | } else { | 947 | } else { |
892 | sms->Folder = 3; /*INBOX ME*/ | 948 | sms->Folder = 3; /*INBOX ME*/ |
893 | } | 949 | } |
894 | sms->InboxFolder = true; | 950 | sms->InboxFolder = true; |
895 | current2=((buffer[current])+1)/2+1; | 951 | current2=((buffer[current])+1)/2+1; |
896 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 952 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
897 | if (buffer[current+1]==NUMBER_ALPHANUMERIC) { | 953 | if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { |
898 | smprintf(s, "Trying to read alphanumeric number\n"); | 954 | smprintf(s, "Trying to read alphanumeric number\n"); |
899 | for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 955 | for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
900 | current+=6; | 956 | current+=6; |
901 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSDeliver.Number+i+4]=buffer[current++]; | 957 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSDeliver.Number+i+4]=buffer[current++]; |
902 | } else { | 958 | } else { |
903 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 959 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
904 | } | 960 | } |
905 | } else { | 961 | } else { |
906 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 962 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
907 | } | 963 | } |
908 | smsframe[PHONE_SMSDeliver.TPPID] = buffer[current++]; | 964 | smsframe[PHONE_SMSDeliver.TPPID] = buffer[current++]; |
909 | smsframe[PHONE_SMSDeliver.TPDCS] = buffer[current++]; | 965 | smsframe[PHONE_SMSDeliver.TPDCS] = buffer[current++]; |
910 | for(i=0;i<7;i++) smsframe[PHONE_SMSDeliver.DateTime+i]=buffer[current++]; | 966 | for(i=0;i<7;i++) smsframe[PHONE_SMSDeliver.DateTime+i]=buffer[current++]; |
911 | smsframe[PHONE_SMSDeliver.TPUDL] = buffer[current++]; | 967 | smsframe[PHONE_SMSDeliver.TPUDL] = buffer[current++]; |
912 | for(i=0;i<smsframe[PHONE_SMSDeliver.TPUDL];i++) smsframe[i+PHONE_SMSDeliver.Text]=buffer[current++]; | 968 | for(i=0;i<smsframe[PHONE_SMSDeliver.TPUDL];i++) smsframe[i+PHONE_SMSDeliver.Text]=buffer[current++]; |
913 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSDeliver); | 969 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSDeliver); |
914 | return ERR_NONE; | 970 | return ERR_NONE; |
915 | case 0x01: | 971 | case 0x01: |
916 | smprintf(s, "SMS type - submit\n"); | 972 | smprintf(s, "SMS type - submit\n"); |
917 | sms->PDU = SMS_Submit; | 973 | sms->PDU = SMS_Submit; |
918 | if (Priv->SMSMemory == MEM_SM) { | 974 | if (Priv->SMSMemory == MEM_SM) { |
919 | sms->Folder = 2; /*OUTBOX SIM*/ | 975 | sms->Folder = 2; /*OUTBOX SIM*/ |
920 | smprintf(s, "Outbox SIM\n"); | 976 | smprintf(s, "Outbox SIM\n"); |
921 | } else { | 977 | } else { |
922 | sms->Folder = 4; /*OUTBOX ME*/ | 978 | sms->Folder = 4; /*OUTBOX ME*/ |
923 | } | 979 | } |
924 | sms->InboxFolder = false; | 980 | sms->InboxFolder = false; |
925 | smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++]; | 981 | smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++]; |
926 | current2=((buffer[current])+1)/2+1; | 982 | current2=((buffer[current])+1)/2+1; |
927 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 983 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
928 | if (buffer[current+1]==NUMBER_ALPHANUMERIC) { | 984 | if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { |
929 | smprintf(s, "Trying to read alphanumeric number\n"); | 985 | smprintf(s, "Trying to read alphanumeric number\n"); |
930 | for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 986 | for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
931 | current+=6; | 987 | current+=6; |
932 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSSubmit.Number+i+4]=buffer[current++]; | 988 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSSubmit.Number+i+4]=buffer[current++]; |
933 | } else { | 989 | } else { |
934 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 990 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
935 | } | 991 | } |
936 | } else { | 992 | } else { |
937 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 993 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
938 | } | 994 | } |
939 | smsframe[PHONE_SMSSubmit.TPPID] = buffer[current++]; | 995 | smsframe[PHONE_SMSSubmit.TPPID] = buffer[current++]; |
940 | smsframe[PHONE_SMSSubmit.TPDCS] = buffer[current++]; | 996 | smsframe[PHONE_SMSSubmit.TPDCS] = buffer[current++]; |
941 | /* See GSM 03.40 9.2.3.3 - TPVP can not exist in frame */ | 997 | /* See GSM 03.40 9.2.3.3 - TPVP can not exist in frame */ |
942 | if ((smsframe[12] & 0x18)!=0) current++; //TPVP is ignored now | 998 | if ((smsframe[12] & 0x18)!=0) current++; //TPVP is ignored now |
943 | smsframe[PHONE_SMSSubmit.TPUDL] = buffer[current++]; | 999 | smsframe[PHONE_SMSSubmit.TPUDL] = buffer[current++]; |
944 | for(i=0;i<smsframe[PHONE_SMSSubmit.TPUDL];i++) smsframe[i+PHONE_SMSSubmit.Text]=buffer[current++]; | 1000 | for(i=0;i<smsframe[PHONE_SMSSubmit.TPUDL];i++) smsframe[i+PHONE_SMSSubmit.Text]=buffer[current++]; |
945 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSSubmit); | 1001 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSSubmit); |
946 | return ERR_NONE; | 1002 | return ERR_NONE; |
947 | case 0x02: | 1003 | case 0x02: |
948 | smprintf(s, "SMS type - status report\n"); | 1004 | smprintf(s, "SMS type - status report\n"); |
949 | sms->PDU = SMS_Status_Report; | 1005 | sms->PDU = SMS_Status_Report; |
950 | sms->Folder = 1;/*INBOX SIM*/ | 1006 | sms->Folder = 1;/*INBOX SIM*/ |
951 | sms->InboxFolder = true; | 1007 | sms->InboxFolder = true; |
952 | smprintf(s, "TPMR is %02x\n",buffer[current]); | 1008 | smprintf(s, "TPMR is %d\n",buffer[current]); |
953 | smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++]; | 1009 | smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++]; |
954 | current2=((buffer[current])+1)/2+1; | 1010 | current2=((buffer[current])+1)/2+1; |
955 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; | 1011 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; |
956 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; | 1012 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; |
957 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; | 1013 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; |
958 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; | 1014 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; |
959 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); | 1015 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); |
960 | return ERR_NONE; | 1016 | return ERR_NONE; |
961 | } | 1017 | } |
962 | break; | 1018 | break; |
963 | case SMS_AT_TXT: | 1019 | case SMS_AT_TXT: |
964 | current = 0; | 1020 | current = 0; |
965 | while (msg.Buffer[current]!='"') current++; | 1021 | while (msg.Buffer[current]!='"') current++; |
966 | current+=ATGEN_ExtractOneParameter(msg.Buffer+current, buffer); | 1022 | current+=ATGEN_ExtractOneParameter(msg.Buffer+current, buffer); |
967 | if (!strcmp(buffer,"\"0\"") || !strcmp(buffer,"\"REC UNREAD\"")) { | 1023 | if (!strcmp(buffer,"\"0\"") || !strcmp(buffer,"\"REC UNREAD\"")) { |
968 | smprintf(s, "SMS type - deliver\n"); | 1024 | smprintf(s, "SMS type - deliver\n"); |
969 | sms->State = SMS_UnRead; | 1025 | sms->State = SMS_UnRead; |
970 | sms->PDU = SMS_Deliver; | 1026 | sms->PDU = SMS_Deliver; |
971 | if (Priv->SMSMemory == MEM_SM) { | 1027 | if (Priv->SMSMemory == MEM_SM) { |
972 | sms->Folder = 1; /*INBOX SIM*/ | 1028 | sms->Folder = 1; /*INBOX SIM*/ |
973 | } else { | 1029 | } else { |
974 | sms->Folder = 3; /*INBOX ME*/ | 1030 | sms->Folder = 3; /*INBOX ME*/ |
975 | } | 1031 | } |
976 | sms->InboxFolder = true; | 1032 | sms->InboxFolder = true; |
@@ -1619,59 +1675,59 @@ GSM_Error ATGEN_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) | |||
1619 | return error; | 1675 | return error; |
1620 | } | 1676 | } |
1621 | } | 1677 | } |
1622 | 1678 | ||
1623 | return Phone->DispatchError; | 1679 | return Phone->DispatchError; |
1624 | } | 1680 | } |
1625 | 1681 | ||
1626 | GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1682 | GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1627 | { | 1683 | { |
1628 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 1684 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
1629 | char *start; | 1685 | char *start; |
1630 | 1686 | ||
1631 | if (s->Protocol.Data.AT.EditMode) { | 1687 | if (s->Protocol.Data.AT.EditMode) { |
1632 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_SMSEdit) { | 1688 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_SMSEdit) { |
1633 | return ERR_UNKNOWN; | 1689 | return ERR_UNKNOWN; |
1634 | } | 1690 | } |
1635 | s->Protocol.Data.AT.EditMode = false; | 1691 | s->Protocol.Data.AT.EditMode = false; |
1636 | return ERR_NONE; | 1692 | return ERR_NONE; |
1637 | } | 1693 | } |
1638 | 1694 | ||
1639 | switch (Priv->ReplyState) { | 1695 | switch (Priv->ReplyState) { |
1640 | case AT_Reply_OK: | 1696 | case AT_Reply_OK: |
1641 | smprintf(s, "SMS sent OK\n"); | 1697 | smprintf(s, "SMS sent OK\n"); |
1642 | if (s->User.SendSMSStatus!=NULL) { | 1698 | if (s->User.SendSMSStatus!=NULL) { |
1643 | start = strstr(msg.Buffer, "+CMGW: "); | 1699 | start = strstr(msg.Buffer, "+CMGS: "); |
1644 | if (start != NULL) { | 1700 | if (start != NULL) { |
1645 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7)); | 1701 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7)); |
1646 | } else { | 1702 | } else { |
1647 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,0); | 1703 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,-1); |
1648 | } | 1704 | } |
1649 | } | 1705 | } |
1650 | return ERR_NONE; | 1706 | return ERR_NONE; |
1651 | case AT_Reply_CMSError: | 1707 | case AT_Reply_CMSError: |
1652 | smprintf(s, "Error %i\n",Priv->ErrorCode); | 1708 | smprintf(s, "Error %i\n",Priv->ErrorCode); |
1653 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,0); | 1709 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,-1); |
1654 | return ATGEN_HandleCMSError(s); | 1710 | return ATGEN_HandleCMSError(s); |
1655 | case AT_Reply_Error: | 1711 | case AT_Reply_Error: |
1656 | return ERR_UNKNOWN; | 1712 | return ERR_UNKNOWN; |
1657 | default: | 1713 | default: |
1658 | return ERR_UNKNOWNRESPONSE; | 1714 | return ERR_UNKNOWNRESPONSE; |
1659 | } | 1715 | } |
1660 | } | 1716 | } |
1661 | 1717 | ||
1662 | GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) | 1718 | GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) |
1663 | { | 1719 | { |
1664 | GSM_Error error,error2; | 1720 | GSM_Error error,error2; |
1665 | int current, current2, Replies; | 1721 | int current, current2, Replies; |
1666 | unsigned char buffer[1000], hexreq[1000]; | 1722 | unsigned char buffer[1000], hexreq[1000]; |
1667 | GSM_Phone_Data *Phone = &s->Phone.Data; | 1723 | GSM_Phone_Data *Phone = &s->Phone.Data; |
1668 | 1724 | ||
1669 | if (sms->PDU == SMS_Deliver) sms->PDU = SMS_Submit; | 1725 | if (sms->PDU == SMS_Deliver) sms->PDU = SMS_Submit; |
1670 | 1726 | ||
1671 | error = ATGEN_MakeSMSFrame(s, sms, hexreq, ¤t, ¤t2); | 1727 | error = ATGEN_MakeSMSFrame(s, sms, hexreq, ¤t, ¤t2); |
1672 | if (error != ERR_NONE) return error; | 1728 | if (error != ERR_NONE) return error; |
1673 | 1729 | ||
1674 | switch (Phone->Priv.ATGEN.SMSMode) { | 1730 | switch (Phone->Priv.ATGEN.SMSMode) { |
1675 | case SMS_AT_PDU: | 1731 | case SMS_AT_PDU: |
1676 | sprintf(buffer, "AT+CMGS=%i\r",current); | 1732 | sprintf(buffer, "AT+CMGS=%i\r",current); |
1677 | break; | 1733 | break; |
@@ -1766,48 +1822,61 @@ GSM_Error ATGEN_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time) | |||
1766 | GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time) | 1822 | GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time) |
1767 | { | 1823 | { |
1768 | char req[128]; | 1824 | char req[128]; |
1769 | 1825 | ||
1770 | sprintf(req, "AT+CCLK=\"%02i/%02i/%02i,%02i:%02i:%02i+00\"\r", | 1826 | sprintf(req, "AT+CCLK=\"%02i/%02i/%02i,%02i:%02i:%02i+00\"\r", |
1771 | date_time->Year-2000,date_time->Month,date_time->Day, | 1827 | date_time->Year-2000,date_time->Month,date_time->Day, |
1772 | date_time->Hour,date_time->Minute,date_time->Second); | 1828 | date_time->Hour,date_time->Minute,date_time->Second); |
1773 | 1829 | ||
1774 | smprintf(s, "Setting date & time\n"); | 1830 | smprintf(s, "Setting date & time\n"); |
1775 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetDateTime); | 1831 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetDateTime); |
1776 | } | 1832 | } |
1777 | 1833 | ||
1778 | GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | 1834 | GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) |
1779 | { | 1835 | { |
1780 | if (alarm->Location != 1) return ERR_NOTSUPPORTED; | 1836 | if (alarm->Location != 1) return ERR_NOTSUPPORTED; |
1781 | 1837 | ||
1782 | alarm->Repeating = true; | 1838 | alarm->Repeating = true; |
1783 | alarm->Text[0] = 0; alarm->Text[1] = 0; | 1839 | alarm->Text[0] = 0; alarm->Text[1] = 0; |
1784 | 1840 | ||
1785 | s->Phone.Data.Alarm = alarm; | 1841 | s->Phone.Data.Alarm = alarm; |
1786 | smprintf(s, "Getting alarm\n"); | 1842 | smprintf(s, "Getting alarm\n"); |
1787 | return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm); | 1843 | return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm); |
1788 | } | 1844 | } |
1789 | 1845 | ||
1846 | /* R320 only takes HH:MM. Do other phones understand full date? */ | ||
1847 | GSM_Error ATGEN_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | ||
1848 | { | ||
1849 | char req[20]; | ||
1850 | |||
1851 | if (alarm->Location != 1) return ERR_INVALIDLOCATION; | ||
1852 | |||
1853 | sprintf(req, "AT+CALA=\"%02i:%02i\"\r",alarm->DateTime.Hour,alarm->DateTime.Minute); | ||
1854 | |||
1855 | smprintf(s, "Setting Alarm\n"); | ||
1856 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetAlarm); | ||
1857 | } | ||
1858 | |||
1790 | GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1859 | GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1791 | { | 1860 | { |
1792 | GSM_SMSC *SMSC = s->Phone.Data.SMSC; | 1861 | GSM_SMSC *SMSC = s->Phone.Data.SMSC; |
1793 | int current; | 1862 | int current; |
1794 | int len; | 1863 | int len; |
1795 | unsigned char buffer[100]; | 1864 | unsigned char buffer[100]; |
1796 | 1865 | ||
1797 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 1866 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
1798 | case AT_Reply_OK: | 1867 | case AT_Reply_OK: |
1799 | smprintf(s, "SMSC info received\n"); | 1868 | smprintf(s, "SMSC info received\n"); |
1800 | 1869 | ||
1801 | current = 0; | 1870 | current = 0; |
1802 | while (msg.Buffer[current]!='"') current++; | 1871 | while (msg.Buffer[current]!='"') current++; |
1803 | 1872 | ||
1804 | /* SMSC number */ | 1873 | /* SMSC number */ |
1805 | /* FIXME: support for all formats */ | 1874 | /* FIXME: support for all formats */ |
1806 | current+=ATGEN_ExtractOneParameter(msg.Buffer+current, buffer); | 1875 | current+=ATGEN_ExtractOneParameter(msg.Buffer+current, buffer); |
1807 | /* | 1876 | /* |
1808 | * Some phones return this as unicode encoded when they are | 1877 | * Some phones return this as unicode encoded when they are |
1809 | * switched to UCS2 mode, so we try to solve this correctly. | 1878 | * switched to UCS2 mode, so we try to solve this correctly. |
1810 | */ | 1879 | */ |
1811 | len = strlen(buffer + 1) - 1; | 1880 | len = strlen(buffer + 1) - 1; |
1812 | buffer[len + 1] = 0; | 1881 | buffer[len + 1] = 0; |
1813 | if ((len > 20) && (len % 4 == 0) && (strchr(buffer + 1, '+') == NULL)) { | 1882 | if ((len > 20) && (len % 4 == 0) && (strchr(buffer + 1, '+') == NULL)) { |
@@ -2181,48 +2250,50 @@ GSM_Error ATGEN_ReplyGetCPBRMemoryStatus(GSM_Protocol_Message msg, GSM_StateMach | |||
2181 | case AT_Reply_Error: | 2250 | case AT_Reply_Error: |
2182 | return ERR_UNKNOWN; | 2251 | return ERR_UNKNOWN; |
2183 | case AT_Reply_CMSError: | 2252 | case AT_Reply_CMSError: |
2184 | return ATGEN_HandleCMSError(s); | 2253 | return ATGEN_HandleCMSError(s); |
2185 | default: | 2254 | default: |
2186 | return ERR_UNKNOWNRESPONSE; | 2255 | return ERR_UNKNOWNRESPONSE; |
2187 | } | 2256 | } |
2188 | } | 2257 | } |
2189 | 2258 | ||
2190 | GSM_Error ATGEN_GetMemoryInfo(GSM_StateMachine *s, GSM_MemoryStatus *Status, GSM_AT_NeededMemoryInfo NeededInfo) | 2259 | GSM_Error ATGEN_GetMemoryInfo(GSM_StateMachine *s, GSM_MemoryStatus *Status, GSM_AT_NeededMemoryInfo NeededInfo) |
2191 | { | 2260 | { |
2192 | GSM_Error error; | 2261 | GSM_Error error; |
2193 | char req[20]; | 2262 | char req[20]; |
2194 | int start; | 2263 | int start; |
2195 | int end; | 2264 | int end; |
2196 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 2265 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
2197 | 2266 | ||
2198 | smprintf(s, "Getting memory information\n"); | 2267 | smprintf(s, "Getting memory information\n"); |
2199 | 2268 | ||
2200 | Priv->MemorySize = 0; | 2269 | Priv->MemorySize = 0; |
2201 | Priv->TextLength = 0; | 2270 | Priv->TextLength = 0; |
2202 | Priv->NumberLength = 0; | 2271 | Priv->NumberLength = 0; |
2203 | 2272 | ||
2204 | error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus); | 2273 | error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus); |
2274 | if (Priv->Manufacturer == AT_Samsung) | ||
2275 | error = GSM_WaitFor (s, "", 0, 0x00, 4, ID_GetMemoryStatus); | ||
2205 | if (error != ERR_NONE) return error; | 2276 | if (error != ERR_NONE) return error; |
2206 | if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE; | 2277 | if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE; |
2207 | 2278 | ||
2208 | smprintf(s, "Getting memory status by reading values\n"); | 2279 | smprintf(s, "Getting memory status by reading values\n"); |
2209 | 2280 | ||
2210 | s->Phone.Data.MemoryStatus= Status; | 2281 | s->Phone.Data.MemoryStatus= Status; |
2211 | Status->MemoryUsed = 0; | 2282 | Status->MemoryUsed = 0; |
2212 | Status->MemoryFree = 0; | 2283 | Status->MemoryFree = 0; |
2213 | start = Priv->FirstMemoryEntry; | 2284 | start = Priv->FirstMemoryEntry; |
2214 | Priv->NextMemoryEntry = 0; | 2285 | Priv->NextMemoryEntry = 0; |
2215 | while (1) { | 2286 | while (1) { |
2216 | end= start + 20; | 2287 | end= start + 20; |
2217 | if (end > Priv->MemorySize) end = Priv->MemorySize; | 2288 | if (end > Priv->MemorySize) end = Priv->MemorySize; |
2218 | sprintf(req, "AT+CPBR=%i,%i\r", start, end); | 2289 | sprintf(req, "AT+CPBR=%i,%i\r", start, end); |
2219 | error= GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetMemoryStatus); | 2290 | error= GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetMemoryStatus); |
2220 | if (error != ERR_NONE) return error; | 2291 | if (error != ERR_NONE) return error; |
2221 | if (NeededInfo == AT_NextEmpty && Priv->NextMemoryEntry != 0 && Priv->NextMemoryEntry != end + 1) return ERR_NONE; | 2292 | if (NeededInfo == AT_NextEmpty && Priv->NextMemoryEntry != 0 && Priv->NextMemoryEntry != end + 1) return ERR_NONE; |
2222 | if (end == Priv->MemorySize) { | 2293 | if (end == Priv->MemorySize) { |
2223 | Status->MemoryFree = Priv->MemorySize - Status->MemoryUsed; | 2294 | Status->MemoryFree = Priv->MemorySize - Status->MemoryUsed; |
2224 | return ERR_NONE; | 2295 | return ERR_NONE; |
2225 | } | 2296 | } |
2226 | start = end + 1; | 2297 | start = end + 1; |
2227 | } | 2298 | } |
2228 | } | 2299 | } |
@@ -2247,48 +2318,54 @@ GSM_Error ATGEN_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status) | |||
2247 | } | 2318 | } |
2248 | 2319 | ||
2249 | return ATGEN_GetMemoryInfo(s, Status, AT_Status); | 2320 | return ATGEN_GetMemoryInfo(s, Status, AT_Status); |
2250 | } | 2321 | } |
2251 | 2322 | ||
2252 | GSM_Error ATGEN_SetPBKCharset(GSM_StateMachine *s, bool PreferUnicode) | 2323 | GSM_Error ATGEN_SetPBKCharset(GSM_StateMachine *s, bool PreferUnicode) |
2253 | { | 2324 | { |
2254 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 2325 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
2255 | GSM_Error error; | 2326 | GSM_Error error; |
2256 | 2327 | ||
2257 | /* Have we already selected something? */ | 2328 | /* Have we already selected something? */ |
2258 | if (Priv->PBKCharset!=0) { | 2329 | if (Priv->PBKCharset!=0) { |
2259 | /* If we want unicode charset and we have it already or setting of it | 2330 | /* If we want unicode charset and we have it already or setting of it |
2260 | * failed, we have nothing to do. */ | 2331 | * failed, we have nothing to do. */ |
2261 | if (PreferUnicode && (Priv->PBKCharset==AT_PBK_UCS2 || Priv->UCS2CharsetFailed)) return ERR_NONE; | 2332 | if (PreferUnicode && (Priv->PBKCharset==AT_PBK_UCS2 || Priv->UCS2CharsetFailed)) return ERR_NONE; |
2262 | 2333 | ||
2263 | /* If we don't need unicode charset and we have some (or have unicode | 2334 | /* If we don't need unicode charset and we have some (or have unicode |
2264 | * charset when other failed), we have nothing to do. */ | 2335 | * charset when other failed), we have nothing to do. */ |
2265 | if (!PreferUnicode && (Priv->PBKCharset!=AT_PBK_UCS2 || Priv->NonUCS2CharsetFailed)) return ERR_NONE; | 2336 | if (!PreferUnicode && (Priv->PBKCharset!=AT_PBK_UCS2 || Priv->NonUCS2CharsetFailed)) return ERR_NONE; |
2266 | } | 2337 | } |
2267 | 2338 | ||
2268 | error=ATGEN_GetManufacturer(s); | 2339 | error=ATGEN_GetManufacturer(s); |
2269 | if (error != ERR_NONE) return error; | 2340 | if (error != ERR_NONE) return error; |
2270 | 2341 | ||
2342 | /* Samsung (and Sagem?) phones use only PCCP437? */ | ||
2343 | if (Priv->Manufacturer == AT_Samsung) { | ||
2344 | Priv->PBKCharset = AT_PBK_PCCP437; | ||
2345 | return ERR_NONE; | ||
2346 | } | ||
2347 | |||
2271 | if (PreferUnicode && !Priv->UCS2CharsetFailed) { | 2348 | if (PreferUnicode && !Priv->UCS2CharsetFailed) { |
2272 | smprintf(s, "Setting charset to UCS2\n"); | 2349 | smprintf(s, "Setting charset to UCS2\n"); |
2273 | error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset); | 2350 | error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset); |
2274 | if (error == ERR_NONE) { | 2351 | if (error == ERR_NONE) { |
2275 | Priv->PBKCharset = AT_PBK_UCS2; | 2352 | Priv->PBKCharset = AT_PBK_UCS2; |
2276 | return ERR_NONE; | 2353 | return ERR_NONE; |
2277 | } else { | 2354 | } else { |
2278 | Priv->UCS2CharsetFailed = true; | 2355 | Priv->UCS2CharsetFailed = true; |
2279 | } | 2356 | } |
2280 | } | 2357 | } |
2281 | 2358 | ||
2282 | smprintf(s, "Setting charset to HEX\n"); | 2359 | smprintf(s, "Setting charset to HEX\n"); |
2283 | error=GSM_WaitFor (s, "AT+CSCS=\"HEX\"\r", 14, 0x00, 3, ID_SetMemoryCharset); | 2360 | error=GSM_WaitFor (s, "AT+CSCS=\"HEX\"\r", 14, 0x00, 3, ID_SetMemoryCharset); |
2284 | /* Falcom replies OK for HEX mode and send everything | 2361 | /* Falcom replies OK for HEX mode and send everything |
2285 | * in normal format */ | 2362 | * in normal format */ |
2286 | if (error == ERR_NONE && Priv->Manufacturer != AT_Falcom) { | 2363 | if (error == ERR_NONE && Priv->Manufacturer != AT_Falcom) { |
2287 | Priv->PBKCharset = AT_PBK_HEX; | 2364 | Priv->PBKCharset = AT_PBK_HEX; |
2288 | return ERR_NONE; | 2365 | return ERR_NONE; |
2289 | } | 2366 | } |
2290 | 2367 | ||
2291 | smprintf(s, "Setting charset to GSM\n"); | 2368 | smprintf(s, "Setting charset to GSM\n"); |
2292 | error=GSM_WaitFor (s, "AT+CSCS=\"GSM\"\r", 14, 0x00, 3, ID_SetMemoryCharset); | 2369 | error=GSM_WaitFor (s, "AT+CSCS=\"GSM\"\r", 14, 0x00, 3, ID_SetMemoryCharset); |
2293 | if (error == ERR_NONE) { | 2370 | if (error == ERR_NONE) { |
2294 | Priv->PBKCharset = AT_PBK_GSM; | 2371 | Priv->PBKCharset = AT_PBK_GSM; |
@@ -2364,49 +2441,79 @@ GSM_Error ATGEN_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
2364 | if (strlen(buffer+1)!=0 && buffer[1] != '+') { | 2441 | if (strlen(buffer+1)!=0 && buffer[1] != '+') { |
2365 | /* Sony Ericsson issue */ | 2442 | /* Sony Ericsson issue */ |
2366 | /* International number is without + */ | 2443 | /* International number is without + */ |
2367 | buffer[0] = '+'; | 2444 | buffer[0] = '+'; |
2368 | EncodeUnicode(Memory->Entries[0].Text,buffer,strlen(buffer)); | 2445 | EncodeUnicode(Memory->Entries[0].Text,buffer,strlen(buffer)); |
2369 | } | 2446 | } |
2370 | } | 2447 | } |
2371 | 2448 | ||
2372 | /* Name */ | 2449 | /* Name */ |
2373 | pos += ATGEN_ExtractOneParameter(pos, buffer); | 2450 | pos += ATGEN_ExtractOneParameter(pos, buffer); |
2374 | smprintf(s, "Name text: %s\n",buffer); | 2451 | smprintf(s, "Name text: %s\n",buffer); |
2375 | Memory->EntriesNum++; | 2452 | Memory->EntriesNum++; |
2376 | Memory->Entries[1].EntryType=PBK_Text_Name; | 2453 | Memory->Entries[1].EntryType=PBK_Text_Name; |
2377 | switch (Priv->PBKCharset) { | 2454 | switch (Priv->PBKCharset) { |
2378 | case AT_PBK_HEX: | 2455 | case AT_PBK_HEX: |
2379 | DecodeHexBin(buffer2,buffer+1,strlen(buffer)-2); | 2456 | DecodeHexBin(buffer2,buffer+1,strlen(buffer)-2); |
2380 | DecodeDefault(Memory->Entries[1].Text,buffer2,strlen(buffer2),false,NULL); | 2457 | DecodeDefault(Memory->Entries[1].Text,buffer2,strlen(buffer2),false,NULL); |
2381 | break; | 2458 | break; |
2382 | case AT_PBK_GSM: | 2459 | case AT_PBK_GSM: |
2383 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); | 2460 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); |
2384 | break; | 2461 | break; |
2385 | case AT_PBK_UCS2: | 2462 | case AT_PBK_UCS2: |
2386 | DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1); | 2463 | DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1); |
2387 | break; | 2464 | break; |
2465 | case AT_PBK_PCCP437: | ||
2466 | /* FIXME: correctly decode PCCP437 */ | ||
2467 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); | ||
2468 | break; | ||
2469 | } | ||
2470 | |||
2471 | /* Samsung number type */ | ||
2472 | if (Priv->Manufacturer == AT_Samsung) { | ||
2473 | int type; | ||
2474 | |||
2475 | pos += ATGEN_ExtractOneParameter(pos, buffer); | ||
2476 | smprintf(s, "Number type: %s\n",buffer); | ||
2477 | type = strtoul(buffer, NULL, 0); | ||
2478 | switch (type) { | ||
2479 | case 0: | ||
2480 | Memory->Entries[0].EntryType = PBK_Number_Mobile; | ||
2481 | break; | ||
2482 | case 1: | ||
2483 | Memory->Entries[0].EntryType = PBK_Number_Work; | ||
2484 | break; | ||
2485 | case 2: | ||
2486 | Memory->Entries[0].EntryType = PBK_Number_Home; | ||
2487 | break; | ||
2488 | case 3: | ||
2489 | Memory->Entries[0].EntryType = PBK_Text_Email; | ||
2490 | break; | ||
2491 | default: | ||
2492 | Memory->Entries[0].EntryType = PBK_Number_General; | ||
2493 | } | ||
2388 | } | 2494 | } |
2495 | |||
2389 | return ERR_NONE; | 2496 | return ERR_NONE; |
2390 | case AT_Reply_CMEError: | 2497 | case AT_Reply_CMEError: |
2391 | return ATGEN_HandleCMEError(s); | 2498 | return ATGEN_HandleCMEError(s); |
2392 | case AT_Reply_Error: | 2499 | case AT_Reply_Error: |
2393 | smprintf(s, "Error - too high location ?\n"); | 2500 | smprintf(s, "Error - too high location ?\n"); |
2394 | return ERR_INVALIDLOCATION; | 2501 | return ERR_INVALIDLOCATION; |
2395 | case AT_Reply_CMSError: | 2502 | case AT_Reply_CMSError: |
2396 | return ATGEN_HandleCMSError(s); | 2503 | return ATGEN_HandleCMSError(s); |
2397 | default: | 2504 | default: |
2398 | break; | 2505 | break; |
2399 | } | 2506 | } |
2400 | return ERR_UNKNOWNRESPONSE; | 2507 | return ERR_UNKNOWNRESPONSE; |
2401 | } | 2508 | } |
2402 | 2509 | ||
2403 | GSM_Error ATGEN_PrivGetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, int endlocation) | 2510 | GSM_Error ATGEN_PrivGetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, int endlocation) |
2404 | { | 2511 | { |
2405 | GSM_Error error; | 2512 | GSM_Error error; |
2406 | unsigned char req[20]; | 2513 | unsigned char req[20]; |
2407 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 2514 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
2408 | 2515 | ||
2409 | if (entry->Location==0x00) return ERR_INVALIDLOCATION; | 2516 | if (entry->Location==0x00) return ERR_INVALIDLOCATION; |
2410 | 2517 | ||
2411 | if (entry->MemoryType == MEM_ME) { | 2518 | if (entry->MemoryType == MEM_ME) { |
2412 | if (Priv->PBKSBNR == 0) { | 2519 | if (Priv->PBKSBNR == 0) { |
@@ -2541,48 +2648,50 @@ GSM_Error ATGEN_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber | |||
2541 | { | 2648 | { |
2542 | char req[39] = "ATDT"; | 2649 | char req[39] = "ATDT"; |
2543 | 2650 | ||
2544 | if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED; | 2651 | if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED; |
2545 | if (strlen(number) > 32) return (ERR_UNKNOWN); | 2652 | if (strlen(number) > 32) return (ERR_UNKNOWN); |
2546 | 2653 | ||
2547 | strcat(req, number); | 2654 | strcat(req, number); |
2548 | strcat(req, ";\r"); | 2655 | strcat(req, ";\r"); |
2549 | 2656 | ||
2550 | smprintf(s, "Making voice call\n"); | 2657 | smprintf(s, "Making voice call\n"); |
2551 | return GSM_WaitFor (s, req, 4+2+strlen(number), 0x00, 5, ID_DialVoice); | 2658 | return GSM_WaitFor (s, req, 4+2+strlen(number), 0x00, 5, ID_DialVoice); |
2552 | } | 2659 | } |
2553 | 2660 | ||
2554 | GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2661 | GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2555 | { | 2662 | { |
2556 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 2663 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
2557 | case AT_Reply_OK: | 2664 | case AT_Reply_OK: |
2558 | smprintf(s, "Security code was OK\n"); | 2665 | smprintf(s, "Security code was OK\n"); |
2559 | return ERR_NONE; | 2666 | return ERR_NONE; |
2560 | case AT_Reply_Error: | 2667 | case AT_Reply_Error: |
2561 | smprintf(s, "Incorrect security code\n"); | 2668 | smprintf(s, "Incorrect security code\n"); |
2562 | return ERR_SECURITYERROR; | 2669 | return ERR_SECURITYERROR; |
2563 | case AT_Reply_CMSError: | 2670 | case AT_Reply_CMSError: |
2564 | return ATGEN_HandleCMSError(s); | 2671 | return ATGEN_HandleCMSError(s); |
2672 | case AT_Reply_CMEError: | ||
2673 | return ATGEN_HandleCMEError(s); | ||
2565 | default: | 2674 | default: |
2566 | break; | 2675 | break; |
2567 | } | 2676 | } |
2568 | return ERR_UNKNOWNRESPONSE; | 2677 | return ERR_UNKNOWNRESPONSE; |
2569 | } | 2678 | } |
2570 | 2679 | ||
2571 | GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code) | 2680 | GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code) |
2572 | { | 2681 | { |
2573 | unsigned char req[50]; | 2682 | unsigned char req[50]; |
2574 | 2683 | ||
2575 | switch (Code.Type) { | 2684 | switch (Code.Type) { |
2576 | case SEC_Pin : | 2685 | case SEC_Pin : |
2577 | sprintf(req, "AT+CPIN=\"%s\"\r" , Code.Code); | 2686 | sprintf(req, "AT+CPIN=\"%s\"\r" , Code.Code); |
2578 | break; | 2687 | break; |
2579 | case SEC_Pin2 : | 2688 | case SEC_Pin2 : |
2580 | if (s->Phone.Data.Priv.ATGEN.Manufacturer == AT_Siemens) { | 2689 | if (s->Phone.Data.Priv.ATGEN.Manufacturer == AT_Siemens) { |
2581 | sprintf(req, "AT+CPIN2=\"%s\"\r", Code.Code); | 2690 | sprintf(req, "AT+CPIN2=\"%s\"\r", Code.Code); |
2582 | } else { | 2691 | } else { |
2583 | sprintf(req, "AT+CPIN=\"%s\"\r" , Code.Code); | 2692 | sprintf(req, "AT+CPIN=\"%s\"\r" , Code.Code); |
2584 | } | 2693 | } |
2585 | break; | 2694 | break; |
2586 | default : return ERR_NOTIMPLEMENTED; | 2695 | default : return ERR_NOTIMPLEMENTED; |
2587 | } | 2696 | } |
2588 | 2697 | ||
@@ -2903,48 +3012,54 @@ GSM_Error ATGEN_PrivSetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) | |||
2903 | if ((Priv->TextLength != 0) && ((Priv->TextLength * 7 / 16) <= len)) { | 3012 | if ((Priv->TextLength != 0) && ((Priv->TextLength * 7 / 16) <= len)) { |
2904 | PreferUnicode = false; | 3013 | PreferUnicode = false; |
2905 | } else { | 3014 | } else { |
2906 | PreferUnicode = true; | 3015 | PreferUnicode = true; |
2907 | } | 3016 | } |
2908 | } | 3017 | } |
2909 | 3018 | ||
2910 | error = ATGEN_SetPBKCharset(s, PreferUnicode); | 3019 | error = ATGEN_SetPBKCharset(s, PreferUnicode); |
2911 | if (error != ERR_NONE) return error; | 3020 | if (error != ERR_NONE) return error; |
2912 | 3021 | ||
2913 | switch (Priv->PBKCharset) { | 3022 | switch (Priv->PBKCharset) { |
2914 | case AT_PBK_HEX: | 3023 | case AT_PBK_HEX: |
2915 | EncodeHexBin(name, DecodeUnicodeString(entry->Entries[Name].Text), UnicodeLength(entry->Entries[Name].Text)); | 3024 | EncodeHexBin(name, DecodeUnicodeString(entry->Entries[Name].Text), UnicodeLength(entry->Entries[Name].Text)); |
2916 | len = strlen(name); | 3025 | len = strlen(name); |
2917 | break; | 3026 | break; |
2918 | case AT_PBK_GSM: | 3027 | case AT_PBK_GSM: |
2919 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); | 3028 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); |
2920 | len = UnicodeLength(entry->Entries[Name].Text); | 3029 | len = UnicodeLength(entry->Entries[Name].Text); |
2921 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); | 3030 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); |
2922 | break; | 3031 | break; |
2923 | case AT_PBK_UCS2: | 3032 | case AT_PBK_UCS2: |
2924 | EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text)); | 3033 | EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text)); |
2925 | len = strlen(name); | 3034 | len = strlen(name); |
2926 | break; | 3035 | break; |
3036 | case AT_PBK_PCCP437: | ||
3037 | /* FIXME: correctly decode PCCP437 */ | ||
3038 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); | ||
3039 | len = UnicodeLength(entry->Entries[Name].Text); | ||
3040 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); | ||
3041 | break; | ||
2927 | } | 3042 | } |
2928 | } else { | 3043 | } else { |
2929 | smprintf(s, "WARNING: No usable name found!\n"); | 3044 | smprintf(s, "WARNING: No usable name found!\n"); |
2930 | len = 0; | 3045 | len = 0; |
2931 | } | 3046 | } |
2932 | 3047 | ||
2933 | if (Number != -1) { | 3048 | if (Number != -1) { |
2934 | GSM_PackSemiOctetNumber(entry->Entries[Number].Text, number, false); | 3049 | GSM_PackSemiOctetNumber(entry->Entries[Number].Text, number, false); |
2935 | NumberType = number[0]; | 3050 | NumberType = number[0]; |
2936 | sprintf(number,"%s",DecodeUnicodeString(entry->Entries[Number].Text)); | 3051 | sprintf(number,"%s",DecodeUnicodeString(entry->Entries[Number].Text)); |
2937 | } else { | 3052 | } else { |
2938 | smprintf(s, "WARNING: No usable number found!\n"); | 3053 | smprintf(s, "WARNING: No usable number found!\n"); |
2939 | number[0] = 0; | 3054 | number[0] = 0; |
2940 | } | 3055 | } |
2941 | 3056 | ||
2942 | if (Priv->FirstMemoryEntry == 0) { | 3057 | if (Priv->FirstMemoryEntry == 0) { |
2943 | error = ATGEN_GetMemoryInfo(s, NULL, AT_First); | 3058 | error = ATGEN_GetMemoryInfo(s, NULL, AT_First); |
2944 | if (error != ERR_NONE) return error; | 3059 | if (error != ERR_NONE) return error; |
2945 | } | 3060 | } |
2946 | 3061 | ||
2947 | /* We can't use here: | 3062 | /* We can't use here: |
2948 | * sprintf(req, "AT+CPBW=%d, \"%s\", %i, \"%s\"\r", | 3063 | * sprintf(req, "AT+CPBW=%d, \"%s\", %i, \"%s\"\r", |
2949 | * entry->Location, number, NumberType, name); | 3064 | * entry->Location, number, NumberType, name); |
2950 | * because name can contain 0 when using GSM alphabet. | 3065 | * because name can contain 0 when using GSM alphabet. |
@@ -3231,48 +3346,85 @@ GSM_Error ATGEN_Terminate(GSM_StateMachine *s) | |||
3231 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 3346 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
3232 | 3347 | ||
3233 | free(Priv->file.Buffer); | 3348 | free(Priv->file.Buffer); |
3234 | return ERR_NONE; | 3349 | return ERR_NONE; |
3235 | } | 3350 | } |
3236 | 3351 | ||
3237 | GSM_Error ATGEN_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 3352 | GSM_Error ATGEN_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
3238 | { | 3353 | { |
3239 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 3354 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
3240 | 3355 | ||
3241 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_AddCalendarNote(s, Note); | 3356 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_AddCalendarNote(s, Note); |
3242 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_AddCalendarNote(s, Note); | 3357 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_AddCalendarNote(s, Note); |
3243 | return ERR_NOTSUPPORTED; | 3358 | return ERR_NOTSUPPORTED; |
3244 | } | 3359 | } |
3245 | 3360 | ||
3246 | GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 3361 | GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
3247 | { | 3362 | { |
3248 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 3363 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
3249 | 3364 | ||
3250 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_DelCalendarNote(s, Note); | 3365 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_DelCalendarNote(s, Note); |
3251 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_DelCalendarNote(s, Note); | 3366 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_DelCalendarNote(s, Note); |
3252 | return ERR_NOTSUPPORTED; | 3367 | return ERR_NOTSUPPORTED; |
3253 | } | 3368 | } |
3254 | 3369 | ||
3370 | |||
3371 | GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
3372 | { | ||
3373 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3374 | |||
3375 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetBitmap(s, Bitmap); | ||
3376 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetBitmap(s, Bitmap); | ||
3377 | return ERR_NOTSUPPORTED; | ||
3378 | } | ||
3379 | |||
3380 | GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
3381 | { | ||
3382 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3383 | |||
3384 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetBitmap(s, Bitmap); | ||
3385 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetBitmap(s, Bitmap); | ||
3386 | return ERR_NOTSUPPORTED; | ||
3387 | } | ||
3388 | |||
3389 | GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | ||
3390 | { | ||
3391 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3392 | |||
3393 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetRingtone(s, Ringtone, PhoneRingtone); | ||
3394 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetRingtone(s, Ringtone, PhoneRingtone); | ||
3395 | return ERR_NOTSUPPORTED; | ||
3396 | } | ||
3397 | |||
3398 | GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | ||
3399 | { | ||
3400 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3401 | |||
3402 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetRingtone(s, Ringtone, maxlength); | ||
3403 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetRingtone(s, Ringtone, maxlength); | ||
3404 | return ERR_NOTSUPPORTED; | ||
3405 | } | ||
3406 | |||
3255 | GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press) | 3407 | GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press) |
3256 | { | 3408 | { |
3257 | GSM_Errorerror; | 3409 | GSM_Errorerror; |
3258 | unsigned char Frame[] = "AT+CKPD=\"?\"\r"; | 3410 | unsigned char Frame[] = "AT+CKPD=\"?\"\r"; |
3259 | 3411 | ||
3260 | if (Press) { | 3412 | if (Press) { |
3261 | switch (Key) { | 3413 | switch (Key) { |
3262 | case GSM_KEY_1 : Frame[9] = '1'; break; | 3414 | case GSM_KEY_1 : Frame[9] = '1'; break; |
3263 | case GSM_KEY_2 : Frame[9] = '2'; break; | 3415 | case GSM_KEY_2 : Frame[9] = '2'; break; |
3264 | case GSM_KEY_3 : Frame[9] = '3'; break; | 3416 | case GSM_KEY_3 : Frame[9] = '3'; break; |
3265 | case GSM_KEY_4 : Frame[9] = '4'; break; | 3417 | case GSM_KEY_4 : Frame[9] = '4'; break; |
3266 | case GSM_KEY_5 : Frame[9] = '5'; break; | 3418 | case GSM_KEY_5 : Frame[9] = '5'; break; |
3267 | case GSM_KEY_6 : Frame[9] = '6'; break; | 3419 | case GSM_KEY_6 : Frame[9] = '6'; break; |
3268 | case GSM_KEY_7 : Frame[9] = '7'; break; | 3420 | case GSM_KEY_7 : Frame[9] = '7'; break; |
3269 | case GSM_KEY_8 : Frame[9] = '8'; break; | 3421 | case GSM_KEY_8 : Frame[9] = '8'; break; |
3270 | case GSM_KEY_9 : Frame[9] = '9'; break; | 3422 | case GSM_KEY_9 : Frame[9] = '9'; break; |
3271 | case GSM_KEY_0 : Frame[9] = '0'; break; | 3423 | case GSM_KEY_0 : Frame[9] = '0'; break; |
3272 | case GSM_KEY_HASH : Frame[9] = '#'; break; | 3424 | case GSM_KEY_HASH : Frame[9] = '#'; break; |
3273 | case GSM_KEY_ASTERISK : Frame[9] = '*'; break; | 3425 | case GSM_KEY_ASTERISK : Frame[9] = '*'; break; |
3274 | case GSM_KEY_POWER : return ERR_NOTSUPPORTED; | 3426 | case GSM_KEY_POWER : return ERR_NOTSUPPORTED; |
3275 | case GSM_KEY_GREEN : Frame[9] = 'S'; break; | 3427 | case GSM_KEY_GREEN : Frame[9] = 'S'; break; |
3276 | case GSM_KEY_RED : Frame[9] = 'E'; break; | 3428 | case GSM_KEY_RED : Frame[9] = 'E'; break; |
3277 | case GSM_KEY_INCREASEVOLUME: Frame[9] = 'U'; break; | 3429 | case GSM_KEY_INCREASEVOLUME: Frame[9] = 'U'; break; |
3278 | case GSM_KEY_DECREASEVOLUME: Frame[9] = 'D'; break; | 3430 | case GSM_KEY_DECREASEVOLUME: Frame[9] = 'D'; break; |
@@ -3325,48 +3477,59 @@ GSM_Error ATGEN_ReplyIncomingCB(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
3325 | return ERR_NONE; | 3477 | return ERR_NONE; |
3326 | } | 3478 | } |
3327 | 3479 | ||
3328 | #endif | 3480 | #endif |
3329 | 3481 | ||
3330 | GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, bool enable) | 3482 | GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, bool enable) |
3331 | { | 3483 | { |
3332 | #ifdef GSM_ENABLE_CELLBROADCAST | 3484 | #ifdef GSM_ENABLE_CELLBROADCAST |
3333 | if (s->Phone.Data.EnableIncomingCB!=enable) { | 3485 | if (s->Phone.Data.EnableIncomingCB!=enable) { |
3334 | s->Phone.Data.EnableIncomingCB = enable; | 3486 | s->Phone.Data.EnableIncomingCB = enable; |
3335 | if (enable) { | 3487 | if (enable) { |
3336 | smprintf(s, "Enabling incoming CB\n"); | 3488 | smprintf(s, "Enabling incoming CB\n"); |
3337 | return GSM_WaitFor(s, "AT+CNMI=3,,2\r", 13, 0x00, 4, ID_SetIncomingCB); | 3489 | return GSM_WaitFor(s, "AT+CNMI=3,,2\r", 13, 0x00, 4, ID_SetIncomingCB); |
3338 | } else { | 3490 | } else { |
3339 | smprintf(s, "Disabling incoming CB\n"); | 3491 | smprintf(s, "Disabling incoming CB\n"); |
3340 | return GSM_WaitFor(s, "AT+CNMI=3,,0\r", 13, 0x00, 4, ID_SetIncomingCB); | 3492 | return GSM_WaitFor(s, "AT+CNMI=3,,0\r", 13, 0x00, 4, ID_SetIncomingCB); |
3341 | } | 3493 | } |
3342 | } | 3494 | } |
3343 | return ERR_NONE; | 3495 | return ERR_NONE; |
3344 | #else | 3496 | #else |
3345 | return ERR_SOURCENOTAVAILABLE; | 3497 | return ERR_SOURCENOTAVAILABLE; |
3346 | #endif | 3498 | #endif |
3347 | } | 3499 | } |
3348 | 3500 | ||
3501 | GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable) | ||
3502 | { | ||
3503 | if (enable) { | ||
3504 | smprintf(s, "Enabling fast SMS sending\n"); | ||
3505 | return GSM_WaitFor(s, "AT+CMMS=2\r", 10, 0x00, 4, ID_SetFastSMSSending); | ||
3506 | } else { | ||
3507 | smprintf(s, "Disabling fast SMS sending\n"); | ||
3508 | return GSM_WaitFor(s, "AT+CMMS=0\r", 10, 0x00, 4, ID_SetFastSMSSending); | ||
3509 | } | ||
3510 | } | ||
3511 | |||
3349 | GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3512 | GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3350 | { | 3513 | { |
3351 | smprintf(s, "Incoming SMS\n"); | 3514 | smprintf(s, "Incoming SMS\n"); |
3352 | return ERR_NONE; | 3515 | return ERR_NONE; |
3353 | } | 3516 | } |
3354 | 3517 | ||
3355 | GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3518 | GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3356 | { | 3519 | { |
3357 | GSM_Phone_Data *Data = &s->Phone.Data; | 3520 | GSM_Phone_Data *Data = &s->Phone.Data; |
3358 | GSM_SMSMessage sms; | 3521 | GSM_SMSMessage sms; |
3359 | int current = 0, current2, i=0; | 3522 | int current = 0, current2, i=0; |
3360 | unsigned char buffer[300],smsframe[800]; | 3523 | unsigned char buffer[300],smsframe[800]; |
3361 | 3524 | ||
3362 | smprintf(s, "Incoming SMS received (Deliver)\n"); | 3525 | smprintf(s, "Incoming SMS received (Deliver)\n"); |
3363 | if (Data->EnableIncomingSMS && s->User.IncomingSMS!=NULL) { | 3526 | if (Data->EnableIncomingSMS && s->User.IncomingSMS!=NULL) { |
3364 | sms.State = SMS_UnRead; | 3527 | sms.State = SMS_UnRead; |
3365 | sms.InboxFolder = true; | 3528 | sms.InboxFolder = true; |
3366 | sms.PDU = SMS_Deliver; | 3529 | sms.PDU = SMS_Deliver; |
3367 | 3530 | ||
3368 | /* T310 with larger SMS goes crazy and mix this incoming | 3531 | /* T310 with larger SMS goes crazy and mix this incoming |
3369 | * frame with normal answers. PDU is always last frame | 3532 | * frame with normal answers. PDU is always last frame |
3370 | * We find its' number and parse it */ | 3533 | * We find its' number and parse it */ |
3371 | while (Data->Priv.ATGEN.Lines.numbers[i*2+1] != 0) { | 3534 | while (Data->Priv.ATGEN.Lines.numbers[i*2+1] != 0) { |
3372 | /* FIXME: handle special chars correctly */ | 3535 | /* FIXME: handle special chars correctly */ |
@@ -3403,267 +3566,297 @@ GSM_Error ATGEN_IncomingSMSReport(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
3403 | 3566 | ||
3404 | GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, bool enable) | 3567 | GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, bool enable) |
3405 | { | 3568 | { |
3406 | /* Nokia returns OK, but doesn't return anything */ | 3569 | /* Nokia returns OK, but doesn't return anything */ |
3407 | if (s->Phone.Data.Priv.ATGEN.Manufacturer == AT_Nokia) return ERR_NOTSUPPORTED; | 3570 | if (s->Phone.Data.Priv.ATGEN.Manufacturer == AT_Nokia) return ERR_NOTSUPPORTED; |
3408 | 3571 | ||
3409 | if (s->Phone.Data.EnableIncomingSMS!=enable) { | 3572 | if (s->Phone.Data.EnableIncomingSMS!=enable) { |
3410 | s->Phone.Data.EnableIncomingSMS = enable; | 3573 | s->Phone.Data.EnableIncomingSMS = enable; |
3411 | if (enable) { | 3574 | if (enable) { |
3412 | smprintf(s, "Enabling incoming SMS\n"); | 3575 | smprintf(s, "Enabling incoming SMS\n"); |
3413 | 3576 | ||
3414 | /* Delivery reports */ | 3577 | /* Delivery reports */ |
3415 | GSM_WaitFor(s, "AT+CNMI=3,,,1\r", 14, 0x00, 4, ID_SetIncomingSMS); | 3578 | GSM_WaitFor(s, "AT+CNMI=3,,,1\r", 14, 0x00, 4, ID_SetIncomingSMS); |
3416 | 3579 | ||
3417 | /* SMS deliver */ | 3580 | /* SMS deliver */ |
3418 | return GSM_WaitFor(s, "AT+CNMI=3,3\r", 12, 0x00, 4, ID_SetIncomingSMS); | 3581 | return GSM_WaitFor(s, "AT+CNMI=3,3\r", 12, 0x00, 4, ID_SetIncomingSMS); |
3419 | } else { | 3582 | } else { |
3420 | smprintf(s, "Disabling incoming SMS\n"); | 3583 | smprintf(s, "Disabling incoming SMS\n"); |
3421 | return GSM_WaitFor(s, "AT+CNMI=3,0\r", 12, 0x00, 4, ID_SetIncomingSMS); | 3584 | return GSM_WaitFor(s, "AT+CNMI=3,0\r", 12, 0x00, 4, ID_SetIncomingSMS); |
3422 | } | 3585 | } |
3423 | } | 3586 | } |
3424 | return ERR_NONE; | 3587 | return ERR_NONE; |
3425 | } | 3588 | } |
3426 | 3589 | ||
3590 | GSM_Error ATGEN_GetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
3591 | { | ||
3592 | if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_GetLocale(s,locale); | ||
3593 | return ERR_NOTSUPPORTED; | ||
3594 | } | ||
3595 | |||
3596 | GSM_Error ATGEN_SetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
3597 | { | ||
3598 | if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_SetLocale(s,locale); | ||
3599 | return ERR_NOTSUPPORTED; | ||
3600 | } | ||
3601 | |||
3427 | GSM_Reply_Function ATGENReplyFunctions[] = { | 3602 | GSM_Reply_Function ATGENReplyFunctions[] = { |
3428 | {ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame }, | 3603 | {ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame }, |
3429 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho }, | 3604 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho }, |
3430 | {ATGEN_GenericReply, "AT+CMEE=" ,0x00,0x00,ID_EnableErrorInfo }, | 3605 | {ATGEN_GenericReply, "AT+CMEE=" ,0x00,0x00,ID_EnableErrorInfo }, |
3431 | {ATGEN_GenericReply, "AT+CKPD=" ,0x00,0x00,ID_PressKey }, | 3606 | {ATGEN_GenericReply, "AT+CKPD=" ,0x00,0x00,ID_PressKey }, |
3432 | {ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI }, | 3607 | {ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI }, |
3433 | {ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX }, | 3608 | {ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX }, |
3434 | 3609 | ||
3610 | {ERICSSON_ReplyGetDateLocale, "*ESDF:" ,0x00,0x00,ID_GetLocale }, | ||
3611 | {ERICSSON_ReplyGetTimeLocale, "*ESTF:" ,0x00,0x00,ID_GetLocale }, | ||
3612 | {ATGEN_GenericReply, "AT*ESDF=" ,0x00,0x00,ID_SetLocale }, | ||
3613 | {ATGEN_GenericReply, "AT*ESTF=" ,0x00,0x00,ID_SetLocale }, | ||
3614 | |||
3435 | #ifdef GSM_ENABLE_CELLBROADCAST | 3615 | #ifdef GSM_ENABLE_CELLBROADCAST |
3436 | {ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame }, | 3616 | {ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame }, |
3437 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB }, | 3617 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB }, |
3438 | #endif | 3618 | #endif |
3439 | 3619 | ||
3440 | {ATGEN_IncomingBattery, "_OBS:" ,0x00,0x00,ID_IncomingFrame }, | 3620 | {ATGEN_IncomingBattery, "_OBS:" ,0x00,0x00,ID_IncomingFrame }, |
3441 | {ATGEN_ReplyGetBatteryCharge, "AT+CBC" ,0x00,0x00,ID_GetBatteryCharge }, | 3621 | {ATGEN_ReplyGetBatteryCharge, "AT+CBC" ,0x00,0x00,ID_GetBatteryCharge }, |
3442 | 3622 | ||
3443 | {ATGEN_ReplyGetModel, "AT+CGMM" ,0x00,0x00,ID_GetModel }, | 3623 | {ATGEN_ReplyGetModel, "AT+CGMM" ,0x00,0x00,ID_GetModel }, |
3444 | {ATGEN_ReplyGetManufacturer, "AT+CGMI" ,0x00,0x00,ID_GetManufacturer }, | 3624 | {ATGEN_ReplyGetManufacturer, "AT+CGMI" ,0x00,0x00,ID_GetManufacturer }, |
3445 | {ATGEN_ReplyGetFirmwareCGMR, "AT+CGMR" ,0x00,0x00,ID_GetFirmware }, | 3625 | {ATGEN_ReplyGetFirmwareCGMR, "AT+CGMR" ,0x00,0x00,ID_GetFirmware }, |
3446 | {ATGEN_ReplyGetFirmwareATI, "ATI" ,0x00,0x00,ID_GetFirmware }, | 3626 | {ATGEN_ReplyGetFirmwareATI, "ATI" ,0x00,0x00,ID_GetFirmware }, |
3447 | {ATGEN_ReplyGetIMEI, "AT+CGSN" ,0x00,0x00,ID_GetIMEI }, | 3627 | {ATGEN_ReplyGetIMEI, "AT+CGSN" ,0x00,0x00,ID_GetIMEI }, |
3448 | 3628 | ||
3449 | {ATGEN_ReplySendSMS, "AT+CMGS" ,0x00,0x00,ID_IncomingFrame }, | 3629 | {ATGEN_ReplySendSMS, "AT+CMGS" ,0x00,0x00,ID_IncomingFrame }, |
3450 | {ATGEN_ReplySendSMS, "AT+CMSS" ,0x00,0x00,ID_IncomingFrame }, | 3630 | {ATGEN_ReplySendSMS, "AT+CMSS" ,0x00,0x00,ID_IncomingFrame }, |
3451 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingSMS }, | 3631 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingSMS }, |
3452 | {ATGEN_GenericReply, "AT+CMGF" ,0x00,0x00,ID_GetSMSMode }, | 3632 | {ATGEN_GenericReply, "AT+CMGF" ,0x00,0x00,ID_GetSMSMode }, |
3453 | {ATGEN_GenericReply, "AT+CSDH" ,0x00,0x00,ID_GetSMSMode }, | 3633 | {ATGEN_GenericReply, "AT+CSDH" ,0x00,0x00,ID_GetSMSMode }, |
3454 | {ATGEN_ReplyGetSMSMessage, "AT+CMGR" ,0x00,0x00,ID_GetSMSMessage }, | 3634 | {ATGEN_ReplyGetSMSMessage, "AT+CMGR" ,0x00,0x00,ID_GetSMSMessage }, |
3455 | {ATGEN_GenericReply, "AT+CPMS" ,0x00,0x00,ID_SetMemoryType }, | 3635 | {ATGEN_GenericReply, "AT+CPMS" ,0x00,0x00,ID_SetMemoryType }, |
3456 | {ATGEN_ReplyGetSMSStatus, "AT+CPMS" ,0x00,0x00,ID_GetSMSStatus }, | 3636 | {ATGEN_ReplyGetSMSStatus, "AT+CPMS" ,0x00,0x00,ID_GetSMSStatus }, |
3457 | {ATGEN_ReplyGetSMSMemories, "AT+CPMS=?" ,0x00,0x00,ID_GetSMSMemories }, | 3637 | {ATGEN_ReplyGetSMSMemories, "AT+CPMS=?" ,0x00,0x00,ID_GetSMSMemories }, |
3458 | {ATGEN_ReplyAddSMSMessage, "AT+CMGW" ,0x00,0x00,ID_SaveSMSMessage }, | 3638 | {ATGEN_ReplyAddSMSMessage, "AT+CMGW" ,0x00,0x00,ID_SaveSMSMessage }, |
3459 | {ATGEN_GenericReply, "AT+CSMP" ,0x00,0x00,ID_SetSMSParameters }, | 3639 | {ATGEN_GenericReply, "AT+CSMP" ,0x00,0x00,ID_SetSMSParameters }, |
3460 | {ATGEN_GenericReply, "AT+CSCA" ,0x00,0x00,ID_SetSMSC }, | 3640 | {ATGEN_GenericReply, "AT+CSCA" ,0x00,0x00,ID_SetSMSC }, |
3461 | {ATGEN_ReplyGetSMSC, "AT+CSCA?" ,0x00,0x00,ID_GetSMSC }, | 3641 | {ATGEN_ReplyGetSMSC, "AT+CSCA?" ,0x00,0x00,ID_GetSMSC }, |
3462 | {ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage }, | 3642 | {ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage }, |
3463 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters }, | 3643 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters }, |
3464 | {ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters }, | 3644 | {ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters }, |
3645 | {ATGEN_GenericReply, "AT+CMMS" ,0x00,0x00,ID_SetFastSMSSending }, | ||
3465 | {ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame }, | 3646 | {ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame }, |
3466 | {ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame }, | 3647 | {ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame }, |
3467 | {ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame }, | 3648 | {ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame }, |
3468 | {ATGEN_IncomingSMSCInfo, "^SCN:" ,0x00,0x00,ID_IncomingFrame }, | 3649 | {ATGEN_IncomingSMSCInfo, "^SCN:" ,0x00,0x00,ID_IncomingFrame }, |
3469 | 3650 | ||
3470 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime }, | 3651 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime }, |
3471 | {ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime }, | 3652 | {ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime }, |
3653 | {ATGEN_GenericReply, "AT+CALA=" ,0x00,0x00,ID_SetAlarm }, | ||
3472 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm }, | 3654 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm }, |
3473 | 3655 | ||
3474 | {ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo }, | 3656 | {ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo }, |
3475 | {ATGEN_GenericReply, "AT+CREG=2" ,0x00,0x00,ID_GetNetworkInfo }, | 3657 | {ATGEN_GenericReply, "AT+CREG=2" ,0x00,0x00,ID_GetNetworkInfo }, |
3476 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_GetNetworkInfo }, | 3658 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_GetNetworkInfo }, |
3477 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_SetAutoNetworkLogin}, | 3659 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_SetAutoNetworkLogin}, |
3478 | {ATGEN_ReplyGetNetworkCode, "AT+COPS" ,0x00,0x00,ID_GetNetworkInfo }, | 3660 | {ATGEN_ReplyGetNetworkCode, "AT+COPS" ,0x00,0x00,ID_GetNetworkInfo }, |
3479 | {ATGEN_ReplyGetSignalQuality, "AT+CSQ" ,0x00,0x00,ID_GetSignalQuality }, | 3661 | {ATGEN_ReplyGetSignalQuality, "AT+CSQ" ,0x00,0x00,ID_GetSignalQuality }, |
3480 | {ATGEN_IncomingNetworkLevel, "_OSIGQ:" ,0x00,0x00,ID_IncomingFrame }, | 3662 | {ATGEN_IncomingNetworkLevel, "_OSIGQ:" ,0x00,0x00,ID_IncomingFrame }, |
3481 | {ATGEN_IncomingGPRS, "+CGREG:" ,0x00,0x00,ID_IncomingFrame }, | 3663 | {ATGEN_IncomingGPRS, "+CGREG:" ,0x00,0x00,ID_IncomingFrame }, |
3482 | {ATGEN_ReplyGetNetworkLAC_CID, "+CREG:" ,0x00,0x00,ID_IncomingFrame }, | 3664 | {ATGEN_ReplyGetNetworkLAC_CID, "+CREG:" ,0x00,0x00,ID_IncomingFrame }, |
3483 | 3665 | ||
3484 | {ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType }, | 3666 | {ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType }, |
3485 | {ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType }, | 3667 | {ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType }, |
3486 | {ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus }, | 3668 | {ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus }, |
3669 | // /* Samsung phones reply +CPBR: after OK --claudio*/ | ||
3487 | {ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus }, | 3670 | {ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus }, |
3671 | {ATGEN_ReplyGetCPBRMemoryInfo, "+CPBR:" ,0x00,0x00,ID_GetMemoryStatus }, | ||
3488 | {ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus }, | 3672 | {ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus }, |
3489 | {ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset }, | 3673 | {ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset }, |
3490 | {ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory }, | 3674 | {ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory }, |
3491 | {ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory }, | 3675 | {ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory }, |
3492 | {ATGEN_SL45ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory }, | 3676 | {SIEMENS_ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory }, |
3493 | {ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory }, | 3677 | {ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory }, |
3494 | 3678 | ||
3495 | {ATGEN_CMS35ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap }, | 3679 | {SIEMENS_ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap }, |
3496 | {ATGEN_CMS35ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap }, | 3680 | {SIEMENS_ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap }, |
3497 | 3681 | ||
3498 | {ATGEN_CMS35ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone }, | 3682 | {SIEMENS_ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone }, |
3499 | {ATGEN_CMS35ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone }, | 3683 | {SIEMENS_ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone }, |
3500 | 3684 | ||
3501 | {ATGEN_CMS35ReplyGetNextCal, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote }, | 3685 | {SIEMENS_ReplyGetNextCalendar, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote }, |
3502 | {ATGEN_CMS35ReplySetCalendar, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote }, | 3686 | {SIEMENS_ReplyAddCalendarNote, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote }, |
3503 | {ATGEN_CMS35ReplyDeleteCalendar,"AT^SBNW=\"vcs\"",0x00,0x00,ID_DeleteCalendarNote }, | 3687 | {SIEMENS_ReplyDelCalendarNote, "AT^SBNW=\"vcs\"",0x00,0x00,ID_DeleteCalendarNote }, |
3504 | 3688 | ||
3505 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode }, | 3689 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode }, |
3506 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode }, | 3690 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode }, |
3507 | {ATGEN_ReplyGetSecurityStatus, "AT+CPIN?" ,0x00,0x00,ID_GetSecurityStatus }, | 3691 | {ATGEN_ReplyGetSecurityStatus, "AT+CPIN?" ,0x00,0x00,ID_GetSecurityStatus }, |
3508 | {ATGEN_ReplyOK, "OK" ,0x00,0x00,ID_IncomingFrame }, | 3692 | {ATGEN_ReplyOK, "OK" ,0x00,0x00,ID_IncomingFrame }, |
3509 | 3693 | ||
3510 | {ATGEN_GenericReply, "AT+VTS" ,0x00,0x00,ID_SendDTMF }, | 3694 | {ATGEN_GenericReply, "AT+VTS" ,0x00,0x00,ID_SendDTMF }, |
3511 | {ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall }, | 3695 | {ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall }, |
3512 | {ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice }, | 3696 | {ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice }, |
3513 | {ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall }, | 3697 | {ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall }, |
3698 | {ATGEN_GenericReply, "AT+CUSD" ,0x00,0x00,ID_SetUSSD }, | ||
3699 | {ATGEN_ReplyGetUSSD, "+CUSD" ,0x00,0x00,ID_IncomingFrame }, | ||
3514 | {ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame }, | 3700 | {ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame }, |
3515 | {ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame }, | 3701 | {ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame }, |
3516 | {ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame }, | 3702 | {ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame }, |
3517 | {ATGEN_ReplyIncomingCallInfo, "RING" ,0x00,0x00,ID_IncomingFrame }, | 3703 | {ATGEN_ReplyIncomingCallInfo, "RING" ,0x00,0x00,ID_IncomingFrame }, |
3518 | {ATGEN_ReplyIncomingCallInfo, "NO CARRIER" ,0x00,0x00,ID_IncomingFrame }, | 3704 | {ATGEN_ReplyIncomingCallInfo, "NO CARRIER" ,0x00,0x00,ID_IncomingFrame }, |
3519 | 3705 | ||
3520 | {ATGEN_ReplyReset, "AT^SRESET" ,0x00,0x00,ID_Reset }, | 3706 | {ATGEN_ReplyReset, "AT^SRESET" ,0x00,0x00,ID_Reset }, |
3521 | {ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset }, | 3707 | {ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset }, |
3522 | {ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings }, | 3708 | {ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings }, |
3523 | 3709 | ||
3710 | {SAMSUNG_ReplyGetBitmap, "AT+IMGR=" ,0x00,0x00,ID_GetBitmap }, | ||
3711 | {SAMSUNG_ReplySetBitmap, "SDNDCRC =" ,0x00,0x00,ID_SetBitmap }, | ||
3712 | |||
3713 | {SAMSUNG_ReplyGetRingtone, "AT+MELR=" ,0x00,0x00,ID_GetRingtone }, | ||
3714 | {SAMSUNG_ReplySetRingtone, "SDNDCRC =" ,0x00,0x00,ID_SetRingtone }, | ||
3715 | |||
3524 | #ifdef GSM_ENABLE_ALCATEL | 3716 | #ifdef GSM_ENABLE_ALCATEL |
3525 | /* Why do I give Alcatel specific things here? It's simple, Alcatel needs | 3717 | /* Why do I give Alcatel specific things here? It's simple, Alcatel needs |
3526 | * some AT commands to start it's binary mode, so this needs to be in AT | 3718 | * some AT commands to start it's binary mode, so this needs to be in AT |
3527 | * related stuff. | 3719 | * related stuff. |
3528 | * | 3720 | * |
3529 | * XXX: AT+IFC could later move outside this ifdef, because it is not Alcatel | 3721 | * XXX: AT+IFC could later move outside this ifdef, because it is not Alcatel |
3530 | * specific and it's part of ETSI specifications | 3722 | * specific and it's part of ETSI specifications |
3531 | */ | 3723 | */ |
3532 | {ATGEN_GenericReply, "AT+IFC" ,0x00,0x00,ID_SetFlowControl }, | 3724 | {ATGEN_GenericReply, "AT+IFC" ,0x00,0x00,ID_SetFlowControl }, |
3533 | {ALCATEL_ProtocolVersionReply, "AT+CPROT=?" ,0x00,0x00,ID_AlcatelProtocol }, | 3725 | {ALCATEL_ProtocolVersionReply, "AT+CPROT=?" ,0x00,0x00,ID_AlcatelProtocol }, |
3534 | {ATGEN_GenericReply, "AT+CPROT" ,0x00,0x00,ID_AlcatelConnect }, | 3726 | {ATGEN_GenericReply, "AT+CPROT" ,0x00,0x00,ID_AlcatelConnect }, |
3535 | #endif | 3727 | #endif |
3536 | 3728 | ||
3537 | {NULL, "\x00" ,0x00,0x00,ID_None } | 3729 | {NULL, "\x00" ,0x00,0x00,ID_None } |
3538 | }; | 3730 | }; |
3539 | 3731 | ||
3540 | GSM_Phone_Functions ATGENPhone = { | 3732 | GSM_Phone_Functions ATGENPhone = { |
3541 | "A2D|iPAQ|at|M20|S25|MC35|C35i|5110|5130|5190|5210|6110|6130|6150|6190|6210|6250|6310|6310i|6510|7110|8210|8250|8290|8310|8390|8850|8855|8890|8910|9110|9210", | 3733 | "A2D|iPAQ|at|M20|S25|MC35|TC35|C35i|S300|5110|5130|5190|5210|6110|6130|6150|6190|6210|6250|6310|6310i|6510|7110|8210|8250|8290|8310|8390|8850|8855|8890|8910|9110|9210", |
3542 | ATGENReplyFunctions, | 3734 | ATGENReplyFunctions, |
3543 | ATGEN_Initialise, | 3735 | ATGEN_Initialise, |
3544 | ATGEN_Terminate, | 3736 | ATGEN_Terminate, |
3545 | ATGEN_DispatchMessage, | 3737 | ATGEN_DispatchMessage, |
3546 | NOTSUPPORTED, /* ShowStartInfo */ | 3738 | NOTSUPPORTED, /* ShowStartInfo */ |
3547 | ATGEN_GetManufacturer, | 3739 | ATGEN_GetManufacturer, |
3548 | ATGEN_GetModel, | 3740 | ATGEN_GetModel, |
3549 | ATGEN_GetFirmware, | 3741 | ATGEN_GetFirmware, |
3550 | ATGEN_GetIMEI, | 3742 | ATGEN_GetIMEI, |
3551 | NOTSUPPORTED, /* GetOriginalIMEI */ | 3743 | NOTSUPPORTED, /* GetOriginalIMEI */ |
3552 | NOTSUPPORTED, /* GetManufactureMonth*/ | 3744 | NOTSUPPORTED, /* GetManufactureMonth*/ |
3553 | NOTSUPPORTED, /* GetProductCode */ | 3745 | NOTSUPPORTED, /* GetProductCode */ |
3554 | NOTSUPPORTED, /* GetHardware */ | 3746 | NOTSUPPORTED, /* GetHardware */ |
3555 | NOTSUPPORTED, /* GetPPM */ | 3747 | NOTSUPPORTED, /* GetPPM */ |
3556 | ATGEN_GetSIMIMSI, | 3748 | ATGEN_GetSIMIMSI, |
3557 | ATGEN_GetDateTime, | 3749 | ATGEN_GetDateTime, |
3558 | ATGEN_SetDateTime, | 3750 | ATGEN_SetDateTime, |
3559 | ATGEN_GetAlarm, | 3751 | ATGEN_GetAlarm, |
3560 | NOTIMPLEMENTED, /* SetAlarm */ | 3752 | ATGEN_SetAlarm, |
3561 | NOTSUPPORTED, /* GetLocale */ | 3753 | ATGEN_GetLocale, |
3562 | NOTSUPPORTED, /* SetLocale */ | 3754 | ATGEN_SetLocale, |
3563 | ATGEN_PressKey, | 3755 | ATGEN_PressKey, |
3564 | ATGEN_Reset, | 3756 | ATGEN_Reset, |
3565 | ATGEN_ResetPhoneSettings, | 3757 | ATGEN_ResetPhoneSettings, |
3566 | ATGEN_EnterSecurityCode, | 3758 | ATGEN_EnterSecurityCode, |
3567 | ATGEN_GetSecurityStatus, | 3759 | ATGEN_GetSecurityStatus, |
3568 | ATGEN_GetDisplayStatus, | 3760 | ATGEN_GetDisplayStatus, |
3569 | ATGEN_SetAutoNetworkLogin, | 3761 | ATGEN_SetAutoNetworkLogin, |
3570 | ATGEN_GetBatteryCharge, | 3762 | ATGEN_GetBatteryCharge, |
3571 | ATGEN_GetSignalQuality, | 3763 | ATGEN_GetSignalQuality, |
3572 | ATGEN_GetNetworkInfo, | 3764 | ATGEN_GetNetworkInfo, |
3573 | NOTSUPPORTED, /* GetCategory */ | 3765 | NOTSUPPORTED, /* GetCategory */ |
3574 | NOTSUPPORTED, /* AddCategory */ | 3766 | NOTSUPPORTED, /* AddCategory */ |
3575 | NOTSUPPORTED, /* GetCategoryStatus */ | 3767 | NOTSUPPORTED, /* GetCategoryStatus */ |
3576 | ATGEN_GetMemoryStatus, | 3768 | ATGEN_GetMemoryStatus, |
3577 | ATGEN_GetMemory, | 3769 | ATGEN_GetMemory, |
3578 | ATGEN_GetNextMemory, | 3770 | ATGEN_GetNextMemory, |
3579 | ATGEN_SetMemory, | 3771 | ATGEN_SetMemory, |
3580 | ATGEN_AddMemory, | 3772 | ATGEN_AddMemory, |
3581 | ATGEN_DeleteMemory, | 3773 | ATGEN_DeleteMemory, |
3582 | ATGEN_DeleteAllMemory, | 3774 | ATGEN_DeleteAllMemory, |
3583 | NOTSUPPORTED, /* GetSpeedDial */ | 3775 | NOTSUPPORTED, /* GetSpeedDial */ |
3584 | NOTSUPPORTED, /* SetSpeedDial */ | 3776 | NOTSUPPORTED, /* SetSpeedDial */ |
3585 | ATGEN_GetSMSC, | 3777 | ATGEN_GetSMSC, |
3586 | ATGEN_SetSMSC, | 3778 | ATGEN_SetSMSC, |
3587 | ATGEN_GetSMSStatus, | 3779 | ATGEN_GetSMSStatus, |
3588 | ATGEN_GetSMS, | 3780 | ATGEN_GetSMS, |
3589 | ATGEN_GetNextSMS, | 3781 | ATGEN_GetNextSMS, |
3590 | NOTSUPPORTED, /* SetSMS */ | 3782 | NOTSUPPORTED, /* SetSMS */ |
3591 | ATGEN_AddSMS, | 3783 | ATGEN_AddSMS, |
3592 | ATGEN_DeleteSMS, | 3784 | ATGEN_DeleteSMS, |
3593 | ATGEN_SendSMS, | 3785 | ATGEN_SendSMS, |
3594 | ATGEN_SendSavedSMS, | 3786 | ATGEN_SendSavedSMS, |
3787 | ATGEN_SetFastSMSSending, | ||
3595 | ATGEN_SetIncomingSMS, | 3788 | ATGEN_SetIncomingSMS, |
3596 | ATGEN_SetIncomingCB, | 3789 | ATGEN_SetIncomingCB, |
3597 | ATGEN_GetSMSFolders, | 3790 | ATGEN_GetSMSFolders, |
3598 | NOTSUPPORTED, /* AddSMSFolder */ | 3791 | NOTSUPPORTED, /* AddSMSFolder */ |
3599 | NOTSUPPORTED, /* DeleteSMSFolder */ | 3792 | NOTSUPPORTED, /* DeleteSMSFolder */ |
3600 | ATGEN_DialVoice, | 3793 | ATGEN_DialVoice, |
3601 | ATGEN_AnswerCall, | 3794 | ATGEN_AnswerCall, |
3602 | ATGEN_CancelCall, | 3795 | ATGEN_CancelCall, |
3603 | NOTSUPPORTED, /* HoldCall */ | 3796 | NOTSUPPORTED, /* HoldCall */ |
3604 | NOTSUPPORTED, /* UnholdCall */ | 3797 | NOTSUPPORTED, /* UnholdCall */ |
3605 | NOTSUPPORTED, /* ConferenceCall */ | 3798 | NOTSUPPORTED, /* ConferenceCall */ |
3606 | NOTSUPPORTED, /* SplitCall */ | 3799 | NOTSUPPORTED, /* SplitCall */ |
3607 | NOTSUPPORTED, /* TransferCall */ | 3800 | NOTSUPPORTED, /* TransferCall */ |
3608 | NOTSUPPORTED, /* SwitchCall */ | 3801 | NOTSUPPORTED, /* SwitchCall */ |
3609 | NOTSUPPORTED, /* GetCallDivert */ | 3802 | NOTSUPPORTED, /* GetCallDivert */ |
3610 | NOTSUPPORTED, /* SetCallDivert */ | 3803 | NOTSUPPORTED, /* SetCallDivert */ |
3611 | NOTSUPPORTED, /* CancelAllDiverts*/ | 3804 | NOTSUPPORTED, /* CancelAllDiverts*/ |
3612 | NONEFUNCTION, /* SetIncomingCall */ | 3805 | NONEFUNCTION, /* SetIncomingCall */ |
3613 | NOTSUPPORTED, /* SetIncomingUSSD */ | 3806 | ATGEN_SetIncomingUSSD, |
3614 | ATGEN_SendDTMF, | 3807 | ATGEN_SendDTMF, |
3615 | ATGEN_GetRingtone, | 3808 | ATGEN_GetRingtone, |
3616 | ATGEN_SetRingtone, | 3809 | ATGEN_SetRingtone, |
3617 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 3810 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
3618 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 3811 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
3619 | NOTSUPPORTED, /* PlayTone */ | 3812 | NOTSUPPORTED, /* PlayTone */ |
3620 | NOTSUPPORTED, /* GetWAPBookmark */ | 3813 | NOTSUPPORTED, /* GetWAPBookmark */ |
3621 | NOTSUPPORTED, /* SetWAPBookmark */ | 3814 | NOTSUPPORTED, /* SetWAPBookmark */ |
3622 | NOTSUPPORTED, /* DeleteWAPBookmark */ | 3815 | NOTSUPPORTED, /* DeleteWAPBookmark */ |
3623 | NOTSUPPORTED, /* GetWAPSettings */ | 3816 | NOTSUPPORTED, /* GetWAPSettings */ |
3624 | NOTSUPPORTED, /* SetWAPSettings */ | 3817 | NOTSUPPORTED, /* SetWAPSettings */ |
3625 | NOTSUPPORTED, /* GetMMSSettings */ | 3818 | NOTSUPPORTED, /* GetMMSSettings */ |
3626 | NOTSUPPORTED, /* SetMMSSettings */ | 3819 | NOTSUPPORTED, /* SetMMSSettings */ |
3627 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 3820 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
3628 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 3821 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
3629 | NOTSUPPORTED, /* GetChatSettings */ | 3822 | NOTSUPPORTED, /* GetChatSettings */ |
3630 | NOTSUPPORTED, /* SetChatSettings */ | 3823 | NOTSUPPORTED, /* SetChatSettings */ |
3631 | ATGEN_GetBitmap, /* GetBitmap */ | 3824 | ATGEN_GetBitmap, /* GetBitmap */ |
3632 | ATGEN_SetBitmap, /* SetBitmap */ | 3825 | ATGEN_SetBitmap, /* SetBitmap */ |
3633 | SONYERIC_GetToDoStatus, | 3826 | SONYERIC_GetToDoStatus, |
3634 | NOTSUPPORTED, /* GetToDo */ | 3827 | NOTSUPPORTED, /* GetToDo */ |
3635 | SONYERIC_GetNextToDo, | 3828 | SONYERIC_GetNextToDo, |
3636 | NOTSUPPORTED, /* SetToDo */ | 3829 | NOTSUPPORTED, /* SetToDo */ |
3637 | SONYERIC_AddToDo, | 3830 | SONYERIC_AddToDo, |
3638 | NOTSUPPORTED, /* DeleteToDo */ | 3831 | NOTSUPPORTED, /* DeleteToDo */ |
3639 | SONYERIC_DeleteAllToDo, | 3832 | SONYERIC_DeleteAllToDo, |
3640 | SONYERIC_GetCalendarStatus, | 3833 | SONYERIC_GetCalendarStatus, |
3641 | NOTIMPLEMENTED, /* GetCalendar */ | 3834 | NOTIMPLEMENTED, /* GetCalendar */ |
3642 | ATGEN_GetNextCalendar, | 3835 | ATGEN_GetNextCalendar, |
3643 | NOTIMPLEMENTED, /* SetCalendar */ | 3836 | NOTIMPLEMENTED, /* SetCalendar */ |
3644 | ATGEN_AddCalendarNote, | 3837 | ATGEN_AddCalendarNote, |
3645 | ATGEN_DelCalendarNote, | 3838 | ATGEN_DelCalendarNote, |
3646 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 3839 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
3647 | NOTSUPPORTED, /* GetCalendarSettings*/ | 3840 | NOTSUPPORTED, /* GetCalendarSettings*/ |
3648 | NOTSUPPORTED, /* SetCalendarSettings*/ | 3841 | NOTSUPPORTED, /* SetCalendarSettings*/ |
3649 | NOTSUPPORTED, /* GetNote */ | 3842 | NOTSUPPORTED, /* GetNextNote */ |
3650 | NOTSUPPORTED, /* GetProfile */ | 3843 | NOTSUPPORTED, /* GetProfile */ |
3651 | NOTSUPPORTED, /* SetProfile */ | 3844 | NOTSUPPORTED, /* SetProfile */ |
3652 | NOTSUPPORTED, /* GetFMStation */ | 3845 | NOTSUPPORTED, /* GetFMStation */ |
3653 | NOTSUPPORTED, /* SetFMStation */ | 3846 | NOTSUPPORTED, /* SetFMStation */ |
3654 | NOTSUPPORTED, /* ClearFMStations */ | 3847 | NOTSUPPORTED, /* ClearFMStations */ |
3655 | NOTSUPPORTED, /* GetNextFileFolder*/ | 3848 | NOTSUPPORTED, /* GetNextFileFolder*/ |
3656 | NOTSUPPORTED, /* GetFilePart */ | 3849 | NOTSUPPORTED, /* GetFilePart */ |
3657 | NOTSUPPORTED, /* AddFile */ | 3850 | NOTSUPPORTED, /* AddFile */ |
3658 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 3851 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
3659 | NOTSUPPORTED, /* DeleteFile */ | 3852 | NOTSUPPORTED, /* DeleteFile */ |
3660 | NOTSUPPORTED, /* AddFolder */ | 3853 | NOTSUPPORTED, /* AddFolder */ |
3661 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 3854 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
3662 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 3855 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
3663 | }; | 3856 | }; |
3664 | 3857 | ||
3665 | #endif | 3858 | #endif |
3666 | 3859 | ||
3667 | /* How should editor hadle tabs in this file? Add editor commands here. | 3860 | /* How should editor hadle tabs in this file? Add editor commands here. |
3668 | * vim: noexpandtab sw=8 ts=8 sts=8: | 3861 | * vim: noexpandtab sw=8 ts=8 sts=8: |
3669 | */ | 3862 | */ |
diff --git a/gammu/emb/common/phone/at/atgen.h b/gammu/emb/common/phone/at/atgen.h index 0e08ee4..bb5c559 100644 --- a/gammu/emb/common/phone/at/atgen.h +++ b/gammu/emb/common/phone/at/atgen.h | |||
@@ -21,55 +21,57 @@ | |||
21 | 21 | ||
22 | typedef enum { | 22 | typedef enum { |
23 | SMS_AT_PDU = 1, | 23 | SMS_AT_PDU = 1, |
24 | SMS_AT_TXT | 24 | SMS_AT_TXT |
25 | } GSM_AT_SMS_Modes; | 25 | } GSM_AT_SMS_Modes; |
26 | 26 | ||
27 | typedef enum { | 27 | typedef enum { |
28 | AT_Reply_OK = 1, | 28 | AT_Reply_OK = 1, |
29 | AT_Reply_Connect, | 29 | AT_Reply_Connect, |
30 | AT_Reply_Error, | 30 | AT_Reply_Error, |
31 | AT_Reply_Unknown, | 31 | AT_Reply_Unknown, |
32 | AT_Reply_CMSError, | 32 | AT_Reply_CMSError, |
33 | AT_Reply_CMEError, | 33 | AT_Reply_CMEError, |
34 | AT_Reply_SMSEdit | 34 | AT_Reply_SMSEdit |
35 | } GSM_AT_Reply_State; | 35 | } GSM_AT_Reply_State; |
36 | 36 | ||
37 | typedef enum { | 37 | typedef enum { |
38 | AT_Nokia = 1, | 38 | AT_Nokia = 1, |
39 | AT_Alcatel, | 39 | AT_Alcatel, |
40 | AT_Siemens, | 40 | AT_Siemens, |
41 | AT_HP, | 41 | AT_HP, |
42 | AT_Falcom, | 42 | AT_Falcom, |
43 | AT_Ericsson, | 43 | AT_Ericsson, |
44 | AT_Sagem, | 44 | AT_Sagem, |
45 | AT_Samsung, | ||
45 | AT_Unknown | 46 | AT_Unknown |
46 | } GSM_AT_Manufacturer; | 47 | } GSM_AT_Manufacturer; |
47 | 48 | ||
48 | typedef enum { | 49 | typedef enum { |
49 | AT_PBK_HEX = 1, | 50 | AT_PBK_HEX = 1, |
50 | AT_PBK_GSM, | 51 | AT_PBK_GSM, |
51 | AT_PBK_UCS2 | 52 | AT_PBK_UCS2, |
53 | AT_PBK_PCCP437 | ||
52 | } GSM_AT_PBK_Charset; | 54 | } GSM_AT_PBK_Charset; |
53 | 55 | ||
54 | typedef enum { | 56 | typedef enum { |
55 | AT_AVAILABLE = 1, | 57 | AT_AVAILABLE = 1, |
56 | AT_NOTAVAILABLE | 58 | AT_NOTAVAILABLE |
57 | } GSM_AT_SMSMemory; | 59 | } GSM_AT_SMSMemory; |
58 | 60 | ||
59 | typedef enum { | 61 | typedef enum { |
60 | AT_SBNR_AVAILABLE = 1, | 62 | AT_SBNR_AVAILABLE = 1, |
61 | AT_SBNR_NOTAVAILABLE | 63 | AT_SBNR_NOTAVAILABLE |
62 | } GSM_AT_SBNR; | 64 | } GSM_AT_SBNR; |
63 | 65 | ||
64 | typedef enum { | 66 | typedef enum { |
65 | AT_Status, | 67 | AT_Status, |
66 | AT_NextEmpty, | 68 | AT_NextEmpty, |
67 | AT_Total, | 69 | AT_Total, |
68 | AT_First, | 70 | AT_First, |
69 | AT_Sizes | 71 | AT_Sizes |
70 | } GSM_AT_NeededMemoryInfo; | 72 | } GSM_AT_NeededMemoryInfo; |
71 | 73 | ||
72 | #define AT_PBK_MAX_MEMORIES200 | 74 | #define AT_PBK_MAX_MEMORIES200 |
73 | 75 | ||
74 | typedef struct { | 76 | typedef struct { |
75 | GSM_AT_Manufacturer Manufacturer; /* Who is manufacturer */ | 77 | GSM_AT_Manufacturer Manufacturer; /* Who is manufacturer */ |
@@ -82,29 +84,33 @@ typedef struct { | |||
82 | char PBKMemories[AT_PBK_MAX_MEMORIES + 1]; /* Supported by phone PBK memories */ | 84 | char PBKMemories[AT_PBK_MAX_MEMORIES + 1]; /* Supported by phone PBK memories */ |
83 | int NextMemoryEntry; /* Next empty memory entry */ | 85 | int NextMemoryEntry; /* Next empty memory entry */ |
84 | int FirstMemoryEntry; /* First memory entry to be read */ | 86 | int FirstMemoryEntry; /* First memory entry to be read */ |
85 | GSM_AT_PBK_Charset PBKCharset; /* Last read PBK charset */ | 87 | GSM_AT_PBK_Charset PBKCharset; /* Last read PBK charset */ |
86 | bool UCS2CharsetFailed; /* Whether setting of UCS2 charset has already failed */ | 88 | bool UCS2CharsetFailed; /* Whether setting of UCS2 charset has already failed */ |
87 | bool NonUCS2CharsetFailed; /* Whether setting of non-UCS2 charset has already failed */ | 89 | bool NonUCS2CharsetFailed; /* Whether setting of non-UCS2 charset has already failed */ |
88 | GSM_AT_SBNR PBKSBNR; | 90 | GSM_AT_SBNR PBKSBNR; |
89 | int NumberLength; | 91 | int NumberLength; |
90 | int TextLength; | 92 | int TextLength; |
91 | int MemorySize; | 93 | int MemorySize; |
92 | 94 | ||
93 | GSM_SMSMemoryStatusLastSMSStatus; | 95 | GSM_SMSMemoryStatusLastSMSStatus; |
94 | int LastSMSRead; | 96 | int LastSMSRead; |
95 | int FirstCalendarPos; | 97 | int FirstCalendarPos; |
96 | bool CanSaveSMS; | 98 | bool CanSaveSMS; |
97 | GSM_AT_SMSMemory PhoneSMSMemory; /* Is phone SMS memory available ? */ | 99 | GSM_AT_SMSMemory PhoneSMSMemory; /* Is phone SMS memory available ? */ |
98 | GSM_AT_SMSMemory SIMSMSMemory; /* Is SIM SMS memory available ? */ | 100 | GSM_AT_SMSMemory SIMSMSMemory; /* Is SIM SMS memory available ? */ |
99 | GSM_MemoryType SMSMemory; /* Last read SMS memory */ | 101 | GSM_MemoryType SMSMemory; /* Last read SMS memory */ |
100 | GSM_AT_SMS_Modes SMSMode; /* PDU or TEXT mode for SMS ? */ | 102 | GSM_AT_SMS_Modes SMSMode; /* PDU or TEXT mode for SMS ? */ |
101 | 103 | ||
102 | bool OBEX; | 104 | bool OBEX; |
103 | GSM_File file; | 105 | GSM_File file; |
104 | } GSM_Phone_ATGENData; | 106 | } GSM_Phone_ATGENData; |
105 | 107 | ||
108 | GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *); | ||
109 | GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *); | ||
110 | GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *); | ||
111 | |||
106 | #endif | 112 | #endif |
107 | 113 | ||
108 | /* How should editor hadle tabs in this file? Add editor commands here. | 114 | /* How should editor hadle tabs in this file? Add editor commands here. |
109 | * vim: noexpandtab sw=8 ts=8 sts=8: | 115 | * vim: noexpandtab sw=8 ts=8 sts=8: |
110 | */ | 116 | */ |
diff --git a/gammu/emb/common/phone/at/samsung.c b/gammu/emb/common/phone/at/samsung.c new file mode 100644 index 0000000..55a42e5 --- a/dev/null +++ b/gammu/emb/common/phone/at/samsung.c | |||
@@ -0,0 +1,447 @@ | |||
1 | /* Samsung-specific functions | ||
2 | * Copyright (C) 2004 Claudio Matsuoka <cmatsuoka@gmail.com> | ||
3 | * Tested with S300 only! | ||
4 | */ | ||
5 | |||
6 | #include "../../gsmstate.h" | ||
7 | |||
8 | #ifdef GSM_ENABLE_ATGEN | ||
9 | |||
10 | #include <string.h> | ||
11 | #include <time.h> | ||
12 | #include <ctype.h> | ||
13 | |||
14 | #include "../../misc/coding/coding.h" | ||
15 | #include "../../gsmcomon.h" | ||
16 | #include "../../service/sms/gsmsms.h" | ||
17 | #include "../pfunc.h" | ||
18 | |||
19 | #include "atgen.h" | ||
20 | #include "samsung.h" | ||
21 | |||
22 | /* Binary frame size */ | ||
23 | #define BLKSZ 1024 | ||
24 | |||
25 | struct ModelRes { | ||
26 | char *model; | ||
27 | int width; | ||
28 | int height; | ||
29 | }; | ||
30 | |||
31 | static struct ModelRes modres[] = { | ||
32 | { "S100", 128, 128 }, | ||
33 | { "S200", 128, 113 }, | ||
34 | { "S300", 128, 97 }, | ||
35 | { "S500", 128, 128 }, | ||
36 | { "T100", 128, 128 }, | ||
37 | { "E700", 128, 128 }, | ||
38 | { NULL, 0, 0 } | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * CRC functions from the Granch SBNI12 Linux driver by | ||
43 | * Denis I. Timofeev <timofeev@granch.ru> | ||
44 | */ | ||
45 | static unsigned int crc32tab[] = { | ||
46 | 0xD202EF8D, 0xA505DF1B, 0x3C0C8EA1, 0x4B0BBE37, | ||
47 | 0xD56F2B94, 0xA2681B02, 0x3B614AB8, 0x4C667A2E, | ||
48 | 0xDCD967BF, 0xABDE5729, 0x32D70693, 0x45D03605, | ||
49 | 0xDBB4A3A6, 0xACB39330, 0x35BAC28A, 0x42BDF21C, | ||
50 | 0xCFB5FFE9, 0xB8B2CF7F, 0x21BB9EC5, 0x56BCAE53, | ||
51 | 0xC8D83BF0, 0xBFDF0B66, 0x26D65ADC, 0x51D16A4A, | ||
52 | 0xC16E77DB, 0xB669474D, 0x2F6016F7, 0x58672661, | ||
53 | 0xC603B3C2, 0xB1048354, 0x280DD2EE, 0x5F0AE278, | ||
54 | 0xE96CCF45, 0x9E6BFFD3, 0x0762AE69, 0x70659EFF, | ||
55 | 0xEE010B5C, 0x99063BCA, 0x000F6A70, 0x77085AE6, | ||
56 | 0xE7B74777, 0x90B077E1, 0x09B9265B, 0x7EBE16CD, | ||
57 | 0xE0DA836E, 0x97DDB3F8, 0x0ED4E242, 0x79D3D2D4, | ||
58 | 0xF4DBDF21, 0x83DCEFB7, 0x1AD5BE0D, 0x6DD28E9B, | ||
59 | 0xF3B61B38, 0x84B12BAE, 0x1DB87A14, 0x6ABF4A82, | ||
60 | 0xFA005713, 0x8D076785, 0x140E363F, 0x630906A9, | ||
61 | 0xFD6D930A, 0x8A6AA39C, 0x1363F226, 0x6464C2B0, | ||
62 | 0xA4DEAE1D, 0xD3D99E8B, 0x4AD0CF31, 0x3DD7FFA7, | ||
63 | 0xA3B36A04, 0xD4B45A92, 0x4DBD0B28, 0x3ABA3BBE, | ||
64 | 0xAA05262F, 0xDD0216B9, 0x440B4703, 0x330C7795, | ||
65 | 0xAD68E236, 0xDA6FD2A0, 0x4366831A, 0x3461B38C, | ||
66 | 0xB969BE79, 0xCE6E8EEF, 0x5767DF55, 0x2060EFC3, | ||
67 | 0xBE047A60, 0xC9034AF6, 0x500A1B4C, 0x270D2BDA, | ||
68 | 0xB7B2364B, 0xC0B506DD, 0x59BC5767, 0x2EBB67F1, | ||
69 | 0xB0DFF252, 0xC7D8C2C4, 0x5ED1937E, 0x29D6A3E8, | ||
70 | 0x9FB08ED5, 0xE8B7BE43, 0x71BEEFF9, 0x06B9DF6F, | ||
71 | 0x98DD4ACC, 0xEFDA7A5A, 0x76D32BE0, 0x01D41B76, | ||
72 | 0x916B06E7, 0xE66C3671, 0x7F6567CB, 0x0862575D, | ||
73 | 0x9606C2FE, 0xE101F268, 0x7808A3D2, 0x0F0F9344, | ||
74 | 0x82079EB1, 0xF500AE27, 0x6C09FF9D, 0x1B0ECF0B, | ||
75 | 0x856A5AA8, 0xF26D6A3E, 0x6B643B84, 0x1C630B12, | ||
76 | 0x8CDC1683, 0xFBDB2615, 0x62D277AF, 0x15D54739, | ||
77 | 0x8BB1D29A, 0xFCB6E20C, 0x65BFB3B6, 0x12B88320, | ||
78 | 0x3FBA6CAD, 0x48BD5C3B, 0xD1B40D81, 0xA6B33D17, | ||
79 | 0x38D7A8B4, 0x4FD09822, 0xD6D9C998, 0xA1DEF90E, | ||
80 | 0x3161E49F, 0x4666D409, 0xDF6F85B3, 0xA868B525, | ||
81 | 0x360C2086, 0x410B1010, 0xD80241AA, 0xAF05713C, | ||
82 | 0x220D7CC9, 0x550A4C5F, 0xCC031DE5, 0xBB042D73, | ||
83 | 0x2560B8D0, 0x52678846, 0xCB6ED9FC, 0xBC69E96A, | ||
84 | 0x2CD6F4FB, 0x5BD1C46D, 0xC2D895D7, 0xB5DFA541, | ||
85 | 0x2BBB30E2, 0x5CBC0074, 0xC5B551CE, 0xB2B26158, | ||
86 | 0x04D44C65, 0x73D37CF3, 0xEADA2D49, 0x9DDD1DDF, | ||
87 | 0x03B9887C, 0x74BEB8EA, 0xEDB7E950, 0x9AB0D9C6, | ||
88 | 0x0A0FC457, 0x7D08F4C1, 0xE401A57B, 0x930695ED, | ||
89 | 0x0D62004E, 0x7A6530D8, 0xE36C6162, 0x946B51F4, | ||
90 | 0x19635C01, 0x6E646C97, 0xF76D3D2D, 0x806A0DBB, | ||
91 | 0x1E0E9818, 0x6909A88E, 0xF000F934, 0x8707C9A2, | ||
92 | 0x17B8D433, 0x60BFE4A5, 0xF9B6B51F, 0x8EB18589, | ||
93 | 0x10D5102A, 0x67D220BC, 0xFEDB7106, 0x89DC4190, | ||
94 | 0x49662D3D, 0x3E611DAB, 0xA7684C11, 0xD06F7C87, | ||
95 | 0x4E0BE924, 0x390CD9B2, 0xA0058808, 0xD702B89E, | ||
96 | 0x47BDA50F, 0x30BA9599, 0xA9B3C423, 0xDEB4F4B5, | ||
97 | 0x40D06116, 0x37D75180, 0xAEDE003A, 0xD9D930AC, | ||
98 | 0x54D13D59, 0x23D60DCF, 0xBADF5C75, 0xCDD86CE3, | ||
99 | 0x53BCF940, 0x24BBC9D6, 0xBDB2986C, 0xCAB5A8FA, | ||
100 | 0x5A0AB56B, 0x2D0D85FD, 0xB404D447, 0xC303E4D1, | ||
101 | 0x5D677172, 0x2A6041E4, 0xB369105E, 0xC46E20C8, | ||
102 | 0x72080DF5, 0x050F3D63, 0x9C066CD9, 0xEB015C4F, | ||
103 | 0x7565C9EC, 0x0262F97A, 0x9B6BA8C0, 0xEC6C9856, | ||
104 | 0x7CD385C7, 0x0BD4B551, 0x92DDE4EB, 0xE5DAD47D, | ||
105 | 0x7BBE41DE, 0x0CB97148, 0x95B020F2, 0xE2B71064, | ||
106 | 0x6FBF1D91, 0x18B82D07, 0x81B17CBD, 0xF6B64C2B, | ||
107 | 0x68D2D988, 0x1FD5E91E, 0x86DCB8A4, 0xF1DB8832, | ||
108 | 0x616495A3, 0x1663A535, 0x8F6AF48F, 0xF86DC419, | ||
109 | 0x660951BA, 0x110E612C, 0x88073096, 0xFF000000 | ||
110 | }; | ||
111 | |||
112 | static unsigned int GetCRC(char *data, int size) | ||
113 | { | ||
114 | unsigned int crc = 0; | ||
115 | |||
116 | while (size--) | ||
117 | crc = crc32tab[(crc ^ *data++) & 0xff] ^ ((crc >> 8) & 0x00FFFFFF); | ||
118 | |||
119 | return crc; | ||
120 | } | ||
121 | |||
122 | /* | ||
123 | * Frame transfer | ||
124 | */ | ||
125 | |||
126 | static GSM_Error WaitFor(GSM_StateMachine *s, char *t, int ttl) | ||
127 | { | ||
128 | char readbuf[100]; | ||
129 | int n; | ||
130 | unsigned int sec; | ||
131 | GSM_DateTime Date; | ||
132 | |||
133 | GSM_GetCurrentDateTime (&Date); | ||
134 | sec = Date.Second; | ||
135 | |||
136 | n = s->Device.Functions->ReadDevice(s, readbuf, 80); | ||
137 | readbuf[n] = 0; | ||
138 | while (strstr(readbuf, t) == NULL && (sec + ttl) >= Date.Second) { | ||
139 | my_sleep(5000); | ||
140 | n = s->Device.Functions->ReadDevice(s, readbuf, 80); | ||
141 | readbuf[n] = 0; | ||
142 | GSM_GetCurrentDateTime (&Date); | ||
143 | } | ||
144 | |||
145 | return (sec + ttl) >= Date.Second ? ERR_NONE : ERR_TIMEOUT; | ||
146 | } | ||
147 | |||
148 | static GSM_Error SetSamsungFrame(GSM_StateMachine *s, unsigned char *buff, int size, GSM_Phone_RequestID id) | ||
149 | { | ||
150 | GSM_Phone_Data *Phone = &s->Phone.Data; | ||
151 | GSM_Error error; | ||
152 | int i, count; | ||
153 | |||
154 | count = size / BLKSZ; | ||
155 | |||
156 | for (i = 0; i < count; i++) { | ||
157 | error = WaitFor(s, ">", 4); | ||
158 | if (error!=ERR_NONE) return error; | ||
159 | |||
160 | error = s->Protocol.Functions->WriteMessage(s, | ||
161 | buff + i * BLKSZ, BLKSZ, 0x00); | ||
162 | if (error!=ERR_NONE) return error; | ||
163 | } | ||
164 | |||
165 | error = WaitFor(s, ">", 4); | ||
166 | if (error!=ERR_NONE) return error; | ||
167 | error = s->Protocol.Functions->WriteMessage(s, | ||
168 | buff + i * BLKSZ, size%BLKSZ, 0x00); | ||
169 | if (error!=ERR_NONE) return error; | ||
170 | |||
171 | error = GSM_WaitFor(s, "", 0, 0x00, 4, id); | ||
172 | if (error!=ERR_NONE) return error; | ||
173 | |||
174 | return Phone->DispatchError; | ||
175 | } | ||
176 | |||
177 | /* Answer format for binary data transfer | ||
178 | * | ||
179 | * SDNDCRC = 0xa : RECEIVECRC = 0xcbf53a1c : BINSIZE = 5 | ||
180 | * CRCERR | ||
181 | */ | ||
182 | static GSM_Error ReplySetSamsungFrame(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
183 | { | ||
184 | unsigned long txcrc, rxcrc; | ||
185 | int binsize; | ||
186 | char *pos; | ||
187 | |||
188 | /* Parse SDNDCRC */ | ||
189 | pos = strchr(msg.Buffer, '='); | ||
190 | if (!pos) return ERR_UNKNOWN; | ||
191 | pos++; | ||
192 | txcrc = strtoul(pos, NULL, 0); | ||
193 | smprintf(s, "Sent CRC : 0x%lx\n", txcrc); | ||
194 | |||
195 | /* Parse RECEIVECRC */ | ||
196 | pos = strchr(pos, '='); | ||
197 | if (!pos) return ERR_UNKNOWN; | ||
198 | pos++; | ||
199 | rxcrc = strtoul(pos, NULL, 0); | ||
200 | smprintf(s, "Reveived CRC : 0x%lx\n", rxcrc); | ||
201 | |||
202 | /* Parse BINSIZE */ | ||
203 | pos = strchr(pos, '='); | ||
204 | if (!pos) return ERR_UNKNOWN; | ||
205 | pos++; | ||
206 | binsize = strtoul(pos, NULL, 0); | ||
207 | smprintf(s, "Binary size : %d\n", binsize); | ||
208 | |||
209 | return txcrc == rxcrc ? ERR_NONE : ERR_WRONGCRC; | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Bitmaps | ||
214 | */ | ||
215 | |||
216 | GSM_Error SAMSUNG_ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
217 | { | ||
218 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | ||
219 | unsigned char buffer[32]; | ||
220 | char *pos; | ||
221 | int location, count; | ||
222 | |||
223 | switch (Priv->ReplyState) { | ||
224 | case AT_Reply_OK: | ||
225 | smprintf(s, "Bitmap info received\n"); | ||
226 | /* Parse +IMGR:location,name,0,0,0,0 */ | ||
227 | |||
228 | /* Parse location */ | ||
229 | pos = strchr(msg.Buffer, ':'); | ||
230 | if (!pos) return ERR_UNKNOWN; | ||
231 | pos++; | ||
232 | location = atoi(pos); | ||
233 | smprintf(s, "Location : %d\n", location); | ||
234 | |||
235 | /* Parse name */ | ||
236 | pos = strchr(pos, '"'); | ||
237 | if (!pos) return ERR_UNKNOWN; | ||
238 | pos++; | ||
239 | for (count = 0; count < 31; count++) { | ||
240 | if (pos[count] == '"') | ||
241 | break; | ||
242 | buffer[count] = pos[count]; | ||
243 | } | ||
244 | buffer[count] = 0; | ||
245 | smprintf(s, "Name : %s\n", buffer); | ||
246 | s->Phone.Data.Bitmap->Name = malloc((strlen(buffer) + 1) * 2); | ||
247 | if (s->Phone.Data.Bitmap->Name == NULL) | ||
248 | return ERR_MOREMEMORY; | ||
249 | EncodeUnicode(s->Phone.Data.Bitmap->Name, buffer, strlen(buffer)); | ||
250 | |||
251 | s->Phone.Data.Bitmap->Location = location; | ||
252 | |||
253 | return ERR_NONE; | ||
254 | case AT_Reply_Error: | ||
255 | return ERR_UNKNOWN; | ||
256 | case AT_Reply_CMSError: | ||
257 | return ATGEN_HandleCMSError(s); | ||
258 | case AT_Reply_CMEError: | ||
259 | return ATGEN_HandleCMEError(s); | ||
260 | default: | ||
261 | return ERR_UNKNOWNRESPONSE; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | GSM_Error SAMSUNG_ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
266 | { | ||
267 | smprintf(s, "Bitmap sent\n"); | ||
268 | return ReplySetSamsungFrame(msg, s); | ||
269 | } | ||
270 | |||
271 | GSM_Error SAMSUNG_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
272 | { | ||
273 | unsigned char req[100]; | ||
274 | |||
275 | s->Phone.Data.Bitmap=Bitmap; | ||
276 | smprintf(s, "Getting bitmap\n"); | ||
277 | sprintf(req, "AT+IMGR=%d\r", Bitmap->Location-1); | ||
278 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetBitmap); | ||
279 | } | ||
280 | |||
281 | GSM_Error SAMSUNG_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
282 | { | ||
283 | unsigned charreq[100]; | ||
284 | unsigned longcrc; | ||
285 | GSM_Errorerror; | ||
286 | char name[50], *dot, *model; | ||
287 | GSM_Phone_Data *Data = &s->Phone.Data; | ||
288 | int i; | ||
289 | |||
290 | s->Phone.Data.Bitmap = Bitmap; | ||
291 | smprintf(s, "Setting bitmap\n"); | ||
292 | |||
293 | if (Bitmap->Type != GSM_PictureBinary) { | ||
294 | smprintf(s, "Invalid picture type\n"); | ||
295 | return ERR_INVALIDDATA; | ||
296 | } | ||
297 | |||
298 | if (Bitmap->BinaryPic.Type != PICTURE_GIF) { | ||
299 | smprintf(s, "Invalid binary picture type\n"); | ||
300 | return ERR_INVALIDDATA; | ||
301 | } | ||
302 | |||
303 | /* Check if picture size matches phone model */ | ||
304 | model = GetModelData(NULL,Data->Model,NULL)->model; | ||
305 | smprintf(s, "Checking picture size for %s\n", model); | ||
306 | for (i = 0; modres[i].model; i++) { | ||
307 | if (!strcmp(model, modres[i].model)) { | ||
308 | if (Bitmap->BitmapWidth != modres[i].width || | ||
309 | Bitmap->BitmapHeight != modres[i].height) { | ||
310 | smprintf(s, "Model %s must use %d x %d picture size\n", | ||
311 | modres[i].model, modres[i].width, | ||
312 | modres[i].height); | ||
313 | return ERR_INVALIDDATA; | ||
314 | } | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | if (modres[i].model == NULL) { | ||
319 | smprintf(s, "Model \"%s\" is not supported.\n", Data->Model); | ||
320 | return ERR_NOTSUPPORTED; | ||
321 | } | ||
322 | |||
323 | crc = GetCRC(Bitmap->BinaryPic.Buffer, Bitmap->BinaryPic.Length); | ||
324 | |||
325 | /* Remove extension from file name */ | ||
326 | strncpy(name, DecodeUnicodeString(Bitmap->Name), 50); | ||
327 | if ((dot = strrchr(name, '.')) != NULL) | ||
328 | *dot = 0; | ||
329 | |||
330 | sprintf(req, "AT+IMGW=0,\"%s\",2,0,0,0,0,100,%d,%u\r", name, | ||
331 | Bitmap->BinaryPic.Length, (unsigned int)crc); | ||
332 | |||
333 | error = s->Protocol.Functions->WriteMessage(s, req, strlen(req), 0x00); | ||
334 | if (error!=ERR_NONE) return error; | ||
335 | |||
336 | return SetSamsungFrame(s, Bitmap->BinaryPic.Buffer, | ||
337 | Bitmap->BinaryPic.Length, ID_SetBitmap); | ||
338 | } | ||
339 | |||
340 | /* | ||
341 | * Ringtones | ||
342 | */ | ||
343 | |||
344 | GSM_Error SAMSUNG_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
345 | { | ||
346 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | ||
347 | unsigned char buffer[32]; | ||
348 | char *pos; | ||
349 | int location, length, count; | ||
350 | |||
351 | switch (Priv->ReplyState) { | ||
352 | case AT_Reply_OK: | ||
353 | smprintf(s, "Ringtone info received\n"); | ||
354 | /* Parse +MELR:location,name,size */ | ||
355 | |||
356 | /* Parse location */ | ||
357 | pos = strchr(msg.Buffer, ':'); | ||
358 | if (!pos) return ERR_UNKNOWN; | ||
359 | pos++; | ||
360 | location = atoi(pos); | ||
361 | smprintf(s, "Location : %d\n", location); | ||
362 | |||
363 | /* Parse name */ | ||
364 | pos = strchr(pos, '"'); | ||
365 | if (!pos) return ERR_UNKNOWN; | ||
366 | pos++; | ||
367 | /* Ringtone.Name size is 20 chars */ | ||
368 | for (count = 0; count < 19; count++) { | ||
369 | if (pos[count] == '"') | ||
370 | break; | ||
371 | buffer[count] = pos[count]; | ||
372 | } | ||
373 | buffer[count] = 0; | ||
374 | smprintf(s, "Name : %s\n", buffer); | ||
375 | EncodeUnicode(s->Phone.Data.Ringtone->Name,buffer,strlen(buffer)); | ||
376 | |||
377 | /* Parse ringtone length */ | ||
378 | pos = strchr(pos, ','); | ||
379 | if (!pos) return ERR_UNKNOWN; | ||
380 | pos++; | ||
381 | length = atoi(pos); | ||
382 | smprintf(s, "Length : %d\n", length); | ||
383 | |||
384 | /* S300 ringtones are always MMF */ | ||
385 | s->Phone.Data.Ringtone->Format = RING_MMF; | ||
386 | s->Phone.Data.Ringtone->Location = location; | ||
387 | s->Phone.Data.Ringtone->BinaryTone.Length = length; | ||
388 | |||
389 | return ERR_NONE; | ||
390 | case AT_Reply_Error: | ||
391 | return ERR_UNKNOWN; | ||
392 | case AT_Reply_CMSError: | ||
393 | return ATGEN_HandleCMSError(s); | ||
394 | case AT_Reply_CMEError: | ||
395 | return ATGEN_HandleCMEError(s); | ||
396 | default: | ||
397 | return ERR_UNKNOWNRESPONSE; | ||
398 | } | ||
399 | } | ||
400 | |||
401 | GSM_Error SAMSUNG_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | ||
402 | { | ||
403 | unsigned char req[100]; | ||
404 | |||
405 | s->Phone.Data.Ringtone = Ringtone; | ||
406 | smprintf(s, "Getting ringtone\n"); | ||
407 | sprintf(req, "AT+MELR=%d\r", Ringtone->Location-1); | ||
408 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetRingtone); | ||
409 | } | ||
410 | |||
411 | GSM_Error SAMSUNG_ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
412 | { | ||
413 | smprintf(s, "Ringtone sent\n"); | ||
414 | return ReplySetSamsungFrame(msg, s); | ||
415 | } | ||
416 | |||
417 | GSM_Error SAMSUNG_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | ||
418 | { | ||
419 | unsigned charreq[100]; | ||
420 | unsigned longcrc; | ||
421 | GSM_Errorerror; | ||
422 | char name[50], *dot; | ||
423 | |||
424 | s->Phone.Data.Ringtone = Ringtone; | ||
425 | smprintf(s, "Setting ringtone\n"); | ||
426 | |||
427 | if (Ringtone->Format != RING_MMF) { | ||
428 | smprintf(s, "Not MMF ringtone\n"); | ||
429 | return ERR_INVALIDDATA; | ||
430 | } | ||
431 | |||
432 | /* Remove extension from file name */ | ||
433 | strncpy(name, DecodeUnicodeString(Ringtone->Name), 50); | ||
434 | if ((dot = strrchr(name, '.')) != NULL) *dot = 0; | ||
435 | |||
436 | crc = GetCRC(Ringtone->BinaryTone.Buffer, Ringtone->BinaryTone.Length); | ||
437 | sprintf(req, "AT+MELW=0,\"%s\",4,%d,%u\r", name, | ||
438 | Ringtone->BinaryTone.Length, (unsigned int)crc); | ||
439 | |||
440 | error = s->Protocol.Functions->WriteMessage(s, req, strlen(req), 0x00); | ||
441 | if (error!=ERR_NONE) return error; | ||
442 | |||
443 | return SetSamsungFrame(s, Ringtone->BinaryTone.Buffer, | ||
444 | Ringtone->BinaryTone.Length, ID_SetRingtone); | ||
445 | } | ||
446 | |||
447 | #endif | ||
diff --git a/gammu/emb/common/phone/at/samsung.h b/gammu/emb/common/phone/at/samsung.h new file mode 100644 index 0000000..3b2947c --- a/dev/null +++ b/gammu/emb/common/phone/at/samsung.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef samsung_h | ||
2 | #define samsung_h | ||
3 | |||
4 | #include "../../gsmstate.h" | ||
5 | |||
6 | GSM_Error SAMSUNG_ReplyGetRingtone(GSM_Protocol_Message, GSM_StateMachine *); | ||
7 | GSM_Error SAMSUNG_ReplySetRingtone(GSM_Protocol_Message, GSM_StateMachine *); | ||
8 | GSM_Error SAMSUNG_ReplyGetBitmap(GSM_Protocol_Message, GSM_StateMachine *); | ||
9 | GSM_Error SAMSUNG_ReplySetBitmap(GSM_Protocol_Message, GSM_StateMachine *); | ||
10 | GSM_Error SAMSUNG_GetRingtone (GSM_StateMachine *, GSM_Ringtone *, bool); | ||
11 | GSM_Error SAMSUNG_SetRingtone (GSM_StateMachine *, GSM_Ringtone *, int *); | ||
12 | GSM_Error SAMSUNG_GetBitmap (GSM_StateMachine *, GSM_Bitmap *); | ||
13 | GSM_Error SAMSUNG_SetBitmap (GSM_StateMachine *, GSM_Bitmap *); | ||
14 | GSM_Error SAMSUNG_GetCallLogs (GSM_StateMachine *, GSM_MemoryEntry *, int); | ||
15 | |||
16 | #endif | ||
diff --git a/gammu/emb/common/phone/at/siemens.c b/gammu/emb/common/phone/at/siemens.c index ab7dd2c..7f66cf8 100644 --- a/gammu/emb/common/phone/at/siemens.c +++ b/gammu/emb/common/phone/at/siemens.c | |||
@@ -1,310 +1,306 @@ | |||
1 | /* (c) 2002-2003 by Walek */ | 1 | /* (c) 2002-2003 by Walek */ |
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 "../../misc/coding/coding.h" | 11 | #include "../../misc/coding/coding.h" |
12 | #include "../../gsmcomon.h" | 12 | #include "../../gsmcomon.h" |
13 | #include "../../service/sms/gsmsms.h" | 13 | #include "../../service/sms/gsmsms.h" |
14 | #include "../pfunc.h" | 14 | #include "../pfunc.h" |
15 | 15 | ||
16 | extern GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s); | 16 | #include "atgen.h" |
17 | #include "siemens.h" | ||
17 | 18 | ||
18 | GSM_Error ATGEN_CMS35ReplySetFunction (GSM_Protocol_Message msg, GSM_StateMachine *s,char *function) | ||
19 | { | ||
20 | if (s->Protocol.Data.AT.EditMode) { | ||
21 | s->Protocol.Data.AT.EditMode = false; | ||
22 | return ERR_NONE; | ||
23 | } | ||
24 | dbgprintf ("Written %s",function); | ||
25 | if (s->Phone.Data.Priv.ATGEN.ReplyState == AT_Reply_OK){ | ||
26 | dbgprintf (" - OK\n"); | ||
27 | return ERR_NONE; | ||
28 | } else { | ||
29 | dbgprintf (" - error\n"); | ||
30 | return ERR_UNKNOWN; | ||
31 | } | ||
32 | } | ||
33 | 19 | ||
34 | GSM_Error GetSiemensFrame(GSM_Protocol_Message msg, GSM_StateMachine *s, char *templ, | 20 | static GSM_Error GetSiemensFrame(GSM_Protocol_Message msg, GSM_StateMachine *s, char *templ, |
35 | unsigned char *buffer, int *len) | 21 | unsigned char *buffer, int *len) |
36 | { | 22 | { |
37 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 23 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
38 | int i=2, pos=0, length=0; | 24 | int i=2, pos=0, length=0; |
39 | unsigned char buf[512]; | 25 | unsigned char buf[512]; |
40 | 26 | ||
41 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"OK")) return ERR_EMPTY; | 27 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"OK")) return ERR_EMPTY; |
42 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,2),templ)) return ERR_UNKNOWN; | 28 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,2),templ)) return ERR_UNKNOWN; |
43 | 29 | ||
44 | while (1) { | 30 | while (1) { |
45 | if (Priv->Lines.numbers[i*2+1]==0) break; | 31 | if (Priv->Lines.numbers[i*2+1]==0) break; |
46 | if ((!strstr(GetLineString(msg.Buffer,Priv->Lines,i+1),templ)) && | 32 | if ((!strstr(GetLineString(msg.Buffer,Priv->Lines,i+1),templ)) && |
47 | (strstr(GetLineString(msg.Buffer,Priv->Lines,i),templ))){ | 33 | (strstr(GetLineString(msg.Buffer,Priv->Lines,i),templ))){ |
48 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,i+1)); | 34 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,i+1)); |
49 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,i+1),length); | 35 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,i+1),length); |
50 | length = length/2; | 36 | length = length/2; |
51 | memcpy (buffer+pos,buf,length); | 37 | memcpy (buffer+pos,buf,length); |
52 | pos+=length; | 38 | pos+=length; |
53 | } | 39 | } |
54 | i++; | 40 | i++; |
55 | } | 41 | } |
56 | *len = pos; | 42 | *len = pos; |
57 | return ERR_NONE; | 43 | return ERR_NONE; |
58 | } | 44 | } |
59 | 45 | ||
60 | GSM_Error SetSiemensFrame (GSM_StateMachine *s, unsigned char *buff, char *templ, | 46 | static GSM_Error SetSiemensFrame (GSM_StateMachine *s, unsigned char *buff, char *templ, |
61 | int Location, GSM_Phone_RequestID RequestID, int len) | 47 | int Location, GSM_Phone_RequestID RequestID, int len) |
62 | { | 48 | { |
63 | GSM_Phone_Data *Phone = &s->Phone.Data; | 49 | GSM_Phone_Data *Phone = &s->Phone.Data; |
64 | GSM_Error error; | 50 | GSM_Error error; |
65 | unsigned char req[20],req1[512],hexreq[2096]; | 51 | unsigned char req[20],req1[512],hexreq[2096]; |
66 | int MaxFrame,CurrentFrame,size,sz,pos=0; | 52 | int MaxFrame,CurrentFrame,size,sz,pos=0; |
67 | 53 | ||
68 | EncodeHexBin(hexreq,buff,len); | 54 | EncodeHexBin(hexreq,buff,len); |
69 | size = len * 2; | 55 | size = len * 2; |
70 | MaxFrame = size / 352; | 56 | MaxFrame = size / 352; |
71 | if (size % 352) MaxFrame++; | 57 | if (size % 352) MaxFrame++; |
72 | 58 | ||
73 | for (CurrentFrame=0;CurrentFrame<MaxFrame;CurrentFrame++) { | 59 | for (CurrentFrame=0;CurrentFrame<MaxFrame;CurrentFrame++) { |
74 | pos=CurrentFrame*352; | 60 | pos=CurrentFrame*352; |
75 | if (pos+352 < size) sz = 352; else sz = size - pos; | 61 | if (pos+352 < size) sz = 352; else sz = size - pos; |
76 | sprintf(req, "AT^SBNW=\"%s\",%i,%i,%i\r",templ,Location,CurrentFrame+1,MaxFrame); | 62 | sprintf(req, "AT^SBNW=\"%s\",%i,%i,%i\r",templ,Location,CurrentFrame+1,MaxFrame); |
77 | s->Protocol.Data.AT.EditMode = true; | 63 | s->Protocol.Data.AT.EditMode = true; |
78 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 3, RequestID); | 64 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 3, RequestID); |
79 | s->Phone.Data.DispatchError=ERR_TIMEOUT; | 65 | s->Phone.Data.DispatchError=ERR_TIMEOUT; |
80 | s->Phone.Data.RequestID=RequestID; | 66 | s->Phone.Data.RequestID=RequestID; |
81 | if (error!=ERR_NONE) return error; | 67 | if (error!=ERR_NONE) return error; |
82 | memcpy (req1,hexreq+pos,sz); | 68 | memcpy (req1,hexreq+pos,sz); |
83 | error = s->Protocol.Functions->WriteMessage(s, req1, sz, 0x00); | 69 | error = s->Protocol.Functions->WriteMessage(s, req1, sz, 0x00); |
84 | if (error!=ERR_NONE) return error; | 70 | if (error!=ERR_NONE) return error; |
85 | error = s->Protocol.Functions->WriteMessage(s,"\x1A", 1, 0x00); | 71 | error = s->Protocol.Functions->WriteMessage(s,"\x1A", 1, 0x00); |
86 | if (error!=ERR_NONE) return error; | 72 | if (error!=ERR_NONE) return error; |
87 | error = GSM_WaitForOnce(s, NULL, 0x00, 0x00, 4); | 73 | error = GSM_WaitForOnce(s, NULL, 0x00, 0x00, 4); |
88 | if (error == ERR_TIMEOUT) return error; | 74 | if (error == ERR_TIMEOUT) return error; |
89 | } | 75 | } |
90 | return Phone->DispatchError; | 76 | return Phone->DispatchError; |
91 | } | 77 | } |
92 | 78 | ||
93 | GSM_Error ATGEN_CMS35ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | 79 | GSM_Error SIEMENS_ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) |
94 | { | 80 | { |
95 | unsigned char buffer[4096]; | 81 | unsigned char buffer[4096]; |
96 | int length; | 82 | int length; |
97 | GSM_Error error; | 83 | GSM_Error error; |
98 | 84 | ||
99 | error = GetSiemensFrame(msg,s,"bmp",buffer,&length); | 85 | error = GetSiemensFrame(msg,s,"bmp",buffer,&length); |
100 | if (error!=ERR_NONE) return error; | 86 | if (error!=ERR_NONE) return error; |
101 | dbgprintf ("Operator logo received lenght=%i\n",length); | 87 | dbgprintf ("Operator logo received lenght=%i\n",length); |
102 | error = BMP2Bitmap (buffer,NULL,s->Phone.Data.Bitmap); | 88 | error = BMP2Bitmap (buffer,NULL,s->Phone.Data.Bitmap); |
103 | if (error==ERR_NONE) return error; | 89 | if (error==ERR_NONE) return error; |
104 | else return ERR_UNKNOWN; | 90 | else return ERR_UNKNOWN; |
105 | } | 91 | } |
106 | 92 | ||
107 | GSM_Error ATGEN_CMS35ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | 93 | GSM_Error SIEMENS_ReplySetFunction (GSM_Protocol_Message msg, GSM_StateMachine *s,char *function) |
108 | { | 94 | { |
109 | return ATGEN_CMS35ReplySetFunction (msg, s, "Operator Logo"); | 95 | if (s->Protocol.Data.AT.EditMode) { |
96 | s->Protocol.Data.AT.EditMode = false; | ||
97 | return ERR_NONE; | ||
98 | } | ||
99 | dbgprintf ("Written %s",function); | ||
100 | if (s->Phone.Data.Priv.ATGEN.ReplyState == AT_Reply_OK){ | ||
101 | dbgprintf (" - OK\n"); | ||
102 | return ERR_NONE; | ||
103 | } else { | ||
104 | dbgprintf (" - error\n"); | ||
105 | return ERR_UNKNOWN; | ||
106 | } | ||
110 | } | 107 | } |
111 | 108 | ||
112 | GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | 109 | GSM_Error SIEMENS_ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) |
110 | { | ||
111 | return SIEMENS_ReplySetFunction (msg, s, "Operator Logo"); | ||
112 | } | ||
113 | |||
114 | GSM_Error SIEMENS_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
113 | { | 115 | { |
114 | unsigned char req[32]; | 116 | unsigned char req[32]; |
115 | 117 | ||
116 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
117 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; | 118 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; |
118 | if (Bitmap->Location-1 < 0) Bitmap->Location++; | 119 | if (Bitmap->Location-1 < 0) Bitmap->Location++; |
119 | s->Phone.Data.Bitmap=Bitmap; | 120 | s->Phone.Data.Bitmap=Bitmap; |
120 | sprintf(req, "AT^SBNR=\"bmp\",%i\r", Bitmap->Location-1); | 121 | sprintf(req, "AT^SBNR=\"bmp\",%i\r", Bitmap->Location-1); |
121 | smprintf(s, "Getting Bitmap\n"); | 122 | smprintf(s, "Getting Bitmap\n"); |
122 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetBitmap); | 123 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetBitmap); |
123 | } | 124 | } |
124 | 125 | ||
125 | GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | 126 | GSM_Error SIEMENS_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) |
126 | { | 127 | { |
127 | unsigned char buffer[4096]; | 128 | unsigned char buffer[4096]; |
128 | int length; | 129 | int length; |
129 | GSM_Errorerror; | 130 | GSM_Errorerror; |
130 | 131 | ||
131 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
132 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; | 132 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; |
133 | 133 | ||
134 | error = Bitmap2BMP (buffer,NULL,Bitmap); | 134 | error = Bitmap2BMP (buffer,NULL,Bitmap); |
135 | if (error!=ERR_NONE) return error; | 135 | if (error!=ERR_NONE) return error; |
136 | length = 0x100 * buffer[3] + buffer[2]; | 136 | length = 0x100 * buffer[3] + buffer[2]; |
137 | buffer[58]=0xff; buffer[59]=0xff; buffer[60]=0xff; | 137 | buffer[58]=0xff; buffer[59]=0xff; buffer[60]=0xff; |
138 | if (Bitmap->Location-1 < 0) Bitmap->Location++; | 138 | if (Bitmap->Location-1 < 0) Bitmap->Location++; |
139 | s->Phone.Data.Bitmap=Bitmap; | 139 | s->Phone.Data.Bitmap=Bitmap; |
140 | return SetSiemensFrame(s, buffer,"bmp",Bitmap->Location-1, | 140 | return SetSiemensFrame(s, buffer,"bmp",Bitmap->Location-1, |
141 | ID_SetBitmap,length); | 141 | ID_SetBitmap,length); |
142 | } | 142 | } |
143 | 143 | ||
144 | GSM_Error ATGEN_CMS35ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | 144 | GSM_Error SIEMENS_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) |
145 | { | 145 | { |
146 | unsigned char buffer[32]; | 146 | unsigned char buffer[32]; |
147 | int length; | 147 | int length; |
148 | GSM_Error error; | 148 | GSM_Error error; |
149 | 149 | ||
150 | error = GetSiemensFrame(msg,s,"mid",s->Phone.Data.Ringtone->NokiaBinary.Frame,&length); | 150 | error = GetSiemensFrame(msg,s,"mid",s->Phone.Data.Ringtone->NokiaBinary.Frame,&length); |
151 | if (error!=ERR_NONE) return error; | 151 | if (error!=ERR_NONE) return error; |
152 | dbgprintf ("Midi ringtone received\n"); | 152 | dbgprintf ("Midi ringtone received\n"); |
153 | 153 | ||
154 | s->Phone.Data.Ringtone->Format = RING_MIDI; | 154 | s->Phone.Data.Ringtone->Format = RING_MIDI; |
155 | s->Phone.Data.Ringtone->NokiaBinary.Length= length; | 155 | s->Phone.Data.Ringtone->NokiaBinary.Length= length; |
156 | sprintf(buffer,"Individual"); | 156 | sprintf(buffer,"Individual"); |
157 | EncodeUnicode (s->Phone.Data.Ringtone->Name,buffer,strlen(buffer)); | 157 | EncodeUnicode (s->Phone.Data.Ringtone->Name,buffer,strlen(buffer)); |
158 | return ERR_NONE; | 158 | return ERR_NONE; |
159 | } | 159 | } |
160 | 160 | ||
161 | GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | 161 | GSM_Error SIEMENS_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) |
162 | { | 162 | { |
163 | unsigned char req[32]; | 163 | unsigned char req[32]; |
164 | 164 | ||
165 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
166 | |||
167 | s->Phone.Data.Ringtone=Ringtone; | 165 | s->Phone.Data.Ringtone=Ringtone; |
168 | sprintf(req, "AT^SBNR=\"mid\",%i\r", Ringtone->Location-1); | 166 | sprintf(req, "AT^SBNR=\"mid\",%i\r", Ringtone->Location-1); |
169 | smprintf(s, "Getting RingTone\n"); | 167 | smprintf(s, "Getting RingTone\n"); |
170 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetRingtone); | 168 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetRingtone); |
171 | } | 169 | } |
172 | 170 | ||
173 | GSM_Error ATGEN_CMS35ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | 171 | GSM_Error SIEMENS_ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) |
174 | { | 172 | { |
175 | return ATGEN_CMS35ReplySetFunction (msg, s, "Ringtone"); | 173 | return SIEMENS_ReplySetFunction (msg, s, "Ringtone"); |
176 | } | 174 | } |
177 | 175 | ||
178 | GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | 176 | GSM_Error SIEMENS_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) |
179 | { | 177 | { |
180 | GSM_Phone_Data *Phone = &s->Phone.Data; | 178 | GSM_Phone_Data *Phone = &s->Phone.Data; |
181 | 179 | ||
182 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
183 | |||
184 | if (Ringtone->Location==255) Ringtone->Location=1; | 180 | if (Ringtone->Location==255) Ringtone->Location=1; |
185 | if (Ringtone->Location-1 > 1) return ERR_INVALIDLOCATION; | 181 | if (Ringtone->Location-1 > 1) return ERR_INVALIDLOCATION; |
186 | 182 | ||
187 | s->Phone.Data.Ringtone= Ringtone; | 183 | s->Phone.Data.Ringtone= Ringtone; |
188 | Phone->Ringtone = Ringtone; | 184 | Phone->Ringtone = Ringtone; |
189 | return SetSiemensFrame(s, Ringtone->NokiaBinary.Frame,"mid",Ringtone->Location-1, | 185 | return SetSiemensFrame(s, Ringtone->NokiaBinary.Frame,"mid",Ringtone->Location-1, |
190 | ID_SetRingtone,Ringtone->NokiaBinary.Length); | 186 | ID_SetRingtone,Ringtone->NokiaBinary.Length); |
191 | } | 187 | } |
192 | 188 | ||
193 | GSM_Error ATGEN_CMS35ReplyGetNextCal(GSM_Protocol_Message msg, GSM_StateMachine *s) | 189 | GSM_Error SIEMENS_ReplyGetNextCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s) |
194 | { | 190 | { |
195 | GSM_Phone_Data *Data = &s->Phone.Data; | 191 | GSM_Phone_Data *Data = &s->Phone.Data; |
196 | GSM_CalendarEntry*Calendar = Data->Cal; | 192 | GSM_CalendarEntry*Calendar = Data->Cal; |
197 | GSM_ToDoEntry ToDo; | 193 | GSM_ToDoEntry ToDo; |
198 | GSM_Error error; | 194 | GSM_Error error; |
199 | unsigned char buffer[354]; | 195 | unsigned char buffer[354]; |
200 | int len, pos=0; | 196 | int len, pos=0; |
201 | 197 | ||
202 | if (Data->Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_UNKNOWN; | 198 | if (Data->Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_UNKNOWN; |
203 | 199 | ||
204 | error = GetSiemensFrame(msg,s,"vcs",buffer,&len); | 200 | error = GetSiemensFrame(msg,s,"vcs",buffer,&len); |
205 | if (error!=ERR_NONE) return error; | 201 | if (error!=ERR_NONE) return error; |
206 | error=GSM_DecodeVCALENDAR_VTODO(buffer,&pos,Calendar,&ToDo,Siemens_VCalendar,0); | 202 | error=GSM_DecodeVCALENDAR_VTODO(buffer,&pos,Calendar,&ToDo,Siemens_VCalendar,0); |
207 | 203 | ||
208 | return error; | 204 | return error; |
209 | } | 205 | } |
210 | 206 | ||
211 | GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) | 207 | GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) |
212 | { | 208 | { |
213 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 209 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
214 | GSM_Error error; | 210 | GSM_Error error; |
215 | unsigned char req[32]; | 211 | unsigned char req[32]; |
216 | int Location; | 212 | int Location; |
217 | 213 | ||
218 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | 214 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; |
219 | 215 | ||
220 | if (start) Note->Location=Priv->FirstCalendarPos; | 216 | if (start) Note->Location=Priv->FirstCalendarPos; |
221 | s->Phone.Data.Cal = Note; | 217 | s->Phone.Data.Cal = Note; |
222 | Note->EntriesNum = 0; | 218 | Note->EntriesNum = 0; |
223 | smprintf(s, "Getting VCALENDAR\n"); | 219 | smprintf(s, "Getting VCALENDAR\n"); |
224 | Location = Note->Location; | 220 | Location = Note->Location; |
225 | while (1){ | 221 | while (1){ |
226 | Location++; | 222 | Location++; |
227 | sprintf(req, "AT^SBNR=\"vcs\",%i\r",Location); | 223 | sprintf(req, "AT^SBNR=\"vcs\",%i\r",Location); |
228 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetCalendarNote); | 224 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetCalendarNote); |
229 | if ((error!=ERR_NONE) && (error!=ERR_EMPTY)) return ERR_INVALIDLOCATION; | 225 | if ((error!=ERR_NONE) && (error!=ERR_EMPTY)) return ERR_INVALIDLOCATION; |
230 | Note->Location = Location; | 226 | Note->Location = Location; |
231 | Priv->FirstCalendarPos = Location; | 227 | Priv->FirstCalendarPos = Location; |
232 | if (Location > MAX_VCALENDAR_LOCATION) return ERR_EMPTY; | 228 | if (Location > MAX_VCALENDAR_LOCATION) return ERR_EMPTY; |
233 | if (error==ERR_NONE) return error; | 229 | if (error==ERR_NONE) return error; |
234 | } | 230 | } |
235 | return error; | 231 | return error; |
236 | } | 232 | } |
237 | 233 | ||
238 | GSM_Error ATGEN_CMS35ReplySetCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s) | 234 | GSM_Error SIEMENS_ReplyAddCalendarNote(GSM_Protocol_Message msg, GSM_StateMachine *s) |
239 | { | 235 | { |
240 | return ATGEN_CMS35ReplySetFunction (msg, s, "Calendar Note"); | 236 | return SIEMENS_ReplySetFunction (msg, s, "Calendar Note"); |
241 | } | 237 | } |
242 | 238 | ||
243 | GSM_Error ATGEN_CMS35ReplyDeleteCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s) | 239 | GSM_Error SIEMENS_ReplyDelCalendarNote(GSM_Protocol_Message msg, GSM_StateMachine *s) |
244 | { | 240 | { |
245 | GSM_Phone_Data *Data = &s->Phone.Data; | 241 | GSM_Phone_Data *Data = &s->Phone.Data; |
246 | 242 | ||
247 | if (Data->Cal->Location > MAX_VCALENDAR_LOCATION) return ERR_UNKNOWN; | 243 | if (Data->Cal->Location > MAX_VCALENDAR_LOCATION) return ERR_UNKNOWN; |
248 | 244 | ||
249 | if (Data->Priv.ATGEN.ReplyState== AT_Reply_OK) { | 245 | if (Data->Priv.ATGEN.ReplyState== AT_Reply_OK) { |
250 | smprintf(s, "Calendar note deleted\n"); | 246 | smprintf(s, "Calendar note deleted\n"); |
251 | return ERR_NONE; | 247 | return ERR_NONE; |
252 | } else { | 248 | } else { |
253 | smprintf(s, "Can't delete calendar note\n"); | 249 | smprintf(s, "Can't delete calendar note\n"); |
254 | return ERR_UNKNOWN; | 250 | return ERR_UNKNOWN; |
255 | } | 251 | } |
256 | } | 252 | } |
257 | 253 | ||
258 | GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 254 | GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
259 | { | 255 | { |
260 | unsigned char req[32]; | 256 | unsigned char req[32]; |
261 | 257 | ||
262 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | 258 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; |
263 | s->Phone.Data.Cal = Note; | 259 | s->Phone.Data.Cal = Note; |
264 | sprintf(req, "AT^SBNW=\"vcs\",%i,0\r",Note->Location); | 260 | sprintf(req, "AT^SBNW=\"vcs\",%i,0\r",Note->Location); |
265 | smprintf(s, "Deleting calendar note\n"); | 261 | smprintf(s, "Deleting calendar note\n"); |
266 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_DeleteCalendarNote); | 262 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_DeleteCalendarNote); |
267 | } | 263 | } |
268 | 264 | ||
269 | GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 265 | GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
270 | { | 266 | { |
271 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 267 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
272 | GSM_Error error; | 268 | GSM_Error error; |
273 | unsigned char req[500]; | 269 | unsigned char req[500]; |
274 | int size=0; | 270 | int size=0; |
275 | 271 | ||
276 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | 272 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; |
277 | // if (Note->Location==0x00) return ERR_INVALIDLOCATION; | 273 | // if (Note->Location==0x00) return ERR_INVALIDLOCATION; |
278 | 274 | ||
279 | s->Phone.Data.Cal = Note; | 275 | s->Phone.Data.Cal = Note; |
280 | error=GSM_EncodeVCALENDAR(req,&size,Note,true,Siemens_VCalendar); | 276 | error=GSM_EncodeVCALENDAR(req,&size,Note,true,Siemens_VCalendar); |
281 | 277 | ||
282 | return SetSiemensFrame (s,req,"vcs",Note->Location,ID_SetCalendarNote,size); | 278 | return SetSiemensFrame (s,req,"vcs",Note->Location,ID_SetCalendarNote,size); |
283 | } | 279 | } |
284 | 280 | ||
285 | /* (c) by Timo Teras */ | 281 | /* (c) by Timo Teras */ |
286 | GSM_Error ATGEN_SL45ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | 282 | GSM_Error SIEMENS_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) |
287 | { | 283 | { |
288 | #ifndef ENABLE_LGPL | 284 | #ifndef ENABLE_LGPL |
289 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 285 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
290 | GSM_MemoryEntry *Memory = s->Phone.Data.Memory; | 286 | GSM_MemoryEntry *Memory = s->Phone.Data.Memory; |
291 | unsigned char buffer[500],buffer2[500]; | 287 | unsigned char buffer[500],buffer2[500]; |
292 | 288 | ||
293 | switch (Priv->ReplyState) { | 289 | switch (Priv->ReplyState) { |
294 | case AT_Reply_OK: | 290 | case AT_Reply_OK: |
295 | smprintf(s, "Phonebook entry received\n"); | 291 | smprintf(s, "Phonebook entry received\n"); |
296 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 3); | 292 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 3); |
297 | DecodeHexBin(buffer2,buffer,strlen(buffer)); | 293 | DecodeHexBin(buffer2,buffer,strlen(buffer)); |
298 | Memory->EntriesNum = 0; | 294 | Memory->EntriesNum = 0; |
299 | DecodeVCARD21Text(buffer2, Memory); | 295 | DecodeVCARD21Text(buffer2, Memory); |
300 | if (Memory->EntriesNum == 0) return ERR_EMPTY; | 296 | if (Memory->EntriesNum == 0) return ERR_EMPTY; |
301 | return ERR_NONE; | 297 | return ERR_NONE; |
302 | case AT_Reply_Error: | 298 | case AT_Reply_Error: |
303 | smprintf(s, "Error - too high location ?\n"); | 299 | smprintf(s, "Error - too high location ?\n"); |
304 | return ERR_INVALIDLOCATION; | 300 | return ERR_INVALIDLOCATION; |
305 | case AT_Reply_CMSError: | 301 | case AT_Reply_CMSError: |
306 | return ATGEN_HandleCMSError(s); | 302 | return ATGEN_HandleCMSError(s); |
307 | default: | 303 | default: |
308 | break; | 304 | break; |
309 | } | 305 | } |
310 | return ERR_UNKNOWNRESPONSE; | 306 | return ERR_UNKNOWNRESPONSE; |
diff --git a/gammu/emb/common/phone/at/sonyeric.c b/gammu/emb/common/phone/at/sonyeric.c index 4b2670a..8eeb39b 100644 --- a/gammu/emb/common/phone/at/sonyeric.c +++ b/gammu/emb/common/phone/at/sonyeric.c | |||
@@ -1,48 +1,46 @@ | |||
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 | extern GSM_Reply_Function ATGENReplyFunctions[]; | 14 | #include "atgen.h" |
15 | extern GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s); | 15 | #include "sonyeric.h" |
16 | 16 | ||
17 | #ifdef GSM_ENABLE_OBEXGEN | 17 | #ifdef GSM_ENABLE_OBEXGEN |
18 | 18 | ||
19 | extern GSM_Reply_Function OBEXGENReplyFunctions[]; | 19 | #include "../obex/obexgen.h" |
20 | extern GSM_Error OBEXGEN_GetFilePart(GSM_StateMachine *s, GSM_File *File); | ||
21 | extern GSM_Error OBEXGEN_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos); | ||
22 | extern GSM_Error OBEXGEN_Disconnect(GSM_StateMachine *s); | ||
23 | 20 | ||
24 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 21 | extern GSM_Reply_FunctionOBEXGENReplyFunctions[]; |
22 | extern GSM_Reply_FunctionATGENReplyFunctions[]; | ||
25 | 23 | ||
26 | static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s) | 24 | static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s) |
27 | { | 25 | { |
28 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 26 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
29 | GSM_Error error; | 27 | GSM_Error error; |
30 | 28 | ||
31 | if (Priv->OBEX) return ERR_NONE; | 29 | if (Priv->OBEX) return ERR_NONE; |
32 | 30 | ||
33 | dbgprintf ("Changing to OBEX\n"); | 31 | dbgprintf ("Changing to OBEX\n"); |
34 | 32 | ||
35 | error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX); | 33 | error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX); |
36 | if (error != ERR_NONE) return error; | 34 | if (error != ERR_NONE) return error; |
37 | 35 | ||
38 | error = s->Protocol.Functions->Terminate(s); | 36 | error = s->Protocol.Functions->Terminate(s); |
39 | if (error != ERR_NONE) return error; | 37 | if (error != ERR_NONE) return error; |
40 | 38 | ||
41 | s->Protocol.Functions = &OBEXProtocol; | 39 | s->Protocol.Functions = &OBEXProtocol; |
42 | error = s->Protocol.Functions->Initialise(s); | 40 | error = s->Protocol.Functions->Initialise(s); |
43 | if (error != ERR_NONE) { | 41 | if (error != ERR_NONE) { |
44 | s->Protocol.Functions = &ATProtocol; | 42 | s->Protocol.Functions = &ATProtocol; |
45 | return error; | 43 | return error; |
46 | } | 44 | } |
47 | strcpy(s->CurrentConfig->Model,"seobex"); | 45 | strcpy(s->CurrentConfig->Model,"seobex"); |
48 | s->Phone.Data.Priv.OBEXGEN.Service = 0; | 46 | s->Phone.Data.Priv.OBEXGEN.Service = 0; |
@@ -105,190 +103,190 @@ static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName, | |||
105 | GSM_File File; | 103 | GSM_File File; |
106 | int Pos = 0; | 104 | int Pos = 0; |
107 | 105 | ||
108 | error = SONYERIC_SetOBEXMode(s); | 106 | error = SONYERIC_SetOBEXMode(s); |
109 | if (error != ERR_NONE) return error; | 107 | if (error != ERR_NONE) return error; |
110 | 108 | ||
111 | strcpy(File.ID_FullName,FileName); | 109 | strcpy(File.ID_FullName,FileName); |
112 | EncodeUnicode(File.Name,FileName,strlen(FileName)); | 110 | EncodeUnicode(File.Name,FileName,strlen(FileName)); |
113 | File.Used = Length; | 111 | File.Used = Length; |
114 | File.Buffer = malloc(Length); | 112 | File.Buffer = malloc(Length); |
115 | memcpy(File.Buffer,Buffer,Length); | 113 | memcpy(File.Buffer,Buffer,Length); |
116 | 114 | ||
117 | error = ERR_NONE; | 115 | error = ERR_NONE; |
118 | while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos); | 116 | while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos); |
119 | free(File.Buffer); | 117 | free(File.Buffer); |
120 | if (error != ERR_EMPTY) return error; | 118 | if (error != ERR_EMPTY) return error; |
121 | 119 | ||
122 | return SONYERIC_SetATMode(s); | 120 | return SONYERIC_SetATMode(s); |
123 | } | 121 | } |
124 | 122 | ||
125 | #endif | 123 | #endif |
126 | 124 | ||
127 | GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) | 125 | GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) |
128 | { | 126 | { |
129 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 127 | #ifdef GSM_ENABLE_OBEXGEN |
130 | GSM_Error error; | 128 | GSM_Error error; |
131 | GSM_ToDoEntry ToDo; | 129 | GSM_ToDoEntry ToDo; |
132 | int Pos, num, Loc; | 130 | int Pos, num, Loc; |
133 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 131 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
134 | 132 | ||
135 | if (start) { | 133 | if (start) { |
136 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 134 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
137 | if (error != ERR_NONE) return error; | 135 | if (error != ERR_NONE) return error; |
138 | 136 | ||
139 | Note->Location = 1; | 137 | Note->Location = 1; |
140 | } else { | 138 | } else { |
141 | Note->Location++; | 139 | Note->Location++; |
142 | } | 140 | } |
143 | smprintf(s, "Getting calendar note %i\n",Note->Location); | 141 | smprintf(s, "Getting calendar note %i\n",Note->Location); |
144 | 142 | ||
145 | Loc = Note->Location; | 143 | Loc = Note->Location; |
146 | Pos = 0; | 144 | Pos = 0; |
147 | num = 0; | 145 | num = 0; |
148 | while (1) { | 146 | while (1) { |
149 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, Note, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); | 147 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, Note, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); |
150 | if (error == ERR_EMPTY) break; | 148 | if (error == ERR_EMPTY) break; |
151 | if (error != ERR_NONE) return error; | 149 | if (error != ERR_NONE) return error; |
152 | if (Note->EntriesNum != 0) { | 150 | if (Note->EntriesNum != 0) { |
153 | num++; | 151 | num++; |
154 | if (num == Loc) return ERR_NONE; | 152 | if (num == Loc) return ERR_NONE; |
155 | } | 153 | } |
156 | } | 154 | } |
157 | return ERR_EMPTY; | 155 | return ERR_EMPTY; |
158 | #else | 156 | #else |
159 | return ERR_SOURCENOTAVAILABLE; | 157 | return ERR_SOURCENOTAVAILABLE; |
160 | #endif | 158 | #endif |
161 | } | 159 | } |
162 | 160 | ||
163 | GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start) | 161 | GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start) |
164 | { | 162 | { |
165 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 163 | #ifdef GSM_ENABLE_OBEXGEN |
166 | GSM_Error error; | 164 | GSM_Error error; |
167 | GSM_CalendarEntryCalendar; | 165 | GSM_CalendarEntryCalendar; |
168 | int Pos, num, Loc; | 166 | int Pos, num, Loc; |
169 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 167 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
170 | 168 | ||
171 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 169 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
172 | 170 | ||
173 | if (start) { | 171 | if (start) { |
174 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 172 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
175 | if (error != ERR_NONE) return error; | 173 | if (error != ERR_NONE) return error; |
176 | 174 | ||
177 | ToDo->Location = 1; | 175 | ToDo->Location = 1; |
178 | } else { | 176 | } else { |
179 | ToDo->Location++; | 177 | ToDo->Location++; |
180 | } | 178 | } |
181 | smprintf(s,"Getting ToDo %i\n",ToDo->Location); | 179 | smprintf(s,"Getting ToDo %i\n",ToDo->Location); |
182 | 180 | ||
183 | Loc = ToDo->Location; | 181 | Loc = ToDo->Location; |
184 | Pos = 0; | 182 | Pos = 0; |
185 | num = 0; | 183 | num = 0; |
186 | while (1) { | 184 | while (1) { |
187 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); | 185 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); |
188 | if (error == ERR_EMPTY) break; | 186 | if (error == ERR_EMPTY) break; |
189 | if (error != ERR_NONE) return error; | 187 | if (error != ERR_NONE) return error; |
190 | if (ToDo->EntriesNum != 0) { | 188 | if (ToDo->EntriesNum != 0) { |
191 | num++; | 189 | num++; |
192 | if (num == Loc) return ERR_NONE; | 190 | if (num == Loc) return ERR_NONE; |
193 | } | 191 | } |
194 | } | 192 | } |
195 | 193 | ||
196 | return ERR_EMPTY; | 194 | return ERR_EMPTY; |
197 | #else | 195 | #else |
198 | return ERR_SOURCENOTAVAILABLE; | 196 | return ERR_SOURCENOTAVAILABLE; |
199 | #endif | 197 | #endif |
200 | } | 198 | } |
201 | 199 | ||
202 | GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) | 200 | GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) |
203 | { | 201 | { |
204 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 202 | #ifdef GSM_ENABLE_OBEXGEN |
205 | GSM_Error error; | 203 | GSM_Error error; |
206 | GSM_ToDoEntry ToDo; | 204 | GSM_ToDoEntry ToDo; |
207 | GSM_CalendarEntry Calendar; | 205 | GSM_CalendarEntry Calendar; |
208 | int Pos; | 206 | int Pos; |
209 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 207 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
210 | 208 | ||
211 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 209 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
212 | 210 | ||
213 | smprintf(s,"Getting ToDo status\n"); | 211 | smprintf(s,"Getting ToDo status\n"); |
214 | 212 | ||
215 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 213 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
216 | if (error != ERR_NONE) return error; | 214 | if (error != ERR_NONE) return error; |
217 | 215 | ||
218 | status->Used = 0; | 216 | status->Used = 0; |
219 | Pos = 0; | 217 | Pos = 0; |
220 | while (1) { | 218 | while (1) { |
221 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); | 219 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); |
222 | if (error == ERR_EMPTY) break; | 220 | if (error == ERR_EMPTY) break; |
223 | if (error != ERR_NONE) return error; | 221 | if (error != ERR_NONE) return error; |
224 | if (ToDo.EntriesNum != 0) status->Used++; | 222 | if (ToDo.EntriesNum != 0) status->Used++; |
225 | } | 223 | } |
226 | 224 | ||
227 | return ERR_NONE; | 225 | return ERR_NONE; |
228 | #else | 226 | #else |
229 | return ERR_SOURCENOTAVAILABLE; | 227 | return ERR_SOURCENOTAVAILABLE; |
230 | #endif | 228 | #endif |
231 | } | 229 | } |
232 | 230 | ||
233 | GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 231 | GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
234 | { | 232 | { |
235 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 233 | #ifdef GSM_ENABLE_OBEXGEN |
236 | unsigned char req[5000]; | 234 | unsigned char req[5000]; |
237 | int size=0; | 235 | int size=0; |
238 | 236 | ||
239 | smprintf(s,"Adding calendar note\n"); | 237 | smprintf(s,"Adding calendar note\n"); |
240 | 238 | ||
241 | GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar); | 239 | GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar); |
242 | 240 | ||
243 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); | 241 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); |
244 | #else | 242 | #else |
245 | return ERR_SOURCENOTAVAILABLE; | 243 | return ERR_SOURCENOTAVAILABLE; |
246 | #endif | 244 | #endif |
247 | } | 245 | } |
248 | 246 | ||
249 | GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) | 247 | GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) |
250 | { | 248 | { |
251 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 249 | #ifdef GSM_ENABLE_OBEXGEN |
252 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 250 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
253 | unsigned char req[5000]; | 251 | unsigned char req[5000]; |
254 | int size=0; | 252 | int size=0; |
255 | 253 | ||
256 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 254 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
257 | 255 | ||
258 | smprintf(s,"Adding ToDo\n"); | 256 | smprintf(s,"Adding ToDo\n"); |
259 | 257 | ||
260 | GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo); | 258 | GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo); |
261 | 259 | ||
262 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); | 260 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); |
263 | #else | 261 | #else |
264 | return ERR_SOURCENOTAVAILABLE; | 262 | return ERR_SOURCENOTAVAILABLE; |
265 | #endif | 263 | #endif |
266 | } | 264 | } |
267 | 265 | ||
268 | GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) | 266 | GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) |
269 | { | 267 | { |
270 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 268 | #ifdef GSM_ENABLE_OBEXGEN |
271 | GSM_Error error; | 269 | GSM_Error error; |
272 | int Pos,Level = 0,Used; | 270 | int Pos,Level = 0,Used; |
273 | unsigned char *Buf; | 271 | unsigned char *Buf; |
274 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 272 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
275 | unsigned char Line[2000]; | 273 | unsigned char Line[2000]; |
276 | 274 | ||
277 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 275 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
278 | 276 | ||
279 | smprintf(s,"Deleting all ToDo\n"); | 277 | smprintf(s,"Deleting all ToDo\n"); |
280 | 278 | ||
281 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 279 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
282 | if (error != ERR_NONE) return error; | 280 | if (error != ERR_NONE) return error; |
283 | 281 | ||
284 | Pos = 0; | 282 | Pos = 0; |
285 | Buf = NULL; | 283 | Buf = NULL; |
286 | Used = 0; | 284 | Used = 0; |
287 | while (1) { | 285 | while (1) { |
288 | MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); | 286 | MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); |
289 | if (strlen(Line) == 0) break; | 287 | if (strlen(Line) == 0) break; |
290 | dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); | 288 | dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); |
291 | switch (Level) { | 289 | switch (Level) { |
292 | case 0: | 290 | case 0: |
293 | if (strstr(Line,"BEGIN:VTODO")) { | 291 | if (strstr(Line,"BEGIN:VTODO")) { |
294 | Level = 2; | 292 | Level = 2; |
@@ -298,49 +296,49 @@ GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) | |||
298 | strcpy(Buf+Used,Line); | 296 | strcpy(Buf+Used,Line); |
299 | Used=Used+strlen(Line)+3; | 297 | Used=Used+strlen(Line)+3; |
300 | Buf[Used-3] = 13; | 298 | Buf[Used-3] = 13; |
301 | Buf[Used-2] = 10; | 299 | Buf[Used-2] = 10; |
302 | Buf[Used-1] = 0x00; | 300 | Buf[Used-1] = 0x00; |
303 | break; | 301 | break; |
304 | case 2: /* ToDo note */ | 302 | case 2: /* ToDo note */ |
305 | if (strstr(Line,"END:VTODO")) { | 303 | if (strstr(Line,"END:VTODO")) { |
306 | Level = 0; | 304 | Level = 0; |
307 | } | 305 | } |
308 | break; | 306 | break; |
309 | } | 307 | } |
310 | } | 308 | } |
311 | 309 | ||
312 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); | 310 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); |
313 | //if (Buf != NULL) free(Buf); | 311 | //if (Buf != NULL) free(Buf); |
314 | return error; | 312 | return error; |
315 | #else | 313 | #else |
316 | return ERR_SOURCENOTAVAILABLE; | 314 | return ERR_SOURCENOTAVAILABLE; |
317 | #endif | 315 | #endif |
318 | } | 316 | } |
319 | 317 | ||
320 | GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 318 | GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
321 | { | 319 | { |
322 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 320 | #ifdef GSM_ENABLE_OBEXGEN |
323 | GSM_Error error; | 321 | GSM_Error error; |
324 | int Pos,Level = 0,Loc=0,Used; | 322 | int Pos,Level = 0,Loc=0,Used; |
325 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 323 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
326 | unsigned char Line[2000]; | 324 | unsigned char Line[2000]; |
327 | unsigned char *Buf; | 325 | unsigned char *Buf; |
328 | 326 | ||
329 | smprintf(s, "Deleting calendar note %i\n",Note->Location); | 327 | smprintf(s, "Deleting calendar note %i\n",Note->Location); |
330 | 328 | ||
331 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 329 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
332 | if (error != ERR_NONE) return error; | 330 | if (error != ERR_NONE) return error; |
333 | 331 | ||
334 | Pos = 0; | 332 | Pos = 0; |
335 | Buf = NULL; | 333 | Buf = NULL; |
336 | Used = 0; | 334 | Used = 0; |
337 | while (1) { | 335 | while (1) { |
338 | MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); | 336 | MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); |
339 | if (strlen(Line) == 0) break; | 337 | if (strlen(Line) == 0) break; |
340 | dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); | 338 | dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); |
341 | switch (Level) { | 339 | switch (Level) { |
342 | case 0: | 340 | case 0: |
343 | if (strstr(Line,"BEGIN:VEVENT")) { | 341 | if (strstr(Line,"BEGIN:VEVENT")) { |
344 | Loc++; | 342 | Loc++; |
345 | if (Loc == Note->Location) { | 343 | if (Loc == Note->Location) { |
346 | Level = 1; | 344 | Level = 1; |
@@ -353,59 +351,170 @@ GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | |||
353 | Buf[Used-3] = 13; | 351 | Buf[Used-3] = 13; |
354 | Buf[Used-2] = 10; | 352 | Buf[Used-2] = 10; |
355 | Buf[Used-1] = 0x00; | 353 | Buf[Used-1] = 0x00; |
356 | break; | 354 | break; |
357 | case 1: /* Calendar note */ | 355 | case 1: /* Calendar note */ |
358 | if (strstr(Line,"END:VEVENT")) { | 356 | if (strstr(Line,"END:VEVENT")) { |
359 | Level = 0; | 357 | Level = 0; |
360 | } | 358 | } |
361 | break; | 359 | break; |
362 | } | 360 | } |
363 | } | 361 | } |
364 | 362 | ||
365 | DumpMessage(s->di.df, s->di.dl, Buf, Used); | 363 | DumpMessage(s->di.df, s->di.dl, Buf, Used); |
366 | 364 | ||
367 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); | 365 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); |
368 | if (Buf != NULL) free(Buf); | 366 | if (Buf != NULL) free(Buf); |
369 | return error; | 367 | return error; |
370 | #else | 368 | #else |
371 | return ERR_SOURCENOTAVAILABLE; | 369 | return ERR_SOURCENOTAVAILABLE; |
372 | #endif | 370 | #endif |
373 | } | 371 | } |
374 | 372 | ||
375 | GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) | 373 | GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) |
376 | { | 374 | { |
377 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 375 | #ifdef GSM_ENABLE_OBEXGEN |
378 | GSM_Error error; | 376 | GSM_Error error; |
379 | GSM_ToDoEntry ToDo; | 377 | GSM_ToDoEntry ToDo; |
380 | GSM_CalendarEntry Calendar; | 378 | GSM_CalendarEntry Calendar; |
381 | int Pos; | 379 | int Pos; |
382 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 380 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
383 | 381 | ||
384 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 382 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
385 | 383 | ||
386 | smprintf(s, "Getting calendar status\n"); | 384 | smprintf(s, "Getting calendar status\n"); |
387 | 385 | ||
388 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 386 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
389 | if (error != ERR_NONE) return error; | 387 | if (error != ERR_NONE) return error; |
390 | 388 | ||
391 | Status->Used = 0; | 389 | Status->Used = 0; |
392 | Pos = 0; | 390 | Pos = 0; |
393 | while (1) { | 391 | while (1) { |
394 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); | 392 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); |
395 | if (error == ERR_EMPTY) break; | 393 | if (error == ERR_EMPTY) break; |
396 | if (error != ERR_NONE) return error; | 394 | if (error != ERR_NONE) return error; |
397 | if (Calendar.EntriesNum != 0) Status->Used++; | 395 | if (Calendar.EntriesNum != 0) Status->Used++; |
398 | } | 396 | } |
399 | 397 | ||
400 | return ERR_NONE; | 398 | return ERR_NONE; |
401 | #else | 399 | #else |
402 | return ERR_SOURCENOTAVAILABLE; | 400 | return ERR_SOURCENOTAVAILABLE; |
403 | #endif | 401 | #endif |
404 | } | 402 | } |
405 | 403 | ||
406 | #endif | 404 | GSM_Error ERICSSON_ReplyGetDateLocale(GSM_Protocol_Message msg, GSM_StateMachine *s) |
405 | { /*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 | is an easy way to obtain the source under GPL, otherwise the author's parts | ||
408 | of this function are GPL 2.0. | ||
409 | */ | ||
410 | GSM_Locale*locale = s->Phone.Data.Locale; | ||
411 | char format; | ||
412 | |||
413 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | ||
414 | case AT_Reply_OK: | ||
415 | smprintf(s, "Date settings received\n"); | ||
416 | format=atoi(msg.Buffer); | ||
417 | switch (format) { | ||
418 | case 0: locale->DateFormat = GSM_Date_OFF; | ||
419 | locale->DateSeparator = 0; | ||
420 | break; | ||
421 | case 1: locale->DateFormat = GSM_Date_DDMMMYY; | ||
422 | locale->DateSeparator = '-'; | ||
423 | break; | ||
424 | case 2: locale->DateFormat = GSM_Date_DDMMYY; | ||
425 | locale->DateSeparator = '-'; | ||
426 | break; | ||
427 | case 3: locale->DateFormat = GSM_Date_MMDDYY; | ||
428 | locale->DateSeparator = '/'; | ||
429 | break; | ||
430 | case 4: locale->DateFormat = GSM_Date_DDMMYY; | ||
431 | locale->DateSeparator = '/'; | ||
432 | break; | ||
433 | case 5: locale->DateFormat = GSM_Date_DDMMYY; | ||
434 | locale->DateSeparator = '.'; | ||
435 | break; | ||
436 | case 6: locale->DateFormat = GSM_Date_YYMMDD; | ||
437 | locale->DateSeparator = 0; | ||
438 | break; | ||
439 | case 7: locale->DateFormat = GSM_Date_YYMMDD; | ||
440 | locale->DateSeparator = '-'; | ||
441 | break; | ||
442 | default:return ERR_UNKNOWNRESPONSE; | ||
443 | } | ||
444 | default: | ||
445 | return ERR_NOTSUPPORTED; | ||
446 | } | ||
447 | } | ||
448 | |||
449 | GSM_Error ERICSSON_ReplyGetTimeLocale(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
450 | { /*Author: Peter Ondraska | ||
451 | License: Whatever the current maintainer of gammulib chooses, as long as there | ||
452 | is an easy way to obtain the source under GPL, otherwise the author's parts | ||
453 | of this function are GPL 2.0. | ||
454 | */ | ||
455 | char format; | ||
456 | |||
457 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | ||
458 | case AT_Reply_OK: | ||
459 | smprintf(s, "Time settings received\n"); | ||
460 | format=atoi(msg.Buffer); | ||
461 | switch (format) { | ||
462 | case 1: | ||
463 | case 2: s->Phone.Data.Locale->AMPMTime=(format==2); | ||
464 | return ERR_NONE; | ||
465 | default:return ERR_UNKNOWNRESPONSE; | ||
466 | } | ||
467 | default: return ERR_NOTSUPPORTED; | ||
468 | } | ||
469 | } | ||
470 | |||
471 | GSM_Error ERICSSON_GetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
472 | { | ||
473 | GSM_Error error; | ||
474 | |||
475 | s->Phone.Data.Locale = locale; | ||
476 | |||
477 | smprintf(s, "Getting date format\n"); | ||
478 | error=GSM_WaitFor (s, "AT+ESDF?\r", 9, 0x00, 3, ID_GetLocale); | ||
479 | if (error!=ERR_NONE) return error; | ||
480 | |||
481 | smprintf(s, "Getting time format\n"); | ||
482 | return GSM_WaitFor (s, "AT+ESTF?\r", 9, 0x00, 3, ID_GetLocale); | ||
483 | } | ||
484 | |||
485 | |||
486 | GSM_Error ERICSSON_SetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
487 | { /*Author: Peter Ondraska | ||
488 | License: Whatever the current maintainer of gammulib chooses, as long as there | ||
489 | is an easy way to obtain the source under GPL, otherwise the author's parts | ||
490 | of this function are GPL 2.0. | ||
491 | */ | ||
492 | /* this is not yet supported by gammu.c */ | ||
493 | intformat=0; | ||
494 | charreq[12]; | ||
495 | |||
496 | if (locale->DateFormat==GSM_Date_OFF) { format=0; } else | ||
497 | if ((locale->DateFormat==GSM_Date_DDMMMYY)&&(locale->DateSeparator=='-')) { format=1; } else | ||
498 | if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='-')) { format=2; } else | ||
499 | if ((locale->DateFormat==GSM_Date_MMDDYY)&&(locale->DateSeparator=='/')) { format=3; } else | ||
500 | if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='/')) { format=4; } else | ||
501 | if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='.')) { format=5; } else | ||
502 | if ((locale->DateFormat==GSM_Date_YYMMDD)&&(locale->DateSeparator==0)) { format=6; } else | ||
503 | if ((locale->DateFormat==GSM_Date_YYMMDD)&&(locale->DateSeparator=='-')) { format=7; } | ||
504 | else { return ERR_NOTSUPPORTED; } /* ERR_WRONGINPUT */ | ||
505 | |||
506 | sprintf(req,"AT+ESDF=%i\r",format); | ||
507 | smprintf(s, "Setting date format\n"); | ||
508 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetLocale); | ||
509 | |||
510 | if (locale->AMPMTime) { format=2; } else { format=1; } | ||
511 | sprintf(req,"AT+ESTF=%i\r",format); | ||
512 | smprintf(s, "Setting time format\n"); | ||
513 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetLocale); | ||
514 | } | ||
515 | |||
407 | #endif | 516 | #endif |
408 | 517 | ||
409 | /* How should editor hadle tabs in this file? Add editor commands here. | 518 | /* How should editor hadle tabs in this file? Add editor commands here. |
410 | * vim: noexpandtab sw=8 ts=8 sts=8: | 519 | * vim: noexpandtab sw=8 ts=8 sts=8: |
411 | */ | 520 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.c b/gammu/emb/common/phone/nokia/dct3/dct3func.c index beef33c..17cd0a4 100644 --- a/gammu/emb/common/phone/nokia/dct3/dct3func.c +++ b/gammu/emb/common/phone/nokia/dct3/dct3func.c | |||
@@ -1,27 +1,30 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail, Pavel Janik, others and Gnokii */ | ||
3 | /* 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) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
4 | 7 | ||
5 | #include <string.h> /* memcpy only */ | 8 | #include <string.h> /* memcpy only */ |
6 | #include <stdio.h> | 9 | #include <stdio.h> |
7 | #include <ctype.h> | 10 | #include <ctype.h> |
8 | 11 | ||
9 | #include "../../../gsmstate.h" | 12 | #include "../../../gsmstate.h" |
10 | #include "../../../misc/coding/coding.h" | 13 | #include "../../../misc/coding/coding.h" |
11 | #include "../../../service/sms/gsmsms.h" | 14 | #include "../../../service/sms/gsmsms.h" |
12 | #include "../../pfunc.h" | 15 | #include "../../pfunc.h" |
13 | #include "../nfunc.h" | 16 | #include "../nfunc.h" |
14 | #include "dct3func.h" | 17 | #include "dct3func.h" |
15 | 18 | ||
16 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 19 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
17 | 20 | ||
18 | GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) | 21 | GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) |
19 | { | 22 | { |
20 | GSM_Error error; | 23 | GSM_Error error; |
21 | 24 | ||
22 | /* We have to enable WAP frames in phone */ | 25 | /* We have to enable WAP frames in phone */ |
23 | error=DCT3DCT4_EnableWAPFunctions(s); | 26 | error=DCT3DCT4_EnableWAPFunctions(s); |
24 | if (error!=ERR_NONE) return error; | 27 | if (error!=ERR_NONE) return error; |
25 | 28 | ||
26 | return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark); | 29 | return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark); |
27 | } | 30 | } |
@@ -373,48 +376,49 @@ GSM_Error DCT3_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm, unsigned char msg | |||
373 | req[8] = alarm->DateTime.Hour; | 376 | req[8] = alarm->DateTime.Hour; |
374 | req[9] = alarm->DateTime.Minute; | 377 | req[9] = alarm->DateTime.Minute; |
375 | 378 | ||
376 | smprintf(s, "Setting alarm\n"); | 379 | smprintf(s, "Setting alarm\n"); |
377 | return GSM_WaitFor (s, req, 11, msgtype, 4, ID_SetAlarm); | 380 | return GSM_WaitFor (s, req, 11, msgtype, 4, ID_SetAlarm); |
378 | } | 381 | } |
379 | 382 | ||
380 | GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) | 383 | GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) |
381 | { | 384 | { |
382 | int i; | 385 | int i; |
383 | GSM_Phone_Data*Data = &s->Phone.Data; | 386 | GSM_Phone_Data*Data = &s->Phone.Data; |
384 | 387 | ||
385 | switch (msg.Buffer[3]) { | 388 | switch (msg.Buffer[3]) { |
386 | case 0x34: | 389 | case 0x34: |
387 | smprintf(s, "SMSC received\n"); | 390 | smprintf(s, "SMSC received\n"); |
388 | Data->SMSC->Format = SMS_FORMAT_Text; | 391 | Data->SMSC->Format = SMS_FORMAT_Text; |
389 | switch (msg.Buffer[6]) { | 392 | switch (msg.Buffer[6]) { |
390 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; | 393 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; |
391 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; | 394 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; |
392 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; | 395 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; |
393 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; | 396 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; |
394 | } | 397 | } |
395 | Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat; | 398 | Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat; |
396 | Data->SMSC->Validity.Relative= msg.Buffer[8]; | 399 | Data->SMSC->Validity.Relative= msg.Buffer[8]; |
400 | if (msg.Buffer[8] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time; | ||
397 | 401 | ||
398 | i=33; | 402 | i=33; |
399 | while (msg.Buffer[i]!=0) {i++;} | 403 | while (msg.Buffer[i]!=0) {i++;} |
400 | i=i-33; | 404 | i=i-33; |
401 | if (i>GSM_MAX_SMSC_NAME_LENGTH) { | 405 | if (i>GSM_MAX_SMSC_NAME_LENGTH) { |
402 | smprintf(s, "Too long name\n"); | 406 | smprintf(s, "Too long name\n"); |
403 | return ERR_UNKNOWNRESPONSE; | 407 | return ERR_UNKNOWNRESPONSE; |
404 | } | 408 | } |
405 | EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i); | 409 | EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i); |
406 | smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); | 410 | smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); |
407 | 411 | ||
408 | GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true); | 412 | GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true); |
409 | smprintf(s, "Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber)); | 413 | smprintf(s, "Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber)); |
410 | 414 | ||
411 | GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+21,false); | 415 | GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+21,false); |
412 | smprintf(s, "Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number)); | 416 | smprintf(s, "Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number)); |
413 | 417 | ||
414 | return ERR_NONE; | 418 | return ERR_NONE; |
415 | case 0x35: | 419 | case 0x35: |
416 | smprintf(s, "Getting SMSC failed\n"); | 420 | smprintf(s, "Getting SMSC failed\n"); |
417 | return ERR_INVALIDLOCATION; | 421 | return ERR_INVALIDLOCATION; |
418 | } | 422 | } |
419 | return ERR_UNKNOWNRESPONSE; | 423 | return ERR_UNKNOWNRESPONSE; |
420 | } | 424 | } |
@@ -438,50 +442,50 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
438 | int count; | 442 | int count; |
439 | GSM_Phone_Data*Data = &s->Phone.Data; | 443 | GSM_Phone_Data*Data = &s->Phone.Data; |
440 | #ifdef DEBUG | 444 | #ifdef DEBUG |
441 | GSM_NetworkInfo NetInfo; | 445 | GSM_NetworkInfo NetInfo; |
442 | char name[100]; | 446 | char name[100]; |
443 | 447 | ||
444 | smprintf(s, "Network info received\n"); | 448 | smprintf(s, "Network info received\n"); |
445 | smprintf(s, " Status : "); | 449 | smprintf(s, " Status : "); |
446 | switch (msg.Buffer[8]) { | 450 | switch (msg.Buffer[8]) { |
447 | case 0x01: smprintf(s, "home network"); break; | 451 | case 0x01: smprintf(s, "home network"); break; |
448 | case 0x02: smprintf(s, "roaming network"); break; | 452 | case 0x02: smprintf(s, "roaming network"); break; |
449 | case 0x03: smprintf(s, "requesting network"); break; | 453 | case 0x03: smprintf(s, "requesting network"); break; |
450 | case 0x04: smprintf(s, "not registered in the network");break; | 454 | case 0x04: smprintf(s, "not registered in the network");break; |
451 | default : smprintf(s, "unknown"); | 455 | default : smprintf(s, "unknown"); |
452 | } | 456 | } |
453 | smprintf(s, "\n"); | 457 | smprintf(s, "\n"); |
454 | smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); | 458 | smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); |
455 | if (msg.Buffer[8]<0x03) { | 459 | if (msg.Buffer[8]<0x03) { |
456 | sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); | 460 | sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); |
457 | smprintf(s, "CID : %s\n", NetInfo.CID); | 461 | smprintf(s, "CID : %s\n", NetInfo.CID); |
458 | 462 | ||
459 | sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); | 463 | sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); |
460 | smprintf(s, "LAC : %s\n", NetInfo.LAC); | 464 | smprintf(s, "LAC : %s\n", NetInfo.LAC); |
461 | 465 | ||
462 | smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); | ||
463 | NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); | 466 | NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); |
467 | smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); | ||
464 | smprintf(s, "Network name for Gammu : %s ", | 468 | smprintf(s, "Network name for Gammu : %s ", |
465 | DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); | 469 | DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); |
466 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); | 470 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); |
467 | 471 | ||
468 | if (msg.Length>18) { | 472 | if (msg.Length>18) { |
469 | if (msg.Buffer[18]==0x00) { | 473 | if (msg.Buffer[18]==0x00) { |
470 | /* In 6210 name is in "normal" Unicode */ | 474 | /* In 6210 name is in "normal" Unicode */ |
471 | memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); | 475 | memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); |
472 | name[msg.Buffer[17]*2]=0x00; | 476 | name[msg.Buffer[17]*2]=0x00; |
473 | name[msg.Buffer[17]*2+1]=0x00; | 477 | name[msg.Buffer[17]*2+1]=0x00; |
474 | smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); | 478 | smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); |
475 | } else { | 479 | } else { |
476 | /* In 9210 first 0x00 is cut from Unicode string */ | 480 | /* In 9210 first 0x00 is cut from Unicode string */ |
477 | name[0] = 0; | 481 | name[0] = 0; |
478 | memcpy(name+1,msg.Buffer+18,msg.Buffer[17]*2); | 482 | memcpy(name+1,msg.Buffer+18,msg.Buffer[17]*2); |
479 | name[msg.Buffer[17]*2+1]=0x00; | 483 | name[msg.Buffer[17]*2+1]=0x00; |
480 | name[msg.Buffer[17]*2+2]=0x00; | 484 | name[msg.Buffer[17]*2+2]=0x00; |
481 | smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); | 485 | smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); |
482 | } | 486 | } |
483 | } | 487 | } |
484 | } | 488 | } |
485 | #endif | 489 | #endif |
486 | if (Data->RequestID==ID_GetNetworkInfo) { | 490 | if (Data->RequestID==ID_GetNetworkInfo) { |
487 | Data->NetworkInfo->NetworkName[0] = 0x00; | 491 | Data->NetworkInfo->NetworkName[0] = 0x00; |
@@ -1187,53 +1191,53 @@ GSM_Error DCT3_SetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *setting | |||
1187 | pos++; | 1191 | pos++; |
1188 | if (loc3 != -1) { | 1192 | if (loc3 != -1) { |
1189 | /* Service number or IP address */ | 1193 | /* Service number or IP address */ |
1190 | pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Service, false); | 1194 | pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Service, false); |
1191 | /* Code number */ | 1195 | /* Code number */ |
1192 | pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Code, false); | 1196 | pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Code, false); |
1193 | } else pos+=2; | 1197 | } else pos+=2; |
1194 | memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8); | 1198 | memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8); |
1195 | pos += 8; | 1199 | pos += 8; |
1196 | smprintf(s, "Writing WAP settings part 2 (USSD bearer)\n"); | 1200 | smprintf(s, "Writing WAP settings part 2 (USSD bearer)\n"); |
1197 | error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet); | 1201 | error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet); |
1198 | if (error != ERR_NONE) return error; | 1202 | if (error != ERR_NONE) return error; |
1199 | } | 1203 | } |
1200 | error = DCT3DCT4_SetActiveConnectSet(s, settings); | 1204 | error = DCT3DCT4_SetActiveConnectSet(s, settings); |
1201 | if (error != ERR_NONE) return error; | 1205 | if (error != ERR_NONE) return error; |
1202 | 1206 | ||
1203 | return DCT3DCT4_DisableConnectionFunctions(s); | 1207 | return DCT3DCT4_DisableConnectionFunctions(s); |
1204 | } | 1208 | } |
1205 | 1209 | ||
1206 | GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1210 | GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1207 | { | 1211 | { |
1208 | switch (msg.Buffer[3]) { | 1212 | switch (msg.Buffer[3]) { |
1209 | case 0x02: | 1213 | case 0x02: |
1210 | smprintf(s, "SMS sent OK\n"); | 1214 | smprintf(s, "SMS sent OK\n"); |
1211 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,0); | 1215 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[5]); |
1212 | return ERR_NONE; | 1216 | return ERR_NONE; |
1213 | case 0x03: | 1217 | case 0x03: |
1214 | smprintf(s, "Error %i\n",msg.Buffer[6]); | 1218 | smprintf(s, "Error %i\n",msg.Buffer[6]); |
1215 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],0); | 1219 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],-1); |
1216 | return ERR_NONE; | 1220 | return ERR_NONE; |
1217 | } | 1221 | } |
1218 | return ERR_UNKNOWNRESPONSE; | 1222 | return ERR_UNKNOWNRESPONSE; |
1219 | } | 1223 | } |
1220 | 1224 | ||
1221 | GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) | 1225 | GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) |
1222 | { | 1226 | { |
1223 | int length; | 1227 | int length; |
1224 | GSM_Error error; | 1228 | GSM_Error error; |
1225 | unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00}; | 1229 | unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00}; |
1226 | 1230 | ||
1227 | error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true); | 1231 | error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true); |
1228 | if (error != ERR_NONE) return error; | 1232 | if (error != ERR_NONE) return error; |
1229 | 1233 | ||
1230 | smprintf(s, "Sending sms\n"); | 1234 | smprintf(s, "Sending sms\n"); |
1231 | return s->Protocol.Functions->WriteMessage(s, req, 6+length, 0x02); | 1235 | return s->Protocol.Functions->WriteMessage(s, req, 6+length, 0x02); |
1232 | } | 1236 | } |
1233 | 1237 | ||
1234 | GSM_Error DCT3_ReplyNetmonitor(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1238 | GSM_Error DCT3_ReplyNetmonitor(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1235 | { | 1239 | { |
1236 | switch (msg.Buffer[3]) { | 1240 | switch (msg.Buffer[3]) { |
1237 | case 0x00: | 1241 | case 0x00: |
1238 | smprintf(s, "Netmonitor correctly set\n"); | 1242 | smprintf(s, "Netmonitor correctly set\n"); |
1239 | break; | 1243 | break; |
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.h b/gammu/emb/common/phone/nokia/dct3/dct3func.h index 66b67ec..18b2026 100644 --- a/gammu/emb/common/phone/nokia/dct3/dct3func.h +++ b/gammu/emb/common/phone/nokia/dct3/dct3func.h | |||
@@ -1,29 +1,31 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef phone_nokia_dct3_h | 3 | #ifndef phone_nokia_dct3_h |
4 | #define phone_nokia_dct3_h | 4 | #define phone_nokia_dct3_h |
5 | 5 | ||
6 | #include "../ncommon.h" | ||
7 | |||
6 | GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s); | 8 | GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s); |
7 | GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s); | 9 | GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s); |
8 | GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message msg, GSM_StateMachine *s); | 10 | GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message msg, GSM_StateMachine *s); |
9 | GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s); | 11 | GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s); |
10 | GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); | 12 | GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); |
11 | GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s); | 13 | GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s); |
12 | GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s); | 14 | GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s); |
13 | GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); | 15 | GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); |
14 | GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); | 16 | GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); |
15 | GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); | 17 | GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); |
16 | GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); | 18 | GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); |
17 | GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s); | 19 | GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s); |
18 | GSM_Error DCT3_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s); | 20 | GSM_Error DCT3_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s); |
19 | GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s); | 21 | GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s); |
20 | GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s); | 22 | GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s); |
21 | GSM_Error DCT3_ReplySetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); | 23 | GSM_Error DCT3_ReplySetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); |
22 | GSM_Error DCT3_ReplyGetWAPSettings(GSM_Protocol_Message msg, GSM_StateMachine *s); | 24 | GSM_Error DCT3_ReplyGetWAPSettings(GSM_Protocol_Message msg, GSM_StateMachine *s); |
23 | GSM_Error DCT3_ReplySetWAPSettings(GSM_Protocol_Message msg, GSM_StateMachine *s); | 25 | GSM_Error DCT3_ReplySetWAPSettings(GSM_Protocol_Message msg, GSM_StateMachine *s); |
24 | GSM_Error DCT3_ReplyNetmonitor (GSM_Protocol_Message msg, GSM_StateMachine *s); | 26 | GSM_Error DCT3_ReplyNetmonitor (GSM_Protocol_Message msg, GSM_StateMachine *s); |
25 | GSM_Error DCT3_ReplyDeleteSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s); | 27 | GSM_Error DCT3_ReplyDeleteSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s); |
26 | GSM_Error N71_92_ReplyGetSignalQuality(GSM_Protocol_Message msg, GSM_StateMachine *s); | 28 | GSM_Error N71_92_ReplyGetSignalQuality(GSM_Protocol_Message msg, GSM_StateMachine *s); |
27 | GSM_Error N71_92_ReplyGetBatteryCharge(GSM_Protocol_Message msg, GSM_StateMachine *s); | 29 | GSM_Error N71_92_ReplyGetBatteryCharge(GSM_Protocol_Message msg, GSM_StateMachine *s); |
28 | GSM_Error N71_92_ReplyPhoneSetting(GSM_Protocol_Message msg, GSM_StateMachine *s); | 30 | GSM_Error N71_92_ReplyPhoneSetting(GSM_Protocol_Message msg, GSM_StateMachine *s); |
29 | GSM_Error N61_71_ReplyResetPhoneSettings(GSM_Protocol_Message msg, GSM_StateMachine *s); | 31 | GSM_Error N61_71_ReplyResetPhoneSettings(GSM_Protocol_Message msg, GSM_StateMachine *s); |
diff --git a/gammu/emb/common/phone/nokia/dct3/n6110.c b/gammu/emb/common/phone/nokia/dct3/n6110.c index 263d12b..dac6c12 100644 --- a/gammu/emb/common/phone/nokia/dct3/n6110.c +++ b/gammu/emb/common/phone/nokia/dct3/n6110.c | |||
@@ -1,28 +1,30 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail and Gnokii */ | ||
3 | /* Authentication function (c) 1999 or earlier by Pavel Janik */ | ||
4 | /* 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) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
5 | 7 | ||
6 | #include "../../../gsmstate.h" | 8 | #include "../../../gsmstate.h" |
7 | 9 | ||
8 | #ifdef GSM_ENABLE_NOKIA6110 | 10 | #ifdef GSM_ENABLE_NOKIA6110 |
9 | 11 | ||
10 | #include <string.h> | 12 | #include <string.h> |
11 | 13 | ||
12 | #include "../../../../cfg/config.h" | 14 | #include "../../../../cfg/config.h" |
13 | #include "../../../misc/coding/coding.h" | 15 | #include "../../../misc/coding/coding.h" |
14 | #include "../../../service/sms/gsmsms.h" | 16 | #include "../../../service/sms/gsmsms.h" |
15 | #include "../../../gsmcomon.h" | 17 | #include "../../../gsmcomon.h" |
16 | #include "../../pfunc.h" | 18 | #include "../../pfunc.h" |
17 | #include "../nfunc.h" | 19 | #include "../nfunc.h" |
18 | #include "n6110.h" | 20 | #include "n6110.h" |
19 | #include "dct3func.h" | 21 | #include "dct3func.h" |
20 | 22 | ||
21 | static unsigned char N6110_MEMORY_TYPES[] = { | 23 | static unsigned char N6110_MEMORY_TYPES[] = { |
22 | MEM_ME, 0x02, | 24 | MEM_ME, 0x02, |
23 | MEM_SM, 0x03, | 25 | MEM_SM, 0x03, |
24 | MEM_ON, 0x05, | 26 | MEM_ON, 0x05, |
25 | MEM_DC, 0x07, | 27 | MEM_DC, 0x07, |
26 | MEM_RC, 0x08, | 28 | MEM_RC, 0x08, |
27 | MEM_MC, 0x09, | 29 | MEM_MC, 0x09, |
28 | MEM_VM, 0x0b, | 30 | MEM_VM, 0x0b, |
@@ -106,48 +108,49 @@ static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const | |||
106 | if (N6110_Lang_Table[i].Lang == 0) break; | 108 | if (N6110_Lang_Table[i].Lang == 0) break; |
107 | if (N6110_Lang_Table[i].Lang == Priv->PhoneLanguage && | 109 | if (N6110_Lang_Table[i].Lang == Priv->PhoneLanguage && |
108 | N6110_Lang_Table[i].Phone == src[i_len]) { | 110 | N6110_Lang_Table[i].Phone == src[i_len]) { |
109 | dest[o_len*2] = N6110_Lang_Table[i].Unicode1; | 111 | dest[o_len*2] = N6110_Lang_Table[i].Unicode1; |
110 | dest[(o_len*2)+1] = N6110_Lang_Table[i].Unicode2; | 112 | dest[(o_len*2)+1] = N6110_Lang_Table[i].Unicode2; |
111 | i_len++; | 113 | i_len++; |
112 | found = true; | 114 | found = true; |
113 | break; | 115 | break; |
114 | } | 116 | } |
115 | i++; | 117 | i++; |
116 | } | 118 | } |
117 | } | 119 | } |
118 | if (!found) { | 120 | if (!found) { |
119 | i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc); | 121 | i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc); |
120 | dest[o_len*2] = (wc >> 8) & 0xff; | 122 | dest[o_len*2] = (wc >> 8) & 0xff; |
121 | dest[(o_len*2)+1] = wc & 0xff; | 123 | dest[(o_len*2)+1] = wc & 0xff; |
122 | } | 124 | } |
123 | } | 125 | } |
124 | dest[o_len*2] = 0; | 126 | dest[o_len*2] = 0; |
125 | dest[(o_len*2)+1] = 0; | 127 | dest[(o_len*2)+1] = 0; |
126 | } | 128 | } |
127 | 129 | ||
128 | #ifndef ENABLE_LGPL | 130 | #ifndef ENABLE_LGPL |
129 | 131 | ||
132 | /* Pavel Janik */ | ||
130 | /* This function provides Nokia authentication protocol. | 133 | /* This function provides Nokia authentication protocol. |
131 | * Nokia authentication protocol is used in the communication between Nokia | 134 | * Nokia authentication protocol is used in the communication between Nokia |
132 | * mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software, | 135 | * mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software, |
133 | * commercially sold by Nokia Corp. | 136 | * commercially sold by Nokia Corp. |
134 | * The authentication scheme is based on the token send by the phone to the | 137 | * The authentication scheme is based on the token send by the phone to the |
135 | * software. The software does it's magic (see the function | 138 | * software. The software does it's magic (see the function |
136 | * N6110_GetNokiaAuthentication) and returns the result back to the phone. | 139 | * N6110_GetNokiaAuthentication) and returns the result back to the phone. |
137 | * If the result is correct the phone responds with the message "Accessory | 140 | * If the result is correct the phone responds with the message "Accessory |
138 | * connected!" displayed on the LCD. Otherwise it will display "Accessory not | 141 | * connected!" displayed on the LCD. Otherwise it will display "Accessory not |
139 | * supported" and some functions will not be available for use (?). | 142 | * supported" and some functions will not be available for use (?). |
140 | * The specification of the protocol is not publicly available, no comment. | 143 | * The specification of the protocol is not publicly available, no comment. |
141 | */ | 144 | */ |
142 | static void N6110_GetNokiaAuthentication(unsigned char *Imei, unsigned char *MagicBytes, unsigned char *MagicResponse) | 145 | static void N6110_GetNokiaAuthentication(unsigned char *Imei, unsigned char *MagicBytes, unsigned char *MagicResponse) |
143 | { | 146 | { |
144 | int i, j, CRC=0; | 147 | int i, j, CRC=0; |
145 | unsigned char Temp[16]; /* This is our temporary working area. */ | 148 | unsigned char Temp[16]; /* This is our temporary working area. */ |
146 | 149 | ||
147 | /* Here we put FAC (Final Assembly Code) and serial number into our area. */ | 150 | /* Here we put FAC (Final Assembly Code) and serial number into our area. */ |
148 | Temp[0] = Imei[6]; Temp[1] = Imei[7]; | 151 | Temp[0] = Imei[6]; Temp[1] = Imei[7]; |
149 | Temp[2] = Imei[8]; Temp[3] = Imei[9]; | 152 | Temp[2] = Imei[8]; Temp[3] = Imei[9]; |
150 | Temp[4] = Imei[10]; Temp[5] = Imei[11]; | 153 | Temp[4] = Imei[10]; Temp[5] = Imei[11]; |
151 | Temp[6] = Imei[12]; Temp[7] = Imei[13]; | 154 | Temp[6] = Imei[12]; Temp[7] = Imei[13]; |
152 | 155 | ||
153 | /* And now the TAC (Type Approval Code). */ | 156 | /* And now the TAC (Type Approval Code). */ |
@@ -803,48 +806,49 @@ static GSM_Error N6110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, | |||
803 | return DCT3_GetNetworkInfo(s,&NetInfo); | 806 | return DCT3_GetNetworkInfo(s,&NetInfo); |
804 | } else { | 807 | } else { |
805 | return ERR_NOTSUPPORTED; | 808 | return ERR_NOTSUPPORTED; |
806 | } | 809 | } |
807 | } | 810 | } |
808 | *maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+7, &size); | 811 | *maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+7, &size); |
809 | req[4] = Ringtone->Location - 1; | 812 | req[4] = Ringtone->Location - 1; |
810 | smprintf(s, "Setting ringtone\n"); | 813 | smprintf(s, "Setting ringtone\n"); |
811 | return GSM_WaitFor (s, req, 7 + size, 0x05, 4, ID_SetRingtone); | 814 | return GSM_WaitFor (s, req, 7 + size, 0x05, 4, ID_SetRingtone); |
812 | case RING_NOKIABINARY: | 815 | case RING_NOKIABINARY: |
813 | error=DCT3_EnableSecurity (s, 0x01); | 816 | error=DCT3_EnableSecurity (s, 0x01); |
814 | if (error!=ERR_NONE) return error; | 817 | if (error!=ERR_NONE) return error; |
815 | memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name)); | 818 | memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name)); |
816 | current += UnicodeLength(Ringtone->Name); | 819 | current += UnicodeLength(Ringtone->Name); |
817 | reqBin[current++] = 0x00; | 820 | reqBin[current++] = 0x00; |
818 | reqBin[current++] = 0x00; | 821 | reqBin[current++] = 0x00; |
819 | reqBin[current++] = 0x00;/*xxx*/ | 822 | reqBin[current++] = 0x00;/*xxx*/ |
820 | memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length); | 823 | memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length); |
821 | current=current+Ringtone->NokiaBinary.Length; | 824 | current=current+Ringtone->NokiaBinary.Length; |
822 | reqBin[3]=Ringtone->Location-1; | 825 | reqBin[3]=Ringtone->Location-1; |
823 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10; | 826 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10; |
824 | smprintf(s, "Setting binary ringtone\n"); | 827 | smprintf(s, "Setting binary ringtone\n"); |
825 | return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone); | 828 | return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone); |
826 | case RING_MIDI: | 829 | case RING_MIDI: |
830 | case RING_MMF: | ||
827 | return ERR_NOTSUPPORTED; | 831 | return ERR_NOTSUPPORTED; |
828 | } | 832 | } |
829 | return ERR_NOTSUPPORTED; | 833 | return ERR_NOTSUPPORTED; |
830 | } | 834 | } |
831 | 835 | ||
832 | static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 836 | static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
833 | { | 837 | { |
834 | int count=5; | 838 | int count=5; |
835 | GSM_Phone_Data *Data = &s->Phone.Data; | 839 | GSM_Phone_Data *Data = &s->Phone.Data; |
836 | 840 | ||
837 | smprintf(s, "Operator logo received\n"); | 841 | smprintf(s, "Operator logo received\n"); |
838 | NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode); | 842 | NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode); |
839 | count = count + 3; | 843 | count = count + 3; |
840 | smprintf(s, "Network code : %s\n", Data->Bitmap->NetworkCode); | 844 | smprintf(s, "Network code : %s\n", Data->Bitmap->NetworkCode); |
841 | smprintf(s, "Network name for Gammu : %s ", | 845 | smprintf(s, "Network name for Gammu : %s ", |
842 | DecodeUnicodeString(GSM_GetNetworkName(Data->Bitmap->NetworkCode))); | 846 | DecodeUnicodeString(GSM_GetNetworkName(Data->Bitmap->NetworkCode))); |
843 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(Data->Bitmap->NetworkCode))); | 847 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(Data->Bitmap->NetworkCode))); |
844 | 848 | ||
845 | count = count + 3; /* We ignore size */ | 849 | count = count + 3; /* We ignore size */ |
846 | Data->Bitmap->BitmapWidth = msg.Buffer[count++]; | 850 | Data->Bitmap->BitmapWidth = msg.Buffer[count++]; |
847 | Data->Bitmap->BitmapHeight = msg.Buffer[count++]; | 851 | Data->Bitmap->BitmapHeight = msg.Buffer[count++]; |
848 | count++; | 852 | count++; |
849 | PHONE_DecodeBitmap(GSM_NokiaOperatorLogo,msg.Buffer+count,Data->Bitmap); | 853 | PHONE_DecodeBitmap(GSM_NokiaOperatorLogo,msg.Buffer+count,Data->Bitmap); |
850 | return ERR_NONE; | 854 | return ERR_NONE; |
@@ -1503,85 +1507,87 @@ static GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi | |||
1503 | while (true) { | 1507 | while (true) { |
1504 | if (start!=0) { | 1508 | if (start!=0) { |
1505 | if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) { | 1509 | if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) { |
1506 | end=i+2; break; | 1510 | end=i+2; break; |
1507 | } | 1511 | } |
1508 | if (msg.Buffer[i]==0x0e && msg.Buffer[i+1]==0x0b) { | 1512 | if (msg.Buffer[i]==0x0e && msg.Buffer[i+1]==0x0b) { |
1509 | end=i+2; break; | 1513 | end=i+2; break; |
1510 | } | 1514 | } |
1511 | } else { | 1515 | } else { |
1512 | if (msg.Buffer[i]==0x02 && msg.Buffer[i+1]==0xfc && msg.Buffer[i+2]==0x09) { | 1516 | if (msg.Buffer[i]==0x02 && msg.Buffer[i+1]==0xfc && msg.Buffer[i+2]==0x09) { |
1513 | start = i; | 1517 | start = i; |
1514 | } | 1518 | } |
1515 | } | 1519 | } |
1516 | i++; | 1520 | i++; |
1517 | if (i==msg.Length-3) return ERR_EMPTY; | 1521 | if (i==msg.Length-3) return ERR_EMPTY; |
1518 | } | 1522 | } |
1519 | /* Copying frame */ | 1523 | /* Copying frame */ |
1520 | memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start); | 1524 | memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start); |
1521 | Data->Ringtone->NokiaBinary.Length=end-start; | 1525 | Data->Ringtone->NokiaBinary.Length=end-start; |
1522 | #ifdef DEBUG | 1526 | #ifdef DEBUG |
1523 | if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length); | 1527 | if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length); |
1524 | #endif | 1528 | #endif |
1525 | return ERR_NONE; | 1529 | return ERR_NONE; |
1526 | case RING_MIDI: | 1530 | case RING_MIDI: |
1531 | case RING_MMF: | ||
1527 | return ERR_NOTSUPPORTED; | 1532 | return ERR_NOTSUPPORTED; |
1528 | } | 1533 | } |
1529 | smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format); | 1534 | smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format); |
1530 | break; | 1535 | break; |
1531 | default: | 1536 | default: |
1532 | smprintf(s, "Invalid location. Too high ?\n"); | 1537 | smprintf(s, "Invalid location. Too high ?\n"); |
1533 | return ERR_INVALIDLOCATION; | 1538 | return ERR_INVALIDLOCATION; |
1534 | } | 1539 | } |
1535 | return ERR_UNKNOWNRESPONSE; | 1540 | return ERR_UNKNOWNRESPONSE; |
1536 | } | 1541 | } |
1537 | 1542 | ||
1538 | static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | 1543 | static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) |
1539 | { | 1544 | { |
1540 | GSM_Error error; | 1545 | GSM_Error error; |
1541 | unsigned char req[] = {0x00, 0x01, 0x9e, | 1546 | unsigned char req[] = {0x00, 0x01, 0x9e, |
1542 | 0x00}; /* location */ | 1547 | 0x00}; /* location */ |
1543 | 1548 | ||
1544 | if (PhoneRingtone) return ERR_NOTSUPPORTED; | 1549 | if (PhoneRingtone) return ERR_NOTSUPPORTED; |
1545 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_NORING)) return ERR_NOTSUPPORTED; | 1550 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_NORING)) return ERR_NOTSUPPORTED; |
1546 | if (Ringtone->Location == 0) return ERR_INVALIDLOCATION; | 1551 | if (Ringtone->Location == 0) return ERR_INVALIDLOCATION; |
1547 | 1552 | ||
1548 | if (Ringtone->Format == 0x00) { | 1553 | if (Ringtone->Format == 0x00) { |
1549 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) { | 1554 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) { |
1550 | Ringtone->Format = RING_NOTETONE; | 1555 | Ringtone->Format = RING_NOTETONE; |
1551 | } else { | 1556 | } else { |
1552 | Ringtone->Format = RING_NOKIABINARY; | 1557 | Ringtone->Format = RING_NOKIABINARY; |
1553 | } | 1558 | } |
1554 | } | 1559 | } |
1555 | 1560 | ||
1556 | switch (Ringtone->Format) { | 1561 | switch (Ringtone->Format) { |
1557 | case RING_NOTETONE: | 1562 | case RING_NOTETONE: |
1558 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; | 1563 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; |
1559 | break; | 1564 | break; |
1560 | case RING_NOKIABINARY: | 1565 | case RING_NOKIABINARY: |
1561 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; | 1566 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; |
1562 | break; | 1567 | break; |
1563 | case RING_MIDI: | 1568 | case RING_MIDI: |
1569 | case RING_MMF: | ||
1564 | return ERR_NOTSUPPORTED; | 1570 | return ERR_NOTSUPPORTED; |
1565 | } | 1571 | } |
1566 | 1572 | ||
1567 | error=DCT3_EnableSecurity (s, 0x01); | 1573 | error=DCT3_EnableSecurity (s, 0x01); |
1568 | if (error!=ERR_NONE) return error; | 1574 | if (error!=ERR_NONE) return error; |
1569 | 1575 | ||
1570 | req[3]=Ringtone->Location-1; | 1576 | req[3]=Ringtone->Location-1; |
1571 | s->Phone.Data.Ringtone=Ringtone; | 1577 | s->Phone.Data.Ringtone=Ringtone; |
1572 | smprintf(s, "Getting (binary) ringtone\n"); | 1578 | smprintf(s, "Getting (binary) ringtone\n"); |
1573 | return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone); | 1579 | return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone); |
1574 | } | 1580 | } |
1575 | 1581 | ||
1576 | static GSM_Error N6110_ReplyGetSecurityStatus(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1582 | static GSM_Error N6110_ReplyGetSecurityStatus(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1577 | { | 1583 | { |
1578 | *s->Phone.Data.SecurityStatus = msg.Buffer[4]; | 1584 | *s->Phone.Data.SecurityStatus = msg.Buffer[4]; |
1579 | 1585 | ||
1580 | #ifdef DEBUG | 1586 | #ifdef DEBUG |
1581 | smprintf(s, "Security code status\n"); | 1587 | smprintf(s, "Security code status\n"); |
1582 | switch(msg.Buffer[4]) { | 1588 | switch(msg.Buffer[4]) { |
1583 | case SEC_SecurityCode: smprintf(s, "waiting for Security Code.\n"); break; | 1589 | case SEC_SecurityCode: smprintf(s, "waiting for Security Code.\n"); break; |
1584 | case SEC_Pin : smprintf(s, "waiting for PIN.\n"); break; | 1590 | case SEC_Pin : smprintf(s, "waiting for PIN.\n"); break; |
1585 | case SEC_Pin2 : smprintf(s, "waiting for PIN2.\n"); break; | 1591 | case SEC_Pin2 : smprintf(s, "waiting for PIN2.\n"); break; |
1586 | case SEC_Puk : smprintf(s, "waiting for PUK.\n"); break; | 1592 | case SEC_Puk : smprintf(s, "waiting for PUK.\n"); break; |
1587 | case SEC_Puk2 : smprintf(s, "waiting for PUK2.\n"); break; | 1593 | case SEC_Puk2 : smprintf(s, "waiting for PUK2.\n"); break; |
@@ -2422,50 +2428,50 @@ static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntr | |||
2422 | Priv->LastCalendarPos++; | 2428 | Priv->LastCalendarPos++; |
2423 | } | 2429 | } |
2424 | 2430 | ||
2425 | Note->Location = Priv->LastCalendarPos; | 2431 | Note->Location = Priv->LastCalendarPos; |
2426 | req[4] = Priv->LastCalendarPos; | 2432 | req[4] = Priv->LastCalendarPos; |
2427 | 2433 | ||
2428 | s->Phone.Data.Cal=Note; | 2434 | s->Phone.Data.Cal=Note; |
2429 | smprintf(s, "Getting calendar note\n"); | 2435 | smprintf(s, "Getting calendar note\n"); |
2430 | error=GSM_WaitFor (s, req, 5, 0x13, 4, ID_GetCalendarNote); | 2436 | error=GSM_WaitFor (s, req, 5, 0x13, 4, ID_GetCalendarNote); |
2431 | 2437 | ||
2432 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(Note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); | 2438 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(Note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); |
2433 | /* 2090 year is set for example in 3310 */ | 2439 | /* 2090 year is set for example in 3310 */ |
2434 | if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) { | 2440 | if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) { |
2435 | error=N6110_GetDateTime(s, &date_time); | 2441 | error=N6110_GetDateTime(s, &date_time); |
2436 | if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year; | 2442 | if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year; |
2437 | } | 2443 | } |
2438 | return error; | 2444 | return error; |
2439 | } | 2445 | } |
2440 | 2446 | ||
2441 | GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2447 | GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2442 | { | 2448 | { |
2443 | unsigned char buffer[2000],buffer2[4000]; | 2449 | unsigned char buffer[2000],buffer2[4000]; |
2444 | int tmp; | 2450 | int tmp; |
2445 | 2451 | ||
2446 | tmp=GSM_UnpackEightBitsToSeven(0, 82, 82, msg.Buffer+8, buffer); | 2452 | tmp=GSM_UnpackEightBitsToSeven(0, msg.Buffer[7], 82, msg.Buffer+8, buffer); |
2447 | msg.Buffer[tmp] = 0; | 2453 | buffer[tmp] = 0; |
2448 | 2454 | ||
2449 | smprintf(s, "USSD reply: \"%s\"\n",buffer); | 2455 | smprintf(s, "USSD reply: \"%s\"\n",buffer); |
2450 | 2456 | ||
2451 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { | 2457 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { |
2452 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 2458 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
2453 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); | 2459 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); |
2454 | } | 2460 | } |
2455 | 2461 | ||
2456 | return ERR_NONE; | 2462 | return ERR_NONE; |
2457 | } | 2463 | } |
2458 | 2464 | ||
2459 | GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all) | 2465 | GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all) |
2460 | { | 2466 | { |
2461 | GSM_Error error; | 2467 | GSM_Error error; |
2462 | unsigned char req1[] = {N6110_FRAME_HEADER, 0x42, 0x05, 0x01, | 2468 | unsigned char req1[] = {N6110_FRAME_HEADER, 0x42, 0x05, 0x01, |
2463 | 0x07, 0xa2, 0x88, 0x81, 0x21, 0x15, 0x63, 0xa8, | 2469 | 0x07, 0xa2, 0x88, 0x81, 0x21, 0x15, 0x63, 0xa8, |
2464 | 0x00, 0x00, 0x07, 0xa3, 0xb8, 0x81, 0x20, 0x15, | 2470 | 0x00, 0x00, 0x07, 0xa3, 0xb8, 0x81, 0x20, 0x15, |
2465 | 0x63, 0x80}; | 2471 | 0x63, 0x80}; |
2466 | 2472 | ||
2467 | if (!all) { | 2473 | if (!all) { |
2468 | smprintf(s, "Answering call part 1\n"); | 2474 | smprintf(s, "Answering call part 1\n"); |
2469 | error = GSM_WaitFor (s, req1, 24, 0x01, 5, ID_AnswerCall); | 2475 | error = GSM_WaitFor (s, req1, 24, 0x01, 5, ID_AnswerCall); |
2470 | if (error != ERR_NONE) return error; | 2476 | if (error != ERR_NONE) return error; |
2471 | return DCT3DCT4_AnswerCall(s,ID); | 2477 | return DCT3DCT4_AnswerCall(s,ID); |
@@ -2786,48 +2792,49 @@ GSM_Phone_Functions N6110Phone = { | |||
2786 | N6110_GetSignalQuality, | 2792 | N6110_GetSignalQuality, |
2787 | DCT3_GetNetworkInfo, | 2793 | DCT3_GetNetworkInfo, |
2788 | NOTSUPPORTED, /* GetCategory */ | 2794 | NOTSUPPORTED, /* GetCategory */ |
2789 | NOTSUPPORTED, /* AddCategory */ | 2795 | NOTSUPPORTED, /* AddCategory */ |
2790 | NOTSUPPORTED, /* GetCategoryStatus */ | 2796 | NOTSUPPORTED, /* GetCategoryStatus */ |
2791 | N6110_GetMemoryStatus, | 2797 | N6110_GetMemoryStatus, |
2792 | N6110_GetMemory, | 2798 | N6110_GetMemory, |
2793 | NOTIMPLEMENTED, /* GetNextMemory */ | 2799 | NOTIMPLEMENTED, /* GetNextMemory */ |
2794 | N6110_SetMemory, | 2800 | N6110_SetMemory, |
2795 | NOTIMPLEMENTED, /* AddMemory */ | 2801 | NOTIMPLEMENTED, /* AddMemory */ |
2796 | N6110_DeleteMemory, | 2802 | N6110_DeleteMemory, |
2797 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 2803 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
2798 | N6110_GetSpeedDial, | 2804 | N6110_GetSpeedDial, |
2799 | NOTIMPLEMENTED, /* SetSpeedDial */ | 2805 | NOTIMPLEMENTED, /* SetSpeedDial */ |
2800 | DCT3_GetSMSC, | 2806 | DCT3_GetSMSC, |
2801 | DCT3_SetSMSC, | 2807 | DCT3_SetSMSC, |
2802 | DCT3_GetSMSStatus, | 2808 | DCT3_GetSMSStatus, |
2803 | N6110_GetSMSMessage, | 2809 | N6110_GetSMSMessage, |
2804 | N6110_GetNextSMSMessage, | 2810 | N6110_GetNextSMSMessage, |
2805 | N6110_SetSMS, | 2811 | N6110_SetSMS, |
2806 | N6110_AddSMS, | 2812 | N6110_AddSMS, |
2807 | N6110_DeleteSMSMessage, | 2813 | N6110_DeleteSMSMessage, |
2808 | DCT3_SendSMSMessage, | 2814 | DCT3_SendSMSMessage, |
2809 | NOTSUPPORTED, /* SendSavedSMS */ | 2815 | NOTSUPPORTED, /* SendSavedSMS */ |
2816 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
2810 | NOKIA_SetIncomingSMS, | 2817 | NOKIA_SetIncomingSMS, |
2811 | DCT3_SetIncomingCB, | 2818 | DCT3_SetIncomingCB, |
2812 | PHONE_GetSMSFolders, | 2819 | PHONE_GetSMSFolders, |
2813 | NOTSUPPORTED, /* AddSMSFolder */ | 2820 | NOTSUPPORTED, /* AddSMSFolder */ |
2814 | NOTSUPPORTED, /* DeleteSMSFolder */ | 2821 | NOTSUPPORTED, /* DeleteSMSFolder */ |
2815 | N6110_DialVoice, | 2822 | N6110_DialVoice, |
2816 | N6110_AnswerCall, | 2823 | N6110_AnswerCall, |
2817 | DCT3_CancelCall, | 2824 | DCT3_CancelCall, |
2818 | N6110_HoldCall, | 2825 | N6110_HoldCall, |
2819 | N6110_UnholdCall, | 2826 | N6110_UnholdCall, |
2820 | N6110_ConferenceCall, | 2827 | N6110_ConferenceCall, |
2821 | N6110_SplitCall, | 2828 | N6110_SplitCall, |
2822 | N6110_TransferCall, | 2829 | N6110_TransferCall, |
2823 | N6110_SwitchCall, | 2830 | N6110_SwitchCall, |
2824 | DCT3DCT4_GetCallDivert, | 2831 | DCT3DCT4_GetCallDivert, |
2825 | DCT3DCT4_SetCallDivert, | 2832 | DCT3DCT4_SetCallDivert, |
2826 | DCT3DCT4_CancelAllDiverts, | 2833 | DCT3DCT4_CancelAllDiverts, |
2827 | NOKIA_SetIncomingCall, | 2834 | NOKIA_SetIncomingCall, |
2828 | NOKIA_SetIncomingUSSD, | 2835 | NOKIA_SetIncomingUSSD, |
2829 | DCT3DCT4_SendDTMF, | 2836 | DCT3DCT4_SendDTMF, |
2830 | N6110_GetRingtone, | 2837 | N6110_GetRingtone, |
2831 | N6110_SetRingtone, | 2838 | N6110_SetRingtone, |
2832 | NOTSUPPORTED, /* GetRingtonesInfo */ | 2839 | NOTSUPPORTED, /* GetRingtonesInfo */ |
2833 | NOTSUPPORTED, /* DeleteUserRingtones */ | 2840 | NOTSUPPORTED, /* DeleteUserRingtones */ |
@@ -2840,45 +2847,45 @@ GSM_Phone_Functions N6110Phone = { | |||
2840 | NOTSUPPORTED, /* GetMMSSettings */ | 2847 | NOTSUPPORTED, /* GetMMSSettings */ |
2841 | NOTSUPPORTED, /* SetMMSSettings */ | 2848 | NOTSUPPORTED, /* SetMMSSettings */ |
2842 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 2849 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
2843 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 2850 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
2844 | NOTSUPPORTED, /* GetChatSettings */ | 2851 | NOTSUPPORTED, /* GetChatSettings */ |
2845 | NOTSUPPORTED, /* SetChatSettings */ | 2852 | NOTSUPPORTED, /* SetChatSettings */ |
2846 | N6110_GetBitmap, | 2853 | N6110_GetBitmap, |
2847 | N6110_SetBitmap, | 2854 | N6110_SetBitmap, |
2848 | NOTSUPPORTED, /* GetToDoStatus */ | 2855 | NOTSUPPORTED, /* GetToDoStatus */ |
2849 | NOTSUPPORTED, /* GetToDo */ | 2856 | NOTSUPPORTED, /* GetToDo */ |
2850 | NOTSUPPORTED, /* GetNextToDo */ | 2857 | NOTSUPPORTED, /* GetNextToDo */ |
2851 | NOTSUPPORTED, /* SetToDo */ | 2858 | NOTSUPPORTED, /* SetToDo */ |
2852 | NOTSUPPORTED, /* AddToDo */ | 2859 | NOTSUPPORTED, /* AddToDo */ |
2853 | NOTSUPPORTED, /* DeleteToDo */ | 2860 | NOTSUPPORTED, /* DeleteToDo */ |
2854 | NOTSUPPORTED, /* DeleteAllToDo */ | 2861 | NOTSUPPORTED, /* DeleteAllToDo */ |
2855 | NOTIMPLEMENTED, /* GetCalendarStatus */ | 2862 | NOTIMPLEMENTED, /* GetCalendarStatus */ |
2856 | NOTIMPLEMENTED, /* GetCalendar */ | 2863 | NOTIMPLEMENTED, /* GetCalendar */ |
2857 | N6110_GetNextCalendarNote, | 2864 | N6110_GetNextCalendarNote, |
2858 | NOTIMPLEMENTED, /* SetCalendar */ | 2865 | NOTIMPLEMENTED, /* SetCalendar */ |
2859 | N6110_AddCalendarNote, | 2866 | N6110_AddCalendarNote, |
2860 | N6110_DeleteCalendarNote, | 2867 | N6110_DeleteCalendarNote, |
2861 | NOTIMPLEMENTED, /* DeleteAllCalendar */ | 2868 | NOTIMPLEMENTED, /* DeleteAllCalendar */ |
2862 | NOTSUPPORTED, /* GetCalendarSettings */ | 2869 | NOTSUPPORTED, /* GetCalendarSettings */ |
2863 | NOTSUPPORTED, /* SetCalendarSettings */ | 2870 | NOTSUPPORTED, /* SetCalendarSettings */ |
2864 | NOTSUPPORTED, /* GetNote */ | 2871 | NOTSUPPORTED, /* GetNextNote */ |
2865 | N6110_GetProfile, | 2872 | N6110_GetProfile, |
2866 | N6110_SetProfile, | 2873 | N6110_SetProfile, |
2867 | NOTSUPPORTED, /* GetFMStation */ | 2874 | NOTSUPPORTED, /* GetFMStation */ |
2868 | NOTSUPPORTED, /* SetFMStation */ | 2875 | NOTSUPPORTED, /* SetFMStation */ |
2869 | NOTSUPPORTED, /* ClearFMStations */ | 2876 | NOTSUPPORTED, /* ClearFMStations */ |
2870 | NOTSUPPORTED, /* GetNextFileFolder */ | 2877 | NOTSUPPORTED, /* GetNextFileFolder */ |
2871 | NOTSUPPORTED, /* GetFilePart */ | 2878 | NOTSUPPORTED, /* GetFilePart */ |
2872 | NOTSUPPORTED, /* AddFile */ | 2879 | NOTSUPPORTED, /* AddFile */ |
2873 | NOTSUPPORTED, /* GetFileSystemStatus */ | 2880 | NOTSUPPORTED, /* GetFileSystemStatus */ |
2874 | NOTSUPPORTED, /* DeleteFile */ | 2881 | NOTSUPPORTED, /* DeleteFile */ |
2875 | NOTSUPPORTED, /* AddFolder */ | 2882 | NOTSUPPORTED, /* AddFolder */ |
2876 | NOTSUPPORTED, /* GetGPRSAccessPoint */ | 2883 | NOTSUPPORTED, /* GetGPRSAccessPoint */ |
2877 | NOTSUPPORTED /* SetGPRSAccessPoint */ | 2884 | NOTSUPPORTED /* SetGPRSAccessPoint */ |
2878 | }; | 2885 | }; |
2879 | 2886 | ||
2880 | #endif | 2887 | #endif |
2881 | 2888 | ||
2882 | /* How should editor hadle tabs in this file? Add editor commands here. | 2889 | /* How should editor hadle tabs in this file? Add editor commands here. |
2883 | * vim: noexpandtab sw=8 ts=8 sts=8: | 2890 | * vim: noexpandtab sw=8 ts=8 sts=8: |
2884 | */ | 2891 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct3/n7110.c b/gammu/emb/common/phone/nokia/dct3/n7110.c index 5a02c9c..b597f9b 100644 --- a/gammu/emb/common/phone/nokia/dct3/n7110.c +++ b/gammu/emb/common/phone/nokia/dct3/n7110.c | |||
@@ -1,26 +1,29 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail and Gnokii */ | 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 | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #include "../../../gsmstate.h" | 7 | #include "../../../gsmstate.h" |
5 | 8 | ||
6 | #ifdef GSM_ENABLE_NOKIA7110 | 9 | #ifdef GSM_ENABLE_NOKIA7110 |
7 | 10 | ||
8 | #include <string.h> | 11 | #include <string.h> |
9 | #include <time.h> | 12 | #include <time.h> |
10 | 13 | ||
11 | #include "../../../misc/coding/coding.h" | 14 | #include "../../../misc/coding/coding.h" |
12 | #include "../../../gsmcomon.h" | 15 | #include "../../../gsmcomon.h" |
13 | #include "../../../service/gsmlogo.h" | 16 | #include "../../../service/gsmlogo.h" |
14 | #include "../../pfunc.h" | 17 | #include "../../pfunc.h" |
15 | #include "../nfunc.h" | 18 | #include "../nfunc.h" |
16 | #include "../nfuncold.h" | 19 | #include "../nfuncold.h" |
17 | #include "n7110.h" | 20 | #include "n7110.h" |
18 | #include "dct3func.h" | 21 | #include "dct3func.h" |
19 | 22 | ||
20 | static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | 23 | static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) |
21 | { | 24 | { |
22 | return DCT3_GetAlarm(s, alarm, 0x19); | 25 | return DCT3_GetAlarm(s, alarm, 0x19); |
23 | } | 26 | } |
24 | 27 | ||
25 | static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | 28 | static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) |
26 | { | 29 | { |
@@ -505,48 +508,49 @@ static GSM_Error N7110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi | |||
505 | case 0x24: | 508 | case 0x24: |
506 | smprintf(s, "Invalid location. Too high ?\n"); | 509 | smprintf(s, "Invalid location. Too high ?\n"); |
507 | return ERR_INVALIDLOCATION; | 510 | return ERR_INVALIDLOCATION; |
508 | } | 511 | } |
509 | return ERR_UNKNOWNRESPONSE; | 512 | return ERR_UNKNOWNRESPONSE; |
510 | } | 513 | } |
511 | 514 | ||
512 | static GSM_Error N7110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | 515 | static GSM_Error N7110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) |
513 | { | 516 | { |
514 | unsigned char req[] = {N7110_FRAME_HEADER, 0x22, 0x00, 0x00}; | 517 | unsigned char req[] = {N7110_FRAME_HEADER, 0x22, 0x00, 0x00}; |
515 | 518 | ||
516 | if (PhoneRingtone) return ERR_NOTSUPPORTED; | 519 | if (PhoneRingtone) return ERR_NOTSUPPORTED; |
517 | if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; | 520 | if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; |
518 | 521 | ||
519 | switch (Ringtone->Format) { | 522 | switch (Ringtone->Format) { |
520 | case RING_NOTETONE: | 523 | case RING_NOTETONE: |
521 | /* In the future get binary and convert */ | 524 | /* In the future get binary and convert */ |
522 | return ERR_NOTSUPPORTED; | 525 | return ERR_NOTSUPPORTED; |
523 | case RING_NOKIABINARY: | 526 | case RING_NOKIABINARY: |
524 | req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location; | 527 | req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location; |
525 | s->Phone.Data.Ringtone=Ringtone; | 528 | s->Phone.Data.Ringtone=Ringtone; |
526 | smprintf(s, "Getting binary ringtone\n"); | 529 | smprintf(s, "Getting binary ringtone\n"); |
527 | return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone); | 530 | return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone); |
528 | case RING_MIDI: | 531 | case RING_MIDI: |
532 | case RING_MMF: | ||
529 | return ERR_NOTSUPPORTED; | 533 | return ERR_NOTSUPPORTED; |
530 | } | 534 | } |
531 | return ERR_NOTSUPPORTED; | 535 | return ERR_NOTSUPPORTED; |
532 | } | 536 | } |
533 | 537 | ||
534 | static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 538 | static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
535 | { | 539 | { |
536 | int i; | 540 | int i; |
537 | GSM_Phone_N7110Data*Priv = &s->Phone.Data.Priv.N7110; | 541 | GSM_Phone_N7110Data*Priv = &s->Phone.Data.Priv.N7110; |
538 | 542 | ||
539 | smprintf(s, "Received info for Picture Images\n"); | 543 | smprintf(s, "Received info for Picture Images\n"); |
540 | smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]); | 544 | smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]); |
541 | smprintf(s, "Locations :"); | 545 | smprintf(s, "Locations :"); |
542 | Priv->LastPictureImageFolder.Number=msg.Buffer[4]*256+msg.Buffer[5]; | 546 | Priv->LastPictureImageFolder.Number=msg.Buffer[4]*256+msg.Buffer[5]; |
543 | for (i=0;i<Priv->LastPictureImageFolder.Number;i++) { | 547 | for (i=0;i<Priv->LastPictureImageFolder.Number;i++) { |
544 | Priv->LastPictureImageFolder.Location[i]=msg.Buffer[6+i*2]*256+msg.Buffer[7+i*2]; | 548 | Priv->LastPictureImageFolder.Location[i]=msg.Buffer[6+i*2]*256+msg.Buffer[7+i*2]; |
545 | smprintf(s, " %i",Priv->LastPictureImageFolder.Location[i]); | 549 | smprintf(s, " %i",Priv->LastPictureImageFolder.Location[i]); |
546 | } | 550 | } |
547 | smprintf(s, "\n"); | 551 | smprintf(s, "\n"); |
548 | return ERR_NONE; | 552 | return ERR_NONE; |
549 | } | 553 | } |
550 | 554 | ||
551 | static GSM_Error N7110_GetPictureImageLocation(GSM_StateMachine *s, GSM_Bitmap *Bitmap, unsigned char *folder, int *location) | 555 | static GSM_Error N7110_GetPictureImageLocation(GSM_StateMachine *s, GSM_Bitmap *Bitmap, unsigned char *folder, int *location) |
552 | { | 556 | { |
@@ -1626,48 +1630,49 @@ GSM_Phone_Functions N7110Phone = { | |||
1626 | N71_92_GetSignalQuality, | 1630 | N71_92_GetSignalQuality, |
1627 | DCT3_GetNetworkInfo, | 1631 | DCT3_GetNetworkInfo, |
1628 | NOTSUPPORTED, /* GetCategory */ | 1632 | NOTSUPPORTED, /* GetCategory */ |
1629 | NOTSUPPORTED, /* AddCategory */ | 1633 | NOTSUPPORTED, /* AddCategory */ |
1630 | NOTSUPPORTED, /* GetCategoryStatus */ | 1634 | NOTSUPPORTED, /* GetCategoryStatus */ |
1631 | N7110_GetMemoryStatus, | 1635 | N7110_GetMemoryStatus, |
1632 | N7110_GetMemory, | 1636 | N7110_GetMemory, |
1633 | NOTIMPLEMENTED, /* GetNextMemory */ | 1637 | NOTIMPLEMENTED, /* GetNextMemory */ |
1634 | N7110_SetMemory, | 1638 | N7110_SetMemory, |
1635 | NOTIMPLEMENTED, /* AddMemory */ | 1639 | NOTIMPLEMENTED, /* AddMemory */ |
1636 | N7110_DeleteMemory, | 1640 | N7110_DeleteMemory, |
1637 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 1641 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
1638 | N7110_GetSpeedDial, | 1642 | N7110_GetSpeedDial, |
1639 | NOTIMPLEMENTED, /* SetSpeedDial */ | 1643 | NOTIMPLEMENTED, /* SetSpeedDial */ |
1640 | DCT3_GetSMSC, | 1644 | DCT3_GetSMSC, |
1641 | DCT3_SetSMSC, | 1645 | DCT3_SetSMSC, |
1642 | N7110_GetSMSStatus, | 1646 | N7110_GetSMSStatus, |
1643 | N7110_GetSMSMessage, | 1647 | N7110_GetSMSMessage, |
1644 | N7110_GetNextSMSMessage, | 1648 | N7110_GetNextSMSMessage, |
1645 | N7110_SetSMS, | 1649 | N7110_SetSMS, |
1646 | N7110_AddSMS, | 1650 | N7110_AddSMS, |
1647 | N7110_DeleteSMS, | 1651 | N7110_DeleteSMS, |
1648 | DCT3_SendSMSMessage, | 1652 | DCT3_SendSMSMessage, |
1649 | NOTSUPPORTED, /* SendSavedSMS */ | 1653 | NOTSUPPORTED, /* SendSavedSMS */ |
1654 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
1650 | N7110_SetIncomingSMS, | 1655 | N7110_SetIncomingSMS, |
1651 | DCT3_SetIncomingCB, | 1656 | DCT3_SetIncomingCB, |
1652 | N7110_GetSMSFolders, | 1657 | N7110_GetSMSFolders, |
1653 | NOTIMPLEMENTED, /* AddSMSFolder */ | 1658 | NOTIMPLEMENTED, /* AddSMSFolder */ |
1654 | NOTIMPLEMENTED, /* DeleteSMSFolder */ | 1659 | NOTIMPLEMENTED, /* DeleteSMSFolder */ |
1655 | DCT3_DialVoice, | 1660 | DCT3_DialVoice, |
1656 | N7110_AnswerCall, | 1661 | N7110_AnswerCall, |
1657 | DCT3_CancelCall, | 1662 | DCT3_CancelCall, |
1658 | NOTIMPLEMENTED, /* HoldCall */ | 1663 | NOTIMPLEMENTED, /* HoldCall */ |
1659 | NOTIMPLEMENTED, /* UnholdCall */ | 1664 | NOTIMPLEMENTED, /* UnholdCall */ |
1660 | NOTIMPLEMENTED, /* ConferenceCall */ | 1665 | NOTIMPLEMENTED, /* ConferenceCall */ |
1661 | NOTIMPLEMENTED, /* SplitCall */ | 1666 | NOTIMPLEMENTED, /* SplitCall */ |
1662 | NOTIMPLEMENTED, /* TransferCall */ | 1667 | NOTIMPLEMENTED, /* TransferCall */ |
1663 | NOTIMPLEMENTED, /* SwitchCall */ | 1668 | NOTIMPLEMENTED, /* SwitchCall */ |
1664 | NOTSUPPORTED, /* GetCallDivert */ | 1669 | NOTSUPPORTED, /* GetCallDivert */ |
1665 | N7110_SetCallDivert, | 1670 | N7110_SetCallDivert, |
1666 | N7110_CancelAllDiverts, | 1671 | N7110_CancelAllDiverts, |
1667 | N7110_SetIncomingCall, | 1672 | N7110_SetIncomingCall, |
1668 | N7110_SetIncomingUSSD, | 1673 | N7110_SetIncomingUSSD, |
1669 | DCT3DCT4_SendDTMF, | 1674 | DCT3DCT4_SendDTMF, |
1670 | N7110_GetRingtone, | 1675 | N7110_GetRingtone, |
1671 | N7110_SetRingtone, | 1676 | N7110_SetRingtone, |
1672 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 1677 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
1673 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 1678 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
@@ -1680,45 +1685,45 @@ GSM_Phone_Functions N7110Phone = { | |||
1680 | NOTSUPPORTED, /* GetMMSSettings */ | 1685 | NOTSUPPORTED, /* GetMMSSettings */ |
1681 | NOTSUPPORTED, /* SetMMSSettings */ | 1686 | NOTSUPPORTED, /* SetMMSSettings */ |
1682 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 1687 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
1683 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 1688 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
1684 | NOTSUPPORTED, /* GetChatSettings */ | 1689 | NOTSUPPORTED, /* GetChatSettings */ |
1685 | NOTSUPPORTED, /* SetChatSettings */ | 1690 | NOTSUPPORTED, /* SetChatSettings */ |
1686 | N7110_GetBitmap, | 1691 | N7110_GetBitmap, |
1687 | N7110_SetBitmap, | 1692 | N7110_SetBitmap, |
1688 | NOTSUPPORTED, /* GetToDoStatus */ | 1693 | NOTSUPPORTED, /* GetToDoStatus */ |
1689 | NOTSUPPORTED, /* GetToDo */ | 1694 | NOTSUPPORTED, /* GetToDo */ |
1690 | NOTSUPPORTED, /* GetNextToDo */ | 1695 | NOTSUPPORTED, /* GetNextToDo */ |
1691 | NOTSUPPORTED, /* SetToDo */ | 1696 | NOTSUPPORTED, /* SetToDo */ |
1692 | NOTSUPPORTED, /* AddToDo */ | 1697 | NOTSUPPORTED, /* AddToDo */ |
1693 | NOTSUPPORTED, /* DeleteToDo */ | 1698 | NOTSUPPORTED, /* DeleteToDo */ |
1694 | NOTSUPPORTED, /* DeleteAllToDo */ | 1699 | NOTSUPPORTED, /* DeleteAllToDo */ |
1695 | N7110_GetCalendarStatus, | 1700 | N7110_GetCalendarStatus, |
1696 | NOTIMPLEMENTED, /* GetCalendar */ | 1701 | NOTIMPLEMENTED, /* GetCalendar */ |
1697 | N7110_GetNextCalendar, | 1702 | N7110_GetNextCalendar, |
1698 | NOTIMPLEMENTED, /* SetCalendar */ | 1703 | NOTIMPLEMENTED, /* SetCalendar */ |
1699 | N7110_AddCalendar, | 1704 | N7110_AddCalendar, |
1700 | N71_65_DelCalendar, | 1705 | N71_65_DelCalendar, |
1701 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 1706 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
1702 | NOTSUPPORTED, /* GetCalendarSettings*/ | 1707 | NOTSUPPORTED, /* GetCalendarSettings*/ |
1703 | NOTSUPPORTED, /* SetCalendarSettings*/ | 1708 | NOTSUPPORTED, /* SetCalendarSettings*/ |
1704 | NOTSUPPORTED, /* GetNote */ | 1709 | NOTSUPPORTED, /* GetNextNote */ |
1705 | N7110_GetProfile, | 1710 | N7110_GetProfile, |
1706 | N7110_SetProfile, | 1711 | N7110_SetProfile, |
1707 | NOTSUPPORTED, /* GetFMStation */ | 1712 | NOTSUPPORTED, /* GetFMStation */ |
1708 | NOTSUPPORTED, /* SetFMStation */ | 1713 | NOTSUPPORTED, /* SetFMStation */ |
1709 | NOTSUPPORTED, /* ClearFMStations */ | 1714 | NOTSUPPORTED, /* ClearFMStations */ |
1710 | NOTSUPPORTED, /* GetNextFileFolder*/ | 1715 | NOTSUPPORTED, /* GetNextFileFolder*/ |
1711 | NOTSUPPORTED, /* GetFilePart */ | 1716 | NOTSUPPORTED, /* GetFilePart */ |
1712 | NOTSUPPORTED, /* AddFile */ | 1717 | NOTSUPPORTED, /* AddFile */ |
1713 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 1718 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
1714 | NOTSUPPORTED, /* DeleteFile */ | 1719 | NOTSUPPORTED, /* DeleteFile */ |
1715 | NOTSUPPORTED, /* AddFolder */ | 1720 | NOTSUPPORTED, /* AddFolder */ |
1716 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 1721 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
1717 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 1722 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
1718 | }; | 1723 | }; |
1719 | 1724 | ||
1720 | #endif | 1725 | #endif |
1721 | 1726 | ||
1722 | /* How should editor hadle tabs in this file? Add editor commands here. | 1727 | /* How should editor hadle tabs in this file? Add editor commands here. |
1723 | * vim: noexpandtab sw=8 ts=8 sts=8: | 1728 | * vim: noexpandtab sw=8 ts=8 sts=8: |
1724 | */ | 1729 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct3/n9210.c b/gammu/emb/common/phone/nokia/dct3/n9210.c index e82d530..ff71ad3 100644 --- a/gammu/emb/common/phone/nokia/dct3/n9210.c +++ b/gammu/emb/common/phone/nokia/dct3/n9210.c | |||
@@ -298,48 +298,49 @@ GSM_Phone_Functions N9210Phone = { | |||
298 | N71_92_GetSignalQuality, | 298 | N71_92_GetSignalQuality, |
299 | DCT3_GetNetworkInfo, | 299 | DCT3_GetNetworkInfo, |
300 | NOTSUPPORTED, /* GetCategory */ | 300 | NOTSUPPORTED, /* GetCategory */ |
301 | NOTSUPPORTED, /* AddCategory */ | 301 | NOTSUPPORTED, /* AddCategory */ |
302 | NOTSUPPORTED, /* GetCategoryStatus */ | 302 | NOTSUPPORTED, /* GetCategoryStatus */ |
303 | NOTIMPLEMENTED, /* GetMemoryStatus */ | 303 | NOTIMPLEMENTED, /* GetMemoryStatus */ |
304 | NOTIMPLEMENTED, /* GetMemory */ | 304 | NOTIMPLEMENTED, /* GetMemory */ |
305 | NOTIMPLEMENTED, /* GetNextMemory */ | 305 | NOTIMPLEMENTED, /* GetNextMemory */ |
306 | NOTIMPLEMENTED, /* SetMemory */ | 306 | NOTIMPLEMENTED, /* SetMemory */ |
307 | NOTIMPLEMENTED, /* AddMemory */ | 307 | NOTIMPLEMENTED, /* AddMemory */ |
308 | NOTIMPLEMENTED, /* DeleteMemory */ | 308 | NOTIMPLEMENTED, /* DeleteMemory */ |
309 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 309 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
310 | NOTIMPLEMENTED, /* GetSpeedDial */ | 310 | NOTIMPLEMENTED, /* GetSpeedDial */ |
311 | NOTIMPLEMENTED, /* SetSpeedDial */ | 311 | NOTIMPLEMENTED, /* SetSpeedDial */ |
312 | DCT3_GetSMSC, | 312 | DCT3_GetSMSC, |
313 | DCT3_SetSMSC, /* FIXME: test it */ | 313 | DCT3_SetSMSC, /* FIXME: test it */ |
314 | NOTIMPLEMENTED, /* GetSMSStatus */ | 314 | NOTIMPLEMENTED, /* GetSMSStatus */ |
315 | NOTIMPLEMENTED, /* GetSMS */ | 315 | NOTIMPLEMENTED, /* GetSMS */ |
316 | NOTIMPLEMENTED, /* GetNextSMS */ | 316 | NOTIMPLEMENTED, /* GetNextSMS */ |
317 | NOTIMPLEMENTED, /* SetSMS */ | 317 | NOTIMPLEMENTED, /* SetSMS */ |
318 | NOTIMPLEMENTED, /* AddSMS */ | 318 | NOTIMPLEMENTED, /* AddSMS */ |
319 | NOTIMPLEMENTED, /* DeleteSMS */ | 319 | NOTIMPLEMENTED, /* DeleteSMS */ |
320 | DCT3_SendSMSMessage, | 320 | DCT3_SendSMSMessage, |
321 | NOTSUPPORTED, /* SendSavedSMS */ | 321 | NOTSUPPORTED, /* SendSavedSMS */ |
322 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
322 | N9210_SetIncomingSMS, | 323 | N9210_SetIncomingSMS, |
323 | DCT3_SetIncomingCB, | 324 | DCT3_SetIncomingCB, |
324 | NOTIMPLEMENTED, /* GetSMSFolders */ | 325 | NOTIMPLEMENTED, /* GetSMSFolders */ |
325 | NOTSUPPORTED, /* AddSMSFolder */ | 326 | NOTSUPPORTED, /* AddSMSFolder */ |
326 | NOTSUPPORTED, /* DeleteSMSFolder */ | 327 | NOTSUPPORTED, /* DeleteSMSFolder */ |
327 | DCT3_DialVoice, | 328 | DCT3_DialVoice, |
328 | N9210_AnswerCall, | 329 | N9210_AnswerCall, |
329 | DCT3_CancelCall, | 330 | DCT3_CancelCall, |
330 | NOTSUPPORTED, /* HoldCall */ | 331 | NOTSUPPORTED, /* HoldCall */ |
331 | NOTSUPPORTED, /* UnholdCall */ | 332 | NOTSUPPORTED, /* UnholdCall */ |
332 | NOTSUPPORTED, /* ConferenceCall */ | 333 | NOTSUPPORTED, /* ConferenceCall */ |
333 | NOTSUPPORTED, /* SplitCall */ | 334 | NOTSUPPORTED, /* SplitCall */ |
334 | NOTSUPPORTED, /* TransferCall */ | 335 | NOTSUPPORTED, /* TransferCall */ |
335 | NOTSUPPORTED, /* SwitchCall */ | 336 | NOTSUPPORTED, /* SwitchCall */ |
336 | NOTSUPPORTED, /* GetCallDivert */ | 337 | NOTSUPPORTED, /* GetCallDivert */ |
337 | NOTSUPPORTED, /* SetCallDivert */ | 338 | NOTSUPPORTED, /* SetCallDivert */ |
338 | NOTSUPPORTED, /* CancelAllDiverts*/ | 339 | NOTSUPPORTED, /* CancelAllDiverts*/ |
339 | NOTSUPPORTED, /* SetIncomingCall */ | 340 | NOTSUPPORTED, /* SetIncomingCall */ |
340 | NOTIMPLEMENTED, /* SetIncomingUSSD */ | 341 | NOTIMPLEMENTED, /* SetIncomingUSSD */ |
341 | NOTSUPPORTED, /* SendDTMF */ | 342 | NOTSUPPORTED, /* SendDTMF */ |
342 | NOTIMPLEMENTED, /* GetRingtone */ | 343 | NOTIMPLEMENTED, /* GetRingtone */ |
343 | NOTIMPLEMENTED, /* SetRingtone */ | 344 | NOTIMPLEMENTED, /* SetRingtone */ |
344 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 345 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
345 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 346 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
@@ -352,45 +353,45 @@ GSM_Phone_Functions N9210Phone = { | |||
352 | NOTSUPPORTED, /* GetMMSSettings */ | 353 | NOTSUPPORTED, /* GetMMSSettings */ |
353 | NOTSUPPORTED, /* SetMMSSettings */ | 354 | NOTSUPPORTED, /* SetMMSSettings */ |
354 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 355 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
355 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 356 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
356 | NOTSUPPORTED, /* GetChatSettings */ | 357 | NOTSUPPORTED, /* GetChatSettings */ |
357 | NOTSUPPORTED, /* SetChatSettings */ | 358 | NOTSUPPORTED, /* SetChatSettings */ |
358 | N9210_GetBitmap, | 359 | N9210_GetBitmap, |
359 | N9210_SetBitmap, | 360 | N9210_SetBitmap, |
360 | NOTSUPPORTED, /* GetToDoStatus */ | 361 | NOTSUPPORTED, /* GetToDoStatus */ |
361 | NOTSUPPORTED, /* GetToDo */ | 362 | NOTSUPPORTED, /* GetToDo */ |
362 | NOTSUPPORTED, /* GetNextToDo */ | 363 | NOTSUPPORTED, /* GetNextToDo */ |
363 | NOTSUPPORTED, /* SetToDo */ | 364 | NOTSUPPORTED, /* SetToDo */ |
364 | NOTSUPPORTED, /* AddToDo */ | 365 | NOTSUPPORTED, /* AddToDo */ |
365 | NOTSUPPORTED, /* DeleteToDo */ | 366 | NOTSUPPORTED, /* DeleteToDo */ |
366 | NOTSUPPORTED, /* DeleteAllToDo */ | 367 | NOTSUPPORTED, /* DeleteAllToDo */ |
367 | NOTSUPPORTED, /* GetCalendarStatus*/ | 368 | NOTSUPPORTED, /* GetCalendarStatus*/ |
368 | NOTSUPPORTED, /* GetCalendar */ | 369 | NOTSUPPORTED, /* GetCalendar */ |
369 | NOTSUPPORTED, /* GetNextCalendar */ | 370 | NOTSUPPORTED, /* GetNextCalendar */ |
370 | NOTSUPPORTED, /* SetCalendar */ | 371 | NOTSUPPORTED, /* SetCalendar */ |
371 | NOTSUPPORTED, /* AddCalendar */ | 372 | NOTSUPPORTED, /* AddCalendar */ |
372 | NOTSUPPORTED, /* DeleteCalendar */ | 373 | NOTSUPPORTED, /* DeleteCalendar */ |
373 | NOTSUPPORTED, /* DeleteAllCalendar*/ | 374 | NOTSUPPORTED, /* DeleteAllCalendar*/ |
374 | NOTSUPPORTED, /* GetCalendarSettings*/ | 375 | NOTSUPPORTED, /* GetCalendarSettings*/ |
375 | NOTSUPPORTED, /* SetCalendarSettings*/ | 376 | NOTSUPPORTED, /* SetCalendarSettings*/ |
376 | NOTSUPPORTED, /* GetNote */ | 377 | NOTSUPPORTED, /* GetNextNote */ |
377 | NOTIMPLEMENTED, /* GetProfile */ | 378 | NOTIMPLEMENTED, /* GetProfile */ |
378 | NOTSUPPORTED, /* SetProfile */ | 379 | NOTSUPPORTED, /* SetProfile */ |
379 | NOTSUPPORTED, /* GetFMStation */ | 380 | NOTSUPPORTED, /* GetFMStation */ |
380 | NOTSUPPORTED, /* SetFMStation */ | 381 | NOTSUPPORTED, /* SetFMStation */ |
381 | NOTSUPPORTED, /* ClearFMStations */ | 382 | NOTSUPPORTED, /* ClearFMStations */ |
382 | NOTSUPPORTED, /* GetNextFileFolder*/ | 383 | NOTSUPPORTED, /* GetNextFileFolder*/ |
383 | NOTSUPPORTED, /* GetFilePart */ | 384 | NOTSUPPORTED, /* GetFilePart */ |
384 | NOTSUPPORTED, /* AddFile */ | 385 | NOTSUPPORTED, /* AddFile */ |
385 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 386 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
386 | NOTSUPPORTED, /* DeleteFile */ | 387 | NOTSUPPORTED, /* DeleteFile */ |
387 | NOTSUPPORTED, /* AddFolder */ | 388 | NOTSUPPORTED, /* AddFolder */ |
388 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 389 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
389 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 390 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
390 | }; | 391 | }; |
391 | 392 | ||
392 | #endif | 393 | #endif |
393 | 394 | ||
394 | /* How should editor hadle tabs in this file? Add editor commands here. | 395 | /* How should editor hadle tabs in this file? Add editor commands here. |
395 | * vim: noexpandtab sw=8 ts=8 sts=8: | 396 | * vim: noexpandtab sw=8 ts=8 sts=8: |
396 | */ | 397 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n3320.c b/gammu/emb/common/phone/nokia/dct4/n3320.c index 51e6f18..9b1d6cd 100644 --- a/gammu/emb/common/phone/nokia/dct4/n3320.c +++ b/gammu/emb/common/phone/nokia/dct4/n3320.c | |||
@@ -173,48 +173,49 @@ GSM_Phone_Functions N3320Phone = { | |||
173 | NOTSUPPORTED, /* GetSignalQuality*/ | 173 | NOTSUPPORTED, /* GetSignalQuality*/ |
174 | NOTSUPPORTED, /* GetNetworkInfo */ | 174 | NOTSUPPORTED, /* GetNetworkInfo */ |
175 | NOTSUPPORTED, /* GetCategory */ | 175 | NOTSUPPORTED, /* GetCategory */ |
176 | NOTSUPPORTED, /* AddCategory */ | 176 | NOTSUPPORTED, /* AddCategory */ |
177 | NOTSUPPORTED, /* GetCategoryStatus */ | 177 | NOTSUPPORTED, /* GetCategoryStatus */ |
178 | N3320_GetMemoryStatus, | 178 | N3320_GetMemoryStatus, |
179 | N3320_GetMemory, | 179 | N3320_GetMemory, |
180 | NOTSUPPORTED, /* GetNextMemory */ | 180 | NOTSUPPORTED, /* GetNextMemory */ |
181 | NOTSUPPORTED, /* SetMemory */ | 181 | NOTSUPPORTED, /* SetMemory */ |
182 | NOTSUPPORTED, /* AddMemory */ | 182 | NOTSUPPORTED, /* AddMemory */ |
183 | NOTSUPPORTED, /* DeleteMemory */ | 183 | NOTSUPPORTED, /* DeleteMemory */ |
184 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 184 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
185 | NOTSUPPORTED, /* GetSpeedDial */ | 185 | NOTSUPPORTED, /* GetSpeedDial */ |
186 | NOTSUPPORTED, /* SetSpeedDial */ | 186 | NOTSUPPORTED, /* SetSpeedDial */ |
187 | NOTSUPPORTED, /* GetSMSC */ | 187 | NOTSUPPORTED, /* GetSMSC */ |
188 | NOTSUPPORTED, /* SetSMSC */ | 188 | NOTSUPPORTED, /* SetSMSC */ |
189 | NOTSUPPORTED, /* GetSMSStatus */ | 189 | NOTSUPPORTED, /* GetSMSStatus */ |
190 | NOTSUPPORTED, /* GetSMS */ | 190 | NOTSUPPORTED, /* GetSMS */ |
191 | NOTSUPPORTED, /* GetNextSMS */ | 191 | NOTSUPPORTED, /* GetNextSMS */ |
192 | NOTSUPPORTED, /* SetSMS */ | 192 | NOTSUPPORTED, /* SetSMS */ |
193 | NOTSUPPORTED, /* AddSMS */ | 193 | NOTSUPPORTED, /* AddSMS */ |
194 | NOTSUPPORTED, /* DeleteSMS */ | 194 | NOTSUPPORTED, /* DeleteSMS */ |
195 | NOTSUPPORTED, /* SendSMS */ | 195 | NOTSUPPORTED, /* SendSMS */ |
196 | NOTSUPPORTED, /* SendSavedSMS */ | 196 | NOTSUPPORTED, /* SendSavedSMS */ |
197 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
197 | NOTSUPPORTED, /* SetIncomingSMS */ | 198 | NOTSUPPORTED, /* SetIncomingSMS */ |
198 | NOTSUPPORTED, /* SetIncomingCB */ | 199 | NOTSUPPORTED, /* SetIncomingCB */ |
199 | NOTSUPPORTED, /* GetSMSFolders */ | 200 | NOTSUPPORTED, /* GetSMSFolders */ |
200 | NOTSUPPORTED, /* AddSMSFolder */ | 201 | NOTSUPPORTED, /* AddSMSFolder */ |
201 | NOTSUPPORTED, /* DeleteSMSFolder */ | 202 | NOTSUPPORTED, /* DeleteSMSFolder */ |
202 | NOTIMPLEMENTED, /* DialVoice */ | 203 | NOTIMPLEMENTED, /* DialVoice */ |
203 | NOTIMPLEMENTED, /* AnswerCall */ | 204 | NOTIMPLEMENTED, /* AnswerCall */ |
204 | NOTIMPLEMENTED, /* CancelCall */ | 205 | NOTIMPLEMENTED, /* CancelCall */ |
205 | NOTIMPLEMENTED, /* HoldCall */ | 206 | NOTIMPLEMENTED, /* HoldCall */ |
206 | NOTIMPLEMENTED, /* UnholdCall */ | 207 | NOTIMPLEMENTED, /* UnholdCall */ |
207 | NOTIMPLEMENTED, /* ConferenceCall */ | 208 | NOTIMPLEMENTED, /* ConferenceCall */ |
208 | NOTIMPLEMENTED, /* SplitCall */ | 209 | NOTIMPLEMENTED, /* SplitCall */ |
209 | NOTIMPLEMENTED, /* TransferCall */ | 210 | NOTIMPLEMENTED, /* TransferCall */ |
210 | NOTIMPLEMENTED, /* SwitchCall */ | 211 | NOTIMPLEMENTED, /* SwitchCall */ |
211 | NOTSUPPORTED, /* GetCallDivert */ | 212 | NOTSUPPORTED, /* GetCallDivert */ |
212 | NOTSUPPORTED, /* SetCallDivert */ | 213 | NOTSUPPORTED, /* SetCallDivert */ |
213 | NOTSUPPORTED, /* CancelAllDiverts*/ | 214 | NOTSUPPORTED, /* CancelAllDiverts*/ |
214 | NOTIMPLEMENTED, /* SetIncomingCall */ | 215 | NOTIMPLEMENTED, /* SetIncomingCall */ |
215 | NOTIMPLEMENTED, /* SetIncomingUSSD */ | 216 | NOTIMPLEMENTED, /* SetIncomingUSSD */ |
216 | NOTSUPPORTED, /* SendDTMF */ | 217 | NOTSUPPORTED, /* SendDTMF */ |
217 | NOTSUPPORTED, /* GetRingtone */ | 218 | NOTSUPPORTED, /* GetRingtone */ |
218 | NOTSUPPORTED, /* SetRingtone */ | 219 | NOTSUPPORTED, /* SetRingtone */ |
219 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 220 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
220 | NOTIMPLEMENTED, /* DeleteUserRingtones*/ | 221 | NOTIMPLEMENTED, /* DeleteUserRingtones*/ |
@@ -227,45 +228,45 @@ GSM_Phone_Functions N3320Phone = { | |||
227 | NOTSUPPORTED, /* GetMMSSettings */ | 228 | NOTSUPPORTED, /* GetMMSSettings */ |
228 | NOTSUPPORTED, /* SetMMSSettings */ | 229 | NOTSUPPORTED, /* SetMMSSettings */ |
229 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 230 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
230 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 231 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
231 | NOTSUPPORTED, /* GetChatSettings */ | 232 | NOTSUPPORTED, /* GetChatSettings */ |
232 | NOTSUPPORTED, /* SetChatSettings */ | 233 | NOTSUPPORTED, /* SetChatSettings */ |
233 | NOTSUPPORTED, /* GetBitmap */ | 234 | NOTSUPPORTED, /* GetBitmap */ |
234 | NOTSUPPORTED, /* SetBitmap */ | 235 | NOTSUPPORTED, /* SetBitmap */ |
235 | NOTSUPPORTED, /* GetToDoStatus */ | 236 | NOTSUPPORTED, /* GetToDoStatus */ |
236 | NOTSUPPORTED, /* GetToDo */ | 237 | NOTSUPPORTED, /* GetToDo */ |
237 | NOTSUPPORTED, /* GetNextToDo */ | 238 | NOTSUPPORTED, /* GetNextToDo */ |
238 | NOTSUPPORTED, /* SetToDo */ | 239 | NOTSUPPORTED, /* SetToDo */ |
239 | NOTSUPPORTED, /* AddToDo */ | 240 | NOTSUPPORTED, /* AddToDo */ |
240 | NOTSUPPORTED, /* DeleteToDo */ | 241 | NOTSUPPORTED, /* DeleteToDo */ |
241 | NOTSUPPORTED, /* DeleteAllToDo */ | 242 | NOTSUPPORTED, /* DeleteAllToDo */ |
242 | N3320_GetCalendarStatus, | 243 | N3320_GetCalendarStatus, |
243 | NOTIMPLEMENTED, /* GetCalendar */ | 244 | NOTIMPLEMENTED, /* GetCalendar */ |
244 | N3320_GetNextCalendar, | 245 | N3320_GetNextCalendar, |
245 | NOTIMPLEMENTED, /* SetCalendar */ | 246 | NOTIMPLEMENTED, /* SetCalendar */ |
246 | NOTSUPPORTED, /* AddCalendar */ | 247 | NOTSUPPORTED, /* AddCalendar */ |
247 | NOTSUPPORTED, /* DeleteCalendar */ | 248 | NOTSUPPORTED, /* DeleteCalendar */ |
248 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 249 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
249 | NOTSUPPORTED, /* GetCalendarSettings*/ | 250 | NOTSUPPORTED, /* GetCalendarSettings*/ |
250 | NOTSUPPORTED, /* SetCalendarSettings*/ | 251 | NOTSUPPORTED, /* SetCalendarSettings*/ |
251 | NOTSUPPORTED, /* GetNote */ | 252 | NOTSUPPORTED, /* GetNextNote */ |
252 | NOTSUPPORTED, /* GetProfile */ | 253 | NOTSUPPORTED, /* GetProfile */ |
253 | NOTSUPPORTED, /* SetProfile */ | 254 | NOTSUPPORTED, /* SetProfile */ |
254 | NOTSUPPORTED, /* GetFMStation */ | 255 | NOTSUPPORTED, /* GetFMStation */ |
255 | NOTSUPPORTED, /* SetFMStation */ | 256 | NOTSUPPORTED, /* SetFMStation */ |
256 | NOTSUPPORTED, /* ClearFMStations */ | 257 | NOTSUPPORTED, /* ClearFMStations */ |
257 | NOTSUPPORTED, /* GetNextFileFolder*/ | 258 | NOTSUPPORTED, /* GetNextFileFolder*/ |
258 | NOTSUPPORTED, /* GetFilePart */ | 259 | NOTSUPPORTED, /* GetFilePart */ |
259 | NOTIMPLEMENTED, /* AddFilePart */ | 260 | NOTIMPLEMENTED, /* AddFilePart */ |
260 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 261 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
261 | NOTIMPLEMENTED, /* DeleteFile */ | 262 | NOTIMPLEMENTED, /* DeleteFile */ |
262 | NOTIMPLEMENTED, /* AddFolder */ | 263 | NOTIMPLEMENTED, /* AddFolder */ |
263 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 264 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
264 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 265 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
265 | }; | 266 | }; |
266 | 267 | ||
267 | #endif | 268 | #endif |
268 | 269 | ||
269 | /* How should editor hadle tabs in this file? Add editor commands here. | 270 | /* How should editor hadle tabs in this file? Add editor commands here. |
270 | * vim: noexpandtab sw=8 ts=8 sts=8: | 271 | * vim: noexpandtab sw=8 ts=8 sts=8: |
271 | */ | 272 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n3650.c b/gammu/emb/common/phone/nokia/dct4/n3650.c index 2da55bf..d4746a7 100644 --- a/gammu/emb/common/phone/nokia/dct4/n3650.c +++ b/gammu/emb/common/phone/nokia/dct4/n3650.c | |||
@@ -294,48 +294,49 @@ GSM_Phone_Functions N3650Phone = { | |||
294 | NOTSUPPORTED, /* GetSignalQuality*/ | 294 | NOTSUPPORTED, /* GetSignalQuality*/ |
295 | NOTSUPPORTED, /* GetNetworkInfo */ | 295 | NOTSUPPORTED, /* GetNetworkInfo */ |
296 | NOTSUPPORTED, /* GetCategory */ | 296 | NOTSUPPORTED, /* GetCategory */ |
297 | NOTSUPPORTED, /* AddCategory */ | 297 | NOTSUPPORTED, /* AddCategory */ |
298 | NOTSUPPORTED, /* GetCategoryStatus */ | 298 | NOTSUPPORTED, /* GetCategoryStatus */ |
299 | NOTSUPPORTED, /* GetMemoryStatus */ | 299 | NOTSUPPORTED, /* GetMemoryStatus */ |
300 | NOTSUPPORTED, /* GetMemory */ | 300 | NOTSUPPORTED, /* GetMemory */ |
301 | NOTSUPPORTED, /* GetNextMemory */ | 301 | NOTSUPPORTED, /* GetNextMemory */ |
302 | NOTSUPPORTED, /* SetMemory */ | 302 | NOTSUPPORTED, /* SetMemory */ |
303 | NOTSUPPORTED, /* AddMemory */ | 303 | NOTSUPPORTED, /* AddMemory */ |
304 | NOTSUPPORTED, /* DeleteMemory */ | 304 | NOTSUPPORTED, /* DeleteMemory */ |
305 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 305 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
306 | NOTSUPPORTED, /* GetSpeedDial */ | 306 | NOTSUPPORTED, /* GetSpeedDial */ |
307 | NOTSUPPORTED, /* SetSpeedDial */ | 307 | NOTSUPPORTED, /* SetSpeedDial */ |
308 | NOTSUPPORTED, /* GetSMSC */ | 308 | NOTSUPPORTED, /* GetSMSC */ |
309 | NOTSUPPORTED, /* SetSMSC */ | 309 | NOTSUPPORTED, /* SetSMSC */ |
310 | NOTSUPPORTED, /* GetSMSStatus */ | 310 | NOTSUPPORTED, /* GetSMSStatus */ |
311 | NOTSUPPORTED, /* GetSMS */ | 311 | NOTSUPPORTED, /* GetSMS */ |
312 | NOTSUPPORTED, /* GetNextSMS */ | 312 | NOTSUPPORTED, /* GetNextSMS */ |
313 | NOTSUPPORTED, /* SetSMS */ | 313 | NOTSUPPORTED, /* SetSMS */ |
314 | NOTSUPPORTED, /* AddSMS */ | 314 | NOTSUPPORTED, /* AddSMS */ |
315 | NOTSUPPORTED, /* DeleteSMS */ | 315 | NOTSUPPORTED, /* DeleteSMS */ |
316 | NOTSUPPORTED, /* SendSMS */ | 316 | NOTSUPPORTED, /* SendSMS */ |
317 | NOTSUPPORTED, /* SendSavedSMS */ | 317 | NOTSUPPORTED, /* SendSavedSMS */ |
318 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
318 | NOTSUPPORTED, /* SetIncomingSMS */ | 319 | NOTSUPPORTED, /* SetIncomingSMS */ |
319 | NOTSUPPORTED, /* SetIncomingCB */ | 320 | NOTSUPPORTED, /* SetIncomingCB */ |
320 | NOTSUPPORTED, /* GetSMSFolders */ | 321 | NOTSUPPORTED, /* GetSMSFolders */ |
321 | NOTSUPPORTED, /* AddSMSFolder */ | 322 | NOTSUPPORTED, /* AddSMSFolder */ |
322 | NOTSUPPORTED, /* DeleteSMSFolder */ | 323 | NOTSUPPORTED, /* DeleteSMSFolder */ |
323 | NOTIMPLEMENTED, /* DialVoice */ | 324 | NOTIMPLEMENTED, /* DialVoice */ |
324 | NOTIMPLEMENTED, /* AnswerCall */ | 325 | NOTIMPLEMENTED, /* AnswerCall */ |
325 | NOTIMPLEMENTED, /* CancelCall */ | 326 | NOTIMPLEMENTED, /* CancelCall */ |
326 | NOTIMPLEMENTED, /* HoldCall */ | 327 | NOTIMPLEMENTED, /* HoldCall */ |
327 | NOTIMPLEMENTED, /* UnholdCall */ | 328 | NOTIMPLEMENTED, /* UnholdCall */ |
328 | NOTIMPLEMENTED, /* ConferenceCall */ | 329 | NOTIMPLEMENTED, /* ConferenceCall */ |
329 | NOTIMPLEMENTED, /* SplitCall */ | 330 | NOTIMPLEMENTED, /* SplitCall */ |
330 | NOTIMPLEMENTED, /* TransferCall */ | 331 | NOTIMPLEMENTED, /* TransferCall */ |
331 | NOTIMPLEMENTED, /* SwitchCall */ | 332 | NOTIMPLEMENTED, /* SwitchCall */ |
332 | NOTSUPPORTED, /* GetCallDivert */ | 333 | NOTSUPPORTED, /* GetCallDivert */ |
333 | NOTSUPPORTED, /* SetCallDivert */ | 334 | NOTSUPPORTED, /* SetCallDivert */ |
334 | NOTSUPPORTED, /* CancelAllDiverts*/ | 335 | NOTSUPPORTED, /* CancelAllDiverts*/ |
335 | NOTIMPLEMENTED, /* SetIncomingCall */ | 336 | NOTIMPLEMENTED, /* SetIncomingCall */ |
336 | NOTIMPLEMENTED, /* SetIncomingUSSD */ | 337 | NOTIMPLEMENTED, /* SetIncomingUSSD */ |
337 | NOTSUPPORTED, /* SendDTMF */ | 338 | NOTSUPPORTED, /* SendDTMF */ |
338 | NOTSUPPORTED, /* GetRingtone */ | 339 | NOTSUPPORTED, /* GetRingtone */ |
339 | NOTSUPPORTED, /* SetRingtone */ | 340 | NOTSUPPORTED, /* SetRingtone */ |
340 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 341 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
341 | NOTIMPLEMENTED, /* DeleteUserRingtones*/ | 342 | NOTIMPLEMENTED, /* DeleteUserRingtones*/ |
@@ -348,45 +349,45 @@ GSM_Phone_Functions N3650Phone = { | |||
348 | NOTSUPPORTED, /* GetMMSSettings */ | 349 | NOTSUPPORTED, /* GetMMSSettings */ |
349 | NOTSUPPORTED, /* SetMMSSettings */ | 350 | NOTSUPPORTED, /* SetMMSSettings */ |
350 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 351 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
351 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 352 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
352 | NOTSUPPORTED, /* GetChatSettings */ | 353 | NOTSUPPORTED, /* GetChatSettings */ |
353 | NOTSUPPORTED, /* SetChatSettings */ | 354 | NOTSUPPORTED, /* SetChatSettings */ |
354 | NOTSUPPORTED, /* GetBitmap */ | 355 | NOTSUPPORTED, /* GetBitmap */ |
355 | NOTSUPPORTED, /* SetBitmap */ | 356 | NOTSUPPORTED, /* SetBitmap */ |
356 | NOTSUPPORTED, /* GetToDoStatus */ | 357 | NOTSUPPORTED, /* GetToDoStatus */ |
357 | NOTSUPPORTED, /* GetToDo */ | 358 | NOTSUPPORTED, /* GetToDo */ |
358 | NOTSUPPORTED, /* GetNextToDo */ | 359 | NOTSUPPORTED, /* GetNextToDo */ |
359 | NOTSUPPORTED, /* SetToDo */ | 360 | NOTSUPPORTED, /* SetToDo */ |
360 | NOTSUPPORTED, /* AddToDo */ | 361 | NOTSUPPORTED, /* AddToDo */ |
361 | NOTSUPPORTED, /* DeleteToDo */ | 362 | NOTSUPPORTED, /* DeleteToDo */ |
362 | NOTSUPPORTED, /* DeleteAllToDo */ | 363 | NOTSUPPORTED, /* DeleteAllToDo */ |
363 | NOTIMPLEMENTED, /* GetCalendarStatus*/ | 364 | NOTIMPLEMENTED, /* GetCalendarStatus*/ |
364 | NOTIMPLEMENTED, /* GetCalendar */ | 365 | NOTIMPLEMENTED, /* GetCalendar */ |
365 | NOTSUPPORTED, /* GetNextCalendar */ | 366 | NOTSUPPORTED, /* GetNextCalendar */ |
366 | NOTIMPLEMENTED, /* SetCalendar */ | 367 | NOTIMPLEMENTED, /* SetCalendar */ |
367 | NOTSUPPORTED, /* AddCalendar */ | 368 | NOTSUPPORTED, /* AddCalendar */ |
368 | NOTSUPPORTED, /* DeleteCalendar */ | 369 | NOTSUPPORTED, /* DeleteCalendar */ |
369 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 370 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
370 | NOTSUPPORTED, /* GetCalendarSettings*/ | 371 | NOTSUPPORTED, /* GetCalendarSettings*/ |
371 | NOTSUPPORTED, /* SetCalendarSettings*/ | 372 | NOTSUPPORTED, /* SetCalendarSettings*/ |
372 | NOTSUPPORTED, /* GetNote */ | 373 | NOTSUPPORTED, /* GetNextNote */ |
373 | NOTSUPPORTED, /* GetProfile */ | 374 | NOTSUPPORTED, /* GetProfile */ |
374 | NOTSUPPORTED, /* SetProfile */ | 375 | NOTSUPPORTED, /* SetProfile */ |
375 | NOTSUPPORTED, /* GetFMStation */ | 376 | NOTSUPPORTED, /* GetFMStation */ |
376 | NOTSUPPORTED, /* SetFMStation */ | 377 | NOTSUPPORTED, /* SetFMStation */ |
377 | NOTSUPPORTED, /* ClearFMStations */ | 378 | NOTSUPPORTED, /* ClearFMStations */ |
378 | N3650_GetNextFileFolder, | 379 | N3650_GetNextFileFolder, |
379 | N3650_GetFilePart, | 380 | N3650_GetFilePart, |
380 | NOTIMPLEMENTED, /* AddFilePart */ | 381 | NOTIMPLEMENTED, /* AddFilePart */ |
381 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 382 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
382 | NOTIMPLEMENTED, /* DeleteFile */ | 383 | NOTIMPLEMENTED, /* DeleteFile */ |
383 | NOTIMPLEMENTED, /* AddFolder */ | 384 | NOTIMPLEMENTED, /* AddFolder */ |
384 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 385 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
385 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 386 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
386 | }; | 387 | }; |
387 | 388 | ||
388 | #endif | 389 | #endif |
389 | 390 | ||
390 | /* How should editor hadle tabs in this file? Add editor commands here. | 391 | /* How should editor hadle tabs in this file? Add editor commands here. |
391 | * vim: noexpandtab sw=8 ts=8 sts=8: | 392 | * vim: noexpandtab sw=8 ts=8 sts=8: |
392 | */ | 393 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.c b/gammu/emb/common/phone/nokia/dct4/n6510.c index 67fe492..2208def 100644 --- a/gammu/emb/common/phone/nokia/dct4/n6510.c +++ b/gammu/emb/common/phone/nokia/dct4/n6510.c | |||
@@ -1,26 +1,29 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail, Pawel Kot and Gnokii */ | 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 | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | /* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ | 6 | /* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ |
4 | 7 | ||
5 | #include "../../../gsmstate.h" | 8 | #include "../../../gsmstate.h" |
6 | 9 | ||
7 | #ifdef GSM_ENABLE_NOKIA6510 | 10 | #ifdef GSM_ENABLE_NOKIA6510 |
8 | 11 | ||
9 | #include <string.h> | 12 | #include <string.h> |
10 | #include <time.h> | 13 | #include <time.h> |
11 | 14 | ||
12 | #include "../../../misc/coding/coding.h" | 15 | #include "../../../misc/coding/coding.h" |
13 | #include "../../../gsmcomon.h" | 16 | #include "../../../gsmcomon.h" |
14 | #include "../../../service/gsmlogo.h" | 17 | #include "../../../service/gsmlogo.h" |
15 | #include "../nfunc.h" | 18 | #include "../nfunc.h" |
16 | #include "../nfuncold.h" | 19 | #include "../nfuncold.h" |
17 | #include "../../pfunc.h" | 20 | #include "../../pfunc.h" |
18 | #include "dct4func.h" | 21 | #include "dct4func.h" |
19 | #include "n6510.h" | 22 | #include "n6510.h" |
20 | 23 | ||
21 | static GSM_Error N6510_Initialise (GSM_StateMachine *s) | 24 | static GSM_Error N6510_Initialise (GSM_StateMachine *s) |
22 | { | 25 | { |
23 | s->Phone.Data.Priv.N6510.CalendarIconsNum = 0; | 26 | s->Phone.Data.Priv.N6510.CalendarIconsNum = 0; |
24 | 27 | ||
25 | /* Enables various things like incoming SMS, call info, etc. */ | 28 | /* Enables various things like incoming SMS, call info, etc. */ |
26 | return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17\x39", 7); | 29 | return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17\x39", 7); |
@@ -98,48 +101,50 @@ static GSM_Error N6510_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine * | |||
98 | GSM_Phone_Data *Data = &s->Phone.Data; | 101 | GSM_Phone_Data *Data = &s->Phone.Data; |
99 | 102 | ||
100 | switch (msg.Buffer[4]) { | 103 | switch (msg.Buffer[4]) { |
101 | case 0x00: | 104 | case 0x00: |
102 | smprintf(s, "SMSC received\n"); | 105 | smprintf(s, "SMSC received\n"); |
103 | break; | 106 | break; |
104 | case 0x02: | 107 | case 0x02: |
105 | smprintf(s, "SMSC empty\n"); | 108 | smprintf(s, "SMSC empty\n"); |
106 | return ERR_INVALIDLOCATION; | 109 | return ERR_INVALIDLOCATION; |
107 | default: | 110 | default: |
108 | smprintf(s, "Unknown SMSC state: %02x\n",msg.Buffer[4]); | 111 | smprintf(s, "Unknown SMSC state: %02x\n",msg.Buffer[4]); |
109 | return ERR_UNKNOWNRESPONSE; | 112 | return ERR_UNKNOWNRESPONSE; |
110 | } | 113 | } |
111 | memset(Data->SMSC,0,sizeof(GSM_SMSC)); | 114 | memset(Data->SMSC,0,sizeof(GSM_SMSC)); |
112 | Data->SMSC->Location = msg.Buffer[8]; | 115 | Data->SMSC->Location = msg.Buffer[8]; |
113 | Data->SMSC->Format = SMS_FORMAT_Text; | 116 | Data->SMSC->Format = SMS_FORMAT_Text; |
114 | switch (msg.Buffer[10]) { | 117 | switch (msg.Buffer[10]) { |
115 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; | 118 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; |
116 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; | 119 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; |
117 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; | 120 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; |
118 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; | 121 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; |
119 | } | 122 | } |
120 | Data->SMSC->Validity.Format= SMS_Validity_RelativeFormat; | 123 | Data->SMSC->Validity.Format= SMS_Validity_RelativeFormat; |
121 | Data->SMSC->Validity.Relative= msg.Buffer[12]; | 124 | Data->SMSC->Validity.Relative= msg.Buffer[12]; |
125 | if (msg.Buffer[12] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time; | ||
126 | |||
122 | current = 14; | 127 | current = 14; |
123 | for (i=0;i<msg.Buffer[13];i++) { | 128 | for (i=0;i<msg.Buffer[13];i++) { |
124 | switch (msg.Buffer[current]) { | 129 | switch (msg.Buffer[current]) { |
125 | case 0x81: | 130 | case 0x81: |
126 | j=current+4; | 131 | j=current+4; |
127 | while (msg.Buffer[j]!=0) {j++;} | 132 | while (msg.Buffer[j]!=0) {j++;} |
128 | j=j-33; | 133 | j=j-33; |
129 | if (j>GSM_MAX_SMSC_NAME_LENGTH) { | 134 | if (j>GSM_MAX_SMSC_NAME_LENGTH) { |
130 | smprintf(s, "Too long name\n"); | 135 | smprintf(s, "Too long name\n"); |
131 | return ERR_UNKNOWNRESPONSE; | 136 | return ERR_UNKNOWNRESPONSE; |
132 | } | 137 | } |
133 | CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4); | 138 | CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4); |
134 | smprintf(s, " Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); | 139 | smprintf(s, " Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); |
135 | break; | 140 | break; |
136 | case 0x82: | 141 | case 0x82: |
137 | switch (msg.Buffer[current+2]) { | 142 | switch (msg.Buffer[current+2]) { |
138 | case 0x01: | 143 | case 0x01: |
139 | GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+current+4,true); | 144 | GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+current+4,true); |
140 | smprintf(s, " Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber)); | 145 | smprintf(s, " Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber)); |
141 | break; | 146 | break; |
142 | case 0x02: | 147 | case 0x02: |
143 | GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+current+4,false); | 148 | GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+current+4,false); |
144 | smprintf(s, " Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number)); | 149 | smprintf(s, " Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number)); |
145 | break; | 150 | break; |
@@ -964,53 +969,53 @@ static GSM_Error N6510_ReplyGetBatteryCharge(GSM_Protocol_Message msg, GSM_State | |||
964 | Data->BatteryCharge->BatteryPercent = ((int)(msg.Buffer[9]*100/7)); | 969 | Data->BatteryCharge->BatteryPercent = ((int)(msg.Buffer[9]*100/7)); |
965 | Data->BatteryCharge->ChargeState = 0; | 970 | Data->BatteryCharge->ChargeState = 0; |
966 | return ERR_NONE; | 971 | return ERR_NONE; |
967 | } | 972 | } |
968 | 973 | ||
969 | static GSM_Error N6510_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat) | 974 | static GSM_Error N6510_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat) |
970 | { | 975 | { |
971 | unsigned char req[] = {N6110_FRAME_HEADER, 0x0A, 0x02, 0x00}; | 976 | unsigned char req[] = {N6110_FRAME_HEADER, 0x0A, 0x02, 0x00}; |
972 | 977 | ||
973 | s->Phone.Data.BatteryCharge = bat; | 978 | s->Phone.Data.BatteryCharge = bat; |
974 | smprintf(s, "Getting battery level\n"); | 979 | smprintf(s, "Getting battery level\n"); |
975 | return GSM_WaitFor (s, req, 6, 0x17, 4, ID_GetBatteryCharge); | 980 | return GSM_WaitFor (s, req, 6, 0x17, 4, ID_GetBatteryCharge); |
976 | } | 981 | } |
977 | 982 | ||
978 | static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s) | 983 | static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s) |
979 | { | 984 | { |
980 | return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true); | 985 | return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true); |
981 | } | 986 | } |
982 | 987 | ||
983 | static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 988 | static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
984 | { | 989 | { |
985 | GSM_Phone_Data *Data = &s->Phone.Data; | 990 | GSM_Phone_Data *Data = &s->Phone.Data; |
986 | 991 | ||
987 | smprintf(s, "Operator logo received\n"); | 992 | smprintf(s, "Operator logo received\n"); |
993 | if (msg.Length == 18) return ERR_EMPTY; | ||
988 | NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode); | 994 | NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode); |
989 | smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode); | 995 | smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode); |
990 | Data->Bitmap->BitmapWidth= msg.Buffer[20]; | 996 | Data->Bitmap->BitmapWidth= msg.Buffer[20]; |
991 | Data->Bitmap->BitmapHeight= msg.Buffer[21]; | 997 | Data->Bitmap->BitmapHeight= msg.Buffer[21]; |
992 | if (msg.Length == 18) return ERR_EMPTY; | ||
993 | PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap); | 998 | PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap); |
994 | return ERR_NONE; | 999 | return ERR_NONE; |
995 | } | 1000 | } |
996 | 1001 | ||
997 | GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1002 | GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) |
998 | { | 1003 | { |
999 | smprintf(s, "Phonebook entry deleted\n"); | 1004 | smprintf(s, "Phonebook entry deleted\n"); |
1000 | return ERR_NONE; | 1005 | return ERR_NONE; |
1001 | } | 1006 | } |
1002 | 1007 | ||
1003 | GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) | 1008 | GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) |
1004 | { | 1009 | { |
1005 | unsigned char req[] = {N7110_FRAME_HEADER, 0x0f, 0x55, 0x01, | 1010 | unsigned char req[] = {N7110_FRAME_HEADER, 0x0f, 0x55, 0x01, |
1006 | 0x04, 0x55, 0x00, 0x10, 0xFF, 0x02, | 1011 | 0x04, 0x55, 0x00, 0x10, 0xFF, 0x02, |
1007 | 0x00, 0x01, /* location*/ | 1012 | 0x00, 0x01, /* location*/ |
1008 | 0x00, 0x00, 0x00, 0x00, | 1013 | 0x00, 0x00, 0x00, 0x00, |
1009 | 0x05, /* memory type*/ | 1014 | 0x05, /* memory type*/ |
1010 | 0x55, 0x55, 0x55}; | 1015 | 0x55, 0x55, 0x55}; |
1011 | 1016 | ||
1012 | req[12] = entry->Location / 256; | 1017 | req[12] = entry->Location / 256; |
1013 | req[13] = entry->Location % 256; | 1018 | req[13] = entry->Location % 256; |
1014 | 1019 | ||
1015 | req[18] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES); | 1020 | req[18] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES); |
1016 | if (req[18]==0xff) return ERR_NOTSUPPORTED; | 1021 | if (req[18]==0xff) return ERR_NOTSUPPORTED; |
@@ -1744,49 +1749,50 @@ static GSM_Error N6510_ReplyGetSyncMLName(GSM_Protocol_Message msg, GSM_StateMac | |||
1744 | } | 1749 | } |
1745 | 1750 | ||
1746 | static GSM_Error N6510_GetSyncMLSettings(GSM_StateMachine *s, GSM_SyncMLSettings *settings) | 1751 | static GSM_Error N6510_GetSyncMLSettings(GSM_StateMachine *s, GSM_SyncMLSettings *settings) |
1747 | { | 1752 | { |
1748 | GSM_Error error; | 1753 | GSM_Error error; |
1749 | // unsigned char NameReq[] = {N6110_FRAME_HEADER, 0x05, | 1754 | // unsigned char NameReq[] = {N6110_FRAME_HEADER, 0x05, |
1750 | // 0x00, 0x00, 0x00, 0x31, 0x00, | 1755 | // 0x00, 0x00, 0x00, 0x31, 0x00, |
1751 | // 0x06, 0x00, 0x00, 0x00, 0xDE, 0x00, 0x00}; | 1756 | // 0x06, 0x00, 0x00, 0x00, 0xDE, 0x00, 0x00}; |
1752 | // unsigned char GetActive[] = {N6110_FRAME_HEADER, 0x05, | 1757 | // unsigned char GetActive[] = {N6110_FRAME_HEADER, 0x05, |
1753 | // 0x00, 0x00, 0x00, 0x31, 0x00, | 1758 | // 0x00, 0x00, 0x00, 0x31, 0x00, |
1754 | // 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}; | 1759 | // 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}; |
1755 | unsigned char req[] = {N6110_FRAME_HEADER, 0x05, | 1760 | unsigned char req[] = {N6110_FRAME_HEADER, 0x05, |
1756 | 0x00, 0x00, 0x00, 0x31, 0x00, | 1761 | 0x00, 0x00, 0x00, 0x31, 0x00, |
1757 | 0x01, //location | 1762 | 0x01, //location |
1758 | 0x00, 0x00, 0x02, 0x46, 0x00, 0x00}; | 1763 | 0x00, 0x00, 0x02, 0x46, 0x00, 0x00}; |
1759 | 1764 | ||
1760 | settings->Connection.Location = settings->Location; | 1765 | settings->Connection.Location = settings->Location; |
1761 | error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS); | 1766 | error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS); |
1762 | if (error != ERR_NONE) return error; | 1767 | if (error != ERR_NONE) return error; |
1763 | 1768 | ||
1764 | settings->Active = settings->Connection.Active; | 1769 | settings->Active = settings->Connection.Active; |
1765 | 1770 | ||
1766 | settings->Name[0] = 0; | 1771 | settings->Name[0] = 0; |
1767 | settings->Name[1] = 0; | 1772 | settings->Name[1] = 0; |
1768 | //s->Phone.Data.SyncMLSettings = settings; | 1773 | s->Phone.Data.SyncMLSettings = settings; |
1774 | |||
1769 | //smprintf(s, "Getting SyncML settings name\n"); | 1775 | //smprintf(s, "Getting SyncML settings name\n"); |
1770 | //error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName); | 1776 | //error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName); |
1771 | //if (error != ERR_NONE) return error; | 1777 | //if (error != ERR_NONE) return error; |
1772 | 1778 | ||
1773 | req[9] = settings->Location - 1; | 1779 | req[9] = settings->Location - 1; |
1774 | smprintf(s, "Getting additional SyncML settings\n"); | 1780 | smprintf(s, "Getting additional SyncML settings\n"); |
1775 | return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings); | 1781 | return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings); |
1776 | } | 1782 | } |
1777 | 1783 | ||
1778 | static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1784 | static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1779 | { | 1785 | { |
1780 | GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings; | 1786 | GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings; |
1781 | int i; | 1787 | int i; |
1782 | 1788 | ||
1783 | Sett->Name[0] = 0; | 1789 | Sett->Name[0] = 0; |
1784 | Sett->Name[1] = 0; | 1790 | Sett->Name[1] = 0; |
1785 | Sett->HomePage[0] = 0; | 1791 | Sett->HomePage[0] = 0; |
1786 | Sett->HomePage[1] = 0; | 1792 | Sett->HomePage[1] = 0; |
1787 | Sett->User[0] = 0; | 1793 | Sett->User[0] = 0; |
1788 | Sett->User[1] = 0; | 1794 | Sett->User[1] = 0; |
1789 | Sett->Password[0] = 0; | 1795 | Sett->Password[0] = 0; |
1790 | Sett->Password[1] = 0; | 1796 | Sett->Password[1] = 0; |
1791 | 1797 | ||
1792 | switch(msg.Buffer[3]) { | 1798 | switch(msg.Buffer[3]) { |
@@ -2262,49 +2268,49 @@ static GSM_Error N6510_DeleteSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms | |||
2262 | unsigned char req[] = {N6110_FRAME_HEADER, 0x04, | 2268 | unsigned char req[] = {N6110_FRAME_HEADER, 0x04, |
2263 | 0x01, /* 0x01=SM, 0x02=ME */ | 2269 | 0x01, /* 0x01=SM, 0x02=ME */ |
2264 | 0x00, /* FolderID */ | 2270 | 0x00, /* FolderID */ |
2265 | 0x00, 0x02, /* Location */ | 2271 | 0x00, 0x02, /* Location */ |
2266 | 0x0F, 0x55}; | 2272 | 0x0F, 0x55}; |
2267 | 2273 | ||
2268 | N6510_GetSMSLocation(s, sms, &folderid, &location); | 2274 | N6510_GetSMSLocation(s, sms, &folderid, &location); |
2269 | 2275 | ||
2270 | switch (folderid) { | 2276 | switch (folderid) { |
2271 | case 0x01: req[5] = 0x02; break; /* INBOX SIM */ | 2277 | case 0x01: req[5] = 0x02; break; /* INBOX SIM */ |
2272 | case 0x02: req[5] = 0x03; break; /* OUTBOX SIM */ | 2278 | case 0x02: req[5] = 0x03; break; /* OUTBOX SIM */ |
2273 | default : req[5] = folderid - 1; req[4] = 0x02; break; /* ME folders*/ | 2279 | default : req[5] = folderid - 1; req[4] = 0x02; break; /* ME folders*/ |
2274 | } | 2280 | } |
2275 | req[6]=location / 256; | 2281 | req[6]=location / 256; |
2276 | req[7]=location; | 2282 | req[7]=location; |
2277 | 2283 | ||
2278 | smprintf(s, "Deleting sms\n"); | 2284 | smprintf(s, "Deleting sms\n"); |
2279 | return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage); | 2285 | return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage); |
2280 | } | 2286 | } |
2281 | 2287 | ||
2282 | static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2288 | static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2283 | { | 2289 | { |
2284 | switch (msg.Buffer[8]) { | 2290 | switch (msg.Buffer[8]) { |
2285 | case 0x00: | 2291 | case 0x00: |
2286 | smprintf(s, "SMS sent OK, TPMR for sent sms is %02x\n",msg.Buffer[10]); | 2292 | smprintf(s, "SMS sent OK, TPMR for sent sms is %d\n",msg.Buffer[10]); |
2287 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]); | 2293 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]); |
2288 | return ERR_NONE; | 2294 | return ERR_NONE; |
2289 | default: | 2295 | default: |
2290 | smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]); | 2296 | smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]); |
2291 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]); | 2297 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]); |
2292 | return ERR_NONE; | 2298 | return ERR_NONE; |
2293 | } | 2299 | } |
2294 | } | 2300 | } |
2295 | 2301 | ||
2296 | static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) | 2302 | static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) |
2297 | { | 2303 | { |
2298 | int length = 11; | 2304 | int length = 11; |
2299 | GSM_Error error; | 2305 | GSM_Error error; |
2300 | GSM_SMSMessageLayout Layout; | 2306 | GSM_SMSMessageLayout Layout; |
2301 | unsigned char req [300] = { | 2307 | unsigned char req [300] = { |
2302 | N6110_FRAME_HEADER, 0x02, 0x00, 0x00, 0x00, 0x55, 0x55}; | 2308 | N6110_FRAME_HEADER, 0x02, 0x00, 0x00, 0x00, 0x55, 0x55}; |
2303 | 2309 | ||
2304 | if (sms->PDU == SMS_Deliver) sms->PDU = SMS_Submit; | 2310 | if (sms->PDU == SMS_Deliver) sms->PDU = SMS_Submit; |
2305 | memset(req+9,0x00,sizeof(req) - 9); | 2311 | memset(req+9,0x00,sizeof(req) - 9); |
2306 | error=N6510_EncodeSMSFrame(s, sms, req + 9, &Layout, &length); | 2312 | error=N6510_EncodeSMSFrame(s, sms, req + 9, &Layout, &length); |
2307 | if (error != ERR_NONE) return error; | 2313 | if (error != ERR_NONE) return error; |
2308 | 2314 | ||
2309 | smprintf(s, "Sending sms\n"); | 2315 | smprintf(s, "Sending sms\n"); |
2310 | return s->Protocol.Functions->WriteMessage(s, req, length + 9, 0x02); | 2316 | return s->Protocol.Functions->WriteMessage(s, req, length + 9, 0x02); |
@@ -2749,48 +2755,49 @@ static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi | |||
2749 | static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | 2755 | static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) |
2750 | { | 2756 | { |
2751 | GSM_AllRingtonesInfo Info; | 2757 | GSM_AllRingtonesInfo Info; |
2752 | GSM_Error error; | 2758 | GSM_Error error; |
2753 | unsigned char req2[6] = {N7110_FRAME_HEADER, 0x12, | 2759 | unsigned char req2[6] = {N7110_FRAME_HEADER, 0x12, |
2754 | 0x00, 0xe7}; /* Location */ | 2760 | 0x00, 0xe7}; /* Location */ |
2755 | 2761 | ||
2756 | if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; | 2762 | if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; |
2757 | 2763 | ||
2758 | switch (Ringtone->Format) { | 2764 | switch (Ringtone->Format) { |
2759 | case RING_NOTETONE: | 2765 | case RING_NOTETONE: |
2760 | /* In the future get binary and convert */ | 2766 | /* In the future get binary and convert */ |
2761 | return ERR_NOTSUPPORTED; | 2767 | return ERR_NOTSUPPORTED; |
2762 | case RING_NOKIABINARY: | 2768 | case RING_NOKIABINARY: |
2763 | s->Phone.Data.Ringtone= Ringtone; | 2769 | s->Phone.Data.Ringtone= Ringtone; |
2764 | Info.Number = 0; | 2770 | Info.Number = 0; |
2765 | error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); | 2771 | error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); |
2766 | if (error != ERR_NONE) return error; | 2772 | if (error != ERR_NONE) return error; |
2767 | if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; | 2773 | if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; |
2768 | req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; | 2774 | req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; |
2769 | req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; | 2775 | req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; |
2770 | smprintf(s, "Getting binary ringtone\n"); | 2776 | smprintf(s, "Getting binary ringtone\n"); |
2771 | return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); | 2777 | return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); |
2772 | case RING_MIDI: | 2778 | case RING_MIDI: |
2779 | case RING_MMF: | ||
2773 | return ERR_NOTSUPPORTED; | 2780 | return ERR_NOTSUPPORTED; |
2774 | } | 2781 | } |
2775 | return ERR_NOTSUPPORTED; | 2782 | return ERR_NOTSUPPORTED; |
2776 | } | 2783 | } |
2777 | 2784 | ||
2778 | static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) | 2785 | static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) |
2779 | { | 2786 | { |
2780 | GSM_Error error; | 2787 | GSM_Error error; |
2781 | unsigned char reqStart[] = { | 2788 | unsigned char reqStart[] = { |
2782 | 0x00,0x06,0x01,0x00,0x07,0x00 }; | 2789 | 0x00,0x06,0x01,0x00,0x07,0x00 }; |
2783 | unsigned char reqPlay[] = { | 2790 | unsigned char reqPlay[] = { |
2784 | 0x00,0x06,0x01,0x14,0x05,0x04, | 2791 | 0x00,0x06,0x01,0x14,0x05,0x04, |
2785 | 0x00,0x00,0x00,0x03,0x03,0x08, | 2792 | 0x00,0x00,0x00,0x03,0x03,0x08, |
2786 | 0x00,0x00,0x00,0x01,0x00,0x00, | 2793 | 0x00,0x00,0x00,0x01,0x00,0x00, |
2787 | 0x03,0x08,0x01,0x00, | 2794 | 0x03,0x08,0x01,0x00, |
2788 | 0x07,0xd0,/*Frequency */ | 2795 | 0x07,0xd0,/*Frequency */ |
2789 | 0x00,0x00,0x03,0x08,0x02,0x00,0x00, | 2796 | 0x00,0x00,0x03,0x08,0x02,0x00,0x00, |
2790 | 0x05, /*Volume */ | 2797 | 0x05, /*Volume */ |
2791 | 0x00,0x00}; | 2798 | 0x00,0x00}; |
2792 | unsigned char reqOff[] = { | 2799 | unsigned char reqOff[] = { |
2793 | 0x00,0x06,0x01,0x14,0x05,0x05, | 2800 | 0x00,0x06,0x01,0x14,0x05,0x05, |
2794 | 0x00,0x00,0x00,0x01,0x03,0x08, | 2801 | 0x00,0x00,0x00,0x01,0x03,0x08, |
2795 | 0x05,0x00,0x00,0x08,0x00,0x00}; | 2802 | 0x05,0x00,0x00,0x08,0x00,0x00}; |
2796 | // unsigned char reqOff2[] = { | 2803 | // unsigned char reqOff2[] = { |
@@ -2965,48 +2972,51 @@ static GSM_Error N6510_ReplyGetProfile(GSM_Protocol_Message msg, GSM_StateMachin | |||
2965 | } | 2972 | } |
2966 | return ERR_NONE; | 2973 | return ERR_NONE; |
2967 | case 0x06: | 2974 | case 0x06: |
2968 | Data->Profile->Active = false; | 2975 | Data->Profile->Active = false; |
2969 | if (Data->Profile->Location == msg.Buffer[5]) Data->Profile->Active = true; | 2976 | if (Data->Profile->Location == msg.Buffer[5]) Data->Profile->Active = true; |
2970 | return ERR_NONE; | 2977 | return ERR_NONE; |
2971 | } | 2978 | } |
2972 | return ERR_UNKNOWNRESPONSE; | 2979 | return ERR_UNKNOWNRESPONSE; |
2973 | } | 2980 | } |
2974 | 2981 | ||
2975 | static GSM_Error N6510_GetProfile(GSM_StateMachine *s, GSM_Profile *Profile) | 2982 | static GSM_Error N6510_GetProfile(GSM_StateMachine *s, GSM_Profile *Profile) |
2976 | { | 2983 | { |
2977 | unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01}; | 2984 | unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01}; |
2978 | unsigned charreqActive[] = {N6110_FRAME_HEADER, 0x05}; | 2985 | unsigned charreqActive[] = {N6110_FRAME_HEADER, 0x05}; |
2979 | int i, length = 7; | 2986 | int i, length = 7; |
2980 | GSM_Errorerror; | 2987 | GSM_Errorerror; |
2981 | 2988 | ||
2982 | /* For now !!! */ | 2989 | /* For now !!! */ |
2983 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) { | 2990 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) { |
2984 | if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED; | 2991 | if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED; |
2985 | } | 2992 | } |
2986 | if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) { | 2993 | if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) { |
2987 | return ERR_NOTSUPPORTED; | 2994 | return ERR_NOTSUPPORTED; |
2988 | } | 2995 | } |
2996 | if (!strcmp(s->Phone.Data.ModelInfo->model,"5140")) { | ||
2997 | return ERR_NOTSUPPORTED; | ||
2998 | } | ||
2989 | 2999 | ||
2990 | if (Profile->Location>5) return ERR_INVALIDLOCATION; | 3000 | if (Profile->Location>5) return ERR_INVALIDLOCATION; |
2991 | 3001 | ||
2992 | for (i = 0; i < 0x0a; i++) { | 3002 | for (i = 0; i < 0x0a; i++) { |
2993 | req[length++] = 0x04; | 3003 | req[length++] = 0x04; |
2994 | req[length++] = Profile->Location; | 3004 | req[length++] = Profile->Location; |
2995 | req[length++] = i; | 3005 | req[length++] = i; |
2996 | req[length++] = 0x01; | 3006 | req[length++] = 0x01; |
2997 | } | 3007 | } |
2998 | 3008 | ||
2999 | req[length++] = 0x04; | 3009 | req[length++] = 0x04; |
3000 | req[length++] = Profile->Location; | 3010 | req[length++] = Profile->Location; |
3001 | req[length++] = 0x0c; | 3011 | req[length++] = 0x0c; |
3002 | req[length++] = 0x01; | 3012 | req[length++] = 0x01; |
3003 | 3013 | ||
3004 | req[length++] = 0x04; | 3014 | req[length++] = 0x04; |
3005 | 3015 | ||
3006 | Profile->CarKitProfile= false; | 3016 | Profile->CarKitProfile= false; |
3007 | Profile->HeadSetProfile= false; | 3017 | Profile->HeadSetProfile= false; |
3008 | 3018 | ||
3009 | Profile->FeaturesNumber = 0; | 3019 | Profile->FeaturesNumber = 0; |
3010 | 3020 | ||
3011 | s->Phone.Data.Profile=Profile; | 3021 | s->Phone.Data.Profile=Profile; |
3012 | smprintf(s, "Getting profile\n"); | 3022 | smprintf(s, "Getting profile\n"); |
@@ -3094,146 +3104,176 @@ static GSM_Error N6510_SetProfile(GSM_StateMachine *s, GSM_Profile *Profile) | |||
3094 | } | 3104 | } |
3095 | 3105 | ||
3096 | static GSM_Error N6510_ReplyIncomingSMS(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3106 | static GSM_Error N6510_ReplyIncomingSMS(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3097 | { | 3107 | { |
3098 | GSM_SMSMessage sms; | 3108 | GSM_SMSMessage sms; |
3099 | 3109 | ||
3100 | #ifdef DEBUG | 3110 | #ifdef DEBUG |
3101 | smprintf(s, "SMS message received\n"); | 3111 | smprintf(s, "SMS message received\n"); |
3102 | N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); | 3112 | N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); |
3103 | #endif | 3113 | #endif |
3104 | 3114 | ||
3105 | if (s->Phone.Data.EnableIncomingSMS && s->User.IncomingSMS!=NULL) { | 3115 | if (s->Phone.Data.EnableIncomingSMS && s->User.IncomingSMS!=NULL) { |
3106 | sms.State = SMS_UnRead; | 3116 | sms.State = SMS_UnRead; |
3107 | sms.InboxFolder = true; | 3117 | sms.InboxFolder = true; |
3108 | 3118 | ||
3109 | N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); | 3119 | N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); |
3110 | 3120 | ||
3111 | s->User.IncomingSMS(s->CurrentConfig->Device,sms); | 3121 | s->User.IncomingSMS(s->CurrentConfig->Device,sms); |
3112 | } | 3122 | } |
3113 | return ERR_NONE; | 3123 | return ERR_NONE; |
3114 | } | 3124 | } |
3115 | 3125 | ||
3116 | static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) | 3126 | static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) |
3117 | { | 3127 | { |
3128 | unsigned int pos2 = 15; | ||
3118 | unsigned intpos = 4; | 3129 | unsigned intpos = 4; |
3130 | unsigned char req2[100] = {N6110_FRAME_HEADER,0x01, | ||
3131 | 0x00,0x02,0x07,0x04, | ||
3132 | 0x01, // 1 - voice, 2 - data | ||
3133 | 0x00,0x03, | ||
3134 | 0x18, // length of rest + 1 | ||
3135 | 0x00,0x00,0x00}; | ||
3119 | unsigned char req[100] = {N6110_FRAME_HEADER,0x01, | 3136 | unsigned char req[100] = {N6110_FRAME_HEADER,0x01, |
3120 | 0x0c};/* Number length */ | 3137 | 0x0c};/* Number length */ |
3138 | GSM_Errorerror; | ||
3139 | |||
3140 | /* USSD not supported */ | ||
3141 | if (number[0] == '*') return ERR_NOTSUPPORTED; | ||
3142 | if (number[0] == '#') return ERR_NOTSUPPORTED; | ||
3121 | 3143 | ||
3122 | req[pos++] = strlen(number); | 3144 | req[pos++] = strlen(number); |
3123 | EncodeUnicode(req+pos,number,strlen(number)); | 3145 | EncodeUnicode(req+pos,number,strlen(number)); |
3124 | pos += strlen(number)*2; | 3146 | pos += strlen(number)*2; |
3125 | req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ | 3147 | req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ |
3126 | req[pos++] = 0x01; | 3148 | req[pos++] = 0x01; |
3127 | req[pos++] = 0x05; | 3149 | req[pos++] = 0x05; |
3128 | req[pos++] = 0x00; | 3150 | req[pos++] = 0x00; |
3129 | req[pos++] = 0x02; | 3151 | req[pos++] = 0x02; |
3130 | req[pos++] = 0x00; | 3152 | req[pos++] = 0x00; |
3131 | req[pos++] = 0x00; | 3153 | req[pos++] = 0x00; |
3132 | switch (ShowNumber) { | 3154 | switch (ShowNumber) { |
3133 | case GSM_CALL_HideNumber: | 3155 | case GSM_CALL_HideNumber: |
3134 | req[pos++] = 0x02; | 3156 | req[pos++] = 0x02; |
3135 | break; | 3157 | break; |
3136 | case GSM_CALL_ShowNumber: | 3158 | case GSM_CALL_ShowNumber: |
3137 | req[pos++] = 0x03; | 3159 | req[pos++] = 0x03; |
3138 | break; | 3160 | break; |
3139 | case GSM_CALL_DefaultNumberPresence: | 3161 | case GSM_CALL_DefaultNumberPresence: |
3140 | req[pos++] = 0x01; | 3162 | req[pos++] = 0x01; |
3141 | break; | 3163 | break; |
3142 | } | 3164 | } |
3165 | smprintf(s, "Making voice call\n"); | ||
3166 | error = GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice); | ||
3167 | if (error != ERR_NOTSUPPORTED) return error; | ||
3168 | |||
3169 | if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED; | ||
3170 | |||
3171 | req2[11] = strlen(number)*2+6; | ||
3172 | req2[pos2++] = strlen(number); | ||
3173 | EncodeUnicode(req2+pos2,number,strlen(number)); | ||
3174 | pos2 += strlen(number)*2; | ||
3143 | 3175 | ||
3144 | smprintf(s, "Making voice call\n"); | 3176 | smprintf(s, "Making voice call\n"); |
3145 | return GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice); | 3177 | error = GSM_WaitFor (s, req2, pos2, 0x01, 4, ID_DialVoice); |
3178 | if (error == ERR_NOTSUPPORTED) return ERR_NONE; | ||
3179 | return error; | ||
3146 | } | 3180 | } |
3147 | 3181 | ||
3148 | /* method 3 */ | 3182 | /* method 3 */ |
3149 | static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last) | 3183 | static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last) |
3150 | { | 3184 | { |
3151 | int i=0,j=0; | 3185 | int i=0,j=0; |
3152 | 3186 | ||
3153 | while (Last->Location[j] != 0x00) j++; | 3187 | while (Last->Location[j] != 0x00) j++; |
3154 | if (j >= GSM_MAXCALENDARTODONOTES) { | 3188 | if (j >= GSM_MAXCALENDARTODONOTES) { |
3155 | smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n"); | 3189 | smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n"); |
3156 | return ERR_UNKNOWN; | 3190 | return ERR_UNKNOWN; |
3157 | } | 3191 | } |
3158 | if (j == 0) { | 3192 | if (j == 0) { |
3159 | Last->Number=msg.Buffer[8]*256+msg.Buffer[9]; | 3193 | Last->Number=msg.Buffer[8]*256+msg.Buffer[9]; |
3160 | smprintf(s, "Number of Entries: %i\n",Last->Number); | 3194 | smprintf(s, "Number of Entries: %i\n",Last->Number); |
3161 | } | 3195 | } |
3162 | smprintf(s, "Locations: "); | 3196 | smprintf(s, "Locations: "); |
3163 | while (14+(i*4) <= msg.Length) { | 3197 | while (14+(i*4) <= msg.Length) { |
3164 | Last->Location[j++]=msg.Buffer[12+i*4]*256+msg.Buffer[13+i*4]; | 3198 | Last->Location[j++]=msg.Buffer[12+i*4]*256+msg.Buffer[13+i*4]; |
3165 | smprintf(s, "%i ",Last->Location[j-1]); | 3199 | smprintf(s, "%i ",Last->Location[j-1]); |
3166 | i++; | 3200 | i++; |
3167 | } | 3201 | } |
3168 | smprintf(s, "\nNumber of Entries in frame: %i\n",i); | 3202 | smprintf(s, "\nNumber of Entries in frame: %i\n",i); |
3169 | Last->Location[j] = 0; | 3203 | Last->Location[j] = 0; |
3170 | smprintf(s, "\n"); | 3204 | smprintf(s, "\n"); |
3171 | if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY; | 3205 | if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY; |
3172 | if (i == 0) return ERR_EMPTY; | 3206 | if (i == 0) return ERR_EMPTY; |
3173 | return ERR_NONE; | 3207 | return ERR_NONE; |
3174 | } | 3208 | } |
3175 | 3209 | ||
3176 | /* method 3 */ | 3210 | /* method 3 */ |
3177 | static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, bool Calendar) | 3211 | static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, char Type) |
3178 | { | 3212 | { |
3179 | GSM_Error error; | 3213 | GSM_Error error = ERR_UNKNOWN; |
3180 | int i; | 3214 | int i; |
3181 | unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00, | 3215 | unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00, |
3182 | 0x00, 0x00,/* First location */ | 3216 | 0x00, 0x00,/* First location */ |
3183 | 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style */ | 3217 | 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style, 2 = Notes */ |
3184 | 3218 | ||
3185 | Last->Location[0] = 0x00; | 3219 | Last->Location[0] = 0x00; |
3186 | Last->Number = 0; | 3220 | Last->Number = 0; |
3187 | 3221 | ||
3188 | if (Calendar) { | 3222 | req[10] = Type; |
3223 | if (Type == 0) { | ||
3189 | smprintf(s, "Getting locations for calendar method 3\n"); | 3224 | smprintf(s, "Getting locations for calendar method 3\n"); |
3190 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); | 3225 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); |
3191 | } else { | 3226 | } else if (Type == 1) { |
3192 | req[10] = 0x01; | ||
3193 | smprintf(s, "Getting locations for ToDo method 2\n"); | 3227 | smprintf(s, "Getting locations for ToDo method 2\n"); |
3194 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); | 3228 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); |
3229 | } else if (Type == 2) { | ||
3230 | smprintf(s, "Getting locations for Notes\n"); | ||
3231 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote); | ||
3195 | } | 3232 | } |
3196 | if (error != ERR_NONE && error != ERR_EMPTY) return error; | 3233 | if (error != ERR_NONE && error != ERR_EMPTY) return error; |
3197 | 3234 | ||
3198 | while (1) { | 3235 | while (1) { |
3199 | i=0; | 3236 | i=0; |
3200 | while (Last->Location[i] != 0x00) i++; | 3237 | while (Last->Location[i] != 0x00) i++; |
3201 | smprintf(s, "i = %i %i\n",i,Last->Number); | 3238 | smprintf(s, "i = %i %i\n",i,Last->Number); |
3202 | if (i == Last->Number) break; | 3239 | if (i == Last->Number) break; |
3203 | if (i != Last->Number && error == ERR_EMPTY) { | 3240 | if (i != Last->Number && error == ERR_EMPTY) { |
3204 | smprintf(s, "Phone doesn't support some notes with this method. Workaround\n"); | 3241 | smprintf(s, "Phone doesn't support some notes with this method. Workaround\n"); |
3205 | Last->Number = i; | 3242 | Last->Number = i; |
3206 | break; | 3243 | break; |
3207 | } | 3244 | } |
3208 | req[8] = Last->Location[i-1] / 256; | 3245 | req[8] = Last->Location[i-1] / 256; |
3209 | req[9] = Last->Location[i-1] % 256; | 3246 | req[9] = Last->Location[i-1] % 256; |
3210 | if (Calendar) { | 3247 | if (Type == 0) { |
3211 | smprintf(s, "Getting locations for calendar method 3\n"); | 3248 | smprintf(s, "Getting locations for calendar method 3\n"); |
3212 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); | 3249 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); |
3213 | } else { | 3250 | } else if (Type == 1) { |
3214 | smprintf(s, "Getting locations for todo method 2\n"); | 3251 | smprintf(s, "Getting locations for todo method 2\n"); |
3215 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); | 3252 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); |
3253 | } else if (Type == 2) { | ||
3254 | smprintf(s, "Getting locations for Notes\n"); | ||
3255 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote); | ||
3216 | } | 3256 | } |
3217 | if (error != ERR_NONE && error != ERR_EMPTY) return error; | 3257 | if (error != ERR_NONE && error != ERR_EMPTY) return error; |
3218 | } | 3258 | } |
3219 | return ERR_NONE; | 3259 | return ERR_NONE; |
3220 | } | 3260 | } |
3221 | 3261 | ||
3222 | /* method 3 */ | 3262 | /* method 3 */ |
3223 | GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3263 | GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3224 | { | 3264 | { |
3225 | GSM_CalendarEntry *entry = s->Phone.Data.Cal; | 3265 | GSM_CalendarEntry *entry = s->Phone.Data.Cal; |
3226 | GSM_DateTime Date; | 3266 | GSM_DateTime Date; |
3227 | unsigned long diff; | 3267 | unsigned long diff; |
3228 | int i; | 3268 | int i; |
3229 | bool found = false; | 3269 | bool found = false; |
3230 | GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; | 3270 | GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; |
3231 | 3271 | ||
3232 | smprintf(s, "Calendar note received method 3\n"); | 3272 | smprintf(s, "Calendar note received method 3\n"); |
3233 | 3273 | ||
3234 | smprintf(s,"Note type %02i: ",msg.Buffer[27]); | 3274 | smprintf(s,"Note type %02i: ",msg.Buffer[27]); |
3235 | switch(msg.Buffer[27]) { | 3275 | switch(msg.Buffer[27]) { |
3236 | case 0x00: smprintf(s,"Reminder\n"); entry->Type = GSM_CAL_REMINDER; break; | 3276 | case 0x00: smprintf(s,"Reminder\n"); entry->Type = GSM_CAL_REMINDER; break; |
3237 | case 0x01: smprintf(s,"Meeting\n"); entry->Type = GSM_CAL_MEETING; break; | 3277 | case 0x01: smprintf(s,"Meeting\n"); entry->Type = GSM_CAL_MEETING; break; |
3238 | case 0x02: smprintf(s,"Call\n"); entry->Type = GSM_CAL_CALL; break; | 3278 | case 0x02: smprintf(s,"Call\n"); entry->Type = GSM_CAL_CALL; break; |
3239 | case 0x04: smprintf(s,"Birthday\n"); entry->Type = GSM_CAL_BIRTHDAY; break; | 3279 | case 0x04: smprintf(s,"Birthday\n"); entry->Type = GSM_CAL_BIRTHDAY; break; |
@@ -3329,93 +3369,99 @@ GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
3329 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[51]*2] = 0; | 3369 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[51]*2] = 0; |
3330 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[51]*2+1] = 0; | 3370 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[51]*2+1] = 0; |
3331 | entry->Entries[entry->EntriesNum].EntryType = CAL_TEXT; | 3371 | entry->Entries[entry->EntriesNum].EntryType = CAL_TEXT; |
3332 | entry->EntriesNum++; | 3372 | entry->EntriesNum++; |
3333 | smprintf(s, "Note text: \"%s\"\n",DecodeUnicodeString(entry->Entries[entry->EntriesNum-1].Text)); | 3373 | smprintf(s, "Note text: \"%s\"\n",DecodeUnicodeString(entry->Entries[entry->EntriesNum-1].Text)); |
3334 | 3374 | ||
3335 | if (entry->Type == GSM_CAL_CALL) { | 3375 | if (entry->Type == GSM_CAL_CALL) { |
3336 | memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); | 3376 | memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); |
3337 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; | 3377 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; |
3338 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; | 3378 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; |
3339 | entry->Entries[entry->EntriesNum].EntryType = CAL_PHONE; | 3379 | entry->Entries[entry->EntriesNum].EntryType = CAL_PHONE; |
3340 | entry->EntriesNum++; | 3380 | entry->EntriesNum++; |
3341 | } | 3381 | } |
3342 | if (entry->Type == GSM_CAL_MEETING) { | 3382 | if (entry->Type == GSM_CAL_MEETING) { |
3343 | memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); | 3383 | memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); |
3344 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; | 3384 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; |
3345 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; | 3385 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; |
3346 | entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION; | 3386 | entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION; |
3347 | entry->EntriesNum++; | 3387 | entry->EntriesNum++; |
3348 | } | 3388 | } |
3349 | 3389 | ||
3350 | return ERR_NONE; | 3390 | return ERR_NONE; |
3351 | } | 3391 | } |
3352 | 3392 | ||
3393 | static GSM_Error N6510_PrivGetGenericCalendar3(GSM_StateMachine *s, int Location, GSM_Phone_RequestID ID) | ||
3394 | { | ||
3395 | unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00, | ||
3396 | 0x00,0x99,/* Location */ | ||
3397 | 0xff,0xff,0xff,0xff}; | ||
3398 | |||
3399 | req[8] = Location / 256; | ||
3400 | req[9] = Location % 256; | ||
3401 | |||
3402 | return GSM_WaitFor (s, req, 14, 0x13, 4, ID); | ||
3403 | } | ||
3404 | |||
3353 | static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear) | 3405 | static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear) |
3354 | { | 3406 | { |
3355 | GSM_Error error; | 3407 | GSM_Error error; |
3356 | GSM_DateTime date_time; | 3408 | GSM_DateTime date_time; |
3357 | unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00, | ||
3358 | 0x00,0x99,/* Location */ | ||
3359 | 0xff,0xff,0xff,0xff,0x01}; | ||
3360 | 3409 | ||
3361 | if (start) { | 3410 | if (start) { |
3362 | /* We have to get current year. It's NOT written in frame for | 3411 | /* We have to get current year. It's NOT written in frame for |
3363 | * Birthday | 3412 | * Birthday |
3364 | */ | 3413 | */ |
3365 | error=s->Phone.Functions->GetDateTime(s,&date_time); | 3414 | error=s->Phone.Functions->GetDateTime(s,&date_time); |
3366 | switch (error) { | 3415 | switch (error) { |
3367 | case ERR_EMPTY: | 3416 | case ERR_EMPTY: |
3368 | case ERR_NOTIMPLEMENTED: | 3417 | case ERR_NOTIMPLEMENTED: |
3369 | GSM_GetCurrentDateTime(&date_time); | 3418 | GSM_GetCurrentDateTime(&date_time); |
3370 | break; | 3419 | break; |
3371 | case ERR_NONE: | 3420 | case ERR_NONE: |
3372 | break; | 3421 | break; |
3373 | default: | 3422 | default: |
3374 | return error; | 3423 | return error; |
3375 | } | 3424 | } |
3376 | *LastCalendarYear = date_time.Year; | 3425 | *LastCalendarYear = date_time.Year; |
3377 | } | 3426 | } |
3378 | 3427 | ||
3379 | Note->EntriesNum = 0; | 3428 | Note->EntriesNum = 0; |
3380 | Note->Entries[0].Date.Year = *LastCalendarYear; | 3429 | Note->Entries[0].Date.Year = *LastCalendarYear; |
3381 | 3430 | ||
3382 | req[8] = Note->Location / 256; | ||
3383 | req[9] = Note->Location % 256; | ||
3384 | |||
3385 | s->Phone.Data.Cal=Note; | 3431 | s->Phone.Data.Cal=Note; |
3386 | smprintf(s, "Getting calendar note method 3\n"); | 3432 | smprintf(s, "Getting calendar note method 3\n"); |
3387 | return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetCalendarNote); | 3433 | return N6510_PrivGetGenericCalendar3(s, Note->Location, ID_GetCalendarNote); |
3388 | } | 3434 | } |
3389 | 3435 | ||
3390 | /* method 3 */ | 3436 | /* method 3 */ |
3391 | GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos) | 3437 | GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos) |
3392 | { | 3438 | { |
3393 | GSM_Error error; | 3439 | GSM_Error error; |
3394 | bool start2; | 3440 | bool start2; |
3395 | 3441 | ||
3396 | if (start) { | 3442 | if (start) { |
3397 | error=N6510_GetCalendarInfo3(s,LastCalendar,true); | 3443 | error=N6510_GetCalendarInfo3(s,LastCalendar,0); |
3398 | if (error!=ERR_NONE) return error; | 3444 | if (error!=ERR_NONE) return error; |
3399 | if (LastCalendar->Number == 0) return ERR_EMPTY; | 3445 | if (LastCalendar->Number == 0) return ERR_EMPTY; |
3400 | 3446 | ||
3401 | *LastCalendarPos = 0; | 3447 | *LastCalendarPos = 0; |
3402 | } else { | 3448 | } else { |
3403 | (*LastCalendarPos)++; | 3449 | (*LastCalendarPos)++; |
3404 | } | 3450 | } |
3405 | 3451 | ||
3406 | error = ERR_EMPTY; | 3452 | error = ERR_EMPTY; |
3407 | start2 = start; | 3453 | start2 = start; |
3408 | while (error == ERR_EMPTY) { | 3454 | while (error == ERR_EMPTY) { |
3409 | if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY; | 3455 | if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY; |
3410 | 3456 | ||
3411 | Note->Location = LastCalendar->Location[*LastCalendarPos]; | 3457 | Note->Location = LastCalendar->Location[*LastCalendarPos]; |
3412 | error=N6510_PrivGetCalendar3(s, Note, start2, LastCalendarYear); | 3458 | error=N6510_PrivGetCalendar3(s, Note, start2, LastCalendarYear); |
3413 | if (error == ERR_EMPTY) (*LastCalendarPos)++; | 3459 | if (error == ERR_EMPTY) (*LastCalendarPos)++; |
3414 | 3460 | ||
3415 | start2 = false; | 3461 | start2 = false; |
3416 | } | 3462 | } |
3417 | return error; | 3463 | return error; |
3418 | } | 3464 | } |
3419 | 3465 | ||
3420 | static GSM_Error N6510_ReplyGetCalendarInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3466 | static GSM_Error N6510_ReplyGetCalendarInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3421 | { | 3467 | { |
@@ -3456,66 +3502,66 @@ static GSM_Error N6510_ReplyGetCalendarNotePos(GSM_Protocol_Message msg, GSM_Sta | |||
3456 | case 0x96: | 3502 | case 0x96: |
3457 | return N6510_ReplyGetCalendarNotePos3(msg, s,&s->Phone.Data.Priv.N6510.FirstCalendarPos); | 3503 | return N6510_ReplyGetCalendarNotePos3(msg, s,&s->Phone.Data.Priv.N6510.FirstCalendarPos); |
3458 | } | 3504 | } |
3459 | return ERR_UNKNOWNRESPONSE; | 3505 | return ERR_UNKNOWNRESPONSE; |
3460 | } | 3506 | } |
3461 | 3507 | ||
3462 | static GSM_Error N6510_FindCalendarIconID3(GSM_StateMachine *s, GSM_CalendarEntry *Entry, unsigned char *ID) | 3508 | static GSM_Error N6510_FindCalendarIconID3(GSM_StateMachine *s, GSM_CalendarEntry *Entry, unsigned char *ID) |
3463 | { | 3509 | { |
3464 | int i,j,LastCalendarYear; | 3510 | int i,j,LastCalendarYear; |
3465 | GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; | 3511 | GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; |
3466 | GSM_CalendarEntry Note; | 3512 | GSM_CalendarEntry Note; |
3467 | GSM_NOKIACalToDoLocationsLastCalendar1,LastCalendar2; | 3513 | GSM_NOKIACalToDoLocationsLastCalendar1,LastCalendar2; |
3468 | GSM_Error error; | 3514 | GSM_Error error; |
3469 | bool found; | 3515 | bool found; |
3470 | 3516 | ||
3471 | for(i=0;i<Priv->CalendarIconsNum;i++) { | 3517 | for(i=0;i<Priv->CalendarIconsNum;i++) { |
3472 | if (Priv->CalendarIconsTypes[i] == Entry->Type) { | 3518 | if (Priv->CalendarIconsTypes[i] == Entry->Type) { |
3473 | *ID = Priv->CalendarIcons[i]; | 3519 | *ID = Priv->CalendarIcons[i]; |
3474 | return ERR_NONE; | 3520 | return ERR_NONE; |
3475 | } | 3521 | } |
3476 | } | 3522 | } |
3477 | 3523 | ||
3478 | smprintf(s, "Starting finding note ID\n"); | 3524 | smprintf(s, "Starting finding note ID\n"); |
3479 | 3525 | ||
3480 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true); | 3526 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0); |
3481 | memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); | 3527 | memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); |
3482 | if (error != ERR_NONE) return error; | 3528 | if (error != ERR_NONE) return error; |
3483 | 3529 | ||
3484 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) || | 3530 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) || |
3485 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) || | 3531 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) || |
3486 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { | 3532 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { |
3487 | error=N71_65_AddCalendar2(s,Entry); | 3533 | error=N71_65_AddCalendar2(s,Entry); |
3488 | } else { | 3534 | } else { |
3489 | if (Entry->Type == GSM_CAL_MEETING) { | 3535 | if (Entry->Type == GSM_CAL_MEETING) { |
3490 | error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos); | 3536 | error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos); |
3491 | } else { | 3537 | } else { |
3492 | error=N71_65_AddCalendar2(s,Entry); | 3538 | error=N71_65_AddCalendar2(s,Entry); |
3493 | } | 3539 | } |
3494 | } | 3540 | } |
3495 | if (error != ERR_NONE) return error; | 3541 | if (error != ERR_NONE) return error; |
3496 | 3542 | ||
3497 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true); | 3543 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0); |
3498 | memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); | 3544 | memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); |
3499 | if (error != ERR_NONE) return error; | 3545 | if (error != ERR_NONE) return error; |
3500 | 3546 | ||
3501 | smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number); | 3547 | smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number); |
3502 | 3548 | ||
3503 | for(i=0;i<LastCalendar2.Number;i++) { | 3549 | for(i=0;i<LastCalendar2.Number;i++) { |
3504 | found = true; | 3550 | found = true; |
3505 | for(j=0;j<LastCalendar1.Number;j++) { | 3551 | for(j=0;j<LastCalendar1.Number;j++) { |
3506 | if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) { | 3552 | if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) { |
3507 | found = false; | 3553 | found = false; |
3508 | break; | 3554 | break; |
3509 | } | 3555 | } |
3510 | } | 3556 | } |
3511 | if (found) { | 3557 | if (found) { |
3512 | Note.Location = LastCalendar2.Location[i]; | 3558 | Note.Location = LastCalendar2.Location[i]; |
3513 | error=N6510_PrivGetCalendar3(s, &Note, true, &LastCalendarYear); | 3559 | error=N6510_PrivGetCalendar3(s, &Note, true, &LastCalendarYear); |
3514 | if (error != ERR_NONE) return error; | 3560 | if (error != ERR_NONE) return error; |
3515 | 3561 | ||
3516 | error=N71_65_DelCalendar(s, &Note); | 3562 | error=N71_65_DelCalendar(s, &Note); |
3517 | if (error != ERR_NONE) return error; | 3563 | if (error != ERR_NONE) return error; |
3518 | 3564 | ||
3519 | smprintf(s, "Ending finding note ID\n"); | 3565 | smprintf(s, "Ending finding note ID\n"); |
3520 | 3566 | ||
3521 | for(j=0;j<Priv->CalendarIconsNum;j++) { | 3567 | for(j=0;j<Priv->CalendarIconsNum;j++) { |
@@ -3716,49 +3762,49 @@ static GSM_Error N6510_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry * | |||
3716 | 3762 | ||
3717 | static GSM_Error N6510_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) | 3763 | static GSM_Error N6510_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) |
3718 | { | 3764 | { |
3719 | GSM_Error error; | 3765 | GSM_Error error; |
3720 | 3766 | ||
3721 | #ifdef GSM_FORCE_DCT4_CALENDAR_6210 | 3767 | #ifdef GSM_FORCE_DCT4_CALENDAR_6210 |
3722 | /* Method 1 */ | 3768 | /* Method 1 */ |
3723 | error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); | 3769 | error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); |
3724 | if (error!=ERR_NONE) return error; | 3770 | if (error!=ERR_NONE) return error; |
3725 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; | 3771 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; |
3726 | return ERR_NONE; | 3772 | return ERR_NONE; |
3727 | #endif | 3773 | #endif |
3728 | 3774 | ||
3729 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { | 3775 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { |
3730 | /* Method 1 */ | 3776 | /* Method 1 */ |
3731 | error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); | 3777 | error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); |
3732 | if (error!=ERR_NONE) return error; | 3778 | if (error!=ERR_NONE) return error; |
3733 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; | 3779 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; |
3734 | return ERR_NONE; | 3780 | return ERR_NONE; |
3735 | 3781 | ||
3736 | /* Method 2 */ | 3782 | /* Method 2 */ |
3737 | // return ERR_NOTSUPPORTED; | 3783 | // return ERR_NOTSUPPORTED; |
3738 | } else { | 3784 | } else { |
3739 | /* Method 3 */ | 3785 | /* Method 3 */ |
3740 | error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,true); | 3786 | error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,0); |
3741 | if (error!=ERR_NONE) return error; | 3787 | if (error!=ERR_NONE) return error; |
3742 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; | 3788 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; |
3743 | return ERR_NONE; | 3789 | return ERR_NONE; |
3744 | } | 3790 | } |
3745 | } | 3791 | } |
3746 | 3792 | ||
3747 | static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 3793 | static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
3748 | { | 3794 | { |
3749 | #ifdef GSM_FORCE_DCT4_CALENDAR_6210 | 3795 | #ifdef GSM_FORCE_DCT4_CALENDAR_6210 |
3750 | return N71_65_AddCalendar2(s,Note); | 3796 | return N71_65_AddCalendar2(s,Note); |
3751 | #endif | 3797 | #endif |
3752 | 3798 | ||
3753 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { | 3799 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { |
3754 | return N71_65_AddCalendar2(s,Note); | 3800 | return N71_65_AddCalendar2(s,Note); |
3755 | // return N71_65_AddCalendar1(s, Note, &s->Phone.Data.Priv.N6510.FirstCalendarPos); | 3801 | // return N71_65_AddCalendar1(s, Note, &s->Phone.Data.Priv.N6510.FirstCalendarPos); |
3756 | } else { | 3802 | } else { |
3757 | /* Method 3. All DCT4 features supported. Not supported by 8910 */ | 3803 | /* Method 3. All DCT4 features supported. Not supported by 8910 */ |
3758 | return N6510_AddCalendar3(s, Note, &s->Phone.Data.Priv.N6510.FirstCalendarPos); | 3804 | return N6510_AddCalendar3(s, Note, &s->Phone.Data.Priv.N6510.FirstCalendarPos); |
3759 | } | 3805 | } |
3760 | } | 3806 | } |
3761 | 3807 | ||
3762 | static GSM_Error N6510_ReplyLogIntoNetwork(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3808 | static GSM_Error N6510_ReplyLogIntoNetwork(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3763 | { | 3809 | { |
3764 | smprintf(s, "Probably phone says: I log into network\n"); | 3810 | smprintf(s, "Probably phone says: I log into network\n"); |
@@ -3951,48 +3997,84 @@ GSM_Error N6510_SetLight(GSM_StateMachine *s, N6510_PHONE_LIGHTS light, bool ena | |||
3951 | 3997 | ||
3952 | static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable) | 3998 | static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable) |
3953 | { | 3999 | { |
3954 | GSM_Error error; | 4000 | GSM_Error error; |
3955 | 4001 | ||
3956 | if (enable) { | 4002 | if (enable) { |
3957 | error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,true); | 4003 | error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,true); |
3958 | if (error != ERR_NONE) return error; | 4004 | if (error != ERR_NONE) return error; |
3959 | 4005 | ||
3960 | error=N6510_SetLight(s,N6510_LIGHT_TORCH,true); | 4006 | error=N6510_SetLight(s,N6510_LIGHT_TORCH,true); |
3961 | if (error != ERR_NONE) return error; | 4007 | if (error != ERR_NONE) return error; |
3962 | 4008 | ||
3963 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true); | 4009 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true); |
3964 | } else { | 4010 | } else { |
3965 | error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false); | 4011 | error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false); |
3966 | if (error != ERR_NONE) return error; | 4012 | if (error != ERR_NONE) return error; |
3967 | 4013 | ||
3968 | error=N6510_SetLight(s,N6510_LIGHT_TORCH,false); | 4014 | error=N6510_SetLight(s,N6510_LIGHT_TORCH,false); |
3969 | if (error != ERR_NONE) return error; | 4015 | if (error != ERR_NONE) return error; |
3970 | 4016 | ||
3971 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false); | 4017 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false); |
3972 | } | 4018 | } |
3973 | } | 4019 | } |
3974 | 4020 | ||
4021 | static GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
4022 | { | ||
4023 | return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastNote); | ||
4024 | } | ||
4025 | |||
4026 | static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
4027 | { | ||
4028 | smprintf(s, "Note received\n"); | ||
4029 | 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; | ||
4031 | s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2+1] = 0; | ||
4032 | return ERR_NONE; | ||
4033 | } | ||
4034 | |||
4035 | GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start) | ||
4036 | { | ||
4037 | GSM_Error error; | ||
4038 | GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; | ||
4039 | |||
4040 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED; | ||
4041 | |||
4042 | if (start) { | ||
4043 | error=N6510_GetCalendarInfo3(s,LastNote,2); | ||
4044 | if (error!=ERR_NONE) return error; | ||
4045 | Note->Location = 1; | ||
4046 | } else { | ||
4047 | Note->Location++; | ||
4048 | } | ||
4049 | |||
4050 | if (Note->Location > LastNote->Number) return ERR_EMPTY; | ||
4051 | |||
4052 | s->Phone.Data.Note = Note; | ||
4053 | smprintf(s, "Getting note\n"); | ||
4054 | return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote); | ||
4055 | } | ||
4056 | |||
3975 | static int N6510_FindFileCheckSum(unsigned char *ptr, int len) | 4057 | static int N6510_FindFileCheckSum(unsigned char *ptr, int len) |
3976 | { | 4058 | { |
3977 | int acc, i, accx; | 4059 | int acc, i, accx; |
3978 | 4060 | ||
3979 | accx = 0; | 4061 | accx = 0; |
3980 | acc = 0xffff; | 4062 | acc = 0xffff; |
3981 | while (len--) { | 4063 | while (len--) { |
3982 | accx = (accx & 0xffff00ff) | (acc & 0xff00); | 4064 | accx = (accx & 0xffff00ff) | (acc & 0xff00); |
3983 | acc = (acc & 0xffff00ff) | *ptr++ << 8; | 4065 | acc = (acc & 0xffff00ff) | *ptr++ << 8; |
3984 | for (i = 0; i < 8; i++) { | 4066 | for (i = 0; i < 8; i++) { |
3985 | acc <<= 1; | 4067 | acc <<= 1; |
3986 | if (acc & 0x10000) acc ^= 0x1021; | 4068 | if (acc & 0x10000) acc ^= 0x1021; |
3987 | if (accx & 0x80000000) acc ^= 0x1021; | 4069 | if (accx & 0x80000000) acc ^= 0x1021; |
3988 | accx <<= 1; | 4070 | accx <<= 1; |
3989 | } | 4071 | } |
3990 | } | 4072 | } |
3991 | dbgprintf("Checksum from Gammu is %04X\n",(acc & 0xffff)); | 4073 | dbgprintf("Checksum from Gammu is %04X\n",(acc & 0xffff)); |
3992 | return (acc & 0xffff); | 4074 | return (acc & 0xffff); |
3993 | } | 4075 | } |
3994 | 4076 | ||
3995 | static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 4077 | static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3996 | { | 4078 | { |
3997 | GSM_File *File = s->Phone.Data.FileInfo; | 4079 | GSM_File *File = s->Phone.Data.FileInfo; |
3998 | GSM_Phone_N6510Data*Priv = &s->Phone.Data.Priv.N6510; | 4080 | GSM_Phone_N6510Data*Priv = &s->Phone.Data.Priv.N6510; |
@@ -4034,49 +4116,49 @@ static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_Stat | |||
4034 | 4116 | ||
4035 | File->Type = GSM_File_Other; | 4117 | File->Type = GSM_File_Other; |
4036 | if (msg.Length > 240){ | 4118 | if (msg.Length > 240){ |
4037 | i = 227; | 4119 | i = 227; |
4038 | if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x01) | 4120 | if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x01) |
4039 | File->Type = GSM_File_Image_JPG; | 4121 | File->Type = GSM_File_Image_JPG; |
4040 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x02) | 4122 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x02) |
4041 | File->Type = GSM_File_Image_BMP; | 4123 | File->Type = GSM_File_Image_BMP; |
4042 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x07) | 4124 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x07) |
4043 | File->Type = GSM_File_Image_BMP; | 4125 | File->Type = GSM_File_Image_BMP; |
4044 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x03) | 4126 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x03) |
4045 | File->Type = GSM_File_Image_PNG; | 4127 | File->Type = GSM_File_Image_PNG; |
4046 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05) | 4128 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05) |
4047 | File->Type = GSM_File_Image_GIF; | 4129 | File->Type = GSM_File_Image_GIF; |
4048 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09) | 4130 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09) |
4049 | File->Type = GSM_File_Image_WBMP; | 4131 | File->Type = GSM_File_Image_WBMP; |
4050 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01) | 4132 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01) |
4051 | File->Type = GSM_File_Sound_AMR; | 4133 | File->Type = GSM_File_Sound_AMR; |
4052 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02) | 4134 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02) |
4053 | File->Type = GSM_File_Sound_MIDI; | 4135 | File->Type = GSM_File_Sound_MIDI; |
4054 | else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05) | 4136 | else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05) |
4055 | File->Type = GSM_File_Video_3GP; | 4137 | File->Type = GSM_File_Video_3GP; |
4056 | else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01) | 4138 | else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01) |
4057 | File->Type = GSM_File_Java_JAR; | 4139 | File->Type = GSM_File_Java_JAR; |
4058 | #if DEVELOP | 4140 | #ifdef DEVELOP |
4059 | else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01) | 4141 | else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01) |
4060 | File->Type = GSM_File_MMS; | 4142 | File->Type = GSM_File_MMS; |
4061 | #endif | 4143 | #endif |
4062 | } | 4144 | } |
4063 | return ERR_NONE; | 4145 | return ERR_NONE; |
4064 | case 0x2F: | 4146 | case 0x2F: |
4065 | smprintf(s,"File or folder used bytes received\n"); | 4147 | smprintf(s,"File or folder used bytes received\n"); |
4066 | File->Used = msg.Buffer[6]*256*256*256+ | 4148 | File->Used = msg.Buffer[6]*256*256*256+ |
4067 | msg.Buffer[7]*256*256+ | 4149 | msg.Buffer[7]*256*256+ |
4068 | msg.Buffer[8]*256+ | 4150 | msg.Buffer[8]*256+ |
4069 | msg.Buffer[9]; | 4151 | msg.Buffer[9]; |
4070 | return ERR_NONE; | 4152 | return ERR_NONE; |
4071 | case 0x33: | 4153 | case 0x33: |
4072 | if (s->Phone.Data.RequestID == ID_GetFileInfo) { | 4154 | if (s->Phone.Data.RequestID == ID_GetFileInfo) { |
4073 | i = Priv->FilesLocationsUsed-1; | 4155 | i = Priv->FilesLocationsUsed-1; |
4074 | while (1) { | 4156 | while (1) { |
4075 | if (i==Priv->FilesLocationsCurrent-1) break; | 4157 | if (i==Priv->FilesLocationsCurrent-1) break; |
4076 | dbgprintf("Copying %i to %i, max %i, current %i\n", | 4158 | dbgprintf("Copying %i to %i, max %i, current %i\n", |
4077 | i,i+msg.Buffer[9], | 4159 | i,i+msg.Buffer[9], |
4078 | Priv->FilesLocationsUsed,Priv->FilesLocationsCurrent); | 4160 | Priv->FilesLocationsUsed,Priv->FilesLocationsCurrent); |
4079 | Priv->FilesLocations[i+msg.Buffer[9]] = Priv->FilesLocations[i]; | 4161 | Priv->FilesLocations[i+msg.Buffer[9]] = Priv->FilesLocations[i]; |
4080 | Priv->FilesLevels[i+msg.Buffer[9]]= Priv->FilesLevels[i]; | 4162 | Priv->FilesLevels[i+msg.Buffer[9]]= Priv->FilesLevels[i]; |
4081 | i--; | 4163 | i--; |
4082 | } | 4164 | } |
@@ -4377,49 +4459,49 @@ static GSM_Error N6510_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos | |||
4377 | GSM_Phone_N6510Data*Priv = &s->Phone.Data.Priv.N6510; | 4459 | GSM_Phone_N6510Data*Priv = &s->Phone.Data.Priv.N6510; |
4378 | GSM_File File2; | 4460 | GSM_File File2; |
4379 | GSM_Error error; | 4461 | GSM_Error error; |
4380 | int j; | 4462 | int j; |
4381 | unsigned char Header[400] = { | 4463 | unsigned char Header[400] = { |
4382 | N7110_FRAME_HEADER, 0x02, 0x00, 0x00, 0x00, 0x01, | 4464 | N7110_FRAME_HEADER, 0x02, 0x00, 0x00, 0x00, 0x01, |
4383 | 0x00, 0x0C, /* parent folder ID */ | 4465 | 0x00, 0x0C, /* parent folder ID */ |
4384 | 0x00, 0x00, 0x00, 0xE8}; | 4466 | 0x00, 0x00, 0x00, 0xE8}; |
4385 | unsigned char Add[15000] = { | 4467 | unsigned char Add[15000] = { |
4386 | N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, | 4468 | N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, |
4387 | 0x00, 0x04, /* file ID */ | 4469 | 0x00, 0x04, /* file ID */ |
4388 | 0x00, 0x00, | 4470 | 0x00, 0x00, |
4389 | 0x01, 0x28}; /* length */ | 4471 | 0x01, 0x28}; /* length */ |
4390 | unsigned char end[30] = { | 4472 | unsigned char end[30] = { |
4391 | N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, | 4473 | N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, |
4392 | 0x00, 0x04, /* file ID */ | 4474 | 0x00, 0x04, /* file ID */ |
4393 | 0x00, 0x00, 0x00, 0x00}; | 4475 | 0x00, 0x00, 0x00, 0x00}; |
4394 | 4476 | ||
4395 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED; | 4477 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED; |
4396 | 4478 | ||
4397 | s->Phone.Data.File = File; | 4479 | s->Phone.Data.File = File; |
4398 | 4480 | ||
4399 | if (*Pos == 0) { | 4481 | if (*Pos == 0) { |
4400 | error = N6510_SearchForFileName(s,File); | 4482 | error = N6510_SearchForFileName(s,File); |
4401 | if (error == ERR_NONE) return ERR_INVALIDLOCATION; | 4483 | if (error == ERR_NONE) return ERR_FILEALREADYEXIST; |
4402 | if (error != ERR_EMPTY) return error; | 4484 | if (error != ERR_EMPTY) return error; |
4403 | 4485 | ||
4404 | Header[8] = atoi(File->ID_FullName) / 256; | 4486 | Header[8] = atoi(File->ID_FullName) / 256; |
4405 | Header[9] = atoi(File->ID_FullName) % 256; | 4487 | Header[9] = atoi(File->ID_FullName) % 256; |
4406 | memset(Header+14, 0x00, 300); | 4488 | memset(Header+14, 0x00, 300); |
4407 | CopyUnicodeString(Header+14,File->Name); | 4489 | CopyUnicodeString(Header+14,File->Name); |
4408 | Header[222] = File->Used / (256*256*256); | 4490 | Header[222] = File->Used / (256*256*256); |
4409 | Header[223] = File->Used / (256*256); | 4491 | Header[223] = File->Used / (256*256); |
4410 | Header[224] = File->Used / 256; | 4492 | Header[224] = File->Used / 256; |
4411 | Header[225] = File->Used % 256; | 4493 | Header[225] = File->Used % 256; |
4412 | switch(File->Type) { | 4494 | switch(File->Type) { |
4413 | case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break; | 4495 | case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break; |
4414 | case GSM_File_Image_BMP : Header[231]=0x02; Header[233]=0x02; break; | 4496 | case GSM_File_Image_BMP : Header[231]=0x02; Header[233]=0x02; break; |
4415 | case GSM_File_Image_PNG : Header[231]=0x02; Header[233]=0x03; break; | 4497 | case GSM_File_Image_PNG : Header[231]=0x02; Header[233]=0x03; break; |
4416 | case GSM_File_Image_GIF : Header[231]=0x02; Header[233]=0x05; break; | 4498 | case GSM_File_Image_GIF : Header[231]=0x02; Header[233]=0x05; break; |
4417 | case GSM_File_Image_WBMP : Header[231]=0x02; Header[233]=0x09; break; | 4499 | case GSM_File_Image_WBMP : Header[231]=0x02; Header[233]=0x09; break; |
4418 | case GSM_File_Sound_AMR : Header[231]=0x04; Header[233]=0x01; break; | 4500 | case GSM_File_Sound_AMR : Header[231]=0x04; Header[233]=0x01; break; |
4419 | case GSM_File_Sound_MIDI : Header[231]=0x04; Header[233]=0x05; break; //Header[238]=0x01; | 4501 | case GSM_File_Sound_MIDI : Header[231]=0x04; Header[233]=0x05; break; //Header[238]=0x01; |
4420 | case GSM_File_Sound_NRT : Header[231]=0x04; Header[233]=0x06; break; | 4502 | case GSM_File_Sound_NRT : Header[231]=0x04; Header[233]=0x06; break; |
4421 | case GSM_File_Video_3GP : Header[231]=0x08; Header[233]=0x05; break; | 4503 | case GSM_File_Video_3GP : Header[231]=0x08; Header[233]=0x05; break; |
4422 | case GSM_File_Java_JAR : Header[231]=0x10; Header[233]=0x01; break; | 4504 | case GSM_File_Java_JAR : Header[231]=0x10; Header[233]=0x01; break; |
4423 | #ifdef DEVELOP | 4505 | #ifdef DEVELOP |
4424 | case GSM_File_MMS: | 4506 | case GSM_File_MMS: |
4425 | Header[214]=0x07; | 4507 | Header[214]=0x07; |
@@ -4793,49 +4875,49 @@ static GSM_Error N6510_ReplyGetToDoStatus1(GSM_Protocol_Message msg, GSM_StateMa | |||
4793 | 4875 | ||
4794 | /* ToDo support - 6310 style */ | 4876 | /* ToDo support - 6310 style */ |
4795 | static GSM_Error N6510_GetToDoStatus1(GSM_StateMachine *s, GSM_ToDoStatus *status) | 4877 | static GSM_Error N6510_GetToDoStatus1(GSM_StateMachine *s, GSM_ToDoStatus *status) |
4796 | { | 4878 | { |
4797 | GSM_Error error; | 4879 | GSM_Error error; |
4798 | GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 4880 | GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
4799 | unsigned char reqLoc[] = { | 4881 | unsigned char reqLoc[] = { |
4800 | N6110_FRAME_HEADER, | 4882 | N6110_FRAME_HEADER, |
4801 | 0x15, 0x01, 0x00, 0x00, | 4883 | 0x15, 0x01, 0x00, 0x00, |
4802 | 0x00, 0x00, 0x00}; | 4884 | 0x00, 0x00, 0x00}; |
4803 | 4885 | ||
4804 | smprintf(s, "Getting ToDo locations\n"); | 4886 | smprintf(s, "Getting ToDo locations\n"); |
4805 | error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo); | 4887 | error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo); |
4806 | if (error != ERR_NONE) return error; | 4888 | if (error != ERR_NONE) return error; |
4807 | 4889 | ||
4808 | status->Used = LastToDo->Number; | 4890 | status->Used = LastToDo->Number; |
4809 | return ERR_NONE; | 4891 | return ERR_NONE; |
4810 | } | 4892 | } |
4811 | 4893 | ||
4812 | static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status) | 4894 | static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status) |
4813 | { | 4895 | { |
4814 | GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 4896 | GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
4815 | GSM_Error error; | 4897 | GSM_Error error; |
4816 | 4898 | ||
4817 | error = N6510_GetCalendarInfo3(s,LastToDo,false); | 4899 | error = N6510_GetCalendarInfo3(s,LastToDo,1); |
4818 | if (error!=ERR_NONE) return error; | 4900 | if (error!=ERR_NONE) return error; |
4819 | 4901 | ||
4820 | status->Used = LastToDo->Number; | 4902 | status->Used = LastToDo->Number; |
4821 | return ERR_NONE; | 4903 | return ERR_NONE; |
4822 | } | 4904 | } |
4823 | 4905 | ||
4824 | static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) | 4906 | static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) |
4825 | { | 4907 | { |
4826 | status->Used = 0; | 4908 | status->Used = 0; |
4827 | 4909 | ||
4828 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { | 4910 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { |
4829 | return N6510_GetToDoStatus1(s, status); | 4911 | return N6510_GetToDoStatus1(s, status); |
4830 | } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { | 4912 | } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { |
4831 | return N6510_GetToDoStatus2(s, status); | 4913 | return N6510_GetToDoStatus2(s, status); |
4832 | } else { | 4914 | } else { |
4833 | return ERR_NOTSUPPORTED; | 4915 | return ERR_NOTSUPPORTED; |
4834 | } | 4916 | } |
4835 | } | 4917 | } |
4836 | 4918 | ||
4837 | /* ToDo support - 6310 style */ | 4919 | /* ToDo support - 6310 style */ |
4838 | static GSM_Error N6510_ReplyGetToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s) | 4920 | static GSM_Error N6510_ReplyGetToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s) |
4839 | { | 4921 | { |
4840 | GSM_ToDoEntry *Last = s->Phone.Data.ToDo; | 4922 | GSM_ToDoEntry *Last = s->Phone.Data.ToDo; |
4841 | 4923 | ||
@@ -4923,148 +5005,139 @@ static GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message msg, GSM_StateMachine | |||
4923 | Date.Second= 0; | 5005 | Date.Second= 0; |
4924 | Last->Entries[1].EntryType = TODO_END_DATETIME; | 5006 | Last->Entries[1].EntryType = TODO_END_DATETIME; |
4925 | memcpy(&Last->Entries[1].Date,&Date,sizeof(GSM_DateTime)); | 5007 | memcpy(&Last->Entries[1].Date,&Date,sizeof(GSM_DateTime)); |
4926 | 5008 | ||
4927 | smprintf(s,"StartTime: %04i-%02i-%02i %02i:%02i\n", | 5009 | smprintf(s,"StartTime: %04i-%02i-%02i %02i:%02i\n", |
4928 | msg.Buffer[28]*256+msg.Buffer[29], | 5010 | msg.Buffer[28]*256+msg.Buffer[29], |
4929 | msg.Buffer[30],msg.Buffer[31],msg.Buffer[32], | 5011 | msg.Buffer[30],msg.Buffer[31],msg.Buffer[32], |
4930 | msg.Buffer[33]); | 5012 | msg.Buffer[33]); |
4931 | Date.Year = msg.Buffer[28]*256+msg.Buffer[29]; | 5013 | Date.Year = msg.Buffer[28]*256+msg.Buffer[29]; |
4932 | Date.Month = msg.Buffer[30]; | 5014 | Date.Month = msg.Buffer[30]; |
4933 | Date.Day = msg.Buffer[31]; | 5015 | Date.Day = msg.Buffer[31]; |
4934 | Date.Hour = msg.Buffer[32]; | 5016 | Date.Hour = msg.Buffer[32]; |
4935 | Date.Minute = msg.Buffer[33]; | 5017 | Date.Minute = msg.Buffer[33]; |
4936 | Date.Second= 0; | 5018 | Date.Second= 0; |
4937 | 5019 | ||
4938 | Last->EntriesNum = 2; | 5020 | Last->EntriesNum = 2; |
4939 | 5021 | ||
4940 | if (msg.Buffer[45] == 0x01) { | 5022 | if (msg.Buffer[45] == 0x01) { |
4941 | Last->Entries[2].Number = msg.Buffer[45]; | 5023 | Last->Entries[2].Number = msg.Buffer[45]; |
4942 | Last->Entries[2].EntryType = TODO_COMPLETED; | 5024 | Last->Entries[2].EntryType = TODO_COMPLETED; |
4943 | Last->EntriesNum++; | 5025 | Last->EntriesNum++; |
4944 | smprintf(s,"Completed\n"); | 5026 | smprintf(s,"Completed\n"); |
4945 | } | 5027 | } |
4946 | 5028 | ||
4947 | if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) | 5029 | if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) { |
4948 | { | ||
4949 | smprintf(s, "No alarm\n"); | 5030 | smprintf(s, "No alarm\n"); |
4950 | } else { | 5031 | } else { |
4951 | diff = ((unsigned int)msg.Buffer[14]) << 24; | 5032 | diff = ((unsigned int)msg.Buffer[14]) << 24; |
4952 | diff += ((unsigned int)msg.Buffer[15]) << 16; | 5033 | diff += ((unsigned int)msg.Buffer[15]) << 16; |
4953 | diff += ((unsigned int)msg.Buffer[16]) << 8; | 5034 | diff += ((unsigned int)msg.Buffer[16]) << 8; |
4954 | diff += msg.Buffer[17]; | 5035 | diff += msg.Buffer[17]; |
4955 | 5036 | ||
4956 | memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime)); | 5037 | memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime)); |
4957 | GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60); | 5038 | GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60); |
4958 | smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n", | 5039 | smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n", |
4959 | Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month, | 5040 | Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month, |
4960 | Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour, | 5041 | Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour, |
4961 | Last->Entries[Last->EntriesNum].Date.Minute,Last->Entries[Last->EntriesNum].Date.Second); | 5042 | Last->Entries[Last->EntriesNum].Date.Minute,Last->Entries[Last->EntriesNum].Date.Second); |
4962 | 5043 | ||
4963 | Last->Entries[Last->EntriesNum].EntryType = TODO_ALARM_DATETIME; | 5044 | Last->Entries[Last->EntriesNum].EntryType = TODO_ALARM_DATETIME; |
4964 | if (msg.Buffer[22]==0x00 && msg.Buffer[23]==0x00 && | 5045 | if (msg.Buffer[22]==0x00 && msg.Buffer[23]==0x00 && |
4965 | msg.Buffer[24]==0x00 && msg.Buffer[25]==0x00) | 5046 | msg.Buffer[24]==0x00 && msg.Buffer[25]==0x00) |
4966 | { | 5047 | { |
4967 | Last->Entries[Last->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; | 5048 | Last->Entries[Last->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; |
4968 | smprintf(s, "Alarm type : Silent\n"); | 5049 | smprintf(s, "Alarm type : Silent\n"); |
4969 | } | 5050 | } |
4970 | Last->EntriesNum++; | 5051 | Last->EntriesNum++; |
4971 | } | 5052 | } |
4972 | 5053 | ||
4973 | return ERR_NONE; | 5054 | return ERR_NONE; |
4974 | } | 5055 | } |
4975 | 5056 | ||
4976 | /* ToDo support - 6610 style */ | 5057 | /* ToDo support - 6610 style */ |
4977 | static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) | 5058 | static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) |
4978 | { | 5059 | { |
4979 | GSM_Error error; | 5060 | GSM_Error error; |
4980 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 5061 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
4981 | /* The same to getting calendar method 3 */ | ||
4982 | unsigned char req[] = { | ||
4983 | N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00, | ||
4984 | 0x00,0x99, /* Location */ | ||
4985 | 0xff,0xff,0xff,0xff,0x01}; | ||
4986 | 5062 | ||
4987 | if (refresh) { | 5063 | if (refresh) { |
4988 | error=N6510_GetCalendarInfo3(s,LastToDo,false); | 5064 | error=N6510_GetCalendarInfo3(s,LastToDo,1); |
4989 | if (error!=ERR_NONE) return error; | 5065 | if (error!=ERR_NONE) return error; |
4990 | ToDo->Location = 1; | 5066 | ToDo->Location = 1; |
4991 | } else { | 5067 | } else { |
4992 | ToDo->Location++; | 5068 | ToDo->Location++; |
4993 | } | 5069 | } |
4994 | 5070 | ||
4995 | if (ToDo->Location > LastToDo->Number) return ERR_EMPTY; | 5071 | if (ToDo->Location > LastToDo->Number) return ERR_EMPTY; |
4996 | 5072 | ||
4997 | req[8] = LastToDo->Location[ToDo->Location-1] / 256; | ||
4998 | req[9] = LastToDo->Location[ToDo->Location-1] % 256; | ||
4999 | |||
5000 | s->Phone.Data.ToDo = ToDo; | 5073 | s->Phone.Data.ToDo = ToDo; |
5001 | smprintf(s, "Getting todo method 2\n"); | 5074 | smprintf(s, "Getting todo method 2\n"); |
5002 | return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetToDo); | 5075 | return N6510_PrivGetGenericCalendar3(s, LastToDo->Location[ToDo->Location-1], ID_GetToDo); |
5003 | } | 5076 | } |
5004 | 5077 | ||
5005 | static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) | 5078 | static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) |
5006 | { | 5079 | { |
5007 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { | 5080 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { |
5008 | return N6510_GetNextToDo1(s, ToDo, refresh); | 5081 | return N6510_GetNextToDo1(s, ToDo, refresh); |
5009 | } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { | 5082 | } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { |
5010 | return N6510_GetNextToDo2(s, ToDo, refresh); | 5083 | return N6510_GetNextToDo2(s, ToDo, refresh); |
5011 | } else { | 5084 | } else { |
5012 | return ERR_NOTSUPPORTED; | 5085 | return ERR_NOTSUPPORTED; |
5013 | } | 5086 | } |
5014 | } | 5087 | } |
5015 | 5088 | ||
5016 | /* ToDo support - 6310 style */ | 5089 | /* ToDo support - 6310 style */ |
5017 | static GSM_Error N6510_ReplyDeleteAllToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s) | 5090 | static GSM_Error N6510_ReplyDeleteAllToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s) |
5018 | { | 5091 | { |
5019 | smprintf(s, "All TODO deleted\n"); | 5092 | smprintf(s, "All TODO deleted\n"); |
5020 | return ERR_NONE; | 5093 | return ERR_NONE; |
5021 | } | 5094 | } |
5022 | 5095 | ||
5023 | /* ToDo support - 6310 style */ | 5096 | /* ToDo support - 6310 style */ |
5024 | static GSM_Error N6510_DeleteAllToDo1(GSM_StateMachine *s) | 5097 | static GSM_Error N6510_DeleteAllToDo1(GSM_StateMachine *s) |
5025 | { | 5098 | { |
5026 | unsigned char req[] = {N6110_FRAME_HEADER, 0x11}; | 5099 | unsigned char req[] = {N6110_FRAME_HEADER, 0x11}; |
5027 | 5100 | ||
5028 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { | 5101 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { |
5029 | return ERR_NOTSUPPORTED; | 5102 | return ERR_NOTSUPPORTED; |
5030 | } | 5103 | } |
5031 | 5104 | ||
5032 | smprintf(s, "Deleting all ToDo method 1\n"); | 5105 | smprintf(s, "Deleting all ToDo method 1\n"); |
5033 | return GSM_WaitFor (s, req, 4, 0x55, 4, ID_DeleteAllToDo); | 5106 | return GSM_WaitFor (s, req, 4, 0x55, 4, ID_DeleteAllToDo); |
5034 | } | 5107 | } |
5035 | 5108 | ||
5036 | static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) | 5109 | static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) |
5037 | { | 5110 | { |
5038 | GSM_Error error; | 5111 | GSM_Error error; |
5039 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 5112 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
5040 | GSM_CalendarEntry Note; | 5113 | GSM_CalendarEntry Note; |
5041 | 5114 | ||
5042 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { | 5115 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { |
5043 | return ERR_NOTSUPPORTED; | 5116 | return ERR_NOTSUPPORTED; |
5044 | } | 5117 | } |
5045 | 5118 | ||
5046 | error=N6510_GetCalendarInfo3(s,LastToDo,false); | 5119 | error=N6510_GetCalendarInfo3(s,LastToDo,1); |
5047 | if (error!=ERR_NONE) return error; | 5120 | if (error!=ERR_NONE) return error; |
5048 | 5121 | ||
5049 | smprintf(s, "Deleting ToDo method 2\n"); | 5122 | smprintf(s, "Deleting ToDo method 2\n"); |
5050 | 5123 | ||
5051 | if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION; | 5124 | if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION; |
5052 | 5125 | ||
5053 | Note.Location = LastToDo->Location[ToDo->Location-1]; | 5126 | Note.Location = LastToDo->Location[ToDo->Location-1]; |
5054 | return N71_65_DelCalendar(s,&Note); | 5127 | return N71_65_DelCalendar(s,&Note); |
5055 | } | 5128 | } |
5056 | 5129 | ||
5057 | /* ToDo support - 6310 style */ | 5130 | /* ToDo support - 6310 style */ |
5058 | static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s) | 5131 | static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s) |
5059 | { | 5132 | { |
5060 | smprintf(s, "TODO first location received method 1: %02x\n",msg.Buffer[9]); | 5133 | smprintf(s, "TODO first location received method 1: %02x\n",msg.Buffer[9]); |
5061 | s->Phone.Data.ToDo->Location = msg.Buffer[9]; | 5134 | s->Phone.Data.ToDo->Location = msg.Buffer[9]; |
5062 | return ERR_NONE; | 5135 | return ERR_NONE; |
5063 | } | 5136 | } |
5064 | 5137 | ||
5065 | /* ToDo support - 6310 style */ | 5138 | /* ToDo support - 6310 style */ |
5066 | static GSM_Error N6510_ReplyAddToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s) | 5139 | static GSM_Error N6510_ReplyAddToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s) |
5067 | { | 5140 | { |
5068 | smprintf(s, "TODO set OK\n"); | 5141 | smprintf(s, "TODO set OK\n"); |
5069 | return ERR_NONE; | 5142 | return ERR_NONE; |
5070 | } | 5143 | } |
@@ -5430,55 +5503,61 @@ GSM_Error N6510_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark | |||
5430 | GSM_Error N6510_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) | 5503 | GSM_Error N6510_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) |
5431 | { | 5504 | { |
5432 | GSM_Error error; | 5505 | GSM_Error error; |
5433 | 5506 | ||
5434 | /* We have to enable WAP frames in phone */ | 5507 | /* We have to enable WAP frames in phone */ |
5435 | error=N6510_EnableConnectionFunctions(s,N6510_WAP_SETTINGS); | 5508 | error=N6510_EnableConnectionFunctions(s,N6510_WAP_SETTINGS); |
5436 | if (error!=ERR_NONE) return error; | 5509 | if (error!=ERR_NONE) return error; |
5437 | 5510 | ||
5438 | return DCT3DCT4_GetWAPBookmarkPart(s,bookmark); | 5511 | return DCT3DCT4_GetWAPBookmarkPart(s,bookmark); |
5439 | } | 5512 | } |
5440 | 5513 | ||
5441 | static GSM_Reply_Function N6510ReplyFunctions[] = { | 5514 | static GSM_Reply_Function N6510ReplyFunctions[] = { |
5442 | {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame }, | 5515 | {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame }, |
5443 | {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame }, | 5516 | {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame }, |
5444 | {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame }, | 5517 | {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame }, |
5445 | {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame }, | 5518 | {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame }, |
5446 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall }, | 5519 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall }, |
5447 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame }, | 5520 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame }, |
5448 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall }, | 5521 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall }, |
5449 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame }, | 5522 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame }, |
5450 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame }, | 5523 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame }, |
5451 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame }, | 5524 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame }, |
5452 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice }, | 5525 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice }, |
5453 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame }, | 5526 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame }, |
5527 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0F,ID_IncomingFrame }, | ||
5528 | {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_DialVoice }, | ||
5529 | {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_IncomingFrame }, | ||
5454 | {N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame }, | 5530 | {N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame }, |
5455 | {N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame }, | 5531 | {N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame }, |
5456 | {N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame }, | 5532 | {N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame }, |
5457 | {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF }, | 5533 | {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF }, |
5458 | {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame }, | 5534 | {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame }, |
5459 | {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF }, | 5535 | {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF }, |
5460 | {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF }, | 5536 | {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF }, |
5537 | {N71_65_ReplyCallInfo, "\x01",0x03,0xA6,ID_IncomingFrame }, | ||
5538 | {N71_65_ReplyCallInfo, "\x01",0x03,0xD2,ID_IncomingFrame }, | ||
5539 | {N71_65_ReplyCallInfo, "\x01",0x03,0xD3,ID_IncomingFrame }, | ||
5461 | 5540 | ||
5462 | {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame }, | 5541 | {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame }, |
5463 | {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame }, | 5542 | {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame }, |
5464 | {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC }, | 5543 | {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC }, |
5465 | {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC }, | 5544 | {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC }, |
5466 | 5545 | ||
5467 | {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus }, | 5546 | {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus }, |
5468 | {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory }, | 5547 | {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory }, |
5469 | {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory }, | 5548 | {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory }, |
5470 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap }, | 5549 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap }, |
5471 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory }, | 5550 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory }, |
5472 | 5551 | ||
5473 | {DCT3DCT4_ReplyCallDivert, "\x06",0x03,0x02,ID_Divert }, | 5552 | {DCT3DCT4_ReplyCallDivert, "\x06",0x03,0x02,ID_Divert }, |
5474 | {N71_65_ReplyUSSDInfo, "\x06",0x03,0x03,ID_IncomingFrame }, | 5553 | {N71_65_ReplyUSSDInfo, "\x06",0x03,0x03,ID_IncomingFrame }, |
5475 | {NoneReply, "\x06",0x03,0x06,ID_IncomingFrame }, | 5554 | {NoneReply, "\x06",0x03,0x06,ID_IncomingFrame }, |
5476 | {NoneReply, "\x06",0x03,0x09,ID_IncomingFrame }, | 5555 | {NoneReply, "\x06",0x03,0x09,ID_IncomingFrame }, |
5477 | 5556 | ||
5478 | {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x08,ID_EnterSecurityCode }, | 5557 | {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x08,ID_EnterSecurityCode }, |
5479 | {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x09,ID_EnterSecurityCode }, | 5558 | {N6510_ReplyEnterSecurityCode, "\x08",0x03,0x09,ID_EnterSecurityCode }, |
5480 | {N6510_ReplyGetSecurityStatus, "\x08",0x03,0x12,ID_GetSecurityStatus }, | 5559 | {N6510_ReplyGetSecurityStatus, "\x08",0x03,0x12,ID_GetSecurityStatus }, |
5481 | 5560 | ||
5482 | {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_GetNetworkInfo }, | 5561 | {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_GetNetworkInfo }, |
5483 | {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_IncomingFrame }, | 5562 | {N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_IncomingFrame }, |
5484 | {N6510_ReplyLogIntoNetwork, "\x0A",0x03,0x02,ID_IncomingFrame }, | 5563 | {N6510_ReplyLogIntoNetwork, "\x0A",0x03,0x02,ID_IncomingFrame }, |
@@ -5487,55 +5566,57 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { | |||
5487 | {NoneReply, "\x0A",0x03,0x20,ID_IncomingFrame }, | 5566 | {NoneReply, "\x0A",0x03,0x20,ID_IncomingFrame }, |
5488 | {N6510_ReplyGetOperatorLogo, "\x0A",0x03,0x24,ID_GetBitmap }, | 5567 | {N6510_ReplyGetOperatorLogo, "\x0A",0x03,0x24,ID_GetBitmap }, |
5489 | {N6510_ReplySetOperatorLogo, "\x0A",0x03,0x26,ID_SetBitmap }, | 5568 | {N6510_ReplySetOperatorLogo, "\x0A",0x03,0x26,ID_SetBitmap }, |
5490 | 5569 | ||
5491 | {NoneReply, "\x0B",0x03,0x01,ID_PlayTone }, | 5570 | {NoneReply, "\x0B",0x03,0x01,ID_PlayTone }, |
5492 | {NoneReply, "\x0B",0x03,0x15,ID_PlayTone }, | 5571 | {NoneReply, "\x0B",0x03,0x15,ID_PlayTone }, |
5493 | {NoneReply, "\x0B",0x03,0x16,ID_PlayTone }, | 5572 | {NoneReply, "\x0B",0x03,0x16,ID_PlayTone }, |
5494 | 5573 | ||
5495 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote }, | 5574 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote }, |
5496 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote }, | 5575 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote }, |
5497 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote }, | 5576 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote }, |
5498 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote }, | 5577 | {N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote }, |
5499 | {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, | 5578 | {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, |
5500 | {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ | 5579 | {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ |
5501 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ | 5580 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ |
5502 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ | 5581 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ |
5503 | #ifdef DEBUG | 5582 | #ifdef DEBUG |
5504 | {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, | 5583 | {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, |
5505 | #endif | 5584 | #endif |
5506 | {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ | 5585 | {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ |
5507 | {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ | 5586 | {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ |
5508 | {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, | 5587 | {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, |
5509 | {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ | 5588 | {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ |
5510 | {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, | 5589 | {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, |
5590 | {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote }, | ||
5511 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, | 5591 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, |
5512 | {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, | 5592 | {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, |
5513 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, | 5593 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, |
5514 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ | 5594 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ |
5515 | {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, | 5595 | {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, |
5516 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ | 5596 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ |
5517 | {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, | 5597 | {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, |
5598 | {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote }, | ||
5518 | 5599 | ||
5519 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, | 5600 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, |
5520 | {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, | 5601 | {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, |
5521 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, | 5602 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, |
5522 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, | 5603 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, |
5523 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, | 5604 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, |
5524 | {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, | 5605 | {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, |
5525 | {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, | 5606 | {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, |
5526 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, | 5607 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, |
5527 | {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, | 5608 | {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, |
5528 | {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, | 5609 | {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, |
5529 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, | 5610 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, |
5530 | {N6510_ReplyGetSMSStatus, "\x14",0x03,0x1a,ID_GetSMSStatus }, | 5611 | {N6510_ReplyGetSMSStatus, "\x14",0x03,0x1a,ID_GetSMSStatus }, |
5531 | 5612 | ||
5532 | {DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset }, | 5613 | {DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset }, |
5533 | {DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset }, | 5614 | {DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset }, |
5534 | {NoneReply, "\x15",0x03,0x68,ID_Reset }, | 5615 | {NoneReply, "\x15",0x03,0x68,ID_Reset }, |
5535 | 5616 | ||
5536 | {N6510_ReplyGetBatteryCharge, "\x17",0x03,0x0B,ID_GetBatteryCharge }, | 5617 | {N6510_ReplyGetBatteryCharge, "\x17",0x03,0x0B,ID_GetBatteryCharge }, |
5537 | 5618 | ||
5538 | {N6510_ReplySetDateTime, "\x19",0x03,0x02,ID_SetDateTime }, | 5619 | {N6510_ReplySetDateTime, "\x19",0x03,0x02,ID_SetDateTime }, |
5539 | {N6510_ReplyGetDateTime, "\x19",0x03,0x0B,ID_GetDateTime }, | 5620 | {N6510_ReplyGetDateTime, "\x19",0x03,0x0B,ID_GetDateTime }, |
5540 | {N6510_ReplySetAlarm, "\x19",0x03,0x12,ID_SetAlarm }, | 5621 | {N6510_ReplySetAlarm, "\x19",0x03,0x12,ID_SetAlarm }, |
5541 | {N6510_ReplyGetAlarm, "\x19",0x03,0x1A,ID_GetAlarm }, | 5622 | {N6510_ReplyGetAlarm, "\x19",0x03,0x1A,ID_GetAlarm }, |
@@ -5630,49 +5711,49 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { | |||
5630 | {N6510_ReplyAddFilePart, "\x6D",0x03,0x41,ID_AddFile }, | 5711 | {N6510_ReplyAddFilePart, "\x6D",0x03,0x41,ID_AddFile }, |
5631 | {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_AddFile }, | 5712 | {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_AddFile }, |
5632 | {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFile }, | 5713 | {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFile }, |
5633 | {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFileInfo }, | 5714 | {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFileInfo }, |
5634 | 5715 | ||
5635 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_GetBitmap }, | 5716 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_GetBitmap }, |
5636 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_SetBitmap }, | 5717 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_SetBitmap }, |
5637 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_GetBitmap }, | 5718 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_GetBitmap }, |
5638 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_SetBitmap }, | 5719 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_SetBitmap }, |
5639 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_GetBitmap }, | 5720 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_GetBitmap }, |
5640 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_SetBitmap }, | 5721 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_SetBitmap }, |
5641 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x25,ID_SetBitmap }, | 5722 | {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x25,ID_SetBitmap }, |
5642 | 5723 | ||
5643 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, | 5724 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, |
5644 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, | 5725 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, |
5645 | 5726 | ||
5646 | /* 0xD7 - Bluetooth */ | 5727 | /* 0xD7 - Bluetooth */ |
5647 | 5728 | ||
5648 | {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, | 5729 | {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, |
5649 | 5730 | ||
5650 | {NULL, "\x00",0x00,0x00,ID_None } | 5731 | {NULL, "\x00",0x00,0x00,ID_None } |
5651 | }; | 5732 | }; |
5652 | 5733 | ||
5653 | GSM_Phone_Functions N6510Phone = { | 5734 | GSM_Phone_Functions N6510Phone = { |
5654 | "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6800|7210|7250|7250i|7600|8310|8390|8910|8910i", | 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", |
5655 | N6510ReplyFunctions, | 5736 | N6510ReplyFunctions, |
5656 | N6510_Initialise, | 5737 | N6510_Initialise, |
5657 | NONEFUNCTION, /* Terminate */ | 5738 | NONEFUNCTION, /* Terminate */ |
5658 | GSM_DispatchMessage, | 5739 | GSM_DispatchMessage, |
5659 | N6510_ShowStartInfo, | 5740 | N6510_ShowStartInfo, |
5660 | NOKIA_GetManufacturer, | 5741 | NOKIA_GetManufacturer, |
5661 | DCT3DCT4_GetModel, | 5742 | DCT3DCT4_GetModel, |
5662 | DCT3DCT4_GetFirmware, | 5743 | DCT3DCT4_GetFirmware, |
5663 | DCT4_GetIMEI, | 5744 | DCT4_GetIMEI, |
5664 | N6510_GetOriginalIMEI, | 5745 | N6510_GetOriginalIMEI, |
5665 | N6510_GetManufactureMonth, | 5746 | N6510_GetManufactureMonth, |
5666 | DCT4_GetProductCode, | 5747 | DCT4_GetProductCode, |
5667 | DCT4_GetHardware, | 5748 | DCT4_GetHardware, |
5668 | N6510_GetPPM, | 5749 | N6510_GetPPM, |
5669 | NOTSUPPORTED, /* GetSIMIMSI */ | 5750 | NOTSUPPORTED, /* GetSIMIMSI */ |
5670 | N6510_GetDateTime, | 5751 | N6510_GetDateTime, |
5671 | N6510_SetDateTime, | 5752 | N6510_SetDateTime, |
5672 | N6510_GetAlarm, | 5753 | N6510_GetAlarm, |
5673 | N6510_SetAlarm, | 5754 | N6510_SetAlarm, |
5674 | N6510_GetLocale, | 5755 | N6510_GetLocale, |
5675 | NOTSUPPORTED, /* SetLocale */ | 5756 | NOTSUPPORTED, /* SetLocale */ |
5676 | N6510_PressKey, | 5757 | N6510_PressKey, |
5677 | DCT4_Reset, | 5758 | DCT4_Reset, |
5678 | NOTIMPLEMENTED, /* ResetPhoneSettings*/ | 5759 | NOTIMPLEMENTED, /* ResetPhoneSettings*/ |
@@ -5684,48 +5765,49 @@ GSM_Phone_Functions N6510Phone = { | |||
5684 | N6510_GetSignalQuality, | 5765 | N6510_GetSignalQuality, |
5685 | N6510_GetNetworkInfo, | 5766 | N6510_GetNetworkInfo, |
5686 | NOTSUPPORTED, /* GetCategory */ | 5767 | NOTSUPPORTED, /* GetCategory */ |
5687 | NOTSUPPORTED, /* AddCategory */ | 5768 | NOTSUPPORTED, /* AddCategory */ |
5688 | NOTSUPPORTED, /* GetCategoryStatus */ | 5769 | NOTSUPPORTED, /* GetCategoryStatus */ |
5689 | N6510_GetMemoryStatus, | 5770 | N6510_GetMemoryStatus, |
5690 | N6510_GetMemory, | 5771 | N6510_GetMemory, |
5691 | NOTIMPLEMENTED, /* GetNextMemory */ | 5772 | NOTIMPLEMENTED, /* GetNextMemory */ |
5692 | N6510_SetMemory, | 5773 | N6510_SetMemory, |
5693 | NOTIMPLEMENTED, /* AddMemory */ | 5774 | NOTIMPLEMENTED, /* AddMemory */ |
5694 | N6510_DeleteMemory, | 5775 | N6510_DeleteMemory, |
5695 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 5776 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
5696 | N6510_GetSpeedDial, | 5777 | N6510_GetSpeedDial, |
5697 | NOTIMPLEMENTED, /* SetSpeedDial */ | 5778 | NOTIMPLEMENTED, /* SetSpeedDial */ |
5698 | N6510_GetSMSC, | 5779 | N6510_GetSMSC, |
5699 | N6510_SetSMSC, | 5780 | N6510_SetSMSC, |
5700 | N6510_GetSMSStatus, | 5781 | N6510_GetSMSStatus, |
5701 | N6510_GetSMSMessage, | 5782 | N6510_GetSMSMessage, |
5702 | N6510_GetNextSMSMessage, | 5783 | N6510_GetNextSMSMessage, |
5703 | N6510_SetSMS, | 5784 | N6510_SetSMS, |
5704 | N6510_AddSMS, | 5785 | N6510_AddSMS, |
5705 | N6510_DeleteSMSMessage, | 5786 | N6510_DeleteSMSMessage, |
5706 | N6510_SendSMSMessage, | 5787 | N6510_SendSMSMessage, |
5707 | NOTSUPPORTED, /* SendSavedSMS */ | 5788 | NOTSUPPORTED, /* SendSavedSMS */ |
5789 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
5708 | NOKIA_SetIncomingSMS, | 5790 | NOKIA_SetIncomingSMS, |
5709 | NOTIMPLEMENTED, /* SetIncomingCB */ | 5791 | NOTIMPLEMENTED, /* SetIncomingCB */ |
5710 | N6510_GetSMSFolders, | 5792 | N6510_GetSMSFolders, |
5711 | N6510_AddSMSFolder, | 5793 | N6510_AddSMSFolder, |
5712 | NOTIMPLEMENTED, /* DeleteSMSFolder */ | 5794 | NOTIMPLEMENTED, /* DeleteSMSFolder */ |
5713 | N6510_DialVoice, | 5795 | N6510_DialVoice, |
5714 | N6510_AnswerCall, | 5796 | N6510_AnswerCall, |
5715 | N6510_CancelCall, | 5797 | N6510_CancelCall, |
5716 | NOTIMPLEMENTED, /* HoldCall */ | 5798 | NOTIMPLEMENTED, /* HoldCall */ |
5717 | NOTIMPLEMENTED, /* UnholdCall */ | 5799 | NOTIMPLEMENTED, /* UnholdCall */ |
5718 | NOTIMPLEMENTED, /* ConferenceCall */ | 5800 | NOTIMPLEMENTED, /* ConferenceCall */ |
5719 | NOTIMPLEMENTED, /* SplitCall */ | 5801 | NOTIMPLEMENTED, /* SplitCall */ |
5720 | NOTIMPLEMENTED, /* TransferCall */ | 5802 | NOTIMPLEMENTED, /* TransferCall */ |
5721 | NOTIMPLEMENTED, /* SwitchCall */ | 5803 | NOTIMPLEMENTED, /* SwitchCall */ |
5722 | DCT3DCT4_GetCallDivert, | 5804 | DCT3DCT4_GetCallDivert, |
5723 | DCT3DCT4_SetCallDivert, | 5805 | DCT3DCT4_SetCallDivert, |
5724 | DCT3DCT4_CancelAllDiverts, | 5806 | DCT3DCT4_CancelAllDiverts, |
5725 | NOKIA_SetIncomingCall, | 5807 | NOKIA_SetIncomingCall, |
5726 | NOKIA_SetIncomingUSSD, | 5808 | NOKIA_SetIncomingUSSD, |
5727 | DCT3DCT4_SendDTMF, | 5809 | DCT3DCT4_SendDTMF, |
5728 | N6510_GetRingtone, | 5810 | N6510_GetRingtone, |
5729 | N6510_SetRingtone, | 5811 | N6510_SetRingtone, |
5730 | N6510_GetRingtonesInfo, | 5812 | N6510_GetRingtonesInfo, |
5731 | N6510_DeleteUserRingtones, | 5813 | N6510_DeleteUserRingtones, |
@@ -5738,45 +5820,45 @@ GSM_Phone_Functions N6510Phone = { | |||
5738 | N6510_GetMMSSettings, | 5820 | N6510_GetMMSSettings, |
5739 | N6510_SetMMSSettings, | 5821 | N6510_SetMMSSettings, |
5740 | N6510_GetSyncMLSettings, | 5822 | N6510_GetSyncMLSettings, |
5741 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 5823 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
5742 | N6510_GetChatSettings, | 5824 | N6510_GetChatSettings, |
5743 | NOTSUPPORTED, /* SetChatSettings */ | 5825 | NOTSUPPORTED, /* SetChatSettings */ |
5744 | N6510_GetBitmap, | 5826 | N6510_GetBitmap, |
5745 | N6510_SetBitmap, | 5827 | N6510_SetBitmap, |
5746 | N6510_GetToDoStatus, | 5828 | N6510_GetToDoStatus, |
5747 | NOTIMPLEMENTED, /* GetToDo */ | 5829 | NOTIMPLEMENTED, /* GetToDo */ |
5748 | N6510_GetNextToDo, | 5830 | N6510_GetNextToDo, |
5749 | NOTIMPLEMENTED, /* SetToDo */ | 5831 | NOTIMPLEMENTED, /* SetToDo */ |
5750 | N6510_AddToDo, | 5832 | N6510_AddToDo, |
5751 | N6510_DeleteToDo2, | 5833 | N6510_DeleteToDo2, |
5752 | N6510_DeleteAllToDo1, | 5834 | N6510_DeleteAllToDo1, |
5753 | N6510_GetCalendarStatus, | 5835 | N6510_GetCalendarStatus, |
5754 | NOTIMPLEMENTED, /* GetCalendar */ | 5836 | NOTIMPLEMENTED, /* GetCalendar */ |
5755 | N6510_GetNextCalendar, | 5837 | N6510_GetNextCalendar, |
5756 | NOTIMPLEMENTED, /* SetCalendar */ | 5838 | NOTIMPLEMENTED, /* SetCalendar */ |
5757 | N6510_AddCalendar, | 5839 | N6510_AddCalendar, |
5758 | N71_65_DelCalendar, | 5840 | N71_65_DelCalendar, |
5759 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 5841 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
5760 | N6510_GetCalendarSettings, | 5842 | N6510_GetCalendarSettings, |
5761 | NOTSUPPORTED, /* SetCalendarSettings*/ | 5843 | NOTSUPPORTED, /* SetCalendarSettings*/ |
5762 | NOTIMPLEMENTED, /* GetNote */ | 5844 | N6510_GetNextNote, |
5763 | N6510_GetProfile, | 5845 | N6510_GetProfile, |
5764 | N6510_SetProfile, | 5846 | N6510_SetProfile, |
5765 | N6510_GetFMStation, | 5847 | N6510_GetFMStation, |
5766 | N6510_SetFMStation, | 5848 | N6510_SetFMStation, |
5767 | N6510_ClearFMStations, | 5849 | N6510_ClearFMStations, |
5768 | N6510_GetNextFileFolder, | 5850 | N6510_GetNextFileFolder, |
5769 | N6510_GetFilePart, | 5851 | N6510_GetFilePart, |
5770 | N6510_AddFilePart, | 5852 | N6510_AddFilePart, |
5771 | N6510_GetFileSystemStatus, | 5853 | N6510_GetFileSystemStatus, |
5772 | N6510_DeleteFile, | 5854 | N6510_DeleteFile, |
5773 | N6510_AddFolder, | 5855 | N6510_AddFolder, |
5774 | N6510_GetGPRSAccessPoint, | 5856 | N6510_GetGPRSAccessPoint, |
5775 | N6510_SetGPRSAccessPoint | 5857 | N6510_SetGPRSAccessPoint |
5776 | }; | 5858 | }; |
5777 | 5859 | ||
5778 | #endif | 5860 | #endif |
5779 | 5861 | ||
5780 | /* How should editor hadle tabs in this file? Add editor commands here. | 5862 | /* How should editor hadle tabs in this file? Add editor commands here. |
5781 | * vim: noexpandtab sw=8 ts=8 sts=8: | 5863 | * vim: noexpandtab sw=8 ts=8 sts=8: |
5782 | */ | 5864 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.h b/gammu/emb/common/phone/nokia/dct4/n6510.h index 4717aeb..26623d6 100644 --- a/gammu/emb/common/phone/nokia/dct4/n6510.h +++ b/gammu/emb/common/phone/nokia/dct4/n6510.h | |||
@@ -13,48 +13,50 @@ typedef enum { | |||
13 | N6510_WAP_SETTINGS, | 13 | N6510_WAP_SETTINGS, |
14 | N6510_SYNCML_SETTINGS | 14 | N6510_SYNCML_SETTINGS |
15 | } N6510_Connection_Settings; | 15 | } N6510_Connection_Settings; |
16 | 16 | ||
17 | typedef enum { | 17 | typedef enum { |
18 | N6510_LIGHT_DISPLAY = 0x01, | 18 | N6510_LIGHT_DISPLAY = 0x01, |
19 | N6510_LIGHT_KEYPAD = 0x03, | 19 | N6510_LIGHT_KEYPAD = 0x03, |
20 | N6510_LIGHT_TORCH = 0x10 | 20 | N6510_LIGHT_TORCH = 0x10 |
21 | } N6510_PHONE_LIGHTS; | 21 | } N6510_PHONE_LIGHTS; |
22 | 22 | ||
23 | typedef struct { | 23 | typedef struct { |
24 | int LastCalendarYear; | 24 | int LastCalendarYear; |
25 | int LastCalendarPos; | 25 | int LastCalendarPos; |
26 | GSM_NOKIACalToDoLocationsLastCalendar; | 26 | GSM_NOKIACalToDoLocationsLastCalendar; |
27 | int FirstCalendarPos; | 27 | int FirstCalendarPos; |
28 | unsigned char CalendarIcons[10]; | 28 | unsigned char CalendarIcons[10]; |
29 | GSM_CalendarNoteType CalendarIconsTypes[10]; | 29 | GSM_CalendarNoteType CalendarIconsTypes[10]; |
30 | int CalendarIconsNum; | 30 | int CalendarIconsNum; |
31 | 31 | ||
32 | GSM_NOKIASMSFolder LastSMSFolder; | 32 | GSM_NOKIASMSFolder LastSMSFolder; |
33 | GSM_SMSFolders LastSMSFolders; | 33 | GSM_SMSFolders LastSMSFolders; |
34 | 34 | ||
35 | GSM_NOKIACalToDoLocationsLastToDo; | 35 | GSM_NOKIACalToDoLocationsLastToDo; |
36 | 36 | ||
37 | GSM_NOKIACalToDoLocationsLastNote; | ||
38 | |||
37 | unsigned char RingtoneID;/* When set with preview */ | 39 | unsigned char RingtoneID;/* When set with preview */ |
38 | 40 | ||
39 | int FilesLocations[1000]; | 41 | int FilesLocations[1000]; |
40 | int FilesLevels[1000]; | 42 | int FilesLevels[1000]; |
41 | int FilesLocationsUsed; | 43 | int FilesLocationsUsed; |
42 | int FilesLocationsCurrent; | 44 | int FilesLocationsCurrent; |
43 | int FileToken; | 45 | int FileToken; |
44 | int ParentID; | 46 | int ParentID; |
45 | int FileCheckSum; | 47 | int FileCheckSum; |
46 | 48 | ||
47 | unsigned char FMStatus[4000]; | 49 | unsigned char FMStatus[4000]; |
48 | int FMStatusLength; | 50 | int FMStatusLength; |
49 | 51 | ||
50 | unsigned char GPRSPoints[4000]; | 52 | unsigned char GPRSPoints[4000]; |
51 | int GPRSPointsLength; | 53 | int GPRSPointsLength; |
52 | 54 | ||
53 | int BearerNumber; | 55 | int BearerNumber; |
54 | 56 | ||
55 | unsigned char PhoneMode; | 57 | unsigned char PhoneMode; |
56 | } GSM_Phone_N6510Data; | 58 | } GSM_Phone_N6510Data; |
57 | 59 | ||
58 | void N6510_EncodeFMFrequency(double freq, unsigned char *buff); | 60 | void N6510_EncodeFMFrequency(double freq, unsigned char *buff); |
59 | void N6510_DecodeFMFrequency(double *freq, unsigned char *buff); | 61 | void N6510_DecodeFMFrequency(double *freq, unsigned char *buff); |
60 | 62 | ||
diff --git a/gammu/emb/common/phone/nokia/nauto.c b/gammu/emb/common/phone/nokia/nauto.c index bf74bc9..3bb53ec 100644 --- a/gammu/emb/common/phone/nokia/nauto.c +++ b/gammu/emb/common/phone/nokia/nauto.c | |||
@@ -100,45 +100,45 @@ GSM_Phone_Functions NAUTOPhone = { | |||
100 | NOTSUPPORTED, /* SetWAPBookmark */ | 100 | NOTSUPPORTED, /* SetWAPBookmark */ |
101 | NOTSUPPORTED, /* DeleteWAPBookmark */ | 101 | NOTSUPPORTED, /* DeleteWAPBookmark */ |
102 | NOTSUPPORTED, /* GetWAPSettings */ | 102 | NOTSUPPORTED, /* GetWAPSettings */ |
103 | NOTSUPPORTED, /* SetWAPSettings */ | 103 | NOTSUPPORTED, /* SetWAPSettings */ |
104 | NOTSUPPORTED, /* GetMMSSettings */ | 104 | NOTSUPPORTED, /* GetMMSSettings */ |
105 | NOTSUPPORTED, /* SetMMSSettings */ | 105 | NOTSUPPORTED, /* SetMMSSettings */ |
106 | NOTSUPPORTED, /* GetBitmap */ | 106 | NOTSUPPORTED, /* GetBitmap */ |
107 | NOTSUPPORTED, /* SetBitmap */ | 107 | NOTSUPPORTED, /* SetBitmap */ |
108 | NOTSUPPORTED, /* GetToDoStatus */ | 108 | NOTSUPPORTED, /* GetToDoStatus */ |
109 | NOTSUPPORTED, /* GetToDo */ | 109 | NOTSUPPORTED, /* GetToDo */ |
110 | NOTSUPPORTED, /* GetNextToDo */ | 110 | NOTSUPPORTED, /* GetNextToDo */ |
111 | NOTSUPPORTED, /* SetToDo */ | 111 | NOTSUPPORTED, /* SetToDo */ |
112 | NOTSUPPORTED, /* AddToDo */ | 112 | NOTSUPPORTED, /* AddToDo */ |
113 | NOTSUPPORTED, /* DeleteToDo */ | 113 | NOTSUPPORTED, /* DeleteToDo */ |
114 | NOTSUPPORTED, /* DeleteAllToDo */ | 114 | NOTSUPPORTED, /* DeleteAllToDo */ |
115 | NOTSUPPORTED, /* GetCalendarStatus*/ | 115 | NOTSUPPORTED, /* GetCalendarStatus*/ |
116 | NOTSUPPORTED, /* GetCalendar */ | 116 | NOTSUPPORTED, /* GetCalendar */ |
117 | NOTSUPPORTED, /* GetNextCalendar */ | 117 | NOTSUPPORTED, /* GetNextCalendar */ |
118 | NOTSUPPORTED, /* SetCalendar */ | 118 | NOTSUPPORTED, /* SetCalendar */ |
119 | NOTSUPPORTED, /* AddCalendar */ | 119 | NOTSUPPORTED, /* AddCalendar */ |
120 | NOTSUPPORTED, /* DeleteCalendar */ | 120 | NOTSUPPORTED, /* DeleteCalendar */ |
121 | NOTSUPPORTED, /* DeleteAllCalendar*/ | 121 | NOTSUPPORTED, /* DeleteAllCalendar*/ |
122 | NOTSUPPORTED, /* GetCalendarSettings*/ | 122 | NOTSUPPORTED, /* GetCalendarSettings*/ |
123 | NOTSUPPORTED, /* SetCalendarSettings*/ | 123 | NOTSUPPORTED, /* SetCalendarSettings*/ |
124 | NOTSUPPORTED, /* GetNote */ | 124 | NOTSUPPORTED, /* GetNextNote */ |
125 | NOTSUPPORTED, /* GetProfile */ | 125 | NOTSUPPORTED, /* GetProfile */ |
126 | NOTSUPPORTED, /* SetProfile */ | 126 | NOTSUPPORTED, /* SetProfile */ |
127 | NOTSUPPORTED, /* GetFMStation */ | 127 | NOTSUPPORTED, /* GetFMStation */ |
128 | NOTSUPPORTED, /* SetFMStation */ | 128 | NOTSUPPORTED, /* SetFMStation */ |
129 | NOTSUPPORTED, /* ClearFMStations */ | 129 | NOTSUPPORTED, /* ClearFMStations */ |
130 | NOTSUPPORTED, /* GetNextFileFolder*/ | 130 | NOTSUPPORTED, /* GetNextFileFolder*/ |
131 | NOTSUPPORTED, /* GetFilePart */ | 131 | NOTSUPPORTED, /* GetFilePart */ |
132 | NOTSUPPORTED, /* AddFilePart */ | 132 | NOTSUPPORTED, /* AddFilePart */ |
133 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 133 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
134 | NOTSUPPORTED, /* DeleteFile */ | 134 | NOTSUPPORTED, /* DeleteFile */ |
135 | NOTSUPPORTED, /* AddFolder */ | 135 | NOTSUPPORTED, /* AddFolder */ |
136 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 136 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
137 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 137 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
138 | }; | 138 | }; |
139 | 139 | ||
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | /* How should editor hadle tabs in this file? Add editor commands here. | 142 | /* How should editor hadle tabs in this file? Add editor commands here. |
143 | * vim: noexpandtab sw=8 ts=8 sts=8: | 143 | * vim: noexpandtab sw=8 ts=8 sts=8: |
144 | */ | 144 | */ |
diff --git a/gammu/emb/common/phone/nokia/nfunc.c b/gammu/emb/common/phone/nokia/nfunc.c index 3acfb10..d4d8b03 100644 --- a/gammu/emb/common/phone/nokia/nfunc.c +++ b/gammu/emb/common/phone/nokia/nfunc.c | |||
@@ -1372,77 +1372,91 @@ GSM_Error N71_65_ReplyCallInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
1372 | call.Status = GSM_CALL_IncomingCall; | 1372 | call.Status = GSM_CALL_IncomingCall; |
1373 | tmp = 6; | 1373 | tmp = 6; |
1374 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); | 1374 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); |
1375 | break; | 1375 | break; |
1376 | case 0x07: | 1376 | case 0x07: |
1377 | smprintf(s, "Call answer initiated\n"); | 1377 | smprintf(s, "Call answer initiated\n"); |
1378 | break; | 1378 | break; |
1379 | case 0x09: | 1379 | case 0x09: |
1380 | smprintf(s, "Call released\n"); | 1380 | smprintf(s, "Call released\n"); |
1381 | call.Status = GSM_CALL_CallLocalEnd; | 1381 | call.Status = GSM_CALL_CallLocalEnd; |
1382 | break; | 1382 | break; |
1383 | case 0x0a: | 1383 | case 0x0a: |
1384 | smprintf(s, "Call is being released\n"); | 1384 | smprintf(s, "Call is being released\n"); |
1385 | break; | 1385 | break; |
1386 | case 0x0b: | 1386 | case 0x0b: |
1387 | smprintf(s, "Meaning not known\n"); | 1387 | smprintf(s, "Meaning not known\n"); |
1388 | call.CallIDAvailable = false; | 1388 | call.CallIDAvailable = false; |
1389 | break; | 1389 | break; |
1390 | case 0x0c: | 1390 | case 0x0c: |
1391 | smprintf(s, "Audio status\n"); | 1391 | smprintf(s, "Audio status\n"); |
1392 | if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n"); | 1392 | if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n"); |
1393 | else smprintf(s, "Audio disabled\n"); | 1393 | else smprintf(s, "Audio disabled\n"); |
1394 | call.CallIDAvailable = false; | 1394 | call.CallIDAvailable = false; |
1395 | break; | 1395 | break; |
1396 | case 0x0f: | ||
1397 | case 0x10: | ||
1398 | smprintf(s, "Meaning not known\n"); | ||
1399 | call.CallIDAvailable = false; | ||
1400 | break; | ||
1396 | case 0x23: | 1401 | case 0x23: |
1397 | smprintf(s, "Call held\n"); | 1402 | smprintf(s, "Call held\n"); |
1398 | call.Status = GSM_CALL_CallHeld; | 1403 | call.Status = GSM_CALL_CallHeld; |
1399 | break; | 1404 | break; |
1400 | case 0x25: | 1405 | case 0x25: |
1401 | smprintf(s, "Call resumed\n"); | 1406 | smprintf(s, "Call resumed\n"); |
1402 | call.Status = GSM_CALL_CallResumed; | 1407 | call.Status = GSM_CALL_CallResumed; |
1403 | break; | 1408 | break; |
1404 | case 0x27: | 1409 | case 0x27: |
1405 | smprintf(s, "Call switched\n"); | 1410 | smprintf(s, "Call switched\n"); |
1406 | call.Status = GSM_CALL_CallSwitched; | 1411 | call.Status = GSM_CALL_CallSwitched; |
1407 | break; | 1412 | break; |
1408 | case 0x53: | 1413 | case 0x53: |
1409 | smprintf(s, "Outgoing call\n"); | 1414 | smprintf(s, "Outgoing call\n"); |
1410 | smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii | 1415 | smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii |
1411 | tmp = 6; | 1416 | tmp = 6; |
1412 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false); | 1417 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false); |
1413 | smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer)); | 1418 | smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer)); |
1414 | /* FIXME: read name from frame */ | 1419 | /* FIXME: read name from frame */ |
1415 | call.Status = GSM_CALL_OutgoingCall; | 1420 | call.Status = GSM_CALL_OutgoingCall; |
1416 | tmp = 6; | 1421 | tmp = 6; |
1417 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); | 1422 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); |
1418 | break; | 1423 | break; |
1424 | case 0xA6: | ||
1425 | case 0xD2: | ||
1426 | case 0xD3: | ||
1427 | smprintf(s, "Meaning not known\n"); | ||
1428 | call.CallIDAvailable = false; | ||
1429 | break; | ||
1419 | } | 1430 | } |
1420 | if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]); | 1431 | if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]); |
1421 | if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) { | 1432 | if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) { |
1422 | if (call.CallIDAvailable) call.CallID = msg.Buffer[4]; | 1433 | if (call.CallIDAvailable) call.CallID = msg.Buffer[4]; |
1423 | s->User.IncomingCall(s->CurrentConfig->Device, call); | 1434 | s->User.IncomingCall(s->CurrentConfig->Device, call); |
1424 | } | 1435 | } |
1436 | if (s->Phone.Data.RequestID == ID_DialVoice) { | ||
1437 | if (msg.Buffer[3] == 0x10) return ERR_NOTSUPPORTED; | ||
1438 | } | ||
1425 | if (s->Phone.Data.RequestID == ID_CancelCall) { | 1439 | if (s->Phone.Data.RequestID == ID_CancelCall) { |
1426 | if (msg.Buffer[3] == 0x09) { | 1440 | if (msg.Buffer[3] == 0x09) { |
1427 | if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; | 1441 | if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; |
1428 | /* when we canceled call and see frame about other | 1442 | /* when we canceled call and see frame about other |
1429 | * call releasing, we don't give ERR_NONE for "our" | 1443 | * call releasing, we don't give ERR_NONE for "our" |
1430 | * call release command | 1444 | * call release command |
1431 | */ | 1445 | */ |
1432 | return ERR_NEEDANOTHERANSWER; | 1446 | return ERR_NEEDANOTHERANSWER; |
1433 | } | 1447 | } |
1434 | } | 1448 | } |
1435 | if (s->Phone.Data.RequestID == ID_AnswerCall) { | 1449 | if (s->Phone.Data.RequestID == ID_AnswerCall) { |
1436 | if (msg.Buffer[3] == 0x07) { | 1450 | if (msg.Buffer[3] == 0x07) { |
1437 | if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; | 1451 | if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; |
1438 | return ERR_NEEDANOTHERANSWER; | 1452 | return ERR_NEEDANOTHERANSWER; |
1439 | } | 1453 | } |
1440 | } | 1454 | } |
1441 | return ERR_NONE; | 1455 | return ERR_NONE; |
1442 | } | 1456 | } |
1443 | 1457 | ||
1444 | void N71_65_GetCalendarRecurrance(GSM_StateMachine *s, unsigned char *buffer, GSM_CalendarEntry *entry) | 1458 | void N71_65_GetCalendarRecurrance(GSM_StateMachine *s, unsigned char *buffer, GSM_CalendarEntry *entry) |
1445 | { | 1459 | { |
1446 | int Recurrance; | 1460 | int Recurrance; |
1447 | 1461 | ||
1448 | Recurrance = buffer[0]*256 + buffer[1]; | 1462 | Recurrance = buffer[0]*256 + buffer[1]; |
diff --git a/gammu/emb/common/phone/obex/obexgen.c b/gammu/emb/common/phone/obex/obexgen.c index dd14f8e..3106369 100644 --- a/gammu/emb/common/phone/obex/obexgen.c +++ b/gammu/emb/common/phone/obex/obexgen.c | |||
@@ -753,48 +753,49 @@ GSM_Phone_Functions OBEXGENPhone = { | |||
753 | NOTIMPLEMENTED, /* GetSignalQuality*/ | 753 | NOTIMPLEMENTED, /* GetSignalQuality*/ |
754 | NOTIMPLEMENTED, /* GetNetworkInfo */ | 754 | NOTIMPLEMENTED, /* GetNetworkInfo */ |
755 | NOTIMPLEMENTED, /* GetCategory */ | 755 | NOTIMPLEMENTED, /* GetCategory */ |
756 | NOTSUPPORTED, /* AddCategory */ | 756 | NOTSUPPORTED, /* AddCategory */ |
757 | NOTIMPLEMENTED, /* GetCategoryStatus */ | 757 | NOTIMPLEMENTED, /* GetCategoryStatus */ |
758 | NOTIMPLEMENTED, /* GetMemoryStatus */ | 758 | NOTIMPLEMENTED, /* GetMemoryStatus */ |
759 | NOTIMPLEMENTED, /* GetMemory */ | 759 | NOTIMPLEMENTED, /* GetMemory */ |
760 | NOTIMPLEMENTED, /* GetNextMemory */ | 760 | NOTIMPLEMENTED, /* GetNextMemory */ |
761 | NOTIMPLEMENTED, /* SetMemory */ | 761 | NOTIMPLEMENTED, /* SetMemory */ |
762 | NOTIMPLEMENTED, /* AddMemory */ | 762 | NOTIMPLEMENTED, /* AddMemory */ |
763 | NOTIMPLEMENTED, /* DeleteMemory */ | 763 | NOTIMPLEMENTED, /* DeleteMemory */ |
764 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 764 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
765 | NOTIMPLEMENTED, /* GetSpeedDial */ | 765 | NOTIMPLEMENTED, /* GetSpeedDial */ |
766 | NOTIMPLEMENTED, /* SetSpeedDial */ | 766 | NOTIMPLEMENTED, /* SetSpeedDial */ |
767 | NOTIMPLEMENTED, /* GetSMSC */ | 767 | NOTIMPLEMENTED, /* GetSMSC */ |
768 | NOTIMPLEMENTED, /* SetSMSC */ | 768 | NOTIMPLEMENTED, /* SetSMSC */ |
769 | NOTIMPLEMENTED, /* GetSMSStatus */ | 769 | NOTIMPLEMENTED, /* GetSMSStatus */ |
770 | NOTIMPLEMENTED, /* GetSMS */ | 770 | NOTIMPLEMENTED, /* GetSMS */ |
771 | NOTIMPLEMENTED, /* GetNextSMS */ | 771 | NOTIMPLEMENTED, /* GetNextSMS */ |
772 | NOTIMPLEMENTED, /* SetSMS */ | 772 | NOTIMPLEMENTED, /* SetSMS */ |
773 | NOTIMPLEMENTED, /* AddSMS */ | 773 | NOTIMPLEMENTED, /* AddSMS */ |
774 | NOTIMPLEMENTED, /* DeleteSMS */ | 774 | NOTIMPLEMENTED, /* DeleteSMS */ |
775 | NOTIMPLEMENTED, /* SendSMSMessage */ | 775 | NOTIMPLEMENTED, /* SendSMSMessage */ |
776 | NOTSUPPORTED, /* SendSavedSMS */ | 776 | NOTSUPPORTED, /* SendSavedSMS */ |
777 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
777 | NOTIMPLEMENTED, /* SetIncomingSMS */ | 778 | NOTIMPLEMENTED, /* SetIncomingSMS */ |
778 | NOTIMPLEMENTED, /* SetIncomingCB */ | 779 | NOTIMPLEMENTED, /* SetIncomingCB */ |
779 | NOTIMPLEMENTED, /* GetSMSFolders */ | 780 | NOTIMPLEMENTED, /* GetSMSFolders */ |
780 | NOTIMPLEMENTED, /* AddSMSFolder */ | 781 | NOTIMPLEMENTED, /* AddSMSFolder */ |
781 | NOTIMPLEMENTED, /* DeleteSMSFolder */ | 782 | NOTIMPLEMENTED, /* DeleteSMSFolder */ |
782 | NOTIMPLEMENTED, /* DialVoice */ | 783 | NOTIMPLEMENTED, /* DialVoice */ |
783 | NOTIMPLEMENTED, /* AnswerCall */ | 784 | NOTIMPLEMENTED, /* AnswerCall */ |
784 | NOTIMPLEMENTED, /* CancelCall */ | 785 | NOTIMPLEMENTED, /* CancelCall */ |
785 | NOTIMPLEMENTED, /* HoldCall */ | 786 | NOTIMPLEMENTED, /* HoldCall */ |
786 | NOTIMPLEMENTED, /* UnholdCall */ | 787 | NOTIMPLEMENTED, /* UnholdCall */ |
787 | NOTIMPLEMENTED, /* ConferenceCall */ | 788 | NOTIMPLEMENTED, /* ConferenceCall */ |
788 | NOTIMPLEMENTED, /* SplitCall */ | 789 | NOTIMPLEMENTED, /* SplitCall */ |
789 | NOTIMPLEMENTED, /* TransferCall */ | 790 | NOTIMPLEMENTED, /* TransferCall */ |
790 | NOTIMPLEMENTED, /* SwitchCall */ | 791 | NOTIMPLEMENTED, /* SwitchCall */ |
791 | NOTIMPLEMENTED, /* GetCallDivert */ | 792 | NOTIMPLEMENTED, /* GetCallDivert */ |
792 | NOTIMPLEMENTED, /* SetCallDivert */ | 793 | NOTIMPLEMENTED, /* SetCallDivert */ |
793 | NOTIMPLEMENTED, /* CancelAllDiverts*/ | 794 | NOTIMPLEMENTED, /* CancelAllDiverts*/ |
794 | NOTIMPLEMENTED, /* SetIncomingCall */ | 795 | NOTIMPLEMENTED, /* SetIncomingCall */ |
795 | NOTIMPLEMENTED, /* SetIncomingUSSD */ | 796 | NOTIMPLEMENTED, /* SetIncomingUSSD */ |
796 | NOTIMPLEMENTED, /* SendDTMF */ | 797 | NOTIMPLEMENTED, /* SendDTMF */ |
797 | NOTIMPLEMENTED, /* GetRingtone */ | 798 | NOTIMPLEMENTED, /* GetRingtone */ |
798 | NOTIMPLEMENTED, /* SetRingtone */ | 799 | NOTIMPLEMENTED, /* SetRingtone */ |
799 | NOTIMPLEMENTED, /* GetRingtonesInfo*/ | 800 | NOTIMPLEMENTED, /* GetRingtonesInfo*/ |
800 | NOTIMPLEMENTED, /* DeleteUserRingtones*/ | 801 | NOTIMPLEMENTED, /* DeleteUserRingtones*/ |
@@ -807,45 +808,45 @@ GSM_Phone_Functions OBEXGENPhone = { | |||
807 | NOTIMPLEMENTED, /* GetMMSSettings */ | 808 | NOTIMPLEMENTED, /* GetMMSSettings */ |
808 | NOTIMPLEMENTED, /* SetMMSSettings */ | 809 | NOTIMPLEMENTED, /* SetMMSSettings */ |
809 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 810 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
810 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 811 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
811 | NOTSUPPORTED, /* GetChatSettings */ | 812 | NOTSUPPORTED, /* GetChatSettings */ |
812 | NOTSUPPORTED, /* SetChatSettings */ | 813 | NOTSUPPORTED, /* SetChatSettings */ |
813 | NOTIMPLEMENTED, /* GetBitmap */ | 814 | NOTIMPLEMENTED, /* GetBitmap */ |
814 | NOTIMPLEMENTED, /* SetBitmap */ | 815 | NOTIMPLEMENTED, /* SetBitmap */ |
815 | NOTIMPLEMENTED, /* GetToDoStatus */ | 816 | NOTIMPLEMENTED, /* GetToDoStatus */ |
816 | NOTIMPLEMENTED, /* GetToDo */ | 817 | NOTIMPLEMENTED, /* GetToDo */ |
817 | NOTIMPLEMENTED, /* GetNextToDo */ | 818 | NOTIMPLEMENTED, /* GetNextToDo */ |
818 | NOTIMPLEMENTED, /* SetToDo */ | 819 | NOTIMPLEMENTED, /* SetToDo */ |
819 | NOTIMPLEMENTED, /* AddToDo */ | 820 | NOTIMPLEMENTED, /* AddToDo */ |
820 | NOTIMPLEMENTED, /* DeleteToDo */ | 821 | NOTIMPLEMENTED, /* DeleteToDo */ |
821 | NOTIMPLEMENTED, /* DeleteAllToDo */ | 822 | NOTIMPLEMENTED, /* DeleteAllToDo */ |
822 | NOTIMPLEMENTED, /* GetCalendarStatus*/ | 823 | NOTIMPLEMENTED, /* GetCalendarStatus*/ |
823 | NOTIMPLEMENTED, /* GetCalendar */ | 824 | NOTIMPLEMENTED, /* GetCalendar */ |
824 | NOTIMPLEMENTED, /* GetNextCalendar */ | 825 | NOTIMPLEMENTED, /* GetNextCalendar */ |
825 | NOTIMPLEMENTED, /* SetCalendar */ | 826 | NOTIMPLEMENTED, /* SetCalendar */ |
826 | NOTIMPLEMENTED, /* AddCalendar */ | 827 | NOTIMPLEMENTED, /* AddCalendar */ |
827 | NOTIMPLEMENTED, /* DeleteCalendar */ | 828 | NOTIMPLEMENTED, /* DeleteCalendar */ |
828 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 829 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
829 | NOTSUPPORTED, /* GetCalendarSettings*/ | 830 | NOTSUPPORTED, /* GetCalendarSettings*/ |
830 | NOTSUPPORTED, /* SetCalendarSettings*/ | 831 | NOTSUPPORTED, /* SetCalendarSettings*/ |
831 | NOTSUPPORTED, /* GetNote */ | 832 | NOTSUPPORTED, /* GetNextNote */ |
832 | NOTIMPLEMENTED, /* GetProfile */ | 833 | NOTIMPLEMENTED, /* GetProfile */ |
833 | NOTIMPLEMENTED, /* SetProfile */ | 834 | NOTIMPLEMENTED, /* SetProfile */ |
834 | NOTIMPLEMENTED, /* GetFMStation */ | 835 | NOTIMPLEMENTED, /* GetFMStation */ |
835 | NOTIMPLEMENTED, /* SetFMStation */ | 836 | NOTIMPLEMENTED, /* SetFMStation */ |
836 | NOTIMPLEMENTED, /* ClearFMStations */ | 837 | NOTIMPLEMENTED, /* ClearFMStations */ |
837 | OBEXGEN_GetNextFileFolder, | 838 | OBEXGEN_GetNextFileFolder, |
838 | OBEXGEN_GetFilePart, | 839 | OBEXGEN_GetFilePart, |
839 | OBEXGEN_AddFilePart, | 840 | OBEXGEN_AddFilePart, |
840 | NOTIMPLEMENTED, /* GetFileSystemStatus*/ | 841 | NOTIMPLEMENTED, /* GetFileSystemStatus*/ |
841 | OBEXGEN_DeleteFile, | 842 | OBEXGEN_DeleteFile, |
842 | OBEXGEN_AddFolder, | 843 | OBEXGEN_AddFolder, |
843 | NOTIMPLEMENTED, /* GetGPRSAccessPoint*/ | 844 | NOTIMPLEMENTED, /* GetGPRSAccessPoint*/ |
844 | NOTIMPLEMENTED /* SetGPRSAccessPoint*/ | 845 | NOTIMPLEMENTED /* SetGPRSAccessPoint*/ |
845 | }; | 846 | }; |
846 | 847 | ||
847 | #endif | 848 | #endif |
848 | 849 | ||
849 | /* How should editor hadle tabs in this file? Add editor commands here. | 850 | /* How should editor hadle tabs in this file? Add editor commands here. |
850 | * vim: noexpandtab sw=8 ts=8 sts=8: | 851 | * vim: noexpandtab sw=8 ts=8 sts=8: |
851 | */ | 852 | */ |
diff --git a/gammu/emb/common/phone/obex/obexgen.h b/gammu/emb/common/phone/obex/obexgen.h index 466fef5..b7033de 100644 --- a/gammu/emb/common/phone/obex/obexgen.h +++ b/gammu/emb/common/phone/obex/obexgen.h | |||
@@ -10,29 +10,33 @@ | |||
10 | 10 | ||
11 | #ifndef GSM_USED_IRDAOBEX | 11 | #ifndef GSM_USED_IRDAOBEX |
12 | # define GSM_USED_IRDAOBEX | 12 | # define GSM_USED_IRDAOBEX |
13 | #endif | 13 | #endif |
14 | #ifndef GSM_USED_BLUEOBEX | 14 | #ifndef GSM_USED_BLUEOBEX |
15 | # define GSM_USED_BLUEOBEX | 15 | # define GSM_USED_BLUEOBEX |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | typedef enum { | 18 | typedef enum { |
19 | OBEX_None = 1, | 19 | OBEX_None = 1, |
20 | OBEX_BrowsingFolders | 20 | OBEX_BrowsingFolders |
21 | } OBEX_Service; | 21 | } OBEX_Service; |
22 | 22 | ||
23 | typedef struct { | 23 | typedef struct { |
24 | int FileLev; | 24 | int FileLev; |
25 | int FilesLocationsUsed; | 25 | int FilesLocationsUsed; |
26 | int FilesLocationsCurrent; | 26 | int FilesLocationsCurrent; |
27 | GSM_File Files[500]; | 27 | GSM_File Files[500]; |
28 | bool FileLastPart; | 28 | bool FileLastPart; |
29 | 29 | ||
30 | int FrameSize; | 30 | int FrameSize; |
31 | OBEX_Service Service; | 31 | OBEX_Service Service; |
32 | } GSM_Phone_OBEXGENData; | 32 | } GSM_Phone_OBEXGENData; |
33 | 33 | ||
34 | GSM_Error OBEXGEN_GetFilePart(GSM_StateMachine *s, GSM_File *File); | ||
35 | GSM_Error OBEXGEN_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos); | ||
36 | GSM_Error OBEXGEN_Disconnect(GSM_StateMachine *s); | ||
37 | |||
34 | #endif | 38 | #endif |
35 | 39 | ||
36 | /* How should editor hadle tabs in this file? Add editor commands here. | 40 | /* How should editor hadle tabs in this file? Add editor commands here. |
37 | * vim: noexpandtab sw=8 ts=8 sts=8: | 41 | * vim: noexpandtab sw=8 ts=8 sts=8: |
38 | */ | 42 | */ |
diff --git a/gammu/emb/common/phone/symbian/mroutgen.c b/gammu/emb/common/phone/symbian/mroutgen.c index 2c339be..a7382cf 100644 --- a/gammu/emb/common/phone/symbian/mroutgen.c +++ b/gammu/emb/common/phone/symbian/mroutgen.c | |||
@@ -122,48 +122,49 @@ GSM_Phone_Functions MROUTERGENPhone = { | |||
122 | NOTSUPPORTED, /* GetBatteryCharge*/ | 122 | NOTSUPPORTED, /* GetBatteryCharge*/ |
123 | NOTSUPPORTED, /* GetSignalQuality*/ | 123 | NOTSUPPORTED, /* GetSignalQuality*/ |
124 | NOTSUPPORTED, /* GetNetworkInfo */ | 124 | NOTSUPPORTED, /* GetNetworkInfo */ |
125 | NOTSUPPORTED, /* GetCategory */ | 125 | NOTSUPPORTED, /* GetCategory */ |
126 | NOTSUPPORTED, /* GetCategoryStatus */ | 126 | NOTSUPPORTED, /* GetCategoryStatus */ |
127 | NOTSUPPORTED, /* GetMemoryStatus */ | 127 | NOTSUPPORTED, /* GetMemoryStatus */ |
128 | NOTSUPPORTED, /* GetMemory */ | 128 | NOTSUPPORTED, /* GetMemory */ |
129 | NOTSUPPORTED, /* GetNextMemory */ | 129 | NOTSUPPORTED, /* GetNextMemory */ |
130 | NOTSUPPORTED, /* SetMemory */ | 130 | NOTSUPPORTED, /* SetMemory */ |
131 | NOTSUPPORTED, /* AddMemory */ | 131 | NOTSUPPORTED, /* AddMemory */ |
132 | NOTSUPPORTED, /* DeleteMemory */ | 132 | NOTSUPPORTED, /* DeleteMemory */ |
133 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 133 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
134 | NOTSUPPORTED, /* GetSpeedDial */ | 134 | NOTSUPPORTED, /* GetSpeedDial */ |
135 | NOTSUPPORTED, /* SetSpeedDial */ | 135 | NOTSUPPORTED, /* SetSpeedDial */ |
136 | NOTSUPPORTED, /* GetSMSC */ | 136 | NOTSUPPORTED, /* GetSMSC */ |
137 | NOTSUPPORTED, /* SetSMSC */ | 137 | NOTSUPPORTED, /* SetSMSC */ |
138 | NOTSUPPORTED, /* GetSMSStatus */ | 138 | NOTSUPPORTED, /* GetSMSStatus */ |
139 | NOTSUPPORTED, /* GetSMS */ | 139 | NOTSUPPORTED, /* GetSMS */ |
140 | NOTSUPPORTED, /* GetNextSMS */ | 140 | NOTSUPPORTED, /* GetNextSMS */ |
141 | NOTSUPPORTED, /* SetSMS */ | 141 | NOTSUPPORTED, /* SetSMS */ |
142 | NOTSUPPORTED, /* AddSMS */ | 142 | NOTSUPPORTED, /* AddSMS */ |
143 | NOTSUPPORTED, /* DeleteSMS */ | 143 | NOTSUPPORTED, /* DeleteSMS */ |
144 | NOTSUPPORTED, /* SendSMSMessage */ | 144 | NOTSUPPORTED, /* SendSMSMessage */ |
145 | NOTSUPPORTED, /* SendSavedSMS */ | 145 | NOTSUPPORTED, /* SendSavedSMS */ |
146 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
146 | NOTSUPPORTED, /* SetIncomingSMS */ | 147 | NOTSUPPORTED, /* SetIncomingSMS */ |
147 | NOTSUPPORTED, /* SetIncomingCB */ | 148 | NOTSUPPORTED, /* SetIncomingCB */ |
148 | NOTSUPPORTED, /* GetSMSFolders */ | 149 | NOTSUPPORTED, /* GetSMSFolders */ |
149 | NOTSUPPORTED, /* AddSMSFolder */ | 150 | NOTSUPPORTED, /* AddSMSFolder */ |
150 | NOTSUPPORTED, /* DeleteSMSFolder */ | 151 | NOTSUPPORTED, /* DeleteSMSFolder */ |
151 | NOTSUPPORTED, /* DialVoice */ | 152 | NOTSUPPORTED, /* DialVoice */ |
152 | NOTSUPPORTED, /* AnswerCall */ | 153 | NOTSUPPORTED, /* AnswerCall */ |
153 | NOTSUPPORTED, /* CancelCall */ | 154 | NOTSUPPORTED, /* CancelCall */ |
154 | NOTSUPPORTED, /* HoldCall */ | 155 | NOTSUPPORTED, /* HoldCall */ |
155 | NOTSUPPORTED, /* UnholdCall */ | 156 | NOTSUPPORTED, /* UnholdCall */ |
156 | NOTSUPPORTED, /* ConferenceCall */ | 157 | NOTSUPPORTED, /* ConferenceCall */ |
157 | NOTSUPPORTED, /* SplitCall */ | 158 | NOTSUPPORTED, /* SplitCall */ |
158 | NOTSUPPORTED, /* TransferCall */ | 159 | NOTSUPPORTED, /* TransferCall */ |
159 | NOTSUPPORTED, /* SwitchCall */ | 160 | NOTSUPPORTED, /* SwitchCall */ |
160 | NOTSUPPORTED, /* GetCallDivert */ | 161 | NOTSUPPORTED, /* GetCallDivert */ |
161 | NOTSUPPORTED, /* SetCallDivert */ | 162 | NOTSUPPORTED, /* SetCallDivert */ |
162 | NOTSUPPORTED, /* CancelAllDiverts*/ | 163 | NOTSUPPORTED, /* CancelAllDiverts*/ |
163 | NOTSUPPORTED, /* SetIncomingCall */ | 164 | NOTSUPPORTED, /* SetIncomingCall */ |
164 | NOTSUPPORTED, /* SetIncomingUSSD */ | 165 | NOTSUPPORTED, /* SetIncomingUSSD */ |
165 | NOTSUPPORTED, /* SendDTMF */ | 166 | NOTSUPPORTED, /* SendDTMF */ |
166 | NOTSUPPORTED, /* GetRingtone */ | 167 | NOTSUPPORTED, /* GetRingtone */ |
167 | NOTSUPPORTED, /* SetRingtone */ | 168 | NOTSUPPORTED, /* SetRingtone */ |
168 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 169 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
169 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 170 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
@@ -176,45 +177,45 @@ GSM_Phone_Functions MROUTERGENPhone = { | |||
176 | NOTSUPPORTED, /* GetMMSSettings */ | 177 | NOTSUPPORTED, /* GetMMSSettings */ |
177 | NOTSUPPORTED, /* SetMMSSettings */ | 178 | NOTSUPPORTED, /* SetMMSSettings */ |
178 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 179 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
179 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 180 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
180 | NOTSUPPORTED, /* GetChatSettings */ | 181 | NOTSUPPORTED, /* GetChatSettings */ |
181 | NOTSUPPORTED, /* SetChatSettings */ | 182 | NOTSUPPORTED, /* SetChatSettings */ |
182 | NOTSUPPORTED, /* GetBitmap */ | 183 | NOTSUPPORTED, /* GetBitmap */ |
183 | NOTSUPPORTED, /* SetBitmap */ | 184 | NOTSUPPORTED, /* SetBitmap */ |
184 | NOTSUPPORTED, /* GetToDoStatus */ | 185 | NOTSUPPORTED, /* GetToDoStatus */ |
185 | NOTSUPPORTED, /* GetToDo */ | 186 | NOTSUPPORTED, /* GetToDo */ |
186 | NOTSUPPORTED, /* GetNextToDo */ | 187 | NOTSUPPORTED, /* GetNextToDo */ |
187 | NOTSUPPORTED, /* SetToDo */ | 188 | NOTSUPPORTED, /* SetToDo */ |
188 | NOTSUPPORTED, /* AddToDo */ | 189 | NOTSUPPORTED, /* AddToDo */ |
189 | NOTSUPPORTED, /* DeleteToDo */ | 190 | NOTSUPPORTED, /* DeleteToDo */ |
190 | NOTSUPPORTED, /* DeleteAllToDo */ | 191 | NOTSUPPORTED, /* DeleteAllToDo */ |
191 | NOTSUPPORTED, /* GetCalendarStatus*/ | 192 | NOTSUPPORTED, /* GetCalendarStatus*/ |
192 | NOTSUPPORTED, /* GetCalendar */ | 193 | NOTSUPPORTED, /* GetCalendar */ |
193 | NOTSUPPORTED, /* GetNextCalendar */ | 194 | NOTSUPPORTED, /* GetNextCalendar */ |
194 | NOTSUPPORTED, /* SetCalendar */ | 195 | NOTSUPPORTED, /* SetCalendar */ |
195 | NOTSUPPORTED, /* AddCalendar */ | 196 | NOTSUPPORTED, /* AddCalendar */ |
196 | NOTSUPPORTED, /* DeleteCalendar */ | 197 | NOTSUPPORTED, /* DeleteCalendar */ |
197 | NOTSUPPORTED, /* DeleteAllCalendar*/ | 198 | NOTSUPPORTED, /* DeleteAllCalendar*/ |
198 | NOTSUPPORTED, /* GetCalendarSettings*/ | 199 | NOTSUPPORTED, /* GetCalendarSettings*/ |
199 | NOTSUPPORTED, /* SetCalendarSettings*/ | 200 | NOTSUPPORTED, /* SetCalendarSettings*/ |
200 | NOTSUPPORTED, /* GetNote */ | 201 | NOTSUPPORTED, /* GetNextNote */ |
201 | NOTSUPPORTED, /* GetProfile */ | 202 | NOTSUPPORTED, /* GetProfile */ |
202 | NOTSUPPORTED, /* SetProfile */ | 203 | NOTSUPPORTED, /* SetProfile */ |
203 | NOTSUPPORTED, /* GetFMStation */ | 204 | NOTSUPPORTED, /* GetFMStation */ |
204 | NOTSUPPORTED, /* SetFMStation */ | 205 | NOTSUPPORTED, /* SetFMStation */ |
205 | NOTSUPPORTED, /* ClearFMStations */ | 206 | NOTSUPPORTED, /* ClearFMStations */ |
206 | NOTSUPPORTED, /* GetNextFileFolder*/ | 207 | NOTSUPPORTED, /* GetNextFileFolder*/ |
207 | NOTSUPPORTED, /* GetFilePart */ | 208 | NOTSUPPORTED, /* GetFilePart */ |
208 | NOTSUPPORTED, /* AddFilePart */ | 209 | NOTSUPPORTED, /* AddFilePart */ |
209 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 210 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
210 | NOTSUPPORTED, /* DeleteFile */ | 211 | NOTSUPPORTED, /* DeleteFile */ |
211 | NOTSUPPORTED, /* AddFolder */ | 212 | NOTSUPPORTED, /* AddFolder */ |
212 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 213 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
213 | NOTSUPPORTED /* SetGPRSAccessPoint*/ | 214 | NOTSUPPORTED /* SetGPRSAccessPoint*/ |
214 | }; | 215 | }; |
215 | 216 | ||
216 | #endif | 217 | #endif |
217 | 218 | ||
218 | /* How should editor hadle tabs in this file? Add editor commands here. | 219 | /* How should editor hadle tabs in this file? Add editor commands here. |
219 | * vim: noexpandtab sw=8 ts=8 sts=8: | 220 | * vim: noexpandtab sw=8 ts=8 sts=8: |
220 | */ | 221 | */ |
diff --git a/gammu/emb/common/protocol/at/at.c b/gammu/emb/common/protocol/at/at.c index f4a75b7..f8ddc06 100644 --- a/gammu/emb/common/protocol/at/at.c +++ b/gammu/emb/common/protocol/at/at.c | |||
@@ -45,56 +45,60 @@ typedef struct { | |||
45 | 45 | ||
46 | static GSM_Error AT_StateMachine(GSM_StateMachine *s, unsigned char rx_char) | 46 | static GSM_Error AT_StateMachine(GSM_StateMachine *s, unsigned char rx_char) |
47 | { | 47 | { |
48 | GSM_Protocol_Message Msg2; | 48 | GSM_Protocol_Message Msg2; |
49 | GSM_Protocol_ATData *d = &s->Protocol.Data.AT; | 49 | GSM_Protocol_ATData *d = &s->Protocol.Data.AT; |
50 | int i; | 50 | int i; |
51 | 51 | ||
52 | /* These are lines with end of "normal" answers */ | 52 | /* These are lines with end of "normal" answers */ |
53 | static char *StartStrings[] = { | 53 | static char *StartStrings[] = { |
54 | "OK" , "ERROR" , | 54 | "OK" , "ERROR" , |
55 | "+CME ERROR:" , "+CMS ERROR:", | 55 | "+CME ERROR:" , "+CMS ERROR:", |
56 | 56 | ||
57 | "+CPIN: " ,/*A2D issue*/ | 57 | "+CPIN: " ,/*A2D issue*/ |
58 | 58 | ||
59 | NULL}; | 59 | NULL}; |
60 | 60 | ||
61 | /* Some info from phone can be inside "normal" answers | 61 | /* Some info from phone can be inside "normal" answers |
62 | * It starts with strings written here | 62 | * It starts with strings written here |
63 | */ | 63 | */ |
64 | static SpecialAnswersStructSpecialAnswers[] = { | 64 | static SpecialAnswersStructSpecialAnswers[] = { |
65 | {"_OSIGQ:" ,1}, {"_OBS:",1}, | 65 | {"_OSIGQ:" ,1}, {"_OBS:",1}, |
66 | {"^SCN:" ,1}, {"+CGREG:",1}, | 66 | {"^SCN:" ,1}, {"+CGREG:",1}, |
67 | {"+CBM:" ,1}, {"+CMT:",2}, | 67 | {"+CBM:" ,1}, {"+CMT:",2}, |
68 | {"+CMTI:" ,1}, {"+CDS:",2}, | 68 | {"+CMTI:" ,1}, {"+CDS:",2}, |
69 | {"+CREG:",1}, | 69 | {"+CREG:" ,1}, {"+CUSD",1}, |
70 | 70 | ||
71 | {"RING" ,1}, {"NO CARRIER",1}, | 71 | {"RING" ,1}, {"NO CARRIER",1}, |
72 | {"NO ANSWER" ,1}, {"+COLP",1}, | 72 | {"NO ANSWER" ,1}, {"+COLP",1}, |
73 | {"+CLIP",1}, | 73 | {"+CLIP",1}, |
74 | 74 | ||
75 | {"SDNDCRC =" ,1},/* Samsung binary transfer end */ | ||
76 | |||
75 | {NULL ,1}}; | 77 | {NULL ,1}}; |
76 | 78 | ||
79 | //printf("%c",rx_char); | ||
80 | |||
77 | /* Ignore leading CR, LF and ESC */ | 81 | /* Ignore leading CR, LF and ESC */ |
78 | if (d->Msg.Length == 0) { | 82 | if (d->Msg.Length == 0) { |
79 | if (rx_char == 10 || rx_char == 13 || rx_char == 27) return ERR_NONE; | 83 | if (rx_char == 10 || rx_char == 13 || rx_char == 27) return ERR_NONE; |
80 | d->LineStart = d->Msg.Length; | 84 | d->LineStart = d->Msg.Length; |
81 | } | 85 | } |
82 | 86 | ||
83 | if (d->Msg.BufferUsed < d->Msg.Length + 2) { | 87 | if (d->Msg.BufferUsed < d->Msg.Length + 2) { |
84 | d->Msg.BufferUsed= d->Msg.Length + 2; | 88 | d->Msg.BufferUsed= d->Msg.Length + 2; |
85 | d->Msg.Buffer = (unsigned char *)realloc(d->Msg.Buffer,d->Msg.BufferUsed); | 89 | d->Msg.Buffer = (unsigned char *)realloc(d->Msg.Buffer,d->Msg.BufferUsed); |
86 | } | 90 | } |
87 | d->Msg.Buffer[d->Msg.Length++] = rx_char; | 91 | d->Msg.Buffer[d->Msg.Length++] = rx_char; |
88 | d->Msg.Buffer[d->Msg.Length ] = 0; | 92 | d->Msg.Buffer[d->Msg.Length ] = 0; |
89 | 93 | ||
90 | switch (rx_char) { | 94 | switch (rx_char) { |
91 | case 0: | 95 | case 0: |
92 | break; | 96 | break; |
93 | case 10: | 97 | case 10: |
94 | case 13: | 98 | case 13: |
95 | if (!d->wascrlf) d->LineEnd = d->Msg.Length-1; | 99 | if (!d->wascrlf) d->LineEnd = d->Msg.Length-1; |
96 | d->wascrlf = true; | 100 | d->wascrlf = true; |
97 | if (d->Msg.Length > 0 && rx_char == 10 && d->Msg.Buffer[d->Msg.Length-2]==13) { | 101 | if (d->Msg.Length > 0 && rx_char == 10 && d->Msg.Buffer[d->Msg.Length-2]==13) { |
98 | i = 0; | 102 | i = 0; |
99 | while (StartStrings[i] != NULL) { | 103 | while (StartStrings[i] != NULL) { |
100 | if (strncmp(StartStrings[i],d->Msg.Buffer+d->LineStart,strlen(StartStrings[i])) == 0) { | 104 | if (strncmp(StartStrings[i],d->Msg.Buffer+d->LineStart,strlen(StartStrings[i])) == 0) { |
diff --git a/gammu/emb/common/protocol/nokia/fbus2.c b/gammu/emb/common/protocol/nokia/fbus2.c index 8b3e024..2b41f8b 100644 --- a/gammu/emb/common/protocol/nokia/fbus2.c +++ b/gammu/emb/common/protocol/nokia/fbus2.c | |||
@@ -1,26 +1,30 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | /* based on some work from Gnokii and MyGnokii */ | 2 | /* based on some work from MyGnokii (www.mwiacek.com) */ |
3 | /* Based on some work from Gnokii (www.gnokii.org) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
3 | 7 | ||
4 | #include "../../gsmstate.h" | 8 | #include "../../gsmstate.h" |
5 | 9 | ||
6 | #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) | 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) |
7 | 11 | ||
8 | #include <stdio.h> | 12 | #include <stdio.h> |
9 | #include <string.h> | 13 | #include <string.h> |
10 | 14 | ||
11 | #include "../../gsmcomon.h" | 15 | #include "../../gsmcomon.h" |
12 | #include "fbus2.h" | 16 | #include "fbus2.h" |
13 | 17 | ||
14 | static GSM_Error FBUS2_WriteFrame(GSM_StateMachine *s, | 18 | static GSM_Error FBUS2_WriteFrame(GSM_StateMachine *s, |
15 | unsigned char *MsgBuffer, | 19 | unsigned char *MsgBuffer, |
16 | int MsgLength, | 20 | int MsgLength, |
17 | unsigned char MsgType) | 21 | unsigned char MsgType) |
18 | { | 22 | { |
19 | unsigned char buffer2[FBUS2_MAX_TRANSMIT_LENGTH + 10]; | 23 | unsigned char buffer2[FBUS2_MAX_TRANSMIT_LENGTH + 10]; |
20 | unsigned char checksum=0; | 24 | unsigned char checksum=0; |
21 | int i, len, sent; | 25 | int i, len, sent; |
22 | 26 | ||
23 | buffer2[0] = FBUS2_FRAME_ID; | 27 | buffer2[0] = FBUS2_FRAME_ID; |
24 | if (s->ConnectionType==GCT_FBUS2IRDA) buffer2[0] = FBUS2_IRDA_FRAME_ID; | 28 | if (s->ConnectionType==GCT_FBUS2IRDA) buffer2[0] = FBUS2_IRDA_FRAME_ID; |
25 | 29 | ||
26 | buffer2[1] = FBUS2_DEVICE_PHONE; //destination | 30 | buffer2[1] = FBUS2_DEVICE_PHONE; //destination |
diff --git a/gammu/emb/common/protocol/nokia/fbus2.h b/gammu/emb/common/protocol/nokia/fbus2.h index 5dd45d7..8dbcb07 100644 --- a/gammu/emb/common/protocol/nokia/fbus2.h +++ b/gammu/emb/common/protocol/nokia/fbus2.h | |||
@@ -1,26 +1,30 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | /* based on some work from Gnokii and MyGnokii */ | 2 | /* based on some work from MyGnokii (www.mwiacek.com) */ |
3 | /* Based on some work from Gnokii (www.gnokii.org) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
3 | 7 | ||
4 | #ifndef fbus2_h | 8 | #ifndef fbus2_h |
5 | #define fbus2_h | 9 | #define fbus2_h |
6 | 10 | ||
7 | #include "../protocol.h" | 11 | #include "../protocol.h" |
8 | 12 | ||
9 | #define FBUS2_FRAME_ID 0x1e | 13 | #define FBUS2_FRAME_ID 0x1e |
10 | #define FBUS2_IRDA_FRAME_ID 0x1c | 14 | #define FBUS2_IRDA_FRAME_ID 0x1c |
11 | #define FBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */ | 15 | #define FBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */ |
12 | #define FBUS2_DEVICE_PC 0x0c /* Our PC */ | 16 | #define FBUS2_DEVICE_PC 0x0c /* Our PC */ |
13 | #define FBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */ | 17 | #define FBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */ |
14 | 18 | ||
15 | #define FBUS2_MAX_TRANSMIT_LENGTH 120 | 19 | #define FBUS2_MAX_TRANSMIT_LENGTH 120 |
16 | 20 | ||
17 | typedef struct { | 21 | typedef struct { |
18 | int MsgSequenceNumber; | 22 | int MsgSequenceNumber; |
19 | int MsgRXState; | 23 | int MsgRXState; |
20 | int FramesToGo; | 24 | int FramesToGo; |
21 | GSM_Protocol_MessageMultiMsg; | 25 | GSM_Protocol_MessageMultiMsg; |
22 | GSM_Protocol_MessageMsg; | 26 | GSM_Protocol_MessageMsg; |
23 | } GSM_Protocol_FBUS2Data; | 27 | } GSM_Protocol_FBUS2Data; |
24 | 28 | ||
25 | #ifndef GSM_USED_SERIALDEVICE | 29 | #ifndef GSM_USED_SERIALDEVICE |
26 | # define GSM_USED_SERIALDEVICE | 30 | # define GSM_USED_SERIALDEVICE |
diff --git a/gammu/emb/common/protocol/nokia/mbus2.c b/gammu/emb/common/protocol/nokia/mbus2.c index f07d6c5..8353b46 100644 --- a/gammu/emb/common/protocol/nokia/mbus2.c +++ b/gammu/emb/common/protocol/nokia/mbus2.c | |||
@@ -1,26 +1,26 @@ | |||
1 | /* (c) 2001-2003 by Marcin Wiacek */ | 1 | /* (c) 2001-2003 by Marcin Wiacek */ |
2 | /* based on some work from MyGnokii */ | 2 | /* based on some work from MyGnokii (www.mwiacek.com) */ |
3 | 3 | ||
4 | #include "../../gsmstate.h" | 4 | #include "../../gsmstate.h" |
5 | 5 | ||
6 | #ifdef GSM_ENABLE_MBUS2 | 6 | #ifdef GSM_ENABLE_MBUS2 |
7 | 7 | ||
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | #include <string.h> | 9 | #include <string.h> |
10 | 10 | ||
11 | #include "../../gsmcomon.h" | 11 | #include "../../gsmcomon.h" |
12 | #include "mbus2.h" | 12 | #include "mbus2.h" |
13 | 13 | ||
14 | static GSM_Error MBUS2_WriteMessage (GSM_StateMachine *s, | 14 | static GSM_Error MBUS2_WriteMessage (GSM_StateMachine *s, |
15 | unsigned char *MsgBuffer, | 15 | unsigned char *MsgBuffer, |
16 | int MsgLength, | 16 | int MsgLength, |
17 | unsigned char MsgType) | 17 | unsigned char MsgType) |
18 | { | 18 | { |
19 | unsigned char *buffer2, checksum = 0; | 19 | unsigned char *buffer2, checksum = 0; |
20 | GSM_Protocol_MBUS2Data *d = &s->Protocol.Data.MBUS2; | 20 | GSM_Protocol_MBUS2Data *d = &s->Protocol.Data.MBUS2; |
21 | int i, sent, len; | 21 | int i, sent, len; |
22 | 22 | ||
23 | GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType); | 23 | GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType); |
24 | 24 | ||
25 | buffer2 = (unsigned char *)malloc(MsgLength + 8); | 25 | buffer2 = (unsigned char *)malloc(MsgLength + 8); |
26 | 26 | ||
diff --git a/gammu/emb/common/protocol/nokia/mbus2.h b/gammu/emb/common/protocol/nokia/mbus2.h index 86fcab6..5dbd8cb 100644 --- a/gammu/emb/common/protocol/nokia/mbus2.h +++ b/gammu/emb/common/protocol/nokia/mbus2.h | |||
@@ -1,26 +1,26 @@ | |||
1 | /* (c) 2001-2003 by Marcin Wiacek */ | 1 | /* (c) 2001-2003 by Marcin Wiacek */ |
2 | /* based on some work from MyGnokii */ | 2 | /* based on some work from MyGnokii (www.mwiacek.com) */ |
3 | 3 | ||
4 | #ifndef mbus2_h | 4 | #ifndef mbus2_h |
5 | #define mbus2_h | 5 | #define mbus2_h |
6 | 6 | ||
7 | #include "../protocol.h" | 7 | #include "../protocol.h" |
8 | 8 | ||
9 | #define MBUS2_FRAME_ID 0x1f | 9 | #define MBUS2_FRAME_ID 0x1f |
10 | #define MBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */ | 10 | #define MBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */ |
11 | #define MBUS2_DEVICE_PC 0x10 /* Our PC (MBUS) */ | 11 | #define MBUS2_DEVICE_PC 0x10 /* Our PC (MBUS) */ |
12 | #define MBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */ | 12 | #define MBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */ |
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | int MsgSequenceNumber; | 15 | int MsgSequenceNumber; |
16 | int MsgRXState; | 16 | int MsgRXState; |
17 | GSM_Protocol_MessageMsg; | 17 | GSM_Protocol_MessageMsg; |
18 | } GSM_Protocol_MBUS2Data; | 18 | } GSM_Protocol_MBUS2Data; |
19 | 19 | ||
20 | #ifndef GSM_USED_SERIALDEVICE | 20 | #ifndef GSM_USED_SERIALDEVICE |
21 | # define GSM_USED_SERIALDEVICE | 21 | # define GSM_USED_SERIALDEVICE |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | /* How should editor hadle tabs in this file? Add editor commands here. | 26 | /* How should editor hadle tabs in this file? Add editor commands here. |
diff --git a/gammu/emb/common/protocol/nokia/phonet.c b/gammu/emb/common/protocol/nokia/phonet.c index bc5717d..db5bd72 100644 --- a/gammu/emb/common/protocol/nokia/phonet.c +++ b/gammu/emb/common/protocol/nokia/phonet.c | |||
@@ -1,26 +1,29 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | /* based on some work from Gnokii */ | 2 | /* Based on some work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #include "../../gsmstate.h" | 7 | #include "../../gsmstate.h" |
5 | 8 | ||
6 | #if defined(GSM_ENABLE_IRDA) || defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_BLUEPHONET) | 9 | #if defined(GSM_ENABLE_IRDA) || defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_BLUEPHONET) |
7 | 10 | ||
8 | #include <stdio.h> | 11 | #include <stdio.h> |
9 | #include <string.h> | 12 | #include <string.h> |
10 | 13 | ||
11 | #include "../../gsmcomon.h" | 14 | #include "../../gsmcomon.h" |
12 | #include "phonet.h" | 15 | #include "phonet.h" |
13 | 16 | ||
14 | static GSM_Error PHONET_WriteMessage (GSM_StateMachine *s, | 17 | static GSM_Error PHONET_WriteMessage (GSM_StateMachine *s, |
15 | unsigned char *MsgBuffer, | 18 | unsigned char *MsgBuffer, |
16 | int MsgLength, | 19 | int MsgLength, |
17 | unsigned char MsgType) | 20 | unsigned char MsgType) |
18 | { | 21 | { |
19 | unsigned char *buffer2; | 22 | unsigned char *buffer2; |
20 | int sent; | 23 | int sent; |
21 | 24 | ||
22 | GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType); | 25 | GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType); |
23 | 26 | ||
24 | buffer2 = (unsigned char *)malloc(MsgLength + 6); | 27 | buffer2 = (unsigned char *)malloc(MsgLength + 6); |
25 | 28 | ||
26 | buffer2[0] = PHONET_FRAME_ID, | 29 | buffer2[0] = PHONET_FRAME_ID, |
diff --git a/gammu/emb/common/protocol/nokia/phonet.h b/gammu/emb/common/protocol/nokia/phonet.h index 2f6e836..e750bbd 100644 --- a/gammu/emb/common/protocol/nokia/phonet.h +++ b/gammu/emb/common/protocol/nokia/phonet.h | |||
@@ -1,26 +1,29 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | /* based on some work from Gnokii */ | 2 | /* Based on some work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #ifndef PHONET_h | 7 | #ifndef PHONET_h |
5 | #define PHONET_h | 8 | #define PHONET_h |
6 | 9 | ||
7 | #include "../protocol.h" | 10 | #include "../protocol.h" |
8 | 11 | ||
9 | #define PHONET_FRAME_ID 0x14 | 12 | #define PHONET_FRAME_ID 0x14 |
10 | #define PHONET_BLUE_FRAME_ID0x19 | 13 | #define PHONET_BLUE_FRAME_ID0x19 |
11 | #define PHONET_DEVICE_PHONE 0x00 /* Nokia mobile phone */ | 14 | #define PHONET_DEVICE_PHONE 0x00 /* Nokia mobile phone */ |
12 | #define PHONET_DEVICE_PC 0x0c /* Our PC */ | 15 | #define PHONET_DEVICE_PC 0x0c /* Our PC */ |
13 | #define PHONET_BLUE_DEVICE_PC 0x10 /* Our PC */ | 16 | #define PHONET_BLUE_DEVICE_PC 0x10 /* Our PC */ |
14 | 17 | ||
15 | typedef struct { | 18 | typedef struct { |
16 | int MsgRXState; | 19 | int MsgRXState; |
17 | GSM_Protocol_MessageMsg; | 20 | GSM_Protocol_MessageMsg; |
18 | } GSM_Protocol_PHONETData; | 21 | } GSM_Protocol_PHONETData; |
19 | 22 | ||
20 | #if defined(GSM_ENABLE_IRDAPHONET) | 23 | #if defined(GSM_ENABLE_IRDAPHONET) |
21 | # ifndef GSM_USED_IRDADEVICE | 24 | # ifndef GSM_USED_IRDADEVICE |
22 | # define GSM_USED_IRDADEVICE | 25 | # define GSM_USED_IRDADEVICE |
23 | # endif | 26 | # endif |
24 | #endif | 27 | #endif |
25 | #if defined(GSM_ENABLE_BLUEPHONET) | 28 | #if defined(GSM_ENABLE_BLUEPHONET) |
26 | # ifndef GSM_USED_BLUETOOTHDEVICE | 29 | # ifndef GSM_USED_BLUETOOTHDEVICE |
diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h index 9d7d973..9a930fc 100644 --- a/gammu/emb/common/service/backup/backgen.h +++ b/gammu/emb/common/service/backup/backgen.h | |||
@@ -1,69 +1,73 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef __gsm_backgen_h | 3 | #ifndef __gsm_backgen_h |
4 | #define __gsm_backgen_h | 4 | #define __gsm_backgen_h |
5 | 5 | ||
6 | #include "../../config.h" | 6 | #include "../../config.h" |
7 | #include "../../misc/misc.h" | 7 | #include "../../misc/misc.h" |
8 | #include "../gsmpbk.h" | 8 | #include "../gsmpbk.h" |
9 | #include "../gsmcal.h" | 9 | #include "../gsmcal.h" |
10 | #include "../gsmlogo.h" | 10 | #include "../gsmlogo.h" |
11 | #include "../gsmring.h" | 11 | #include "../gsmring.h" |
12 | #include "../gsmdata.h" | 12 | #include "../gsmdata.h" |
13 | #include "../gsmprof.h" | 13 | #include "../gsmprof.h" |
14 | #include "../gsmmisc.h" | 14 | #include "../gsmmisc.h" |
15 | #include "../sms/gsmsms.h" | 15 | #include "../sms/gsmsms.h" |
16 | 16 | ||
17 | #define GSM_BACKUP_MAX_PHONEPHONEBOOK 501 | 17 | #define GSM_BACKUP_MAX_PHONEPHONEBOOK 501 |
18 | #define GSM_BACKUP_MAX_SIMPHONEBOOK 251 | 18 | #define GSM_BACKUP_MAX_SIMPHONEBOOK 251 |
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 | ||
25 | #define GSM_BACKUP_MAX_CHATSETTINGS10 | ||
24 | #define GSM_BACKUP_MAX_RINGTONES30 | 26 | #define GSM_BACKUP_MAX_RINGTONES30 |
25 | #define GSM_BACKUP_MAX_PROFILES 10 | 27 | #define GSM_BACKUP_MAX_PROFILES 10 |
26 | #define GSM_BACKUP_MAX_FMSTATIONS20 | 28 | #define GSM_BACKUP_MAX_FMSTATIONS20 |
27 | #define GSM_BACKUP_MAX_GPRSPOINT10 | 29 | #define GSM_BACKUP_MAX_GPRSPOINT10 |
28 | #define GSM_BACKUP_MAX_NOTE 10/* FIXME */ | 30 | #define GSM_BACKUP_MAX_NOTE 10/* FIXME */ |
29 | 31 | ||
30 | typedef struct { | 32 | typedef struct { |
31 | char IMEI [MAX_IMEI_LENGTH]; | 33 | char IMEI [MAX_IMEI_LENGTH]; |
32 | char Model [MAX_MODEL_LENGTH+MAX_VERSION_LENGTH]; | 34 | char Model [MAX_MODEL_LENGTH+MAX_VERSION_LENGTH]; |
33 | char Creator [80]; | 35 | char Creator [80]; |
34 | GSM_DateTime DateTime; | 36 | GSM_DateTime DateTime; |
35 | bool DateTimeAvailable; | 37 | bool DateTimeAvailable; |
36 | char MD5Original[100]; | 38 | char MD5Original[100]; |
37 | char MD5Calculated[100]; | 39 | char MD5Calculated[100]; |
38 | GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1]; | 40 | GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1]; |
39 | GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1]; | 41 | GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1]; |
40 | GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1]; | 42 | GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1]; |
41 | GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; | 43 | GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; |
42 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; | 44 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; |
43 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; | 45 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; |
44 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; | 46 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; |
45 | 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]; | ||
49 | GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; | ||
46 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; | 50 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; |
47 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; | 51 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; |
48 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; | 52 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; |
49 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; | 53 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; |
50 | GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; | 54 | GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; |
51 | GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; | 55 | GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; |
52 | GSM_Bitmap *StartupLogo; | 56 | GSM_Bitmap *StartupLogo; |
53 | GSM_Bitmap *OperatorLogo; | 57 | GSM_Bitmap *OperatorLogo; |
54 | } GSM_Backup; | 58 | } GSM_Backup; |
55 | 59 | ||
56 | #define GSM_BACKUP_MAX_SMS500 | 60 | #define GSM_BACKUP_MAX_SMS500 |
57 | 61 | ||
58 | typedef struct { | 62 | typedef struct { |
59 | GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; | 63 | GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; |
60 | } GSM_SMS_Backup; | 64 | } GSM_SMS_Backup; |
61 | 65 | ||
62 | extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); | 66 | extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); |
63 | extern GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); | 67 | extern GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); |
64 | 68 | ||
65 | #endif | 69 | #endif |
66 | 70 | ||
67 | /* 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. |
68 | * vim: noexpandtab sw=8 ts=8 sts=8: | 72 | * vim: noexpandtab sw=8 ts=8 sts=8: |
69 | */ | 73 | */ |
diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c index fee0f73..4cb1bb7 100644 --- a/gammu/emb/common/service/backup/backtext.c +++ b/gammu/emb/common/service/backup/backtext.c | |||
@@ -130,95 +130,96 @@ static void ReadLinkedBackupText(INI_Section *file_info, char *section, char *my | |||
130 | readvalue = ReadCFGText(file_info, section, buffer2, UseUnicode); | 130 | readvalue = ReadCFGText(file_info, section, buffer2, UseUnicode); |
131 | if (readvalue!=NULL) { | 131 | if (readvalue!=NULL) { |
132 | myvalue[strlen(myvalue)+strlen(readvalue)]=0; | 132 | myvalue[strlen(myvalue)+strlen(readvalue)]=0; |
133 | memcpy(myvalue+strlen(myvalue),readvalue,strlen(readvalue)); | 133 | memcpy(myvalue+strlen(myvalue),readvalue,strlen(readvalue)); |
134 | } else break; | 134 | } else break; |
135 | i++; | 135 | i++; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | static void SaveBackupText(FILE *file, char *myname, char *myvalue, bool UseUnicode) | 139 | static void SaveBackupText(FILE *file, char *myname, char *myvalue, bool UseUnicode) |
140 | { | 140 | { |
141 | unsigned char buffer[10000], buffer2[10000]; | 141 | unsigned char buffer[10000], buffer2[10000]; |
142 | 142 | ||
143 | if (myname[0] == 0x00) { | 143 | if (myname[0] == 0x00) { |
144 | if (UseUnicode) { | 144 | if (UseUnicode) { |
145 | EncodeUnicode(buffer,myvalue,strlen(myvalue)); | 145 | EncodeUnicode(buffer,myvalue,strlen(myvalue)); |
146 | fwrite(buffer,1,strlen(myvalue)*2,file); | 146 | fwrite(buffer,1,strlen(myvalue)*2,file); |
147 | } else fprintf(file,"%s",myvalue); | 147 | } else fprintf(file,"%s",myvalue); |
148 | } else { | 148 | } else { |
149 | if (UseUnicode) { | 149 | if (UseUnicode) { |
150 | sprintf(buffer,"%s = \"",myname); | 150 | sprintf(buffer,"%s = \"",myname); |
151 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 151 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
152 | fwrite(buffer2,1,strlen(buffer)*2,file); | 152 | fwrite(buffer2,1,strlen(buffer)*2,file); |
153 | 153 | ||
154 | fwrite(myvalue,1,UnicodeLength(myvalue)*2,file); | 154 | fwrite(EncodeUnicodeSpecialChars(myvalue),1,UnicodeLength(EncodeUnicodeSpecialChars(myvalue))*2,file); |
155 | 155 | ||
156 | sprintf(buffer,"\"%c%c",13,10); | 156 | sprintf(buffer,"\"%c%c",13,10); |
157 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 157 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
158 | fwrite(buffer2,1,strlen(buffer)*2,file); | 158 | fwrite(buffer2,1,strlen(buffer)*2,file); |
159 | } else { | 159 | } else { |
160 | sprintf(buffer,"%s = \"%s\"%c%c",myname,DecodeUnicodeString(myvalue),13,10); | 160 | sprintf(buffer,"%s = \"%s\"%c%c",myname,EncodeSpecialChars(DecodeUnicodeString(myvalue)),13,10); |
161 | fprintf(file,"%s",buffer); | 161 | fprintf(file,"%s",buffer); |
162 | 162 | ||
163 | EncodeHexBin(buffer,myvalue,UnicodeLength(myvalue)*2); | 163 | EncodeHexBin(buffer,myvalue,UnicodeLength(myvalue)*2); |
164 | fprintf(file,"%sUnicode = %s%c%c",myname,buffer,13,10); | 164 | fprintf(file,"%sUnicode = %s%c%c",myname,buffer,13,10); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, char *myvalue, bool UseUnicode) | 169 | static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, char *myvalue, bool UseUnicode) |
170 | { | 170 | { |
171 | unsigned char paramname[10000],*readvalue; | 171 | unsigned char paramname[10000],*readvalue; |
172 | 172 | ||
173 | if (UseUnicode) { | 173 | if (UseUnicode) { |
174 | EncodeUnicode(paramname,myname,strlen(myname)); | 174 | EncodeUnicode(paramname,myname,strlen(myname)); |
175 | readvalue = INI_GetValue(file_info, section, paramname, UseUnicode); | 175 | readvalue = INI_GetValue(file_info, section, paramname, UseUnicode); |
176 | if (readvalue!=NULL) { | 176 | if (readvalue!=NULL) { |
177 | CopyUnicodeString(myvalue,readvalue+2); | 177 | CopyUnicodeString(myvalue,DecodeUnicodeSpecialChars(readvalue+2)); |
178 | myvalue[UnicodeLength(readvalue)*2-4]=0; | 178 | myvalue[UnicodeLength(myvalue)*2-2]=0; |
179 | myvalue[UnicodeLength(readvalue)*2-3]=0; | 179 | myvalue[UnicodeLength(myvalue)*2-1]=0; |
180 | |||
180 | dbgprintf("%s\n",DecodeUnicodeString(readvalue)); | 181 | dbgprintf("%s\n",DecodeUnicodeString(readvalue)); |
181 | } else { | 182 | } else { |
182 | myvalue[0]=0; | 183 | myvalue[0]=0; |
183 | myvalue[1]=0; | 184 | myvalue[1]=0; |
184 | return false; | 185 | return false; |
185 | } | 186 | } |
186 | } else { | 187 | } else { |
187 | strcpy(paramname,myname); | 188 | strcpy(paramname,myname); |
188 | strcat(paramname,"Unicode"); | 189 | strcat(paramname,"Unicode"); |
189 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); | 190 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); |
190 | if (readvalue!=NULL) { | 191 | if (readvalue!=NULL) { |
191 | dbgprintf("%s %i\n",readvalue,strlen(readvalue)); | 192 | dbgprintf("%s %i\n",readvalue,strlen(readvalue)); |
192 | DecodeHexBin (myvalue, readvalue, strlen(readvalue)); | 193 | DecodeHexBin (myvalue, readvalue, strlen(readvalue)); |
193 | myvalue[strlen(readvalue)/2]=0; | 194 | myvalue[strlen(readvalue)/2]=0; |
194 | myvalue[strlen(readvalue)/2+1]=0; | 195 | myvalue[strlen(readvalue)/2+1]=0; |
195 | dbgprintf("%s\n",DecodeUnicodeString(myvalue)); | 196 | dbgprintf("%s\n",DecodeUnicodeString(myvalue)); |
196 | } else { | 197 | } else { |
197 | strcpy(paramname,myname); | 198 | strcpy(paramname,myname); |
198 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); | 199 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); |
199 | if (readvalue!=NULL) { | 200 | if (readvalue!=NULL) { |
200 | EncodeUnicode(myvalue,readvalue+1,strlen(readvalue)-2); | 201 | EncodeUnicode(myvalue,DecodeSpecialChars(readvalue+1),strlen(DecodeSpecialChars(readvalue+1))-1); |
201 | } else { | 202 | } else { |
202 | myvalue[0]=0; | 203 | myvalue[0]=0; |
203 | myvalue[1]=0; | 204 | myvalue[1]=0; |
204 | return false; | 205 | return false; |
205 | } | 206 | } |
206 | } | 207 | } |
207 | } | 208 | } |
208 | return true; | 209 | return true; |
209 | } | 210 | } |
210 | 211 | ||
211 | static void SaveVCalDateTime(FILE *file, GSM_DateTime *dt, bool UseUnicode) | 212 | static void SaveVCalDateTime(FILE *file, GSM_DateTime *dt, bool UseUnicode) |
212 | { | 213 | { |
213 | unsigned char buffer[100]; | 214 | unsigned char buffer[100]; |
214 | int Length = 3; | 215 | int Length = 3; |
215 | 216 | ||
216 | sprintf(buffer, " = "); | 217 | sprintf(buffer, " = "); |
217 | SaveVCALDateTime(buffer, &Length, dt, NULL); | 218 | SaveVCALDateTime(buffer, &Length, dt, NULL); |
218 | SaveBackupText(file, "", buffer, UseUnicode); | 219 | SaveBackupText(file, "", buffer, UseUnicode); |
219 | } | 220 | } |
220 | 221 | ||
221 | static void SaveVCalDate(FILE *file, GSM_DateTime *dt, bool UseUnicode) | 222 | static void SaveVCalDate(FILE *file, GSM_DateTime *dt, bool UseUnicode) |
222 | { | 223 | { |
223 | unsigned char buffer[100]; | 224 | unsigned char buffer[100]; |
224 | 225 | ||
@@ -397,48 +398,59 @@ static void SavePbkEntry(FILE *file, GSM_MemoryEntry *Pbk, bool UseUnicode) | |||
397 | case PBK_Number_Work: | 398 | case PBK_Number_Work: |
398 | case PBK_Number_Fax: | 399 | case PBK_Number_Fax: |
399 | case PBK_Number_Home: | 400 | case PBK_Number_Home: |
400 | case PBK_Number_Other: | 401 | case PBK_Number_Other: |
401 | case PBK_Number_Pager: | 402 | case PBK_Number_Pager: |
402 | if (Pbk->Entries[j].VoiceTag!=0) { | 403 | if (Pbk->Entries[j].VoiceTag!=0) { |
403 | sprintf(buffer,"Entry%02iVoiceTag = %i%c%c",j,Pbk->Entries[j].VoiceTag,13,10); | 404 | sprintf(buffer,"Entry%02iVoiceTag = %i%c%c",j,Pbk->Entries[j].VoiceTag,13,10); |
404 | SaveBackupText(file, "", buffer, UseUnicode); | 405 | SaveBackupText(file, "", buffer, UseUnicode); |
405 | } | 406 | } |
406 | i = 0; | 407 | i = 0; |
407 | while (Pbk->Entries[j].SMSList[i]!=0) { | 408 | while (Pbk->Entries[j].SMSList[i]!=0) { |
408 | sprintf(buffer,"Entry%02iSMSList%02i = %i%c%c",j,i,Pbk->Entries[j].SMSList[i],13,10); | 409 | sprintf(buffer,"Entry%02iSMSList%02i = %i%c%c",j,i,Pbk->Entries[j].SMSList[i],13,10); |
409 | SaveBackupText(file, "", buffer, UseUnicode); | 410 | SaveBackupText(file, "", buffer, UseUnicode); |
410 | i++; | 411 | i++; |
411 | } | 412 | } |
412 | break; | 413 | break; |
413 | default: | 414 | default: |
414 | break; | 415 | break; |
415 | } | 416 | } |
416 | } | 417 | } |
417 | sprintf(buffer,"%c%c",13,10); | 418 | sprintf(buffer,"%c%c",13,10); |
418 | SaveBackupText(file, "", buffer, UseUnicode); | 419 | SaveBackupText(file, "", buffer, UseUnicode); |
419 | } | 420 | } |
420 | 421 | ||
422 | static void SaveNoteEntry(FILE *file, GSM_NoteEntry *Note, bool UseUnicode) | ||
423 | { | ||
424 | char buffer[1000]; | ||
425 | |||
426 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); | ||
427 | SaveBackupText(file, "", buffer, UseUnicode); | ||
428 | SaveBackupText(file, "Text", Note->Text, UseUnicode); | ||
429 | sprintf(buffer, "%c%c",13,10); | ||
430 | SaveBackupText(file, "", buffer, UseUnicode); | ||
431 | } | ||
432 | |||
421 | static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) | 433 | static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) |
422 | { | 434 | { |
423 | int i; | 435 | int i; |
424 | charbuffer[1000]; | 436 | charbuffer[1000]; |
425 | 437 | ||
426 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); | 438 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); |
427 | SaveBackupText(file, "", buffer, UseUnicode); | 439 | SaveBackupText(file, "", buffer, UseUnicode); |
428 | SaveBackupText(file, "", "Type = ", UseUnicode); | 440 | SaveBackupText(file, "", "Type = ", UseUnicode); |
429 | switch (Note->Type) { | 441 | switch (Note->Type) { |
430 | case GSM_CAL_REMINDER : sprintf(buffer,"Reminder%c%c", 13,10); break; | 442 | case GSM_CAL_REMINDER : sprintf(buffer,"Reminder%c%c", 13,10); break; |
431 | case GSM_CAL_CALL : sprintf(buffer,"Call%c%c", 13,10); break; | 443 | case GSM_CAL_CALL : sprintf(buffer,"Call%c%c", 13,10); break; |
432 | case GSM_CAL_MEETING : sprintf(buffer,"Meeting%c%c", 13,10); break; | 444 | case GSM_CAL_MEETING : sprintf(buffer,"Meeting%c%c", 13,10); break; |
433 | case GSM_CAL_BIRTHDAY : sprintf(buffer,"Birthday%c%c", 13,10); break; | 445 | case GSM_CAL_BIRTHDAY : sprintf(buffer,"Birthday%c%c", 13,10); break; |
434 | case GSM_CAL_TRAVEL : sprintf(buffer,"Travel%c%c", 13,10); break; | 446 | case GSM_CAL_TRAVEL : sprintf(buffer,"Travel%c%c", 13,10); break; |
435 | case GSM_CAL_VACATION : sprintf(buffer,"Vacation%c%c", 13,10); break; | 447 | case GSM_CAL_VACATION : sprintf(buffer,"Vacation%c%c", 13,10); break; |
436 | case GSM_CAL_MEMO : sprintf(buffer,"Memo%c%c", 13,10); break; | 448 | case GSM_CAL_MEMO : sprintf(buffer,"Memo%c%c", 13,10); break; |
437 | case GSM_CAL_ALARM : sprintf(buffer,"Alarm%c%c", 13,10); break; | 449 | case GSM_CAL_ALARM : sprintf(buffer,"Alarm%c%c", 13,10); break; |
438 | case GSM_CAL_DAILY_ALARM : sprintf(buffer,"DailyAlarm%c%c", 13,10); break; | 450 | case GSM_CAL_DAILY_ALARM : sprintf(buffer,"DailyAlarm%c%c", 13,10); break; |
439 | case GSM_CAL_T_ATHL : sprintf(buffer,"Training/Athletism%c%c", 13,10); break; | 451 | case GSM_CAL_T_ATHL : sprintf(buffer,"Training/Athletism%c%c", 13,10); break; |
440 | case GSM_CAL_T_BALL : sprintf(buffer,"Training/BallGames%c%c", 13,10); break; | 452 | case GSM_CAL_T_BALL : sprintf(buffer,"Training/BallGames%c%c", 13,10); break; |
441 | case GSM_CAL_T_CYCL : sprintf(buffer,"Training/Cycling%c%c", 13,10); break; | 453 | case GSM_CAL_T_CYCL : sprintf(buffer,"Training/Cycling%c%c", 13,10); break; |
442 | case GSM_CAL_T_BUDO : sprintf(buffer,"Training/Budo%c%c", 13,10); break; | 454 | case GSM_CAL_T_BUDO : sprintf(buffer,"Training/Budo%c%c", 13,10); break; |
443 | case GSM_CAL_T_DANC : sprintf(buffer,"Training/Dance%c%c", 13,10); break; | 455 | case GSM_CAL_T_DANC : sprintf(buffer,"Training/Dance%c%c", 13,10); break; |
444 | case GSM_CAL_T_EXTR : sprintf(buffer,"Training/ExtremeSports%c%c", 13,10); break; | 456 | case GSM_CAL_T_EXTR : sprintf(buffer,"Training/ExtremeSports%c%c", 13,10); break; |
@@ -636,48 +648,90 @@ static void SaveWAPSettingsEntry(FILE *file, GSM_MultiWAPSettings *settings, boo | |||
636 | break; | 648 | break; |
637 | } | 649 | } |
638 | sprintf(buffer,"User%02i",i); | 650 | sprintf(buffer,"User%02i",i); |
639 | SaveBackupText(file, buffer, settings->Settings[i].User, UseUnicode); | 651 | SaveBackupText(file, buffer, settings->Settings[i].User, UseUnicode); |
640 | sprintf(buffer,"Password%02i",i); | 652 | sprintf(buffer,"Password%02i",i); |
641 | SaveBackupText(file, buffer, settings->Settings[i].Password, UseUnicode); | 653 | SaveBackupText(file, buffer, settings->Settings[i].Password, UseUnicode); |
642 | break; | 654 | break; |
643 | case WAPSETTINGS_BEARER_USSD: | 655 | case WAPSETTINGS_BEARER_USSD: |
644 | sprintf(buffer,"Bearer%02i = USSD%c%c",i,13,10); | 656 | sprintf(buffer,"Bearer%02i = USSD%c%c",i,13,10); |
645 | SaveBackupText(file, "", buffer, UseUnicode); | 657 | SaveBackupText(file, "", buffer, UseUnicode); |
646 | sprintf(buffer,"ServiceCode%02i",i); | 658 | sprintf(buffer,"ServiceCode%02i",i); |
647 | SaveBackupText(file, buffer, settings->Settings[i].Code, UseUnicode); | 659 | SaveBackupText(file, buffer, settings->Settings[i].Code, UseUnicode); |
648 | if (settings->Settings[i].IsIP) { | 660 | if (settings->Settings[i].IsIP) { |
649 | sprintf(buffer,"IP%02i",i); | 661 | sprintf(buffer,"IP%02i",i); |
650 | } else { | 662 | } else { |
651 | sprintf(buffer,"Number%02i",i); | 663 | sprintf(buffer,"Number%02i",i); |
652 | } | 664 | } |
653 | SaveBackupText(file, buffer, settings->Settings[i].Service, UseUnicode); | 665 | SaveBackupText(file, buffer, settings->Settings[i].Service, UseUnicode); |
654 | } | 666 | } |
655 | sprintf(buffer,"%c%c",13,10); | 667 | sprintf(buffer,"%c%c",13,10); |
656 | SaveBackupText(file, "", buffer, UseUnicode); | 668 | SaveBackupText(file, "", buffer, UseUnicode); |
657 | } | 669 | } |
658 | } | 670 | } |
659 | 671 | ||
672 | static void SaveChatSettingsEntry(FILE *file, GSM_ChatSettings *settings, bool UseUnicode) | ||
673 | { | ||
674 | char buffer[10000]; | ||
675 | |||
676 | sprintf(buffer,"HomePage"); | ||
677 | SaveBackupText(file, buffer, settings->HomePage, UseUnicode); | ||
678 | sprintf(buffer,"User"); | ||
679 | SaveBackupText(file, buffer, settings->User, UseUnicode); | ||
680 | sprintf(buffer,"Password"); | ||
681 | SaveBackupText(file, buffer, settings->Password, UseUnicode); | ||
682 | SaveWAPSettingsEntry(file, &settings->Connection, UseUnicode); | ||
683 | } | ||
684 | |||
685 | static void SaveSyncMLSettingsEntry(FILE *file, GSM_SyncMLSettings *settings, bool UseUnicode) | ||
686 | { | ||
687 | char buffer[10000]; | ||
688 | |||
689 | sprintf(buffer,"User"); | ||
690 | SaveBackupText(file, buffer, settings->User, UseUnicode); | ||
691 | sprintf(buffer,"Password"); | ||
692 | SaveBackupText(file, buffer, settings->Password, UseUnicode); | ||
693 | sprintf(buffer,"PhonebookDB"); | ||
694 | SaveBackupText(file, buffer, settings->PhonebookDataBase, UseUnicode); | ||
695 | sprintf(buffer,"CalendarDB"); | ||
696 | SaveBackupText(file, buffer, settings->CalendarDataBase, UseUnicode); | ||
697 | sprintf(buffer,"Server"); | ||
698 | SaveBackupText(file, buffer, settings->Server, UseUnicode); | ||
699 | if (settings->SyncPhonebook) { | ||
700 | sprintf(buffer,"SyncPhonebook = True%c%c",13,10); | ||
701 | } else { | ||
702 | sprintf(buffer,"SyncPhonebook = False%c%c",13,10); | ||
703 | } | ||
704 | SaveBackupText(file, "", buffer, UseUnicode); | ||
705 | if (settings->SyncCalendar) { | ||
706 | sprintf(buffer,"SyncCalendar = True%c%c",13,10); | ||
707 | } else { | ||
708 | sprintf(buffer,"SyncCalendar = False%c%c",13,10); | ||
709 | } | ||
710 | SaveBackupText(file, "", buffer, UseUnicode); | ||
711 | SaveWAPSettingsEntry(file, &settings->Connection, UseUnicode); | ||
712 | } | ||
713 | |||
660 | static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) | 714 | static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) |
661 | { | 715 | { |
662 | unsigned char buffer[10000],buffer2[10000]; | 716 | unsigned char buffer[10000],buffer2[10000]; |
663 | int x,y; | 717 | int x,y; |
664 | 718 | ||
665 | sprintf(buffer,"Width = %i%c%c",bitmap->BitmapWidth,13,10); | 719 | sprintf(buffer,"Width = %i%c%c",bitmap->BitmapWidth,13,10); |
666 | SaveBackupText(file, "", buffer, UseUnicode); | 720 | SaveBackupText(file, "", buffer, UseUnicode); |
667 | sprintf(buffer,"Height = %i%c%c",bitmap->BitmapHeight,13,10); | 721 | sprintf(buffer,"Height = %i%c%c",bitmap->BitmapHeight,13,10); |
668 | SaveBackupText(file, "", buffer, UseUnicode); | 722 | SaveBackupText(file, "", buffer, UseUnicode); |
669 | for (y=0;y<bitmap->BitmapHeight;y++) { | 723 | for (y=0;y<bitmap->BitmapHeight;y++) { |
670 | for (x=0;x<bitmap->BitmapWidth;x++) { | 724 | for (x=0;x<bitmap->BitmapWidth;x++) { |
671 | buffer[x] = ' '; | 725 | buffer[x] = ' '; |
672 | if (GSM_IsPointBitmap(bitmap,x,y)) buffer[x]='#'; | 726 | if (GSM_IsPointBitmap(bitmap,x,y)) buffer[x]='#'; |
673 | } | 727 | } |
674 | buffer[bitmap->BitmapWidth] = 0; | 728 | buffer[bitmap->BitmapWidth] = 0; |
675 | sprintf(buffer2,"Bitmap%02i = \"%s\"%c%c",y,buffer,13,10); | 729 | sprintf(buffer2,"Bitmap%02i = \"%s\"%c%c",y,buffer,13,10); |
676 | SaveBackupText(file, "", buffer2, UseUnicode); | 730 | SaveBackupText(file, "", buffer2, UseUnicode); |
677 | } | 731 | } |
678 | } | 732 | } |
679 | 733 | ||
680 | static void SaveCallerEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) | 734 | static void SaveCallerEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) |
681 | { | 735 | { |
682 | unsigned char buffer[1000]; | 736 | unsigned char buffer[1000]; |
683 | 737 | ||
@@ -744,64 +798,65 @@ static void SaveSMSCEntry(FILE *file, GSM_SMSC *SMSC, bool UseUnicode) | |||
744 | case SMS_FORMAT_Fax: sprintf(buffer,"Fax"); break; | 798 | case SMS_FORMAT_Fax: sprintf(buffer,"Fax"); break; |
745 | case SMS_FORMAT_Email: sprintf(buffer,"Email"); break; | 799 | case SMS_FORMAT_Email: sprintf(buffer,"Email"); break; |
746 | case SMS_FORMAT_Pager: sprintf(buffer,"Pager"); break; | 800 | case SMS_FORMAT_Pager: sprintf(buffer,"Pager"); break; |
747 | } | 801 | } |
748 | SaveBackupText(file, "", buffer, UseUnicode); | 802 | SaveBackupText(file, "", buffer, UseUnicode); |
749 | sprintf(buffer,"%c%cValidity = ",13,10); | 803 | sprintf(buffer,"%c%cValidity = ",13,10); |
750 | SaveBackupText(file, "", buffer, UseUnicode); | 804 | SaveBackupText(file, "", buffer, UseUnicode); |
751 | switch (SMSC->Validity.Relative) { | 805 | switch (SMSC->Validity.Relative) { |
752 | case SMS_VALID_1_Hour : sprintf(buffer, "1hour"); break; | 806 | case SMS_VALID_1_Hour : sprintf(buffer, "1hour"); break; |
753 | case SMS_VALID_6_Hours : sprintf(buffer, "6hours"); break; | 807 | case SMS_VALID_6_Hours : sprintf(buffer, "6hours"); break; |
754 | case SMS_VALID_1_Day : sprintf(buffer, "24hours"); break; | 808 | case SMS_VALID_1_Day : sprintf(buffer, "24hours"); break; |
755 | case SMS_VALID_3_Days : sprintf(buffer, "72hours"); break; | 809 | case SMS_VALID_3_Days : sprintf(buffer, "72hours"); break; |
756 | case SMS_VALID_1_Week : sprintf(buffer, "1week"); break; | 810 | case SMS_VALID_1_Week : sprintf(buffer, "1week"); break; |
757 | case SMS_VALID_Max_Time: | 811 | case SMS_VALID_Max_Time: |
758 | default : sprintf(buffer,"MaximumTime"); break; | 812 | default : sprintf(buffer,"MaximumTime"); break; |
759 | } | 813 | } |
760 | SaveBackupText(file, "", buffer, UseUnicode); | 814 | SaveBackupText(file, "", buffer, UseUnicode); |
761 | sprintf(buffer,"%c%c%c%c",13,10,13,10); | 815 | sprintf(buffer,"%c%c%c%c",13,10,13,10); |
762 | SaveBackupText(file, "", buffer, UseUnicode); | 816 | SaveBackupText(file, "", buffer, UseUnicode); |
763 | } | 817 | } |
764 | 818 | ||
765 | static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) | 819 | static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) |
766 | { | 820 | { |
767 | unsigned char buffer[45000]; | 821 | unsigned char buffer[45000]; |
768 | int i,j; | ||
769 | 822 | ||
770 | sprintf(buffer,"Location = %i%c%c",ringtone->Location,13,10); | 823 | sprintf(buffer,"Location = %i%c%c",ringtone->Location,13,10); |
771 | SaveBackupText(file, "", buffer, UseUnicode); | 824 | SaveBackupText(file, "", buffer, UseUnicode); |
772 | SaveBackupText(file, "Name", ringtone->Name, UseUnicode); | 825 | SaveBackupText(file, "Name", ringtone->Name, UseUnicode); |
773 | switch (ringtone->Format) { | 826 | switch (ringtone->Format) { |
774 | case RING_NOKIABINARY: | 827 | case RING_NOKIABINARY: |
775 | j = 0; i = 0; | ||
776 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | 828 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); |
777 | SaveLinkedBackupText(file, "NokiaBinary", buffer, UseUnicode); | 829 | SaveLinkedBackupText(file, "NokiaBinary", buffer, UseUnicode); |
778 | break; | 830 | break; |
779 | case RING_MIDI: | 831 | case RING_MIDI: |
780 | j = 0; i = 0; | ||
781 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | 832 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); |
782 | SaveLinkedBackupText(file, "Pure Midi", buffer, UseUnicode); | 833 | SaveLinkedBackupText(file, "Pure Midi", buffer, UseUnicode); |
783 | break; | 834 | break; |
835 | case RING_MMF: | ||
836 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | ||
837 | SaveLinkedBackupText(file, "SMAF", buffer, UseUnicode); | ||
838 | break; | ||
784 | case RING_NOTETONE: | 839 | case RING_NOTETONE: |
785 | break; | 840 | break; |
786 | } | 841 | } |
787 | sprintf(buffer,"%c%c",13,10); | 842 | sprintf(buffer,"%c%c",13,10); |
788 | SaveBackupText(file, "", buffer, UseUnicode); | 843 | SaveBackupText(file, "", buffer, UseUnicode); |
789 | } | 844 | } |
790 | 845 | ||
791 | static void SaveOperatorEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) | 846 | static void SaveOperatorEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) |
792 | { | 847 | { |
793 | unsigned char buffer[1000]; | 848 | unsigned char buffer[1000]; |
794 | 849 | ||
795 | sprintf(buffer,"[Operator]%c%c",13,10); | 850 | sprintf(buffer,"[Operator]%c%c",13,10); |
796 | SaveBackupText(file, "", buffer, UseUnicode); | 851 | SaveBackupText(file, "", buffer, UseUnicode); |
797 | sprintf(buffer,"Network = \"%s\"%c%c", bitmap->NetworkCode,13,10); | 852 | sprintf(buffer,"Network = \"%s\"%c%c", bitmap->NetworkCode,13,10); |
798 | SaveBackupText(file, "", buffer, UseUnicode); | 853 | SaveBackupText(file, "", buffer, UseUnicode); |
799 | SaveBitmapEntry(file, bitmap, UseUnicode); | 854 | SaveBitmapEntry(file, bitmap, UseUnicode); |
800 | sprintf(buffer,"%c%c",13,10); | 855 | sprintf(buffer,"%c%c",13,10); |
801 | SaveBackupText(file, "", buffer, UseUnicode); | 856 | SaveBackupText(file, "", buffer, UseUnicode); |
802 | } | 857 | } |
803 | 858 | ||
804 | static void SaveToDoEntry(FILE *file, GSM_ToDoEntry *ToDo, bool UseUnicode) | 859 | static void SaveToDoEntry(FILE *file, GSM_ToDoEntry *ToDo, bool UseUnicode) |
805 | { | 860 | { |
806 | unsigned char buffer[1000]; | 861 | unsigned char buffer[1000]; |
807 | int j; | 862 | int j; |
@@ -1054,83 +1109,104 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
1054 | SaveBackupText(file, "", buffer, UseUnicode); | 1109 | SaveBackupText(file, "", buffer, UseUnicode); |
1055 | 1110 | ||
1056 | i=0; | 1111 | i=0; |
1057 | while (backup->PhonePhonebook[i]!=NULL) { | 1112 | while (backup->PhonePhonebook[i]!=NULL) { |
1058 | sprintf(buffer,"[PhonePBK%03i]%c%c",i+1,13,10); | 1113 | sprintf(buffer,"[PhonePBK%03i]%c%c",i+1,13,10); |
1059 | SaveBackupText(file, "", buffer, UseUnicode); | 1114 | SaveBackupText(file, "", buffer, UseUnicode); |
1060 | SavePbkEntry(file, backup->PhonePhonebook[i], UseUnicode); | 1115 | SavePbkEntry(file, backup->PhonePhonebook[i], UseUnicode); |
1061 | i++; | 1116 | i++; |
1062 | } | 1117 | } |
1063 | i=0; | 1118 | i=0; |
1064 | while (backup->SIMPhonebook[i]!=NULL) { | 1119 | while (backup->SIMPhonebook[i]!=NULL) { |
1065 | sprintf(buffer,"[SIMPBK%03i]%c%c",i+1,13,10); | 1120 | sprintf(buffer,"[SIMPBK%03i]%c%c",i+1,13,10); |
1066 | SaveBackupText(file, "", buffer, UseUnicode); | 1121 | SaveBackupText(file, "", buffer, UseUnicode); |
1067 | SavePbkEntry(file, backup->SIMPhonebook[i], UseUnicode); | 1122 | SavePbkEntry(file, backup->SIMPhonebook[i], UseUnicode); |
1068 | i++; | 1123 | i++; |
1069 | } | 1124 | } |
1070 | i=0; | 1125 | i=0; |
1071 | while (backup->Calendar[i]!=NULL) { | 1126 | while (backup->Calendar[i]!=NULL) { |
1072 | sprintf(buffer,"[Calendar%03i]%c%c",i+1,13,10); | 1127 | sprintf(buffer,"[Calendar%03i]%c%c",i+1,13,10); |
1073 | SaveBackupText(file, "", buffer, UseUnicode); | 1128 | SaveBackupText(file, "", buffer, UseUnicode); |
1074 | SaveCalendarEntry(file, backup->Calendar[i], UseUnicode); | 1129 | SaveCalendarEntry(file, backup->Calendar[i], UseUnicode); |
1075 | i++; | 1130 | i++; |
1076 | } | 1131 | } |
1077 | i=0; | 1132 | i=0; |
1133 | while (backup->Note[i]!=NULL) { | ||
1134 | sprintf(buffer,"[Note%03i]%c%c",i+1,13,10); | ||
1135 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1136 | SaveNoteEntry(file, backup->Note[i], UseUnicode); | ||
1137 | i++; | ||
1138 | } | ||
1139 | i=0; | ||
1078 | while (backup->CallerLogos[i]!=NULL) { | 1140 | while (backup->CallerLogos[i]!=NULL) { |
1079 | sprintf(buffer,"[Caller%03i]%c%c",i+1,13,10); | 1141 | sprintf(buffer,"[Caller%03i]%c%c",i+1,13,10); |
1080 | SaveBackupText(file, "", buffer, UseUnicode); | 1142 | SaveBackupText(file, "", buffer, UseUnicode); |
1081 | SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode); | 1143 | SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode); |
1082 | i++; | 1144 | i++; |
1083 | } | 1145 | } |
1084 | i=0; | 1146 | i=0; |
1085 | while (backup->SMSC[i]!=NULL) { | 1147 | while (backup->SMSC[i]!=NULL) { |
1086 | sprintf(buffer,"[SMSC%03i]%c%c",i+1,13,10); | 1148 | sprintf(buffer,"[SMSC%03i]%c%c",i+1,13,10); |
1087 | SaveBackupText(file, "", buffer, UseUnicode); | 1149 | SaveBackupText(file, "", buffer, UseUnicode); |
1088 | SaveSMSCEntry(file, backup->SMSC[i], UseUnicode); | 1150 | SaveSMSCEntry(file, backup->SMSC[i], UseUnicode); |
1089 | i++; | 1151 | i++; |
1090 | } | 1152 | } |
1091 | i=0; | 1153 | i=0; |
1092 | while (backup->WAPBookmark[i]!=NULL) { | 1154 | while (backup->WAPBookmark[i]!=NULL) { |
1093 | sprintf(buffer,"[WAPBookmark%03i]%c%c",i+1,13,10); | 1155 | sprintf(buffer,"[WAPBookmark%03i]%c%c",i+1,13,10); |
1094 | SaveBackupText(file, "", buffer, UseUnicode); | 1156 | SaveBackupText(file, "", buffer, UseUnicode); |
1095 | SaveWAPBookmarkEntry(file, backup->WAPBookmark[i], UseUnicode); | 1157 | SaveWAPBookmarkEntry(file, backup->WAPBookmark[i], UseUnicode); |
1096 | i++; | 1158 | i++; |
1097 | } | 1159 | } |
1098 | i=0; | 1160 | i=0; |
1099 | while (backup->WAPSettings[i]!=NULL) { | 1161 | while (backup->WAPSettings[i]!=NULL) { |
1100 | sprintf(buffer,"[WAPSettings%03i]%c%c",i+1,13,10); | 1162 | sprintf(buffer,"[WAPSettings%03i]%c%c",i+1,13,10); |
1101 | SaveBackupText(file, "", buffer, UseUnicode); | 1163 | SaveBackupText(file, "", buffer, UseUnicode); |
1102 | SaveWAPSettingsEntry(file, backup->WAPSettings[i], UseUnicode); | 1164 | SaveWAPSettingsEntry(file, backup->WAPSettings[i], UseUnicode); |
1103 | i++; | 1165 | i++; |
1104 | } | 1166 | } |
1105 | i=0; | 1167 | i=0; |
1106 | while (backup->MMSSettings[i]!=NULL) { | 1168 | while (backup->MMSSettings[i]!=NULL) { |
1107 | sprintf(buffer,"[MMSSettings%03i]%c%c",i+1,13,10); | 1169 | sprintf(buffer,"[MMSSettings%03i]%c%c",i+1,13,10); |
1108 | SaveBackupText(file, "", buffer, UseUnicode); | 1170 | SaveBackupText(file, "", buffer, UseUnicode); |
1109 | SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode); | 1171 | SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode); |
1110 | i++; | 1172 | i++; |
1111 | } | 1173 | } |
1112 | i=0; | 1174 | i=0; |
1175 | while (backup->SyncMLSettings[i]!=NULL) { | ||
1176 | sprintf(buffer,"[SyncMLSettings%03i]%c%c",i+1,13,10); | ||
1177 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1178 | SaveSyncMLSettingsEntry(file, backup->SyncMLSettings[i], UseUnicode); | ||
1179 | i++; | ||
1180 | } | ||
1181 | i=0; | ||
1182 | while (backup->ChatSettings[i]!=NULL) { | ||
1183 | sprintf(buffer,"[ChatSettings%03i]%c%c",i+1,13,10); | ||
1184 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1185 | SaveChatSettingsEntry(file, backup->ChatSettings[i], UseUnicode); | ||
1186 | i++; | ||
1187 | } | ||
1188 | i=0; | ||
1113 | while (backup->Ringtone[i]!=NULL) { | 1189 | while (backup->Ringtone[i]!=NULL) { |
1114 | sprintf(buffer,"[Ringtone%03i]%c%c",i+1,13,10); | 1190 | sprintf(buffer,"[Ringtone%03i]%c%c",i+1,13,10); |
1115 | SaveBackupText(file, "", buffer, UseUnicode); | 1191 | SaveBackupText(file, "", buffer, UseUnicode); |
1116 | SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode); | 1192 | SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode); |
1117 | i++; | 1193 | i++; |
1118 | } | 1194 | } |
1119 | i=0; | 1195 | i=0; |
1120 | while (backup->ToDo[i]!=NULL) { | 1196 | while (backup->ToDo[i]!=NULL) { |
1121 | sprintf(buffer,"[TODO%03i]%c%c",i+1,13,10); | 1197 | sprintf(buffer,"[TODO%03i]%c%c",i+1,13,10); |
1122 | SaveBackupText(file, "", buffer, UseUnicode); | 1198 | SaveBackupText(file, "", buffer, UseUnicode); |
1123 | SaveToDoEntry(file, backup->ToDo[i], UseUnicode); | 1199 | SaveToDoEntry(file, backup->ToDo[i], UseUnicode); |
1124 | i++; | 1200 | i++; |
1125 | } | 1201 | } |
1126 | i=0; | 1202 | i=0; |
1127 | while (backup->Profiles[i]!=NULL) { | 1203 | while (backup->Profiles[i]!=NULL) { |
1128 | sprintf(buffer,"[Profile%03i]%c%c",i+1,13,10); | 1204 | sprintf(buffer,"[Profile%03i]%c%c",i+1,13,10); |
1129 | SaveBackupText(file, "", buffer, UseUnicode); | 1205 | SaveBackupText(file, "", buffer, UseUnicode); |
1130 | SaveProfileEntry(file, backup->Profiles[i], UseUnicode); | 1206 | SaveProfileEntry(file, backup->Profiles[i], UseUnicode); |
1131 | i++; | 1207 | i++; |
1132 | } | 1208 | } |
1133 | i=0; | 1209 | i=0; |
1134 | while (backup->FMStation[i]!=NULL) { | 1210 | while (backup->FMStation[i]!=NULL) { |
1135 | sprintf(buffer,"[FMStation%03i]%c%c",i+1,13,10); | 1211 | sprintf(buffer,"[FMStation%03i]%c%c",i+1,13,10); |
1136 | SaveBackupText(file, "", buffer, UseUnicode); | 1212 | SaveBackupText(file, "", buffer, UseUnicode); |
@@ -2635,49 +2711,174 @@ GSM_Error LoadBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
2635 | if (UseUnicode) { | 2711 | if (UseUnicode) { |
2636 | EncodeUnicode(buffer,"Note",4); | 2712 | EncodeUnicode(buffer,"Note",4); |
2637 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | 2713 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; |
2638 | } else { | 2714 | } else { |
2639 | if (mystrncasecmp("Note", h->SectionName, 4)) found = true; | 2715 | if (mystrncasecmp("Note", h->SectionName, 4)) found = true; |
2640 | } | 2716 | } |
2641 | if (found) { | 2717 | if (found) { |
2642 | readvalue = ReadCFGText(file_info, h->SectionName, "Text", UseUnicode); | 2718 | readvalue = ReadCFGText(file_info, h->SectionName, "Text", UseUnicode); |
2643 | if (readvalue==NULL) break; | 2719 | if (readvalue==NULL) break; |
2644 | if (num < GSM_BACKUP_MAX_NOTE) { | 2720 | if (num < GSM_BACKUP_MAX_NOTE) { |
2645 | backup->Note[num] = malloc(sizeof(GSM_NoteEntry)); | 2721 | backup->Note[num] = malloc(sizeof(GSM_NoteEntry)); |
2646 | if (backup->Note[num] == NULL) return ERR_MOREMEMORY; | 2722 | if (backup->Note[num] == NULL) return ERR_MOREMEMORY; |
2647 | backup->Note[num + 1] = NULL; | 2723 | backup->Note[num + 1] = NULL; |
2648 | } else { | 2724 | } else { |
2649 | dbgprintf("Increase GSM_BACKUP_MAX_NOTE\n"); | 2725 | dbgprintf("Increase GSM_BACKUP_MAX_NOTE\n"); |
2650 | return ERR_MOREMEMORY; | 2726 | return ERR_MOREMEMORY; |
2651 | } | 2727 | } |
2652 | ReadNoteEntry(file_info, h->SectionName, backup->Note[num],UseUnicode); | 2728 | ReadNoteEntry(file_info, h->SectionName, backup->Note[num],UseUnicode); |
2653 | num++; | 2729 | num++; |
2654 | } | 2730 | } |
2655 | } | 2731 | } |
2656 | if (backup->MD5Original[0]!=0) { | 2732 | if (backup->MD5Original[0]!=0) { |
2657 | FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated); | 2733 | FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated); |
2658 | } | 2734 | } |
2659 | 2735 | for (h = file_info; h != NULL; h = h->Next) { | |
2736 | found = false; | ||
2737 | if (UseUnicode) { | ||
2738 | EncodeUnicode(buffer,"Backup",4); | ||
2739 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2740 | } else { | ||
2741 | if (mystrncasecmp("Backup", h->SectionName, 6)) found = true; | ||
2742 | } | ||
2743 | if (UseUnicode) { | ||
2744 | EncodeUnicode(buffer,"Checksum",4); | ||
2745 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2746 | } else { | ||
2747 | if (mystrncasecmp("Checksum", h->SectionName, 8)) found = true; | ||
2748 | } | ||
2749 | if (UseUnicode) { | ||
2750 | EncodeUnicode(buffer,"Profile",7); | ||
2751 | if (mywstrncasecmp(buffer, h->SectionName, 7)) found = true; | ||
2752 | } else { | ||
2753 | if (mystrncasecmp("Profile", h->SectionName, 7)) found = true; | ||
2754 | } | ||
2755 | if (UseUnicode) { | ||
2756 | EncodeUnicode(buffer,"PhonePBK",8); | ||
2757 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2758 | } else { | ||
2759 | if (mystrncasecmp("PhonePBK", h->SectionName, 8)) found = true; | ||
2760 | } | ||
2761 | if (UseUnicode) { | ||
2762 | EncodeUnicode(buffer,"SIMPBK",6); | ||
2763 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2764 | } else { | ||
2765 | if (mystrncasecmp("SIMPBK", h->SectionName, 6)) found = true; | ||
2766 | } | ||
2767 | if (UseUnicode) { | ||
2768 | EncodeUnicode(buffer,"Calendar",8); | ||
2769 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2770 | } else { | ||
2771 | if (mystrncasecmp("Calendar", h->SectionName, 8)) found = true; | ||
2772 | } | ||
2773 | if (UseUnicode) { | ||
2774 | EncodeUnicode(buffer,"Caller",6); | ||
2775 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2776 | } else { | ||
2777 | if (mystrncasecmp("Caller", h->SectionName, 6)) found = true; | ||
2778 | } | ||
2779 | if (UseUnicode) { | ||
2780 | EncodeUnicode(buffer,"SMSC",4); | ||
2781 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2782 | } else { | ||
2783 | if (mystrncasecmp("SMSC", h->SectionName, 4)) found = true; | ||
2784 | } | ||
2785 | if (UseUnicode) { | ||
2786 | EncodeUnicode(buffer,"WAPBookmark",11); | ||
2787 | if (mywstrncasecmp(buffer, h->SectionName, 11)) found = true; | ||
2788 | if (!found) { | ||
2789 | EncodeUnicode(buffer,"Bookmark",8); | ||
2790 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2791 | } | ||
2792 | } else { | ||
2793 | if (mystrncasecmp("WAPBookmark", h->SectionName, 11)) found = true; | ||
2794 | if (!found) { | ||
2795 | if (mystrncasecmp("Bookmark", h->SectionName, 8)) found = true; | ||
2796 | } | ||
2797 | } | ||
2798 | if (UseUnicode) { | ||
2799 | EncodeUnicode(buffer,"WAPSettings",11); | ||
2800 | if (mywstrncasecmp(buffer, h->SectionName, 11)) found = true; | ||
2801 | if (!found) { | ||
2802 | EncodeUnicode(buffer,"Settings",8); | ||
2803 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2804 | } | ||
2805 | } else { | ||
2806 | if (mystrncasecmp("WAPSettings", h->SectionName, 11)) found = true; | ||
2807 | if (!found) { | ||
2808 | if (mystrncasecmp("Settings", h->SectionName, 8)) found = true; | ||
2809 | } | ||
2810 | } | ||
2811 | if (UseUnicode) { | ||
2812 | EncodeUnicode(buffer,"MMSSettings",8); | ||
2813 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2814 | } else { | ||
2815 | if (mystrncasecmp("MMSSettings", h->SectionName, 8)) found = true; | ||
2816 | } | ||
2817 | if (UseUnicode) { | ||
2818 | EncodeUnicode(buffer,"Ringtone",8); | ||
2819 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2820 | } else { | ||
2821 | if (mystrncasecmp("Ringtone", h->SectionName, 8)) found = true; | ||
2822 | } | ||
2823 | if (UseUnicode) { | ||
2824 | EncodeUnicode(buffer,"TODO",4); | ||
2825 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2826 | } else { | ||
2827 | if (mystrncasecmp("TODO", h->SectionName, 4)) found = true; | ||
2828 | } | ||
2829 | if (UseUnicode) { | ||
2830 | EncodeUnicode(buffer,"Startup",7); | ||
2831 | if (mywstrncasecmp(buffer, h->SectionName, 7)) found = true; | ||
2832 | } else { | ||
2833 | if (mystrncasecmp("Startup", h->SectionName, 7)) found = true; | ||
2834 | } | ||
2835 | if (UseUnicode) { | ||
2836 | EncodeUnicode(buffer,"Operator",7); | ||
2837 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2838 | } else { | ||
2839 | if (mystrncasecmp("Operator", h->SectionName, 8)) found = true; | ||
2840 | } | ||
2841 | if (UseUnicode) { | ||
2842 | EncodeUnicode(buffer,"FMStation",9); | ||
2843 | if (mywstrncasecmp(buffer, h->SectionName, 9)) found = true; | ||
2844 | } else { | ||
2845 | if (mystrncasecmp("FMStation", h->SectionName, 9)) found = true; | ||
2846 | } | ||
2847 | if (UseUnicode) { | ||
2848 | EncodeUnicode(buffer,"GPRSPoint",9); | ||
2849 | if (mywstrncasecmp(buffer, h->SectionName, 9)) found = true; | ||
2850 | } else { | ||
2851 | if (mystrncasecmp("GPRSPoint", h->SectionName, 9)) found = true; | ||
2852 | } | ||
2853 | if (UseUnicode) { | ||
2854 | EncodeUnicode(buffer,"Note",4); | ||
2855 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2856 | } else { | ||
2857 | if (mystrncasecmp("Note", h->SectionName, 4)) found = true; | ||
2858 | } | ||
2859 | if (!found) return ERR_NOTIMPLEMENTED; | ||
2860 | } | ||
2660 | return ERR_NONE; | 2861 | return ERR_NONE; |
2661 | } | 2862 | } |
2662 | 2863 | ||
2663 | /* ---------------------- backup files for SMS ----------------------------- */ | 2864 | /* ---------------------- backup files for SMS ----------------------------- */ |
2664 | 2865 | ||
2665 | static void ReadSMSBackupEntry(INI_Section *file_info, char *section, GSM_SMSMessage *SMS) | 2866 | static void ReadSMSBackupEntry(INI_Section *file_info, char *section, GSM_SMSMessage *SMS) |
2666 | { | 2867 | { |
2667 | unsigned char buffer[10000], *readvalue; | 2868 | unsigned char buffer[10000], *readvalue; |
2668 | 2869 | ||
2669 | GSM_SetDefaultSMSData(SMS); | 2870 | GSM_SetDefaultSMSData(SMS); |
2670 | 2871 | ||
2671 | SMS->PDU = SMS_Submit; | 2872 | SMS->PDU = SMS_Submit; |
2672 | SMS->SMSC.Location = 0; | 2873 | SMS->SMSC.Location = 0; |
2673 | sprintf(buffer,"SMSC"); | 2874 | sprintf(buffer,"SMSC"); |
2674 | ReadBackupText(file_info, section, buffer, SMS->SMSC.Number, false); | 2875 | ReadBackupText(file_info, section, buffer, SMS->SMSC.Number, false); |
2675 | sprintf(buffer,"ReplySMSC"); | 2876 | sprintf(buffer,"ReplySMSC"); |
2676 | SMS->ReplyViaSameSMSC = false; | 2877 | SMS->ReplyViaSameSMSC = false; |
2677 | readvalue = ReadCFGText(file_info, section, buffer, false); | 2878 | readvalue = ReadCFGText(file_info, section, buffer, false); |
2678 | if (readvalue!=NULL) { | 2879 | if (readvalue!=NULL) { |
2679 | if (mystrncasecmp(readvalue,"True",0)) SMS->ReplyViaSameSMSC = true; | 2880 | if (mystrncasecmp(readvalue,"True",0)) SMS->ReplyViaSameSMSC = true; |
2680 | } | 2881 | } |
2681 | sprintf(buffer,"Class"); | 2882 | sprintf(buffer,"Class"); |
2682 | SMS->Class = -1; | 2883 | SMS->Class = -1; |
2683 | readvalue = ReadCFGText(file_info, section, buffer, false); | 2884 | readvalue = ReadCFGText(file_info, section, buffer, false); |
diff --git a/gammu/emb/common/service/backup/gsmback.c b/gammu/emb/common/service/backup/gsmback.c index 91ac745..c94a4d2 100644 --- a/gammu/emb/common/service/backup/gsmback.c +++ b/gammu/emb/common/service/backup/gsmback.c | |||
@@ -52,221 +52,239 @@ void GSM_FreeBackup(GSM_Backup *backup) | |||
52 | while (backup->SMSC[i]!=NULL) { | 52 | while (backup->SMSC[i]!=NULL) { |
53 | free(backup->SMSC[i]); | 53 | free(backup->SMSC[i]); |
54 | backup->SMSC[i] = NULL; | 54 | backup->SMSC[i] = NULL; |
55 | i++; | 55 | i++; |
56 | } | 56 | } |
57 | i=0; | 57 | i=0; |
58 | while (backup->WAPBookmark[i]!=NULL) { | 58 | while (backup->WAPBookmark[i]!=NULL) { |
59 | free(backup->WAPBookmark[i]); | 59 | free(backup->WAPBookmark[i]); |
60 | backup->WAPBookmark[i] = NULL; | 60 | backup->WAPBookmark[i] = NULL; |
61 | i++; | 61 | i++; |
62 | } | 62 | } |
63 | i=0; | 63 | i=0; |
64 | while (backup->WAPSettings[i]!=NULL) { | 64 | while (backup->WAPSettings[i]!=NULL) { |
65 | free(backup->WAPSettings[i]); | 65 | free(backup->WAPSettings[i]); |
66 | backup->WAPSettings[i] = NULL; | 66 | backup->WAPSettings[i] = NULL; |
67 | i++; | 67 | i++; |
68 | } | 68 | } |
69 | i=0; | 69 | i=0; |
70 | while (backup->MMSSettings[i]!=NULL) { | 70 | while (backup->MMSSettings[i]!=NULL) { |
71 | free(backup->MMSSettings[i]); | 71 | free(backup->MMSSettings[i]); |
72 | backup->MMSSettings[i] = NULL; | 72 | backup->MMSSettings[i] = NULL; |
73 | i++; | 73 | i++; |
74 | } | 74 | } |
75 | i=0; | 75 | i=0; |
76 | while (backup->SyncMLSettings[i]!=NULL) { | ||
77 | free(backup->SyncMLSettings[i]); | ||
78 | backup->SyncMLSettings[i] = NULL; | ||
79 | i++; | ||
80 | } | ||
81 | i=0; | ||
82 | while (backup->ChatSettings[i]!=NULL) { | ||
83 | free(backup->ChatSettings[i]); | ||
84 | backup->ChatSettings[i] = NULL; | ||
85 | i++; | ||
86 | } | ||
87 | i=0; | ||
76 | while (backup->Ringtone[i]!=NULL) { | 88 | while (backup->Ringtone[i]!=NULL) { |
77 | free(backup->Ringtone[i]); | 89 | free(backup->Ringtone[i]); |
78 | backup->Ringtone[i] = NULL; | 90 | backup->Ringtone[i] = NULL; |
79 | i++; | 91 | i++; |
80 | } | 92 | } |
81 | i=0; | 93 | i=0; |
82 | while (backup->ToDo[i]!=NULL) { | 94 | while (backup->ToDo[i]!=NULL) { |
83 | free(backup->ToDo[i]); | 95 | free(backup->ToDo[i]); |
84 | backup->ToDo[i] = NULL; | 96 | backup->ToDo[i] = NULL; |
85 | i++; | 97 | i++; |
86 | } | 98 | } |
87 | i=0; | 99 | i=0; |
88 | while (backup->Profiles[i]!=NULL) { | 100 | while (backup->Profiles[i]!=NULL) { |
89 | free(backup->Profiles[i]); | 101 | free(backup->Profiles[i]); |
90 | backup->Profiles[i] = NULL; | 102 | backup->Profiles[i] = NULL; |
91 | i++; | 103 | i++; |
92 | } | 104 | } |
93 | i=0; | 105 | i=0; |
94 | while (backup->FMStation[i]!=NULL) { | 106 | while (backup->FMStation[i]!=NULL) { |
95 | free(backup->FMStation[i]); | 107 | free(backup->FMStation[i]); |
96 | backup->FMStation[i] = NULL; | 108 | backup->FMStation[i] = NULL; |
97 | i++; | 109 | i++; |
98 | } | 110 | } |
99 | if (backup->StartupLogo!=NULL) { | 111 | if (backup->StartupLogo!=NULL) { |
100 | free(backup->StartupLogo); | 112 | free(backup->StartupLogo); |
101 | backup->StartupLogo = NULL; | 113 | backup->StartupLogo = NULL; |
102 | } | 114 | } |
103 | if (backup->OperatorLogo!=NULL) { | 115 | if (backup->OperatorLogo!=NULL) { |
104 | free(backup->OperatorLogo); | 116 | free(backup->OperatorLogo); |
105 | backup->OperatorLogo = NULL; | 117 | backup->OperatorLogo = NULL; |
106 | } | 118 | } |
107 | i=0; | 119 | i=0; |
108 | while (backup->GPRSPoint[i]!=NULL) { | 120 | while (backup->GPRSPoint[i]!=NULL) { |
109 | free(backup->GPRSPoint[i]); | 121 | free(backup->GPRSPoint[i]); |
110 | backup->GPRSPoint[i] = NULL; | 122 | backup->GPRSPoint[i] = NULL; |
111 | i++; | 123 | i++; |
112 | } | 124 | } |
113 | i=0; | 125 | i=0; |
114 | while (backup->Note[i]!=NULL) { | 126 | while (backup->Note[i]!=NULL) { |
115 | free(backup->Note[i]); | 127 | free(backup->Note[i]); |
116 | backup->Note[i] = NULL; | 128 | backup->Note[i] = NULL; |
117 | i++; | 129 | i++; |
118 | } | 130 | } |
119 | } | 131 | } |
120 | 132 | ||
121 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) | 133 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) |
122 | { | 134 | { |
123 | if (strstr(FileName,".lmb")) { | 135 | if (mystrcasestr(FileName,".lmb")) { |
124 | return SaveLMB(FileName,backup); | 136 | return SaveLMB(FileName,backup); |
125 | } else if (strstr(FileName,".vcs")) { | 137 | } else if (mystrcasestr(FileName,".vcs")) { |
126 | return SaveVCalendar(FileName,backup); | 138 | return SaveVCalendar(FileName,backup); |
127 | } else if (strstr(FileName,".vcf")) { | 139 | } else if (mystrcasestr(FileName,".vcf")) { |
128 | return SaveVCard(FileName,backup); | 140 | return SaveVCard(FileName,backup); |
129 | } else if (strstr(FileName,".ldif")) { | 141 | } else if (mystrcasestr(FileName,".ldif")) { |
130 | return SaveLDIF(FileName,backup); | 142 | return SaveLDIF(FileName,backup); |
131 | } else if (strstr(FileName,".ics")) { | 143 | } else if (mystrcasestr(FileName,".ics")) { |
132 | return SaveICS(FileName,backup); | 144 | return SaveICS(FileName,backup); |
133 | } else { | 145 | } else { |
134 | return SaveBackup(FileName,backup, UseUnicode); | 146 | return SaveBackup(FileName,backup, UseUnicode); |
135 | } | 147 | } |
136 | } | 148 | } |
137 | 149 | ||
138 | GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup) | 150 | GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup) |
139 | { | 151 | { |
140 | FILE *file; | 152 | FILE *file; |
141 | unsigned charbuffer[300]; | 153 | unsigned charbuffer[300]; |
142 | 154 | ||
143 | file = fopen(FileName, "rb"); | 155 | file = fopen(FileName, "rb"); |
144 | if (file == NULL) return ERR_CANTOPENFILE; | 156 | if (file == NULL) return ERR_CANTOPENFILE; |
145 | fread(buffer, 1, 9, file); /* Read the header of the file. */ | 157 | fread(buffer, 1, 9, file); /* Read the header of the file. */ |
146 | fclose(file); | 158 | fclose(file); |
147 | 159 | ||
148 | GSM_ClearBackup(backup); | 160 | GSM_ClearBackup(backup); |
149 | 161 | ||
150 | /* Attempt to identify filetype */ | 162 | /* Attempt to identify filetype */ |
151 | if (strstr(FileName,".vcs")) { | 163 | if (mystrcasestr(FileName,".vcs")) { |
152 | return LoadVCalendar(FileName,backup); | 164 | return LoadVCalendar(FileName,backup); |
153 | } else if (strstr(FileName,".vcf")) { | 165 | } else if (mystrcasestr(FileName,".vcf")) { |
154 | return LoadVCard(FileName,backup); | 166 | return LoadVCard(FileName,backup); |
155 | } else if (strstr(FileName,".ldif")) { | 167 | } else if (mystrcasestr(FileName,".ldif")) { |
156 | return LoadLDIF(FileName,backup); | 168 | return LoadLDIF(FileName,backup); |
157 | } else if (strstr(FileName,".ics")) { | 169 | } else if (mystrcasestr(FileName,".ics")) { |
158 | return LoadICS(FileName,backup); | 170 | return LoadICS(FileName,backup); |
159 | } else if (memcmp(buffer, "LMB ",4)==0) { | 171 | } else if (memcmp(buffer, "LMB ",4)==0) { |
160 | return LoadLMB(FileName,backup); | 172 | return LoadLMB(FileName,backup); |
161 | } else if (buffer[0] == 0xFE && buffer[1] == 0xFF) { | 173 | } else if (buffer[0] == 0xFE && buffer[1] == 0xFF) { |
162 | return LoadBackup(FileName,backup,true); | 174 | return LoadBackup(FileName,backup,true); |
163 | } else if (buffer[0] == 0xFF && buffer[1] == 0xFE) { | 175 | } else if (buffer[0] == 0xFF && buffer[1] == 0xFE) { |
164 | return LoadBackup(FileName,backup,true); | 176 | return LoadBackup(FileName,backup,true); |
165 | } else { | 177 | } else { |
166 | return LoadBackup(FileName,backup,false); | 178 | return LoadBackup(FileName,backup,false); |
167 | } | 179 | } |
168 | } | 180 | } |
169 | 181 | ||
170 | void GSM_ClearBackup(GSM_Backup *backup) | 182 | void GSM_ClearBackup(GSM_Backup *backup) |
171 | { | 183 | { |
172 | backup->PhonePhonebook[0] = NULL; | 184 | backup->PhonePhonebook[0] = NULL; |
173 | backup->SIMPhonebook[0] = NULL; | 185 | backup->SIMPhonebook[0] = NULL; |
174 | backup->Calendar[0] = NULL; | 186 | backup->Calendar[0] = NULL; |
175 | backup->CallerLogos[0] = NULL; | 187 | backup->CallerLogos[0] = NULL; |
176 | backup->SMSC [0] = NULL; | 188 | backup->SMSC [0] = NULL; |
177 | backup->WAPBookmark[0] = NULL; | 189 | backup->WAPBookmark[0] = NULL; |
178 | backup->WAPSettings[0] = NULL; | 190 | backup->WAPSettings[0] = NULL; |
179 | backup->MMSSettings[0] = NULL; | 191 | backup->MMSSettings[0] = NULL; |
192 | backup->SyncMLSettings[0] = NULL; | ||
193 | backup->ChatSettings[0] = NULL; | ||
180 | backup->Ringtone[0] = NULL; | 194 | backup->Ringtone[0] = NULL; |
181 | backup->Profiles[0] = NULL; | 195 | backup->Profiles[0] = NULL; |
182 | backup->ToDo [0] = NULL; | 196 | backup->ToDo [0] = NULL; |
183 | backup->GPRSPoint[0] = NULL; | 197 | backup->GPRSPoint[0] = NULL; |
184 | backup->FMStation[0] = NULL; | 198 | backup->FMStation[0] = NULL; |
185 | backup->Note [0] = NULL; | 199 | backup->Note [0] = NULL; |
186 | backup->StartupLogo = NULL; | 200 | backup->StartupLogo = NULL; |
187 | backup->OperatorLogo = NULL; | 201 | backup->OperatorLogo = NULL; |
188 | 202 | ||
189 | backup->Creator [0] = 0; | 203 | backup->Creator [0] = 0; |
190 | backup->IMEI [0] = 0; | 204 | backup->IMEI [0] = 0; |
191 | backup->Model [0] = 0; | 205 | backup->Model [0] = 0; |
192 | backup->DateTimeAvailable = false; | 206 | backup->DateTimeAvailable = false; |
193 | backup->MD5Original[0] = 0; | 207 | backup->MD5Original[0] = 0; |
194 | backup->MD5Calculated[0] = 0; | 208 | backup->MD5Calculated[0] = 0; |
195 | } | 209 | } |
196 | 210 | ||
197 | void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info) | 211 | void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info) |
198 | { | 212 | { |
199 | info->UseUnicode= false; | 213 | info->UseUnicode= false; |
200 | info->IMEI = false; | 214 | info->IMEI = false; |
201 | info->Model = false; | 215 | info->Model = false; |
202 | info->DateTime = false; | 216 | info->DateTime = false; |
203 | info->PhonePhonebook = false; | 217 | info->PhonePhonebook = false; |
204 | info->SIMPhonebook = false; | 218 | info->SIMPhonebook = false; |
205 | info->ToDo = false; | 219 | info->ToDo = false; |
206 | info->Calendar = false; | 220 | info->Calendar = false; |
207 | info->CallerLogos = false; | 221 | info->CallerLogos = false; |
208 | info->SMSC = false; | 222 | info->SMSC = false; |
209 | info->WAPBookmark = false; | 223 | info->WAPBookmark = false; |
210 | info->WAPSettings = false; | 224 | info->WAPSettings = false; |
211 | info->MMSSettings = false; | 225 | info->MMSSettings = false; |
226 | info->SyncMLSettings = false; | ||
227 | info->ChatSettings = false; | ||
212 | info->Ringtone = false; | 228 | info->Ringtone = false; |
213 | info->StartupLogo = false; | 229 | info->StartupLogo = false; |
214 | info->OperatorLogo = false; | 230 | info->OperatorLogo = false; |
215 | info->Profiles = false; | 231 | info->Profiles = false; |
216 | info->FMStation = false; | 232 | info->FMStation = false; |
217 | info->GPRSPoint = false; | 233 | info->GPRSPoint = false; |
218 | info->Note = false; | 234 | info->Note = false; |
219 | 235 | ||
220 | if (strstr(FileName,".lmb")) { | 236 | if (strstr(FileName,".lmb")) { |
221 | info->PhonePhonebook = true; | 237 | info->PhonePhonebook = true; |
222 | info->SIMPhonebook = true; | 238 | info->SIMPhonebook = true; |
223 | info->CallerLogos = true; | 239 | info->CallerLogos = true; |
224 | info->StartupLogo = true; | 240 | info->StartupLogo = true; |
225 | } else if (strstr(FileName,".vcs")) { | 241 | } else if (strstr(FileName,".vcs")) { |
226 | info->ToDo = true; | 242 | info->ToDo = true; |
227 | info->Calendar = true; | 243 | info->Calendar = true; |
228 | } else if (strstr(FileName,".vcf")) { | 244 | } else if (strstr(FileName,".vcf")) { |
229 | info->PhonePhonebook= true; | 245 | info->PhonePhonebook= true; |
230 | } else if (strstr(FileName,".ics")) { | 246 | } else if (strstr(FileName,".ics")) { |
231 | info->ToDo = true; | 247 | info->ToDo = true; |
232 | info->Calendar = true; | 248 | info->Calendar = true; |
233 | } else if (strstr(FileName,".ldif")) { | 249 | } else if (strstr(FileName,".ldif")) { |
234 | info->PhonePhonebook= true; | 250 | info->PhonePhonebook= true; |
235 | } else { | 251 | } else { |
236 | info->UseUnicode= true; | 252 | info->UseUnicode= true; |
237 | info->IMEI = true; | 253 | info->IMEI = true; |
238 | info->Model = true; | 254 | info->Model = true; |
239 | info->DateTime = true; | 255 | info->DateTime = true; |
240 | info->PhonePhonebook = true; | 256 | info->PhonePhonebook = true; |
241 | info->SIMPhonebook = true; | 257 | info->SIMPhonebook = true; |
242 | info->ToDo = true; | 258 | info->ToDo = true; |
243 | info->Calendar = true; | 259 | info->Calendar = true; |
244 | info->CallerLogos = true; | 260 | info->CallerLogos = true; |
245 | info->SMSC = true; | 261 | info->SMSC = true; |
246 | info->WAPBookmark = true; | 262 | info->WAPBookmark = true; |
247 | info->WAPSettings = true; | 263 | info->WAPSettings = true; |
248 | info->MMSSettings = true; | 264 | info->MMSSettings = true; |
265 | info->SyncMLSettings = true; | ||
266 | info->ChatSettings = true; | ||
249 | info->Ringtone = true; | 267 | info->Ringtone = true; |
250 | info->StartupLogo = true; | 268 | info->StartupLogo = true; |
251 | info->OperatorLogo = true; | 269 | info->OperatorLogo = true; |
252 | info->Profiles = true; | 270 | info->Profiles = true; |
253 | info->FMStation = true; | 271 | info->FMStation = true; |
254 | info->GPRSPoint = true; | 272 | info->GPRSPoint = true; |
255 | info->Note = true; | 273 | info->Note = true; |
256 | } | 274 | } |
257 | } | 275 | } |
258 | 276 | ||
259 | void GSM_GetBackupFileFeatures(char *FileName, GSM_Backup_Info *info, GSM_Backup *backup) | 277 | void GSM_GetBackupFileFeatures(char *FileName, GSM_Backup_Info *info, GSM_Backup *backup) |
260 | { | 278 | { |
261 | GSM_GetBackupFormatFeatures(FileName, info); | 279 | GSM_GetBackupFormatFeatures(FileName, info); |
262 | 280 | ||
263 | if (info->PhonePhonebook && backup->PhonePhonebook[0] == NULL) info->PhonePhonebook = false; | 281 | if (info->PhonePhonebook && backup->PhonePhonebook[0] == NULL) info->PhonePhonebook = false; |
264 | if (info->SIMPhonebook && backup->SIMPhonebook[0] == NULL) info->SIMPhonebook = false; | 282 | if (info->SIMPhonebook && backup->SIMPhonebook[0] == NULL) info->SIMPhonebook = false; |
265 | if (info->Calendar && backup->Calendar[0] == NULL) info->Calendar = false; | 283 | if (info->Calendar && backup->Calendar[0] == NULL) info->Calendar = false; |
266 | if (info->ToDo && backup->ToDo[0] == NULL) info->ToDo = false; | 284 | if (info->ToDo && backup->ToDo[0] == NULL) info->ToDo = false; |
267 | if (info->WAPBookmark && backup->WAPBookmark[0] == NULL) info->WAPBookmark = false; | 285 | if (info->WAPBookmark && backup->WAPBookmark[0] == NULL) info->WAPBookmark = false; |
268 | if (info->WAPSettings && backup->WAPSettings[0] == NULL) info->WAPSettings = false; | 286 | if (info->WAPSettings && backup->WAPSettings[0] == NULL) info->WAPSettings = false; |
269 | if (info->MMSSettings && backup->MMSSettings[0] == NULL) info->MMSSettings = false; | 287 | if (info->MMSSettings && backup->MMSSettings[0] == NULL) info->MMSSettings = false; |
270 | if (info->FMStation && backup->FMStation[0] == NULL) info->FMStation = false; | 288 | if (info->FMStation && backup->FMStation[0] == NULL) info->FMStation = false; |
271 | if (info->GPRSPoint && backup->GPRSPoint[0] == NULL) info->GPRSPoint = false; | 289 | if (info->GPRSPoint && backup->GPRSPoint[0] == NULL) info->GPRSPoint = false; |
272 | if (info->Profiles && backup->Profiles[0] == NULL) info->Profiles = false; | 290 | if (info->Profiles && backup->Profiles[0] == NULL) info->Profiles = false; |
diff --git a/gammu/emb/common/service/backup/gsmback.h b/gammu/emb/common/service/backup/gsmback.h index 1fd99b0..791e81d 100644 --- a/gammu/emb/common/service/backup/gsmback.h +++ b/gammu/emb/common/service/backup/gsmback.h | |||
@@ -8,41 +8,43 @@ | |||
8 | #ifdef GSM_ENABLE_BACKUP | 8 | #ifdef GSM_ENABLE_BACKUP |
9 | 9 | ||
10 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode); | 10 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode); |
11 | GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup); | 11 | GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup); |
12 | 12 | ||
13 | void GSM_ClearBackup (GSM_Backup *backup); | 13 | void GSM_ClearBackup (GSM_Backup *backup); |
14 | void GSM_FreeBackup (GSM_Backup *backup); | 14 | void GSM_FreeBackup (GSM_Backup *backup); |
15 | 15 | ||
16 | typedef struct { | 16 | typedef struct { |
17 | bool UseUnicode; | 17 | bool UseUnicode; |
18 | 18 | ||
19 | bool IMEI; | 19 | bool IMEI; |
20 | bool Model; | 20 | bool Model; |
21 | bool DateTime; | 21 | bool DateTime; |
22 | bool ToDo; | 22 | bool ToDo; |
23 | bool PhonePhonebook; | 23 | bool PhonePhonebook; |
24 | bool SIMPhonebook; | 24 | bool SIMPhonebook; |
25 | bool Calendar; | 25 | bool Calendar; |
26 | bool CallerLogos; | 26 | bool CallerLogos; |
27 | bool SMSC; | 27 | bool SMSC; |
28 | bool WAPBookmark; | 28 | bool WAPBookmark; |
29 | bool Profiles; | 29 | bool Profiles; |
30 | bool WAPSettings; | 30 | bool WAPSettings; |
31 | bool MMSSettings; | 31 | bool MMSSettings; |
32 | bool SyncMLSettings; | ||
33 | bool ChatSettings; | ||
32 | bool Ringtone; | 34 | bool Ringtone; |
33 | bool StartupLogo; | 35 | bool StartupLogo; |
34 | bool OperatorLogo; | 36 | bool OperatorLogo; |
35 | bool FMStation; | 37 | bool FMStation; |
36 | bool GPRSPoint; | 38 | bool GPRSPoint; |
37 | bool Note; | 39 | bool Note; |
38 | } GSM_Backup_Info; | 40 | } GSM_Backup_Info; |
39 | 41 | ||
40 | void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info); | 42 | void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info); |
41 | void GSM_GetBackupFileFeatures (char *FileName, GSM_Backup_Info *info, GSM_Backup *backup); | 43 | void GSM_GetBackupFileFeatures (char *FileName, GSM_Backup_Info *info, GSM_Backup *backup); |
42 | 44 | ||
43 | #endif | 45 | #endif |
44 | #endif | 46 | #endif |
45 | 47 | ||
46 | /* 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. |
47 | * vim: noexpandtab sw=8 ts=8 sts=8: | 49 | * vim: noexpandtab sw=8 ts=8 sts=8: |
48 | */ | 50 | */ |
diff --git a/gammu/emb/common/service/gsmcal.h b/gammu/emb/common/service/gsmcal.h index 067a4a4..0a41b7b 100644 --- a/gammu/emb/common/service/gsmcal.h +++ b/gammu/emb/common/service/gsmcal.h | |||
@@ -384,49 +384,49 @@ typedef struct { | |||
384 | 384 | ||
385 | void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone); | 385 | void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone); |
386 | 386 | ||
387 | typedef enum { | 387 | typedef enum { |
388 | Nokia_VToDo = 1, | 388 | Nokia_VToDo = 1, |
389 | SonyEricsson_VToDo | 389 | SonyEricsson_VToDo |
390 | } GSM_VToDoVersion; | 390 | } GSM_VToDoVersion; |
391 | 391 | ||
392 | GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version); | 392 | GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version); |
393 | 393 | ||
394 | /** | 394 | /** |
395 | * Status of to do entries. | 395 | * Status of to do entries. |
396 | */ | 396 | */ |
397 | typedef struct { | 397 | typedef struct { |
398 | /** | 398 | /** |
399 | * Number of used positions. | 399 | * Number of used positions. |
400 | */ | 400 | */ |
401 | int Used; | 401 | int Used; |
402 | } GSM_ToDoStatus; | 402 | } GSM_ToDoStatus; |
403 | 403 | ||
404 | /* --------------------------- note ---------------------------------------- */ | 404 | /* --------------------------- note ---------------------------------------- */ |
405 | 405 | ||
406 | typedef struct { | 406 | typedef struct { |
407 | int Location; | 407 | int Location; |
408 | char Text[100]; | 408 | char Text[3000*2]; |
409 | } GSM_NoteEntry; | 409 | } GSM_NoteEntry; |
410 | 410 | ||
411 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note); | 411 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note); |
412 | 412 | ||
413 | /* --------------------------- alarm --------------------------------------- */ | 413 | /* --------------------------- alarm --------------------------------------- */ |
414 | 414 | ||
415 | /** | 415 | /** |
416 | * Alarm values. | 416 | * Alarm values. |
417 | */ | 417 | */ |
418 | typedef struct { | 418 | typedef struct { |
419 | /** | 419 | /** |
420 | * Location where it is stored. | 420 | * Location where it is stored. |
421 | */ | 421 | */ |
422 | int Location; | 422 | int Location; |
423 | /** | 423 | /** |
424 | * Date and time of alarm. | 424 | * Date and time of alarm. |
425 | */ | 425 | */ |
426 | GSM_DateTime DateTime; | 426 | GSM_DateTime DateTime; |
427 | /** | 427 | /** |
428 | * Whether it repeats each day. | 428 | * Whether it repeats each day. |
429 | */ | 429 | */ |
430 | bool Repeating; | 430 | bool Repeating; |
431 | /** | 431 | /** |
432 | * Text that is shown on display. | 432 | * Text that is shown on display. |
diff --git a/gammu/emb/common/service/gsmdata.c b/gammu/emb/common/service/gsmdata.c index 94e9b7b..9303b57 100644 --- a/gammu/emb/common/service/gsmdata.c +++ b/gammu/emb/common/service/gsmdata.c | |||
@@ -225,95 +225,173 @@ void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_W | |||
225 | Buffer[(*Length)++] = 0x7C; //TYPE = MMSURL | 225 | Buffer[(*Length)++] = 0x7C; //TYPE = MMSURL |
226 | } else { | 226 | } else { |
227 | Buffer[(*Length)++] = 0x07; //TYPE = URL | 227 | Buffer[(*Length)++] = 0x07; //TYPE = URL |
228 | } | 228 | } |
229 | Buffer[(*Length)++] = 0x11; //VALUE | 229 | Buffer[(*Length)++] = 0x11; //VALUE |
230 | Buffer[(*Length)++] = 0x03; //Inline string | 230 | Buffer[(*Length)++] = 0x03; //Inline string |
231 | sprintf(buffer,"%s",DecodeUnicodeString(settings->HomePage)); | 231 | sprintf(buffer,"%s",DecodeUnicodeString(settings->HomePage)); |
232 | for (i=0;i<(int)strlen(buffer);i++) { | 232 | for (i=0;i<(int)strlen(buffer);i++) { |
233 | Buffer[(*Length)++] = buffer[i];//Text | 233 | Buffer[(*Length)++] = buffer[i];//Text |
234 | } | 234 | } |
235 | Buffer[(*Length)++] = 0x00; //END Inline string | 235 | Buffer[(*Length)++] = 0x00; //END Inline string |
236 | Buffer[(*Length)++] = 0x01; //END PARMeter | 236 | Buffer[(*Length)++] = 0x01; //END PARMeter |
237 | 237 | ||
238 | /* ISP_NAME (name) */ | 238 | /* ISP_NAME (name) */ |
239 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes | 239 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes |
240 | Buffer[(*Length)++] = 0x08; //TYPE=NAME | 240 | Buffer[(*Length)++] = 0x08; //TYPE=NAME |
241 | Buffer[(*Length)++] = 0x01; //END PARMeter | 241 | Buffer[(*Length)++] = 0x01; //END PARMeter |
242 | /* Settings name */ | 242 | /* Settings name */ |
243 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(settings->Title), UnicodeLength(settings->Title)); | 243 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(settings->Title), UnicodeLength(settings->Title)); |
244 | Buffer[(*Length)++] = 0x01; //END PARMeter | 244 | Buffer[(*Length)++] = 0x01; //END PARMeter |
245 | Buffer[(*Length)++] = 0x01; //END PARMeter | 245 | Buffer[(*Length)++] = 0x01; //END PARMeter |
246 | } | 246 | } |
247 | 247 | ||
248 | /* http://forum.nokia.com: OTA Settings 7.0 */ | 248 | /* http://forum.nokia.com: OTA Settings 7.0 */ |
249 | /* first it used default/ISO coding */ | ||
250 | /* Joergen Thomsen changed to UTF8 */ | ||
249 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) | 251 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) |
250 | { | 252 | { |
251 | unsigned charbuffer[100]; | 253 | unsigned charbuffer[100]; |
252 | bool UnicodeCoding = false; | ||
253 | 254 | ||
254 | EncodeUTF8QuotedPrintable(buffer,bookmark->Title); | 255 | // bool UnicodeCoding = false; |
255 | if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; | 256 | //EncodeUTF8QuotedPrintable(buffer,bookmark->Title); |
257 | //if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; | ||
256 | 258 | ||
257 | Buffer[(*Length)++] = 0x01; //Push ID | 259 | Buffer[(*Length)++] = 0x01; //Push ID |
258 | Buffer[(*Length)++] = 0x06; //PDU Type (push) | 260 | Buffer[(*Length)++] = 0x06; //PDU Type (push) |
259 | Buffer[(*Length)++] = 0x2D; //Headers length (content type + headers) | 261 | Buffer[(*Length)++] = 0x2D; //Headers length (content type + headers) |
260 | strcpy(Buffer+(*Length),"\x1F\x2B"); | 262 | strcpy(Buffer+(*Length),"\x1F\x2B"); |
261 | (*Length)=(*Length)+2; //Value length | 263 | (*Length)=(*Length)+2; //Value length |
262 | strcpy(Buffer+(*Length),"application/x-wap-prov.browser-bookmarks"); | 264 | strcpy(Buffer+(*Length),"application/x-wap-prov.browser-bookmarks"); |
263 | (*Length)=(*Length)+40; //MIME-Type | 265 | (*Length)=(*Length)+40; //MIME-Type |
264 | Buffer[(*Length)++] = 0x00; //end inline string | 266 | Buffer[(*Length)++] = 0x00; //end inline string |
265 | strcpy(Buffer+(*Length),"\x81\xEA"); | 267 | strcpy(Buffer+(*Length),"\x81\xEA"); |
266 | (*Length)=(*Length)+2; //charset UTF-8 short int. | 268 | (*Length)=(*Length)+2; //charset UTF-8 short int. |
267 | 269 | ||
270 | /* removed by Joergen Thomsen */ | ||
268 | /* Block from sniffs. UNKNOWN */ | 271 | /* Block from sniffs. UNKNOWN */ |
269 | if (!UnicodeCoding) { | 272 | //if (!UnicodeCoding) { |
270 | Buffer[(*Length)++] = 0x00; | 273 | // Buffer[(*Length)++] = 0x00; |
271 | Buffer[(*Length)++] = 0x01; | 274 | // Buffer[(*Length)++] = 0x01; |
272 | } else { | 275 | //} else { |
273 | strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); | 276 | // strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); |
274 | (*Length)=(*Length)+4; | 277 | // (*Length)=(*Length)+4; |
275 | } | 278 | //} |
276 | Buffer[(*Length)++] = 0x00; | 279 | //Buffer[(*Length)++] = 0x00; |
280 | |||
281 | /* added by Joergen Thomsen */ | ||
282 | Buffer[(*Length)++] = 0x01; // Version WBXML 1.1 | ||
283 | Buffer[(*Length)++] = 0x01; // Unknown public identifier | ||
284 | Buffer[(*Length)++] = 0x6A; // charset UTF-8 | ||
285 | Buffer[(*Length)++] = 0x00; // string table length | ||
277 | 286 | ||
278 | Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content | 287 | Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content |
279 | /* URL */ | 288 | /* URL */ |
280 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes | 289 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes |
281 | Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK | 290 | Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK |
282 | Buffer[(*Length)++] = 0x01; //END PARMeter | 291 | Buffer[(*Length)++] = 0x01; //END PARMeter |
283 | if (!UnicodeCoding) { | 292 | |
284 | /* TITLE */ | 293 | /* removed by Joergen Thomsen */ |
285 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); | 294 | // if (!UnicodeCoding) { |
286 | /* URL */ | 295 | // /* TITLE */ |
287 | AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); | 296 | // AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); |
288 | } else { | 297 | // /* URL */ |
298 | // AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); | ||
299 | // } else { | ||
300 | // /* TITLE */ | ||
301 | // AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); | ||
302 | // /* URL */ | ||
303 | // AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); | ||
304 | // } | ||
305 | |||
306 | /* added by Joergen Thomsen */ | ||
289 | /* TITLE */ | 307 | /* TITLE */ |
290 | AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); | 308 | EncodeUTF8(buffer, bookmark->Title); |
309 | AddWAPSMSParameterText(Buffer, Length, 0x15, buffer, strlen(buffer)); | ||
291 | /* URL */ | 310 | /* URL */ |
292 | AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); | 311 | EncodeUTF8(buffer, bookmark->Address); |
312 | AddWAPSMSParameterText(Buffer, Length, 0x17, buffer, strlen(buffer)); | ||
313 | |||
314 | Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC) | ||
315 | Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC-LIST) | ||
293 | } | 316 | } |
294 | Buffer[(*Length)++] = 0x01; //END PARMeter | 317 | |
295 | Buffer[(*Length)++] = 0x01; //END PARMeter | 318 | void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL) |
319 | { | ||
320 | int i; | ||
321 | |||
322 | Buffer[(*Length)++] = 0x01; //Push ID | ||
323 | Buffer[(*Length)++] = 0x06; //PDU Type (push) | ||
324 | Buffer[(*Length)++] = 28; //Headers length (content type + headers) | ||
325 | strcpy(Buffer+(*Length),"\x1F\x23"); | ||
326 | (*Length)=(*Length)+2; //Value length | ||
327 | strcpy(Buffer+(*Length),"application/vnd.wap.sic"); | ||
328 | (*Length)=(*Length)+23; //MIME-Type | ||
329 | Buffer[(*Length)++] = 0x00; //end inline string | ||
330 | strcpy(Buffer+(*Length),"\x81\xEA"); | ||
331 | (*Length)=(*Length)+2; //charset UTF-8 short int. | ||
332 | |||
333 | Buffer[(*Length)++] = 0x02; // WBXML 1.2 | ||
334 | Buffer[(*Length)++] = 0x05; // SI 1.0 Public Identifier | ||
335 | Buffer[(*Length)++] = 0x6A; // charset UTF-8 | ||
336 | Buffer[(*Length)++] = 0x00; // string table length | ||
337 | Buffer[(*Length)++] = 0x45; // SI with content | ||
338 | Buffer[(*Length)++] = 0xC6; // indication with content and attributes | ||
339 | Buffer[(*Length)++] = 0x0B;// address | ||
340 | Buffer[(*Length)++] = 0x03; // Inline string | ||
341 | for (i=0;i<(int)strlen(URL);i++) { | ||
342 | Buffer[(*Length)++] = URL[i];//Text | ||
343 | } | ||
344 | Buffer[(*Length)++] = 0x00; // END Inline string | ||
345 | |||
346 | #ifdef XXX | ||
347 | Buffer[(*Length)++] = 0x0A;// created... | ||
348 | Buffer[(*Length)++] = 0xC3;// OPAQUE | ||
349 | Buffer[(*Length)++] = 0x07;// length | ||
350 | Buffer[(*Length)++] = 0x19;// year | ||
351 | Buffer[(*Length)++] = 0x80;// year | ||
352 | Buffer[(*Length)++] = 0x21;// month | ||
353 | Buffer[(*Length)++] = 0x12;// .. | ||
354 | Buffer[(*Length)++] = 0x00;// .. | ||
355 | Buffer[(*Length)++] = 0x00;// .. | ||
356 | Buffer[(*Length)++] = 0x00;// .. | ||
357 | Buffer[(*Length)++] = 0x10;// expires | ||
358 | Buffer[(*Length)++] = 0xC3;// OPAQUE | ||
359 | Buffer[(*Length)++] = 0x04;// length | ||
360 | Buffer[(*Length)++] = 0x20;// year | ||
361 | Buffer[(*Length)++] = 0x10;// year | ||
362 | Buffer[(*Length)++] = 0x06;// month | ||
363 | Buffer[(*Length)++] = 0x25;// day | ||
364 | #endif | ||
365 | |||
366 | Buffer[(*Length)++] = 0x01; // END (indication) | ||
367 | Buffer[(*Length)++] = 0x03; // Inline string | ||
368 | for (i=0;i<(int)strlen(Text);i++) { | ||
369 | Buffer[(*Length)++] = Text[i];//Text | ||
370 | } | ||
371 | Buffer[(*Length)++] = 0x00; // END Inline string | ||
372 | Buffer[(*Length)++] = 0x01; // END (indication) | ||
373 | Buffer[(*Length)++] = 0x01; // END (SI) | ||
296 | } | 374 | } |
297 | 375 | ||
298 | void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length) | 376 | void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length) |
299 | { | 377 | { |
300 | int i; | 378 | int i; |
301 | 379 | ||
302 | strcpy(Buffer+(*Length),"\x8C\x80\x98\x4F"); | 380 | strcpy(Buffer+(*Length),"\x8C\x80\x98\x4F"); |
303 | (*Length)=(*Length)+4; | 381 | (*Length)=(*Length)+4; |
304 | 382 | ||
305 | /* Unique MMS ID ? */ | 383 | /* Unique MMS ID ? */ |
306 | strcpy(Buffer+(*Length),"123456789"); | 384 | strcpy(Buffer+(*Length),"123456789"); |
307 | (*Length)=(*Length)+9; | 385 | (*Length)=(*Length)+9; |
308 | Buffer[(*Length)++] = 0x00; | 386 | Buffer[(*Length)++] = 0x00; |
309 | 387 | ||
310 | strcpy(Buffer+(*Length),"\x8D\x90\x89"); | 388 | strcpy(Buffer+(*Length),"\x8D\x90\x89"); |
311 | (*Length)=(*Length)+3; | 389 | (*Length)=(*Length)+3; |
312 | 390 | ||
313 | strcpy(Buffer+(*Length),"\x01\x81\x86\x81\x96"); | 391 | strcpy(Buffer+(*Length),"\x01\x81\x86\x81\x96"); |
314 | (*Length)=(*Length)+5; | 392 | (*Length)=(*Length)+5; |
315 | 393 | ||
316 | if (UnicodeLength(Info->Subject) != 0) { | 394 | if (UnicodeLength(Info->Subject) != 0) { |
317 | sprintf(Buffer+(*Length),"%s",DecodeUnicodeString(Info->Subject)); | 395 | sprintf(Buffer+(*Length),"%s",DecodeUnicodeString(Info->Subject)); |
318 | (*Length)=(*Length)+UnicodeLength(Info->Subject); | 396 | (*Length)=(*Length)+UnicodeLength(Info->Subject); |
319 | Buffer[(*Length)++] = 0x00; | 397 | Buffer[(*Length)++] = 0x00; |
diff --git a/gammu/emb/common/service/gsmdata.h b/gammu/emb/common/service/gsmdata.h index f5f8e07..e81589f 100644 --- a/gammu/emb/common/service/gsmdata.h +++ b/gammu/emb/common/service/gsmdata.h | |||
@@ -67,48 +67,50 @@ typedef struct { | |||
67 | 67 | ||
68 | void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_WAPSettings *settings, bool MMS); | 68 | void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_WAPSettings *settings, bool MMS); |
69 | 69 | ||
70 | /* -------------------------------- WAP Bookmark --------------------------- */ | 70 | /* -------------------------------- WAP Bookmark --------------------------- */ |
71 | 71 | ||
72 | typedef struct { | 72 | typedef struct { |
73 | char Address [(255+1)*2]; | 73 | char Address [(255+1)*2]; |
74 | char Title [(50+1)*2]; | 74 | char Title [(50+1)*2]; |
75 | int Location; | 75 | int Location; |
76 | } GSM_WAPBookmark; | 76 | } GSM_WAPBookmark; |
77 | 77 | ||
78 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark); | 78 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark); |
79 | GSM_Error GSM_EncodeURLFile (unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark); | 79 | GSM_Error GSM_EncodeURLFile (unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark); |
80 | 80 | ||
81 | /* ------------------------------ MMS Indicator ---------------------------- */ | 81 | /* ------------------------------ MMS Indicator ---------------------------- */ |
82 | 82 | ||
83 | typedef struct { | 83 | typedef struct { |
84 | unsigned char Address[500]; | 84 | unsigned char Address[500]; |
85 | unsigned char Title[200]; | 85 | unsigned char Title[200]; |
86 | unsigned char Sender[200]; | 86 | unsigned char Sender[200]; |
87 | } GSM_MMSIndicator; | 87 | } GSM_MMSIndicator; |
88 | 88 | ||
89 | void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, int *Length, GSM_MMSIndicator Indicator); | 89 | void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, int *Length, GSM_MMSIndicator Indicator); |
90 | 90 | ||
91 | void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL); | ||
92 | |||
91 | /* ------------------------------ MMS file --------------------------------- */ | 93 | /* ------------------------------ MMS file --------------------------------- */ |
92 | 94 | ||
93 | #define MAX_MULTI_MMS 20 | 95 | #define MAX_MULTI_MMS 20 |
94 | 96 | ||
95 | typedef enum { | 97 | typedef enum { |
96 | MMS_Text = 1, | 98 | MMS_Text = 1, |
97 | MMS_Bitmap_JPG | 99 | MMS_Bitmap_JPG |
98 | } EncodeMultiPartMMSID; | 100 | } EncodeMultiPartMMSID; |
99 | 101 | ||
100 | typedef struct { | 102 | typedef struct { |
101 | EncodeMultiPartMMSID ID; | 103 | EncodeMultiPartMMSID ID; |
102 | 104 | ||
103 | GSM_File File; | 105 | GSM_File File; |
104 | unsigned char *Buffer; | 106 | unsigned char *Buffer; |
105 | } EncodeMultiPartMMSEntry; | 107 | } EncodeMultiPartMMSEntry; |
106 | 108 | ||
107 | typedef struct { | 109 | typedef struct { |
108 | /* Input values */ | 110 | /* Input values */ |
109 | EncodeMultiPartMMSEntry Entries[MAX_MULTI_MMS]; | 111 | EncodeMultiPartMMSEntry Entries[MAX_MULTI_MMS]; |
110 | int EntriesNum; | 112 | int EntriesNum; |
111 | 113 | ||
112 | unsigned char Source[200]; | 114 | unsigned char Source[200]; |
113 | unsigned char Destination[200]; | 115 | unsigned char Destination[200]; |
114 | unsigned char Subject[200]; | 116 | unsigned char Subject[200]; |
diff --git a/gammu/emb/common/service/gsmlogo.c b/gammu/emb/common/service/gsmlogo.c index c992915..7c19967 100644 --- a/gammu/emb/common/service/gsmlogo.c +++ b/gammu/emb/common/service/gsmlogo.c | |||
@@ -1,28 +1,29 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <sys/stat.h> | ||
5 | 6 | ||
6 | #include "../misc/misc.h" | 7 | #include "../misc/misc.h" |
7 | #include "../misc/coding/coding.h" | 8 | #include "../misc/coding/coding.h" |
8 | #include "gsmlogo.h" | 9 | #include "gsmlogo.h" |
9 | #include "gsmnet.h" | 10 | #include "gsmnet.h" |
10 | 11 | ||
11 | void PHONE_GetBitmapWidthHeight(GSM_Phone_Bitmap_Types Type, int *width, int *height) | 12 | void PHONE_GetBitmapWidthHeight(GSM_Phone_Bitmap_Types Type, int *width, int *height) |
12 | { | 13 | { |
13 | *width = 0; | 14 | *width = 0; |
14 | *height= 0; | 15 | *height= 0; |
15 | switch (Type) { | 16 | switch (Type) { |
16 | case GSM_EMSSmallPicture: *width=8; *height=8; break; | 17 | case GSM_EMSSmallPicture: *width=8; *height=8; break; |
17 | case GSM_EMSMediumPicture: *width=16; *height=16; break; | 18 | case GSM_EMSMediumPicture: *width=16; *height=16; break; |
18 | case GSM_EMSBigPicture : *width=32; *height=32; break; | 19 | case GSM_EMSBigPicture : *width=32; *height=32; break; |
19 | case GSM_NokiaOperatorLogo: | 20 | case GSM_NokiaOperatorLogo: |
20 | case GSM_NokiaCallerLogo: *width=72; *height=14; break; | 21 | case GSM_NokiaCallerLogo: *width=72; *height=14; break; |
21 | case GSM_NokiaPictureImage: *width=72; *height=28; break; | 22 | case GSM_NokiaPictureImage: *width=72; *height=28; break; |
22 | case GSM_Nokia7110OperatorLogo: | 23 | case GSM_Nokia7110OperatorLogo: |
23 | case GSM_Nokia6510OperatorLogo: *width=78; *height=21; break; | 24 | case GSM_Nokia6510OperatorLogo: *width=78; *height=21; break; |
24 | case GSM_NokiaStartupLogo: *width=84; *height=48; break; | 25 | case GSM_NokiaStartupLogo: *width=84; *height=48; break; |
25 | case GSM_Nokia6210StartupLogo: *width=96; *height=60; break; | 26 | case GSM_Nokia6210StartupLogo: *width=96; *height=60; break; |
26 | case GSM_Nokia7110StartupLogo: *width=96; *height=65; break; | 27 | case GSM_Nokia7110StartupLogo: *width=96; *height=65; break; |
27 | case GSM_EMSVariablePicture : break; | 28 | case GSM_EMSVariablePicture : break; |
28 | case GSM_AlcatelBMMIPicture : break; | 29 | case GSM_AlcatelBMMIPicture : break; |
@@ -140,48 +141,49 @@ void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *B | |||
140 | case GSM_NokiaCallerLogo : Bitmap->Type=GSM_CallerGroupLogo;break; | 141 | case GSM_NokiaCallerLogo : Bitmap->Type=GSM_CallerGroupLogo;break; |
141 | case GSM_AlcatelBMMIPicture : | 142 | case GSM_AlcatelBMMIPicture : |
142 | case GSM_NokiaStartupLogo: | 143 | case GSM_NokiaStartupLogo: |
143 | case GSM_Nokia7110StartupLogo: | 144 | case GSM_Nokia7110StartupLogo: |
144 | case GSM_Nokia6210StartupLogo : Bitmap->Type=GSM_StartupLogo; break; | 145 | case GSM_Nokia6210StartupLogo : Bitmap->Type=GSM_StartupLogo; break; |
145 | case GSM_NokiaPictureImage: | 146 | case GSM_NokiaPictureImage: |
146 | case GSM_EMSVariablePicture: | 147 | case GSM_EMSVariablePicture: |
147 | case GSM_EMSSmallPicture: | 148 | case GSM_EMSSmallPicture: |
148 | case GSM_EMSMediumPicture: | 149 | case GSM_EMSMediumPicture: |
149 | case GSM_EMSBigPicture : Bitmap->Type=GSM_PictureImage;break; | 150 | case GSM_EMSBigPicture : Bitmap->Type=GSM_PictureImage;break; |
150 | } | 151 | } |
151 | 152 | ||
152 | Bitmap->Location = 0; | 153 | Bitmap->Location = 0; |
153 | Bitmap->Text[0] = 0; | 154 | Bitmap->Text[0] = 0; |
154 | Bitmap->Text[1] = 0; | 155 | Bitmap->Text[1] = 0; |
155 | Bitmap->BitmapEnabled = false; | 156 | Bitmap->BitmapEnabled = false; |
156 | Bitmap->DefaultName = false; | 157 | Bitmap->DefaultName = false; |
157 | Bitmap->DefaultBitmap = false; | 158 | Bitmap->DefaultBitmap = false; |
158 | Bitmap->DefaultRingtone = false; | 159 | Bitmap->DefaultRingtone = false; |
159 | Bitmap->RingtoneID = 0; | 160 | Bitmap->RingtoneID = 0; |
160 | Bitmap->NetworkCode[0] = 0; | 161 | Bitmap->NetworkCode[0] = 0; |
161 | Bitmap->Sender[0] = 0; | 162 | Bitmap->Sender[0] = 0; |
162 | Bitmap->Sender[1] = 0; | 163 | Bitmap->Sender[1] = 0; |
163 | Bitmap->ID = 0; | 164 | Bitmap->ID = 0; |
165 | Bitmap->Name = NULL; | ||
164 | 166 | ||
165 | GSM_ClearBitmap(Bitmap); | 167 | GSM_ClearBitmap(Bitmap); |
166 | for (x=0;x<Bitmap->BitmapWidth;x++) { | 168 | for (x=0;x<Bitmap->BitmapWidth;x++) { |
167 | for (y=0;y<Bitmap->BitmapHeight;y++) { | 169 | for (y=0;y<Bitmap->BitmapHeight;y++) { |
168 | if (PHONE_IsPointBitmap(Type, buffer, x, y, Bitmap->BitmapWidth, Bitmap->BitmapHeight)) { | 170 | if (PHONE_IsPointBitmap(Type, buffer, x, y, Bitmap->BitmapWidth, Bitmap->BitmapHeight)) { |
169 | GSM_SetPointBitmap(Bitmap,x,y); | 171 | GSM_SetPointBitmap(Bitmap,x,y); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | } | 174 | } |
173 | } | 175 | } |
174 | 176 | ||
175 | void PHONE_ClearBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, int width, int height) | 177 | void PHONE_ClearBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, int width, int height) |
176 | { | 178 | { |
177 | memset(buffer,0,PHONE_GetBitmapSize(Type,width,height)); | 179 | memset(buffer,0,PHONE_GetBitmapSize(Type,width,height)); |
178 | } | 180 | } |
179 | 181 | ||
180 | void PHONE_EncodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap) | 182 | void PHONE_EncodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap) |
181 | { | 183 | { |
182 | int width, height, x, y; | 184 | int width, height, x, y; |
183 | GSM_Bitmapdest; | 185 | GSM_Bitmapdest; |
184 | 186 | ||
185 | PHONE_GetBitmapWidthHeight(Type, &width, &height); | 187 | PHONE_GetBitmapWidthHeight(Type, &width, &height); |
186 | if (width == 0 && height == 0) { | 188 | if (width == 0 && height == 0) { |
187 | width = Bitmap->BitmapWidth; | 189 | width = Bitmap->BitmapWidth; |
@@ -605,59 +607,59 @@ static GSM_Error savensl(FILE *file, GSM_MultiBitmap *bitmap) | |||
605 | static GSM_Error savewbmp(FILE *file, GSM_MultiBitmap *bitmap) | 607 | static GSM_Error savewbmp(FILE *file, GSM_MultiBitmap *bitmap) |
606 | { | 608 | { |
607 | unsigned char buffer[4]; | 609 | unsigned char buffer[4]; |
608 | 610 | ||
609 | buffer[0] = 0x00; | 611 | buffer[0] = 0x00; |
610 | buffer[1] = 0x00; | 612 | buffer[1] = 0x00; |
611 | buffer[2] = bitmap->Bitmap[0].BitmapWidth; | 613 | buffer[2] = bitmap->Bitmap[0].BitmapWidth; |
612 | buffer[3] = bitmap->Bitmap[0].BitmapHeight; | 614 | buffer[3] = bitmap->Bitmap[0].BitmapHeight; |
613 | fwrite(buffer,1,4,file); | 615 | fwrite(buffer,1,4,file); |
614 | 616 | ||
615 | PrivSaveNLMWBMP(file, &bitmap->Bitmap[0]); | 617 | PrivSaveNLMWBMP(file, &bitmap->Bitmap[0]); |
616 | 618 | ||
617 | return ERR_NONE; | 619 | return ERR_NONE; |
618 | } | 620 | } |
619 | 621 | ||
620 | GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) | 622 | GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) |
621 | { | 623 | { |
622 | FILE *file; | 624 | FILE *file; |
623 | GSM_Error error=ERR_NONE; | 625 | GSM_Error error=ERR_NONE; |
624 | 626 | ||
625 | file = fopen(FileName, "wb"); | 627 | file = fopen(FileName, "wb"); |
626 | if (file == NULL) return ERR_CANTOPENFILE; | 628 | if (file == NULL) return ERR_CANTOPENFILE; |
627 | 629 | ||
628 | /* Attempt to identify filetype */ | 630 | /* Attempt to identify filetype */ |
629 | if (strstr(FileName,".nlm")) { | 631 | if (mystrcasestr(FileName,".nlm")) { |
630 | error=savenlm(file,bitmap); | 632 | error=savenlm(file,bitmap); |
631 | } else if (strstr(FileName,".ngg")) { | 633 | } else if (mystrcasestr(FileName,".ngg")) { |
632 | error=savengg(file,bitmap); | 634 | error=savengg(file,bitmap); |
633 | } else if (strstr(FileName,".nol")) { | 635 | } else if (mystrcasestr(FileName,".nol")) { |
634 | error=savenol(file,bitmap); | 636 | error=savenol(file,bitmap); |
635 | } else if (strstr(FileName,".xpm")) { | 637 | } else if (mystrcasestr(FileName,".xpm")) { |
636 | error=savexpm(file,bitmap); | 638 | error=savexpm(file,bitmap); |
637 | } else if (strstr(FileName,".nsl")) { | 639 | } else if (mystrcasestr(FileName,".nsl")) { |
638 | error=savensl(file,bitmap); | 640 | error=savensl(file,bitmap); |
639 | } else if (strstr(FileName,".wbmp")) { | 641 | } else if (mystrcasestr(FileName,".wbmp")) { |
640 | error=savewbmp(file,bitmap); | 642 | error=savewbmp(file,bitmap); |
641 | } else { | 643 | } else { |
642 | error=savebmp(file,bitmap); | 644 | error=savebmp(file,bitmap); |
643 | } | 645 | } |
644 | fclose(file); | 646 | fclose(file); |
645 | 647 | ||
646 | return error; | 648 | return error; |
647 | } | 649 | } |
648 | 650 | ||
649 | GSM_Error BMP2Bitmap(unsigned char *buffer, FILE *file,GSM_Bitmap *bitmap) | 651 | GSM_Error BMP2Bitmap(unsigned char *buffer, FILE *file,GSM_Bitmap *bitmap) |
650 | { | 652 | { |
651 | bool first_white,isfile=false; | 653 | bool first_white,isfile=false; |
652 | unsigned char buff[34]; | 654 | unsigned char buff[34]; |
653 | int w,h,pos,y,x,i,buffpos=0; | 655 | int w,h,pos,y,x,i,buffpos=0; |
654 | #ifdef DEBUG | 656 | #ifdef DEBUG |
655 | int sizeimage=0; | 657 | int sizeimage=0; |
656 | #endif | 658 | #endif |
657 | 659 | ||
658 | if (bitmap->Type == GSM_None) bitmap->Type = GSM_StartupLogo; | 660 | if (bitmap->Type == GSM_None) bitmap->Type = GSM_StartupLogo; |
659 | if (file!=NULL) isfile=true; | 661 | if (file!=NULL) isfile=true; |
660 | if (isfile) { | 662 | if (isfile) { |
661 | fread(buff, 1, 34, file); | 663 | fread(buff, 1, 34, file); |
662 | } else { | 664 | } else { |
663 | memcpy(buff,buffer,34); | 665 | memcpy(buff,buffer,34); |
@@ -934,70 +936,103 @@ static GSM_Error loadnsl(FILE *file, GSM_MultiBitmap *bitmap) | |||
934 | } | 936 | } |
935 | } | 937 | } |
936 | } | 938 | } |
937 | } | 939 | } |
938 | bitmap->Number = 1; | 940 | bitmap->Number = 1; |
939 | return(ERR_NONE); | 941 | return(ERR_NONE); |
940 | } | 942 | } |
941 | 943 | ||
942 | static GSM_Error loadwbmp(FILE *file, GSM_MultiBitmap *bitmap) | 944 | static GSM_Error loadwbmp(FILE *file, GSM_MultiBitmap *bitmap) |
943 | { | 945 | { |
944 | unsigned char buffer[10000]; | 946 | unsigned char buffer[10000]; |
945 | 947 | ||
946 | fread(buffer,1,4,file); | 948 | fread(buffer,1,4,file); |
947 | bitmap->Bitmap[0].BitmapWidth = buffer[2]; | 949 | bitmap->Bitmap[0].BitmapWidth = buffer[2]; |
948 | bitmap->Bitmap[0].BitmapHeight = buffer[3]; | 950 | bitmap->Bitmap[0].BitmapHeight = buffer[3]; |
949 | bitmap->Number = 1; | 951 | bitmap->Number = 1; |
950 | 952 | ||
951 | fread(buffer,1,10000,file); | 953 | fread(buffer,1,10000,file); |
952 | PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo, buffer, &bitmap->Bitmap[0]); | 954 | PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo, buffer, &bitmap->Bitmap[0]); |
953 | GSM_ReverseBitmap(&bitmap->Bitmap[0]); | 955 | GSM_ReverseBitmap(&bitmap->Bitmap[0]); |
954 | 956 | ||
955 | return ERR_NONE; | 957 | return ERR_NONE; |
956 | } | 958 | } |
957 | 959 | ||
960 | static GSM_Error loadgif(FILE *file, GSM_MultiBitmap *bitmap) | ||
961 | { | ||
962 | GSM_Bitmap *bmap = &bitmap->Bitmap[0]; | ||
963 | char *buffer; | ||
964 | struct stat st; | ||
965 | int length; | ||
966 | |||
967 | dbgprintf("loading gif file\n"); | ||
968 | fstat(fileno(file), &st); | ||
969 | bmap->BinaryPic.Length = length = st.st_size; | ||
970 | bmap->BinaryPic.Buffer = buffer = malloc(length); | ||
971 | if (bmap->BinaryPic.Buffer == NULL) | ||
972 | return ERR_MOREMEMORY; | ||
973 | |||
974 | fread(buffer, 1, length, file); | ||
975 | dbgprintf("Length %i name \"%s\"\n", length, | ||
976 | DecodeUnicodeString(bmap->Name)); | ||
977 | |||
978 | bmap->Type = GSM_PictureBinary; | ||
979 | bmap->BinaryPic.Type = PICTURE_GIF; | ||
980 | bmap->BitmapWidth = 256 * buffer[7] + buffer[6]; | ||
981 | bmap->BitmapHeight = 256 * buffer[9] + buffer[8]; | ||
982 | bitmap->Number = 1; | ||
983 | |||
984 | return ERR_NONE; | ||
985 | } | ||
986 | |||
958 | GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) | 987 | GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) |
959 | { | 988 | { |
960 | FILE *file; | 989 | FILE *file; |
961 | unsigned charbuffer[300]; | 990 | unsigned charbuffer[300]; |
962 | 991 | ||
963 | file = fopen(FileName, "rb"); | 992 | file = fopen(FileName, "rb"); |
964 | if (file == NULL) return ERR_CANTOPENFILE; | 993 | if (file == NULL) return ERR_CANTOPENFILE; |
965 | 994 | ||
995 | bitmap->Bitmap[0].Name = malloc((strlen(FileName) + 1) * 2); | ||
996 | if (bitmap->Bitmap[0].Name == NULL) return ERR_MOREMEMORY; | ||
997 | EncodeUnicode(bitmap->Bitmap[0].Name, FileName, strlen(FileName)); | ||
998 | |||
966 | fread(buffer, 1, 9, file); /* Read the header of the file. */ | 999 | fread(buffer, 1, 9, file); /* Read the header of the file. */ |
967 | rewind(file); | 1000 | rewind(file); |
968 | 1001 | ||
969 | bitmap->Bitmap[0].DefaultBitmap = false; | 1002 | bitmap->Bitmap[0].DefaultBitmap = false; |
970 | 1003 | ||
971 | /* Attempt to identify filetype */ | 1004 | /* Attempt to identify filetype */ |
972 | if (memcmp(buffer, "BM",2)==0) { | 1005 | if (memcmp(buffer, "BM",2)==0) { |
973 | return loadbmp(file,bitmap); | 1006 | return loadbmp(file,bitmap); |
974 | } else if (buffer[0] == 0x00 && buffer[1] == 0x00) { | 1007 | } else if (buffer[0] == 0x00 && buffer[1] == 0x00) { |
975 | return loadwbmp(file,bitmap); | 1008 | return loadwbmp(file,bitmap); |
976 | } else if (memcmp(buffer, "NLM",3)==0) { | 1009 | } else if (memcmp(buffer, "NLM",3)==0) { |
977 | return loadnlm(file,bitmap); | 1010 | return loadnlm(file,bitmap); |
978 | } else if (memcmp(buffer, "NOL",3)==0) { | 1011 | } else if (memcmp(buffer, "NOL",3)==0) { |
979 | return loadnolngg(file,bitmap,true); | 1012 | return loadnolngg(file,bitmap,true); |
980 | } else if (memcmp(buffer, "NGG",3)==0) { | 1013 | } else if (memcmp(buffer, "NGG",3)==0) { |
981 | return loadnolngg(file,bitmap,false); | 1014 | return loadnolngg(file,bitmap,false); |
982 | } else if (memcmp(buffer, "FORM",4)==0) { | 1015 | } else if (memcmp(buffer, "FORM",4)==0) { |
983 | return loadnsl(file,bitmap); | 1016 | return loadnsl(file,bitmap); |
1017 | } else if (memcmp(buffer, "GIF",3)==0) { | ||
1018 | return loadgif(file,bitmap); | ||
984 | } | 1019 | } |
985 | return ERR_UNKNOWN; | 1020 | return ERR_UNKNOWN; |
986 | } | 1021 | } |
987 | 1022 | ||
988 | void NOKIA_CopyBitmap(GSM_Phone_Bitmap_Types Type, GSM_Bitmap *Bitmap, char *Buffer, int *Length) | 1023 | void NOKIA_CopyBitmap(GSM_Phone_Bitmap_Types Type, GSM_Bitmap *Bitmap, char *Buffer, int *Length) |
989 | { | 1024 | { |
990 | int Width, Height; | 1025 | int Width, Height; |
991 | 1026 | ||
992 | Buffer[(*Length)++] = 0x00; | 1027 | Buffer[(*Length)++] = 0x00; |
993 | PHONE_GetBitmapWidthHeight(Type, &Width, &Height); | 1028 | PHONE_GetBitmapWidthHeight(Type, &Width, &Height); |
994 | Buffer[(*Length)++] = Width; | 1029 | Buffer[(*Length)++] = Width; |
995 | Buffer[(*Length)++] = Height; | 1030 | Buffer[(*Length)++] = Height; |
996 | Buffer[(*Length)++] = 0x01; | 1031 | Buffer[(*Length)++] = 0x01; |
997 | PHONE_EncodeBitmap(Type, Buffer + (*Length), Bitmap); | 1032 | PHONE_EncodeBitmap(Type, Buffer + (*Length), Bitmap); |
998 | (*Length) = (*Length) + PHONE_GetBitmapSize(Type,0,0); | 1033 | (*Length) = (*Length) + PHONE_GetBitmapSize(Type,0,0); |
999 | } | 1034 | } |
1000 | 1035 | ||
1001 | /* How should editor hadle tabs in this file? Add editor commands here. | 1036 | /* How should editor hadle tabs in this file? Add editor commands here. |
1002 | * vim: noexpandtab sw=8 ts=8 sts=8: | 1037 | * vim: noexpandtab sw=8 ts=8 sts=8: |
1003 | */ | 1038 | */ |
diff --git a/gammu/emb/common/service/gsmlogo.h b/gammu/emb/common/service/gsmlogo.h index b1b579d..6c6e2d8 100644 --- a/gammu/emb/common/service/gsmlogo.h +++ b/gammu/emb/common/service/gsmlogo.h | |||
@@ -1,72 +1,90 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef __gsm_bitmaps_h | 3 | #ifndef __gsm_bitmaps_h |
4 | #define __gsm_bitmaps_h | 4 | #define __gsm_bitmaps_h |
5 | 5 | ||
6 | #include "../gsmcomon.h" | 6 | #include "../gsmcomon.h" |
7 | 7 | ||
8 | typedef enum { | ||
9 | PICTURE_BMP = 1, | ||
10 | PICTURE_GIF, | ||
11 | PICTURE_JPG, | ||
12 | PICTURE_ICN, | ||
13 | PICTURE_PNG | ||
14 | } GSM_BinaryPicture_Types; | ||
15 | |||
16 | typedef struct { | ||
17 | GSM_BinaryPicture_Types Type; | ||
18 | unsigned char *Buffer; | ||
19 | int Length; | ||
20 | } GSM_BinaryPicture; | ||
21 | |||
8 | /** | 22 | /** |
9 | * Enum to handle all possible bitmaps, which are not saved in various filesystems. | 23 | * Enum to handle all possible bitmaps, which are not saved in various filesystems. |
10 | */ | 24 | */ |
11 | typedef enum { | 25 | typedef enum { |
12 | GSM_None = 1, | 26 | GSM_None = 1, |
13 | /** | 27 | /** |
14 | * ID of static file in filesystem displayed during startup | 28 | * ID of static file in filesystem displayed during startup |
15 | */ | 29 | */ |
16 | GSM_ColourStartupLogo_ID, | 30 | GSM_ColourStartupLogo_ID, |
17 | /** | 31 | /** |
18 | * Static mono bitmap/ID of animated mono bitmap displayed during startup | 32 | * Static mono bitmap/ID of animated mono bitmap displayed during startup |
19 | */ | 33 | */ |
20 | GSM_StartupLogo, | 34 | GSM_StartupLogo, |
21 | /** | 35 | /** |
22 | * ID of static file in filesystem displayed instead of operator name | 36 | * ID of static file in filesystem displayed instead of operator name |
23 | */ | 37 | */ |
24 | GSM_ColourOperatorLogo_ID, | 38 | GSM_ColourOperatorLogo_ID, |
25 | /** | 39 | /** |
26 | * Mono bitmap displayed instead of operator name | 40 | * Mono bitmap displayed instead of operator name |
27 | */ | 41 | */ |
28 | GSM_OperatorLogo, | 42 | GSM_OperatorLogo, |
29 | /** | 43 | /** |
30 | * ID of static file in filesystem displayed as wallpaper | 44 | * ID of static file in filesystem displayed as wallpaper |
31 | */ | 45 | */ |
32 | GSM_ColourWallPaper_ID, | 46 | GSM_ColourWallPaper_ID, |
33 | /** | 47 | /** |
34 | * Mono bitmap assigned to caller group | 48 | * Mono bitmap assigned to caller group |
35 | */ | 49 | */ |
36 | GSM_CallerGroupLogo, | 50 | GSM_CallerGroupLogo, |
37 | /** | 51 | /** |
38 | * Text displayed during startup, which can't be removed from phone menu | 52 | * Text displayed during startup, which can't be removed from phone menu |
39 | */ | 53 | */ |
40 | GSM_DealerNote_Text, | 54 | GSM_DealerNote_Text, |
41 | /** | 55 | /** |
42 | * Text displayed during startup | 56 | * Text displayed during startup |
43 | */ | 57 | */ |
44 | GSM_WelcomeNote_Text, | 58 | GSM_WelcomeNote_Text, |
45 | /** | 59 | /** |
46 | * Image defined in Smart Messaging specification | 60 | * Image defined in Smart Messaging specification |
47 | */ | 61 | */ |
48 | GSM_PictureImage | 62 | GSM_PictureImage, |
63 | /** | ||
64 | * Binary picture (BMP, GIF, etc.) | ||
65 | */ | ||
66 | GSM_PictureBinary | ||
49 | } GSM_Bitmap_Types; | 67 | } GSM_Bitmap_Types; |
50 | 68 | ||
51 | #define GSM_BITMAP_SIZE(65+7)/8*96 | 69 | #define GSM_BITMAP_SIZE(65+7)/8*96 |
52 | #define GSM_BITMAP_TEXT_LENGTH 128 | 70 | #define GSM_BITMAP_TEXT_LENGTH 128 |
53 | 71 | ||
54 | /** | 72 | /** |
55 | * Structure for all possible bitmaps, which are not saved in various filesystems | 73 | * Structure for all possible bitmaps, which are not saved in various filesystems |
56 | */ | 74 | */ |
57 | typedef struct { | 75 | typedef struct { |
58 | /** | 76 | /** |
59 | * For all: bitmap type | 77 | * For all: bitmap type |
60 | */ | 78 | */ |
61 | GSM_Bitmap_Types Type; | 79 | GSM_Bitmap_Types Type; |
62 | /** | 80 | /** |
63 | * For caller group logos: number of group | 81 | * For caller group logos: number of group |
64 | * For startup logos: number of animated bitmap | 82 | * For startup logos: number of animated bitmap |
65 | */ | 83 | */ |
66 | unsigned char Location; | 84 | unsigned char Location; |
67 | /** | 85 | /** |
68 | * For dealer/welcome note text: text | 86 | * For dealer/welcome note text: text |
69 | * For caller group logo: name of group | 87 | * For caller group logo: name of group |
70 | * For picture images: text assigned to it | 88 | * For picture images: text assigned to it |
71 | */ | 89 | */ |
72 | unsigned char Text[2 * (GSM_BITMAP_TEXT_LENGTH + 1)]; | 90 | unsigned char Text[2 * (GSM_BITMAP_TEXT_LENGTH + 1)]; |
@@ -94,48 +112,56 @@ typedef struct { | |||
94 | /** | 112 | /** |
95 | * For mono bitmaps: body of bitmap | 113 | * For mono bitmaps: body of bitmap |
96 | */ | 114 | */ |
97 | unsigned char BitmapPoints[GSM_BITMAP_SIZE]; | 115 | unsigned char BitmapPoints[GSM_BITMAP_SIZE]; |
98 | /** | 116 | /** |
99 | * For mono bitmaps: height specified in pixels | 117 | * For mono bitmaps: height specified in pixels |
100 | */ | 118 | */ |
101 | unsigned char BitmapHeight; | 119 | unsigned char BitmapHeight; |
102 | /** | 120 | /** |
103 | * For mono bitmaps: width specified in pixels | 121 | * For mono bitmaps: width specified in pixels |
104 | */ | 122 | */ |
105 | unsigned char BitmapWidth; | 123 | unsigned char BitmapWidth; |
106 | /** | 124 | /** |
107 | * For operator logos: Network operator code | 125 | * For operator logos: Network operator code |
108 | */ | 126 | */ |
109 | char NetworkCode[7]; | 127 | char NetworkCode[7]; |
110 | /** | 128 | /** |
111 | * For picture images: number of sender | 129 | * For picture images: number of sender |
112 | */ | 130 | */ |
113 | unsigned char Sender[2 * (GSM_MAX_NUMBER_LENGTH + 1)]; | 131 | unsigned char Sender[2 * (GSM_MAX_NUMBER_LENGTH + 1)]; |
114 | /** | 132 | /** |
115 | * For colour bitmaps: ID | 133 | * For colour bitmaps: ID |
116 | */ | 134 | */ |
117 | unsigned char ID; | 135 | unsigned char ID; |
136 | /** | ||
137 | * For binary pictures (GIF, BMP, etc.): frame and length | ||
138 | */ | ||
139 | GSM_BinaryPicture BinaryPic; | ||
140 | /** | ||
141 | * Bitmap name | ||
142 | */ | ||
143 | char *Name; | ||
118 | } GSM_Bitmap; | 144 | } GSM_Bitmap; |
119 | 145 | ||
120 | #define MAX_MULTI_BITMAP 6 | 146 | #define MAX_MULTI_BITMAP 6 |
121 | 147 | ||
122 | /** | 148 | /** |
123 | * Structure to handle more than one bitmap | 149 | * Structure to handle more than one bitmap |
124 | */ | 150 | */ |
125 | typedef struct { | 151 | typedef struct { |
126 | /** | 152 | /** |
127 | * Number of bitmaps | 153 | * Number of bitmaps |
128 | */ | 154 | */ |
129 | unsigned char Number; | 155 | unsigned char Number; |
130 | /** | 156 | /** |
131 | * All bitmaps | 157 | * All bitmaps |
132 | */ | 158 | */ |
133 | GSM_Bitmap Bitmap[MAX_MULTI_BITMAP]; | 159 | GSM_Bitmap Bitmap[MAX_MULTI_BITMAP]; |
134 | } GSM_MultiBitmap; | 160 | } GSM_MultiBitmap; |
135 | 161 | ||
136 | typedef enum { | 162 | typedef enum { |
137 | GSM_NokiaStartupLogo = 1,/*size 84*48*/ | 163 | GSM_NokiaStartupLogo = 1,/*size 84*48*/ |
138 | GSM_NokiaOperatorLogo, /*size 72*14*/ | 164 | GSM_NokiaOperatorLogo, /*size 72*14*/ |
139 | GSM_Nokia7110OperatorLogo,/*size 78*21*/ | 165 | GSM_Nokia7110OperatorLogo,/*size 78*21*/ |
140 | GSM_Nokia6510OperatorLogo,/*size 78*21*/ | 166 | GSM_Nokia6510OperatorLogo,/*size 78*21*/ |
141 | GSM_NokiaCallerLogo, /*size 72*14*/ | 167 | GSM_NokiaCallerLogo, /*size 72*14*/ |
diff --git a/gammu/emb/common/service/gsmmisc.h b/gammu/emb/common/service/gsmmisc.h index 37501ad..793d3d1 100644 --- a/gammu/emb/common/service/gsmmisc.h +++ b/gammu/emb/common/service/gsmmisc.h | |||
@@ -271,46 +271,51 @@ GSM_Error GSM_ReadFile(char *FileName, GSM_File *File); | |||
271 | 271 | ||
272 | GSM_Error GSM_JADFindData(GSM_File File, char *Vendor, char *Name, char *JAR, char *Version, int *Size); | 272 | GSM_Error GSM_JADFindData(GSM_File File, char *Vendor, char *Name, char *JAR, char *Version, int *Size); |
273 | 273 | ||
274 | void GSM_IdentifyFileFormat(GSM_File *File); | 274 | void GSM_IdentifyFileFormat(GSM_File *File); |
275 | 275 | ||
276 | typedef struct { | 276 | typedef struct { |
277 | int Free; | 277 | int Free; |
278 | int Used; | 278 | int Used; |
279 | } GSM_FileSystemStatus; | 279 | } GSM_FileSystemStatus; |
280 | 280 | ||
281 | /* ----------------------------- GPRS access points ----------------------- */ | 281 | /* ----------------------------- GPRS access points ----------------------- */ |
282 | 282 | ||
283 | typedef struct { | 283 | typedef struct { |
284 | int Location; | 284 | int Location; |
285 | unsigned char Name[300]; | 285 | unsigned char Name[300]; |
286 | unsigned char URL[500]; | 286 | unsigned char URL[500]; |
287 | bool Active; | 287 | bool Active; |
288 | } GSM_GPRSAccessPoint; | 288 | } GSM_GPRSAccessPoint; |
289 | 289 | ||
290 | /* ------------------------------------------------------------------------ */ | 290 | /* ------------------------------------------------------------------------ */ |
291 | 291 | ||
292 | typedef enum { | 292 | typedef enum { |
293 | GSM_Date_DDMMYYYY = 1, | 293 | GSM_Date_DDMMYYYY = 1, |
294 | GSM_Date_MMDDYYYY, | 294 | GSM_Date_MMDDYYYY, |
295 | GSM_Date_YYYYMMDD | 295 | GSM_Date_YYYYMMDD, |
296 | GSM_Date_DDMMMYY, | ||
297 | GSM_Date_MMDDYY, | ||
298 | GSM_Date_DDMMYY, | ||
299 | GSM_Date_YYMMDD, | ||
300 | GSM_Date_OFF | ||
296 | } GSM_DateFormat; | 301 | } GSM_DateFormat; |
297 | 302 | ||
298 | typedef struct { | 303 | typedef struct { |
299 | unsigned char DateSeparator; | 304 | unsigned char DateSeparator; |
300 | GSM_DateFormatDateFormat; | 305 | GSM_DateFormatDateFormat; |
301 | bool AMPMTime; | 306 | bool AMPMTime; |
302 | } GSM_Locale; | 307 | } GSM_Locale; |
303 | 308 | ||
304 | /* ------------------------------------------------------------------------ */ | 309 | /* ------------------------------------------------------------------------ */ |
305 | 310 | ||
306 | void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt); | 311 | void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt); |
307 | void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start); | 312 | void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start); |
308 | 313 | ||
309 | void SaveVCALText(char *Buffer, int *Length, char *Text, char *Start); | 314 | void SaveVCALText(char *Buffer, int *Length, char *Text, char *Start); |
310 | bool ReadVCALText(char *Buffer, char *Start, char *Value); | 315 | bool ReadVCALText(char *Buffer, char *Start, char *Value); |
311 | 316 | ||
312 | #endif | 317 | #endif |
313 | 318 | ||
314 | /* How should editor hadle tabs in this file? Add editor commands here. | 319 | /* How should editor hadle tabs in this file? Add editor commands here. |
315 | * vim: noexpandtab sw=8 ts=8 sts=8: | 320 | * vim: noexpandtab sw=8 ts=8 sts=8: |
316 | */ | 321 | */ |
diff --git a/gammu/emb/common/service/gsmring.c b/gammu/emb/common/service/gsmring.c index 7df46f1..dab028c 100644 --- a/gammu/emb/common/service/gsmring.c +++ b/gammu/emb/common/service/gsmring.c | |||
@@ -1,33 +1,36 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* Based on some work from Ralf Thelen (7110 ringtones), | 2 | /* Based on some work from Ralf Thelen (7110 ringtones) and others */ |
3 | * Gnokii (RTTL and SM) and others | 3 | /* Based on some work (RTTL and SM) from Gnokii (www.gnokii.org) |
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
4 | */ | 6 | */ |
5 | 7 | ||
6 | #include <stdlib.h> | 8 | #include <stdlib.h> |
7 | #include <string.h> | 9 | #include <string.h> |
8 | #include <ctype.h> | 10 | #include <ctype.h> |
9 | #include <math.h> | 11 | #include <math.h> |
12 | #include <sys/stat.h> | ||
10 | #ifdef WIN32 | 13 | #ifdef WIN32 |
11 | # include <windows.h> | 14 | # include <windows.h> |
12 | #endif | 15 | #endif |
13 | 16 | ||
14 | #include "../gsmcomon.h" | 17 | #include "../gsmcomon.h" |
15 | #include "../misc/coding/coding.h" | 18 | #include "../misc/coding/coding.h" |
16 | #include "../gsmstate.h" | 19 | #include "../gsmstate.h" |
17 | #include "gsmring.h" | 20 | #include "gsmring.h" |
18 | #include "sms/gsmsms.h" | 21 | #include "sms/gsmsms.h" |
19 | 22 | ||
20 | int GSM_RingNoteGetFrequency(GSM_RingNote Note) | 23 | int GSM_RingNoteGetFrequency(GSM_RingNote Note) |
21 | { | 24 | { |
22 | double freq=0; | 25 | double freq=0; |
23 | 26 | ||
24 | /* Values according to the software from http://iki.fi/too/sw/xring/ | 27 | /* Values according to the software from http://iki.fi/too/sw/xring/ |
25 | * generated with: | 28 | * generated with: |
26 | * perl -e 'print int(4400 * (2 **($_/12)) + .5)/10, "\n" for(3..14)' | 29 | * perl -e 'print int(4400 * (2 **($_/12)) + .5)/10, "\n" for(3..14)' |
27 | */ | 30 | */ |
28 | switch (Note.Note) { | 31 | switch (Note.Note) { |
29 | case Note_C : freq = 523.3; break; | 32 | case Note_C : freq = 523.3; break; |
30 | case Note_Cis: freq = 554.4; break; | 33 | case Note_Cis: freq = 554.4; break; |
31 | case Note_D : freq = 587.3; break; | 34 | case Note_D : freq = 587.3; break; |
32 | case Note_Dis: freq = 622.3; break; | 35 | case Note_Dis: freq = 622.3; break; |
33 | case Note_E : freq = 659.3; break; | 36 | case Note_E : freq = 659.3; break; |
@@ -135,48 +138,54 @@ GSM_Error savewav(FILE *file, GSM_Ringtone *ringtone) | |||
135 | 138 | ||
136 | return ERR_NONE; | 139 | return ERR_NONE; |
137 | } | 140 | } |
138 | 141 | ||
139 | static GSM_Error savebin(FILE *file, GSM_Ringtone *ringtone) | 142 | static GSM_Error savebin(FILE *file, GSM_Ringtone *ringtone) |
140 | { | 143 | { |
141 | char nullchar=0x00; | 144 | char nullchar=0x00; |
142 | 145 | ||
143 | fwrite(&nullchar,1,1,file); | 146 | fwrite(&nullchar,1,1,file); |
144 | fwrite(&nullchar,1,1,file); | 147 | fwrite(&nullchar,1,1,file); |
145 | fprintf(file,"\x0C\x01\x2C"); | 148 | fprintf(file,"\x0C\x01\x2C"); |
146 | fprintf(file,"%s",DecodeUnicodeString(ringtone->Name)); | 149 | fprintf(file,"%s",DecodeUnicodeString(ringtone->Name)); |
147 | fwrite(&nullchar,1,1,file); | 150 | fwrite(&nullchar,1,1,file); |
148 | fwrite(&nullchar,1,1,file); | 151 | fwrite(&nullchar,1,1,file); |
149 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); | 152 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); |
150 | return ERR_NONE; | 153 | return ERR_NONE; |
151 | } | 154 | } |
152 | 155 | ||
153 | static GSM_Error savepuremidi(FILE *file, GSM_Ringtone *ringtone) | 156 | static GSM_Error savepuremidi(FILE *file, GSM_Ringtone *ringtone) |
154 | { | 157 | { |
155 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); | 158 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); |
156 | return ERR_NONE; | 159 | return ERR_NONE; |
157 | } | 160 | } |
158 | 161 | ||
162 | static GSM_Error savemmf(FILE *file, GSM_Ringtone *ringtone) | ||
163 | { | ||
164 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); | ||
165 | return ERR_NONE; | ||
166 | } | ||
167 | |||
159 | GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone) | 168 | GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone) |
160 | { | 169 | { |
161 | GSM_RingNoteScaleDefNoteScale; | 170 | GSM_RingNoteScaleDefNoteScale; |
162 | GSM_RingNoteDurationDefNoteDuration; | 171 | GSM_RingNoteDurationDefNoteDuration; |
163 | 172 | ||
164 | GSM_RingNoteStyleDefNoteStyle=0; | 173 | GSM_RingNoteStyleDefNoteStyle=0; |
165 | int DefNoteTempo=0; | 174 | int DefNoteTempo=0; |
166 | 175 | ||
167 | bool started = false, firstcomma = true; | 176 | bool started = false, firstcomma = true; |
168 | GSM_RingNote *Note; | 177 | GSM_RingNote *Note; |
169 | 178 | ||
170 | unsigned char buffer[15]; | 179 | unsigned char buffer[15]; |
171 | int i,j,k=0; | 180 | int i,j,k=0; |
172 | 181 | ||
173 | /* Saves ringtone name */ | 182 | /* Saves ringtone name */ |
174 | fprintf(file,"%s:",DecodeUnicodeString(ringtone->Name)); | 183 | fprintf(file,"%s:",DecodeUnicodeString(ringtone->Name)); |
175 | 184 | ||
176 | /* Find the most frequently used duration */ | 185 | /* Find the most frequently used duration */ |
177 | for (i=0;i<6;i++) buffer[i]=0; | 186 | for (i=0;i<6;i++) buffer[i]=0; |
178 | for (i=0;i<ringtone->NoteTone.NrCommands;i++) { | 187 | for (i=0;i<ringtone->NoteTone.NrCommands;i++) { |
179 | if (ringtone->NoteTone.Commands[i].Type == RING_Note) { | 188 | if (ringtone->NoteTone.Commands[i].Type == RING_Note) { |
180 | Note = &ringtone->NoteTone.Commands[i].Note; | 189 | Note = &ringtone->NoteTone.Commands[i].Note; |
181 | /* some durations need 2 bytes in file, some 1 */ | 190 | /* some durations need 2 bytes in file, some 1 */ |
182 | if (Note->Duration >= Duration_Full && Note->Duration <= Duration_1_8) { | 191 | if (Note->Duration >= Duration_Full && Note->Duration <= Duration_1_8) { |
@@ -464,48 +473,51 @@ GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone) | |||
464 | if (strstr(FileName,".ott")) { | 473 | if (strstr(FileName,".ott")) { |
465 | saveott(file,ringtone); | 474 | saveott(file,ringtone); |
466 | #ifndef ENABLE_LGPL | 475 | #ifndef ENABLE_LGPL |
467 | } else if (strstr(FileName,".mid")) { | 476 | } else if (strstr(FileName,".mid")) { |
468 | savemid(file,ringtone); | 477 | savemid(file,ringtone); |
469 | #endif | 478 | #endif |
470 | } else if (strstr(FileName,".rng")) { | 479 | } else if (strstr(FileName,".rng")) { |
471 | saveott(file,ringtone); | 480 | saveott(file,ringtone); |
472 | } else if (strstr(FileName,".imy")) { | 481 | } else if (strstr(FileName,".imy")) { |
473 | saveimelody(file,ringtone); | 482 | saveimelody(file,ringtone); |
474 | } else if (strstr(FileName,".ime")) { | 483 | } else if (strstr(FileName,".ime")) { |
475 | saveimelody(file,ringtone); | 484 | saveimelody(file,ringtone); |
476 | } else if (strstr(FileName,".wav")) { | 485 | } else if (strstr(FileName,".wav")) { |
477 | savewav(file,ringtone); | 486 | savewav(file,ringtone); |
478 | } else { | 487 | } else { |
479 | saverttl(file, ringtone); | 488 | saverttl(file, ringtone); |
480 | } | 489 | } |
481 | break; | 490 | break; |
482 | case RING_NOKIABINARY: | 491 | case RING_NOKIABINARY: |
483 | savebin(file, ringtone); | 492 | savebin(file, ringtone); |
484 | break; | 493 | break; |
485 | case RING_MIDI: | 494 | case RING_MIDI: |
486 | savepuremidi(file, ringtone); | 495 | savepuremidi(file, ringtone); |
487 | break; | 496 | break; |
497 | case RING_MMF: | ||
498 | savemmf(file, ringtone); | ||
499 | break; | ||
488 | } | 500 | } |
489 | 501 | ||
490 | fclose(file); | 502 | fclose(file); |
491 | 503 | ||
492 | return ERR_NONE; | 504 | return ERR_NONE; |
493 | } | 505 | } |
494 | 506 | ||
495 | static GSM_Error loadrttl(FILE *file, GSM_Ringtone *ringtone) | 507 | static GSM_Error loadrttl(FILE *file, GSM_Ringtone *ringtone) |
496 | { | 508 | { |
497 | GSM_RingNoteScale DefNoteScale= Scale_880; | 509 | GSM_RingNoteScale DefNoteScale= Scale_880; |
498 | GSM_RingNoteDuration DefNoteDuration= Duration_1_4; | 510 | GSM_RingNoteDuration DefNoteDuration= Duration_1_4; |
499 | GSM_RingNoteStyle DefNoteStyle= NaturalStyle; | 511 | GSM_RingNoteStyle DefNoteStyle= NaturalStyle; |
500 | int DefNoteTempo= 63, i=0; | 512 | int DefNoteTempo= 63, i=0; |
501 | 513 | ||
502 | unsigned char buffer[2000],Name[100]; | 514 | unsigned char buffer[2000],Name[100]; |
503 | GSM_RingNote *Note; | 515 | GSM_RingNote *Note; |
504 | 516 | ||
505 | fread(buffer, 2000, 1, file); | 517 | fread(buffer, 2000, 1, file); |
506 | 518 | ||
507 | ringtone->NoteTone.NrCommands = 0; | 519 | ringtone->NoteTone.NrCommands = 0; |
508 | 520 | ||
509 | /* -------------- name ---------------- */ | 521 | /* -------------- name ---------------- */ |
510 | while (buffer[i] != ':') { | 522 | while (buffer[i] != ':') { |
511 | if (buffer[i] == 0x00) return ERR_NONE; | 523 | if (buffer[i] == 0x00) return ERR_NONE; |
@@ -748,121 +760,150 @@ static GSM_Error loadbin(FILE *file, GSM_Ringtone *ringtone) | |||
748 | i=5; | 760 | i=5; |
749 | while (buffer[i]!=0x00) i++; | 761 | while (buffer[i]!=0x00) i++; |
750 | EncodeUnicode(ringtone->Name,buffer+5,i-5); | 762 | EncodeUnicode(ringtone->Name,buffer+5,i-5); |
751 | while (buffer[i]!=0x02 && buffer[i+1]!=0xFC && buffer[i+2]!=0x09) { | 763 | while (buffer[i]!=0x02 && buffer[i+1]!=0xFC && buffer[i+2]!=0x09) { |
752 | i++; | 764 | i++; |
753 | } | 765 | } |
754 | ringtone->NokiaBinary.Length=ringtone->NokiaBinary.Length-i; | 766 | ringtone->NokiaBinary.Length=ringtone->NokiaBinary.Length-i; |
755 | memcpy(ringtone->NokiaBinary.Frame,buffer+i,ringtone->NokiaBinary.Length); | 767 | memcpy(ringtone->NokiaBinary.Frame,buffer+i,ringtone->NokiaBinary.Length); |
756 | dbgprintf("Length %i name \"%s\"\n",ringtone->NokiaBinary.Length,DecodeUnicodeString(ringtone->Name)); | 768 | dbgprintf("Length %i name \"%s\"\n",ringtone->NokiaBinary.Length,DecodeUnicodeString(ringtone->Name)); |
757 | return ERR_NONE; | 769 | return ERR_NONE; |
758 | } | 770 | } |
759 | 771 | ||
760 | static GSM_Error loadpuremidi(FILE *file, GSM_Ringtone *ringtone) | 772 | static GSM_Error loadpuremidi(FILE *file, GSM_Ringtone *ringtone) |
761 | { | 773 | { |
762 | unsigned char buffer[30000]; | 774 | unsigned char buffer[30000]; |
763 | 775 | ||
764 | dbgprintf("loading midi\n"); | 776 | dbgprintf("loading midi\n"); |
765 | EncodeUnicode(ringtone->Name,"MIDI",4); | 777 | EncodeUnicode(ringtone->Name,"MIDI",4); |
766 | ringtone->NokiaBinary.Length=fread(buffer, 1, 30000, file); | 778 | ringtone->NokiaBinary.Length=fread(buffer, 1, 30000, file); |
767 | memcpy(ringtone->NokiaBinary.Frame,buffer,ringtone->NokiaBinary.Length); | 779 | memcpy(ringtone->NokiaBinary.Frame,buffer,ringtone->NokiaBinary.Length); |
768 | dbgprintf("Length %i name \"%s\"\n",ringtone->NokiaBinary.Length,DecodeUnicodeString(ringtone->Name)); | 780 | dbgprintf("Length %i name \"%s\"\n",ringtone->NokiaBinary.Length,DecodeUnicodeString(ringtone->Name)); |
769 | return ERR_NONE; | 781 | return ERR_NONE; |
770 | } | 782 | } |
771 | 783 | ||
784 | static GSM_Error loadmmf(FILE *file, GSM_Ringtone *ringtone) | ||
785 | { | ||
786 | struct stat st; | ||
787 | char *buffer; | ||
788 | int length; | ||
789 | |||
790 | dbgprintf("loading smaf file\n"); | ||
791 | fstat(fileno(file), &st); | ||
792 | ringtone->BinaryTone.Length = length = st.st_size; | ||
793 | ringtone->BinaryTone.Buffer = buffer = malloc(length); | ||
794 | if (buffer == NULL) | ||
795 | return ERR_MOREMEMORY; | ||
796 | fread(buffer, 1, length, file); | ||
797 | |||
798 | dbgprintf("Length %i name \"%s\"\n", length, | ||
799 | DecodeUnicodeString(ringtone->Name)); | ||
800 | |||
801 | return ERR_NONE; | ||
802 | } | ||
803 | |||
772 | static GSM_Error loadre(FILE *file, GSM_Ringtone *ringtone) | 804 | static GSM_Error loadre(FILE *file, GSM_Ringtone *ringtone) |
773 | { | 805 | { |
774 | unsigned char buffer[2000]; | 806 | unsigned char buffer[2000]; |
775 | 807 | ||
776 | ringtone->NokiaBinary.Length=fread(buffer, 1, 500, file); | 808 | ringtone->NokiaBinary.Length=fread(buffer, 1, 500, file); |
777 | 809 | ||
778 | if (buffer[18]==0x00 && buffer[21]!=0x02) { | 810 | if (buffer[18]==0x00 && buffer[21]!=0x02) { |
779 | /* DCT3, Unicode subformat, 62xx & 7110 */ | 811 | /* DCT3, Unicode subformat, 62xx & 7110 */ |
780 | CopyUnicodeString(ringtone->Name,buffer+18); | 812 | CopyUnicodeString(ringtone->Name,buffer+18); |
781 | ringtone->NokiaBinary.Length = ringtone->NokiaBinary.Length - (21+UnicodeLength(ringtone->Name)*2); | 813 | ringtone->NokiaBinary.Length = ringtone->NokiaBinary.Length - (21+UnicodeLength(ringtone->Name)*2); |
782 | memcpy(ringtone->NokiaBinary.Frame,buffer+21+UnicodeLength(ringtone->Name)*2,ringtone->NokiaBinary.Length); | 814 | memcpy(ringtone->NokiaBinary.Frame,buffer+21+UnicodeLength(ringtone->Name)*2,ringtone->NokiaBinary.Length); |
783 | } else { | 815 | } else { |
784 | /* DCT3, normal subformat, 32xx/33xx/51xx/5210/5510/61xx/8xxx */ | 816 | /* DCT3, normal subformat, 32xx/33xx/51xx/5210/5510/61xx/8xxx */ |
785 | EncodeUnicode(ringtone->Name,buffer+17,buffer[16]); | 817 | EncodeUnicode(ringtone->Name,buffer+17,buffer[16]); |
786 | ringtone->NokiaBinary.Length = ringtone->NokiaBinary.Length - (19+UnicodeLength(ringtone->Name)); | 818 | ringtone->NokiaBinary.Length = ringtone->NokiaBinary.Length - (19+UnicodeLength(ringtone->Name)); |
787 | memcpy(ringtone->NokiaBinary.Frame,buffer+19+UnicodeLength(ringtone->Name),ringtone->NokiaBinary.Length); | 819 | memcpy(ringtone->NokiaBinary.Frame,buffer+19+UnicodeLength(ringtone->Name),ringtone->NokiaBinary.Length); |
788 | } | 820 | } |
789 | dbgprintf("Name \"%s\"\n",DecodeUnicodeString(ringtone->Name)); | 821 | dbgprintf("Name \"%s\"\n",DecodeUnicodeString(ringtone->Name)); |
790 | return ERR_NONE; | 822 | return ERR_NONE; |
791 | } | 823 | } |
792 | 824 | ||
793 | GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone) | 825 | GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone) |
794 | { | 826 | { |
795 | FILE *file; | 827 | FILE *file; |
796 | unsigned charbuffer[300]; | 828 | unsigned charbuffer[300]; |
797 | GSM_Errorerror = ERR_UNKNOWN; | 829 | GSM_Errorerror = ERR_UNKNOWN; |
798 | 830 | ||
799 | dbgprintf("Loading ringtone %s\n",FileName); | 831 | dbgprintf("Loading ringtone %s\n",FileName); |
800 | file = fopen(FileName, "rb"); | 832 | file = fopen(FileName, "rb"); |
801 | if (file == NULL) return ERR_CANTOPENFILE; | 833 | if (file == NULL) return ERR_CANTOPENFILE; |
802 | 834 | ||
803 | /* Read the header of the file. */ | 835 | /* Read the header of the file. */ |
804 | fread(buffer, 1, 4, file); | 836 | fread(buffer, 1, 4, file); |
805 | if (ringtone->Format == 0x00) { | 837 | if (ringtone->Format == 0x00) { |
806 | ringtone->Format = RING_NOTETONE; | 838 | ringtone->Format = RING_NOTETONE; |
807 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 839 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
808 | buffer[2]==0x0C && buffer[3]==0x01) { | 840 | buffer[2]==0x0C && buffer[3]==0x01) { |
809 | ringtone->Format = RING_NOKIABINARY; | 841 | ringtone->Format = RING_NOKIABINARY; |
810 | } | 842 | } |
811 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 843 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
812 | buffer[2]==0x00) { | 844 | buffer[2]==0x00) { |
813 | ringtone->Format = RING_NOKIABINARY; | 845 | ringtone->Format = RING_NOKIABINARY; |
814 | } | 846 | } |
815 | if (buffer[0]==0x4D && buffer[1]==0x54 && | 847 | if (buffer[0]==0x4D && buffer[1]==0x54 && |
816 | buffer[2]==0x68 && buffer[3]==0x64) { | 848 | buffer[2]==0x68 && buffer[3]==0x64) { |
817 | ringtone->Format = RING_MIDI; | 849 | ringtone->Format = RING_MIDI; |
818 | } | 850 | } |
851 | if (buffer[0]==0x4D && buffer[1]==0x4D && | ||
852 | buffer[2]==0x4D && buffer[3]==0x44) { | ||
853 | ringtone->Format = RING_MMF; | ||
854 | } | ||
819 | } | 855 | } |
820 | rewind(file); | 856 | rewind(file); |
821 | switch (ringtone->Format) { | 857 | switch (ringtone->Format) { |
822 | case RING_NOTETONE: | 858 | case RING_NOTETONE: |
823 | if (buffer[0]==0x02 && buffer[1]==0x4A) { | 859 | if (buffer[0]==0x02 && buffer[1]==0x4A) { |
824 | error=loadott(file,ringtone); | 860 | error=loadott(file,ringtone); |
825 | } else if (buffer[0]==0xC7 && buffer[1]==0x45) { | 861 | } else if (buffer[0]==0xC7 && buffer[1]==0x45) { |
826 | error=loadcommunicator(file,ringtone); | 862 | error=loadcommunicator(file,ringtone); |
827 | } else { | 863 | } else { |
828 | error=loadrttl(file,ringtone); | 864 | error=loadrttl(file,ringtone); |
829 | } | 865 | } |
830 | ringtone->NoteTone.AllNotesScale=false; | 866 | ringtone->NoteTone.AllNotesScale=false; |
831 | break; | 867 | break; |
832 | case RING_NOKIABINARY: | 868 | case RING_NOKIABINARY: |
833 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 869 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
834 | buffer[2]==0x0C && buffer[3]==0x01) { | 870 | buffer[2]==0x0C && buffer[3]==0x01) { |
835 | error=loadbin(file,ringtone); | 871 | error=loadbin(file,ringtone); |
836 | } | 872 | } |
837 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 873 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
838 | buffer[2]==0x00) { | 874 | buffer[2]==0x00) { |
839 | error=loadre(file,ringtone); | 875 | error=loadre(file,ringtone); |
840 | } | 876 | } |
841 | break; | 877 | break; |
842 | case RING_MIDI: | 878 | case RING_MIDI: |
843 | EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); | 879 | EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); |
844 | error = loadpuremidi(file,ringtone); | 880 | error = loadpuremidi(file,ringtone); |
881 | break; | ||
882 | case RING_MMF: | ||
883 | EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); | ||
884 | error = loadmmf(file,ringtone); | ||
885 | break; | ||
845 | } | 886 | } |
846 | fclose(file); | 887 | fclose(file); |
847 | return(error); | 888 | return(error); |
848 | } | 889 | } |
849 | 890 | ||
850 | /* -------------------------- required with Nokia & RTTL ------------------- */ | 891 | /* -------------------------- required with Nokia & RTTL ------------------- */ |
851 | 892 | ||
852 | /* Beats per Minute like written in Smart Messaging */ | 893 | /* Beats per Minute like written in Smart Messaging */ |
853 | static int SM_BeatsPerMinute[] = { | 894 | static int SM_BeatsPerMinute[] = { |
854 | 25, 28, 31, 35, 40, 45, 50, 56, 63,70, | 895 | 25, 28, 31, 35, 40, 45, 50, 56, 63,70, |
855 | 80, 90, 100, 112, 125, 140, 160, 180, 200,225, | 896 | 80, 90, 100, 112, 125, 140, 160, 180, 200,225, |
856 | 250, 285, 320, 355, 400, 450, 500, 565, 635,715, | 897 | 250, 285, 320, 355, 400, 450, 500, 565, 635,715, |
857 | 800,900 | 898 | 800,900 |
858 | }; | 899 | }; |
859 | 900 | ||
860 | int GSM_RTTLGetTempo(int Beats) | 901 | int GSM_RTTLGetTempo(int Beats) |
861 | { | 902 | { |
862 | int i=0; | 903 | int i=0; |
863 | 904 | ||
864 | while (Beats > SM_BeatsPerMinute[i] && SM_BeatsPerMinute[i] != 900) i++; | 905 | while (Beats > SM_BeatsPerMinute[i] && SM_BeatsPerMinute[i] != 900) i++; |
865 | 906 | ||
866 | return i<<3; | 907 | return i<<3; |
867 | } | 908 | } |
868 | 909 | ||
diff --git a/gammu/emb/common/service/gsmring.h b/gammu/emb/common/service/gsmring.h index 207cf31..2d2dd7a 100644 --- a/gammu/emb/common/service/gsmring.h +++ b/gammu/emb/common/service/gsmring.h | |||
@@ -99,63 +99,65 @@ typedef struct { | |||
99 | 99 | ||
100 | typedef enum { | 100 | typedef enum { |
101 | RING_Note = 1, | 101 | RING_Note = 1, |
102 | RING_EnableVibra, | 102 | RING_EnableVibra, |
103 | RING_DisableVibra, | 103 | RING_DisableVibra, |
104 | RING_EnableLight, | 104 | RING_EnableLight, |
105 | RING_DisableLight, | 105 | RING_DisableLight, |
106 | RING_EnableLED, | 106 | RING_EnableLED, |
107 | RING_DisableLED, | 107 | RING_DisableLED, |
108 | RING_Repeat | 108 | RING_Repeat |
109 | } GSM_RingCommandType; | 109 | } GSM_RingCommandType; |
110 | 110 | ||
111 | typedef struct { | 111 | typedef struct { |
112 | GSM_RingCommandType Type; | 112 | GSM_RingCommandType Type; |
113 | GSM_RingNote Note; | 113 | GSM_RingNote Note; |
114 | unsigned char Value; | 114 | unsigned char Value; |
115 | } GSM_RingCommand; | 115 | } GSM_RingCommand; |
116 | 116 | ||
117 | typedef struct { | 117 | typedef struct { |
118 | int NrCommands; | 118 | int NrCommands; |
119 | GSM_RingCommand Commands[MAX_RINGTONE_NOTES]; | 119 | GSM_RingCommand Commands[MAX_RINGTONE_NOTES]; |
120 | bool AllNotesScale; | 120 | bool AllNotesScale; |
121 | } GSM_NoteRingtone; | 121 | } GSM_NoteRingtone; |
122 | 122 | ||
123 | /* FIXME: should use BinaryTone instead? */ | ||
123 | /* Structure to hold Nokia binary ringtones. */ | 124 | /* Structure to hold Nokia binary ringtones. */ |
124 | typedef struct { | 125 | typedef struct { |
125 | unsigned char Frame[30000]; | 126 | unsigned char Frame[50000]; |
126 | int Length; | 127 | int Length; |
127 | } GSM_NokiaBinaryRingtone; | 128 | } GSM_NokiaBinaryRingtone; |
128 | 129 | ||
129 | typedef struct { | 130 | typedef struct { |
130 | unsigned char *Frame; | 131 | unsigned char *Buffer; |
131 | int Length; | 132 | int Length; |
132 | } GSM_BinaryTone; | 133 | } GSM_BinaryTone; |
133 | 134 | ||
134 | typedef enum { | 135 | typedef enum { |
135 | RING_NOTETONE = 1, | 136 | RING_NOTETONE = 1, |
136 | RING_NOKIABINARY, | 137 | RING_NOKIABINARY, |
137 | RING_MIDI | 138 | RING_MIDI, |
139 | RING_MMF | ||
138 | } GSM_RingtoneFormat; | 140 | } GSM_RingtoneFormat; |
139 | 141 | ||
140 | /** | 142 | /** |
141 | * Structure for saving various ringtones formats | 143 | * Structure for saving various ringtones formats |
142 | */ | 144 | */ |
143 | typedef struct { | 145 | typedef struct { |
144 | /** | 146 | /** |
145 | * Ringtone saved in one of three formats | 147 | * Ringtone saved in one of three formats |
146 | */ | 148 | */ |
147 | GSM_NokiaBinaryRingtone NokiaBinary; | 149 | GSM_NokiaBinaryRingtone NokiaBinary; |
148 | GSM_BinaryTone BinaryTone; | 150 | GSM_BinaryTone BinaryTone; |
149 | GSM_NoteRingtone NoteTone; | 151 | GSM_NoteRingtone NoteTone; |
150 | /** | 152 | /** |
151 | * Ringtone format | 153 | * Ringtone format |
152 | */ | 154 | */ |
153 | GSM_RingtoneFormat Format; | 155 | GSM_RingtoneFormat Format; |
154 | /** | 156 | /** |
155 | * Ringtone name | 157 | * Ringtone name |
156 | */ | 158 | */ |
157 | char Name[20*2]; | 159 | char Name[20*2]; |
158 | /** | 160 | /** |
159 | * Ringtone location | 161 | * Ringtone location |
160 | */ | 162 | */ |
161 | int Location; | 163 | int Location; |
diff --git a/gammu/emb/common/service/sms/gsmmulti.c b/gammu/emb/common/service/sms/gsmmulti.c index 6c1cdcd..bdb5ee9 100644 --- a/gammu/emb/common/service/sms/gsmmulti.c +++ b/gammu/emb/common/service/sms/gsmmulti.c | |||
@@ -466,48 +466,53 @@ GSM_Error GSM_EncodeMultiPartSMS(GSM_MultiPartSMSInfo *Info, | |||
466 | 466 | ||
467 | Length = 4; | 467 | Length = 4; |
468 | j = 0; | 468 | j = 0; |
469 | 469 | ||
470 | /* Offsets to bitmaps */ | 470 | /* Offsets to bitmaps */ |
471 | for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { | 471 | for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { |
472 | Buffer[Length++] = (4+j+Info->Entries[0].Bitmap->Number*2) % 256; | 472 | Buffer[Length++] = (4+j+Info->Entries[0].Bitmap->Number*2) % 256; |
473 | Buffer[Length++] = (4+j+Info->Entries[0].Bitmap->Number*2) / 256; | 473 | Buffer[Length++] = (4+j+Info->Entries[0].Bitmap->Number*2) / 256; |
474 | j += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight)+2; | 474 | j += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight)+2; |
475 | } | 475 | } |
476 | 476 | ||
477 | /* Bitmaps */ | 477 | /* Bitmaps */ |
478 | for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { | 478 | for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { |
479 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth; | 479 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth; |
480 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight; | 480 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight; |
481 | PHONE_EncodeBitmap(GSM_AlcatelBMMIPicture, Buffer+Length, &Info->Entries[0].Bitmap->Bitmap[i]); | 481 | PHONE_EncodeBitmap(GSM_AlcatelBMMIPicture, Buffer+Length, &Info->Entries[0].Bitmap->Bitmap[i]); |
482 | Length += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight); | 482 | Length += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight); |
483 | } | 483 | } |
484 | return GSM_EncodeAlcatelMultiPartSMS(SMS,Buffer,Length,Info->Entries[0].Bitmap->Bitmap[0].Text,ALCATELTDD_ANIMATION); | 484 | return GSM_EncodeAlcatelMultiPartSMS(SMS,Buffer,Length,Info->Entries[0].Bitmap->Bitmap[0].Text,ALCATELTDD_ANIMATION); |
485 | case SMS_MMSIndicatorLong: | 485 | case SMS_MMSIndicatorLong: |
486 | Class= 1; | 486 | Class= 1; |
487 | UDH= UDH_MMSIndicatorLong; | 487 | UDH= UDH_MMSIndicatorLong; |
488 | GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator); | 488 | GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator); |
489 | break; | 489 | break; |
490 | case SMS_WAPIndicatorLong: | ||
491 | Class= 1; | ||
492 | UDH= UDH_MMSIndicatorLong; | ||
493 | GSM_EncodeWAPIndicatorSMSText(Buffer,&Length,Info->Entries[0].MMSIndicator->Title,Info->Entries[0].MMSIndicator->Address); | ||
494 | break; | ||
490 | case SMS_NokiaRingtoneLong: | 495 | case SMS_NokiaRingtoneLong: |
491 | case SMS_NokiaRingtone: | 496 | case SMS_NokiaRingtone: |
492 | UDH= UDH_NokiaRingtone; | 497 | UDH= UDH_NokiaRingtone; |
493 | Class= 1; | 498 | Class= 1; |
494 | /* 7 = length of UDH_NokiaRingtone UDH header */ | 499 | /* 7 = length of UDH_NokiaRingtone UDH header */ |
495 | Length = GSM_MAX_8BIT_SMS_LENGTH-7; | 500 | Length = GSM_MAX_8BIT_SMS_LENGTH-7; |
496 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); | 501 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); |
497 | if (Info->Entries[0].ID == SMS_NokiaRingtone) break; | 502 | if (Info->Entries[0].ID == SMS_NokiaRingtone) break; |
498 | if (Info->Entries[0].RingtoneNotes != Info->Entries[0].Ringtone->NoteTone.NrCommands) { | 503 | if (Info->Entries[0].RingtoneNotes != Info->Entries[0].Ringtone->NoteTone.NrCommands) { |
499 | UDH = UDH_NokiaRingtoneLong; | 504 | UDH = UDH_NokiaRingtoneLong; |
500 | Length = (GSM_MAX_8BIT_SMS_LENGTH-12)*3; | 505 | Length = (GSM_MAX_8BIT_SMS_LENGTH-12)*3; |
501 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); | 506 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); |
502 | } | 507 | } |
503 | break; | 508 | break; |
504 | case SMS_NokiaOperatorLogoLong: | 509 | case SMS_NokiaOperatorLogoLong: |
505 | if (Info->Entries[0].Bitmap->Bitmap[0].BitmapWidth > 72 || Info->Entries[0].Bitmap->Bitmap[0].BitmapHeight > 14) { | 510 | if (Info->Entries[0].Bitmap->Bitmap[0].BitmapWidth > 72 || Info->Entries[0].Bitmap->Bitmap[0].BitmapHeight > 14) { |
506 | UDH= UDH_NokiaOperatorLogoLong; | 511 | UDH= UDH_NokiaOperatorLogoLong; |
507 | Class = 1; | 512 | Class = 1; |
508 | NOKIA_EncodeNetworkCode(Buffer, Info->Entries[0].Bitmap->Bitmap[0].NetworkCode); | 513 | NOKIA_EncodeNetworkCode(Buffer, Info->Entries[0].Bitmap->Bitmap[0].NetworkCode); |
509 | Length = Length + 3; | 514 | Length = Length + 3; |
510 | NOKIA_CopyBitmap(GSM_Nokia7110OperatorLogo, &Info->Entries[0].Bitmap->Bitmap[0], Buffer, &Length); | 515 | NOKIA_CopyBitmap(GSM_Nokia7110OperatorLogo, &Info->Entries[0].Bitmap->Bitmap[0], Buffer, &Length); |
511 | break; | 516 | break; |
512 | } | 517 | } |
513 | case SMS_NokiaOperatorLogo: | 518 | case SMS_NokiaOperatorLogo: |
diff --git a/gammu/emb/common/service/sms/gsmmulti.h b/gammu/emb/common/service/sms/gsmmulti.h index c672261..3f70d81 100644 --- a/gammu/emb/common/service/sms/gsmmulti.h +++ b/gammu/emb/common/service/sms/gsmmulti.h | |||
@@ -1,29 +1,33 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef __gsm_multi_h | 3 | #ifndef __gsm_multi_h |
4 | #define __gsm_multi_h | 4 | #define __gsm_multi_h |
5 | 5 | ||
6 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
6 | #include "../../gsmcomon.h" | 10 | #include "../../gsmcomon.h" |
7 | #include "../gsmlogo.h" | 11 | #include "../gsmlogo.h" |
8 | #include "../gsmcal.h" | 12 | #include "../gsmcal.h" |
9 | #include "../gsmpbk.h" | 13 | #include "../gsmpbk.h" |
10 | #include "../gsmdata.h" | 14 | #include "../gsmdata.h" |
11 | #include "../gsmring.h" | 15 | #include "../gsmring.h" |
12 | #include "gsmsms.h" | 16 | #include "gsmsms.h" |
13 | 17 | ||
14 | /* ---------------------- multi SMS --------------------------------------- */ | 18 | /* ---------------------- multi SMS --------------------------------------- */ |
15 | 19 | ||
16 | /* Identifiers for Smart Messaging 3.0 multipart SMS */ | 20 | /* Identifiers for Smart Messaging 3.0 multipart SMS */ |
17 | 21 | ||
18 | #define SM30_ISOTEXT 0 /* ISO 8859-1 text */ | 22 | #define SM30_ISOTEXT 0 /* ISO 8859-1 text */ |
19 | #define SM30_UNICODETEXT 1 | 23 | #define SM30_UNICODETEXT 1 |
20 | #define SM30_OTA 2 | 24 | #define SM30_OTA 2 |
21 | #define SM30_RINGTONE 3 | 25 | #define SM30_RINGTONE 3 |
22 | #define SM30_PROFILENAME 4 | 26 | #define SM30_PROFILENAME 4 |
23 | /* ... */ | 27 | /* ... */ |
24 | #define SM30_SCREENSAVER 6 | 28 | #define SM30_SCREENSAVER 6 |
25 | 29 | ||
26 | /* Identifiers for Alcatel Terminal Data Download */ | 30 | /* Identifiers for Alcatel Terminal Data Download */ |
27 | #define ALCATELTDD_PICTURE 4 | 31 | #define ALCATELTDD_PICTURE 4 |
28 | #define ALCATELTDD_ANIMATION 5 | 32 | #define ALCATELTDD_ANIMATION 5 |
29 | #define ALCATELTDD_SMSTEMPLATE 6 | 33 | #define ALCATELTDD_SMSTEMPLATE 6 |
@@ -151,66 +155,67 @@ typedef enum { | |||
151 | SMS_VCARD21Long, | 155 | SMS_VCARD21Long, |
152 | SMS_DisableVoice, | 156 | SMS_DisableVoice, |
153 | SMS_DisableFax, | 157 | SMS_DisableFax, |
154 | SMS_DisableEmail, | 158 | SMS_DisableEmail, |
155 | SMS_EnableVoice, | 159 | SMS_EnableVoice, |
156 | SMS_EnableFax, | 160 | SMS_EnableFax, |
157 | SMS_EnableEmail, | 161 | SMS_EnableEmail, |
158 | SMS_VoidSMS, | 162 | SMS_VoidSMS, |
159 | /** | 163 | /** |
160 | * IMelody 1.0 | 164 | * IMelody 1.0 |
161 | */ | 165 | */ |
162 | SMS_EMSSound10, | 166 | SMS_EMSSound10, |
163 | /** | 167 | /** |
164 | * IMelody 1.2 | 168 | * IMelody 1.2 |
165 | */ | 169 | */ |
166 | SMS_EMSSound12, | 170 | SMS_EMSSound12, |
167 | /** | 171 | /** |
168 | * IMelody without header - SonyEricsson extension | 172 | * IMelody without header - SonyEricsson extension |
169 | */ | 173 | */ |
170 | SMS_EMSSonyEricssonSound, | 174 | SMS_EMSSonyEricssonSound, |
171 | /** | 175 | /** |
172 | * IMelody 1.0 with UPI. | 176 | * IMelody 1.0 with UPI. |
173 | */ | 177 | */ |
174 | SMS_EMSSound10Long, | 178 | SMS_EMSSound10Long, |
175 | /*** | 179 | /** |
176 | * IMelody 1.2 with UPI. | 180 | * IMelody 1.2 with UPI. |
177 | */ | 181 | */ |
178 | SMS_EMSSound12Long, | 182 | SMS_EMSSound12Long, |
179 | /** | 183 | /** |
180 | * IMelody without header with UPI. | 184 | * IMelody without header with UPI. |
181 | */ | 185 | */ |
182 | SMS_EMSSonyEricssonSoundLong, | 186 | SMS_EMSSonyEricssonSoundLong, |
183 | SMS_EMSPredefinedSound, | 187 | SMS_EMSPredefinedSound, |
184 | SMS_EMSPredefinedAnimation, | 188 | SMS_EMSPredefinedAnimation, |
185 | SMS_EMSAnimation, | 189 | SMS_EMSAnimation, |
186 | /** | 190 | /** |
187 | * Fixed bitmap of size 16x16 or 32x32. | 191 | * Fixed bitmap of size 16x16 or 32x32. |
188 | */ | 192 | */ |
189 | SMS_EMSFixedBitmap, | 193 | SMS_EMSFixedBitmap, |
190 | SMS_EMSVariableBitmap, | 194 | SMS_EMSVariableBitmap, |
191 | SMS_EMSVariableBitmapLong, | 195 | SMS_EMSVariableBitmapLong, |
192 | SMS_MMSIndicatorLong, | 196 | SMS_MMSIndicatorLong, |
197 | SMS_WAPIndicatorLong, | ||
193 | /** | 198 | /** |
194 | * Variable bitmap with black and white colors | 199 | * Variable bitmap with black and white colors |
195 | */ | 200 | */ |
196 | SMS_AlcatelMonoBitmapLong, | 201 | SMS_AlcatelMonoBitmapLong, |
197 | /** | 202 | /** |
198 | * Variable animation with black and white colors | 203 | * Variable animation with black and white colors |
199 | */ | 204 | */ |
200 | SMS_AlcatelMonoAnimationLong, | 205 | SMS_AlcatelMonoAnimationLong, |
201 | SMS_AlcatelSMSTemplateName | 206 | SMS_AlcatelSMSTemplateName |
202 | } EncodeMultiPartSMSID; | 207 | } EncodeMultiPartSMSID; |
203 | 208 | ||
204 | typedef struct { | 209 | typedef struct { |
205 | EncodeMultiPartSMSID ID; | 210 | EncodeMultiPartSMSID ID; |
206 | 211 | ||
207 | int Number; | 212 | int Number; |
208 | GSM_Ringtone *Ringtone; | 213 | GSM_Ringtone *Ringtone; |
209 | GSM_MultiBitmap *Bitmap; | 214 | GSM_MultiBitmap *Bitmap; |
210 | GSM_WAPBookmark *Bookmark; | 215 | GSM_WAPBookmark *Bookmark; |
211 | GSM_WAPSettings *Settings; | 216 | GSM_WAPSettings *Settings; |
212 | GSM_MMSIndicator*MMSIndicator; | 217 | GSM_MMSIndicator*MMSIndicator; |
213 | GSM_MemoryEntry *Phonebook; | 218 | GSM_MemoryEntry *Phonebook; |
214 | GSM_CalendarEntry *Calendar; | 219 | GSM_CalendarEntry *Calendar; |
215 | GSM_ToDoEntry *ToDo; | 220 | GSM_ToDoEntry *ToDo; |
216 | bool Protected; | 221 | bool Protected; |
@@ -243,29 +248,33 @@ typedef struct { | |||
243 | * Encodes multi part SMS from "readable" format. | 248 | * Encodes multi part SMS from "readable" format. |
244 | */ | 249 | */ |
245 | GSM_Error GSM_EncodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS); | 250 | GSM_Error GSM_EncodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS); |
246 | 251 | ||
247 | /** | 252 | /** |
248 | * Decodes multi part SMS to "readable" format. | 253 | * Decodes multi part SMS to "readable" format. |
249 | */ | 254 | */ |
250 | bool GSM_DecodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS, bool ems); | 255 | bool GSM_DecodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS, bool ems); |
251 | 256 | ||
252 | /** | 257 | /** |
253 | * Clears @ref GSM_MultiPartSMSInfo to default values. | 258 | * Clears @ref GSM_MultiPartSMSInfo to default values. |
254 | */ | 259 | */ |
255 | void GSM_ClearMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); | 260 | void GSM_ClearMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); |
256 | 261 | ||
257 | /** | 262 | /** |
258 | * Frees any allocated structures inside @ref GSM_MultiPartSMSInfo. | 263 | * Frees any allocated structures inside @ref GSM_MultiPartSMSInfo. |
259 | */ | 264 | */ |
260 | void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); | 265 | void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); |
261 | 266 | ||
262 | /** | 267 | /** |
263 | * Links SMS messages according to IDs. | 268 | * Links SMS messages according to IDs. |
264 | */ | 269 | */ |
265 | GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems); | 270 | GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems); |
266 | 271 | ||
272 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
273 | } | ||
274 | #endif | ||
275 | |||
267 | #endif | 276 | #endif |
268 | 277 | ||
269 | /* How should editor hadle tabs in this file? Add editor commands here. | 278 | /* How should editor hadle tabs in this file? Add editor commands here. |
270 | * vim: noexpandtab sw=8 ts=8 sts=8: | 279 | * vim: noexpandtab sw=8 ts=8 sts=8: |
271 | */ | 280 | */ |
diff --git a/gammu/emb/common/service/sms/gsmsms.c b/gammu/emb/common/service/sms/gsmsms.c index 9920835..feceba4 100644 --- a/gammu/emb/common/service/sms/gsmsms.c +++ b/gammu/emb/common/service/sms/gsmsms.c | |||
@@ -1,26 +1,29 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Pawel Kot, others and Gnokii */ | 2 | /* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #include <ctype.h> | 7 | #include <ctype.h> |
5 | #include <string.h> | 8 | #include <string.h> |
6 | #include <time.h> | 9 | #include <time.h> |
7 | 10 | ||
8 | #include "../../gsmcomon.h" | 11 | #include "../../gsmcomon.h" |
9 | #include "../../misc/coding/coding.h" | 12 | #include "../../misc/coding/coding.h" |
10 | #include "../gsmcal.h" | 13 | #include "../gsmcal.h" |
11 | #include "../gsmpbk.h" | 14 | #include "../gsmpbk.h" |
12 | #include "../gsmlogo.h" | 15 | #include "../gsmlogo.h" |
13 | #include "../gsmring.h" | 16 | #include "../gsmring.h" |
14 | #include "../gsmdata.h" | 17 | #include "../gsmdata.h" |
15 | #include "../gsmnet.h" | 18 | #include "../gsmnet.h" |
16 | #include "gsmsms.h" | 19 | #include "gsmsms.h" |
17 | 20 | ||
18 | /* User data headers */ | 21 | /* User data headers */ |
19 | static GSM_UDHHeader UDHHeaders[] = { | 22 | static GSM_UDHHeader UDHHeaders[] = { |
20 | /* See GSM 03.40 section 9.2.3.24.1 | 23 | /* See GSM 03.40 section 9.2.3.24.1 |
21 | * 1 byte 0x00 | 24 | * 1 byte 0x00 |
22 | * 1 byte 0x03 | 25 | * 1 byte 0x03 |
23 | * 1 byte 0x01: unique ID for message series | 26 | * 1 byte 0x01: unique ID for message series |
24 | * 1 byte 0x00: how many SMS in sequence | 27 | * 1 byte 0x00: how many SMS in sequence |
25 | * 1 byte 0x00: number of current SMS in sequence */ | 28 | * 1 byte 0x00: number of current SMS in sequence */ |
26 | { UDH_ConcatenatedMessages, 0x05, "\x00\x03\x01\x00\x00",2,-1,4,3}, | 29 | { UDH_ConcatenatedMessages, 0x05, "\x00\x03\x01\x00\x00",2,-1,4,3}, |
diff --git a/gammu/emb/common/service/sms/gsmsms.h b/gammu/emb/common/service/sms/gsmsms.h index d87ff60..0b950d3 100644 --- a/gammu/emb/common/service/sms/gsmsms.h +++ b/gammu/emb/common/service/sms/gsmsms.h | |||
@@ -1,26 +1,29 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Pawel Kot, others and Gnokii */ | 2 | /* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #ifndef __gsm_sms_h | 7 | #ifndef __gsm_sms_h |
5 | #define __gsm_sms_h | 8 | #define __gsm_sms_h |
6 | 9 | ||
7 | #include "../../gsmcomon.h" | 10 | #include "../../gsmcomon.h" |
8 | #include "../gsmlogo.h" | 11 | #include "../gsmlogo.h" |
9 | #include "../gsmcal.h" | 12 | #include "../gsmcal.h" |
10 | #include "../gsmpbk.h" | 13 | #include "../gsmpbk.h" |
11 | #include "../gsmdata.h" | 14 | #include "../gsmdata.h" |
12 | #include "../gsmring.h" | 15 | #include "../gsmring.h" |
13 | 16 | ||
14 | /* --------------------- Some general definitions ------------------------- */ | 17 | /* --------------------- Some general definitions ------------------------- */ |
15 | 18 | ||
16 | #define GSM_MAX_UDH_LENGTH 140 | 19 | #define GSM_MAX_UDH_LENGTH 140 |
17 | #define GSM_MAX_SMS_LENGTH 160 | 20 | #define GSM_MAX_SMS_LENGTH 160 |
18 | #define GSM_MAX_8BIT_SMS_LENGTH 140 | 21 | #define GSM_MAX_8BIT_SMS_LENGTH 140 |
19 | 22 | ||
20 | /* -------------------- Cell Broadcast ------------------------------------ */ | 23 | /* -------------------- Cell Broadcast ------------------------------------ */ |
21 | 24 | ||
22 | /** | 25 | /** |
23 | * Structure for Cell Broadcast messages. | 26 | * Structure for Cell Broadcast messages. |
24 | */ | 27 | */ |
25 | typedef struct { | 28 | typedef struct { |
26 | /** | 29 | /** |