From 546c29dad4f68cd157ffde7ae312e3c435dfb42d Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 4 Mar 2013 15:12:58 +0200 Subject: monitor: Add full decoding of Page Scan Activity HCI commands --- monitor/bt.h | 13 +++++++++++++ monitor/packet.c | 25 +++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'monitor') diff --git a/monitor/bt.h b/monitor/bt.h index 96c5fce8c..9f50a438c 100644 --- a/monitor/bt.h +++ b/monitor/bt.h @@ -552,6 +552,19 @@ struct bt_hci_cmd_write_scan_enable { uint8_t enable; } __attribute__ ((packed)); +#define BT_HCI_CMD_READ_PAGE_SCAN_ACTIVITY 0x0c1b +struct bt_hci_rsp_read_page_scan_activity { + uint8_t status; + uint16_t interval; + uint16_t window; +} __attribute__ ((packed)); + +#define BT_HCI_CMD_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c +struct bt_hci_cmd_write_page_scan_activity { + uint16_t interval; + uint16_t window; +} __attribute__ ((packed)); + #define BT_HCI_CMD_READ_AUTH_ENABLE 0x0c1f struct bt_hci_rsp_read_auth_enable { uint8_t status; diff --git a/monitor/packet.c b/monitor/packet.c index 91a093e06..bd68d358d 100644 --- a/monitor/packet.c +++ b/monitor/packet.c @@ -3062,6 +3062,23 @@ static void write_scan_enable_cmd(const void *data, uint8_t size) print_scan_enable(cmd->enable); } +static void read_page_scan_activity_rsp(const void *data, uint8_t size) +{ + const struct bt_hci_rsp_read_page_scan_activity *rsp = data; + + print_status(rsp->status); + print_interval(rsp->interval); + print_window(rsp->window); +} + +static void write_page_scan_activity_cmd(const void *data, uint8_t size) +{ + const struct bt_hci_cmd_write_page_scan_activity *cmd = data; + + print_interval(cmd->interval); + print_window(cmd->window); +} + static void read_class_of_dev_rsp(const void *data, uint8_t size) { const struct bt_hci_rsp_read_class_of_dev *rsp = data; @@ -3913,8 +3930,12 @@ static const struct opcode_data opcode_table[] = { { 0x0c1a, 63, "Write Scan Enable", write_scan_enable_cmd, 1, true, status_rsp, 1, true }, - { 0x0c1b, 64, "Read Page Scan Activity" }, - { 0x0c1c, 65, "Write Page Scan Activity" }, + { 0x0c1b, 64, "Read Page Scan Activity", + null_cmd, 0, true, + read_page_scan_activity_rsp, 5, true }, + { 0x0c1c, 65, "Write Page Scan Activity", + write_page_scan_activity_cmd, 4, true, + status_rsp, 1, true }, { 0x0c1d, 66, "Read Inquiry Scan Activity" }, { 0x0c1e, 67, "Write Inquiry Scan Activity" }, { 0x0c1f, 68, "Read Authentication Enable" }, -- cgit v1.2.3