Implemented connection type "tcp" (GCT_TCP), use <hostname>:<port> as "port"
[gnokii.git] / include / fbus-3810.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 3810 code.
14
15   $Log$
16   Revision 1.1.1.1  2002/04/03 00:08:17  short
17   Found in "gnokii-working" directory, some November-patches version
18
19   Revision 1.51  2001/06/28 00:40:57  pkot
20   8bit SMS handling in 3810 series - old structure yet (Tamas Bondar)
21
22   Revision 1.50  2001/06/28 00:28:45  pkot
23   Small docs updates (Pawel Kot)
24         
25
26 */
27
28 #ifndef     __fbus_3810_h
29 #define     __fbus_3810_h
30
31 #ifndef     __gsm_common_h
32 #include    "gsm-common.h"  /* Needed for GSM_Error etc. */
33 #endif
34
35     /* Global variables */
36 extern bool                 FB38_LinkOK;
37 extern GSM_Functions        FB38_Functions;
38 extern GSM_Information      FB38_Information;
39 extern void                 (*FB38_RLP_RXCallback)(RLP_F96Frame *frame);
40
41     /* Prototypes for the functions designed to be used externally. */
42 GSM_Error   FB38_Initialise(char *port_device, char *initlength,
43                             GSM_ConnectionType connection,
44                             void (*rlp_callback)(RLP_F96Frame *frame));
45
46 bool        FB38_OpenSerial(void);
47 void        FB38_Terminate(void);
48
49 int         FB38_GetMemoryType(GSM_MemoryType memory_type);
50
51 GSM_Error   FB38_GetMemoryLocation(GSM_PhonebookEntry *entry);
52
53 GSM_Error   FB38_WritePhonebookLocation(GSM_PhonebookEntry *entry);
54
55 GSM_Error   FB38_GetSpeedDial(GSM_SpeedDial *entry);
56
57 GSM_Error   FB38_SetSpeedDial(GSM_SpeedDial *entry);
58
59 GSM_Error   FB38_GetMemoryStatus(GSM_MemoryStatus *Status);
60
61 GSM_Error   FB38_GetSMSStatus(GSM_SMSStatus *Status);
62 GSM_Error   FB38_GetSMSCenter(GSM_MessageCenter *MessageCenter);
63 GSM_Error   FB38_GetSMSMessage(GSM_SMSMessage *message);
64
65 GSM_Error   FB38_GetSMSCenter(GSM_MessageCenter *MessageCenter);
66 GSM_Error   FB38_SetSMSCenter(GSM_MessageCenter *MessageCenter);
67
68 GSM_Error   FB38_DeleteSMSMessage(GSM_SMSMessage *message);
69
70 GSM_Error       FB38_CancelCall(void);
71
72 GSM_Error   FB38_SendSMSMessage(GSM_SMSMessage *SMS);
73
74 GSM_Error   FB38_GetRFLevel(GSM_RFUnits *units, float *level);
75
76 GSM_Error   FB38_GetBatteryLevel(GSM_BatteryUnits *units, float *level);
77
78 bool            FB38_SendRLPFrame(RLP_F96Frame *frame, bool out_dtx);
79
80     /* These aren't presently implemented. */
81 GSM_Error   FB38_SaveSMSMessage(GSM_SMSMessage *SMS);
82 GSM_Error   FB38_GetPowerSource(GSM_PowerSource *source);
83 GSM_Error   FB38_GetDisplayStatus(int *Status);
84 GSM_Error   FB38_EnterSecurityCode(GSM_SecurityCode SecurityCode);
85 GSM_Error   FB38_GetSecurityCodeStatus(int *Status);
86 GSM_Error   FB38_GetIMEI(char *imei);
87 GSM_Error   FB38_GetRevision(char *revision);
88 GSM_Error   FB38_GetModel(char *model);
89 GSM_Error   FB38_GetDateTime(GSM_DateTime *date_time);
90 GSM_Error   FB38_SetDateTime(GSM_DateTime *date_time);
91 GSM_Error   FB38_GetAlarm(int alarm_number, GSM_DateTime *date_time);
92 GSM_Error   FB38_SetAlarm(int alarm_number, GSM_DateTime *date_time);
93 GSM_Error   FB38_DialVoice(char *Number);
94 GSM_Error   FB38_DialData(char *Number, char type,void (* callpassup)(char c));
95 GSM_Error   FB38_GetIncomingCallNr(char *Number);
96 GSM_Error   FB38_GetNetworkInfo(GSM_NetworkInfo *NetworkInfo);
97 GSM_Error   FB38_GetCalendarNote(GSM_CalendarNote *CalendarNote);
98 GSM_Error   FB38_WriteCalendarNote(GSM_CalendarNote *CalendarNote);
99 GSM_Error   FB38_DeleteCalendarNote(GSM_CalendarNote *CalendarNote);
100 GSM_Error   FB38_Netmonitor(unsigned char mode, char *Screen);
101 GSM_Error   FB38_SendDTMF(char *String);
102 GSM_Error   FB38_GetBitmap(GSM_Bitmap *Bitmap);
103 GSM_Error   FB38_SetBitmap(GSM_Bitmap *Bitmap);
104 GSM_Error   FB38_SetRingTone (GSM_Ringtone *ringtone);
105 GSM_Error   FB38_Reset(unsigned char type);
106 GSM_Error   FB38_GetProfile(GSM_Profile *Profile);
107 GSM_Error   FB38_SetProfile(GSM_Profile *Profile);
108
109 GSM_Error   FB38_EnableDisplayOutput();
110 GSM_Error   FB38_DisableDisplayOutput();
111
112 GSM_Error   FB38_EnableCellBroadcast ();
113 GSM_Error   FB38_DisableCellBroadcast(void);
114 GSM_Error   FB38_ReadCellBroadcast (GSM_CBMessage *Message);
115
116     /* All defines and prototypes from here down are specific to 
117        this model and so are #ifdef out if __fbus_3810_c isn't 
118        defined. */
119 #ifdef  __fbus_3810_c
120
121     /* These set length limits for the handset.  This is SIM dependant
122        and ultimately will be set automatically once we know how
123        to get that information from phone.  INT values are
124        selected when the memory type specified is '1'
125        this corresponds to internal memory on an 8110 */
126 #define     FB38_DEFAULT_SIM_PHONEBOOK_NAME_LENGTH      (10)
127 #define     FB38_DEFAULT_SIM_PHONEBOOK_NUMBER_LENGTH    (30)
128
129 #define     FB38_DEFAULT_INT_PHONEBOOK_NAME_LENGTH      (20)
130 #define     FB38_DEFAULT_INT_PHONEBOOK_NUMBER_LENGTH    (30)
131
132     /* Number of times to try resending SMS (empirical) */
133 #define     FB38_SMS_SEND_RETRY_COUNT                   (4)
134
135     /* Miscellaneous values. */
136 #define     FB38_MAX_RECEIVE_LENGTH             (512)
137 #define     FB38_MAX_TRANSMIT_LENGTH            (256)
138 #define     FB38_BAUDRATE                       (B115200)
139
140     /* Limits for IMEI, Revision and Model string storage. */
141 #define     FB38_MAX_IMEI_LENGTH            (20)
142 #define     FB38_MAX_REVISION_LENGTH        (10)
143 #define     FB38_MAX_MODEL_LENGTH           (8)
144
145     /* Limits for sizing of array in FB38_PhonebookEntry */
146 #define     FB38_MAX_PHONEBOOK_NAME_LENGTH              (30)
147 #define     FB38_MAX_PHONEBOOK_NUMBER_LENGTH            (30)
148
149     /* Limits to do with SMS messages. */
150 #define     FB38_MAX_SMS_CENTER_LENGTH                  (30)
151 #define     FB38_MAX_SENDER_LENGTH                      (30)
152 #define     FB38_MAX_SMS_LENGTH                         (160)
153
154     /* States for receive code. */
155 enum    FB38_RX_States {FB38_RX_Sync,
156                         FB38_RX_GetLength,
157                         FB38_RX_GetMessage,
158                         FB38_RX_Off};
159
160     /* Prototypes for internal functions. */
161 void    FB38_SigHandler(int status);
162 void    FB38_ThreadLoop(void);
163
164 void    FB38_RX_StateMachine(char rx_byte);
165 enum    FB38_RX_States FB38_RX_DispatchMessage(void);
166 enum    FB38_RX_States FB38_RX_HandleRLPMessage(void);
167 void    FB38_RX_DisplayMessage(void);
168 void    FB38_RX_Handle0x0b_IncomingCall(void);
169 void    FB38_RX_Handle0x4b_Status(void);
170 void    FB38_RX_Handle0x10_EndOfOutgoingCall(void);
171 void    FB38_RX_Handle0x11_EndOfIncomingCall(void);
172 void    FB38_RX_Handle0x12_EndOfOutgoingCall(void);
173 void    FB38_RX_Handle0x27_SMSMessageText(void);
174 void    FB38_RX_Handle0x30_IncomingSMSNotification(void);
175 void    FB38_RX_Handle0x32_SMSDelivered(void);
176 void    FB38_RX_Handle0x0d_IncomingCallAnswered(void);
177 void    FB38_RX_Handle0x0e_CallEstablished(void);
178 void    FB38_RX_Handle0x2c_SMSHeader(void);
179 void    FB38_RX_Handle0x41_SMSMessageCenterData(void);
180 void    FB38_RX_Handle0x46_MemoryLocationData(void);
181 void    FB38_RX_Handle0x4d_IMEIRevisionModelData(void);
182
183 void    FB38_TX_UpdateSequenceNumber(void);
184 int     FB38_TX_SendStandardAcknowledge(u8 message_type);
185 GSM_Error   FB38_TX_SendDialCommand(u8 call_type, char *Number);
186 bool    FB38_TX_SendRLPFrame(RLP_F96Frame *frame, bool out_dtx);
187
188 int     FB38_TX_SendMessage(u8 message_length, u8 message_type, u8 sequence_byte, u8 *buffer);
189 void    FB38_TX_Send0x0f_HangupMessage(void);
190 void    FB38_TX_Send0x25_RequestSMSMemoryLocation(u8 memory_type, u8 location); 
191 void    FB38_TX_Send0x26_DeleteSMSMemoryLocation(u8 memory_type, u8 location);
192
193 void    FB38_TX_Send0x23_SendSMSHeader(char *message_center, char *destination, u8 fo, u8 dcs, u8 total_length);
194 void    FB38_TX_Send0x27_SendSMSMessageText(u8 block_number, u8 block_length, char *text);
195 void    FB38_TX_Send0x3fMessage(void); 
196 void    FB38_TX_Send0x4aMessage(void);
197 int     FB38_TX_Send0x42_WriteMemoryLocation(u8 memory_area, u8 location, char *label, char *number);
198 void    FB38_TX_Send0x43_RequestMemoryLocation(u8 memory_area, u8 location);
199 void    FB38_TX_Send0x4c_RequestIMEIRevisionModelData(void);
200 void    FB38_TX_Send0x15Message(u8 sequence_number);
201 void    FB38_TX_SendExploreMessage(u8 message);
202
203 #endif  /* __fbus_3810_c */
204
205 #endif  /* __fbus_3810_h */