Auto updating alarm watch - accepts alarm settings from a BLE device like a Raspberry Pi and buzzes at the appropriate time - also displays binary time

Dependencies:   BLE_API mbed-src nRF51822 nrf51_rtc

Revision:
5:2682353a8c32
Parent:
3:a4b8d67de1b1
Child:
6:4a12e0f03381
--- a/WatchTimeService.h	Mon Jul 27 19:30:11 2015 +0000
+++ b/WatchTimeService.h	Mon Dec 14 22:58:31 2015 +0000
@@ -4,6 +4,8 @@
 #ifndef __BLE_WATCHTIME_SERVICE_H__
 #define __BLE_WATCHTIME_SERVICE_H__
 
+//typedef void (*GetCurTimeCallbackFn)(uint8_t* curWatchTime)
+
 class WatchTimeService {
 public:
 
@@ -11,26 +13,29 @@
     const static uint16_t WATCHTIME_SERVICE_UUID              = 0xFE32;
     const static uint16_t WATCHTIME_STATE_CHARACTERISTIC_UUID = 0xFE33;
 
-    WatchTimeService(BLE &_ble, uint8_t* pInitialWatchTime) :
-        ble(_ble), watchTimeVal(WATCHTIME_STATE_CHARACTERISTIC_UUID, pInitialWatchTime, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
+    WatchTimeService(BLE &ble, uint8_t* pInitialWatchTime) :
+        _ble(ble), 
+        _watchTimeVal(WATCHTIME_STATE_CHARACTERISTIC_UUID, pInitialWatchTime, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
     {
-        GattCharacteristic *charTable[] = {&watchTimeVal};
+        GattCharacteristic *charTable[] = {&_watchTimeVal};
         GattService watchTimeService(WatchTimeService::WATCHTIME_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
-        ble.gattServer().addService(watchTimeService);
+        _ble.gattServer().addService(watchTimeService);
     }
 
-    void sendWatchTime(uint8_t* pWatchTime) {
-        ble.gattServer().write(watchTimeVal.getValueHandle(), pWatchTime, WatchTime_BlockSize);
+    void writeWatchTime(uint8_t* pWatchTime)
+    {
+        _ble.gattServer().write(_watchTimeVal.getValueHandle(), pWatchTime, WatchTime_BlockSize);
     }
 
     GattAttribute::Handle_t getValueHandle()
     {
-        return watchTimeVal.getValueHandle();
+        return _watchTimeVal.getValueHandle();
     }
 
 private:
-    BLE &ble;
-    ReadWriteArrayGattCharacteristic<uint8_t, WatchTime_BlockSize> watchTimeVal;
+    BLE &_ble;
+    ReadWriteArrayGattCharacteristic<uint8_t, WatchTime_BlockSize> _watchTimeVal;
+//    GetCurTimeCallbackFn _pGetCurTimeCallback;
 };
 
 #endif /* #ifndef __BLE_WATCHTIME_SERVICE_H__ */