---
plugins/bluetooth.c | 22 ++++++++++++++++++++++
plugins/bluetooth.h | 1 +
plugins/hfp.c | 25 +------------------------
3 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index fc89579..49d1b5e 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -40,6 +40,28 @@ static DBusConnection *connection;
static GHashTable *uuid_hash = NULL;
static GHashTable *adapter_address_hash = NULL;
+void bluetooth_create_path(const char *dev_addr, const char *adapter_addr, char *buf, int
size)
+{
+ int i, j;
+
+ for (i = 0, j = 0; adapter_addr[j] && i < size - 1; j++)
+ if (adapter_addr[j] >= '0' && adapter_addr[j] <= '9')
+ buf[i++] = adapter_addr[j];
+ else if (adapter_addr[j] >= 'A' && adapter_addr[j] <=
'F')
+ buf[i++] = adapter_addr[j];
+
+ if (i < size - 1)
+ buf[i++] = '_';
+
+ for (j = 0; dev_addr[j] && i < size - 1; j++)
+ if (dev_addr[j] >= '0' && dev_addr[j] <= '9')
+ buf[i++] = dev_addr[j];
+ else if (dev_addr[j] >= 'A' && dev_addr[j] <= 'F')
+ buf[i++] = dev_addr[j];
+
+ buf[i] = '\0';
+}
+
static int send_method_call_with_reply(const char *dest, const char *path,
const char *interface, const char *method,
DBusPendingCallNotifyFunction cb,
diff --git a/plugins/bluetooth.h b/plugins/bluetooth.h
index 99bd617..4019daa 100644
--- a/plugins/bluetooth.h
+++ b/plugins/bluetooth.h
@@ -43,5 +43,6 @@ struct bluetooth_profile {
int bluetooth_register_uuid(const char *uuid, struct bluetooth_profile *profile);
void bluetooth_unregister_uuid(const char *uuid);
+void bluetooth_create_path(const char *dev_addr, const char *adapter_addr, char *buf, int
size);
#endif /* __BLUETOOTH_H */
diff --git a/plugins/hfp.c b/plugins/hfp.c
index ea34f4c..13439d9 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -446,29 +446,6 @@ static GDBusMethodTable agent_methods[] = {
{ NULL, NULL, NULL, NULL }
};
-static void create_path(const char *dev_addr, const char *adapter_addr,
- char *buf, int size)
-{
- int i, j;
-
- for (i = 0, j = 0; adapter_addr[j] && i < size - 1; j++)
- if (adapter_addr[j] >= '0' && adapter_addr[j] <= '9')
- buf[i++] = adapter_addr[j];
- else if (adapter_addr[j] >= 'A' && adapter_addr[j] <=
'F')
- buf[i++] = adapter_addr[j];
-
- if (i < size - 1)
- buf[i++] = '_';
-
- for (j = 0; dev_addr[j] && i < size - 1; j++)
- if (dev_addr[j] >= '0' && dev_addr[j] <= '9')
- buf[i++] = dev_addr[j];
- else if (dev_addr[j] >= 'A' && dev_addr[j] <= 'F')
- buf[i++] = dev_addr[j];
-
- buf[i] = '\0';
-}
-
static int hfp_create_modem(const char *device, const char *dev_addr,
const char *adapter_addr, const char *alias)
{
@@ -484,7 +461,7 @@ static int hfp_create_modem(const char *device, const char *dev_addr,
device, dev_addr, adapter_addr);
strcpy(buf, "hfp/");
- create_path(dev_addr, adapter_addr, buf + 4, sizeof(buf) - 4);
+ bluetooth_create_path(dev_addr, adapter_addr, buf + 4, sizeof(buf) - 4);
modem = ofono_modem_create(buf, "hfp");
if (modem == NULL)
--
1.7.1