Eddystone Beacon only for TYBLE16
Please refer flowing link.
/users/kenjiArai/notebook/tyble16-module-will-become-a-mbed-family--mbedliza/
Eddystone/TLMFrame.h@0:5087fec653b2, 2018-02-25 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Feb 25 02:26:02 2018 +0000
- Revision:
- 0:5087fec653b2
Eddystone Beacon only for TYBLE16
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:5087fec653b2 | 1 | /* mbed Microcontroller Library |
kenjiArai | 0:5087fec653b2 | 2 | * Copyright (c) 2006-2015 ARM Limited |
kenjiArai | 0:5087fec653b2 | 3 | * |
kenjiArai | 0:5087fec653b2 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kenjiArai | 0:5087fec653b2 | 5 | * you may not use this file except in compliance with the License. |
kenjiArai | 0:5087fec653b2 | 6 | * You may obtain a copy of the License at |
kenjiArai | 0:5087fec653b2 | 7 | * |
kenjiArai | 0:5087fec653b2 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kenjiArai | 0:5087fec653b2 | 9 | * |
kenjiArai | 0:5087fec653b2 | 10 | * Unless required by applicable law or agreed to in writing, software |
kenjiArai | 0:5087fec653b2 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kenjiArai | 0:5087fec653b2 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kenjiArai | 0:5087fec653b2 | 13 | * See the License for the specific language governing permissions and |
kenjiArai | 0:5087fec653b2 | 14 | * limitations under the License. |
kenjiArai | 0:5087fec653b2 | 15 | */ |
kenjiArai | 0:5087fec653b2 | 16 | |
kenjiArai | 0:5087fec653b2 | 17 | #ifndef __TLMFRAME_H__ |
kenjiArai | 0:5087fec653b2 | 18 | #define __TLMFRAME_H__ |
kenjiArai | 0:5087fec653b2 | 19 | |
kenjiArai | 0:5087fec653b2 | 20 | #include "EddystoneTypes.h" |
kenjiArai | 0:5087fec653b2 | 21 | |
kenjiArai | 0:5087fec653b2 | 22 | class TLMFrame |
kenjiArai | 0:5087fec653b2 | 23 | { |
kenjiArai | 0:5087fec653b2 | 24 | public: |
kenjiArai | 0:5087fec653b2 | 25 | TLMFrame(uint8_t tlmVersionIn = 0, |
kenjiArai | 0:5087fec653b2 | 26 | uint16_t tlmBatteryVoltageIn = 0, |
kenjiArai | 0:5087fec653b2 | 27 | uint16_t tlmBeaconTemperatureIn = 0x8000, |
kenjiArai | 0:5087fec653b2 | 28 | uint32_t tlmPduCountIn = 0, |
kenjiArai | 0:5087fec653b2 | 29 | uint32_t tlmTimeSinceBootIn = 0); |
kenjiArai | 0:5087fec653b2 | 30 | |
kenjiArai | 0:5087fec653b2 | 31 | void setTLMData(uint8_t tlmVersionIn = 0); |
kenjiArai | 0:5087fec653b2 | 32 | |
kenjiArai | 0:5087fec653b2 | 33 | void constructTLMFrame(uint8_t *rawFrame); |
kenjiArai | 0:5087fec653b2 | 34 | |
kenjiArai | 0:5087fec653b2 | 35 | size_t getRawFrameSize(void) const; |
kenjiArai | 0:5087fec653b2 | 36 | |
kenjiArai | 0:5087fec653b2 | 37 | void updateTimeSinceBoot(uint32_t nowInMillis); |
kenjiArai | 0:5087fec653b2 | 38 | |
kenjiArai | 0:5087fec653b2 | 39 | void updateBatteryVoltage(uint16_t tlmBatteryVoltageIn); |
kenjiArai | 0:5087fec653b2 | 40 | |
kenjiArai | 0:5087fec653b2 | 41 | void updateBeaconTemperature(uint16_t tlmBeaconTemperatureIn); |
kenjiArai | 0:5087fec653b2 | 42 | |
kenjiArai | 0:5087fec653b2 | 43 | void updatePduCount(void); |
kenjiArai | 0:5087fec653b2 | 44 | |
kenjiArai | 0:5087fec653b2 | 45 | uint16_t getBatteryVoltage(void) const; |
kenjiArai | 0:5087fec653b2 | 46 | |
kenjiArai | 0:5087fec653b2 | 47 | uint16_t getBeaconTemperature(void) const; |
kenjiArai | 0:5087fec653b2 | 48 | |
kenjiArai | 0:5087fec653b2 | 49 | uint8_t getTLMVersion(void) const; |
kenjiArai | 0:5087fec653b2 | 50 | |
kenjiArai | 0:5087fec653b2 | 51 | private: |
kenjiArai | 0:5087fec653b2 | 52 | static const uint8_t FRAME_TYPE_TLM = 0x20; |
kenjiArai | 0:5087fec653b2 | 53 | static const uint8_t FRAME_SIZE_TLM = 14; |
kenjiArai | 0:5087fec653b2 | 54 | |
kenjiArai | 0:5087fec653b2 | 55 | uint8_t tlmVersion; |
kenjiArai | 0:5087fec653b2 | 56 | uint32_t lastTimeSinceBootRead; |
kenjiArai | 0:5087fec653b2 | 57 | uint16_t tlmBatteryVoltage; |
kenjiArai | 0:5087fec653b2 | 58 | uint16_t tlmBeaconTemperature; |
kenjiArai | 0:5087fec653b2 | 59 | uint32_t tlmPduCount; |
kenjiArai | 0:5087fec653b2 | 60 | uint32_t tlmTimeSinceBoot; |
kenjiArai | 0:5087fec653b2 | 61 | }; |
kenjiArai | 0:5087fec653b2 | 62 | |
kenjiArai | 0:5087fec653b2 | 63 | #endif /* __TLMFRAME_H__ */ |