diff --git a/doc/profile-api.txt b/doc/profile-api.txt
index 9a04185..03b7d2b 100644
--- a/doc/profile-api.txt
+++ b/doc/profile-api.txt
Human readable name for the profile
+ string Service
+
+ The primary service class UUID
+ (if different from the actual
+ profile UUID)
+
string Role
For asymmetric profiles that do not
diff --git a/lib/uuid.h b/lib/uuid.h
index 0edc57c..f85abbe 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
#define OBEX_SYNC_UUID "00001104-0000-1000-8000-00805f9b34fb"
#define OBEX_OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
#define OBEX_FTP_UUID "00001106-0000-1000-8000-00805f9b34fb"
-#define OBEX_BIP_UUID "0000111a-0000-1000-8000-00805f9b34fb"
-#define OBEX_PBAP_UUID "0000112f-0000-1000-8000-00805f9b34fb"
+#define OBEX_PCE_UUID "0000112e-0000-1000-8000-00805f9b34fb"
+#define OBEX_PSE_UUID "0000112f-0000-1000-8000-00805f9b34fb"
+#define OBEX_PBAP_UUID "00001130-0000-1000-8000-00805f9b34fb"
#define OBEX_MAS_UUID "00001132-0000-1000-8000-00805f9b34fb"
#define OBEX_MNS_UUID "00001133-0000-1000-8000-00805f9b34fb"
+#define OBEX_MAP_UUID "00001134-0000-1000-8000-00805f9b34fb"
typedef struct {
enum {
diff --git a/src/profile.c b/src/profile.c
index 43605a4..ec6d9cc 100644
--- a/src/profile.c
+++ b/src/profile.c
char *name;
char *owner;
- char *uuid;
char *path;
+ char *uuid;
+ char *service;
char *role;
char *record;
DBusMessageIter entry, value, *dict = data->dict;
struct btd_device *dev = data->io->device;
struct ext_profile *ext = data->io->ext;
+ const char *uuid = ext->service ? ext->service : ext->uuid;
- if (strcasecmp(p->uuid, ext->uuid) != 0)
+ if (strcasecmp(p->uuid, uuid) != 0)
return;
if (p->exists && !p->exists(p->uuid, dev, p->user_data))
{
struct ext_io *server = user_data;
struct ext_profile *ext = server->ext;
+ const char *uuid = ext->service ? ext->service : ext->uuid;
struct ext_io *conn;
GError *gerr = NULL;
bdaddr_t src, dst;
conn = create_conn(server, io, &src, &dst);
- conn->auth_id = btd_request_authorization(&src, &dst, ext->uuid,
- ext_auth, conn);
+ conn->auth_id = btd_request_authorization(&src, &dst, uuid, ext_auth,
+ conn);
if (conn->auth_id == 0) {
error("%s authorization failure", ext->name);
ext_io_destroy(conn);
.get_record = get_ftp_record,
.version = 0x0102,
}, {
- .uuid = OBEX_BIP_UUID,
- .name = "Basic Imaging",
- .channel = BIP_DEFAULT_CHANNEL,
- }, {
.uuid = OBEX_SYNC_UUID,
.name = "Synchronization",
.channel = SYNC_DEFAULT_CHANNEL,
}, {
- .uuid = OBEX_PBAP_UUID,
+ .uuid = OBEX_PSE_UUID,
.name = "Phone Book Access",
- .channel = SYNC_DEFAULT_CHANNEL,
+ .channel = PBAP_DEFAULT_CHANNEL,
}, {
.uuid = OBEX_MAS_UUID,
.name = "Message Access",
dbus_message_iter_get_basic(value, &feat);
ext->features = feat;
+ } else if (strcasecmp(key, "Service") == 0) {
+ if (type != DBUS_TYPE_STRING)
+ return -EINVAL;
+ dbus_message_iter_get_basic(value, &str);
+ g_free(ext->service);
+ ext->service = bt_name2string(str);
}
return 0;
}
+static void set_service(struct ext_profile *ext)
+{
+ if (strcasecmp(ext->uuid, HSP_HS_UUID) == 0) {
+ ext->service = g_strdup(ext->uuid);
+ } else if (strcasecmp(ext->uuid, HSP_AG_UUID) == 0) {
+ ext->service = ext->uuid;
+ ext->uuid = g_strdup(HSP_HS_UUID);
+ } else if (strcasecmp(ext->uuid, HFP_HS_UUID) == 0) {
+ ext->service = g_strdup(ext->uuid);
+ } else if (strcasecmp(ext->uuid, HFP_AG_UUID) == 0) {
+ ext->service = ext->uuid;
+ ext->uuid = g_strdup(HFP_HS_UUID);
+ } else if (strcasecmp(ext->uuid, OBEX_SYNC_UUID) == 0 ||
+ strcasecmp(ext->uuid, OBEX_OPP_UUID) == 0 ||
+ strcasecmp(ext->uuid, OBEX_FTP_UUID) == 0) {
+ ext->service = g_strdup(ext->uuid);
+ } else if (strcasecmp(ext->uuid, OBEX_PSE_UUID) == 0 ||
+ strcasecmp(ext->uuid, OBEX_PCE_UUID) == 0) {
+ ext->service = ext->uuid;
+ ext->uuid = g_strdup(OBEX_PBAP_UUID);
+ } else if (strcasecmp(ext->uuid, OBEX_MAS_UUID) == 0 ||
+ strcasecmp(ext->uuid, OBEX_MNS_UUID) == 0) {
+ ext->service = ext->uuid;
+ ext->uuid = g_strdup(OBEX_MAP_UUID);
+ }
+}
+
static struct ext_profile *create_ext(const char *owner, const char *path,
const char *uuid,
DBusMessageIter *opts)
dbus_message_iter_next(opts);
}
+ if (!ext->service)
+ set_service(ext);
+
if (!ext->name)
ext->name = g_strdup_printf("%s%s/%s", owner, path, uuid);
p = &ext->p;
p->name = ext->name;
- p->local_uuid = ext->uuid;
+ p->local_uuid = ext->service ? ext->service : ext->uuid;
/* Typecast can't really be avoided here:
* http://c-faq.com/ansi/constmismatch.html */
g_free(ext->name);
g_free(ext->owner);
g_free(ext->uuid);
+ g_free(ext->service);
g_free(ext->role);
g_free(ext->path);
g_free(ext->record);