2 #ifndef gsm_statemachine_h
3 #define gsm_statemachine_h
10 #ifdef GSM_ENABLE_NOKIA3650
11 # include "phone/nokia/dct4/n3650.h"
13 #ifdef GSM_ENABLE_NOKIA6110
14 # include "phone/nokia/dct3/n6110.h"
16 #ifdef GSM_ENABLE_NOKIA6510
17 # include "phone/nokia/dct4/n6510.h"
19 #ifdef GSM_ENABLE_NOKIA7110
20 # include "phone/nokia/dct3/n7110.h"
22 #ifdef GSM_ENABLE_NOKIA9210
23 # include "phone/nokia/dct3/n9210.h"
25 #ifdef GSM_ENABLE_ATGEN
26 # include "phone/at/atgen.h"
28 #ifdef GSM_ENABLE_ALCATEL
29 # include "phone/alcatel/alcatel.h"
31 #ifdef GSM_ENABLE_OBEXGEN
32 # include "phone/obex/obexgen.h"
34 #ifdef GSM_ENABLE_MROUTERGEN
35 # include "phone/symbian/mroutgen.h"
38 #ifndef GSM_USED_MBUS2
39 # undef GSM_ENABLE_MBUS2
41 #ifndef GSM_USED_FBUS2
42 # undef GSM_ENABLE_FBUS2
44 #ifndef GSM_USED_FBUS2DLR3
45 # undef GSM_ENABLE_FBUS2DLR3
47 #ifndef GSM_USED_FBUS2DKU5
48 # undef GSM_ENABLE_FBUS2DKU5
50 #ifndef GSM_USED_FBUS2BLUE
51 # undef GSM_ENABLE_FBUS2BLUE
53 #ifndef GSM_USED_FBUS2IRDA
54 # undef GSM_ENABLE_FBUS2IRDA
56 #ifndef GSM_USED_PHONETBLUE
57 # undef GSM_ENABLE_PHONETBLUE
62 #ifndef GSM_USED_IRDAOBEX
63 # undef GSM_ENABLE_IRDAOBEX
65 #ifndef GSM_USED_BLUEOBEX
66 # undef GSM_ENABLE_BLUEOBEX
68 #ifndef GSM_USED_ALCABUS
69 # undef GSM_ENABLE_ALCABUS
71 #ifndef GSM_USED_IRDAPHONET
72 # undef GSM_ENABLE_IRDAPHONET
74 #ifndef GSM_USED_BLUEFBUS2
75 # undef GSM_ENABLE_BLUEFBUS2
77 #ifndef GSM_USED_BLUEPHONET
78 # undef GSM_ENABLE_BLUEPHONET
80 #ifndef GSM_USED_BLUEAT
81 # undef GSM_ENABLE_BLUEAT
83 #ifndef GSM_USED_IRDAAT
84 # undef GSM_ENABLE_IRDAAT
86 #ifndef GSM_USED_MROUTERBLUE
87 # undef GSM_ENABLE_MROUTERBLUE
90 #if defined(GSM_ENABLE_NOKIA6110) || defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210)
91 # define GSM_ENABLE_NOKIA_DCT3
93 #if defined(GSM_ENABLE_NOKIA3650) || defined(GSM_ENABLE_NOKIA6510)
94 # define GSM_ENABLE_NOKIA_DCT4
97 #include "protocol/protocol.h"
98 #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2DKU5)
99 # include "protocol/nokia/fbus2.h"
101 #ifdef GSM_ENABLE_MBUS2
102 # include "protocol/nokia/mbus2.h"
104 #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
105 # include "protocol/nokia/phonet.h"
107 #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
108 # include "protocol/at/at.h"
110 #ifdef GSM_ENABLE_ALCABUS
111 # include "protocol/alcatel/alcabus.h"
113 #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
114 # include "protocol/obex/obex.h"
116 #if defined(GSM_ENABLE_MROUTERBLUE)
117 # include "protocol/symbian/mrouter.h"
120 #define GSM_ENABLE_SERIALDEVICE
121 #ifndef GSM_USED_SERIALDEVICE
122 # undef GSM_ENABLE_SERIALDEVICE
124 #define GSM_ENABLE_IRDADEVICE
125 #ifndef GSM_USED_IRDADEVICE
126 # undef GSM_ENABLE_IRDADEVICE
128 #define GSM_ENABLE_BLUETOOTHDEVICE
129 #ifndef GSM_USED_BLUETOOTHDEVICE
130 # undef GSM_ENABLE_BLUETOOTHDEVICE
134 # undef GSM_ENABLE_IRDADEVICE
135 # undef GSM_ENABLE_FBUS2IRDA
136 # undef GSM_ENABLE_IRDAPHONET
137 # undef GSM_ENABLE_BLUETOOTHDEVICE
138 # undef GSM_ENABLE_BLUEFBUS2
139 # undef GSM_ENABLE_BLUEPHONET
140 # undef GSM_ENABLE_BLUEAT
141 # undef GSM_ENABLE_IRDAAT
142 # undef GSM_ENABLE_PHONETBLUE
143 # undef GSM_ENABLE_FBUS2BLUE
144 # undef GSM_ENABLE_IRDAOBEX
145 # undef GSM_ENABLE_BLUEOBEX
146 # undef GSM_ENABLE_MROUTERBLUE
149 #ifdef GSM_ENABLE_SERIALDEVICE
150 # include "device/serial/ser_w32.h"
151 # include "device/serial/ser_unx.h"
152 # include "device/serial/ser_djg.h"
154 #ifdef GSM_ENABLE_IRDADEVICE
155 # include "device/irda/irda.h"
157 #ifdef GSM_ENABLE_BLUETOOTHDEVICE
158 # include "device/bluetoth/bluetoth.h"
161 #include "service/gsmpbk.h"
162 #include "service/gsmnet.h"
163 #include "service/gsmring.h"
164 #include "service/gsmcal.h"
165 #include "service/gsmwap.h"
166 #include "service/gsmlogo.h"
167 #include "service/gsmmisc.h"
168 #include "service/gsmprof.h"
169 #include "service/gsmcall.h"
170 #include "service/sms/gsmsms.h"
171 #include "service/sms/gsmems.h"
172 #include "service/sms/gsmmulti.h"
174 typedef struct _GSM_StateMachine GSM_StateMachine
;
175 typedef struct _GSM_User GSM_User
;
176 typedef struct _OnePhoneModel OnePhoneModel
;
178 /* ------------------------- Device layer ---------------------------------- */
181 * Device functions, each device has to provide these.
187 GSM_Error (*OpenDevice
) (GSM_StateMachine
*s
);
191 GSM_Error (*CloseDevice
) (GSM_StateMachine
*s
);
193 * Sets parity for device.
195 GSM_Error (*DeviceSetParity
) (GSM_StateMachine
*s
, bool parity
);
197 * Sets dtr (data to read) and rts (ready to send) flags.
199 GSM_Error (*DeviceSetDtrRts
) (GSM_StateMachine
*s
, bool dtr
, bool rts
);
203 GSM_Error (*DeviceSetSpeed
) (GSM_StateMachine
*s
, int speed
);
205 * Attempts to read nbytes from device.
207 int (*ReadDevice
) (GSM_StateMachine
*s
, void *buf
, size_t nbytes
);
209 * Attempts to read nbytes from device.
211 int (*WriteDevice
) (GSM_StateMachine
*s
, void *buf
, size_t nbytes
);
212 } GSM_Device_Functions
;
214 #ifdef GSM_ENABLE_SERIALDEVICE
215 extern GSM_Device_Functions SerialDevice
;
217 #ifdef GSM_ENABLE_IRDADEVICE
218 extern GSM_Device_Functions IrdaDevice
;
220 #ifdef GSM_ENABLE_BLUETOOTHDEVICE
221 extern GSM_Device_Functions BlueToothDevice
;
225 * Structure containing device specific data and pointer to device functions -
226 * @ref GSM_Device_Functions. The data are in a union, so you can use only
227 * one device at one time.
232 #ifdef GSM_ENABLE_SERIALDEVICE
233 GSM_Device_SerialData Serial
;
235 #ifdef GSM_ENABLE_IRDADEVICE
236 GSM_Device_IrdaData Irda
;
238 #ifdef GSM_ENABLE_BLUETOOTHDEVICE
239 GSM_Device_BlueToothData BlueTooth
;
242 GSM_Device_Functions
*Functions
;
245 /* ---------------------- Protocol layer ----------------------------------- */
248 * Protocol functions, each protocol has to implement these.
252 * Writes message to device.
254 GSM_Error (*WriteMessage
) (GSM_StateMachine
*s
, unsigned char *buffer
,
255 int length
, unsigned char type
);
257 * This one is called when character is received from device.
259 GSM_Error (*StateMachine
) (GSM_StateMachine
*s
, unsigned char rx_byte
);
261 * Protocol initialisation.
263 GSM_Error (*Initialise
) (GSM_StateMachine
*s
);
265 * Protocol termination.
267 GSM_Error (*Terminate
) (GSM_StateMachine
*s
);
268 } GSM_Protocol_Functions
;
270 #ifdef GSM_ENABLE_MBUS2
271 extern GSM_Protocol_Functions MBUS2Protocol
;
273 #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2)
274 extern GSM_Protocol_Functions FBUS2Protocol
;
276 #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
277 extern GSM_Protocol_Functions PHONETProtocol
;
279 #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
280 extern GSM_Protocol_Functions ATProtocol
;
282 #ifdef GSM_ENABLE_ALCABUS
283 extern GSM_Protocol_Functions ALCABUSProtocol
;
285 #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
286 extern GSM_Protocol_Functions OBEXProtocol
;
288 #if defined(GSM_ENABLE_MROUTERBLUE)
289 extern GSM_Protocol_Functions MROUTERProtocol
;
293 * Structure containing protocol specific data and pointer to protocol
294 * functions - @ref GSM_Protocol_Functions. The data are in a structure, so
295 * you may use more protocols at once and switch between them.
300 #ifdef GSM_ENABLE_MBUS2
301 GSM_Protocol_MBUS2Data MBUS2
;
303 #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2)
304 GSM_Protocol_FBUS2Data FBUS2
;
306 #if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
307 GSM_Protocol_PHONETData PHONET
;
309 #if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
310 GSM_Protocol_ATData AT
;
312 #ifdef GSM_ENABLE_ALCABUS
313 GSM_Protocol_ALCABUSData ALCABUS
;
315 #if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
316 GSM_Protocol_OBEXData OBEX
;
318 #if defined(GSM_ENABLE_MROUTERBLUE)
319 GSM_Protocol_MROUTERData MROUTER
;
322 GSM_Protocol_Functions
*Functions
;
325 /* -------------------------- Phone layer ---------------------------------- */
328 * Phone requests identificators, these are used for internally identifying
329 * which operation is being performed.
348 ID_GetSMSFolderStatus
,
354 ID_GetCalendarNotesInfo
,
368 ID_DeleteCalendarNote
,
377 ID_GetCalendarNotePos
,
383 ID_GetCalendarSettings
,
384 ID_SetCalendarSettings
,
388 ID_DeleteWAPBookmark
,
396 ID_GetManufactureMonth
,
419 ID_GetSecurityStatus
,
420 ID_EnterSecurityCode
,
423 ID_MakeAuthentication
,
425 ID_ResetPhoneSettings
,
428 ID_SetAutoNetworkLogin
,
438 #ifdef GSM_ENABLE_ALCATEL
459 ID_AlcatelGetCategories1
,
460 ID_AlcatelGetCategories2
,
461 ID_AlcatelGetCategoryText1
,
462 ID_AlcatelGetCategoryText2
,
463 ID_AlcatelGetFields1
,
464 ID_AlcatelGetFields2
,
465 ID_AlcatelGetFieldValue1
,
466 ID_AlcatelGetFieldValue2
,
467 ID_AlcatelDeleteItem1
,
468 ID_AlcatelDeleteItem2
,
469 ID_AlcatelDeleteField
,
470 ID_AlcatelCreateField
,
471 ID_AlcatelUpdateField
,
487 } GSM_Phone_RequestID
;
490 * Phone related data are stored here.
494 * Phone IMEI (or serial number).
496 char IMEI
[MAX_IMEI_LENGTH
];
498 * Phone manufacturer as reported by phone.
500 char Manufacturer
[MAX_MANUFACTURER_LENGTH
];
502 * Phone model as reported by phone.
504 char Model
[MAX_MODEL_LENGTH
];
506 * Model information, pointer to static @ref allmodels array.
508 OnePhoneModel
*ModelInfo
;
510 * Phone version as reported by phone. It doesn't have to be numerical
513 char Version
[MAX_VERSION_LENGTH
];
515 * Phone version date, might be empty for some models.
517 char VerDate
[MAX_VERSION_DATE_LENGTH
];
519 * Phone version as number, if applicable.
523 * Cache for hardware version used by some modules.
525 char HardwareCache
[50];
527 * Cache for product code version used by some modules.
529 char ProductCodeCache
[50];
532 * Counter used for disabling startup info on phone, see
533 * @ref GSM_Phone_Functions::ShowStartInfo . After this is 0, the startup info is hidden.
535 int StartInfoCounter
;
538 * Pointer to structure used internally by phone drivers.
540 GSM_GPRSAccessPoint
*GPRSPoint
;
542 * Pointer to structure used internally by phone drivers.
544 GSM_SpeedDial
*SpeedDial
;
546 * Pointer to structure used internally by phone drivers.
548 GSM_DateTime
*DateTime
;
550 * Pointer to structure used internally by phone drivers.
554 * Pointer to structure used internally by phone drivers.
556 GSM_MemoryEntry
*Memory
;
558 * Pointer to structure used internally by phone drivers.
560 GSM_MemoryStatus
*MemoryStatus
;
562 * Pointer to structure used internally by phone drivers.
566 * Pointer to structure used internally by phone drivers.
568 GSM_MultiSMSMessage
*GetSMSMessage
;
570 * Pointer to structure used internally by phone drivers.
572 GSM_SMSMessage
*SaveSMSMessage
;
574 * Pointer to structure used internally by phone drivers.
576 GSM_SMSMemoryStatus
*SMSStatus
;
578 * Pointer to structure used internally by phone drivers.
580 GSM_SMSFolders
*SMSFolders
;
582 * Used internally by phone drivers.
586 * Used internally by phone drivers.
590 * Pointer to structure used internally by phone drivers.
592 GSM_SignalQuality
*SignalQuality
;
594 * Pointer to structure used internally by phone drivers.
596 GSM_BatteryCharge
*BatteryCharge
;
598 * Pointer to structure used internally by phone drivers.
600 GSM_NetworkInfo
*NetworkInfo
;
602 * Pointer to structure used internally by phone drivers.
604 GSM_Ringtone
*Ringtone
;
606 * Pointer to structure used internally by phone drivers.
608 GSM_CalendarEntry
*Cal
;
610 * Used internally by phone drivers.
612 unsigned char *SecurityCode
;
614 * Pointer to structure used internally by phone drivers.
616 GSM_WAPBookmark
*WAPBookmark
;
618 * Pointer to structure used internally by phone drivers.
620 GSM_MultiWAPSettings
*WAPSettings
;
622 * Pointer to structure used internally by phone drivers.
626 * Used internally by phone drivers.
628 unsigned char *Netmonitor
;
630 * Pointer to structure used internally by phone drivers.
632 GSM_MultiCallDivert
*Divert
;
634 * Pointer to structure used internally by phone drivers.
638 * Used internally by phone drivers.
642 * Pointer to structure used internally by phone drivers.
644 GSM_SecurityCodeType
*SecurityStatus
;
646 * Pointer to structure used internally by phone drivers.
648 GSM_Profile
*Profile
;
650 * Pointer to structure used internally by phone drivers.
652 GSM_AllRingtonesInfo
*RingtonesInfo
;
654 * Pointer to structure used internally by phone drivers.
656 GSM_DisplayFeatures
*DisplayFeatures
;
658 * Pointer to structure used internally by phone drivers.
660 GSM_FMStation
*FMStation
;
662 * Pointer to structure used internally by phone drivers.
666 * Pointer to structure used internally by phone drivers.
668 GSM_CalendarSettings
*CalendarSettings
;
670 * Used internally by phone drivers.
672 unsigned char *PhoneString
;
674 * Used internally by phone drivers.
676 int StartPhoneString
;
678 * Pointer to structure used internally by phone drivers.
682 * Pointer to structure used internally by phone drivers.
686 * Pointer to structure used internally by phone drivers.
688 GSM_FileSystemStatus
*FileSystemStatus
;
691 * Should phone notify about incoming calls?
693 bool EnableIncomingCall
;
695 * Should phone notify about incoming SMSes?
697 bool EnableIncomingSMS
;
699 * Should phone notify about incoming CBs?
701 bool EnableIncomingCB
;
703 * Should phone notify about incoming USSDs?
705 bool EnableIncomingUSSD
;
708 * Last message received from phone.
710 GSM_Protocol_Message
*RequestMsg
;
712 * Last message sent by Gammu.
714 GSM_Protocol_Message
*SentMsg
;
716 * What operation is being performed now, see @ref GSM_Phone_RequestID
717 * for possible values.
719 GSM_Phone_RequestID RequestID
;
721 * Error returned by function in phone module.
723 GSM_Error DispatchError
;
726 * Structure with private phone modules data.
730 #ifdef GSM_ENABLE_NOKIA3650
731 GSM_Phone_N3650Data N3650
;
733 #ifdef GSM_ENABLE_NOKIA6110
734 GSM_Phone_N6110Data N6110
;
736 #ifdef GSM_ENABLE_NOKIA6510
737 GSM_Phone_N6510Data N6510
;
739 #ifdef GSM_ENABLE_NOKIA7110
740 GSM_Phone_N7110Data N7110
;
742 #ifdef GSM_ENABLE_ATGEN
743 GSM_Phone_ATGENData ATGEN
;
745 #ifdef GSM_ENABLE_ALCATEL
746 GSM_Phone_ALCATELData ALCATEL
;
748 #ifdef GSM_ENABLE_OBEXGEN
749 GSM_Phone_OBEXGENData OBEXGEN
;
751 #ifdef GSM_ENABLE_MROUTERGEN
752 GSM_Phone_MROUTERGENData MROUTERGEN
;
758 * Structure for defining reply functions.
760 * Function is called when requestID matches current operation or is
761 * ID_IncomingFrame and msgtype matches start message and (if msgtype is just
762 * one character) subtypechar is zero or subtypechar-th character of message
765 * Should be used in array with last element containing ID_None as requestID.
769 * Pointer to function that should be executed.
771 GSM_Error (*Function
) (GSM_Protocol_Message msg
, GSM_StateMachine
*s
);
773 * Message type, if it is longer than 1 character, it disables subtype
776 unsigned char *msgtype
;
778 * Which character of message should be checked as subtype. Zero to
779 * disable subtype checking.
783 * Subtype to be checked.
785 unsigned char subtype
;
787 * Phone request when this can be called, use ID_IncomingFrame when
788 * you want to use this in any state.
790 GSM_Phone_RequestID requestID
;
791 } GSM_Reply_Function
;
794 * Structure defining phone functions.
798 * Names of supported models separated by |. Must contain at least one
803 * Array of reply functions for the phone, see
804 * @ref GSM_Reply_Function for details about it.
806 GSM_Reply_Function
*ReplyFunctions
;
810 GSM_Error (*Initialise
) (GSM_StateMachine
*s
);
812 * Terminates phone communication.
814 GSM_Error (*Terminate
) (GSM_StateMachine
*s
);
816 * Dispatches messages from phone, at the end it should call
817 * @ref GSM_DispatchMessage.
819 GSM_Error (*DispatchMessage
) (GSM_StateMachine
*s
);
821 * Enables showing information on phone display.
823 GSM_Error (*ShowStartInfo
) (GSM_StateMachine
*s
, bool enable
);
825 * Reads manufacturer from phone.
827 GSM_Error (*GetManufacturer
) (GSM_StateMachine
*s
);
829 * Reads model from phone.
831 GSM_Error (*GetModel
) (GSM_StateMachine
*s
);
833 * Reads firmware information from phone.
835 GSM_Error (*GetFirmware
) (GSM_StateMachine
*s
);
837 * Reads IMEI/serial number from phone.
839 GSM_Error (*GetIMEI
) (GSM_StateMachine
*s
);
841 * Gets date and time from phone.
843 GSM_Error (*GetOriginalIMEI
) (GSM_StateMachine
*s
, char *value
);
845 * Gets month when device was manufactured.
847 GSM_Error (*GetManufactureMonth
)(GSM_StateMachine
*s
, char *value
);
849 * Gets product code of device.
851 GSM_Error (*GetProductCode
) (GSM_StateMachine
*s
, char *value
);
853 * Gets hardware information about device.
855 GSM_Error (*GetHardware
) (GSM_StateMachine
*s
, char *value
);
857 * Gets PPM (Post Programmable Memory) info from phone
858 * (in other words for Nokia get, which language pack is in phone)
860 GSM_Error (*GetPPM
) (GSM_StateMachine
*s
, char *value
);
862 * Gets SIM IMSI from phone.
864 GSM_Error (*GetSIMIMSI
) (GSM_StateMachine
*s
, char *IMSI
);
866 * Reads date and time from phone.
868 GSM_Error (*GetDateTime
) (GSM_StateMachine
*s
, GSM_DateTime
*date_time
);
870 * Sets date and time in phone.
872 GSM_Error (*SetDateTime
) (GSM_StateMachine
*s
, GSM_DateTime
*date_time
);
874 * Reads alarm set in phone.
876 GSM_Error (*GetAlarm
) (GSM_StateMachine
*s
, GSM_Alarm
*alarm
);
878 * Sets alarm in phone.
880 GSM_Error (*SetAlarm
) (GSM_StateMachine
*s
, GSM_Alarm
*alarm
);
882 * Gets locale from phone.
884 GSM_Error (*GetLocale
) (GSM_StateMachine
*s
, GSM_Locale
*locale
);
886 * Sets locale of phone.
888 GSM_Error (*SetLocale
) (GSM_StateMachine
*s
, GSM_Locale
*locale
);
890 * Emulates key press or key release.
892 GSM_Error (*PressKey
) (GSM_StateMachine
*s
, GSM_KeyCode Key
, bool Press
);
894 * Performs phone reset.
896 GSM_Error (*Reset
) (GSM_StateMachine
*s
, bool hard
);
898 * Resets phone settings.
900 GSM_Error (*ResetPhoneSettings
) (GSM_StateMachine
*s
, GSM_ResetSettingsType Type
);
902 * Enters security code (PIN, PUK,...) .
904 GSM_Error (*EnterSecurityCode
) (GSM_StateMachine
*s
, GSM_SecurityCode Code
);
906 * Queries whether some security code needs to be entered./
908 GSM_Error (*GetSecurityStatus
) (GSM_StateMachine
*s
, GSM_SecurityCodeType
*Status
);
910 * Acquired display status.
912 GSM_Error (*GetDisplayStatus
) (GSM_StateMachine
*s
, GSM_DisplayFeatures
*features
);
914 * Enables network auto login.
916 GSM_Error (*SetAutoNetworkLogin
)(GSM_StateMachine
*s
);
918 * Gets information about batery charge and phone charging state.
920 GSM_Error (*GetBatteryCharge
) (GSM_StateMachine
*s
, GSM_BatteryCharge
*bat
);
922 * Reads signal quality (strength and error rate).
924 GSM_Error (*GetSignalQuality
) (GSM_StateMachine
*s
, GSM_SignalQuality
*sig
);
926 * Gets network information.
928 GSM_Error (*GetNetworkInfo
) (GSM_StateMachine
*s
, GSM_NetworkInfo
*netinfo
);
930 * Reads category from phone.
932 GSM_Error (*GetCategory
) (GSM_StateMachine
*s
, GSM_Category
*Category
);
934 * Reads category status (number of used entries) from phone.
936 GSM_Error (*GetCategoryStatus
) (GSM_StateMachine
*s
, GSM_CategoryStatus
*Status
);
938 * Gets memory (phonebooks or calls) status (eg. number of used and
941 GSM_Error (*GetMemoryStatus
) (GSM_StateMachine
*s
, GSM_MemoryStatus
*status
);
943 * Reads entry from memory (phonebooks or calls). Which entry should
944 * be read is defined in entry.
946 GSM_Error (*GetMemory
) (GSM_StateMachine
*s
, GSM_MemoryEntry
*entry
);
948 * Reads entry from memory (phonebooks or calls). Which entry should
949 * be read is defined in entry. This can be easily used for reading all entries.
951 GSM_Error (*GetNextMemory
) (GSM_StateMachine
*s
, GSM_MemoryEntry
*entry
, bool start
);
953 * Sets memory (phonebooks or calls) entry.
955 GSM_Error (*SetMemory
) (GSM_StateMachine
*s
, GSM_MemoryEntry
*entry
);
957 * Deletes memory (phonebooks or calls) entry.
959 GSM_Error (*AddMemory
) (GSM_StateMachine
*s
, GSM_MemoryEntry
*entry
);
961 * Deletes memory (phonebooks or calls) entry.
963 GSM_Error (*DeleteMemory
) (GSM_StateMachine
*s
, GSM_MemoryEntry
*entry
);
965 * Deletes all memory (phonebooks or calls) entries of specified type.
967 GSM_Error (*DeleteAllMemory
) (GSM_StateMachine
*s
, GSM_MemoryType MemoryType
);
971 GSM_Error (*GetSpeedDial
) (GSM_StateMachine
*s
, GSM_SpeedDial
*Speed
);
975 GSM_Error (*SetSpeedDial
) (GSM_StateMachine
*s
, GSM_SpeedDial
*Speed
);
977 * Gets SMS Service Center number and SMS settings.
979 GSM_Error (*GetSMSC
) (GSM_StateMachine
*s
, GSM_SMSC
*smsc
);
981 * Sets SMS Service Center number and SMS settings.
983 GSM_Error (*SetSMSC
) (GSM_StateMachine
*s
, GSM_SMSC
*smsc
);
985 * Gets information about SMS memory (read/unread/size of memory for
986 * both SIM and phone).
988 GSM_Error (*GetSMSStatus
) (GSM_StateMachine
*s
, GSM_SMSMemoryStatus
*status
);
992 GSM_Error (*GetSMS
) (GSM_StateMachine
*s
, GSM_MultiSMSMessage
*sms
);
994 * Reads next (or first if start set) SMS message. This might be
995 * faster for some phones than using @ref GetSMS for each message.
997 GSM_Error (*GetNextSMS
) (GSM_StateMachine
*s
, GSM_MultiSMSMessage
*sms
, bool start
);
1001 GSM_Error (*SetSMS
) (GSM_StateMachine
*s
, GSM_SMSMessage
*sms
);
1003 * Adds SMS to specified folder.
1005 GSM_Error (*AddSMS
) (GSM_StateMachine
*s
, GSM_SMSMessage
*sms
);
1009 GSM_Error (*DeleteSMS
) (GSM_StateMachine
*s
, GSM_SMSMessage
*sms
);
1013 GSM_Error (*SendSMS
) (GSM_StateMachine
*s
, GSM_SMSMessage
*sms
);
1015 * Enable/disable notification on incoming SMS.
1017 GSM_Error (*SetIncomingSMS
) (GSM_StateMachine
*s
, bool enable
);
1019 * Gets network information from phone.
1021 GSM_Error (*SetIncomingCB
) (GSM_StateMachine
*s
, bool enable
);
1023 * Returns SMS folders information.
1025 GSM_Error (*GetSMSFolders
) (GSM_StateMachine
*s
, GSM_SMSFolders
*folders
);
1027 * Creates SMS folder.
1029 GSM_Error (*AddSMSFolder
) (GSM_StateMachine
*s
, unsigned char *name
);
1031 * Deletes SMS folder.
1033 GSM_Error (*DeleteSMSFolder
) (GSM_StateMachine
*s
, int ID
);
1035 * Dials number and starts voice call.
1037 GSM_Error (*DialVoice
) (GSM_StateMachine
*s
, char *Number
, GSM_CallShowNumber ShowNumber
);
1039 * Accept current incoming call.
1041 GSM_Error (*AnswerCall
) (GSM_StateMachine
*s
, int ID
, bool all
);
1043 * Deny current incoming call.
1045 GSM_Error (*CancelCall
) (GSM_StateMachine
*s
, int ID
, bool all
);
1049 GSM_Error (*HoldCall
) (GSM_StateMachine
*s
, int ID
);
1053 GSM_Error (*UnholdCall
) (GSM_StateMachine
*s
, int ID
);
1055 * Initiates conference call.
1057 GSM_Error (*ConferenceCall
) (GSM_StateMachine
*s
, int ID
);
1061 GSM_Error (*SplitCall
) (GSM_StateMachine
*s
, int ID
);
1065 GSM_Error (*TransferCall
) (GSM_StateMachine
*s
, int ID
, bool next
);
1069 GSM_Error (*SwitchCall
) (GSM_StateMachine
*s
, int ID
, bool next
);
1071 * Gets call diverts.
1073 GSM_Error (*GetCallDivert
) (GSM_StateMachine
*s
, GSM_MultiCallDivert
*divert
);
1075 * Sets call diverts.
1077 GSM_Error (*SetCallDivert
) (GSM_StateMachine
*s
, GSM_MultiCallDivert
*divert
);
1079 * Cancels all diverts.
1081 GSM_Error (*CancelAllDiverts
) (GSM_StateMachine
*s
);
1083 * Activates/deactivates noticing about incoming calls.
1085 GSM_Error (*SetIncomingCall
) (GSM_StateMachine
*s
, bool enable
);
1087 * Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services).
1089 GSM_Error (*SetIncomingUSSD
) (GSM_StateMachine
*s
, bool enable
);
1091 * Sends DTMF (Dual Tone Multi Frequency) tone.
1093 GSM_Error (*SendDTMF
) (GSM_StateMachine
*s
, char *sequence
);
1095 * Gets ringtone from phone.
1097 GSM_Error (*GetRingtone
) (GSM_StateMachine
*s
, GSM_Ringtone
*Ringtone
, bool PhoneRingtone
);
1099 * Sets ringtone in phone.
1101 GSM_Error (*SetRingtone
) (GSM_StateMachine
*s
, GSM_Ringtone
*Ringtone
, int *maxlength
);
1103 * Acquires ringtone informaiton.
1105 GSM_Error (*GetRingtonesInfo
) (GSM_StateMachine
*s
, GSM_AllRingtonesInfo
*Info
);
1107 * Deletes user defined ringtones from phone.
1109 GSM_Error (*DeleteUserRingtones
)(GSM_StateMachine
*s
);
1113 GSM_Error (*PlayTone
) (GSM_StateMachine
*s
, int Herz
, unsigned char Volume
, bool start
);
1115 * Reads WAP bookmark.
1117 GSM_Error (*GetWAPBookmark
) (GSM_StateMachine
*s
, GSM_WAPBookmark
*bookmark
);
1119 * Sets WAP bookmark.
1121 GSM_Error (*SetWAPBookmark
) (GSM_StateMachine
*s
, GSM_WAPBookmark
*bookmark
);
1123 * Deletes WAP bookmark.
1125 GSM_Error (*DeleteWAPBookmark
) (GSM_StateMachine
*s
, GSM_WAPBookmark
*bookmark
);
1127 * Acquires WAP settings.
1129 GSM_Error (*GetWAPSettings
) (GSM_StateMachine
*s
, GSM_MultiWAPSettings
*settings
);
1131 * Changes WAP settings.
1133 GSM_Error (*SetWAPSettings
) (GSM_StateMachine
*s
, GSM_MultiWAPSettings
*settings
);
1135 * Acquires MMS settings.
1137 GSM_Error (*GetMMSSettings
) (GSM_StateMachine
*s
, GSM_MultiWAPSettings
*settings
);
1139 * Changes MMS settings.
1141 GSM_Error (*SetMMSSettings
) (GSM_StateMachine
*s
, GSM_MultiWAPSettings
*settings
);
1145 GSM_Error (*GetBitmap
) (GSM_StateMachine
*s
, GSM_Bitmap
*Bitmap
);
1149 GSM_Error (*SetBitmap
) (GSM_StateMachine
*s
, GSM_Bitmap
*Bitmap
);
1151 * Gets status of ToDos (count of used entries).
1153 GSM_Error (*GetToDoStatus
) (GSM_StateMachine
*s
, GSM_ToDoStatus
*status
);
1155 * Reads ToDo from phone.
1157 GSM_Error (*GetToDo
) (GSM_StateMachine
*s
, GSM_ToDoEntry
*ToDo
);
1159 * Reads ToDo from phone.
1161 GSM_Error (*GetNextToDo
) (GSM_StateMachine
*s
, GSM_ToDoEntry
*ToDo
, bool start
);
1163 * Sets ToDo in phone.
1165 GSM_Error (*SetToDo
) (GSM_StateMachine
*s
, GSM_ToDoEntry
*ToDo
);
1167 * Adds ToDo in phone.
1169 GSM_Error (*AddToDo
) (GSM_StateMachine
*s
, GSM_ToDoEntry
*ToDo
);
1171 * Deletes ToDo entry in phone.
1173 GSM_Error (*DeleteToDo
) (GSM_StateMachine
*s
, GSM_ToDoEntry
*ToDo
);
1175 * Deletes all todo entries in phone.
1177 GSM_Error (*DeleteAllToDo
) (GSM_StateMachine
*s
);
1179 * Retrieves calendar status (number of used entries).
1181 GSM_Error (*GetCalendarStatus
) (GSM_StateMachine
*s
, GSM_CalendarStatus
*Status
);
1183 * Retrieves calendar entry.
1185 GSM_Error (*GetCalendar
) (GSM_StateMachine
*s
, GSM_CalendarEntry
*Note
);
1187 * Retrieves calendar entry. This is useful for continuous reading of all
1190 GSM_Error (*GetNextCalendar
) (GSM_StateMachine
*s
, GSM_CalendarEntry
*Note
, bool start
);
1192 * Sets calendar entry
1194 GSM_Error (*SetCalendar
) (GSM_StateMachine
*s
, GSM_CalendarEntry
*Note
);
1196 * Adds calendar entry.
1198 GSM_Error (*AddCalendar
) (GSM_StateMachine
*s
, GSM_CalendarEntry
*Note
);
1200 * Deletes calendar entry.
1202 GSM_Error (*DeleteCalendar
) (GSM_StateMachine
*s
, GSM_CalendarEntry
*Note
);
1204 * Deletes all calendar entries.
1206 GSM_Error (*DeleteAllCalendar
) (GSM_StateMachine
*s
);
1208 * Reads calendar settings.
1210 GSM_Error (*GetCalendarSettings
)(GSM_StateMachine
*s
, GSM_CalendarSettings
*settings
);
1212 * Sets calendar settings.
1214 GSM_Error (*SetCalendarSettings
)(GSM_StateMachine
*s
, GSM_CalendarSettings
*settings
);
1218 GSM_Error (*GetNote
) (GSM_StateMachine
*s
, GSM_NoteEntry
*Note
, bool refresh
);
1222 GSM_Error (*GetProfile
) (GSM_StateMachine
*s
, GSM_Profile
*Profile
);
1226 GSM_Error (*SetProfile
) (GSM_StateMachine
*s
, GSM_Profile
*Profile
);
1230 GSM_Error (*GetFMStation
) (GSM_StateMachine
*s
, GSM_FMStation
*FMStation
);
1234 GSM_Error (*SetFMStation
) (GSM_StateMachine
*s
, GSM_FMStation
*FMStation
);
1236 * Clears defined FM stations.
1238 GSM_Error (*ClearFMStations
) (GSM_StateMachine
*s
);
1240 * Gets next filename from filesystem.
1242 GSM_Error (*GetNextFileFolder
) (GSM_StateMachine
*s
, GSM_File
*File
, bool start
);
1244 * Gets file part from filesystem.
1246 GSM_Error (*GetFilePart
) (GSM_StateMachine
*s
, GSM_File
*File
);
1248 * Adds file part to filesystem.
1250 GSM_Error (*AddFilePart
) (GSM_StateMachine
*s
, GSM_File
*File
, int *Pos
);
1252 * Acquires filesystem status.
1254 GSM_Error (*GetFileSystemStatus
)(GSM_StateMachine
*s
, GSM_FileSystemStatus
*Status
);
1256 * Deletes file from filessytem.
1258 GSM_Error (*DeleteFile
) (GSM_StateMachine
*s
, unsigned char *ID
);
1260 * Adds folder to filesystem.
1262 GSM_Error (*AddFolder
) (GSM_StateMachine
*s
, GSM_File
*File
);
1264 * Gets GPRS access point.
1266 GSM_Error (*GetGPRSAccessPoint
) (GSM_StateMachine
*s
, GSM_GPRSAccessPoint
*point
);
1268 * Sets GPRS access point.
1270 GSM_Error (*SetGPRSAccessPoint
) (GSM_StateMachine
*s
, GSM_GPRSAccessPoint
*point
);
1271 } GSM_Phone_Functions
;
1273 extern GSM_Phone_Functions NAUTOPhone
;
1274 #ifdef GSM_ENABLE_NOKIA3650
1275 extern GSM_Phone_Functions N3650Phone
;
1277 #ifdef GSM_ENABLE_NOKIA6110
1278 extern GSM_Phone_Functions N6110Phone
;
1280 #ifdef GSM_ENABLE_NOKIA6510
1281 extern GSM_Phone_Functions N6510Phone
;
1283 #ifdef GSM_ENABLE_NOKIA7110
1284 extern GSM_Phone_Functions N7110Phone
;
1286 #ifdef GSM_ENABLE_NOKIA9210
1287 extern GSM_Phone_Functions N9210Phone
;
1289 #ifdef GSM_ENABLE_ATGEN
1290 extern GSM_Phone_Functions ATGENPhone
;
1292 #ifdef GSM_ENABLE_ALCATEL
1293 extern GSM_Phone_Functions ALCATELPhone
;
1295 #ifdef GSM_ENABLE_OBEXGEN
1296 extern GSM_Phone_Functions OBEXGENPhone
;
1298 #ifdef GSM_ENABLE_MROUTERGEN
1299 extern GSM_Phone_Functions MROUTERGENPhone
;
1303 GSM_Phone_Data Data
;
1304 GSM_Phone_Functions
*Functions
;
1307 /* --------------------------- User layer ---------------------------------- */
1310 GSM_Reply_Function
*UserReplyFunctions
;
1312 void (*IncomingCall
) (char *Device
, GSM_Call call
);
1313 void (*IncomingSMS
) (char *Device
, GSM_SMSMessage sms
);
1314 void (*IncomingCB
) (char *Device
, GSM_CBMessage cb
);
1315 void (*IncomingUSSD
) (char *Device
, char *Text
);
1316 void (*SendSMSStatus
) (char *Device
, int status
);
1319 /* --------------------------- Statemachine layer -------------------------- */
1339 } GSM_ConnectionType
;
1342 /* Config file (or Registry or...) variables */
1343 char Model
[50]; /* Model from config file */
1344 char DebugLevel
[50]; /* Debug level */
1345 char *Device
; /* Device name from config file */
1346 char *Connection
; /* Connection type as string */
1347 char *SyncTime
; /* Synchronize time on startup? */
1348 char *LockDevice
; /* Lock device ? (Unix) */
1349 char *DebugFile
; /* Name of debug file */
1350 char *Localize
; /* Name of localisation file */
1351 char *StartInfo
; /* Display something during start ? */
1352 bool UseGlobalDebugFile
;/* Should we use global debug file? */
1354 bool DefaultDebugLevel
;
1356 bool DefaultConnection
;
1357 bool DefaultSyncTime
;
1358 bool DefaultLockDevice
;
1359 bool DefaultDebugFile
;
1360 bool DefaultLocalize
;
1361 bool DefaultStartInfo
;
1364 struct _GSM_StateMachine
{
1365 GSM_ConnectionType ConnectionType
; /* Type of connection as int */
1366 char *LockFile
; /* Lock file name for Unix */
1367 Debug_Info di
; /* Debug information */
1368 bool opened
; /* Is connection opened ? */
1369 GSM_Config Config
[5];
1370 GSM_Config
*CurrentConfig
; /* Config file (or Registry or...) variables */
1372 INI_Section
*msg
; /* Localisation strings structure */
1373 int ReplyNum
; /* How many times make sth. */
1374 int Speed
; /* For some protocols used speed */
1377 GSM_Protocol Protocol
;
1382 /* ------------------------ Other general definitions ---------------------- */
1384 GSM_Error
GSM_RegisterAllPhoneModules (GSM_StateMachine
*s
);
1386 GSM_Error
GSM_InitConnection (GSM_StateMachine
*s
, int ReplyNum
);
1387 GSM_Error
GSM_TerminateConnection (GSM_StateMachine
*s
);
1389 int GSM_ReadDevice (GSM_StateMachine
*s
, bool wait
);
1391 GSM_Error
GSM_WaitForOnce (GSM_StateMachine
*s
, unsigned char *buffer
,
1392 int length
, unsigned char type
, int time
);
1394 GSM_Error
GSM_WaitFor (GSM_StateMachine
*s
, unsigned char *buffer
,
1395 int length
, unsigned char type
, int time
,
1396 GSM_Phone_RequestID request
);
1398 GSM_Error
GSM_DispatchMessage (GSM_StateMachine
*s
);
1400 INI_Section
*GSM_FindGammuRC(void);
1402 bool GSM_ReadConfig (INI_Section
*cfg_info
, GSM_Config
*cfg
, int num
);
1404 void GSM_DumpMessageLevel2 (GSM_StateMachine
*s
, unsigned char *message
, int messagesize
, int type
);
1405 void GSM_DumpMessageLevel3 (GSM_StateMachine
*s
, unsigned char *message
, int messagesize
, int type
);
1407 /* ---------------------- Phone features ----------------------------------- */
1411 F_CAL33
= 1, /* Calendar,3310 style - 10 reminders, Unicode, 3 coding types */
1412 F_CAL52
, /* Calendar,5210 style - full Unicode, etc. */
1413 F_CAL82
, /* Calendar,8250 style - "normal", but with Unicode */
1414 F_RING_SM
, /* Ringtones returned in SM format - 33xx */
1415 F_NORING
, /* No ringtones */
1416 F_NOPBKUNICODE
, /* No phonebook in Unicode */
1417 F_NOWAP
, /* No WAP */
1418 F_NOCALLER
, /* No caller groups */
1419 F_NOPICTURE
, /* No Picture Images */
1420 F_NOPICTUREUNI
, /* No Picture Images text in Unicode */
1421 F_NOSTARTUP
, /* No startup logo */
1422 F_NOCALENDAR
, /* No calendar */
1423 F_NOSTARTANI
, /* Startup logo is not animated */
1424 F_POWER_BATT
, /* Network and battery level get from netmonitor */
1425 F_PROFILES33
, /* Phone profiles in 3310 style */
1426 F_PROFILES51
, /* Phone profiles in 5110 style */
1427 F_MAGICBYTES
, /* Phone can make authentication with magic bytes */
1428 F_NODTMF
, /* Phone can't send DTMF */
1429 F_DISPSTATUS
, /* Phone return display status */
1433 F_PBK35
, /* Phonebook in 3510 style with ringtones ID */
1434 F_RADIO
, /* Phone with FM radio */
1435 F_TODO63
, /* ToDo in 6310 style - 0x55 msg type */
1436 F_TODO66
, /* ToDo in 6610 style - like calendar, with date and other */
1437 F_NOMIDI
, /* No ringtones in MIDI */
1438 F_BLUETOOTH
, /* Bluetooth support */
1439 F_NOFILESYSTEM
, /* No images, ringtones, java saved in special filesystem */
1440 F_NOMMS
, /* No MMS sets in phone */
1441 F_NOGPRSPOINT
, /* GPRS point are not useable */
1442 F_CAL35
, /* Calendar,3510 style - Reminder,Call,Birthday */
1443 F_CAL65
, /* Calendar,6510 style - CBMM, method 3 */
1445 /* n6510.c && n7110.c */
1446 F_VOICETAGS
, /* Voice tags available */
1447 F_CAL62
, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */
1450 F_SMSONLYSENT
, /* Phone supports only sent/unsent messages */
1451 F_BROKENCPBS
, /* CPBS on some memories can hang phone */
1452 F_M20SMS
, /* Siemens M20 like SMS handling */
1453 F_SLOWWRITE
/* Use slower writing which some phone need */
1456 /* For models table */
1457 struct _OnePhoneModel
{
1461 Feature features
[12];
1464 bool IsPhoneFeatureAvailable (OnePhoneModel
*model
, int feature
);
1465 OnePhoneModel
*GetModelData (char *model
, char *number
, char *irdamodel
);
1467 int smprintf(GSM_StateMachine
*s
, const char *format
, ...);
1469 void GSM_OSErrorInfo(GSM_StateMachine
*s
, char *description
);
1473 /* How should editor hadle tabs in this file? Add editor commands here.
1474 * vim: noexpandtab sw=8 ts=8 sts=8: