ipc: Consistent coding style and major cleanup
[libsamsung-ipc.git] / vapi / samsung-ipc-1.0.vapi
1 /*
2  * samsung-ipc-1.0.vapi
3  *
4  * Copyright (C) 2011-2012 Simon Busch <morphis@gravedo.de>
5  *
6  * libsamsung-ipc 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 2 of the License, or
9  * (at your option) any later version.
10  *
11  * libsamsung-ipc 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 libsamsung-ipc.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 [CCode (cheader_filename = "samsung-ipc.h")]
22 namespace SamsungIpc
23 {
24     [CCode (cname = "int", cprefix = "IPC_CLIENT_TYPE_", has_type_id = false)]
25     public enum ClientType
26     {
27         FMT,
28         RFS,
29     }
30
31     [CCode (cname = "int", cprefix = "IPC_DEVICE_", has_type_id = false)]
32     public enum DeviceType
33     {
34         CRESPO,
35     }
36
37     [CCode (cname = "int", cprefix = "IPC_TYPE_", has_type_id = false)]
38     public enum RequestType
39     {
40         EXEC,
41         GET,
42         SET,
43         CFRM,
44         EVENT,
45     }
46
47     [CCode (cname = "unsigned char", cprefix = "IPC_TYPE_", has_type_id = false)]
48     public enum ResponseType
49     {
50         INDI,
51         RESP,
52         NOTI,
53     }
54
55     [CCode (cname = "int", cprefix = "IPC_GROUP_", has_type_id = false)]
56     public enum MessageGroup
57     {
58         PWR,
59         CALL,
60         SMS,
61         SEC,
62         PB,
63         DISP,
64         NET,
65         SND,
66         MISC,
67         SVC,
68         SS,
69         GPRS,
70         SAT,
71         CFG,
72         IMEI,
73         GPS,
74         SAP,
75         GEN,
76     }
77
78     [CCode (cname = "unsigned short", cprefix = "IPC_", has_type_id = false)]
79     public enum MessageType
80     {
81         PWR_PHONE_PWR_OFF,
82         PWR_PHONE_PWR_UP,
83         PWR_PHONE_RESET,
84         PWR_BATT_STATUS,
85         PWR_BATT_TYPE,
86         PWR_BATT_COMP,
87         PWR_PHONE_STATE,
88         PB_ACCESS,
89         PB_STORAGE,
90         PB_STORAGE_LIST,
91         PB_ENTRY_INFO,
92         PB_CAPABILITY_INFO,
93         SS_WAITING,
94         SS_CLI,
95         SS_BARRING,
96         SS_BARRING_PW,
97         SS_FORWARDING,
98         SS_INFO,
99         SS_MANAGE_CALL,
100         SS_USSD,
101         SS_AOC,
102         SS_RELEASE_COMPLETE,
103         GPRS_DEFINE_PDP_CONTEXT,
104         GPRS_QOS,
105         GPRS_PS,
106         GPRS_PDP_CONTEXT,
107         GPRS_SHOW_PDP_ADDR,
108         GPRS_3G_QUAL_SERVICE_PROFILE,
109         GPRS_IP_CONFIGURATION,
110         GPRS_DEFINE_SEC_PDP_CONTEXT,
111         GPRS_TFT,
112         GPRS_HSDPA_STATUS,
113         GPRS_CURRENT_SESSION_DATA_COUNT,
114         GPRS_DATA_DORMANT,
115         GPRS_DUN_PIN_CTRL,
116         GPRS_CALL_STATUS,
117         GPRS_PORT_LIST,
118         SAT_PROFILE_DOWNLOAD,
119         SAT_ENVELOPE_CMD,
120         SAT_PROACTIVE_CMD,
121         SAT_TERMINATE_USAT_SESSION,
122         SAT_EVENT_DOWNLOAD,
123         SAT_PROVIDE_LOCAL_INFO,
124         SAT_POLLING,
125         SAT_REFRESH,
126         SAT_SETUP_EVENT_LIST,
127         SAT_CALL_CONTROL_RESULT,
128         SAT_IMAGE_CLUT,
129         SAT_CALL_PROCESSING,
130         IMEI_START,
131         IMEI_CHECK_DEVICE_INFO,
132         CALL_OUTGOING,
133         CALL_INCOMING,
134         CALL_RELEASE,
135         CALL_ANSWER,
136         CALL_STATUS,
137         CALL_LIST,
138         CALL_BURST_DTMF,
139         CALL_CONT_DTMF,
140         CALL_WAITING,
141         CALL_LINE_ID,
142         DISP_ICON_INFO,
143         DISP_HOMEZONE_INFO,
144         DISP_RSSI_INFO,
145         SEC_SIM_STATUS,
146         SEC_PHONE_LOCK,
147         SEC_CHANGE_LOCKING_PW,
148         SEC_SIM_LANG,
149         SEC_RSIM_ACCESS,
150         SEC_GSIM_ACCESS,
151         SEC_SIM_ICC_TYPE,
152         SEC_LOCK_INFO,
153         SEC_ISIM_AUTH,
154         NET_PREF_PLMN,
155         NET_PLMN_SEL,
156         NET_CURRENT_PLMN,
157         NET_PLMN_LIST,
158         NET_REGIST,
159         NET_SUBSCRIBER_NUM,
160         NET_BAND_SEL,
161         NET_SERVICE_DOMAIN_CONFIG,
162         NET_POWERON_ATTACH,
163         NET_MODE_SEL,
164         NET_ACQ_ORDER,
165         NET_IDENTITY,
166         NET_CURRENT_RRC_STATUS,
167         GEN_PHONE_RES,
168         MISC_ME_VERSION,
169         MISC_ME_IMSI,
170         MISC_ME_SN,
171         MISC_TIME_INFO,
172         SMS_SEND_MSG,
173         SMS_INCOMING_MSG,
174         SMS_READ_MSG,
175         SMS_SAVE_MSG,
176         SMS_DEL_MSG,
177         SMS_DELIVER_REPORT,
178         SMS_DEVICE_READY,
179         SMS_SEL_MEM,
180         SMS_STORED_MSG_COUNT,
181         SMS_SVC_CENTER_ADDR,
182         SMS_SVC_OPTION,
183         SMS_MEM_STATUS,
184         SMS_CBS_MSG,
185         SMS_CBS_CONFIG,
186         SMS_STORED_MSG_STATUS,
187         SMS_PARAM_COUNT,
188         SMS_PARAM,
189         SND_SPKR_VOLUME_CTRL,
190         SND_MIC_MUTE_CTRL,
191         SND_AUDIO_PATH_CTRL,
192         SND_RINGBACK_TONE_CTRL,
193         SND_CLOCK_CTRL,
194         RFS_NV_READ_ITEM,
195         RFS_NV_WRITE_ITEM,
196     }
197
198     /* ******************************************************************************** */
199
200     namespace Power
201     {
202         [CCode (cname = "gint16", cprefix = "IPC_PWR_PHONE_STATE_", has_type_id = false)]
203         public enum PhoneState
204         {
205             LPM,
206             NORMAL,
207         }
208     }
209
210     /* ******************************************************************************** */
211
212     namespace Security
213     {
214         [CCode (cname = "gint8", cprefix = "IPC_SEC_SIM_STATUS_", has_type_id = false)]
215         public enum SimStatus
216         {
217             INITIALIZING,
218             SIM_LOCK_REQUIRED,
219             INSIDE_PF_ERROR,
220             LOCK_SC,
221             LOCK_FD,
222             LOCK_PN,
223             LOCK_PU,
224             LOCK_PP,
225             LOCK_PC,
226             CARD_NOT_PRESENT,
227             CARD_ERROR,
228             INIT_COMPLETE,
229             PB_INIT_COMPLETE,
230         }
231
232         [CCode (cname = "gint8", cprefix = "IPC_SEC_FACILITY_TYPE_", has_type_id = false)]
233         public enum FacilityType
234         {
235             SC,
236             FD,
237             PN,
238             PU,
239             PP,
240             PC,
241         }
242
243         [CCode (cname = "gint8", cprefix = "IPC_SEC_FACILITY_LOCK_TYPE_", has_type_id = false)]
244         public enum FacilityLockType
245         {
246             SC_UNLOCKED,
247             SC_PIN1_REQ,
248             SC_PUK_REQ,
249             SC_CARD_BLOCKED,
250         }
251
252         [CCode (cname = "gint8", cprefix = "IPC_SEC_PIN_TYPE_", has_type_id = false)]
253         public enum PinType
254         {
255             PIN1,
256             PIN2,
257         }
258
259         [CCode (cname = "gint8", cprefix = "IPC_SEC_SIM_CARD_TYPE_", has_type_id = false)]
260         public enum SimCardType
261         {
262             UNKNOWN,
263             SIM,
264             USIM,
265         }
266
267         [CCode (cname = "gint8", cprefix = "IPC_SEC_RSIM_COMMAND_", has_type_id = false)]
268         public enum RSimCommandType
269         {
270             READ_BINARY,
271             READ_RECORD,
272             UPDATE_BINARY,
273             STATUS,
274         }
275
276         [CCode (cname = "struct ipc_sec_sim_status_response", destroy_function = "")]
277         public struct SimStatusMessage
278         {
279             public SimStatus status;
280             public FacilityLockType facility_lock;
281
282             public unowned uint8[] data
283             {
284                 get
285                 {
286                     unowned uint8[] res = (uint8[])(&this);
287                     res.length = (int) sizeof( SimStatusMessage );
288                     return res;
289                 }
290             }
291         }
292
293         [CCode (cname = "struct ipc_sec_pin_status_set", destroy_function = "")]
294         public struct PinStatusSetMessage
295         {
296             public PinType type;
297             public uint8 length1;
298             public uint8 length2;
299             [CCode (array_length_cname = "length1")]
300             public uint8[] pin1; // size = 8
301             [CCode (array_length_cname = "length2")]
302             public uint8[] pin2; // size = 8
303
304             [CCode (cname = "ipc_sec_pin_status_set_setup")]
305             public void setup(PinType pin_type, string pin1, string pin2);
306
307             public unowned uint8[] data
308             {
309                 get
310                 {
311                     unowned uint8[] res = (uint8[])(&this);
312                     res.length = (int) sizeof( PinStatusSetMessage );
313                     return res;
314                 }
315             }
316         }
317
318         [CCode (cname = "struct ipc_sec_phone_lock_get", destroy_function = "")]
319         public struct PhoneLockGetMessage
320         {
321             public FacilityType facility;
322
323             public unowned uint8[] data
324             {
325                 get
326                 {
327                     unowned uint8[] res = (uint8[])(&this);
328                     res.length = (int) sizeof( PhoneLockGetMessage );
329                     return res;
330                 }
331             }
332         }
333
334         [CCode (cname = "struct ipc_sec_phone_lock_response", destroy_function = "")]
335         public struct PhoneLockGetResponseMessage
336         {
337             public FacilityType facility;
338             public bool status;
339
340             public unowned uint8[] data
341             {
342                 get
343                 {
344                     unowned uint8[] res = (uint8[])(&this);
345                     res.length = (int) sizeof( PhoneLockGetResponseMessage );
346                     return res;
347                 }
348             }
349         }
350
351         [CCode (cname = "struct ipc_sec_rsim_access_get", destroy_function = "")]
352         public struct RSimAccessRequestMessage
353         {
354             public RSimCommandType command;
355             public uint16 fileid;
356             public uint8 p1;
357             public uint8 p2;
358             public uint8 p3;
359
360             public unowned uint8[] data
361             {
362                 get
363                 {
364                     unowned uint8[] res = (uint8[])(&this);
365                     res.length = (int) sizeof( RSimAccessRequestMessage );
366                     return res;
367                 }
368             }
369         }
370
371         [CCode (cname = "struct ipc_sec_rsim_access_response", destroy_function = "")]
372         public struct RSimAccessResponseMessage
373         {
374             public uint8 sw1;
375             public uint8 sw2;
376             public uint8 len;
377
378             public unowned uint8[] data
379             {
380                 get
381                 {
382                     unowned uint8[] res = (uint8[])(&this);
383                     res.length = (int) sizeof( RSimAccessResponseMessage );
384                     return res;
385                 }
386             }
387
388             [CCode (cname = "ipc_sec_rsim_access_response_get_file_data")]
389             public static string get_file_data( Response response );
390         }
391
392         [CCode (cname = "struct ipc_sec_lock_info_get", destroy_function = "")]
393         public struct LockInfoRequestMessage
394         {
395             public uint8 unk0;
396             public PinType pin_type;
397
398             [CCode (cname = "ipc_sec_lock_info_get_setup")]
399             public void setup(PinType pin_type);
400
401             public unowned uint8[] data
402             {
403                 get
404                 {
405                     unowned uint8[] res = (uint8[])(&this);
406                     res.length = (int) sizeof( LockInfoRequestMessage );
407                     return res;
408                 }
409             }
410         }
411
412         [CCode (cname = "struct ipc_sec_lock_info_response", destroy_function = "")]
413         public struct LockInfoResponseMessage
414         {
415             public uint8 num;
416             public PinType type;
417             public uint8 key;
418             public uint8 attempts;
419
420             public unowned uint8[] data
421             {
422                 get
423                 {
424                     unowned uint8[] res = (uint8[])(&this);
425                     res.length = (int) sizeof( LockInfoResponseMessage );
426                     return res;
427                 }
428             }
429         }
430     }
431
432     /* ******************************************************************************** */
433
434     namespace Display
435     {
436         [CCode (cname = "ipc_disp_icon_info", destroy_function = "")]
437         public struct IconInfoMessage
438         {
439             public uint8 unk;
440             public uint8 rssi;
441             public uint8 battery;
442             public uint8 act;
443             public uint8 reg;
444
445             public unowned uint8[] data
446             {
447                 get
448                 {
449                     unowned uint8[] res = (uint8[])(&this);
450                     res.length = (int) sizeof( IconInfoMessage );
451                     return res;
452                 }
453             }
454         }
455
456         [CCode (cname = "struct ipc_disp_rssi_info", destroy_function = "")]
457         public struct RssiInfoMessage
458         {
459             public uint8 rssi;
460
461             public unowned uint8[] data
462             {
463                 get
464                 {
465                     unowned uint8[] res = (uint8[])(&this);
466                     res.length = (int) sizeof( RssiInfoMessage );
467                     return res;
468                 }
469             }
470         }
471     }
472
473     /* ******************************************************************************** */
474
475     namespace Network
476     {
477         [CCode (cname = "gint8", cprefix = "IPC_NET_ACCESS_TECHNOLOGY_", has_type_id = false)]
478         public enum AccessTechnology
479         {
480             UNKNOWN,
481             GSM,
482             GSM2,
483             GPRS,
484             EDGE,
485             UMTS,
486         }
487
488         [CCode (cname = "gint8", cprefix = "IPC_NET_REGISTRATION_STATE_", has_type_id = false)]
489         public enum RegistrationState
490         {
491             NONE,
492             HOME,
493             SEARCHING,
494             EMERGENCY,
495             UNKNOWN,
496             ROAMING,
497         }
498
499         [CCode (cname = "gint8", cprefix = "IPC_NET_PLMN_STATUS_", has_type_id = false)]
500         public enum PlmnStatus
501         {
502             AVAILABLE,
503             CURRENT,
504             FORBIDDEN,
505         }
506
507         [CCode (cname = "gint8", cprefix = "IPC_NET_PLMN_SEL_", has_type_id = false)]
508         public enum PlmnSelectionMode
509         {
510             MANUAL,
511             AUTO,
512         }
513
514         [CCode (cname = "gint8", cprefix = "IPC_NET_MODE_SEL_", has_type_id = false)]
515         public enum NetworkSelectionMode
516         {
517             GSM_UMTS,
518             GSM_ONLY,
519             UMTS_ONLY
520         }
521
522         [CCode (cname = "gint8", cprefix = "IPC_NET_SERVICE_DOMAIN_", has_type_id = false)]
523         public enum ServiceDomain
524         {
525             GSM,
526             GPRS,
527         }
528
529         [CCode (cname = "struct ipc_net_regist_response", destroy_function = "")]
530         public struct RegistrationMessage
531         {
532             public AccessTechnology act;
533             public ServiceDomain domain;
534             public RegistrationState reg_state;
535             public uint8 edge;
536             public uint16 lac;
537             public uint32 cid;
538             public uint8 rej_cause;
539
540             public unowned uint8[] data
541             {
542                 get
543                 {
544                     unowned uint8[] res = (uint8[])(&this);
545                     res.length = (int) sizeof( RegistrationMessage );
546                     return res;
547                 }
548             }
549         }
550
551         [CCode (cname = "struct ipc_net_regist_get", destroy_function = "")]
552         public struct RegistrationGetMessage
553         {
554             public uint8 net;
555             public ServiceDomain domain;
556
557             [CCode (cname = "ipc_net_regist_get_setup")]
558             public void setup( ServiceDomain domain );
559
560             public unowned uint8[] data
561             {
562                 get
563                 {
564                     unowned uint8[] res = (uint8[])(&this);
565                     res.length = (int) sizeof( RegistrationGetMessage );
566                     return res;
567                 }
568             }
569         }
570
571         [CCode (cname = "struct ipc_net_current_plmn_response", destroy_function = "")]
572         public struct CurrentPlmnMessage
573         {
574             public uint8 unk0;
575             public uint8 slevel;
576             public uint8 unk1;
577             [CCode (array_length = false)]
578             public uint8[] plmn;
579             public uint8 type;
580             public uint16 lac;
581
582             public unowned uint8[] data
583             {
584                 get
585                 {
586                     unowned uint8[] res = (uint8[])(&this);
587                     res.length = (int) sizeof( CurrentPlmnMessage );
588                     return res;
589                 }
590             }
591         }
592
593         [CCode (cname = "struct ipc_net_plmn_entry", destroy_function = "")]
594         public struct PlmnEntryMessage
595         {
596             public PlmnStatus status;
597             [CCode (array_length = false)]
598             public uint8[] plmn;
599             public uint8 type;
600
601             public unowned uint8[] data
602             {
603                 get
604                 {
605                     unowned uint8[] res = (uint8[])(&this);
606                     res.length = (int) sizeof( PlmnEntryMessage );
607                     return res;
608                 }
609             }
610         }
611
612         [CCode (cname = "struct ipc_net_plmn_entries", destroy_function = "")]
613         public struct PlmnEntriesMessage
614         {
615             public uint8 num;
616
617             public unowned PlmnEntryMessage? get_entry( Response response, uint pos )
618             {
619                 unowned PlmnEntryMessage? entry = null;
620
621                 if ( pos >= num )
622                     return null;
623
624                 uint8 *p = ((uint8*) response.data) + sizeof(PlmnEntriesMessage);
625                 entry = (PlmnEntryMessage?) (p + pos * sizeof(PlmnEntryMessage));
626
627                 return entry;
628             }
629
630             public unowned uint8[] data
631             {
632                 get
633                 {
634                     unowned uint8[] res = (uint8[])(&this);
635                     res.length = (int) sizeof( PlmnEntriesMessage );
636                     return res;
637                 }
638             }
639         }
640
641         [CCode (cname = "struct ipc_net_plmn_sel_get", destroy_function = "")]
642         public struct PlmnSelectionGetMessage
643         {
644             [CCode (cname = "plmn_sel")]
645             public PlmnSelectionMode mode;
646
647             public unowned uint8[] data
648             {
649                 get
650                 {
651                     unowned uint8[] res = (uint8[])(&this);
652                     res.length = (int) sizeof( PlmnSelectionGetMessage );
653                     return res;
654                 }
655             }
656
657         }
658
659         [CCode (cname = "struct ipc_net_plmn_sel_set", destroy_function = "")]
660         public struct PlmnSelectionSetMessage
661         {
662             public PlmnSelectionMode mode;
663             public uint8[] plmn;
664             public AccessTechnology act;
665
666             [CCode (cname = "ipc_net_plmn_sel_set_setup")]
667             public void setup(uint8 mode, string plmn, AccessTechnology act);
668
669             public unowned uint8[] data
670             {
671                 get
672                 {
673                     unowned uint8[] res = (uint8[])(&this);
674                     res.length = (int) sizeof( PlmnSelectionSetMessage );
675                     return res;
676                 }
677             }
678         }
679     }
680
681     /* ******************************************************************************** */
682
683     namespace Call
684     {
685         [CCode (cname = "int", cprefix = "IPC_CALL_TYPE_", has_type_id = false)]
686         public enum Type
687         {
688             VOICE,
689             DATA,
690         }
691
692         [CCode (cname = "gint8", cprefix = "IPC_CALL_IDENTITY_", has_type_id = false)]
693         public enum Identity
694         {
695             DEFAULT,
696             HIDE,
697             SHOW,
698         }
699
700         [CCode (cname = "gint8", cprefix = "IPC_CALL_PREFIX_", has_type_id = false)]
701         public enum Prefix
702         {
703             NONE,
704             INTL,
705         }
706
707         [CCode (cname = "gint8", cprefix = "IPC_CALL_STATE_", has_type_id = false)]
708         public enum State
709         {
710             DIALING,
711             IGNORING_INCOMING_STATUS,
712             CONNECTED,
713             RELEASED,
714             CONNECTING,
715         }
716
717         [CCode (cname = "gint8", cprefix = "IPC_CALL_LIST_ENTRY_STATE_", has_type_id = false)]
718         public enum State2
719         {
720             ACTIVE,
721             HOLDING,
722             DIALING,
723             ALERTING,
724             INCOMING,
725             WAITING
726         }
727
728         [CCode (cname = "int", cprefix = "IPC_CALL_TERM_", has_type_id = false)]
729         public enum Termination
730         {
731             MO,
732             MT,
733         }
734
735         [CCode (cname = "uint8", cprefix = "IPC_CALL_DTMF_STATE_", has_type_id = false)]
736         public enum DtmfState
737         {
738             START,
739             STOP
740         }
741
742         [CCode (cname = "struct ipc_call_outgoing", destroy_function = "")]
743         public struct OutgoingMessage
744         {
745             public Type type;
746             public Identity identity;
747             public uint8 length;
748             public Prefix prefix;
749             public uint8[] number;
750
751             [CCode (cname = "ipc_call_outgoing_setup")]
752             public void setup(Type type, Identity identity, Prefix prefix, string number);
753
754             public unowned uint8[] data
755             {
756                 get
757                 {
758                     unowned uint8[] res = (uint8[])(&this);
759                     res.length = (int) sizeof( OutgoingMessage );
760                     return res;
761                 }
762             }
763         }
764
765         [CCode (cname = "struct ipc_call_incoming", destroy_function = "")]
766         public struct IncomingMessage
767         {
768             public uint8 type;
769             public uint8 id;
770             public uint8 line;
771
772             public unowned uint8[] data
773             {
774                 get
775                 {
776                     unowned uint8[] res = (uint8[])(&this);
777                     res.length = (int) sizeof( IncomingMessage );
778                     return res;
779                 }
780             }
781         }
782
783         [CCode (cname = "struct ipc_message_info", destroy_function = "")]
784         public struct ListResponseMessage
785         {
786             [CCode (cname = "ipc_call_list_response_get_num_entries")]
787             public uint get_num_entries();
788             [CCode (cname = "ipc_call_list_response_get_entry")]
789             public ListEntry* get_entry(uint num);
790             [CCode (cname = "ipc_call_list_response_get_entry_number")]
791             public string get_entry_number(uint num);
792         }
793
794         [SimpleType]
795         [CCode (cname = "struct ipc_call_list_entry", destroy_function = "")]
796         public struct ListEntry
797         {
798             public Type type;
799             public uint8 idx;
800             public Termination term;
801             public State2 state;
802             public uint8 mpty;
803             public uint8 number_len;
804             public uint8 unk4;
805         }
806
807         [CCode (cname = "struct ipc_call_status", destroy_function = "")]
808         public struct StatusMessage
809         {
810             public uint8 type;
811             public uint8 id;
812             public State state;
813             public uint8 reason;
814             public uint8 end_cause;
815
816             public unowned uint8[] data
817             {
818                 get
819                 {
820                     unowned uint8[] res = (uint8[])(&this);
821                     res.length = (int) sizeof( StatusMessage );
822                     return res;
823                 }
824             }
825         }
826
827         [CCode (cname = "struct ipc_call_cont_dtmf", destroy_function = "")]
828         public struct ContDtmfMessage
829         {
830             public DtmfState state;
831             public uint8 tone;
832
833             [CCode (cname = "ipc_call_cont_dtmf_burst_pack")]
834             public uint8[] pack(uint8[] burst);
835
836             public unowned uint8[] data
837             {
838                 get
839                 {
840                     unowned uint8[] res = (uint8[])(&this);
841                     res.length = (int) sizeof( ContDtmfMessage );
842                     return res;
843                 }
844             }
845         }
846     }
847
848     /* ******************************************************************************** */
849
850     namespace Generic
851     {
852         [CCode (cname = "struct ipc_gen_phone_res", destroy_function = "")]
853         public struct PhoneResponseMessage
854         {
855             public uint8 group;
856             public uint8 type;
857             public uint16 code;
858             public uint8 unk;
859
860             public unowned uint8[] data
861             {
862                 get
863                 {
864                     unowned uint8[] res = (uint8[])(&this);
865                     res.length = (int) sizeof( PhoneResponseMessage );
866                     return res;
867                 }
868             }
869         }
870     }
871
872     /* ******************************************************************************** */
873
874     namespace Misc
875     {
876         [CCode (cname = "ipc_parse_misc_me_imsi")]
877         public string parse_imsi(uint8[] data);
878
879         [CCode (cname = "struct ipc_misc_me_version", destroy_function = "", free_function = "")]
880         public struct VersionMessage
881         {
882             [CCode (array_length = false)]
883             public uint8[] sw_version;
884             [CCode (array_length = false)]
885             public uint8[] hw_version;
886             [CCode (array_length = false)]
887             public uint8[] cal_date;
888             [CCode (array_length = false)]
889             public uint8[] misc;
890
891             public unowned uint8[] data
892             {
893                 get
894                 {
895                     unowned uint8[] res = (uint8[])(&this);
896                     res.length = (int) sizeof( VersionMessage );
897                     return res;
898                 }
899             }
900         }
901
902         [CCode (cname = "gint8", cprefix = "IPC_MISC_ME_SN_SERIAL_NUM_", has_type_id = false)]
903         public enum SerialNumberType
904         {
905             SERIAL,
906             MANUFACTURE_DATE,
907             BARCODE,
908         }
909
910         [CCode (cname = "struct ipc_misc_me_sn")]
911         public struct SerialNumberResponseMessage
912         {
913             public SerialNumberType type;
914             public uint8 length;
915             public uint8[] data;
916         }
917
918         [CCode (cname = "struct ipc_message_info")]
919         public struct MeResponseMessage
920         {
921             [CCode (cname = "ipc_misc_me_imsi_response_get_imsi")]
922             public static string get_imsi( Response response );
923         }
924
925         [CCode (cname = "struct ipc_misc_time_info", destroy_function = "")]
926         public struct TimeInfoMessage
927         {
928             public uint8 tz_valid;
929             public uint8 daylight_valid;
930             public uint8 year;
931             public uint8 mon;
932             public uint8 day;
933             public uint8 hour;
934             public uint8 min;
935             public uint8 sec;
936             public uint8 tz;
937             public uint8 dl;
938             public uint8 dv;
939             public uint8[] plmn;
940
941             public unowned uint8[] data
942             {
943                 get
944                 {
945                     unowned uint8[] res = (uint8[])(&this);
946                     res.length = (int) sizeof( TimeInfoMessage );
947                     return res;
948                 }
949             }
950         }
951     }
952
953     /* ******************************************************************************** */
954
955     namespace Gprs
956     {
957         [CCode (cname = "IPC_GPRS_PDP_CONTEXT_GET_DESC_COUNT")]
958         public uint MAX_PDP_CONTEXT_COUNT;
959
960         [CCode (cname = "gint8", cprefix = "IPC_GPRS_STATE_", has_type_id = false)]
961         public enum State
962         {
963             NOT_ENABLED,
964             ENABLED,
965             DISABLED
966         }
967
968         [CCode (cname = "gint8", cprefix = "IPC_GPRS_FAIL_", has_type_id = false)]
969         public enum Error
970         {
971             INSUFFICIENT_RESOURCES,
972             MISSING_UNKNOWN_APN,
973             UNKNOWN_PDP_ADDRESS_TYPE,
974             USER_AUTHENTICATION,
975             ACTIVATION_REJECT_CGSN,
976             ACTIVATION_REJECT_UNSPECIFIED,
977             SERVICE_OPTION_NOT_SUPPORTED,
978             SERVICE_OPTION_NOT_SUBSCRIBED,
979             SERVICE_OPTION_OUT_OF_ORDER,
980             NSAPI_IN_USE
981         }
982
983         [CCode (cname = "struct ipc_gprs_define_pdp_context", destroy_function = "")]
984         public struct DefinePdpContextMessage
985         {
986             public uint8 enable;
987             public uint8 cid;
988             public uint8 unk;
989             public uint8[] apn;
990
991             [CCode (cname = "ipc_gprs_define_pdp_context_setup")]
992             public void setup(uint8 cid, bool enable, string apn);
993
994             public unowned uint8[] data
995             {
996                 get
997                 {
998                     unowned uint8[] res = (uint8[])(&this);
999                     res.length = (int) sizeof( DefinePdpContextMessage );
1000                     return res;
1001                 }
1002             }
1003         }
1004
1005         [CCode (cname = "struct ipc_gprs_ip_configuration", destroy_function = "")]
1006         public struct IpConfigurationMessage
1007         {
1008             public uint8 cid;
1009             public uint8 field_flag;
1010             public uint8 unk1;
1011             [CCode (array_length = false)]
1012             public uint8[] ip;
1013             [CCode (array_length = false)]
1014             public uint8[] dns1;
1015             [CCode (array_length = false)]
1016             public uint8[] dns2;
1017             [CCode (array_length = false)]
1018             public uint8[] gateway;
1019             [CCode (array_length = false)]
1020             public uint8[] subnet_mask;
1021             [CCode (array_length = false)]
1022             public uint8[] unk2;
1023
1024             public unowned uint8[] data
1025             {
1026                 get
1027                 {
1028                     unowned uint8[] res = (uint8[])(&this);
1029                     res.length = (int) sizeof( IpConfigurationMessage );
1030                     return res;
1031                 }
1032             }
1033         }
1034
1035         [CCode (name = "struct ipc_gprs_pdp_context_get_desc", destroy_function = "")]
1036         public struct PdpContextGetDescMessage
1037         {
1038             public uint8 cid;
1039             public uint8 state;
1040
1041             public unowned uint8[] data
1042             {
1043                 get
1044                 {
1045                     unowned uint8[] res = (uint8[])(&this);
1046                     res.length = (int) sizeof( PdpContextGetDescMessage );
1047                     return res;
1048                 }
1049             }
1050         }
1051
1052         [CCode (name = "struct ipc_gprs_pdp_context_get", destroy_function = "")]
1053         public struct PdpContextGetMessage
1054         {
1055             public uint8 unk;
1056             public PdpContextGetDescMessage[] desc;
1057
1058             public unowned uint8[] data
1059             {
1060                 get
1061                 {
1062                     unowned uint8[] res = (uint8[])(&this);
1063                     res.length = (int) sizeof( PdpContextGetMessage );
1064                     return res;
1065                 }
1066             }
1067         }
1068
1069
1070         [CCode (name = "struct ipc_gprs_call_status", destroy_function = "")]
1071         public struct CallStatusMessage
1072         {
1073             public uint8 cid;
1074             public State status;
1075             public uint16 fail_status;
1076
1077             public unowned uint8[] data
1078             {
1079                 get
1080                 {
1081                     unowned uint8[] res = (uint8[])(&this);
1082                     res.length = (int) sizeof( CallStatusMessage );
1083                     return res;
1084                 }
1085             }
1086         }
1087
1088         [CCode (cname = "struct ipc_gprs_hsdpa_status", destroy_function = "")]
1089         public struct HsdpaStatusMessage
1090         {
1091             public uint8 unk;
1092
1093             public unowned uint8[] data
1094             {
1095                 get
1096                 {
1097                     unowned uint8[] res = (uint8[])(&this);
1098                     res.length = (int) sizeof( HsdpaStatusMessage );
1099                     return res;
1100                 }
1101             }
1102         }
1103
1104         [CCode (cname = "struct ipc_gprs_pdp_context_set", destroy_function = "")]
1105         public struct PdpContextSetMessage
1106         {
1107             public uint8 enable;
1108             public uint8 cid;
1109             public uint8[] unk0;
1110             public uint8[] username;
1111             public uint8[] password;
1112             public uint8[] unk1;
1113             public uint8 unk2;
1114
1115             [CCode (cname = "ipc_gprs_pdp_context_setup")]
1116             public void setup(int cid, bool activate, string? username, string? password);
1117
1118             public unowned uint8[] data
1119             {
1120                 get
1121                 {
1122                     unowned uint8[] res = (uint8[])(&this);
1123                     res.length = (int) sizeof( PdpContextSetMessage );
1124                     return res;
1125                 }
1126             }
1127         }
1128
1129         [CCode (cname = "struct ipc_gprs_ps", destroy_function = "")]
1130         public struct PsMessage
1131         {
1132             public uint8[] unk;
1133
1134             public unowned uint8[] data
1135             {
1136                 get
1137                 {
1138                     unowned uint8[] res = (uint8[])(&this);
1139                     res.length = (int) sizeof( PsMessage );
1140                     return res;
1141                 }
1142             }
1143         }
1144
1145         [CCode (cname = "struct ipc_gprs_current_session_data_counter", destroy_function = "")]
1146         public struct CurrentSessionDataCounterMessage
1147         {
1148             public uint8[] cid;
1149             public uint8[] rx_count;
1150             public uint8[] tx_count;
1151
1152             public unowned uint8[] data
1153             {
1154                 get
1155                 {
1156                     unowned uint8[] res = (uint8[])(&this);
1157                     res.length = (int) sizeof( CurrentSessionDataCounterMessage );
1158                     return res;
1159                 }
1160             }
1161         }
1162
1163         [CCode (cname = "struct ipc_gprs_port_list")]
1164         public struct PortListMessage
1165         {
1166             public uint8[] unk;
1167
1168             [CCode (cname = "ipc_gprs_port_list_setup")]
1169             public void setup();
1170
1171             public unowned uint8[] data
1172             {
1173                 get
1174                 {
1175                     unowned uint8[] res = (uint8[])(&this);
1176                     res.length = (int) sizeof( PortListMessage );
1177                     return res;
1178                 }
1179             }
1180         }
1181     }
1182
1183     /* ******************************************************************************** */
1184
1185     namespace Sms
1186     {
1187         [CCode (cname = "gint8", cprefix = "IPC_SMS_MSG_", has_type_id = false)]
1188         public enum MessageAmountType
1189         {
1190             MULTIPLE,
1191             SINGLE,
1192         }
1193
1194         [CCode (cname = "gint8", cprefix = "IPC_SMS_TYPE_", has_type_id = false)]
1195         public enum MessageType
1196         {
1197             POINT_TO_POINT,
1198             STATUS_REPORT,
1199             OUTGOING,
1200         }
1201
1202         [CCode (cname = "gint16", cprefix = "IPC_SMS_ACK_", has_type_id = false)]
1203         public enum AcknowledgeErrorType
1204         {
1205             NO_ERROR,
1206             PDA_FULL_ERROR,
1207             MAILFORMED_REQ_ERROR,
1208             UNSPEC_ERROR,
1209         }
1210
1211         [CCode (cname = "struct ipc_sms_incoming_msg")]
1212         public struct IncomingMessage
1213         {
1214             public uint8 msg_type;
1215             public uint8 type;
1216             public uint16 sim_index;
1217             public uint8 msg_tpid;
1218             public uint8 length;
1219
1220             public unowned uint8[] data
1221             {
1222                 get
1223                 {
1224                     unowned uint8[] res = (uint8[])(&this);
1225                     res.length = (int) sizeof( IncomingMessage );
1226                     return res;
1227                 }
1228             }
1229
1230             public uint8[] unpack_pdu( Response response )
1231             {
1232                 uint8[] pdu = new uint8[this.length];
1233                 uint8 *pdu_start = ((uint8*) response.data) + sizeof( IncomingMessage );
1234                 GLib.Memory.copy(pdu, pdu_start, this.length);
1235                 return pdu;
1236             }
1237         }
1238
1239         [CCode (cname = "struct ipc_sms_send_msg_request")]
1240         public struct SendMessage
1241         {
1242             public MessageType type;
1243             public MessageAmountType msg_type;
1244             public uint8 length;
1245             public uint8 smsc_len;
1246
1247             public uint8[] pack(string smsc, uint8[] pdu);
1248
1249             public unowned uint8[] data
1250             {
1251                 get
1252                 {
1253                     unowned uint8[] res = (uint8[])(&this);
1254                     res.length = (int) sizeof( SendMessage );
1255                     return res;
1256                 }
1257             }
1258         }
1259
1260         [CCode (cname = "struct ipc_sms_send_msg_response")]
1261         public struct DeliverReportMessage
1262         {
1263             public MessageType type;
1264             public AcknowledgeErrorType error;
1265             public uint8 msg_tpid;
1266             public uint8 unk;
1267
1268             public unowned uint8[] data
1269             {
1270                 get
1271                 {
1272                     unowned uint8[] res = (uint8[])(&this);
1273                     res.length = (int) sizeof( DeliverReportMessage );
1274                     return res;
1275                 }
1276             }
1277         }
1278     }
1279
1280     /* ******************************************************************************** */
1281
1282     namespace Sound
1283     {
1284         [CCode (cname = "gint8", cprefix = "IPC_SND_VOLUME_TYPE_", has_type_id = false)]
1285         public enum VolumeType
1286         {
1287             VOICE,
1288             SPEAKER,
1289             HEADSET,
1290             BTVOICE,
1291         }
1292
1293         [CCode (cname = "gint8", cprefix = "IPC_SND_AUDIO_PATH_", has_type_id = false)]
1294         public enum AudioPath
1295         {
1296             HANDSET,
1297             HEADSET,
1298             SPEAKER,
1299             BLUETOOTH,
1300             BLUETOOTH_NO_NR,
1301             HEADPHONE,
1302         }
1303
1304         [CCode (cname = "struct ipc_snd_spkr_volume_ctrl")]
1305         public struct SpeakerVolumeControlMessage
1306         {
1307             public VolumeType type;
1308             public uint8 volume;
1309
1310             public unowned uint8[] data
1311             {
1312                 get
1313                 {
1314                     unowned uint8[] res = (uint8[])(&this);
1315                     res.length = (int) sizeof( SpeakerVolumeControlMessage );
1316                     return res;
1317                 }
1318             }
1319         }
1320     }
1321
1322     /* ******************************************************************************** */
1323
1324     namespace Rfs
1325     {
1326         [CCode (cname = "ipc_rfs_send_io_confirm_for_nv_read_item")]
1327         public void send_io_confirm_for_nv_read_item(Client client, Response req);
1328         [CCode (cname = "ipc_rfs_send_io_confirm_for_nv_write_item")]
1329         public void send_io_confirm_for_nv_write_item(Client client, Response req);
1330     }
1331
1332     /* ******************************************************************************** */
1333
1334     [CCode (cname = "struct ipc_message_info", destroy_function = "", free_function = "")]
1335     public struct Request
1336     {
1337         public uint8 mseq;
1338         public uint8 aseq;
1339         public uint8 group;
1340         public uint8 index;
1341         public RequestType type;
1342         public uint32 length;
1343         [CCode (array_length_cname = "length")]
1344         public uint8[] data;
1345
1346         public MessageType command
1347         {
1348             get { return (MessageType) ((group << 8) | index); }
1349             set { group = value >> 8; index = value & 0xff; }
1350         }
1351     }
1352
1353     [CCode (cname = "struct ipc_message_info", destroy_function = "", free_function = "", copy_function = "")]
1354     public struct Response
1355     {
1356         public uint8 mseq;
1357         public uint8 aseq;
1358         public uint8 group;
1359         public uint8 index;
1360         public ResponseType type;
1361         public uint32 length;
1362         [CCode (array_length_cname = "length")]
1363         public uint8[] data;
1364
1365         public MessageType command
1366         {
1367             get { return (MessageType) ((group << 8) | index); }
1368             set { group = value >> 8; index = value & 0xff; }
1369         }
1370     }
1371
1372     public delegate int TransportCb(uint8[] data);
1373     public delegate void LogHandlerCb(string message);
1374
1375     [Compact]
1376     [CCode (cname = "struct ipc_client", cprefix = "ipc_client_")]
1377     public class Client
1378     {
1379         public Client(ClientType client_type);
1380         public Client.for_device(DeviceType device_type, ClientType client_type);
1381         [CCode (delagate_target_pos = 0.9)]
1382         public int set_log_handler(LogHandlerCb log_cb);
1383         public int set_io_handlers(TransportCb write_cb, TransportCb read_cb);
1384         public int bootstrap_modem();
1385         public int open();
1386         public int close();
1387         public int power_on();
1388         public int power_off();
1389         public int recv(out Response response);
1390         public void send(MessageType command, RequestType type, uint8[] data, uint8 mseq);
1391         public void send_get(MessageType command, uint8 aseq);
1392         public void send_exec(MessageType command, uint8 aseq);
1393         public void set_handlers_common_data_fd(int fd);
1394         public int get_handlers_common_data_fd();
1395         public int create_handlers_common_data();
1396     }
1397 }