#include <stdio.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <liberipc/eripc.h>
#include <liberipc/eripcviewer.h>
#include <liberipc/eripctoolbar.h>
#include <liberipc/eripcbusyd.h>
#include <liberipc/eripccontentlister.h>
#include <libermanifest/ermanifest.h>
#include "contentListerLog.h"
#include "erbusy.h"
#include "displayUpdate.h"
#include "stack.h"
#include "viewer.h"
#include "history.h"
#include "erConnect.h"
#include "system.h"
#include "gtkPincodeScreen.h"
#include "control.h"
#include "programManager.h"
#include "erMSDisk.h"
#include "regValue.h"
#include "toolbar.h"
#include "button.h"
#include "click.h"
Go to the source code of this file.
Functions | |
static int | viewerGetChannel (char *viewer) |
void | viewerMessageReceived (gpointer data, gint source_fd, GdkInputCondition condition) |
gboolean | viewerInit (char *viewer) |
gboolean | viewerStore (char *viewer, st_ContentType_e contentType) |
gboolean | viewerInstallIpcServer () |
Variables | |
static erClientChannel_t | theBrowserChannel |
static erServerChannel_t | theServerChannel |
<File description>="">
Definition in file viewer.c.
static int viewerGetChannel | ( | char * | viewer | ) | [static] |
retrieve the channel ID of the specified viewer
viewer | unique identifier |
Definition at line 314 of file viewer.c.
00315 { 00316 int channel = -1; 00317 00318 CL_IPCPRINTF("entry %s", viewer); 00319 00320 if (strncmp(BROWSER_APP, viewer, UAID_MAX_SIZE) == 0) 00321 { 00322 channel = ER_XHTML_VIEWER_CHANNEL; 00323 } 00324 else 00325 { 00326 CL_WARNPRINTF("%s unkown viewer", viewer); 00327 } 00328 return channel; 00329 }
gboolean viewerInit | ( | char * | viewer | ) |
Init the communication channel with the viewer
viewer | unique identifier |
Definition at line 71 of file viewer.c.
00072 { 00073 int channel; 00074 00075 channel = viewerGetChannel(viewer); 00076 00077 if (channel > 0) 00078 { 00079 // create/init the channel to communicate with the userApplication 00080 if (erIpcStartClient(channel, &theBrowserChannel) == 0) 00081 { 00082 CL_IPCPRINTF("channel %d opened", channel); 00083 return TRUE; 00084 } 00085 } 00086 return FALSE; 00087 }
gboolean viewerInstallIpcServer | ( | ) |
Start listening to viewer IPC requests
Definition at line 111 of file viewer.c.
00112 { 00113 int returnValue; 00114 int fd = -1; 00115 00116 CL_IPCPRINTF("entry"); 00117 00118 returnValue = erIpcOpenServerChannel(ER_CONTENTLISTER_CHANNEL, &theServerChannel); 00119 00120 if (returnValue != (-1)) 00121 { 00122 fd = erIpcGetServerFd(theServerChannel); 00123 00124 CL_IPCPRINTF("erIpcGetServerFd returned %d\n", fd); 00125 00126 // gtk specific mechanism to monitor input file descriptor. 00127 returnValue = gdk_input_add(fd, GDK_INPUT_READ, viewerMessageReceived, (gpointer) theServerChannel); 00128 00129 CL_IPCPRINTF("gdk_input_add returned %d", returnValue); 00130 return TRUE; 00131 } 00132 else 00133 { 00134 CL_ERRORPRINTF("Could not open server channel"); 00135 return FALSE; 00136 } 00137 }
void viewerMessageReceived | ( | gpointer | data, | |
gint | source_fd, | |||
GdkInputCondition | condition | |||
) |
Definition at line 143 of file viewer.c.
00144 { 00145 char szBuffer[SERVER_BUFFER_SIZE]; 00146 int nBuf = SERVER_BUFFER_SIZE; 00147 erIpcCmd_t command; 00148 int index; 00149 st_ContentType_e contentType; 00150 char *location; 00151 char *item; 00152 eCcBusyState status; 00153 00154 CL_IPCPRINTF("entry"); 00155 erIpcGetMessage((erServerChannel_t) data, szBuffer, &nBuf); 00156 00157 CL_IPCPRINTF("Received [%s]", szBuffer); 00158 00159 if (clParseCommand(szBuffer, &command) >= 0) 00160 { 00161 CL_IPCPRINTF("command.cc [%d]", command.cc); 00162 switch (command.cc) 00163 { 00164 case ccClStore: 00165 CL_IPCPRINTF("STORE - nArg %d", command.nArg); 00166 //check the argument just to besure 00167 if (command.nArg == 4) 00168 { 00169 for (index = 0; index < command.nArg; index++) 00170 { 00171 CL_IPCPRINTF("command.arg[%d]=%s", index, command.arg[index]); 00172 } 00173 00174 contentType = atoi(command.arg[1]); 00175 item = command.arg[2]; // NOT USED ANY MORE !!!! 00176 location = command.arg[3]; 00177 00178 CL_IPCPRINTF("contentType=%d location=%s", contentType, location); 00179 hsSetLocation(contentType, location); 00180 } 00181 else 00182 { 00183 CL_WARNPRINTF("ccclStore invalid argument count %d", command.nArg); 00184 } 00185 break; 00186 00187 case ccClMSDiskSetConnected: 00188 { 00189 int connected = atoi(command.arg[0]); 00190 CL_IPCPRINTF("msdisk: connected = %d\n", connected); 00191 erMSDiskSetConnected(connected); 00192 break; 00193 } 00194 00195 case ccClGotoPage: 00196 { 00197 int page = atoi(command.arg[0]); 00198 CL_IPCPRINTF("Contentlister Goto Page: %d\n", page); 00199 gdk_threads_enter(); 00200 erbusy_blink(); 00201 ctrl_goto_page(page); 00202 gdk_threads_leave(); 00203 break; 00204 } 00205 00206 case ccClBatteryLow: 00207 { 00208 eCcClBatteryAction action = atoi(command.arg[0]); 00209 int percentage = atoi(command.arg[1]); 00210 int time_left = atoi(command.arg[2]); 00211 CL_IPCPRINTF("BatteryLow: action [%d] perc [%d] time [%d]", action, percentage, time_left); 00212 gdk_threads_enter(); 00213 if (action == ccClBattery_warning) 00214 { 00215 ctrl_battery_low_screen(percentage, time_left, FALSE); 00216 } 00217 else if (action == ccClBattery_shutdown) 00218 { 00219 ctrl_battery_low_screen(percentage, time_left, TRUE); 00220 } 00221 gdk_threads_leave(); 00222 } 00223 00224 case ccClToolbarIcon: 00225 { 00226 int iconID = atoi(command.arg[0]); 00227 int iconState = atoi(command.arg[1]); 00228 CL_TBPRINTF("ccClToolbarIcon: iconID [%d] iconState [%d]", iconID, iconState); 00229 gdk_threads_enter(); 00230 ctrl_on_icon_clicked(iconID, iconState); 00231 gdk_threads_leave(); 00232 break; 00233 } 00234 00235 case ccClStoragePresent: 00236 { 00237 st_ContentType_e storageType = ctrl_get_storageType(command.arg[0]); 00238 gboolean storagePresent = atoi(command.arg[1]) ? TRUE : FALSE; 00239 gdk_threads_enter(); 00240 ctrl_storage_changed(storageType, storagePresent); 00241 gdk_threads_leave(); 00242 break; 00243 } 00244 00245 case ccClToolbarSynchronised: 00246 gdk_threads_enter(); 00247 ctrl_on_toolbar_synchronised(); 00248 gdk_threads_leave(); 00249 break; 00250 00251 case ccClBusyIndicator: 00252 if (command.nArg == 1) 00253 { 00254 status = atoi(command.arg[0]); 00255 if (status == ccBusyState_Off) 00256 { 00257 CL_LOGPRINTF("enable key buffering for busybar off"); 00258 gdk_threads_enter(); 00259 button_enable_key_buffering(TRUE); 00260 gdk_threads_leave(); 00261 } 00262 else if (status == ccBusyState_Blink) 00263 { 00264 CL_LOGPRINTF("disable key buffering for busybar blink"); 00265 gdk_threads_enter(); 00266 button_enable_key_buffering(FALSE); 00267 gdk_threads_leave(); 00268 } 00269 } 00270 break; 00271 00272 case ccClDisplayUpdated: 00273 CL_LOGPRINTF("enable key buffering for display updated"); 00274 gdk_threads_enter(); 00275 button_enable_key_buffering(TRUE); 00276 gdk_threads_leave(); 00277 break; 00278 00279 case ccClNewContent: 00280 CL_LOGPRINTF("enable key buffering for display updated\n"); 00281 gdk_threads_enter(); 00282 ctrl_new_content_received(); 00283 gdk_threads_leave(); 00284 break; 00285 00286 case ccClPenClick: 00287 click_pen(); 00288 break; 00289 00290 case ccClEnableAudio: 00291 { 00292 int volume = atoi(command.arg[0]); 00293 CL_LOGPRINTF("enable/disable volume=%d", volume); 00294 handle_sound_settings_changed(volume); 00295 break; 00296 } 00297 00298 default: 00299 CL_ERRORPRINTF("UNKNOWN IPC COMMAND %d", command.cc); 00300 break; 00301 } 00302 } 00303 CL_IPCPRINTF("done"); 00304 }
gboolean viewerStore | ( | char * | viewer, | |
st_ContentType_e | contentType | |||
) |
Send IPC request to the viewer to store the filename of the currently displayed data
viewer | unique identifier | |
contentType | unique identifier |
Definition at line 89 of file viewer.c.
00090 { 00091 int channel; 00092 00093 CL_IPCPRINTF("entry - %s - %d", viewer, contentType); 00094 00095 channel = viewerGetChannel(viewer); 00096 00097 if (channel > 0) 00098 { 00099 // request to store the location of the currently diplayed data 00100 // NULL where itemID used to be since in the past the last location 00101 // of every item neede to be stored. Now only hte last accessed item 00102 // location needs to be stored so no item id is needed any more 00103 00104 vwrStore(theBrowserChannel, ER_CONTENT_LISTER_UA_ID, contentType, NULL); 00105 } 00106 00107 return TRUE; 00108 00109 }
erClientChannel_t theBrowserChannel [static] |
erServerChannel_t theServerChannel [static] |