Merge branch 'master' of git://anongit.freedesktop.org/git/dbus/dbus-c++
Merge branch 'master' of git://anongit.freedesktop.org/git/dbus/dbus-c++ Conflicts: include/dbus-c++/connection.h include/dbus-c++/dispatcher.h include/dbus-c++/pendingcall.h src/dispatcher.cpp
This commit is contained in:
commit
c1970e2352
57 changed files with 1642 additions and 1638 deletions
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = properties echo hal glib ecore
|
||||
SUBDIRS = properties echo hal glib ecore
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
static const char* ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
|
||||
static const char* ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
|
||||
static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
|
||||
static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
|
||||
|
||||
EchoClient::EchoClient( DBus::Connection& connection, const char* path, const char* name )
|
||||
EchoClient::EchoClient(DBus::Connection &connection, const char *path, const char *name)
|
||||
: DBus::ObjectProxy(connection, path, name)
|
||||
{
|
||||
}
|
||||
|
||||
void EchoClient::Echoed( const DBus::Variant& value )
|
||||
void EchoClient::Echoed(const DBus::Variant &value)
|
||||
{
|
||||
cout << "!";
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ void EchoClient::Echoed( const DBus::Variant& value )
|
|||
* For some strange reason, libdbus frequently dies with an OOM
|
||||
*/
|
||||
|
||||
static const int THREADS = 16;
|
||||
static const int THREADS = 3;
|
||||
|
||||
static bool spin = true;
|
||||
|
||||
void* greeter_thread( void* arg )
|
||||
void *greeter_thread(void *arg)
|
||||
{
|
||||
DBus::Connection* conn = reinterpret_cast<DBus::Connection*>(arg);
|
||||
DBus::Connection *conn = reinterpret_cast<DBus::Connection *>(arg);
|
||||
|
||||
EchoClient client(*conn, ECHO_SERVER_PATH, ECHO_SERVER_NAME);
|
||||
|
||||
|
@ -40,7 +40,7 @@ void* greeter_thread( void* arg )
|
|||
|
||||
snprintf(idstr, sizeof(idstr), "%lu", pthread_self());
|
||||
|
||||
for(int i = 0; i < 100 && spin; ++i)
|
||||
for (int i = 0; i < 30 && spin; ++i)
|
||||
{
|
||||
cout << client.Hello(idstr) << endl;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ void* greeter_thread( void* arg )
|
|||
|
||||
DBus::BusDispatcher dispatcher;
|
||||
|
||||
void niam( int sig )
|
||||
void niam(int sig)
|
||||
{
|
||||
spin = false;
|
||||
|
||||
|
@ -76,7 +76,7 @@ int main()
|
|||
|
||||
pthread_t threads[THREADS];
|
||||
|
||||
for(int i = 0; i < THREADS; ++i)
|
||||
for (int i = 0; i < THREADS; ++i)
|
||||
{
|
||||
pthread_create(threads+i, NULL, greeter_thread, &conn);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ int main()
|
|||
|
||||
cout << "terminating" << endl;
|
||||
|
||||
for(int i = 0; i < THREADS; ++i)
|
||||
for (int i = 0; i < THREADS; ++i)
|
||||
{
|
||||
pthread_join(threads[i], NULL);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ class EchoClient
|
|||
{
|
||||
public:
|
||||
|
||||
EchoClient( DBus::Connection& connection, const char* path, const char* name );
|
||||
EchoClient(DBus::Connection &connection, const char *path, const char *name);
|
||||
|
||||
void Echoed( const DBus::Variant& value );
|
||||
void Echoed(const DBus::Variant &value);
|
||||
};
|
||||
|
||||
#endif//__DEMO_ECHO_CLIENT_H
|
||||
|
|
|
@ -9,58 +9,59 @@
|
|||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
static const char* ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
|
||||
static const char* ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
|
||||
static const char *ECHO_SERVER_NAME = "org.freedesktop.DBus.Examples.Echo";
|
||||
static const char *ECHO_SERVER_PATH = "/org/freedesktop/DBus/Examples/Echo";
|
||||
|
||||
EchoServer::EchoServer( DBus::Connection& connection )
|
||||
EchoServer::EchoServer(DBus::Connection &connection)
|
||||
: DBus::ObjectAdaptor(connection, ECHO_SERVER_PATH)
|
||||
{
|
||||
}
|
||||
|
||||
DBus::Int32 EchoServer::Random()
|
||||
int32_t EchoServer::Random()
|
||||
{
|
||||
return rand();
|
||||
}
|
||||
|
||||
DBus::String EchoServer::Hello( const DBus::String& name )
|
||||
std::string EchoServer::Hello(const std::string &name)
|
||||
{
|
||||
sleep (10);
|
||||
return "Hello " + name + "!";
|
||||
}
|
||||
|
||||
DBus::Variant EchoServer::Echo( const DBus::Variant& value )
|
||||
DBus::Variant EchoServer::Echo(const DBus::Variant &value)
|
||||
{
|
||||
this->Echoed(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
std::vector< DBus::Byte > EchoServer::Cat( const DBus::String & file )
|
||||
std::vector< uint8_t > EchoServer::Cat(const std::string &file)
|
||||
{
|
||||
FILE* handle = fopen(file.c_str(), "rb");
|
||||
FILE *handle = fopen(file.c_str(), "rb");
|
||||
|
||||
if(!handle) throw DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileNotFound", "file not found");
|
||||
if (!handle) throw DBus::Error("org.freedesktop.DBus.EchoDemo.ErrorFileNotFound", "file not found");
|
||||
|
||||
DBus::Byte buff[1024];
|
||||
uint8_t buff[1024];
|
||||
|
||||
size_t nread = fread(buff, 1, sizeof(buff), handle);
|
||||
|
||||
fclose(handle);
|
||||
|
||||
return std::vector< DBus::Byte > (buff, buff + nread);
|
||||
return std::vector< uint8_t > (buff, buff + nread);
|
||||
}
|
||||
|
||||
DBus::Int32 EchoServer::Sum( const std::vector<DBus::Int32>& ints )
|
||||
int32_t EchoServer::Sum(const std::vector<int32_t>& ints)
|
||||
{
|
||||
DBus::Int32 sum = 0;
|
||||
int32_t sum = 0;
|
||||
|
||||
for(size_t i = 0; i < ints.size(); ++i) sum += ints[i];
|
||||
for (size_t i = 0; i < ints.size(); ++i) sum += ints[i];
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
std::map< DBus::String, DBus::String > EchoServer::Info()
|
||||
std::map< std::string, std::string > EchoServer::Info()
|
||||
{
|
||||
std::map< DBus::String, DBus::String > info;
|
||||
std::map< std::string, std::string > info;
|
||||
char hostname[HOST_NAME_MAX];
|
||||
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
|
@ -73,7 +74,7 @@ std::map< DBus::String, DBus::String > EchoServer::Info()
|
|||
|
||||
DBus::BusDispatcher dispatcher;
|
||||
|
||||
void niam( int sig )
|
||||
void niam(int sig)
|
||||
{
|
||||
dispatcher.leave();
|
||||
}
|
||||
|
|
|
@ -11,19 +11,19 @@ class EchoServer
|
|||
{
|
||||
public:
|
||||
|
||||
EchoServer( DBus::Connection& connection );
|
||||
EchoServer(DBus::Connection &connection);
|
||||
|
||||
DBus::Int32 Random();
|
||||
int32_t Random();
|
||||
|
||||
DBus::String Hello( const DBus::String & name );
|
||||
std::string Hello(const std::string &name);
|
||||
|
||||
DBus::Variant Echo( const DBus::Variant & value );
|
||||
DBus::Variant Echo(const DBus::Variant &value);
|
||||
|
||||
std::vector< DBus::Byte > Cat( const DBus::String & file );
|
||||
std::vector< uint8_t > Cat(const std::string &file);
|
||||
|
||||
DBus::Int32 Sum( const std::vector<DBus::Int32> & ints );
|
||||
int32_t Sum(const std::vector<int32_t> & ints);
|
||||
|
||||
std::map< DBus::String, DBus::String > Info();
|
||||
std::map< std::string, std::string > Info();
|
||||
};
|
||||
|
||||
#endif//__DEMO_ECHO_SERVER_H
|
||||
|
|
|
@ -15,7 +15,7 @@ static const char* DBUS_SERVER_PATH = "/org/freedesktop/DBus";
|
|||
DBusBrowser::DBusBrowser( ::DBus::Connection& conn )
|
||||
: ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME)
|
||||
{
|
||||
typedef std::vector< ::DBus::String > Names;
|
||||
typedef std::vector< std::string > Names;
|
||||
|
||||
Names names = ListNames();
|
||||
|
||||
|
@ -26,17 +26,17 @@ DBusBrowser::DBusBrowser( ::DBus::Connection& conn )
|
|||
}
|
||||
|
||||
void DBusBrowser::NameOwnerChanged(
|
||||
const ::DBus::String& name, const ::DBus::String& old_owner, const ::DBus::String& new_owner )
|
||||
const std::string& name, const std::string& old_owner, const std::string& new_owner )
|
||||
{
|
||||
cout << name << ": " << old_owner << " -> " << new_owner << endl;
|
||||
}
|
||||
|
||||
void DBusBrowser::NameLost( const ::DBus::String& name )
|
||||
void DBusBrowser::NameLost( const std::string& name )
|
||||
{
|
||||
cout << name << " lost" << endl;
|
||||
}
|
||||
|
||||
void DBusBrowser::NameAcquired( const ::DBus::String& name )
|
||||
void DBusBrowser::NameAcquired( const std::string& name )
|
||||
{
|
||||
cout << name << " acquired" << endl;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void NameOwnerChanged( const ::DBus::String&, const ::DBus::String&, const ::DBus::String& );
|
||||
void NameOwnerChanged( const std::string&, const std::string&, const std::string& );
|
||||
|
||||
void NameLost( const ::DBus::String& );
|
||||
void NameLost( const std::string& );
|
||||
|
||||
void NameAcquired( const ::DBus::String& );
|
||||
void NameAcquired( const std::string& );
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -9,26 +9,26 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
static const char* DBUS_SERVER_NAME = "org.freedesktop.DBus";
|
||||
static const char* DBUS_SERVER_PATH = "/org/freedesktop/DBus";
|
||||
static const char *DBUS_SERVER_NAME = "org.freedesktop.DBus";
|
||||
static const char *DBUS_SERVER_PATH = "/org/freedesktop/DBus";
|
||||
|
||||
DBusBrowser::DBusBrowser( ::DBus::Connection& conn )
|
||||
DBusBrowser::DBusBrowser(::DBus::Connection &conn)
|
||||
: ::DBus::ObjectProxy(conn, DBUS_SERVER_PATH, DBUS_SERVER_NAME)
|
||||
{
|
||||
set_title("D-Bus Browser");
|
||||
set_border_width(5);
|
||||
set_default_size(400, 500);
|
||||
|
||||
typedef std::vector< ::DBus::String > Names;
|
||||
typedef std::vector< std::string > Names;
|
||||
|
||||
Names names = ListNames();
|
||||
|
||||
for(Names::iterator it = names.begin(); it != names.end(); ++it)
|
||||
for (Names::iterator it = names.begin(); it != names.end(); ++it)
|
||||
{
|
||||
_cb_busnames.append_text(*it);
|
||||
}
|
||||
|
||||
_cb_busnames.signal_changed().connect( sigc::mem_fun(*this, &DBusBrowser::on_select_busname) );
|
||||
_cb_busnames.signal_changed().connect(sigc::mem_fun(*this, &DBusBrowser::on_select_busname));
|
||||
|
||||
_tm_inspect = Gtk::TreeStore::create(_records);
|
||||
_tv_inspect.set_model(_tm_inspect);
|
||||
|
@ -46,17 +46,17 @@ DBusBrowser::DBusBrowser( ::DBus::Connection& conn )
|
|||
}
|
||||
|
||||
void DBusBrowser::NameOwnerChanged(
|
||||
const ::DBus::String& name, const ::DBus::String& old_owner, const ::DBus::String& new_owner )
|
||||
const std::string &name, const std::string &old_owner, const std::string &new_owner)
|
||||
{
|
||||
cout << name << ": " << old_owner << " -> " << new_owner << endl;
|
||||
}
|
||||
|
||||
void DBusBrowser::NameLost( const ::DBus::String& name )
|
||||
void DBusBrowser::NameLost(const std::string &name)
|
||||
{
|
||||
cout << name << " lost" << endl;
|
||||
}
|
||||
|
||||
void DBusBrowser::NameAcquired( const ::DBus::String& name )
|
||||
void DBusBrowser::NameAcquired(const std::string &name)
|
||||
{
|
||||
cout << name << " acquired" << endl;
|
||||
}
|
||||
|
@ -64,24 +64,24 @@ void DBusBrowser::NameAcquired( const ::DBus::String& name )
|
|||
void DBusBrowser::on_select_busname()
|
||||
{
|
||||
Glib::ustring busname = _cb_busnames.get_active_text();
|
||||
if(busname.empty()) return;
|
||||
if (busname.empty()) return;
|
||||
|
||||
_tm_inspect->clear();
|
||||
_inspect_append(NULL, "", busname);
|
||||
}
|
||||
|
||||
void DBusBrowser::_inspect_append( Gtk::TreeModel::Row* row, const std::string& buspath, const std::string& busname )
|
||||
void DBusBrowser::_inspect_append(Gtk::TreeModel::Row *row, const std::string &buspath, const std::string &busname)
|
||||
{
|
||||
DBusInspector inspector(conn(), buspath.empty() ? "/" : buspath.c_str(), busname.c_str());
|
||||
|
||||
::DBus::Xml::Document doc(inspector.Introspect());
|
||||
::DBus::Xml::Node& root = *(doc.root);
|
||||
::DBus::Xml::Node &root = *(doc.root);
|
||||
|
||||
::DBus::Xml::Nodes ifaces = root["interface"];
|
||||
|
||||
for(::DBus::Xml::Nodes::iterator ii = ifaces.begin(); ii != ifaces.end(); ++ii)
|
||||
for (::DBus::Xml::Nodes::iterator ii = ifaces.begin(); ii != ifaces.end(); ++ii)
|
||||
{
|
||||
::DBus::Xml::Node& iface = **ii;
|
||||
::DBus::Xml::Node &iface = **ii;
|
||||
|
||||
Gtk::TreeModel::Row i_row = row
|
||||
? *(_tm_inspect->append(row->children()))
|
||||
|
@ -90,7 +90,7 @@ void DBusBrowser::_inspect_append( Gtk::TreeModel::Row* row, const std::string&
|
|||
|
||||
::DBus::Xml::Nodes methods = iface["method"];
|
||||
|
||||
for(::DBus::Xml::Nodes::iterator im = methods.begin(); im != methods.end(); ++im)
|
||||
for (::DBus::Xml::Nodes::iterator im = methods.begin(); im != methods.end(); ++im)
|
||||
{
|
||||
Gtk::TreeModel::Row m_row = *(_tm_inspect->append(i_row.children()));
|
||||
m_row[_records.name] = "method: " + (*im)->get("name");
|
||||
|
@ -98,7 +98,7 @@ void DBusBrowser::_inspect_append( Gtk::TreeModel::Row* row, const std::string&
|
|||
|
||||
::DBus::Xml::Nodes signals = iface["signal"];
|
||||
|
||||
for(::DBus::Xml::Nodes::iterator is = signals.begin(); is != signals.end(); ++is)
|
||||
for (::DBus::Xml::Nodes::iterator is = signals.begin(); is != signals.end(); ++is)
|
||||
{
|
||||
Gtk::TreeModel::Row s_row = *(_tm_inspect->append(i_row.children()));
|
||||
s_row[_records.name] = "signal: " + (*is)->get("name");
|
||||
|
@ -107,7 +107,7 @@ void DBusBrowser::_inspect_append( Gtk::TreeModel::Row* row, const std::string&
|
|||
|
||||
::DBus::Xml::Nodes nodes = root["node"];
|
||||
|
||||
for(::DBus::Xml::Nodes::iterator in = nodes.begin(); in != nodes.end(); ++in)
|
||||
for (::DBus::Xml::Nodes::iterator in = nodes.begin(); in != nodes.end(); ++in)
|
||||
{
|
||||
std::string name = (*in)->get("name");
|
||||
|
||||
|
@ -122,7 +122,7 @@ void DBusBrowser::_inspect_append( Gtk::TreeModel::Row* row, const std::string&
|
|||
|
||||
DBus::Glib::BusDispatcher dispatcher;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Gtk::Main kit(argc, argv);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class DBusInspector
|
|||
{
|
||||
public:
|
||||
|
||||
DBusInspector( DBus::Connection& conn, const char* path, const char* service )
|
||||
DBusInspector(DBus::Connection &conn, const char *path, const char *service)
|
||||
: DBus::ObjectProxy(conn, path, service)
|
||||
{}
|
||||
};
|
||||
|
@ -26,19 +26,19 @@ class DBusBrowser
|
|||
{
|
||||
public:
|
||||
|
||||
DBusBrowser( ::DBus::Connection& );
|
||||
DBusBrowser(::DBus::Connection &);
|
||||
|
||||
private:
|
||||
|
||||
void NameOwnerChanged( const ::DBus::String&, const ::DBus::String&, const ::DBus::String& );
|
||||
void NameOwnerChanged(const std::string &, const std::string &, const std::string &);
|
||||
|
||||
void NameLost( const ::DBus::String& );
|
||||
void NameLost(const std::string &);
|
||||
|
||||
void NameAcquired( const ::DBus::String& );
|
||||
void NameAcquired(const std::string &);
|
||||
|
||||
void on_select_busname();
|
||||
|
||||
void _inspect_append( Gtk::TreeModel::Row*, const std::string&, const std::string& );
|
||||
void _inspect_append(Gtk::TreeModel::Row *, const std::string &, const std::string &);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
#include <signal.h>
|
||||
#include <iostream>
|
||||
|
||||
HalManagerProxy::HalManagerProxy( DBus::Connection& connection )
|
||||
HalManagerProxy::HalManagerProxy(DBus::Connection &connection)
|
||||
: DBus::InterfaceProxy("org.freedesktop.Hal.Manager"),
|
||||
DBus::ObjectProxy(connection, "/org/freedesktop/Hal/Manager", "org.freedesktop.Hal")
|
||||
{
|
||||
connect_signal(HalManagerProxy, DeviceAdded, DeviceAddedCb);
|
||||
connect_signal(HalManagerProxy, DeviceRemoved, DeviceRemovedCb);
|
||||
|
||||
std::vector< DBus::String > devices = GetAllDevices();
|
||||
std::vector< std::string > devices = GetAllDevices();
|
||||
|
||||
std::vector< DBus::String >::iterator it;
|
||||
for(it = devices.begin(); it != devices.end(); ++it)
|
||||
std::vector< std::string >::iterator it;
|
||||
for (it = devices.begin(); it != devices.end(); ++it)
|
||||
{
|
||||
DBus::Path udi = *it;
|
||||
|
||||
|
@ -27,9 +27,9 @@ HalManagerProxy::HalManagerProxy( DBus::Connection& connection )
|
|||
}
|
||||
}
|
||||
|
||||
std::vector< DBus::String > HalManagerProxy::GetAllDevices()
|
||||
std::vector< std::string > HalManagerProxy::GetAllDevices()
|
||||
{
|
||||
std::vector< DBus::String > udis;
|
||||
std::vector< std::string > udis;
|
||||
DBus::CallMessage call;
|
||||
|
||||
call.member("GetAllDevices");
|
||||
|
@ -41,10 +41,10 @@ std::vector< DBus::String > HalManagerProxy::GetAllDevices()
|
|||
return udis;
|
||||
}
|
||||
|
||||
void HalManagerProxy::DeviceAddedCb( const DBus::SignalMessage& sig )
|
||||
void HalManagerProxy::DeviceAddedCb(const DBus::SignalMessage &sig)
|
||||
{
|
||||
DBus::MessageIter it = sig.reader();
|
||||
DBus::String devname;
|
||||
std::string devname;
|
||||
|
||||
it >> devname;
|
||||
|
||||
|
@ -54,10 +54,10 @@ void HalManagerProxy::DeviceAddedCb( const DBus::SignalMessage& sig )
|
|||
std::cout << "added device " << udi << std::endl;
|
||||
}
|
||||
|
||||
void HalManagerProxy::DeviceRemovedCb( const DBus::SignalMessage& sig )
|
||||
void HalManagerProxy::DeviceRemovedCb(const DBus::SignalMessage &sig)
|
||||
{
|
||||
DBus::MessageIter it = sig.reader();
|
||||
DBus::String devname;
|
||||
std::string devname;
|
||||
|
||||
it >> devname;
|
||||
|
||||
|
@ -66,7 +66,7 @@ void HalManagerProxy::DeviceRemovedCb( const DBus::SignalMessage& sig )
|
|||
_devices.erase(devname);
|
||||
}
|
||||
|
||||
HalDeviceProxy::HalDeviceProxy( DBus::Connection& connection, DBus::Path& udi )
|
||||
HalDeviceProxy::HalDeviceProxy(DBus::Connection &connection, DBus::Path &udi)
|
||||
: DBus::InterfaceProxy("org.freedesktop.Hal.Device"),
|
||||
DBus::ObjectProxy(connection, udi, "org.freedesktop.Hal")
|
||||
{
|
||||
|
@ -74,18 +74,18 @@ HalDeviceProxy::HalDeviceProxy( DBus::Connection& connection, DBus::Path& udi )
|
|||
connect_signal(HalDeviceProxy, Condition, ConditionCb);
|
||||
}
|
||||
|
||||
void HalDeviceProxy::PropertyModifiedCb( const DBus::SignalMessage& sig )
|
||||
void HalDeviceProxy::PropertyModifiedCb(const DBus::SignalMessage &sig)
|
||||
{
|
||||
typedef DBus::Struct< DBus::String, DBus::Bool, DBus::Bool > HalProperty;
|
||||
typedef DBus::Struct< std::string, bool, bool > HalProperty;
|
||||
|
||||
DBus::MessageIter it = sig.reader();
|
||||
DBus::Int32 number;
|
||||
int32_t number;
|
||||
|
||||
it >> number;
|
||||
|
||||
DBus::MessageIter arr = it.recurse();
|
||||
|
||||
for(int i = 0; i < number; ++i, ++arr)
|
||||
for (int i = 0; i < number; ++i, ++arr)
|
||||
{
|
||||
HalProperty hp;
|
||||
|
||||
|
@ -95,10 +95,10 @@ void HalDeviceProxy::PropertyModifiedCb( const DBus::SignalMessage& sig )
|
|||
}
|
||||
}
|
||||
|
||||
void HalDeviceProxy::ConditionCb( const DBus::SignalMessage& sig )
|
||||
void HalDeviceProxy::ConditionCb(const DBus::SignalMessage &sig)
|
||||
{
|
||||
DBus::MessageIter it = sig.reader();
|
||||
DBus::String condition;
|
||||
std::string condition;
|
||||
|
||||
it >> condition;
|
||||
|
||||
|
@ -107,7 +107,7 @@ void HalDeviceProxy::ConditionCb( const DBus::SignalMessage& sig )
|
|||
|
||||
DBus::BusDispatcher dispatcher;
|
||||
|
||||
void niam( int sig )
|
||||
void niam(int sig)
|
||||
{
|
||||
dispatcher.leave();
|
||||
}
|
||||
|
|
|
@ -13,17 +13,17 @@ class HalManagerProxy
|
|||
{
|
||||
public:
|
||||
|
||||
HalManagerProxy( DBus::Connection& connection );
|
||||
HalManagerProxy(DBus::Connection &connection);
|
||||
|
||||
std::vector< DBus::String > GetAllDevices();
|
||||
std::vector< std::string > GetAllDevices();
|
||||
|
||||
private:
|
||||
|
||||
void DeviceAddedCb( const DBus::SignalMessage& sig );
|
||||
void DeviceAddedCb(const DBus::SignalMessage &sig);
|
||||
|
||||
void DeviceRemovedCb( const DBus::SignalMessage& sig );
|
||||
void DeviceRemovedCb(const DBus::SignalMessage &sig);
|
||||
|
||||
std::map< DBus::String, DBus::RefPtr< HalDeviceProxy > > _devices;
|
||||
std::map< std::string, DBus::RefPtr< HalDeviceProxy > > _devices;
|
||||
};
|
||||
|
||||
class HalDeviceProxy
|
||||
|
@ -32,13 +32,13 @@ class HalDeviceProxy
|
|||
{
|
||||
public:
|
||||
|
||||
HalDeviceProxy( DBus::Connection& connection, DBus::Path& udi );
|
||||
HalDeviceProxy(DBus::Connection &connection, DBus::Path &udi);
|
||||
|
||||
private:
|
||||
|
||||
void PropertyModifiedCb( const DBus::SignalMessage& sig );
|
||||
void PropertyModifiedCb(const DBus::SignalMessage &sig);
|
||||
|
||||
void ConditionCb( const DBus::SignalMessage& sig );
|
||||
void ConditionCb(const DBus::SignalMessage &sig);
|
||||
};
|
||||
|
||||
#endif//__DEMO_HAL_LISTEN_H
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include "props-server.h"
|
||||
#include <signal.h>
|
||||
|
||||
static const char* PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties";
|
||||
static const char* PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties";
|
||||
static const char *PROPS_SERVER_NAME = "org.freedesktop.DBus.Examples.Properties";
|
||||
static const char *PROPS_SERVER_PATH = "/org/freedesktop/DBus/Examples/Properties";
|
||||
|
||||
PropsServer::PropsServer( DBus::Connection& connection )
|
||||
PropsServer::PropsServer(DBus::Connection &connection)
|
||||
: DBus::ObjectAdaptor(connection, PROPS_SERVER_PATH)
|
||||
{
|
||||
Version = 1;
|
||||
|
@ -16,18 +16,18 @@ PropsServer::PropsServer( DBus::Connection& connection )
|
|||
}
|
||||
|
||||
void PropsServer::on_set_property
|
||||
( DBus::InterfaceAdaptor& interface, const DBus::String& property, const DBus::Variant& value )
|
||||
(DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value)
|
||||
{
|
||||
if(property == "Message")
|
||||
if (property == "Message")
|
||||
{
|
||||
DBus::String msg = value;
|
||||
std::string msg = value;
|
||||
this->MessageChanged(msg);
|
||||
}
|
||||
}
|
||||
|
||||
DBus::BusDispatcher dispatcher;
|
||||
|
||||
void niam( int sig )
|
||||
void niam(int sig)
|
||||
{
|
||||
dispatcher.leave();
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ class PropsServer
|
|||
{
|
||||
public:
|
||||
|
||||
PropsServer( DBus::Connection& connection );
|
||||
PropsServer(DBus::Connection &connection);
|
||||
|
||||
void on_set_property
|
||||
( DBus::InterfaceAdaptor& interface, const DBus::String& property, const DBus::Variant& value );
|
||||
(DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
|
||||
};
|
||||
|
||||
#endif//__DEMO_PROPS_SERVER_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue