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.
service.h
00001 /* 00002 * Made by Jurica @ aconno 00003 * All rights reserved 00004 * 00005 */ 00006 00007 #ifndef SERVICE_H 00008 #define SERVICE_H 00009 00010 #define TIMESTAMP_SIZE_B (6) 00011 00012 static const uint16_t SERVICE_UUID = 0xA3B6; 00013 static const uint16_t NTP_CHARACTERISTIC_UUID = 0x33CC; 00014 00015 class Service{ 00016 public: 00017 Service(BLEDevice &ble) : ble(ble), time(NTP_CHARACTERISTIC_UUID, 0){ 00018 // Add characteristics to the table 00019 GattCharacteristic *characteristics[] = {&time}; 00020 GattService service(SERVICE_UUID, characteristics, 00021 sizeof(characteristics)/sizeof(*characteristics)); 00022 ble.addService(service); // Add service in the BLE 00023 } 00024 inline GattAttribute::Handle_t getTimeCharacteristicHandle() 00025 { 00026 return time.getValueHandle(); 00027 } 00028 private: 00029 BLEDevice &ble; 00030 // New characteristics names time 00031 WriteOnlyArrayGattCharacteristic<uint8_t, TIMESTAMP_SIZE_B> time; 00032 }; 00033 #endif
Generated on Tue Aug 23 2022 10:29:07 by
1.7.2