~ubuntu-branches/ubuntu/wily/bluez/wily

« back to all changes in this revision

Viewing changes to lib/mgmt.h

ImportĀ upstreamĀ versionĀ 4.81

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  BlueZ - Bluetooth protocol stack for Linux
 
3
 *
 
4
 *  Copyright (C) 2010  Nokia Corporation
 
5
 *  Copyright (C) 2010  Marcel Holtmann <marcel@holtmann.org>
 
6
 *
 
7
 *
 
8
 *  This program is free software; you can redistribute it and/or modify
 
9
 *  it under the terms of the GNU General Public License as published by
 
10
 *  the Free Software Foundation; either version 2 of the License, or
 
11
 *  (at your option) any later version.
 
12
 *
 
13
 *  This program is distributed in the hope that it will be useful,
 
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 *  GNU General Public License for more details.
 
17
 *
 
18
 *  You should have received a copy of the GNU General Public License
 
19
 *  along with this program; if not, write to the Free Software
 
20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
21
 *
 
22
 */
 
23
 
 
24
#ifndef __packed
 
25
#define __packed __attribute__((packed))
 
26
#endif
 
27
 
 
28
struct mgmt_hdr {
 
29
        uint16_t opcode;
 
30
        uint16_t len;
 
31
} __packed;
 
32
#define MGMT_HDR_SIZE   4
 
33
 
 
34
#define MGMT_OP_READ_VERSION            0x0001
 
35
struct mgmt_rp_read_version {
 
36
        uint8_t version;
 
37
        uint16_t revision;
 
38
} __packed;
 
39
 
 
40
#define MGMT_OP_READ_FEATURES           0x0002
 
41
struct mgmt_rp_read_features {
 
42
        uint8_t features[8];
 
43
} __packed;
 
44
 
 
45
#define MGMT_OP_READ_INDEX_LIST         0x0003
 
46
struct mgmt_rp_read_index_list {
 
47
        uint16_t num_controllers;
 
48
        uint16_t index[0];
 
49
} __packed;
 
50
 
 
51
#define MGMT_OP_READ_INFO               0x0004
 
52
struct mgmt_cp_read_info {
 
53
        uint16_t index;
 
54
} __packed;
 
55
struct mgmt_rp_read_info {
 
56
        uint8_t status;
 
57
        uint16_t index;
 
58
        uint8_t type;
 
59
        bdaddr_t bdaddr;
 
60
        uint8_t features[8];
 
61
        uint16_t manufacturer;
 
62
        uint8_t hci_ver;
 
63
        uint16_t hci_rev;
 
64
} __packed;
 
65
 
 
66
#define MGMT_OP_READ_STATISTICS         0x0005
 
67
 
 
68
#define MGMT_OP_READ_MODE               0x0006
 
69
struct mgmt_cp_read_mode {
 
70
        uint16_t index;
 
71
} __packed;
 
72
struct mgmt_rp_read_mode {
 
73
        uint8_t status;
 
74
        uint16_t index;
 
75
        uint8_t enabled;
 
76
        uint8_t mode;
 
77
} __packed;
 
78
 
 
79
#define MGMT_OP_WRITE_MODE              0x0007
 
80
 
 
81
#define MGMT_EV_CMD_COMPLETE            0x0001
 
82
struct mgmt_ev_cmd_complete {
 
83
        uint16_t opcode;
 
84
        uint8_t data[0];
 
85
} __packed;
 
86
 
 
87
#define MGMT_EV_CMD_STATUS              0x0002
 
88
struct mgmt_ev_cmd_status {
 
89
        uint8_t status;
 
90
        uint16_t opcode;
 
91
} __packed;
 
92
 
 
93
#define MGMT_EV_CONTROLLER_ERROR        0x0003
 
94
struct mgmt_ev_controller_error {
 
95
        uint16_t index;
 
96
        uint8_t error_code;
 
97
} __packed;
 
98
 
 
99
#define MGMT_EV_INDEX_ADDED             0x0004
 
100
struct mgmt_ev_index_added {
 
101
        uint16_t index;
 
102
} __packed;
 
103
 
 
104
#define MGMT_EV_INDEX_REMOVED           0x0005
 
105
struct mgmt_ev_index_removed {
 
106
        uint16_t index;
 
107
} __packed;