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 __UUID_H__
julientiron 0:3d641e170a74 19 #define __UUID_H__
julientiron 0:3d641e170a74 20
julientiron 0:3d641e170a74 21 #include "blecommon.h"
julientiron 0:3d641e170a74 22
julientiron 0:3d641e170a74 23 const unsigned LENGTH_OF_LONG_UUID = 16;
julientiron 0:3d641e170a74 24 typedef uint16_t ShortUUID_t;
julientiron 0:3d641e170a74 25 typedef uint8_t LongUUID_t[LENGTH_OF_LONG_UUID];
julientiron 0:3d641e170a74 26
julientiron 0:3d641e170a74 27 class UUID
julientiron 0:3d641e170a74 28 {
julientiron 0:3d641e170a74 29 public:
julientiron 0:3d641e170a74 30 enum {
julientiron 0:3d641e170a74 31 UUID_TYPE_SHORT = 0, // Short BLE UUID
julientiron 0:3d641e170a74 32 UUID_TYPE_LONG = 1 // Full 128-bit UUID
julientiron 0:3d641e170a74 33 };
julientiron 0:3d641e170a74 34
julientiron 0:3d641e170a74 35 public:
julientiron 0:3d641e170a74 36 UUID(const LongUUID_t);
julientiron 0:3d641e170a74 37 UUID(ShortUUID_t);
julientiron 0:3d641e170a74 38 virtual ~UUID(void);
julientiron 0:3d641e170a74 39
julientiron 0:3d641e170a74 40 public:
julientiron 0:3d641e170a74 41 uint8_t shortOrLong(void) const {
julientiron 0:3d641e170a74 42 return type;
julientiron 0:3d641e170a74 43 }
julientiron 0:3d641e170a74 44 const uint8_t* getBaseUUID(void) const {
julientiron 0:3d641e170a74 45 return baseUUID;
julientiron 0:3d641e170a74 46 }
julientiron 0:3d641e170a74 47 ShortUUID_t getShortUUID(void) const {
julientiron 0:3d641e170a74 48 return shortUUID;
julientiron 0:3d641e170a74 49 }
julientiron 0:3d641e170a74 50
julientiron 0:3d641e170a74 51 private:
julientiron 0:3d641e170a74 52 uint8_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG
julientiron 0:3d641e170a74 53 LongUUID_t baseUUID; /* the base of the long UUID (if
julientiron 0:3d641e170a74 54 * used). Note: bytes 12 and 13 (counting from LSB)
julientiron 0:3d641e170a74 55 * are zeroed out to allow comparison with other long
julientiron 0:3d641e170a74 56 * UUIDs which differ only in the 16-bit relative
julientiron 0:3d641e170a74 57 * part.*/
julientiron 0:3d641e170a74 58 ShortUUID_t shortUUID; // 16 bit uuid (byte 2-3 using with base)
julientiron 0:3d641e170a74 59 };
julientiron 0:3d641e170a74 60
julientiron 0:3d641e170a74 61 #endif // ifndef __UUID_H__