~ubuntu-branches/ubuntu/trusty/modem-manager-gui/trusty-backports

« back to all changes in this revision

Viewing changes to src/mmguicore.h

  • Committer: Package Import Robot
  • Author(s): Graham Inggs
  • Date: 2013-07-30 12:51:59 UTC
  • Revision ID: package-import@ubuntu.com-20130730125159-flzv882fhuzhmfmi
Tags: upstream-0.0.16
ImportĀ upstreamĀ versionĀ 0.0.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      mmguicore.h
 
3
 *      
 
4
 *      Copyright 2013 Alex <alex@linuxonly.ru>
 
5
 *      
 
6
 *      This program is free software: you can redistribute it and/or modify
 
7
 *      it under the terms of the GNU General Public License as published by
 
8
 *      the Free Software Foundation; either version 3 of the License, or
 
9
 *      (at your option) any later version.
 
10
 *      
 
11
 *      This program is distributed in the hope that it will be useful,
 
12
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *      GNU General Public License for more details.
 
15
 *      
 
16
 *      You should have received a copy of the GNU General Public License
 
17
 *      along with this program. If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef __MMGUICORE_H__
 
21
#define __MMGUICORE_H__
 
22
 
 
23
#include <glib.h>
 
24
#include <gmodule.h>
 
25
#include <net/if.h>
 
26
 
 
27
#include "netlink.h"
 
28
#include "smsdb.h"
 
29
 
 
30
#define MMGUI_SPEED_VALUES_NUMBER  20
 
31
 
 
32
#define MMGUI_THREAD_SLEEP_PERIOD   1 /*seconds*/
 
33
 
 
34
enum _mmgui_event {
 
35
        MMGUI_EVENT_DEVICE_ADDED = 0,
 
36
        MMGUI_EVENT_DEVICE_REMOVED,
 
37
        MMGUI_EVENT_DEVICE_ENABLED_STATUS,
 
38
        MMGUI_EVENT_DEVICE_BLOCKED_STATUS,
 
39
        MMGUI_EVENT_DEVICE_CONNECTION_STATUS,
 
40
                
 
41
        MMGUI_EVENT_SMS_LIST_READY,
 
42
        MMGUI_EVENT_SMS_COMPLETED,
 
43
        MMGUI_EVENT_SMS_SENT,
 
44
        MMGUI_EVENT_SMS_REMOVED,
 
45
        MMGUI_EVENT_SIGNAL_LEVEL_CHANGE,
 
46
        MMGUI_EVENT_NETWORK_MODE_CHANGE,
 
47
        MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE,
 
48
        MMGUI_EVENT_LOCATION_CHANGE,
 
49
        
 
50
        MMGUI_EVENT_MODEM_ENABLE_RESULT,
 
51
        MMGUI_EVENT_SCAN_RESULT,
 
52
        MMGUI_EVENT_USSD_RESULT,
 
53
        MMGUI_EVENT_NET_STATUS,
 
54
        MMGUI_EVENT_TRAFFIC_LIMIT,
 
55
        MMGUI_EVENT_TIME_LIMIT,
 
56
        MMGUI_EVENT_UPDATE_CONNECTIONS_LIST,
 
57
                
 
58
};
 
59
 
 
60
//External event callback
 
61
typedef void (*mmgui_event_ext_callback)(enum _mmgui_event event, gpointer mmguicore, gpointer data, gpointer userdata);
 
62
//Internal event callback
 
63
typedef void (*mmgui_event_int_callback)(enum _mmgui_event event, gpointer mmguicore, gpointer data);
 
64
 
 
65
enum _mmgui_module_priority {
 
66
        //module priority levels
 
67
        MMGUI_MODULE_PRIORITY_LOW = 0x00,
 
68
        MMGUI_MODULE_PRIORITY_NORMAL,
 
69
        MMGUI_MODULE_PRIORITY_RECOMMENDED
 
70
};
 
71
 
 
72
enum _mmgui_module_type {
 
73
        //module types
 
74
        MMGUI_MODULE_TYPE_MODEM_MANAGER = 0x00,
 
75
        MMGUI_MODULE_TYPE_CONNECTION_MANGER
 
76
};
 
77
 
 
78
enum _mmgui_module_functions {
 
79
        //module functions bitmask
 
80
        MMGUI_MODULE_FUNCTION_BASIC     = 0x00,
 
81
        //MMGUI_MODULE_FUNCTION_VOICECALL = 0x01
 
82
};
 
83
 
 
84
enum _mmgui_module_requirement {
 
85
        //module requirements
 
86
        MMGUI_MODULE_REQUIREMENT_SERVICE = 0x00,
 
87
        MMGUI_MODULE_REQUIREMENT_FILE,
 
88
        MMGUI_MODULE_REQUIREMENT_NONE
 
89
};
 
90
 
 
91
struct _mmguimodule {
 
92
        //module description
 
93
        guint identifier;
 
94
        enum _mmgui_module_type type;
 
95
        enum _mmgui_module_requirement requirement;
 
96
        enum _mmgui_module_priority priority;
 
97
        enum _mmgui_module_functions functions;
 
98
        gchar servicename[256];
 
99
        gchar description[256];
 
100
        gchar filename[256];
 
101
};
 
102
 
 
103
typedef struct _mmguimodule *mmguimodule_t;
 
104
 
 
105
enum _mmgui_device_types {
 
106
        MMGUI_DEVICE_TYPE_GSM = 1,
 
107
        MMGUI_DEVICE_TYPE_CDMA
 
108
};
 
109
 
 
110
enum _mmgui_device_modes {
 
111
        MMGUI_DEVICE_MODE_UNKNOWN = 0,
 
112
        MMGUI_DEVICE_MODE_GSM,
 
113
        MMGUI_DEVICE_MODE_GSM_COMPACT,
 
114
        MMGUI_DEVICE_MODE_GPRS,
 
115
        MMGUI_DEVICE_MODE_EDGE,
 
116
        MMGUI_DEVICE_MODE_UMTS,
 
117
        MMGUI_DEVICE_MODE_HSDPA,
 
118
        MMGUI_DEVICE_MODE_HSUPA,
 
119
        MMGUI_DEVICE_MODE_HSPA,
 
120
        MMGUI_DEVICE_MODE_HSPA_PLUS,
 
121
        MMGUI_DEVICE_MODE_1XRTT,
 
122
        MMGUI_DEVICE_MODE_EVDO0,
 
123
        MMGUI_DEVICE_MODE_EVDOA,
 
124
        MMGUI_DEVICE_MODE_EVDOB,
 
125
        MMGUI_DEVICE_MODE_LTE
 
126
};
 
127
 
 
128
enum _mmgui_network_availability {
 
129
        MMGUI_NA_UNKNOWN = 0,
 
130
        MMGUI_NA_AVAILABLE,
 
131
        MMGUI_NA_CURRENT,
 
132
        MMGUI_NA_FORBIDDEN
 
133
};
 
134
 
 
135
enum _mmgui_access_tech {
 
136
        MMGUI_ACCESS_TECH_GSM = 0,
 
137
        MMGUI_ACCESS_TECH_GSM_COMPACT,
 
138
        MMGUI_ACCESS_TECH_UMTS,
 
139
        MMGUI_ACCESS_TECH_EDGE,
 
140
        MMGUI_ACCESS_TECH_HSDPA,
 
141
        MMGUI_ACCESS_TECH_HSUPA,
 
142
        MMGUI_ACCESS_TECH_HSPA,
 
143
        MMGUI_ACCESS_TECH_HSPA_PLUS,
 
144
    MMGUI_ACCESS_TECH_1XRTT,
 
145
    MMGUI_ACCESS_TECH_EVDO0,
 
146
    MMGUI_ACCESS_TECH_EVDOA,
 
147
    MMGUI_ACCESS_TECH_EVDOB,
 
148
    MMGUI_ACCESS_TECH_LTE,
 
149
    MMGUI_ACCESS_TECH_UNKNOWN
 
150
};
 
151
 
 
152
enum _mmgui_ussd_encoding {
 
153
        MMGUI_USSD_ENCODING_GSM7 = 0,
 
154
        MMGUI_USSD_ENCODING_UCS2
 
155
};
 
156
 
 
157
enum _mmgui_reg_status {
 
158
        MMGUI_REG_STATUS_IDLE = 0,
 
159
        MMGUI_REG_STATUS_HOME,
 
160
        MMGUI_REG_STATUS_SEARCHING,
 
161
        MMGUI_REG_STATUS_DENIED,
 
162
        MMGUI_REG_STATUS_UNKNOWN,
 
163
        MMGUI_REG_STATUS_ROAMING
 
164
};
 
165
 
 
166
enum _mmgui_device_state {
 
167
        MMGUI_DEVICE_STATE_UNKNOWN       = 0,
 
168
    MMGUI_DEVICE_STATE_DISABLED      = 10,
 
169
    MMGUI_DEVICE_STATE_DISABLING     = 20,
 
170
    MMGUI_DEVICE_STATE_ENABLING      = 30,
 
171
    MMGUI_DEVICE_STATE_ENABLED       = 40,
 
172
    MMGUI_DEVICE_STATE_SEARCHING     = 50,
 
173
    MMGUI_DEVICE_STATE_REGISTERED    = 60,
 
174
    MMGUI_DEVICE_STATE_DISCONNECTING = 70,
 
175
    MMGUI_DEVICE_STATE_CONNECTING    = 80,
 
176
    MMGUI_DEVICE_STATE_CONNECTED     = 90
 
177
};
 
178
 
 
179
enum _mmgui_ussd_state {
 
180
        MMGUI_USSD_STATE_UNKNOWN = 0,
 
181
        MMGUI_USSD_STATE_IDLE,
 
182
        MMGUI_USSD_STATE_ACTIVE,
 
183
        MMGUI_USSD_STATE_USER_RESPONSE
 
184
};
 
185
 
 
186
enum _mmgui_ussd_validation {
 
187
        MMGUI_USSD_VALIDATION_INVALID = 0,
 
188
        MMGUI_USSD_VALIDATION_REQUEST,
 
189
        MMGUI_USSD_VALIDATION_RESPONSE
 
190
};
 
191
 
 
192
enum _mmgui_contacts_storage {
 
193
        MMGUI_CONTACTS_STORAGE_UNKNOWN   = 0,
 
194
    MMGUI_MODEM_CONTACTS_STORAGE_ME  = 1,
 
195
    MMGUI_MODEM_CONTACTS_STORAGE_SM  = 2,
 
196
    MMGUI_MODEM_CONTACTS_STORAGE_MT  = 3,
 
197
};
 
198
 
 
199
/*Capbilities specifications*/
 
200
enum _mmgui_sms_capabilities {
 
201
        MMGUI_SMS_CAPS_NONE              = 0,
 
202
    MMGUI_SMS_CAPS_RECEIVE           = 1 << 1,
 
203
    MMGUI_SMS_CAPS_SEND              = 1 << 2
 
204
};
 
205
 
 
206
enum _mmgui_ussd_capabilities {
 
207
        MMGUI_USSD_CAPS_NONE             = 0,
 
208
    MMGUI_USSD_CAPS_SEND             = 1 << 1
 
209
};
 
210
 
 
211
enum _mmgui_location_capabilities {
 
212
        MMGUI_LOCATION_CAPS_NONE         = 0,
 
213
    MMGUI_LOCATION_CAPS_3GPP         = 1 << 1,
 
214
    MMGUI_LOCATION_CAPS_GPS          = 1 << 2
 
215
};
 
