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
56
57
58
59
60
61
67
72
73
79
80
81
82
83
92
93
94
95
96
119
120
123
124
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
211
212
213
214
215
216
217
218
219
220
221
222
223
224
236
237
238
239
/* ... */
#include <string.h>
#include "common/bt_target.h"
#include "stack/avrc_api.h"
#include "avrc_int.h"
#if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE)
#if (AVRC_METADATA_INCLUDED == TRUE)
/* ... */
BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type)
{
BOOLEAN result = FALSE;
if (avc_type < AVRC_RSP_NOT_IMPL) {
switch (pdu_id) {
case AVRC_PDU_GET_CAPABILITIES:
case AVRC_PDU_LIST_PLAYER_APP_ATTR:
case AVRC_PDU_LIST_PLAYER_APP_VALUES:
case AVRC_PDU_GET_CUR_PLAYER_APP_VALUE:
case AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT:
case AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT:
case AVRC_PDU_GET_ELEMENT_ATTR:
case AVRC_PDU_GET_PLAY_STATUS:
if (avc_type == AVRC_CMD_STATUS) {
result = TRUE;
}{...}
break;
...
case AVRC_PDU_SET_PLAYER_APP_VALUE:
case AVRC_PDU_INFORM_DISPLAY_CHARSET:
case AVRC_PDU_INFORM_BATTERY_STAT_OF_CT:
case AVRC_PDU_REQUEST_CONTINUATION_RSP:
case AVRC_PDU_ABORT_CONTINUATION_RSP:
case AVRC_PDU_SET_ABSOLUTE_VOLUME:
if (avc_type == AVRC_CMD_CTRL) {
result = TRUE;
}{...}
break;
...
case AVRC_PDU_REGISTER_NOTIFICATION:
if (avc_type == AVRC_CMD_NOTIF) {
result = TRUE;
}{...}
break;...
}{...}
}{...} else {
if (avc_type >= AVRC_RSP_NOT_IMPL &&
avc_type <= AVRC_RSP_INTERIM ) {
result = TRUE;
}{...}
}{...}
return result;
}{...}
/* ... */
BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
{
BOOLEAN result = FALSE;
switch (attrib) {
case AVRC_PLAYER_SETTING_EQUALIZER:
if ((value > 0) &&
(value <= AVRC_PLAYER_VAL_ON)) {
result = TRUE;
}{...}
break;
...
case AVRC_PLAYER_SETTING_REPEAT:
if ((value > 0) &&
(value <= AVRC_PLAYER_VAL_GROUP_REPEAT)) {
result = TRUE;
}{...}
break;
...
case AVRC_PLAYER_SETTING_SHUFFLE:
case AVRC_PLAYER_SETTING_SCAN:
if ((value > 0) &&
(value <= AVRC_PLAYER_VAL_GROUP_SHUFFLE)) {
result = TRUE;
}{...}
break;...
}{...}
if (attrib >= AVRC_PLAYER_SETTING_LOW_MENU_EXT) {
result = TRUE;
}{...}
if (!result) {
AVRC_TRACE_ERROR(
"avrc_is_valid_player_attrib_value() found not matching attrib(x%x)-value(x%x) pair!",
attrib, value);
}{...}
return result;
}{...}
/* ... */
BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr)
{
BOOLEAN result = FALSE;
if ( (attr >= AVRC_PLAYER_SETTING_EQUALIZER && attr <= AVRC_PLAYER_SETTING_SCAN) ||
(attr >= AVRC_PLAYER_SETTING_LOW_MENU_EXT) ) {
result = TRUE;
}{...}
return result;
}{...}
/* ... */
tAVRC_STS avrc_pars_pass_thru(tAVRC_MSG_PASS *p_msg, UINT16 *p_vendor_unique_id)
{
UINT8 *p_data;
UINT32 co_id;
UINT16 id;
tAVRC_STS status = AVRC_STS_BAD_CMD;
if (p_msg->op_id == AVRC_ID_VENDOR && p_msg->pass_len == AVRC_PASS_THRU_GROUP_LEN) {
p_data = p_msg->p_pass_data;
AVRC_BE_STREAM_TO_CO_ID (co_id, p_data);
if (co_id == AVRC_CO_METADATA) {
BE_STREAM_TO_UINT16 (id, p_data);
if (AVRC_IS_VALID_GROUP(id)) {
*p_vendor_unique_id = id;
status = AVRC_STS_NO_ERROR;
}{...}
}{...}
}{...}
return status;
}{...}
/* ... */
UINT8 avrc_opcode_from_pdu(UINT8 pdu)
{
UINT8 opcode = 0;
switch (pdu) {
case AVRC_PDU_NEXT_GROUP:
case AVRC_PDU_PREV_GROUP:
opcode = AVRC_OP_PASS_THRU;
break;
...
default:
opcode = AVRC_OP_VENDOR;
break;...
}{...}
return opcode;
}{...}
/* ... */
BOOLEAN avrc_is_valid_opcode(UINT8 opcode)
{
BOOLEAN is_valid = FALSE;
switch (opcode) {
case AVRC_OP_BROWSE:
case AVRC_OP_PASS_THRU:
case AVRC_OP_VENDOR:
is_valid = TRUE;
break;...
}{...}
return is_valid;
}{...}
/* ... */
#endif
/* ... */
#endif