diff options
| author | JF <jf@codingfield.com> | 2020-03-25 20:23:40 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-03-25 20:23:40 (GMT) |
| commit | 68240704c7a60534342cfc0157564f11cf82d9d8 (patch) | |
| tree | 8472af61a5fa8a99ce5549f2de73b47f73cf41b6 /src/main.cpp | |
| parent | 7e9a7e4d5fa0f55b43180600d499f1d0ce6aded1 (diff) | |
Add support for BLE notification (ANS client).
Work In Progress!!!
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 25a8a6c..a4a759d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,6 +85,11 @@ void OnBleDisconnection() { bleController.Disconnect(); } +void OnNewNotification(const char* message, uint8_t size) { + bleController.PushNotification(message, size); + systemTask->PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); +} + void OnNewTime(current_time_char_t* currentTime) { auto dayOfWeek = currentTime->exact_time_256.day_date_time.day_of_week; auto year = currentTime->exact_time_256.day_date_time.date_time.year; @@ -96,6 +101,8 @@ void OnNewTime(current_time_char_t* currentTime) { dateTimeController.SetTime(year, month, day, dayOfWeek, hour, minute, second, nrf_rtc_counter_get(portNRF_RTC_REG)); + + systemTask->PushMessage(Pinetime::System::SystemTask::Messages::OnNewTime); } void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { @@ -128,6 +135,7 @@ int main(void) { ble_manager_set_new_time_callback(OnNewTime); ble_manager_set_ble_connection_callback(OnBleConnection); ble_manager_set_ble_disconnection_callback(OnBleDisconnection); + ble_manager_set_new_notification_callback(OnNewNotification); vTaskStartScheduler(); |
