Changed the device name.
Dependents: BLE_Health_Thermometer_HeartRateMonitor
Fork of BLE_API_Native_IRC by
hw/nRF51822n/nRF51GattServer.h@0:4c3097c65247, 2014-02-06 (annotated)
- Committer:
- ktownsend
- Date:
- Thu Feb 06 11:51:06 2014 +0000
- Revision:
- 0:4c3097c65247
- Child:
- 8:b346eddb9346
Native mode drivers
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ktownsend | 0:4c3097c65247 | 1 | /* mbed Microcontroller Library |
ktownsend | 0:4c3097c65247 | 2 | * Copyright (c) 2006-2013 ARM Limited |
ktownsend | 0:4c3097c65247 | 3 | * |
ktownsend | 0:4c3097c65247 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ktownsend | 0:4c3097c65247 | 5 | * you may not use this file except in compliance with the License. |
ktownsend | 0:4c3097c65247 | 6 | * You may obtain a copy of the License at |
ktownsend | 0:4c3097c65247 | 7 | * |
ktownsend | 0:4c3097c65247 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ktownsend | 0:4c3097c65247 | 9 | * |
ktownsend | 0:4c3097c65247 | 10 | * Unless required by applicable law or agreed to in writing, software |
ktownsend | 0:4c3097c65247 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
ktownsend | 0:4c3097c65247 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ktownsend | 0:4c3097c65247 | 13 | * See the License for the specific language governing permissions and |
ktownsend | 0:4c3097c65247 | 14 | * limitations under the License. |
ktownsend | 0:4c3097c65247 | 15 | */ |
ktownsend | 0:4c3097c65247 | 16 | |
ktownsend | 0:4c3097c65247 | 17 | #ifndef __NRF51822_GATT_SERVER_H__ |
ktownsend | 0:4c3097c65247 | 18 | #define __NRF51822_GATT_SERVER_H__ |
ktownsend | 0:4c3097c65247 | 19 | |
ktownsend | 0:4c3097c65247 | 20 | #include "mbed.h" |
ktownsend | 0:4c3097c65247 | 21 | #include "blecommon.h" |
ktownsend | 0:4c3097c65247 | 22 | #include "GattService.h" |
ktownsend | 0:4c3097c65247 | 23 | #include "hw/GattServer.h" |
ktownsend | 0:4c3097c65247 | 24 | |
ktownsend | 0:4c3097c65247 | 25 | #define BLE_TOTAL_CHARACTERISTICS 10 |
ktownsend | 0:4c3097c65247 | 26 | |
ktownsend | 0:4c3097c65247 | 27 | /**************************************************************************/ |
ktownsend | 0:4c3097c65247 | 28 | /*! |
ktownsend | 0:4c3097c65247 | 29 | \brief |
ktownsend | 0:4c3097c65247 | 30 | |
ktownsend | 0:4c3097c65247 | 31 | */ |
ktownsend | 0:4c3097c65247 | 32 | /**************************************************************************/ |
ktownsend | 0:4c3097c65247 | 33 | class nRF51GattServer : public GattServer |
ktownsend | 0:4c3097c65247 | 34 | { |
ktownsend | 0:4c3097c65247 | 35 | public: |
ktownsend | 0:4c3097c65247 | 36 | static nRF51GattServer& getInstance() |
ktownsend | 0:4c3097c65247 | 37 | { |
ktownsend | 0:4c3097c65247 | 38 | static nRF51GattServer m_instance; |
ktownsend | 0:4c3097c65247 | 39 | return m_instance; |
ktownsend | 0:4c3097c65247 | 40 | } |
ktownsend | 0:4c3097c65247 | 41 | |
ktownsend | 0:4c3097c65247 | 42 | /* Functions that must be implemented from GattServer */ |
ktownsend | 0:4c3097c65247 | 43 | virtual ble_error_t addService(GattService &); |
ktownsend | 0:4c3097c65247 | 44 | virtual ble_error_t readValue(uint16_t, uint8_t[], uint16_t); |
ktownsend | 0:4c3097c65247 | 45 | virtual ble_error_t updateValue(uint16_t, uint8_t[], uint16_t); |
ktownsend | 0:4c3097c65247 | 46 | |
ktownsend | 0:4c3097c65247 | 47 | /* nRF51 Functions */ |
ktownsend | 0:4c3097c65247 | 48 | void eventCallback(void); |
ktownsend | 0:4c3097c65247 | 49 | |
ktownsend | 0:4c3097c65247 | 50 | private: |
ktownsend | 0:4c3097c65247 | 51 | nRF51GattServer() { serviceCount = 0; characteristicCount = 0; }; |
ktownsend | 0:4c3097c65247 | 52 | nRF51GattServer(nRF51GattServer const&); |
ktownsend | 0:4c3097c65247 | 53 | void operator=(nRF51GattServer const&); |
ktownsend | 0:4c3097c65247 | 54 | |
ktownsend | 0:4c3097c65247 | 55 | ble_gatts_char_handles_t nrfCharacteristicHandles[BLE_TOTAL_CHARACTERISTICS]; |
ktownsend | 0:4c3097c65247 | 56 | }; |
ktownsend | 0:4c3097c65247 | 57 | |
ktownsend | 0:4c3097c65247 | 58 | #endif |