mgmt.h revision fdd43acc2a2a151e380de5f02c291d804ec05419
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 35fb91c88916485512033b8437686a5f2405d19a92Johan Hedbergstruct mgmt_read_version_rp { 36b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg uint8_t version; 37b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg uint16_t revision; 38b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg} __packed; 393d3063f323ae71198a7b1d73b0b1e8e0fd82739aJohan Hedberg#define MGMT_READ_VERSION_RP_SIZE 3 40b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg 41fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_FEATURES 0x0002 4258e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedbergstruct mgmt_read_features_rp { 4358e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint8_t features[8]; 4458e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed; 4558e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg#define MGMT_READ_FEATURES_RP_SIZE 8 46c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg 47fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_INDEX_LIST 0x0003 48c0882114c2f9008762f2b298dd511d349627b490Johan Hedbergstruct mgmt_read_index_list_rp { 49c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg uint16_t num_controllers; 50c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg uint16_t index[0]; 51c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg} __packed; 52c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg#define MGMT_READ_INDEX_LIST_RP_SIZE 2 53c0882114c2f9008762f2b298dd511d349627b490Johan Hedberg 54fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_INFO 0x0004 5558e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedbergstruct mgmt_read_info_cp { 5658e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint16_t index; 5758e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed; 5858e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg#define MGMT_READ_INFO_CP_SIZE 2 5958e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedbergstruct mgmt_read_info_rp { 6058e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint8_t status; 6158e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint16_t index; 6258e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint8_t type; 63b67a8a42e6ea9c2d2b0877ac3832de75ec4e00e5Johan Hedberg bdaddr_t bdaddr; 6458e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint8_t features[8]; 6558e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed; 6658e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg#define MGMT_READ_INFO_RP_SIZE 18 6758e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg 68fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_STATISTICS 0x0005 69fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg 70fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_MODE 0x0006 71fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedbergstruct mgmt_read_mode_cp { 72fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg uint16_t index; 73fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg} __packed; 74fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg#define MGMT_READ_MODE_CP_SIZE 2 75fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedbergstruct mgmt_read_mode_rp { 76fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg uint8_t status; 77fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg uint16_t index; 78fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg uint8_t enabled; 79fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg uint8_t mode; 80fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg} __packed; 81fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg#define MGMT_READ_MODE_RP_SIZE 5 82fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg 83fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_WRITE_MODE 0x0007 8412d02e7f2283d0b1511fc7be08579b3037f5c9a9Johan Hedberg 85fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CMD_COMPLETE 0x0001 86fb91c88916485512033b8437686a5f2405d19a92Johan Hedbergstruct mgmt_cmd_complete_ev { 87b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg uint16_t opcode; 88b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg uint8_t data[0]; 89b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg} __packed; 90fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_CMD_COMPLETE_SIZE 2 91b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg 92fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CMD_STATUS 0x0002 93fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CONTROLLER_ERROR 0x0003 94