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.
Fork of Nucleo_BLE_API by
GattService.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 00018 #ifndef __GATT_SERVICE_H__ 00019 #define __GATT_SERVICE_H__ 00020 00021 #include "blecommon.h" 00022 #include "UUID.h" 00023 #include "GattCharacteristic.h" 00024 00025 00026 /**************************************************************************/ 00027 /*! 00028 \brief GATT service 00029 */ 00030 /**************************************************************************/ 00031 class GattService 00032 { 00033 public: 00034 /** 00035 * @brief Creates a new GattCharacteristic using the specified 16-bit 00036 * UUID, value length, and properties 00037 * 00038 * @note The UUID value must be unique in the service and is normally >1 00039 * 00040 * @param[in] uuid 00041 * The UUID to use for this characteristic 00042 * @param[in] characteristics 00043 * A pointer to an array of characteristics to be included within this service 00044 * @param[in] numCharacteristics 00045 * The number of characteristics 00046 */ 00047 /**************************************************************************/ 00048 GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics); 00049 00050 enum { 00051 UUID_ALERT_NOTIFICATION_SERVICE = 0x1811, 00052 UUID_BATTERY_SERVICE = 0x180F, 00053 UUID_BLOOD_PRESSURE_SERVICE = 0x1810, 00054 UUID_CURRENT_TIME_SERVICE = 0x1805, 00055 UUID_CYCLING_SPEED_AND_CADENCE = 0x1816, 00056 UUID_DEVICE_INFORMATION_SERVICE = 0x180A, 00057 UUID_GLUCOSE_SERVICE = 0x1808, 00058 UUID_HEALTH_THERMOMETER_SERVICE = 0x1809, 00059 UUID_HEART_RATE_SERVICE = 0x180D, 00060 UUID_VIJAYS_UNICORN_SERVICE = 0x18FF, 00061 UUID_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812, 00062 UUID_IMMEDIATE_ALERT_SERVICE = 0x1802, 00063 UUID_LINK_LOSS_SERVICE = 0x1803, 00064 UUID_NEXT_DST_CHANGE_SERVICE = 0x1807, 00065 UUID_PHONE_ALERT_STATUS_SERVICE = 0x180E, 00066 UUID_REFERENCE_TIME_UPDATE_SERVICE = 0x1806, 00067 UUID_RUNNING_SPEED_AND_CADENCE = 0x1814, 00068 UUID_SCAN_PARAMETERS_SERVICE = 0x1813, 00069 UUID_TX_POWER_SERVICE = 0x1804 00070 }; 00071 00072 const UUID &getUUID(void) const { 00073 return _primaryServiceID; 00074 } 00075 uint16_t getHandle(void) const { 00076 return _handle; 00077 } 00078 void setHandle(uint16_t handle) { 00079 _handle = handle; 00080 } 00081 uint8_t getCharacteristicCount(void) const { 00082 return _characteristicCount; 00083 } 00084 GattCharacteristic *getCharacteristic(uint8_t index) { 00085 if (index >= _characteristicCount) { 00086 return NULL; 00087 } 00088 00089 return _characteristics[index]; 00090 } 00091 00092 private: 00093 UUID _primaryServiceID; 00094 uint8_t _characteristicCount; 00095 GattCharacteristic **_characteristics; 00096 uint16_t _handle; 00097 }; 00098 00099 #endif // ifndef __GATT_SERVICE_H__
Generated on Tue Jul 12 2022 22:48:24 by
1.7.2
