mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-28 14:44:39 +08:00
profiles/network: Remove unneeded bnep_uuid function from bnep code
This function is no longer needed since connection and server can handle this functionality by itself.
This commit is contained in:
parent
c0266b7d45
commit
ab0b65ad6d
@ -85,16 +85,6 @@ struct bnep {
|
||||
void *disconn_data;
|
||||
};
|
||||
|
||||
const char *bnep_uuid(uint16_t id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; __svc[i].uuid128; i++)
|
||||
if (__svc[i].id == id)
|
||||
return __svc[i].uuid128;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *bnep_name(uint16_t id)
|
||||
{
|
||||
int i;
|
||||
|
@ -26,7 +26,6 @@ struct bnep;
|
||||
int bnep_init(void);
|
||||
int bnep_cleanup(void);
|
||||
|
||||
const char *bnep_uuid(uint16_t id);
|
||||
const char *bnep_name(uint16_t id);
|
||||
|
||||
struct bnep *bnep_new(int sk, uint16_t local_role, uint16_t remote_role,
|
||||
|
@ -284,21 +284,23 @@ static DBusMessage *local_connect(DBusConnection *conn,
|
||||
struct btd_service *service;
|
||||
struct network_conn *nc;
|
||||
const char *svc;
|
||||
const char *uuid;
|
||||
uint16_t id;
|
||||
int err;
|
||||
char uuid_str[MAX_LEN_UUID_STR];
|
||||
bt_uuid_t uuid16, uuid128;
|
||||
|
||||
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &svc,
|
||||
DBUS_TYPE_INVALID) == FALSE)
|
||||
return btd_error_invalid_args(msg);
|
||||
|
||||
id = get_pan_srv_id(svc);
|
||||
uuid = bnep_uuid(id);
|
||||
bt_uuid16_create(&uuid16, id);
|
||||
bt_uuid_to_uuid128(&uuid128, &uuid16);
|
||||
|
||||
if (uuid == NULL)
|
||||
if (bt_uuid_to_string(&uuid128, uuid_str, MAX_LEN_UUID_STR) < 0)
|
||||
return btd_error_invalid_args(msg);
|
||||
|
||||
service = btd_device_get_service(peer->device, uuid);
|
||||
service = btd_device_get_service(peer->device, uuid_str);
|
||||
if (service == NULL)
|
||||
return btd_error_not_supported(msg);
|
||||
|
||||
@ -439,15 +441,18 @@ static gboolean network_property_get_uuid(const GDBusPropertyTable *property,
|
||||
{
|
||||
struct network_peer *peer = data;
|
||||
struct network_conn *nc;
|
||||
const char *uuid;
|
||||
char uuid_str[MAX_LEN_UUID_STR];
|
||||
bt_uuid_t uuid16, uuid128;
|
||||
|
||||
nc = find_connection_by_state(peer->connections, CONNECTED);
|
||||
if (nc == NULL)
|
||||
return FALSE;
|
||||
|
||||
uuid = bnep_uuid(nc->id);
|
||||
bt_uuid16_create(&uuid16, nc->id);
|
||||
bt_uuid_to_uuid128(&uuid128, &uuid16);
|
||||
bt_uuid_to_string(&uuid128, uuid_str, MAX_LEN_UUID_STR);
|
||||
|
||||
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &uuid);
|
||||
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &uuid_str);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -114,14 +114,38 @@ static struct network_server *find_server(GSList *list, uint16_t id)
|
||||
static struct network_server *find_server_by_uuid(GSList *list,
|
||||
const char *uuid)
|
||||
{
|
||||
for (; list; list = list->next) {
|
||||
struct network_server *ns = list->data;
|
||||
bt_uuid_t srv_uuid, bnep_uuid;
|
||||
|
||||
if (strcasecmp(uuid, bnep_uuid(ns->id)) == 0)
|
||||
return ns;
|
||||
if (!bt_string_to_uuid(&srv_uuid, uuid)) {
|
||||
for (; list; list = list->next) {
|
||||
struct network_server *ns = list->data;
|
||||
|
||||
if (strcasecmp(uuid, bnep_name(ns->id)) == 0)
|
||||
return ns;
|
||||
bt_uuid16_create(&bnep_uuid, ns->id);
|
||||
|
||||
/* UUID value compare */
|
||||
if (!bt_uuid_cmp(&srv_uuid, &bnep_uuid))
|
||||
return ns;
|
||||
}
|
||||
} else {
|
||||
for (; list; list = list->next) {
|
||||
struct network_server *ns = list->data;
|
||||
|
||||
/* String value compare */
|
||||
switch (ns->id) {
|
||||
case BNEP_SVC_PANU:
|
||||
if (!strcasecmp(uuid, "panu"))
|
||||
return ns;
|
||||
break;
|
||||
case BNEP_SVC_NAP:
|
||||
if (!strcasecmp(uuid, "nap"))
|
||||
return ns;
|
||||
break;
|
||||
case BNEP_SVC_GN:
|
||||
if (!strcasecmp(uuid, "gn"))
|
||||
return ns;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user