summaryrefslogtreecommitdiff
path: root/obexd/src
diff options
context:
space:
mode:
Diffstat (limited to 'obexd/src')
-rwxr-xr-xobexd/src/main.c8
-rwxr-xr-xobexd/src/manager.c129
-rwxr-xr-xobexd/src/obex.c16
-rwxr-xr-xobexd/src/obexd.h3
-rwxr-xr-xobexd/src/org.bluez.obex.service3
5 files changed, 156 insertions, 3 deletions
diff --git a/obexd/src/main.c b/obexd/src/main.c
index c774cda5..e2df4eff 100755
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
@@ -179,6 +179,14 @@ static GOptionEntry options[] = {
{ NULL },
};
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void obex_option_set_root_folder(const char *root)
+{
+ g_free(option_root);
+ option_root = g_strdup(root);
+}
+#endif
+
gboolean obex_option_auto_accept(void)
{
return option_autoaccept;
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index f84384ae..90c51147 100755
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -190,6 +190,52 @@ static DBusMessage *unregister_agent(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static DBusMessage *set_root(DBusConnection *conn, DBusMessage *msg,
+ const char *root, void *data)
+{
+ DBG("new_root: %s", root);
+
+ /* Change the option root path (using in filesystem) */
+ obex_option_set_root_folder(root);
+
+ return dbus_message_new_method_return(msg);
+}
+
+static DBusMessage *set_property(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ DBusMessageIter iter;
+ DBusMessageIter sub;
+ const char *property;
+
+ if (!dbus_message_iter_init(msg, &iter))
+ return invalid_args(msg);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
+ return invalid_args(msg);
+
+ dbus_message_iter_get_basic(&iter, &property);
+ dbus_message_iter_next(&iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
+ return invalid_args(msg);
+ dbus_message_iter_recurse(&iter, &sub);
+
+ if (g_str_equal("Root", property)) {
+ const char *root;
+
+ if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRING)
+ return invalid_args(msg);
+ dbus_message_iter_get_basic(&sub, &root);
+
+ return set_root(conn, msg, root, data);
+ }
+
+ return invalid_args(msg);
+}
+#endif
+
static gboolean get_source(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
@@ -440,6 +486,79 @@ static gboolean transfer_get_filename(const GDBusPropertyTable *property,
return TRUE;
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static gboolean transfer_operation_exists(const GDBusPropertyTable *property,
+ void *data)
+{
+ struct obex_transfer *transfer = data;
+ struct obex_session *session = transfer->session;
+
+ if (session->cmd == G_OBEX_OP_PUT &&
+ session->size != OBJECT_SIZE_DELETE)
+ return TRUE;
+ else if (session->cmd == G_OBEX_OP_GET)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static gboolean transfer_get_operation(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *data)
+{
+ struct obex_transfer *transfer = data;
+ struct obex_session *session = transfer->session;
+ const char *operation;
+
+ if (session->cmd == G_OBEX_OP_PUT &&
+ session->size != OBJECT_SIZE_DELETE)
+ operation = "PUT";
+ else if (session->cmd == G_OBEX_OP_GET)
+ operation = "GET";
+ else
+ return FALSE;
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &operation);
+
+ return TRUE;
+}
+
+static gboolean transfer_address_exists(const GDBusPropertyTable *property,
+ void *data)
+{
+ struct obex_transfer *transfer = data;
+ struct obex_session *session = transfer->session;
+ char *address;
+ int err;
+
+ err = obex_getpeername(session, &address);
+ if (err < 0)
+ return FALSE;
+
+ g_free(address);
+
+ return TRUE;
+}
+
+static gboolean transfer_get_address(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *data)
+{
+ struct obex_transfer *transfer = data;
+ struct obex_session *session = transfer->session;
+ char *address;
+ int err;
+
+ err = obex_getpeername(session, &address);
+ if (err < 0)
+ return FALSE;
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &address);
+ g_free(address);
+
+ return TRUE;
+}
+
+#endif
+
static gboolean transfer_get_transferred(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
@@ -457,6 +576,10 @@ static const GDBusMethodTable manager_methods[] = {
GDBUS_ARGS({ "agent", "o" }), NULL, register_agent) },
{ GDBUS_METHOD("UnregisterAgent",
GDBUS_ARGS({ "agent", "o" }), NULL, unregister_agent) },
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ { GDBUS_METHOD("SetProperty",
+ GDBUS_ARGS({ "property", "sv" }), NULL, set_property) },
+#endif
{ }
};
@@ -474,6 +597,12 @@ static const GDBusPropertyTable transfer_properties[] = {
{ "Time", "t", transfer_get_time, NULL, transfer_time_exists },
{ "Filename", "s", transfer_get_filename, NULL,
transfer_filename_exists },
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ { "Operation", "s", transfer_get_operation, NULL,
+ transfer_operation_exists },
+ { "Address", "s", transfer_get_address, NULL,
+ transfer_address_exists },
+#endif
{ "Transferred", "t", transfer_get_transferred },
{ }
};
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 788bffc6..fee2461b 100755
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -642,7 +642,17 @@ static void parse_name(struct obex_session *os, GObexPacket *req)
if (!g_obex_header_get_unicode(hdr, &name))
return;
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ DBG("Obex Session For: %s", os->service->name);
+ if (name && g_strcmp0(os->service->name, "Object Push server") == 0) {
+ char *new_name;
+ new_name = strrchr(name, '/');
+ if (new_name) {
+ name = new_name + 1;
+ DBG("FileName %s", name);
+ }
+ }
+#endif
os->name = g_strdup(name);
DBG("NAME: %s", os->name);
}
@@ -773,7 +783,11 @@ int obex_put_stream_start(struct obex_session *os, const char *filename)
int err;
os->object = os->driver->open(filename, O_WRONLY | O_CREAT | O_TRUNC,
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ 0644, os->service_data,
+#else
0600, os->service_data,
+#endif
os->size != OBJECT_SIZE_UNKNOWN ?
(size_t *) &os->size : NULL, &err);
if (os->object == NULL) {
diff --git a/obexd/src/obexd.h b/obexd/src/obexd.h
index 42c3c4d9..ddf5ba03 100755
--- a/obexd/src/obexd.h
+++ b/obexd/src/obexd.h
@@ -41,3 +41,6 @@ gboolean obex_option_auto_accept(void);
const char *obex_option_root_folder(void);
gboolean obex_option_symlinks(void);
const char *obex_option_capability(void);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void obex_option_set_root_folder(const char *root);
+#endif
diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
index a5380888..3abb5551 100755
--- a/obexd/src/org.bluez.obex.service
+++ b/obexd/src/org.bluez.obex.service
@@ -1,4 +1,3 @@
[D-BUS Service]
Name=org.bluez.obex
-Exec=/bin/false
-SystemdService=dbus-org.bluez.obex.service
+Exec=/bin/sh -c 'exec /usr/libexec/bluetooth/obexd -d --noplugin=ftp,syncevolution,pcsuite,irmc --symlinks -r /opt/usr/home/owner/media/'