Inter-Process Communication Library

Data Structures

struct  eripc_arg_t
struct  eripc_event_info_t
struct  eripc_client_context_t
struct  eripc_device_caps_t
struct  eripc_callback_function_t
struct  _osso_callback_data_t
struct  _osso_handler_t
struct  _osso_hash_value_t
struct  osso_af_context_t
struct  _eripc_context_t

Files

file  eripc.h
 

Public header for liberipc.


file  eripc_support.h
 

Public header for liberipc support functions.


file  init.h
 

This file implements all initialisation and shutdown of the library.


file  internal.h
 

This file contains internal definitions.


Defines

#define DBUS_API_SUBJECT_TO_CHANGE
#define OSSO_BUS_ROOT   "com.irexnet"
#define OSSO_BUS_ROOT_PATH   "/com/irexnet"
#define ERIPC_PATH_MATCH_ALL   "eripc_path_match_all"
#define ERIPC_MEMBER_MATCH_ALL   "eripc_member_match_all"
#define MAX_IF_LEN   255
#define MAX_SVC_LEN   255
#define MAX_OP_LEN   255
#define MAX_MEMBER_LEN   255
#define MAX_ERROR_LEN   255
#define MAX_HASH_KEY_LEN   (MAX_IF_LEN + MAX_SVC_LEN + MAX_OP_LEN)
#define MAX_OPM_HASH_KEY_LEN   (MAX_OP_LEN + MAX_MEMBER_LEN)
#define MAX_MSGID_LEN   (MAX_SVC_LEN + 20 + 20 + 2)
#define MAX_APP_NAME_LEN   50
#define MAX_VERSION_LEN   30
#define ERIPC_MAX_ARGS   256
#define ERIPC_MAX_MATCH_SIZE   256
#define dprint(f, a...)
#define ULOG_CRIT(...)   do {} while (0)
#define ULOG_ERR(...)   do {} while (0)
#define ULOG_WARN(...)   do {} while (0)
#define ULOG_INFO(...)   do {} while (0)
#define ULOG_DEBUG(...)   do {} while (0)
#define ULOG_CRIT_L(...)   do {} while (0)
#define ULOG_ERR_L(...)   do {} while (0)
#define ULOG_WARN_L(...)   do {} while (0)
#define ULOG_INFO_L(...)   do {} while (0)
#define ULOG_DEBUG_L(...)   do {} while (0)
#define ULOG_CRIT_F(...)   do {} while (0)
#define ULOG_ERR_F(...)   do {} while (0)
#define ULOG_WARN_F(...)   do {} while (0)
#define ULOG_INFO_F(...)   do {} while (0)
#define ULOG_DEBUG_F(...)   do {} while (0)
#define DLOG_CRIT(...)   do {} while (0)
#define DLOG_ERR(...)   do {} while (0)
#define DLOG_WARN(...)   do {} while (0)
#define DLOG_INFO(...)   do {} while (0)
#define DLOG_DEBUG(...)   do {} while (0)
#define DLOG_CRIT_L(...)   do {} while (0)
#define DLOG_ERR_L(...)   do {} while (0)
#define DLOG_WARN_L(...)   do {} while (0)
#define DLOG_INFO_L(...)   do {} while (0)
#define DLOG_DEBUG_L(...)   do {} while (0)
#define DLOG_CRIT_F(...)   do {} while (0)
#define DLOG_ERR_F(...)   do {} while (0)
#define DLOG_WARN_F(...)   do {} while (0)
#define DLOG_INFO_F(...)   do {} while (0)
#define DLOG_DEBUG_F(...)   do {} while (0)
#define ULOG_OPEN(X)   do {} while (0)
#define DLOG_OPEN(X)   do {} while (0)
#define LOG_CLOSE()   do {} while (0)

Typedefs

typedef struct _eripc_context_t eripc_context_t
typedef void( eripc_handler_t )(eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
typedef struct osso_af_context_t osso_context_t
typedef void( _osso_handler_f )(osso_context_t *osso, DBusMessage *msg, _osso_callback_data_t *data, eripc_bus_t bus_type)
typedef struct osso_af_context_t _eripc_context_t
typedef struct _eripc_context_t _eripc_this_type_is_not_used_t

Enumerations

enum  eripc_error_t {
  ERIPC_ERROR_SUCCESS = 0, ERIPC_ERROR_INVALID, ERIPC_ERROR_OOM, ERIPC_ERROR,
  ERIPC_ERROR_TIMEOUT
}
enum  eripc_data_t {
  ERIPC_TYPE_INVALID = 0, ERIPC_TYPE_BOOL, ERIPC_TYPE_BYTE, ERIPC_TYPE_INT,
  ERIPC_TYPE_UINT, ERIPC_TYPE_DOUBLE, ERIPC_TYPE_STRING, ERIPC_TYPE_DATA
}
enum  eripc_bus_t { ERIPC_BUS_IRRELEVANT = 0, ERIPC_BUS_SYSTEM, ERIPC_BUS_SESSION, ERIPC_BUS_BOTH }
enum  eripc_event_t {
  ERIPC_EVENT_NONE = 0, ERIPC_EVENT_MESSAGE, ERIPC_EVENT_SIGNAL, ERIPC_EVENT_MESSAGE_OR_SIGNAL,
  ERIPC_EVENT_REPLY, ERIPC_EVENT_ERROR, ERIPC_EVENT_REPLY_OR_ERROR
}

Functions

void * eripc_get_system_connection (eripc_context_t *context)
void * eripc_get_session_connection (eripc_context_t *context)
eripc_context_teripc_init (const char *program_name, const char *program_version, GMainContext *context)
eripc_error_t eripc_set_signal_handler (eripc_context_t *context, eripc_handler_t *handler, void *user_data, eripc_bus_t bus_type, const char *source, const char *signal_name, int *handler_id)
eripc_error_t eripc_set_message_handler (eripc_context_t *context, eripc_handler_t *handler, void *user_data, eripc_bus_t bus_type, const char *source, const char *message_name, int *handler_id)
eripc_error_t eripc_set_event_handler (eripc_context_t *context, const eripc_event_info_t *info, eripc_handler_t *handler, void *user_data, int *handler_id)
eripc_error_t eripc_unset_handler (eripc_context_t *context, int handler_id)
eripc_error_t eripc_get_timeout (eripc_context_t *context, int *timeout)
eripc_error_t eripc_set_timeout (eripc_context_t *context, int timeout)
eripc_error_t eripc_send_varargs (eripc_context_t *context, eripc_handler_t *reply_handler, const void *user_data, eripc_bus_t bus_type, const char *destination, const char *message_name, eripc_data_t arg_type,...)
eripc_error_t eripc_send_string (eripc_context_t *context, eripc_handler_t *reply_handler, const void *user_data, eripc_bus_t bus_type, const char *destination, const char *message_name, const char *string)
eripc_error_t eripc_send_int (eripc_context_t *context, eripc_handler_t *reply_handler, const void *user_data, eripc_bus_t bus_type, const char *destination, const char *message_name, int value)
eripc_error_t eripc_send_bool (eripc_context_t *context, eripc_handler_t *reply_handler, const void *user_data, eripc_bus_t bus_type, const char *destination, const char *message_name, gboolean value)
eripc_error_t eripc_send_varargs_and_wait (eripc_context_t *context, eripc_event_info_t **reply, eripc_bus_t bus_type, const char *destination, const char *message_name, eripc_data_t arg_type,...)
eripc_error_t eripc_send_string_and_wait (eripc_context_t *context, eripc_event_info_t **reply, eripc_bus_t bus_type, const char *destination, const char *message_name, const char *string)
eripc_error_t eripc_send_int_and_wait (eripc_context_t *context, eripc_event_info_t **reply, eripc_bus_t bus_type, const char *destination, const char *message_name, int value)
eripc_error_t eripc_send_bool_and_wait (eripc_context_t *context, eripc_event_info_t **reply, eripc_bus_t bus_type, const char *destination, const char *message_name, gboolean value)
eripc_error_t eripc_send_signal (eripc_context_t *context, eripc_bus_t bus_type, const char *signal_name, const char *argument)
eripc_error_t eripc_send_signal_varargs (eripc_context_t *context, eripc_bus_t bus_type, const char *signal_path, const char *signal_interface, const char *signal_name, eripc_data_t arg_type,...)
eripc_error_t eripc_event_info_free (eripc_context_t *context, eripc_event_info_t *reply)
eripc_error_t eripc_reply_varargs (eripc_context_t *context, const char *message_id, eripc_data_t arg_type,...)
eripc_error_t eripc_reply_string (eripc_context_t *context, const char *message_id, const char *string)
eripc_error_t eripc_reply_int (eripc_context_t *context, const char *message_id, int value)
eripc_error_t eripc_reply_bool (eripc_context_t *context, const char *message_id, gboolean value)
eripc_error_t eripc_reply_error (eripc_context_t *context, const char *message_id, const char *error_name, const char *error_message)
eripc_client_context_teripc_client_context_new (const char *name, const char *version, const char *service, const char *path, const char *interface, eripc_callback_function_t *callbacks)
void eripc_client_context_free (eripc_client_context_t *ccontext, eripc_callback_function_t *callbacks)
const gchar * eripc_error_string (eripc_error_t errorcode)
gboolean eripc_menu_add_menu (eripc_client_context_t *ccontext, const char *name, const char *group1, const char *group2, const char *group3, const char *group4)
gboolean eripc_menu_remove_menu (eripc_client_context_t *ccontext, const char *name)
gboolean eripc_menu_add_group (eripc_client_context_t *ccontext, const char *name, const char *parent, const char *image)
gboolean eripc_menu_add_item (eripc_client_context_t *ccontext, const char *name, const char *parent, const char *image)
gboolean eripc_menu_set_menu_label (eripc_client_context_t *ccontext, const char *name, const char *label)
gboolean eripc_menu_set_group_label (eripc_client_context_t *ccontext, const char *name, const char *label)
gboolean eripc_menu_set_item_label (eripc_client_context_t *ccontext, const char *name, const char *parent, const char *label)
gboolean eripc_menu_show_menu (eripc_client_context_t *ccontext, const char *name)
gboolean eripc_menu_set_group_state (eripc_client_context_t *ccontext, const char *name, const char *state)
gboolean eripc_menu_set_item_state (eripc_client_context_t *ccontext, const char *name, const char *parent, const char *state)
gboolean eripc_menu_set_pagecounter (eripc_client_context_t *ccontext, int cur_page, int num_pages, gboolean boundary_check)
gboolean eripc_menu_set_statusitem_state (eripc_client_context_t *ccontext, const char *item, const char *state)
gboolean eripc_sysd_set_menu_state (eripc_client_context_t *ccontext, const char *state)
gboolean eripc_sysd_mount_sd_card (eripc_client_context_t *ccontext, gboolean show_index_splash)
gboolean eripc_sysd_unmount_sd_card (eripc_client_context_t *ccontext)
gboolean eripc_sysd_set_busy (eripc_client_context_t *ccontext, const char *state, const char *message)
gboolean eripc_sysd_reset_busy (eripc_client_context_t *ccontext)
gboolean eripc_sysd_set_bg_busy (eripc_client_context_t *ccontext)
gboolean eripc_sysd_reset_bg_busy (eripc_client_context_t *ccontext)
gboolean eripc_sysd_set_keyboard (eripc_client_context_t *ccontext, const char *state)
gboolean eripc_sysd_startup_complete (eripc_client_context_t *ccontext, const int pid, const gboolean is_multidoc, const int xid)
gint eripc_sysd_start_task (eripc_client_context_t *ccontext, const gchar *cmd_line, const gchar *work_dir, const gchar *label, const gchar *thumbnail_path, gchar **err_message)
gboolean eripc_sysd_stop_task (eripc_client_context_t *ccontext, const char *cmd_line)
gint eripc_sysd_open_url (eripc_client_context_t *ccontext, const gchar *url, const gchar *label, const gchar *back_text, gchar **err_message)
gboolean eripc_sysd_get_device_capabilities (eripc_client_context_t *ccontext, eripc_device_caps_t *caps)
gboolean eripc_sysd_conn_connect (eripc_client_context_t *ccontext, const char *medium, const char *profile)
gboolean eripc_sysd_conn_disconnect (eripc_client_context_t *ccontext)
gboolean eripc_sysd_conn_status_request (eripc_client_context_t *ccontext)
static gboolean _validate (const gchar *application, const gchar *version)
static osso_context_t_init (const char *application, const char *version)
static void _deinit (osso_context_t *osso)
static DBusConnection * _dbus_setup (osso_context_t *osso, DBusBusType bus_type, GMainContext *context)
int __attribute__ ((visibility("hidden"))) eripc_convert_msgtype(int t)
eripc_arg_t_get_args (DBusMessageIter *iter)
gboolean validate_appname (const gchar *application)

Variables

DBusHandlerResult DBusMessage * msg
DBusHandlerResult DBusMessage
void * 
data
void char * interface
void char * service
void char * path
void const char * name
void const char char * ready_name
gboolean _osso_handler_fhandler
gboolean _osso_handler_f
_osso_callback_data_t int 
handler_id
gboolean _osso_handler_f
_osso_callback_data_t int
gboolean 
call_once_per_handler_id
void eripc_bus_tbus
void eripc_bus_t char * sender
void eripc_bus_t char int * serial
void const char int char * id

Define Documentation

#define DBUS_API_SUBJECT_TO_CHANGE

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Based on code found in libosso library by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

Definition at line 35 of file internal.h.

#define DLOG_CRIT ( ...   )     do {} while (0)

Definition at line 277 of file eripc/include/log.h.

#define DLOG_CRIT_F ( ...   )     do {} while (0)

Definition at line 287 of file eripc/include/log.h.

#define DLOG_CRIT_L ( ...   )     do {} while (0)

Definition at line 282 of file eripc/include/log.h.

#define DLOG_DEBUG ( ...   )     do {} while (0)

Definition at line 281 of file eripc/include/log.h.

#define DLOG_DEBUG_F ( ...   )     do {} while (0)

Definition at line 291 of file eripc/include/log.h.

#define DLOG_DEBUG_L ( ...   )     do {} while (0)

Definition at line 286 of file eripc/include/log.h.

#define DLOG_ERR ( ...   )     do {} while (0)

Definition at line 278 of file eripc/include/log.h.

#define DLOG_ERR_F ( ...   )     do {} while (0)

Definition at line 288 of file eripc/include/log.h.

#define DLOG_ERR_L ( ...   )     do {} while (0)

Definition at line 283 of file eripc/include/log.h.

#define DLOG_INFO ( ...   )     do {} while (0)

Definition at line 280 of file eripc/include/log.h.

#define DLOG_INFO_F ( ...   )     do {} while (0)

Definition at line 290 of file eripc/include/log.h.

#define DLOG_INFO_L ( ...   )     do {} while (0)

Definition at line 285 of file eripc/include/log.h.

#define DLOG_OPEN (  )     do {} while (0)

Definition at line 294 of file eripc/include/log.h.

#define DLOG_WARN ( ...   )     do {} while (0)

Definition at line 279 of file eripc/include/log.h.

#define DLOG_WARN_F ( ...   )     do {} while (0)

Definition at line 289 of file eripc/include/log.h.

#define DLOG_WARN_L ( ...   )     do {} while (0)

Definition at line 284 of file eripc/include/log.h.

#define dprint ( f,
a...   ) 

