SumeetSingh19 commented on code in PR #1426:
URL: https://github.com/apache/mynewt-nimble/pull/1426#discussion_r1149125076
##########
nimble/host/src/ble_att_clt.c:
##########
@@ -907,6 +907,59 @@ ble_att_clt_tx_notify(uint16_t conn_handle, uint16_t
handle,
return rc;
}
+/*****************************************************************************
+* $multi handle value notification *
+*****************************************************************************/
+
+int
+ble_att_clt_tx_multi_notify(uint16_t conn_handle, uint16_t * att_handles,
+ struct os_mbuf ** notif_values, uint16_t
num_handles)
+{
+#if !NIMBLE_BLE_ATT_CLT_MULTI_NOTIFY
+ return BLE_HS_ENOTSUP;
+#endif
+
+ struct os_mbuf * txom;
+ int rc;
+ int i;
+
+ if (ble_att_cmd_get(BLE_ATT_OP_MULTI_NOTIFY_REQ, 0, &txom) == NULL) {
+ rc = BLE_HS_ENOMEM;
+ goto err;
+ }
+
+ for (i = 0; i < num_handles; i++) {
+ /* Handle */
+ rc = os_mbuf_copyinto(txom, OS_MBUF_PKTLEN(txom),
+ &att_handles[i], sizeof(att_handles[i]));
+ if (rc != 0) {
+ rc = BLE_HS_ENOMEM;
+ goto err;
+ }
+ /* Length */
+ rc = os_mbuf_copyinto(txom, OS_MBUF_PKTLEN(txom),
+ &(OS_MBUF_PKTLEN(notif_values[i])),
+ sizeof(OS_MBUF_PKTLEN(notif_values[i])));
+ if (rc != 0) {
+ rc = BLE_HS_ENOMEM;
+ goto err;
+ }
+ /* Value */
+ rc = os_mbuf_copyinto(txom, OS_MBUF_PKTLEN(txom),
+ OS_MBUF_DATA(notif_values[i], void *),
+ OS_MBUF_PKTLEN(notif_values[i]));
+ if (rc != 0) {
+ rc = BLE_HS_ENOMEM;
+ goto err;
+ }
+ }
+
+ return ble_att_tx(conn_handle, txom);
Review Comment:
Added logic to make sure that the notification isn't truncated.
If the multi notification is too large, it will be split into multiple
smaller multi notifications.
If a single notification is larger than MTU, no notifications will be sent
by the server.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]