author | zautrix <zautrix> | 2004-08-30 09:41:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-30 09:41:28 (UTC) |
commit | d78908896f19bb9e63a69bf475bf417b2599653b (patch) (unidiff) | |
tree | 6b992feca77e724d80982157d6999978239a557b /gammu/emb | |
parent | ddbd95b5b5d84f3a818e5bc22ea4e887c6494123 (diff) | |
download | kdepimpi-d78908896f19bb9e63a69bf475bf417b2599653b.zip kdepimpi-d78908896f19bb9e63a69bf475bf417b2599653b.tar.gz kdepimpi-d78908896f19bb9e63a69bf475bf417b2599653b.tar.bz2 |
Initial revision
36 files changed, 16807 insertions, 0 deletions
diff --git a/gammu/emb/gammu/depend/nokia/dct3.c b/gammu/emb/gammu/depend/nokia/dct3.c new file mode 100644 index 0000000..d4a55da --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3.c | |||
@@ -0,0 +1,801 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | ||
2 | /* MSID by Walek */ | ||
3 | |||
4 | #include "../../../common/gsmstate.h" | ||
5 | |||
6 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
7 | |||
8 | #include <string.h> | ||
9 | #include <signal.h> | ||
10 | |||
11 | #include "../../../common/misc/coding/coding.h" | ||
12 | #include "../../../common/gsmcomon.h" | ||
13 | #include "../../../common/service/gsmpbk.h" | ||
14 | #include "../../../common/phone/nokia/dct3/dct3func.h" | ||
15 | #include "../../../common/phone/pfunc.h" | ||
16 | #include "../../gammu.h" | ||
17 | |||
18 | extern GSM_Reply_Function UserReplyFunctions3[]; | ||
19 | |||
20 | /* ------- some usefull functions ----------------------------------------- */ | ||
21 | |||
22 | GSM_Error CheckDCT3Only() | ||
23 | { | ||
24 | bool found = false; | ||
25 | |||
26 | /* Checking if phone is DCT3 */ | ||
27 | #ifdef GSM_ENABLE_NOKIA6110 | ||
28 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | ||
29 | #endif | ||
30 | #ifdef GSM_ENABLE_NOKIA7110 | ||
31 | if (strstr(N7110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | ||
32 | #endif | ||
33 | #ifdef GSM_ENABLE_NOKIA9210 | ||
34 | if (strstr(N9210Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | ||
35 | #endif | ||
36 | if (!found) return ERR_NOTSUPPORTED; | ||
37 | |||
38 | if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && | ||
39 | s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_FBUS2BLUE && | ||
40 | s.ConnectionType!=GCT_FBUS2IRDA && s.ConnectionType!=GCT_IRDAPHONET && | ||
41 | s.ConnectionType!=GCT_BLUEFBUS2) { | ||
42 | return ERR_OTHERCONNECTIONREQUIRED; | ||
43 | } | ||
44 | return ERR_NONE; | ||
45 | } | ||
46 | |||
47 | static void CheckDCT3() | ||
48 | { | ||
49 | GSM_Error error; | ||
50 | |||
51 | error = CheckDCT3Only(); | ||
52 | switch (error) { | ||
53 | case ERR_NOTSUPPORTED: | ||
54 | Print_Error(ERR_NOTSUPPORTED); | ||
55 | break; | ||
56 | case ERR_OTHERCONNECTIONREQUIRED: | ||
57 | printf("Can't do it with current phone protocol\n"); | ||
58 | GSM_TerminateConnection(&s); | ||
59 | exit(-1); | ||
60 | default: | ||
61 | break; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static bool answer_yes3(char *text) | ||
66 | { | ||
67 | int len; | ||
68 | char ans[99]; | ||
69 | |||
70 | while (1) { | ||
71 | printf("%s (yes/no) ? ",text); | ||
72 | len=GetLine(stdin, ans, 99); | ||
73 | if (len==-1) exit(-1); | ||
74 | if (mystrncasecmp(ans, "yes",0)) return true; | ||
75 | if (mystrncasecmp(ans, "no" ,0)) return false; | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /* ------------------- functions ------------------------------------------- */ | ||
80 | |||
81 | static FILE *DCT3T9File; | ||
82 | |||
83 | static GSM_Error DCT3_ReplyGetT9(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
84 | { | ||
85 | int DCT3T9Size; | ||
86 | |||
87 | DCT3T9Size = msg.Length - 6; | ||
88 | fwrite(msg.Buffer+6,1,DCT3T9Size,DCT3T9File); | ||
89 | return ERR_NONE; | ||
90 | } | ||
91 | |||
92 | void DCT3GetT9(int argc, char *argv[]) | ||
93 | { | ||
94 | int i; | ||
95 | unsigned char req[] = {0x00, 0x01, 0xAE, 0x02, 0x00, | ||
96 | 0x00};/* Part number */ | ||
97 | |||
98 | //"00 01 AE 00" gets some control values | ||
99 | |||
100 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
101 | |||
102 | DCT3T9File = fopen("T9", "w"); | ||
103 | if (DCT3T9File == NULL) return; | ||
104 | |||
105 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
106 | |||
107 | for (i=0;i<5;i++) { | ||
108 | req[5] = i; | ||
109 | error=GSM_WaitFor (&s, req, 6, 0x40, 4, ID_User3); | ||
110 | Print_Error(error); | ||
111 | } | ||
112 | |||
113 | fclose(DCT3T9File); | ||
114 | } | ||
115 | |||
116 | void DCT3VibraTest(int argc, char *argv[]) | ||
117 | { | ||
118 | unsigned char ans[200]; | ||
119 | unsigned char SetLevel[4] = {0x00, 0x01, 0xA3, | ||
120 | 0xff};/* Level */ | ||
121 | |||
122 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
123 | |||
124 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
125 | |||
126 | error=DCT3_EnableSecurity (&s, 0x01); | ||
127 | Print_Error(error); | ||
128 | |||
129 | error=GSM_WaitFor (&s, SetLevel, 4, 0x40, 4, ID_User3); | ||
130 | Print_Error(error); | ||
131 | |||
132 | printf("Press any key to continue...\n"); | ||
133 | GetLine(stdin, ans, 99); | ||
134 | |||
135 | SetLevel[3] = 0x00; | ||
136 | error=GSM_WaitFor (&s, SetLevel, 4, 0x40, 4, ID_User3); | ||
137 | } | ||
138 | |||
139 | static GSM_Error DCT3_ReplyPhoneTests(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
140 | { | ||
141 | int i; | ||
142 | |||
143 | for (i=0;i<msg.Buffer[3];i++) { | ||
144 | switch (i) { | ||
145 | case 0: printf("Unknown(%02i) ",i);break; | ||
146 | case 1: printf("MCU ROM checksum (startup)");break; | ||
147 | case 2: printf("MCU RAM interface (startup)");break; | ||
148 | case 3: printf("MCU RAM component ");break; | ||
149 | case 4: printf("MCU EEPROM interface (startup)");break; | ||
150 | case 5: printf("MCU EEPROM component ");break; | ||
151 | case 6: printf("Real Time Clock battery (startup)");break; | ||
152 | case 7: printf("CCONT interface (startup)");break; | ||
153 | case 8: printf("AD converter (startup)");break; | ||
154 | case 9: printf("SW Reset ");break; | ||
155 | case 10:printf("Power Off ");break; | ||
156 | case 11:printf("Security Data ");break; | ||
157 | case 12:printf("EEPROM Tune checksum (startup)");break; | ||
158 | case 13:printf("PPM checksum (startup)");break; | ||
159 | case 14:printf("MCU download DSP (startup)");break; | ||
160 | case 15:printf("DSP alive (startup)");break; | ||
161 | case 16:printf("COBBA serial (startup)");break; | ||
162 | case 17:printf("COBBA paraller (startup)");break; | ||
163 | case 18:printf("EEPROM security checksum (startup)");break; | ||
164 | case 19:printf("PPM validity (startup)");break; | ||
165 | case 20:printf("Warranty state (startup)");break; | ||
166 | case 21:printf("Simlock check/SW version (startup)");break; | ||
167 | case 22:printf("IMEI check? ");break;/*from PC-Locals1.3.is OK?*/ | ||
168 | default:printf("Unknown(%02i) ",i);break; | ||
169 | } | ||
170 | switch (msg.Buffer[4+i]) { | ||
171 | case 0: printf(" : passed"); break; | ||
172 | case 0xff:printf(" : not executed"); break; | ||
173 | case 254: printf(" : fail"); break; | ||
174 | default: printf(" : result unknown(%i)",msg.Buffer[4+i]);break; | ||
175 | } | ||
176 | printf("\n"); | ||
177 | } | ||
178 | |||
179 | return ERR_NONE; | ||
180 | } | ||
181 | |||
182 | void DCT3SelfTests(int argc, char *argv[]) | ||
183 | { | ||
184 | unsigned char buffer[3] = {0x00,0x01,0xcf}; | ||
185 | unsigned char buffer3[8] = {0x00,0x01,0xce,0x1d,0xfe,0x23,0x00,0x00}; | ||
186 | int i; | ||
187 | |||
188 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
189 | |||
190 | error=DCT3_EnableSecurity (&s, 0x01); | ||
191 | Print_Error(error); | ||
192 | |||
193 | if (answer_yes3("Run all tests now ?")) { | ||
194 | /* make almost all tests */ | ||
195 | error = s.Protocol.Functions->WriteMessage(&s, buffer3, 8, 0x40); | ||
196 | Print_Error(error); | ||
197 | |||
198 | GSM_Terminate(); | ||
199 | |||
200 | while (!false) { | ||
201 | GSM_Init(false); | ||
202 | if (error==ERR_NONE) break; | ||
203 | GSM_Terminate(); | ||
204 | } | ||
205 | |||
206 | my_sleep(400); | ||
207 | } | ||
208 | |||
209 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
210 | |||
211 | for (i=0;i<10;i++) { | ||
212 | error=GSM_WaitFor (&s, buffer, 3, 0x40, 4, ID_User1); | ||
213 | if (error == ERR_NONE) break; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | struct DCT3ADCInfo { | ||
218 | char *name; | ||
219 | char *unit; | ||
220 | int x; | ||
221 | intpos1; | ||
222 | intpos2; | ||
223 | }; | ||
224 | |||
225 | static struct DCT3ADCInfo DCT3ADC[] = { | ||
226 | {"Battery voltage:", "mV", 1, 3, 2}, | ||
227 | // {"Charger voltage:", "mV", 1, -1, 7}, | ||
228 | // {"Charger current:", "mA", 1, -1, 5}, | ||
229 | {"Battery type:", "mAh", 1, 4, 3}, | ||
230 | {"Battery temperature:", "mK", 10, 5, 4}, | ||
231 | // {"Accessory detection:", "mV", 1, -1, -1}, | ||
232 | {"RSSI:", "", 1, 2, -1}, | ||
233 | // {"VCXO temperature:", "mV", 1, -1, -1}, | ||
234 | // {"Hook information:", "mV", 1, -1, -1}, | ||
235 | |||
236 | {"", "", 1, -1, -1} | ||
237 | }; | ||
238 | |||
239 | unsigned char DCT3ADCBuf[200]; | ||
240 | int DCT3ADCInt; | ||
241 | |||
242 | static GSM_Error DCT3_ReplyGetADC(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
243 | { | ||
244 | switch (msg.Buffer[2]) { | ||
245 | case 0x68: | ||
246 | memcpy(DCT3ADCBuf,msg.Buffer+4,msg.Length-4); | ||
247 | return ERR_NONE; | ||
248 | case 0x91: | ||
249 | DCT3ADCInt = msg.Buffer[4]*256+msg.Buffer[5]; | ||
250 | return ERR_NONE; | ||
251 | } | ||
252 | return ERR_UNKNOWNRESPONSE; | ||
253 | } | ||
254 | |||
255 | void DCT3GetADC(int argc, char *argv[]) | ||
256 | { | ||
257 | int i = 0; | ||
258 | unsigned charGetRaw[] = {0x00, 0x01, 0x68}; | ||
259 | unsigned charGetUnit[] = {0x00, 0x01, 0x91, | ||
260 | 0x02}; /* Test number */ | ||
261 | |||
262 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
263 | |||
264 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
265 | |||
266 | error=DCT3_EnableSecurity (&s, 0x02); | ||
267 | Print_Error(error); | ||
268 | |||
269 | error=GSM_WaitFor (&s, GetRaw, 3, 0x40, 6, ID_User3); | ||
270 | Print_Error(error); | ||
271 | |||
272 | while (1) { | ||
273 | printf(" %30s ",DCT3ADC[i].name); | ||
274 | if (DCT3ADC[i].pos1 != -1) { | ||
275 | printf("raw "); | ||
276 | printf("%10i ", | ||
277 | DCT3ADCBuf[(DCT3ADC[i].pos1-1)*2]*256+ | ||
278 | DCT3ADCBuf[(DCT3ADC[i].pos1-1)*2+1]); | ||
279 | } | ||
280 | if (DCT3ADC[i].pos2 != -1) { | ||
281 | printf("unit result "); | ||
282 | GetUnit[3] = DCT3ADC[i].pos2; | ||
283 | error=GSM_WaitFor (&s, GetUnit, 6, 0x40, 4, ID_User3); | ||
284 | Print_Error(error); | ||
285 | printf("%10i ",DCT3ADCInt*DCT3ADC[i].x); | ||
286 | printf("%s\n",DCT3ADC[i].unit); | ||
287 | } | ||
288 | i++; | ||
289 | if (DCT3ADC[i].name[0] == 0x00) break; | ||
290 | } | ||
291 | |||
292 | error=DCT3_EnableSecurity (&s, 0x01); | ||
293 | Print_Error(error); | ||
294 | } | ||
295 | |||
296 | void DCT3DisplayTest(int argc, char *argv[]) | ||
297 | { | ||
298 | unsigned char ans[200]; | ||
299 | unsigned char req[] = {0x00, 0x01, 0xD3, | ||
300 | 0x03, /* 3=set, 2=clear */ | ||
301 | 0x03}; /* test number */ | ||
302 | |||
303 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
304 | |||
305 | if (atoi(argv[2]) != 1 && atoi(argv[2]) != 2) { | ||
306 | printf("Give 1 or 2 as test number\n"); | ||
307 | } | ||
308 | |||
309 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
310 | |||
311 | req[4] = atoi(argv[2]); | ||
312 | s.Protocol.Functions->WriteMessage(&s, req, 5, 0x40); | ||
313 | |||
314 | printf("Press any key to continue...\n"); | ||
315 | GetLine(stdin, ans, 99); | ||
316 | |||
317 | req[3] = 0x02; | ||
318 | req[4] = 0x03; | ||
319 | s.Protocol.Functions->WriteMessage(&s, req, 5, 0x40); | ||
320 | |||
321 | error=DCT3_EnableSecurity (&s, 0x03); | ||
322 | Print_Error(error); | ||
323 | } | ||
324 | |||
325 | void DCT3netmonitor(int argc, char *argv[]) | ||
326 | { | ||
327 | char value[100]; | ||
328 | |||
329 | GSM_Init(true); | ||
330 | |||
331 | CheckDCT3(); | ||
332 | |||
333 | error=DCT3_Netmonitor(&s, atoi(argv[2]), value); | ||
334 | Print_Error(error); | ||
335 | |||
336 | printf("%s\n",value); | ||
337 | #ifdef GSM_ENABLE_BEEP | ||
338 | if (atoi(argv[2]) == 243) GSM_PhoneBeep(); | ||
339 | #endif | ||
340 | GSM_Terminate(); | ||
341 | } | ||
342 | |||
343 | static GSM_Error DCT3_ReplyGetMSID(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
344 | { | ||
345 | int i; | ||
346 | |||
347 | printf("MSID : "); | ||
348 | for (i=5;i<18;i++) printf("%02x",msg.Buffer[i]); | ||
349 | printf("\n"); | ||
350 | return ERR_NONE; | ||
351 | } | ||
352 | |||
353 | static GSM_Error DCT3_ReplyGetDSPROM(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
354 | { | ||
355 | printf("DSP ROM : %c\n",msg.Buffer[5]); | ||
356 | return ERR_NONE; | ||
357 | } | ||
358 | |||
359 | static GSM_Error DCT3_ReplySimlockInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
360 | { | ||
361 | inti, j; | ||
362 | charuni[100], buffer[50]; | ||
363 | |||
364 | j=0; | ||
365 | for (i=0; i < 12; i++) { | ||
366 | if (j<24) { | ||
367 | uni[j]='0' + (msg.Buffer[9+i] >> 4); | ||
368 | j++; | ||
369 | } | ||
370 | if (j!=15) { | ||
371 | if (j<24) { | ||
372 | uni[j]='0' + (msg.Buffer[9+i] & 0x0f); | ||
373 | j++; | ||
374 | } | ||
375 | } else j++; | ||
376 | } | ||
377 | |||
378 | strncpy(buffer,uni,5); | ||
379 | buffer[5]=0; | ||
380 | printf("Simlock 1 : MCC+MNC %10s, %s, %s, counter %i\n", | ||
381 | buffer, | ||
382 | ((msg.Buffer[6] & 1) == 1)==0?"opened":"CLOSED", | ||
383 | ((msg.Buffer[5] & 1) != 1)==0?"user ":"factory", | ||
384 | msg.Buffer[21]); | ||
385 | |||
386 | strncpy(buffer,uni+16,4); | ||
387 | buffer[4]=0; | ||
388 | printf("Simlock 2 : GID1 %10s, %s, %s, counter %i\n", | ||
389 | buffer, | ||
390 | ((msg.Buffer[6] & 4) == 4)==0?"opened":"CLOSED", | ||
391 | ((msg.Buffer[5] & 4) != 4)==0?"user ":"factory", | ||
392 | msg.Buffer[23]); | ||
393 | |||
394 | strncpy(buffer,uni+20,4); | ||
395 | buffer[4]=0; | ||
396 | printf("Simlock 3 : GID2 %10s, %s, %s, counter %i\n", | ||
397 | buffer, | ||
398 | ((msg.Buffer[6] & 8) == 8)==0?"opened":"CLOSED", | ||
399 | ((msg.Buffer[5] & 8) != 8)==0?"user ":"factory", | ||
400 | msg.Buffer[24]); | ||
401 | |||
402 | strncpy(buffer,uni+5,10); | ||
403 | buffer[10]=0; | ||
404 | printf("Simlock 4 : MSIN %10s, %s, %s, counter %i\n", | ||
405 | buffer, | ||
406 | ((msg.Buffer[6] & 2) == 2)==0?"opened":"CLOSED", | ||
407 | ((msg.Buffer[5] & 2) != 2)==0?"user ":"factory", | ||
408 | msg.Buffer[22]); | ||
409 | |||
410 | return ERR_NONE; | ||
411 | } | ||
412 | |||
413 | static GSM_Error DCT3_ReplyGetMCUchkSum(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
414 | { | ||
415 | int i; | ||
416 | |||
417 | if (msg.Buffer[3] == 0x12) printf("Language Pack: %c\n",msg.Buffer[5]); | ||
418 | if (msg.Buffer[3] == 0x02) { | ||
419 | printf("MCU checksum : "); | ||
420 | for (i=5;i<9;i++) printf("%c",msg.Buffer[i]); | ||
421 | printf("\n"); | ||
422 | } | ||
423 | return ERR_NONE; | ||
424 | } | ||
425 | |||
426 | static unsigned char MSID1; | ||
427 | |||
428 | GSM_Error DCT3_ReplyEnableSecurity2(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
429 | { | ||
430 | smprintf(s, "State of security commands set\n"); | ||
431 | MSID1 = msg.Buffer[5]; | ||
432 | return ERR_NONE; | ||
433 | } | ||
434 | |||
435 | void DCT3Info(int argc, char *argv[]) | ||
436 | { | ||
437 | unsigned char req[] = {0x00, 0x01, 0x8A, 0x00}; /* Get simlock info */ | ||
438 | unsigned char req2[] = {0x00, 0x01, 0xb4, 0x00, 0x00}; /* Get MSID */ | ||
439 | unsigned char req3[] = {0x00, 0x01, 0xc8, 0x02}; /* Get MCU chksum */ | ||
440 | unsigned char req4[] = {0x00, 0x01, 0xc8, 0x09}; /* Get DSP ROM */ | ||
441 | |||
442 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
443 | |||
444 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
445 | |||
446 | error=DCT3_EnableSecurity (&s, 0x01); | ||
447 | Print_Error(error); | ||
448 | |||
449 | error=GSM_WaitFor (&s, req, 4, 0x40, 4, ID_User3); | ||
450 | Print_Error(error); | ||
451 | |||
452 | req2[3] = MSID1; | ||
453 | req2[4] = req2[2] + req2[3]; | ||
454 | error=GSM_WaitFor (&s, req2, 5, 0x40, 4, ID_User8); | ||
455 | Print_Error(error); | ||
456 | |||
457 | error=GSM_WaitFor (&s, req3, 4, 0x40, 4, ID_User9); | ||
458 | Print_Error(error); | ||
459 | |||
460 | error=GSM_WaitFor (&s, req4, 4, 0x40, 4, ID_User10); | ||
461 | Print_Error(error); | ||
462 | } | ||
463 | |||
464 | static GSM_Error DCT3_ReplyResetTest36(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
465 | { | ||
466 | printf("Netmonitor test 36 cleaned OK\n"); | ||
467 | return ERR_NONE; | ||
468 | } | ||
469 | |||
470 | void DCT3ResetTest36(int argc, char *argv[]) | ||
471 | { | ||
472 | unsigned char req[] = {0x00, 0x01, 0x65, 0x40, 0x00}; /* Reset test 36 in netmon */ | ||
473 | |||
474 | GSM_Init(true); | ||
475 | |||
476 | CheckDCT3(); | ||
477 | |||
478 | error=DCT3_EnableSecurity (&s, 0x01); | ||
479 | Print_Error(error); | ||
480 | |||
481 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
482 | |||
483 | error=GSM_WaitFor (&s, req, 5, 0x40, 4, ID_User2); | ||
484 | Print_Error(error); | ||
485 | |||
486 | #ifdef GSM_ENABLE_BEEP | ||
487 | GSM_PhoneBeep(); | ||
488 | #endif | ||
489 | GSM_Terminate(); | ||
490 | } | ||
491 | |||
492 | static unsigned char PPS[32]; /* Product Profile Settings */ | ||
493 | |||
494 | static GSM_Error DCT3_ReplyGetPPS(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
495 | { | ||
496 | int i,j,z; | ||
497 | |||
498 | #ifdef DEBUG | ||
499 | dbgprintf("Product Profile Settings received -"); | ||
500 | for (i=0;i<4;i++) dbgprintf(" %02x",msg.Buffer[3+i]); | ||
501 | dbgprintf("\n"); | ||
502 | #endif | ||
503 | j=128;z=0; | ||
504 | for (i=0;i<32;i++) { | ||
505 | PPS[i]='0'; | ||
506 | if (msg.Buffer[z+3]&j) PPS[i]='1'; | ||
507 | if (j==1) { | ||
508 | j=128; | ||
509 | z++; | ||
510 | } else j=j/2; | ||
511 | } | ||
512 | #ifdef DEBUG | ||
513 | dbgprintf("After decoding: "); | ||
514 | for (i=0;i<32;i++) dbgprintf("%c",PPS[i]); | ||
515 | dbgprintf("\n"); | ||
516 | #endif | ||
517 | return ERR_NONE; | ||
518 | } | ||
519 | |||
520 | static GSM_Error DCT3_ReplySetPPS(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
521 | { | ||
522 | printf("Setting done OK\n"); | ||
523 | return ERR_NONE; | ||
524 | } | ||
525 | |||
526 | void DCT3SetPhoneMenus(int argc, char *argv[]) | ||
527 | { | ||
528 | char value[100]; | ||
529 | int i,j,z; | ||
530 | unsigned char reqGet[] = {0x00, 0x01, 0x6a}; | ||
531 | unsigned char reqSet[] = { | ||
532 | 0x00, 0x01, 0x6b, | ||
533 | 0x00, 0x00, 0x00, 0x00 }; /* bytes with Product Profile Setings */ | ||
534 | |||
535 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
536 | |||
537 | error=DCT3_EnableSecurity (&s, 0x01); | ||
538 | Print_Error(error); | ||
539 | |||
540 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
541 | |||
542 | error=GSM_WaitFor (&s, reqGet, 3, 0x40, 4, ID_User4); | ||
543 | Print_Error(error); | ||
544 | |||
545 | printf("ALS : enabling menu\n"); | ||
546 | PPS[10] = '1'; | ||
547 | |||
548 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3310") && s.Phone.Data.VerNum>5.87) { | ||
549 | printf("3310: enabling control of SMS charsets\n"); | ||
550 | PPS[11] = '0';//0 = ON, 1 = OFF | ||
551 | } | ||
552 | if (!strcmp(s.Phone.Data.ModelInfo->model,"6150")) { | ||
553 | printf("6150: enabling WellMate menu\n"); | ||
554 | PPS[18] = '1'; | ||
555 | } | ||
556 | /* FIXME */ | ||
557 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3210")) { | ||
558 | printf("3210: enabling vibra menu\n"); | ||
559 | PPS[24] = '1'; | ||
560 | } | ||
561 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3310") && s.Phone.Data.VerNum>5.13) { | ||
562 | printf("3310: enabling 3315 features\n"); | ||
563 | PPS[25] = '1'; | ||
564 | } | ||
565 | /* FIXME */ | ||
566 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3210") && s.Phone.Data.VerNum>=5.31) { | ||
567 | printf("3210: enabling React and Logic game\n"); | ||
568 | PPS[26] = '1'; | ||
569 | } | ||
570 | |||
571 | #ifdef DEBUG | ||
572 | dbgprintf("After settings: "); | ||
573 | for (i=0;i<32;i++) dbgprintf("%c",PPS[i]); | ||
574 | dbgprintf("\n"); | ||
575 | #endif | ||
576 | |||
577 | j=128;z=0; | ||
578 | for (i=0;i<32;i++) { | ||
579 | if (PPS[i]=='1') reqSet[z+3]=reqSet[z+3]+j; | ||
580 | if (j==1) { | ||
581 | j=128; | ||
582 | z++; | ||
583 | } else j=j/2; | ||
584 | } | ||
585 | |||
586 | //reqSet[3]=0xe7; | ||
587 | //reqSet[4]=0x25; | ||
588 | //reqSet[5]=0x00; | ||
589 | //reqSet[6]=0xe0; | ||
590 | |||
591 | error=GSM_WaitFor (&s, reqSet, 7, 0x40, 4, ID_User4); | ||
592 | Print_Error(error); | ||
593 | |||
594 | printf("Enabling netmonitor\n"); | ||
595 | error=DCT3_Netmonitor(&s, 243, value); | ||
596 | Print_Error(error); | ||
597 | } | ||
598 | |||
599 | static GSM_Error DCT3_Reply61GetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
600 | { | ||
601 | printf("Security Code is \"%s\"\n",msg.Buffer+5); | ||
602 | return ERR_NONE; | ||
603 | } | ||
604 | |||
605 | static GSM_Error DCT3_Reply7191GetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
606 | { | ||
607 | printf("Security Code is \"%s\"\n",msg.Buffer+6); | ||
608 | return ERR_NONE; | ||
609 | } | ||
610 | |||
611 | void DCT3GetSecurityCode(int argc, char *argv[]) | ||
612 | { | ||
613 | unsigned char req6110[] = {0x00, 0x01, 0x6e, | ||
614 | 0x01};/* Code type */ | ||
615 | unsigned char req71_91[] = {N7110_FRAME_HEADER, 0xee, | ||
616 | 0x1c};/* Setting */ | ||
617 | |||
618 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
619 | |||
620 | error=DCT3_EnableSecurity (&s, 0x01); | ||
621 | Print_Error(error); | ||
622 | |||
623 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
624 | |||
625 | #ifdef GSM_ENABLE_NOKIA6110 | ||
626 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) { | ||
627 | error=GSM_WaitFor (&s, req6110, 4, 0x40, 4, ID_User6); | ||
628 | } | ||
629 | #endif | ||
630 | #ifdef GSM_ENABLE_NOKIA7110 | ||
631 | if (strstr(N7110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) { | ||
632 | error=GSM_WaitFor (&s, req71_91, 5, 0x7a, 4, ID_User6); | ||
633 | } | ||
634 | #endif | ||
635 | #ifdef GSM_ENABLE_NOKIA9210 | ||
636 | if (strstr(N9210Phone.models, s.Phone.Data.ModelInfo->model) != NULL) { | ||
637 | error=GSM_WaitFor (&s, req71_91, 5, 0x7a, 4, ID_User6); | ||
638 | } | ||
639 | #endif | ||
640 | Print_Error(error); | ||
641 | } | ||
642 | |||
643 | #ifdef GSM_ENABLE_NOKIA6110 | ||
644 | |||
645 | static GSM_Error DCT3_ReplyGetOperatorName(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
646 | { | ||
647 | unsigned char buffer[10]; | ||
648 | |||
649 | NOKIA_DecodeNetworkCode(msg.Buffer+5, buffer); | ||
650 | buffer[6] = 0; | ||
651 | printf("Network : %s (%s ",buffer,DecodeUnicodeString(GSM_GetNetworkName(buffer))); | ||
652 | printf(", %s)\n", DecodeUnicodeString(GSM_GetCountryName(buffer))); | ||
653 | printf("Name : \"%s\"\n",msg.Buffer+8); | ||
654 | |||
655 | return ERR_NONE; | ||
656 | } | ||
657 | |||
658 | void DCT3GetOperatorName(int argc, char *argv[]) | ||
659 | { | ||
660 | unsigned char req[] = {0x00,0x01,0x8c,0x00}; | ||
661 | |||
662 | GSM_Init(true); | ||
663 | |||
664 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) == NULL) Print_Error(ERR_NOTSUPPORTED); | ||
665 | CheckDCT3(); | ||
666 | |||
667 | error=DCT3_EnableSecurity (&s, 0x01); | ||
668 | Print_Error(error); | ||
669 | |||
670 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
671 | |||
672 | error=GSM_WaitFor (&s, req, 4, 0x40, 4, ID_User5); | ||
673 | Print_Error(error); | ||
674 | |||
675 | GSM_Terminate(); | ||
676 | } | ||
677 | |||
678 | static GSM_Error DCT3_ReplySetOperatorName(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
679 | { | ||
680 | printf("Operator name set OK\n"); | ||
681 | return ERR_NONE; | ||
682 | } | ||
683 | |||
684 | void DCT3SetOperatorName(int argc, char *argv[]) | ||
685 | { | ||
686 | int i = 0; | ||
687 | unsigned char req[256] = {0x00,0x01,0x8b,0x00, | ||
688 | 0x00,0x00, /* MCC */ | ||
689 | 0x00}; /* MNC */ | ||
690 | |||
691 | GSM_Init(true); | ||
692 | |||
693 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) == NULL) Print_Error(ERR_NOTSUPPORTED); | ||
694 | CheckDCT3(); | ||
695 | |||
696 | error=DCT3_EnableSecurity (&s, 0x01); | ||
697 | Print_Error(error); | ||
698 | |||
699 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
700 | |||
701 | switch (argc) { | ||
702 | case 2: | ||
703 | case 3:NOKIA_EncodeNetworkCode(req+4,"000 00"); | ||
704 | req[7] = 0x00; | ||
705 | i = 1; | ||
706 | break; | ||
707 | case 4: NOKIA_EncodeNetworkCode(req+4,argv[2]); | ||
708 | strncpy(req+7,argv[3],200); | ||
709 | i = strlen(argv[3]); | ||
710 | } | ||
711 | |||
712 | error=GSM_WaitFor (&s, req, 8+i, 0x40, 4, ID_User7); | ||
713 | Print_Error(error); | ||
714 | |||
715 | GSM_Terminate(); | ||
716 | } | ||
717 | |||
718 | static GSM_Error DCT3_ReplyDisplayOutput(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
719 | { | ||
720 | unsigned char buf[100]; | ||
721 | |||
722 | switch (msg.Buffer[3]) { | ||
723 | case 0x50: | ||
724 | dbgprintf("Display string received\n"); | ||
725 | memcpy(buf,msg.Buffer+8,msg.Buffer[7]*2); | ||
726 | buf[msg.Buffer[7]*2] = 0; | ||
727 | buf[msg.Buffer[7]*2+1] = 0; | ||
728 | printf("X=%i, Y=%i, Text=\"%s\"\n",msg.Buffer[6],msg.Buffer[5],DecodeUnicodeString(buf)); | ||
729 | return ERR_NONE; | ||
730 | case 0x54: | ||
731 | dbgprintf("Display output set\n"); | ||
732 | return ERR_NONE; | ||
733 | } | ||
734 | return ERR_UNKNOWNRESPONSE; | ||
735 | } | ||
736 | |||
737 | void DCT3DisplayOutput(int argc, char *argv[]) | ||
738 | { | ||
739 | unsigned char req[] = {N6110_FRAME_HEADER, 0x53, | ||
740 | 0x01}; //1 = enable, 2 = disable | ||
741 | |||
742 | GSM_Init(true); | ||
743 | |||
744 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) == NULL) Print_Error(ERR_NOTSUPPORTED); | ||
745 | CheckDCT3(); | ||
746 | |||
747 | s.User.UserReplyFunctions=UserReplyFunctions3; | ||
748 | |||
749 | error=GSM_WaitFor (&s, req, 5, 0x0d, 4, ID_User7); | ||
750 | Print_Error(error); | ||
751 | |||
752 | signal(SIGINT, interrupt); | ||
753 | printf("Press Ctrl+C to break...\n"); | ||
754 | printf("Entering monitor mode...\n\n"); | ||
755 | |||
756 | while (!gshutdown) { | ||
757 | GSM_ReadDevice(&s,true); | ||
758 | my_sleep(10); | ||
759 | } | ||
760 | |||
761 | req[4] = 0x02; | ||
762 | error=GSM_WaitFor (&s, req, 5, 0x0d, 4, ID_User7); | ||
763 | Print_Error(error); | ||
764 | |||
765 | GSM_Terminate(); | ||
766 | } | ||
767 | #endif | ||
768 | |||
769 | static GSM_Reply_Function UserReplyFunctions3[] = { | ||
770 | {DCT3_ReplyDisplayOutput, "\x0D",0x03,0x50,ID_IncomingFrame}, | ||
771 | {DCT3_ReplyDisplayOutput, "\x0D",0x03,0x54,ID_User7 }, | ||
772 | |||
773 | {DCT3_ReplyEnableSecurity2, "\x40",0x02,0x64,ID_EnableSecurity}, | ||
774 | {DCT3_ReplyResetTest36, "\x40",0x02,0x65,ID_User2 }, | ||
775 | {DCT3_ReplyGetADC, "\x40",0x02,0x68,ID_User3 }, | ||
776 | {DCT3_ReplyGetPPS, "\x40",0x02,0x6A,ID_User4 }, | ||
777 | {DCT3_ReplySetPPS, "\x40",0x02,0x6B,ID_User4 }, | ||
778 | {DCT3_Reply61GetSecurityCode, "\x40",0x02,0x6E,ID_User6 }, | ||
779 | {DCT3_ReplySimlockInfo, "\x40",0x02,0x8A,ID_User3 }, | ||
780 | #ifdef GSM_ENABLE_NOKIA6110 | ||
781 | {DCT3_ReplySetOperatorName, "\x40",0x02,0x8B,ID_User7 }, | ||
782 | {DCT3_ReplyGetOperatorName, "\x40",0x02,0x8C,ID_User5 }, | ||
783 | #endif | ||
784 | {DCT3_ReplyGetADC, "\x40",0x02,0x91,ID_User3 }, | ||
785 | {NoneReply, "\x40",0x02,0xA3,ID_User3 }, | ||
786 | {DCT3_ReplyGetT9, "\x40",0x02,0xAE,ID_User3 }, | ||
787 | {DCT3_ReplyGetMSID, "\x40",0x02,0xb5,ID_User8 }, | ||
788 | {DCT3_ReplyGetDSPROM, "\x40",0x02,0xC8,ID_User10 }, | ||
789 | {DCT3_ReplyGetMCUchkSum, "\x40",0x02,0xC8,ID_User9 }, | ||
790 | {DCT3_ReplyPhoneTests, "\x40",0x02,0xCF,ID_User1 }, | ||
791 | |||
792 | {DCT3_Reply7191GetSecurityCode, "\x7a",0x04,0x1C,ID_User6 }, | ||
793 | |||
794 | {NULL, "\x00",0x00,0x00,ID_None } | ||
795 | }; | ||
796 | |||
797 | #endif | ||
798 | |||
799 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
800 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
801 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3.h b/gammu/emb/gammu/depend/nokia/dct3.h new file mode 100644 index 0000000..721222d --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | ||
2 | |||
3 | void DCT3SelfTests (int argc, char *argv[]); | ||
4 | void DCT3netmonitor (int argc, char *argv[]); | ||
5 | void DCT3Info (int argc, char *argv[]); | ||
6 | void DCT3ResetTest36 (int argc, char *argv[]); | ||
7 | void DCT3SetPhoneMenus (int argc, char *argv[]); | ||
8 | void DCT3GetSecurityCode (int argc, char *argv[]); | ||
9 | void DCT3GetADC (int argc, char *argv[]); | ||
10 | void DCT3DisplayTest (int argc, char *argv[]); | ||
11 | void DCT3VibraTest (int argc, char *argv[]); | ||
12 | void DCT3GetT9 (int argc, char *argv[]); | ||
13 | |||
14 | GSM_Error CheckDCT3Only(); | ||
15 | |||
16 | #include "../../../common/gsmstate.h" | ||
17 | |||
18 | #ifdef GSM_ENABLE_NOKIA6110 | ||
19 | void DCT3GetOperatorName (int argc, char *argv[]); | ||
20 | void DCT3SetOperatorName (int argc, char *argv[]); | ||
21 | void DCT3DisplayOutput (int argc, char *argv[]); | ||
22 | #endif | ||
23 | |||
24 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
25 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
26 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/nhm5_587.txt b/gammu/emb/gammu/depend/nokia/dct3trac/nhm5_587.txt new file mode 100644 index 0000000..a68d9d2 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/nhm5_587.txt | |||
@@ -0,0 +1,2055 @@ | |||
1 | 09XX CS:err/CS_ERROR_TRA | ||
2 | 0900 CS:err/INVALID_PRIMITIVE | ||
3 | 0901 CS:err/UNKNOWN_PRIMITIVE | ||
4 | 0902 CS:err/UNDEFINED_PRIMITIVE | ||
5 | 0903 CS:err/L1_UNKNOWN_MDI_MSG_SEND | ||
6 | 0904 CS:err/HPLMN_READ_FAIL | ||
7 | 0905 CS:err/L1_M82_UNKNOWN_TIMING_OFFSET | ||
8 | 0906 CS:err/UNKNOWN_SSUPL_CM_RET_VALUE | ||
9 | 0907 CS:err/UNKNOWN_MODE | ||
10 | 0908 CS:err/UNKNOWN_PDU | ||
11 | 0909 CS:err/UNDEFINED_PDU | ||
12 | 090A CS:err/UNDEFINED_TIMER | ||
13 | 090B CS:err/FATAL_ERROR_IN_L2_PDU | ||
14 | 090C CS:err/UNKNOWN_INFO_ELEMENT | ||
15 | 090D CS:err/TRAN_ID_CONFLICT | ||
16 | 090E CS:err/UNKNOWN_ERROR_CODE | ||
17 | 090F CS:err/L2_ERROR | ||
18 | 0910 CS:err/RR_ERROR | ||
19 | 0911 CS:err/MM_ERROR | ||
20 | 0912 CS:err/CC_ERROR | ||
21 | 0913 CS:err/SS_ERROR | ||
22 | 0914 CS:err/CS_ERROR | ||
23 | 0915 CS:err/RM_ERROR | ||
24 | 0916 CS:err/LAPDM_CONT_RS_FAIL(22/061C) | ||
25 | 0917 CS:err/LAPDM_INVALID_RESP(22/060D) | ||
26 | 0918 CS:err/LAPDM_SEQUENCE_ERROR(22/05FD) | ||
27 | 0919 CS:err/LAPDM_TIMEOUT_ERROR(22/05FE) | ||
28 | 091A CS:err/LAPDM_AWAIT_EST_ERROR(22/061F) | ||
29 | 091B CS:err/LAPDM_UNSOL_DM_IN_MF_EST(22/0602) | ||
30 | 10XX Const/CONSTANT_WINDOW_TRA | ||
31 | 1000 Const/CHANNEL_CONFIG | ||
32 | 1001 Const/DSF | ||
33 | 1002 Const/RLT | ||
34 | 1003 Const/PWR_TA | ||
35 | 1004 Const/PWR | ||
36 | 1005 Const/TIM_ADV | ||
37 | 1006 Const/MEAS_RESULTS | ||
38 | 1007 Const/OWN_SYSPAR | ||
39 | 1008 Const/NBOUR_SYSPAR | ||
40 | 11XX L1:timer/L1_TIMER_TRA | ||
41 | 1100 L1:timer/BCCH_TIMEOUT-start(4/008B) | ||
42 | 1101 L1:timer/BCCH_TIMEOUT-stop | ||
43 | 1102 L1:timer/BCCH_TIMEOUT-timeout(4/0087) | ||
44 | 1103 L1:timer/RESEL_TIME-start | ||
45 | 1104 L1:timer/RESEL_TIME-stop(4/008A) | ||
46 | 1105 L1:timer/RESEL_TIME-timeout | ||
47 | 1106 L1:timer/IMM_ASS_DELAY-start(4/0089) | ||
48 | 1107 L1:timer/IMM_ASS_DELAY-stop | ||
49 | 1108 L1:timer/IMM_ASS_DELAY-timeout(4/008D) | ||
50 | 1109 L1:timer/EXT_PAGE_MODE-start | ||
51 | 110A L1:timer/EXT_PAGE_MODE-stop(4/0088) | ||
52 | 110B L1:timer/EXT_PAGE_MODE-timeout | ||
53 | 110C L1:timer/SYNC_PERIOD-start(4/008C) | ||
54 | 110D L1:timer/SYNC_PERIOD-stop | ||
55 | 110E L1:timer/SYNC_PERIOD-timeout(4/008E) | ||
56 | 110F L1:timer/SC1_NEG-start | ||
57 | 1110 L1:timer/SC1_NEG-stop | ||
58 | 1111 L1:timer/SC1_NEG-timeout | ||
59 | 1112 L1:timer/NCX_GREAT-start | ||
60 | 1113 L1:timer/NCX_GREAT-stop | ||
61 | 1114 L1:timer/NCX_GREAT-timeout | ||
62 | 1115 L1:timer/LAST_RESEL-start | ||
63 | 1116 L1:timer/LAST_RESEL-stop | ||
64 | 1117 L1:timer/LAST_RESEL-timeout | ||
65 | 1118 L1:timer/FORBIDDEN_CELLS-start | ||
66 | 1119 L1:timer/FORBIDDEN_CELLS-stop | ||
67 | 111A L1:timer/FORBIDDEN_CELLS-timeout | ||
68 | 111B L1:timer/CS_SCANN-start | ||
69 | 111C L1:timer/CS_SCANN-stop | ||
70 | 111D L1:timer/CS_SCANN-timeout | ||
71 | 111E L1:timer/WEAK_NEIGH-start | ||
72 | 111F L1:timer/WEAK_NEIGH-stop | ||
73 | 1120 L1:timer/WEAK_NEIGH-timeout | ||
74 | 1121 L1:timer/MEAS_REQ-start | ||
75 | 1122 L1:timer/MEAS_REQ-stop | ||
76 | 1123 L1:timer/MEAS_REQ-timeout | ||
77 | 1124 L1:timer/OWN_BCCH_PER-start | ||
78 | 1125 L1:timer/OWN_BCCH_PER-stop | ||
79 | 1126 L1:timer/OWN_BCCH_PER-timeout | ||
80 | 1127 L1:timer/OLD_SCELL-start | ||
81 | 1128 L1:timer/OLD_SCELL-stop | ||
82 | 1129 L1:timer/OLD_SCELL-timeout | ||
83 | 112A L1:timer/PLMN_SEARCH-start | ||
84 | 112B L1:timer/PLMN_SEARCH-stop | ||
85 | 112C L1:timer/PLMN_SEARCH-timeout | ||
86 | 18XX MDI:m2d/MDI_M2D_MSG_TRA | ||
87 | 1800 MDI:m2d/INVALID_MDI_MSG 0 | ||
88 | 1801 MDI:m2d/INVALID_MDI_MSG 1 | ||
89 | 1802 MDI:m2d/CHANNEL_CONFIGURE | ||
90 | 1803 MDI:m2d/DEACTIVATE | ||
91 | 1804 MDI:m2d/CBCH | ||
92 | 1805 MDI:m2d/FROM_MCU_TO_FBUS | ||
93 | 1806 MDI:m2d/CIPHER_KEY | ||
94 | 1807 MDI:m2d/MEAS_PLMN_RSSI | ||
95 | 1808 MDI:m2d/TYPE_TEST_ENABLED | ||
96 | 1809 MDI:m2d/PSW_SEARCH_LIST | ||
97 | 180A MDI:m2d/INVALID_MDI_MSG 10 | ||
98 | 180B MDI:m2d/HOPPING_PARAMETERS | ||
99 | 180C MDI:m2d/IDLE_RA | ||
100 | 180D MDI:m2d/MODULATOR_TABLE | ||
101 | 180E MDI:m2d/MODULATOR_DC_OFFSET | ||
102 | 180F MDI:m2d/NEIGHBOUR_LIST | ||
103 | 1810 MDI:m2d/NEXT_BCCH | ||
104 | 1811 MDI:m2d/NMEAS_INSTRUCTIONS | ||
105 | 1812 MDI:m2d/INVALID_MDI_MSG 18 | ||
106 | 1813 MDI:m2d/ON_OFF_CIPHER | ||
107 | 1814 MDI:m2d/CIPHER_PARAMETERS | ||
108 | 1815 MDI:m2d/INVALID_MDI_MSG 21 | ||
109 | 1816 MDI:m2d/INVALID_MDI_MSG 22 | ||
110 | 1817 MDI:m2d/INVALID_MDI_MSG 23 | ||
111 | 1818 MDI:m2d/INVALID_MDI_MSG 24 | ||
112 | 1819 MDI:m2d/INVALID_MDI_MSG 25 | ||
113 | 181A MDI:m2d/SEARCH_LIST | ||
114 | 181B MDI:m2d/SEND_BLOCK | ||
115 | 181C MDI:m2d/INVALID_MDI_MSG 28 | ||
116 | 181D MDI:m2d/INVALID_MDI_MSG 29 | ||
117 | 181E MDI:m2d/INVALID_MDI_MSG 30 | ||
118 | 181F MDI:m2d/TX_CONTROL | ||
119 | 1820 MDI:m2d/INVALID_MDI_MSG 32 | ||
120 | 1821 MDI:m2d/INVALID_MDI_MSG 33 | ||
121 | 1822 MDI:m2d/INVALID_MDI_MSG 34 | ||
122 | 1823 MDI:m2d/INVALID_MDI_MSG 35 | ||
123 | 1824 MDI:m2d/INVALID_MDI_MSG 36 | ||
124 | 1825 MDI:m2d/INVALID_MDI_MSG 37 | ||
125 | 1826 MDI:m2d/INVALID_MDI_MSG 38 | ||
126 | 1827 MDI:m2d/INVALID_MDI_MSG 39 | ||
127 | 1828 MDI:m2d/IR_LINK_STATUS | ||
128 | 1829 MDI:m2d/INVALID_MDI_MSG 41 | ||
129 | 182A MDI:m2d/INVALID_MDI_MSG 42 | ||
130 | 182B MDI:m2d/INVALID_MDI_MSG 43 | ||
131 | 182C MDI:m2d/DSP_CONSTANTS | ||
132 | 182D MDI:m2d/INVALID_MDI_MSG 45 | ||
133 | 182E MDI:m2d/INVALID_MDI_MSG 46 | ||
134 | 182F MDI:m2d/INVALID_MDI_MSG 47 | ||
135 | 1830 MDI:m2d/TX_ENABLE | ||
136 | 1831 MDI:m2d/MEAS_REQ_ON | ||
137 | 1832 MDI:m2d/INVALID_MDI_MSG 50 | ||
138 | 1833 MDI:m2d/INVALID_MDI_MSG 51 | ||
139 | 1834 MDI:m2d/INVALID_MDI_MSG 52 | ||
140 | 1835 MDI:m2d/INVALID_MDI_MSG 53 | ||
141 | 1836 MDI:m2d/DISCHARGE | ||
142 | 1837 MDI:m2d/INVALID_MDI_MSG 55 | ||
143 | 1838 MDI:m2d/TYPE_LOOP_BACK | ||
144 | 1839 MDI:m2d/PARAMETER_UPDATE | ||
145 | 183A MDI:m2d/RX_TX_CONTROL | ||
146 | 183B MDI:m2d/TEMPERATURE | ||
147 | 183C MDI:m2d/DSP_PARAMETERS | ||
148 | 183D MDI:m2d/INVALID_MDI_MSG 61 | ||
149 | 183E MDI:m2d/DTX_CONTROL | ||
150 | 183F MDI:m2d/POWER_LEVEL_RAMP | ||
151 | 1840 MDI:m2d/INVALID_MDI_MSG 64 | ||
152 | 1841 MDI:m2d/IGNORE_CBCH_MESSAGE | ||
153 | 1842 MDI:m2d/CBCH_BITMAP | ||
154 | 1843 MDI:m2d/INVALID_MDI_MSG 67 | ||
155 | 1844 MDI:m2d/INVALID_MDI_MSG 68 | ||
156 | 1845 MDI:m2d/OWN_BCCH | ||
157 | 1846 MDI:m2d/MSI | ||
158 | 1847 MDI:m2d/LOOP_BACK | ||
159 | 1848 MDI:m2d/LOOP_BACK_SHORT | ||
160 | 1849 MDI:m2d/RTC_CALIBRATION_REQUEST | ||
161 | 184A MDI:m2d/TXC_BIAS_RESULT | ||
162 | 184B MDI:m2d/MORE_RSSI | ||
163 | 184C MDI:m2d/FBUS_MODE | ||
164 | 184D MDI:m2d/SEND_DTE_DATA_BLOCK | ||
165 | 184E MDI:m2d/SEND_IRLAP_DATA_BLOCK | ||
166 | 184F MDI:m2d/DATA_CODING_MODE | ||
167 | 1850 MDI:m2d/SEND_TCH_DATA_BLOCK | ||
168 | 1851 MDI:m2d/INVALID_MDI_MSG 81 | ||
169 | 1852 MDI:m2d/INVALID_MDI_MSG 82 | ||
170 | 1853 MDI:m2d/INVALID_MDI_MSG 83 | ||
171 | 1854 MDI:m2d/INVALID_MDI_MSG 84 | ||
172 | 1855 MDI:m2d/INVALID_MDI_MSG 85 | ||
173 | 1856 MDI:m2d/INVALID_MDI_MSG 86 | ||
174 | 1857 MDI:m2d/INVALID_MDI_MSG 87 | ||
175 | 1858 MDI:m2d/INVALID_MDI_MSG 88 | ||
176 | 1859 MDI:m2d/INVALID_MDI_MSG 89 | ||
177 | 185A MDI:m2d/INVALID_MDI_MSG 90 | ||
178 | 185B MDI:m2d/INVALID_MDI_MSG 91 | ||
179 | 185C MDI:m2d/INVALID_MDI_MSG 92 | ||
180 | 185D MDI:m2d/INVALID_MDI_MSG 93 | ||
181 | 185E MDI:m2d/INVALID_MDI_MSG 94 | ||
182 | 185F MDI:m2d/INVALID_MDI_MSG 95 | ||
183 | 1860 MDI:m2d/INVALID_MDI_MSG 96 | ||
184 | 1861 MDI:m2d/INVALID_MDI_MSG 97 | ||
185 | 1862 MDI:m2d/INVALID_MDI_MSG 98 | ||
186 | 1863 MDI:m2d/INVALID_MDI_MSG 99 | ||
187 | 1864 MDI:m2d/INVALID_MDI_MSG 100 | ||
188 | 1865 MDI:m2d/INVALID_MDI_MSG 101 | ||
189 | 1866 MDI:m2d/INVALID_MDI_MSG 102 | ||
190 | 1867 MDI:m2d/INVALID_MDI_MSG 103 | ||
191 | 1868 MDI:m2d/INVALID_MDI_MSG 104 | ||
192 | 1869 MDI:m2d/INVALID_MDI_MSG 105 | ||
193 | 186A MDI:m2d/INVALID_MDI_MSG 106 | ||
194 | 186B MDI:m2d/INVALID_MDI_MSG 107 | ||
195 | 186C MDI:m2d/INVALID_MDI_MSG 108 | ||
196 | 186D MDI:m2d/INVALID_MDI_MSG 109 | ||
197 | 186E MDI:m2d/INVALID_MDI_MSG 110 | ||
198 | 186F MDI:m2d/INVALID_MDI_MSG 111 | ||
199 | 1870 MDI:m2d/COMMAND_LOCAL | ||
200 | 1871 MDI:m2d/INVALID_MDI_MSG 113 | ||
201 | 1872 MDI:m2d/INVALID_MDI_MSG 114 | ||
202 | 1873 MDI:m2d/INVALID_MDI_MSG 115 | ||
203 | 1874 MDI:m2d/RESPONSE_LOCAL | ||
204 | 1875 MDI:m2d/INVALID_MDI_MSG 117 | ||
205 | 1876 MDI:m2d/INVALID_MDI_MSG 118 | ||
206 | 1877 MDI:m2d/INVALID_MDI_MSG 119 | ||
207 | 1878 MDI:m2d/INVALID_MDI_MSG 120 | ||
208 | 1879 MDI:m2d/INVALID_MDI_MSG 121 | ||
209 | 187A MDI:m2d/INVALID_MDI_MSG 122 | ||
210 | 187B MDI:m2d/INVALID_MDI_MSG 123 | ||
211 | 187C MDI:m2d/INVALID_MDI_MSG 124 | ||
212 | 187D MDI:m2d/INVALID_MDI_MSG 125 | ||
213 | 187E MDI:m2d/INVALID_MDI_MSG 126 | ||
214 | 187F MDI:m2d/INVALID_MDI_MSG 127 | ||
215 | 1880 MDI:m2d/RECEIVED_BLOCK | ||
216 | 1881 MDI:m2d/MEAS_REQUEST | ||
217 | 1882 MDI:m2d/INVALID_MDI_MSG 130 | ||
218 | 1883 MDI:m2d/RSSI_RESULTS | ||
219 | 1884 MDI:m2d/RA_INFO | ||
220 | 1885 MDI:m2d/INVALID_MDI_MSG 133 | ||
221 | 1886 MDI:m2d/BLOCK_REQUEST | ||
222 | 1887 MDI:m2d/NO_BCCH_LEFT | ||
223 | 1888 MDI:m2d/NEIGHBOUR_TIMING_OFFSET | ||
224 | 1889 MDI:m2d/CHANNEL_CHANGED_CNF | ||
225 | 188A MDI:m2d/NO_PSW_FOUND | ||
226 | 188B MDI:m2d/ALL_RSSI_RESULTS | ||
227 | 188C MDI:m2d/DOWNLINK_SIGNALLING_FAIL | ||
228 | 188D MDI:m2d/FBUS_DISCONNECTED | ||
229 | 188E MDI:m2d/FROM_FBUS_TO_MCU | ||
230 | 188F MDI:m2d/NO_PSW_LEFT | ||
231 | 1890 MDI:m2d/INVALID_MDI_MSG 144 | ||
232 | 1891 MDI:m2d/INVALID_MDI_MSG 145 | ||
233 | 1892 MDI:m2d/INVALID_MDI_MSG 146 | ||
234 | 1893 MDI:m2d/INVALID_MDI_MSG 147 | ||
235 | 1894 MDI:m2d/FBUS_ERROR | ||
236 | 1895 MDI:m2d/IR_DISABLED | ||
237 | 1896 MDI:m2d/LOOP_BACK_REPLY | ||
238 | 1897 MDI:m2d/LOOP_BACK_SHORT_REPLY | ||
239 | 1898 MDI:m2d/RTC_CALIBRATION_VALUE | ||
240 | 1899 MDI:m2d/TXC_BIAS_MEAS | ||
241 | 189A MDI:m2d/RECEIVED_DTE_DATA_BLOCK | ||
242 | 189B MDI:m2d/RECEIVED_IRLAP_DATA_BLOCK | ||
243 | 189C MDI:m2d/RECEIVED_TCH_DATA_BLOCK | ||
244 | 189D MDI:m2d/INVALID_MDI_MSG 157 | ||
245 | 189E MDI:m2d/INVALID_MDI_MSG 158 | ||
246 | 189F MDI:m2d/INVALID_MDI_MSG 159 | ||
247 | 18A0 MDI:m2d/INVALID_MDI_MSG 160 | ||
248 | 18A1 MDI:m2d/INVALID_MDI_MSG 161 | ||
249 | 18A2 MDI:m2d/INVALID_MDI_MSG 162 | ||
250 | 18A3 MDI:m2d/INVALID_MDI_MSG 163 | ||
251 | 18A4 MDI:m2d/INVALID_MDI_MSG 164 | ||
252 | 18A5 MDI:m2d/INVALID_MDI_MSG 165 | ||
253 | 18A6 MDI:m2d/INVALID_MDI_MSG 166 | ||
254 | 18A7 MDI:m2d/INVALID_MDI_MSG 167 | ||
255 | 18A8 MDI:m2d/INVALID_MDI_MSG 168 | ||
256 | 18A9 MDI:m2d/INVALID_MDI_MSG 169 | ||
257 | 18AA MDI:m2d/INVALID_MDI_MSG 170 | ||
258 | 18AB MDI:m2d/UNKNOWN_MDI_MSG | ||
259 | 19XX MDI:d2m/MDI_D2M_MSG_TRA | ||
260 | 1900 MDI:d2m/INVALID_MDI_MSG 0 | ||
261 | 1901 MDI:d2m/INVALID_MDI_MSG 1 | ||
262 | 1902 MDI:d2m/CHANNEL_CONFIGURE | ||
263 | 1903 MDI:d2m/DEACTIVATE | ||
264 | 1904 MDI:d2m/CBCH | ||
265 | 1905 MDI:d2m/FROM_MCU_TO_FBUS | ||
266 | 1906 MDI:d2m/CIPHER_KEY | ||
267 | 1907 MDI:d2m/MEAS_PLMN_RSSI | ||
268 | 1908 MDI:d2m/TYPE_TEST_ENABLED | ||
269 | 1909 MDI:d2m/PSW_SEARCH_LIST | ||
270 | 190A MDI:d2m/INVALID_MDI_MSG 10 | ||
271 | 190B MDI:d2m/HOPPING_PARAMETERS | ||
272 | 190C MDI:d2m/IDLE_RA | ||
273 | 190D MDI:d2m/MODULATOR_TABLE | ||
274 | 190E MDI:d2m/MODULATOR_DC_OFFSET | ||
275 | 190F MDI:d2m/NEIGHBOUR_LIST | ||
276 | 1910 MDI:d2m/NEXT_BCCH | ||
277 | 1911 MDI:d2m/NMEAS_INSTRUCTIONS | ||
278 | 1912 MDI:d2m/INVALID_MDI_MSG 18 | ||
279 | 1913 MDI:d2m/ON_OFF_CIPHER | ||
280 | 1914 MDI:d2m/CIPHER_PARAMETERS | ||
281 | 1915 MDI:d2m/INVALID_MDI_MSG 21 | ||
282 | 1916 MDI:d2m/INVALID_MDI_MSG 22 | ||
283 | 1917 MDI:d2m/INVALID_MDI_MSG 23 | ||
284 | 1918 MDI:d2m/INVALID_MDI_MSG 24 | ||
285 | 1919 MDI:d2m/INVALID_MDI_MSG 25 | ||
286 | 191A MDI:d2m/SEARCH_LIST | ||
287 | 191B MDI:d2m/SEND_BLOCK | ||
288 | 191C MDI:d2m/INVALID_MDI_MSG 28 | ||
289 | 191D MDI:d2m/INVALID_MDI_MSG 29 | ||
290 | 191E MDI:d2m/INVALID_MDI_MSG 30 | ||
291 | 191F MDI:d2m/TX_CONTROL | ||
292 | 1920 MDI:d2m/INVALID_MDI_MSG 32 | ||
293 | 1921 MDI:d2m/INVALID_MDI_MSG 33 | ||
294 | 1922 MDI:d2m/INVALID_MDI_MSG 34 | ||
295 | 1923 MDI:d2m/INVALID_MDI_MSG 35 | ||
296 | 1924 MDI:d2m/INVALID_MDI_MSG 36 | ||
297 | 1925 MDI:d2m/INVALID_MDI_MSG 37 | ||
298 | 1926 MDI:d2m/INVALID_MDI_MSG 38 | ||
299 | 1927 MDI:d2m/INVALID_MDI_MSG 39 | ||
300 | 1928 MDI:d2m/IR_LINK_STATUS | ||
301 | 1929 MDI:d2m/INVALID_MDI_MSG 41 | ||
302 | 192A MDI:d2m/INVALID_MDI_MSG 42 | ||
303 | 192B MDI:d2m/INVALID_MDI_MSG 43 | ||
304 | 192C MDI:d2m/DSP_CONSTANTS | ||
305 | 192D MDI:d2m/INVALID_MDI_MSG 45 | ||
306 | 192E MDI:d2m/INVALID_MDI_MSG 46 | ||
307 | 192F MDI:d2m/INVALID_MDI_MSG 47 | ||
308 | 1930 MDI:d2m/TX_ENABLE | ||
309 | 1931 MDI:d2m/MEAS_REQ_ON | ||
310 | 1932 MDI:d2m/INVALID_MDI_MSG 50 | ||
311 | 1933 MDI:d2m/INVALID_MDI_MSG 51 | ||
312 | 1934 MDI:d2m/INVALID_MDI_MSG 52 | ||
313 | 1935 MDI:d2m/INVALID_MDI_MSG 53 | ||
314 | 1936 MDI:d2m/DISCHARGE | ||
315 | 1937 MDI:d2m/INVALID_MDI_MSG 55 | ||
316 | 1938 MDI:d2m/TYPE_LOOP_BACK | ||
317 | 1939 MDI:d2m/PARAMETER_UPDATE | ||
318 | 193A MDI:d2m/RX_TX_CONTROL | ||
319 | 193B MDI:d2m/TEMPERATURE | ||
320 | 193C MDI:d2m/DSP_PARAMETERS | ||
321 | 193D MDI:d2m/INVALID_MDI_MSG 61 | ||
322 | 193E MDI:d2m/DTX_CONTROL | ||
323 | 193F MDI:d2m/POWER_LEVEL_RAMP | ||
324 | 1940 MDI:d2m/INVALID_MDI_MSG 64 | ||
325 | 1941 MDI:d2m/IGNORE_CBCH_MESSAGE | ||
326 | 1942 MDI:d2m/CBCH_BITMAP | ||
327 | 1943 MDI:d2m/INVALID_MDI_MSG 67 | ||
328 | 1944 MDI:d2m/INVALID_MDI_MSG 68 | ||
329 | 1945 MDI:d2m/OWN_BCCH | ||
330 | 1946 MDI:d2m/MSI | ||
331 | 1947 MDI:d2m/LOOP_BACK | ||
332 | 1948 MDI:d2m/LOOP_BACK_SHORT | ||
333 | 1949 MDI:d2m/RTC_CALIBRATION_REQUEST | ||
334 | 194A MDI:d2m/TXC_BIAS_RESULT | ||
335 | 194B MDI:d2m/MORE_RSSI | ||
336 | 194C MDI:d2m/FBUS_MODE | ||
337 | 194D MDI:d2m/SEND_DTE_DATA_BLOCK | ||
338 | 194E MDI:d2m/SEND_IRLAP_DATA_BLOCK | ||
339 | 194F MDI:d2m/DATA_CODING_MODE | ||
340 | 1950 MDI:d2m/SEND_TCH_DATA_BLOCK | ||
341 | 1951 MDI:d2m/INVALID_MDI_MSG 81 | ||
342 | 1952 MDI:d2m/INVALID_MDI_MSG 82 | ||
343 | 1953 MDI:d2m/INVALID_MDI_MSG 83 | ||
344 | 1954 MDI:d2m/INVALID_MDI_MSG 84 | ||
345 | 1955 MDI:d2m/INVALID_MDI_MSG 85 | ||
346 | 1956 MDI:d2m/INVALID_MDI_MSG 86 | ||
347 | 1957 MDI:d2m/INVALID_MDI_MSG 87 | ||
348 | 1958 MDI:d2m/INVALID_MDI_MSG 88 | ||
349 | 1959 MDI:d2m/INVALID_MDI_MSG 89 | ||
350 | 195A MDI:d2m/INVALID_MDI_MSG 90 | ||
351 | 195B MDI:d2m/INVALID_MDI_MSG 91 | ||
352 | 195C MDI:d2m/INVALID_MDI_MSG 92 | ||
353 | 195D MDI:d2m/INVALID_MDI_MSG 93 | ||
354 | 195E MDI:d2m/INVALID_MDI_MSG 94 | ||
355 | 195F MDI:d2m/INVALID_MDI_MSG 95 | ||
356 | 1960 MDI:d2m/INVALID_MDI_MSG 96 | ||
357 | 1961 MDI:d2m/INVALID_MDI_MSG 97 | ||
358 | 1962 MDI:d2m/INVALID_MDI_MSG 98 | ||
359 | 1963 MDI:d2m/INVALID_MDI_MSG 99 | ||
360 | 1964 MDI:d2m/INVALID_MDI_MSG 100 | ||
361 | 1965 MDI:d2m/INVALID_MDI_MSG 101 | ||
362 | 1966 MDI:d2m/INVALID_MDI_MSG 102 | ||
363 | 1967 MDI:d2m/INVALID_MDI_MSG 103 | ||
364 | 1968 MDI:d2m/INVALID_MDI_MSG 104 | ||
365 | 1969 MDI:d2m/INVALID_MDI_MSG 105 | ||
366 | 196A MDI:d2m/INVALID_MDI_MSG 106 | ||
367 | 196B MDI:d2m/INVALID_MDI_MSG 107 | ||
368 | 196C MDI:d2m/INVALID_MDI_MSG 108 | ||
369 | 196D MDI:d2m/INVALID_MDI_MSG 109 | ||
370 | 196E MDI:d2m/INVALID_MDI_MSG 110 | ||
371 | 196F MDI:d2m/INVALID_MDI_MSG 111 | ||
372 | 1970 MDI:d2m/COMMAND_LOCAL | ||
373 | 1971 MDI:d2m/INVALID_MDI_MSG 113 | ||
374 | 1972 MDI:d2m/INVALID_MDI_MSG 114 | ||
375 | 1973 MDI:d2m/INVALID_MDI_MSG 115 | ||
376 | 1974 MDI:d2m/RESPONSE_LOCAL | ||
377 | 1975 MDI:d2m/INVALID_MDI_MSG 117 | ||
378 | 1976 MDI:d2m/INVALID_MDI_MSG 118 | ||
379 | 1977 MDI:d2m/INVALID_MDI_MSG 119 | ||
380 | 1978 MDI:d2m/INVALID_MDI_MSG 120 | ||
381 | 1979 MDI:d2m/INVALID_MDI_MSG 121 | ||
382 | 197A MDI:d2m/INVALID_MDI_MSG 122 | ||
383 | 197B MDI:d2m/INVALID_MDI_MSG 123 | ||
384 | 197C MDI:d2m/INVALID_MDI_MSG 124 | ||
385 | 197D MDI:d2m/INVALID_MDI_MSG 125 | ||
386 | 197E MDI:d2m/INVALID_MDI_MSG 126 | ||
387 | 197F MDI:d2m/INVALID_MDI_MSG 127 | ||
388 | 1980 MDI:d2m/RECEIVED_BLOCK | ||
389 | 1981 MDI:d2m/MEAS_REQUEST | ||
390 | 1982 MDI:d2m/INVALID_MDI_MSG 130 | ||
391 | 1983 MDI:d2m/RSSI_RESULTS | ||
392 | 1984 MDI:d2m/RA_INFO | ||
393 | 1985 MDI:d2m/INVALID_MDI_MSG 133 | ||
394 | 1986 MDI:d2m/BLOCK_REQUEST | ||
395 | 1987 MDI:d2m/NO_BCCH_LEFT | ||
396 | 1988 MDI:d2m/NEIGHBOUR_TIMING_OFFSET | ||
397 | 1989 MDI:d2m/CHANNEL_CHANGED_CNF | ||
398 | 198A MDI:d2m/NO_PSW_FOUND | ||
399 | 198B MDI:d2m/ALL_RSSI_RESULTS | ||
400 | 198C MDI:d2m/DOWNLINK_SIGNALLING_FAIL | ||
401 | 198D MDI:d2m/FBUS_DISCONNECTED | ||
402 | 198E MDI:d2m/FROM_FBUS_TO_MCU | ||
403 | 198F MDI:d2m/NO_PSW_LEFT | ||
404 | 1990 MDI:d2m/INVALID_MDI_MSG 144 | ||
405 | 1991 MDI:d2m/INVALID_MDI_MSG 145 | ||
406 | 1992 MDI:d2m/INVALID_MDI_MSG 146 | ||
407 | 1993 MDI:d2m/INVALID_MDI_MSG 147 | ||
408 | 1994 MDI:d2m/FBUS_ERROR | ||
409 | 1995 MDI:d2m/IR_DISABLED | ||
410 | 1996 MDI:d2m/LOOP_BACK_REPLY | ||
411 | 1997 MDI:d2m/LOOP_BACK_SHORT_REPLY | ||
412 | 1998 MDI:d2m/RTC_CALIBRATION_VALUE | ||
413 | 1999 MDI:d2m/TXC_BIAS_MEAS | ||
414 | 199A MDI:d2m/RECEIVED_DTE_DATA_BLOCK | ||
415 | 199B MDI:d2m/RECEIVED_IRLAP_DATA_BLOCK | ||
416 | 199C MDI:d2m/RECEIVED_TCH_DATA_BLOCK | ||
417 | 199D MDI:d2m/INVALID_MDI_MSG 157 | ||
418 | 199E MDI:d2m/INVALID_MDI_MSG 158 | ||
419 | 199F MDI:d2m/INVALID_MDI_MSG 159 | ||
420 | 19A0 MDI:d2m/INVALID_MDI_MSG 160 | ||
421 | 19A1 MDI:d2m/INVALID_MDI_MSG 161 | ||
422 | 19A2 MDI:d2m/INVALID_MDI_MSG 162 | ||
423 | 19A3 MDI:d2m/INVALID_MDI_MSG 163 | ||
424 | 19A4 MDI:d2m/INVALID_MDI_MSG 164 | ||
425 | 19A5 MDI:d2m/INVALID_MDI_MSG 165 | ||
426 | 19A6 MDI:d2m/INVALID_MDI_MSG 166 | ||
427 | 19A7 MDI:d2m/INVALID_MDI_MSG 167 | ||
428 | 19A8 MDI:d2m/INVALID_MDI_MSG 168 | ||
429 | 19A9 MDI:d2m/INVALID_MDI_MSG 169 | ||
430 | 19AA MDI:d2m/INVALID_MDI_MSG 170 | ||
431 | 19AB MDI:d2m/UNKNOWN_MDI_MSG | ||
432 | 1CXX L1:ph_rr/L1_PH_RR_MSG_TRA | ||
433 | 1C00 L1:ph_rr/RR->:ACTIVATE_CNF(1/0002) | ||
434 | 1C01 L1:ph_rr/RR<-:ACTIVATE_REQ(1/03E9) | ||
435 | 1C02 L1:ph_rr/RR<-:DEACTIVATE_REQ(1/03EA) | ||
436 | 1C03 L1:ph_rr/RR<-:START_AG_LISTEN_REQ(1/03EB) | ||
437 | 1C04 L1:ph_rr/RR<-:STOP_AG_LISTEN_REQ(1/03EC) | ||
438 | 1C05 L1:ph_rr/RR<-:ASSIGN_REQ(1/03ED) | ||
439 | 1C06 L1:ph_rr/HANDOVER_REQ(1/03EE) | ||
440 | 1C07 L1:ph_rr/RR<-:FREQUENCY_REDEF_REQ(1/03EF) | ||
441 | 1C08 L1:ph_rr/RR<-:BACK_TO_PREV_CH_REQ(1/03F0) | ||
442 | 1C09 L1:ph_rr/RR<-:DECONFIG_REQ(1/03F1) | ||
443 | 1C0A L1:ph_rr/RR<-:CH_MODE_MODIFY_REQ(1/03F2) | ||
444 | 1C0B L1:ph_rr/RR<-:PHYS_INFO_REQ(1/03F3) | ||
445 | 1C0C L1:ph_rr/RR<-:CIPHER_START_REQ(1/03F4) | ||
446 | 1C0D L1:ph_rr/RR<-:CIPHER_STOP_REQ(1/03F5) | ||
447 | 1C0E L1:ph_rr/RR<-:PAGE_MODE_REQ(1/03F6) | ||
448 | 1C0F L1:ph_rr/RR->:AG_LISTEN_REJ(1/03F7) | ||
449 | 1C10 L1:ph_rr/RR<-:CONFIG_CNF(1/03F8) | ||
450 | 1C11 L1:ph_rr/RR->:ERROR_IND(1/03F9) | ||
451 | 1C12 L1:ph_rr/RR->:RANDOM_ACCESS_IND(1/03FA) | ||
452 | 1C13 L1:ph_rr/RR->:AG_TIMEOUT_IND(1/03FB) | ||
453 | 1C14 L1:ph_rr/RR->:RESEL_NEEDED_IND(1/03FC) | ||
454 | 1C15 L1:ph_rr/RR->:RESEL_FAIL_IND(1/03FD) | ||
455 | 1C16 L1:ph_rr/RR->:RESEL_IMPOSSIBLE_IND | ||
456 | 1C17 L1:ph_rr/RR<-:STOP_RA_SENDING_REQ | ||
457 | 1C18 L1:ph_rr/RR<-:LIMITED_SERVICE_REQ | ||
458 | 1C19 L1:ph_rr/MDI->:TX_INIT | ||
459 | 1C1A L1:ph_rr/RR<-:CONFIG_CHANGE_REQ | ||
460 | 1C24 (1/040D) | ||
461 | 1C25 (1/040E) | ||
462 | 1C26 (1/040F) | ||
463 | 1C27 (1/0410) | ||
464 | 1C28 (1/0411) | ||
465 | 1C29 (1/0412) | ||
466 | 1C2A (1/0413) | ||
467 | 1C2B (1/0414) | ||
468 | 1C2C (1/0415) | ||
469 | 1C2D (1/0416) | ||
470 | 1C2E (1/0417) | ||
471 | 1C2F (1/0418) | ||
472 | 1C30 (1/0419) | ||
473 | 1C31 (1/041A) | ||
474 | 1C32 (1/041B) | ||
475 | 1C33 (1/0420) | ||
476 | 1C34 (1/0425) | ||
477 | 20XX SIM:fil_msg/SIM_FIL_MSG_TRA | ||
478 | 2000 SIM:fil_msg/UNKNOWN_CMD | ||
479 | 2001 SIM:fil_msg/UPDATE_RECORD | ||
480 | 2002 SIM:fil_msg/RESET_SIM | ||
481 | 2003 SIM:fil_msg/DEACTIVATE_SIM | ||
482 | 2004 SIM:fil_msg/UNBLOCK_GSM_APPLICATION | ||
483 | 2005 SIM:fil_msg/SLEEP | ||
484 | 2006 SIM:fil_msg/STATUS | ||
485 | 2007 SIM:fil_msg/SELECT | ||
486 | 2008 SIM:fil_msg/SEEK | ||
487 | 2009 SIM:fil_msg/VERIFY_PIN | ||
488 | 200A SIM:fil_msg/CHANGE_PIN | ||
489 | 200B SIM:fil_msg/DISABLE_PIN | ||
490 | 200C SIM:fil_msg/RENABLE_PIN | ||
491 | 200D SIM:fil_msg/RUN_SIM_ALGORITHM | ||
492 | 200E SIM:fil_msg/READ_BINARY | ||
493 | 200F SIM:fil_msg/READ_RECORD | ||
494 | 2010 SIM:fil_msg/GET_RESPONSE | ||
495 | 2011 SIM:fil_msg/UPDATE_BINARY | ||
496 | 2012 SIM:fil_msg/INVALIDATE | ||
497 | 2013 SIM:fil_msg/REHABILITATE | ||
498 | 2014 SIM:fil_msg/INCREASE | ||
499 | 2015 SIM:fil_msg/RESET | ||
500 | 2016 SIM:fil_msg/DEACTIVATE | ||
501 | 2017 SIM:fil_msg/TERMINAL_PROFILE | ||
502 | 2018 SIM:fil_msg/ENVELOPE | ||
503 | 2019 SIM:fil_msg/FETCH | ||
504 | 201A SIM:fil_msg/TERMINAL_RESPONSE | ||
505 | 201B SIM:fil_msg/AUTHENTICATE | ||
506 | 201C SIM:fil_msg/AKEY_VALIDATE | ||
507 | 201D SIM:fil_msg/ASK_RANDOM | ||
508 | 201E SIM:fil_msg/UPDATE_SSD | ||
509 | 201F SIM:fil_msg/CONFIRM_SSD | ||
510 | 2020 SIM:fil_msg/CMEA_ENCRYPT | ||
511 | 2021 SIM:fil_msg/SWITCH_TO_5V | ||
512 | 2022 SIM:fil_msg/VOLTAGE_SET | ||
513 | 2023 SIM:fil_msg/SEND_ADM_CODE | ||
514 | 21XX SIM_L2:msg/SIM_L2_MSG_TRA | ||
515 | 2100 SIM_L2:msg/MSG_DATA | ||
516 | 22XX SIM_L2:data/SIM_L2_DATA_TRA | ||
517 | 2200 SIM_L2:data/RECEIVED_DATA | ||
518 | 2201 SIM_L2:data/SENT_DATA | ||
519 | 23XX SIM_L2:resp/SIM_L2_RESP_TRA | ||
520 | 2300 SIM_L2:resp/UNKNOWN_PRIMITIVE | ||
521 | 2301 SIM_L2:resp/CARD_NOT_OK | ||
522 | 2302 SIM_L2:resp/BINARY_DATA_AVAIL | ||
523 | 2303 SIM_L2:resp/FORMATTED_DATA_AVAIL | ||
524 | 2304 SIM_L2:resp/SRES_KC_DATA_AVAIL | ||
525 | 2305 SIM_L2:resp/DFIELD_INFO_AVAIL | ||
526 | 2306 SIM_L2:resp/DIR_INFO_AVAIL | ||
527 | 2307 SIM_L2:resp/ATR_TRACE | ||
528 | 2308 SIM_L2:resp/MEMORY_PROBLEM | ||
529 | 2309 SIM_L2:resp/OK | ||
530 | 230A SIM_L2:resp/DFIELD_NOT_SELECTED | ||
531 | 230B SIM_L2:resp/PATTERN_NOT_FOUND | ||
532 | 230C SIM_L2:resp/OUT_OF_RANGE | ||
533 | 230D SIM_L2:resp/ILLEGAL_OPERATION | ||
534 | 230E SIM_L2:resp/NO_PIN | ||
535 | 230F SIM_L2:resp/SECURITY_VIOLATION | ||
536 | 2310 SIM_L2:resp/PIN_STATUS_MISMATCH | ||
537 | 2311 SIM_L2:resp/CARD_BLOCKED | ||
538 | 2312 SIM_L2:resp/TECH_PROB_NO_DIAG | ||
539 | 2313 SIM_L2:resp/CARD_DISCONNECTED | ||
540 | 2314 SIM_L2:resp/ICC_INSERTED | ||
541 | 2315 SIM_L2:resp/MAX_VALUE_REACHED | ||
542 | 2316 SIM_L2:resp/DUALMODE_DATA_AVAIL | ||
543 | 2317 SIM_L2:resp/3V_SIM | ||
544 | 2318 SIM_L2:resp/5V_SIM | ||
545 | 2319 SIM_L2:resp/ENHANCED_PTS | ||
546 | 231A SIM_L2:resp/ATR_FAILED | ||
547 | 231B SIM_L2:resp/ERROR_IN_ATR | ||
548 | 231C SIM_L2:resp/SEND_FAILED | ||
549 | 231D SIM_L2:resp/PARITY_ERROR | ||
550 | 231E SIM_L2:resp/TIMEOUT_ERROR | ||
551 | 231F SIM_L2:resp/COMM_ERROR | ||
552 | 2320 SIM_L2:resp/OVERFLOW_ERROR | ||
553 | 2321 SIM_L2:resp/RESP_NOT_OK | ||
554 | 2322 SIM_L2:resp/FETCH_REQUEST | ||
555 | 2323 SIM_L2:resp/PROACTIVE_CMD | ||
556 | 2324 SIM_L2:resp/INCREASE_INFO | ||
557 | 2325 SIM_L2:resp/ENVELOPE_RESP | ||
558 | 2326 SIM_L2:resp/INVALIDATION_STATUS_MISMATCH | ||
559 | 2327 SIM_L2:resp/DUALMODE_SIM_SSD_IS_INCORRECT | ||
560 | 2328 SIM_L2:resp/CARD_NOT_OK | ||
561 | 2329 SIM_L2:resp/ENVELOPE_RESP_AVAILABLE | ||
562 | 232A SIM_L2:resp/ATR_RECIEVED | ||
563 | 232B SIM_L2:resp/CARD_BUSY | ||
564 | 24XX L2:prim/L2_PRIMITIVE_TRA | ||
565 | 2400 L2:prim/RR->:EST_REQ(0/05DD) | ||
566 | 2401 L2:prim/RR->:RELEASE_REQ(0/05DE) | ||
567 | 2402 L2:prim/RR->:ABORT_REQ(0/05DF) | ||
568 | 2403 L2:prim/RR->:DATA_REQ(0/05E0) | ||
569 | 2404 L2:prim/RR->:UNIT_DATA_REQ(0/05E1) | ||
570 | 2405 L2:prim/RR->:SUSPEND_REQ(0/05E2) | ||
571 | 2406 L2:prim/RR->:RESUME_REQ(0/05E3) | ||
572 | 2407 L2:prim/RR->:RESUME_COMPLETE_REQ(0/060A) | ||
573 | 2408 L2:prim/RR->:LOCAL_RELEASE_REQ(0/060B) | ||
574 | 2409 L2:prim/RR<-:EST_CNF(0/05E6) | ||
575 | 240A L2:prim/RR<-:EST_IND(0/05E7) | ||
576 | 240B L2:prim/RR<-:RELEASE_CNF(0/05E8) | ||
577 | 240C L2:prim/RR<-:RELEASE_IND(0/05E9) | ||
578 | 240D L2:prim/RR<-:DATA_IND(0/05EA) | ||
579 | 240E L2:prim/RR<-:UNIT_DATA_IND(0/05EB) | ||
580 | 240F L2:prim/RR<-:SUSPEND_CNF(0/05EC) | ||
581 | 2410 L2:prim/RR<-:RESUME_CNF(0/05ED) | ||
582 | 2411 L2:prim/RR<-:ERROR_IND(0/05EE) | ||
583 | 2412 L2:prim/RR<-:ABORT_IND(0/05EF) | ||
584 | 2413 (0/0623) | ||
585 | 2414 (0/0624) | ||
586 | 2415 (0/0622) | ||
587 | 2416 L2:prim/RR->:T200:TIMEOUT(0/05FB) | ||
588 | 2417 L2:prim/RR->:T203:TIMEOUT(0/05FA) | ||
589 | 2419 L2:prim/SMS->SAPI3_SACCH_REL_IND(0/0620) | ||
590 | 241A L2:prim/SMS->SAPI3_NON_SACCH_REL_IND(0/0621) | ||
591 | 25XX RR:prim/RR_PRIMITIVE_TRA | ||
592 | 2500 RR:prim/L2<-:DL_EST_REQ(1/05DD) | ||
593 | 2501 RR:prim/L2<-:DL_RELEASE_REQ(1/05DE) | ||
594 | 2502 RR:prim/L2<-:DL_ABORT_REQ(1/05DF) | ||
595 | 2503 RR:prim/L2<-:DL_DATA_REQ(1/05E0) | ||
596 | 2504 RR:prim/L2<-DL_UNIT_DATA_REQ(1/05E1) | ||
597 | 2505 RR:prim/L2<-:DL_SUSPEND_REQ(1/05E2) | ||
598 | 2506 RR:prim/L2<-:DL_RESUME_REQ(1/05E3) | ||
599 | 2507 RR:prim/L2<-:DL_RESUME_COMPLETE_REQ(1/060A) | ||
600 | 2508 RR:prim/L2<-:DL_LOCAL_RELEASE_REQ(1/060B) | ||
601 | 2509 RR:prim/L2->:DL_EST_CNF(1/05E6) | ||
602 | 250A RR:prim/L2<-:DL_EST_IND(1/05E7) | ||
603 | 250B RR:prim/L2->:DL_RELEASE_CNF(1/05E8) | ||
604 | 250C RR:prim/L2->:DL_RELEASE_IND(1/05E9) | ||
605 | 250D RR:prim/L2->:DL_DATA_IND(1/05EA) | ||
606 | 250E RR:prim/L2->:DL_UNIT_DATA_IND(1/05EB) | ||
607 | 250F RR:prim/L2->:DL_SUSPEND_CNF(1/05EC) | ||
608 | 2510 RR:prim/L2->:DL_RESUME_CNF(1/05ED) | ||
609 | 2511 RR:prim/L2->:DL_ERROR_IND(1/05EE) | ||
610 | 2512 RR:prim/L2->:DL_ABORT_IND(1/05EF) | ||
611 | 2513 RR:prim/MM->:REL_IND(1/07DB) | ||
612 | 2514 RR:prim/MM->:SYNC_IND(1/07DC) | ||
613 | 2515 RR:prim/MM->:TCH_NOT_ALLOC_IND(1/07E2) | ||
614 | 2516 (1/07E3) | ||
615 | 2517 RR:prim/MM->:DATA_IND(1/07DD) | ||
616 | 2518 RR:prim/MM<-:ABORT_REQ(1/07D5) | ||
617 | 2519 RR:prim/MM<-:ACTIVATE_REQ(1/07D6) | ||
618 | 251A (1/0824) | ||
619 | 251B (1/0A03) | ||
620 | 251C (1/0A04) | ||
621 | 251D (1/0A05) | ||
622 | 251E (1/0A06) | ||
623 | 251F (1/0A07) | ||
624 | 2521 (1/0A09) | ||
625 | 2523 (1/0825) | ||
626 | 2524 (1/0826) | ||
627 | 2525 (1/0A0A) | ||
628 | 2527 RR:prim/MM->:UNIT_DATA_IND(1/07DE) | ||
629 | 2528 (1/0A0B) | ||
630 | 2529 RR:prim/MM<-:DEACTIVATE_REQ(1/07D7) | ||
631 | 252A RR:prim/MM<-:CLASSMARK_CHANGE_REQ(1/07D8) | ||
632 | 252B (1/09FD) | ||
633 | 2531 RR:prim/MM->:TCH_SPEECH_ALLOC_IND(1/07E1) | ||
634 | 2533 (1/040D) | ||
635 | 2534 (1/03FE) | ||
636 | 2535 RR:prim/L1->:RANDOM_ACCESS_IND(1/0400) | ||
637 | 2536 RR:prim/L1->:RESEL_NEEDED_IND(1/0402) | ||
638 | 2537 (1/0405) | ||
639 | 2538 RR:prim/L1->:RESEL_IMPOSSIBLE_IND(1/0404) | ||
640 | 2539 RR:prim/L1->:AG_TIMEOUT_IND(1/0401) | ||
641 | 253A (1/0409) | ||
642 | 253B RR:prim/L1->:RESEL_FAIL_IND(1/0403) | ||
643 | 253C (1/0406) | ||
644 | 253D (1/040C) | ||
645 | 253E (1/040B) | ||
646 | 253F RR:prim/L1->:CIPHER_START_REQ(1/03F4) | ||
647 | 2540 (1/0804) | ||
648 | 2542 (1/07FE) | ||
649 | 2543 (1/0800) | ||
650 | 2544 (1/0803) | ||
651 | 2545 (1/0802) | ||
652 | 2546 (1/0801) | ||
653 | 2547 RR:prim/L1->:ERROR_IND(1/03FF) | ||
654 | 2548 RR:prim/L1->:HANDOVER_REQ(1/03EE) | ||
655 | 2556 RR:prim/L1->:CIPHER_STOP_REQ(1/03F5) | ||
656 | 2557 RR:prim/L1->:PAGE_MODE_REQ(1/03F6) | ||
657 | 2558 (1/07FD) | ||
658 | 255D (1/09FF) | ||
659 | 255E RR:prim/MM<-:EST_REQ(1/07D1) | ||
660 | 255F RR:prim/MM<-:REL_REQ(1/07D2) | ||
661 | 2560 RR:prim/MM<-:DATA_REQ(1/07D3) | ||
662 | 2561 RR:prim/MM<-:UNIT_DATA_REQ(1/07D4) | ||
663 | 2562 RR:prim/MM->:EST_CNF(1/07D9) | ||
664 | 2563 RR:prim/MM->:EST_IND(1/07DA) | ||
665 | 2564 RR:prim/MM->:ABORT_IND(1/07DF) | ||
666 | 2565 RR:prim/MM->:ACTIVATE_IND(1/07E0) | ||
667 | 2566 RR:prim/MM->:T3122_TIMEOUT_IND(1/07E4) | ||
668 | 2567 RR:prim/MM<-:PREACTIVATE_REQ(1/07E5) | ||
669 | 2568 RR:prim/MM->:PREACTIVATE_CNF(1/07E6) | ||
670 | 2569 (1/07E7) | ||
671 | 256A (1/09F7) | ||
672 | 256B (1/09F8) | ||
673 | 256C (1/09F9) | ||
674 | 256D (1/09FA) | ||
675 | 256E (1/09FB) | ||
676 | 256F (1/09FC) | ||
677 | 2570 (1/09FE) | ||
678 | 2571 (1/0A02) | ||
679 | 2572 (1/0A0C) | ||
680 | 26XX MM:prim/MM_PRIMITIVE_TRA | ||
681 | 2600 MM:prim/RM->:NREG_IND_LA_ON_REG_LIST(2/0A29) | ||
682 | 2601 MM:prim/RM->:CONN_COMPL_IND(2/0A2A) | ||
683 | 2602 MM:prim/RM->:CONN_REL_IND(2/0A2B) | ||
684 | 2603 (2/0A2C) | ||
685 | 2604 (2/0A2D) | ||
686 | 2605 MM:prim/RR->:LIMITED_SERVICE_STATE_REQ(2/0A2E) | ||
687 | 2606 MM:prim/RM->:PLMN_SEARCH_TERM_IND(2/0A2F) | ||
688 | 2607 MM:prim/RM<-:PLMN_SEARCH_START_REQ(2/0A30) | ||
689 | 2608 (2/0A36) | ||
690 | 2609 (2/0A37) | ||
691 | 260A (2/0A38) | ||
692 | 260B (2/0A39) | ||
693 | 260C (2/0A3B) | ||
694 | 260D (2/0A3C) | ||
695 | 260E (2/0A3E) | ||
696 | 260F (2/0A40) | ||
697 | 2610 (2/0A42) | ||
698 | 2611 (2/0A43) | ||
699 | 2612 (2/0A45) | ||
700 | 2613 (2/0A46) | ||
701 | 2614 (2/0A48) | ||
702 | 2615 (2/0A49) | ||
703 | 2616 (2/0A4B) | ||
704 | 2617 (2/0A4D) | ||
705 | 2618 (2/0A4F) | ||
706 | 261A (2/158C) | ||
707 | 261C (2/0A50) | ||
708 | 261D (2/158D) | ||
709 | 261E (2/1580) | ||
710 | 2620 (2/1581) | ||
711 | 2621 (2/1582) | ||
712 | 2623 (2/0A64) | ||
713 | 2624 (2/0A65) | ||
714 | 2625 (2/0A66) | ||
715 | 2626 (2/0A67) | ||
716 | 2627 (2/0A68) | ||
717 | 2628 (2/0A69) | ||
718 | 2629 (2/0A6A) | ||
719 | 262A (2/0A6C) | ||
720 | 262B (2/0A6D) | ||
721 | 262C (2/0A6E) | ||
722 | 262D (2/0A55) | ||
723 | 262E (2/0A56) | ||
724 | 262F (2/0A57) | ||
725 | 2630 (2/0A58) | ||
726 | 2631 (2/0A59) | ||
727 | 2632 (2/0A5A) | ||
728 | 2633 (2/0A62) | ||
729 | 2634 (2/0A63) | ||
730 | 2635 (2/0A85) | ||
731 | 2636 (2/0A87) | ||
732 | 2637 (2/0A8C) | ||
733 | 2638 (2/0A88) | ||
734 | 2639 (2/0A8D) | ||
735 | 263C (2/0DDF) | ||
736 | 263D MM:prim/RR<-:REL_IND(2/07DB) | ||
737 | 263E MM:prim/RR<-:SYNC_IND(2/07DC) | ||
738 | 263F (2/07E2) | ||
739 | 2640 MM:prim/RR<-:DATA_IND(2/07DD) | ||
740 | 2641 MM:prim/RR->:ABORT_REQ(2/07D5) | ||
741 | 2642 MM:prim/RR->:ACTIVATE_REQ(2/07D6) | ||
742 | 2643 MM:prim/CM<-:EST_REQ_EMERGENCY(2/0A03) | ||
743 | 2644 MM:prim/CM<-:REEST_REQ(2/0A04) | ||
744 | 2645 MM:prim/CM<-:REL_REQ(2/0A05) | ||
745 | 2646 MM:prim/CM<-:DATA_REQ(2/0A06) | ||
746 | 2647 MM:prim/MM<-:LAI_LISTS_TIMEOUT(2/0A07) | ||
747 | 2649 MM:prim/CM->:EST_CNF(2/0A09) | ||
748 | 264B MM:prim/CM->:ERROR_IND(2/0A0A) | ||
749 | 264C (2/0A0B) | ||
750 | 264D MM:prim/RR->:DEACTIVATE_REQ(2/07D7) | ||
751 | 264E (2/07D8) | ||
752 | 264F MM:prim/MM<-:T3240_TIMEOUT(2/09FD) | ||
753 | 2653 MM:prim/RR<-:UNIT_DATA_IND(2/07DE) | ||
754 | 2654 (2/07E1) | ||
755 | 2655 (2/0A5B) | ||
756 | 2656 (2/0A5C) | ||
757 | 2657 (2/0A5D) | ||
758 | 2658 (2/0A5E) | ||
759 | 2659 (2/0A5F) | ||
760 | 265A (2/0A60) | ||
761 | 265B (2/0A61) | ||
762 | 265C (2/0A81) | ||
763 | 265D (2/0A6B) | ||
764 | 265E MM:prim/SMS<-:DATA_REQ(2/09C9) | ||
765 | 265F MM:prim/SMS->:ERROR_IND(2/09CA) | ||
766 | 2660 (2/158A) | ||
767 | 2668 (2/0AA0) | ||
768 | 2669 (2/0AA1) | ||
769 | 266A MM:prim/SMS->:REL_IND(2/09CB) | ||
770 | 2675 (2/1584) | ||
771 | 2676 (2/1585) | ||
772 | 2677 (2/1586) | ||
773 | 2678 (2/1587) | ||
774 | 2679 (2/1588) | ||
775 | 267A (2/158E) | ||
776 | 267B MM:prim/RR->:EST_REQ(2/07D1) | ||
777 | 267C MM:prim/RR->:REL_REQ(2/07D2) | ||
778 | 267D MM:prim/RR->:DATA_REQ(2/07D3) | ||
779 | 267E (2/07D4) | ||
780 | 267F MM:prim/RR<-:EST_CNF(2/07D9) | ||
781 | 2680 MM:prim/RR<-:EST_IND(2/07DA) | ||
782 | 2681 MM:prim/RR<-:ABORT_IND(2/07DF) | ||
783 | 2682 MM:prim/RR<-:ACTIVATE_IND(2/07E0) | ||
784 | 2683 MM:prim/RR<-:T3122_TIMEOUT_IND(2/07E4) | ||
785 | 2684 MM:prim/RR->:PREACTIVATE_REQ(2/07E5) | ||
786 | 2685 MM:prim/RR->:PREACTIVATE_CNF(2/07E6) | ||
787 | 2686 (2/07E7) | ||
788 | 2687 MM:prim/MM<-:T3210_TIMEOUT(2/09F7) | ||
789 | 2688 MM:prim/MM<-:T3211_TIMEOUT(2/09F8) | ||
790 | 2689 MM:prim/MM<-:T3212_TIMEOUT(2/09F9) | ||
791 | 268A MM:prim/MM<-:T3213_TIMEOUT(2/09FA) | ||
792 | 268B MM:prim/MM<-:T3220_TIMEOUT(2/09FB) | ||
793 | 268C MM:prim/MM<-:T3230_TIMEOUT(2/09FC) | ||
794 | 268D MM:prim/RM->:NREG_IND_NO_IMSI(2/09FE) | ||
795 | 268E MM:prim/CM<-:EST_REQ_NORMAL(2/0A02) | ||
796 | 268F (2/0A0C) | ||
797 | 27XX CC:prim/CC_PRIMITIVE_TRA | ||
798 | 2700 (3/0FA2) | ||
799 | 2701 CC:prim/CS->:SETUP_REQ(3/0FA3) | ||
800 | 2702 CC:prim/CS->:EMERGENCY_SETUP_REQ(3/0FA4) | ||
801 | 2703 CC:prim/CS->:SETUP_RES(3/0FA5) | ||
802 | 2704 CC:prim/CS->:SETUP_REJ_REQ(3/0FA6) | ||
803 | 2705 CC:prim/CS->:CALL_CONF_REQ(3/0FA7) | ||
804 | 2706 CC:prim/CS->:MODIFY_REQ(3/0FA8) | ||
805 | 2707 CC:prim/CS->:NOTIFY_REQ(3/0FA9) | ||
806 | 2708 CC:prim/CS->:DISC_REQ(3/0FAA) | ||
807 | 2709 CC:prim/CS->:REL_REQ(3/0FAB) | ||
808 | 270A CC:prim/CS->:ALERTING_REQ(3/0FAC) | ||
809 | 270C CC:prim/CS->:STATUS_ENQ_REQ(3/0FAE) | ||
810 | 270E CC:prim/CS->:MODIFY_RES(3/0FB0) | ||
811 | 270F CC:prim/CS->:MODIFY_REJ_REQ(3/0FB1) | ||
812 | 2710 CC:prim/CS->:SS_REQ(3/0FB2) | ||
813 | 2711 CC:prim/CS->:REJ_REQ(3/0FB3) | ||
814 | 2712 CC:prim/CS<-:SETUP_IND(3/0FB4) | ||
815 | 2713 CC:prim/CS<-:SETUP_CNF(3/0FB5) | ||
816 | 2714 CC:prim/CS<-:SETUP_COMPL_IND(3/0FB6) | ||
817 | 2715 CC:prim/CS<-:CALL_PROC_IND(3/0FB7) | ||
818 | 2716 CC:prim/CS<-:PROGRESS_IND(3/0FB8) | ||
819 | 2717 CC:prim/CS<-:ALERT_IND(3/0FB9) | ||
820 | 271A CC:prim/CS<-:MODIFY_REJ_IND(3/0FBC) | ||
821 | 271B CC:prim/CS<-:NOTIFY_IND(3/0FBD) | ||
822 | 271C CC:prim/CS<-:DISC_IND(3/0FBE) | ||
823 | 271D CC:prim/CS->:REJ_IND(3/0FBF) | ||
824 | 271E CC:prim/CS->:REL_IND(3/0FC0) | ||
825 | 271F CC:prim/CS<-:START_DTMF_CNF(3/0FC1) | ||
826 | 2720 CC:prim/CS<-:START_DTMF_REJ_IND(3/0FC2) | ||
827 | 2721 CC:prim/CS<-:STATE_UPDATE_IND(3/0FC3) | ||
828 | 2722 CC:prim/CS<-:STATUS_IND(3/0FC4) | ||
829 | 2723 CC:prim/CS<-:STOP_DTMF_IND(3/0FC5) | ||
830 | 2724 CC:prim/CS<-:STOP_DTMF_CNF(3/0FC6) | ||
831 | 2725 CC:prim/CS<-:ERROR_IND(3/0FC7) | ||
832 | 2726 CC:prim/CS<-:SS_IND(3/0FC8) | ||
833 | 2727 CC:prim/CS<-:REL_CNF(3/0FC9) | ||
834 | 2728 CC:prim/CS<-:REL_COMPL_IND(3/0FCA) | ||
835 | 2729 CC:prim/MM<-:MM_CONN_COMPL_IND(3/0FCB) | ||
836 | 272A (3/100F) | ||
837 | 272B (3/1010) | ||
838 | 272C (3/1011) | ||
839 | 272D (3/1012) | ||
840 | 272E (3/1013) | ||
841 | 272F (3/1014) | ||
842 | 2730 (3/100D) | ||
843 | 2731 (3/100E) | ||
844 | 2732 (3/1020) | ||
845 | 2733 (3/101C) | ||
846 | 2734 (3/0A36) | ||
847 | 2735 (3/0A37) | ||
848 | 2736 (3/0A38) | ||
849 | 2737 (3/0A39) | ||
850 | 273E CC:prim/CS->:RESET_REQ(3/0FA1) | ||
851 | 28XX CS:prim/CS_PRIMITIVE_TRA | ||
852 | 2800 (5/15B4) | ||
853 | 2802 CS:prim/PLMN_SELECT(5/157D) | ||
854 | 2806 (5/15AE) | ||
855 | 2807 (5/15AF) | ||
856 | 280A (5/157E) | ||
857 | 280B (5/15B2) | ||
858 | 280C (5/15B3) | ||
859 | 280E (5/15B5) | ||
860 | 280F (5/15A4) | ||
861 | 2810 (5/15A5) | ||
862 | 2811 (5/15A6) | ||
863 | 2812 (5/15A7) | ||
864 | 2815 (5/15A8) | ||
865 | 2816 (5/15A9) | ||
866 | 2819 CS:prim/CC->:ALERT_IND(5/0FB9) | ||
867 | 281A CS:prim/CC<-ALERTING_REQ(5/0FAC) | ||
868 | 281B CS:prim/CC<-:CALL_CONF_REQ(5/0FA7) | ||
869 | 281D CS:prim/CC->:DISC_IND(5/0FBE) | ||
870 | 281E CS:prim/CC<-:DISC_REQ(5/0FAA) | ||
871 | 2820 (5/1010) | ||
872 | 2821 (5/100F) | ||
873 | 2822 (5/1011) | ||
874 | 2823 CS:prim/MM->:CONN_COMPL_IND(5/0FCB) | ||
875 | 2826 CS:prim/CC<-:MODIFY_REQ(5/0FA8) | ||
876 | 2827 CS:prim/CC->:MODIFY_RES(5/0FB0) | ||
877 | 2828 CS:prim/CC<-:MODIFY_REJ_REQ(5/0FB1) | ||
878 | 2829 CS:prim/CC->:MODIFY_REJ_IND(5/0FBC) | ||
879 | 282B CS:prim/CC->:PROGRESS_IND(5/0FB8) | ||
880 | 282C (5/100D) | ||
881 | 282D (5/100E) | ||
882 | 2830 CS:prim/CC<-:REL_IND(5/0FC0) | ||
883 | 2831 CS:prim/CC<-:REL_REQ(5/0FAB) | ||
884 | 2832 CS:prim/CC->:REL_COMPL_IND(5/0FCA) | ||
885 | 2833 (5/1013) | ||
886 | 2834 (5/1012) | ||
887 | 2835 (5/1014) | ||
888 | 2836 CS:prim/CC->:SETUP_CNF(5/0FB5) | ||
889 | 2837 CS:prim/CC->:SETUP_COMPL_IND(5/0FB6) | ||
890 | 2838 CS:prim/CC->:SETUP_IND(5/0FB4) | ||
891 | 2839 CS:prim/CC<-:SETUP_REQ(5/0FA3) | ||
892 | 283A CS:prim/CC->:SETUP_RES(5/0FA5) | ||
893 | 283B CS:prim/CC<-:SETUP_REJ_REQ(5/0FA6) | ||
894 | 283C CS:prim/CC->:SS_IND(5/0FC8) | ||
895 | 283D CS:prim/CC<-:SS_REQ(5/0FB2) | ||
896 | 283E CS:prim/CC<-:START_DTMF_REQ(5/0FAD) | ||
897 | 2841 CS:prim/CC<-:STOP_DTMF_REQ(5/0FAF) | ||
898 | 2843 (5/1015) | ||
899 | 2844 (5/1016) | ||
900 | 2845 (5/101C) | ||
901 | 2846 (5/101D) | ||
902 | 2847 (5/101E) | ||
903 | 2848 (5/1020) | ||
904 | 2849 (5/0A36) | ||
905 | 284A (5/0A37) | ||
906 | 284B (5/0A38) | ||
907 | 284C (5/0A39) | ||
908 | 284E (5/0A65) | ||
909 | 284F (5/0A64) | ||
910 | 2854 CS:prim/PLMN_SEARCH(5/1589) | ||
911 | 285B (5/0826) | ||
912 | 285C (5/0825) | ||
913 | 2861 (5/15B6) | ||
914 | 29XX SSCL:prim/SSCL_PRIMITIVE_TRA | ||
915 | 2900 SSCL:prim/SS_UPL->:BEGIN_IND(6/1771) | ||
916 | 2901 SSCL:prim/SS_UPL->:END_IND(6/1773) | ||
917 | 2902 SSCL:prim/SS_UPL->:ERROR_IND(6/1774) | ||
918 | 2903 SSCL:prim/MM<-:FACILITY_IND(7/177A) | ||
919 | 2904 SSCL:prim/SS_UPL->:PARA_CONN_IND(6/177D) | ||
920 | 2905 SSCL:prim/SS_UPL->:REL_IND(6/1775) | ||
921 | 2906 SSCL:prim/MM->:PARA_MM_SS_REL_REQ(6/177F) | ||
922 | 2907 SSCL:prim/MM->:PARA_MM_SS_DATA_REQ(6/179B) | ||
923 | 2908 SSCL:prim/MM->:SS_DATA_REQ(6/0A46) | ||
924 | 2909 SSCL:prim/MM->:SS_EST_REQ(6/0A43) | ||
925 | 290A SSCL:prim/MM->:SS_REL_REQ(6/0A45) | ||
926 | 290B SSCL:prim/UNKNOWN_SSCL_PRIMITIVE | ||
927 | 2AXX SMS:prim/SMS_PRIMITIVE_TRA | ||
928 | 2A00 SMS:prim/SMTL<-:SMRL_MEM_CAP_AVAIL_REQ(8/0BBF) | ||
929 | 2A01 SMS:prim/SMTL<-:SMRL_DATA_REQ(8/0BB9) | ||
930 | 2A02 SMS:prim/SMTL->:SMRL_REPORT_IND(8/0BBA) | ||
931 | 2A03 SMS:prim/SMTL->:SMRL_DATA_IND(8/0BBC) | ||
932 | 2A04 SMS:prim/SMTL->:SMRL_DATA_RSP(8/0BBD) | ||
933 | 2A05 SMS:prim/SMTL<-:SMRL_INIT_STD_REQ(8/0BBE) | ||
934 | 2A06 SMS:prim/SMTL<-:CB_ACTIVATE_REQ(8/0BC0) | ||
935 | 2A07 SMS:prim/SMTL<-:CB_DEACTIVATE_REQ(8/0BC1) | ||
936 | 2A08 SMS:prim/SMTL<-:MEM_CAP_AVAIL_REQ(8/0BBF) | ||
937 | 2A09 SMS:prim/SMTL<-:SMTL_TPDU(8/0BEB) | ||
938 | 2A0A SMS:prim/SMRL<-:SMCL_DATA_REQ(8/0DAD) | ||
939 | 2A0B SMS:prim/SMRL->:SMCL_DATA_IND(8/0DAE) | ||
940 | 2A0C SMS:prim/SMRL<-:SMCL_ABORT_REQ(8/0DAF) | ||
941 | 2A0D SMS:prim/SMRL->:SMCL_EST_IND(8/0DB0) | ||
942 | 2A0E SMS:prim/SMRL<-:SMCL_EST_REQ(8/0DB1) | ||
943 | 2A0F SMS:prim/SMRL->:SMCL_ERROR_IND(8/0DB2) | ||
944 | 2A10 SMS:prim/SMRL<-:SMCL_REL_REQ(8/0DB3) | ||
945 | 2A11 SMS:prim/SMRL<-:SMCL_INIT_STD_REQ(8/0DB4) | ||
946 | 2A12 SMS:prim/UNKNOWN_SMS_PRIMITIVE | ||
947 | 2A13 SMS:prim/MM<-:SMSCB_ZONE_CHANGED_IND | ||
948 | 2A14 SMS:prim/MM<-:EST_IND(8/0A29) | ||
949 | 2A15 SMS:prim/MM->:EST_REQ(8/0A2A) | ||
950 | 2A16 SMS:prim/MM<-:EST_CNF(8/0A2B) | ||
951 | 2A17 SMS:prim/MM<-:DATA_IND(8/0A2C) | ||
952 | 2A18 SMS:prim/MM->:DATA_REQ(8/0A2D) | ||
953 | 2A19 SMS:prim/MM<-:ERROR_IND(8/0A2E) | ||
954 | 2A1A SMS:prim/MM<-:REL_IND(8/0A2F) | ||
955 | 2A1B SMS:prim/MM->:REL_REQ(8/0A30) | ||
956 | 2A1C SMS:prim/L2<-SAPI3_SACCH_REL_IND(8/0620) | ||
957 | 2A1D SMS:prim/L2<-SAPI3_NON_SACCH_REL_IND(8/0621) | ||
958 | 2BXX SIM:prim/SIM_PRIMITIVE_TRA | ||
959 | 2B00 SIM:prim/PIN_VERIFY_START | ||
960 | 2B01 SIM:prim/PIN_CHANGE_START | ||
961 | 2B02 SIM:prim/PIN_DISABLE_START | ||
962 | 2B03 SIM:prim/PIN_ENABLE_START | ||
963 | 2B04 SIM:prim/UNBLOCK_START | ||
964 | 2B05 SIM:prim/INIT | ||
965 | 2B06 SIM:prim/DEACTIVATE | ||
966 | 2B07 SIM:prim/UPDATE | ||
967 | 2B08 SIM:prim/COMPUTE_GSM_ALGORITHMS | ||
968 | 2B09 SIM:prim/STORE_SCM_NBR | ||
969 | 2B0A SIM:prim/SCM_NBR_TO_BE_STORED | ||
970 | 2B0B SIM:prim/RECALL_SCM_NBR | ||
971 | 2B0C SIM:prim/PIN2_VERIFY_START | ||
972 | 2B0D SIM:prim/PIN2_CHANGE_START | ||
973 | 2B0E SIM:prim/PIN2_UNBLOCK_START | ||
974 | 2B0F SIM:prim/ACM_INCREMENT | ||
975 | 2B10 SIM:prim/ACM_SET | ||
976 | 2B11 SIM:prim/ACM_MAX_VALUE_SET | ||
977 | 2B12 SIM:prim/PUCT_SET | ||
978 | 2B13 SIM:prim/PUCT_READ | ||
979 | 2B14 SIM:prim/STORE_MSISDN_NBR | ||
980 | 2B15 SIM:prim/READ_MSISDN_NBR | ||
981 | 2B16 SIM:prim/STORE_SMS_PARAM | ||
982 | 2B17 SIM:prim/READ_SMS_PARAM | ||
983 | 2B18 SIM:prim/STORE_FIXDIAL_NUMBER | ||
984 | 2B19 SIM:prim/READ_FIXDIAL_NUMBER | ||
985 | 2B1A SIM:prim/ACTIVATE_FIXDIAL | ||
986 | 2B1B SIM:prim/DEACTIVATE_FIXDIAL | ||
987 | 2B1C SIM:prim/FDN_NBR_TO_BE_STORED | ||
988 | 2B1D SIM:prim/MSISDN_TO_BE_STORED | ||
989 | 2B1E SIM:prim/STO_SCM_NBR | ||
990 | 2B1F SIM:prim/RCL_SCM_NBR | ||
991 | 2B20 SIM:prim/SMS_PARAM_TO_BE_STORED | ||
992 | 2B21 SIM:prim/RECALL_SCM_NBR_SIF | ||
993 | 2B22 SIM:prim/TEST_SYNC_MSG | ||
994 | 2B23 SIM:prim/ACM_FROM_CARD | ||
995 | 2B24 SIM:prim/MAILBOX_NBR_STORE_MSG | ||
996 | 2B25 SIM:prim/MAILBOX_NBR_READ_MSG | ||
997 | 2B26 SIM:prim/OPERATOR_NAME_READ_MSG | ||
998 | 2B27 SIM:prim/MICROTEL_PARAMS_READ_MSG | ||
999 | 2B28 SIM:prim/CSP_READ_MSG | ||
1000 | 2B29 SIM:prim/MAILBOX_NBR_TO_BE_STORED | ||
1001 | 2B2A SIM:prim/SMS_READ_MSG | ||
1002 | 2B2B SIM:prim/SMS_STORE_MO_MSG | ||
1003 | 2B2C SIM:prim/SMS_CLEAR_MSG | ||
1004 | 2B2D SIM:prim/SMS_UPDATE_MSG | ||
1005 | 2B2E SIM:prim/SMS_STORE_MT_MSG | ||
1006 | 2B2F SIM:prim/SMS_MSG_TO_BE_STORED | ||
1007 | 2B30 SIM:prim/SMS_STORE_MSG | ||
1008 | 2B31 SIM:prim/SMS_INIT | ||
1009 | 2B32 SIM:prim/SCM_INIT | ||
1010 | 2B33 SIM:prim/FDN_INIT | ||
1011 | 2B34 SIM:prim/UNDEFINED_SIM_PRIMITIVE | ||
1012 | 2B35 SIM:prim/PIN_CHECK_START | ||
1013 | 2B36 SIM:prim/SIM_REFRESH | ||
1014 | 2B37 SIM:prim/SMS_STORE_AND_CLEAR | ||
1015 | 2B38 SIM:prim/WELCOME_MSG_READ | ||
1016 | 2B39 SIM:prim/FIRST_PLMN_WRITE | ||
1017 | 2B3A SIM:prim/UPDATE_MSG_REF | ||
1018 | 2B3B SIM:prim/PLUG_IN_CARD_DISCONNECTED | ||
1019 | 2B3C SIM:prim/READ_INF_NBR_MSG | ||
1020 | 2B3D SIM:prim/READ_JACOB_ID_MSG | ||
1021 | 2B3E SIM:prim/SIMP_WARM_INIT | ||
1022 | 2B3F SIM:prim/SIMP_REFRESH_RSP | ||
1023 | 2B40 SIM:prim/SIMP_UI_REFRESH_RSP | ||
1024 | 2B41 SIM:prim/SIMP_SMS_PP_STORE_MSG | ||
1025 | 2B42 SIM:prim/READ_SID_LIST | ||
1026 | 2B43 SIM:prim/READ_CALL_COUNT | ||
1027 | 2B44 SIM:prim/INC_CALL_COUNT | ||
1028 | 2B45 SIM:prim/WRITE_CALL_COUNT | ||
1029 | 2B46 SIM:prim/AUTH_SIGN_CALC | ||
1030 | 2B47 SIM:prim/AUTH_RANDBS_GET | ||
1031 | 2B48 SIM:prim/AKEY_VALIDATE | ||
1032 | 2B49 SIM:prim/SSD_GENERATE | ||
1033 | 2B4A SIM:prim/SSD_CONFIRM | ||
1034 | 2B4B SIM:prim/CMEA_ENCRYPT | ||
1035 | 2B4C SIM:prim/AUTH_CHECK | ||
1036 | 2CXX RM:prim/RM_PRIMITIVE_TRA | ||
1037 | 2C00 RM:prim/CC->:EMERGENCY_SETUP_REQ(4/0FA4) | ||
1038 | 2C01 RM:prim/MM->:LIMITED_SERVICE_STATE_REQ(4/09CF) | ||
1039 | 2C02 RM:prim/MM->:REG_REQ(4/09CD) | ||
1040 | 2C03 RM:prim/MM->:NREG_REQ(4/09CE) | ||
1041 | 2C04 RM:prim/MM->:SIM_INFO_READ_ALL_REQ(4/09D2) | ||
1042 | 2C05 RM:prim/MM->:SIM_INSERTED_REQ(4/09D3) | ||
1043 | 2C06 RM:prim/MM->:PLMN_SEARCH_START_REQ(4/09C9) | ||
1044 | 2C07 RM:prim/MM->:PLMN_SEARCH_STOP_REQ(4/09CA) | ||
1045 | 2C08 RM:prim/MM->:PLMN_REL_SEARCH_INFO(4/09CB) | ||
1046 | 2C09 RM:prim/MM->:PH_UPL_PLMN_SEARCH_START_REQ(4/09C8) | ||
1047 | 2C0A RM:prim/MM->PH_UPL_PLMN_SEARCH_STOP_REQ(4/09C7) | ||
1048 | 2C0B RM:prim/MM->:NSPS_MON_START_REQ(4/09C5) | ||
1049 | 2C0C RM:prim/MM->:NSPS_MON_STOP_REQ(4/09C6) | ||
1050 | 2C0D RM:prim/UNKNOWN_RM_PRIMITIVE(4/09CC) | ||
1051 | 2C0E (4/09D0) | ||
1052 | 2C0F (4/09D1) | ||
1053 | 2C10 (4/09D6) | ||
1054 | 2DXX L2:pdu/L2_PDU_TRA | ||
1055 | 2D00 L2:pdu/->:DISC(9/060F) | ||
1056 | 2D01 L2:pdu/->:DM(9/0610) | ||
1057 | 2D02 L2:pdu/->:EMPTY(9/0611) | ||
1058 | 2D03 L2:pdu/->:RRE(9/0612) | ||
1059 | 2D04 L2:pdu/->:SABM(9/0613) | ||
1060 | 2D05 L2:pdu/->:UA(9/0614) | ||
1061 | 2D06 (9/1025) | ||
1062 | 2D07 L2:pdu/->:I_CMD(9/0616) | ||
1063 | 2D08 L2:pdu/->:RNR(9/0617) | ||
1064 | 2D09 L2:pdu/->:REJ(9/0618) | ||
1065 | 2D0A L2:pdu/->:UNNUMBERED_INFO(9/061A) | ||
1066 | 2D0B L2:pdu/->:PDU_ERROR(9/061B) | ||
1067 | 2D0C L2:pdu/<-:DISC(10/060F) | ||
1068 | 2D0D L2:pdu/<-:DM(10/0610) | ||
1069 | 2D0E L2:pdu/<-:EMPTY(10/0611) | ||
1070 | 2D0F L2:pdu/<-:RRE(10/0612) | ||
1071 | 2D10 L2:pdu/<-:SABM(10/0613) | ||
1072 | 2D11 L2:pdu/<-:UA(10/0614) | ||
1073 | 2D12 (10/1025) | ||
1074 | 2D13 L2:pdu/<-:I_CMD(10/0616) | ||
1075 | 2D14 L2:pdu/<-:RNR(10/0617) | ||
1076 | 2D15 L2:pdu/<-:REJ(10/0618) | ||
1077 | 2D16 L2:pdu/<-:UNNUMBERED_INFO(10/061A) | ||
1078 | 2D17 L2:pdu/<-:PDU_ERROR(10/061B) | ||
1079 | 2EXX RR:pdu/RR_PDU_TRA | ||
1080 | 2E00 RR:pdu/->:CH_REQ | ||
1081 | 2E01 RR:pdu/->:ASSIGN_COM(11/08A6) | ||
1082 | 2E02 RR:pdu/->:ASSIGN_FAILURE(11/08A7) | ||
1083 | 2E03 RR:pdu/->:CH_MODE_MODIFY_ACK(11/08A8) | ||
1084 | 2E04 RR:pdu/->:HANDOVER_COM(11/08A9) | ||
1085 | 2E05 RR:pdu/->:HANDOVER_FAILURE(11/08AA) | ||
1086 | 2E06 RR:pdu/->:RR_STATUS(11/08AB) | ||
1087 | 2E07 RR:pdu/->:PAGING_RESP(11/08AC) | ||
1088 | 2E08 RR:pdu/->:CIPH_MODE_COM(11/08AD) | ||
1089 | 2E09 RR:pdu/->:CLASSMARK_CHANGE(11/08AE) | ||
1090 | 2E0A RR:pdu/<-:PDU_IGNORE(12/0000) | ||
1091 | 2E0B RR:pdu/<-:ASSIGN_CMD(12/0898) | ||
1092 | 2E0C RR:pdu/<-:IMM_ASSIGN(12/0899) | ||
1093 | 2E0D RR:pdu/<-:IMM_ASSIGN_REJ(12/089A) | ||
1094 | 2E0E RR:pdu/<-:CH_MODE_MODIFY(12/089B) | ||
1095 | 2E0F RR:pdu/<-:HANDOVER_CMD(12/089C) | ||
1096 | 2E10 RR:pdu/<-:PHYS_INFO(12/089D) | ||
1097 | 2E11 RR:pdu/<-:CH_REL(12/089E) | ||
1098 | 2E12 RR:pdu/<-:CLASSMARK_ENQ(12/089F) | ||
1099 | 2E13 RR:pdu/<-:FREQ_REDEF(12/08A0) | ||
1100 | 2E14 RR:pdu/<-:CIPH_MODE_CMD(12/08A1) | ||
1101 | 2E15 RR:pdu/<-:PAG_REQ_1(12/08A2) | ||
1102 | 2E16 RR:pdu/<-:PAG_REQ_2(12/08A3) | ||
1103 | 2E17 RR:pdu/<-:PAG_REQ_3(12/08A4) | ||
1104 | 2E18 RR:pdu/<-:CLASSMARK_CHANGE(12/08AE) | ||
1105 | 2E19 RR:pdu/<-:OWN_PAGE_MODE(12/08AF) | ||
1106 | 2E1A RR:pdu/<-:MESSAGE_TYPE_ERROR(12/08B0) | ||
1107 | 2E1B RR:pdu/<-:IE_CONTENT_ERROR(12/08B1) | ||
1108 | 2E1C RR:pdu/<-:ASSIGN_CMD_MISSING_CA(12/08B2) | ||
1109 | 2E1D RR:pdu/<-:ASSIGN_CMD_CH_MODE_ERR(12/08B3) | ||
1110 | 2E1E RR:pdu/<-:ASSIGN_CMD_FREQ_ERR(12/08B4) | ||
1111 | 2E1F RR:pdu/<-:HANDOVER_CMD_CH_MODE_ERR(12/08B5) | ||
1112 | 2E20 RR:pdu/<-:HANDOVER_CMD_CIPH_MSG_ERR(12/08C2) | ||
1113 | 2E21 RR:pdu/<-:HANDOVER_CMD_FREQ_ERR(12/08B6) | ||
1114 | 2E22 RR:pdu/<-:HANDOVER_CMD_TA_RANGE_ERR(12/08C4) | ||
1115 | 2E23 RR:pdu/<-:ASSIGN_FREQLIST_ID_ERROR(12/08BA) | ||
1116 | 2E24 RR:pdu/<-:HO_FREQLIST_ID_ERROR(12/08BB) | ||
1117 | 2E25 RR:pdu/<-:HO_FREQLIST_SHORT_ERROR(12/08BC) | ||
1118 | 2E26 RR:pdu/<-:UNSPEC_PROTOCOL_ERROR(12/08BD) | ||
1119 | 2E27 RR:pdu/<-:MESSAGE_MAND_INFO_ERROR(12/08BE) | ||
1120 | 2E28 RR:pdu/<-:MESSAGE_PROTOCOL_STATE_ERROR(12/08BF) | ||
1121 | 2E29 RR:pdu/<-:MESSAGE_SEMANTICAL_ERROR(12/08C0) | ||
1122 | 2E2A RR:pdu/<-:MESSAGE_COND_INFO_ERROR(12/08C1) | ||
1123 | 2E2B RR:pdu/<-:ASSIGN_CMD_CIPH_MSG_ERR(12/08C3) | ||
1124 | 2E2C RR:pdu/<-:IMM_ASS_SEMANTIC_ERROR(12/08C5) | ||
1125 | 2E2D RR:pdu/UNKNOWNPDU | ||
1126 | 2E2E RR:pdu/->:CONFIG_CHANGE_ACK | ||
1127 | 2E2F RR:pdu/->:CONFIG_CHANGE_REJ | ||
1128 | 2E30 RR:pdu/<-:CONFIG_CHANGE | ||
1129 | 2FXX MM:pdu/MM_PDU_TRA | ||
1130 | 2F00 MM:pdu/->:CM_SERV_ABORT(13/0062) | ||
1131 | 2F01 MM:pdu/->:IMSI_DETACH_IND(13/0047) | ||
1132 | 2F02 MM:pdu/->:LOC_UPD_REQ(13/004A) | ||
1133 | 2F03 MM:pdu/->:AUT_RESPONSE(13/004D) | ||
1134 | 2F04 MM:pdu/->:TMSI_REAL_COM(13/004F) | ||
1135 | 2F05 MM:pdu/->:ID_RESPONSE(13/0051) | ||
1136 | 2F06 MM:pdu/->:CM_SERV_REQ(13/0054) | ||
1137 | 2F07 MM:pdu/->:PDU_CM_REEST_REQ(13/0055) | ||
1138 | 2F08 MM:pdu/->:MM_STATUS(13/0056) | ||
1139 | 2F09 MM:pdu/<-:LOC_UPD_ACCEPT(14/0048) | ||
1140 | 2F0A MM:pdu/<-:LOC_UPD_REJECT(14/0049) | ||
1141 | 2F0B MM:pdu/<-:AUT_REJ_CMD(14/004B) | ||
1142 | 2F0C MM:pdu/<-:AUT_REQ(14/004C) | ||
1143 | 2F0D MM:pdu/<-:TMSI_REAL_CMD(14/004E) | ||
1144 | 2F0E MM:pdu/<-:ID_REQ(14/0050) | ||
1145 | 2F0F MM:pdu/<-:CM_SERV_ACCEPT(14/0052) | ||
1146 | 2F10 MM:pdu/<-:CM_SERV_REJECT(14/0053) | ||
1147 | 2F11 MM:pdu/<-:MM_STATUS(14/0056) | ||
1148 | 2F12 MM:pdu/<-:RR_CM_DATA_IND(14/0057) | ||
1149 | 2F13 MM:pdu/<-:ILLEGAL_PDU(14/0063) | ||
1150 | 2F14 MM:pdu/<-:EMMI_PDU(14/0065) | ||
1151 | 2F15 MM:pdu/<-:ABORT(14/0061) | ||
1152 | 2F16 MM:pdu/<-:MM_INFORMATION(14/006B) | ||
1153 | 2F17 MM:pdu/<-:PDU_IGNORED(14/0064) | ||
1154 | 2F18 MM:pdu/UNKNOWNPDU | ||
1155 | 30XX CC:pdu/CC_PDU_TRA | ||
1156 | 3000 CC:pdu/->:ALERT(15/1022) | ||
1157 | 3001 CC:pdu/->:CALL_CONF(15/1023) | ||
1158 | 3002 CC:pdu/->:CONN(15/1025) | ||
1159 | 3003 CC:pdu/->:CONN_ACK(15/1026) | ||
1160 | 3004 CC:pdu/->:EMERGENCY_SETUP(15/1027) | ||
1161 | 3005 CC:pdu/->:SETUP(15/1029) | ||
1162 | 3006 CC:pdu/->:MODIFY | ||
1163 | 3007 CC:pdu/->:MODIFY_COM(15/102B) | ||
1164 | 3008 CC:pdu/->:MODIFY_REJ(15/102C) | ||
1165 | 3009 CC:pdu/->:DISC(15/102D) | ||
1166 | 300A CC:pdu/->:REL(15/102E) | ||
1167 | 300B CC:pdu/->:REL_COM(15/102F) | ||
1168 | 300C CC:pdu/->:CONG(15/1030) | ||
1169 | 300D CC:pdu/->:NOTIFY(15/1031) | ||
1170 | 300E CC:pdu/->:START_DTMF(15/1032) | ||
1171 | 300F CC:pdu/->:START_DTMF_ACK | ||
1172 | 3010 CC:pdu/->:START_DTMF_REJ | ||
1173 | 3011 CC:pdu/->:STATUS(15/1035) | ||
1174 | 3012 CC:pdu/->:STATUS_ENQ(15/1036) | ||
1175 | 3013 CC:pdu/->:STOP_DTMF(15/1037) | ||
1176 | 3014 CC:pdu/->:STOP_DTMF_ACK | ||
1177 | 3015 CC:pdu/->:HOLD(15/1039) | ||
1178 | 3016 CC:pdu/->:FACILITY(15/103A) | ||
1179 | 3017 CC:pdu/->:HOLD_REJ | ||
1180 | 3018 CC:pdu/->:RETRIEVE(15/103F) | ||
1181 | 3019 CC:pdu/->:USER_INFO(15/1040) | ||
1182 | 301A CC:pdu/->:UNKNOWN_PDU | ||
1183 | 301B CC:pdu/<-:ALERT(16/1022) | ||
1184 | 301C CC:pdu/<-:CALL_PROC(16/1024) | ||
1185 | 301D CC:pdu/<-:CONN(16/1025) | ||
1186 | 301E CC:pdu/<-:CONN_ACK(16/1026) | ||
1187 | 301F CC:pdu/<-:PROG(16/1028) | ||
1188 | 3020 CC:pdu/<-:SETUP(16/1029) | ||
1189 | 3021 CC:pdu/<-:MODIFY(16/102A) | ||
1190 | 3022 CC:pdu/<-:MODIFY_COM | ||
1191 | 3023 CC:pdu/<-:MODIFY_REJ | ||
1192 | 3024 CC:pdu/<-:DISC(16/102D) | ||
1193 | 3025 CC:pdu/<-:REL(16/102E) | ||
1194 | 3026 CC:pdu/<-:REL_COM(16/102F) | ||
1195 | 3027 CC:pdu/<-:CONG(16/1030) | ||
1196 | 3028 CC:pdu/<-:NOTIFY(16/1031) | ||
1197 | 3029 CC:pdu/<-:START_DTMF_ACK(16/1033) | ||
1198 | 302A CC:pdu/<-:START_DTMF_REJ(16/1034) | ||
1199 | 302B CC:pdu/<-:STATUS(16/1035) | ||
1200 | 302C CC:pdu/<-:STATUS_ENQ(16/1036) | ||
1201 | 302D CC:pdu/<-:STOP_DTMF_ACK(16/1038) | ||
1202 | 302E CC:pdu/<-:FACILITY(16/103A) | ||
1203 | 302F CC:pdu/<-:HOLD_REJ(16/103B) | ||
1204 | 3030 CC:pdu/<-:HOLD_ACK(16/103C) | ||
1205 | 3031 CC:pdu/<-:RETRIEVE_ACK(16/103D) | ||
1206 | 3032 CC:pdu/<-:RETRIEVE_REJ(16/103E) | ||
1207 | 3033 CC:pdu/<-:USER_INFO(16/1040) | ||
1208 | 3034 CC:pdu/<-:PDU_IGNORE | ||
1209 | 3035 CC:pdu/<-:UNKNOWN_PDU | ||
1210 | 3036 CC:pdu/UNKNOWN_PDU | ||
1211 | 3037 CC:pdu/Err/INVALID_TRAN_ID(16/1041) | ||
1212 | 3038 CC:pdu/Err/MESSAGE_MAND(16/1043) | ||
1213 | 3039 CC:pdu/Err/MESSAGE_COND(16/1049) | ||
1214 | 303A CC:pdu/Err/MESSAGE_PROTOCOL(16/104B) | ||
1215 | 303B CC:pdu/Err/MESSAGE_SEMANTICAL(16/104A) | ||
1216 | 303C CC:pdu/Err/MESSAGE_TYPE(16/1042) | ||
1217 | 303D CC:pdu/Err/DISC_MAND(16/1044) | ||
1218 | 303E CC:pdu/Err/DISC_OPT(16/1045) | ||
1219 | 303F CC:pdu/Err/PDU_IGNORE(16/0000) | ||
1220 | 3040 CC:pdu/Err/REL_MAND(16/1046) | ||
1221 | 3041 CC:pdu/Err/REL_OPT(16/1047) | ||
1222 | 3042 CC:pdu/Err/SETUP(16/1048) | ||
1223 | 31XX SSCL:pdu/SSCL_PDU_TRA | ||
1224 | 3100 SSCL:pdu/->:RELEASE_COMPLETE(17/002A) | ||
1225 | 3101 SSCL:pdu/->:FACILITY(17/003A) | ||
1226 | 3102 SSCL:pdu/->:REGISTER(17/003B) | ||
1227 | 3103 SSCL:pdu/<-:RELEASE_COMPLETE(18/002A) | ||
1228 | 3104 SSCL:pdu/<-:FACILITY(18/003A) | ||
1229 | 3105 SSCL:pdu/<-:REGISTER(18/003B) | ||
1230 | 3106 SSCL:pdu/UNKNOWN_PDU | ||
1231 | 32XX SMS:pdu/SMS_PDU_TRA | ||
1232 | 3200 SMS:pdu/->:RP_DATA(19/0BCD) | ||
1233 | 3201 SMS:pdu/->:RP_ACK(19/0BCE) | ||
1234 | 3202 SMS:pdu/->:RP_ERROR(19/0BCF) | ||
1235 | 3203 SMS:pdu/->:RP_SMMA(19/0BD0) | ||
1236 | 3204 SMS:pdu/->:TR1M_TIMEOUT(19/0BD7) | ||
1237 | 3205 SMS:pdu/->:TRAM_TIMEOUT(19/0BD8) | ||
1238 | 3206 SMS:pdu/->:TR99_TIMEOUT(19/0BD9) | ||
1239 | 3207 SMS:pdu/->:TR2M_TIMEOUT(19/0BDA) | ||
1240 | 3208 SMS:pdu/->:CP_WAIT_TIMEOUT(19/0DCD) | ||
1241 | 3209 SMS:pdu/->:CB_SCHEDULE_TIMEOUT(19/0DCE) | ||
1242 | 320A SMS:pdu/->:TC1M_TIMEOUT(19/0DCB) | ||
1243 | 320B SMS:pdu/->:TC2M_TIMEOUT(19/0DCC) | ||
1244 | 320C SMS:pdu/->:CP_DATA(19/0DC1) | ||
1245 | 320D SMS:pdu/->:CP_ACK(19/0DC2) | ||
1246 | 320E SMS:pdu/->:CP_ERROR(19/0DC3) | ||
1247 | 320F SMS:pdu/<-:RP_DATA(20/0BCD) | ||
1248 | 3210 SMS:pdu/<-:RP_ACK(20/0BCE) | ||
1249 | 3211 SMS:pdu/<-:RP_ERROR(20/0BCF) | ||
1250 | 3212 SMS:pdu/<-:CP_DATA(20/0DC1) | ||
1251 | 3213 SMS:pdu/<-:CP_ACK(20/0DC2) | ||
1252 | 3214 SMS:pdu/<-:CP_ERROR(20/0DC3) | ||
1253 | 3215 SMS:pdu/<-:CP_PDU_ERROR(20/0DC4) | ||
1254 | 3216 SMS:pdu/<-:CP_PDU_NEW_TRAN_ID(20/0DC5) | ||
1255 | 3217 SMS:pdu/UNKNOWN_PDU | ||
1256 | 33XX CS:trans/CS_TRANSITION_TRA | ||
1257 | 3300 CS:trans/TRANSITION_TO | ||
1258 | 34XX L2:trans/L2_TRANSITION_TRA | ||
1259 | 3400 L2:trans/TRANSITION_TO | ||
1260 | 35XX RR:trans/RR_TRANSITION_TRA | ||
1261 | 3500 RR:trans/TRANSITION_TO | ||
1262 | 36XX CC:trans/CC_TRANSITION_TRA | ||
1263 | 3600 CC:trans/TRANSITION_TO | ||
1264 | 37XX RM_CTRL:trans/RM_CTRL_TRANSITION_TRA | ||
1265 | 3700 RM_CTRL:trans/TRANSITION_TO | ||
1266 | 38XX MM:trans/MM_TRANSITION_TRA | ||
1267 | 3800 MM:trans/TRANSITION_TO | ||
1268 | 39XX SSCL:trans/SSCL_TRANSITION_TRA | ||
1269 | 3900 SSCL:trans/TRANSITION_TO | ||
1270 | 3AXX SSCL_MO:trans/SMCL_MO_TRANSITION_TRA | ||
1271 | 3A00 SSCL_MO:trans/unused | ||
1272 | 3BXX SSCL_MT:trans/SMCL_MT_TRANSITION_TRA | ||
1273 | 3B00 SSCL_MT:trans/unused | ||
1274 | 3CXX SMRL:trans/SMRL_TRANSITION_TRA | ||
1275 | 3C00 SMRL:trans/unused | ||
1276 | 47XX L1:PLMN_info/PLMN_INFO_TRA | ||
1277 | 4700 L1:PLMN_info/PLMN_PTR | ||
1278 | 4701 L1:PLMN_info/M88_PLMN_MEAS_PLMN_OK | ||
1279 | 4702 L1:PLMN_info/M105_PLMN_MEAS_PLMN_OK | ||
1280 | 4703 L1:PLMN_info/M92_PLMN_C1 | ||
1281 | 4704 L1:PLMN_info/M94_SEL_PLMN_FOUND | ||
1282 | 4705 L1:PLMN_info/M88_PLMN_MEAS_SYSPAR_OK | ||
1283 | 4706 L1:PLMN_info/M94_PLMN_MEAS_SYSPAR_OK | ||
1284 | 4707 L1:PLMN_info/M86_PLMN_MEAS_NO_PSW | ||
1285 | 4708 L1:PLMN_info/M86_PLMN_MEAS_BCCH_DONE | ||
1286 | 4709 L1:PLMN_info/M87_PLMN_MEAS_BCCH_DONE | ||
1287 | 470A L1:PLMN_info/M88_PLMN_MEAS_BCCH_DONE | ||
1288 | 470B L1:PLMN_info/M93_PLMN_MEAS_BCCH_DONE | ||
1289 | 470C L1:PLMN_info/I_L1_M94_SEL_PLMN_FOUND | ||
1290 | 470D L1:PLMN_info/M102_PLMN_MEAS_BCCH_DONE | ||
1291 | 470E L1:PLMN_info/M105_PLMN_MEAS_BCCH_DONE | ||
1292 | 470F L1:PLMN_info/M_EEPROM_PLMN_SELECTED | ||
1293 | 4710 L1:PLMN_info/M82_PSW_RESULT_RECEIVED | ||
1294 | 4711 L1:PLMN_info/M83_SORTED_RSSIS | ||
1295 | 4712 L1:PLMN_info/M83_SORTED_CARR_LIST | ||
1296 | 4713 L1:PLMN_info/M86_SAVED_CARRIERS_UPDATED | ||
1297 | 4714 L1:PLMN_info/M88_NSYSPARS_RECEIVED | ||
1298 | 4715 L1:PLMN_info/M88_CORRUPTED_SYSPAR | ||
1299 | 4716 L1:PLMN_info/M105_NSYSPARS_RECEIVED | ||
1300 | 4717 L1:PLMN_info/E_L1_M82_UNKNOWN_TIMING_OFFSET | ||
1301 | 48XX L1:NMEAS_info/NMEAS_INFO_TRA | ||
1302 | 4800 L1:NMEAS_info/MEAS_INSTR_SENDED | ||
1303 | 4801 L1:NMEAS_info/MEAS_REQ_STATE_UPDATED | ||
1304 | 4802 L1:NMEAS_info/M27_MEAS_REQ_DISCARDED | ||
1305 | 4803 L1:NMEAS_info/M28_MEAS_INITED_FOR_NEIGH | ||
1306 | 4804 L1:NMEAS_info/M29_MEAS_INITED_FOR_NEIGH | ||
1307 | 4805 L1:NMEAS_info/M9_NSYSPARS_RECEIVED | ||
1308 | 4806 L1:NMEAS_info/M9_NSYSPARS_RERECEIVED | ||
1309 | 4807 L1:NMEAS_info/M18_NLIST_CHANGED | ||
1310 | 4808 L1:NMEAS_info/M25_SYNC_PERIOD_STARTED | ||
1311 | 4809 L1:NMEAS_info/M26_SYSPAR_PERIOD_STARTED | ||
1312 | 480A L1:NMEAS_info/M27_NO_NEIGHBOURS | ||
1313 | 480B L1:NMEAS_info/M28_SYNC_CARRIER_SELECTED | ||
1314 | 480C L1:NMEAS_info/M29_SYNC_CARRIER_SELECTED | ||
1315 | 480D L1:NMEAS_info/M29_NO_SYNC_NEIGH_FOUND | ||
1316 | 480E L1:NMEAS_info/M2_PSW_RESULT_RECEIVED | ||
1317 | 480F L1:NMEAS_info/M30_PSW_CARRIER_SELECTED | ||
1318 | 4810 L1:NMEAS_info/M30_NO_PSW_NEIGH_FOUND | ||
1319 | 4811 L1:NMEAS_info/M10_SYNC_RECEIVED | ||
1320 | 4812 L1:NMEAS_info/M10_SYNC_RERECEIVED | ||
1321 | 4813 L1:NMEAS_info/M10_UNKNOWN_BSIC | ||
1322 | 4814 L1:NMEAS_info/M10_UNPERMITTED_PLMN | ||
1323 | 4815 L1:NMEAS_info/M31_SYNC_REREC_SELECTED | ||
1324 | 4816 L1:NMEAS_info/M31_NO_SYNC_REREC_SELECT | ||
1325 | 4817 L1:NMEAS_info/M32_SYSPAR_CARRIER_SELECT | ||
1326 | 4818 L1:NMEAS_info/M32_SYS_MEAS_TYPE_NOT_FOUN | ||
1327 | 4AXX SSCL:input/SSCL_INPUT_TRA | ||
1328 | 4A00 SSCL:input/MM<-:SSCL_BEGIN_REQ(7/1776) | ||
1329 | 4A01 SSCL:input/MM<-:SSCL_END_REQ(7/1778) | ||
1330 | 4A02 SSCL:input/MM<-:FACILITY_IND | ||
1331 | 4A03 SSCL:input/MM<-:SSCL_FACILITY_REQ(7/1777) | ||
1332 | 4A04 SSCL:input/NO_EVENT(7/0000) | ||
1333 | 4A05 SSCL:input/MM<-:SSCL_PARA_REL_COM(7/177E) | ||
1334 | 4A06 SSCL:input/RELEASE_COMPLETE_IND(7/177B) | ||
1335 | 4A07 SSCL:input/MM<-:SSCL_PDU_ERROR_IND(7/177C) | ||
1336 | 4A08 SSCL:input/MM<-:REGISTER_IND(7/1779) | ||
1337 | 4A09 SSCL:input/MM<-:SS_EST_IND(7/0A49) | ||
1338 | 4A0A SSCL:input/MM<-:SS_EST_CNF(7/0A48) | ||
1339 | 4A0B SSCL:input/MM<-:SS_REL_IND(7/0A4B) | ||
1340 | 4A0C SSCL:input/MM<-:SS_ERROR_IND(7/0A4F) | ||
1341 | 4A0D SSCL:input/MM<-:SS_DATA_IND | ||
1342 | 4A0E SSCL:input/UNKNOWN_SSCL_INPUT_PRIMITIVE | ||
1343 | 4BXX CS:func/CS_FUNCTION_TRA | ||
1344 | 4B00 CS:func/DTMF_START | ||
1345 | 4B01 CS:func/DTMF_STOP | ||
1346 | 4B02 CS:func/DTMF_DIGIT_START | ||
1347 | 4B03 CS:func/DTMF_DIGIT_STOP | ||
1348 | 4B04 CS:func/DATA_IF_ACTIVATE | ||
1349 | 4B05 CS:func/DATA_IF_DEACTIVATE | ||
1350 | 4B06 CS:func/SPEECH_BC_DEFAULT_SET | ||
1351 | 4B07 CS:func/DATA_BC_DEFAULT_SET | ||
1352 | 4B08 CS:func/SIM_INIT_STATUS | ||
1353 | 4B09 CS:func/SIM_SRES_KC_UPDATE | ||
1354 | 4B0A CS:func/FACILITY_RECEIVED | ||
1355 | 4B0B CS:func/CURRENT_BC_READ | ||
1356 | 4B0C CS:func/CALLING_PARTY_NUMBER_RECEIVED | ||
1357 | 4B0D CS:func/CALLING_PARTY_NUMBER_READ | ||
1358 | 4B0E CS:func/MS_PAR_READ_NEIGH_BCCH_LIST | ||
1359 | 4B0F CS:func/CCM_NEW_TRANS_ACT_ID_IN_USE | ||
1360 | 4B10 CS:func/CCM_MO_CALL_ESTAB_CHECK | ||
1361 | 4B11 CS:func/CCM_MO_CALL_ESTAB_CHECK_RETURN | ||
1362 | 4B12 CS:func/MPARTY_HOLD | ||
1363 | 4B13 CS:func/MPARTY_RETRIEVE | ||
1364 | 4B14 CS:func/MPARTY_SWAP | ||
1365 | 4B15 CS:func/MPARTY_SPLIT_CNF | ||
1366 | 4B16 CS:func/MPARTY_BUILD_CNF | ||
1367 | 4B17 CS:func/MPARTY_HOLD_CNF | ||
1368 | 4B18 CS:func/MPARTY_RETRIEVE_CNF | ||
1369 | 4B19 CS:func/FACILITY_OPER_FAIL_CHECK | ||
1370 | 4B1A CS:func/CALL_TRANSFER | ||
1371 | 4B1B CS:func/MS_PAR_WRITE_NEIGH_BCCH_LIST | ||
1372 | 4B1C CS:func/CALL_TRANSFER_CNF | ||
1373 | 4B1D CS:func/MM_PAGING_ALLOWED | ||
1374 | 4B1E CS:func/L1_INFO_READ_CA_VALID | ||
1375 | 4B1F CS:func/MS_PAR_SET_LAI_LISTS_IGNORE | ||
1376 | 4B20 CS:func/CS_ICM_MO_ACTIVATE | ||
1377 | 4B21 CS:func/CS_FCF_DUMMY_0_1 | ||
1378 | 4B22 CS:func/CS_FCN_DUMMY_0_2 | ||
1379 | 4B23 CS:func/CS_FCN_DUMMY_0_3 | ||
1380 | 4B24 CS:func/CS_FCN_DUMMY_0_4 | ||
1381 | 4B25 CS:func/CS_FCN_DUMMY_0_5 | ||
1382 | 4B26 CS:func/CS_FCN_DUMMY_0_6 | ||
1383 | 4B27 CS:func/CS_FCN_DUMMY_0_7 | ||
1384 | 4B28 CS:func/CS_FCN_DUMMY_0_8 | ||
1385 | 4B29 CS:func/CS_FCN_DUMMY_0_9 | ||
1386 | 4B2A CS:func/ | ||
1387 | 4B2B CS:func/CS_CALL_HOLD | ||
1388 | 4B2C CS:func/CS_CALL_SWAP | ||
1389 | 4B2D CS:func/SEND_AOC_ACKNOWLEDGE | ||
1390 | 4B2E CS:func/CS_CALL_ANSWER | ||
1391 | 4B2F CS:func/CS_BUILD_CONFERENCE | ||
1392 | 4B30 CS:func/CS_SPLIT_CONFERENCE | ||
1393 | 4B31 CS:func/CS_UPL_CALL_TERMINATE_SIF | ||
1394 | 4B32 CS:func/CS_CALL_TERMINATE | ||
1395 | 4B33 CS:func/CS_FCN_DUMMY_1_1 | ||
1396 | 4B34 CS:func/CS_FCN_DUMMY_1_2 | ||
1397 | 4B35 CS:func/CS_FCN_DUMMY_1_3 | ||
1398 | 4B36 CS:func/CS_FCN_DUMMY_1_4 | ||
1399 | 4B37 CS:func/CS_FCN_DUMMY_1_5 | ||
1400 | 4B38 CS:func/CS_FCN_DUMMY_1_6 | ||
1401 | 4B39 CS:func/CS_FCN_DUMMY_1_7 | ||
1402 | 4B3A CS:func/CS_FCN_DUMMY_1_8 | ||
1403 | 4B3B CS:func/CS_FCN_DUMMY_1_9 | ||
1404 | 4B3C CS:func/ | ||
1405 | 4B3D CS:func/CS_CALL_RETRIEVE | ||
1406 | 4B3E CS:func/CS_CALL_RELEASE | ||
1407 | 4B3F CS:func/MS_PAR_WRITE_BCCH_LIST | ||
1408 | 4B40 CS:func/MS_PAR_WRITE_SELECTED_PLMN | ||
1409 | 4B41 CS:func/CS_CALL_CREATE | ||
1410 | 4B42 CS:func/CCM_CHECK_TCH_CH_MODE | ||
1411 | 4B43 CS:func/CS_TASK_INIT_COMPLETE | ||
1412 | 4B44 CS:func/CS_DEV_TASK_INIT_COMPLETED | ||
1413 | 4B45 CS:func/CCM_HSCSD_CALL_STATE_PARAMS | ||
1414 | 4CXX SIM_INFO:func/SIM_INFO_FUNCTION_TRA | ||
1415 | 4C00 SIM_INFO:func/READ_SERV_TABLE | ||
1416 | 4C01 SIM_INFO:func/READ_ADM_DATA | ||
1417 | 4C02 SIM_INFO:func/READ_ID_DATA | ||
1418 | 4C03 SIM_INFO:func/READ_TMSI | ||
1419 | 4C04 SIM_INFO:func/WRITE_TMSI | ||
1420 | 4C05 SIM_INFO:func/READ_LAI | ||
1421 | 4C06 SIM_INFO:func/WRITE_LAI | ||
1422 | 4C07 SIM_INFO:func/READ_CIPH_KEY | ||
1423 | 4C08 SIM_INFO:func/WRITE_CIPH_KEY | ||
1424 | 4C09 SIM_INFO:func/READ_CIPH_KEY_SNR | ||
1425 | 4C0A SIM_INFO:func/WRITE_CIPH_KEY_SNR | ||
1426 | 4C0B SIM_INFO:func/READ_T3212 | ||
1427 | 4C0C SIM_INFO:func/WRITE_T3212 | ||
1428 | 4C0D SIM_INFO:func/READ_BCCH_INFO_LIST | ||
1429 | 4C0E SIM_INFO:func/WRITE_BCCH_INFO_LIST | ||
1430 | 4C0F SIM_INFO:func/SIM_INFO_DUMMY_0_0 | ||
1431 | 4C10 SIM_INFO:func/ADD_FORBIDDEN_PLMN | ||
1432 | 4C11 SIM_INFO:func/ERASE_FORBIDDEN_PLMN | ||
1433 | 4C12 SIM_INFO:func/CHECK_FORBIDDEN_PLMN | ||
1434 | 4C13 SIM_INFO:func/READ_LOC_UPD_STATUS | ||
1435 | 4C14 SIM_INFO:func/WRITE_LOC_UPD_STATUS | ||
1436 | 4C15 SIM_INFO:func/FIRST_PLMN_SELECTOR | ||
1437 | 4C16 SIM_INFO:func/NEXT_PLMN_SELECTOR | ||
1438 | 4C17 SIM_INFO:func/WRITE_PLMN_LIST | ||
1439 | 4C18 SIM_INFO:func/DISABLE_IMSI | ||
1440 | 4C19 SIM_INFO:func/READ_HPLMN | ||
1441 | 4C1A SIM_INFO:func/SIM_INFO_AVAILABLE | ||
1442 | 4C1B SIM_INFO:func/READ_MOBILE_IDENTITY | ||
1443 | 4C1C SIM_INFO:func/CLEAR_SIM_INFO | ||
1444 | 4C1D SIM_INFO:func/READ_PLMN_LIST | ||
1445 | 4C1E SIM_INFO:func/READ_BCCH_BIT_MAP | ||
1446 | 4C1F SIM_INFO:func/PIN_STATUS | ||
1447 | 4C20 SIM_INFO:func/WRITE_LANGUAGE_PREF | ||
1448 | 4C21 SIM_INFO:func/READ_LANGUAGE_PREF | ||
1449 | 4C22 SIM_INFO:func/WRITE_SMS_STATUS | ||
1450 | 4C23 SIM_INFO:func/READ_SMS_STATUS | ||
1451 | 4C24 SIM_INFO:func/READ_DATA_SIZES | ||
1452 | 4C25 SIM_INFO:func/READ_FIRST_MSISDN_NBR | ||
1453 | 4C26 SIM_INFO:func/PIN2_STATUS | ||
1454 | 4C27 SIM_INFO:func/FIXDIAL_STATUS | ||
1455 | 4C28 SIM_INFO:func/READ_HPLMN_SEARCH | ||
1456 | 4C29 SIM_INFO:func/READ_SERV_CONTROL_TBL | ||
1457 | 4C2A SIM_INFO:func/WRITE_DYN_FLAGS | ||
1458 | 4C2B SIM_INFO:func/READ_DYN_FLAGS | ||
1459 | 4C2C SIM_INFO:func/WRITE_VOICE_MSG_FLAGS | ||
1460 | 4C2D SIM_INFO:func/READ_VOICE_MSG_FLAGS | ||
1461 | 4C2E SIM_INFO:func/WRITE_CALL_FORWARD_FLAGS | ||
1462 | 4C2F SIM_INFO:func/READ_CALL_FORWARD_FLAGS | ||
1463 | 4C30 SIM_INFO:func/READ_WELCOME_MESSAGE | ||
1464 | 4C31 SIM_INFO:func/READ_OPERATOR_NAME | ||
1465 | 4C32 SIM_INFO:func/WRITE_DYN2_FLAGS | ||
1466 | 4C33 SIM_INFO:func/READ_DYN2_FLAGS | ||
1467 | 4C34 SIM_INFO:func/READ_PUCT | ||
1468 | 4C35 SIM_INFO:func/READ_CPHS | ||
1469 | 4C36 SIM_INFO:func/READ_CELL_BC_MSG_ID | ||
1470 | 4C37 SIM_INFO:func/WRITE_CELL_BC_MSG_ID | ||
1471 | 4C38 SIM_INFO:func/FIRST_FREE_SMS_LOC | ||
1472 | 4C39 SIM_INFO:func/READ_LOCAL_CALL_TEXT | ||
1473 | 4C3A SIM_INFO:func/READ_TARIFF_PACKAGE | ||
1474 | 4C3B SIM_INFO:func/READ_HOME_ZONE_COORD | ||
1475 | 4C3C SIM_INFO:func/READ_AOC_STATUS | ||
1476 | 4C3D SIM_INFO:func/READ_FORB_PLMN_LIST | ||
1477 | 4C3E SIM_INFO:func/READ_SIM_LOCK_INFO | ||
1478 | 4C3F SIM_INFO:func/BCCH_LIST_NOT_VALID | ||
1479 | 4C40 SIM_INFO:func/READ_SERV_PROV_NAME | ||
1480 | 4C41 SIM_INFO:func/READ_DUALMODE_NAM_DATA | ||
1481 | 4C42 SIM_INFO:func/CHECK_EMERG_CALL_CODES | ||
1482 | 4C43 SIM_INFO:func/READ_EMERG_CALL_CODES | ||
1483 | 4C44 SIM_INFO:func/READ_FDN_INFO | ||
1484 | 4C45 SIM_INFO:func/READ_ADN_INFO | ||
1485 | 4C46 SIM_INFO:func/READ_DUALMODE_SID_LIST | ||
1486 | 4C47 SIM_INFO:func/READ_DUALMODE_NET_FLAG | ||
1487 | 4C48 SIM_INFO:func/READ_DUALMODE_FAC_CODE | ||
1488 | 4C49 SIM_INFO:func/READ_DUALMODE_SYS_PRIORITY_LIST | ||
1489 | 4C4A SIM_INFO:func/CHECK_IF_DUALMODE_SIM | ||
1490 | 4C4B SIM_INFO:func/SIM_INFO_DUMMY_0_1 | ||
1491 | 4C4C SIM_INFO:func/SIM_INFO_DUMMY_0_2 | ||
1492 | 4C4D SIM_INFO:func/SIM_INFO_DUMMY_0_3 | ||
1493 | 4C4E SIM_INFO:func/SIM_INFO_DUMMY_0_4 | ||
1494 | 4C4F SIM_INFO:func/SIM_INFO_DUMMY_0_5 | ||
1495 | 4C50 SIM_INFO:func/SIM_INFO_DUMMY_0_6 | ||
1496 | 4C51 SIM_INFO:func/SIM_INFO_DUMMY_0_7 | ||
1497 | 4C52 SIM_INFO:func/SIM_INFO_DUMMY_0_8 | ||
1498 | 4C53 SIM_INFO:func/SIM_INFO_DUMMY_0_9 | ||
1499 | 4C54 SIM_INFO:func/SIM_INFO_DUMMY_0_10 | ||
1500 | 4C55 SIM_INFO:func/SIM_INFO_DUMMY_0_11 | ||
1501 | 4C56 SIM_INFO:func/SIM_INFO_DUMMY_0_12 | ||
1502 | 4C57 SIM_INFO:func/ | ||
1503 | 4C58 SIM_INFO:func/CHECK_HOME_ZONE | ||
1504 | 4C59 SIM_INFO:func/SIM_INFO_DUMMY_1_1 | ||
1505 | 4C5A SIM_INFO:func/SIM_INFO_DUMMY_1_2 | ||
1506 | 4C5B SIM_INFO:func/SIM_INFO_DUMMY_1_3 | ||
1507 | 4C5C SIM_INFO:func/SIM_INFO_DUMMY_1_4 | ||
1508 | 4C5D SIM_INFO:func/SIM_INFO_DUMMY_1_5 | ||
1509 | 4C5E SIM_INFO:func/SIM_INFO_DUMMY_1_6 | ||
1510 | 4C5F SIM_INFO:func/SIM_INFO_DUMMY_1_7 | ||
1511 | 4C60 SIM_INFO:func/SIM_INFO_DUMMY_1_8 | ||
1512 | 4C61 SIM_INFO:func/SIM_INFO_DUMMY_1_9 | ||
1513 | 4C62 SIM_INFO:func/SIM_INFO_DUMMY_1_10 | ||
1514 | 4C63 SIM_INFO:func/ | ||
1515 | 4C64 SIM_INFO:func/READ_ACM | ||
1516 | 4C65 SIM_INFO:func/READ_ACM_MAX_VALUE | ||
1517 | 4C66 SIM_INFO:func/READ_ACM_WARNING_LEVEL | ||
1518 | 4C67 SIM_INFO:func/READ_CSP | ||
1519 | 4C68 SIM_INFO:func/READ_ZONAL_IND_LABEL | ||
1520 | 4C69 SIM_INFO:func/READ_CARD_TYPE | ||
1521 | 4C6A SIM_INFO:func/WRITE_BCCH_DESCR | ||
1522 | 4C6B SIM_INFO:func/READ_IMSI | ||
1523 | 4C6C SIM_INFO:func/READ_ACCESS_CTRL | ||
1524 | 4C6D SIM_INFO:func/WRITE_DUALMODE_NAM | ||
1525 | 4C6E SIM_INFO:func/READ_SDN_INFO | ||
1526 | 5BXX EM_IF:func/CHA_IF_TRA | ||
1527 | 5B00 EM_IF:func/INIT | ||
1528 | 5B01 EM_IF:func/CHARGER_CONNECTED | ||
1529 | 5B02 EM_IF:func/CHARGER_DISCONNECTED | ||
1530 | 5B03 EM_IF:func/CHARGER_VOL_LIMITATION_ON | ||
1531 | 5B04 EM_IF:func/CHARGER_VOL_LIMITATION_OFF | ||
1532 | 5B05 EM_IF:func/CHARGING_ENABLE | ||
1533 | 5B06 EM_IF:func/CHARGING_DISABLE | ||
1534 | 5B07 EM_IF:func/ACTING_DEAD | ||
1535 | 5B08 EM_IF:func/CALL_CONNECTED | ||
1536 | 5B09 EM_IF:func/CALL_DISCONNECTED | ||
1537 | 5B0A EM_IF:func/POWER_ON | ||
1538 | 5B0B EM_IF:func/ | ||
1539 | 5B0C EM_IF:func/ | ||
1540 | 5B0D EM_IF:func/CHARGER_TYPE_GET | ||
1541 | 5B0E EM_IF:func/CHARGER_CURRENT_GET | ||
1542 | 5B0F EM_IF:func/CHARGER_VOL_GET | ||
1543 | 5B10 EM_IF:func/CHARGE_STATUS_GET | ||
1544 | 5B11 EM_IF:func/BATTERY_TYPE_GET | ||
1545 | 5B12 EM_IF:func/BATTERY_SIZE_GET | ||
1546 | 5B13 EM_IF:func/BATTERY_TEMP_GET | ||
1547 | 5B14 EM_IF:func/BATTERY_VOL_GET | ||
1548 | 5B15 EM_IF:func/BATTERY_VOL_READ | ||
1549 | 5B16 EM_IF:func/BATTERY_VOL_READ_REQ | ||
1550 | 5B17 EM_IF:func/BATTERY_VOL_TX_READ | ||
1551 | 5B18 EM_IF:func/BATTERY_VOL_TX_READ_REQ | ||
1552 | 5B19 EM_IF:func/CHARGED_CAPACITY_GET | ||
1553 | 5CXX EM_INT:func/CHA_INT_FUNCTION_TRA | ||
1554 | 5C00 EM_INT:func/I_FAST_CHARGING | ||
1555 | 5C01 EM_INT:func/I_LI_BATTERY_CHARGING | ||
1556 | 5C02 EM_INT:func/I_COLD_CHARGING | ||
1557 | 5C03 EM_INT:func/I_MAINTENANCE_CHARGING | ||
1558 | 5C04 EM_INT:func/I_TX_ON_CHARGING | ||
1559 | 5C05 EM_INT:func/I_CHARGING_DISABLED | ||
1560 | 5C06 EM_INT:func/I_ONE_CELL_BROKEN | ||
1561 | 5C07 EM_INT:func/I_START_BATT_BAR_SCROLL_REQ | ||
1562 | 5C08 EM_INT:func/I_STOP_BATT_BAR_SCROLL_REQ | ||
1563 | 5C09 EM_INT:func/I_CHARGER_DISCONNECTED | ||
1564 | 5C0A EM_INT:func/I_CHARGER_CONNECTED | ||
1565 | 5C0B EM_INT:func/I_BATTERY_FULL | ||
1566 | 5C0C EM_INT:func/I_BATT_HOT | ||
1567 | 5C0D EM_INT:func/I_LI_BATT_PWM_OVER_LIMIT | ||
1568 | 5C0E EM_INT:func/I_LI_BATT_PWM_BELOW_LIMIT | ||
1569 | 5C0F EM_INT:func/E_CHARGER_CURRENT_FAIL | ||
1570 | 5C10 EM_INT:func/I_BATTERY_NOT_FULL | ||
1571 | 5C11 EM_INT:func/I_CHARGING_COMPLETED | ||
1572 | 5C12 EM_INT:func/E_CHARGER_VOLTAGE_FAIL | ||
1573 | 5C13 EM_INT:func/E_ILLEGAL_OPERATING_STATE | ||
1574 | 5C14 EM_INT:func/ | ||
1575 | 5C15 EM_INT:func/ | ||
1576 | 5C16 EM_INT:func/I_PWM_WRITE | ||
1577 | 5C17 EM_INT:func/I_CHARGE_CURRENT | ||
1578 | 5C18 EM_INT:func/I_CHARGER_CURRENT | ||
1579 | 5C19 EM_INT:func/I_CHARGER_TYPE | ||
1580 | 5C1A EM_INT:func/I_LI_BATT_EEPROM_DATA_CHECK | ||
1581 | 5C1B EM_INT:func/I_OPERATING_MODE | ||
1582 | 5C1C EM_INT:func/I_OPERATING_CURRENT | ||
1583 | 5EXX EM:volt/CHA_VOLTAGE_TRA | ||
1584 | 5E00 EM:volt/I_BATT_TEMP | ||
1585 | 5E01 EM:volt/I_BATT_SIZE | ||
1586 | 5E02 EM:volt/I_CHARGER_VOL_MAX | ||
1587 | 5E03 EM:volt/I_CHARGER_VOL_MIN | ||
1588 | 5E04 EM:volt/I_BATT_VOLTAGE | ||
1589 | 5E05 EM:volt/I_BATT_MEAN_VALUE | ||
1590 | 5E06 EM:volt/I_CHARGER_VOLTAGE | ||
1591 | 5E07 EM:volt/I_BFD_MEDIAN_VALUE | ||
1592 | 5E08 EM:volt/I_BFD_CHARGEAMOUNT | ||
1593 | 5E09 EM:volt/I_BFD_VOLDIFFTOMAX | ||
1594 | 5E0A EM:volt/I_BFD_VOLDROPCNT | ||
1595 | 5E0B EM:volt/I_BFD_TEMPERATURE | ||
1596 | 5E0C EM:volt/I_BFD_VOLTAGE | ||
1597 | 5E0D EM:volt/I_BFD_VOLDIFFTIME | ||
1598 | 5E0E EM:volt/I_BFD_AVERDIFF | ||
1599 | 5E0F EM:volt/I_BFD_DERIVCNT | ||
1600 | 5E10 EM:volt/I_BFD_FULL_BELIEF | ||
1601 | 5E11 EM:volt/I_CVC_BATT_VOL_DOWN | ||
1602 | 5E12 EM:volt/I_CVC_BATT_VOL_UP | ||
1603 | 5E13 EM:volt/I_CVC_BATT_VOL_AVER | ||
1604 | 5E14 EM:volt/I_CVC_BATT_VOL_ERROR | ||
1605 | 5E15 EM:volt/I_CVC_BATT_VOL_CHANGE | ||
1606 | 5E16 EM:volt/I_CVC_BATT_GOAL_VOL | ||
1607 | 5FXX EM:trans/CHA_TRANSITION_TRA | ||
1608 | 5F00 EM:trans/TRANSITION | ||
1609 | 60XX EM_PSM/EM_PSM_TRA | ||
1610 | 6000 EM_PSM/I_EM_PSM_TIME | ||
1611 | 6001 EM_PSM/I_EM_PSM_ITEM | ||
1612 | 6002 EM_PSM/I_EM_PSM_STATE | ||
1613 | 6003 EM_PSM/I_EM_PSM_MAX_ITEMS | ||
1614 | 6004 EM_PSM/I_EM_PSM_AVG_ITEMS | ||
1615 | 6005 EM_PSM/I_EM_PSM_CONSUMED | ||
1616 | 6006 EM_PSM/I_EM_PSM_AVG_CURRENT | ||
1617 | 6007 EM_PSM/I_EM_PSM_TMP_CURRENT | ||
1618 | 62XX LOC:timer/LOC_TIMER_TRA | ||
1619 | 6200 LOC:timer/EVENT_HANDLE | ||
1620 | 64XX LOC_IF:func/LOC_IF_TRA | ||
1621 | 6400 LOC_IF:func/MDI_MSG_RECEIVE | ||
1622 | 6401 LOC_IF:func/COUNTER_INCREMENT | ||
1623 | 6402 LOC_IF:func/COUNTER_READ | ||
1624 | 6403 LOC_IF:func/COUNTER_WRITE | ||
1625 | 6404 LOC_IF:func/DSP_INIT | ||
1626 | 6405 LOC_IF:func/SER_NUM_READ | ||
1627 | 6406 LOC_IF:func/SMS_DATA_DELETE_STATUS | ||
1628 | 6407 LOC_IF:func/PROD_INFO_READ | ||
1629 | 6408 LOC_IF:func/PROD_INFO_WRITE | ||
1630 | 6409 LOC_IF:func/SELF_TEST_RUN | ||
1631 | 640A LOC_IF:func/SELF_TEST_RESULT_GET | ||
1632 | 640B LOC_IF:func/SELF_TEST_PRESET_READ | ||
1633 | 640C LOC_IF:func/SELF_TEST_PRESET_WRITE | ||
1634 | 640D LOC_IF:func/SELF_TEST_IF_READ | ||
1635 | 640E LOC_IF:func/UI_TEST_CONTROL | ||
1636 | 640F LOC_IF:func/PROD_FAST_SERV_CH_READ | ||
1637 | 6410 LOC_IF:func/PROD_FAST_SERV_CH_WRITE | ||
1638 | 6411 LOC_IF:func/VERSION_READ | ||
1639 | 6412 LOC_IF:func/VERSION_WRITE | ||
1640 | 6413 LOC_IF:func/VERSION_MOVE | ||
1641 | 6414 LOC_IF:func/WARR_INFO_READ | ||
1642 | 6415 LOC_IF:func/WARR_INFO_WRITE | ||
1643 | 6416 LOC_IF:func/TRANSFER_START | ||
1644 | 6417 LOC_IF:func/SIM_LOC_CLOSE | ||
1645 | 6418 LOC_IF:func/SIM_LOC_OPEN | ||
1646 | 6419 LOC_IF:func/SIM_LOC_STATUS_GET | ||
1647 | 641A LOC_IF:func/SERIAL_NBR_READ | ||
1648 | 641B LOC_IF:func/SEC_CODE_CALC | ||
1649 | 641C LOC_IF:func/MASTER_CODE_CALC | ||
1650 | 641D LOC_IF:func/MASTER_CODE_CHECK | ||
1651 | 641E LOC_IF:func/IMEISV_READ | ||
1652 | 641F LOC_IF:func/SIM_STATUS | ||
1653 | 6420 LOC_IF:func/SMS_CLEAR | ||
1654 | 6421 LOC_IF:func/SCM_STORE_STATUS | ||
1655 | 6422 LOC_IF:func/SCM_READ_STATUS | ||
1656 | 6423 LOC_IF:func/KEY_PRESS | ||
1657 | 6424 LOC_IF:func/KEY_RELEASE | ||
1658 | 6425 LOC_IF:func/PP_INIT | ||
1659 | 6426 LOC_IF:func/MDI_MSG_RESEIVE | ||
1660 | 6427 LOC_IF:func/ADJ_DATA_READ | ||
1661 | 6428 LOC_IF:func/FACTORY_SET_STATUS | ||
1662 | 6429 LOC_IF:func/PP_READ | ||
1663 | 642A LOC_IF:func/PP_WRITE | ||
1664 | 65XX LOC_INT:func/LOC_INT_TRA | ||
1665 | 6500 LOC_INT:func/TASK_INIT | ||
1666 | 6501 LOC_INT:func/MS_TEST_MODE | ||
1667 | 6502 LOC_INT:func/MCU_CMD_EXECUTE | ||
1668 | 6503 LOC_INT:func/DSP_CMD_EXECUTE | ||
1669 | 6504 LOC_INT:func/PHONE_MEMORY_HANDLE | ||
1670 | 6505 LOC_INT:func/PAGING_STATE_GET | ||
1671 | 6506 LOC_INT:func/RESP_MSG_SEND | ||
1672 | 6507 LOC_INT:func/ADDRESS_CHECK | ||
1673 | 6508 LOC_INT:func/INT_CHSUM_CALC | ||
1674 | 6509 LOC_INT:func/EEP_CHSUM_CALC | ||
1675 | 650A LOC_INT:func/ERROR_MSG_SEND | ||
1676 | 650B LOC_INT:func/RF_TEMP_READ | ||
1677 | 650C LOC_INT:func/AD_CONV_READ | ||
1678 | 650D LOC_INT:func/EEP_CHSUM_SAVE | ||
1679 | 650E LOC_INT:func/FACTORY_SET_LOC | ||
1680 | 650F LOC_INT:func/IMEI_TRANSPORT | ||
1681 | 6510 LOC_INT:func/EVENT_TRC_HANDLE | ||
1682 | 6511 LOC_INT:func/MDI_RESP_HANDLE | ||
1683 | 6512 LOC_INT:func/DSP_MSG_TO_MDI | ||
1684 | 6513 LOC_INT:func/REROUTE_MSG | ||
1685 | 6514 LOC_INT:func/USER_MEMORY_READ | ||
1686 | 6515 LOC_INT:func/USER_MEMORY_WRITE | ||
1687 | 6516 LOC_INT:func/VERSION_HANDLE | ||
1688 | 6517 LOC_INT:func/IMEI_WRITE | ||
1689 | 6518 LOC_INT:func/IMEI_READ | ||
1690 | 6519 LOC_INT:func/PROD_INFO_HANDLE | ||
1691 | 651A LOC_INT:func/WARR_INFO_HANDLE | ||
1692 | 651B LOC_INT:func/TX_CONTROL | ||
1693 | 651C LOC_INT:func/RX_CONTROL | ||
1694 | 651D LOC_INT:func/PWR_RAMP_SEND | ||
1695 | 651E LOC_INT:func/FACTORY_VALUES_SET | ||
1696 | 651F LOC_INT:func/CALL_HANDLE | ||
1697 | 6520 LOC_INT:func/FTD_READ | ||
1698 | 6521 LOC_INT:func/UI_TEST | ||
1699 | 6522 LOC_INT:func/ORIG_IMEI_READ | ||
1700 | 6523 LOC_INT:func/ORIG_IMEI_WRITE | ||
1701 | 6524 LOC_INT:func/ST_RESULTS_READ | ||
1702 | 6525 LOC_INT:func/ST_INFO_READ | ||
1703 | 6526 LOC_INT:func/ST_PRESET_HANDLE | ||
1704 | 6527 LOC_INT:func/UI_CODE_READ | ||
1705 | 6528 LOC_INT:func/UI_CODE_WRITE | ||
1706 | 6529 LOC_INT:func/COUNTER_HANDLE | ||
1707 | 652A LOC_INT:func/STARTUP_RESULT_GET | ||
1708 | 652B LOC_INT:func/Tx_IQ_Cal | ||
1709 | 652C LOC_INT:func/resp_msg_header_make | ||
1710 | 652D LOC_INT:func/warr_data_transfer_handle | ||
1711 | 652E LOC_INT:func/ui_settings_handle | ||
1712 | 652F LOC_INT:func/ui_setting_read | ||
1713 | 6530 LOC_INT:func/ui_setting_write | ||
1714 | 6531 LOC_INT:func/int_aud_loop_set | ||
1715 | 6532 LOC_INT:func/counter_amount_check | ||
1716 | 6533 LOC_INT:func/ad_scaled_value_read | ||
1717 | 6534 LOC_INT:func/pp_handle | ||
1718 | 6535 LOC_INT:func/tx_pwr_ramp_set | ||
1719 | 6536 LOC_INT:func/local_mode_start | ||
1720 | 6537 LOC_INT:func/nsps_read | ||
1721 | 6538 LOC_INT:func/nsps_write | ||
1722 | 6539 LOC_INT:func/graph_display_read | ||
1723 | 653A LOC_INT:func/graph_display_write | ||
1724 | 653B LOC_INT:func/plmn_name_handle | ||
1725 | 653C LOC_INT:func/charging_state | ||
1726 | 653D LOC_INT:func/cs_status_get | ||
1727 | 653E LOC_INT:func/buzzer_test | ||
1728 | 653F LOC_INT:func/ear_volume_sett | ||
1729 | 6540 LOC_INT:func/rtc_time_read | ||
1730 | 6541 LOC_INT:func/rtc_time_set | ||
1731 | 6542 LOC_INT:func/ir_test | ||
1732 | 6543 LOC_INT:func/pwm_write | ||
1733 | 6544 LOC_INT:func/operator_logo_read | ||
1734 | 6545 LOC_INT:func/operator_logo_write | ||
1735 | 6546 LOC_INT:func/ring_tone_read | ||
1736 | 6547 LOC_INT:func/ring_tone_write | ||
1737 | 6548 LOC_INT:func/tx_iq_set | ||
1738 | 6549 LOC_INT:func/sec_startup_msg_send | ||
1739 | 654A LOC_INT:func/sec_ms_id_store | ||
1740 | 654B LOC_INT:func/sec_ms_id_read | ||
1741 | 654C LOC_INT:func/sec_ser_num_prg | ||
1742 | 654D LOC_INT:func/sec_check_sum_calc | ||
1743 | 654E LOC_INT:func/imei_string_get | ||
1744 | 654F LOC_INT:func/sec_encrypted_siml_store | ||
1745 | 6550 LOC_INT:func/sec_siml_state_chg_send | ||
1746 | 6551 LOC_INT:func/sec_master_code_req | ||
1747 | 6552 LOC_INT:func/sec_master_code_resp | ||
1748 | 6553 LOC_INT:func/sim_lock_close_ | ||
1749 | 6554 LOC_INT:func/sim_lock_open_ | ||
1750 | 6555 LOC_INT:func/sim_lock_status_get | ||
1751 | 6556 LOC_INT:func/sim_lock_config_data_set | ||
1752 | 6557 LOC_INT:func/sim_lock_keypad_close_set | ||
1753 | 6558 LOC_INT:func/sim_lock_state_read | ||
1754 | 6559 LOC_INT:func/sim_lock_action_resp_send | ||
1755 | 69XX LOC_MDI:send/LOC_MDI_MSG_SEND_TRA | ||
1756 | 6900 LOC_MDI:send/dsp_init | ||
1757 | 6901 LOC_MDI:send/task_init | ||
1758 | 6902 LOC_MDI:send/mdi_response_handle | ||
1759 | 6903 LOC_MDI:send/dsp_msg_to_mdi | ||
1760 | 6904 LOC_MDI:send/int_aud_loop_set | ||
1761 | 6905 LOC_MDI:send/reroute | ||
1762 | 6906 LOC_MDI:send/tx_power_ramp_send | ||
1763 | 6907 LOC_MDI:send/tx_control | ||
1764 | 6908 LOC_MDI:send/rx_control | ||
1765 | 6909 LOC_MDI:send/tx_pwr_ramp_set | ||
1766 | 690A LOC_MDI:send/local_mode_start | ||
1767 | 690B LOC_MDI:send/tx_iq_set | ||
1768 | 690C LOC_MDI:send/sec_startup_msg_send | ||
1769 | 690D LOC_MDI:send/sec_siml_state_chg_send | ||
1770 | 690E LOC_MDI:send/sec_master_code_req | ||
1771 | 6DXX DEV_IF:func/DEV_IF_TRA | ||
1772 | 6D00 DEV_IF:func/PWR_IF_POWER_ON | ||
1773 | 6D01 DEV_IF:func/PWR_IF_POWER_ON | ||
1774 | 6D02 DEV_IF:func/PWR_IF_POWER_OFF | ||
1775 | 6D03 DEV_IF:func/PWR_IF_UI_POWER_DOWN_READY | ||
1776 | 6D04 DEV_IF:func/PWR_IF_CS_POWER_DOWN_READY | ||
1777 | 6D05 DEV_IF:func/PWR_IF_EM_POWER_DOWN_READY | ||
1778 | 6D06 DEV_IF:func/PWR_IF_LOC_POWER_DOWN_READY | ||
1779 | 6D07 DEV_IF:func/PWR_IF_DEVTIME_POWER_DOWN_READY | ||
1780 | 6D08 DEV_IF:func/PWR_IF_SIM_POWER_DOWN_READY | ||
1781 | 6D09 DEV_IF:func/PWR_IF_CHARGER_CONNECTED | ||
1782 | 6D0A DEV_IF:func/PWR_IF_CHARGER_DISCONNECTED | ||
1783 | 6D0B DEV_IF:func/PWR_IF_CALL_CONN | ||
1784 | 6D0C DEV_IF:func/PWR_IF_CALL_DISCONN | ||
1785 | 6D0D DEV_IF:func/PWR_IF_CHARGING_COMPLETED | ||
1786 | 6D0E DEV_IF:func/PWR_IF_DISCHARGING_COMPLETED | ||
1787 | 6D0F DEV_IF:func/PWR_IF_SW_RESET | ||
1788 | 6D10 DEV_IF:func/PWR_IF_RESET_REASON_SET | ||
1789 | 6D11 DEV_IF:func/DISP_IF_REFRESH | ||
1790 | 6D12 DEV_IF:func/DISP_IF_IND_REFRESH | ||
1791 | 6D13 DEV_IF:func/DISP_IF_IND_ON | ||
1792 | 6D14 DEV_IF:func/DISP_IF_IND_OFF | ||
1793 | 6D15 DEV_IF:func/DISP_IF_IND_BLINK | ||
1794 | 6D16 DEV_IF:func/DISP_IF_CLEAR | ||
1795 | 6D17 DEV_IF:func/DISP_IF_BAR_SCROLL_START | ||
1796 | 6D18 DEV_IF:func/DISP_IF_BAR_SCROLL_STOP | ||
1797 | 6D19 DEV_IF:func/KBD_IF_KEY_CTRL_SET | ||
1798 | 6D1A DEV_IF:func/dev_time_set() | ||
1799 | 6D1B DEV_IF:func/dev_time_get() | ||
1800 | 6D1C DEV_IF:func/dev_time_alarm_set() | ||
1801 | 6D1D DEV_IF:func/dev_time_alarm_get() | ||
1802 | 6D1E DEV_IF:func/dev_time_alarm_set_off() | ||
1803 | 6D1F DEV_IF:func/dev_time_rtc_on() | ||
1804 | 6D20 DEV_IF:func/dev_time_rtc_off() | ||
1805 | 6D21 DEV_IF:func/dev_time_notify_mode_set() | ||
1806 | 6D22 DEV_IF:func/dev_time_notify_mode_get() | ||
1807 | 6D23 DEV_IF:func/dev_time_update() | ||
1808 | 6D24 DEV_IF:func/dev_time_alarm_update() | ||
1809 | 6D25 DEV_IF:func/dev_time_rtc_status() | ||
1810 | 6D26 DEV_IF:func/dev_time_full_days_in_secs() | ||
1811 | 6D27 DEV_IF:func/dev_time_alarm_set_check() | ||
1812 | 6D28 DEV_IF:func/dev_time_factory_set() | ||
1813 | 6D29 DEV_IF:func/dev_time_calib_value_calc() | ||
1814 | 6D2A DEV_IF:func/dev_time_date_set() | ||
1815 | 6D2B DEV_IF:func/dev_disp_update() | ||
1816 | 6D2C DEV_IF:func/dev_disp_indi_update() | ||
1817 | 6D2D DEV_IF:func/dev_indicator_on() | ||
1818 | 6D2E DEV_IF:func/dev_indicator_off() | ||
1819 | 6D2F DEV_IF:func/dev_indicator_blink() | ||
1820 | 6D30 DEV_IF:func/dev_disp_clear() | ||
1821 | 6D31 DEV_IF:func/dev_grph_area_set() | ||
1822 | 6D32 DEV_IF:func/dev_grph_font_info_get() | ||
1823 | 6D33 DEV_IF:func/dev_grph_battery_bar_on() | ||
1824 | 6D34 DEV_IF:func/dev_grph_battery_bar_off() | ||
1825 | 6D35 DEV_IF:func/dev_grph_battery_bar_blink() | ||
1826 | 6D36 DEV_IF:func/dev_grph_rf_bar_on() | ||
1827 | 6D37 DEV_IF:func/dev_grph_rf_bar_off() | ||
1828 | 6D38 DEV_IF:func/dev_grph_rf_bar_blink() | ||
1829 | 6D39 DEV_IF:func/dev_grph_bitmap_display() | ||
1830 | 6D3A DEV_IF:func/dev_grph_text_draw() | ||
1831 | 6D3B DEV_IF:func/dev_grph_pixel_set() | ||
1832 | 6D3C DEV_IF:func/dev_grph_line_draw() | ||
1833 | 6D3D DEV_IF:func/dev_grph_battery_bar_type_set() | ||
1834 | 6D3E DEV_IF:func/dev_grph_rf_bar_type_set | ||
1835 | 6D3F DEV_IF:func/dev_disp_blink_disable() | ||
1836 | 6D40 DEV_IF:func/dev_disp_batt_bar_write() | ||
1837 | 6D41 DEV_IF:func/dev_disp_rf_bar_write | ||
1838 | 6D42 DEV_IF:func/dev_disp_test_pattern_on() | ||
1839 | 6D43 DEV_IF:func/dev_disp_test_pattern_off() | ||
1840 | 6D44 DEV_IF:func/dev_indicator_state_get() | ||
1841 | 6D45 DEV_IF:func/dev_disp_acting_dead_bar_set() | ||
1842 | 6D46 DEV_IF:func/dev_disp_acting_dead_bar_clear() | ||
1843 | 6D47 DEV_IF:func/dev_grph_rectangle_draw() | ||
1844 | 6D48 DEV_IF:func/dev_grph_write_string() | ||
1845 | 6D49 DEV_IF:func/dev_grph_char_info_get() | ||
1846 | 6D4A DEV_IF:func/dev_grph_init() | ||
1847 | 6D4B DEV_IF:func/dev_discharge_start() | ||
1848 | 6D4C DEV_IF:func/dev_discharge_stop() | ||
1849 | 6D4D DEV_IF:func/dev_gsm_power_down() | ||
1850 | 6D4E DEV_IF:func/dev_sim_deactivated() | ||
1851 | 6D4F DEV_IF:func/dev_recovery_reset() | ||
1852 | 6D50 DEV_IF:func/dev_dsp_deactivate() | ||
1853 | 6D51 DEV_IF:func/dev_gsm_factory_set() | ||
1854 | 6D52 DEV_IF:func/dev_sms_message_clear() | ||
1855 | 6D53 DEV_IF:func/dev_sms_message_read_sif() | ||
1856 | 6D54 DEV_IF:func/dev_sms_message_store_sif() | ||
1857 | 6D55 DEV_IF:func/dev_sms_update_msg_reference() | ||
1858 | 6D56 DEV_IF:func/dev_sms_update_msg_status() | ||
1859 | 6D57 DEV_IF:func/dev_buzzer_test() | ||
1860 | 6D58 DEV_IF:func/dev_gsm_normal_power_up() | ||
1861 | 6D59 DEV_IF:func/dev_standby_status_get() | ||
1862 | 6D5A DEV_IF:func/dev_rf_bar_get() | ||
1863 | 6D5B DEV_IF:func/dev_nsps_status_get() | ||
1864 | 6D5C DEV_IF:func/dev_nsps_key_press() | ||
1865 | 6D5D DEV_IF:func/dev_nsps_timeout() | ||
1866 | 6D5E DEV_IF:func/dev_nsps_serv_off() | ||
1867 | 6D5F DEV_IF:func/dev_nsps_serv_on() | ||
1868 | 6D60 DEV_IF:func/dev_nsps_charger_status() | ||
1869 | 6D61 DEV_IF:func/dev_signal_indicator_set() | ||
1870 | 6D62 DEV_IF:func/dev_ccont_int_handler() | ||
1871 | 6D63 DEV_IF:func/dev_ccont_charger_exist() | ||
1872 | 6D64 DEV_IF:func/dev_ct_timer_start() | ||
1873 | 6D65 DEV_IF:func/dev_ct_timer_stop() | ||
1874 | 6D66 DEV_IF:func/dev_ct_timer_read() | ||
1875 | 6D67 DEV_IF:func/dev_cs_wakeup_needed() | ||
1876 | 6D68 DEV_IF:func/ | ||
1877 | 6D69 DEV_IF:func/ | ||
1878 | 72XX DEV_PWR:func/DEV_PWR_TRA | ||
1879 | 7200 DEV_PWR:func/unused | ||
1880 | 7201 DEV_PWR:func/DSP_STARTUP_COMPLETED | ||
1881 | 7202 DEV_PWR:func/CS_INIT_COMPLETED | ||
1882 | 7203 DEV_PWR:func/UI_INIT_COMPLETED | ||
1883 | 7204 DEV_PWR:func/EM_INIT_COMPLETED | ||
1884 | 7205 DEV_PWR:func/DETERMINE_WAKEUP_REASON | ||
1885 | 7206 DEV_PWR:func/RTC_CALIBRATION_COMPLETED | ||
1886 | 7207 DEV_PWR:func/ALARM_WRITE_COMPLETED | ||
1887 | 73XX DEV_GRPH:func/DEV_GRPH_TRA | ||
1888 | 7300 DEV_GRPH:func/unused | ||
1889 | 7301 DEV_GRPH:func/INDI_UPDATE | ||
1890 | 7302 DEV_GRPH:func/Indicator set ON | ||
1891 | 7303 DEV_GRPH:func/Indicator set OFF | ||
1892 | 7304 DEV_GRPH:func/Indicator set BLINKING | ||
1893 | 7305 DEV_GRPH:func/HORIZ text_draw() | ||
1894 | 7306 DEV_GRPH:func/VERT text_draw() | ||
1895 | 7307 DEV_GRPH:func/text_draw() reported to DDI | ||
1896 | 7308 DEV_GRPH:func/battery_bar type set to | ||
1897 | 7309 DEV_GRPH:func/rf_bar type set to | ||
1898 | 730A DEV_GRPH:func/blink_status set to ON | ||
1899 | 730B DEV_GRPH:func/blink_status set to OFF | ||
1900 | 730C DEV_GRPH:func/blinking ENABLED | ||
1901 | 730D DEV_GRPH:func/blinking DISABLED | ||
1902 | 730E DEV_GRPH:func/batt_bar_write(), segments | ||
1903 | 730F DEV_GRPH:func/rf_bar_write(), segments | ||
1904 | 7310 DEV_GRPH:func/PPM fonts found | ||
1905 | 7311 DEV_GRPH:func/ROM-fonts used | ||
1906 | 74XX DEV_DISP:func/DEV_DISP_TRA | ||
1907 | 7400 DEV_DISP:func/unused | ||
1908 | 7401 DEV_DISP:func/dev_disp_bars_update() | ||
1909 | 7402 DEV_DISP:func/dev_disp_batt_bar_update(), segments | ||
1910 | 7403 DEV_DISP:func/dev_disp_rf_bar_update(), segments | ||
1911 | 7404 DEV_DISP:func/dev_disp_batt_bar_clear() | ||
1912 | 7405 DEV_DISP:func/dev_disp_rf_bar_clear() | ||
1913 | 7406 DEV_DISP:func/dev_light_on() | ||
1914 | 7407 DEV_DISP:func/dev_light_off() | ||
1915 | 7408 DEV_DISP:func/dev_light_blink() | ||
1916 | 7409 DEV_DISP:func/dev_disp_light_on() | ||
1917 | 740A DEV_DISP:func/dev_disp_light_off() | ||
1918 | 740B DEV_DISP:func/dev_disp_light_blink() | ||
1919 | 740C DEV_DISP:func/dev_keyboard_light_on() | ||
1920 | 740D DEV_DISP:func/dev_keyboard_light_off() | ||
1921 | 740E DEV_DISP:func/dev_keyboard_light_blink() | ||
1922 | 740F DEV_DISP:func/dev_charge_bar_get() | ||
1923 | 7410 DEV_DISP:func/dev_disp_lcd_power_on() | ||
1924 | 7411 DEV_DISP:func/dev_disp_lcd_power_off() | ||
1925 | 7412 DEV_DISP:func/dev_disp_text_draw_report(), set ON | ||
1926 | 7413 DEV_DISP:func/dev_disp_text_draw_report(), set OFF | ||
1927 | 75XX DEV_ACC:func/DEV_ACC_TRA | ||
1928 | 7500 DEV_ACC:func/unused | ||
1929 | 7501 DEV_ACC:func/Use_mode_get | ||
1930 | 7502 DEV_ACC:func/Detect_poll | ||
1931 | 7503 DEV_ACC:func/Headset_connection_check | ||
1932 | 7504 DEV_ACC:func/Audio_control | ||
1933 | 7505 DEV_ACC:func/Audio_activate | ||
1934 | 7506 DEV_ACC:func/Audio_deactivate | ||
1935 | 7507 DEV_ACC:func/Car_speaker_mute_on | ||
1936 | 7508 DEV_ACC:func/Car_speaker_mute_off | ||
1937 | 7509 DEV_ACC:func/Car_mic_mute_on | ||
1938 | 750A DEV_ACC:func/Car_mic_mute_off | ||
1939 | 750B DEV_ACC:func/Radio_mute_set_on | ||
1940 | 750C DEV_ACC:func/Radio_mute_set_off | ||
1941 | 750D DEV_ACC:func/Car IGN | ||
1942 | 750E DEV_ACC:func/HFU2: Hook-On | ||
1943 | 750F DEV_ACC:func/HFU2: Hook-Off | ||
1944 | 7510 DEV_ACC:func/Antenna_motor_set_on | ||
1945 | 7511 DEV_ACC:func/Antenna_motor_set_off | ||
1946 | 7512 DEV_ACC:func/EAD_get | ||
1947 | 7513 DEV_ACC:func/Alive_msg_send | ||
1948 | 7514 DEV_ACC:func/Vibration_alert_set_on | ||
1949 | 7515 DEV_ACC:func/Vibration_alert_set_off | ||
1950 | 7516 DEV_ACC:func/New Mode | ||
1951 | 7517 DEV_ACC:func/Headset Button State | ||
1952 | 7518 DEV_ACC:func/Unknown HFU2 func | ||
1953 | 7519 DEV_ACC:func/Unk HFU2 IND sub_func | ||
1954 | 751A DEV_ACC:func/Unk HFU2 ACC sub_func | ||
1955 | 751B DEV_ACC:func/Bad HFU-2 Connection! | ||
1956 | 751C DEV_ACC:func/HFU-2 Selftest fail! | ||
1957 | 751D DEV_ACC:func/HFU-2 Port Read Resp | ||
1958 | 751E DEV_ACC:func/HFU-2 ADC Value | ||
1959 | 751F DEV_ACC:func/HFU-2 Model Message | ||
1960 | 7520 DEV_ACC:func/HFU-2 Audio Path | ||
1961 | 7521 DEV_ACC:func/HFU-2 Audio Path Resp | ||
1962 | 7522 DEV_ACC:func/Unk PN Obj Router Func | ||
1963 | 7523 DEV_ACC:func/Unk PN Router Sub Func | ||
1964 | 7524 DEV_ACC:func/dev_acc_power_off() | ||
1965 | 7525 DEV_ACC:func/dev_acc_power_off_ok() | ||
1966 | 76XX DEV_TIME:func/DEV_TIME_TRA | ||
1967 | 7600 DEV_TIME:func/unused | ||
1968 | 7601 DEV_TIME:func/TIME_SET | ||
1969 | 7602 DEV_TIME:func/TIME_GET | ||
1970 | 7603 DEV_TIME:func/ALARM_SET | ||
1971 | 7604 DEV_TIME:func/ALARM_GET | ||
1972 | 7605 DEV_TIME:func/NOTIFY_MODE_SET | ||
1973 | 7606 DEV_TIME:func/NOTIFY_MODE_GET | ||
1974 | 7607 DEV_TIME:func/TIME_NOTIFY | ||
1975 | 7608 DEV_TIME:func/ALARM_NOTIFY | ||
1976 | 7609 DEV_TIME:func/ALARM_CHK_NOTIFY | ||
1977 | 760A DEV_TIME:func/RTC_STATUS | ||
1978 | 760B DEV_TIME:func/RTC_STATUS_CHECK | ||
1979 | 760C DEV_TIME:func/RTC_STATUS_GET | ||
1980 | 760D DEV_TIME:func/FULL_DAYS_IN_SECS | ||
1981 | 760E DEV_TIME:func/CALIB_VALUE_CALC | ||
1982 | 760F DEV_TIME:func/NEW_CALIB_VALUE | ||
1983 | 7610 DEV_TIME:func/SLEEP_CLK_RATIO_SET | ||
1984 | 7611 DEV_TIME:func/SLEEP_CLK_CALIB_REQ | ||
1985 | 7612 DEV_TIME:func/WAITING_NEW_CALIB | ||
1986 | 7613 DEV_TIME:func/WAITING_NEW_ALARM | ||
1987 | 7614 DEV_TIME:func/INFORM_ALARM_TO_UI | ||
1988 | 7615 DEV_TIME:func/ALARM_TYPE_GET | ||
1989 | 7616 DEV_TIME:func/DEV_TIME_CSM_INIT | ||
1990 | 7617 DEV_TIME:func/DATE_SET | ||
1991 | 7618 DEV_TIME:func/dev_time_rtc_status_check(), comparison results | ||
1992 | 78XX DEV_GSM:func/DEV_GSM_TRA | ||
1993 | 7800 DEV_GSM:func/unused | ||
1994 | 7801 DEV_GSM:func/FAST discharge started | ||
1995 | 7802 DEV_GSM:func/SLOW discharge started | ||
1996 | 7803 DEV_GSM:func/Discharging stopped | ||
1997 | 7804 DEV_GSM:func/Last power-up was normal | ||
1998 | 7805 DEV_GSM:func/Last power-up was NOT normal | ||
1999 | 7806 DEV_GSM:func/dev_standby_status_get(), OK | ||
2000 | 7807 DEV_GSM:func/dev_standby_status_get(), FAIL | ||
2001 | 79XX DEV_CCNT:func/DEV_CCNT_TRA | ||
2002 | 7900 DEV_CCNT:func/unused | ||
2003 | 7901 DEV_CCNT:func/dev_ccont_int_handler(), CCONT intr. ID register | ||
2004 | 7902 DEV_CCNT:func/dev_ccont_int_handler(), RTC-DAY interrupt! | ||
2005 | 7903 DEV_CCNT:func/dev_ccont_int_handler(), RTC-MIN interrupt! | ||
2006 | 7904 DEV_CCNT:func/dev_ccont_int_handler(), RTC-SEC interrupt! | ||
2007 | 7905 DEV_CCNT:func/dev_ccont_int_handler(), RTC-ALR interrupt! | ||
2008 | 7906 DEV_CCNT:func/dev_ccont_int_handler(), CHARGER interrupt! | ||
2009 | 7907 DEV_CCNT:func/dev_ccont_charger_exist(), charger CONNECTION! | ||
2010 | 7908 DEV_CCNT:func/dev_ccont_charger_exist(), charger DISCONNECTION! | ||
2011 | 7DXX AUD:func/AUD_FUNCTION_TRA | ||
2012 | 7D00 AUD:func/aud_init | ||
2013 | 7D01 AUD:func/aud_acc_active | ||
2014 | 7D02 AUD:func/aud_path_on | ||
2015 | 7D03 AUD:func/aud_path_off | ||
2016 | 7D04 AUD:func/aud_mode | ||
2017 | 7D05 AUD:func/aud_mic_cs_on | ||
2018 | 7D06 AUD:func/aud_mic_cs_off | ||
2019 | 7D07 AUD:func/aud_mic_ui_on | ||
2020 | 7D08 AUD:func/aud_mic_ui_off | ||
2021 | 7D09 AUD:func/aud_mic_user_on | ||
2022 | 7D0A AUD:func/aud_mic_user_off | ||
2023 | 7D0B AUD:func/aud_ear_cs_on | ||
2024 | 7D0C AUD:func/aud_ear_cs_off | ||
2025 | 7D0D AUD:func/aud_ear_ui_on | ||
2026 | 7D0E AUD:func/aud_ear_ui_off | ||
2027 | 7D0F AUD:func/aud_ear_vol_set | ||
2028 | 7D10 AUD:func/aud_ear_vol_get | ||
2029 | 7D11 AUD:func/aud_ear_vol_inc | ||
2030 | 7D12 AUD:func/aud_ear_vol_dec | ||
2031 | 7D13 AUD:func/aud_request | ||
2032 | 7D14 AUD:func/audio dsp params chunk | ||
2033 | 7D15 AUD:func/mic/ear state | ||
2034 | 7EXX TONE:func/TONE_FUNCTION_TRA | ||
2035 | 7E00 TONE:func/aud_tone_start | ||
2036 | 7E01 TONE:func/aud_tone_stop | ||
2037 | 7E02 TONE:func/aud_dtmf_start | ||
2038 | 7E03 TONE:func/aud_tone_buzzer | ||
2039 | 7E04 TONE:func/aud_tone_ear | ||
2040 | 7E05 TONE:func/aud_tone_buzzer_ear | ||
2041 | 7FXX AUD:msg/AUD_MSG_TRA | ||
2042 | 7F00 AUD:msg/aud_api_write | ||
2043 | 7F01 AUD:msg/aud_api_error | ||
2044 | 80XX AUD:tim/AUD_TIMER_TRA | ||
2045 | 8000 AUD:tim/aud_ear_timer_start | ||
2046 | 8001 AUD:tim/aud_mic_timer_start | ||
2047 | 8002 AUD:tim/aud_param_timer_start | ||
2048 | 8003 AUD:tim/aud_refresh_timer_start | ||
2049 | 8004 AUD:tim/aud_test_timer_start | ||
2050 | 8005 AUD:tim/aud_ear_timeout | ||
2051 | 8006 AUD:tim/aud_mic_timeout | ||
2052 | 8007 AUD:tim/aud_param_timeout | ||
2053 | 8008 AUD:tim/aud_refresh_timeout | ||
2054 | 8009 AUD:tim/aud_test_timeout | ||
2055 | 800A AUD:tim/aud_message_error | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/type-cc.h b/gammu/emb/gammu/depend/nokia/dct3trac/type-cc.h new file mode 100644 index 0000000..6c07ca2 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/type-cc.h | |||
@@ -0,0 +1,43 @@ | |||
1 | {0x00, "", "Escape to nationally specific message types"}, | ||
2 | /* Call establishment messages: */ | ||
3 | {0x01, "9.3.1", "ALERTING"}, | ||
4 | {0x08, "9.3.2", "CALL CONFIRMED"}, | ||
5 | {0x02, "9.3.3", "CALL PROCEEDING"}, | ||
6 | {0x07, "9.3.5", "CONNECT"}, | ||
7 | {0x0F, "9.3.6", "CONNECT ACKNOWLEDGE"}, | ||
8 | {0x0E, "9.3.8", "EMERGENCY SETUP"}, | ||
9 | {0x03, "9.3.17", "PROGRESS"}, | ||
10 | {0x04, "9.3.17a", "CC-ESTABLISHMENT"}, | ||
11 | {0x06, "9.3.17b", "CC-ESTABLISHMENT CONFIRMED"}, | ||
12 | {0x0B, "9.3.18a", "RECALL"}, | ||
13 | {0x09, "9.3.23a", "START CC"}, | ||
14 | {0x05, "9.3.23", "SETUP"}, | ||
15 | /* Call information phase messages: */ | ||
16 | {0x17, "9.3.13", "MODIFY"}, | ||
17 | {0x1F, "9.3.14", "MODIFY COMPLETE"}, | ||
18 | {0x13, "9.3.15", "MODIFY REJECT"}, | ||
19 | {0x10, "9.3.31", "USER INFORMATION"}, | ||
20 | {0x18, "9.3.10", "HOLD"}, | ||
21 | {0x19, "9.3.11", "HOLD ACKNOWLEDGE"}, | ||
22 | {0x1A, "9.3.12", "HOLD REJECT"}, | ||
23 | {0x1C, "9.3.20", "RETRIEVE"}, | ||
24 | {0x1D, "9.3.21", "RETRIEVE ACKNOWLEDGE"}, | ||
25 | {0x1E, "9.3.22", "RETRIEVE REJECT"}, | ||
26 | /* Call clearing messages: */ | ||
27 | {0x25, "9.3.7", "DISCONNECT"}, | ||
28 | {0x2D, "9.3.18", "RELEASE"}, | ||
29 | {0x2A, "9.3.19", "RELEASE COMPLETE"}, | ||
30 | /* Miscellaneous messages: */ | ||
31 | {0x39, "9.3.4", "CONGESTION CONTROL"}, | ||
32 | {0x3E, "9.3.16", "NOTIFY"}, | ||
33 | {0x3D, "9.3.27", "STATUS"}, | ||
34 | {0x34, "9.3.28", "STATUS ENQUIRY"}, | ||
35 | {0x35, "9.3.24", "START DTMF"}, | ||
36 | {0x31, "9.3.29", "STOP DTMF"}, | ||
37 | {0x32, "9.3.30", "STOP DTMF ACKNOWLEDGE"}, | ||
38 | {0x36, "9.3.25", "START DTMF ACKNOWLEDGE"}, | ||
39 | {0x37, "9.3.26", "START DTMF REJECT"}, | ||
40 | {0x3A, "9.3.9", "FACILITY"}, | ||
41 | {-1, NULL, NULL} | ||
42 | /* Unused sections | ||
43 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/type-mm.h b/gammu/emb/gammu/depend/nokia/dct3trac/type-mm.h new file mode 100644 index 0000000..8ba36b2 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/type-mm.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* Registration messages: */ | ||
2 | {0x01, "9.2.12", "IMSI DETACH INDICATION"}, | ||
3 | {0x02, "9.2.13", "LOCATION UPDATING ACCEPT"}, | ||
4 | {0x04, "9.2.14", "LOCATION UPDATING REJECT"}, | ||
5 | {0x08, "9.2.15", "LOCATION UPDATING REQUEST"}, | ||
6 | /* Security messages: */ | ||
7 | {0x11, "9.2.1", "AUTHENTICATION REJECT"}, | ||
8 | {0x12, "9.2.2", "AUTHENTICATION REQUEST"}, | ||
9 | {0x14, "9.2.3", "AUTHENTICATION RESPONSE"}, | ||
10 | {0x1C, "9.2.3a", "CS AUTHENTICATION FAILURE"}, | ||
11 | {0x18, "9.2.10", "IDENTITY REQUEST"}, | ||
12 | {0x19, "9.2.11", "IDENTITY RESPONSE"}, | ||
13 | {0x1A, "9.2.17", "TMSI REALLOCATION COMMAND"}, | ||
14 | {0x1B, "9.2.18", "TMSI REALLOCATION COMPLETE"}, | ||
15 | /* Connection management messages: */ | ||
16 | {0x21, "9.2.5", "CM SERVICE ACCEPT"}, | ||
17 | {0x22, "9.2.6", "CM SERVICE REJECT"}, | ||
18 | {0x23, "9.2.7", "CM SERVICE ABORT"}, | ||
19 | {0x24, "9.2.9", "CM SERVICE REQUEST"}, | ||
20 | {0x25, "9.2.5a", "CM SERVICE PROMPT"}, | ||
21 | {0x26, "9.2.20", "NOTIFICATION RESPONSE"}, | ||
22 | {0x28, "9.2.4", "CM RE-ESTABLISHMENT REQUEST"}, | ||
23 | {0x29, "9.2.8", "ABORT"}, | ||
24 | /* Miscellaneous messages: */ | ||
25 | {0x30, "9.2.19", "MM NULL"}, | ||
26 | {0x31, "9.2.16", "MM STATUS"}, | ||
27 | {0x32, "9.2.15a", "MM INFORMATION"}, | ||
28 | {-1, NULL, NULL} | ||
29 | /* Unused sections | ||
30 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/type-rr.h b/gammu/emb/gammu/depend/nokia/dct3trac/type-rr.h new file mode 100644 index 0000000..31adee4 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/type-rr.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /* Channel establishment messages: */ | ||
2 | {0x3C, "9.1.28a", "RR INITIALISATION REQUEST"}, | ||
3 | {0x3B, "9.1.1", "ADDITIONAL ASSIGNMENT"}, | ||
4 | {0x3F, "9.1.18", "IMMEDIATE ASSIGNMENT"}, | ||
5 | {0x39, "9.1.19", "IMMEDIATE ASSIGNMENT EXTENDED"}, | ||
6 | {0x3A, "9.1.20", "IMMEDIATE ASSIGNMENT REJECT"}, | ||
7 | {0x48, "9.1.12f", "DTM ASSIGNMENT FAILURE"}, | ||
8 | {0x49, "9.1.12h", "DTM REJECT"}, | ||
9 | {0x4A, "9.1.12i", "DTM REQUEST"}, | ||
10 | {0x4B, "9.1.21f", "PACKET ASSIGNMENT"}, | ||
11 | /* Ciphering messages: */ | ||
12 | {0x35, "9.1.9", "CIPHERING MODE COMMAND"}, | ||
13 | {0x32, "9.1.10", "CIPHERING MODE COMPLETE"}, | ||
14 | /* Configuration change messages: */ | ||
15 | {0x30, "9.1.12b", "CONFIGURATION CHANGE COMMAND"}, | ||
16 | {0x31, "9.1.12c", "CONFIGURATION CHANGE ACKNOWLEDGE"}, | ||
17 | {0x33, "9.1.12d", "CONFIGURATION CHANGE REJECT"}, | ||
18 | /* Handover messages: */ | ||
19 | {0x2E, "9.1.2", "ASSIGNMENT COMMAND"}, | ||
20 | {0x29, "9.1.3", "ASSIGNMENT COMPLETE"}, | ||
21 | {0x2F, "9.1.4", "ASSIGNMENT FAILURE"}, | ||
22 | {0x2B, "9.1.15", "HANDOVER COMMAND"}, | ||
23 | {0x2C, "9.1.16", "HANDOVER COMPLETE"}, | ||
24 | {0x28, "9.1.17", "HANDOVER FAILURE"}, | ||
25 | {0x2D, "9.1.28", "PHYSICAL INFORMATION"}, | ||
26 | {0x4C, "9.1.12e", "DTM ASSIGNMENT COMMAND"}, | ||
27 | {0x08, "9.1.21e", "RR-CELL CHANGE ORDER"}, | ||
28 | {0x23, "9.1.13a", "PDCH ASSIGNMENT COMMAND"}, | ||
29 | /* Channel release messages: */ | ||
30 | {0x0D, "9.1.7", "CHANNEL RELEASE"}, | ||
31 | {0x0A, "9.1.26", "PARTIAL RELEASE"}, | ||
32 | {0x0F, "9.1.27", "PARTIAL RELEASE COMPLETE"}, | ||
33 | /* Paging and Notification messages: */ | ||
34 | {0x21, "9.1.22", "PAGING REQUEST TYPE 1"}, | ||
35 | {0x22, "9.1.23", "PAGING REQUEST TYPE 2"}, | ||
36 | {0x24, "9.1.24", "PAGING REQUEST TYPE 3"}, | ||
37 | {0x27, "9.1.25", "PAGING RESPONSE"}, | ||
38 | {0x20, "9.1.21b", "NOTIFICATION/NCH"}, | ||
39 | {0x25, "", "Reserved"}, | ||
40 | {0x26, "9.1.21d", "NOTIFICATION RESPONSE"}, | ||
41 | {0x0B, "", "Reserved"}, | ||
42 | {0x4E, "9.1.21g", "PACKET NOTIFICATION"}, | ||
43 | /* 3G Specific messages */ | ||
44 | {0x60, "9.1.11a", "UTRAN CLASSMARK CHANGE"}, | ||
45 | {0x62, "9.1.11b", "cdma2000 CLASSMARK CHANGE"}, | ||
46 | {0x63, "9.1.15a", "INTER SYSTEM TO UTRAN HANDOVER COMMAND"}, | ||
47 | {0x64, "9.1.15b", "INTER SYSTEM TO CDMA2000 HANDOVER COMMAND"}, | ||
48 | /* System information messages: */ | ||
49 | {0x18, "9.1.42", "SYSTEM INFORMATION TYPE 8"}, | ||
50 | {0x19, "9.1.31", "SYSTEM INFORMATION TYPE 1"}, | ||
51 | {0x1A, "9.1.32", "SYSTEM INFORMATION TYPE 2"}, | ||
52 | {0x1B, "9.1.35", "SYSTEM INFORMATION TYPE 3"}, | ||
53 | {0x1C, "9.1.36", "SYSTEM INFORMATION TYPE 4"}, | ||
54 | {0x1D, "9.1.37", "SYSTEM INFORMATION TYPE 5"}, | ||
55 | {0x1E, "9.1.40", "SYSTEM INFORMATION TYPE 6"}, | ||
56 | {0x1F, "9.1.41", "SYSTEM INFORMATION TYPE 7"}, | ||
57 | /* System information messages: */ | ||
58 | {0x02, "9.1.33", "SYSTEM INFORMATION TYPE 2bis"}, | ||
59 | {0x03, "9.1.34", "SYSTEM INFORMATION TYPE 2ter"}, | ||
60 | {0x07, "9.1.34a", "SYSTEM INFORMATION TYPE 2quater"}, | ||
61 | {0x05, "9.1.38", "SYSTEM INFORMATION TYPE 5bis"}, | ||
62 | {0x06, "9.1.39", "SYSTEM INFORMATION TYPE 5ter"}, | ||
63 | {0x04, "9.1.43", "SYSTEM INFORMATION TYPE 9"}, | ||
64 | {0x00, "9.1.43a", "SYSTEM INFORMATION TYPE 13"}, | ||
65 | /* System information messages: */ | ||
66 | {0x3D, "9.1.43d", "SYSTEM INFORMATION TYPE 16"}, | ||
67 | {0x3E, "9.1.43e", "SYSTEM INFORMATION TYPE 17"}, | ||
68 | /* System information messages: */ | ||
69 | {0x40, "9.1.43.g", "SYSTEM INFORMATION TYPE 18"}, | ||
70 | {0x41, "9.1.43f", "SYSTEM INFORMATION TYPE 19"}, | ||
71 | {0x42, "9.1.43.h", "SYSTEM INFORMATION TYPE 20"}, | ||
72 | /* Miscellaneous messages: */ | ||
73 | {0x10, "9.1.5", "CHANNEL MODE MODIFY"}, | ||
74 | {0x12, "9.1.29", "RR STATUS"}, | ||
75 | {0x17, "9.1.6", "CHANNEL MODE MODIFY ACKNOWLEDGE"}, | ||
76 | {0x14, "9.1.13", "FREQUENCY REDEFINITION"}, | ||
77 | {0x15, "9.1.21", "MEASUREMENT REPORT"}, | ||
78 | {0x16, "9.1.11", "CLASSMARK CHANGE"}, | ||
79 | {0x13, "9.1.12", "CLASSMARK ENQUIRY"}, | ||
80 | {0x36, "9.1.52", "EXTENDED MEASUREMENT REPORT"}, | ||
81 | {0x37, "9.1.51", "EXTENDED MEASUREMENT ORDER"}, | ||
82 | {0x34, "9.1.13b", "GPRS SUSPENSION REQUEST"}, | ||
83 | {0x4D, "9.1.12g", "DTM INFORMATION"}, | ||
84 | {0x09, "9.1.49", "VGCS UPLINK GRANT"}, | ||
85 | {0x0E, "9.1.48", "UPLINK RELEASE"}, | ||
86 | {0x0C, "", "Reserved"}, | ||
87 | {0x2A, "9.1.46", "UPLINK BUSY"}, | ||
88 | {0x11, "9.1.44", "TALKER INDICATION"}, | ||
89 | {0x38, "9.1.53", "APPLICATION INFORMATION"}, | ||
90 | {-1, NULL, NULL} | ||
91 | /* Unused sections | ||
92 | NOTIFICATION/FACCH [9.1.21a] | ||
93 | HANDOVER ACCESS [9.1.14] | ||
94 | SYNCHRONIZATION CHANNEL INFORMATION [9.1.30] | ||
95 | UPLINK FREE [9.1.47] | ||
96 | UPLINK ACCESS [9.1.45] | ||
97 | ENHANCED MEASUREMENT REPORT [9.1.55] | ||
98 | CHANNEL REQUEST [9.1.8] | ||
99 | MEASUREMENT INFORMATION [9.1.54] | ||
100 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/type-sms.h b/gammu/emb/gammu/depend/nokia/dct3trac/type-sms.h new file mode 100644 index 0000000..54b9ec3 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/type-sms.h | |||
@@ -0,0 +1,6 @@ | |||
1 | {0x01, "7.2.1", "CP-DATA"}, | ||
2 | {0x04, "7.2.2", "CP-ACK"}, | ||
3 | {0x10, "7.2.3", "CP-ERROR"}, | ||
4 | {-1, NULL, NULL} | ||
5 | /* Unused sections | ||
6 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/type-ss.h b/gammu/emb/gammu/depend/nokia/dct3trac/type-ss.h new file mode 100644 index 0000000..d258892 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/type-ss.h | |||
@@ -0,0 +1,8 @@ | |||
1 | /* Clearing messages: */ | ||
2 | {0x2A, "2.5", "RELEASE COMPLETE"}, | ||
3 | /* Miscellaneous message group: */ | ||
4 | {0x3A, "2.3", "FACILITY"}, | ||
5 | {0x3B, "2.4", "REGISTER"}, | ||
6 | {-1, NULL, NULL} | ||
7 | /* Unused sections | ||
8 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-gsm.c b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-gsm.c new file mode 100644 index 0000000..44db64b --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-gsm.c | |||
@@ -0,0 +1,416 @@ | |||
1 | /** | ||
2 | * Simple GSM frame decoder | ||
3 | * wumpus 2003 -- www.blacksphere.tk | ||
4 | */ | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | #include <signal.h> | ||
10 | |||
11 | #include "wmx-util.h" | ||
12 | #include "wmx-gsm.h" | ||
13 | |||
14 | /* Administrative */ | ||
15 | GSMDecoder *GSMDecoder_new() | ||
16 | { | ||
17 | GSMDecoder *self; | ||
18 | |||
19 | self = malloc(sizeof(GSMDecoder)); | ||
20 | self->xmlout = NULL; | ||
21 | |||
22 | return self; | ||
23 | } | ||
24 | |||
25 | /** | ||
26 | * Set 'sniffer' XML output stream | ||
27 | */ | ||
28 | void GSMDecoder_xmlout(GSMDecoder *self, FILE *f) | ||
29 | { | ||
30 | self->xmlout = f; | ||
31 | if(self->xmlout) { | ||
32 | /* Open XML doc */ | ||
33 | fprintf(self->xmlout,"<?xml version=\"1.0\"?>\n"); | ||
34 | fprintf(self->xmlout,"<dump>\n"); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | void GSMDecoder_free(GSMDecoder *self) | ||
39 | { | ||
40 | if(self->xmlout) { | ||
41 | fprintf(self->xmlout,"</dump>\n"); | ||
42 | fclose(self->xmlout); | ||
43 | } | ||
44 | free(self); | ||
45 | } | ||
46 | |||
47 | char *GSM_protocols[]={ | ||
48 | /*0*/ "Group call control", | ||
49 | /*1*/ "Broadcast call control", | ||
50 | /*2*/ "PDSS1", | ||
51 | /*3*/ "Call Control; call related SS messages (TS 24.008)", | ||
52 | /*4*/ "PDSS2", | ||
53 | /*5*/ "Mobility Management messages (TS 24.008)", | ||
54 | /*6*/ "Radio Resources management messages (GSM 04.18)", | ||
55 | /*7*/ "RFU", | ||
56 | /*8*/ "GPRS mobility management messages", | ||
57 | /*9*/ "SMS messages (GSM 04.11)", | ||
58 | /*A*/ "GPRS session management messages", | ||
59 | /*B*/ "Non call related SS messages (GSM 04.80)", | ||
60 | /*C*/ "Location services", | ||
61 | /*D*/ "RFU", | ||
62 | /*E*/ "Reserved for extension of the PD to one octet length", | ||
63 | /*F*/ "Reserved for tests procedures described in GSM 11.10" | ||
64 | }; | ||
65 | |||
66 | typedef struct GSMpackettypestruct { | ||
67 | int id; | ||
68 | char *section; | ||
69 | char *description; | ||
70 | } GSMpackettype; | ||
71 | |||
72 | /* Include the data */ | ||
73 | GSMpackettype GSM_RR_packettypes[] = { | ||
74 | #include "type-rr.h" | ||
75 | }; | ||
76 | GSMpackettype GSM_MM_packettypes[] = { | ||
77 | #include "type-mm.h" | ||
78 | }; | ||
79 | GSMpackettype GSM_CC_packettypes[] = { | ||
80 | #include "type-cc.h" | ||
81 | }; | ||
82 | GSMpackettype GSM_SS_packettypes[] = { | ||
83 | #include "type-ss.h" | ||
84 | }; | ||
85 | GSMpackettype GSM_SMS_packettypes[] = { | ||
86 | #include "type-sms.h" | ||
87 | }; | ||
88 | |||
89 | GSMpackettype *GSMpackettype_lookup(GSMpackettype list[], int id) | ||
90 | { | ||
91 | GSMpackettype *ptr = list; | ||
92 | |||
93 | while(ptr->id != -1 && ptr->id != id) ptr++; | ||
94 | if(ptr->id == -1) { | ||
95 | return NULL; | ||
96 | } else { | ||
97 | return ptr; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | /* disassemble L3 packet -- GSM 04.06 | ||
102 | tx=0 Network to MS | ||
103 | tx=1 MS to Network | ||
104 | */ | ||
105 | void GSMDecoder_L3packet(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length) | ||
106 | { | ||
107 | int proto,type; | ||
108 | GSMpackettype *ptype; | ||
109 | |||
110 | dumpraw("Inform", buffer, length); | ||
111 | printf(" "); | ||
112 | if(length < 2) return; | ||
113 | |||
114 | /* Attempt at decoding first byte | ||
115 | -- protocol discriminator | ||
116 | */ | ||
117 | proto = buffer[0]&0xF; | ||
118 | printf("\n %s ", GSM_protocols[proto]); | ||
119 | |||
120 | switch(proto) { | ||
121 | case 0x3: /* CC */ | ||
122 | type = buffer[1]&0x3F; | ||
123 | ptype = GSMpackettype_lookup(GSM_CC_packettypes, type); | ||
124 | if (ptype == NULL) { | ||
125 | printf("\n Unknown %02X", type); | ||
126 | } else { | ||
127 | printf("\n %s (%s)", ptype->description, ptype->section); | ||
128 | } | ||
129 | break; | ||
130 | case 0x5: /* MM */ | ||
131 | type = buffer[1]&0x3F; | ||
132 | ptype = GSMpackettype_lookup(GSM_MM_packettypes, type); | ||
133 | if (ptype == NULL) { | ||
134 | printf("\n Unknown %02X", type); | ||
135 | } else { | ||
136 | printf("\n %s (%s)", ptype->description, ptype->section); | ||
137 | } | ||
138 | break; | ||
139 | case 0x6: /* RR */ | ||
140 | if (buffer[0]>>4) { | ||
141 | printf("\n RR:Invalid Skip Indicator"); | ||
142 | return; | ||
143 | } | ||
144 | type = buffer[1]; | ||
145 | ptype = GSMpackettype_lookup(GSM_RR_packettypes, type); | ||
146 | if (ptype == NULL) { | ||
147 | printf("\n Unknown %02X", type); | ||
148 | } else { | ||
149 | printf("\n %s (%s)", ptype->description, ptype->section); | ||
150 | } | ||
151 | break; | ||
152 | case 0x9: /* SMS */ | ||
153 | type = buffer[1]&0x3F; | ||
154 | ptype = GSMpackettype_lookup(GSM_SMS_packettypes, type); | ||
155 | if (ptype == NULL) { | ||
156 | printf("\n Unknown %02X", type); | ||
157 | } else { | ||
158 | printf("\n %s (%s)", ptype->description, ptype->section); | ||
159 | } | ||
160 | break; | ||
161 | case 0xB: /* SS */ | ||
162 | if (buffer[1]&0x80) { | ||
163 | printf("\n SS:Invalid Message Type"); | ||
164 | return; | ||
165 | } | ||
166 | type = buffer[1]&0x3F; | ||
167 | ptype = GSMpackettype_lookup(GSM_SS_packettypes, type); | ||
168 | if (ptype == NULL) { | ||
169 | printf("\n Unknown %02X", type); | ||
170 | } else { | ||
171 | printf("\n %s (%s)", ptype->description, ptype->section); | ||
172 | } | ||
173 | break; | ||
174 | } | ||
175 | } | ||
176 | |||
177 | static void GSMDecoder_l1xml_open(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length) | ||
178 | { | ||
179 | unsigned int x; | ||
180 | |||
181 | if(self->xmlout) { | ||
182 | fprintf(self->xmlout, "<l1 "); | ||
183 | fprintf(self->xmlout, "direction=\"%s\" ", l1->tx==GSMDECODER_SEND?"up":"down"); | ||
184 | fprintf(self->xmlout, "logicalchannel=\"%i\" ", l1->ch); | ||
185 | if(l1->tx == GSMDECODER_RECEIVE) { | ||
186 | fprintf(self->xmlout, "physicalchannel=\"%i\" ", l1->arfcn); | ||
187 | fprintf(self->xmlout, "sequence=\"%u\" ", l1->seq); | ||
188 | fprintf(self->xmlout, "error=\"%i\" ", l1->err); | ||
189 | fprintf(self->xmlout, "timeshift=\"%i\" ", l1->timeshift); | ||
190 | fprintf(self->xmlout, "bsic=\"%i\" ", l1->bsic); | ||
191 | fprintf(self->xmlout, "data=\""); | ||
192 | for(x=0; x<length; x++) { | ||
193 | fprintf(self->xmlout, "%02X", buffer[x]); | ||
194 | } | ||
195 | fprintf(self->xmlout, "\" "); | ||
196 | } | ||
197 | fprintf(self->xmlout, ">\n"); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | static void GSMDecoder_l1xml_close(GSMDecoder *self) | ||
202 | { | ||
203 | if(self->xmlout) fprintf(self->xmlout, "</l1>\n"); | ||
204 | } | ||
205 | |||
206 | /* disassemble L2 pseudo length header packet -- GSM 04.06 | ||
207 | tx=0 Network to MS | ||
208 | tx=1 MS to Network | ||
209 | write XML stream | ||
210 | */ | ||
211 | void GSMDecoder_L2short_packet(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length) | ||
212 | { | ||
213 | size_t ptr,usedlength, x; | ||
214 | |||
215 | GSMDecoder_l1xml_open(self, l1, buffer, length); | ||
216 | |||
217 | if(length<1) { | ||
218 | /* too small to contain 1 header byte */ | ||
219 | printf("L2 packet too small\n"); | ||
220 | GSMDecoder_l1xml_close(self); | ||
221 | return; | ||
222 | } | ||
223 | ptr = 0; | ||
224 | //printf("L2 packet\n"); | ||
225 | |||
226 | /* dump Length Indicator field */ | ||
227 | usedlength = buffer[ptr]>>2; | ||
228 | if((buffer[ptr]&3) != 1) { | ||
229 | dumpraw("ErrPacket", buffer, length); | ||
230 | printf(" Invalid pseudo length byte\n"); | ||
231 | GSMDecoder_l1xml_close(self); | ||
232 | return; | ||
233 | } | ||
234 | printf("Length : used=%i ID=%i\n", | ||
235 | usedlength, | ||
236 | (buffer[ptr]>>0)&3); | ||
237 | ptr++; | ||
238 | /* dump Information */ | ||
239 | printf("Inform : "); | ||
240 | if((ptr+usedlength) > length) { | ||
241 | printf("Invalid used length\n"); | ||
242 | } | ||
243 | if(self->xmlout) { | ||
244 | fprintf(self->xmlout, "<l2 "); | ||
245 | fprintf(self->xmlout, "data=\""); | ||
246 | for(x=0; x<usedlength; x++) fprintf(self->xmlout, "%02X", buffer[ptr+x]); | ||
247 | fprintf(self->xmlout, "\" "); | ||
248 | /* Rest octets */ | ||
249 | fprintf(self->xmlout, "rest=\""); | ||
250 | for(x=(ptr+usedlength); x<length; x++) fprintf(self->xmlout, "%02X", buffer[x]); | ||
251 | fprintf(self->xmlout, "\" "); | ||
252 | fprintf(self->xmlout, ">\n"); | ||
253 | } | ||
254 | GSMDecoder_L3packet(self, l1, &buffer[ptr], usedlength); | ||
255 | if(self->xmlout) fprintf(self->xmlout, "</l2>\n"); | ||
256 | //dumpraw("Inform", &buffer[ptr], usedlength); | ||
257 | //printf("\n"); | ||
258 | GSMDecoder_l1xml_close(self); | ||
259 | } | ||
260 | |||
261 | #define TYPE_I 0x01 /* Information */ | ||
262 | #define TYPE_S 0x02 /* Supervisory */ | ||
263 | #define TYPE_U 0x03 /* Unnumbered */ | ||
264 | |||
265 | /* disassemble L2 packet -- GSM 04.06 | ||
266 | tx=0 Network to MS | ||
267 | tx=1 MS to Network | ||
268 | */ | ||
269 | void GSMDecoder_L2packet(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length) | ||
270 | { | ||
271 | size_t ptr,usedlength,x; | ||
272 | int more; | ||
273 | int type; | ||
274 | char temp[80]; | ||
275 | |||
276 | GSMDecoder_l1xml_open(self, l1, buffer, length); | ||
277 | |||
278 | if(length<5) { | ||
279 | /* too small to contain 3 header bytes plus 20 data bytes */ | ||
280 | printf("L2 packet too small\n"); | ||
281 | GSMDecoder_l1xml_close(self); | ||
282 | return; | ||
283 | } | ||
284 | ptr = 0; | ||
285 | //printf("L2 packet\n"); | ||
286 | /* dump Address field */ | ||
287 | printf("Address: LPD=%i SAPI=%i C/R=%i EA=%i\n", | ||
288 | (buffer[ptr]>>5)&3, | ||
289 | (buffer[ptr]>>2)&7, | ||
290 | (buffer[ptr]>>1)&1, | ||
291 | (buffer[ptr]>>0)&1); | ||
292 | /* skip next address field bytes */ | ||
293 | while((buffer[ptr]&1)==0) ptr++; | ||
294 | ptr++; | ||
295 | /* dump Control field */ | ||
296 | |||
297 | type = TYPE_I; | ||
298 | // if(!(buffer[ptr]&1)) type = TYPE_I; | ||
299 | if((buffer[ptr]&1) && !(buffer[ptr]&2)) type = TYPE_S; | ||
300 | if((buffer[ptr]&1) && (buffer[ptr]&2)) type = TYPE_U; | ||
301 | switch(type) { | ||
302 | case TYPE_I: | ||
303 | printf("Control: I TXSeq=%i P=%i RXSeq=%i\n", | ||
304 | (buffer[ptr]>>5)&7, | ||
305 | (buffer[ptr]>>4)&1, | ||
306 | (buffer[ptr]>>1)&7); | ||
307 | break; | ||
308 | case TYPE_S: { | ||
309 | char *desc = "Unknown"; | ||
310 | x = (buffer[ptr]>>2)&3; | ||
311 | switch(x) { | ||
312 | case 0: /* 00 */ desc="RR (Receive Ready)"; break; /* ALSO acknowledgement */ | ||
313 | case 1: /* 01 */ desc="RNR (Receive Not Ready)"; break; | ||
314 | case 2: /* 10 */ desc="REJ (Reject)"; break; | ||
315 | } | ||
316 | printf("Control: S TXSeq=%i P/F=%i S=%i %s\n", | ||
317 | (buffer[ptr]>>5)&7, | ||
318 | (buffer[ptr]>>4)&1, | ||
319 | x, desc); | ||
320 | } break; | ||
321 | case TYPE_U: { | ||
322 | char *desc = "Unknown"; | ||
323 | x = (((buffer[ptr]>>5)&7)<<2) | ((buffer[ptr]>>2)&3); | ||
324 | binstr(temp, x, 5); | ||
325 | switch(x) { | ||
326 | case 0: /* 00000 */ desc = "UI (Unnumbered information)"; break; | ||
327 | case 3: /* 00011 */ desc = "DM (Disconnect mode)"; break; | ||
328 | case 7: /* 00111 */ desc = "SABM (Set asynchronous balanced mode)"; break; | ||
329 | case 8: /* 01000 */ desc = "DISC (Disconnect)"; break; | ||
330 | case 12:/* 01100 */ desc = "UA (Unnumbered acknowledge)"; break; | ||
331 | } | ||
332 | |||
333 | printf("Control: U U=%s %s P/F=%i\n", | ||
334 | temp, desc, | ||
335 | (buffer[ptr]>>4)&1); | ||
336 | } break; | ||
337 | } | ||
338 | ptr++; | ||
339 | /* dump Length Indicator field */ | ||
340 | usedlength = buffer[ptr]>>2; | ||
341 | more = (buffer[ptr]>>1)&1; /* more to go */ | ||
342 | printf("Length : used=%i M=%i EL=%i\n", | ||
343 | usedlength, more, | ||
344 | (buffer[ptr]>>0)&1); | ||
345 | while((buffer[ptr]&1)==0) ptr++; | ||
346 | ptr++; | ||
347 | /* dump Information */ | ||
348 | printf("Inform : "); | ||
349 | if((ptr+usedlength) > length) { | ||
350 | printf("Invalid used length\n"); | ||
351 | } | ||
352 | /* | ||
353 | for(x=0; x<usedlength; x++) { | ||
354 | printf("%02x ",buffer[ptr]); | ||
355 | ptr++; | ||
356 | } | ||
357 | */ | ||
358 | if(self->xmlout) { | ||
359 | char *desc; | ||
360 | fprintf(self->xmlout, "<l2 "); | ||
361 | switch(type) { | ||
362 | case TYPE_I: | ||
363 | fprintf(self->xmlout, "type=\"I\" "); | ||
364 | fprintf(self->xmlout, "txseq=\"%i\" p=\"%i\" rxseq=\"%i\" ", | ||
365 | (buffer[ptr]>>5)&7, | ||
366 | (buffer[ptr]>>4)&1, | ||
367 | (buffer[ptr]>>1)&7); | ||
368 | break; | ||
369 | case TYPE_S: | ||
370 | fprintf(self->xmlout, "type=\"S\" "); | ||
371 | desc = "Unknown"; | ||
372 | x = (buffer[ptr]>>2)&3; | ||
373 | switch(x) { | ||
374 | case 0: /* 00 */ desc="RR"; break; /* ALSO acknowledgement */ | ||
375 | case 1: /* 01 */ desc="RNR"; break; | ||
376 | case 2: /* 10 */ desc="REJ"; break; | ||
377 | } | ||
378 | fprintf(self->xmlout, "subtype=\"%s\" rxseq=\"%i\" p=\"%i\" ", | ||
379 | desc, | ||
380 | (buffer[ptr]>>5)&7, | ||
381 | (buffer[ptr]>>4)&1); | ||
382 | break; | ||
383 | case TYPE_U: | ||
384 | fprintf(self->xmlout, "type=\"U\" "); | ||
385 | desc = "Unknown"; | ||
386 | x = (((buffer[ptr]>>5)&7)<<2) | ((buffer[ptr]>>2)&3); | ||
387 | switch(x) { | ||
388 | case 0: /* 00000 */ desc = "UI"; break; | ||
389 | case 3: /* 00011 */ desc = "DM"; break; | ||
390 | case 7: /* 00111 */ desc = "SABM"; break; | ||
391 | case 8: /* 01000 */ desc = "DISC"; break; | ||
392 | case 12:/* 01100 */ desc = "UA"; break; | ||
393 | } | ||
394 | |||
395 | fprintf(self->xmlout, "subtype=\"%s\" p=\"%i\" ", | ||
396 | desc, | ||
397 | (buffer[ptr]>>4)&1); | ||
398 | break; | ||
399 | default: | ||
400 | fprintf(self->xmlout, "type=\"Unknown\" "); | ||
401 | } | ||
402 | fprintf(self->xmlout, "data=\""); | ||
403 | for(x=0; x<usedlength; x++) fprintf(self->xmlout, "%02X", buffer[ptr+x]); | ||
404 | fprintf(self->xmlout, "\" "); | ||
405 | fprintf(self->xmlout, ">\n"); | ||
406 | } | ||
407 | GSMDecoder_L3packet(self, l1, &buffer[ptr], usedlength); | ||
408 | if(self->xmlout) fprintf(self->xmlout, "</l2>\n"); | ||
409 | GSMDecoder_l1xml_close(self); | ||
410 | //dumpraw("Inform", ); | ||
411 | //printf("\n"); | ||
412 | } | ||
413 | |||
414 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
415 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
416 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-gsm.h b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-gsm.h new file mode 100644 index 0000000..13b9ed8 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-gsm.h | |||
@@ -0,0 +1,41 @@ | |||
1 | #ifndef WMX_GSM_INCLUDED | ||
2 | #define WMX_GSM_INCLUDED | ||
3 | |||
4 | typedef struct GSMDecoder_struct { | ||
5 | FILE *xmlout; | ||
6 | } GSMDecoder; | ||
7 | |||
8 | typedef struct GSMDecoder_l1l2data_struct { | ||
9 | /* 0 receive | ||
10 | 1 send | ||
11 | */ | ||
12 | int tx; | ||
13 | |||
14 | #define GSMDECODER_RECEIVE 0 | ||
15 | #define GSMDECODER_SEND 1 | ||
16 | |||
17 | /* send and receive */ | ||
18 | int ch; /* logical channel */ | ||
19 | |||
20 | /* receive only: */ | ||
21 | int bsic; /* base station identity code */ | ||
22 | int arfcn; /* physical channel */ | ||
23 | int seq; /* sequence number */ | ||
24 | short timeshift;/* diff time with sequence number */ | ||
25 | int err; /* error flag */ | ||
26 | } GSMDecoder_l1l2data; | ||
27 | |||
28 | GSMDecoder *GSMDecoder_new(); | ||
29 | |||
30 | void GSMDecoder_free (GSMDecoder *self); | ||
31 | void GSMDecoder_xmlout (GSMDecoder *self, FILE *f); | ||
32 | |||
33 | void GSMDecoder_L3packet(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length); | ||
34 | void GSMDecoder_L2short_packet(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length); | ||
35 | void GSMDecoder_L2packet(GSMDecoder *self, GSMDecoder_l1l2data *l1, unsigned char *buffer, size_t length); | ||
36 | |||
37 | #endif | ||
38 | |||
39 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
40 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
41 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-list.c b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-list.c new file mode 100644 index 0000000..9af4b48 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-list.c | |||
@@ -0,0 +1,137 @@ | |||
1 | /** | ||
2 | * Decode trace type using text file | ||
3 | * wumpus 2003 -- www.blacksphere.tk | ||
4 | */ | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <string.h> | ||
9 | #include <signal.h> | ||
10 | |||
11 | #include "wmx-util.h" | ||
12 | #include "wmx-list.h" | ||
13 | |||
14 | static void wmx_tracelist_init(struct wmx_tracelist *tl) | ||
15 | { | ||
16 | tl->entries = 0; | ||
17 | tl->max = 10; | ||
18 | tl->records = malloc(tl->max * sizeof(struct wmx_tracetype)); | ||
19 | } | ||
20 | |||
21 | static void wmx_tracelist_add(struct wmx_tracelist *tl, int type, char *desc) | ||
22 | { | ||
23 | /* Possibly expand list */ | ||
24 | if(tl->entries == tl->max) { | ||
25 | tl->max *= 2; | ||
26 | tl->records = realloc(tl->records, tl->max * sizeof(struct wmx_tracetype)); | ||
27 | } | ||
28 | /* Add record */ | ||
29 | tl->records[tl->entries].type = type; | ||
30 | tl->records[tl->entries].desc = strdup(desc); | ||
31 | /* Increase number of entries */ | ||
32 | tl->entries++; | ||
33 | //printf("%04x %04x\n", tl->entries, tl->max); | ||
34 | } | ||
35 | |||
36 | static void wmx_tracelist_free(struct wmx_tracelist *tl) | ||
37 | { | ||
38 | int x; | ||
39 | |||
40 | for(x=0; x<tl->entries; x++) free(tl->records[x].desc); | ||
41 | free(tl->records); | ||
42 | tl->entries = tl->max = 0; | ||
43 | tl->records = NULL; | ||
44 | } | ||
45 | |||
46 | /** Comparision function for bsearch */ | ||
47 | static int compar(const void *a, const void *b) | ||
48 | { | ||
49 | int typea = ((struct wmx_tracetype*)a)->type; | ||
50 | int typeb = ((struct wmx_tracetype*)b)->type; | ||
51 | if(typea < typeb) return -1; | ||
52 | if(typea > typeb) return 1; | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * Look up debug trace type | ||
58 | */ | ||
59 | static struct wmx_tracetype *wmx_tracelist_search(struct wmx_tracelist *tl, int type) | ||
60 | { | ||
61 | /* | ||
62 | int x; | ||
63 | for(x=0; x<tl->entries; x++) | ||
64 | if(tl->records[x].type == type) | ||
65 | return &tl->records[x]; | ||
66 | return NULL; | ||
67 | */ | ||
68 | |||
69 | struct wmx_tracetype key; | ||
70 | |||
71 | key.type = type; | ||
72 | return bsearch(&key, tl->records, tl->entries, sizeof(struct wmx_tracetype), &compar); | ||
73 | } | ||
74 | |||
75 | struct wmx_tracestruct *wmx_tracestruct_load(char *listfile) | ||
76 | { | ||
77 | char data[256]; | ||
78 | FILE *f; | ||
79 | struct wmx_tracestruct *tl; | ||
80 | int tpe; | ||
81 | |||
82 | f = fopen(listfile, "r"); | ||
83 | |||
84 | if(f == NULL) return NULL; | ||
85 | printf("Loading\n"); | ||
86 | |||
87 | tl = malloc(sizeof(struct wmx_tracestruct)); | ||
88 | wmx_tracelist_init(&tl->minors); | ||
89 | wmx_tracelist_init(&tl->majors); | ||
90 | |||
91 | while(fgets(data, sizeof(data), f)) { | ||
92 | int l = strlen(data); | ||
93 | if(l > 0 && data[l-1]=='\n') l--; | ||
94 | data[l] = 0; | ||
95 | if(l < 6) | ||
96 | /* Empty/invalid line */ | ||
97 | continue; | ||
98 | if(data[2] == 'X' && data[3] == 'X') { | ||
99 | sscanf(data, "%02X", &tpe); | ||
100 | wmx_tracelist_add(&tl->majors, tpe, &data[5]); | ||
101 | } else { | ||
102 | sscanf(data, "%04X", &tpe); | ||
103 | wmx_tracelist_add(&tl->minors, tpe, &data[5]); | ||
104 | } | ||
105 | } | ||
106 | fclose(f); | ||
107 | return tl; | ||
108 | } | ||
109 | |||
110 | |||
111 | struct wmx_tracetype *wmx_tracestruct_querymajor(struct wmx_tracestruct * ts, int type) { | ||
112 | return wmx_tracelist_search(&ts->majors, type); | ||
113 | } | ||
114 | |||
115 | struct wmx_tracetype *wmx_tracestruct_queryminor(struct wmx_tracestruct * ts, int type) { | ||
116 | return wmx_tracelist_search(&ts->minors, type); | ||
117 | } | ||
118 | |||
119 | void wmx_tracestruct_free(struct wmx_tracestruct * ts) { | ||
120 | wmx_tracelist_free(&ts->minors); | ||
121 | wmx_tracelist_free(&ts->majors); | ||
122 | free(ts); | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | main() { | ||
127 | int x; | ||
128 | struct wmx_tracestruct * tstruct= wmx_tracestruct_load( | ||
129 | "/home/orion/projects/blacksphere/tables/nhm5_587.txt"); | ||
130 | |||
131 | printf("%s\n", wmx_tracestruct_queryminor(tstruct, 0x1802)->desc); | ||
132 | } | ||
133 | */ | ||
134 | |||
135 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
136 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
137 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-list.h b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-list.h new file mode 100644 index 0000000..1e76af9 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-list.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef WMX_TRACELIST_INCLUDED | ||
2 | #define WMX_TRACELIST_INCLUDED | ||
3 | |||
4 | struct wmx_tracetype { | ||
5 | int type; | ||
6 | char *desc; | ||
7 | }; | ||
8 | |||
9 | struct wmx_tracelist { | ||
10 | int max, entries; | ||
11 | struct wmx_tracetype *records; | ||
12 | }; | ||
13 | |||
14 | struct wmx_tracestruct { | ||
15 | struct wmx_tracelist majors, minors; | ||
16 | }; | ||
17 | |||
18 | struct wmx_tracestruct *wmx_tracestruct_load(char *listfile); | ||
19 | struct wmx_tracetype *wmx_tracestruct_querymajor(struct wmx_tracestruct * ts, int type); | ||
20 | struct wmx_tracetype *wmx_tracestruct_queryminor(struct wmx_tracestruct * ts, int type); | ||
21 | |||
22 | void wmx_tracestruct_free(struct wmx_tracestruct * ts); | ||
23 | |||
24 | #endif | ||
25 | |||
26 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
27 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
28 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-sim.c b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-sim.c new file mode 100644 index 0000000..039d9e9 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-sim.c | |||
@@ -0,0 +1,239 @@ | |||
1 | /** | ||
2 | * SIM packet disassembly functions | ||
3 | * The Monty <monty@technojunkie.gr> | ||
4 | */ | ||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include <string.h> | ||
8 | #include <signal.h> | ||
9 | |||
10 | #include "wmx-util.h" | ||
11 | #include "wmx-sim.h" | ||
12 | |||
13 | /* Disassemble SIM Command packet (0x25) | ||
14 | * -- GSM 11.11 v6.2.0 (1999) | ||
15 | */ | ||
16 | /* vars: | ||
17 | * ins = sim cmd instruction | ||
18 | * type = 0x25 debug subtype | ||
19 | * buffer = sim cmd's parameter 1 (P1) + P2 + P3 + additional data if exist | ||
20 | * (ie select file, additional data is file id) | ||
21 | */ | ||
22 | void simCommand_data(unsigned char ins, unsigned char type, unsigned char *buffer, size_t length) | ||
23 | { | ||
24 | size_t x; | ||
25 | int v=1; // v = verbose (to use or not to use ?) | ||
26 | |||
27 | printf("[a0 %02x ", ins); | ||
28 | for(x=0;x<length;x++) printf("%02x ", buffer[x]); | ||
29 | printf("]\nSim "); | ||
30 | |||
31 | /* This switches type. The below types are known/valid. Since I don't | ||
32 | * know all the types, i've created a switch based on instruction. | ||
33 | */ | ||
34 | /*switch(type) { | ||
35 | case 0x06: | ||
36 | printf("Request Status"); | ||
37 | break; | ||
38 | case 0x07: | ||
39 | printf("Select Command"); | ||
40 | break; | ||
41 | case 0x10: | ||
42 | printf("GetResponse Command\n"); | ||
43 | break; | ||
44 | default: | ||
45 | printf("Unknown Command\n"); | ||
46 | break; | ||
47 | } | ||
48 | */ | ||
49 | |||
50 | /* A switch case based on sim command's instruction */ | ||
51 | switch(ins) { | ||
52 | case 0xa4: | ||
53 | printf("Select Command"); | ||
54 | break; | ||
55 | case 0xf2: | ||
56 | printf("Request Status"); | ||
57 | break; | ||
58 | case 0xb0: | ||
59 | printf("Read Binary"); | ||
60 | break; | ||
61 | case 0xd6: | ||
62 | printf("Update Binary"); | ||
63 | break; | ||
64 | case 0xb2: | ||
65 | printf("Read Record"); | ||
66 | break; | ||
67 | case 0xdc: | ||
68 | printf("Update Record"); | ||
69 | break; | ||
70 | case 0xa2: | ||
71 | printf("Seek cmd"); | ||
72 | break; | ||
73 | case 0x32: | ||
74 | printf("Increase cmd"); | ||
75 | break; | ||
76 | case 0x20: | ||
77 | printf("Verify CHV"); | ||
78 | break; | ||
79 | case 0x24: | ||
80 | printf("Change CHV"); | ||
81 | break; | ||
82 | case 0x26: | ||
83 | printf("Disable CHV"); | ||
84 | break; | ||
85 | case 0x28: | ||
86 | printf("Enable CHV"); | ||
87 | break; | ||
88 | case 0x2c: | ||
89 | printf("Unblock CHV"); | ||
90 | break; | ||
91 | case 0x04: | ||
92 | printf("Invalidate"); | ||
93 | break; | ||
94 | case 0x44: | ||
95 | printf("Rehabilitate"); | ||
96 | break; | ||
97 | case 0x88: | ||
98 | printf("Run GSM Algorithm"); | ||
99 | break; | ||
100 | case 0xfa: | ||
101 | printf("Sleep"); | ||
102 | break; | ||
103 | case 0xc0: | ||
104 | printf("GetResponse Command"); | ||
105 | break; | ||
106 | case 0x10: | ||
107 | printf("Terminal Profile"); | ||
108 | break; | ||
109 | case 0xc2: | ||
110 | printf("Envelope"); | ||
111 | break; | ||
112 | case 0x12: | ||
113 | printf("Fetch"); | ||
114 | break; | ||
115 | case 0x14: | ||
116 | printf("Terminal Response"); | ||
117 | break; | ||
118 | default: | ||
119 | printf("Unknown SIM command "); | ||
120 | printf(" : INS=%02x P1=%02x P2=%02x P3=%02x ", buffer[0], buffer[1], buffer[2], buffer[3]); | ||
121 | printf("\nCommand="); | ||
122 | for(x=0; x<length; x++) printf("%02x ",buffer[x]&0xFF); | ||
123 | printf("\n"); | ||
124 | break; | ||
125 | } | ||
126 | |||
127 | if(v) { | ||
128 | printf(" : INS=%02x P1=%02x P2=%02x P3=%02x ", ins, buffer[0], buffer[1], buffer[2]); | ||
129 | if (ins==0xa4) { | ||
130 | printf(" FileID=%02x%02x",buffer[3], buffer[4]); | ||
131 | } else { | ||
132 | //printf("\n"); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | void simResponse_Process(unsigned char type, unsigned char *buffer, size_t length) | ||
138 | { | ||
139 | size_t x; | ||
140 | // for status process : | ||
141 | int RFU1,mem,fileID,fileT; | ||
142 | int lofd; //length of following data | ||
143 | |||
144 | /* SIM responses to these commands: | ||
145 | - select (for MF/DF files: fileID,memory space available, CHV (en/)disable | ||
146 | indicator, CHV status, GSM specific data. | ||
147 | for EF files: fileID,fileSize,access conditions, valid/invalid | ||
148 | indicator, structure of EF and length of | ||
149 | records if they exist) | ||
150 | - status (fileID,memory space available, CHV en/disable indicator, | ||
151 | CHV status, GSM specific data like select command) | ||
152 | - read binary (string of bytes) | ||
153 | - read record (contents of the record) | ||
154 | - seek (only for seek type 2 response = 1 byte, the record number) | ||
155 | - increase ( etc.. etc.. described in GSM 11.11) | ||
156 | - run gsm algorithm | ||
157 | - get response | ||
158 | - envelope | ||
159 | - fetch | ||
160 | */ | ||
161 | switch(type) { | ||
162 | case 0x02: | ||
163 | printf("(Read Binary) Binary's Data: "); | ||
164 | for(x=0; x<length; x++) printf("%02x ",buffer[x]&0xFF); | ||
165 | //printf("\n"); | ||
166 | break; | ||
167 | case 0x03: | ||
168 | printf("(Read Record) Record's Data:\n"); | ||
169 | for(x=0; x<length; x++) printf("%02x ",buffer[x]&0xFF); | ||
170 | //printf("\n"); | ||
171 | break; | ||
172 | case 0x05: | ||
173 | printf("Get Response Data: "); | ||
174 | for(x=0; x<length; x++) printf("%02x ",buffer[x]&0xFF); | ||
175 | //printf("\n"); | ||
176 | break; | ||
177 | case 0x06: | ||
178 | printf("Status Response : "); | ||
179 | RFU1 = ((buffer[0]&0xFF)<<8)|(buffer[1]&0xFF); | ||
180 | mem = ((buffer[2]&0xFF)<<8)|(buffer[3]&0xFF); | ||
181 | fileID = ((buffer[4]&0xFF)<<8)|(buffer[5]&0xFF); | ||
182 | fileT = (buffer[6]&0xFF); | ||
183 | //RFU2 = (((buffer[7]&0xFF)<<8)|(buffer[8]&0xFF))<<8|(buffe | ||
184 | lofd = (buffer[12]&0xFF); | ||
185 | printf("RFU=%04x, mem=%04x, fileID=%04x,\nfileType=%02x, RFU=%02x%02x%02x%02x%02x, ", | ||
186 | RFU1, mem, fileID, fileT, | ||
187 | buffer[7], buffer[8], buffer[9], buffer[10], buffer[11] // RFU2 | ||
188 | ); // not the proper way ;) | ||
189 | printf("%02x bytes of GSM specific data follows: ", lofd); | ||
190 | |||
191 | /* we could analyze these too but there is no meaning or time */ | ||
192 | for(x=0;x<(unsigned int)lofd;x++) printf("%02x ", buffer[13+x]); | ||
193 | //printf("\n"); | ||
194 | break; | ||
195 | case 0x09: | ||
196 | printf("Select Response"); | ||
197 | // select response always has 00 bytes length | ||
198 | break; | ||
199 | default: | ||
200 | printf("Unknown SIM Response : "); | ||
201 | for(x=0; x<length; x++) printf("%02x ",buffer[x]&0xFF); | ||
202 | //printf("\n"); | ||
203 | break; | ||
204 | } | ||
205 | } | ||
206 | |||
207 | void simAnswer_Process(unsigned char type, unsigned char *buffer, size_t length) | ||
208 | { | ||
209 | size_t x; | ||
210 | |||
211 | switch(type) { | ||
212 | case 0x00: | ||
213 | /* in some sim commands (i.e. status or read record) the answer | ||
214 | * is more than 2 bytes. we could analyse all the bytes but the | ||
215 | * usefull ones are only the last 2 of them. | ||
216 | * Should we make a switch() for the answer or would it be | ||
217 | * too much?? | ||
218 | */ | ||
219 | printf("SIM answer: "); | ||
220 | for(x=length-2;x<length;x++) printf("%02x ", buffer[x]&0xFF); | ||
221 | //printf("\n"); | ||
222 | break; | ||
223 | case 0x01: | ||
224 | /* 0x25XX sim command. I don't know why they re-write/send the command :-\ | ||
225 | for(x=0;x<length;x++) printf("%02x ", buffer[x]&0xFF); | ||
226 | printf("\n"); | ||
227 | */ | ||
228 | break; | ||
229 | default: | ||
230 | printf("Uknown subtype! dumping data: "); | ||
231 | for(x=0;x<length;x++) printf("%02x ", buffer[x]&0xFF); | ||
232 | //printf("\n"); | ||
233 | break; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
238 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
239 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-sim.h b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-sim.h new file mode 100644 index 0000000..c42bd5b --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-sim.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef WMX_SIM | ||
2 | |||
3 | #define WMX_SIM | ||
4 | |||
5 | void simCommand_data(unsigned char ins, unsigned char type, unsigned char *buffer, size_t length); | ||
6 | void simResponse_Process(unsigned char type, unsigned char *buffer, size_t length); | ||
7 | void simAnswer_Process(unsigned char type, unsigned char *buffer, size_t length); | ||
8 | |||
9 | #endif | ||
10 | |||
11 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
12 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
13 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-util.c b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-util.c new file mode 100644 index 0000000..f5e7c9f --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-util.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /** | ||
2 | * Generic utils | ||
3 | * wumpus 2003 -- www.blacksphere.tk | ||
4 | */ | ||
5 | |||
6 | #include <stdio.h> | ||
7 | #include <string.h> | ||
8 | #include <signal.h> | ||
9 | |||
10 | #include "wmx-util.h" | ||
11 | |||
12 | /** | ||
13 | * Dump raw hex | ||
14 | */ | ||
15 | void dumpraw(char *str, unsigned char *buffer, size_t length) | ||
16 | { | ||
17 | size_t x; | ||
18 | |||
19 | printf("["); | ||
20 | for(x=0; x<length; x++) { | ||
21 | if(x != (length-1)) { | ||
22 | printf("%02x ",buffer[x]); | ||
23 | } else { | ||
24 | printf("%02x",buffer[x]); | ||
25 | } | ||
26 | } | ||
27 | printf("]"); | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * Integer to binary | ||
32 | */ | ||
33 | void binstr(char *dest, unsigned int value, int len) | ||
34 | { | ||
35 | int x; | ||
36 | |||
37 | for(x=len-1; x>=0; x--) { | ||
38 | dest[x] = '0' + (value & 1); | ||
39 | value >>= 1; | ||
40 | } | ||
41 | dest[len] = 0; | ||
42 | } | ||
43 | |||
44 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
45 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
46 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx-util.h b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-util.h new file mode 100644 index 0000000..8c15df0 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx-util.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef WMX_UTIL_INCLUDED | ||
2 | #define WMX_UTIL_INCLUDED | ||
3 | |||
4 | void dumpraw(char *str, unsigned char *buffer, size_t length); | ||
5 | void binstr(char *dest, unsigned int value, int len); | ||
6 | |||
7 | #endif | ||
8 | |||
9 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
10 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
11 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c b/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c new file mode 100644 index 0000000..64eda37 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c | |||
@@ -0,0 +1,480 @@ | |||
1 | /** | ||
2 | * Nokia DCT3 Firmware Debug Trace Monitor | ||
3 | * wumpus 2003 -- www.blacksphere.tk | ||
4 | * SIM stuff by The Monty | ||
5 | * | ||
6 | * Command line arguments: | ||
7 | * gammu --nokiadebug v00-0F,20,21 | ||
8 | * (v=verbose) | ||
9 | */ | ||
10 | |||
11 | #include "../../../../common/gsmstate.h" | ||
12 | |||
13 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
14 | |||
15 | #include <string.h> | ||
16 | #include <signal.h> | ||
17 | |||
18 | #include "../../../../common/misc/coding/coding.h" | ||
19 | #include "../../../../common/gsmcomon.h" | ||
20 | #include "../../../../common/gsmstate.h" | ||
21 | #include "../../../../common/service/gsmpbk.h" | ||
22 | #include "../../../../common/phone/nokia/dct3/dct3func.h" | ||
23 | #include "../../../gammu.h" | ||
24 | #include "../dct3.h" | ||
25 | #include "wmx.h" | ||
26 | #include "wmx-util.h" | ||
27 | #include "wmx-gsm.h" | ||
28 | #include "wmx-sim.h" | ||
29 | #include "wmx-list.h" | ||
30 | |||
31 | extern GSM_Reply_Function UserReplyFunctionsX[]; | ||
32 | |||
33 | /* Global variables suck */ | ||
34 | GSMDecoder *gsmdec; | ||
35 | struct wmx_tracestruct *traces; | ||
36 | |||
37 | static GSM_Error DCT3_ReplySwitchDebug(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
38 | { | ||
39 | switch(msg.Buffer[2]) { | ||
40 | case 0x70: | ||
41 | printf("Debug Trace Enabled\n"); | ||
42 | break; | ||
43 | case 0x71: | ||
44 | printf("Debug Trace Disabled\n"); | ||
45 | break; | ||
46 | } | ||
47 | return ERR_NONE; | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * RPC confirmation/reply | ||
52 | */ | ||
53 | static GSM_Error DCT3_ReplyRPC(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
54 | { | ||
55 | printf("RPC Reply "); | ||
56 | printf("call=%02x rettype=%02x data=", msg.Buffer[2], msg.Buffer[3]); | ||
57 | if(msg.Buffer[3] == 3) { | ||
58 | /* string */ | ||
59 | printf("%s", &msg.Buffer[4]); | ||
60 | } else { | ||
61 | dumpraw("RPC Reply data", &msg.Buffer[4], msg.Length-4); | ||
62 | } | ||
63 | printf("\n"); | ||
64 | return ERR_NONE; | ||
65 | } | ||
66 | |||
67 | /* disassemble mdisnd (0x18xx) packet */ | ||
68 | static void mdisnd_data(unsigned char type, unsigned char *buffer, size_t length) | ||
69 | { | ||
70 | GSMDecoder_l1l2data dat; | ||
71 | size_t x; | ||
72 | int ch; | ||
73 | |||
74 | if(type==0x1B && length>2) { | ||
75 | /* channel packet */ | ||
76 | ch = buffer[1]; | ||
77 | dat.tx = GSMDECODER_SEND; | ||
78 | dat.ch = ch; | ||
79 | printf("%02X ch=%02X ",buffer[0],ch); | ||
80 | if (ch == 0x80 || ch == 0xB0) { | ||
81 | printf("\n"); | ||
82 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[2], length-2); | ||
83 | } else if (ch == 0x70) { | ||
84 | dumpraw("MDI send ch70 prefix", &buffer[2], 2); | ||
85 | printf("\n"); | ||
86 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[4], length-4); | ||
87 | } else { | ||
88 | dumpraw("MDI recv 1B packet", &buffer[2], length-2); | ||
89 | } | ||
90 | } else { | ||
91 | /* hex */ | ||
92 | for(x=0; x<length; x++) { | ||
93 | printf("%02x ",buffer[x]&0xFF); | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /* disassemble mdircv (0x19xx) packet */ | ||
99 | static void mdircv_data(unsigned char type, unsigned char *buffer, size_t length) | ||
100 | { | ||
101 | size_t x; | ||
102 | int ch; | ||
103 | GSMDecoder_l1l2data dat; | ||
104 | |||
105 | if (type==0x80 && length>1) { | ||
106 | // buffer[0] channel | ||
107 | // buffer[1] flag1 | ||
108 | // buffer[2] flag2 | ||
109 | // buffer[3..5] timestamp | ||
110 | // buffer[6..7] unknown_hw1 | ||
111 | // buffer[8..9] unknown_hw2 | ||
112 | ch = buffer[0]; | ||
113 | dat.tx = GSMDECODER_RECEIVE; | ||
114 | dat.ch = ch; | ||
115 | dat.bsic = buffer[1]; | ||
116 | dat.err = buffer[2]; | ||
117 | dat.seq = (buffer[3]<<16)|(buffer[4]<<8)|(buffer[5]); | ||
118 | dat.arfcn = (buffer[6]<<8)|buffer[7]; | ||
119 | dat.timeshift = (buffer[8]<<8)|buffer[9]; | ||
120 | |||
121 | printf("ch=%02X bsic=%i err=%i t=%06X arfcn=%i shift=%i", | ||
122 | ch, buffer[1], buffer[2], | ||
123 | dat.seq, dat.arfcn, dat.timeshift | ||
124 | ); | ||
125 | |||
126 | //dumpraw("MDI recv 80 header", &buffer[6], 4); | ||
127 | printf(" "); | ||
128 | if(buffer[2] == 0) { /* unencrypted */ | ||
129 | if(ch == 0x70) { | ||
130 | /* Normal header + 2b prefix */ | ||
131 | dumpraw("MDI recv ch70 prefix", &buffer[10], 2); | ||
132 | printf("\n"); | ||
133 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[12], length-12); | ||
134 | } else if (ch == 0x80 || ch == 0xB0) { | ||
135 | /* Normal header */ | ||
136 | printf("\n"); | ||
137 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[10], length-10); | ||
138 | } else if (ch == 0x50 || ch == 0x60) { | ||
139 | /* Short header */ | ||
140 | |||
141 | printf("\n"); | ||
142 | GSMDecoder_L2short_packet(gsmdec, &dat, &buffer[10], length-10); | ||
143 | } else { | ||
144 | dumpraw("MDI send 80 packet", &buffer[10], length-10); | ||
145 | } | ||
146 | } else { | ||
147 | /* Encrypted (?) */ | ||
148 | dumpraw("MDI send err 80", &buffer[10], length-10); | ||
149 | } | ||
150 | } else { | ||
151 | /* hex */ | ||
152 | for(x=0; x<length; x++) { | ||
153 | printf("%02x ",buffer[x]&0xFF); | ||
154 | } | ||
155 | } | ||
156 | } | ||
157 | |||
158 | static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
159 | { | ||
160 | int x; | ||
161 | int id,timestamp,number,length; | ||
162 | struct wmx_tracetype *minor; | ||
163 | char *desc; | ||
164 | |||
165 | //printf("Debug Trace Received\n"); | ||
166 | /* parse frame | ||
167 | Debug trace packet: | ||
168 | packet type 0x00 | ||
169 | source subsystem 0x01 (LOCAL) | ||
170 | verder formaat zie notebook | ||
171 | 0x08 ID (payload=offset 0x02 here) | ||
172 | 0x0A timestamp | ||
173 | 0x0C seq nr | ||
174 | 0x0D .. parameters | ||
175 | */ | ||
176 | id = ((msg.Buffer[2]&0xFF)<<8)|(msg.Buffer[3]&0xFF); | ||
177 | timestamp = ((msg.Buffer[4]&0xFF)<<8)|(msg.Buffer[5]&0xFF); | ||
178 | number = msg.Buffer[6]&0xFF; | ||
179 | length = msg.Buffer[7]&0xFF; | ||
180 | |||
181 | /* filter */ | ||
182 | //if((id&0xFF00)==0x1900 && id != 0x1980) | ||
183 | //return GE_NONE; | ||
184 | //printf("%02x\n",msg.Buffer[10]); | ||
185 | //if(msg.Buffer[10]!=0x40) | ||
186 | //return GE_NONE; | ||
187 | /* Query trace type name */ | ||
188 | desc = "Unknown"; | ||
189 | if(traces != NULL) { | ||
190 | minor = wmx_tracestruct_queryminor(traces, id); | ||
191 | if(minor != NULL) desc = minor->desc; | ||
192 | } | ||
193 | printf("<%04X> %s\n", id, desc); | ||
194 | printf("t=%04x nr=%02x: ", timestamp, number); | ||
195 | |||
196 | /* TODO -- decode debug types on phone type */ | ||
197 | switch(id>>8) { | ||
198 | case 0x33: | ||
199 | case 0x34: | ||
200 | case 0x35: | ||
201 | case 0x37: | ||
202 | case 0x38: | ||
203 | case 0x39: | ||
204 | case 0x3A: | ||
205 | case 0x3B: | ||
206 | case 0x3C: | ||
207 | case 0x5F: | ||
208 | /* text */ | ||
209 | /* skip length byte */ | ||
210 | printf("\""); | ||
211 | for(x=8; x<msg.Length; x++) { | ||
212 | printf("%c",msg.Buffer[x]&0xFF); | ||
213 | } | ||
214 | printf("\""); | ||
215 | break; | ||
216 | /* | ||
217 | case 0x6801: | ||
218 | for(x=8; x<msg.Length; x++) { | ||
219 | printf("%02x%c ",msg.Buffer[x]&0xFF,msg.Buffer[x]&0xFF); | ||
220 | } | ||
221 | break; | ||
222 | */ | ||
223 | case 0x18: /* MDISND */ | ||
224 | |||
225 | /* skip these: | ||
226 | +00 length | ||
227 | +01 type (also xx in 0x18xx) | ||
228 | */ | ||
229 | if(msg.Length<10 || msg.Buffer[9]!=(id&0xFF)) { | ||
230 | printf("C %02X: param:%02x", id&0xFF, msg.Buffer[8]); | ||
231 | } else { | ||
232 | //printf("D %02X: ", id&0xFF); | ||
233 | printf("D %02X: ", id&0xFF); | ||
234 | mdisnd_data((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[10], msg.Length-10); | ||
235 | } | ||
236 | break; | ||
237 | case 0x19: /* MDIRCV */ | ||
238 | if(msg.Length<10 || msg.Buffer[9]!=(id&0xFF)) { | ||
239 | printf("C %02X: param:%02x", id&0xFF, msg.Buffer[8]); | ||
240 | } else { | ||
241 | printf("D %02X: ", id&0xFF); | ||
242 | mdircv_data((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[10], msg.Length-10); | ||
243 | //dumpraw((unsigned char*)&msg.Buffer[10], msg.Length-10); | ||
244 | } | ||
245 | break; | ||
246 | case 0x20: /* 0x25 SIM commands */ | ||
247 | /* | ||
248 | for(x=8;x<msg.Length;x++) | ||
249 | printf("%02x ", msg.Buffer[x]&0xFF); | ||
250 | */ | ||
251 | printf("SIM command "); | ||
252 | if(msg.Buffer[8]==0xa0) { // check if valid (class=a0) | ||
253 | simCommand_data(msg.Buffer[9], (unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[10], msg.Length-10); | ||
254 | // TODO: pass the msg.Buffer[9] and skip 1rst arg | ||
255 | } else { | ||
256 | printf("Unknown 0x25 packet (NOT SIM cmd): "); | ||
257 | for(x=8;x<msg.Length;x++) printf("%02x ", msg.Buffer[x]&0xFF); | ||
258 | printf("\n"); | ||
259 | } | ||
260 | break; | ||
261 | case 0x22: /* 0x27 SIM answer to command (error/ok/etc..) */ | ||
262 | if(msg.Length<10) { | ||
263 | // Unknown response | ||
264 | for(x=0;x<msg.Length-10;x++) printf("%02x ", msg.Buffer[x]&0xFF); | ||
265 | printf(" (Unknown 0x27 packet ? ? )\n"); | ||
266 | } else { | ||
267 | simAnswer_Process((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[8], length); | ||
268 | } | ||
269 | break; | ||
270 | case 0x23: /* 0x28 SIM response data to commands */ | ||
271 | if(msg.Length<10) { | ||
272 | // Unknown response | ||
273 | for(x=0;x<msg.Length-10;x++) printf("%02x ", msg.Buffer[x]&0xFF); | ||
274 | printf(" (Unknown 0x28 packet)\n"); | ||
275 | } else { | ||
276 | simResponse_Process((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[8], length); | ||
277 | } | ||
278 | break; | ||
279 | default: | ||
280 | /* hex */ | ||
281 | for(x=8; x<msg.Length; x++) { | ||
282 | printf("%02x ",msg.Buffer[x]&0xFF); | ||
283 | } | ||
284 | break; | ||
285 | } | ||
286 | printf("\n"); | ||
287 | return ERR_NONE; | ||
288 | } | ||
289 | |||
290 | |||
291 | static GSM_Error DCT3_ReplyMyPacket(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
292 | { | ||
293 | int x; | ||
294 | |||
295 | printf("MyPacket "); | ||
296 | for(x=0; x<msg.Length; x++) { | ||
297 | printf("%02x ",msg.Buffer[x]&0xFF); | ||
298 | } | ||
299 | printf("\n"); | ||
300 | return ERR_NONE; | ||
301 | } | ||
302 | |||
303 | #define ID_DebugTrace 0x666 | ||
304 | #define ID_DebugSwitch 0x667 | ||
305 | #define ID_RPC 0x668 | ||
306 | |||
307 | void DCT3SetDebug(int argc, char *argv[]) | ||
308 | { | ||
309 | int x,count; | ||
310 | unsigned int y; | ||
311 | unsigned char reqDisable[] = {0x01, 0x01, 0x71}; | ||
312 | // unsigned char reqTest[] = {0x01, 0x01, 0x96, 0xFF, 0xFF}; | ||
313 | |||
314 | /* RPC testing packets: */ | ||
315 | |||
316 | /* RPC: Get version */ | ||
317 | //unsigned char reqTest2[] = {0x01, 0x01, 0x00, 0x03, 0x00}; | ||
318 | /* RPC: read I/O 0x6D mask 0xFF */ | ||
319 | //unsigned char reqTest2[] = {0x01, 0x01, 0x02, 0x01, 0x02, 0x6D, 0xFF}; /* */ | ||
320 | /* RPC: write I/O 0x03 mask 0xFF value 0x31 */ | ||
321 | //unsigned char reqTest2[] = {0x01, 0x01, 0x01, 0x01, 0x07, 0x03, 0xFF, 0x31}; /* write I/O */ | ||
322 | |||
323 | /* RPC: write forged FBUS packet to MDISND */ | ||
324 | // unsigned char reqTest2[] = {0x01, 0x01, 0x16, 0x01, 0x06, | ||
325 | //0x14, // R0 -- length | ||
326 | //0x05, // R1 -- MDI type identifier 0x05(FBUS) | ||
327 | //0x1e, 0x0c, 0x00, 0x66, | ||
328 | //0x00, 0x0e, 0x01, 0x01, | ||
329 | //0x66, 0x55, 0x44, 0x33, | ||
330 | //0x0d, 0x01, 0x01, 0x01, | ||
331 | //0x1b, 0x58, 0x01, 0x44}; | ||
332 | //1805 t=cb37 nr=e2 :D 05: | ||
333 | |||
334 | /* debug enable packet */ | ||
335 | unsigned char reqEnable[] = { | ||
336 | 0x00, 0x01, 0x70, | ||
337 | /* Debug bits | ||
338 | byte[bit>>3]&(1<<(7-(bit&7))) | ||
339 | */ | ||
340 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00 */ | ||
341 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40 */ | ||
342 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80 */ | ||
343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xC0 */ | ||
344 | /* Debug verbose bits | ||
345 | byte[bit>>3]&(1<<(7-(bit&7))) | ||
346 | */ | ||
347 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
348 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
349 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
350 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
351 | }; | ||
352 | |||
353 | #define ENABLE_BIT(bit,verbose) reqEnable[3 + (bit>>3)] |= 1<<(7-(bit&7)); if(verbose){reqEnable[3 + 32 + (bit>>3)] |= 1<<(7-(bit&7));} | ||
354 | |||
355 | /* Enable some bit | ||
356 | TODO command line or GUI interface | ||
357 | */ | ||
358 | //ENABLE_BIT(0x18, 1);/* Enable MDISND debugging */ | ||
359 | //ENABLE_BIT(0x19, 1);/* Enable MDIRCV debugging */ | ||
360 | //ENABLE_BIT(0x31, 1); | ||
361 | |||
362 | gsmdec = GSMDecoder_new(); | ||
363 | /* Open XML file .. needs to be argument */ | ||
364 | { | ||
365 | FILE *xout = fopen("out.xml", "w"); | ||
366 | GSMDecoder_xmlout(gsmdec, xout); | ||
367 | } | ||
368 | printf("Debug Trace Mode -- wumpus 2003\n"); | ||
369 | traces = wmx_tracestruct_load(argv[2]); | ||
370 | if(traces == NULL) | ||
371 | printf("Warning: could not load trace description file %s\n", argv[2]); | ||
372 | printf("Activating ranges:\n"); | ||
373 | count = 0; | ||
374 | for(x=3; x<argc; x++) { | ||
375 | char *ptr = argv[x]; | ||
376 | unsigned from,to,verbose; | ||
377 | |||
378 | while(*ptr) { | ||
379 | verbose = 0; | ||
380 | if(*ptr == 'v') { | ||
381 | verbose = 1; | ||
382 | ptr++; | ||
383 | } | ||
384 | to = from = strtol(ptr, &ptr, 16); | ||
385 | if(*ptr == '-') { | ||
386 | ptr ++; | ||
387 | to = strtol(ptr, &ptr, 16); | ||
388 | } | ||
389 | if(*ptr != ',' && *ptr != 0) { | ||
390 | printf("Invalid parameter '%s'\n", argv[x]); | ||
391 | return; | ||
392 | } | ||
393 | if(*ptr == ',') | ||
394 | ptr++; | ||
395 | if(from > 0xFF) from=0xFF; | ||
396 | if(to > 0xFF) to=0xFF; | ||
397 | printf(" %02x-%02x verbose=%i\n",from,to,verbose); | ||
398 | for(y=from; y<=to; y++) { | ||
399 | ENABLE_BIT(y, verbose); | ||
400 | count++; | ||
401 | } | ||
402 | } | ||
403 | } | ||
404 | if(count == 0) { | ||
405 | printf("Nothing activated -- bailing out\n"); | ||
406 | return; | ||
407 | } | ||
408 | //ENABLE_BIT(0x20, 1); /* SIM commands (literal) */ | ||
409 | //ENABLE_BIT(0x21, 1); /* SIML2 commands (literal) */ | ||
410 | //ENABLE_BIT(0x22, 1); /* SIM commands (literal) */ | ||
411 | //ENABLE_BIT(0x3B, 1);/* PHCTRL state */ | ||
412 | |||
413 | GSM_Init(true); | ||
414 | |||
415 | /* We Need DCT3 */ | ||
416 | if (CheckDCT3Only()!=ERR_NONE) return; | ||
417 | |||
418 | error=DCT3_EnableSecurity (&s, 0x01); | ||
419 | Print_Error(error); | ||
420 | |||
421 | s.User.UserReplyFunctions=UserReplyFunctionsX; | ||
422 | |||
423 | //error=GSM_WaitFor (&s, reqTest, sizeof(reqTest), 0x40, 1, ID_DebugSwitch); | ||
424 | |||
425 | //error=GSM_WaitFor (&s, reqTest2, sizeof(reqTest2), 0xD1, 4, ID_RPC); | ||
426 | |||
427 | /* Enable Debug Mode */ | ||
428 | error=GSM_WaitFor (&s, reqEnable, sizeof(reqEnable), 0x40, 4, ID_DebugSwitch); | ||
429 | |||
430 | Print_Error(error); | ||
431 | signal(SIGINT, interrupt); | ||
432 | printf("Press Ctrl+C to interrupt...\n"); | ||
433 | x=0; | ||
434 | |||
435 | /* | ||
436 | while(x<100) { | ||
437 | //printf(": %02x\n",x); | ||
438 | s.Phone.Data.RequestID= ID_DebugTrace; | ||
439 | res = s.Device.Functions->ReadDevice(&s, buff, 255); | ||
440 | if(res) { | ||
441 | printf("%02x\n",x); | ||
442 | for(y=0;y<res;y++) { | ||
443 | //printf("%02x\n",x,buff[y]&0xFF); | ||
444 | s.Protocol.Functions->StateMachine(&s,buff[y]); | ||
445 | x++; | ||
446 | } | ||
447 | } | ||
448 | } | ||
449 | */ | ||
450 | ; | ||
451 | |||
452 | /* todo: wait and dump for some time */ | ||
453 | while (!gshutdown) { | ||
454 | GSM_ReadDevice(&s,true); | ||
455 | my_sleep(10); | ||
456 | } | ||
457 | signal(SIGINT, SIG_DFL); | ||
458 | printf("Disabling\n"); | ||
459 | error=GSM_WaitFor (&s, reqDisable, sizeof(reqDisable), 0x40, 10, ID_DebugSwitch); | ||
460 | Print_Error(error); | ||
461 | |||
462 | GSMDecoder_free(gsmdec); | ||
463 | } | ||
464 | |||
465 | static GSM_Reply_Function UserReplyFunctionsX[] = { | ||
466 | {DCT3_ReplySwitchDebug, "\x40",0x02,0x70,ID_DebugSwitch }, | ||
467 | {DCT3_ReplySwitchDebug, "\x40",0x02,0x71,ID_DebugSwitch }, | ||
468 | {DCT3_ReplyDebugTrace, "\x00",0x00,0x00,ID_IncomingFrame}, | ||
469 | {DCT3_ReplyMyPacket, "\x40",0x00,0x00,ID_IncomingFrame}, | ||
470 | |||
471 | {DCT3_ReplyRPC, "\xD2",0x00,0x00,ID_RPC }, | ||
472 | |||
473 | {NULL, "\x00",0x00,0x00,ID_None } | ||
474 | }; | ||
475 | |||
476 | #endif | ||
477 | |||
478 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
479 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
480 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx.h b/gammu/emb/gammu/depend/nokia/dct3trac/wmx.h new file mode 100644 index 0000000..76fb394 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx.h | |||
@@ -0,0 +1,5 @@ | |||
1 | void DCT3SetDebug(int argc, char *argv[]); | ||
2 | |||
3 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
4 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
5 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct4.c b/gammu/emb/gammu/depend/nokia/dct4.c new file mode 100644 index 0000000..f4ed305 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct4.c | |||
@@ -0,0 +1,1341 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | ||
2 | |||
3 | #include "../../../common/gsmstate.h" | ||
4 | |||
5 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
6 | |||
7 | #include <string.h> | ||
8 | |||
9 | #include "dct4.h" | ||
10 | #include "../../gammu.h" | ||
11 | #include "../../../common/phone/pfunc.h" | ||
12 | #include "../../../common/phone/nokia/nfunc.h" | ||
13 | #include "../../../common/phone/nokia/dct4/dct4func.h" | ||
14 | #include "../../../common/misc/coding/coding.h" | ||
15 | |||
16 | extern GSM_Reply_Function UserReplyFunctions4[]; | ||
17 | |||
18 | /* ------- some usefull functions ----------------------------------------- */ | ||
19 | |||
20 | GSM_Error CheckDCT4Only() | ||
21 | { | ||
22 | bool found = false; | ||
23 | |||
24 | /* Checking if phone is DCT4 */ | ||
25 | #ifdef GSM_ENABLE_NOKIA3650 | ||
26 | if (strstr(N3650Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | ||
27 | #endif | ||
28 | #ifdef GSM_ENABLE_NOKIA6510 | ||
29 | if (strstr(N6510Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | ||
30 | #endif | ||
31 | #ifdef GSM_ENABLE_NOKIA3320 | ||
32 | if (strstr(N3320Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | ||
33 | #endif | ||
34 | if (!found) return ERR_NOTSUPPORTED; | ||
35 | |||
36 | if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && | ||
37 | s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_PHONETBLUE && | ||
38 | s.ConnectionType!=GCT_IRDAPHONET && s.ConnectionType!=GCT_BLUEPHONET) { | ||
39 | return ERR_OTHERCONNECTIONREQUIRED; | ||
40 | } | ||
41 | return ERR_NONE; | ||
42 | } | ||
43 | |||
44 | static void CheckDCT4() | ||
45 | { | ||
46 | GSM_Error error; | ||
47 | |||
48 | error = CheckDCT4Only(); | ||
49 | switch (error) { | ||
50 | case ERR_NOTSUPPORTED: | ||
51 | Print_Error(ERR_NOTSUPPORTED); | ||
52 | break; | ||
53 | case ERR_OTHERCONNECTIONREQUIRED: | ||
54 | printf("Can't do it with current phone protocol\n"); | ||
55 | GSM_TerminateConnection(&s); | ||
56 | exit(-1); | ||
57 | default: | ||
58 | break; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | static bool answer_yes2(char *text) | ||
63 | { | ||
64 | int len; | ||
65 | char ans[99]; | ||
66 | |||
67 | while (1) { | ||
68 | printf("%s (yes/no) ? ",text); | ||
69 | len=GetLine(stdin, ans, 99); | ||
70 | if (len==-1) exit(-1); | ||
71 | if (mystrncasecmp(ans, "yes",0)) return true; | ||
72 | if (mystrncasecmp(ans, "no" ,0)) return false; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | /* ------------------- functions ------------------------------------------- */ | ||
77 | |||
78 | static DCT4_Feature DCT4Features[] = { | ||
79 | {DCT4_ALWAYS_ONLINE, "GPRS Always Online", {{0,"on (Context)"},{1,"off (Attach)"},{0,""}}},///?? | ||
80 | {DCT4_GPRS_PCCH, "PCCH support for GPRS", {{1,"on"},{0,"off"},{0,""}}}, | ||
81 | {DCT4_GEA1, "GEA1 support indication", {{1,"on"},{0,"off"},{0,""}}}, | ||
82 | {DCT4_EOTD, "EOTD support", {{1,"on"},{0,"off"},{0,""}}}, | ||
83 | {DCT4_WAP_PUSH, "WAP push", {{1,"on"},{0,"off"},{0,""}}}, | ||
84 | {DCT4_USE_PREF_SIM_NET, "Use SIM preffered network list",{{1,"on"},{0,"off"},{0,""}}}, | ||
85 | {DCT4_JAVA_TCK, "Java TCK support", {{1,"on"},{0,"off"},{0,""}}}, | ||
86 | |||
87 | {DCT4_ALS, "Alternate Line Service (ALS)", {{1,"on"},{0,"off"},{0,""}}}, | ||
88 | {DCT4_A52, "Ciphering alghoritm A52", {{1,"on"},{0,"off"},{0,""}}}, | ||
89 | {DCT4_CSP, "Customer Service Profile", {{0,"off"},{1,"on"},{0,""}}}, | ||
90 | {DCT4_EONS, "EONS support", {{1,"on"},{0,"off"},{0,""}}}, | ||
91 | {DCT4_3GINDICATOR, "3G indicator", {{1,"on"},{0,"off"},{0,""}}}, | ||
92 | {DCT4_DISPLAY_PHONE_NAME, "Display both number and name for incoming calls",{{1,"on"},{0,"off"},{0,""}}}, | ||
93 | {DCT4_DISPLAY_WAP_PROFILE, "Display selected WAP profile name instead of Home option menu in Services",{{1,"on"},{0,"off"},{0,""}}}, | ||
94 | |||
95 | {DCT4_GAMES_WAP_DOWNLOAD, "Games WAP download", {{1,"on"},{0,"off"},{0,""}}}, | ||
96 | {DCT4_GAMES_SCORE_SEND, "Games WAP score send", {{1,"on"},{0,"off"},{0,""}}}, | ||
97 | {DCT4_GAMES_URL_CHECK, "Games URL check", {{1,"on"},{0,"off"},{0,""}}}, | ||
98 | |||
99 | {DCT4_BLUETOOTH_MENU, "Bluetooth menu", {{1,"on"},{0,"off"},{0,""}}}, | ||
100 | {DCT4_WAP_BOOKMARKS_MENU, "Bookmarks menu in Services", {{1,"on"},{0,"off"},{0,""}}}, | ||
101 | {DCT4_WAP_BOOKMARKS_MENU2, "Bookmarks menu in Services", {{3,"bookmarks & download"},{0,"off"},{0,""}}}, | ||
102 | {DCT4_WAP_GOTO_MENU, "GoTo menu in Services", {{0,"on"},{1,"off"},{0,""}}}, | ||
103 | {DCT4_WAP_SETTINGS_MENU, "Profiles menu in Services", {{0,"on"},{1,"off"},{0,""}}}, | ||
104 | {DCT4_SERVICES_GAMES_APP_GALLERY,"Services menu in Games/Apps/Gallery",{{1,"on"},{0,"off"},{0,""}}}, | ||
105 | {DCT4_JAVA_GAMES_MENU, "Java games menu in Games", {{1,"on"},{0,"off"},{0,""}}}, | ||
106 | {DCT4_SAT_CONFIRM_MENU, "Can use confirming SIM service actions", {{1,"on"},{0,"off"},{0,""}}}, | ||
107 | {DCT4_INSTANT_MESS_MENU, "Instant Messaging in Messages",{{1,"on"},{0,"off"},{0,""}}}, | ||
108 | {DCT4_CONFIRM_ALS, "Confirm using ALS", {{1,"on"},{0,"off"},{0,""}}}, | ||
109 | {DCT4_BOOKMARK_GOTO_MENU, "Bookmarks in GoTo menu", {{1,"on"},{0,"off"},{0,""}}}, | ||
110 | |||
111 | {DCT4_5100_IDENTIFY, "Phone identification", {{1,"NPM-6U"},{0,"NPM-6"},{0,""}}}, | ||
112 | |||
113 | #ifdef DEBUG | ||
114 | {DCT4_TEST,"",{{1,"1"},{0,"0"}}}, | ||
115 | #endif | ||
116 | |||
117 | {0, "", {{0,""}}} | ||
118 | }; | ||
119 | |||
120 | static DCT4_Phone_Features DCT4PhoneFeatures[] = { | ||
121 | /*3100*/ {"RH-19",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,4},{DCT4_GPRS_PCCH,8}, | ||
122 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
123 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
124 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
125 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
126 | {DCT4_EONS,28},{DCT4_3GINDICATOR,30},{DCT4_INSTANT_MESS_MENU,33}, | ||
127 | {DCT4_CONFIRM_ALS,35}, | ||
128 | {0,0}}}, | ||
129 | /*3200*/ {"RH-30",{{DCT4_ALS,2},{DCT4_A52,4},{DCT4_CSP,5},{DCT4_GPRS_PCCH,14}, | ||
130 | {DCT4_GEA1,15},{DCT4_EOTD,18},{DCT4_WAP_SETTINGS_MENU,20}, | ||
131 | {DCT4_DISPLAY_PHONE_NAME,21},{DCT4_WAP_GOTO_MENU,23}, | ||
132 | {DCT4_SERVICES_GAMES_APP_GALLERY,26},{DCT4_3GINDICATOR,28}, | ||
133 | {DCT4_DISPLAY_WAP_PROFILE,31},{DCT4_SAT_CONFIRM_MENU,33}, | ||
134 | {DCT4_CONFIRM_ALS,34},{DCT4_EONS,40},{DCT4_ALWAYS_ONLINE,45}, | ||
135 | {0,0}}}, | ||
136 | /*3200*/ {"RH-31",{{DCT4_ALS,2},{DCT4_A52,4},{DCT4_CSP,5},{DCT4_GPRS_PCCH,14}, | ||
137 | {DCT4_GEA1,15},{DCT4_EOTD,18},{DCT4_WAP_SETTINGS_MENU,20}, | ||
138 | {DCT4_DISPLAY_PHONE_NAME,21},{DCT4_WAP_GOTO_MENU,23}, | ||
139 | {DCT4_SERVICES_GAMES_APP_GALLERY,26},{DCT4_3GINDICATOR,28}, | ||
140 | {DCT4_DISPLAY_WAP_PROFILE,31},{DCT4_SAT_CONFIRM_MENU,33}, | ||
141 | {DCT4_CONFIRM_ALS,34},{DCT4_EONS,40},{DCT4_ALWAYS_ONLINE,45}, | ||
142 | {0,0}}}, | ||
143 | /*3300*/ {"NEM-1",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
144 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
145 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
146 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
147 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
148 | /*MORE*/ {0,0}}}, | ||
149 | /*3510*/ {"NHM-8",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,6}, | ||
150 | {DCT4_GAMES_WAP_DOWNLOAD,7},{DCT4_GAMES_SCORE_SEND,8}, | ||
151 | {DCT4_GAMES_URL_CHECK,9},{DCT4_GPRS_PCCH,13}, | ||
152 | {DCT4_GEA1,15},{DCT4_ALWAYS_ONLINE,18},{0,0}}}, | ||
153 | /*3510i*/{"RH-9",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,4},{DCT4_GPRS_PCCH,9}, | ||
154 | {DCT4_DISPLAY_PHONE_NAME,14},{DCT4_WAP_GOTO_MENU,15}, | ||
155 | {DCT4_WAP_SETTINGS_MENU,16},{DCT4_SERVICES_GAMES_APP_GALLERY,19}, | ||
156 | {DCT4_DISPLAY_WAP_PROFILE,25},{0,0}}}, | ||
157 | /*3650*/ {"NHL-8",{{DCT4_ALS,1},{0,0}}}, | ||
158 | /*5100*/ {"NPM-6",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
159 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
160 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
161 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
162 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
163 | {DCT4_EONS,28}, | ||
164 | // {DCT4_5100_IDENTIFY,10}, | ||
165 | {0,0}}}, | ||
166 | /*5100*/ {"NPM-6U",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
167 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
168 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
169 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
170 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
171 | {DCT4_EONS,28}, | ||
172 | // {DCT4_5100_IDENTIFY,10}, | ||
173 | {0,0}}}, | ||
174 | /*6100*/ {"NPL-2",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
175 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
176 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
177 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
178 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
179 | {0,0}}}, | ||
180 | /*6220*/ {"RH-20",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,4}, | ||
181 | {DCT4_GEA1,14},{DCT4_EOTD,17},{DCT4_WAP_SETTINGS_MENU,19}, | ||
182 | {DCT4_DISPLAY_PHONE_NAME,20},{DCT4_WAP_GOTO_MENU,22}, | ||
183 | {DCT4_WAP_BOOKMARKS_MENU2,24},{DCT4_SERVICES_GAMES_APP_GALLERY,25}, | ||
184 | {DCT4_3GINDICATOR,27},{DCT4_DISPLAY_WAP_PROFILE,30},{DCT4_SAT_CONFIRM_MENU,32}, | ||
185 | {DCT4_CONFIRM_ALS,33},{DCT4_JAVA_TCK,36},{DCT4_BOOKMARK_GOTO_MENU,37}, | ||
186 | {0,0}}}, | ||
187 | /*6310*/ {"NPE-4",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,6},{DCT4_GAMES_WAP_DOWNLOAD,7}, | ||
188 | {DCT4_GAMES_SCORE_SEND,8},{DCT4_GAMES_URL_CHECK,9},{DCT4_BLUETOOTH_MENU,10}, | ||
189 | {DCT4_GPRS_PCCH,13},{DCT4_GEA1,15},{DCT4_ALWAYS_ONLINE,18},{0,0}}}, | ||
190 | /*6310i*/{"NPL-1",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,6},{DCT4_GAMES_WAP_DOWNLOAD,7}, | ||
191 | {DCT4_GAMES_SCORE_SEND,8},{DCT4_GAMES_URL_CHECK,9}, | ||
192 | {DCT4_BLUETOOTH_MENU,10},{DCT4_USE_PREF_SIM_NET,11}, | ||
193 | {DCT4_GPRS_PCCH,13},{DCT4_GEA1,15},{DCT4_EOTD,16}, | ||
194 | {DCT4_ALWAYS_ONLINE,17},{DCT4_JAVA_GAMES_MENU,18}, | ||
195 | {DCT4_WAP_BOOKMARKS_MENU,20},{DCT4_WAP_SETTINGS_MENU,21}, | ||
196 | {DCT4_WAP_PUSH,28},{DCT4_WAP_GOTO_MENU,29},{0,0}}}, | ||
197 | /*6510*/ {"NPM-9",{{DCT4_ALS,1},{DCT4_A52,3},{DCT4_CSP,6},{DCT4_GAMES_WAP_DOWNLOAD,7}, | ||
198 | {DCT4_GAMES_SCORE_SEND,8},{DCT4_GAMES_URL_CHECK,9}, | ||
199 | {DCT4_GPRS_PCCH,13},{DCT4_GEA1,15},{DCT4_ALWAYS_ONLINE,18},{0,0}}}, | ||
200 | /*6610*/ {"NHL-4U",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
201 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
202 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
203 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
204 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
205 | {0,0}}}, | ||
206 | /*6800*/ {"NHL-6",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
207 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
208 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
209 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
210 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
211 | /*MORE*/ {0,0}}}, | ||
212 | /*7210*/ {"NHL-4",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
213 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
214 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
215 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
216 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
217 | {0,0}}}, | ||
218 | /*7250*/ {"NHL-4J",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
219 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
220 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
221 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
222 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
223 | {0,0}}}, | ||
224 | /*7250i*/{"NHL-4JX",{{DCT4_ALS,1},{DCT4_CSP,4},{DCT4_GAMES_URL_CHECK,5},{DCT4_GPRS_PCCH,8}, | ||
225 | {DCT4_GEA1,9},{DCT4_ALWAYS_ONLINE,11},{DCT4_EOTD,12}, | ||
226 | {DCT4_DISPLAY_PHONE_NAME,17},{DCT4_WAP_GOTO_MENU,18}, | ||
227 | {DCT4_WAP_SETTINGS_MENU,19},{DCT4_SERVICES_GAMES_APP_GALLERY,22}, | ||
228 | {DCT4_DISPLAY_WAP_PROFILE,26},{DCT4_SAT_CONFIRM_MENU,27}, | ||
229 | /*MORE*/ {0,0}}}, | ||
230 | /*8310*/{"NHM-7",{{DCT4_ALS,1},{DCT4_CSP,6},{DCT4_GAMES_WAP_DOWNLOAD,7}, | ||
231 | {DCT4_GAMES_SCORE_SEND,8},{DCT4_GAMES_URL_CHECK,9},{DCT4_GPRS_PCCH,13}, | ||
232 | {DCT4_ALWAYS_ONLINE,18},{0,0}}}, | ||
233 | {"", {{0,0}}} | ||
234 | }; | ||
235 | |||
236 | static GSM_Error DCT4_ReplySetPPS(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
237 | { | ||
238 | printf("Setting done OK\n"); | ||
239 | return ERR_NONE; | ||
240 | } | ||
241 | |||
242 | void DCT4SetPhoneMenus(int argc, char *argv[]) | ||
243 | { | ||
244 | int current = 10,i=0,j,z; | ||
245 | unsigned char reqSet[200] = { | ||
246 | N7110_FRAME_HEADER,0x04,0x00,0x01,0x47,0x48,0x02, | ||
247 | 0x00}; /* Number of changed features */ | ||
248 | |||
249 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
250 | |||
251 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
252 | |||
253 | while (DCT4PhoneFeatures[i].Model[0] != 0x00) { | ||
254 | if (!strcmp(DCT4PhoneFeatures[i].Model,s.Phone.Data.Model)) { | ||
255 | j = 0; | ||
256 | while (DCT4PhoneFeatures[i].Features[j].Name != 0x00) { | ||
257 | z = 0; | ||
258 | while (DCT4Features[z].Name != 0x00) { | ||
259 | if (DCT4Features[z].Name == DCT4PhoneFeatures[i].Features[j].Name) { | ||
260 | printf("%s : %s\n",DCT4Features[z].Text,DCT4Features[z].Values[0].Text); | ||
261 | reqSet[9]++; /* Number of features */ | ||
262 | reqSet[current++] = DCT4PhoneFeatures[i].Features[j].Number; /* Feature number */ | ||
263 | reqSet[current++] = DCT4Features[z].Values[0].Value; /* Value */ | ||
264 | break; | ||
265 | } | ||
266 | z++; | ||
267 | } | ||
268 | j++; | ||
269 | } | ||
270 | } | ||
271 | i++; | ||
272 | } | ||
273 | |||
274 | if (current == 10) { | ||
275 | printf("Sorry, but configuration matrix for this model is not added yet. Please report\n"); | ||
276 | return; | ||
277 | } | ||
278 | |||
279 | reqSet[current++] = 0x00; | ||
280 | reqSet[current++] = 0x00; | ||
281 | |||
282 | error=GSM_WaitFor (&s, reqSet, current, 0x1b, 4, ID_User1); | ||
283 | Print_Error(error); | ||
284 | } | ||
285 | |||
286 | DCT4_Phone_Tests DCT4Tests; | ||
287 | |||
288 | static GSM_Error DCT4_ReplyTestsNames(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
289 | { | ||
290 | int i,pos; | ||
291 | |||
292 | DCT4Tests.Num = msg.Buffer[5]; | ||
293 | pos = 6; | ||
294 | |||
295 | smprintf(s,"%i names for phone tests received\n",msg.Buffer[5]); | ||
296 | for (i=0;i<msg.Buffer[5];i++) { | ||
297 | strcpy(DCT4Tests.Tests[i].Name,msg.Buffer+pos+4); | ||
298 | DCT4Tests.Tests[i].ID = msg.Buffer[pos+2]; | ||
299 | smprintf(s,"%x.\"%s\"\n",DCT4Tests.Tests[i].ID,DCT4Tests.Tests[i].Name); | ||
300 | pos+=msg.Buffer[pos+1]; | ||
301 | } | ||
302 | |||
303 | return ERR_NONE; | ||
304 | } | ||
305 | |||
306 | static GSM_Error DCT4_ReplyTestsStartup(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
307 | { | ||
308 | int i,pos,j; | ||
309 | bool found; | ||
310 | |||
311 | pos = 10; | ||
312 | |||
313 | for (i=0;i<msg.Buffer[8];i++) { | ||
314 | found = false; | ||
315 | for (j=0;j<DCT4Tests.Num;j++) { | ||
316 | if (DCT4Tests.Tests[j].ID == msg.Buffer[pos]) { | ||
317 | DCT4Tests.Tests[j].Startup = true; | ||
318 | found = true; | ||
319 | break; | ||
320 | } | ||
321 | } | ||
322 | if (!found) printf("%x ",msg.Buffer[pos]); | ||
323 | pos++; | ||
324 | } | ||
325 | |||
326 | return ERR_NONE; | ||
327 | } | ||
328 | |||
329 | static GSM_Error DCT4_ReplyTestsStatus(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
330 | { | ||
331 | int i,pos,j; | ||
332 | |||
333 | pos = 6; | ||
334 | |||
335 | smprintf(s,"%i status entries for phone tests received\n",msg.Buffer[5]); | ||
336 | for (i=0;i<msg.Buffer[5];i++) { | ||
337 | for (j=0;j<DCT4Tests.Num;j++) { | ||
338 | if (DCT4Tests.Tests[j].ID == msg.Buffer[pos+2]) { | ||
339 | printf("\"%40s\" : ",DCT4Tests.Tests[j].Name); | ||
340 | switch(msg.Buffer[pos+3]) { | ||
341 | case 0x00: printf("Passed"); break; | ||
342 | case 0x01: printf("Fail"); break; | ||
343 | case 0x03: printf("Not executed"); break; | ||
344 | case 0x06: printf("No signal"); break; | ||
345 | case 0x0D: printf("Timeout"); break; | ||
346 | default : printf("Unknown (%x)",msg.Buffer[pos+3]); | ||
347 | } | ||
348 | if (DCT4Tests.Tests[j].Startup) printf(" (startup)"); | ||
349 | printf("\n"); | ||
350 | break; | ||
351 | } | ||
352 | } | ||
353 | pos+=msg.Buffer[pos+1]; | ||
354 | } | ||
355 | |||
356 | return ERR_NONE; | ||
357 | } | ||
358 | |||
359 | void DCT4SelfTests(int argc, char *argv[]) | ||
360 | { | ||
361 | int j; | ||
362 | unsigned char GetDoneST[6] = {0x00, 0x08, 0x01, 0x04, 0x01, 0x00}; | ||
363 | unsigned char GetDoneST2[6] = {0x00, 0x08, 0x02, 0x04, 0x02, 0x00}; | ||
364 | unsigned char GetNames[6] = {0x00, 0x08, 0x03, 0x06, 0x03, 0x00}; | ||
365 | unsigned char GetStatus[6] = {0x00, 0x08, 0x04, 0x02, 0x03, 0x00}; | ||
366 | |||
367 | unsigned char RunALL[6] = {0x00, 0x06, 0x04, 0x00, 0x03, 0x00}; | ||
368 | |||
369 | //unsigned char GetID[6] = {0x00, 0x08, 0x00, 0x04, 0x03, 0x00};//tests ID | ||
370 | |||
371 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
372 | |||
373 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
374 | |||
375 | if (answer_yes2("Run all tests now ?")) { | ||
376 | error=GSM_WaitFor (&s, RunALL, 6, 0x35, 4, ID_User1); | ||
377 | Print_Error(error); | ||
378 | } | ||
379 | |||
380 | error=GSM_WaitFor (&s, GetNames, 6, 0x35, 4, ID_User1); | ||
381 | Print_Error(error); | ||
382 | |||
383 | for (j=0;j<DCT4Tests.Num;j++) DCT4Tests.Tests[j].Startup = false; | ||
384 | |||
385 | error=GSM_WaitFor (&s, GetDoneST, 6, 0x35, 4, ID_User3); | ||
386 | Print_Error(error); | ||
387 | |||
388 | error=GSM_WaitFor (&s, GetDoneST2, 6, 0x35, 4, ID_User3); | ||
389 | Print_Error(error); | ||
390 | |||
391 | error=GSM_WaitFor (&s, GetStatus, 6, 0x35, 4, ID_User2); | ||
392 | Print_Error(error); | ||
393 | } | ||
394 | |||
395 | static GSM_Error DCT4_ReplyVibra(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
396 | { | ||
397 | #ifdef DEBUG | ||
398 | switch (msg.Buffer[3]) { | ||
399 | case 0x0D : dbgprintf("Vibra state set OK\n"); break; | ||
400 | case 0x0F : dbgprintf("Vibra power set OK\n"); break; | ||
401 | } | ||
402 | #endif | ||
403 | return ERR_NONE; | ||
404 | } | ||
405 | |||
406 | static GSM_Error DCT4EnableVibra(GSM_StateMachine *s, bool enable) | ||
407 | { | ||
408 | /* Enables or disables vibra */ | ||
409 | unsigned char Control[6] = {N7110_FRAME_HEADER,0x0C, | ||
410 | 0x01, /* 0x01 = On, 0x00 = Off */ | ||
411 | 0x00}; | ||
412 | |||
413 | if (!enable) Control[4] = 0x00; | ||
414 | return GSM_WaitFor (s, Control, 6, 0x1C, 4, ID_User3); | ||
415 | } | ||
416 | |||
417 | void DCT4SetVibraLevel(int argc, char *argv[]) | ||
418 | { | ||
419 | GSM_DateTimeDate; | ||
420 | unsigned inti,j; | ||
421 | |||
422 | /* Set vibra level */ | ||
423 | unsigned char SetLevel[6] = {N7110_FRAME_HEADER,0x0E, | ||
424 | 0x64,/* Vibra power (in percent) */ | ||
425 | 0x00}; | ||
426 | |||
427 | GSM_Init(true); | ||
428 | |||
429 | CheckDCT4(); | ||
430 | |||
431 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
432 | |||
433 | SetLevel[4] = atoi(argv[2]); | ||
434 | error=GSM_WaitFor (&s, SetLevel, 6, 0x1C, 4, ID_User3); | ||
435 | Print_Error(error); | ||
436 | |||
437 | error=DCT4EnableVibra(&s, true); | ||
438 | Print_Error(error); | ||
439 | |||
440 | for (i=0;i<3;i++) { | ||
441 | GSM_GetCurrentDateTime (&Date); | ||
442 | j=Date.Second; | ||
443 | while (j==Date.Second) { | ||
444 | my_sleep(10); | ||
445 | GSM_GetCurrentDateTime(&Date); | ||
446 | } | ||
447 | } | ||
448 | |||
449 | error=DCT4EnableVibra(&s, false); | ||
450 | Print_Error(error); | ||
451 | |||
452 | GSM_Terminate(); | ||
453 | } | ||
454 | |||
455 | void DCT4VibraTest(int argc, char *argv[]) | ||
456 | { | ||
457 | unsigned char ans[200]; | ||
458 | |||
459 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
460 | |||
461 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
462 | |||
463 | error=DCT4EnableVibra(&s, true); | ||
464 | Print_Error(error); | ||
465 | |||
466 | printf("Press any key to continue...\n"); | ||
467 | GetLine(stdin, ans, 99); | ||
468 | |||
469 | error=DCT4EnableVibra(&s, false); | ||
470 | Print_Error(error); | ||
471 | } | ||
472 | |||
473 | #ifdef DEBUG | ||
474 | static GSM_Error DCT4_ReplyResetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
475 | { | ||
476 | switch (msg.Buffer[3]) { | ||
477 | case 0x05: | ||
478 | printf("Security code set to \"12345\"\n"); | ||
479 | return ERR_NONE; | ||
480 | case 0x06: | ||
481 | printf("Unknown reason. Can't reset your security code\n"); | ||
482 | return ERR_UNKNOWN; | ||
483 | } | ||
484 | return ERR_UNKNOWNRESPONSE; | ||
485 | } | ||
486 | |||
487 | void DCT4ResetSecurityCode(int argc, char *argv[]) | ||
488 | { | ||
489 | unsigned inti; | ||
490 | unsigned char ResetCode[30] = {0x00,0x06,0x03,0x04,0x01, | ||
491 | '1','2','3','4','5','6','7','8','9','0',/* Old code */ | ||
492 | 0x00, | ||
493 | '1','2','3','4','5',0x00,0x00,0x00,0x00,0x00, /* New code */ | ||
494 | 0x00}; | ||
495 | |||
496 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
497 | |||
498 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
499 | |||
500 | error=GSM_WaitFor (&s, ResetCode, 27, 0x08, 4, ID_User2); | ||
501 | if (error == ERR_UNKNOWN) { | ||
502 | if (answer_yes2("Try brutal force ?")) { | ||
503 | for (i=10000;i<9999999;i++) { | ||
504 | printf("Trying %i\n",i); | ||
505 | memset(ResetCode+6,0,22); | ||
506 | sprintf(ResetCode+5,"%i",i); | ||
507 | sprintf(ResetCode+16,"12345"); | ||
508 | error=GSM_WaitFor (&s, ResetCode, 27, 0x08, 4, ID_User2); | ||
509 | if (error == ERR_NONE) break; | ||
510 | } | ||
511 | } | ||
512 | } else Print_Error(error); | ||
513 | } | ||
514 | #endif | ||
515 | |||
516 | char SecLength; | ||
517 | |||
518 | static GSM_Error DCT4_ReplyGetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
519 | { | ||
520 | if (msg.Length > 12) { | ||
521 | SecLength = msg.Buffer[13]; | ||
522 | if ((msg.Buffer[17]+18) == msg.Length) { | ||
523 | printf("Security code is %s\n",msg.Buffer+18); | ||
524 | // DumpMessage(stdout, msg.Buffer, msg.Length); | ||
525 | } | ||
526 | } | ||
527 | return ERR_NONE; | ||
528 | } | ||
529 | |||
530 | void DCT4GetSecurityCode(int argc, char *argv[]) | ||
531 | { | ||
532 | GSM_Error error; | ||
533 | unsigned char getlen[]={0x00, 0x08, 0x01, 0x0C, | ||
534 | 0x00, 0x23, //ID | ||
535 | 0x00, 0x00, //Index | ||
536 | 0x00, 0x00}; | ||
537 | unsigned char read[]={0x00, 0x08, 0x02, 0x04, | ||
538 | 0x00, 0x23, //ID | ||
539 | 0x00, 0x00, //Index | ||
540 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
541 | 0x00, 0x00, 0x00, 0x00, | ||
542 | 0x00}; //Length | ||
543 | |||
544 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
545 | |||
546 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
547 | |||
548 | SecLength = 0; | ||
549 | error=GSM_WaitFor (&s, getlen, sizeof(getlen), 0x23, 1, ID_User1); | ||
550 | Print_Error(error); | ||
551 | if (SecLength != 0) { | ||
552 | read[17] = SecLength; | ||
553 | error=GSM_WaitFor (&s, read, sizeof(read), 0x23, 5, ID_User1); | ||
554 | Print_Error(error); | ||
555 | } | ||
556 | } | ||
557 | |||
558 | static GSM_Error DCT4_ReplyGetVoiceRecord(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
559 | { | ||
560 | int i=18,j; | ||
561 | unsigned charBuffer[100]; | ||
562 | |||
563 | switch (msg.Buffer[3]) { | ||
564 | case 0x05: | ||
565 | dbgprintf("Part of voice record received\n"); | ||
566 | if (msg.Length == 6) { | ||
567 | dbgprintf("Empty\n"); | ||
568 | return ERR_EMPTY; | ||
569 | } | ||
570 | *s->Phone.Data.VoiceRecord = 0; | ||
571 | while (i<msg.Length) { | ||
572 | s->Phone.Data.PhoneString[(*s->Phone.Data.VoiceRecord)++] = msg.Buffer[i+1]; | ||
573 | s->Phone.Data.PhoneString[(*s->Phone.Data.VoiceRecord)++] = msg.Buffer[i]; | ||
574 | i += 2; | ||
575 | } | ||
576 | return ERR_NONE; | ||
577 | case 0x0D: | ||
578 | dbgprintf("Last part of voice record is %02x %02x\n",msg.Buffer[11],msg.Buffer[12]); | ||
579 | dbgprintf("Token is %02x\n",msg.Buffer[13]); | ||
580 | s->Phone.Data.PhoneString[0] = msg.Buffer[11]; | ||
581 | s->Phone.Data.PhoneString[1] = msg.Buffer[12]; | ||
582 | s->Phone.Data.PhoneString[2] = msg.Buffer[13]; | ||
583 | return ERR_NONE; | ||
584 | break; | ||
585 | case 0x31: | ||
586 | dbgprintf("Names of voice records received\n"); | ||
587 | j = 33; | ||
588 | for (i=0;i<msg.Buffer[9];i++) { | ||
589 | memcpy(Buffer,msg.Buffer+(j+1),msg.Buffer[j]); | ||
590 | Buffer[msg.Buffer[j]] = 0; | ||
591 | Buffer[msg.Buffer[j]+1] = 0; | ||
592 | dbgprintf("%i. \"%s\"\n",i+1,DecodeUnicodeString(Buffer)); | ||
593 | if (i==*s->Phone.Data.VoiceRecord) { | ||
594 | sprintf(s->Phone.Data.PhoneString,"%s.wav",DecodeUnicodeString(Buffer)); | ||
595 | return ERR_NONE; | ||
596 | } | ||
597 | if (i != msg.Buffer[9] - 1) { | ||
598 | j+=msg.Buffer[j] + 1; | ||
599 | if (msg.Buffer[j] == 0x00 && msg.Buffer[j+1]==0x00) j+=2; | ||
600 | j+=23; | ||
601 | } | ||
602 | } | ||
603 | return ERR_EMPTY; | ||
604 | } | ||
605 | return ERR_UNKNOWNRESPONSE; | ||
606 | } | ||
607 | |||
608 | void DCT4GetVoiceRecord(int argc, char *argv[]) | ||
609 | { | ||
610 | /* Voice records names */ | ||
611 | unsigned char ReqNames[200] = { | ||
612 | N7110_FRAME_HEADER, | ||
613 | 0x30,0x01,0x55,0x00,0x00,0xFF,0xFF,0x01,0x01,0x55,0x55}; | ||
614 | /* Voice record token */ | ||
615 | unsigned char ReqToken[200] = { | ||
616 | N7110_FRAME_HEADER,0x0C,0x00,0x44,0x00, | ||
617 | 0x00, /* Location: 0, 1, ... */ | ||
618 | 0x55,0x55}; | ||
619 | /* Voice record part */ | ||
620 | unsigned char ReqGet[200] = { | ||
621 | N7110_FRAME_HEADER,0x04,0x00,0x44, | ||
622 | 0x00,0x00,/* Location: 0, 1, ... */ | ||
623 | 0x55,0x55,0x00, | ||
624 | |||
625 | 0x00,0x00, /* Part Location*/ | ||
626 | 0x00,0x00,0x00, | ||
627 | |||
628 | 0x04, /* ??? */ | ||
629 | |||
630 | 0x00}; /* Token */ | ||
631 | |||
632 | /* WAV file headers */ | ||
633 | unsigned char WAV_Header[] = { | ||
634 | 'R','I','F','F', | ||
635 | 0x00,0x00,0x00,0x00,/* Length */ | ||
636 | 'W','A','V','E'}; | ||
637 | unsigned char FMT_Header[] = {'f','m','t',' ', | ||
638 | 0x14,0x00,0x00,0x00,0x31,0x00,0x01,0x00,0x40,0x1f, | ||
639 | 0x00,0x00,0x59,0x06,0x00,0x00,0x41,0x00,0x00,0x00, | ||
640 | 0x02,0x00,0x40,0x01,'f', 'a', 'c', 't', 0x04,0x00, | ||
641 | 0x00,0x00, | ||
642 | 0x00,0x73,0x00,0x00};/* Seems to be some length */ | ||
643 | unsigned char DATA_Header[] = { | ||
644 | 'd','a','t','a', | ||
645 | 0x00,0x00,0x00,0x00};/* Length */ | ||
646 | |||
647 | long wavfilesize=0; | ||
648 | unsigned charFileName[100], Buffer[10000], Token; | ||
649 | unsigned int Location, size=0, CurrentLocation = 0, TokenLocation; | ||
650 | int i; | ||
651 | FILE *WAVFile; | ||
652 | |||
653 | Location = atoi(argv[2]); | ||
654 | if (Location == 0x00) { | ||
655 | printf("Please numerate locations from 1\n"); | ||
656 | return; | ||
657 | } | ||
658 | Location--; | ||
659 | |||
660 | GSM_Init(true); | ||
661 | |||
662 | CheckDCT4(); | ||
663 | |||
664 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
665 | |||
666 | s.Phone.Data.VoiceRecord = &Location; | ||
667 | s.Phone.Data.PhoneString = FileName; | ||
668 | dbgprintf("Getting voice record name\n"); | ||
669 | error=GSM_WaitFor (&s, ReqNames, 14, 0x4A, 4, ID_User4); | ||
670 | Print_Error(error); | ||
671 | |||
672 | s.Phone.Data.PhoneString = Buffer; | ||
673 | ReqToken[7] = Location; | ||
674 | dbgprintf("Getting voice record token\n"); | ||
675 | error=GSM_WaitFor (&s, ReqToken, 10, 0x23, 4, ID_User4); | ||
676 | Print_Error(error); | ||
677 | TokenLocation = Buffer[0] * 256 + Buffer[1]; | ||
678 | Token = Buffer[2]; | ||
679 | |||
680 | WAVFile = fopen(FileName, "wb"); | ||
681 | |||
682 | fwrite(&WAV_Header, 1, sizeof(WAV_Header),WAVFile); | ||
683 | fwrite(&FMT_Header, 1, sizeof(FMT_Header),WAVFile); | ||
684 | fwrite(&DATA_Header, 1, sizeof(DATA_Header),WAVFile); | ||
685 | |||
686 | s.Phone.Data.VoiceRecord = &size; | ||
687 | s.Phone.Data.PhoneString = Buffer; | ||
688 | ReqGet[7] = Location; | ||
689 | fprintf(stderr,"Getting voice record and saving to \"%s\": ",FileName); | ||
690 | while (1) { | ||
691 | dbgprintf("Getting next part of voice record\n"); | ||
692 | fprintf(stderr,"."); | ||
693 | error=GSM_WaitFor (&s, ReqGet, 18, 0x23, 4, ID_User4); | ||
694 | if (error == ERR_NONE) { | ||
695 | wavfilesize += size; | ||
696 | fwrite(Buffer,1,size,WAVFile); | ||
697 | } | ||
698 | if (error == ERR_EMPTY) break; | ||
699 | Print_Error(error); | ||
700 | CurrentLocation += 4; | ||
701 | ReqGet[11] = CurrentLocation / 256; | ||
702 | ReqGet[12] = CurrentLocation % 256; | ||
703 | if (CurrentLocation+4 > TokenLocation) break; | ||
704 | } | ||
705 | dbgprintf("Getting first part in last sequence of voice record\n"); | ||
706 | for (i=255;i>=0;i--) { | ||
707 | ReqGet[16] = i; | ||
708 | ReqGet[17] = Token; | ||
709 | fprintf(stderr,"."); | ||
710 | error=GSM_WaitFor (&s, ReqGet, 18, 0x23, 4, ID_User4); | ||
711 | if (error == ERR_NONE) { | ||
712 | wavfilesize += size; | ||
713 | fwrite(Buffer,1,size,WAVFile); | ||
714 | break; | ||
715 | } | ||
716 | if (error != ERR_EMPTY) Print_Error(error); | ||
717 | } | ||
718 | while (1) { | ||
719 | dbgprintf("Getting next part of last sequence in voice record\n"); | ||
720 | CurrentLocation += 4; | ||
721 | ReqGet[11] = CurrentLocation / 256; | ||
722 | ReqGet[12] = CurrentLocation % 256; | ||
723 | fprintf(stderr,"."); | ||
724 | error=GSM_WaitFor (&s, ReqGet, 18, 0x23, 4, ID_User4); | ||
725 | if (error == ERR_NONE) { | ||
726 | wavfilesize += size; | ||
727 | fwrite(Buffer,1,size,WAVFile); | ||
728 | } | ||
729 | if (error == ERR_EMPTY) break; | ||
730 | Print_Error(error); | ||
731 | } | ||
732 | fprintf(stderr,"\n"); | ||
733 | |||
734 | wavfilesize += sizeof(WAV_Header) + sizeof(FMT_Header) + sizeof(DATA_Header); | ||
735 | WAV_Header[4] = (unsigned char)(wavfilesize % 256); | ||
736 | WAV_Header[5] = (unsigned char)(wavfilesize / 256); | ||
737 | WAV_Header[6] = (unsigned char)(wavfilesize / (256*256)); | ||
738 | WAV_Header[7] = (unsigned char)(wavfilesize / (256*256*256)); | ||
739 | |||
740 | /* FIXME */ | ||
741 | FMT_Header[36]= (unsigned char)(((wavfilesize - 238) * 5 ) % 256); | ||
742 | FMT_Header[37]= (unsigned char)(((wavfilesize - 238) * 5 ) / 256); | ||
743 | FMT_Header[38]= (unsigned char)(((wavfilesize - 238) * 5 ) / (256*256)); | ||
744 | FMT_Header[39]= (unsigned char)(((wavfilesize - 238) * 5 ) / (256*256*256)); | ||
745 | |||
746 | wavfilesize = wavfilesize - 54 - 6; | ||
747 | DATA_Header[4] = (unsigned char)(wavfilesize % 256); | ||
748 | DATA_Header[5] = (unsigned char)(wavfilesize / 256); | ||
749 | DATA_Header[6] = (unsigned char)(wavfilesize / (256*256)); | ||
750 | DATA_Header[7] = (unsigned char)(wavfilesize / (256*256*256)); | ||
751 | |||
752 | fseek( WAVFile, 0, SEEK_SET); | ||
753 | fwrite(&WAV_Header, 1, sizeof(WAV_Header),WAVFile); | ||
754 | fwrite(&FMT_Header, 1, sizeof(FMT_Header),WAVFile); | ||
755 | fwrite(&DATA_Header, 1, sizeof(DATA_Header),WAVFile); | ||
756 | |||
757 | fclose(WAVFile); | ||
758 | |||
759 | GSM_Terminate(); | ||
760 | } | ||
761 | |||
762 | static GSM_Error DCT4_ReplyGetBTInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
763 | { | ||
764 | printf("device address %02x%02x%02x%02x%02x%02x\n", | ||
765 | msg.Buffer[9],msg.Buffer[10],msg.Buffer[11], | ||
766 | msg.Buffer[12],msg.Buffer[13],msg.Buffer[14]); | ||
767 | return ERR_NONE; | ||
768 | } | ||
769 | |||
770 | static GSM_Error DCT4_ReplyGetSimlock(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
771 | { | ||
772 | int i; | ||
773 | |||
774 | switch (msg.Buffer[3]) { | ||
775 | case 0x0D: | ||
776 | dbgprintf("Simlock info received\n"); | ||
777 | dbgprintf("Config_Data: "); | ||
778 | for (i=14;i<22;i++) { | ||
779 | dbgprintf("%02x",msg.Buffer[i]); | ||
780 | } | ||
781 | dbgprintf("\n"); | ||
782 | dbgprintf("Profile_Bits: "); | ||
783 | for (i=22;i<30;i++) { | ||
784 | dbgprintf("%02x",msg.Buffer[i]); | ||
785 | } | ||
786 | dbgprintf("\n"); | ||
787 | return ERR_NONE; | ||
788 | case 0x13: | ||
789 | dbgprintf("Simlock info received\n"); | ||
790 | if (msg.Buffer[58] == 0x05 && msg.Buffer[59] == 0x02) { | ||
791 | dbgprintf("SIM_PATH: "); | ||
792 | for (i=44;i<52;i++) { | ||
793 | dbgprintf("%02x",msg.Buffer[i]); | ||
794 | } | ||
795 | dbgprintf("\n"); | ||
796 | printf("Simlock data : "); | ||
797 | for (i=60;i<63;i++) { | ||
798 | printf("%02x",msg.Buffer[i]); | ||
799 | } | ||
800 | printf("\n"); | ||
801 | } | ||
802 | return ERR_NONE; | ||
803 | } | ||
804 | return ERR_UNKNOWNRESPONSE; | ||
805 | } | ||
806 | |||
807 | void DCT4Info(int argc, char *argv[]) | ||
808 | { | ||
809 | unsigned char GetBTAddress[8] = {N6110_FRAME_HEADER, 0x09, 0x19, 0x01, 0x03, 0x06}; | ||
810 | unsigned char GetSimlock[5] = {N6110_FRAME_HEADER, 0x12, 0x0D}; | ||
811 | unsigned char value[10]; | ||
812 | |||
813 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
814 | |||
815 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
816 | |||
817 | if (IsPhoneFeatureAvailable(s.Phone.Data.ModelInfo, F_BLUETOOTH)) { | ||
818 | printf("Bluetooth : "); | ||
819 | |||
820 | error=GSM_WaitFor (&s, GetBTAddress, 8, 0xD7, 4, ID_User6); | ||
821 | Print_Error(error); | ||
822 | } | ||
823 | |||
824 | error=GSM_WaitFor (&s, GetSimlock, 5, 0x53, 4, ID_User6); | ||
825 | Print_Error(error); | ||
826 | GetSimlock[4] = 0x0E; | ||
827 | error=GSM_WaitFor (&s, GetSimlock, 5, 0x53, 4, ID_User6); | ||
828 | Print_Error(error); | ||
829 | GetSimlock[3] = 0x0C; | ||
830 | error=GSM_WaitFor (&s, GetSimlock, 4, 0x53, 4, ID_User6); | ||
831 | Print_Error(error); | ||
832 | error=NOKIA_GetPhoneString(&s,"\x00\x03\x02\x07\x00\x08",6,0x1b,value,ID_User6,10); | ||
833 | Print_Error(error); | ||
834 | printf("UEM : %s\n",value); | ||
835 | } | ||
836 | |||
837 | static FILE *T9File; | ||
838 | int T9Size; | ||
839 | int T9FullSize; | ||
840 | |||
841 | static GSM_Error DCT4_ReplyGetT9(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
842 | { | ||
843 | T9FullSize = msg.Buffer[18] * 256 + msg.Buffer[19]; | ||
844 | T9Size = msg.Length - 18; | ||
845 | fwrite(msg.Buffer+18,1,T9Size,T9File); | ||
846 | return ERR_NONE; | ||
847 | } | ||
848 | |||
849 | void DCT4GetT9(int argc, char *argv[]) | ||
850 | { | ||
851 | int i,T9Dictionary=0; | ||
852 | unsigned char req[] = {N7110_FRAME_HEADER, 0x04, 0x00, 0x5B, | ||
853 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
854 | 0x00, 0x00,/* Start position */ | ||
855 | 0x00, 0x00, | ||
856 | 0x02, 0xBC};/* How many bytes to read */ | ||
857 | |||
858 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
859 | |||
860 | T9File = fopen("T9", "w"); | ||
861 | if (T9File == NULL) return; | ||
862 | |||
863 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
864 | |||
865 | i = 0; | ||
866 | while (1) { | ||
867 | req[12] = i / 256; | ||
868 | req[13] = i % 256; | ||
869 | if (i != 0) { | ||
870 | if (T9Dictionary - i < req[16]*256+req[17]) { | ||
871 | req[16] = (T9Dictionary - i) / 256; | ||
872 | req[17] = (T9Dictionary - i) % 256; | ||
873 | } | ||
874 | if (T9Dictionary - i == 0) break; | ||
875 | } | ||
876 | error=GSM_WaitFor (&s, req, 18, 0x23, 4, ID_User3); | ||
877 | Print_Error(error); | ||
878 | if (i==0) { | ||
879 | T9Dictionary = T9FullSize; | ||
880 | dbgprintf("T9 dictionary size is %i\n",T9Dictionary); | ||
881 | } | ||
882 | i+=T9Size; | ||
883 | } | ||
884 | |||
885 | fclose(T9File); | ||
886 | } | ||
887 | |||
888 | extern GSM_Error N6510_SetLight(GSM_StateMachine *s, N6510_PHONE_LIGHTS light, bool enable); | ||
889 | |||
890 | void DCT4SetLight(int argc, char *argv[]) | ||
891 | { | ||
892 | int i; | ||
893 | N6510_PHONE_LIGHTS type; | ||
894 | bool enable; | ||
895 | |||
896 | if (mystrncasecmp(argv[2],"display",0)) { type = N6510_LIGHT_DISPLAY; | ||
897 | } else if (mystrncasecmp(argv[2],"keypad",0)) {type = N6510_LIGHT_KEYPAD; | ||
898 | } else if (mystrncasecmp(argv[2],"torch",0)) {type = N6510_LIGHT_TORCH; | ||
899 | } else { | ||
900 | printf("What lights should I enable (\"%s\") ?\n",argv[2]); | ||
901 | exit(-1); | ||
902 | } | ||
903 | |||
904 | if (mystrncasecmp(argv[3],"on",0)) { enable = true; | ||
905 | } else if (mystrncasecmp(argv[3],"off",0)) {enable = false; | ||
906 | } else { | ||
907 | printf("What should I do (\"%s\") ?\n",argv[3]); | ||
908 | exit(-1); | ||
909 | } | ||
910 | |||
911 | for (i=0;i<s.ConfigNum;i++) { | ||
912 | s.Config[i].StartInfo = "false"; | ||
913 | } | ||
914 | |||
915 | GSM_Init(true); | ||
916 | |||
917 | CheckDCT4(); | ||
918 | |||
919 | error=N6510_SetLight(&s, type, enable); | ||
920 | Print_Error(error); | ||
921 | |||
922 | GSM_Terminate(); | ||
923 | } | ||
924 | |||
925 | void DCT4DisplayTest(int argc, char *argv[]) | ||
926 | { | ||
927 | unsigned char ans[200]; | ||
928 | unsigned char req0[] = {0x00, 0x08, 0x0D, 0x00, 0x0F, 0x00}; | ||
929 | unsigned char req[] = {0x00, 0x08, 0x0E, 0x00, 0x12, 0x01, 0x00, 0x04, | ||
930 | 0x09, /* test number */ | ||
931 | 0x00}; | ||
932 | |||
933 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
934 | |||
935 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
936 | |||
937 | DCT4_SetPhoneMode(&s, DCT4_MODE_TEST); | ||
938 | |||
939 | s.Protocol.Functions->WriteMessage(&s, req0, 6, 0x40); | ||
940 | |||
941 | req[8] = atoi(argv[2]); | ||
942 | s.Protocol.Functions->WriteMessage(&s, req, 10, 0x40); | ||
943 | |||
944 | printf("Press any key to continue...\n"); | ||
945 | GetLine(stdin, ans, 99); | ||
946 | |||
947 | DCT4_SetPhoneMode(&s, DCT4_MODE_NORMAL); | ||
948 | } | ||
949 | |||
950 | int ADC; | ||
951 | |||
952 | static GSM_Error DCT4_ReplyGetADC(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
953 | { | ||
954 | if (msg.Buffer[6] == 0xff && msg.Buffer[7] == 0xff) return ERR_NONE; | ||
955 | switch (msg.Buffer[3]) { | ||
956 | case 0x10: | ||
957 | printf("raw "); | ||
958 | printf("%10i ",msg.Buffer[8]*256+msg.Buffer[9]); | ||
959 | break; | ||
960 | case 0x12: | ||
961 | printf("unit result "); | ||
962 | printf("%10i ",(msg.Buffer[8]*256+msg.Buffer[9])*ADC); | ||
963 | break; | ||
964 | } | ||
965 | return ERR_NONE; | ||
966 | } | ||
967 | |||
968 | struct DCT4ADCInfo { | ||
969 | char *name; | ||
970 | char *unit; | ||
971 | int x; | ||
972 | }; | ||
973 | |||
974 | static struct DCT4ADCInfo DCT4ADC[] = { | ||
975 | {"Battery voltage, divided:", "mV", 1}, | ||
976 | {"Battery voltage, scaled:", "mV", 1}, | ||
977 | {"Charger voltage:", "mV", 1}, | ||
978 | {"Charger current:", "mA", 1}, | ||
979 | {"Battery size indicator:", "Ohms",100}, | ||
980 | {"Battery temperature:", "K", 1}, | ||
981 | {"Headset interconnection:", "mV", 1}, | ||
982 | {"Hook interconnection:", "mV", 1}, | ||
983 | {"Light sensor:", "mV", 1}, | ||
984 | {"Power amplifier temperature:","K", 1}, | ||
985 | {"VCXO temperature:", "K", 1}, | ||
986 | {"Resistive keyboard 1/headint2:","mV", 1}, | ||
987 | {"Resistive keyboard 1/auxdet:","mV", 1}, | ||
988 | {"Initial battery voltage:", "mV", 1}, | ||
989 | {"Battery Current:", "mA", 1}, | ||
990 | {"Battery Current Fast:", "mA", 1}, | ||
991 | |||
992 | {"", "", 1} | ||
993 | }; | ||
994 | |||
995 | void DCT4GetADC(int argc, char *argv[]) | ||
996 | { | ||
997 | int i = 0; | ||
998 | unsigned char GetRaw[] = {N6110_FRAME_HEADER, 0x0F, | ||
999 | 0x00, /* Test number */ | ||
1000 | 0x01}; | ||
1001 | unsigned char GetUnit[] = {N6110_FRAME_HEADER, 0x11, | ||
1002 | 0x00, /* Test number */ | ||
1003 | 0x01}; | ||
1004 | |||
1005 | if (CheckDCT4Only()!=ERR_NONE) return; | ||
1006 | |||
1007 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
1008 | |||
1009 | while (1) { | ||
1010 | printf(" %30s ",DCT4ADC[i].name); | ||
1011 | GetRaw[4] = i; | ||
1012 | error=GSM_WaitFor (&s, GetRaw, 6, 0x17, 4, ID_User3); | ||
1013 | Print_Error(error); | ||
1014 | GetUnit[4] = i; | ||
1015 | ADC = DCT4ADC[i].x; | ||
1016 | error=GSM_WaitFor (&s, GetUnit, 6, 0x17, 4, ID_User3); | ||
1017 | Print_Error(error); | ||
1018 | printf("%s\n",DCT4ADC[i].unit); | ||
1019 | i++; | ||
1020 | if (DCT4ADC[i].name[0] == 0x00) break; | ||
1021 | } | ||
1022 | } | ||
1023 | |||
1024 | static double RadioFreq; | ||
1025 | static unsigned char RadioName[100]; | ||
1026 | |||
1027 | static GSM_Error DCT4_ReplyTuneRadio(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
1028 | { | ||
1029 | int length; | ||
1030 | unsigned char name[100]; | ||
1031 | |||
1032 | switch (msg.Buffer[3]) { | ||
1033 | case 0x09: | ||
1034 | N6510_DecodeFMFrequency(&RadioFreq, msg.Buffer+16); | ||
1035 | |||
1036 | length = msg.Buffer[8]; | ||
1037 | memcpy(name,msg.Buffer+18,length*2); | ||
1038 | name[length*2] = 0x00; | ||
1039 | name[length*2+1] = 0x00; | ||
1040 | CopyUnicodeString(RadioName,name); | ||
1041 | smprintf(s,"Station name: \"%s\"\n",DecodeUnicodeString(RadioName)); | ||
1042 | return ERR_NONE; | ||
1043 | case 0x15: | ||
1044 | case 0x16: | ||
1045 | smprintf(s,"Response for enabling radio/headset status received\n"); | ||
1046 | if (msg.Buffer[5] == 0) { | ||
1047 | smprintf(s,"Connected\n"); | ||
1048 | return ERR_NONE; | ||
1049 | } | ||
1050 | smprintf(s,"Probably not connected\n"); | ||
1051 | return ERR_PERMISSION; | ||
1052 | } | ||
1053 | return ERR_UNKNOWNRESPONSE; | ||
1054 | } | ||
1055 | |||
1056 | void DCT4TuneRadio(int argc, char *argv[]) | ||
1057 | { | ||
1058 | double Freq, diff; | ||
1059 | GSM_FMStation FMStation[50],FMStat; | ||
1060 | int i, j, num; | ||
1061 | bool found; | ||
1062 | |||
1063 | unsigned char Enable[] = {N6110_FRAME_HEADER, 0x00, 0x00, 0x00}; | ||
1064 | unsigned char Disable[] = {N6110_FRAME_HEADER, 0x01, 0x0E, 0x00}; | ||
1065 | //unsigned char SetVolume[] = {N6110_FRAME_HEADER, 0x14, | ||
1066 | // 0x00,/* Volume level */ | ||
1067 | // 0x00}; | ||
1068 | //unsigned char MuteUnMute[] = {N6110_FRAME_HEADER, 0x0F, | ||
1069 | // 0x0C,/* 0x0B = mute, 0x0C = unmute */ | ||
1070 | // 0x00}; | ||
1071 | unsigned char SetFreq[] = {N6110_FRAME_HEADER, 0x08, | ||
1072 | 0x08, 0x14, 0x00, 0x01, | ||
1073 | 0x9A, 0x28}; /* Frequency */ | ||
1074 | // unsigned char Find1[] = {N6110_FRAME_HEADER, 0x08, | ||
1075 | // 0x04, 0x14, 0x00, 0x00, 0x00, 0x00}; | ||
1076 | unsigned char Find2[] = {N6110_FRAME_HEADER, 0x08, | ||
1077 | 0x05, 0x14, 0x00, 0x00, 0x00, 0x00}; | ||
1078 | //unsigned char SetStereo[] = {N6110_FRAME_HEADER, 0x19, | ||
1079 | // 0x0A, 0x00, 0x15}; | ||
1080 | //unsigned char SetMono[] = {N6110_FRAME_HEADER, 0x19, | ||
1081 | // 0x09, 0x00, 0x96}; | ||
1082 | |||
1083 | GSM_Init(true); | ||
1084 | |||
1085 | CheckDCT4(); | ||
1086 | |||
1087 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
1088 | |||
1089 | FMStat.Location = 1; | ||
1090 | error = Phone->GetFMStation(&s,&FMStat); | ||
1091 | if (error != ERR_NONE && error != ERR_EMPTY) { | ||
1092 | printf("Phone seems not to support radio\n"); | ||
1093 | GSM_Terminate(); | ||
1094 | exit(-1); | ||
1095 | } | ||
1096 | |||
1097 | error=GSM_WaitFor (&s, Enable, 6, 0x3E, 4, ID_User3); | ||
1098 | if (error == ERR_PERMISSION) { | ||
1099 | printf("Please connect headset. Required as antenna\n"); | ||
1100 | GSM_Terminate(); | ||
1101 | exit(-1); | ||
1102 | } | ||
1103 | Print_Error(error); | ||
1104 | |||
1105 | num=0; | ||
1106 | for (i=88;i<108;i++) { | ||
1107 | fprintf(stderr,"%cSearching: %i percent",13,(i-88)*100/(108-88)); | ||
1108 | Freq = i; | ||
1109 | N6510_EncodeFMFrequency(Freq, SetFreq+8); | ||
1110 | error=GSM_WaitFor (&s, SetFreq, 10, 0x3E, 4, ID_User3); | ||
1111 | Print_Error(error); | ||
1112 | |||
1113 | error=GSM_WaitFor (&s, Find2, 10, 0x3E, 4, ID_User3); | ||
1114 | Print_Error(error); | ||
1115 | found = false; | ||
1116 | for (j=0;j<num;j++) { | ||
1117 | if (FMStation[j].Frequency > RadioFreq) { | ||
1118 | diff = FMStation[j].Frequency - RadioFreq; | ||
1119 | } else { | ||
1120 | diff = RadioFreq - FMStation[j].Frequency; | ||
1121 | } | ||
1122 | if (diff <= 0.2) { | ||
1123 | dbgprintf("diff is %f\n",diff); | ||
1124 | found = true; | ||
1125 | break; | ||
1126 | } | ||
1127 | } | ||
1128 | if (!found) { | ||
1129 | dbgprintf("Adding %f, num %i\n",RadioFreq,num); | ||
1130 | FMStation[num].Frequency = RadioFreq; | ||
1131 | CopyUnicodeString(FMStation[num].StationName,RadioName); | ||
1132 | num++; | ||
1133 | } | ||
1134 | } | ||
1135 | fprintf(stderr,"%cSearching: %i percent",13,100); | ||
1136 | fprintf(stderr,"\n\n"); | ||
1137 | |||
1138 | i=0; | ||
1139 | while(1) { | ||
1140 | if (i==num || i==num-1) break; | ||
1141 | if (FMStation[i].Frequency > FMStation[i+1].Frequency) { | ||
1142 | memcpy(&FMStat,&FMStation[i],sizeof(GSM_FMStation)); | ||
1143 | memcpy(&FMStation[i],&FMStation[i+1],sizeof(GSM_FMStation)); | ||
1144 | memcpy(&FMStation[i+1],&FMStat,sizeof(GSM_FMStation)); | ||
1145 | i = 0; | ||
1146 | continue; | ||
1147 | } | ||
1148 | i++; | ||
1149 | } | ||
1150 | for (i=0;i<num;i++) { | ||
1151 | fprintf(stderr,"%02i.",i+1); | ||
1152 | if (FMStation[i].Frequency < 100) fprintf(stderr," "); | ||
1153 | fprintf(stderr,"%.1f MHz - \"%s\" \n", | ||
1154 | FMStation[i].Frequency, | ||
1155 | DecodeUnicodeString(FMStation[i].StationName)); | ||
1156 | } | ||
1157 | |||
1158 | if (answer_yes2("Do you want to save found stations")) { | ||
1159 | fprintf(stderr,"Deleting old FM stations: "); | ||
1160 | error=Phone->ClearFMStations(&s); | ||
1161 | Print_Error(error); | ||
1162 | fprintf(stderr,"Done\n"); | ||
1163 | for (i=0;i<num;i++) { | ||
1164 | FMStation[i].Location = i+1; | ||
1165 | error=Phone->SetFMStation(&s,&FMStation[i]); | ||
1166 | Print_Error(error); | ||
1167 | fprintf(stderr,"%cWriting: %i percent",13,(i+1)*100/num); | ||
1168 | } | ||
1169 | fprintf(stderr,"\n"); | ||
1170 | } | ||
1171 | |||
1172 | error=GSM_WaitFor (&s, Disable, 6, 0x3E, 4, ID_User3); | ||
1173 | Print_Error(error); | ||
1174 | |||
1175 | GSM_Terminate(); | ||
1176 | } | ||
1177 | |||
1178 | void DCT4PlaySavedRingtone(int argc, char *argv[]) | ||
1179 | { | ||
1180 | unsigned char req[] = {N6110_FRAME_HEADER, | ||
1181 | 0x01, | ||
1182 | 0x00,0x64,//id | ||
1183 | 0x01, //group | ||
1184 | 0x01,0x00,0x00, | ||
1185 | 0x0A, //volume | ||
1186 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00}; | ||
1187 | GSM_AllRingtonesInfo Info; | ||
1188 | |||
1189 | GSM_Init(true); | ||
1190 | |||
1191 | CheckDCT4(); | ||
1192 | |||
1193 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
1194 | |||
1195 | error=Phone->GetRingtonesInfo(&s,&Info); | ||
1196 | Print_Error(error); | ||
1197 | |||
1198 | if (atoi(argv[2]) > Info.Number-1) { | ||
1199 | GSM_Terminate(); | ||
1200 | return; | ||
1201 | } | ||
1202 | req[4] = Info.Ringtone[atoi(argv[2])].ID / 256; | ||
1203 | req[5] = Info.Ringtone[atoi(argv[2])].ID % 256; | ||
1204 | req[6] = Info.Ringtone[atoi(argv[2])].Group; | ||
1205 | |||
1206 | error=GSM_WaitFor (&s, req, 18, 0x1F, 4, ID_User3); | ||
1207 | Print_Error(error); | ||
1208 | |||
1209 | //for (i=0;i<Info.Number;i++) printmsg("%i. \"%s\"\n",i,DecodeUnicodeConsole(Info.Ringtone[i].Name)); | ||
1210 | |||
1211 | GSM_Terminate(); | ||
1212 | } | ||
1213 | |||
1214 | static GSM_Error DCT4_ReplyMakeCameraShoot(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
1215 | { | ||
1216 | return ERR_NONE; | ||
1217 | } | ||
1218 | |||
1219 | void DCT4MakeCameraShoot(int argc, char *argv[]) | ||
1220 | { | ||
1221 | unsigned char SetCamera[] = {N6110_FRAME_HEADER, 0x09, 0x01, 0x02}; | ||
1222 | unsigned char CameraON[] = {N6110_FRAME_HEADER, 0x02, 0x01, 0x00, 0x00, 0x00 , 0x00, 0x00}; | ||
1223 | unsigned char CameraON2[] = {N6110_FRAME_HEADER, 0xF0, 0x02, 0x00}; | ||
1224 | unsigned char MakeShot[200] = {N6110_FRAME_HEADER, 0x06, 0x01, 0x06, | ||
1225 | 0x01, 0x00, 0x00, 0x02, 0x00, 0x04, 0x32, 0x00, 0x01, | ||
1226 | 0x1D, //length of rest | ||
1227 | 0x00, 0x00, 0x00, 0x01, | ||
1228 | 0x00, 0x02,//master folder id | ||
1229 | 0x00, 0x14}; //length | ||
1230 | unsigned char CameraOFF[] = {N6110_FRAME_HEADER, 0x04, 0x01, 0x00}; | ||
1231 | |||
1232 | GSM_Init(true); | ||
1233 | |||
1234 | CheckDCT4(); | ||
1235 | |||
1236 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
1237 | |||
1238 | error=GSM_WaitFor (&s, SetCamera, 6, 0x61, 4, ID_User3); | ||
1239 | Print_Error(error); | ||
1240 | error=GSM_WaitFor (&s, CameraON, 10, 0x61, 4, ID_User3); | ||
1241 | Print_Error(error); | ||
1242 | error=GSM_WaitFor (&s, CameraON2, 6, 0x61, 4, ID_User3); | ||
1243 | Print_Error(error); | ||
1244 | EncodeUnicode(MakeShot+24,"GammuShot",9); | ||
1245 | MakeShot[15] = 9+9*2; | ||
1246 | MakeShot[23] = 9*2; | ||
1247 | error=GSM_WaitFor (&s, MakeShot, 24+MakeShot[23], 0x61, 4, ID_User3); | ||
1248 | Print_Error(error); | ||
1249 | error=GSM_WaitFor (&s, SetCamera, 6, 0x61, 4, ID_User3); | ||
1250 | Print_Error(error); | ||
1251 | error=GSM_WaitFor (&s, CameraOFF, 6, 0x61, 4, ID_User3); | ||
1252 | Print_Error(error); | ||
1253 | |||
1254 | GSM_Terminate(); | ||
1255 | } | ||
1256 | |||
1257 | int len; | ||
1258 | |||
1259 | static GSM_Error DCT4_ReplyGetScreenDump(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
1260 | { | ||
1261 | if (msg.Buffer[7] == 0x0C) len = 1; | ||
1262 | return ERR_NONE; | ||
1263 | } | ||
1264 | |||
1265 | void DCT4GetScreenDump(int argc, char *argv[]) | ||
1266 | { | ||
1267 | unsigned char req[] = {N6110_FRAME_HEADER, 0x07, 0x01, 0x00}; | ||
1268 | //n6110_frameheader 06//screen info | ||
1269 | |||
1270 | GSM_Init(true); | ||
1271 | |||
1272 | CheckDCT4(); | ||
1273 | |||
1274 | s.User.UserReplyFunctions=UserReplyFunctions4; | ||
1275 | |||
1276 | error=GSM_WaitFor (&s, req, 6, 0x0E, 4, ID_User3); | ||
1277 | Print_Error(error); | ||
1278 | len = 2000; | ||
1279 | while (len >= 200) GSM_ReadDevice(&s,true); | ||
1280 | |||
1281 | GSM_Terminate(); | ||
1282 | } | ||
1283 | |||
1284 | static GSM_Reply_Function UserReplyFunctions4[] = { | ||
1285 | |||
1286 | #ifdef DEBUG | ||
1287 | {DCT4_ReplyResetSecurityCode, "\x08",0x03,0x05,ID_User2}, | ||
1288 | {DCT4_ReplyResetSecurityCode, "\x08",0x03,0x06,ID_User2}, | ||
1289 | #endif | ||
1290 | |||
1291 | {DCT4_ReplyGetScreenDump, "\x0E",0x00,0x00,ID_User3}, | ||
1292 | {DCT4_ReplyGetScreenDump,"\x0E",0x00,0x00,ID_IncomingFrame}, | ||
1293 | |||
1294 | {DCT4_ReplyGetADC, "\x17",0x03,0x10,ID_User3}, | ||
1295 | {DCT4_ReplyGetADC, "\x17",0x03,0x12,ID_User3}, | ||
1296 | |||
1297 | {DCT4_ReplySetPPS, "\x1b",0x03,0x05,ID_User1}, | ||
1298 | {NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x08,ID_User6}, | ||
1299 | |||
1300 | {DCT4_ReplyVibra, "\x1C",0x03,0x0D,ID_User3}, | ||
1301 | {DCT4_ReplyVibra, "\x1C",0x03,0x0F,ID_User3}, | ||
1302 | |||
1303 | {NoneReply, "\x1F",0x03,0x02,ID_User3}, | ||
1304 | |||
1305 | {DCT4_ReplyGetSecurityCode, "\x23",0x03,0x05,ID_User1}, | ||
1306 | {DCT4_ReplyGetT9, "\x23",0x03,0x05,ID_User3}, | ||
1307 | {DCT4_ReplyGetVoiceRecord, "\x23",0x03,0x05,ID_User4}, | ||
1308 | {DCT4_ReplyGetVoiceRecord, "\x23",0x03,0x0D,ID_User4}, | ||
1309 | {DCT4_ReplyGetSecurityCode, "\x23",0x03,0x0D,ID_User1}, | ||
1310 | |||
1311 | {DCT4_ReplyTestsStartup, "\x35",0x02,0x01,ID_User3}, | ||
1312 | {DCT4_ReplyTestsStartup, "\x35",0x02,0x02,ID_User3}, | ||
1313 | {DCT4_ReplyTestsNames, "\x35",0x02,0x03,ID_User1}, | ||
1314 | {DCT4_ReplyTestsStatus, "\x35",0x02,0x04,ID_User2}, | ||
1315 | |||
1316 | {DCT4_ReplyTuneRadio, "\x3E",0x03,0x09,ID_User3}, | ||
1317 | {DCT4_ReplyTuneRadio, "\x3E",0x03,0x15,ID_User3}, | ||
1318 | {DCT4_ReplyTuneRadio, "\x3E",0x03,0x15,ID_SetFMStation}, | ||
1319 | {DCT4_ReplyTuneRadio, "\x3E",0x03,0x16,ID_User3}, | ||
1320 | |||
1321 | {DCT4_ReplyGetVoiceRecord, "\x4A",0x03,0x31,ID_User4}, | ||
1322 | |||
1323 | {DCT4_ReplyGetSimlock, "\x53",0x03,0x0D,ID_User6}, | ||
1324 | {DCT4_ReplyGetSimlock, "\x53",0x03,0x13,ID_User6}, | ||
1325 | |||
1326 | {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x03,ID_User3}, | ||
1327 | {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x07,ID_User3}, | ||
1328 | {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x08,ID_User3}, | ||
1329 | {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x0A,ID_User3}, | ||
1330 | {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0xF0,ID_User3}, | ||
1331 | |||
1332 | {DCT4_ReplyGetBTInfo, "\xD7",0x03,0x0A,ID_User6}, | ||
1333 | |||
1334 | {NULL, "\x00",0x00,0x00,ID_None} | ||
1335 | }; | ||
1336 | |||
1337 | #endif | ||
1338 | |||
1339 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
1340 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
1341 | */ | ||
diff --git a/gammu/emb/gammu/depend/nokia/dct4.h b/gammu/emb/gammu/depend/nokia/dct4.h new file mode 100644 index 0000000..fde5b08 --- a/dev/null +++ b/gammu/emb/gammu/depend/nokia/dct4.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | ||
2 | |||
3 | #include "../../../common/gsmstate.h" | ||
4 | |||
5 | void DCT4SetPhoneMenus (int argc, char *argv[]); | ||
6 | void DCT4SelfTests (int argc, char *argv[]); | ||
7 | void DCT4SetVibraLevel (int argc, char *argv[]); | ||
8 | void DCT4GetSecurityCode (int argc, char *argv[]); | ||
9 | #ifdef DEBUG | ||
10 | void DCT4ResetSecurityCode (int argc, char *argv[]); | ||
11 | #endif | ||
12 | void DCT4GetVoiceRecord (int argc, char *argv[]); | ||
13 | void DCT4Info (int argc, char *argv[]); | ||
14 | void DCT4GetT9 (int argc, char *argv[]); | ||
15 | void DCT4SetLight (int argc, char *argv[]); | ||
16 | void DCT4DisplayTest (int argc, char *argv[]); | ||
17 | void DCT4GetADC (int argc, char *argv[]); | ||
18 | void DCT4VibraTest (int argc, char *argv[]); | ||
19 | void DCT4TuneRadio (int argc, char *argv[]); | ||
20 | void DCT4PlaySavedRingtone (int argc, char *argv[]); | ||
21 | void DCT4MakeCameraShoot (int argc, char *argv[]); | ||
22 | void DCT4GetScreenDump (int argc, char *argv[]); | ||
23 | |||
24 | /* ------------------- features matrix ------------------------------------- */ | ||
25 | |||
26 | typedef enum { | ||
27 | DCT4_ALWAYS_ONLINE = 1, | ||
28 | DCT4_GPRS_PCCH, | ||
29 | DCT4_GEA1, | ||
30 | DCT4_EOTD, | ||
31 | DCT4_WAP_PUSH, | ||
32 | DCT4_USE_PREF_SIM_NET, | ||
33 | DCT4_JAVA_TCK, | ||
34 | |||
35 | DCT4_ALS, | ||
36 | DCT4_A52, | ||
37 | DCT4_CSP, | ||
38 | DCT4_EONS, | ||
39 | DCT4_3GINDICATOR, | ||
40 | DCT4_DISPLAY_PHONE_NAME, | ||
41 | DCT4_DISPLAY_WAP_PROFILE, | ||
42 | |||
43 | DCT4_GAMES_WAP_DOWNLOAD, | ||
44 | DCT4_GAMES_SCORE_SEND, | ||
45 | DCT4_GAMES_URL_CHECK, | ||
46 | |||
47 | DCT4_BLUETOOTH_MENU, | ||
48 | DCT4_WAP_BOOKMARKS_MENU, | ||
49 | DCT4_WAP_BOOKMARKS_MENU2, | ||
50 | DCT4_WAP_GOTO_MENU, | ||
51 | DCT4_WAP_SETTINGS_MENU, | ||
52 | DCT4_SERVICES_GAMES_APP_GALLERY, | ||
53 | DCT4_JAVA_GAMES_MENU, | ||
54 | DCT4_SAT_CONFIRM_MENU, | ||
55 | DCT4_INSTANT_MESS_MENU, | ||
56 | DCT4_CONFIRM_ALS, | ||
57 | DCT4_BOOKMARK_GOTO_MENU, | ||
58 | |||
59 | DCT4_5100_IDENTIFY, | ||
60 | |||
61 | DCT4_TEST | ||
62 | } DCT4_Feature_Name; | ||
63 | |||
64 | typedef struct { | ||
65 | DCT4_Feature_Name Name; | ||
66 | unsigned char *Text; | ||
67 | struct { | ||
68 | unsigned char Value; | ||
69 | unsigned char *Text; | ||
70 | } Values[10]; | ||
71 | } DCT4_Feature; | ||
72 | |||
73 | typedef struct { | ||
74 | char *Model; | ||
75 | struct { | ||
76 | DCT4_Feature_NameName; | ||
77 | int Number; | ||
78 | } Features[25]; | ||
79 | } DCT4_Phone_Features; | ||
80 | |||
81 | typedef struct { | ||
82 | struct { | ||
83 | char Name[100]; | ||
84 | unsigned char ID; | ||
85 | unsigned char Value; | ||
86 | bool Startup; | ||
87 | } Tests[50]; | ||
88 | int Num; | ||
89 | } DCT4_Phone_Tests; | ||
90 | |||
91 | /* ------------------------------------------------------------------------- */ | ||
92 | |||
93 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
94 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
95 | */ | ||
diff --git a/gammu/emb/gammu/depend/siemens/chiffre.c b/gammu/emb/gammu/depend/siemens/chiffre.c new file mode 100644 index 0000000..65a06ba --- a/dev/null +++ b/gammu/emb/gammu/depend/siemens/chiffre.c | |||
@@ -0,0 +1,223 @@ | |||
1 | /* xsiemens.c */ | ||
2 | /* Siemens service code generator */ | ||
3 | /* (C) Ivan Gorinov, 30.09.2002 */ | ||
4 | |||
5 | #include "chiffre.h" | ||
6 | |||
7 | unsigned char key1[4] = {0x57, 0xF9, 0x3A, 0xC1}; /* Level 1 key */ | ||
8 | unsigned char key2[4] = {0xA4, 0xD3, 0x67, 0x9C}; /* Level 2 key */ | ||
9 | |||
10 | /* 4-bit substitution boxes */ | ||
11 | unsigned char sbox_h[0x10] = | ||
12 | {0x09, 0x02, 0x04, 0x06, 0x08, 0x07, 0x05, 0x03, 0x01, 0x00, | ||
13 | 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; | ||
14 | unsigned char sbox_l[0x10] = | ||
15 | {0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, | ||
16 | 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; | ||
17 | |||
18 | unsigned char sbox[0x100]; /* 8-bit substitution box */ | ||
19 | |||
20 | char digit[] = "0123456789ABCDEF"; | ||
21 | |||
22 | /* Convert hex digit to binary value */ | ||
23 | int from_hex(int c) | ||
24 | { | ||
25 | int i; | ||
26 | |||
27 | for(i = 0; i < 0x10; i++) if(c == digit[i]) break; | ||
28 | if (i >= 0x10) i = -1; | ||
29 | return i; | ||
30 | } | ||
31 | |||
32 | /* Convert binary value to string (decimal) */ | ||
33 | int bin2dec(char *s, int n, unsigned long l) | ||
34 | { | ||
35 | int c, i, j; | ||
36 | |||
37 | j = n; | ||
38 | s[j] = 0; | ||
39 | for(i = 0; i < n; i++) { | ||
40 | c = l % 10; | ||
41 | l /= 10; | ||
42 | c = digit[c]; | ||
43 | s[--j] = c; | ||
44 | } | ||
45 | return j; | ||
46 | } | ||
47 | |||
48 | /* Convert two 4-bit boxes to one 8-bit */ | ||
49 | int initbox(void) | ||
50 | { | ||
51 | int i, j, k, x; | ||
52 | |||
53 | k = 0; | ||
54 | for(i = 0; i < 0x10; i++) { | ||
55 | x = sbox_h[i] << 4; | ||
56 | for(j = 0; j < 0x10; j++) { | ||
57 | sbox[k] = sbox_l[j] | x; | ||
58 | k++; | ||
59 | } | ||
60 | } | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | /* Substitution */ | ||
65 | void subst(unsigned char *b, unsigned char *a, int n) | ||
66 | { | ||
67 | int i; | ||
68 | |||
69 | for(i = 0; i < n; i++) b[i] = sbox[a[i]]; | ||
70 | } | ||
71 | |||
72 | /* Xor N bytes with Z, inverting every odd byte */ | ||
73 | void xxstr(unsigned char *b, unsigned char *a, int n, int z) | ||
74 | { | ||
75 | int i; | ||
76 | |||
77 | for(i = 0; i < n; i++) { | ||
78 | if(i & 1) { | ||
79 | b[i] = (~a[i]) ^ z; | ||
80 | } else { | ||
81 | b[i] = a[i] ^ z; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /* Encryption (1 iteration) */ | ||
87 | void ec_f(unsigned char *a, int n, int z) | ||
88 | { | ||
89 | unsigned char bc[0x20], bs[0x10], bx[0x10]; | ||
90 | int n2, i; | ||
91 | |||
92 | for(i = 0; i < n; i++) bc[i] = a[i]; | ||
93 | n2 = n >> 1; | ||
94 | subst(bs, a, n2); | ||
95 | xxstr(bx, bs, n2, z); | ||
96 | for(i = 0; i < n2; i++) { | ||
97 | a[i] = bx[i] ^ bc[i+n2]; | ||
98 | a[i+n2] = bc[i]; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | void ec_f_bak(unsigned char *a, int n, int z) | ||
103 | { | ||
104 | unsigned char bc[0x20], bs[0x10], bx[0x10]; | ||
105 | int n2, i; | ||
106 | |||
107 | n2 = n >> 1; | ||
108 | for(i = 0; i < n2; i++) bc[i+n2] = a[i]; | ||
109 | subst(bs, bc + n2, n2); | ||
110 | xxstr(bx, bs, n2, z); | ||
111 | for(i = 0; i < n2; i++) bc[i] = bx[i] ^ a[i+n2]; | ||
112 | for(i = 0; i < n; i++) a[i] = bc[i]; | ||
113 | } | ||
114 | |||
115 | /* Decryption (1 iteration) */ | ||
116 | void dc_f(unsigned char *a, int n, int z) | ||
117 | { | ||
118 | unsigned char bc[0x20], bs[0x10], bx[0x10]; | ||
119 | int n2, i; | ||
120 | |||
121 | for(i = 0; i < n; i++) bc[i] = a[i]; | ||
122 | n2 = n >> 1; | ||
123 | subst(bs, a + n2, n2); | ||
124 | xxstr(bx, bs, n2, z); | ||
125 | for(i = 0; i < n2; i++) { | ||
126 | a[i] = bc[i+n2]; | ||
127 | a[i+n2] = bx[i] ^ bc[i]; | ||
128 | } | ||
129 | } | ||
130 | |||
131 | /* Encryption (IMSI -> code) */ | ||
132 | void ss_encrypt(unsigned char *a, int n, unsigned char *key) | ||
133 | { | ||
134 | int i; | ||
135 | |||
136 | for(i = 0; i < 4; i++) ec_f_bak(a, n, key[i]); | ||
137 | } | ||
138 | |||
139 | /* Decryption (code -> IMSI) */ | ||
140 | void ss_decrypt(unsigned char *a, int n, unsigned char *key) | ||
141 | { | ||
142 | int i; | ||
143 | |||
144 | for(i = 0; i < 4; i++) dc_f(a, n, key[3-i]); | ||
145 | } | ||
146 | |||
147 | int siemens_code(char *str_imsi, char *str_code, int level) | ||
148 | { | ||
149 | unsigned char array[8]; | ||
150 | unsigned char xcode[8]; | ||
151 | unsigned char test[8]; | ||
152 | unsigned long l0, l1; | ||
153 | unsigned char *key; | ||
154 | int x, c, i, j; | ||
155 | |||
156 | if(!str_code) return -1; | ||
157 | str_code[0] = 0; | ||
158 | |||
159 | initbox(); | ||
160 | |||
161 | switch(level) { | ||
162 | case 1: key = key1; break; | ||
163 | case 2: key = key2; break; | ||
164 | default: return -1; | ||
165 | } | ||
166 | |||
167 | /* Check the length of IMSI */ | ||
168 | for(i = 0; i < 32; i++) if(!str_imsi[i]) break; | ||
169 | if(i == 0) return -1; | ||
170 | if(i >= 32) return -1; | ||
171 | |||
172 | /* Convert last 12 digits to 6 bytes [2-7] */ | ||
173 | for(j = 7; j >= 2; j--) { | ||
174 | if (i == 0) { | ||
175 | c = 0x0F; | ||
176 | } else { | ||
177 | c = str_imsi[--i]; | ||
178 | c = from_hex(c); | ||
179 | if(c < 0) return -1; | ||
180 | } | ||
181 | x = c; | ||
182 | if(i == 0) { | ||
183 | c = 0x0F; | ||
184 | } else { | ||
185 | c = str_imsi[--i]; | ||
186 | c = from_hex(c); | ||
187 | if(c < 0) return -1; | ||
188 | } | ||
189 | x = (x << 4) | c; | ||
190 | array[j] = x; | ||
191 | } | ||
192 | |||
193 | /* This byte is never checked by firmware */ | ||
194 | array[1] = 0; | ||
195 | |||
196 | /* Byte [0] <- checksum */ | ||
197 | x = 0; | ||
198 | for(i = 1; i < 8; i++) x ^= array[i]; | ||
199 | array[0] = x; | ||
200 | |||
201 | for(i = 0; i < 8; i++) xcode[i] = array[i]; | ||
202 | |||
203 | /* Make the code */ | ||
204 | ss_encrypt(xcode, 8, key); | ||
205 | |||
206 | /* The test */ | ||
207 | for(i = 0; i < 8; i++) test[i] = xcode[i]; | ||
208 | ss_decrypt(test, 8, key); | ||
209 | for(i = 0; i < 8; i++) if(test[i] != array[i]) break; | ||
210 | if(i < 8) return -1; | ||
211 | |||
212 | /* Convert to strings */ | ||
213 | l0 = 0; | ||
214 | for(i = 3; i >= 0; i--) l0 = (l0 << 8) | xcode[i]; | ||
215 | |||
216 | l1 = 0; | ||
217 | for(i = 7; i >= 4; i--) l1 = (l1 << 8) | xcode[i]; | ||
218 | |||
219 | bin2dec(str_code, 10, l0); | ||
220 | bin2dec(str_code + 10, 10, l1); | ||
221 | |||
222 | return 0; | ||
223 | } | ||
diff --git a/gammu/emb/gammu/depend/siemens/chiffre.h b/gammu/emb/gammu/depend/siemens/chiffre.h new file mode 100644 index 0000000..840157a --- a/dev/null +++ b/gammu/emb/gammu/depend/siemens/chiffre.h | |||
@@ -0,0 +1,3 @@ | |||
1 | /* xsiemens.h */ | ||
2 | |||
3 | int siemens_code(char*, char*, int); | ||
diff --git a/gammu/emb/gammu/depend/siemens/dsiemens.c b/gammu/emb/gammu/depend/siemens/dsiemens.c new file mode 100644 index 0000000..dc54102 --- a/dev/null +++ b/gammu/emb/gammu/depend/siemens/dsiemens.c | |||
@@ -0,0 +1,363 @@ | |||
1 | /* (c) by Walek */ | ||
2 | |||
3 | #include "../../../common/gsmstate.h" | ||
4 | |||
5 | #ifdef GSM_ENABLE_ATGEN | ||
6 | |||
7 | #include <string.h> | ||
8 | |||
9 | #include "../../../common/misc/coding/coding.h" | ||
10 | #include "../../../common/gsmcomon.h" | ||
11 | #include "../../../common/service/gsmnet.h" | ||
12 | #include "../../../common/phone/at/atgen.h" | ||
13 | #include "../../gammu.h" | ||
14 | #include "dsiemens.h" | ||
15 | #include "chiffre.h" | ||
16 | |||
17 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); | ||
18 | extern GSM_Error ATGEN_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *status); | ||
19 | extern GSM_Error ATGEN_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *pbk); | ||
20 | extern GSM_Reply_Function UserReplyFunctionsAtS[]; | ||
21 | |||
22 | bool new_variable; | ||
23 | GSM_Error CheckSiemens() | ||
24 | { | ||
25 | if (s.Phone.Data.Priv.ATGEN.Manufacturer != AT_Siemens) return ERR_NOTSUPPORTED; | ||
26 | return ERR_NONE; | ||
27 | } | ||
28 | |||
29 | GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
30 | { | ||
31 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | ||
32 | GSM_SAT_Measure_results MeasureResult; | ||
33 | unsigned char buf[256]; | ||
34 | int length,i,rep,ChNo=1,j=0,result=0,origARFCN=0; | ||
35 | int freq_tmp,frequency[24]; | ||
36 | GSM_NetworkInfo Network; | ||
37 | |||
38 | if (Priv->ReplyState!=AT_Reply_OK) return ERR_UNKNOWN; | ||
39 | if (s->Protocol.Data.AT.EditMode) s->Protocol.Data.AT.EditMode = false; | ||
40 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"SSTK")) { | ||
41 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,2))-7; | ||
42 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,2)+7,length); | ||
43 | if (buf[0]==0x7f) { | ||
44 | new_variable=true; | ||
45 | return ERR_NONE; | ||
46 | } | ||
47 | else return ERR_UNKNOWN; | ||
48 | } | ||
49 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,3),"SSTK")) return ERR_UNKNOWN; | ||
50 | |||
51 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,3))-7; | ||
52 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,3)+7,length); | ||
53 | |||
54 | if (buf[3]!=0x26) return ERR_UNKNOWN; | ||
55 | |||
56 | #ifdef DEBUG | ||
57 | dbgprintf ("SAT command: Provide Local Information\nFunction: "); | ||
58 | switch (buf[4]) { | ||
59 | case 00: dbgprintf ("Loc Info\n"); break; | ||
60 | case 01: dbgprintf ("IMEI\n"); break; | ||
61 | case 02: dbgprintf ("Network Measure\n"); break; | ||
62 | case 03: dbgprintf ("Date time and timezone\n");break; | ||
63 | case 04: dbgprintf ("Language setting\n"); break; | ||
64 | case 05: dbgprintf ("Timing advance\n"); break; | ||
65 | } | ||
66 | #endif | ||
67 | /* Loc Info (MCC, MNC, LAC, Cell ID) */ | ||
68 | if (buf[4]==00) { | ||
69 | DecodeBCD (Network.NetworkCode,buf+14,2); | ||
70 | Network.NetworkCode[3] = ' '; | ||
71 | DecodeBCD (Network.NetworkCode+4,buf+16,1); | ||
72 | EncodeHexBin (Network.LAC,buf+17,2); | ||
73 | EncodeHexBin (Network.CID,buf+19,2); | ||
74 | |||
75 | printf(" Network code : %s\n",Network.NetworkCode); | ||
76 | printf(" Network name for Gammu : %s\n", | ||
77 | DecodeUnicodeString(GSM_GetNetworkName(Network.NetworkCode))); | ||
78 | printf(" CID : %s\n",Network.CID); | ||
79 | printf(" LAC : %s\n",Network.LAC); | ||
80 | } | ||
81 | |||
82 | /* Network Measure */ | ||
83 | if (buf[4]==02) { | ||
84 | |||
85 | for (i=0;i<24;i++) frequency[i]=0; | ||
86 | if (!new_variable) { | ||
87 | GetBufferI(buf+32,&j,&result,7); | ||
88 | result &= 0x67; | ||
89 | if (result !=0x47) return ERR_NOTSUPPORTED; | ||
90 | } | ||
91 | #ifdef DEBUG | ||
92 | if (new_variable)dbgprintf ("New variable Bitmap format\n"); | ||
93 | else dbgprintf ("Old variable Bitmap format\n"); | ||
94 | #endif | ||
95 | GetBufferI(buf+32,&j,&origARFCN,10); | ||
96 | /* 10 bit origin ARFCN or first frequency (new variable format) */ | ||
97 | #ifdef DEBUG | ||
98 | dbgprintf("Origin BCCH = %i\n",origARFCN); | ||
99 | #endif | ||
100 | rep = buf[31]*8; | ||
101 | if (!new_variable ){ | ||
102 | for (i=0;i<rep;i++){ | ||
103 | result = 0; | ||
104 | GetBufferI(buf+32,&j,&result,1); | ||
105 | if (result) { | ||
106 | frequency[ChNo]=i+origARFCN+1; | ||
107 | ChNo++; | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | else { | ||
112 | frequency[ChNo++]=origARFCN; | ||
113 | for (i=0; i<rep; i+=10){ | ||
114 | result = 0; | ||
115 | GetBufferI(buf+32,&j,&result,10); | ||
116 | if (!result) break; | ||
117 | frequency[ChNo++]=result; | ||
118 | } | ||
119 | j=1; | ||
120 | while (j) { | ||
121 | j=0; | ||
122 | for (i=0; i<ChNo-1; i++){ | ||
123 | if (frequency[i] > frequency[i+1]){ | ||
124 | freq_tmp=frequency[i]; | ||
125 | frequency[i]=frequency[i+1]; | ||
126 | frequency[i+1]=freq_tmp; | ||
127 | j=1; | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | }; | ||
132 | #ifdef DEBUG | ||
133 | dbgprintf("Neighbor BCCH list: "); | ||
134 | for (i=1;i<ChNo;i++) dbgprintf ("%d ",frequency[i]); | ||
135 | dbgprintf ("\n"); | ||
136 | #endif | ||
137 | j= 0; | ||
138 | result= 0; | ||
139 | GetBufferI(buf+14,&j,&result,1); | ||
140 | if (result) MeasureResult.BA_used=true; | ||
141 | else MeasureResult.BA_used=false; | ||
142 | |||
143 | result= 0; | ||
144 | GetBufferI(buf+14,&j,&result,1); | ||
145 | if (result) MeasureResult.DTX_used=true; | ||
146 | else MeasureResult.DTX_used=false; | ||
147 | |||
148 | result= 0; | ||
149 | GetBufferI(buf+14,&j,&result,6); | ||
150 | MeasureResult.RXLEV_FullServicingCell=result-110; | ||
151 | |||
152 | j++;//skip spare bit | ||
153 | result= 0; | ||
154 | GetBufferI(buf+14,&j,&result,1); | ||
155 | if (result) MeasureResult.MeasValid=true; | ||
156 | else MeasureResult.MeasValid=false; | ||
157 | |||
158 | result= 0; | ||
159 | GetBufferI(buf+14,&j,&result,6); | ||
160 | MeasureResult.RXLEV_SubServicingCell=result-110; | ||
161 | |||
162 | j++;//skip spare bit | ||
163 | result= 0; | ||
164 | GetBufferI(buf+14,&j,&result,3); | ||
165 | MeasureResult.RXQUAL_FullServicingCell=result; | ||
166 | |||
167 | result= 0; | ||
168 | GetBufferI(buf+14,&j,&result,3); | ||
169 | MeasureResult.RXQUAL_SubServicingCell=result; | ||
170 | |||
171 | printf ("RX Level FULL Servicing Cell = %i\n",MeasureResult.RXLEV_FullServicingCell); | ||
172 | printf ("RX Level Sub Servicing Cell = %i\n",MeasureResult.RXLEV_FullServicingCell); | ||
173 | |||
174 | printf ("RX Quality Full Servicing Cell = %i\n",MeasureResult.RXQUAL_FullServicingCell); | ||
175 | printf ("RX Quality Sub Servicing Cell = %i\n",MeasureResult.RXQUAL_SubServicingCell); | ||
176 | |||
177 | result= 0; | ||
178 | GetBufferI(buf+14,&j,&result,3); | ||
179 | MeasureResult.NO_NCELL_M=result; | ||
180 | |||
181 | rep=MeasureResult.NO_NCELL_M; | ||
182 | |||
183 | for (i=0;i<MeasureResult.NO_NCELL_M;i++) { | ||
184 | result= 0; | ||
185 | GetBufferI(buf+14,&j,&result,6); | ||
186 | MeasureResult.NeighbourCell[i].RxLev = result-110; | ||
187 | |||
188 | result= 0; | ||
189 | GetBufferI(buf+14,&j,&result,5); | ||
190 | if (new_variable) | ||
191 | MeasureResult.NeighbourCell[i].ChFreq = frequency[result+1]; | ||
192 | else MeasureResult.NeighbourCell[i].ChFreq = frequency[result]; | ||
193 | |||
194 | result= 0; | ||
195 | GetBufferI(buf+14,&j,&result,3); | ||
196 | MeasureResult.NeighbourCell[i].NB = 10 * result; | ||
197 | result= 0; | ||
198 | GetBufferI(buf+14,&j,&result,3); | ||
199 | MeasureResult.NeighbourCell[i].NB += result; | ||
200 | |||
201 | if (MeasureResult.NeighbourCell[i].ChFreq) | ||
202 | printf("CH = %i,\t",MeasureResult.NeighbourCell[i].ChFreq); | ||
203 | else | ||
204 | printf("CH = Unknown\t"); | ||
205 | printf("RX Lev = %i dBm\t",MeasureResult.NeighbourCell[i].RxLev); | ||
206 | printf("BSIC CELL = %i\n",MeasureResult.NeighbourCell[i].NB); | ||
207 | } | ||
208 | } | ||
209 | #ifdef DEBUG | ||
210 | if (buf[4]==05) { //Timing Advance | ||
211 | if (buf[11]) dbgprintf ("Unknown Timing Advance\n"); | ||
212 | else dbgprintf ("Timing Advance = %i\n",buf[14] & 0x3f); | ||
213 | } | ||
214 | #endif | ||
215 | return ERR_NONE; | ||
216 | } | ||
217 | |||
218 | GSM_Error ATSIEMENS_Reply_GetNetmon(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
219 | { | ||
220 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
221 | int i=2; | ||
222 | |||
223 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,1),"AT^S^MI")) return ERR_UNKNOWN; | ||
224 | while (strlen(GetLineString(msg.Buffer,Priv->Lines,i+1))) | ||
225 | printf("%s\n",GetLineString(msg.Buffer,Priv->Lines,i++)); | ||
226 | printf("\n"); | ||
227 | return ERR_NONE; | ||
228 | } | ||
229 | |||
230 | GSM_Error ATSIEMENS_GetSAT(GSM_StateMachine *s) | ||
231 | { | ||
232 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
233 | GSM_Error error; | ||
234 | unsigned char *reqSAT[]= {"D009810301260082028182", | ||
235 | "D009810301260282028182", | ||
236 | "D009810301260582028182"},req[32]; | ||
237 | int i,len; | ||
238 | |||
239 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
240 | |||
241 | sprintf(req, "AT^SSTK=?\r"); | ||
242 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_User1); | ||
243 | |||
244 | for (i=0;i<3;i++){ | ||
245 | len = strlen(reqSAT[i]); | ||
246 | s->Protocol.Data.AT.EditMode = true; | ||
247 | sprintf(req, "AT^SSTK=%i,1\r",len/2); | ||
248 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_User1); | ||
249 | s->Phone.Data.DispatchError= ERR_TIMEOUT; | ||
250 | s->Phone.Data.RequestID = ID_User1; | ||
251 | error = s->Protocol.Functions->WriteMessage(s, reqSAT[i], len, 0x00); | ||
252 | if (error!=ERR_NONE) return error; | ||
253 | error = s->Protocol.Functions->WriteMessage(s, "\x1A", 1, 0x00); | ||
254 | if (error!=ERR_NONE) return error; | ||
255 | error = GSM_WaitForOnce (s, NULL,0x00, 0x00, 4); | ||
256 | if (error!=ERR_NONE) return error; | ||
257 | } | ||
258 | return ERR_NONE; | ||
259 | } | ||
260 | |||
261 | GSM_Error ATSIEMENS_GetNetmon(GSM_StateMachine *s,int test_no) | ||
262 | { | ||
263 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
264 | unsigned char req[32]; | ||
265 | |||
266 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
267 | sprintf(req, "AT^S^MI=%d\r",test_no); | ||
268 | printf ("Siemens NetMonitor test #%i\n",test_no); | ||
269 | return GSM_WaitFor(s, req, strlen(req), 0x00, 3, ID_User2); | ||
270 | } | ||
271 | |||
272 | GSM_Error ATSIEMENS_ActivateNetmon (GSM_StateMachine *s,int netmon_type) | ||
273 | { | ||
274 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
275 | unsigned char req[32]; | ||
276 | |||
277 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
278 | |||
279 | sprintf(req, "AT\r"); | ||
280 | printf ("Activate Siemens NetMonitor\n"); | ||
281 | siemens_code (req,req,2); | ||
282 | |||
283 | return GSM_WaitFor(s, req, strlen(req), 0x00, 3, ID_User2); | ||
284 | } | ||
285 | |||
286 | void ATSIEMENSActivateNetmon(int argc, char *argv[]) | ||
287 | { | ||
288 | GSM_MemoryStatus status; | ||
289 | GSM_MemoryEntry pbk; | ||
290 | int netmon_type, pbk_maxlocation; | ||
291 | char imsi[15], NetMonCode[32]; | ||
292 | |||
293 | GSM_Init(true); | ||
294 | if (CheckSiemens()==ERR_NOTSUPPORTED) Print_Error(ERR_NOTSUPPORTED); | ||
295 | s.User.UserReplyFunctions=UserReplyFunctionsAtS; | ||
296 | |||
297 | printf ("Activate NetMonitor...\n"); | ||
298 | netmon_type = atoi(argv[2]); | ||
299 | |||
300 | if ((netmon_type==1) || (netmon_type==2)) { | ||
301 | error = ATGEN_GetSIMIMSI (&s,imsi); | ||
302 | Print_Error(error); | ||
303 | siemens_code(imsi,NetMonCode,netmon_type); | ||
304 | |||
305 | status.MemoryType = MEM_SM; | ||
306 | error = ATGEN_GetMemoryStatus (&s,&status); | ||
307 | Print_Error(error); | ||
308 | |||
309 | pbk_maxlocation = status.MemoryUsed+status.MemoryFree; | ||
310 | pbk.MemoryType = MEM_SM; | ||
311 | pbk.Location = pbk_maxlocation; | ||
312 | pbk.EntriesNum = 2; | ||
313 | pbk.Entries[0].EntryType = PBK_Number_General; | ||
314 | EncodeUnicode (pbk.Entries[0].Text,NetMonCode,strlen(NetMonCode)); | ||
315 | pbk.Entries[1].EntryType = PBK_Text_Name; | ||
316 | sprintf (NetMonCode,"Net Monitor"); | ||
317 | EncodeUnicode (pbk.Entries[1].Text,NetMonCode,strlen(NetMonCode)); | ||
318 | error = ATGEN_SetMemory (&s, &pbk); | ||
319 | Print_Error(error); | ||
320 | } | ||
321 | else printf ("NetMonitor type should be:\n1 - full Netmon\n2 - simple NetMon\n"); | ||
322 | |||
323 | GSM_Terminate(); | ||
324 | } | ||
325 | |||
326 | void ATSIEMENSSATNetmon(int argc, char *argv[]) | ||
327 | { | ||
328 | GSM_Init(true); | ||
329 | if (CheckSiemens()==ERR_NOTSUPPORTED) Print_Error(ERR_NOTSUPPORTED); | ||
330 | s.User.UserReplyFunctions=UserReplyFunctionsAtS; | ||
331 | |||
332 | printf ("Getting Siemens Sim Aplication Toolkit NetMonitor...\n"); | ||
333 | |||
334 | error=ATSIEMENS_GetSAT(&s); | ||
335 | Print_Error(error); | ||
336 | GSM_Terminate(); | ||
337 | } | ||
338 | |||
339 | void ATSIEMENSNetmonitor(int argc, char *argv[]) | ||
340 | { | ||
341 | int test_no; | ||
342 | |||
343 | GSM_Init(true); | ||
344 | if (CheckSiemens()==ERR_NOTSUPPORTED) Print_Error(ERR_NOTSUPPORTED); | ||
345 | s.User.UserReplyFunctions=UserReplyFunctionsAtS; | ||
346 | |||
347 | printf ("Getting Siemens NetMonitor...\n"); | ||
348 | test_no = atoi(argv[2]); | ||
349 | error = ATSIEMENS_GetNetmon (&s,test_no+1); | ||
350 | Print_Error(error); | ||
351 | GSM_Terminate(); | ||
352 | } | ||
353 | |||
354 | static GSM_Reply_Function UserReplyFunctionsAtS[] = { | ||
355 | {ATSIEMENS_Reply_GetSAT, "AT^SSTK", 0x00,0x00,ID_User1}, | ||
356 | {ATSIEMENS_Reply_GetNetmon, "AT^S^MI", 0x00,0x00,ID_User2}, | ||
357 | {NULL, "\x00", 0x00,0x00,ID_None} | ||
358 | }; | ||
359 | #endif | ||
360 | |||
361 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
362 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
363 | */ | ||
diff --git a/gammu/emb/gammu/depend/siemens/dsiemens.h b/gammu/emb/gammu/depend/siemens/dsiemens.h new file mode 100644 index 0000000..3db1c30 --- a/dev/null +++ b/gammu/emb/gammu/depend/siemens/dsiemens.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* (c) by Walek */ | ||
2 | |||
3 | #ifndef at_siemens_h | ||
4 | #define at_siemens_h | ||
5 | |||
6 | typedef struct { | ||
7 | intChFreq; | ||
8 | intRxLev; | ||
9 | intNB; | ||
10 | } GSM_SAT_ChInfo; | ||
11 | |||
12 | typedef struct { | ||
13 | bool BA_used; | ||
14 | bool DTX_used; | ||
15 | bool MeasValid; | ||
16 | int RXLEV_FullServicingCell; | ||
17 | int RXLEV_SubServicingCell; | ||
18 | unsigned charRXQUAL_FullServicingCell; | ||
19 | unsigned charRXQUAL_SubServicingCell; | ||
20 | unsigned charNO_NCELL_M; | ||
21 | GSM_SAT_ChInfoNeighbourCell[8]; | ||
22 | } GSM_SAT_Measure_results; | ||
23 | |||
24 | void ATSIEMENSSATNetmon(int argc, char *argv[]); | ||
25 | void ATSIEMENSNetmonitor(int argc, char *argv[]); | ||
26 | void ATSIEMENSActivateNetmon(int argc, char *argv[]); | ||
27 | |||
28 | #include "../../../common/gsmstate.h" | ||
29 | |||
30 | #endif | ||
31 | |||
32 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
33 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
34 | */ | ||
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c new file mode 100644 index 0000000..1d53fb0 --- a/dev/null +++ b/gammu/emb/gammu/gammu.c | |||
@@ -0,0 +1,8356 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ | ||
2 | /* FM stuff by Walek */ | ||
3 | |||
4 | #include <string.h> | ||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include <stdarg.h> | ||
8 | #include <locale.h> | ||
9 | #include <signal.h> | ||
10 | #include <ctype.h> | ||
11 | #include <wchar.h> | ||
12 | #undef HAVE_MYSQL_MYSQL_H | ||
13 | #ifdef WIN32 | ||
14 | # include <windows.h> | ||
15 | # include <process.h> | ||
16 | # ifdef _MSC_VER | ||
17 | # include <sys/utime.h> | ||
18 | # else | ||
19 | # include <utime.h> | ||
20 | # endif | ||
21 | #else | ||
22 | # include <utime.h> | ||
23 | #endif | ||
24 | |||
25 | #include "../common/gammu.h" | ||
26 | #include "gammu.h" | ||
27 | #include "smsd/smsdcore.h" | ||
28 | #ifdef DEBUG | ||
29 | # include "sniff.h" | ||
30 | #endif | ||
31 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
32 | # include "depend/nokia/dct3.h" | ||
33 | # include "depend/nokia/dct3trac/wmx.h" | ||
34 | #endif | ||
35 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
36 | # include "depend/nokia/dct4.h" | ||
37 | #endif | ||
38 | #ifdef GSM_ENABLE_ATGEN | ||
39 | # include "depend/siemens/dsiemens.h" | ||
40 | #endif | ||
41 | |||
42 | #ifdef HAVE_PTHREAD | ||
43 | # include <pthread.h> | ||
44 | #endif | ||
45 | |||
46 | #ifdef HAVE_SYS_IOCTL_H | ||
47 | # include <sys/ioctl.h> | ||
48 | #endif | ||
49 | |||
50 | |||
51 | //static GSM_StateMachine s; | ||
52 | //static GSM_Phone_Functions *Phone; | ||
53 | static INI_Section *cfg = NULL; | ||
54 | |||
55 | //static GSM_Error error = ERR_NONE; | ||
56 | static int i; | ||
57 | |||
58 | //static bool gshutdown = false; | ||
59 | typedef struct { | ||
60 | unsigned char Connection[50]; | ||
61 | } OneConnectionInfo; | ||
62 | |||
63 | typedef struct { | ||
64 | unsigned char Device[50]; | ||
65 | OneConnectionInfo Connections[6]; | ||
66 | //GSM_StateMachines; | ||
67 | } OneDeviceInfo; | ||
68 | |||
69 | static int num; | ||
70 | static OneDeviceInfo SearchDevices[100]; | ||
71 | static bool SearchOutput; | ||
72 | void interrupt(int sign) | ||
73 | { | ||
74 | signal(sign, SIG_IGN); | ||
75 | gshutdown = true; | ||
76 | } | ||
77 | |||
78 | #ifdef __GNUC__ | ||
79 | __attribute__((format(printf, 1, 2))) | ||
80 | #endif | ||
81 | int printmsg(char *format, ...) | ||
82 | { | ||
83 | va_list argp; | ||
84 | int result; | ||
85 | |||
86 | va_start(argp, format); | ||
87 | result = vfprintf(stdout,GetMsg(s.msg,format),argp); | ||
88 | va_end(argp); | ||
89 | return result; | ||
90 | } | ||
91 | |||
92 | #ifdef __GNUC__ | ||
93 | __attribute__((format(printf, 1, 2))) | ||
94 | #endif | ||
95 | int printmsgerr(char *format, ...) | ||
96 | { | ||
97 | va_list argp; | ||
98 | int result; | ||
99 | |||
100 | va_start(argp, format); | ||
101 | result = vfprintf(stderr,GetMsg(s.msg,format), argp); | ||
102 | va_end(argp); | ||
103 | return result; | ||
104 | } | ||
105 | |||
106 | static void PrintSecurityStatus() | ||
107 | { | ||
108 | GSM_SecurityCodeType Status; | ||
109 | |||
110 | error=Phone->GetSecurityStatus(&s,&Status); | ||
111 | Print_Error(error); | ||
112 | switch(Status) { | ||
113 | case SEC_SecurityCode: | ||
114 | printmsg("Waiting for Security Code.\n"); | ||
115 | break; | ||
116 | case SEC_Pin: | ||
117 | printmsg("Waiting for PIN.\n"); | ||
118 | break; | ||
119 | case SEC_Pin2: | ||
120 | printmsg("Waiting for PIN2.\n"); | ||
121 | break; | ||
122 | case SEC_Puk: | ||
123 | printmsg("Waiting for PUK.\n"); | ||
124 | break; | ||
125 | case SEC_Puk2: | ||
126 | printmsg("Waiting for PUK2.\n"); | ||
127 | break; | ||
128 | case SEC_None: | ||
129 | printmsg("Nothing to enter.\n"); | ||
130 | break; | ||
131 | default: | ||
132 | printmsg("Unknown\n"); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | void Print_Error(GSM_Error error) | ||
137 | { | ||
138 | if (error != ERR_NONE) { | ||
139 | printf("%s\n",print_error(error,s.di.df,s.msg)); | ||
140 | if (error == ERR_SECURITYERROR) { | ||
141 | printmsg("Security status: "); | ||
142 | PrintSecurityStatus(); | ||
143 | } | ||
144 | if (s.opened) GSM_TerminateConnection(&s); | ||
145 | exit (-1); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | void GSM_Init(bool checkerror) | ||
150 | { | ||
151 | error=GSM_InitConnection(&s,3); | ||
152 | if (checkerror) Print_Error(error); | ||
153 | |||
154 | Phone=s.Phone.Functions; | ||
155 | } | ||
156 | |||
157 | void GSM_Terminate(void) | ||
158 | { | ||
159 | error=GSM_TerminateConnection(&s); | ||
160 | Print_Error(error); | ||
161 | } | ||
162 | |||
163 | static void GetStartStop(int *start, int *stop, int num, int argc, char *argv[]) | ||
164 | { | ||
165 | *start=atoi(argv[num]); | ||
166 | if (*start==0) { | ||
167 | printmsg("ERROR: enumerate locations from 1\n"); | ||
168 | exit (-1); | ||
169 | } | ||
170 | |||
171 | if (stop!=NULL) { | ||
172 | *stop=*start; | ||
173 | if (argc>=num+2) *stop=atoi(argv[num+1]); | ||
174 | if (*stop==0) { | ||
175 | printmsg("ERROR: enumerate locations from 1\n"); | ||
176 | exit (-1); | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | |||
181 | bool always_answer_yes = false; | ||
182 | bool always_answer_no = false; | ||
183 | |||
184 | static bool answer_yes(char *text) | ||
185 | { | ||
186 | int len; | ||
187 | char ans[99]; | ||
188 | |||
189 | while (1) { | ||
190 | printmsgerr("%s (yes/no/ALL/ONLY/NONE) ? ",text); | ||
191 | if (always_answer_yes) { | ||
192 | printmsgerr("YES (always)\n"); | ||
193 | return true; | ||
194 | } | ||
195 | if (always_answer_no) { | ||
196 | printmsgerr("NO (always)\n"); | ||
197 | return false; | ||
198 | } | ||
199 | len=GetLine(stdin, ans, 99); | ||
200 | if (len==-1) exit(-1); | ||
201 | if (!strcmp(ans, "NONE")) { | ||
202 | always_answer_no = true; | ||
203 | return false; | ||
204 | } | ||
205 | if (!strcmp(ans, "ONLY")) { | ||
206 | always_answer_no = true; | ||
207 | return true; | ||
208 | } | ||
209 | if (!strcmp(ans, "ALL")) { | ||
210 | always_answer_yes = true; | ||
211 | return true; | ||
212 | } | ||
213 | if (mystrncasecmp(ans, "yes",0)) return true; | ||
214 | if (mystrncasecmp(ans, "no" ,0)) return false; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | #ifdef GSM_ENABLE_BEEP | ||
219 | void GSM_PhoneBeep(void) | ||
220 | { | ||
221 | error = PHONE_Beep(&s); | ||
222 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
223 | } | ||
224 | #endif | ||
225 | |||
226 | static GSM_Error GSM_PlayRingtone(GSM_Ringtone ringtone) | ||
227 | { | ||
228 | int i; | ||
229 | bool first=true; | ||
230 | GSM_Error error; | ||
231 | |||
232 | signal(SIGINT, interrupt); | ||
233 | printmsg("Press Ctrl+C to break...\n"); | ||
234 | |||
235 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | ||
236 | if (gshutdown) break; | ||
237 | if (ringtone.NoteTone.Commands[i].Type != RING_NOTETONE) continue; | ||
238 | error=PHONE_RTTLPlayOneNote(&s,ringtone.NoteTone.Commands[i].Note,first); | ||
239 | if (error!=ERR_NONE) return error; | ||
240 | first = false; | ||
241 | } | ||
242 | |||
243 | /* Disables buzzer */ | ||
244 | return s.Phone.Functions->PlayTone(&s,255*255,0,false); | ||
245 | } | ||
246 | static void PlayRingtone(int argc, char *argv[]) | ||
247 | { | ||
248 | GSM_Ringtone ringtone,ringtone2; | ||
249 | |||
250 | ringtone.Format= 0; | ||
251 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | ||
252 | Print_Error(error); | ||
253 | |||
254 | error=GSM_RingtoneConvert(&ringtone2,&ringtone,RING_NOTETONE); | ||
255 | Print_Error(error); | ||
256 | |||
257 | GSM_Init(true); | ||
258 | |||
259 | error=GSM_PlayRingtone(ringtone2); | ||
260 | Print_Error(error); | ||
261 | |||
262 | GSM_Terminate(); | ||
263 | } | ||
264 | |||
265 | static void Identify(int argc, char *argv[]) | ||
266 | { | ||
267 | unsigned char buffer[100]; | ||
268 | |||
269 | GSM_Init(true); | ||
270 | |||
271 | error=Phone->GetManufacturer(&s); | ||
272 | Print_Error(error); | ||
273 | printmsg("Manufacturer : %s\n", s.Phone.Data.Manufacturer); | ||
274 | error=Phone->GetModel(&s); | ||
275 | Print_Error(error); | ||
276 | printmsg("Model : %s (%s)\n", | ||
277 | s.Phone.Data.ModelInfo->model, | ||
278 | s.Phone.Data.Model); | ||
279 | |||
280 | error=Phone->GetFirmware(&s); | ||
281 | Print_Error(error); | ||
282 | printmsg("Firmware : %s",s.Phone.Data.Version); | ||
283 | error=Phone->GetPPM(&s, buffer); | ||
284 | if (error != ERR_NOTSUPPORTED) { | ||
285 | if (error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
286 | if (error == ERR_NONE) printmsg(" %s",buffer); | ||
287 | } | ||
288 | if (s.Phone.Data.VerDate[0]!=0) printmsg(" (%s)",s.Phone.Data.VerDate); | ||
289 | printf("\n"); | ||
290 | |||
291 | error=Phone->GetHardware(&s, buffer); | ||
292 | if (error != ERR_NOTSUPPORTED) { | ||
293 | if (error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
294 | if (error == ERR_NONE) printmsg("Hardware : %s\n",buffer); | ||
295 | } | ||
296 | |||
297 | error=Phone->GetIMEI(&s); | ||
298 | if (error != ERR_NOTSUPPORTED) { | ||
299 | if (error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
300 | if (error == ERR_NONE) printmsg("IMEI : %s\n",s.Phone.Data.IMEI); | ||
301 | |||
302 | error=Phone->GetOriginalIMEI(&s, buffer); | ||
303 | if (error != ERR_NOTSUPPORTED && error != ERR_SECURITYERROR) { | ||
304 | if (error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
305 | if (error == ERR_NONE) printmsg("Original IMEI : %s\n",buffer); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | error=Phone->GetManufactureMonth(&s, buffer); | ||
310 | if (error != ERR_NOTSUPPORTED && error != ERR_SECURITYERROR) { | ||
311 | if (error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
312 | if (error == ERR_NONE) printmsg("Manufactured : %s\n",buffer); | ||
313 | } | ||
314 | |||
315 | error=Phone->GetProductCode(&s, buffer); | ||
316 | if (error != ERR_NOTSUPPORTED) { | ||
317 | if (error != ERR_NOTIMPLEMENTED) Print_Error(error); | ||
318 | if (error == ERR_NONE) printmsg("Product code : %s\n",buffer); | ||
319 | } | ||
320 | |||
321 | error=Phone->GetSIMIMSI(&s, buffer); | ||
322 | switch (error) { | ||
323 | case ERR_SECURITYERROR: | ||
324 | case ERR_NOTSUPPORTED: | ||
325 | case ERR_NOTIMPLEMENTED: | ||
326 | break; | ||
327 | case ERR_NONE: | ||
328 | printmsg("SIM IMSI : %s\n",buffer); | ||
329 | break; | ||
330 | default: | ||
331 | Print_Error(error); | ||
332 | } | ||
333 | |||
334 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
335 | DCT3Info(argc, argv); | ||
336 | #endif | ||
337 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
338 | DCT4Info(argc, argv); | ||
339 | #endif | ||
340 | |||
341 | GSM_Terminate(); | ||
342 | } | ||
343 | |||
344 | //#if 0 | ||
345 | static void GetDateTime(int argc, char *argv[]) | ||
346 | { | ||
347 | GSM_DateTime date_time; | ||
348 | GSM_Localelocale; | ||
349 | |||
350 | GSM_Init(true); | ||
351 | |||
352 | error=Phone->GetDateTime(&s, &date_time); | ||
353 | switch (error) { | ||
354 | case ERR_EMPTY: | ||
355 | printmsg("Date and time not set in phone\n"); | ||
356 | break; | ||
357 | case ERR_NONE: | ||
358 | printmsg("Phone time is %s\n",OSDateTime(date_time,false)); | ||
359 | break; | ||
360 | default: | ||
361 | Print_Error(error); | ||
362 | } | ||
363 | |||
364 | error=Phone->GetLocale(&s, &locale); | ||
365 | switch (error) { | ||
366 | case ERR_NOTSUPPORTED: | ||
367 | case ERR_NOTIMPLEMENTED: | ||
368 | break; | ||
369 | default: | ||
370 | Print_Error(error); | ||
371 | printmsg("Time format is "); | ||
372 | if (locale.AMPMTime) printmsg("12 hours\n"); else printmsg("24 hours\n"); | ||
373 | printmsg("Date format is "); | ||
374 | switch (locale.DateFormat) { | ||
375 | case GSM_Date_DDMMYYYY:printmsg("DD MM YYYY");break; | ||
376 | case GSM_Date_MMDDYYYY:printmsg("MM DD YYYY");break; | ||
377 | case GSM_Date_YYYYMMDD:printmsg("YYYY MM DD"); | ||
378 | } | ||
379 | printmsg(", date separator is %c\n",locale.DateSeparator); | ||
380 | } | ||
381 | |||
382 | GSM_Terminate(); | ||
383 | } | ||
384 | |||
385 | static void SetDateTime(int argc, char *argv[]) | ||
386 | { | ||
387 | GSM_DateTime date_time; | ||
388 | |||
389 | GSM_GetCurrentDateTime(&date_time); | ||
390 | |||
391 | GSM_Init(true); | ||
392 | |||
393 | error=Phone->SetDateTime(&s, &date_time); | ||
394 | Print_Error(error); | ||
395 | |||
396 | GSM_Terminate(); | ||
397 | } | ||
398 | |||
399 | static void GetAlarm(int argc, char *argv[]) | ||
400 | { | ||
401 | GSM_Alarm alarm; | ||
402 | |||
403 | GSM_Init(true); | ||
404 | |||
405 | alarm.Location = 1; | ||
406 | error=Phone->GetAlarm(&s, &alarm); | ||
407 | switch (error) { | ||
408 | case ERR_EMPTY: | ||
409 | printmsg("Alarm not set in phone\n"); | ||
410 | break; | ||
411 | case ERR_NONE: | ||
412 | if (alarm.Repeating) { | ||
413 | printmsg("Date: %s\n","Every day"); | ||
414 | } else { | ||
415 | printmsg("Date: %s\n",OSDate(alarm.DateTime)); | ||
416 | } | ||
417 | printmsg("Time: %02d:%02d\n",alarm.DateTime.Hour, alarm.DateTime.Minute); | ||
418 | if (alarm.Text[0] != 0 || alarm.Text[1] != 0) { | ||
419 | printmsg("Text: \"%s\"\n", DecodeUnicodeConsole(alarm.Text)); | ||
420 | } | ||
421 | break; | ||
422 | default: | ||
423 | Print_Error(error); | ||
424 | } | ||
425 | |||
426 | GSM_Terminate(); | ||
427 | } | ||
428 | |||
429 | static void SetAlarm(int argc, char *argv[]) | ||
430 | { | ||
431 | GSM_Alarm alarm; | ||
432 | |||
433 | alarm.DateTime.Hour = atoi(argv[2]); | ||
434 | alarm.DateTime.Minute = atoi(argv[3]); | ||
435 | alarm.DateTime.Second = 0; | ||
436 | alarm.Location = 1; | ||
437 | alarm.Repeating = true; | ||
438 | alarm.Text[0] = 0; | ||
439 | alarm.Text[1] = 0; | ||
440 | |||
441 | GSM_Init(true); | ||
442 | |||
443 | error=Phone->SetAlarm(&s, &alarm); | ||
444 | Print_Error(error); | ||
445 | |||
446 | GSM_Terminate(); | ||
447 | } | ||
448 | |||
449 | GSM_Bitmap caller[5]; | ||
450 | GSM_AllRingtonesInfo Info; | ||
451 | bool callerinit[5] = {false, false, false, false, false}; | ||
452 | bool ringinit = false; | ||
453 | |||
454 | static void PrintMemoryEntry(GSM_MemoryEntry *entry) | ||
455 | { | ||
456 | GSM_Category Category; | ||
457 | bool unknown; | ||
458 | int z; | ||
459 | |||
460 | for (i=0;i<entry->EntriesNum;i++) { | ||
461 | unknown = false; | ||
462 | switch (entry->Entries[i].EntryType) { | ||
463 | case PBK_Date: | ||
464 | printmsg("Date and time : %s\n",OSDateTime(entry->Entries[i].Date,false)); | ||
465 | continue; | ||
466 | case PBK_Category: | ||
467 | Category.Location = entry->Entries[i].Number; | ||
468 | Category.Type = Category_Phonebook; | ||
469 | error=Phone->GetCategory(&s, &Category); | ||
470 | if (error == ERR_NONE) { | ||
471 | printmsg("Category : \"%s\" (%i)\n", DecodeUnicodeConsole(Category.Name), entry->Entries[i].Number); | ||
472 | } else { | ||
473 | printmsg("Category : %i\n", entry->Entries[i].Number); | ||
474 | } | ||
475 | continue; | ||
476 | case PBK_Private: | ||
477 | printmsg("Private : %s\n", entry->Entries[i].Number == 1 ? "Yes" : "No"); | ||
478 | continue; | ||
479 | case PBK_Number_General : printmsg("General number "); break; | ||
480 | case PBK_Number_Mobile : printmsg("Mobile number "); break; | ||
481 | case PBK_Number_Work : printmsg("Work number "); break; | ||
482 | case PBK_Number_Fax : printmsg("Fax number "); break; | ||
483 | case PBK_Number_Home : printmsg("Home number "); break; | ||
484 | case PBK_Number_Pager : printmsg("Pager number "); break; | ||
485 | case PBK_Number_Other : printmsg("Other number "); break; | ||
486 | case PBK_Text_Note : printmsg("Text "); break; | ||
487 | case PBK_Text_Postal : printmsg("Snail address "); break; | ||
488 | case PBK_Text_Email : printmsg("Email address 1 "); break; | ||
489 | case PBK_Text_Email2 : printmsg("Email address 2 "); break; | ||
490 | case PBK_Text_URL : printmsg("URL address "); break; | ||
491 | case PBK_Text_Name : printmsg("Name "); break; | ||
492 | case PBK_Text_LastName : printmsg("Last name "); break; | ||
493 | case PBK_Text_FirstName : printmsg("First name "); break; | ||
494 | case PBK_Text_Company : printmsg("Company "); break; | ||
495 | case PBK_Text_JobTitle : printmsg("Job title "); break; | ||
496 | case PBK_Text_StreetAddress : printmsg("Street address "); break; | ||
497 | case PBK_Text_City : printmsg("City "); break; | ||
498 | case PBK_Text_State : printmsg("State "); break; | ||
499 | case PBK_Text_Zip : printmsg("Zip code "); break; | ||
500 | case PBK_Text_Country : printmsg("Country "); break; | ||
501 | case PBK_Text_Custom1 : printmsg("Custom text 1 "); break; | ||
502 | case PBK_Text_Custom2 : printmsg("Custom text 2 "); break; | ||
503 | case PBK_Text_Custom3 : printmsg("Custom text 3 "); break; | ||
504 | case PBK_Text_Custom4 : printmsg("Custom text 4 "); break; | ||
505 | case PBK_Caller_Group : | ||
506 | unknown = true; | ||
507 | if (!callerinit[entry->Entries[i].Number]) { | ||
508 | caller[entry->Entries[i].Number].Type = GSM_CallerGroupLogo; | ||
509 | caller[entry->Entries[i].Number].Location = entry->Entries[i].Number; | ||
510 | error=Phone->GetBitmap(&s,&caller[entry->Entries[i].Number]); | ||
511 | Print_Error(error); | ||
512 | if (caller[entry->Entries[i].Number].DefaultName) { | ||
513 | NOKIA_GetDefaultCallerGroupName(&s,&caller[entry->Entries[i].Number]); | ||
514 | } | ||
515 | callerinit[entry->Entries[i].Number]=true; | ||
516 | } | ||
517 | printmsg("Caller group : \"%s\"\n",DecodeUnicodeConsole(caller[entry->Entries[i].Number].Text)); | ||
518 | break; | ||
519 | case PBK_RingtoneID : | ||
520 | unknown = true; | ||
521 | if (!ringinit) { | ||
522 | error=Phone->GetRingtonesInfo(&s,&Info); | ||
523 | if (error != ERR_NOTSUPPORTED) Print_Error(error); | ||
524 | if (error == ERR_NONE) ringinit = true; | ||
525 | } | ||
526 | if (ringinit) { | ||
527 | for (z=0;z<Info.Number;z++) { | ||
528 | if (Info.Ringtone[z].ID == entry->Entries[i].Number) { | ||
529 | printmsg("Ringtone : \"%s\"\n",DecodeUnicodeConsole(Info.Ringtone[z].Name)); | ||
530 | break; | ||
531 | } | ||
532 | } | ||
533 | } else { | ||
534 | printmsg("Ringtone ID : %i\n",entry->Entries[i].Number); | ||
535 | } | ||
536 | break; | ||
537 | case PBK_PictureID : | ||
538 | unknown = true; | ||
539 | printmsg("Picture ID : 0x%x\n",entry->Entries[i].Number); | ||
540 | break; | ||
541 | default : | ||
542 | printmsg("UNKNOWN\n"); | ||
543 | unknown = true; | ||
544 | break; | ||
545 | } | ||
546 | if (!unknown) printmsg(" : \"%s\"\n", DecodeUnicodeConsole(entry->Entries[i].Text)); | ||
547 | } | ||
548 | printf("\n"); | ||
549 | } | ||
550 | |||
551 | static void GetAllMemory(int argc, char *argv[]) | ||
552 | { | ||
553 | GSM_MemoryEntry Entry; | ||
554 | bool start = true; | ||
555 | |||
556 | signal(SIGINT, interrupt); | ||
557 | printmsgerr("Press Ctrl+C to break...\n"); | ||
558 | |||
559 | Entry.MemoryType = 0; | ||
560 | |||
561 | if (mystrncasecmp(argv[2],"DC",0)) Entry.MemoryType=MEM_DC; | ||
562 | if (mystrncasecmp(argv[2],"ON",0)) Entry.MemoryType=MEM_ON; | ||
563 | if (mystrncasecmp(argv[2],"RC",0)) Entry.MemoryType=MEM_RC; | ||
564 | if (mystrncasecmp(argv[2],"MC",0)) Entry.MemoryType=MEM_MC; | ||
565 | if (mystrncasecmp(argv[2],"ME",0)) Entry.MemoryType=MEM_ME; | ||
566 | if (mystrncasecmp(argv[2],"SM",0)) Entry.MemoryType=MEM_SM; | ||
567 | if (mystrncasecmp(argv[2],"VM",0)) Entry.MemoryType=MEM_VM; | ||
568 | if (mystrncasecmp(argv[2],"FD",0)) Entry.MemoryType=MEM_FD; | ||
569 | if (Entry.MemoryType==0) { | ||
570 | printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); | ||
571 | exit (-1); | ||
572 | } | ||
573 | |||
574 | GSM_Init(true); | ||
575 | |||
576 | while (!gshutdown) { | ||
577 | error = Phone->GetNextMemory(&s, &Entry, start); | ||
578 | if (error == ERR_EMPTY) break; | ||
579 | Print_Error(error); | ||
580 | printmsg("Memory %s, Location %i\n",argv[2],Entry.Location); | ||
581 | PrintMemoryEntry(&Entry); | ||
582 | start = false; | ||
583 | } | ||
584 | |||
585 | GSM_Terminate(); | ||
586 | } | ||
587 | |||
588 | static void GetMemory(int argc, char *argv[]) | ||
589 | { | ||
590 | int j, start, stop; | ||
591 | GSM_MemoryEntry entry; | ||
592 | |||
593 | entry.MemoryType=0; | ||
594 | |||
595 | if (mystrncasecmp(argv[2],"DC",0)) entry.MemoryType=MEM_DC; | ||
596 | if (mystrncasecmp(argv[2],"ON",0)) entry.MemoryType=MEM_ON; | ||
597 | if (mystrncasecmp(argv[2],"RC",0)) entry.MemoryType=MEM_RC; | ||
598 | if (mystrncasecmp(argv[2],"MC",0)) entry.MemoryType=MEM_MC; | ||
599 | if (mystrncasecmp(argv[2],"ME",0)) entry.MemoryType=MEM_ME; | ||
600 | if (mystrncasecmp(argv[2],"SM",0)) entry.MemoryType=MEM_SM; | ||
601 | if (mystrncasecmp(argv[2],"VM",0)) entry.MemoryType=MEM_VM; | ||
602 | if (mystrncasecmp(argv[2],"FD",0)) entry.MemoryType=MEM_FD; | ||
603 | if (entry.MemoryType==0) { | ||
604 | printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); | ||
605 | exit (-1); | ||
606 | } | ||
607 | |||
608 | GetStartStop(&start, &stop, 3, argc, argv); | ||
609 | |||
610 | GSM_Init(true); | ||
611 | |||
612 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3310")) { | ||
613 | if (s.Phone.Data.VerNum<=4.06) printmsg("WARNING: you will have null names in entries. Upgrade firmware in phone to higher than 4.06\n"); | ||
614 | } | ||
615 | |||
616 | for (j=start;j<=stop;j++) { | ||
617 | printmsg("Memory %s, Location %i\n",argv[2],j); | ||
618 | |||
619 | entry.Location=j; | ||
620 | |||
621 | error=Phone->GetMemory(&s, &entry); | ||
622 | if (error != ERR_EMPTY) Print_Error(error); | ||
623 | |||
624 | if (error == ERR_EMPTY) { | ||
625 | printmsg("Entry is empty\n"); | ||
626 | printf("\n"); | ||
627 | } else { | ||
628 | PrintMemoryEntry(&entry); | ||
629 | } | ||
630 | } | ||
631 | |||
632 | GSM_Terminate(); | ||
633 | } | ||
634 | |||
635 | #define MemoryLocationToString(x) ( \ | ||
636 | x == MEM_ON ? "ON" : \ | ||
637 | x == MEM_RC ? "RC" : \ | ||
638 | x == MEM_MC ? "MC" : \ | ||
639 | x == MEM_ME ? "ME" : \ | ||
640 | x == MEM_SM ? "SM" : \ | ||
641 | x == MEM_VM ? "VM" : \ | ||
642 | x == MEM_FD ? "FD" : "XX") | ||
643 | |||
644 | static void SearchOneEntry(GSM_MemoryEntry *Entry, unsigned char *Text) | ||
645 | { | ||
646 | int i; | ||
647 | |||
648 | for (i=0;i<Entry->EntriesNum;i++) { | ||
649 | switch (Entry->Entries[i].EntryType) { | ||
650 | case PBK_Number_General : | ||
651 | case PBK_Number_Mobile : | ||
652 | case PBK_Number_Work : | ||
653 | case PBK_Number_Fax : | ||
654 | case PBK_Number_Home : | ||
655 | case PBK_Number_Pager : | ||
656 | case PBK_Number_Other : | ||
657 | case PBK_Text_Note : | ||
658 | case PBK_Text_Postal : | ||
659 | case PBK_Text_Email : | ||
660 | case PBK_Text_Email2 : | ||
661 | case PBK_Text_URL : | ||
662 | case PBK_Text_Name : | ||
663 | case PBK_Text_LastName : | ||
664 | case PBK_Text_FirstName : | ||
665 | case PBK_Text_Company : | ||
666 | case PBK_Text_JobTitle : | ||
667 | case PBK_Text_StreetAddress : | ||
668 | case PBK_Text_City : | ||
669 | case PBK_Text_State : | ||
670 | case PBK_Text_Zip : | ||
671 | case PBK_Text_Country : | ||
672 | case PBK_Text_Custom1 : | ||
673 | case PBK_Text_Custom2 : | ||
674 | case PBK_Text_Custom3 : | ||
675 | case PBK_Text_Custom4 : | ||
676 | case PBK_Caller_Group : | ||
677 | if (mystrstr(Entry->Entries[i].Text, Text) != NULL) { | ||
678 | fprintf(stderr,"\n"); | ||
679 | printmsg("Memory %s, Location %i\n",MemoryLocationToString(Entry->MemoryType),Entry->Location); | ||
680 | PrintMemoryEntry(Entry); | ||
681 | return; | ||
682 | } | ||
683 | break; | ||
684 | default: | ||
685 | break; | ||
686 | } | ||
687 | } | ||
688 | } | ||
689 | |||
690 | static void SearchOneMemory(GSM_MemoryType MemoryType, char *Title, unsigned char *Text) | ||
691 | { | ||
692 | GSM_MemoryEntry Entry; | ||
693 | GSM_MemoryStatusStatus; | ||
694 | int i = 0, l = 1; | ||
695 | bool start = true; | ||
696 | |||
697 | Status.MemoryType = MemoryType; | ||
698 | Entry.MemoryType = MemoryType; | ||
699 | |||
700 | if (Phone->GetMemoryStatus(&s, &Status) == ERR_NONE) { | ||
701 | fprintf(stderr,"%c%s: %i%%", 13, Title, (i+1)*100/(Status.MemoryUsed+1)); | ||
702 | if (Phone->GetNextMemory != NOTSUPPORTED && Phone->GetNextMemory != NOTIMPLEMENTED) { | ||
703 | while (i < Status.MemoryUsed) { | ||
704 | if (gshutdown) return; | ||
705 | i++; | ||
706 | fprintf(stderr,"\r%s: %i%%", Title, (i+1)*100/(Status.MemoryUsed+1)); | ||
707 | error = Phone->GetNextMemory(&s, &Entry, start); | ||
708 | if (error == ERR_EMPTY) break; | ||
709 | Print_Error(error); | ||
710 | SearchOneEntry(&Entry, Text); | ||
711 | start = false; | ||
712 | } | ||
713 | } else { | ||
714 | while (i < Status.MemoryUsed) { | ||
715 | Entry.Location = l; | ||
716 | error = Phone->GetMemory(&s, &Entry); | ||
717 | if (error != ERR_EMPTY) { | ||
718 | Print_Error(error); | ||
719 | i++; | ||
720 | SearchOneEntry(&Entry, Text); | ||
721 | } | ||
722 | fprintf(stderr,"%c%s: %i%%", 13, Title, (i+1)*100/(Status.MemoryUsed+1)); | ||
723 | l++; | ||
724 | } | ||
725 | } | ||
726 | fprintf(stderr,"\n"); | ||
727 | } | ||
728 | } | ||
729 | |||
730 | static void SearchMemory(int argc, char *argv[]) | ||
731 | { | ||
732 | unsigned char Text[(GSM_PHONEBOOK_TEXT_LENGTH+1)*2]; | ||
733 | int Length; | ||
734 | |||
735 | signal(SIGINT, interrupt); | ||
736 | printmsgerr("Press Ctrl+C to break...\n"); | ||
737 | |||
738 | Length = strlen(argv[2]); | ||
739 | if (Length > GSM_PHONEBOOK_TEXT_LENGTH) { | ||
740 | printmsg("Search text too long, truncating to %d chars!\n", GSM_PHONEBOOK_TEXT_LENGTH); | ||
741 | Length = GSM_PHONEBOOK_TEXT_LENGTH; | ||
742 | } | ||
743 | EncodeUnicode(Text, argv[2], Length); | ||
744 | |||
745 | GSM_Init(true); | ||
746 | |||
747 | if (!gshutdown) SearchOneMemory(MEM_ME, "Phone phonebook", Text); | ||
748 | if (!gshutdown) SearchOneMemory(MEM_SM, "SIM phonebook", Text); | ||
749 | if (!gshutdown) SearchOneMemory(MEM_ON, "Own numbers", Text); | ||
750 | if (!gshutdown) SearchOneMemory(MEM_DC, "Dialled numbers", Text); | ||
751 | if (!gshutdown) SearchOneMemory(MEM_RC, "Received numbers", Text); | ||
752 | if (!gshutdown) SearchOneMemory(MEM_MC, "Missed numbers", Text); | ||
753 | if (!gshutdown) SearchOneMemory(MEM_FD, "Fix dialling", Text); | ||
754 | if (!gshutdown) SearchOneMemory(MEM_VM, "Voice mailbox", Text); | ||
755 | |||
756 | GSM_Terminate(); | ||
757 | } | ||
758 | |||
759 | static void ListMemoryCategoryEntries(int Category) | ||
760 | { | ||
761 | GSM_MemoryEntry Entry; | ||
762 | bool start = true; | ||
763 | int j; | ||
764 | |||
765 | /* Category can be only for ME stored entries */ | ||
766 | Entry.MemoryType = MEM_ME; | ||
767 | |||
768 | while (!gshutdown) { | ||
769 | error = Phone->GetNextMemory(&s, &Entry, start); | ||
770 | if (error == ERR_EMPTY) break; | ||
771 | Print_Error(error); | ||
772 | for (j=0;j<Entry.EntriesNum;j++) { | ||
773 | if (Entry.Entries[j].EntryType == PBK_Category && Entry.Entries[j].Number == Category) { | ||
774 | printmsg("Memory %s, Location %i\n",MemoryLocationToString(Entry.MemoryType),Entry.Location); | ||
775 | PrintMemoryEntry(&Entry); | ||
776 | } | ||
777 | } | ||
778 | start = false; | ||
779 | } | ||
780 | } | ||
781 | |||
782 | static void ListMemoryCategory(int argc, char *argv[]) | ||
783 | { | ||
784 | GSM_Category Category; | ||
785 | GSM_CategoryStatusStatus; | ||
786 | int j, count; | ||
787 | |||
788 | unsigned char Text[(GSM_MAX_CATEGORY_NAME_LENGTH+1)*2]; | ||
789 | int Length; | ||
790 | bool Number = true;; | ||
791 | |||
792 | GSM_Init(true); | ||
793 | |||
794 | signal(SIGINT, interrupt); | ||
795 | printmsgerr("Press Ctrl+C to break...\n"); | ||
796 | |||
797 | Length = strlen(argv[2]); | ||
798 | for (j = 0; j < Length; j++) { | ||
799 | if (!isdigit(argv[2][j])) { | ||
800 | Number = false; | ||
801 | break; | ||
802 | } | ||
803 | } | ||
804 | |||
805 | if (Number) { | ||
806 | j = atoi(argv[2]); | ||
807 | if (j > 0) { | ||
808 | ListMemoryCategoryEntries(j); | ||
809 | } | ||
810 | } else { | ||
811 | if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) { | ||
812 | printmsg("Search text too long, truncating to %d chars!\n", GSM_MAX_CATEGORY_NAME_LENGTH); | ||
813 | Length = GSM_MAX_CATEGORY_NAME_LENGTH; | ||
814 | } | ||
815 | EncodeUnicode(Text, argv[2], Length); | ||
816 | |||
817 | Category.Type = Category_Phonebook; | ||
818 | Status.Type = Category_Phonebook; | ||
819 | |||
820 | if (Phone->GetCategoryStatus(&s, &Status) == ERR_NONE) { | ||
821 | for (count=0,j=1;count<Status.Used;j++) { | ||
822 | Category.Location=j; | ||
823 | error=Phone->GetCategory(&s, &Category); | ||
824 | |||
825 | if (error != ERR_EMPTY) { | ||
826 | count++; | ||
827 | if (mystrstr(Category.Name, Text) != NULL) { | ||
828 | ListMemoryCategoryEntries(j); | ||
829 | } | ||
830 | } | ||
831 | } | ||
832 | } | ||
833 | } | ||
834 | GSM_Terminate(); | ||
835 | } | ||
836 | |||
837 | static void displaysinglesmsinfo(GSM_SMSMessage sms, bool displaytext, bool displayudh) | ||
838 | { | ||
839 | switch (sms.PDU) { | ||
840 | case SMS_Status_Report: | ||
841 | printmsg("SMS status report\n"); | ||
842 | printmsg("Status : "); | ||
843 | switch (sms.State) { | ||
844 | case SMS_Sent : printmsg("Sent");break; | ||
845 | case SMS_Read : printmsg("Read");break; | ||
846 | case SMS_UnRead : printmsg("UnRead");break; | ||
847 | case SMS_UnSent : printmsg("UnSent");break; | ||
848 | } | ||
849 | printmsg("\nRemote number : \"%s\"\n",DecodeUnicodeConsole(sms.Number)); | ||
850 | printmsg("Reference number: 0x%02X\n",sms.MessageReference); | ||
851 | printmsg("Sent : %s\n",OSDateTime(sms.DateTime,true)); | ||
852 | printmsg("SMSC number : \"%s\"\n",DecodeUnicodeConsole(sms.SMSC.Number)); | ||
853 | printmsg("SMSC response : %s\n",OSDateTime(sms.SMSCTime,true)); | ||
854 | printmsg("Delivery status : %s\n",DecodeUnicodeConsole(sms.Text)); | ||
855 | printmsg("Details : "); | ||
856 | if (sms.DeliveryStatus & 0x40) { | ||
857 | if (sms.DeliveryStatus & 0x20) { | ||
858 | printmsg("Temporary error, "); | ||
859 | } else { | ||
860 | printmsg("Permanent error, "); | ||
861 | } | ||
862 | } else if (sms.DeliveryStatus & 0x20) { | ||
863 | printmsg("Temporary error, "); | ||
864 | } | ||
865 | switch (sms.DeliveryStatus) { | ||
866 | case 0x00: printmsg("SM received by the SME"); break; | ||
867 | case 0x01: printmsg("SM forwarded by the SC to the SME but the SC is unable to confirm delivery");break; | ||
868 | case 0x02: printmsg("SM replaced by the SC"); break; | ||
869 | case 0x20: printmsg("Congestion"); break; | ||
870 | case 0x21: printmsg("SME busy"); break; | ||
871 | case 0x22: printmsg("No response from SME"); break; | ||
872 | case 0x23: printmsg("Service rejected"); break; | ||
873 | case 0x24: printmsg("Quality of service not aviable"); break; | ||
874 | case 0x25: printmsg("Error in SME"); break; | ||
875 | case 0x40: printmsg("Remote procedure error"); break; | ||
876 | case 0x41: printmsg("Incompatibile destination"); break; | ||
877 | case 0x42: printmsg("Connection rejected by SME"); break; | ||
878 | case 0x43: printmsg("Not obtainable"); break; | ||
879 | case 0x44: printmsg("Quality of service not available"); break; | ||
880 | case 0x45: printmsg("No internetworking available"); break; | ||
881 | case 0x46: printmsg("SM Validity Period Expired"); break; | ||
882 | case 0x47: printmsg("SM deleted by originating SME"); break; | ||
883 | case 0x48: printmsg("SM Deleted by SC Administration"); break; | ||
884 | case 0x49: printmsg("SM does not exist"); break; | ||
885 | case 0x60: printmsg("Congestion"); break; | ||
886 | case 0x61: printmsg("SME busy"); break; | ||
887 | case 0x62: printmsg("No response from SME"); break; | ||
888 | case 0x63: printmsg("Service rejected"); break; | ||
889 | case 0x64: printmsg("Quality of service not available"); break; | ||
890 | case 0x65: printmsg("Error in SME"); break; | ||
891 | default : printmsg("Reserved/Specific to SC: %x",sms.DeliveryStatus);break; | ||
892 | } | ||
893 | printf("\n"); | ||
894 | break; | ||
895 | case SMS_Deliver: | ||
896 | printmsg("SMS message\n"); | ||
897 | printmsg("SMSC number : \"%s\"",DecodeUnicodeConsole(sms.SMSC.Number)); | ||
898 | if (sms.ReplyViaSameSMSC) printmsg(" (set for reply)"); | ||
899 | printmsg("\nSent : %s\n",OSDateTime(sms.DateTime,true)); | ||
900 | /* No break. The only difference for SMS_Deliver and SMS_Submit is, | ||
901 | * that SMS_Deliver contains additional data. We wrote them and then go | ||
902 | * for data shared with SMS_Submit | ||
903 | */ | ||
904 | case SMS_Submit: | ||
905 | if (sms.ReplaceMessage != 0) printmsg("SMS replacing ID : %i\n",sms.ReplaceMessage); | ||
906 | /* If we went here from "case SMS_Deliver", we don't write "SMS Message" */ | ||
907 | if (sms.PDU==SMS_Submit) { | ||
908 | printmsg("SMS message\n"); | ||
909 | printmsg("Reference number : 0x%02X\n",sms.MessageReference); | ||
910 | } | ||
911 | if (sms.Name[0] != 0x00 || sms.Name[1] != 0x00) { | ||
912 | printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(sms.Name)); | ||
913 | } | ||
914 | if (sms.Class != -1) { | ||
915 | printmsg("Class : %i\n",sms.Class); | ||
916 | } | ||
917 | printmsg("Coding : "); | ||
918 | switch (sms.Coding) { | ||
919 | case SMS_Coding_Unicode : printmsg("Unicode\n"); break; | ||
920 | case SMS_Coding_Default : printmsg("Default GSM alphabet\n");break; | ||
921 | case SMS_Coding_8bit : printmsg("8 bit\n"); break; | ||
922 | } | ||
923 | printmsg("Status : "); | ||
924 | switch (sms.State) { | ||
925 | case SMS_Sent : printmsg("Sent");break; | ||
926 | case SMS_Read : printmsg("Read");break; | ||
927 | case SMS_UnRead : printmsg("UnRead");break; | ||
928 | case SMS_UnSent : printmsg("UnSent");break; | ||
929 | } | ||
930 | printmsg("\nRemote number : \"%s\"\n",DecodeUnicodeConsole(sms.Number)); | ||
931 | if (sms.UDH.Type != UDH_NoUDH) { | ||
932 | printmsg("User Data Header : "); | ||
933 | switch (sms.UDH.Type) { | ||
934 | case UDH_ConcatenatedMessages : printmsg("Concatenated (linked) message"); break; | ||
935 | case UDH_ConcatenatedMessages16bit : printmsg("Concatenated (linked) message"); break; | ||
936 | case UDH_DisableVoice : printmsg("Disables voice indicator"); break; | ||
937 | case UDH_EnableVoice : printmsg("Enables voice indicator"); break; | ||
938 | case UDH_DisableFax : printmsg("Disables fax indicator"); break; | ||
939 | case UDH_EnableFax : printmsg("Enables fax indicator"); break; | ||
940 | case UDH_DisableEmail : printmsg("Disables email indicator"); break; | ||
941 | case UDH_EnableEmail : printmsg("Enables email indicator"); break; | ||
942 | case UDH_VoidSMS : printmsg("Void SMS"); break; | ||
943 | case UDH_NokiaWAP : printmsg("Nokia WAP bookmark"); break; | ||
944 | case UDH_NokiaOperatorLogoLong : printmsg("Nokia operator logo"); break; | ||
945 | case UDH_NokiaWAPLong : printmsg("Nokia WAP bookmark or WAP/MMS settings"); break; | ||
946 | case UDH_NokiaRingtone : printmsg("Nokia ringtone"); break; | ||
947 | case UDH_NokiaRingtoneLong : printmsg("Nokia ringtone"); break; | ||
948 | case UDH_NokiaOperatorLogo : printmsg("Nokia GSM operator logo"); break; | ||
949 | case UDH_NokiaCallerLogo : printmsg("Nokia caller logo"); break; | ||
950 | case UDH_NokiaProfileLong : printmsg("Nokia profile"); break; | ||
951 | case UDH_NokiaCalendarLong : printmsg("Nokia calendar note"); break; | ||
952 | case UDH_NokiaPhonebookLong : printmsg("Nokia phonebook entry"); break; | ||
953 | case UDH_UserUDH : printmsg("User UDH"); break; | ||
954 | case UDH_MMSIndicatorLong : printmsg("MMS indicator"); break; | ||
955 | case UDH_NoUDH: break; | ||
956 | } | ||
957 | if (sms.UDH.Type != UDH_NoUDH) { | ||
958 | if (sms.UDH.ID8bit != -1) printmsg(", ID (8 bit) %i",sms.UDH.ID8bit); | ||
959 | if (sms.UDH.ID16bit != -1) printmsg(", ID (16 bit) %i",sms.UDH.ID16bit); | ||
960 | if (sms.UDH.PartNumber != -1 && sms.UDH.AllParts != -1) { | ||
961 | if (displayudh) { | ||
962 | printmsg(", part %i of %i",sms.UDH.PartNumber,sms.UDH.AllParts); | ||
963 | } else { | ||
964 | printmsg(", %i parts",sms.UDH.AllParts); | ||
965 | } | ||
966 | } | ||
967 | } | ||
968 | printf("\n"); | ||
969 | } | ||
970 | if (displaytext) { | ||
971 | printf("\n"); | ||
972 | if (sms.Coding!=SMS_Coding_8bit) { | ||
973 | printmsg("%s\n",DecodeUnicodeConsole(sms.Text)); | ||
974 | } else { | ||
975 | printmsg("8 bit SMS, cannot be displayed here\n"); | ||
976 | } | ||
977 | } | ||
978 | break; | ||
979 | } | ||
980 | } | ||
981 | //#if 0 | ||
982 | static void displaymultismsinfo (GSM_MultiSMSMessage sms, bool eachsms, bool ems) | ||
983 | { | ||
984 | GSM_MultiPartSMSInfoSMSInfo; | ||
985 | bool RetVal,udhinfo=true; | ||
986 | int j; | ||
987 | |||
988 | /* GSM_DecodeMultiPartSMS returns if decoded SMS contenst correctly */ | ||
989 | RetVal = GSM_DecodeMultiPartSMS(&SMSInfo,&sms,ems); | ||
990 | |||
991 | if (eachsms) { | ||
992 | if (sms.SMS[0].UDH.Type != UDH_NoUDH && sms.SMS[0].UDH.AllParts == sms.Number) udhinfo = false; | ||
993 | if (RetVal && !udhinfo) { | ||
994 | displaysinglesmsinfo(sms.SMS[0],false,false); | ||
995 | printf("\n"); | ||
996 | } else { | ||
997 | for (j=0;j<sms.Number;j++) { | ||
998 | displaysinglesmsinfo(sms.SMS[j],!RetVal,udhinfo); | ||
999 | printf("\n"); | ||
1000 | } | ||
1001 | } | ||
1002 | } else { | ||
1003 | for (j=0;j<sms.Number;j++) { | ||
1004 | displaysinglesmsinfo(sms.SMS[j],!RetVal,true); | ||
1005 | printf("\n"); | ||
1006 | } | ||
1007 | } | ||
1008 | if (!RetVal) { | ||
1009 | GSM_FreeMultiPartSMSInfo(&SMSInfo); | ||
1010 | return; | ||
1011 | } | ||
1012 | |||
1013 | if (SMSInfo.Unknown) printmsg("Some details were ignored (unknown or not implemented in decoding functions)\n\n"); | ||
1014 | |||
1015 | for (i=0;i<SMSInfo.EntriesNum;i++) { | ||
1016 | switch (SMSInfo.Entries[i].ID) { | ||
1017 | case SMS_NokiaRingtone: | ||
1018 | printmsg("Ringtone \"%s\"\n",DecodeUnicodeConsole(SMSInfo.Entries[i].Ringtone->Name)); | ||
1019 | saverttl(stdout,SMSInfo.Entries[i].Ringtone); | ||
1020 | printf("\n"); | ||
1021 | if (s.Phone.Functions->PlayTone!=NOTSUPPORTED && | ||
1022 | s.Phone.Functions->PlayTone!=NOTIMPLEMENTED) { | ||
1023 | if (answer_yes("Do you want to play it")) GSM_PlayRingtone(*SMSInfo.Entries[i].Ringtone); | ||
1024 | } | ||
1025 | break; | ||
1026 | case SMS_NokiaCallerLogo: | ||
1027 | printmsg("Caller logo\n\n"); | ||
1028 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1029 | break; | ||
1030 | case SMS_NokiaOperatorLogo: | ||
1031 | printmsg("Operator logo for %s network (%s, %s)\n\n", | ||
1032 | SMSInfo.Entries[i].Bitmap->Bitmap[0].NetworkCode, | ||
1033 | DecodeUnicodeConsole(GSM_GetNetworkName(SMSInfo.Entries[i].Bitmap->Bitmap[0].NetworkCode)), | ||
1034 | DecodeUnicodeConsole(GSM_GetCountryName(SMSInfo.Entries[i].Bitmap->Bitmap[0].NetworkCode))); | ||
1035 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1036 | break; | ||
1037 | case SMS_NokiaScreenSaverLong: | ||
1038 | printmsg("Screen saver\n"); | ||
1039 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1040 | break; | ||
1041 | case SMS_NokiaPictureImageLong: | ||
1042 | printmsg("Picture Image\n"); | ||
1043 | if (UnicodeLength(SMSInfo.Entries[i].Bitmap->Bitmap[0].Text)!=0) printmsg("Text: \"%s\"\n\n",DecodeUnicodeConsole(SMSInfo.Entries[i].Bitmap->Bitmap[0].Text)); | ||
1044 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1045 | break; | ||
1046 | case SMS_NokiaProfileLong: | ||
1047 | printmsg("Profile\n"); | ||
1048 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1049 | break; | ||
1050 | case SMS_ConcatenatedTextLong: | ||
1051 | case SMS_ConcatenatedAutoTextLong: | ||
1052 | case SMS_ConcatenatedTextLong16bit: | ||
1053 | case SMS_ConcatenatedAutoTextLong16bit: | ||
1054 | printmsg("%s\n",DecodeUnicodeConsole(SMSInfo.Entries[i].Buffer)); | ||
1055 | break; | ||
1056 | case SMS_EMSFixedBitmap: | ||
1057 | case SMS_EMSVariableBitmap: | ||
1058 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1059 | break; | ||
1060 | case SMS_EMSAnimation: | ||
1061 | /* Can't show animation, we show first frame */ | ||
1062 | GSM_PrintBitmap(stdout,&SMSInfo.Entries[i].Bitmap->Bitmap[0]); | ||
1063 | break; | ||
1064 | case SMS_EMSPredefinedSound: | ||
1065 | printmsg("\nEMS sound ID: %i\n",SMSInfo.Entries[i].Number); | ||
1066 | break; | ||
1067 | case SMS_EMSPredefinedAnimation: | ||
1068 | printmsg("\nEMS animation ID: %i\n",SMSInfo.Entries[i].Number); | ||
1069 | break; | ||
1070 | default: | ||
1071 | printf("Error\n"); | ||
1072 | break; | ||
1073 | } | ||
1074 | } | ||
1075 | printf("\n"); | ||
1076 | GSM_FreeMultiPartSMSInfo(&SMSInfo); | ||
1077 | } | ||
1078 | |||
1079 | static void NetworkInfo(int argc, char *argv[]) | ||
1080 | { | ||
1081 | GSM_NetworkInfo NetInfo; | ||
1082 | |||
1083 | GSM_Init(true); | ||
1084 | |||
1085 | if (Phone->GetNetworkInfo(&s,&NetInfo)==ERR_NONE) { | ||
1086 | printmsg("Network state : "); | ||
1087 | switch (NetInfo.State) { | ||
1088 | case GSM_HomeNetwork : printmsg("home network\n"); break; | ||
1089 | case GSM_RoamingNetwork : printmsg("roaming network\n"); break; | ||
1090 | case GSM_RequestingNetwork : printmsg("requesting network\n"); break; | ||
1091 | case GSM_NoNetwork : printmsg("not logged into network\n");break; | ||
1092 | case GSM_RegistrationDenied : printmsg("registration to network denied\n");break; | ||
1093 | case GSM_NetworkStatusUnknown : printmsg("unknown\n"); break; | ||
1094 | default : printmsg("unknown\n"); | ||
1095 | } | ||
1096 | if (NetInfo.State == GSM_HomeNetwork || NetInfo.State == GSM_RoamingNetwork) { | ||
1097 | printmsg("Network : %s (%s",NetInfo.NetworkCode,DecodeUnicodeConsole(GSM_GetNetworkName(NetInfo.NetworkCode))); | ||
1098 | printmsg(", %s)", DecodeUnicodeConsole(GSM_GetCountryName(NetInfo.NetworkCode))); | ||
1099 | printmsg(", LAC %s, CellID %s\n", NetInfo.LAC,NetInfo.CID); | ||
1100 | if (NetInfo.NetworkName[0] != 0x00 || NetInfo.NetworkName[1] != 0x00) { | ||
1101 | printmsg("Name in phone : \"%s\"\n",DecodeUnicodeConsole(NetInfo.NetworkName)); | ||
1102 | } | ||
1103 | } | ||
1104 | } | ||
1105 | GSM_Terminate(); | ||
1106 | } | ||
1107 | |||
1108 | static void IncomingSMS(char *Device, GSM_SMSMessage sms) | ||
1109 | { | ||
1110 | GSM_MultiSMSMessage SMS; | ||
1111 | |||
1112 | printmsg("SMS message received\n"); | ||
1113 | SMS.Number = 1; | ||
1114 | memcpy(&SMS.SMS[0],&sms,sizeof(GSM_SMSMessage)); | ||
1115 | displaymultismsinfo(SMS,false,false); | ||
1116 | } | ||
1117 | |||
1118 | static void IncomingCB(char *Device, GSM_CBMessage CB) | ||
1119 | { | ||
1120 | printmsg("CB message received\n"); | ||
1121 | printmsg("Channel %i, text \"%s\"\n",CB.Channel,DecodeUnicodeConsole(CB.Text)); | ||
1122 | } | ||
1123 | |||
1124 | static void IncomingCall(char *Device, GSM_Call call) | ||
1125 | { | ||
1126 | printmsg("Call info : "); | ||
1127 | if (call.CallIDAvailable) printmsg("ID %i, ",call.CallID); | ||
1128 | switch(call.Status) { | ||
1129 | case GSM_CALL_IncomingCall : printmsg("incoming call from \"%s\"\n",DecodeUnicodeConsole(call.PhoneNumber)); break; | ||
1130 | case GSM_CALL_OutgoingCall : printmsg("outgoing call to \"%s\"\n",DecodeUnicodeConsole(call.PhoneNumber)); break; | ||
1131 | case GSM_CALL_CallStart : printmsg("call started\n"); break; | ||
1132 | case GSM_CALL_CallEnd : printmsg("end of call (unknown side)\n"); break; | ||
1133 | case GSM_CALL_CallLocalEnd : printmsg("call end from our side\n"); break; | ||
1134 | case GSM_CALL_CallRemoteEnd : printmsg("call end from remote side (code %i)\n",call.StatusCode); break; | ||
1135 | case GSM_CALL_CallEstablished : printmsg("call established. Waiting for answer\n"); break; | ||
1136 | case GSM_CALL_CallHeld : printmsg("call held\n"); break; | ||
1137 | case GSM_CALL_CallResumed : printmsg("call resumed\n"); break; | ||
1138 | case GSM_CALL_CallSwitched : printmsg("call switched\n"); break; | ||
1139 | } | ||
1140 | } | ||
1141 | |||
1142 | static void IncomingUSSD(char *Device, char *Buffer) | ||
1143 | { | ||
1144 | printmsg("Service reply: \"%s\"\n",DecodeUnicodeConsole(Buffer)); | ||
1145 | } | ||
1146 | |||
1147 | #define CHECKMEMORYSTATUS(x, m, a1, b1) { \ | ||
1148 | x.MemoryType=m; \ | ||
1149 | if (Phone->GetMemoryStatus(&s, &x) == ERR_NONE) \ | ||
1150 | printmsg("%s %03d, %s %03d\n", a1, x.MemoryUsed, b1, x.MemoryFree);\ | ||
1151 | } | ||
1152 | |||
1153 | static void Monitor(int argc, char *argv[]) | ||
1154 | { | ||
1155 | GSM_MemoryStatusMemStatus; | ||
1156 | GSM_SMSMemoryStatusSMSStatus; | ||
1157 | GSM_ToDoStatus ToDoStatus; | ||
1158 | GSM_CalendarStatusCalendarStatus; | ||
1159 | GSM_NetworkInfo NetInfo; | ||
1160 | GSM_BatteryCharge BatteryCharge; | ||
1161 | GSM_SignalQuality SignalQuality; | ||
1162 | int count = -1; | ||
1163 | |||
1164 | if (argc >= 3) { | ||
1165 | count = atoi(argv[2]); | ||
1166 | if (count <= 0) count = -1; | ||
1167 | } | ||
1168 | |||
1169 | signal(SIGINT, interrupt); | ||
1170 | printmsgerr("Press Ctrl+C to break...\n"); | ||
1171 | printmsg("Entering monitor mode...\n\n"); | ||
1172 | |||
1173 | GSM_Init(true); | ||
1174 | |||
1175 | s.User.IncomingSMS = IncomingSMS; | ||
1176 | s.User.IncomingCB = IncomingCB; | ||
1177 | s.User.IncomingCall = IncomingCall; | ||
1178 | s.User.IncomingUSSD = IncomingUSSD; | ||
1179 | |||
1180 | error=Phone->SetIncomingSMS (&s,true); | ||
1181 | printmsg("Enabling info about incoming SMS : %s\n",print_error(error,NULL,s.msg)); | ||
1182 | error=Phone->SetIncomingCB (&s,true); | ||
1183 | printmsg("Enabling info about incoming CB : %s\n",print_error(error,NULL,s.msg)); | ||
1184 | error=Phone->SetIncomingCall (&s,true); | ||
1185 | printmsg("Enabling info about calls : %s\n",print_error(error,NULL,s.msg)); | ||
1186 | error=Phone->SetIncomingUSSD (&s,true); | ||
1187 | printmsg("Enabling info about USSD : %s\n\n",print_error(error,NULL,s.msg)); | ||
1188 | |||
1189 | while (!gshutdown && count != 0) { | ||
1190 | if (count > 0) count--; | ||
1191 | CHECKMEMORYSTATUS(MemStatus,MEM_SM,"SIM phonebook : Used","Free"); | ||
1192 | if (gshutdown) break; | ||
1193 | CHECKMEMORYSTATUS(MemStatus,MEM_DC,"Dialled numbers : Used","Free"); | ||
1194 | if (gshutdown) break; | ||
1195 | CHECKMEMORYSTATUS(MemStatus,MEM_RC,"Received numbers : Used","Free"); | ||
1196 | if (gshutdown) break; | ||
1197 | CHECKMEMORYSTATUS(MemStatus,MEM_MC,"Missed numbers : Used","Free"); | ||
1198 | if (gshutdown) break; | ||
1199 | CHECKMEMORYSTATUS(MemStatus,MEM_ON,"Own numbers : Used","Free"); | ||
1200 | if (gshutdown) break; | ||
1201 | CHECKMEMORYSTATUS(MemStatus,MEM_ME,"Phone phonebook : Used","Free"); | ||
1202 | if (gshutdown) break; | ||
1203 | if (Phone->GetToDoStatus(&s, &ToDoStatus) == ERR_NONE) { | ||
1204 | printmsg("ToDos : Used %d\n", ToDoStatus.Used); | ||
1205 | } | ||
1206 | if (gshutdown) break; | ||
1207 | if (Phone->GetCalendarStatus(&s, &CalendarStatus) == ERR_NONE) { | ||
1208 | printmsg("Calendar : Used %d\n", CalendarStatus.Used); | ||
1209 | } | ||
1210 | if (gshutdown) break; | ||
1211 | if (Phone->GetBatteryCharge(&s,&BatteryCharge)==ERR_NONE) { | ||
1212 | if (BatteryCharge.BatteryPercent != -1) printmsg("Battery level : %i percent\n", BatteryCharge.BatteryPercent); | ||
1213 | if (BatteryCharge.ChargeState != 0) { | ||
1214 | printmsg("Charge state : "); | ||
1215 | switch (BatteryCharge.ChargeState) { | ||
1216 | case GSM_BatteryPowered: | ||
1217 | printmsg("powered from battery"); | ||
1218 | break; | ||
1219 | case GSM_BatteryConnected: | ||
1220 | printmsg("battery connected, but not powered from battery"); | ||
1221 | break; | ||
1222 | case GSM_BatteryNotConnected: | ||
1223 | printmsg("battery not connected"); | ||
1224 | break; | ||
1225 | case GSM_PowerFault: | ||
1226 | printmsg("detected power failure"); | ||
1227 | break; | ||
1228 | default: | ||
1229 | printmsg("unknown"); | ||
1230 | break; | ||
1231 | } | ||
1232 | printf("\n"); | ||
1233 | } | ||
1234 | } | ||
1235 | if (gshutdown) break; | ||
1236 | if (Phone->GetSignalQuality(&s,&SignalQuality)==ERR_NONE) { | ||
1237 | if (SignalQuality.SignalStrength != -1) printmsg("Signal strength : %i dBm\n", SignalQuality.SignalStrength); | ||
1238 | if (SignalQuality.SignalPercent != -1) printmsg("Network level : %i percent\n", SignalQuality.SignalPercent); | ||
1239 | if (SignalQuality.BitErrorRate != -1) printmsg("Bit error rate : %i percent\n", SignalQuality.BitErrorRate); | ||
1240 | } | ||
1241 | if (gshutdown) break; | ||
1242 | if (Phone->GetSMSStatus(&s,&SMSStatus)==ERR_NONE) { | ||
1243 | if (SMSStatus.SIMSize > 0) { | ||
1244 | printmsg("SIM SMS status : %i used, %i unread, %i locations\n", | ||
1245 | SMSStatus.SIMUsed, | ||
1246 | SMSStatus.SIMUnRead, | ||
1247 | SMSStatus.SIMSize); | ||
1248 | } | ||
1249 | |||
1250 | if (SMSStatus.PhoneSize > 0) { | ||
1251 | printmsg("Phone SMS status : %i used, %i unread, %i locations", | ||
1252 | SMSStatus.PhoneUsed, | ||
1253 | SMSStatus.PhoneUnRead, | ||
1254 | SMSStatus.PhoneSize); | ||
1255 | if (SMSStatus.TemplatesUsed!=0) printmsg(", %i templates", SMSStatus.TemplatesUsed); | ||
1256 | printf("\n"); | ||
1257 | } | ||
1258 | } | ||
1259 | if (gshutdown) break; | ||
1260 | if (Phone->GetNetworkInfo(&s,&NetInfo)==ERR_NONE) { | ||
1261 | printmsg("Network state : "); | ||
1262 | switch (NetInfo.State) { | ||
1263 | case GSM_HomeNetwork : printmsg("home network\n"); break; | ||
1264 | case GSM_RoamingNetwork : printmsg("roaming network\n"); break; | ||
1265 | case GSM_RequestingNetwork : printmsg("requesting network\n"); break; | ||
1266 | case GSM_NoNetwork : printmsg("not logged into network\n"); break; | ||
1267 | case GSM_RegistrationDenied : printmsg("registration to network denied\n");break; | ||
1268 | case GSM_NetworkStatusUnknown : printmsg("unknown\n"); break; | ||
1269 | default : printmsg("unknown\n"); | ||
1270 | } | ||
1271 | if (NetInfo.State == GSM_HomeNetwork || NetInfo.State == GSM_RoamingNetwork) { | ||
1272 | printmsg("Network : %s (%s",NetInfo.NetworkCode,DecodeUnicodeConsole(GSM_GetNetworkName(NetInfo.NetworkCode))); | ||
1273 | printmsg(", %s)", DecodeUnicodeConsole(GSM_GetCountryName(NetInfo.NetworkCode))); | ||
1274 | printmsg(", LAC %s, CID %s\n", NetInfo.LAC,NetInfo.CID); | ||
1275 | if (NetInfo.NetworkName[0] != 0x00 || NetInfo.NetworkName[1] != 0x00) { | ||
1276 | printmsg("Name in phone : \"%s\"\n",DecodeUnicodeConsole(NetInfo.NetworkName)); | ||
1277 | } | ||
1278 | } | ||
1279 | } | ||
1280 | printf("\n"); | ||
1281 | } | ||
1282 | |||
1283 | printmsg("Leaving monitor mode...\n"); | ||
1284 | |||
1285 | GSM_Terminate(); | ||
1286 | } | ||
1287 | |||
1288 | static void GetUSSD(int argc, char *argv[]) | ||
1289 | { | ||
1290 | GSM_Init(true); | ||
1291 | |||
1292 | signal(SIGINT, interrupt); | ||
1293 | printmsgerr("Press Ctrl+C to break...\n"); | ||
1294 | |||
1295 | s.User.IncomingUSSD = IncomingUSSD; | ||
1296 | |||
1297 | error=Phone->SetIncomingUSSD(&s,true); | ||
1298 | Print_Error(error); | ||
1299 | |||
1300 | error=Phone->DialVoice(&s, argv[2], GSM_CALL_DefaultNumberPresence); | ||
1301 | Print_Error(error); | ||
1302 | |||
1303 | while (!gshutdown) GSM_ReadDevice(&s,true); | ||
1304 | |||
1305 | GSM_Terminate(); | ||
1306 | } | ||
1307 | |||
1308 | static void GetSMSC(int argc, char *argv[]) | ||
1309 | { | ||
1310 | GSM_SMSC smsc; | ||
1311 | int start, stop; | ||
1312 | |||
1313 | GetStartStop(&start, &stop, 2, argc, argv); | ||
1314 | |||
1315 | GSM_Init(true); | ||
1316 | |||
1317 | for (i=start;i<=stop;i++) { | ||
1318 | smsc.Location=i; | ||
1319 | |||
1320 | error=Phone->GetSMSC(&s, &smsc); | ||
1321 | Print_Error(error); | ||
1322 | |||
1323 | if (!strcmp(DecodeUnicodeConsole(smsc.Name),"")) { | ||
1324 | printmsg("%i. Set %i\n",smsc.Location, smsc.Location); | ||
1325 | } else { | ||
1326 | printmsg("%i. \"%s\"\n",smsc.Location, DecodeUnicodeConsole(smsc.Name)); | ||
1327 | } | ||
1328 | printmsg("Number : \"%s\"\n",DecodeUnicodeConsole(smsc.Number)); | ||
1329 | printmsg("Default number : \"%s\"\n",DecodeUnicodeConsole(smsc.DefaultNumber)); | ||
1330 | |||
1331 | printmsg("Format : "); | ||
1332 | switch (smsc.Format) { | ||
1333 | case SMS_FORMAT_Text : printmsg("Text");break; | ||
1334 | case SMS_FORMAT_Fax : printmsg("Fax");break; | ||
1335 | case SMS_FORMAT_Email : printmsg("Email");break; | ||
1336 | case SMS_FORMAT_Pager : printmsg("Pager");break; | ||
1337 | } | ||
1338 | printf("\n"); | ||
1339 | |||
1340 | printmsg("Validity : "); | ||
1341 | switch (smsc.Validity.Relative) { | ||
1342 | case SMS_VALID_1_Hour : printmsg("1 hour"); break; | ||
1343 | case SMS_VALID_6_Hours : printmsg("6 hours"); break; | ||
1344 | case SMS_VALID_1_Day : printmsg("24 hours"); break; | ||
1345 | case SMS_VALID_3_Days : printmsg("72 hours"); break; | ||
1346 | case SMS_VALID_1_Week : printmsg("1 week"); break; | ||
1347 | case SMS_VALID_Max_Time: printmsg("Maximum time"); break; | ||
1348 | default : printmsg("Unknown"); | ||
1349 | } | ||
1350 | printf("\n"); | ||
1351 | } | ||
1352 | |||
1353 | GSM_Terminate(); | ||
1354 | } | ||
1355 | |||
1356 | static void GetSMS(int argc, char *argv[]) | ||
1357 | { | ||
1358 | GSM_MultiSMSMessagesms; | ||
1359 | GSM_SMSFolders folders; | ||
1360 | int start, stop; | ||
1361 | int j; | ||
1362 | |||
1363 | GetStartStop(&start, &stop, 3, argc, argv); | ||
1364 | |||
1365 | GSM_Init(true); | ||
1366 | |||
1367 | error=Phone->GetSMSFolders(&s, &folders); | ||
1368 | Print_Error(error); | ||
1369 | |||
1370 | for (j = start; j <= stop; j++) { | ||
1371 | sms.SMS[0].Folder= atoi(argv[2]); | ||
1372 | sms.SMS[0].Location= j; | ||
1373 | error=Phone->GetSMS(&s, &sms); | ||
1374 | switch (error) { | ||
1375 | case ERR_EMPTY: | ||
1376 | printmsg("Location %i\n",sms.SMS[0].Location); | ||
1377 | printmsg("Empty\n"); | ||
1378 | break; | ||
1379 | default: | ||
1380 | Print_Error(error); | ||
1381 | printmsg("Location %i, folder \"%s\"",sms.SMS[0].Location,DecodeUnicodeConsole(folders.Folder[sms.SMS[0].Folder-1].Name)); | ||
1382 | switch(sms.SMS[0].Memory) { | ||
1383 | case MEM_SM: printmsg(", SIM memory"); break; | ||
1384 | case MEM_ME: printmsg(", phone memory"); break; | ||
1385 | case MEM_MT: printmsg(", phone or SIM memory"); break; | ||
1386 | default : break; | ||
1387 | } | ||
1388 | if (sms.SMS[0].InboxFolder) printmsg(", Inbox folder"); | ||
1389 | printf("\n"); | ||
1390 | displaymultismsinfo(sms,false,false); | ||
1391 | } | ||
1392 | } | ||
1393 | |||
1394 | GSM_Terminate(); | ||
1395 | } | ||
1396 | |||
1397 | static void DeleteSMS(int argc, char *argv[]) | ||
1398 | { | ||
1399 | GSM_SMSMessagesms; | ||
1400 | int start, stop; | ||
1401 | |||
1402 | sms.Folder=atoi(argv[2]); | ||
1403 | |||
1404 | GetStartStop(&start, &stop, 3, argc, argv); | ||
1405 | |||
1406 | GSM_Init(true); | ||
1407 | |||
1408 | for (i=start;i<=stop;i++) { | ||
1409 | sms.Folder= 0; | ||
1410 | sms.Location= i; | ||
1411 | error=Phone->DeleteSMS(&s, &sms); | ||
1412 | Print_Error(error); | ||
1413 | } | ||
1414 | #ifdef GSM_ENABLE_BEEP | ||
1415 | GSM_PhoneBeep(); | ||
1416 | #endif | ||
1417 | GSM_Terminate(); | ||
1418 | } | ||
1419 | |||
1420 | static void GetAllSMS(int argc, char *argv[]) | ||
1421 | { | ||
1422 | GSM_MultiSMSMessage sms; | ||
1423 | GSM_SMSFolders folders; | ||
1424 | bool start = true; | ||
1425 | |||
1426 | GSM_Init(true); | ||
1427 | |||
1428 | error=Phone->GetSMSFolders(&s, &folders); | ||
1429 | Print_Error(error); | ||
1430 | |||
1431 | fprintf(stderr,"Reading: "); | ||
1432 | while (error == ERR_NONE) { | ||
1433 | sms.SMS[0].Folder=0x00; | ||
1434 | error=Phone->GetNextSMS(&s, &sms, start); | ||
1435 | switch (error) { | ||
1436 | case ERR_EMPTY: | ||
1437 | break; | ||
1438 | default: | ||
1439 | Print_Error(error); | ||
1440 | printmsg("Location %i, folder \"%s\"",sms.SMS[0].Location,DecodeUnicodeConsole(folders.Folder[sms.SMS[0].Folder-1].Name)); | ||
1441 | switch(sms.SMS[0].Memory) { | ||
1442 | case MEM_SM: printmsg(", SIM memory"); break; | ||
1443 | case MEM_ME: printmsg(", phone memory"); break; | ||
1444 | case MEM_MT: printmsg(", phone or SIM memory"); break; | ||
1445 | default : break; | ||
1446 | } | ||
1447 | if (sms.SMS[0].InboxFolder) printmsg(", Inbox folder"); | ||
1448 | printf("\n"); | ||
1449 | displaymultismsinfo(sms,false,false); | ||
1450 | } | ||
1451 | fprintf(stderr,"*"); | ||
1452 | start=false; | ||
1453 | } | ||
1454 | fprintf(stderr,"\n"); | ||
1455 | |||
1456 | #ifdef GSM_ENABLE_BEEP | ||
1457 | GSM_PhoneBeep(); | ||
1458 | #endif | ||
1459 | GSM_Terminate(); | ||
1460 | } | ||
1461 | |||
1462 | static void GetEachSMS(int argc, char *argv[]) | ||
1463 | { | ||
1464 | GSM_MultiSMSMessage*GetSMS[PHONE_MAXSMSINFOLDER],*SortedSMS[PHONE_MAXSMSINFOLDER],sms; | ||
1465 | int GetSMSNumber = 0,i,j; | ||
1466 | GSM_SMSFolders folders; | ||
1467 | bool start = true, ems = true; | ||
1468 | |||
1469 | GetSMS[0] = NULL; | ||
1470 | |||
1471 | GSM_Init(true); | ||
1472 | |||
1473 | error=Phone->GetSMSFolders(&s, &folders); | ||
1474 | Print_Error(error); | ||
1475 | |||
1476 | fprintf(stderr,"Reading: "); | ||
1477 | while (error == ERR_NONE) { | ||
1478 | sms.SMS[0].Folder=0x00; | ||
1479 | error=Phone->GetNextSMS(&s, &sms, start); | ||
1480 | switch (error) { | ||
1481 | case ERR_EMPTY: | ||
1482 | break; | ||
1483 | default: | ||
1484 | Print_Error(error); | ||
1485 | GetSMS[GetSMSNumber] = malloc(sizeof(GSM_MultiSMSMessage)); | ||
1486 | if (GetSMS[GetSMSNumber] == NULL) Print_Error(ERR_MOREMEMORY); | ||
1487 | GetSMS[GetSMSNumber+1] = NULL; | ||
1488 | memcpy(GetSMS[GetSMSNumber],&sms,sizeof(GSM_MultiSMSMessage)); | ||
1489 | GetSMSNumber++; | ||
1490 | if (GetSMSNumber==PHONE_MAXSMSINFOLDER) { | ||
1491 | fprintf(stderr,"SMS counter overflow\n"); | ||
1492 | return; | ||
1493 | } | ||
1494 | } | ||
1495 | fprintf(stderr,"*"); | ||
1496 | start=false; | ||
1497 | } | ||
1498 | fprintf(stderr,"\n"); | ||
1499 | |||
1500 | #ifdef GSM_ENABLE_BEEP | ||
1501 | GSM_PhoneBeep(); | ||
1502 | #endif | ||
1503 | |||
1504 | error = GSM_LinkSMS(GetSMS, SortedSMS, ems); | ||
1505 | Print_Error(error); | ||
1506 | |||
1507 | i=0; | ||
1508 | while(GetSMS[i] != NULL) { | ||
1509 | free(GetSMS[i]); | ||
1510 | GetSMS[i] = NULL; | ||
1511 | i++; | ||
1512 | } | ||
1513 | |||
1514 | i=0; | ||
1515 | while(SortedSMS[i] != NULL) { | ||
1516 | for (j=0;j<SortedSMS[i]->Number;j++) { | ||
1517 | if ((j==0) || (j!=0 && SortedSMS[i]->SMS[j].Location != SortedSMS[i]->SMS[j-1].Location)) { | ||
1518 | printmsg("Location %i, folder \"%s\"",SortedSMS[i]->SMS[j].Location,DecodeUnicodeConsole(folders.Folder[SortedSMS[i]->SMS[j].Folder-1].Name)); | ||
1519 | switch(SortedSMS[i]->SMS[j].Memory) { | ||
1520 | case MEM_SM: printmsg(", SIM memory"); break; | ||
1521 | case MEM_ME: printmsg(", phone memory"); break; | ||
1522 | case MEM_MT: printmsg(", phone or SIM memory"); break; | ||
1523 | default : break; | ||
1524 | } | ||
1525 | if (SortedSMS[i]->SMS[j].InboxFolder) printmsg(", Inbox folder"); | ||
1526 | printf("\n"); | ||
1527 | } | ||
1528 | } | ||
1529 | displaymultismsinfo(*SortedSMS[i],true,ems); | ||
1530 | |||
1531 | free(SortedSMS[i]); | ||
1532 | SortedSMS[i] = NULL; | ||
1533 | i++; | ||
1534 | } | ||
1535 | |||
1536 | GSM_Terminate(); | ||
1537 | } | ||
1538 | |||
1539 | static void GetSMSFolders(int argc, char *argv[]) | ||
1540 | { | ||
1541 | GSM_SMSFolders folders; | ||
1542 | |||
1543 | GSM_Init(true); | ||
1544 | |||
1545 | error=Phone->GetSMSFolders(&s,&folders); | ||
1546 | Print_Error(error); | ||
1547 | |||
1548 | for (i=0;i<folders.Number;i++) { | ||
1549 | printmsg("%i. \"%30s\"",i+1,DecodeUnicodeConsole(folders.Folder[i].Name)); | ||
1550 | switch(folders.Folder[i].Memory) { | ||
1551 | case MEM_SM: printmsg(", SIM memory"); break; | ||
1552 | case MEM_ME: printmsg(", phone memory"); break; | ||
1553 | case MEM_MT: printmsg(", phone or SIM memory"); break; | ||
1554 | default : break; | ||
1555 | } | ||
1556 | if (folders.Folder[i].InboxFolder) printmsg(", Inbox folder"); | ||
1557 | printf("\n"); | ||
1558 | } | ||
1559 | |||
1560 | GSM_Terminate(); | ||
1561 | } | ||
1562 | |||
1563 | static void GetRingtone(int argc, char *argv[]) | ||
1564 | { | ||
1565 | GSM_Ringtone ringtone; | ||
1566 | bool PhoneRingtone = false; | ||
1567 | |||
1568 | if (mystrncasecmp(argv[1],"--getphoneringtone",0)) PhoneRingtone = true; | ||
1569 | |||
1570 | GetStartStop(&ringtone.Location, NULL, 2, argc, argv); | ||
1571 | |||
1572 | GSM_Init(true); | ||
1573 | |||
1574 | ringtone.Format=0; | ||
1575 | |||
1576 | error=Phone->GetRingtone(&s,&ringtone,PhoneRingtone); | ||
1577 | Print_Error(error); | ||
1578 | |||
1579 | switch (ringtone.Format) { | ||
1580 | case RING_NOTETONE : printmsg("Smart Messaging");break; | ||
1581 | case RING_NOKIABINARY : printmsg("Nokia binary");break; | ||
1582 | case RING_MIDI : printmsg("Midi format");break; | ||
1583 | } | ||
1584 | printmsg(" format, ringtone \"%s\"\n",DecodeUnicodeConsole(ringtone.Name)); | ||
1585 | |||
1586 | if (argc==4) { | ||
1587 | error=GSM_SaveRingtoneFile(argv[3], &ringtone); | ||
1588 | Print_Error(error); | ||
1589 | } | ||
1590 | |||
1591 | GSM_Terminate(); | ||
1592 | } | ||
1593 | |||
1594 | static void GetRingtonesList(int argc, char *argv[]) | ||
1595 | { | ||
1596 | GSM_AllRingtonesInfo Info; | ||
1597 | int i; | ||
1598 | |||
1599 | GSM_Init(true); | ||
1600 | |||
1601 | error=Phone->GetRingtonesInfo(&s,&Info); | ||
1602 | Print_Error(error); | ||
1603 | |||
1604 | GSM_Terminate(); | ||
1605 | |||
1606 | for (i=0;i<Info.Number;i++) printmsg("%i. \"%s\"\n",i,DecodeUnicodeConsole(Info.Ringtone[i].Name)); | ||
1607 | } | ||
1608 | |||
1609 | static void DialVoice(int argc, char *argv[]) | ||
1610 | { | ||
1611 | GSM_CallShowNumber ShowNumber = GSM_CALL_DefaultNumberPresence; | ||
1612 | |||
1613 | if (argc > 3) { | ||
1614 | if (mystrncasecmp(argv[3],"show",0)) { ShowNumber = GSM_CALL_ShowNumber; | ||
1615 | } else if (mystrncasecmp(argv[3],"hide",0)) {ShowNumber = GSM_CALL_HideNumber; | ||
1616 | } else { | ||
1617 | printmsg("Unknown parameter (\"%s\")\n",argv[3]); | ||
1618 | exit(-1); | ||
1619 | } | ||
1620 | } | ||
1621 | |||
1622 | GSM_Init(true); | ||
1623 | |||
1624 | error=Phone->DialVoice(&s, argv[2], ShowNumber); | ||
1625 | Print_Error(error); | ||
1626 | |||
1627 | GSM_Terminate(); | ||
1628 | } | ||
1629 | |||
1630 | static void CancelCall(int argc, char *argv[]) | ||
1631 | { | ||
1632 | GSM_Init(true); | ||
1633 | |||
1634 | if (argc>2) { | ||
1635 | error=Phone->CancelCall(&s,atoi(argv[2]),false); | ||
1636 | } else { | ||
1637 | error=Phone->CancelCall(&s,0,true); | ||
1638 | } | ||
1639 | Print_Error(error); | ||
1640 | |||
1641 | GSM_Terminate(); | ||
1642 | } | ||
1643 | |||
1644 | static void AnswerCall(int argc, char *argv[]) | ||
1645 | { | ||
1646 | GSM_Init(true); | ||
1647 | |||
1648 | if (argc>2) { | ||
1649 | error=Phone->AnswerCall(&s,atoi(argv[2]),false); | ||
1650 | } else { | ||
1651 | error=Phone->AnswerCall(&s,0,true); | ||
1652 | } | ||
1653 | Print_Error(error); | ||
1654 | |||
1655 | GSM_Terminate(); | ||
1656 | } | ||
1657 | |||
1658 | static void UnholdCall(int argc, char *argv[]) | ||
1659 | { | ||
1660 | GSM_Init(true); | ||
1661 | |||
1662 | error=Phone->UnholdCall(&s,atoi(argv[2])); | ||
1663 | Print_Error(error); | ||
1664 | |||
1665 | GSM_Terminate(); | ||
1666 | } | ||
1667 | |||
1668 | static void HoldCall(int argc, char *argv[]) | ||
1669 | { | ||
1670 | GSM_Init(true); | ||
1671 | |||
1672 | error=Phone->HoldCall(&s,atoi(argv[2])); | ||
1673 | Print_Error(error); | ||
1674 | |||
1675 | GSM_Terminate(); | ||
1676 | } | ||
1677 | |||
1678 | static void ConferenceCall(int argc, char *argv[]) | ||
1679 | { | ||
1680 | GSM_Init(true); | ||
1681 | |||
1682 | error=Phone->ConferenceCall(&s,atoi(argv[2])); | ||
1683 | Print_Error(error); | ||
1684 | |||
1685 | GSM_Terminate(); | ||
1686 | } | ||
1687 | |||
1688 | static void SplitCall(int argc, char *argv[]) | ||
1689 | { | ||
1690 | GSM_Init(true); | ||
1691 | |||
1692 | error=Phone->SplitCall(&s,atoi(argv[2])); | ||
1693 | Print_Error(error); | ||
1694 | |||
1695 | GSM_Terminate(); | ||
1696 | } | ||
1697 | |||
1698 | static void SwitchCall(int argc, char *argv[]) | ||
1699 | { | ||
1700 | GSM_Init(true); | ||
1701 | |||
1702 | if (argc > 2) { | ||
1703 | error=Phone->SwitchCall(&s,atoi(argv[2]),false); | ||
1704 | } else { | ||
1705 | error=Phone->SwitchCall(&s,0,true); | ||
1706 | } | ||
1707 | Print_Error(error); | ||
1708 | |||
1709 | GSM_Terminate(); | ||
1710 | } | ||
1711 | |||
1712 | static void TransferCall(int argc, char *argv[]) | ||
1713 | { | ||
1714 | GSM_Init(true); | ||
1715 | |||
1716 | if (argc > 2) { | ||
1717 | error=Phone->TransferCall(&s,atoi(argv[2]),false); | ||
1718 | } else { | ||
1719 | error=Phone->TransferCall(&s,0,true); | ||
1720 | } | ||
1721 | Print_Error(error); | ||
1722 | |||
1723 | GSM_Terminate(); | ||
1724 | } | ||
1725 | |||
1726 | static void AddSMSFolder(int argc, char *argv[]) | ||
1727 | { | ||
1728 | unsigned char buffer[200]; | ||
1729 | |||
1730 | GSM_Init(true); | ||
1731 | |||
1732 | EncodeUnicode(buffer,argv[2],strlen(argv[2])); | ||
1733 | error=Phone->AddSMSFolder(&s,buffer); | ||
1734 | Print_Error(error); | ||
1735 | |||
1736 | GSM_Terminate(); | ||
1737 | } | ||
1738 | |||
1739 | static void Reset(int argc, char *argv[]) | ||
1740 | { | ||
1741 | bool hard; | ||
1742 | |||
1743 | if (mystrncasecmp(argv[2],"SOFT",0)) { hard=false; | ||
1744 | } else if (mystrncasecmp(argv[2],"HARD",0)) {hard=true; | ||
1745 | } else { | ||
1746 | printmsg("What type of reset do you want (\"%s\") ?\n",argv[2]); | ||
1747 | exit(-1); | ||
1748 | } | ||
1749 | |||
1750 | GSM_Init(true); | ||
1751 | |||
1752 | error=Phone->Reset(&s, hard); | ||
1753 | Print_Error(error); | ||
1754 | |||
1755 | GSM_Terminate(); | ||
1756 | } | ||
1757 | |||
1758 | static void PrintCalendar(GSM_CalendarEntry *Note) | ||
1759 | { | ||
1760 | int i_age = 0,i; | ||
1761 | GSM_DateTime Alarm,DateTime; | ||
1762 | GSM_MemoryEntry entry; | ||
1763 | unsigned char *name; | ||
1764 | |||
1765 | bool repeating = false; | ||
1766 | int repeat_dayofweek = -1; | ||
1767 | int repeat_day = -1; | ||
1768 | int repeat_weekofmonth = -1; | ||
1769 | int repeat_month = -1; | ||
1770 | int repeat_frequency = -1; | ||
1771 | GSM_DateTime repeat_startdate = {0,0,0,0,0,0,0}; | ||
1772 | GSM_DateTime repeat_stopdate = {0,0,0,0,0,0,0}; | ||
1773 | |||
1774 | printmsg("Location : %d\n", Note->Location); | ||
1775 | printmsg("Note type : "); | ||
1776 | switch (Note->Type) { | ||
1777 | case GSM_CAL_REMINDER : printmsg("Reminder (Date)\n"); break; | ||
1778 | case GSM_CAL_CALL : printmsg("Call\n"); break; | ||
1779 | case GSM_CAL_MEETING : printmsg("Meeting\n"); break; | ||
1780 | case GSM_CAL_BIRTHDAY : printmsg("Birthday (Anniversary)\n"); break; | ||
1781 | case GSM_CAL_MEMO : printmsg("Memo (Miscellaneous)\n"); break; | ||
1782 | case GSM_CAL_TRAVEL : printmsg("Travel\n"); break; | ||
1783 | case GSM_CAL_VACATION : printmsg("Vacation\n"); break; | ||
1784 | case GSM_CAL_ALARM : printmsg("Alarm\n"); break; | ||
1785 | case GSM_CAL_DAILY_ALARM : printmsg("Daily alarm\n"); break; | ||
1786 | case GSM_CAL_T_ATHL : printmsg("Training/Athletism\n"); break; | ||
1787 | case GSM_CAL_T_BALL : printmsg("Training/Ball Games\n"); break; | ||
1788 | case GSM_CAL_T_CYCL : printmsg("Training/Cycling\n"); break; | ||
1789 | case GSM_CAL_T_BUDO : printmsg("Training/Budo\n"); break; | ||
1790 | case GSM_CAL_T_DANC : printmsg("Training/Dance\n"); break; | ||
1791 | case GSM_CAL_T_EXTR : printmsg("Training/Extreme Sports\n"); break; | ||
1792 | case GSM_CAL_T_FOOT : printmsg("Training/Football\n"); break; | ||
1793 | case GSM_CAL_T_GOLF : printmsg("Training/Golf\n"); break; | ||
1794 | case GSM_CAL_T_GYM : printmsg("Training/Gym\n"); break; | ||
1795 | case GSM_CAL_T_HORS : printmsg("Training/Horse Races\n"); break; | ||
1796 | case GSM_CAL_T_HOCK : printmsg("Training/Hockey\n"); break; | ||
1797 | case GSM_CAL_T_RACE : printmsg("Training/Races\n"); break; | ||
1798 | case GSM_CAL_T_RUGB : printmsg("Training/Rugby\n"); break; | ||
1799 | case GSM_CAL_T_SAIL : printmsg("Training/Sailing\n"); break; | ||
1800 | case GSM_CAL_T_STRE : printmsg("Training/Street Games\n"); break; | ||
1801 | case GSM_CAL_T_SWIM : printmsg("Training/Swimming\n"); break; | ||
1802 | case GSM_CAL_T_TENN : printmsg("Training/Tennis\n"); break; | ||
1803 | case GSM_CAL_T_TRAV : printmsg("Training/Travels\n"); break; | ||
1804 | case GSM_CAL_T_WINT : printmsg("Training/Winter Games\n"); break; | ||
1805 | default : printmsg("UNKNOWN\n"); | ||
1806 | } | ||
1807 | Alarm.Year = 0; | ||
1808 | |||
1809 | repeating = false; | ||
1810 | repeat_dayofweek = -1; | ||
1811 | repeat_day = -1; | ||
1812 | repeat_weekofmonth = -1; | ||
1813 | repeat_month = -1; | ||
1814 | repeat_frequency = -1; | ||
1815 | repeat_startdate.Day= 0; | ||
1816 | repeat_stopdate.Day = 0; | ||
1817 | |||
1818 | for (i=0;i<Note->EntriesNum;i++) { | ||
1819 | switch (Note->Entries[i].EntryType) { | ||
1820 | case CAL_START_DATETIME: | ||
1821 | printmsg("Start : %s\n",OSDateTime(Note->Entries[i].Date,false)); | ||
1822 | memcpy(&DateTime,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | ||
1823 | break; | ||
1824 | case CAL_END_DATETIME: | ||
1825 | printmsg("Stop : %s\n",OSDateTime(Note->Entries[i].Date,false)); | ||
1826 | memcpy(&DateTime,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | ||
1827 | break; | ||
1828 | case CAL_ALARM_DATETIME: | ||
1829 | printmsg("Tone alarm : %s\n",OSDateTime(Note->Entries[i].Date,false)); | ||
1830 | memcpy(&Alarm,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | ||
1831 | break; | ||
1832 | case CAL_SILENT_ALARM_DATETIME: | ||
1833 | printmsg("Silent alarm : %s\n",OSDateTime(Note->Entries[i].Date,false)); | ||
1834 | memcpy(&Alarm,&Note->Entries[i].Date,sizeof(GSM_DateTime)); | ||
1835 | break; | ||
1836 | case CAL_RECURRANCE: | ||
1837 | printmsg("Repeat : %d day%s\n",Note->Entries[i].Number/24, | ||
1838 | ((Note->Entries[i].Number/24)>1) ? "s":"" ); | ||
1839 | break; | ||
1840 | case CAL_TEXT: | ||
1841 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | ||
1842 | break; | ||
1843 | case CAL_LOCATION: | ||
1844 | printmsg("Location : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | ||
1845 | break; | ||
1846 | case CAL_PHONE: | ||
1847 | printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(Note->Entries[i].Text)); | ||
1848 | break; | ||
1849 | case CAL_PRIVATE: | ||
1850 | printmsg("Private : %s\n",Note->Entries[i].Number == 1 ? "Yes" : "No"); | ||
1851 | break; | ||
1852 | case CAL_CONTACTID: | ||
1853 | entry.Location = Note->Entries[i].Number; | ||
1854 | entry.MemoryType = MEM_ME; | ||
1855 | error=Phone->GetMemory(&s, &entry); | ||
1856 | if (error == ERR_NONE) { | ||
1857 | name = GSM_PhonebookGetEntryName(&entry); | ||
1858 | if (name != NULL) { | ||
1859 | printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), Note->Entries[i].Number); | ||
1860 | } else { | ||
1861 | printmsg("Contact ID : %d\n",Note->Entries[i].Number); | ||
1862 | } | ||
1863 | } else { | ||
1864 | printmsg("Contact ID : %d\n",Note->Entries[i].Number); | ||
1865 | } | ||
1866 | break; | ||
1867 | case CAL_REPEAT_DAYOFWEEK: | ||
1868 | repeat_dayofweek = Note->Entries[i].Number; | ||
1869 | repeating = true; | ||
1870 | break; | ||
1871 | case CAL_REPEAT_DAY: | ||
1872 | repeat_day = Note->Entries[i].Number; | ||
1873 | repeating = true; | ||
1874 | break; | ||
1875 | case CAL_REPEAT_WEEKOFMONTH: | ||
1876 | repeat_weekofmonth = Note->Entries[i].Number; | ||
1877 | repeating = true; | ||
1878 | break; | ||
1879 | case CAL_REPEAT_MONTH: | ||
1880 | repeat_month = Note->Entries[i].Number; | ||
1881 | repeating = true; | ||
1882 | break; | ||
1883 | case CAL_REPEAT_FREQUENCY: | ||
1884 | repeat_frequency = Note->Entries[i].Number; | ||
1885 | repeating = true; | ||
1886 | break; | ||
1887 | case CAL_REPEAT_STARTDATE: | ||
1888 | repeat_startdate = Note->Entries[i].Date; | ||
1889 | repeating = true; | ||
1890 | break; | ||
1891 | case CAL_REPEAT_STOPDATE: | ||
1892 | repeat_stopdate = Note->Entries[i].Date; | ||
1893 | repeating = true; | ||
1894 | break; | ||
1895 | } | ||
1896 | } | ||
1897 | if (repeating) { | ||
1898 | printmsg("Repeating : "); | ||
1899 | if ((repeat_startdate.Day == 0) && (repeat_stopdate.Day == 0)) { | ||
1900 | printmsg("Forever"); | ||
1901 | } else if (repeat_startdate.Day == 0) { | ||
1902 | printmsg("Till %s", OSDate(repeat_stopdate)); | ||
1903 | } else if (repeat_stopdate.Day == 0) { | ||
1904 | printmsg("Since %s", OSDate(repeat_startdate)); | ||
1905 | } else { | ||
1906 | printmsg("Since %s till %s", OSDate(repeat_startdate), OSDate(repeat_stopdate)); | ||
1907 | } | ||
1908 | if (repeat_frequency != -1) { | ||
1909 | if (repeat_frequency == 1) { | ||
1910 | printmsg (" on each "); | ||
1911 | } else { | ||
1912 | printmsg(" on each %d. ", repeat_frequency); | ||
1913 | } | ||
1914 | if (repeat_dayofweek > 0) { | ||
1915 | switch (repeat_dayofweek) { | ||
1916 | case 1 : printmsg("Monday"); break; | ||
1917 | case 2 : printmsg("Tuesday"); break; | ||
1918 | case 3 : printmsg("Wednesday"); break; | ||
1919 | case 4 : printmsg("Thursday"); break; | ||
1920 | case 5 : printmsg("Friday"); break; | ||
1921 | case 6 : printmsg("Saturday"); break; | ||
1922 | case 7 : printmsg("Sunday"); break; | ||
1923 | default: printmsg("Bad day!"); break; | ||
1924 | } | ||
1925 | if (repeat_weekofmonth > 0) { | ||
1926 | printmsg(" in %d. week of ", repeat_weekofmonth); | ||
1927 | } else { | ||
1928 | printmsg(" in "); | ||
1929 | } | ||
1930 | if (repeat_month > 0) { | ||
1931 | switch(repeat_month) { | ||
1932 | case 1 : printmsg("January"); break; | ||
1933 | case 2 : printmsg("February"); break; | ||
1934 | case 3 : printmsg("March"); break; | ||
1935 | case 4 : printmsg("April"); break; | ||
1936 | case 5 : printmsg("May"); break; | ||
1937 | case 6 : printmsg("June"); break; | ||
1938 | case 7 : printmsg("July"); break; | ||
1939 | case 8 : printmsg("August"); break; | ||
1940 | case 9 : printmsg("September"); break; | ||
1941 | case 10: printmsg("October"); break; | ||
1942 | case 11: printmsg("November"); break; | ||
1943 | case 12: printmsg("December"); break; | ||
1944 | default: printmsg("Bad month!"); break; | ||
1945 | } | ||
1946 | } else { | ||
1947 | printmsg("each month"); | ||
1948 | } | ||
1949 | } else if (repeat_day > 0) { | ||
1950 | printmsg("%d. day of ", repeat_day); | ||
1951 | if (repeat_month > 0) { | ||
1952 | switch(repeat_month) { | ||
1953 | case 1 : printmsg("January"); break; | ||
1954 | case 2 : printmsg("February"); break; | ||
1955 | case 3 : printmsg("March");break; | ||
1956 | case 4 : printmsg("April"); break; | ||
1957 | case 5 : printmsg("May"); break; | ||
1958 | case 6 : printmsg("June"); break; | ||
1959 | case 7 : printmsg("July"); break; | ||
1960 | case 8 : printmsg("August"); break; | ||
1961 | case 9 : printmsg("September"); break; | ||
1962 | case 10: printmsg("October"); break; | ||
1963 | case 11: printmsg("November"); break; | ||
1964 | case 12: printmsg("December"); break; | ||
1965 | default: printmsg("Bad month!");break; | ||
1966 | } | ||
1967 | } else { | ||
1968 | printmsg("each month"); | ||
1969 | } | ||
1970 | } else { | ||
1971 | printmsg("day"); | ||
1972 | } | ||
1973 | } | ||
1974 | printf("\n"); | ||
1975 | } | ||
1976 | if (Note->Type == GSM_CAL_BIRTHDAY) { | ||
1977 | if (Alarm.Year == 0x00) GSM_GetCurrentDateTime (&Alarm); | ||
1978 | if (DateTime.Year != 0) { | ||
1979 | i_age = Alarm.Year - DateTime.Year; | ||
1980 | if (DateTime.Month < Alarm.Month) i_age++; | ||
1981 | if (DateTime.Month == Alarm.Month && | ||
1982 | DateTime.Day < Alarm.Day) { | ||
1983 | i_age++; | ||
1984 | } | ||
1985 | printmsg("Age : %d %s\n",i_age, (i_age==1)?"year":"years"); | ||
1986 | } | ||
1987 | } | ||
1988 | printf("\n"); | ||
1989 | } | ||
1990 | |||
1991 | static void GetCalendar(int argc, char *argv[]) | ||
1992 | { | ||
1993 | GSM_CalendarEntryNote; | ||
1994 | int start,stop; | ||
1995 | |||
1996 | GetStartStop(&start, &stop, 2, argc, argv); | ||
1997 | |||
1998 | GSM_Init(true); | ||
1999 | |||
2000 | for (i=start;i<=stop;i++) { | ||
2001 | Note.Location=i; | ||
2002 | error = Phone->GetCalendar(&s, &Note); | ||
2003 | if (error == ERR_EMPTY) continue; | ||
2004 | Print_Error(error); | ||
2005 | PrintCalendar(&Note); | ||
2006 | } | ||
2007 | |||
2008 | GSM_Terminate(); | ||
2009 | } | ||
2010 | |||
2011 | static void DeleteCalendar(int argc, char *argv[]) | ||
2012 | { | ||
2013 | GSM_CalendarEntryNote; | ||
2014 | int start,stop; | ||
2015 | |||
2016 | GetStartStop(&start, &stop, 2, argc, argv); | ||
2017 | |||
2018 | GSM_Init(true); | ||
2019 | |||
2020 | for (i=start;i<=stop;i++) { | ||
2021 | Note.Location=i; | ||
2022 | error = Phone->DeleteCalendar(&s, &Note); | ||
2023 | if (error == ERR_EMPTY) continue; | ||
2024 | Print_Error(error); | ||
2025 | PrintCalendar(&Note); | ||
2026 | } | ||
2027 | |||
2028 | GSM_Terminate(); | ||
2029 | } | ||
2030 | |||
2031 | |||
2032 | static void GetAllCalendar(int argc, char *argv[]) | ||
2033 | { | ||
2034 | GSM_CalendarEntryNote; | ||
2035 | bool refresh= true; | ||
2036 | |||
2037 | signal(SIGINT, interrupt); | ||
2038 | printmsgerr("Press Ctrl+C to break...\n"); | ||
2039 | |||
2040 | GSM_Init(true); | ||
2041 | |||
2042 | while (!gshutdown) { | ||
2043 | error=Phone->GetNextCalendar(&s,&Note,refresh); | ||
2044 | if (error == ERR_EMPTY) break; | ||
2045 | PrintCalendar(&Note); | ||
2046 | Print_Error(error); | ||
2047 | refresh=false; | ||
2048 | } | ||
2049 | |||
2050 | GSM_Terminate(); | ||
2051 | } | ||
2052 | |||
2053 | static void GetCalendarSettings(int argc, char *argv[]) | ||
2054 | { | ||
2055 | GSM_CalendarSettings settings; | ||
2056 | |||
2057 | GSM_Init(true); | ||
2058 | |||
2059 | error=Phone->GetCalendarSettings(&s,&settings); | ||
2060 | Print_Error(error); | ||
2061 | |||
2062 | if (settings.AutoDelete == 0) { | ||
2063 | printmsg("Auto deleting disabled"); | ||
2064 | } else { | ||
2065 | printmsg("Auto deleting notes after %i day(s)",settings.AutoDelete); | ||
2066 | } | ||
2067 | printmsg("\nWeek start on "); | ||
2068 | switch(settings.StartDay) { | ||
2069 | case 1: printmsg("Monday"); break; | ||
2070 | case 6: printmsg("Saturday"); break; | ||
2071 | case 7: printmsg("Sunday"); break; | ||
2072 | } | ||
2073 | printf("\n"); | ||
2074 | |||
2075 | GSM_Terminate(); | ||
2076 | } | ||
2077 | |||
2078 | static void GetWAPBookmark(int argc, char *argv[]) | ||
2079 | { | ||
2080 | GSM_WAPBookmark bookmark; | ||
2081 | int start,stop; | ||
2082 | |||
2083 | GetStartStop(&start, &stop, 2, argc, argv); | ||
2084 | |||
2085 | GSM_Init(true); | ||
2086 | |||
2087 | for (i=start;i<=stop;i++) { | ||
2088 | bookmark.Location=i; | ||
2089 | error=Phone->GetWAPBookmark(&s,&bookmark); | ||
2090 | Print_Error(error); | ||
2091 | printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(bookmark.Title)); | ||
2092 | printmsg("Address : \"%s\"\n",DecodeUnicodeConsole(bookmark.Address)); | ||
2093 | } | ||
2094 | |||
2095 | GSM_Terminate(); | ||
2096 | } | ||
2097 | |||
2098 | static void DeleteWAPBookmark(int argc, char *argv[]) | ||
2099 | { | ||
2100 | GSM_WAPBookmarkbookmark; | ||
2101 | int start, stop; | ||
2102 | |||
2103 | GetStartStop(&start, &stop, 2, argc, argv); | ||
2104 | |||
2105 | GSM_Init(true); | ||
2106 | |||
2107 | for (i=start;i<=stop;i++) { | ||
2108 | bookmark.Location=i; | ||
2109 | error=Phone->DeleteWAPBookmark(&s, &bookmark); | ||
2110 | Print_Error(error); | ||
2111 | } | ||
2112 | |||
2113 | GSM_Terminate(); | ||
2114 | } | ||
2115 | |||
2116 | static void GetGPRSPoint(int argc, char *argv[]) | ||
2117 | { | ||
2118 | GSM_GPRSAccessPointpoint; | ||
2119 | int start,stop; | ||
2120 | |||
2121 | GetStartStop(&start, &stop, 2, argc, argv); | ||
2122 | |||
2123 | GSM_Init(true); | ||
2124 | |||
2125 | for (i=start;i<=stop;i++) { | ||
2126 | point.Location=i; | ||
2127 | error=Phone->GetGPRSAccessPoint(&s,&point); | ||
2128 | if (error != ERR_EMPTY) { | ||
2129 | Print_Error(error); | ||
2130 | printmsg("%i. \"%s\"",point.Location,DecodeUnicodeConsole(point.Name)); | ||
2131 | } else { | ||
2132 | printmsg("%i. Access point %i",point.Location,point.Location); | ||
2133 | } | ||
2134 | if (point.Active) printmsg(" (active)"); | ||
2135 | if (error != ERR_EMPTY) { | ||
2136 | printmsg("\nAddress : \"%s\"\n\n",DecodeUnicodeConsole(point.URL)); | ||
2137 | } else { | ||
2138 | printmsg("\n\n"); | ||
2139 | } | ||
2140 | } | ||
2141 | |||
2142 | GSM_Terminate(); | ||
2143 | } | ||
2144 | |||
2145 | static void GetBitmap(int argc, char *argv[]) | ||
2146 | { | ||
2147 | GSM_File File; | ||
2148 | GSM_MultiBitmap MultiBitmap; | ||
2149 | int location=0; | ||
2150 | GSM_AllRingtonesInfo Info; | ||
2151 | |||
2152 | if (mystrncasecmp(argv[2],"STARTUP",0)) { | ||
2153 | MultiBitmap.Bitmap[0].Type=GSM_StartupLogo; | ||
2154 | } else if (mystrncasecmp(argv[2],"CALLER",0)) { | ||
2155 | MultiBitmap.Bitmap[0].Type=GSM_CallerGroupLogo; | ||
2156 | GetStartStop(&location, NULL, 3, argc, argv); | ||
2157 | if (location>5) { | ||
2158 | printmsg("Maximal location for caller logo can be 5\n"); | ||
2159 | exit (-1); | ||
2160 | } | ||
2161 | } else if (mystrncasecmp(argv[2],"PICTURE",0)) { | ||
2162 | MultiBitmap.Bitmap[0].Type=GSM_PictureImage; | ||
2163 | GetStartStop(&location, NULL, 3, argc, argv); | ||
2164 | } else if (mystrncasecmp(argv[2],"TEXT",0)) { | ||
2165 | MultiBitmap.Bitmap[0].Type=GSM_WelcomeNote_Text; | ||
2166 | } else if (mystrncasecmp(argv[2],"DEALER",0)) { | ||
2167 | MultiBitmap.Bitmap[0].Type=GSM_DealerNote_Text; | ||
2168 | } else if (mystrncasecmp(argv[2],"OPERATOR",0)) { | ||
2169 | MultiBitmap.Bitmap[0].Type=GSM_OperatorLogo; | ||
2170 | } else { | ||
2171 | printmsg("What type of logo do you want to get (\"%s\") ?\n",argv[2]); | ||
2172 | exit(-1); | ||
2173 | } | ||
2174 | MultiBitmap.Bitmap[0].Location=location; | ||
2175 | |||
2176 | GSM_Init(true); | ||
2177 | |||
2178 | error=Phone->GetBitmap(&s,&MultiBitmap.Bitmap[0]); | ||
2179 | Print_Error(error); | ||
2180 | |||
2181 | MultiBitmap.Number = 1; | ||
2182 | |||
2183 | error=ERR_NONE; | ||
2184 | switch (MultiBitmap.Bitmap[0].Type) { | ||
2185 | case GSM_CallerGroupLogo: | ||
2186 | if (!MultiBitmap.Bitmap[0].DefaultBitmap) GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | ||
2187 | printmsg("Group name : \"%s\"",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | ||
2188 | if (MultiBitmap.Bitmap[0].DefaultName) printmsg(" (default)"); | ||
2189 | printf("\n"); | ||
2190 | if (MultiBitmap.Bitmap[0].DefaultRingtone) { | ||
2191 | printmsg("Ringtone : default\n"); | ||
2192 | } else if (MultiBitmap.Bitmap[0].FileSystemRingtone) { | ||
2193 | sprintf(File.ID_FullName,"%i",MultiBitmap.Bitmap[0].RingtoneID); | ||
2194 | |||
2195 | File.Buffer = NULL; | ||
2196 | File.Used = 0; | ||
2197 | |||
2198 | error = ERR_NONE; | ||
2199 | // while (error == ERR_NONE) { | ||
2200 | error = Phone->GetFilePart(&s,&File); | ||
2201 | // } | ||
2202 | if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error); | ||
2203 | error = ERR_NONE; | ||
2204 | |||
2205 | printmsg("Ringtone : \"%s\" (file with ID %i)\n", | ||
2206 | DecodeUnicodeString(File.Name), | ||
2207 | MultiBitmap.Bitmap[0].RingtoneID); | ||
2208 | } else { | ||
2209 | error = Phone->GetRingtonesInfo(&s,&Info); | ||
2210 | if (error != ERR_NONE) Info.Number = 0; | ||
2211 | error = ERR_NONE; | ||
2212 | |||
2213 | printmsg("Ringtone : "); | ||
2214 | if (UnicodeLength(GSM_GetRingtoneName(&Info,MultiBitmap.Bitmap[0].RingtoneID))!=0) { | ||
2215 | printmsg("\"%s\" (ID %i)\n", | ||
2216 | DecodeUnicodeConsole(GSM_GetRingtoneName(&Info,MultiBitmap.Bitmap[0].RingtoneID)), | ||
2217 | MultiBitmap.Bitmap[0].RingtoneID); | ||
2218 | } else { | ||
2219 | printmsg("ID %i\n",MultiBitmap.Bitmap[0].RingtoneID); | ||
2220 | } | ||
2221 | } | ||
2222 | if (MultiBitmap.Bitmap[0].BitmapEnabled) { | ||
2223 | printmsg("Bitmap : enabled\n"); | ||
2224 | } else { | ||
2225 | printmsg("Bitmap : disabled\n"); | ||
2226 | } | ||
2227 | if (argc>4 && !MultiBitmap.Bitmap[0].DefaultBitmap) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); | ||
2228 | break; | ||
2229 | case GSM_StartupLogo: | ||
2230 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | ||
2231 | if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); | ||
2232 | break; | ||
2233 | case GSM_OperatorLogo: | ||
2234 | if (strcmp(MultiBitmap.Bitmap[0].NetworkCode,"000 00")!=0) { | ||
2235 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | ||
2236 | if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); | ||
2237 | } else { | ||
2238 | printmsg("No operator logo in phone\n"); | ||
2239 | } | ||
2240 | break; | ||
2241 | case GSM_PictureImage: | ||
2242 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | ||
2243 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | ||
2244 | printmsg("Sender : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Sender)); | ||
2245 | if (argc>4) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); | ||
2246 | break; | ||
2247 | case GSM_WelcomeNote_Text: | ||
2248 | printmsg("Welcome note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | ||
2249 | break; | ||
2250 | case GSM_DealerNote_Text: | ||
2251 | printmsg("Dealer note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | ||
2252 | break; | ||
2253 | default: | ||
2254 | break; | ||
2255 | } | ||
2256 | Print_Error(error); | ||
2257 | |||
2258 | GSM_Terminate(); | ||
2259 | } | ||
2260 | |||
2261 | static void SetBitmap(int argc, char *argv[]) | ||
2262 | { | ||
2263 | GSM_Bitmap Bitmap, NewBitmap; | ||
2264 | GSM_MultiBitmap MultiBitmap; | ||
2265 | GSM_NetworkInfo NetInfo; | ||
2266 | bool init = true; | ||
2267 | |||
2268 | if (mystrncasecmp(argv[2],"STARTUP",0)) { | ||
2269 | if (argc<4) { | ||
2270 | printmsg("More arguments required\n"); | ||
2271 | exit(-1); | ||
2272 | } | ||
2273 | MultiBitmap.Bitmap[0].Type=GSM_StartupLogo; | ||
2274 | MultiBitmap.Bitmap[0].Location=1; | ||
2275 | if (!strcmp(argv[3],"1")) MultiBitmap.Bitmap[0].Location = 2; | ||
2276 | if (!strcmp(argv[3],"2")) MultiBitmap.Bitmap[0].Location = 3; | ||
2277 | if (!strcmp(argv[3],"3")) MultiBitmap.Bitmap[0].Location = 4; | ||
2278 | if (MultiBitmap.Bitmap[0].Location == 1) { | ||
2279 | error=GSM_ReadBitmapFile(argv[3],&MultiBitmap); | ||
2280 | Print_Error(error); | ||
2281 | } | ||
2282 | memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap)); | ||
2283 | } else if (mystrncasecmp(argv[2],"TEXT",0)) { | ||
2284 | if (argc<4) { | ||
2285 | printmsg("More arguments required\n"); | ||
2286 | exit(-1); | ||
2287 | } | ||
2288 | Bitmap.Type=GSM_WelcomeNote_Text; | ||
2289 | EncodeUnicode(Bitmap.Text,argv[3],strlen(argv[3])); | ||
2290 | } else if (mystrncasecmp(argv[2],"DEALER",0)) { | ||
2291 | if (argc<4) { | ||
2292 | printmsg("More arguments required\n"); | ||
2293 | exit(-1); | ||
2294 | } | ||
2295 | Bitmap.Type=GSM_DealerNote_Text; | ||
2296 | EncodeUnicode(Bitmap.Text,argv[3],strlen(argv[3])); | ||
2297 | } else if (mystrncasecmp(argv[2],"CALLER",0)) { | ||
2298 | if (argc<4) { | ||
2299 | printmsg("More arguments required\n"); | ||
2300 | exit(-1); | ||
2301 | } | ||
2302 | GetStartStop(&i, NULL, 3, argc, argv); | ||
2303 | if (i>5 && i!=255) { | ||
2304 | printmsg("Maximal location for caller logo can be 5\n"); | ||
2305 | exit (-1); | ||
2306 | } | ||
2307 | MultiBitmap.Bitmap[0].Type = GSM_CallerGroupLogo; | ||
2308 | MultiBitmap.Bitmap[0].Location= i; | ||
2309 | if (argc>4) { | ||
2310 | error=GSM_ReadBitmapFile(argv[4],&MultiBitmap); | ||
2311 | Print_Error(error); | ||
2312 | } | ||
2313 | memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap)); | ||
2314 | if (i!=255) { | ||
2315 | GSM_Init(true); | ||
2316 | init = false; | ||
2317 | NewBitmap.Type = GSM_CallerGroupLogo; | ||
2318 | NewBitmap.Location = i; | ||
2319 | error=Phone->GetBitmap(&s,&NewBitmap); | ||
2320 | Print_Error(error); | ||
2321 | Bitmap.RingtoneID = NewBitmap.RingtoneID; | ||
2322 | Bitmap.DefaultRingtone = NewBitmap.DefaultRingtone; | ||
2323 | Bitmap.FileSystemRingtone = false; | ||
2324 | CopyUnicodeString(Bitmap.Text, NewBitmap.Text); | ||
2325 | Bitmap.DefaultName = NewBitmap.DefaultName; | ||
2326 | } | ||
2327 | } else if (mystrncasecmp(argv[2],"PICTURE",0)) { | ||
2328 | if (argc<5) { | ||
2329 | printmsg("More arguments required\n"); | ||
2330 | exit(-1); | ||
2331 | } | ||
2332 | MultiBitmap.Bitmap[0].Type = GSM_PictureImage; | ||
2333 | MultiBitmap.Bitmap[0].Location = atoi(argv[4]); | ||
2334 | error=GSM_ReadBitmapFile(argv[3],&MultiBitmap); | ||
2335 | Print_Error(error); | ||
2336 | memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap)); | ||
2337 | Bitmap.Text[0]=0; | ||
2338 | Bitmap.Text[1]=0; | ||
2339 | if (argc == 6) EncodeUnicode(Bitmap.Text,argv[5],strlen(argv[5])); | ||
2340 | Bitmap.Sender[0]=0; | ||
2341 | Bitmap.Sender[1]=0; | ||
2342 | } else if (mystrncasecmp(argv[2],"COLOUROPERATOR",0)) { | ||
2343 | Bitmap.Type = GSM_ColourOperatorLogo_ID; | ||
2344 | strcpy(Bitmap.NetworkCode,"000 00"); | ||
2345 | if (argc > 3) { | ||
2346 | Bitmap.ID = atoi(argv[3]); | ||
2347 | if (argc>4) { | ||
2348 | strncpy(Bitmap.NetworkCode,argv[4],6); | ||
2349 | } else { | ||
2350 | GSM_Init(true); | ||
2351 | init = false; | ||
2352 | error=Phone->GetNetworkInfo(&s,&NetInfo); | ||
2353 | Print_Error(error); | ||
2354 | strcpy(Bitmap.NetworkCode,NetInfo.NetworkCode); | ||
2355 | } | ||
2356 | } | ||
2357 | } else if (mystrncasecmp(argv[2],"COLOURSTARTUP",0)) { | ||
2358 | Bitmap.Type = GSM_ColourStartupLogo_ID; | ||
2359 | Bitmap.Location = 0; | ||
2360 | if (argc > 3) { | ||
2361 | Bitmap.Location = 1; | ||
2362 | Bitmap.ID = atoi(argv[3]); | ||
2363 | } | ||
2364 | } else if (mystrncasecmp(argv[2],"WALLPAPER",0)) { | ||
2365 | Bitmap.Type = GSM_ColourWallPaper_ID; | ||
2366 | Bitmap.ID = 0; | ||
2367 | if (argc > 3) Bitmap.ID = atoi(argv[3]); | ||
2368 | } else if (mystrncasecmp(argv[2],"OPERATOR",0)) { | ||
2369 | MultiBitmap.Bitmap[0].Type= GSM_OperatorLogo; | ||
2370 | MultiBitmap.Bitmap[0].Location = 1; | ||
2371 | strcpy(MultiBitmap.Bitmap[0].NetworkCode,"000 00"); | ||
2372 | if (argc>3) { | ||
2373 | error=GSM_ReadBitmapFile(argv[3],&MultiBitmap); | ||
2374 | Print_Error(error); | ||
2375 | if (argc>4) { | ||
2376 | strncpy(MultiBitmap.Bitmap[0].NetworkCode,argv[4],6); | ||
2377 | } else { | ||
2378 | GSM_Init(true); | ||
2379 | init = false; | ||
2380 | error=Phone->GetNetworkInfo(&s,&NetInfo); | ||
2381 | Print_Error(error); | ||
2382 | strcpy(MultiBitmap.Bitmap[0].NetworkCode,NetInfo.NetworkCode); | ||
2383 | } | ||
2384 | } | ||
2385 | memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap)); | ||
2386 | } else { | ||
2387 | printmsg("What type of logo do you want to set (\"%s\") ?\n",argv[2]); | ||
2388 | exit(-1); | ||
2389 | } | ||
2390 | |||
2391 | if (init) GSM_Init(true); | ||
2392 | |||
2393 | error=Phone->SetBitmap(&s,&Bitmap); | ||
2394 | Print_Error(error); | ||
2395 | |||
2396 | #ifdef GSM_ENABLE_BEEP | ||
2397 | GSM_PhoneBeep(); | ||
2398 | #endif | ||
2399 | |||
2400 | GSM_Terminate(); | ||
2401 | } | ||
2402 | |||
2403 | static void SetRingtone(int argc, char *argv[]) | ||
2404 | { | ||
2405 | GSM_Ringtone ringtone; | ||
2406 | int i,nextlong=0; | ||
2407 | |||
2408 | ringtone.Format= 0; | ||
2409 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | ||
2410 | Print_Error(error); | ||
2411 | ringtone.Location = 255; | ||
2412 | for (i=3;i<argc;i++) { | ||
2413 | switch (nextlong) { | ||
2414 | case 0: | ||
2415 | if (mystrncasecmp(argv[i],"-scale",0)) { | ||
2416 | ringtone.NoteTone.AllNotesScale = true; | ||
2417 | break; | ||
2418 | } | ||
2419 | if (mystrncasecmp(argv[i],"-location",0)) { | ||
2420 | nextlong = 1; | ||
2421 | break; | ||
2422 | } | ||
2423 | if (mystrncasecmp(argv[i],"-name",0)) { | ||
2424 | nextlong = 2; | ||
2425 | break; | ||
2426 | } | ||
2427 | printmsg("Unknown parameter \"%s\"",argv[i]); | ||
2428 | exit(-1); | ||
2429 | case 1: | ||
2430 | ringtone.Location=atoi(argv[i]); | ||
2431 | nextlong = 0; | ||
2432 | break; | ||
2433 | case 2: | ||
2434 | EncodeUnicode(ringtone.Name,argv[i],strlen(argv[i])); | ||
2435 | nextlong = 0; | ||
2436 | break; | ||
2437 | } | ||
2438 | } | ||
2439 | if (nextlong!=0) { | ||
2440 | printmsg("Parameter missed...\n"); | ||
2441 | exit(-1); | ||
2442 | } | ||
2443 | if (ringtone.Location==0) { | ||
2444 | printmsg("ERROR: enumerate locations from 1\n"); | ||
2445 | exit (-1); | ||
2446 | } | ||
2447 | |||
2448 | GSM_Init(true); | ||
2449 | error=Phone->SetRingtone(&s, &ringtone, &i); | ||
2450 | Print_Error(error); | ||
2451 | #ifdef GSM_ENABLE_BEEP | ||
2452 | GSM_PhoneBeep(); | ||
2453 | #endif | ||
2454 | GSM_Terminate(); | ||
2455 | } | ||
2456 | |||
2457 | static void DisplaySMSFrame(GSM_SMSMessage *SMS) | ||
2458 | { | ||
2459 | GSM_Error error; | ||
2460 | int i, length, current = 0; | ||
2461 | unsigned char req[1000], buffer[1000], hexreq[1000]; | ||
2462 | #ifdef OSCAR | ||
2463 | unsigned char hexmsg[1000], hexudh[1000]; | ||
2464 | #endif | ||
2465 | error=PHONE_EncodeSMSFrame(&s,SMS,buffer,PHONE_SMSSubmit,&length,true); | ||
2466 | if (error != ERR_NONE) { | ||
2467 | printmsg("Error\n"); | ||
2468 | exit(-1); | ||
2469 | } | ||
2470 | length = length - PHONE_SMSSubmit.Text; | ||
2471 | #ifdef OSCAR | ||
2472 | for(i=SMS->UDH.Length;i<length;i++) { | ||
2473 | req[i-SMS->UDH.Length]=buffer[PHONE_SMSSubmit.Text+i]; | ||
2474 | } | ||
2475 | EncodeHexBin(hexmsg, req, length-SMS->UDH.Length); | ||
2476 | |||
2477 | for(i=0;i<SMS->UDH.Length;i++) { | ||
2478 | req[i]=buffer[PHONE_SMSSubmit.Text+i]; | ||
2479 | } | ||
2480 | EncodeHexBin(hexudh, req, SMS->UDH.Length); | ||
2481 | |||
2482 | printf("msg:%s nb:%i udh:%s\n", | ||
2483 | hexmsg, | ||
2484 | (buffer[PHONE_SMSSubmit.TPUDL]-SMS->UDH.Length)*8, | ||
2485 | hexudh); | ||
2486 | #else | ||
2487 | for (i=0;i<buffer[PHONE_SMSSubmit.SMSCNumber]+1;i++) { | ||
2488 | req[current++]=buffer[PHONE_SMSSubmit.SMSCNumber+i]; | ||
2489 | } | ||
2490 | req[current++]=buffer[PHONE_SMSSubmit.firstbyte]; | ||
2491 | req[current++]=buffer[PHONE_SMSSubmit.TPMR]; | ||
2492 | for (i=0;i<((buffer[PHONE_SMSSubmit.Number]+1)/2+1)+1;i++) { | ||
2493 | req[current++]=buffer[PHONE_SMSSubmit.Number+i]; | ||
2494 | } | ||
2495 | req[current++]=buffer[PHONE_SMSSubmit.TPPID]; | ||
2496 | req[current++]=buffer[PHONE_SMSSubmit.TPDCS]; | ||
2497 | req[current++]=buffer[PHONE_SMSSubmit.TPVP]; | ||
2498 | req[current++]=buffer[PHONE_SMSSubmit.TPUDL]; | ||
2499 | for(i=0;i<length;i++) req[current++]=buffer[PHONE_SMSSubmit.Text+i]; | ||
2500 | EncodeHexBin(hexreq, req, current); | ||
2501 | printmsg("%s\n\n",hexreq); | ||
2502 | #endif | ||
2503 | } | ||
2504 | |||
2505 | #define SEND_SAVE_SMS_BUFFER_SIZE 10000 | ||
2506 | |||
2507 | static GSM_Error SMSStatus; | ||
2508 | //#if 0 | ||
2509 | static void SendSMSStatus (char *Device, int status, int MessageReference) | ||
2510 | { | ||
2511 | dbgprintf("Sent SMS on device: \"%s\"\n",Device); | ||
2512 | if (status==0) { | ||
2513 | printmsg("..OK"); | ||
2514 | SMSStatus = ERR_NONE; | ||
2515 | } else { | ||
2516 | printmsg("..error %i",status); | ||
2517 | SMSStatus = ERR_UNKNOWN; | ||
2518 | } | ||
2519 | printmsg(", message reference=%02x\n",MessageReference); | ||
2520 | } | ||
2521 | |||
2522 | static void SendSaveDisplaySMS(int argc, char *argv[]) | ||
2523 | { | ||
2524 | #ifdef GSM_ENABLE_BACKUP | ||
2525 | GSM_Backup Backup; | ||
2526 | #endif | ||
2527 | int i,j,z,FramesNum = 0; | ||
2528 | int Protected = 0; | ||
2529 | GSM_SMSFolders folders; | ||
2530 | GSM_MultiSMSMessage sms; | ||
2531 | GSM_Ringtone ringtone[MAX_MULTI_SMS]; | ||
2532 | GSM_MultiBitmap bitmap[MAX_MULTI_SMS],bitmap2; | ||
2533 | GSM_MultiPartSMSInfoSMSInfo; | ||
2534 | GSM_NetworkInfo NetInfo; | ||
2535 | GSM_MMSIndicator MMSInfo; | ||
2536 | FILE *ReplaceFile,*f; | ||
2537 | char ReplaceBuffer2[200],ReplaceBuffer[200]; | ||
2538 | char InputBuffer[SEND_SAVE_SMS_BUFFER_SIZE/2+1]; | ||
2539 | char Buffer [MAX_MULTI_SMS][SEND_SAVE_SMS_BUFFER_SIZE]; | ||
2540 | char Sender [(GSM_MAX_NUMBER_LENGTH+1)*2]; | ||
2541 | char Name [(GSM_MAX_NUMBER_LENGTH+1)*2]; | ||
2542 | char SMSC [(GSM_MAX_NUMBER_LENGTH+1)*2]; | ||
2543 | int startarg = 0; | ||
2544 | int chars_read = 0; | ||
2545 | int nextlong = 0; | ||
2546 | bool ReplyViaSameSMSC = false; | ||
2547 | int SMSCSet = 1; | ||
2548 | int MaxSMS = -1; | ||
2549 | bool EMS16Bit = false; | ||
2550 | bool SendSaved = false; | ||
2551 | |||
2552 | /* Parameters required only during saving */ | ||
2553 | int Folder = 1; /*Inbox by default */ | ||
2554 | GSM_SMS_State State = SMS_Sent; | ||
2555 | |||
2556 | /* Required only during sending */ | ||
2557 | GSM_SMSValidity Validity; | ||
2558 | GSM_SMSC PhoneSMSC; | ||
2559 | bool DeliveryReport = false; | ||
2560 | |||
2561 | ReplaceBuffer[0] = 0; | ||
2562 | ReplaceBuffer[1] = 0; | ||
2563 | GSM_ClearMultiPartSMSInfo(&SMSInfo); | ||
2564 | SMSInfo.ReplaceMessage = 0; | ||
2565 | SMSInfo.EntriesNum = 1; | ||
2566 | |||
2567 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2568 | EncodeUnicode(Sender,"Gammu",5); | ||
2569 | Name[0] = 0; | ||
2570 | Name[1] = 0; | ||
2571 | startarg = 0; | ||
2572 | } else { | ||
2573 | EncodeUnicode(Sender,argv[3],strlen(argv[3])); | ||
2574 | startarg = 1; | ||
2575 | Validity.Format = 0; | ||
2576 | } | ||
2577 | if (mystrncasecmp(argv[1],"--sendsmsdsms",0)) startarg=startarg+2; | ||
2578 | |||
2579 | if (mystrncasecmp(argv[2],"TEXT",0)) { | ||
2580 | chars_read = fread(InputBuffer, 1, SEND_SAVE_SMS_BUFFER_SIZE/2, stdin); | ||
2581 | if (chars_read == 0) printmsg("Warning: 0 chars read !\n"); | ||
2582 | InputBuffer[chars_read] = 0x00; | ||
2583 | InputBuffer[chars_read+1] = 0x00; | ||
2584 | EncodeUnicode(Buffer[0],InputBuffer,strlen(InputBuffer)); | ||
2585 | SMSInfo.Entries[0].Buffer = Buffer[0]; | ||
2586 | SMSInfo.Entries[0].ID = SMS_Text; | ||
2587 | SMSInfo.UnicodeCoding = false; | ||
2588 | startarg += 3; | ||
2589 | } else if (mystrncasecmp(argv[2],"SMSTEMPLATE",0)) { | ||
2590 | SMSInfo.UnicodeCoding = false; | ||
2591 | SMSInfo.EntriesNum = 1; | ||
2592 | Buffer[0][0] = 0x00; | ||
2593 | Buffer[0][1] = 0x00; | ||
2594 | SMSInfo.Entries[0].Buffer = Buffer[0]; | ||
2595 | SMSInfo.Entries[0].ID = SMS_AlcatelSMSTemplateName; | ||
2596 | startarg += 3; | ||
2597 | } else if (mystrncasecmp(argv[2],"EMS",0)) { | ||
2598 | SMSInfo.UnicodeCoding = false; | ||
2599 | SMSInfo.EntriesNum = 0; | ||
2600 | startarg += 3; | ||
2601 | } else if (mystrncasecmp(argv[2],"MMSINDICATOR",0)) { | ||
2602 | if (argc<6+startarg) { | ||
2603 | printmsg("Where is ringtone filename ?\n"); | ||
2604 | exit(-1); | ||
2605 | } | ||
2606 | SMSInfo.Entries[0].ID = SMS_MMSIndicatorLong; | ||
2607 | SMSInfo.Entries[0].MMSIndicator = &MMSInfo; | ||
2608 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2609 | EncodeUnicode(Sender,"MMS Info",8); | ||
2610 | } | ||
2611 | strcpy(MMSInfo.Address,argv[3+startarg]); | ||
2612 | strcpy(MMSInfo.Title,argv[4+startarg]); | ||
2613 | strcpy(MMSInfo.Sender,argv[5+startarg]); | ||
2614 | startarg += 6; | ||
2615 | } else if (mystrncasecmp(argv[2],"RINGTONE",0)) { | ||
2616 | if (argc<4+startarg) { | ||
2617 | printmsg("Where is ringtone filename ?\n"); | ||
2618 | exit(-1); | ||
2619 | } | ||
2620 | ringtone[0].Format=RING_NOTETONE; | ||
2621 | error=GSM_ReadRingtoneFile(argv[3+startarg],&ringtone[0]); | ||
2622 | Print_Error(error); | ||
2623 | SMSInfo.Entries[0].ID = SMS_NokiaRingtone; | ||
2624 | SMSInfo.Entries[0].Ringtone = &ringtone[0]; | ||
2625 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2626 | CopyUnicodeString(Sender, ringtone[0].Name); | ||
2627 | EncodeUnicode(Name,"Ringtone ",9); | ||
2628 | CopyUnicodeString(Name+9*2, ringtone[0].Name); | ||
2629 | } | ||
2630 | startarg += 4; | ||
2631 | } else if (mystrncasecmp(argv[2],"OPERATOR",0)) { | ||
2632 | if (argc<4+startarg) { | ||
2633 | printmsg("Where is logo filename ?\n"); | ||
2634 | exit(-1); | ||
2635 | } | ||
2636 | bitmap[0].Bitmap[0].Type=GSM_OperatorLogo; | ||
2637 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); | ||
2638 | Print_Error(error); | ||
2639 | strcpy(bitmap[0].Bitmap[0].NetworkCode,"000 00"); | ||
2640 | SMSInfo.Entries[0].ID = SMS_NokiaOperatorLogo; | ||
2641 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; | ||
2642 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2643 | EncodeUnicode(Sender, "OpLogo",6); | ||
2644 | EncodeUnicode(Name,"OpLogo ",7); | ||
2645 | } | ||
2646 | startarg += 4; | ||
2647 | } else if (mystrncasecmp(argv[2],"CALLER",0)) { | ||
2648 | if (argc<4+startarg) { | ||
2649 | printmsg("Where is logo filename ?\n"); | ||
2650 | exit(-1); | ||
2651 | } | ||
2652 | bitmap[0].Bitmap[0].Type=GSM_CallerGroupLogo; | ||
2653 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); | ||
2654 | Print_Error(error); | ||
2655 | SMSInfo.Entries[0].ID = SMS_NokiaCallerLogo; | ||
2656 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; | ||
2657 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2658 | EncodeUnicode(Sender, "Caller",6); | ||
2659 | } | ||
2660 | startarg += 4; | ||
2661 | } else if (mystrncasecmp(argv[2],"ANIMATION",0)) { | ||
2662 | SMSInfo.UnicodeCoding = false; | ||
2663 | SMSInfo.EntriesNum = 1; | ||
2664 | if (argc<4+startarg) { | ||
2665 | printmsg("Where is number of frames ?\n"); | ||
2666 | exit(-1); | ||
2667 | } | ||
2668 | bitmap[0].Number = 0; | ||
2669 | i = 1; | ||
2670 | while (1) { | ||
2671 | bitmap2.Bitmap[0].Type=GSM_StartupLogo; | ||
2672 | error=GSM_ReadBitmapFile(argv[3+startarg+i],&bitmap2); | ||
2673 | Print_Error(error); | ||
2674 | for (j=0;j<bitmap2.Number;j++) { | ||
2675 | if (bitmap[0].Number == atoi(argv[3+startarg])) break; | ||
2676 | memcpy(&bitmap[0].Bitmap[bitmap[0].Number],&bitmap2.Bitmap[j],sizeof(GSM_Bitmap)); | ||
2677 | bitmap[0].Number++; | ||
2678 | } | ||
2679 | if (bitmap[0].Number == atoi(argv[3+startarg])) break; | ||
2680 | i++; | ||
2681 | } | ||
2682 | SMSInfo.Entries[0].ID = SMS_AlcatelMonoAnimationLong; | ||
2683 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; | ||
2684 | bitmap[0].Bitmap[0].Text[0]= 0; | ||
2685 | bitmap[0].Bitmap[0].Text[1]= 0; | ||
2686 | startarg += 4 + atoi(argv[3+startarg]); | ||
2687 | } else if (mystrncasecmp(argv[2],"PICTURE",0)) { | ||
2688 | if (argc<4+startarg) { | ||
2689 | printmsg("Where is logo filename ?\n"); | ||
2690 | exit(-1); | ||
2691 | } | ||
2692 | bitmap[0].Bitmap[0].Type=GSM_PictureImage; | ||
2693 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); | ||
2694 | printmsg("File \"%s\"\n",argv[3+startarg]); | ||
2695 | Print_Error(error); | ||
2696 | SMSInfo.Entries[0].ID = SMS_NokiaPictureImageLong; | ||
2697 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; | ||
2698 | SMSInfo.UnicodeCoding = false; | ||
2699 | bitmap[0].Bitmap[0].Text[0]= 0; | ||
2700 | bitmap[0].Bitmap[0].Text[1]= 0; | ||
2701 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2702 | EncodeUnicode(Sender, "Picture",7); | ||
2703 | EncodeUnicode(Name,"Picture Image",13); | ||
2704 | } | ||
2705 | startarg += 4; | ||
2706 | #ifdef GSM_ENABLE_BACKUP | ||
2707 | } else if (mystrncasecmp(argv[2],"BOOKMARK",0)) { | ||
2708 | if (argc<5+startarg) { | ||
2709 | printmsg("Where is backup filename and location ?\n"); | ||
2710 | exit(-1); | ||
2711 | } | ||
2712 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | ||
2713 | Print_Error(error); | ||
2714 | i = 0; | ||
2715 | while (Backup.WAPBookmark[i]!=NULL) { | ||
2716 | if (i == atoi(argv[4+startarg])-1) break; | ||
2717 | i++; | ||
2718 | } | ||
2719 | if (i != atoi(argv[4+startarg])-1) { | ||
2720 | printmsg("Bookmark not found in file\n"); | ||
2721 | exit(-1); | ||
2722 | } | ||
2723 | SMSInfo.Entries[0].ID = SMS_NokiaWAPBookmarkLong; | ||
2724 | SMSInfo.Entries[0].Bookmark = Backup.WAPBookmark[i]; | ||
2725 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2726 | EncodeUnicode(Sender, "Bookmark",8); | ||
2727 | EncodeUnicode(Name,"WAP Bookmark",12); | ||
2728 | } | ||
2729 | startarg += 5; | ||
2730 | } else if (mystrncasecmp(argv[2],"WAPSETTINGS",0)) { | ||
2731 | if (argc<6+startarg) { | ||
2732 | printmsg("Where is backup filename and location ?\n"); | ||
2733 | exit(-1); | ||
2734 | } | ||
2735 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | ||
2736 | Print_Error(error); | ||
2737 | i = 0; | ||
2738 | while (Backup.WAPSettings[i]!=NULL) { | ||
2739 | if (i == atoi(argv[4+startarg])-1) break; | ||
2740 | i++; | ||
2741 | } | ||
2742 | if (i != atoi(argv[4+startarg])-1) { | ||
2743 | printmsg("WAP settings not found in file\n"); | ||
2744 | exit(-1); | ||
2745 | } | ||
2746 | SMSInfo.Entries[0].Settings = NULL; | ||
2747 | for (j=0;j<Backup.WAPSettings[i]->Number;j++) { | ||
2748 | switch (Backup.WAPSettings[i]->Settings[j].Bearer) { | ||
2749 | case WAPSETTINGS_BEARER_GPRS: | ||
2750 | if (mystrncasecmp(argv[5+startarg],"GPRS",0)) { | ||
2751 | SMSInfo.Entries[0].Settings = &Backup.WAPSettings[i]->Settings[j]; | ||
2752 | break; | ||
2753 | } | ||
2754 | case WAPSETTINGS_BEARER_DATA: | ||
2755 | if (mystrncasecmp(argv[5+startarg],"DATA",0)) { | ||
2756 | SMSInfo.Entries[0].Settings = &Backup.WAPSettings[i]->Settings[j]; | ||
2757 | break; | ||
2758 | } | ||
2759 | default: | ||
2760 | break; | ||
2761 | } | ||
2762 | } | ||
2763 | if (SMSInfo.Entries[0].Settings == NULL) { | ||
2764 | printmsg("Sorry. For now there is only support for GPRS or DATA bearers end\n"); | ||
2765 | exit(-1); | ||
2766 | } | ||
2767 | SMSInfo.Entries[0].ID = SMS_NokiaWAPSettingsLong; | ||
2768 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2769 | EncodeUnicode(Sender, "Settings",8); | ||
2770 | EncodeUnicode(Name,"WAP Settings",12); | ||
2771 | } | ||
2772 | startarg += 6; | ||
2773 | } else if (mystrncasecmp(argv[2],"MMSSETTINGS",0)) { | ||
2774 | if (argc<5+startarg) { | ||
2775 | printmsg("Where is backup filename and location ?\n"); | ||
2776 | exit(-1); | ||
2777 | } | ||
2778 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | ||
2779 | Print_Error(error); | ||
2780 | i = 0; | ||
2781 | while (Backup.MMSSettings[i]!=NULL) { | ||
2782 | if (i == atoi(argv[4+startarg])-1) break; | ||
2783 | i++; | ||
2784 | } | ||
2785 | if (i != atoi(argv[4+startarg])-1) { | ||
2786 | printmsg("MMS settings not found in file\n"); | ||
2787 | exit(-1); | ||
2788 | } | ||
2789 | SMSInfo.Entries[0].Settings = NULL; | ||
2790 | for (j=0;j<Backup.MMSSettings[i]->Number;j++) { | ||
2791 | switch (Backup.MMSSettings[i]->Settings[j].Bearer) { | ||
2792 | case WAPSETTINGS_BEARER_GPRS: | ||
2793 | SMSInfo.Entries[0].Settings = &Backup.MMSSettings[i]->Settings[j]; | ||
2794 | break; | ||
2795 | default: | ||
2796 | break; | ||
2797 | } | ||
2798 | } | ||
2799 | if (SMSInfo.Entries[0].Settings == NULL) { | ||
2800 | printmsg("Sorry. No GPRS bearer found in MMS settings\n"); | ||
2801 | exit(-1); | ||
2802 | } | ||
2803 | SMSInfo.Entries[0].ID = SMS_NokiaMMSSettingsLong; | ||
2804 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2805 | EncodeUnicode(Sender, "Settings",8); | ||
2806 | EncodeUnicode(Name,"MMS Settings",12); | ||
2807 | } | ||
2808 | startarg += 5; | ||
2809 | } else if (mystrncasecmp(argv[2],"CALENDAR",0)) { | ||
2810 | if (argc<5+startarg) { | ||
2811 | printmsg("Where is backup filename and location ?\n"); | ||
2812 | exit(-1); | ||
2813 | } | ||
2814 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | ||
2815 | Print_Error(error); | ||
2816 | i = 0; | ||
2817 | while (Backup.Calendar[i]!=NULL) { | ||
2818 | if (i == atoi(argv[4+startarg])-1) break; | ||
2819 | i++; | ||
2820 | } | ||
2821 | if (i != atoi(argv[4+startarg])-1) { | ||
2822 | printmsg("Calendar note not found in file\n"); | ||
2823 | exit(-1); | ||
2824 | } | ||
2825 | SMSInfo.Entries[0].ID = SMS_NokiaVCALENDAR10Long; | ||
2826 | SMSInfo.Entries[0].Calendar = Backup.Calendar[i]; | ||
2827 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2828 | EncodeUnicode(Sender, "Calendar",8); | ||
2829 | } | ||
2830 | startarg += 5; | ||
2831 | } else if (mystrncasecmp(argv[2],"TODO",0)) { | ||
2832 | if (argc<5+startarg) { | ||
2833 | printmsg("Where is backup filename and location ?\n"); | ||
2834 | exit(-1); | ||
2835 | } | ||
2836 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | ||
2837 | Print_Error(error); | ||
2838 | i = 0; | ||
2839 | while (Backup.ToDo[i]!=NULL) { | ||
2840 | if (i == atoi(argv[4+startarg])-1) break; | ||
2841 | i++; | ||
2842 | } | ||
2843 | if (i != atoi(argv[4+startarg])-1) { | ||
2844 | printmsg("ToDo note not found in file\n"); | ||
2845 | exit(-1); | ||
2846 | } | ||
2847 | SMSInfo.Entries[0].ID = SMS_NokiaVTODOLong; | ||
2848 | SMSInfo.Entries[0].ToDo = Backup.ToDo[i]; | ||
2849 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2850 | EncodeUnicode(Sender, "ToDo",8); | ||
2851 | } | ||
2852 | startarg += 5; | ||
2853 | } else if (mystrncasecmp(argv[2],"VCARD10",0) || mystrncasecmp(argv[2],"VCARD21",0)) { | ||
2854 | if (argc<6+startarg) { | ||
2855 | printmsg("Where is backup filename and location and memory type ?\n"); | ||
2856 | exit(-1); | ||
2857 | } | ||
2858 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | ||
2859 | Print_Error(error); | ||
2860 | i = 0; | ||
2861 | if (mystrncasecmp(argv[4+startarg],"SM",0)) { | ||
2862 | while (Backup.SIMPhonebook[i]!=NULL) { | ||
2863 | if (i == atoi(argv[5+startarg])-1) break; | ||
2864 | i++; | ||
2865 | } | ||
2866 | if (i != atoi(argv[5+startarg])-1) { | ||
2867 | printmsg("Phonebook entry not found in file\n"); | ||
2868 | exit(-1); | ||
2869 | } | ||
2870 | SMSInfo.Entries[0].Phonebook = Backup.SIMPhonebook[i]; | ||
2871 | } else if (mystrncasecmp(argv[4+startarg],"ME",0)) { | ||
2872 | while (Backup.PhonePhonebook[i]!=NULL) { | ||
2873 | if (i == atoi(argv[5+startarg])-1) break; | ||
2874 | i++; | ||
2875 | } | ||
2876 | if (i != atoi(argv[5+startarg])-1) { | ||
2877 | printmsg("Phonebook entry not found in file\n"); | ||
2878 | exit(-1); | ||
2879 | } | ||
2880 | SMSInfo.Entries[0].Phonebook = Backup.PhonePhonebook[i]; | ||
2881 | } else { | ||
2882 | printmsg("Unknown memory type: \"%s\"\n",argv[4+startarg]); | ||
2883 | exit(-1); | ||
2884 | } | ||
2885 | if (mystrncasecmp(argv[2],"VCARD10",0)) { | ||
2886 | SMSInfo.Entries[0].ID = SMS_VCARD10Long; | ||
2887 | } else { | ||
2888 | SMSInfo.Entries[0].ID = SMS_VCARD21Long; | ||
2889 | } | ||
2890 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2891 | EncodeUnicode(Sender, "VCARD",5); | ||
2892 | EncodeUnicode(Name, "Phonebook entry",15); | ||
2893 | } | ||
2894 | startarg += 6; | ||
2895 | #endif | ||
2896 | } else if (mystrncasecmp(argv[2],"PROFILE",0)) { | ||
2897 | SMSInfo.Entries[0].ID = SMS_NokiaProfileLong; | ||
2898 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2899 | EncodeUnicode(Sender, "Profile",7); | ||
2900 | } | ||
2901 | startarg += 3; | ||
2902 | } else { | ||
2903 | printmsg("What format of sms (\"%s\") ?\n",argv[2]); | ||
2904 | exit(-1); | ||
2905 | } | ||
2906 | |||
2907 | for (i=startarg;i<argc;i++) { | ||
2908 | switch (nextlong) { | ||
2909 | case 0: | ||
2910 | if (mystrncasecmp(argv[1],"--savesms",0) || SendSaved) { | ||
2911 | if (mystrncasecmp(argv[i],"-folder",0)) { | ||
2912 | nextlong=1; | ||
2913 | continue; | ||
2914 | } | ||
2915 | } | ||
2916 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2917 | if (mystrncasecmp(argv[i],"-unread",0)) { | ||
2918 | State = SMS_UnRead; | ||
2919 | continue; | ||
2920 | } | ||
2921 | if (mystrncasecmp(argv[i],"-read",0)) { | ||
2922 | State = SMS_Read; | ||
2923 | continue; | ||
2924 | } | ||
2925 | if (mystrncasecmp(argv[i],"-unsent",0)) { | ||
2926 | State = SMS_UnSent; | ||
2927 | continue; | ||
2928 | } | ||
2929 | if (mystrncasecmp(argv[i],"-sent",0)) { | ||
2930 | State = SMS_Sent; | ||
2931 | continue; | ||
2932 | } | ||
2933 | if (mystrncasecmp(argv[i],"-sender",0)) { | ||
2934 | nextlong=2; | ||
2935 | continue; | ||
2936 | } | ||
2937 | } else { | ||
2938 | if (mystrncasecmp(argv[i],"-save",0)) { | ||
2939 | SendSaved=true; | ||
2940 | continue; | ||
2941 | } | ||
2942 | if (mystrncasecmp(argv[i],"-report",0)) { | ||
2943 | DeliveryReport=true; | ||
2944 | continue; | ||
2945 | } | ||
2946 | if (mystrncasecmp(argv[i],"-validity",0)) { | ||
2947 | nextlong=10; | ||
2948 | continue; | ||
2949 | } | ||
2950 | } | ||
2951 | if (mystrncasecmp(argv[i],"-smscset",0)) { | ||
2952 | nextlong=3; | ||
2953 | continue; | ||
2954 | } | ||
2955 | if (mystrncasecmp(argv[i],"-smscnumber",0)) { | ||
2956 | nextlong=4; | ||
2957 | continue; | ||
2958 | } | ||
2959 | if (mystrncasecmp(argv[i],"-protected",0)) { | ||
2960 | nextlong=19; | ||
2961 | continue; | ||
2962 | } | ||
2963 | if (mystrncasecmp(argv[i],"-reply",0)) { | ||
2964 | ReplyViaSameSMSC=true; | ||
2965 | continue; | ||
2966 | } | ||
2967 | if (mystrncasecmp(argv[i],"-maxsms",0)) { | ||
2968 | nextlong=21; | ||
2969 | continue; | ||
2970 | } | ||
2971 | if (mystrncasecmp(argv[2],"RINGTONE",0)) { | ||
2972 | if (mystrncasecmp(argv[i],"-long",0)) { | ||
2973 | SMSInfo.Entries[0].ID = SMS_NokiaRingtoneLong; | ||
2974 | break; | ||
2975 | } | ||
2976 | if (mystrncasecmp(argv[i],"-scale",0)) { | ||
2977 | ringtone[0].NoteTone.AllNotesScale=true; | ||
2978 | break; | ||
2979 | } | ||
2980 | } | ||
2981 | if (mystrncasecmp(argv[2],"TEXT",0)) { | ||
2982 | if (mystrncasecmp(argv[i],"-inputunicode",0)) { | ||
2983 | ReadUnicodeFile(Buffer[0],InputBuffer); | ||
2984 | break; | ||
2985 | } | ||
2986 | if (mystrncasecmp(argv[i],"-16bit",0)) { | ||
2987 | if (SMSInfo.Entries[0].ID == SMS_ConcatenatedTextLong) SMSInfo.Entries[0].ID = SMS_ConcatenatedTextLong16bit; | ||
2988 | if (SMSInfo.Entries[0].ID == SMS_ConcatenatedAutoTextLong) SMSInfo.Entries[0].ID = SMS_ConcatenatedAutoTextLong16bit; | ||
2989 | break; | ||
2990 | } | ||
2991 | if (mystrncasecmp(argv[i],"-flash",0)) { | ||
2992 | SMSInfo.Class = 0; | ||
2993 | break; | ||
2994 | } | ||
2995 | if (mystrncasecmp(argv[i],"-len",0)) { | ||
2996 | nextlong = 5; | ||
2997 | break; | ||
2998 | } | ||
2999 | if (mystrncasecmp(argv[i],"-autolen",0)) { | ||
3000 | nextlong = 5; | ||
3001 | break; | ||
3002 | } | ||
3003 | if (mystrncasecmp(argv[i],"-unicode",0)) { | ||
3004 | SMSInfo.UnicodeCoding = true; | ||
3005 | break; | ||
3006 | } | ||
3007 | if (mystrncasecmp(argv[i],"-enablevoice",0)) { | ||
3008 | SMSInfo.Entries[0].ID = SMS_EnableVoice; | ||
3009 | break; | ||
3010 | } | ||
3011 | if (mystrncasecmp(argv[i],"-disablevoice",0)) { | ||
3012 | SMSInfo.Entries[0].ID = SMS_DisableVoice; | ||
3013 | break; | ||
3014 | } | ||
3015 | if (mystrncasecmp(argv[i],"-enablefax",0)) { | ||
3016 | SMSInfo.Entries[0].ID = SMS_EnableFax; | ||
3017 | break; | ||
3018 | } | ||
3019 | if (mystrncasecmp(argv[i],"-disablefax",0)) { | ||
3020 | SMSInfo.Entries[0].ID = SMS_DisableFax; | ||
3021 | break; | ||
3022 | } | ||
3023 | if (mystrncasecmp(argv[i],"-enableemail",0)) { | ||
3024 | SMSInfo.Entries[0].ID = SMS_EnableEmail; | ||
3025 | break; | ||
3026 | } | ||
3027 | if (mystrncasecmp(argv[i],"-disableemail",0)) { | ||
3028 | SMSInfo.Entries[0].ID = SMS_DisableEmail; | ||
3029 | break; | ||
3030 | } | ||
3031 | if (mystrncasecmp(argv[i],"-voidsms",0)) { | ||
3032 | SMSInfo.Entries[0].ID = SMS_VoidSMS; | ||
3033 | break; | ||
3034 | } | ||
3035 | if (mystrncasecmp(argv[i],"-replacemessages",0) && | ||
3036 | SMSInfo.Entries[0].ID != SMS_ConcatenatedTextLong) { | ||
3037 | nextlong = 8; | ||
3038 | break; | ||
3039 | } | ||
3040 | if (mystrncasecmp(argv[i],"-replacefile",0)) { | ||
3041 | nextlong = 9; | ||
3042 | continue; | ||
3043 | } | ||
3044 | } | ||
3045 | if (mystrncasecmp(argv[2],"PICTURE",0)) { | ||
3046 | if (mystrncasecmp(argv[i],"-text",0)) { | ||
3047 | nextlong = 6; | ||
3048 | break; | ||
3049 | } | ||
3050 | if (mystrncasecmp(argv[i],"-unicode",0)) { | ||
3051 | SMSInfo.UnicodeCoding = true; | ||
3052 | break; | ||
3053 | } | ||
3054 | if (mystrncasecmp(argv[i],"-alcatelbmmi",0)) { | ||
3055 | bitmap[0].Bitmap[0].Type=GSM_StartupLogo; | ||
3056 | error=GSM_ReadBitmapFile(argv[startarg-1],&bitmap[0]); | ||
3057 | Print_Error(error); | ||
3058 | SMSInfo.UnicodeCoding = true; | ||
3059 | SMSInfo.Entries[0].ID = SMS_AlcatelMonoBitmapLong; | ||
3060 | break; | ||
3061 | } | ||
3062 | break; | ||
3063 | } | ||
3064 | if (mystrncasecmp(argv[2],"VCARD10",0)) { | ||
3065 | if (mystrncasecmp(argv[i],"-nokia",0)) { | ||
3066 | SMSInfo.Entries[0].ID = SMS_NokiaVCARD10Long; | ||
3067 | break; | ||
3068 | } | ||
3069 | break; | ||
3070 | } | ||
3071 | if (mystrncasecmp(argv[2],"VCARD21",0)) { | ||
3072 | if (mystrncasecmp(argv[i],"-nokia",0)) { | ||
3073 | SMSInfo.Entries[0].ID = SMS_NokiaVCARD21Long; | ||
3074 | break; | ||
3075 | } | ||
3076 | break; | ||
3077 | } | ||
3078 | if (mystrncasecmp(argv[2],"PROFILE",0)) { | ||
3079 | if (mystrncasecmp(argv[i],"-name",0)) { | ||
3080 | nextlong = 22; | ||
3081 | break; | ||
3082 | } | ||
3083 | if (mystrncasecmp(argv[i],"-ringtone",0)) { | ||
3084 | nextlong = 23; | ||
3085 | break; | ||
3086 | } | ||
3087 | if (mystrncasecmp(argv[i],"-bitmap",0)) { | ||
3088 | nextlong = 24; | ||
3089 | break; | ||
3090 | } | ||
3091 | } | ||
3092 | if (mystrncasecmp(argv[2],"SMSTEMPLATE",0)) { | ||
3093 | if (mystrncasecmp(argv[i],"-unicode",0)) { | ||
3094 | SMSInfo.UnicodeCoding = true; | ||
3095 | break; | ||
3096 | } | ||
3097 | if (mystrncasecmp(argv[i],"-text",0)) { | ||
3098 | nextlong = 11; | ||
3099 | break; | ||
3100 | } | ||
3101 | if (mystrncasecmp(argv[i],"-unicodefiletext",0)) { | ||
3102 | nextlong = 18; | ||
3103 | break; | ||
3104 | } | ||
3105 | if (mystrncasecmp(argv[i],"-defsound",0)) { | ||
3106 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSPredefinedSound; | ||
3107 | nextlong = 12; | ||
3108 | break; | ||
3109 | } | ||
3110 | if (mystrncasecmp(argv[i],"-defanimation",0)) { | ||
3111 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSPredefinedAnimation; | ||
3112 | nextlong = 12; | ||
3113 | break; | ||
3114 | } | ||
3115 | if (mystrncasecmp(argv[i],"-tone10",0)) { | ||
3116 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound10; | ||
3117 | if (Protected != 0) { | ||
3118 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3119 | Protected --; | ||
3120 | } | ||
3121 | nextlong = 14; | ||
3122 | break; | ||
3123 | } | ||
3124 | if (mystrncasecmp(argv[i],"-tone10long",0)) { | ||
3125 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound10Long; | ||
3126 | if (Protected != 0) { | ||
3127 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3128 | Protected --; | ||
3129 | } | ||
3130 | nextlong = 14; | ||
3131 | break; | ||
3132 | } | ||
3133 | if (mystrncasecmp(argv[i],"-tone12",0)) { | ||
3134 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound12; | ||
3135 | if (Protected != 0) { | ||
3136 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3137 | Protected --; | ||
3138 | } | ||
3139 | nextlong = 14; | ||
3140 | break; | ||
3141 | } | ||
3142 | if (mystrncasecmp(argv[i],"-tone12long",0)) { | ||
3143 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound12Long; | ||
3144 | if (Protected != 0) { | ||
3145 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3146 | Protected --; | ||
3147 | } | ||
3148 | nextlong = 14; | ||
3149 | break; | ||
3150 | } | ||
3151 | if (mystrncasecmp(argv[i],"-toneSE",0)) { | ||
3152 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSonyEricssonSound; | ||
3153 | if (Protected != 0) { | ||
3154 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3155 | Protected --; | ||
3156 | } | ||
3157 | nextlong = 14; | ||
3158 | break; | ||
3159 | } | ||
3160 | if (mystrncasecmp(argv[i],"-toneSElong",0)) { | ||
3161 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSonyEricssonSoundLong; | ||
3162 | if (Protected != 0) { | ||
3163 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3164 | Protected --; | ||
3165 | } | ||
3166 | nextlong = 14; | ||
3167 | break; | ||
3168 | } | ||
3169 | if (mystrncasecmp(argv[i],"-variablebitmap",0)) { | ||
3170 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSVariableBitmap; | ||
3171 | if (Protected != 0) { | ||
3172 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3173 | Protected --; | ||
3174 | } | ||
3175 | nextlong = 15; | ||
3176 | break; | ||
3177 | } | ||
3178 | if (mystrncasecmp(argv[i],"-variablebitmaplong",0)) { | ||
3179 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSVariableBitmapLong; | ||
3180 | if (Protected != 0) { | ||
3181 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3182 | Protected --; | ||
3183 | } | ||
3184 | nextlong = 15; | ||
3185 | break; | ||
3186 | } | ||
3187 | if (mystrncasecmp(argv[i],"-animation",0)) { | ||
3188 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSAnimation; | ||
3189 | if (Protected != 0) { | ||
3190 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3191 | Protected --; | ||
3192 | } | ||
3193 | bitmap[SMSInfo.EntriesNum].Number = 0; | ||
3194 | nextlong = 16; | ||
3195 | break; | ||
3196 | } | ||
3197 | } | ||
3198 | if (mystrncasecmp(argv[2],"EMS",0)) { | ||
3199 | if (mystrncasecmp(argv[i],"-unicode",0)) { | ||
3200 | SMSInfo.UnicodeCoding = true; | ||
3201 | break; | ||
3202 | } | ||
3203 | if (mystrncasecmp(argv[i],"-16bit",0)) { | ||
3204 | EMS16Bit = true; | ||
3205 | break; | ||
3206 | } | ||
3207 | if (mystrncasecmp(argv[i],"-format",0)) { | ||
3208 | nextlong = 20; | ||
3209 | break; | ||
3210 | } | ||
3211 | if (mystrncasecmp(argv[i],"-text",0)) { | ||
3212 | nextlong = 11; | ||
3213 | break; | ||
3214 | } | ||
3215 | if (mystrncasecmp(argv[i],"-unicodefiletext",0)) { | ||
3216 | nextlong = 18; | ||
3217 | break; | ||
3218 | } | ||
3219 | if (mystrncasecmp(argv[i],"-defsound",0)) { | ||
3220 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSPredefinedSound; | ||
3221 | nextlong = 12; | ||
3222 | break; | ||
3223 | } | ||
3224 | if (mystrncasecmp(argv[i],"-defanimation",0)) { | ||
3225 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSPredefinedAnimation; | ||
3226 | nextlong = 12; | ||
3227 | break; | ||
3228 | } | ||
3229 | if (mystrncasecmp(argv[i],"-tone10",0)) { | ||
3230 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound10; | ||
3231 | if (Protected != 0) { | ||
3232 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3233 | Protected --; | ||
3234 | } | ||
3235 | nextlong = 14; | ||
3236 | break; | ||
3237 | } | ||
3238 | if (mystrncasecmp(argv[i],"-tone10long",0)) { | ||
3239 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound10Long; | ||
3240 | if (Protected != 0) { | ||
3241 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3242 | Protected --; | ||
3243 | } | ||
3244 | nextlong = 14; | ||
3245 | break; | ||
3246 | } | ||
3247 | if (mystrncasecmp(argv[i],"-tone12",0)) { | ||
3248 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound12; | ||
3249 | if (Protected != 0) { | ||
3250 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3251 | Protected --; | ||
3252 | } | ||
3253 | nextlong = 14; | ||
3254 | break; | ||
3255 | } | ||
3256 | if (mystrncasecmp(argv[i],"-tone12long",0)) { | ||
3257 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSound12Long; | ||
3258 | if (Protected != 0) { | ||
3259 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3260 | Protected --; | ||
3261 | } | ||
3262 | nextlong = 14; | ||
3263 | break; | ||
3264 | } | ||
3265 | if (mystrncasecmp(argv[i],"-toneSE",0)) { | ||
3266 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSonyEricssonSound; | ||
3267 | if (Protected != 0) { | ||
3268 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3269 | Protected --; | ||
3270 | } | ||
3271 | nextlong = 14; | ||
3272 | break; | ||
3273 | } | ||
3274 | if (mystrncasecmp(argv[i],"-toneSElong",0)) { | ||
3275 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSSonyEricssonSoundLong; | ||
3276 | if (Protected != 0) { | ||
3277 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3278 | Protected --; | ||
3279 | } | ||
3280 | nextlong = 14; | ||
3281 | break; | ||
3282 | } | ||
3283 | if (mystrncasecmp(argv[i],"-fixedbitmap",0)) { | ||
3284 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSFixedBitmap; | ||
3285 | if (Protected != 0) { | ||
3286 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3287 | Protected --; | ||
3288 | } | ||
3289 | nextlong = 15; | ||
3290 | break; | ||
3291 | } | ||
3292 | if (mystrncasecmp(argv[i],"-variablebitmap",0)) { | ||
3293 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSVariableBitmap; | ||
3294 | if (Protected != 0) { | ||
3295 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3296 | Protected --; | ||
3297 | } | ||
3298 | nextlong = 15; | ||
3299 | break; | ||
3300 | } | ||
3301 | if (mystrncasecmp(argv[i],"-variablebitmaplong",0)) { | ||
3302 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSVariableBitmapLong; | ||
3303 | if (Protected != 0) { | ||
3304 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3305 | Protected --; | ||
3306 | } | ||
3307 | nextlong = 15; | ||
3308 | break; | ||
3309 | } | ||
3310 | if (mystrncasecmp(argv[i],"-animation",0)) { | ||
3311 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_EMSAnimation; | ||
3312 | if (Protected != 0) { | ||
3313 | SMSInfo.Entries[SMSInfo.EntriesNum].Protected = true; | ||
3314 | Protected --; | ||
3315 | } | ||
3316 | bitmap[SMSInfo.EntriesNum].Number = 0; | ||
3317 | nextlong = 16; | ||
3318 | break; | ||
3319 | } | ||
3320 | } | ||
3321 | if (mystrncasecmp(argv[2],"OPERATOR",0)) { | ||
3322 | if (mystrncasecmp(argv[i],"-netcode",0)) { | ||
3323 | nextlong = 7; | ||
3324 | break; | ||
3325 | } | ||
3326 | if (mystrncasecmp(argv[i],"-biglogo",0)) { | ||
3327 | SMSInfo.Entries[0].ID = SMS_NokiaOperatorLogoLong; | ||
3328 | break; | ||
3329 | } | ||
3330 | break; | ||
3331 | } | ||
3332 | printmsg("Unknown parameter (\"%s\")\n",argv[i]); | ||
3333 | exit(-1); | ||
3334 | break; | ||
3335 | case 1: /* SMS folder - only during saving SMS */ | ||
3336 | Folder = atoi(argv[i]); | ||
3337 | nextlong = 0; | ||
3338 | break; | ||
3339 | case 2: /* Sender number - only during saving SMS */ | ||
3340 | EncodeUnicode(Sender,argv[i],strlen(argv[i])); | ||
3341 | nextlong = 0; | ||
3342 | break; | ||
3343 | case 3: /* SMSC set number */ | ||
3344 | SMSCSet = atoi(argv[i]); | ||
3345 | nextlong = 0; | ||
3346 | break; | ||
3347 | case 4: /* Number of SMSC */ | ||
3348 | EncodeUnicode(SMSC,argv[i],strlen(argv[i])); | ||
3349 | SMSCSet = 0; | ||
3350 | nextlong= 0; | ||
3351 | break; | ||
3352 | case 5: /* Length of text SMS */ | ||
3353 | if (atoi(argv[i])<chars_read) | ||
3354 | { | ||
3355 | Buffer[0][atoi(argv[i])*2]= 0x00; | ||
3356 | Buffer[0][atoi(argv[i])*2+1]= 0x00; | ||
3357 | } | ||
3358 | SMSInfo.Entries[0].ID = SMS_ConcatenatedTextLong; | ||
3359 | if (mystrncasecmp(argv[i-1],"-autolen",0)) SMSInfo.Entries[0].ID = SMS_ConcatenatedAutoTextLong; | ||
3360 | nextlong = 0; | ||
3361 | break; | ||
3362 | case 6:/* Picture Images - text */ | ||
3363 | EncodeUnicode(bitmap[0].Bitmap[0].Text,argv[i],strlen(argv[i])); | ||
3364 | nextlong = 0; | ||
3365 | break; | ||
3366 | case 7:/* Operator Logo - network code */ | ||
3367 | strncpy(bitmap[0].Bitmap[0].NetworkCode,argv[i],7); | ||
3368 | if (!strcmp(DecodeUnicodeConsole(GSM_GetNetworkName(bitmap[0].Bitmap[0].NetworkCode)),"unknown")) { | ||
3369 | printmsg("Unknown GSM network code (\"%s\")\n",argv[i]); | ||
3370 | exit(-1); | ||
3371 | } | ||
3372 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
3373 | EncodeUnicode(Sender, "OpLogo",6); | ||
3374 | EncodeUnicode(Sender+6*2,bitmap[0].Bitmap[0].NetworkCode,3); | ||
3375 | EncodeUnicode(Sender+6*2+3*2,bitmap[0].Bitmap[0].NetworkCode+4,2); | ||
3376 | if (UnicodeLength(GSM_GetNetworkName(bitmap[0].Bitmap[0].NetworkCode))<GSM_MAX_SMS_NAME_LENGTH-7) { | ||
3377 | EncodeUnicode(Name,"OpLogo ",7); | ||
3378 | CopyUnicodeString(Name+7*2,GSM_GetNetworkName(bitmap[0].Bitmap[0].NetworkCode)); | ||
3379 | } else { | ||
3380 | CopyUnicodeString(Name,Sender); | ||
3381 | } | ||
3382 | } | ||
3383 | nextlong = 0; | ||
3384 | break; | ||
3385 | case 8:/* Reject duplicates ID */ | ||
3386 | SMSInfo.ReplaceMessage = atoi(argv[i]); | ||
3387 | if (SMSInfo.ReplaceMessage < 1 || SMSInfo.ReplaceMessage > 7) { | ||
3388 | printmsg("You have to give number between 1 and 7 (\"%s\")\n",argv[i]); | ||
3389 | exit(-1); | ||
3390 | } | ||
3391 | nextlong = 0; | ||
3392 | break; | ||
3393 | case 9:/* Replace file for text SMS */ | ||
3394 | ReplaceFile = fopen(argv[i], "rb"); | ||
3395 | if (ReplaceFile == NULL) Print_Error(ERR_CANTOPENFILE); | ||
3396 | memset(ReplaceBuffer,0,sizeof(ReplaceBuffer)); | ||
3397 | fread(ReplaceBuffer,1,sizeof(ReplaceBuffer),ReplaceFile); | ||
3398 | fclose(ReplaceFile); | ||
3399 | ReadUnicodeFile(ReplaceBuffer2,ReplaceBuffer); | ||
3400 | for(j=0;j<(int)(UnicodeLength(Buffer[0]));j++) { | ||
3401 | for (z=0;z<(int)(UnicodeLength(ReplaceBuffer2)/2);z++) { | ||
3402 | if (ReplaceBuffer2[z*4] == Buffer[0][j] && | ||
3403 | ReplaceBuffer2[z*4+1] == Buffer[0][j+1]) { | ||
3404 | Buffer[0][j] = ReplaceBuffer2[z*4+2]; | ||
3405 | Buffer[0][j+1] = ReplaceBuffer2[z*4+3]; | ||
3406 | break; | ||
3407 | } | ||
3408 | } | ||
3409 | } | ||
3410 | nextlong = 0; | ||
3411 | break; | ||
3412 | case 10: | ||
3413 | Validity.Format = SMS_Validity_RelativeFormat; | ||
3414 | if (mystrncasecmp(argv[i],"HOUR",0)) Validity.Relative = SMS_VALID_1_Hour; | ||
3415 | else if (mystrncasecmp(argv[i],"6HOURS",0))Validity.Relative = SMS_VALID_6_Hours; | ||
3416 | else if (mystrncasecmp(argv[i],"DAY",0)) Validity.Relative = SMS_VALID_1_Day; | ||
3417 | else if (mystrncasecmp(argv[i],"3DAYS",0)) Validity.Relative = SMS_VALID_3_Days; | ||
3418 | else if (mystrncasecmp(argv[i],"WEEK",0)) Validity.Relative = SMS_VALID_1_Week; | ||
3419 | else if (mystrncasecmp(argv[i],"MAX",0)) Validity.Relative = SMS_VALID_Max_Time; | ||
3420 | else { | ||
3421 | printmsg("Unknown validity string (\"%s\")\n",argv[i]); | ||
3422 | exit(-1); | ||
3423 | } | ||
3424 | nextlong = 0; | ||
3425 | break; | ||
3426 | case 11:/* EMS text from parameter */ | ||
3427 | EncodeUnicode(Buffer[SMSInfo.EntriesNum],argv[i],strlen(argv[i])); | ||
3428 | dbgprintf("buffer is \"%s\"\n",DecodeUnicodeConsole(Buffer[SMSInfo.EntriesNum])); | ||
3429 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_ConcatenatedTextLong; | ||
3430 | SMSInfo.Entries[SMSInfo.EntriesNum].Buffer = Buffer[SMSInfo.EntriesNum]; | ||
3431 | SMSInfo.EntriesNum++; | ||
3432 | nextlong = 0; | ||
3433 | break; | ||
3434 | case 12:/* EMS predefined sound/animation number */ | ||
3435 | SMSInfo.Entries[SMSInfo.EntriesNum].Number = atoi(argv[i]); | ||
3436 | SMSInfo.EntriesNum++; | ||
3437 | nextlong = 0; | ||
3438 | break; | ||
3439 | case 14: /* EMS ringtone - IMelody */ | ||
3440 | ringtone[SMSInfo.EntriesNum].Format=RING_NOTETONE; | ||
3441 | error=GSM_ReadRingtoneFile(argv[i],&ringtone[SMSInfo.EntriesNum]); | ||
3442 | Print_Error(error); | ||
3443 | SMSInfo.Entries[SMSInfo.EntriesNum].Ringtone = &ringtone[SMSInfo.EntriesNum]; | ||
3444 | SMSInfo.EntriesNum++; | ||
3445 | nextlong = 0; | ||
3446 | break; | ||
3447 | case 15:/* EMS bitmap file */ | ||
3448 | bitmap[SMSInfo.EntriesNum].Bitmap[0].Type=GSM_StartupLogo; | ||
3449 | error=GSM_ReadBitmapFile(argv[i],&bitmap[SMSInfo.EntriesNum]); | ||
3450 | Print_Error(error); | ||
3451 | SMSInfo.Entries[SMSInfo.EntriesNum].Bitmap = &bitmap[SMSInfo.EntriesNum]; | ||
3452 | SMSInfo.EntriesNum++; | ||
3453 | nextlong = 0; | ||
3454 | break; | ||
3455 | case 16:/* Number of frames for EMS animation */ | ||
3456 | FramesNum = atoi(argv[i]); | ||
3457 | if (FramesNum < 1 || FramesNum > 4) { | ||
3458 | printmsg("You have to give number of EMS frames between 1 and 4 (\"%s\")\n",argv[i]); | ||
3459 | exit(-1); | ||
3460 | } | ||
3461 | bitmap[SMSInfo.EntriesNum].Number = 0; | ||
3462 | nextlong = 17; | ||
3463 | break; | ||
3464 | case 17:/*File for EMS animation */ | ||
3465 | bitmap2.Bitmap[0].Type=GSM_StartupLogo; | ||
3466 | error=GSM_ReadBitmapFile(argv[i],&bitmap2); | ||
3467 | for (j=0;j<bitmap2.Number;j++) { | ||
3468 | if (bitmap[SMSInfo.EntriesNum].Number == FramesNum) break; | ||
3469 | memcpy(&bitmap[SMSInfo.EntriesNum].Bitmap[bitmap[SMSInfo.EntriesNum].Number],&bitmap2.Bitmap[j],sizeof(GSM_Bitmap)); | ||
3470 | bitmap[SMSInfo.EntriesNum].Number++; | ||
3471 | } | ||
3472 | if (bitmap[SMSInfo.EntriesNum].Number == FramesNum) { | ||
3473 | SMSInfo.Entries[SMSInfo.EntriesNum].Bitmap = &bitmap[SMSInfo.EntriesNum]; | ||
3474 | SMSInfo.EntriesNum++; | ||
3475 | nextlong = 0; | ||
3476 | } | ||
3477 | break; | ||
3478 | case 18:/* EMS text from Unicode file */ | ||
3479 | f = fopen(argv[i],"rb"); | ||
3480 | if (f == NULL) { | ||
3481 | printmsg("Can't open file \"%s\"\n",argv[i]); | ||
3482 | exit(-1); | ||
3483 | } | ||
3484 | z=fread(InputBuffer,1,2000,f); | ||
3485 | InputBuffer[z] = 0; | ||
3486 | InputBuffer[z+1] = 0; | ||
3487 | fclose(f); | ||
3488 | ReadUnicodeFile(Buffer[SMSInfo.EntriesNum],InputBuffer); | ||
3489 | dbgprintf("buffer is \"%s\"\n",DecodeUnicodeConsole(Buffer[SMSInfo.EntriesNum])); | ||
3490 | SMSInfo.Entries[SMSInfo.EntriesNum].ID = SMS_ConcatenatedTextLong; | ||
3491 | SMSInfo.Entries[SMSInfo.EntriesNum].Buffer = Buffer[SMSInfo.EntriesNum]; | ||
3492 | SMSInfo.EntriesNum++; | ||
3493 | nextlong = 0; | ||
3494 | break; | ||
3495 | case 19:/* Number of protected items */ | ||
3496 | Protected = atoi(argv[i]); | ||
3497 | nextlong = 0; | ||
3498 | break; | ||
3499 | case 20:/* Formatting text for EMS */ | ||
3500 | if (SMSInfo.Entries[SMSInfo.EntriesNum-1].ID == SMS_ConcatenatedTextLong) { | ||
3501 | for(j=0;j<(int)strlen(argv[i]);j++) { | ||
3502 | switch(argv[i][j]) { | ||
3503 | case 'l': case 'L': | ||
3504 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Left = true; | ||
3505 | break; | ||
3506 | case 'c': case 'C': | ||
3507 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Center = true; | ||
3508 | break; | ||
3509 | case 'r': case 'R': | ||
3510 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Right = true; | ||
3511 | break; | ||
3512 | case 'a': case 'A': | ||
3513 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Large = true; | ||
3514 | break; | ||
3515 | case 's': case 'S': | ||
3516 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Small = true; | ||
3517 | break; | ||
3518 | case 'b': case 'B': | ||
3519 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Bold = true; | ||
3520 | break; | ||
3521 | case 'i': case 'I': | ||
3522 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Italic = true; | ||
3523 | break; | ||
3524 | case 'u': case 'U': | ||
3525 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Underlined = true; | ||
3526 | break; | ||
3527 | case 't': case 'T': | ||
3528 | SMSInfo.Entries[SMSInfo.EntriesNum-1].Strikethrough = true; | ||
3529 | break; | ||
3530 | default: | ||
3531 | printmsg("Unknown parameter \"%c\"\n",argv[i][j]); | ||
3532 | exit(-1); | ||
3533 | } | ||
3534 | } | ||
3535 | } else { | ||
3536 | printmsg("Last parameter wasn't text\n"); | ||
3537 | exit(-1); | ||
3538 | } | ||
3539 | nextlong = 0; | ||
3540 | break; | ||
3541 | case 21:/*MaxSMS*/ | ||
3542 | MaxSMS = atoi(argv[i]); | ||
3543 | nextlong = 0; | ||
3544 | break; | ||
3545 | case 22:/* profile name */ | ||
3546 | EncodeUnicode(Buffer[0],argv[i],strlen(argv[i])); | ||
3547 | SMSInfo.Entries[0].Buffer = Buffer[0]; | ||
3548 | nextlong = 0; | ||
3549 | break; | ||
3550 | case 23:/* profile ringtone */ | ||
3551 | ringtone[0].Format = RING_NOTETONE; | ||
3552 | error=GSM_ReadRingtoneFile(argv[i],&ringtone[0]); | ||
3553 | Print_Error(error); | ||
3554 | SMSInfo.Entries[0].Ringtone = &ringtone[0]; | ||
3555 | nextlong = 0; | ||
3556 | break; | ||
3557 | case 24:/* profile bitmap */ | ||
3558 | bitmap[0].Bitmap[0].Type = GSM_PictureImage; | ||
3559 | error=GSM_ReadBitmapFile(argv[i],&bitmap[0]); | ||
3560 | Print_Error(error); | ||
3561 | bitmap[0].Bitmap[0].Text[0] = 0; | ||
3562 | bitmap[0].Bitmap[0].Text[1] = 0; | ||
3563 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; | ||
3564 | nextlong = 0; | ||
3565 | break; | ||
3566 | } | ||
3567 | } | ||
3568 | if (nextlong!=0) { | ||
3569 | printmsg("Parameter missed...\n"); | ||
3570 | exit(-1); | ||
3571 | } | ||
3572 | |||
3573 | if (mystrncasecmp(argv[2],"EMS",0) && EMS16Bit) { | ||
3574 | for (i=0;i<SMSInfo.EntriesNum;i++) { | ||
3575 | switch (SMSInfo.Entries[i].ID) { | ||
3576 | case SMS_ConcatenatedTextLong: | ||
3577 | SMSInfo.Entries[i].ID = SMS_ConcatenatedTextLong16bit; | ||
3578 | default: | ||
3579 | break; | ||
3580 | |||
3581 | } | ||
3582 | } | ||
3583 | |||
3584 | } | ||
3585 | if (mystrncasecmp(argv[2],"TEXT",0)) { | ||
3586 | chars_read = UnicodeLength(Buffer[0]); | ||
3587 | if (chars_read != 0) { | ||
3588 | /* Trim \n at the end of string */ | ||
3589 | if (Buffer[0][chars_read*2-1] == '\n' && Buffer[0][chars_read*2-2] == 0) | ||
3590 | { | ||
3591 | Buffer[0][chars_read*2-1] = 0; | ||
3592 | } | ||
3593 | } | ||
3594 | } | ||
3595 | |||
3596 | if (mystrncasecmp(argv[1],"--displaysms",0) || mystrncasecmp(argv[1],"--sendsmsdsms",0)) { | ||
3597 | if (mystrncasecmp(argv[2],"OPERATOR",0)) { | ||
3598 | if (bitmap[0].Bitmap[0].Type==GSM_OperatorLogo && strcmp(bitmap[0].Bitmap[0].NetworkCode,"000 00")==0) { | ||
3599 | printmsg("No network code\n"); | ||
3600 | exit(-1); | ||
3601 | } | ||
3602 | } | ||
3603 | } else { | ||
3604 | GSM_Init(true); | ||
3605 | |||
3606 | if (mystrncasecmp(argv[2],"OPERATOR",0)) { | ||
3607 | if (bitmap[0].Bitmap[0].Type==GSM_OperatorLogo && strcmp(bitmap[0].Bitmap[0].NetworkCode,"000 00")==0) { | ||
3608 | error=Phone->GetNetworkInfo(&s,&NetInfo); | ||
3609 | Print_Error(error); | ||
3610 | strcpy(bitmap[0].Bitmap[0].NetworkCode,NetInfo.NetworkCode); | ||
3611 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
3612 | EncodeUnicode(Sender, "OpLogo",6); | ||
3613 | EncodeUnicode(Sender+6*2,bitmap[0].Bitmap[0].NetworkCode,3); | ||
3614 | EncodeUnicode(Sender+6*2+3*2,bitmap[0].Bitmap[0].NetworkCode+4,2); | ||
3615 | if (UnicodeLength(GSM_GetNetworkName(bitmap[0].Bitmap[0].NetworkCode))<GSM_MAX_SMS_NAME_LENGTH-7) { | ||
3616 | EncodeUnicode(Name,"OpLogo ",7); | ||
3617 | CopyUnicodeString(Name+7*2,GSM_GetNetworkName(bitmap[0].Bitmap[0].NetworkCode)); | ||
3618 | } else { | ||
3619 | CopyUnicodeString(Name,Sender); | ||
3620 | } | ||
3621 | } | ||
3622 | } | ||
3623 | } | ||
3624 | } | ||
3625 | |||
3626 | error=GSM_EncodeMultiPartSMS(&SMSInfo,&sms); | ||
3627 | Print_Error(error); | ||
3628 | |||
3629 | for (i=0;i<SMSInfo.EntriesNum;i++) { | ||
3630 | switch (SMSInfo.Entries[i].ID) { | ||
3631 | case SMS_NokiaRingtone: | ||
3632 | case SMS_NokiaRingtoneLong: | ||
3633 | case SMS_NokiaProfileLong: | ||
3634 | case SMS_EMSSound10: | ||
3635 | case SMS_EMSSound12: | ||
3636 | case SMS_EMSSonyEricssonSound: | ||
3637 | case SMS_EMSSound10Long: | ||
3638 | case SMS_EMSSound12Long: | ||
3639 | case SMS_EMSSonyEricssonSoundLong: | ||
3640 | if (SMSInfo.Entries[i].RingtoneNotes!=SMSInfo.Entries[i].Ringtone->NoteTone.NrCommands) { | ||
3641 | printmsg("Warning: ringtone too long. %i percent part cut\n", | ||
3642 | (SMSInfo.Entries[i].Ringtone->NoteTone.NrCommands-SMSInfo.Entries[i].RingtoneNotes)*100/SMSInfo.Entries[i].Ringtone->NoteTone.NrCommands); | ||
3643 | } | ||
3644 | default: | ||
3645 | break; | ||
3646 | |||
3647 | } | ||
3648 | } | ||
3649 | if (MaxSMS != -1 && sms.Number > MaxSMS) { | ||
3650 | printmsg("There is %i SMS packed and %i limit. Exiting\n",sms.Number,MaxSMS); | ||
3651 | if (!mystrncasecmp(argv[1],"--displaysms",0) && !mystrncasecmp(argv[1],"--sendsmsdsms",0)) GSM_Terminate(); | ||
3652 | exit(-1); | ||
3653 | } | ||
3654 | |||
3655 | if (mystrncasecmp(argv[1],"--displaysms",0)) { | ||
3656 | if (SMSCSet != 0) { | ||
3657 | printmsg("Use -smscnumber option to give SMSC number\n"); | ||
3658 | exit(-1); | ||
3659 | } | ||
3660 | |||
3661 | for (i=0;i<sms.Number;i++) { | ||
3662 | sms.SMS[i].Location = 0; | ||
3663 | sms.SMS[i].ReplyViaSameSMSC = ReplyViaSameSMSC; | ||
3664 | sms.SMS[i].SMSC.Location = 0; | ||
3665 | sms.SMS[i].PDU = SMS_Submit; | ||
3666 | if (DeliveryReport) sms.SMS[i].PDU= SMS_Status_Report; | ||
3667 | CopyUnicodeString(sms.SMS[i].Number, Sender); | ||
3668 | CopyUnicodeString(sms.SMS[i].SMSC.Number, SMSC); | ||
3669 | if (Validity.Format != 0) memcpy(&sms.SMS[i].SMSC.Validity,&Validity,sizeof(GSM_SMSValidity)); | ||
3670 | DisplaySMSFrame(&sms.SMS[i]); | ||
3671 | } | ||
3672 | |||
3673 | printmsg("\nNumber of SMS: %i\n",sms.Number); | ||
3674 | exit(sms.Number); | ||
3675 | } | ||
3676 | if (mystrncasecmp(argv[1],"--sendsmsdsms",0)) { | ||
3677 | if (SMSCSet != 0) { | ||
3678 | printmsg("Use -smscnumber option to give SMSC number\n"); | ||
3679 | exit(-1); | ||
3680 | } | ||
3681 | |||
3682 | for (i=0;i<sms.Number;i++) { | ||
3683 | sms.SMS[i].Location = 0; | ||
3684 | sms.SMS[i].ReplyViaSameSMSC = ReplyViaSameSMSC; | ||
3685 | sms.SMS[i].SMSC.Location = 0; | ||
3686 | sms.SMS[i].PDU = SMS_Submit; | ||
3687 | if (DeliveryReport) sms.SMS[i].PDU= SMS_Status_Report; | ||
3688 | CopyUnicodeString(sms.SMS[i].Number, Sender); | ||
3689 | CopyUnicodeString(sms.SMS[i].SMSC.Number, SMSC); | ||
3690 | if (Validity.Format != 0) memcpy(&sms.SMS[i].SMSC.Validity,&Validity,sizeof(GSM_SMSValidity)); | ||
3691 | } | ||
3692 | SMSDaemonSendSMS(argv[4],argv[5],&sms); | ||
3693 | exit(0); | ||
3694 | } | ||
3695 | if (mystrncasecmp(argv[1],"--savesms",0) || SendSaved) { | ||
3696 | error=Phone->GetSMSFolders(&s, &folders); | ||
3697 | Print_Error(error); | ||
3698 | |||
3699 | if (SendSaved){ | ||
3700 | if (Validity.Format != 0 && SMSCSet != 0) { | ||
3701 | PhoneSMSC.Location = SMSCSet; | ||
3702 | error=Phone->GetSMSC(&s,&PhoneSMSC); | ||
3703 | Print_Error(error); | ||
3704 | CopyUnicodeString(SMSC,PhoneSMSC.Number); | ||
3705 | SMSCSet = 0; | ||
3706 | } | ||
3707 | |||
3708 | s.User.SendSMSStatus = SendSMSStatus; | ||
3709 | |||
3710 | signal(SIGINT, interrupt); | ||
3711 | printmsgerr("If you want break, press Ctrl+C...\n"); | ||
3712 | } | ||
3713 | |||
3714 | for (i=0;i<sms.Number;i++) { | ||
3715 | printmsg("Saving SMS %i/%i\n",i+1,sms.Number); | ||
3716 | // sms.SMS[i].Location = 0; | ||
3717 | sms.SMS[i].Folder = Folder; | ||
3718 | sms.SMS[i].State = State; | ||
3719 | sms.SMS[i].ReplyViaSameSMSC= ReplyViaSameSMSC; | ||
3720 | sms.SMS[i].SMSC.Location= SMSCSet; | ||
3721 | |||
3722 | if (SendSaved){ | ||
3723 | sms.SMS[i].PDU= SMS_Submit; | ||
3724 | if (DeliveryReport) sms.SMS[i].PDU = SMS_Status_Report; | ||
3725 | if (Validity.Format != 0) sms.SMS[i].SMSC.Validity = Validity; | ||
3726 | } else { | ||
3727 | sms.SMS[i].PDU= SMS_Deliver; | ||
3728 | } | ||
3729 | |||
3730 | CopyUnicodeString(sms.SMS[i].Number, Sender); | ||
3731 | CopyUnicodeString(sms.SMS[i].Name, Name); | ||
3732 | if (SMSCSet==0) CopyUnicodeString(sms.SMS[i].SMSC.Number, SMSC); | ||
3733 | error=Phone->AddSMS(&s, &sms.SMS[i]); | ||
3734 | Print_Error(error); | ||
3735 | printmsg("Saved in folder \"%s\", location %i\n", | ||
3736 | DecodeUnicodeConsole(folders.Folder[sms.SMS[i].Folder-1].Name),sms.SMS[i].Location); | ||
3737 | |||
3738 | if (SendSaved) { | ||
3739 | printmsg("Sending sms from folder \"%s\", location %i\n", | ||
3740 | DecodeUnicodeString(folders.Folder[sms.SMS[i].Folder-1].Name),sms.SMS[i].Location); | ||
3741 | SMSStatus = ERR_TIMEOUT; | ||
3742 | error=Phone->SendSavedSMS(&s, 0, sms.SMS[i].Location); | ||
3743 | Print_Error(error); | ||
3744 | printmsg("....waiting for network answer"); | ||
3745 | while (!gshutdown) { | ||
3746 | GSM_ReadDevice(&s,true); | ||
3747 | if (SMSStatus == ERR_UNKNOWN) { | ||
3748 | GSM_Terminate(); | ||
3749 | exit(-1); | ||
3750 | } | ||
3751 | if (SMSStatus == ERR_NONE) break; | ||
3752 | } | ||
3753 | } | ||
3754 | } | ||
3755 | } else { | ||
3756 | if (Validity.Format != 0 && SMSCSet != 0) { | ||
3757 | PhoneSMSC.Location = SMSCSet; | ||
3758 | error=Phone->GetSMSC(&s,&PhoneSMSC); | ||
3759 | Print_Error(error); | ||
3760 | CopyUnicodeString(SMSC,PhoneSMSC.Number); | ||
3761 | SMSCSet = 0; | ||
3762 | } | ||
3763 | |||
3764 | signal(SIGINT, interrupt); | ||
3765 | printmsgerr("If you want break, press Ctrl+C...\n"); | ||
3766 | |||
3767 | s.User.SendSMSStatus = SendSMSStatus; | ||
3768 | |||
3769 | for (i=0;i<sms.Number;i++) { | ||
3770 | printmsg("Sending SMS %i/%i",i+1,sms.Number); | ||
3771 | sms.SMS[i].Location = 0; | ||
3772 | sms.SMS[i].ReplyViaSameSMSC = ReplyViaSameSMSC; | ||
3773 | sms.SMS[i].SMSC.Location = SMSCSet; | ||
3774 | sms.SMS[i].PDU = SMS_Submit; | ||
3775 | if (DeliveryReport) sms.SMS[i].PDU= SMS_Status_Report; | ||
3776 | CopyUnicodeString(sms.SMS[i].Number, Sender); | ||
3777 | if (SMSCSet==0) CopyUnicodeString(sms.SMS[i].SMSC.Number, SMSC); | ||
3778 | if (Validity.Format != 0) memcpy(&sms.SMS[i].SMSC.Validity,&Validity,sizeof(GSM_SMSValidity)); | ||
3779 | SMSStatus = ERR_TIMEOUT; | ||
3780 | error=Phone->SendSMS(&s, &sms.SMS[i]); | ||
3781 | Print_Error(error); | ||
3782 | printmsg("....waiting for network answer"); | ||
3783 | while (!gshutdown) { | ||
3784 | GSM_ReadDevice(&s,true); | ||
3785 | if (SMSStatus == ERR_UNKNOWN) { | ||
3786 | GSM_Terminate(); | ||
3787 | exit(-1); | ||
3788 | } | ||
3789 | if (SMSStatus == ERR_NONE) break; | ||
3790 | } | ||
3791 | } | ||
3792 | } | ||
3793 | |||
3794 | GSM_Terminate(); | ||
3795 | } | ||
3796 | |||
3797 | #ifdef GSM_ENABLE_BACKUP | ||
3798 | static void SaveFile(int argc, char *argv[]) | ||
3799 | { | ||
3800 | GSM_Backup Backup; | ||
3801 | int i,j; | ||
3802 | FILE *file; | ||
3803 | unsigned char Buffer[10000]; | ||
3804 | GSM_MemoryEntry *pbk; | ||
3805 | |||
3806 | if (mystrncasecmp(argv[2],"CALENDAR",0)) { | ||
3807 | if (argc<5) { | ||
3808 | printmsg("Where is backup filename and location ?\n"); | ||
3809 | exit(-1); | ||
3810 | } | ||
3811 | error=GSM_ReadBackupFile(argv[4],&Backup); | ||
3812 | Print_Error(error); | ||
3813 | i = 0; | ||
3814 | while (Backup.Calendar[i]!=NULL) { | ||
3815 | if (i == atoi(argv[5])-1) break; | ||
3816 | i++; | ||
3817 | } | ||
3818 | if (i != atoi(argv[5])-1) { | ||
3819 | printmsg("Calendar note not found in file\n"); | ||
3820 | exit(-1); | ||
3821 | } | ||
3822 | j = 0; | ||
3823 | GSM_EncodeVCALENDAR(Buffer, &j, Backup.Calendar[i],true,Nokia_VCalendar); | ||
3824 | } else if (mystrncasecmp(argv[2],"BOOKMARK",0)) { | ||
3825 | if (argc<5) { | ||
3826 | printmsg("Where is backup filename and location ?\n"); | ||
3827 | exit(-1); | ||
3828 | } | ||
3829 | error=GSM_ReadBackupFile(argv[4],&Backup); | ||
3830 | Print_Error(error); | ||
3831 | i = 0; | ||
3832 | while (Backup.WAPBookmark[i]!=NULL) { | ||
3833 | if (i == atoi(argv[5])-1) break; | ||
3834 | i++; | ||
3835 | } | ||
3836 | if (i != atoi(argv[5])-1) { | ||
3837 | printmsg("WAP bookmark not found in file\n"); | ||
3838 | exit(-1); | ||
3839 | } | ||
3840 | j = 0; | ||
3841 | GSM_EncodeURLFile(Buffer, &j, Backup.WAPBookmark[i]); | ||
3842 | } else if (mystrncasecmp(argv[2],"NOTE",0)) { | ||
3843 | if (argc<5) { | ||
3844 | printmsg("Where is backup filename and location ?\n"); | ||
3845 | exit(-1); | ||
3846 | } | ||
3847 | error=GSM_ReadBackupFile(argv[4],&Backup); | ||
3848 | Print_Error(error); | ||
3849 | i = 0; | ||
3850 | while (Backup.Note[i]!=NULL) { | ||
3851 | if (i == atoi(argv[5])-1) break; | ||
3852 | i++; | ||
3853 | } | ||
3854 | if (i != atoi(argv[5])-1) { | ||
3855 | printmsg("Note not found in file\n"); | ||
3856 | exit(-1); | ||
3857 | } | ||
3858 | j = 0; | ||
3859 | GSM_EncodeVNTFile(Buffer, &j, Backup.Note[i]); | ||
3860 | } else if (mystrncasecmp(argv[2],"TODO",0)) { | ||
3861 | if (argc<5) { | ||
3862 | printmsg("Where is backup filename and location ?\n"); | ||
3863 | exit(-1); | ||
3864 | } | ||
3865 | error=GSM_ReadBackupFile(argv[4],&Backup); | ||
3866 | Print_Error(error); | ||
3867 | i = 0; | ||
3868 | while (Backup.ToDo[i]!=NULL) { | ||
3869 | if (i == atoi(argv[5])-1) break; | ||
3870 | i++; | ||
3871 | } | ||
3872 | if (i != atoi(argv[5])-1) { | ||
3873 | printmsg("ToDo note not found in file\n"); | ||
3874 | exit(-1); | ||
3875 | } | ||
3876 | j = 0; | ||
3877 | GSM_EncodeVTODO(Buffer, &j, Backup.ToDo[i], true, Nokia_VToDo); | ||
3878 | } else if (mystrncasecmp(argv[2],"VCARD10",0) || mystrncasecmp(argv[2],"VCARD21",0)) { | ||
3879 | if (argc<6) { | ||
3880 | printmsg("Where is backup filename and location and memory type ?\n"); | ||
3881 | exit(-1); | ||
3882 | } | ||
3883 | error=GSM_ReadBackupFile(argv[4],&Backup); | ||
3884 | Print_Error(error); | ||
3885 | i = 0; | ||
3886 | if (mystrncasecmp(argv[5],"SM",0)) { | ||
3887 | while (Backup.SIMPhonebook[i]!=NULL) { | ||
3888 | if (i == atoi(argv[6])-1) break; | ||
3889 | i++; | ||
3890 | } | ||
3891 | if (i != atoi(argv[6])-1) { | ||
3892 | printmsg("Phonebook entry not found in file\n"); | ||
3893 | exit(-1); | ||
3894 | } | ||
3895 | pbk = Backup.SIMPhonebook[i]; | ||
3896 | } else if (mystrncasecmp(argv[5],"ME",0)) { | ||
3897 | while (Backup.PhonePhonebook[i]!=NULL) { | ||
3898 | if (i == atoi(argv[6])-1) break; | ||
3899 | i++; | ||
3900 | } | ||
3901 | if (i != atoi(argv[6])-1) { | ||
3902 | printmsg("Phonebook entry not found in file\n"); | ||
3903 | exit(-1); | ||
3904 | } | ||
3905 | pbk = Backup.PhonePhonebook[i]; | ||
3906 | } else { | ||
3907 | printmsg("Unknown memory type: \"%s\"\n",argv[5]); | ||
3908 | exit(-1); | ||
3909 | } | ||
3910 | j = 0; | ||
3911 | if (mystrncasecmp(argv[2],"VCARD10",0)) { | ||
3912 | GSM_EncodeVCARD(Buffer,&j,pbk,true,Nokia_VCard10); | ||
3913 | } else { | ||
3914 | GSM_EncodeVCARD(Buffer,&j,pbk,true,Nokia_VCard21); | ||
3915 | } | ||
3916 | } else { | ||
3917 | printmsg("What format of file (\"%s\") ?\n",argv[2]); | ||
3918 | exit(-1); | ||
3919 | } | ||
3920 | |||
3921 | file = fopen(argv[3],"wb"); | ||
3922 | fwrite(Buffer,1,j,file); | ||
3923 | fclose(file); | ||
3924 | } | ||
3925 | |||
3926 | static void Backup(int argc, char *argv[]) | ||
3927 | { | ||
3928 | int i, used; | ||
3929 | GSM_MemoryStatusMemStatus; | ||
3930 | GSM_ToDoEntry ToDo; | ||
3931 | GSM_ToDoStatus ToDoStatus; | ||
3932 | GSM_MemoryEntry Pbk; | ||
3933 | GSM_CalendarEntryNote; | ||
3934 | GSM_Bitmap Bitmap; | ||
3935 | GSM_WAPBookmark Bookmark; | ||
3936 | GSM_Profile Profile; | ||
3937 | GSM_MultiWAPSettingsSettings; | ||
3938 | GSM_Ringtone Ringtone; | ||
3939 | GSM_SMSC SMSC; | ||
3940 | GSM_Backup Backup; | ||
3941 | GSM_Backup_Info Info; | ||
3942 | GSM_FMStation FMStation; | ||
3943 | GSM_GPRSAccessPointGPRSPoint; | ||
3944 | bool DoBackup; | ||
3945 | |||
3946 | if (argc == 4 && mystrncasecmp(argv[3],"-yes",0)) always_answer_yes = true; | ||
3947 | |||
3948 | GSM_ClearBackup(&Backup); | ||
3949 | GSM_GetBackupFormatFeatures(argv[2],&Info); | ||
3950 | |||
3951 | sprintf(Backup.Creator,"Gammu %s",VERSION); | ||
3952 | if (strlen(GetOS()) != 0) { | ||
3953 | strcat(Backup.Creator+strlen(Backup.Creator),", "); | ||
3954 | strcat(Backup.Creator+strlen(Backup.Creator),GetOS()); | ||
3955 | } | ||
3956 | if (strlen(GetCompiler()) != 0) { | ||
3957 | strcat(Backup.Creator+strlen(Backup.Creator),", "); | ||
3958 | strcat(Backup.Creator+strlen(Backup.Creator),GetCompiler()); | ||
3959 | } | ||
3960 | |||
3961 | signal(SIGINT, interrupt); | ||
3962 | printmsgerr("Press Ctrl+C to break...\n"); | ||
3963 | |||
3964 | GSM_Init(true); | ||
3965 | |||
3966 | if (Info.UseUnicode) { | ||
3967 | Info.UseUnicode=answer_yes("Use Unicode subformat of backup file"); | ||
3968 | } | ||
3969 | if (Info.DateTime) { | ||
3970 | GSM_GetCurrentDateTime (&Backup.DateTime); | ||
3971 | Backup.DateTimeAvailable=true; | ||
3972 | } | ||
3973 | if (Info.Model) { | ||
3974 | error=Phone->GetManufacturer(&s); | ||
3975 | Print_Error(error); | ||
3976 | sprintf(Backup.Model,"%s ",s.Phone.Data.Manufacturer); | ||
3977 | if (s.Phone.Data.ModelInfo->model[0]!=0) { | ||
3978 | strcat(Backup.Model,s.Phone.Data.ModelInfo->model); | ||
3979 | } else { | ||
3980 | strcat(Backup.Model,s.Phone.Data.Model); | ||
3981 | } | ||
3982 | strcat(Backup.Model," "); | ||
3983 | strcat(Backup.Model,s.Phone.Data.Version); | ||
3984 | } | ||
3985 | if (Info.IMEI) { | ||
3986 | error=Phone->GetIMEI(&s); | ||
3987 | if (error != ERR_NOTSUPPORTED) { | ||
3988 | strcpy(Backup.IMEI, s.Phone.Data.IMEI); | ||
3989 | Print_Error(error); | ||
3990 | } else { | ||
3991 | Backup.IMEI[0] = 0; | ||
3992 | } | ||
3993 | } | ||
3994 | printf("\n"); | ||
3995 | |||
3996 | DoBackup = false; | ||
3997 | if (Info.PhonePhonebook) { | ||
3998 | printmsg("Checking phone phonebook\n"); | ||
3999 | MemStatus.MemoryType = MEM_ME; | ||
4000 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
4001 | if (error==ERR_NONE && MemStatus.MemoryUsed != 0) { | ||
4002 | if (answer_yes(" Backup phone phonebook")) DoBackup = true; | ||
4003 | } | ||
4004 | } | ||
4005 | if (DoBackup) { | ||
4006 | Pbk.MemoryType = MEM_ME; | ||
4007 | i = 1; | ||
4008 | used = 0; | ||
4009 | while (used != MemStatus.MemoryUsed) { | ||
4010 | Pbk.Location = i; | ||
4011 | error=Phone->GetMemory(&s, &Pbk); | ||
4012 | if (error != ERR_EMPTY) { | ||
4013 | Print_Error(error); | ||
4014 | if (used < GSM_BACKUP_MAX_PHONEPHONEBOOK) { | ||
4015 | Backup.PhonePhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); | ||
4016 | if (Backup.PhonePhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4017 | Backup.PhonePhonebook[used+1] = NULL; | ||
4018 | } else { | ||
4019 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_PHONEPHONEBOOK"); | ||
4020 | GSM_Terminate(); | ||
4021 | exit(-1); | ||
4022 | } | ||
4023 | *Backup.PhonePhonebook[used]=Pbk; | ||
4024 | used++; | ||
4025 | } | ||
4026 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); | ||
4027 | i++; | ||
4028 | if (gshutdown) { | ||
4029 | GSM_Terminate(); | ||
4030 | exit(0); | ||
4031 | } | ||
4032 | } | ||
4033 | printmsgerr("\n"); | ||
4034 | } | ||
4035 | DoBackup = false; | ||
4036 | if (Info.SIMPhonebook) { | ||
4037 | printmsg("Checking SIM phonebook\n"); | ||
4038 | MemStatus.MemoryType = MEM_SM; | ||
4039 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
4040 | if (error==ERR_NONE && MemStatus.MemoryUsed != 0) { | ||
4041 | if (answer_yes(" Backup SIM phonebook")) DoBackup=true; | ||
4042 | } | ||
4043 | } | ||
4044 | if (DoBackup) { | ||
4045 | Pbk.MemoryType = MEM_SM; | ||
4046 | i = 1; | ||
4047 | used = 0; | ||
4048 | while (used != MemStatus.MemoryUsed) { | ||
4049 | Pbk.Location = i; | ||
4050 | error=Phone->GetMemory(&s, &Pbk); | ||
4051 | if (error != ERR_EMPTY) { | ||
4052 | Print_Error(error); | ||
4053 | if (used < GSM_BACKUP_MAX_SIMPHONEBOOK) { | ||
4054 | Backup.SIMPhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); | ||
4055 | if (Backup.SIMPhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4056 | Backup.SIMPhonebook[used + 1] = NULL; | ||
4057 | } else { | ||
4058 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SIMPHONEBOOK"); | ||
4059 | GSM_Terminate(); | ||
4060 | exit(-1); | ||
4061 | } | ||
4062 | *Backup.SIMPhonebook[used]=Pbk; | ||
4063 | used++; | ||
4064 | } | ||
4065 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); | ||
4066 | i++; | ||
4067 | if (gshutdown) { | ||
4068 | GSM_Terminate(); | ||
4069 | exit(0); | ||
4070 | } | ||
4071 | } | ||
4072 | printmsgerr("\n"); | ||
4073 | } | ||
4074 | DoBackup = false; | ||
4075 | if (Info.Calendar) { | ||
4076 | printmsg("Checking calendar\n"); | ||
4077 | error=Phone->GetNextCalendar(&s,&Note,true); | ||
4078 | if (error==ERR_NONE) { | ||
4079 | if (answer_yes(" Backup calendar notes")) DoBackup = true; | ||
4080 | } | ||
4081 | } | ||
4082 | if (DoBackup) { | ||
4083 | used = 0; | ||
4084 | printmsgerr(" Reading : "); | ||
4085 | while (error == ERR_NONE) { | ||
4086 | if (used < GSM_MAXCALENDARTODONOTES) { | ||
4087 | Backup.Calendar[used] = malloc(sizeof(GSM_CalendarEntry)); | ||
4088 | if (Backup.Calendar[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4089 | Backup.Calendar[used+1] = NULL; | ||
4090 | } else { | ||
4091 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); | ||
4092 | GSM_Terminate(); | ||
4093 | exit(-1); | ||
4094 | } | ||
4095 | *Backup.Calendar[used]=Note; | ||
4096 | used ++; | ||
4097 | error=Phone->GetNextCalendar(&s,&Note,false); | ||
4098 | printmsgerr("*"); | ||
4099 | if (gshutdown) { | ||
4100 | GSM_Terminate(); | ||
4101 | exit(0); | ||
4102 | } | ||
4103 | } | ||
4104 | printmsgerr("\n"); | ||
4105 | } | ||
4106 | DoBackup = false; | ||
4107 | if (Info.ToDo) { | ||
4108 | printmsg("Checking ToDo\n"); | ||
4109 | error=Phone->GetToDoStatus(&s,&ToDoStatus); | ||
4110 | if (error == ERR_NONE && ToDoStatus.Used != 0) { | ||
4111 | if (answer_yes(" Backup ToDo")) DoBackup = true; | ||
4112 | } | ||
4113 | } | ||
4114 | if (DoBackup) { | ||
4115 | used = 0; | ||
4116 | error=Phone->GetNextToDo(&s,&ToDo,true); | ||
4117 | while (error == ERR_NONE) { | ||
4118 | if (used < GSM_MAXCALENDARTODONOTES) { | ||
4119 | Backup.ToDo[used] = malloc(sizeof(GSM_ToDoEntry)); | ||
4120 | if (Backup.ToDo[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4121 | Backup.ToDo[used+1] = NULL; | ||
4122 | } else { | ||
4123 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); | ||
4124 | GSM_Terminate(); | ||
4125 | exit(-1); | ||
4126 | } | ||
4127 | *Backup.ToDo[used]=ToDo; | ||
4128 | used ++; | ||
4129 | error=Phone->GetNextToDo(&s,&ToDo,false); | ||
4130 | printmsgerr("%c Reading: %i percent",13,used*100/ToDoStatus.Used); | ||
4131 | if (gshutdown) { | ||
4132 | GSM_Terminate(); | ||
4133 | exit(0); | ||
4134 | } | ||
4135 | } | ||
4136 | printmsgerr("\n"); | ||
4137 | } | ||
4138 | DoBackup = false; | ||
4139 | if (Info.CallerLogos) { | ||
4140 | printmsg("Checking caller logos\n"); | ||
4141 | Bitmap.Type = GSM_CallerGroupLogo; | ||
4142 | Bitmap.Location = 1; | ||
4143 | error=Phone->GetBitmap(&s,&Bitmap); | ||
4144 | if (error == ERR_NONE) { | ||
4145 | if (answer_yes(" Backup caller groups and logos")) DoBackup = true; | ||
4146 | } | ||
4147 | } | ||
4148 | if (DoBackup) { | ||
4149 | printmsgerr(" Reading : "); | ||
4150 | error = ERR_NONE; | ||
4151 | used = 0; | ||
4152 | while (error == ERR_NONE) { | ||
4153 | if (used < GSM_BACKUP_MAX_CALLER) { | ||
4154 | Backup.CallerLogos[used] = malloc(sizeof(GSM_Bitmap)); | ||
4155 | if (Backup.CallerLogos[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4156 | Backup.CallerLogos[used+1] = NULL; | ||
4157 | } else { | ||
4158 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CALLER"); | ||
4159 | GSM_Terminate(); | ||
4160 | exit(-1); | ||
4161 | } | ||
4162 | *Backup.CallerLogos[used] = Bitmap; | ||
4163 | used ++; | ||
4164 | Bitmap.Location = used + 1; | ||
4165 | error=Phone->GetBitmap(&s,&Bitmap); | ||
4166 | printmsgerr("*"); | ||
4167 | if (gshutdown) { | ||
4168 | GSM_Terminate(); | ||
4169 | exit(0); | ||
4170 | } | ||
4171 | } | ||
4172 | printmsgerr("\n"); | ||
4173 | } | ||
4174 | DoBackup = false; | ||
4175 | if (Info.SMSC) { | ||
4176 | printmsg("Checking SMS profiles\n"); | ||
4177 | if (answer_yes(" Backup SMS profiles")) DoBackup = true; | ||
4178 | } | ||
4179 | if (DoBackup) { | ||
4180 | used = 0; | ||
4181 | printmsgerr(" Reading: "); | ||
4182 | while (true) { | ||
4183 | SMSC.Location = used + 1; | ||
4184 | error = Phone->GetSMSC(&s,&SMSC); | ||
4185 | if (error != ERR_NONE) break; | ||
4186 | if (used < GSM_BACKUP_MAX_SMSC) { | ||
4187 | Backup.SMSC[used] = malloc(sizeof(GSM_SMSC)); | ||
4188 | if (Backup.SMSC[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4189 | Backup.SMSC[used + 1] = NULL; | ||
4190 | } else { | ||
4191 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMSC"); | ||
4192 | GSM_Terminate(); | ||
4193 | exit(-1); | ||
4194 | } | ||
4195 | *Backup.SMSC[used]=SMSC; | ||
4196 | used++; | ||
4197 | printmsgerr("*"); | ||
4198 | } | ||
4199 | printmsgerr("\n"); | ||
4200 | } | ||
4201 | DoBackup = false; | ||
4202 | if (Info.StartupLogo) { | ||
4203 | printmsg("Checking startup text\n"); | ||
4204 | Bitmap.Type = GSM_WelcomeNote_Text; | ||
4205 | error = Phone->GetBitmap(&s,&Bitmap); | ||
4206 | if (error == ERR_NONE) { | ||
4207 | if (answer_yes(" Backup startup logo/text")) DoBackup = true; | ||
4208 | } | ||
4209 | } | ||
4210 | if (DoBackup) { | ||
4211 | Backup.StartupLogo = malloc(sizeof(GSM_Bitmap)); | ||
4212 | if (Backup.StartupLogo == NULL) Print_Error(ERR_MOREMEMORY); | ||
4213 | *Backup.StartupLogo = Bitmap; | ||
4214 | if (Bitmap.Text[0]==0 && Bitmap.Text[1]==0) { | ||
4215 | Bitmap.Type = GSM_StartupLogo; | ||
4216 | error = Phone->GetBitmap(&s,&Bitmap); | ||
4217 | if (error == ERR_NONE) *Backup.StartupLogo = Bitmap; | ||
4218 | } | ||
4219 | } | ||
4220 | DoBackup = false; | ||
4221 | if (Info.OperatorLogo) { | ||
4222 | printmsg("Checking operator logo\n"); | ||
4223 | Bitmap.Type = GSM_OperatorLogo; | ||
4224 | error=Phone->GetBitmap(&s,&Bitmap); | ||
4225 | if (error == ERR_NONE) { | ||
4226 | if (strcmp(Bitmap.NetworkCode,"000 00")!=0) { | ||
4227 | if (answer_yes(" Backup operator logo")) DoBackup = true; | ||
4228 | } | ||
4229 | } | ||
4230 | } | ||
4231 | if (DoBackup) { | ||
4232 | Backup.OperatorLogo = malloc(sizeof(GSM_Bitmap)); | ||
4233 | if (Backup.OperatorLogo == NULL) Print_Error(ERR_MOREMEMORY); | ||
4234 | *Backup.OperatorLogo = Bitmap; | ||
4235 | } | ||
4236 | DoBackup = false; | ||
4237 | if (Info.MMSSettings) { | ||
4238 | printmsg("Checking MMS settings\n"); | ||
4239 | Settings.Location = 1; | ||
4240 | error=Phone->GetMMSSettings(&s,&Settings); | ||
4241 | if (error==ERR_NONE) { | ||
4242 | if (answer_yes(" Backup MMS settings")) DoBackup = true; | ||
4243 | } | ||
4244 | } | ||
4245 | if (DoBackup) { | ||
4246 | used = 0; | ||
4247 | printmsgerr(" Reading : "); | ||
4248 | while (error == ERR_NONE) { | ||
4249 | if (used < GSM_BACKUP_MAX_MMSSETTINGS) { | ||
4250 | Backup.MMSSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | ||
4251 | if (Backup.MMSSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4252 | Backup.MMSSettings[used+1] = NULL; | ||
4253 | } else { | ||
4254 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_MMSSETTINGS"); | ||
4255 | GSM_Terminate(); | ||
4256 | exit(-1); | ||
4257 | } | ||
4258 | *Backup.MMSSettings[used]=Settings; | ||
4259 | used ++; | ||
4260 | Settings.Location = used+1; | ||
4261 | error=Phone->GetMMSSettings(&s,&Settings); | ||
4262 | printmsgerr("*"); | ||
4263 | if (gshutdown) { | ||
4264 | GSM_Terminate(); | ||
4265 | exit(0); | ||
4266 | } | ||
4267 | } | ||
4268 | printmsgerr("\n"); | ||
4269 | } | ||
4270 | DoBackup = false; | ||
4271 | if (Info.WAPBookmark) { | ||
4272 | printmsg("Checking WAP bookmarks\n"); | ||
4273 | Bookmark.Location = 1; | ||
4274 | error=Phone->GetWAPBookmark(&s,&Bookmark); | ||
4275 | if (error==ERR_NONE) { | ||
4276 | if (answer_yes(" Backup WAP bookmarks")) DoBackup = true; | ||
4277 | } | ||
4278 | } | ||
4279 | if (DoBackup) { | ||
4280 | used = 0; | ||
4281 | printmsgerr(" Reading : "); | ||
4282 | while (error == ERR_NONE) { | ||
4283 | if (used < GSM_BACKUP_MAX_WAPBOOKMARK) { | ||
4284 | Backup.WAPBookmark[used] = malloc(sizeof(GSM_WAPBookmark)); | ||
4285 | if (Backup.WAPBookmark[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4286 | Backup.WAPBookmark[used+1] = NULL; | ||
4287 | } else { | ||
4288 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPBOOKMARK"); | ||
4289 | GSM_Terminate(); | ||
4290 | exit(-1); | ||
4291 | } | ||
4292 | *Backup.WAPBookmark[used]=Bookmark; | ||
4293 | used ++; | ||
4294 | Bookmark.Location = used+1; | ||
4295 | error=Phone->GetWAPBookmark(&s,&Bookmark); | ||
4296 | printmsgerr("*"); | ||
4297 | if (gshutdown) { | ||
4298 | GSM_Terminate(); | ||
4299 | exit(0); | ||
4300 | } | ||
4301 | } | ||
4302 | printmsgerr("\n"); | ||
4303 | } | ||
4304 | DoBackup = false; | ||
4305 | if (Info.WAPSettings) { | ||
4306 | printmsg("Checking WAP settings\n"); | ||
4307 | Settings.Location = 1; | ||
4308 | error=Phone->GetWAPSettings(&s,&Settings); | ||
4309 | if (error==ERR_NONE) { | ||
4310 | if (answer_yes(" Backup WAP settings")) DoBackup = true; | ||
4311 | } | ||
4312 | } | ||
4313 | if (DoBackup) { | ||
4314 | used = 0; | ||
4315 | printmsgerr(" Reading : "); | ||
4316 | while (error == ERR_NONE) { | ||
4317 | if (used < GSM_BACKUP_MAX_WAPSETTINGS) { | ||
4318 | Backup.WAPSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | ||
4319 | if (Backup.WAPSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4320 | Backup.WAPSettings[used+1] = NULL; | ||
4321 | } else { | ||
4322 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPSETTINGS"); | ||
4323 | GSM_Terminate(); | ||
4324 | exit(-1); | ||
4325 | } | ||
4326 | *Backup.WAPSettings[used]=Settings; | ||
4327 | used ++; | ||
4328 | Settings.Location = used+1; | ||
4329 | error=Phone->GetWAPSettings(&s,&Settings); | ||
4330 | printmsgerr("*"); | ||
4331 | if (gshutdown) { | ||
4332 | GSM_Terminate(); | ||
4333 | exit(0); | ||
4334 | } | ||
4335 | } | ||
4336 | printmsgerr("\n"); | ||
4337 | } | ||
4338 | DoBackup = false; | ||
4339 | if (Info.Ringtone) { | ||
4340 | printmsg("Checking user ringtones\n"); | ||
4341 | Ringtone.Location = 1; | ||
4342 | Ringtone.Format = 0; | ||
4343 | error=Phone->GetRingtone(&s,&Ringtone,false); | ||
4344 | if (error==ERR_EMPTY || error == ERR_NONE) { | ||
4345 | if (answer_yes(" Backup user ringtones")) DoBackup = true; | ||
4346 | } | ||
4347 | } | ||
4348 | if (DoBackup) { | ||
4349 | used = 0; | ||
4350 | i= 1; | ||
4351 | printmsgerr(" Reading : "); | ||
4352 | while (error == ERR_NONE || error == ERR_EMPTY) { | ||
4353 | if (error == ERR_NONE) { | ||
4354 | if (used < GSM_BACKUP_MAX_RINGTONES) { | ||
4355 | Backup.Ringtone[used] = malloc(sizeof(GSM_Ringtone)); | ||
4356 | if (Backup.Ringtone[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4357 | Backup.Ringtone[used+1] = NULL; | ||
4358 | } else { | ||
4359 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_RINGTONES"); | ||
4360 | GSM_Terminate(); | ||
4361 | exit(-1); | ||
4362 | } | ||
4363 | *Backup.Ringtone[used]=Ringtone; | ||
4364 | used ++; | ||
4365 | } | ||
4366 | i++; | ||
4367 | Ringtone.Location = i; | ||
4368 | Ringtone.Format = 0; | ||
4369 | error=Phone->GetRingtone(&s,&Ringtone,false); | ||
4370 | printmsgerr("*"); | ||
4371 | if (gshutdown) { | ||
4372 | GSM_Terminate(); | ||
4373 | exit(0); | ||
4374 | } | ||
4375 | } | ||
4376 | printmsgerr("\n"); | ||
4377 | } | ||
4378 | DoBackup = false; | ||
4379 | if (Info.Profiles) { | ||
4380 | printmsg("Checking phone profiles\n"); | ||
4381 | Profile.Location = 1; | ||
4382 | error = Phone->GetProfile(&s,&Profile); | ||
4383 | if (error == ERR_NONE) { | ||
4384 | if (answer_yes(" Backup phone profiles")) DoBackup = true; | ||
4385 | } | ||
4386 | } | ||
4387 | if (DoBackup) { | ||
4388 | used = 0; | ||
4389 | printmsgerr(" Reading: "); | ||
4390 | while (true) { | ||
4391 | Profile.Location = used + 1; | ||
4392 | error = Phone->GetProfile(&s,&Profile); | ||
4393 | if (error != ERR_NONE) break; | ||
4394 | if (used < GSM_BACKUP_MAX_PROFILES) { | ||
4395 | Backup.Profiles[used] = malloc(sizeof(GSM_Profile)); | ||
4396 | if (Backup.Profiles[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4397 | Backup.Profiles[used + 1] = NULL; | ||
4398 | } else { | ||
4399 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_PROFILES"); | ||
4400 | GSM_Terminate(); | ||
4401 | exit(-1); | ||
4402 | } | ||
4403 | *Backup.Profiles[used]=Profile; | ||
4404 | used++; | ||
4405 | printmsgerr("*"); | ||
4406 | } | ||
4407 | printmsgerr("\n"); | ||
4408 | } | ||
4409 | DoBackup = false; | ||
4410 | if (Info.FMStation) { | ||
4411 | printmsg("Checking FM stations\n"); | ||
4412 | FMStation.Location = 1; | ||
4413 | error = Phone->GetFMStation(&s,&FMStation); | ||
4414 | if (error == ERR_NONE || error == ERR_EMPTY) { | ||
4415 | if (answer_yes(" Backup phone FM stations")) DoBackup=true; | ||
4416 | } | ||
4417 | } | ||
4418 | if (DoBackup) { | ||
4419 | used= 0; | ||
4420 | i = 1; | ||
4421 | printmsgerr(" Reading: "); | ||
4422 | while (error == ERR_NONE || error == ERR_EMPTY) { | ||
4423 | error = Phone->GetFMStation(&s,&FMStation); | ||
4424 | if (error == ERR_NONE) { | ||
4425 | if (used < GSM_BACKUP_MAX_FMSTATIONS) { | ||
4426 | Backup.FMStation[used] = malloc(sizeof(GSM_FMStation)); | ||
4427 | if (Backup.FMStation[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4428 | Backup.FMStation[used + 1] = NULL; | ||
4429 | } else { | ||
4430 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_FMSTATIONS"); | ||
4431 | GSM_Terminate(); | ||
4432 | exit(-1); | ||
4433 | } | ||
4434 | *Backup.FMStation[used]=FMStation; | ||
4435 | used++; | ||
4436 | } | ||
4437 | i++; | ||
4438 | FMStation.Location = i; | ||
4439 | printmsgerr("*"); | ||
4440 | } | ||
4441 | printmsgerr("\n"); | ||
4442 | } | ||
4443 | DoBackup = false; | ||
4444 | if (Info.GPRSPoint) { | ||
4445 | printmsg("Checking GPRS access points\n"); | ||
4446 | GPRSPoint.Location = 1; | ||
4447 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); | ||
4448 | if (error == ERR_NONE || error == ERR_EMPTY) { | ||
4449 | if (answer_yes(" Backup GPRS access points")) DoBackup = true; | ||
4450 | } | ||
4451 | } | ||
4452 | if (DoBackup) { | ||
4453 | used= 0; | ||
4454 | i = 1; | ||
4455 | printmsgerr(" Reading: "); | ||
4456 | while (error == ERR_NONE || error == ERR_EMPTY) { | ||
4457 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); | ||
4458 | if (error == ERR_NONE) { | ||
4459 | if (used < GSM_BACKUP_MAX_GPRSPOINT) { | ||
4460 | Backup.GPRSPoint[used] = malloc(sizeof(GSM_GPRSAccessPoint)); | ||
4461 | if (Backup.GPRSPoint[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4462 | Backup.GPRSPoint[used + 1] = NULL; | ||
4463 | } else { | ||
4464 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_GPRSPOINT"); | ||
4465 | GSM_Terminate(); | ||
4466 | exit(-1); | ||
4467 | } | ||
4468 | *Backup.GPRSPoint[used]=GPRSPoint; | ||
4469 | used++; | ||
4470 | } | ||
4471 | i++; | ||
4472 | GPRSPoint.Location = i; | ||
4473 | printmsgerr("*"); | ||
4474 | } | ||
4475 | printmsgerr("\n"); | ||
4476 | } | ||
4477 | |||
4478 | GSM_Terminate(); | ||
4479 | |||
4480 | GSM_SaveBackupFile(argv[2],&Backup, Info.UseUnicode); | ||
4481 | GSM_FreeBackup(&Backup); | ||
4482 | } | ||
4483 | |||
4484 | static void Restore(int argc, char *argv[]) | ||
4485 | { | ||
4486 | GSM_Backup Backup; | ||
4487 | GSM_FMStation FMStation; | ||
4488 | GSM_DateTime date_time; | ||
4489 | GSM_CalendarEntryCalendar; | ||
4490 | GSM_Bitmap Bitmap; | ||
4491 | GSM_Ringtone Ringtone; | ||
4492 | GSM_MemoryEntry Pbk; | ||
4493 | GSM_MemoryStatusMemStatus; | ||
4494 | GSM_ToDoEntry ToDo; | ||
4495 | GSM_ToDoStatus ToDoStatus; | ||
4496 | GSM_Profile Profile; | ||
4497 | GSM_MultiWAPSettingsSettings; | ||
4498 | GSM_GPRSAccessPointGPRSPoint; | ||
4499 | GSM_WAPBookmark Bookmark; | ||
4500 | int i, used, max = 0; | ||
4501 | bool Past = true; | ||
4502 | bool Found, DoRestore; | ||
4503 | |||
4504 | error=GSM_ReadBackupFile(argv[2],&Backup); | ||
4505 | Print_Error(error); | ||
4506 | |||
4507 | signal(SIGINT, interrupt); | ||
4508 | printmsgerr("Press Ctrl+C to break...\n"); | ||
4509 | |||
4510 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); | ||
4511 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | ||
4512 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); | ||
4513 | |||
4514 | if (Backup.MD5Calculated[0]!=0) { | ||
4515 | dbgprintf("\"%s\"\n",Backup.MD5Original); | ||
4516 | dbgprintf("\"%s\"\n",Backup.MD5Calculated); | ||
4517 | if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) { | ||
4518 | if (!answer_yes("Checksum in backup file do not match. Continue")) return; | ||
4519 | } | ||
4520 | } | ||
4521 | |||
4522 | GSM_Init(true); | ||
4523 | |||
4524 | DoRestore = false; | ||
4525 | if (Backup.PhonePhonebook[0] != NULL) { | ||
4526 | MemStatus.MemoryType = MEM_ME; | ||
4527 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
4528 | if (error==ERR_NONE) { | ||
4529 | max = 0; | ||
4530 | while (Backup.PhonePhonebook[max]!=NULL) max++; | ||
4531 | printmsgerr("%i entries in backup file\n",max); | ||
4532 | if (answer_yes("Restore phone phonebook")) DoRestore = true; | ||
4533 | } | ||
4534 | } | ||
4535 | if (DoRestore) { | ||
4536 | used = 0; | ||
4537 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | ||
4538 | Pbk.MemoryType = MEM_ME; | ||
4539 | Pbk.Location= i + 1; | ||
4540 | Pbk.EntriesNum= 0; | ||
4541 | if (used<max) { | ||
4542 | if (Backup.PhonePhonebook[used]->Location == Pbk.Location) { | ||
4543 | Pbk = *Backup.PhonePhonebook[used]; | ||
4544 | used++; | ||
4545 | dbgprintf("Location %i\n",Pbk.Location); | ||
4546 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); | ||
4547 | } | ||
4548 | } | ||
4549 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); | ||
4550 | Print_Error(error); | ||
4551 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | ||
4552 | if (gshutdown) { | ||
4553 | GSM_Terminate(); | ||
4554 | exit(0); | ||
4555 | } | ||
4556 | } | ||
4557 | printmsgerr("\n"); | ||
4558 | } | ||
4559 | |||
4560 | DoRestore = false; | ||
4561 | if (Backup.SIMPhonebook[0] != NULL) { | ||
4562 | MemStatus.MemoryType = MEM_SM; | ||
4563 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
4564 | if (error==ERR_NONE) { | ||
4565 | max = 0; | ||
4566 | while (Backup.SIMPhonebook[max]!=NULL) max++; | ||
4567 | printmsgerr("%i entries in backup file\n",max); | ||
4568 | if (answer_yes("Restore SIM phonebook")) DoRestore = true; | ||
4569 | } | ||
4570 | } | ||
4571 | if (DoRestore) { | ||
4572 | used = 0; | ||
4573 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | ||
4574 | Pbk.MemoryType = MEM_SM; | ||
4575 | Pbk.Location= i + 1; | ||
4576 | Pbk.EntriesNum= 0; | ||
4577 | if (used<max) { | ||
4578 | if (Backup.SIMPhonebook[used]->Location == Pbk.Location) { | ||
4579 | Pbk = *Backup.SIMPhonebook[used]; | ||
4580 | used++; | ||
4581 | dbgprintf("Location %i\n",Pbk.Location); | ||
4582 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); | ||
4583 | } | ||
4584 | } | ||
4585 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); | ||
4586 | Print_Error(error); | ||
4587 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | ||
4588 | if (gshutdown) { | ||
4589 | GSM_Terminate(); | ||
4590 | exit(0); | ||
4591 | } | ||
4592 | } | ||
4593 | printmsgerr("\n"); | ||
4594 | } | ||
4595 | |||
4596 | DoRestore = false; | ||
4597 | if (Backup.CallerLogos[0] != NULL) { | ||
4598 | Bitmap.Type = GSM_CallerGroupLogo; | ||
4599 | Bitmap.Location = 1; | ||
4600 | error=Phone->GetBitmap(&s,&Bitmap); | ||
4601 | if (error == ERR_NONE) { | ||
4602 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; | ||
4603 | } | ||
4604 | } | ||
4605 | if (DoRestore) { | ||
4606 | max = 0; | ||
4607 | while (Backup.CallerLogos[max]!=NULL) max++; | ||
4608 | for (i=0;i<max;i++) { | ||
4609 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); | ||
4610 | Print_Error(error); | ||
4611 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4612 | if (gshutdown) { | ||
4613 | GSM_Terminate(); | ||
4614 | exit(0); | ||
4615 | } | ||
4616 | } | ||
4617 | printmsgerr("\n"); | ||
4618 | } | ||
4619 | |||
4620 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | ||
4621 | if (/*answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/ true ) { | ||
4622 | GSM_GetCurrentDateTime(&date_time); | ||
4623 | |||
4624 | error=Phone->SetDateTime(&s, &date_time); | ||
4625 | Print_Error(error); | ||
4626 | } | ||
4627 | } | ||
4628 | DoRestore = false; | ||
4629 | if (Backup.Calendar[0] != NULL) { | ||
4630 | /* N6110 doesn't support getting calendar status */ | ||
4631 | error = Phone->GetNextCalendar(&s,&Calendar,true); | ||
4632 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | ||
4633 | max = 0; | ||
4634 | while (Backup.Calendar[max] != NULL) max++; | ||
4635 | printmsgerr("%i entries in backup file\n",max); | ||
4636 | DoRestore = true; | ||
4637 | /* | ||
4638 | if (answer_yes("Restore calendar notes")) { | ||
4639 | Past = answer_yes("Restore notes from the past"); | ||
4640 | DoRestore = true; | ||
4641 | } | ||
4642 | */ | ||
4643 | } | ||
4644 | } | ||
4645 | if (DoRestore) { | ||
4646 | printmsgerr("Deleting old notes: "); | ||
4647 | error = Phone->DeleteAllCalendar(&s); | ||
4648 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | ||
4649 | while (1) { | ||
4650 | error = Phone->GetNextCalendar(&s,&Calendar,true); | ||
4651 | if (error != ERR_NONE) break; | ||
4652 | error = Phone->DeleteCalendar(&s,&Calendar); | ||
4653 | Print_Error(error); | ||
4654 | printmsgerr("*"); | ||
4655 | } | ||
4656 | printmsgerr("\n"); | ||
4657 | } else { | ||
4658 | printmsgerr("Done\n"); | ||
4659 | Print_Error(error); | ||
4660 | } | ||
4661 | |||
4662 | for (i=0;i<max;i++) { | ||
4663 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; | ||
4664 | |||
4665 | Calendar = *Backup.Calendar[i]; | ||
4666 | error=Phone->AddCalendar(&s,&Calendar); | ||
4667 | Print_Error(error); | ||
4668 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4669 | if (gshutdown) { | ||
4670 | GSM_Terminate(); | ||
4671 | exit(0); | ||
4672 | } | ||
4673 | } | ||
4674 | printmsgerr("\n"); | ||
4675 | } | ||
4676 | |||
4677 | DoRestore = false; | ||
4678 | if (Backup.ToDo[0] != NULL) { | ||
4679 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | ||
4680 | if (error == ERR_NONE) { | ||
4681 | max = 0; | ||
4682 | while (Backup.ToDo[max]!=NULL) max++; | ||
4683 | printmsgerr("%i entries in backup file\n",max); | ||
4684 | |||
4685 | /*if (answer_yes("Restore ToDo")) */DoRestore = true; | ||
4686 | } | ||
4687 | } | ||
4688 | if (DoRestore) { | ||
4689 | ToDo = *Backup.ToDo[0]; | ||
4690 | error = Phone->SetToDo(&s,&ToDo); | ||
4691 | } | ||
4692 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { | ||
4693 | printmsgerr("Deleting old ToDo: "); | ||
4694 | error=Phone->DeleteAllToDo(&s); | ||
4695 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | ||
4696 | while (1) { | ||
4697 | error = Phone->GetNextToDo(&s,&ToDo,true); | ||
4698 | if (error != ERR_NONE) break; | ||
4699 | error = Phone->DeleteToDo(&s,&ToDo); | ||
4700 | Print_Error(error); | ||
4701 | printmsgerr("*"); | ||
4702 | } | ||
4703 | printmsgerr("\n"); | ||
4704 | } else { | ||
4705 | printmsgerr("Done\n"); | ||
4706 | Print_Error(error); | ||
4707 | } | ||
4708 | |||
4709 | for (i=0;i<max;i++) { | ||
4710 | ToDo = *Backup.ToDo[i]; | ||
4711 | ToDo.Location = 0; | ||
4712 | error=Phone->AddToDo(&s,&ToDo); | ||
4713 | Print_Error(error); | ||
4714 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4715 | if (gshutdown) { | ||
4716 | GSM_Terminate(); | ||
4717 | exit(0); | ||
4718 | } | ||
4719 | } | ||
4720 | printmsgerr("\n"); | ||
4721 | } else if (DoRestore) { | ||
4722 | /* At first delete entries, that were deleted */ | ||
4723 | used = 0; | ||
4724 | error = Phone->GetNextToDo(&s,&ToDo,true); | ||
4725 | while (error == ERR_NONE) { | ||
4726 | used++; | ||
4727 | Found = false; | ||
4728 | for (i=0;i<max;i++) { | ||
4729 | if (Backup.ToDo[i]->Location == ToDo.Location) { | ||
4730 | Found = true; | ||
4731 | break; | ||
4732 | } | ||
4733 | } | ||
4734 | if (!Found) { | ||
4735 | error=Phone->DeleteToDo(&s,&ToDo); | ||
4736 | Print_Error(error); | ||
4737 | } | ||
4738 | error = Phone->GetNextToDo(&s,&ToDo,false); | ||
4739 | printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used); | ||
4740 | if (gshutdown) { | ||
4741 | GSM_Terminate(); | ||
4742 | exit(0); | ||
4743 | } | ||
4744 | } | ||
4745 | printmsgerr("\n"); | ||
4746 | |||
4747 | /* Now write modified/new entries */ | ||
4748 | for (i=0;i<max;i++) { | ||
4749 | ToDo = *Backup.ToDo[i]; | ||
4750 | error = Phone->SetToDo(&s,&ToDo); | ||
4751 | Print_Error(error); | ||
4752 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4753 | if (gshutdown) { | ||
4754 | GSM_Terminate(); | ||
4755 | exit(0); | ||
4756 | } | ||
4757 | } | ||
4758 | printmsgerr("\n"); | ||
4759 | } | ||
4760 | |||
4761 | if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) { | ||
4762 | max = 0; | ||
4763 | while (Backup.SMSC[max]!=NULL) max++; | ||
4764 | for (i=0;i<max;i++) { | ||
4765 | error=Phone->SetSMSC(&s,Backup.SMSC[i]); | ||
4766 | Print_Error(error); | ||
4767 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4768 | if (gshutdown) { | ||
4769 | GSM_Terminate(); | ||
4770 | exit(0); | ||
4771 | } | ||
4772 | } | ||
4773 | printmsgerr("\n"); | ||
4774 | } | ||
4775 | if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) { | ||
4776 | error=Phone->SetBitmap(&s,Backup.StartupLogo); | ||
4777 | Print_Error(error); | ||
4778 | } | ||
4779 | if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) { | ||
4780 | error=Phone->SetBitmap(&s,Backup.OperatorLogo); | ||
4781 | Print_Error(error); | ||
4782 | } | ||
4783 | DoRestore = false; | ||
4784 | if (Backup.WAPBookmark[0] != NULL) { | ||
4785 | Bookmark.Location = 1; | ||
4786 | error = Phone->GetWAPBookmark(&s,&Bookmark); | ||
4787 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | ||
4788 | if (answer_yes("Restore WAP bookmarks")) DoRestore = true; | ||
4789 | } | ||
4790 | } | ||
4791 | if (DoRestore) { | ||
4792 | printmsgerr("Deleting old bookmarks: "); | ||
4793 | /* One thing to explain: DCT4 phones seems to have bug here. | ||
4794 | * When delete for example first bookmark, phone change | ||
4795 | * numeration for getting frame, not for deleting. So, we try to | ||
4796 | * get 1'st bookmark. Inside frame is "correct" location. We use | ||
4797 | * it later | ||
4798 | */ | ||
4799 | while (error==ERR_NONE) { | ||
4800 | error = Phone->DeleteWAPBookmark(&s,&Bookmark); | ||
4801 | Bookmark.Location = 1; | ||
4802 | error = Phone->GetWAPBookmark(&s,&Bookmark); | ||
4803 | printmsgerr("*"); | ||
4804 | } | ||
4805 | printmsgerr("\n"); | ||
4806 | max = 0; | ||
4807 | while (Backup.WAPBookmark[max]!=NULL) max++; | ||
4808 | for (i=0;i<max;i++) { | ||
4809 | Bookmark = *Backup.WAPBookmark[i]; | ||
4810 | Bookmark.Location = 0; | ||
4811 | error=Phone->SetWAPBookmark(&s,&Bookmark); | ||
4812 | Print_Error(error); | ||
4813 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4814 | if (gshutdown) { | ||
4815 | GSM_Terminate(); | ||
4816 | exit(0); | ||
4817 | } | ||
4818 | } | ||
4819 | printmsgerr("\n"); | ||
4820 | } | ||
4821 | DoRestore = false; | ||
4822 | if (Backup.WAPSettings[0] != NULL) { | ||
4823 | Settings.Location = 1; | ||
4824 | error = Phone->GetWAPSettings(&s,&Settings); | ||
4825 | if (error == ERR_NONE) { | ||
4826 | if (answer_yes("Restore WAP settings")) DoRestore = true; | ||
4827 | } | ||
4828 | } | ||
4829 | if (DoRestore) { | ||
4830 | max = 0; | ||
4831 | while (Backup.WAPSettings[max]!=NULL) max++; | ||
4832 | for (i=0;i<max;i++) { | ||
4833 | error=Phone->SetWAPSettings(&s,Backup.WAPSettings[i]); | ||
4834 | Print_Error(error); | ||
4835 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4836 | if (gshutdown) { | ||
4837 | GSM_Terminate(); | ||
4838 | exit(0); | ||
4839 | } | ||
4840 | } | ||
4841 | printmsgerr("\n"); | ||
4842 | } | ||
4843 | DoRestore = false; | ||
4844 | if (Backup.MMSSettings[0] != NULL) { | ||
4845 | Settings.Location = 1; | ||
4846 | error = Phone->GetMMSSettings(&s,&Settings); | ||
4847 | if (error == ERR_NONE) { | ||
4848 | if (answer_yes("Restore MMS settings")) DoRestore = true; | ||
4849 | } | ||
4850 | } | ||
4851 | if (DoRestore) { | ||
4852 | max = 0; | ||
4853 | while (Backup.MMSSettings[max]!=NULL) max++; | ||
4854 | for (i=0;i<max;i++) { | ||
4855 | error=Phone->SetMMSSettings(&s,Backup.MMSSettings[i]); | ||
4856 | Print_Error(error); | ||
4857 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4858 | if (gshutdown) { | ||
4859 | GSM_Terminate(); | ||
4860 | exit(0); | ||
4861 | } | ||
4862 | } | ||
4863 | printmsgerr("\n"); | ||
4864 | } | ||
4865 | DoRestore = false; | ||
4866 | if (Backup.Ringtone[0] != NULL) { | ||
4867 | Ringtone.Location = 1; | ||
4868 | Ringtone.Format = 0; | ||
4869 | error = Phone->GetRingtone(&s,&Ringtone,false); | ||
4870 | if (error == ERR_NONE || error ==ERR_EMPTY) { | ||
4871 | if (Phone->DeleteUserRingtones != NOTSUPPORTED) { | ||
4872 | if (answer_yes("Delete all user ringtones")) DoRestore = true; | ||
4873 | } | ||
4874 | } | ||
4875 | } | ||
4876 | if (DoRestore) { | ||
4877 | printmsgerr("Deleting: "); | ||
4878 | error=Phone->DeleteUserRingtones(&s); | ||
4879 | Print_Error(error); | ||
4880 | printmsgerr("Done\n"); | ||
4881 | DoRestore = false; | ||
4882 | if (answer_yes("Restore user ringtones")) DoRestore = true; | ||
4883 | } | ||
4884 | if (DoRestore) { | ||
4885 | max = 0; | ||
4886 | while (Backup.Ringtone[max]!=NULL) max++; | ||
4887 | for (i=0;i<max;i++) { | ||
4888 | error=GSM_RingtoneConvert(&Ringtone, Backup.Ringtone[i], Ringtone.Format); | ||
4889 | Print_Error(error); | ||
4890 | error=Phone->SetRingtone(&s,&Ringtone,&i); | ||
4891 | Print_Error(error); | ||
4892 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4893 | if (gshutdown) { | ||
4894 | GSM_Terminate(); | ||
4895 | exit(0); | ||
4896 | } | ||
4897 | } | ||
4898 | printmsgerr("\n"); | ||
4899 | } | ||
4900 | DoRestore = false; | ||
4901 | if (Backup.Profiles[0] != NULL) { | ||
4902 | Profile.Location = 1; | ||
4903 | error = Phone->GetProfile(&s,&Profile); | ||
4904 | if (error == ERR_NONE) { | ||
4905 | if (answer_yes("Restore profiles")) DoRestore = true; | ||
4906 | } | ||
4907 | } | ||
4908 | if (DoRestore) { | ||
4909 | Profile.Location= 0; | ||
4910 | max = 0; | ||
4911 | while (Backup.Profiles[max]!=NULL) max++; | ||
4912 | for (i=0;i<max;i++) { | ||
4913 | Profile= *Backup.Profiles[i]; | ||
4914 | error=Phone->SetProfile(&s,&Profile); | ||
4915 | Print_Error(error); | ||
4916 | if (gshutdown) { | ||
4917 | GSM_Terminate(); | ||
4918 | exit(0); | ||
4919 | } | ||
4920 | } | ||
4921 | printmsgerr("\n"); | ||
4922 | } | ||
4923 | DoRestore = false; | ||
4924 | if (Backup.FMStation[0] != NULL) { | ||
4925 | FMStation.Location = 1; | ||
4926 | error = Phone->GetFMStation(&s,&FMStation); | ||
4927 | if (error == ERR_NONE || error == ERR_EMPTY) { | ||
4928 | if (answer_yes("Restore FM stations")) DoRestore = true; | ||
4929 | } | ||
4930 | } | ||
4931 | if (DoRestore) { | ||
4932 | printmsgerr("Deleting old FM stations: "); | ||
4933 | error=Phone->ClearFMStations(&s); | ||
4934 | Print_Error(error); | ||
4935 | printmsgerr("Done\n"); | ||
4936 | max = 0; | ||
4937 | while (Backup.FMStation[max]!=NULL) max++; | ||
4938 | for (i=0;i<max;i++) { | ||
4939 | FMStation = *Backup.FMStation[i]; | ||
4940 | error=Phone->SetFMStation(&s,&FMStation); | ||
4941 | Print_Error(error); | ||
4942 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4943 | if (gshutdown) { | ||
4944 | GSM_Terminate(); | ||
4945 | exit(0); | ||
4946 | } | ||
4947 | } | ||
4948 | printmsgerr("\n"); | ||
4949 | } | ||
4950 | DoRestore = false; | ||
4951 | if (Backup.GPRSPoint[0] != NULL) { | ||
4952 | GPRSPoint.Location = 1; | ||
4953 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); | ||
4954 | if (error == ERR_NONE || error == ERR_EMPTY) { | ||
4955 | if (answer_yes("Restore GPRS Points")) DoRestore = true; | ||
4956 | } | ||
4957 | } | ||
4958 | if (DoRestore) { | ||
4959 | max = 0; | ||
4960 | while (Backup.GPRSPoint[max]!=NULL) max++; | ||
4961 | for (i=0;i<max;i++) { | ||
4962 | error=Phone->SetGPRSAccessPoint(&s,Backup.GPRSPoint[i]); | ||
4963 | Print_Error(error); | ||
4964 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
4965 | if (gshutdown) { | ||
4966 | GSM_Terminate(); | ||
4967 | exit(0); | ||
4968 | } | ||
4969 | } | ||
4970 | printmsgerr("\n"); | ||
4971 | } | ||
4972 | |||
4973 | GSM_Terminate(); | ||
4974 | } | ||
4975 | |||
4976 | static void AddNew(int argc, char *argv[]) | ||
4977 | { | ||
4978 | GSM_Backup Backup; | ||
4979 | GSM_DateTime date_time; | ||
4980 | GSM_MemoryEntry Pbk; | ||
4981 | GSM_MemoryStatusMemStatus; | ||
4982 | GSM_ToDoEntry ToDo; | ||
4983 | GSM_ToDoStatus ToDoStatus; | ||
4984 | GSM_CalendarEntryCalendar; | ||
4985 | GSM_WAPBookmark Bookmark; | ||
4986 | int i, max, j; | ||
4987 | |||
4988 | error=GSM_ReadBackupFile(argv[2],&Backup); | ||
4989 | Print_Error(error); | ||
4990 | |||
4991 | signal(SIGINT, interrupt); | ||
4992 | printmsgerr("Press Ctrl+C to break...\n"); | ||
4993 | |||
4994 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); | ||
4995 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | ||
4996 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); | ||
4997 | |||
4998 | GSM_Init(true); | ||
4999 | |||
5000 | if (Backup.PhonePhonebook[0] != NULL) { | ||
5001 | MemStatus.MemoryType = MEM_ME; | ||
5002 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
5003 | if (error==ERR_NONE) { | ||
5004 | max = 0; | ||
5005 | while (Backup.PhonePhonebook[max]!=NULL) max++; | ||
5006 | printmsgerr("%i entries in backup file\n",max); | ||
5007 | if (MemStatus.MemoryFree < max) { | ||
5008 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | ||
5009 | } else if (answer_yes("Add phone phonebook entries")) { | ||
5010 | for (i=0;i<max;i++) { | ||
5011 | Pbk = *Backup.PhonePhonebook[i]; | ||
5012 | Pbk.MemoryType = MEM_ME; | ||
5013 | error=Phone->AddMemory(&s, &Pbk); | ||
5014 | Print_Error(error); | ||
5015 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
5016 | if (gshutdown) { | ||
5017 | GSM_Terminate(); | ||
5018 | exit(0); | ||
5019 | } | ||
5020 | } | ||
5021 | printmsgerr("\n"); | ||
5022 | } | ||
5023 | } | ||
5024 | } | ||
5025 | if (Backup.SIMPhonebook[0] != NULL) { | ||
5026 | MemStatus.MemoryType = MEM_SM; | ||
5027 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
5028 | if (error==ERR_NONE) { | ||
5029 | max = 0; | ||
5030 | while (Backup.SIMPhonebook[max]!=NULL) max++; | ||
5031 | printmsgerr("%i entries in backup file\n",max); | ||
5032 | if (MemStatus.MemoryFree < max) { | ||
5033 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | ||
5034 | } else if (answer_yes("Add SIM phonebook entries")) { | ||
5035 | j = 1; | ||
5036 | for (i=0;i<max;i++) { | ||
5037 | Pbk = *Backup.SIMPhonebook[i]; | ||
5038 | Pbk.MemoryType = MEM_SM; | ||
5039 | error=Phone->AddMemory(&s, &Pbk); | ||
5040 | Print_Error(error); | ||
5041 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
5042 | if (gshutdown) { | ||
5043 | GSM_Terminate(); | ||
5044 | exit(0); | ||
5045 | } | ||
5046 | } | ||
5047 | printmsgerr("\n"); | ||
5048 | } | ||
5049 | } | ||
5050 | } | ||
5051 | |||
5052 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | ||
5053 | if (answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")) { | ||
5054 | GSM_GetCurrentDateTime(&date_time); | ||
5055 | |||
5056 | error=Phone->SetDateTime(&s, &date_time); | ||
5057 | Print_Error(error); | ||
5058 | } | ||
5059 | } | ||
5060 | if (Backup.Calendar[0] != NULL) { | ||
5061 | error = Phone->GetNextCalendar(&s,&Calendar,true); | ||
5062 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | ||
5063 | if (answer_yes("Add calendar notes")) { | ||
5064 | max = 0; | ||
5065 | while (Backup.Calendar[max]!=NULL) max++; | ||
5066 | for (i=0;i<max;i++) { | ||
5067 | Calendar = *Backup.Calendar[i]; | ||
5068 | error=Phone->AddCalendar(&s,&Calendar); | ||
5069 | Print_Error(error); | ||
5070 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
5071 | if (gshutdown) { | ||
5072 | GSM_Terminate(); | ||
5073 | exit(0); | ||
5074 | } | ||
5075 | } | ||
5076 | printmsgerr("\n"); | ||
5077 | } | ||
5078 | } | ||
5079 | } | ||
5080 | if (Backup.ToDo[0] != NULL) { | ||
5081 | ToDo.Location = 1; | ||
5082 | error=Phone->GetToDoStatus(&s,&ToDoStatus); | ||
5083 | if (error == ERR_NONE) { | ||
5084 | if (answer_yes("Add ToDo")) { | ||
5085 | max = 0; | ||
5086 | while (Backup.ToDo[max]!=NULL) max++; | ||
5087 | for (i=0;i<max;i++) { | ||
5088 | ToDo = *Backup.ToDo[i]; | ||
5089 | error = Phone->AddToDo(&s,&ToDo); | ||
5090 | Print_Error(error); | ||
5091 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
5092 | if (gshutdown) { | ||
5093 | GSM_Terminate(); | ||
5094 | exit(0); | ||
5095 | } | ||
5096 | } | ||
5097 | printmsgerr("\n"); | ||
5098 | } | ||
5099 | } | ||
5100 | } | ||
5101 | if (Backup.WAPBookmark[0] != NULL) { | ||
5102 | Bookmark.Location = 1; | ||
5103 | error = Phone->GetWAPBookmark(&s,&Bookmark); | ||
5104 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | ||
5105 | if (answer_yes("Add WAP bookmarks")) { | ||
5106 | max = 0; | ||
5107 | while (Backup.WAPBookmark[max]!=NULL) max++; | ||
5108 | for (i=0;i<max;i++) { | ||
5109 | Bookmark = *Backup.WAPBookmark[i]; | ||
5110 | Bookmark.Location = 0; | ||
5111 | error=Phone->SetWAPBookmark(&s,&Bookmark); | ||
5112 | Print_Error(error); | ||
5113 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | ||
5114 | if (gshutdown) { | ||
5115 | GSM_Terminate(); | ||
5116 | exit(0); | ||
5117 | } | ||
5118 | } | ||
5119 | printmsgerr("\n"); | ||
5120 | } | ||
5121 | } | ||
5122 | } | ||
5123 | |||
5124 | GSM_Terminate(); | ||
5125 | } | ||
5126 | #endif | ||
5127 | |||
5128 | static void ClearAll(int argc, char *argv[]) | ||
5129 | { | ||
5130 | GSM_MemoryStatusMemStatus; | ||
5131 | GSM_ToDoStatus ToDoStatus; | ||
5132 | GSM_CalendarEntryCalendar; | ||
5133 | GSM_ToDoEntry ToDo; | ||
5134 | GSM_WAPBookmark Bookmark; | ||
5135 | GSM_FMStation Station; | ||
5136 | GSM_MemoryEntry Pbk; | ||
5137 | bool DoClear; | ||
5138 | |||
5139 | GSM_Init(true); | ||
5140 | |||
5141 | DoClear = false; | ||
5142 | MemStatus.MemoryType = MEM_ME; | ||
5143 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
5144 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { | ||
5145 | if (answer_yes("Delete phone phonebook")) DoClear = true; | ||
5146 | } | ||
5147 | if (DoClear) { | ||
5148 | error = Phone->DeleteAllMemory(&s,MEM_ME); | ||
5149 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | ||
5150 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | ||
5151 | Pbk.MemoryType = MEM_ME; | ||
5152 | Pbk.Location= i + 1; | ||
5153 | Pbk.EntriesNum= 0; | ||
5154 | error=Phone->DeleteMemory(&s, &Pbk); | ||
5155 | Print_Error(error); | ||
5156 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | ||
5157 | if (gshutdown) { | ||
5158 | GSM_Terminate(); | ||
5159 | exit(0); | ||
5160 | } | ||
5161 | } | ||
5162 | printmsgerr("\n"); | ||
5163 | } else { | ||
5164 | printmsgerr("Done\n"); | ||
5165 | Print_Error(error); | ||
5166 | } | ||
5167 | } | ||
5168 | |||
5169 | DoClear = false; | ||
5170 | MemStatus.MemoryType = MEM_SM; | ||
5171 | error=Phone->GetMemoryStatus(&s, &MemStatus); | ||
5172 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { | ||
5173 | if (answer_yes("Delete SIM phonebook")) DoClear = true; | ||
5174 | } | ||
5175 | if (DoClear) { | ||
5176 | error = Phone->DeleteAllMemory(&s,MEM_SM); | ||
5177 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | ||
5178 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | ||
5179 | Pbk.MemoryType = MEM_SM; | ||
5180 | Pbk.Location= i + 1; | ||
5181 | Pbk.EntriesNum= 0; | ||
5182 | error=Phone->DeleteMemory(&s, &Pbk); | ||
5183 | Print_Error(error); | ||
5184 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | ||
5185 | if (gshutdown) { | ||
5186 | GSM_Terminate(); | ||
5187 | exit(0); | ||
5188 | } | ||
5189 | } | ||
5190 | printmsgerr("\n"); | ||
5191 | } else { | ||
5192 | printmsgerr("Done\n"); | ||
5193 | Print_Error(error); | ||
5194 | } | ||
5195 | } | ||
5196 | |||
5197 | DoClear = false; | ||
5198 | error = Phone->GetNextCalendar(&s,&Calendar,true); | ||
5199 | if (error == ERR_NONE) { | ||
5200 | if (answer_yes("Delete calendar notes")) DoClear = true; | ||
5201 | } | ||
5202 | if (DoClear) { | ||
5203 | printmsgerr("Deleting: "); | ||
5204 | error=Phone->DeleteAllCalendar(&s); | ||
5205 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | ||
5206 | while (1) { | ||
5207 | error = Phone->GetNextCalendar(&s,&Calendar,true); | ||
5208 | if (error != ERR_NONE) break; | ||
5209 | error = Phone->DeleteCalendar(&s,&Calendar); | ||
5210 | Print_Error(error); | ||
5211 | printmsgerr("*"); | ||
5212 | } | ||
5213 | printmsgerr("\n"); | ||
5214 | } else { | ||
5215 | printmsgerr("Done\n"); | ||
5216 | Print_Error(error); | ||
5217 | } | ||
5218 | } | ||
5219 | |||
5220 | DoClear = false; | ||
5221 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | ||
5222 | if (error == ERR_NONE && ToDoStatus.Used != 0) { | ||
5223 | if (answer_yes("Delete ToDo")) DoClear = true; | ||
5224 | } | ||
5225 | if (DoClear) { | ||
5226 | printmsgerr("Deleting: "); | ||
5227 | error=Phone->DeleteAllToDo(&s); | ||
5228 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | ||
5229 | while (1) { | ||
5230 | error = Phone->GetNextToDo(&s,&ToDo,true); | ||
5231 | if (error != ERR_NONE) break; | ||
5232 | error = Phone->DeleteToDo(&s,&ToDo); | ||
5233 | Print_Error(error); | ||
5234 | printmsgerr("*"); | ||
5235 | } | ||
5236 | printmsgerr("\n"); | ||
5237 | } else { | ||
5238 | printmsgerr("Done\n"); | ||
5239 | Print_Error(error); | ||
5240 | } | ||
5241 | } | ||
5242 | |||
5243 | Bookmark.Location = 1; | ||
5244 | error = Phone->GetWAPBookmark(&s,&Bookmark); | ||
5245 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | ||
5246 | if (answer_yes("Delete WAP bookmarks")) { | ||
5247 | printmsgerr("Deleting: "); | ||
5248 | /* One thing to explain: DCT4 phones seems to have bug here. | ||
5249 | * When delete for example first bookmark, phone change | ||
5250 | * numeration for getting frame, not for deleting. So, we try to | ||
5251 | * get 1'st bookmark. Inside frame is "correct" location. We use | ||
5252 | * it later | ||
5253 | */ | ||
5254 | while (error==ERR_NONE) { | ||
5255 | error = Phone->DeleteWAPBookmark(&s,&Bookmark); | ||
5256 | Bookmark.Location = 1; | ||
5257 | error = Phone->GetWAPBookmark(&s,&Bookmark); | ||
5258 | printmsgerr("*"); | ||
5259 | } | ||
5260 | printmsgerr("\n"); | ||
5261 | } | ||
5262 | } | ||
5263 | if (Phone->DeleteUserRingtones != NOTSUPPORTED) { | ||
5264 | if (answer_yes("Delete all user ringtones")) { | ||
5265 | printmsgerr("Deleting: "); | ||
5266 | error=Phone->DeleteUserRingtones(&s); | ||
5267 | Print_Error(error); | ||
5268 | printmsgerr("Done\n"); | ||
5269 | } | ||
5270 | } | ||
5271 | Station.Location=i; | ||
5272 | error=Phone->GetFMStation(&s,&Station); | ||
5273 | if (error == ERR_NONE || error == ERR_EMPTY) { | ||
5274 | if (answer_yes("Delete all FM station")) { | ||
5275 | error=Phone->ClearFMStations(&s); | ||
5276 | Print_Error(error); | ||
5277 | } | ||
5278 | } | ||
5279 | |||
5280 | GSM_Terminate(); | ||
5281 | } | ||
5282 | |||
5283 | static void DisplayConnectionSettings(GSM_MultiWAPSettings *settings,int j) | ||
5284 | { | ||
5285 | if (settings->Settings[j].IsContinuous) { | ||
5286 | printmsg("Connection type : Continuous\n"); | ||
5287 | } else { | ||
5288 | printmsg("Connection type : Temporary\n"); | ||
5289 | } | ||
5290 | if (settings->Settings[j].IsSecurity) { | ||
5291 | printmsg("Connection security : On\n"); | ||
5292 | } else { | ||
5293 | printmsg("Connection security : Off\n"); | ||
5294 | } | ||
5295 | printmsg("Proxy : address \"%s\", port %i\n",DecodeUnicodeConsole(settings->Proxy),settings->ProxyPort); | ||
5296 | printmsg("2'nd proxy : address \"%s\", port %i\n",DecodeUnicodeConsole(settings->Proxy2),settings->Proxy2Port); | ||
5297 | switch (settings->Settings[j].Bearer) { | ||
5298 | case WAPSETTINGS_BEARER_SMS: | ||
5299 | printmsg("Bearer : SMS"); | ||
5300 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_SMS) printf(" (active)"); | ||
5301 | printmsg("\nServer number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Server)); | ||
5302 | printmsg("Service number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); | ||
5303 | break; | ||
5304 | case WAPSETTINGS_BEARER_DATA: | ||
5305 | printmsg("Bearer : Data (CSD)"); | ||
5306 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_DATA) printf(" (active)"); | ||
5307 | printmsg("\nDial-up number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].DialUp)); | ||
5308 | printmsg("IP address : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].IPAddress)); | ||
5309 | if (settings->Settings[j].ManualLogin) { | ||
5310 | printmsg("Login Type : Manual\n"); | ||
5311 | } else { | ||
5312 | printmsg("Login Type : Automatic\n"); | ||
5313 | } | ||
5314 | if (settings->Settings[j].IsNormalAuthentication) { | ||
5315 | printmsg("Authentication type : Normal\n"); | ||
5316 | } else { | ||
5317 | printmsg("Authentication type : Secure\n"); | ||
5318 | } | ||
5319 | if (settings->Settings[j].IsISDNCall) { | ||
5320 | printmsg("Data call type : ISDN\n"); | ||
5321 | } else { | ||
5322 | printmsg("Data call type : Analogue\n"); | ||
5323 | } | ||
5324 | switch (settings->Settings[j].Speed) { | ||
5325 | case WAPSETTINGS_SPEED_9600 : printmsg("Data call speed : 9600\n"); break; | ||
5326 | case WAPSETTINGS_SPEED_14400 : printmsg("Data call speed : 14400\n"); break; | ||
5327 | case WAPSETTINGS_SPEED_AUTO : printmsg("Data call speed : Auto\n"); break; | ||
5328 | } | ||
5329 | printmsg("User name : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].User)); | ||
5330 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Password)); | ||
5331 | break; | ||
5332 | case WAPSETTINGS_BEARER_USSD: | ||
5333 | printmsg("Bearer : USSD"); | ||
5334 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_USSD) printf(" (active)"); | ||
5335 | printmsg("\nService code : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Code)); | ||
5336 | if (settings->Settings[j].IsIP) { | ||
5337 | printmsg("Address type : IP address\nIPaddress : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); | ||
5338 | } else { | ||
5339 | printmsg("Address type : Service number\nService number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); | ||
5340 | } | ||
5341 | break; | ||
5342 | case WAPSETTINGS_BEARER_GPRS: | ||
5343 | printmsg("Bearer : GPRS"); | ||
5344 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_GPRS) printf(" (active)"); | ||
5345 | if (settings->Settings[j].ManualLogin) { | ||
5346 | printmsg("\nLogin Type : Manual\n"); | ||
5347 | } else { | ||
5348 | printmsg("\nLogin Type : Automatic\n"); | ||
5349 | } | ||
5350 | if (settings->Settings[j].IsNormalAuthentication) { | ||
5351 | printmsg("Authentication type : Normal\n"); | ||
5352 | } else { | ||
5353 | printmsg("Authentication type : Secure\n"); | ||
5354 | } | ||
5355 | printmsg("Access point : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].DialUp)); | ||
5356 | printmsg("IP address : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].IPAddress)); | ||
5357 | printmsg("User name : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].User)); | ||
5358 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Password)); | ||
5359 | } | ||
5360 | } | ||
5361 | |||
5362 | static void GetSyncMLSettings(int argc, char *argv[]) | ||
5363 | { | ||
5364 | GSM_SyncMLSettingssettings; | ||
5365 | int start,stop,j; | ||
5366 | |||
5367 | GetStartStop(&start, &stop, 2, argc, argv); | ||
5368 | |||
5369 | GSM_Init(true); | ||
5370 | |||
5371 | for (i=start;i<=stop;i++) { | ||
5372 | settings.Location=i; | ||
5373 | error=Phone->GetSyncMLSettings(&s,&settings); | ||
5374 | Print_Error(error); | ||
5375 | printmsg("%i. ",i); | ||
5376 | if (settings.Name[0]==0 && settings.Name[1]==0) { | ||
5377 | printmsg("Set %i",i); | ||
5378 | } else { | ||
5379 | printmsg("%s",DecodeUnicodeConsole(settings.Name)); | ||
5380 | } | ||
5381 | if (settings.Active) printmsg(" (active)"); | ||
5382 | // if (settings.ReadOnly) printmsg("\nRead only : yes"); | ||
5383 | printmsg("\n"); | ||
5384 | printmsg("User : \"%s\"\n",DecodeUnicodeConsole(settings.User)); | ||
5385 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings.Password)); | ||
5386 | printmsg("Phonebook database : \"%s\"\n",DecodeUnicodeConsole(settings.PhonebookDataBase)); | ||
5387 | printmsg("Calendar database : \"%s\"\n",DecodeUnicodeConsole(settings.CalendarDataBase)); | ||
5388 | printmsg("Server : \"%s\"\n",DecodeUnicodeConsole(settings.Server)); | ||
5389 | printmsg("Sync. phonebook : "); | ||
5390 | if (settings.SyncPhonebook) printmsg("yes\n"); | ||
5391 | if (!settings.SyncPhonebook) printmsg("no\n"); | ||
5392 | printmsg("Sync. calendar : "); | ||
5393 | if (settings.SyncCalendar) printmsg("yes\n"); | ||
5394 | if (!settings.SyncCalendar) printmsg("no\n"); | ||
5395 | printmsg("\n"); | ||
5396 | for (j=0;j<settings.Connection.Number;j++) { | ||
5397 | if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) { | ||
5398 | printmsg("Connection set name : Set %i\n",i); | ||
5399 | } else { | ||
5400 | printmsg("Connection set name : %s\n",DecodeUnicodeConsole(settings.Connection.Settings[j].Title)); | ||
5401 | } | ||
5402 | DisplayConnectionSettings(&settings.Connection,j); | ||
5403 | printf("\n"); | ||
5404 | } | ||
5405 | } | ||
5406 | GSM_Terminate(); | ||
5407 | } | ||
5408 | |||
5409 | static void GetChatSettings(int argc, char *argv[]) | ||
5410 | { | ||
5411 | GSM_ChatSettingssettings; | ||
5412 | int start,stop,j; | ||
5413 | |||
5414 | GetStartStop(&start, &stop, 2, argc, argv); | ||
5415 | |||
5416 | GSM_Init(true); | ||
5417 | |||
5418 | for (i=start;i<=stop;i++) { | ||
5419 | settings.Location=i; | ||
5420 | error=Phone->GetChatSettings(&s,&settings); | ||
5421 | Print_Error(error); | ||
5422 | printmsg("%i. ",i); | ||
5423 | if (settings.Name[0]==0 && settings.Name[1]==0) { | ||
5424 | printmsg("Set %i",i); | ||
5425 | } else { | ||
5426 | printmsg("%s",DecodeUnicodeConsole(settings.Name)); | ||
5427 | } | ||
5428 | if (settings.Active) printmsg(" (active)"); | ||
5429 | // if (settings.ReadOnly) printmsg("\nRead only : yes"); | ||
5430 | printmsg("\n"); | ||
5431 | printmsg("Homepage : \"%s\"\n",DecodeUnicodeConsole(settings.HomePage)); | ||
5432 | printmsg("User : \"%s\"\n",DecodeUnicodeConsole(settings.User)); | ||
5433 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings.Password)); | ||
5434 | printmsg("\n"); | ||
5435 | for (j=0;j<settings.Connection.Number;j++) { | ||
5436 | if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) { | ||
5437 | printmsg("Connection set name : Set %i\n",i); | ||
5438 | } else { | ||
5439 | printmsg("Connection set name : %s\n",DecodeUnicodeConsole(settings.Connection.Settings[j].Title)); | ||
5440 | } | ||
5441 | DisplayConnectionSettings(&settings.Connection,j); | ||
5442 | printf("\n"); | ||
5443 | } | ||
5444 | } | ||
5445 | GSM_Terminate(); | ||
5446 | } | ||
5447 | |||
5448 | static void GetWAPMMSSettings(int argc, char *argv[]) | ||
5449 | { | ||
5450 | GSM_MultiWAPSettingssettings; | ||
5451 | int start,stop,j; | ||
5452 | |||
5453 | GetStartStop(&start, &stop, 2, argc, argv); | ||
5454 | |||
5455 | GSM_Init(true); | ||
5456 | |||
5457 | for (i=start;i<=stop;i++) { | ||
5458 | settings.Location=i; | ||
5459 | if (mystrncasecmp(argv[1],"--getwapsettings",0)) { | ||
5460 | error=Phone->GetWAPSettings(&s,&settings); | ||
5461 | } else { | ||
5462 | error=Phone->GetMMSSettings(&s,&settings); | ||
5463 | } | ||
5464 | Print_Error(error); | ||
5465 | for (j=0;j<settings.Number;j++) { | ||
5466 | printmsg("%i. ",i); | ||
5467 | if (settings.Settings[j].Title[0]==0 && settings.Settings[j].Title[1]==0) { | ||
5468 | printmsg("Set %i",i); | ||
5469 | } else { | ||
5470 | printmsg("%s",DecodeUnicodeConsole(settings.Settings[j].Title)); | ||
5471 | } | ||
5472 | if (settings.Active) printmsg(" (active)"); | ||
5473 | if (settings.ReadOnly) printmsg("\nRead only : yes"); | ||
5474 | printmsg("\nHomepage : \"%s\"\n",DecodeUnicodeConsole(settings.Settings[j].HomePage)); | ||
5475 | DisplayConnectionSettings(&settings,j); | ||
5476 | printf("\n"); | ||
5477 | } | ||
5478 | } | ||
5479 | GSM_Terminate(); | ||
5480 | } | ||
5481 | |||
5482 | #ifdef GSM_ENABLE_BACKUP | ||
5483 | static void BackupSMS(int argc, char *argv[]) | ||
5484 | { | ||
5485 | GSM_SMS_Backup Backup; | ||
5486 | GSM_MultiSMSMessage sms; | ||
5487 | GSM_SMSFolders folders; | ||
5488 | bool BackupFromFolder[GSM_MAX_SMS_FOLDERS]; | ||
5489 | bool start = true; | ||
5490 | bool DeleteAfter; | ||
5491 | int j, smsnum; | ||
5492 | char buffer[200]; | ||
5493 | |||
5494 | /* We ignore return code, because (when file doesn't exist) we | ||
5495 | * will create new later | ||
5496 | */ | ||
5497 | GSM_ReadSMSBackupFile(argv[2], &Backup); | ||
5498 | smsnum = 0; | ||
5499 | while (Backup.SMS[smsnum]!=NULL) smsnum++; | ||
5500 | |||
5501 | GSM_Init(true); | ||
5502 | |||
5503 | error=Phone->GetSMSFolders(&s, &folders); | ||
5504 | Print_Error(error); | ||
5505 | |||
5506 | DeleteAfter=answer_yes("Delete each sms after backup"); | ||
5507 | |||
5508 | for (j=0;j<folders.Number;j++) { | ||
5509 | BackupFromFolder[j] = false; | ||
5510 | sprintf(buffer,"Backup sms from folder \"%s\"",DecodeUnicodeConsole(folders.Folder[j].Name)); | ||
5511 | if (answer_yes(buffer)) BackupFromFolder[j] = true; | ||
5512 | } | ||
5513 | |||
5514 | while (error == ERR_NONE) { | ||
5515 | sms.SMS[0].Folder=0x00; | ||
5516 | error=Phone->GetNextSMS(&s, &sms, start); | ||
5517 | switch (error) { | ||
5518 | case ERR_EMPTY: | ||
5519 | break; | ||
5520 | default: | ||
5521 | Print_Error(error); | ||
5522 | for (j=0;j<sms.Number;j++) { | ||
5523 | if (BackupFromFolder[sms.SMS[j].Folder-1]) { | ||
5524 | switch (sms.SMS[j].PDU) { | ||
5525 | case SMS_Status_Report: | ||
5526 | break; | ||
5527 | case SMS_Submit: | ||
5528 | case SMS_Deliver: | ||
5529 | if (sms.SMS[j].Length == 0) break; | ||
5530 | if (smsnum < GSM_BACKUP_MAX_SMS) { | ||
5531 | Backup.SMS[smsnum] = malloc(sizeof(GSM_SMSMessage)); | ||
5532 | if (Backup.SMS[smsnum] == NULL) Print_Error(ERR_MOREMEMORY); | ||
5533 | Backup.SMS[smsnum+1] = NULL; | ||
5534 | } else { | ||
5535 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMS"); | ||
5536 | GSM_Terminate(); | ||
5537 | exit(-1); | ||
5538 | } | ||
5539 | *Backup.SMS[smsnum] = sms.SMS[j]; | ||
5540 | smsnum++; | ||
5541 | break; | ||
5542 | } | ||
5543 | } | ||
5544 | } | ||
5545 | } | ||
5546 | start=false; | ||
5547 | } | ||
5548 | |||
5549 | error = GSM_SaveSMSBackupFile(argv[2],&Backup); | ||
5550 | Print_Error(error); | ||
5551 | |||
5552 | if (DeleteAfter) { | ||
5553 | for (j=0;j<smsnum;j++) { | ||
5554 | Backup.SMS[j]->Folder = 0; | ||
5555 | error=Phone->DeleteSMS(&s, Backup.SMS[j]); | ||
5556 | Print_Error(error); | ||
5557 | printmsgerr("%cDeleting: %i percent",13,(j+1)*100/smsnum); | ||
5558 | } | ||
5559 | } | ||
5560 | |||
5561 | GSM_Terminate(); | ||
5562 | } | ||
5563 | |||
5564 | static void AddSMS(int argc, char *argv[]) | ||
5565 | { | ||
5566 | GSM_MultiSMSMessage SMS; | ||
5567 | GSM_SMS_Backup Backup; | ||
5568 | int smsnum = 0; | ||
5569 | int folder; | ||
5570 | |||
5571 | folder = atoi(argv[2]); | ||
5572 | |||
5573 | error = GSM_ReadSMSBackupFile(argv[3], &Backup); | ||
5574 | Print_Error(error); | ||
5575 | |||
5576 | GSM_Init(true); | ||
5577 | |||
5578 | while (Backup.SMS[smsnum] != NULL) { | ||
5579 | Backup.SMS[smsnum]->Folder = folder; | ||
5580 | Backup.SMS[smsnum]->SMSC.Location = 1; | ||
5581 | SMS.Number = 1; | ||
5582 | SMS.SMS[0] = *Backup.SMS[smsnum]; | ||
5583 | displaymultismsinfo(SMS,false,false); | ||
5584 | if (answer_yes("Restore sms")) { | ||
5585 | error=Phone->AddSMS(&s, Backup.SMS[smsnum]); | ||
5586 | Print_Error(error); | ||
5587 | } | ||
5588 | smsnum++; | ||
5589 | } | ||
5590 | |||
5591 | GSM_Terminate(); | ||
5592 | } | ||
5593 | |||
5594 | static void RestoreSMS(int argc, char *argv[]) | ||
5595 | { | ||
5596 | GSM_MultiSMSMessage SMS; | ||
5597 | GSM_SMS_Backup Backup; | ||
5598 | GSM_SMSFolders folders; | ||
5599 | int smsnum = 0; | ||
5600 | char buffer[200]; | ||
5601 | |||
5602 | error=GSM_ReadSMSBackupFile(argv[2], &Backup); | ||
5603 | Print_Error(error); | ||
5604 | |||
5605 | GSM_Init(true); | ||
5606 | |||
5607 | error=Phone->GetSMSFolders(&s, &folders); | ||
5608 | Print_Error(error); | ||
5609 | |||
5610 | while (Backup.SMS[smsnum] != NULL) { | ||
5611 | SMS.Number = 1; | ||
5612 | memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); | ||
5613 | displaymultismsinfo(SMS,false,false); | ||
5614 | sprintf(buffer,"Restore sms to folder \"%s\"",DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name)); | ||
5615 | if (answer_yes(buffer)) { | ||
5616 | Backup.SMS[smsnum]->Location = 0; | ||
5617 | error=Phone->SetSMS(&s, Backup.SMS[smsnum]); | ||
5618 | Print_Error(error); | ||
5619 | } | ||
5620 | smsnum++; | ||
5621 | } | ||
5622 | |||
5623 | GSM_Terminate(); | ||
5624 | } | ||
5625 | #endif | ||
5626 | |||
5627 | static void CopyBitmap(int argc, char *argv[]) | ||
5628 | { | ||
5629 | GSM_MultiBitmap Bitmap; | ||
5630 | int i; | ||
5631 | |||
5632 | Bitmap.Bitmap[0].Type = GSM_None; | ||
5633 | |||
5634 | error=GSM_ReadBitmapFile(argv[2],&Bitmap); | ||
5635 | Print_Error(error); | ||
5636 | |||
5637 | if (argc==3) { | ||
5638 | for (i=0;i<Bitmap.Number;i++) { | ||
5639 | switch (Bitmap.Bitmap[i].Type) { | ||
5640 | case GSM_StartupLogo : printmsg("Startup logo"); break; | ||
5641 | case GSM_OperatorLogo: printmsg("Operator logo"); break; | ||
5642 | case GSM_PictureImage: printmsg("Picture Image"); break; | ||
5643 | case GSM_CallerGroupLogo : printmsg("Caller group logo"); break; | ||
5644 | default : break; | ||
5645 | } | ||
5646 | printmsg(", width %i, height %i\n",Bitmap.Bitmap[i].BitmapWidth,Bitmap.Bitmap[i].BitmapHeight); | ||
5647 | GSM_PrintBitmap(stdout,&Bitmap.Bitmap[i]); | ||
5648 | } | ||
5649 | } else { | ||
5650 | if (argc == 5) { | ||
5651 | for (i=0;i<Bitmap.Number;i++) { | ||
5652 | if (mystrncasecmp(argv[4],"PICTURE",0)) { | ||
5653 | Bitmap.Bitmap[i].Type = GSM_PictureImage; | ||
5654 | } else if (mystrncasecmp(argv[4],"STARTUP",0)) { | ||
5655 | Bitmap.Bitmap[i].Type = GSM_StartupLogo; | ||
5656 | } else if (mystrncasecmp(argv[4],"CALLER",0)) { | ||
5657 | Bitmap.Bitmap[i].Type = GSM_CallerGroupLogo; | ||
5658 | } else if (mystrncasecmp(argv[4],"OPERATOR",0)) { | ||
5659 | Bitmap.Bitmap[i].Type = GSM_OperatorLogo; | ||
5660 | } else { | ||
5661 | printmsg("What format of output file logo (\"%s\") ?\n",argv[4]); | ||
5662 | exit(-1); | ||
5663 | } | ||
5664 | } | ||
5665 | } | ||
5666 | error=GSM_SaveBitmapFile(argv[3],&Bitmap); | ||
5667 | Print_Error(error); | ||
5668 | } | ||
5669 | } | ||
5670 | |||
5671 | static void NokiaComposer(int argc, char *argv[]) | ||
5672 | { | ||
5673 | GSM_Ringtone ringtone; | ||
5674 | bool started; | ||
5675 | int i,j; | ||
5676 | GSM_RingNote *Note; | ||
5677 | GSM_RingNoteDuration Duration; | ||
5678 | GSM_RingNoteDuration DefNoteDuration = 32; /* 32 = Duration_1_4 */ | ||
5679 | unsigned int DefNoteScale = Scale_880; | ||
5680 | |||
5681 | ringtone.Format= 0; | ||
5682 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | ||
5683 | |||
5684 | if (ringtone.Format != RING_NOTETONE) { | ||
5685 | printmsg("It can be RTTL ringtone only used with this option\n"); | ||
5686 | exit(-1); | ||
5687 | } | ||
5688 | |||
5689 | started = false; | ||
5690 | j= 0; | ||
5691 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | ||
5692 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { | ||
5693 | Note = &ringtone.NoteTone.Commands[i].Note; | ||
5694 | if (!started) { | ||
5695 | if (Note->Note != Note_Pause) { | ||
5696 | printmsg("Ringtone \"%s\" (tempo = %i Beats Per Minute)\n\n",DecodeUnicodeConsole(ringtone.Name),GSM_RTTLGetTempo(Note->Tempo)); | ||
5697 | started = true; | ||
5698 | } | ||
5699 | } | ||
5700 | if (started) j++; | ||
5701 | } | ||
5702 | } | ||
5703 | if (j>50) printmsg("WARNING: LENGTH=%i NOTES, BUT YOU WILL ENTER ONLY FIRST 50 TONES.",j); | ||
5704 | |||
5705 | printmsg("\n\nThis ringtone in Nokia Composer in phone should look: "); | ||
5706 | started = false; | ||
5707 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | ||
5708 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { | ||
5709 | Note = &ringtone.NoteTone.Commands[i].Note; | ||
5710 | if (!started) { | ||
5711 | if (Note->Note != Note_Pause) started = true; | ||
5712 | } | ||
5713 | if (started) { | ||
5714 | switch (Note->Duration) { | ||
5715 | case Duration_Full: printmsg("1"); break; | ||
5716 | case Duration_1_2 : printmsg("2"); break; | ||
5717 | case Duration_1_4 : printmsg("4"); break; | ||
5718 | case Duration_1_8 : printmsg("8"); break; | ||
5719 | case Duration_1_16: printmsg("16");break; | ||
5720 | case Duration_1_32: printmsg("32");break; | ||
5721 | } | ||
5722 | if (Note->DurationSpec == DottedNote) printmsg("."); | ||
5723 | switch (Note->Note) { | ||
5724 | case Note_C : printmsg("c");break; | ||
5725 | case Note_Cis : printmsg("#c");break; | ||
5726 | case Note_D :printmsg("d");break; | ||
5727 | case Note_Dis : printmsg("#d");break; | ||
5728 | case Note_E : printmsg("e");break; | ||
5729 | case Note_F : printmsg("f");break; | ||
5730 | case Note_Fis : printmsg("#f");break; | ||
5731 | case Note_G : printmsg("g");break; | ||
5732 | case Note_Gis : printmsg("#g");break; | ||
5733 | case Note_A : printmsg("a");break; | ||
5734 | case Note_Ais : printmsg("#a");break; | ||
5735 | case Note_H : printmsg("h");break; | ||
5736 | case Note_Pause : printmsg("-");break; | ||
5737 | } | ||
5738 | if (Note->Note != Note_Pause) printmsg("%i",Note->Scale - 4); | ||
5739 | printmsg(" "); | ||
5740 | } | ||
5741 | } | ||
5742 | } | ||
5743 | |||
5744 | printmsg("\n\nTo enter it please press: "); | ||
5745 | started = false; | ||
5746 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | ||
5747 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { | ||
5748 | Note = &ringtone.NoteTone.Commands[i].Note; | ||
5749 | if (!started) { | ||
5750 | if (Note->Note != Note_Pause) started = true; | ||
5751 | } | ||
5752 | if (started) { | ||
5753 | switch (Note->Note) { | ||
5754 | case Note_C : case Note_Cis:printmsg("1");break; | ||
5755 | case Note_D : case Note_Dis:printmsg("2");break; | ||
5756 | case Note_E : printmsg("3");break; | ||
5757 | case Note_F : case Note_Fis:printmsg("4");break; | ||
5758 | case Note_G : case Note_Gis:printmsg("5");break; | ||
5759 | case Note_A : case Note_Ais:printmsg("6");break; | ||
5760 | case Note_H : printmsg("7");break; | ||
5761 | default : printmsg("0");break; | ||
5762 | } | ||
5763 | if (Note->DurationSpec == DottedNote) printmsg("(longer)"); | ||
5764 | switch (Note->Note) { | ||
5765 | case Note_Cis: case Note_Dis: | ||
5766 | case Note_Fis: case Note_Gis: | ||
5767 | case Note_Ais: | ||
5768 | printmsg("#"); | ||
5769 | break; | ||
5770 | default : | ||
5771 | break; | ||
5772 | } | ||
5773 | if (Note->Note != Note_Pause) { | ||
5774 | if ((unsigned int)Note->Scale != DefNoteScale) { | ||
5775 | while (DefNoteScale != (unsigned int)Note->Scale) { | ||
5776 | printmsg("*"); | ||
5777 | DefNoteScale++; | ||
5778 | if (DefNoteScale==Scale_7040) DefNoteScale = Scale_880; | ||
5779 | } | ||
5780 | } | ||
5781 | } | ||
5782 | Duration = 0; | ||
5783 | switch (Note->Duration) { | ||
5784 | case Duration_Full : Duration = 128;break; | ||
5785 | case Duration_1_2 : Duration = 64;break; | ||
5786 | case Duration_1_4 : Duration = 32;break; | ||
5787 | case Duration_1_8 : Duration = 16;break; | ||
5788 | case Duration_1_16 : Duration = 8;break; | ||
5789 | case Duration_1_32 : Duration = 4;break; | ||
5790 | default : dbgprintf("error\n");break; | ||
5791 | } | ||
5792 | if (Duration > DefNoteDuration) { | ||
5793 | while (DefNoteDuration != Duration) { | ||
5794 | printmsg("9"); | ||
5795 | DefNoteDuration = DefNoteDuration * 2; | ||
5796 | } | ||
5797 | } | ||
5798 | if (Duration < DefNoteDuration) { | ||
5799 | while (DefNoteDuration != Duration) { | ||
5800 | printmsg("8"); | ||
5801 | DefNoteDuration = DefNoteDuration / 2; | ||
5802 | } | ||
5803 | } | ||
5804 | printmsg(" "); | ||
5805 | } | ||
5806 | } | ||
5807 | } | ||
5808 | |||
5809 | printf("\n"); | ||
5810 | } | ||
5811 | //#if 0 | ||
5812 | static void CopyRingtone(int argc, char *argv[]) | ||
5813 | { | ||
5814 | GSM_Ringtone ringtone, ringtone2; | ||
5815 | GSM_RingtoneFormatFormat; | ||
5816 | |||
5817 | ringtone.Format= 0; | ||
5818 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | ||
5819 | Print_Error(error); | ||
5820 | |||
5821 | Format = ringtone.Format; | ||
5822 | if (argc == 5) { | ||
5823 | if (mystrncasecmp(argv[4],"RTTL",0)) { Format = RING_NOTETONE; | ||
5824 | } else if (mystrncasecmp(argv[4],"BINARY",0)) {Format = RING_NOKIABINARY; | ||
5825 | } else { | ||
5826 | printmsg("What format of output ringtone file (\"%s\") ?\n",argv[4]); | ||
5827 | exit(-1); | ||
5828 | } | ||
5829 | } | ||
5830 | |||
5831 | error=GSM_RingtoneConvert(&ringtone2,&ringtone,Format); | ||
5832 | Print_Error(error); | ||
5833 | |||
5834 | error=GSM_SaveRingtoneFile(argv[3],&ringtone2); | ||
5835 | Print_Error(error); | ||
5836 | } | ||
5837 | |||
5838 | static void PressKeySequence(int argc, char *argv[]) | ||
5839 | { | ||
5840 | int i,Length; | ||
5841 | GSM_KeyCodeKeyCode[500]; | ||
5842 | |||
5843 | error = MakeKeySequence(argv[2], KeyCode, &Length); | ||
5844 | if (error == ERR_NOTSUPPORTED) { | ||
5845 | printmsg("Unknown key/function name: \"%c\"\n",argv[2][Length]); | ||
5846 | exit(-1); | ||
5847 | } | ||
5848 | |||
5849 | GSM_Init(true); | ||
5850 | |||
5851 | for (i=0;i<Length;i++) { | ||
5852 | error=Phone->PressKey(&s, KeyCode[i], true); | ||
5853 | Print_Error(error); | ||
5854 | error=Phone->PressKey(&s, KeyCode[i], false); | ||
5855 | Print_Error(error); | ||
5856 | } | ||
5857 | |||
5858 | GSM_Terminate(); | ||
5859 | } | ||
5860 | |||
5861 | static void GetAllCategories(int argc, char *argv[]) | ||
5862 | { | ||
5863 | GSM_Category Category; | ||
5864 | GSM_CategoryStatusStatus; | ||
5865 | int j, count; | ||
5866 | |||
5867 | if (mystrncasecmp(argv[2],"TODO",0)) { | ||
5868 | Category.Type = Category_ToDo; | ||
5869 | Status.Type = Category_ToDo; | ||
5870 | } else if (mystrncasecmp(argv[2],"PHONEBOOK",0)) { | ||
5871 | Category.Type = Category_Phonebook; | ||
5872 | Status.Type = Category_Phonebook; | ||
5873 | } else { | ||
5874 | printmsg("What type of categories do you want to get (\"%s\") ?\n",argv[2]); | ||
5875 | exit(-1); | ||
5876 | } | ||
5877 | |||
5878 | GSM_Init(true); | ||
5879 | |||
5880 | error=Phone->GetCategoryStatus(&s, &Status); | ||
5881 | Print_Error(error); | ||
5882 | |||
5883 | for (count=0,j=1;count<Status.Used;j++) | ||
5884 | { | ||
5885 | Category.Location=j; | ||
5886 | error=Phone->GetCategory(&s, &Category); | ||
5887 | |||
5888 | if (error != ERR_EMPTY) { | ||
5889 | printmsg("Location: %i\n",j); | ||
5890 | |||
5891 | Print_Error(error); | ||
5892 | |||
5893 | printmsg("Name : \"%s\"\n\n",DecodeUnicodeConsole(Category.Name)); | ||
5894 | count++; | ||
5895 | } | ||
5896 | } | ||
5897 | |||
5898 | GSM_Terminate(); | ||
5899 | } | ||
5900 | |||
5901 | static void GetCategory(int argc, char *argv[]) | ||
5902 | { | ||
5903 | GSM_CategoryCategory; | ||
5904 | int start,stop,j; | ||
5905 | |||
5906 | if (mystrncasecmp(argv[2],"TODO",0)) { | ||
5907 | Category.Type = Category_ToDo; | ||
5908 | } else if (mystrncasecmp(argv[2],"PHONEBOOK",0)) { | ||
5909 | Category.Type = Category_Phonebook; | ||
5910 | } else { | ||
5911 | printmsg("What type of categories do you want to get (\"%s\") ?\n",argv[2]); | ||
5912 | exit(-1); | ||
5913 | } | ||
5914 | |||
5915 | GetStartStop(&start, &stop, 2, argc - 1, argv + 1); | ||
5916 | |||
5917 | GSM_Init(true); | ||
5918 | |||
5919 | for (j=start;j<=stop;j++) | ||
5920 | { | ||
5921 | printmsg("Location: %i\n",j); | ||
5922 | |||
5923 | Category.Location=j; | ||
5924 | |||
5925 | error=Phone->GetCategory(&s, &Category); | ||
5926 | if (error != ERR_EMPTY) Print_Error(error); | ||
5927 | |||
5928 | if (error == ERR_EMPTY) { | ||
5929 | printmsg("Entry is empty\n\n"); | ||
5930 | } else { | ||
5931 | printmsg("Name : \"%s\"\n\n",DecodeUnicodeConsole(Category.Name)); | ||
5932 | } | ||
5933 | } | ||
5934 | |||
5935 | GSM_Terminate(); | ||
5936 | } | ||
5937 | |||
5938 | static void DeleteToDo(int argc, char *argv[]) | ||
5939 | { | ||
5940 | GSM_ToDoEntryToDo; | ||
5941 | int i; | ||
5942 | int start,stop; | ||
5943 | |||
5944 | GetStartStop(&start, &stop, 2, argc, argv); | ||
5945 | |||
5946 | GSM_Init(true); | ||
5947 | |||
5948 | for (i=start;i<=stop;i++) { | ||
5949 | ToDo.Location=i; | ||
5950 | printmsg("Location : %i\n",i); | ||
5951 | error=Phone->DeleteToDo(&s,&ToDo); | ||
5952 | if (error != ERR_EMPTY) Print_Error(error); | ||
5953 | |||
5954 | if (error == ERR_EMPTY) { | ||
5955 | printmsg("Entry was empty\n"); | ||
5956 | } else { | ||
5957 | printmsg("Entry was deleted\n"); | ||
5958 | } | ||
5959 | printf("\n"); | ||
5960 | } | ||
5961 | |||
5962 | GSM_Terminate(); | ||
5963 | } | ||
5964 | |||
5965 | static void PrintToDo(GSM_ToDoEntry *ToDo) | ||
5966 | { | ||
5967 | int j; | ||
5968 | GSM_MemoryEntry entry; | ||
5969 | unsigned char *name; | ||
5970 | GSM_Category Category; | ||
5971 | |||
5972 | printmsg("Location : %i\n",ToDo->Location); | ||
5973 | printmsg("Priority : "); | ||
5974 | switch (ToDo->Priority) { | ||
5975 | case GSM_Priority_Low : printmsg("Low\n"); break; | ||
5976 | case GSM_Priority_Medium : printmsg("Medium\n"); break; | ||
5977 | case GSM_Priority_High : printmsg("High\n"); break; | ||
5978 | default : printmsg("Unknown\n");break; | ||
5979 | } | ||
5980 | for (j=0;j<ToDo->EntriesNum;j++) { | ||
5981 | switch (ToDo->Entries[j].EntryType) { | ||
5982 | case TODO_END_DATETIME: | ||
5983 | printmsg("DueTime : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); | ||
5984 | break; | ||
5985 | case TODO_COMPLETED: | ||
5986 | printmsg("Completed : %s\n",ToDo->Entries[j].Number == 1 ? "Yes" : "No"); | ||
5987 | break; | ||
5988 | case TODO_ALARM_DATETIME: | ||
5989 | printmsg("Alarm : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); | ||
5990 | break; | ||
5991 | case TODO_SILENT_ALARM_DATETIME: | ||
5992 | printmsg("Silent alarm : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); | ||
5993 | break; | ||
5994 | case TODO_TEXT: | ||
5995 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); | ||
5996 | break; | ||
5997 | case TODO_PRIVATE: | ||
5998 | printmsg("Private : %s\n",ToDo->Entries[j].Number == 1 ? "Yes" : "No"); | ||
5999 | break; | ||
6000 | case TODO_CATEGORY: | ||
6001 | Category.Location = ToDo->Entries[j].Number; | ||
6002 | Category.Type = Category_ToDo; | ||
6003 | error=Phone->GetCategory(&s, &Category); | ||
6004 | if (error == ERR_NONE) { | ||
6005 | printmsg("Category : \"%s\" (%i)\n", DecodeUnicodeConsole(Category.Name), ToDo->Entries[j].Number); | ||
6006 | } else { | ||
6007 | printmsg("Category : %i\n", ToDo->Entries[j].Number); | ||
6008 | } | ||
6009 | break; | ||
6010 | case TODO_CONTACTID: | ||
6011 | entry.Location = ToDo->Entries[j].Number; | ||
6012 | entry.MemoryType = MEM_ME; | ||
6013 | error=Phone->GetMemory(&s, &entry); | ||
6014 | if (error == ERR_NONE) { | ||
6015 | name = GSM_PhonebookGetEntryName(&entry); | ||
6016 | if (name != NULL) { | ||
6017 | printmsg("Contact ID : \"%s\" (%d)\n", DecodeUnicodeConsole(name), ToDo->Entries[j].Number); | ||
6018 | } else { | ||
6019 | printmsg("Contact ID : %d\n",ToDo->Entries[j].Number); | ||
6020 | } | ||
6021 | } else { | ||
6022 | printmsg("Contact : %d\n",ToDo->Entries[j].Number); | ||
6023 | } | ||
6024 | break; | ||
6025 | case TODO_PHONE: | ||
6026 | printmsg("Phone : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); | ||
6027 | break; | ||
6028 | } | ||
6029 | } | ||
6030 | printf("\n"); | ||
6031 | } | ||
6032 | |||
6033 | static void ListToDoCategoryEntries(int Category) | ||
6034 | { | ||
6035 | GSM_ToDoEntry Entry; | ||
6036 | bool start = true; | ||
6037 | int j; | ||
6038 | |||
6039 | while (!gshutdown) { | ||
6040 | error = Phone->GetNextToDo(&s, &Entry, start); | ||
6041 | if (error == ERR_EMPTY) break; | ||
6042 | Print_Error(error); | ||
6043 | for (j=0;j<Entry.EntriesNum;j++) { | ||
6044 | if (Entry.Entries[j].EntryType == TODO_CATEGORY && Entry.Entries[j].Number == (unsigned int)Category) | ||
6045 | PrintToDo(&Entry); | ||
6046 | } | ||
6047 | start = false; | ||
6048 | } | ||
6049 | } | ||
6050 | |||
6051 | static void ListToDoCategory(int argc, char *argv[]) | ||
6052 | { | ||
6053 | GSM_Category Category; | ||
6054 | GSM_CategoryStatusStatus; | ||
6055 | int j, count; | ||
6056 | |||
6057 | unsigned char Text[(GSM_MAX_CATEGORY_NAME_LENGTH+1)*2]; | ||
6058 | int Length; | ||
6059 | bool Number = true;; | ||
6060 | |||
6061 | GSM_Init(true); | ||
6062 | |||
6063 | signal(SIGINT, interrupt); | ||
6064 | printmsgerr("Press Ctrl+C to break...\n"); | ||
6065 | |||
6066 | Length = strlen(argv[2]); | ||
6067 | for (j = 0; j < Length; j++) { | ||
6068 | if (!isdigit(argv[2][j])) { | ||
6069 | Number = false; | ||
6070 | break; | ||
6071 | } | ||
6072 | } | ||
6073 | |||
6074 | if (Number) { | ||
6075 | j = atoi(argv[2]); | ||
6076 | if (j > 0) { | ||
6077 | ListToDoCategoryEntries(j); | ||
6078 | } | ||
6079 | } else { | ||
6080 | if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) { | ||
6081 | printmsg("Search text too long, truncating to %d chars!\n", GSM_MAX_CATEGORY_NAME_LENGTH); | ||
6082 | Length = GSM_MAX_CATEGORY_NAME_LENGTH; | ||
6083 | } | ||
6084 | EncodeUnicode(Text, argv[2], Length); | ||
6085 | |||
6086 | Category.Type = Category_ToDo; | ||
6087 | Status.Type = Category_ToDo; | ||
6088 | |||
6089 | if (Phone->GetCategoryStatus(&s, &Status) == ERR_NONE) { | ||
6090 | for (count=0,j=1;count<Status.Used;j++) { | ||
6091 | Category.Location=j; | ||
6092 | error=Phone->GetCategory(&s, &Category); | ||
6093 | |||
6094 | if (error != ERR_EMPTY) { | ||
6095 | count++; | ||
6096 | if (mystrstr(Category.Name, Text) != NULL) { | ||
6097 | ListToDoCategoryEntries(j); | ||
6098 | } | ||
6099 | } | ||
6100 | } | ||
6101 | } | ||
6102 | } | ||
6103 | GSM_Terminate(); | ||
6104 | } | ||
6105 | |||
6106 | |||
6107 | static void GetToDo(int argc, char *argv[]) | ||
6108 | { | ||
6109 | GSM_ToDoEntryToDo; | ||
6110 | int i; | ||
6111 | int start,stop; | ||
6112 | |||
6113 | GetStartStop(&start, &stop, 2, argc, argv); | ||
6114 | |||
6115 | GSM_Init(true); | ||
6116 | |||
6117 | for (i=start;i<=stop;i++) { | ||
6118 | ToDo.Location=i; | ||
6119 | error = Phone->GetToDo(&s,&ToDo); | ||
6120 | if (error == ERR_EMPTY) continue; | ||
6121 | Print_Error(error); | ||
6122 | PrintToDo(&ToDo); | ||
6123 | } | ||
6124 | |||
6125 | GSM_Terminate(); | ||
6126 | } | ||
6127 | |||
6128 | static void GetAllToDo(int argc, char *argv[]) | ||
6129 | { | ||
6130 | GSM_ToDoEntry ToDo; | ||
6131 | bool start = true; | ||
6132 | |||
6133 | signal(SIGINT, interrupt); | ||
6134 | printmsgerr("Press Ctrl+C to break...\n"); | ||
6135 | |||
6136 | GSM_Init(true); | ||
6137 | |||
6138 | while (!gshutdown) { | ||
6139 | error = Phone->GetNextToDo(&s, &ToDo, start); | ||
6140 | if (error == ERR_EMPTY) break; | ||
6141 | Print_Error(error); | ||
6142 | PrintToDo(&ToDo); | ||
6143 | start = false; | ||
6144 | } | ||
6145 | |||
6146 | GSM_Terminate(); | ||
6147 | } | ||
6148 | |||
6149 | static void GetNote(int argc, char *argv[]) | ||
6150 | { | ||
6151 | GSM_NoteEntry Note; | ||
6152 | int start,stop; | ||
6153 | bool refresh=true; | ||
6154 | |||
6155 | GetStartStop(&start, &stop, 2, argc, argv); | ||
6156 | |||
6157 | GSM_Init(true); | ||
6158 | |||
6159 | for (i=start;i<=stop;i++) { | ||
6160 | Note.Location=i; | ||
6161 | printmsg("Location : %i\n",i); | ||
6162 | error=Phone->GetNote(&s,&Note,refresh); | ||
6163 | if (error != ERR_EMPTY) Print_Error(error); | ||
6164 | |||
6165 | if (error == ERR_EMPTY) { | ||
6166 | printmsg("Entry is empty\n\n"); | ||
6167 | } else { | ||
6168 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(Note.Text)); | ||
6169 | printf("\n"); | ||
6170 | refresh=false; | ||
6171 | } | ||
6172 | } | ||
6173 | |||
6174 | GSM_Terminate(); | ||
6175 | } | ||
6176 | |||
6177 | static void GetSecurityStatus(int argc, char *argv[]) | ||
6178 | { | ||
6179 | GSM_Init(true); | ||
6180 | |||
6181 | PrintSecurityStatus(); | ||
6182 | |||
6183 | GSM_Terminate(); | ||
6184 | } | ||
6185 | |||
6186 | static void EnterSecurityCode(int argc, char *argv[]) | ||
6187 | { | ||
6188 | GSM_SecurityCode Code; | ||
6189 | |||
6190 | if (mystrncasecmp(argv[2],"PIN",0)) { Code.Type = SEC_Pin; | ||
6191 | } else if (mystrncasecmp(argv[2],"PUK",0)) {Code.Type = SEC_Puk; | ||
6192 | } else if (mystrncasecmp(argv[2],"PIN2",0)) {Code.Type = SEC_Pin2; | ||
6193 | } else if (mystrncasecmp(argv[2],"PUK2",0)) {Code.Type = SEC_Puk2; | ||
6194 | } else { | ||
6195 | printmsg("What security code (\"%s\") ?\n",argv[2]); | ||
6196 | exit(-1); | ||
6197 | } | ||
6198 | |||
6199 | strcpy(Code.Code,argv[3]); | ||
6200 | |||
6201 | GSM_Init(true); | ||
6202 | |||
6203 | error=Phone->EnterSecurityCode(&s,Code); | ||
6204 | Print_Error(error); | ||
6205 | |||
6206 | GSM_Terminate(); | ||
6207 | } | ||
6208 | |||
6209 | static void GetProfile(int argc, char *argv[]) | ||
6210 | { | ||
6211 | GSM_Profile Profile; | ||
6212 | int start,stop,j,k; | ||
6213 | GSM_Bitmap caller[5]; | ||
6214 | bool callerinit[5],special; | ||
6215 | GSM_AllRingtonesInfo Info; | ||
6216 | |||
6217 | GetStartStop(&start, &stop, 2, argc, argv); | ||
6218 | |||
6219 | for (i=0;i<5;i++) callerinit[i] = false; | ||
6220 | |||
6221 | GSM_Init(true); | ||
6222 | |||
6223 | error=Phone->GetRingtonesInfo(&s,&Info); | ||
6224 | if (error != ERR_NONE) Info.Number = 0; | ||
6225 | |||
6226 | for (i=start;i<=stop;i++) { | ||
6227 | Profile.Location=i; | ||
6228 | error=Phone->GetProfile(&s,&Profile); | ||
6229 | Print_Error(error); | ||
6230 | |||
6231 | printmsg("%i. \"%s\"",i,DecodeUnicodeConsole(Profile.Name)); | ||
6232 | if (Profile.Active) printmsg(" (active)"); | ||
6233 | if (Profile.DefaultName) printmsg(" (default name)"); | ||
6234 | if (Profile.HeadSetProfile) printmsg(" (HeadSet profile)"); | ||
6235 | if (Profile.CarKitProfile) printmsg(" (CarKit profile)"); | ||
6236 | printf("\n"); | ||
6237 | for (j=0;j<Profile.FeaturesNumber;j++) { | ||
6238 | special = false; | ||
6239 | switch (Profile.FeatureID[j]) { | ||
6240 | case Profile_MessageToneID: | ||
6241 | case Profile_RingtoneID: | ||
6242 | special = true; | ||
6243 | if (Profile.FeatureID[j] == Profile_RingtoneID) { | ||
6244 | printmsg("Ringtone ID : "); | ||
6245 | } else { | ||
6246 | printmsg("Message alert tone ID : "); | ||
6247 | } | ||
6248 | if (UnicodeLength(GSM_GetRingtoneName(&Info,Profile.FeatureValue[j]))!=0) { | ||
6249 | printmsg("\"%s\"\n",DecodeUnicodeConsole(GSM_GetRingtoneName(&Info,Profile.FeatureValue[j]))); | ||
6250 | } else { | ||
6251 | printmsg("%i\n",Profile.FeatureValue[j]); | ||
6252 | } | ||
6253 | break; | ||
6254 | case Profile_CallerGroups: | ||
6255 | special = true; | ||
6256 | printmsg("Call alert for :"); | ||
6257 | for (k=0;k<5;k++) { | ||
6258 | if (Profile.CallerGroups[k]) { | ||
6259 | if (!callerinit[k]) { | ||
6260 | caller[k].Type = GSM_CallerGroupLogo; | ||
6261 | caller[k].Location = k + 1; | ||
6262 | error=Phone->GetBitmap(&s,&caller[k]); | ||
6263 | if (error == ERR_SECURITYERROR) { | ||
6264 | NOKIA_GetDefaultCallerGroupName(&s,&caller[k]); | ||
6265 | } else { | ||
6266 | Print_Error(error); | ||
6267 | } | ||
6268 | callerinit[k]= true; | ||
6269 | } | ||
6270 | printmsg(" \"%s\"",DecodeUnicodeConsole(caller[k].Text)); | ||
6271 | } | ||
6272 | } | ||
6273 | printf("\n"); | ||
6274 | break; | ||
6275 | case Profile_ScreenSaverNumber: | ||
6276 | special = true; | ||
6277 | printmsg("Screen saver number : "); | ||
6278 | printmsg("%i\n",Profile.FeatureValue[j]); | ||
6279 | break; | ||
6280 | case Profile_CallAlert : printmsg("Incoming call alert : "); break; | ||
6281 | case Profile_RingtoneVolume : printmsg("Ringtone volume : "); break; | ||
6282 | case Profile_Vibration : printmsg("Vibrating alert : "); break; | ||
6283 | case Profile_MessageTone: printmsg("Message alert tone : "); break; | ||
6284 | case Profile_KeypadTone : printmsg("Keypad tones : "); break; | ||
6285 | case Profile_WarningTone: printmsg("Warning (games) tones : "); break; | ||
6286 | case Profile_ScreenSaver: printmsg("Screen saver : "); break; | ||
6287 | case Profile_ScreenSaverTime: printmsg("Screen saver timeout : "); break; | ||
6288 | case Profile_AutoAnswer : printmsg("Automatic answer : "); break; | ||
6289 | case Profile_Lights : printmsg("Lights : "); break; | ||
6290 | default: | ||
6291 | printmsg("Unknown\n"); | ||
6292 | special = true; | ||
6293 | } | ||
6294 | if (!special) { | ||
6295 | switch (Profile.FeatureValue[j]) { | ||
6296 | case PROFILE_VOLUME_LEVEL1 : | ||
6297 | case PROFILE_KEYPAD_LEVEL1 : printmsg("Level 1\n"); break; | ||
6298 | case PROFILE_VOLUME_LEVEL2 : | ||
6299 | case PROFILE_KEYPAD_LEVEL2 : printmsg("Level 2\n"); break; | ||
6300 | case PROFILE_VOLUME_LEVEL3 : | ||
6301 | case PROFILE_KEYPAD_LEVEL3 : printmsg("Level 3\n"); break; | ||
6302 | case PROFILE_VOLUME_LEVEL4 : printmsg("Level 4\n"); break; | ||
6303 | case PROFILE_VOLUME_LEVEL5 : printmsg("Level 5\n"); break; | ||
6304 | case PROFILE_MESSAGE_NOTONE : | ||
6305 | case PROFILE_AUTOANSWER_OFF : | ||
6306 | case PROFILE_LIGHTS_OFF : | ||
6307 | case PROFILE_SAVER_OFF : | ||
6308 | case PROFILE_WARNING_OFF : | ||
6309 | case PROFILE_CALLALERT_OFF : | ||
6310 | case PROFILE_VIBRATION_OFF : | ||
6311 | case PROFILE_KEYPAD_OFF : printmsg("Off\n"); break; | ||
6312 | case PROFILE_CALLALERT_RINGING : printmsg("Ringing\n"); break; | ||
6313 | case PROFILE_CALLALERT_BEEPONCE : | ||
6314 | case PROFILE_MESSAGE_BEEPONCE : printmsg("Beep once\n"); break; | ||
6315 | case PROFILE_CALLALERT_RINGONCE : printmsg("Ring once\n");break; | ||
6316 | case PROFILE_CALLALERT_ASCENDING : printmsg("Ascending\n"); break; | ||
6317 | case PROFILE_CALLALERT_CALLERGROUPS : printmsg("Caller groups\n");break; | ||
6318 | case PROFILE_MESSAGE_STANDARD : printmsg("Standard\n"); break; | ||
6319 | case PROFILE_MESSAGE_SPECIAL : printmsg("Special\n"); break; | ||
6320 | case PROFILE_MESSAGE_ASCENDING : printmsg("Ascending\n"); break; | ||
6321 | case PROFILE_MESSAGE_PERSONAL : printmsg("Personal\n"); break; | ||
6322 | case PROFILE_AUTOANSWER_ON : | ||
6323 | case PROFILE_WARNING_ON : | ||
6324 | case PROFILE_SAVER_ON : | ||
6325 | case PROFILE_VIBRATION_ON : printmsg("On\n"); break; | ||
6326 | case PROFILE_VIBRATION_FIRST : printmsg("Vibrate first\n");break; | ||
6327 | case PROFILE_LIGHTS_AUTO : printmsg("Auto\n"); break; | ||
6328 | case PROFILE_SAVER_TIMEOUT_5SEC : printmsg("5 seconds\n"); break; | ||
6329 | case PROFILE_SAVER_TIMEOUT_20SEC : printmsg("20 seconds\n"); break; | ||
6330 | case PROFILE_SAVER_TIMEOUT_1MIN : printmsg("1 minute\n"); break; | ||
6331 | case PROFILE_SAVER_TIMEOUT_2MIN : printmsg("2 minutes\n");break; | ||
6332 | case PROFILE_SAVER_TIMEOUT_5MIN : printmsg("5 minutes\n");break; | ||
6333 | case PROFILE_SAVER_TIMEOUT_10MIN : printmsg("10 minutes\n");break; | ||
6334 | default : printmsg("UNKNOWN\n"); | ||
6335 | } | ||
6336 | } | ||
6337 | } | ||
6338 | printf("\n"); | ||
6339 | } | ||
6340 | |||
6341 | GSM_Terminate(); | ||
6342 | } | ||
6343 | |||
6344 | static void GetSpeedDial(int argc, char *argv[]) | ||
6345 | { | ||
6346 | GSM_SpeedDial SpeedDial; | ||
6347 | GSM_MemoryEntry Phonebook; | ||
6348 | int start,stop,Name,Number,Group; | ||
6349 | |||
6350 | GetStartStop(&start, &stop, 2, argc, argv); | ||
6351 | |||
6352 | GSM_Init(true); | ||
6353 | |||
6354 | for (i=start;i<=stop;i++) { | ||
6355 | SpeedDial.Location=i; | ||
6356 | error=Phone->GetSpeedDial(&s,&SpeedDial); | ||
6357 | printmsg("%i.",i); | ||
6358 | switch (error) { | ||
6359 | case ERR_EMPTY: | ||
6360 | printmsg(" speed dial not assigned\n"); | ||
6361 | break; | ||
6362 | default: | ||
6363 | Print_Error(error); | ||
6364 | |||
6365 | Phonebook.Location= SpeedDial.MemoryLocation; | ||
6366 | Phonebook.MemoryType = SpeedDial.MemoryType; | ||
6367 | error=Phone->GetMemory(&s,&Phonebook); | ||
6368 | |||
6369 | GSM_PhonebookFindDefaultNameNumberGroup(&Phonebook, &Name, &Number, &Group); | ||
6370 | |||
6371 | if (Name != -1) printmsg(" Name \"%s\",",DecodeUnicodeConsole(Phonebook.Entries[Name].Text)); | ||
6372 | printmsg(" Number \"%s\"",DecodeUnicodeConsole(Phonebook.Entries[SpeedDial.MemoryNumberID-1].Text)); | ||
6373 | } | ||
6374 | printf("\n"); | ||
6375 | } | ||
6376 | |||
6377 | GSM_Terminate(); | ||
6378 | } | ||
6379 | |||
6380 | static void ResetPhoneSettings(int argc, char *argv[]) | ||
6381 | { | ||
6382 | GSM_ResetSettingsType Type; | ||
6383 | |||
6384 | if (mystrncasecmp(argv[2],"PHONE",0)) { Type = GSM_RESET_PHONESETTINGS; | ||
6385 | } else if (mystrncasecmp(argv[2],"UIF",0)) { Type = GSM_RESET_USERINTERFACE; | ||
6386 | } else if (mystrncasecmp(argv[2],"ALL",0)) { Type = GSM_RESET_USERINTERFACE_PHONESETTINGS; | ||
6387 | } else if (mystrncasecmp(argv[2],"DEV",0)) { Type = GSM_RESET_DEVICE; | ||
6388 | } else if (mystrncasecmp(argv[2],"FACTORY",0)) { Type = GSM_RESET_FULLFACTORY; | ||
6389 | } else { | ||
6390 | printmsg("What type of reset phone settings (\"%s\") ?\n",argv[2]); | ||
6391 | exit(-1); | ||
6392 | } | ||
6393 | |||
6394 | GSM_Init(true); | ||
6395 | |||
6396 | error=Phone->ResetPhoneSettings(&s,Type); | ||
6397 | Print_Error(error); | ||
6398 | |||
6399 | GSM_Terminate(); | ||
6400 | } | ||
6401 | |||
6402 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | ||
6403 | static void NokiaSecurityCode(int argc, char *argv[]) | ||
6404 | { | ||
6405 | GSM_Init(true); | ||
6406 | |||
6407 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
6408 | DCT3GetSecurityCode(argc,argv); | ||
6409 | #endif | ||
6410 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
6411 | //DCT4ResetSecurityCode(argc, argv); | ||
6412 | DCT4GetSecurityCode(argc,argv); | ||
6413 | #endif | ||
6414 | |||
6415 | GSM_Terminate(); | ||
6416 | } | ||
6417 | |||
6418 | static void NokiaSetPhoneMenus(int argc, char *argv[]) | ||
6419 | { | ||
6420 | GSM_Init(true); | ||
6421 | |||
6422 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
6423 | DCT3SetPhoneMenus (argc, argv); | ||
6424 | #endif | ||
6425 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
6426 | DCT4SetPhoneMenus (argc, argv); | ||
6427 | #endif | ||
6428 | |||
6429 | GSM_Terminate(); | ||
6430 | } | ||
6431 | |||
6432 | static void NokiaSelfTests(int argc, char *argv[]) | ||
6433 | { | ||
6434 | GSM_Init(true); | ||
6435 | |||
6436 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
6437 | DCT3SelfTests(argc, argv); | ||
6438 | #endif | ||
6439 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
6440 | DCT4SelfTests(argc, argv); | ||
6441 | #endif | ||
6442 | |||
6443 | GSM_Terminate(); | ||
6444 | } | ||
6445 | #endif | ||
6446 | |||
6447 | static void DeleteAllSMS(int argc, char *argv[]) | ||
6448 | { | ||
6449 | GSM_MultiSMSMessage sms; | ||
6450 | GSM_SMSFolders folders; | ||
6451 | int foldernum; | ||
6452 | bool start = true; | ||
6453 | |||
6454 | GSM_Init(true); | ||
6455 | |||
6456 | error=Phone->GetSMSFolders(&s, &folders); | ||
6457 | Print_Error(error); | ||
6458 | |||
6459 | GetStartStop(&foldernum, NULL, 2, argc, argv); | ||
6460 | if (foldernum > folders.Number) { | ||
6461 | printmsg("Too high folder number (max. %i)\n",folders.Number); | ||
6462 | GSM_Terminate(); | ||
6463 | exit(-1); | ||
6464 | } | ||
6465 | |||
6466 | printmsg("Deleting SMS from \"%s\" folder: ",DecodeUnicodeConsole(folders.Folder[foldernum-1].Name)); | ||
6467 | |||
6468 | while (error == ERR_NONE) { | ||
6469 | sms.SMS[0].Folder=0x00; | ||
6470 | error=Phone->GetNextSMS(&s, &sms, start); | ||
6471 | switch (error) { | ||
6472 | case ERR_EMPTY: | ||
6473 | break; | ||
6474 | default: | ||
6475 | Print_Error(error); | ||
6476 | if (sms.SMS[0].Folder == foldernum) { | ||
6477 | sms.SMS[0].Folder=0x00; | ||
6478 | error=Phone->DeleteSMS(&s, &sms.SMS[0]); | ||
6479 | Print_Error(error); | ||
6480 | printmsg("*"); | ||
6481 | } | ||
6482 | } | ||
6483 | start=false; | ||
6484 | } | ||
6485 | |||
6486 | printf("\n"); | ||
6487 | |||
6488 | GSM_Terminate(); | ||
6489 | } | ||
6490 | |||
6491 | static void SendDTMF(int argc, char *argv[]) | ||
6492 | { | ||
6493 | GSM_Init(true); | ||
6494 | |||
6495 | error=Phone->SendDTMF(&s,argv[2]); | ||
6496 | Print_Error(error); | ||
6497 | |||
6498 | GSM_Terminate(); | ||
6499 | } | ||
6500 | |||
6501 | static void GetDisplayStatus(int argc, char *argv[]) | ||
6502 | { | ||
6503 | GSM_DisplayFeatures Features; | ||
6504 | int i; | ||
6505 | |||
6506 | GSM_Init(true); | ||
6507 | |||
6508 | error=Phone->GetDisplayStatus(&s,&Features); | ||
6509 | Print_Error(error); | ||
6510 | |||
6511 | printmsg("Current display features :\n"); | ||
6512 | |||
6513 | for (i=0;i<Features.Number;i++) { | ||
6514 | switch(Features.Feature[i]) { | ||
6515 | case GSM_CallActive : printmsg("Call active\n");break; | ||
6516 | case GSM_UnreadSMS : printmsg("Unread SMS\n");break; | ||
6517 | case GSM_VoiceCall : printmsg("Voice call\n");break; | ||
6518 | case GSM_FaxCall : printmsg("Fax call\n");break; | ||
6519 | case GSM_DataCall : printmsg("Data call\n");break; | ||
6520 | case GSM_KeypadLocked : printmsg("Keypad locked\n");break; | ||
6521 | case GSM_SMSMemoryFull: printmsg("SMS memory full\n"); | ||
6522 | } | ||
6523 | } | ||
6524 | |||
6525 | GSM_Terminate(); | ||
6526 | } | ||
6527 | |||
6528 | static void SetAutoNetworkLogin(int argc, char *argv[]) | ||
6529 | { | ||
6530 | GSM_Init(true); | ||
6531 | |||
6532 | error=Phone->SetAutoNetworkLogin(&s); | ||
6533 | Print_Error(error); | ||
6534 | |||
6535 | GSM_Terminate(); | ||
6536 | } | ||
6537 | |||
6538 | #ifdef DEBUG | ||
6539 | static void MakeConvertTable(int argc, char *argv[]) | ||
6540 | { | ||
6541 | unsigned char InputBuffer[10000], Buffer[10000]; | ||
6542 | FILE *file; | ||
6543 | int size,i,j=0; | ||
6544 | |||
6545 | file = fopen(argv[2], "rb"); | ||
6546 | if (file == NULL) Print_Error(ERR_CANTOPENFILE); | ||
6547 | size=fread(InputBuffer, 1, 10000-1, file); | ||
6548 | fclose(file); | ||
6549 | InputBuffer[size] = 0; | ||
6550 | InputBuffer[size+1] = 0; | ||
6551 | |||
6552 | ReadUnicodeFile(Buffer,InputBuffer); | ||
6553 | |||
6554 | for(i=0;i<((int)UnicodeLength(Buffer));i++) { | ||
6555 | j++; | ||
6556 | if (j==100) { | ||
6557 | printf("\"\\\n\""); | ||
6558 | j=0; | ||
6559 | } | ||
6560 | printf("\\x%02x\\x%02x",Buffer[i*2],Buffer[i*2+1]); | ||
6561 | } | ||
6562 | printf("\\x00\\x00"); | ||
6563 | } | ||
6564 | #endif | ||
6565 | |||
6566 | static void ListNetworks(int argc, char *argv[]) | ||
6567 | { | ||
6568 | extern unsigned char *GSM_Networks[]; | ||
6569 | int i=0; | ||
6570 | |||
6571 | printmsg("Network Name\n\n"); | ||
6572 | while (GSM_Networks[i*2]!=NULL) { | ||
6573 | printmsg("%s %s\n", GSM_Networks[i*2], GSM_Networks[i*2+1]); | ||
6574 | i++; | ||
6575 | } | ||
6576 | } | ||
6577 | |||
6578 | static void Version(int argc, char *argv[]) | ||
6579 | { | ||
6580 | // unsigned char buff[10]; | ||
6581 | // int len; | ||
6582 | |||
6583 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); | ||
6584 | |||
6585 | #ifdef DEBUG | ||
6586 | printf("GSM_SMSMessage - %i\n",sizeof(GSM_SMSMessage)); | ||
6587 | printf("GSM_SMSC - %i\n",sizeof(GSM_SMSC)); | ||
6588 | printf("GSM_SMS_State - %i\n",sizeof(GSM_SMS_State)); | ||
6589 | printf("GSM_UDHHeader - %i\n",sizeof(GSM_UDHHeader)); | ||
6590 | printf("bool - %i\n",sizeof(bool)); | ||
6591 | printf("GSM_DateTime - %i\n",sizeof(GSM_DateTime)); | ||
6592 | printf("int - %i\n",sizeof(int)); | ||
6593 | printf("GSM_NetworkInfo - %i\n",sizeof(GSM_NetworkInfo)); | ||
6594 | #endif | ||
6595 | |||
6596 | //len=DecodeBASE64("AXw", buff, 3); | ||
6597 | //DumpMessage(stdout, buff, len); | ||
6598 | } | ||
6599 | |||
6600 | static void GetFMStation(int argc, char *argv[]) | ||
6601 | { | ||
6602 | GSM_FMStation Station; | ||
6603 | int start,stop; | ||
6604 | |||
6605 | GetStartStop(&start, &stop, 2, argc, argv); | ||
6606 | |||
6607 | GSM_Init(true); | ||
6608 | |||
6609 | for (i=start;i<=stop;i++) { | ||
6610 | Station.Location=i; | ||
6611 | error=Phone->GetFMStation(&s,&Station); | ||
6612 | switch (error) { | ||
6613 | case ERR_EMPTY: | ||
6614 | printmsg("Entry number %i is empty\n",i); | ||
6615 | break; | ||
6616 | case ERR_NONE: | ||
6617 | printmsg("Entry number %i\nStation name : \"%s\"\nFrequency : %.1f MHz\n", | ||
6618 | i,DecodeUnicodeConsole(Station.StationName), | ||
6619 | Station.Frequency); | ||
6620 | break; | ||
6621 | default: | ||
6622 | Print_Error(error); | ||
6623 | } | ||
6624 | } | ||
6625 | GSM_Terminate(); | ||
6626 | } | ||
6627 | |||
6628 | static void GetFileSystemStatus(int argc, char *argv[]) | ||
6629 | { | ||
6630 | GSM_FileSystemStatusStatus; | ||
6631 | |||
6632 | GSM_Init(true); | ||
6633 | |||
6634 | error = Phone->GetFileSystemStatus(&s,&Status); | ||
6635 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) { | ||
6636 | Print_Error(error); | ||
6637 | printmsg("\nFree memory: %i, total memory: %i\n",Status.Free,Status.Free+Status.Used); | ||
6638 | } | ||
6639 | |||
6640 | GSM_Terminate(); | ||
6641 | } | ||
6642 | |||
6643 | static void GetFileSystem(int argc, char *argv[]) | ||
6644 | { | ||
6645 | bool Start = true; | ||
6646 | GSM_File Files; | ||
6647 | int j; | ||
6648 | GSM_FileSystemStatusStatus; | ||
6649 | char FolderName[256]; | ||
6650 | |||
6651 | GSM_Init(true); | ||
6652 | |||
6653 | while (1) { | ||
6654 | error = Phone->GetNextFileFolder(&s,&Files,Start); | ||
6655 | if (error == ERR_EMPTY) break; | ||
6656 | Print_Error(error); | ||
6657 | |||
6658 | if (argc <= 2 || !mystrncasecmp(argv[2],"-flatall",0)) { | ||
6659 | if (strlen(Files.ID_FullName) < 5 && strlen(Files.ID_FullName) != 0) { | ||
6660 | printf("%5s.",Files.ID_FullName); | ||
6661 | } | ||
6662 | if (Files.Protected) { | ||
6663 | printf("P"); | ||
6664 | } else { | ||
6665 | printf(" "); | ||
6666 | } | ||
6667 | if (Files.ReadOnly) { | ||
6668 | printf("R"); | ||
6669 | } else { | ||
6670 | printf(" "); | ||
6671 | } | ||
6672 | if (Files.Hidden) { | ||
6673 | printf("H"); | ||
6674 | } else { | ||
6675 | printf(" "); | ||
6676 | } | ||
6677 | if (Files.System) { | ||
6678 | printf("S"); | ||
6679 | } else { | ||
6680 | printf(" "); | ||
6681 | } | ||
6682 | if (argc > 2 && mystrncasecmp(argv[2],"-flat",0)) { | ||
6683 | if (!Files.Folder) { | ||
6684 | if (mystrncasecmp(argv[2],"-flatall",0)) { | ||
6685 | if (!Files.ModifiedEmpty) { | ||
6686 | printf(" %30s",OSDateTime(Files.Modified,false)); | ||
6687 | } else printf(" %30c",0x20); | ||
6688 | printf(" %9i",Files.Used); | ||
6689 | printf(" "); | ||
6690 | } else printf("|-- "); | ||
6691 | } else printf("Folder "); | ||
6692 | } else { | ||
6693 | if (Files.Level != 1) { | ||
6694 | for (j=0;j<Files.Level-2;j++) printf(" | "); | ||
6695 | printf(" |-- "); | ||
6696 | } | ||
6697 | if (Files.Folder) printf("Folder "); | ||
6698 | } | ||
6699 | printf("\"%s\"",DecodeUnicodeConsole(Files.Name)); | ||
6700 | printf("\n"); | ||
6701 | |||
6702 | Start = false; | ||
6703 | } else if (argc > 2 && mystrncasecmp(argv[2],"-flatall",0)) { | ||
6704 | /* format for a folder ID;Folder;FOLDER_NAME;[FOLDER_PARAMETERS] | ||
6705 | * format for a file ID;File;FOLDER_NAME;FILE_NAME;DATESTAMP;FILE_SIZE;[FILE_PARAMETERS] */ | ||
6706 | if (!Files.Folder) { | ||
6707 | printf("%s;File;",Files.ID_FullName); | ||
6708 | printf("\"%s\";",FolderName); | ||
6709 | printf("\"%s\";",DecodeUnicodeConsole(Files.Name)); | ||
6710 | if (!Files.ModifiedEmpty) { | ||
6711 | printf("\"%s\";",OSDateTime(Files.Modified,false)); | ||
6712 | } else printf("\"%c\";",0x20); | ||
6713 | printf("%i;",Files.Used); | ||
6714 | } else { | ||
6715 | printf("%s;Folder;",Files.ID_FullName); | ||
6716 | printf("\"%s\";",DecodeUnicodeConsole(Files.Name)); | ||
6717 | strcpy(FolderName,DecodeUnicodeConsole(Files.Name)); | ||
6718 | } | ||
6719 | |||
6720 | if (Files.Protected) printf("P"); | ||
6721 | if (Files.ReadOnly) printf("R"); | ||
6722 | if (Files.Hidden) printf("H"); | ||
6723 | if (Files.System) printf("S"); | ||
6724 | |||
6725 | printf("\n"); | ||
6726 | |||
6727 | Start = false; | ||
6728 | } | ||
6729 | } | ||
6730 | |||
6731 | error = Phone->GetFileSystemStatus(&s,&Status); | ||
6732 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) { | ||
6733 | Print_Error(error); | ||
6734 | printmsg("\nFree memory: %i, total memory: %i\n",Status.Free,Status.Free+Status.Used); | ||
6735 | } | ||
6736 | |||
6737 | GSM_Terminate(); | ||
6738 | } | ||
6739 | |||
6740 | static void GetOneFile(GSM_File *File, bool newtime, int i) | ||
6741 | { | ||
6742 | FILE *file; | ||
6743 | bool start; | ||
6744 | unsigned char buffer[5000]; | ||
6745 | struct utimbuf filedate; | ||
6746 | |||
6747 | if (File->Buffer != NULL) { | ||
6748 | free(File->Buffer); | ||
6749 | File->Buffer = NULL; | ||
6750 | } | ||
6751 | File->Used = 0; | ||
6752 | start = true; | ||
6753 | |||
6754 | error = ERR_NONE; | ||
6755 | while (error == ERR_NONE) { | ||
6756 | error = Phone->GetFilePart(&s,File); | ||
6757 | if (error == ERR_NONE || error == ERR_EMPTY || error == ERR_WRONGCRC) { | ||
6758 | if (start) { | ||
6759 | printmsg("Getting \"%s\": ", DecodeUnicodeConsole(File->Name)); | ||
6760 | start = false; | ||
6761 | } | ||
6762 | if (File->Folder) { | ||
6763 | free(File->Buffer); | ||
6764 | GSM_Terminate(); | ||
6765 | printmsg("it's folder. Please give only file names\n"); | ||
6766 | exit(-1); | ||
6767 | } | ||
6768 | printmsg("*"); | ||
6769 | if (error == ERR_EMPTY) break; | ||
6770 | if (error == ERR_WRONGCRC) { | ||
6771 | printmsg("WARNING: File checksum calculated by phone doesn't match with value calculated by Gammu. File damaged or error in Gammu\n"); | ||
6772 | break; | ||
6773 | } | ||
6774 | } | ||
6775 | Print_Error(error); | ||
6776 | } | ||
6777 | printf("\n"); | ||
6778 | if (File->Used != 0) { | ||
6779 | sprintf(buffer,"%s",DecodeUnicodeConsole(File->Name)); | ||
6780 | file = fopen(buffer,"wb"); | ||
6781 | if (file == NULL) { | ||
6782 | sprintf(buffer,"file%s",File->ID_FullName); | ||
6783 | file = fopen(buffer,"wb"); | ||
6784 | } | ||
6785 | if (file == NULL) { | ||
6786 | sprintf(buffer,"file%i",i); | ||
6787 | file = fopen(buffer,"wb"); | ||
6788 | } | ||
6789 | printmsg(" Saving to %s\n",buffer); | ||
6790 | if (!file) Print_Error(ERR_CANTOPENFILE); | ||
6791 | fwrite(File->Buffer,1,File->Used,file); | ||
6792 | fclose(file); | ||
6793 | if (!newtime && !File->ModifiedEmpty) { | ||
6794 | /* access time */ | ||
6795 | filedate.actime = Fill_Time_T(File->Modified, 8); | ||
6796 | /* modification time */ | ||
6797 | filedate.modtime = Fill_Time_T(File->Modified, 8); | ||
6798 | dbgprintf("Setting date of %s\n",buffer); | ||
6799 | utime(buffer,&filedate); | ||
6800 | } | ||
6801 | } | ||
6802 | } | ||
6803 | |||
6804 | static void GetFiles(int argc, char *argv[]) | ||
6805 | { | ||
6806 | GSM_File File; | ||
6807 | int i; | ||
6808 | bool newtime = false; | ||
6809 | |||
6810 | File.Buffer = NULL; | ||
6811 | |||
6812 | GSM_Init(true); | ||
6813 | |||
6814 | for (i=2;i<argc;i++) { | ||
6815 | if (mystrncasecmp(argv[i],"-newtime",0)) { | ||
6816 | newtime = true; | ||
6817 | continue; | ||
6818 | } | ||
6819 | |||
6820 | strcpy(File.ID_FullName,argv[i]); | ||
6821 | GetOneFile(&File, newtime, i); | ||
6822 | } | ||
6823 | |||
6824 | free(File.Buffer); | ||
6825 | GSM_Terminate(); | ||
6826 | } | ||
6827 | |||
6828 | static void GetFileFolder(int argc, char *argv[]) | ||
6829 | { | ||
6830 | bool Start = true; | ||
6831 | GSM_File File; | ||
6832 | int level=0,allnum=0,num=0,filelevel=0; | ||
6833 | bool newtime = false, found; | ||
6834 | |||
6835 | File.Buffer = NULL; | ||
6836 | |||
6837 | GSM_Init(true); | ||
6838 | |||
6839 | for (i=2;i<argc;i++) { | ||
6840 | if (mystrncasecmp(argv[i],"-newtime",0)) { | ||
6841 | newtime = true; | ||
6842 | continue; | ||
6843 | } | ||
6844 | allnum++; | ||
6845 | } | ||
6846 | |||
6847 | while (allnum != num) { | ||
6848 | error = Phone->GetNextFileFolder(&s,&File,Start); | ||
6849 | if (error == ERR_EMPTY) break; | ||
6850 | Print_Error(error); | ||
6851 | |||
6852 | if (level == 0) { | ||
6853 | /* We search for file or folder */ | ||
6854 | found = false; | ||
6855 | for (i=2;i<argc;i++) { | ||
6856 | if (mystrncasecmp(argv[i],"-newtime",0)) { | ||
6857 | continue; | ||
6858 | } | ||
6859 | if (!strcmp(File.ID_FullName,argv[i])) { | ||
6860 | found = true; | ||
6861 | if (File.Folder) { | ||
6862 | level = 1; | ||
6863 | filelevel = File.Level + 1; | ||
6864 | Start = false; | ||
6865 | } else { | ||
6866 | level = 2; | ||
6867 | } | ||
6868 | break; | ||
6869 | } | ||
6870 | } | ||
6871 | if (found && File.Folder) continue; | ||
6872 | } | ||
6873 | if (level == 1) { | ||
6874 | /* We have folder */ | ||
6875 | dbgprintf("%i %i\n",File.Level,filelevel); | ||
6876 | if (File.Level != filelevel) { | ||
6877 | level = 0; | ||
6878 | num++; | ||
6879 | } | ||
6880 | } | ||
6881 | |||
6882 | if (level != 0 && !File.Folder) GetOneFile(&File, newtime,num); | ||
6883 | |||
6884 | if (level == 2) { | ||
6885 | level = 0; | ||
6886 | num++; | ||
6887 | } | ||
6888 | |||
6889 | Start = false; | ||
6890 | } | ||
6891 | |||
6892 | free(File.Buffer); | ||
6893 | GSM_Terminate(); | ||
6894 | } | ||
6895 | |||
6896 | static void AddFile(int argc, char *argv[]) | ||
6897 | { | ||
6898 | GSM_File File; | ||
6899 | int Pos = 0,i,nextlong; | ||
6900 | |||
6901 | File.Buffer = NULL; | ||
6902 | strcpy(File.ID_FullName,argv[2]); | ||
6903 | error = GSM_ReadFile(argv[3], &File); | ||
6904 | Print_Error(error); | ||
6905 | EncodeUnicode(File.Name,argv[3],strlen(argv[3])); | ||
6906 | GSM_IdentifyFileFormat(&File); | ||
6907 | |||
6908 | File.Protected = false; | ||
6909 | File.ReadOnly= false; | ||
6910 | File.Hidden= false; | ||
6911 | File.System= false; | ||
6912 | |||
6913 | if (argc > 4) { | ||
6914 | nextlong = 0; | ||
6915 | for (i=4;i<argc;i++) { | ||
6916 | switch(nextlong) { | ||
6917 | case 0: | ||
6918 | if (mystrncasecmp(argv[i],"-type",0)) { | ||
6919 | nextlong = 1; | ||
6920 | continue; | ||
6921 | } | ||
6922 | if (mystrncasecmp(argv[i],"-protected",0)) { | ||
6923 | File.Protected = true; | ||
6924 | continue; | ||
6925 | } | ||
6926 | if (mystrncasecmp(argv[i],"-readonly",0)) { | ||
6927 | File.ReadOnly = true; | ||
6928 | continue; | ||
6929 | } | ||
6930 | if (mystrncasecmp(argv[i],"-hidden",0)) { | ||
6931 | File.Hidden = true; | ||
6932 | continue; | ||
6933 | } | ||
6934 | if (mystrncasecmp(argv[i],"-system",0)) { | ||
6935 | File.System = true; | ||
6936 | continue; | ||
6937 | } | ||
6938 | if (mystrncasecmp(argv[i],"-newtime",0)) { | ||
6939 | File.ModifiedEmpty = true; | ||
6940 | continue; | ||
6941 | } | ||
6942 | printmsg("Parameter \"%s\" unknown\n",argv[i]); | ||
6943 | exit(-1); | ||
6944 | case 1: | ||
6945 | if (mystrncasecmp(argv[i],"JAR",0)) { | ||
6946 | File.Type = GSM_File_Java_JAR; | ||
6947 | } else if (mystrncasecmp(argv[i],"JPG",0)) { | ||
6948 | File.Type = GSM_File_Image_JPG; | ||
6949 | } else if (mystrncasecmp(argv[i],"BMP",0)) { | ||
6950 | File.Type = GSM_File_Image_BMP; | ||
6951 | } else if (mystrncasecmp(argv[i],"WBMP",0)) { | ||
6952 | File.Type = GSM_File_Image_WBMP; | ||
6953 | } else if (mystrncasecmp(argv[i],"GIF",0)) { | ||
6954 | File.Type = GSM_File_Image_GIF; | ||
6955 | } else if (mystrncasecmp(argv[i],"PNG",0)) { | ||
6956 | File.Type = GSM_File_Image_PNG; | ||
6957 | } else if (mystrncasecmp(argv[i],"MIDI",0)) { | ||
6958 | File.Type = GSM_File_Sound_MIDI; | ||
6959 | } else if (mystrncasecmp(argv[i],"AMR",0)) { | ||
6960 | File.Type = GSM_File_Sound_AMR; | ||
6961 | } else if (mystrncasecmp(argv[i],"NRT",0)) { | ||
6962 | File.Type = GSM_File_Sound_NRT; | ||
6963 | } else if (mystrncasecmp(argv[i],"3GP",0)) { | ||
6964 | File.Type = GSM_File_Video_3GP; | ||
6965 | } else { | ||
6966 | printmsg("What file type (\"%s\") ?\n",argv[i]); | ||
6967 | exit(-1); | ||
6968 | } | ||
6969 | nextlong = 0; | ||
6970 | break; | ||
6971 | } | ||
6972 | } | ||
6973 | if (nextlong!=0) { | ||
6974 | printmsg("Parameter missed...\n"); | ||
6975 | exit(-1); | ||
6976 | } | ||
6977 | } | ||
6978 | |||
6979 | GSM_Init(true); | ||
6980 | |||
6981 | error = ERR_NONE; | ||
6982 | while (error == ERR_NONE) { | ||
6983 | error = Phone->AddFilePart(&s,&File,&Pos); | ||
6984 | if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error); | ||
6985 | printmsgerr("%cWriting: %i percent",13,Pos*100/File.Used); | ||
6986 | } | ||
6987 | printmsgerr("\n"); | ||
6988 | if (error == ERR_WRONGCRC) { | ||
6989 | printmsg("WARNING: File checksum calculated by phone doesn't match with value calculated by Gammu. File damaged or error in Gammu\n"); | ||
6990 | } | ||
6991 | |||
6992 | free(File.Buffer); | ||
6993 | GSM_Terminate(); | ||
6994 | } | ||
6995 | |||
6996 | static void AddFolder(int argc, char *argv[]) | ||
6997 | { | ||
6998 | GSM_File File; | ||
6999 | |||
7000 | strcpy(File.ID_FullName,argv[2]); | ||
7001 | EncodeUnicode(File.Name,argv[3],strlen(argv[3])); | ||
7002 | File.ReadOnly = false; | ||
7003 | |||
7004 | GSM_Init(true); | ||
7005 | |||
7006 | error = Phone->AddFolder(&s,&File); | ||
7007 | Print_Error(error); | ||
7008 | |||
7009 | GSM_Terminate(); | ||
7010 | } | ||
7011 | |||
7012 | struct NokiaFolderInfo { | ||
7013 | char*model; | ||
7014 | char *parameter; | ||
7015 | char*folder; | ||
7016 | char *level; | ||
7017 | }; | ||
7018 | |||
7019 | static struct NokiaFolderInfo Folder[] = { | ||
7020 | /* Language indepedent in DCT4 */ | ||
7021 | {"", "MMSUnreadInbox", "INBOX","3"}, | ||
7022 | {"", "MMSReadInbox", "INBOX","3"}, | ||
7023 | {"", "MMSOutbox", "OUTBOX","3"}, | ||
7024 | {"", "MMSSent", "SENT", "3"}, | ||
7025 | {"", "MMSDrafts", "DRAFTS","3"}, | ||
7026 | {"", "Application", "applications","3"}, | ||
7027 | {"", "Game", "games","3"}, | ||
7028 | /* Language depedent in DCT4 */ | ||
7029 | {"", "Gallery", "Pictures","2"}, /* 3510 */ | ||
7030 | {"", "Gallery", "Graphics","3"}, /* 3510i */ | ||
7031 | {"", "Gallery", "Images","3"}, /* 6610 */ | ||
7032 | {"3510", "Gallery", "", "8"}, | ||
7033 | {"3510i","Gallery", "", "3"}, | ||
7034 | {"5100", "Gallery", "", "3"}, | ||
7035 | {"6220", "Gallery", "", "5"}, | ||
7036 | {"", "Tones", "Tones","3"}, | ||
7037 | {"3510i","Tones", "", "4"}, | ||
7038 | {"5100", "Tones", "", "4"}, | ||
7039 | {"6220", "Tones", "", "6"}, | ||
7040 | /* Language indepedent in OBEX */ | ||
7041 | {"obex", "MMSUnreadInbox", "", "predefMessages\\predefINBOX"}, | ||
7042 | {"obex", "MMSReadInbox", "", "predefMessages\\predefINBOX"}, | ||
7043 | {"obex", "MMSOutbox", "", "predefMessages\\predefOUTBOX"}, | ||
7044 | {"obex", "MMSSent", "", "predefMessages\\predefSENT" }, | ||
7045 | {"obex", "MMSDrafts", "", "predefMessages\\predefDRAFTS"}, | ||
7046 | // {"obex", "Application, "", "predefjava\\predefapplications"}, | ||
7047 | // {"obex", "Game", "", "predefjava\\predefgames"}, | ||
7048 | {"obex", "Gallery", "", "predefgallery\\predefgraphics"}, | ||
7049 | {"obex", "Tones", "", "predefgallery\\predeftones"}, | ||
7050 | |||
7051 | /* End of list */ | ||
7052 | {"", "", "", ""} | ||
7053 | }; | ||
7054 | |||
7055 | static void NokiaAddFile(int argc, char *argv[]) | ||
7056 | { | ||
7057 | GSM_File File, Files; | ||
7058 | FILE *file; | ||
7059 | GSM_DateTime DT,DT2; | ||
7060 | time_t t_time1,t_time2; | ||
7061 | unsigned char buffer[10000],JAR[500],Vendor[500],Name[500],Version[500],FileID[400]; | ||
7062 | bool Start = true, Found = false, wasclr; | ||
7063 | bool ModEmpty = false; | ||
7064 | int i = 0, Pos, Size, Size2, nextlong; | ||
7065 | |||
7066 | while (Folder[i].level[0] != 0) { | ||
7067 | if (mystrncasecmp(argv[2],Folder[i].parameter,0)) { | ||
7068 | Found = true; | ||
7069 | break; | ||
7070 | } | ||
7071 | i++; | ||
7072 | } | ||
7073 | if (!Found) { | ||
7074 | printmsg("What folder type (\"%s\") ?\n",argv[2]); | ||
7075 | exit(-1); | ||
7076 | } | ||
7077 | |||
7078 | GSM_Init(true); | ||
7079 | |||
7080 | if (s.ConnectionType == GCT_IRDAOBEX || s.ConnectionType == GCT_BLUEOBEX) { | ||
7081 | Found = false; | ||
7082 | i = 0; | ||
7083 | while (Folder[i].level[0] != 0) { | ||
7084 | if (!strcmp("obex",Folder[i].model) && | ||
7085 | mystrncasecmp(argv[2],Folder[i].parameter,0)) { | ||
7086 | strcpy(Files.ID_FullName,Folder[i].level); | ||
7087 | Found = true; | ||
7088 | break; | ||
7089 | } | ||
7090 | i++; | ||
7091 | } | ||
7092 | } else { | ||
7093 | printmsgerr("Searching for phone folder: "); | ||
7094 | while (1) { | ||
7095 | error = Phone->GetNextFileFolder(&s,&Files,Start); | ||
7096 | if (error == ERR_EMPTY) break; | ||
7097 | Print_Error(error); | ||
7098 | |||
7099 | if (Files.Folder) { | ||
7100 | dbgprintf("folder %s level %i\n",DecodeUnicodeConsole(Files.Name),Files.Level); | ||
7101 | Found = false; | ||
7102 | i = 0; | ||
7103 | while (Folder[i].level[0] != 0) { | ||
7104 | EncodeUnicode(buffer,Folder[i].folder,strlen(Folder[i].folder)); | ||
7105 | dbgprintf("comparing \"%s\" \"%s\" \"%s\"\n",s.Phone.Data.ModelInfo->model,Files.ID_FullName,Folder[i].level); | ||
7106 | if (mystrncasecmp(argv[2],Folder[i].parameter,0) && | ||
7107 | mywstrncasecmp(Files.Name,buffer,0) && | ||
7108 | Files.Level == atoi(Folder[i].level)) { | ||
7109 | Found = true; | ||
7110 | break; | ||
7111 | } | ||
7112 | if (!strcmp(s.Phone.Data.ModelInfo->model,Folder[i].model) && | ||
7113 | mystrncasecmp(argv[2],Folder[i].parameter,0) && | ||
7114 | !strcmp(Files.ID_FullName,Folder[i].level)) { | ||
7115 | Found = true; | ||
7116 | break; | ||
7117 | } | ||
7118 | i++; | ||
7119 | } | ||
7120 | if (Found) break; | ||
7121 | } | ||
7122 | printmsgerr("*"); | ||
7123 | |||
7124 | Start = false; | ||
7125 | } | ||
7126 | printmsgerr("\n"); | ||
7127 | } | ||
7128 | if (!Found) { | ||
7129 | printmsg("Folder not found. Probably function not supported !\n"); | ||
7130 | GSM_Terminate(); | ||
7131 | exit(-1); | ||
7132 | } | ||
7133 | File.Buffer = NULL; | ||
7134 | File.Protected = false; | ||
7135 | File.ReadOnly = false; | ||
7136 | File.Hidden= false; | ||
7137 | File.System= false; | ||
7138 | |||
7139 | if (mystrncasecmp(argv[2],"Application",0) || mystrncasecmp(argv[2],"Game",0)) { | ||
7140 | sprintf(buffer,"%s.jad",argv[3]); | ||
7141 | file = fopen(buffer,"rb"); | ||
7142 | if (file == NULL) Print_Error(ERR_CANTOPENFILE); | ||
7143 | fclose(file); | ||
7144 | sprintf(buffer,"%s.jar",argv[3]); | ||
7145 | file = fopen(buffer,"rb"); | ||
7146 | if (file == NULL) Print_Error(ERR_CANTOPENFILE); | ||
7147 | fclose(file); | ||
7148 | |||
7149 | /* reading jar file */ | ||
7150 | sprintf(buffer,"%s.jar",argv[3]); | ||
7151 | error = GSM_ReadFile(buffer, &File); | ||
7152 | Print_Error(error); | ||
7153 | Size2 = File.Used; | ||
7154 | |||
7155 | /* reading jad file */ | ||
7156 | sprintf(buffer,"%s.jad",argv[3]); | ||
7157 | error = GSM_ReadFile(buffer, &File); | ||
7158 | Print_Error(error); | ||
7159 | |||
7160 | /* Getting values from JAD file */ | ||
7161 | error = GSM_JADFindData(File, Vendor, Name, JAR, Version, &Size); | ||
7162 | if (error == ERR_FILENOTSUPPORTED) { | ||
7163 | if (Vendor[0] == 0x00) { | ||
7164 | printmsgerr("No vendor info in JAD file\n"); | ||
7165 | GSM_Terminate(); | ||
7166 | return; | ||
7167 | } | ||
7168 | if (Name[0] == 0x00) { | ||
7169 | printmsgerr("No name info in JAD file\n"); | ||
7170 | GSM_Terminate(); | ||
7171 | return; | ||
7172 | } | ||
7173 | if (JAR[0] == 0x00) { | ||
7174 | printmsgerr("No JAR URL info in JAD file\n"); | ||
7175 | GSM_Terminate(); | ||
7176 | return; | ||
7177 | } | ||
7178 | if (Size == -1) { | ||
7179 | printmsgerr("No JAR size info in JAD file\n"); | ||
7180 | GSM_Terminate(); | ||
7181 | return; | ||
7182 | } | ||
7183 | } | ||
7184 | if (Size != Size2) { | ||
7185 | printmsgerr("Declared JAR file size is different than real\n"); | ||
7186 | GSM_Terminate(); | ||
7187 | return; | ||
7188 | } | ||
7189 | printmsgerr("Adding \"%s\"",Name); | ||
7190 | if (Version[0] != 0x00) printmsgerr(" version %s",Version); | ||
7191 | printmsgerr(" created by %s\n",Vendor); | ||
7192 | |||
7193 | /* Bostjan Muller 3200 RH-30 3.08 */ | ||
7194 | if (strstr(JAR,"http://") != NULL) { | ||
7195 | i = strlen(JAR)-1; | ||
7196 | while (JAR[i] != '/') i--; | ||
7197 | strcpy(buffer,JAR+i+1); | ||
7198 | strcpy(JAR,buffer); | ||
7199 | dbgprintf("New file name is \"%s\"\n",JAR); | ||
7200 | } | ||
7201 | |||
7202 | /* Changing all #13 or #10 to #13#10 in JAD */ | ||
7203 | Pos = 0; | ||
7204 | wasclr = false; | ||
7205 | for (i=0;i<File.Used;i++) { | ||
7206 | switch (File.Buffer[i]) { | ||
7207 | case 0x0D: | ||
7208 | case 0x0A: | ||
7209 | if (!wasclr) { | ||
7210 | buffer[Pos++] = 0x0D; | ||
7211 | buffer[Pos++] = 0x0A; | ||
7212 | wasclr = true; | ||
7213 | } else wasclr = false; | ||
7214 | break; | ||
7215 | default: | ||
7216 | buffer[Pos++] = File.Buffer[i]; | ||
7217 | wasclr = false; | ||
7218 | } | ||
7219 | } | ||
7220 | File.Buffer = realloc(File.Buffer, Pos); | ||
7221 | File.Used = Pos; | ||
7222 | memcpy(File.Buffer,buffer,Pos); | ||
7223 | |||
7224 | /* adding folder */ | ||
7225 | strcpy(buffer,Vendor); | ||
7226 | strcat(buffer,Name); | ||
7227 | EncodeUnicode(File.Name,buffer,strlen(buffer)); | ||
7228 | strcpy(File.ID_FullName,Files.ID_FullName); | ||
7229 | error = Phone->AddFolder(&s,&File); | ||
7230 | Print_Error(error); | ||
7231 | strcpy(FileID,File.ID_FullName); | ||
7232 | |||
7233 | /* adding jad file */ | ||
7234 | strcpy(buffer,JAR); | ||
7235 | buffer[strlen(buffer) - 1] = 'd'; | ||
7236 | EncodeUnicode(File.Name,buffer,strlen(buffer)); | ||
7237 | File.Type = GSM_File_Other; | ||
7238 | File.ModifiedEmpty = true; | ||
7239 | error = ERR_NONE; | ||
7240 | Pos = 0; | ||
7241 | while (error == ERR_NONE) { | ||
7242 | error = Phone->AddFilePart(&s,&File,&Pos); | ||
7243 | if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error); | ||
7244 | printmsgerr("%cWriting JAD file: %i percent",13,Pos*100/File.Used); | ||
7245 | } | ||
7246 | printmsgerr("\n"); | ||
7247 | if (error == ERR_WRONGCRC) { | ||
7248 | printmsg("WARNING: File checksum calculated by phone doesn't match with value calculated by Gammu. File damaged or error in Gammu\n"); | ||
7249 | } | ||
7250 | |||
7251 | if (argc > 4) { | ||
7252 | if (mystrncasecmp(argv[4],"-readonly",0)) File.ReadOnly = true; | ||
7253 | } | ||
7254 | |||
7255 | /* reading jar file */ | ||
7256 | sprintf(buffer,"%s.jar",argv[3]); | ||
7257 | error = GSM_ReadFile(buffer, &File); | ||
7258 | Print_Error(error); | ||
7259 | |||
7260 | /* adding jar file */ | ||
7261 | strcpy(File.ID_FullName,FileID); | ||
7262 | strcpy(buffer,JAR); | ||
7263 | EncodeUnicode(File.Name,buffer,strlen(buffer)); | ||
7264 | File.Type = GSM_File_Java_JAR; | ||
7265 | File.ModifiedEmpty = true; | ||
7266 | error = ERR_NONE; | ||
7267 | Pos = 0; | ||
7268 | while (error == ERR_NONE) { | ||
7269 | error = Phone->AddFilePart(&s,&File,&Pos); | ||
7270 | if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error); | ||
7271 | printmsgerr("%cWriting JAR file: %i percent",13,Pos*100/File.Used); | ||
7272 | } | ||
7273 | printmsgerr("\n"); | ||
7274 | if (error == ERR_WRONGCRC) { | ||
7275 | printmsg("WARNING: File checksum calculated by phone doesn't match with value calculated by Gammu. File damaged or error in Gammu\n"); | ||
7276 | } | ||
7277 | |||
7278 | free(File.Buffer); | ||
7279 | GSM_Terminate(); | ||
7280 | return; | ||
7281 | } | ||
7282 | |||
7283 | if (mystrncasecmp(argv[2],"Gallery",0) || mystrncasecmp(argv[2],"Tones",0)) { | ||
7284 | strcpy(buffer,argv[3]); | ||
7285 | if (argc > 4) { | ||
7286 | nextlong = 0; | ||
7287 | for (i=4;i<argc;i++) { | ||
7288 | switch(nextlong) { | ||
7289 | case 0: | ||
7290 | if (mystrncasecmp(argv[i],"-name",0)) { | ||
7291 | nextlong = 1; | ||
7292 | continue; | ||
7293 | } | ||
7294 | if (mystrncasecmp(argv[i],"-protected",0)) { | ||
7295 | File.Protected = true; | ||
7296 | continue; | ||
7297 | } | ||
7298 | if (mystrncasecmp(argv[i],"-readonly",0)) { | ||
7299 | File.ReadOnly = true; | ||
7300 | continue; | ||
7301 | } | ||
7302 | if (mystrncasecmp(argv[i],"-hidden",0)) { | ||
7303 | File.Hidden = true; | ||
7304 | continue; | ||
7305 | } | ||
7306 | if (mystrncasecmp(argv[i],"-system",0)) { | ||
7307 | File.System = true; | ||
7308 | continue; | ||
7309 | } | ||
7310 | if (mystrncasecmp(argv[i],"-newtime",0)) { | ||
7311 | ModEmpty = true; | ||
7312 | continue; | ||
7313 | } | ||
7314 | printmsg("Parameter \"%s\" unknown\n",argv[i]); | ||
7315 | exit(-1); | ||
7316 | case 1: | ||
7317 | strcpy(buffer,argv[i]); | ||
7318 | nextlong = 0; | ||
7319 | break; | ||
7320 | } | ||
7321 | } | ||
7322 | if (nextlong!=0) { | ||
7323 | printmsg("Parameter missed...\n"); | ||
7324 | exit(-1); | ||
7325 | } | ||
7326 | } | ||
7327 | } else { /* MMS things */ | ||
7328 | DT2.Year = 2001; | ||
7329 | DT2.Month = 12; | ||
7330 | DT2.Day = 31; | ||
7331 | DT2.Hour = 14; | ||
7332 | DT2.Minute = 00; | ||
7333 | DT2.Second = 00; | ||
7334 | t_time2 = Fill_Time_T(DT2,8); | ||
7335 | |||
7336 | GSM_GetCurrentDateTime(&DT); | ||
7337 | t_time1 = Fill_Time_T(DT,8); | ||
7338 | |||
7339 | sprintf(buffer,"%07X %07X ",(int)(t_time1-t_time2-40),(int)(t_time1-t_time2-40)); | ||
7340 | #ifdef DEVELOP | ||
7341 | sprintf(buffer,"2A947BD 2A947DB "); | ||
7342 | #endif | ||
7343 | /* 40 = inbox "multimedia message received" message */ | ||
7344 | /* 30 = outbox sending failed */ | ||
7345 | if (mystrncasecmp(argv[2],"MMSUnreadInbox",0)) strcat(buffer,"43 "); | ||
7346 | else if (mystrncasecmp(argv[2],"MMSReadInbox",0)) strcat(buffer,"50 "); | ||
7347 | else if (mystrncasecmp(argv[2],"MMSOutbox",0)) strcat(buffer,"10 "); | ||
7348 | else if (mystrncasecmp(argv[2],"MMSSent",0)) strcat(buffer,"20 "); | ||
7349 | else if (mystrncasecmp(argv[2],"MMSDrafts",0)) strcat(buffer,"61 "); | ||
7350 | if (argc > 4) { | ||
7351 | if (!mystrncasecmp(argv[2],"MMSOutbox",0) && | ||
7352 | !mystrncasecmp(argv[2],"MMSSent",0)) { | ||
7353 | sprintf(Name,"%s",argv[4]); | ||
7354 | strcat(buffer,Name); | ||
7355 | } | ||
7356 | if (argc > 5) { | ||
7357 | sprintf(Name,"%zd%s/TYPE=PLMN",strlen(argv[5])+10,argv[5]); | ||
7358 | strcat(buffer,Name); | ||
7359 | } | ||
7360 | } | ||
7361 | ModEmpty = true; | ||
7362 | } | ||
7363 | |||
7364 | error = GSM_ReadFile(argv[3], &File); | ||
7365 | Print_Error(error); | ||
7366 | if (ModEmpty) File.ModifiedEmpty = true; | ||
7367 | |||
7368 | strcpy(File.ID_FullName,Files.ID_FullName); | ||
7369 | EncodeUnicode(File.Name,buffer,strlen(buffer)); | ||
7370 | GSM_IdentifyFileFormat(&File); | ||
7371 | #ifdef DEVELOP | ||
7372 | if (mystrncasecmp(argv[2],"Gallery",0) || mystrncasecmp(argv[2],"Tones",0)) { | ||
7373 | } else { /* MMS things */ | ||
7374 | File.Type = GSM_File_MMS; | ||
7375 | } | ||
7376 | #endif | ||
7377 | |||
7378 | dbgprintf("Adding file to filesystem now\n"); | ||
7379 | error = ERR_NONE; | ||
7380 | Pos= 0; | ||
7381 | while (error == ERR_NONE) { | ||
7382 | error = Phone->AddFilePart(&s,&File,&Pos); | ||
7383 | if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error); | ||
7384 | if (File.Used != 0) printmsgerr("%cWriting file: %i percent",13,Pos*100/File.Used); | ||
7385 | } | ||
7386 | printmsgerr("\n"); | ||
7387 | if (error == ERR_WRONGCRC) { | ||
7388 | printmsg("WARNING: File checksum calculated by phone doesn't match with value calculated by Gammu. File damaged or error in Gammu\n"); | ||
7389 | } | ||
7390 | |||
7391 | free(File.Buffer); | ||
7392 | GSM_Terminate(); | ||
7393 | } | ||
7394 | |||
7395 | static void DeleteFiles(int argc, char *argv[]) | ||
7396 | { | ||
7397 | int i; | ||
7398 | |||
7399 | GSM_Init(true); | ||
7400 | |||
7401 | for (i=2;i<argc;i++) { | ||
7402 | error = Phone->DeleteFile(&s,argv[i]); | ||
7403 | Print_Error(error); | ||
7404 | } | ||
7405 | |||
7406 | GSM_Terminate(); | ||
7407 | } | ||
7408 | |||
7409 | static void SaveMMSFile(int argc, char *argv[]) | ||
7410 | { | ||
7411 | FILE *file; | ||
7412 | unsigned char Buffer[50000],Buffer2[20][2010]; | ||
7413 | int i,nextlong = 0,len = 0; | ||
7414 | GSM_EncodeMultiPartMMSInfo Info; | ||
7415 | |||
7416 | GSM_ClearMultiPartMMSInfo(&Info); | ||
7417 | |||
7418 | for (i=3;i<argc;i++) { | ||
7419 | switch (nextlong) { | ||
7420 | case 0: | ||
7421 | if (mystrncasecmp(argv[i],"-subject",0)) { | ||
7422 | nextlong=1; | ||
7423 | continue; | ||
7424 | } | ||
7425 | if (mystrncasecmp(argv[i],"-text",0)) { | ||
7426 | nextlong=2; | ||
7427 | continue; | ||
7428 | } | ||
7429 | if (mystrncasecmp(argv[i],"-from",0)) { | ||
7430 | nextlong=3; | ||
7431 | continue; | ||
7432 | } | ||
7433 | if (mystrncasecmp(argv[i],"-to",0)) { | ||
7434 | nextlong=4; | ||
7435 | continue; | ||
7436 | } | ||
7437 | printmsg("Unknown parameter (\"%s\")\n",argv[i]); | ||
7438 | exit(-1); | ||
7439 | break; | ||
7440 | case 1: /* Subject */ | ||
7441 | EncodeUnicode(Info.Subject,argv[i],strlen(argv[i])); | ||
7442 | nextlong = 0; | ||
7443 | break; | ||
7444 | case 2: /* Text */ | ||
7445 | EncodeUnicode(Buffer2[Info.EntriesNum],argv[i],strlen(argv[i])); | ||
7446 | Info.Entries[Info.EntriesNum].ID = MMS_Text; | ||
7447 | Info.Entries[Info.EntriesNum].Buffer = Buffer2[Info.EntriesNum]; | ||
7448 | Info.EntriesNum++; | ||
7449 | nextlong = 0; | ||
7450 | break; | ||
7451 | case 3: /* From */ | ||
7452 | EncodeUnicode(Info.Source,argv[i],strlen(argv[i])); | ||
7453 | nextlong = 0; | ||
7454 | break; | ||
7455 | case 4: /* To */ | ||
7456 | EncodeUnicode(Info.Destination,argv[i],strlen(argv[i])); | ||
7457 | nextlong = 0; | ||
7458 | break; | ||
7459 | } | ||
7460 | } | ||
7461 | if (nextlong!=0) { | ||
7462 | printmsg("Parameter missed...\n"); | ||
7463 | exit(-1); | ||
7464 | } | ||
7465 | |||
7466 | GSM_EncodeMMSFile(&Info,Buffer,&len); | ||
7467 | |||
7468 | file = fopen(argv[2],"wb"); | ||
7469 | if (file == NULL) Print_Error(ERR_CANTOPENFILE); | ||
7470 | fwrite(Buffer,1,len,file); | ||
7471 | fclose(file); | ||
7472 | } | ||
7473 | |||
7474 | static void CallDivert(int argc, char *argv[]) | ||
7475 | { | ||
7476 | GSM_MultiCallDivert cd; | ||
7477 | |||
7478 | if (mystrncasecmp("get",argv[2],0)) {} | ||
7479 | else if (mystrncasecmp("set",argv[2],0)) {} | ||
7480 | else { | ||
7481 | printmsg("Unknown divert action (\"%s\")\n",argv[2]); | ||
7482 | exit(-1); | ||
7483 | } | ||
7484 | |||
7485 | if (mystrncasecmp("all" , argv[3],0)) {cd.Request.DivertType = GSM_DIVERT_AllTypes ;} | ||
7486 | else if (mystrncasecmp("busy" , argv[3],0)) {cd.Request.DivertType = GSM_DIVERT_Busy ;} | ||
7487 | else if (mystrncasecmp("noans" , argv[3],0)) {cd.Request.DivertType = GSM_DIVERT_NoAnswer ;} | ||
7488 | else if (mystrncasecmp("outofreach", argv[3],0)) {cd.Request.DivertType = GSM_DIVERT_OutOfReach;} | ||
7489 | else { | ||
7490 | printmsg("Unknown divert type (\"%s\")\n",argv[3]); | ||
7491 | exit(-1); | ||
7492 | } | ||
7493 | |||
7494 | if (mystrncasecmp("all" , argv[4],0)) {cd.Request.CallType = GSM_DIVERT_AllCalls ;} | ||
7495 | else if (mystrncasecmp("voice", argv[4],0)) {cd.Request.CallType = GSM_DIVERT_VoiceCalls;} | ||
7496 | else if (mystrncasecmp("fax" , argv[4],0)) {cd.Request.CallType = GSM_DIVERT_FaxCalls ;} | ||
7497 | else if (mystrncasecmp("data" , argv[4],0)) {cd.Request.CallType = GSM_DIVERT_DataCalls ;} | ||
7498 | else { | ||
7499 | printmsg("Unknown call type (\"%s\")\n",argv[4]); | ||
7500 | exit(-1); | ||
7501 | } | ||
7502 | |||
7503 | GSM_Init(true); | ||
7504 | |||
7505 | if (mystrncasecmp("get", argv[2],0)) { | ||
7506 | error = Phone->GetCallDivert(&s,&cd); | ||
7507 | Print_Error(error); | ||
7508 | printmsg("Query:\n Divert type: "); | ||
7509 | } else { | ||
7510 | cd.Request.Number[0] = 0; | ||
7511 | cd.Request.Number[1] = 0; | ||
7512 | if (argc > 5) EncodeUnicode(cd.Request.Number,argv[5],strlen(argv[5])); | ||
7513 | |||
7514 | cd.Request.Timeout = 0; | ||
7515 | if (argc > 6) cd.Request.Timeout = atoi(argv[6]); | ||
7516 | |||
7517 | error = Phone->SetCallDivert(&s,&cd); | ||
7518 | Print_Error(error); | ||
7519 | printmsg("Changed:\n Divert type: "); | ||
7520 | } | ||
7521 | |||
7522 | switch (cd.Request.DivertType) { | ||
7523 | case GSM_DIVERT_Busy : printmsg("when busy"); break; | ||
7524 | case GSM_DIVERT_NoAnswer : printmsg("when not answered"); break; | ||
7525 | case GSM_DIVERT_OutOfReach: printmsg("when phone off or no coverage");break; | ||
7526 | case GSM_DIVERT_AllTypes : printmsg("all types of diverts"); break; | ||
7527 | default : printmsg("unknown %i",cd.Request.DivertType); break; | ||
7528 | } | ||
7529 | printmsg("\n Calls type : "); | ||
7530 | switch (cd.Request.CallType) { | ||
7531 | case GSM_DIVERT_VoiceCalls: printmsg("voice"); break; | ||
7532 | case GSM_DIVERT_FaxCalls : printmsg("fax"); break; | ||
7533 | case GSM_DIVERT_DataCalls : printmsg("data"); break; | ||
7534 | case GSM_DIVERT_AllCalls : printmsg("data & fax & voice"); break; | ||
7535 | default : printmsg("unknown %i",cd.Request.CallType); break; | ||
7536 | } | ||
7537 | printmsg("\nResponse:"); | ||
7538 | |||
7539 | for (i=0;i<cd.Response.EntriesNum;i++) { | ||
7540 | printmsg("\n Calls type : "); | ||
7541 | switch (cd.Response.Entries[i].CallType) { | ||
7542 | case GSM_DIVERT_VoiceCalls: printmsg("voice"); break; | ||
7543 | case GSM_DIVERT_FaxCalls : printmsg("fax"); break; | ||
7544 | case GSM_DIVERT_DataCalls : printmsg("data"); break; | ||
7545 | default : printmsg("unknown %i",cd.Response.Entries[i].CallType);break; | ||
7546 | } | ||
7547 | printf("\n"); | ||
7548 | printmsg(" Timeout : %i seconds\n",cd.Response.Entries[i].Timeout); | ||
7549 | printmsg(" Number : %s\n",DecodeUnicodeString(cd.Response.Entries[i].Number)); | ||
7550 | } | ||
7551 | printf("\n"); | ||
7552 | |||
7553 | GSM_Terminate(); | ||
7554 | } | ||
7555 | |||
7556 | |||
7557 | //#if 0 | ||
7558 | static void CancelAllDiverts(int argc, char *argv[]) | ||
7559 | { | ||
7560 | GSM_Init(true); | ||
7561 | |||
7562 | error = Phone->CancelAllDiverts(&s); | ||
7563 | Print_Error(error); | ||
7564 | |||
7565 | GSM_Terminate(); | ||
7566 | } | ||
7567 | |||
7568 | |||
7569 | |||
7570 | void SearchPhoneThread(OneDeviceInfo *Info) | ||
7571 | { | ||
7572 | int j; | ||
7573 | GSM_Error error; | ||
7574 | fprintf(stderr,"*********************************** \n"); | ||
7575 | fprintf(stderr,"*********************************** \n"); | ||
7576 | fprintf(stderr,"*********************************** \n"); | ||
7577 | fprintf(stderr,"*********************************** \n"); | ||
7578 | fprintf(stderr,"*********************************** \n"); | ||
7579 | #if 0 | ||
7580 | j = 0; | ||
7581 | while(strlen(Info->Connections[j].Connection) != 0) { | ||
7582 | memcpy(&Info->s.di,&s.di,sizeof(Debug_Info)); | ||
7583 | Info->s.msg = s.msg; | ||
7584 | Info->s.ConfigNum = 1; | ||
7585 | Info->s.opened = false; | ||
7586 | Info->s.Config[0].UseGlobalDebugFile = s.Config[0].UseGlobalDebugFile; | ||
7587 | Info->s.Config[0].Localize = s.Config[0].Localize; | ||
7588 | Info->s.Config[0].Device = Info->Device; | ||
7589 | Info->s.Config[0].Connection = Info->Connections[j].Connection; | ||
7590 | Info->s.Config[0].SyncTime = "no"; | ||
7591 | Info->s.Config[0].DebugFile = s.Config[0].DebugFile; | ||
7592 | Info->s.Config[0].Model[0] = 0; | ||
7593 | strcpy(Info->s.Config[0].DebugLevel,s.Config[0].DebugLevel); | ||
7594 | Info->s.Config[0].LockDevice = "no"; | ||
7595 | Info->s.Config[0].StartInfo = "no"; | ||
7596 | |||
7597 | error = GSM_InitConnection(&Info->s,1); | ||
7598 | if (SearchOutput) printf("Connection \"%s\" on device \"%s\"\n",Info->Connections[j].Connection,Info->Device); | ||
7599 | if (error == ERR_NONE) { | ||
7600 | error=Info->s.Phone.Functions->GetManufacturer(&Info->s); | ||
7601 | if (error == ERR_NONE) { | ||
7602 | error=Info->s.Phone.Functions->GetModel(&Info->s); | ||
7603 | if (error == ERR_NONE) { | ||
7604 | if (!SearchOutput) printf("Connection \"%s\" on device \"%s\"\n",Info->Connections[j].Connection,Info->Device); | ||
7605 | printmsg(" Manufacturer : %s\n", | ||
7606 | Info->s.Phone.Data.Manufacturer); | ||
7607 | printmsg(" Model : %s (%s)\n", | ||
7608 | Info->s.Phone.Data.ModelInfo->model, | ||
7609 | Info->s.Phone.Data.Model); | ||
7610 | } else { | ||
7611 | if (SearchOutput) printf(" %s\n",print_error(error,Info->s.di.df,Info->s.msg)); | ||
7612 | } | ||
7613 | } else { | ||
7614 | if (SearchOutput) printf(" %s\n",print_error(error,Info->s.di.df,Info->s.msg)); | ||
7615 | } | ||
7616 | } else { | ||
7617 | if (SearchOutput) printf(" %s\n",print_error(error,Info->s.di.df,Info->s.msg)); | ||
7618 | } | ||
7619 | if (error != ERR_DEVICEOPENERROR) { | ||
7620 | GSM_TerminateConnection(&Info->s); | ||
7621 | dbgprintf("Closing done\n"); | ||
7622 | } | ||
7623 | if (error == ERR_DEVICEOPENERROR || error == ERR_NONE) break; | ||
7624 | j++; | ||
7625 | } | ||
7626 | num--; | ||
7627 | #endif | ||
7628 | } | ||
7629 | |||
7630 | //#undef HAVE_PTHREAD | ||
7631 | //#if 0 | ||
7632 | #if defined(WIN32) || defined(HAVE_PTHREAD) | ||
7633 | #ifdef HAVE_PTHREAD | ||
7634 | pthread_t Thread[100]; | ||
7635 | #endif | ||
7636 | |||
7637 | void MakeSearchThread(int i) | ||
7638 | { | ||
7639 | num++; | ||
7640 | #ifdef HAVE_PTHREAD | ||
7641 | if (pthread_create(&Thread[i],NULL,(void *)SearchPhoneThread,&SearchDevices[i])!=0) { | ||
7642 | dbgprintf("Error creating thread\n"); | ||
7643 | } | ||
7644 | #else | ||
7645 | if (CreateThread((LPSECURITY_ATTRIBUTES)NULL,0, | ||
7646 | (LPTHREAD_START_ROUTINE)SearchPhoneThread,&SearchDevices[i], | ||
7647 | 0,NULL)==NULL) { | ||
7648 | dbgprintf("Error creating thread\n"); | ||
7649 | } | ||
7650 | #endif | ||
7651 | } | ||
7652 | |||
7653 | static void SearchPhone(int argc, char *argv[]) | ||
7654 | { | ||
7655 | int i,dev = 0, dev2 = 0; | ||
7656 | |||
7657 | SearchOutput = false; | ||
7658 | if (argc == 3 && mystrncasecmp(argv[2], "-debug",0)) SearchOutput = true; | ||
7659 | |||
7660 | num = 0; | ||
7661 | #ifdef WIN32 | ||
7662 | # ifdef GSM_ENABLE_IRDADEVICE | ||
7663 | sprintf(SearchDevices[dev].Device,""); | ||
7664 | sprintf(SearchDevices[dev].Connections[0].Connection,"irdaphonet"); | ||
7665 | SearchDevices[dev].Connections[1].Connection[0] = 0; | ||
7666 | dev++; | ||
7667 | # endif | ||
7668 | # ifdef GSM_ENABLE_SERIALDEVICE | ||
7669 | dev2 = dev; | ||
7670 | for(i=0;i<10;i++) { | ||
7671 | sprintf(SearchDevices[dev2].Device,"com%i:",i+1); | ||
7672 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | ||
7673 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | ||
7674 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | ||
7675 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | ||
7676 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | ||
7677 | dev2++; | ||
7678 | } | ||
7679 | # endif | ||
7680 | #endif | ||
7681 | #ifdef __linux__ | ||
7682 | # ifdef GSM_ENABLE_IRDADEVICE | ||
7683 | for(i=0;i<6;i++) { | ||
7684 | sprintf(SearchDevices[dev].Device,"/dev/ircomm%i",i); | ||
7685 | sprintf(SearchDevices[dev].Connections[0].Connection,"irdaphonet"); | ||
7686 | sprintf(SearchDevices[dev].Connections[1].Connection,"at19200"); | ||
7687 | SearchDevices[dev].Connections[2].Connection[0] = 0; | ||
7688 | dev++; | ||
7689 | } | ||
7690 | # endif | ||
7691 | # ifdef GSM_ENABLE_SERIALDEVICE | ||
7692 | dev2 = dev; | ||
7693 | for(i=0;i<10;i++) { | ||
7694 | sprintf(SearchDevices[dev2].Device,"/dev/ttyS%i",i); | ||
7695 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | ||
7696 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | ||
7697 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | ||
7698 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | ||
7699 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | ||
7700 | dev2++; | ||
7701 | } | ||
7702 | for(i=0;i<8;i++) { | ||
7703 | sprintf(SearchDevices[dev2].Device,"/dev/ttyD00%i",i); | ||
7704 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | ||
7705 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | ||
7706 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | ||
7707 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | ||
7708 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | ||
7709 | dev2++; | ||
7710 | } | ||
7711 | for(i=0;i<4;i++) { | ||
7712 | sprintf(SearchDevices[dev2].Device,"/dev/usb/tts/%i",i); | ||
7713 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | ||
7714 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | ||
7715 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | ||
7716 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | ||
7717 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | ||
7718 | dev2++; | ||
7719 | } | ||
7720 | # endif | ||
7721 | #endif | ||
7722 | for(i=0;i<dev;i++) MakeSearchThread(i); | ||
7723 | while (num != 0) my_sleep(5); | ||
7724 | for(i=dev;i<dev2;i++) MakeSearchThread(i); | ||
7725 | while (num != 0) my_sleep(5); | ||
7726 | } | ||
7727 | #endif /*Support for threads */ | ||
7728 | // #if 0 | ||
7729 | static void NokiaGetADC(int argc, char *argv[]) | ||
7730 | { | ||
7731 | GSM_Init(true); | ||
7732 | |||
7733 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
7734 | DCT3GetADC(argc,argv); | ||
7735 | #endif | ||
7736 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
7737 | DCT4GetADC(argc, argv); | ||
7738 | #endif | ||
7739 | |||
7740 | GSM_Terminate(); | ||
7741 | } | ||
7742 | |||
7743 | static void NokiaDisplayTest(int argc, char *argv[]) | ||
7744 | { | ||
7745 | GSM_Init(true); | ||
7746 | |||
7747 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
7748 | DCT3DisplayTest(argc,argv); | ||
7749 | #endif | ||
7750 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
7751 | DCT4DisplayTest(argc, argv); | ||
7752 | #endif | ||
7753 | |||
7754 | GSM_Terminate(); | ||
7755 | } | ||
7756 | |||
7757 | static void NokiaGetT9(int argc, char *argv[]) | ||
7758 | { | ||
7759 | GSM_Init(true); | ||
7760 | |||
7761 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
7762 | DCT3GetT9(argc,argv); | ||
7763 | #endif | ||
7764 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
7765 | DCT4GetT9(argc, argv); | ||
7766 | #endif | ||
7767 | |||
7768 | GSM_Terminate(); | ||
7769 | } | ||
7770 | |||
7771 | static void NokiaVibraTest(int argc, char *argv[]) | ||
7772 | { | ||
7773 | GSM_Init(true); | ||
7774 | |||
7775 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
7776 | DCT3VibraTest(argc,argv); | ||
7777 | #endif | ||
7778 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
7779 | DCT4VibraTest(argc, argv); | ||
7780 | #endif | ||
7781 | |||
7782 | GSM_Terminate(); | ||
7783 | } | ||
7784 | |||
7785 | static GSM_Parameters Parameters[] = { | ||
7786 | {"--identify", 0, 0, Identify, {H_Info,0}, ""}, | ||
7787 | {"--version", 0, 0, Version, {H_Other,0}, ""}, | ||
7788 | {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""}, | ||
7789 | {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"}, | ||
7790 | {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""}, | ||
7791 | {"--listnetworks", 0, 0, ListNetworks, {H_Network,0}, ""}, | ||
7792 | {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"}, | ||
7793 | {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"}, | ||
7794 | {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"}, | ||
7795 | {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""}, | ||
7796 | {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."}, | ||
7797 | {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."}, | ||
7798 | {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"}, | ||
7799 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"}, | ||
7800 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"}, | ||
7801 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, | ||
7802 | {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, | ||
7803 | {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, | ||
7804 | {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, | ||
7805 | {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, | ||
7806 | {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, | ||
7807 | {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, | ||
7808 | {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"}, | ||
7809 | {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"}, | ||
7810 | {"--getmemory", 2, 3, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop]"}, | ||
7811 | {"--getallmemory", 1, 1, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"}, | ||
7812 | {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"}, | ||
7813 | {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"}, | ||
7814 | {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"}, | ||
7815 | {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"}, | ||
7816 | {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"}, | ||
7817 | {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"}, | ||
7818 | {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"}, | ||
7819 | {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""}, | ||
7820 | {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""}, | ||
7821 | {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""}, | ||
7822 | |||
7823 | #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]" | ||
7824 | #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]" | ||
7825 | #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]" | ||
7826 | #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]" | ||
7827 | #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]" | ||
7828 | #define SMS_ANIMATION_OPTIONS"" | ||
7829 | #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]" | ||
7830 | #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]" | ||
7831 | #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]" | ||
7832 | #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]" | ||
7833 | |||
7834 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, | ||
7835 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7836 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, | ||
7837 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7838 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, | ||
7839 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, | ||
7840 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7841 | #ifdef GSM_ENABLE_BACKUP | ||
7842 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7843 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7844 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7845 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7846 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7847 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7848 | #endif | ||
7849 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS}, | ||
7850 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, | ||
7851 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, | ||
7852 | |||
7853 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, | ||
7854 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7855 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, | ||
7856 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7857 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, | ||
7858 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION destination frames file1 file2... " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, | ||
7859 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR destination URL Title Sender " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7860 | #ifdef GSM_ENABLE_BACKUP | ||
7861 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7862 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS destination file location DATA|GPRS " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7863 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7864 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7865 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7866 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 destination file SM|ME location [-nokia]" SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7867 | #endif | ||
7868 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS ""SMS_PROFILE_OPTIONS}, | ||
7869 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, | ||
7870 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, | ||
7871 | |||
7872 | {"--displaysms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "... (options like in sendsms)"}, | ||
7873 | |||
7874 | {"--addsmsfolder", 1, 1, AddSMSFolder, {H_SMS,0}, "name"}, | ||
7875 | #ifdef HAVE_MYSQL_MYSQL_H | ||
7876 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "MYSQL configfile"}, | ||
7877 | #endif | ||
7878 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "FILES configfile"}, | ||
7879 | {"--sendsmsdsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Other,0}, "TEXT|WAPSETTINGS|... destination FILES|MYSQL configfile ... (options like in sendsms)"}, | ||
7880 | {"--getringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, | ||
7881 | {"--getphoneringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, | ||
7882 | {"--getringtoneslist", 0, 0, GetRingtonesList, {H_Ringtone,0}, ""}, | ||
7883 | {"--setringtone", 1, 6, SetRingtone, {H_Ringtone,0}, "file [-location location][-scale][-name name]"}, | ||
7884 | {"--nokiacomposer", 1, 1, NokiaComposer, {H_Ringtone,H_Nokia,0}, "file"}, | ||
7885 | {"--copyringtone", 2, 3, CopyRingtone, {H_Ringtone,0}, "source destination [RTTL|BINARY]"}, | ||
7886 | {"--getussd", 1, 1, GetUSSD, {H_Call,0}, "code"}, | ||
7887 | {"--dialvoice", 1, 2, DialVoice, {H_Call,0}, "number [show|hide]"}, | ||
7888 | {"--getspeeddial", 1, 2, GetSpeedDial, {H_Call,H_Memory,0}, "start [stop]"}, | ||
7889 | {"--cancelcall", 0, 1, CancelCall, {H_Call,0}, "[ID]"}, | ||
7890 | {"--answercall", 0, 1, AnswerCall, {H_Call,0}, "[ID]"}, | ||
7891 | {"--unholdcall", 1, 1, UnholdCall, {H_Call,0}, "ID"}, | ||
7892 | {"--holdcall", 1, 1, HoldCall, {H_Call,0}, "ID"}, | ||
7893 | {"--conferencecall", 1, 1, ConferenceCall, {H_Call,0}, "ID"}, | ||
7894 | {"--splitcall", 1, 1, SplitCall, {H_Call,0}, "ID"}, | ||
7895 | {"--switchcall", 0, 1, SwitchCall, {H_Call,0}, "[ID]"}, | ||
7896 | {"--transfercall", 0, 1, TransferCall, {H_Call,0}, "[ID]"}, | ||
7897 | {"--divert", 3, 5, CallDivert, {H_Call,0}, "get|set all|busy|noans|outofreach all|voice|fax|data [number timeout]"}, | ||
7898 | {"--canceldiverts", 0, 0, CancelAllDiverts, {H_Call,0}, ""}, | ||
7899 | {"--senddtmf", 1, 1, SendDTMF, {H_Call,0}, "sequence"}, | ||
7900 | {"--getcalendarsettings", 0, 0, GetCalendarSettings, {H_Calendar,H_Settings,0},""}, | ||
7901 | {"--getalltodo", 0, 0, GetAllToDo, {H_ToDo,0}, ""}, | ||
7902 | {"--listtodocategory", 1, 1, ListToDoCategory, {H_ToDo, H_Category,0}, "text|number"}, | ||
7903 | {"--gettodo", 1, 2, GetToDo, {H_ToDo,0}, "start [stop]"}, | ||
7904 | {"--deletetodo", 1, 2, DeleteToDo, {H_ToDo,0}, "start [stop]"}, | ||
7905 | {"--getnote", 1, 2, GetNote, {H_Note,0}, "start [stop]"}, | ||
7906 | {"--deletecalendar", 1, 2, DeleteCalendar, {H_Calendar,0}, "start [stop]"}, | ||
7907 | {"--getallcalendar", 0, 0, GetAllCalendar, {H_Calendar,0}, ""}, | ||
7908 | {"--getcalendar", 1, 2, GetCalendar, {H_Calendar,0}, "start [stop]"}, | ||
7909 | {"--getcategory", 2, 3, GetCategory, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK start [stop]"}, | ||
7910 | {"--getallcategory", 1, 1, GetAllCategories, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK"}, | ||
7911 | {"--reset", 1, 1, Reset, {H_Other,0}, "SOFT|HARD"}, | ||
7912 | {"--getprofile", 1, 2, GetProfile, {H_Settings,0}, "start [stop]"}, | ||
7913 | {"--getsecuritystatus", 0, 0, GetSecurityStatus, {H_Info,0}, ""}, | ||
7914 | {"--entersecuritycode", 2, 2, EnterSecurityCode, {H_Other,0}, "PIN|PUK|PIN2|PUK2 code"}, | ||
7915 | {"--deletewapbookmark", 1, 2, DeleteWAPBookmark, {H_WAP,0}, "start [stop]"}, | ||
7916 | {"--getwapbookmark", 1, 2, GetWAPBookmark, {H_WAP,0}, "start [stop]"}, | ||
7917 | {"--getwapsettings", 1, 2, GetWAPMMSSettings, {H_WAP,0}, "start [stop]"}, | ||
7918 | {"--getmmssettings", 1, 2, GetWAPMMSSettings, {H_MMS,0}, "start [stop]"}, | ||
7919 | {"--getsyncmlsettings", 1, 2, GetSyncMLSettings, {H_WAP,0}, "start [stop]"}, | ||
7920 | {"--getchatsettings", 1, 2, GetChatSettings, {H_WAP,0}, "start [stop]"}, | ||
7921 | {"--savemmsfile", 3, 15,SaveMMSFile, {H_MMS,0}, "file [-subject text][-text text]"}, | ||
7922 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "STARTUP [file]"}, | ||
7923 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "CALLER location [file]"}, | ||
7924 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "OPERATOR [file]"}, | ||
7925 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "PICTURE location [file]"}, | ||
7926 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "TEXT"}, | ||
7927 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "DEALER"}, | ||
7928 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "STARTUP file|1|2|3"}, | ||
7929 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOURSTARTUP [fileID]"}, | ||
7930 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "WALLPAPER fileID"}, | ||
7931 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "CALLER location [file]"}, | ||
7932 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "OPERATOR [file [netcode]]"}, | ||
7933 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOUROPERATOR [fileID [netcode]]"}, | ||
7934 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "PICTURE file location [text]"}, | ||
7935 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "TEXT text"}, | ||
7936 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "DEALER text"}, | ||
7937 | {"--copybitmap", 1, 3, CopyBitmap, {H_Logo,0}, "inputfile [outputfile [OPERATOR|PICTURE|STARTUP|CALLER]]"}, | ||
7938 | {"--presskeysequence", 1, 1, PressKeySequence, {H_Other,0}, "mMnNpPuUdD+-123456789*0#gGrRwW"}, | ||
7939 | #if defined(WIN32) || defined(HAVE_PTHREAD) | ||
7940 | {"--searchphone", 0, 1, SearchPhone, {H_Other,0}, "[-debug]"}, | ||
7941 | #endif | ||
7942 | #ifdef GSM_ENABLE_BACKUP | ||
7943 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_Calendar,0},"CALENDAR target.vcs file location"}, | ||
7944 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_ToDo,0}, "TODO target.vcs file location"}, | ||
7945 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_Memory,0}, "VCARD10|VCARD21 target.vcf file SM|ME location"}, | ||
7946 | {"--savefile", 4, 5, SaveFile, {H_Backup,H_WAP,0}, "BOOKMARK target.url file location"}, | ||
7947 | {"--backup", 1, 2, Backup, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file [-yes]"}, | ||
7948 | {"--backupsms", 1, 1, BackupSMS, {H_Backup,H_SMS,0}, "file"}, | ||
7949 | {"--restore", 1, 1, Restore, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, | ||
7950 | {"--addnew", 1, 1, AddNew, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, | ||
7951 | {"--restoresms", 1, 1, RestoreSMS, {H_Backup,H_SMS,0}, "file"}, | ||
7952 | {"--addsms", 2, 2, AddSMS, {H_Backup,H_SMS,0}, "folder file"}, | ||
7953 | #endif | ||
7954 | {"--clearall", 0, 0, ClearAll, {H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0},""}, | ||
7955 | {"--networkinfo", 0, 0, NetworkInfo, {H_Network,0}, ""}, | ||
7956 | #ifdef GSM_ENABLE_AT | ||
7957 | {"--siemenssatnetmon", 0, 0, ATSIEMENSSATNetmon, {H_Siemens,H_Network,0},""}, | ||
7958 | {"--siemensnetmonact", 1, 1, ATSIEMENSActivateNetmon, {H_Siemens,H_Network,0}, "netmon_type (1-full, 2-simple)"}, | ||
7959 | {"--siemensnetmonitor", 1, 1, ATSIEMENSNetmonitor, {H_Siemens,H_Network,0},"test"}, | ||
7960 | #endif | ||
7961 | #ifdef GSM_ENABLE_NOKIA6110 | ||
7962 | {"--nokiagetoperatorname", 0, 0, DCT3GetOperatorName, {H_Nokia,H_Network,0}, ""}, | ||
7963 | {"--nokiasetoperatorname", 0, 2, DCT3SetOperatorName, {H_Nokia,H_Network,0}, "[networkcode name]"}, | ||
7964 | {"--nokiadisplayoutput", 0, 0, DCT3DisplayOutput, {H_Nokia,0}, ""}, | ||
7965 | #endif | ||
7966 | #ifdef GSM_ENABLE_NOKIA_DCT3 | ||
7967 | {"--nokianetmonitor", 1, 1, DCT3netmonitor, {H_Nokia,H_Network,0}, "test"}, | ||
7968 | {"--nokianetmonitor36", 0, 0, DCT3ResetTest36, {H_Nokia,0}, ""}, | ||
7969 | {"--nokiadebug", 1, 2, DCT3SetDebug, {H_Nokia,H_Network,0}, "filename [[v11-22][,v33-44]...]"}, | ||
7970 | #endif | ||
7971 | #ifdef GSM_ENABLE_NOKIA_DCT4 | ||
7972 | {"--nokiasetvibralevel", 1, 1, DCT4SetVibraLevel, {H_Nokia,H_Other,0}, "level"}, | ||
7973 | {"--nokiagetvoicerecord", 1, 1, DCT4GetVoiceRecord, {H_Nokia,H_Other,0}, "location"}, | ||
7974 | {"--nokiasetlights", 2, 2, DCT4SetLight, {H_Nokia,H_Tests,0}, "keypad|display|torch on|off"}, | ||
7975 | {"--nokiatuneradio", 0, 0, DCT4TuneRadio, {H_Nokia,H_FM,0}, ""}, | ||
7976 | {"--nokiamakecamerashoot", 0, 0, DCT4MakeCameraShoot, {H_Nokia,H_Other,0}, ""}, | ||
7977 | {"--nokiagetscreendump", 0, 0, DCT4GetScreenDump, {H_Nokia,H_Other,0}, ""}, | ||
7978 | #endif | ||
7979 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | ||
7980 | {"--nokiavibratest", 0, 0, NokiaVibraTest, {H_Nokia,H_Tests,0}, ""}, | ||
7981 | {"--nokiagett9", 0, 0, NokiaGetT9, {H_Nokia,H_SMS,0}, ""}, | ||
7982 | {"--nokiadisplaytest", 1, 1, NokiaDisplayTest, {H_Nokia,H_Tests,0}, "number"}, | ||
7983 | {"--nokiagetadc", 0, 0, NokiaGetADC, {H_Nokia,H_Tests,0}, ""}, | ||
7984 | {"--nokiasecuritycode", 0, 0, NokiaSecurityCode, {H_Nokia,H_Info,0}, ""}, | ||
7985 | {"--nokiaselftests", 0, 0, NokiaSelfTests, {H_Nokia,H_Tests,0}, ""}, | ||
7986 | {"--nokiasetphonemenus", 0, 0, NokiaSetPhoneMenus, {H_Nokia,H_Other,0}, ""}, | ||
7987 | #endif | ||
7988 | #ifdef DEBUG | ||
7989 | {"--decodesniff", 2, 3, decodesniff, {H_Decode,0}, "MBUS2|IRDA file [phonemodel]"}, | ||
7990 | {"--decodebinarydump", 1, 2, decodebinarydump, {H_Decode,0}, "file [phonemodel]"}, | ||
7991 | {"--makeconverttable", 1, 1, MakeConvertTable, {H_Decode,0}, "file"}, | ||
7992 | #endif | ||
7993 | {"", 0, 0, NULL } | ||
7994 | }; | ||
7995 | |||
7996 | static HelpCategoryDescriptions HelpDescriptions[] = { | ||
7997 | {H_Call, "call", "Calls",}, | ||
7998 | {H_SMS, "sms", "SMS and EMS"}, | ||
7999 | {H_Memory, "memory","Memory (phonebooks and calls)"}, | ||
8000 | {H_Filesystem, "filesystem","Filesystem"}, | ||
8001 | {H_Logo, "logo", "Logo and pictures"}, | ||
8002 | {H_Ringtone, "ringtone","Ringtones"}, | ||
8003 | {H_Calendar, "calendar","Calendar notes"}, | ||
8004 | {H_ToDo, "todo", "To do lists"}, | ||
8005 | {H_Note, "note", "Notes"}, | ||
8006 | {H_DateTime, "datetime","Date, time and alarms"}, | ||
8007 | {H_Category, "category","Categories"}, | ||
8008 | #ifdef GSM_ENABLE_BACKUP | ||
8009 | {H_Backup, "backup","Backing up and restoring"}, | ||
8010 | #endif | ||
8011 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | ||
8012 | {H_Nokia, "nokia","Nokia specific"}, | ||
8013 | #endif | ||
8014 | #ifdef GSM_ENABLE_AT | ||
8015 | {H_Siemens, "siemens","Siemens specific"}, | ||
8016 | #endif | ||
8017 | {H_Network, "network","Network"}, | ||
8018 | {H_WAP, "wap", "WAP settings and bookmarks"}, | ||
8019 | {H_MMS, "mms", "MMS and MMS settings"}, | ||
8020 | {H_Tests, "tests","Phone tests"}, | ||
8021 | {H_FM, "fm", "FM radio"}, | ||
8022 | {H_Info, "info", "Phone information"}, | ||
8023 | {H_Settings, "settings","Phone settings"}, | ||
8024 | #ifdef DEBUG | ||
8025 | {H_Decode, "decode","Dumps decoding"}, | ||
8026 | #endif | ||
8027 | {H_Other, "other","Functions that don't fit elsewhere"}, | ||
8028 | {0, NULL, NULL} | ||
8029 | }; | ||
8030 | |||
8031 | |||
8032 | void HelpHeader(void) | ||
8033 | { | ||
8034 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); | ||
8035 | } | ||
8036 | |||
8037 | static void HelpGeneral(void) | ||
8038 | { | ||
8039 | inti=0; | ||
8040 | |||
8041 | HelpHeader(); | ||
8042 | |||
8043 | printmsg("Usage: gammu [confign] [nothing|text|textall|binary|errors] [options]\n\n"); | ||
8044 | printmsg("First parameter optionally specifies which config section to use (by default are probed all).\n"); | ||
8045 | printmsg("Second parameter optionally controls debug level, next specify actions.\n\n"); | ||
8046 | |||
8047 | /* We might want to put here some most used commands */ | ||
8048 | printmsg("For more details call help on specific topic (gammu --help topic), topics are:\n\n"); | ||
8049 | |||
8050 | while (HelpDescriptions[i].category != 0) { | ||
8051 | printf("%11s - %s\n", HelpDescriptions[i].option, HelpDescriptions[i].description); | ||
8052 | i++; | ||
8053 | } | ||
8054 | printf("\n"); | ||
8055 | } | ||
8056 | |||
8057 | static void HelpSplit(int cols, int len, unsigned char *buff) | ||
8058 | { | ||
8059 | int l, len2, pos, split; | ||
8060 | bool in_opt,first=true; | ||
8061 | char *remain, spaces[50], buffer[500]; | ||
8062 | |||
8063 | if (cols == 0) { | ||
8064 | printf(" %s\n", buff); | ||
8065 | } else { | ||
8066 | printf(" "); | ||
8067 | spaces[0] = 0; | ||
8068 | len2 = strlen(buff); | ||
8069 | if (len + len2 < cols) { | ||
8070 | printf("%s\n", buff); | ||
8071 | } else { | ||
8072 | for(l = 0; l < len; l++) strcat(spaces, " "); | ||
8073 | |||
8074 | remain = buff; | ||
8075 | |||
8076 | while (strlen(remain) > 0) { | ||
8077 | split= 0; | ||
8078 | pos= 0; | ||
8079 | in_opt= false; | ||
8080 | if (!first) printf(spaces); | ||
8081 | while (pos < cols - len && remain[pos] != 0) { | ||
8082 | if (in_opt && remain[pos] == ']') { | ||
8083 | in_opt = false; | ||
8084 | split = pos; | ||
8085 | } else if (remain[pos] == '[') { | ||
8086 | in_opt = true; | ||
8087 | } else if (!in_opt && remain[pos] == ' ') { | ||
8088 | split = pos - 1; | ||
8089 | } | ||
8090 | pos++; | ||
8091 | } | ||
8092 | /* Can not be split */ | ||
8093 | if (split == 0) { | ||
8094 | printf("%s\n", remain); | ||
8095 | remain += strlen(remain); | ||
8096 | } else { | ||
8097 | first = false; | ||
8098 | split++; | ||
8099 | strncpy(buffer, remain, split); | ||
8100 | buffer[split] = 0; | ||
8101 | printf("%s\n", buffer); | ||
8102 | remain += split; | ||
8103 | if (remain[0] == ' ') remain++; | ||
8104 | } | ||
8105 | } | ||
8106 | } | ||
8107 | } | ||
8108 | } | ||
8109 | |||
8110 | static void Help(int argc, char *argv[]) | ||
8111 | { | ||
8112 | int i = 0, j = 0, k, cols; | ||
8113 | bool disp; | ||
8114 | #ifdef TIOCGWINSZ | ||
8115 | struct winsize w; | ||
8116 | #endif | ||
8117 | #if defined(WIN32) || defined(DJGPP) | ||
8118 | #else | ||
8119 | char *columns; | ||
8120 | #endif | ||
8121 | |||
8122 | /* Just --help */ | ||
8123 | if (argc == 2) { | ||
8124 | HelpGeneral(); | ||
8125 | return; | ||
8126 | } | ||
8127 | |||
8128 | if (!strcmp(argv[2],"all")) { | ||
8129 | HelpHeader(); | ||
8130 | } else { | ||
8131 | while (HelpDescriptions[i].category != 0) { | ||
8132 | if (strcmp(argv[2], HelpDescriptions[i].option) == 0) break; | ||
8133 | i++; | ||
8134 | } | ||
8135 | if (HelpDescriptions[i].category == 0) { | ||
8136 | HelpGeneral(); | ||
8137 | printmsg("Unknown help topic specified!\n"); | ||
8138 | return; | ||
8139 | } | ||
8140 | HelpHeader(); | ||
8141 | printmsg("Gammu parameters, topic: %s\n\n", HelpDescriptions[i].description); | ||
8142 | } | ||
8143 | |||
8144 | #if defined(WIN32) || defined(DJGPP) | ||
8145 | cols = 80; | ||
8146 | #else | ||
8147 | cols = 0; | ||
8148 | /* If stdout is a tty, we will wrap to columns it has */ | ||
8149 | if (isatty(1)) { | ||
8150 | #ifdef TIOCGWINSZ | ||
8151 | if (ioctl(2, TIOCGWINSZ, &w) == 0) { | ||
8152 | if (w.ws_col > 0) cols = w.ws_col; | ||
8153 | } | ||
8154 | #endif | ||
8155 | if (cols == 0) { | ||
8156 | columns = getenv("COLUMNS"); | ||
8157 | if (columns != NULL) { | ||
8158 | cols = atoi(columns); | ||
8159 | if (cols <= 0) cols = 0; | ||
8160 | } | ||
8161 | } | ||
8162 | |||
8163 | if (cols == 0) { | ||
8164 | /* Fallback */ | ||
8165 | cols = 80; | ||
8166 | } | ||
8167 | } | ||
8168 | #endif | ||
8169 | |||
8170 | while (Parameters[j].Function != NULL) { | ||
8171 | k = 0; | ||
8172 | disp = false; | ||
8173 | if (!strcmp(argv[2],"all")) { | ||
8174 | if (j==0) disp = true; | ||
8175 | if (j!=0) { | ||
8176 | if (strcmp(Parameters[j].help,Parameters[j-1].help)) { | ||
8177 | disp = true; | ||
8178 | } else { | ||
8179 | if (strcmp(Parameters[j].parameter,Parameters[j-1].parameter)) { | ||
8180 | disp = true; | ||
8181 | } | ||
8182 | } | ||
8183 | } | ||
8184 | } else { | ||
8185 | while (Parameters[j].help_cat[k] != 0) { | ||
8186 | if (Parameters[j].help_cat[k] == HelpDescriptions[i].category) { | ||
8187 | disp = true; | ||
8188 | break; | ||
8189 | } | ||
8190 | k++; | ||
8191 | } | ||
8192 | } | ||
8193 | if (disp) { | ||
8194 | printf("%s", Parameters[j].parameter); | ||
8195 | if (Parameters[j].help[0] == 0) { | ||
8196 | printf("\n"); | ||
8197 | } else { | ||
8198 | HelpSplit(cols - 1, strlen(Parameters[j].parameter) + 1, Parameters[j].help); | ||
8199 | } | ||
8200 | } | ||
8201 | j++; | ||
8202 | } | ||
8203 | } | ||
8204 | #if 0 | ||
8205 | #endif // 0 | ||
8206 | int main(int argc, char *argv[]) | ||
8207 | { | ||
8208 | |||
8209 | //fprintf(stderr,"HIIIIIIIIIIIII \n"); | ||
8210 | //#if 0 | ||
8211 | static int z ,start,i; | ||
8212 | static intonly_config ; | ||
8213 | #if !defined(WIN32) && defined(LOCALE_PATH) | ||
8214 | static char*locale, locale_file[201]; | ||
8215 | #endif | ||
8216 | static char*cp; | ||
8217 | static boolcount_failed; | ||
8218 | z = 0; | ||
8219 | start=0;only_config = -1;count_failed = false; | ||
8220 | s.opened = false; | ||
8221 | s.msg = NULL; | ||
8222 | s.ConfigNum = 0; | ||
8223 | |||
8224 | setlocale(LC_ALL, ""); | ||
8225 | #ifdef DEBUG | ||
8226 | di.dl = DL_TEXTALL; | ||
8227 | di.df = stdout; | ||
8228 | #endif | ||
8229 | //#if 0 | ||
8230 | /* Any parameters? */ | ||
8231 | if (argc == 1) { | ||
8232 | HelpGeneral(); | ||
8233 | printmsg("Too few parameters!\n"); | ||
8234 | exit(1); | ||
8235 | } | ||
8236 | |||
8237 | /* Help? */ | ||
8238 | if (strncmp(argv[1 + start], "--help", 6) == 0) { | ||
8239 | Help(argc - start, argv + start); | ||
8240 | exit(1); | ||
8241 | } | ||
8242 | |||
8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ | ||
8244 | if (isdigit(argv[1][0])) { | ||
8245 | only_config = atoi(argv[1]); | ||
8246 | if (only_config >= 0) start++; else only_config = -1; | ||
8247 | } | ||
8248 | |||
8249 | cfg=GSM_FindGammuRC(); | ||
8250 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | ||
8251 | if (cfg!=NULL) { | ||
8252 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); | ||
8253 | if (cp) di.coding = cp; | ||
8254 | |||
8255 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); | ||
8256 | if (s.Config[i].Localize) { | ||
8257 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | ||
8258 | } else { | ||
8259 | #if !defined(WIN32) && defined(LOCALE_PATH) | ||
8260 | locale = setlocale(LC_MESSAGES, NULL); | ||
8261 | if (locale != NULL) { | ||
8262 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | ||
8263 | LOCALE_PATH, | ||
8264 | tolower(locale[0]), | ||
8265 | tolower(locale[1])); | ||
8266 | s.msg = INI_ReadFile(locale_file, true); | ||
8267 | } | ||
8268 | #endif | ||
8269 | } | ||
8270 | } | ||
8271 | |||
8272 | /* Wanted user specific configuration? */ | ||
8273 | if (only_config != -1) { | ||
8274 | /* Here we get only in first for loop */ | ||
8275 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; | ||
8276 | } else { | ||
8277 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | ||
8278 | } | ||
8279 | s.ConfigNum++; | ||
8280 | |||
8281 | /* We want to use only one file descriptor for global and state machine debug output */ | ||
8282 | s.Config[i].UseGlobalDebugFile = true; | ||
8283 | |||
8284 | /* It makes no sense to open several debug logs... */ | ||
8285 | if (i != 0) { | ||
8286 | strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel); | ||
8287 | free(s.Config[i].DebugFile); | ||
8288 | s.Config[i].DebugFile = strdup(s.Config[0].DebugFile); | ||
8289 | } else { | ||
8290 | /* Just for first config */ | ||
8291 | /* When user gave debug level on command line */ | ||
8292 | if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) { | ||
8293 | /* Debug level from command line will be used with phone too */ | ||
8294 | strcpy(s.Config[i].DebugLevel,argv[1 + start]); | ||
8295 | start++; | ||
8296 | } else { | ||
8297 | /* Try to set debug level from config file */ | ||
8298 | GSM_SetDebugLevel(s.Config[i].DebugLevel, &di); | ||
8299 | } | ||
8300 | /* If user gave debug file in gammurc, we will use it */ | ||
8301 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); | ||
8302 | Print_Error(error); | ||
8303 | } | ||
8304 | |||
8305 | /* We wanted to read just user specified configuration. */ | ||
8306 | if (only_config != -1) {break;} | ||
8307 | } | ||
8308 | |||
8309 | /* Do we have enough parameters? */ | ||
8310 | if (argc == 1 + start) { | ||
8311 | HelpGeneral(); | ||
8312 | printmsg("Too few parameters!\n"); | ||
8313 | exit(-2); | ||
8314 | } | ||
8315 | |||
8316 | /* Check used version vs. compiled */ | ||
8317 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { | ||
8318 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", | ||
8319 | GetGammuVersion(),VERSION); | ||
8320 | exit(-1); | ||
8321 | } | ||
8322 | |||
8323 | /* Check parameters */ | ||
8324 | while (Parameters[z].Function != NULL) { | ||
8325 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { | ||
8326 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { | ||
8327 | Parameters[z].Function(argc - start, argv + start); | ||
8328 | break; | ||
8329 | } else { | ||
8330 | count_failed = true; | ||
8331 | } | ||
8332 | } | ||
8333 | z++; | ||
8334 | } | ||
8335 | |||
8336 | /* Tell user when we did nothing */ | ||
8337 | if (Parameters[z].Function == NULL) { | ||
8338 | HelpGeneral(); | ||
8339 | if (count_failed) { | ||
8340 | printmsg("Bad parameter count!\n"); | ||
8341 | } else { | ||
8342 | printmsg("Bad option!\n"); | ||
8343 | } | ||
8344 | } | ||
8345 | |||
8346 | /* Close debug output if opened */ | ||
8347 | if (di.df!=stdout) fclose(di.df); | ||
8348 | //#endif // 0 | ||
8349 | fprintf(stderr,"kammu: Success. End. \n"); | ||
8350 | exit(0); | ||
8351 | } | ||
8352 | |||
8353 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
8354 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
8355 | */ | ||
8356 | |||
diff --git a/gammu/emb/gammu/gammu.h b/gammu/emb/gammu/gammu.h new file mode 100644 index 0000000..d3de31b --- a/dev/null +++ b/gammu/emb/gammu/gammu.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek and Michal Cihar */ | ||
2 | |||
3 | #include "../common/config.h" | ||
4 | #include "../common/misc/misc.h" | ||
5 | #include "../common/gsmstate.h" | ||
6 | |||
7 | typedef enum { | ||
8 | H_Call=1, | ||
9 | H_SMS, | ||
10 | H_Memory, | ||
11 | H_Filesystem, | ||
12 | H_Logo, | ||
13 | H_Ringtone, | ||
14 | H_Calendar, | ||
15 | H_ToDo, | ||
16 | H_Note, | ||
17 | H_DateTime, | ||
18 | H_Category, | ||
19 | H_Tests, | ||
20 | #ifdef GSM_ENABLE_BACKUP | ||
21 | H_Backup, | ||
22 | #endif | ||
23 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | ||
24 | H_Nokia, | ||
25 | #endif | ||
26 | #ifdef GSM_ENABLE_AT | ||
27 | H_Siemens, | ||
28 | #endif | ||
29 | H_Network, | ||
30 | H_WAP, | ||
31 | H_MMS, | ||
32 | H_FM, | ||
33 | H_Info, | ||
34 | H_Settings, | ||
35 | #ifdef DEBUG | ||
36 | H_Decode, | ||
37 | #endif | ||
38 | H_Other | ||
39 | } HelpCategory; | ||
40 | |||
41 | typedef struct { | ||
42 | HelpCategorycategory; | ||
43 | char *option; | ||
44 | char *description; | ||
45 | } HelpCategoryDescriptions; | ||
46 | |||
47 | typedef struct { | ||
48 | char *parameter; | ||
49 | int min_arg; | ||
50 | int max_arg; | ||
51 | void (*Function) (int argc, char *argv[]); | ||
52 | HelpCategoryhelp_cat[10]; | ||
53 | char *help; | ||
54 | } GSM_Parameters; | ||
55 | |||
56 | void Print_Error (GSM_Error error); | ||
57 | void GSM_Init (bool checkerror); | ||
58 | void GSM_Terminate (void); | ||
59 | |||
60 | static GSM_StateMachines; | ||
61 | static GSM_Phone_Functions*Phone; | ||
62 | static GSM_Error error; | ||
63 | |||
64 | static bool gshutdown; | ||
65 | |||
66 | void interrupt(int sign); | ||
67 | |||
68 | #ifdef GSM_ENABLE_BEEP | ||
69 | void GSM_PhoneBeep (void); | ||
70 | #endif | ||
71 | |||
72 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
73 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
74 | */ | ||
diff --git a/gammu/emb/gammu/gammu.pro b/gammu/emb/gammu/gammu.pro new file mode 100644 index 0000000..bd683c4 --- a/dev/null +++ b/gammu/emb/gammu/gammu.pro | |||
@@ -0,0 +1,52 @@ | |||
1 | ###################################################################### | ||
2 | # Automatically generated by qmake (1.07a) Fri Jul 30 22:22:02 2004 | ||
3 | ###################################################################### | ||
4 | |||
5 | TEMPLATE = app | ||
6 | DEPENDPATH += msvc06.mak \ | ||
7 | msvc2003.mak \ | ||
8 | smsd \ | ||
9 | depend/nokia \ | ||
10 | depend/siemens \ | ||
11 | depend/nokia/dct3trac | ||
12 | INCLUDEPATH += . smsd depend/nokia depend/nokia/dct3trac depend/siemens | ||
13 | CONFIG = qt warn_off release | ||
14 | # Input | ||
15 | |||
16 | HEADERS += gammu.h \ | ||
17 | sniff.h \ | ||
18 | smsd/s_files.h \ | ||
19 | smsd/s_mysql.h \ | ||
20 | smsd/smsdcore.h \ | ||
21 | depend/nokia/dct3.h \ | ||
22 | depend/nokia/dct4.h \ | ||
23 | depend/siemens/chiffre.h \ | ||
24 | depend/siemens/dsiemens.h \ | ||
25 | depend/nokia/dct3trac/type-cc.h \ | ||
26 | depend/nokia/dct3trac/type-mm.h \ | ||
27 | depend/nokia/dct3trac/type-rr.h \ | ||
28 | depend/nokia/dct3trac/type-sms.h \ | ||
29 | depend/nokia/dct3trac/type-ss.h \ | ||
30 | depend/nokia/dct3trac/wmx-gsm.h \ | ||
31 | depend/nokia/dct3trac/wmx-list.h \ | ||
32 | depend/nokia/dct3trac/wmx-sim.h \ | ||
33 | depend/nokia/dct3trac/wmx-util.h \ | ||
34 | depend/nokia/dct3trac/wmx.h | ||
35 | SOURCES += gammu.c \ | ||
36 | sniff.c \ | ||
37 | smsd/s_files.c \ | ||
38 | smsd/smsdcore.c \ | ||
39 | depend/nokia/dct3.c \ | ||
40 | depend/nokia/dct4.c \ | ||
41 | depend/siemens/chiffre.c \ | ||
42 | depend/siemens/dsiemens.c \ | ||
43 | depend/nokia/dct3trac/wmx-gsm.c \ | ||
44 | depend/nokia/dct3trac/wmx-list.c \ | ||
45 | depend/nokia/dct3trac/wmx-sim.c \ | ||
46 | depend/nokia/dct3trac/wmx-util.c \ | ||
47 | depend/nokia/dct3trac/wmx.c | ||
48 | |||
49 | LIBS += ../../../bin/libmicrogammu.so /usr/lib/libbluetooth.so /usr/lib/libsdp.so /usr/lib/libpthread.so | ||
50 | DESTDIR = ../../../bin | ||
51 | OBJECTS_DIR = obj/unix | ||
52 | TARGET = kammu \ No newline at end of file | ||
diff --git a/gammu/emb/gammu/gammuE.pro b/gammu/emb/gammu/gammuE.pro new file mode 100644 index 0000000..a1028cb --- a/dev/null +++ b/gammu/emb/gammu/gammuE.pro | |||
@@ -0,0 +1,55 @@ | |||
1 | ###################################################################### | ||
2 | # Automatically generated by qmake (1.07a) Fri Jul 30 22:22:02 2004 | ||
3 | ###################################################################### | ||
4 | |||
5 | TEMPLATE = app | ||
6 | DEPENDPATH += msvc06.mak \ | ||
7 | msvc2003.mak \ | ||
8 | smsd \ | ||
9 | depend/nokia \ | ||
10 | depend/siemens \ | ||
11 | depend/nokia/dct3trac | ||
12 | INCLUDEPATH += . smsd depend/nokia depend/nokia/dct3trac depend/siemens | ||
13 | CONFIG = qt warn_off release | ||
14 | # Input | ||
15 | |||
16 | HEADERS += gammu.h \ | ||
17 | sniff.h \ | ||
18 | smsd/s_files.h \ | ||
19 | smsd/s_mysql.h \ | ||
20 | smsd/smsdcore.h \ | ||
21 | depend/nokia/dct3.h \ | ||
22 | depend/nokia/dct4.h \ | ||
23 | depend/siemens/chiffre.h \ | ||
24 | depend/siemens/dsiemens.h \ | ||
25 | depend/nokia/dct3trac/type-cc.h \ | ||
26 | depend/nokia/dct3trac/type-mm.h \ | ||
27 | depend/nokia/dct3trac/type-rr.h \ | ||
28 | depend/nokia/dct3trac/type-sms.h \ | ||
29 | depend/nokia/dct3trac/type-ss.h \ | ||
30 | depend/nokia/dct3trac/wmx-gsm.h \ | ||
31 | depend/nokia/dct3trac/wmx-list.h \ | ||
32 | depend/nokia/dct3trac/wmx-sim.h \ | ||
33 | depend/nokia/dct3trac/wmx-util.h \ | ||
34 | depend/nokia/dct3trac/wmx.h | ||
35 | SOURCES += gammu.c \ | ||
36 | sniff.c \ | ||
37 | smsd/s_files.c \ | ||
38 | smsd/smsdcore.c \ | ||
39 | depend/nokia/dct3.c \ | ||
40 | depend/nokia/dct4.c \ | ||
41 | depend/siemens/chiffre.c \ | ||
42 | depend/siemens/dsiemens.c \ | ||
43 | depend/nokia/dct3trac/wmx-gsm.c \ | ||
44 | depend/nokia/dct3trac/wmx-list.c \ | ||
45 | depend/nokia/dct3trac/wmx-sim.c \ | ||
46 | depend/nokia/dct3trac/wmx-util.c \ | ||
47 | depend/nokia/dct3trac/wmx.c | ||
48 | |||
49 | LIBS += -lmicrogammu | ||
50 | LIBS += -lbluetooth | ||
51 | LIBS += -lsdp | ||
52 | LIBS += -lpthread | ||
53 | DESTDIR=$(QPEDIR)/bin | ||
54 | OBJECTS_DIR = obj/$(PLATFORM) | ||
55 | TARGET = kammu \ No newline at end of file | ||
diff --git a/gammu/emb/gammu/smsd/s_files.c b/gammu/emb/gammu/smsd/s_files.c new file mode 100644 index 0000000..dac8d9c --- a/dev/null +++ b/gammu/emb/gammu/smsd/s_files.c | |||
@@ -0,0 +1,313 @@ | |||
1 | /* (c) 2002-2003 by Joergen Thomsen */ | ||
2 | |||
3 | #include "../../cfg/config.h" | ||
4 | |||
5 | #include <string.h> | ||
6 | #include <stdio.h> | ||
7 | #include <errno.h> | ||
8 | #include <time.h> | ||
9 | #ifdef WIN32 | ||
10 | # include <io.h> | ||
11 | #endif | ||
12 | #if defined HAVE_DIRENT_H && defined HAVE_SCANDIR && defined HAVE_ALPHASORT | ||
13 | # include <dirent.h> | ||
14 | #endif | ||
15 | |||
16 | #include "../../common/misc/coding/coding.h" | ||
17 | #include "../../common/service/backup/gsmback.h" | ||
18 | #include "smsdcore.h" | ||
19 | |||
20 | /* Save SMS from phone (called Inbox sms - it's in phone Inbox) somewhere */ | ||
21 | static GSM_Error SMSDFiles_SaveInboxSMS(GSM_MultiSMSMessage sms, GSM_SMSDConfig *Config) | ||
22 | { | ||
23 | GSM_Errorerror = ERR_NONE; | ||
24 | int i,j; | ||
25 | unsigned char FileName[100], FullName[400], ext[4], buffer[64],buffer2[400]; | ||
26 | bool done; | ||
27 | FILE *file; | ||
28 | #ifdef GSM_ENABLE_BACKUP | ||
29 | GSM_SMS_Backup backup; | ||
30 | #endif | ||
31 | |||
32 | j = 0; | ||
33 | done = false; | ||
34 | for (i=0;i<sms.Number && !done;i++) { | ||
35 | strcpy(ext, "txt"); | ||
36 | if (sms.SMS[i].Coding == SMS_Coding_8bit) strcpy(ext, "bin"); | ||
37 | DecodeUnicode(sms.SMS[i].Number,buffer2); | ||
38 | /* we loop on yy for the first SMS assuming that if xxxx_yy_00.ext is absent, | ||
39 | any xxxx_yy_01,02, must be garbage, that can be overwritten */ | ||
40 | file = NULL; | ||
41 | do { | ||
42 | sprintf(FileName, | ||
43 | "IN%02d%02d%02d_%02d%02d%02d_%02i_%s_%02i.%s", | ||
44 | sms.SMS[i].DateTime.Year, sms.SMS[i].DateTime.Month, sms.SMS[i].DateTime.Day, | ||
45 | sms.SMS[i].DateTime.Hour, sms.SMS[i].DateTime.Minute, sms.SMS[i].DateTime.Second, | ||
46 | j, buffer2, i, ext); | ||
47 | strcpy(FullName, Config->inboxpath); | ||
48 | strcat(FullName, FileName); | ||
49 | if (file) fclose(file); | ||
50 | file = fopen(FullName, "r"); | ||
51 | } while ((i == 0) && (file && (++j < 100))); | ||
52 | if (file) { | ||
53 | fclose(file); | ||
54 | if (i == 0) { | ||
55 | WriteSMSDLog("Cannot save %s. No available file names", FileName); | ||
56 | return ERR_CANTOPENFILE; | ||
57 | } | ||
58 | } | ||
59 | errno = 0; | ||
60 | |||
61 | if ((sms.SMS[i].PDU == SMS_Status_Report) && mystrncasecmp(Config->deliveryreport, "log", 3)) { | ||
62 | strcpy(buffer, DecodeUnicodeString(sms.SMS[i].Number)); | ||
63 | WriteSMSDLog("Delivery report: %s to %s", DecodeUnicodeString(sms.SMS[i].Text), buffer); | ||
64 | } else { | ||
65 | #ifdef GSM_ENABLE_BACKUP | ||
66 | if (mystrncasecmp(Config->inboxformat, "detail", 0)) { | ||
67 | for (j=0;j<sms.Number;j++) backup.SMS[j] = &sms.SMS[j]; | ||
68 | backup.SMS[sms.Number] = NULL; | ||
69 | error = GSM_SaveSMSBackupFile(FullName, &backup); | ||
70 | done = true; | ||
71 | } | ||
72 | #endif | ||
73 | if (!mystrncasecmp(Config->inboxformat, "detail", 0)) { | ||
74 | file = fopen(FullName, "wb"); | ||
75 | if (file) { | ||
76 | switch (sms.SMS[i].Coding) { | ||
77 | case SMS_Coding_Unicode: | ||
78 | case SMS_Coding_Default: | ||
79 | |||
80 | DecodeUnicode(sms.SMS[i].Text,buffer2); | ||
81 | if (mystrncasecmp(Config->inboxformat, "unicode", 0)) { | ||
82 | buffer[0] = 0xFE; | ||
83 | buffer[1] = 0xFF; | ||
84 | fwrite(buffer,1,2,file); | ||
85 | fwrite(sms.SMS[i].Text,1,strlen(buffer2)*2,file); | ||
86 | } else { | ||
87 | fwrite(buffer2,1,strlen(buffer2),file); | ||
88 | } | ||
89 | break; | ||
90 | case SMS_Coding_8bit: | ||
91 | fwrite(sms.SMS[i].Text,1,sms.SMS[i].Length,file); | ||
92 | } | ||
93 | fclose(file); | ||
94 | } else error = ERR_CANTOPENFILE; | ||
95 | } | ||
96 | if (error == ERR_NONE) { | ||
97 | WriteSMSDLog("%s %s", (sms.SMS[i].PDU == SMS_Status_Report?"Delivery report":"Received"), FileName); | ||
98 | } else { | ||
99 | WriteSMSDLog("Cannot save %s (%i)", FileName, errno); | ||
100 | return ERR_CANTOPENFILE; | ||
101 | } | ||
102 | } | ||
103 | } | ||
104 | return ERR_NONE; | ||
105 | } | ||
106 | |||
107 | /* Find one multi SMS to sending and return it (or return ERR_EMPTY) | ||
108 | * There is also set ID for SMS | ||
109 | */ | ||
110 | static GSM_Error SMSDFiles_FindOutboxSMS(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID) | ||
111 | { | ||
112 | GSM_Error error = ERR_NOTSUPPORTED; | ||
113 | GSM_MultiPartSMSInfo SMSInfo; | ||
114 | unsigned char FileName[100],FullName[400]; | ||
115 | unsigned char Buffer[(GSM_MAX_SMS_LENGTH*MAX_MULTI_SMS+1)*2]; | ||
116 | unsigned char Buffer2[(GSM_MAX_SMS_LENGTH*MAX_MULTI_SMS+1)*2]; | ||
117 | FILE *File; | ||
118 | int i, len, phlen; | ||
119 | char *pos1, *pos2; | ||
120 | #if defined HAVE_DIRENT_H && defined HAVE_SCANDIR & defined HAVE_ALPHASORT | ||
121 | struct dirent **namelist = NULL; | ||
122 | int l, m ,n; | ||
123 | |||
124 | strcpy(FullName, Config->outboxpath); | ||
125 | FullName[strlen(Config->outboxpath)-1] = '\0'; | ||
126 | n = scandir(FullName, &namelist, 0, alphasort); | ||
127 | m = 0; | ||
128 | while ((m < n) && ((*(namelist[m]->d_name) == '.') || | ||
129 | !mystrncasecmp(namelist[m]->d_name,"out", 3) || | ||
130 | ((strlen(namelist[m]->d_name) >= 4) && | ||
131 | !mystrncasecmp(&namelist[m]->d_name[strlen(namelist[m]->d_name)-4],".txt",4) | ||
132 | ) | ||
133 | ) | ||
134 | ) m++; | ||
135 | if (m < n) strcpy(FileName,namelist[m]->d_name); | ||
136 | for (l=0; l < n; l++) free(namelist[l]); | ||
137 | free(namelist); | ||
138 | namelist = NULL; | ||
139 | if (m >= n) return ERR_EMPTY; | ||
140 | error = ERR_NONE; | ||
141 | #else | ||
142 | #ifdef WIN32 | ||
143 | struct _finddata_t c_file; | ||
144 | long hFile; | ||
145 | |||
146 | strcpy(FullName, Config->outboxpath); | ||
147 | strcat(FullName, "OUT*.txt"); | ||
148 | if((hFile = _findfirst( FullName, &c_file )) == -1L ) { | ||
149 | return ERR_EMPTY; | ||
150 | } else { | ||
151 | strcpy(FileName,c_file.name); | ||
152 | } | ||
153 | _findclose( hFile ); | ||
154 | error = ERR_NONE; | ||
155 | #endif | ||
156 | #endif | ||
157 | if (error != ERR_NONE) return error; | ||
158 | |||
159 | strcpy(FullName, Config->outboxpath); | ||
160 | strcat(FullName, FileName); | ||
161 | |||
162 | File = fopen(FullName, "rb"); | ||
163 | len = fread(Buffer, 1, sizeof(Buffer)-2, File); | ||
164 | fclose(File); | ||
165 | if (len<2) return ERR_EMPTY; | ||
166 | |||
167 | if ((Buffer[0] != 0xFF || Buffer[1] != 0xFE) && | ||
168 | (Buffer[0] != 0xFE || Buffer[1] != 0xFF)) { | ||
169 | if (len > GSM_MAX_SMS_LENGTH*MAX_MULTI_SMS) len = GSM_MAX_SMS_LENGTH*MAX_MULTI_SMS; | ||
170 | EncodeUnicode(Buffer2, Buffer, len); | ||
171 | len = len*2; | ||
172 | memmove(Buffer, Buffer2, len); | ||
173 | } | ||
174 | |||
175 | Buffer[len] = 0; | ||
176 | Buffer[len+1] = 0; | ||
177 | ReadUnicodeFile(Buffer2,Buffer); | ||
178 | |||
179 | SMSInfo.ReplaceMessage = 0; | ||
180 | SMSInfo.Entries[0].Buffer= Buffer2; | ||
181 | SMSInfo.Class = -1; | ||
182 | SMSInfo.EntriesNum = 1; | ||
183 | if (mystrncasecmp(Config->transmitformat, "unicode", 0)) { | ||
184 | SMSInfo.Entries[0].ID = SMS_ConcatenatedTextLong; | ||
185 | SMSInfo.UnicodeCoding = true; | ||
186 | } else if (mystrncasecmp(Config->transmitformat, "7bit", 0)) { | ||
187 | SMSInfo.Entries[0].ID = SMS_ConcatenatedTextLong; | ||
188 | SMSInfo.UnicodeCoding = false; | ||
189 | } else { | ||
190 | /* auto */ | ||
191 | SMSInfo.Entries[0].ID = SMS_ConcatenatedAutoTextLong; | ||
192 | } | ||
193 | GSM_EncodeMultiPartSMS(&SMSInfo,sms); | ||
194 | |||
195 | pos1 = FileName; | ||
196 | strcpy(ID,FileName); | ||
197 | for (i = 1; i <= 3 && pos1 != NULL ; i++) pos1 = strchr(++pos1, '_'); | ||
198 | if (pos1 != NULL) { | ||
199 | /* OUT<priority><date>_<time>_<serialno>_<phone number>_<anything>.txt */ | ||
200 | pos2 = strchr(++pos1, '_'); | ||
201 | if (pos2 != NULL) { | ||
202 | phlen = strlen(pos1) - strlen(pos2); | ||
203 | } else { | ||
204 | /* something wrong */ | ||
205 | return ERR_UNKNOWN; | ||
206 | } | ||
207 | } else if (i == 2) { | ||
208 | /* OUTxxxxxxx.txt or OUTxxxxxxx */ | ||
209 | pos1 = &FileName[3]; | ||
210 | pos2 = strchr(pos1, '.'); | ||
211 | if (pos2 == NULL) { | ||
212 | phlen = strlen(pos1); | ||
213 | } else { | ||
214 | phlen = strlen(pos1) - strlen(pos2); | ||
215 | } | ||
216 | } else if (i == 4) { | ||
217 | /* OUT<priority>_<phone number>_<serialno>.txt */ | ||
218 | pos1 = strchr(FileName, '_'); | ||
219 | pos2 = strchr(++pos1, '_'); | ||
220 | phlen = strlen(pos1) - strlen(pos2); | ||
221 | } else { | ||
222 | /* something wrong */ | ||
223 | return ERR_UNKNOWN; | ||
224 | } | ||
225 | |||
226 | for (len=0;len<sms->Number;len++) { | ||
227 | EncodeUnicode(sms->SMS[len].Number, pos1, phlen); | ||
228 | } | ||
229 | |||
230 | #ifdef DEBUG | ||
231 | if (sms->Number != 0) { | ||
232 | DecodeUnicode(sms->SMS[0].Number,Buffer); | ||
233 | dbgprintf("Found %i sms to \"%s\" with text \"%s\" cod %i lgt %i udh: t %i l %i\n", | ||
234 | sms->Number, | ||
235 | Buffer, | ||
236 | DecodeUnicodeString(sms->SMS[0].Text), | ||
237 | sms->SMS[0].Coding, | ||
238 | sms->SMS[0].Length, | ||
239 | sms->SMS[0].UDH.Type, | ||
240 | sms->SMS[0].UDH.Length); | ||
241 | } else dbgprintf("error\n"); | ||
242 | #endif | ||
243 | |||
244 | return ERR_NONE; | ||
245 | } | ||
246 | |||
247 | /* After sending SMS is moved to Sent Items or Error Items. */ | ||
248 | static GSM_Error SMSDFiles_MoveSMS(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID, bool alwaysDelete, bool sent) | ||
249 | { | ||
250 | FILE *oFile,*iFile; | ||
251 | int ilen = 0, olen = 0; | ||
252 | char Buffer[(GSM_MAX_SMS_LENGTH*MAX_MULTI_SMS+1)*2],ifilename[400],ofilename[400]; | ||
253 | char*sourcepath, *destpath; | ||
254 | |||
255 | sourcepath = Config->outboxpath; | ||
256 | if (sent) { | ||
257 | destpath = Config->sentsmspath; | ||
258 | } else { | ||
259 | destpath = Config->errorsmspath; | ||
260 | } | ||
261 | |||
262 | strcpy(ifilename, sourcepath); | ||
263 | strcat(ifilename, ID); | ||
264 | strcpy(ofilename, destpath); | ||
265 | strcat(ofilename, ID); | ||
266 | |||
267 | #ifdef WIN32 | ||
268 | if (!mystrncasecmp(ifilename, ofilename, strlen(ofilename))) { | ||
269 | #else | ||
270 | if (strcmp(ifilename, ofilename) != 0) { | ||
271 | #endif | ||
272 | iFile = fopen(ifilename, "r"); | ||
273 | ilen = fread(Buffer, 1, sizeof(Buffer), iFile); | ||
274 | fclose(iFile); | ||
275 | oFile = fopen(ofilename, "w"); | ||
276 | olen = fwrite(Buffer, 1, ilen, oFile); | ||
277 | fclose(oFile); | ||
278 | } | ||
279 | if (ilen == olen) { | ||
280 | if ((strcmp(ifilename, "/") == 0) || (remove(ifilename) != 0)) { | ||
281 | WriteSMSDLog("Could not delete %s (%i)", ifilename, errno); | ||
282 | return ERR_UNKNOWN; | ||
283 | } | ||
284 | return ERR_NONE; | ||
285 | } else { | ||
286 | WriteSMSDLog("Error copying SMS %s -> %s", ifilename, ofilename); | ||
287 | if (alwaysDelete) { | ||
288 | if ((strcmp(ifilename, "/") == 0) || (remove(ifilename) != 0)) | ||
289 | WriteSMSDLog("Could not delete %s (%i)", ifilename, errno); | ||
290 | } | ||
291 | return ERR_UNKNOWN; | ||
292 | } | ||
293 | } | ||
294 | |||
295 | static GSM_Error SMSDFiles_AddSentSMSInfo(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID, int Part, bool OK) | ||
296 | { | ||
297 | if (OK) WriteSMSDLog("Transmitted %s (%s: %i) to %s", Config->SMSID, (Part == sms->Number?"total":"part"),Part,DecodeUnicodeString(sms->SMS[0].Number)); | ||
298 | |||
299 | return ERR_NONE; | ||
300 | } | ||
301 | |||
302 | GSM_SMSDService SMSDFiles = { | ||
303 | NONEFUNCTION, /* Init */ | ||
304 | SMSDFiles_SaveInboxSMS, | ||
305 | SMSDFiles_FindOutboxSMS, | ||
306 | SMSDFiles_MoveSMS, | ||
307 | NOTSUPPORTED, /* CreateOutboxSMS*/ | ||
308 | SMSDFiles_AddSentSMSInfo | ||
309 | }; | ||
310 | |||
311 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
312 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
313 | */ | ||
diff --git a/gammu/emb/gammu/smsd/s_files.h b/gammu/emb/gammu/smsd/s_files.h new file mode 100644 index 0000000..5cfa05f --- a/dev/null +++ b/gammu/emb/gammu/smsd/s_files.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* (c) 2002-2003 by Joergen Thomsen */ | ||
2 | |||
3 | extern GSM_SMSDService SMSDFiles; | ||
4 | |||
5 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
6 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
7 | */ | ||
diff --git a/gammu/emb/gammu/smsd/s_mysql.c b/gammu/emb/gammu/smsd/s_mysql.c new file mode 100644 index 0000000..dacc256 --- a/dev/null +++ b/gammu/emb/gammu/smsd/s_mysql.c | |||
@@ -0,0 +1,414 @@ | |||
1 | /* (c) 2004 by Marcin Wiacek */ | ||
2 | |||
3 | #include "../../cfg/config.h" | ||
4 | |||
5 | #ifdef HAVE_MYSQL_MYSQL_H | ||
6 | |||
7 | #include <string.h> | ||
8 | #include <stdio.h> | ||
9 | #include <errno.h> | ||
10 | #include <time.h> | ||
11 | #ifdef WIN32 | ||
12 | # include <windows.h> | ||
13 | # pragma comment(lib, "libmysql.lib") | ||
14 | #endif | ||
15 | |||
16 | #include "../../common/misc/coding/coding.h" | ||
17 | #include "../../common/service/backup/gsmback.h" | ||
18 | #include "smsdcore.h" | ||
19 | |||
20 | /* Connects to database */ | ||
21 | static GSM_Error SMSDMySQL_Init(GSM_SMSDConfig *Config) | ||
22 | { | ||
23 | mysql_init(&Config->DB); | ||
24 | if (!mysql_real_connect(&Config->DB,Config->PC,Config->user,Config->password,Config->database,0,NULL,0)) { | ||
25 | WriteSMSDLog("Error connecting to database: %s\n", mysql_error(&Config->DB)); | ||
26 | return ERR_UNKNOWN; | ||
27 | } | ||
28 | return ERR_NONE; | ||
29 | } | ||
30 | |||
31 | /* Save SMS from phone (called Inbox sms - it's in phone Inbox) somewhere */ | ||
32 | static GSM_Error SMSDMySQL_SaveInboxSMS(GSM_MultiSMSMessage sms, GSM_SMSDConfig *Config) | ||
33 | { | ||
34 | unsigned charbuffer[10000],buffer2[200],buffer3[2]; | ||
35 | int i,j,z; | ||
36 | |||
37 | for (i=0;i<sms.Number;i++) { | ||
38 | if ((sms.SMS[i].PDU == SMS_Status_Report) && mystrncasecmp(Config->deliveryreport, "log", 3)) { | ||
39 | strcpy(buffer, DecodeUnicodeString(sms.SMS[i].Number)); | ||
40 | WriteSMSDLog("Delivery report: %s to %s", DecodeUnicodeString(sms.SMS[i].Text), buffer); | ||
41 | continue; | ||
42 | } | ||
43 | if (sms.SMS[i].PDU != SMS_Deliver) continue; | ||
44 | buffer[0]=0; | ||
45 | sprintf(buffer+strlen(buffer),"INSERT INTO `Inbox` \ | ||
46 | (`DateTime`,`Text`,`SenderNumber`,`Coding`,`SMSCNumber`,`UDH`, \ | ||
47 | `Class`,`TextDecoded`) VALUES ('%04d%02d%02d%02d%02d%02d','", | ||
48 | sms.SMS[i].DateTime.Year,sms.SMS[i].DateTime.Month,sms.SMS[i].DateTime.Day, | ||
49 | sms.SMS[i].DateTime.Hour,sms.SMS[i].DateTime.Minute,sms.SMS[i].DateTime.Second); | ||
50 | switch (sms.SMS[i].Coding) { | ||
51 | case SMS_Coding_Unicode: | ||
52 | case SMS_Coding_Default: | ||
53 | EncodeHexUnicode(buffer+strlen(buffer),sms.SMS[i].Text,UnicodeLength(sms.SMS[i].Text)); | ||
54 | break; | ||
55 | case SMS_Coding_8bit: | ||
56 | EncodeHexBin(buffer+strlen(buffer),sms.SMS[i].Text,sms.SMS[i].Length); | ||
57 | } | ||
58 | sprintf(buffer+strlen(buffer),"','%s','",DecodeUnicodeString(sms.SMS[i].Number)); | ||
59 | switch (sms.SMS[i].Coding) { | ||
60 | case SMS_Coding_Unicode: | ||
61 | sprintf(buffer+strlen(buffer),"Unicode"); | ||
62 | break; | ||
63 | case SMS_Coding_Default: | ||
64 | sprintf(buffer+strlen(buffer),"Default"); | ||
65 | break; | ||
66 | case SMS_Coding_8bit: | ||
67 | sprintf(buffer+strlen(buffer),"8bit"); | ||
68 | break; | ||
69 | } | ||
70 | sprintf(buffer+strlen(buffer),"','%s'",DecodeUnicodeString(sms.SMS[i].SMSC.Number)); | ||
71 | if (sms.SMS[i].UDH.Type == UDH_NoUDH) { | ||
72 | sprintf(buffer+strlen(buffer),",''"); | ||
73 | } else { | ||
74 | sprintf(buffer+strlen(buffer),",'"); | ||
75 | EncodeHexBin(buffer+strlen(buffer),sms.SMS[i].UDH.Text,sms.SMS[i].UDH.Length); | ||
76 | sprintf(buffer+strlen(buffer),"'"); | ||
77 | } | ||
78 | sprintf(buffer+strlen(buffer),",'%i','",sms.SMS[i].Class); | ||
79 | switch (sms.SMS[i].Coding) { | ||
80 | case SMS_Coding_Unicode: | ||
81 | case SMS_Coding_Default: | ||
82 | sprintf(buffer2,"%s",DecodeUnicodeString(sms.SMS[i].Text)); | ||
83 | for (j=0;j<(int)strlen(buffer2);j++) { | ||
84 | sprintf(buffer3,"'"); | ||
85 | z = strlen(buffer); | ||
86 | if (buffer2[j]==buffer3[0]) { | ||
87 | buffer[z+2]=0; | ||
88 | buffer[z+1]=buffer2[j]; | ||
89 | buffer[z] ='\\'; | ||
90 | } else { | ||
91 | buffer[z+1]=0; | ||
92 | buffer[z] =buffer2[j]; | ||
93 | } | ||
94 | } | ||
95 | break; | ||
96 | case SMS_Coding_8bit: | ||
97 | break; | ||
98 | } | ||
99 | sprintf(buffer+strlen(buffer),"')"); | ||
100 | if (mysql_real_query(&Config->DB,buffer,strlen(buffer))) { | ||
101 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
102 | return ERR_UNKNOWN; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | return ERR_NONE; | ||
107 | } | ||
108 | |||
109 | /* Find one multi SMS to sending and return it (or return ERR_EMPTY) | ||
110 | * There is also set ID for SMS | ||
111 | */ | ||
112 | static GSM_Error SMSDMySQL_FindOutboxSMS(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID) | ||
113 | { | ||
114 | unsigned char buf[400]; | ||
115 | MYSQL_RES *Res; | ||
116 | MYSQL_ROW Row; | ||
117 | int i; | ||
118 | |||
119 | sprintf(buf, "SELECT ID,DateTime FROM `Outbox` WHERE 1"); | ||
120 | if (mysql_real_query(&Config->DB,buf,strlen(buf))) { | ||
121 | WriteSMSDLog("Error reading from database: %s\n", mysql_error(&Config->DB)); | ||
122 | return ERR_UNKNOWN; | ||
123 | } | ||
124 | if (!(Res = mysql_store_result(&Config->DB))) { | ||
125 | WriteSMSDLog("Error reading from database: %s\n", mysql_error(&Config->DB)); | ||
126 | return ERR_UNKNOWN; | ||
127 | } | ||
128 | if (!(Row = mysql_fetch_row(Res))) { | ||
129 | mysql_free_result(Res); | ||
130 | return ERR_EMPTY; | ||
131 | } | ||
132 | sprintf(ID,"%s",Row[0]); | ||
133 | sprintf(Config->DT,"%s",Row[1]); | ||
134 | sms->Number = 0; | ||
135 | for (i=1;i<10;i++) { | ||
136 | GSM_SetDefaultSMSData(&sms->SMS[sms->Number]); | ||
137 | if (i==1) { | ||
138 | sprintf(buf, "SELECT Text,DestinationNumber,Coding,UDH,SMSCNumber,Class,TextDecoded,ID,MultiPart FROM `Outbox` WHERE ID='%s'",ID); | ||
139 | } else { | ||
140 | sprintf(buf, "SELECT Text,DestinationNumber,Coding,UDH,SMSCNumber,Class,TextDecoded,ID,SequencePosition FROM `Outbox_MultiPart` WHERE ID='%s' AND SequencePosition='%i'",ID,i); | ||
141 | } | ||
142 | if (mysql_real_query(&Config->DB,buf,strlen(buf))) { | ||
143 | WriteSMSDLog("Error reading from database: %s\n", mysql_error(&Config->DB)); | ||
144 | return ERR_UNKNOWN; | ||
145 | } | ||
146 | if (!(Res = mysql_store_result(&Config->DB))) { | ||
147 | WriteSMSDLog("Error reading from database: %s\n", mysql_error(&Config->DB)); | ||
148 | return ERR_UNKNOWN; | ||
149 | } | ||
150 | if (!(Row = mysql_fetch_row(Res))) { | ||
151 | mysql_free_result(Res); | ||
152 | return ERR_NONE; | ||
153 | } | ||
154 | |||
155 | sms->SMS[sms->Number].Coding=SMS_Coding_Default; | ||
156 | if (!strcmp(Row[2],"Unicode")) sms->SMS[sms->Number].Coding=SMS_Coding_Unicode; | ||
157 | if (!strcmp(Row[2],"8bit")) sms->SMS[sms->Number].Coding=SMS_Coding_8bit; | ||
158 | |||
159 | if (strlen(Row[0])==0) { | ||
160 | EncodeUnicode(sms->SMS[sms->Number].Text,Row[6],strlen(Row[6])); | ||
161 | } else { | ||
162 | switch (sms->SMS[sms->Number].Coding) { | ||
163 | case SMS_Coding_Unicode: | ||
164 | case SMS_Coding_Default: | ||
165 | DecodeHexUnicode(sms->SMS[sms->Number].Text,Row[0],strlen(Row[0])); | ||
166 | break; | ||
167 | case SMS_Coding_8bit: | ||
168 | DecodeHexBin(sms->SMS[sms->Number].Text,Row[0],strlen(Row[0])); | ||
169 | sms->SMS[sms->Number].Length=strlen(Row[0])/2; | ||
170 | } | ||
171 | } | ||
172 | EncodeUnicode(sms->SMS[sms->Number].Number,Row[1],strlen(Row[1])); | ||
173 | sms->SMS[sms->Number].UDH.Type = UDH_NoUDH; | ||
174 | if (strlen(Row[3])!=0) { | ||
175 | sms->SMS[sms->Number].UDH.Type = UDH_UserUDH; | ||
176 | sms->SMS[sms->Number].UDH.Length = strlen(Row[3])/2; | ||
177 | DecodeHexBin(sms->SMS[sms->Number].UDH.Text,Row[3],strlen(Row[3])); | ||
178 | } | ||
179 | EncodeUnicode(sms->SMS[sms->Number].SMSC.Number,Row[4],strlen(Row[4])); | ||
180 | sms->SMS[sms->Number].Class = atoi(Row[5]); | ||
181 | sms->SMS[sms->Number].PDU = SMS_Submit; | ||
182 | sms->SMS[sms->Number].SMSC.Location = 0; | ||
183 | sms->Number++; | ||
184 | if (i == 1 && !strcmp(Row[8],"false")) break; | ||
185 | } | ||
186 | return ERR_NONE; | ||
187 | } | ||
188 | |||
189 | /* After sending SMS is moved to Sent Items or Error Items. */ | ||
190 | static GSM_Error SMSDMySQL_MoveSMS(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID, bool alwaysDelete, bool sent) | ||
191 | { | ||
192 | char *status; | ||
193 | unsigned charbuffer[10000],buffer2[200],buffer3[2]; | ||
194 | int i,j,z; | ||
195 | |||
196 | if (sent) status = "OK"; else status = "Error"; | ||
197 | |||
198 | for (i=0;i<sms->Number;i++) { | ||
199 | buffer[0]=0; | ||
200 | sprintf(buffer+strlen(buffer),"UPDATE `SentItems` SET `Text`='"); | ||
201 | |||
202 | switch (sms->SMS[i].Coding) { | ||
203 | case SMS_Coding_Unicode: | ||
204 | case SMS_Coding_Default: | ||
205 | EncodeHexUnicode(buffer+strlen(buffer),sms->SMS[i].Text,UnicodeLength(sms->SMS[i].Text)); | ||
206 | break; | ||
207 | case SMS_Coding_8bit: | ||
208 | EncodeHexBin(buffer+strlen(buffer),sms->SMS[i].Text,sms->SMS[i].Length); | ||
209 | } | ||
210 | |||
211 | sprintf(buffer+strlen(buffer),"',`DestinationNumber`='%s',`Coding`='",DecodeUnicodeString(sms->SMS[i].Number)); | ||
212 | |||
213 | switch (sms->SMS[i].Coding) { | ||
214 | case SMS_Coding_Unicode: | ||
215 | sprintf(buffer+strlen(buffer),"Unicode"); | ||
216 | break; | ||
217 | case SMS_Coding_Default: | ||
218 | sprintf(buffer+strlen(buffer),"Default"); | ||
219 | break; | ||
220 | case SMS_Coding_8bit: | ||
221 | sprintf(buffer+strlen(buffer),"8bit"); | ||
222 | break; | ||
223 | } | ||
224 | |||
225 | sprintf(buffer+strlen(buffer),"',`SMSCNumber`='%s',`UDH`='",DecodeUnicodeString(sms->SMS[i].SMSC.Number)); | ||
226 | if (sms->SMS[i].UDH.Type != UDH_NoUDH) { | ||
227 | EncodeHexBin(buffer+strlen(buffer),sms->SMS[i].UDH.Text,sms->SMS[i].UDH.Length); | ||
228 | } | ||
229 | |||
230 | sprintf(buffer+strlen(buffer),"',`Class`='%i',`TextDecoded`='",sms->SMS[i].Class); | ||
231 | switch (sms->SMS[i].Coding) { | ||
232 | case SMS_Coding_Unicode: | ||
233 | case SMS_Coding_Default: | ||
234 | sprintf(buffer2,"%s",DecodeUnicodeString(sms->SMS[i].Text)); | ||
235 | for (j=0;j<(int)strlen(buffer2);j++) { | ||
236 | sprintf(buffer3,"'"); | ||
237 | z = strlen(buffer); | ||
238 | if (buffer2[j]==buffer3[0]) { | ||
239 | buffer[z+2]=0; | ||
240 | buffer[z+1]=buffer2[j]; | ||
241 | buffer[z] ='\\'; | ||
242 | } else { | ||
243 | buffer[z+1]=0; | ||
244 | buffer[z] =buffer2[j]; | ||
245 | } | ||
246 | } | ||
247 | break; | ||
248 | case SMS_Coding_8bit: | ||
249 | break; | ||
250 | } | ||
251 | sprintf(buffer+strlen(buffer),"',`Status`='%s',`DateTime`='%s' ",status,Config->DT); | ||
252 | sprintf(buffer+strlen(buffer),"WHERE `ID`='%s' AND `SequencePosition`='%i'",ID,i+1); | ||
253 | if (mysql_real_query(&Config->DB,buffer,strlen(buffer))) { | ||
254 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
255 | return ERR_UNKNOWN; | ||
256 | } | ||
257 | } | ||
258 | sprintf(buffer,"DELETE FROM `Outbox` WHERE `ID` = '%s'",ID); | ||
259 | if (mysql_real_query(&Config->DB,buffer,strlen(buffer))) { | ||
260 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
261 | return ERR_UNKNOWN; | ||
262 | } | ||
263 | sprintf(buffer,"DELETE FROM `Outbox_MultiPart` WHERE `ID` = '%s'",ID); | ||
264 | if (mysql_real_query(&Config->DB,buffer,strlen(buffer))) { | ||
265 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
266 | return ERR_UNKNOWN; | ||
267 | } | ||
268 | return ERR_NONE; | ||
269 | } | ||
270 | |||
271 | /* Adds SMS to Outbox */ | ||
272 | static GSM_Error SMSDMySQL_CreateOutboxSMS(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config) | ||
273 | { | ||
274 | unsigned charbuffer[10000],buffer2[200],buffer3[2],buffer4[10000]; | ||
275 | int i,j,z; | ||
276 | GSM_DateTimetime; | ||
277 | |||
278 | for (i=0;i<sms->Number;i++) { | ||
279 | buffer[0]=0; | ||
280 | if (i==0) { | ||
281 | sprintf(buffer+strlen(buffer),"INSERT INTO `Outbox` (`MultiPart`,`DateTime"); | ||
282 | } else { | ||
283 | sprintf(buffer+strlen(buffer),"INSERT INTO `Outbox_MultiPart` (`SequencePosition"); | ||
284 | } | ||
285 | sprintf(buffer+strlen(buffer),"`,`Text`,`DestinationNumber`,`Coding`,`SMSCNumber`,`UDH`, \ | ||
286 | `Class`,`TextDecoded`,`ID`) VALUES ('"); | ||
287 | if (i==0) { | ||
288 | if (sms->Number == 1) { | ||
289 | sprintf(buffer+strlen(buffer),"false"); | ||
290 | } else { | ||
291 | sprintf(buffer+strlen(buffer),"true"); | ||
292 | } | ||
293 | sprintf(buffer+strlen(buffer),"',NOW()"); | ||
294 | } else { | ||
295 | sprintf(buffer+strlen(buffer),"%i'",i+1); | ||
296 | } | ||
297 | sprintf(buffer+strlen(buffer),",'"); | ||
298 | |||
299 | switch (sms->SMS[i].Coding) { | ||
300 | case SMS_Coding_Unicode: | ||
301 | case SMS_Coding_Default: | ||
302 | EncodeHexUnicode(buffer+strlen(buffer),sms->SMS[i].Text,UnicodeLength(sms->SMS[i].Text)); | ||
303 | break; | ||
304 | case SMS_Coding_8bit: | ||
305 | EncodeHexBin(buffer+strlen(buffer),sms->SMS[i].Text,sms->SMS[i].Length); | ||
306 | } | ||
307 | sprintf(buffer+strlen(buffer),"','%s','",DecodeUnicodeString(sms->SMS[i].Number)); | ||
308 | switch (sms->SMS[i].Coding) { | ||
309 | case SMS_Coding_Unicode: | ||
310 | sprintf(buffer+strlen(buffer),"Unicode"); | ||
311 | break; | ||
312 | case SMS_Coding_Default: | ||
313 | sprintf(buffer+strlen(buffer),"Default"); | ||
314 | break; | ||
315 | case SMS_Coding_8bit: | ||
316 | sprintf(buffer+strlen(buffer),"8bit"); | ||
317 | break; | ||
318 | } | ||
319 | sprintf(buffer+strlen(buffer),"','%s'",DecodeUnicodeString(sms->SMS[i].SMSC.Number)); | ||
320 | if (sms->SMS[i].UDH.Type == UDH_NoUDH) { | ||
321 | sprintf(buffer+strlen(buffer),",''"); | ||
322 | } else { | ||
323 | sprintf(buffer+strlen(buffer),",'"); | ||
324 | EncodeHexBin(buffer+strlen(buffer),sms->SMS[i].UDH.Text,sms->SMS[i].UDH.Length); | ||
325 | sprintf(buffer+strlen(buffer),"'"); | ||
326 | } | ||
327 | sprintf(buffer+strlen(buffer),",'%i','",sms->SMS[i].Class); | ||
328 | switch (sms->SMS[i].Coding) { | ||
329 | case SMS_Coding_Unicode: | ||
330 | case SMS_Coding_Default: | ||
331 | sprintf(buffer2,"%s",DecodeUnicodeString(sms->SMS[i].Text)); | ||
332 | for (j=0;j<(int)strlen(buffer2);j++) { | ||
333 | sprintf(buffer3,"'"); | ||
334 | z = strlen(buffer); | ||
335 | if (buffer2[j]==buffer3[0]) { | ||
336 | buffer[z+2]=0; | ||
337 | buffer[z+1]=buffer2[j]; | ||
338 | buffer[z] ='\\'; | ||
339 | } else { | ||
340 | buffer[z+1]=0; | ||
341 | buffer[z] =buffer2[j]; | ||
342 | } | ||
343 | } | ||
344 | break; | ||
345 | case SMS_Coding_8bit: | ||
346 | |||
347 | break; | ||
348 | } | ||
349 | sprintf(buffer+strlen(buffer),"','"); | ||
350 | if (i==0) { | ||
351 | while (true) { | ||
352 | GSM_GetCurrentDateTime(&time); | ||
353 | buffer4[0] = 0; | ||
354 | strcpy(buffer4,buffer); | ||
355 | sprintf(buffer4+strlen(buffer4),"%i')", | ||
356 | time.Hour*1000000+ | ||
357 | time.Minute*10000+ | ||
358 | time.Second*100+time.Day); | ||
359 | if (mysql_real_query(&Config->DB,buffer4,strlen(buffer4))) { | ||
360 | if (mysql_errno(&Config->DB) == ER_DUP_ENTRY) { | ||
361 | WriteSMSDLog("Duplicated outgoing SMS ID\n"); | ||
362 | continue; | ||
363 | } | ||
364 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
365 | return ERR_UNKNOWN; | ||
366 | } | ||
367 | break; | ||
368 | } | ||
369 | } else { | ||
370 | strcpy(buffer4,buffer); | ||
371 | sprintf(buffer4+strlen(buffer4),"%i')", | ||
372 | time.Hour*1000000+ | ||
373 | time.Minute*10000+ | ||
374 | time.Second*100+time.Day); | ||
375 | if (mysql_real_query(&Config->DB,buffer4,strlen(buffer4))) { | ||
376 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
377 | return ERR_UNKNOWN; | ||
378 | } | ||
379 | } | ||
380 | } | ||
381 | return ERR_NONE; | ||
382 | } | ||
383 | |||
384 | static GSM_Error SMSDMySQL_AddSentSMSInfo(GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID, int Part, bool OK) | ||
385 | { | ||
386 | unsigned char buffer[10000]; | ||
387 | |||
388 | if (OK) WriteSMSDLog("Transmitted %s (%s: %i) to %s", Config->SMSID, (Part == sms->Number?"total":"part"),Part,DecodeUnicodeString(sms->SMS[0].Number)); | ||
389 | |||
390 | buffer[0] = 0; | ||
391 | sprintf(buffer+strlen(buffer),"INSERT INTO `SentItems` \ | ||
392 | (`ID`,`SequencePosition`,`Status`,`SendingDateTime`) VALUES ("); | ||
393 | sprintf(buffer+strlen(buffer),"'%s','%i','Sending',NOW())",ID,Part); | ||
394 | if (mysql_real_query(&Config->DB,buffer,strlen(buffer))) { | ||
395 | WriteSMSDLog("Error writing to database: %d %s\n", mysql_errno(&Config->DB), mysql_error(&Config->DB)); | ||
396 | return ERR_UNKNOWN; | ||
397 | } | ||
398 | return ERR_NONE; | ||
399 | } | ||
400 | |||
401 | GSM_SMSDService SMSDMySQL = { | ||
402 | SMSDMySQL_Init, | ||
403 | SMSDMySQL_SaveInboxSMS, | ||
404 | SMSDMySQL_FindOutboxSMS, | ||
405 | SMSDMySQL_MoveSMS, | ||
406 | SMSDMySQL_CreateOutboxSMS, | ||
407 | SMSDMySQL_AddSentSMSInfo | ||
408 | }; | ||
409 | |||
410 | #endif | ||
411 | |||
412 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
413 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
414 | */ | ||
diff --git a/gammu/emb/gammu/smsd/s_mysql.h b/gammu/emb/gammu/smsd/s_mysql.h new file mode 100644 index 0000000..e0928ea --- a/dev/null +++ b/gammu/emb/gammu/smsd/s_mysql.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* (c) 2004 by Marcin Wiacek */ | ||
2 | |||
3 | #ifdef HAVE_MYSQL_MYSQL_H | ||
4 | |||
5 | extern GSM_SMSDService SMSDMySQL; | ||
6 | |||
7 | #endif | ||
8 | |||
9 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
10 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
11 | */ | ||
diff --git a/gammu/emb/gammu/smsd/smsdcore.c b/gammu/emb/gammu/smsd/smsdcore.c new file mode 100644 index 0000000..fbc55d3 --- a/dev/null +++ b/gammu/emb/gammu/smsd/smsdcore.c | |||
@@ -0,0 +1,507 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek and Joergen Thomsen */ | ||
2 | |||
3 | #include <string.h> | ||
4 | #include <signal.h> | ||
5 | #include <stdarg.h> | ||
6 | #include <time.h> | ||
7 | |||
8 | #include "../../common/misc/coding/coding.h" | ||
9 | #include "../gammu.h" | ||
10 | #include "smsdcore.h" | ||
11 | #include "s_files.h" | ||
12 | #ifdef HAVE_MYSQL_MYSQL_H | ||
13 | # include "s_mysql.h" | ||
14 | #endif | ||
15 | |||
16 | FILE *smsd_log_file = NULL; | ||
17 | static GSM_Error SendingSMSStatus; | ||
18 | static void SMSSendingSMSStatus (char *Device, int status, int mr) | ||
19 | { | ||
20 | dbgprintf("Incoming SMS device: \"%s\" status=%d, reference=%d\n",Device, status, mr); | ||
21 | if (status==0) { | ||
22 | SendingSMSStatus = ERR_NONE; | ||
23 | } else { | ||
24 | SendingSMSStatus = ERR_UNKNOWN; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | void GSM_Terminate_SMSD(char *msg, int error, bool exitprogram, int rc) | ||
29 | { | ||
30 | int ret = ERR_NONE; | ||
31 | |||
32 | if (s.opened) { | ||
33 | WriteSMSDLog("Terminating communication"); | ||
34 | ret=GSM_TerminateConnection(&s); | ||
35 | if (ret!=ERR_NONE) { | ||
36 | printf("%s\n",print_error(error,s.di.df,s.msg)); | ||
37 | if (s.opened) GSM_TerminateConnection(&s); | ||
38 | } | ||
39 | } | ||
40 | if (error != 0) { | ||
41 | WriteSMSDLog(msg, error, print_error(error,s.di.df,s.msg)); | ||
42 | fprintf(stderr, msg, error, print_error(error,s.di.df,s.msg)); | ||
43 | fprintf(stderr, "\n"); | ||
44 | } | ||
45 | if (exitprogram) { | ||
46 | if (smsd_log_file!=NULL) fclose(smsd_log_file); | ||
47 | exit(rc); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | #ifdef __GNUC__ | ||
52 | __attribute__((format(printf, 1, 2))) | ||
53 | #endif | ||
54 | void WriteSMSDLog(char *format, ...) | ||
55 | { | ||
56 | GSM_DateTime date_time; | ||
57 | char Buffer[2000]; | ||
58 | va_list argp; | ||
59 | int result; | ||
60 | |||
61 | if (smsd_log_file != NULL) { | ||
62 | va_start(argp, format); | ||
63 | result = vsprintf(Buffer,GetMsg(s.msg,format),argp); | ||
64 | va_end(argp); | ||
65 | |||
66 | GSM_GetCurrentDateTime(&date_time); | ||
67 | |||
68 | fprintf(smsd_log_file,"%s %4d/%02d/%02d %02d:%02d:%02d : %s\n", | ||
69 | DayOfWeek(date_time.Year, date_time.Month, date_time.Day), | ||
70 | date_time.Year, date_time.Month, date_time.Day, | ||
71 | date_time.Hour, date_time.Minute, date_time.Second,Buffer); | ||
72 | fflush(smsd_log_file); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | void SMSD_ReadConfig(char *filename, GSM_SMSDConfig *Config, bool log) | ||
77 | { | ||
78 | INI_Section *smsdcfgfile = NULL; | ||
79 | GSM_Config smsdcfg; | ||
80 | unsigned char *str; | ||
81 | static unsigned charemptyPath[1] = "\0"; | ||
82 | |||
83 | smsdcfgfile=INI_ReadFile(filename, false); | ||
84 | if (smsdcfgfile==NULL) { | ||
85 | fprintf(stderr,"Can't find file \"%s\"\n",filename); | ||
86 | exit(-1); | ||
87 | } | ||
88 | |||
89 | Config->logfilename=INI_GetValue(smsdcfgfile, "smsd", "logfile", false); | ||
90 | if (Config->logfilename != NULL) { | ||
91 | smsd_log_file=fopen(Config->logfilename,"ab"); | ||
92 | if (smsd_log_file == NULL) { | ||
93 | fprintf(stderr,"Can't open file \"%s\"\n",Config->logfilename); | ||
94 | exit(-1); | ||
95 | } | ||
96 | fprintf(stderr,"Log filename is \"%s\"\n",Config->logfilename); | ||
97 | } | ||
98 | if (log) WriteSMSDLog("Start GAMMU smsd"); | ||
99 | |||
100 | /* Include Numbers used, because we don't want create new variable */ | ||
101 | Config->IncludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "gammu", false); | ||
102 | if (Config->IncludeNumbers) { | ||
103 | GSM_ReadConfig(smsdcfgfile, &smsdcfg, 0); | ||
104 | memcpy(&s.Config,&smsdcfg,sizeof(GSM_Config)); | ||
105 | } | ||
106 | |||
107 | Config->PINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false); | ||
108 | if (Config->PINCode == NULL) { | ||
109 | if (log) WriteSMSDLog("No PIN code in %s file",filename); | ||
110 | fprintf(stderr,"No PIN code in %s file\n",filename); | ||
111 | exit(-1); | ||
112 | } | ||
113 | if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode); | ||
114 | |||
115 | Config->user = INI_GetValue(smsdcfgfile, "smsd", "user", false); | ||
116 | if (Config->user == NULL) Config->user="root"; | ||
117 | Config->password = INI_GetValue(smsdcfgfile, "smsd", "password", false); | ||
118 | if (Config->password == NULL) Config->password=""; | ||
119 | Config->PC = INI_GetValue(smsdcfgfile, "smsd", "pc", false); | ||
120 | if (Config->PC == NULL) Config->PC="localhost"; | ||
121 | Config->database = INI_GetValue(smsdcfgfile, "smsd", "database", false); | ||
122 | if (Config->database == NULL) Config->database="sms"; | ||
123 | |||
124 | str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false); | ||
125 | if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1; | ||
126 | str = INI_GetValue(smsdcfgfile, "smsd", "sendtimeout", false); | ||
127 | if (str) Config->sendtimeout=atoi(str); else Config->sendtimeout = 10; | ||
128 | str = INI_GetValue(smsdcfgfile, "smsd", "receivefrequency", false); | ||
129 | if (str) Config->receivefrequency=atoi(str); else Config->receivefrequency = 0; | ||
130 | if (log) WriteSMSDLog("commtimeout=%i, sendtimeout=%i, receivefrequency=%i", Config->commtimeout, Config->sendtimeout, Config->receivefrequency); | ||
131 | |||
132 | Config->deliveryreport = INI_GetValue(smsdcfgfile, "smsd", "deliveryreport", false); | ||
133 | if (Config->deliveryreport == NULL || (!mystrncasecmp(Config->deliveryreport, "log", 3) && !mystrncasecmp(Config->deliveryreport, "sms", 3))) { | ||
134 | Config->deliveryreport = "no"; | ||
135 | } | ||
136 | if (log) WriteSMSDLog("deliveryreport = %s", Config->deliveryreport); | ||
137 | |||
138 | Config->inboxpath=INI_GetValue(smsdcfgfile, "smsd", "inboxpath", false); | ||
139 | if (Config->inboxpath == NULL) Config->inboxpath = emptyPath; | ||
140 | |||
141 | Config->inboxformat=INI_GetValue(smsdcfgfile, "smsd", "inboxformat", false); | ||
142 | if (Config->inboxformat == NULL || (!mystrncasecmp(Config->inboxformat, "detail", 6) && !mystrncasecmp(Config->inboxformat, "unicode", 7))) { | ||
143 | Config->inboxformat = "standard"; | ||
144 | } | ||
145 | if (log) WriteSMSDLog("Inbox is \"%s\" with format \"%s\"", Config->inboxpath, Config->inboxformat); | ||
146 | |||
147 | Config->outboxpath=INI_GetValue(smsdcfgfile, "smsd", "outboxpath", false); | ||
148 | if (Config->outboxpath == NULL) Config->outboxpath = emptyPath; | ||
149 | |||
150 | Config->transmitformat=INI_GetValue(smsdcfgfile, "smsd", "transmitformat", false); | ||
151 | if (Config->transmitformat == NULL || (!mystrncasecmp(Config->transmitformat, "auto", 4) && !mystrncasecmp(Config->transmitformat, "unicode", 7))) { | ||
152 | Config->transmitformat = "7bit"; | ||
153 | } | ||
154 | if (log) WriteSMSDLog("Outbox is \"%s\" with transmission format \"%s\"", Config->outboxpath, Config->transmitformat); | ||
155 | |||
156 | Config->sentsmspath=INI_GetValue(smsdcfgfile, "smsd", "sentsmspath", false); | ||
157 | if (Config->sentsmspath == NULL) Config->sentsmspath = Config->outboxpath; | ||
158 | if (log) WriteSMSDLog("Sent SMS moved to \"%s\"",Config->sentsmspath); | ||
159 | |||
160 | Config->errorsmspath=INI_GetValue(smsdcfgfile, "smsd", "errorsmspath", false); | ||
161 | if (Config->errorsmspath == NULL) Config->errorsmspath = Config->sentsmspath; | ||
162 | if (log) WriteSMSDLog("SMS with errors moved to \"%s\"",Config->errorsmspath); | ||
163 | |||
164 | Config->IncludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "include_numbers", false); | ||
165 | Config->ExcludeNumbers=INI_FindLastSectionEntry(smsdcfgfile, "exclude_numbers", false); | ||
166 | if (Config->IncludeNumbers != NULL) { | ||
167 | if (log) WriteSMSDLog("Include numbers available"); | ||
168 | } | ||
169 | if (Config->ExcludeNumbers != NULL) { | ||
170 | if (Config->IncludeNumbers == NULL) { | ||
171 | if (log) WriteSMSDLog("Exclude numbers available"); | ||
172 | } else { | ||
173 | if (log) WriteSMSDLog("Exclude numbers available, but IGNORED"); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | Config->retries = 0; | ||
178 | Config->prevSMSID[0] = 0; | ||
179 | } | ||
180 | |||
181 | bool SMSD_CheckSecurity(GSM_SMSDConfig *Config) | ||
182 | { | ||
183 | GSM_SecurityCode SecurityCode; | ||
184 | GSM_Error error; | ||
185 | |||
186 | /* Need PIN ? */ | ||
187 | error=Phone->GetSecurityStatus(&s,&SecurityCode.Type); | ||
188 | /* Unknown error */ | ||
189 | if (error != ERR_NOTSUPPORTED && error != ERR_NONE) { | ||
190 | WriteSMSDLog("Error getting security status (%i)", error); | ||
191 | return false; | ||
192 | } | ||
193 | /* No supported - do not check more */ | ||
194 | if (error == ERR_NOTSUPPORTED) return true; | ||
195 | /* If PIN, try to enter */ | ||
196 | switch (SecurityCode.Type) { | ||
197 | case SEC_Pin: | ||
198 | WriteSMSDLog("Trying to enter PIN"); | ||
199 | strcpy(SecurityCode.Code,Config->PINCode); | ||
200 | error=Phone->EnterSecurityCode(&s,SecurityCode); | ||
201 | if (error == ERR_SECURITYERROR) { | ||
202 | GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1); | ||
203 | } | ||
204 | if (error != ERR_NONE) { | ||
205 | WriteSMSDLog("Error entering PIN (%i)", error); | ||
206 | return false; | ||
207 | } | ||
208 | break; | ||
209 | case SEC_SecurityCode: | ||
210 | case SEC_Pin2: | ||
211 | case SEC_Puk: | ||
212 | case SEC_Puk2: | ||
213 | GSM_Terminate_SMSD("ERROR: phone requires not supported code type", 0, true, -1); | ||
214 | case SEC_None: | ||
215 | break; | ||
216 | } | ||
217 | return true; | ||
218 | } | ||
219 | |||
220 | bool SMSD_ReadDeleteSMS(GSM_SMSDConfig *Config, GSM_SMSDService *Service) | ||
221 | { | ||
222 | bool start,process; | ||
223 | GSM_MultiSMSMessage sms; | ||
224 | unsigned char buffer[100]; | ||
225 | GSM_Error error=ERR_NONE; | ||
226 | INI_Entry *e; | ||
227 | int i; | ||
228 | |||
229 | start=true; | ||
230 | while (error == ERR_NONE && !gshutdown) { | ||
231 | sms.SMS[0].Folder=0x00; | ||
232 | error=Phone->GetNextSMS(&s, &sms, start); | ||
233 | switch (error) { | ||
234 | case ERR_EMPTY: | ||
235 | break; | ||
236 | case ERR_NONE: | ||
237 | /* Not Inbox SMS - exit */ | ||
238 | if (!sms.SMS[0].InboxFolder) break; | ||
239 | process=true; | ||
240 | DecodeUnicode(sms.SMS[0].Number,buffer); | ||
241 | if (Config->IncludeNumbers != NULL) { | ||
242 | e=Config->IncludeNumbers; | ||
243 | process=false; | ||
244 | while (1) { | ||
245 | if (e == NULL) break; | ||
246 | if (strcmp(buffer,e->EntryValue)==0) { | ||
247 | process=true; | ||
248 | break; | ||
249 | } | ||
250 | e = e->Prev; | ||
251 | } | ||
252 | } else if (Config->ExcludeNumbers != NULL) { | ||
253 | e=Config->ExcludeNumbers; | ||
254 | process=true; | ||
255 | while (1) { | ||
256 | if (e == NULL) break; | ||
257 | if (strcmp(buffer,e->EntryValue)==0) { | ||
258 | process=false; | ||
259 | break; | ||
260 | } | ||
261 | e = e->Prev; | ||
262 | } | ||
263 | } | ||
264 | if (process) { | ||
265 | Service->SaveInboxSMS(sms, Config); | ||
266 | } else { | ||
267 | WriteSMSDLog("Excluded %s", buffer); | ||
268 | } | ||
269 | break; | ||
270 | default: | ||
271 | WriteSMSDLog("Error getting SMS (%i)", error); | ||
272 | return false; | ||
273 | } | ||
274 | if (error == ERR_NONE && sms.SMS[0].InboxFolder) { | ||
275 | for (i=0;i<sms.Number;i++) { | ||
276 | sms.SMS[i].Folder=0; | ||
277 | error=Phone->DeleteSMS(&s,&sms.SMS[i]); | ||
278 | switch (error) { | ||
279 | case ERR_NONE: | ||
280 | case ERR_EMPTY: | ||
281 | break; | ||
282 | default: | ||
283 | WriteSMSDLog("Error deleting SMS (%i)", error); | ||
284 | return false; | ||
285 | } | ||
286 | } | ||
287 | } | ||
288 | start=false; | ||
289 | } | ||
290 | return true; | ||
291 | } | ||
292 | |||
293 | bool SMSD_CheckSMSStatus(GSM_SMSDConfig *Config,GSM_SMSDService *Service) | ||
294 | { | ||
295 | GSM_SMSMemoryStatusSMSStatus; | ||
296 | GSM_Error error; | ||
297 | |||
298 | /* Do we have any SMS in phone ? */ | ||
299 | error=Phone->GetSMSStatus(&s,&SMSStatus); | ||
300 | if (error != ERR_NONE) { | ||
301 | WriteSMSDLog("Error getting SMS status (%i)", error); | ||
302 | return false; | ||
303 | } | ||
304 | /* Yes. We have SMS in phone */ | ||
305 | if (SMSStatus.SIMUsed+SMSStatus.PhoneUsed != 0) { | ||
306 | return SMSD_ReadDeleteSMS(Config,Service); | ||
307 | } | ||
308 | return true; | ||
309 | } | ||
310 | |||
311 | bool SMSD_SendSMS(GSM_SMSDConfig *Config,GSM_SMSDService *Service) | ||
312 | { | ||
313 | GSM_MultiSMSMessage sms; | ||
314 | GSM_DateTime Date; | ||
315 | GSM_Error error; | ||
316 | unsigned int i, j, z; | ||
317 | |||
318 | error = Service->FindOutboxSMS(&sms, Config, Config->SMSID); | ||
319 | |||
320 | if (error == ERR_EMPTY || error == ERR_NOTSUPPORTED) { | ||
321 | /* No outbox sms - wait few seconds and escape */ | ||
322 | for (j=0;j<Config->commtimeout && !gshutdown;j++) { | ||
323 | GSM_GetCurrentDateTime (&Date); | ||
324 | i=Date.Second; | ||
325 | while (i==Date.Second && !gshutdown) { | ||
326 | my_sleep(10); | ||
327 | GSM_GetCurrentDateTime(&Date); | ||
328 | } | ||
329 | } | ||
330 | return true; | ||
331 | } | ||
332 | if (error != ERR_NONE) { | ||
333 | /* Unknown error - escape */ | ||
334 | WriteSMSDLog("Error in outbox on %s", Config->SMSID); | ||
335 | for (i=0;i<sms.Number;i++) { | ||
336 | Service->AddSentSMSInfo(&sms, Config, Config->SMSID, i+1, false); | ||
337 | } | ||
338 | Service->MoveSMS(&sms,Config, Config->SMSID, true,false); | ||
339 | return false; | ||
340 | } | ||
341 | if (!gshutdown) { | ||
342 | if (strcmp(Config->prevSMSID, Config->SMSID) == 0) { | ||
343 | Config->retries++; | ||
344 | if (Config->retries > MAX_RETRIES) { | ||
345 | Config->retries = 0; | ||
346 | strcpy(Config->prevSMSID, ""); | ||
347 | WriteSMSDLog("Moved to errorbox: %s", Config->SMSID); | ||
348 | for (i=0;i<sms.Number;i++) { | ||
349 | Service->AddSentSMSInfo(&sms, Config, Config->SMSID, i+1, false); | ||
350 | } | ||
351 | Service->MoveSMS(&sms,Config, Config->SMSID, true,false); | ||
352 | return false; | ||
353 | } | ||
354 | } else { | ||
355 | Config->retries = 0; | ||
356 | strcpy(Config->prevSMSID, Config->SMSID); | ||
357 | } | ||
358 | for (i=0;i<sms.Number;i++) { | ||
359 | if (strcmp(Config->deliveryreport, "no") != 0) sms.SMS[i].PDU = SMS_Status_Report; | ||
360 | error=Phone->SendSMS(&s, &sms.SMS[i]); | ||
361 | if (error!=ERR_NONE) { | ||
362 | WriteSMSDLog("Error sending SMS %s (%i): %s", Config->SMSID, error,print_error(error,s.di.df,s.msg)); | ||
363 | return false; | ||
364 | } | ||
365 | j=0; | ||
366 | SendingSMSStatus = ERR_TIMEOUT; | ||
367 | while (!gshutdown) { | ||
368 | GSM_GetCurrentDateTime (&Date); | ||
369 | z=Date.Second; | ||
370 | while (z==Date.Second) { | ||
371 | my_sleep(10); | ||
372 | GSM_GetCurrentDateTime(&Date); | ||
373 | GSM_ReadDevice(&s,true); | ||
374 | if (SendingSMSStatus != ERR_TIMEOUT) break; | ||
375 | } | ||
376 | if (SendingSMSStatus != ERR_TIMEOUT) break; | ||
377 | j++; | ||
378 | if (j>Config->sendtimeout) break; | ||
379 | } | ||
380 | if (SendingSMSStatus != ERR_NONE) { | ||
381 | WriteSMSDLog("Error getting send status of %s (%i): %s", Config->SMSID, SendingSMSStatus,print_error(SendingSMSStatus,s.di.df,s.msg)); | ||
382 | return false; | ||
383 | } | ||
384 | error = Service->AddSentSMSInfo(&sms, Config, Config->SMSID, i+1, true); | ||
385 | if (error!=ERR_NONE) { | ||
386 | return false; | ||
387 | } | ||
388 | } | ||
389 | while ((int)i<sms.Number-1) { | ||
390 | Service->AddSentSMSInfo(&sms, Config, Config->SMSID, i+1, false); | ||
391 | i++; | ||
392 | } | ||
393 | strcpy(Config->prevSMSID, ""); | ||
394 | if (Service->MoveSMS(&sms,Config, Config->SMSID, false, true) != ERR_NONE) { | ||
395 | Service->MoveSMS(&sms,Config, Config->SMSID, true, false); | ||
396 | } | ||
397 | } | ||
398 | return true; | ||
399 | } | ||
400 | |||
401 | void SMSDaemon(int argc, char *argv[]) | ||
402 | { | ||
403 | int errors = 255, initerrors=0; | ||
404 | GSM_SMSDService *Service; | ||
405 | GSM_Error error; | ||
406 | time_t time1; | ||
407 | GSM_SMSDConfig Config; | ||
408 | |||
409 | if (!strcmp(argv[2],"FILES")) { | ||
410 | Service = &SMSDFiles; | ||
411 | #ifdef HAVE_MYSQL_MYSQL_H | ||
412 | } else if (!strcmp(argv[2],"MYSQL")) { | ||
413 | Service = &SMSDMySQL; | ||
414 | #endif | ||
415 | } else { | ||
416 | fprintf(stderr,"Unknown service type (\"%s\")\n",argv[2]); | ||
417 | exit(-1); | ||
418 | } | ||
419 | |||
420 | SMSD_ReadConfig(argv[3], &Config, true); | ||
421 | |||
422 | error = Service->Init(&Config); | ||
423 | if (error!=ERR_NONE) { | ||
424 | GSM_Terminate_SMSD("Stop GAMMU smsd (%i)", error, true, -1); | ||
425 | } | ||
426 | |||
427 | signal(SIGINT, interrupt); | ||
428 | signal(SIGTERM, interrupt); | ||
429 | fprintf(stderr,"Press Ctrl+C to stop the program ...\n"); | ||
430 | |||
431 | time1 = time(NULL); | ||
432 | SendingSMSStatus = ERR_UNKNOWN; | ||
433 | |||
434 | while (!gshutdown) { | ||
435 | /* There were errors in communication - try to recover */ | ||
436 | if (errors > 2) { | ||
437 | if (errors != 255) { | ||
438 | WriteSMSDLog("Terminating communication (%i,%i)", error, errors); | ||
439 | error=GSM_TerminateConnection(&s); | ||
440 | } | ||
441 | if (initerrors++ > 3) my_sleep(30000); | ||
442 | WriteSMSDLog("Starting communication"); | ||
443 | error=GSM_InitConnection(&s,2); | ||
444 | switch (error) { | ||
445 | case ERR_NONE: | ||
446 | s.User.SendSMSStatus = SMSSendingSMSStatus; | ||
447 | Phone = s.Phone.Functions; | ||
448 | errors = 0; | ||
449 | /* Marcin Wiacek: FIXME. To check */ | ||
450 | // di = s.di; | ||
451 | break; | ||
452 | case ERR_DEVICEOPENERROR: | ||
453 | GSM_Terminate_SMSD("Can't open device (%i)", error, true, -1); | ||
454 | default: | ||
455 | WriteSMSDLog("Error at init connection (%i)", error); | ||
456 | errors = 250; | ||
457 | } | ||
458 | continue; | ||
459 | } | ||
460 | if ((difftime(time(NULL), time1) >= Config.receivefrequency) || (SendingSMSStatus != ERR_NONE)) { | ||
461 | time1 = time(NULL); | ||
462 | |||
463 | if (!SMSD_CheckSecurity(&Config)) { | ||
464 | errors++; | ||
465 | initerrors++; | ||
466 | continue; | ||
467 | } else errors=0; | ||
468 | |||
469 | initerrors = 0; | ||
470 | |||
471 | if (!SMSD_CheckSMSStatus(&Config,Service)) { | ||
472 | errors++; | ||
473 | continue; | ||
474 | } else errors=0; | ||
475 | } | ||
476 | if (!SMSD_SendSMS(&Config,Service)) continue; | ||
477 | } | ||
478 | GSM_Terminate_SMSD("Stop GAMMU smsd", 0, false, 0); | ||
479 | } | ||
480 | |||
481 | GSM_Error SMSDaemonSendSMS(char *service, char *filename, GSM_MultiSMSMessage *sms) | ||
482 | { | ||
483 | GSM_SMSDService *Service; | ||
484 | GSM_SMSDConfig Config; | ||
485 | |||
486 | if (!strcmp(service,"FILES")) { | ||
487 | Service = &SMSDFiles; | ||
488 | #ifdef HAVE_MYSQL_MYSQL_H | ||
489 | } else if (!strcmp(service,"MYSQL")) { | ||
490 | Service = &SMSDMySQL; | ||
491 | #endif | ||
492 | } else { | ||
493 | fprintf(stderr,"Unknown service type (\"%s\")\n",service); | ||
494 | exit(-1); | ||
495 | } | ||
496 | |||
497 | SMSD_ReadConfig(filename, &Config, false); | ||
498 | |||
499 | error = Service->Init(&Config); | ||
500 | if (error!=ERR_NONE) return ERR_UNKNOWN; | ||
501 | |||
502 | return Service->CreateOutboxSMS(sms,&Config); | ||
503 | } | ||
504 | |||
505 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
506 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
507 | */ | ||
diff --git a/gammu/emb/gammu/smsd/smsdcore.h b/gammu/emb/gammu/smsd/smsdcore.h new file mode 100644 index 0000000..23e402e --- a/dev/null +++ b/gammu/emb/gammu/smsd/smsdcore.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek and Joergen Thomsen */ | ||
2 | |||
3 | #include "../../cfg/config.h" | ||
4 | #undef HAVE_MYSQL_MYSQL_H | ||
5 | #ifdef HAVE_MYSQL_MYSQL_H | ||
6 | #ifdef WIN32 | ||
7 | # include <mysql.h> | ||
8 | # include <mysqld_error.h> | ||
9 | #else | ||
10 | # include <mysql/mysql.h> | ||
11 | # include <mysql/mysqld_error.h> | ||
12 | #endif | ||
13 | #endif | ||
14 | |||
15 | #include "../../common/service/sms/gsmsms.h" | ||
16 | #include "../../common/service/sms/gsmmulti.h" | ||
17 | |||
18 | #define MAX_RETRIES 1 | ||
19 | |||
20 | void SMSDaemon (int argc, char *argv[]); | ||
21 | GSM_Error SMSDaemonSendSMS(char *service, char *filename, GSM_MultiSMSMessage *sms); | ||
22 | |||
23 | typedef struct { | ||
24 | /* general options */ | ||
25 | INI_Entry *IncludeNumbers, *ExcludeNumbers; | ||
26 | unsigned int commtimeout, sendtimeout, receivefrequency; | ||
27 | unsigned char *deliveryreport, *logfilename, *PINCode; | ||
28 | |||
29 | /* options for FILES */ | ||
30 | unsigned char *inboxpath, *outboxpath, *sentsmspath; | ||
31 | unsigned char *errorsmspath, *inboxformat, *transmitformat; | ||
32 | |||
33 | /* options for MYSQL */ | ||
34 | unsigned char *database, *user, *password; | ||
35 | unsigned char*PC; | ||
36 | |||
37 | /* private variables required for work */ | ||
38 | unsigned int retries; | ||
39 | unsigned char SMSID[200], prevSMSID[200]; | ||
40 | #ifdef HAVE_MYSQL_MYSQL_H | ||
41 | MYSQL DB; char DT[20]; | ||
42 | #endif | ||
43 | } GSM_SMSDConfig; | ||
44 | |||
45 | typedef struct { | ||
46 | GSM_Error (*Init) (GSM_SMSDConfig *Config); | ||
47 | GSM_Error(*SaveInboxSMS) (GSM_MultiSMSMessage sms, GSM_SMSDConfig *Config); | ||
48 | GSM_Error(*FindOutboxSMS) (GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID); | ||
49 | GSM_Error (*MoveSMS) (GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID, bool alwaysDelete, bool sent); | ||
50 | GSM_Error(*CreateOutboxSMS) (GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config); | ||
51 | GSM_Error(*AddSentSMSInfo) (GSM_MultiSMSMessage *sms, GSM_SMSDConfig *Config, unsigned char *ID, int Part, bool OK); | ||
52 | } GSM_SMSDService; | ||
53 | |||
54 | #ifdef __GNUC__ | ||
55 | __attribute__((format(printf, 1, 2))) | ||
56 | #endif | ||
57 | void WriteSMSDLog(char *format, ...); | ||
58 | |||
59 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
60 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
61 | */ | ||
diff --git a/gammu/emb/gammu/sniff.c b/gammu/emb/gammu/sniff.c new file mode 100644 index 0000000..0e3bc69 --- a/dev/null +++ b/gammu/emb/gammu/sniff.c | |||
@@ -0,0 +1,405 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | ||
2 | |||
3 | #include "../common/gsmstate.h" | ||
4 | |||
5 | #ifdef DEBUG | ||
6 | |||
7 | #include <string.h> | ||
8 | #include <stdio.h> | ||
9 | |||
10 | #include "../common/protocol/nokia/mbus2.h" | ||
11 | #include "../common/protocol/nokia/phonet.h" | ||
12 | #include "../common/phone/nokia/nfunc.h" | ||
13 | #include "../common/misc/misc.h" | ||
14 | #include "../common/gsmcomon.h" | ||
15 | #include "../common/service/gsmcal.h" | ||
16 | #include "gammu.h" | ||
17 | |||
18 | static GSM_Protocol_MBUS2DataMBUS2Data; | ||
19 | static GSM_Protocol_PHONETDataPHONETData; | ||
20 | |||
21 | #define MBUS2_DEVICE_PC1 0x1D | ||
22 | |||
23 | static void DecodeInputMBUS2(unsigned char rx_byte) | ||
24 | { | ||
25 | GSM_Protocol_MBUS2Data *d = &MBUS2Data; | ||
26 | |||
27 | d->Msg.CheckSum[0] = d->Msg.CheckSum[1]; | ||
28 | d->Msg.CheckSum[1] ^= rx_byte; | ||
29 | |||
30 | if (d->MsgRXState == RX_GetMessage) { | ||
31 | d->Msg.Buffer[d->Msg.Count] = rx_byte; | ||
32 | d->Msg.Count++; | ||
33 | |||
34 | if (d->Msg.Count != d->Msg.Length+2) return; | ||
35 | |||
36 | if (d->Msg.CheckSum[0] != rx_byte) { | ||
37 | printf("[ERROR: checksum]\n"); | ||
38 | printf(" 0x%02x / 0x%04x", d->Msg.Type, d->Msg.Length); | ||
39 | DumpMessage(stdout, DL_TEXTALL, d->Msg.Buffer, d->Msg.Length); | ||
40 | d->MsgRXState = RX_Sync; | ||
41 | return; | ||
42 | } | ||
43 | |||
44 | if (d->Msg.Destination != MBUS2_DEVICE_PHONE) { | ||
45 | printf("Received frame"); | ||
46 | } else { | ||
47 | printf("Sending frame"); | ||
48 | } | ||
49 | printf(" 0x%02x / 0x%04x", d->Msg.Type, d->Msg.Length); | ||
50 | DumpMessage(stdout, DL_TEXTALL, d->Msg.Buffer, d->Msg.Length); | ||
51 | if (d->Msg.Destination != MBUS2_DEVICE_PHONE) { | ||
52 | if (s.Phone.Functions != NULL) { | ||
53 | s.Phone.Data.RequestMsg = &d->Msg; | ||
54 | s.Phone.Functions->DispatchMessage(&s); | ||
55 | } | ||
56 | } | ||
57 | d->MsgRXState = RX_Sync; | ||
58 | return; | ||
59 | } | ||
60 | if (d->MsgRXState == RX_GetLength2) { | ||
61 | if (d->Msg.Type == MBUS2_ACK_BYTE) { | ||
62 | d->MsgRXState = RX_Sync; | ||
63 | } else { | ||
64 | d->Msg.Length = d->Msg.Length + rx_byte; | ||
65 | d->MsgRXState = RX_GetMessage; | ||
66 | } | ||
67 | return; | ||
68 | } | ||
69 | if (d->MsgRXState == RX_GetLength1) { | ||
70 | d->Msg.Length = rx_byte * 256; | ||
71 | d->MsgRXState = RX_GetLength2; | ||
72 | return; | ||
73 | } | ||
74 | if (d->MsgRXState == RX_GetType) { | ||
75 | d->Msg.Type = rx_byte; | ||
76 | d->MsgRXState = RX_GetLength1; | ||
77 | return; | ||
78 | } | ||
79 | if (d->MsgRXState == RX_GetSource) { | ||
80 | if (rx_byte != MBUS2_DEVICE_PC && rx_byte != MBUS2_DEVICE_PHONE && rx_byte != MBUS2_DEVICE_PC1) { | ||
81 | d->MsgRXState = RX_Sync; | ||
82 | printf("[ERROR: incorrect char - %02x, not %02x and %02x and %02x]\n", | ||
83 | rx_byte, MBUS2_DEVICE_PHONE, MBUS2_DEVICE_PC, MBUS2_DEVICE_PC1); | ||
84 | } else { | ||
85 | d->Msg.Source = rx_byte; | ||
86 | d->MsgRXState = RX_GetType; | ||
87 | } | ||
88 | return; | ||
89 | } | ||
90 | if (d->MsgRXState == RX_GetDestination) { | ||
91 | if (rx_byte != MBUS2_DEVICE_PC && rx_byte != MBUS2_DEVICE_PHONE && rx_byte != MBUS2_DEVICE_PC1) { | ||
92 | d->MsgRXState = RX_Sync; | ||
93 | printf("[ERROR: incorrect char - %02x, not %02x and %02x and %02x]\n", | ||
94 | rx_byte, MBUS2_DEVICE_PHONE, MBUS2_DEVICE_PC, MBUS2_DEVICE_PC1); | ||
95 | } else { | ||
96 | d->Msg.Destination = rx_byte; | ||
97 | d->MsgRXState = RX_GetSource; | ||
98 | } | ||
99 | return; | ||
100 | } | ||
101 | if (d->MsgRXState == RX_Sync) { | ||
102 | if (rx_byte == MBUS2_FRAME_ID) { | ||
103 | d->Msg.CheckSum[1] = MBUS2_FRAME_ID; | ||
104 | d->Msg.Count = 0; | ||
105 | d->MsgRXState = RX_GetDestination; | ||
106 | } else { | ||
107 | printf("[ERROR: incorrect char - %02x, not %02x]\n", rx_byte, MBUS2_FRAME_ID); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | #define PHONETIRDA_DEVICE_PC1 0x10 | ||
113 | |||
114 | static void DecodeInputIRDA(unsigned char rx_byte) | ||
115 | { | ||
116 | GSM_Protocol_PHONETData *d = &PHONETData; | ||
117 | |||
118 | if (d->MsgRXState == RX_GetMessage) { | ||
119 | d->Msg.Buffer[d->Msg.Count] = rx_byte; | ||
120 | d->Msg.Count++; | ||
121 | |||
122 | if (d->Msg.Count != d->Msg.Length) return; | ||
123 | |||
124 | if (d->Msg.Destination != PHONET_DEVICE_PHONE) { | ||
125 | printf("Received frame"); | ||
126 | } else { | ||
127 | printf("Sending frame"); | ||
128 | } | ||
129 | printf(" 0x%02x / 0x%04x", d->Msg.Type, d->Msg.Length); | ||
130 | DumpMessage(stdout, DL_TEXTALL, d->Msg.Buffer, d->Msg.Length); | ||
131 | if (d->Msg.Destination != PHONET_DEVICE_PHONE) { | ||
132 | if (s.Phone.Functions != NULL) { | ||
133 | s.Phone.Data.RequestMsg = &d->Msg; | ||
134 | s.Phone.Functions->DispatchMessage(&s); | ||
135 | } | ||
136 | } | ||
137 | d->MsgRXState = RX_Sync; | ||
138 | return; | ||
139 | } | ||
140 | if (d->MsgRXState == RX_GetLength2) { | ||
141 | d->Msg.Length = d->Msg.Length + rx_byte; | ||
142 | d->MsgRXState = RX_GetMessage; | ||
143 | return; | ||
144 | } | ||
145 | if (d->MsgRXState == RX_GetLength1) { | ||
146 | d->Msg.Length = rx_byte * 256; | ||
147 | d->MsgRXState = RX_GetLength2; | ||
148 | return; | ||
149 | } | ||
150 | if (d->MsgRXState == RX_GetType) { | ||
151 | d->Msg.Type = rx_byte; | ||
152 | d->MsgRXState = RX_GetLength1; | ||
153 | return; | ||
154 | } | ||
155 | if (d->MsgRXState == RX_GetSource) { | ||
156 | if (rx_byte != PHONET_DEVICE_PHONE && rx_byte != PHONETIRDA_DEVICE_PC1) { | ||
157 | d->MsgRXState = RX_Sync; | ||
158 | } else { | ||
159 | d->Msg.Source = rx_byte; | ||
160 | d->MsgRXState = RX_GetType; | ||
161 | } | ||
162 | return; | ||
163 | } | ||
164 | if (d->MsgRXState == RX_GetDestination) { | ||
165 | if (rx_byte != PHONETIRDA_DEVICE_PC1 && rx_byte != PHONET_DEVICE_PHONE) { | ||
166 | d->MsgRXState = RX_Sync; | ||
167 | } else { | ||
168 | d->Msg.Destination = rx_byte; | ||
169 | d->MsgRXState = RX_GetSource; | ||
170 | } | ||
171 | return; | ||
172 | } | ||
173 | if (d->MsgRXState == RX_Sync) { | ||
174 | if (rx_byte == PHONET_FRAME_ID) { | ||
175 | d->Msg.Count = 0; | ||
176 | d->MsgRXState = RX_GetDestination; | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | |||
181 | static char IMEI[50]; | ||
182 | static GSM_DateTime DateTime; | ||
183 | static GSM_Alarm Alarm; | ||
184 | static GSM_MemoryEntry Memory; | ||
185 | static GSM_MemoryStatus MemoryStatus; | ||
186 | static GSM_SMSC SMSC; | ||
187 | static GSM_MultiSMSMessage GetSMSMessage; | ||
188 | static GSM_SMSMessage SaveSMSMessage; | ||
189 | static GSM_SMSMemoryStatus SMSStatus; | ||
190 | static GSM_SMSFolders SMSFolders; | ||
191 | static GSM_SignalQuality SignalQuality; | ||
192 | static GSM_BatteryCharge BatteryCharge; | ||
193 | static GSM_NetworkInfo NetworkInfo; | ||
194 | static GSM_Ringtone Ringtone; | ||
195 | static GSM_CalendarEntry Calendar; | ||
196 | static char SecurityCode; | ||
197 | static GSM_WAPBookmark WAPBookmark; | ||
198 | static GSM_Bitmap Bitmap; | ||
199 | static char PhoneString[500]; | ||
200 | |||
201 | static char Model[50]; | ||
202 | static char Version[50]; | ||
203 | static double VersionNum; | ||
204 | |||
205 | static void prepareStateMachine() | ||
206 | { | ||
207 | GSM_Phone_Data*Phone = &s.Phone.Data; | ||
208 | |||
209 | strcpy(Phone->IMEI, IMEI); | ||
210 | strcpy(Phone->Model, Model); | ||
211 | strcpy(Phone->Version, Version); | ||
212 | Phone->DateTime = &DateTime; | ||
213 | Phone->Alarm = &Alarm; | ||
214 | Phone->Memory = &Memory; | ||
215 | Phone->Memory->MemoryType= MEM7110_CG; | ||
216 | Phone->MemoryStatus = &MemoryStatus; | ||
217 | Phone->SMSC = &SMSC; | ||
218 | Phone->GetSMSMessage = &GetSMSMessage; | ||
219 | Phone->SaveSMSMessage = &SaveSMSMessage; | ||
220 | Phone->SMSStatus = &SMSStatus; | ||
221 | Phone->SMSFolders = &SMSFolders; | ||
222 | Phone->SignalQuality = &SignalQuality; | ||
223 | Phone->BatteryCharge = &BatteryCharge; | ||
224 | Phone->NetworkInfo = &NetworkInfo; | ||
225 | Phone->Ringtone = &Ringtone; | ||
226 | Phone->Ringtone->Format = RING_NOKIABINARY; | ||
227 | Phone->Cal = &Calendar; | ||
228 | Phone->SecurityCode = &SecurityCode; | ||
229 | Phone->WAPBookmark = &WAPBookmark; | ||
230 | Phone->Bitmap = &Bitmap; | ||
231 | Phone->PhoneString = PhoneString; | ||
232 | Phone->StartPhoneString = 0; | ||
233 | |||
234 | Phone->EnableIncomingSMS = false; | ||
235 | Phone->EnableIncomingCB = false; | ||
236 | Model[0] = 0; | ||
237 | Phone->VerNum = VersionNum; | ||
238 | Version[0] = 0; | ||
239 | VersionNum = 0; | ||
240 | |||
241 | s.Phone.Functions = NULL; | ||
242 | s.User.UserReplyFunctions= NULL; | ||
243 | Phone->RequestID = ID_EachFrame; | ||
244 | } | ||
245 | |||
246 | void decodesniff(int argc, char *argv[]) | ||
247 | { | ||
248 | GSM_ConnectionTypeProtocol = GCT_MBUS2; | ||
249 | unsigned char Buffer[50000]; | ||
250 | unsigned char Buffer2[50000]; | ||
251 | FILE *file; | ||
252 | int len, len2, pos, state, i; | ||
253 | unsigned char mybyte1 = 0,mybyte2; | ||
254 | |||
255 | if (!strcmp(argv[2],"MBUS2")) { | ||
256 | Protocol = GCT_MBUS2; | ||
257 | } else if (!strcmp(argv[2],"IRDA")) { | ||
258 | Protocol = GCT_IRDAPHONET; | ||
259 | } else { | ||
260 | printf("What protocol (\"%s\") ?\n",argv[2]); | ||
261 | exit(-1); | ||
262 | } | ||
263 | file = fopen(argv[3], "rb"); | ||
264 | if (!file) { | ||
265 | printf("Can not open file \"%s\"\n",argv[3]); | ||
266 | exit(-1); | ||
267 | } | ||
268 | prepareStateMachine(); | ||
269 | if (argc > 4) { | ||
270 | strcpy(s.CurrentConfig->Model,argv[4]); | ||
271 | error=GSM_RegisterAllPhoneModules(&s); | ||
272 | if (error!=ERR_NONE) Print_Error(error); | ||
273 | } | ||
274 | /* Irda uses simple "raw" format */ | ||
275 | if (Protocol == GCT_IRDAPHONET) { | ||
276 | PHONETData.MsgRXState=RX_Sync; | ||
277 | len2=30000; | ||
278 | while (len2==30000) { | ||
279 | len2=fread(Buffer, 1, 30000, file); | ||
280 | for (i=0;i<len2;i++) { | ||
281 | DecodeInputIRDA(Buffer[i]); | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | /* MBUS2 uses PortMon format */ | ||
286 | if (Protocol == GCT_MBUS2) { | ||
287 | MBUS2Data.MsgRXState=RX_Sync; | ||
288 | len2=30000; | ||
289 | state=0; | ||
290 | while (len2==30000) { | ||
291 | len2=fread(Buffer, 1, 30000, file); | ||
292 | pos=0; | ||
293 | len=0; | ||
294 | while (pos!=len2) { | ||
295 | switch (state) { | ||
296 | case 0: | ||
297 | if (Buffer[pos]==' ') state = 1; | ||
298 | break; | ||
299 | case 1: | ||
300 | state = 2; | ||
301 | if (Buffer[pos]=='0') state = 0; | ||
302 | break; | ||
303 | case 2: | ||
304 | if (Buffer[pos]>='0' && Buffer[pos]<='9') { | ||
305 | state = 2; | ||
306 | } else { | ||
307 | if (Buffer[pos]==':') state = 3; | ||
308 | } | ||
309 | break; | ||
310 | case 3: | ||
311 | if (Buffer[pos]==' ') state = 4; | ||
312 | break; | ||
313 | case 4: | ||
314 | if (Buffer[pos]==13) { | ||
315 | state = 0; | ||
316 | break; | ||
317 | } | ||
318 | mybyte1=Buffer[pos]-'0'; | ||
319 | if (Buffer[pos]>'9') mybyte1=Buffer[pos]-'A'+10; | ||
320 | state = 5; | ||
321 | break; | ||
322 | case 5: | ||
323 | mybyte2=Buffer[pos]-'0'; | ||
324 | if (Buffer[pos]>'9') mybyte2=Buffer[pos]-'A'+10; | ||
325 | Buffer2[len++]=mybyte1*16+mybyte2; | ||
326 | state = 6; | ||
327 | break; | ||
328 | case 6: | ||
329 | state = 4; | ||
330 | if (Buffer[pos]!=' ') state = 0; | ||
331 | break; | ||
332 | } | ||
333 | pos++; | ||
334 | } | ||
335 | for (i=0;i<len;i++) { | ||
336 | DecodeInputMBUS2(Buffer2[i]); | ||
337 | } | ||
338 | } | ||
339 | } | ||
340 | fclose(file); | ||
341 | } | ||
342 | |||
343 | void decodebinarydump(int argc, char *argv[]) | ||
344 | { | ||
345 | unsigned char Buffer[50000]; | ||
346 | FILE *file; | ||
347 | int len, len2, i; | ||
348 | unsigned char type; | ||
349 | bool sent; | ||
350 | GSM_Protocol_Messagemsg; | ||
351 | |||
352 | prepareStateMachine(); | ||
353 | if (argc > 3) { | ||
354 | strcpy(s.CurrentConfig->Model,argv[3]); | ||
355 | error=GSM_RegisterAllPhoneModules(&s); | ||
356 | if (error!=ERR_NONE) Print_Error(error); | ||
357 | } | ||
358 | file = fopen(argv[2], "rb"); | ||
359 | if (!file) { | ||
360 | printf("Can not open file \"%s\"\n",argv[2]); | ||
361 | exit(-1); | ||
362 | } | ||
363 | //len2=fread(Buffer, 1, 1, file); | ||
364 | //len2=Buffer[0]; | ||
365 | //len =fread(Buffer, 1, len2, file); | ||
366 | //Buffer[len2]=0; | ||
367 | //dbgprintf("[Gammu - version %s]\n",Buffer); | ||
368 | len2=30000; | ||
369 | msg.Buffer = NULL; | ||
370 | while (len2==30000) { | ||
371 | len2=fread(Buffer, 1, 30000, file); | ||
372 | i=0; | ||
373 | while (i!=len2) { | ||
374 | if (Buffer[i++]==0x01) { | ||
375 | dbgprintf("Sending frame "); | ||
376 | sent = true; | ||
377 | } else { | ||
378 | dbgprintf("Receiving frame "); | ||
379 | sent = false; | ||
380 | } | ||
381 | type = Buffer[i++]; | ||
382 | len = Buffer[i++] * 256; | ||
383 | len = len + Buffer[i++]; | ||
384 | dbgprintf("0x%02x / 0x%04x", type, len); | ||
385 | DumpMessage(stdout, DL_TEXTALL, Buffer+i, len); | ||
386 | fflush(stdout); | ||
387 | if (s.Phone.Functions != NULL && !sent) { | ||
388 | msg.Buffer = (unsigned char *)realloc(msg.Buffer,len); | ||
389 | memcpy(msg.Buffer,Buffer+i,len); | ||
390 | msg.Type = type; | ||
391 | msg.Length = len; | ||
392 | s.Phone.Data.RequestMsg = &msg; | ||
393 | s.Phone.Functions->DispatchMessage(&s); | ||
394 | } | ||
395 | i = i + len; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | } | ||
400 | |||
401 | #endif | ||
402 | |||
403 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
404 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
405 | */ | ||
diff --git a/gammu/emb/gammu/sniff.h b/gammu/emb/gammu/sniff.h new file mode 100644 index 0000000..104f8f1 --- a/dev/null +++ b/gammu/emb/gammu/sniff.h | |||
@@ -0,0 +1,8 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | ||
2 | |||
3 | void decodesniff(int argc, char *argv[]); | ||
4 | void decodebinarydump(int argc, char *argv[]); | ||
5 | |||
6 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
7 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
8 | */ | ||