#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <liberipc/eripc.h>
#include <liberipc/eripc_support.h>
#include <liberutils/er_error.h>
#include "ctb_log.h"
#include "index_ipc.h"
#include "index.h"
Go to the source code of this file.
Defines | |
#define | DBUS_APPL_NAME "index" |
#define | DBUS_SERVICE "com.irexnet." DBUS_APPL_NAME |
#define | DBUS_PATH "/com/irexnet/" DBUS_APPL_NAME |
#define | DBUS_INTERFACE "com.irexnet." DBUS_APPL_NAME |
#define | DBUS_SERVICE_UDS "com.irexnet.uds" |
#define | DBUS_STORE_METADATA_TIMEOUT 25000 |
Functions | |
static void | on_storemetadata_ready (eripc_context_t *context, const eripc_event_info_t *info, void *user_data) |
void | ipc_set_services () |
Setup IPC connection and register API functions. | |
void | ipc_unset_services (void) |
Unregister API functions. | |
gboolean | ipc_send_store_metadata (const char *dir, const char *document) |
Send message to store metadata to UDS. | |
Variables | |
static eripc_client_context_t * | eripcClient = NULL |
static eripc_callback_function_t | service_functions [] |
#define DBUS_APPL_NAME "index" |
Copyright (C) 2009 iRex Technologies B.V. All rights reserved.
Definition at line 56 of file index_ipc.c.
Referenced by ipc_init(), notepad::ipc_set_services(), ipc_set_services(), ipc_sys_startup_complete(), and main().
#define DBUS_INTERFACE "com.irexnet." DBUS_APPL_NAME |
Definition at line 59 of file index_ipc.c.
Referenced by ipc_broadcast_conn_signal(), ipc_broadcast_conn_status(), ipc_init(), ipc_menu_add_task(), 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(), notepad::ipc_set_services(), ipc_set_services(), and main().
#define DBUS_PATH "/com/irexnet/" DBUS_APPL_NAME |
Definition at line 58 of file index_ipc.c.
Referenced by ipc_broadcast_conn_signal(), ipc_broadcast_conn_status(), ipc_init(), 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(), notepad::ipc_set_services(), ipc_set_services(), ipc_sys_startup_complete(), and main().
#define DBUS_SERVICE "com.irexnet." DBUS_APPL_NAME |
Definition at line 57 of file index_ipc.c.
Referenced by add_group(), add_item(), add_menu(), hide_statusitem(), ipc_init(), ipc_menu_add_menu(), notepad::ipc_set_services(), ipc_set_services(), ipc_sys_startup_complete(), main(), remove_group(), remove_item(), remove_menu(), set_group_state(), set_item_state(), set_popup_state(), set_statusitem_state(), show_menu(), and show_statusitem().
#define DBUS_SERVICE_UDS "com.irexnet.uds" |
Definition at line 60 of file index_ipc.c.
Referenced by ipc_send_store_metadata().
#define DBUS_STORE_METADATA_TIMEOUT 25000 |
Definition at line 62 of file index_ipc.c.
Referenced by ipc_send_store_metadata().
gboolean ipc_send_store_metadata | ( | const char * | dir, | |
const char * | document | |||
) |
Send message to store metadata to UDS.
---------------------------------------------------------------------------
Name : ipc_send_store_metadata
[in] | document | String of document to open |
--------------------------------------------------------------------------
Definition at line 117 of file index_ipc.c.
References eripc_client_context_t::context, DBUS_SERVICE_UDS, DBUS_STORE_METADATA_TIMEOUT, ERIPC_BUS_SESSION, eripc_error_string(), ERIPC_ERROR_SUCCESS, eripc_send_string_and_wait(), eripc_set_timeout(), ERRORPRINTF, and LOGPRINTF.
Referenced by send_store_metadata().
00118 { 00119 LOGPRINTF("entry"); 00120 00121 char* fullpath = (char *)calloc(strlen(dir) + strlen(document) + 2, sizeof(char)); 00122 strcat(fullpath, dir); 00123 strcat(fullpath, "/"); 00124 strcat(fullpath, document); 00125 00126 eripc_error_t retval; 00127 00128 g_return_val_if_fail(document != NULL, FALSE); 00129 00130 int status = (int)eripc_set_timeout(eripcClient->context, DBUS_STORE_METADATA_TIMEOUT); 00131 if (status != 0) 00132 { 00133 ERRORPRINTF("Could not set timeout, status = [%d]", status); 00134 } 00135 00136 retval = eripc_send_string_and_wait(eripcClient->context, 00137 NULL, 00138 ERIPC_BUS_SESSION, 00139 DBUS_SERVICE_UDS, 00140 "storeMetadata", 00141 fullpath); 00142 00143 // Fullpath can be freed here because send_string_and_wait only returns 00144 // after executing (and it makes a copy of it anyway) [MDB] 00145 free(fullpath); 00146 00147 if (retval != ERIPC_ERROR_SUCCESS) 00148 { 00149 ERRORPRINTF("Error launching eripc handler: %s", eripc_error_string(retval)); 00150 return FALSE; 00151 } 00152 00153 return TRUE; 00154 }
void ipc_set_services | ( | ) |
Setup IPC connection and register API functions.
File Name : index_ipc.h
Description: The dbus-based eripc functions Copyright (C) 2009 IREX Technologies B.V. All rights reserved.---------------------------------------------------------------------------
Name : ipc_set_services
None |
--------------------------------------------------------------------------
Definition at line 95 of file index_ipc.c.
00096 { 00097 eripcClient = eripc_client_context_new( 00098 DBUS_APPL_NAME, 00099 "1.0", 00100 DBUS_SERVICE, 00101 DBUS_PATH, 00102 DBUS_INTERFACE, 00103 service_functions); 00104 }
void ipc_unset_services | ( | void | ) |
Unregister API functions.
---------------------------------------------------------------------------
Name : ipc_unset_services
-- |
--------------------------------------------------------------------------
Definition at line 108 of file index_ipc.c.
00109 { 00110 eripc_client_context_free(eripcClient, service_functions); 00111 }
static void on_storemetadata_ready | ( | eripc_context_t * | context, | |
const eripc_event_info_t * | info, | |||
void * | user_data | |||
) | [static] |
Definition at line 165 of file index_ipc.c.
References LOGPRINTF, and store_metadata_ready().
00168 { 00169 LOGPRINTF("entry"); 00170 00171 store_metadata_ready(); 00172 }
eripc_client_context_t* eripcClient = NULL [static] |
Definition at line 68 of file index_ipc.c.
Referenced by hal_set_services().
eripc_callback_function_t service_functions[] [static] |
{ { on_storemetadata_ready, "storeMetadataReady", NULL, 0}, { NULL, NULL, NULL ,0 } }
Definition at line 79 of file index_ipc.c.