Updated to latest online libraries (See also mbed Apps: HelloBlue, FOTA4)

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_Default_APP by Yihui Xiong

Committer:
yihui
Date:
Fri Oct 10 03:36:28 2014 +0000
Revision:
1:a607cd9655d7
use NVIC_SystemReset() to run bootloader

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 1:a607cd9655d7 1 /* mbed Microcontroller Library
yihui 1:a607cd9655d7 2 * Copyright (c) 2006-2013 ARM Limited
yihui 1:a607cd9655d7 3 *
yihui 1:a607cd9655d7 4 * Licensed under the Apache License, Version 2.0 (the "License");
yihui 1:a607cd9655d7 5 * you may not use this file except in compliance with the License.
yihui 1:a607cd9655d7 6 * You may obtain a copy of the License at
yihui 1:a607cd9655d7 7 *
yihui 1:a607cd9655d7 8 * http://www.apache.org/licenses/LICENSE-2.0
yihui 1:a607cd9655d7 9 *
yihui 1:a607cd9655d7 10 * Unless required by applicable law or agreed to in writing, software
yihui 1:a607cd9655d7 11 * distributed under the License is distributed on an "AS IS" BASIS,
yihui 1:a607cd9655d7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
yihui 1:a607cd9655d7 13 * See the License for the specific language governing permissions and
yihui 1:a607cd9655d7 14 * limitations under the License.
yihui 1:a607cd9655d7 15 */
yihui 1:a607cd9655d7 16
yihui 1:a607cd9655d7 17 #ifndef __NRF51822_GAP_H__
yihui 1:a607cd9655d7 18 #define __NRF51822_GAP_H__
yihui 1:a607cd9655d7 19
yihui 1:a607cd9655d7 20 #include "mbed.h"
yihui 1:a607cd9655d7 21 #include "blecommon.h"
yihui 1:a607cd9655d7 22 #include "ble.h"
yihui 1:a607cd9655d7 23 #include "GapAdvertisingParams.h"
yihui 1:a607cd9655d7 24 #include "GapAdvertisingData.h"
yihui 1:a607cd9655d7 25 #include "public/Gap.h"
yihui 1:a607cd9655d7 26
yihui 1:a607cd9655d7 27 /**************************************************************************/
yihui 1:a607cd9655d7 28 /*!
yihui 1:a607cd9655d7 29 \brief
yihui 1:a607cd9655d7 30
yihui 1:a607cd9655d7 31 */
yihui 1:a607cd9655d7 32 /**************************************************************************/
yihui 1:a607cd9655d7 33 class nRF51Gap : public Gap
yihui 1:a607cd9655d7 34 {
yihui 1:a607cd9655d7 35 public:
yihui 1:a607cd9655d7 36 static nRF51Gap &getInstance() {
yihui 1:a607cd9655d7 37 static nRF51Gap m_instance;
yihui 1:a607cd9655d7 38 return m_instance;
yihui 1:a607cd9655d7 39 }
yihui 1:a607cd9655d7 40
yihui 1:a607cd9655d7 41 /* Functions that must be implemented from Gap */
yihui 1:a607cd9655d7 42 virtual ble_error_t setAddress(addr_type_t type,
yihui 1:a607cd9655d7 43 const uint8_t address[6]);
yihui 1:a607cd9655d7 44 virtual ble_error_t setAdvertisingData(const GapAdvertisingData &,
yihui 1:a607cd9655d7 45 const GapAdvertisingData &);
yihui 1:a607cd9655d7 46 virtual ble_error_t startAdvertising(const GapAdvertisingParams &);
yihui 1:a607cd9655d7 47 virtual ble_error_t stopAdvertising(void);
yihui 1:a607cd9655d7 48 virtual ble_error_t disconnect(DisconnectionReason_t reason);
yihui 1:a607cd9655d7 49
yihui 1:a607cd9655d7 50 virtual ble_error_t setDeviceName(const uint8_t *deviceName);
yihui 1:a607cd9655d7 51 virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
yihui 1:a607cd9655d7 52 virtual ble_error_t setAppearance(uint16_t appearance);
yihui 1:a607cd9655d7 53 virtual ble_error_t getAppearance(uint16_t *appearanceP);
yihui 1:a607cd9655d7 54
yihui 1:a607cd9655d7 55 void setConnectionHandle(uint16_t con_handle);
yihui 1:a607cd9655d7 56 uint16_t getConnectionHandle(void);
yihui 1:a607cd9655d7 57
yihui 1:a607cd9655d7 58 virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params);
yihui 1:a607cd9655d7 59 virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params);
yihui 1:a607cd9655d7 60 virtual ble_error_t updateConnectionParams(Handle_t handle, const ConnectionParams_t *params);
yihui 1:a607cd9655d7 61
yihui 1:a607cd9655d7 62 private:
yihui 1:a607cd9655d7 63 uint16_t m_connectionHandle;
yihui 1:a607cd9655d7 64 nRF51Gap() {
yihui 1:a607cd9655d7 65 m_connectionHandle = BLE_CONN_HANDLE_INVALID;
yihui 1:a607cd9655d7 66 }
yihui 1:a607cd9655d7 67
yihui 1:a607cd9655d7 68 nRF51Gap(nRF51Gap const &);
yihui 1:a607cd9655d7 69 void operator=(nRF51Gap const &);
yihui 1:a607cd9655d7 70 };
yihui 1:a607cd9655d7 71
yihui 1:a607cd9655d7 72 #endif // ifndef __NRF51822_GAP_H__