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

« Back to documentation index

EIDFrame Class Reference

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

#include <EIDFrame.h>

Public Member Functions

 EIDFrame ()
 Construct a new instance of this class.
void clearFrame (uint8_t *frame)
 Clear frame (intervally indicated by length = 0 )
void setData (uint8_t *rawFrame, int8_t advTxPower, const uint8_t *eidData)
 Construct the raw bytes of the Eddystone-EID frame that will be directly used in the advertising packets.
uint8_t * getData (uint8_t *rawFrame)
 Get the EID frame data from the Eddystone-EID frame.
uint8_t getDataLength (uint8_t *rawFrame)
 Get the length of the EID frame data from the Eddystone-EID frame.
uint8_t * getAdvFrame (uint8_t *rawFrame)
 Get the EID Adv data from the Eddystone-EID frame.
uint8_t getAdvFrameLength (uint8_t *rawFrame)
 Get the length of the EID Adv data from the Eddystone-EID frame.
uint8_t * getEid (uint8_t *rawFrame)
 Get just the EID data from the Eddystone-EID frame.
uint8_t getEidLength (uint8_t *rawFrame)
 Get the length of just the EID data from the Eddystone-EID frame.
void setAdvTxPower (uint8_t *rawFrame, int8_t advTxPower)
 Set the Adv TX Power in the frame.
int genBeaconKeys (PrivateEcdhKey_t beaconPrivateEcdhKey, PublicEcdhKey_t beaconPublicEcdhKey)
 Generate the beacon private and public keys.
void update (uint8_t *rawFrame, uint8_t *eidIdentityKey, uint8_t rotationPeriodExp, uint32_t timeSecs)
 Update the EID frame.
int genEcdhSharedKey (PrivateEcdhKey_t beaconPrivateEcdhKey, PublicEcdhKey_t beaconPublicEcdhKey, PublicEcdhKey_t serverPublicEcdhKey, EidIdentityKey_t eidIdentityKey)
 genEcdhSharedKey generates the eik value for inclusion in the EID ADV packet

Static Public Attributes

static const uint8_t FRAME_TYPE_EID = 0x30
 The byte ID of an Eddystone-EID frame.

Detailed Description

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

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

Definition at line 34 of file EIDFrame.h.


Constructor & Destructor Documentation

EIDFrame (  )

Construct a new instance of this class.

Definition at line 22 of file EIDFrame.cpp.


Member Function Documentation

void clearFrame ( uint8_t *  frame )

Clear frame (intervally indicated by length = 0 )

Definition at line 31 of file EIDFrame.cpp.

int genBeaconKeys ( PrivateEcdhKey_t  beaconPrivateEcdhKey,
PublicEcdhKey_t  beaconPublicEcdhKey 
)

Generate the beacon private and public keys.

This should be called on every restart of the beacon.

Parameters:
[out]beaconPrivateEcdhKeyPointer to the beacon private key array.
[out]beaconPublicEcdhKeyPointer to the beacon public key array.

Definition at line 121 of file EIDFrame.cpp.

int genEcdhSharedKey ( PrivateEcdhKey_t  beaconPrivateEcdhKey,
PublicEcdhKey_t  beaconPublicEcdhKey,
PublicEcdhKey_t  serverPublicEcdhKey,
EidIdentityKey_t  eidIdentityKey 
)

genEcdhSharedKey generates the eik value for inclusion in the EID ADV packet

Parameters:
[in]beaconPrivateEcdhKeyThe beacon's private ECDH key, generated by genBeaconKeys()
[in]beaconPublicEcdhKeyThe beacon's public ECDH key, generated by genBeaconKeys()
[in]serverPublicEcdhKeyThe server's public ECDH key
[out]eidIdentityKeyIdentity key for this beacon and server combination

Definition at line 143 of file EIDFrame.cpp.

uint8_t * getAdvFrame ( uint8_t *  rawFrame )

Get the EID Adv data from the Eddystone-EID frame.

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-EID Adv frame data.

Definition at line 58 of file EIDFrame.cpp.

uint8_t getAdvFrameLength ( uint8_t *  rawFrame )

Get the length of the EID Adv data from the Eddystone-EID frame.

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

Definition at line 63 of file EIDFrame.cpp.

uint8_t * getData ( uint8_t *  rawFrame )

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

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

Definition at line 48 of file EIDFrame.cpp.

uint8_t getDataLength ( uint8_t *  rawFrame )

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

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

Definition at line 53 of file EIDFrame.cpp.

uint8_t * getEid ( uint8_t *  rawFrame )

Get just the EID data from the Eddystone-EID frame.

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

Definition at line 68 of file EIDFrame.cpp.

uint8_t getEidLength ( uint8_t *  rawFrame )

Get the length of just the EID data from the Eddystone-EID frame.

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

Definition at line 73 of file EIDFrame.cpp.

void setAdvTxPower ( uint8_t *  rawFrame,
int8_t  advTxPower 
)

Set the Adv TX Power in the frame.

This is necessary because the adv Tx Power might be updated independent of the data bytes

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

Definition at line 78 of file EIDFrame.cpp.

void setData ( uint8_t *  rawFrame,
int8_t  advTxPower,
const uint8_t *  eidData 
)

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

Parameters:
[in]rawFramePointer to the location where the raw frame will be stored.
[in]advPowerLevelPower level value included in the raw frame.
[in]eidDataThe actual 16-byte EID data in the raw frame.

Definition at line 36 of file EIDFrame.cpp.

void update ( uint8_t *  rawFrame,
uint8_t *  eidIdentityKey,
uint8_t  rotationPeriodExp,
uint32_t  timeSecs 
)

Update the EID frame.

Tests if its time to rotate the EID payload, and if due, calculates and establishes the new value

Parameters:
[in]*rawFramePointer to the location where the raw frame will be stored.
[in]*eidIdentityKeyEid key used to regenerate the EID id.
[in]rotationPeriodExpEID rotation time as an exponent k : 2^k seconds
[in]timeSecstime in seconds

Definition at line 84 of file EIDFrame.cpp.


Field Documentation

const uint8_t FRAME_TYPE_EID = 0x30 [static]

The byte ID of an Eddystone-EID frame.

Definition at line 186 of file EIDFrame.h.