Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TLMFrame.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 __TLMFRAME_H__ 00018 #define __TLMFRAME_H__ 00019 00020 #include "EddystoneTypes.h" 00021 00022 /** 00023 * Class that encapsulates data that belongs to the Eddystone-TLM frame. For 00024 * more information refer to https://github.com/google/eddystone/tree/master/eddystone-tlm. 00025 */ 00026 class TLMFrame 00027 { 00028 public: 00029 /** 00030 * Construct a new instance of this class. 00031 * 00032 * @param[in] tlmVersionIn 00033 * Eddystone-TLM version number to use. 00034 * @param[in] tlmBatteryVoltageIn 00035 * Initial value for the Eddystone-TLM Battery Voltage. 00036 * @param[in] tlmBeaconTemperatureIn 00037 * Initial value for the Eddystone-TLM Beacon Temperature. 00038 * @param[in] tlmPduCountIn 00039 * Initial value for the Eddystone-TLM Advertising PDU Count. 00040 * @param[in] tlmTimeSinceBootIn 00041 * Intitial value for the Eddystone-TLM time since boot timer. 00042 8 This timer has a 0.1 second resolution. 00043 */ 00044 TLMFrame(uint8_t tlmVersionIn = 0, 00045 uint16_t tlmBatteryVoltageIn = 0, 00046 uint16_t tlmBeaconTemperatureIn = 0x8000, 00047 uint32_t tlmPduCountIn = 0, 00048 uint32_t tlmTimeSinceBootIn = 0); 00049 00050 /** 00051 * Set the Eddystone-TLM version number. 00052 */ 00053 void setTLMData(uint8_t tlmVersionIn = 0); 00054 00055 /** 00056 * Construct the raw bytes of the Eddystone-TLM 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 */ 00062 void constructTLMFrame(uint8_t *rawFrame); 00063 00064 /** 00065 * Get the size of the Eddystone-TLM frame constructed with the 00066 * current state of the TLMFrame object. 00067 * 00068 * @return The size in bytes of the Eddystone-TLM frame. 00069 */ 00070 size_t getRawFrameSize(void) const; 00071 00072 /** 00073 * Update the time since boot. 00074 * 00075 * @param[in] nowInMillis 00076 * The time since boot in milliseconds. 00077 */ 00078 void updateTimeSinceBoot(uint32_t nowInMillis); 00079 00080 /** 00081 * Update the Battery Voltage. 00082 * 00083 * @param[in] tlmBatteryVoltageIn 00084 * The new Battery Voltage value. 00085 */ 00086 void updateBatteryVoltage(uint16_t tlmBatteryVoltageIn); 00087 00088 /** 00089 * Update the Beacon Temperature. 00090 * 00091 * @param[in] tlmBeaconTemperatureIn 00092 * The new Beacon Temperature value. 00093 */ 00094 void updateBeaconTemperature(uint16_t tlmBeaconTemperatureIn); 00095 00096 /** 00097 * Increment the current PDU counter by 1. 00098 */ 00099 void updatePduCount(void); 00100 00101 /** 00102 * Get the current Battery Voltage. 00103 * 00104 * @return The Battery Voltage. 00105 */ 00106 uint16_t getBatteryVoltage(void) const; 00107 00108 /** 00109 * Get the current Beacon Temperature. 00110 * 00111 * @return The Beacon Temperature. 00112 */ 00113 uint16_t getBeaconTemperature(void) const; 00114 00115 /** 00116 * Get the current TLM Version number. 00117 * 00118 * @return The TLM Version number. 00119 */ 00120 uint8_t getTLMVersion(void) const; 00121 00122 private: 00123 /** 00124 * The byte ID of an Eddystone-TLM frame. 00125 */ 00126 static const uint8_t FRAME_TYPE_TLM = 0x20; 00127 /** 00128 * The size of an Eddystone-TLM frame. 00129 */ 00130 static const uint8_t FRAME_SIZE_TLM = 14; 00131 00132 /** 00133 * Eddystone-TLM version value. 00134 */ 00135 uint8_t tlmVersion; 00136 /** 00137 * Time since boot in milliseconds. 00138 */ 00139 uint32_t lastTimeSinceBootRead; 00140 /** 00141 * Eddystone-TLM Battery Voltage value. 00142 */ 00143 uint16_t tlmBatteryVoltage; 00144 /** 00145 * Eddystone-TLM Beacon temperature value. 00146 */ 00147 uint16_t tlmBeaconTemperature; 00148 /** 00149 * Eddystone-TLM Advertising PDU Count. 00150 */ 00151 uint32_t tlmPduCount; 00152 /** 00153 * Eddystone-TLM time since boot with 0.1 second resolution. 00154 */ 00155 uint32_t tlmTimeSinceBoot; 00156 }; 00157 00158 #endif /* __TLMFRAME_H__ */
Generated on Tue Jul 12 2022 19:55:16 by
1.7.2