- Startup, /* Not yet initialised */
- Initialised, /* Ready! */
- MessageSent, /* A command has been sent to the link(phone) */
- WaitingForResponse, /* We are waiting for a response from the link(phone) */
- ResponseReceived /* A response has been received - waiting for the phone layer to collect it */
-} GSM_State;
-
-/* How many message types we can wait for at one */
-#define SM_MAXWAITINGFOR 3
-
-
-/* All properties of the state machine */
-
-struct _GSM_Statemachine{
- GSM_State CurrentState;
- GSM_Link Link;
- GSM_Phone Phone;
-
- /* Store last message for resend purposes */
- u8 LastMsgType;
- u16 LastMsgSize;
- void *LastMsg;
-
- /* The responses we are waiting for */
- unsigned char NumWaitingFor;
- unsigned char NumReceived;
- unsigned char WaitingFor[SM_MAXWAITINGFOR];
- GSM_Error ResponseError[SM_MAXWAITINGFOR];
- /* Data structure to be filled in with the response */
- GSM_Data *Data[SM_MAXWAITINGFOR];
-};
-
-
-
-/* Define the structure used to hold pointers to the various API functions.
- This is in effect the master list of functions provided by the gnokii API.
- Modules containing the model specific code each contain one of these
- structures which is "filled in" with the corresponding function within the
- model specific code. If a function is not supported or not implemented, a
- generic not implemented function is used to return a GE_NOTIMPLEMENTED
- error code. */
-
-typedef struct {
-
- /* FIXME: comment this. */
-
- GSM_Error (*Initialise)( char *port_device, char *initlength,
- GSM_ConnectionType connection,
- void (*rlp_callback)(RLP_F96Frame *frame));
-
- void (*Terminate)(void);
-
- GSM_Error (*GetMemoryLocation)( GSM_PhonebookEntry *entry );
-
- GSM_Error (*WritePhonebookLocation)( GSM_PhonebookEntry *entry );
-
- GSM_Error (*GetSpeedDial)( GSM_SpeedDial *entry);
-
- GSM_Error (*SetSpeedDial)( GSM_SpeedDial *entry);
-
- GSM_Error (*GetMemoryStatus)( GSM_MemoryStatus *Status);
-
- GSM_Error (*GetSMSStatus)( GSM_SMSMemoryStatus *Status);
-
- GSM_Error (*GetSMSCenter)( SMS_MessageCenter *MessageCenter );
-
- GSM_Error (*SetSMSCenter)( SMS_MessageCenter *MessageCenter );
-
- GSM_Error (*GetSMSMessage)( GSM_SMSMessage *Message );
-
- GSM_Error (*DeleteSMSMessage)( GSM_SMSMessage *Message );
-
- GSM_Error (*SendSMSMessage)( GSM_SMSMessage *Message, int size );
-
- GSM_Error (*SaveSMSMessage)( GSM_SMSMessage *Message );
-
- /* If units is set to a valid GSM_RFUnits value, the code
- will return level in these units if it is able. Otherwise
- value will be returned as GRF_Arbitary. If phone doesn't
- support GetRFLevel, function returns GE_NOTSUPPORTED */
- GSM_Error (*GetRFLevel)( GSM_RFUnits *units, float *level );
-
- /* Works the same as GetRFLevel, except returns battery
- level if known. */
- GSM_Error (*GetBatteryLevel)( GSM_BatteryUnits *units, float *level );
-
- GSM_Error (*GetPowerSource)( GSM_PowerSource *source);
-
- GSM_Error (*GetDisplayStatus)( int *Status);
-
- GSM_Error (*EnterSecurityCode)( GSM_SecurityCode Code);
-
- GSM_Error (*GetSecurityCodeStatus)( int *Status );
-
- GSM_Error (*GetIMEI)( char *imei );
-
- GSM_Error (*GetRevision)( char *revision );
-
- GSM_Error (*GetModel)( char *model );
-
- GSM_Error (*GetManufacturer)( char *manufacturer );
-
- GSM_Error (*GetDateTime)( GSM_DateTime *date_time);
-
- GSM_Error (*SetDateTime)( GSM_DateTime *date_time);
-
- GSM_Error (*GetAlarm)( int alarm_number, GSM_DateTime *date_time );
-
- GSM_Error (*SetAlarm)( int alarm_number, GSM_DateTime *date_time );
-
- GSM_Error (*DialVoice)( char *Number);
-
- GSM_Error (*DialData)( char *Number, char type, void (* callpassup)(char c));
-
- GSM_Error (*GetIncomingCallNr)( char *Number );
-
- GSM_Error (*GetNetworkInfo) ( GSM_NetworkInfo *NetworkInfo );
-
- GSM_Error (*GetCalendarNote) ( GSM_CalendarNote *CalendarNote);
-
- GSM_Error (*WriteCalendarNote) ( GSM_CalendarNote *CalendarNote);
-
- GSM_Error (*DeleteCalendarNote) ( GSM_CalendarNote *CalendarNote);
-
- GSM_Error (*NetMonitor) ( unsigned char mode, char *Screen );
-
- GSM_Error (*SendDTMF) ( char *String );
-
- GSM_Error (*GetBitmap) ( GSM_Bitmap *Bitmap );
-
- GSM_Error (*SetBitmap) ( GSM_Bitmap *Bitmap );
-
- GSM_Error (*SetRingtone) ( GSM_Ringtone *ringtone );
-
- GSM_Error (*SendRingtone) ( GSM_Ringtone *ringtone, char *dest );
-
- GSM_Error (*Reset) ( unsigned char type );
-
- GSM_Error (*GetProfile) ( GSM_Profile *Profile );
-
- GSM_Error (*SetProfile) ( GSM_Profile *Profile );
-
- bool (*SendRLPFrame) ( RLP_F96Frame *frame, bool out_dtx );
-
- GSM_Error (*CancelCall) ();
+ GE_NONE = 0, /* No error. */
+ GE_DEVICEOPENFAILED, /* Couldn't open specified serial device. */
+ GE_UNKNOWNMODEL, /* Model specified isn't known/supported. */
+ GE_NOTSUPPORTED, /* We are sure, that function not supported by phone model */
+ GE_NOLINK, /* Couldn't establish link with phone. */
+ GE_TIMEOUT, /* Command timed out. */
+ GE_TRYAGAIN, /* Try again. */
+ GE_INVALIDSECURITYCODE, /* Invalid Security code. */
+ GE_NOTIMPLEMENTED, /* Command called isn't implemented in model. */
+ GE_INVALIDSMSLOCATION, /* Invalid SMS location. */
+ GE_INVALIDPHBOOKLOCATION, /* Invalid phonebook location. */ /*10*/
+ GE_INVALIDMEMORYTYPE, /* Invalid type of memory. */
+ GE_INVALIDSPEEDDIALLOCATION, /* Invalid speed dial location. */
+ GE_INVALIDCALNOTELOCATION,/* Invalid calendar note location. */
+ GE_INVALIDDATETIME, /* Invalid date, time or alarm specification. */
+ GE_EMPTYSMSLOCATION, /* SMS location is empty. */
+ GE_PHBOOKNAMETOOLONG, /* Phonebook name is too long. */
+ GE_PHBOOKNUMBERTOOLONG, /* Phonebook number is too long. */
+ GE_PHBOOKWRITEFAILED, /* Phonebook write failed. */
+ GE_SMSSENDOK, /* SMS was send correctly. */
+ GE_SMSSENDFAILED, /* SMS send fail. */ /*20*/
+ GE_SMSWAITING, /* Waiting for the next part of SMS. */
+ GE_SMSTOOLONG, /* SMS message too long. */
+ GE_NONEWCBRECEIVED, /* Attempt to read CB when no new CB received */
+ GE_INTERNALERROR, /* Problem occured internal to model specific code. */
+ GE_CANTOPENFILE, /* Can't open file with bitmap/ringtone */
+ GE_WRONGNUMBEROFCOLORS, /* Wrong number of colors in specified bitmap file */
+ GE_WRONGCOLORS, /* Wrong colors in bitmap file */
+ GE_INVALIDFILEFORMAT, /* Invalid format of file */
+ GE_SUBFORMATNOTSUPPORTED, /* Subformat of file not supported */
+ GE_TOOSHORT, /* Too short file, structure, etc. to read */ /*30*/
+ GE_TOOLONG, /* Too long file, structure, etc. to read */
+ GE_INVALIDIMAGESIZE, /* Invalid size of bitmap (in file, etc.) */
+ GE_BUSY, /* Command is still being executed. */
+ GE_UNKNOWN, /* Unknown error - well better than nothing!! */ /*34*/
+ GE_NOACCESS,
+ GE_USERCANCELED,
+ GE_MEMORYFULL,
+ GE_INVALIDRINGLOCATION,
+ GE_INSIDEBOOKMARKSMENU,
+ GE_INVALIDBOOKMARKLOCATION,
+ GE_INSIDESETTINGSMENU,
+ GE_INVALIDSETTINGSLOCATION,
+ GE_EMPTYSMSC,