test code 123

Dependencies:   mbed

Fork of LinkNode-Test by Qi Yao

Committer:
youkee
Date:
Thu Sep 01 05:14:03 2016 +0000
Revision:
0:1ad0e04b1bc5
change internal time from 1s to 200ms

Who changed what in which revision?

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