PicoScenes API Docs
 
Loading...
Searching...
No Matches
PicoScenesMessagingService Class Reference

Messaging service for PicoScenes platform. More...

#include <PicoScenesMessagingService.hxx>

Public Member Functions

void append2MessageQueue (const UniversalMessageType &message)
 Add message to queue.
 
void clearMessageQueue ()
 Clear all pending messages @thread_safety Thread-safe operation.
 
void send (const ModularPicoScenesRxFrame &rxFrame, const std::string &destination, const std::string &source, const std::string &description="")
 Send Rx frame message.
 
void send (const ModularPicoScenesTxFrame &txFrame, const std::string &destination, const std::string &source, const std::string &description="")
 Send Tx frame message.
 
void send (const std::string &textContent, const std::string &destination, const std::string &source, const std::string &description="")
 Send text message.
 
void send (const pt::ptree &ptree, const std::string &destination, const std::string &source, const std::string &description="")
 Send property tree message.
 
void send (const U8Vector &data, const std::string &destination, const std::string &source, const std::string &description="")
 Send binary data message (vector)
 
void send (const uint8_t *data, size_t bufferLength, const std::string &destination, const std::string &source, const std::string &description="")
 Send binary data message (raw buffer)
 
void registerMessageHandler (const std::string &handlerName, std::function< void(const UniversalMessageType &)> handler)
 Register message handler.
 
void unregisterHandler (const std::string &handlerName)
 Unregister message handler.
 

Static Public Member Functions

static std::shared_ptr< PicoScenesMessagingServicegetInstance (const std::string &messagingChannelId="default")
 Get singleton instance for specified channel.
 
static UniversalMessageType makeMessage (const std::any &object, const std::string &destination, const std::string &source, const std::string &description)
 Create a universal message.
 

Detailed Description

Messaging service for PicoScenes platform.

Implements a singleton-based messaging system that supports:

  • Multiple message channels
  • Various message types (frames, text, binary data)
  • Thread-safe message handling
  • Dynamic handler registration

Definition at line 30 of file PicoScenesMessagingService.hxx.

Member Function Documentation

◆ append2MessageQueue()

void PicoScenesMessagingService::append2MessageQueue ( const UniversalMessageType message)

Add message to queue.

Parameters
messageMessage to append @thread_safety Thread-safe operation

◆ clearMessageQueue()

void PicoScenesMessagingService::clearMessageQueue ( )

Clear all pending messages @thread_safety Thread-safe operation.

◆ getInstance()

static std::shared_ptr< PicoScenesMessagingService > PicoScenesMessagingService::getInstance ( const std::string &  messagingChannelId = "default")
static

Get singleton instance for specified channel.

Parameters
messagingChannelIdChannel identifier (defaults to "default")
Returns
Shared pointer to messaging service instance

◆ makeMessage()

static UniversalMessageType PicoScenesMessagingService::makeMessage ( const std::any &  object,
const std::string &  destination,
const std::string &  source,
const std::string &  description 
)
static

Create a universal message.

Parameters
objectMessage payload
destinationTarget identifier
sourceSender identifier
descriptionMessage description
Returns
Constructed universal message

◆ registerMessageHandler()

void PicoScenesMessagingService::registerMessageHandler ( const std::string &  handlerName,
std::function< void(const UniversalMessageType &)>  handler 
)

Register message handler.

Parameters
handlerNameUnique handler identifier
handlerHandler function @thread_safety Thread-safe operation

◆ send() [1/6]

void PicoScenesMessagingService::send ( const ModularPicoScenesRxFrame &  rxFrame,
const std::string &  destination,
const std::string &  source,
const std::string &  description = "" 
)

Send Rx frame message.

Parameters
rxFrameReceive frame to send
destinationTarget identifier
sourceSender identifier
descriptionOptional message description

◆ send() [2/6]

void PicoScenesMessagingService::send ( const ModularPicoScenesTxFrame &  txFrame,
const std::string &  destination,
const std::string &  source,
const std::string &  description = "" 
)

Send Tx frame message.

Parameters
txFrameTransmit frame to send
destinationTarget identifier
sourceSender identifier
descriptionOptional message description

◆ send() [3/6]

void PicoScenesMessagingService::send ( const pt::ptree &  ptree,
const std::string &  destination,
const std::string &  source,
const std::string &  description = "" 
)

Send property tree message.

Parameters
ptreeProperty tree to send
destinationTarget identifier
sourceSender identifier
descriptionOptional message description

◆ send() [4/6]

void PicoScenesMessagingService::send ( const std::string &  textContent,
const std::string &  destination,
const std::string &  source,
const std::string &  description = "" 
)

Send text message.

Parameters
textContentText content to send
destinationTarget identifier
sourceSender identifier
descriptionOptional message description

◆ send() [5/6]

void PicoScenesMessagingService::send ( const U8Vector &  data,
const std::string &  destination,
const std::string &  source,
const std::string &  description = "" 
)

Send binary data message (vector)

Parameters
dataBinary data vector
destinationTarget identifier
sourceSender identifier
descriptionOptional message description

◆ send() [6/6]

void PicoScenesMessagingService::send ( const uint8_t *  data,
size_t  bufferLength,
const std::string &  destination,
const std::string &  source,
const std::string &  description = "" 
)

Send binary data message (raw buffer)

Parameters
dataPointer to data buffer
bufferLengthLength of buffer
destinationTarget identifier
sourceSender identifier
descriptionOptional message description

◆ unregisterHandler()

void PicoScenesMessagingService::unregisterHandler ( const std::string &  handlerName)

Unregister message handler.

Parameters
handlerNameHandler identifier to remove @thread_safety Thread-safe operation

The documentation for this class was generated from the following file: