Gammu internals  1.38.0
atobex.c
Go to the documentation of this file.
1 /* (c) 2006 by Michal Cihar */
2 
20 #include "../../gsmstate.h"
21 
22 #ifdef GSM_ENABLE_ATOBEX
23 #ifdef GSM_ENABLE_ATGEN
24 
25 #include <string.h>
26 #include <time.h>
27 
28 #include "../../gsmcomon.h"
29 #include "../../misc/coding/coding.h"
30 #include "../../misc/misc.h"
31 #include "../pfunc.h"
32 #include "../at/atfunc.h"
33 #include "../at/sonyericsson.h"
34 #include "../obex/obexfunc.h"
35 #include "atobex.h"
36 
37 extern GSM_Reply_Function ATOBEXReplyFunctions[];
38 
39 
43 GSM_Error ATOBEX_SetATMode(GSM_StateMachine *s)
44 {
45  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
46  GSM_Error error;
47 
48  /* Aren't we in OBEX mode? */
49  if (Priv->Mode == ATOBEX_ModeAT) return ERR_NONE;
50 
51  smprintf(s, "Terminating OBEX\n");
52 
53  /* Disconnect from OBEX service */
54  error = OBEXGEN_Disconnect(s);
55  if (error != ERR_NONE) return error;
56 
57  /* Terminate OBEX protocol */
58  error = s->Protocol.Functions->Terminate(s);
59  if (error != ERR_NONE) return error;
60 
61  /* Switch to AT protocol */
62  smprintf(s, "Changing protocol to AT\n");
63  s->Protocol.Functions = &ATProtocol;
65  Priv->Mode = ATOBEX_ModeAT;
66 
67  /* Terminate SQWE Obex mode */
68  if (Priv->HasOBEX == ATOBEX_OBEX_SQWE) {
69  sleep(1);
70  error = GSM_WaitFor (s, "+++", 3, 0x00, 100, ID_IncomingFrame);
71  if (error != ERR_NONE) return error;
72  }
73 
74  /* Give Samsung phones some time to recover from protocol switch */
75  if (Priv->HasOBEX == ATOBEX_OBEX_MOBEX || Priv->HasOBEX == ATOBEX_OBEX_TSSPCSW) {
76  sleep(2);
77  }
78 
79  /* Initialise AT protocol */
80  error = s->Protocol.Functions->Initialise(s);
81  if (error != ERR_NONE) return error;
82 
83  return ERR_NONE;
84 }
85 
86 
91 GSM_Error ATOBEX_SetOBEXMode(GSM_StateMachine *s, OBEX_Service service)
92 {
93  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
94  GSM_Error error;
95 
96  /* Is OBEX mode supported? */
97  if (Priv->HasOBEX == ATOBEX_OBEX_None) {
98  return ERR_NOTSUPPORTED;
99  }
100 
101  /* Are we already in OBEX mode? */
102  if (Priv->Mode == ATOBEX_ModeOBEX) {
103  /* We can not safely switch service, we need to disconnect instead */
104  if (s->Phone.Data.Priv.OBEXGEN.Service == service) {
105  return ERR_NONE;
106  } else {
107  error = ATOBEX_SetATMode(s);
108  }
109  if (error != ERR_NONE) return error;
110  }
111 
112  smprintf(s, "Changing to OBEX mode\n");
113 
114  /* Switch phone to OBEX */
115  error = ERR_NOTSUPPORTED;
116  switch (Priv->HasOBEX) {
117  case ATOBEX_OBEX_CPROT0:
118  /* 3GPP TS 27.007 standard */
119  error = GSM_WaitFor (s, "AT+CPROT=0\r", 11, 0x00, 100, ID_SetOBEX);
120  break;
121  case ATOBEX_OBEX_EOBEX:
122  /* Sony-Ericsson extension */
123  error = GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 100, ID_SetOBEX);
124  break;
125  case ATOBEX_OBEX_MODE22:
126  /* Motorola extension */
127  error = GSM_WaitFor (s, "AT+MODE=22\r", 11, 0x00, 20, ID_SetOBEX);
128  break;
129  case ATOBEX_OBEX_XLNK:
130  /* Sharp extension */
131  error = GSM_WaitFor (s, "AT+XLNK\r", 8, 0x00, 20, ID_SetOBEX);
132  break;
133  case ATOBEX_OBEX_SQWE:
134  /* Siemens extension */
135  error = GSM_WaitFor (s, "AT^SQWE=3\r", 10, 0x00, 20, ID_SetOBEX);
136  break;
137  case ATOBEX_OBEX_MOBEX:
138  /* Samsung extension */
139  error = GSM_WaitFor (s, "AT+SYNCML=MOBEXSTART\r", 21, 0x00, 20, ID_SetOBEX);
140  break;
141  case ATOBEX_OBEX_TSSPCSW:
142  /* Samsung extension */
143  error = GSM_WaitFor (s, "AT$TSSPCSW=1\r", 13, 0x00, 20, ID_SetOBEX);
144  break;
145  case ATOBEX_OBEX_None:
146  break;
147  }
148  if (error != ERR_NONE) return error;
149 
150  /* Tell OBEX module it has no service selected */
151  s->Phone.Data.Priv.OBEXGEN.Service = 0;
152 
153  smprintf(s, "Changing protocol to OBEX\n");
154 
155  /* Stop AT protocol */
156  error = s->Protocol.Functions->Terminate(s);
157  if (error != ERR_NONE) return error;
158 
159  /* Need some sleep before starting talk in OBEX */
160  sleep(1);
161 
162  /* Switch to OBEX protocol and initialise it */
163  s->Protocol.Functions = &OBEXProtocol;
165 
166  /* Initialise protocol */
167  error = s->Protocol.Functions->Initialise(s);
168  if (error != ERR_NONE) {
169  /* Revert back to AT */
170  s->Protocol.Functions = &ATProtocol;
171  return error;
172  }
173 
174  /* Remember our state */
175  Priv->Mode = ATOBEX_ModeOBEX;
176 
177  /* Choose appropriate connection type (we need different for filesystem and for IrMC) */
178  smprintf(s, "Setting service %d\n", service);
179  error = OBEXGEN_Connect(s, service);
180  if (error != ERR_NONE) return error;
181 
182  return ERR_NONE;
183 }
184 
185 
189 GSM_Error ATOBEX_Initialise(GSM_StateMachine *s)
190 {
191  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
192  GSM_Phone_ATGENData *PrivAT = &s->Phone.Data.Priv.ATGEN;
193  GSM_Error error;
194 
195  Priv->Mode = ATOBEX_ModeAT;
196  Priv->EBCAFailed = FALSE;
197 
198  /* We might receive incoming event */
199  s->Phone.Data.BatteryCharge = NULL;
200 
201  /* Init OBEX module also */
202  error = OBEXGEN_InitialiseVars(s);
203  if (error != ERR_NONE) return error;
204 
205  /* This can be filled in by AT module init */
206  Priv->HasOBEX = ATOBEX_OBEX_None;
207  Priv->DataService = OBEX_None;
208 
209  /* Init AT module */
210  /* This also enables ATOBEX_OBEX_CPROT0 if available */
211  error = ATGEN_Initialise(s);
212  if (error != ERR_NONE) return error;
213 
214  /* Does phone have support for AT+MODE=22 switching? */
216  Priv->HasOBEX = ATOBEX_OBEX_MODE22;
217  Priv->DataService = OBEX_IRMC;
219  Priv->HasOBEX = ATOBEX_OBEX_XLNK;
220  Priv->DataService = OBEX_IRMC;
222  Priv->HasOBEX = ATOBEX_OBEX_SQWE;
223  Priv->DataService = OBEX_IRMC;
225  Priv->HasOBEX = ATOBEX_OBEX_CPROT0;
226  Priv->DataService = OBEX_IRMC;
228  Priv->HasOBEX = ATOBEX_OBEX_MOBEX;
229  Priv->DataService = OBEX_m_OBEX;
232  Priv->DataService = OBEX_m_OBEX;
233  } else {
234  if (PrivAT->Mode) {
235  smprintf(s, "Guessed mode style switching\n");
236  Priv->HasOBEX = ATOBEX_OBEX_MODE22;
237  Priv->DataService = OBEX_IRMC;
238  }
239  }
240 
241  /* Do we have OBEX capability? */
242  if (Priv->HasOBEX == ATOBEX_OBEX_None) {
243  error = GSM_WaitFor (s, "AT*EOBEX=?\r", 11, 0x00, 4, ID_SetOBEX);
244  if (error == ERR_NONE) {
245  Priv->HasOBEX = ATOBEX_OBEX_EOBEX;
246  Priv->DataService = OBEX_IRMC;
247  }
248  }
249 
250  return ERR_NONE;
251 }
252 
256 GSM_Error ATOBEX_Terminate(GSM_StateMachine *s)
257 {
258  GSM_Error error;
259 
260  error = ATOBEX_SetATMode(s);
261  if (error != ERR_NONE) return error;
262  OBEXGEN_FreeVars(s);
263  return ATGEN_Terminate(s);
264 }
265 
266 
270 GSM_Error ATOBEX_DispatchMessage(GSM_StateMachine *s)
271 {
272  if (s->Phone.Data.Priv.ATOBEX.Mode == ATOBEX_ModeOBEX) {
273  return GSM_DispatchMessage(s);
274  } else {
275  return ATGEN_DispatchMessage(s);
276  }
277 }
278 
279 
283 GSM_Error ATOBEX_GetProductCode(GSM_StateMachine *s, char *value)
284 {
285  strcpy(value, s->Phone.Data.Model);
286  return ERR_NONE;
287 }
288 
289 
296 GSM_Error ATOBEX_GetIMEI (GSM_StateMachine *s)
297 {
298  GSM_Error error;
299 
300  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
301  return ATGEN_GetIMEI(s);
302 }
303 
304 GSM_Error ATOBEX_GetFirmware(GSM_StateMachine *s)
305 {
306  GSM_Error error;
307 
308  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
309  return ATGEN_GetFirmware(s);
310 }
311 
312 GSM_Error ATOBEX_GetModel(GSM_StateMachine *s)
313 {
314  GSM_Error error;
315 
316  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
317  return ATGEN_GetModel(s);
318 }
319 
320 GSM_Error ATOBEX_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
321 {
322  GSM_Error error;
323 
324  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
325  return ATGEN_GetDateTime(s, date_time);
326 }
327 
328 GSM_Error ATOBEX_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
329 {
330  GSM_Error error;
331 
332  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
333  return ATGEN_GetSMS(s, sms);
334 }
335 
336 GSM_Error ATOBEX_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
337 {
338  GSM_Error error;
339 
340  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
341  return ATGEN_DeleteSMS(s, sms);
342 }
343 
344 GSM_Error ATOBEX_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
345 {
346  GSM_Error error;
347 
348  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
349  return ATGEN_AddSMS(s, sms);
350 }
351 
352 GSM_Error ATOBEX_GetSignalStrength(GSM_StateMachine *s, GSM_SignalQuality *sig)
353 {
354  GSM_Error error;
355 
356  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
357  return ATGEN_GetSignalQuality(s, sig);
358 }
359 
360 GSM_Error ATOBEX_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
361 {
362  GSM_Error error;
363 
364  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
365  return ATGEN_GetSMSFolders(s, folders);
366 }
367 
368 GSM_Error ATOBEX_GetNextSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
369 {
370  GSM_Error error;
371 
372  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
373  return ATGEN_GetNextSMS(s, sms, start);
374 }
375 
376 GSM_Error ATOBEX_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
377 {
378  GSM_Error error;
379 
380  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
381  return ATGEN_GetSMSStatus(s, status);
382 }
383 
384 GSM_Error ATOBEX_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
385 {
386  GSM_Error error;
387 
388  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
389  return ATGEN_DialVoice(s, number, ShowNumber);
390 }
391 
392 GSM_Error ATOBEX_DialService(GSM_StateMachine *s, char *number)
393 {
394  GSM_Error error;
395 
396  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
397  return ATGEN_DialService(s, number);
398 }
399 
400 GSM_Error ATOBEX_AnswerCall(GSM_StateMachine *s, int ID, gboolean all)
401 {
402  GSM_Error error;
403 
404  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
405  return ATGEN_AnswerCall(s,ID,all);
406 }
407 
408 GSM_Error ATOBEX_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
409 {
410  GSM_Error error;
411 
412  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
413  return ATGEN_GetNetworkInfo(s, netinfo);
414 }
415 
416 GSM_Error ATOBEX_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatures *features)
417 {
418  GSM_Error error;
419 
420  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
421  return ATGEN_GetDisplayStatus(s, features);
422 }
423 
424 GSM_Error ATOBEX_SetAutoNetworkLogin(GSM_StateMachine *s)
425 {
426  GSM_Error error;
427 
428  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
429  return ATGEN_SetAutoNetworkLogin(s);
430 }
431 
432 GSM_Error ATOBEX_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
433 {
434  GSM_Error error;
435 
439  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
440  return ATGEN_PressKey(s, Key, Press);
441 }
442 
443 GSM_Error ATOBEX_Reset(GSM_StateMachine *s, gboolean hard)
444 {
445  GSM_Error error;
446 
447  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
448  return ATGEN_Reset(s, hard);
449 }
450 
451 GSM_Error ATOBEX_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
452 {
453  GSM_Error error;
454 
455  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
456  return ATGEN_CancelCall(s,ID,all);
457 }
458 
459 GSM_Error ATOBEX_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
460 {
461  GSM_Error error;
462 
463  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
464  return ATGEN_SendSavedSMS(s, Folder, Location);
465 }
466 
467 GSM_Error ATOBEX_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
468 {
469  GSM_Error error;
470 
471  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
472  return ATGEN_SendSMS(s, sms);
473 }
474 
475 GSM_Error ATOBEX_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
476 {
477  GSM_Error error;
478 
479  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
480  return ATGEN_SetDateTime(s, date_time);
481 }
482 
483 GSM_Error ATOBEX_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
484 {
485  GSM_Error error;
486 
487  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
488  return ATGEN_SetSMSC(s, smsc);
489 }
490 
491 GSM_Error ATOBEX_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
492 {
493  GSM_Error error;
494 
495  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
496  return ATGEN_GetSMSC(s, smsc);
497 }
498 
499 GSM_Error ATOBEX_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode *Code)
500 {
501  GSM_Error error;
502 
503  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
504  return ATGEN_EnterSecurityCode(s, Code);
505 }
506 
507 GSM_Error ATOBEX_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
508 {
509  GSM_Error error;
510 
511  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
512  return ATGEN_GetSecurityStatus(s, Status);
513 }
514 
515 GSM_Error ATOBEX_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
516 {
517  GSM_Error error;
518 
519  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
520  return ATGEN_ResetPhoneSettings(s, Type);
521 }
522 
523 GSM_Error ATOBEX_SendDTMF(GSM_StateMachine *s, char *sequence)
524 {
525  GSM_Error error;
526 
527  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
528  return ATGEN_SendDTMF(s, sequence);
529 }
530 
531 GSM_Error ATOBEX_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
532 {
533  GSM_Error error;
534 
535  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
536  return ATGEN_GetSIMIMSI(s, IMSI);
537 }
538 
539 GSM_Error ATOBEX_SetIncomingCall (GSM_StateMachine *s, gboolean enable)
540 {
541  GSM_Error error;
542 
543  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
544  return ATGEN_SetIncomingCall(s, enable);
545 }
546 
547 GSM_Error ATOBEX_SetIncomingCB (GSM_StateMachine *s, gboolean enable)
548 {
549  GSM_Error error;
550 
551  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
552  return ATGEN_SetIncomingCB(s, enable);
553 }
554 
555 GSM_Error ATOBEX_SetIncomingSMS (GSM_StateMachine *s, gboolean enable)
556 {
557  GSM_Error error;
558 
559  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
560  return ATGEN_SetIncomingSMS(s, enable);
561 }
562 
563 GSM_Error ATOBEX_SetFastSMSSending(GSM_StateMachine *s, gboolean enable)
564 {
565  GSM_Error error;
566 
567  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
568  return ATGEN_SetFastSMSSending(s, enable);
569 }
570 
571 GSM_Error ATOBEX_GetManufacturer(GSM_StateMachine *s)
572 {
573  GSM_Error error;
574 
575  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
576  return ATGEN_GetManufacturer(s);
577 }
578 
579 GSM_Error ATOBEX_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
580 {
581  GSM_Error error;
582 
583  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
584  return ATGEN_GetAlarm(s, Alarm);
585 }
586 
587 GSM_Error ATOBEX_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
588 {
589  GSM_Error error;
590 
591  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
592  return ATGEN_SetAlarm(s, Alarm);
593 }
594 
595 GSM_Error ATOBEX_SetIncomingUSSD(GSM_StateMachine *s, gboolean enable)
596 {
597  GSM_Error error;
598 
599  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
600  return ATGEN_SetIncomingUSSD(s, enable);
601 }
602 
603 GSM_Error ATOBEX_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone)
604 {
605  GSM_Error error;
606 
607  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
608  return ATGEN_GetRingtone(s, Ringtone, PhoneRingtone);
609 }
610 
611 GSM_Error ATOBEX_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
612 {
613  GSM_Error error;
614 
615  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
616  return ATGEN_SetRingtone(s, Ringtone, maxlength);
617 }
618 
619 GSM_Error ATOBEX_SetPower(GSM_StateMachine *s, gboolean on)
620 {
621  GSM_Error error;
622 
623  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
624  return ATGEN_SetPower(s, on);
625 }
626 
627 GSM_Error ATOBEX_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
628 {
629  GSM_Error error;
630 
631  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
632  return ATGEN_GetBitmap(s, Bitmap);
633 }
634 
635 GSM_Error ATOBEX_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
636 {
637  GSM_Error error;
638 
639  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
640  return ATGEN_SetBitmap(s, Bitmap);
641 }
642 
650 GSM_Error ATOBEX_AddFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
651 {
652  GSM_Error error;
653 
654  error = ATOBEX_SetOBEXMode(s, OBEX_BrowsingFolders);
655  if (error != ERR_NONE) {
656  return error;
657  }
658  return OBEXGEN_AddFilePart(s, File, Pos, Handle);
659 }
660 
661 GSM_Error ATOBEX_SendFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
662 {
663  GSM_Error error;
664 
665  error = ATOBEX_SetOBEXMode(s, OBEX_None);
666  if (error != ERR_NONE) {
667  return error;
668  }
669  return OBEXGEN_SendFilePart(s, File, Pos, Handle);
670 }
671 
672 GSM_Error ATOBEX_GetFilePart(GSM_StateMachine *s, GSM_File *File, int *Handle, size_t *Size)
673 {
674  GSM_Error error;
675 
676  error = ATOBEX_SetOBEXMode(s, OBEX_BrowsingFolders);
677  if (error != ERR_NONE) {
678  return error;
679  }
680  return OBEXGEN_GetFilePart(s, File, Handle, Size);
681 }
682 
683 GSM_Error ATOBEX_GetNextFileFolder(GSM_StateMachine *s, GSM_File *File, gboolean start)
684 {
685  GSM_Error error;
686 
687  error = ATOBEX_SetOBEXMode(s, OBEX_BrowsingFolders);
688  if (error != ERR_NONE) {
689  return error;
690  }
691  return OBEXGEN_GetNextFileFolder(s, File, start);
692 }
693 
694 GSM_Error ATOBEX_DeleteFile(GSM_StateMachine *s, unsigned char *ID)
695 {
696  GSM_Error error;
697 
698  error = ATOBEX_SetOBEXMode(s, OBEX_BrowsingFolders);
699  if (error != ERR_NONE) {
700  return error;
701  }
702  return OBEXGEN_DeleteFile(s, ID);
703 }
704 
705 GSM_Error ATOBEX_AddFolder(GSM_StateMachine *s, GSM_File *File)
706 {
707  GSM_Error error;
708 
709  error = ATOBEX_SetOBEXMode(s, OBEX_BrowsingFolders);
710  if (error != ERR_NONE) {
711  return error;
712  }
713  return OBEXGEN_AddFolder(s, File);
714 }
715 
718 static int ATOBEX_UseObex (GSM_StateMachine *s, GSM_MemoryType type)
719 {
720  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
721  if (type == MEM_ME) {
722  return 1;
723  }
724  if (type != MEM_SM) {
725  return 0;
726  }
727  if (Priv->HasOBEX == ATOBEX_OBEX_MOBEX || Priv->HasOBEX == ATOBEX_OBEX_TSSPCSW) {
728  return 1;
729  }
730  return 0;
731 }
738 GSM_Error ATOBEX_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
739 {
740  GSM_Error error;
741  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
742 
743  if (ATOBEX_UseObex (s, Status->MemoryType)) {
744  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
745  if (error != ERR_NONE) {
746  goto atgen;
747  }
748  return OBEXGEN_GetMemoryStatus(s, Status);
749  }
750 
751 atgen:
752  error = ATOBEX_SetATMode(s);
753  if (error != ERR_NONE) {
754  return error;
755  }
756  return ATGEN_GetMemoryStatus(s, Status);
757 }
758 
759 GSM_Error ATOBEX_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
760 {
761  GSM_Error error;
762  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
763 
764  if (ATOBEX_UseObex (s, entry->MemoryType)) {
765  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
766  if (error != ERR_NONE) {
767  goto atgen;
768  }
769  return OBEXGEN_GetMemory(s, entry);
770  }
771 
772 atgen:
773  error = ATOBEX_SetATMode(s);
774  if (error != ERR_NONE) {
775  return error;
776  }
777  return ATGEN_GetMemory(s, entry);
778 }
779 
780 GSM_Error ATOBEX_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
781 {
782  GSM_Error error;
783  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
784 
785  if (ATOBEX_UseObex (s, entry->MemoryType)) {
786  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
787  if (error != ERR_NONE) {
788  goto atgen;
789  }
790  return OBEXGEN_GetNextMemory(s, entry, start);
791  }
792 
793 atgen:
794  error = ATOBEX_SetATMode(s);
795  if (error != ERR_NONE) {
796  return error;
797  }
798  return ATGEN_GetNextMemory(s, entry, start);
799 }
800 
801 GSM_Error ATOBEX_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
802 {
803  GSM_Error error;
804  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
805 
806  if (ATOBEX_UseObex (s, entry->MemoryType)) {
807  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
808  if (error != ERR_NONE) {
809  goto atgen;
810  }
811  return OBEXGEN_SetMemory(s, entry);
812  }
813 
814 atgen:
815  error = ATOBEX_SetATMode(s);
816  if (error != ERR_NONE) {
817  return error;
818  }
819  return ATGEN_SetMemory(s, entry);
820 }
821 
822 GSM_Error ATOBEX_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
823 {
824  GSM_Error error;
825  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
826 
827  if (ATOBEX_UseObex (s, entry->MemoryType)) {
828  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
829  if (error != ERR_NONE) {
830  goto atgen;
831  }
832  return OBEXGEN_AddMemory(s, entry);
833  }
834 
835 atgen:
836  error = ATOBEX_SetATMode(s);
837  if (error != ERR_NONE) {
838  return error;
839  }
840  return ATGEN_AddMemory(s, entry);
841 }
842 
843 GSM_Error ATOBEX_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
844 {
845  GSM_Error error;
846  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
847 
848  if (ATOBEX_UseObex (s, entry->MemoryType)) {
849  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
850  if (error != ERR_NONE) {
851  goto atgen;
852  }
853  return OBEXGEN_DeleteMemory(s, entry);
854  }
855 
856 atgen:
857  error = ATOBEX_SetATMode(s);
858  if (error != ERR_NONE) {
859  return error;
860  }
861  return ATGEN_DeleteMemory(s, entry);
862 }
863 
864 GSM_Error ATOBEX_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType type)
865 {
866  GSM_Error error;
867  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
868 
869  if (ATOBEX_UseObex (s, type)) {
870  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
871  if (error != ERR_NONE) {
872  goto atgen;
873  }
874  return OBEXGEN_DeleteAllMemory(s, type);
875  }
876 
877 atgen:
878  error = ATOBEX_SetATMode(s);
879  if (error != ERR_NONE) {
880  return error;
881  }
882  return ATGEN_DeleteAllMemory(s, type);
883 }
884 
892 GSM_Error ATOBEX_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
893 {
894  GSM_Error error;
895  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
896 
897  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
898  if (error != ERR_NONE) {
899  return error;
900  }
901  return OBEXGEN_GetTodoStatus(s, status);
902 }
903 
904 GSM_Error ATOBEX_GetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
905 {
906  GSM_Error error;
907  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
908 
909  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
910  if (error != ERR_NONE) {
911  return error;
912  }
913  return OBEXGEN_GetTodo(s, ToDo);
914 }
915 
916 GSM_Error ATOBEX_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, gboolean start)
917 {
918  GSM_Error error;
919  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
920 
921  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
922  if (error != ERR_NONE) {
923  return error;
924  }
925  return OBEXGEN_GetNextTodo(s, ToDo, start);
926 }
927 
928 GSM_Error ATOBEX_DeleteAllToDo (GSM_StateMachine *s)
929 {
930  GSM_Error error;
931  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
932 
933  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
934  if (error != ERR_NONE) {
935  return error;
936  }
937  return OBEXGEN_DeleteAllTodo(s);
938 }
939 
940 GSM_Error ATOBEX_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
941 {
942  GSM_Error error;
943  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
944 
945  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
946  if (error != ERR_NONE) {
947  return error;
948  }
949  return OBEXGEN_AddTodo(s, ToDo);
950 }
951 
952 GSM_Error ATOBEX_SetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
953 {
954  GSM_Error error;
955  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
956 
957  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
958  if (error != ERR_NONE) {
959  return error;
960  }
961  return OBEXGEN_SetTodo(s, ToDo);
962 }
963 
964 GSM_Error ATOBEX_DeleteToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
965 {
966  GSM_Error error;
967  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
968 
969  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
970  if (error != ERR_NONE) {
971  return error;
972  }
973  return OBEXGEN_DeleteTodo(s, ToDo);
974 }
975 
976 GSM_Error ATOBEX_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *status)
977 {
978  GSM_Error error;
979  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
980 
981  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
982  if (error != ERR_NONE) {
983  return error;
984  }
985  return OBEXGEN_GetCalendarStatus(s, status);
986 }
987 
988 GSM_Error ATOBEX_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
989 {
990  GSM_Error error;
991  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
992 
993  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
994  if (error != ERR_NONE) {
995  return error;
996  }
997  return OBEXGEN_GetCalendar(s, Note);
998 }
999 
1000 GSM_Error ATOBEX_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start)
1001 {
1002  GSM_Error error;
1003  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1004 
1005  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1006  if (error != ERR_NONE) {
1007  return error;
1008  }
1009  return OBEXGEN_GetNextCalendar(s, Note, start);
1010 }
1011 
1012 GSM_Error ATOBEX_DeleteCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
1013 {
1014  GSM_Error error;
1015  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1016 
1017  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1018  if (error != ERR_NONE) {
1019  return error;
1020  }
1021  return OBEXGEN_DeleteCalendar(s, Note);
1022 }
1023 
1024 GSM_Error ATOBEX_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
1025 {
1026  GSM_Error error;
1027  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1028 
1029  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1030  if (error != ERR_NONE) {
1031  return error;
1032  }
1033  return OBEXGEN_AddCalendar(s, Note);
1034 }
1035 
1036 GSM_Error ATOBEX_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
1037 {
1038  GSM_Error error;
1039  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1040 
1041  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1042  if (error != ERR_NONE) {
1043  return error;
1044  }
1045  return OBEXGEN_SetCalendar(s, Note);
1046 }
1047 
1048 GSM_Error ATOBEX_DeleteAllCalendar (GSM_StateMachine *s)
1049 {
1050  GSM_Error error;
1051  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1052 
1053  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1054  if (error != ERR_NONE) {
1055  return error;
1056  }
1057  return OBEXGEN_DeleteAllCalendar(s);
1058 }
1059 
1060 GSM_Error ATOBEX_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
1061 {
1062  GSM_Error error;
1063  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1064 
1065  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1066  if (error != ERR_NONE) {
1067  return error;
1068  }
1069  return OBEXGEN_GetNoteStatus(s, status);
1070 }
1071 
1072 GSM_Error ATOBEX_GetNote (GSM_StateMachine *s, GSM_NoteEntry *Note)
1073 {
1074  GSM_Error error;
1075  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1076 
1077  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1078  if (error != ERR_NONE) {
1079  return error;
1080  }
1081  return OBEXGEN_GetNote(s, Note);
1082 }
1083 
1084 GSM_Error ATOBEX_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, gboolean start)
1085 {
1086  GSM_Error error;
1087  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1088 
1089  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1090  if (error != ERR_NONE) {
1091  return error;
1092  }
1093  return OBEXGEN_GetNextNote(s, Note, start);
1094 }
1095 
1096 GSM_Error ATOBEX_DeleteAllNotes(GSM_StateMachine *s)
1097 {
1098  GSM_Error error;
1099  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1100 
1101  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1102  if (error != ERR_NONE) {
1103  return error;
1104  }
1105  return OBEXGEN_DeleteAllNotes(s);
1106 }
1107 
1108 GSM_Error ATOBEX_AddNote (GSM_StateMachine *s, GSM_NoteEntry *Note)
1109 {
1110  GSM_Error error;
1111  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1112 
1113  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1114  if (error != ERR_NONE) {
1115  return error;
1116  }
1117  return OBEXGEN_AddNote(s, Note);
1118 }
1119 
1120 GSM_Error ATOBEX_SetNote (GSM_StateMachine *s, GSM_NoteEntry *Note)
1121 {
1122  GSM_Error error;
1123  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1124 
1125  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1126  if (error != ERR_NONE) {
1127  return error;
1128  }
1129  return OBEXGEN_SetNote(s, Note);
1130 }
1131 
1132 GSM_Error ATOBEX_DeleteNote (GSM_StateMachine *s, GSM_NoteEntry *Note)
1133 {
1134  GSM_Error error;
1135  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1136 
1137  error = ATOBEX_SetOBEXMode(s, Priv->DataService);
1138  if (error != ERR_NONE) {
1139  return error;
1140  }
1141  return OBEXGEN_DeleteNote(s, Note);
1142 }
1143 
1144 
1160 {
1161  GSM_Locale *locale = s->Phone.Data.Locale;
1162  int format;
1163  char *pos;
1164 
1165  switch (s->Phone.Data.Priv.ATGEN.ReplyState) {
1166  case AT_Reply_OK:
1167  smprintf(s, "Date settings received\n");
1168  pos = strstr(msg->Buffer, "*ESDF:");
1169  if (pos == NULL) return ERR_UNKNOWNRESPONSE;
1170  format = atoi(pos + 7);
1171  switch (format) {
1172  case 0: locale->DateFormat = GSM_Date_OFF;
1173  locale->DateSeparator = 0;
1174  break;
1175  case 1: locale->DateFormat = GSM_Date_DDMMMYY;
1176  locale->DateSeparator = '-';
1177  break;
1178  case 2: locale->DateFormat = GSM_Date_DDMMYY;
1179  locale->DateSeparator = '-';
1180  break;
1181  case 3: locale->DateFormat = GSM_Date_MMDDYY;
1182  locale->DateSeparator = '/';
1183  break;
1184  case 4: locale->DateFormat = GSM_Date_DDMMYY;
1185  locale->DateSeparator = '/';
1186  break;
1187  case 5: locale->DateFormat = GSM_Date_DDMMYY;
1188  locale->DateSeparator = '.';
1189  break;
1190  case 6: locale->DateFormat = GSM_Date_YYMMDD;
1191  locale->DateSeparator = 0;
1192  break;
1193  case 7: locale->DateFormat = GSM_Date_YYMMDD;
1194  locale->DateSeparator = '-';
1195  break;
1196  default:return ERR_UNKNOWNRESPONSE;
1197  }
1198  return ERR_NONE;
1199  default:return ERR_NOTSUPPORTED;
1200  }
1201 }
1202 
1211 {
1212  int format;
1213  char *pos;
1214 
1215  switch (s->Phone.Data.Priv.ATGEN.ReplyState) {
1216  case AT_Reply_OK:
1217  smprintf(s, "Time settings received\n");
1218  pos = strstr(msg->Buffer, "*ESTF:");
1219  if (pos == NULL) return ERR_UNKNOWNRESPONSE;
1220  format = atoi(pos + 7);
1221  switch (format) {
1222  case 1:
1223  case 2: s->Phone.Data.Locale->AMPMTime=(format==2);
1224  return ERR_NONE;
1225  default:return ERR_UNKNOWNRESPONSE;
1226  }
1227  default: return ERR_NOTSUPPORTED;
1228  }
1229 }
1230 
1238 GSM_Error ATOBEX_GetLocale(GSM_StateMachine *s, GSM_Locale *locale)
1239 {
1240  GSM_Error error;
1241 
1242  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
1243 
1244 
1245  s->Phone.Data.Locale = locale;
1246 
1247  smprintf(s, "Getting date format\n");
1248  error=GSM_WaitFor (s, "AT*ESDF?\r", 9, 0x00, 3, ID_GetLocale);
1249  if (error!=ERR_NONE) return error;
1250 
1251  smprintf(s, "Getting time format\n");
1252  return GSM_WaitFor (s, "AT*ESTF?\r", 9, 0x00, 3, ID_GetLocale);
1253 }
1254 
1262 GSM_Error ATOBEX_SetLocale(GSM_StateMachine *s, GSM_Locale *locale)
1263 {
1264  /* this is not yet supported by gammu.c */
1265  int format=0;
1266  char req[12];
1267  GSM_Error error;
1268 
1269  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
1270 
1271  if (locale->DateFormat==GSM_Date_OFF) { format=0; } else
1272  if ((locale->DateFormat==GSM_Date_DDMMMYY)&&(locale->DateSeparator=='-')) { format=1; } else
1273  if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='-')) { format=2; } else
1274  if ((locale->DateFormat==GSM_Date_MMDDYY)&&(locale->DateSeparator=='/')) { format=3; } else
1275  if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='/')) { format=4; } else
1276  if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='.')) { format=5; } else
1277  if ((locale->DateFormat==GSM_Date_YYMMDD)&&(locale->DateSeparator==0)) { format=6; } else
1278  if ((locale->DateFormat==GSM_Date_YYMMDD)&&(locale->DateSeparator=='-')) { format=7; }
1279  else { return ERR_NOTSUPPORTED; } /* ERR_WRONGINPUT */
1280 
1281  sprintf(req,"AT*ESDF=%i\r",format);
1282  smprintf(s, "Setting date format\n");
1283  error = GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetLocale);
1284  if (error!=ERR_NONE) return error;
1285 
1286  if (locale->AMPMTime) { format=2; } else { format=1; }
1287  sprintf(req,"AT*ESTF=%i\r",format);
1288  smprintf(s, "Setting time format\n");
1289  return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetLocale);
1290 }
1291 
1293 {
1294  GSM_Error error;
1295 
1296  switch (s->Phone.Data.Priv.ATGEN.ReplyState) {
1297  case AT_Reply_OK:
1298  error = ATGEN_ParseReply(s,
1299  GetLineString(msg->Buffer, &s->Phone.Data.Priv.ATGEN.Lines, 2),
1300  "*EMEM: @i, @i, @i, @i, @i",
1306  );
1307 
1308  if (error == ERR_NONE) {
1309  /* This is actually total */
1311  return ERR_NONE;
1312  }
1313 
1314  return error;
1315  default:
1316  return ERR_NOTSUPPORTED;
1317  }
1318 }
1319 
1320 GSM_Error ATOBEX_GetFileSystemStatus(GSM_StateMachine *s, GSM_FileSystemStatus *Status)
1321 {
1322  GSM_Error error;
1323 
1324  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
1325 
1326  s->Phone.Data.FileSystemStatus = Status;
1327 
1328  return GSM_WaitFor (s, "AT*EMEM\r", 8, 0x00, 3, ID_FileSystemStatus);
1329 }
1330 
1332 {
1333  int tmp, ncapacity, method, state;
1334  int vbat1, vbat2, vbat3, vbat4;
1335  GSM_Error error;
1337 
1338  if (bat == NULL) {
1339  smprintf(s, "Battery status received, but not requested right now\n");
1340  return ERR_NONE;
1341  }
1342  smprintf(s, "Battery status received\n");
1343 
1344  /* Parse version 4 reply */
1345  error = ATGEN_ParseReply(s,
1346  msg->Buffer,
1347  "*EBCA: @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i\xd\xa",
1348  &bat->BatteryVoltage, /* vbat */
1349  &bat->ChargeVoltage, /* dcio */
1350  &bat->ChargeCurrent, /* iocharge */
1351  &bat->PhoneCurrent, /* iphone */
1352  &bat->BatteryTemperature, /* tempbattery */
1353  &bat->PhoneTemperature, /* tempphone */
1354  &method, /* chargingmethod, used to determine battery type */
1355  &state, /* chargestate */
1356  &bat->BatteryCapacity, /* remcapacity */
1357  &bat->BatteryPercent, /* remcapacitypercent */
1358  &tmp, /* powerdissipation */
1359  &tmp, /* noccycles */
1360  &tmp, /* nosostimer */
1361  &tmp /* suspensioncause */
1362  );
1363  /* Did we suceed? */
1364  if (error == ERR_NONE) {
1365  /* Posprocess fields that need it */
1366  bat->ChargeCurrent /= 10;
1367  bat->PhoneCurrent /= 10;
1368  switch (method) {
1369  case 0:
1371  break;
1372  case 1:
1374  break;
1375  case 2:
1377  break;
1378  default:
1380  break;
1381  }
1382  switch (state) {
1383  case 7:
1385  break;
1386  case 2:
1388  break;
1389  case 0:
1390  case 3:
1391  case 4:
1392  case 5:
1393  case 15:
1395  break;
1396  case 8:
1398  break;
1399  }
1400  s->Phone.Data.BatteryCharge = NULL;
1401  return ERR_NONE;
1402  }
1403 
1404  /* Parse version 2 reply */
1405  error = ATGEN_ParseReply(s,
1406  msg->Buffer,
1407  "*EBCA: @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i, @i\xd\xa",
1408  &vbat1, /* vbat1 */
1409  &vbat2, /* vbat2 */
1410  &vbat3, /* vbat3 */
1411  &vbat4, /* vbat4 */
1412  &method, /* btype */
1413  &bat->ChargeVoltage, /* dcio */
1414  &bat->ChargeCurrent, /* iocharge */
1415  &bat->PhoneCurrent, /* iphone */
1416  &tmp, /* acapacity */
1417  &tmp, /* ccapacity */
1418  &tmp, /* pcapacity */
1419  &ncapacity, /* ncapacity */
1420  &bat->BatteryTemperature, /* tempbattery */
1421  &bat->PhoneTemperature, /* tempphone */
1422  &state, /* chargestate */
1423  &bat->BatteryPercent, /* remcapacitypercent */
1424  &tmp, /* cycles */
1425  &tmp, /* ipulse */
1426  &tmp, /* ibattery */
1427  &tmp, /* ChTempMax */
1428  &tmp, /* ChTempMin */
1429  &tmp, /* MainChTempMax */
1430  &tmp, /* MainChTempMin */
1431  &tmp, /* FlatVTimer */
1432  &tmp, /* DV */
1433  &tmp, /* DT */
1434  &tmp /* D2V */
1435  );
1436  /* Did we suceed? */
1437  if (error == ERR_NONE) {
1438  /* Posprocess fields that need it */
1439  if (vbat4 > 0) {
1440  bat->BatteryVoltage = vbat4;
1441  } else if (vbat3 > 0) {
1442  bat->BatteryVoltage = vbat3;
1443  } else if (vbat2 > 0) {
1444  bat->BatteryVoltage = vbat2;
1445  } else if (vbat1 > 0) {
1446  bat->BatteryVoltage = vbat1;
1447  }
1448  bat->ChargeVoltage *= 10;
1449  switch (method) {
1450  case 0:
1452  break;
1453  case 1:
1455  break;
1456  case 2:
1457  default:
1459  break;
1460  }
1461  switch (state) {
1462  case 3:
1464  break;
1465  case 0:
1466  case 1:
1467  case 2:
1469  break;
1470  case 4:
1471  case 5:
1472  case 6:
1473  case 7:
1474  case 8:
1476  break;
1477  }
1478  /* Calculate remaining capacity */
1479  bat->BatteryCapacity = 1000 * ncapacity / bat->BatteryPercent;
1480  s->Phone.Data.BatteryCharge = NULL;
1481  return ERR_NONE;
1482  }
1483 
1484  smprintf(s, "Unsupported battery status format, you're welcome to help with implementation\n");
1485  s->Phone.Data.BatteryCharge = NULL;
1486  return ERR_NOTIMPLEMENTED;
1487 }
1488 
1489 GSM_Error ATOBEX_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
1490 {
1491  GSM_Error error, error2;
1492  int i = 0;
1493  GSM_Phone_ATOBEXData *Priv = &s->Phone.Data.Priv.ATOBEX;
1494 
1495  s->Phone.Data.BatteryCharge = bat;
1496 
1497  if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
1498 
1499  /* Go to AT if EBCA does not work */
1500  if (Priv->EBCAFailed) {
1501  return ATGEN_GetBatteryCharge(s, bat);
1502  }
1503 
1504  /* Now try ericsson extended reporting */
1505  error = GSM_WaitFor (s, "AT*EBCA=1\r", 10, 0x00, 3, ID_GetBatteryCharge);
1506  if (error != ERR_NONE) {
1507  Priv->EBCAFailed = TRUE;
1508  /* Ty ATGEN state */
1509  return ATGEN_GetBatteryCharge(s, bat);
1510  }
1511  /* Wait for async phone reply */
1512  while (s->Phone.Data.BatteryCharge != NULL) {
1513  error = GSM_WaitFor (s, "AT\r", 3, 0x00, 3, ID_GetBatteryCharge);
1514  smprintf(s, "Loop %d, error %d\n", i, error);
1515  if (i == 20) break;
1516  if (error != ERR_NONE) {
1517  break;
1518  }
1519  i++;
1520  }
1521  /* Disable reading information */
1522  error2 = GSM_WaitFor (s, "AT*EBCA=0\r", 10, 0x00, 3, ID_GetBatteryCharge);
1523  if (error2 != ERR_NONE) {
1524  return error;
1525  }
1526  /* If something failed, do AT way */
1527  if (error != ERR_NONE) {
1528  return ATGEN_GetBatteryCharge(s, bat);
1529  }
1530  /* Did we timeout? */
1531  if (i == 20) return ERR_TIMEOUT;
1532  return error;
1533 }
1534 
1538 GSM_Phone_Functions ATOBEXPhone = {
1539  /* There is much more SE phones which support this! */
1540  "sonyericsson|ericsson|atobex",
1542  NOTSUPPORTED, /* Install */
1543  ATOBEX_Initialise,
1544  ATOBEX_Terminate,
1545  ATOBEX_DispatchMessage,
1546  NOTSUPPORTED, /* ShowStartInfo */
1547  ATOBEX_GetManufacturer,
1548  ATOBEX_GetModel,
1549  ATOBEX_GetFirmware,
1550  ATOBEX_GetIMEI,
1551  NOTSUPPORTED, /* GetOriginalIMEI */
1552  NOTSUPPORTED, /* GetManufactureMonth */
1553  ATOBEX_GetProductCode,
1554  NOTSUPPORTED, /* GetHardware */
1555  NOTSUPPORTED, /* GetPPM */
1556  ATOBEX_GetSIMIMSI,
1557  ATOBEX_GetDateTime,
1558  ATOBEX_SetDateTime,
1559  ATOBEX_GetAlarm,
1560  ATOBEX_SetAlarm,
1561  ATOBEX_GetLocale,
1562  ATOBEX_SetLocale,
1563  ATOBEX_PressKey,
1564  ATOBEX_Reset,
1565  ATOBEX_ResetPhoneSettings,
1566  ATOBEX_EnterSecurityCode,
1567  ATOBEX_GetSecurityStatus,
1568  ATOBEX_GetDisplayStatus,
1569  ATOBEX_SetAutoNetworkLogin,
1570  ATOBEX_GetBatteryCharge,
1571  ATOBEX_GetSignalStrength,
1572  ATOBEX_GetNetworkInfo,
1573  NOTSUPPORTED, /* GetCategory */
1574  NOTSUPPORTED, /* AddCategory */
1575  NOTSUPPORTED, /* GetCategoryStatus */
1576  ATOBEX_GetMemoryStatus,
1577  ATOBEX_GetMemory,
1578  ATOBEX_GetNextMemory,
1579  ATOBEX_SetMemory,
1580  ATOBEX_AddMemory,
1581  ATOBEX_DeleteMemory,
1582  ATOBEX_DeleteAllMemory,
1583  NOTSUPPORTED, /* GetSpeedDial */
1584  NOTSUPPORTED, /* SetSpeedDial */
1585  ATOBEX_GetSMSC,
1586  ATOBEX_SetSMSC,
1587  ATOBEX_GetSMSStatus,
1588  ATOBEX_GetSMS,
1589  ATOBEX_GetNextSMS,
1590  NOTSUPPORTED, /* SetSMS */
1591  ATOBEX_AddSMS,
1592  ATOBEX_DeleteSMS,
1593  ATOBEX_SendSMS,
1594  ATOBEX_SendSavedSMS,
1595  ATOBEX_SetFastSMSSending,
1596  ATOBEX_SetIncomingSMS,
1597  ATOBEX_SetIncomingCB,
1598  ATOBEX_GetSMSFolders,
1599  NOTSUPPORTED, /* AddSMSFolder */
1600  NOTSUPPORTED, /* DeleteSMSFolder */
1601  ATOBEX_DialVoice,
1602  ATOBEX_DialService,
1603  ATOBEX_AnswerCall,
1604  ATOBEX_CancelCall,
1605  NOTSUPPORTED, /* HoldCall */
1606  NOTSUPPORTED, /* UnholdCall */
1607  NOTSUPPORTED, /* ConferenceCall */
1608  NOTSUPPORTED, /* SplitCall */
1609  NOTSUPPORTED, /* TransferCall */
1610  NOTSUPPORTED, /* SwitchCall */
1611  NOTSUPPORTED, /* GetCallDivert */
1612  NOTSUPPORTED, /* SetCallDivert */
1613  NOTSUPPORTED, /* CancelAllDiverts */
1614  ATOBEX_SetIncomingCall,
1615  ATOBEX_SetIncomingUSSD,
1616  ATOBEX_SendDTMF,
1617  ATOBEX_GetRingtone,
1618  ATOBEX_SetRingtone,
1619  NOTSUPPORTED, /* GetRingtonesInfo */
1620  NOTSUPPORTED, /* DeleteUserRingtones */
1621  NOTSUPPORTED, /* PlayTone */
1622  NOTSUPPORTED, /* GetWAPBookmark */
1623  NOTSUPPORTED, /* SetWAPBookmark */
1624  NOTSUPPORTED, /* DeleteWAPBookmark */
1625  NOTSUPPORTED, /* GetWAPSettings */
1626  NOTSUPPORTED, /* SetWAPSettings */
1627  NOTSUPPORTED, /* GetSyncMLSettings */
1628  NOTSUPPORTED, /* SetSyncMLSettings */
1629  NOTSUPPORTED, /* GetChatSettings */
1630  NOTSUPPORTED, /* SetChatSettings */
1631  NOTSUPPORTED, /* GetMMSSettings */
1632  NOTSUPPORTED, /* SetMMSSettings */
1633  NOTSUPPORTED, /* GetMMSFolders */
1634  NOTSUPPORTED, /* GetNextMMSFileInfo */
1635  ATOBEX_GetBitmap,
1636  ATOBEX_SetBitmap,
1637  ATOBEX_GetToDoStatus,
1638  ATOBEX_GetToDo,
1639  ATOBEX_GetNextToDo,
1640  ATOBEX_SetToDo,
1641  ATOBEX_AddToDo,
1642  ATOBEX_DeleteToDo,
1643  ATOBEX_DeleteAllToDo,
1644  ATOBEX_GetCalendarStatus,
1645  ATOBEX_GetCalendar,
1646  ATOBEX_GetNextCalendar,
1647  ATOBEX_SetCalendar,
1648  ATOBEX_AddCalendar,
1649  ATOBEX_DeleteCalendar,
1650  ATOBEX_DeleteAllCalendar,
1651  NOTSUPPORTED, /* GetCalendarSettings */
1652  NOTSUPPORTED, /* SetCalendarSettings */
1653  ATOBEX_GetNoteStatus,
1654  ATOBEX_GetNote,
1655  ATOBEX_GetNextNote,
1656  ATOBEX_SetNote,
1657  ATOBEX_AddNote,
1658  ATOBEX_DeleteNote,
1659  ATOBEX_DeleteAllNotes,
1660  NOTSUPPORTED, /* GetProfile */
1661  NOTSUPPORTED, /* SetProfile */
1662  NOTSUPPORTED, /* GetFMStation */
1663  NOTSUPPORTED, /* SetFMStation */
1664  NOTSUPPORTED, /* ClearFMStations */
1665  ATOBEX_GetNextFileFolder,
1666  NOTSUPPORTED, /* GetFolderListing */
1667  NOTSUPPORTED, /* GetNextRootFolder */
1668  NOTSUPPORTED, /* SetFileAttributes */
1669  ATOBEX_GetFilePart,
1670  ATOBEX_AddFilePart,
1671  ATOBEX_SendFilePart,
1672  ATOBEX_GetFileSystemStatus,
1673  ATOBEX_DeleteFile,
1674  ATOBEX_AddFolder,
1675  ATOBEX_DeleteFile, /* DeleteFolder */
1676  NOTSUPPORTED, /* GetGPRSAccessPoint */
1677  NOTSUPPORTED, /* SetGPRSAccessPoint */
1678  SONYERICSSON_GetScreenshot, /* GetScreenshot */
1679  ATOBEX_SetPower,
1680  NOTSUPPORTED, /* PostConnect */
1681  NONEFUNCTION /* PreAPICall */
1682 };
1683 
1684 #endif
1685 #endif
1686 
1688 
1689 /* How should editor hadle tabs in this file? Add editor commands here.
1690  * vim: noexpandtab sw=8 ts=8 sts=8:
1691  */
GSM_Error ATOBEX_ReplyGetTimeLocale(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
GSM_Error ATGEN_AnswerCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error OBEXGEN_DeleteFile(GSM_StateMachine *s, unsigned char *ID)
GSM_Error OBEXGEN_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry, gboolean start)
GSM_Error ATGEN_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
GSM_ChargeState ChargeState
Definition: gammu-info.h:244
GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s)
GSM_Error ATGEN_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_DialService(GSM_StateMachine *s, char *number)
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
GSM_Error OBEXGEN_Connect(GSM_StateMachine *s, OBEX_Service service)
#define NOTSUPPORTED
Definition: gsmcomon.h:14
GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone)
GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
GSM_Error ATGEN_Reset(GSM_StateMachine *s, gboolean hard)
GSM_Error OBEXGEN_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
GSM_Error ATGEN_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
GSM_Error OBEXGEN_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *Entry)
GSM_Error ATGEN_SendDTMF(GSM_StateMachine *s, char *sequence)
GSM_Error OBEXGEN_GetFilePart(GSM_StateMachine *s, GSM_File *File, int *Handle, size_t *Size)
GSM_Error ATGEN_GetModel(GSM_StateMachine *s)
GSM_Error ATGEN_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error ATGEN_Terminate(GSM_StateMachine *s)
GSM_Error GSM_DispatchMessage(GSM_StateMachine *s)
Definition: gsmstate.c:1131
GSM_Error ATGEN_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
#define NONEFUNCTION
Definition: gsmcomon.h:12
GSM_Error OBEXGEN_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *Status)
GSM_Error
Definition: gammu-error.h:23
GSM_Error ATGEN_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatures *features)
GSM_Error ATGEN_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
GSM_Error ATGEN_Initialise(GSM_StateMachine *s)
const char * GetLineString(const char *message, GSM_CutLines *lines, int start)
Definition: misc.c:492
GSM_CallShowNumber
Definition: gammu-call.h:192
OBEX_Service DataService
Definition: atobex.h:78
gboolean EBCAFailed
Definition: atobex.h:74
GSM_Error OBEXGEN_DeleteTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry)
GSM_Error OBEXGEN_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
GSM_DateFormat DateFormat
GSM_Error ATGEN_SetPower(GSM_StateMachine *s, gboolean on)
GSM_Error OBEXGEN_DeleteCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry)
const char features[]
Definition: feature_tests.c:2
GSM_Error ATGEN_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_FileSystemStatus * FileSystemStatus
Definition: gsmstate.h:646
GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error ATGEN_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
GSM_Error ATGEN_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
GSM_Error ATGEN_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
GSM_Locale * Locale
Definition: gsmstate.h:621
GSM_Error ATOBEX_ReplyGetBatteryCharge(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
GSM_Error OBEXGEN_AddNote(GSM_StateMachine *s, GSM_NoteEntry *Entry)
GSM_Error OBEXGEN_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry)
GSM_Error OBEXGEN_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
GSM_Error OBEXGEN_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *Entry)
GSM_Error OBEXGEN_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry)
GSM_Error(* Initialise)(GSM_StateMachine *s)
Definition: gsmstate.h:356
GSM_Error OBEXGEN_GetTodoStatus(GSM_StateMachine *s, GSM_ToDoStatus *Status)
GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
GSM_Error ATGEN_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error OBEXGEN_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *Entry)
int gboolean
Definition: gammu-types.h:23
GSM_MemoryType
Definition: gammu-memory.h:31
GSM_Error OBEXGEN_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *Entry)
GSM_Error ATGEN_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error ATGEN_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
struct GSM_Phone_Data::@2 Priv
GSM_Reply_Function ATGENReplyFunctions[]
GSM_Error OBEXGEN_DeleteAllMemory(GSM_StateMachine *, GSM_MemoryType MemoryTypes)
GSM_SecurityCodeType
void OBEXGEN_FreeVars(GSM_StateMachine *s)
GSM_Error ATOBEX_ReplyGetDateLocale(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_ParseReply(GSM_StateMachine *s, const unsigned char *input, const char *format,...)
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_Error OBEXGEN_DeleteAllCalendar(GSM_StateMachine *s)
GSM_Error ATGEN_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType type)
OBEX_Service
Definition: obexgen.h:30
GSM_Error ATGEN_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
gboolean Mode
Definition: atgen.h:377
GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error ATGEN_SetIncomingCall(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
GSM_Error OBEXGEN_SetNote(GSM_StateMachine *s, GSM_NoteEntry *Entry)
GSM_Error ATGEN_GetNextSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
GSM_Error ATOBEX_ReplyGetFileSystemStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Protocol Protocol
Definition: gsmstate.h:1430
GSM_BatteryCharge * BatteryCharge
Definition: gsmstate.h:537
GSM_Error OBEXGEN_InitialiseVars(GSM_StateMachine *s)
GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
GSM_Error ATGEN_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s)
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_KeyCode
Definition: gammu-keys.h:30
GSM_MemoryType MemoryType
Definition: gammu-memory.h:131
GSM_Error(* Terminate)(GSM_StateMachine *s)
Definition: gsmstate.h:360
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026
GSM_Error OBEXGEN_GetNote(GSM_StateMachine *s, GSM_NoteEntry *Entry)
GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
GSM_Error OBEXGEN_Disconnect(GSM_StateMachine *s)
GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_ATOBEX_OBEX HasOBEX
Definition: atobex.h:70
GSM_Error OBEXGEN_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *Entry)
GSM_Error ATGEN_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
GSM_Error OBEXGEN_GetTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry)
GSM_Error OBEXGEN_DeleteAllNotes(GSM_StateMachine *s)
GSM_Error OBEXGEN_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Entry, gboolean start)
GSM_Error ATGEN_GetIMEI(GSM_StateMachine *s)
GSM_Reply_Function * ReplyFunctions
Definition: gsmstate.h:748
GSM_Error OBEXGEN_AddFolder(GSM_StateMachine *s, GSM_File *File)
GSM_Error OBEXGEN_GetNextFileFolder(GSM_StateMachine *s, GSM_File *File, gboolean start)
char DateSeparator
GSM_Protocol_Functions * Functions
Definition: gsmstate.h:424
GSM_Error OBEXGEN_AddFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
#define TRUE
Definition: gammu-types.h:28
GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s)
GSM_Error OBEXGEN_SendFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
GSM_Reply_Function OBEXGENReplyFunctions[]
GSM_Error OBEXGEN_AddTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry)
GSM_Error SONYERICSSON_GetScreenshot(GSM_StateMachine *s, GSM_BinaryPicture *picture)
unsigned char * Buffer
Definition: protocol.h:22
GSM_ATOBEX_Mode Mode
Definition: atobex.h:66
GSM_Error OBEXGEN_DeleteAllTodo(GSM_StateMachine *s)
char Model[GSM_MAX_MODEL_LENGTH+1]
Definition: gsmstate.h:445
GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
GSM_Error OBEXGEN_SetTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry)
GSM_Error ATGEN_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
GSM_Error ATGEN_GetSignalQuality(GSM_StateMachine *s, GSM_SignalQuality *sig)
GSM_Error OBEXGEN_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Entry)
GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
gboolean AMPMTime
GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode *Code)
GSM_ResetSettingsType
GSM_Error ATGEN_GetFirmware(GSM_StateMachine *s)
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
GSM_Error OBEXGEN_GetNextTodo(GSM_StateMachine *s, GSM_ToDoEntry *Entry, gboolean start)
GSM_BatteryType BatteryType
Definition: gammu-info.h:276
GSM_Error ATGEN_SetIncomingUSSD(GSM_StateMachine *s, gboolean enable)