Gammu internals  1.38.0
dct3func.c
Go to the documentation of this file.
1 /* (c) 2001-2004 by Marcin Wiacek */
2 /* resetting DCT4 phones settings (c) by Walek */
3 /* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
4  * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5  * GNU GPL version 2 or later
6  */
7 /* Due to a problem in the source code management, the names of some of
8  * the authors have unfortunately been lost. We do not mean to belittle
9  * their efforts and hope they will contact us to see their names
10  * properly added to the Copyright notice above.
11  * Having published their contributions under the terms of the GNU
12  * General Public License (GPL) [version 2], the Copyright of these
13  * authors will remain respected by adhering to the license they chose
14  * to publish their code under.
15  */
16 
17 #include <string.h> /* memcpy only */
18 #include <stdio.h>
19 #include <ctype.h>
20 
21 #include "../../../gsmstate.h"
22 #include "../../../misc/coding/coding.h"
23 #include "../../../service/gsmnet.h"
24 #include "../../../service/gsmlogo.h"
25 #include "../../pfunc.h"
26 #include "../nfunc.h"
27 #include "dct3func.h"
28 
29 #include <gammu-config.h>
30 
31 #ifdef GSM_ENABLE_NOKIA_DCT3
32 
34 {
35  GSM_Error error;
36 
37  /* We have to enable WAP frames in phone */
39  if (error!=ERR_NONE) return error;
40 
41  return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark);
42 }
43 
45 {
46  GSM_Error error;
47 
48  /* We have to enable WAP frames in phone */
50  if (error!=ERR_NONE) return error;
51 
52  return DCT3DCT4_GetWAPBookmarkPart(s,bookmark);
53 }
54 
56 {
57  GSM_Phone_Data *Data = &s->Phone.Data;
58 
59  switch (msg->Buffer[2]) {
60  case 0x46:
61  smprintf(s, "Pressing key OK\n");
62  if (Data->PressKey) return ERR_NONE;
63  break;
64  case 0x47:
65  smprintf(s, "Releasing key OK\n");
66  if (!Data->PressKey) return ERR_NONE;
67  break;
68  }
69  return ERR_UNKNOWNRESPONSE;
70 }
71 
73 {
74  unsigned char PressReq[] = {0x00, 0x01, 0x46, 0x00, 0x01,
75  0x0a}; /* Key code */
76  unsigned char ReleaseReq[] = {0x00, 0x01, 0x47, 0x00, 0x01, 0x0c};
77 
78  if (Press) {
79  PressReq[5] = Key;
80  s->Phone.Data.PressKey = TRUE;
81  smprintf(s, "Pressing key\n");
82  return GSM_WaitFor (s, PressReq, 6, 0xd1, 4, ID_PressKey);
83  } else {
84  s->Phone.Data.PressKey = FALSE;
85  smprintf(s, "Releasing key\n");
86  return GSM_WaitFor (s, ReleaseReq, 6, 0xd1, 4, ID_PressKey);
87  }
88 }
89 
91 {
92  smprintf(s, "Tone played\n");
93  return ERR_NONE;
94 }
95 
96 GSM_Error DCT3_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, gboolean start)
97 {
98  GSM_Error error;
99  unsigned char req[] = {0x00,0x01,0x8f,
100  0x00, /* Volume */
101  0x00, /* HerzLo */
102  0x00}; /* HerzHi */
103 
104  if (start) {
105  error=DCT3_EnableSecurity (s, 0x01);
106  if (error!=ERR_NONE) return error;
107  }
108 
109  /* For Herz==255*255 we have silent */
110  if (Herz!=255*255) {
111  req[3]=Volume;
112  req[5]=Herz%256;
113  req[4]=Herz/256;
114  } else {
115  req[3]=0;
116  req[5]=0;
117  req[4]=0;
118  }
119 
120  return GSM_WaitFor (s, req, 6, 0x40, 4, ID_PlayTone);
121 }
122 
123 #ifdef GSM_ENABLE_CELLBROADCAST
124 
125 GSM_Error DCT3_ReplyIncomingCB(GSM_Protocol_Message *msg, GSM_StateMachine *s)
126 {
127  GSM_CBMessage CB;
128  int i;
129  char Buffer[300];
130 
131  smprintf(s, "CB received\n");
132  CB.Channel = msg->Buffer[7];
133  i = GSM_UnpackEightBitsToSeven(0, msg->Buffer[9], msg->Buffer[9], msg->Buffer+10, Buffer);
134  i = msg->Buffer[9] - 1;
135  while (i!=0) {
136  if (Buffer[i] == 13) i = i - 1; else break;
137  }
138  DecodeDefault(CB.Text, Buffer, i + 1, TRUE, NULL);
139  smprintf(s, "Channel %i, text \"%s\"\n",CB.Channel,DecodeUnicodeString(CB.Text));
140  if (s->Phone.Data.EnableIncomingCB && s->User.IncomingCB!=NULL) {
141  s->User.IncomingCB(s, &CB, s->User.IncomingCBUserData);
142  }
143  return ERR_NONE;
144 }
145 
146 GSM_Error DCT3_ReplySetIncomingCB(GSM_Protocol_Message *msg, GSM_StateMachine *s)
147 {
148  switch (msg->Buffer[3]) {
149  case 0x21:
150  smprintf(s, "CB set\n");
151  return ERR_NONE;
152  case 0x22:
153  smprintf(s, "CB not set\n");
154  return ERR_UNKNOWN;
155  case 0xCA:
156  smprintf(s, "No network and no CB\n");
157  return ERR_SECURITYERROR;
158  }
159  return ERR_UNKNOWNRESPONSE;
160 }
161 
162 #endif
163 
165 {
166 #ifdef GSM_ENABLE_CELLBROADCAST
167  unsigned char reqOn[] = {N6110_FRAME_HEADER, 0x20, 0x01,
168  0x01, 0x00, 0x00, 0x01, 0x01};
169  unsigned char reqOff[] = {N6110_FRAME_HEADER, 0x20, 0x00,
170  0x00, 0x00, 0x00, 0x00, 0x00};
171 
172  if (s->Phone.Data.EnableIncomingCB!=enable) {
173  s->Phone.Data.EnableIncomingCB = enable;
174  if (enable) {
175  smprintf(s, "Enabling incoming CB\n");
176  return GSM_WaitFor(s, reqOn, 10, 0x02, 4, ID_SetIncomingCB);
177  } else {
178  smprintf(s, "Disabling incoming CB\n");
179  return GSM_WaitFor(s, reqOff, 10, 0x02, 4, ID_SetIncomingCB);
180  }
181  }
182  return ERR_NONE;
183 #else
184  return ERR_SOURCENOTAVAILABLE;
185 #endif
186 }
187 
189 {
190  smprintf(s, "SMSC set\n");
191  return ERR_NONE;
192 }
193 
195 {
196  unsigned char req[100] = {N6110_FRAME_HEADER, 0x30, 0x64};
197 
198  memset(req+6,0,100-6);
199 
200  /* SMSC location */
201  req[5] = smsc->Location;
202 
203  /* SMSC format */
204  switch (smsc->Format) {
205  case SMS_FORMAT_Text : req[7] = 0x00; break;
206  case SMS_FORMAT_Fax : req[7] = 0x22; break;
207  case SMS_FORMAT_Pager : req[7] = 0x26; break;
208  case SMS_FORMAT_Email : req[7] = 0x32; break;
209  }
210 
211  /* SMS validity */
212  req[9] = smsc->Validity.Relative;
213 
214  /* Default number for SMS messages */
215  req[10] = GSM_PackSemiOctetNumber(smsc->DefaultNumber, req+11, TRUE);
216 
217  /* SMSC number */
218  req[22] = GSM_PackSemiOctetNumber(smsc->Number, req+23, FALSE);
219 
220  /* SMSC name */
221  memcpy(req + 34, DecodeUnicodeString(smsc->Name),UnicodeLength(smsc->Name));
222 
223  smprintf(s, "Setting SMSC\n");
224  return GSM_WaitFor (s, req, 35+UnicodeLength(smsc->Name), 0x02, 4, ID_SetSMSC);
225 }
226 
228 {
229  smprintf(s, "State of security commands set\n");
230  return ERR_NONE;
231 }
232 
233 /* If you set make some things (for example, change Security Code from
234  * phone's menu, disable and enable phone), it won't answer for 0x40 frames
235  * and you won't be able to play tones, get netmonitor, etc.
236  * This function do thing called "Enabling extended security commands"
237  * and it enables 0x40 frame functions.
238  * This frame can also some other things - see below
239  */
240 GSM_Error DCT3_EnableSecurity (GSM_StateMachine *s, unsigned char status)
241 {
242  unsigned char req[] = {0x00, 0x01, 0x64,
243  0x01}; /* 0x00/0x01 - off/on,
244  * 0x03/0x04 - soft/hard reset,
245  * 0x06 - CONTACT SERVICE
246  */
247 
248  /* 0x06 MAKES CONTACT SERVICE! BE CAREFULL! */
249  /* When use 0x03 and had during session changed time & date
250  * some phones (like 6150 or 6210) can ask for time & date after reset
251  * or disable clock on the screen
252  */
253  if (status!=0x06) req[3] = status;
254  smprintf(s, "Setting state of security commands\n");
255  return GSM_WaitFor (s, req, 4, 0x40, 4, ID_EnableSecurity);
256 }
257 
259 {
260  memcpy(s->Phone.Data.IMEI,msg->Buffer + 4, 16);
261  smprintf(s, "Received IMEI %s\n",s->Phone.Data.IMEI);
262  return ERR_NONE;
263 }
264 
266 {
267  unsigned char req[] = {0x00, 0x01, 0x66, 0x00};
268  GSM_Error error;
269 
270  if (strlen(s->Phone.Data.IMEI)!=0) return ERR_NONE;
271 
272  error=DCT3_EnableSecurity (s, 0x01);
273  if (error!=ERR_NONE) return error;
274 
275  smprintf(s, "Getting IMEI\n");
276  return GSM_WaitFor (s, req, 4, 0x40, 2, ID_GetIMEI);
277 }
278 
280 {
281  smprintf(s, "Login for SIM card\n");
282  return ERR_NONE;
283 }
284 
286 {
287  smprintf(s, "Logout for SIM card\n");
288  return ERR_NONE;
289 }
290 
292 {
293  smprintf(s, "Date & time received\n");
294  if (msg->Buffer[4]==0x01) {
296  return ERR_NONE;
297  }
298  smprintf(s, "Not set in phone\n");
299  return ERR_EMPTY;
300 }
301 
302 GSM_Error DCT3_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype)
303 {
304  unsigned char req[] = {N6110_FRAME_HEADER, 0x62};
305 
306  s->Phone.Data.DateTime=date_time;
307  smprintf(s, "Getting date & time\n");
308  return GSM_WaitFor (s, req, 4, msgtype, 4, ID_GetDateTime);
309 }
310 
312 {
313  GSM_Phone_Data *Data = &s->Phone.Data;
314 
315  smprintf(s, "Alarm: ");
316  if (msg->Buffer[8]==0x02) {
317  smprintf(s, "set to %02i:%02i\n", msg->Buffer[9], msg->Buffer[10]);
318  Data->Alarm->Repeating = TRUE;
319  Data->Alarm->Text[0] = 0;
320  Data->Alarm->Text[1] = 0;
321  Data->Alarm->DateTime.Hour = msg->Buffer[9];
322  Data->Alarm->DateTime.Minute = msg->Buffer[10];
323  Data->Alarm->DateTime.Second = 0;
324  return ERR_NONE;
325  }
326  smprintf(s, "not set\n");
327  return ERR_EMPTY;
328 }
329 
330 GSM_Error DCT3_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm, unsigned char msgtype)
331 {
332  unsigned char req[] = {N6110_FRAME_HEADER, 0x6d};
333 
334  if (Alarm->Location!=1) return ERR_NOTSUPPORTED;
335 
336  s->Phone.Data.Alarm=Alarm;
337  smprintf(s, "Getting alarm\n");
338  return GSM_WaitFor (s, req, 4, msgtype, 4, ID_GetAlarm);
339 }
340 
342 {
343  smprintf(s, "Date & time: ");
344  if (msg->Buffer[4]==0x01) {
345  smprintf(s, "set OK\n");
346  return ERR_NONE;
347  }
348  smprintf(s, "error setting\n");
349  return ERR_UNKNOWN;
350 }
351 
352 GSM_Error DCT3_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype)
353 {
354  unsigned char req[] = {N6110_FRAME_HEADER, 0x60, 0x01, 0x01, 0x07,
355  0x00, 0x00, /* Year */
356  0x00, /* Month */
357  0x00, /* Day */
358  0x00, /* Hour */
359  0x00, /* Minute */
360  0x00}; /* Unknown. Not seconds */
361 
362  NOKIA_EncodeDateTime(s, req+7, date_time);
363  smprintf(s, "Setting date & time\n");
364  return GSM_WaitFor (s, req, 14, msgtype, 4, ID_SetDateTime);
365 }
366 
368 {
369  smprintf(s, "Alarm: ");
370  if (msg->Buffer[4]==0x01) {
371  smprintf(s, "set OK\n");
372  return ERR_NONE;
373  }
374  smprintf(s, "error setting\n");
375  return ERR_UNKNOWN;
376 }
377 
378 GSM_Error DCT3_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm, unsigned char msgtype)
379 {
380  unsigned char req[] = {N6110_FRAME_HEADER, 0x6b, 0x01, 0x20, 0x03,
381  0x02, /* Unknown. Not for enabling/disabling */
382  0x00, /* Hour */
383  0x00, /* Minute */
384  0x00}; /* Unknown. Not seconds */
385 
386  if (Alarm->Location != 1) return ERR_NOTSUPPORTED;
387 
388  req[8] = Alarm->DateTime.Hour;
389  req[9] = Alarm->DateTime.Minute;
390 
391  smprintf(s, "Setting alarm\n");
392  return GSM_WaitFor (s, req, 11, msgtype, 4, ID_SetAlarm);
393 }
394 
396 {
397  smprintf(s, "Waiting for SMSC reply\n");
398  return ERR_NONE;
399 }
400 
402 {
403  int i;
404  GSM_Phone_Data *Data = &s->Phone.Data;
405  size_t pos;
406  GSM_Error error;
407 
408  switch (msg->Buffer[3]) {
409  case 0x34:
410  smprintf(s, "SMSC received\n");
411  Data->SMSC->Format = SMS_FORMAT_Text;
412  switch (msg->Buffer[6]) {
413  case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break;
414  case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break;
415  case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager; break;
416  case 0x32: Data->SMSC->Format = SMS_FORMAT_Email; break;
417  }
419  Data->SMSC->Validity.Relative = msg->Buffer[8];
420  if (msg->Buffer[8] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time;
421 
422  i=33;
423  while (msg->Buffer[i]!=0) {i++;}
424  i=i-33;
425  if (i>GSM_MAX_SMSC_NAME_LENGTH) {
426  smprintf(s, "Too long name\n");
427  return ERR_UNKNOWNRESPONSE;
428  }
429  EncodeUnicode(Data->SMSC->Name,msg->Buffer+33,i);
430  smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name));
431 
432  pos = 9;
433  error = GSM_UnpackSemiOctetNumber(&(s->di), Data->SMSC->DefaultNumber, msg->Buffer, &pos, msg->Length, TRUE);
434  if (error != ERR_NONE) {
435  return error;
436  }
437  smprintf(s, "Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber));
438 
439  pos = 21;
440  error = GSM_UnpackSemiOctetNumber(&(s->di), Data->SMSC->Number, msg->Buffer, &pos, msg->Length, FALSE);
441  if (error != ERR_NONE) {
442  return error;
443  }
444  smprintf(s, "Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number));
445 
446  return ERR_NONE;
447  case 0x35:
448  smprintf(s, "Getting SMSC failed\n");
449  return ERR_INVALIDLOCATION;
450  }
451  return ERR_UNKNOWNRESPONSE;
452 }
453 
455 {
456  unsigned char req[] = {N6110_FRAME_HEADER, 0x33, 0x64,
457  0x00}; /* Location */
458 
459  if (smsc->Location==0x00) return ERR_INVALIDLOCATION;
460 
461  req[5]=smsc->Location;
462 
463  s->Phone.Data.SMSC=smsc;
464  smprintf(s, "Getting SMSC\n");
465  return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC);
466 }
467 
469 {
470  int count;
471  GSM_Phone_Data *Data = &s->Phone.Data;
472 #ifdef DEBUG
473  GSM_NetworkInfo NetInfo;
474  char name[100];
475 
476  NetInfo.GPRS = 0;
477  smprintf(s, "Network info received\n");
478  smprintf(s, "Status : ");
479  switch (msg->Buffer[8]) {
480  case 0x01: smprintf(s, "home network"); break;
481  case 0x02: smprintf(s, "roaming network"); break;
482  case 0x03: smprintf(s, "requesting network"); break;
483  case 0x04: smprintf(s, "not registered in the network"); break;
484  default : smprintf(s, "unknown");
485  }
486  smprintf(s, "\n");
487  smprintf(s, "Network selection : %s\n", msg->Buffer[9]==1?"manual":"automatic");
488  if (msg->Buffer[8]<0x03) {
489  sprintf(NetInfo.CID, "%02X%02X", msg->Buffer[10], msg->Buffer[11]);
490  smprintf(s, "CID : %s\n", NetInfo.CID);
491 
492  sprintf(NetInfo.LAC, "%02X%02X", msg->Buffer[12], msg->Buffer[13]);
493  smprintf(s, "LAC : %s\n", NetInfo.LAC);
494 
495  NOKIA_DecodeNetworkCode(msg->Buffer+14,NetInfo.NetworkCode);
496  smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
497  smprintf(s, "Network name for Gammu : %s ",
500 
501  if (msg->Length>18) {
502  if (msg->Buffer[18]==0x00) {
503  /* In 6210 name is in "normal" Unicode */
504  memcpy(name,msg->Buffer+18,msg->Buffer[17]*2);
505  name[msg->Buffer[17]*2] =0x00;
506  name[msg->Buffer[17]*2+1]=0x00;
507  smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
508  } else {
509  /* In 9210 first 0x00 is cut from Unicode string */
510  name[0] = 0;
511  memcpy(name+1,msg->Buffer+18,msg->Buffer[17]*2);
512  name[msg->Buffer[17]*2+1]=0x00;
513  name[msg->Buffer[17]*2+2]=0x00;
514  smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
515  }
516  }
517  }
518 #endif
519  if (Data->RequestID==ID_GetNetworkInfo) {
520  Data->NetworkInfo->NetworkName[0] = 0x00;
521  Data->NetworkInfo->NetworkName[1] = 0x00;
522  Data->NetworkInfo->State = 0;
523  switch (msg->Buffer[8]) {
524  case 0x01: Data->NetworkInfo->State = GSM_HomeNetwork; break;
525  case 0x02: Data->NetworkInfo->State = GSM_RoamingNetwork; break;
526  case 0x03: Data->NetworkInfo->State = GSM_RequestingNetwork; break;
527  case 0x04: Data->NetworkInfo->State = GSM_NoNetwork; break;
528  }
530  if (msg->Buffer[18]==0x00) {
531  /* In 6210 name is in "normal" Unicode */
532  memcpy(Data->NetworkInfo->NetworkName,msg->Buffer+18,msg->Buffer[17]*2);
533  Data->NetworkInfo->NetworkName[msg->Buffer[17]*2] = 0x00;
534  Data->NetworkInfo->NetworkName[msg->Buffer[17]*2+1] = 0x00;
535  } else {
536  /* In 9210 first 0x00 is cut from Unicode string */
537  Data->NetworkInfo->NetworkName[0] = 0;
538  memcpy(Data->NetworkInfo->NetworkName+1,msg->Buffer+18,msg->Buffer[17]*2);
539  Data->NetworkInfo->NetworkName[msg->Buffer[17]*2+1]=0x00;
540  Data->NetworkInfo->NetworkName[msg->Buffer[17]*2+2]=0x00;
541  }
543  sprintf(Data->NetworkInfo->CID, "%02X%02X", msg->Buffer[10], msg->Buffer[11]);
544  sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg->Buffer[12], msg->Buffer[13]);
545  }
546  }
547  /* 6210/6250/7110 */
548  if (Data->RequestID==ID_GetBitmap) {
549  if (msg->Buffer[4]==0x02) {
550  smprintf(s, "Operator logo available\n");
551  count = 7;
552  /* skip network info */
553  count += msg->Buffer[count];
554  count ++;
555  Data->Bitmap->BitmapWidth = msg->Buffer[count++];
556  Data->Bitmap->BitmapHeight = msg->Buffer[count++];
557  count+=4;
560  } else {
561  Data->Bitmap->BitmapWidth = 78;
562  Data->Bitmap->BitmapHeight = 21;
563  GSM_ClearBitmap(Data->Bitmap);
564  strcpy(Data->Bitmap->NetworkCode,"000 00");
565  }
566  }
567  return ERR_NONE;
568 }
569 
571 {
572  unsigned char req[] = {N6110_FRAME_HEADER, 0x70};
573 
574  netinfo->GPRS = 0;
575  s->Phone.Data.NetworkInfo=netinfo;
576  smprintf(s, "Getting network info\n");
577  return GSM_WaitFor (s, req, 4, 0x0a, 4, ID_GetNetworkInfo);
578 }
579 
581 {
582  smprintf(s, "Answer for call commands\n");
583  return ERR_NONE;
584 }
585 
586 GSM_Error DCT3_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
587 {
588  unsigned int i = 0;
589  GSM_Error error;
590  unsigned char req[100] = {0x00, 0x01, 0x7c,
591  0x01}; /* call command */
592 
593  if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED;
594 
595  error=DCT3_EnableSecurity (s, 0x01);
596  if (error!=ERR_NONE) return error;
597 
598  for (i=0; i < strlen(number); i++) req[4+i]=number[i];
599  req[4+i+1]=0;
600 
601  smprintf(s, "Making voice call\n");
602  return GSM_WaitFor (s, req, 4+strlen(number)+1, 0x40, 4, ID_DialVoice);
603 }
604 
605 static GSM_Error DCT3_CancelAllCalls(GSM_StateMachine *s)
606 {
607  GSM_Error error;
608  unsigned char req[] = {0x00, 0x01, 0x7c,
609  0x03}; /* call command */
610 
611  error=DCT3_EnableSecurity (s, 0x01);
612  if (error!=ERR_NONE) return error;
613 
614  smprintf(s, "Canceling calls\n");
615  return GSM_WaitFor (s, req, 4, 0x40, 4, ID_CancelCall);
616 }
617 
619 {
620  if (!all) return DCT3DCT4_CancelCall(s,ID);
621  return DCT3_CancelAllCalls(s);
622 }
623 
625 {
626  GSM_Error error;
627  unsigned char req[] = {0x00, 0x01, 0x7c,
628  0x02}; /* call command */
629 
630  error=DCT3_EnableSecurity (s, 0x01);
631  if (error!=ERR_NONE) return error;
632 
633  smprintf(s, "Answering calls\n");
634  return GSM_WaitFor (s, req, 4, 0x40, 4, ID_AnswerCall);
635 }
636 
638 {
639  GSM_Error error;
640 
641  if (hard) {
642  error=DCT3_EnableSecurity(s, 0x04);
643  } else {
644  error=DCT3_EnableSecurity(s, 0x03);
645  }
646  if (error == ERR_NONE) {
649  }
650  return error;
651 }
652 
654 {
655  return DCT3DCT4_ReplyGetWAPBookmark (msg,s,FALSE);
656 }
657 
659 {
660  GSM_Error error;
661  int count = 4, location;
662  unsigned char req[600] = {N6110_FRAME_HEADER, 0x09};
663 
664  /* We have to enable WAP frames in phone */
666  if (error!=ERR_NONE) return error;
667 
668  location = bookmark->Location - 1;
669  if (bookmark->Location == 0) location = 0xffff;
670  req[count++] = (location & 0xff00) >> 8;
671  req[count++] = location & 0x00ff;
672 
673  count += NOKIA_SetUnicodeString(s, req+count, bookmark->Title, FALSE);
674  count += NOKIA_SetUnicodeString(s, req+count, bookmark->Address, FALSE);
675 
676  /* unknown */
677  req[count++] = 0x01; req[count++] = 0x80; req[count++] = 0x00;
678  req[count++] = 0x00; req[count++] = 0x00; req[count++] = 0x00;
679  req[count++] = 0x00; req[count++] = 0x00; req[count++] = 0x00;
680 
681  smprintf(s, "Setting WAP bookmark\n");
682  error = GSM_WaitFor (s, req, count, 0x3f, 4, ID_SetWAPBookmark);
683  if (error != ERR_NONE) {
684  if (error == ERR_INSIDEPHONEMENU || error == ERR_EMPTY || error == ERR_FULL) {
686  }
687  return error;
688  }
689 
691 }
692 
694 {
695  int tmp,Number;
696 /* int tmp2; */
697  GSM_Phone_Data *Data = &s->Phone.Data;
698 #ifdef GSM_ENABLE_NOKIA6110
699  GSM_Phone_N6110Data *Priv6110 = &s->Phone.Data.Priv.N6110;
700 #endif
701 #ifdef GSM_ENABLE_NOKIA7110
702  GSM_Phone_N7110Data *Priv7110 = &s->Phone.Data.Priv.N7110;
703 #endif
704 
705  switch(msg->Buffer[3]) {
706  case 0x16:
707  smprintf(s, "WAP settings part 1 received OK\n");
708 
709  tmp = 4;
710 
711  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[0].Title,FALSE);
712  smprintf(s, "Title: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[0].Title));
713 
715  smprintf(s, "Homepage: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[0].HomePage));
716 #ifdef DEBUG
717  smprintf(s, "Connection type: ");
718  switch (msg->Buffer[tmp]) {
719  case 0x00: smprintf(s, "temporary\n"); break;
720  case 0x01: smprintf(s, "continuous\n"); break;
721  default: smprintf(s, "unknown\n");
722  }
723  smprintf(s, "Connection security: ");
724  switch (msg->Buffer[tmp+13]) {
725  case 0x00: smprintf(s, "off\n"); break;
726  case 0x01: smprintf(s, "on\n"); break;
727  default: smprintf(s, "unknown\n");
728  }
729 #endif
731  if (msg->Buffer[tmp] == 0x01) Data->WAPSettings->Settings[0].IsContinuous = TRUE;
732  Data->WAPSettings->Settings[0].IsSecurity = FALSE;
733  if (msg->Buffer[tmp+13] == 0x01) Data->WAPSettings->Settings[0].IsSecurity = TRUE;
734 
735  /* I'm not sure here. Experimental values from 6210 5.56 */
736 /* tmp2 = DecodeUnicodeLength(Data->WAPSettings->Settings[0].Title); */
737 /* if (tmp2 != 0) tmp2 --; */
738 /* tmp2 += tmp; */
739  if (!(UnicodeLength(Data->WAPSettings->Settings[0].Title)) % 2) tmp++;
740  if (UnicodeLength(Data->WAPSettings->Settings[0].HomePage)!=0) tmp++;
741 
742  smprintf(s, "ID for writing %i\n",msg->Buffer[tmp+5]);
743 
744  smprintf(s, "Current set location in phone %i\n",msg->Buffer[tmp+6]);
745 
746  smprintf(s, "1 location %i\n",msg->Buffer[tmp+8]);
747  smprintf(s, "2 location %i\n",msg->Buffer[tmp+9]);
748  smprintf(s, "3 location %i\n",msg->Buffer[tmp+10]);
749  smprintf(s, "4 location %i\n",msg->Buffer[tmp+11]);
750 #ifdef GSM_ENABLE_NOKIA7110
751  if (strstr(N7110Phone.models, Data->ModelInfo->model) != NULL) {
752  Priv7110->WAPLocations.ID = msg->Buffer[tmp+5];
753  Priv7110->WAPLocations.CurrentLocation = msg->Buffer[tmp+6];
754  Priv7110->WAPLocations.Locations[0] = msg->Buffer[tmp+8];
755  Priv7110->WAPLocations.Locations[1] = msg->Buffer[tmp+9];
756  Priv7110->WAPLocations.Locations[2] = msg->Buffer[tmp+10];
757  Priv7110->WAPLocations.Locations[3] = msg->Buffer[tmp+11];
758 
759 /* Priv7110->WAPLocations.CurrentLocation = msg->Buffer[tmp2+1]; */
760 /* Priv7110->WAPLocations.Locations[0] = msg->Buffer[tmp2+3]; */
761 /* Priv7110->WAPLocations.Locations[1] = msg->Buffer[tmp2+4]; */
762 /* Priv7110->WAPLocations.Locations[2] = msg->Buffer[tmp2+5]; */
763 /* Priv7110->WAPLocations.Locations[3] = msg->Buffer[tmp2+6]; */
764  }
765 #endif
766 #ifdef GSM_ENABLE_NOKIA6110
767  if (strstr(N6110Phone.models, Data->ModelInfo->model) != NULL) {
768  Priv6110->WAPLocations.ID = msg->Buffer[tmp+5];
769  Priv6110->WAPLocations.CurrentLocation = msg->Buffer[tmp+6];
770  Priv6110->WAPLocations.Locations[0] = msg->Buffer[tmp+8];
771  Priv6110->WAPLocations.Locations[1] = msg->Buffer[tmp+9];
772  Priv6110->WAPLocations.Locations[2] = msg->Buffer[tmp+10];
773  Priv6110->WAPLocations.Locations[3] = msg->Buffer[tmp+11];
774  }
775 #endif
776  return ERR_NONE;
777  case 0x17:
778  smprintf(s, "WAP settings part 1 receiving error\n");
779  switch (msg->Buffer[4]) {
780  case 0x01:
781  smprintf(s, "Security error. Inside WAP settings menu\n");
782  return ERR_INSIDEPHONEMENU;
783  case 0x02:
784  smprintf(s, "Invalid or empty\n");
785  return ERR_INVALIDLOCATION;
786  default:
787  smprintf(s, "ERROR: unknown %i\n",msg->Buffer[4]);
788  return ERR_UNKNOWNRESPONSE;
789  }
790  case 0x1c:
791  smprintf(s, "WAP settings part 2 received OK\n");
792  Number = Data->WAPSettings->Number;
793  switch (msg->Buffer[5]) {
794  case 0x00:
796  smprintf(s, "Settings for SMS bearer:\n");
797  tmp = 6;
798 
799  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].Service,FALSE);
800  smprintf(s, "Service number: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].Service));
801 
802  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].Server,FALSE);
803  smprintf(s, "Server number: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].Server));
804  break;
805  case 0x01:
807  smprintf(s, "Settings for data bearer:\n");
808  Data->WAPSettings->Settings[Number].ManualLogin = FALSE;
809  tmp = 10;
810 
811  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].IPAddress,FALSE);
812  smprintf(s, "IP address: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].IPAddress));
813 
814  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].DialUp,FALSE);
815  smprintf(s, "Dial-up number: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].DialUp));
816 
817  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].User,FALSE);
818  smprintf(s, "User name: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].User));
819 
820  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].Password,FALSE);
821  smprintf(s, "Password: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].Password));
822 #ifdef DEBUG
823  smprintf(s, "Authentication type: ");
824  switch (msg->Buffer[6]) {
825  case 0x00: smprintf(s, "normal\n"); break;
826  case 0x01: smprintf(s, "secure\n"); break;
827  default: smprintf(s, "unknown\n"); break;
828  }
829  smprintf(s, "Data call type: ");
830  switch (msg->Buffer[7]) {
831  case 0x00: smprintf(s, "analogue\n"); break;
832  case 0x01: smprintf(s, "ISDN\n"); break;
833  default: smprintf(s, "unknown\n"); break;
834  }
835  smprintf(s, "Data call speed: ");
836  switch (msg->Buffer[9]) {
837  case 0x01: smprintf(s, "9600\n"); break;
838  case 0x02: smprintf(s, "14400\n"); break;
839  default: smprintf(s, "unknown\n"); break;
840  }
841 #endif
843  if (msg->Buffer[6]==0x01) Data->WAPSettings->Settings[Number].IsNormalAuthentication=FALSE;
844  Data->WAPSettings->Settings[Number].IsISDNCall=FALSE;
845  if (msg->Buffer[7]==0x01) Data->WAPSettings->Settings[Number].IsISDNCall=TRUE;
847  if (msg->Buffer[9]==0x02) Data->WAPSettings->Settings[Number].Speed = WAPSETTINGS_SPEED_14400;
848  break;
849  case 0x02:
851  smprintf(s, "Settings for USSD bearer:\n");
852  tmp = 7;
853  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].Service,FALSE);
854 #ifdef DEBUG
855  if (msg->Buffer[6]==0x01)
856  smprintf(s, "Service number: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].Service));
857  else
858  smprintf(s, "IP address: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].Service));
859 #endif
860  Data->WAPSettings->Settings[Number].IsIP=TRUE;
861  if (msg->Buffer[6]==0x01) Data->WAPSettings->Settings[Number].IsIP=FALSE;
862  NOKIA_GetUnicodeString(s, &tmp, msg->Buffer, Data->WAPSettings->Settings[Number].Code,FALSE);
863  smprintf(s, "Service code: \"%s\"\n",DecodeUnicodeString(Data->WAPSettings->Settings[Number].Code));
864  }
865  Data->WAPSettings->Number++;
866  return ERR_NONE;
867  case 0x1d:
868  smprintf(s, "Incorrect WAP settings location\n");
869  return ERR_NONE;
870  }
871  return ERR_UNKNOWNRESPONSE;
872 }
873 
875 {
876 #ifdef GSM_ENABLE_NOKIA6110
877  GSM_Phone_N6110Data *Priv6110 = &s->Phone.Data.Priv.N6110;
878 #endif
879 #ifdef GSM_ENABLE_NOKIA7110
880  GSM_Phone_N7110Data *Priv7110 = &s->Phone.Data.Priv.N7110;
881 #endif
882  GSM_Error error;
883  int i;
884  unsigned char req[] = {N6110_FRAME_HEADER,0x15,
885  0x00}; /* Location */
886  unsigned char req2[] = {N6110_FRAME_HEADER,0x1b,
887  0x00}; /* Location */
888 
889  /* We have to enable WAP frames in phone */
891  if (error!=ERR_NONE) return error;
892 
893  s->Phone.Data.WAPSettings = settings;
894  settings->Number = 0;
895  settings->ReadOnly = FALSE;
896 
897  req[4] = settings->Location-1;
898  smprintf(s, "Getting WAP settings part 1\n");
899  error = GSM_WaitFor (s, req, 5, 0x3f, 4, ID_GetConnectSet);
900  if (error != ERR_NONE) return error;
901 
902 #ifdef GSM_ENABLE_NOKIA7110
903  if (strstr(N7110Phone.models, s->Phone.Data.ModelInfo->model) != NULL) {
904  for (i=0;i<4;i++) {
905  req2[4] = Priv7110->WAPLocations.Locations[i];
906  smprintf(s, "Getting WAP settings part 2\n");
907  error=GSM_WaitFor (s, req2, 5, 0x3f, 4, ID_GetConnectSet);
908  if (error != ERR_NONE) return error;
909  if (Priv7110->WAPLocations.Locations[i] == Priv7110->WAPLocations.CurrentLocation) {
910  settings->ActiveBearer = settings->Settings[settings->Number-1].Bearer;
911  }
912  }
913  }
914 #endif
915 #ifdef GSM_ENABLE_NOKIA6110
916  if (strstr(N6110Phone.models, s->Phone.Data.ModelInfo->model) != NULL) {
917  for (i=0;i<4;i++) {
918  req2[4] = Priv6110->WAPLocations.Locations[i];
919  smprintf(s, "Getting WAP settings part 2\n");
920  error=GSM_WaitFor (s, req2, 5, 0x3f, 4, ID_GetConnectSet);
921  if (error != ERR_NONE) return error;
922  if (Priv6110->WAPLocations.Locations[i] == Priv6110->WAPLocations.CurrentLocation) {
923  settings->ActiveBearer = settings->Settings[settings->Number-1].Bearer;
924  }
925  }
926  }
927 #endif
928  if (error == ERR_NONE) {
929  for (i=1;i<3;i++) {
930  CopyUnicodeString(settings->Settings[i].Title,settings->Settings[0].Title);
931  CopyUnicodeString(settings->Settings[i].HomePage,settings->Settings[0].HomePage);
932  settings->Settings[i].IsContinuous = settings->Settings[0].IsContinuous;
933  settings->Settings[i].IsSecurity = settings->Settings[0].IsSecurity;
934 
935  settings->Settings[i].IsContinuous = settings->Settings[0].IsContinuous;
936  settings->Settings[i].IsSecurity = settings->Settings[0].IsSecurity;
937  }
938  error = DCT3DCT4_GetActiveConnectSet(s);
939  }
940  if (error != ERR_NONE) return error;
941 
942  settings->Proxy[0] = 0x00;
943  settings->Proxy[1] = 0x00;
944  settings->ProxyPort = 8080;
945 
946  settings->Proxy2[0] = 0x00;
947  settings->Proxy2[1] = 0x00;
948  settings->Proxy2Port = 8080;
949 
951 }
952 
954 {
955  switch(msg->Buffer[3]) {
956  case 0x19:
957  smprintf(s, "WAP settings part 1 set OK\n");
958  return ERR_NONE;
959  case 0x1a:
960  smprintf(s, "WAP settings part 1 setting error\n");
961  switch (msg->Buffer[4]) {
962  case 0x01:
963  smprintf(s, "Security error. Inside WAP settings menu\n");
964  return ERR_INSIDEPHONEMENU;
965  case 0x02:
966  smprintf(s, "Incorrect data\n");
967  return ERR_UNKNOWN;
968  default:
969  smprintf(s, "ERROR: unknown %i\n",msg->Buffer[4]);
970  return ERR_UNKNOWNRESPONSE;
971  }
972  case 0x1F:
973  smprintf(s, "WAP settings part 2 set OK\n");
974  return ERR_NONE;
975  }
976  return ERR_UNKNOWNRESPONSE;
977 }
978 
980 {
981 #ifdef GSM_ENABLE_NOKIA6110
982  GSM_Phone_N6110Data *Priv6110 = &s->Phone.Data.Priv.N6110;
983 #endif
984 #ifdef GSM_ENABLE_NOKIA7110
985  GSM_Phone_N7110Data *Priv7110 = &s->Phone.Data.Priv.N7110;
986 #endif
987  GSM_Error error;
988  GSM_MultiWAPSettings settings2;
989  int i,pos,phone1=-1,phone2=-1,phone3=-1;
990  int ID=0,locations[4] = {0, 0, 0, 0},loc1=-1,loc2=-1,loc3=-1;
991  unsigned char req[] = {N6110_FRAME_HEADER,0x15,
992  0x00, 0x00}; /* Location */
993  unsigned char req2[] = {N6110_FRAME_HEADER,0x1b,
994  0x00, 0x00}; /* Location */
995  unsigned char SetReq[200] = {N7110_FRAME_HEADER, 0x18,
996  0x00}; /* Location */
997  unsigned char SetReq2[200] = {N7110_FRAME_HEADER, 0x1e,
998  0x00}; /* Location */
999 
1000  /* We have to enable WAP frames in phone */
1001  error=DCT3DCT4_EnableWAPFunctions(s);
1002  if (error!=ERR_NONE) return error;
1003 
1004  s->Phone.Data.WAPSettings = &settings2;
1005  settings2.Number = 0;
1006 
1007  req[4] = settings->Location-1;
1008  smprintf(s, "Getting WAP settings part 1\n");
1009  error = GSM_WaitFor (s, req, 6, 0x3f, 4, ID_GetConnectSet);
1010  if (error != ERR_NONE) return error;
1011 
1012 #ifdef GSM_ENABLE_NOKIA6110
1013  if (strstr(N6110Phone.models, s->Phone.Data.ModelInfo->model) != NULL) {
1014  for (i=0;i<4;i++) locations[i] = Priv6110->WAPLocations.Locations[i];
1015  ID = Priv6110->WAPLocations.ID;
1016  }
1017 #endif
1018 #ifdef GSM_ENABLE_NOKIA7110
1019  if (strstr(N7110Phone.models, s->Phone.Data.ModelInfo->model) != NULL) {
1020  for (i=0;i<4;i++) locations[i] = Priv7110->WAPLocations.Locations[i];
1021  ID = Priv7110->WAPLocations.ID;
1022  }
1023 #endif
1024 
1025  /* Now we get info about supported types by phone and their locations */
1026  for (i=0;i<4;i++) {
1027  settings2.Number = 0;
1028  settings2.Settings[0].Bearer = 0;
1029  req2[4] = locations[i];
1030  smprintf(s, "Getting WAP settings part 2\n");
1031  error=GSM_WaitFor (s, req2, 6, 0x3f, 4, ID_GetConnectSet);
1032  if (error != ERR_NONE) return error;
1033  switch (settings2.Settings[0].Bearer) {
1034  case WAPSETTINGS_BEARER_DATA: phone1 = locations[i]; break;
1035  case WAPSETTINGS_BEARER_SMS : phone2 = locations[i]; break;
1036  case WAPSETTINGS_BEARER_USSD: phone3 = locations[i]; break;
1037  default : break;
1038  }
1039  if (error != ERR_NONE) return error;
1040  }
1041 
1042  /* We have some phone locations and some data to set. We try to
1043  * find info about locations in phone used to write concrete bearers
1044  */
1045  for (i=0;i<settings->Number;i++) {
1046  if (settings->Settings[i].Bearer == WAPSETTINGS_BEARER_DATA) {
1047  if (phone1 != -1) loc1=i;
1048  }
1049  if (settings->Settings[i].Bearer == WAPSETTINGS_BEARER_SMS) {
1050  if (phone2 != -1) loc2=i;
1051  }
1052  if (settings->Settings[i].Bearer == WAPSETTINGS_BEARER_USSD) {
1053  if (phone3 != -1) loc3=i;
1054  }
1055  }
1056 
1057  pos = 5;
1058  memset(SetReq + pos, 0, 200 - pos);
1059  SetReq[4] = settings->Location - 1;
1060  if (loc1 != -1) {
1061  /* Name */
1062  pos += NOKIA_SetUnicodeString(s, SetReq + pos, settings->Settings[loc1].Title, FALSE);
1063  /* HomePage */
1064  pos += NOKIA_SetUnicodeString(s, SetReq + pos, settings->Settings[loc1].HomePage, FALSE);
1065  if (settings->Settings[loc1].IsContinuous) SetReq[pos] = 0x01;
1066  pos++;
1067  SetReq[pos++] = ID;
1068 
1069  SetReq[pos] = phone1; /* bearer */
1070  switch (settings->ActiveBearer) {
1072  if (loc1 != -1) SetReq[pos] = phone1;
1073  break;
1075  if (loc2 != -1) SetReq[pos] = phone2;
1076  break;
1078  if (loc3 != -1) SetReq[pos] = phone3;
1079  break;
1080  default: break;
1081  }
1082  pos++;
1083 
1084  if (settings->Settings[loc1].IsSecurity) SetReq[pos] = 0x01;
1085  pos++;
1086  } else if (loc2 != -1) {
1087  /* Name */
1088  pos += NOKIA_SetUnicodeString(s, SetReq + pos, settings->Settings[loc2].Title, FALSE);
1089  /* HomePage */
1090  pos += NOKIA_SetUnicodeString(s, SetReq + pos, settings->Settings[loc2].HomePage, FALSE);
1091  if (settings->Settings[loc2].IsContinuous) SetReq[pos] = 0x01;
1092  pos++;
1093  SetReq[pos++] = ID;
1094 
1095  SetReq[pos] = phone2; /* bearer */
1096  switch (settings->ActiveBearer) {
1098  if (loc1 != -1) SetReq[pos] = phone1;
1099  break;
1101  if (loc2 != -1) SetReq[pos] = phone2;
1102  break;
1104  if (loc3 != -1) SetReq[pos] = phone3;
1105  break;
1106  default: break;
1107  }
1108  pos++;
1109 
1110  if (settings->Settings[loc2].IsSecurity) SetReq[pos] = 0x01;
1111  pos++;
1112  } else if (loc3 != -1) {
1113  /* Name */
1114  pos += NOKIA_SetUnicodeString(s, SetReq + pos, settings->Settings[loc3].Title, FALSE);
1115  /* HomePage */
1116  pos += NOKIA_SetUnicodeString(s, SetReq + pos, settings->Settings[loc3].HomePage, FALSE);
1117  if (settings->Settings[loc3].IsContinuous) SetReq[pos] = 0x01;
1118  pos++;
1119  SetReq[pos++] = ID;
1120 
1121  SetReq[pos] = phone3; /* bearer */
1122  switch (settings->ActiveBearer) {
1124  if (loc1 != -1) SetReq[pos] = phone1;
1125  break;
1127  if (loc2 != -1) SetReq[pos] = phone2;
1128  break;
1130  if (loc3 != -1) SetReq[pos] = phone3;
1131  break;
1132  default: break;
1133  }
1134  pos++;
1135 
1136  if (settings->Settings[loc3].IsSecurity) SetReq[pos] = 0x01;
1137  pos++;
1138  } else {
1139  return ERR_UNKNOWN; /* We have to have write something known */
1140  }
1141  memcpy(SetReq + pos, "\x01\x80\x00\x00\x00\x00\x00\x00\x00", 9);
1142  pos += 9;
1143 
1144  smprintf(s, "Writing WAP settings part 1\n");
1145  error=GSM_WaitFor (s, SetReq, pos, 0x3f, 4, ID_SetConnectSet);
1146  if (error != ERR_NONE) return error;
1147 
1148  /* Data */
1149  if (phone1 != -1) {
1150  pos = 4;
1151  memset(SetReq2 + pos, 0, 200 - pos);
1152  SetReq2[pos++] = phone1;
1153  SetReq2[pos++] = 0x02;
1154  SetReq2[pos++] = 0x01; /* GSMdata */
1155  if (loc1 != -1) {
1156  if (!settings->Settings[loc1].IsNormalAuthentication) SetReq2[pos] = 0x01;
1157  }
1158  pos++;
1159  if (loc1 != -1) {
1160  if (settings->Settings[loc1].IsISDNCall) SetReq2[pos] = 0x01;
1161  }
1162  pos++;
1163  if (loc1 != -1) {
1164  switch (settings->Settings[loc1].Speed) {
1165  case WAPSETTINGS_SPEED_9600 : SetReq2[pos++] = 0x01; break;
1166  case WAPSETTINGS_SPEED_14400 : SetReq2[pos++] = 0x02; break;
1167  default : SetReq2[pos++] = 0x02; break;
1168  }
1169  switch (settings->Settings[loc1].Speed) {
1170  case WAPSETTINGS_SPEED_9600 : SetReq2[pos++] = 0x01; break;
1171  case WAPSETTINGS_SPEED_14400 : SetReq2[pos++] = 0x02; break;
1172  default : SetReq2[pos++] = 0x02; break;
1173  }
1174  } else pos+=2;
1175  if (loc1 != -1) {
1176  /* IP */
1177  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].IPAddress, FALSE);
1178  /* Number */
1179  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].DialUp, FALSE);
1180  /* Username */
1181  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].User, FALSE);
1182  /* Password */
1183  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].Password, FALSE);
1184  } else pos+=5;
1185  memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8);
1186  pos += 8;
1187  smprintf(s, "Writing WAP settings part 2 (Data bearer)\n");
1188  error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet);
1189  if (error != ERR_NONE) return error;
1190  }
1191  /* SMS */
1192  if (phone2 != -1) {
1193  pos = 4;
1194  memset(SetReq2 + pos, 0, 200 - pos);
1195  SetReq2[pos++] = phone2;
1196  SetReq2[pos++] = 0x02;
1197  SetReq2[pos++] = 0x00; /* SMS */
1198  if (loc2 != -1) {
1199  /* Service number */
1200  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc2].Service, FALSE);
1201  /* Server number */
1202  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc2].Server, FALSE);
1203  } else pos += 2;
1204  memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8);
1205  pos += 8;
1206  smprintf(s, "Writing WAP settings part 2 (SMS bearer)\n");
1207  error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet);
1208  if (error != ERR_NONE) return error;
1209  }
1210  /* USSD */
1211  if (phone3 != -1) {
1212  pos = 4;
1213  memset(SetReq2 + pos, 0, 200 - pos);
1214  SetReq2[pos++] = phone3;
1215  SetReq2[pos++] = 0x02;
1216  SetReq2[pos++] = 0x02; /* USSD */
1217  if (loc3 != -1) {
1218  if (!settings->Settings[loc3].IsIP) SetReq2[pos] = 0x01;
1219  }
1220  pos++;
1221  if (loc3 != -1) {
1222  /* Service number or IP address */
1223  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Service, FALSE);
1224  /* Code number */
1225  pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Code, FALSE);
1226  } else pos+=2;
1227  memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8);
1228  pos += 8;
1229  smprintf(s, "Writing WAP settings part 2 (USSD bearer)\n");
1230  error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet);
1231  if (error != ERR_NONE) return error;
1232  }
1233  error = DCT3DCT4_SetActiveConnectSet(s, settings);
1234  if (error != ERR_NONE) return error;
1235 
1237 }
1238 
1240 {
1241  switch (msg->Buffer[3]) {
1242  case 0x02:
1243  smprintf(s, "SMS sent OK\n");
1244  if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s,0,msg->Buffer[5], s->User.SendSMSStatusUserData);
1245  return ERR_NONE;
1246  case 0x03:
1247  smprintf(s, "Error %i\n",msg->Buffer[6]);
1248  if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s,msg->Buffer[6],-1, s->User.SendSMSStatusUserData);
1249  return ERR_NONE;
1250  }
1251  return ERR_UNKNOWNRESPONSE;
1252 }
1253 
1255 {
1256  int length;
1257  GSM_Error error;
1258  unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00};
1259 
1260  error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, TRUE);
1261  if (error != ERR_NONE) return error;
1262 
1263  smprintf(s, "Sending sms\n");
1264  return s->Protocol.Functions->WriteMessage(s, req, 6+length, 0x02);
1265 }
1266 
1268 {
1269  switch (msg->Buffer[3]) {
1270  case 0x00:
1271  smprintf(s, "Netmonitor correctly set\n");
1272  break;
1273  default:
1274  smprintf(s, "Menu %i\n",msg->Buffer[3]);
1275  smprintf(s, "%s\n",msg->Buffer+4);
1276  strcpy(s->Phone.Data.Netmonitor,msg->Buffer+4);
1277  break;
1278  }
1279  return ERR_NONE;
1280 }
1281 
1282 GSM_Error DCT3_Netmonitor(GSM_StateMachine *s, int testnumber, char *value)
1283 {
1284  GSM_Error error;
1285  unsigned char req[] = {0x00, 0x01, 0x7e,
1286  0x00}; /* Test number */
1287 
1288  value[0] = 0;
1289 
1290  error=DCT3_EnableSecurity (s, 0x01);
1291  if (error != ERR_NONE) return error;
1292 
1293  req[3] = testnumber;
1294 
1295  smprintf(s, "Getting netmonitor test\n");
1296  s->Phone.Data.Netmonitor = value;
1297  return GSM_WaitFor (s, req, 4, 0x40, 4, ID_Netmonitor);
1298 }
1299 
1301 {
1302  GSM_Error error;
1303 
1304  error=DCT3_EnableSecurity (s, 0x01);
1305  if (error != ERR_NONE) return error;
1306  return NOKIA_GetPhoneString(s,"\x00\x01\xCC\x02",4,0x40,value,ID_GetManufactureMonth,5);
1307 }
1308 
1310 {
1311  GSM_Error error;
1312 
1313  if (strlen(s->Phone.Data.ProductCodeCache)!=0) {
1314  strcpy(value,s->Phone.Data.ProductCodeCache);
1315  return ERR_NONE;
1316  }
1317 
1318  error=DCT3_EnableSecurity (s, 0x01);
1319  if (error != ERR_NONE) return error;
1320  return NOKIA_GetPhoneString(s,"\x00\x01\xCA\x01",4,0x40,value,ID_GetProductCode,5);
1321 }
1322 
1324 {
1325  GSM_Error error;
1326 
1327  error=DCT3_EnableSecurity (s, 0x01);
1328  if (error != ERR_NONE) return error;
1329  return NOKIA_GetPhoneString(s,"\x00\x01\xCC\x01",4,0x40,value,ID_GetOriginalIMEI,5);
1330 }
1331 
1333 {
1334  GSM_Error error;
1335 
1336  if (strlen(s->Phone.Data.HardwareCache)!=0) {
1337  strcpy(value,s->Phone.Data.HardwareCache);
1338  return ERR_NONE;
1339  }
1340 
1341  error=DCT3_EnableSecurity (s, 0x01);
1342  if (error != ERR_NONE) return error;
1343  return NOKIA_GetPhoneString(s,"\x00\x01\xC8\x05",4,0x40,value,ID_GetHardware,5);
1344 }
1345 
1346 GSM_Error DCT3_GetPPM(GSM_StateMachine *s, char *value)
1347 {
1348  GSM_Error error;
1349 
1350  error=DCT3_EnableSecurity (s, 0x01);
1351  if (error != ERR_NONE) return error;
1352  return NOKIA_GetPhoneString(s,"\x00\x01\xC8\x12",4,0x40,value,ID_GetPPM,5);
1353 }
1354 
1356 {
1357  unsigned char req[] = {N6110_FRAME_HEADER, 0x36, 0x64};
1358 
1359  s->Phone.Data.SMSStatus=status;
1360  smprintf(s, "Getting SMS status\n");
1361  return GSM_WaitFor (s, req, 5, 0x14, 4, ID_GetSMSStatus);
1362 
1363  /* 6210 family doesn't show in frame with SMS status info
1364  * about Templates. We get separately info about this SMS folder.
1365  */
1366 }
1367 
1369 {
1370  switch(msg->Buffer[3]) {
1371  case 0x0b:
1372  smprintf(s, "SMS deleted\n");
1373  return ERR_NONE;
1374  case 0x0c:
1375  smprintf(s, "Error deleting SMS\n");
1376  switch (msg->Buffer[4]) {
1377  case 0x00:
1378  /* Not tested on 6210 */
1379  smprintf(s, "Unknown meaning, SMS seems to be deleted\n");
1380  return ERR_NONE;
1381  case 0x02:
1382  /* Not tested on 6210 */
1383  smprintf(s, "Invalid location\n");
1384  return ERR_INVALIDLOCATION;
1385  case 0x06:
1386  /* Not tested on 6210 */
1387  smprintf(s, "Phone is OFF\n");
1388  return ERR_PHONEOFF;
1389  default:
1390  smprintf(s, "Unknown error: %02x\n",msg->Buffer[4]);
1391  return ERR_UNKNOWNRESPONSE;
1392  }
1393  }
1394  return ERR_UNKNOWNRESPONSE;
1395 }
1396 
1398 {
1399  GSM_Phone_Data *Data = &s->Phone.Data;
1400 
1401  smprintf(s, "Network level received: %i\n",msg->Buffer[4]);
1402  Data->SignalQuality->SignalStrength = -1;
1403  Data->SignalQuality->SignalPercent = ((int)msg->Buffer[4]);
1404  Data->SignalQuality->BitErrorRate = -1;
1405  return ERR_NONE;
1406 }
1407 
1409 {
1410  unsigned char req[] = {N6110_FRAME_HEADER, 0x81};
1411 
1412  s->Phone.Data.SignalQuality = sig;
1413  smprintf(s, "Getting network level\n");
1414  return GSM_WaitFor (s, req, 4, 0x0a, 4, ID_GetSignalQuality);
1415 }
1416 
1418 {
1419  GSM_Phone_Data *Data = &s->Phone.Data;
1420 
1421  smprintf(s, "Battery level received: %i\n",msg->Buffer[5]);
1422  Data->BatteryCharge->BatteryPercent = ((int)msg->Buffer[5]);
1423  Data->BatteryCharge->ChargeState = 0;
1424  return ERR_NONE;
1425 }
1426 
1428 {
1429  unsigned char req[] = {N6110_FRAME_HEADER, 0x02};
1430 
1431  s->Phone.Data.BatteryCharge = bat;
1432  smprintf(s, "Getting battery level\n");
1433  return GSM_WaitFor (s, req, 4, 0x17, 4, ID_GetBatteryCharge);
1434 }
1435 
1437 {
1438  GSM_Phone_Bitmap_Types BmpType;
1439  GSM_Phone_Data *Data = &s->Phone.Data;
1440 
1441  switch (msg->Buffer[4]) {
1442  case 0x02:
1443  if (Data->RequestID == ID_GetBitmap || Data->RequestID == ID_EachFrame) {
1444  smprintf(s, "Welcome note text received\n");
1445  CopyUnicodeString(Data->Bitmap->Text,msg->Buffer+6);
1446  smprintf(s, "Text is \"%s\"\n",DecodeUnicodeString(Data->Bitmap->Text));
1447  return ERR_NONE;
1448  }
1449  if (Data->RequestID == ID_SetBitmap || Data->RequestID == ID_EachFrame) {
1450  smprintf(s, "Startup text set\n");
1451  return ERR_NONE;
1452  }
1453  case 0x15:
1454  if (Data->RequestID == ID_GetBitmap || Data->RequestID == ID_EachFrame) {
1455  smprintf(s, "Startup logo received\n");
1456  BmpType=GSM_Nokia7110StartupLogo;
1457  if (msg->Buffer[17]==0x60) BmpType=GSM_Nokia6210StartupLogo;
1458  if (msg->Buffer[17]==0xc0) BmpType=GSM_NokiaStartupLogo;
1459  PHONE_DecodeBitmap(BmpType, msg->Buffer+22, Data->Bitmap);
1460  return ERR_NONE;
1461  }
1462  if (Data->RequestID == ID_SetBitmap || Data->RequestID == ID_EachFrame) {
1463  smprintf(s, "Startup logo set\n");
1464  return ERR_NONE;
1465  }
1466  case 0x17:
1467  if (Data->RequestID == ID_GetBitmap || Data->RequestID == ID_EachFrame) {
1468  smprintf(s, "Dealer note text received\n");
1469  CopyUnicodeString(Data->Bitmap->Text,msg->Buffer+6);
1470  smprintf(s, "Text is \"%s\"\n",DecodeUnicodeString(Data->Bitmap->Text));
1471  return ERR_NONE;
1472  }
1473  if (Data->RequestID == ID_SetBitmap || Data->RequestID == ID_EachFrame) {
1474  smprintf(s, "Dealer text set\n");
1475  return ERR_NONE;
1476  }
1477  }
1478  return ERR_UNKNOWNRESPONSE;
1479 }
1480 
1481 GSM_Error N71_92_GetPhoneSetting(GSM_StateMachine *s, int Request, int Setting)
1482 {
1483  unsigned char req[] = {N7110_FRAME_HEADER, 0xee,
1484  0x1c}; /* Setting */
1485 
1486  req[4]=Setting;
1487  return GSM_WaitFor (s, req, 5, 0x7a, 4, Request);
1488 }
1489 
1491 {
1492  return DCT3_GetDateTime(s, date_time, 0x19);
1493 }
1494 
1496 {
1497  return DCT3_SetDateTime(s, date_time, 0x19);
1498 }
1499 
1500 GSM_Error DCT3_DecodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer)
1501 {
1502  switch (buffer[12] & 0x03) {
1503  case 0x00:
1504  smprintf(s, "SMS type - deliver\n");
1505  SMS->PDU = SMS_Deliver;
1506  return GSM_DecodeSMSFrame(&(s->di), SMS,buffer,PHONE_SMSDeliver);
1507  case 0x01:
1508  smprintf(s, "SMS type - submit\n");
1509  SMS->PDU = SMS_Submit;
1510  return GSM_DecodeSMSFrame(&(s->di), SMS,buffer,PHONE_SMSSubmit);
1511  case 0x02:
1512  smprintf(s, "SMS type - delivery report\n");
1513  SMS->PDU = SMS_Status_Report;
1514  return GSM_DecodeSMSFrame(&(s->di), SMS,buffer,PHONE_SMSStatusReport);
1515  }
1516  return ERR_UNKNOWN;
1517 }
1518 
1520 {
1521  switch (msg->Buffer[3]) {
1522  case 0x31:
1523  smprintf(s, "Operator logo set OK\n");
1524  return ERR_NONE;
1525  case 0x32:
1526  smprintf(s, "Error setting operator logo\n");
1527  switch (msg->Buffer[4]) {
1528  case 0x7d:
1529  smprintf(s, "Too high location ?\n");
1530  return ERR_INVALIDLOCATION;
1531  default:
1532  smprintf(s, "ERROR: unknown %i\n",msg->Buffer[4]);
1533  }
1534  }
1535  return ERR_UNKNOWNRESPONSE;
1536 }
1537 
1539 {
1540  smprintf(s, "Phone settings cleaned OK\n");
1541  return ERR_NONE;
1542 }
1543 
1545 {
1546  GSM_Error error;
1547  unsigned char req[] = {0x00, 0x01, 0x65,
1548  0x01}; /* Reset type */
1549 
1550  switch (Type) {
1551  case GSM_RESET_PHONESETTINGS : req[3] = 0x01; break;
1552  case GSM_RESET_DEVICE : req[3] = 0x02; break;
1553  case GSM_RESET_USERINTERFACE : req[3] = 0x08; break;
1554  case GSM_RESET_USERINTERFACE_PHONESETTINGS : req[3] = 0x38; break;
1555  case GSM_RESET_FULLFACTORY : req[3] = 0xff; break;
1556  }
1557 
1558  error=DCT3_EnableSecurity (s, 0x01);
1559  if (error != ERR_NONE) return error;
1560 
1561  return GSM_WaitFor (s, req, 4, 0x40, 4, ID_ResetPhoneSettings);
1562 }
1563 
1564 #endif
1565 
1566 /* How should editor hadle tabs in this file? Add editor commands here.
1567  * vim: noexpandtab sw=8 ts=8 sts=8:
1568  */
GSM_SMSMessageType PDU
WAPSettings_Bearer ActiveBearer
Definition: gammu-wap.h:200
unsigned char * Netmonitor
Definition: gsmstate.h:577
char IPAddress[(20+1) *2]
Definition: gammu-wap.h:128
gboolean IsNormalAuthentication
Definition: gammu-wap.h:104
GSM_Error DCT3_EnableSecurity(GSM_StateMachine *s, unsigned char status)
GSM_ChargeState ChargeState
Definition: gammu-info.h:244
char HardwareCache[50]
Definition: gsmstate.h:466
const unsigned char * GSM_GetNetworkName(const char *NetworkCode)
Definition: gsmnet.c:2420
char * DecodeUnicodeString(const unsigned char *src)
Definition: coding.c:245
char Title[(20+1) *2]
Definition: gammu-wap.h:79
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
GSM_Alarm * Alarm
Definition: gsmstate.h:493
GSM_WAPSettings Settings[4]
Definition: gammu-wap.h:172
void DecodeDefault(unsigned char *dest, const unsigned char *src, size_t len, gboolean UseExtensions, unsigned char *ExtraAlphabet)
Definition: coding.c:498
GSM_Error N71_92_ReplyGetBatteryCharge(GSM_Protocol_Message *msg, GSM_StateMachine *s)
IncomingCBCallback IncomingCB
Definition: gsmstate.h:1383
gboolean IsSecurity
Definition: gammu-wap.h:91
GSM_Error N61_71_ReplyResetPhoneSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error DCT3_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
GSM_Error DCT3_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype)
GSM_Error DCT3_ReplyGetWAPSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3DCT4_GetWAPBookmarkPart(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
int GSM_PackSemiOctetNumber(const unsigned char *Number, unsigned char *Output, gboolean semioctet)
Definition: coding.c:1125
GSM_Error DCT3_ReplyGetIMEI(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyGetDateTime(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
GSM_Error DCT3_ReplyPlayTone(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_DecodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer)
#define N6110_FRAME_HEADER
Definition: ncommon.h:8
GSM_Error DCT3_ReplySIMLogin(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char NetworkName[15 *2]
Definition: gammu-info.h:135
GSM_Error N71_92_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_SMSMemoryStatus * SMSStatus
Definition: gsmstate.h:517
GSM_Error DCT3_GetPPM(GSM_StateMachine *s, char *value)
GSM_DateTime DateTime
void NOKIA_EncodeDateTime(GSM_StateMachine *s UNUSED, unsigned char *buffer, GSM_DateTime *datetime)
Definition: nfunc.c:1007
GSM_Error DCT3_ReplyDialCommand(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message *msg, GSM_StateMachine *s)
SendSMSStatusCallback SendSMSStatus
Definition: gsmstate.h:1385
GSM_Error GSM_DecodeSMSFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
Definition: gsmsms.c:807
gboolean EnableIncomingCB
Definition: gsmstate.h:667
GSM_Error
Definition: gammu-error.h:23
GSM_Error DCT3_GetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
GSM_Debug_Info di
Definition: gsmstate.h:1412
const char * model
Definition: gammu-info.h:764
GSM_CallShowNumber
Definition: gammu-call.h:192
GSM_NetworkInfo * NetworkInfo
Definition: gsmstate.h:541
char Service[(20+1) *2]
Definition: gammu-wap.h:114
char LAC[10]
Definition: gammu-info.h:131
void * SendSMSStatusUserData
Definition: gsmstate.h:1390
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
GSM_Error DCT3DCT4_EnableWAPFunctions(GSM_StateMachine *s)
GSM_SMSMessageLayout PHONE_SMSDeliver
Definition: pfunc.c:16
void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap)
Definition: gsmlogo.c:141
GSM_Error DCT3_Reset(GSM_StateMachine *s, gboolean hard)
GSM_Bitmap * Bitmap
Definition: gsmstate.h:573
GSM_Error DCT3_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype)
GSM_Error(* WriteMessage)(GSM_StateMachine *s, unsigned const char *buffer, int length, int type)
Definition: gsmstate.h:347
unsigned char Number
Definition: gammu-wap.h:168
char IMEI[GSM_MAX_IMEI_LENGTH+1]
Definition: gsmstate.h:437
GSM_Error DCT3_ReplyDeleteSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Phone_Bitmap_Types
Definition: gsmlogo.h:9
GSM_Error DCT3_ReplySetAlarm(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyGetWAPBookmark(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_SMSFormat Format
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
char NetworkCode[10]
Definition: gammu-info.h:122
WAPSettings_Bearer Bearer
Definition: gammu-wap.h:87
char CID[10]
Definition: gammu-info.h:118
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_Error DCT3_AnswerAllCalls(GSM_StateMachine *s)
GSM_Error DCT3_ReplySetSMSC(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message *msg, GSM_StateMachine *s)
char Code[(10+1) *2]
Definition: gammu-wap.h:123
GSM_SignalQuality * SignalQuality
Definition: gsmstate.h:533
GSM_Error DCT3_SetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
gboolean IsIP
Definition: gammu-wap.h:118
GSM_Error NOKIA_GetPhoneString(GSM_StateMachine *s, const unsigned char *msgframe, int msglen, unsigned char msgtype, char *retvalue, GSM_Phone_RequestID request, int startresponse)
char NetworkCode[10]
Definition: gammu-bitmap.h:160
GSM_Error DCT3DCT4_SetActiveConnectSet(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
char Server[(21+1) *2]
Definition: gammu-wap.h:109
GSM_Error DCT3_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error N71_92_ReplyGetSignalQuality(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char DefaultNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_Error N61_71_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
void NOKIA_DecodeNetworkCode(const unsigned char *buffer, char *output)
Definition: gsmnet.c:2473
gboolean PressKey
Definition: gsmstate.h:597
int gboolean
Definition: gammu-types.h:23
GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_ValidityPeriodFormat Format
GSM_Error N71_92_GetPhoneSetting(GSM_StateMachine *s, int Request, int Setting)
GSM_DateTime * DateTime
Definition: gsmstate.h:489
char User[(50+1) *2]
Definition: gammu-wap.h:142
gboolean ManualLogin
Definition: gammu-wap.h:132
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Error DCT3DCT4_CancelCall(GSM_StateMachine *s, int ID)
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
GSM_Error DCT3DCT4_DeleteWAPBookmarkPart(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
GSM_Error DCT3_ReplySetWAPSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_92_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
GSM_SMSValidity Validity
char Proxy[(100+1) *2]
Definition: gammu-wap.h:184
struct GSM_Phone_Data::@2 Priv
void NOKIA_GetUnicodeString(GSM_StateMachine *s, int *current, unsigned char *input, unsigned char *output, gboolean FullLength)
GSM_Error DCT3DCT4_DisableConnectionFunctions(GSM_StateMachine *s)
GSM_Error DCT3_ReplyPressKey(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_MultiWAPSettings * WAPSettings
Definition: gsmstate.h:569
WAPSettings_Speed Speed
Definition: gammu-wap.h:152
GSM_Error GSM_WaitFor(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout, GSM_Phone_RequestID request)
Definition: gsmstate.c:1029
GSM_GPRS_State GPRS
Definition: gammu-info.h:139
GSM_Error N71_92_ReplyPhoneSetting(GSM_Protocol_Message *msg, GSM_StateMachine *s)
int NOKIA_SetUnicodeString(GSM_StateMachine *s, unsigned char *dest, unsigned char *string, gboolean FullLength)
GSM_Error DCT3_GetIMEI(GSM_StateMachine *s)
GSM_Error DCT3_ReplyGetAlarm(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_SetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
DCT3_WAPSettings_Locations WAPLocations
Definition: n6110.h:18
GSM_Phone_RequestID RequestID
Definition: gsmstate.h:685
GSM_Error DCT3_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, gboolean start)
GSM_Error DCT3_ReplySIMLogout(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N61_91_ReplySetOpLogo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm, unsigned char msgtype)
GSM_Error DCT3_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
#define N7110_FRAME_HEADER
Definition: ncommon.h:9
GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
gboolean IsISDNCall
Definition: gammu-wap.h:100
GSM_Protocol Protocol
Definition: gsmstate.h:1430
GSM_BatteryCharge * BatteryCharge
Definition: gsmstate.h:537
GSM_NetworkInfo_State State
Definition: gammu-info.h:127
char Password[(50+1) *2]
Definition: gammu-wap.h:148
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_SMSMessageLayout PHONE_SMSStatusReport
Definition: pfunc.c:30
unsigned char Title[(50+1) *2]
Definition: gammu-wap.h:42
GSM_Error DCT3DCT4_GetActiveConnectSet(GSM_StateMachine *s)
void * IncomingCBUserData
Definition: gsmstate.h:1388
GSM_Error DCT3_GetProductCode(GSM_StateMachine *s, char *value)
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_KeyCode
Definition: gammu-keys.h:30
char Proxy2[(100+1) *2]
Definition: gammu-wap.h:192
GSM_Error GSM_UnpackSemiOctetNumber(GSM_Debug_Info *di, unsigned char *retval, const unsigned char *Number, size_t *pos, size_t bufferlength, gboolean semioctet)
Definition: coding.c:1028
int GSM_UnpackEightBitsToSeven(size_t offset, size_t in_length, size_t out_length, const unsigned char *input, unsigned char *output)
Definition: coding.c:953
GSM_Error DCT3_ReplyNetmonitor(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void GSM_ClearBitmap(GSM_Bitmap *bmp)
Definition: gsmlogo.c:247
char DialUp[(20+1) *2]
Definition: gammu-wap.h:136
gboolean IsContinuous
Definition: gammu-wap.h:95
GSM_Error N71_92_GetSignalQuality(GSM_StateMachine *s, GSM_SignalQuality *sig)
GSM_SMSMessageLayout PHONE_SMSSubmit
Definition: pfunc.c:23
size_t BitmapHeight
Definition: gammu-bitmap.h:152
GSM_Error DCT3_GetHardware(GSM_StateMachine *s, char *value)
GSM_Error DCT3_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm, unsigned char msgtype)
GSM_SMSC * SMSC
Definition: gsmstate.h:505
GSM_Error N71_92_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
size_t BitmapWidth
Definition: gammu-bitmap.h:156
GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
unsigned char Text[2 *(GSM_BITMAP_TEXT_LENGTH+1)]
Definition: gammu-bitmap.h:118
GSM_Protocol_Functions * Functions
Definition: gsmstate.h:424
char HomePage[(100+1) *2]
Definition: gammu-wap.h:83
unsigned char Address[(255+1) *2]
Definition: gammu-wap.h:38
#define TRUE
Definition: gammu-types.h:28
void NOKIA_DecodeDateTime(GSM_StateMachine *s, unsigned char *buffer, GSM_DateTime *datetime, gboolean seconds, gboolean DayMonthReverse)
Definition: nfunc.c:976
GSM_Error DCT3_ReplyWaitSMSC(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_GetOriginalIMEI(GSM_StateMachine *s, char *value)
GSM_Error DCT3DCT4_ReplyGetWAPBookmark(GSM_Protocol_Message *msg, GSM_StateMachine *s, gboolean FullLength)
GSM_Error DCT3_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
gboolean EnableIncomingSMS
Definition: gsmstate.h:663
GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
Definition: pfunc.c:58
unsigned char * Buffer
Definition: protocol.h:22
GSM_Error DCT3_Netmonitor(GSM_StateMachine *s, int testnumber, char *value)
#define UNUSED
Definition: gammu-misc.h:105
DCT3_WAPSettings_Locations WAPLocations
Definition: n7110.h:19
GSM_Error DCT3_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
GSM_ValidityPeriod Relative
GSM_Error DCT3_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
char Text[300]
gboolean Repeating
GSM_Error DCT3_ReplySetDateTime(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_ResetSettingsType
const unsigned char * GSM_GetCountryName(const char *CountryCode)
Definition: gsmnet.c:2452
char ProductCodeCache[50]
Definition: gsmstate.h:470
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
#define GSM_MAX_SMSC_NAME_LENGTH
Definition: gammu-limits.h:218
GSM_Error DCT3_GetManufactureMonth(GSM_StateMachine *s, char *value)
unsigned char Name[(GSM_MAX_SMSC_NAME_LENGTH+1) *2]