mgmt.h revision a20bb21f47db02155498d71c0bdd2095a56bdc2a
112d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg/*
212d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  BlueZ - Bluetooth protocol stack for Linux
312d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *
412d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  Copyright (C) 2010  Nokia Corporation
512d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  Copyright (C) 2010  Marcel Holtmann <marcel@holtmann.org>
612d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *
712d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *
812d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  This program is free software; you can redistribute it and/or modify
912d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  it under the terms of the GNU General Public License as published by
1012d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  the Free Software Foundation; either version 2 of the License, or
1112d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  (at your option) any later version.
1212d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *
1312d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  This program is distributed in the hope that it will be useful,
1412d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  but WITHOUT ANY WARRANTY; without even the implied warranty of
1512d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1612d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  GNU General Public License for more details.
1712d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *
1812d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  You should have received a copy of the GNU General Public License
1912d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  along with this program; if not, write to the Free Software
2012d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
2112d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg *
2212d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg */
2312d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg
24b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg#ifndef __packed
25b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg#define __packed __attribute__((packed))
26b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg#endif
27b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg
28fb91c88916485512033b8437686a5f2405d19a92Johan Hedbergstruct mgmt_hdr {
2912d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg	uint16_t opcode;
3012d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg	uint16_t len;
3112d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg} __packed;
32fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_HDR_SIZE	4
3312d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg
34fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_VERSION		0x0001
359a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_rp_read_version {
36b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg	uint8_t version;
37b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg	uint16_t revision;
38b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg} __packed;
39b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg
40fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_FEATURES		0x0002
419a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_rp_read_features {
4258e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg	uint8_t features[8];
4358e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed;
44c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg
45fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_INDEX_LIST		0x0003
469a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_rp_read_index_list {
47c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg	uint16_t num_controllers;
48c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg	uint16_t index[0];
49c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg} __packed;
50c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg
51fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_INFO		0x0004
529a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_cp_read_info {
5358e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg	uint16_t index;
5458e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed;
559a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_rp_read_info {
5658e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg	uint16_t index;
5758e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg	uint8_t type;
5824a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg	uint8_t powered;
5914655825c95fd065afc41bfc1c810987bfb1a2c6Johan Hedberg	uint8_t connectable;
6024a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg	uint8_t discoverable;
6124a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg	uint8_t pairable;
6224a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg	uint8_t sec_mode;
63b67a8a42e6ea9c2d2b0877ac3832de75ec4e00e5Johan Hedberg	bdaddr_t bdaddr;
6424a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg	uint8_t dev_class[3];
6558e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg	uint8_t features[8];
668c442fd677490441b64b3509c1264460668d9367Johan Hedberg	uint16_t manufacturer;
678c442fd677490441b64b3509c1264460668d9367Johan Hedberg	uint8_t hci_ver;
688c442fd677490441b64b3509c1264460668d9367Johan Hedberg	uint16_t hci_rev;
6958e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed;
7058e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg
71fb88bd2992dc0e3d90a9aabacaefcfcfc3f9aba9Johan Hedbergstruct mgmt_mode {
7227a311476a53c72ac06d6cdc3cffbef14a0caba7Johan Hedberg	uint16_t index;
73fb88bd2992dc0e3d90a9aabacaefcfcfc3f9aba9Johan Hedberg	uint8_t val;
7407481cab563a0db441075f7e786d442e0c576c32Johan Hedberg} __packed;
75fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg
76fb88bd2992dc0e3d90a9aabacaefcfcfc3f9aba9Johan Hedberg#define MGMT_OP_SET_POWERED		0x0005
77fb88bd2992dc0e3d90a9aabacaefcfcfc3f9aba9Johan Hedberg
78528432cc7aad7601c3d98157c9472e6a089232f8Johan Hedberg#define MGMT_OP_SET_DISCOVERABLE	0x0006
79528432cc7aad7601c3d98157c9472e6a089232f8Johan Hedberg
8014655825c95fd065afc41bfc1c810987bfb1a2c6Johan Hedberg#define MGMT_OP_SET_CONNECTABLE		0x0007
8114655825c95fd065afc41bfc1c810987bfb1a2c6Johan Hedberg
826964bd2dd54d5cce7ce2588b0dcd0a3530e6fba9Johan Hedberg#define MGMT_OP_SET_PAIRABLE		0x0008
836964bd2dd54d5cce7ce2588b0dcd0a3530e6fba9Johan Hedberg
84006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg#define MGMT_OP_ADD_UUID		0x0009
85006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedbergstruct mgmt_cp_add_uuid {
86a31b2bfb5f0880030844eaf27b8f95e04b107f9fJohan Hedberg	uint16_t index;
87a31b2bfb5f0880030844eaf27b8f95e04b107f9fJohan Hedberg	uint8_t uuid[16];
88006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint8_t svc_hint;
89a31b2bfb5f0880030844eaf27b8f95e04b107f9fJohan Hedberg} __packed;
90a31b2bfb5f0880030844eaf27b8f95e04b107f9fJohan Hedberg
91a31b2bfb5f0880030844eaf27b8f95e04b107f9fJohan Hedberg#define MGMT_OP_REMOVE_UUID		0x000A
92006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedbergstruct mgmt_cp_remove_uuid {
93006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint16_t index;
94006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint8_t uuid[16];
95006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg} __packed;
96006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg
97006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg#define MGMT_OP_SET_DEV_CLASS		0x000B
98006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedbergstruct mgmt_cp_set_dev_class {
99006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint16_t index;
100006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint8_t major;
101006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint8_t minor;
102006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg} __packed;
103006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg
104006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg#define MGMT_OP_SET_SERVICE_CACHE	0x000C
105006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedbergstruct mgmt_cp_set_service_cache {
106006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint16_t index;
107006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg	uint8_t enable;
108006301ab40fc71da92f593ddfb2dba70202bd061Johan Hedberg} __packed;
109a31b2bfb5f0880030844eaf27b8f95e04b107f9fJohan Hedberg
110b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedbergstruct mgmt_key_info {
111b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	bdaddr_t bdaddr;
112b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint8_t type;
113b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint8_t val[16];
114b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint8_t pin_len;
115b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg} __packed;
116b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg
117b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg#define MGMT_OP_LOAD_KEYS		0x000D
118b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedbergstruct mgmt_cp_load_keys {
119b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint16_t index;
120b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint8_t debug_keys;
121b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint16_t key_count;
122b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	struct mgmt_key_info keys[0];
123b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg} __packed;
124b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg
125b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg#define MGMT_OP_REMOVE_KEY		0x000E
126b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedbergstruct mgmt_cp_remove_key {
127b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint16_t index;
128b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	bdaddr_t bdaddr;
129b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint8_t disconnect;
130b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg} __packed;
131b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg
132cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg#define MGMT_OP_DISCONNECT		0x000F
133cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedbergstruct mgmt_cp_disconnect {
134cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg	uint16_t index;
135cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg	bdaddr_t bdaddr;
136cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg} __packed;
137cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedbergstruct mgmt_rp_disconnect {
138cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg	uint16_t index;
139cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg	bdaddr_t bdaddr;
140cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg} __packed;
141cc8588d684373cfbca2282e6ec761c2194fb0aedJohan Hedberg
1421e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg#define MGMT_OP_GET_CONNECTIONS		0x0010
1431e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedbergstruct mgmt_cp_get_connections {
1441e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg	uint16_t index;
1451e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg} __packed;
1461e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedbergstruct mgmt_rp_get_connections {
1471e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg	uint16_t index;
1481e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg	uint16_t conn_count;
1491e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg	bdaddr_t conn[0];
1501e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg} __packed;
1511e862b561c65fb0d6096cd93d2c9cfe11f0356bbJohan Hedberg
1528b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg#define MGMT_OP_PIN_CODE_REPLY		0x0011
1538b77225e7b850a0524703be5439023cfff23b16cJohan Hedbergstruct mgmt_cp_pin_code_reply {
1548b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	uint16_t index;
1558b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	bdaddr_t bdaddr;
1568b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	uint8_t pin_len;
1578b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	uint8_t pin_code[16];
1588b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg} __packed;
1598b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg
1608b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg#define MGMT_OP_PIN_CODE_NEG_REPLY	0x0012
1618b77225e7b850a0524703be5439023cfff23b16cJohan Hedbergstruct mgmt_cp_pin_code_neg_reply {
1628b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	uint16_t index;
1638b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	bdaddr_t bdaddr;
1648b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg} __packed;
1658b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg
1669634f5c410e761219037129f71c591459a854391Johan Hedberg#define MGMT_OP_SET_IO_CAPABILITY	0x0013
1679634f5c410e761219037129f71c591459a854391Johan Hedbergstruct mgmt_cp_set_io_capability {
1689634f5c410e761219037129f71c591459a854391Johan Hedberg	uint16_t index;
1699634f5c410e761219037129f71c591459a854391Johan Hedberg	uint8_t io_capability;
1709634f5c410e761219037129f71c591459a854391Johan Hedberg} __packed;
1719634f5c410e761219037129f71c591459a854391Johan Hedberg
1721c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg#define MGMT_OP_PAIR_DEVICE		0x0014
1731c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedbergstruct mgmt_cp_pair_device {
1741c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg	uint16_t index;
1751c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg	bdaddr_t bdaddr;
1761c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg	uint8_t io_cap;
1771c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg} __packed;
1781c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedbergstruct mgmt_rp_pair_device {
1791c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg	uint16_t index;
1801c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg	bdaddr_t bdaddr;
1811c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg	uint8_t status;
1821c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg} __packed;
1831c93c6fa88016166faf1a3d4b0d72531393834f9Johan Hedberg
18450102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg#define MGMT_OP_USER_CONFIRM_REPLY	0x0015
18550102905d99a29d47377103c752f0dbe0ac71d03Johan Hedbergstruct mgmt_cp_user_confirm_reply {
18650102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	uint16_t index;
18750102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	bdaddr_t bdaddr;
18850102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg} __packed;
18950102905d99a29d47377103c752f0dbe0ac71d03Johan Hedbergstruct mgmt_rp_user_confirm_reply {
19050102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	uint16_t index;
19150102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	bdaddr_t bdaddr;
19250102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	uint8_t status;
19350102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg} __packed;
19450102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg
19550102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg#define MGMT_OP_USER_CONFIRM_NEG_REPLY	0x0016
19650102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg
197fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CMD_COMPLETE		0x0001
1989a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_cmd_complete {
199b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg	uint16_t opcode;
200b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg	uint8_t data[0];
201b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg} __packed;
202b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg
203fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CMD_STATUS		0x0002
2049a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_cmd_status {
205ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg	uint8_t status;
206ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg	uint16_t opcode;
207ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg} __packed;
208ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg
209fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CONTROLLER_ERROR	0x0003
2109a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_controller_error {
211ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg	uint16_t index;
212ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg	uint8_t error_code;
213ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg} __packed;
21449bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg
21549bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg#define MGMT_EV_INDEX_ADDED		0x0004
2169a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_index_added {
21749bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg	uint16_t index;
21849bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg} __packed;
21949bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg
22049bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg#define MGMT_EV_INDEX_REMOVED		0x0005
2219a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_index_removed {
22249bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg	uint16_t index;
22349bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg} __packed;
2248582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg
2258582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg#define MGMT_EV_POWERED			0x0006
226528432cc7aad7601c3d98157c9472e6a089232f8Johan Hedberg
227528432cc7aad7601c3d98157c9472e6a089232f8Johan Hedberg#define MGMT_EV_DISCOVERABLE		0x0007
22814655825c95fd065afc41bfc1c810987bfb1a2c6Johan Hedberg
22914655825c95fd065afc41bfc1c810987bfb1a2c6Johan Hedberg#define MGMT_EV_CONNECTABLE		0x0008
2306964bd2dd54d5cce7ce2588b0dcd0a3530e6fba9Johan Hedberg
2316964bd2dd54d5cce7ce2588b0dcd0a3530e6fba9Johan Hedberg#define MGMT_EV_PAIRABLE		0x0009
232b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg
233b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg#define MGMT_EV_NEW_KEY			0x000A
234b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedbergstruct mgmt_ev_new_key {
235b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint16_t index;
236b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	struct mgmt_key_info key;
237b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg	uint8_t old_key_type;
238b115f344441c31c642f360fa5ce7d2fc73c1cfb2Johan Hedberg} __packed;
23948908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg
24048908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg#define MGMT_EV_DEVICE_CONNECTED	0x000B
24148908574c4853023dfe402a120b58a7a7d1f56deJohan Hedbergstruct mgmt_ev_device_connected {
24248908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg	uint16_t index;
24348908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg	bdaddr_t bdaddr;
24448908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg} __packed;
24548908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg
24648908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg#define MGMT_EV_DEVICE_DISCONNECTED	0x000C
24748908574c4853023dfe402a120b58a7a7d1f56deJohan Hedbergstruct mgmt_ev_device_disconnected {
24848908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg	uint16_t index;
24948908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg	bdaddr_t bdaddr;
25048908574c4853023dfe402a120b58a7a7d1f56deJohan Hedberg} __packed;
251d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedberg
252d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedberg#define MGMT_EV_CONNECT_FAILED		0x000D
253d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedbergstruct mgmt_ev_connect_failed {
254d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedberg	uint16_t index;
255d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedberg	bdaddr_t bdaddr;
256d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedberg	uint8_t status;
257d6fda82e31fa3b6fbf74f695201ac0da3aff2757Johan Hedberg} __packed;
2588b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg
2598b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg#define MGMT_EV_PIN_CODE_REQUEST	0x000E
2608b77225e7b850a0524703be5439023cfff23b16cJohan Hedbergstruct mgmt_ev_pin_code_request {
2618b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	uint16_t index;
2628b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg	bdaddr_t bdaddr;
2638b77225e7b850a0524703be5439023cfff23b16cJohan Hedberg} __packed;
26450102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg
26550102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg#define MGMT_EV_USER_CONFIRM_REQUEST	0x000F
26650102905d99a29d47377103c752f0dbe0ac71d03Johan Hedbergstruct mgmt_ev_user_confirm_request {
26750102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	uint16_t index;
26850102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	bdaddr_t bdaddr;
26950102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg	uint32_t value;
27050102905d99a29d47377103c752f0dbe0ac71d03Johan Hedberg} __packed;
271a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedberg
272a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedberg#define MGMT_EV_AUTH_FAILED		0x0010
273a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedbergstruct mgmt_ev_auth_failed {
274a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedberg	uint16_t index;
275a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedberg	bdaddr_t bdaddr;
276a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedberg	uint8_t status;
277a20bb21f47db02155498d71c0bdd2095a56bdc2aJohan Hedberg} __packed;
278