popupmenu/include/ipc.h

Go to the documentation of this file.
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 popupmenu.
00012  *
00013  * popupmenu 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  * popupmenu 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 #include <liberipc/eripc.h>
00038 
00039 
00040 G_BEGIN_DECLS
00041 
00042 
00043 //----------------------------------------------------------------------------
00044 // Definitions
00045 //---------------------------------------------------------------------------- 
00046 
00047 #define DBUS_APPL_NAME                  PACKAGE_NAME
00048 #define DBUS_SERVICE                    "com.irexnet."  DBUS_APPL_NAME
00049 #define DBUS_PATH                       "/com/irexnet/" DBUS_APPL_NAME
00050 #define DBUS_INTERFACE                  "com.irexnet."  DBUS_APPL_NAME
00051 
00052 #define DBUS_SERVICE_SYSTEM_CONTROL     "com.irexnet.sysd"
00053 #define DBUS_SERVICE_CTB                "com.irexnet.ctb"
00054 
00055 
00056 //----------------------------------------------------------------------------
00057 // Forward Declarations
00058 //----------------------------------------------------------------------------
00059 
00060 //----------------------------------------------------------------------------
00061 // Type Declarations
00062 //----------------------------------------------------------------------------
00063 
00064 //----------------------------------------------------------------------------
00065 // Global Constants
00066 //----------------------------------------------------------------------------
00067 
00068 
00069 //============================================================================
00070 // Public Functions
00071 //============================================================================
00072 
00073 /**---------------------------------------------------------------------------
00074  *
00075  * Name :  ipc_set_services
00076  *
00077  * @brief  Setup IPC connection and register API functions
00078  *
00079  * @param  --
00080  *
00081  * @return --
00082  *
00083  *--------------------------------------------------------------------------*/
00084 void ipc_set_services(void);
00085 
00086 /**---------------------------------------------------------------------------
00087  *
00088  * Name :  ipc_unset_services
00089  *
00090  * @brief  Unregister API functions
00091  *
00092  * @param  --
00093  *
00094  * @return --
00095  *
00096  *--------------------------------------------------------------------------*/
00097 void ipc_unset_services(void);
00098 
00099 void ipc_send_task_activated(int xid);
00100 
00101 /**---------------------------------------------------------------------------
00102  *
00103  * Name :  ipc_send_item_activated
00104  *
00105  * @brief  Send menuItemActivated to service
00106  *
00107  * @param  iname   Item name
00108  * @param  pname   Parent group name
00109  * @param  mname   Current menu name
00110  * @param  state   Current state of the menu item
00111  * @param  service IPC service name
00112  *
00113  * @return --
00114  *
00115  *--------------------------------------------------------------------------*/
00116 void ipc_send_item_activated(const char *iname, const char *pname, const char *mname, const char *state, const char *service);
00117 
00118 /**---------------------------------------------------------------------------
00119  *
00120  * Name :  ipc_send_status_item_activated
00121  *
00122  * @brief  Send statusItemActivated to service
00123  *
00124  * @param  iname   Status item name
00125  * @param  state   Current state of the menu item
00126  * @param  service IPC service name
00127  *
00128  * @return --
00129  *
00130  *--------------------------------------------------------------------------*/
00131 void ipc_send_status_item_activated(const char *iname, const char *state, const char *service);
00132 
00133 /**---------------------------------------------------------------------------
00134  *
00135  * Name :  ipc_send_startup_complete
00136  *
00137  * @brief  Send startupComplete
00138  *
00139  * @param  --
00140  *
00141  * @return --
00142  *
00143  *--------------------------------------------------------------------------*/
00144 void ipc_send_startup_complete(void);
00145 
00146 /**---------------------------------------------------------------------------
00147  *
00148  * Name :  ipc_sys_start_task
00149  *
00150  * @brief  Send message startTask to system control,
00151  *         usually to open a document in the relevant viewer application
00152  *
00153  * @param  [in] cmd_line - command-line to launch the task (executable + options)
00154  * @param  [in] work_dir - working directory in which to start this task
00155  * @param  [in] label - text to show in popup menu
00156  * @param  [in] thumbnail_path - the file containing the thumbnail to show in popup menu
00157  *
00158  * @return TRUE on success, FALSE otherwise
00159  *
00160  *--------------------------------------------------------------------------*/
00161 gboolean ipc_sys_start_task ( const gchar  *cmd_line,
00162                               const gchar  *work_dir,
00163                               const gchar  *label,
00164                               const gchar  *thumbnail_path );
00165 
00166 /**---------------------------------------------------------------------------
00167  *
00168  * Name :  ipc_get_battery_state
00169  *
00170  * @brief  Get current battery state and level and update statusbar icon 
00171  *
00172  * @param  [out] level    Current battery level
00173  * @param  [out] state    Current charging state, string must be freed
00174  * @param  [out] timeleft Minutes to empty (discharing) of -1 (charging)
00175  *
00176  * @return TRUE on success, FALSE otherwise
00177  *
00178  *--------------------------------------------------------------------------*/
00179 gboolean ipc_get_battery_state(gint *level, gchar **state, gint *timeleft);
00180 
00181 void ipc_send_page_change(const gchar* dir);
00182 
00183 void ipc_send_reply(eripc_context_t *context, const char *message_id, gboolean result);
00184 gboolean ipc_get_device_capabilities(gboolean *has_stylus, gboolean *has_wifi, gboolean *has_bluetooth, gboolean *has_3g);
00185 void ipc_send_request_popup(const char *state);
00186 
00187 void ipc_set_enabled(gboolean enabled);
00188 gboolean ipc_is_enabled(void);
00189 gchar *ipc_get_orientation(void);
00190 void ipc_set_orientation(const gchar *orientation);
00191 void ipc_sys_standby(void);
00192 
00193 
00194 G_END_DECLS
00195 
00196 #endif /* __IPC_H__ */
Generated by  doxygen 1.6.2-20100208