WallbotBLE_Challenge ホワイトボード消し版

Dependencies:   mbed

Fork of BLE_WallbotBLE_Challenge by JKSoft

Committer:
Dyotty
Date:
Sun Jun 03 07:04:34 2018 +0000
Revision:
3:f707552ec50a
Parent:
0:76dfa9657d9d
MPU6050????????

Who changed what in which revision?

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