Imported gammu 0.90.7
[gammu.git] / common / service / gsmmisc.h
bloba4cd9f32908b439b30f8f92a17d048dfc9d55d8b
1 #ifndef __gsm_misc_h
2 #define __gsm_misc_h
4 #include "../gsmcomon.h"
6 /* Define an enum for specifying memory types for getting phonebook entries,
7 * SMS messages etc. Phone modules can translate it to own values
8 */
9 typedef enum {
10 /* Two letter codes are from GSM 07.07 release 6.2.0 */
11 /**
12 * Internal memory of the mobile equipment
14 GMT_ME=1,
15 /**
16 * SIM card memory
18 GMT_SM,
19 /**
20 * Own numbers
22 GMT_ON,
23 /**
24 * Dialled calls
26 GMT_DC,
27 /**
28 * Received calls
30 GMT_RC,
31 /**
32 * Missed calls
34 GMT_MC,
35 /**
36 * Combined ME and SIM phonebook
38 GMT_MT,
39 /**
40 * Fixed dial
42 GMT_FD,
44 /**
45 * Voice mailbox
47 GMT_VM
48 } GSM_MemoryType;
50 /* --------------------------- resetting phone settings ------------------- */
52 typedef enum {
53 GSM_RESET_PHONESETTINGS = 1,
54 GSM_RESET_USERINTERFACE,
55 GSM_RESET_USERINTERFACE_PHONESETTINGS,
56 GSM_RESET_DEVICE,
57 GSM_RESET_FULLFACTORY
58 } GSM_ResetSettingsType;
60 /* --------------------------- security codes ------------------------------ */
62 /**
63 * Definition of security codes.
65 typedef enum {
66 /**
67 * Security code.
69 GSCT_SecurityCode = 0x01,
70 /**
71 * PIN.
73 GSCT_Pin,
74 /**
75 * PIN 2.
77 GSCT_Pin2,
78 /**
79 * PUK.
81 GSCT_Puk,
82 /**
83 * PUK 2.
85 GSCT_Puk2,
86 /**
87 * Code not needed.
89 GSCT_None
90 } GSM_SecurityCodeType;
92 #define GSM_SECURITY_CODE_LEN 15
94 /**
95 * Security code definition.
97 typedef struct {
98 /**
99 * Type of the code.
101 GSM_SecurityCodeType Type;
103 * Actual code.
105 char Code[GSM_SECURITY_CODE_LEN+1];
106 } GSM_SecurityCode;
108 /* ---------------------------- keyboard ----------------------------------- */
110 typedef enum {
111 GSM_KEY_NONE = 0x00,
112 GSM_KEY_1 = 0x01,
113 GSM_KEY_2,
114 GSM_KEY_3,
115 GSM_KEY_4,
116 GSM_KEY_5,
117 GSM_KEY_6,
118 GSM_KEY_7,
119 GSM_KEY_8,
120 GSM_KEY_9,
121 GSM_KEY_0,
125 GSM_KEY_HASH,
129 GSM_KEY_ASTERISK,
130 GSM_KEY_POWER,
132 * in some phone ie. N5110 sometimes works identical to POWER
134 GSM_KEY_GREEN,
136 * (c) key in some phone: ie. N5110
138 GSM_KEY_RED,
140 * doesn't available in some phones as separate button: ie. N5110
142 GSM_KEY_INCREASEVOLUME,
144 * doesn't available in some phones as separate button: ie. N5110
146 GSM_KEY_DECREASEVOLUME,
147 GSM_KEY_UP = 0x17,
148 GSM_KEY_DOWN,
149 GSM_KEY_MENU,
151 * doesn't available in some phone: ie. N5110
153 GSM_KEY_NAMES
154 } GSM_KeyCode;
156 GSM_Error MakeKeySequence(char *text, GSM_KeyCode *KeyCode, int *Length);
158 /* ------------------------------- display features ------------------------ */
160 typedef enum {
161 GSM_CallActive = 1,
162 GSM_UnreadSMS,
163 GSM_VoiceCall,
164 GSM_FaxCall,
165 GSM_DataCall,
166 GSM_KeypadLocked,
167 GSM_SMSMemoryFull /* blinking envelope */
168 } GSM_DisplayFeature;
170 typedef struct {
171 int Number;
172 GSM_DisplayFeature Feature[7];
173 } GSM_DisplayFeatures;
175 /* ----------------------------- power source ------------------------------ */
177 typedef enum {
178 GSM_BatteryPowered = 1,
179 GSM_BatteryConnected,
180 GSM_BatteryNotConnected,
181 GSM_PowerFault
182 } GSM_ChargeState;
184 typedef struct {
186 * Signal strength in percent, -1 = unknown
188 int BatteryPercent;
190 * Charge state
192 GSM_ChargeState ChargeState;
193 } GSM_BatteryCharge;
195 /* ------------------------------ categories ------------------------------- */
197 #define GSM_MAX_CATEGORY_NAME_LENGTH 50
199 typedef enum {
200 Category_ToDo,
201 Category_Phonebook
202 } GSM_CategoryType;
204 typedef struct {
205 GSM_CategoryType Type;
206 int Location;
207 unsigned char Name[(GSM_MAX_CATEGORY_NAME_LENGTH + 1)*2];
208 } GSM_Category;
210 typedef struct {
211 GSM_CategoryType Type;
212 int Used;
213 } GSM_CategoryStatus;
215 /* ------------------- radio FM stations ---------------------------------- */
217 #define GSM_MAX_FMSTATION_LENGTH 12
218 #define GSM_MAX_FM_STATION 20
220 typedef struct {
221 int Location;
222 char StationName [(GSM_MAX_FMSTATION_LENGTH+1)*2];
223 double Frequency;
224 } GSM_FMStation;
226 /* ----------------------- filesystem ------------------------------------- */
228 typedef enum {
229 GSM_File_Java_JAR = 1,
230 GSM_File_Image_JPG,
231 GSM_File_Image_BMP,
232 GSM_File_Image_GIF,
233 GSM_File_Image_PNG,
234 GSM_File_Image_WBMP,
235 GSM_File_Ringtone_MIDI,
236 #ifdef DEVELOP
237 GSM_File_MMS,
238 #endif
239 GSM_File_Other
240 } GSM_FileType;
242 typedef struct {
243 int Used; /* how many bytes used */
244 unsigned char Name[300]; /* Name */
245 bool Folder; /* true, when folder */
246 int Level;
247 GSM_FileType Type;
248 unsigned char ID_FullName[400];
249 unsigned char *Buffer;
251 GSM_DateTime Modified;
252 bool ModifiedEmpty;
254 /* File attributes */
255 bool Protected;
256 bool ReadOnly;
257 bool Hidden;
258 bool System;
259 } GSM_File;
261 GSM_Error GSM_ReadFile(char *FileName, GSM_File *File);
263 GSM_Error GSM_JADFindData(GSM_File File, char *Vendor, char *Name, char *JAR, char *Version, int *Size);
265 void GSM_IdentifyFileFormat(GSM_File *File);
267 typedef struct {
268 int Free;
269 int Used;
270 } GSM_FileSystemStatus;
272 /* ----------------------------- GPRS access points ----------------------- */
274 typedef struct {
275 int Location;
276 unsigned char Name[300];
277 unsigned char URL[500];
278 bool Active;
279 } GSM_GPRSAccessPoint;
281 /* ------------------------------------------------------------------------ */
283 typedef enum {
284 GSM_Date_DDMMYYYY = 1,
285 GSM_Date_MMDDYYYY,
286 GSM_Date_YYYYMMDD
287 } GSM_DateFormat;
289 typedef struct {
290 unsigned char DateSeparator;
291 GSM_DateFormat DateFormat;
292 bool AMPMTime;
293 } GSM_Locale;
295 /* ------------------------------------------------------------------------ */
297 void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt);
298 void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start);
300 void SaveVCALText(char *Buffer, int *Length, char *Text, char *Start);
301 bool ReadVCALText(char *Buffer, char *Start, char *Value);
303 #endif
305 /* How should editor hadle tabs in this file? Add editor commands here.
306 * vim: noexpandtab sw=8 ts=8 sts=8: