00001 #ifndef __IPC_H 00002 #define __IPC_H 00003 00004 /** 00005 * File Name : ipc.h 00006 * 00007 * Description: Internationalization and localization 00008 */ 00009 00010 /* 00011 * This file is part of settings. 00012 * 00013 * settings 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 * settings 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 // Public Functions 00035 //============================================================================ 00036 00037 /**--------------------------------------------------------------------------- 00038 * 00039 * Name : ipc_set_services 00040 * 00041 * @brief Setup IPC connection and register API functions 00042 * 00043 * @param -- 00044 * 00045 * @return -- 00046 * 00047 *--------------------------------------------------------------------------*/ 00048 gboolean ipc_set_services ( void ); 00049 00050 /**--------------------------------------------------------------------------- 00051 * 00052 * Name : ipc_unset_services 00053 * 00054 * @brief Unregister API functions 00055 * 00056 * @param -- 00057 * 00058 * @return -- 00059 * 00060 *--------------------------------------------------------------------------*/ 00061 void ipc_unset_services ( void ); 00062 00063 /**--------------------------------------------------------------------------- 00064 * 00065 * Name : ipc_sys_startup_complete 00066 * 00067 * @brief Report "settings started" to sysd 00068 * 00069 * @param [in] xid Xwindows id of main window 00070 * 00071 * @return -- 00072 * 00073 *--------------------------------------------------------------------------*/ 00074 void ipc_sys_startup_complete ( int xid); 00075 00076 /**--------------------------------------------------------------------------- 00077 * 00078 * Name : ipc_menu_show_menu 00079 * 00080 * @brief Set menu context 00081 * 00082 * @param name [Input] Menu name. 00083 * 00084 * @return -- 00085 * 00086 *--------------------------------------------------------------------------*/ 00087 gboolean ipc_menu_show_menu( const char *name ); 00088 00089 /**--------------------------------------------------------------------------- 00090 * 00091 * Name : ipc_remove_menu 00092 * 00093 * @brief Remove menu from popup menu. 00094 * 00095 * @param name [Input] Menu name. 00096 * 00097 * @return -- 00098 * 00099 *--------------------------------------------------------------------------*/ 00100 gboolean ipc_remove_menu( const char *name ); 00101 00102 /**--------------------------------------------------------------------------- 00103 * 00104 * Name : menu_init 00105 * 00106 * @brief Initialise popup menus for settings application. 00107 * 00108 * @param -- 00109 * 00110 * @return -- 00111 * 00112 *--------------------------------------------------------------------------*/ 00113 void menu_init(void); 00114 00115 /**--------------------------------------------------------------------------- 00116 * 00117 * Name : ipc_menu_popup 00118 * 00119 * @brief Request popup menu state 00120 * 00121 * @param state [Input] State ("show", "hide", "toggle", "block", "unblock") 00122 * 00123 * @return FALSE if failed to set menu 00124 * 00125 *--------------------------------------------------------------------------*/ 00126 gboolean ipc_menu_popup(const char* state); 00127 00128 /**--------------------------------------------------------------------------- 00129 * 00130 * Name : ipc_menu_enable 00131 * 00132 * @brief Enable items in popup menu 00133 * 00134 * @param -- 00135 * 00136 * @return -- 00137 * 00138 *--------------------------------------------------------------------------*/ 00139 void ipc_menu_enable(); 00140 00141 /**--------------------------------------------------------------------------- 00142 * 00143 * Name : ipc_menu_disable 00144 * 00145 * @brief Disable items in popup menu 00146 * 00147 * @param -- 00148 * 00149 * @return -- 00150 * 00151 *--------------------------------------------------------------------------*/ 00152 void ipc_menu_disable(); 00153 00154 00155 /**--------------------------------------------------------------------------- 00156 * 00157 * Name : ipc_sys_busy 00158 * 00159 * @brief Send message sysSetBusy to system daemon 00160 * 00161 * @param [in] look_busy - TRUE to show, FALSE to remove the busy indication 00162 * 00163 * @return TRUE on success, FALSE otherwise 00164 * 00165 *--------------------------------------------------------------------------*/ 00166 gboolean ipc_sys_busy( gboolean look_busy ); 00167 00168 00169 /**--------------------------------------------------------------------------- 00170 * 00171 * Name : ipc_set_stylus 00172 * 00173 * @brief Request popup menu state 00174 * 00175 * @param state [Input] State ("enable", "disable", "suspend", "resume", 00176 * "high", "normal") 00177 * 00178 * @return FALSE if failed to set stylus state 00179 * 00180 *--------------------------------------------------------------------------*/ 00181 gboolean ipc_set_stylus(const char* state); 00182 00183 00184 /**--------------------------------------------------------------------------- 00185 * 00186 * Name : get_device_capabilities 00187 * 00188 * @brief Get device capabilities from sysd. 00189 * 00190 * @param has_stylus [Output] Store result of hasing stylus. 00191 * has_wifi [Output] Store result of hasing wifi. 00192 * has_bluetooth [Output] Store result of hasing bluetooth. 00193 * has_3g [Output] Store result of hasing 3g. 00194 * 00195 * @return FALSE if failed to get device capabilities. 00196 * 00197 *--------------------------------------------------------------------------*/ 00198 gboolean get_device_capabilities(gboolean* has_stylus, 00199 gboolean* has_wifi, 00200 gboolean* has_bluetooth, 00201 gboolean* has_3g); 00202 00203 /**--------------------------------------------------------------------------- 00204 * 00205 * Name : mount_sd_card 00206 * 00207 * @brief Mount sd card via sysd. 00208 * 00209 * @param -- 00210 * 00211 * @return -- 00212 * 00213 *--------------------------------------------------------------------------*/ 00214 void mount_sd_card(void); 00215 00216 /**--------------------------------------------------------------------------- 00217 * 00218 * Name : unmount_sd_card 00219 * 00220 * @brief Unmount sd card via sysd. 00221 * 00222 * @param -- 00223 * 00224 * @return -- 00225 * 00226 *--------------------------------------------------------------------------*/ 00227 void unmount_sd_card(void); 00228 00229 /**--------------------------------------------------------------------------- 00230 * 00231 * Name : ipc_sys_open_url 00232 * 00233 * @brief Send message openURL to system control, 00234 * usually to open a web location in the browser application 00235 * 00236 * @param [in] url - url to open 00237 * @param [in] label - text to show in popup menu, or NULL 00238 * @param [in] back_text - text in Back bar, or NULL to omit this bar 00239 * @param [out] err_message - error message text from application 00240 * 00241 * @return error code (0 for success, >0 for failure) 00242 * 00243 *--------------------------------------------------------------------------*/ 00244 gint ipc_sys_open_url ( const gchar *url, 00245 const gchar *label, 00246 const gchar *back_text, 00247 gchar **err_message ); 00248 00249 00250 /**--------------------------------------------------------------------------- 00251 * 00252 * Name : ipc_sys_start_task 00253 * 00254 * @brief Send message startTask to system control, 00255 * usually to open a document in the relevant viewer application 00256 * 00257 * @param [in] cmd_line - command-line to launch the task (executable + options) 00258 * @param [in] work_dir - working directory in which to start this task 00259 * @param [in] label - text to show in popup menu 00260 * @param [in] thumbnail_path - the file containing the thumbnail to show in popup menu 00261 * @param [out] err_message - error message text from application 00262 * 00263 * @return error code (0 for success, >0 for failure) 00264 * 00265 *--------------------------------------------------------------------------*/ 00266 gint ipc_sys_start_task ( const gchar *cmd_line, 00267 const gchar *work_dir, 00268 const gchar *label, 00269 const gchar *thumbnail_path, 00270 gchar **err_message ); 00271 00272 /**--------------------------------------------------------------------------- 00273 * 00274 * Name : ipc_sys_stop_task 00275 * 00276 * @brief Send message stopTask to system control, 00277 * usually to close a documen that has previously been open using ipc_sys_start_task() 00278 * 00279 * @param [in] cmd_line - command-line passed to ipc_sys_start_task() when launching the task 00280 * 00281 * @return TRUE on success, FALSE otherwise 00282 * 00283 *--------------------------------------------------------------------------*/ 00284 gboolean ipc_sys_stop_task ( const gchar *cmd_line ); 00285 00286 gboolean ipc_menu_block( void ); 00287 gboolean ipc_menu_unblock( void ); 00288 00289 gboolean ipc_sys_is_in_portrait_mode(void); 00290 gboolean ipc_get_battery_state(gint *level, gchar **state, gint *timeleft); 00291 00292 #endif // __IPC_H