HW layer for the Nucleo board, it only work with old BLE_API

Dependents:   Hello_BLE F446RE-BLE

Fork of X_NUCLEO_IDB0XA1 by ST

Committer:
hemddabral
Date:
Mon Aug 25 11:56:52 2014 +0000
Revision:
33:96724af256a5
Parent:
32:d1f250acad29
Child:
41:95b8d531628c
Added compatibility for BLE_API version 106

Who changed what in which revision?

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