#include "config.h"
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <liberipc/eripc.h>
#include <liberipc/eripc_support.h>
#include "log.h"
Go to the source code of this file.
Defines | |
#define | DBUS_APPL_NAME "sysclient" |
#define | DBUS_SERVICE "com.irexnet." DBUS_APPL_NAME |
#define | DBUS_PATH "/com/irexnet/" DBUS_APPL_NAME |
#define | DBUS_INTERFACE "com.irexnet." DBUS_APPL_NAME |
#define | DBUS_SERVICE_SYSD "com.irexnet.sysd" |
#define | DBUS_SERVICE_CTB "com.irexnet.ctb" |
#define | DBUS_SERVICE_POPUPMENU "com.irexnet.popupmenu" |
Functions | |
static void | usage (const char *argv_0) |
int | main (int argc, char *argv[]) |
Variables | |
static eripc_client_context_t * | eripcClient = NULL |
#define DBUS_APPL_NAME "sysclient" |
Copyright (C) 2008 iRex Technologies B.V. All rights reserved.
Definition at line 56 of file sysclient.c.
#define DBUS_INTERFACE "com.irexnet." DBUS_APPL_NAME |
Definition at line 59 of file sysclient.c.
#define DBUS_PATH "/com/irexnet/" DBUS_APPL_NAME |
Definition at line 58 of file sysclient.c.
#define DBUS_SERVICE "com.irexnet." DBUS_APPL_NAME |
Definition at line 57 of file sysclient.c.
#define DBUS_SERVICE_CTB "com.irexnet.ctb" |
Definition at line 62 of file sysclient.c.
#define DBUS_SERVICE_POPUPMENU "com.irexnet.popupmenu" |
Definition at line 63 of file sysclient.c.
Referenced by main().
#define DBUS_SERVICE_SYSD "com.irexnet.sysd" |
Definition at line 61 of file sysclient.c.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 83 of file sysclient.c.
References eripc_client_context_t::context, DBUS_APPL_NAME, DBUS_INTERFACE, DBUS_PATH, DBUS_SERVICE, DBUS_SERVICE_CTB, DBUS_SERVICE_POPUPMENU, DBUS_SERVICE_SYSD, ERIPC_BUS_SESSION, eripc_client_context_new(), eripc_send_varargs(), ERIPC_TYPE_BOOL, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, LOGPRINTF, usage(), and WARNPRINTF.
00084 { 00085 if (argc <= 1) 00086 { 00087 usage(argv[0]); 00088 return 1; 00089 } 00090 00091 eripcClient = eripc_client_context_new( 00092 DBUS_APPL_NAME, 00093 "1.0", 00094 DBUS_SERVICE, 00095 DBUS_PATH, 00096 DBUS_INTERFACE, 00097 NULL); 00098 00099 if (eripcClient == NULL) 00100 { 00101 printf("Cannot connect to DBUS, make sure DISPLAY environment variable is set.\n\n"); 00102 return 1; 00103 } 00104 00105 if (strcmp(argv[1], "startTask") == 0) 00106 { 00107 if (argc == 6) 00108 { 00109 LOGPRINTF("Calling %s %s...", argv[1], argv[2]); 00110 00111 eripc_send_varargs(eripcClient->context, 00112 NULL, 00113 NULL, 00114 ERIPC_BUS_SESSION, 00115 DBUS_SERVICE_SYSD, 00116 argv[1], 00117 ERIPC_TYPE_STRING, argv[2], 00118 ERIPC_TYPE_STRING, argv[3], 00119 ERIPC_TYPE_STRING, argv[4], 00120 ERIPC_TYPE_STRING, argv[5], 00121 ERIPC_TYPE_INVALID); 00122 } 00123 else 00124 { 00125 WARNPRINTF("Invalid args for %s", argv[1]); 00126 } 00127 } 00128 else if ((strcmp(argv[1], "menuRequestPopup") == 0) 00129 || (strcmp(argv[1], "stopTask") == 0)) 00130 { 00131 if (argc == 3) 00132 { 00133 LOGPRINTF("Calling %s %s...", argv[1], argv[2]); 00134 00135 eripc_send_varargs(eripcClient->context, 00136 NULL, 00137 NULL, 00138 ERIPC_BUS_SESSION, 00139 DBUS_SERVICE_SYSD, 00140 argv[1], 00141 ERIPC_TYPE_STRING, argv[2], 00142 ERIPC_TYPE_INVALID); 00143 } 00144 else 00145 { 00146 WARNPRINTF("Invalid args for %s", argv[1]); 00147 } 00148 } 00149 else if (strcmp(argv[1], "gotoHome") == 0) 00150 { 00151 if (argc == 2) 00152 { 00153 LOGPRINTF("Calling %s...", argv[1]); 00154 00155 eripc_send_varargs(eripcClient->context, 00156 NULL, 00157 NULL, 00158 ERIPC_BUS_SESSION, 00159 DBUS_SERVICE_SYSD, 00160 "menuItemActivated", 00161 ERIPC_TYPE_STRING, "desktop", /* item */ 00162 ERIPC_TYPE_STRING, "general", /* group */ 00163 ERIPC_TYPE_STRING, "", /* menu */ 00164 ERIPC_TYPE_STRING, "", /* state */ 00165 ERIPC_TYPE_INVALID); 00166 } 00167 else 00168 { 00169 WARNPRINTF("Invalid args for %s", argv[1]); 00170 } 00171 } 00172 else if ((strcmp(argv[1], "sysCardUnmount") == 0) 00173 || (strcmp(argv[1], "sysShutdown") == 0) 00174 || (strcmp(argv[1], "sysStandby") == 0)) 00175 { 00176 if (argc == 2) 00177 { 00178 LOGPRINTF("Calling %s...", argv[1]); 00179 00180 eripc_send_varargs(eripcClient->context, 00181 NULL, 00182 NULL, 00183 ERIPC_BUS_SESSION, 00184 DBUS_SERVICE_SYSD, 00185 argv[1], 00186 ERIPC_TYPE_INVALID); 00187 } 00188 else 00189 { 00190 WARNPRINTF("Invalid args for %s", argv[1]); 00191 } 00192 } 00193 else if ((strcmp(argv[1], "sysCardMount") == 0)) 00194 { 00195 if (argc == 2) 00196 { 00197 LOGPRINTF("Calling %s...", argv[1]); 00198 00199 eripc_send_varargs(eripcClient->context, 00200 NULL, 00201 NULL, 00202 ERIPC_BUS_SESSION, 00203 DBUS_SERVICE_SYSD, 00204 argv[1], 00205 ERIPC_TYPE_BOOL, TRUE, 00206 ERIPC_TYPE_INVALID); 00207 } 00208 else 00209 { 00210 WARNPRINTF("Invalid args for %s", argv[1]); 00211 } 00212 } 00213 else if ((strcmp(argv[1], "ctbRefresh") == 0)) 00214 { 00215 LOGPRINTF("Calling %s...", argv[1]); 00216 00217 eripc_send_varargs(eripcClient->context, 00218 NULL, 00219 NULL, 00220 ERIPC_BUS_SESSION, 00221 DBUS_SERVICE_CTB, 00222 "filesystemChanged", 00223 ERIPC_TYPE_INVALID); 00224 } 00225 else if ((strcmp(argv[1], "listTasks") == 0)) 00226 { 00227 LOGPRINTF("Calling %s...", argv[1]); 00228 00229 eripc_send_varargs(eripcClient->context, 00230 NULL, 00231 NULL, 00232 ERIPC_BUS_SESSION, 00233 DBUS_SERVICE_SYSD, 00234 "testingListTasks", 00235 ERIPC_TYPE_INVALID); 00236 } 00237 else if ((strcmp(argv[1], "listMenu") == 0)) 00238 { 00239 LOGPRINTF("Calling %s...", argv[1]); 00240 00241 eripc_send_varargs(eripcClient->context, 00242 NULL, 00243 NULL, 00244 ERIPC_BUS_SESSION, 00245 DBUS_SERVICE_POPUPMENU, 00246 "testingListMenuItems", 00247 ERIPC_TYPE_INVALID); 00248 } 00249 else 00250 { 00251 usage(argv[0]); 00252 } 00253 return 1; 00254 }
static void usage | ( | const char * | argv_0 | ) | [static] |
Definition at line 257 of file sysclient.c.
00258 { 00259 static const char *usage_text = 00260 "Usage:\n" 00261 " %s <command> [<arguments>]\n" 00262 "\n" 00263 "Commands and aguments:\n" 00264 " startTask\t- start a new task/application\n" 00265 " \tcommand_line\tstring, full path to application with arguments\n" 00266 " \tworking_dir\tstring, current working directory\n" 00267 " \tlabel\tstring, text label shown under icon in popup menu\n" 00268 " \timage\tstring, full path to icon shown in popup menu (png, 60x60 pixels)\n" 00269 " stopTask\t- stop a running task/applciation\n" 00270 " \tcommand_line\tstring, full path to application with arguments\n" 00271 " listTasks\t- show lists of running tasks, windows and processes\n" 00272 " menuRequestPopup\t- show/hide the popupmenu\n" 00273 " \tstate\tstring, \"show\" | \"hide\" | \"toggle\"\n" 00274 " gotoHome\t- activate ctb desktop/home\n" 00275 " sysCardMount\t- mount the SD card(s)\n" 00276 " sysCardUnmount\t- unmount the SD card(s)\n" 00277 " sysShutdown\t- graciously shut down the system\n" 00278 " sysStandby\t- enter standby mode\n" 00279 " ctbRefresh\t- refresh ctb fileview from database\n" 00280 " listMenu\t- show all entries in popupmenu\n" 00281 "\n"; 00282 00283 printf(usage_text, argv_0); 00284 00285 exit(1); 00286 }
eripc_client_context_t* eripcClient = NULL [static] |
Definition at line 69 of file sysclient.c.