ble

Dependencies:   HC_SR04_Ultrasonic_Library Servo mbed

Fork of FIP_REV1 by Robotique FIP

Committer:
julientiron
Date:
Thu Jul 09 13:33:36 2015 +0000
Revision:
4:69a35a56ac48
Parent:
0:3d641e170a74
BLE

Who changed what in which revision?

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