OSDN Git Service

enum-ify stack/include/avrc_defs::tAVRC_PDU
authorChris Manton <cmanton@google.com>
Sat, 12 Dec 2020 17:15:24 +0000 (09:15 -0800)
committerChris Manton <cmanton@google.com>
Sun, 20 Dec 2020 06:48:39 +0000 (22:48 -0800)
Towards readable code

Bug: 163134718
Tag: #refactor
Test: gd/cert/run --host

Change-Id: I667063c026983dcfe04f8b2a98466febdcaeb041

stack/include/avrc_defs.h

index 29d3e39..16ff608 100644 (file)
 #define AVRC_PKT_END 3
 #define AVRC_PKT_TYPE_MASK 3
 
-/* Define the PDUs carried in the vendor dependant data
-*/
-#define AVRC_PDU_GET_CAPABILITIES 0x10
-#define AVRC_PDU_LIST_PLAYER_APP_ATTR 0x11
-#define AVRC_PDU_LIST_PLAYER_APP_VALUES 0x12
-#define AVRC_PDU_GET_CUR_PLAYER_APP_VALUE 0x13
-#define AVRC_PDU_SET_PLAYER_APP_VALUE 0x14
-#define AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT 0x15
-#define AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT 0x16
-#define AVRC_PDU_INFORM_DISPLAY_CHARSET 0x17
-#define AVRC_PDU_INFORM_BATTERY_STAT_OF_CT 0x18
-#define AVRC_PDU_GET_ELEMENT_ATTR 0x20
-#define AVRC_PDU_GET_PLAY_STATUS 0x30
-#define AVRC_PDU_REGISTER_NOTIFICATION 0x31
-#define AVRC_PDU_REQUEST_CONTINUATION_RSP 0x40
-#define AVRC_PDU_ABORT_CONTINUATION_RSP 0x41
-/* added in 1.4 */
-#define AVRC_PDU_SET_ABSOLUTE_VOLUME 0x50
-#define AVRC_PDU_SET_ADDRESSED_PLAYER 0x60
-#define AVRC_PDU_SET_BROWSED_PLAYER 0x70
-#define AVRC_PDU_GET_FOLDER_ITEMS 0x71
-#define AVRC_PDU_CHANGE_PATH 0x72
-#define AVRC_PDU_GET_ITEM_ATTRIBUTES 0x73
-#define AVRC_PDU_PLAY_ITEM 0x74
-/* Added in post 1.5 */
-#define AVRC_PDU_GET_TOTAL_NUM_OF_ITEMS 0x75
-#define AVRC_PDU_SEARCH 0x80
-#define AVRC_PDU_ADD_TO_NOW_PLAYING 0x90
-#define AVRC_PDU_GENERAL_REJECT 0xA0
-
-/* Define the vendor unique id carried in the pass through data
-*/
-#define AVRC_PDU_NEXT_GROUP 0x00
-#define AVRC_PDU_PREV_GROUP 0x01
+typedef enum : uint8_t {
+  /* Define the PDUs carried in the vendor dependant data
+   */
+  AVRC_PDU_GET_CAPABILITIES = 0x10,
+  AVRC_PDU_LIST_PLAYER_APP_ATTR = 0x11,
+  AVRC_PDU_LIST_PLAYER_APP_VALUES = 0x12,
+  AVRC_PDU_GET_CUR_PLAYER_APP_VALUE = 0x13,
+  AVRC_PDU_SET_PLAYER_APP_VALUE = 0x14,
+  AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT = 0x15,
+  AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT = 0x16,
+  AVRC_PDU_INFORM_DISPLAY_CHARSET = 0x17,
+  AVRC_PDU_INFORM_BATTERY_STAT_OF_CT = 0x18,
+  AVRC_PDU_GET_ELEMENT_ATTR = 0x20,
+  AVRC_PDU_GET_PLAY_STATUS = 0x30,
+  AVRC_PDU_REGISTER_NOTIFICATION = 0x31,
+  AVRC_PDU_REQUEST_CONTINUATION_RSP = 0x40,
+  AVRC_PDU_ABORT_CONTINUATION_RSP = 0x41,
+  /* added in 1.4 */
+  AVRC_PDU_SET_ABSOLUTE_VOLUME = 0x50,
+  AVRC_PDU_SET_ADDRESSED_PLAYER = 0x60,
+  AVRC_PDU_SET_BROWSED_PLAYER = 0x70,
+  AVRC_PDU_GET_FOLDER_ITEMS = 0x71,
+  AVRC_PDU_CHANGE_PATH = 0x72,
+  AVRC_PDU_GET_ITEM_ATTRIBUTES = 0x73,
+  AVRC_PDU_PLAY_ITEM = 0x74,
+  /* Added in post 1.5 */
+  AVRC_PDU_GET_TOTAL_NUM_OF_ITEMS = 0x75,
+  AVRC_PDU_SEARCH = 0x80,
+  AVRC_PDU_ADD_TO_NOW_PLAYING = 0x90,
+  AVRC_PDU_GENERAL_REJECT = 0xA0,
+  /* Define the vendor unique id carried in the pass through data
+   */
+  AVRC_PDU_NEXT_GROUP = 0x00,
+  AVRC_PDU_PREV_GROUP = 0x01,
+  AVRC_PDU_INVALID = 0xff,
+} tAVRC_PDU;
+
 /* The only pass through vendor unique commands defined by AVRC are the group
  *  navigation commands.
  * The len for vendor unique data is 5
  */
 #define AVRC_PASS_THRU_GROUP_LEN 5
 
-#define AVRC_PDU_INVALID 0xff
 /* 6.15.3 error status code for general reject */
 /* Invalid command, sent if TG received a PDU that it did not understand. */
 #define AVRC_STS_BAD_CMD 0x00