Wallbot_CaaS

Dependencies:   MPU6050 mbed PID

Fork of BLE_MPU6050_test6_challenge_sb by Junichi Katsu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GattService.h Source File

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 #ifndef __GATT_SERVICE_H__
00018 #define __GATT_SERVICE_H__
00019 
00020 #include "UUID.h"
00021 #include "GattCharacteristic.h"
00022 
00023 class GattService {
00024 public:
00025     enum {
00026         UUID_ALERT_NOTIFICATION_SERVICE     = 0x1811,
00027         UUID_BATTERY_SERVICE                = 0x180F,
00028         UUID_BLOOD_PRESSURE_SERVICE         = 0x1810,
00029         UUID_CURRENT_TIME_SERVICE           = 0x1805,
00030         UUID_CYCLING_SPEED_AND_CADENCE      = 0x1816,
00031         UUID_DEVICE_INFORMATION_SERVICE     = 0x180A,
00032         UUID_GLUCOSE_SERVICE                = 0x1808,
00033         UUID_HEALTH_THERMOMETER_SERVICE     = 0x1809,
00034         UUID_HEART_RATE_SERVICE             = 0x180D,
00035         UUID_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812,
00036         UUID_IMMEDIATE_ALERT_SERVICE        = 0x1802,
00037         UUID_LINK_LOSS_SERVICE              = 0x1803,
00038         UUID_NEXT_DST_CHANGE_SERVICE        = 0x1807,
00039         UUID_PHONE_ALERT_STATUS_SERVICE     = 0x180E,
00040         UUID_REFERENCE_TIME_UPDATE_SERVICE  = 0x1806,
00041         UUID_RUNNING_SPEED_AND_CADENCE      = 0x1814,
00042         UUID_SCAN_PARAMETERS_SERVICE        = 0x1813,
00043         UUID_TX_POWER_SERVICE               = 0x1804
00044     };
00045 
00046 public:
00047     /**
00048      *  @brief  Creates a new GattCharacteristic using the specified 16-bit
00049      *          UUID, value length, and properties
00050      *
00051      *  @note   The UUID value must be unique in the service and is normally >1
00052      *
00053      *  @param[in]  uuid
00054      *              The UUID to use for this characteristic
00055      *  @param[in]  characteristics
00056      *              A pointer to an array of characteristics to be included within this service
00057      *  @param[in]  numCharacteristics
00058      *              The number of characteristics
00059      */
00060     GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics);
00061 
00062     const UUID &getUUID(void)                const {return _primaryServiceID;   }
00063     uint16_t    getHandle(void)              const {return _handle;             }
00064     uint8_t     getCharacteristicCount(void) const {return _characteristicCount;}
00065     void setHandle(uint16_t handle) {_handle = handle;}
00066 
00067     GattCharacteristic *getCharacteristic(uint8_t index) {
00068         if (index >= _characteristicCount) {
00069             return NULL;
00070         }
00071 
00072         return _characteristics[index];
00073     }
00074 
00075 private:
00076     UUID                 _primaryServiceID;
00077     uint8_t              _characteristicCount;
00078     GattCharacteristic **_characteristics;
00079     uint16_t             _handle;
00080 };
00081 
00082 #endif // ifndef __GATT_SERVICE_H__