Gammu internals  1.38.0
Info

Data Structures

struct  GSM_CodeName
 
struct  GSM_NetworkInfo
 
struct  GSM_SignalQuality
 
struct  GSM_BatteryCharge
 
struct  GSM_DisplayFeatures
 
struct  GSM_PhoneModel
 

Enumerations

enum  GSM_NetworkInfo_State {
  GSM_HomeNetwork = 1, GSM_NoNetwork, GSM_RoamingNetwork, GSM_RegistrationDenied,
  GSM_NetworkStatusUnknown, GSM_RequestingNetwork
}
 
enum  GSM_GPRS_State { GSM_GPRS_Detached = 1, GSM_GPRS_Attached }
 
enum  GSM_ChargeState {
  GSM_BatteryPowered = 1, GSM_BatteryConnected, GSM_BatteryCharging, GSM_BatteryNotConnected,
  GSM_BatteryFull, GSM_PowerFault
}
 
enum  GSM_BatteryType { GSM_BatteryUnknown = 0, GSM_BatteryNiMH = 1, GSM_BatteryLiIon, GSM_BatteryLiPol }
 
enum  GSM_DisplayFeature {
  GSM_CallActive = 1, GSM_SMSMemoryFull, GSM_FaxCall, GSM_UnreadSMS,
  GSM_DataCall, GSM_VoiceCall, GSM_KeypadLocked
}
 
enum  GSM_Feature {
  F_CAL33 = 1, F_CAL52, F_CAL82, F_RING_SM,
  F_NORING, F_NOPBKUNICODE, F_NOWAP, F_NOCALLER,
  F_NOPICTURE, F_NOPICTUREUNI, F_NOSTARTUP, F_NOCALENDAR,
  F_NOSTARTANI, F_POWER_BATT, F_PROFILES33, F_PROFILES51,
  F_MAGICBYTES, F_NODTMF, F_DISPSTATUS, F_NOCALLINFO,
  F_DAYMONTH, F_PBK35, F_PBKIMG, F_PBKTONEGAL,
  F_PBKSMSLIST, F_PBKUSER, F_6230iCALLER, F_RADIO,
  F_TODO63, F_TODO66, F_NOMIDI, F_BLUETOOTH,
  F_NOFILESYSTEM, F_NOMMS, F_NOGPRSPOINT, F_CAL35,
  F_CAL65, F_WAPMMSPROXY, F_CHAT, F_SYNCML,
  F_FILES2, F_NOFILE1, F_6230iWAP, F_PROFILES,
  F_SERIES40_30, F_SMS_FILES, F_3220_MMS, F_VOICETAGS,
  F_CAL62, F_NOTES, F_SMSONLYSENT, F_BROKENCPBS,
  F_M20SMS, F_SLOWWRITE, F_SMSME900, F_ALCATEL,
  F_OBEX, F_IRMC_LEVEL_2, F_MODE22, F_SMS_LOCATION_0,
  F_NO_UCS2, F_FORCE_UTF8, F_SMS_SM, F_SMS_ME,
  F_XLNK, F_SUBMIT_SIM_ONLY, F_PBK_UNICODE, F_SQWE,
  F_NO_ATOBEX, F_LENGTH_BYTES, F_BROKEN_CMGL, F_EXTRA_PBK_FIELD,
  F_CKPD_NO_UNICODE, F_CPROT, F_PBKFAVORITEMESSAGE, F_PBKNOPOSTAL,
  F_PBK_ENCODENUMBER, F_NO_CLIP, F_ENCODED_USSD, F_USE_SMSTEXTMODE,
  F_CPIN_NO_OK, F_FOUR_DIGIT_YEAR, F_SMS_NO_ME, F_SMS_NO_SM,
  F_SIEMENS_PBK, F_NO_ATSYNCML, F_MOBEX, F_TSSPCSW,
  F_DISABLE_GETNEXT, F_DISABLE_GETNEXTSMS, F_DISABLE_CMGL, F_NO_UTF8,
  F_SAMSUNG_UTF8, F_SMS_UTF8_ENCODED, F_NO_STOP_CUSD, F_READ_SMSTEXTMODE,
  F_RESET_AFTER_TIMEOUT, F_HUAWEI_INIT, F_ZTE_INIT, F_LAST_VALUE
}
 

Functions

const unsigned char * GSM_GetNetworkName (const char *NetworkCode)
 
const unsigned char * GSM_GetCountryName (const char *CountryCode)
 
const char * GSM_FeatureToString (GSM_Feature feature)
 
GSM_Feature GSM_FeatureFromString (const char *feature)
 
gboolean GSM_IsPhoneFeatureAvailable (GSM_PhoneModel *model, GSM_Feature feature)
 
gboolean GSM_AddPhoneFeature (GSM_PhoneModel *model, GSM_Feature feature)
 
GSM_Error GSM_GetManufacturer (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetModel (GSM_StateMachine *s, char *value)
 
GSM_PhoneModelGSM_GetModelInfo (GSM_StateMachine *s)
 
GSM_Error GSM_GetFirmware (GSM_StateMachine *s, char *value, char *date, double *num)
 
GSM_Error GSM_GetIMEI (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetOriginalIMEI (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetManufactureMonth (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetProductCode (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetHardware (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetPPM (GSM_StateMachine *s, char *value)
 
GSM_Error GSM_GetSIMIMSI (GSM_StateMachine *s, char *IMSI)
 
GSM_Error GSM_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat)
 
GSM_Error GSM_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig)
 
GSM_Error GSM_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
 
GSM_Error GSM_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features)
 

Variables

const GSM_CodeName GSM_Networks []
 
const GSM_CodeName GSM_Countries []
 

Detailed Description

Phone information.

Enumeration Type Documentation

§ GSM_BatteryType

Power source

Enumerator
GSM_BatteryUnknown 

Unknown battery

GSM_BatteryNiMH 

NiMH battery

GSM_BatteryLiIon 

Lithium Ion battery

GSM_BatteryLiPol 

Lithium Polymer battery

Definition at line 212 of file gammu-info.h.

§ GSM_ChargeState

Power source

Enumerator
GSM_BatteryPowered 

Powered from battery

GSM_BatteryConnected 

Powered from AC, battery connected

GSM_BatteryCharging 

Powered from AC, battery is charging

GSM_BatteryNotConnected 

Powered from AC, no battery

GSM_BatteryFull 

Powered from AC, battery is fully charged

GSM_PowerFault 

Power failure

Definition at line 180 of file gammu-info.h.

§ GSM_DisplayFeature

Display feature

Enumerator
GSM_CallActive 
GSM_SMSMemoryFull 

blinking envelope

GSM_FaxCall 
GSM_UnreadSMS 
GSM_DataCall 
GSM_VoiceCall 
GSM_KeypadLocked 

Definition at line 284 of file gammu-info.h.

§ GSM_Feature

Phone features definition. This is usually used for things, which can not be determined on run time.

Enumerator
F_CAL33 

Calendar,3310 style - 10 reminders, Unicode, 3 coding types

F_CAL52 

Calendar,5210 style - full Unicode, etc.

F_CAL82 

Calendar,8250 style - "normal", but with Unicode

F_RING_SM 

Ringtones returned in SM format - 33xx

F_NORING 

No ringtones

F_NOPBKUNICODE 

No phonebook in Unicode

F_NOWAP 

No WAP

F_NOCALLER 

No caller groups

F_NOPICTURE 

No Picture Images

F_NOPICTUREUNI 

No Picture Images text in Unicode

F_NOSTARTUP 

No startup logo

F_NOCALENDAR 

No calendar

F_NOSTARTANI 

Startup logo is not animated

F_POWER_BATT 

Network and battery level get from netmonitor

F_PROFILES33 

Phone profiles in 3310 style

F_PROFILES51 

Phone profiles in 5110 style

F_MAGICBYTES 

Phone can make authentication with magic bytes

F_NODTMF 

Phone can't send DTMF

F_DISPSTATUS 

Phone return display status

F_NOCALLINFO 

Phone does not return call info

F_DAYMONTH 

Day and month reversed in pbk, when compare to GSM models

F_PBK35 

Phonebook in 3510 style with ringtones ID

F_PBKIMG 

Phonebook in 7250 style with picture ID

F_PBKTONEGAL 

Phonebook with selecting ringtones from gallery

F_PBKSMSLIST 

Phonebook with SMS list

F_PBKUSER 

Phonebook with user ID

F_6230iCALLER 

Caller groups like in 6230i

F_RADIO 

Phone with FM radio

F_TODO63 

ToDo in 6310 style - 0x55 msg type

F_TODO66 

ToDo in 6610 style - like calendar, with date and other

F_NOMIDI 

No ringtones in MIDI

F_BLUETOOTH 

Bluetooth support

F_NOFILESYSTEM 

No images, ringtones, java saved in special filesystem

F_NOMMS 

No MMS sets in phone

F_NOGPRSPOINT 

GPRS point are not useable

F_CAL35 

Calendar,3510 style - Reminder,Call,Birthday

F_CAL65 

Calendar,6510 style - CBMM, method 3

F_WAPMMSPROXY 

WAP & MMS settings contains first & second proxy

F_CHAT 

Phone with Chat settings

F_SYNCML 

Phone with SyncML settings

F_FILES2 

Filesystem version 2

F_NOFILE1 

No filesystem version 1

F_6230iWAP 

WAP, MMS, etc. settings like in 6230i - unknown now

F_PROFILES 

Profiles support available

F_SERIES40_30 

Series 40 3.0

F_SMS_FILES 

SMS are read from filesystem files like in Series 40 3.0

F_3220_MMS 

MMS storage as in 3320

F_VOICETAGS 

Voice tags available

F_CAL62 

Calendar,6210 style - Call,Birthday,Memo,Meeting

F_NOTES 

Notes supported

F_SMSONLYSENT 

Phone supports only sent/unsent messages

F_BROKENCPBS 

CPBS on some memories can hang phone

F_M20SMS 

Siemens M20 like SMS handling

F_SLOWWRITE 

Use slower writing which some phone need

F_SMSME900 

SMS in ME start from location 900 - case of Sagem

F_ALCATEL 

Phone supports Alcatel protocol

F_OBEX 

Phone can switch to OBEX protocol from AT mode

F_IRMC_LEVEL_2 

Phone supports IrMC level 2 even if it doesn't report it

F_MODE22 

Switching to OBEX mode is done using AT+MODE=22

F_SMS_LOCATION_0 

Locations of SMS memories start from 0

F_NO_UCS2 

Phone does not support UCS2 even if it reports it.

F_FORCE_UTF8 

Phone returns strings in utf-8 even if it reports GSM.

F_SMS_SM 

Phone supports SM storage for SMS even if it does not report so.

F_SMS_ME 

Phone supports ME storage for SMS even if it does not report so.

F_XLNK 

Switching to OBEX mode is done using AT+XLNK.

F_SUBMIT_SIM_ONLY 

Submit messages can be saved on SM memory only.

F_PBK_UNICODE 

Prefer Unicode for phone book manipulations.

F_SQWE 

Switching to OBEX mode using AT^SQWE=3.

F_NO_ATOBEX 

Do not use OBEX/AT switching even if available.

F_LENGTH_BYTES 

Length of text for contact is in bytes and not chars.

F_BROKEN_CMGL 

CMGL does not list real locations for CMGR, these should be sequential.

F_EXTRA_PBK_FIELD 

Phonebook has extra numeric field at the end.

F_CKPD_NO_UNICODE 

Key presses can not be in unicode.

F_CPROT 

OBEX switching using AT+CPROT even if phone does not report it properly.

F_PBKFAVORITEMESSAGE 

Phonebook with favorite messaging numbers

F_PBKNOPOSTAL 

No support for postal entry in phonebook.

F_PBK_ENCODENUMBER 

Encode number in HEX charset.

F_NO_CLIP 

Do not use CLIP (phone hangs on it).

F_ENCODED_USSD 

USSD propmts and responses are encoded like PDU in SMS (packed 7-bit GSM encoding).

F_USE_SMSTEXTMODE 

Phone has better support for SMS text mode (rather than PDU mode)

F_CPIN_NO_OK 

Phone does not end CPIN reply with OK/ERROR.

F_FOUR_DIGIT_YEAR 

Phone require four digit year in time.

F_SMS_NO_ME 

Phone does not have a phone SMS memory even if it reports so.

F_SMS_NO_SM 

Phone does not have a SIM SMS memory even if it reports so.

F_SIEMENS_PBK 

Phone supports Siemens style phonebook even if it does not tell so.

F_NO_ATSYNCML 

Disable AT+SYNCML probing.

F_MOBEX 

Phone supports m-obex (usually Samsung phones).

F_TSSPCSW 

Phone supports m-obex (usually Samsung phones) using AT$TSSPCSW=1.

F_DISABLE_GETNEXT 

Disable GetNext* operations on the dummy phone.

F_DISABLE_GETNEXTSMS 

Disable GetNextSMS operations on the dummy phone.

F_DISABLE_CMGL 

CMGL hangs, so should not be used.

F_NO_UTF8 

Phone does not support UTF8 even if it reports it.

F_SAMSUNG_UTF8 

Samsung B2100 in UCS-2 mode provides a garbled UTF-8 instead.

F_SMS_UTF8_ENCODED 

SMS text is always UTF-8 encoded.

F_NO_STOP_CUSD 

Avoid forcibly stopping CUSD session.

F_READ_SMSTEXTMODE 

Reading og SMSes in text mode.

F_RESET_AFTER_TIMEOUT 

Reset phone after timeout.

F_HUAWEI_INIT 

Huawei style init.

F_ZTE_INIT 

ZTE style init.

F_LAST_VALUE 

Just marker of highest feature code, should not be used.

Definition at line 313 of file gammu-info.h.

313  {
314  /* n6110.c */
318  F_CAL33 = 1,
322  F_CAL52,
326  F_CAL82,
330  F_RING_SM,
334  F_NORING,
342  F_NOWAP,
346  F_NOCALLER,
350  F_NOPICTURE,
358  F_NOSTARTUP,
362  F_NOCALENDAR,
366  F_NOSTARTANI,
370  F_POWER_BATT,
374  F_PROFILES33,
378  F_PROFILES51,
382  F_MAGICBYTES,
386  F_NODTMF,
390  F_DISPSTATUS,
394  F_NOCALLINFO,
395 
396  /* n3320.c */
400  F_DAYMONTH,
401 
402  /* n6510.c */
406  F_PBK35,
410  F_PBKIMG,
414  F_PBKTONEGAL,
418  F_PBKSMSLIST,
422  F_PBKUSER,
430  F_RADIO,
434  F_TODO63,
438  F_TODO66,
442  F_NOMIDI,
446  F_BLUETOOTH,
454  F_NOMMS,
462  F_CAL35,
466  F_CAL65,
474  F_CHAT,
478  F_SYNCML,
482  F_FILES2,
486  F_NOFILE1,
490  F_6230iWAP,
494  F_PROFILES,
502  F_SMS_FILES,
506  F_3220_MMS,
507 
508  /* n6510.c && n7110.c */
512  F_VOICETAGS,
516  F_CAL62,
520  F_NOTES,
521 
522  /* AT modules */
530  F_BROKENCPBS,
534  F_M20SMS,
538  F_SLOWWRITE,
542  F_SMSME900,
546  F_ALCATEL,
550  F_OBEX,
558  F_MODE22,
566  F_NO_UCS2,
570  F_FORCE_UTF8,
575  F_SMS_SM,
580  F_SMS_ME,
584  F_XLNK,
596  F_SQWE,
600  F_NO_ATOBEX,
622  F_CPROT,
638  F_NO_CLIP,
651  F_CPIN_NO_OK,
659  F_SMS_NO_ME,
663  F_SMS_NO_SM,
676  F_MOBEX,
680  F_TSSPCSW,
696  F_NO_UTF8,
724  F_ZTE_INIT,
725 
730 } GSM_Feature;
GSM_Feature
Definition: gammu-info.h:313

§ GSM_GPRS_State

Status of GPRS connection.

Enumerator
GSM_GPRS_Detached 

GRPS is detached.

GSM_GPRS_Attached 

GRPS is attached.

Definition at line 98 of file gammu-info.h.

§ GSM_NetworkInfo_State

Status of network logging

Enumerator
GSM_HomeNetwork 

Home network for used SIM card.

GSM_NoNetwork 

No network available for used SIM card.

GSM_RoamingNetwork 

SIM card uses roaming.

GSM_RegistrationDenied 

Network registration denied - card blocked or expired or disabled.

GSM_NetworkStatusUnknown 

Unknown network status.

GSM_RequestingNetwork 

Network explicitely requested by user.

Definition at line 66 of file gammu-info.h.

Function Documentation

§ GSM_AddPhoneFeature()

gboolean GSM_AddPhoneFeature ( GSM_PhoneModel model,
GSM_Feature  feature 
)

Adds feature to phone configuration.

Parameters
modelModel information (you can get it using GSM_GetModelInfo).
featureGSM_Feature to check for.
Returns
True if phone has defined this feature.

Definition at line 1039 of file gsmphones.c.

References FALSE, GSM_PhoneModel::features, GSM_MAX_PHONE_FEATURES, and TRUE.

Referenced by GSM_RegisterAllPhoneModules().

1040 {
1041  int i = 0;
1042 
1043  for (i = 0; model->features[i] != 0; i++) {
1044  if (model->features[i] == feature) {
1045  return TRUE;
1046  }
1047  }
1048 
1049  if (i == GSM_MAX_PHONE_FEATURES) return FALSE;
1050  model->features[i++] = feature;
1051  model->features[i] = 0;
1052  return TRUE;
1053 }
#define FALSE
Definition: gammu-types.h:25
#define GSM_MAX_PHONE_FEATURES
Definition: gammu-limits.h:302
GSM_Feature features[GSM_MAX_PHONE_FEATURES+1]
Definition: gammu-info.h:776
#define TRUE
Definition: gammu-types.h:28

§ GSM_FeatureFromString()

GSM_Feature GSM_FeatureFromString ( const char *  feature)

Converts feature string to value.

Parameters
featureGSM_Feature string to convert.
Returns
GSM_Feature value, 0 on failure.

Definition at line 145 of file gsmphones.c.

References GSM_FeatureName::feature, and GSM_FeatureName::name.

Referenced by GSM_SetFeatureString().

146 {
147  GSM_FeatureName *current;
148  for (current = AllFeatureNames; current->feature != 0; current++) {
149  if (strcasecmp(current->name, feature) == 0)
150  return current->feature;
151  }
152  return 0;
153 }
GSM_Feature feature
Definition: gsmphones.c:28
char name[MAX_FEATURE_NAME_LEN+1]
Definition: gsmphones.c:27
GSM_FeatureName AllFeatureNames[]
Definition: gsmphones.c:31

§ GSM_FeatureToString()

const char* GSM_FeatureToString ( GSM_Feature  feature)

Converts feature value to string.

Parameters
featureGSM_Feature to convert.
Returns
Pointer to static string with string for specified feature, NULL on failure.

Definition at line 135 of file gsmphones.c.

References GSM_FeatureName::feature, and GSM_FeatureName::name.

136 {
137  GSM_FeatureName *current;
138  for (current = AllFeatureNames; current->feature != 0; current++) {
139  if (current->feature == feature)
140  return current->name;
141  }
142  return NULL;
143 }
GSM_Feature feature
Definition: gsmphones.c:28
char name[MAX_FEATURE_NAME_LEN+1]
Definition: gsmphones.c:27
GSM_FeatureName AllFeatureNames[]
Definition: gsmphones.c:31

§ GSM_GetBatteryCharge()

GSM_Error GSM_GetBatteryCharge ( GSM_StateMachine s,
GSM_BatteryCharge bat 
)

Gets information about batery charge and phone charging state.

Definition at line 411 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetBatteryCharge, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

412 {
413  GSM_Error err;
414 
416 
417  memset(bat, 0, sizeof(GSM_BatteryCharge));
418 
419  err = s->Phone.Functions->GetBatteryCharge(s, bat);
420  PRINT_LOG_ERROR(err);
421  return err;
422 }
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Error(* GetBatteryCharge)(GSM_StateMachine *s, GSM_BatteryCharge *bat)
Definition: gsmstate.h:866
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetCountryName()

const unsigned char* GSM_GetCountryName ( const char *  CountryCode)

Find country name from given country code.

Definition at line 2452 of file gsmnet.c.

References GSM_CodeName::Code, and EncodeUnicode().

2453 {
2454  int i = 0;
2455  static char retval[200];
2456 
2457  EncodeUnicode(retval,"unknown",7);
2458  for (i = 0; GSM_Countries[i].Code[0] != 0; i++) {
2459  if (!strncmp(GSM_Countries[i].Code, CountryCode, 3)) {
2460  EncodeUnicode(retval, GSM_Countries[i].Name, strlen(GSM_Countries[i].Name));
2461  break;
2462  }
2463  }
2464  return retval;
2465 }
const GSM_CodeName GSM_Countries[]
Definition: gsmnet.c:10
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
const char Code[8]
Definition: gammu-info.h:43

§ GSM_GetDisplayStatus()

GSM_Error GSM_GetDisplayStatus ( GSM_StateMachine s,
GSM_DisplayFeatures features 
)

Acquired display status.

Definition at line 385 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetDisplayStatus, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

386 {
387  GSM_Error err;
388 
390 
391  err = s->Phone.Functions->GetDisplayStatus(s, features);
392  PRINT_LOG_ERROR(err);
393  return err;
394 }
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Error(* GetDisplayStatus)(GSM_StateMachine *s, GSM_DisplayFeatures *features)
Definition: gsmstate.h:858
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetFirmware()

GSM_Error GSM_GetFirmware ( GSM_StateMachine s,
char *  value,
char *  date,
double *  num 
)

Reads firmware information from phone.

Parameters
sState machine pointer.
valuePointer where to store revision text
datePointer where to store revision date
numPointer where to store revision number
Returns
Error code.

Reads firmware information from phone.

Definition at line 108 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Data, GSM_Phone::Functions, GSM_Phone_Functions::GetFirmware, _GSM_StateMachine::Phone, PRINT_LOG_ERROR, GSM_Phone_Data::VerDate, GSM_Phone_Data::VerNum, and GSM_Phone_Data::Version.

109 {
110  GSM_Error err;
111 
113 
114  s->Phone.Data.Version[0] = '\0';
115  err = s->Phone.Functions->GetFirmware(s);
116  if (value != NULL) {
117  strcpy(value, s->Phone.Data.Version);
118  }
119  if (date != NULL) {
120  strcpy(date, s->Phone.Data.VerDate);
121  }
122  if (num != NULL) {
123  *num = s->Phone.Data.VerNum;
124  }
125 
126  PRINT_LOG_ERROR(err);
127  return err;
128 }
char VerDate[GSM_MAX_VERSION_DATE_LENGTH+1]
Definition: gsmstate.h:458
GSM_Error
Definition: gammu-error.h:23
char Version[GSM_MAX_VERSION_LENGTH+1]
Definition: gsmstate.h:454
GSM_Error(* GetFirmware)(GSM_StateMachine *s)
Definition: gsmstate.h:781
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Data Data
Definition: gsmstate.h:1369
double VerNum
Definition: gsmstate.h:462
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetHardware()

GSM_Error GSM_GetHardware ( GSM_StateMachine s,
char *  value 
)

Gets hardware information about device.

Definition at line 189 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetHardware, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

190 {
191  GSM_Error err;
192 
194 
195  err = s->Phone.Functions->GetHardware(s, value);
196  PRINT_LOG_ERROR(err);
197  return err;
198 }
GSM_Error(* GetHardware)(GSM_StateMachine *s, char *value)
Definition: gsmstate.h:801
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetIMEI()

GSM_Error GSM_GetIMEI ( GSM_StateMachine s,
char *  value 
)

Reads IMEI/serial number from phone.

Parameters
sState machine pointer.
valuePointer where to store IMEI, NULL to ignore.
Returns
Error code.

Reads IMEI/serial number from phone.

Definition at line 132 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Data, GSM_Phone::Functions, GSM_Phone_Functions::GetIMEI, GSM_Phone_Data::IMEI, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

133 {
134  GSM_Error err;
135 
137 
138  s->Phone.Data.IMEI[0] = '\0';
139  err = s->Phone.Functions->GetIMEI(s);
140  if (value != NULL) {
141  strcpy(value, s->Phone.Data.IMEI);
142  }
143 
144  PRINT_LOG_ERROR(err);
145  return err;
146 }
GSM_Error
Definition: gammu-error.h:23
char IMEI[GSM_MAX_IMEI_LENGTH+1]
Definition: gsmstate.h:437
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
GSM_Error(* GetIMEI)(GSM_StateMachine *s)
Definition: gsmstate.h:785

§ GSM_GetManufactureMonth()

GSM_Error GSM_GetManufactureMonth ( GSM_StateMachine s,
char *  value 
)

Gets month when device was manufactured.

Definition at line 163 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetManufactureMonth, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

164 {
165  GSM_Error err;
166 
168 
169  err = s->Phone.Functions->GetManufactureMonth(s, value);
170  PRINT_LOG_ERROR(err);
171  return err;
172 }
GSM_Error(* GetManufactureMonth)(GSM_StateMachine *s, char *value)
Definition: gsmstate.h:793
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetManufacturer()

GSM_Error GSM_GetManufacturer ( GSM_StateMachine s,
char *  value 
)

Reads manufacturer from phone.

Parameters
sState machine pointer.
valuePointer where to store manufacturer name
Returns
Error code.

Reads manufacturer from phone.

Definition at line 72 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Data, GSM_Phone::Functions, GSM_Phone_Functions::GetManufacturer, GSM_Phone_Data::Manufacturer, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

73 {
74  GSM_Error err;
75 
77 
78  s->Phone.Data.Manufacturer[0] = '\0';
79  err = s->Phone.Functions->GetManufacturer(s);
80  if (value != NULL) {
81  strcpy(value, s->Phone.Data.Manufacturer);
82  }
83 
84  PRINT_LOG_ERROR(err);
85  return err;
86 }
GSM_Error
Definition: gammu-error.h:23
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
Definition: gsmstate.h:441
GSM_Error(* GetManufacturer)(GSM_StateMachine *s)
Definition: gsmstate.h:773
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetModel()

GSM_Error GSM_GetModel ( GSM_StateMachine s,
char *  value 
)

Reads model from phone.

Parameters
sState machine pointer.
valuePointer where to store model name
Returns
Error code.

Reads model from phone.

Definition at line 90 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Data, GSM_Phone::Functions, GSM_Phone_Functions::GetModel, GSM_Phone_Data::Model, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

91 {
92  GSM_Error err;
93 
95 
96  s->Phone.Data.Model[0] = '\0';
97  err = s->Phone.Functions->GetModel(s);
98  if (value != NULL) {
99  strcpy(value, s->Phone.Data.Model);
100  }
101 
102  PRINT_LOG_ERROR(err);
103  return err;
104 }
GSM_Error
Definition: gammu-error.h:23
GSM_Error(* GetModel)(GSM_StateMachine *s)
Definition: gsmstate.h:777
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
char Model[GSM_MAX_MODEL_LENGTH+1]
Definition: gsmstate.h:445

§ GSM_GetModelInfo()

GSM_PhoneModel* GSM_GetModelInfo ( GSM_StateMachine s)

Reads model info from state machine.

Parameters
sState machine pointer.
Returns
Pointer to phone information structure.

Definition at line 1714 of file gsmstate.c.

References GSM_Phone::Data, GSM_Phone_Data::ModelInfo, and _GSM_StateMachine::Phone.

1715 {
1716  return s->Phone.Data.ModelInfo;
1717 }
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ GSM_GetNetworkInfo()

GSM_Error GSM_GetNetworkInfo ( GSM_StateMachine s,
GSM_NetworkInfo netinfo 
)

Gets network information.

Definition at line 439 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_NetworkInfo::CID, GSM_Phone::Functions, GSM_Phone_Functions::GetNetworkInfo, GSM_NetworkInfo::GPRS, GSM_NetworkStatusUnknown, GSM_NetworkInfo::LAC, GSM_NetworkInfo::NetworkCode, GSM_NetworkInfo::NetworkName, GSM_NetworkInfo::PacketCID, GSM_NetworkInfo::PacketLAC, GSM_NetworkInfo::PacketState, _GSM_StateMachine::Phone, PRINT_LOG_ERROR, and GSM_NetworkInfo::State.

440 {
441  GSM_Error err;
442 
444 
445  netinfo->CID[0] = 0;
446  netinfo->LAC[0] = 0;
447  netinfo->PacketCID[0] = 0;
448  netinfo->PacketLAC[0] = 0;
449  netinfo->State = GSM_NetworkStatusUnknown;
451  netinfo->NetworkName[0] = 0;
452  netinfo->NetworkName[1] = 0;
453  netinfo->NetworkCode[0] = 0;
454  netinfo->GPRS = 0;
455 
456  err = s->Phone.Functions->GetNetworkInfo(s, netinfo);
457  PRINT_LOG_ERROR(err);
458  return err;
459 }
unsigned char NetworkName[15 *2]
Definition: gammu-info.h:135
GSM_Error
Definition: gammu-error.h:23
char LAC[10]
Definition: gammu-info.h:131
char PacketCID[10]
Definition: gammu-info.h:143
char NetworkCode[10]
Definition: gammu-info.h:122
char CID[10]
Definition: gammu-info.h:118
GSM_Error(* GetNetworkInfo)(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
Definition: gsmstate.h:874
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_GPRS_State GPRS
Definition: gammu-info.h:139
GSM_NetworkInfo_State State
Definition: gammu-info.h:127
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
GSM_NetworkInfo_State PacketState
Definition: gammu-info.h:148
char PacketLAC[10]
Definition: gammu-info.h:152

§ GSM_GetNetworkName()

const unsigned char* GSM_GetNetworkName ( const char *  NetworkCode)

Find network name from given network code.

Definition at line 2420 of file gsmnet.c.

References GSM_CodeName::Code, and EncodeUnicode().

2421 {
2422  int i = 0;
2423  static char retval[200];
2424  char NetworkCodeFull[8];
2425  const char *pos;
2426 
2427  EncodeUnicode(retval, "unknown", 7);
2428 
2429  /* Too long string */
2430  if (strlen(NetworkCode) > 7 || strlen(NetworkCode) < 5) {
2431  return retval;
2432  }
2433  pos = strchr(NetworkCode, ' ');
2434  if (pos == NULL) {
2435  pos = NetworkCode + 3;
2436  } else {
2437  pos += 1;
2438  }
2439 
2440  sprintf(NetworkCodeFull, "%c%c%c %s", NetworkCode[0], NetworkCode[1], NetworkCode[2], pos);
2441 
2442  for (i = 0; GSM_Networks[i].Code[0] != 0; i++) {
2443  if (strcmp(GSM_Networks[i].Code, NetworkCodeFull) == 0) {
2444  EncodeUnicode(retval, GSM_Networks[i].Name, strlen(GSM_Networks[i].Name));
2445  break;
2446  }
2447  }
2448 
2449  return retval;
2450 }
const GSM_CodeName GSM_Networks[]
Definition: gsmnet.c:258
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
const char Code[8]
Definition: gammu-info.h:43

§ GSM_GetOriginalIMEI()

GSM_Error GSM_GetOriginalIMEI ( GSM_StateMachine s,
char *  value 
)

Gets date and time from phone.

Definition at line 150 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetOriginalIMEI, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

151 {
152  GSM_Error err;
153 
155 
156  err = s->Phone.Functions->GetOriginalIMEI(s, value);
157  PRINT_LOG_ERROR(err);
158  return err;
159 }
GSM_Error(* GetOriginalIMEI)(GSM_StateMachine *s, char *value)
Definition: gsmstate.h:789
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetPPM()

GSM_Error GSM_GetPPM ( GSM_StateMachine s,
char *  value 
)

Gets PPM (Post Programmable Memory) info from phone (in other words for Nokia get, which language pack is in phone)

Definition at line 203 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetPPM, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

204 {
205  GSM_Error err;
206 
208 
209  err = s->Phone.Functions->GetPPM(s, value);
210  PRINT_LOG_ERROR(err);
211  return err;
212 }
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
GSM_Error(* GetPPM)(GSM_StateMachine *s, char *value)
Definition: gsmstate.h:806

§ GSM_GetProductCode()

GSM_Error GSM_GetProductCode ( GSM_StateMachine s,
char *  value 
)

Gets product code of device.

Definition at line 176 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetProductCode, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

177 {
178  GSM_Error err;
179 
181 
182  err = s->Phone.Functions->GetProductCode(s, value);
183  PRINT_LOG_ERROR(err);
184  return err;
185 }
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
GSM_Error(* GetProductCode)(GSM_StateMachine *s, char *value)
Definition: gsmstate.h:797

§ GSM_GetSignalQuality()

GSM_Error GSM_GetSignalQuality ( GSM_StateMachine s,
GSM_SignalQuality sig 
)

Reads signal quality (strength and error rate).

Definition at line 426 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetSignalQuality, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

427 {
428  GSM_Error err;
429 
431 
432  err = s->Phone.Functions->GetSignalQuality(s, sig);
433  PRINT_LOG_ERROR(err);
434  return err;
435 }
GSM_Error
Definition: gammu-error.h:23
GSM_Error(* GetSignalQuality)(GSM_StateMachine *s, GSM_SignalQuality *sig)
Definition: gsmstate.h:870
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373

§ GSM_GetSIMIMSI()

GSM_Error GSM_GetSIMIMSI ( GSM_StateMachine s,
char *  IMSI 
)

Gets SIM IMSI from phone.

Definition at line 216 of file api.c.

References CHECK_PHONE_CONNECTION, GSM_Phone::Functions, GSM_Phone_Functions::GetSIMIMSI, _GSM_StateMachine::Phone, and PRINT_LOG_ERROR.

217 {
218  GSM_Error err;
219 
221 
222  err = s->Phone.Functions->GetSIMIMSI(s, IMSI);
223  PRINT_LOG_ERROR(err);
224  return err;
225 }
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define PRINT_LOG_ERROR(err)
Definition: api.c:28
#define CHECK_PHONE_CONNECTION()
Definition: api.c:38
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
GSM_Error(* GetSIMIMSI)(GSM_StateMachine *s, char *IMSI)
Definition: gsmstate.h:810

§ GSM_IsPhoneFeatureAvailable()

gboolean GSM_IsPhoneFeatureAvailable ( GSM_PhoneModel model,
GSM_Feature  feature 
)

Checks whether phone supports features.

Parameters
modelModel information (you can get it using GSM_GetModelInfo).
featureGSM_Feature to check for.
Returns
True if phone has defined this feature.

Definition at line 1026 of file gsmphones.c.

References FALSE, GSM_PhoneModel::features, and TRUE.

Referenced by DUMMY_GetNextCalendar(), DUMMY_GetNextMemory(), DUMMY_GetNextNote(), DUMMY_GetNextSMS(), DUMMY_GetNextToDo(), GSM_RegisterAllPhoneModules(), GSM_WaitFor(), N71_65_DecodePhonebook(), N71_65_EncodePhonebookFrame(), and NOKIA_EncodeDateTime().

1027 {
1028  int i;
1029 
1030  for (i = 0; model->features[i] != 0; i++) {
1031  if (model->features[i] == feature) {
1032  return TRUE;
1033  }
1034  }
1035 
1036  return FALSE;
1037 }
#define FALSE
Definition: gammu-types.h:25
GSM_Feature features[GSM_MAX_PHONE_FEATURES+1]
Definition: gammu-info.h:776
#define TRUE
Definition: gammu-types.h:28

Variable Documentation

§ GSM_Countries

const GSM_CodeName GSM_Countries[]

List of country codes, terminated by empty name/code.

Definition at line 10 of file gsmnet.c.

§ GSM_Networks

const GSM_CodeName GSM_Networks[]

List of network codes, terminated by empty name/code.

Definition at line 258 of file gsmnet.c.