mgmt.h revision 8582b8e4cdf85425a40696c2839c44417c798687
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; 5924a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg uint8_t discoverable; 6024a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg uint8_t pairable; 6124a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg uint8_t sec_mode; 62b67a8a42e6ea9c2d2b0877ac3832de75ec4e00e5Johan Hedberg bdaddr_t bdaddr; 6324a34a8b1f8615ad79199efdb6fea479509464b4Johan Hedberg uint8_t dev_class[3]; 6458e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg uint8_t features[8]; 658c442fd677490441b64b3509c1264460668d9367Johan Hedberg uint16_t manufacturer; 668c442fd677490441b64b3509c1264460668d9367Johan Hedberg uint8_t hci_ver; 678c442fd677490441b64b3509c1264460668d9367Johan Hedberg uint16_t hci_rev; 6858e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg} __packed; 6958e6c539e644ab0d85890a0369dcc0c3d06a99b1Johan Hedberg 70fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_OP_READ_STATISTICS 0x0005 71fdd43acc2a2a151e380de5f02c291d804ec05419Johan Hedberg 72fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CMD_COMPLETE 0x0001 739a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_cmd_complete { 74b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg uint16_t opcode; 75b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg uint8_t data[0]; 76b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg} __packed; 77b02a68367321b323db81823f43d7332e35ce96faJohan Hedberg 78fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CMD_STATUS 0x0002 799a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_cmd_status { 80ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg uint8_t status; 81ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg uint16_t opcode; 82ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg} __packed; 83ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg 84fb91c88916485512033b8437686a5f2405d19a92Johan Hedberg#define MGMT_EV_CONTROLLER_ERROR 0x0003 859a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_controller_error { 86ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg uint16_t index; 87ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg uint8_t error_code; 88ff489b4fe36d7de4f438df38cb446c7b3477ebdeJohan Hedberg} __packed; 8949bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg 9049bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg#define MGMT_EV_INDEX_ADDED 0x0004 919a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_index_added { 9249bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg uint16_t index; 9349bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg} __packed; 9449bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg 9549bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg#define MGMT_EV_INDEX_REMOVED 0x0005 969a404a4e6bc03afcd78f02ef5cd77e50f77cd012Johan Hedbergstruct mgmt_ev_index_removed { 9749bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg uint16_t index; 9849bedc0b8c58cac7a8198a7247fb6dfb37e29c42Johan Hedberg} __packed; 998582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg 1008582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg#define MGMT_EV_POWERED 0x0006 1018582b8e4cdf85425a40696c2839c44417c798687Johan Hedbergstruct mgmt_ev_powered { 1028582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg uint16_t index; 1038582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg uint8_t powered; 1048582b8e4cdf85425a40696c2839c44417c798687Johan Hedberg} __packed; 105