1 /* (c) 2006 by Michal Cihar */
2 
3 /**
4  * \file atobex.c
5  * @author Michal Čihař
6  */
7 /**
8  * @addtogroup Phone
9  * @{
10  */
11 /**
12  * \defgroup SEPhone Sony-Ericsson phones communication
13  * High level functions for communication with Sony-Ericsson phones.
14  *
15  * This module heavily uses \ref ATPhone and \ref OBEXPhone modules.
16  *
17  * @{
18  */
19 
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 
40 /**
41  * Ensures phone and Gammu protocol are switched to AT commands mode.
42  */
ATOBEX_SetATMode(GSM_StateMachine * s)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;
64 	s->Phone.Functions->ReplyFunctions	= ATGENReplyFunctions;
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 
87 /**
88  * Ensures phone and Gammu protocol are in OBEX mode, in IrMC service
89  * if requrested.
90  */
ATOBEX_SetOBEXMode(GSM_StateMachine * s,OBEX_Service service)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;
164 	s->Phone.Functions->ReplyFunctions	= OBEXGENReplyFunctions;
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 
186 /**
187  * Initialises Sony-Ericsson module internals and calls AT module init.
188  */
ATOBEX_Initialise(GSM_StateMachine * s)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? */
215 	if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_MODE22)) {
216 		Priv->HasOBEX = ATOBEX_OBEX_MODE22;
217 		Priv->DataService = OBEX_IRMC;
218 	} else if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_XLNK)) {
219 		Priv->HasOBEX = ATOBEX_OBEX_XLNK;
220 		Priv->DataService = OBEX_IRMC;
221 	} else if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_SQWE)) {
222 		Priv->HasOBEX = ATOBEX_OBEX_SQWE;
223 		Priv->DataService = OBEX_IRMC;
224 	} else if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CPROT)) {
225 		Priv->HasOBEX = ATOBEX_OBEX_CPROT0;
226 		Priv->DataService = OBEX_IRMC;
227 	} else if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_MOBEX)) {
228 		Priv->HasOBEX = ATOBEX_OBEX_MOBEX;
229 		Priv->DataService = OBEX_m_OBEX;
230 	} else if (GSM_IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TSSPCSW)) {
231 		Priv->HasOBEX = ATOBEX_OBEX_TSSPCSW;
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 
253 /**
254  * Switch to AT mode and calls AT module termination procedure.
255  */
ATOBEX_Terminate(GSM_StateMachine * s)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 
267 /**
268  * Dispatches message to correct dispatcher according to active protocol
269  */
ATOBEX_DispatchMessage(GSM_StateMachine * s)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 
280 /**
281  * We receive product code over AT commands, so we can easily use it
282  */
ATOBEX_GetProductCode(GSM_StateMachine * s,char * value)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 
290 /**
291  * \defgroup SEAT Wrapper functions for using AT module functionality
292  * \ingroup SEPhone
293  * @{
294  */
295 
ATOBEX_GetIMEI(GSM_StateMachine * s)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 
ATOBEX_GetFirmware(GSM_StateMachine * s)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 
ATOBEX_GetModel(GSM_StateMachine * s)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 
ATOBEX_GetDateTime(GSM_StateMachine * s,GSM_DateTime * date_time)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 
ATOBEX_GetSMS(GSM_StateMachine * s,GSM_MultiSMSMessage * sms)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 
ATOBEX_DeleteSMS(GSM_StateMachine * s,GSM_SMSMessage * sms)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 
ATOBEX_AddSMS(GSM_StateMachine * s,GSM_SMSMessage * sms)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 
ATOBEX_GetSignalStrength(GSM_StateMachine * s,GSM_SignalQuality * sig)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 
ATOBEX_GetSMSFolders(GSM_StateMachine * s,GSM_SMSFolders * folders)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 
ATOBEX_GetNextSMS(GSM_StateMachine * s,GSM_MultiSMSMessage * sms,gboolean start)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 
ATOBEX_GetSMSStatus(GSM_StateMachine * s,GSM_SMSMemoryStatus * status)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 
ATOBEX_DialVoice(GSM_StateMachine * s,char * number,GSM_CallShowNumber ShowNumber)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 
ATOBEX_DialService(GSM_StateMachine * s,char * number)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 
ATOBEX_AnswerCall(GSM_StateMachine * s,int ID,gboolean all)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 
ATOBEX_GetNetworkInfo(GSM_StateMachine * s,GSM_NetworkInfo * netinfo)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 
ATOBEX_GetDisplayStatus(GSM_StateMachine * s,GSM_DisplayFeatures * features)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 
ATOBEX_SetAutoNetworkLogin(GSM_StateMachine * s)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 
ATOBEX_PressKey(GSM_StateMachine * s,GSM_KeyCode Key,gboolean Press)432 GSM_Error ATOBEX_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
433 {
434 	GSM_Error error;
435 
436 	/**
437 	 * @todo Implement completely using AT*EKEY
438 	 */
439 	if ((error = ATOBEX_SetATMode(s))!= ERR_NONE) return error;
440 	return ATGEN_PressKey(s, Key, Press);
441 }
442 
ATOBEX_Reset(GSM_StateMachine * s,gboolean hard)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 
ATOBEX_CancelCall(GSM_StateMachine * s,int ID,gboolean all)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 
ATOBEX_SendSavedSMS(GSM_StateMachine * s,int Folder,int Location)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 
ATOBEX_SendSMS(GSM_StateMachine * s,GSM_SMSMessage * sms)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 
ATOBEX_SetDateTime(GSM_StateMachine * s,GSM_DateTime * date_time)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 
ATOBEX_SetSMSC(GSM_StateMachine * s,GSM_SMSC * smsc)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 
ATOBEX_GetSMSC(GSM_StateMachine * s,GSM_SMSC * smsc)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 
ATOBEX_EnterSecurityCode(GSM_StateMachine * s,GSM_SecurityCode * Code)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 
ATOBEX_GetSecurityStatus(GSM_StateMachine * s,GSM_SecurityCodeType * Status)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 
ATOBEX_ResetPhoneSettings(GSM_StateMachine * s,GSM_ResetSettingsType Type)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 
ATOBEX_SendDTMF(GSM_StateMachine * s,char * sequence)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 
ATOBEX_GetSIMIMSI(GSM_StateMachine * s,char * IMSI)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 
ATOBEX_SetIncomingCall(GSM_StateMachine * s,gboolean enable)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 
ATOBEX_SetIncomingCB(GSM_StateMachine * s,gboolean enable)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 
ATOBEX_SetIncomingSMS(GSM_StateMachine * s,gboolean enable)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 
ATOBEX_SetFastSMSSending(GSM_StateMachine * s,gboolean enable)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 
ATOBEX_GetManufacturer(GSM_StateMachine * s)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 
ATOBEX_GetAlarm(GSM_StateMachine * s,GSM_Alarm * Alarm)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 
ATOBEX_SetAlarm(GSM_StateMachine * s,GSM_Alarm * Alarm)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 
ATOBEX_SetIncomingUSSD(GSM_StateMachine * s,gboolean enable)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 
ATOBEX_GetRingtone(GSM_StateMachine * s,GSM_Ringtone * Ringtone,gboolean PhoneRingtone)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 
ATOBEX_SetRingtone(GSM_StateMachine * s,GSM_Ringtone * Ringtone,int * maxlength)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 
ATOBEX_SetPower(GSM_StateMachine * s,gboolean on)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 
ATOBEX_GetBitmap(GSM_StateMachine * s,GSM_Bitmap * Bitmap)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 
ATOBEX_SetBitmap(GSM_StateMachine * s,GSM_Bitmap * Bitmap)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 
643 /*@}*/
644 /**
645  * \defgroup SEOBEX OBEX native functions for filesystem
646  * \ingroup SEPhone
647  * @{
648  */
649 
ATOBEX_AddFilePart(GSM_StateMachine * s,GSM_File * File,size_t * Pos,int * Handle)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 
ATOBEX_SendFilePart(GSM_StateMachine * s,GSM_File * File,size_t * Pos,int * Handle)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 
ATOBEX_GetFilePart(GSM_StateMachine * s,GSM_File * File,int * Handle,size_t * Size)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 
ATOBEX_GetNextFileFolder(GSM_StateMachine * s,GSM_File * File,gboolean start)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 
ATOBEX_DeleteFile(GSM_StateMachine * s,unsigned char * ID)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 
ATOBEX_AddFolder(GSM_StateMachine * s,GSM_File * File)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 
716 /*@}*/
717 
ATOBEX_UseObex(GSM_StateMachine * s,GSM_MemoryType type)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 }
732 /**
733  * \defgroup SEATIrMC Mixed AT mode/IrMC functions
734  * \ingroup SEPhone
735  * @{
736  */
737 
ATOBEX_GetMemoryStatus(GSM_StateMachine * s,GSM_MemoryStatus * Status)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 
ATOBEX_GetMemory(GSM_StateMachine * s,GSM_MemoryEntry * entry)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 
ATOBEX_GetNextMemory(GSM_StateMachine * s,GSM_MemoryEntry * entry,gboolean start)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 
ATOBEX_SetMemory(GSM_StateMachine * s,GSM_MemoryEntry * entry)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 
ATOBEX_AddMemory(GSM_StateMachine * s,GSM_MemoryEntry * entry)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 
ATOBEX_DeleteMemory(GSM_StateMachine * s,GSM_MemoryEntry * entry)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 
ATOBEX_DeleteAllMemory(GSM_StateMachine * s,GSM_MemoryType type)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 
885 /*@}*/
886 /**
887  * \defgroup SEIrMC Native IrMC functions using OBEX connection
888  * \ingroup SEPhone
889  * @{
890  */
891 
ATOBEX_GetToDoStatus(GSM_StateMachine * s,GSM_ToDoStatus * status)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 
ATOBEX_GetToDo(GSM_StateMachine * s,GSM_ToDoEntry * ToDo)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 
ATOBEX_GetNextToDo(GSM_StateMachine * s,GSM_ToDoEntry * ToDo,gboolean start)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 
ATOBEX_DeleteAllToDo(GSM_StateMachine * s)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 
ATOBEX_AddToDo(GSM_StateMachine * s,GSM_ToDoEntry * ToDo)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 
ATOBEX_SetToDo(GSM_StateMachine * s,GSM_ToDoEntry * ToDo)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 
ATOBEX_DeleteToDo(GSM_StateMachine * s,GSM_ToDoEntry * ToDo)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 
ATOBEX_GetCalendarStatus(GSM_StateMachine * s,GSM_CalendarStatus * status)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 
ATOBEX_GetCalendar(GSM_StateMachine * s,GSM_CalendarEntry * Note)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 
ATOBEX_GetNextCalendar(GSM_StateMachine * s,GSM_CalendarEntry * Note,gboolean start)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 
ATOBEX_DeleteCalendar(GSM_StateMachine * s,GSM_CalendarEntry * Note)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 
ATOBEX_AddCalendar(GSM_StateMachine * s,GSM_CalendarEntry * Note)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 
ATOBEX_SetCalendar(GSM_StateMachine * s,GSM_CalendarEntry * Note)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 
ATOBEX_DeleteAllCalendar(GSM_StateMachine * s)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 
ATOBEX_GetNoteStatus(GSM_StateMachine * s,GSM_ToDoStatus * status)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 
ATOBEX_GetNote(GSM_StateMachine * s,GSM_NoteEntry * Note)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 
ATOBEX_GetNextNote(GSM_StateMachine * s,GSM_NoteEntry * Note,gboolean start)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 
ATOBEX_DeleteAllNotes(GSM_StateMachine * s)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 
ATOBEX_AddNote(GSM_StateMachine * s,GSM_NoteEntry * Note)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 
ATOBEX_SetNote(GSM_StateMachine * s,GSM_NoteEntry * Note)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 
ATOBEX_DeleteNote(GSM_StateMachine * s,GSM_NoteEntry * Note)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 
1145 /*@}*/
1146 /**
1147  * \defgroup SENativeAT Native AT mode functions
1148  * \ingroup SEPhone
1149  * @{
1150  */
1151 
1152 /**
1153  * \author Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar
1154  *
1155  * License: Whatever the current maintainer of gammulib chooses, as long as there
1156  * is an easy way to obtain the source under GPL, otherwise the author's parts
1157  * of this function are GPL 2.0.
1158  */
ATOBEX_ReplyGetDateLocale(GSM_Protocol_Message * msg,GSM_StateMachine * s)1159 GSM_Error ATOBEX_ReplyGetDateLocale(GSM_Protocol_Message *msg, GSM_StateMachine *s)
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 
1203 /**
1204  * \author Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar
1205  *
1206  * License: Whatever the current maintainer of gammulib chooses, as long as there
1207  * is an easy way to obtain the source under GPL, otherwise the author's parts
1208  * of this function are GPL 2.0.
1209  */
ATOBEX_ReplyGetTimeLocale(GSM_Protocol_Message * msg,GSM_StateMachine * s)1210 GSM_Error ATOBEX_ReplyGetTimeLocale(GSM_Protocol_Message *msg, GSM_StateMachine *s)
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 
1231 /**
1232  * \author Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar
1233  *
1234  * License: Whatever the current maintainer of gammulib chooses, as long as there
1235  * is an easy way to obtain the source under GPL, otherwise the author's parts
1236  * of this function are GPL 2.0.
1237  */
ATOBEX_GetLocale(GSM_StateMachine * s,GSM_Locale * locale)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 
1255 /**
1256  * \author Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar
1257  *
1258  * License: Whatever the current maintainer of gammulib chooses, as long as there
1259  * is an easy way to obtain the source under GPL, otherwise the author's parts
1260  * of this function are GPL 2.0.
1261  */
ATOBEX_SetLocale(GSM_StateMachine * s,GSM_Locale * locale)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 
ATOBEX_ReplyGetFileSystemStatus(GSM_Protocol_Message * msg,GSM_StateMachine * s)1292 GSM_Error ATOBEX_ReplyGetFileSystemStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
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",
1301 					&s->Phone.Data.FileSystemStatus->Free,
1302 					&s->Phone.Data.FileSystemStatus->Used,
1303 					&s->Phone.Data.FileSystemStatus->UsedImages,
1304 					&s->Phone.Data.FileSystemStatus->UsedSounds,
1305 					&s->Phone.Data.FileSystemStatus->UsedThemes
1306 					);
1307 
1308 			if (error == ERR_NONE) {
1309 				/* This is actually total */
1310 				s->Phone.Data.FileSystemStatus->Used -= s->Phone.Data.FileSystemStatus->Free;
1311 				return ERR_NONE;
1312 			}
1313 
1314 			return error;
1315 		default:
1316 			return ERR_NOTSUPPORTED;
1317 	}
1318 }
1319 
ATOBEX_GetFileSystemStatus(GSM_StateMachine * s,GSM_FileSystemStatus * Status)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 
ATOBEX_ReplyGetBatteryCharge(GSM_Protocol_Message * msg,GSM_StateMachine * s)1331 GSM_Error ATOBEX_ReplyGetBatteryCharge(GSM_Protocol_Message *msg, GSM_StateMachine *s)
1332 {
1333 	int tmp, ncapacity, method, state;
1334 	int vbat1, vbat2, vbat3, vbat4;
1335 	GSM_Error error;
1336 	GSM_BatteryCharge *bat = s->Phone.Data.BatteryCharge;
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:
1370 				bat->BatteryType = GSM_BatteryLiPol;
1371 				break;
1372 			case 1:
1373 				bat->BatteryType = GSM_BatteryLiIon;
1374 				break;
1375 			case 2:
1376 				bat->BatteryType = GSM_BatteryNiMH;
1377 				break;
1378 			default:
1379 				bat->BatteryType = GSM_BatteryUnknown;
1380 				break;
1381 		}
1382 		switch (state) {
1383 			case 7:
1384 				bat->ChargeState = GSM_BatteryPowered;
1385 				break;
1386 			case 2:
1387 				bat->ChargeState = GSM_BatteryCharging;
1388 				break;
1389 			case 0:
1390 			case 3:
1391 			case 4:
1392 			case 5:
1393 			case 15:
1394 				bat->ChargeState = GSM_BatteryConnected;
1395 				break;
1396 			case 8:
1397 				bat->ChargeState = GSM_BatteryFull;
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:
1451 				bat->BatteryType = GSM_BatteryNiMH;
1452 				break;
1453 			case 1:
1454 				bat->BatteryType = GSM_BatteryLiIon;
1455 				break;
1456 			case 2:
1457 			default:
1458 				bat->BatteryType = GSM_BatteryUnknown;
1459 				break;
1460 		}
1461 		switch (state) {
1462 			case 3:
1463 				bat->ChargeState = GSM_BatteryPowered;
1464 				break;
1465 			case 0:
1466 			case 1:
1467 			case 2:
1468 				bat->ChargeState = GSM_BatteryCharging;
1469 				break;
1470 			case 4:
1471 			case 5:
1472 			case 6:
1473 			case 7:
1474 			case 8:
1475 				bat->ChargeState = GSM_BatteryFull;
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 
ATOBEX_GetBatteryCharge(GSM_StateMachine * s,GSM_BatteryCharge * bat)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 
1535 /*@}*/
1536 
1537 
1538 GSM_Phone_Functions ATOBEXPhone = {
1539 	/* There is much more SE phones which support this! */
1540 	"sonyericsson|ericsson|atobex",
1541 	ATGENReplyFunctions,
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 /*@}*/
1687 /*@}*/
1688 
1689 /* How should editor hadle tabs in this file? Add editor commands here.
1690  * vim: noexpandtab sw=8 ts=8 sts=8:
1691  */
1692