1 /* 2 3 G N O K I I 4 5 A Linux/Unix toolset and driver for Nokia the phones. 6 7 This file is part of gnokii. 8 9 Gnokii is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 Gnokii is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with gnokii; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 Copyright (C) 1999-2000 Hugh Blemings & Pavel Jan�k ml. 24 Copyright (C) 2001-2004 Pawel Kot, BORBELY Zoltan 25 Copyright (C) 2001 Manfred Jonsson, Marian Jancar, Chris Kemp, Marcin Wiacek 26 Copyright (C) 2001-2002 Pavel Machek 27 Copyright (C) 2002 Markus Plail 28 29 Header file for the definitions, enums etc. that are used by all models of 30 handset. 31 32 */ 33 34 #ifndef _gnokii_common_h 35 #define _gnokii_common_h 36 37 #include <gnokii/rlp-common.h> 38 39 /* Type of connection. Now we support serial connection with FBUS cable and 40 IR (only with 61x0 models) */ 41 typedef enum { 42 GN_CT_NONE = -1,/* no connection type (error) */ 43 GN_CT_Serial, /* Serial connection. */ 44 GN_CT_DAU9P, /* Serial connection using DAU9P cable; use only with 6210/7110 if you want faster initialization */ 45 GN_CT_DLR3P, /* Serial connection using DLR3P cable */ 46 GN_CT_Infrared, /* Infrared connection. */ 47 GN_CT_Irda, /* Linux IrDA support */ 48 GN_CT_Bluetooth,/* Linux Bluetooth support */ 49 GN_CT_Tekram, /* Tekram Ir-Dongle */ 50 GN_CT_TCP, /* TCP network connection */ 51 GN_CT_M2BUS, /* Serial connection with M2BUS protocol */ 52 GN_CT_DKU2, /* DKU2 usb connection using nokia_dku2 kernel driver */ 53 GN_CT_DKU2LIBUSB, /* DKU2 usb connection using libusb */ 54 GN_CT_PCSC, /* PC/SC SIM Card reader using libpsclite */ 55 GN_CT_SOCKETPHONET /* Linux PHONET kernel driver */ 56 } gn_connection_type; 57 58 GNOKII_API const char *gn_connection_type2str(gn_connection_type t); 59 60 /* Maximum length of device name for serial port */ 61 62 #define GN_DEVICE_NAME_MAX_LENGTH (32) 63 64 /* Define an enum for specifying memory types for retrieving phonebook 65 entries, SMS messages etc. This type is not mobile specific - the model 66 code should take care of translation to mobile specific numbers - see 6110 67 code. 68 01/07/99: Two letter codes follow GSM 07.07 release 6.2.0 69 */ 70 typedef enum { 71 GN_MT_ME, /* Internal memory of the mobile equipment */ 72 GN_MT_SM, /* SIM card memory */ 73 GN_MT_FD, /* Fixed dial numbers */ 74 GN_MT_ON, /* Own numbers */ 75 GN_MT_EN, /* Emergency numbers */ 76 GN_MT_DC, /* Dialled numbers */ 77 GN_MT_RC, /* Received numbers */ 78 GN_MT_MC, /* Missed numbers */ 79 GN_MT_LD, /* Last dialled */ 80 GN_MT_BD, /* Barred Dialling Numbers */ 81 GN_MT_SD, /* Service Dialling Numbers */ 82 GN_MT_MT, /* combined ME and SIM phonebook */ 83 GN_MT_TA, /* for compatibility only: TA=computer memory */ 84 GN_MT_CB, /* Currently selected memory */ 85 GN_MT_IN, /* Inbox for folder aware phones */ 86 GN_MT_OU, /* Outbox, sent items */ 87 GN_MT_AR, /* Archive */ 88 GN_MT_TE, /* Templates */ 89 GN_MT_SR, /* Status reports */ 90 GN_MT_DR, /* Drafts */ 91 GN_MT_OUS, /* Outbox, items to be sent */ 92 GN_MT_F1, /* 1st CUSTOM FOLDER */ 93 GN_MT_F2, 94 GN_MT_F3, 95 GN_MT_F4, 96 GN_MT_F5, 97 GN_MT_F6, 98 GN_MT_F7, 99 GN_MT_F8, 100 GN_MT_F9, 101 GN_MT_F10, 102 GN_MT_F11, 103 GN_MT_F12, 104 GN_MT_F13, 105 GN_MT_F14, 106 GN_MT_F15, 107 GN_MT_F16, 108 GN_MT_F17, 109 GN_MT_F18, 110 GN_MT_F19, 111 GN_MT_F20, /* 20th CUSTOM FOLDER */ 112 GN_MT_BM, /* Cell Broadcast Messages */ 113 GN_MT_LAST = GN_MT_BM, 114 GN_MT_XX = 0xff /* Error code for unknown memory type (returned by fbus-xxxx functions). */ 115 } gn_memory_type; 116 117 GNOKII_API gn_memory_type gn_str2memory_type(const char *s); 118 GNOKII_API const char *gn_memory_type2str(gn_memory_type mt); 119 120 /* Power source types - see subclause 8.4 of ETSI TS 127 007 V8.6.0 (2009-01) */ 121 typedef enum { 122 GN_PS_UNKNOWN, /* +CME ERROR: ... */ 123 GN_PS_ACDC = 1, /* +CBC: 1,... AC/DC powered (charging) */ 124 GN_PS_BATTERY, /* +CBC: 0,... Battery powered (not charging) */ 125 GN_PS_NOBATTERY, /* +CBC: 2,... No battery */ 126 GN_PS_FAULT /* +CBC: 3,... There is a power fault and calls are inhibited */ 127 } gn_power_source; 128 129 GNOKII_API const char *gn_power_source2str(gn_power_source s); 130 131 /* Definition of security codes. */ 132 typedef enum { 133 GN_SCT_SecurityCode = 0x01, /* Security code. */ 134 GN_SCT_Pin, /* PIN. */ 135 GN_SCT_Pin2, /* PIN 2. */ 136 GN_SCT_Puk, /* PUK. */ 137 GN_SCT_Puk2, /* PUK 2. */ 138 GN_SCT_None /* Code not needed. */ 139 } gn_security_code_type; 140 141 GNOKII_API const char *gn_security_code_type2str(gn_security_code_type t); 142 143 /* Security code definition. */ 144 typedef struct { 145 gn_security_code_type type; /* Type of the code. */ 146 char code[10]; /* Actual code. */ 147 char new_code[10]; /* New code. */ 148 } gn_security_code; 149 150 /* This structure is used to get the current network status */ 151 typedef struct { 152 char network_code[10]; /* GSM network code */ 153 unsigned char cell_id[10]; /* CellID */ 154 unsigned char LAC[10]; /* LAC */ 155 } gn_network_info; 156 157 /* Limits for sizing of array in gn_phonebook_entry. Individual handsets may 158 not support these lengths so they have their own limits set. */ 159 #define GN_PHONEBOOK_NAME_MAX_LENGTH 61 /* For 6510 */ 160 #define GN_PHONEBOOK_NUMBER_MAX_LENGTH 49 /* For 6510 */ 161 #define GN_PHONEBOOK_SUBENTRIES_MAX_NUMBER 64 /* it was 10 for 6510, but modern phones supports more */ 162 /* 7110 is able to have in one 163 * entry 5 numbers and 4 164 * texts [email,notice,postal,url]. 165 * Dirk reported on gnokii-users that N70 has the following additional fields: 166 * - Company 167 * - Position 168 * - Aliasname 169 * - DTMF 170 * - User ID 171 * - all postal fields: 172 * - PO Box 173 * - Addition 174 * - Street 175 * - Zip Code 176 * - City 177 * - State/Province 178 * - Country 179 * - Birthday 180 */ 181 #define GN_PHONEBOOK_CALLER_GROUPS_MAX_NUMBER 5 182 #define GN_PHONEBOOK_ENTRY_MAX_LENGTH 1024 183 184 /* This data type is used to report the number of used and free positions in 185 memory (sim or internal). */ 186 typedef struct { 187 gn_memory_type memory_type; /* Type of the memory */ 188 int used; /* Number of used positions */ 189 int free; /* Number of free positions */ 190 } gn_memory_status; 191 192 /* General date and time structure. It is used for the SMS, calendar, alarm 193 * settings, clock etc. */ 194 typedef struct { 195 int year; /* The complete year specification - e.g. 1999. Y2K :-) */ 196 int month; /* January = 1 */ 197 int day; 198 int hour; 199 int minute; 200 int second; 201 int timezone; /* The difference between local time and GMT. 202 Note that different SMSC software treat this field 203 in the different ways. */ 204 } gn_timestamp; 205 206 /* Some phones (at the moment 7110/6510 series) supports extended phonebook 207 with additional data. Here we have structures for them */ 208 typedef enum { 209 GN_PHONEBOOK_NUMBER_None = 0x00, 210 GN_PHONEBOOK_NUMBER_Common = 0x01, 211 GN_PHONEBOOK_NUMBER_Home = 0x02, 212 GN_PHONEBOOK_NUMBER_Mobile = 0x03, 213 GN_PHONEBOOK_NUMBER_Fax = 0x04, 214 GN_PHONEBOOK_NUMBER_Work = 0x06, 215 GN_PHONEBOOK_NUMBER_General = 0x0a, 216 } gn_phonebook_number_type; 217 218 GNOKII_API const char *gn_phonebook_number_type2str(gn_phonebook_number_type t); 219 220 typedef enum { 221 GN_PHONEBOOK_ENTRY_Name = 0x07, 222 GN_PHONEBOOK_ENTRY_Email = 0x08, 223 GN_PHONEBOOK_ENTRY_Postal = 0x09, 224 GN_PHONEBOOK_ENTRY_Note = 0x0a, 225 GN_PHONEBOOK_ENTRY_Number = 0x0b, 226 GN_PHONEBOOK_ENTRY_Ringtone = 0x0c, /* Ringtone */ 227 GN_PHONEBOOK_ENTRY_Date = 0x13, /* Date is used for DC,RC,etc (last calls) */ 228 GN_PHONEBOOK_ENTRY_Pointer = 0x1a, /* Pointer to the other memory */ 229 GN_PHONEBOOK_ENTRY_Logo = 0x1b, /* Bitmap */ 230 GN_PHONEBOOK_ENTRY_LogoSwitch = 0x1c, 231 GN_PHONEBOOK_ENTRY_Group = 0x1e, /* Octect */ 232 GN_PHONEBOOK_ENTRY_URL = 0x2c, 233 GN_PHONEBOOK_ENTRY_Location = 0x2f, /* Octect */ 234 GN_PHONEBOOK_ENTRY_Image = 0x33, /* File ID */ 235 GN_PHONEBOOK_ENTRY_RingtoneAdv = 0x37, /* File ID or Ringtone */ 236 GN_PHONEBOOK_ENTRY_UserID = 0x38, 237 GN_PHONEBOOK_ENTRY_PTTAddress = 0x3f, 238 GN_PHONEBOOK_ENTRY_ExtGroup = 0x43, 239 GN_PHONEBOOK_ENTRY_Video = 0x45, /* File ID */ 240 GN_PHONEBOOK_ENTRY_FirstName = 0x46, 241 GN_PHONEBOOK_ENTRY_LastName = 0x47, 242 GN_PHONEBOOK_ENTRY_PostalAddress = 0x4a, 243 GN_PHONEBOOK_ENTRY_ExtendedAddress = 0x4b, 244 GN_PHONEBOOK_ENTRY_Street = 0x4c, 245 GN_PHONEBOOK_ENTRY_City = 0x4d, 246 GN_PHONEBOOK_ENTRY_StateProvince = 0x4e, 247 GN_PHONEBOOK_ENTRY_ZipCode = 0x4f, 248 GN_PHONEBOOK_ENTRY_Country = 0x50, 249 GN_PHONEBOOK_ENTRY_FormalName = 0x52, 250 GN_PHONEBOOK_ENTRY_JobTitle = 0x54, 251 GN_PHONEBOOK_ENTRY_Company = 0x55, 252 GN_PHONEBOOK_ENTRY_Nickname = 0x56, 253 GN_PHONEBOOK_ENTRY_Birthday = 0x57, /* Date */ 254 } gn_phonebook_entry_type; 255 256 GNOKII_API const char *gn_phonebook_entry_type2str(gn_phonebook_entry_type t); 257 GNOKII_API const char *gn_subentrytype2string(gn_phonebook_entry_type entry_type, gn_phonebook_number_type number_type); 258 259 typedef enum { 260 GN_PHONEBOOK_GROUP_Family, 261 GN_PHONEBOOK_GROUP_Vips, 262 GN_PHONEBOOK_GROUP_Friends, 263 GN_PHONEBOOK_GROUP_Work, 264 GN_PHONEBOOK_GROUP_Others, 265 GN_PHONEBOOK_GROUP_None, 266 } gn_phonebook_group_type; 267 268 GNOKII_API const char *gn_phonebook_group_type2str(gn_phonebook_group_type t); 269 270 #define GN_PHONEBOOK_PERSON_MAX_LENGTH 64 271 272 typedef struct { 273 int has_person; 274 char family_name[GN_PHONEBOOK_PERSON_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_LastName */ 275 char given_name[GN_PHONEBOOK_PERSON_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_FirstName */ 276 char additional_names[GN_PHONEBOOK_PERSON_MAX_LENGTH + 1]; 277 char honorific_prefixes[GN_PHONEBOOK_PERSON_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_FormalName */ 278 char honorific_suffixes[GN_PHONEBOOK_PERSON_MAX_LENGTH + 1]; 279 } gn_phonebook_person; 280 281 #define GN_PHONEBOOK_ADDRESS_MAX_LENGTH 64 282 283 typedef struct { 284 int has_address; 285 char post_office_box[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_PostalAddress */ 286 char extended_address[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_ExtendedAddress */ 287 char street[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_Street */ 288 char city[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_City */ 289 char state_province[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_StateProvince */ 290 char zipcode[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_ZipCode */ 291 char country[GN_PHONEBOOK_ADDRESS_MAX_LENGTH + 1]; /* GN_PHONEBOOK_ENTRY_Country */ 292 } gn_phonebook_address; 293 294 typedef struct { 295 gn_phonebook_entry_type entry_type; 296 gn_phonebook_number_type number_type; 297 union { 298 char number[GN_PHONEBOOK_NAME_MAX_LENGTH + 1]; /* Number, Name, Address, eMail... */ 299 /* GN_PHONEBOOK_ENTRY_Date 300 * GN_PHONEBOOK_ENTRY_Birthday 301 */ 302 gn_timestamp date; /* or the last calls list */ 303 /* GN_PHONEBOOK_ENTRY_Image 304 * GN_PHONEBOOK_ENTRY_RingtoneAdv 305 */ 306 char fileid[6]; /* Bitmap or ringtone fileid */ 307 /* GN_PHONEBOOK_ENTRY_ExtGroup 308 */ 309 int id; /* Any number, like ID */ 310 } data; 311 int id; 312 } gn_phonebook_subentry; 313 314 /* Define datatype for phonebook entry, used for getting/writing phonebook 315 entries. */ 316 typedef struct { 317 int empty; /* Is this entry empty? */ 318 char name[GN_PHONEBOOK_NAME_MAX_LENGTH + 1]; /* Plus 1 for 319 nullterminator. */ 320 char number[GN_PHONEBOOK_NUMBER_MAX_LENGTH + 1]; /* Number */ 321 gn_memory_type memory_type; /* Type of memory */ 322 gn_phonebook_group_type caller_group; /* Caller group - gn_phonebook_group_type */ 323 int location; /* Location */ 324 gn_timestamp date; /* The record date and time 325 of the number. */ 326 gn_phonebook_person person; /* Personal information */ 327 gn_phonebook_address address; /* Address information */ 328 gn_phonebook_subentry subentries[GN_PHONEBOOK_SUBENTRIES_MAX_NUMBER]; 329 /* For phones with 330 * additional phonebook 331 * entries */ 332 int subentries_count; /* Should be set to 0, if extended 333 phonebook is not used */ 334 } gn_phonebook_entry; 335 336 /* This define speed dialling entries. */ 337 typedef struct { 338 int number; /* Which number is used to dialling? */ 339 gn_memory_type memory_type; /* Memory type of the number. */ 340 int location; /* Location of the number in MemoryType. */ 341 } gn_speed_dial; 342 343 /* Define enum used to describe what sort of date/time support is 344 available. */ 345 typedef enum { 346 GN_DT_None, /* The mobile phone doesn't support time and date. */ 347 GN_DT_TimeOnly, /* The mobile phone supports only time. */ 348 GN_DT_DateOnly, /* The mobile phone supports only date. */ 349 GN_DT_DateTime /* Wonderful phone - it supports date and time. */ 350 } gn_datetime_support; 351 352 /* Define enums for RF units. GRF_CSQ asks for units in form used 353 in AT+CSQ command as defined by GSM 07.07 */ 354 typedef enum { 355 GN_RF_Arbitrary, 356 GN_RF_dBm, 357 GN_RF_mV, 358 GN_RF_uV, 359 GN_RF_CSQ, 360 GN_RF_Percentage 361 } gn_rf_unit; 362 363 /* Define enums for Battery units. */ 364 typedef enum { 365 GN_BU_Arbitrary, 366 GN_BU_Volts, 367 GN_BU_Minutes, 368 GN_BU_Percentage 369 } gn_battery_unit; 370 371 /* Define enums for Calendar Note types */ 372 typedef enum { 373 GN_CALNOTE_MEETING = 0x01, /* Meeting */ 374 GN_CALNOTE_CALL = 0x02, /* Call */ 375 GN_CALNOTE_BIRTHDAY = 0x04, /* Birthday */ 376 GN_CALNOTE_REMINDER = 0x08, /* Reminder */ 377 GN_CALNOTE_MEMO = 0x16, /* Memo */ 378 } gn_calnote_type; 379 380 GNOKII_API const char *gn_calnote_type2str(gn_calnote_type t); 381 382 typedef enum { 383 GN_CALNOTE_NEVER = 0, 384 GN_CALNOTE_DAILY = 24, 385 GN_CALNOTE_WEEKLY = 168, 386 GN_CALNOTE_2WEEKLY = 336, 387 GN_CALNOTE_MONTHLY = 65534, 388 GN_CALNOTE_YEARLY = 65535 389 } gn_calnote_recurrence; 390 391 GNOKII_API const char *gn_calnote_recurrence2str(gn_calnote_recurrence r); 392 393 #define GN_CALNOTE_MAX_NUMBER 1024 /* FIXME how many are possible? */ 394 #define GN_CALNOTE_MAX_LENGTH 258 395 #define GN_CALNOTE_NUMBER_MAX_LENGTH 49 396 397 typedef struct { 398 int enabled; /* Is alarm set? */ 399 int tone; /* Is alarm tone enabled? */ 400 gn_timestamp timestamp; 401 } gn_calnote_alarm; 402 403 /* Calendar note type */ 404 typedef struct { 405 int location; /* The number of the note in the phone memory */ 406 gn_calnote_type type; /* The type of the note */ 407 gn_timestamp time; /* The time of the note */ 408 gn_timestamp end_time; /* The end time of the note */ 409 gn_calnote_alarm alarm; /* The alarm of the note */ 410 char text[GN_CALNOTE_MAX_LENGTH]; /* The text of the note */ 411 char phone_number[GN_CALNOTE_NUMBER_MAX_LENGTH]; /* For Call only: the phone number */ 412 char mlocation[GN_CALNOTE_MAX_LENGTH]; /* For Meeting only: the location field */ 413 gn_calnote_recurrence recurrence; /* Recurrence of the note */ 414 int occurrences; /* Number of recurrence events; 0 for infinity */ 415 } gn_calnote; 416 417 /* List of Calendar Notes in phone */ 418 typedef struct { 419 unsigned int number; /* The number of notes in phone */ 420 unsigned int location[GN_CALNOTE_MAX_NUMBER]; /* Location of the nth note */ 421 unsigned int last; /* Index of the last allocated note */ 422 } gn_calnote_list; 423 424 /* ToDo things. It is only supported by the newer phones. */ 425 #define GN_TODO_MAX_LENGTH 256 426 #define GN_TODO_MAX_NUMBER 512 427 428 typedef enum { 429 GN_TODO_LOW = 3, 430 GN_TODO_MEDIUM = 2, 431 GN_TODO_HIGH = 1 432 } gn_todo_priority; 433 434 GNOKII_API const char *gn_todo_priority2str(gn_todo_priority p); 435 436 typedef struct { 437 int location; /* The number of the note in the phone memory */ 438 char text[GN_TODO_MAX_LENGTH]; /* The text of the note */ 439 gn_todo_priority priority; 440 } gn_todo; 441 442 /* List of ToDo Notes in phone */ 443 typedef struct { 444 int number; /* The number of notes in phone */ 445 int location[GN_TODO_MAX_NUMBER]; /* Location of the nth note */ 446 } gn_todo_list; 447 448 449 /* WAP */ 450 #define WAP_URL_MAX_LENGTH 258 451 #define WAP_NAME_MAX_LENGTH 52 452 #define WAP_SETTING_USERNAME_MAX_LENGTH 34 453 #define WAP_SETTING_NAME_MAX_LENGTH 22 454 #define WAP_SETTING_HOME_MAX_LENGTH 95 455 #define WAP_SETTING_APN_MAX_LENGTH 102 456 457 /* bookmarks */ 458 typedef struct { 459 int location; 460 char name[WAP_NAME_MAX_LENGTH]; 461 char URL[WAP_URL_MAX_LENGTH]; 462 } gn_wap_bookmark; 463 464 /* settings */ 465 typedef enum { 466 GN_WAP_SESSION_TEMPORARY = 0, 467 GN_WAP_SESSION_PERMANENT 468 } gn_wap_session; 469 470 GNOKII_API const char *gn_wap_session2str(gn_wap_session p); 471 472 typedef enum { 473 GN_WAP_AUTH_NORMAL = 0, 474 GN_WAP_AUTH_SECURE 475 } gn_wap_authentication; 476 477 GNOKII_API const char *gn_wap_authentication2str(gn_wap_authentication p); 478 479 typedef enum { 480 GN_WAP_BEARER_GSMDATA = 1, 481 GN_WAP_BEARER_GPRS = 3, 482 GN_WAP_BEARER_SMS = 7, 483 GN_WAP_BEARER_USSD = 9 /* FIXME real value? */ 484 } gn_wap_bearer; 485 486 GNOKII_API const char *gn_wap_bearer2str(gn_wap_bearer p); 487 488 typedef enum { 489 GN_WAP_CALL_ANALOGUE, 490 GN_WAP_CALL_ISDN 491 } gn_wap_call_type; 492 493 GNOKII_API const char *gn_wap_call_type2str(gn_wap_call_type p); 494 495 typedef enum { 496 GN_WAP_CALL_AUTOMATIC, 497 GN_WAP_CALL_9600, 498 GN_WAP_CALL_14400 499 } gn_wap_call_speed; 500 501 GNOKII_API const char *gn_wap_call_speed2str(gn_wap_call_speed p); 502 503 typedef enum { 504 GN_WAP_LOGIN_MANUAL, 505 GN_WAP_LOGIN_AUTOLOG 506 } gn_wap_login; 507 508 GNOKII_API const char *gn_wap_login2str(gn_wap_login p); 509 510 typedef enum { 511 GN_WAP_GPRS_ALWAYS, 512 GN_WAP_GPRS_WHENNEEDED 513 } gn_wap_gprs; 514 515 GNOKII_API const char *gn_wap_gprs2str(gn_wap_gprs p); 516 517 typedef struct { 518 int read_before_write; 519 int location; 520 int successors[4]; 521 char number [WAP_SETTING_NAME_MAX_LENGTH]; 522 char gsm_data_ip [WAP_SETTING_NAME_MAX_LENGTH]; 523 char gprs_ip [WAP_SETTING_NAME_MAX_LENGTH]; 524 char name [WAP_SETTING_NAME_MAX_LENGTH]; 525 char home [WAP_SETTING_HOME_MAX_LENGTH]; 526 char gsm_data_username [WAP_SETTING_USERNAME_MAX_LENGTH]; 527 char gsm_data_password [WAP_SETTING_NAME_MAX_LENGTH]; 528 char gprs_username [WAP_SETTING_USERNAME_MAX_LENGTH]; 529 char gprs_password [WAP_SETTING_NAME_MAX_LENGTH]; 530 char access_point_name [WAP_SETTING_APN_MAX_LENGTH]; 531 char sms_service_number [WAP_SETTING_NAME_MAX_LENGTH]; 532 char sms_server_number [WAP_SETTING_NAME_MAX_LENGTH]; 533 gn_wap_session session; 534 int security; 535 gn_wap_bearer bearer; 536 gn_wap_authentication gsm_data_authentication; 537 gn_wap_authentication gprs_authentication; 538 gn_wap_call_type call_type; 539 gn_wap_call_speed call_speed; 540 gn_wap_login gsm_data_login; 541 gn_wap_login gprs_login; 542 gn_wap_gprs gprs_connection; 543 } gn_wap_setting; 544 545 /* This structure is provided to allow common information about the particular 546 model to be looked up in a model independant way. Some of the values here 547 define minimum and maximum levels for values retrieved by the various Get 548 functions for example battery level. They are not defined as constants to 549 allow model specific code to set them during initialisation */ 550 typedef struct { 551 unsigned char *models; /* Models covered by this type, pipe '|' delimited. */ 552 553 /* Minimum and maximum levels for RF signal strength. Units are as per the 554 setting of RFLevelUnits. The setting of RFLevelUnits indicates the 555 default or "native" units used. In the case of the 3110 and 6110 series 556 these are arbitrary, ranging from 0 to 4. */ 557 float max_rf_level; 558 float min_rf_level; 559 gn_rf_unit rf_level_unit; 560 561 /* Minimum and maximum levels for battery level. Again, units are as per the 562 setting of GSM_BatteryLevelUnits. The value that BatteryLevelUnits is set 563 to indicates the "native" or default value that the phone supports. In the 564 case of the 3110 and 6110 series these are arbitrary, ranging from 0 to 4. */ 565 float max_battery_level; 566 float min_battery_level; 567 gn_battery_unit battery_level_unit; 568 569 /* Information about date, time and alarm support. In case of alarm 570 information we provide value for the number of alarms supported. */ 571 gn_datetime_support datetime_support; 572 gn_datetime_support alarm_support; 573 int maximum_alarms_number; 574 575 unsigned int startup_logo_height; /* Logo widths and heights - if supported */ 576 unsigned int startup_logo_width; 577 unsigned int operator_logo_height; 578 unsigned int operator_logo_width; 579 unsigned int caller_logo_height; 580 unsigned int caller_logo_width; 581 } gn_phone; 582 583 typedef enum { 584 GN_PROFILE_MESSAGE_NoTone = 0x00, 585 GN_PROFILE_MESSAGE_Standard = 0x01, 586 GN_PROFILE_MESSAGE_Special = 0x02, 587 GN_PROFILE_MESSAGE_BeepOnce = 0x03, 588 GN_PROFILE_MESSAGE_Ascending = 0x04 589 } gn_profile_message_type; 590 591 GNOKII_API const char *gn_profile_message_type2str(gn_profile_message_type p); 592 593 typedef enum { 594 GN_PROFILE_WARNING_Off = 0xff, 595 GN_PROFILE_WARNING_On = 0x04 596 } gn_profile_warning_type; 597 598 GNOKII_API const char *gn_profile_warning_type2str(gn_profile_warning_type p); 599 600 typedef enum { 601 GN_PROFILE_VIBRATION_Off = 0x00, 602 GN_PROFILE_VIBRATION_On = 0x01 603 } gn_profile_vibration_type; 604 605 GNOKII_API const char *gn_profile_vibration_type2str(gn_profile_vibration_type p); 606 607 typedef enum { 608 GN_PROFILE_CALLALERT_Ringing = 0x01, 609 GN_PROFILE_CALLALERT_BeepOnce = 0x02, 610 GN_PROFILE_CALLALERT_Off = 0x04, 611 GN_PROFILE_CALLALERT_RingOnce = 0x05, 612 GN_PROFILE_CALLALERT_Ascending = 0x06, 613 GN_PROFILE_CALLALERT_CallerGroups = 0x07 614 } gn_profile_callalert_type; 615 616 GNOKII_API const char *gn_profile_callalert_type2str(gn_profile_callalert_type p); 617 618 typedef enum { 619 GN_PROFILE_KEYVOL_Off = 0xff, 620 GN_PROFILE_KEYVOL_Level1 = 0x00, 621 GN_PROFILE_KEYVOL_Level2 = 0x01, 622 GN_PROFILE_KEYVOL_Level3 = 0x02 623 } gn_profile_keyvol_type; 624 625 GNOKII_API const char *gn_profile_keyvol_type2str(gn_profile_keyvol_type p); 626 627 typedef enum { 628 GN_PROFILE_VOLUME_Level1 = 0x06, 629 GN_PROFILE_VOLUME_Level2 = 0x07, 630 GN_PROFILE_VOLUME_Level3 = 0x08, 631 GN_PROFILE_VOLUME_Level4 = 0x09, 632 GN_PROFILE_VOLUME_Level5 = 0x0a, 633 } gn_profile_volume_type; 634 635 GNOKII_API const char *gn_profile_volume_type2str(gn_profile_volume_type p); 636 637 /* Structure to hold profile entries. */ 638 typedef struct { 639 int number; /* The number of the profile. */ 640 char name[40]; /* The name of the profile. */ 641 int default_name; /* 0-6, when default name is used, -1, when not. */ 642 int keypad_tone; /* Volume level for keypad tones. */ 643 int lights; /* Lights on/off. */ 644 int call_alert; /* Incoming call alert. */ 645 int ringtone; /* Ringtone for incoming call alert. */ 646 int volume; /* Volume of the ringing. */ 647 int message_tone; /* The tone for message indication. */ 648 int warning_tone; /* The tone for warning messages. */ 649 int vibration; /* Vibration? */ 650 int caller_groups; /* CallerGroups. */ 651 int automatic_answer; /* Does the phone auto-answer incoming call? */ 652 } gn_profile; 653 654 /* Limits for IMEI, Revision, Model and Manufacturer string storage. */ 655 #define GN_IMEI_MAX_LENGTH 20 656 #define GN_REVISION_MAX_LENGTH 20 657 #define GN_MODEL_MAX_LENGTH 32 658 #define GN_MANUFACTURER_MAX_LENGTH 32 659 660 #define GN_BCD_STRING_MAX_LENGTH 40 661 662 /* 663 * This data-type is used to specify the type of the number. See the official 664 * GSM specification 03.40, version 6.1.0, section 9.1.2.5, page 35-37 (old) 665 * 3GPP TS 23.040, version 6.7.0, section 9.1.2.5, page 39-41 (new) 666 */ 667 668 /* bit 7 is always 1 */ 669 #define GN_GSM_NUMBER_Type_Mask 0x70 670 671 #define GN_GSM_NUMBER_International_Mask 0x10 672 #define GN_GSM_NUMBER_National_Mask 0x20 673 #define GN_GSM_NUMBER_Network_Mask 0x30 674 #define GN_GSM_NUMBER_Subecriber_Mask 0x40 675 #define GN_GSM_NUMBER_Alphanumeric_Mask 0x50 676 #define GN_GSM_NUMBER_Abbreviated_Mask 0x60 677 678 #define GN_GSM_NUMBER_Numbering_Plan_Mask 0x0f 679 680 #define GN_GSM_NUMBER_ISDN_Plan_Mask 0x01 681 #define GN_GSM_NUMBER_Data_Plan_Mask 0x03 682 #define GN_GSM_NUMBER_Telex_Plan_Mask 0x04 683 #define GN_GSM_NUMBER_Specific1_Plan_Mask 0x05 684 #define GN_GSM_NUMBER_Specific2_Plan_Mask 0x06 685 #define GN_GSM_NUMBER_National_Plan_Mask 0x08 686 #define GN_GSM_NUMBER_Private_Plan_Mask 0x09 687 #define GN_GSM_NUMBER_ERMES_Plan_Mask 0x0a 688 689 typedef enum { 690 GN_GSM_NUMBER_Unknown = 0x81, /* Unknown number */ 691 GN_GSM_NUMBER_International = 0x91, /* International number */ 692 GN_GSM_NUMBER_National = 0xa1, /* National number */ 693 GN_GSM_NUMBER_Network = 0xb1, /* Network specific number */ 694 GN_GSM_NUMBER_Subscriber = 0xc1, /* Subscriber number */ 695 GN_GSM_NUMBER_Alphanumeric = 0xd0, /* Alphanumeric number */ 696 GN_GSM_NUMBER_Abbreviated = 0xe1 /* Abbreviated number */ 697 } gn_gsm_number_type; 698 699 typedef struct { 700 gn_gsm_number_type type; 701 char number[GN_BCD_STRING_MAX_LENGTH]; 702 } gn_gsm_number; 703 704 /* Data structures for the call divert */ 705 typedef enum { 706 GN_CDV_Unconditional = 0x00, 707 GN_CDV_Busy, 708 GN_CDV_NoAnswer, 709 GN_CDV_OutOfReach, 710 GN_CDV_NotAvailable, 711 GN_CDV_AllTypes 712 } gn_call_divert_type; 713 714 GNOKII_API const char *gn_call_divert_type2str(gn_call_divert_type p); 715 716 typedef enum { 717 GN_CDV_VoiceCalls = 0x01, 718 GN_CDV_FaxCalls, 719 GN_CDV_DataCalls, 720 GN_CDV_AllCalls 721 } gn_call_divert_call_type; 722 723 GNOKII_API const char *gn_call_divert_call_type2str(gn_call_divert_call_type p); 724 725 typedef enum { 726 GN_CDV_Disable = 0x00, 727 GN_CDV_Enable = 0x01, 728 GN_CDV_Query = 0x02, 729 GN_CDV_Register = 0x03, 730 GN_CDV_Erasure = 0x04 731 } gn_call_divert_operation; 732 733 GNOKII_API const char *gn_call_divert_operation2str(gn_call_divert_operation p); 734 735 typedef struct { 736 gn_call_divert_type type; 737 gn_call_divert_call_type ctype; 738 gn_call_divert_operation operation; 739 gn_gsm_number number; 740 unsigned int timeout; 741 } gn_call_divert; 742 743 typedef struct { 744 int full; /* indicates if we have full data read */ 745 unsigned int length; 746 unsigned char *data; 747 } gn_raw_data; 748 749 /* This enum is used for display status. */ 750 typedef enum { 751 GN_DISP_Call_In_Progress, /* Call in progress. */ 752 GN_DISP_Unknown, /* The meaning is unknown now :-( */ 753 GN_DISP_Unread_SMS, /* There is Unread SMS. */ 754 GN_DISP_Voice_Call, /* Voice call active. */ 755 GN_DISP_Fax_Call, /* Fax call active. */ 756 GN_DISP_Data_Call, /* Data call active. */ 757 GN_DISP_Keyboard_Lock, /* Keyboard lock status. */ 758 GN_DISP_SMS_Storage_Full /* Full SMS Memory. */ 759 } gn_display_status; 760 761 #define GN_DRAW_SCREEN_MAX_WIDTH 27 762 #define GN_DRAW_SCREEN_MAX_HEIGHT 6 763 764 typedef enum { 765 GN_DISP_DRAW_Clear, 766 GN_DISP_DRAW_Text, 767 GN_DISP_DRAW_Status 768 } gn_display_draw_command; 769 770 typedef struct { 771 int x; 772 int y; 773 unsigned char text[GN_DRAW_SCREEN_MAX_WIDTH + 1]; 774 } gn_display_text; 775 776 typedef struct { 777 gn_display_draw_command cmd; 778 union { 779 gn_display_text text; 780 gn_display_status status; 781 } data; 782 } gn_display_draw_msg; 783 784 typedef struct { 785 void (*output_fn)(gn_display_draw_msg *draw); 786 int state; 787 struct timeval last; 788 } gn_display_output; 789 790 typedef enum { 791 GN_KEY_NONE = 0x00, 792 GN_KEY_1 = 0x01, 793 GN_KEY_2, 794 GN_KEY_3, 795 GN_KEY_4, 796 GN_KEY_5, 797 GN_KEY_6, 798 GN_KEY_7, 799 GN_KEY_8, 800 GN_KEY_9, 801 GN_KEY_0, 802 GN_KEY_HASH, 803 GN_KEY_ASTERISK, 804 GN_KEY_POWER, 805 GN_KEY_GREEN, 806 GN_KEY_RED, 807 GN_KEY_INCREASEVOLUME, 808 GN_KEY_DECREASEVOLUME, 809 GN_KEY_UP = 0x17, 810 GN_KEY_DOWN, 811 GN_KEY_MENU, 812 GN_KEY_NAMES 813 } gn_key_code; 814 815 typedef struct { 816 int field; 817 char screen[50]; 818 } gn_netmonitor; 819 820 typedef struct { 821 int userlock; /* TRUE = user lock, FALSE = factory lock */ 822 int closed; 823 char data[12]; 824 int counter; 825 } gn_locks_info; 826 827 typedef struct { 828 int frequency; 829 int volume; 830 } gn_tone; 831 832 #define GN_RINGTONE_MAX_NAME 20 833 #define GN_RINGTONE_MAX_COUNT 256 834 835 typedef struct { 836 int location; 837 char name[20]; 838 int user_defined; 839 int readable; 840 int writable; 841 } gn_ringtone_info; 842 843 typedef struct { 844 int count; 845 int userdef_location; 846 int userdef_count; 847 gn_ringtone_info ringtone[GN_RINGTONE_MAX_COUNT]; 848 } gn_ringtone_list; 849 850 typedef enum { 851 GN_LOG_T_NONE = 0, 852 GN_LOG_T_STDERR = 1 853 } gn_log_target; 854 855 856 typedef enum { 857 GN_FT_None = 0, 858 GN_FT_NOL, 859 GN_FT_NGG, 860 GN_FT_NSL, 861 GN_FT_NLM, 862 GN_FT_BMP, 863 GN_FT_OTA, 864 GN_FT_XPMF, 865 GN_FT_RTTTL, 866 GN_FT_OTT, 867 GN_FT_MIDI, 868 GN_FT_NOKRAW_TONE, 869 GN_FT_GIF, 870 GN_FT_JPG, 871 GN_FT_MID, 872 GN_FT_NRT, 873 GN_FT_PNG, 874 } gn_filetypes; 875 876 typedef struct { 877 gn_filetypes filetype; /* file type */ 878 unsigned char *id; /* file id */ 879 char name[512]; /* file name */ 880 int year; /* datetime of creation/modification */ 881 int month; 882 int day; 883 int hour; 884 int minute; 885 int second; 886 int file_length; /* size of the file */ 887 int togo; /* amount of bytes to be sent yet */ 888 int just_sent; /* ??? */ 889 int folderId; /* folder id of the file */ 890 unsigned char *file; /* file contents */ 891 } gn_file; 892 893 typedef struct { 894 char path[512]; 895 gn_file **files; 896 int file_count; 897 int size; 898 } gn_file_list; 899 900 #endif /* _gnokii_common_h */ 901