92cb563893645d128ef8d5d5b7ff19ff16e6987b
[libsamsung-ipc.git] / include / call.h
1 /*
2  * This file is part of libsamsung-ipc.
3  *
4  * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
5  * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
6  *
7  * libsamsung-ipc is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * libsamsung-ipc is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with libsamsung-ipc.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include <samsung-ipc.h>
22
23 #ifndef __SAMSUNG_IPC_CALL_H__
24 #define __SAMSUNG_IPC_CALL_H__
25
26 /*
27  * Commands
28  */
29
30 #define IPC_CALL_OUTGOING                                       0x0201
31 #define IPC_CALL_INCOMING                                       0x0202
32 #define IPC_CALL_RELEASE                                        0x0203
33 #define IPC_CALL_ANSWER                                         0x0204
34 #define IPC_CALL_STATUS                                         0x0205
35 #define IPC_CALL_LIST                                           0x0206
36 #define IPC_CALL_BURST_DTMF                                     0x0207
37 #define IPC_CALL_CONT_DTMF                                      0x0208
38 #define IPC_CALL_WAITING                                        0x0209
39 #define IPC_CALL_LINE_ID                                        0x020A
40
41 /*
42  * Values
43  */
44
45 #define IPC_CALL_TYPE_VOICE                                     0x01
46 #define IPC_CALL_TYPE_DATA                                      0x03
47
48 #define IPC_CALL_IDENTITY_DEFAULT                               0x00
49 #define IPC_CALL_IDENTITY_HIDE                                  0x01
50 #define IPC_CALL_IDENTITY_SHOW                                  0x02
51
52 #define IPC_CALL_PREFIX_NONE                                    0x00
53 #define IPC_CALL_PREFIX_INTL                                    0x11
54
55 #define IPC_CALL_STATUS_DIALING                                 0x01
56 #define IPC_CALL_STATUS_IGNORING_INCOMING_STATUS                0x02
57 #define IPC_CALL_STATUS_CONNECTED                               0x03
58 #define IPC_CALL_STATUS_RELEASED                                0x04
59 #define IPC_CALL_STATUS_CONNECTING                              0x05
60
61 #define IPC_CALL_END_CAUSE_NORMAL                               0x05
62 #define IPC_CALL_END_CAUSE_REJECTED                             0x2F
63 #define IPC_CALL_END_CAUSE_UNSPECIFIED                          0x10
64
65 #define IPC_CALL_TERM_MO                                        0x01
66 #define IPC_CALL_TERM_MT                                        0x02
67
68 #define IPC_CALL_LIST_ENTRY_STATUS_ACTIVE                       0x01
69 #define IPC_CALL_LIST_ENTRY_STATUS_HOLDING                      0x02
70 #define IPC_CALL_LIST_ENTRY_STATUS_DIALING                      0x03
71 #define IPC_CALL_LIST_ENTRY_STATUS_ALERTING                     0x04
72 #define IPC_CALL_LIST_ENTRY_STATUS_INCOMING                     0x05
73 #define IPC_CALL_LIST_ENTRY_STATUS_WAITING                      0x06
74
75 #define IPC_CALL_DTMF_STATE_START                               0x01
76 #define IPC_CALL_DTMF_STATE_STOP                                0x02
77
78 /*
79  * Structures
80  */
81
82 struct ipc_call_outgoing_data {
83     unsigned char unknown;
84     unsigned char type; // IPC_CALL_TYPE
85     unsigned char identity; // IPC_CALL_IDENTITY
86     unsigned char number_length;
87     unsigned char prefix; // IPC_CALL_PREFIX
88     unsigned char number[86];
89 } __attribute__((__packed__));
90
91 struct ipc_call_incoming_data {
92     unsigned char unknown;
93     unsigned char type; // IPC_CALL_TYPE_...
94     unsigned char id;
95     unsigned char line;
96 } __attribute__((__packed__));
97
98 struct ipc_call_status_data {
99     unsigned char unknown;
100     unsigned char type; // IPC_CALL_TYPE
101     unsigned char id;
102     unsigned char status; // IPC_CALL_STATUS
103     unsigned char reason;
104     unsigned char end_cause; // IPC_CALL_END_CAUSE
105 } __attribute__((__packed__));
106
107 struct ipc_call_list_header {
108     unsigned char count;
109 } __attribute__((__packed__));
110
111 struct ipc_call_list_entry {
112     unsigned char unknown1;
113     unsigned char type; // IPC_CALL_TYPE
114     unsigned char id;
115     unsigned char term; // IPC_CALL_TERM
116     unsigned char status; // IPC_CALL_LIST_ENTRY_STATUS
117     unsigned char unknown2;
118     unsigned char number_length;
119     unsigned char unknown3;
120 } __attribute__((__packed__));
121
122 struct ipc_call_burst_dtmf_header {
123     unsigned char count;
124 } __attribute__((__packed__));
125
126 struct ipc_call_burst_dtmf_entry {
127     unsigned char state;
128     unsigned char tone;
129 } __attribute__((__packed__));
130
131 struct ipc_call_cont_dtmf_data {
132     unsigned char state;
133     unsigned char tone;
134 } __attribute__((__packed__));
135
136 /*
137  * Helpers
138  */
139
140 int ipc_call_outgoing_setup(struct ipc_call_outgoing_data *data,
141     unsigned char type, unsigned char identity, unsigned char prefix,
142     const char *number);
143 unsigned char ipc_call_list_get_count(const void *data, size_t size);
144 struct ipc_call_list_entry *ipc_call_list_get_entry(const void *data,
145     size_t size, unsigned int index);
146 char *ipc_call_list_get_entry_number(const void *data,
147     size_t size, unsigned int index);
148 void *ipc_call_burst_dtmf_setup(const struct ipc_call_burst_dtmf_entry *entries,
149     unsigned char count);
150
151 #endif
152
153 // vim:ts=4:sw=4:expandtab