Select one of the symbols to view example projects that use it.
 
Outline
#include <assert.h>
#include "common/bt_target.h"
#include <string.h>
#include "stack/avrc_api.h"
#include "avrc_int.h"
#include "osi/allocator.h"
Files
ESP-IDF
components
app_trace
app_update
bootloader_support
bt
common
controller
esp_ble_mesh
host
bluedroid
api
bta
btc
common
config
device
external
hci
main
stack
a2dp
avct
avdt
avrc
include
btm
btu
gap
gatt
goep
hcic
hid
include
l2cap
obex
rfcomm
sdp
smp
nimble
include
porting
cmock
console
cxx
driver
efuse
esp_adc
esp_app_format
esp_bootloader_format
esp_coex
esp_common
esp_driver_ana_cmpr
esp_driver_cam
esp_driver_dac
esp_driver_gpio
esp_driver_gptimer
esp_driver_i2c
esp_driver_i2s
esp_driver_jpeg
esp_driver_ledc
esp_driver_mcpwm
esp_driver_parlio
esp_driver_pcnt
esp_driver_rmt
esp_driver_sdio
esp_driver_sdm
esp_driver_sdmmc
esp_driver_sdspi
esp_driver_spi
esp_driver_tsens
esp_driver_uart
esp_driver_usb_serial_jtag
esp_eth
esp_event
esp_gdbstub
esp_hid
esp_http_client
esp_http_server
esp_https_ota
esp_https_server
esp_hw_support
esp_lcd
esp_local_ctrl
esp_mm
esp_netif
esp_partition
esp_phy
esp_pm
esp_psram
esp_ringbuf
esp_rom
esp_security
esp_system
esp_timer
esp_vfs_console
esp_wifi
esp-tls
espcoredump
hal
heap
http_parser
ieee802154
log
mqtt
newlib
nvs_flash
nvs_sec_provider
openthread
perfmon
protobuf-c
protocomm
pthread
rt
sdmmc
soc
spi_flash
spiffs
tcp_transport
ulp
unity
vfs
wear_levelling
wifi_provisioning
wpa_supplicant
xtensa
examples
lwIP
FreeRTOS
cJSON
mbedTLS
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/bt/host/bluedroid/stack/avrc/avrc_opt.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/****************************************************************************** * * Copyright (C) 2003-2012 Broadcom Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************//* ... */ /****************************************************************************** * * Interface to AVRCP optional commands * ******************************************************************************//* ... */ #include <assert.h> #include "common/bt_target.h" #include <string.h> #include "stack/avrc_api.h" #include "avrc_int.h" #include "osi/allocator.h"6 includes #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE) /****************************************************************************** ** ** Function avrc_vendor_msg ** ** Description Compose a VENDOR DEPENDENT command according to p_msg ** ** Input Parameters: ** p_msg: Pointer to VENDOR DEPENDENT message structure. ** ** Output Parameters: ** None. ** ** Returns pointer to a valid GKI buffer if successful. ** NULL if p_msg is NULL. ** ******************************************************************************//* ... */ static BT_HDR *avrc_vendor_msg(tAVRC_MSG_VENDOR *p_msg) { BT_HDR *p_cmd; UINT8 *p_data; assert(p_msg != NULL); #if AVRC_METADATA_INCLUDED == TRUE assert(AVRC_META_CMD_BUF_SIZE > (AVRC_MIN_CMD_LEN + p_msg->vendor_len)); if ((p_cmd = (BT_HDR *) osi_malloc(AVRC_META_CMD_BUF_SIZE)) != NULL)/* ... */ #else assert(AVRC_CMD_BUF_SIZE > (AVRC_MIN_CMD_LEN + p_msg->vendor_len)); if ((p_cmd = (BT_HDR *) osi_malloc(AVRC_CMD_BUF_SIZE)) != NULL)/* ... */ #endif { p_cmd->offset = AVCT_MSG_OFFSET; p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset; *p_data++ = (p_msg->hdr.ctype & AVRC_CTYPE_MASK); *p_data++ = (p_msg->hdr.subunit_type << AVRC_SUBTYPE_SHIFT) | p_msg->hdr.subunit_id; *p_data++ = AVRC_OP_VENDOR; AVRC_CO_ID_TO_BE_STREAM(p_data, p_msg->company_id); if (p_msg->vendor_len && p_msg->p_vendor_data) { memcpy(p_data, p_msg->p_vendor_data, p_msg->vendor_len); }{...} p_cmd->len = (UINT16) (p_data + p_msg->vendor_len - (UINT8 *)(p_cmd + 1) - p_cmd->offset); p_cmd->layer_specific = AVCT_DATA_CTRL; }{...} return p_cmd; }{...} /****************************************************************************** ** ** Function AVRC_UnitCmd ** ** Description Send a UNIT INFO command to the peer device. This ** function can only be called for controller role connections. ** Any response message from the peer is passed back through ** the tAVRC_MSG_CBACK callback function. ** ** Input Parameters: ** handle: Handle of this connection. ** ** label: Transaction label. ** ** Output Parameters: ** None. ** ** Returns AVRC_SUCCESS if successful. ** AVRC_BAD_HANDLE if handle is invalid. ** ******************************************************************************//* ... */ UINT16 AVRC_UnitCmd(UINT8 handle, UINT8 label) { BT_HDR *p_cmd; UINT8 *p_data; if ((p_cmd = (BT_HDR *) osi_malloc(AVRC_CMD_BUF_SIZE)) != NULL) { p_cmd->offset = AVCT_MSG_OFFSET; p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset; *p_data++ = AVRC_CMD_STATUS; /* unit & id ignore */ *p_data++ = (AVRC_SUB_UNIT << AVRC_SUBTYPE_SHIFT) | AVRC_SUBID_IGNORE; *p_data++ = AVRC_OP_UNIT_INFO; memset(p_data, AVRC_CMD_OPRND_PAD, AVRC_UNIT_OPRND_BYTES); p_cmd->len = p_data + AVRC_UNIT_OPRND_BYTES - (UINT8 *)(p_cmd + 1) - p_cmd->offset; p_cmd->layer_specific = AVCT_DATA_CTRL; }{...} return AVCT_MsgReq( handle, label, AVCT_CMD, p_cmd); }{...} /****************************************************************************** ** ** Function AVRC_SubCmd ** ** Description Send a SUBUNIT INFO command to the peer device. This ** function can only be called for controller role connections. ** Any response message from the peer is passed back through ** the tAVRC_MSG_CBACK callback function. ** ** Input Parameters: ** handle: Handle of this connection. ** ** label: Transaction label. ** ** page: Specifies which part of the subunit type table ** is requested. For AVRCP it is typically zero. ** Value range is 0-7. ** ** Output Parameters: ** None. ** ** Returns AVRC_SUCCESS if successful. ** AVRC_BAD_HANDLE if handle is invalid. ** ******************************************************************************//* ... */ UINT16 AVRC_SubCmd(UINT8 handle, UINT8 label, UINT8 page) { BT_HDR *p_cmd; UINT8 *p_data; if ((p_cmd = (BT_HDR *) osi_malloc(AVRC_CMD_BUF_SIZE)) != NULL) { p_cmd->offset = AVCT_MSG_OFFSET; p_data = (UINT8 *)(p_cmd + 1) + p_cmd->offset; *p_data++ = AVRC_CMD_STATUS; /* unit & id ignore */ *p_data++ = (AVRC_SUB_UNIT << AVRC_SUBTYPE_SHIFT) | AVRC_SUBID_IGNORE; *p_data++ = AVRC_OP_SUB_INFO; *p_data++ = ((page & AVRC_SUB_PAGE_MASK) << AVRC_SUB_PAGE_SHIFT) | AVRC_SUB_EXT_CODE; memset(p_data, AVRC_CMD_OPRND_PAD, AVRC_SUB_OPRND_BYTES); p_cmd->len = p_data + AVRC_SUB_OPRND_BYTES - (UINT8 *)(p_cmd + 1) - p_cmd->offset; p_cmd->layer_specific = AVCT_DATA_CTRL; }{...} return AVCT_MsgReq( handle, label, AVCT_CMD, p_cmd); }{...} /****************************************************************************** ** ** Function AVRC_VendorCmd ** ** Description Send a VENDOR DEPENDENT command to the peer device. This ** function can only be called for controller role connections. ** Any response message from the peer is passed back through ** the tAVRC_MSG_CBACK callback function. ** ** Input Parameters: ** handle: Handle of this connection. ** ** label: Transaction label. ** ** p_msg: Pointer to VENDOR DEPENDENT message structure. ** ** Output Parameters: ** None. ** ** Returns AVRC_SUCCESS if successful. ** AVRC_BAD_HANDLE if handle is invalid. ** ******************************************************************************//* ... */ UINT16 AVRC_VendorCmd(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg) { BT_HDR *p_buf = avrc_vendor_msg(p_msg); if (p_buf) { return AVCT_MsgReq( handle, label, AVCT_CMD, p_buf); }{...} else { return AVCT_NO_RESOURCES; }{...} }{...} /****************************************************************************** ** ** Function AVRC_VendorRsp ** ** Description Send a VENDOR DEPENDENT response to the peer device. This ** function can only be called for target role connections. ** This function must be called when a VENDOR DEPENDENT ** command message is received from the peer through the ** tAVRC_MSG_CBACK callback function. ** ** Input Parameters: ** handle: Handle of this connection. ** ** label: Transaction label. Must be the same value as ** passed with the command message in the callback function. ** ** p_msg: Pointer to VENDOR DEPENDENT message structure. ** ** Output Parameters: ** None. ** ** Returns AVRC_SUCCESS if successful. ** AVRC_BAD_HANDLE if handle is invalid. ** ******************************************************************************//* ... */ UINT16 AVRC_VendorRsp(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg) { BT_HDR *p_buf = avrc_vendor_msg(p_msg); if (p_buf) { return AVCT_MsgReq( handle, label, AVCT_RSP, p_buf); }{...} else { return AVCT_NO_RESOURCES; }{...} }{...} /* ... */ #endif /* #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE) */
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.