Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Fork of SensorModulePIR by
HumidityMeasureService.h
00001 #ifndef __BLE_HUMIDITY_MEASURE_SERVICE_H__ 00002 #define __BLE_HUMIDITY_MEASURE_SERVICE_H__ 00003 00004 class HumidityMeasureService { 00005 public: 00006 const static uint16_t HUMIDITY_MEASURE_SERVICE_UUID = 0xA004; 00007 const static uint16_t HUMIDITY_CHARACTERISTIC_UUID = 0xA005; 00008 00009 HumidityMeasureService(BLEDevice &_ble, float humidity) : 00010 ble(_ble), 00011 humidityValue(HUMIDITY_CHARACTERISTIC_UUID, &humidity, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ) 00012 { 00013 GattCharacteristic *charTable[] = {&humidityValue}; 00014 GattService getHumidityService(HUMIDITY_MEASURE_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); 00015 ble.addService(getHumidityService); 00016 } 00017 00018 GattAttribute::Handle_t getValueHandle() const { 00019 return humidityValue.getValueHandle(); 00020 } 00021 00022 void updateHumidity(uint8_t newHum) { 00023 ble.gattServer().write(humidityValue.getValueHandle(), &newHum, 1); 00024 } 00025 00026 public: 00027 BLEDevice &ble; 00028 ReadWriteGattCharacteristic<float> humidityValue; 00029 }; 00030 00031 #endif /* #ifndef __BLE_HUMIDITY_MEASURE_SERVICE_H__ */
Generated on Wed Jul 20 2022 20:14:52 by
1.7.2