216
 
 
217
enum _mmgui_scan_capabilities {
 
218
        MMGUI_SCAN_CAPS_NONE             = 0,
 
219
    MMGUI_SCAN_CAPS_OBSERVE          = 1 << 1
 
220
};
 
221
 
 
222
enum _mmgui_contacts_capabilities {
 
223
        MMGUI_CONTACTS_CAPS_NONE         = 0,
 
224
    MMGUI_CONTACTS_CAPS_EXPORT       = 1 << 1,
 
225
    MMGUI_CONTACTS_CAPS_EDIT         = 1 << 2,
 
226
    MMGUI_CONTACTS_CAPS_EXTENDED     = 1 << 3
 
227
};
 
228
 
 
229
enum _mmgui_device_operation {
 
230
        MMGUI_DEVICE_OPERATION_IDLE = 0,
 
231
        MMGUI_DEVICE_OPERATION_ENABLE,
 
232
        MMGUI_DEVICE_OPERATION_SEND_SMS,
 
233
        MMGUI_DEVICE_OPERATION_SEND_USSD,
 
234
        MMGUI_DEVICE_OPERATION_SCAN,
 
235
        MMGUI_DEVICE_OPERATIONS
 
236
};
 
237
 
 
238
enum _mmgui_device_state_request {
 
239
        MMGUI_DEVICE_STATE_REQUEST_ENABLED = 0,
 
240
        MMGUI_DEVICE_STATE_REQUEST_LOCKED,
 
241
        MMGUI_DEVICE_STATE_REQUEST_REGISTERED,
 
242
        MMGUI_DEVICE_STATE_REQUEST_CONNECTED
 
243
};
 
244
 
 
245
enum _mmgui_event_action {
 
246
        MMGUI_EVENT_ACTION_NOTHING = 0,
 
247
        MMGUI_EVENT_ACTION_DISCONNECT
 
248
};
 
249
 
 
250
struct _mmgui_scanned_network {
 
251
        enum _mmgui_network_availability status;
 
252
        enum _mmgui_access_tech access_tech;
 
253
        guint operator_num;
 
254
        gchar *operator_long;
 
255
        gchar *operator_short;
 
256
};
 
257
 
 
258
typedef struct _mmgui_scanned_network *mmgui_scanned_network_t;
 
259
 
 
260
struct _mmgui_ext_connection {
 
261
        guchar state;
 
262
        guchar family;
 
263
        gushort srcport;
 
264
        guint dqueue;
 
265
        guint inode;
 
266
        guint userid;
 
267
        guint apppid;
 
268
        gchar *appname;
 
269
        gchar *dsthostname;
 
270
        gchar srcaddr[INET6_ADDRSTRLEN + 8];
 
271
        gchar dstaddr[INET6_ADDRSTRLEN + 8];
 
272
        gboolean existsflag;
 
273
};
 
274
 
 
275
typedef struct _mmgui_ext_connection *mmgui_ext_connection_t;
 
276
 
 
277
struct _mmgui_contact {
 
278
        guint id;        //Internal private number
 
279
        gchar *name;     //Full name of the contact
 
280
        gchar *number;   //Telephone number
 
281
        gchar *email;    //Email address
 
282
        gchar *group;    //Group this contact belongs to
 
283
        gchar *name2;    //Additional contact name
 
284
        gchar *number2;  //Additional contact telephone number
 
285
        gboolean hidden; //Boolean flag to specify whether this entry is hidden or not
 
286
        guint storage;   //Phonebook in which the contact is stored
 
287
};
 
288
 
 
289
typedef struct _mmgui_contact *mmgui_contact_t;
 
