SPSP
Simple publish-subscribe protocol. Connects low power IoT clients to MQTT.
Public Member Functions | List of all members
SPSP::IFarLayer Class Referenceabstract

Interface for far layer. More...

#include <layers.hpp>

Inheritance diagram for SPSP::IFarLayer:
Inheritance graph
[legend]

Public Member Functions

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...
 
virtual bool publish (const std::string &src, const std::string &topic, const std::string &payload)=0
 Publishes message coming from node. More...
 
virtual bool subscribe (const std::string &topic)=0
 Subscribes to given topic. More...
 
virtual bool unsubscribe (const std::string &topic)=0
 Unsubscribes from given topic. More...
 

Detailed Description

Interface for far layer.

Definition at line 83 of file layers.hpp.

Member Function Documentation

◆ getNode()

IFarNode<IFarLayer>* SPSP::IFarLayer::getNode ( ) const
inline

Gets the node object.

Returns
Node pointer

Definition at line 103 of file layers.hpp.

◆ nodeConnected()

bool SPSP::IFarLayer::nodeConnected ( ) const
inline

Checks whether the owner node is connected.

Returns
true Node is connected
false Node is disconnected

Definition at line 114 of file layers.hpp.

◆ publish()

virtual bool SPSP::IFarLayer::publish ( const std::string &  src,
const std::string &  topic,
const std::string &  payload 
)
pure virtual

Publishes message coming from node.

Should be used by INode only!

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

Implemented in SPSP::FarLayers::DummyFarLayer, SPSP::FarLayers::MQTT::MQTT, and SPSP::FarLayers::LocalBroker::LocalBroker.

◆ setNode()

void SPSP::IFarLayer::setNode ( void *  n)
inline

Sets pointer to the owner node.

Parameters
nOwner node

Definition at line 93 of file layers.hpp.

◆ subscribe()

virtual bool SPSP::IFarLayer::subscribe ( const std::string &  topic)
pure virtual

Subscribes to given topic.

Should be used by INode only!

Parameters
topicTopic
Returns
true Subscribe successful
false Subscribe failed

Implemented in SPSP::FarLayers::DummyFarLayer, SPSP::FarLayers::MQTT::MQTT, and SPSP::FarLayers::LocalBroker::LocalBroker.

◆ unsubscribe()

virtual bool SPSP::IFarLayer::unsubscribe ( const std::string &  topic)
pure virtual

Unsubscribes from given topic.

Should be used by INode only!

Parameters
topicTopic
Returns
true Unsubscribe successful
false Unsubscribe failed

Implemented in SPSP::FarLayers::DummyFarLayer, SPSP::FarLayers::MQTT::MQTT, and SPSP::FarLayers::LocalBroker::LocalBroker.


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