Gammu internals  1.38.0
Error handling

Enumerations

enum  GSM_Error {
  ERR_NONE = 1, ERR_DEVICEOPENERROR, ERR_DEVICELOCKED, ERR_DEVICENOTEXIST,
  ERR_DEVICEBUSY, ERR_DEVICENOPERMISSION, ERR_DEVICENODRIVER, ERR_DEVICENOTWORK,
  ERR_DEVICEDTRRTSERROR, ERR_DEVICECHANGESPEEDERROR, ERR_DEVICEWRITEERROR, ERR_DEVICEREADERROR,
  ERR_DEVICEPARITYERROR, ERR_TIMEOUT, ERR_FRAMENOTREQUESTED, ERR_UNKNOWNRESPONSE,
  ERR_UNKNOWNFRAME, ERR_UNKNOWNCONNECTIONTYPESTRING, ERR_UNKNOWNMODELSTRING, ERR_SOURCENOTAVAILABLE,
  ERR_NOTSUPPORTED, ERR_EMPTY, ERR_SECURITYERROR, ERR_INVALIDLOCATION,
  ERR_NOTIMPLEMENTED, ERR_FULL, ERR_UNKNOWN, ERR_CANTOPENFILE,
  ERR_MOREMEMORY, ERR_PERMISSION, ERR_EMPTYSMSC, ERR_INSIDEPHONEMENU,
  ERR_NOTCONNECTED, ERR_WORKINPROGRESS, ERR_PHONEOFF, ERR_FILENOTSUPPORTED,
  ERR_BUG, ERR_CANCELED, ERR_NEEDANOTHERANSWER, ERR_OTHERCONNECTIONREQUIRED,
  ERR_WRONGCRC, ERR_INVALIDDATETIME, ERR_MEMORY, ERR_INVALIDDATA,
  ERR_FILEALREADYEXIST, ERR_FILENOTEXIST, ERR_SHOULDBEFOLDER, ERR_SHOULDBEFILE,
  ERR_NOSIM, ERR_GNAPPLETWRONG, ERR_FOLDERPART, ERR_FOLDERNOTEMPTY,
  ERR_DATACONVERTED, ERR_UNCONFIGURED, ERR_WRONGFOLDER, ERR_PHONE_INTERNAL,
  ERR_WRITING_FILE, ERR_NONE_SECTION, ERR_USING_DEFAULTS, ERR_CORRUPTED,
  ERR_BADFEATURE, ERR_DISABLED, ERR_SPECIFYCHANNEL, ERR_NOTRUNNING,
  ERR_NOSERVICE, ERR_BUSY, ERR_COULDNT_CONNECT, ERR_COULDNT_RESOLVE,
  ERR_GETTING_SMSC, ERR_ABORTED, ERR_INSTALL_NOT_FOUND, ERR_READ_ONLY,
  ERR_NETWORK_ERROR, ERR_DB_VERSION, ERR_DB_DRIVER, ERR_DB_CONFIG,
  ERR_DB_CONNECT, ERR_DB_TIMEOUT, ERR_SQL, ERR_LAST_VALUE
}
 

Functions

const char * GSM_ErrorString (GSM_Error e)
 
const char * GSM_ErrorName (GSM_Error e)
 

Detailed Description

Error handling and manipulation.

Enumeration Type Documentation

§ GSM_Error

enum GSM_Error

Error types.

Enumerator
ERR_NONE 

No error

ERR_DEVICEOPENERROR 

Error during opening device

ERR_DEVICELOCKED 

Device locked

ERR_DEVICENOTEXIST 

Device does not exits

ERR_DEVICEBUSY 

Device is busy

ERR_DEVICENOPERMISSION 

No permissions to open device

ERR_DEVICENODRIVER 

No driver installed for a device

ERR_DEVICENOTWORK 

Device doesn't seem to be working

ERR_DEVICEDTRRTSERROR 

Error during setting DTR/RTS in device

ERR_DEVICECHANGESPEEDERROR 

10 Error during changing speed in device

ERR_DEVICEWRITEERROR 

Error during writing device

ERR_DEVICEREADERROR 

Error during reading device

ERR_DEVICEPARITYERROR 

Can't set parity on device

ERR_TIMEOUT 

Command timed out

ERR_FRAMENOTREQUESTED 

Frame handled, but not requested in this moment

ERR_UNKNOWNRESPONSE 

Response not handled by gammu

ERR_UNKNOWNFRAME 

Frame not handled by gammu

ERR_UNKNOWNCONNECTIONTYPESTRING 

Unknown connection type given by user

ERR_UNKNOWNMODELSTRING 

Unknown model given by user

ERR_SOURCENOTAVAILABLE 

20 Some functions not compiled in your OS

ERR_NOTSUPPORTED 

Not supported by phone

ERR_EMPTY 

Empty entry or transfer end.

ERR_SECURITYERROR 

Not allowed

ERR_INVALIDLOCATION 

Too high or too low location...

ERR_NOTIMPLEMENTED 

Function not implemented

ERR_FULL 

Memory is full

ERR_UNKNOWN 

Unknown response from phone

ERR_CANTOPENFILE 

Error during opening file

ERR_MOREMEMORY 

More memory required

ERR_PERMISSION 

30 No permission

ERR_EMPTYSMSC 

SMSC number is empty

ERR_INSIDEPHONEMENU 

Inside phone menu - can't make something

ERR_NOTCONNECTED 

Phone NOT connected - can't make something

ERR_WORKINPROGRESS 

Work in progress

ERR_PHONEOFF 

Phone is disabled and connected to charger

ERR_FILENOTSUPPORTED 

File format not supported by Gammu

ERR_BUG 

Found bug in implementation or phone

ERR_CANCELED 

Action was canceled by user

ERR_NEEDANOTHERANSWER 

Inside Gammu: phone module need to send another answer frame

ERR_OTHERCONNECTIONREQUIRED 

40 You need other connectin for this operation.

ERR_WRONGCRC 

Wrong CRC

ERR_INVALIDDATETIME 

Invalid date/time

ERR_MEMORY 

Phone memory error, maybe it is read only

ERR_INVALIDDATA 

Invalid data given to phone

ERR_FILEALREADYEXIST 

File with specified name already exist

ERR_FILENOTEXIST 

File with specified name doesn't exist

ERR_SHOULDBEFOLDER 

You have to give folder (not file) name

ERR_SHOULDBEFILE 

You have to give file (not folder) name

ERR_NOSIM 

Can not access SIM card

ERR_GNAPPLETWRONG 

50 Invalid gnapplet version

ERR_FOLDERPART 

Only part of folders listed

ERR_FOLDERNOTEMPTY 

Folder is not empty

ERR_DATACONVERTED 

Data were converted

ERR_UNCONFIGURED 

Gammu is not configured.

ERR_WRONGFOLDER 

Wrong folder selected (eg. for SMS).

ERR_PHONE_INTERNAL 

Internal phone error (phone got crazy).

ERR_WRITING_FILE 

Could not write to a file (on local filesystem).

ERR_NONE_SECTION 

No such section exists.

ERR_USING_DEFAULTS 

Using default values.

ERR_CORRUPTED 

60 Corrupted data returned by phone.

ERR_BADFEATURE 

Bad feature string.

ERR_DISABLED 

Some functions not compiled in your OS

ERR_SPECIFYCHANNEL 

Bluetooth configuration requires channel option.

ERR_NOTRUNNING 

Service is not running.

ERR_NOSERVICE 

Service setup is missing.

ERR_BUSY 

Command failed. Try again.

ERR_COULDNT_CONNECT 

Can not connect to server.

ERR_COULDNT_RESOLVE 

Can not resolve host name.

ERR_GETTING_SMSC 

Failed to get SMSC number from phone.

ERR_ABORTED 

70 Operation aborted.

ERR_INSTALL_NOT_FOUND 

Installation data not found.

ERR_READ_ONLY 

Entry is read only.

ERR_NETWORK_ERROR 

Network error.

ERR_DB_VERSION 

Invalid database version.

ERR_DB_DRIVER 

Failed to initialize DB driver.

ERR_DB_CONFIG 

Failed to configure DB driver.

ERR_DB_CONNECT 

Failed to connect to database.

ERR_DB_TIMEOUT 

Database connection timeout.

ERR_SQL 

Error in executing SQL query.

ERR_LAST_VALUE 

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

Definition at line 23 of file gammu-error.h.

23  {
27  ERR_NONE = 1,
60 
102 
115  ERR_EMPTY,
131  ERR_FULL,
135  ERR_UNKNOWN,
144 
169  ERR_PHONEOFF,
177  ERR_BUG,
181  ERR_CANCELED,
186 
195  ERR_WRONGCRC,
203  ERR_MEMORY,
227  ERR_NOSIM,
228 
270 
283  ERR_DISABLED,
299  ERR_BUSY,
312 
317  ERR_ABORTED,
353  ERR_SQL,
354 
359 } GSM_Error;
GSM_Error
Definition: gammu-error.h:23

Function Documentation

§ GSM_ErrorName()

const char* GSM_ErrorName ( GSM_Error  e)

Returns name for error.

Parameters
eError code.
Returns
Text with error name

Definition at line 167 of file gsmcomon.c.

References PrintErrorEntry::ErrorName.

Referenced by GSM_LogError().

168 {
169  const char *def = NULL;
170  int i = 0;
171 
172  while (PrintErrorEntries[i].ErrorNum != 0) {
173  if (PrintErrorEntries[i].ErrorNum == e) {
174  def = PrintErrorEntries[i].ErrorName;
175  break;
176  }
177  i++;
178  }
179 
180  return def;
181 }
const char * ErrorName
Definition: gsmcomon.c:73
static PrintErrorEntry PrintErrorEntries[]
Definition: gsmcomon.c:83

§ GSM_ErrorString()

const char* GSM_ErrorString ( GSM_Error  e)

Returns text for error.

Parameters
eError code.
Returns
Text (in current locales) describing error

Definition at line 183 of file gsmcomon.c.

References dgettext, PrintErrorEntry::ErrorText, and N_.

Referenced by GSM_LogError().

184 {
185  const char *def = NULL;
186  int i = 0;
187 
188  while (PrintErrorEntries[i].ErrorNum != 0) {
189  if (PrintErrorEntries[i].ErrorNum == e) {
190  def = PrintErrorEntries[i].ErrorText;
191  break;
192  }
193  i++;
194  }
195  if (def == NULL) def = N_("Unknown error description.");
196 
197  return dgettext("libgammu", def);
198 }
#define dgettext(d, x)
Definition: locales.h:22
const char * ErrorText
Definition: gsmcomon.c:77
static PrintErrorEntry PrintErrorEntries[]
Definition: gsmcomon.c:83
#define N_(x)
Definition: locales.h:26