Bike service

Fork of BLE_API by Bluetooth Low Energy

Revision:
1053:ec4a5b9b254e
Parent:
1052:b55e1ad3e1b3
--- a/ble/services/DFUService.h	Mon Jan 11 08:51:31 2016 +0000
+++ b/ble/services/DFUService.h	Mon Jan 11 08:51:32 2016 +0000
@@ -14,13 +14,17 @@
  * limitations under the License.
  */
 
+#ifdef TARGET_NRF51822 /* DFU only supported on nrf51 platforms */
+
 #ifndef __BLE_DFU_SERVICE_H__
 #define __BLE_DFU_SERVICE_H__
 
 #include "ble/BLE.h"
 #include "ble/UUID.h"
 
-extern "C" void bootloader_start(void);
+extern "C" {
+#include "dfu_app_handler.h"
+}
 
 extern const uint8_t  DFUServiceBaseUUID[];
 extern const uint16_t DFUServiceShortUUID;
@@ -101,7 +105,15 @@
                 handoverCallback();
             }
 
-            bootloader_start();
+            // Call bootloader_start implicitly trough a event handler call
+            // it is a work around for bootloader_start not being public in sdk 8.1
+            ble_dfu_t p_dfu;
+            ble_dfu_evt_t p_evt;
+
+            p_dfu.conn_handle = params->connHandle;
+            p_evt.ble_dfu_evt_type = BLE_DFU_START;
+
+            dfu_app_on_dfu_evt(&p_dfu, &p_evt);
         }
     }
 
@@ -130,4 +142,5 @@
     static ResetPrepare_t handoverCallback;  /**< Application-specific handover callback. */
 };
 
-#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
\ No newline at end of file
+#endif /* #ifndef __BLE_DFU_SERVICE_H__*/
+#endif /* #ifdef TARGET_NRF51822 */
\ No newline at end of file