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
28 #define AVCTP_HEADER_LENGTH 3
29 #define AVC_HEADER_LENGTH 3
31 #define AVC_DATA_OFFSET AVCTP_HEADER_LENGTH + AVC_HEADER_LENGTH
32 #define AVC_DATA_MTU 512
35 #define AVC_CTYPE_CONTROL 0x0
36 #define AVC_CTYPE_STATUS 0x1
37 #define AVC_CTYPE_NOTIFY 0x3
38 #define AVC_CTYPE_NOT_IMPLEMENTED 0x8
39 #define AVC_CTYPE_ACCEPTED 0x9
40 #define AVC_CTYPE_REJECTED 0xA
41 #define AVC_CTYPE_STABLE 0xC
42 #define AVC_CTYPE_CHANGED 0xD
43 #define AVC_CTYPE_INTERIM 0xF
46 #define AVC_OP_VENDORDEP 0x00
47 #define AVC_OP_UNITINFO 0x30
48 #define AVC_OP_SUBUNITINFO 0x31
49 #define AVC_OP_PASSTHROUGH 0x7c
51 /* subunits of interest */
52 #define AVC_SUBUNIT_PANEL 0x09
54 /* operands in passthrough commands */
55 #define AVC_SELECT 0x00
59 #define AVC_RIGHT 0x04
60 #define AVC_ROOT_MENU 0x09
61 #define AVC_CONTENTS_MENU 0x0b
62 #define AVC_FAVORITE_MENU 0x0c
64 #define AVC_ON_DEMAND_MENU 0x0e
65 #define AVC_APPS_MENU 0x0f
77 #define AVC_ENTER 0x2b
78 #define AVC_CHANNEL_UP 0x30
79 #define AVC_CHANNEL_DOWN 0x31
80 #define AVC_CHANNEL_PREVIOUS 0x32
81 #define AVC_INPUT_SELECT 0x34
84 #define AVC_PAGE_UP 0x37
85 #define AVC_PAGE_DOWN 0x38
87 #define AVC_POWER 0x40
88 #define AVC_VOLUME_UP 0x41
89 #define AVC_VOLUME_DOWN 0x42
93 #define AVC_PAUSE 0x46
94 #define AVC_RECORD 0x47
95 #define AVC_REWIND 0x48
96 #define AVC_FAST_FORWARD 0x49
97 #define AVC_EJECT 0x4a
98 #define AVC_FORWARD 0x4b
99 #define AVC_BACKWARD 0x4c
100 #define AVC_LIST 0x4d
111 #define AVC_GREEN 0x7b
112 #define AVC_BLUE 0x7c
113 #define AVC_YELLOW 0x7c
115 #define AVC_VENDOR_UNIQUE 0x7e
117 #define AVC_VENDOR_NEXT_GROUP 0x00
118 #define AVC_VENDOR_PREV_GROUP 0x01
122 typedef bool (*avctp_passthrough_cb) (struct avctp *session,
123 uint8_t op, bool pressed,
125 typedef ssize_t (*avctp_control_pdu_cb) (struct avctp *session,
126 uint8_t transaction, uint8_t *code,
127 uint8_t *subunit, uint8_t *operands,
128 size_t operand_count, void *user_data);
129 typedef gboolean (*avctp_rsp_cb) (struct avctp *session, uint8_t code,
130 uint8_t subunit, uint8_t *operands,
131 size_t operand_count, void *user_data);
132 typedef gboolean (*avctp_browsing_rsp_cb) (struct avctp *session,
133 uint8_t *operands, size_t operand_count,
135 typedef ssize_t (*avctp_browsing_pdu_cb) (struct avctp *session,
137 uint8_t *operands, size_t operand_count,
140 typedef void (*avctp_destroy_cb_t) (void *user_data);
142 struct avctp *avctp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
143 void avctp_set_destroy_cb(struct avctp *session, avctp_destroy_cb_t cb,
146 int avctp_init_uinput(struct avctp *session, const char *name,
147 const char *address);
148 int avctp_connect_browsing(struct avctp *session, int fd, size_t imtu,
151 void avctp_shutdown(struct avctp *session);
153 unsigned int avctp_register_passthrough_handler(struct avctp *session,
154 avctp_passthrough_cb cb,
156 bool avctp_unregister_passthrough_handler(struct avctp *session,
159 unsigned int avctp_register_pdu_handler(struct avctp *session, uint8_t opcode,
160 avctp_control_pdu_cb cb,
162 bool avctp_unregister_pdu_handler(struct avctp *session, unsigned int id);
164 unsigned int avctp_register_browsing_pdu_handler(struct avctp *session,
165 avctp_browsing_pdu_cb cb,
167 avctp_destroy_cb_t destroy);
168 bool avctp_unregister_browsing_pdu_handler(struct avctp *session,
171 int avctp_send_passthrough(struct avctp *session, uint8_t op, uint8_t *params,
173 int avctp_send_vendor(struct avctp *session, uint8_t transaction,
174 uint8_t code, uint8_t subunit,
175 const struct iovec *iov, int iov_cnt);
176 int avctp_send_vendor_req(struct avctp *session, uint8_t code, uint8_t subunit,
177 const struct iovec *iov, int iov_cnt,
178 avctp_rsp_cb func, void *user_data);
179 int avctp_send_browsing(struct avctp *session, uint8_t transaction,
180 const struct iovec *iov, int iov_cnt);
181 int avctp_send_browsing_req(struct avctp *session,
182 const struct iovec *iov, int iov_cnt,
183 avctp_browsing_rsp_cb func, void *user_data);