State machine¶
-
GSM_Error
GSM_InitConnection_Log(GSM_StateMachine * s, int ReplyNum, GSM_Log_Function log_function, void * user_data)¶ Initiates connection with custom logging callback.
- Return
- Error code
- See
- GSM_SetDebugFunction
- Parameters
s: State machine dataReplyNum: Number of replies to await (usually 3).log_function: Logging function, see GSM_SetDebugFunction.user_data: User data for logging function, see GSM_SetDebugFunction.
-
GSM_Error
GSM_InitConnection(GSM_StateMachine * s, int ReplyNum)¶ Initiates connection.
- Return
- Error code
- Parameters
s: State machine dataReplyNum: Number of replies to await (usually 3).
-
GSM_Error
GSM_TerminateConnection(GSM_StateMachine * s)¶ Terminates connection.
- Return
- Error code
- Parameters
s: State machine data
-
GSM_Error
GSM_AbortOperation(GSM_StateMachine * s)¶ Aborts current operation.
This is thread safe call to abort any existing operations with the phone.
- Return
- Error code
- Parameters
s: State machine data
-
GSM_Error
GSM_Install(GSM_StateMachine * s, const char * ExtraPath, gboolean Minimal)¶ Installs applet required for configured connection to the phone.
- Return
- Result of operation.
- Parameters
s: State machine data.ExtraPath: Extra path where to search for installation data.Minimal: Whether to do minimal installation (eg. without support libraries), useful for applet updates
-
typedef struct _GSM_StateMachine
GSM_StateMachine¶ Private structure holding information about phone connection. Should be allocated by GSM_AllocStateMachine and freed by GSM_FreeStateMachine.
-
enum
GSM_ConnectionType¶ Connection types definitions.
Values:
-
GCT_MBUS2= 1¶
-
GCT_FBUS2¶
-
GCT_FBUS2DLR3¶
-
GCT_DKU2AT¶
-
GCT_DKU2PHONET¶
-
GCT_DKU5FBUS2¶
-
GCT_ARK3116FBUS2¶
-
GCT_FBUS2PL2303¶
-
GCT_FBUS2BLUE¶
-
GCT_FBUS2IRDA¶
-
GCT_PHONETBLUE¶
-
GCT_AT¶
-
GCT_BLUEGNAPBUS¶
-
GCT_IRDAOBEX¶
-
GCT_IRDAGNAPBUS¶
-
GCT_IRDAAT¶
-
GCT_IRDAPHONET¶
-
GCT_BLUEFBUS2¶
-
GCT_BLUEAT¶
-
GCT_BLUEPHONET¶
-
GCT_BLUEOBEX¶
-
GCT_FBUS2USB¶
-
GCT_BLUES60¶
-
GCT_PROXYGNAPBUS¶
-
GCT_PROXYFBUS2¶
-
GCT_PROXYAT¶
-
GCT_PROXYPHONET¶
-
GCT_PROXYOBEX¶
-
GCT_PROXYS60¶
-
GCT_NONE¶
-
-
struct
GSM_Config¶ Configuration of state machine.
Public Members
-
char GSM_Config::Model[50] Model from config file
-
char GSM_Config::DebugLevel[50] Debug level
-
char*
Device¶ Device name from config file
-
char*
Connection¶ Connection type as string
-
char*
DebugFile¶ Name of debug file
-
char GSM_Config::TextReminder[32] Text for reminder calendar entry category in local language
-
char GSM_Config::TextMeeting[32] Text for meeting calendar entry category in local language
-
char GSM_Config::TextCall[32] Text for call calendar entry category in local language
-
char GSM_Config::TextBirthday[32] Text for birthday calendar entry category in local language
-
char GSM_Config::TextMemo[32] Text for memo calendar entry category in local language
-
GSM_Feature GSM_Config::PhoneFeatures[GSM_MAX_PHONE_FEATURES+1] Phone features override.
-
-
typedef void
(* GSM_Log_Function)(const char *text, void *data)¶ Callback function for logging.
- Parameters
text: Text to be printed, will be also sent (as a separate message).data: Arbitrary logger data, as passed to GSM_InitConnection_Log.
-
int
GSM_ReadDevice(GSM_StateMachine * s, gboolean waitforreply)¶ Attempts to read data from phone. This can be used for getting status of incoming events, which would not be found out without polling device.
- Return
- Number of read bytes
- Parameters
s: State machine datawaitforreply: Whether to wait for some event
-
gboolean
GSM_IsConnected(GSM_StateMachine * s)¶ Detects whether state machine is connected.
- Return
- Whether phone is connected.
- Parameters
s: State machine data
-
GSM_Error
GSM_FindGammuRC(INI_Section ** result, const char * force_config)¶ Finds and reads gammu configuration file. The search order depends on platform. On POSIX systems it looks for ~/.gammurc and then for /etc/gammurc, on Windows for gammurc in Application data folder, then in home and last fallback is in current driectory.
- Return
- Error code
- Parameters
result: Ini file representationforce_config: Forcing of custom path instead of autodetected one (if NULL, autodetection is performed).
-
GSM_Error
GSM_ReadConfig(INI_Section * cfg_info, GSM_Config * cfg, int num)¶ Processes gammu configuration.
- Return
- Whether we got valid configuration. Especially check for ERR_USING_DEFAULTS.
- See
- GSM_FallbackConfig
- Parameters
cfg_info: Ini file representation.cfg: Where to store configuration.num: Number of section to read.
-
GSM_Config*
GSM_GetConfig(GSM_StateMachine * s, int num)¶ Gets gammu configuration from state machine. This actually returns pointer to internal configuration storage, so you can use it also for updating existing settings.
- Return
- Pointer to configuration.
- Parameters
s: State machine datanum: Number of section to read, -1 for currently used.
-
int
GSM_GetConfigNum(const GSM_StateMachine * s)¶ Gets number of active gammu configurations.
- Return
- Number of sections.
- Parameters
s: State machine data
-
void
GSM_SetConfigNum(GSM_StateMachine * s, int sections)¶ Gets number of active gammu configurations.
- Parameters
s: State machine datasections: Number of sections.
-
GSM_StateMachine*
GSM_AllocStateMachine(void)¶ Allocates new clean state machine structure. You should free it then by GSM_FreeStateMachine.
- Return
- Pointer to state machine structure.
-
void
GSM_FreeStateMachine(GSM_StateMachine * s)¶ Frees state machine structure allocated by GSM_AllocStateMachine.
- Parameters
s: Pointer to state machine structure.
-
GSM_ConnectionType
GSM_GetUsedConnection(GSM_StateMachine * s)¶ Gets number of active gammu configurations.
- Return
- Connection type.
- Parameters
s: State machine data