CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
test_console.h File Reference

The declarations in this header file correspond to the definitions in test_console.c. More...

#include <stdbool.h>
#include "test_args.h"

Go to the source code of this file.

Functions

bool TestConsoleCreate (bool multi_window_mode, int num_stats_lines)
 
void TestConsoleLogMessageCallback (const CdiLogMessageCbData *cb_data_ptr)
 
void TestConsoleStats (int x, int y, int attribute, const char *format_str,...)
 
void TestConsoleStatsHorzLine (int x, int y, int width)
 
void TestConsoleStatsRefresh (void)
 
void TestConsoleLog (CdiLogLevel log_level, const char *format_str,...)
 
void TestConsoleDestroy (bool abnormal_termination)
 

Detailed Description

The declarations in this header file correspond to the definitions in test_console.c.

Function Documentation

◆ TestConsoleCreate()

bool TestConsoleCreate ( bool multi_window_mode,
int num_stats_lines )

Initialize the console for either multi-window mode or stdout mode.

Parameters
multi_window_modeTrue to enable mutli-window mode, otherwise use stdout mode.
num_stats_linesNumber of lines to dedicate to statistics window.
Returns
Returns true if success, otherwise false is returned and the stdout console will be used.

◆ TestConsoleDestroy()

void TestConsoleDestroy ( bool abnormal_termination)

Destroy the resources used by the console. Doesn't do much unless multi-window mode is enabled.

Parameters
abnormal_terminationTrue if being terminated abnormally (ie. from a signal event handler). This will cause all console log API functions to be disabled to prevent other threads from generating erroneous log error messages.

◆ TestConsoleLog()

void TestConsoleLog ( CdiLogLevel log_level,
const char * format_str,
... )

Add a message to the console log window, if multi-window mode is enabled (no need to use TestConsoleStatsRefresh()). Otherwise just writes to stdout.

Parameters
log_levelThe log level for this message.
format_strFormat string specifier.
...The remaining parameters contain a variable length list of arguments.

◆ TestConsoleLogMessageCallback()

void TestConsoleLogMessageCallback ( const CdiLogMessageCbData * cb_data_ptr)

Callback function used by the log message callback feature.

Parameters
cb_data_ptrPointer to log message callback data.

◆ TestConsoleStats()

void TestConsoleStats ( int x,
int y,
int attribute,
const char * format_str,
... )

Put a message in the console log window if using mult-window mode, otherwise just write to stdout. NOTE: When in multi-window mode, must use TestConsoleStatsRefresh() to update the window.

Parameters
xConsole window X position.
yConsole window Y position.
attributeCharacter attribute. Use A_NORMAL for normal console output.
format_strPointer to format string.
...Variable list of string arguments.

◆ TestConsoleStatsHorzLine()

void TestConsoleStatsHorzLine ( int x,
int y,
int width )

Render a horizontal line on the stats console. NOTE: When in multi-window mode, must use TestConsoleStatsRefresh() to update the window.

Parameters
xConsole window X position.
yConsole window Y position.
widthColumn width of line to draw. Use 0 for full width of console.

◆ TestConsoleStatsRefresh()

void TestConsoleStatsRefresh ( void )

Refresh the status console window. Only used in multi-window mode.