-/*
+/*******************************************************************************
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Copyright 2006 ComArch S.A.
-*/
-/** \file dictionary_engine.h
- * \brief API for DBusWrapper library.
+Copyright 2006-2008 ComArch S.A.
+*******************************************************************************/
+/** \defgroup DBusWrapperAPI mDictionary D-Bus Wrapper API
+ * \brief Wrapper for GLib D-Bus bindings for mDictionary project.
+ *
+ */
+/*@{*/
+/** \file ws_dbus.h
+ * \brief API for D-Bus Wrapper Library.
*
* Declaration of methods used to communicate between
* dictionary UI and searching module
#include <stdlib.h>
#include <glib-2.0/glib.h>
-/**\brief Callback function definition
+/** \brief Callback function definition
*
* @param error - pointer to a GError structure. Currently not used
* @param data - GArray of osso_rpc_t structures containing sent data
*/
typedef void (* ws_dbus_cb) (GError *error, gpointer data, gpointer user_data);
-/**\brief An enumeration of data types to be sent via DBUS*/
+/** \brief An enumeration of data types to be sent via DBUS*/
typedef enum
{
WS_DBUS_TYPE_STRING = DBUS_TYPE_STRING,
WS_DBUS_TYPE_SIGNAL = DBUS_TYPE_INT32
} WSDBusDataType;
-/**\brief This structure contains data vital for DBUS communication.
+/** \brief This structure contains data vital for DBUS communication.
*
- * The fields shouldn't be modified directly. It should be done by
+ * The fields shouldn't be modified directly. It should be done by
* ws_dbus_config function
- *\sa ws_dbus_config
+ * \sa ws_dbus_config
*/
-
struct _WSDBusData
{
osso_context_t * context;
*/
};
-/**
- *\brief An enumeration of return values.
+/** \brief An enumeration of return values.
*/
typedef enum
{
/**< Transmission error*/
} WSDBusStatus;
-/**\brief Specifies the possible kinds of event notifications that can be sent
- *via DBus
+/** \brief Specifies the possible kinds of event notifications that can be sent
+ * via DBus
*/
-typedef enum
+typedef enum
{
- WS_DBUS_INFO_TERMINATE = 1,
+ WS_DBUS_INFO_TERMINATE = 1,
/**<GUI signal - terminate the application*/
WS_DBUS_INFO_STOP_SEARCH,
/**<GUI signal - stop the current search*/
/**<Manager signal - informs the GUI,that history record can not be
*found because dictionary is not activate
*/
- WS_DBUS_BOOKMARKS_ADDED_OK,
+ WS_DBUS_BOOKMARKS_ADDED_OK,
/**<GUI signal - send if bookmark has been added succesfully*/
- WS_DBUS_BOOKMARKS_REMOVED_OK,
+ WS_DBUS_BOOKMARKS_REMOVED_OK,
/**<GUI signal - send if bookmark has been removed succesfully*/
WS_DBUS_BOOKMARKS_ADDED_FAIL,
/**<GUI signal - send if bookmark has not been added succesfully*/
- WS_DBUS_BOOKMARKS_REMOVED_FAIL,
+ WS_DBUS_BOOKMARKS_REMOVED_FAIL,
/**<GUI signal - send if bookmark has not been removed succesfully*/
WS_DBUS_LOAD_BOOKMARK_FAILED,
/**<GUI signal - blocks bookmarks*/
/**<Manager signal - words' list full*/
WS_DBUS_WORDS_LIST_FILLED_NOT_FULL
/**<Manager signal - words' list filled but not full*/
-
} WSDBusNotify;
-/**
- *\brief This structure is used for specifying the field of WSDBusData structure
- *one would like to modify.
+/** \brief This structure is used for specifying the field of WSDBusData
+ * structure one would like to modify.
*
- *It is used in the ws_dbus_config function. Its main purpose is to clarify D-BUS
- *configuration.
+ * It is used in the ws_dbus_config function. Its main purpose is to clarify
+ * D-BUS configuration.
*/
typedef enum
{
typedef struct _WSDBusData WSDBusData;
-/**\brief First function to be called in every program using this wrapper library
+/** \brief First function to be called in every program using this wrapper
*
- *This function is used for allocating memory for the WSDBusData structure and
- *setting some basic parameters.
- *@param name - name of the application
- *@param version - app's version
- *@return pointer to WSDBusData structure\n
- *\sa ::WSDBusData
+ * This function is used for allocating memory for the WSDBusData structure and
+ * setting some basic parameters.
+ * \param name - name of the application
+ * \param version - app's version
+ * \return pointer to WSDBusData structure\n
+ * \sa WSDBusData
*/
WSDBusData * ws_dbus_create (gchar *name, gchar *version);
-/**\brief This function is used for setting dbus service/client parameters.
+/** \brief This function is used for setting dbus service/client parameters.
*
- *These include the addresses of both remote and local apps communicating
- *@param ws_dbus_data - pointer to a structure uniquely identifying
- the application for DBus. The possible values of
- *this parameter are listed here: ::WSDBusConfig
- *@param field - the name of the variable, this function is supposed to set.
- *@param value - the value of the variable
- *@return WS_STATUS_OK - on success \n
- *WS_STATUS_ERROR - on error
- *\sa ::WSDBusConfig
+ * These include the addresses of both remote and local apps communicating
+ * \param ws_dbus_data - pointer to a structure uniquely identifying
+ * the application for DBus. The possible values of
+ * this parameter are listed here: ::WSDBusConfig
+ * \param field - the name of the variable, this function is supposed to set.
+ * \param value - the value of the variable
+ * \return WS_STATUS_OK - on success \n
+ * WS_STATUS_ERROR - on error
+ * \sa WSDBusConfig
*/
WSDBusStatus ws_dbus_config (WSDBusData * ws_dbus_data,
WSDBusConfig field,
gchar *value);
/**
- *\brief Initialize D-BUS communication.
+ * \brief Initialize D-BUS communication.
*
- *It should be the called after <B>ws_dbus_create</B> and after setting all D-BUS
- *parameters with the <B>ws_dbus_config</B> function.
- *The structure it returns is necessary to call out every function implemented in
- *this wrapper library.
- *@param ws_dbus_data - it's a structure containing the unique paths to objects
- *and interfaces to be registered in the DBus session daemon
- *@return WS_STATUS_OK - on success \n
- *WS_STATUS_ERROR - on error
- *\sa ::WSDBusConfig, ws_dbus_create, ws_dbus_config
+ * It should be the called after <B>ws_dbus_create</B> and after setting all D-BUS
+ * parameters with the <B>ws_dbus_config</B> function.
+ * The structure it returns is necessary to call out every function implemented in
+ * this wrapper library.
+ * \param ws_dbus_data - it's a structure containing the unique paths to objects
+ * and interfaces to be registered in the DBus session daemon
+ * \return WS_STATUS_OK - on success \n
+ * WS_STATUS_ERROR - on error
+ * \sa WSDBusConfig | ws_dbus_create | ws_dbus_config
*/
-
WSDBusStatus ws_dbus_connect (WSDBusData * ws_dbus_data);
-/**\brief Function deinitializing D-BUS wrapper library
+/** \brief Function deinitializing D-BUS wrapper library
*
- *Before the program exits, all memory allocated by D-BUS should be freed.
- *@param ws_dbus_data - pointer to a structure uniquely identifying the
- *application for DBus
- *@return WS_STATUS_OK - on success \n
- *WS_STATUS_ERROR - on error
+ * Before the program exits, all memory allocated by D-BUS should be freed.
+ * \param ws_dbus_data - pointer to a structure uniquely identifying the
+ * application for DBus
+ * \return \li WS_STATUS_OK - on success \li WS_STATUS_ERROR - on error
*/
-
void ws_dbus_destroy (WSDBusData * ws_dbus_data);
-/**\brief This function is used for setting a callback function for a
+/** \brief This function is used for setting a callback function for a
* specific method name
*
- *@param ws_dbus_data - pointer to a structure uniquely identifying the
+ * \param ws_dbus_data - pointer to a structure uniquely identifying the
* application for D-BUS
- *@param detailed_signal - string containing the signal name which will trigger
- the function passed in the c_func parameter.
- *@param c_func - is a pointer to the signal handling function.
- *@param user_data - is the data passed directly to the signal handling function
- *
- *@return WS_STATUS_OK - on success \n
- *WS_STATUS_ERROR - on error
- *\sa ::WSDBusConfig \n
- *#ws_dbus_cb
+ * \param detailed_signal - string containing the signal name which will trigger
+ * the function passed in the c_func parameter.
+ * \param c_func - is a pointer to the signal handling function.
+ * \param user_data - is the data passed directly to the signal handling
+ * function
+ * \return \li WS_STATUS_OK - on success \li WS_STATUS_ERROR - on error
+ * \sa WSDBusConfig | ws_dbus_cb
*/
-
WSDBusStatus ws_dbus_set_cb (WSDBusData * ws_dbus_data,
gchar * detailed_signal,
gpointer c_func,
gpointer user_data);
-
-/**\brief Function registering a method to be called remotely
+
+/** \brief Function registering a method to be called remotely
*
- *@param ws_dbus_data - pointer to a structure uniquely identifying the
- *application for DBus
- *@param method - method name\n
- *@param arglist - a comma separated list of method's arguments (actually just
- *their datatypes) finished with WS_DBUS_TYPE_INVALID
- *@return WS_STATUS_OK - on success \n
- *WS_STATUS_ERROR - on error
- *\sa ::WSDBusDataType \n
+ * \param ws_dbus_data - pointer to a structure uniquely identifying the
+ * application for DBus
+ * \param method - method name\n
+ * \param arglist - a comma separated list of method's arguments (actually just
+ * their datatypes) finished with WS_DBUS_TYPE_INVALID
+ * \return \li WS_STATUS_OK - on success \li WS_STATUS_ERROR - on error
+ * \sa WSDBusDataType
*/
-
WSDBusStatus ws_dbus_add_method (WSDBusData * ws_dbus_data, gchar *method, ...);
-
-/**\brief Function deinitializing D-BUS wrapper library
+
+/** \brief Function deinitializing D-BUS wrapper library
+ *
+ * Before the program exits, all memory allocated by D-BUS should be freed
*
- *Before the program exits, all memory allocated by D-BUS should be freed.
- *@param ws_dbus_data - pointer to a structure uniquely identifying the
- *application for DBus
- *@param method - method name\n
- *@param arglist - a comma separated list of pairs: datatype, value finished with WS_DBUS_TYPE_INVALID
- *@return WS_STATUS_OK - on success \n
- *WS_STATUS_ERROR - on error
- *\sa ::WSDBusDataType \n
+ * \param ws_dbus_data - pointer to a structure uniquely identifying the
+ * application for DBus
+ * \param method - method name
+ * \param arglist - a comma separated list of pairs: datatype, value finished
+ * with WS_DBUS_TYPE_INVALID
+ * \return \li WS_STATUS_OK - on success \li WS_STATUS_ERROR - on error
+ * \sa WSDBusDataType
*/
-
-WSDBusStatus ws_dbus_call_method (WSDBusData * ws_dbus_data, gchar *method,
- ...);
+WSDBusStatus ws_dbus_call_method (WSDBusData * ws_dbus_data, gchar *method,...);
/** \name Functions to be called by client (GUI)*/
/*@{*/
-/**\brief Instructs the manager to start search of words matching a given
- *pattern
+/** \brief Instructs the manager to start search of words matching a given
+ * pattern
*/
-#define ws_dbus_client_find_word(structure,arg) ws_dbus_call_method(structure,"find_word",WS_DBUS_TYPE_STRING,arg,WS_DBUS_TYPE_INVALID)
-
-/**\brief Instructs the manager to start search of translations for a specific
- *word
+#define ws_dbus_client_find_word(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "find_word",\
+ WS_DBUS_TYPE_STRING,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Instructs the manager to start search of translations for a specific
+ * word
*/
-#define ws_dbus_client_find_translation(structure,arg) ws_dbus_call_method(structure,"find_translation",WS_DBUS_TYPE_STRING,arg,WS_DBUS_TYPE_INVALID)
-
-/**\brief Instructs the manager to bookmark a given pair of word, translation*/
-#define ws_dbus_client_add_bookmark(structure,arg1,arg2) ws_dbus_call_method(structure,"add_bookmark",WS_DBUS_TYPE_STRING,arg1,WS_DBUS_TYPE_STRING,arg2,WS_DBUS_TYPE_INVALID)
-
-/**\brief Instructs the manager to remove the specified bookmark*/
-#define ws_dbus_client_remove_bookmark(structure,arg) ws_dbus_call_method(structure,"remove_bookmark",WS_DBUS_TYPE_STRING,arg,WS_DBUS_TYPE_INVALID)
-
-/**\brief Instructs the manager to extract a dictionary from a tar.bz2 archive*/
-#define ws_dbus_client_extract_dictionary(structure,arg) ws_dbus_call_method(structure,"extract_dictionary",WS_DBUS_TYPE_STRING,arg,WS_DBUS_TYPE_INVALID)
+#define ws_dbus_client_find_translation(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "find_translation",\
+ WS_DBUS_TYPE_STRING,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Instructs the manager to bookmark a given pair of word, translation
+ */
+#define ws_dbus_client_add_bookmark(structure,arg1,arg2)\
+ ws_dbus_call_method(structure,\
+ "add_bookmark",\
+ WS_DBUS_TYPE_STRING,\
+ arg1,\
+ WS_DBUS_TYPE_STRING,\
+ arg2,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Instructs the manager to remove the specified bookmark
+ */
+#define ws_dbus_client_remove_bookmark(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "remove_bookmark",\
+ WS_DBUS_TYPE_STRING,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Instructs the manager to extract a dictionary from a tar.bz2 archive
+ */
+#define ws_dbus_client_extract_dictionary(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "extract_dictionary",\
+ WS_DBUS_TYPE_STRING,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
/*@}*/
/** \name Functions to be called by server (thread's manager)*/
/*@{*/
-/**\brief Informs GUI that a dictionary has been extracted*/
-#define ws_dbus_server_return_extracted_dict(structure,arg) ws_dbus_call_method(structure,"return_extracted_dict",WS_DBUS_TYPE_STRING,arg,WS_DBUS_TYPE_INVALID)
-
-/**\brief Returns a list of words to GUI*/
-#define ws_dbus_server_return_words(structure,arg) ws_dbus_call_method(structure,"return_words",WS_DBUS_TYPE_GARRAY,arg,WS_DBUS_TYPE_INVALID)
-/**\brief Returns to GUI a list of translations for a given word*/
-#define ws_dbus_server_return_translations(structure,arg) ws_dbus_call_method(structure,"return_translations",WS_DBUS_TYPE_STRING,arg,WS_DBUS_TYPE_INVALID)
-
-/**\brief Updates the search progressbar*/
-#define ws_dbus_server_update_progressbar(structure,arg) ws_dbus_call_method(structure,"update_progressbar",WS_DBUS_TYPE_DOUBLE,arg,WS_DBUS_TYPE_INVALID)
+/** \brief Informs GUI that a dictionary has been extracted
+ */
+#define ws_dbus_server_return_extracted_dict(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "return_extracted_dict",\
+ WS_DBUS_TYPE_STRING,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Returns a list of words to GUI
+ */
+#define ws_dbus_server_return_words(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "return_words",\
+ WS_DBUS_TYPE_GARRAY,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Returns to GUI a list of translations for a given word
+ */
+#define ws_dbus_server_return_translations(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "return_translations",\
+ WS_DBUS_TYPE_STRING,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
+/** \brief Updates the search progressbar
+ */
+#define ws_dbus_server_update_progressbar(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "update_progressbar",\
+ WS_DBUS_TYPE_DOUBLE,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
/*@}*/
/** \name Functions to be called by both client and server*/
/*@{*/
-/**\brief Sends a predefined signal */
-#define ws_dbus_notify(structure,arg) ws_dbus_call_method(structure,"signal",WS_DBUS_TYPE_SIGNAL,arg,WS_DBUS_TYPE_INVALID)
+
+/** \brief Sends a predefined signal
+ */
+#define ws_dbus_notify(structure,arg)\
+ ws_dbus_call_method(structure,\
+ "signal",\
+ WS_DBUS_TYPE_SIGNAL,\
+ arg,\
+ WS_DBUS_TYPE_INVALID)
+
/*@}*/
#ifdef __cplusplus
#endif
#endif
+
+/*@}*/
-/*
+/*******************************************************************************
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation;
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-Copyright 2006 ComArch S.A.
-*/
-
+Copyright 2006-2008 ComArch S.A.
+*******************************************************************************/
+/** \addtogroup DBusWrapperAPI
+ */
+/*@{*/
+/** \file ws_dbus.c
+ * \brief API for D-Bus Wrapper Library - code.
+ *
+ * Bodies of methods used to communicate between
+ * dictionary UI and searching module
+ * \author Krzysztof Sasiak \<krzysztof.sasiak\@comarch.com\>
+ * \date 05-11-2007
+ * \version 1.0.0
+ * \see DBusWrapperAPI
+ */
#include <ws_dbus.h>
typedef struct _WSDBusMethodData WSDBusMethodData;
-/*static WSDBusStatus ws_dbus_send_method_data (WSDBusData *ws_dbus_data);*/
static gchar* ws_dbus_get_ptr2method (GArray *methods, gchar* name );
static void ws_dbus_libosso_errors (osso_return_t result);
static void ws_dbus_fill_message (DBusMessage *msg, void *data);
static gchar* ws_dbus_get_ptr2method (GArray *methods, gchar* name)
-
{
guint i;
gchar* temp;
-
+
g_debug ("%d", methods->len);
return NULL;
for (i = 0; i < methods->len; i+=2)
-
{
temp = g_array_index (methods, gchar *,i);
temp = g_array_index (methods, gchar *,i+1);
g_debug ("\nData types: %s\n", temp);
return temp;
- }
+ }
};
};
static void ws_dbus_libosso_errors (osso_return_t result)
-
{
switch (result)
{
case OSSO_OK:
g_debug ("All OK\n");
- break;
-
+ break;
case OSSO_ERROR:
g_debug ("Ordinary Error\n");
- break;
-
+ break;
case OSSO_INVALID:
g_debug ("At least one parameter is invalid\n");
- break;
-
+ break;
case OSSO_RPC_ERROR:
g_debug ("Osso RPC method returned an error\n");
- break;
-
+ break;
case OSSO_ERROR_NAME:
g_debug ("Error Name\n");
- break;
-
+ break;
case OSSO_ERROR_NO_STATE:
g_debug ("No state file found to read\n");
- break;
-
+ break;
case OSSO_ERROR_STATE_SIZE:
g_debug("The size of the given structure");
g_debug(" is different from the saved size\n");
- break;
+ break;
};
};
-static WSDBusStatus ws_dbus_run_cb (WSDBusMethodData *method_data, gpointer data)
-
+static WSDBusStatus ws_dbus_run_cb( WSDBusMethodData *method_data,
+ gpointer data )
{
- g_debug ("%s: Running cb for method %s\n", __FUNCTION__,
- method_data->name);
-
+ g_debug ( "%s: Running cb for method %s\n",
+ __FUNCTION__,
+ method_data->name);
+
ws_dbus_cb cb;
osso_rpc_t osso_data;
-
GArray *args = (GArray *) data;
-
+
cb = (ws_dbus_cb) method_data->handler;
g_debug ("cb pointer address %p\n", cb);
-
- if (cb != NULL)
- {
+
+ if (cb != NULL)
+ {
if (args->len == 0)
{
osso_data.type = WS_DBUS_TYPE_STRING;
g_array_append_val (args, osso_data);
}
- cb (NULL, data, method_data->user_data);
- return OSSO_OK;
+ cb (NULL, data, method_data->user_data);
+ return OSSO_OK;
}
-
- else
- {
- g_debug ("DBUS: No callback defined for this function\n");
- return OSSO_ERROR;
- };
+ else
+ {
+ g_debug ("DBUS: No callback defined for this function\n");
+ return OSSO_ERROR;
+ };
};
-//A dispatcher function
+/* A dispatcher function */
static gint ws_dbus_cb_handler (const gchar * interface,
const gchar * method,
GArray * arguments,
gpointer data,
osso_rpc_t * retval)
-
{
WSDBusMethodData *method_data;
GArray *dbus_method_data;
retval = NULL;
g_debug ("DBUS: Method: %s\n", method);
- //check if a unique identifier has been generated for this string
+ /* check if a unique identifier has been generated for this string */
temp = g_quark_try_string (method);
-
- if (temp != 0)
-
+ if (temp != 0)
{
//run through all available methods and run the one which was called remotely
- for (i=0; i < dbus_method_data->len; ++i)
-
+ for (i=0; i < dbus_method_data->len; ++i)
{
- method_data = g_array_index (dbus_method_data,
- WSDBusMethodData *, i);
-
+ method_data = g_array_index( dbus_method_data,
+ WSDBusMethodData*,
+ i );
+
if (method_data->id == temp)
-
{
- g_debug ("DBUS: Running callback for %s\n",
+ g_debug( "DBUS: Running callback for %s\n",
method);
ws_dbus_run_cb (method_data, arguments);
};
-
};
-
- }
-
- else
-
+ }
+ else
{
- g_debug ("Error in function %s, couldn't find the signal %s\n",
- __FUNCTION__, method);
+ g_debug( "Error in function %s, couldn't find the signal %s\n",
+ __FUNCTION__,
+ method );
return OSSO_ERROR;
- };
-
+ };
+
return OSSO_OK;
};
-//This function adds words stored in a GArray as arguments to a DBUS message
+/* This function adds words stored in a GArray as arguments to a DBUS message */
static void ws_dbus_fill_message (DBusMessage *msg, void *data)
{
-
guint i;
osso_rpc_t *data_unit;
GArray *data_bundle;
g_debug ("%s, number of fields: %d", __FUNCTION__, data_bundle->len);
- if (data_bundle->len > 255)
+ if (data_bundle->len > 255)
+ {
g_debug ("DBUS: Number of fields in message exceeds 255\n");
+ }
- for (i=0;((i<data_bundle->len) && (i<255));++i)
- {
+ for (i = 0; ((i < data_bundle->len) && (i < 255)); ++i)
+ {
data_unit = g_array_index (data_bundle, osso_rpc_t *, i);
-
g_debug ("%s, type: %c, value: ", __FUNCTION__, data_unit->type);
-
+
switch (data_unit->type)
{
case DBUS_TYPE_STRING:
buffer = &data_unit->value.s;
g_debug ("%s", data_unit->value.s);
- break;
-
+ break;
case DBUS_TYPE_INT32:
buffer = &data_unit->value.i;
g_debug ("%d", data_unit->value.i);
- break;
-
+ break;
case DBUS_TYPE_DOUBLE:
buffer = &data_unit->value.d;
g_debug ("%f", data_unit->value.d);
- break;
-
+ break;
case DBUS_TYPE_BOOLEAN:
buffer = &data_unit->value.b;
g_debug ("%d", data_unit->value.b);
- break;
+ break;
};
if (data_unit->value.s != NULL) {
- dbus_message_append_args (msg,data_unit->type,
- buffer,
- DBUS_TYPE_INVALID);
+ dbus_message_append_args( msg,
+ data_unit->type,
+ buffer,
+ DBUS_TYPE_INVALID );
}
-
- else
+ else
+ {
if (data_bundle->len > 1)
- g_debug ("One of the arguments is NULL, ommitting it");
-
- };
-
- g_debug ("DBUS: Added %d words\n", i);
+ {
+ g_debug ("One argument ommited");
+ }
+ }
+ };
+
+ g_debug ("DBUS: Added %d words\n", i);
};
-void ws_dbus_add_remote_methods (GError *error, gpointer data, gpointer user_data)
+void ws_dbus_add_remote_methods (GError *error,
+ gpointer data,
+ gpointer user_data)
{
WSDBusData *ws_dbus_data = (WSDBusData *) user_data;
GArray *methods_list = (GArray *) data;
guint i=0;
-
+
osso_rpc_t *temp;
-
+
for (i = 0; i < methods_list->len; ++i)
{
temp = g_array_index (methods_list, osso_rpc_t *, i);
- g_array_append_val (ws_dbus_data->remote_method_data, temp->value);
+ g_array_append_val( ws_dbus_data->remote_method_data,
+ temp->value );
};
-
+
return;
};
WSDBusData * ws_dbus_create (gchar *name, gchar *version)
-
{
WSDBusData *temp;
-
temp = (gpointer) g_try_malloc (sizeof (WSDBusData));
-
g_debug ("\nDBUS: ");
if (temp == NULL)
__FUNCTION__);
g_assert_not_reached();
}
-
- else g_debug ("Memory allocation successful\n");
+ else
+ {
+ g_debug ("Memory allocation successful\n");
+ }
temp->name = g_strconcat (name, NULL);
temp->version = g_strconcat (version, NULL);
- temp->method_data = g_array_new (TRUE, TRUE, sizeof (WSDBusMethodData *));
-
- //Adding callback for remote methods list
- //ws_dbus_add_method (temp, "method_data", WS_DBUS_TYPE_STRING, WS_DBUS_TYPE_STRING);
- //ws_dbus_set_cb (temp, "method_data", ws_dbus_add_remote_methods, NULL);
-
- return temp;
+ temp->method_data = g_array_new( TRUE,
+ TRUE,
+ sizeof(WSDBusMethodData *) );
+ return temp;
};
-//Set destination and source addresses of DBUS communication
+/* Set destination and source addresses of DBUS communication */
WSDBusStatus ws_dbus_config (WSDBusData * ws_dbus_data,
WSDBusConfig field,
gchar *value)
-
{
if (ws_dbus_data == NULL)
{
- g_debug ("\nDBUS: Error in function %s - ws_dbus_data is NULL\n",
- __FUNCTION__);
+ g_debug ("DBUS: Error in function %s - ws_dbus_data is NULL\n",
+ __FUNCTION__);
+ return WS_DBUS_STATUS_ERROR;
};
- switch (field)
+
+ switch (field)
{
case WS_DBUS_CONFIG_SERVICE :
- ws_dbus_data->service = g_strconcat (value, NULL);
- break;
+ ws_dbus_data->service = g_strconcat(value, NULL);
+ break;
case WS_DBUS_CONFIG_OBJECT :
- ws_dbus_data->object = g_strconcat (value, NULL);
- break;
+ ws_dbus_data->object = g_strconcat(value, NULL);
+ break;
case WS_DBUS_CONFIG_IFACE :
- ws_dbus_data->iface = g_strconcat (value, NULL);
- break;
+ ws_dbus_data->iface = g_strconcat(value, NULL);
+ break;
case WS_DBUS_CONFIG_REMOTE_SERVICE :
- ws_dbus_data->remote_service = g_strconcat (value, NULL);
- break;
+ ws_dbus_data->remote_service = g_strconcat(value, NULL);
+ break;
case WS_DBUS_CONFIG_REMOTE_OBJECT :
- ws_dbus_data->remote_object = g_strconcat (value, NULL);
- break;
+ ws_dbus_data->remote_object = g_strconcat(value, NULL);
+ break;
case WS_DBUS_CONFIG_REMOTE_IFACE :
- ws_dbus_data->remote_iface = g_strconcat (value, NULL);
- break;
+ ws_dbus_data->remote_iface = g_strconcat(value, NULL);
+ break;
};
-
+
return WS_DBUS_STATUS_OK;
};
WSDBusStatus ws_dbus_connect (WSDBusData * ws_dbus_data)
-
{
- osso_return_t result;
- //initialize osso_rpc
- ws_dbus_data->context = osso_initialize (ws_dbus_data->name,
- ws_dbus_data->version,
- FALSE,
- NULL);
- osso_rpc_set_timeout (ws_dbus_data->context, 100);
-
- //set a dispatcher function which runs local methods when asked via DBUS
- result = osso_rpc_set_cb_f(ws_dbus_data->context,
- ws_dbus_data->service,
- ws_dbus_data->object,
- ws_dbus_data->iface,
- ws_dbus_cb_handler,
- ws_dbus_data->method_data);
+ osso_return_t result;
+ /* initialize osso_rpc */
+ ws_dbus_data->context = osso_initialize (ws_dbus_data->name,
+ ws_dbus_data->version,
+ FALSE,
+ NULL);
+ osso_rpc_set_timeout (ws_dbus_data->context, 100);
+
+ /* set a dispatcher function which runs local methods when asked via
+ * DBUS */
+ result = osso_rpc_set_cb_f(ws_dbus_data->context,
+ ws_dbus_data->service,
+ ws_dbus_data->object,
+ ws_dbus_data->iface,
+ ws_dbus_cb_handler,
+ ws_dbus_data->method_data);
-
g_debug ("\nSending method data\n");
- //sends methods list to remote receiver
- //ws_dbus_send_method_data (ws_dbus_data);
-
- if (result == OSSO_OK) return WS_DBUS_STATUS_OK;
- else return WS_DBUS_STATUS_ERROR;
+ /*sends methods list to remote receiver
+ * ws_dbus_send_method_data (ws_dbus_data); */
+
+ if (result == OSSO_OK)
+ {
+ return WS_DBUS_STATUS_OK;
+ }
+ else
+ {
+ return WS_DBUS_STATUS_ERROR;
+ }
};
-//Free allocated memory
+/* Free allocated memory */
void ws_dbus_destroy (WSDBusData * ws_dbus_data)
-
{
guint i;
if (ws_dbus_data == NULL)
- {
- g_debug ("\nDBUS: Error in function %s - cannot free osso_context\n",
+ {
+ g_debug ("DBUS: Error in fun %s - cannot free osso_context\n",
__FUNCTION__);
g_free (ws_dbus_data);
g_assert_not_reached();
};
-
- g_debug ("\nDBUS deinitialization by %s:\n---------------------------\n",
- ws_dbus_data->service);
- osso_deinitialize (ws_dbus_data->context);
- g_debug ("| Deinitializing osso context |\n");
- if (ws_dbus_data->method_data != NULL)
- {
+
+ g_debug( "DBUS deinitialization by %s:\n---------------------------\n",
+ ws_dbus_data->service);
+ osso_deinitialize (ws_dbus_data->context);
+ g_debug ("| Deinitializing osso context |\n");
+ if (ws_dbus_data->method_data != NULL)
+ {
for (i = 0; i < ws_dbus_data->method_data->len; ++i)
{
WSDBusMethodData *temp =
WSDBusMethodData *, i);
g_free (temp->data_types);
g_free (temp->name);
-
g_free (temp);
};
-
+
g_array_free (ws_dbus_data->method_data, TRUE);
g_debug ("| Freeing callback pointers list |\n");
};
g_free (ws_dbus_data->remote_object);
g_free (ws_dbus_data->remote_iface);
-/*
- Introspection not implemented yet
-*/
-/*
- if (ws_dbus_data->remote_method_data != NULL)
- {
- for (i = 0; i < ws_dbus_data->remote_method_data->len; ++i)
- {
- g_free (g_array_index(ws_dbus_data->remote_method_data,
- gchar*, i));
- };
- g_array_free (ws_dbus_data->remote_method_data, TRUE);
- };*/
-
- g_free (ws_dbus_data);
- g_debug ("| Freeing WSDBusData structure |\n----------------------\n");
+ /** \TODO is this needed still? */
+ /* Introspection not implemented yet - IS IT NEEDED?? */
+ /*
+ * if (ws_dbus_data->remote_method_data != NULL)
+ * {
+ * for (i = 0; i < ws_dbus_data->remote_method_data->len; ++i)
+ * {
+ * g_free (g_array_index(ws_dbus_data->remote_method_data,
+ * gchar*, i));
+ * };
+ * g_array_free (ws_dbus_data->remote_method_data, TRUE);
+ * };*/
+
+ g_free (ws_dbus_data);
+ g_debug ("| Freeing WSDBusData structure |\n----------------------\n");
};
gchar * method,
gpointer c_func,
gpointer user_data)
-
{
WSDBusMethodData *method_data;
GQuark temp;
guint i;
- //check if a unique GQuark id for this method has been generated
+ /* check if a unique GQuark id for this method has been generated */
temp = g_quark_try_string (method);
if (temp == 0)
{
- g_debug ("DBUS:\"%s\"- method not defined or invalid method name\n",
+ g_debug ("DBUS:%s- method not defined or invalid method name\n",
method);
return WS_DBUS_STATUS_ERROR;
}
-
else
{
-
for (i = 0; i < ws_dbus_data->method_data->len; ++i)
{
method_data = g_array_index (ws_dbus_data->method_data,
WSDBusMethodData *,
i);
- /*
- Add method data (callback pointer and data) for a given method
- */
-
+ /* Add method data (callback pointer and data) for a
+ * given method */
if (method_data->id == temp)
{
method_data->handler = c_func;
g_array_remove_index (ws_dbus_data->method_data,
i+1);
};
-
};
-
};
- /*
- ws_dbus_send_method_data (ws_dbus_data);
- */
-
+ /* ws_dbus_send_method_data (ws_dbus_data); */
return WS_DBUS_STATUS_OK;
};
WSDBusStatus ws_dbus_add_method (WSDBusData * ws_dbus_data, gchar *method, ...)
-
{
- WSDBusMethodData *method_data;
+ WSDBusMethodData *method_data;
WSDBusDataType data_type;
- GQuark temp;
+ GQuark temp;
gchar *buffer;
va_list arglist;
- /*
- Check if a unique GQuark id exists for a given string
- */
-
- temp = g_quark_try_string (method);
-
- if (temp == 0)
- {
- method_data = g_try_malloc (sizeof (WSDBusMethodData));
-
- if (method_data != NULL)
- {
- va_start (arglist, method);
-
- method_data->id = g_quark_from_string (method);
- method_data->name = g_strdup (method);
-
- data_type = va_arg (arglist, WSDBusDataType);
-
- method_data->data_types = g_strdup("");
+ /* Check if a unique GQuark id exists for a given string */
+ temp = g_quark_try_string (method);
- /*
- Add all datatypes in arglist as arguments to method
- */
+ if (temp != 0)
+ {
+ g_debug( "DBUS:\"%s\"- method has already been registered\n",
+ method );
+ return WS_DBUS_STATUS_ERROR;
+ }
- while (data_type != WS_DBUS_TYPE_INVALID)
- {
- buffer = method_data->data_types;
-
- method_data->data_types = g_strdup_printf ("%s%c",
- method_data->data_types,
- (gchar) data_type );
-
- g_free (buffer);
-
- data_type = va_arg (arglist, WSDBusDataType);
- };
-
- g_debug ("%d, %s, %s\n", method_data->id, method_data->name, method_data->data_types);
-
- va_end (arglist);
-
- g_array_append_val (ws_dbus_data->method_data, method_data);
- }
-
- else g_debug ("DBUS: Failed to allocate memory for method data");
-
- }
-
- else
- {
- g_debug ("DBUS:\"%s\"- method has already been registered\n",
- method);
-
- return WS_DBUS_STATUS_ERROR;
- };
+ method_data = g_try_malloc (sizeof (WSDBusMethodData));
+ if (method_data != NULL)
+ {
+ va_start (arglist, method);
+
+ method_data->id = g_quark_from_string (method);
+ method_data->name = g_strdup (method);
+ data_type = va_arg (arglist, WSDBusDataType);
+ method_data->data_types = g_strdup("");
- return WS_DBUS_STATUS_OK;
+ /* Add all datatypes in arglist as arguments to method */
+ while (data_type != WS_DBUS_TYPE_INVALID)
+ {
+ buffer = method_data->data_types;
+
+ method_data->data_types =
+ g_strdup_printf( "%s%c",
+ method_data->data_types,
+ (gchar) data_type );
+ g_free (buffer);
+ data_type = va_arg (arglist, WSDBusDataType);
+ };
+
+ g_debug( "%d, %s, %s\n",
+ method_data->id,
+ method_data->name,
+ method_data->data_types );
+ va_end (arglist);
+ g_array_append_val( ws_dbus_data->method_data,
+ method_data );
+ }
+ else
+ {
+ g_debug( "DBUS: Failed to allocate memory for method data");
+ return WS_DBUS_STATUS_ERROR;
+ }
+
+ return WS_DBUS_STATUS_OK;
};
-/*
-Converts an array of strings to an array of osso_rpc_t
-*/
+/* Converts an array of strings to an array of osso_rpc_t */
WSDBusStatus ws_dbus_add_garray (GArray *data_bundle, GArray *strings)
-
{
osso_rpc_t *temp;
guint i;
if (strings != NULL)
{
-
for (i = 0; i < strings->len; ++i)
{
temp = g_try_malloc (sizeof (osso_rpc_t));
g_debug ("%d, %s", temp->type, temp->value.s);
g_array_append_val (data_bundle, temp);
};
-
return WS_DBUS_STATUS_OK;
-
}
-
- else
+ else
{
printf ("\n%s - Error - GArray is NULL", __FUNCTION__);
return WS_DBUS_STATUS_ERROR;
};
-
};
-/*
-Calls a specific method on remote object
-*/
+/* Calls a specific method on remote object */
WSDBusStatus ws_dbus_call_method (WSDBusData * ws_dbus_data, gchar *method, ...)
-
{
va_list arglist;
GArray *data_to_send;
GArray *temp_garray;
data_to_send = g_array_new (TRUE, TRUE, sizeof (osso_rpc_t *));
-
va_start (arglist, method);
-
- /*
- convert all given arguments to a GArray of osso_rpc_t
- */
- while (1)
+ /* convert all given arguments to a GArray of osso_rpc_t */
+ while (TRUE)
{
temp = g_try_malloc (sizeof (osso_rpc_t));
-
temp->type = va_arg (arglist, WSDBusDataType);
- /*
- g_debug ("Type: %c ", temp->type);
- */
- if (temp->type == WS_DBUS_TYPE_INVALID) break;
-
+ /* g_debug ("Type: %c ", temp->type); */
+ if (temp->type == WS_DBUS_TYPE_INVALID)
+ {
+ break;
+ }
+
switch (temp->type)
{
case WS_DBUS_TYPE_STRING:
temp->value.s = va_arg (arglist, gchar *);
g_debug ("Value: %s\n", temp->value.s);
- break;
+ break;
case WS_DBUS_TYPE_INT:
temp->value.i = va_arg (arglist, gint);
g_debug ("Value: %d\n", temp->value.i);
- break;
+ break;
case WS_DBUS_TYPE_UINT:
temp->value.u = va_arg (arglist, guint);
g_debug ("Value: %d\n", temp->value.u);
- break;
+ break;
case WS_DBUS_TYPE_DOUBLE:
temp->value.d = va_arg (arglist, gdouble);
g_debug ("Value: %f\n", temp->value.d);
- break;
+ break;
case WS_DBUS_TYPE_BOOLEAN:
temp->value.b = va_arg (arglist, gboolean);
g_debug ("Value: %d\n", temp->value.b);
- break;
+ break;
case WS_DBUS_TYPE_GARRAY:
temp_garray = va_arg (arglist, GArray *);
ws_dbus_add_garray (data_to_send,
temp_garray);
g_debug ("Value: GArray of strings");
- break;
+ break;
};
g_debug ("Type: %c %d", temp->type, temp->value.i);
-
- if (temp->type != WS_DBUS_TYPE_GARRAY)
+
+ if (temp->type != WS_DBUS_TYPE_GARRAY)
+ {
g_array_append_val (data_to_send, temp);
+ }
};
-
- va_end (arglist);
- g_debug ("%s, method %s, added %d arguments", __FUNCTION__,
- method, data_to_send->len);
+ va_end (arglist);
+ g_debug( "%s, method %s, added %d arguments",
+ __FUNCTION__,
+ method, data_to_send->len);
- //allocate memory for return value
- retval = g_try_malloc (sizeof (osso_rpc_t));
+ /* allocate memory for return value */
+ retval = g_try_malloc (sizeof (osso_rpc_t));
+ if (retval == NULL)
+ {
+ g_debug("DBUS: Error in function %s:",__FUNCTION__);
+ g_debug("Couldn't allocate memory for message return value\n");
+ };
- if (retval == NULL)
- {
- g_debug("DBUS: Error in function %s:",__FUNCTION__);
- g_debug("Couldn't allocate memory for message's return value\n");
- };
+ result = osso_rpc_run_with_argfill (ws_dbus_data->context,
+ ws_dbus_data->remote_service,
+ ws_dbus_data->remote_object,
+ ws_dbus_data->remote_iface,
+ method,
+ retval,
+ ws_dbus_fill_message,
+ data_to_send);
- result = osso_rpc_run_with_argfill (ws_dbus_data->context,
- ws_dbus_data->remote_service,
- ws_dbus_data->remote_object,
- ws_dbus_data->remote_iface,
- method,
- retval,
- ws_dbus_fill_message,
- data_to_send);
-
- g_debug ("\nDBUS: %s: ", __FUNCTION__);
+ g_debug ("\nDBUS: %s: ", __FUNCTION__);
+ ws_dbus_libosso_errors (result);
- ws_dbus_libosso_errors (result);
-
guint i;
-
for (i = 0; i < data_to_send->len; ++i)
{
g_free (g_array_index(data_to_send, osso_rpc_t*,i));
};
-
- g_array_free (data_to_send, TRUE);
- if (result != OSSO_OK)
- {
- g_debug ("Error message: %s\n", retval->value.s);
- osso_rpc_free_val (retval);
- g_free (retval);
- return WS_DBUS_STATUS_ERROR;
- };
+ g_array_free (data_to_send, TRUE);
+ if (result != OSSO_OK)
+ {
+ g_debug ("Error message: %s\n", retval->value.s);
+ osso_rpc_free_val (retval);
+ g_free (retval);
+ return WS_DBUS_STATUS_ERROR;
+ };
- osso_rpc_free_val (retval);
- g_free (retval);
+ osso_rpc_free_val (retval);
+ g_free (retval);
return WS_DBUS_STATUS_OK;
};
-WSDBusStatus ws_dbus_call_registered_method (WSDBusData * ws_dbus_data, gchar *method, ...)
-
+WSDBusStatus ws_dbus_call_registered_method (WSDBusData * ws_dbus_data,
+ gchar *method, ...)
{
va_list arglist;
guint i;
GArray *data_to_send;
osso_rpc_t *temp;
- osso_return_t result;
- osso_rpc_t *retval;
-
+ osso_return_t result;
+ osso_rpc_t *retval;
+
gchar* data_types = ws_dbus_get_ptr2method (
- ws_dbus_data->remote_method_data,
- method);
-
+ ws_dbus_data->remote_method_data,
+ method );
g_debug ("\n%s\n", data_types);
-
+
data_to_send = g_array_new (TRUE, TRUE, sizeof (osso_rpc_t *));
-
+
va_start (arglist, method);
-
+
for (i = 0; i < strlen (data_types); ++i)
{
temp = g_try_malloc (sizeof (osso_rpc_t));
switch ((char) data_types[i])
{
case WS_DBUS_TYPE_STRING:
- temp->value.s = va_arg (arglist, gchar *);
- break;
+ temp->value.s = va_arg (arglist, gchar *);
+ break;
case WS_DBUS_TYPE_INT:
- temp->value.i = va_arg (arglist, gint);
- break;
+ temp->value.i = va_arg (arglist, gint);
+ break;
case WS_DBUS_TYPE_UINT:
- temp->value.u = va_arg (arglist, guint);
- break;
+ temp->value.u = va_arg (arglist, guint);
+ break;
case WS_DBUS_TYPE_DOUBLE:
- temp->value.d = va_arg (arglist, gdouble);
- break;
+ temp->value.d = va_arg (arglist, gdouble);
+ break;
case WS_DBUS_TYPE_BOOLEAN:
- temp->value.b = va_arg (arglist, gboolean);
- break;
+ temp->value.b = va_arg (arglist, gboolean);
+ break;
};
-
g_array_append_val (data_to_send, temp);
};
-
va_end (arglist);
-
+
retval = g_try_malloc (sizeof (osso_rpc_t));
if (retval == NULL)
{
g_debug("DBUS: Error in function %s:",__FUNCTION__);
- g_debug("Couldn't allocate memory for message's return value\n");
+ g_debug("Couldn't allocate memory for message return value\n");
};
- result = osso_rpc_run_with_argfill (ws_dbus_data->context,
- ws_dbus_data->remote_service,
- ws_dbus_data->remote_object,
- ws_dbus_data->remote_iface,
- method,
- retval,
- ws_dbus_fill_message,
- data_to_send);
+ result = osso_rpc_run_with_argfill (ws_dbus_data->context,
+ ws_dbus_data->remote_service,
+ ws_dbus_data->remote_object,
+ ws_dbus_data->remote_iface,
+ method,
+ retval,
+ ws_dbus_fill_message,
+ data_to_send);
g_debug ("\nDBUS: %s: ", __FUNCTION__);
ws_dbus_libosso_errors (result);
osso_rpc_free_val (retval);
g_free (retval);
return WS_DBUS_STATUS_OK;
-
- return WS_DBUS_STATUS_OK;
-};
-
-/*
-WSDBusStatus ws_dbus_run_method (WSDBusData * ws_dbus_data, gchar *method, ...)
-
-{
- va_list arglist;
- guint i;
- GArray *data_to_send;
- osso_rpc_t *temp;
- osso_return_t result;
- osso_rpc_t *retval;
-
- gchar* method_data = ws_dbus_get_ptr2method (
- ws_dbus_data->method_data,
- method);
-
- data_to_send = g_array_new (TRUE, TRUE, sizeof (osso_rpc_t *));
-
- va_start (arglist, method);
-
- g_debug ("%p\n\n%p\n\n", method_data, method_data->data_types);
-
- for (i = 0; i < strlen (method_data->data_types); ++i)
- {
- temp = g_try_malloc (sizeof (osso_rpc_t));
- temp->type = method_data->data_types[i];
-
- switch ((char) method_data->data_types[i])
- {
- case WS_DBUS_TYPE_STRING:
- temp->value.s = va_arg (arglist, gchar *);
- break;
- case WS_DBUS_TYPE_INT:
- temp->value.i = va_arg (arglist, gint);
- break;
- case WS_DBUS_TYPE_SIGNAL:
- case WS_DBUS_TYPE_UINT:
- temp->value.u = va_arg (arglist, guint);
- break;
- case WS_DBUS_TYPE_DOUBLE:
- temp->value.d = va_arg (arglist, gdouble);
- break;
- case WS_DBUS_TYPE_BOOLEAN:
- temp->value.b = va_arg (arglist, gboolean);
- break;
- };
-
- g_array_append_val (data_to_send, temp);
- };
-
- va_end (arglist);
-
- retval = g_try_malloc (sizeof (osso_rpc_t));
-
- if (retval == NULL)
- {
- g_debug("DBUS: Error in function %s:",__FUNCTION__);
- g_debug("Couldn't allocate memory for message's return value\n");
- };
-
- result = osso_rpc_run_with_argfill (ws_dbus_data->context,
- ws_dbus_data->remote_service,
- ws_dbus_data->remote_object,
- ws_dbus_data->remote_iface,
- method,
- retval,
- ws_dbus_fill_message,
- data_to_send);
- g_debug ("\nDBUS: %s: ", __FUNCTION__);
-
- ws_dbus_libosso_errors (result);
-registered_
- if (result != OSSO_OK)
- {
- g_debug ("Error message: %s\n", retval->value.s);
- osso_rpc_free_val (retval);
- g_free (retval);
- return WS_DBUS_STATUS_ERROR;
- };
-
- osso_rpc_free_val (retval);
- g_free (retval);
- return WS_DBUS_STATUS_OK;
-
- return WS_DBUS_STATUS_OK;
};
-*/
-
-
-/*static void ws_dbus_fill_method_data (DBusMessage *msg, void *data)
-{
-
- guint i;
- WSDBusMethodData *buffer;
- GArray *temp;
-
- temp = (GArray *) data;
-
- for (i=0;((i<temp->len) && (i<255));++i)
- {
- buffer = g_array_index (temp, WSDBusMethodData *, i);
-
- g_debug ("name: %s\ntypes: %s", buffer->name, buffer->data_types);
-
- return;
-
- dbus_message_append_args (msg, DBUS_TYPE_STRING, buffer->name,
- DBUS_TYPE_STRING, buffer->data_types,
- DBUS_TYPE_INVALID);
- };
- g_debug ("DBUS: Added %d words\n", i);
-};
-
-WSDBusStatus ws_dbus_send_method_data (WSDBusData *ws_dbus_data)
-{
- osso_return_t result;
- osso_rpc_t *retval;
-
- retval = g_try_malloc (sizeof (osso_rpc_t));
-
- if (retval == NULL)
- {
- g_debug("DBUS: Error in function %s:",__FUNCTION__);
- g_debug(" Couldn't allocate memory for message's return value\n");
- };
-
- result = osso_rpc_run_with_argfill (ws_dbus_data->context,
- ws_dbus_data->remote_service,
- ws_dbus_data->remote_object,
- ws_dbus_data->remote_iface,
- "method_data",
- retval,
- ws_dbus_fill_method_data,
- ws_dbus_data->method_data);
-
- g_debug ("\nDBUS: %s: ", __FUNCTION__);
-
- ws_dbus_libosso_errors (result);
-
- if (result != OSSO_OK)
- {
- g_debug ("Error message: %s\n", retval->value.s);
- osso_rpc_free_val (retval);
- g_free (retval);
- return WS_DBUS_STATUS_ERROR;
- };
- osso_rpc_free_val (retval);
- g_free (retval);
- return WS_DBUS_STATUS_OK;
-};*/
+/*@}*/