Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez-devel] [D-BUS PATCH]bluez-pin
@ 2005-10-31 18:10 Claudio Takahasi
  2005-10-31 18:25 ` Marcel Holtmann
  2005-10-31 18:39 ` Bastien Nocera
  0 siblings, 2 replies; 3+ messages in thread
From: Claudio Takahasi @ 2005-10-31 18:10 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

Hi,

here is the patch removing the support for old dbus versions.

The code style is a little weird, but I kept the code style :)

Who is responsible for maintain the bluez-pin?

Regards,
Claudio.
--
---------------------------------------------------------
Claudio Takahasi
Instituto Nokia de Tecnologia - INdT

[-- Attachment #2: pin_patch.patch --]
[-- Type: application/octet-stream, Size: 3135 bytes --]

--- bluez-pin-0.26.orig/pin-dbus.c	2005-09-05 16:09:13.000000000 -0300
+++ bluez-pin-0.26-dbus0.50/pin-dbus.c	2005-10-31 11:45:46.000000000 -0200
@@ -39,17 +39,11 @@
 static void
 bluez_pin_send_dbus_reply (DBusConnection *connection, DBusMessage *message, const char *pin)
 {
-#ifndef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
-  DBusMessageIter iter;
 
-  dbus_message_append_iter_init (message, &iter);
   if (pin)
-    dbus_message_iter_append_string (&iter, pin);
-#else
-  dbus_message_append_args(message,
-			DBUS_TYPE_STRING, &pin,
-			DBUS_TYPE_INVALID);
-#endif
+    dbus_message_append_args(message,
+  			    DBUS_TYPE_STRING, &pin,
+			    DBUS_TYPE_INVALID);
 
   dbus_connection_send (connection, message, NULL);
 
@@ -72,6 +66,7 @@
 bluez_pin_handle_dbus_request (DBusConnection *connection, DBusMessage *message)
 {
   DBusMessageIter iter;
+  DBusMessageIter array_iter;
   gboolean out;
   bdaddr_t bdaddr, sbdaddr;
   int type;
@@ -92,11 +87,7 @@
     goto error;
   }
 
-#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
   dbus_message_iter_get_basic (&iter, &out);
-#else
-  out = dbus_message_iter_get_boolean (&iter);
-#endif
 
   if (! dbus_message_iter_next (&iter))
     {
@@ -107,16 +98,13 @@
 
   type = dbus_message_iter_get_arg_type (&iter);
 
-#ifdef HAVE_DBUS_MESSAGE_ITER_GET_BASIC
   nbytes = 0;
-  if (type == DBUS_TYPE_ARRAY)
-    dbus_message_iter_get_fixed_array (&iter, &bytes, &nbytes);
+  if (type == DBUS_TYPE_ARRAY) {
+    dbus_message_iter_recurse(&iter, &array_iter);
+    dbus_message_iter_get_fixed_array (&array_iter, &bytes, &nbytes);
+  }
+
   if (nbytes != sizeof (bdaddr))
-#else
-  if (type != DBUS_TYPE_ARRAY
-      || ! dbus_message_iter_get_byte_array (&iter, &bytes, &nbytes)
-      || nbytes != sizeof (bdaddr))
-#endif
   {
     reply = dbus_message_new_error (message, WRONG_ARGS_ERROR,
 				    "Byte array expected, other type given");
--- bluez-pin-0.26.orig/main.c	2005-09-05 16:11:20.000000000 -0300
+++ bluez-pin-0.26-dbus0.50/main.c	2005-10-31 10:57:14.000000000 -0200
@@ -47,7 +47,7 @@
     return bluez_pin_handle_dbus_request (connection, message);
 
   if (dbus_message_is_signal (message,
-                              DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
+                              DBUS_INTERFACE_LOCAL,
                               "Disconnected"))
     exit (0);
   
@@ -84,7 +84,7 @@
   dbus_connection_register_object_path (connection, new_object_path, &dbus_vtable, NULL);
   dbus_connection_register_object_path (connection, old_object_path, &dbus_vtable, NULL);
 
-  dbus_bus_acquire_service (connection, NEW_SERVICE_NAME, 0, &error);
+  dbus_bus_request_name (connection, NEW_SERVICE_NAME, 0, &error);
   if (dbus_error_is_set (&error))
     {
       fprintf (stderr, "Failed to acquire %s service: %s\n", NEW_SERVICE_NAME, error.message);
@@ -92,7 +92,7 @@
       errors++;
     }
 
-  dbus_bus_acquire_service (connection, OLD_SERVICE_NAME, 0, &error);
+  dbus_bus_request_name (connection, OLD_SERVICE_NAME, 0, &error);
   if (dbus_error_is_set (&error))
     {
       fprintf (stderr, "Failed to acquire %s service: %s\n", OLD_SERVICE_NAME, error.message);


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-31 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-31 18:10 [Bluez-devel] [D-BUS PATCH]bluez-pin Claudio Takahasi
2005-10-31 18:25 ` Marcel Holtmann
2005-10-31 18:39 ` Bastien Nocera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox