Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added BTHome advertising field "packet id" for deduplication #211

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/nrf-connect/samples/ble/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ config PRST_BLE_ENCODING_SERVICE_DATA_LEN
Size of the service data buffer.
default 20 if PRST_BLE_ENCODING_BPARASITE_V2
default 18 if PRST_BLE_ENCODING_BTHOME_V1
default 19 if PRST_BLE_ENCODING_BTHOME_V2
default 21 if PRST_BLE_ENCODING_BTHOME_V2


config PRST_BLE_HAS_USER_DEFINED_RANDOM_STATIC_ADDR
Expand Down
5 changes: 5 additions & 0 deletions code/nrf-connect/samples/ble/src/encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ int prst_ble_encode_service_data(const prst_sensors_t* sensors,
uint8_t batt_percentage_val = 100 * sensors->batt.percentage + 0.5f;
out[18] = batt_percentage_val;

// Misc packet-id
static uint8_t run_counter;
out[19] = 0x00;
out[20] = run_counter++ & 0xFF;

#endif // Encoding protocols

LOG_HEXDUMP_DBG(out, out_len, "Encoded BLE adv: ");
Expand Down
Loading