aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2011-08-01 11:42:15 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2011-08-03 14:00:08 +0300
commit14465a1c9211e798e6a0ed550b9c290ba89e9b76 (patch)
treea48ece41fc9ad1e3da54a429c1b373676ce322bd
parentbc4f1dcd77250a1566d7052dba624bd17ca28929 (diff)
downloadbluez-hcidump-14465a1c9211e798e6a0ed550b9c290ba89e9b76.tar.gz
bluez-hcidump-14465a1c9211e798e6a0ed550b9c290ba89e9b76.tar.xz
bluez-hcidump-14465a1c9211e798e6a0ed550b9c290ba89e9b76.zip
Add parsing for AVRCP InformBatteryStatusOfCT PDU
-rw-r--r--parser/avrcp.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/parser/avrcp.c b/parser/avrcp.c
index 53d8be2..e4d227f 100644
--- a/parser/avrcp.c
+++ b/parser/avrcp.c
@@ -847,6 +847,38 @@ static void avrcp_displayable_charset(int level, struct frame *frm,
}
}
+static const char *status2str(uint8_t status)
+{
+ switch (status) {
+ case 0x0:
+ return "NORMAL";
+ case 0x1:
+ return "WARNING";
+ case 0x2:
+ return "CRITICAL";
+ case 0x3:
+ return "EXTERNAL";
+ case 0x4:
+ return "FULL_CHARGE";
+ default:
+ return "Reserved";
+ }
+}
+
+static void avrcp_ct_battery_status_dump(int level, struct frame *frm,
+ uint8_t ctype, uint16_t len)
+{
+ uint8_t status;
+
+ if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+ return;
+
+ p_indent(level, frm);
+
+ status = get_u8(frm);
+ printf("BatteryStatus: 0x%02x (%s)\n", status, status2str(status));
+}
+
static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
{
uint8_t pduid, pt;
@@ -899,6 +931,9 @@ static void avrcp_pdu_dump(int level, struct frame *frm, uint8_t ctype)
case AVRCP_DISPLAYABLE_CHARSET:
avrcp_displayable_charset(level + 1, frm, ctype, len);
break;
+ case AVRCP_CT_BATTERY_STATUS:
+ avrcp_ct_battery_status_dump(level + 1, frm, ctype, len);
+ break;
default:
raw_dump(level, frm);
}