Bluetooth: Add LE connection parameter update procedure
[platform/kernel/linux-starfive.git] / include / net / bluetooth / mgmt_tizen.h
1 /*
2  * BlueZ - Bluetooth protocol stack for Linux
3  *
4  * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd.
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 version 2 as
8  * published by the Free Software Foundation.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17  * SOFTWARE.
18  */
19
20 #ifndef __MGMT_TIZEN_H
21 #define __MGMT_TIZEN_H
22
23 #define TIZEN_OP_CODE_BASE      0xff00
24 #define TIZEN_EV_BASE           0xff00
25
26 #define MGMT_OP_SET_ADVERTISING_PARAMS          (TIZEN_OP_CODE_BASE + 0x01)
27 struct mgmt_cp_set_advertising_params {
28         __le16  interval_min;
29         __le16  interval_max;
30         __u8 filter_policy;
31         __u8 type;
32 } __packed;
33 #define MGMT_SET_ADVERTISING_PARAMS_SIZE        6
34
35 #define MGMT_OP_SET_ADVERTISING_DATA            (TIZEN_OP_CODE_BASE + 0x02)
36 struct mgmt_cp_set_advertising_data {
37         __u8    data[HCI_MAX_AD_LENGTH];
38 } __packed;
39 #define MGMT_SET_ADVERTISING_DATA_SIZE          HCI_MAX_AD_LENGTH
40 #define MGMT_SET_ADV_MIN_APP_DATA_SIZE          1
41
42 #define MGMT_OP_SET_SCAN_RSP_DATA               (TIZEN_OP_CODE_BASE + 0x03)
43 struct mgmt_cp_set_scan_rsp_data {
44         __u8    data[HCI_MAX_AD_LENGTH];
45 } __packed;
46 #define MGMT_SET_SCAN_RSP_DATA_SIZE             HCI_MAX_AD_LENGTH
47 #define MGMT_SET_SCAN_RSP_MIN_APP_DATA_SIZE     1
48
49 #define MGMT_OP_ADD_DEV_WHITE_LIST              (TIZEN_OP_CODE_BASE + 0x04)
50 struct mgmt_cp_add_dev_white_list {
51         __u8    bdaddr_type;
52         bdaddr_t bdaddr;
53 } __packed;
54 #define MGMT_ADD_DEV_WHITE_LIST_SIZE            7
55
56 #define MGMT_OP_REMOVE_DEV_FROM_WHITE_LIST      (TIZEN_OP_CODE_BASE + 0x05)
57 struct mgmt_cp_remove_dev_from_white_list {
58         __u8    bdaddr_type;
59         bdaddr_t bdaddr;
60 } __packed;
61 #define MGMT_REMOVE_DEV_FROM_WHITE_LIST_SIZE    7
62
63 #define MGMT_OP_CLEAR_DEV_WHITE_LIST            (TIZEN_OP_CODE_BASE + 0x06)
64 #define MGMT_OP_CLEAR_DEV_WHITE_LIST_SIZE       0
65
66 /* For RSSI monitoring */
67 #define MGMT_OP_SET_RSSI_ENABLE                 (TIZEN_OP_CODE_BASE + 0x07)
68 #define MGMT_SET_RSSI_ENABLE_SIZE               10
69
70 struct mgmt_cp_set_enable_rssi {
71         __s8    low_th;
72         __s8    in_range_th;
73         __s8    high_th;
74         bdaddr_t        bdaddr;
75         __s8    link_type;
76 } __packed;
77
78 struct mgmt_cc_rsp_enable_rssi {
79         __u8    status;
80         __u8    le_ext_opcode;
81         bdaddr_t        bt_address;
82         __s8    link_type;
83 } __packed;
84
85 #define MGMT_OP_GET_RAW_RSSI                    (TIZEN_OP_CODE_BASE + 0x08)
86 #define MGMT_GET_RAW_RSSI_SIZE                  7
87
88 struct mgmt_cp_get_raw_rssi {
89         bdaddr_t bt_address;
90         __u8    link_type;
91 } __packed;
92
93 #define MGMT_OP_SET_RSSI_DISABLE                (TIZEN_OP_CODE_BASE + 0x09)
94 #define MGMT_SET_RSSI_DISABLE_SIZE              7
95 struct mgmt_cp_disable_rssi {
96         bdaddr_t        bdaddr;
97         __u8    link_type;
98 } __packed;
99 struct mgmt_cc_rp_disable_rssi {
100         __u8    status;
101         __u8    le_ext_opcode;
102         bdaddr_t        bt_address;
103         __s8    link_type;
104 } __packed;
105 /* RSSI monitoring */
106
107 /* For le discovery */
108 #define MGMT_OP_START_LE_DISCOVERY              (TIZEN_OP_CODE_BASE + 0x0a)
109 struct mgmt_cp_start_le_discovery {
110         __u8    type;
111 } __packed;
112 #define MGMT_START_LE_DISCOVERY_SIZE            1
113
114 #define MGMT_OP_STOP_LE_DISCOVERY               (TIZEN_OP_CODE_BASE + 0x0b)
115 struct mgmt_cp_stop_le_discovery {
116         __u8    type;
117 } __packed;
118 #define MGMT_STOP_LE_DISCOVERY_SIZE             1
119 /* le discovery */
120
121 /* For LE auto connection */
122 #define MGMT_OP_DISABLE_LE_AUTO_CONNECT         (TIZEN_OP_CODE_BASE + 0x0c)
123 #define MGMT_DISABLE_LE_AUTO_CONNECT_SIZE       0
124 /* LE auto connection */
125
126 /* For Add LE connection parameter update procedure */
127 #define MGMT_LE_CONN_UPDATE_SIZE                14
128 #define MGMT_OP_LE_CONN_UPDATE                  (TIZEN_OP_CODE_BASE + 0x0d)
129 struct mgmt_cp_le_conn_update {
130         __le16  conn_interval_min;
131         __le16  conn_interval_max;
132         __le16  conn_latency;
133         __le16  supervision_timeout;
134         bdaddr_t        bdaddr;
135 } __packed;
136 /* Add LE connection parameter update procedure */
137
138 /* EVENTS */
139
140 /* For device name update changes */
141 #define MGMT_EV_DEVICE_NAME_UPDATE              (TIZEN_EV_BASE + 0x01)
142 struct mgmt_ev_device_name_update {
143         struct mgmt_addr_info addr;
144         __le16  eir_len;
145         __u8    eir[0];
146 } __packed;
147 /* Device name update changes */
148
149 /* For handling of RSSI Events */
150 #define MGMT_EV_RSSI_ALERT                      (TIZEN_EV_BASE + 0x04)
151 struct mgmt_ev_vendor_specific_rssi_alert {
152         bdaddr_t        bdaddr;
153         __s8    link_type;
154         __s8    alert_type;
155         __s8    rssi_dbm;
156 } __packed;
157
158 #define MGMT_EV_RAW_RSSI                        (TIZEN_EV_BASE + 0x05)
159 struct mgmt_cc_rp_get_raw_rssi {
160         __u8    status;
161         __s8    rssi_dbm;
162         __u8    link_type;
163         bdaddr_t        bt_address;
164 } __packed;
165
166 #define MGMT_EV_RSSI_ENABLED                    (TIZEN_EV_BASE + 0x06)
167
168 #define MGMT_EV_RSSI_DISABLED                   (TIZEN_EV_BASE + 0x07)
169 /* Handling of RSSI Events */
170
171 /* For Add LE connection update Events */
172 #define MGMT_EV_CONN_UPDATED                    (TIZEN_EV_BASE + 0x08)
173 struct mgmt_ev_conn_updated {
174         struct  mgmt_addr_info addr;
175         __le16  conn_interval;
176         __le16  conn_latency;
177         __le16  supervision_timeout;
178 } __packed;
179
180 #define MGMT_EV_CONN_UPDATE_FAILED              (TIZEN_EV_BASE + 0x09)
181 struct mgmt_ev_conn_update_failed {
182         struct  mgmt_addr_info addr;
183         __u8    status;
184 } __packed;
185 /* Add LE connection update Events */
186
187 #endif  /* __MGMT_TIZEN_H */