Roy Want / Mbed OS beaconCompileReadyFork
Embed: (wiki syntax)

« Back to documentation index

TLMFrame Class Reference

Class that encapsulates data that belongs to the Eddystone-TLM frame. More...

#include <TLMFrame.h>

Public Member Functions

 TLMFrame (uint8_t tlmVersionIn=0, uint16_t tlmBatteryVoltageIn=0, uint16_t tlmBeaconTemperatureIn=0x8000, uint32_t tlmPduCountIn=0, uint32_t tlmTimeSinceBootIn=0)
 Construct a new instance of this class.
void setTLMData (uint8_t tlmVersionIn=0)
 Set the Eddystone-TLM version number.
void setData (uint8_t *rawFrame)
 Construct the raw bytes of the Eddystone-TLM frame that will be directly used in the advertising packets.
void encryptData (uint8_t *rawFrame, uint8_t *eidIdentityKey, uint8_t rotationPeriodExp, uint32_t beaconTimeSecs)
 Construct the encrypted bytes of the Eddystone-ETLM frame that will be directly used in the advertising packets.
size_t getRawFrameSize (uint8_t *rawFrame)
 Get the size of the Eddystone-TLM frame constructed with the current state of the TLMFrame object.
uint8_t * getData (uint8_t *rawFrame)
 Get the TLM frame data from the Eddystone-TLM frame.
uint8_t getDataLength (uint8_t *rawFrame)
 Get the length of the TLM frame data from the Eddystone-TLM frame.
uint8_t * getAdvFrame (uint8_t *rawFrame)
 Get the TLM Adv data from the Eddystone-TLMframe.
uint8_t getAdvFrameLength (uint8_t *rawFrame)
 Get the length of the TLM Adv data from the Eddystone-TLMframe.
void updateTimeSinceBoot (uint32_t nowInMillis)
 Update the time since boot.
void updateBatteryVoltage (uint16_t tlmBatteryVoltageIn)
 Update the Battery Voltage.
void updateBeaconTemperature (uint16_t tlmBeaconTemperatureIn)
 Update the Beacon Temperature.
void updatePduCount (void)
 Increment the current PDU counter by 1.
uint16_t getBatteryVoltage (void) const
 Get the current Battery Voltage.
uint16_t getBeaconTemperature (void) const
 Get the current Beacon Temperature.
uint8_t getTLMVersion (void) const
 Get the current TLM Version number.
int generateEtlmNonce (uint8_t *nonce, uint8_t rotatePeriodExp, uint32_t beaconTimeSecs)
 Constructs 6 byte (48-bit) Nonce from an empty array, rotationExp and beacon time (secs)

Static Public Attributes

static const uint8_t FRAME_TYPE_TLM = 0x20
 The byte ID of an Eddystone-TLM frame.
static const uint8_t DEFAULT_TLM_VERSION = 0
 The verison number of the Telemetry packets being used.
static const uint8_t FRAME_SIZE_TLM = 14
 The size of an Eddystone-TLM frame.
static const uint8_t FRAME_SIZE_ETLM = (FRAME_SIZE_TLM + 4)
 The size of an Eddystone-ETLM frame.

Detailed Description

Class that encapsulates data that belongs to the Eddystone-TLM frame.

For more information refer to https://github.com/google/eddystone/tree/master/eddystone-tlm.

Definition at line 27 of file TLMFrame.h.


Constructor & Destructor Documentation

TLMFrame ( uint8_t  tlmVersionIn = 0,
uint16_t  tlmBatteryVoltageIn = 0,
uint16_t  tlmBeaconTemperatureIn = 0x8000,
uint32_t  tlmPduCountIn = 0,
uint32_t  tlmTimeSinceBootIn = 0 
)

Construct a new instance of this class.

Parameters:
[in]tlmVersionInEddystone-TLM version number to use.
[in]tlmBatteryVoltageInInitial value for the Eddystone-TLM Battery Voltage.
[in]tlmBeaconTemperatureInInitial value for the Eddystone-TLM Beacon Temperature.
[in]tlmPduCountInInitial value for the Eddystone-TLM Advertising PDU Count.
[in]tlmTimeSinceBootInIntitial value for the Eddystone-TLM time since boot timer. 8 This timer has a 0.1 second resolution.

Definition at line 20 of file TLMFrame.cpp.


Member Function Documentation

void encryptData ( uint8_t *  rawFrame,
uint8_t *  eidIdentityKey,
uint8_t  rotationPeriodExp,
uint32_t  beaconTimeSecs 
)

