#include "Service.h"
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 ServiceInformation & | information (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. | |
Session * | getSession (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. | |
Session * | m_session |
This services type. | |
bool | m_receiveBroadcastMessages |
The session this service belongs to. | |
bool | m_isVisible |
Service::Service | ( | ServiceManager * | _owner, |
const ServiceInformation & | _info ) |
|
virtual |
Service::Service | ( | const std::string & | _url, |
const std::string & | _name, | ||
ot::serviceID_t | _id, | ||
const std::string & | _type, | ||
Session * | _session, | ||
bool | _showDebugInfo ) |
Constructor.
_url | The URL of this service |
_name | The name of this service |
_id | The ID of this service |
_session | The session this service belongs to |
|
inlinevirtual |
Deconstructor.
void Service::addToJsonObject | ( | ot::JsonValue & | _object, |
ot::JsonAllocator & | _allocator ) const |
Add the object contents to the provided JSON object.
_document | The JSON document (used to get the allocator) |
_object | The JSON object to add the contents to |
bool Service::checkAlive | ( | void | ) |
|
inline |
Will return the session this service belongs to.
|
inline |
Will return the ID of this service.
void Service::incrStartCounter | ( | void | ) |
|
inline |
|
inline |
Will return true if this service is visible.
|
inline |
Will return the name of this service.
|
inline |
|
virtual |
Will return the port numbers of this service.
Reimplemented in RelayService.
|
inline |
Will return true if this service wants to receive broadcast messages.
ot::app::RunResult Service::run | ( | const SessionInformation & | _sessionInformation, |
const std::string & | _url, | ||
ot::port_t | _port, | ||
ot::port_t | _websocketPort = 0 ) |
void Service::setHidden | ( | void | ) |
Will set the visible state of the service to false and notify all other services in the same session.
|
inline |
Will set the ID for this service.
_id | The ID to set |
|
inline |
Will set the name of this service.
_name | The name to set |
|
inline |
Will set the receive broadcast messages flag.
|
inline |
Will set the ip of this service.
_ip | The IP to set |
void Service::setVisible | ( | void | ) |
Will set the visible state of the service.
_isVisible | if true the service will appear as visible |
bool Service::shutdown | ( | void | ) |
|
inline |
|
virtual |
Will return a JSON string representing this service.
Reimplemented in RelayService.
|
inline |
Will return the type of this service.
|
inline |
|
inline |
Will return the ip of this service.
|
inline |
|
inline |
void Service::writeDataToValue | ( | ot::JsonValue & | _object, |
ot::JsonAllocator & | _allocator ) const |
|
protected |
This services name.
|
protected |
|
protected |
This services IP address.
|
protected |
The session this service belongs to.
|
protected |
This services type.
|
protected |
This services ID.