290
 
 
291
struct _mmgui_traffic_limits {
 
292
        gboolean trafficenabled;
 
293
        gboolean trafficexecuted;
 
294
        guint trafficamount;
 
295
        guint trafficunits;
 
296
        guint64 trafficfull;
 
297
        gchar *trafficmessage;
 
298
        guint trafficaction;
 
299
        gboolean timeenabled;
 
300
        gboolean timeexecuted;
 
301
        guint timeamount;
 
302
        guint timeunits;
 
303
        guint64 timefull;
 
304
        gchar *timemessage;
 
305
        guint timeaction;
 
306
};
 
307
 
 
308
typedef struct _mmgui_traffic_limits *mmgui_traffic_limits_t;
 
309
 
 
310
struct _mmgui_traffic_stats {
 
311
        gint64 rxbytes;
 
312
        gint64 rxpackets;
 
313
        gint64 rxerrs;
 
314
        gint64 rxdrop;
 
315
        gint64 rxfifo;
 
316
        gint64 rxframe;
 
317
        gint64 rxcompressed;
 
318
        gint64 rxmulticast;
 
319
        gint64 txbytes;
 
320
        gint64 txpackets;
 
321
        gint64 txerrs;
 
322
        gint64 txdrop;
 
323
        gint64 txfifo;
 
324
        gint64 txcolls;
 
325
        gint64 txcarrier;
 
326
        gint64 txcompressed;
 
327
};
 
328
 
 
329
typedef struct _mmgui_traffic_stats *mmgui_traffic_stats_t;
 
330
 
 
331
struct _mmguidevice {
 
332
        guint id;
 
333
        /*State*/
 
334
        gboolean enabled;
 
335
        gboolean blocked;
 
336
        gboolean registered;
 
337
        enum _mmgui_device_operation operation;
 
338
        //Info
 
339
        gchar *manufacturer;
 
340
        gchar *model;
 
341
        gchar *version;
 
342
        gchar *port;
 
343
        gchar *internalid;
 
344
        gchar *persistentid;
 
345
        gchar *objectpath;
 
346
        gchar *sysfspath;
 
347
        enum _mmgui_device_types type;
 
348
        gchar *imei;
 
349
        gchar *imsi;
 
350
        gchar *operatorcode;
 
351
        gchar *operatorname;
 
352
        enum _mmgui_reg_status regstatus;
 
353
        guint allmode;
 
354
        enum _mmgui_device_modes mode;
 
355
        guint siglevel;
 
356
        //Location
 
357
        guint locationcaps;
 
358
        guint loc3gppdata[4]; /*mcc/mnc/lac/ci*/
 
359
        gfloat locgpsdata[4]; /*latitude/longitude/altitude/time*/
 
360
        //SMS
 
361
        guint smscaps;
 
362
        gpointer smsdb;
 
363
        //USSD
 
364
        guint ussdcaps;
 
365
        enum _mmgui_ussd_encoding ussdencoding;
 
366
        //Scan
 
367
        guint scancaps;
 
368
        //Traffic
 
369
        guint64 rxbytes;
 
370
        guint64 txbytes;
 
371
        guint64 sessiontime;
 
372
        time_t speedchecktime;
 
373
        time_t smschecktime;
 
374
        gfloat speedvalues[2][MMGUI_SPEED_VALUES_NUMBER];
 
375
        guint speedindex;
 
376
        gboolean connected;
 
377
        gchar interface[IFNAMSIZ];
 
378
        time_t sessionstarttime;
 
379
        gpointer trafficdb;
 
380
        //Contacts
 
381
        guint contactscaps;
 
382
        GSList *contactslist;
 
383
};
 
384
 
 
385
typedef struct _mmguidevice *mmguidevice_t;
 
386
 
 
387
//Modem manager module functions 
 
388
typedef gboolean (*mmgui_module_init_func)(mmguimodule_t module);
 
389
typedef gboolean (*mmgui_module_open_func)(gpointer mmguicore);
 
390
typedef gboolean (*mmgui_module_close_func)(gpointer mmguicore);
 
391
typedef gchar *(*mmgui_module_last_error_func)(gpointer mmguicore);
 
392
typedef gboolean (*mmgui_module_interrupt_operation_func)(gpointer mmguicore);
 
