Junichi Katsu / Mbed 2 deprecated BLE_MPU6050_test6_challenge_sb

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UUID.h Source File

UUID.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 __UUID_H__
00018 #define __UUID_H__
00019 
00020 #include "blecommon.h"
00021 
00022 const unsigned   LENGTH_OF_LONG_UUID = 16;
00023 typedef uint16_t ShortUUIDBytes_t;
00024 typedef uint8_t  LongUUIDBytes_t[LENGTH_OF_LONG_UUID];
00025 
00026 class UUID {
00027 public:
00028     enum {
00029         UUID_TYPE_SHORT = 0,    // Short BLE UUID
00030         UUID_TYPE_LONG  = 1     // Full 128-bit UUID
00031     };
00032 
00033 public:
00034     UUID(const LongUUIDBytes_t);
00035     UUID(ShortUUIDBytes_t);
00036 
00037 public:
00038     uint8_t           shortOrLong(void)  const {return type;     }
00039     const uint8_t    *getBaseUUID(void)  const {return baseUUID; }
00040     ShortUUIDBytes_t  getShortUUID(void) const {return shortUUID;}
00041 
00042 private:
00043     uint8_t          type;      // UUID_TYPE_SHORT or UUID_TYPE_LONG
00044     LongUUIDBytes_t  baseUUID;  /* the base of the long UUID (if
00045                             * used). Note: bytes 12 and 13 (counting from LSB)
00046                             * are zeroed out to allow comparison with other long
00047                             * UUIDs which differ only in the 16-bit relative
00048                             * part.*/
00049     ShortUUIDBytes_t shortUUID; // 16 bit uuid (byte 2-3 using with base)
00050 };
00051 
00052 #endif // ifndef __UUID_H__