CSSE4011_BLE_IMU IMU Seeed Tiny Ble

Dependencies:   BLE_API_Tiny_BLE MPU6050-DMP-Seeed-Tiny-BLE mbed

Committer:
flywind
Date:
Wed Jun 10 12:56:48 2015 +0000
Revision:
2:44bc61abdf33
Parent:
0:f90c3452d779
milestone working one , yaw pitch roll update in BLE sucessfull

Who changed what in which revision?

UserRevisionLine numberNew contents of line
flywind 0:f90c3452d779 1 /* mbed Microcontroller Library
flywind 0:f90c3452d779 2 * Copyright (c) 2006-2013 ARM Limited
flywind 0:f90c3452d779 3 *
flywind 0:f90c3452d779 4 * Licensed under the Apache License, Version 2.0 (the "License");
flywind 0:f90c3452d779 5 * you may not use this file except in compliance with the License.
flywind 0:f90c3452d779 6 * You may obtain a copy of the License at
flywind 0:f90c3452d779 7 *
flywind 0:f90c3452d779 8 * http://www.apache.org/licenses/LICENSE-2.0
flywind 0:f90c3452d779 9 *
flywind 0:f90c3452d779 10 * Unless required by applicable law or agreed to in writing, software
flywind 0:f90c3452d779 11 * distributed under the License is distributed on an "AS IS" BASIS,
flywind 0:f90c3452d779 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
flywind 0:f90c3452d779 13 * See the License for the specific language governing permissions and
flywind 0:f90c3452d779 14 * limitations under the License.
flywind 0:f90c3452d779 15 */
flywind 0:f90c3452d779 16
flywind 0:f90c3452d779 17 #ifndef __NRF51822_GATT_SERVER_H__
flywind 0:f90c3452d779 18 #define __NRF51822_GATT_SERVER_H__
flywind 0:f90c3452d779 19
flywind 0:f90c3452d779 20 #include <stddef.h>
flywind 0:f90c3452d779 21
flywind 0:f90c3452d779 22 #include "blecommon.h"
flywind 0:f90c3452d779 23 #include "ble.h" /* nordic ble */
flywind 0:f90c3452d779 24 #include "GattServer.h"
flywind 0:f90c3452d779 25
flywind 0:f90c3452d779 26 class nRF51GattServer : public GattServer
flywind 0:f90c3452d779 27 {
flywind 0:f90c3452d779 28 public:
flywind 0:f90c3452d779 29 static nRF51GattServer &getInstance() {
flywind 0:f90c3452d779 30 static nRF51GattServer m_instance;
flywind 0:f90c3452d779 31 return m_instance;
flywind 0:f90c3452d779 32 }
flywind 0:f90c3452d779 33
flywind 0:f90c3452d779 34 /* Functions that must be implemented from GattServer */
flywind 0:f90c3452d779 35 virtual ble_error_t addService(GattService &);
flywind 0:f90c3452d779 36 virtual ble_error_t readValue(GattAttribute::Handle_t handle, uint8_t buffer[], uint16_t *const lengthP);
flywind 0:f90c3452d779 37 virtual ble_error_t updateValue(GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly = false);
flywind 0:f90c3452d779 38 virtual ble_error_t initializeGATTDatabase(void);
flywind 0:f90c3452d779 39
flywind 0:f90c3452d779 40 /* nRF51 Functions */
flywind 0:f90c3452d779 41 void eventCallback(void);
flywind 0:f90c3452d779 42 void hwCallback(ble_evt_t *p_ble_evt);
flywind 0:f90c3452d779 43
flywind 0:f90c3452d779 44 private:
flywind 0:f90c3452d779 45 const static unsigned BLE_TOTAL_CHARACTERISTICS = 24;
flywind 0:f90c3452d779 46 const static unsigned BLE_TOTAL_DESCRIPTORS = 24;
flywind 0:f90c3452d779 47
flywind 0:f90c3452d779 48 GattCharacteristic *p_characteristics[BLE_TOTAL_CHARACTERISTICS];
flywind 0:f90c3452d779 49 ble_gatts_char_handles_t nrfCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS];
flywind 0:f90c3452d779 50 GattAttribute *p_descriptors[BLE_TOTAL_DESCRIPTORS];
flywind 0:f90c3452d779 51 uint8_t descriptorCount;
flywind 0:f90c3452d779 52 uint16_t nrfDescriptorHandles[BLE_TOTAL_DESCRIPTORS];
flywind 0:f90c3452d779 53
flywind 0:f90c3452d779 54 nRF51GattServer() : GattServer(), p_characteristics(), nrfCharacteristicHandles(), p_descriptors(), descriptorCount(0), nrfDescriptorHandles() {
flywind 0:f90c3452d779 55 /* empty */
flywind 0:f90c3452d779 56 }
flywind 0:f90c3452d779 57
flywind 0:f90c3452d779 58 private:
flywind 0:f90c3452d779 59 nRF51GattServer(const nRF51GattServer &);
flywind 0:f90c3452d779 60 const nRF51GattServer& operator=(const nRF51GattServer &);
flywind 0:f90c3452d779 61 };
flywind 0:f90c3452d779 62
flywind 0:f90c3452d779 63 #endif // ifndef __NRF51822_GATT_SERVER_H__