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:
Tue Aug 26 05:04:24 2014 +0000
Revision:
37:07487777d9c6
Parent:
33:96724af256a5
Child:
45:1fff7d7d5ce7
add compatibility for BLE API version 108.

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_GATT_SERVER_H__
mridup 2:a2b623661316 18 #define __BLUENRG_GATT_SERVER_H__
mridup 2:a2b623661316 19
mridup 2:a2b623661316 20 #include "mbed.h"
mridup 13:4c30346287e4 21 #include "blecommon.h"
mridup 5:31dedfa19a12 22 #include "btle.h"
mridup 2:a2b623661316 23 #include "GattService.h"
hemddabral 33:96724af256a5 24 #include "public/GattServer.h"
mridup 2:a2b623661316 25
mridup 2:a2b623661316 26 #define BLE_TOTAL_CHARACTERISTICS 10
mridup 2:a2b623661316 27
mridup 2:a2b623661316 28 class BlueNRGGattServer : public GattServer
mridup 2:a2b623661316 29 {
mridup 2:a2b623661316 30 public:
mridup 2:a2b623661316 31 static BlueNRGGattServer &getInstance() {
mridup 2:a2b623661316 32 static BlueNRGGattServer m_instance;
mridup 2:a2b623661316 33 return m_instance;
mridup 2:a2b623661316 34 }
mridup 2:a2b623661316 35
mridup 2:a2b623661316 36 /* Functions that must be implemented from GattServer */
mridup 2:a2b623661316 37 virtual ble_error_t addService(GattService &);
mridup 2:a2b623661316 38 virtual ble_error_t readValue(uint16_t handle, uint8_t buffer[], uint16_t *const lengthP);
mridup 2:a2b623661316 39 virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t, bool localOnly = false);
hemddabral 37:07487777d9c6 40 virtual ble_error_t setDeviceName(const uint8_t *deviceName);
hemddabral 37:07487777d9c6 41 virtual ble_error_t getDeviceName(uint8_t *deviceName, unsigned *lengthP);
hemddabral 37:07487777d9c6 42 virtual ble_error_t setAppearance(uint16_t appearance);
hemddabral 37:07487777d9c6 43 virtual ble_error_t getAppearance(uint16_t *appearanceP);
mridup 2:a2b623661316 44
mridup 6:08cfc94b5f49 45 /* BlueNRG Functions */
mridup 2:a2b623661316 46 void eventCallback(void);
mridup 6:08cfc94b5f49 47 //void hwCallback(void *pckt);
mridup 26:047d45ea379e 48 ble_error_t Read_Request_CB(tHalUint16 handle);
mridup 27:b4c21a9e8b39 49 GattCharacteristic* getCharacteristicFromHandle(tHalUint16 charHandle);
mridup 27:b4c21a9e8b39 50
mridup 2:a2b623661316 51 private:
mridup 2:a2b623661316 52
mridup 2:a2b623661316 53 uint8_t serviceCount;
mridup 2:a2b623661316 54 uint8_t characteristicCount;
mridup 5:31dedfa19a12 55 tHalUint16 hrmServHandle, hrmCharHandle;
mridup 2:a2b623661316 56
mridup 2:a2b623661316 57 GattCharacteristic *p_characteristics[BLE_TOTAL_CHARACTERISTICS];
mridup 7:55ac052585db 58 tHalUint16 bleCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS];
mridup 27:b4c21a9e8b39 59
mridup 27:b4c21a9e8b39 60
mridup 2:a2b623661316 61 BlueNRGGattServer() {
mridup 2:a2b623661316 62 serviceCount = 0;
mridup 2:a2b623661316 63 characteristicCount = 0;
mridup 2:a2b623661316 64 };
mridup 2:a2b623661316 65
mridup 2:a2b623661316 66 BlueNRGGattServer(BlueNRGGattServer const &);
mridup 2:a2b623661316 67 void operator=(BlueNRGGattServer const &);
mridup 2:a2b623661316 68 };
mridup 2:a2b623661316 69
mridup 2:a2b623661316 70 #endif