393
typedef gboolean (*mmgui_module_set_timeout_func)(gpointer mmguicore, guint operation, guint timeout);
 
394
typedef guint (*mmgui_module_devices_enum_func)(gpointer mmguicore, GSList **devicelist);
 
395
typedef gboolean (*mmgui_module_devices_open_func)(gpointer mmguicore, mmguidevice_t device);
 
396
typedef gboolean (*mmgui_module_devices_close_func)(gpointer mmguicore);
 
397
typedef gboolean (*mmgui_module_devices_state_func)(gpointer mmguicore, enum _mmgui_device_state_request request);
 
398
typedef gboolean (*mmgui_module_devices_update_state_func)(gpointer mmguicore);
 
399
typedef gboolean (*mmgui_module_devices_information_func)(gpointer mmguicore);
 
400
typedef gboolean (*mmgui_module_devices_enable_func)(gpointer mmguicore, gboolean enabled);
 
401
typedef guint (*mmgui_module_sms_enum_func)(gpointer mmguicore, GSList **smslist);
 
402
typedef mmgui_sms_message_t (*mmgui_module_sms_get_func)(gpointer mmguicore, guint index);
 
403
typedef gboolean (*mmgui_module_sms_delete_func)(gpointer mmguicore, guint index);
 
404
typedef gboolean (*mmgui_module_sms_send_func)(gpointer mmguicore, gchar* number, gchar *text);
 
405
typedef gboolean (*mmgui_module_ussd_cancel_session_func)(gpointer mmguicore);
 
406
typedef enum _mmgui_ussd_state (*mmgui_module_ussd_get_state_func)(gpointer mmguicore);
 
407
typedef gboolean (*mmgui_module_ussd_send_func)(gpointer mmguicore, gchar *request, enum _mmgui_ussd_validation validationid);
 
408
typedef gboolean (*mmgui_module_networks_scan_func)(gpointer mmguicore);
 
409
typedef guint (*mmgui_module_contacts_enum_func)(gpointer mmguicore, GSList **contactslist);
 
410
typedef gboolean (*mmgui_module_contacts_delete_func)(gpointer mmguicore, guint index);
 
411
typedef gint (*mmgui_module_contacts_add_func)(gpointer mmguicore, mmgui_contact_t contact);
 
412
//Connection manager module functions
 
413
typedef gboolean (*mmgui_module_connection_open_func)(gpointer mmguicore);
 
414
typedef gboolean (*mmgui_module_connection_close_func)(gpointer mmguicore);
 
415
typedef gchar *(*mmgui_module_connection_last_error_func)(gpointer mmguicore);
 
416
typedef gboolean (*mmgui_module_device_connection_open_func)(gpointer mmguicore, mmguidevice_t device);
 
417
typedef gboolean (*mmgui_module_device_connection_close_func)(gpointer mmguicore);
 
418
typedef gboolean (*mmgui_module_device_connection_status_func)(gpointer mmguicore);
 
419
typedef guint64 (*mmgui_module_device_connection_timestamp_func)(gpointer mmguicore);
 
420
typedef gboolean (*mmgui_module_device_connection_disconnect_func)(gpointer mmguicore);
 
