diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 7d78575..0493260 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
void *disconn_data;
};
-uint16_t bnep_service_id(const char *svc)
-{
- int i;
- uint16_t id;
-
- /* Friendly service name */
- for (i = 0; __svc[i].name; i++) {
- if (!strcasecmp(svc, __svc[i].name))
- return __svc[i].id;
- }
-
- /* UUID 128 string */
- for (i = 0; __svc[i].uuid128; i++) {
- if (!strcasecmp(svc, __svc[i].uuid128))
- return __svc[i].id;
- }
-
- /* Try convert to HEX */
- id = strtol(svc, NULL, 16);
- if ((id < BNEP_SVC_PANU) || (id > BNEP_SVC_GN))
- return 0;
-
- return id;
-}
-
const char *bnep_uuid(uint16_t id)
{
int i;
diff --git a/profiles/network/bnep.h b/profiles/network/bnep.h
index 5aedf38..b0a91e5 100644
--- a/profiles/network/bnep.h
+++ b/profiles/network/bnep.h
int bnep_init(void);
int bnep_cleanup(void);
-uint16_t bnep_service_id(const char *svc);
const char *bnep_uuid(uint16_t id);
const char *bnep_name(uint16_t id);
diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index ecb8441..4311cc9 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
#include "src/profile.h"
#include "src/service.h"
#include "src/error.h"
+#include "lib/uuid.h"
#include "bnep.h"
#include "connection.h"
static GSList *peers = NULL;
-static uint16_t get_service_id(struct btd_service *svc)
+static uint16_t get_pan_srv_id(const char *svc)
{
- return bnep_service_id(btd_service_get_profile(svc)->remote_uuid);
+ if (!strcasecmp(svc, "panu") || !strcasecmp(svc, PANU_UUID))
+ return BNEP_SVC_PANU;
+ if (!strcasecmp(svc, "nap") || !strcasecmp(svc, NAP_UUID))
+ return BNEP_SVC_NAP;
+ if (!strcasecmp(svc, "gn") || !strcasecmp(svc, GN_UUID))
+ return BNEP_SVC_GN;
+
+ return 0;
}
static struct network_peer *find_peer(GSList *list, struct btd_device *device)
DBUS_TYPE_INVALID) == FALSE)
return btd_error_invalid_args(msg);
- id = bnep_service_id(svc);
+ id = get_pan_srv_id(svc);
uuid = bnep_uuid(id);
if (uuid == NULL)
{
struct network_conn *nc = btd_service_get_user_data(svc);
struct network_peer *peer = nc->peer;
- uint16_t id = get_service_id(svc);
+ uint16_t id = get_pan_srv_id(btd_service_get_profile(svc)->remote_uuid);
GError *err = NULL;
const bdaddr_t *src;
const bdaddr_t *dst;
struct btd_device *device = btd_service_get_device(svc);
struct network_conn *conn = btd_service_get_user_data(svc);
struct network_peer *peer = conn->peer;
- uint16_t id = get_service_id(svc);
+ uint16_t id = get_pan_srv_id(btd_service_get_profile(svc)->remote_uuid);
DBG("%s id %u", device_get_path(device), id);
struct btd_device *device = btd_service_get_device(svc);
struct network_peer *peer;
struct network_conn *nc;
- uint16_t id = get_service_id(svc);
+ uint16_t id = get_pan_srv_id(btd_service_get_profile(svc)->remote_uuid);
DBG("%s id %u", device_get_path(device), id);