HiveMindBridge
Functions
MessageUtils Namespace Reference

Functions

MessageDTO createResponseMessage (uint32_t responseId, uint32_t msgSourceId, uint32_t msgDestinationId, UserCallTargetDTO moduleDestination, GenericResponseStatusDTO status, const std::string &ackMessage)
 
MessageDTO createFunctionListLengthResponseMessage (uint32_t responseId, uint32_t msgSourceId, uint32_t msgDestinationId, UserCallTargetDTO moduleDestination, uint32_t length)
 
MessageDTO createFunctionDescriptionResponseMessage (uint32_t responseId, uint32_t msgSourceId, uint32_t msgDestinationId, UserCallTargetDTO moduleDestination, FunctionDescriptionDTO functionDescription)
 
MessageDTO createFunctionCallRequest (uint32_t msgSourceId, uint32_t msgDestinationId, uint32_t requestId, UserCallTargetDTO moduleDestination, const std::string &callbackName, const CallbackArgs &args)
 
MessageDTO createFunctionCallRequest (uint32_t msgSourceId, uint32_t msgDestinationId, uint32_t requestId, UserCallTargetDTO moduleDestination, const std::string &callbackName)
 
std::optional< MessageDTO > createBytesMessage (uint32_t msgSourceId, uint32_t msgDestinationId, uint32_t requestId, uint32_t byteReqId, uint32_t packetNumber, bool lastPacket, uint8_t *payload, uint16_t payloadLength)
 
MessageDTO createGreetMessage ()
 
uint32_t generateRandomId ()
 

Detailed Description

Utilitary functions for message creation

Function Documentation

◆ createBytesMessage()

std::optional< MessageDTO > MessageUtils::createBytesMessage ( uint32_t  msgSourceId,
uint32_t  msgDestinationId,
uint32_t  requestId,
uint32_t  byteReqId,
uint32_t  packetNumber,
bool  lastPacket,
uint8_t *  payload,
uint16_t  payloadLength 
)

Create a message with a Bytes request. This only creates the message, and does NOT manage the packet numbering logic.

Parameters
msgSourceIdThe ID of this device
msgDestinationIdThe ID of the target device
requestIdThe ID of the request
byteReqIdThe ID of the Bytes request
packetNumberThe number of this packet
lastPacketWhether this is the last packet in the Bytes request
payloadThe section of the payload that constitutes this packet
payloadLengthThe length of the payload that constitutes this packet
Returns
Here is the caller graph for this function:

◆ createFunctionCallRequest() [1/2]

MessageDTO MessageUtils::createFunctionCallRequest ( uint32_t  msgSourceId,
uint32_t  msgDestinationId,
uint32_t  requestId,
UserCallTargetDTO  moduleDestination,
const std::string &  callbackName 
)

Create a message with a Function call request without arguments

Parameters
msgSourceIdThe ID of this device
msgDestinationIdThe ID of the target device
requestIdThe ID of the request
moduleDestinationThe module to send the message to
callbackNameThe name of the function
Returns
the created message

◆ createFunctionCallRequest() [2/2]

MessageDTO MessageUtils::createFunctionCallRequest ( uint32_t  msgSourceId,
uint32_t  msgDestinationId,
uint32_t  requestId,
UserCallTargetDTO  moduleDestination,
const std::string &  callbackName,
const CallbackArgs args 
)

Create a message with a Function call request with arguments

Parameters
msgSourceIdThe ID of this device
msgDestinationIdThe ID of the target device
requestIdThe ID of the request
moduleDestinationThe module to send the message to
callbackNameThe name of the function
argsThe args to pass to the function
Returns
the created message
Here is the caller graph for this function:

◆ createFunctionDescriptionResponseMessage()

MessageDTO MessageUtils::createFunctionDescriptionResponseMessage ( uint32_t  responseId,
uint32_t  msgSourceId,
uint32_t  msgDestinationId,
UserCallTargetDTO  moduleDestination,
FunctionDescriptionDTO  functionDescription 
)

Create a response message for a FunctionDescription request

Parameters
responseIdId of the request responded to
msgSourceIdSource of the response. Should correspond to the ID of this device.
msgDestinationIdDestination of the response.
moduleDestinationThe module to which the response should be addressed.
functionDescriptionThe description of the function
Returns
the created message

◆ createFunctionListLengthResponseMessage()

MessageDTO MessageUtils::createFunctionListLengthResponseMessage ( uint32_t  responseId,
uint32_t  msgSourceId,
uint32_t  msgDestinationId,
UserCallTargetDTO  moduleDestination,
uint32_t  length 
)

Create a response message for a FunctionListLength request

Parameters
responseIdId of the request responded to
msgSourceIdSource of the response. Should correspond to the ID of this device.
msgDestinationIdDestination of the response.
moduleDestinationThe module to which the response should be addressed.
lengththe length of the function list
Returns
the created message

◆ createGreetMessage()

MessageDTO MessageUtils::createGreetMessage ( )

Create a greet message

Returns
The created message
Here is the caller graph for this function:

◆ createResponseMessage()

MessageDTO MessageUtils::createResponseMessage ( uint32_t  responseId,
uint32_t  msgSourceId,
uint32_t  msgDestinationId,
UserCallTargetDTO  moduleDestination,
GenericResponseStatusDTO  status,
const std::string &  ackMessage 
)

Create a response message containing some parameters

Parameters
responseIdId of the request responded to
msgSourceIdSource of the response. Should correspond to the ID of this device.
msgDestinationIdDestination of the response.
moduleDestinationThe module to which the response should be addressed.
statusThe status of the processing of the message
ackMessageA string containing some details.
Returns
the created message

◆ generateRandomId()

uint32_t MessageUtils::generateRandomId ( )

Returns a suitable value to use as a requestId;

Here is the caller graph for this function: