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:
Tue Aug 19 08:43:19 2014 +0000
Revision:
26:047d45ea379e
Parent:
13:4c30346287e4
Child:
27:b4c21a9e8b39
Allowing Read Request from Gatt Server

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"
mridup 2:a2b623661316 24 #include "hw/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);
mridup 2:a2b623661316 40
mridup 6:08cfc94b5f49 41 /* BlueNRG Functions */
mridup 2:a2b623661316 42 void eventCallback(void);
mridup 6:08cfc94b5f49 43 //void hwCallback(void *pckt);
mridup 26:047d45ea379e 44 ble_error_t Read_Request_CB(tHalUint16 handle);
mridup 2:a2b623661316 45
mridup 2:a2b623661316 46 private:
mridup 2:a2b623661316 47
mridup 2:a2b623661316 48 uint8_t serviceCount;
mridup 2:a2b623661316 49 uint8_t characteristicCount;
mridup 5:31dedfa19a12 50 tHalUint16 hrmServHandle, hrmCharHandle;
mridup 2:a2b623661316 51
mridup 2:a2b623661316 52 GattCharacteristic *p_characteristics[BLE_TOTAL_CHARACTERISTICS];
mridup 7:55ac052585db 53 tHalUint16 bleCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS];
mridup 2:a2b623661316 54
mridup 2:a2b623661316 55 BlueNRGGattServer() {
mridup 2:a2b623661316 56 serviceCount = 0;
mridup 2:a2b623661316 57 characteristicCount = 0;
mridup 2:a2b623661316 58 };
mridup 2:a2b623661316 59
mridup 2:a2b623661316 60 BlueNRGGattServer(BlueNRGGattServer const &);
mridup 2:a2b623661316 61 void operator=(BlueNRGGattServer const &);
mridup 2:a2b623661316 62 };
mridup 2:a2b623661316 63
mridup 2:a2b623661316 64 #endif