5#ifndef PICOSCENES_PLATFORM_PICOSCENESMESSAGINGSERVICE_HXX
6#define PICOSCENES_PLATFORM_PICOSCENESMESSAGINGSERVICE_HXX
37 static std::shared_ptr<PicoScenesMessagingService>
getInstance(
const std::string &messagingChannelId =
"default");
69 void send(
const ModularPicoScenesRxFrame &rxFrame,
const std::string &destination,
const std::string &source,
const std::string &description =
"");
78 void send(
const ModularPicoScenesTxFrame &txFrame,
const std::string &destination,
const std::string &source,
const std::string &description =
"");
87 void send(
const std::string &textContent,
const std::string &destination,
const std::string &source,
const std::string &description =
"");
96 void send(
const pt::ptree &ptree,
const std::string &destination,
const std::string &source,
const std::string &description =
"");
105 void send(
const U8Vector &data,
const std::string &destination,
const std::string &source,
const std::string &description =
"");
115 void send(
const uint8_t *data,
size_t bufferLength,
const std::string &destination,
const std::string &source,
const std::string &description =
"");
136 bool serviceState =
true;
137 std::deque<UniversalMessageType> appendingMessageQueue;
138 std::mutex queueMutex;
139 std::mutex handleMutex;
140 std::deque<UniversalMessageType> messageQueue;
143 std::mutex queueOperationMutex;
144 std::condition_variable queueOperationCV;
151 void messagingServiceLoop();
std::tuple< std::any, std::string, std::string, std::string > UniversalMessageType
Universal message type for PicoScenes platform.
Messaging service for PicoScenes platform.
void send(const U8Vector &data, const std::string &destination, const std::string &source, const std::string &description="")
Send binary data message (vector)
void registerMessageHandler(const std::string &handlerName, std::function< void(const UniversalMessageType &)> handler)
Register message handler.
void clearMessageQueue()
Clear all pending messages @thread_safety Thread-safe operation.
void send(const std::string &textContent, const std::string &destination, const std::string &source, const std::string &description="")
Send text message.
void send(const ModularPicoScenesRxFrame &rxFrame, const std::string &destination, const std::string &source, const std::string &description="")
Send Rx frame message.
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)
static std::shared_ptr< PicoScenesMessagingService > getInstance(const std::string &messagingChannelId="default")
Get singleton instance for specified channel.
void send(const pt::ptree &ptree, const std::string &destination, const std::string &source, const std::string &description="")
Send property tree message.
void append2MessageQueue(const UniversalMessageType &message)
Add message to queue.
void unregisterHandler(const std::string &handlerName)
Unregister message handler.
static UniversalMessageType makeMessage(const std::any &object, const std::string &destination, const std::string &source, const std::string &description)
Create a universal message.
void send(const ModularPicoScenesTxFrame &txFrame, const std::string &destination, const std::string &source, const std::string &description="")
Send Tx frame message.