Gammu internals  1.38.0
gsmstate.h
Go to the documentation of this file.
1 /* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */
2 
15 #ifndef __gsm_state_h
16 #define __gsm_state_h
17 
18 #include <time.h>
19 
20 #include <gammu-file.h>
21 #include <gammu-info.h>
22 #include <gammu-config.h>
23 #include <gammu-keys.h>
24 #include <gammu-security.h>
25 #include <gammu-callback.h>
26 #include <gammu-settings.h>
27 #include <gammu-misc.h>
28 #include <gammu-category.h>
29 #include <gammu-backup.h>
30 #include <string.h>
31 
32 typedef struct _GSM_User GSM_User;
33 
34 #ifdef GSM_ENABLE_NOKIA3650
35 # include "phone/nokia/wd2/n3650.h"
36 #endif
37 #ifdef GSM_ENABLE_NOKIA650
38 # include "phone/nokia/dct3/n0650.h"
39 #endif
40 #ifdef GSM_ENABLE_NOKIA6110
41 # include "phone/nokia/dct3/n6110.h"
42 #endif
43 #ifdef GSM_ENABLE_NOKIA3320
45 #endif
46 #ifdef GSM_ENABLE_NOKIA6510
48 #endif
49 #ifdef GSM_ENABLE_NOKIA7110
50 # include "phone/nokia/dct3/n7110.h"
51 #endif
52 #ifdef GSM_ENABLE_NOKIA9210
53 # include "phone/nokia/dct3/n9210.h"
54 #endif
55 #ifdef GSM_ENABLE_ATGEN
56 # include "phone/at/atgen.h"
57 #endif
58 #ifdef GSM_ENABLE_ALCATEL
59 # include "phone/alcatel/alcatel.h"
60 #endif
61 #ifdef GSM_ENABLE_ATOBEX
62 # include "phone/atobex/atobex.h"
63 #endif
64 #ifdef GSM_ENABLE_OBEXGEN
65 # include "phone/obex/obexgen.h"
66 #endif
67 #ifdef GSM_ENABLE_GNAPGEN
68 # include "phone/symbian/gnapgen.h"
69 #endif
70 #ifdef GSM_ENABLE_S60
71 # include "phone/s60/s60phone.h"
72 #endif
73 # include "phone/dummy/dummy.h"
74 
75 #ifndef GSM_USED_MBUS2
76 # undef GSM_ENABLE_MBUS2
77 #endif
78 #ifndef GSM_USED_FBUS2
79 # undef GSM_ENABLE_FBUS2
80 #endif
81 #ifndef GSM_USED_FBUS2DLR3
82 # undef GSM_ENABLE_FBUS2DLR3
83 #endif
84 #ifndef GSM_USED_DKU2PHONET
85 # undef GSM_ENABLE_DKU2PHONET
86 #endif
87 #ifndef GSM_USED_DKU2AT
88 # undef GSM_ENABLE_DKU2AT
89 #endif
90 #ifndef GSM_USED_DKU5FBUS2
91 # undef GSM_ENABLE_DKU5FBUS2
92 #endif
93 #ifndef GSM_USED_FBUS2PL2303
94 # undef GSM_ENABLE_FBUS2PL2303
95 #endif
96 #ifndef GSM_USED_FBUS2BLUE
97 # undef GSM_ENABLE_FBUS2BLUE
98 #endif
99 #ifndef GSM_USED_FBUS2IRDA
100 # undef GSM_ENABLE_FBUS2IRDA
101 #endif
102 #ifndef GSM_USED_PHONETBLUE
103 # undef GSM_ENABLE_PHONETBLUE
104 #endif
105 #ifndef GSM_USED_AT
106 # undef GSM_ENABLE_AT
107 #endif
108 #ifndef GSM_USED_ALCABUS
109 # undef GSM_ENABLE_ALCABUS
110 #endif
111 #ifndef GSM_USED_IRDAPHONET
112 # undef GSM_ENABLE_IRDAPHONET
113 #endif
114 #ifndef GSM_USED_IRDAAT
115 # undef GSM_ENABLE_IRDAAT
116 #endif
117 #ifndef GSM_USED_IRDAOBEX
118 # undef GSM_ENABLE_IRDAOBEX
119 #endif
120 #ifndef GSM_USED_BLUEFBUS2
121 # undef GSM_ENABLE_BLUEFBUS2
122 #endif
123 #ifndef GSM_USED_BLUEOBEX
124 # undef GSM_ENABLE_BLUEOBEX
125 #endif
126 #ifndef GSM_USED_BLUEPHONET
127 # undef GSM_ENABLE_BLUEPHONET
128 #endif
129 #ifndef GSM_USED_BLUEAT
130 # undef GSM_ENABLE_BLUEAT
131 #endif
132 #ifndef GSM_USED_BLUEGNAPBUS
133 # undef GSM_ENABLE_BLUEGNAPBUS
134 #endif
135 
136 #include "protocol/protocol.h"
137 #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_DKU5FBUS2) || defined(GSM_ENABLE_FBUS2PL2303)
138 # include "protocol/nokia/fbus2.h"
139 #endif
140 #ifdef GSM_ENABLE_MBUS2
141 # include "protocol/nokia/mbus2.h"
142 #endif
143 #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) || defined(GSM_ENABLE_DKU2PHONET)
144 # include "protocol/nokia/phonet.h"
145 #endif
146 #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) || defined(GSM_ENABLE_DKU2AT)
147 # include "protocol/at/at.h"
148 #endif
149 #ifdef GSM_ENABLE_ALCABUS
150 # include "protocol/alcatel/alcabus.h"
151 #endif
152 #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_ATOBEX)
153 # include "protocol/obex/obex.h"
154 #endif
155 #if defined(GSM_ENABLE_BLUEGNAPBUS) || defined(GSM_ENABLE_IRDAGNAPBUS)
156 # include "protocol/symbian/gnapbus.h"
157 #endif
158 #if defined(GSM_ENABLE_S60)
159 # include "protocol/s60/s60.h"
160 #endif
161 
162 #define GSM_ENABLE_SERIALDEVICE
163 #ifndef GSM_USED_SERIALDEVICE
164 # undef GSM_ENABLE_SERIALDEVICE
165 #endif
166 #ifdef LIBUSB_FOUND
167 #define GSM_ENABLE_USBDEVICE
168 #endif
169 #ifndef GSM_USED_USBDEVICE
170 # undef GSM_ENABLE_USBDEVICE
171 #endif
172 #define GSM_ENABLE_IRDADEVICE
173 #ifndef GSM_USED_IRDADEVICE
174 # undef GSM_ENABLE_IRDADEVICE
175 #endif
176 #if defined(BLUEZ_FOUND) || defined(BSD_BLUE_FOUND) || defined(OSX_BLUE_FOUND) || defined(WIN32)
177 # define GSM_ENABLE_BLUETOOTHDEVICE
178 #endif
179 #ifndef GSM_USED_BLUETOOTHDEVICE
180 # undef GSM_ENABLE_BLUETOOTHDEVICE
181 #endif
182 
183 #ifdef DJGPP
184 # undef GSM_ENABLE_IRDADEVICE
185 # undef GSM_ENABLE_IRDAPHONET
186 # undef GSM_ENABLE_IRDAOBEX
187 # undef GSM_ENABLE_IRDAAT
188 # undef GSM_ENABLE_IRDAGNAPBUS
189 # undef GSM_ENABLE_DKU2AT
190 # undef GSM_ENABLE_FBUS2IRDA
191 # undef GSM_ENABLE_BLUETOOTHDEVICE
192 # undef GSM_ENABLE_BLUEPHONET
193 # undef GSM_ENABLE_BLUEOBEX
194 # undef GSM_ENABLE_BLUEAT
195 # undef GSM_ENABLE_BLUEFBUS2
196 # undef GSM_ENABLE_BLUEGNAPBUS
197 # undef GSM_ENABLE_PHONETBLUE
198 # undef GSM_ENABLE_FBUS2BLUE
199 #endif
200 
201 #ifdef GSM_ENABLE_SERIALDEVICE
202 # include "device/serial/ser_w32.h"
203 # include "device/serial/ser_unx.h"
204 # include "device/serial/ser_djg.h"
205 #endif
206 #ifdef GSM_ENABLE_USBDEVICE
207 # include "device/usb/usb.h"
208 #endif
209 #ifdef GSM_ENABLE_IRDADEVICE
210 # include "device/irda/irda.h"
211 #endif
212 #ifdef GSM_ENABLE_BLUETOOTHDEVICE
214 #endif
215 #ifndef WIN32
216 # include "device/proxy/proxy.h"
217 #endif
218 
219 #include "debug.h"
220 #include "gsmreply.h"
221 
222 
223 /* ------------------------- Device layer ---------------------------------- */
224 
228 typedef struct {
232  GSM_Error (*OpenDevice) (GSM_StateMachine *s);
236  GSM_Error (*CloseDevice) (GSM_StateMachine *s);
240  GSM_Error (*DeviceSetParity) (GSM_StateMachine *s, gboolean parity);
244  GSM_Error (*DeviceSetDtrRts) (GSM_StateMachine *s, gboolean dtr, gboolean rts);
248  GSM_Error (*DeviceSetSpeed) (GSM_StateMachine *s, int speed);
252  int (*ReadDevice) (GSM_StateMachine *s, void *buf, size_t nbytes);
256  int (*WriteDevice) (GSM_StateMachine *s, const void *buf, size_t nbytes);
258 
259 #ifdef GSM_ENABLE_SERIALDEVICE
260 
263 extern GSM_Device_Functions SerialDevice;
264 #endif
265 #ifdef GSM_ENABLE_IRDADEVICE
266 
269 extern GSM_Device_Functions IrdaDevice;
270 #endif
271 #ifdef GSM_ENABLE_BLUETOOTHDEVICE
272 
275 extern GSM_Device_Functions BlueToothDevice;
276 #endif
277 #ifdef GSM_ENABLE_USBDEVICE
278 
281 extern GSM_Device_Functions FBUSUSBDevice;
282 #endif
283 #ifndef WIN32
284 
288 #endif
289 
295 typedef struct {
296  union {
300  char fake;
301 #ifdef GSM_ENABLE_SERIALDEVICE
302 
305  GSM_Device_SerialData Serial;
306 #endif
307 #ifdef GSM_ENABLE_IRDADEVICE
308 
311  GSM_Device_IrdaData Irda;
312 #endif
313 #ifdef GSM_ENABLE_BLUETOOTHDEVICE
314 
317  GSM_Device_BlueToothData BlueTooth;
318 #endif
319 #ifdef GSM_ENABLE_USBDEVICE
320 
323  GSM_Device_USBData USB;
324 #endif
325 #ifndef WIN32
326 
330 #endif
331  } Data;
336 } GSM_Device;
337 
338 /* ---------------------- Protocol layer ----------------------------------- */
339 
343 typedef struct {
347  GSM_Error (*WriteMessage) (GSM_StateMachine *s, unsigned const char *buffer,
348  int length, int type);
352  GSM_Error (*StateMachine) (GSM_StateMachine *s, unsigned char rx_char);
356  GSM_Error (*Initialise) (GSM_StateMachine *s);
360  GSM_Error (*Terminate) (GSM_StateMachine *s);
362 
363 #ifdef GSM_ENABLE_MBUS2
364  extern GSM_Protocol_Functions MBUS2Protocol;
365 #endif
366 #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_DKU5FBUS2) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2PL2303)
367  extern GSM_Protocol_Functions FBUS2Protocol;
368 #endif
369 #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) || defined(GSM_ENABLE_DKU2PHONET)
370  extern GSM_Protocol_Functions PHONETProtocol;
371 #endif
372 #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) || defined(GSM_ENABLE_DKU2AT)
373  extern GSM_Protocol_Functions ATProtocol;
374 #endif
375 #ifdef GSM_ENABLE_ALCABUS
376  extern GSM_Protocol_Functions ALCABUSProtocol;
377 #endif
378 #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_ATOBEX)
379  extern GSM_Protocol_Functions OBEXProtocol;
380 #endif
381 #if defined(GSM_ENABLE_BLUEGNAPBUS) || defined(GSM_ENABLE_IRDAGNAPBUS)
382  extern GSM_Protocol_Functions GNAPBUSProtocol;
383 #endif
384 #if defined(GSM_ENABLE_S60)
385  extern GSM_Protocol_Functions S60Protocol;
386 #endif
387 
393 typedef struct {
394  struct {
395  char fake;
396 #ifdef GSM_ENABLE_MBUS2
398 #endif
399 #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_DKU5FBUS2) || defined(GSM_ENABLE_FBUS2PL2303) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2)
401 #endif
402 #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET) || defined(GSM_ENABLE_DKU2PHONET)
404 #endif
405 #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT) || defined(GSM_ENABLE_DKU2AT)
407 #endif
408 #ifdef GSM_ENABLE_ALCABUS
409  GSM_Protocol_ALCABUSData ALCABUS;
410 #endif
411 #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_ATOBEX)
413 #endif
414 #if defined(GSM_ENABLE_BLUEGNAPBUS) || defined(GSM_ENABLE_IRDAGNAPBUS)
415  GSM_Protocol_GNAPBUSData GNAPBUS;
416 #endif
417 #if defined(GSM_ENABLE_S60)
419 #endif
420  } Data;
425 } GSM_Protocol;
426 
427 /* -------------------------- Phone layer ---------------------------------- */
428 
429 
433 typedef struct {
437  char IMEI[GSM_MAX_IMEI_LENGTH + 1];
441  char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH + 1];
445  char Model[GSM_MAX_MODEL_LENGTH + 1];
454  char Version[GSM_MAX_VERSION_LENGTH + 1];
458  char VerDate[GSM_MAX_VERSION_DATE_LENGTH + 1];
462  double VerNum;
466  char HardwareCache[50];
470  char ProductCodeCache[50];
471 
477 
525  size_t *VoiceRecord;
529  int CallID;
561  unsigned char *SecurityCode;
577  unsigned char *Netmonitor;
629  unsigned char *PhoneString;
655 
672 
690 
694  struct {
695 #ifdef GSM_ENABLE_NOKIA3320
696  GSM_Phone_N3320Data N3320;
697 #endif
698 #ifdef GSM_ENABLE_NOKIA3650
699  GSM_Phone_N3650Data N3650;
700 #endif
701 #ifdef GSM_ENABLE_NOKIA650
702  GSM_Phone_N650Data N650;
703 #endif
704 #ifdef GSM_ENABLE_NOKIA6110
705  GSM_Phone_N6110Data N6110;
706 #endif
707 #ifdef GSM_ENABLE_NOKIA6510
708  GSM_Phone_N6510Data N6510;
709 #endif
710 #ifdef GSM_ENABLE_NOKIA7110
711  GSM_Phone_N7110Data N7110;
712 #endif
713 #ifdef GSM_ENABLE_ATGEN
714  GSM_Phone_ATGENData ATGEN;
715 #endif
716 #ifdef GSM_ENABLE_ALCATEL
717  GSM_Phone_ALCATELData ALCATEL;
718 #endif
719 #ifdef GSM_ENABLE_ATOBEX
720  GSM_Phone_ATOBEXData ATOBEX;
721 #endif
722 #ifdef GSM_ENABLE_OBEXGEN
723  GSM_Phone_OBEXGENData OBEXGEN;
724 #endif
725 #ifdef GSM_ENABLE_GNAPGEN
726  GSM_Phone_GNAPGENData GNAPGEN;
727 #endif
728 #ifdef GSM_ENABLE_S60
729  GSM_Phone_S60Data S60;
730 #endif
732  } Priv;
734 
738 typedef struct {
743  const char *models;
752  GSM_Error (*Install) (GSM_StateMachine *s, const char *ExtraPath, gboolean Minimal);
756  GSM_Error (*Initialise) (GSM_StateMachine *s);
760  GSM_Error (*Terminate) (GSM_StateMachine *s);
765  GSM_Error (*DispatchMessage) (GSM_StateMachine *s);
769  GSM_Error (*ShowStartInfo) (GSM_StateMachine *s, gboolean enable);
773  GSM_Error (*GetManufacturer) (GSM_StateMachine *s);
777  GSM_Error (*GetModel) (GSM_StateMachine *s);
781  GSM_Error (*GetFirmware) (GSM_StateMachine *s);
785  GSM_Error (*GetIMEI) (GSM_StateMachine *s);
789  GSM_Error (*GetOriginalIMEI) (GSM_StateMachine *s, char *value);
793  GSM_Error (*GetManufactureMonth)(GSM_StateMachine *s, char *value);
797  GSM_Error (*GetProductCode) (GSM_StateMachine *s, char *value);
801  GSM_Error (*GetHardware) (GSM_StateMachine *s, char *value);
806  GSM_Error (*GetPPM) (GSM_StateMachine *s, char *value);
810  GSM_Error (*GetSIMIMSI) (GSM_StateMachine *s, char *IMSI);
814  GSM_Error (*GetDateTime) (GSM_StateMachine *s, GSM_DateTime *date_time);
818  GSM_Error (*SetDateTime) (GSM_StateMachine *s, GSM_DateTime *date_time);
822  GSM_Error (*GetAlarm) (GSM_StateMachine *s, GSM_Alarm *Alarm);
826  GSM_Error (*SetAlarm) (GSM_StateMachine *s, GSM_Alarm *Alarm);
830  GSM_Error (*GetLocale) (GSM_StateMachine *s, GSM_Locale *locale);
834  GSM_Error (*SetLocale) (GSM_StateMachine *s, GSM_Locale *locale);
838  GSM_Error (*PressKey) (GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press);
842  GSM_Error (*Reset) (GSM_StateMachine *s, gboolean hard);
846  GSM_Error (*ResetPhoneSettings) (GSM_StateMachine *s, GSM_ResetSettingsType Type);
850  GSM_Error (*EnterSecurityCode) (GSM_StateMachine *s, GSM_SecurityCode *Code);
854  GSM_Error (*GetSecurityStatus) (GSM_StateMachine *s, GSM_SecurityCodeType *Status);
862  GSM_Error (*SetAutoNetworkLogin)(GSM_StateMachine *s);
866  GSM_Error (*GetBatteryCharge) (GSM_StateMachine *s, GSM_BatteryCharge *bat);
870  GSM_Error (*GetSignalQuality) (GSM_StateMachine *s, GSM_SignalQuality *sig);
874  GSM_Error (*GetNetworkInfo) (GSM_StateMachine *s, GSM_NetworkInfo *netinfo);
878  GSM_Error (*GetCategory) (GSM_StateMachine *s, GSM_Category *Category);
882  GSM_Error (*AddCategory) (GSM_StateMachine *s, GSM_Category *Category);
886  GSM_Error (*GetCategoryStatus) (GSM_StateMachine *s, GSM_CategoryStatus *Status);
891  GSM_Error (*GetMemoryStatus) (GSM_StateMachine *s, GSM_MemoryStatus *status);
896  GSM_Error (*GetMemory) (GSM_StateMachine *s, GSM_MemoryEntry *entry);
901  GSM_Error (*GetNextMemory) (GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start);
905  GSM_Error (*SetMemory) (GSM_StateMachine *s, GSM_MemoryEntry *entry);
909  GSM_Error (*AddMemory) (GSM_StateMachine *s, GSM_MemoryEntry *entry);
913  GSM_Error (*DeleteMemory) (GSM_StateMachine *s, GSM_MemoryEntry *entry);
917  GSM_Error (*DeleteAllMemory) (GSM_StateMachine *s, GSM_MemoryType MemoryType);
921  GSM_Error (*GetSpeedDial) (GSM_StateMachine *s, GSM_SpeedDial *Speed);
925  GSM_Error (*SetSpeedDial) (GSM_StateMachine *s, GSM_SpeedDial *Speed);
929  GSM_Error (*GetSMSC) (GSM_StateMachine *s, GSM_SMSC *smsc);
933  GSM_Error (*SetSMSC) (GSM_StateMachine *s, GSM_SMSC *smsc);
938  GSM_Error (*GetSMSStatus) (GSM_StateMachine *s, GSM_SMSMemoryStatus *status);
947  GSM_Error (*GetNextSMS) (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start);
959  GSM_Error (*DeleteSMS) (GSM_StateMachine *s, GSM_SMSMessage *sms);
967  GSM_Error (*SendSavedSMS) (GSM_StateMachine *s, int Folder, int Location);
971  GSM_Error (*SetFastSMSSending) (GSM_StateMachine *s, gboolean enable);
975  GSM_Error (*SetIncomingSMS) (GSM_StateMachine *s, gboolean enable);
979  GSM_Error (*SetIncomingCB) (GSM_StateMachine *s, gboolean enable);
983  GSM_Error (*GetSMSFolders) (GSM_StateMachine *s, GSM_SMSFolders *folders);
987  GSM_Error (*AddSMSFolder) (GSM_StateMachine *s, unsigned char *name);
991  GSM_Error (*DeleteSMSFolder) (GSM_StateMachine *s, int ID);
995  GSM_Error (*DialVoice) (GSM_StateMachine *s, char *Number, GSM_CallShowNumber ShowNumber);
999  GSM_Error (*DialService) (GSM_StateMachine *s, char *Number);
1003  GSM_Error (*AnswerCall) (GSM_StateMachine *s, int ID, gboolean all);
1007  GSM_Error (*CancelCall) (GSM_StateMachine *s, int ID, gboolean all);
1011  GSM_Error (*HoldCall) (GSM_StateMachine *s, int ID);
1015  GSM_Error (*UnholdCall) (GSM_StateMachine *s, int ID);
1019  GSM_Error (*ConferenceCall) (GSM_StateMachine *s, int ID);
1023  GSM_Error (*SplitCall) (GSM_StateMachine *s, int ID);
1027  GSM_Error (*TransferCall) (GSM_StateMachine *s, int ID, gboolean next);
1031  GSM_Error (*SwitchCall) (GSM_StateMachine *s, int ID, gboolean next);
1035  GSM_Error (*GetCallDivert) (GSM_StateMachine *s, GSM_CallDivert *request, GSM_MultiCallDivert *result);
1039  GSM_Error (*SetCallDivert) (GSM_StateMachine *s, GSM_CallDivert *divert);
1043  GSM_Error (*CancelAllDiverts) (GSM_StateMachine *s);
1047  GSM_Error (*SetIncomingCall) (GSM_StateMachine *s, gboolean enable);
1051  GSM_Error (*SetIncomingUSSD) (GSM_StateMachine *s, gboolean enable);
1055  GSM_Error (*SendDTMF) (GSM_StateMachine *s, char *sequence);
1059  GSM_Error (*GetRingtone) (GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone);
1063  GSM_Error (*SetRingtone) (GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength);
1067  GSM_Error (*GetRingtonesInfo) (GSM_StateMachine *s, GSM_AllRingtonesInfo *Info);
1071  GSM_Error (*DeleteUserRingtones)(GSM_StateMachine *s);
1075  GSM_Error (*PlayTone) (GSM_StateMachine *s, int Herz, unsigned char Volume, gboolean start);
1079  GSM_Error (*GetWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
1083  GSM_Error (*SetWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
1087  GSM_Error (*DeleteWAPBookmark) (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
1091  GSM_Error (*GetWAPSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1095  GSM_Error (*SetWAPSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1099  GSM_Error (*GetSyncMLSettings) (GSM_StateMachine *s, GSM_SyncMLSettings *settings);
1103  GSM_Error (*SetSyncMLSettings) (GSM_StateMachine *s, GSM_SyncMLSettings *settings);
1107  GSM_Error (*GetChatSettings) (GSM_StateMachine *s, GSM_ChatSettings *settings);
1111  GSM_Error (*SetChatSettings) (GSM_StateMachine *s, GSM_ChatSettings *settings);
1115  GSM_Error (*GetMMSSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1119  GSM_Error (*SetMMSSettings) (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
1123  GSM_Error (*GetMMSFolders) (GSM_StateMachine *s, GSM_MMSFolders *folders);
1127  GSM_Error (*GetNextMMSFileInfo) (GSM_StateMachine *s, unsigned char *FileID, int *MMSFolder, gboolean start);
1131  GSM_Error (*GetBitmap) (GSM_StateMachine *s, GSM_Bitmap *Bitmap);
1135  GSM_Error (*SetBitmap) (GSM_StateMachine *s, GSM_Bitmap *Bitmap);
1139  GSM_Error (*GetToDoStatus) (GSM_StateMachine *s, GSM_ToDoStatus *status);
1143  GSM_Error (*GetToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1147  GSM_Error (*GetNextToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo, gboolean start);
1151  GSM_Error (*SetToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1155  GSM_Error (*AddToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1159  GSM_Error (*DeleteToDo) (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
1163  GSM_Error (*DeleteAllToDo) (GSM_StateMachine *s);
1167  GSM_Error (*GetCalendarStatus) (GSM_StateMachine *s, GSM_CalendarStatus *Status);
1171  GSM_Error (*GetCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note);
1176  GSM_Error (*GetNextCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start);
1180  GSM_Error (*SetCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note);
1184  GSM_Error (*AddCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note);
1188  GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note);
1192  GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s);
1196  GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings);
1200  GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings);
1204  GSM_Error (*GetNotesStatus) (GSM_StateMachine *s, GSM_ToDoStatus *status);
1208  GSM_Error (*GetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1213  GSM_Error (*GetNextNote) (GSM_StateMachine *s, GSM_NoteEntry *Note, gboolean start);
1217  GSM_Error (*SetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1221  GSM_Error (*AddNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1225  GSM_Error (*DeleteNote) (GSM_StateMachine *s, GSM_NoteEntry *Note);
1229  GSM_Error (*DeleteAllNotes) (GSM_StateMachine *s);
1233  GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile);
1237  GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile);
1241  GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation);
1245  GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation);
1249  GSM_Error (*ClearFMStations) (GSM_StateMachine *s);
1253  GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, gboolean start);
1257  GSM_Error (*GetFolderListing) (GSM_StateMachine *s, GSM_File *File, gboolean start);
1261  GSM_Error (*GetNextRootFolder) (GSM_StateMachine *s, GSM_File *File);
1265  GSM_Error (*SetFileAttributes) (GSM_StateMachine *s, GSM_File *File);
1269  GSM_Error (*GetFilePart) (GSM_StateMachine *s, GSM_File *File, int *Handle, size_t *Size);
1273  GSM_Error (*AddFilePart) (GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle);
1277  GSM_Error (*SendFilePart) (GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle);
1281  GSM_Error (*GetFileSystemStatus)(GSM_StateMachine *s, GSM_FileSystemStatus *Status);
1285  GSM_Error (*DeleteFile) (GSM_StateMachine *s, unsigned char *ID);
1289  GSM_Error (*AddFolder) (GSM_StateMachine *s, GSM_File *File);
1293  GSM_Error (*DeleteFolder) (GSM_StateMachine *s, unsigned char *ID);
1297  GSM_Error (*GetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point);
1301  GSM_Error (*SetGPRSAccessPoint) (GSM_StateMachine *s, GSM_GPRSAccessPoint *point);
1305  GSM_Error (*GetScreenshot) (GSM_StateMachine *s, GSM_BinaryPicture *picture);
1309  GSM_Error (*SetPower) (GSM_StateMachine *s, gboolean on);
1313  GSM_Error (*PostConnect) (GSM_StateMachine *s);
1317  GSM_Error (*PreAPICall)(GSM_StateMachine *s);
1319 
1321 #ifdef GSM_ENABLE_NOKIA3320
1322  extern GSM_Phone_Functions N3320Phone;
1323 #endif
1324 #ifdef GSM_ENABLE_NOKIA3650
1325  extern GSM_Phone_Functions N3650Phone;
1326 #endif
1327 #ifdef GSM_ENABLE_NOKIA6110
1328  extern GSM_Phone_Functions N6110Phone;
1329 #endif
1330 #ifdef GSM_ENABLE_NOKIA650
1331  extern GSM_Phone_Functions N650Phone;
1332 #endif
1333 #ifdef GSM_ENABLE_NOKIA6510
1334  extern GSM_Phone_Functions N6510Phone;
1335 #endif
1336 #ifdef GSM_ENABLE_NOKIA7110
1337  extern GSM_Phone_Functions N7110Phone;
1338 #endif
1339 #ifdef GSM_ENABLE_NOKIA9210
1340  extern GSM_Phone_Functions N9210Phone;
1341 #endif
1342 #ifdef GSM_ENABLE_ATGEN
1343  extern GSM_Phone_Functions ATGENPhone;
1344 #endif
1345 #ifdef GSM_ENABLE_ALCATEL
1346  extern GSM_Phone_Functions ALCATELPhone;
1347 #endif
1348 #ifdef GSM_ENABLE_ATOBEX
1349  extern GSM_Phone_Functions ATOBEXPhone;
1350 #endif
1351 #ifdef GSM_ENABLE_OBEXGEN
1352  extern GSM_Phone_Functions OBEXGENPhone;
1353 #endif
1354 #ifdef GSM_ENABLE_GNAPGEN
1355  extern GSM_Phone_Functions GNAPGENPhone;
1356 #endif
1357 #ifdef GSM_ENABLE_S60
1358  extern GSM_Phone_Functions S60Phone;
1359 #endif
1361 
1365 typedef struct {
1374 } GSM_Phone;
1375 
1376 /* --------------------------- User layer ---------------------------------- */
1377 
1378 struct _GSM_User {
1380 
1391 };
1392 
1393 /* --------------------------- Statemachine layer -------------------------- */
1394 
1395 
1399 #define MAX_CONFIG_NUM 5
1400 
1411  char *LockFile;
1417  int ReplyNum;
1418  int Speed;
1423  volatile gboolean Abort;
1427  volatile size_t MessagesCount;
1428 
1433 };
1434 
1435 /* ------------------------ Other general definitions ---------------------- */
1436 
1445 
1446 GSM_Error GSM_WaitForOnce (GSM_StateMachine *s, unsigned const char *buffer,
1447  size_t length, int type, int timeout);
1448 
1461 GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned const char *buffer,
1462  size_t length, int type, int timeout,
1464 
1478 #define GSM_WaitForAutoLen(s,buffer,type,timeout,request) \
1479  GSM_WaitFor(s,buffer,strlen(buffer),type,timeout,request)
1480 
1482 
1483 void GSM_DumpMessageText (GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type);
1484 void GSM_DumpMessageTextRecv (GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type);
1485 void GSM_DumpMessageBinary (GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type);
1486 void GSM_DumpMessageBinaryRecv(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type);
1487 
1488 
1489 void GSM_OSErrorInfo(GSM_StateMachine *s, const char *description);
1490 
1491 #endif
1492 
1494 /* How should editor hadle tabs in this file? Add editor commands here.
1495  * vim: noexpandtab sw=8 ts=8 sts=8:
1496  */
void GSM_DumpMessageBinary(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type)
Definition: gsmstate.c:1583
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
GSM_SecurityCodeType * SecurityStatus
Definition: gsmstate.h:601
gboolean EnableIncomingUSSD
Definition: gsmstate.h:671
unsigned char * Netmonitor
Definition: gsmstate.h:577
GSM_Device_ProxyData Proxy
Definition: gsmstate.h:329
IncomingUSSDCallback IncomingUSSD
Definition: gsmstate.h:1384
GSM_BinaryPicture * Picture
Definition: gsmstate.h:593
GSM_Alarm * Alarm
Definition: gsmstate.h:493
IncomingCBCallback IncomingCB
Definition: gsmstate.h:1383
void * IncomingCallUserData
Definition: gsmstate.h:1386
#define GSM_MAX_VERSION_LENGTH
Definition: gammu-limits.h:39
void * IncomingUSSDUserData
Definition: gsmstate.h:1389
int StartPhoneString
Definition: gsmstate.h:634
GSM_Phone_Functions NAUTOPhone
void GSM_DumpMessageTextRecv(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type)
Definition: gsmstate.c:1560
GSM_Reply_Function * UserReplyFunctions
Definition: gsmstate.h:1379
GSM_ConnectionType ConnectionType
Definition: gsmstate.h:1402
GSM_MemoryEntry * Memory
Definition: gsmstate.h:497
int StartInfoCounter
Definition: gsmstate.h:476
GSM_SMSMemoryStatus * SMSStatus
Definition: gsmstate.h:517
GSM_MultiSMSMessage * GetSMSMessage
Definition: gsmstate.h:509
GSM_CalendarSettings * CalendarSettings
Definition: gsmstate.h:625
GSM_ToDoEntry * ToDo
Definition: gsmstate.h:585
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
SendSMSStatusCallback SendSMSStatus
Definition: gsmstate.h:1385
GSM_Error GSM_DispatchMessage(GSM_StateMachine *s)
Definition: gsmstate.c:1131
gboolean EnableIncomingCB
Definition: gsmstate.h:667
GSM_Error
Definition: gammu-error.h:23
GSM_Error DispatchError
Definition: gsmstate.h:689
GSM_Debug_Info di
Definition: gsmstate.h:1412
GSM_CallShowNumber
Definition: gammu-call.h:192
GSM_NetworkInfo * NetworkInfo
Definition: gsmstate.h:541
void(* SendSMSStatusCallback)(GSM_StateMachine *s, int status, int MessageReference, void *user_data)
void * SendSMSStatusUserData
Definition: gsmstate.h:1390
gboolean EnableIncomingCall
Definition: gsmstate.h:659
GSM_Error GSM_WaitForOnce(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout)
Definition: gsmstate.c:986
GSM_ToDoStatus * ToDoStatus
Definition: gsmstate.h:557
GSM_Bitmap * Bitmap
Definition: gsmstate.h:573
const char features[]
Definition: feature_tests.c:2
#define GSM_MAX_MODEL_LENGTH
Definition: gammu-limits.h:31
GSM_CalendarStatus * CalStatus
Definition: gsmstate.h:553
GSM_FileSystemStatus * FileSystemStatus
Definition: gsmstate.h:646
GSM_File * File
Definition: gsmstate.h:642
GSM_ChatSettings * ChatSettings
Definition: gsmstate.h:650
GSM_Locale * Locale
Definition: gsmstate.h:621
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
volatile gboolean Abort
Definition: gsmstate.h:1423
#define GSM_MAX_IMEI_LENGTH
Definition: gammu-limits.h:53
GSM_SignalQuality * SignalQuality
Definition: gsmstate.h:533
#define GSM_MAX_VERSION_DATE_LENGTH
Definition: gammu-limits.h:46
void(* IncomingUSSDCallback)(GSM_StateMachine *s, GSM_USSDMessage *ussd, void *user_data)
GSM_ConnectionType
gboolean PressKey
Definition: gsmstate.h:597
int gboolean
Definition: gammu-types.h:23
GSM_MemoryType
Definition: gammu-memory.h:31
GSM_DateTime * DateTime
Definition: gsmstate.h:489
const char * models
Definition: gsmstate.h:743
GSM_Phone Phone
Definition: gsmstate.h:1431
void(* IncomingCallCallback)(GSM_StateMachine *s, GSM_Call *call, void *user_data)
GSM_Protocol_Message * SentMsg
Definition: gsmstate.h:680
GSM_SecurityCodeType
unsigned char * SecurityCode
Definition: gsmstate.h:561
GSM_FMStation * FMStation
Definition: gsmstate.h:617
GSM_MultiWAPSettings * WAPSettings
Definition: gsmstate.h:569
GSM_Error GSM_WaitFor(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout, GSM_Phone_RequestID request) WARNUNUSED
Definition: gsmstate.c:1029
#define MAX_CONFIG_NUM
Definition: gsmstate.h:1399
GSM_Ringtone * Ringtone
Definition: gsmstate.h:545
#define GSM_MAX_MANUFACTURER_LENGTH
Definition: gammu-limits.h:24
GSM_SyncMLSettings * SyncMLSettings
Definition: gsmstate.h:654
GSM_WAPBookmark * WAPBookmark
Definition: gsmstate.h:565
#define WARNUNUSED
Definition: gammu-misc.h:99
GSM_Phone_RequestID RequestID
Definition: gsmstate.h:685
void GSM_OSErrorInfo(GSM_StateMachine *s, const char *description)
Definition: gsmstate.c:1593
GSM_Device_Functions * Functions
Definition: gsmstate.h:335
IncomingCallCallback IncomingCall
Definition: gsmstate.h:1381
GSM_MultiCallDivert * Divert
Definition: gsmstate.h:581
GSM_AllRingtonesInfo * RingtonesInfo
Definition: gsmstate.h:609
gboolean opened
Definition: gsmstate.h:1413
GSM_Protocol Protocol
Definition: gsmstate.h:1430
void(* IncomingCBCallback)(GSM_StateMachine *s, GSM_CBMessage *cb, void *user_data)
GSM_BatteryCharge * BatteryCharge
Definition: gsmstate.h:537
GSM_Device_Functions ProxyDevice
Definition: proxy.c:212
void * IncomingCBUserData
Definition: gsmstate.h:1388
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_KeyCode
Definition: gammu-keys.h:30
GSM_SMSFolders * SMSFolders
Definition: gsmstate.h:521
double VerNum
Definition: gsmstate.h:462
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
gboolean NoPowerCable
Definition: gsmstate.h:1410
gboolean SkipDtrRts
Definition: gsmstate.h:1406
char fake
Definition: gsmstate.h:300
size_t * VoiceRecord
Definition: gsmstate.h:525
GSM_Phone_Functions DUMMYPhone
Definition: dummy.c:1964
void * IncomingSMSUserData
Definition: gsmstate.h:1387
GSM_SMSC * SMSC
Definition: gsmstate.h:505
GSM_Reply_Function * ReplyFunctions
Definition: gsmstate.h:748
GSM_Error GSM_RegisterAllPhoneModules(GSM_StateMachine *s)
Definition: gsmstate.c:383
void GSM_DumpMessageBinaryRecv(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type)
Definition: gsmstate.c:1588
GSM_Protocol_Functions * Functions
Definition: gsmstate.h:424
GSM_GPRSAccessPoint * GPRSPoint
Definition: gsmstate.h:481
GSM_MemoryStatus * MemoryStatus
Definition: gsmstate.h:501
GSM_SMSMessage * SaveSMSMessage
Definition: gsmstate.h:513
GSM_Profile * Profile
Definition: gsmstate.h:605
GSM_File * FileInfo
Definition: gsmstate.h:638
gboolean EnableIncomingSMS
Definition: gsmstate.h:663
GSM_DisplayFeatures * DisplayFeatures
Definition: gsmstate.h:613
GSM_NoteEntry * Note
Definition: gsmstate.h:589
GSM_Phone_RequestID
Definition: gsmreply.h:25
GSM_SpeedDial * SpeedDial
Definition: gsmstate.h:485
void(* IncomingSMSCallback)(GSM_StateMachine *s, GSM_SMSMessage *sms, void *user_data)
GSM_Protocol_Message * RequestMsg
Definition: gsmstate.h:676
volatile size_t MessagesCount
Definition: gsmstate.h:1427
IncomingSMSCallback IncomingSMS
Definition: gsmstate.h:1382
void GSM_DumpMessageText(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type)
Definition: gsmstate.c:1555
GSM_Device Device
Definition: gsmstate.h:1429
unsigned char * PhoneString
Definition: gsmstate.h:629
GSM_ResetSettingsType
GSM_CalendarEntry * Cal
Definition: gsmstate.h:549