SPSP
Simple publish-subscribe protocol. Connects low power IoT clients to MQTT.
Public Types | Public Member Functions | Protected Attributes | List of all members
SPSP::FarLayers::DummyFarLayer Class Reference

Dummy far layer for testing. More...

#include <layers_dummy.hpp>

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

Public Types

using PubsSetT = std::unordered_set< std::string >
 
using SubsSetT = std::unordered_set< std::string >
 
using SubsLogT = std::vector< std::string >
 

Public Member Functions

virtual bool publish (const std::string &src, const std::string &topic, const std::string &payload)
 Publishes message coming from node. More...
 
virtual bool subscribe (const std::string &topic)
 Subscribes to given topic. More...
 
virtual bool unsubscribe (const std::string &topic)
 Unsubscribes from given topic. More...
 
virtual void receiveDirect (const std::string &topic, const std::string &payload)
 Simulates reception of data from far layer. More...
 
const PubsSetT & getPubs ()
 Returns current publishes set. More...
 
const SubsSetT & getSubs ()
 Returns current subscriptions set. More...
 
const SubsLogT & getSubsLog ()
 Returns current subscriptions log. More...
 
const SubsLogT & getUnsubsLog ()
 Returns current unsubscriptions log. 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...
 

Protected Attributes

PubsSetT m_pubs
 
SubsSetT m_subs
 
SubsLogT m_subsLog
 
SubsLogT m_unsubsLog
 

Detailed Description

Dummy far layer for testing.

Definition at line 98 of file layers_dummy.hpp.

Member Function Documentation

◆ getPubs()

const PubsSetT& SPSP::FarLayers::DummyFarLayer::getPubs ( )
inline

Returns current publishes set.

Returns
Publishes set

Definition at line 175 of file layers_dummy.hpp.

◆ getSubs()

const SubsSetT& SPSP::FarLayers::DummyFarLayer::getSubs ( )
inline

Returns current subscriptions set.

Returns
Subscriptions set

Definition at line 185 of file layers_dummy.hpp.

◆ getSubsLog()

const SubsLogT& SPSP::FarLayers::DummyFarLayer::getSubsLog ( )
inline

Returns current subscriptions log.

Returns
Subscriptions log

Definition at line 195 of file layers_dummy.hpp.

◆ getUnsubsLog()

const SubsLogT& SPSP::FarLayers::DummyFarLayer::getUnsubsLog ( )
inline

Returns current unsubscriptions log.

Returns
Unsubscriptions log

Definition at line 205 of file layers_dummy.hpp.

◆ publish()

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

Publishes message coming from node.

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

Implements SPSP::IFarLayer.

Definition at line 121 of file layers_dummy.hpp.

◆ receiveDirect()

virtual void SPSP::FarLayers::DummyFarLayer::receiveDirect ( const std::string &  topic,
const std::string &  payload 
)
inlinevirtual

Simulates reception of data from far layer.

Parameters
topicTopic
payloadPayload (data)

Definition at line 162 of file layers_dummy.hpp.

◆ subscribe()

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

Subscribes to given topic.

Parameters
topicTopic
Returns
true Subscribe successful
false Subscribe failed

Implements SPSP::IFarLayer.

Definition at line 136 of file layers_dummy.hpp.

◆ unsubscribe()

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

Unsubscribes from given topic.

Parameters
topicTopic
Returns
true Unsubscribe successful
false Unsubscribe failed

Implements SPSP::IFarLayer.

Definition at line 150 of file layers_dummy.hpp.


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