:pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Fri Dec 14 20:46 CET 2001
[gnokii.git] / include / gsm-common.h
1 /*
2
3   $Id$
4
5   G N O K I I
6
7   A Linux/Unix toolset and driver for Nokia mobile phones.
8
9   Copyright (C) 1999, 2000 Hugh Blemings & Pavel Janík ml.
10
11   Released under the terms of the GNU GPL, see file COPYING for more details.
12         
13   Header file for the definitions, enums etc. that are used by all models of
14   handset.
15
16 */
17
18 #ifndef __gsm_common_h
19 #define __gsm_common_h
20
21 #include <stdlib.h>
22
23 #include "data/rlp-common.h"
24 #include "gsm-sms.h"
25
26 /* Type of connection. Now we support serial connection with FBUS cable and
27    IR (only with 61x0 models) */
28
29 typedef enum {
30         GCT_Serial,   /* Serial connection. */
31         GCT_DAU9P,     /* Serial connection using DAU9P cable; use only with 6210/7110 if you want faster initialization */
32         GCT_Infrared, /* Infrared connection. */
33         GCT_Tekram,   /* Tekram Ir-Dongle */
34         GCT_Irda
35 } GSM_ConnectionType;
36
37 /* Maximum length of device name for serial port */
38
39 #define GSM_MAX_DEVICE_NAME_LENGTH (100)
40
41 /* Define an enum for specifying memory types for retrieving phonebook
42    entries, SMS messages etc. This type is not mobile specific - the model
43    code should take care of translation to mobile specific numbers - see 6110
44    code.
45    01/07/99:  Two letter codes follow GSM 07.07 release 6.2.0
46 */
47
48 typedef enum {
49         GMT_ME, /* Internal memory of the mobile equipment */
50         GMT_SM, /* SIM card memory */
51         GMT_FD, /* Fixed dial numbers */
52         GMT_ON, /* Own numbers */
53         GMT_EN, /* Emergency numbers */
54         GMT_DC, /* Dialled numbers */
55         GMT_RC, /* Received numbers */
56         GMT_MC, /* Missed numbers */
57         GMT_LD, /* Last dialed */
58         GMT_MT, /* combined ME and SIM phonebook */
59         GMT_TA, /* for compatibility only: TA=computer memory */
60         GMT_CB, /* Currently selected memory */
61         GMT_XX = 0xff   /* Error code for unknown memory type (returned by fbus-xxxx functions). */
62 } GSM_MemoryType;
63
64 /* Power source types */
65
66 typedef enum {
67         GPS_ACDC=1, /* AC/DC powered (charging) */
68         GPS_BATTERY /* Internal battery */
69 } GSM_PowerSource;
70
71 /* Definition of security codes. */
72
73 typedef enum {
74         GSCT_SecurityCode = 0x01, /* Security code. */
75         GSCT_Pin,                 /* PIN. */
76         GSCT_Pin2,                /* PIN 2. */
77         GSCT_Puk,                 /* PUK. */
78         GSCT_Puk2,                /* PUK 2. */
79         GSCT_None                 /* Code not needed. */
80 } GSM_SecurityCodeType;
81
82 /* Security code definition. */
83
84 typedef struct {
85         GSM_SecurityCodeType Type; /* Type of the code. */
86         char Code[10];             /* Actual code. */
87 } GSM_SecurityCode;
88
89 /* This structure is used to get the current network status */
90
91 typedef struct {
92         char NetworkCode[10]; /* GSM network code */
93         char CellID[10];      /* CellID */
94         char LAC[10];         /* LAC */
95 } GSM_NetworkInfo;
96
97 /* Limits for sizing of array in GSM_PhonebookEntry. Individual handsets may
98    not support these lengths so they have their own limits set. */
99
100 #define GSM_MAX_PHONEBOOK_NAME_LENGTH   (50)   /* For 7110 */
101 #define GSM_MAX_PHONEBOOK_NUMBER_LENGTH (48)   /* For 7110 */
102 #define GSM_MAX_PHONEBOOK_TEXT_LENGTH   (60)   /* For 7110 */
103 #define GSM_MAX_PHONEBOOK_SUB_ENTRIES   (8)    /* For 7110 */
104                                                /* 7110 is able to in one
105                                                 * entry 5 numbers and 2
106                                                 * texts [email,notice,postal] */
107
108 /* Here is a macro for models that do not support caller groups. */
109
110 #define GSM_GROUPS_NOT_SUPPORTED -1
111
112 /* This data type is used to report the number of used and free positions in
113    memory (sim or internal). */
114
115 typedef struct {
116         GSM_MemoryType MemoryType; /* Type of the memory */
117         int Used;                  /* Number of used positions */
118         int Free;                  /* Number of free positions */
119 } GSM_MemoryStatus;
120
121 /* Some phones (at the moment 6210/7110) supports extended phonebook
122    with additional data.  Here we have structures for them */
123
124 typedef enum {
125         GSM_General = 0x0a,
126         GSM_Mobile  = 0x03,
127         GSM_Work    = 0x06,
128         GSM_Fax     = 0x04,
129         GSM_Home    = 0x02
130 } GSM_Number_Type;
131
132 typedef enum {
133         GSM_Number  = 0x0b,
134         GSM_Note    = 0x0a,
135         GSM_Postal  = 0x09,
136         GSM_Email   = 0x08,
137         GSM_Name    = 0x07,
138         GSM_Date    = 0x13   /* Date is used for DC,RC,etc (last calls) */
139 } GSM_EntryType;
140
141 typedef struct {
142         bool AlarmEnabled; /* Is alarm set ? */
143         int Year;          /* The complete year specification - e.g. 1999. Y2K :-) */
144         int Month;         /* January = 1 */
145         int Day;
146         int Hour;
147         int Minute;
148         int Second;
149         int Timezone;      /* The difference between local time and GMT */
150 } GSM_DateTime;
151
152 typedef struct {
153         GSM_EntryType   EntryType;
154         GSM_Number_Type NumberType;
155         union {
156                 char Number[GSM_MAX_PHONEBOOK_TEXT_LENGTH + 1]; /* Number */
157                 GSM_DateTime Date;                         /* or the last calls list */
158         } data;
159         int             BlockNumber;
160 } GSM_SubPhonebookEntry;
161
162 /* Define datatype for phonebook entry, used for getting/writing phonebook
163    entries. */
164
165 typedef struct {
166         bool Empty;                                       /* Is this entry empty? */
167         char Name[GSM_MAX_PHONEBOOK_NAME_LENGTH + 1];     /* Plus 1 for
168                                                              nullterminator. */
169         char Number[GSM_MAX_PHONEBOOK_NUMBER_LENGTH + 1]; /* Number */
170         GSM_MemoryType MemoryType;                        /* Type of memory */
171         int Group;                                        /* Group */
172         int Location;                                     /* Location */
173         GSM_DateTime Date;                                /* The record date and time
174                                                              of the number. */
175         GSM_SubPhonebookEntry SubEntries[GSM_MAX_PHONEBOOK_SUB_ENTRIES];
176         /* For phones with
177          * additional phonebook
178          * entries */
179         int SubEntriesCount;                              /* Should be 0, if extended
180                                                              phonebook is not used */
181 } GSM_PhonebookEntry;
182
183 /* This define speed dialing entries. */
184
185 typedef struct {
186         int Number;                /* Which number is used to dialing? */
187         GSM_MemoryType MemoryType; /* Memory type of the number. */
188         int Location;              /* Location of the number in MemoryType. */
189 } GSM_SpeedDial;
190
191 /* Define enum used to describe what sort of date/time support is
192    available. */
193
194 typedef enum {
195         GDT_None,     /* The mobile phone doesn't support time and date. */
196         GDT_TimeOnly, /* The mobile phone supports only time. */
197         GDT_DateOnly, /* The mobile phone supports only date. */
198         GDT_DateTime  /* Wonderful phone - it supports date and time. */
199 } GSM_DateTimeSupport;
200
201 /* Define enums for RF units.  GRF_CSQ asks for units in form used
202    in AT+CSQ command as defined by GSM 07.07 */
203
204 typedef enum {
205         GRF_Arbitrary,
206         GRF_dBm,
207         GRF_mV,
208         GRF_uV,
209         GRF_CSQ,
210         GRF_Percentage
211 } GSM_RFUnits;
212
213 /* Define enums for Battery units. */
214
215 typedef enum {
216         GBU_Arbitrary,
217         GBU_Volts,
218         GBU_Minutes,
219         GBU_Percentage
220 } GSM_BatteryUnits;
221
222 /* Define enums for Calendar Note types */
223
224 typedef enum {
225         GCN_REMINDER=1, /* Reminder */
226         GCN_CALL,       /* Call */
227         GCN_MEETING,    /* Meeting */
228         GCN_BIRTHDAY    /* Birthday */
229 } GSM_CalendarNoteType;
230
231 /* Calendar note type */
232
233 typedef struct {
234         int Location;                   /* The number of the note in the phone memory */
235         GSM_CalendarNoteType Type;      /* The type of the note */
236         GSM_DateTime Time;              /* The time of the note */
237         GSM_DateTime Alarm;             /* The alarm of the note */
238         char Text[20];          /* The text of the note */
239         char Phone[20];         /* For Call only: the phone number */
240         double Recurance;               /* Recurance of the note */
241 } GSM_CalendarNote;
242
243 /* This structure is provided to allow common information about the particular
244    model to be looked up in a model independant way. Some of the values here
245    define minimum and maximum levels for values retrieved by the various Get
246    functions for example battery level. They are not defined as constants to
247    allow model specific code to set them during initialisation */
248
249 typedef struct {
250                 
251         char *Models; /* Models covered by this type, pipe '|' delimited. */
252
253 /* Minimum and maximum levels for RF signal strength. Units are as per the
254    setting of RFLevelUnits.  The setting of RFLevelUnits indicates the 
255    default or "native" units used.  In the case of the 3110 and 6110 series
256    these are arbitrary, ranging from 0 to 4. */
257
258         float MaxRFLevel;
259         float MinRFLevel;
260         GSM_RFUnits RFLevelUnits;
261
262 /* Minimum and maximum levels for battery level. Again, units are as per the
263    setting of GSM_BatteryLevelUnits.  The value that BatteryLevelUnits is set
264    to indicates the "native" or default value that the phone supports.  In the
265    case of the 3110 and 6110 series these are arbitrary, ranging from 0 to 4. */
266
267         float MaxBatteryLevel;
268         float MinBatteryLevel;
269         GSM_BatteryUnits BatteryLevelUnits;
270
271 /* FIXME: some very similar code is in common/misc.c */
272
273 /* Information about date, time and alarm support. In case of alarm
274    information we provide value for the number of alarms supported. */
275
276         GSM_DateTimeSupport DateTimeSupport;
277         GSM_DateTimeSupport AlarmSupport;
278         int MaximumAlarms;
279         u8 StartupLogoH;   /* Logo Widths and Heights - if supported */
280         u8 StartupLogoW;
281         u8 OpLogoH;
282         u8 OpLogoW;
283         u8 CallerLogoH;
284         u8 CallerLogoW;
285 } GSM_Information;
286
287 /* This enum is used for display status. */
288
289 typedef enum {
290         DS_Call_In_Progress, /* Call in progress. */
291         DS_Unknown,          /* The meaning is unknown now :-( */
292         DS_Unread_SMS,       /* There is Unread SMS. */
293         DS_Voice_Call,       /* Voice call active. */
294         DS_Fax_Call,         /* Fax call active. */
295         DS_Data_Call,        /* Data call active. */
296         DS_Keyboard_Lock,    /* Keyboard lock status. */
297         DS_SMS_Storage_Full  /* Full SMS Memory. */
298 } DisplayStatusEntity;
299
300 /* Bitmap types. */
301
302 typedef enum {
303         GSM_None=0,
304         GSM_StartupLogo,
305         GSM_OperatorLogo,
306         GSM_CallerLogo,
307         GSM_PictureImage,
308         GSM_WelcomeNoteText,
309         GSM_DealerNoteText
310 } GSM_Bitmap_Types;
311
312 #define GSM_MAX_BITMAP_SIZE 864
313
314 /* Structure to hold incoming/outgoing bitmaps (and welcome-notes). */
315
316 typedef struct {
317         u8 height;               /* Bitmap height (pixels) */
318         u8 width;                /* Bitmap width (pixels) */
319         u16 size;                /* Bitmap size (bytes) */
320         GSM_Bitmap_Types type;   /* Bitmap type */
321         char netcode[7];         /* Network operator code */
322         char text[256];          /* Text used for welcome-note or callergroup name */
323         char dealertext[256];    /* Text used for dealer welcome-note */
324         bool dealerset;          /* Is dealer welcome-note set now ? */
325         unsigned char bitmap[GSM_MAX_BITMAP_SIZE]; /* Actual Bitmap */ 
326         char number;             /* Caller group number */
327         char ringtone;           /* Ringtone no sent with caller group */
328 } GSM_Bitmap;
329
330
331 /* NoteValue is encoded as octave(scale)*14 + note */
332 /* where for note: c=0, d=2, e=4 .... */
333 /* ie. c#=1 and 5 and 13 are invalid */
334 /* note=255 means a pause */
335
336 #define MAX_RINGTONE_NOTES 256
337
338 /* Structure to hold note of ringtone. */
339
340 typedef struct {
341         u8 duration;
342         u8 note;
343 } GSM_RingtoneNote;
344
345 /* Structure to hold ringtones. */
346
347 typedef struct {
348         char name[20];
349         u8 tempo;
350         u8 NrNotes;
351         GSM_RingtoneNote notes[MAX_RINGTONE_NOTES];
352 } GSM_Ringtone;
353   
354 /* Structure to hold profile entries. */
355
356 typedef struct {
357         int Number;          /* The number of the profile. */
358         char Name[40];       /* The name of the profile. */
359         int DefaultName;     /* 0-6, when default name is used, -1, when not. */
360         int KeypadTone;      /* Volume level for keypad tones. */
361         int Lights;          /* Lights on/off. */
362         int CallAlert;       /* Incoming call alert. */
363         int Ringtone;        /* Ringtone for incoming call alert. */
364         int Volume;          /* Volume of the ringing. */
365         int MessageTone;     /* The tone for message indication. */
366         int WarningTone;     /* The tone for warning messages. */
367         int Vibration;       /* Vibration? */
368         int CallerGroups;    /* CallerGroups. */
369         int AutomaticAnswer; /* Does the phone auto-answer incoming call? */
370 } GSM_Profile;
371
372
373 #define FO_SUBMIT       0x01
374 #define FO_RD           0x40
375 #define FO_VPF_NONE     0x00
376 #define FO_VPF_REL      0x10
377 #define FO_VPF_ABS      0x18
378 #define FO_VPF_ENH      0x08
379 #define FO_SRR          0x20
380 #define FO_UDHI         0x40
381 #define FO_RP           0x80
382 #define FO_DEFAULT      (FO_SUBMIT | FO_VPF_REL | FO_SRR)
383
384 #define PID_DEFAULT     0x00
385 #define PID_TYPE0       0x40
386 #define PID_REPLACE1    0x41
387 #define PID_REPLACE2    0x42
388 #define PID_REPLACE3    0x43
389 #define PID_REPLACE4    0x44
390 #define PID_REPLACE5    0x45
391 #define PID_REPLACE6    0x46
392 #define PID_REPLACE7    0x47
393 #define PID_RETURN_CALL 0x5f
394
395 #define DCS_DEFAULT     0x00
396 #define DCS_MSG_WAIT_VOICE_DISCARD      0xc8
397 #define DCS_MSG_WAIT_VOICE_OFF          0xc0
398 #define DCS_MSG_WAIT_VOICE_STORE        0xd8
399 #define DCS_DATA        0xf4
400 #define DCS_CLASS0      0xf0
401 #define DCS_CLASS1      0xf1
402 #define DCS_CLASS2      0xf2
403 #define DCS_CLASS3      0xf3
404
405 /* Limits for IMEI, Revision and Model string storage. */
406 #define GSM_MAX_IMEI_LENGTH     (20)
407 #define GSM_MAX_REVISION_LENGTH (6)
408 #define GSM_MAX_MODEL_LENGTH    (6)
409
410 /* Data structures for the call divert */
411 typedef enum {
412         GSM_CDV_Busy = 0x01,
413         GSM_CDV_NoAnswer,
414         GSM_CDV_OutOfReach,
415         GSM_CDV_NotAvailable,
416         GSM_CDV_AllTypes
417 } GSM_CDV_DivertTypes;
418
419 typedef enum {
420         GSM_CDV_VoiceCalls = 0x01,
421         GSM_CDV_FaxCalls,
422         GSM_CDV_DataCalls,
423         GSM_CDV_AllCalls
424 } GSM_CDV_CallTypes;
425
426 typedef enum {
427         GSM_CDV_Disable  = 0x00,
428         GSM_CDV_Enable   = 0x01,
429         GSM_CDV_Query    = 0x02,
430         GSM_CDV_Register = 0x03,
431         GSM_CDV_Erasure  = 0x04
432 } GSM_CDV_Opers;
433
434 typedef struct {
435         GSM_CDV_DivertTypes DType;
436         GSM_CDV_CallTypes   CType;
437         GSM_CDV_Opers       Operation;
438         SMS_Number          Number;
439         unsigned int        Timeout;
440 } GSM_CallDivert;
441
442 /* This is a generic holder for high level information - eg a GSM_Bitmap */
443
444 typedef struct {
445         SMS_Folder *SMSFolder;
446         SMS_FolderList *SMSFolderList;
447         GSM_SMSMessage *SMSMessage;
448         GSM_PhonebookEntry *PhonebookEntry;
449         GSM_SpeedDial *SpeedDial;
450         GSM_MemoryStatus *MemoryStatus;
451         GSM_SMSMemoryStatus *SMSStatus;
452         SMS_MessageCenter *MessageCenter;
453         char *Imei;
454         char *Revision;
455         char *Model;
456         char *Manufacturer;
457         GSM_NetworkInfo *NetworkInfo;
458         GSM_CalendarNote *CalendarNote;
459         GSM_Bitmap *Bitmap;
460         GSM_Ringtone *Ringtone;
461         GSM_Profile *Profile;
462         GSM_BatteryUnits *BatteryUnits;
463         float *BatteryLevel;
464         GSM_RFUnits *RFUnits;
465         float *RFLevel;
466         GSM_Error (*OutputFn)(char *Display, char *Indicators);
467         char *IncomingCallNr;
468         GSM_PowerSource *PowerSource;
469         GSM_DateTime *DateTime;
470         GSM_CallDivert *CallDivert;
471 } GSM_Data;
472
473
474 /* Global structures intended to be independant of phone etc */
475 /* Obviously currently rather Nokia biased but I think most things */
476 /* (eg at commands) can be enumerated */
477
478
479 /* A structure to hold information about the particular link */
480 /* The link comes 'under' the phone */
481 typedef struct {
482         char PortDevice[20];   /* The port device */
483         int InitLength;        /* Number of chars sent to sync the serial port */
484         GSM_ConnectionType ConnectionType;   /* Connection type, serial, ir etc */
485
486         /* A regularly called loop function */
487         /* timeout can be used to make the function block or not */
488         GSM_Error (*Loop)(struct timeval *timeout);
489
490         /* A pointer to the function used to send out a message */
491         /* This is used by the phone specific code to send a message over the link */
492         GSM_Error (*SendMessage)(u16 messagesize, u8 messagetype, void *message);
493
494 } GSM_Link;
495
496
497 /* Small structure used in GSM_Phone */
498 /* Messagetype is passed to the function in case it is a 'generic' one */
499 typedef struct {
500         u8 MessageType;
501         GSM_Error (*Functions)(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
502 } GSM_IncomingFunctionType;
503
504 typedef enum {
505         GOP_Init,
506         GOP_GetModel,
507         GOP_GetRevision,
508         GOP_GetImei,
509         GOP_GetManufacturer,
510         GOP_Identify,
511         GOP_GetBitmap,
512         GOP_SetBitmap,
513         GOP_GetBatteryLevel,
514         GOP_GetRFLevel,
515         GOP_DisplayOutput,
516         GOP_GetMemoryStatus,
517         GOP_ReadPhonebook,
518         GOP_WritePhonebook,
519         GOP_GetPowersource,
520         GOP_GetAlarm,
521         GOP_GetSMSStatus,
522         GOP_GetIncomingCallNr,
523         GOP_GetNetworkInfo,
524         GOP_GetSMS,
525         GOP_DeleteSMS,
526         GOP_SendSMS,
527         GOP_GetSpeedDial,
528         GOP_GetSMSCenter,
529         GOP_GetDateTime,
530         GOP_GetCalendarNote,
531         GOP_CallDivert,
532         GOP_Max,        /* don't append anything after this entry */
533 } GSM_Operation;
534
535 /* This structure contains the 'callups' needed by the statemachine */
536 /* to deal with messages from the phone and other information */
537
538 typedef struct _GSM_Statemachine GSM_Statemachine; 
539
540 typedef struct {
541         /* These make up a list of functions, one for each message type and NULL terminated */
542         GSM_IncomingFunctionType *IncomingFunctions;
543         GSM_Error (*DefaultFunction)(int messagetype, unsigned char *buffer, int length);
544         GSM_Information Info;
545         GSM_Error (*Functions)(GSM_Operation op, GSM_Data *data, GSM_Statemachine *state);
546 } GSM_Phone;
547
548
549 /* The states the statemachine can take */
550
551 typedef enum {
552         Startup,            /* Not yet initialised */
553         Initialised,        /* Ready! */
554         MessageSent,        /* A command has been sent to the link(phone) */ 
555         WaitingForResponse, /* We are waiting for a response from the link(phone) */
556         ResponseReceived    /* A response has been received - waiting for the phone layer to collect it */
557 } GSM_State;
558
559 /* How many message types we can wait for at one */
560 #define SM_MAXWAITINGFOR 3
561
562
563 /* All properties of the state machine */
564
565 struct _GSM_Statemachine{
566         GSM_State CurrentState;
567         GSM_Link Link;
568         GSM_Phone Phone;
569         
570         /* Store last message for resend purposes */
571         u8 LastMsgType;
572         u16 LastMsgSize;
573         void *LastMsg;
574
575         /* The responses we are waiting for */
576         unsigned char NumWaitingFor;
577         unsigned char NumReceived;
578         unsigned char WaitingFor[SM_MAXWAITINGFOR];
579         GSM_Error ResponseError[SM_MAXWAITINGFOR];
580         /* Data structure to be filled in with the response */
581         GSM_Data *Data[SM_MAXWAITINGFOR];
582 };
583
584
585  
586 /* Define the structure used to hold pointers to the various API functions.
587    This is in effect the master list of functions provided by the gnokii API.
588    Modules containing the model specific code each contain one of these
589    structures which is "filled in" with the corresponding function within the
590    model specific code.  If a function is not supported or not implemented, a
591    generic not implemented function is used to return a GE_NOTIMPLEMENTED
592    error code. */
593
594 typedef struct {
595
596         /* FIXME: comment this. */
597
598         GSM_Error (*Initialise)( char *port_device, char *initlength,
599                                  GSM_ConnectionType connection,
600                                  void (*rlp_callback)(RLP_F96Frame *frame));
601
602         void (*Terminate)(void);        
603
604         GSM_Error (*GetMemoryLocation)( GSM_PhonebookEntry *entry );
605
606         GSM_Error (*WritePhonebookLocation)( GSM_PhonebookEntry *entry );
607
608         GSM_Error (*GetSpeedDial)( GSM_SpeedDial *entry);
609
610         GSM_Error (*SetSpeedDial)( GSM_SpeedDial *entry);
611
612         GSM_Error (*GetMemoryStatus)( GSM_MemoryStatus *Status);
613
614         GSM_Error (*GetSMSStatus)( GSM_SMSMemoryStatus *Status);
615
616         GSM_Error (*GetSMSCenter)( SMS_MessageCenter *MessageCenter );
617
618         GSM_Error (*SetSMSCenter)( SMS_MessageCenter *MessageCenter );
619
620         GSM_Error (*GetSMSMessage)( GSM_SMSMessage *Message );
621
622         GSM_Error (*DeleteSMSMessage)( GSM_SMSMessage *Message );
623
624         GSM_Error (*SendSMSMessage)( GSM_SMSMessage *Message, int size );
625
626         GSM_Error (*SaveSMSMessage)( GSM_SMSMessage *Message );
627
628         /* If units is set to a valid GSM_RFUnits value, the code
629            will return level in these units if it is able.  Otherwise
630            value will be returned as GRF_Arbitary.  If phone doesn't
631            support GetRFLevel, function returns GE_NOTSUPPORTED */
632         GSM_Error (*GetRFLevel)( GSM_RFUnits *units, float *level );
633
634         /* Works the same as GetRFLevel, except returns battery
635            level if known. */
636         GSM_Error (*GetBatteryLevel)( GSM_BatteryUnits *units, float *level );
637
638         GSM_Error (*GetPowerSource)( GSM_PowerSource *source);
639
640         GSM_Error (*GetDisplayStatus)( int *Status);
641
642         GSM_Error (*EnterSecurityCode)( GSM_SecurityCode Code);
643
644         GSM_Error (*GetSecurityCodeStatus)( int *Status );
645
646         GSM_Error (*GetIMEI)( char *imei );
647
648         GSM_Error (*GetRevision)( char *revision );
649
650         GSM_Error (*GetModel)( char *model );
651
652         GSM_Error (*GetManufacturer)( char *manufacturer );
653
654         GSM_Error (*GetDateTime)( GSM_DateTime *date_time);
655
656         GSM_Error (*SetDateTime)( GSM_DateTime *date_time);
657
658         GSM_Error (*GetAlarm)( int alarm_number, GSM_DateTime *date_time );
659
660         GSM_Error (*SetAlarm)( int alarm_number, GSM_DateTime *date_time );
661
662         GSM_Error (*DialVoice)( char *Number);
663
664         GSM_Error (*DialData)( char *Number, char type, void (* callpassup)(char c));
665
666         GSM_Error (*GetIncomingCallNr)( char *Number );
667
668         GSM_Error (*GetNetworkInfo) ( GSM_NetworkInfo *NetworkInfo );
669
670         GSM_Error (*GetCalendarNote) ( GSM_CalendarNote *CalendarNote);
671
672         GSM_Error (*WriteCalendarNote) ( GSM_CalendarNote *CalendarNote);
673
674         GSM_Error (*DeleteCalendarNote) ( GSM_CalendarNote *CalendarNote);
675
676         GSM_Error (*NetMonitor) ( unsigned char mode, char *Screen );
677
678         GSM_Error (*SendDTMF) ( char *String );
679
680         GSM_Error (*GetBitmap) ( GSM_Bitmap *Bitmap );
681   
682         GSM_Error (*SetBitmap) ( GSM_Bitmap *Bitmap );
683
684         GSM_Error (*SetRingtone) ( GSM_Ringtone *ringtone );
685
686         GSM_Error (*SendRingtone) ( GSM_Ringtone *ringtone, char *dest );
687
688         GSM_Error (*Reset) ( unsigned char type );
689
690         GSM_Error (*GetProfile) ( GSM_Profile *Profile );
691
692         GSM_Error (*SetProfile) ( GSM_Profile *Profile );
693   
694         bool      (*SendRLPFrame) ( RLP_F96Frame *frame, bool out_dtx );
695
696         GSM_Error (*CancelCall) ();
697   
698         GSM_Error (*EnableDisplayOutput) ();
699   
700         GSM_Error (*DisableDisplayOutput) ();
701  
702         GSM_Error (*EnableCellBroadcast) ();
703
704         GSM_Error (*DisableCellBroadcast) ();
705
706         GSM_Error (*ReadCellBroadcast) ( GSM_CBMessage *Message );
707   
708         GSM_Error (*SetKey) (int c, int up);
709   
710         GSM_Error (*HandleString) (char *s);
711         
712         GSM_Error (*AnswerCall) (char s);
713
714 } GSM_Functions;
715
716 /* Undefined functions in fbus/mbus files */
717 extern GSM_Error Unimplemented(void);
718 #define UNIMPLEMENTED (void *) Unimplemented
719
720 extern GSM_MemoryType StrToMemoryType (const char *s);
721
722 inline void GSM_DataClear(GSM_Data *data);
723
724 #endif  /* __gsm_common_h */