421
 
 
422
struct _mmguicore {
 
423
        //Modules list
 
424
        GSList *modules;
 
425
        //Modem manager module
 
426
        GModule *module;
 
427
        gpointer moduledata;
 
428
        gpointer moduleptr;
 
429
        //Connection manager module
 
430
        GModule *cmodule;
 
431
        gpointer cmoduledata;
 
432
        gpointer cmoduleptr;
 
433
        //Modem manager module functions 
 
434
        mmgui_module_open_func open_func;
 
435
        mmgui_module_close_func close_func;
 
436
        mmgui_module_last_error_func last_error_func;
 
437
        mmgui_module_interrupt_operation_func interrupt_operation_func;
 
438
        mmgui_module_set_timeout_func set_timeout_func;
 
439
        mmgui_module_devices_enum_func devices_enum_func;
 
440
        mmgui_module_devices_open_func devices_open_func;
 
441
        mmgui_module_devices_close_func devices_close_func;
 
442
        mmgui_module_devices_state_func devices_state_func;
 
443
        mmgui_module_devices_update_state_func devices_update_state_func;
 
444
        mmgui_module_devices_information_func devices_information_func;
 
445
        mmgui_module_devices_enable_func devices_enable_func;
 
446
        mmgui_module_sms_enum_func sms_enum_func;
 
447
        mmgui_module_sms_get_func sms_get_func;
 
448
        mmgui_module_sms_delete_func sms_delete_func;
 
449
        mmgui_module_sms_send_func sms_send_func;
 
450
        mmgui_module_ussd_cancel_session_func ussd_cancel_session_func;
 
451
        mmgui_module_ussd_get_state_func ussd_get_state_func;
 
452
        mmgui_module_ussd_send_func ussd_send_func;
 
453
        mmgui_module_networks_scan_func networks_scan_func;
 
454
        mmgui_module_contacts_enum_func contacts_enum_func;
 
455
        mmgui_module_contacts_delete_func contacts_delete_func;
 
456
        mmgui_module_contacts_add_func contacts_add_func;
 
457
        //Connection manager module functions
 
458
        mmgui_module_connection_open_func connection_open_func;
 
459
        mmgui_module_connection_close_func connection_close_func;
 
460
        mmgui_module_connection_last_error_func connection_last_error_func;
 
461
        mmgui_module_device_connection_open_func device_connection_open_func;
 
462
        mmgui_module_device_connection_close_func device_connection_close_func;
 
463
        mmgui_module_device_connection_status_func device_connection_status_func;
 
464
        mmgui_module_device_connection_timestamp_func device_connection_timestamp_func;
 
465
        mmgui_module_device_connection_disconnect_func device_connection_disconnect_func;
 
466
        //Devices
 
467
        GSList *devices;
 
468
        mmguidevice_t device;
 
469
        //Callbacks
 
470
        mmgui_event_int_callback eventcb;
 
471
        mmgui_event_ext_callback extcb;
 
472
        //Traffic limits
 
473
        mmgui_traffic_limits_t limits;
 
474
        //User data pointer
 
475
        gpointer userdata;
 
476
        //Netlink interface
 
477
        mmgui_netlink_t netlink;
 
478
        GHashTable *connections;
 
479
        //Work thread
 
480
        GThread *workthread;
 
481
        gint workthreadctl[2];
 
482
        #if GLIB_CHECK_VERSION(2,32,0)
 
483
                GMutex workthreadmutex;
 
484
                GMutex connsyncmutex;
 
485
        #else
 
486
                GMutex *workthreadmutex;
 
487
                GMutex *connsyncmutex;
 
488
        #endif
 
489
};
 
490
 
 
491
typedef struct _mmguicore *mmguicore_t;
 
492
 
 
493
//Devices
 
494
gboolean mmguicore_devices_open(mmguicore_t mmguicore, guint deviceid, gboolean openfirst);
 
495
 
 
496
gboolean mmguicore_devices_enable(mmguicore_t mmguicore, gboolean enabled);
 
497
GSList *mmguicore_devices_get_list(mmguicore_t mmguicore);
 
498
mmguidevice_t mmguicore_devices_get_current(mmguicore_t mmguicore);
 
499
gboolean mmguicore_devices_get_enabled(mmguicore_t mmguicore);
 
500
gboolean mmguicore_devices_get_locked(mmguicore_t mmguicore);
 
501
gboolean mmguicore_devices_get_registered(mmguicore_t mmguicore);
 
502
gboolean mmguicore_devices_get_connected(mmguicore_t mmguicore);
 
503
gboolean mmguicore_devices_update_device_state(mmguicore_t mmguicore);
 
