Kenji Arai / TYBLE16_mbedlized_os5_several_examples_1st

Dependencies:   nRF51_Vdd TextLCD BME280

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TLMFrame.h Source File

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 class TLMFrame
00023 {
00024 public:
00025     TLMFrame(uint8_t  tlmVersionIn           = 0,
00026              uint16_t tlmBatteryVoltageIn    = 0,
00027              uint16_t tlmBeaconTemperatureIn = 0x8000,
00028              uint32_t tlmPduCountIn          = 0,
00029              uint32_t tlmTimeSinceBootIn     = 0);
00030 
00031     void setTLMData(uint8_t tlmVersionIn = 0);
00032 
00033     void constructTLMFrame(uint8_t *rawFrame);
00034 
00035     size_t getRawFrameSize(void) const;
00036 
00037     void updateTimeSinceBoot(uint32_t nowInMillis);
00038 
00039     void updateBatteryVoltage(uint16_t tlmBatteryVoltageIn);
00040 
00041     void updateBeaconTemperature(uint16_t tlmBeaconTemperatureIn);
00042 
00043     void updatePduCount(void);
00044 
00045     uint16_t getBatteryVoltage(void) const;
00046 
00047     uint16_t getBeaconTemperature(void) const;
00048 
00049     uint8_t getTLMVersion(void) const;
00050 
00051 private:
00052     static const uint8_t FRAME_TYPE_TLM = 0x20;
00053     static const uint8_t FRAME_SIZE_TLM = 14;
00054 
00055     uint8_t              tlmVersion;
00056     uint32_t             lastTimeSinceBootRead;
00057     uint16_t             tlmBatteryVoltage;
00058     uint16_t             tlmBeaconTemperature;
00059     uint32_t             tlmPduCount;
00060     uint32_t             tlmTimeSinceBoot;
00061 };
00062 
00063 #endif  /* __TLMFRAME_H__ */