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: CM3592
Fork of MtConnect04S_MtSense05 by
EnvironmentalUVService.h
00001 #ifndef ENVIRONMENTALUVSERVICE_H 00002 #define ENVIRONMENTALUVSERVICE_H 00003 00004 #include "ble/BLE.h" 00005 00006 class EnvironmentUVService { 00007 public: 00008 00009 typedef int UVType_t; 00010 EnvironmentUVService(BLE& _ble) : 00011 ble(_ble), 00012 uvCharacteristic(0x2A76, &uv ) { 00013 00014 static bool serviceAdded = false; /* We should only ever need to add the information service once. */ 00015 if (serviceAdded) { 00016 return; 00017 } 00018 00019 GattCharacteristic *charTable[] = { &uvCharacteristic }; 00020 00021 GattService environmentalService(GattService::UUID_ENVIRONMENTAL_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); 00022 00023 ble.gattServer().addService(environmentalService); 00024 serviceAdded = true; 00025 } 00026 00027 void updateTemperature(int uvIndex) { 00028 uv = (UVType_t) uvIndex; 00029 ble.gattServer().write(uvCharacteristic.getValueHandle(), (uint8_t *) &uv, sizeof(UVType_t)); 00030 } 00031 00032 private: 00033 00034 BLE& ble; 00035 UVType_t uv; 00036 ReadOnlyGattCharacteristic<UVType_t> uvCharacteristic; 00037 }; 00038 00039 00040 #endif
Generated on Mon Aug 1 2022 08:00:44 by
1.7.2
