Cleanup CMakeLists.txt files - use tde_automoc and tde_setup_dbus macros

Remove debug msg for ignored interfaces in HardwareControl and consistent logging for dbus name aquired

Cleanup header files and consistent formatting

Signed-off-by: Emanoil Kotsev <deloptes@gmail.com>
feat/new_hwcontrol
Emanoil Kotsev 3 months ago
parent 802ffbda85
commit b15f74f1d6
No known key found for this signature in database
GPG Key ID: F1EEB8CD9FB16A50

@ -34,16 +34,11 @@ public:
BrightnessService(TQT_DBusConnection&); BrightnessService(TQT_DBusConnection&);
virtual ~BrightnessService(); virtual ~BrightnessService();
protected: protected: // implement DBus calls
virtual bool CanSetBrightness(const TQString& device, bool& value, TQT_DBusError& error); virtual bool CanSetBrightness(const TQString& device, bool& value, TQT_DBusError& error);
virtual bool SetBrightness(const TQString& device, const TQString& brightness, bool& value, TQT_DBusError& error); virtual bool SetBrightness(const TQString& device, const TQString& brightness, bool& value, TQT_DBusError& error);
// implement sending replies
protected: // implement sending replies
void handleMethodReply(const TQT_DBusMessage& reply); void handleMethodReply(const TQT_DBusMessage& reply);
//
// virtual void BrightnessServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid);
}; };
#endif /* BRIGHTNESSSERVICE_H_ */ #endif /* BRIGHTNESSSERVICE_H_ */

@ -9,26 +9,6 @@
# #
################################################# #################################################
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
#-Wl,--whole-archive
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
##### configure checks ##########################
if( NOT DBUS_SYS_DIR )
set( DBUS_SYS_DIR ${SYSCONF_INSTALL_DIR}/dbus-1/system.d )
endif( )
if( WITH_GCC_VISIBILITY )
if( NOT UNIX )
tde_message_fatal(FATAL_ERROR "\ngcc visibility support was requested, but your system is not *NIX" )
endif( NOT UNIX )
set( __KDE_HAVE_GCC_VISIBILITY 1 )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
endif( )
add_definitions( add_definitions(
# -DQT_THREAD_SUPPORT # -DQT_THREAD_SUPPORT
${TQT_CFLAGS_OTHER} ${TQT_CFLAGS_OTHER}

@ -31,16 +31,12 @@ class CPUGovernorService: public org::trinitydesktop::hardwarecontrol::CPUGovern
public: public:
CPUGovernorService(TQT_DBusConnection&); CPUGovernorService(TQT_DBusConnection&);
virtual ~CPUGovernorService(); virtual ~CPUGovernorService();
protected:
virtual bool CanSetCPUGovernor(TQ_INT32 cpu, bool& value, TQT_DBusError& error) ;
protected: // implement DBus calls
virtual bool CanSetCPUGovernor(TQ_INT32 cpu, bool& value, TQT_DBusError& error) ;
virtual bool SetCPUGovernor(TQ_INT32 cpu, const TQString& governor, bool& value, TQT_DBusError& error); virtual bool SetCPUGovernor(TQ_INT32 cpu, const TQString& governor, bool& value, TQT_DBusError& error);
// implement sending replies
protected: // implement sending replies
void handleMethodReply(const TQT_DBusMessage& reply); void handleMethodReply(const TQT_DBusMessage& reply);
//
// virtual void CPUGovernorServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid);
}; };
#endif /* CPUGOVERNORSERVICE_H_ */ #endif /* CPUGOVERNORSERVICE_H_ */

@ -31,11 +31,10 @@ public:
DeviceServiceBase(TQT_DBusConnection&); DeviceServiceBase(TQT_DBusConnection&);
virtual ~DeviceServiceBase(); virtual ~DeviceServiceBase();
protected: protected: // implement DBus calls
bool canSetDeviceValue(const TQString& device, TQT_DBusError& error); bool canSetDeviceValue(const TQString& device, TQT_DBusError& error);
bool setDeviceValue(const TQString& device, const TQString& param, TQT_DBusError& error); bool setDeviceValue(const TQString& device, const TQString& param, TQT_DBusError& error);
// implement sending replies
protected: // implement sending replies
virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0; virtual void handleMethodReply(const TQT_DBusMessage& reply) = 0;
protected: protected:

