2022-05-25 11:28:34

by Joseph Hwang

[permalink] [raw]
Subject: [BlueZ PATCH v5 2/8] lib: Add structures and constants for quality report command and event

Add the new MGMT struct and constants to lib/mgmt.h.

---

Changes in v5:
- Use quality_report instead of action in struct
mgmt_cp_set_quality_report.
- Declare "const uint8_t data[];"

Changes in v4:
- Combine both MGMT command and event changes in a single patch.
- Fix namings of QUALITY_SPEC_AOSP and QUALITY_SPEC_INTEL.
- Use "Quality Report" without the prefix "Bluetooth".

Changes in v3:
- Swap AOSP Bluetooth Quality Report Event and Intel Telemetry Event.

Changes in v2:
- This is a new patch for adding the new struct and constants.

lib/mgmt.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 922a24367..fd59ef6fa 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -96,6 +96,7 @@ struct mgmt_rp_read_index_list {
#define MGMT_SETTING_STATIC_ADDRESS 0x00008000
#define MGMT_SETTING_PHY_CONFIGURATION 0x00010000
#define MGMT_SETTING_WIDEBAND_SPEECH 0x00020000
+#define MGMT_SETTING_QUALITY_REPORT 0x00040000

#define MGMT_OP_READ_INFO 0x0004
struct mgmt_rp_read_info {
@@ -757,6 +758,14 @@ struct mgmt_cp_add_adv_patterns_monitor_rssi {
struct mgmt_adv_pattern patterns[0];
} __packed;

+#define MGMT_OP_SET_QUALITY_REPORT 0x0057
+struct mgmt_cp_set_quality_report {
+ uint8_t quality_report;
+} __packed;
+struct mgmt_rp_set_quality_report {
+ uint32_t current_settings;
+} __packed;
+
#define MGMT_EV_CMD_COMPLETE 0x0001
struct mgmt_ev_cmd_complete {
uint16_t opcode;
@@ -1032,6 +1041,15 @@ struct mgmt_ev_adv_monitor_device_lost {
struct mgmt_addr_info addr;
} __packed;

+#define MGMT_EV_QUALITY_REPORT 0x0031
+#define QUALITY_SPEC_AOSP 0x0
+#define QUALITY_SPEC_INTEL 0x1
+struct mgmt_ev_quality_report {
+ uint8_t quality_spec;
+ uint32_t data_len;
+ const uint8_t data[];
+} __packed;
+
static const char *mgmt_op[] = {
"<0x0000>",
"Read Version",
@@ -1172,6 +1190,7 @@ static const char *mgmt_ev[] = {
"Controller Resume",
"Advertisement Monitor Device Found", /* 0x002f */
"Advertisement Monitor Device Lost",
+ "Quality Report", /* 0x0031 */
};

static const char *mgmt_status[] = {
--
2.36.1.124.g0e6072fb45-goog