prova invio BLE

Dependents:   BLE_HeartRate_IDB04A1

Fork of BLE_API by Bluetooth Low Energy

Committer:
Rohit Grover
Date:
Wed Jul 23 15:09:23 2014 +0100
Revision:
106:a20be740075d
Child:
113:7e3fd573d87b
initial re-organization of BLE_API directory structure

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rohit Grover 106:a20be740075d 1 /* mbed Microcontroller Library
Rohit Grover 106:a20be740075d 2 * Copyright (c) 2006-2013 ARM Limited
Rohit Grover 106:a20be740075d 3 *
Rohit Grover 106:a20be740075d 4 * Licensed under the Apache License, Version 2.0 (the "License");
Rohit Grover 106:a20be740075d 5 * you may not use this file except in compliance with the License.
Rohit Grover 106:a20be740075d 6 * You may obtain a copy of the License at
Rohit Grover 106:a20be740075d 7 *
Rohit Grover 106:a20be740075d 8 * http://www.apache.org/licenses/LICENSE-2.0
Rohit Grover 106:a20be740075d 9 *
Rohit Grover 106:a20be740075d 10 * Unless required by applicable law or agreed to in writing, software
Rohit Grover 106:a20be740075d 11 * distributed under the License is distributed on an "AS IS" BASIS,
Rohit Grover 106:a20be740075d 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Rohit Grover 106:a20be740075d 13 * See the License for the specific language governing permissions and
Rohit Grover 106:a20be740075d 14 * limitations under the License.
Rohit Grover 106:a20be740075d 15 */
Rohit Grover 106:a20be740075d 16
Rohit Grover 106:a20be740075d 17
Rohit Grover 106:a20be740075d 18 #ifndef __GATT_SERVICE_H__
Rohit Grover 106:a20be740075d 19 #define __GATT_SERVICE_H__
Rohit Grover 106:a20be740075d 20
Rohit Grover 106:a20be740075d 21 #include "blecommon.h"
Rohit Grover 106:a20be740075d 22 #include "UUID.h"
Rohit Grover 106:a20be740075d 23 #include "GattCharacteristic.h"
Rohit Grover 106:a20be740075d 24
Rohit Grover 106:a20be740075d 25
Rohit Grover 106:a20be740075d 26 /**************************************************************************/
Rohit Grover 106:a20be740075d 27 /*!
Rohit Grover 106:a20be740075d 28 \brief GATT service
Rohit Grover 106:a20be740075d 29 */
Rohit Grover 106:a20be740075d 30 /**************************************************************************/
Rohit Grover 106:a20be740075d 31 class GattService
Rohit Grover 106:a20be740075d 32 {
Rohit Grover 106:a20be740075d 33 public:
Rohit Grover 106:a20be740075d 34 GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics);
Rohit Grover 106:a20be740075d 35
Rohit Grover 106:a20be740075d 36 enum {
Rohit Grover 106:a20be740075d 37 UUID_ALERT_NOTIFICATION_SERVICE = 0x1811,
Rohit Grover 106:a20be740075d 38 UUID_BATTERY_SERVICE = 0x180F,
Rohit Grover 106:a20be740075d 39 UUID_BLOOD_PRESSURE_SERVICE = 0x1810,
Rohit Grover 106:a20be740075d 40 UUID_CURRENT_TIME_SERVICE = 0x1805,
Rohit Grover 106:a20be740075d 41 UUID_CYCLING_SPEED_AND_CADENCE = 0x1816,
Rohit Grover 106:a20be740075d 42 UUID_DEVICE_INFORMATION_SERVICE = 0x180A,
Rohit Grover 106:a20be740075d 43 UUID_GLUCOSE_SERVICE = 0x1808,
Rohit Grover 106:a20be740075d 44 UUID_HEALTH_THERMOMETER_SERVICE = 0x1809,
Rohit Grover 106:a20be740075d 45 UUID_HEART_RATE_SERVICE = 0x180D,
Rohit Grover 106:a20be740075d 46 UUID_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812,
Rohit Grover 106:a20be740075d 47 UUID_IMMEDIATE_ALERT_SERVICE = 0x1802,
Rohit Grover 106:a20be740075d 48 UUID_LINK_LOSS_SERVICE = 0x1803,
Rohit Grover 106:a20be740075d 49 UUID_NEXT_DST_CHANGE_SERVICE = 0x1807,
Rohit Grover 106:a20be740075d 50 UUID_PHONE_ALERT_STATUS_SERVICE = 0x180E,
Rohit Grover 106:a20be740075d 51 UUID_REFERENCE_TIME_UPDATE_SERVICE = 0x1806,
Rohit Grover 106:a20be740075d 52 UUID_RUNNING_SPEED_AND_CADENCE = 0x1814,
Rohit Grover 106:a20be740075d 53 UUID_SCAN_PARAMETERS_SERVICE = 0x1813,
Rohit Grover 106:a20be740075d 54 UUID_TX_POWER_SERVICE = 0x1804
Rohit Grover 106:a20be740075d 55 };
Rohit Grover 106:a20be740075d 56
Rohit Grover 106:a20be740075d 57 const UUID &getUUID(void) const {
Rohit Grover 106:a20be740075d 58 return _primaryServiceID;
Rohit Grover 106:a20be740075d 59 }
Rohit Grover 106:a20be740075d 60 uint16_t getHandle(void) const {
Rohit Grover 106:a20be740075d 61 return _handle;
Rohit Grover 106:a20be740075d 62 }
Rohit Grover 106:a20be740075d 63 void setHandle(uint16_t handle) {
Rohit Grover 106:a20be740075d 64 _handle = handle;
Rohit Grover 106:a20be740075d 65 }
Rohit Grover 106:a20be740075d 66 uint8_t getCharacteristicCount(void) const {
Rohit Grover 106:a20be740075d 67 return _characteristicCount;
Rohit Grover 106:a20be740075d 68 }
Rohit Grover 106:a20be740075d 69 GattCharacteristic *getCharacteristic(uint8_t index) {
Rohit Grover 106:a20be740075d 70 if (index >= _characteristicCount) {
Rohit Grover 106:a20be740075d 71 return NULL;
Rohit Grover 106:a20be740075d 72 }
Rohit Grover 106:a20be740075d 73
Rohit Grover 106:a20be740075d 74 return _characteristics[index];
Rohit Grover 106:a20be740075d 75 }
Rohit Grover 106:a20be740075d 76
Rohit Grover 106:a20be740075d 77 private:
Rohit Grover 106:a20be740075d 78 UUID _primaryServiceID;
Rohit Grover 106:a20be740075d 79 uint8_t _characteristicCount;
Rohit Grover 106:a20be740075d 80 GattCharacteristic **_characteristics;
Rohit Grover 106:a20be740075d 81 uint16_t _handle;
Rohit Grover 106:a20be740075d 82 };
Rohit Grover 106:a20be740075d 83
Rohit Grover 106:a20be740075d 84 #endif // ifndef __GATT_SERVICE_H__