scribble/src/IPCServer.c File Reference

#include <pthread.h>
#include <liberipc/eripc.h>
#include <liberipc/eripctoolbar.h>
#include <liberipc/eripcicons.h>
#include <liberipc/eripcbusyd.h>
#include <liberipc/eripccontentlister.h>
#include <liberipc/eripcviewer.h>
#include "ScribbleLog.h"
#include "ScribbleIPC.h"
#include "ScribbleUI.h"
#include "ScribbleDefine.h"

Go to the source code of this file.

Functions

void ipcMessageReceived (gpointer data, gint source_fd, GdkInputCondition condition)
gboolean installIpcServer (PScribbleUICtx pScribbleUICtx)
void stopIpcServer (void)

Variables

static erServerChannel_t srvChannel
static gint srvInputTag


Function Documentation

gboolean installIpcServer ( PScribbleUICtx  pScribbleUICtx  ) 

Start listening to IPC requests

Parameters:
PScribbleUICtx scribble ui context
Returns:
-

Definition at line 88 of file IPCServer.c.

00089 {
00090     int     iRet = 0;
00091     int     fd = -1;
00092 
00093     SB_IPCPRINTF("__start__\n");
00094     iRet = erIpcOpenServerChannel(ER_SCRIBBLE_CHANNEL,
00095                                   &srvChannel);
00096     if (iRet != 0)
00097     {
00098         SB_ERRORPRINTF("erIpcOpenServerChannel returned %d\n", iRet);
00099         return iRet;
00100     }
00101     fd = erIpcGetServerFd(srvChannel);
00102     // gtk specific mechanism to monitor input file descriptor.
00103     srvInputTag = gdk_input_add(fd, GDK_INPUT_READ, 
00104                                 ipcMessageReceived, (gpointer) pScribbleUICtx);
00105     SB_IPCPRINTF("__finish__\n");
00106     return iRet;
00107 }

Here is the call graph for this function:

void ipcMessageReceived ( gpointer  data,
gint  source_fd,
GdkInputCondition  condition 
)

Definition at line 51 of file IPCServer.c.

00053 {
00054     char    szBuffer[SCRIB_SERVER_BUFFER_SIZE];
00055     int     nBuf = SCRIB_SERVER_BUFFER_SIZE;
00056     erIpcCmd_t command;
00057     int        iconID;
00058     int        iconState;
00059 
00060     PScribbleUICtx pScribbleUICtx=(PScribbleUICtx)data;
00061 
00062     erIpcGetMessage(srvChannel, szBuffer, &nBuf);
00063     SB_IPCPRINTF("get msg ok\n");
00064     if (vwrParseCommand(szBuffer, &command) >= 0) 
00065     {
00066         switch ((int) command.cc) 
00067         {
00068             case ccVwrJumpToPage:
00069                 SB_IPCPRINTF("\nServiceCallBack: ccVwrJumpToPage %d\n", 
00070                              atoi(command.arg[1]));
00071                 resetCurrentPage(pScribbleUICtx,atoi(command.arg[1]) );
00072                 SB_IPCPRINTF("reset page ok\n");
00073                 break;
00074             case ccVwrToolbar:
00075                 iconID    = atoi(command.arg[0]);
00076                 iconState = atoi(command.arg[1]);
00077                 SB_IPCPRINTF("Toolbar iconID [%d] iconState [%d]", \
00078                         iconID, iconState);
00079                 toolbar_key_selected(iconID, iconState, pScribbleUICtx);
00080                 break;
00081             default:
00082                 SB_ERRORPRINTF("UNKNOWN COMMAND\n");
00083         }
00084     }
00085 }

Here is the call graph for this function:

void stopIpcServer ( void   ) 

Stop listening to IPC requests

Returns:
-

Definition at line 110 of file IPCServer.c.

00111 {
00112     int fd = erIpcGetServerFd(srvChannel);
00113 
00114     SB_IPCPRINTF("__start__\n");
00115     gdk_input_remove(srvInputTag);
00116     close(fd);
00117     SB_IPCPRINTF("__finish__\n");
00118 }


Variable Documentation

erServerChannel_t srvChannel [static]

Definition at line 47 of file IPCServer.c.

gint srvInputTag [static]

Definition at line 48 of file IPCServer.c.


Generated on Sun Dec 14 17:14:38 2008 by  doxygen 1.5.6