State machine


Data Structures

struct  GSM_Config

Typedefs

typedef struct _GSM_StateMachine GSM_StateMachine

Functions

GSM_Debug_InfoGSM_GetDebug (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)
int GSM_ReadDevice (GSM_StateMachine *s, bool waitforreply)
bool GSM_IsConnected (GSM_StateMachine *s)
GSM_Error GSM_FindGammuRC (INI_Section **result)
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)

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

GSM_StateMachine* GSM_AllocStateMachine ( void   ) 

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  ) 

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:
result Ini file representation
Returns:
Error code

void GSM_FreeStateMachine ( GSM_StateMachine s  ) 

Frees state machine structure allocated by GSM_AllocStateMachine.

Parameters:
s Pointer to state machine structure.

GSM_Config* GSM_GetConfig ( GSM_StateMachine s,
int  num 
)

Gets gammu configuration from state machine.

Parameters:
s State machine data
num Number 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:
s State machine data
Returns:
Number of sections.

GSM_Debug_Info* GSM_GetDebug ( GSM_StateMachine s  ) 

Gets debug information for state machine.

Parameters:
s State machine data
Returns:
Debug information.

GSM_ConnectionType GSM_GetUsedConnection ( GSM_StateMachine s  ) 

Gets number of active gammu configurations.

Parameters:
s State machine data
Returns:
Connection type.

GSM_Error GSM_InitConnection ( GSM_StateMachine s,
int  ReplyNum 
)

Initiates connection.

Parameters:
s State machine data
ReplyNum Number 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:
s State machine data
ReplyNum Number of replies to await (usually 3).
log_function Logging function, see GSM_SetDebugFunction.
user_data User data for logging function, see GSM_SetDebugFunction.
Returns:
Error code
See also:
GSM_SetDebugFunction

bool GSM_IsConnected ( GSM_StateMachine s  ) 

Detects whether state machine is connected.

Parameters:
s State 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_info Ini file representation.
cfg Where to store configuration.
num Number 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,
bool  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:
s State machine data
waitforreply Whether 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:
s State machine data
sections Number of sections.

GSM_Error GSM_TerminateConnection ( GSM_StateMachine s  ) 

Terminates connection.

Parameters:
s State machine data
Returns:
Error code


Generated on Mon Jan 5 15:44:31 2009 for Gammu API by  doxygen 1.5.6