Minor temporary patch to allow DFU packet callback

Fork of BLE_API by Bluetooth Low Energy

Committer:
Rohit Grover
Date:
Tue Sep 30 01:03:56 2014 +0100
Revision:
122:4b68a819ab4f
Parent:
121:035516234a33
Child:
260:ea7f9f14cc15
DFUService object needs to remain alive after ble.init(); declaring as static.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rohit Grover 121:035516234a33 1 /* mbed Microcontroller Library
Rohit Grover 121:035516234a33 2 * Copyright (c) 2006-2013 ARM Limited
Rohit Grover 121:035516234a33 3 *
Rohit Grover 121:035516234a33 4 * Licensed under the Apache License, Version 2.0 (the "License");
Rohit Grover 121:035516234a33 5 * you may not use this file except in compliance with the License.
Rohit Grover 121:035516234a33 6 * You may obtain a copy of the License at
Rohit Grover 121:035516234a33 7 *
Rohit Grover 121:035516234a33 8 * http://www.apache.org/licenses/LICENSE-2.0
Rohit Grover 121:035516234a33 9 *
Rohit Grover 121:035516234a33 10 * Unless required by applicable law or agreed to in writing, software
Rohit Grover 121:035516234a33 11 * distributed under the License is distributed on an "AS IS" BASIS,
Rohit Grover 121:035516234a33 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Rohit Grover 121:035516234a33 13 * See the License for the specific language governing permissions and
Rohit Grover 121:035516234a33 14 * limitations under the License.
Rohit Grover 121:035516234a33 15 */
Rohit Grover 121:035516234a33 16
Rohit Grover 121:035516234a33 17 #include "BLEDevice.h"
Rohit Grover 121:035516234a33 18
Rohit Grover 121:035516234a33 19 #if defined(TARGET_OTA_ENABLED)
Rohit Grover 121:035516234a33 20 #include "DFUService.h"
Rohit Grover 121:035516234a33 21 #endif
Rohit Grover 121:035516234a33 22
Rohit Grover 121:035516234a33 23 ble_error_t
Rohit Grover 121:035516234a33 24 BLEDevice::init()
Rohit Grover 121:035516234a33 25 {
Rohit Grover 121:035516234a33 26 ble_error_t err = transport->init();
Rohit Grover 121:035516234a33 27 if (err != BLE_ERROR_NONE) {
Rohit Grover 121:035516234a33 28 return err;
Rohit Grover 121:035516234a33 29 }
Rohit Grover 121:035516234a33 30
Rohit Grover 121:035516234a33 31 /* Platforms enabled for DFU should introduce the DFU Service into
Rohit Grover 121:035516234a33 32 * applications automatically. */
Rohit Grover 121:035516234a33 33 #if defined(TARGET_OTA_ENABLED)
Rohit Grover 122:4b68a819ab4f 34 static DFUService dfu(*this); // defined static so that the object remains alive
Rohit Grover 121:035516234a33 35 #endif // TARGET_OTA_ENABLED
Rohit Grover 121:035516234a33 36
Rohit Grover 121:035516234a33 37 return BLE_ERROR_NONE;
Rohit Grover 121:035516234a33 38 }