Esempio n. 1
0
File: cli.c Progetto: draringi/gini
/*
 * set verbose [value]
 * set raw-time [true | false ]
 * set update-delay value
 * set sched-cycle value
 */
void setCmd()
{
	char *next_tok = strtok(NULL, " \n");
	int level, cyclelen, rawmode, updateinterval;

	if (next_tok == NULL)
		error("[setCmd]:: ERROR!! missing set-parameter");
	else if (!strcmp(next_tok, "sched-cycle"))
	{
		if ((next_tok = strtok(NULL, " \n")) != NULL)
		{
			cyclelen = atoi(next_tok);
			if (cyclelen >=0)
				rconfig.schedcycle = cyclelen;
			else
				verbose(1, "ERROR!! schedule cycle length should be positive \n");
		} else
			printf("\nSchedule cycle length: %d (microseconds) \n", rconfig.schedcycle);
	} else if (!strcmp(next_tok, "verbose"))
	{
		if ((next_tok = strtok(NULL, " \n")) != NULL)
		{
			level = atoi(next_tok);
			if ((level >= 0) && (level <= 6))
				prog_set_verbosity_level(level);
			else
				verbose(1, "[setCmd]:: ERROR!! level should be in [0..6] \n");
		} else
			printf("\nVerbose level: %ld \n", prog_verbosity_level());
	} else if (!strcmp(next_tok, "raw-times"))
	{
		if ((next_tok = strtok(NULL, " \n")) != NULL)
		{
			rawmode = atoi(next_tok);
			if ((rawmode == 0) || (rawmode == 1))
				setTimeMode(rawmode);
			else
				printf("\nRaw time mode: %d  \n", getTimeMode());
		}
		else if (!strcmp(next_tok, "update-delay"))
		{
			if ((next_tok = strtok(NULL, " \n")) != NULL)
			{
				updateinterval = atoi(next_tok);
				if (updateinterval >=2)
					setUpdateInterval(updateinterval);
				else
					verbose(1, "Invalid update interval.. setting failed.. \n");
			}
			else
				printf("Update interval: %d (seconds) \n", getUpdateInterval());
		}
	}
}
Esempio n. 2
0
static void ConvertValue2String(PEDIT_FIELD pCtrl,UINT16* pString, UINT32 dwValue, PEDIT_PATTERN pPattern)
{
	UINT32 i, j, len, cnt;
	UINT32 dwTemp = 1;
	UINT16 wSep;
	UINT32 status = OSD_GetEditFieldStatus(pCtrl);

#if EDITFIELD_SUPPORT_TIME
	if('t' == pPattern->bTag || 'T' == pPattern->bTag )
	{
		UINT16 wsNum[8], wsSep[2];// = {0};
		char *pfmt = m_fmtDT[pPattern->dt.bFormat];

		for(i=0; i<pPattern->bLen; i++)
			dwTemp *= 10;
		pString[0] = 0;
		wSep = (UINT16)(m_Sep[pPattern->dt.bSep]);
		for(i=0, len=0; i<STRLEN(pfmt); i+=2)
		{
			cnt = pfmt[i+1] - '0';
			for(j=0; j<cnt; j++)
				dwTemp /= 10;
			len += ComInt2UniStr(&pString[len], dwValue/dwTemp, cnt);
			if(dwTemp > 1)
			//pString[len++] = wSep;
				SetUniStrCharAt(&pString[len++], wSep,0);
			dwValue %= dwTemp;
		}

		if(pPattern->bTag=='T')	
		{
			SetUniStrCharAt(&pString[len+2], 'M',0);
			SetUniStrCharAt(&pString[len], ' ',0);//space

			if (status == SELECT_STATUS || (status == EDIT_STATUS && pCtrl->bCursor == (len+1)))
				SetUniStrCharAt(&pString[len+1], (getTimeMode() ? 'P' : 'A'),0);
			len += 3;
		}
		pString[len++] = 0;
	}
	else
#endif
	if(pPattern->bTag == 'i')
	{
		wSep = (UINT16)(m_Sep[pPattern->ip.bSep]);
		for(i = 0,len = 0; i < 4; i++)
		{
			len += ComInt2UniStr(&pString[len], (UINT8)(dwValue>>((3-i)*8)), 3);
			if(i < 3)
				SetUniStrCharAt(&pString[len++], wSep,0);
		}
		pString[len++] = 0;
	}
Esempio n. 3
0
File: cli.c Progetto: draringi/gini
/*
 * get parameter_name
 */
void getCmd()
{
	char *next_tok = strtok(NULL, " \n");
	int level, cyclelen, rawmode, updateinterval;

	if (next_tok == NULL)
		error("[getCmd]:: ERROR!! missing get-parameter");
	else if (!strcmp(next_tok, "sched-cycle"))
		printf("\nSchedule cycle length: %d (microseconds) \n", rconfig.schedcycle);
	else if (!strcmp(next_tok, "verbose"))
		printf("\nVerbose level: %ld \n", prog_verbosity_level());
	else if (!strcmp(next_tok, "raw-times"))
		printf("\nRaw time mode: %d  \n", getTimeMode());
	else if (!strcmp(next_tok, "update-delay"))
		printf("Update interval: %d (seconds) \n", getUpdateInterval());
}