SPSP
Simple publish-subscribe protocol. Connects low power IoT clients to MQTT.
All Classes Files Functions Variables Typedefs Enumerations
Public Member Functions | List of all members
SPSP::FarLayers::LocalBroker::LocalBroker Class Reference

Local broker far layer. More...

#include <local_broker.hpp>

Inheritance diagram for SPSP::FarLayers::LocalBroker::LocalBroker:
Inheritance graph
[legend]
Collaboration diagram for SPSP::FarLayers::LocalBroker::LocalBroker:
Collaboration graph
[legend]

Public Member Functions

 LocalBroker (const std::string topicPrefix="spsp")
 Constructs a new local broker object. More...
 
 ~LocalBroker ()
 Destroys local broker layer object. More...
 
bool publish (const std::string &src, const std::string &topic, const std::string &payload)
 Publishes message coming from node. More...
 
bool subscribe (const std::string &topic)
 Subscribes to given topic. More...
 
bool unsubscribe (const std::string &topic)
 Unsubscribes from given topic. More...
 
- Public Member Functions inherited from SPSP::IFarLayer
void setNode (void *n)
 Sets pointer to the owner node. More...
 
IFarNode< IFarLayer > * getNode () const
 Gets the node object. More...
 
bool nodeConnected () const
 Checks whether the owner node is connected. More...
 

Detailed Description

Local broker far layer.

Acts as local MQTT server.

Definition at line 26 of file local_broker.hpp.

Constructor & Destructor Documentation

◆ LocalBroker()

SPSP::FarLayers::LocalBroker::LocalBroker::LocalBroker ( const std::string  topicPrefix = "spsp")

Constructs a new local broker object.

Parameters
topicPrefixTopic prefix for publishing

◆ ~LocalBroker()

SPSP::FarLayers::LocalBroker::LocalBroker::~LocalBroker ( )

Destroys local broker layer object.

Member Function Documentation

◆ publish()

bool SPSP::FarLayers::LocalBroker::LocalBroker::publish ( const std::string &  src,
const std::string &  topic,
const std::string &  payload 
)
virtual

Publishes message coming from node.

Parameters
srcSource address
topicTopic
payloadPayload (data)
Returns
true Delivery successful
false Delivery failed

Implements SPSP::IFarLayer.

◆ subscribe()

bool SPSP::FarLayers::LocalBroker::LocalBroker::subscribe ( const std::string &  topic)
virtual

Subscribes to given topic.

Should be used by INode only!

Parameters
topicTopic
Returns
true Subscribe successful
false Subscribe failed

Implements SPSP::IFarLayer.

◆ unsubscribe()

bool SPSP::FarLayers::LocalBroker::LocalBroker::unsubscribe ( const std::string &  topic)
virtual

Unsubscribes from given topic.

Should be used by INode only!

Parameters
topicTopic
Returns
true Unsubscribe successful
false Unsubscribe failed

Implements SPSP::IFarLayer.


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