//*****************************************************************************
//
// Update one or other of the the status strings on the display.
//
//*****************************************************************************
void
UpdateStatus(tBoolean bMainStatus, const char *pcString, ...)
{
    va_list vaArgP;

    //
    // Start the varargs processing.
    //
    va_start(vaArgP, pcString);

    //
    // Call vsnprintf to format the text into the status string buffer.
    //
    uvsnprintf(g_pcStatus[bMainStatus ? 0 : 1], MAX_STATUS_STRING_LEN,
               pcString, vaArgP);

    //
    // End the varargs processing.
    //
    va_end(vaArgP);

    //
    // Update the status string on the display.
    //
    WidgetPaint(bMainStatus ? (tWidget *)&g_sMainStatus :
                (tWidget *)&g_sAlarmStatus);
}
Exemple #2
0
//*****************************************************************************
//
// This function is used to add a new string to the status list box at the
// bottom of the display.  This shows errors and echos user commands entered
// via the UART.
//
//*****************************************************************************
static int
PrintfStatus(char *pi8Format, ...)
{
    int iRet;
    va_list vaArgP;

    //
    // Start the varargs processing.
    //
    va_start(vaArgP, pi8Format);

    //
    // Call vsnprintf to perform the conversion.
    //
    iRet = uvsnprintf(g_pcStatus[g_ui32StatusStringIndex],
                      MAX_STATUS_STRING_LEN, pi8Format, vaArgP);

    //
    // End the varargs processing.
    //
    va_end(vaArgP);

    //
    // Add the new string to the status listbox.
    //
    ListBoxTextAdd(&g_sStatusList, g_pcStatus[g_ui32StatusStringIndex]);

    //
    // Update our string index.
    //
    g_ui32StatusStringIndex++;
    if(g_ui32StatusStringIndex == NUM_STATUS_STRINGS)
    {
        g_ui32StatusStringIndex = 0;
    }

    //
    // Repaint the status listbox.
    //
    WidgetPaint((tWidget *)&g_sStatusList);

    //
    // Return the conversion count.
    //
    return(iRet);

}
Exemple #3
0
/* Helper function to print a line to a virtual screen
*/
int cmd_print(const char *pcString, ...) {
	va_list vaArgP;
	char *str;
	int len=0;
	

	if(cmd_out->line + 1 < TELNETD_CONF_NUMLINES) {
	    cmd_out->line++;

		str= (char *)pvPortMalloc(TELNETD_CONF_LINELEN);
		if(str == NULL) {
			return ERROR_MEM;
		}

	    va_start(vaArgP, pcString); // Start the varargs processing.
	    len = uvsnprintf(str, TELNETD_CONF_LINELEN, pcString, vaArgP);
	    va_end(vaArgP);

		cmd_out->lines[cmd_out->line] = str;
	}
	
	return len;
}