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