Appearance
class flake::ServiceImpl
#include <flake/ServiceImpl.h>
Inherits from flake::Service, flake::ObjectDelegate
Public Functions
| Name | |
|---|---|
| ServiceImpl(SyncManager * sync_manager) | |
| ~ServiceImpl() override | |
| virtual ServiceImpl * | asServiceImpl() override |
| virtual [void] | onInitialized() override This function is called when the service is initialized. |
| virtual [bool] | isInitialized() override Checks if the service is initialized. |
| virtual [int] | broadcast([string] command, PropArray & params) override Broadcasts a command with parameters. |
| virtual [int] | sync([int] timeout_ms) override |
| virtual [void] | defer() override |
| virtual [int] | syncDeferred([unsigned] timeout_ms, [bool] block) |
| virtual [bool] | hasDeferred() |
| virtual [int] | syncInt([int] timeout_ms, SyncType sync_type) |
| virtual [unsigned] | pendingBytes() override |
| virtual [void] | setMessageHook(std::function< [int]([const][string] &, PropArray &, PropArray &, [void] *)> cb, [void] * ctx) override |
| virtual [void] | setPropertyHook(std::function< [int]([uint32_t] tag, Property &value, [const]PropArray &[transaction], [bool], [void] *)> cb, [void] * ctx) override |
| virtual [void] | reset() override |
Protected Functions
| Name | |
|---|---|
| virtual Object * | handle() override |
| Connection * | connection() |
| virtual Property | get([uint32_t] tag) override |
| virtual [int] | set(Property & property) override |
| virtual [int] | on([string] message, std::function< [int](PropArray &, PropArray &)> cb) override |
| virtual [int] | get(PropArray & pa) override Retrieve multiple properties from the object. |
| virtual [int] | set(PropArray & pa) override Set multiple properties on the object. |
| virtual [int] | setPropertyRequested([uint32_t] tag, Property & value, [const]PropArray & transaction, [bool] internal) override |
| virtual [int] | getPropertyRequested([uint32_t] tag, Property & value) override |
| virtual [int8_t] | handleStreamOpen(Stream * s) override |
| virtual [int8_t] | handleStreamClose(Stream * s) override |
| virtual [int8_t] | handleStreamRead(Stream * s, [uint8_t] * cb, [uint16_t] * len, [uint16_t] max_len) override |
| virtual [int8_t] | handleStreamWrite(Stream * s, [uint8_t] * cb, [uint16_t] len) override |
| virtual [int8_t] | handleCustomMessage(std::string name, [const]PropArray & data, PropArray & outProps) override |
| virtual [void] | propertyChanged([const]Property & p) override |
| virtual [int] | openProperty([const][uint32_t] propTag, Stream ** stream) override |
Protected Attributes
| Name | |
|---|---|
| std::map< [uint32_t], [PropCallBackStreamRead] > | sr_callbacks |
| std::map< [uint32_t], [PropCallBackStreamWrite] > | sw_callbacks |
| std::map< [uint32_t], [PropCallBackStreamOpenClose] > | soc_callbacks |
| std::map< [uint32_t], [PropCallBackActionable] > | p_callbacks |
| std::map< [uint32_t], [PropCallBackPlain] > | p_callbacks_pod |
| std::map< std::string, std::function< [int](PropArray &, PropArray &)> > | m_callbacks |
| std::function< [int]([const][string] &, PropArray &, PropArray &, [void] *)> | m_messageHook |
| [void] * | m_messageHookCtx |
| std::function< [int]([uint32_t] tag, Property &value, [const]PropArray &[transaction], [bool], [void] *)> | m_propertyHook |
| [void] * | m_propertyHookCtx |
Friends
| Name | |
|---|---|
| [class] | ObjectImpl(ObjectImpl ) |
Additional inherited members
Public Functions inherited from flake::Service
| Name | |
|---|---|
| virtual | ~Service() =default |
| template <uint32_t PropTag> [int] | onRead([PropCallBackStreamRead] cb) |
| template <uint32_t PropTag> [int] | onOpenClose([PropCallBackStreamOpenClose] cb) |
| template <uint32_t PropTag> [int] | onWrite([PropCallBackStreamWrite] cb) |
Public Functions inherited from flake::ObjectDelegate
| Name | |
|---|---|
| virtual | ~ObjectDelegate() =default |
Public Functions Documentation
function ServiceImpl
cpp
ServiceImpl(
SyncManager * sync_manager
)function ~ServiceImpl
cpp
~ServiceImpl() overridefunction asServiceImpl
cpp
inline virtual ServiceImpl * asServiceImpl() overrideReimplements: flake::Service::asServiceImpl
function onInitialized
cpp
virtual void onInitialized() overrideThis function is called when the service is initialized.
Reimplements: flake::Service::onInitialized
This function should be overridden in derived classes to perform any necessary initialization tasks when the service is initialized.
function isInitialized
cpp
virtual bool isInitialized() overrideChecks if the service is initialized.
Return: bool True if the service is initialized, otherwise false.
Reimplements: flake::Service::isInitialized
This function returns a boolean value indicating whether the service is initialized or not.
function broadcast
cpp
virtual int broadcast(
string command,
PropArray & params
) overrideBroadcasts a command with parameters.
Parameters:
- command The command to be broadcasted.
- params The parameters associated with the command.
Return: int The result of the broadcast. Returns 0 if the broadcast is successful. Returns an error code if the broadcast fails.
Reimplements: flake::Service::broadcast
This function sends a command with parameters to all interested listeners. It should be called when you want to notify other entities about an event or action.
function sync
cpp
virtual int sync(
int timeout_ms
) overrideReimplements: flake::Service::sync
function defer
cpp
virtual void defer() overrideReimplements: flake::Service::defer
function syncDeferred
cpp
virtual int syncDeferred(
unsigned timeout_ms,
bool block
)Reimplements: flake::Service::syncDeferred
function hasDeferred
cpp
virtual bool hasDeferred()Reimplements: flake::Service::hasDeferred
function syncInt
cpp
virtual int syncInt(
int timeout_ms,
SyncType sync_type
)function pendingBytes
cpp
virtual unsigned pendingBytes() overrideReimplements: flake::Service::pendingBytes
function setMessageHook
cpp
virtual void setMessageHook(
std::function< int(conststring &, PropArray &, PropArray &, void *)> cb,
void * ctx
) overrideReimplements: flake::Service::setMessageHook
function setPropertyHook
cpp
virtual void setPropertyHook(
std::function< int(uint32_t tag, Property &value, constPropArray &transaction, bool, void *)> cb,
void * ctx
) overrideReimplements: flake::Service::setPropertyHook
function reset
cpp
virtual void reset() overrideReimplements: flake::Service::reset
Protected Functions Documentation
function handle
cpp
inline virtual Object * handle() overrideReimplements: flake::ObjectDelegate::handle
function connection
cpp
Connection * connection()function get
cpp
virtual Property get(
uint32_t tag
) overrideReimplements: flake::Service::get
function set
cpp
virtual int set(
Property & property
) overrideReimplements: flake::Service::set
function on
cpp
virtual int on(
string message,
std::function< int(PropArray &, PropArray &)> cb
) overrideReimplements: flake::Service::on
function get
cpp
virtual int get(
PropArray & pa
) overrideRetrieve multiple properties from the object.
Parameters:
- pa A reference to an empty PropArray object to be populated.
Return: An integer representing the result of the operation.
- E_FAILED: If none of the properties could be retrieved
- E_PARTIAL_SUCCESS: if some of the properties could be retrieved
- E_OK: if all of the properties could be retrieved.
Reimplements: flake::Service::get
function set
cpp
virtual int set(
PropArray & pa
) overrideSet multiple properties on the object.
Parameters:
- pa The PropArray object containing the properties to be set
Return: An integer representing the result of the operation.
- E_FAILED: If none of the properties could be set
- E_PARTIAL_SUCCESS: if some of the properties could be set
- E_OK: if all of the properties could be set.
- E_REFUSED: if called from within a property-callback, registered with on
Note: : mind, that you cannot call set from within a property-callback you registered with on
Reimplements: flake::Service::set
function setPropertyRequested
cpp
virtual int setPropertyRequested(
uint32_t tag,
Property & value,
constPropArray & transaction,
bool internal
) overrideReimplements: flake::ObjectDelegate::setPropertyRequested
function getPropertyRequested
cpp
virtual int getPropertyRequested(
uint32_t tag,
Property & value
) overrideReimplements: flake::ObjectDelegate::getPropertyRequested
function handleStreamOpen
cpp
virtual int8_t handleStreamOpen(
Stream * s
) overrideReimplements: flake::ObjectDelegate::handleStreamOpen
function handleStreamClose
cpp
virtual int8_t handleStreamClose(
Stream * s
) overrideReimplements: flake::ObjectDelegate::handleStreamClose
function handleStreamRead
cpp
virtual int8_t handleStreamRead(
Stream * s,
uint8_t * cb,
uint16_t * len,
uint16_t max_len
) overrideReimplements: flake::ObjectDelegate::handleStreamRead
function handleStreamWrite
cpp
virtual int8_t handleStreamWrite(
Stream * s,
uint8_t * cb,
uint16_t len
) overrideReimplements: flake::ObjectDelegate::handleStreamWrite
function handleCustomMessage
cpp
virtual int8_t handleCustomMessage(
std::string name,
constPropArray & data,
PropArray & outProps
) overrideReimplements: flake::ObjectDelegate::handleCustomMessage
function propertyChanged
cpp
virtual void propertyChanged(
constProperty & p
) overrideReimplements: flake::ObjectDelegate::propertyChanged
function openProperty
cpp
virtual int openProperty(
constuint32_t propTag,
Stream ** stream
) overrideReimplements: flake::Service::openProperty
Protected Attributes Documentation
variable sr_callbacks
cpp
std::map<uint32_t, PropCallBackStreamRead> flake::ServiceImpl::sr_callbacksvariable sw_callbacks
cpp
std::map<uint32_t, PropCallBackStreamWrite> flake::ServiceImpl::sw_callbacksvariable soc_callbacks
cpp
std::map<uint32_t, PropCallBackStreamOpenClose> flake::ServiceImpl::soc_callbacksvariable p_callbacks
cpp
std::map<uint32_t, PropCallBackActionable> flake::ServiceImpl::p_callbacksvariable p_callbacks_pod
cpp
std::map<uint32_t, PropCallBackPlain> flake::ServiceImpl::p_callbacks_podvariable m_callbacks
cpp
std::map<std::string, std::function<int (PropArray&, PropArray&)> > flake::ServiceImpl::m_callbacksvariable m_messageHook
cpp
std::function<int (const string&, PropArray&, PropArray&, void*)> flake::ServiceImpl::m_messageHookvariable m_messageHookCtx
cpp
void* flake::ServiceImpl::m_messageHookCtxvariable m_propertyHook
cpp
std::function<int (uint32_t tag, Property &value, const PropArray &transaction, bool, void*)> flake::ServiceImpl::m_propertyHookvariable m_propertyHookCtx
cpp
void* flake::ServiceImpl::m_propertyHookCtxFriends
friend ObjectImpl
cpp
friend class ObjectImpl(
ObjectImpl
);