SRS: srs-client library, proper structures for protocol data
[samsung-ril.git] / include / samsung-ril-socket.h
1 /**
2  * This file is part of samsung-ril.
3  *
4  * Copyright (C) 2011-2012 Paul Kocialkowski <contact@oaulk.fr>
5  *
6  * samsung-ril 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  * samsung-ril 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 samsung-ril.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 /* Samsung RIL Socket protocol defines */
22
23 #ifndef _SAMSUNG_RIL_SOCKET_H_
24 #define _SAMSUNG_RIL_SOCKET_H_
25
26 #define SRS_COMMAND(f)  ((f->group << 8) | f->index)
27 #define SRS_GROUP(m)    (m >> 8)
28 #define SRS_INDEX(m)    (m & 0xff)
29
30 #define SRS_SOCKET_NAME                 "samsung-ril-socket"
31 #define SRS_DATA_MAX_SIZE               0x1000
32
33 #define SRS_CONTROL                     0x01
34 #define SRS_CONTROL_PING                0x0101
35
36 #define SRS_SND                         0x02
37 #define SRS_SND_SET_CALL_VOLUME         0x0201
38 #define SRS_SND_SET_CALL_AUDIO_PATH     0x0202
39 #define SRS_SND_SET_CALL_CLOCK_SYNC     0x0203
40
41 #define SRS_CONTROL_CAFFE               0xCAFFE
42
43 struct srs_header {
44         unsigned int length;
45         unsigned char group;
46         unsigned char index;
47 } __attribute__((__packed__));
48
49 struct srs_message {
50         unsigned short command;
51         int length;
52         void *data;
53 };
54
55
56 enum srs_snd_type {
57         SRS_SND_TYPE_VOICE,
58         SRS_SND_TYPE_SPEAKER,
59         SRS_SND_TYPE_HEADSET,
60         SRS_SND_TYPE_BTVOICE
61 };
62
63 enum srs_snd_path {
64         SRS_SND_PATH_HANDSET,
65         SRS_SND_PATH_HEADSET,
66         SRS_SND_PATH_SPEAKER,
67         SRS_SND_PATH_BLUETOOTH,
68         SRS_SND_PATH_BLUETOOTH_NO_NR,
69         SRS_SND_PATH_HEADPHONE
70 };
71
72 enum srs_snd_clock {
73         SND_CLOCK_STOP,
74         SND_CLOCK_START
75 };
76
77 struct srs_snd_call_volume {
78         enum srs_snd_type type;
79         int volume;
80 } __attribute__((__packed__));
81
82 struct srs_snd_call_audio_path {
83         enum srs_snd_path path;
84 } __attribute__((__packed__));
85
86 struct srs_snd_call_clock_sync {
87         unsigned char sync;
88 } __attribute__((__packed__));
89
90 struct srs_control_ping {
91         int caffe;
92 } __attribute__((__packed__));
93
94 #endif