@ -72,16 +72,13 @@ void HardwareControl::slotDbusSignal(const TQT_DBusMessage& message) {
message.member() == TQString("NameAcquired") && message.member() == TQString("NameAcquired") &&
serviceName == DBUS_HWCTRL_SERVICE_NAME ) serviceName == DBUS_HWCTRL_SERVICE_NAME )
{ {
tqDebug("Name acquired: " + serviceName); tqDebug("TDEHW unique DBus name acquired: " + serviceName);
rootService = new RootNodeService(m_connection); rootService = new RootNodeService(m_connection);
orgService = new OrgNodeService(m_connection); orgService = new OrgNodeService(m_connection);
trinitydesktopService = new TrinityDesktopNodeService(m_connection); trinitydesktopService = new TrinityDesktopNodeService(m_connection);
hardwarecontrolService = new HardwareControlNodeService(m_connection); hardwarecontrolService = new HardwareControlNodeService(m_connection);
tqDebug("TDEHW service setup done."); tqDebug("TDEHW service setup done.");
} else {
tqDebug("TDEHW service ignored: " + serviceName);
} }
} }
void HardwareControl::dbusConnectionClose() { void HardwareControl::dbusConnectionClose() {

@ -45,6 +45,7 @@ private:
//! to close the connection to D-Bus //! to close the connection to D-Bus
void dbusConnectionClose(); void dbusConnectionClose();
private:
RootNodeService *rootService; RootNodeService *rootService;
OrgNodeService *orgService; OrgNodeService *orgService;
TrinityDesktopNodeService *trinitydesktopService; TrinityDesktopNodeService *trinitydesktopService;
@ -63,8 +64,6 @@ private slots:
* \return void * \return void
*/ */
void slotDbusSignal(const TQT_DBusMessage&); void slotDbusSignal(const TQT_DBusMessage&);
}; };
#endif /* HARDWARECONTROL_H_ */ #endif /* HARDWARECONTROL_H_ */

@ -31,18 +31,13 @@ class InputEventsService: public org::trinitydesktop::hardwarecontrol::InputEven
public: public:
InputEventsService(TQT_DBusConnection&); InputEventsService(TQT_DBusConnection&);
virtual ~InputEventsService(); virtual ~InputEventsService();
protected:
protected: // implement DBus calls
TQValueList< TQ_UINT32 > getSwitches(const TQString& device, bool active, TQT_DBusError& error); TQValueList< TQ_UINT32 > getSwitches(const TQString& device, bool active, TQT_DBusError& error);
virtual bool GetProvidedSwitches(const TQString& device, TQValueList< TQ_UINT32 >& value, TQT_DBusError& error); virtual bool GetProvidedSwitches(const TQString& device, TQValueList< TQ_UINT32 >& value, TQT_DBusError& error);
virtual bool GetActiveSwitches(const TQString& device, TQValueList< TQ_UINT32 >& value, TQT_DBusError& error); virtual bool GetActiveSwitches(const TQString& device, TQValueList< TQ_UINT32 >& value, TQT_DBusError& error);
// implement sending replies
protected: // implement sending replies
virtual void handleMethodReply(const TQT_DBusMessage& reply); virtual void handleMethodReply(const TQT_DBusMessage& reply);
//
// virtual void InputEventsServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid);
private: private:
TQT_DBusConnection *m_connection; TQT_DBusConnection *m_connection;

@ -31,43 +31,27 @@ class PowerService: public org::trinitydesktop::hardwarecontrol::PowerInterface,
public: public:
PowerService(TQT_DBusConnection&); PowerService(TQT_DBusConnection&);
virtual ~PowerService(); virtual ~PowerService();
protected: protected:
// implement DBus calls
bool canSetPower(TQString state, TQT_DBusError& error); bool canSetPower(TQString state, TQT_DBusError& error);
bool setPower(TQString state, TQT_DBusError& error); bool setPower(TQString state, TQT_DBusError& error);
bool canSetHibernation(TQString state, TQT_DBusError& error); bool canSetHibernation(TQString state, TQT_DBusError& error);
bool setHibernation(TQString state, TQT_DBusError& error); bool setHibernation(TQString state, TQT_DBusError& error);
virtual bool CanStandby(bool& value, TQT_DBusError& error); virtual bool CanStandby(bool& value, TQT_DBusError& error);
virtual bool Standby(bool& value, TQT_DBusError& error); virtual bool Standby(bool& value, TQT_DBusError& error);
virtual bool CanFreeze(bool& value, TQT_DBusError& error); virtual bool CanFreeze(bool& value, TQT_DBusError& error);
virtual bool Freeze(bool& value, TQT_DBusError& error); virtual bool Freeze(bool& value, TQT_DBusError& error);
virtual bool CanSuspend(bool& value, TQT_DBusError& error); virtual bool CanSuspend(bool& value, TQT_DBusError& error);
virtual bool Suspend(bool& value, TQT_DBusError& error); virtual bool Suspend(bool& value, TQT_DBusError& error);
virtual bool CanHibernate(bool& value, TQT_DBusError& error); virtual bool CanHibernate(bool& value, TQT_DBusError& error);
virtual bool Hibernate(bool& value, TQT_DBusError& error); virtual bool Hibernate(bool& value, TQT_DBusError& error);
virtual bool CanHybridSuspend(bool& value, TQT_DBusError& error); virtual bool CanHybridSuspend(bool& value, TQT_DBusError& error);
virtual bool HybridSuspend(bool& value, TQT_DBusError& error); virtual bool HybridSuspend(bool& value, TQT_DBusError& error);
virtual bool CanSetHibernationMethod(bool& value, TQT_DBusError& error); virtual bool CanSetHibernationMethod(bool& value, TQT_DBusError& error);
virtual bool SetHibernationMethod(const TQString& method, bool& value, TQT_DBusError& error); virtual bool SetHibernationMethod(const TQString& method, bool& value, TQT_DBusError& error);
// implement sending replies
protected: // implement sending replies
void handleMethodReply(const TQT_DBusMessage& reply); void handleMethodReply(const TQT_DBusMessage& reply);
//
// virtual void PowerServiceAsync(int asyncCallId, const TQT_DBusObjectPath& device, const TQString& uuid);
}; };
#endif /* POWERSERVICE_H_ */ #endif /* POWERSERVICE_H_ */

