#include "driver.h"
#include "map_ap.h"
#include "mns-tizen.h"
+#include "gobex/gobex-apparam.h"
#define OBEX_MNS_UUID \
"\xBB\x58\x2B\x41\x42\x0C\x11\xDB\xB0\xDE\x08\x00\x20\x0C\x9A\x66"
EVENT_TYPE_UNKNOWN,
};
-struct sendevent_apparam {
- uint8_t masinstanceid_tag;
- uint8_t masinstanceid_len;
- uint8_t masinstanceid;
-} __attribute__ ((packed));
-
struct mns_data {
struct obc_session *session;
DBusMessage *msg;
{
struct mns_data *mns = user_data;
struct obc_transfer *transfer;
- struct sendevent_apparam apparam;
+ GObexApparam *apparam;
gchar *event_type;
gchar *folder;
gchar *old_folder;
if (transfer == NULL)
goto fail;
- apparam.masinstanceid_tag = MAP_AP_MASINSTANCEID;
- apparam.masinstanceid_len = 1;
/* Obexd currently supports single SDP for MAS */
- apparam.masinstanceid = 0;
+ apparam = g_obex_apparam_set_uint8(NULL, MAP_AP_MASINSTANCEID, 0);
- obc_transfer_set_apparam(transfer, &apparam);
+ obc_transfer_set_apparam(transfer, apparam);
if (obc_session_queue(mns->session, transfer, NULL, NULL, &err))
return dbus_message_new_method_return(message);
/*
*
- * OBEX Server
- *
- * Copyright (c) 2000-2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * OBEX Server
*
+ * Copyright (C) 2012 Samsung Electronics Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
return 0;
}
+
+static void append_variant(DBusMessageIter *iter, int type, void *val)
+{
+ DBusMessageIter value;
+ char sig[2] = { type, '\0' };
+
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT, sig, &value);
+ dbus_message_iter_append_basic(&value, type, val);
+ dbus_message_iter_close_container(iter, &value);
+}
+
+static void dict_append_entry(DBusMessageIter *dict, const char *key,
+ int type, void *val)
+{
+ DBusMessageIter entry;
+
+ dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry);
+ dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
+ append_variant(&entry, type, val);
+ dbus_message_iter_close_container(dict, &entry);
+}
+
int messages_get_messages_listing(void *session, const char *name,
uint16_t max, uint16_t offset,
uint8_t subject_len,
DBusPendingCall *call;
DBusMessage *message;
struct session *s = session;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
if (name != NULL && strlen(name))
s->name = g_strdup(name);
dbus_message_append_args(message, DBUS_TYPE_STRING, &s->name,
DBUS_TYPE_UINT16, &s->max,
+ DBUS_TYPE_UINT16, &s->offset,
+ DBUS_TYPE_BYTE, &subject_len,
DBUS_TYPE_INVALID);
+ dbus_message_iter_init_append(message, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+ if (filter->parameter_mask)
+ dict_append_entry(&dict, "ParameterMask", DBUS_TYPE_UINT32,
+ &filter->parameter_mask);
+ if (filter->type)
+ dict_append_entry(&dict, "FilterMessageType", DBUS_TYPE_BYTE,
+ &filter->type);
+ if (filter->period_begin)
+ dict_append_entry(&dict, "FilterPeriodBegin", DBUS_TYPE_STRING,
+ &filter->period_begin);
+ if (filter->period_end)
+ dict_append_entry(&dict, "FilterPeriodEnd", DBUS_TYPE_STRING,
+ &filter->period_end);
+ if (filter->read_status)
+ dict_append_entry(&dict, "FilterReadStatus", DBUS_TYPE_BYTE,
+ &filter->read_status);
+ if (filter->recipient)
+ dict_append_entry(&dict, "FilterRecipient", DBUS_TYPE_STRING,
+ &filter->recipient);
+ if (filter->originator)
+ dict_append_entry(&dict, "FilterOriginator", DBUS_TYPE_STRING,
+ &filter->originator);
+ if (filter->priority)
+ dict_append_entry(&dict, "FilterPriority", DBUS_TYPE_BYTE,
+ &filter->priority);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
if (dbus_connection_send_with_reply(g_conn, message, &call,
DBUS_TIMEOUT_INFINITE) == FALSE) {
error("Could not send dbus message");