ST
/
mbed-os-example-ble-EddystoneService
BLE EddystoneService example
Embed:
(wiki syntax)
Show/hide line numbers
UIDFrame.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2015 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __UIDFRAME_H__ 00018 #define __UIDFRAME_H__ 00019 00020 #include <string.h> 00021 #include "EddystoneTypes.h" 00022 00023 /** 00024 * Class that encapsulates data that belongs to the Eddystone-UID frame. For 00025 * more information refer to https://github.com/google/eddystone/tree/master/eddystone-uid. 00026 */ 00027 class UIDFrame 00028 { 00029 public: 00030 /** 00031 * Construct a new instance of this class. 00032 */ 00033 UIDFrame(void); 00034 00035 /** 00036 * Construct a new instance of this class. 00037 * 00038 * @param[in] uidNamespaceIDIn 00039 * The Eddystone-UID namespace ID. 00040 * @param[in] uidInstanceIDIn 00041 * The Eddystone-UID instance ID. 00042 */ 00043 UIDFrame(const UIDNamespaceID_t uidNamespaceIDIn, const UIDInstanceID_t uidInstanceIDIn); 00044 00045 /** 00046 * Set the instance and namespace ID. 00047 * 00048 * @param[in] uidNamespaceIDIn 00049 * The new Eddystone-UID namespace ID. 00050 * @param[in] uidInstanceIDIn 00051 * The new Eddystone-UID instance ID. 00052 */ 00053 void setUIDData(const UIDNamespaceID_t &uidNamespaceIDIn, const UIDInstanceID_t &uidInstanceIDIn); 00054 00055 /** 00056 * Construct the raw bytes of the Eddystone-UID frame that will be directly 00057 * used in the advertising packets. 00058 * 00059 * @param[in] rawFrame 00060 * Pointer to the location where the raw frame will be stored. 00061 * @param[in] advPowerLevel 00062 * Power level value included withing the raw frame. 00063 */ 00064 void constructUIDFrame(uint8_t *rawFrame, int8_t advPowerLevel); 00065 00066 /** 00067 * Get the size of the Eddystone-UID frame constructed with the 00068 * current state of the UIDFrame object. 00069 * 00070 * @return The size in bytes of the Eddystone-UID frame. 00071 */ 00072 size_t getRawFrameSize(void) const; 00073 00074 /** 00075 * Get the Eddystone-UID namespace ID. 00076 * 00077 * @return A pointer to the namespace ID. 00078 */ 00079 uint8_t* getUIDNamespaceID(void); 00080 00081 /** 00082 * Get the Eddystone-UID instance ID. 00083 * 00084 * @return A pointer to the instance ID. 00085 */ 00086 uint8_t* getUIDInstanceID(void); 00087 00088 private: 00089 /** 00090 * The byte ID of an Eddystone-UID frame. 00091 */ 00092 static const uint8_t FRAME_TYPE_UID = 0x00; 00093 /** 00094 * The size (in bytes) of an Eddystone-UID frame. 00095 */ 00096 static const uint8_t FRAME_SIZE_UID = 20; 00097 00098 /** 00099 * The Eddystone-UID namespace ID. 00100 */ 00101 UIDNamespaceID_t uidNamespaceID; 00102 /** 00103 * The Eddystone-UID instance ID. 00104 */ 00105 UIDInstanceID_t uidInstanceID; 00106 }; 00107 00108 #endif /* __UIDFRAME_H__ */
Generated on Tue Jul 12 2022 19:55:16 by 1.7.2