00001 #ifndef __IPC_H__ 00002 #define __IPC_H__ 00003 00004 /** 00005 * File Name : ipc.h 00006 * 00007 * Description: The dbus-based eripc functions 00008 */ 00009 00010 /* 00011 * This file is part of ctb. 00012 * 00013 * ctb is free software: you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation, either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * ctb is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 */ 00026 00027 /** 00028 * Copyright (C) 2008 iRex Technologies B.V. 00029 * All rights reserved. 00030 */ 00031 00032 00033 //---------------------------------------------------------------------------- 00034 // Include Files 00035 //---------------------------------------------------------------------------- 00036 00037 G_BEGIN_DECLS 00038 00039 00040 //---------------------------------------------------------------------------- 00041 // Definitions 00042 //---------------------------------------------------------------------------- 00043 00044 00045 //---------------------------------------------------------------------------- 00046 // Forward Declarations 00047 //---------------------------------------------------------------------------- 00048 00049 00050 //---------------------------------------------------------------------------- 00051 // Type Declarations 00052 //---------------------------------------------------------------------------- 00053 00054 typedef struct 00055 { 00056 gboolean has_stylus; 00057 gboolean has_wifi; 00058 gboolean has_bluetooth; 00059 gboolean has_3g; 00060 } device_caps_t; 00061 00062 00063 //---------------------------------------------------------------------------- 00064 // Global Constants 00065 //---------------------------------------------------------------------------- 00066 00067 00068 //============================================================================ 00069 // Public Functions 00070 //============================================================================ 00071 00072 /**--------------------------------------------------------------------------- 00073 * 00074 * Name : ipc_init 00075 * 00076 * @brief Setup IPC connection and register API functions 00077 * 00078 * @param Callback function for quit and changing locale 00079 * 00080 * @return -- 00081 * 00082 *--------------------------------------------------------------------------*/ 00083 typedef void (*quit_function)(); 00084 typedef void (*locale_function)(const char*); 00085 typedef void (*mount_cb_t)(const char* mountpoint); 00086 typedef void (*unmount_cb_t)(); 00087 00088 void ipc_init (quit_function quit_cb, 00089 locale_function set_locale_cb, 00090 mount_cb_t mount_cb, 00091 unmount_cb_t unmount_cb); 00092 00093 00094 /**--------------------------------------------------------------------------- 00095 * 00096 * Name : ipc_sys_startup_complete 00097 * 00098 * @brief Report "content browser started" to sysd 00099 * 00100 * @param -- 00101 * 00102 * @return -- 00103 * 00104 *--------------------------------------------------------------------------*/ 00105 void ipc_sys_startup_complete(); 00106 00107 00108 /**--------------------------------------------------------------------------- 00109 * 00110 * Name : ipc_sys_start_task 00111 * 00112 * @brief Send message startTask to system control, 00113 * usually to open a document in the relevant viewer application 00114 * 00115 * @param [in] cmd_line - command-line to launch the task (executable + options) 00116 * @param [in] work_dir - working directory in which to start this task 00117 * @param [in] label - text to show in popup menu 00118 * @param [in] thumbnail_path - the file containing the thumbnail to show in popup menu 00119 * @param [out] err_message - error message text from application 00120 * 00121 * @return error code (0 for success, >0 for failure) 00122 * 00123 *--------------------------------------------------------------------------*/ 00124 gint ipc_sys_start_task ( const gchar *cmd_line, 00125 const gchar *work_dir, 00126 const gchar *label, 00127 const gchar *thumbnail_path, 00128 gchar **err_message ); 00129 00130 00131 /**--------------------------------------------------------------------------- 00132 * 00133 * Name : ipc_sys_stop_task 00134 * 00135 * @brief Send message stopTask to system control, 00136 * usually to close a documen that has previously been open using ipc_sys_start_task() 00137 * 00138 * @param [in] cmd_line - command-line passed to ipc_sys_start_task() when launching the task 00139 * 00140 * @return TRUE on success, FALSE otherwise 00141 * 00142 *--------------------------------------------------------------------------*/ 00143 gboolean ipc_sys_stop_task ( const gchar *cmd_line ); 00144 00145 00146 /**--------------------------------------------------------------------------- 00147 * 00148 * Name : ipc_sys_open_url 00149 * 00150 * @brief Send message openURL to system control, 00151 * usually to open a web location in the browser application 00152 * 00153 * @param [in] url - url to open 00154 * @param [in] label - text to show in popup menu, or NULL 00155 * @param [in] back_text - text in Back bar, or NULL to omit this bar 00156 * @param [out] err_message - error message text from application 00157 * 00158 * @return error code (0 for success, >0 for failure) 00159 * 00160 *--------------------------------------------------------------------------*/ 00161 gint ipc_sys_open_url ( const gchar *url, 00162 const gchar *label, 00163 const gchar *back_text, 00164 gchar **err_message ); 00165 00166 00167 /**--------------------------------------------------------------------------- 00168 * 00169 * Name : ipc_sys_get_device_capabilities 00170 * 00171 * @brief Query system control for device capabilties 00172 * 00173 * @param -- 00174 * 00175 * @return current device capabilities 00176 * 00177 *--------------------------------------------------------------------------*/ 00178 const device_caps_t* ipc_sys_get_device_capabilities(); 00179 00180 00181 /**--------------------------------------------------------------------------- 00182 * 00183 * Name : ipc_menu_add_menu 00184 * 00185 * @brief Send message addMenu to popup menu 00186 * 00187 * @param [in] name - name (mnemonic) of the menu 00188 * @param [in] group1 .. group3 - name (mnemonic) of the menu groups 00189 * 00190 * @return TRUE on success, FALSE otherwise 00191 * 00192 *--------------------------------------------------------------------------*/ 00193 gboolean ipc_menu_add_menu ( const char *name, 00194 const char *group1, 00195 const char *group2, 00196 const char *group3 ); 00197 00198 00199 /**--------------------------------------------------------------------------- 00200 * 00201 * Name : ipc_menu_add_group 00202 * 00203 * @brief Send message addGroup to popup menu 00204 * 00205 * @param [in] name - name (mnemonic) of menu group 00206 * @param [in] parent - name (mnemonic) of the group this group belongs to, 00207 * or NULL when this group is at the highest level 00208 * @param [in] image - icon bitmap file 00209 * 00210 * @return TRUE on success, FALSE otherwise 00211 * 00212 *--------------------------------------------------------------------------*/ 00213 gboolean ipc_menu_add_group ( const char *name, 00214 const char *parent, 00215 const char *image ); 00216 00217 00218 /**--------------------------------------------------------------------------- 00219 * 00220 * Name : ipc_menu_add_item 00221 * 00222 * @brief Send message addGroup to popup menu 00223 * 00224 * @param [in] name - name (mnemonic) of menu item 00225 * @param [in] parent - name (mnemomic) of the menu group this item belongs to 00226 * @param [in] image - icon bitmap file 00227 * 00228 * @return TRUE on success, FALSE otherwise 00229 * 00230 *--------------------------------------------------------------------------*/ 00231 gboolean ipc_menu_add_item ( const char *name, 00232 const char *parent, 00233 const char *image ); 00234 00235 00236 /**--------------------------------------------------------------------------- 00237 * 00238 * Name : ipc_menu_set_menu_label 00239 * 00240 * @brief Send message setMenuLabel to popup menu 00241 * 00242 * @param [in] name - name (mnemonic) of the menu 00243 * @param [in] label - on-screen text at the top of the menu 00244 * 00245 * @return TRUE on success, FALSE otherwise 00246 * 00247 *--------------------------------------------------------------------------*/ 00248 gboolean ipc_menu_set_menu_label ( const char *name, 00249 const char *label ); 00250 00251 00252 /**--------------------------------------------------------------------------- 00253 * 00254 * Name : ipc_menu_set_group_label 00255 * 00256 * @brief Send message setGroupLabel to popup menu 00257 * 00258 * @param [in] name - name (mnemonic) of menu group 00259 * @param [in] label - on-screen text at the top of the menu group 00260 * 00261 * @return TRUE on success, FALSE otherwise 00262 * 00263 *--------------------------------------------------------------------------*/ 00264 gboolean ipc_menu_set_group_label ( const char *name, 00265 const char *label ); 00266 00267 00268 /**--------------------------------------------------------------------------- 00269 * 00270 * Name : ipc_menu_set_item_label 00271 * 00272 * @brief Send message setItemLabel to popup menu 00273 * 00274 * @param [in] name - name (mnemonic) of menu item 00275 * @param [in] parent - name (mnemomic) of the menu group this item belongs to 00276 * @param [in] label - on-screen text below icon 00277 * 00278 * @return TRUE on success, FALSE otherwise 00279 * 00280 *--------------------------------------------------------------------------*/ 00281 gboolean ipc_menu_set_item_label ( const char *name, 00282 const char *parent, 00283 const char *label ); 00284 00285 00286 /**--------------------------------------------------------------------------- 00287 * 00288 * Name : ipc_menu_show_menu 00289 * 00290 * @brief Send message showMenu to popup menu 00291 * 00292 * @param [in] name - name (mnemonic) of menu to be displayed 00293 * 00294 * @return TRUE on success, FALSE otherwise 00295 * 00296 *--------------------------------------------------------------------------*/ 00297 gboolean ipc_menu_show_menu ( const char *name ); 00298 00299 00300 /**--------------------------------------------------------------------------- 00301 * 00302 * Name : ipc_menu_set_group_state 00303 * 00304 * @brief Send message setItemState to popup menu 00305 * 00306 * @param [in] name - name (mnemonic) of menu group to be set 00307 * @param [in] state - new state ("normal", "disabled") 00308 * 00309 * @return TRUE on success, FALSE otherwise 00310 * 00311 *--------------------------------------------------------------------------*/ 00312 gboolean ipc_menu_set_group_state ( const char *name, 00313 const char *state ); 00314 00315 00316 /**--------------------------------------------------------------------------- 00317 * 00318 * Name : ipc_menu_set_item_state 00319 * 00320 * @brief Send message setItemState to popup menu 00321 * 00322 * @param [in] name - name (mnemonic) of menu item to be set 00323 * @param [in] parent - name (mnemomic) of the menu group this item belongs to 00324 * @param [in] state - new state ("normal", "selected", "disabled") 00325 * 00326 * @return TRUE on success, FALSE otherwise 00327 * 00328 *--------------------------------------------------------------------------*/ 00329 gboolean ipc_menu_set_item_state ( const char *name, 00330 const char *parent, 00331 const char *state ); 00332 00333 00334 gboolean ipc_menu_block(); 00335 gboolean ipc_menu_unblock(); 00336 00337 void ipc_menu_updates_finished(); 00338 00339 00340 void ipc_menu_set_pagecounter(int cur_page, int num_pages, gboolean boundary_check); 00341 00342 00343 /**--------------------------------------------------------------------------- 00344 * 00345 * Name : ipc_sys_busy 00346 * 00347 * @brief Send message sysSetBusy to system daemon 00348 * 00349 * @param [in] look_busy - TRUE to show, FALSE to remove the busy indication 00350 * 00351 * @return TRUE on success, FALSE otherwise 00352 * 00353 *--------------------------------------------------------------------------*/ 00354 gboolean ipc_sys_busy( gboolean look_busy ); 00355 00356 00357 /**--------------------------------------------------------------------------- 00358 * 00359 * Name : ipc_status_set_stylus 00360 * 00361 * @brief Send message setStatusItemState(statusbar_stylus) to popup menu 00362 * 00363 * @param [in] state - state string, e.g. 'pointer' 00364 * 00365 * @return TRUE on success, FALSE otherwise 00366 * 00367 *--------------------------------------------------------------------------*/ 00368 gboolean ipc_status_set_stylus( const char *state ); 00369 00370 gboolean ipc_sys_is_in_portrait_mode(); 00371 00372 00373 /**--------------------------------------------------------------------------- 00374 * 00375 * Name : ipc_get_media 00376 * 00377 * @brief Get currently mounted storage media 00378 * 00379 * @return gchar* of mount point of storage media or NULL if not mounted 00380 * 00381 *--------------------------------------------------------------------------*/ 00382 const gchar* ipc_get_media(); 00383 00384 00385 /**--------------------------------------------------------------------------- 00386 * 00387 * Name : storage_media_mounted 00388 * 00389 * @brief Report that a storage media has been mounted 00390 * 00391 * @param [in] mountpoint - location where this media has been mounted 00392 * 00393 *--------------------------------------------------------------------------*/ 00394 void storage_media_mounted ( const gchar *mountpoint ); 00395 00396 G_END_DECLS 00397 00398 #endif 00399