Gammu internals
1.38.0
|
Data Structures | |
struct | GSM_Reply_Function |
struct | GSM_Device_Functions |
struct | GSM_Device |
struct | GSM_Protocol_Functions |
struct | GSM_Protocol |
struct | GSM_Phone_Data |
struct | GSM_Phone_Functions |
struct | GSM_Phone |
struct | _GSM_User |
struct | _GSM_StateMachine |
struct | GSM_Config |
Macros | |
#define | GSM_ENABLE_SERIALDEVICE |
#define | GSM_ENABLE_IRDADEVICE |
#define | MAX_CONFIG_NUM 5 |
#define | GSM_WaitForAutoLen(s, buffer, type, timeout, request) GSM_WaitFor(s,buffer,strlen(buffer),type,timeout,request) |
Typedefs | |
typedef struct _GSM_User | GSM_User |
typedef struct _GSM_StateMachine | GSM_StateMachine |
Variables | |
GSM_Device_Functions | ProxyDevice |
GSM_Phone_Functions | NAUTOPhone |
GSM_Phone_Functions | DUMMYPhone |
Generic state machine layer.
#define GSM_ENABLE_IRDADEVICE |
Definition at line 172 of file gsmstate.h.
#define GSM_ENABLE_SERIALDEVICE |
Definition at line 162 of file gsmstate.h.
#define GSM_WaitForAutoLen | ( | s, | |
buffer, | |||
type, | |||
timeout, | |||
request | |||
) | GSM_WaitFor(s,buffer,strlen(buffer),type,timeout,request) |
Wait for reply from the phone for ASCII strings without given length. This is just a convenience wrapper around GSM_WaitFor which fills in length.
s | State machine pointer. |
buffer | Data to write to phone. |
type | Type of request (for protocols where it makes sense). |
timeout | How long to wait for reply. |
request | ID of request |
Definition at line 1478 of file gsmstate.h.
#define MAX_CONFIG_NUM 5 |
Maximum number of concurrent configurations.
Definition at line 1399 of file gsmstate.h.
Referenced by GSM_FreeStateMachine(), GSM_GetConfig(), and GSM_SetConfigNum().
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 40 of file gammu-statemachine.h.
Definition at line 32 of file gsmstate.h.
enum GSM_Phone_RequestID |
Phone requests identificators, these are used for internally identifying which operation is being performed.
Definition at line 25 of file gsmreply.h.
GSM_Error GSM_AbortOperation | ( | GSM_StateMachine * | s | ) |
Aborts current operation.
This is thread safe call to abort any existing operations with the phone.
s | State machine data |
Definition at line 980 of file gsmstate.c.
References _GSM_StateMachine::Abort, ERR_NONE, and TRUE.
GSM_StateMachine* GSM_AllocStateMachine | ( | void | ) |
Allocates new clean state machine structure. You should free it then by GSM_FreeStateMachine.
Definition at line 1677 of file gsmstate.c.
References _GSM_StateMachine::Abort, _GSM_StateMachine::Config, _GSM_StateMachine::CurrentConfig, and FALSE.
GSM_Error GSM_DispatchMessage | ( | GSM_StateMachine * | s | ) |
Definition at line 1131 of file gsmstate.c.
References GSM_Protocol_Message::Buffer, CheckReplyFunctions(), D_ERROR, GSM_Phone::Data, DumpMessage(), ERR_FRAMENOTREQUESTED, ERR_NEEDANOTHERANSWER, ERR_NONE, ERR_TIMEOUT, ERR_UNKNOWNFRAME, ERR_UNKNOWNRESPONSE, FALSE, GSM_Reply_Function::Function, GSM_Phone::Functions, GSM_DumpMessageBinaryRecv(), GSM_DumpMessageTextRecv(), GSM_GetDI(), ID_None, GSM_Protocol_Message::Length, _GSM_StateMachine::MessagesCount, GSM_Phone_Functions::models, _GSM_StateMachine::Phone, GSM_Phone_Functions::ReplyFunctions, GSM_Phone_Data::RequestID, GSM_Phone_Data::RequestMsg, GSM_Phone_Data::SentMsg, smprintf(), smprintf_level(), TRUE, GSM_Protocol_Message::Type, _GSM_StateMachine::User, and _GSM_User::UserReplyFunctions.
void GSM_DumpMessageBinary | ( | GSM_StateMachine * | s, |
unsigned const char * | message, | ||
size_t | messagesize, | ||
int | type | ||
) |
Definition at line 1583 of file gsmstate.c.
References GSM_DumpMessageBinary_Custom().
void GSM_DumpMessageBinaryRecv | ( | GSM_StateMachine * | s, |
unsigned const char * | message, | ||
size_t | messagesize, | ||
int | type | ||
) |
Definition at line 1588 of file gsmstate.c.
References GSM_DumpMessageBinary_Custom().
Referenced by GSM_DispatchMessage().
void GSM_DumpMessageText | ( | GSM_StateMachine * | s, |
unsigned const char * | message, | ||
size_t | messagesize, | ||
int | type | ||
) |
Definition at line 1555 of file gsmstate.c.
References GSM_DumpMessageText_Custom().
void GSM_DumpMessageTextRecv | ( | GSM_StateMachine * | s, |
unsigned const char * | message, | ||
size_t | messagesize, | ||
int | type | ||
) |
Definition at line 1560 of file gsmstate.c.
References GSM_DumpMessageText_Custom().
Referenced by GSM_DispatchMessage().
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.
result | Ini file representation |
force_config | Forcing of custom path instead of autodetected one (if NULL, autodetection is performed). |
Definition at line 1209 of file gsmstate.c.
References ERR_NONE, FALLBACK_GAMMURC, GAMMURC_NAME, GSM_TryReadGammuRC(), PATH_MAX, and XDG_GAMMURC_NAME.
void GSM_FreeStateMachine | ( | GSM_StateMachine * | s | ) |
Frees state machine structure allocated by GSM_AllocStateMachine.
s | Pointer to state machine structure. |
Definition at line 1689 of file gsmstate.c.
References _GSM_StateMachine::Config, GSM_Config::Connection, GSM_Config::DebugFile, GSM_Config::Device, and MAX_CONFIG_NUM.
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.
s | State machine data |
num | Number of section to read, -1 for currently used. |
Definition at line 1301 of file gsmstate.c.
References _GSM_StateMachine::Config, _GSM_StateMachine::CurrentConfig, and MAX_CONFIG_NUM.
int GSM_GetConfigNum | ( | const GSM_StateMachine * | s | ) |
Gets number of active gammu configurations.
s | State machine data |
Definition at line 1312 of file gsmstate.c.
References _GSM_StateMachine::ConfigNum.
GSM_Debug_Info* GSM_GetDebug | ( | GSM_StateMachine * | s | ) |
Gets debug information for state machine.
s | State machine data |
Definition at line 1719 of file gsmstate.c.
References _GSM_StateMachine::di.
GSM_Debug_Info* GSM_GetDI | ( | GSM_StateMachine * | s | ) |
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.
s | State machine data |
Returns current debuging descriptor. It honors use_global flag.
Definition at line 70 of file gsmstate.c.
References _GSM_StateMachine::di, FALSE, GSM_global_debug, and _GSM_Debug_Info::use_global.
Referenced by GSM_DispatchMessage(), GSM_DumpMessageBinary_Custom(), GSM_DumpMessageText_Custom(), GSM_InitConnection_Log(), GSM_OSErrorInfo(), N71_65_DecodePhonebook(), PHONE_EncodeSMSFrame(), smprintf(), and smprintf_level().
GSM_ConnectionType GSM_GetUsedConnection | ( | GSM_StateMachine * | s | ) |
Gets number of active gammu configurations.
s | State machine data |
Definition at line 1709 of file gsmstate.c.
References _GSM_StateMachine::ConnectionType.
GSM_Error GSM_InitConnection | ( | GSM_StateMachine * | s, |
int | ReplyNum | ||
) |
Initiates connection.
s | State machine data |
ReplyNum | Number of replies to await (usually 3). |
Definition at line 914 of file gsmstate.c.
References GSM_InitConnection_Log(), GSM_none_debug, _GSM_Debug_Info::log_function, and _GSM_Debug_Info::user_data.
GSM_Error GSM_InitConnection_Log | ( | GSM_StateMachine * | s, |
int | ReplyNum, | ||
GSM_Log_Function | log_function, | ||
void * | user_data | ||
) |
Initiates connection with custom logging callback.
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. |
Definition at line 711 of file gsmstate.c.
References _GSM_StateMachine::Config, _GSM_StateMachine::ConfigNum, GSM_Config::Connection, _GSM_StateMachine::ConnectionType, _GSM_StateMachine::CurrentConfig, D_ERROR, GSM_Phone::Data, GSM_Config::DebugFile, GSM_Config::DebugLevel, GSM_Config::Device, _GSM_StateMachine::di, DL_BINARY, GSM_Phone_Data::EnableIncomingCall, GSM_Phone_Data::EnableIncomingCB, GSM_Phone_Data::EnableIncomingSMS, GSM_Phone_Data::EnableIncomingUSSD, ERR_DEVICEBUSY, ERR_DEVICELOCKED, ERR_DEVICENODRIVER, ERR_DEVICENOPERMISSION, ERR_DEVICENOTEXIST, ERR_DEVICENOTWORK, ERR_DEVICEOPENERROR, ERR_NONE, ERR_NOTSUPPORTED, ERR_TIMEOUT, ERR_UNCONFIGURED, ERR_UNKNOWNMODELSTRING, FALSE, GSM_Phone::Functions, GAMMU_VERSION, GCT_BLUEGNAPBUS, GCT_BLUEOBEX, GCT_BLUES60, GCT_IRDAGNAPBUS, GCT_IRDAOBEX, GCT_NONE, GCT_PROXYGNAPBUS, GCT_PROXYOBEX, GCT_PROXYS60, GSM_Phone_Functions::GetFirmware, GSM_Phone_Functions::GetManufacturer, GSM_Phone_Functions::GetModel, GetModelData(), GetOS(), GSM_CloseConnection(), GSM_GetCurrentDateTime(), GSM_GetDI(), GSM_LogError(), GSM_none_debug, GSM_OpenConnection(), GSM_RegisterAllConnections(), GSM_RegisterAllPhoneModules(), GSM_SetDebugFile(), GSM_SetDebugFunction(), GSM_SetDebugLevel(), GSM_TryGetModel(), GSM_Phone_Data::HardwareCache, _GSM_User::IncomingCall, _GSM_User::IncomingCB, _GSM_User::IncomingSMS, _GSM_User::IncomingUSSD, GSM_Phone_Functions::Initialise, _GSM_StateMachine::LockFile, GSM_Phone_Data::Manufacturer, GSM_Config::Model, GSM_Phone_Data::Model, GSM_Phone_Data::ModelInfo, _GSM_StateMachine::opened, _GSM_StateMachine::Phone, GSM_Phone_Functions::PostConnect, GSM_Phone_Data::ProductCodeCache, _GSM_StateMachine::ReplyNum, _GSM_User::SendSMSStatus, GSM_Phone_Data::SentMsg, GSM_Phone_Functions::SetDateTime, GSM_Phone_Functions::ShowStartInfo, smprintf(), smprintf_level(), _GSM_StateMachine::Speed, GSM_Config::StartInfo, GSM_Phone_Data::StartInfoCounter, StripSpaces(), GSM_Config::SyncTime, TRUE, _GSM_Debug_Info::use_global, GSM_Config::UseGlobalDebugFile, _GSM_StateMachine::User, _GSM_User::UserReplyFunctions, GSM_Phone_Data::VerDate, GSM_Phone_Data::VerNum, and GSM_Phone_Data::Version.
Referenced by GSM_InitConnection().
GSM_Error GSM_Install | ( | GSM_StateMachine * | s, |
const char * | ExtraPath, | ||
gboolean | Minimal | ||
) |
Installs applet required for configured connection to the phone.
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 |
Gets phone screenshot
Definition at line 1888 of file api.c.
References GSM_Phone::Functions, GSM_Phone_Functions::Install, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.
gboolean GSM_IsConnected | ( | GSM_StateMachine * | s | ) |
Detects whether state machine is connected.
s | State machine data |
Definition at line 976 of file gsmstate.c.
References GSM_Phone::Functions, _GSM_StateMachine::opened, and _GSM_StateMachine::Phone.
Referenced by GSM_ReadDevice().
void GSM_OSErrorInfo | ( | GSM_StateMachine * | s, |
const char * | description | ||
) |
Definition at line 1593 of file gsmstate.c.
References _GSM_Debug_Info::dl, DL_TEXT, DL_TEXTALL, DL_TEXTALLDATE, DL_TEXTDATE, DL_TEXTERROR, DL_TEXTERRORDATE, GSM_GetDI(), and smprintf().
Referenced by DUMMY_Error(), DUMMY_Initialise(), proxy_connect(), proxy_read(), and proxy_write().
GSM_Error GSM_ReadConfig | ( | INI_Section * | cfg_info, |
GSM_Config * | cfg, | ||
int | num | ||
) |
Processes gammu configuration.
cfg_info | Ini file representation. |
cfg | Where to store configuration. |
num | Number of section to read. |
Definition at line 1350 of file gsmstate.c.
References GSM_Config::Connection, GSM_Config::DebugFile, GSM_Config::DebugLevel, DEFAULT_CONNECTION, DEFAULT_DEBUG_FILE, DEFAULT_DEBUG_LEVEL, DEFAULT_DEVICE, DEFAULT_LOCK_DEVICE, DEFAULT_MODEL, DEFAULT_START_INFO, DEFAULT_SYNCHRONIZE_TIME, GSM_Config::Device, ERR_NONE, ERR_NONE_SECTION, ERR_UNCONFIGURED, ERR_UNKNOWN, ERR_USING_DEFAULTS, FALSE, GSM_ExpandUserPath(), GSM_SetFeatureString(), INI_GetBool(), INI_GetValue(), GSM_Config::LockDevice, GSM_Config::Model, _INI_Section::Next, GSM_Config::PhoneFeatures, _INI_Section::SectionName, GSM_Config::StartInfo, GSM_Config::SyncTime, GSM_Config::TextBirthday, GSM_Config::TextCall, GSM_Config::TextMeeting, GSM_Config::TextMemo, GSM_Config::TextReminder, TRUE, and GSM_Config::UseGlobalDebugFile.
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.
s | State machine data |
waitforreply | Whether to wait for some event |
Definition at line 919 of file gsmstate.c.
References _GSM_StateMachine::Abort, _GSM_StateMachine::Device, GSM_Device::Functions, GSM_Protocol::Functions, GSM_GetCurrentDateTime(), GSM_IsConnected(), _GSM_StateMachine::Protocol, GSM_Device_Functions::ReadDevice, GSM_DateTime::Second, and GSM_Protocol_Functions::StateMachine.
Referenced by GSM_WaitForOnce().
GSM_Error GSM_RegisterAllPhoneModules | ( | GSM_StateMachine * | s | ) |
Tries to register all modules to find one matching current configuration.
s | State machine pointer. |
Definition at line 383 of file gsmstate.c.
References _GSM_StateMachine::ConnectionType, _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, DUMMYPhone, ERR_NONE, ERR_UNKNOWNMODELSTRING, F_6230iCALLER, F_ALCATEL, F_FILES2, F_NOTES, F_OBEX, F_RADIO, F_SERIES40_30, F_SMS_FILES, F_TODO66, GSM_PhoneModel::features, GSM_Phone::Functions, GCT_AT, GCT_BLUEAT, GCT_BLUEFBUS2, GCT_BLUEGNAPBUS, GCT_BLUEOBEX, GCT_BLUEPHONET, GCT_BLUES60, GCT_DKU2AT, GCT_DKU2PHONET, GCT_DKU5FBUS2, GCT_FBUS2, GCT_FBUS2BLUE, GCT_FBUS2DLR3, GCT_FBUS2IRDA, GCT_FBUS2PL2303, GCT_FBUS2USB, GCT_IRDAAT, GCT_IRDAGNAPBUS, GCT_IRDAOBEX, GCT_IRDAPHONET, GCT_MBUS2, GCT_NONE, GCT_PHONETBLUE, GCT_PROXYAT, GCT_PROXYFBUS2, GCT_PROXYGNAPBUS, GCT_PROXYOBEX, GCT_PROXYPHONET, GCT_PROXYS60, GetModelData(), GSM_AddPhoneFeature(), GSM_IsPhoneFeatureAvailable(), GSM_RegisterModule(), GSM_Config::Model, GSM_Phone_Data::Model, GSM_PhoneModel::model, GSM_Phone_Functions::models, _GSM_StateMachine::Phone, and smprintf().
Referenced by GSM_InitConnection_Log().
void GSM_SetConfigNum | ( | GSM_StateMachine * | s, |
int | sections | ||
) |
Gets number of active gammu configurations.
s | State machine data |
sections | Number of sections. |
Definition at line 1317 of file gsmstate.c.
References _GSM_StateMachine::ConfigNum, and MAX_CONFIG_NUM.
GSM_Error GSM_TerminateConnection | ( | GSM_StateMachine * | s | ) |
Terminates connection.
s | State machine data |
Definition at line 949 of file gsmstate.c.
References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, _GSM_StateMachine::di, ERR_NONE, FALSE, GSM_Phone::Functions, GSM_CloseConnection(), GSM_SetDebugFileDescriptor(), _GSM_StateMachine::opened, _GSM_StateMachine::Phone, GSM_Phone_Functions::ShowStartInfo, smprintf(), GSM_Config::StartInfo, GSM_Phone_Data::StartInfoCounter, and GSM_Phone_Functions::Terminate.
GSM_Error GSM_WaitFor | ( | GSM_StateMachine * | s, |
unsigned const char * | buffer, | ||
size_t | length, | ||
int | type, | ||
int | timeout, | ||
GSM_Phone_RequestID | request | ||
) |
Wait for reply from the phone.
s | State machine pointer. |
buffer | Data to write to phone. |
length | Length of data in buffer. |
type | Type of request (for protocols where it makes sense). |
timeout | How long to wait for reply. |
request | ID of request |
Definition at line 1029 of file gsmstate.c.
References _GSM_StateMachine::CurrentConfig, D_ERROR, GSM_Phone::Data, GSM_Phone_Data::DispatchError, ERR_NONE, ERR_TIMEOUT, F_RESET_AFTER_TIMEOUT, FALSE, GSM_Protocol::Functions, GSM_Phone::Functions, GSM_IsPhoneFeatureAvailable(), GSM_Reset(), GSM_WaitForOnce(), ID_None, ID_Reset, GSM_Phone_Data::ModelInfo, _GSM_StateMachine::Phone, _GSM_StateMachine::Protocol, _GSM_StateMachine::ReplyNum, GSM_Phone_Data::RequestID, GSM_Phone_Functions::ShowStartInfo, smprintf_level(), GSM_Config::StartInfo, GSM_Phone_Data::StartInfoCounter, and GSM_Protocol_Functions::WriteMessage.
Referenced by NOKIA_EncodeDateTime().
GSM_Error GSM_WaitForOnce | ( | GSM_StateMachine * | s, |
unsigned const char * | buffer, | ||
size_t | length, | ||
int | type, | ||
int | timeout | ||
) |
Definition at line 986 of file gsmstate.c.
References _GSM_StateMachine::Abort, GSM_Protocol_Message::Buffer, GSM_Phone::Data, GSM_Phone_Data::DispatchError, ERR_ABORTED, ERR_TIMEOUT, GSM_ReadDevice(), ID_None, GSM_Protocol_Message::Length, _GSM_StateMachine::Phone, GSM_Phone_Data::RequestID, GSM_Phone_Data::SentMsg, TRUE, and GSM_Protocol_Message::Type.
Referenced by GSM_WaitFor().
GSM_Phone_Functions DUMMYPhone |
Definition at line 1964 of file dummy.c.
Referenced by GSM_RegisterAllPhoneModules(), and GSM_TryGetModel().
GSM_Phone_Functions NAUTOPhone |
Referenced by GSM_TryGetModel().
GSM_Device_Functions ProxyDevice |
Proxy device functions.
Definition at line 212 of file proxy.c.
Referenced by GSM_RegisterAllConnections().