7 A Linux/Unix toolset and driver for Nokia mobile phones.
9 Copyright (C) 2000 Hugh Blemings & Pavel JanÃk ml.
10 Copytight (C) 2000 Chris Kemp
12 Released under the terms of the GNU GPL, see file COPYING for more details.
14 This file provides functions specific to the 7110 series.
15 See README for more details on supported mobile phones.
17 The various routines are called P7110_(whatever).
20 Revision 1.1.1.1 2001/11/25 21:59:22 short
21 :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
23 Revision 1.7 2001/11/22 17:56:53 pkot
24 smslib update. sms sending
26 Revision 1.6 2001/11/08 16:47:48 pkot
27 Start fiddling with 7110 and SMS
29 Revision 1.5 2001/06/27 23:52:52 pkot
30 7110/6210 updates (Marian Jancar)
32 Revision 1.4 2001/05/24 20:47:30 chris
33 More updating of 7110 code and some of xgnokii_lowlevel changed over.
35 Revision 1.3 2001/03/23 13:40:25 chris
36 Pavel's patch and a few fixes.
38 Revision 1.2 2001/03/21 23:36:08 chris
39 Added the statemachine
40 This will break gnokii --identify and --monitor except for 6210/7110
42 Revision 1.1 2001/02/21 19:57:13 chris
43 More fiddling with the directory layout
45 Revision 1.1 2001/02/16 14:29:54 chris
46 Restructure of common/. Fixed a problem in fbus-phonet.c
47 Lots of dprintfs for Marcin
48 Any size xpm can now be loaded (eg for 7110 startup logos)
49 nk7110 code detects 7110/6210 and alters startup logo size to suit
50 Moved Marcin's extended phonebook code into gnokii.c
52 Revision 1.4 2001/01/29 17:14:44 chris
53 dprintf now in misc.h (and fiddling with 7110 code)
55 Revision 1.3 2001/01/23 15:32:44 chris
56 Pavel's 'break' and 'static' corrections.
57 Work on logos for 7110.
59 Revision 1.2 2001/01/17 02:54:56 chris
60 More 7110 work. Use with care! (eg it is not possible to delete phonebook entries)
61 I can now edit my phonebook in xgnokii but it is 'work in progress'.
63 Revision 1.1 2001/01/14 22:47:01 chris
64 Preliminary 7110 support (dlr9 only) and the beginnings of a new structure
69 #ifndef __phones_nk7110_h
70 #define __phones_nk7110_h
72 #include <gsm-common.h>
73 #include "gsm-statemachine.h"
75 extern bool P7110_LinkOK;
78 #define P7110_MSG_COMMSTATUS 0x01 /* Communication status */
79 #define P7110_MSG_SMS 0x02 /* SMS handling */
80 #define P7110_MSG_PHONEBOOK 0x03 /* Phonebook functions */
81 #define P7110_MSG_NETSTATUS 0x0a /* Network status */
82 #define P7110_MSG_CALENDAR 0x13 /* Calendar notes */
83 #define P7110_MSG_FOLDER 0x14 /* Folders handling */
84 #define P7110_MSG_BATTERY 0x17 /* Battery info */
85 #define P7110_MSG_CLOCK 0x19 /* Date & alarm */
86 #define P7110_MSG_IDENTITY 0x1b /* Brief product info */
87 #define P7110_MSG_RINGTONE 0x1f /* Ringtone handling */
88 #define P7110_MSG_SECURITY 0x40 /* Security */
89 #define P7110_MSG_STLOGO 0x7a /* Startup logo */
90 #define P7110_MSG_VERREQ 0xd1 /* HW&SW version request */
91 #define P7110_MSG_VERRESP 0xd2 /* HW&SW version response */
93 /* SMS handling message subtypes (send) */
94 #define P7110_SUBSMS_SEND_SMS 0x01 /* Send SMS */
95 #define P7110_SUBSMS_SET_CELLBRD 0x20 /* Set cell broadcast */
96 #define P7110_SUBSMS_SET_SMSC 0x30 /* Set SMS center */
97 #define P7110_SUBSMS_GET_SMSC 0x33 /* Get SMS center */
98 /* SMS handling message subtypes (recv) */
99 #define P7110_SUBSMS_SMS_SENT 0x02 /* SMS sent */
100 #define P7110_SUBSMS_SEND_FAIL 0x03 /* SMS send failed */
101 #define P7110_SUBSMS_SMS_RCVD 0x10 /* SMS received */
102 #define P7110_SUBSMS_CELLBRD_OK 0x21 /* Set cell broadcast success*/
103 #define P7110_SUBSMS_CELLBRD_FAIL 0x22 /* Set cell broadcast failure */
104 #define P7110_SUBSMS_READ_CELLBRD 0x23 /* Read cell broadcast */
105 #define P7110_SUBSMS_SMSC_OK 0x31 /* Set SMS center success*/
106 #define P7110_SUBSMS_SMSC_FAIL 0x32 /* Set SMS center failure */
107 #define P7110_SUBSMS_SMSC_RCVD 0x34 /* SMS center received */
108 #define P7110_SUBSMS_SMSC_RCVFAIL 0x35 /* SMS center receive failure */
110 /* Clock handling message subtypes (send) */
111 #define P7110_SUBCLO_GET_DATE 0x62 /* Get date & time */
112 #define P7110_SUBCLO_GET_ALARM 0x6D /* Get alarm */
113 /* Clock handling message subtypes (recv) */
114 #define P7110_SUBCLO_DATE_RCVD 0x63 /* Received date & time */
115 #define P7110_SUBCLO_ALARM_RCVD 0x6E /* Received alarm */
117 #define P7110_ALARM_ENABLED 0x02 /* Alarm enabled */
118 #define P7110_ALARM_DISABLED 0x01 /* Alarm disabled */
120 /* Calendar handling message subtypes (send) */
121 #define P7110_SUBCAL_ADD_MEETING 0x01 /* Add meeting note */
122 #define P7110_SUBCAL_ADD_CALL 0x03 /* Add call note */
123 #define P7110_SUBCAL_ADD_BIRTHDAY 0x05 /* Add birthday note */
124 #define P7110_SUBCAL_ADD_REMINDER 0x07 /* Add reminder note */
125 #define P7110_SUBCAL_DEL_NOTE 0x0b /* Delete note */
126 #define P7110_SUBCAL_GET_NOTE 0x19 /* Get note */
127 #define P7110_SUBCAL_GET_FREEPOS 0x31 /* Get first free position */
128 #define P7110_SUBCAL_GET_INFO 0x3a /* Calendar sumary */
129 /* Calendar handling message subtypes (recv) */
130 #define P7110_SUBCAL_ADD_MEETING_RESP 0x02 /* Add meeting note response */
131 #define P7110_SUBCAL_ADD_CALL_RESP 0x04 /* Add call note response */
132 #define P7110_SUBCAL_ADD_BIRTHDAY_RESP 0x06 /* Add birthday note response */
133 #define P7110_SUBCAL_ADD_REMINDER_RESP 0x08 /* Add reminder note response */
134 #define P7110_SUBCAL_DEL_NOTE_RESP 0x0c /* Dletete note response */
135 #define P7110_SUBCAL_NOTE_RCVD 0x1a /* Received note */
136 #define P7110_SUBCAL_FREEPOS_RCVD 0x32 /* Received first free position */
137 #define P7110_SUBCAL_INFO_RCVD 0x3b /* Received calendar summary*/
138 /* Calendar note types */
139 #define P7110_NOTE_MEETING 0x01 /* Metting */
140 #define P7110_NOTE_CALL 0x02 /* Call */
141 #define P7110_NOTE_BIRTHDAY 0x04 /* Birthday */
142 #define P7110_NOTE_REMINDER 0x08 /* Reminder */
144 /* Phone Memory types */
145 #define P7110_MEMORY_DIALLED 0x01 /* Dialled numbers */
146 #define P7110_MEMORY_MISSED 0x02 /* Missed calls */
147 #define P7110_MEMORY_RECEIVED 0x03 /* Received calls */
148 #define P7110_MEMORY_PHONE 0x05 /* Telephone phonebook */
149 #define P7110_MEMORY_SIM 0x06 /* SIM phonebook */
150 #define P7110_MEMORY_SPEEDDIALS 0x0e /* Speed dials */
151 #define P7110_MEMORY_GROUPS 0x10 /* Caller groups */
153 #define P7110_MEMORY_DC 0x01 /* ME dialled calls list */
154 #define P7110_MEMORY_MC 0x02 /* ME missed (unanswered received) calls list */
155 #define P7110_MEMORY_RC 0x03 /* ME received calls list */
156 #define P7110_MEMORY_FD 0x04 /* ?? SIM fixdialling-phonebook */
157 #define P7110_MEMORY_ME 0x05 /* ME (Mobile Equipment) phonebook */
158 #define P7110_MEMORY_SM 0x06 /* SIM phonebook */
159 #define P7110_MEMORY_ON 0x07 /* ?? SIM (or ME) own numbers list */
160 #define P7110_MEMORY_EN 0x08 /* ?? SIM (or ME) emergency number */
161 #define P7110_MEMORY_MT 0x09 /* ?? combined ME and SIM phonebook */
162 #define P7110_MEMORY_VOICE 0x0b /* Voice Mailbox */
164 /* This is used when the memory type is unknown. */
165 #define P7110_MEMORY_XX 0xff
167 /* Entry Types for the enhanced phonebook */
168 #define P7110_ENTRYTYPE_POINTER 0x04 /* Pointer to other memory */
169 #define P7110_ENTRYTYPE_NAME 0x07 /* Name always the only one */
170 #define P7110_ENTRYTYPE_EMAIL 0x08 /* Email Adress (TEXT) */
171 #define P7110_ENTRYTYPE_POSTAL 0x09 /* Postal Address (Text) */
172 #define P7110_ENTRYTYPE_NOTE 0x0a /* Note (Text) */
173 #define P7110_ENTRYTYPE_NUMBER 0x0b /* Phonenumber */
174 #define P7110_ENTRYTYPE_RINGTONE 0x0c /* Ringtone */
175 #define P7110_ENTRYTYPE_DATE 0x13 /* Date for a Called List */
176 #define P7110_ENTRYTYPE_LOGO 0x1b /* Group logo */
177 #define P7110_ENTRYTYPE_LOGOSWITCH 0x1c /* Group logo on/off */
178 #define P7110_ENTRYTYPE_GROUP 0x1e /* Group number for phonebook entry */
180 #ifdef __phones_nk7110_c /* Prototype functions for phone-7110.c only */
182 static GSM_Error P7110_Functions(GSM_Operation op, GSM_Data *data, GSM_Statemachine *state);
183 static GSM_Error P7110_Initialise(GSM_Statemachine *state);
184 static GSM_Error P7110_GetModel(GSM_Data *data, GSM_Statemachine *state);
185 static GSM_Error P7110_GetRevision(GSM_Data *data, GSM_Statemachine *state);
186 static GSM_Error P7110_GetIMEI(GSM_Data *data, GSM_Statemachine *state);
187 static GSM_Error P7110_Identify(GSM_Data *data, GSM_Statemachine *state);
188 static GSM_Error P7110_GetBatteryLevel(GSM_Data *data, GSM_Statemachine *state);
189 static GSM_Error P7110_GetRFLevel(GSM_Data *data, GSM_Statemachine *state);
190 static GSM_Error P7110_GetMemoryStatus(GSM_Data *data, GSM_Statemachine *state);
191 static GSM_Error P7110_SetBitmap(GSM_Data *data, GSM_Statemachine *state);
192 static GSM_Error P7110_GetBitmap(GSM_Data *data, GSM_Statemachine *state);
193 static GSM_Error P7110_WritePhonebookLocation(GSM_Data *data, GSM_Statemachine *state);
194 static GSM_Error P7110_ReadPhonebook(GSM_Data *data, GSM_Statemachine *state);
195 static GSM_Error P7110_GetNetworkInfo(GSM_Data *data, GSM_Statemachine *state);
196 static GSM_Error P7110_GetSpeedDial(GSM_Data *data, GSM_Statemachine *state);
197 static GSM_Error P7110_GetSMSCenter(GSM_Data *data, GSM_Statemachine *state);
198 static GSM_Error P7110_GetClock(char req_type, GSM_Data *data, GSM_Statemachine *state);
199 static GSM_Error P7110_GetCalendarNote(GSM_Data *data, GSM_Statemachine *state);
200 static GSM_Error P7110_GetSMS(GSM_Data *data, GSM_Statemachine *state);
201 static GSM_Error P7110_SendSMS(GSM_Data *data, GSM_Statemachine *state);
202 static GSM_Error P7110_GetSMSFolders(GSM_Data *data, GSM_Statemachine *state);
203 static GSM_Error P7110_GetSMSFolderStatus(GSM_Data *data, GSM_Statemachine *state);
205 static GSM_Error P7110_Incoming0x1b(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
206 static GSM_Error P7110_IncomingPhonebook(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
207 static GSM_Error P7110_IncomingNetwork(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
208 static GSM_Error P7110_IncomingBattLevel(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
209 static GSM_Error P7110_IncomingStartup(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
210 static GSM_Error P7110_IncomingSMS(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
211 static GSM_Error P7110_IncomingFolder(int messagetype, unsigned char *buffer, int length, GSM_Data *data);
212 static GSM_Error P7110_IncomingClock(int messagetype, unsigned char *message, int length, GSM_Data *data);
213 static GSM_Error P7110_IncomingCalendar(int messagetype, unsigned char *message, int length, GSM_Data *data);
215 static int GetMemoryType(GSM_MemoryType memory_type);
218 static GSM_Error P7110_Initialise(char *port_device, char *initlength,
219 GSM_ConnectionType connection,
220 void (*rlp_callback)(RLP_F96Frame *frame));
221 static GSM_Error P7110_GenericCRHandler(int messagetype, unsigned char *buffer, int length);
222 static GSM_Error P7110_IncomingDefault(int messagetype, unsigned char *buffer, int length);
223 static GSM_Error P7110_GetIMEI(char *imei);
224 static GSM_Error P7110_GetRevision(char *revision);
225 static GSM_Error P7110_GetModel(char *model);
226 static GSM_Error P7110_ReadPhonebook(GSM_PhonebookEntry *entry);
227 static GSM_Error P7110_WritePhonebookLocation(GSM_PhonebookEntry *entry);
228 static GSM_Error P7110_GetMemoryStatus(GSM_MemoryStatus *status);
229 static GSM_Error P7110_GetBatteryLevel(GSM_BatteryUnits *units, float *level);
230 static GSM_Error P7110_GetRFLevel(GSM_RFUnits *units, float *level);
231 static GSM_Error P7110_GetBitmap(GSM_Bitmap *bitmap);
232 static GSM_Error P7110_SetBitmap(GSM_Bitmap *bitmap);
233 static GSM_Error P7110_DialVoice(char *Number);
234 static void P7110_Terminate();
235 static bool P7110_SendRLPFrame( RLP_F96Frame *frame, bool out_dtx );
240 #endif /* #ifdef __phones_nk7110_c */
242 #endif /* #ifndef __phones_nk7110_h */