Skip to content

fix: add static_assert for BLE structs and [[nodiscard]] to methods#65

Closed
gdellis wants to merge 1 commit into
mainfrom
fix/ble-struct-asserts-nodiscard
Closed

fix: add static_assert for BLE structs and [[nodiscard]] to methods#65
gdellis wants to merge 1 commit into
mainfrom
fix/ble-struct-asserts-nodiscard

Conversation

@gdellis
Copy link
Copy Markdown
Owner

@gdellis gdellis commented Apr 19, 2026

Summary

Address issues #61 and #62:

  • Add static_assert to verify BLE struct sizes at compile time
  • Add [[nodiscard]] to all esp_err_t returning methods to catch ignored errors at compile time
  • Fix state_machine.cpp to use ESP_ERROR_CHECK on ble_.send_alert() call (required after adding [[nodiscard]])

Changes

firmware/main/ble.hpp:

  • Add #pragma pack(push, 1) and static_assert for BleLocationData (17 bytes) and BleAlertData (18 bytes)
  • Add [[nodiscard]] to: init(), start(), stop(), update_location(), send_alert(), set_device_name()

firmware/main/state_machine.cpp:

  • Use ESP_ERROR_CHECK on ble_.send_alert() in geofence breach handling

Testing

  • Build passes for ESP32-S3
  • Host tests pass

Closes #61, #62

- Add static_assert to verify BLE struct sizes (17 bytes for BleLocationData, 18 for BleAlertData)
- Add [[nodiscard]] to all esp_err_t returning methods to catch ignored errors at compile time
- Fix state_machine.cpp to use ESP_ERROR_CHECK on ble_.send_alert() call

Closes #61, #62
@gdellis
Copy link
Copy Markdown
Owner Author

gdellis commented Apr 19, 2026

The changes this PR intended to add (static_assert for BLE structs and [[nodiscard]] on esp_err_t methods) were already merged via PR #52.

The branch has been rebased onto current main and no additional changes are needed. Closing as duplicate.

@gdellis gdellis closed this Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancement: Add static_assert for BLE struct sizes

1 participant