Definition at line 174 of file internal.h.

Referenced by _dbus_setup().

#define ERIPC_MAX_ARGS   256

Definition at line 71 of file internal.h.

Referenced by _get_args().

#define ERIPC_MAX_MATCH_SIZE   256

Definition at line 72 of file internal.h.

Referenced by compose_match().

#define ERIPC_MEMBER_MATCH_ALL   "eripc_member_match_all"

Definition at line 56 of file internal.h.

Referenced by __attribute__(), _send_helper(), compose_opm_hash_key(), and opm_match().

#define ERIPC_PATH_MATCH_ALL   "eripc_path_match_all"

Definition at line 55 of file internal.h.

Referenced by __attribute__(), _send_helper(), compose_opm_hash_key(), and opm_match().

 
#define LOG_CLOSE (  )     do {} while (0)

Definition at line 295 of file eripc/include/log.h.

#define MAX_APP_NAME_LEN   50

Definition at line 68 of file internal.h.

Referenced by _init().

#define MAX_ERROR_LEN   255

Definition at line 63 of file internal.h.

Referenced by eripc_reply_error().

#define MAX_HASH_KEY_LEN   (MAX_IF_LEN + MAX_SVC_LEN + MAX_OP_LEN)

Definition at line 64 of file internal.h.

#define MAX_IF_LEN   255

Definition at line 59 of file internal.h.

Referenced by __attribute__(), _send_helper(), and _send_sync_helper().

#define MAX_MEMBER_LEN   255

Definition at line 62 of file internal.h.

Referenced by compose_opm_hash_key(), and opm_match_helper().

#define MAX_MSGID_LEN   (MAX_SVC_LEN + 20 + 20 + 2)
#define MAX_OP_LEN   255

Definition at line 61 of file internal.h.

Referenced by _send_helper(), _send_sync_helper(), compose_opm_hash_key(), and opm_match_helper().

#define MAX_OPM_HASH_KEY_LEN   (MAX_OP_LEN + MAX_MEMBER_LEN)

Definition at line 65 of file internal.h.

Referenced by __attribute__(), and opm_match().

#define MAX_SVC_LEN   255
#define MAX_VERSION_LEN   30

Definition at line 69 of file internal.h.

Referenced by _init().

#define OSSO_BUS_ROOT   "com.irexnet"

Definition at line 52 of file internal.h.

Referenced by __attribute__().

#define OSSO_BUS_ROOT_PATH   "/com/irexnet"

Definition at line 53 of file internal.h.

#define ULOG_CRIT ( ...   )     do {} while (0)

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Based on code found in libosso library by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

Definition at line 261 of file eripc/include/log.h.

#define ULOG_CRIT_F ( ...   )     do {} while (0)

Definition at line 271 of file eripc/include/log.h.

Referenced by eripc_init(), and fix_name().

#define ULOG_CRIT_L ( ...   )     do {} while (0)

Definition at line 266 of file eripc/include/log.h.

#define ULOG_DEBUG ( ...   )     do {} while (0)

Definition at line 265 of file eripc/include/log.h.

#define ULOG_DEBUG_F ( ...   )     do {} while (0)
#define ULOG_DEBUG_L ( ...   )     do {} while (0)

Definition at line 270 of file eripc/include/log.h.

#define ULOG_ERR ( ...   )     do {} while (0)

Definition at line 262 of file eripc/include/log.h.

Referenced by eripc_client_context_new().

#define ULOG_ERR_F ( ...   )     do {} while (0)
#define ULOG_ERR_L ( ...   )     do {} while (0)

Definition at line 267 of file eripc/include/log.h.

#define ULOG_INFO ( ...   )     do {} while (0)

Definition at line 264 of file eripc/include/log.h.

#define ULOG_INFO_F ( ...   )     do {} while (0)

Definition at line 274 of file eripc/include/log.h.

#define ULOG_INFO_L ( ...   )     do {} while (0)

Definition at line 269 of file eripc/include/log.h.

#define ULOG_OPEN (  )     do {} while (0)

Definition at line 293 of file eripc/include/log.h.

#define ULOG_WARN ( ...   )     do {} while (0)

Definition at line 263 of file eripc/include/log.h.

#define ULOG_WARN_F ( ...   )     do {} while (0)

Definition at line 273 of file eripc/include/log.h.

Referenced by __attribute__(), eripc_reply_handler(), and generic_signal_handler().

#define ULOG_WARN_L ( ...   )     do {} while (0)

Definition at line 268 of file eripc/include/log.h.


Typedef Documentation

This structure is used to store library specific stuff

typedef void( _osso_handler_f)(osso_context_t *osso, DBusMessage *msg, _osso_callback_data_t *data, eripc_bus_t bus_type)

Definition at line 92 of file internal.h.

Definition at line 75 of file eripc.h.

typedef void( eripc_handler_t)(eripc_context_t *context, const eripc_event_info_t *info, void *user_data)

This is the type for the callback handlers of events and messages.

This function is called when the asynchronous function returns a reply or when a registered event occurs.

Parameters:
context IPC context returned by eripc_init.
info Structure specifying the type of event and its arguments.
user_data Optional user data passed when the handler was registered.

Definition at line 133 of file eripc.h.

Definition at line 137 of file eripc.h.


Enumeration Type Documentation

Enumerator:
ERIPC_BUS_IRRELEVANT 
ERIPC_BUS_SYSTEM 
ERIPC_BUS_SESSION 
ERIPC_BUS_BOTH 

Definition at line 58 of file eripc.h.

00058              {
00059     ERIPC_BUS_IRRELEVANT = 0,
00060     ERIPC_BUS_SYSTEM,
00061     ERIPC_BUS_SESSION,
00062     ERIPC_BUS_BOTH
00063 } eripc_bus_t;

Enumerator:
ERIPC_TYPE_INVALID 
ERIPC_TYPE_BOOL 
ERIPC_TYPE_BYTE 
ERIPC_TYPE_INT 
ERIPC_TYPE_UINT 
ERIPC_TYPE_DOUBLE 
ERIPC_TYPE_STRING 
ERIPC_TYPE_DATA 

Definition at line 47 of file eripc.h.

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Based on code found in libosso library by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com>

Enumerator:
ERIPC_ERROR_SUCCESS 
ERIPC_ERROR_INVALID 
ERIPC_ERROR_OOM 
ERIPC_ERROR 
ERIPC_ERROR_TIMEOUT 

Definition at line 39 of file eripc.h.

00039              {
00040     ERIPC_ERROR_SUCCESS =  0,   /* success (not an error) */
00041     ERIPC_ERROR_INVALID,        /* invalid arguments */ 
00042     ERIPC_ERROR_OOM,            /* out of memory */
00043     ERIPC_ERROR,                /* generic error code */
00044     ERIPC_ERROR_TIMEOUT,        /* timeout happened */
00045 } eripc_error_t;

Enumerator:
ERIPC_EVENT_NONE 
ERIPC_EVENT_MESSAGE 
ERIPC_EVENT_SIGNAL 
ERIPC_EVENT_MESSAGE_OR_SIGNAL 
ERIPC_EVENT_REPLY 
ERIPC_EVENT_ERROR 
ERIPC_EVENT_REPLY_OR_ERROR 

Definition at line 65 of file eripc.h.

00065              { 
00066     ERIPC_EVENT_NONE = 0,               /* non-event, event type is not relevant */
00067     ERIPC_EVENT_MESSAGE,                /* message received */
00068     ERIPC_EVENT_SIGNAL,                 /* signal received */
00069     ERIPC_EVENT_MESSAGE_OR_SIGNAL,      /* message or signal received */
00070     ERIPC_EVENT_REPLY,                  /* reply received */
00071     ERIPC_EVENT_ERROR,                  /* error reply received */
00072     ERIPC_EVENT_REPLY_OR_ERROR,         /* reply or error received */
00073 } eripc_event_t;