504
const gchar *mmguicore_devices_get_identifier(mmguicore_t mmguicore);
 
505
const gchar *mmguicore_devices_get_internal_identifier(mmguicore_t mmguicore);
 
506
gpointer mmguicore_devices_get_sms_db(mmguicore_t mmguicore);
 
507
gpointer mmguicore_devices_get_traffic_db(mmguicore_t mmguicore);
 
508
gboolean mmguicore_devices_get_connection_status(mmguicore_t mmguicore);
 
509
guint64 mmguicore_devices_get_connection_timestamp(mmguicore_t mmguicore);
 
510
guint mmguicore_devices_get_current_operation(mmguicore_t mmguicore);
 
511
//Location
 
512
guint mmguicore_location_get_capabilities(mmguicore_t mmguicore);
 
513
//SMS
 
514
guint mmguicore_sms_get_capabilities(mmguicore_t mmguicore);
 
515
void mmguicore_sms_message_free(mmgui_sms_message_t message);
 
516
GSList *mmguicore_sms_enum(mmguicore_t mmguicore, gboolean concatenation);
 
517
mmgui_sms_message_t mmguicore_sms_get(mmguicore_t mmguicore, guint index);
 
518
gboolean mmguicore_sms_delete(mmguicore_t mmguicore, guint index);
 
519
gboolean mmguicore_sms_validate_number(const gchar *number);
 
520
gboolean mmguicore_sms_send(mmguicore_t mmguicore, gchar *number, gchar *text);
 
521
//USSD
 
522
guint mmguicore_ussd_get_capabilities(mmguicore_t mmguicore);
 
523
enum _mmgui_ussd_validation mmguicore_ussd_validate_request(gchar *request);
 
524
gboolean mmguicore_ussd_cancel_session(mmguicore_t mmguicore);
 
525
enum _mmgui_ussd_state mmguicore_ussd_get_state(mmguicore_t mmguicore);
 
526
gboolean mmguicore_ussd_send(mmguicore_t mmguicore, gchar *request);
 
527
gboolean mmguicore_ussd_set_encoding(mmguicore_t mmguicore, enum _mmgui_ussd_encoding encoding);
 
528
enum _mmgui_ussd_encoding mmguicore_ussd_get_encoding(mmguicore_t mmguicore);
 
529
//Scan
 
530
guint mmguicore_newtworks_scan_get_capabilities(mmguicore_t mmguicore);
 
531
void mmguicore_networks_scan_free(GSList *networks);
 
532
gboolean mmguicore_networks_scan(mmguicore_t mmguicore);
 
533
//Contacts
 
534
guint mmguicore_contacts_get_capabilities(mmguicore_t mmguicore);
 
535
void mmguicore_contacts_free_single(mmgui_contact_t contact, gboolean freestruct);
 
536
GSList *mmguicore_contacts_list(mmguicore_t mmguicore);
 
537
mmgui_contact_t mmguicore_contacts_get(mmguicore_t mmguicore, guint index);
 
538
gboolean mmguicore_contacts_delete(mmguicore_t mmguicore, guint index);
 
539
gboolean mmguicore_contacts_add(mmguicore_t mmguicore, mmgui_contact_t contact);
 
540
//Connections
 
541
GHashTable *mmguicore_connections_sync(mmguicore_t mmguicore);
 
542
//MMGUI Core
 
543
gchar *mmguicore_get_last_error(mmguicore_t mmguicore);
 
544
gchar *mmguicore_get_last_connection_error(mmguicore_t mmguicore);
 
545
gboolean mmguicore_interrupt_operation(mmguicore_t mmguicore);
 
546
mmguicore_t mmguicore_new(mmgui_event_ext_callback callback, mmgui_traffic_limits_t limits, gpointer userdata);
 
547
void mmguicore_close(mmguicore_t mmguicore);
 
548
 
 
549
#endif /* __MMGUICORE_H__ */