BLE_API_Tiny_BLE
Fork of BLE_API by
public/UUID.h@116:ca826083980e, 2014-09-02 (annotated)
- Committer:
- Rohit Grover
- Date:
- Tue Sep 02 15:09:46 2014 +0100
- Revision:
- 116:ca826083980e
- Parent:
- 106:a20be740075d
- Child:
- 144:c025c8839682
Release 0.1.0
=============
Mostly API changes.
Features
~~~~~~~~
- onConnection() callback now receives connection-parameters applicable to the
new connection.
- onDataSent() callback now receives a count parameter containing the number of
times notifications were sent out since the last callback.
- A 'reason' parameter has been added to Gap::disconnect() to indicate the
reason for disconnection; and also to the onDisconnection callback to
receive a reason from the remote host.
Bugfixes
~~~~~~~~
- onDataWritten() callback now receives an additional parameter
(GattServer::WriteEventCallback_t) encapsulating the update. This avoids
having to re-fetch the updated characteristic's value attribute. It also
fixes a bug where multiple updates to the characteristic's value-attribute
could get clobbered if they occurred in quick succession before the
callbacks could be processed.
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 | |
Rohit Grover |
106:a20be740075d | 18 | #ifndef __UUID_H__ |
Rohit Grover |
106:a20be740075d | 19 | #define __UUID_H__ |
Rohit Grover |
106:a20be740075d | 20 | |
Rohit Grover |
106:a20be740075d | 21 | #include "blecommon.h" |
Rohit Grover |
106:a20be740075d | 22 | |
Rohit Grover |
106:a20be740075d | 23 | const unsigned LENGTH_OF_LONG_UUID = 16; |
Rohit Grover |
116:ca826083980e | 24 | typedef uint16_t ShortUUIDBytes_t; |
Rohit Grover |
116:ca826083980e | 25 | typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID]; |
Rohit Grover |
106:a20be740075d | 26 | |
Rohit Grover |
106:a20be740075d | 27 | class UUID |
Rohit Grover |
106:a20be740075d | 28 | { |
Rohit Grover |
106:a20be740075d | 29 | public: |
Rohit Grover |
106:a20be740075d | 30 | enum { |
Rohit Grover |
106:a20be740075d | 31 | UUID_TYPE_SHORT = 0, // Short BLE UUID |
Rohit Grover |
106:a20be740075d | 32 | UUID_TYPE_LONG = 1 // Full 128-bit UUID |
Rohit Grover |
106:a20be740075d | 33 | }; |
Rohit Grover |
106:a20be740075d | 34 | |
Rohit Grover |
106:a20be740075d | 35 | public: |
Rohit Grover |
116:ca826083980e | 36 | UUID(const LongUUIDBytes_t); |
Rohit Grover |
116:ca826083980e | 37 | UUID(ShortUUIDBytes_t); |
Rohit Grover |
106:a20be740075d | 38 | virtual ~UUID(void); |
Rohit Grover |
106:a20be740075d | 39 | |
Rohit Grover |
106:a20be740075d | 40 | public: |
Rohit Grover |
106:a20be740075d | 41 | uint8_t shortOrLong(void) const { |
Rohit Grover |
106:a20be740075d | 42 | return type; |
Rohit Grover |
106:a20be740075d | 43 | } |
Rohit Grover |
106:a20be740075d | 44 | const uint8_t* getBaseUUID(void) const { |
Rohit Grover |
106:a20be740075d | 45 | return baseUUID; |
Rohit Grover |
106:a20be740075d | 46 | } |
Rohit Grover |
116:ca826083980e | 47 | ShortUUIDBytes_t getShortUUID(void) const { |
Rohit Grover |
106:a20be740075d | 48 | return shortUUID; |
Rohit Grover |
106:a20be740075d | 49 | } |
Rohit Grover |
106:a20be740075d | 50 | |
Rohit Grover |
106:a20be740075d | 51 | private: |
Rohit Grover |
116:ca826083980e | 52 | uint8_t type; // UUID_TYPE_SHORT or UUID_TYPE_LONG |
Rohit Grover |
116:ca826083980e | 53 | LongUUIDBytes_t baseUUID; /* the base of the long UUID (if |
Rohit Grover |
106:a20be740075d | 54 | * used). Note: bytes 12 and 13 (counting from LSB) |
Rohit Grover |
106:a20be740075d | 55 | * are zeroed out to allow comparison with other long |
Rohit Grover |
106:a20be740075d | 56 | * UUIDs which differ only in the 16-bit relative |
Rohit Grover |
106:a20be740075d | 57 | * part.*/ |
Rohit Grover |
116:ca826083980e | 58 | ShortUUIDBytes_t shortUUID; // 16 bit uuid (byte 2-3 using with base) |
Rohit Grover |
106:a20be740075d | 59 | }; |
Rohit Grover |
106:a20be740075d | 60 | |
Rohit Grover |
106:a20be740075d | 61 | #endif // ifndef __UUID_H__ |