[PATCH 16/16] e_dbus/bluez: move DeviceFound to e_bluez_devicefound.c
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 27 Feb 2010 05:28:07 +0000 (05:28 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 27 Feb 2010 05:28:07 +0000 (05:28 +0000)
By: Gustavo F. Padovan <padovan@profusion.mobi>

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@46568 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/e_dbus_bluez_test.c
src/lib/bluez/E_Bluez.h
src/lib/bluez/Makefile.am
src/lib/bluez/e_bluez_adapter.c
src/lib/bluez/e_bluez_devicefound.c [new file with mode: 0644]

index 4e0f72f..4fbe4d9 100644 (file)
@@ -119,7 +119,7 @@ _on_device_found(void *data, int type, void *info)
    e_bluez_element_array_print(stderr, device->array);
    printf("\n");
 
-   e_bluez_adapter_device_found_free(device);
+   e_bluez_devicefound_free(device);
    return 1;
 }
 
index 7fe927e..53b277a 100644 (file)
@@ -93,8 +93,6 @@ extern "C" {
   EAPI bool e_bluez_manager_default_adapter(E_DBus_Method_Return_Cb cb, void *data) EINA_WARN_UNUSED_RESULT;
 
   /* Adapter Methods */
-  EAPI void e_bluez_adapter_device_found_free(E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1);
-  EAPI const char *e_bluez_adapter_device_found_get_alias(E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1);
   EAPI bool e_bluez_adapter_agent_register(E_Bluez_Element *element, const char *object_path, const char *capability, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
   EAPI bool e_bluez_adapter_agent_unregister(E_Bluez_Element *element, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
   EAPI bool e_bluez_adapter_address_get(E_Bluez_Element *element, const char **address) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
@@ -105,6 +103,10 @@ extern "C" {
   EAPI bool e_bluez_adapter_stop_discovery(E_Bluez_Element *element, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
 bool e_bluez_adapter_create_paired_device(E_Bluez_Element *element, const char *object_path, const char *capability, const char *device, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1,2,4) EINA_WARN_UNUSED_RESULT;
 
+  /* Device Found Methods */
+  EAPI void e_bluez_devicefound_free(E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1);
+  EAPI const char *e_bluez_devicefound_alias_get(E_Bluez_Device_Found *device) EINA_ARG_NONNULL(1);
+
   /* Devices Methods */
   EAPI bool e_bluez_device_name_get(E_Bluez_Element *element, const char **name) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
 
index d69b481..b0e3c9c 100644 (file)
@@ -16,7 +16,8 @@ e_bluez.c \
 e_bluez_element.c \
 e_bluez_manager.c \
 e_bluez_adapter.c \
-e_bluez_device.c
+e_bluez_device.c \
+e_bluez_devicefound.c
 
 libebluez_la_LIBADD = \
 @EDBUS_LIBS@ @EVAS_LIBS@ \
index 1cfcc72..307be25 100644 (file)
@@ -50,37 +50,6 @@ _device_found_callback(void *data, DBusMessage *msg)
 }
 
 /**
- * Free a E_Bluez_Device_Found struct
- *
- * @param device the struct to be freed
- */
-void
-e_bluez_adapter_device_found_free(E_Bluez_Device_Found *device)
-{
-   EINA_SAFETY_ON_NULL_RETURN(device);
-
-   eina_stringshare_del(device->name);
-   e_bluez_element_array_free(device->array, NULL);
-}
-
-const char *
-e_bluez_adapter_device_found_get_alias(E_Bluez_Device_Found *device)
-{
-   E_Bluez_Element_Dict_Entry *entry;
-   const char *alias = eina_stringshare_add("Alias");
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(device, NULL);
-
-   entry = e_bluez_element_array_dict_find_stringshared(device->array,
-                                                       alias);
-
-   if (entry->type == DBUS_TYPE_STRING)
-      return entry->value.str;
-
-   return NULL;
-}
-
-/**
  * Register new agent for handling user requests.
  *
  * Call method RegisterAgent(object) on server in order to
diff --git a/src/lib/bluez/e_bluez_devicefound.c b/src/lib/bluez/e_bluez_devicefound.c
new file mode 100644 (file)
index 0000000..0ce6eb8
--- /dev/null
@@ -0,0 +1,32 @@
+#include "e_bluez_private.h"
+
+/**
+ * Free a E_Bluez_Device_Found struct
+ *
+ * @param device the struct to be freed
+ */
+void
+e_bluez_devicefound_free(E_Bluez_Device_Found *device)
+{
+   EINA_SAFETY_ON_NULL_RETURN(device);
+
+   eina_stringshare_del(device->name);
+   e_bluez_element_array_free(device->array, NULL);
+}
+
+const char *
+e_bluez_devicefound_alias_get(E_Bluez_Device_Found *device)
+{
+   E_Bluez_Element_Dict_Entry *entry;
+   const char *alias = eina_stringshare_add("Alias");
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(device, NULL);
+
+   entry = e_bluez_element_array_dict_find_stringshared(device->array,
+                                                       alias);
+
+   if (entry->type == DBUS_TYPE_STRING)
+      return entry->value.str;
+
+   return NULL;
+}