The record table visualizer shows columns of data in a table. This page describes the methods implemented by the RecordTable class in the MegunoLink Arduino library to send data and control the Record table visualizer from your Arduino sketch. Refer to Record table for documentation on the visualizer.

Records Table visualizer

The RecordTable class sends data to the record table visualizer.

Methods

The RecordTable can work with rows or individual cells in the table. AddRow* methods append new rows to the end of the table while UpdateRow* methods modify existing rows. The SetValue method modifies an individual cell in the table. There are several variations of the *Row* methods for flexibility.

Generally, you can send any printable value to a record table. Sending the special value SpecialParameters::CurrentTime will have MegunoLink place the computer’s current time into the corresponding cell of the table. See record table visualizer for an example.

The following methods are available for a RecordTable:

Method Descriptions

Record Table Constructor

Creates a RecordTable variable, which can be used to send commands to MegunoLink to add data to and control a Record table visualizer.

RecordTable(const char *Channel = NULL, Print &Destination = Serial);
RecordTable(const __FlashStringHelper *Channel, Print &Destination = Serial);
RecordTable(Print& Destination);

Parameters
Name Type Required? Description
Channel const char *, const __FlashStringHelper No The name of the destination channel for report table messages. Defaults to the broadcast channel (NULL).
Destination Print & No Sets the serial connection to use for sending messages to MegunoLink. Defaults to Serial, the default Arduino RS232 port.

AddRow

Adds a new row of data to a table filling in columns with the values supplied. You can supply as many values as you like to the AddRow function (it is a variadic template). Values are added to columns in the new row in logical column order. Extra values are discarded if more values are supplied than there are columns in the visualizer table.
void AddRow(Type… Values);

Parameters
Name Type Required? Description
Values Type… Yes The column values to send to the record table. Pass one value for each column. Any type supported by the Arduino print method is supported including int, String, const char* etc.

AddRowWithIds

Adds a new row of data to a table. The target column for each new value is set by a matching entry in an array of column ids. The column ids supplied are matched to the id of a column set in MegunoLink. Values can be mixed types.
void AddRowWithIds(int NumberOfIds, const uint8_t *ColumnIds, Types... Values);

Parameters
Name Type Required? Description
NumberOfIds int Yes The number of ids in ColumnIds and the number of Values to send to MegunoLink
ColumnIds const uint8_t * Yes Array of ids for the column in MegunoLink where the corresponding value should be placed
Values Types… Yes The column values to send to the record table. Pass at least NumberOfIds values. Each values is placed in the column with the matching column id from ColumnIds. Values may be any type supported by the Arduino print method including int, String, const char* etc.

AddRowFromArray

Adds a new row of data to a table filling in columns, in logical column order, from values supplied in an array.
void AddRowFromArray(int NumberOfValues, TValue *Values);

Parameters
Name Type Required? Description
NumberOfValues int Yes Number of values in the Values array to send to MegunoLink
Values TValue * Yes An array of (at least) NumberOfValues values to send to MegunoLink. The values from the array are added to columns of the table. The array type may be any type supported by the Arduino print method including int, String, const char* etc.

AddRowFromArrayWithIds

Adds a new row of data to a table. The target column for each new value is set by a matching entry in an array of column ids. The column ids supplied are matched to the id of a column set in MegunoLink.
void AddRowFromArrayWithIds(int NumberOfIds, const uint8_t *ColumnIds, TValue *Values);

Parameters
Name Type Required? Description
NumberOfIds int Yes Number of column ids in the ColumnIds and Values arrays
ColumnIds const uint8_t * Yes Array of ids for the column in MegunoLink where the corresponding value should be placed
Values TValues Yes An array of NumberOfIds values for columns in the new row of the record table. Each values is placed in the column with the matching column id from ColumnIds. The array type may be type supported by the Arduino print method including int, String, const char* etc.

UpdateRow

Updates an existing row of data in the table, replacing values in columns with the new values supplied. The row to update is identified by number, with the first row in the table as row 0.

