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
UUID.h@56:537b8e8f5d60, 2014-05-29 (annotated)
- Committer:
- Rohit Grover
- Date:
- Thu May 29 08:57:57 2014 +0100
- Revision:
- 56:537b8e8f5d60
- Parent:
- 53:a1bec483c8e3
- Child:
- 60:de30b62ab8c1
make members of UUID private; add accessors()
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ktownsend | 27:4a83843f04b0 | 1 | /* mbed Microcontroller Library |
| ktownsend | 27:4a83843f04b0 | 2 | * Copyright (c) 2006-2013 ARM Limited |
| ktownsend | 27:4a83843f04b0 | 3 | * |
| ktownsend | 27:4a83843f04b0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| ktownsend | 27:4a83843f04b0 | 5 | * you may not use this file except in compliance with the License. |
| ktownsend | 27:4a83843f04b0 | 6 | * You may obtain a copy of the License at |
| ktownsend | 27:4a83843f04b0 | 7 | * |
| ktownsend | 27:4a83843f04b0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| ktownsend | 27:4a83843f04b0 | 9 | * |
| ktownsend | 27:4a83843f04b0 | 10 | * Unless required by applicable law or agreed to in writing, software |
| ktownsend | 27:4a83843f04b0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| ktownsend | 27:4a83843f04b0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ktownsend | 27:4a83843f04b0 | 13 | * See the License for the specific language governing permissions and |
| ktownsend | 27:4a83843f04b0 | 14 | * limitations under the License. |
| ktownsend | 27:4a83843f04b0 | 15 | */ |
| Rohit Grover |
34:da2ea8cd6216 | 16 | |
| ktownsend | 27:4a83843f04b0 | 17 | |
| ktownsend | 0:ace2e8d3ce79 | 18 | #ifndef __UUID_H__ |
| ktownsend | 0:ace2e8d3ce79 | 19 | #define __UUID_H__ |
| ktownsend | 0:ace2e8d3ce79 | 20 | |
| ktownsend | 0:ace2e8d3ce79 | 21 | #include "blecommon.h" |
| ktownsend | 0:ace2e8d3ce79 | 22 | |
| ktownsend | 0:ace2e8d3ce79 | 23 | class UUID |
| ktownsend | 0:ace2e8d3ce79 | 24 | { |
| ktownsend | 0:ace2e8d3ce79 | 25 | public: |
| Rohit Grover |
50:9078969e80e4 | 26 | enum { |
| ktownsend | 0:ace2e8d3ce79 | 27 | UUID_TYPE_SHORT = 0, // Short BLE UUID |
| ktownsend | 0:ace2e8d3ce79 | 28 | UUID_TYPE_LONG = 1 // Full 128-bit UUID |
| ktownsend | 0:ace2e8d3ce79 | 29 | }; |
| Rohit Grover |
34:da2ea8cd6216 | 30 | |
| Rohit Grover |
50:9078969e80e4 | 31 | static const unsigned LENGTH_OF_LONG_UUID = 16; |
| Rohit Grover |
50:9078969e80e4 | 32 | |
| Rohit Grover |
50:9078969e80e4 | 33 | public: |
| ktownsend | 0:ace2e8d3ce79 | 34 | UUID(void); |
| Rohit Grover |
50:9078969e80e4 | 35 | UUID(uint8_t const[LENGTH_OF_LONG_UUID]); |
| ktownsend | 0:ace2e8d3ce79 | 36 | UUID(uint16_t const); |
| ktownsend | 0:ace2e8d3ce79 | 37 | virtual ~UUID(void); |
| Rohit Grover |
34:da2ea8cd6216 | 38 | |
| Rohit Grover |
50:9078969e80e4 | 39 | public: |
| Rohit Grover |
56:537b8e8f5d60 | 40 | uint8_t shortOrLong(void) const { |
| Rohit Grover |
56:537b8e8f5d60 | 41 | return type; |
| Rohit Grover |
56:537b8e8f5d60 | 42 | } |
| Rohit Grover |
56:537b8e8f5d60 | 43 | const uint8_t* getBaseUUID(void) const { |
| Rohit Grover |
56:537b8e8f5d60 | 44 | return base; |
| Rohit Grover |
56:537b8e8f5d60 | 45 | } |
| Rohit Grover |
56:537b8e8f5d60 | 46 | uint16_t get16BitUUID(void) const { |
| Rohit Grover |
56:537b8e8f5d60 | 47 | return value; |
| Rohit Grover |
56:537b8e8f5d60 | 48 | } |
| Rohit Grover |
56:537b8e8f5d60 | 49 | |
| Rohit Grover |
56:537b8e8f5d60 | 50 | private: |
| Rohit Grover |
34:da2ea8cd6216 | 51 | uint8_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG |
| Rohit Grover |
50:9078969e80e4 | 52 | uint8_t base[LENGTH_OF_LONG_UUID]; // in case of custom |
| Rohit Grover |
34:da2ea8cd6216 | 53 | uint16_t value; // 16 bit uuid (byte 2-3 using with base) |
| ktownsend | 0:ace2e8d3ce79 | 54 | }; |
| ktownsend | 0:ace2e8d3ce79 | 55 | |
| Rohit Grover |
34:da2ea8cd6216 | 56 | #endif // ifndef __UUID_H__ |
