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 6160 code.
16 Revision 1.1.1.2 2002/04/03 00:08:19 short
17 Found in "gnokii-working" directory, some November-patches version
19 Revision 1.16 2001/06/28 00:28:46 pkot
20 Small docs updates (Pawel Kot)
28 #ifndef __gsm_common_h
29 #include "gsm-common.h" /* Needed for GSM_Error etc. */
32 /* Global variables */
33 extern bool MB61_LinkOK;
34 extern GSM_Functions MB61_Functions;
35 extern GSM_Information MB61_Information;
38 /* Prototypes for the functions designed to be used externally. */
39 GSM_Error MB61_Initialise(char *port_device, char *initlength,
40 GSM_ConnectionType connection,
41 void (*rlp_callback)(RLP_F96Frame *frame));
43 bool MB61_OpenSerial(void);
44 void MB61_Terminate(void);
46 int MB61_GetMemoryType(GSM_MemoryType memory_type);
48 GSM_Error MB61_GetMemoryLocation(GSM_PhonebookEntry *entry);
50 GSM_Error MB61_WritePhonebookLocation(GSM_PhonebookEntry *entry);
52 GSM_Error MB61_GetSpeedDial(GSM_SpeedDial *entry);
54 GSM_Error MB61_SetSpeedDial(GSM_SpeedDial *entry);
56 GSM_Error MB61_GetMemoryStatus(GSM_MemoryStatus *Status);
58 GSM_Error MB61_GetSMSStatus(GSM_SMSStatus *Status);
59 GSM_Error MB61_GetSMSCenter(GSM_MessageCenter *MessageCenter);
60 GSM_Error MB61_GetSMSMessage(GSM_SMSMessage *message);
62 GSM_Error MB61_GetSMSCenter(GSM_MessageCenter *MessageCenter);
63 GSM_Error MB61_SetSMSCenter(GSM_MessageCenter *MessageCenter);
65 GSM_Error MB61_DeleteSMSMessage(GSM_SMSMessage *message);
67 GSM_Error MB61_SendSMSMessage(GSM_SMSMessage *SMS, int size);
69 GSM_Error MB61_GetRFLevel(GSM_RFUnits *units, float *level);
71 GSM_Error MB61_GetBatteryLevel(GSM_BatteryUnits *units, float *level);
73 /* These aren't presently implemented. */
74 GSM_Error MB61_SaveSMSMessage(GSM_SMSMessage *SMS, int data_size);
75 GSM_Error MB61_GetPowerSource(GSM_PowerSource *source);
76 GSM_Error MB61_GetDisplayStatus(int *Status);
78 GSM_Error MB61_EnterSecurityCode(GSM_SecurityCode SecurityCode);
79 GSM_Error MB61_GetSecurityCodeStatus(int *Status);
81 GSM_Error MB61_GetIMEI(char *imei);
82 GSM_Error MB61_GetRevision(char *revision);
83 GSM_Error MB61_GetModel(char *model);
84 GSM_Error MB61_GetDateTime(GSM_DateTime *date_time);
85 GSM_Error MB61_SetDateTime(GSM_DateTime *date_time);
86 GSM_Error MB61_GetAlarm(int alarm_number, GSM_DateTime *date_time);
87 GSM_Error MB61_SetAlarm(int alarm_number, GSM_DateTime *date_time);
88 GSM_Error MB61_DialVoice(char *Number);
89 GSM_Error MB61_DialData(char *Number, char type, void (* callpassup)(char c));
90 GSM_Error MB61_GetIncomingCallNr(char *Number);
91 GSM_Error MB61_GetNetworkInfo(GSM_NetworkInfo *NetworkInfo);
92 GSM_Error MB61_GetCalendarNote(GSM_CalendarNote *CalendarNote);
93 GSM_Error MB61_WriteCalendarNote(GSM_CalendarNote *CalendarNote);
94 GSM_Error MB61_DeleteCalendarNote(GSM_CalendarNote *CalendarNote);
95 GSM_Error MB61_Netmonitor(unsigned char mode, char *Screen);
96 GSM_Error MB61_SendDTMF(char *String);
97 GSM_Error MB61_GetBitmap(GSM_Bitmap *Bitmap);
98 GSM_Error MB61_SetBitmap(GSM_Bitmap *Bitmap);
99 GSM_Error MB61_SetRingTone(GSM_Ringtone *ringtone);
100 GSM_Error MB61_Reset(unsigned char type);
101 GSM_Error MB61_GetProfile(GSM_Profile *Profile);
102 GSM_Error MB61_SetProfile(GSM_Profile *Profile);
103 bool MB61_SendRLPFrame(RLP_F96Frame *frame, bool out_dtx);
104 GSM_Error MB61_CancelCall(void);
106 GSM_Error MB61_EnableDisplayOutput();
107 GSM_Error MB61_DisableDisplayOutput();
109 GSM_Error MB61_EnableCellBroadcast ();
110 GSM_Error MB61_DisableCellBroadcast(void);
111 GSM_Error MB61_ReadCellBroadcast (GSM_CBMessage *Message);
112 /* All defines and prototypes from here down are specific to
113 this model and so are #ifdef out if __mbus_6160_c isn't
117 #define MB61_MAX_RECEIVE_LENGTH (160)
119 #define MB61_MAX_TRANSMIT_LENGTH (200) /* Arbitrary */
120 #define MSG_ADDR_PC (0x1d)
121 #define MSG_ADDR_PHONE (0x00)
122 #define MSG_ADDR_SERVICE (0x10)
123 #define MSG_ADDR_UNKNOWN (0xf8)
124 #define MSG_ADDR_GLOBAL (0xff)
126 #define MAX_5160_PHONEBOOK_ENTRIES (100)
127 #define MAX_5160_PHONEBOOK_NUMBER_LENGTH (16)
128 #define MAX_5160_PHONEBOOK_NAME_LENGTH (16)
130 #define MAX_6160_PHONEBOOK_ENTRIES (199)
131 #define MAX_6161_PHONEBOOK_ENTRIES (199) /* Assumed */
132 #define MAX_6162_PHONEBOOK_ENTRIES (199) /* Assumed */
133 #define MAX_616X_PHONEBOOK_NUMBER_LENGTH (16)
134 #define MAX_616X_PHONEBOOK_NAME_LENGTH (16)
136 #define MAX_6185_PHONEBOOK_ENTRIES (200) /* Assumed */
137 #define MAX_6185_PHONEBOOK_NUMBER_LENGTH (16) /* Assumed */
138 #define MAX_6185_PHONEBOOK_NAME_LENGTH (16) /* Assumed */
140 /* States for receive code. */
141 enum MB61_RX_States {MB61_RX_Sync,
142 MB61_RX_GetDestination,
145 MB61_RX_GetLengthMSB,
146 MB61_RX_GetLengthLSB,
150 /* This table duplicates info in xgnokii, maybe we need a single
151 data structure for this someplace in the common codebase ... HAB */
152 enum MB61_Models {MB61_ModelUnknown,
153 MB61_Model5160, /* NSW-1 */
154 MB61_Model6110, /* NSE-3 */
155 MB61_Model6160, /* NSW-3 */
156 MB61_Model6161, /* ????? */
157 MB61_Model6162, /* ????? */
158 MB61_Model6185, /* NSD-3 */
159 MB61_Model7110 /* NSE-5 */
164 /* We need to keep track of what response is expected as there
165 is no unambiguous field in responses from the phone to
166 provide this information. */
167 enum MB61_Responses {MB61_Response_Unknown,
168 MB61_Response_0xD0_Init,
169 MB61_Response_0xD2_ID,
170 MB61_Response_0xD2_Version,
171 MB61_Response_0x40_WriteAcknowledge,
172 MB61_Response_0x40_PhonebookRead,
173 MB61_Response_0x40_LongPhonebookRead};
175 /* Prototypes for internal functions. */
176 void MB61_ThreadLoop(void);
177 void MB61_SigHandler(int status);
178 void MB61_ThreadLoop(void);
179 void MB61_UpdateSequenceNumber(void);
181 bool MB61_TX_SendStandardAcknowledge(u8 sequence_number);
183 int MB61_TX_SendMessage(u8 destination, u8 source, u8 command, u8 sequence_byte, int message_length, u8 *buffer);
184 void MB61_TX_SendPhoneIDRequest(void);
185 bool MB61_TX_SendPhonebookReadRequest(u8 entry);
186 bool MB61_TX_SendLongPhonebookReadRequest(u8 entry);
187 GSM_Error MB61_TX_SendPhonebookWriteRequest(GSM_PhonebookEntry *entry);
189 bool MB61_InitialiseLink(void);
190 void MB61_SetExpectedResponse(enum MB61_Responses response);
191 bool MB61_WaitForExpectedResponse(int timeout);
192 void MB61_RX_StateMachine(char rx_byte);
193 enum MB61_RX_States MB61_RX_DispatchMessage(void);
194 void MB61_RX_DisplayMessage(void);
195 void MB61_RX_Handle0x40_PhonebookRead(void);
196 void MB61_RX_Handle0x40_LongPhonebookRead(void);
197 void MB61_RX_Handle0xD2_ID(void);
198 void MB61_RX_Handle0xD2_Version(void);
200 #endif /* __mbus_6160_c */
202 #endif /* __mbus_6160_h */