@ -37,16 +37,13 @@ public:
protected: // implement sending signals protected: // implement sending signals
virtual bool handleSignalSend(const TQT_DBusMessage& reply); virtual bool handleSignalSend(const TQT_DBusMessage& reply);
// returns the path
virtual TQString objectPath() const; virtual TQString objectPath() const;
// implement DBus calls
protected:
virtual bool Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error); 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 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); virtual bool GetAll(const TQString& interface, TQMap< TQString, TQT_DBusVariant >& properties, TQT_DBusError& error);
// implement sending replies
protected: // implement sending replies
virtual void handleMethodReply(const TQT_DBusMessage& reply); virtual void handleMethodReply(const TQT_DBusMessage& reply);
private: private:

@ -42,8 +42,10 @@ class RootNodeService : public DBusBaseNode
public: public:
RootNodeService(TQT_DBusConnection&); RootNodeService(TQT_DBusConnection&);
~RootNodeService(); ~RootNodeService();
protected: protected:
virtual TQT_DBusObjectBase* createInterface(const TQString&); virtual TQT_DBusObjectBase* createInterface(const TQString&);
private: private:
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
TQT_DBusConnection m_connection; TQT_DBusConnection m_connection;
@ -60,8 +62,10 @@ class OrgNodeService : public DBusBaseNode
public: public:
OrgNodeService(TQT_DBusConnection&); OrgNodeService(TQT_DBusConnection&);
~OrgNodeService(); ~OrgNodeService();
protected: protected:
virtual TQT_DBusObjectBase* createInterface(const TQString&); virtual TQT_DBusObjectBase* createInterface(const TQString&);
private: private:
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
TQT_DBusConnection m_connection; TQT_DBusConnection m_connection;
@ -78,8 +82,10 @@ class TrinityDesktopNodeService : public DBusBaseNode
public: public:
TrinityDesktopNodeService(TQT_DBusConnection&); TrinityDesktopNodeService(TQT_DBusConnection&);
~TrinityDesktopNodeService(); ~TrinityDesktopNodeService();
protected: protected:
virtual TQT_DBusObjectBase* createInterface(const TQString&); virtual TQT_DBusObjectBase* createInterface(const TQString&);
private: private:
TQMap<TQString, TQT_DBusObjectBase*> m_interfaces; TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
TQT_DBusConnection m_connection; TQT_DBusConnection m_connection;

@ -21,16 +21,6 @@ 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 propertiesInterface.h propertiesProxy.h ) 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) 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
COMMAND ${TMOC_EXECUTABLE} ${fileinput}.h -o ${fileinput}.moc
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${fileinput}.h
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set_property( SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${fileinput}.cpp APPEND
PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${fileinput}.moc )
endfunction( )
##### HardwareControl ######################### ##### HardwareControl #########################
add_custom_command( add_custom_command(
OUTPUT ${HardwareControl_HDRS} ${HardwareControl_SRCS} OUTPUT ${HardwareControl_HDRS} ${HardwareControl_SRCS}
@ -39,13 +29,7 @@ add_custom_command(
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
) )
make_moc ( brightnessProxy ) tde_add_library( hwcontrolinterfaces STATIC_PIC AUTOMOC
make_moc ( cpugovernorProxy )
make_moc ( inputeventsProxy)
make_moc ( powerProxy )
make_moc ( propertiesProxy )
tde_add_library( hwcontrolinterfaces STATIC_PIC
SOURCES ${HardwareControl_SRCS} SOURCES ${HardwareControl_SRCS}
LINK ${DBUS_TQT_LIBRARIES} LINK ${DBUS_TQT_LIBRARIES}
) )

Loading…
Cancel
Save