Gammu API  1.31.91
State machine

Data Structures

struct  GSM_Config

Typedefs

typedef struct _GSM_StateMachine GSM_StateMachine

Functions

GSM_Debug_InfoGSM_GetDebug (GSM_StateMachine *s)
GSM_Debug_InfoGSM_GetDI (GSM_StateMachine *s)
GSM_Error GSM_InitConnection_Log (GSM_StateMachine *s, int ReplyNum, GSM_Log_Function log_function, void *user_data)
GSM_Error GSM_InitConnection (GSM_StateMachine *s, int ReplyNum)
GSM_Error GSM_TerminateConnection (GSM_StateMachine *s)
GSM_Error GSM_AbortOperation (GSM_StateMachine *s)
int GSM_ReadDevice (GSM_StateMachine *s, gboolean waitforreply)
gboolean GSM_IsConnected (GSM_StateMachine *s)
GSM_Error GSM_FindGammuRC (INI_Section **result, const char *force_config)
GSM_Error GSM_ReadConfig (INI_Section *cfg_info, GSM_Config *cfg, int num)
GSM_ConfigGSM_GetConfig (GSM_StateMachine *s, int num)
int GSM_GetConfigNum (const GSM_StateMachine *s)
void GSM_SetConfigNum (GSM_StateMachine *s, int sections)
GSM_StateMachineGSM_AllocStateMachine (void)
void GSM_FreeStateMachine (GSM_StateMachine *s)
GSM_ConnectionType GSM_GetUsedConnection (GSM_StateMachine *s)
GSM_Error GSM_Install (GSM_StateMachine *s, const char *ExtraPath, gboolean Minimal)

Detailed Description

Generic state machine layer.


Typedef Documentation

typedef struct _GSM_StateMachine GSM_StateMachine

Private structure holding information about phone connection. Should be allocated by GSM_AllocStateMachine and freed by GSM_FreeStateMachine.

Definition at line 34 of file gammu-statemachine.h.


Function Documentation

Aborts current operation.

This is thread safe call to abort any existing operations with the phone.

Parameters:
sState machine data
Returns:
Error code

Allocates new clean state machine structure. You should free it then by GSM_FreeStateMachine.

Returns:
Pointer to state machine structure.
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.

Parameters:
resultIni file representation
force_configForcing of custom path instead of autodetected one (if NULL, autodetection is performed).
Returns:
Error code

Frees state machine structure allocated by GSM_AllocStateMachine.

Parameters:
sPointer to state machine structure.
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.

Parameters:
sState machine data
numNumber of section to read, -1 for currently used.
Returns:
Pointer to configuration.
int GSM_GetConfigNum ( const GSM_StateMachine s)

Gets number of active gammu configurations.

Parameters:
sState machine data
Returns:
Number of sections.

Gets debug information for state machine.

Parameters:
sState machine data
Returns:
Debug information.

Returns debug information active for state machine. Please note that it can be either global debug or state machine debug structure, depending on use_global flag. For configuring usite GSM_GetDebug.

Parameters:
sState machine data
Returns:
Debug information.

Gets number of active gammu configurations.

Parameters:
sState machine data
Returns:
Connection type.
GSM_Error GSM_InitConnection ( GSM_StateMachine s,
int  ReplyNum 
)

Initiates connection.

Parameters:
sState machine data
ReplyNumNumber of replies to await (usually 3).
Returns:
Error code
GSM_Error GSM_InitConnection_Log ( GSM_StateMachine s,
int  ReplyNum,
GSM_Log_Function  log_function,
void *  user_data 
)

Initiates connection with custom logging callback.

Parameters:
sState machine data
ReplyNumNumber of replies to await (usually 3).
log_functionLogging function, see GSM_SetDebugFunction.
user_dataUser data for logging function, see GSM_SetDebugFunction.
Returns:
Error code
See also:
GSM_SetDebugFunction
GSM_Error GSM_Install ( GSM_StateMachine s,
const char *  ExtraPath,
gboolean  Minimal 
)

Installs applet required for configured connection to the phone.

Parameters:
sState machine data.
ExtraPathExtra path where to search for installation data.
MinimalWhether to do minimal installation (eg. without support libraries), useful for applet updates
Returns:
Result of operation.

Detects whether state machine is connected.

Parameters:
sState machine data
Returns:
Whether phone is connected.
GSM_Error GSM_ReadConfig ( INI_Section cfg_info,
GSM_Config cfg,
int  num 
)

Processes gammu configuration.

Parameters:
cfg_infoIni file representation.
cfgWhere to store configuration.
numNumber of section to read.
Returns:
Whether we got valid configuration. Especially check for ERR_USING_DEFAULTS.
See also:
GSM_FallbackConfig
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.

Parameters:
sState machine data
waitforreplyWhether to wait for some event
Returns:
Number of read bytes
void GSM_SetConfigNum ( GSM_StateMachine s,
int  sections 
)

Gets number of active gammu configurations.

Parameters:
sState machine data
sectionsNumber of sections.

Terminates connection.

Parameters:
sState machine data
Returns:
Error code