Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Hello_BLE F446RE-BLE
Fork of X_NUCLEO_IDB0XA1 by
BlueNRGGattServer.h@47:45b79f89b739, 2014-09-05 (annotated)
- Committer:
 - mridup
 - Date:
 - Fri Sep 05 09:20:09 2014 +0000
 - Revision:
 - 47:45b79f89b739
 - Parent:
 - 45:1fff7d7d5ce7
 - Child:
 - 51:963982e7c17c
 
BLEDevice getAppearance()
Who changed what in which revision?
| User | Revision | Line number | New 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 | 45:1fff7d7d5ce7 | 60 | uint8_t *DeviceName; | 
| mridup | 47:45b79f89b739 | 61 | uint8_t deviceAppearance[2]; | 
| mridup | 27:b4c21a9e8b39 | 62 | |
| mridup | 2:a2b623661316 | 63 | BlueNRGGattServer() { | 
| mridup | 2:a2b623661316 | 64 | serviceCount = 0; | 
| mridup | 2:a2b623661316 | 65 | characteristicCount = 0; | 
| mridup | 45:1fff7d7d5ce7 | 66 | DeviceName = NULL; | 
| mridup | 2:a2b623661316 | 67 | }; | 
| mridup | 2:a2b623661316 | 68 | |
| mridup | 2:a2b623661316 | 69 | BlueNRGGattServer(BlueNRGGattServer const &); | 
| mridup | 2:a2b623661316 | 70 | void operator=(BlueNRGGattServer const &); | 
| mridup | 2:a2b623661316 | 71 | }; | 
| mridup | 2:a2b623661316 | 72 | |
| mridup | 2:a2b623661316 | 73 | #endif | 
