#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include "eripc.h"
#include "eripcclient.h"
#include "eripcbusyd.h"
#include "eripccontentlister.h"
#include "eripcparser.h"
Go to the source code of this file.
Functions | |
int | clParseCommand (char *szCommand, erIpcCmd_t *pCmd) |
int | clStore (erClientChannel_t channel, int uaID, int category, char *itemID, char *itemLocation) |
int | MSDiskSetConnected (erClientChannel_t channel, int connected) |
int | clGotoPage (erClientChannel_t channel, int page) |
int | clBatteryLow (erClientChannel_t channel, eCcClBatteryAction action, int percentage, int time_left) |
int | clStoragePresent (erClientChannel_t channel, char *storageType, int storagePresent) |
int | clBusyIndicator (erClientChannel_t channel, eCcBusyState status) |
int | clDisplayUpdated (erClientChannel_t channel) |
int | clNewContent (erClientChannel_t channel) |
int | clPenClick (erClientChannel_t channel) |
int | clEnableAudio (erClientChannel_t channel, int volume) |
int clBatteryLow | ( | erClientChannel_t | channel, | |
eCcClBatteryAction | action, | |||
int | percentage, | |||
int | time_left | |||
) |
Notify the contentmanager that the battery level is low
channel | Opaque datastructure that contains info on communication channel | |
action | requested from contetnLister | |
battery | charge as 0 .. 100% | |
estimated | time left (in minutes) |
Definition at line 243 of file eripccontentlister.c.
00244 { 00245 erIpcCmd_t cmd; 00246 00247 strcpy(cmd.name, "ccClBatteryLow"); 00248 cmd.cc = (int) ccClBatteryLow; 00249 cmd.nArg = 3; 00250 sprintf(cmd.arg[0], "%d", action); 00251 sprintf(cmd.arg[1], "%d", percentage); 00252 sprintf(cmd.arg[2], "%d", time_left); 00253 00254 return erIpcSndCommand(channel, &cmd); 00255 }
int clBusyIndicator | ( | erClientChannel_t | channel, | |
eCcBusyState | status | |||
) |
Notify the contentmanager that busyIndicator changes its status
channel | Opaque datastructure that contains info on communication channel | |
status | busybar change to the 'status' |
Definition at line 271 of file eripccontentlister.c.
00272 { 00273 erIpcCmd_t cmd; 00274 00275 strcpy(cmd.name, "ccClBusyIndicator"); 00276 cmd.cc = (int) ccClBusyIndicator; 00277 cmd.nArg = 1; 00278 sprintf(cmd.arg[0], "%d", status); 00279 00280 return erIpcSndCommand(channel, &cmd); 00281 }
int clDisplayUpdated | ( | erClientChannel_t | channel | ) |
Notify the contentmanager that display Updated
channel | Opaque datastructure that contains info on communication channel |
Definition at line 283 of file eripccontentlister.c.
00284 { 00285 erIpcCmd_t cmd; 00286 00287 strcpy(cmd.name, "ccClDisplayUpdated"); 00288 cmd.cc = (int) ccClDisplayUpdated; 00289 cmd.nArg = 0; 00290 00291 return erIpcSndCommand(channel, &cmd); 00292 }
int clEnableAudio | ( | erClientChannel_t | channel, | |
int | volume | |||
) |
Called by settings application when user changes the sound settings
channel | Opaque datastructure that contains info on communication channel | |
volume | 0=disabled, >0=enabled |
Definition at line 316 of file eripccontentlister.c.
00317 { 00318 erIpcCmd_t cmd; 00319 00320 strcpy(cmd.name, "ccClEnableAudio"); 00321 cmd.cc = (int) ccClEnableAudio; 00322 cmd.nArg = 1; 00323 sprintf(cmd.arg[0], "%d", volume); 00324 00325 return erIpcSndCommand(channel, &cmd); 00326 }
int clGotoPage | ( | erClientChannel_t | channel, | |
int | page | |||
) |
Notify the contentmanager it should goto a new page
channel | Opaque datastructure that contains info on communication channel | |
page | pagenumber to jump to |
Definition at line 231 of file eripccontentlister.c.
00232 { 00233 erIpcCmd_t cmd; 00234 00235 strcpy(cmd.name, "ccClGotoPage"); 00236 cmd.cc = (int) ccClGotoPage; 00237 cmd.nArg = 1; 00238 sprintf(cmd.arg[0], "%d", page); 00239 00240 return erIpcSndCommand(channel, &cmd); 00241 }
int clNewContent | ( | erClientChannel_t | channel | ) |
Notify the contentmanager that new content has been downloaded
channel | Opaque datastructure that contains info on communication channel |
Definition at line 294 of file eripccontentlister.c.
00295 { 00296 erIpcCmd_t cmd; 00297 00298 strcpy(cmd.name, "ccClNewContent"); 00299 cmd.cc = (int) ccClNewContent; 00300 cmd.nArg = 0; 00301 00302 return erIpcSndCommand(channel, &cmd); 00303 }
int clParseCommand | ( | char * | szCommand, | |
erIpcCmd_t * | pCmd | |||
) |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
Definition at line 43 of file eripccontentlister.c.
00044 { 00045 int i; 00046 char *pChar; 00047 int cmdcode; 00048 char szToken[TB_MAXCHARONLINE]; 00049 int nReqArgs = 0; 00050 00051 pCmd->cc = (int) ccClUndefined; 00052 for (i = 0; i < TB_N_ARG; i++) 00053 { 00054 strcpy(pCmd->arg[i], ""); 00055 } 00056 00057 // Parse Command 00058 pChar = szCommand; 00059 i = 0; 00060 while (*pChar != '\0') 00061 { 00062 szToken[i] = '\0'; 00063 if (*pChar == ',') 00064 { 00065 pChar++; 00066 break; 00067 } 00068 szToken[i] = *pChar++; 00069 i++; 00070 szToken[i] = '\0'; 00071 } 00072 00073 // We have found the command Token. Figure out what the command is. 00074 // TODO: stop doing this hardcoded, rely on a smart datastructure instead. 00075 if (isdigit(szToken[0])) 00076 { 00077 cmdcode = atoi(szToken); 00078 } 00079 else 00080 { 00081 cmdcode = -1; 00082 } 00083 if (strcmp(szToken, "ccClStore") == 0 || cmdcode == ccClStore) 00084 { 00085 strcpy(pCmd->name, szToken); 00086 pCmd->cc = (int) ccClStore; 00087 nReqArgs = 4; 00088 pCmd->nArg = 4; 00089 } 00090 else if (strcmp(szToken, "ccClMSDiskSetConnected") == 0 || cmdcode == ccClMSDiskSetConnected) 00091 { 00092 strcpy(pCmd->name, szToken); 00093 pCmd->cc = (int) ccClMSDiskSetConnected; 00094 nReqArgs = 1; 00095 pCmd->nArg = 1; 00096 } 00097 else if (strcmp(szToken, "ccClGotoPage") == 0 || cmdcode == ccClGotoPage) 00098 { 00099 strcpy(pCmd->name, szToken); 00100 pCmd->cc = (int) ccClGotoPage; 00101 nReqArgs = 1; 00102 pCmd->nArg = 1; 00103 } 00104 else if (strcmp(szToken, "ccClBatteryLow") == 0 || cmdcode == ccClBatteryLow) 00105 { 00106 strcpy(pCmd->name, szToken); 00107 pCmd->cc = (int) ccClBatteryLow; 00108 nReqArgs = 3; 00109 pCmd->nArg = 3; 00110 } 00111 else if (strcmp(szToken, "ccClToolbarIcon") == 0 || cmdcode == ccClToolbarIcon) 00112 { 00113 strcpy(pCmd->name, szToken); 00114 pCmd->cc = (int) ccClToolbarIcon; 00115 nReqArgs = 2; 00116 pCmd->nArg = 2; 00117 } 00118 else if (strcmp(szToken, "ccClStoragePresent") == 0 || cmdcode == ccClStoragePresent) 00119 { 00120 strcpy(pCmd->name, szToken); 00121 pCmd->cc = (int) ccClStoragePresent; 00122 nReqArgs = 2; 00123 pCmd->nArg = 2; 00124 } 00125 else if (strcmp(szToken, "ccClToolbarSynchronised") == 0 || cmdcode == ccClToolbarSynchronised) 00126 { 00127 strcpy(pCmd->name, szToken); 00128 pCmd->cc = (int) ccClToolbarSynchronised; 00129 nReqArgs = 0; 00130 pCmd->nArg = 0; 00131 } 00132 else if (strcmp(szToken, "ccClBusyIndicator") == 0 || cmdcode == ccClBusyIndicator) 00133 { 00134 strcpy(pCmd->name, szToken); 00135 pCmd->cc = (int) ccClBusyIndicator; 00136 nReqArgs = 1; 00137 pCmd->nArg = 1; 00138 } 00139 else if (strcmp(szToken, "ccClDisplayUpdated") == 0 || cmdcode == ccClDisplayUpdated) 00140 { 00141 strcpy(pCmd->name, szToken); 00142 pCmd->cc = (int) ccClDisplayUpdated; 00143 nReqArgs = 0; 00144 pCmd->nArg = 0; 00145 } 00146 else if (strcmp(szToken, "ccClNewContent") == 0 || cmdcode == ccClNewContent) 00147 { 00148 strcpy(pCmd->name, szToken); 00149 pCmd->cc = (int) ccClNewContent; 00150 nReqArgs = 0; 00151 pCmd->nArg = 0; 00152 } 00153 else if (strcmp(szToken, "ccClPenClick") == 0 || cmdcode == ccClPenClick) 00154 { 00155 strcpy(pCmd->name, szToken); 00156 pCmd->cc = (int) ccClPenClick; 00157 nReqArgs = 0; 00158 pCmd->nArg = 0; 00159 } 00160 else if (strcmp(szToken, "ccClEnableAudio") == 0 || cmdcode == ccClEnableAudio) 00161 { 00162 strcpy(pCmd->name, szToken); 00163 pCmd->cc = (int) ccClEnableAudio; 00164 nReqArgs = 1; 00165 pCmd->nArg = 1; 00166 } 00167 else 00168 { 00169 strcpy(pCmd->name, "ccClUndefined"); 00170 pCmd->cc = (int) ccClUndefined; 00171 fprintf(stderr, "%s: Command %s \n", __FUNCTION__, szToken); 00172 fprintf(stderr, "Error parsing (%s). Command undefined\n", szCommand); 00173 pCmd->nArg = -1; 00174 return -1; 00175 } 00176 00177 if (nReqArgs > 0) 00178 { 00179 erIpcGetArgs(pChar, pCmd, nReqArgs); 00180 } 00181 return 0; 00182 }
int clPenClick | ( | erClientChannel_t | channel | ) |
Notify the Content Lister that a pen click event is occurred
channel | Opaque datastructure that contains info on communication channel |
Definition at line 305 of file eripccontentlister.c.
00306 { 00307 erIpcCmd_t cmd; 00308 00309 strcpy(cmd.name, "ccClPenClick"); 00310 cmd.cc = (int) ccClPenClick; 00311 cmd.nArg = 0; 00312 00313 return erIpcSndCommand(channel, &cmd); 00314 }
int clStoragePresent | ( | erClientChannel_t | channel, | |
char * | storageType, | |||
int | storagePresent | |||
) |
Notify the contentmanager that a storage module has been inserted or removed
channel | Opaque datastructure that contains info on communication channel | |
storage | module identification | |
1/0 | = module present yes/no |
Definition at line 257 of file eripccontentlister.c.
00258 { 00259 erIpcCmd_t cmd; 00260 00261 strcpy(cmd.name, "ccClStoragePresent"); 00262 cmd.cc = (int) ccClStoragePresent; 00263 cmd.nArg = 2; 00264 sprintf(cmd.arg[0], "%s", storageType); 00265 sprintf(cmd.arg[1], "%d", storagePresent); 00266 00267 return erIpcSndCommand(channel, &cmd); 00268 }
int clStore | ( | erClientChannel_t | channel, | |
int | uaID, | |||
int | category, | |||
char * | itemID, | |||
char * | itemLocation | |||
) |
Store the currently displayed page for this category
channel | Opaque datastructure that contains info on communication channel | |
uaID | application identifier | |
category | identifier | |
itemID | - null terminated string - unique item ID of the currently displayed content | |
itemLocation | - null terminated string |
Definition at line 184 of file eripccontentlister.c.
00185 { 00186 erIpcCmd_t cmd; 00187 00188 strcpy(cmd.name, "ccClStore"); 00189 cmd.cc = (int) ccClStore; 00190 cmd.nArg = 4; 00191 sprintf(cmd.arg[0], "%d", uaID); 00192 sprintf(cmd.arg[1], "%d", category); 00193 00194 if ((itemID) && (strlen(itemID) < TB_ARGLENGTH)) 00195 { 00196 strncpy(cmd.arg[2], itemID, TB_ARGLENGTH); 00197 } 00198 else 00199 { 00200 sprintf(cmd.arg[2],"%s", ""); 00201 fprintf(stderr, "Command %s \n", cmd.name); 00202 fprintf(stderr, "invalid itemID (%s)\n", itemID); 00203 } 00204 00205 if ((itemLocation) && (strlen(itemLocation) < TB_ARGLENGTH)) 00206 { 00207 strncpy(cmd.arg[3], itemLocation, TB_ARGLENGTH); 00208 } 00209 else 00210 { 00211 sprintf(cmd.arg[3],"%s", ""); 00212 fprintf(stderr, "Command %s \n", cmd.name); 00213 fprintf(stderr, "invalid itemLocation (%s)\n", itemLocation); 00214 } 00215 00216 return erIpcSndCommand(channel, &cmd); 00217 }
int MSDiskSetConnected | ( | erClientChannel_t | channel, | |
int | connected | |||
) |
Notify the contentmanager that we are connected to the PC
channel | Opaque datastructure that contains info on communication channel | |
connected | boolean showing connection status |
Definition at line 219 of file eripccontentlister.c.
00220 { 00221 erIpcCmd_t cmd; 00222 00223 strcpy(cmd.name, "ccClMSDiskSetConnected"); 00224 cmd.cc = (int) ccClMSDiskSetConnected; 00225 cmd.nArg = 1; 00226 sprintf(cmd.arg[0], "%d", connected); 00227 00228 return erIpcSndCommand(channel, &cmd); 00229 }