Skip to content

Commit d1f0219

Browse files
committed
Corrected parameters assignment in per_adv_transfer_enable
1 parent 0715750 commit d1f0219

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

nimble/host/src/ble_gap.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4896,20 +4896,26 @@ periodic_adv_transfer_enable(uint16_t conn_handle,
48964896

48974897
opcode = BLE_HCI_OP(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_PERIODIC_ADV_SYNC_TRANSFER_PARAMS);
48984898

4899+
memset(&cmd, 0, sizeof(cmd));
48994900
cmd.conn_handle = htole16(conn_handle);
4900-
cmd.mode = params->reports_disabled ? 0x01 : 0x02;
4901+
4902+
if (params != NULL) {
49014903
#if MYNEWT_VAL(BLE_AOA_AOD)
4902-
cmd.sync_cte_type = params->sync_cte_type;
4903-
#else
4904-
cmd.sync_cte_type = 0x00;
4904+
cmd.sync_cte_type = params->sync_cte_type;
4905+
#else
4906+
cmd.sync_cte_type = 0x00;
49054907
#endif
4908+
cmd.mode = params->reports_disabled ? 0x01 : 0x02;
4909+
49064910
#if MYNEWT_VAL(BLE_PERIODIC_ADV_ENH)
4907-
if (params->filter_duplicates)
4908-
cmd.mode = 0x03;
4911+
if (!params->reports_disabled && params->filter_duplicates) {
4912+
cmd.mode = 0x03;
4913+
}
49094914
#endif
49104915

4911-
cmd.skip = htole16(params->skip);
4912-
cmd.sync_timeout = htole16(params->sync_timeout);
4916+
cmd.skip = htole16(params->skip);
4917+
cmd.sync_timeout = htole16(params->sync_timeout);
4918+
}
49134919

49144920
rc = ble_hs_hci_cmd_tx(opcode, &cmd, sizeof(cmd), &rsp, sizeof(rsp));
49154921
if (!rc) {

0 commit comments

Comments
 (0)