Skip to content

Commit

Permalink
✨ (BLEKit): BLEServiceMonitoring - add negociated_mtu characteristic
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed May 14, 2024
1 parent 1faeba9 commit 582709b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
24 changes: 19 additions & 5 deletions libs/BLEKit/include/BLEServiceMonitoring.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ class BLEServiceMonitoring : public interface::BLEService
sendData(data);
}

void setNegotiatedMtu(uint8_t value)
{
_negociated_mtu = value;

auto data = std::make_tuple(_negociated_mtu_characteristic.getValueHandle(), std::span(&_negociated_mtu, 1));

sendData(data);
}

auto isScreensaverEnable() const -> bool { return _screensaver_enable; }

void onDataReceived(const data_received_handle_t &params) final
Expand Down Expand Up @@ -85,11 +94,16 @@ class BLEServiceMonitoring : public interface::BLEService
&_hard_reboot,
};

std::array<GattCharacteristic *, 4> _characteristic_table {
&_charging_status_characteristic,
&_screensaver_enable_characteristic,
&_soft_reboot_characteristic,
&_hard_reboot_characteristic,
uint8_t _negociated_mtu {0x00};
ReadOnlyGattCharacteristic<uint8_t> _negociated_mtu_characteristic {
service::monitoring::characteristic::charging_status,
&_negociated_mtu,
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY,
};

std::array<GattCharacteristic *, 5> _characteristic_table {
&_charging_status_characteristic, &_screensaver_enable_characteristic, &_soft_reboot_characteristic,
&_hard_reboot_characteristic, &_negociated_mtu_characteristic,
};
};

Expand Down
1 change: 1 addition & 0 deletions libs/BLEKit/include/internal/ServicesCharacteristics.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace monitoring {
inline constexpr uint16_t screensaver_enable = 0x8369;
inline constexpr uint16_t soft_reboot = 0x8382;
inline constexpr uint16_t hard_reboot = 0x7282;
inline constexpr uint16_t negociated_mtu = 0x7784;
} // namespace characteristic

} // namespace monitoring
Expand Down

0 comments on commit 582709b

Please sign in to comment.