3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2006-2010 Nokia Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #define AVCTP_CONTROL_PSM 23
26 #define AVCTP_BROWSING_PSM 27
29 #define AVC_HEADER_LENGTH 3
32 #define AVC_CTYPE_CONTROL 0x0
33 #define AVC_CTYPE_STATUS 0x1
34 #define AVC_CTYPE_NOTIFY 0x3
35 #define AVC_CTYPE_NOT_IMPLEMENTED 0x8
36 #define AVC_CTYPE_ACCEPTED 0x9
37 #define AVC_CTYPE_REJECTED 0xA
38 #define AVC_CTYPE_STABLE 0xC
39 #define AVC_CTYPE_CHANGED 0xD
40 #define AVC_CTYPE_INTERIM 0xF
43 #define AVC_OP_VENDORDEP 0x00
44 #define AVC_OP_UNITINFO 0x30
45 #define AVC_OP_SUBUNITINFO 0x31
46 #define AVC_OP_PASSTHROUGH 0x7c
48 /* subunits of interest */
49 #define AVC_SUBUNIT_PANEL 0x09
51 /* operands in passthrough commands */
52 #define AVC_SELECT 0x00
56 #define AVC_RIGHT 0x04
57 #define AVC_ROOT_MENU 0x09
58 #define AVC_CONTENTS_MENU 0x0b
59 #define AVC_FAVORITE_MENU 0x0c
61 #define AVC_ON_DEMAND_MENU 0x0e
62 #define AVC_APPS_MENU 0x0f
74 #define AVC_ENTER 0x2b
75 #define AVC_CHANNEL_UP 0x30
76 #define AVC_CHANNEL_DOWN 0x31
77 #define AVC_CHANNEL_PREVIOUS 0x32
78 #define AVC_INPUT_SELECT 0x34
81 #define AVC_PAGE_UP 0x37
82 #define AVC_PAGE_DOWN 0x38
84 #define AVC_POWER 0x40
85 #define AVC_VOLUME_UP 0x41
86 #define AVC_VOLUME_DOWN 0x42
90 #define AVC_PAUSE 0x46
91 #define AVC_RECORD 0x47
92 #define AVC_REWIND 0x48
93 #define AVC_FAST_FORWARD 0x49
94 #define AVC_EJECT 0x4a
95 #define AVC_FORWARD 0x4b
96 #define AVC_BACKWARD 0x4c
108 #define AVC_GREEN 0x7b
109 #define AVC_BLUE 0x7c
110 #define AVC_YELLOW 0x7c
115 AVCTP_STATE_DISCONNECTED = 0,
116 AVCTP_STATE_CONNECTING,
117 AVCTP_STATE_CONNECTED,
118 AVCTP_STATE_BROWSING_CONNECTING,
119 AVCTP_STATE_BROWSING_CONNECTED
122 typedef void (*avctp_state_cb) (struct btd_device *dev,
123 avctp_state_t old_state,
124 avctp_state_t new_state,
125 int err, void *user_data);
127 typedef bool (*avctp_passthrough_cb) (struct avctp *session,
128 uint8_t op, bool pressed,
130 typedef size_t (*avctp_control_pdu_cb) (struct avctp *session,
131 uint8_t transaction, uint8_t *code,
132 uint8_t *subunit, uint8_t *operands,
133 size_t operand_count, void *user_data);
134 typedef gboolean (*avctp_rsp_cb) (struct avctp *session, uint8_t code,
135 uint8_t subunit, uint8_t *operands,
136 size_t operand_count, void *user_data);
137 typedef gboolean (*avctp_browsing_rsp_cb) (struct avctp *session,
138 uint8_t *operands, size_t operand_count,
140 typedef size_t (*avctp_browsing_pdu_cb) (struct avctp *session,
142 uint8_t *operands, size_t operand_count,
145 unsigned int avctp_add_state_cb(struct btd_device *dev, avctp_state_cb cb,
147 gboolean avctp_remove_state_cb(unsigned int id);
149 int avctp_register(struct btd_adapter *adapter, gboolean master);
150 void avctp_unregister(struct btd_adapter *adapter);
152 struct avctp *avctp_connect(struct btd_device *device);
153 struct avctp *avctp_get(struct btd_device *device);
154 bool avctp_is_initiator(struct avctp *session);
155 int avctp_connect_browsing(struct avctp *session);
156 void avctp_disconnect(struct avctp *session);
158 unsigned int avctp_register_passthrough_handler(struct avctp *session,
159 avctp_passthrough_cb cb,
161 bool avctp_unregister_passthrough_handler(unsigned int id);
163 unsigned int avctp_register_pdu_handler(struct avctp *session, uint8_t opcode,
164 avctp_control_pdu_cb cb,
166 gboolean avctp_unregister_pdu_handler(unsigned int id);
168 unsigned int avctp_register_browsing_pdu_handler(struct avctp *session,
169 avctp_browsing_pdu_cb cb,
171 GDestroyNotify destroy);
172 gboolean avctp_unregister_browsing_pdu_handler(unsigned int id);
174 int avctp_send_passthrough(struct avctp *session, uint8_t op);
175 #ifdef __TIZEN_PATCH__
176 int avctp_send_release_passthrough(struct avctp *session, uint8_t op);
178 int avctp_send_vendordep(struct avctp *session, uint8_t transaction,
179 uint8_t code, uint8_t subunit,
180 uint8_t *operands, size_t operand_count);
181 int avctp_send_vendordep_req(struct avctp *session, uint8_t code,
182 uint8_t subunit, uint8_t *operands,
183 size_t operand_count,
184 avctp_rsp_cb func, void *user_data);
185 int avctp_send_browsing_req(struct avctp *session,
186 uint8_t *operands, size_t operand_count,
187 avctp_browsing_rsp_cb func, void *user_data);