#include <src/dbus/server/dbus_object.hpp>
|
using | MethodHandlerType = std::function< void(DBusRequest &)> |
|
using | PropertyHandlerType = std::function< otError(DBusMessageIter &)> |
|
|
| DBusObject (DBusConnection *aConnection, const std::string &aObjectPath) |
|
virtual otbrError | Init (void) |
|
void | RegisterMethod (const std::string &aInterfaceName, const std::string &aMethodName, const MethodHandlerType &aHandler) |
|
virtual void | RegisterGetPropertyHandler (const std::string &aInterfaceName, const std::string &aPropertyName, const PropertyHandlerType &aHandler) |
|
virtual void | RegisterSetPropertyHandler (const std::string &aInterfaceName, const std::string &aPropertyName, const PropertyHandlerType &aHandler) |
|
template<typename... FieldTypes> |
otbrError | Signal (const std::string &aInterfaceName, const std::string &aSignalName, const std::tuple< FieldTypes... > &aArgs) |
|
template<typename ValueType > |
otbrError | SignalPropertyChanged (const std::string &aInterfaceName, const std::string &aPropertyName, const ValueType &aValue) |
|
virtual | ~DBusObject (void) |
|
void | Flush (void) |
|
This class is a base class for implementing a d-bus object.
◆ DBusObject()
otbr::DBus::DBusObject::DBusObject |
( |
DBusConnection * |
aConnection, |
|
|
const std::string & |
aObjectPath |
|
) |
| |
The constructor of a d-bus object.
- Parameters
-
[in] | aConnection | The dbus-connection the object bounds to. |
[in] | aObjectPath | The path of the object. |
◆ ~DBusObject()
otbr::DBus::DBusObject::~DBusObject |
( |
void |
| ) |
|
|
virtual |
The destructor of a d-bus object.
◆ Flush()
void otbr::DBus::DBusObject::Flush |
( |
void |
| ) |
|
Sends all outgoing messages, blocks until the message queue is empty.
◆ Init()
otbrError otbr::DBus::DBusObject::Init |
( |
void |
| ) |
|
|
virtual |
This method initializes the d-bus object.
This method will register the object to the d-bus library.
- Return values
-
OTBR_ERROR_NONE | Successfully registered the object. |
OTBR_ERROR_DBUS | Failed to ragister an object. |
Reimplemented in otbr::DBus::DBusThreadObject.
◆ RegisterGetPropertyHandler()
void otbr::DBus::DBusObject::RegisterGetPropertyHandler |
( |
const std::string & |
aInterfaceName, |
|
|
const std::string & |
aPropertyName, |
|
|
const PropertyHandlerType & |
aHandler |
|
) |
| |
|
virtual |
This method registers the get handler for a property.
- Parameters
-
[in] | aInterfaceName | The interface name. |
[in] | aPropertyName | The property name. |
[in] | aHandler | The method handler. |
Reimplemented in otbr::DBus::DBusThreadObject.
◆ RegisterMethod()
void otbr::DBus::DBusObject::RegisterMethod |
( |
const std::string & |
aInterfaceName, |
|
|
const std::string & |
aMethodName, |
|
|
const MethodHandlerType & |
aHandler |
|
) |
| |
This method registers the method handler.
- Parameters
-
[in] | aInterfaceName | The interface name. |
[in] | aMethodName | The method name. |
[in] | aHandler | The method handler. |
◆ RegisterSetPropertyHandler()
void otbr::DBus::DBusObject::RegisterSetPropertyHandler |
( |
const std::string & |
aInterfaceName, |
|
|
const std::string & |
aPropertyName, |
|
|
const PropertyHandlerType & |
aHandler |
|
) |
| |
|
virtual |
This method registers the set handler for a property.
- Parameters
-
[in] | aInterfaceName | The interface name. |
[in] | aPropertyName | The property name. |
[in] | aHandler | The method handler. |
◆ Signal()
template<typename... FieldTypes>
otbrError otbr::DBus::DBusObject::Signal |
( |
const std::string & |
aInterfaceName, |
|
|
const std::string & |
aSignalName, |
|
|
const std::tuple< FieldTypes... > & |
aArgs |
|
) |
| |
|
inline |
This method sends a signal.
- Parameters
-
[in] | aInterfaceName | The interface name. |
[in] | aSignalName | The signal name. |
[in] | aArgs | The tuple to be encoded into the signal. |
- Return values
-
OTBR_ERROR_NONE | Signal successfully sent. |
OTBR_ERROR_DBUS | Failed to send the signal. |
◆ SignalPropertyChanged()
template<typename ValueType >
otbrError otbr::DBus::DBusObject::SignalPropertyChanged |
( |
const std::string & |
aInterfaceName, |
|
|
const std::string & |
aPropertyName, |
|
|
const ValueType & |
aValue |
|
) |
| |
|
inline |
This method sends a property changed signal.
- Parameters
-
[in] | aInterfaceName | The interface name. |
[in] | aPropertyName | The property name. |
[in] | aValue | New value of the property. |
- Return values
-
OTBR_ERROR_NONE | Signal successfully sent. |
OTBR_ERROR_DBUS | Failed to send the signal. |
The documentation for this class was generated from the following files: