Linux bluetooth development
 help / color / mirror / Atom feed
From: Claudio Takahasi <cktakahasi@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] [D-BUS PATCH]bluez-pin
Date: Mon, 31 Oct 2005 16:10:52 -0200	[thread overview]
Message-ID: <e1effdeb0510311010x27fcd538w310b97f5999e7771@mail.gmail.com> (raw)

[-- 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);


             reply	other threads:[~2005-10-31 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-31 18:10 Claudio Takahasi [this message]
2005-10-31 18:25 ` [Bluez-devel] [D-BUS PATCH]bluez-pin Marcel Holtmann
2005-10-31 18:39 ` Bastien Nocera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1effdeb0510311010x27fcd538w310b97f5999e7771@mail.gmail.com \
    --to=cktakahasi@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox