Component: Injector (File) (Comms)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.0 (Release)
Category Comms
This inherits from Data Injector Template


Image Injector (File) component

Comms data injector to allow data to be streamed to and from a file during simulation. The component will read data from the incoming file and write data to the outgoing file.

Examples

Example to log the bytes sent via the UART RS232 component to a file as comma separated decimal numbers. FC6 Icon.png LogToFile Contents of the file in the Flowcode project directory after running the simulation.

FileWrite.jpg

Downloadable macro reference

This component does not contain any downloadable macros

Simulation macro reference

This component inherits simulation macros from Data Injector Template

InitialiseInjector

Sets up the injector ready to receive commands or send data

Parameters

<- STRING InjectorName
Name of the console that will be created
This parameter may be returned back to the caller


Return value

BYTE


RxByteCount

Returns the number of bytes currently sat in the receive buffer.

This call is provided by Data Injector Template

Parameters

This macro has no parameters


Return value

UINT


TxByte

Puts a byte onto the comms channel.

Parameters

BYTE DataByte


Return value

This call does not return a value


RxByte

Attempt to receive a byte back from the injector

0 - 255 = Valid data

256 = RX timeout no data available

Parameters

This macro has no parameters


Return value

UINT


GetTxConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

This call is provided by Data Injector Template

Parameters

This macro has no parameters


Return value

HANDLE


ChangeState

Changes the state for I2C or SPI type comms where the data bytes along are not enough to go on.

This call is provided by Data Injector Template

Parameters

BYTE NewState
Assigns new state, 0=default


Return value

This call does not return a value


GetRxConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

This call is provided by Data Injector Template

Parameters

This macro has no parameters


Return value

HANDLE


GetConsoleHandle

Gets the handle to the console allowing data displaying on the panel etc.

Parameters

This macro has no parameters


Return value

HANDLE



Property reference

Incoming File

This property is of type Filename and can be referenced with the variable name Incoming.

File to stream incoming data from.

File -> Communications component.

Parse Mode

This property is of type Fixed list of ints and can be referenced with the variable name ParseMode.

Specifies the way we read in the data from the file.

Detailed Byte : "z - 122 - 0x7a"

Raw : "z"

CSV Decimal : "122, "

CSV Hex : "0x7a, "

Display Mode

This property is of type Fixed list of ints and can be referenced with the variable name DisplayMode.

Specifies the way we show the data on the console.

Detailed Byte : "z - 122 - 0x7a"

Raw : "z"

CSV Decimal : "122, "

CSV Hex : "0x7a, "

Values Per Line

This property is of type Unsigned integer and can be referenced with the variable name ValsPerLineI.

Number of values to display on a single line of the data console.

0 = Infinite number of characters

Skip Timestamp

This property is of type True or false and can be referenced with the variable name SkipTimestamp.

A file populated with data from an injector may have a timestamp built in which we may not want to receive.

Yes: Skip first 22 characters of each line of data so we don't receive any of the timestamp info.

No: Read data normally.

Outgoing File

This property is of type Filename and can be referenced with the variable name Outgoing.

File to store outgoing data.

Communications component -> File

Clear On Init

This property is of type True or false and can be referenced with the variable name ResetOutgoing.

No - Append to the end of the file.

Yes - Empty file on initialise and start from the beginning of the file.

Data Mode

This property is of type Fixed list of ints and can be referenced with the variable name DataMode.

Specifies how the data is represented in the outgoing file.

Detailed Byte : "z - 122 - 0x7a"

Raw : "z"

CSV Decimal : "122, "

CSV Hex : "0x7a, "

Values Per Line

This property is of type Unsigned integer and can be referenced with the variable name ValsPerLine.

Number of values to display on a single line, applies to the file and data console.

0 = Infinite number of characters

Append Timestamp

This property is of type True or false and can be referenced with the variable name Timestamp.

Appends a timestamp to the beginning of every line relating to the time the first byte in the line was received.

Based on the PC system time.

Timestamp in the format "YY/MM/DD - HH:MM:SS - "