vo dung
/
eddystone_URL
first commit
Fork of BLE_WallbotBLE_Challenge by
BLE_API/public/UUID.h@0:76dfa9657d9d, 2014-11-12 (annotated)
- Committer:
- jksoft
- Date:
- Wed Nov 12 02:40:34 2014 +0000
- Revision:
- 0:76dfa9657d9d
????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:76dfa9657d9d | 1 | /* mbed Microcontroller Library |
jksoft | 0:76dfa9657d9d | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 0:76dfa9657d9d | 3 | * |
jksoft | 0:76dfa9657d9d | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 0:76dfa9657d9d | 5 | * you may not use this file except in compliance with the License. |
jksoft | 0:76dfa9657d9d | 6 | * You may obtain a copy of the License at |
jksoft | 0:76dfa9657d9d | 7 | * |
jksoft | 0:76dfa9657d9d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 0:76dfa9657d9d | 9 | * |
jksoft | 0:76dfa9657d9d | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 0:76dfa9657d9d | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 0:76dfa9657d9d | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 0:76dfa9657d9d | 13 | * See the License for the specific language governing permissions and |
jksoft | 0:76dfa9657d9d | 14 | * limitations under the License. |
jksoft | 0:76dfa9657d9d | 15 | */ |
jksoft | 0:76dfa9657d9d | 16 | |
jksoft | 0:76dfa9657d9d | 17 | |
jksoft | 0:76dfa9657d9d | 18 | #ifndef __UUID_H__ |
jksoft | 0:76dfa9657d9d | 19 | #define __UUID_H__ |
jksoft | 0:76dfa9657d9d | 20 | |
jksoft | 0:76dfa9657d9d | 21 | #include "blecommon.h" |
jksoft | 0:76dfa9657d9d | 22 | |
jksoft | 0:76dfa9657d9d | 23 | const unsigned LENGTH_OF_LONG_UUID = 16; |
jksoft | 0:76dfa9657d9d | 24 | typedef uint16_t ShortUUIDBytes_t; |
jksoft | 0:76dfa9657d9d | 25 | typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID]; |
jksoft | 0:76dfa9657d9d | 26 | |
jksoft | 0:76dfa9657d9d | 27 | class UUID |
jksoft | 0:76dfa9657d9d | 28 | { |
jksoft | 0:76dfa9657d9d | 29 | public: |
jksoft | 0:76dfa9657d9d | 30 | enum { |
jksoft | 0:76dfa9657d9d | 31 | UUID_TYPE_SHORT = 0, // Short BLE UUID |
jksoft | 0:76dfa9657d9d | 32 | UUID_TYPE_LONG = 1 // Full 128-bit UUID |
jksoft | 0:76dfa9657d9d | 33 | }; |
jksoft | 0:76dfa9657d9d | 34 | |
jksoft | 0:76dfa9657d9d | 35 | public: |
jksoft | 0:76dfa9657d9d | 36 | UUID(const LongUUIDBytes_t); |
jksoft | 0:76dfa9657d9d | 37 | UUID(ShortUUIDBytes_t); |
jksoft | 0:76dfa9657d9d | 38 | virtual ~UUID(void); |
jksoft | 0:76dfa9657d9d | 39 | |
jksoft | 0:76dfa9657d9d | 40 | public: |
jksoft | 0:76dfa9657d9d | 41 | uint8_t shortOrLong(void) const { |
jksoft | 0:76dfa9657d9d | 42 | return type; |
jksoft | 0:76dfa9657d9d | 43 | } |
jksoft | 0:76dfa9657d9d | 44 | const uint8_t* getBaseUUID(void) const { |
jksoft | 0:76dfa9657d9d | 45 | return baseUUID; |
jksoft | 0:76dfa9657d9d | 46 | } |
jksoft | 0:76dfa9657d9d | 47 | ShortUUIDBytes_t getShortUUID(void) const { |
jksoft | 0:76dfa9657d9d | 48 | return shortUUID; |
jksoft | 0:76dfa9657d9d | 49 | } |
jksoft | 0:76dfa9657d9d | 50 | |
jksoft | 0:76dfa9657d9d | 51 | private: |
jksoft | 0:76dfa9657d9d | 52 | uint8_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG |
jksoft | 0:76dfa9657d9d | 53 | LongUUIDBytes_t baseUUID; /* the base of the long UUID (if |
jksoft | 0:76dfa9657d9d | 54 | * used). Note: bytes 12 and 13 (counting from LSB) |
jksoft | 0:76dfa9657d9d | 55 | * are zeroed out to allow comparison with other long |
jksoft | 0:76dfa9657d9d | 56 | * UUIDs which differ only in the 16-bit relative |
jksoft | 0:76dfa9657d9d | 57 | * part.*/ |
jksoft | 0:76dfa9657d9d | 58 | ShortUUIDBytes_t shortUUID; // 16 bit uuid (byte 2-3 using with base) |
jksoft | 0:76dfa9657d9d | 59 | }; |
jksoft | 0:76dfa9657d9d | 60 | |
jksoft | 0:76dfa9657d9d | 61 | #endif // ifndef __UUID_H__ |