MeshProtocolSimulator  1.0.0
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
RawMessage Struct Reference

This structure represents raw message, that was sent between two virtual radios. It has no header and data are not structured. More...

#include <Emulator_helpers.h>

Public Member Functions

 RawMessage (uint8_t *message, uint8_t messageLength, std::chrono::nanoseconds _sentTime, std::chrono::nanoseconds _sendingDoneTime)
 
void Set (uint8_t *message, uint8_t messageLength, std::chrono::nanoseconds _sentTime, std::chrono::nanoseconds _sendingDoneTime)
 Sets message bytes. More...
 
void Get (uint8_t *message, uint8_t &messageLength) const
 Gets bytes from message. More...
 
void Clear ()
 Clears data stored in message.
 
std::chrono::nanoseconds SentTime () const
 Gets time, when message was sent. More...
 
std::chrono::nanoseconds ReceiveTime () const
 Gets time, when message will be available to receive. More...
 
uint32_t Length () const
 Gets length of stored message in bytes. More...
 
uint64_t GetUniqueIdentifier () const
 Gets unique identifier of current message. More...
 
bool IsTransacting (std::chrono::nanoseconds currentSimulationTime) const
 Checks if message is transacting right now. More...
 
bool IsInterfering (RawMessage &anotherMessage) const
 Checks if two messages are interfering each other. More...
 
std::string ConvertToBase64 ()
 Converts raw message to Base64. Structure of data is: More...
 

Static Public Member Functions

static void printFrameCompressed (uint64_t uniqueID, MeshFrame &msg)
 

Public Attributes

bool IsInterfered = false
 True when message was interfered.
 
MeshMAC SenderNodeMACAddress = 0
 MAC address of current message sender.
 

Protected Attributes

uint8_t payload [MESH_FRAME_SIZE_LIMIT]
 
uint8_t length = 0
 
std::chrono::nanoseconds sentTime = std::chrono::nanoseconds::zero()
 
std::chrono::nanoseconds receiveTime = std::chrono::nanoseconds::zero()
 
uint64_t uniqueIdentifier = 0
 

Static Protected Attributes

static uint64_t globalUniqueIdentifier = 1
 

Detailed Description

This structure represents raw message, that was sent between two virtual radios. It has no header and data are not structured.

Member Function Documentation

◆ ConvertToBase64()

std::string RawMessage::ConvertToBase64 ( )

Converts raw message to Base64. Structure of data is:

  • 8 bytes - sentTime in ns.
  • 8 bytes - receiveTime in ns.
  • 8 bytes - uniqueIdentifier.
  • 4 bytes - SenderNodeMACAddress.
  • 1 byte - data length.
  • x bytes - data of length data length.
    Returns
    Returns unique identifier of current message.

◆ Get()

void RawMessage::Get ( uint8_t *  message,
uint8_t &  messageLength 
) const

Gets bytes from message.

Parameters
[out]messageBuffer, where message will be copyied.
[out]messageLengthNumber of bytes copyied.

◆ GetUniqueIdentifier()

uint64_t RawMessage::GetUniqueIdentifier ( ) const
inline

Gets unique identifier of current message.

Returns
Returns unique identifier of current message.

◆ IsInterfering()

bool RawMessage::IsInterfering ( RawMessage anotherMessage) const

Checks if two messages are interfering each other.

Parameters
anotherMessageAnother message to check interference with current mssage.
Returns
Returns true when messages are interfering.

◆ IsTransacting()

bool RawMessage::IsTransacting ( std::chrono::nanoseconds  currentSimulationTime) const
inline

Checks if message is transacting right now.

Parameters
currentSimulationTimeCurrent simulation time, when to check transation state.
Returns
Returns true when message is transacting.

◆ Length()

uint32_t RawMessage::Length ( ) const
inline

Gets length of stored message in bytes.

Returns
Returns length of stored message in bytes.

◆ ReceiveTime()

std::chrono::nanoseconds RawMessage::ReceiveTime ( ) const
inline

Gets time, when message will be available to receive.

Returns
Time, when message will be available to receive.

◆ SentTime()

std::chrono::nanoseconds RawMessage::SentTime ( ) const
inline

Gets time, when message was sent.

Returns
Time, when message was sent.

◆ Set()

void RawMessage::Set ( uint8_t *  message,
uint8_t  messageLength,
std::chrono::nanoseconds  _sentTime,
std::chrono::nanoseconds  _sendingDoneTime 
)

Sets message bytes.

Parameters
[in]messageBuffer with message to set.
[in]messageLengthLength of message in bytes.
[in]_sentTimeTime, when message was sent.
[in]_sendingDoneTimeTime, when message sending will be stopped.

The documentation for this struct was generated from the following files: