OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
Service Class Reference

#include "Service.h"

Inheritance diagram for Service:
RelayService

Public Member Functions

 Service (ServiceManager *_owner, const ServiceInformation &_info)
 
virtual ~Service ()
 
void addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const
 Add the object contents to the provided JSON object.
 
ot::app::RunResult run (const SessionInformation &_sessionInformation, const std::string &_url, ot::port_t _port, ot::port_t _websocketPort=0)
 
bool shutdown (void)
 
bool checkAlive (void)
 
void incrStartCounter (void)
 
const ServiceInformationinformation (void) const
 
unsigned int startCounter (void) const
 
const std::string & url (void) const
 
ot::port_t port (void) const
 
const std::string & websocketUrl (void) const
 
ot::port_t websocketPort (void) const
 
 Service (const std::string &_url, const std::string &_name, ot::serviceID_t _id, const std::string &_type, Session *_session, bool _showDebugInfo)
 Constructor.
 
virtual ~Service ()
 Deconstructor.
 
void setURL (const std::string &_url)
 Will set the ip of this service.
 
void setName (const std::string &_name)
 Will set the name of this service.
 
void setID (ot::serviceID_t _id)
 Will set the ID for this service.
 
void setReceiveBroadcastMessages (bool _receive)
 Will set the receive broadcast messages flag.
 
void setVisible (void)
 Will set the visible state of the service.
 
void setHidden (void)
 Will set the visible state of the service to false and notify all other services in the same session.
 
std::string url (void) const
 Will return the ip of this service.
 
virtual std::list< unsigned long long > portNumbers (void) const
 Will return the port numbers of this service.
 
std::string name (void) const
 Will return the name of this service.
 
ot::serviceID_t id (void) const
 Will return the ID of this service.
 
std::string type (void) const
 Will return the type of this service.
 
SessiongetSession (void) const
 Will return the session this service belongs to.
 
bool receiveBroadcastMessages (void) const
 Will return true if this service wants to receive broadcast messages.
 
bool isVisible (void) const
 Will return true if this service is visible.
 
virtual std::string toJSON (void) const
 Will return a JSON string representing this service.
 
void writeDataToValue (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const
 

Protected Attributes

std::string m_name
 This services IP address.
 
ot::serviceID_t m_id
 This services name.
 
std::string m_type
 This services ID.
 
Sessionm_session
 This services type.
 
bool m_receiveBroadcastMessages
 The session this service belongs to.
 
bool m_isVisible
 

Constructor & Destructor Documentation

◆ Service() [1/2]

Service::Service ( ServiceManager * _owner,
const ServiceInformation & _info )

◆ ~Service() [1/2]

Service::~Service ( )
virtual

◆ Service() [2/2]

Service::Service ( const std::string & _url,
const std::string & _name,
ot::serviceID_t _id,
const std::string & _type,
Session * _session,
bool _showDebugInfo )

Constructor.

Parameters
_urlThe URL of this service
_nameThe name of this service
_idThe ID of this service
_sessionThe session this service belongs to

◆ ~Service() [2/2]

virtual Service::~Service ( )
inlinevirtual

Deconstructor.

Member Function Documentation

◆ addToJsonObject()

void Service::addToJsonObject ( ot::JsonValue & _object,
ot::JsonAllocator & _allocator ) const

Add the object contents to the provided JSON object.

Parameters
_documentThe JSON document (used to get the allocator)
_objectThe JSON object to add the contents to

◆ checkAlive()

bool Service::checkAlive ( void )

◆ getSession()

Session * Service::getSession ( void ) const
inline

Will return the session this service belongs to.

◆ id()

ot::serviceID_t Service::id ( void ) const
inline

Will return the ID of this service.

◆ incrStartCounter()

void Service::incrStartCounter ( void )

◆ information()

const ServiceInformation & Service::information ( void ) const
inline

◆ isVisible()

bool Service::isVisible ( void ) const
inline

Will return true if this service is visible.

◆ name()

std::string Service::name ( void ) const
inline

Will return the name of this service.

◆ port()

ot::port_t Service::port ( void ) const
inline

◆ portNumbers()

std::list< unsigned long long > Service::portNumbers ( void ) const
virtual

Will return the port numbers of this service.

Reimplemented in RelayService.

◆ receiveBroadcastMessages()

bool Service::receiveBroadcastMessages ( void ) const
inline

Will return true if this service wants to receive broadcast messages.

◆ run()

ot::app::RunResult Service::run ( const SessionInformation & _sessionInformation,
const std::string & _url,
ot::port_t _port,
ot::port_t _websocketPort = 0 )

◆ setHidden()

void Service::setHidden ( void )

Will set the visible state of the service to false and notify all other services in the same session.

◆ setID()

void Service::setID ( ot::serviceID_t _id)
inline

Will set the ID for this service.

Parameters
_idThe ID to set

◆ setName()

void Service::setName ( const std::string & _name)
inline

Will set the name of this service.

Parameters
_nameThe name to set

◆ setReceiveBroadcastMessages()

void Service::setReceiveBroadcastMessages ( bool _receive)
inline

Will set the receive broadcast messages flag.

◆ setURL()

void Service::setURL ( const std::string & _url)
inline

Will set the ip of this service.

Parameters
_ipThe IP to set

◆ setVisible()

void Service::setVisible ( void )

Will set the visible state of the service.

Parameters
_isVisibleif true the service will appear as visible

◆ shutdown()

bool Service::shutdown ( void )

◆ startCounter()

unsigned int Service::startCounter ( void ) const
inline

◆ toJSON()

std::string Service::toJSON ( void ) const
virtual

Will return a JSON string representing this service.

Reimplemented in RelayService.

◆ type()

std::string Service::type ( void ) const
inline

Will return the type of this service.

◆ url() [1/2]

const std::string & Service::url ( void ) const
inline

◆ url() [2/2]

std::string Service::url ( void ) const
inline

Will return the ip of this service.

◆ websocketPort()

ot::port_t Service::websocketPort ( void ) const
inline

◆ websocketUrl()

const std::string & Service::websocketUrl ( void ) const
inline

◆ writeDataToValue()

void Service::writeDataToValue ( ot::JsonValue & _object,
ot::JsonAllocator & _allocator ) const

Member Data Documentation

◆ m_id

ot::serviceID_t Service::m_id
protected

This services name.

◆ m_isVisible

bool Service::m_isVisible
protected

◆ m_name

std::string Service::m_name
protected

This services IP address.

◆ m_receiveBroadcastMessages

bool Service::m_receiveBroadcastMessages
protected

The session this service belongs to.

◆ m_session

Session* Service::m_session
protected

This services type.

◆ m_type

std::string Service::m_type
protected

This services ID.


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