Johan Hedberg | c02178d | 2010-12-08 00:21:05 +0200 | [diff] [blame] | 1 | /* |
| 2 | BlueZ - Bluetooth protocol stack for Linux |
| 3 | |
| 4 | Copyright (C) 2010 Nokia Corporation |
| 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, EXPRESS |
| 11 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
| 13 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
| 14 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
| 15 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 16 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 17 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 18 | |
| 19 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
| 20 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
| 21 | SOFTWARE IS DISCLAIMED. |
| 22 | */ |
| 23 | |
| 24 | struct mgmt_hdr { |
| 25 | __le16 opcode; |
| 26 | __le16 len; |
| 27 | } __packed; |
| 28 | #define MGMT_HDR_SIZE 4 |
| 29 | |
Johan Hedberg | 02d9812 | 2010-12-13 21:07:04 +0200 | [diff] [blame] | 30 | #define MGMT_OP_READ_VERSION 0x0001 |
| 31 | struct mgmt_rp_read_version { |
| 32 | __u8 version; |
| 33 | __le16 revision; |
| 34 | } __packed; |
| 35 | |
Johan Hedberg | faba42e | 2010-12-13 21:07:05 +0200 | [diff] [blame] | 36 | #define MGMT_OP_READ_INDEX_LIST 0x0003 |
| 37 | struct mgmt_rp_read_index_list { |
| 38 | __le16 num_controllers; |
| 39 | __le16 index[0]; |
| 40 | } __packed; |
| 41 | |
Johan Hedberg | f7b64e6 | 2010-12-13 21:07:06 +0200 | [diff] [blame] | 42 | #define MGMT_OP_READ_INFO 0x0004 |
| 43 | struct mgmt_cp_read_info { |
| 44 | __le16 index; |
| 45 | } __packed; |
| 46 | struct mgmt_rp_read_info { |
| 47 | __le16 index; |
| 48 | __u8 type; |
| 49 | __u8 powered; |
| 50 | __u8 discoverable; |
| 51 | __u8 pairable; |
| 52 | __u8 sec_mode; |
| 53 | bdaddr_t bdaddr; |
| 54 | __u8 dev_class[3]; |
| 55 | __u8 features[8]; |
| 56 | __u16 manufacturer; |
| 57 | __u8 hci_ver; |
| 58 | __u16 hci_rev; |
| 59 | } __packed; |
| 60 | |
Johan Hedberg | eec8d2b | 2010-12-16 10:17:38 +0200 | [diff] [blame^] | 61 | #define MGMT_OP_SET_POWERED 0x0005 |
| 62 | struct mgmt_cp_set_powered { |
| 63 | __le16 index; |
| 64 | __u8 powered; |
| 65 | } __packed; |
| 66 | struct mgmt_rp_set_powered { |
| 67 | __le16 index; |
| 68 | __u8 powered; |
| 69 | } __packed; |
| 70 | |
Johan Hedberg | c02178d | 2010-12-08 00:21:05 +0200 | [diff] [blame] | 71 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
| 72 | struct mgmt_ev_cmd_complete { |
| 73 | __le16 opcode; |
| 74 | __u8 data[0]; |
| 75 | } __packed; |
| 76 | |
| 77 | #define MGMT_EV_CMD_STATUS 0x0002 |
| 78 | struct mgmt_ev_cmd_status { |
| 79 | __u8 status; |
| 80 | __le16 opcode; |
| 81 | } __packed; |
| 82 | |
| 83 | #define MGMT_EV_CONTROLLER_ERROR 0x0003 |
| 84 | struct mgmt_ev_controller_error { |
| 85 | __le16 index; |
| 86 | __u8 error_code; |
| 87 | } __packed; |
Johan Hedberg | c71e97b | 2010-12-13 21:07:07 +0200 | [diff] [blame] | 88 | |
| 89 | #define MGMT_EV_INDEX_ADDED 0x0004 |
| 90 | struct mgmt_ev_index_added { |
| 91 | __le16 index; |
| 92 | } __packed; |
| 93 | |
| 94 | #define MGMT_EV_INDEX_REMOVED 0x0005 |
| 95 | struct mgmt_ev_index_removed { |
| 96 | __le16 index; |
| 97 | } __packed; |
Johan Hedberg | 5add6af | 2010-12-16 10:00:37 +0200 | [diff] [blame] | 98 | |
| 99 | #define MGMT_EV_POWERED 0x0006 |
| 100 | struct mgmt_ev_powered { |
| 101 | __le16 index; |
| 102 | __u8 powered; |
| 103 | } __packed; |