Gammu internals  1.38.0
n7110.c
Go to the documentation of this file.
1 /* (c) 2001-2004 by Marcin Wiacek */
2 /* based on some Markus Plail work from Gnokii (www.gnokii.org)
3  * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4  * GNU GPL version 2 or later
5  */
6 /* Due to a problem in the source code management, the names of some of
7  * the authors have unfortunately been lost. We do not mean to belittle
8  * their efforts and hope they will contact us to see their names
9  * properly added to the Copyright notice above.
10  * Having published their contributions under the terms of the GNU
11  * General Public License (GPL) [version 2], the Copyright of these
12  * authors will remain respected by adhering to the license they chose
13  * to publish their code under.
14  */
15 
16 #include <gammu-config.h>
17 
18 #ifdef GSM_ENABLE_NOKIA7110
19 
20 #include <string.h>
21 #include <time.h>
22 
23 #include <gammu-nokia.h>
24 
25 #include "../../../misc/coding/coding.h"
26 #include "../../../gsmcomon.h"
27 #include "../../../service/gsmlogo.h"
28 #include "../../../service/gsmring.h"
29 #include "../../../service/gsmnet.h"
30 #include "../../../service/sms/gsmmulti.h"
31 #include "../../pfunc.h"
32 #include "../nfunc.h"
33 #include "../nfuncold.h"
34 #include "n7110.h"
35 #include "dct3func.h"
36 
37 static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
38 {
39  return DCT3_GetAlarm(s, Alarm, 0x19);
40 }
41 
42 static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
43 {
44  return DCT3_SetAlarm(s, Alarm, 0x19);
45 }
46 
47 static GSM_Error N7110_ReplyGetMemory(GSM_Protocol_Message *msg, GSM_StateMachine *s)
48 {
49  GSM_Phone_Data *Data = &s->Phone.Data;
50 
51  smprintf(s, "Phonebook entry received\n");
52 
53  if (msg->Buffer[6] == 0x0f)
54  return N71_65_ReplyGetMemoryError(msg->Buffer[10], s);
55 
56  return N71_65_DecodePhonebook(s, Data->Memory,Data->Bitmap,Data->SpeedDial,msg->Buffer+18,msg->Length-18,FALSE);
57 }
58 
59 static GSM_Error N7110_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
60 {
61  unsigned char req[] = {N7110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01, 0x02,
62  0x05, /* memory type */
63  0x00, 0x00, /* location */
64  0x00, 0x00};
65 
67  if (req[9]==0xff) return ERR_NOTSUPPORTED;
68 
69  if (entry->Location==0x00) return ERR_INVALIDLOCATION;
70 
71  req[10] = entry->Location / 256;
72  req[11] = entry->Location % 256;
73 
74  s->Phone.Data.Memory=entry;
75  smprintf(s, "Getting phonebook entry\n");
76  return GSM_WaitFor (s, req, 14, 0x03, 4, ID_GetMemory);
77 }
78 
79 static GSM_Error N7110_ReplyGetMemoryStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
80 {
81  GSM_Phone_Data *Data = &s->Phone.Data;
82 
83  smprintf(s, "Memory status received\n");
84  /* Quess ;-)) */
85  if (msg->Buffer[10]==0x10) {
86  Data->MemoryStatus->MemoryFree = msg->Buffer[14]*256 + msg->Buffer[15];
87  } else {
88  Data->MemoryStatus->MemoryFree = msg->Buffer[18];
89  }
90  smprintf(s, " Size : %i\n",Data->MemoryStatus->MemoryFree);
91  Data->MemoryStatus->MemoryUsed = msg->Buffer[16]*256 + msg->Buffer[17];
92  smprintf(s, " Used : %i\n",Data->MemoryStatus->MemoryUsed);
94  smprintf(s, " Free : %i\n",Data->MemoryStatus->MemoryFree);
95  return ERR_NONE;
96 }
97 
98 static GSM_Error N7110_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
99 {
100  unsigned char req[] = {N6110_FRAME_HEADER, 0x03, 0x02,
101  0x05}; /* Memory type */
102 
104  if (req[5]==0xff) return ERR_NOTSUPPORTED;
105 
106  s->Phone.Data.MemoryStatus=Status;
107  smprintf(s, "Getting memory status\n");
108  return GSM_WaitFor (s, req, 6, 0x03, 4, ID_GetMemoryStatus);
109 }
110 
111 static void N7110_GetSMSLocation(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char *folderid, unsigned int *location)
112 {
113  int ifolderid;
114 
115  /* simulate flat SMS memory */
116  if (sms->Folder==0x00) {
117  ifolderid = sms->Location / GSM_PHONE_MAXSMSINFOLDER;
118  *folderid = (ifolderid + 1) * 0x08;
119  *location = sms->Location - ifolderid * GSM_PHONE_MAXSMSINFOLDER;
120  } else {
121  *folderid = sms->Folder * 0x08;
122  *location = sms->Location;
123  }
124  smprintf(s, "SMS folder %i & location %i -> 7110 folder %i & location %i\n",
125  sms->Folder,sms->Location,*folderid,*location);
126 }
127 
128 static void N7110_SetSMSLocation(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char folderid, int location)
129 {
130  sms->Folder = 0;
131  sms->Location = (folderid / 0x08 - 1) * GSM_PHONE_MAXSMSINFOLDER + location;
132  smprintf(s, "7110 folder %i & location %i -> SMS folder %i & location %i\n",
133  folderid,location,sms->Folder,sms->Location);
134 }
135 
136 static GSM_Error N7110_ReplyGetSMSFolders(GSM_Protocol_Message *msg, GSM_StateMachine *s)
137 {
138  int j,current=5;
139  unsigned char buffer[200];
140  GSM_Phone_Data *Data = &s->Phone.Data;
141 
142  switch (msg->Buffer[3]) {
143  case 0x7B:
144  smprintf(s, "Names for SMS folders received\n");
145  Data->SMSFolders->Number=msg->Buffer[4];
146  for (j=0;j<msg->Buffer[4];j++) {
147  smprintf(s, "Folder index: %02x",msg->Buffer[current]);
148  current++;
149  smprintf(s, ", folder name: \"");
150  CopyUnicodeString(buffer,msg->Buffer+current);
152  smprintf(s, "Too long text\n");
153  return ERR_UNKNOWNRESPONSE;
154  }
155  CopyUnicodeString(Data->SMSFolders->Folder[j].Name,buffer);
156  smprintf(s, "%s\"\n",DecodeUnicodeString(buffer));
157  current=current+2+UnicodeLength(buffer)*2;
158  Data->SMSFolders->Folder[j].InboxFolder = FALSE;
159  if (j==0) Data->SMSFolders->Folder[j].InboxFolder = TRUE;
160  Data->SMSFolders->Folder[j].OutboxFolder = FALSE;
164  Data->SMSFolders->Folder[j].Memory = MEM_ME;
165  if (j==0 || j==1) Data->SMSFolders->Folder[j].InboxFolder = MEM_MT;
166  }
167  return ERR_NONE;
168  case 0x7C:
169  smprintf(s, "Security error ? No PIN ?\n");
170  return ERR_SECURITYERROR;
171  case 0xCA:
172  smprintf(s, "Wait a moment. Phone is during power on and busy now\n");
173  return ERR_SECURITYERROR;
174  }
175  return ERR_UNKNOWNRESPONSE;
176 }
177 
178 static GSM_Error N7110_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
179 {
180  unsigned char req[] = {N6110_FRAME_HEADER, 0x7A, 0x00, 0x00};
181 
182  s->Phone.Data.SMSFolders=folders;
183  smprintf(s, "Getting SMS folders\n");
184  return GSM_WaitFor (s, req, 6, 0x14, 4, ID_GetSMSFolders);
185 }
186 
187 static GSM_Error N7110_ReplyGetSMSFolderStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
188 {
189  int i;
190  GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
191 
192  smprintf(s, "SMS folder status received\n");
193  Priv->LastSMSFolder.Number=msg->Buffer[4]*256+msg->Buffer[5];
194  smprintf(s, "Number of Entries: %i\n",Priv->LastSMSFolder.Number);
195  smprintf(s, "Locations: ");
196  for (i=0;i<Priv->LastSMSFolder.Number;i++) {
197  Priv->LastSMSFolder.Location[i]=msg->Buffer[6+(i*2)]*256+msg->Buffer[(i*2)+7];
199  smprintf(s, "Increase GSM_PHONE_MAXSMSINFOLDER\n");
200  return ERR_UNKNOWNRESPONSE;
201  }
202  smprintf(s, "%i ",Priv->LastSMSFolder.Location[i]);
203  }
204  smprintf(s, "\n");
206  return ERR_NONE;
207 }
208 
209 static GSM_Error N7110_PrivGetSMSFolderStatus(GSM_StateMachine *s, int folderid)
210 {
211  unsigned char req[] = {N7110_FRAME_HEADER, 0x6b,
212  0x08, /* folderID */
213  0x0F, 0x01};
214 
215  req[4] = folderid;
216 
217  smprintf(s, "Getting SMS folder status\n");
218  return GSM_WaitFor (s, req, 7, 0x14, 4, ID_GetSMSFolderStatus);
219 }
220 
221 static GSM_Error N7110_GetSMSFolderStatus(GSM_StateMachine *s, int folderid)
222 {
223  GSM_Error error;
224  int i;
225  GSM_NOKIASMSFolder folder;
226 
227  error = N7110_PrivGetSMSFolderStatus(s,folderid);
228  /* 0x08 contais read Inbox, 0xf8 unread Inbox.
229  * we want all msg from Inbox, so read both 0x08 and 0xf8 */
230  if (folderid==0x08 && error==ERR_NONE) {
231  folder=s->Phone.Data.Priv.N7110.LastSMSFolder;
232  error = N7110_PrivGetSMSFolderStatus(s,0xf8);
233  if (error==ERR_NONE) {
234  for (i=0;i<folder.Number;i++) {
235  s->Phone.Data.Priv.N7110.LastSMSFolder.Location[s->Phone.Data.Priv.N7110.LastSMSFolder.Number++]=folder.Location[i];
236  }
237  }
238  }
239  return error;
240 }
241 
242 static GSM_SMSMessageLayout N7110_SMSTemplate = {
243  36 /* SMS Text */, 17 /* Phone number */,
244  255 /* SMSC Number */, 15 /* TPDCS */,
245  255 /* SendingDateTime */, 255 /* SMSCDateTime */,
246  255 /* TPStatus */, 16 /* TPUDL */,
247  255 /* TPVP */, 12 /* firstbyte */,
248  13 /* TPMR */, 255 /* TPPID?? */};
249 
250 static GSM_Error N7110_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
251 {
252  int i;
253  size_t Width, Height;
254  unsigned char output[500], output2[500];
255  GSM_Phone_Data *Data = &s->Phone.Data;
256  size_t pos;
257  GSM_Error error;
258 
259  switch(msg->Buffer[3]) {
260  case 0x08:
261  switch (msg->Buffer[8]) {
262  case 0x00:
263  case 0x01:
264  smprintf(s, "SMS message\n");
265  if (Data->RequestID == ID_GetSMSMessage) {
266  Data->GetSMSMessage->Number=1;
267  NOKIA_DecodeSMSState(s, msg->Buffer[4], &Data->GetSMSMessage->SMS[0]);
268  DCT3_DecodeSMSFrame(s, &Data->GetSMSMessage->SMS[0],msg->Buffer+9);
269  return ERR_NONE;
270  }
271  case 0x02:
272  smprintf(s, "SMS template\n");
273  if (Data->RequestID == ID_GetSMSMessage) {
274  Data->GetSMSMessage->Number=1;
275  NOKIA_DecodeSMSState(s, msg->Buffer[4], &Data->GetSMSMessage->SMS[0]);
276  Data->GetSMSMessage->SMS[0].PDU=SMS_Submit;
277  GSM_DecodeSMSFrame(&(s->di), &Data->GetSMSMessage->SMS[0],msg->Buffer+9,N7110_SMSTemplate);
278  return ERR_NONE;
279  }
280  case 0x07:
281  smprintf(s, "Picture Image\n");
282  switch (Data->RequestID) {
283  case ID_GetBitmap:
285  Data->Bitmap->BitmapWidth = Width;
286  Data->Bitmap->BitmapHeight = Height;
288  pos = 22;
289  error = GSM_UnpackSemiOctetNumber(&(s->di), Data->Bitmap->Sender, msg->Buffer, &pos, msg->Length, TRUE);
290  if (error != ERR_NONE) {
291  return error;
292  }
293 #ifdef DEBUG
294  pos = 9;
295  error = GSM_UnpackSemiOctetNumber(&(s->di), output, msg->Buffer, &pos, msg->Length, TRUE);
296  if (error != ERR_NONE) {
297  return error;
298  }
299  smprintf(s, "SMSC : %s\n",DecodeUnicodeString(output));
300 #endif
301  Data->Bitmap->Text[0] = 0;
302  Data->Bitmap->Text[1] = 0;
303  if (msg->Length!=304) {
304  GSM_UnpackEightBitsToSeven(0, msg->Length-304, msg->Length-304, msg->Buffer+52+PHONE_GetBitmapSize(GSM_NokiaPictureImage,0,0),output);
305  DecodeDefault(Data->Bitmap->Text, output, msg->Length - 304, TRUE, NULL);
306  }
307  return ERR_NONE;
308  case ID_GetSMSMessage:
309  Data->GetSMSMessage->Number = 0;
310  i = 0;
311  output[i++] = 0x30; /* Smart Messaging 3.0 */
312  output[i++] = SM30_OTA;
313  output[i++] = 0x01; /* Length */
314  output[i++] = 0x00; /* Length */
315  output[i++] = 0x00;
317  output[i++] = Width;
318  output[i++] = Height;
319  output[i++] = 0x01;
320  memcpy(output+i,msg->Buffer+51,PHONE_GetBitmapSize(GSM_NokiaPictureImage,0,0));
322  if (msg->Length!=304) {
323  output[i++] = SM30_UNICODETEXT;
324  output[i++] = 0;
325  output[i++] = 0; /* Length - later changed */
326  GSM_UnpackEightBitsToSeven(0, msg->Length-304, msg->Length-304, msg->Buffer+52+PHONE_GetBitmapSize(GSM_NokiaPictureImage,0,0),output2);
327  DecodeDefault(output+i, output2, msg->Length - 304, TRUE, NULL);
328  output[i - 1] = UnicodeLength(output+i) * 2;
329  i = i + output[i-1];
330  }
332  for (i=0;i<3;i++) {
333  Data->GetSMSMessage->SMS[i].Number[0]=0;
334  Data->GetSMSMessage->SMS[i].Number[1]=0;
335  }
336  return ERR_NONE;
337  default:
338  smprintf(s, "Unknown SMS type: %i\n",msg->Buffer[8]);
339  return ERR_UNKNOWNRESPONSE;
340  }
341  default:
342  smprintf(s, "Unknown SMS type: %i\n",msg->Buffer[8]);
343  }
344  break;
345  case 0x09:
346  switch (msg->Buffer[4]) {
347  case 0x02:
348  smprintf(s, "Too high location ?\n");
349  return ERR_INVALIDLOCATION;
350  case 0x07:
351  smprintf(s, "Empty\n");
352  return ERR_EMPTY;
353  default:
354  smprintf(s, "ERROR: unknown %i\n",msg->Buffer[4]);
355  }
356  case 0x6F:
357  smprintf(s, "SMS message info received\n");
358  if (msg->Length == 43) {
359  Data->GetSMSMessage->SMS[0].Name[0] = 0;
360  Data->GetSMSMessage->SMS[0].Name[1] = 0;
361  } else {
362  CopyUnicodeString(Data->GetSMSMessage->SMS[0].Name,msg->Buffer+43);
363  }
364  smprintf(s, "Name: \"%s\"\n",DecodeUnicodeString(Data->GetSMSMessage->SMS[0].Name));
365  return ERR_NONE;
366  }
367  return ERR_UNKNOWNRESPONSE;
368 }
369 
370 static GSM_Error N7110_PrivGetSMSMessage(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
371 {
372  GSM_Error error;
373  unsigned char folderid;
374  unsigned int location;
375  int i;
376  unsigned char req[] = {N6110_FRAME_HEADER, 0x07,
377  0x08, /* folder ID */
378  0x00, 0x05, /* location */
379  0x01, 0x65, 0x01};
380  unsigned char NameReq[] = {N6110_FRAME_HEADER, 0x6E,
381  0x08, /* folder ID */
382  0x00, 0x05}; /* location */
383 
384  N7110_GetSMSLocation(s, &sms->SMS[0], &folderid, &location);
385 
386  req[4]=folderid;
387  req[5]=location / 256;
388  req[6]=location % 256;
389 
390  s->Phone.Data.GetSMSMessage=sms;
391  smprintf(s, "Getting sms\n");
392  error=GSM_WaitFor (s, req, 10, 0x14, 4, ID_GetSMSMessage);
393  if (error==ERR_NONE) {
394  NameReq[4] = folderid;
395  NameReq[5] = location / 256;
396  NameReq[6] = location;
397  smprintf(s, "Getting sms info\n");
398  error=GSM_WaitFor (s, NameReq, 7, 0x14, 4, ID_GetSMSMessage);
399  if (error != ERR_NONE) return error;
400  for (i=0;i<sms->Number;i++) {
401  N7110_SetSMSLocation(s, &sms->SMS[i], folderid, location);
402  sms->SMS[i].Folder = folderid/0x08;
403  sms->SMS[i].InboxFolder = TRUE;
404  if (folderid/0x08 != 0x01) sms->SMS[i].InboxFolder = FALSE;
405  CopyUnicodeString(sms->SMS[i].Name,sms->SMS[0].Name);
406  sms->SMS[i].Memory = MEM_ME;
407  if (folderid/0x08 == 0x01 || folderid/0x08 == 0x02) {
408  sms->SMS[i].Memory = MEM_MT;
409  if (folderid/0x08 == 0x01) { /* Inbox */
410  if (sms->SMS[i].State == SMS_Sent) sms->SMS[i].Memory = MEM_ME;
411  if (sms->SMS[i].State == SMS_UnSent) sms->SMS[i].Memory = MEM_ME;
412  if (sms->SMS[i].State == SMS_Read) sms->SMS[i].Memory = MEM_SM;
413  if (sms->SMS[i].State == SMS_UnRead) sms->SMS[i].Memory = MEM_SM;
414  }
415  if (folderid/0x08 == 0x02) { /* Outbox */
416  if (sms->SMS[i].State == SMS_Sent) sms->SMS[i].Memory = MEM_SM;
417  if (sms->SMS[i].State == SMS_UnSent) sms->SMS[i].Memory = MEM_SM;
418  if (sms->SMS[i].State == SMS_Read) sms->SMS[i].Memory = MEM_ME;
419  if (sms->SMS[i].State == SMS_UnRead) sms->SMS[i].Memory = MEM_ME;
420  }
421  }
422  }
423  }
424  return error;
425 }
426 
427 static GSM_Error N7110_GetSMSMessage(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
428 {
429  GSM_Error error;
430  unsigned char folderid;
431  unsigned int location;
432  GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
433  int i;
434  gboolean found = FALSE;
435 
436  N7110_GetSMSLocation(s, &(sms->SMS[0]), &folderid, &location);
437  error=N7110_GetSMSFolderStatus(s, folderid);
438  if (error!=ERR_NONE) return error;
439  for (i=0;i<Priv->LastSMSFolder.Number;i++) {
440  if (Priv->LastSMSFolder.Location[i]==location) {
441  found = TRUE;
442  break;
443  }
444  }
445  if (!found) return ERR_EMPTY;
446  return N7110_PrivGetSMSMessage(s,sms);
447 }
448 
449 static GSM_Error N7110_GetNextSMSMessage(GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
450 {
451  GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
452  unsigned char folderid;
453  unsigned int location;
454  GSM_Error error;
455  int i;
456  gboolean findnextfolder = FALSE;
457 
458  if (start) {
459  folderid=0x00;
460  findnextfolder=TRUE;
461  error=N7110_GetSMSFolders(s,&Priv->LastSMSFolders);
462  if (error!=ERR_NONE) return error;
463  } else {
464  N7110_GetSMSLocation(s, &(sms->SMS[0]), &folderid, &location);
465  for (i=0;i<Priv->LastSMSFolder.Number;i++) {
466  if (Priv->LastSMSFolder.Location[i]==location) break;
467  }
468  /* Is this last location in this folder ? */
469  if (i==Priv->LastSMSFolder.Number-1) {
470  findnextfolder=TRUE;
471  } else {
472  location=Priv->LastSMSFolder.Location[i+1];
473  }
474  }
475  if (findnextfolder) {
476  Priv->LastSMSFolder.Number=0;
477  while (Priv->LastSMSFolder.Number==0) {
478  folderid=folderid+0x08;
479  /* Too high folder number */
480  if ((folderid/0x08)>Priv->LastSMSFolders.Number) return ERR_EMPTY;
481  /* Get next folder status */
482  error=N7110_GetSMSFolderStatus(s, folderid);
483  if (error!=ERR_NONE) return error;
484  /* First location from this folder */
485  location=Priv->LastSMSFolder.Location[0];
486  }
487  }
488  N7110_SetSMSLocation(s, &sms->SMS[0], folderid, location);
489 
490  return N7110_PrivGetSMSMessage(s, sms);
491 }
492 
493 static int N7110_ReturnBinaryRingtoneLocation(char *model)
494 {
495  if (strcmp(model,"NSE-5") == 0) return 0x72; /* first 0x72 - 7110 */
496  if (strcmp(model,"NPE-3") == 0) return 0x89; /* first 0x89 - 6210 */
497  if (strcmp(model,"NHM-3") == 0) return 0x89; /* quess for 6250 */
498  return 0;
499 }
500 
501 static GSM_Error N7110_ReplyGetRingtone(GSM_Protocol_Message *msg, GSM_StateMachine *s)
502 {
503  int tmp;
504  size_t i;
505  GSM_Phone_Data *Data = &s->Phone.Data;
506 
507  smprintf(s, "Ringtone received\n");
508  switch (msg->Buffer[3]) {
509  case 0x23:
510  tmp=0;i=4;
511  while (msg->Buffer[i]!=0 || msg->Buffer[i+1]!=0) {
512  tmp++;
513  i=i+2;
514  if (i>msg->Length) return ERR_EMPTY;
515  }
516  memcpy(Data->Ringtone->Name,msg->Buffer+6,tmp*2);
517  smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name));
518  /* Looking for end */
519  i=37;
520  while (TRUE) {
521  if (msg->Buffer[i]==0x07 && msg->Buffer[i+1]==0x0b) {
522  i=i+2; break;
523  }
524  if (msg->Buffer[i]==0x0e && msg->Buffer[i+1]==0x0b) {
525  i=i+2; break;
526  }
527  i++;
528  if (i==msg->Length) return ERR_EMPTY;
529  }
530  /* Copying frame */
531  memcpy(Data->Ringtone->NokiaBinary.Frame,msg->Buffer+37,i-37);
532  Data->Ringtone->NokiaBinary.Length=i-37;
533  return ERR_NONE;
534  case 0x24:
535  smprintf(s, "Invalid location. Too high ?\n");
536  return ERR_INVALIDLOCATION;
537  }
538  return ERR_UNKNOWNRESPONSE;
539 }
540 
541 static GSM_Error N7110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone)
542 {
543  unsigned char req[] = {N7110_FRAME_HEADER, 0x22, 0x00, 0x00};
544 
545  if (PhoneRingtone) return ERR_NOTSUPPORTED;
546  if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY;
547 
548  switch (Ringtone->Format) {
549  case RING_NOTETONE:
550  /* In the future get binary and convert */
551  return ERR_NOTSUPPORTED;
552  case RING_NOKIABINARY:
553  req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location;
554  s->Phone.Data.Ringtone=Ringtone;
555  smprintf(s, "Getting binary ringtone\n");
556  return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone);
557  case RING_MIDI:
558  case RING_MMF:
559  return ERR_NOTSUPPORTED;
560  }
561  return ERR_NOTSUPPORTED;
562 }
563 
564 static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
565 {
566  int i;
567  GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
568 
569  smprintf(s, "Received info for Picture Images\n");
570  smprintf(s, "Number : %i\n",msg->Buffer[4]*256+msg->Buffer[5]);
571  smprintf(s, "Locations :");
572  Priv->LastPictureImageFolder.Number=msg->Buffer[4]*256+msg->Buffer[5];
573  for (i=0;i<Priv->LastPictureImageFolder.Number;i++) {
574  Priv->LastPictureImageFolder.Location[i]=msg->Buffer[6+i*2]*256+msg->Buffer[7+i*2];
575  smprintf(s, " %i",Priv->LastPictureImageFolder.Location[i]);
576  }
577  smprintf(s, "\n");
578  return ERR_NONE;
579 }
580 
581 static GSM_Error N7110_GetPictureImageLocation(GSM_StateMachine *s, GSM_Bitmap *Bitmap, unsigned char *folder, int *location)
582 {
583  GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
584  GSM_SMSFolders folders;
585  GSM_Error error;
586  int i, j = 0, count = 0;
587  unsigned char req[] = {N6110_FRAME_HEADER, 0x96,
588  0x00, /* Folder ID */
589  0x0f, 0x07};
590 
591  /* Just to have some defined values */
592  *folder = 0;
593  *location = 0;
594 
595  error=N7110_GetSMSFolders (s, &folders);
596  if (error!=ERR_NONE) return error;
597 
598  for (i=0;i<folders.Number;i++) {
599  req[4] = (i+1) * 0x08; /* SMS folder ID */
600  error = GSM_WaitFor (s, req, 7, 0x14, 4, ID_GetBitmap);
601  if (error!=ERR_NONE) return error;
602  for (j=0;j<Priv->LastPictureImageFolder.Number;j++) {
603  count++;
604  if (count==Bitmap->Location) break;
605  }
606  if (count==Bitmap->Location) break;
607  }
608  if (count!=Bitmap->Location) return ERR_INVALIDLOCATION;
609  *folder = (i+1) * 0x08; /* SMS Folder ID */
610  *location = Priv->LastPictureImageFolder.Location[j];
611  return ERR_NONE;
612 }
613 
614 static GSM_Error N7110_GetPictureImage(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
615 {
616  unsigned char folder;
617  int location;
618  GSM_Error error;
619  unsigned char req[] = {N6110_FRAME_HEADER, 0x07,
620  0x00, /* Folder ID */
621  0x00, 0x00, /* Location */
622  0x00, 0x64};
623 
624  error = N7110_GetPictureImageLocation(s, Bitmap, &folder, &location);
625  switch (error) {
626  case ERR_NONE:
627  req[4] = folder;
628  req[5] = location / 256;
629  req[6] = location % 256;
630  return GSM_WaitFor (s, req, 9, 0x14, 4, ID_GetBitmap);
631  default:
632  return error;
633  }
634 }
635 
636 static GSM_Error N7110_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
637 {
638  GSM_MemoryEntry pbk;
639  GSM_Error error;
640  unsigned char OpReq[] = {N6110_FRAME_HEADER, 0x70};
641 
642  s->Phone.Data.Bitmap=Bitmap;
643  switch (Bitmap->Type) {
644  case GSM_StartupLogo:
645  smprintf(s, "Getting startup logo\n");
646  return N71_92_GetPhoneSetting(s, ID_GetBitmap, 0x15);
648  smprintf(s, "Getting welcome note\n");
649  return N71_92_GetPhoneSetting(s, ID_GetBitmap, 0x02);
650  case GSM_DealerNote_Text:
651  smprintf(s, "Getting dealer note\n");
652  return N71_92_GetPhoneSetting(s, ID_GetBitmap, 0x17);
653  case GSM_CallerGroupLogo:
655  pbk.Location = Bitmap->Location;
656  smprintf(s, "Getting caller group logo\n");
657  error=N7110_GetMemory(s,&pbk);
658  if (error==ERR_NONE) NOKIA_GetDefaultCallerGroupName(Bitmap);
659  return error;
660  case GSM_OperatorLogo:
661  smprintf(s, "Getting operator logo\n");
662  /* This is like DCT3_GetNetworkInfo */
663  return GSM_WaitFor (s, OpReq, 4, 0x0a, 4, ID_GetBitmap);
664  case GSM_PictureImage:
665  /* 7110 doesn't support it */
666  if (strcmp(s->Phone.Data.Model,"NSE-5") == 0) return ERR_NOTSUPPORTED;
667  return N7110_GetPictureImage(s, Bitmap);
668  default:
669  break;
670  }
671  return ERR_NOTSUPPORTED;
672 }
673 
674 static GSM_Error N7110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
675 {
676  GSM_Ringtone dest;
677  GSM_Error error;
678  GSM_NetworkInfo NetInfo;
679  size_t size=200;
680  unsigned char req[1000] = {0x7C, 0x01, 0x00, 0x0D, 0x00,
681  0x00, 0x00, 0x00, 0x00, 0x00,
682  0x00}; /*Length*/
683  unsigned char req2[4000] = {N7110_FRAME_HEADER, 0x1F, 0x00,
684  0x87, /* Location */
685  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
686  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
687  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
688  0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
689  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
690 
691  switch (Ringtone->Format) {
692  case RING_NOTETONE:
693  if (Ringtone->Location==255) {
694  /* 7110 doesn't support it */
695  if (strcmp(s->Phone.Data.Model,"NSE-5") == 0) return ERR_NOTSUPPORTED;
696  *maxlength=GSM_EncodeNokiaRTTLRingtone(Ringtone, req+11, &size);
697  req[10] = size;
698  error = s->Protocol.Functions->WriteMessage(s, req, size+11, 0x00);
699  if (error!=ERR_NONE) return error;
700  sleep(1);
701  /* We have to make something (not important, what) now */
702  /* no answer from phone*/
703  return DCT3_GetNetworkInfo(s,&NetInfo);
704  }
705  GSM_RingtoneConvert(&dest, Ringtone, RING_NOKIABINARY);
706  break;
707  case RING_NOKIABINARY:
708  memcpy(&dest,Ringtone,sizeof(GSM_Ringtone));
709  break;
710  default:
711  return ERR_NOTSUPPORTED;
712  }
713  req2[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location;
714  CopyUnicodeString(req2+6,Ringtone->Name);
715  memcpy(req2+37,dest.NokiaBinary.Frame,dest.NokiaBinary.Length);
716  error = s->Protocol.Functions->WriteMessage(s, req2, 37+dest.NokiaBinary.Length, 0x1F);
717  if (error!=ERR_NONE) return error;
718  sleep(1);
719  /* We have to make something (not important, what) now */
720  /* no answer from phone*/
721  return DCT3_GetNetworkInfo(s,&NetInfo);
722 }
723 
724 static GSM_Error N7110_ReplySaveSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
725 {
726  GSM_Phone_Data *Data = &s->Phone.Data;
727 
728  switch (msg->Buffer[3]) {
729  case 0x05:
730  smprintf(s, "SMS message saving status\n");
731  smprintf(s, "Saved in folder %i at location %i\n",msg->Buffer[4], msg->Buffer[5]*256+msg->Buffer[6]);
732  if (msg->Buffer[4] == 0xf8) {
733  N7110_SetSMSLocation(s, Data->SaveSMSMessage,0x08,msg->Buffer[5]*256+msg->Buffer[6]);
734  Data->SaveSMSMessage->Folder = 0x01;
735  } else {
736  N7110_SetSMSLocation(s, Data->SaveSMSMessage,msg->Buffer[4],msg->Buffer[5]*256+msg->Buffer[6]);
737  Data->SaveSMSMessage->Folder = msg->Buffer[4] / 0x08;
738  }
739  return ERR_NONE;
740  case 0x06:
741  smprintf(s, "SMS message saving status\n");
742  switch (msg->Buffer[4]) {
743  case 0x03:
744  smprintf(s, "Too high location ?\n");
745  return ERR_INVALIDLOCATION;
746  default:
747  smprintf(s, "ERROR: unknown %i\n",msg->Buffer[4]);
748  }
749  break;
750  case 0x84:
751  smprintf(s, "Name for SMS changed OK to \"%s\"\n",DecodeUnicodeString(msg->Buffer+7));
752  smprintf(s, "Saved in folder %i at location %i\n",msg->Buffer[4], msg->Buffer[5]*256+msg->Buffer[6]);
753  if (msg->Buffer[4] == 0xf8) {
754  N7110_SetSMSLocation(s, Data->SaveSMSMessage,0x08,msg->Buffer[5]*256+msg->Buffer[6]);
755  Data->SaveSMSMessage->Folder = 0x01;
756  } else {
757  N7110_SetSMSLocation(s, Data->SaveSMSMessage,msg->Buffer[4],msg->Buffer[5]*256+msg->Buffer[6]);
758  Data->SaveSMSMessage->Folder = msg->Buffer[4] / 0x08;
759  }
760  return ERR_NONE;
761  }
762  return ERR_UNKNOWNRESPONSE;
763 }
764 
765 static GSM_Error N7110_PrivSetSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
766 {
767  int length;
768  unsigned int location;
769  unsigned char folderid, folder;
770  GSM_Error error;
771  unsigned char req[256] = {N6110_FRAME_HEADER, 0x04,
772  0x03, /* sms status */
773  0x10, /* folder */
774  0x00,0x00, /* location */
775  0x00};
776  unsigned char NameReq[200] = {N6110_FRAME_HEADER, 0x83};
777 
778  switch (sms->State) {
779  case SMS_Read : req[4] = 0x01; break;
780  case SMS_UnRead : req[4] = 0x03; break;
781  case SMS_Sent : req[4] = 0x05; break;
782  case SMS_UnSent : req[4] = 0x07; break;
783  }
784 
785  N7110_GetSMSLocation(s, sms, &folderid, &location);
786  req[5] = folderid;
787  req[6] = location / 256;
788  req[7] = location % 256;
789 
790  sms->Memory = MEM_ME;
791  /* Outbox */
792  if (folderid == 0x10 && (sms->State == SMS_Sent || sms->State == SMS_UnSent)) {
793  sms->PDU = SMS_Submit; /* We will use SIM Outbox */
794  sms->Memory = MEM_SM;
795  }
796  /* Inbox */
797  if (folderid == 0x08 && (sms->State == SMS_UnRead || sms->State == SMS_Read)) {
798  if (sms->State == SMS_UnRead) req[5] = 0xf8; /* We will use SIM Inbox */
799  sms->Memory = MEM_SM;
800  }
801 
802  switch (sms->PDU) {
803  case SMS_Deliver:
804  error = PHONE_EncodeSMSFrame(s,sms,req+9,PHONE_SMSDeliver,&length,TRUE);
805  break;
806  case SMS_Submit:
807  smprintf(s, "Saving SMS template\n");
808  error = PHONE_EncodeSMSFrame(s,sms,req+9,N7110_SMSTemplate,&length,TRUE);
809  req[8] = 0x02; /* SMS Template info */
810  break;
811  default:
812  return ERR_UNKNOWN;
813  }
814  if (error != ERR_NONE) return error;
815 
816  s->Phone.Data.SaveSMSMessage=sms;
817  smprintf(s, "Saving sms\n");
818  error=GSM_WaitFor (s, req, 9+length, 0x14, 4, ID_SaveSMSMessage);
819  if (error == ERR_NONE && UnicodeLength(sms->Name)!=0) {
820  folder = sms->Folder;
821  sms->Folder = 0;
822  N7110_GetSMSLocation(s, sms, &folderid, &location);
823  length = 4;
824  NameReq[length++] = folderid;
825  NameReq[length++] = location / 256;
826  NameReq[length++] = location % 256;
827  CopyUnicodeString(NameReq+length, sms->Name);
828  length = length+UnicodeLength(sms->Name)*2;
829  NameReq[length++] = 0;
830  NameReq[length++] = 0;
831  error=GSM_WaitFor (s, NameReq, length, 0x14, 4, ID_SaveSMSMessage);
832  sms->Folder = folder;
833  }
834  return error;
835 }
836 
837 static GSM_Error N7110_SetSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
838 {
839  unsigned int location;
840  unsigned char folderid;
841 
842  N7110_GetSMSLocation(s, sms, &folderid, &location);
843  if (location == 0) return ERR_INVALIDLOCATION;
844  return N7110_PrivSetSMSMessage(s, sms);
845 }
846 
847 static GSM_Error N7110_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
848 {
849  unsigned int location;
850  unsigned char folderid;
851 
852  N7110_GetSMSLocation(s, sms, &folderid, &location);
853  location = 0;
854  N7110_SetSMSLocation(s, sms, folderid, location);
855  return N7110_PrivSetSMSMessage(s, sms);
856 }
857 
858 static GSM_Error N7110_ReplyClearOperatorLogo(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
859 {
860  smprintf(s, "Clearing operator logo.....\n");
861  return ERR_NONE;
862 }
863 
864 static GSM_Error N7110_ReplySetOperatorLogo(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
865 {
866  smprintf(s, "Setting operator logo.....\n");
867  return ERR_NONE;
868 }
869 
870 static GSM_Error N7110_SetCallerLogo(GSM_StateMachine *s, GSM_Bitmap *bitmap)
871 {
872  int block=0, i;
873  size_t Width, Height;
874  unsigned int count = 18;
875  char string[500];
876  unsigned char req[500] = {N6110_FRAME_HEADER, 0x0b, 0x00,
877  0x01, 0x01, 0x00, 0x00, 0x0c,
878  0x00, 0x10, /* memory type */
879  0x00, 0x00, /* location */
880  0x00, 0x00, 0x00};
881 
882  req[13] = bitmap->Location;
883 
884  /* Enabling/disabling logo */
885  if (bitmap->DefaultBitmap) {
886  string[0] = 0; /* disabling */
887  } else {
888  string[0] = bitmap->BitmapEnabled?1:0;
889  }
890  string[1] = 0;
891  count += N71_65_PackPBKBlock(s, N7110_PBK_LOGOON, 2, block++, string, req + count);
892 
893  /* Ringtone */
894  if (!bitmap->DefaultRingtone) {
895  string[0] = bitmap->RingtoneID;
896  string[1] = 0;
897  count += N71_65_PackPBKBlock(s, N7110_PBK_RINGTONE_ID, 2, block++, string, req + count);
898  }
899 
900  /* Number of group */
901  string[0] = bitmap->Location;
902  string[1] = 0;
903  count += N71_65_PackPBKBlock(s, N7110_PBK_GROUP, 2, block++, string, req + count);
904 
905  /* Name */
906  if (!bitmap->DefaultName) {
907  i = UnicodeLength(bitmap->Text) * 2;
908  string[0] = i + 2;
909  memcpy(string + 1, bitmap->Text, i);
910  string[i + 1] = 0;
911  count += N71_65_PackPBKBlock(s, N7110_PBK_NAME, i + 2, block++, string, req + count);
912  }
913 
914  /* Logo */
915  if (bitmap->DefaultBitmap) {
916  bitmap->BitmapWidth = 72;
917  bitmap->BitmapHeight = 14;
918  GSM_ClearBitmap(bitmap);
919  }
921  string[0] = Width;
922  string[1] = Height;
923  string[2] = 0;
924  string[3] = 0;
925  string[4] = PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0);
926  PHONE_EncodeBitmap(GSM_NokiaCallerLogo, string + 5, bitmap);
927  count += N71_65_PackPBKBlock(s, N7110_PBK_GROUPLOGO, PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0) + 5, block++, string, req + count);
928 
929  req[17] = block;
930 
931  return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetBitmap);
932 }
933 
934 static GSM_Error N7110_ReplySetPicture(GSM_Protocol_Message *msg, GSM_StateMachine *s)
935 {
936  smprintf(s, "Picture Image written OK, folder %i, location %i\n",msg->Buffer[4],msg->Buffer[5]*256+msg->Buffer[6]);
937  return ERR_NONE;
938 }
939 
940 static GSM_Error N7110_SetPictureImage(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
941 {
942  unsigned char folder;
943  GSM_Error error;
944  int location, i, count;
945  size_t Width, Height;
947  unsigned char req[500] = {N6110_FRAME_HEADER, 0x50, 0x07,
948  0x00, /* location */
949  0x00, 0x00, /* index */
950  0x07};
951 
952  error=N7110_GetPictureImageLocation(s, Bitmap, &folder, &location);
953  switch (error) {
954  case ERR_NONE:
955  req[5] = folder;
956  req[6] = location / 256;
957  req[7] = location % 256;
958  break;
959  case ERR_INVALIDLOCATION:
960  req[5] = 0x21; /* Save in Templates folder */
961  req[6] = 0;
962  req[7] = 0;
963  break;
964  default:
965  return error;
966  }
967 
968  /* Cleaning */
969  for (i=0;i<36;i++) req[i+9]=0;
970 
971  count=8;
972  if (UnicodeLength(Bitmap->Text)==0) {
973  count+=2 ;req[count]=0x0c;
974  count+=2 ;req[count]=0x0d;
975  count+=2 ;req[count]=0x0e;
976  count+=2 ;req[count]=0x0f;
977  count+=2 ;req[count]=0x10;
978  count+=2 ;req[count]=0x11;
979  count+=23;req[count]=0x02;
980  count++ ;
981  } else {
982  count+=2 ;req[count]=0x54;
983  count++ ;req[count]=0xd4;
984  count++ ;req[count]=0x0d;
985  count+=2 ;req[count]=0x0e;
986  count+=2 ;req[count]=0x0f;
987  count+=2 ;req[count]=0x10;
988  count+=2 ;req[count]=0x11;
989  count+=21;req[count]=0x01;
990  count+=3 ;
991  }
992  req[count] = 0x01;
993  count+=2;
994  req[count++] = 0x01;
995  PHONE_GetBitmapWidthHeight(Type, &Width, &Height);
996  req[count++] = Width;
997  req[count++] = Height;
998  req[count++] = PHONE_GetBitmapSize(Type,0,0) / 256;
999  req[count++] = PHONE_GetBitmapSize(Type,0,0) % 256;
1000  PHONE_EncodeBitmap(Type, req + count, Bitmap);
1001  count += PHONE_GetBitmapSize(Type,0,0);
1002  if (UnicodeLength(Bitmap->Text)!=0) {
1003  req[count] = UnicodeLength(Bitmap->Text);
1004  GSM_PackSevenBitsToEight(0, Bitmap->Text, req+count+1,strlen(Bitmap->Text));
1005  count = count + req[count];
1006  } else {
1007  req[count++]=0x00;
1008  }
1009  req[count++]=0x00;
1010  smprintf(s, "Setting Picture Image\n");
1011  return GSM_WaitFor (s, req, count, 0x14, 4, ID_SetBitmap);
1012 }
1013 
1014 static GSM_Error N7110_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
1015 {
1016  GSM_Error error;
1018  size_t Width, Height, i;
1019  unsigned char reqStartup[1000] = {N7110_FRAME_HEADER, 0xec,
1020  0x15, /* Startup Logo setting */
1021  0x00, 0x00, 0x00, 0x04, 0xc0, 0x02, 0x00,
1022  0x00, /* Bitmap height */
1023  0xc0, 0x03, 0x00,
1024  0x00, /* Bitmap width */
1025  0xc0, 0x04, 0x03, 0x00};
1026  unsigned char reqOp[1000] = {N7110_FRAME_HEADER, 0xa3, 0x01,
1027  0x00, /* logo disabled */
1028  0x00, 0xf0, 0x00, /* network code (000 00) */
1029  0x00 ,0x04,
1030  0x08, /* length of rest */
1031  0x00, 0x00, /* Bitmap width / height */
1032  0x00,
1033  0x00, /* Bitmap size */
1034  0x00, 0x00};
1035  unsigned char reqClrOp[] = {0x00, 0x01, 0x00, 0xaf, 0x00};
1036  unsigned char reqStartupText[500] = {N7110_FRAME_HEADER, 0xec,
1037  0x02}; /* Startup Text setting */
1038 
1039  switch (Bitmap->Type) {
1040  case GSM_StartupLogo:
1041  if (Bitmap->Location!=1) return ERR_NOTSUPPORTED;
1043  if (strcmp(s->Phone.Data.Model,"NSE-5") == 0) Type=GSM_Nokia7110StartupLogo;
1044  PHONE_GetBitmapWidthHeight(Type, &Width, &Height);
1045  reqStartup[12] = Height;
1046  reqStartup[16] = Width;
1047  PHONE_EncodeBitmap(Type, reqStartup + 21, Bitmap);
1048  smprintf(s, "Setting startup logo\n");
1049  return GSM_WaitFor (s, reqStartup, 21+PHONE_GetBitmapSize(Type,0,0), 0x7A, 4, ID_SetBitmap);
1050  case GSM_WelcomeNote_Text:
1051  CopyUnicodeString(reqStartupText + 5, Bitmap->Text);
1052  i = 6 + UnicodeLength(Bitmap->Text) * 2;
1053  reqStartupText[i++] = 0;
1054  reqStartupText[i++] = 0;
1055  return GSM_WaitFor (s, reqStartupText, i, 0x7A, 4, ID_SetBitmap);
1056  case GSM_DealerNote_Text:
1057  reqStartupText[4] = 0x17;
1058  CopyUnicodeString(reqStartupText + 5, Bitmap->Text);
1059  i = 6 + UnicodeLength(Bitmap->Text) * 2;
1060  reqStartupText[i++] = 0;
1061  reqStartupText[i++] = 0;
1062  return GSM_WaitFor (s, reqStartupText, i, 0x7A, 4, ID_SetBitmap);
1063  case GSM_OperatorLogo:
1064  /* We want to set operator logo, not clear */
1065  if (strcmp(Bitmap->NetworkCode,"000 00")) {
1066  reqOp[5] = 0x01; /* Logo enabled */
1067  NOKIA_EncodeNetworkCode(reqOp+6, Bitmap->NetworkCode);
1069  reqOp[11] = 8 + PHONE_GetBitmapSize(Type,0,0);
1070  PHONE_GetBitmapWidthHeight(Type, &Width, &Height);
1071  reqOp[12]=Width;
1072  reqOp[13]=Height;
1073  reqOp[15]=PHONE_GetBitmapSize(Type,0,0);
1074  PHONE_EncodeBitmap(Type, reqOp + 18, Bitmap);
1075  smprintf(s, "Setting operator logo\n");
1076  return GSM_WaitFor (s, reqOp, 18+PHONE_GetBitmapSize(Type,0,0), 0x0A, 4, ID_SetBitmap);
1077  } else {
1078  smprintf(s, "Clearing operator logo\n");
1079  for (i=0;i<5;i++) {
1080  reqClrOp[4]=i;
1081  error=GSM_WaitFor (s, reqClrOp, 5, 0x0A, 4, ID_SetBitmap);
1082  if (error!=ERR_NONE) return error;
1083  }
1084  return GSM_WaitFor (s, reqOp, 18, 0x0A, 4, ID_SetBitmap);
1085  }
1086  case GSM_CallerGroupLogo:
1087  return N7110_SetCallerLogo(s,Bitmap);
1088  case GSM_PictureImage:
1089  return N7110_SetPictureImage(s,Bitmap);
1090  default:
1091  break;
1092  }
1093  return ERR_NOTSUPPORTED;
1094 }
1095 
1096 static GSM_Error N7110_ReplyDeleteMemory(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
1097 {
1098  smprintf(s, "Phonebook entry deleted\n");
1099  return ERR_NONE;
1100 }
1101 
1102 static GSM_Error N7110_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1103 {
1104  unsigned char req[] = {N7110_FRAME_HEADER, 0x0f, 0x00, 0x01,
1105  0x04, 0x00, 0x00, 0x0c, 0x01, 0xff,
1106  0x00, 0x01, /* location */
1107  0x05, /* memory type */
1108  0x00, 0x00, 0x00};
1109 
1110  req[12] = entry->Location / 256;
1111  req[13] = entry->Location % 256;
1112 
1113  req[14] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
1114  if (req[14]==0xff) return ERR_NOTSUPPORTED;
1115 
1116  smprintf(s, "Deleting phonebook entry\n");
1117  return GSM_WaitFor (s, req, 18, 0x03, 4, ID_SetMemory);
1118 }
1119 
1120 static GSM_Error N7110_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1121 {
1122  int count = 18;
1123  size_t blocks;
1124  unsigned char req[5000] = {N7110_FRAME_HEADER, 0x0b, 0x00,
1125  0x01, 0x01, 0x00, 0x00, 0x0c,
1126  0x00, 0x00, /* memory type */
1127  0x00, 0x00, /* location */
1128  0x00, 0x00, 0x00};
1129 
1130  if (entry->Location == 0) return ERR_NOTSUPPORTED;
1131 
1132  req[11] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
1133  if (req[11]==0xff) return ERR_NOTSUPPORTED;
1134 
1135  req[12] = entry->Location >> 8;
1136  req[13] = entry->Location & 0xff;
1137 
1138  count = count + N71_65_EncodePhonebookFrame(s, req+18, entry, &blocks, FALSE, GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_VOICETAGS));
1139  req[17] = blocks;
1140 
1141  smprintf(s, "Writing phonebook entry\n");
1142  return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetMemory);
1143 }
1144 
1145 static GSM_Error N7110_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
1146 {
1147  unsigned char folderid;
1148  unsigned int location;
1149  unsigned char req[] = {N7110_FRAME_HEADER, 0x0a,
1150  0x00, /* folder */
1151  0x00, 0x00, /* location */
1152  0x01};
1153 
1154  N7110_GetSMSLocation(s, sms, &folderid, &location);
1155  req[4] = folderid;
1156  req[5] = location / 256;
1157  req[6] = location % 256;
1158 
1159  smprintf(s, "Deleting sms\n");
1160  return GSM_WaitFor (s, req, 8, 0x14, 4, ID_DeleteSMSMessage);
1161 }
1162 
1163 static GSM_Error N7110_ReplyGetSMSStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
1164 {
1165  GSM_Phone_Data *Data = &s->Phone.Data;
1166 
1167  smprintf(s, "SMS status received\n");
1168  switch (msg->Buffer[3]) {
1169  case 0x37:
1170  smprintf(s, "SIM size : %i\n",msg->Buffer[8]*256+msg->Buffer[9]);
1171  smprintf(s, "Used in phone memory : %i\n",msg->Buffer[10]*256+msg->Buffer[11]);
1172  smprintf(s, "Unread in phone memory : %i\n",msg->Buffer[12]*256+msg->Buffer[13]);
1173  smprintf(s, "Used in SIM : %i\n",msg->Buffer[14]*256+msg->Buffer[15]);
1174  smprintf(s, "Unread in SIM : %i\n",msg->Buffer[16]*256+msg->Buffer[17]);
1175  Data->SMSStatus->SIMSize = msg->Buffer[8]*256+msg->Buffer[9];
1176  Data->SMSStatus->PhoneUsed = msg->Buffer[10]*256+msg->Buffer[11];
1177  Data->SMSStatus->PhoneUnRead = msg->Buffer[12]*256+msg->Buffer[13];
1178  Data->SMSStatus->PhoneSize = 150;
1179  Data->SMSStatus->SIMUsed = msg->Buffer[14]*256+msg->Buffer[15];
1180  Data->SMSStatus->SIMUnRead = msg->Buffer[16]*256+msg->Buffer[17];
1181  return ERR_NONE;
1182  case 0x38:
1183  smprintf(s, "Error. No PIN ?\n");
1184  return ERR_SECURITYERROR;
1185  }
1186  return ERR_UNKNOWNRESPONSE;
1187 }
1188 
1189 static GSM_Error N7110_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
1190 {
1191  GSM_Error error;
1192  GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
1193 
1194  error = DCT3_GetSMSStatus(s,status);
1195  if (error != ERR_NONE) return error;
1196 
1197  /* 6210 family doesn't show in frame with SMS status info
1198  * about Templates. We get separately info about this SMS folder.
1199  */
1200  error = N7110_GetSMSFolderStatus(s, 0x20);
1201  if (error != ERR_NONE) return error;
1202  status->TemplatesUsed = Priv->LastSMSFolder.Number;
1203 
1204  return ERR_NONE;
1205 }
1206 
1207 static GSM_Error N7110_ReplyGetProfileFeature(GSM_Protocol_Message *msg, GSM_StateMachine *s)
1208 {
1209  GSM_Phone_Data *Data = &s->Phone.Data;
1210 
1211  switch (msg->Buffer[3]) {
1212  case 0x02:
1213  smprintf(s, "Profile feature %02x with value %02x\n",msg->Buffer[6],msg->Buffer[10]);
1214  switch (msg->Buffer[6]) {
1215  case 0x03:
1216  smprintf(s, "Ringtone ID\n");
1218  Data->Profile->FeatureValue [Data->Profile->FeaturesNumber] = msg->Buffer[10];
1219  Data->Profile->FeaturesNumber++;
1220  break;
1221  case 0x08: /* Caller groups */
1222  NOKIA_FindFeatureValue(s, Profile71_65,msg->Buffer[6],msg->Buffer[10],Data,TRUE);
1223  break;
1224  case 0x09: /* Autoanswer */
1225  if (Data->Profile->CarKitProfile || Data->Profile->HeadSetProfile) {
1226  NOKIA_FindFeatureValue(s, Profile71_65,msg->Buffer[6],msg->Buffer[10],Data,FALSE);
1227  }
1228  break;
1229  case 0xff :
1230  CopyUnicodeString(Data->Profile->Name, msg->Buffer+10);
1231  smprintf(s, "profile Name: \"%s\"\n", DecodeUnicodeString(Data->Profile->Name));
1232  Data->Profile->DefaultName = FALSE;
1233  break;
1234  default:
1235  NOKIA_FindFeatureValue(s, Profile71_65,msg->Buffer[6],msg->Buffer[10],Data,FALSE);
1236  }
1237  return ERR_NONE;
1238  }
1239  return ERR_UNKNOWNRESPONSE;
1240 }
1241 
1242 static GSM_Error N7110_GetProfile(GSM_StateMachine *s, GSM_Profile *Profile)
1243 {
1244  GSM_Error error;
1245  int i;
1246  unsigned char Features[12] = {0x00,0x02,0x03,0x04,0x05,0x06,
1247  0x07,0x08,0x09,0xff,
1248  0x0a,0x22};
1249  unsigned char req[] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x01, 0x01,
1250  0x00, /* Profile Location */
1251  0xff}; /* Feature number */
1252 
1253  if (Profile->Location > 7) return ERR_INVALIDLOCATION;
1254 
1255  Profile->CarKitProfile = FALSE;
1256  Profile->HeadSetProfile = FALSE;
1257  if (Profile->Location == 6) Profile->CarKitProfile = TRUE;
1258  if (Profile->Location == 7) Profile->HeadSetProfile = TRUE;
1259 
1260  Profile->FeaturesNumber = 0;
1261 
1262  s->Phone.Data.Profile=Profile;
1263  for (i = 0; i < 10; i++) {
1264  req[7] = Profile->Location;
1265  req[8] = Features[i];
1266  smprintf(s, "Getting profile feature\n");
1267  error = GSM_WaitFor (s, req, 9, 0x39, 4, ID_GetProfile);
1268  if (error!=ERR_NONE) return error;
1269  }
1270  NOKIA_GetDefaultProfileName(Profile);
1271  Profile->Active = FALSE;
1272  return error;
1273 }
1274 
1275 static GSM_Error N7110_ReplySetProfileFeature(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
1276 {
1277  smprintf(s, "Profile feature set\n");
1278  return ERR_NONE;
1279 }
1280 
1281 static GSM_Error N7110_SetProfile(GSM_StateMachine *s, GSM_Profile *Profile)
1282 {
1283  int i;
1284  gboolean found;
1285  GSM_Error error;
1286  unsigned char ID,Value;
1287  unsigned char req[] = {N6110_FRAME_HEADER, 0x03, 0x01, 0x01, 0x03,
1288  0x02, /* feature number */
1289  0x01, /* Profile Location */
1290  0x01,
1291  0xff}; /* Value */
1292 
1293  for (i=0;i<Profile->FeaturesNumber;i++) {
1294  found = FALSE;
1295  switch (Profile->FeatureID[i]) {
1296  case Profile_RingtoneID:
1297  ID = 0x03;
1298  Value = Profile->FeatureValue[i];
1299  found = TRUE;
1300  break;
1301  default:
1303  s,
1304  Profile71_65,
1305  Profile->FeatureID[i],Profile->FeatureValue[i],
1306  &ID,&Value);
1307  }
1308  if (found) {
1309  req[7] = ID;
1310  req[8] = Profile->Location;
1311  req[10] = Value;
1312  smprintf(s, "Setting profile feature\n");
1313  error = GSM_WaitFor (s, req, 11, 0x39, 4, ID_SetProfile);
1314  if (error!=ERR_NONE) return error;
1315  }
1316  }
1317  return ERR_NONE;
1318 }
1319 
1320 static GSM_Error N7110_GetSpeedDial(GSM_StateMachine *s, GSM_SpeedDial *SpeedDial)
1321 {
1322  GSM_MemoryEntry pbk;
1323  GSM_Error error;
1324 
1326  pbk.Location = SpeedDial->Location;
1327  SpeedDial->MemoryLocation = 0;
1328  s->Phone.Data.SpeedDial = SpeedDial;
1329 
1330  smprintf(s, "Getting speed dial\n");
1331  error=N7110_GetMemory(s,&pbk);
1332  switch (error) {
1333  case ERR_NOTSUPPORTED:
1334  smprintf(s, "No speed dials set in phone\n");
1335  return ERR_EMPTY;
1336  case ERR_NONE:
1337  if (SpeedDial->MemoryLocation == 0) {
1338  smprintf(s, "Speed dial not assigned or error in firmware\n");
1339  return ERR_EMPTY;
1340  }
1341  return ERR_NONE;
1342  default:
1343  return error;
1344  }
1345 }
1346 
1347 static GSM_Error N7110_ReplyIncomingSMS(GSM_Protocol_Message *msg, GSM_StateMachine *s)
1348 {
1349  GSM_SMSMessage sms;
1350  GSM_Phone_Data *Data = &s->Phone.Data;
1351 
1352 #ifdef DEBUG
1353  smprintf(s, "SMS message received\n");
1354  sms.State = SMS_UnRead;
1355  sms.InboxFolder = TRUE;
1356  DCT3_DecodeSMSFrame(s, &sms,msg->Buffer+8);
1357 #endif
1358  if (Data->EnableIncomingSMS && s->User.IncomingSMS!=NULL) {
1359  sms.State = SMS_UnRead;
1360  sms.InboxFolder = TRUE;
1361  DCT3_DecodeSMSFrame(s, &sms,msg->Buffer+8);
1362 
1363  s->User.IncomingSMS(s, &sms, s->User.IncomingSMSUserData);
1364  }
1365  return ERR_NONE;
1366 }
1367 
1368 static GSM_Error N7110_Initialise (GSM_StateMachine *s)
1369 {
1370 #ifdef DEBUG
1372 #endif
1373 #ifdef GSM_ENABLE_N71_92INCOMINGINFO
1374  /* Enables various things like incoming SMS, call info, etc. */
1375  return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17", 6);
1376 #endif
1377  return ERR_NONE;
1378 }
1379 
1380 static GSM_Error N7110_ReplyGetCalendarInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
1381 {
1382  /* Old method 1 for accessing calendar */
1383  return N71_65_ReplyGetCalendarInfo1(msg, s, &s->Phone.Data.Priv.N7110.LastCalendar);
1384 }
1385 
1386 #ifdef DEBUG
1387 static GSM_Error N7110_ReplyGetCalendarNotePos(GSM_Protocol_Message *msg, GSM_StateMachine *s)
1388 {
1389  /* Old method 1 for accessing calendar */
1390  return N71_65_ReplyGetCalendarNotePos1(msg, s, &s->Phone.Data.Priv.N7110.FirstCalendarPos);
1391 }
1392 #endif
1393 
1394 static GSM_Error N7110_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start)
1395 {
1396  return N71_65_GetNextCalendar1(s,Note,start,&s->Phone.Data.Priv.N7110.LastCalendar,&s->Phone.Data.Priv.N7110.LastCalendarYear,&s->Phone.Data.Priv.N7110.LastCalendarPos);
1397 /* return N71_65_GetNextCalendar2(s,Note,start,&s->Phone.Data.Priv.N7110.LastCalendarYear,&s->Phone.Data.Priv.N7110.LastCalendarPos); */
1398 }
1399 
1400 static GSM_Error N7110_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
1401 {
1402  GSM_Error error;
1403 
1404  /* Method 1 */
1405  error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N7110.LastCalendar);
1406  if (error!=ERR_NONE) return error;
1410  Status->Free = 100;
1411  Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number;
1412  return ERR_NONE;
1413 
1414  /* Method 2 */
1415 /* return GE_NOTSUPPORTED; */
1416 }
1417 
1418 static GSM_Error N7110_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
1419 {
1420 /* return N71_65_AddCalendar1(s, Note, NULL); */
1421  return N71_65_AddCalendar2(s,Note);
1422 }
1423 
1424 static GSM_Error N7110_ReplyGetNetworkInfoError(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
1425 {
1426  smprintf(s, "Probably means no PIN\n");
1427  return ERR_SECURITYERROR;
1428 }
1429 
1430 static GSM_Error N7110_SetIncomingCall(GSM_StateMachine *s, gboolean enable)
1431 {
1432 #ifndef GSM_ENABLE_N71_92INCOMINGINFO
1433  return ERR_SOURCENOTAVAILABLE;
1434 #else
1435  return NOKIA_SetIncomingCall(s,enable);
1436 #endif
1437 }
1438 
1439 static GSM_Error N7110_SetIncomingUSSD(GSM_StateMachine *s, gboolean enable)
1440 {
1441 #ifndef GSM_ENABLE_N71_92INCOMINGINFO
1442  return ERR_SOURCENOTAVAILABLE;
1443 #else
1444  return NOKIA_SetIncomingUSSD(s,enable);
1445 #endif
1446 }
1447 
1448 static GSM_Error N7110_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
1449 {
1450 #ifndef GSM_ENABLE_N71_92INCOMINGINFO
1451  return ERR_SOURCENOTAVAILABLE;
1452 #else
1453  return NOKIA_SetIncomingSMS(s,enable);
1454 #endif
1455 }
1456 
1457 GSM_Error N7110_AnswerCall(GSM_StateMachine *s, int ID, gboolean all)
1458 {
1459  if (!all) return DCT3DCT4_AnswerCall(s,ID);
1460  return DCT3_AnswerAllCalls(s);
1461 }
1462 
1463 GSM_Error N7110_SetCallDivert(GSM_StateMachine *s, GSM_CallDivert *divert)
1464 {
1465  GSM_Error error;
1466  int i;
1467 
1468  /* No answer from phone side */
1469  i = s->ReplyNum;
1470  s->ReplyNum = 1;
1471  error = DCT3DCT4_SetCallDivert(s,divert);
1472  s->ReplyNum = i;
1473  return error;
1474 }
1475 
1476 GSM_Error N7110_CancelAllDiverts(GSM_StateMachine *s)
1477 {
1478  GSM_Error error;
1479  int i;
1480 
1481  /* No answer from phone side */
1482  i = s->ReplyNum;
1483  s->ReplyNum = 1;
1484  error = DCT3DCT4_CancelAllDiverts(s);
1485  s->ReplyNum = i;
1486  return error;
1487 }
1488 
1489 static GSM_Reply_Function N7110ReplyFunctions[] = {
1490  {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame },
1491  {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame },
1492  {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame },
1493  {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame },
1494  {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall },
1495  {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame },
1496  {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall },
1497  {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame },
1498  {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame },
1499  {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame },
1500  {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame },
1501  {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF },
1502  {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame },
1503  {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF },
1504  {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF },
1505 
1506  {DCT3_ReplySendSMSMessage, "\x02",0x03,0x02,ID_IncomingFrame },
1507  {DCT3_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame },
1508  {N7110_ReplyIncomingSMS, "\x02",0x03,0x10,ID_IncomingFrame },
1509 #ifdef GSM_ENABLE_CELLBROADCAST
1510  {DCT3_ReplySetIncomingCB, "\x02",0x03,0x21,ID_SetIncomingCB },
1511  {DCT3_ReplySetIncomingCB, "\x02",0x03,0x22,ID_SetIncomingCB },
1512  {DCT3_ReplyIncomingCB, "\x02",0x03,0x23,ID_IncomingFrame },
1513 #endif
1514  {DCT3_ReplySetSMSC, "\x02",0x03,0x31,ID_SetSMSC },
1515  {DCT3_ReplyGetSMSC, "\x02",0x03,0x34,ID_GetSMSC },
1516  {DCT3_ReplyGetSMSC, "\x02",0x03,0x35,ID_GetSMSC },
1517 #ifdef GSM_ENABLE_CELLBROADCAST
1518  {DCT3_ReplySetIncomingCB, "\x02",0x03,0xCA,ID_SetIncomingCB },
1519 #endif
1520 
1521  {N7110_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus },
1522  {N7110_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory },
1523  {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap },
1524  {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory },
1525  {N7110_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory },
1526 
1527  {N71_65_ReplyUSSDInfo, "\x06",0x03,0x03,ID_IncomingFrame },
1528  {NoneReply, "\x06",0x03,0x06,ID_IncomingFrame },
1529 
1530  {DCT3_ReplySIMLogin, "\x09",0x03,0x80,ID_IncomingFrame },
1531  {DCT3_ReplySIMLogout, "\x09",0x03,0x81,ID_IncomingFrame },
1532 
1533  {DCT3_ReplyGetNetworkInfo, "\x0A",0x03,0x71,ID_GetNetworkInfo },
1534  {DCT3_ReplyGetNetworkInfo, "\x0A",0x03,0x71,ID_GetBitmap },
1535  {DCT3_ReplyGetNetworkInfo, "\x0A",0x03,0x71,ID_IncomingFrame },
1536  {N7110_ReplyGetNetworkInfoError, "\x0A",0x03,0x72,ID_GetNetworkInfo },
1537  {DCT3_ReplyGetNetworkInfo, "\x0A",0x03,0x73,ID_IncomingFrame },
1539  {N7110_ReplySetOperatorLogo, "\x0A",0x03,0xA4,ID_SetBitmap },
1540  {N7110_ReplyClearOperatorLogo, "\x0A",0x03,0xB0,ID_SetBitmap },
1541  {NoneReply, "\x0A",0x03,0xB5,ID_IncomingFrame },
1542 
1543 #ifdef DEBUG
1544  {N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote },/*method 1*/
1545  {N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote },/*method 1*/
1546  {N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote },/*method 1*/
1547  {N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote },/*method 1*/
1548 #endif
1549  {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote },
1550  {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/
1551 #ifdef DEBUG
1552  {N7110_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/
1553 #endif
1554  {N7110_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/
1555 #ifdef DEBUG
1556  {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote },/*method 2*/
1557 #endif
1558  {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/
1559 
1560  {N7110_ReplySaveSMSMessage, "\x14",0x03,0x05,ID_SaveSMSMessage },
1561  {N7110_ReplySaveSMSMessage, "\x14",0x03,0x06,ID_SaveSMSMessage },
1562  {N7110_ReplyGetSMSMessage, "\x14",0x03,0x08,ID_GetSMSMessage },
1563  {N7110_ReplyGetSMSMessage, "\x14",0x03,0x08,ID_GetBitmap },
1564  {N7110_ReplyGetSMSMessage, "\x14",0x03,0x09,ID_GetSMSMessage },
1565  {DCT3_ReplyDeleteSMSMessage, "\x14",0x03,0x0B,ID_DeleteSMSMessage },
1566  {DCT3_ReplyDeleteSMSMessage, "\x14",0x03,0x0C,ID_DeleteSMSMessage },
1567  {N7110_ReplyGetSMSStatus, "\x14",0x03,0x37,ID_GetSMSStatus },
1568  {N7110_ReplyGetSMSStatus, "\x14",0x03,0x38,ID_GetSMSStatus },
1569  {N7110_ReplySetPicture, "\x14",0x03,0x51,ID_SetBitmap },
1570  {N7110_ReplyGetSMSFolderStatus, "\x14",0x03,0x6C,ID_GetSMSFolderStatus },
1571  {N7110_ReplyGetSMSMessage, "\x14",0x03,0x6F,ID_GetSMSMessage },
1572  {N7110_ReplyGetSMSFolders, "\x14",0x03,0x7B,ID_GetSMSFolders },
1573  {N7110_ReplyGetSMSFolders, "\x14",0x03,0x7C,ID_GetSMSFolders },
1574  {N7110_ReplySaveSMSMessage, "\x14",0x03,0x84,ID_SaveSMSMessage },
1575  {N7110_ReplyGetPictureImageInfo, "\x14",0x03,0x97,ID_GetBitmap },
1576  {N7110_ReplyGetSMSFolders, "\x14",0x03,0xCA,ID_GetSMSFolders },
1577 
1579 
1580  {DCT3_ReplySetDateTime, "\x19",0x03,0x61,ID_SetDateTime },
1581  {DCT3_ReplyGetDateTime, "\x19",0x03,0x63,ID_GetDateTime },
1582  {DCT3_ReplySetAlarm, "\x19",0x03,0x6C,ID_SetAlarm },
1583  {DCT3_ReplyGetAlarm, "\x19",0x03,0x6E,ID_GetAlarm },
1584 
1585  {N7110_ReplyGetRingtone, "\x1f",0x03,0x23,ID_GetRingtone },
1586  {N7110_ReplyGetRingtone, "\x1f",0x03,0x24,ID_GetRingtone },
1587 
1589  {DCT3DCT4_ReplyEnableConnectFunc, "\x3f",0x03,0x02,ID_EnableConnectFunc },
1591  {DCT3DCT4_ReplyDisableConnectFunc,"\x3f",0x03,0x05,ID_DisableConnectFunc },
1592  {DCT3_ReplyGetWAPBookmark, "\x3f",0x03,0x07,ID_GetWAPBookmark },
1593  {DCT3_ReplyGetWAPBookmark, "\x3f",0x03,0x08,ID_GetWAPBookmark },
1594  {DCT3DCT4_ReplySetWAPBookmark, "\x3f",0x03,0x0A,ID_SetWAPBookmark },
1595  {DCT3DCT4_ReplySetWAPBookmark, "\x3f",0x03,0x0B,ID_SetWAPBookmark },
1597  {DCT3DCT4_ReplyDelWAPBookmark, "\x3f",0x03,0x0E,ID_DeleteWAPBookmark },
1600  {DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x16,ID_GetConnectSet },
1601  {DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x17,ID_GetConnectSet },
1602  {DCT3_ReplySetWAPSettings, "\x3f",0x03,0x19,ID_SetConnectSet },
1603  {DCT3_ReplySetWAPSettings, "\x3f",0x03,0x1A,ID_SetConnectSet },
1604  {DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x1C,ID_GetConnectSet },
1605  {DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x1D,ID_GetConnectSet },
1606  {DCT3_ReplySetWAPSettings, "\x3f",0x03,0x1F,ID_SetConnectSet },
1607 
1608  {N7110_ReplyGetProfileFeature, "\x39",0x03,0x02,ID_GetProfile },
1609  {N7110_ReplySetProfileFeature, "\x39",0x03,0x04,ID_SetProfile },
1610 
1611  {DCT3_ReplyEnableSecurity, "\x40",0x02,0x64,ID_EnableSecurity },
1613  {DCT3_ReplyGetIMEI, "\x40",0x02,0x66,ID_GetIMEI },
1614  {DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_DialVoice },
1615  {DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_CancelCall },
1616  {DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_AnswerCall },
1617  {DCT3_ReplyNetmonitor, "\x40",0x02,0x7E,ID_Netmonitor },
1618  {DCT3_ReplyPlayTone, "\x40",0x02,0x8F,ID_PlayTone },
1619  {NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetHardware },
1620  {NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetPPM },
1621  {NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCA,ID_GetProductCode },
1623  {NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetOriginalIMEI },
1624  {NoneReply, "\x40",0x02,0xFF,ID_IncomingFrame },
1625 
1626  {N71_92_ReplyPhoneSetting, "\x7a",0x04,0x02,ID_GetBitmap },
1627  {N71_92_ReplyPhoneSetting, "\x7a",0x04,0x02,ID_SetBitmap },
1628  {N71_92_ReplyPhoneSetting, "\x7a",0x04,0x15,ID_GetBitmap },
1629  {N71_92_ReplyPhoneSetting, "\x7a",0x04,0x15,ID_SetBitmap },
1630  {N71_92_ReplyPhoneSetting, "\x7a",0x04,0x17,ID_GetBitmap },
1631  {N71_92_ReplyPhoneSetting, "\x7a",0x04,0x17,ID_SetBitmap },
1632 
1633  {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
1634  {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
1635  {DCT3_ReplyPressKey, "\xD2",0x02,0x46,ID_PressKey },
1636  {DCT3_ReplyPressKey, "\xD2",0x02,0x47,ID_PressKey },
1637 
1638  {NULL, "\x00",0x00,0x00,ID_None }
1639 };
1640 
1641 GSM_Phone_Functions N7110Phone = {
1642  "6210|6250|7110|7190",
1643  N7110ReplyFunctions,
1644  NOTSUPPORTED, /* Install */
1645  N7110_Initialise,
1648  NOTSUPPORTED, /* ShowStartInfo */
1652  DCT3_GetIMEI,
1657  DCT3_GetPPM,
1658  NOTSUPPORTED, /* GetSIMIMSI */
1661  N7110_GetAlarm,
1662  N7110_SetAlarm,
1663  NOTSUPPORTED, /* GetLocale */
1664  NOTSUPPORTED, /* SetLocale */
1665  DCT3_PressKey,
1666  DCT3_Reset,
1668  NOTSUPPORTED, /* EnterSecurityCode */
1669  NOTSUPPORTED, /* GetSecurityStatus */
1670  NOTSUPPORTED, /* GetDisplayStatus */
1671  NOTIMPLEMENTED, /* SetAutoNetworkLogin */
1675  NOTSUPPORTED, /* GetCategory */
1676  NOTSUPPORTED, /* AddCategory */
1677  NOTSUPPORTED, /* GetCategoryStatus */
1678  N7110_GetMemoryStatus,
1679  N7110_GetMemory,
1680  NOTIMPLEMENTED, /* GetNextMemory */
1681  N7110_SetMemory,
1682  NOTIMPLEMENTED, /* AddMemory */
1683  N7110_DeleteMemory,
1684  NOTIMPLEMENTED, /* DeleteAllMemory */
1685  N7110_GetSpeedDial,
1686  NOTIMPLEMENTED, /* SetSpeedDial */
1687  DCT3_GetSMSC,
1688  DCT3_SetSMSC,
1689  N7110_GetSMSStatus,
1690  N7110_GetSMSMessage,
1691  N7110_GetNextSMSMessage,
1692  N7110_SetSMS,
1693  N7110_AddSMS,
1694  N7110_DeleteSMS,
1696  NOTSUPPORTED, /* SendSavedSMS */
1697  NOTSUPPORTED, /* SetFastSMSSending */
1698  N7110_SetIncomingSMS,
1700  N7110_GetSMSFolders,
1701  NOTIMPLEMENTED, /* AddSMSFolder */
1702  NOTIMPLEMENTED, /* DeleteSMSFolder */
1704  NOTIMPLEMENTED, /* DialService */
1705  N7110_AnswerCall,
1707  NOTIMPLEMENTED, /* HoldCall */
1708  NOTIMPLEMENTED, /* UnholdCall */
1709  NOTIMPLEMENTED, /* ConferenceCall */
1710  NOTIMPLEMENTED, /* SplitCall */
1711  NOTIMPLEMENTED, /* TransferCall */
1712  NOTIMPLEMENTED, /* SwitchCall */
1713  NOTSUPPORTED, /* GetCallDivert */
1714  N7110_SetCallDivert,
1715  N7110_CancelAllDiverts,
1716  N7110_SetIncomingCall,
1717  N7110_SetIncomingUSSD,
1719  N7110_GetRingtone,
1720  N7110_SetRingtone,
1721  NOTSUPPORTED, /* GetRingtonesInfo */
1722  NOTSUPPORTED, /* DeleteUserRingtones */
1723  DCT3_PlayTone,
1729  NOTSUPPORTED, /* GetSyncMLSettings */
1730  NOTSUPPORTED, /* SetSyncMLSettings */
1731  NOTSUPPORTED, /* GetChatSettings */
1732  NOTSUPPORTED, /* SetChatSettings */
1733  NOTSUPPORTED, /* GetMMSSettings */
1734  NOTSUPPORTED, /* SetMMSSettings */
1735  NOTSUPPORTED, /* GetMMSFolders */
1736  NOTSUPPORTED, /* GetNextMMSFileInfo */
1737  N7110_GetBitmap,
1738  N7110_SetBitmap,
1739  NOTSUPPORTED, /* GetToDoStatus */
1740  NOTSUPPORTED, /* GetToDo */
1741  NOTSUPPORTED, /* GetNextToDo */
1742  NOTSUPPORTED, /* SetToDo */
1743  NOTSUPPORTED, /* AddToDo */
1744  NOTSUPPORTED, /* DeleteToDo */
1745  NOTSUPPORTED, /* DeleteAllToDo */
1746  N7110_GetCalendarStatus,
1747  NOTIMPLEMENTED, /* GetCalendar */
1748  N7110_GetNextCalendar,
1749  NOTIMPLEMENTED, /* SetCalendar */
1750  N7110_AddCalendar,
1752  NOTIMPLEMENTED, /* DeleteAllCalendar */
1753  NOTSUPPORTED, /* GetCalendarSettings */
1754  NOTSUPPORTED, /* SetCalendarSettings */
1755  NOTSUPPORTED, /* GetNoteStatus */
1756  NOTSUPPORTED, /* GetNote */
1757  NOTSUPPORTED, /* GetNextNote */
1758  NOTSUPPORTED, /* SetNote */
1759  NOTSUPPORTED, /* AddNote */
1760  NOTSUPPORTED, /* DeleteNote */
1761  NOTSUPPORTED, /* DeleteAllNotes */
1762  N7110_GetProfile,
1763  N7110_SetProfile,
1764  NOTSUPPORTED, /* GetFMStation */
1765  NOTSUPPORTED, /* SetFMStation */
1766  NOTSUPPORTED, /* ClearFMStations */
1767  NOTSUPPORTED, /* GetNextFileFolder */
1768  NOTSUPPORTED, /* GetFolderListing */
1769  NOTSUPPORTED, /* GetNextRootFolder */
1770  NOTSUPPORTED, /* SetFileAttributes */
1771  NOTSUPPORTED, /* GetFilePart */
1772  NOTSUPPORTED, /* AddFile */
1773  NOTSUPPORTED, /* SendFilePart */
1774  NOTSUPPORTED, /* GetFileSystemStatus */
1775  NOTSUPPORTED, /* DeleteFile */
1776  NOTSUPPORTED, /* AddFolder */
1777  NOTSUPPORTED, /* DeleteFolder */
1778  NOTSUPPORTED, /* GetGPRSAccessPoint */
1779  NOTSUPPORTED, /* SetGPRSAccessPoint */
1780  NOTSUPPORTED, /* GetScreenshot */
1781  NOTSUPPORTED, /* SetPower */
1782  NOTSUPPORTED, /* PostConnect */
1783  NONEFUNCTION /* PreAPICall */
1784 };
1785 
1786 #endif
1787 
1788 /* How should editor hadle tabs in this file? Add editor commands here.
1789  * vim: noexpandtab sw=8 ts=8 sts=8:
1790  */
GSM_SMSMessageType PDU
GSM_Error DCT3DCT4_ReplyGetActiveConnectSet(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_65_ReplyDelCalendar(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char Name[(GSM_MAX_RINGTONE_NAME_LENGTH+1) *2]
gboolean DefaultRingtone
Definition: gammu-bitmap.h:134
GSM_Profile_Feat_ID FeatureID[15]
GSM_NOKIASMSFolder LastPictureImageFolder
Definition: n7110.h:17
char * DecodeUnicodeString(const unsigned char *src)
Definition: coding.c:245
size_t PHONE_GetBitmapSize(GSM_Phone_Bitmap_Types Type, size_t Width, size_t Height)
Definition: gsmlogo.c:44
GSM_RingtoneFormat Format
GSM_Error DCT3DCT4_GetModel(GSM_StateMachine *s)
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
void NOKIA_DecodeSMSState(GSM_StateMachine *s, unsigned char state, GSM_SMSMessage *sms)
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)
GSM_Error N61_71_ReplyResetPhoneSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void NOKIA_SortSMSFolderStatus(GSM_StateMachine *s, GSM_NOKIASMSFolder *Folder)
GSM_Error DCT3_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error NOKIA_SetIncomingUSSD(GSM_StateMachine *s, gboolean enable)
GSM_Error DCT3_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
GSM_SMS_State State
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
GSM_Error DCT3_ReplyGetWAPSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Bitmap_Types Type
Definition: gammu-bitmap.h:107
#define GSM_PHONE_MAXSMSINFOLDER
Definition: gammu-limits.h:70
#define NOTSUPPORTED
Definition: gsmcomon.h:14
GSM_Error DCT3_ReplyGetIMEI(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_MemoryEntry * Memory
Definition: gsmstate.h:497
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)
GSM_Error N71_92_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_MemoryType NOKIA_GetMemoryType(GSM_StateMachine *s, GSM_MemoryType memory_type, unsigned char *ID)
GSM_SMSMemoryStatus * SMSStatus
Definition: gsmstate.h:517
GSM_Error DCT3_GetPPM(GSM_StateMachine *s, char *value)
GSM_Error N71_65_DelCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
GSM_MultiSMSMessage * GetSMSMessage
Definition: gsmstate.h:509
GSM_Error N71_65_GetCalendarInfo1(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *LastCalendar)
unsigned char Sender[2 *(GSM_MAX_NUMBER_LENGTH+1)]
Definition: gammu-bitmap.h:164
gboolean HeadSetProfile
GSM_Error DCT3_ReplyDialCommand(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error GSM_DispatchMessage(GSM_StateMachine *s)
Definition: gsmstate.c:1131
#define NONEFUNCTION
Definition: gsmcomon.h:12
GSM_Error GSM_DecodeSMSFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
Definition: gsmsms.c:807
int GSM_PackSevenBitsToEight(size_t offset, const unsigned char *input, unsigned char *output, size_t length)
Definition: coding.c:993
GSM_Error
Definition: gammu-error.h:23
GSM_Error DCT3_GetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
void PHONE_EncodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap)
Definition: gsmlogo.c:197
GSM_Error DCT3DCT4_ReplyEnableConnectFunc(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void NOKIA_FindFeatureValue(GSM_StateMachine *s, GSM_Profile_PhoneTableValue ProfileTable[], unsigned char ID, unsigned char Value, GSM_Phone_Data *Data, gboolean CallerGroups)
GSM_SMSFolders LastSMSFolders
Definition: n7110.h:16
GSM_Debug_Info di
Definition: gsmstate.h:1412
GSM_OneSMSFolder Folder[GSM_MAX_SMS_FOLDERS]
GSM_Error NoneReply(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
Definition: pfunc.c:188
GSM_Error DCT3DCT4_ReplyDisableConnectFunc(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_65_ReplyCallInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
GSM_Error N71_65_ReplyGetCalendarNotePos1(GSM_Protocol_Message *msg, GSM_StateMachine *s, int *FirstCalendarPos)
GSM_SMSMessageLayout PHONE_SMSDeliver
Definition: pfunc.c:16
GSM_Error N71_65_ReplyAddCalendar1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *Bitmap)
Definition: gsmlogo.c:141
GSM_Error PHONE_Terminate(GSM_StateMachine *s)
Definition: pfunc.c:79
GSM_Error DCT3_Reset(GSM_StateMachine *s, gboolean hard)
GSM_Bitmap * Bitmap
Definition: gsmstate.h:573
unsigned char Location
Definition: gammu-bitmap.h:112
GSM_Error(* WriteMessage)(GSM_StateMachine *s, unsigned const char *buffer, int length, int type)
Definition: gsmstate.h:347
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 NOKIA_SetIncomingCall(GSM_StateMachine *s, gboolean enable)
char Name[40 *2]
GSM_Profile_PhoneTableValue Profile71_65[]
GSM_Error DCT3_ReplyGetWAPBookmark(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char GSM_EncodeNokiaRTTLRingtone(GSM_Ringtone *ringtone, unsigned char *package, size_t *maxlength)
Definition: gsmring.c:992
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
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)
GSM_Error DCT3_SetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
char NetworkCode[10]
Definition: gammu-bitmap.h:160
GSM_Error DCT3_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
unsigned char RingtoneID
Definition: gammu-bitmap.h:138
GSM_Error DCT3DCT4_GetFirmware(GSM_StateMachine *s)
GSM_Error DCT3DCT4_ReplySetActiveConnectSet(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_92_ReplyGetSignalQuality(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N61_71_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
int gboolean
Definition: gammu-types.h:23
void GSM_MakeMultiPartSMS(GSM_Debug_Info *di, GSM_MultiSMSMessage *SMS, unsigned char *MessageBuffer, size_t MessageLength, GSM_UDH UDHType, GSM_Coding_Type Coding, int Class, unsigned char ReplaceMessage)
Definition: gsmmulti.c:305
GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_MemoryType
Definition: gammu-memory.h:31
GSM_Error N71_92_GetPhoneSetting(GSM_StateMachine *s, int Request, int Setting)
#define GSM_MAX_SMS_FOLDER_NAME_LEN
Definition: gammu-limits.h:155
GSM_Error DCT3DCT4_SetCallDivert(GSM_StateMachine *s, GSM_CallDivert *divert)
unsigned char Name[(GSM_MAX_SMS_NAME_LENGTH+1) *2]
gboolean InboxFolder
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
GSM_Error DCT3_ReplySetWAPSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_92_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
size_t N71_65_PackPBKBlock(GSM_StateMachine *s, int id, size_t size, int no, unsigned char *buf, unsigned char *block)
Definition: nfunc.c:36
unsigned int Location[GSM_PHONE_MAXSMSINFOLDER+1]
Definition: ncommon.h:87
struct GSM_Phone_Data::@2 Priv
#define SM30_UNICODETEXT
Definition: gsmmulti.h:17
GSM_NOKIASMSFolder LastSMSFolder
Definition: n7110.h:15
GSM_Error N71_65_ReplyGetNextCalendar1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
gboolean NOKIA_FindPhoneFeatureValue(GSM_StateMachine *s, GSM_Profile_PhoneTableValue ProfileTable[], GSM_Profile_Feat_ID FeatureID, GSM_Profile_Feat_Value FeatureValue, unsigned char *PhoneID, unsigned char *PhoneValue)
GSM_NokiaBinaryRingtone NokiaBinary
GSM_Error DCT3_ReplyPressKey(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void NOKIA_GetDefaultCallerGroupName(GSM_Bitmap *Bitmap)
Definition: nfunc.c:956
unsigned char N71_65_MEMORY_TYPES[]
Definition: nfunc.c:21
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
unsigned char Frame[50000]
GSM_Error N71_92_ReplyPhoneSetting(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_GetIMEI(GSM_StateMachine *s)
GSM_Ringtone * Ringtone
Definition: gsmstate.h:545
GSM_Error DCT3_ReplyGetAlarm(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_SetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
GSM_Phone_RequestID RequestID
Definition: gsmstate.h:685
GSM_Error N71_65_GetNextCalendar1(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos)
GSM_Error DCT3_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, gboolean start)
unsigned char Name[(GSM_MAX_SMS_FOLDER_NAME_LEN+1) *2]
GSM_Error N71_65_DecodePhonebook(GSM_StateMachine *s, GSM_MemoryEntry *entry, GSM_Bitmap *bitmap, GSM_SpeedDial *speed, unsigned char *MessageBuffer, int MessageLength, gboolean DayMonthReverse)
Definition: nfunc.c:364
GSM_Error DCT3_ReplySIMLogout(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_MemoryType Memory
gboolean OutboxFolder
gboolean BitmapEnabled
Definition: gammu-bitmap.h:122
GSM_Error DCT3_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm, unsigned char msgtype)
GSM_Error DCT3_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
GSM_Profile_Feat_Value FeatureValue[15]
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
GSM_Error N71_65_ReplyAddCalendar2(GSM_Protocol_Message *msg, GSM_StateMachine *s)
#define N7110_FRAME_HEADER
Definition: ncommon.h:9
GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error DCT3DCT4_ReplyDelWAPBookmark(GSM_Protocol_Message *msg, GSM_StateMachine *s)
#define NOTIMPLEMENTED
Definition: gsmcomon.h:13
gboolean CarKitProfile
GSM_Protocol Protocol
Definition: gsmstate.h:1430
gboolean InboxFolder
gboolean DefaultBitmap
Definition: gammu-bitmap.h:130
GSM_Error DCT3DCT4_CancelAllDiverts(GSM_StateMachine *s)
void NOKIA_EncodeNetworkCode(unsigned char *buffer, const char *input)
Definition: gsmnet.c:2467
GSM_Error DCT3DCT4_ReplySetWAPBookmark(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_65_ReplyGetCalendarInfo1(GSM_Protocol_Message *msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *LastCalendar)
GSM_Error DCT3_GetProductCode(GSM_StateMachine *s, char *value)
GSM_Phone_Data Data
Definition: gsmstate.h:1369
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
GSM_Error N71_65_EnableFunctions(GSM_StateMachine *s, const char *buff, int len)
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)
GSM_Error DCT3DCT4_ReplyGetModelFirmware(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_MemoryType MemoryType
Definition: gammu-memory.h:131
GSM_Error N71_65_ReplyUSSDInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void GSM_ClearBitmap(GSM_Bitmap *bmp)
Definition: gsmlogo.c:247
GSM_SMSFolders * SMSFolders
Definition: gsmstate.h:521
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026
size_t N71_65_EncodePhonebookFrame(GSM_StateMachine *s, unsigned char *req, GSM_MemoryEntry *entry, size_t *block2, gboolean DCT4, gboolean VoiceTag)
Definition: nfunc.c:54
GSM_Error N71_92_GetSignalQuality(GSM_StateMachine *s, GSM_SignalQuality *sig)
gboolean DefaultName
Definition: gammu-bitmap.h:126
GSM_Error NOKIA_ReplyGetPhoneString(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void PHONE_GetBitmapWidthHeight(GSM_Phone_Bitmap_Types Type, size_t *width, size_t *height)
Definition: gsmlogo.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)
void * IncomingSMSUserData
Definition: gsmstate.h:1387
gboolean DefaultName
GSM_Error N71_92_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error GSM_RingtoneConvert(GSM_Ringtone *dest, GSM_Ringtone *src, GSM_RingtoneFormat Format)
Definition: gsmring.c:1543
size_t BitmapWidth
Definition: gammu-bitmap.h:156
GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
GSM_Error N71_65_AddCalendar2(GSM_StateMachine *s, GSM_CalendarEntry *Note)
unsigned char Text[2 *(GSM_BITMAP_TEXT_LENGTH+1)]
Definition: gammu-bitmap.h:118
GSM_Error N71_65_ReplyGetMemoryError(unsigned char error, GSM_StateMachine *s)
GSM_Protocol_Functions * Functions
Definition: gsmstate.h:424
GSM_Error NOKIA_GetManufacturer(GSM_StateMachine *s)
#define TRUE
Definition: gammu-types.h:28
GSM_MemoryStatus * MemoryStatus
Definition: gsmstate.h:501
GSM_SMSMessage * SaveSMSMessage
Definition: gsmstate.h:513
GSM_Error DCT3_GetOriginalIMEI(GSM_StateMachine *s, char *value)
GSM_Error NOKIA_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
GSM_Profile * Profile
Definition: gsmstate.h:605
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
#define UNUSED
Definition: gammu-misc.h:105
GSM_Error DCT3_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
GSM_Error DCT3DCT4_AnswerCall(GSM_StateMachine *s, int ID)
GSM_Error DCT3_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
char Model[GSM_MAX_MODEL_LENGTH+1]
Definition: gsmstate.h:445
GSM_SpeedDial * SpeedDial
Definition: gsmstate.h:485
GSM_Error DCT3_ReplySetDateTime(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_MemoryType Memory
IncomingSMSCallback IncomingSMS
Definition: gsmstate.h:1382
GSM_Error N71_65_ReplySendDTMF(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void NOKIA_GetDefaultProfileName(GSM_Profile *Profile)
GSM_Error DCT3DCT4_SendDTMF(GSM_StateMachine *s, char *sequence)
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
gboolean Active
GSM_Error DCT3_GetManufactureMonth(GSM_StateMachine *s, char *value)
#define SM30_OTA
Definition: gsmmulti.h:18
GSM_Error N71_65_ReplyWritePhonebook(GSM_Protocol_Message *msg, GSM_StateMachine *s)