test-avrcp.c 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2014 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. #ifdef HAVE_CONFIG_H
  11. #include <config.h>
  12. #endif
  13. #include <unistd.h>
  14. #include <stdlib.h>
  15. #include <stdbool.h>
  16. #include <inttypes.h>
  17. #include <string.h>
  18. #include <fcntl.h>
  19. #include <errno.h>
  20. #include <sys/socket.h>
  21. #include <glib.h>
  22. #include "src/shared/util.h"
  23. #include "src/shared/tester.h"
  24. #include "src/log.h"
  25. #include "lib/bluetooth.h"
  26. #include "android/avctp.h"
  27. #include "android/avrcp-lib.h"
  28. struct test_pdu {
  29. bool valid;
  30. bool fragmented;
  31. bool continuing;
  32. bool browse;
  33. uint8_t *data;
  34. size_t size;
  35. };
  36. struct test_data {
  37. char *test_name;
  38. struct test_pdu *pdu_list;
  39. };
  40. struct context {
  41. struct avrcp *session;
  42. guint source;
  43. guint browse_source;
  44. guint process;
  45. int fd;
  46. int browse_fd;
  47. unsigned int pdu_offset;
  48. const struct test_data *data;
  49. };
  50. #define data(args...) ((const unsigned char[]) { args })
  51. #define raw_pdu(args...) \
  52. { \
  53. .valid = true, \
  54. .data = g_memdup(data(args), sizeof(data(args))), \
  55. .size = sizeof(data(args)), \
  56. }
  57. #define brs_pdu(args...) \
  58. { \
  59. .valid = true, \
  60. .browse = true, \
  61. .data = g_memdup(data(args), sizeof(data(args))), \
  62. .size = sizeof(data(args)), \
  63. }
  64. #define frg_pdu(args...) \
  65. { \
  66. .valid = true, \
  67. .fragmented = true, \
  68. .data = g_memdup(data(args), sizeof(data(args))), \
  69. .size = sizeof(data(args)), \
  70. }
  71. #define cont_pdu(args...) \
  72. { \
  73. .valid = true, \
  74. .continuing = true, \
  75. .data = g_memdup(data(args), sizeof(data(args))), \
  76. .size = sizeof(data(args)), \
  77. }
  78. #define define_test(name, function, args...) \
  79. do { \
  80. const struct test_pdu pdus[] = { \
  81. args, { } \
  82. }; \
  83. static struct test_data data; \
  84. data.test_name = g_strdup(name); \
  85. data.pdu_list = g_memdup(pdus, sizeof(pdus)); \
  86. tester_add(name, &data, NULL, function, NULL); \
  87. } while (0)
  88. static void test_free(gconstpointer user_data)
  89. {
  90. const struct test_data *data = user_data;
  91. struct test_pdu *pdu;
  92. int i;
  93. for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
  94. g_free(pdu->data);
  95. g_free(data->test_name);
  96. g_free(data->pdu_list);
  97. }
  98. static void destroy_context(struct context *context)
  99. {
  100. if (context->source > 0)
  101. g_source_remove(context->source);
  102. if (context->browse_source > 0)
  103. g_source_remove(context->browse_source);
  104. avrcp_shutdown(context->session);
  105. test_free(context->data);
  106. g_free(context);
  107. }
  108. static gboolean context_quit(gpointer user_data)
  109. {
  110. struct context *context = user_data;
  111. if (context->process > 0)
  112. g_source_remove(context->process);
  113. destroy_context(context);
  114. tester_test_passed();
  115. return FALSE;
  116. }
  117. static gboolean send_pdu(gpointer user_data)
  118. {
  119. struct context *context = user_data;
  120. const struct test_pdu *pdu;
  121. ssize_t len;
  122. pdu = &context->data->pdu_list[context->pdu_offset++];
  123. if (pdu->browse) {
  124. len = write(context->browse_fd, pdu->data, pdu->size);
  125. tester_monitor('<', 0x0000, 0x001b, pdu->data, len);
  126. } else {
  127. len = write(context->fd, pdu->data, pdu->size);
  128. tester_monitor('<', 0x0000, 0x0017, pdu->data, len);
  129. }
  130. g_assert_cmpint(len, ==, pdu->size);
  131. if (pdu->fragmented)
  132. return send_pdu(user_data);
  133. context->process = 0;
  134. return FALSE;
  135. }
  136. static void context_process(struct context *context)
  137. {
  138. if (!context->data->pdu_list[context->pdu_offset].valid) {
  139. context_quit(context);
  140. return;
  141. }
  142. context->process = g_idle_add(send_pdu, context);
  143. }
  144. static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
  145. gpointer user_data)
  146. {
  147. struct context *context = user_data;
  148. const struct test_pdu *pdu;
  149. unsigned char buf[512];
  150. ssize_t len;
  151. int fd;
  152. pdu = &context->data->pdu_list[context->pdu_offset++];
  153. g_assert(!pdu->browse);
  154. if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
  155. context->source = 0;
  156. tester_debug("%s: cond %x\n", __func__, cond);
  157. return FALSE;
  158. }
  159. fd = g_io_channel_unix_get_fd(channel);
  160. len = read(fd, buf, sizeof(buf));
  161. g_assert(len > 0);
  162. tester_monitor('>', 0x0000, 0x0017, buf, len);
  163. if (!pdu->continuing)
  164. g_assert_cmpint(len, ==, pdu->size);
  165. g_assert(memcmp(buf, pdu->data, pdu->size) == 0);
  166. if (!pdu->fragmented)
  167. context_process(context);
  168. return TRUE;
  169. }
  170. static gboolean browse_test_handler(GIOChannel *channel, GIOCondition cond,
  171. gpointer user_data)
  172. {
  173. struct context *context = user_data;
  174. const struct test_pdu *pdu;
  175. unsigned char buf[512];
  176. ssize_t len;
  177. int fd;
  178. pdu = &context->data->pdu_list[context->pdu_offset++];
  179. g_assert(pdu->browse);
  180. if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
  181. context->browse_source = 0;
  182. tester_debug("%s: cond %x\n", __func__, cond);
  183. return FALSE;
  184. }
  185. fd = g_io_channel_unix_get_fd(channel);
  186. len = read(fd, buf, sizeof(buf));
  187. g_assert(len > 0);
  188. tester_monitor('>', 0x0000, 0x001b, buf, len);
  189. g_assert_cmpint(len, ==, pdu->size);
  190. g_assert(memcmp(buf, pdu->data, pdu->size) == 0);
  191. if (!pdu->fragmented)
  192. context_process(context);
  193. return TRUE;
  194. }
  195. static struct context *create_context(uint16_t version, gconstpointer data)
  196. {
  197. struct context *context = g_new0(struct context, 1);
  198. GIOChannel *channel;
  199. int err, sv[2];
  200. /* Control channel setup */
  201. err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
  202. g_assert(!err);
  203. context->session = avrcp_new(sv[0], 672, 672, version);
  204. g_assert(context->session != NULL);
  205. channel = g_io_channel_unix_new(sv[1]);
  206. g_io_channel_set_close_on_unref(channel, TRUE);
  207. g_io_channel_set_encoding(channel, NULL, NULL);
  208. g_io_channel_set_buffered(channel, FALSE);
  209. context->source = g_io_add_watch(channel,
  210. G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
  211. test_handler, context);
  212. g_assert(context->source > 0);
  213. g_io_channel_unref(channel);
  214. context->fd = sv[1];
  215. /* Browsing channel setup */
  216. err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
  217. g_assert(!err);
  218. err = avrcp_connect_browsing(context->session, sv[0], 672, 672);
  219. g_assert(!err);
  220. channel = g_io_channel_unix_new(sv[1]);
  221. g_io_channel_set_close_on_unref(channel, TRUE);
  222. g_io_channel_set_encoding(channel, NULL, NULL);
  223. g_io_channel_set_buffered(channel, FALSE);
  224. context->browse_source = g_io_add_watch(channel,
  225. G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
  226. browse_test_handler, context);
  227. g_assert(context->browse_source > 0);
  228. g_io_channel_unref(channel);
  229. context->browse_fd = sv[1];
  230. context->data = data;
  231. return context;
  232. }
  233. static void test_dummy(gconstpointer data)
  234. {
  235. struct context *context = create_context(0x0100, data);
  236. context_quit(context);
  237. }
  238. static bool handle_play(struct avrcp *session, bool pressed, void *user_data)
  239. {
  240. return true;
  241. }
  242. static bool handle_volume_up(struct avrcp *session, bool pressed,
  243. void *user_data)
  244. {
  245. return true;
  246. }
  247. static bool handle_channel_up(struct avrcp *session, bool pressed,
  248. void *user_data)
  249. {
  250. return true;
  251. }
  252. static bool handle_select(struct avrcp *session, bool pressed, void *user_data)
  253. {
  254. return true;
  255. }
  256. static bool handle_vendor_uniq(struct avrcp *session, bool pressed,
  257. void *user_data)
  258. {
  259. return true;
  260. }
  261. static const struct avrcp_passthrough_handler passthrough_handlers[] = {
  262. { AVC_PLAY, handle_play },
  263. { AVC_VOLUME_UP, handle_volume_up },
  264. { AVC_CHANNEL_UP, handle_channel_up },
  265. { AVC_SELECT, handle_select },
  266. { AVC_VENDOR_UNIQUE, handle_vendor_uniq },
  267. { },
  268. };
  269. static int get_capabilities(struct avrcp *session, uint8_t transaction,
  270. void *user_data)
  271. {
  272. return -EINVAL;
  273. }
  274. static int list_attributes(struct avrcp *session, uint8_t transaction,
  275. void *user_data)
  276. {
  277. avrcp_list_player_attributes_rsp(session, transaction, 0, NULL);
  278. return 0;
  279. }
  280. static int get_attribute_text(struct avrcp *session, uint8_t transaction,
  281. uint8_t number, uint8_t *attrs,
  282. void *user_data)
  283. {
  284. const char *text[number];
  285. if (number) {
  286. memset(text, 0, number);
  287. text[0] = "equalizer";
  288. }
  289. avrcp_get_player_attribute_text_rsp(session, transaction, number, attrs,
  290. text);
  291. return 0;
  292. }
  293. static int list_values(struct avrcp *session, uint8_t transaction,
  294. uint8_t attr, void *user_data)
  295. {
  296. avrcp_list_player_values_rsp(session, transaction, 0, NULL);
  297. return -EINVAL;
  298. }
  299. static int get_value_text(struct avrcp *session, uint8_t transaction,
  300. uint8_t attr, uint8_t number, uint8_t *values,
  301. void *user_data)
  302. {
  303. const char *text[number];
  304. if (number) {
  305. memset(text, 0, number);
  306. text[0] = "on";
  307. }
  308. avrcp_get_player_values_text_rsp(session, transaction, number,
  309. values, text);
  310. return -EINVAL;
  311. }
  312. static int get_value(struct avrcp *session, uint8_t transaction,
  313. uint8_t number, uint8_t *attrs, void *user_data)
  314. {
  315. uint8_t values[number];
  316. memset(values, 0, number);
  317. avrcp_get_current_player_value_rsp(session, transaction, number, attrs,
  318. values);
  319. return 0;
  320. }
  321. static int set_value(struct avrcp *session, uint8_t transaction,
  322. uint8_t number, uint8_t *attrs, uint8_t *values,
  323. void *user_data)
  324. {
  325. avrcp_set_player_value_rsp(session, transaction);
  326. return 0;
  327. }
  328. static int get_play_status(struct avrcp *session, uint8_t transaction,
  329. void *user_data)
  330. {
  331. avrcp_get_play_status_rsp(session, transaction, 0xaaaaaaaa, 0xbbbbbbbb,
  332. 0x00);
  333. return 0;
  334. }
  335. static int get_element_attributes(struct avrcp *session, uint8_t transaction,
  336. uint64_t uid, uint8_t number,
  337. uint32_t *attrs, void *user_data)
  338. {
  339. struct context *context = user_data;
  340. if (g_str_has_prefix(context->data->test_name, "/TP/RCR")) {
  341. uint8_t params[1024];
  342. memset(params, 0x00, sizeof(params) / 2);
  343. memset(params + (sizeof(params) / 2), 0xff, sizeof(params) / 2);
  344. avrcp_get_element_attrs_rsp(session, transaction, params,
  345. sizeof(params));
  346. } else
  347. avrcp_get_element_attrs_rsp(session, transaction, NULL, 0);
  348. return 0;
  349. }
  350. static int track_changed(struct avrcp *session, uint8_t transaction,
  351. uint32_t interval, void *user_data)
  352. {
  353. struct context *context = user_data;
  354. uint64_t track;
  355. if (g_str_equal(context->data->test_name, "/TP/NFY/BV-05-C") ||
  356. g_str_equal(context->data->test_name, "/TP/NFY/BV-08-C"))
  357. memset(&track, 0, sizeof(track));
  358. else
  359. memset(&track, 0xff, sizeof(track));
  360. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  361. AVRCP_EVENT_TRACK_CHANGED,
  362. &track, sizeof(track));
  363. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  364. AVRCP_EVENT_TRACK_CHANGED,
  365. &track, sizeof(track));
  366. return 0;
  367. }
  368. static int settings_changed(struct avrcp *session, uint8_t transaction,
  369. uint32_t interval, void *user_data)
  370. {
  371. uint8_t settings[3];
  372. settings[0] = 0x01;
  373. settings[1] = 0x01;
  374. settings[2] = 0x02;
  375. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  376. AVRCP_EVENT_SETTINGS_CHANGED,
  377. settings, sizeof(settings));
  378. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  379. AVRCP_EVENT_SETTINGS_CHANGED,
  380. settings, sizeof(settings));
  381. return 0;
  382. }
  383. static int available_players_changed(struct avrcp *session, uint8_t transaction,
  384. uint32_t interval, void *user_data)
  385. {
  386. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  387. AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED,
  388. NULL, 0);
  389. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  390. AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED,
  391. NULL, 0);
  392. return 0;
  393. }
  394. static int addressed_player_changed(struct avrcp *session, uint8_t transaction,
  395. uint32_t interval, void *user_data)
  396. {
  397. uint16_t player[2];
  398. player[0] = 0x0001;
  399. player[1] = 0x0001;
  400. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  401. AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED,
  402. player, sizeof(player));
  403. player[0] = 0x0200;
  404. player[1] = 0x0200;
  405. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  406. AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED,
  407. player, sizeof(player));
  408. return 0;
  409. }
  410. static int uids_changed(struct avrcp *session, uint8_t transaction,
  411. uint32_t interval, void *user_data)
  412. {
  413. struct context *context = user_data;
  414. uint16_t counter;
  415. if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-09-C"))
  416. counter = 0x0000;
  417. else
  418. counter = 0x0001;
  419. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  420. AVRCP_EVENT_UIDS_CHANGED,
  421. &counter, sizeof(counter));
  422. if (!g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-11-C") &&
  423. !g_str_equal(context->data->test_name, "/TP/MCN/CB/BI-05-C"))
  424. return 0;
  425. counter = 0x0200;
  426. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  427. AVRCP_EVENT_UIDS_CHANGED,
  428. &counter, sizeof(counter));
  429. return 0;
  430. }
  431. static int now_playing_content_changed(struct avrcp *session,
  432. uint8_t transaction, uint32_t interval,
  433. void *user_data)
  434. {
  435. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  436. AVRCP_EVENT_NOW_PLAYING_CONTENT_CHANGED,
  437. NULL, 0);
  438. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  439. AVRCP_EVENT_NOW_PLAYING_CONTENT_CHANGED,
  440. NULL, 0);
  441. return 0;
  442. }
  443. static int volume_changed(struct avrcp *session, uint8_t transaction,
  444. uint32_t interval, void *user_data)
  445. {
  446. uint8_t volume = 0x00;
  447. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_INTERIM,
  448. AVRCP_EVENT_VOLUME_CHANGED,
  449. &volume, sizeof(volume));
  450. volume = 0x01;
  451. avrcp_register_notification_rsp(session, transaction, AVC_CTYPE_CHANGED,
  452. AVRCP_EVENT_VOLUME_CHANGED,
  453. &volume, sizeof(volume));
  454. return 0;
  455. }
  456. static int register_notification(struct avrcp *session, uint8_t transaction,
  457. uint8_t event, uint32_t interval,
  458. void *user_data)
  459. {
  460. switch (event) {
  461. case AVRCP_EVENT_TRACK_CHANGED:
  462. return track_changed(session, transaction, interval, user_data);
  463. case AVRCP_EVENT_SETTINGS_CHANGED:
  464. return settings_changed(session, transaction, interval,
  465. user_data);
  466. case AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED:
  467. return available_players_changed(session, transaction, interval,
  468. user_data);
  469. case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
  470. return addressed_player_changed(session, transaction, interval,
  471. user_data);
  472. case AVRCP_EVENT_UIDS_CHANGED:
  473. return uids_changed(session, transaction, interval, user_data);
  474. case AVRCP_EVENT_NOW_PLAYING_CONTENT_CHANGED:
  475. return now_playing_content_changed(session, transaction,
  476. interval, user_data);
  477. case AVRCP_EVENT_VOLUME_CHANGED:
  478. return volume_changed(session, transaction,
  479. interval, user_data);
  480. default:
  481. return -EINVAL;
  482. }
  483. }
  484. static int set_volume(struct avrcp *session, uint8_t transaction,
  485. uint8_t volume, void *user_data)
  486. {
  487. avrcp_set_volume_rsp(session, transaction, volume);
  488. return 0;
  489. }
  490. static int set_addressed(struct avrcp *session, uint8_t transaction,
  491. uint16_t id, void *user_data)
  492. {
  493. struct context *context = user_data;
  494. uint8_t status;
  495. if (g_str_equal(context->data->test_name, "/TP/MPS/BI-01-C"))
  496. status = AVRCP_STATUS_INVALID_PLAYER_ID;
  497. else
  498. status = AVRCP_STATUS_SUCCESS;
  499. avrcp_set_addressed_player_rsp(session, transaction, status);
  500. return 0;
  501. }
  502. static int set_browsed(struct avrcp *session, uint8_t transaction,
  503. uint16_t id, void *user_data)
  504. {
  505. struct context *context = user_data;
  506. const char *folders[1] = { "Filesystem" };
  507. if (g_str_equal(context->data->test_name, "/TP/MPS/BI-02-C"))
  508. avrcp_set_browsed_player_rsp(session, transaction,
  509. AVRCP_STATUS_INVALID_PLAYER_ID,
  510. 0, 0, 0, NULL);
  511. else
  512. avrcp_set_browsed_player_rsp(session, transaction,
  513. AVRCP_STATUS_SUCCESS,
  514. 0xabcd, 0, 1, folders);
  515. return 0;
  516. }
  517. static int get_folder_items(struct avrcp *session, uint8_t transaction,
  518. uint8_t scope, uint32_t start, uint32_t end,
  519. uint16_t number, uint32_t *attrs,
  520. void *user_data)
  521. {
  522. struct context *context = user_data;
  523. if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BI-02-C"))
  524. return -ERANGE;
  525. if (start > 1)
  526. return -ERANGE;
  527. avrcp_get_folder_items_rsp(session, transaction, AVRCP_STATUS_SUCCESS,
  528. 0xabcd, 0, NULL, NULL, NULL);
  529. return 0;
  530. }
  531. static int change_path(struct avrcp *session, uint8_t transaction,
  532. uint16_t counter, uint8_t direction,
  533. uint64_t uid, void *user_data)
  534. {
  535. if (!uid)
  536. return -ENOTDIR;
  537. avrcp_change_path_rsp(session, transaction, AVRCP_STATUS_SUCCESS, 0);
  538. return 0;
  539. }
  540. static int get_item_attributes(struct avrcp *session, uint8_t transaction,
  541. uint8_t scope, uint64_t uid,
  542. uint16_t counter, uint8_t number,
  543. uint32_t *attrs, void *user_data)
  544. {
  545. struct context *context = user_data;
  546. uint8_t status;
  547. if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BI-05-C"))
  548. status = AVRCP_STATUS_UID_CHANGED;
  549. else
  550. status = AVRCP_STATUS_SUCCESS;
  551. avrcp_get_item_attributes_rsp(session, transaction, status, 0, NULL,
  552. NULL);
  553. return 0;
  554. }
  555. static int play_item(struct avrcp *session, uint8_t transaction, uint8_t scope,
  556. uint64_t uid, uint16_t counter, void *user_data)
  557. {
  558. if (!uid)
  559. return -ENOENT;
  560. avrcp_play_item_rsp(session, transaction, AVRCP_STATUS_SUCCESS);
  561. return 0;
  562. }
  563. static int search(struct avrcp *session, uint8_t transaction,
  564. const char *string, void *user_data)
  565. {
  566. avrcp_search_rsp(session, transaction, AVRCP_STATUS_SUCCESS, 0xaabb, 0);
  567. return 0;
  568. }
  569. static int add_to_now_playing(struct avrcp *session, uint8_t transaction,
  570. uint8_t scope, uint64_t uid, uint16_t counter,
  571. void *user_data)
  572. {
  573. if (!uid)
  574. return -ENOENT;
  575. avrcp_add_to_now_playing_rsp(session, transaction,
  576. AVRCP_STATUS_SUCCESS);
  577. return 0;
  578. }
  579. static const struct avrcp_control_ind control_ind = {
  580. .get_capabilities = get_capabilities,
  581. .list_attributes = list_attributes,
  582. .get_attribute_text = get_attribute_text,
  583. .list_values = list_values,
  584. .get_value_text = get_value_text,
  585. .get_value = get_value,
  586. .set_value = set_value,
  587. .get_play_status = get_play_status,
  588. .get_element_attributes = get_element_attributes,
  589. .register_notification = register_notification,
  590. .set_volume = set_volume,
  591. .set_addressed = set_addressed,
  592. .set_browsed = set_browsed,
  593. .get_folder_items = get_folder_items,
  594. .change_path = change_path,
  595. .get_item_attributes = get_item_attributes,
  596. .play_item = play_item,
  597. .search = search,
  598. .add_to_now_playing = add_to_now_playing,
  599. };
  600. static void test_server(gconstpointer data)
  601. {
  602. struct context *context = create_context(0x0100, data);
  603. avrcp_set_passthrough_handlers(context->session, passthrough_handlers,
  604. context);
  605. avrcp_register_player(context->session, &control_ind, NULL, context);
  606. g_idle_add(send_pdu, context);
  607. }
  608. static void get_folder_items_rsp(struct avrcp *session, int err,
  609. uint16_t counter, uint16_t number,
  610. uint8_t *params, void *user_data)
  611. {
  612. struct context *context = user_data;
  613. g_assert_cmpint(err, ==, 0);
  614. g_assert_cmpint(counter, ==, 0xabcd);
  615. g_assert_cmpint(number, ==, 0);
  616. context_quit(context);
  617. }
  618. static void set_volume_rsp(struct avrcp *session, int err, uint8_t volume,
  619. void *user_data)
  620. {
  621. struct context *context = user_data;
  622. g_assert_cmpint(err, ==, 0);
  623. g_assert_cmpint(volume, ==, 1);
  624. context_quit(context);
  625. }
  626. static bool register_notification_rsp(struct avrcp *session, int err,
  627. uint8_t code, uint8_t event,
  628. void *params, void *user_data)
  629. {
  630. struct context *context = user_data;
  631. uint8_t *p = params;
  632. g_assert_cmpint(err, ==, 0);
  633. switch (event) {
  634. case AVRCP_EVENT_VOLUME_CHANGED:
  635. if (g_str_equal(context->data->test_name, "/TP/VLH/BV-03-C")) {
  636. g_assert_cmpint(p[0], ==, 0);
  637. break;
  638. } else if (code == AVC_CTYPE_INTERIM) {
  639. g_assert_cmpint(p[0], ==, 0);
  640. return true;
  641. }
  642. g_assert_cmpint(p[0], ==, 1);
  643. break;
  644. }
  645. context_quit(context);
  646. return false;
  647. }
  648. static const struct avrcp_control_cfm control_cfm = {
  649. .register_notification = register_notification_rsp,
  650. .set_volume = set_volume_rsp,
  651. .get_folder_items = get_folder_items_rsp,
  652. };
  653. static void test_client(gconstpointer data)
  654. {
  655. struct context *context = create_context(0x0100, data);
  656. avrcp_register_player(context->session, NULL, &control_cfm, context);
  657. if (g_str_equal(context->data->test_name, "/TP/MPS/BV-01-C"))
  658. avrcp_set_addressed_player(context->session, 0xabcd);
  659. if (g_str_equal(context->data->test_name, "/TP/MPS/BV-03-C"))
  660. avrcp_set_browsed_player(context->session, 0xabcd);
  661. if (g_str_equal(context->data->test_name, "/TP/MPS/BV-06-C") ||
  662. g_str_equal(context->data->test_name, "/TP/MPS/BV-08-C"))
  663. avrcp_get_folder_items(context->session,
  664. AVRCP_MEDIA_PLAYER_LIST, 0, 2, 0, NULL);
  665. if (g_str_equal(context->data->test_name, "/TP/MPS/BV-01-I"))
  666. avrcp_get_folder_items(context->session,
  667. AVRCP_MEDIA_PLAYER_LIST, 0, 2, 0, NULL);
  668. if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-01-C"))
  669. avrcp_get_folder_items(context->session,
  670. AVRCP_MEDIA_PLAYER_VFS, 0, 2, 0, NULL);
  671. if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-04-C"))
  672. avrcp_change_path(context->session, 0x01, 0x01, 0xaabb);
  673. if (g_str_equal(context->data->test_name, "/TP/MCN/CB/BV-07-C"))
  674. avrcp_get_item_attributes(context->session,
  675. AVRCP_MEDIA_PLAYER_VFS, 0x01, 0xaabb,
  676. 0, NULL);
  677. if (g_str_equal(context->data->test_name, "/TP/MCN/SRC/BV-01-C"))
  678. avrcp_search(context->session, "Country");
  679. if (g_str_equal(context->data->test_name, "/TP/MCN/SRC/BV-03-C"))
  680. avrcp_get_folder_items(context->session, AVRCP_MEDIA_SEARCH,
  681. 0, 2, 0, NULL);
  682. if (g_str_equal(context->data->test_name, "/TP/MCN/SRC/BV-05-C"))
  683. avrcp_get_item_attributes(context->session,
  684. AVRCP_MEDIA_SEARCH, 0x01, 0xaabb,
  685. 0, NULL);
  686. if (g_str_equal(context->data->test_name, "/TP/MCN/NP/BV-01-C"))
  687. avrcp_play_item(context->session, AVRCP_MEDIA_NOW_PLAYING, 1,
  688. 1);
  689. if (g_str_equal(context->data->test_name, "/TP/MCN/NP/BV-03-C"))
  690. avrcp_add_to_now_playing(context->session,
  691. AVRCP_MEDIA_NOW_PLAYING, 0x01, 0xaabb);
  692. if (g_str_equal(context->data->test_name, "/TP/MCN/NP/BV-05-C"))
  693. avrcp_get_folder_items(context->session,
  694. AVRCP_MEDIA_NOW_PLAYING, 0, 2, 0, NULL);
  695. if (g_str_equal(context->data->test_name, "/TP/MCN/NP/BV-08-C"))
  696. avrcp_get_item_attributes(context->session,
  697. AVRCP_MEDIA_NOW_PLAYING, 0x01, 0xaabb,
  698. 0, NULL);
  699. if (g_str_equal(context->data->test_name, "/TP/CFG/BV-01-C"))
  700. avrcp_get_capabilities(context->session, CAP_EVENTS_SUPPORTED);
  701. if (g_str_equal(context->data->test_name, "/TP/PAS/BV-01-C"))
  702. avrcp_list_player_attributes(context->session);
  703. if (g_str_equal(context->data->test_name, "/TP/PAS/BV-03-C")) {
  704. uint8_t attrs[2] = { AVRCP_ATTRIBUTE_EQUALIZER,
  705. AVRCP_ATTRIBUTE_REPEAT_MODE };
  706. avrcp_get_player_attribute_text(context->session, sizeof(attrs),
  707. attrs);
  708. }
  709. if (g_str_equal(context->data->test_name, "/TP/PAS/BV-05-C"))
  710. avrcp_list_player_values(context->session,
  711. AVRCP_ATTRIBUTE_EQUALIZER);
  712. if (g_str_equal(context->data->test_name, "/TP/PAS/BV-07-C")) {
  713. uint8_t values[2] = { AVRCP_EQUALIZER_OFF, AVRCP_EQUALIZER_ON };
  714. avrcp_get_player_value_text(context->session,
  715. AVRCP_ATTRIBUTE_EQUALIZER,
  716. sizeof(values), values);
  717. }
  718. if (g_str_equal(context->data->test_name, "/TP/PAS/BV-09-C")) {
  719. uint8_t attrs[2] = { AVRCP_ATTRIBUTE_EQUALIZER,
  720. AVRCP_ATTRIBUTE_REPEAT_MODE };
  721. avrcp_get_current_player_value(context->session, sizeof(attrs),
  722. attrs);
  723. }
  724. if (g_str_equal(context->data->test_name, "/TP/PAS/BV-11-C")) {
  725. uint8_t attrs[2] = { AVRCP_ATTRIBUTE_EQUALIZER,
  726. AVRCP_ATTRIBUTE_REPEAT_MODE };
  727. uint8_t values[2] = { 0xaa, 0xff };
  728. avrcp_set_player_value(context->session, sizeof(attrs), attrs,
  729. values);
  730. }
  731. if (g_str_equal(context->data->test_name, "/TP/MDI/BV-01-C"))
  732. avrcp_get_play_status(context->session);
  733. if (g_str_equal(context->data->test_name, "/TP/MDI/BV-03-C"))
  734. avrcp_get_element_attributes(context->session);
  735. if (g_str_equal(context->data->test_name, "/TP/NFY/BV-01-C"))
  736. avrcp_register_notification(context->session,
  737. AVRCP_EVENT_STATUS_CHANGED, 0);
  738. if (g_str_equal(context->data->test_name, "/TP/BGN/BV-01-I"))
  739. avrcp_send_passthrough(context->session, IEEEID_BTSIG,
  740. AVC_VENDOR_NEXT_GROUP);
  741. if (g_str_equal(context->data->test_name, "/TP/BGN/BV-02-I"))
  742. avrcp_send_passthrough(context->session, IEEEID_BTSIG,
  743. AVC_VENDOR_PREV_GROUP);
  744. if (g_str_equal(context->data->test_name, "/TP/VLH/BV-01-C"))
  745. avrcp_set_volume(context->session, 0x00);
  746. if (g_str_equal(context->data->test_name, "/TP/VLH/BV-03-C"))
  747. avrcp_register_notification(context->session,
  748. AVRCP_EVENT_VOLUME_CHANGED, 0);
  749. if (g_str_equal(context->data->test_name, "/TP/VLH/BI-03-C"))
  750. avrcp_set_volume(context->session, 0x01);
  751. if (g_str_equal(context->data->test_name, "/TP/VLH/BI-04-C"))
  752. avrcp_register_notification(context->session,
  753. AVRCP_EVENT_VOLUME_CHANGED, 0);
  754. if (g_str_equal(context->data->test_name, "/TP/PTH/BV-01-C"))
  755. avrcp_send_passthrough(context->session, 0, AVC_PLAY);
  756. if (g_str_equal(context->data->test_name, "/TP/PTH/BV-02-C"))
  757. avrcp_send_passthrough(context->session, 0, AVC_FAST_FORWARD);
  758. }
  759. int main(int argc, char *argv[])
  760. {
  761. tester_init(&argc, &argv);
  762. __btd_log_init("*", 0);
  763. /* Media Player Selection Commands and Notifications */
  764. /* SetAddressedPlayer - CT */
  765. define_test("/TP/MPS/BV-01-C", test_client,
  766. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  767. 0x00, 0x19, 0x58, 0x60, 0x00, 0x00,
  768. 0x02, 0xab, 0xcd));
  769. /* SetAddressedPlayer - TG */
  770. define_test("/TP/MPS/BV-02-C", test_server,
  771. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  772. 0x00, 0x19, 0x58, AVRCP_SET_ADDRESSED_PLAYER,
  773. 0x00, 0x00, 0x02, 0xab, 0xcd),
  774. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_STABLE,
  775. 0x48, 0x00, 0x00, 0x19, 0x58,
  776. AVRCP_SET_ADDRESSED_PLAYER,
  777. 0x00, 0x00, 0x01, 0x04));
  778. /* SetBrowsedPlayer - CT */
  779. define_test("/TP/MPS/BV-03-C", test_client,
  780. brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
  781. 0xab, 0xcd));
  782. /* SetBrowsedPlayer - TG */
  783. define_test("/TP/MPS/BV-04-C", test_server,
  784. brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
  785. 0xab, 0xcd),
  786. brs_pdu(0x02, 0x11, 0x0e, 0x70, 0x00, 0x16,
  787. 0x04, 0xab, 0xcd, 0x00, 0x00, 0x00,
  788. 0x00, 0x00, 0x6a, 0x01, 0x00, 0x0a,
  789. 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79,
  790. 0x73, 0x74, 0x65, 0x6d));
  791. /* AddressedPlayerChanged notification – TG */
  792. define_test("/TP/MPS/BV-05-C", test_server,
  793. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  794. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  795. 0x00, 0x00, 0x05, 0x0b,
  796. 0x00, 0x00, 0x00, 0x00),
  797. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  798. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  799. 0x00, 0x00, 0x05, 0x0b,
  800. 0x00, 0x01, 0x00, 0x01),
  801. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  802. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  803. 0x00, 0x00, 0x05, 0x0b,
  804. 0x02, 0x00, 0x02, 0x00));
  805. /* GetFolderItems - CT */
  806. define_test("/TP/MPS/BV-06-C", test_client,
  807. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  808. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_LIST,
  809. 0x00, 0x00, 0x00, 0x00, /* start */
  810. 0x00, 0x00, 0x00, 0x02, /* end */
  811. 0x00),
  812. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  813. 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
  814. /* AvailablePlayersChanged Notification – TG */
  815. define_test("/TP/MPS/BV-07-C", test_server,
  816. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  817. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  818. 0x00, 0x00, 0x05, 0x0a,
  819. 0x00, 0x00, 0x00, 0x00),
  820. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  821. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  822. 0x00, 0x00, 0x01, 0x0a),
  823. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  824. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  825. 0x00, 0x00, 0x01, 0x0a));
  826. /* GetFolderItems - CT */
  827. define_test("/TP/MPS/BV-08-C", test_client,
  828. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  829. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_LIST,
  830. 0x00, 0x00, 0x00, 0x00, /* start */
  831. 0x00, 0x00, 0x00, 0x02, /* end */
  832. 0x00));
  833. /* GetFolderItems - TG */
  834. define_test("/TP/MPS/BV-09-C", test_server,
  835. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  836. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_LIST,
  837. 0x00, 0x00, 0x00, 0x00, /* start */
  838. 0x00, 0x00, 0x00, 0x02, /* end */
  839. 0x00),
  840. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  841. 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
  842. /* SetAddressedPlayer - TG */
  843. define_test("/TP/MPS/BI-01-C", test_server,
  844. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  845. 0x00, 0x19, 0x58, AVRCP_SET_ADDRESSED_PLAYER,
  846. 0x00, 0x00, 0x02, 0xab, 0xcd),
  847. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_STABLE,
  848. 0x48, 0x00, 0x00, 0x19, 0x58,
  849. AVRCP_SET_ADDRESSED_PLAYER,
  850. 0x00, 0x00, 0x01, 0x11));
  851. /* SetBrowsedPlayer - TG */
  852. define_test("/TP/MPS/BI-02-C", test_server,
  853. brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
  854. 0xab, 0xcd),
  855. brs_pdu(0x02, 0x11, 0x0e, 0x70, 0x00, 0x01,
  856. 0x11));
  857. /*
  858. * Media Content Navigation Commands and Notifications for Content
  859. * Browsing.
  860. */
  861. /* GetFolderItems - Virtual FS - CT */
  862. define_test("/TP/MCN/CB/BV-01-C", test_client,
  863. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  864. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
  865. 0x00, 0x00, 0x00, 0x00, /* start */
  866. 0x00, 0x00, 0x00, 0x02, /* end */
  867. 0x00));
  868. /* GetFolderItems - Virtual FS - TG */
  869. define_test("/TP/MCN/CB/BV-02-C", test_server,
  870. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  871. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
  872. 0x00, 0x00, 0x00, 0x00, /* start */
  873. 0x00, 0x00, 0x00, 0x02, /* end */
  874. 0x00),
  875. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  876. 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
  877. /* GetFolderItems - Virtual FS - TG */
  878. define_test("/TP/MCN/CB/BV-03-C", test_server,
  879. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  880. 0x00, 0x19, 0x58, AVRCP_SET_ADDRESSED_PLAYER,
  881. 0x00, 0x00, 0x02, 0xab, 0xcd),
  882. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_STABLE,
  883. 0x48, 0x00, 0x00, 0x19, 0x58,
  884. AVRCP_SET_ADDRESSED_PLAYER,
  885. 0x00, 0x00, 0x01, 0x04),
  886. brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
  887. 0xab, 0xcd),
  888. brs_pdu(0x02, 0x11, 0x0e, 0x70, 0x00, 0x16,
  889. 0x04, 0xab, 0xcd, 0x00, 0x00, 0x00,
  890. 0x00, 0x00, 0x6a, 0x01, 0x00, 0x0a,
  891. 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79,
  892. 0x73, 0x74, 0x65, 0x6d),
  893. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  894. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
  895. 0x00, 0x00, 0x00, 0x00, /* start */
  896. 0x00, 0x00, 0x00, 0x02, /* end */
  897. 0x00),
  898. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  899. 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
  900. /* ChangePath - CT */
  901. define_test("/TP/MCN/CB/BV-04-C", test_client,
  902. brs_pdu(0x00, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  903. 0x00, 0x0b,
  904. 0xaa, 0xbb, /* counter */
  905. 0x01, /* direction */
  906. 0x00, 0x00, 0x00, 0x00,
  907. 0x00, 0x00, 0x00, 0x01 /* Folder UID */));
  908. /* ChangePath - TG */
  909. define_test("/TP/MCN/CB/BV-05-C", test_server,
  910. brs_pdu(0x00, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  911. 0x00, 0x0b,
  912. 0xaa, 0xbb, /* counter */
  913. 0x01, /* direction */
  914. 0x00, 0x00, 0x00, 0x00,
  915. 0x00, 0x00, 0x00, 0x01 /* Folder UID */),
  916. brs_pdu(0x02, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  917. 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00));
  918. /* ChangePath - TG */
  919. define_test("/TP/MCN/CB/BV-06-C", test_server,
  920. brs_pdu(0x00, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  921. 0x00, 0x0b,
  922. 0xaa, 0xbb, /* counter */
  923. 0x00, /* direction */
  924. 0x00, 0x00, 0x00, 0x00,
  925. 0x00, 0x00, 0x00, 0x01 /* Folder UID */),
  926. brs_pdu(0x02, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  927. 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00));
  928. /* GetItemAttributes - CT */
  929. define_test("/TP/MCN/CB/BV-07-C", test_client,
  930. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  931. 0x00, 0x0c, AVRCP_MEDIA_PLAYER_VFS,
  932. 0x00, 0x00, 0x00, 0x00,
  933. 0x00, 0x00, 0x00, 0x01, /* uuid */
  934. 0xaa, 0xbb, /* counter */
  935. 0x00)); /* num attr */
  936. /* GetItemAttributes - TG */
  937. define_test("/TP/MCN/CB/BV-08-C", test_server,
  938. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  939. 0x00, 0x0c, AVRCP_MEDIA_PLAYER_VFS,
  940. 0x00, 0x00, 0x00, 0x00,
  941. 0x00, 0x00, 0x00, 0x01, /* uuid */
  942. 0xaa, 0xbb, /* counter */
  943. 0x00), /* num attr */
  944. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  945. 0x00, 0x02, 0x04, 0x00));
  946. /* UIDcounter - TG */
  947. define_test("/TP/MCN/CB/BV-09-C", test_server,
  948. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  949. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  950. 0x00, 0x00, 0x05, 0x0c,
  951. 0x00, 0x00, 0x00, 0x00),
  952. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  953. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  954. 0x00, 0x00, 0x03, 0x0c,
  955. 0x00, 0x00));
  956. /* UIDcounter - TG */
  957. define_test("/TP/MCN/CB/BV-10-C", test_server,
  958. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  959. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  960. 0x00, 0x00, 0x05, 0x0c,
  961. 0x00, 0x00, 0x00, 0x00),
  962. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  963. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  964. 0x00, 0x00, 0x03, 0x0c,
  965. 0x00, 0x01));
  966. /* UIDcounter - TG */
  967. define_test("/TP/MCN/CB/BV-11-C", test_server,
  968. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  969. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  970. 0x00, 0x00, 0x05, 0x0c,
  971. 0x00, 0x00, 0x00, 0x00),
  972. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  973. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  974. 0x00, 0x00, 0x03, 0x0c,
  975. 0x00, 0x01),
  976. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  977. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  978. 0x00, 0x00, 0x03, 0x0c,
  979. 0x02, 0x00));
  980. /* GetFolderItems - Virtual FS - TG */
  981. define_test("/TP/MCN/CB/BI-01-C", test_server,
  982. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  983. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
  984. 0x00, 0x00, 0x00, 0x01, /* start */
  985. 0x00, 0x00, 0x00, 0x00, /* end */
  986. 0x00),
  987. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  988. 0x00, 0x01, 0x0b));
  989. /* GetFolderItems - Virtual FS - TG */
  990. define_test("/TP/MCN/CB/BI-02-C", test_server,
  991. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  992. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
  993. 0x00, 0x00, 0x00, 0x00, /* start */
  994. 0x00, 0x00, 0x00, 0x01, /* end */
  995. 0x00),
  996. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  997. 0x00, 0x01, 0x0b));
  998. /* GetFolderItems - Virtual FS - TG */
  999. define_test("/TP/MCN/CB/BI-03-C", test_server,
  1000. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1001. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_VFS,
  1002. 0x00, 0x00, 0x00, 0x02, /* start */
  1003. 0x00, 0x00, 0x00, 0x03, /* end */
  1004. 0x00),
  1005. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1006. 0x00, 0x01, 0x0b));
  1007. /* ChangePath - TG */
  1008. define_test("/TP/MCN/CB/BI-04-C", test_server,
  1009. brs_pdu(0x00, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  1010. 0x00, 0x0b,
  1011. 0xaa, 0xbb, /* counter */
  1012. 0x01, /* direction */
  1013. 0x00, 0x00, 0x00, 0x00,
  1014. 0x00, 0x00, 0x00, 0x00 /* Folder UID */),
  1015. brs_pdu(0x02, 0x11, 0x0e, AVRCP_CHANGE_PATH,
  1016. 0x00, 0x01, 0x08));
  1017. /* UIDcounter - TG */
  1018. define_test("/TP/MCN/CB/BI-05-C", test_server,
  1019. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1020. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1021. 0x00, 0x00, 0x05, 0x0c,
  1022. 0x00, 0x00, 0x00, 0x00),
  1023. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1024. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1025. 0x00, 0x00, 0x03, 0x0c,
  1026. 0x00, 0x01),
  1027. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  1028. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1029. 0x00, 0x00, 0x03, 0x0c,
  1030. 0x02, 0x00),
  1031. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1032. 0x00, 0x0c, AVRCP_MEDIA_NOW_PLAYING,
  1033. 0x00, 0x00, 0x00, 0x00,
  1034. 0x00, 0x00, 0x00, 0x01,
  1035. 0xaa, 0xbb,
  1036. 0x00),
  1037. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1038. 0x00, 0x01, 0x05));
  1039. /* Media Content Navigation Commands and Notifications for Search */
  1040. /* Search - CT */
  1041. define_test("/TP/MCN/SRC/BV-01-C", test_client,
  1042. brs_pdu(0x00, 0x11, 0x0e, AVRCP_SEARCH,
  1043. 0x00, 0x0b, 0x00, 0x6a,
  1044. 0x00, 0x07,
  1045. 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79));
  1046. define_test("/TP/MCN/SRC/BV-02-C", test_server,
  1047. brs_pdu(0x00, 0x11, 0x0e, AVRCP_SEARCH,
  1048. 0x00, 0x0b, 0x00, 0x6a,
  1049. 0x00, 0x07,
  1050. 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79),
  1051. brs_pdu(0x02, 0x11, 0x0e, AVRCP_SEARCH,
  1052. 0x00, 0x07, 0x04,
  1053. 0xaa, 0xbb, /* counter */
  1054. 0x00, 0x00, 0x00, 0x00));
  1055. /* GetFolderItems - CT */
  1056. define_test("/TP/MCN/SRC/BV-03-C", test_client,
  1057. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1058. 0x00, 0x0a, AVRCP_MEDIA_SEARCH,
  1059. 0x00, 0x00, 0x00, 0x00, /* start */
  1060. 0x00, 0x00, 0x00, 0x02, /* end */
  1061. 0x00));
  1062. /* GetFolderItems - NowPlaying - TG */
  1063. define_test("/TP/MCN/SCR/BV-04-C", test_server,
  1064. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1065. 0x00, 0x0a, AVRCP_MEDIA_SEARCH,
  1066. 0x00, 0x00, 0x00, 0x00, /* start */
  1067. 0x00, 0x00, 0x00, 0x02, /* end */
  1068. 0x00),
  1069. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1070. 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
  1071. /* GetItemAttributes - CT */
  1072. define_test("/TP/MCN/SRC/BV-05-C", test_client,
  1073. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1074. 0x00, 0x0c, AVRCP_MEDIA_SEARCH,
  1075. 0x00, 0x00, 0x00, 0x00,
  1076. 0x00, 0x00, 0x00, 0x01, /* uuid */
  1077. 0xaa, 0xbb, /* counter */
  1078. 0x00)); /* num attr */
  1079. /* GetItemAttributes - TG */
  1080. define_test("/TP/MCN/SRC/BV-06-C", test_server,
  1081. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1082. 0x00, 0x0c, AVRCP_MEDIA_SEARCH,
  1083. 0x00, 0x00, 0x00, 0x00,
  1084. 0x00, 0x00, 0x00, 0x01, /* uid */
  1085. 0xaa, 0xbb, /* counter */
  1086. 0x00), /* num attr */
  1087. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1088. 0x00, 0x02, 0x04, 0x00));
  1089. /* Media Content Navigation Commands and Notifications for NowPlaying */
  1090. /* PlayItem - NowPlaying - CT */
  1091. define_test("/TP/MCN/NP/BV-01-C", test_client,
  1092. brs_pdu(0x00, 0x11, 0x0e, AVRCP_PLAY_ITEM,
  1093. 0x00, 0x0b, AVRCP_MEDIA_NOW_PLAYING,
  1094. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
  1095. 0x00, 0x01));
  1096. /* PlayItem - NowPlaying - TG */
  1097. define_test("/TP/MCN/NP/BV-02-C", test_server,
  1098. brs_pdu(0x00, 0x11, 0x0e, AVRCP_PLAY_ITEM,
  1099. 0x00, 0x0b, AVRCP_MEDIA_NOW_PLAYING,
  1100. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
  1101. 0x00, 0x01),
  1102. brs_pdu(0x02, 0x11, 0x0e, AVRCP_PLAY_ITEM,
  1103. 0x00, 0x01, 0x04));
  1104. /* AddToNowPlaying - NowPlaying - CT */
  1105. define_test("/TP/MCN/NP/BV-03-C", test_client,
  1106. brs_pdu(0x00, 0x11, 0x0e, AVRCP_ADD_TO_NOW_PLAYING,
  1107. 0x00, 0x0b, AVRCP_MEDIA_NOW_PLAYING,
  1108. 0x00, 0x00, 0x00, 0x00,
  1109. 0x00, 0x00, 0x00, 0x01, /* uid */
  1110. 0xaa, 0xbb));
  1111. /* AddToNowPlaying - NowPlaying - TG */
  1112. define_test("/TP/MCN/NP/BV-04-C", test_server,
  1113. brs_pdu(0x00, 0x11, 0x0e, AVRCP_ADD_TO_NOW_PLAYING,
  1114. 0x00, 0x0b, AVRCP_MEDIA_NOW_PLAYING,
  1115. 0x00, 0x00, 0x00, 0x00,
  1116. 0x00, 0x00, 0x00, 0x01, /* uid */
  1117. 0xaa, 0xbb),
  1118. brs_pdu(0x02, 0x11, 0x0e, AVRCP_ADD_TO_NOW_PLAYING,
  1119. 0x00, 0x01, 0x04));
  1120. /* GetFolderItems - NowPlaying - CT */
  1121. define_test("/TP/MCN/NP/BV-05-C", test_client,
  1122. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1123. 0x00, 0x0a, AVRCP_MEDIA_NOW_PLAYING,
  1124. 0x00, 0x00, 0x00, 0x00, /* start */
  1125. 0x00, 0x00, 0x00, 0x02, /* end */
  1126. 0x00));
  1127. /* GetFolderItems - NowPlaying - TG */
  1128. define_test("/TP/MCN/NP/BV-06-C", test_server,
  1129. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1130. 0x00, 0x0a, AVRCP_MEDIA_NOW_PLAYING,
  1131. 0x00, 0x00, 0x00, 0x00, /* start */
  1132. 0x00, 0x00, 0x00, 0x02, /* end */
  1133. 0x00),
  1134. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1135. 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
  1136. /* NowPlayingContentChanged Notification – TG */
  1137. define_test("/TP/MCN/NP/BV-07-C", test_server,
  1138. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1139. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1140. 0x00, 0x00, 0x05, 0x09,
  1141. 0x00, 0x00, 0x00, 0x00),
  1142. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1143. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1144. 0x00, 0x00, 0x01, 0x09),
  1145. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  1146. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1147. 0x00, 0x00, 0x01, 0x09));
  1148. /* GetItemAttributes - CT */
  1149. define_test("/TP/MCN/NP/BV-08-C", test_client,
  1150. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1151. 0x00, 0x0c, AVRCP_MEDIA_NOW_PLAYING,
  1152. 0x00, 0x00, 0x00, 0x00,
  1153. 0x00, 0x00, 0x00, 0x01, /* uid */
  1154. 0xaa, 0xbb, /* counter */
  1155. 0x00)); /* num attr */
  1156. /* GetItemAttributes - TG */
  1157. define_test("/TP/MCN/CB/BV-09-C", test_server,
  1158. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1159. 0x00, 0x0c, AVRCP_MEDIA_NOW_PLAYING,
  1160. 0x00, 0x00, 0x00, 0x00,
  1161. 0x00, 0x00, 0x00, 0x01, /* uid */
  1162. 0xaa, 0xbb, /* counter */
  1163. 0x00), /* num attr */
  1164. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_ITEM_ATTRIBUTES,
  1165. 0x00, 0x02, 0x04, 0x00));
  1166. /* PlayItem - NowPlaying - TG */
  1167. define_test("/TP/MCN/NP/BI-01-C", test_server,
  1168. brs_pdu(0x00, 0x11, 0x0e, AVRCP_PLAY_ITEM,
  1169. 0x00, 0x0b, AVRCP_MEDIA_NOW_PLAYING,
  1170. 0x00, 0x00, 0x00, 0x00,
  1171. 0x00, 0x00, 0x00, 0x00, /* uid */
  1172. 0xaa, 0xbb), /* counter */
  1173. brs_pdu(0x02, 0x11, 0x0e, AVRCP_PLAY_ITEM,
  1174. 0x00, 0x01, 0x09));
  1175. /* AddToNowPlaying - NowPlaying - TG */
  1176. define_test("/TP/MCN/NP/BI-02-C", test_server,
  1177. brs_pdu(0x00, 0x11, 0x0e, AVRCP_ADD_TO_NOW_PLAYING,
  1178. 0x00, 0x0b, AVRCP_MEDIA_NOW_PLAYING,
  1179. 0x00, 0x00, 0x00, 0x00,
  1180. 0x00, 0x00, 0x00, 0x00, /* uid */
  1181. 0xaa, 0xbb), /* counter */
  1182. brs_pdu(0x02, 0x11, 0x0e, AVRCP_ADD_TO_NOW_PLAYING,
  1183. 0x00, 0x01, 0x09));
  1184. /* Media Player Selection IOP tests */
  1185. /* Listing of available media players */
  1186. define_test("/TP/MPS/BV-01-I", test_client,
  1187. brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
  1188. 0x00, 0x0a, AVRCP_MEDIA_PLAYER_LIST,
  1189. 0x00, 0x00, 0x00, 0x00, /* start */
  1190. 0x00, 0x00, 0x00, 0x02, /* end */
  1191. 0x00));
  1192. /* Connection Establishment for Browsing tests */
  1193. /*
  1194. * Tests are checking connection establishment and release
  1195. * for browsing channel. Since we are connected through socketpair
  1196. * the tests are dummy
  1197. */
  1198. define_test("/TP/CON/BV-01-C", test_dummy, raw_pdu(0x00));
  1199. define_test("/TP/CON/BV-02-C", test_dummy, raw_pdu(0x00));
  1200. define_test("/TP/CON/BV-03-C", test_dummy, raw_pdu(0x00));
  1201. define_test("/TP/CON/BV-04-C", test_dummy, raw_pdu(0x00));
  1202. define_test("/TP/CON/BV-05-C", test_dummy, raw_pdu(0x00));
  1203. /* Connection Establishment for Control tests */
  1204. /*
  1205. * Tests are checking connection establishement and release
  1206. * for control channel. Since we are connected through socketpair
  1207. * the tests are dummy
  1208. */
  1209. define_test("/TP/CEC/BV-01-I", test_dummy, raw_pdu(0x00));
  1210. define_test("/TP/CEC/BV-02-I", test_dummy, raw_pdu(0x00));
  1211. define_test("/TP/CRC/BV-01-I", test_dummy, raw_pdu(0x00));
  1212. define_test("/TP/CRC/BV-02-I", test_dummy, raw_pdu(0x00));
  1213. /* Information collection for control tests */
  1214. define_test("/TP/ICC/BV-01-I", test_server,
  1215. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0xf8, 0x30,
  1216. 0xff, 0xff, 0xff, 0xff, 0xff),
  1217. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0xf8, 0x30,
  1218. 0x07, 0x48, 0xff, 0xff, 0xff));
  1219. define_test("/TP/ICC/BV-02-I", test_server,
  1220. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0xf8, 0x31,
  1221. 0x07, 0xff, 0xff, 0xff, 0xff),
  1222. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0xf8, 0x31,
  1223. 0x07, 0x48, 0xff, 0xff, 0xff));
  1224. define_test("/TP/PTT/BV-01-I", test_server,
  1225. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
  1226. 0x44, 0x00),
  1227. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
  1228. 0x44, 0x00));
  1229. define_test("/TP/PTT/BV-02-I", test_server,
  1230. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
  1231. AVC_VOLUME_UP, 0x00),
  1232. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
  1233. AVC_VOLUME_UP, 0x00));
  1234. define_test("/TP/PTT/BV-03-I", test_server,
  1235. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
  1236. AVC_CHANNEL_UP, 0x00),
  1237. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
  1238. AVC_CHANNEL_UP, 0x00));
  1239. define_test("/TP/PTT/BV-04-I", test_server,
  1240. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
  1241. AVC_SELECT, 0x00),
  1242. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
  1243. AVC_SELECT, 0x00));
  1244. define_test("/TP/PTT/BV-05-I", test_server,
  1245. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
  1246. AVC_PLAY, 0x00),
  1247. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
  1248. AVC_PLAY, 0x00),
  1249. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
  1250. AVC_PLAY | 0x80, 0x00),
  1251. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
  1252. AVC_PLAY | 0x80, 0x00));
  1253. /* Metadata transfer tests */
  1254. define_test("/TP/CFG/BV-01-C", test_client,
  1255. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1256. 0x00, 0x19, 0x58, 0x10, 0x00, 0x00,
  1257. 0x01, 0x03));
  1258. define_test("/TP/CFG/BV-02-C", test_server,
  1259. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1260. 0x00, 0x19, 0x58, 0x10, 0x00, 0x00,
  1261. 0x01, 0x02),
  1262. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1263. 0x00, 0x19, 0x58, 0x10, 0x00, 0x00,
  1264. 0x05, 0x02, 0x01, 0x00, 0x19, 0x58));
  1265. define_test("/TP/CFG/BI-01-C", test_server,
  1266. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1267. 0x00, 0x19, 0x58, 0x10, 0x00, 0x00,
  1268. 0x01, 0x7f),
  1269. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1270. 0x48, 0x00, 0x00, 0x19, 0x58, 0x10,
  1271. 0x00, 0x00, 0x01,
  1272. AVRCP_STATUS_INVALID_PARAM));
  1273. /* Player Application Settings tests */
  1274. define_test("/TP/PAS/BV-01-C", test_client,
  1275. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1276. 0x00, 0x19, 0x58, 0x11, 0x00, 0x00,
  1277. 0x00));
  1278. define_test("/TP/PAS/BV-02-C", test_server,
  1279. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1280. 0x00, 0x19, 0x58, 0x11, 0x00, 0x00,
  1281. 0x00),
  1282. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1283. 0x00, 0x19, 0x58, 0x11, 0x00, 0x00,
  1284. 0x01, 0x00));
  1285. define_test("/TP/PAS/BV-03-C", test_client,
  1286. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1287. 0x00, 0x19, 0x58,
  1288. AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
  1289. 0x00, 0x00, 0x03, 0x02,
  1290. AVRCP_ATTRIBUTE_EQUALIZER,
  1291. AVRCP_ATTRIBUTE_REPEAT_MODE));
  1292. define_test("/TP/PAS/BV-04-C", test_server,
  1293. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1294. 0x00, 0x19, 0x58,
  1295. AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
  1296. 0x00, 0x00, 0x02, 0x01, 0x01),
  1297. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1298. 0x00, 0x19, 0x58,
  1299. AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
  1300. 0x00, 0x00, 0x0e, 0x01, 0x01, 0x00,
  1301. 0x6a, 0x09, 0x65, 0x71, 0x75, 0x61,
  1302. 0x6c, 0x69, 0x7a, 0x65, 0x72));
  1303. define_test("/TP/PAS/BV-05-C", test_client,
  1304. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1305. 0x00, 0x19, 0x58,
  1306. AVRCP_LIST_PLAYER_VALUES,
  1307. 0x00, 0x00, 0x01,
  1308. AVRCP_ATTRIBUTE_EQUALIZER));
  1309. define_test("/TP/PAS/BV-06-C", test_server,
  1310. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1311. 0x00, 0x19, 0x58,
  1312. AVRCP_LIST_PLAYER_VALUES,
  1313. 0x00, 0x00, 0x01, AVRCP_ATTRIBUTE_EQUALIZER),
  1314. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1315. 0x00, 0x19, 0x58,
  1316. AVRCP_LIST_PLAYER_VALUES,
  1317. 0x00, 0x00, 0x01, 0x00));
  1318. define_test("/TP/PAS/BV-07-C", test_client,
  1319. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1320. 0x00, 0x19, 0x58,
  1321. AVRCP_GET_PLAYER_VALUE_TEXT,
  1322. 0x00, 0x00, 0x04,
  1323. AVRCP_ATTRIBUTE_EQUALIZER, 0x02,
  1324. AVRCP_EQUALIZER_OFF,
  1325. AVRCP_EQUALIZER_ON));
  1326. define_test("/TP/PAS/BV-08-C", test_server,
  1327. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1328. 0x00, 0x19, 0x58,
  1329. AVRCP_GET_PLAYER_VALUE_TEXT,
  1330. 0x00, 0x00, 0x03, AVRCP_ATTRIBUTE_EQUALIZER,
  1331. 0x01, 0x01),
  1332. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1333. 0x00, 0x19, 0x58,
  1334. AVRCP_GET_PLAYER_VALUE_TEXT,
  1335. 0x00, 0x00, 0x07, 0x01, 0x01, 0x00,
  1336. 0x6a, 0x02, 0x6f, 0x6e));
  1337. define_test("/TP/PAS/BV-09-C", test_client,
  1338. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1339. 0x00, 0x19, 0x58,
  1340. AVRCP_GET_CURRENT_PLAYER_VALUE,
  1341. 0x00, 0x00, 0x03, 0x02,
  1342. AVRCP_ATTRIBUTE_EQUALIZER,
  1343. AVRCP_ATTRIBUTE_REPEAT_MODE));
  1344. define_test("/TP/PAS/BV-10-C", test_server,
  1345. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1346. 0x00, 0x19, 0x58,
  1347. AVRCP_GET_CURRENT_PLAYER_VALUE,
  1348. 0x00, 0x00, 0x03, 0x02,
  1349. AVRCP_ATTRIBUTE_EQUALIZER,
  1350. AVRCP_ATTRIBUTE_REPEAT_MODE),
  1351. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1352. 0x00, 0x19, 0x58,
  1353. AVRCP_GET_CURRENT_PLAYER_VALUE,
  1354. 0x00, 0x00, 0x05, 0x02,
  1355. AVRCP_ATTRIBUTE_EQUALIZER, 0x00,
  1356. AVRCP_ATTRIBUTE_REPEAT_MODE, 0x00));
  1357. define_test("/TP/PAS/BV-11-C", test_client,
  1358. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1359. 0x00, 0x19, 0x58,
  1360. AVRCP_SET_PLAYER_VALUE,
  1361. 0x00, 0x00, 0x05, 0x02,
  1362. AVRCP_ATTRIBUTE_EQUALIZER, 0xaa,
  1363. AVRCP_ATTRIBUTE_REPEAT_MODE, 0xff));
  1364. /* Get player app setting attribute text invalid behavior - TG */
  1365. define_test("/TP/PAS/BI-01-C", test_server,
  1366. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1367. 0x00, 0x19, 0x58,
  1368. AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
  1369. 0x00, 0x00, 0x02, 0x01,
  1370. /* Invalid attribute id */
  1371. 0x7f),
  1372. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1373. 0x48, 0x00, 0x00, 0x19, 0x58,
  1374. AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
  1375. 0x00, 0x00, 0x01, AVRCP_STATUS_INVALID_PARAM));
  1376. /* List player application setting values invalid behavior - TG */
  1377. define_test("/TP/PAS/BI-02-C", test_server,
  1378. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1379. 0x00, 0x19, 0x58,
  1380. AVRCP_LIST_PLAYER_VALUES,
  1381. 0x00, 0x00, 0x01,
  1382. /* Invalid attribute id */
  1383. 0x7f),
  1384. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1385. 0x48, 0x00, 0x00, 0x19, 0x58,
  1386. AVRCP_LIST_PLAYER_VALUES,
  1387. 0x00, 0x00, 0x01, AVRCP_STATUS_INVALID_PARAM));
  1388. /* Get player application setting value text invalid behavior - TG */
  1389. define_test("/TP/PAS/BI-03-C", test_server,
  1390. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1391. 0x00, 0x19, 0x58,
  1392. AVRCP_GET_PLAYER_VALUE_TEXT,
  1393. 0x00, 0x00, 0x03, AVRCP_ATTRIBUTE_EQUALIZER,
  1394. 0x01,
  1395. /* Invalid setting value */
  1396. 0x7f),
  1397. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1398. 0x48, 0x00, 0x00, 0x19, 0x58,
  1399. AVRCP_GET_PLAYER_VALUE_TEXT,
  1400. 0x00, 0x00, 0x01, AVRCP_STATUS_INVALID_PARAM));
  1401. /* Get current player application setting value invalid behavior - TG */
  1402. define_test("/TP/PAS/BI-04-C", test_server,
  1403. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1404. 0x00, 0x19, 0x58,
  1405. AVRCP_GET_CURRENT_PLAYER_VALUE,
  1406. 0x00, 0x00, 0x02, 0x01,
  1407. /* Invalid attribute */
  1408. 0x7f),
  1409. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1410. 0x48, 0x00, 0x00, 0x19, 0x58,
  1411. AVRCP_GET_CURRENT_PLAYER_VALUE,
  1412. 0x00, 0x00, 0x01, AVRCP_STATUS_INVALID_PARAM));
  1413. /* Set player application setting value invalid behavior - TG */
  1414. define_test("/TP/PAS/BI-05-C", test_server,
  1415. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1416. 0x00, 0x19, 0x58,
  1417. AVRCP_SET_PLAYER_VALUE,
  1418. 0x00, 0x00, 0x03, 0x01,
  1419. AVRCP_ATTRIBUTE_REPEAT_MODE, 0x7f),
  1420. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1421. 0x48, 0x00, 0x00, 0x19, 0x58,
  1422. AVRCP_SET_PLAYER_VALUE,
  1423. 0x00, 0x00, 0x01, AVRCP_STATUS_INVALID_PARAM));
  1424. /* Media Information Commands */
  1425. /* Get play status - CT */
  1426. define_test("/TP/MDI/BV-01-C", test_client,
  1427. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1428. 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
  1429. 0x00, 0x00, 0x00));
  1430. /* Get play status - TG */
  1431. define_test("/TP/MDI/BV-02-C", test_server,
  1432. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1433. 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
  1434. 0x00, 0x00, 0x00),
  1435. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1436. 0x00, 0x19, 0x58, AVRCP_GET_PLAY_STATUS,
  1437. 0x00, 0x00, 0x09,
  1438. 0xbb, 0xbb, 0xbb, 0xbb, /* duration */
  1439. 0xaa, 0xaa, 0xaa, 0xaa, /* position */
  1440. 0x00));
  1441. /* Get element attributes - CT */
  1442. define_test("/TP/MDI/BV-03-C", test_client,
  1443. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1444. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1445. 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
  1446. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00));
  1447. /* Get element attributes - TG */
  1448. define_test("/TP/MDI/BV-04-C", test_server,
  1449. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1450. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1451. 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
  1452. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
  1453. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1454. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1455. 0x00, 0x00, 0x00));
  1456. /* Get element attributes - TG */
  1457. define_test("/TP/MDI/BV-05-C", test_server,
  1458. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1459. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1460. 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,
  1461. 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
  1462. 0x00, 0x00, 0x00, 0x01),
  1463. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1464. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1465. 0x00, 0x00, 0x00));
  1466. /* Notification Commands */
  1467. /* Register notification - CT */
  1468. define_test("/TP/NFY/BV-01-C", test_client,
  1469. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1470. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1471. 0x00, 0x00, 0x05, AVRCP_EVENT_STATUS_CHANGED,
  1472. 0x00, 0x00, 0x00, 0x00));
  1473. /* Register notification - TG */
  1474. define_test("/TP/NFY/BV-02-C", test_server,
  1475. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1476. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1477. 0x00, 0x00, 0x05, AVRCP_EVENT_TRACK_CHANGED,
  1478. 0x00, 0x00, 0x00, 0x00),
  1479. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1480. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1481. 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
  1482. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1483. 0xff, 0xff),
  1484. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  1485. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1486. 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
  1487. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1488. 0xff, 0xff));
  1489. /* Register notification - TG */
  1490. define_test("/TP/NFY/BV-03-C", test_server,
  1491. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1492. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1493. 0x00, 0x00, 0x05,
  1494. AVRCP_EVENT_SETTINGS_CHANGED,
  1495. 0x00, 0x00, 0x00, 0x00),
  1496. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1497. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1498. 0x00, 0x00, 0x04,
  1499. AVRCP_EVENT_SETTINGS_CHANGED,
  1500. 0x01, 0x01, 0x02),
  1501. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  1502. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1503. 0x00, 0x00, 0x04,
  1504. AVRCP_EVENT_SETTINGS_CHANGED,
  1505. 0x01, 0x01, 0x02));
  1506. /* Register notification - Track Changed - No Selected Track - TG */
  1507. define_test("/TP/NFY/BV-04-C", test_server,
  1508. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1509. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1510. 0x00, 0x00, 0x05, AVRCP_EVENT_TRACK_CHANGED,
  1511. 0x00, 0x00, 0x00, 0x00),
  1512. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1513. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1514. 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
  1515. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  1516. 0xff, 0xff));
  1517. /* Register notification - Track Changed - Track Playing - TG */
  1518. define_test("/TP/NFY/BV-05-C", test_server,
  1519. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1520. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1521. 0x00, 0x00, 0x05, AVRCP_EVENT_TRACK_CHANGED,
  1522. 0x00, 0x00, 0x00, 0x00),
  1523. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1524. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1525. 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
  1526. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1527. 0x00, 0x00));
  1528. /* Register notification - Track Changed - Selected Track - TG */
  1529. define_test("/TP/NFY/BV-08-C", test_server,
  1530. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1531. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1532. 0x00, 0x00, 0x05, AVRCP_EVENT_TRACK_CHANGED,
  1533. 0x00, 0x00, 0x00, 0x00),
  1534. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1535. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1536. 0x00, 0x00, 0x09, AVRCP_EVENT_TRACK_CHANGED,
  1537. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1538. 0x00, 0x00));
  1539. /* Register notification - Register for events invalid behavior - TG */
  1540. define_test("/TP/NFY/BI-01-C", test_server,
  1541. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1542. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1543. 0x00, 0x00, 0x05,
  1544. /* Invalid event id */
  1545. 0xff,
  1546. 0x00, 0x00, 0x00, 0x00),
  1547. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1548. 0x48, 0x00, 0x00, 0x19, 0x58,
  1549. AVRCP_REGISTER_NOTIFICATION,
  1550. 0x00, 0x00, 0x01, AVRCP_STATUS_INVALID_PARAM));
  1551. /* Invalid commands */
  1552. /* Invalid PDU ID - TG */
  1553. define_test("/TP/INV/BI-01-C", test_server,
  1554. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1555. 0x00, 0x19, 0x58,
  1556. /* Invalid PDU ID */
  1557. 0xff,
  1558. 0x00, 0x00, 0x00),
  1559. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_REJECTED,
  1560. 0x48, 0x00, 0x00, 0x19, 0x58,
  1561. 0xff, 0x00, 0x00, 0x01,
  1562. AVRCP_STATUS_INVALID_COMMAND));
  1563. /* Invalid PDU ID - Browsing TG */
  1564. define_test("/TP/INV/BI-02-C", test_server,
  1565. brs_pdu(0x00, 0x11, 0x0e, 0xff, 0x00, 0x00),
  1566. brs_pdu(0x02, 0x11, 0x0e, AVRCP_GENERAL_REJECT,
  1567. 0x00, 0x01, AVRCP_STATUS_INVALID_COMMAND));
  1568. /* Next Group command transfer - CT */
  1569. define_test("/TP/BGN/BV-01-I", test_client,
  1570. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48,
  1571. AVC_OP_PASSTHROUGH,
  1572. AVC_VENDOR_UNIQUE, 0x05, 0x00, 0x19,
  1573. 0x58, 0x00, AVC_VENDOR_NEXT_GROUP));
  1574. /* Next Group command transfer - TG */
  1575. define_test("/TP/BGN/BV-01-I", test_server,
  1576. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48,
  1577. AVC_OP_PASSTHROUGH,
  1578. AVC_VENDOR_UNIQUE, 0x05, 0x00, 0x19,
  1579. 0x58, 0x00, AVC_VENDOR_NEXT_GROUP),
  1580. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_ACCEPTED,
  1581. 0x48, AVC_OP_PASSTHROUGH,
  1582. AVC_VENDOR_UNIQUE, 0x05, 0x00, 0x19,
  1583. 0x58, 0x00, AVC_VENDOR_NEXT_GROUP));
  1584. /* Previous Group command transfer - CT */
  1585. define_test("/TP/BGN/BV-02-I", test_client,
  1586. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48,
  1587. AVC_OP_PASSTHROUGH,
  1588. AVC_VENDOR_UNIQUE, 0x05, 0x00, 0x19,
  1589. 0x58, 0x00, AVC_VENDOR_PREV_GROUP));
  1590. /* Previous Group command transfer - TG */
  1591. define_test("/TP/BGN/BV-02-I", test_server,
  1592. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48,
  1593. AVC_OP_PASSTHROUGH,
  1594. AVC_VENDOR_UNIQUE, 0x05, 0x00, 0x19,
  1595. 0x58, 0x00, AVC_VENDOR_PREV_GROUP),
  1596. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_ACCEPTED,
  1597. 0x48, AVC_OP_PASSTHROUGH,
  1598. AVC_VENDOR_UNIQUE, 0x05, 0x00, 0x19,
  1599. 0x58, 0x00, AVC_VENDOR_PREV_GROUP));
  1600. /* Volume Level Handling */
  1601. /* Set absolute volume – CT */
  1602. define_test("/TP/VLH/BV-01-C", test_client,
  1603. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1604. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1605. 0x00, 0x00, 0x01, 0x00));
  1606. /* Set absolute volume – TG */
  1607. define_test("/TP/VLH/BV-02-C", test_server,
  1608. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1609. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1610. 0x00, 0x00, 0x01, 0x00),
  1611. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1612. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1613. 0x00, 0x00, 0x01, 0x00));
  1614. /* NotifyVolumeChange - CT */
  1615. define_test("/TP/VLH/BV-03-C", test_client,
  1616. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1617. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1618. 0x00, 0x00, 0x05, 0x0d,
  1619. 0x00, 0x00, 0x00, 0x00),
  1620. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1621. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1622. 0x00, 0x00, 0x02, 0x0d,
  1623. 0x00));
  1624. /* NotifyVolumeChange - TG */
  1625. define_test("/TP/VLH/BV-04-C", test_server,
  1626. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1627. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1628. 0x00, 0x00, 0x05, 0x0d,
  1629. 0x00, 0x00, 0x00, 0x00),
  1630. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1631. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1632. 0x00, 0x00, 0x02, 0x0d,
  1633. 0x00),
  1634. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  1635. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1636. 0x00, 0x00, 0x02, 0x0d,
  1637. 0x01));
  1638. /* Set absolute volume – TG */
  1639. define_test("/TP/VLH/BI-01-C", test_server,
  1640. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1641. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1642. 0x00, 0x00, 0x00),
  1643. raw_pdu(0x02, 0x11, 0x0e, 0x0a, 0x48, 0x00,
  1644. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1645. 0x00, 0x00, 0x01, 0x01));
  1646. /* Set absolute volume – TG */
  1647. define_test("/TP/VLH/BI-02-C", test_server,
  1648. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1649. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1650. 0x00, 0x00, 0x01, 0x80),
  1651. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1652. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1653. 0x00, 0x00, 0x01, 0x00));
  1654. /* Set Absolute Volume invalid behavior CT */
  1655. define_test("/TP/VLH/BI-03-C", test_client,
  1656. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1657. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1658. 0x00, 0x00, 0x01, 0x01),
  1659. raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1660. 0x00, 0x19, 0x58, AVRCP_SET_ABSOLUTE_VOLUME,
  1661. 0x00, 0x00, 0x01, 0x81));
  1662. /* Set Absolute Volume invalid behavior CT */
  1663. define_test("/TP/VLH/BI-04-C", test_client,
  1664. raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
  1665. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1666. 0x00, 0x00, 0x05, 0x0d,
  1667. 0x00, 0x00, 0x00, 0x00),
  1668. frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
  1669. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1670. 0x00, 0x00, 0x02, 0x0d,
  1671. 0x00),
  1672. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
  1673. 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
  1674. 0x00, 0x00, 0x02, 0x0d,
  1675. 0x81));
  1676. /* PASS THROUGH Handling */
  1677. /* Press and release – CT */
  1678. define_test("/TP/PTH/BV-01-C", test_client,
  1679. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48,
  1680. AVC_OP_PASSTHROUGH, AVC_PLAY, 0x00),
  1681. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_ACCEPTED, 0x48,
  1682. AVC_OP_PASSTHROUGH, AVC_PLAY),
  1683. raw_pdu(0x10, 0x11, 0x0e, 0x00, 0x48,
  1684. AVC_OP_PASSTHROUGH, AVC_PLAY | 0x80, 0x00));
  1685. define_test("/TP/PTH/BV-02-C", test_client,
  1686. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48,
  1687. AVC_OP_PASSTHROUGH, AVC_FAST_FORWARD, 0x00),
  1688. raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_ACCEPTED, 0x48,
  1689. AVC_OP_PASSTHROUGH, AVC_FAST_FORWARD),
  1690. raw_pdu(0x10, 0x11, 0x0e, 0x00, 0x48,
  1691. AVC_OP_PASSTHROUGH, AVC_FAST_FORWARD | 0x80,
  1692. 0x00),
  1693. raw_pdu(0x12, 0x11, 0x0e, AVC_CTYPE_ACCEPTED, 0x48,
  1694. AVC_OP_PASSTHROUGH, AVC_FAST_FORWARD | 0x80),
  1695. raw_pdu(0x20, 0x11, 0x0e, 0x00, 0x48,
  1696. AVC_OP_PASSTHROUGH, AVC_FAST_FORWARD, 0x00));
  1697. /* Request continuing response - TG */
  1698. define_test("/TP/RCR/BV-02-C", test_server,
  1699. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1700. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1701. 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
  1702. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
  1703. cont_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1704. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1705. 0x01, 0x01, 0xf9),
  1706. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1707. 0x00, 0x19, 0x58, AVRCP_REQUEST_CONTINUING,
  1708. 0x00, 0x00, 0x01, AVRCP_GET_ELEMENT_ATTRIBUTES),
  1709. cont_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1710. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1711. 0x02, 0x01, 0xf9),
  1712. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1713. 0x00, 0x19, 0x58, AVRCP_REQUEST_CONTINUING,
  1714. 0x00, 0x00, 0x01, AVRCP_GET_ELEMENT_ATTRIBUTES),
  1715. cont_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1716. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1717. 0x03, 0x00, 0x0e));
  1718. /* Abort continuing response - TG */
  1719. define_test("/TP/RCR/BV-04-C", test_server,
  1720. raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
  1721. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1722. 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
  1723. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
  1724. cont_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
  1725. 0x00, 0x19, 0x58, AVRCP_GET_ELEMENT_ATTRIBUTES,
  1726. 0x01, 0x01, 0xf9),
  1727. raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
  1728. 0x00, 0x19, 0x58, AVRCP_ABORT_CONTINUING,
  1729. 0x00, 0x00, 0x01, AVRCP_GET_ELEMENT_ATTRIBUTES),
  1730. raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x00,
  1731. 0x00, 0x19, 0x58, AVRCP_ABORT_CONTINUING,
  1732. 0x00, 0x00, 0x00));
  1733. return tester_run();
  1734. }