最新revisionだとなんかerrorになるので、暫定的に rev 111にrevert。ごめんなさい。こういうときどういうふうにcommitすればいいのか分からなかったので。

Dependents:   MiniSteer_BLE

Fork of BLE_API by Bluetooth Low Energy

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 
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     GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics);
00035 
00036     enum {
00037         UUID_ALERT_NOTIFICATION_SERVICE     = 0x1811,
00038         UUID_BATTERY_SERVICE                = 0x180F,
00039         UUID_BLOOD_PRESSURE_SERVICE         = 0x1810,
00040         UUID_CURRENT_TIME_SERVICE           = 0x1805,
00041         UUID_CYCLING_SPEED_AND_CADENCE      = 0x1816,
00042         UUID_DEVICE_INFORMATION_SERVICE     = 0x180A,
00043         UUID_GLUCOSE_SERVICE                = 0x1808,
00044         UUID_HEALTH_THERMOMETER_SERVICE     = 0x1809,
00045         UUID_HEART_RATE_SERVICE             = 0x180D,
00046         UUID_HUMAN_INTERFACE_DEVICE_SERVICE = 0x1812,
00047         UUID_IMMEDIATE_ALERT_SERVICE        = 0x1802,
00048         UUID_LINK_LOSS_SERVICE              = 0x1803,
00049         UUID_NEXT_DST_CHANGE_SERVICE        = 0x1807,
00050         UUID_PHONE_ALERT_STATUS_SERVICE     = 0x180E,
00051         UUID_REFERENCE_TIME_UPDATE_SERVICE  = 0x1806,
00052         UUID_RUNNING_SPEED_AND_CADENCE      = 0x1814,
00053         UUID_SCAN_PARAMETERS_SERVICE        = 0x1813,
00054         UUID_TX_POWER_SERVICE               = 0x1804
00055     };
00056 
00057     const UUID &getUUID(void) const {
00058         return _primaryServiceID;
00059     }
00060     uint16_t getHandle(void) const {
00061         return _handle;
00062     }
00063     void setHandle(uint16_t handle) {
00064         _handle = handle;
00065     }
00066     uint8_t getCharacteristicCount(void) const {
00067         return _characteristicCount;
00068     }
00069     GattCharacteristic *getCharacteristic(uint8_t index) {
00070         if (index >= _characteristicCount) {
00071             return NULL;
00072         }
00073 
00074         return _characteristics[index];
00075     }
00076 
00077 private:
00078     UUID                 _primaryServiceID;
00079     uint8_t              _characteristicCount;
00080     GattCharacteristic **_characteristics;
00081     uint16_t             _handle;
00082 };
00083 
00084 #endif // ifndef __GATT_SERVICE_H__