BLE EddystoneService example

This example is a fork of the following mbed-os example:

https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-EddystoneService/

Please read the documentation in this page.

Committer:
mbed_official
Date:
Fri Jul 29 22:45:40 2016 +0100
Revision:
3:5120491ba317
Parent:
2:9ee673e0b86a
Merge branch 'master' of https://github.com/ARMmbed/mbed-os-example-ble


Commit copied from https://github.com/ARMmbed/mbed-os-example-ble

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 3:5120491ba317 1 /* mbed Microcontroller Library
mbed_official 3:5120491ba317 2 * Copyright (c) 2006-2015 ARM Limited
mbed_official 3:5120491ba317 3 *
mbed_official 3:5120491ba317 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 3:5120491ba317 5 * you may not use this file except in compliance with the License.
mbed_official 3:5120491ba317 6 * You may obtain a copy of the License at
mbed_official 3:5120491ba317 7 *
mbed_official 3:5120491ba317 8 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 3:5120491ba317 9 *
mbed_official 3:5120491ba317 10 * Unless required by applicable law or agreed to in writing, software
mbed_official 3:5120491ba317 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 3:5120491ba317 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 3:5120491ba317 13 * See the License for the specific language governing permissions and
mbed_official 3:5120491ba317 14 * limitations under the License.
mbed_official 3:5120491ba317 15 */
mbed_official 3:5120491ba317 16
mbed_official 3:5120491ba317 17 #ifndef __UIDFRAME_H__
mbed_official 3:5120491ba317 18 #define __UIDFRAME_H__
mbed_official 3:5120491ba317 19
mbed_official 3:5120491ba317 20 #include <string.h>
mbed_official 3:5120491ba317 21 #include "EddystoneTypes.h"
mbed_official 3:5120491ba317 22
mbed_official 3:5120491ba317 23 /**
mbed_official 3:5120491ba317 24 * Class that encapsulates data that belongs to the Eddystone-UID frame. For
mbed_official 3:5120491ba317 25 * more information refer to https://github.com/google/eddystone/tree/master/eddystone-uid.
mbed_official 3:5120491ba317 26 */
mbed_official 3:5120491ba317 27 class UIDFrame
mbed_official 3:5120491ba317 28 {
mbed_official 3:5120491ba317 29 public:
mbed_official 3:5120491ba317 30 /**
mbed_official 3:5120491ba317 31 * Construct a new instance of this class.
mbed_official 3:5120491ba317 32 */
mbed_official 3:5120491ba317 33 UIDFrame(void);
mbed_official 3:5120491ba317 34
mbed_official 3:5120491ba317 35 /**
mbed_official 3:5120491ba317 36 * Construct a new instance of this class.
mbed_official 3:5120491ba317 37 *
mbed_official 3:5120491ba317 38 * @param[in] uidNamespaceIDIn
mbed_official 3:5120491ba317 39 * The Eddystone-UID namespace ID.
mbed_official 3:5120491ba317 40 * @param[in] uidInstanceIDIn
mbed_official 3:5120491ba317 41 * The Eddystone-UID instance ID.
mbed_official 3:5120491ba317 42 */
mbed_official 3:5120491ba317 43 UIDFrame(const UIDNamespaceID_t uidNamespaceIDIn, const UIDInstanceID_t uidInstanceIDIn);
mbed_official 3:5120491ba317 44
mbed_official 3:5120491ba317 45 /**
mbed_official 3:5120491ba317 46 * Set the instance and namespace ID.
mbed_official 3:5120491ba317 47 *
mbed_official 3:5120491ba317 48 * @param[in] uidNamespaceIDIn
mbed_official 3:5120491ba317 49 * The new Eddystone-UID namespace ID.
mbed_official 3:5120491ba317 50 * @param[in] uidInstanceIDIn
mbed_official 3:5120491ba317 51 * The new Eddystone-UID instance ID.
mbed_official 3:5120491ba317 52 */
mbed_official 3:5120491ba317 53 void setUIDData(const UIDNamespaceID_t &uidNamespaceIDIn, const UIDInstanceID_t &uidInstanceIDIn);
mbed_official 3:5120491ba317 54
mbed_official 3:5120491ba317 55 /**
mbed_official 3:5120491ba317 56 * Construct the raw bytes of the Eddystone-UID frame that will be directly
mbed_official 3:5120491ba317 57 * used in the advertising packets.
mbed_official 3:5120491ba317 58 *
mbed_official 3:5120491ba317 59 * @param[in] rawFrame
mbed_official 3:5120491ba317 60 * Pointer to the location where the raw frame will be stored.
mbed_official 3:5120491ba317 61 * @param[in] advPowerLevel
mbed_official 3:5120491ba317 62 * Power level value included withing the raw frame.
mbed_official 3:5120491ba317 63 */
mbed_official 3:5120491ba317 64 void constructUIDFrame(uint8_t *rawFrame, int8_t advPowerLevel);
mbed_official 3:5120491ba317 65
mbed_official 3:5120491ba317 66 /**
mbed_official 3:5120491ba317 67 * Get the size of the Eddystone-UID frame constructed with the
mbed_official 3:5120491ba317 68 * current state of the UIDFrame object.
mbed_official 3:5120491ba317 69 *
mbed_official 3:5120491ba317 70 * @return The size in bytes of the Eddystone-UID frame.
mbed_official 3:5120491ba317 71 */
mbed_official 3:5120491ba317 72 size_t getRawFrameSize(void) const;
mbed_official 3:5120491ba317 73
mbed_official 3:5120491ba317 74 /**
mbed_official 3:5120491ba317 75 * Get the Eddystone-UID namespace ID.
mbed_official 3:5120491ba317 76 *
mbed_official 3:5120491ba317 77 * @return A pointer to the namespace ID.
mbed_official 3:5120491ba317 78 */
mbed_official 3:5120491ba317 79 uint8_t* getUIDNamespaceID(void);
mbed_official 3:5120491ba317 80
mbed_official 3:5120491ba317 81 /**
mbed_official 3:5120491ba317 82 * Get the Eddystone-UID instance ID.
mbed_official 3:5120491ba317 83 *
mbed_official 3:5120491ba317 84 * @return A pointer to the instance ID.
mbed_official 3:5120491ba317 85 */
mbed_official 3:5120491ba317 86 uint8_t* getUIDInstanceID(void);
mbed_official 3:5120491ba317 87
mbed_official 3:5120491ba317 88 private:
mbed_official 3:5120491ba317 89 /**
mbed_official 3:5120491ba317 90 * The byte ID of an Eddystone-UID frame.
mbed_official 3:5120491ba317 91 */
mbed_official 3:5120491ba317 92 static const uint8_t FRAME_TYPE_UID = 0x00;
mbed_official 3:5120491ba317 93 /**
mbed_official 3:5120491ba317 94 * The size (in bytes) of an Eddystone-UID frame.
mbed_official 3:5120491ba317 95 */
mbed_official 3:5120491ba317 96 static const uint8_t FRAME_SIZE_UID = 20;
mbed_official 3:5120491ba317 97
mbed_official 3:5120491ba317 98 /**
mbed_official 3:5120491ba317 99 * The Eddystone-UID namespace ID.
mbed_official 3:5120491ba317 100 */
mbed_official 3:5120491ba317 101 UIDNamespaceID_t uidNamespaceID;
mbed_official 3:5120491ba317 102 /**
mbed_official 3:5120491ba317 103 * The Eddystone-UID instance ID.
mbed_official 3:5120491ba317 104 */
mbed_official 3:5120491ba317 105 UIDInstanceID_t uidInstanceID;
mbed_official 3:5120491ba317 106 };
mbed_official 3:5120491ba317 107
mbed_official 3:5120491ba317 108 #endif /* __UIDFRAME_H__ */