diff options
| author | Adam Pigg <adam@piggz.co.uk> | 2020-04-28 17:39:26 (GMT) |
|---|---|---|
| committer | Adam Pigg <adam@piggz.co.uk> | 2020-05-05 19:58:15 (GMT) |
| commit | d33be52bc9cec10e530e1390f1cf812c12cd830e (patch) | |
| tree | 9e986f32a31154090316abba81cee8a182cf711d /src/Components/Ble/PinetimeService.cpp | |
| parent | 49a9a93ceffac325b008bc9fbfc41d571fa7e110 (diff) | |
Run the alert notification service and simplify trhe pinetime service
initialization
Diffstat (limited to 'src/Components/Ble/PinetimeService.cpp')
| -rw-r--r-- | src/Components/Ble/PinetimeService.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/Components/Ble/PinetimeService.cpp b/src/Components/Ble/PinetimeService.cpp index 5bcb36d..e18d78a 100644 --- a/src/Components/Ble/PinetimeService.cpp +++ b/src/Components/Ble/PinetimeService.cpp @@ -24,22 +24,21 @@ int PinetimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, NRF_LOG_INFO("Setting time..."); if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { - if (m_dateTimeController) { - CtsData result; - os_mbuf_copydata(ctxt->om, 0, sizeof(CtsData), &result); + CtsData result; + os_mbuf_copydata(ctxt->om, 0, sizeof(CtsData), &result); - NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", result.year, - result.month, result.dayofmonth, - result.hour, result.minute, result.second); + NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", result.year, + result.month, result.dayofmonth, + result.hour, result.minute, result.second); + + m_dateTimeController.SetTime(result.year, result.month, result.dayofmonth, + 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG)); - m_dateTimeController->SetTime(result.year, result.month, result.dayofmonth, - 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG)); - } } return 0; } -PinetimeService::PinetimeService() : +PinetimeService::PinetimeService(DateTime &dateTimeController) : m_dateTimeController{dateTimeController}, characteristicDefinition{ { .uuid = (ble_uuid_t *) &timeUuid, @@ -67,7 +66,3 @@ PinetimeService::PinetimeService() : } -void PinetimeService::setDateTimeController(DateTime *dateTimeController) -{ - m_dateTimeController = dateTimeController; -} |