Function Documentation

gboolean __attribute__ ( (visibility("hidden"))   ) 

Definition at line 145 of file init.c.

References MAX_IF_LEN, and OSSO_BUS_ROOT.

00147 {
00148     assert(application != NULL);
00149     assert(interface != NULL);
00150 
00151     if (g_strrstr(application, ".") != NULL) {
00152         g_snprintf(interface, MAX_IF_LEN, "%s", application);
00153     } else {
00154         g_snprintf(interface, MAX_IF_LEN, OSSO_BUS_ROOT ".%s",
00155                    application);
00156     }
00157 }

static DBusConnection* _dbus_setup ( osso_context_t osso,
DBusBusType  bus_type,
GMainContext *  context 
) [static]

This function connect to the given D-BUS bus and registers itself with the D-BUS daemon.

Parameters:
osso The osso_context_t for this connection.
bus_type. The DBusType to use.
context The GLib main-loop context to connect to, use NULL for the default context.
Returns:
The DBusConnection for the connection.
static void _deinit ( osso_context_t osso  )  [static]

This function deinitializes the osso_type_t structure, but does not touch and D-BUS element. As a final thing it will destroy the osso_context_t structure.

Parameters:
osso the disconnecte osso_context_t structure to destroy.
eripc_arg_t* _get_args ( DBusMessageIter *  iter  ) 

Definition at line 62 of file hw.c.

References _get_byte_array(), eripc_arg_t::b, eripc_arg_t::by, eripc_arg_t::d, ERIPC_MAX_ARGS, ERIPC_TYPE_BOOL, ERIPC_TYPE_BYTE, ERIPC_TYPE_DOUBLE, ERIPC_TYPE_INT, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, ERIPC_TYPE_UINT, eripc_arg_t::i, eripc_arg_t::s, eripc_arg_t::type, eripc_arg_t::u, ULOG_ERR_F, and eripc_arg_t::value.

Referenced by _send_sync_helper(), eripc_reply_handler(), and generic_signal_handler().

00063 {
00064     int type, idx = 0;
00065     eripc_arg_t *arg_array;
00066 
00067     arg_array = calloc(1, sizeof(eripc_arg_t) * (ERIPC_MAX_ARGS + 1));
00068     if (arg_array == NULL) {
00069             ULOG_ERR_F("calloc() failed: %s", strerror(errno));
00070             return NULL;
00071     }
00072 
00073     while ((type = dbus_message_iter_get_arg_type(iter))
00074            != DBUS_TYPE_INVALID) {
00075 
00076             int i;
00077             unsigned int u;
00078             double d;
00079             char c, *s;
00080 
00081             switch (type) {
00082                     case DBUS_TYPE_BOOLEAN:
00083                             arg_array[idx].type = ERIPC_TYPE_BOOL; 
00084                             dbus_message_iter_get_basic(iter, &i);
00085                             arg_array[idx].value.b = i ? 1 : 0;
00086                             ++idx;
00087                             break;
00088                     case DBUS_TYPE_INT32:
00089                             arg_array[idx].type = ERIPC_TYPE_INT; 
00090                             dbus_message_iter_get_basic(iter, &i);
00091                             arg_array[idx].value.i = i;
00092                             ++idx;
00093                             break;
00094                     case DBUS_TYPE_UINT32:
00095                             arg_array[idx].type = ERIPC_TYPE_UINT; 
00096                             dbus_message_iter_get_basic(iter, &u);
00097                             arg_array[idx].value.u = u;
00098                             ++idx;
00099                             break;
00100                     case DBUS_TYPE_DOUBLE:
00101                             arg_array[idx].type = ERIPC_TYPE_DOUBLE; 
00102                             dbus_message_iter_get_basic(iter, &d);
00103                             arg_array[idx].value.d = d;
00104                             ++idx;
00105                             break;
00106                     case DBUS_TYPE_BYTE:
00107                             arg_array[idx].type = ERIPC_TYPE_BYTE; 
00108                             dbus_message_iter_get_basic(iter, &c);
00109                             arg_array[idx].value.by = c;
00110                             ++idx;
00111                             break;
00112                     case DBUS_TYPE_STRING:
00113                             arg_array[idx].type = ERIPC_TYPE_STRING; 
00114                             dbus_message_iter_get_basic(iter, &s);
00115                             arg_array[idx].value.s = s;
00116                             ++idx;
00117                             break;
00118                     case DBUS_TYPE_ARRAY:
00119                             /* only byte arrays are supported */
00120                             if (dbus_message_iter_get_element_type(iter)
00121                                 == DBUS_TYPE_BYTE) {
00122                                     _get_byte_array(iter,
00123                                                     &arg_array[idx]);
00124                                     ++idx;
00125                             } else {
00126                                     ULOG_ERR_F("arrays of type %d not"
00127                                                " supported",
00128                                     dbus_message_iter_get_element_type(iter));
00129                             }
00130                             break;
00131                     default:
00132                             ULOG_ERR_F("type %d not supported", type);
00133                             break;
00134             }
00135 
00136             dbus_message_iter_next(iter);
00137     }
00138 
00139     arg_array[idx].type = ERIPC_TYPE_INVALID;
00140 
00141     return arg_array;
00142 }

Here is the call graph for this function:

Here is the caller graph for this function:

static osso_context_t* _init ( const char *  application,
const char *  version 
) [static]

This function allocates and initializes the osso_type_t structure

Parameters:
application The application name
verson The application version.
Returns:
the newly allocated osso_context_t structure, or NULL if there is an error.
static gboolean _validate ( const gchar *  application,
const gchar *  version 
) [static]

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Based on code found in libosso library by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> This internal function performs a simple validation for the application and version information of the osso_context regarding their validity as components of the filesystem (no slashes, value not NULL etc)

Parameters:
application The application name
verson The application version.
Returns:
TRUE if the context passes the validation, FALSE otherwise.
void eripc_client_context_free ( eripc_client_context_t ccontext,
eripc_callback_function_t callbacks 
)

Free a client context

Definition at line 269 of file support.c.

References eripc_client_context_t::context, eripc_unset_handler(), eripc_callback_function_t::handler_id, eripc_client_context_t::name, eripc_client_context_t::path, and eripc_client_context_t::service.

Referenced by notepad::ipc_unset_services(), and ipc_unset_services().

