Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
public/UUID.h@240:20df772f2374, 2014-12-08 (annotated)
- Committer:
- mbedAustin
- Date:
- Mon Dec 08 20:51:17 2014 +0000
- Revision:
- 240:20df772f2374
- Parent:
- 144:c025c8839682
updated documenatation to UriBeacon;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Rohit Grover |
106:a20be740075d | 1 | /* mbed Microcontroller Library |
| Rohit Grover |
106:a20be740075d | 2 | * Copyright (c) 2006-2013 ARM Limited |
| Rohit Grover |
106:a20be740075d | 3 | * |
| Rohit Grover |
106:a20be740075d | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| Rohit Grover |
106:a20be740075d | 5 | * you may not use this file except in compliance with the License. |
| Rohit Grover |
106:a20be740075d | 6 | * You may obtain a copy of the License at |
| Rohit Grover |
106:a20be740075d | 7 | * |
| Rohit Grover |
106:a20be740075d | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| Rohit Grover |
106:a20be740075d | 9 | * |
| Rohit Grover |
106:a20be740075d | 10 | * Unless required by applicable law or agreed to in writing, software |
| Rohit Grover |
106:a20be740075d | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| Rohit Grover |
106:a20be740075d | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| Rohit Grover |
106:a20be740075d | 13 | * See the License for the specific language governing permissions and |
| Rohit Grover |
106:a20be740075d | 14 | * limitations under the License. |
| Rohit Grover |
106:a20be740075d | 15 | */ |
| Rohit Grover |
106:a20be740075d | 16 | |
| Rohit Grover |
106:a20be740075d | 17 | #ifndef __UUID_H__ |
| Rohit Grover |
106:a20be740075d | 18 | #define __UUID_H__ |
| Rohit Grover |
106:a20be740075d | 19 | |
| Rohit Grover |
106:a20be740075d | 20 | #include "blecommon.h" |
| Rohit Grover |
106:a20be740075d | 21 | |
| Rohit Grover |
106:a20be740075d | 22 | const unsigned LENGTH_OF_LONG_UUID = 16; |
| Rohit Grover |
116:ca826083980e | 23 | typedef uint16_t ShortUUIDBytes_t; |
| Rohit Grover |
116:ca826083980e | 24 | typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID]; |
| Rohit Grover |
106:a20be740075d | 25 | |
| rgrover1 | 144:c025c8839682 | 26 | class UUID { |
| Rohit Grover |
106:a20be740075d | 27 | public: |
| Rohit Grover |
106:a20be740075d | 28 | enum { |
| Rohit Grover |
106:a20be740075d | 29 | UUID_TYPE_SHORT = 0, // Short BLE UUID |
| Rohit Grover |
106:a20be740075d | 30 | UUID_TYPE_LONG = 1 // Full 128-bit UUID |
| Rohit Grover |
106:a20be740075d | 31 | }; |
| Rohit Grover |
106:a20be740075d | 32 | |
| Rohit Grover |
106:a20be740075d | 33 | public: |
| Rohit Grover |
116:ca826083980e | 34 | UUID(const LongUUIDBytes_t); |
| Rohit Grover |
116:ca826083980e | 35 | UUID(ShortUUIDBytes_t); |
| Rohit Grover |
106:a20be740075d | 36 | |
| Rohit Grover |
106:a20be740075d | 37 | public: |
| rgrover1 | 144:c025c8839682 | 38 | uint8_t shortOrLong(void) const {return type; } |
| rgrover1 | 144:c025c8839682 | 39 | const uint8_t *getBaseUUID(void) const {return baseUUID; } |
| rgrover1 | 144:c025c8839682 | 40 | ShortUUIDBytes_t getShortUUID(void) const {return shortUUID;} |
| Rohit Grover |
106:a20be740075d | 41 | |
| Rohit Grover |
106:a20be740075d | 42 | private: |
| Rohit Grover |
116:ca826083980e | 43 | uint8_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG |
| Rohit Grover |
116:ca826083980e | 44 | LongUUIDBytes_t baseUUID; /* the base of the long UUID (if |
| Rohit Grover |
106:a20be740075d | 45 | * used). Note: bytes 12 and 13 (counting from LSB) |
| Rohit Grover |
106:a20be740075d | 46 | * are zeroed out to allow comparison with other long |
| Rohit Grover |
106:a20be740075d | 47 | * UUIDs which differ only in the 16-bit relative |
| Rohit Grover |
106:a20be740075d | 48 | * part.*/ |
| Rohit Grover |
116:ca826083980e | 49 | ShortUUIDBytes_t shortUUID; // 16 bit uuid (byte 2-3 using with base) |
| Rohit Grover |
106:a20be740075d | 50 | }; |
| Rohit Grover |
106:a20be740075d | 51 | |
| rgrover1 | 144:c025c8839682 | 52 | #endif // ifndef __UUID_H__ |
