7 A Linux/Unix toolset and driver for Nokia mobile phones.
9 Copyright (C) 1999, 2000 Hugh Blemings & Pavel JanÃk ml.
11 Released under the terms of the GNU GPL, see file COPYING for more details.
13 Header file for the various functions, definitions etc. used to implement
14 the handset interface. See fbus-6110.c for more details.
17 Revision 1.1.1.2 2002/04/03 00:08:17 short
18 Found in "gnokii-working" directory, some November-patches version
20 Revision 1.58 2001/06/28 00:28:45 pkot
21 Small docs updates (Pawel Kot)
29 #ifndef __gsm_common_h
30 #include "gsm-common.h"
33 #define FB61_MAX_TRANSMIT_LENGTH (256)
34 #define FB61_MAX_RECEIVE_LENGTH (512)
35 #define FB61_MAX_CONTENT_LENGTH (120)
37 /* Nokia 6110 supports phonebook entries of max. 16 characters and numbers of
40 #define FB61_MAX_PHONEBOOK_NAME_LENGTH (16)
41 #define FB61_MAX_PHONEBOOK_NUMBER_LENGTH (30)
43 /* Alternate defines for memory types. Two letter codes follow GSM 07.07
44 release 6.2.0, AT+CPBS "Select Phonebook Memory Storage" */
46 #define FB61_MEMORY_MT 0x01 /* combined ME and SIM phonebook */
47 #define FB61_MEMORY_ME 0x02 /* ME (Mobile Equipment) phonebook */
48 #define FB61_MEMORY_SM 0x03 /* SIM phonebook */
49 #define FB61_MEMORY_FD 0x04 /* SIM fixdialling-phonebook */
50 #define FB61_MEMORY_ON 0x05 /* SIM (or ME) own numbers list */
51 #define FB61_MEMORY_EN 0x06 /* SIM (or ME) emergency number */
52 #define FB61_MEMORY_DC 0x07 /* ME dialled calls list */
53 #define FB61_MEMORY_RC 0x08 /* ME received calls list */
54 #define FB61_MEMORY_MC 0x09 /* ME missed (unanswered received) calls list */
56 /* This is still unknown, it can also be unimplemented in CDS. */
58 // #define FB61_MEMORY_LD 0x?? /* SIM last-dialling-phonebook */
60 /* TA is not applicable (TA == computer) but it's here for 'completeness' */
62 // #define FB61_MEMORY_TA 0x?? /* TA (Terminal Adaptor) phonebook */
64 /* This is used when the memory type is unknown. */
66 #define FB61_MEMORY_XX 0xff
68 /* Limits for IMEI, Revision and Model string storage. */
70 #define FB61_MAX_IMEI_LENGTH (20)
71 #define FB61_MAX_REVISION_LENGTH (20)
72 #define FB61_MAX_SW_LENGTH (9)
73 #define FB61_MAX_MODEL_LENGTH (6)
75 /* This byte is used to synchronize FBUS channel over cable or IR. */
77 #define FB61_SYNC_BYTE 0x55
79 /* This byte is at the beginning of all GSM Frames sent over FBUS to Nokia
82 #define FB61_FRAME_ID 0x1e
84 /* Every (well, almost every) frame from the computer starts with this
87 #define FB61_FRAME_HEADER 0x00, 0x01, 0x00
89 /* The FBUS interface is 115200 */
91 #define FB61_BAUDRATE (B115200)
93 /* The next two macros define the source and destination addresses used for
94 specifying the device connected on the cable. */
96 /* Nokia mobile phone. */
97 #define FB61_DEVICE_PHONE 0x00
100 #define FB61_DEVICE_PC 0x0c
102 /* These macros are used to specify the type of the frame. Only few types are
103 known yet - if you can cast some light on these, please let us known. */
105 /* Acknowledge of the received frame. */
106 #define FB61_FRTYPE_ACK 0x7f
108 /* Macros for infrared communication */
110 /* This byte is at the beginning of all GSM Frames sent over IR to Nokia 6110
113 #define FB61_IR_FRAME_ID 0x1c
115 /* Infrared communication starts on 9600 bps. */
117 #define FB61_IR_INIT_SPEED (B9600)
119 /* This byte is send after all FB61_SYNC_BYTE bytes. */
121 #define FB61_IR_END_INIT_BYTE 0xc1
123 /* Global variables */
125 extern bool FB61_LinkOK;
126 extern GSM_Functions FB61_Functions;
127 extern GSM_Information FB61_Information;
130 /* Prototypes for the functions designed to be used externally. */
132 GSM_Error FB61_Initialise(char *port_device, char *initlength,
133 GSM_ConnectionType connection,
134 void (*rlp_callback)(RLP_F96Frame *frame));
136 bool FB61_OpenSerial(void);
137 bool FB61_Open_Ir_Serial(void);
138 void FB61_Terminate(void);
139 void FB61_ThreadLoop(void);
140 void FB61_SigHandler(int status);
141 void FB61_RX_StateMachine(char rx_byte);
142 enum FB61_RX_States FB61_RX_DispatchMessage(void);
143 enum FB61_RX_States FB61_RX_HandleRLPMessage(void);
144 void FB61_RX_DisplayMessage(void);
146 int FB61_TX_SendMessage(u16 message_length, u8 message_type, u8 *buffer);
147 int FB61_TX_SendAck(u8 message_type, u8 message_seq);
148 int FB61_TX_SendFrame(u8 message_length, u8 message_type, u8 *buffer);
150 int FB61_GetMemoryType(GSM_MemoryType memory_type);
151 int SemiOctetPack(char *Number, unsigned char *Output);
153 GSM_Error FB61_GetMemoryLocation(GSM_PhonebookEntry *entry);
154 GSM_Error FB61_WritePhonebookLocation(GSM_PhonebookEntry *entry);
156 GSM_Error FB61_GetSpeedDial(GSM_SpeedDial *entry);
157 GSM_Error FB61_SetSpeedDial(GSM_SpeedDial *entry);
159 GSM_Error FB61_GetMemoryStatus(GSM_MemoryStatus *Status);
160 GSM_Error FB61_GetSMSStatus(GSM_SMSStatus *Status);
161 GSM_Error FB61_GetSMSCenter(GSM_MessageCenter *MessageCenter);
163 GSM_Error FB61_GetSMSMessage(GSM_SMSMessage *Message);
164 GSM_Error FB61_DeleteSMSMessage(GSM_SMSMessage *Message);
165 GSM_Error FB61_SendSMSMessage(GSM_SMSMessage *Message);
166 GSM_Error FB61_SaveSMSMessage(GSM_SMSMessage *Message);
168 GSM_Error FB61_GetRFLevel(GSM_RFUnits *units, float *level);
169 GSM_Error FB61_GetBatteryLevel(GSM_BatteryUnits *units, float *level);
170 GSM_Error FB61_GetPowerSource(GSM_PowerSource *source);
171 GSM_Error FB61_GetDisplayStatus(int *Status);
173 GSM_Error FB61_EnterSecurityCode(GSM_SecurityCode SecurityCode);
174 GSM_Error FB61_GetSecurityCodeStatus(int *Status);
176 GSM_Error FB61_GetSMSCenter(GSM_MessageCenter *MessageCenter);
177 GSM_Error FB61_SetSMSCenter(GSM_MessageCenter *MessageCenter);
179 GSM_Error FB61_GetIMEI(char *imei);
180 GSM_Error FB61_GetRevision(char *revision);
181 GSM_Error FB61_GetModel(char *model);
183 GSM_Error FB61_GetDateTime(GSM_DateTime *date_time);
184 GSM_Error FB61_SetDateTime(GSM_DateTime *date_time);
186 GSM_Error FB61_GetAlarm(int alarm_number, GSM_DateTime *date_time);
187 GSM_Error FB61_SetAlarm(int alarm_number, GSM_DateTime *date_time);
189 GSM_Error FB61_DialVoice(char *Number);
190 GSM_Error FB61_DialData(char *Number, char type, void (* callpassup)(char c));
192 GSM_Error FB61_GetIncomingCallNr(char *Number);
194 GSM_Error FB61_SendBitmap(char *NetworkCode, int width, int height,
195 unsigned char *bitmap);
196 GSM_Error FB61_GetNetworkInfo(GSM_NetworkInfo *NetworkInfo);
198 GSM_Error FB61_GetCalendarNote(GSM_CalendarNote *CalendarNote);
199 GSM_Error FB61_WriteCalendarNote(GSM_CalendarNote *CalendarNote);
200 GSM_Error FB61_DeleteCalendarNote(GSM_CalendarNote *CalendarNote);
202 GSM_Error FB61_NetMonitor(unsigned char mode, char *Screen);
204 GSM_Error FB61_SetBitmap( GSM_Bitmap *Bitmap );
205 GSM_Error FB61_GetBitmap( GSM_Bitmap *Bitmap );
207 GSM_Error FB61_SetRingTone(GSM_Ringtone *ringtone);
209 GSM_Error FB61_EnableDisplayOutput();
210 GSM_Error FB61_DisableDisplayOutput();
212 GSM_Error FB61_EnableCellBroadcast ();
213 GSM_Error FB61_DisableCellBroadcast(void);
214 GSM_Error FB61_ReadCellBroadcast (GSM_CBMessage *Message);
216 GSM_Error FB61_SendDTMF(char *String);
218 GSM_Error FB61_Reset(unsigned char type);
220 GSM_Error FB61_GetProfile(GSM_Profile *Profile);
221 GSM_Error FB61_SetProfile(GSM_Profile *Profile);
222 bool FB61_SendRLPFrame(RLP_F96Frame *frame, bool out_dtx);
224 GSM_Error FB61_CancelCall(void);
225 GSM_Error FB61_AnswerCall(char s);
227 /* States for receive code. */
229 enum FB61_RX_States {
232 FB61_RX_GetDestination,
240 GSM_Error FB61_TX_SendStatusRequest(void);
242 #endif /* __fbus_6110_h */