00271 {
00272     if (callbacks != NULL)
00273     {
00274         for (int i = 0 ; callbacks[i].handler_id != 0 ; i++)
00275         {
00276             eripc_unset_handler(ccontext->context, callbacks[i].handler_id);
00277         }
00278     }
00279 
00280     if (ccontext)
00281     {
00282         free(ccontext->name);
00283         free(ccontext->service);
00284         free(ccontext->path);
00285         free(ccontext);
00286     }
00287 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_client_context_t* eripc_client_context_new ( const char *  name,
const char *  version,
const char *  service,
const char *  path,
const char *  interface,
eripc_callback_function_t callbacks 
)

Create a new client context for a client application

Definition at line 189 of file support.c.

References eripc_client_context_t::context, ERIPC_BUS_SESSION, ERIPC_ERROR_SUCCESS, eripc_init(), eripc_set_message_handler(), eripc_set_signal_handler(), fix_name(), eripc_callback_function_t::handler, eripc_callback_function_t::handler_id, interface, eripc_callback_function_t::message_name, eripc_client_context_t::name, name, eripc_client_context_t::path, path, eripc_client_context_t::service, service, ULOG_DEBUG_F, and ULOG_ERR.

Referenced by ipc_init(), notepad::ipc_set_services(), ipc_set_services(), and main().

00195 {
00196     int retval;
00197     eripc_client_context_t* ccontext;
00198 
00199     ccontext = (eripc_client_context_t*)malloc(sizeof(eripc_client_context_t));
00200     
00201     char *name      = fix_name(raw_name);
00202     char *service   = fix_name(raw_service);
00203     char *path      = fix_name(raw_path);
00204     char *interface = fix_name(raw_interface);
00205     
00206     ccontext->context = eripc_init(name, version, NULL);
00207     if (ccontext->context == NULL) 
00208     {
00209         // NOTE: MEMLEAK on name, service, path and interface!
00210         ULOG_ERR("Failed to initialize eripc context");
00211         free(ccontext);
00212         return NULL;
00213     }
00214     
00215     if (callbacks != NULL)
00216     {
00217         for (int i = 0 ; callbacks[i].handler != NULL ; i++)
00218         {
00219             if (callbacks[i].interface)
00220             {
00221                 // install signal handler
00222                 char *cb_interface = fix_name(callbacks[i].interface);
00223                 retval = eripc_set_signal_handler( ccontext->context,
00224                                                    callbacks[i].handler,
00225                                                    NULL,
00226                                                    ERIPC_BUS_SESSION,
00227                                                    cb_interface,
00228                                                    callbacks[i].message_name,
00229                                                    &(callbacks[i].handler_id) );
00230                 
00231                 free(cb_interface);
00232                 if (retval != ERIPC_ERROR_SUCCESS) 
00233                 {
00234                     ULOG_DEBUG_F( "eripc_set_signal_handler %s returns %d",
00235                                  callbacks[i].message_name,
00236                                  retval );
00237                 }
00238             }
00239             else
00240             {
00241                 // install message handler
00242                 retval = eripc_set_message_handler( ccontext->context,
00243                                                     callbacks[i].handler,
00244                                                     NULL,
00245                                                     ERIPC_BUS_SESSION,
00246                                                     interface,
00247                                                     callbacks[i].message_name,
00248                                                     &(callbacks[i].handler_id) );
00249                   
00250                 if (retval != ERIPC_ERROR_SUCCESS) 
00251                 {
00252                     ULOG_DEBUG_F( "eripc_set_message_handler %s returns %d",
00253                                  callbacks[i].message_name,
00254                                  retval );
00255                 }
00256             }
00257         }
00258     }
00259 
00260     free(interface);
00261     
00262     ccontext->name = name;
00263     ccontext->service = service;
00264     ccontext->path = path;
00265     return ccontext;
00266 }

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar* eripc_error_string ( eripc_error_t  errorcode  ) 

Return error string for code

Definition at line 290 of file support.c.

References ERIPC_ERROR, ERIPC_ERROR_INVALID, ERIPC_ERROR_OOM, ERIPC_ERROR_SUCCESS, and ERIPC_ERROR_TIMEOUT.

Referenced by cb_sys_get_battery_state(), cb_sys_get_card_mountpoint(), cb_sys_get_device_capabilities(), cb_sys_get_orientation(), cb_sys_get_pageturn_inverted(), cb_sys_get_stylus(), ipc_add_profile(), ipc_confirm_install_drz(), ipc_confirm_install_update(), ipc_confirm_usbconnect(), ipc_connect(), ipc_ctb_goto(), ipc_disconnect(), ipc_edit_profile(), ipc_get_battery_state(), ipc_menu_add_task(), ipc_menu_remove_task(), ipc_menu_rename_task(), ipc_menu_set_first_task(), ipc_send_close(), ipc_send_conn_status(), ipc_send_item_activated(), ipc_send_open(), ipc_send_page_change(), ipc_send_ping(), ipc_send_reply(), ipc_send_reply_task_start(), ipc_send_status_item_activated(), ipc_send_store_metadata(), ipc_send_task_activated(), ipc_send_volume_mounted_to(), ipc_send_window_activated(), ipc_send_window_deactivated(), ipc_send_window_show(), ipc_set_orientation(), ipc_show_busy(), ipc_show_message(), ipc_show_popup(), and ipc_show_splash().

00291 {
00292     switch (errorcode) 
00293     {
00294     case ERIPC_ERROR_SUCCESS:
00295         return "No error (ERIPC_ERROR_SUCCESS)";
00296     case ERIPC_ERROR:
00297         return "Some kind of error occurred (ERIPC_ERROR)";
00298     case ERIPC_ERROR_INVALID:
00299         return "At least one parameter is invalid (ERIPC_ERROR_INVALID)";
00300     case ERIPC_ERROR_OOM:
00301         return "Out of memory error (ERIPC_ERROR_OOM)";
00302     case ERIPC_ERROR_TIMEOUT:
00303         return "Timeout error (ERIPC_ERROR_TIMEOUT)";
00304     default:
00305         return "Unknown/Undefined";
00306     }
00307 }

Here is the caller graph for this function:

eripc_error_t eripc_event_info_free ( eripc_context_t context,
eripc_event_info_t reply 
)

This function frees the event info structure and associated message.

Parameters:
context IPC context returned by eripc_init.
reply A pointer to the event info structure where the return info is stored.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 743 of file rpc.c.

References eripc_event_info_t::args, eripc_event_info_t::dbus_message, ERIPC_ERROR_SUCCESS, and UNUSED.

Referenced by ipc_get_battery_state(), notepad::ipc_get_mountpoint(), ipc_get_orientation(), notepad::ipc_sys_is_in_portrait_mode(), ipc_sys_is_in_portrait_mode(), notepad::ipc_sys_is_pageturn_inverted(), ipc_sys_is_pageturn_inverted(), and is_in_portrait_orientation().

00745 {
00746     UNUSED(context);
00747     if (info != NULL) {
00748         if (info->args != NULL) {
00749             free((char*)info->args);
00750         }
00751     
00752         if (info->dbus_message != NULL) {
00753             dbus_message_unref((DBusMessage *)info->dbus_message);
00754         }
00755         
00756         free(info);        
00757     }
00758     
00759     return ERIPC_ERROR_SUCCESS;
00760 }

Here is the caller graph for this function:

void* eripc_get_session_connection ( eripc_context_t context  ) 

Definition at line 163 of file rpc.c.

References _eripc_context_t::conn.

00164 {
00165     return (void *) context->conn;
00166 }

void* eripc_get_system_connection ( eripc_context_t context  ) 

Definition at line 158 of file rpc.c.

References _eripc_context_t::sys_conn.

Referenced by hal_set_services().

00159 {
00160     return (void *) context->sys_conn;
00161 }

Here is the caller graph for this function:

eripc_error_t eripc_get_timeout ( eripc_context_t context,
int *  timeout 
)

Returns the current RPC timeout value.

Parameters:
context IPC context returned by eripc_init.
timeout A pointer where to return the timeout value in milliseconds.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 150 of file rpc.c.

References ERIPC_ERROR_INVALID, ERIPC_ERROR_SUCCESS, and _eripc_context_t::timeout_ms.

Referenced by eripc_sysd_get_device_capabilities(), and ipc_sys_start_task().

00151 {
00152     if(context == NULL) return ERIPC_ERROR_INVALID;
00153     *timeout = context->timeout_ms;
00154     return ERIPC_ERROR_SUCCESS;
00155 }

Here is the caller graph for this function:

eripc_context_t* eripc_init ( const char *  program_name,
const char *  program_version,
GMainContext *  context 
)

This function initialises the library, connects to both the D-Bus session and system busses, integrates with the GLib main loop, and initialises the library for use. eripc_init should be called only once by the program.

Parameters:
program_name The name of the program. This name forms the last part of the default (D-Bus) service name of the program. Note that the D-Bus service name will be 'com.irexnet.program_name', where 'program_name' is the value you gave as the parameter. The only valid characters that the name may contain are letters a-z and the underscore '_'. However, you can give a name such as 'org.foo.bar' to have 'bar' as your program's name and 'org.foo.bar' as the D-Bus service name.
program_version The version string of the application. This will be used to determine if a saved UI state is still valid for the program.
context The GLib main loop context to connect to, or NULL for the default context.
Returns:
A context to use in later calls to this library, or NULL if an error happened.

Definition at line 81 of file init.c.

References _dbus_setup(), _deinit(), _init(), osso_af_context_t::conn, osso_af_context_t::cur_conn, osso_af_context_t::eripc_filters_setup, name, osso_af_context_t::sys_conn, ULOG_CRIT_F, and ULOG_DEBUG_F.

Referenced by eripc_client_context_new(), ipc_set_services(), and main().

00084 {
00085     osso_context_t *osso;
00086 
00087     char *name = strdup(program_name);
00088     if (name == NULL) {
00089         ULOG_CRIT_F("initialisation failed: out of memory");
00090         return NULL;
00091     }
00092     
00093     // replace dashes (-) with underscores (_) as dbus chokes on dashes
00094     unsigned int i;
00095     for (i=0; i<strlen(name); i++)
00096     {
00097         if (name[i] == '-')
00098             name[i] = '_';
00099     }
00100 
00101     ULOG_DEBUG_F("program '%s', version '%s'", name,
00102                  program_version);
00103 
00104     osso = _init(name, program_version);
00105     free(name);
00106     if (osso == NULL) {
00107         ULOG_CRIT_F("initialisation failed: out of memory");
00108         return NULL;
00109     }
00110 
00111     osso->conn = _dbus_setup(osso, DBUS_BUS_SESSION, context);
00112     if (osso->conn == NULL) {
00113         ULOG_CRIT_F("connecting to the session bus failed");
00114         _deinit(osso);
00115         return NULL;
00116     }
00117     osso->sys_conn = _dbus_setup(osso, DBUS_BUS_SYSTEM, context);
00118     if (osso->sys_conn == NULL) {
00119         ULOG_CRIT_F("connecting to the system bus failed");
00120       _deinit(osso);
00121         return NULL;
00122     }
00123     osso->eripc_filters_setup = TRUE;
00124     osso->cur_conn = NULL;
00125     return (eripc_context_t*)osso;
00126 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean eripc_menu_add_group ( eripc_client_context_t ccontext,
const char *  name,
const char *  parent,
const char *  image 
)

Add a new group to a popupmenu menu

Definition at line 340 of file support.c.

References DBUS_SERVICE_POPUP_MENU, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, and MAKE_VARARG_CALL.

Referenced by ipc_menu_add_group(), and notepad::menu_init().

00344 {
00345     MAKE_VARARG_CALL(DBUS_SERVICE_POPUP_MENU, "addGroup",
00346                      ERIPC_TYPE_STRING, name,
00347                      ERIPC_TYPE_STRING, parent,
00348                      ERIPC_TYPE_STRING, "",
00349                      ERIPC_TYPE_STRING, image,
00350                      ERIPC_TYPE_INVALID );
00351 }

Here is the caller graph for this function:

gboolean eripc_menu_add_item ( eripc_client_context_t ccontext,
const char *  name,
const char *  parent,
const char *  image 
)

Add a new item to a popupmenu group

Definition at line 354 of file support.c.

References DBUS_SERVICE_POPUP_MENU, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, and MAKE_VARARG_CALL.

Referenced by ipc_menu_add_item(), and notepad::menu_init().

00358 {
00359     MAKE_VARARG_CALL(DBUS_SERVICE_POPUP_MENU, "addItem",
00360                      ERIPC_TYPE_STRING, name,
00361                      ERIPC_TYPE_STRING, parent,
00362                      ERIPC_TYPE_STRING, "",
00363                      ERIPC_TYPE_STRING, image,
00364                      ERIPC_TYPE_INVALID );
00365 }

Here is the caller graph for this function:

gboolean eripc_menu_add_menu ( eripc_client_context_t ccontext,
const char *  name,
const char *  group1,
const char *  group2,
const char *  group3,
const char *  group4 
)

Add a new menu to the popupmenu

Definition at line 314 of file support.c.

References DBUS_SERVICE_POPUP_MENU, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, MAKE_VARARG_CALL, and eripc_client_context_t::service.

Referenced by ipc_menu_add_menu(), and notepad::menu_init().

00320 {
00321     MAKE_VARARG_CALL(DBUS_SERVICE_POPUP_MENU, "addMenu",
00322                      ERIPC_TYPE_STRING, name,
00323                      ERIPC_TYPE_STRING, "",
00324                      ERIPC_TYPE_STRING, ccontext->service,
00325                      ERIPC_TYPE_STRING, group1,
00326                      ERIPC_TYPE_STRING, group2,
00327                      ERIPC_TYPE_STRING, group3,
00328                      ERIPC_TYPE_STRING, group4,
00329                      ERIPC_TYPE_INVALID );
00330 }

Here is the caller graph for this function:

gboolean eripc_menu_remove_menu ( eripc_client_context_t ccontext,
const char *  name 
)

Remove a menu from the popupmenu

Definition at line 333 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_1S.

Referenced by ipc_remove_menu(), and notepad::menu_destroy().

00335 {
00336     MAKE_VARARG_CALL_1S(DBUS_SERVICE_POPUP_MENU, "removeMenu", name);
00337 }

Here is the caller graph for this function:

gboolean eripc_menu_set_group_label ( eripc_client_context_t ccontext,
const char *  name,
const char *  label 
)

Set the label for a popupmenu group

Definition at line 376 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_2S.

Referenced by ipc_menu_set_group_label(), and notepad::menu_set_text().

00379 {
00380     MAKE_VARARG_CALL_2S(DBUS_SERVICE_POPUP_MENU, "setGroupLabel", name, label);
00381 }

Here is the caller graph for this function:

gboolean eripc_menu_set_group_state ( eripc_client_context_t ccontext,
const char *  name,
const char *  state 
)

Set a popupmenu group's state

Definition at line 401 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_2S.

Referenced by ipc_menu_set_group_state().

00404 {
00405     MAKE_VARARG_CALL_2S(DBUS_SERVICE_POPUP_MENU, "setGroupState", name, state);
00406 }

Here is the caller graph for this function:

gboolean eripc_menu_set_item_label ( eripc_client_context_t ccontext,
const char *  name,
const char *  parent,
const char *  label 
)

Set the label for a popupmenu item

Definition at line 384 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_3S.

Referenced by ipc_menu_set_item_label(), and notepad::menu_set_text().

00388 {
00389     MAKE_VARARG_CALL_3S(DBUS_SERVICE_POPUP_MENU, "setItemLabel",
00390                         name, parent, label);
00391 }

Here is the caller graph for this function:

gboolean eripc_menu_set_item_state ( eripc_client_context_t ccontext,
const char *  name,
const char *  parent,
const char *  state 
)

Set a popupmenu item's state

Definition at line 409 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_3S.

Referenced by ipc_menu_set_item_state(), notepad::ipc_menu_set_pagecounter(), and notepad::menu_show().

00413 {
00414     MAKE_VARARG_CALL_3S(DBUS_SERVICE_POPUP_MENU, "setItemState",
00415                         name, parent, state);
00416 }

Here is the caller graph for this function:

gboolean eripc_menu_set_menu_label ( eripc_client_context_t ccontext,
const char *  name,
const char *  label 
)

Set the label for a popupmenu menu

Definition at line 368 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_2S.

Referenced by ipc_menu_set_menu_label().

00371 {
00372     MAKE_VARARG_CALL_2S(DBUS_SERVICE_POPUP_MENU, "setMenuLabel", name, label);
00373 }

Here is the caller graph for this function:

gboolean eripc_menu_set_pagecounter ( eripc_client_context_t ccontext,
int  cur_page,
int  num_pages,
gboolean  boundary_check 
)

Set the statusbar page counter

Definition at line 418 of file support.c.

References DBUS_SERVICE_POPUP_MENU, ERIPC_TYPE_BOOL, ERIPC_TYPE_INT, ERIPC_TYPE_INVALID, and MAKE_VARARG_CALL.

Referenced by notepad::ipc_menu_set_pagecounter(), and ipc_menu_set_pagecounter().

00422 {
00423     MAKE_VARARG_CALL(DBUS_SERVICE_POPUP_MENU, "updatePageCounter",
00424                      ERIPC_TYPE_INT, cur_page,
00425                      ERIPC_TYPE_INT, num_pages,
00426                      ERIPC_TYPE_BOOL, boundary_check,
00427                      ERIPC_TYPE_INVALID );
00428 }

Here is the caller graph for this function:

gboolean eripc_menu_set_statusitem_state ( eripc_client_context_t ccontext,
const char *  item,
const char *  state 
)

Set a statusbar item's state

Definition at line 431 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_2S.

Referenced by ipc_menu_set_statusitem_state(), ipc_set_stylus(), notepad::ipc_status_set_stylus(), and ipc_status_set_stylus().

00434 {
00435     MAKE_VARARG_CALL_2S(DBUS_SERVICE_POPUP_MENU, "setStatusItemState", item, state);
00436 }

Here is the caller graph for this function:

gboolean eripc_menu_show_menu ( eripc_client_context_t ccontext,
const char *  name 
)

Show a specific popupmenu menu

Definition at line 394 of file support.c.

References DBUS_SERVICE_POPUP_MENU, and MAKE_VARARG_CALL_1S.

Referenced by ipc_menu_show(), ipc_menu_show_menu(), and notepad::menu_show().

00396 {
00397     MAKE_VARARG_CALL_1S(DBUS_SERVICE_POPUP_MENU, "showMenu", name);
00398 }

Here is the caller graph for this function:

eripc_error_t eripc_reply_bool ( eripc_context_t context,
const char *  message_id,
gboolean  value 
)

This function returns a reply to a message with a boolean argument.

Instead of the variable arguments of eripc_reply_varargs, this function has single boolean as argument.

Parameters:
context IPC context returned by eripc_init.
message_id ID string of the received message to reply to.
value The argument value.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 868 of file rpc.c.

References eripc_reply_varargs(), ERIPC_TYPE_BOOL, and ERIPC_TYPE_INVALID.

Referenced by ipc_send_reply(), menuActivated_rh(), on_file_close(), on_ping(), on_window_activated(), and on_window_deactivated().

00871 {
00872     eripc_error_t rc;
00873     rc = eripc_reply_varargs(context, message_id,
00874                              ERIPC_TYPE_BOOL, value,
00875                              ERIPC_TYPE_INVALID);
00876     return rc;
00877 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_reply_error ( eripc_context_t context,
const char *  message_id,
const char *  error_name,
const char *  error_message 
)

This function return an error in reply to a message.

The error_name indicates the error which can be fully-qualitfied. When the service is omitted from the error name, the service of the given context is used.

Parameters:
context IPC context returned by eripc_init.
message_id ID string of the received message to reply to.
error_name The name of the error to return.
error_message Text string with error description.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 879 of file rpc.c.

References _parse_id(), _eripc_context_t::conn, ERIPC_BUS_SESSION, ERIPC_BUS_SYSTEM, ERIPC_ERROR, ERIPC_ERROR_INVALID, ERIPC_ERROR_OOM, ERIPC_ERROR_SUCCESS, _eripc_context_t::error_dummy, MAX_ERROR_LEN, MAX_SVC_LEN, sender, serial, _eripc_context_t::service, _eripc_context_t::sys_conn, and ULOG_ERR_F.

00883 {
00884     DBusConnection *conn;
00885     DBusMessage *reply;
00886     dbus_bool_t ret;
00887     char sender[MAX_SVC_LEN + 1], error_name[MAX_ERROR_LEN + 1];
00888     int serial;
00889     eripc_bus_t bus_type;
00890 
00891     if (context == NULL || name == NULL || message_id == NULL) {
00892         return ERIPC_ERROR_INVALID;
00893     }
00894     if (context->error_dummy == NULL) {
00895         /* OOM has happened earlier in the handler, or
00896          * the context is invalid */
00897         ULOG_ERR_F("error_dummy has not been created");
00898         return ERIPC_ERROR;
00899     }
00900 
00901     _parse_id(message_id, &bus_type, sender, &serial);
00902     assert(bus_type == ERIPC_BUS_SYSTEM || bus_type == ERIPC_BUS_SESSION);
00903 
00904     if (bus_type == ERIPC_BUS_SYSTEM) {
00905         conn = context->sys_conn;
00906     } else {
00907         conn = context->conn;
00908     }
00909     if (!dbus_connection_get_is_connected(conn)) {
00910         ULOG_ERR_F("connection %p is not open", conn);
00911         return ERIPC_ERROR_INVALID;
00912     }
00913 
00914     make_default_error_name(context->service, name, error_name);
00915 
00916     /* make a copy of the error_dummy and modify the copy */
00917     reply = dbus_message_copy(context->error_dummy);
00918     if (reply == NULL) {
00919         ULOG_ERR_F("dbus_message_copy failed");
00920         return ERIPC_ERROR_OOM;
00921     }
00922     if (!dbus_message_set_destination(reply, sender)) {
00923         ULOG_ERR_F("dbus_message_set_destination failed");
00924         goto unref_and_exit;
00925     }
00926     if (!dbus_message_set_reply_serial(reply, serial)) {
00927         ULOG_ERR_F("dbus_message_set_reply_serial failed");
00928         goto unref_and_exit;
00929     }
00930     if (!dbus_message_set_error_name(reply, error_name)) {
00931         ULOG_ERR_F("dbus_message_set_error_name failed");
00932         goto unref_and_exit;
00933     }
00934 
00935     if (message != NULL) {
00936         ret = dbus_message_append_args(reply, DBUS_TYPE_STRING,
00937                                        &message,
00938                                        DBUS_TYPE_INVALID);
00939         if (!ret) {
00940             ULOG_ERR_F("dbus_message_append_args failed");
00941             goto unref_and_exit;
00942         }
00943     }
00944 
00945     if (!dbus_connection_send(conn, reply, NULL)) {
00946         ULOG_ERR_F("dbus_connection_send failed");
00947         goto unref_and_exit;
00948     }
00949     dbus_message_unref(reply);
00950     return ERIPC_ERROR_SUCCESS;
00951 
00952 unref_and_exit:
00953     dbus_message_unref(reply);
00954     return ERIPC_ERROR_OOM;
00955 }

Here is the call graph for this function:

eripc_error_t eripc_reply_int ( eripc_context_t context,
const char *  message_id,
int  value 
)

This function returns a reply to a message with an integer argument.

Instead of the variable arguments of eripc_reply_varargs, this function has single integer as argument.

Parameters:
context IPC context returned by eripc_init.
message_id ID string of the received message to reply to.
value The argument value.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 857 of file rpc.c.

References eripc_reply_varargs(), ERIPC_TYPE_INT, and ERIPC_TYPE_INVALID.

00860 {
00861     eripc_error_t rc;
00862     rc = eripc_reply_varargs(context, message_id,
00863                              ERIPC_TYPE_INT, value,
00864                              ERIPC_TYPE_INVALID);
00865     return rc;
00866 }

Here is the call graph for this function:

eripc_error_t eripc_reply_string ( eripc_context_t context,
const char *  message_id,
const char *  string 
)

This function returns a reply to a message with a string argument.

Instead of the variable arguments of eripc_reply_varargs, this function has single string as argument.

Parameters:
context IPC context returned by eripc_init.
message_id ID string of the received message to reply to.
string The argument string.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 846 of file rpc.c.

References eripc_reply_varargs(), ERIPC_TYPE_INVALID, and ERIPC_TYPE_STRING.

Referenced by cb_sys_get_card_mountpoint(), testing_list_menu_items_cb(), testing_list_tasks(), and testing_route_menu_item_cb().

00849 {
00850     eripc_error_t rc;
00851     rc = eripc_reply_varargs(context, message_id,
00852                              ERIPC_TYPE_STRING, string,
00853                              ERIPC_TYPE_INVALID);
00854     return rc;
00855 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_reply_varargs ( eripc_context_t context,
const char *  message_id,
eripc_data_t  arg_type,
  ... 
)

This function returns a reply to a message with variable arguments.

The variable arguments work in a type-value pairs. The type argument defines the type of the following value. If the type is G_TYPE_STRING, then the value is a pointer to a string. The list must end in a ERIPC_TYPE_INVALID. The supported types are:

  • ERIPC_TYPE_BOOL
    • The value is a gboolean.
  • ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT
    • The value is an byte, int or an unsigned int.
  • ERIPC_TYPE_DOUBLE
    • The value is a float.
  • ERIPC_TYPE_STRING
    • The value is a pointer to a string.
  • ERIPC_TYPE_DATA
    • Two values are expected: first an integer indicating length of the data block (e.g. array), second a pointer to the data block.
Parameters:
context IPC context returned by eripc_init.
message_id ID string of the received message to reply to.
arg_type The type of the first argument.
... The first argument value, and then a type-value list of other arguments. This list must end in a ERIPC_TYPE_INVALID type.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 832 of file rpc.c.

References _reply_helper().

Referenced by cb_sys_get_battery_state(), cb_sys_get_device_capabilities(), cb_sys_get_orientation(), cb_sys_get_pageturn_inverted(), cb_sys_get_stylus(), eripc_reply_bool(), eripc_reply_int(), eripc_reply_string(), ipc_send_reply_task_start(), and on_file_open().

00835 {
00836     va_list va_args;
00837     eripc_error_t rc;
00838 
00839     va_start(va_args, arg_type);
00840     rc = _reply_helper(context, message_id,
00841                             arg_type, va_args);
00842     va_end(va_args);
00843     return rc;
00844 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_send_bool ( eripc_context_t context,
eripc_handler_t reply_handler,
const void *  user_data,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
gboolean  value 
)

This function sends a boolean message and registers a reply handler.

Instead of the variable arguments of eripc_send_varargs, this function has single boolean as argument.

Parameters:
context IPC context returned by eripc_init.
reply_handler The handler function to call when a reply is returned. Set to NULL for no reply.
user_data Optional user data to pass to the handler when it is called.
bus_type The bus type (session or system bus).
destination Interface name to send message to.
message_name Name of the message/method to call.
value The argument value.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 727 of file rpc.c.

References eripc_send_varargs(), ERIPC_TYPE_BOOL, and ERIPC_TYPE_INVALID.

00734 {
00735     eripc_error_t rc;
00736     rc = eripc_send_varargs(context, reply_handler, user_data,
00737                             bus_type, destination, message_name,
00738                             ERIPC_TYPE_BOOL, value_to_send,
00739                             ERIPC_TYPE_INVALID);
00740     return rc;
00741 }

Here is the call graph for this function:

eripc_error_t eripc_send_bool_and_wait ( eripc_context_t context,
eripc_event_info_t **  reply,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
gboolean  value 
)

This function sends a boolean message and return reply immediately. This call is blocking.

Instead of the variable arguments of eripc_send_varargs_and_wait, this function has single boolean as argument.

Parameters:
[in] context IPC context returned by eripc_init.
[out] reply A pointer pointer to the event info structure where the return info goes. Set to NULL for no reply arguments. If the expected reply does not come within the RPC timeout value set with the eripc_set_timeout function. Caller must free the reply structure using eripc_event_info_free.
[in] bus_type The bus type (session or system bus).
[in] destination Interface name to send message to.
[in] message_name Name of the message/method to call.
[in] value The argument value.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 678 of file rpc.c.

References eripc_send_varargs_and_wait(), ERIPC_TYPE_BOOL, and ERIPC_TYPE_INVALID.

00686 {
00687     eripc_error_t rc;
00688     rc = eripc_send_varargs_and_wait(context, reply,
00689                                      bus_type, destination, message_name,
00690                                      ERIPC_TYPE_BOOL, value_to_send,
00691                                      ERIPC_TYPE_INVALID);
00692     return rc;
00693 }

Here is the call graph for this function:

eripc_error_t eripc_send_int ( eripc_context_t context,
eripc_handler_t reply_handler,
const void *  user_data,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
int  value 
)

This function sends an integer message and registers a reply handler.

Instead of the variable arguments of eripc_send_varargs, this function has single integer as argument.

Parameters:
context IPC context returned by eripc_init.
reply_handler The handler function to call when a reply is returned. Set to NULL for no reply.
user_data Optional user data to pass to the handler when it is called.
bus_type The bus type (session or system bus).
destination Interface name to send message to.
message_name Name of the message/method to call.
value The argument value.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 711 of file rpc.c.

References eripc_send_varargs(), ERIPC_TYPE_INT, and ERIPC_TYPE_INVALID.

Referenced by ipc_menu_remove_task(), ipc_menu_set_first_task(), ipc_send_task_activated(), ipc_send_window_activated(), ipc_send_window_deactivated(), and ipc_send_window_show().

00718 {
00719     eripc_error_t rc;
00720     rc = eripc_send_varargs(context, reply_handler, user_data,
00721                             bus_type, destination, message_name,
00722                             ERIPC_TYPE_INT, value_to_send,
00723                             ERIPC_TYPE_INVALID);
00724     return rc;
00725 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_send_int_and_wait ( eripc_context_t context,
eripc_event_info_t **  reply,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
int  value 
)

This function sends an integer message and return reply immediately. This call is blocking.

Instead of the variable arguments of eripc_send_varargs_and_wait, this function has single integer as argument.

Parameters:
[in] context IPC context returned by eripc_init.
[out] reply A pointer pointer to the event info structure where the return info goes. Set to NULL for no reply arguments. If the expected reply does not come within the RPC timeout value set with the eripc_set_timeout function. Caller must free the reply structure using eripc_event_info_free.
[in] bus_type The bus type (session or system bus).
[in] destination Interface name to send message to.
[in] message_name Name of the message/method to call.
[in] value The argument value.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 661 of file rpc.c.

References eripc_send_varargs_and_wait(), ERIPC_TYPE_INT, and ERIPC_TYPE_INVALID.

00669 {
00670     eripc_error_t rc;
00671     rc = eripc_send_varargs_and_wait(context, reply,
00672                                      bus_type, destination, message_name,
00673                                      ERIPC_TYPE_INT, value_to_send,
00674                                      ERIPC_TYPE_INVALID);
00675     return rc;
00676 }

Here is the call graph for this function:

eripc_error_t eripc_send_signal ( eripc_context_t context,
eripc_bus_t  bus_type,
const char *  signal_name,
const char *  argument 
)

This function sends a signal with optional string argument.

The signal defaults to the path and interface in the context. For more flexibility, use eripc_send_signal_varargs.

Parameters:
context IPC context returned by eripc_init.
bus_type The bus type (session or system bus).
signal_name Name of the signal to send.
argument The argument string or NULL for no argument.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 329 of file rpc.c.

References eripc_send_signal_varargs(), ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, _eripc_context_t::interface, and _eripc_context_t::object_path.

00333 {
00334     eripc_error_t rc;
00335     
00336     if (argument == NULL)
00337     {        
00338         rc = eripc_send_signal_varargs(context, bus_type, 
00339                                       context->object_path, context->interface, signal_name,
00340                                       ERIPC_TYPE_INVALID);
00341     }
00342     else 
00343     {
00344         rc = eripc_send_signal_varargs(context, bus_type, 
00345                                       context->object_path, context->interface, signal_name,
00346                                       ERIPC_TYPE_STRING, argument,
00347                                       ERIPC_TYPE_INVALID);
00348     }
00349     return rc;
00350 }

Here is the call graph for this function:

eripc_error_t eripc_send_signal_varargs ( eripc_context_t context,
eripc_bus_t  bus_type,
const char *  signal_path,
const char *  signal_interface,
const char *  signal_name,
eripc_data_t  arg_type,
  ... 
)

This function sends a signal with variable arguments.

The variable arguments work in a type-value pairs. The type argument defines the type of the following value. If the type is G_TYPE_STRING, then the value is a pointer to a string. The list must end in a ERIPC_TYPE_INVALID. The supported types are:

  • ERIPC_TYPE_BOOL
    • The value is a gboolean.
  • ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT
    • The value is an byte, int or an unsigned int.
  • ERIPC_TYPE_DOUBLE
    • The value is a float.
  • ERIPC_TYPE_STRING
    • The value is a pointer to a string.
  • ERIPC_TYPE_DATA
    • Two values are expected: first an integer indicating length of the data block (e.g. array), second a pointer to the data block.
Parameters:
context IPC context returned by eripc_init.
bus_type The bus type (session or system bus).
signal_path The object path of the signal to send.
signal_interface The interface name of the signal to send.
signal_name Name of the signal to send.
arg_type The type of the first argument.
... The first argument value, and then a type-value list of other arguments. This list must end in a ERIPC_TYPE_INVALID type.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 310 of file rpc.c.

References _send_signal_helper().

Referenced by eripc_send_signal(), ipc_broadcast_conn_signal(), ipc_broadcast_conn_status(), ipc_send_battery_state(), ipc_send_changed_locale(), ipc_send_changed_orientation(), ipc_send_changed_pageturn_inverted(), ipc_send_demo_mode(), ipc_send_prepare_standby(), ipc_send_prepare_unmount(), ipc_send_usb_state(), ipc_send_volume_mounted(), ipc_send_volume_unmounted(), and ipc_sys_startup_complete().

00316 {
00317     va_list va_args;
00318     eripc_error_t rc;
00319 
00320     va_start(va_args, arg_type);
00321     rc = _send_signal_helper(context, bus_type,
00322                              signal_path, signal_interface, signal_name,
00323                              arg_type, va_args);
00324     va_end(va_args);
00325     return rc;
00326 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_send_string ( eripc_context_t context,
eripc_handler_t reply_handler,
const void *  user_data,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
const char *  string 
)

This function sends a string message and registers a reply handler.

Instead of the variable arguments of eripc_send_varargs, this function has single string as argument.

Parameters:
context IPC context returned by eripc_init.
reply_handler The handler function to call when a reply is returned. Set to NULL for no reply.
user_data Optional user data to pass to the handler when it is called.
bus_type The bus type (session or system bus).
destination Interface name to send message to.
message_name Name of the message/method to call.
string The argument string.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 695 of file rpc.c.

References eripc_send_varargs(), ERIPC_TYPE_INVALID, and ERIPC_TYPE_STRING.

Referenced by ipc_confirm_install_drz(), ipc_confirm_install_update(), ipc_confirm_usbconnect(), ipc_ctb_goto(), ipc_send_close(), ipc_send_open(), ipc_send_volume_mounted_to(), ipc_show_message(), ipc_show_popup(), and ipc_show_splash().

00702 {
00703     eripc_error_t rc;
00704     rc = eripc_send_varargs(context, reply_handler, user_data,
00705                             bus_type, destination, message_name,
00706                             ERIPC_TYPE_STRING, string_to_send,
00707                             ERIPC_TYPE_INVALID);
00708     return rc;
00709 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_send_string_and_wait ( eripc_context_t context,
eripc_event_info_t **  reply,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
const char *  string 
)

This function sends a string message and return reply immediately. This call is blocking.

Instead of the variable arguments of eripc_send_varargs_and_wait, this function has single string as argument.

Parameters:
[in] context IPC context returned by eripc_init.
[out] reply A pointer pointer to the event info structure where the return info goes. Set to NULL for no reply arguments. If the expected reply does not come within the RPC timeout value set with the eripc_set_timeout function. Caller must free the reply structure using eripc_event_info_free.
[in] bus_type The bus type (session or system bus).
[in] destination Interface name to send message to.
[in] message_name Name of the message/method to call.
[in] string The argument string.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 644 of file rpc.c.

References eripc_send_varargs_and_wait(), ERIPC_TYPE_INVALID, and ERIPC_TYPE_STRING.

Referenced by ipc_send_store_metadata().

00652 {
00653     eripc_error_t rc;
00654     rc = eripc_send_varargs_and_wait(context, reply,
00655                                      bus_type, destination, message_name,
00656                                      ERIPC_TYPE_STRING, string_to_send,
00657                                      ERIPC_TYPE_INVALID);
00658     return rc;
00659 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_send_varargs ( eripc_context_t context,
eripc_handler_t reply_handler,
const void *  user_data,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
eripc_data_t  arg_type,
  ... 
)

This function sends a variable message and registers a reply handler.

The variable arguments work in a type-value pairs. The type argument defines the type of the following value. If the type is G_TYPE_STRING, then the value is a pointer to a string. The list must end in a ERIPC_TYPE_INVALID. The supported types are:

  • ERIPC_TYPE_BOOL
    • The value is a gboolean.
  • ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT
    • The value is an byte, int or an unsigned int.
  • ERIPC_TYPE_DOUBLE
    • The value is a float.
  • ERIPC_TYPE_STRING
    • The value is a pointer to a string.
  • ERIPC_TYPE_DATA
    • Two values are expected: first an integer indicating length of the data block (e.g. array), second a pointer to the data block.
Parameters:
context IPC context returned by eripc_init.
reply_handler The handler function to call when a reply is returned. Set to NULL for no reply.
user_data Optional user data to pass to the handler when it is called.
bus_type The bus type (session or system bus).
destination Interface name to send message to.
message_name Name of the message/method to call.
arg_type The type of the first argument.
... The first argument value, and then a type-value list of other arguments. This list must end in a ERIPC_TYPE_INVALID type.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 607 of file rpc.c.

References _send_helper().

Referenced by add_group(), add_item(), add_menu(), eripc_send_bool(), eripc_send_int(), eripc_send_string(), ipc_add_profile(), notepad::ipc_change_filename(), ipc_connect(), ipc_disconnect(), ipc_edit_profile(), ipc_menu_add_group(), ipc_menu_add_item(), ipc_menu_add_menu(), ipc_menu_add_task(), ipc_menu_rename_task(), ipc_menu_set_group_label(), ipc_menu_set_group_state(), ipc_menu_set_item_label(), ipc_menu_set_item_state(), ipc_menu_set_menu_label(), ipc_menu_show_menu(), notepad::ipc_menu_update_toolbar(), ipc_menu_updates_finished(), ipc_refresh_ctb(), ipc_remove_menu(), ipc_send_conn_status(), ipc_send_item_activated(), ipc_send_page_change(), ipc_send_ping(), ipc_send_status_item_activated(), ipc_set_orientation(), ipc_show_busy(), ipc_sys_standby(), main(), notepad::menu_show(), remove_group(), and remove_menu().

00614 {
00615     va_list va_args;
00616     eripc_error_t rc;
00617 
00618     va_start(va_args, arg_type);
00619     rc = _send_helper(context, reply_handler, user_data,
00620                       bus_type, destination, message_name,
00621                       arg_type, va_args);
00622     va_end(va_args);
00623     return rc;
00624 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_send_varargs_and_wait ( eripc_context_t context,
eripc_event_info_t **  reply,
eripc_bus_t  bus_type,
const char *  destination,
const char *  message_name,
eripc_data_t  arg_type,
  ... 
)

This function sends a variable message and return reply immediately. This call is blocking.

The variable arguments work in a type-value pairs. The type argument defines the type of the following value. If the type is G_TYPE_STRING, then the value is a pointer to a string. The list must end in a ERIPC_TYPE_INVALID. The supported types are:

  • ERIPC_TYPE_BOOL
    • The value is a gboolean.
  • ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT
    • The value is an byte, int or an unsigned int.
  • ERIPC_TYPE_DOUBLE
    • The value is a float.
  • ERIPC_TYPE_STRING
    • The value is a pointer to a string.
  • ERIPC_TYPE_DATA
    • Two values are expected: first an integer indicating length of the data block (e.g. array), second a pointer to the data block.
Parameters:
[in] context IPC context returned by eripc_init.
[out] reply A pointer pointer to the event info structure where the return info goes. Set to NULL for no reply arguments. If the expected reply does not come within the RPC timeout value set with the eripc_set_timeout function. Caller must free the reply structure using eripc_event_info_free.
[in] bus_type The bus type (session or system bus).
[in] destination Interface name to send message to.
[in] message_name Name of the message/method to call.
[in] arg_type The type of the first argument.
[in] ... The first argument value, and then a type-value list of other arguments. This list must end in a ERIPC_TYPE_INVALID type.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 627 of file rpc.c.

References _send_sync_helper().

Referenced by eripc_send_bool_and_wait(), eripc_send_int_and_wait(), eripc_send_string_and_wait(), hide_statusitem(), ipc_get_battery_state(), notepad::ipc_get_mountpoint(), ipc_get_orientation(), notepad::ipc_get_rotation(), notepad::ipc_sys_is_in_portrait_mode(), ipc_sys_is_in_portrait_mode(), notepad::ipc_sys_is_pageturn_inverted(), ipc_sys_is_pageturn_inverted(), ipc_sys_start_task(), is_in_portrait_orientation(), remove_group(), remove_item(), remove_menu(), set_group_state(), set_item_state(), set_popup_state(), set_statusitem_state(), show_menu(), and show_statusitem().

00633 {
00634     va_list va_args;
00635     eripc_error_t rc;
00636     
00637     va_start(va_args, arg_type);
00638     rc = _send_sync_helper(context, reply, bus_type, destination,
00639                            message_name, arg_type, va_args);
00640     va_end(va_args);
00641     return rc;   
00642 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_set_event_handler ( eripc_context_t context,
const eripc_event_info_t info,
eripc_handler_t handler,
void *  user_data,
int *  handler_id 
)

This function registers a custom handler for event, message, or signal.

Parameters:
context IPC context returned by eripc_init.
info Structure specifying the type of events to handle.
handler The handler function to call when the event happens.
user_data Optional user data to pass to the handler when it is called.
handler_id Return location for the handler ID, which is used to unregister the handler.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 463 of file hw.c.

References _set_handler(), eripc_event_info_t::bus_type, compose_match(), ERIPC_BUS_BOTH, ERIPC_BUS_IRRELEVANT, ERIPC_BUS_SESSION, ERIPC_BUS_SYSTEM, ERIPC_ERROR_INVALID, ERIPC_ERROR_OOM, ERIPC_ERROR_SUCCESS, eripc_event_info_t::event_type, generic_signal_handler(), eripc_event_info_t::interface, eripc_event_info_t::name, _eripc_context_t::next_handler_id, eripc_event_info_t::path, eripc_event_info_t::service, ULOG_DEBUG_F, and ULOG_ERR_F.

Referenced by eripc_set_message_handler(), and eripc_set_signal_handler().

00468 {
00469         eripc_error_t error = ERIPC_ERROR_SUCCESS;
00470         _osso_handler_f *event_cb = NULL;
00471         char *tmp_match = NULL, *match = NULL, *sys_match = NULL;
00472         int new_handler_id;
00473         eripc_error_t ret;
00474         eripc_bus_t bus_type;
00475 
00476         ULOG_DEBUG_F("entered");
00477 
00478         if (context == NULL || handler == NULL) {
00479                 ULOG_ERR_F("invalid arguments");
00480                 return ERIPC_ERROR_INVALID;
00481         }
00482 
00483         if (info == NULL) {
00484                 ULOG_ERR_F("info structure must be provided");
00485                 return ERIPC_ERROR_INVALID;
00486         }
00487 
00488         if (info->bus_type == ERIPC_BUS_IRRELEVANT) {
00489                 bus_type = ERIPC_BUS_BOTH;
00490         } else {
00491                 bus_type = info->bus_type;
00492         }
00493 
00494         new_handler_id = context->next_handler_id++;
00495 
00496         event_cb = generic_signal_handler;
00497 
00498         ret = compose_match(info, &tmp_match);
00499         ULOG_DEBUG_F("match='%s'", tmp_match);
00500         
00501         if (ret == ERIPC_ERROR_SUCCESS) {
00502                 if (bus_type == ERIPC_BUS_BOTH
00503                     || bus_type == ERIPC_BUS_SESSION) {
00504                         match = tmp_match;
00505                 }
00506                 if (bus_type == ERIPC_BUS_BOTH
00507                     || bus_type == ERIPC_BUS_SYSTEM) {
00508                         if (match == NULL) {
00509                                 sys_match = tmp_match;
00510                         } else {
00511                                 sys_match = strdup(tmp_match);
00512                                 if (sys_match == NULL) {
00513                                         ULOG_ERR_F("strdup failed");
00514                                         free(tmp_match);
00515                                         error = ERIPC_ERROR_OOM;
00516                                         goto _oom_exit;
00517                                 }
00518                         }
00519                 }
00520                 error = _set_handler(context,
00521                                      info->service,
00522                                      info->path,
00523                                      info->interface,
00524                                      info->name,
00525                                      match,
00526                                      sys_match,
00527                                      event_cb,
00528                                      info->event_type, // FIXME was 0, event_type ignored
00529                                      handler,
00530                                      user_data,
00531                                      new_handler_id,
00532                                      FALSE, bus_type);
00533         } else {
00534                 error = ret;
00535         }
00536 
00537 _oom_exit:
00538         if (handler_id != NULL) {
00539                 if (error == ERIPC_ERROR_SUCCESS) {
00540                         *handler_id = new_handler_id;
00541                 } else {
00542                         *handler_id = 0;
00543                 }
00544         }
00545         return error;
00546 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_set_message_handler ( eripc_context_t context,
eripc_handler_t handler,
void *  user_data,
eripc_bus_t  bus_type,
const char *  source,
const char *  message_name,
int *  handler_id 
)

This function registers a handler for a message.

Parameters:
context IPC context returned by eripc_init.
handler The handler function to call when the event happens.
user_data Optional user data to pass to the handler when it is called.
bus_type The bus type (session or system bus).
source Interface name of message to receive.
message_name Name of the message/method.
handler_id Return location for the handler ID, which is used to unregister the handler.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 436 of file hw.c.

References eripc_event_info_t::bus_type, ERIPC_ERROR_SUCCESS, ERIPC_EVENT_MESSAGE, eripc_set_event_handler(), eripc_event_info_t::event_type, fix_name(), eripc_event_info_t::interface, interface, and eripc_event_info_t::name.

Referenced by eripc_client_context_new(), install_activation_handler(), and ipc_set_services().

00443 {
00444     eripc_error_t error = ERIPC_ERROR_SUCCESS;
00445     eripc_event_info_t info;
00446     
00447     char *interface = fix_name(source);
00448     memset(&info, 0, sizeof(info));
00449     info.event_type = ERIPC_EVENT_MESSAGE;
00450     info.bus_type = bus_type;
00451     info.interface = interface;
00452     info.name = name;
00453     
00454     error = eripc_set_event_handler(context, &info, 
00455                                     handler, user_data, handler_id);
00456     
00457     free(interface);
00458     
00459     return error;
00460 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_set_signal_handler ( eripc_context_t context,
eripc_handler_t handler,
void *  user_data,
eripc_bus_t  bus_type,
const char *  source,
const char *  signal_name,
int *  handler_id 
)

This function registers a handler for a signal.

Parameters:
context IPC context returned by eripc_init.
handler The handler function to call when the event happens.
user_data Optional user data to pass to the handler when it is called.
bus_type The bus type (session or system bus).
source Interface name to receive signal/message from.
signal_name Name of the signal.
handler_id Return location for the handler ID, which is used to unregister the handler.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 409 of file hw.c.

References eripc_event_info_t::bus_type, ERIPC_ERROR_SUCCESS, ERIPC_EVENT_SIGNAL, eripc_set_event_handler(), eripc_event_info_t::event_type, fix_name(), eripc_event_info_t::interface, interface, and eripc_event_info_t::name.

Referenced by eripc_client_context_new(), and ipc_set_services().

00416 {
00417     eripc_error_t error = ERIPC_ERROR_SUCCESS;
00418     eripc_event_info_t info;
00419     
00420     char *interface = fix_name(source);
00421     memset(&info, 0, sizeof(info));
00422     info.event_type = ERIPC_EVENT_SIGNAL;
00423     info.bus_type = bus_type;
00424     info.interface = interface;
00425     info.name = name;
00426     
00427     error = eripc_set_event_handler(context, &info, 
00428                                     handler, user_data, handler_id);
00429     
00430     free(interface);
00431     
00432     return error;
00433 }

Here is the call graph for this function:

Here is the caller graph for this function:

eripc_error_t eripc_set_timeout ( eripc_context_t context,
int  timeout 
)

Sets the timeout value used by the RPC functions.

Parameters:
context IPC context returned by eripc_init.
timeout The new timeout value in milliseconds.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 169 of file rpc.c.

References ERIPC_ERROR_INVALID, ERIPC_ERROR_SUCCESS, and _eripc_context_t::timeout_ms.

Referenced by eripc_sysd_get_device_capabilities(), ipc_send_store_metadata(), ipc_set_services(), ipc_sys_start_task(), and main().

00170 {
00171     if(context == NULL) return ERIPC_ERROR_INVALID;
00172     context->timeout_ms = timeout;
00173     return ERIPC_ERROR_SUCCESS;
00174 }

Here is the caller graph for this function:

gboolean eripc_sysd_conn_connect ( eripc_client_context_t ccontext,
const char *  medium,
const char *  profile 
)

Request a network connection

Definition at line 669 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, MAKE_VARARG_CALL_3S, and eripc_client_context_t::service.

Referenced by ipc_sys_connect().

00672 {
00673     MAKE_VARARG_CALL_3S(DBUS_SERVICE_SYSTEM_CONTROL, "connConnect", 
00674                         ccontext->service, medium, profile);
00675 }

Here is the caller graph for this function:

gboolean eripc_sysd_conn_disconnect ( eripc_client_context_t ccontext  ) 

Release the network connection

Definition at line 677 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, MAKE_VARARG_CALL_1S, and eripc_client_context_t::service.

Referenced by ipc_sys_disconnect().

00678 {
00679     MAKE_VARARG_CALL_1S(DBUS_SERVICE_SYSTEM_CONTROL, "connDisconnect", ccontext->service);
00680 }

Here is the caller graph for this function:

gboolean eripc_sysd_conn_status_request ( eripc_client_context_t ccontext  ) 

Request the current network network status

Definition at line 682 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, MAKE_VARARG_CALL_1S, and eripc_client_context_t::name.

00683 {
00684     MAKE_VARARG_CALL_1S(DBUS_SERVICE_SYSTEM_CONTROL, "connConnectionStatusRequest", ccontext->name);
00685 }

gboolean eripc_sysd_get_device_capabilities ( eripc_client_context_t ccontext,
eripc_device_caps_t caps 
)

Return the device's capabilities

Definition at line 638 of file support.c.

References eripc_client_context_t::context, DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_ERROR_SUCCESS, eripc_get_timeout(), eripc_set_timeout(), ERIPC_TYPE_INVALID, eripc_device_caps_t::has_3g, eripc_device_caps_t::has_bluetooth, eripc_device_caps_t::has_stylus, eripc_device_caps_t::has_wifi, MAKE_VARARG_WAIT_CALL, and parse_reply_capabilities().

Referenced by get_device_capabilities(), ipc_get_device_capabilities(), and ipc_sys_get_device_capabilities().

00640 {
00641     int old_timeout;
00642     int timeout_set = 0;
00643     int retval = 0;
00644     eripc_error_t result;
00645 
00646     // set default reply
00647     caps->has_stylus    = FALSE;
00648     caps->has_wifi      = FALSE;
00649     caps->has_bluetooth = FALSE;
00650     caps->has_3g        = FALSE;
00651     
00652     result = eripc_get_timeout(ccontext->context, &old_timeout);
00653     if (result == ERIPC_ERROR_SUCCESS)
00654     {
00655         result = eripc_set_timeout(ccontext->context, 5*1000);
00656         timeout_set = (result == ERIPC_ERROR_SUCCESS);
00657     }
00658     
00659     MAKE_VARARG_WAIT_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "sysGetDeviceCapabilities",
00660                           parse_reply_capabilities(reply, caps),
00661                           ERIPC_TYPE_INVALID );
00662     
00663     if (timeout_set)
00664         eripc_set_timeout(ccontext->context, old_timeout);
00665     
00666     return retval;
00667 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean eripc_sysd_mount_sd_card ( eripc_client_context_t ccontext,
gboolean  show_index_splash 
)

Request an SD card mount

Definition at line 449 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_BOOL, ERIPC_TYPE_INVALID, and MAKE_VARARG_CALL.

Referenced by mount_sd_card().

00450 {
00451     MAKE_VARARG_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "sysCardMount",
00452                      ERIPC_TYPE_BOOL, show_index_splash, ERIPC_TYPE_INVALID );
00453 }

Here is the caller graph for this function:

gint eripc_sysd_open_url ( eripc_client_context_t ccontext,
const gchar *  url,
const gchar *  label,
const gchar *  back_text,
gchar **  err_message 
)

Request an url be opened

Definition at line 563 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, MAKE_BUSY_TIMEOUT_END, MAKE_BUSY_TIMEOUT_START, MAKE_VARARG_WAIT_CALL, and parse_reply_start().

Referenced by ipc_sys_open_url().

00568 {
00569     int old_timeout;
00570     int timeout_set = 0;
00571     int retval = 0;
00572     eripc_error_t result;
00573     
00574     MAKE_BUSY_TIMEOUT_START(60);
00575     MAKE_VARARG_WAIT_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "openUrl",
00576                           parse_reply_start(reply, err_message),
00577                           ERIPC_TYPE_STRING, url,
00578                           ERIPC_TYPE_STRING, label,
00579                           ERIPC_TYPE_STRING, back_text,
00580                           ERIPC_TYPE_INVALID );
00581     MAKE_BUSY_TIMEOUT_END();
00582     return retval;
00583 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean eripc_sysd_reset_bg_busy ( eripc_client_context_t ccontext  ) 

Reset background busy state

Definition at line 482 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_INVALID, and MAKE_VARARG_CALL.

Referenced by notepad::ipc_sys_bg_busy(), and ipc_sys_bg_busy().

00483 {
00484     MAKE_VARARG_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "sysResetBgBusy",
00485                      ERIPC_TYPE_INVALID );
00486 }

Here is the caller graph for this function:

gboolean eripc_sysd_reset_busy ( eripc_client_context_t ccontext  ) 

Reset busy state

Definition at line 470 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_INVALID, and MAKE_VARARG_CALL.

Referenced by notepad::ipc_sys_busy(), ipc_sys_busy(), ipc_sys_set_busy(), and ipc_sys_set_busy_nodialog().

00471 {
00472     MAKE_VARARG_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "sysResetBusy",
00473                      ERIPC_TYPE_INVALID );
00474 }

Here is the caller graph for this function:

gboolean eripc_sysd_set_bg_busy ( eripc_client_context_t ccontext  ) 

Set background busy state

Definition at line 476 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_INVALID, and MAKE_VARARG_CALL.

Referenced by notepad::ipc_sys_bg_busy(), and ipc_sys_bg_busy().

00477 {
00478     MAKE_VARARG_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "sysSetBgBusy",
00479                      ERIPC_TYPE_INVALID );
00480 }

Here is the caller graph for this function:

gboolean eripc_sysd_set_busy ( eripc_client_context_t ccontext,
const char *  state,
const char *  message 
)

Set busy state

Definition at line 463 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, and MAKE_VARARG_CALL_2S.

Referenced by notepad::ipc_sys_busy(), ipc_sys_busy(), ipc_sys_set_busy(), and ipc_sys_set_busy_nodialog().

00466 {
00467     MAKE_VARARG_CALL_2S(DBUS_SERVICE_SYSTEM_CONTROL, "sysSetBusy", state, message);
00468 }

Here is the caller graph for this function:

gboolean eripc_sysd_set_keyboard ( eripc_client_context_t ccontext,
const char *  state 
)

Set keyboard state

Definition at line 488 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, and MAKE_VARARG_CALL_1S.

00490 {
00491     MAKE_VARARG_CALL_1S(DBUS_SERVICE_SYSTEM_CONTROL, "sysSetKeyboard", state);
00492 }

gboolean eripc_sysd_set_menu_state ( eripc_client_context_t ccontext,
const char *  state 
)

Set the popupmenu's state

Definition at line 442 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, and MAKE_VARARG_CALL_1S.

Referenced by ipc_menu_block(), ipc_menu_popup(), ipc_menu_unblock(), ipc_send_request_popup(), and notepad::menu_block().

00444 {
00445     MAKE_VARARG_CALL_1S(DBUS_SERVICE_SYSTEM_CONTROL, "menuRequestPopup", state);
00446 }

Here is the caller graph for this function:

gint eripc_sysd_start_task ( eripc_client_context_t ccontext,
const gchar *  cmd_line,
const gchar *  work_dir,
const gchar *  label,
const gchar *  thumbnail_path,
gchar **  err_message 
)

Request a task be started

Definition at line 533 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, MAKE_BUSY_TIMEOUT_END, MAKE_BUSY_TIMEOUT_START, MAKE_VARARG_WAIT_CALL, and parse_reply_start().

Referenced by ipc_sys_start_task().

00539 {
00540     int old_timeout;
00541     int timeout_set = 0;
00542     int retval = 0;
00543     eripc_error_t result;
00544 
00545     MAKE_BUSY_TIMEOUT_START(60);
00546     MAKE_VARARG_WAIT_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "startTask",
00547                           parse_reply_start(reply, err_message),
00548                           ERIPC_TYPE_STRING, cmd_line,
00549                           ERIPC_TYPE_STRING, work_dir,
00550                           ERIPC_TYPE_STRING, label,
00551                           ERIPC_TYPE_STRING, thumbnail_path,
00552                           ERIPC_TYPE_INVALID );
00553     MAKE_BUSY_TIMEOUT_END();
00554     return retval;
00555 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean eripc_sysd_startup_complete ( eripc_client_context_t ccontext,
const int  pid,
const gboolean  is_multidoc,
const int  xid 
)

Signal the application has completed startup

Definition at line 494 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_BOOL, ERIPC_TYPE_INT, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, MAKE_SIGNAL_VARARG_CALL, eripc_client_context_t::name, and eripc_client_context_t::service.

Referenced by ipc_send_startup_complete(), and ipc_sys_startup_complete().

00498 {
00499     MAKE_SIGNAL_VARARG_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "startupComplete",
00500                             ERIPC_TYPE_STRING, ccontext->name,
00501                             ERIPC_TYPE_INT,    pid,
00502                             ERIPC_TYPE_BOOL,   is_multidoc,
00503                             ERIPC_TYPE_STRING, ccontext->service,
00504                             ERIPC_TYPE_INT,    xid,
00505                             ERIPC_TYPE_INVALID );
00506 }

Here is the caller graph for this function:

gboolean eripc_sysd_stop_task ( eripc_client_context_t ccontext,
const char *  cmd_line 
)

Request a task be stopped

Definition at line 557 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, and MAKE_VARARG_CALL_1S.

Referenced by ipc_sys_stop_task().

00559 {
00560     MAKE_VARARG_CALL_1S(DBUS_SERVICE_SYSTEM_CONTROL, "stopTask", cmd_line);
00561 }

Here is the caller graph for this function:

gboolean eripc_sysd_unmount_sd_card ( eripc_client_context_t ccontext  ) 

Request an SD card unmount

Definition at line 456 of file support.c.

References DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_TYPE_INVALID, and MAKE_VARARG_CALL.

Referenced by unmount_sd_card().

00457 {
00458     MAKE_VARARG_CALL(DBUS_SERVICE_SYSTEM_CONTROL, "sysCardUnmount",
00459                      ERIPC_TYPE_INVALID );
00460 }

Here is the caller graph for this function:

eripc_error_t eripc_unset_handler ( eripc_context_t context,
int  handler_id 
)

This function unregisters a handler for event, message, or signal.

Parameters:
context IPC context returned by eripc_init.
handler_id Handler to unregister. The handler will not be called after it has been successfully unregistered.
Returns:
ERIPC_ERROR_SUCCESS on success.

Definition at line 548 of file hw.c.

References ERIPC_ERROR_INVALID, ERIPC_ERROR_SUCCESS, ULOG_DEBUG_F, and ULOG_ERR_F.

Referenced by eripc_client_context_free(), ipc_unset_services(), and term_handler().

00550 {
00551         ULOG_DEBUG_F("entered");
00552 
00553         if (context == NULL || handler_id == 0) {
00554                 ULOG_ERR_F("invalid arguments");
00555                 return ERIPC_ERROR_INVALID;
00556         }
00557 
00558         if (_unset_handler((_eripc_context_t*)context, handler_id)) {
00559                 return ERIPC_ERROR_SUCCESS;
00560         } else {
00561                 /* id was not found */
00562                 return ERIPC_ERROR_INVALID;
00563         }
00564 }

Here is the caller graph for this function:

gboolean validate_appname ( const gchar *  application  ) 

Referenced by _validate().

Here is the caller graph for this function:


Variable Documentation

Definition at line 213 of file internal.h.

Definition at line 202 of file internal.h.

Definition at line 202 of file internal.h.

Referenced by ipc_set_services().

gboolean int handler_id

Definition at line 202 of file internal.h.

Referenced by _filter(), _send_helper(), ipc_set_services(), and ipc_unset_services().

void const char int char* id

Definition at line 217 of file internal.h.

Referenced by testDoc().

void char* interface
DBusHandlerResult DBusMessage* msg
void const char* name
void char* path
void const char char* ready_name

Definition at line 197 of file internal.h.

void const char * sender
void const char int serial

Definition at line 213 of file internal.h.

Referenced by _reply_helper(), eripc_reply_error(), get_ebook_mall_home(), and main().

void char* service
Generated by  doxygen 1.6.2-20100208