15 explicit BleEnvironmentalDataProvider(UpdateAttributeCallback updateCallback, InvokeCommandCallback commandCallback) : Nrf::BLEBridgedDeviceProvider(updateCallback, commandCallback) {}
19 void NotifyUpdateState(chip::ClusterId clusterId, chip::AttributeId attributeId,
void *data,
20 size_t dataSize)
override;
21 CHIP_ERROR
UpdateState(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t *buffer)
override;
26 static constexpr uint32_t kMeasurementsIntervalMs{ CONFIG_BRIDGE_BLE_DEVICE_POLLING_INTERVAL };
28 void StartHumidityTimer();
29 void StopHumidityTimer() { k_timer_stop(&mHumidityTimer); }
32 bool CheckSubscriptionParameters(bt_gatt_subscribe_params *params);
34 CHIP_ERROR ParseTemperatureCharacteristic(bt_gatt_dm *discoveredData);
35 CHIP_ERROR ParseHumidityCharacteristic(bt_gatt_dm *discoveredData);
37 static uint8_t GattTemperatureNotifyCallback(bt_conn *conn, bt_gatt_subscribe_params *params,
const void *data,
39 static uint8_t GattHumidityNotifyCallback(bt_conn *conn, bt_gatt_subscribe_params *params,
const void *data,
41 static void NotifyTemperatureAttributeChange(intptr_t context);
42 static void NotifyHumidityAttributeChange(intptr_t context);
44 static void ReadGATTHumidity(intptr_t context);
45 static void HumidityTimerTimeoutCallback(k_timer *timer);
46 static uint8_t HumidityGATTReadCallback(bt_conn *conn, uint8_t att_err, bt_gatt_read_params *params,
47 const void *data, uint16_t read_len);
49 uint16_t mTemperatureValue{};
50 uint16_t mHumidityValue{};
52 uint16_t mTemperatureCharacteristicHandle{};
53 uint16_t mHumidityCharacteristicHandle{};
55 bt_gatt_subscribe_params mGattTemperatureSubscribeParams{};
56 bt_gatt_subscribe_params mGattHumiditySubscribeParams{};
58 uint16_t mCccTemperatureHandle{};
59 uint16_t mCccHumidityHandle{};
61 k_timer mHumidityTimer;
63 static bt_gatt_read_params sHumidityReadParams;