Lightly modified version of the BLE stack, that doesn't bring up a DFUService by default... as we have our own.

Fork of BLE_API by Bluetooth Low Energy

Committer:
rgrover1
Date:
Mon Mar 02 11:50:48 2015 +0000
Revision:
303:a0d78cb2e9ef
Parent:
302:8f4348c2b6b5
Child:
332:1dc2f80b4710
Synchronized with git rev 70f09d4c
Author: Rohit Grover
#32: minor enhancement. add enum UUID_Type_t to constrain 'type'.

Who changed what in which revision?

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