liberipc/src/eripcpowermgr.c File Reference

#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 "eripcpowermgr.h"
#include "eripcparser.h"

Go to the source code of this file.

Functions

int pwrSetAC97 (erClientChannel_t channel, int enabled)
int pwrGotoIdleMode (erClientChannel_t channel, int MHz, int timeout)
int pwrParseCommand (char *szCommand, erIpcCmd_t *pCmd)


Function Documentation

int pwrGotoIdleMode ( erClientChannel_t  channel,
int  MHz,
int  timeout 
)

Outdated ** int pwrSetWifi(erClientChannel_t channel, int enabled) { erIpcCmd_t cmd;

strcpy(cmd.name, "pwrWifi"); cmd.cc = (int) ccPwrWifi; cmd.nArg = 1; sprintf(cmd.arg[0], "%d", enabled);

return erIpcSndCommand(channel, &cmd); } Outdated

Definition at line 65 of file eripcpowermgr.c.

00066 {
00067     erIpcCmd_t cmd;
00068 
00069     strcpy(cmd.name, "pwrGotoIdle");
00070     cmd.cc = (int) ccPwrIdleMode;
00071     cmd.nArg = 2;
00072     sprintf(cmd.arg[0], "%d", MHz);
00073     sprintf(cmd.arg[1], "%d", timeout);
00074 
00075     return erIpcSndCommand(channel, &cmd);
00076 }

Here is the call graph for this function:

int pwrParseCommand ( char *  szCommand,
erIpcCmd_t pCmd 
)

Outdated ** else if (strcmp(szToken, "pwrWifi") == 0 || cmdcode == ccPwrWifi) { strcpy(pCmd->name, szToken); pCmd->cc = (int) ccPwrWifi; nReqArgs = 1; pCmd->nArg = 1; } Outdated

Definition at line 82 of file eripcpowermgr.c.

00083 {
00084     int     i;
00085     char   *pChar;
00086     int     cmdcode;
00087     char    szToken[TB_MAXCHARONLINE];
00088     int     nReqArgs = 0;
00089 
00090     pCmd->cc = (int) ccPwrUndefined;
00091     for (i = 0; i < TB_N_ARG; i++)
00092     {
00093         strcpy(pCmd->arg[i], "");
00094     }
00095 
00096     // Parse Command
00097     pChar = szCommand;
00098     i = 0;
00099     while (*pChar != '\0')
00100     {
00101         szToken[i] = '\0';
00102         if (*pChar == ',')
00103         {
00104             pChar++;
00105             break;
00106         }
00107         szToken[i] = *pChar++;
00108         i++;
00109         szToken[i] = '\0';
00110     }
00111 
00112 
00113     // We have found the command Token. Figure out what the command is.
00114     // TODO: stop doing this hardcoded, rely on a smart datastructure instead.
00115 
00116     if (isdigit(szToken[0]))
00117     {
00118         cmdcode = atoi(szToken);
00119     }
00120     else
00121     {
00122         cmdcode = -1;
00123     }
00124     if (strcmp(szToken, "pwrAC97") == 0  ||  cmdcode == ccPwrAC97)
00125     {
00126         strcpy(pCmd->name, szToken);
00127         pCmd->cc = (int) ccPwrAC97;
00128         nReqArgs = 1;
00129         pCmd->nArg = 1;
00130     }
00140     else if (strcmp(szToken, "pwrGotoIdle") == 0  ||  cmdcode == ccPwrIdleMode)
00141     {
00142         strcpy(pCmd->name, szToken);
00143         pCmd->cc = (int) ccPwrIdleMode;
00144         nReqArgs = 2;
00145         pCmd->nArg = 2;
00146     }
00147     else {
00148         strcpy(pCmd->name, "Undefined");
00149         pCmd->cc = (int) ccPwrUndefined;
00150         fprintf(stderr, "%s: Command %s \n", __FUNCTION__, szToken);
00151         fprintf(stderr, "Error parsing (%s). Command undefined\n", szCommand);
00152         pCmd->nArg = -1;
00153         return -1;
00154     }
00155 
00156     if (nReqArgs > 0)
00157     {
00158         erIpcGetArgs(pChar, pCmd, nReqArgs);
00159     }
00160     return 0;
00161 }

Here is the call graph for this function:

int pwrSetAC97 ( erClientChannel_t  channel,
int  enabled 
)

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

Definition at line 39 of file eripcpowermgr.c.

00040 {
00041     erIpcCmd_t cmd;
00042 
00043     strcpy(cmd.name, "pwrAC97");
00044     cmd.cc = (int) ccPwrAC97;
00045     cmd.nArg = 1;
00046     sprintf(cmd.arg[0], "%d", enabled);
00047 
00048     return erIpcSndCommand(channel, &cmd);
00049 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:11:46 2008 by  doxygen 1.5.6