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:
mridup
Date:
Mon Jul 21 14:10:22 2014 +0000
Revision:
3:9c4c13795643
Parent:
2:a2b623661316
Child:
32:d1f250acad29
Advertising working with setAdvertisingData (DEVICE NAME). Hard-coded implementation.

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"
mridup 2:a2b623661316 25 #include "hw/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);
mridup 2:a2b623661316 51
mridup 2:a2b623661316 52 void setConnectionHandle(uint16_t con_handle);
mridup 2:a2b623661316 53 uint16_t getConnectionHandle(void);
mridup 2:a2b623661316 54
mridup 2:a2b623661316 55 private:
mridup 2:a2b623661316 56 uint16_t m_connectionHandle;
mridup 2:a2b623661316 57 tBleStatus ret;
mridup 2:a2b623661316 58
mridup 2:a2b623661316 59 //const char local_name[];// = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
mridup 3:9c4c13795643 60 //Local Variables
mridup 3:9c4c13795643 61 //uint8_t *device_name;
mridup 2:a2b623661316 62 BlueNRGGap() {
mridup 2:a2b623661316 63 m_connectionHandle = BLE_CONN_HANDLE_INVALID;
mridup 2:a2b623661316 64 //local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G'};
mridup 3:9c4c13795643 65
mridup 2:a2b623661316 66 }
mridup 2:a2b623661316 67
mridup 2:a2b623661316 68 BlueNRGGap(BlueNRGGap const &);
mridup 2:a2b623661316 69 void operator=(BlueNRGGap const &);
mridup 2:a2b623661316 70 };
mridup 2:a2b623661316 71
mridup 2:a2b623661316 72 #endif // ifndef __BLUENRG_GAP_H__