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 BLE_WallbotBLE_Challenge 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_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812, 00061 UUID_IMMEDIATE_ALERT_SERVICE = 0x1802, 00062 UUID_LINK_LOSS_SERVICE = 0x1803, 00063 UUID_NEXT_DST_CHANGE_SERVICE = 0x1807, 00064 UUID_PHONE_ALERT_STATUS_SERVICE = 0x180E, 00065 UUID_REFERENCE_TIME_UPDATE_SERVICE = 0x1806, 00066 UUID_RUNNING_SPEED_AND_CADENCE = 0x1814, 00067 UUID_SCAN_PARAMETERS_SERVICE = 0x1813, 00068 UUID_TX_POWER_SERVICE = 0x1804 00069 }; 00070 00071 const UUID &getUUID(void) const { 00072 return _primaryServiceID; 00073 } 00074 uint16_t getHandle(void) const { 00075 return _handle; 00076 } 00077 void setHandle(uint16_t handle) { 00078 _handle = handle; 00079 } 00080 uint8_t getCharacteristicCount(void) const { 00081 return _characteristicCount; 00082 } 00083 GattCharacteristic *getCharacteristic(uint8_t index) { 00084 if (index >= _characteristicCount) { 00085 return NULL; 00086 } 00087 00088 return _characteristics[index]; 00089 } 00090 00091 private: 00092 UUID _primaryServiceID; 00093 uint8_t _characteristicCount; 00094 GattCharacteristic **_characteristics; 00095 uint16_t _handle; 00096 }; 00097 00098 #endif // ifndef __GATT_SERVICE_H__
Generated on Tue Jul 12 2022 13:52:31 by
