BLE_API for nRF51
Fork of BLE_API by
source/BLE.cpp@808:f902b7ca06a6, 2015-09-29 (annotated)
- Committer:
- rgrover1
- Date:
- Tue Sep 29 09:47:52 2015 +0100
- Revision:
- 808:f902b7ca06a6
- Parent:
- 807:d119f9333581
- Child:
- 809:18a6423afee6
Synchronized with git rev ce482107
Author: Rohit Grover
handle the case of a NULL transport pointer for BLE.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 712:b04b5db36865 | 1 | /* mbed Microcontroller Library |
rgrover1 | 712:b04b5db36865 | 2 | * Copyright (c) 2006-2013 ARM Limited |
rgrover1 | 712:b04b5db36865 | 3 | * |
rgrover1 | 712:b04b5db36865 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rgrover1 | 712:b04b5db36865 | 5 | * you may not use this file except in compliance with the License. |
rgrover1 | 712:b04b5db36865 | 6 | * You may obtain a copy of the License at |
rgrover1 | 712:b04b5db36865 | 7 | * |
rgrover1 | 712:b04b5db36865 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rgrover1 | 712:b04b5db36865 | 9 | * |
rgrover1 | 712:b04b5db36865 | 10 | * Unless required by applicable law or agreed to in writing, software |
rgrover1 | 712:b04b5db36865 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rgrover1 | 712:b04b5db36865 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rgrover1 | 712:b04b5db36865 | 13 | * See the License for the specific language governing permissions and |
rgrover1 | 712:b04b5db36865 | 14 | * limitations under the License. |
rgrover1 | 712:b04b5db36865 | 15 | */ |
rgrover1 | 712:b04b5db36865 | 16 | |
rgrover1 | 712:b04b5db36865 | 17 | #include "ble/BLE.h" |
rgrover1 | 712:b04b5db36865 | 18 | |
rgrover1 | 712:b04b5db36865 | 19 | #if defined(TARGET_OTA_ENABLED) |
rgrover1 | 732:916f36dd93f8 | 20 | #include "ble/services/DFUService.h" |
rgrover1 | 712:b04b5db36865 | 21 | #endif |
rgrover1 | 712:b04b5db36865 | 22 | |
rgrover1 | 712:b04b5db36865 | 23 | ble_error_t |
rgrover1 | 712:b04b5db36865 | 24 | BLE::init() |
rgrover1 | 712:b04b5db36865 | 25 | { |
rgrover1 | 712:b04b5db36865 | 26 | ble_error_t err = transport->init(); |
rgrover1 | 712:b04b5db36865 | 27 | if (err != BLE_ERROR_NONE) { |
rgrover1 | 712:b04b5db36865 | 28 | return err; |
rgrover1 | 712:b04b5db36865 | 29 | } |
rgrover1 | 712:b04b5db36865 | 30 | |
rgrover1 | 712:b04b5db36865 | 31 | /* Platforms enabled for DFU should introduce the DFU Service into |
rgrover1 | 712:b04b5db36865 | 32 | * applications automatically. */ |
rgrover1 | 712:b04b5db36865 | 33 | #if defined(TARGET_OTA_ENABLED) |
rgrover1 | 712:b04b5db36865 | 34 | static DFUService dfu(*this); // defined static so that the object remains alive |
rgrover1 | 712:b04b5db36865 | 35 | #endif // TARGET_OTA_ENABLED |
rgrover1 | 712:b04b5db36865 | 36 | |
rgrover1 | 712:b04b5db36865 | 37 | return BLE_ERROR_NONE; |
rgrover1 | 712:b04b5db36865 | 38 | } |