Construct the encrypted bytes of the Eddystone-ETLM frame that will be directly used in the advertising packets.

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
[in]eidIdentityKeyPointer to the eidIdentityKey in use
[in]rotationPeriodExpRotation exponent for EID
[in]beaconTimeSecsTime in seconds since beacon boot.

Definition at line 68 of file TLMFrame.cpp.

int generateEtlmNonce ( uint8_t *  nonce,
uint8_t  rotatePeriodExp,
uint32_t  beaconTimeSecs 
)

Constructs 6 byte (48-bit) Nonce from an empty array, rotationExp and beacon time (secs)

Parameters:
[in]noncethe input and target nonce[] array
[in]rotationPeriodExpRotation exponent for EID
[in]beaconTimeSecsTime in seconds since beacon boot.
Returns:
[out] return code (success = 0)

Definition at line 178 of file TLMFrame.cpp.

uint8_t * getAdvFrame ( uint8_t *  rawFrame )

Get the TLM Adv data from the Eddystone-TLMframe.

This is the full service data included in the BLE service data params

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
Returns:
A pointer to the bytes of the Eddystone-TLM Adv frame data.

Definition at line 133 of file TLMFrame.cpp.

uint8_t getAdvFrameLength ( uint8_t *  rawFrame )

Get the length of the TLM Adv data from the Eddystone-TLMframe.

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
Returns:
The size in bytes of the Eddystone-TLM Adv frame data.

Definition at line 137 of file TLMFrame.cpp.

uint16_t getBatteryVoltage ( void   ) const

Get the current Battery Voltage.

Returns:
The Battery Voltage.

Definition at line 163 of file TLMFrame.cpp.

uint16_t getBeaconTemperature ( void   ) const

Get the current Beacon Temperature.

Returns:
The Beacon Temperature.

Definition at line 168 of file TLMFrame.cpp.

uint8_t * getData ( uint8_t *  rawFrame )

Get the TLM frame data from the Eddystone-TLM frame.

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
Returns:
A pointer to the bytes of the Eddystone-TLM frame data.

Definition at line 120 of file TLMFrame.cpp.

uint8_t getDataLength ( uint8_t *  rawFrame )

Get the length of the TLM frame data from the Eddystone-TLM frame.

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
Returns:
The size in bytes of the Eddystone-TLM frame.

Definition at line 128 of file TLMFrame.cpp.

size_t getRawFrameSize ( uint8_t *  rawFrame )

Get the size of the Eddystone-TLM frame constructed with the current state of the TLMFrame object.

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
Returns:
The size in bytes of the Eddystone-TLM frame.

Definition at line 115 of file TLMFrame.cpp.

uint8_t getTLMVersion ( void   ) const

Get the current TLM Version number.

Returns:
The TLM Version number.

Definition at line 173 of file TLMFrame.cpp.

void setData ( uint8_t *  rawFrame )

Construct the raw bytes of the Eddystone-TLM frame that will be directly used in the advertising packets.

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.

Definition at line 46 of file TLMFrame.cpp.

void setTLMData ( uint8_t  tlmVersionIn = 0 )

Set the Eddystone-TLM version number.

Definition at line 34 of file TLMFrame.cpp.

void updateBatteryVoltage ( uint16_t  tlmBatteryVoltageIn )

Update the Battery Voltage.

Parameters:
[in]tlmBatteryVoltageInThe new Battery Voltage value.

Definition at line 148 of file TLMFrame.cpp.

void updateBeaconTemperature ( uint16_t  tlmBeaconTemperatureIn )

Update the Beacon Temperature.

Parameters:
[in]tlmBeaconTemperatureInThe new Beacon Temperature value.

Definition at line 153 of file TLMFrame.cpp.

void updatePduCount ( void   )

Increment the current PDU counter by 1.

Definition at line 158 of file TLMFrame.cpp.

void updateTimeSinceBoot ( uint32_t  nowInMillis )

Update the time since boot.

Parameters:
[in]nowInMillisThe time since boot in milliseconds.

Definition at line 141 of file TLMFrame.cpp.


Field Documentation

const uint8_t DEFAULT_TLM_VERSION = 0 [static]

The verison number of the Telemetry packets being used.

Definition at line 191 of file TLMFrame.h.

const uint8_t FRAME_SIZE_ETLM = (FRAME_SIZE_TLM + 4) [static]

The size of an Eddystone-ETLM frame.

Definition at line 200 of file TLMFrame.h.

const uint8_t FRAME_SIZE_TLM = 14 [static]

The size of an Eddystone-TLM frame.

Definition at line 196 of file TLMFrame.h.

const uint8_t FRAME_TYPE_TLM = 0x20 [static]

The byte ID of an Eddystone-TLM frame.

Definition at line 186 of file TLMFrame.h.