With DBus Properties

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
master
Emanoil Kotsev 3 years ago
parent 3ef14f2360
commit a1b10d2d3c
Signed by: deloptes
GPG Key ID: F1EEB8CD9FB16A50

@ -88,7 +88,8 @@ link_directories(
# set( KDE3_DCOPIDL_EXECUTABLE ${KDE3_DCOPIDLNG_EXECUTABLE} )
tde_add_library( tdehwcontrol SHARED AUTOMOC
SOURCES BrightnessService.cpp CPUGovernorService.cpp DeviceServiceBase.cpp
InputEventsService.cpp PowerService.cpp hardwarecontrolService.cpp
InputEventsService.cpp PowerService.cpp PropertiesService.cpp
hardwarecontrolService.cpp
VERSION ${LIBRARY_VERSION}
DEPENDS hwcontrolinterfaces-static
LINK ${DBUS_TQT_LIBRARIES} hwcontrolinterfaces-static tdecore-shared

@ -0,0 +1,63 @@
/*
* PropertiesService.cpp
*
* Created on: Feb 7, 2021
* Author: emanoil
*
* hardwarecontrol Copyright (C) 2009 hardwarecontrol development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "PropertiesService.h"
PropertiesService::PropertiesService(TQT_DBusConnection &conn)
: m_connection(&conn)
{
// TODO Auto-generated constructor stub
}
PropertiesService::~PropertiesService()
{
// TODO Auto-generated destructor stub
}
bool PropertiesService::handleSignalSend(const TQT_DBusMessage& reply) {
return true;
}
TQString PropertiesService::objectPath() const {
return TQString();
}
bool PropertiesService::Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error) {
return true;
}
bool PropertiesService::Set(const TQString& interface, const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error) {
return true;
}
bool PropertiesService::GetAll(const TQString& interface, TQMap< TQString, TQT_DBusVariant >& properties, TQT_DBusError& error) {
properties = TQMap< TQString, TQT_DBusVariant >();
return true;
}
void PropertiesService::handleMethodReply(const TQT_DBusMessage& reply){
m_connection->send(reply);
}

@ -0,0 +1,56 @@
/*
* PropertiesService.h
*
* Created on: Feb 7, 2021
* Author: emanoil
*
* hardwarecontrol Copyright (C) 2009 hardwarecontrol development team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef PROPERTIESSERVICE_H_
#define PROPERTIESSERVICE_H_
#include <tqmap.h>
#include <tqdbusconnection.h>
#include <tqdbusvariant.h>
#include "build/interfaces/propertiesInterface.h"
class PropertiesService: public org::freedesktop::DBus::PropertiesInterface
{
public:
PropertiesService(TQT_DBusConnection&);
virtual ~PropertiesService();
protected: // implement sending signals
virtual bool handleSignalSend(const TQT_DBusMessage& reply);
virtual TQString objectPath() const;
protected:
virtual bool Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error);
virtual bool Set(const TQString& interface, const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error);
virtual bool GetAll(const TQString& interface, TQMap< TQString, TQT_DBusVariant >& properties, TQT_DBusError& error);
protected: // implement sending replies
virtual void handleMethodReply(const TQT_DBusMessage& reply);
private:
TQT_DBusConnection *m_connection;
};
#endif /* PROPERTIESSERVICE_H_ */

@ -28,12 +28,14 @@
#include "hardwarecontrolService.h"
#include "interfaces/introspectableInterface.h"
#include "interfaces/propertiesInterface.h"
#include "DeviceServiceBase.h"
#include "BrightnessService.h"
#include "CPUGovernorService.h"
#include "InputEventsService.h"
#include "PowerService.h"
#include "PropertiesService.h"
/*!
* Implementing node services for /org/trinitydesktop/hardwarecontrol
@ -102,6 +104,7 @@ HardwareControlNodeService::HardwareControlNodeService(TQT_DBusConnection &conn)
m_connection(conn)
{
m_interfaces.insert("org.freedesktop.DBus.Introspectable", this);
m_interfaces.insert("org.freedesktop.DBus.Properties", new PropertiesService(m_connection));
m_interfaces.insert("org.trinitydesktop.hardwarecontrol.Brightness", new BrightnessService(m_connection));
m_interfaces.insert("org.trinitydesktop.hardwarecontrol.CPUGovernor", new CPUGovernorService(m_connection));
m_interfaces.insert("org.trinitydesktop.hardwarecontrol.InputEvents", new InputEventsService(m_connection));

@ -88,6 +88,7 @@ private:
/*
* HardwareControlNodeService
* Service: org.freedesktop.DBus.Introspectable
* Service: org.freedesktop.DBus.Properties
* Service: org.trinitydesktop.hardwarecontrol.Brightness
* Service: org.trinitydesktop.hardwarecontrol.CPUGovernor
* Service: org.trinitydesktop.hardwarecontrol.InputEvents

@ -18,8 +18,8 @@ include_directories(
set( INTROSPECTIONPATH ${CMAKE_SOURCE_DIR}/interfaces )
set( DBUSXML2QT3_EXECUTABLE dbusxml2qt3 )
set( HardwareControl_HDRS brightnessInterface.h brightnessProxy.h cpugovernorInterface.h cpugovernorProxy.h dbusbaseNode.h hardwarecontrolNode.h inputeventsInterface.h inputeventsProxy.h introspectableInterface.h powerInterface.h powerProxy.h )
set( HardwareControl_SRCS brightnessInterface.cpp brightnessProxy.cpp cpugovernorInterface.cpp cpugovernorProxy.cpp dbusbaseNode.cpp hardwarecontrolNode.cpp inputeventsInterface.cpp inputeventsProxy.cpp introspectableInterface.cpp powerInterface.cpp powerProxy.cpp )
set( HardwareControl_HDRS brightnessInterface.h brightnessProxy.h cpugovernorInterface.h cpugovernorProxy.h dbusbaseNode.h hardwarecontrolNode.h inputeventsInterface.h inputeventsProxy.h introspectableInterface.h powerInterface.h powerProxy.h propertiesInterface.h propertiesProxy.h )
set( HardwareControl_SRCS brightnessInterface.cpp brightnessProxy.cpp cpugovernorInterface.cpp cpugovernorProxy.cpp dbusbaseNode.cpp hardwarecontrolNode.cpp inputeventsInterface.cpp inputeventsProxy.cpp introspectableInterface.cpp powerInterface.cpp powerProxy.cpp propertiesInterface.cpp propertiesProxy.cpp)
function( make_moc fileinput )
add_custom_command( OUTPUT ${fileinput}.moc
@ -43,9 +43,10 @@ make_moc ( brightnessProxy )
make_moc ( cpugovernorProxy )
make_moc ( inputeventsProxy)
make_moc ( powerProxy )
make_moc ( propertiesProxy )
tde_add_library( hwcontrolinterfaces STATIC_PIC AUTOMOC
SOURCES ${HardwareControl_SRCS} brightnessProxy.moc cpugovernorProxy.moc inputeventsProxy.moc powerProxy.moc
SOURCES ${HardwareControl_SRCS} brightnessProxy.moc cpugovernorProxy.moc inputeventsProxy.moc powerProxy.moc propertiesProxy.moc
LINK ${DBUS_TQT_LIBRARIES}
)

@ -72,4 +72,25 @@
<arg name="value" direction="out" type="b" />
</method>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface" type="s" direction="in"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
</node>

Loading…
Cancel
Save