dbus-cpp/dbus-cpp bus.cc, 1.1.1.1, 1.2 bus.h, 1.1.1.1, 1.2 connection.h, 1.1.1.1, 1.2 service.cc, 1.1.1.1, 1.2

Murray Cumming murrayc at freedesktop.org
Fri Jun 17 08:36:26 PDT 2005


Update of /cvs/dbus/dbus-cpp/dbus-cpp
In directory gabe:/tmp/cvs-serv29851/dbus-cpp

Modified Files:
	bus.cc bus.h connection.h service.cc 
Log Message:
2005-06-17  Murray Cumming <murrayc at murrayc.com>

        * dbus-cpp/bus.cc:
        * dbus-cpp/bus.h:
        * dbus-cpp/connection.h:
        * dbus-cpp/service.cc: Changed to match the new dbus_bus_* API,
        fixing the build.


Index: bus.cc
===================================================================
RCS file: /cvs/dbus/dbus-cpp/dbus-cpp/bus.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- bus.cc	17 Dec 2003 19:16:37 -0000	1.1.1.1
+++ bus.cc	17 Jun 2005 15:36:24 -0000	1.2
@@ -48,45 +48,65 @@
 }
 */
 
-void set_base_service(connection& connection, const std::string& base_service)
+bool set_unique_name(connection& connection, const std::string& unique_name)
 {
-  bool test = dbus_bus_set_base_service(connection.cobj(), base_service.c_str());
+  bool test = dbus_bus_set_unique_name(connection.cobj(), unique_name.c_str());
   if(!test)
     throw exception();
 }
 
-std::string get_base_service(connection& connection)
+std::string get_unique_name(const connection& connection)
 {
   std::string result;
-  const char* cstring = dbus_bus_get_base_service(connection.cobj());
+  const char* cstring = dbus_bus_get_unique_name(const_cast<DBusConnection*>(connection.cobj()));
   if(cstring)
     result = cstring;
+
+  return result;
 }
 
-int acquire_service(connection& connection, const std::string& service_name, unsigned int flags)
+unsigned long get_unix_user(const connection& connection, const std::string& name)
 {
   exception error;
-  int result = dbus_bus_acquire_service(connection.cobj(), service_name.c_str(), flags, error.cobj());
+  unsigned long result = dbus_bus_get_unix_user(const_cast<DBusConnection*>(connection.cobj()), name.c_str(), error.cobj());
+  if(dbus_error_is_set(error.cobj()))
+    throw error;
+
+  return result;
+}
+
+int request_name(connection& connection, const std::string& name, unsigned int flags)
+{
+  exception error;
+  int result = dbus_bus_request_name(connection.cobj(), name.c_str(), flags, error.cobj());
   if(!result) //TODO: What value is an error?
     throw error;
 
   return result;
 }
 
-bool service_exists(connection& connection, const std::string& service_name)
+bool name_has_owner(const connection& connection, const std::string& name)
 {
   exception error;
-  bool test = dbus_bus_service_exists(connection.cobj(), service_name.c_str(), error.cobj());
-  if(!test)
+  bool result = dbus_bus_name_has_owner(const_cast<DBusConnection*>(connection.cobj()), name.c_str(), error.cobj());
+  if(dbus_error_is_set(error.cobj()))
     throw error;
 
-  return test;
+  return result;
 }
 
-void activate_service(connection& connection, const std::string& service_name, dbus_uint32_t flags, dbus_uint32_t& reply)
+bool start_service_by_name(connection& connection, const std::string& name, dbus_uint32_t& reply, dbus_uint32_t flags)
 {
   exception error;
-  bool test = dbus_bus_activate_service(connection.cobj(), service_name.c_str(), flags, &reply, error.cobj());
+  bool test = dbus_bus_start_service_by_name(connection.cobj(), name.c_str(), flags, &reply, error.cobj());
+  if(!test)
+    throw error;
+}
+
+bool start_service_by_name(connection& connection, const std::string& name, dbus_uint32_t flags)
+{
+  exception error;
+  bool test = dbus_bus_start_service_by_name(connection.cobj(), name.c_str(), flags, 0, error.cobj());
   if(!test)
     throw error;
 }
@@ -95,16 +115,16 @@
 {
   exception error;
   dbus_bus_add_match(connection.cobj(), rule.c_str(), error.cobj());
-  //TODO: How do we know if there was an error?: if(!test)
-  //  throw error;
+  if(dbus_error_is_set(error.cobj()))
+    throw error;
 }
 
 void remove_match(connection& connection, const std::string& rule)
 {
   exception error;
   dbus_bus_remove_match(connection.cobj(), rule.c_str(), error.cobj());
-  //TODO: How do we know if there was an error?: if(!test)
-  //  throw error;
+  if(dbus_error_is_set(error.cobj()))
+    throw error;
 }
 
 } //namespace bus

Index: bus.h
===================================================================
RCS file: /cvs/dbus/dbus-cpp/dbus-cpp/bus.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- bus.h	17 Dec 2003 19:16:36 -0000	1.1.1.1
+++ bus.h	17 Jun 2005 15:36:24 -0000	1.2
@@ -41,11 +41,14 @@
 connection get_connection(bustype type = BUS_SESSION);
 
 //void register(connection& connection);
-void set_base_service (connection& connection, const std::string& base_service);
-std::string get_base_service(connection& connection);
-int acquire_service(connection& connection, const std::string& service_name, unsigned int flags = 0);
-bool service_exists(connection& connection, const std::string& service_name);
-void activate_service (connection& connection, const std::string& service_name, dbus_uint32_t flags, dbus_uint32_t& reply);
+bool set_unique_name(connection& connection, const std::string& unique_name);
+std::string get_unique_name(const connection& connection);
+unsigned long get_unix_user(const connection& connection, const std::string& name);
+int request_name(connection& connection, const std::string& name, unsigned int flags = 0);
+bool name_has_owner(const connection& connection, const std::string& name);
+
+bool start_service_by_name(connection& connection, const std::string& name, dbus_uint32_t& reply, dbus_uint32_t flags = 0);
+bool start_service_by_name(connection& connection, const std::string& name, dbus_uint32_t flags = 0);
 
 void add_match(connection& connection, const std::string& rule);
 void remove_match(connection& connection, const std::string& rule);

Index: connection.h
===================================================================
RCS file: /cvs/dbus/dbus-cpp/dbus-cpp/connection.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- connection.h	17 Dec 2003 19:16:36 -0000	1.1.1.1
+++ connection.h	17 Jun 2005 15:36:24 -0000	1.2
@@ -54,7 +54,7 @@
 
   ///Takes ownership:
   connection(DBusConnection* cobj);
-  
+
   connection(const connection& src);
   virtual ~connection();
 

Index: service.cc
===================================================================
RCS file: /cvs/dbus/dbus-cpp/dbus-cpp/service.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- service.cc	17 Dec 2003 19:16:37 -0000	1.1.1.1
+++ service.cc	17 Jun 2005 15:36:24 -0000	1.2
@@ -30,10 +30,10 @@
 
 service::service(const std::string& name, bus::bustype bus)
 : m_name(name)
-{ 
+{
   m_connection = bus::get_connection();
-  
-  bus::acquire_service(m_connection, name); //TODO: UnAcquire it later?
+
+  bus::request_name(m_connection, name);
 }
 
 service::~service()



More information about the dbus-commit mailing list