1 /* 2 3 G N O K I I 4 5 A Linux/Unix toolset and driver for the mobile 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) 2002-2004 BORBELY Zoltan 25 Copyright (C) 2002-2011 Pawel Kot 26 Copyright (C) 2002 Ladis Michl, Markus Plail, Pavel Machek, Chris Kemp 27 28 */ 29 30 #ifndef _gnokii_data_h 31 #define _gnokii_data_h 32 33 #include <gnokii/common.h> 34 #include <gnokii/sms.h> 35 #include <gnokii/mms.h> 36 #include <gnokii/call.h> 37 #include <gnokii/error.h> 38 #include <gnokii/rlp-common.h> 39 40 /* For models table */ 41 typedef struct { 42 const char *model; /* e.g. 6310 */ 43 const char *product_name; /* e.g. NPE-4 */ 44 int flags; 45 } gn_phone_model; 46 47 /* This is a generic holder for high level information - eg a gn_bmp */ 48 typedef struct { 49 gn_sms_folder *sms_folder; 50 gn_sms_folder_list *sms_folder_list; 51 /* 52 * This is for phone driver, application using libgnokii should not 53 * touch this. 54 */ 55 gn_sms_raw *raw_sms; 56 /* 57 * This is for user communication, phone driver should not have to 58 * touch this one. 59 */ 60 gn_sms *sms; 61 gn_phonebook_entry *phonebook_entry; 62 gn_speed_dial *speed_dial; 63 gn_memory_status *memory_status; 64 gn_sms_message_list *message_list[GN_SMS_MESSAGE_MAX_NUMBER][GN_SMS_FOLDER_MAX_NUMBER]; 65 gn_sms_status *sms_status; 66 gn_sms_folder_stats *folder_stats[GN_SMS_FOLDER_MAX_NUMBER]; 67 gn_sms_message_center *message_center; 68 char *imei; 69 char *revision; 70 char *model; 71 char *manufacturer; 72 gn_network_info *network_info; 73 gn_wap_bookmark *wap_bookmark; 74 gn_wap_setting *wap_setting; 75 gn_todo *todo; 76 gn_todo_list *todo_list; 77 gn_calnote *calnote; 78 gn_calnote_list *calnote_list; 79 gn_bmp *bitmap; 80 gn_ringtone *ringtone; 81 gn_profile *profile; 82 gn_battery_unit *battery_unit; 83 float *battery_level; 84 gn_rf_unit *rf_unit; 85 float *rf_level; 86 gn_display_output *display_output; 87 char *incoming_call_nr; 88 gn_power_source *power_source; 89 gn_timestamp *datetime; 90 gn_calnote_alarm *alarm; 91 gn_raw_data *raw_data; 92 gn_call_divert *call_divert; 93 gn_error (*on_sms)(gn_sms *message, struct gn_statemachine *state, void *callback_data); 94 int *display_status; 95 void (*on_cell_broadcast)(gn_cb_message *message, struct gn_statemachine *state, void *callback_data); 96 gn_netmonitor *netmonitor; 97 gn_call_info *call_info; 98 void (*call_notification)(gn_call_status call_status, gn_call_info *call_info, 99 struct gn_statemachine *state, void *callback_data); 100 gn_rlp_f96_frame *rlp_frame; 101 int rlp_out_dtx; 102 void (*rlp_rx_callback)(gn_rlp_f96_frame *frame); 103 gn_security_code *security_code; 104 const char *dtmf_string; 105 unsigned char reset_type; 106 gn_key_code key_code; 107 unsigned char character; 108 gn_phone_model *phone; 109 gn_locks_info *locks_info; 110 gn_tone *tone; 111 gn_ringtone_list *ringtone_list; 112 gn_call_active *call_active; 113 gn_file_list *file_list; 114 gn_file *file; 115 /* 116 * This is a pointer to some data that may be used by any callback 117 * function. 118 */ 119 void *callback_data; 120 /* 121 * This is a callback function for any changes related to the network 122 * registration parameters changes: status, LAC, cell id. 123 */ 124 void (*reg_notification)(gn_network_info *info, void *callback_data); 125 /* 126 * This is callback function for file download progress. 127 * progress is value in range [0, 100]. 128 */ 129 void (*progress_indication)(int progress, void *callback_data); 130 /* 131 * This is for phone driver, application using libgnokii should not 132 * touch this. 133 */ 134 gn_mms_raw *raw_mms; 135 /* 136 * This is for user communication, phone driver should not have to 137 * touch this one. 138 */ 139 gn_mms *mms; 140 } gn_data; 141 142 /* 143 * A structure to hold information about the particular link 144 * The link comes 'under' the phone 145 */ 146 typedef struct { 147 /* A regularly called loop function. Timeout can be used to make the 148 * function block or not */ 149 gn_error (*loop)(struct timeval *timeout, struct gn_statemachine *state); 150 /* A pointer to the function used to send out a message. This is used 151 * by the phone specific code to send a message over the link */ 152 gn_error (*send_message)(unsigned int messagesize, unsigned char messagetype, unsigned char *message, 153 struct gn_statemachine *state); 154 void *link_instance; 155 void (*reset)(struct gn_statemachine *state); 156 void (*cleanup)(struct gn_statemachine *state); 157 } gn_link; 158 159 typedef struct { 160 char model[GN_MODEL_MAX_LENGTH]; /* Phone model */ 161 char irda_string[GN_MODEL_MAX_LENGTH]; /* If IrDA connection used, string shown in the discovery log */ 162 char port_device[GN_DEVICE_NAME_MAX_LENGTH]; /* Port device to use (e.g. /dev/ttyS0) */ 163 gn_connection_type connection_type; /* Connection type (e.g. serial, ir) */ 164 int init_length; /* Number of chars sent to sync the serial port */ 165 int serial_baudrate; /* Baud rate to use */ 166 int serial_write_usleep; /* Inter character delay or <0 to disable */ 167 int hardware_handshake; /* Select between hardware and software handshake */ 168 int require_dcd; /* DCD signal check */ 169 int smsc_timeout; /* How many seconds should we wait for the SMSC response, defaults to 10 seconds */ 170 char connect_script[256]; /* Script to run when device connection established */ 171 char disconnect_script[256]; /* Script to run when device connection closed */ 172 uint8_t rfcomm_cn; /* RFCOMM channel number to connect */ 173 unsigned int sm_retry; /* Indicates whether statemachine should do retries. Defaults to off. */ 174 /* Use with caution -- may break newer DCT4 phones */ 175 176 unsigned int use_locking; /* Should we use locking system or not */ 177 int set_dtr_rts; /* Should we set DTR and RTS bits on the serial line */ 178 /* do not change the following values from userspace */ 179 char m_model[GN_MODEL_MAX_LENGTH]; 180 char m_manufacturer[GN_MANUFACTURER_MAX_LENGTH]; 181 char m_revision[GN_REVISION_MAX_LENGTH]; 182 char m_imei[GN_IMEI_MAX_LENGTH]; 183 } gn_config; 184 185 typedef struct { 186 int fd; 187 gn_connection_type type; 188 void *device_instance; 189 } gn_device; 190 191 typedef enum { 192 GN_OP_Init, 193 GN_OP_Terminate, 194 GN_OP_GetModel, 195 GN_OP_GetRevision, 196 GN_OP_GetImei, 197 GN_OP_GetManufacturer, 198 GN_OP_Identify, 199 GN_OP_GetBitmap, 200 GN_OP_SetBitmap, 201 GN_OP_GetBatteryLevel, 202 GN_OP_GetRFLevel, 203 GN_OP_DisplayOutput, 204 GN_OP_GetMemoryStatus, 205 GN_OP_ReadPhonebook, 206 GN_OP_WritePhonebook, 207 GN_OP_DeletePhonebook, 208 GN_OP_GetPowersource, 209 GN_OP_GetAlarm, 210 GN_OP_GetSMSStatus, 211 GN_OP_GetIncomingCallNr, 212 GN_OP_GetNetworkInfo, 213 GN_OP_GetSecurityCode, 214 GN_OP_CreateSMSFolder, 215 GN_OP_DeleteSMSFolder, 216 GN_OP_GetSMS, 217 GN_OP_GetSMSnoValidate, 218 GN_OP_GetSMSFolders, 219 GN_OP_GetSMSFolderStatus, 220 GN_OP_GetIncomingSMS, 221 GN_OP_GetUnreadMessages, 222 GN_OP_GetNextSMS, 223 GN_OP_DeleteSMSnoValidate, 224 GN_OP_DeleteSMS, 225 GN_OP_SendSMS, 226 GN_OP_GetSpeedDial, 227 GN_OP_GetSMSCenter, 228 GN_OP_SetSMSCenter, 229 GN_OP_GetDateTime, 230 GN_OP_GetToDo, 231 GN_OP_GetCalendarNote, 232 GN_OP_CallDivert, 233 GN_OP_OnSMS, /* set data->on_sms and data->callback_data */ 234 GN_OP_PollSMS, 235 GN_OP_SetAlarm, 236 GN_OP_SetDateTime, 237 GN_OP_GetProfile, 238 GN_OP_SetProfile, 239 GN_OP_WriteToDo, 240 GN_OP_DeleteAllToDos, 241 GN_OP_WriteCalendarNote, 242 GN_OP_DeleteCalendarNote, 243 GN_OP_SetSpeedDial, 244 GN_OP_GetDisplayStatus, 245 GN_OP_PollDisplay, 246 GN_OP_SaveSMS, 247 GN_OP_SetCellBroadcast, /* set data->on_cell_broadcast and data->callback_data */ 248 GN_OP_NetMonitor, 249 GN_OP_MakeCall, 250 GN_OP_AnswerCall, 251 GN_OP_CancelCall, 252 GN_OP_SetCallNotification, /* set data->call_notification and data->callback_data */ 253 GN_OP_SendRLPFrame, 254 GN_OP_SetRLPRXCallback, 255 GN_OP_EnterSecurityCode, 256 GN_OP_GetSecurityCodeStatus, 257 GN_OP_ChangeSecurityCode, 258 GN_OP_SendDTMF, 259 GN_OP_Reset, 260 GN_OP_GetRingtone, 261 GN_OP_SetRingtone, 262 GN_OP_GetRawRingtone, 263 GN_OP_SetRawRingtone, 264 GN_OP_PressPhoneKey, 265 GN_OP_ReleasePhoneKey, 266 GN_OP_EnterChar, 267 GN_OP_Subscribe, 268 GN_OP_GetWAPBookmark, 269 GN_OP_WriteWAPBookmark, 270 GN_OP_DeleteWAPBookmark, 271 GN_OP_GetWAPSetting, 272 GN_OP_ActivateWAPSetting, 273 GN_OP_WriteWAPSetting, 274 GN_OP_GetLocksInfo, 275 GN_OP_GetActiveProfile, 276 GN_OP_SetActiveProfile, 277 GN_OP_PlayTone, 278 GN_OP_GetRingtoneList, 279 GN_OP_DeleteRingtone, 280 GN_OP_GetActiveCalls, 281 GN_OP_GetFileList, 282 GN_OP_GetFileId, 283 GN_OP_GetFile, 284 GN_OP_PutFile, 285 GN_OP_DeleteFile, 286 GN_OP_GetFileDetailsById, 287 GN_OP_GetFileById, 288 GN_OP_DeleteFileById, 289 GN_OP_GetMMS, 290 GN_OP_DeleteMMS, 291 GN_OP_Max, /* don't append anything after this entry */ 292 } gn_operation; 293 294 /* Undefined functions in fbus/mbus files */ 295 extern gn_error gn_unimplemented(void); 296 #define GN_UNIMPLEMENTED (void *) gn_unimplemented 297 298 #endif /* _gnokii_data_h */ 299