From 07f74cee63d77882191c8ce53c598f91e6159ba8 Mon Sep 17 00:00:00 2001 From: JF Date: Mon, 1 Jun 2020 16:30:24 +0200 Subject: DFU : add timeout detection : abort dfu procedure after 10s without any data from the host. --- src/Components/Ble/DfuService.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Components/Ble/DfuService.h') diff --git a/src/Components/Ble/DfuService.h b/src/Components/Ble/DfuService.h index 3de17f9f..73846c86 100644 --- a/src/Components/Ble/DfuService.h +++ b/src/Components/Ble/DfuService.h @@ -26,6 +26,9 @@ namespace Pinetime { int OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context); void OnNotificationTimer(); + void OnTimeout(); + + void Reset(); private: Pinetime::System::SystemTask &systemTask; @@ -125,11 +128,9 @@ namespace Pinetime { uint16_t ComputeCrc(uint8_t const *p_data, uint32_t size, uint16_t const *p_crc); - bool firstCrc = true; - uint16_t tempCrc = 0; - void WriteMagicNumber(); TimerHandle_t notificationTimer; + TimerHandle_t timeoutTimer; uint16_t notificatonConnectionHandle = 0; size_t notificationSize = 0; -- cgit v1.2.3-70-g09d2