You can supply as many values as you like to the UpdateRow function (it is a variadic template). Values are added to columns in the new row in logical column order. If there are more values supplied than columns in the visualizer table, additional values are discarded.
void UpdateRow(int RowNumber, Types… Values);

Parameters
Name Type Required? Description
RowNumber int Yes The number of the row to update in the table (counting from 0). Additional rows are added automatically if the table contains fewer rows.
Values Types… Yes The column values to send to the record table. Pass one value for each column. Any type supported by the Arduino print method is supported including int, String, const char* etc.

UpdateRowWithIds

Updates an existing row of data in the table, replacing values in columns with the new values supplied. The row to update is identified by number, with the first row of the table as row 0.

Values are mapped to columns by matching the corresponding id in the array of column ids to the id of the column set in MegunoLink. Columns not included in the array remain unchanged. Values can be mixed types.
void UpdateRowWithIds(int RowNumber, int NumberOfIds, const uint8_t *ColumnIds, Types... Values);

Parameters
Name Type Required? Description
RowNumber int Yes The number of the row to update in the table (counting from 0). Additional rows are added automatically if the table contains fewer than RowNumber rows.
NumberOfIds int Yes The number of column ids in the ColumnIds array and values supplied.
ColumnIds const uint8_t * Yes Array of ids for the column in MegunoLink where the corresponding value should be placed
Values Types… Yes NumberOfIds column values to send to the record table. Each values is placed in the column with the matching column id from ColumnIds. Values may be type supported by the Arduino print method including int, String, const char* etc.

UpdateRowFromArray

Updates an existing row of data in the table, replacing column values with the new values supplied in an array. Columns are filled in logical column order. The row to update is identified by row-number, counting from 0.

void UpdateRowFromArray(int RowNumber, int NumberOfValues, TValue *Values);

Parameters
Name Type Required? Description
RowNumber int Yes The row-number to update (counting from 0). Rows are added automatically if the table contains fewer than RowNumber rows.
NumberOfValues int Yes Number of values in the Values array to send to MegunoLink
Values TValue * Yes An array of (at least) NumberOfValues values to send to MegunoLink. The values from the array replace data already in the table. The array type may be any type of values supported by the Arduino print method including int, String, const char* etc.

UpdateRowFromArrayWithIds

Updates an existing row of data in the table, replacing column values with the new values supplied. The row updated is identified by a number, with the first row in the table as row 0.

Values are mapped to columns by matching the corresponding id in the array of column ids to the id of the column set in MegunoLink.
void UpdateRowFromArrayWithIds(int RowNumber, int NumberOfIds, const uint8_t *ColumnIds, TValue *Values);

Parameters
Name Type Required? Description
RowNumber int Yes The number of the row to update in the table (counting from 0). Additional rows are automatically added if the table contains fewer than RowNumber rows.
NumberOfIds int Yes Number of column ids in the ColumnIds and Values arrays
ColumnIds const uint8_t * Yes Array of NumberOfIds ids for the column in MegunoLink where the corresponding value should be placed
Values TValues Yes An array of NumberOfIds values for columns in the new row of the record table. Each value is placed in the column with the matching column id from ColumnIds. The array type may be any type supported by the Arduino print method including int, String, const char* etc.

SetValue

Sets the value in a cell identified by a row, column index. Rows and columns are both counted from 0.

void SetValue(int RowNumber, int ColumnNumber, TValue Value);

Parameters
Name Type Required? Description
RowNumber int Yes The number of the row to update in the table (counting from 0). Additional rows are automatically added if the table contains fewer than RowNumber rows.
ColumnNumber int Yes The number of the row to update in the table (counting from 0). Must be less than the number of columns present in the table; columns are not automatically added if the table contains fewer than ColumnNumber columns.
Value TValue Yes The value to place in cell (RowNumber, ColumnNumber). Values may be any type supported by the Arduino print method including int, String, const char* etc.

ClearRow

Removes the content from a row in the record table.

void ClearRow(int RowNumber);

Parameters
Name Type Required? Description
RowNumber int Yes The row-number in the table to clear.

ClearAllRows

Removes all the content from the record table.

void ClearAllRows();

Leave a Comment

Start typing and press Enter to search