You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2025/05/12 11:29:48 UTC
(mynewt-nimble) branch master updated (cc1418744 -> 75a3ec3ad)
This is an automated email from the ASF dual-hosted git repository.
janc pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
from cc1418744 apps/bttester: Set scannable flag if data is present
new ca51138f4 apps: bttester: Add notify multiple command
new 75a3ec3ad apps: bttester: Remove set_mult support
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
apps/bttester/src/btp/btp_gatt.h | 7 +++---
apps/bttester/src/btp_gatt.c | 47 +++++++++++++++-------------------------
2 files changed, 22 insertions(+), 32 deletions(-)
(mynewt-nimble) 02/02: apps: bttester: Remove set_mult support
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 75a3ec3ad2caca69e08788c7a429d2f7d25de6dc
Author: Szymon Czapracki <sz...@codecoup.pl>
AuthorDate: Wed Jan 29 16:59:24 2025 +0100
apps: bttester: Remove set_mult support
This command has no corresponding auto-pts procedure.
Notify is now utilized via function specially designed
for notify purpose.
---
apps/bttester/src/btp/btp_gatt.h | 6 -----
apps/bttester/src/btp_gatt.c | 48 ----------------------------------------
2 files changed, 54 deletions(-)
diff --git a/apps/bttester/src/btp/btp_gatt.h b/apps/bttester/src/btp/btp_gatt.h
index 7849263de..6c57ade09 100644
--- a/apps/bttester/src/btp/btp_gatt.h
+++ b/apps/bttester/src/btp/btp_gatt.h
@@ -314,12 +314,6 @@ struct btp_gatt_change_database_cmd {
uint8_t visibility;
} __packed;
-#define BTP_GATT_SET_MULT_VALUE 0x20
-struct btp_gatt_set_mult_val_cmd {
- uint16_t count;
- uint8_t data[0];
-} __packed;
-
#define BTP_GATT_NOTIFY_MULTIPLE 0x21
struct btp_gatt_notify_mult_val_cmd {
ble_addr_t addr;
diff --git a/apps/bttester/src/btp_gatt.c b/apps/bttester/src/btp_gatt.c
index cbfe1f8fe..b6ac433c0 100644
--- a/apps/bttester/src/btp_gatt.c
+++ b/apps/bttester/src/btp_gatt.c
@@ -1907,49 +1907,6 @@ notify_multiple(uint16_t conn_handle, void *arg)
return rc;
}
-static uint8_t
-set_mult(const void *cmd, uint16_t cmd_len,
- void *rsp, uint16_t *rsp_len)
-{
- const struct btp_gatt_set_mult_val_cmd *cp = cmd;
- struct ble_gatt_notif tuples[16];
- int i;
- int rc = 0;
- int data_idx = 0;
- uint16_t data_len;
- struct notify_mult_cb_data cb_data;
-
- for (i = 0; i < cp->count; i++) {
- tuples[i].handle = get_le16(cp->data + data_idx);
- data_idx += 2;
- tuples[i].value = ble_hs_mbuf_att_pkt();
- if (tuples[i].value == NULL) {
- rc = ENOMEM;
- goto done;
- }
-
- data_len = get_le16(cp->data + data_idx);
- data_idx += 2;
-
- os_mbuf_append(tuples[i].value, cp->data + data_idx, data_len);
- data_idx += data_len;
- }
-
- for (i = 0; i < cp->count; i++) {
- ble_att_svr_write_local(tuples[i].handle, tuples[i].value);
- cb_data.handles[i] = tuples[i].handle;
- }
-
- cb_data.tuple_cnt = cp->count;
- ble_gap_conn_foreach_handle(notify_multiple, (void *)&cb_data);
-done:
- if (rc != 0) {
- return BTP_STATUS_FAILED;
- }
-
- return BTP_STATUS_SUCCESS;
-}
-
static uint8_t
notify_mult(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len)
@@ -2164,11 +2121,6 @@ static const struct btp_handler handlers[] = {
.expect_len = sizeof(struct btp_gatt_get_attribute_value_cmd),
.func = get_attr_val,
},
- {
- .opcode = BTP_GATT_SET_MULT_VALUE,
- .expect_len = BTP_HANDLER_LENGTH_VARIABLE,
- .func = set_mult,
- },
{
.opcode = BTP_GATT_NOTIFY_MULTIPLE,
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
(mynewt-nimble) 01/02: apps: bttester: Add notify multiple command
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit ca51138f488703884301e907a7219dcf12b7982a
Author: Szymon Czapracki <sz...@codecoup.pl>
AuthorDate: Tue Jan 28 17:33:06 2025 +0100
apps: bttester: Add notify multiple command
Add functionality to utilize BTP notify multiple command.
Existing notify handling parses non-existent data.
---
apps/bttester/src/btp/btp_gatt.h | 7 +++++++
apps/bttester/src/btp_gatt.c | 39 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/apps/bttester/src/btp/btp_gatt.h b/apps/bttester/src/btp/btp_gatt.h
index 8da6f43df..7849263de 100644
--- a/apps/bttester/src/btp/btp_gatt.h
+++ b/apps/bttester/src/btp/btp_gatt.h
@@ -320,6 +320,13 @@ struct btp_gatt_set_mult_val_cmd {
uint8_t data[0];
} __packed;
+#define BTP_GATT_NOTIFY_MULTIPLE 0x21
+struct btp_gatt_notify_mult_val_cmd {
+ ble_addr_t addr;
+ uint16_t count;
+ uint16_t handles[0];
+} __packed;
+
/* GATT events */
#define BTP_GATT_EV_NOTIFICATION 0x80
struct btp_gatt_notification_ev {
diff --git a/apps/bttester/src/btp_gatt.c b/apps/bttester/src/btp_gatt.c
index 157e7da1c..cbfe1f8fe 100644
--- a/apps/bttester/src/btp_gatt.c
+++ b/apps/bttester/src/btp_gatt.c
@@ -95,7 +95,7 @@ struct find_attr_data {
struct notify_mult_cb_data {
size_t tuple_cnt;
- uint16_t handles[0];
+ uint16_t handles[8];
};
static int
@@ -1950,6 +1950,38 @@ done:
return BTP_STATUS_SUCCESS;
}
+static uint8_t
+notify_mult(const void *cmd, uint16_t cmd_len,
+ void *rsp, uint16_t *rsp_len)
+{
+ const struct btp_gatt_notify_mult_val_cmd *cp = cmd;
+ struct notify_mult_cb_data cb_data;
+ int i;
+
+
+ if (cmd_len < sizeof(*cp) ||
+ (cmd_len != (sizeof(*cp) +
+ (le16toh(cp->count) * sizeof(cp->handles[0]))))) {
+
+ return BTP_STATUS_FAILED;
+ }
+
+ if (le16toh(cp->count) > sizeof(cb_data.handles)) {
+ SYS_LOG_ERR("Too many handles to notify");
+ return BTP_STATUS_FAILED;
+ }
+
+ for (i = 0; i < cp->count; i++) {
+ cb_data.handles[i] = le16toh(cp->handles[i]);
+ }
+
+ cb_data.tuple_cnt = cp->count;
+
+ ble_gap_conn_foreach_handle(notify_multiple, (void *)&cb_data);
+
+ return BTP_STATUS_SUCCESS;
+}
+
static uint8_t
change_database(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len)
@@ -2137,6 +2169,11 @@ static const struct btp_handler handlers[] = {
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
.func = set_mult,
},
+ {
+ .opcode = BTP_GATT_NOTIFY_MULTIPLE,
+ .expect_len = BTP_HANDLER_LENGTH_VARIABLE,
+ .func = notify_mult,
+ },
};
int