Component: Injector (vNet) (Simulation)

From Flowcode Help
Revision as of 12:13, 21 July 2016 by BenR (talk | contribs) (XML import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


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


Image Injector (vNet) component

Comms data injector to allow components to talk to each other between instances of Flowcode. The injector allows the data to be sent and received between multiple instances of Flowcode either running on a single machine, across a network or via the internet.

Examples

Here is a set of example files demonstrating how to connect two instances of Flowcode up using the Vnet injector component.


This example file is set to listen to incoming data on port 4000 and send outgoing data on port 4001, the TCP channel used is 6. Any incoming data is incremented by one and echoed back out to the sender. FC6 Icon.png Vnet Example 1 This example file is set to listen to incoming data on port 4001 and send outgoing data on port 4000, the TCP channel used is 7. Pressing the switch on the panel allows the example to send out comms data which is received by the Vnet1 program. FC6 Icon.png Vnet Example 2 Here is a example of the console data being passed by the Vnet injector component.

VnetComms.jpg


When using multiple instances of the Vnet injector component on the same PC you must remember to assign different port numbers to the outgoing and incoming data. Otherwise the sending node will simply receive back it's own outgoing data. You must also take care to ensure that every Vnet node running on the same PC uses a different TCP Channel to avoid any problems with the communications DLL.

VnetPorts.jpg

Downloadable macro reference

This component does not contain any downloadable macros

Simulation macro reference

This component inherits simulation macros from Data Injector

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


TxByte

Puts a byte onto the comms channel.

Parameters

BYTE DataByte


Return value

This call does not return a value


RxByte

Gets a byte from the comms channel - 255 signifies no more data available

Parameters

This macro has no parameters


Return value

BYTE


GetTxConsoleHandle

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

This call is provided by Data Injector

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

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

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

Network Interface

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

Allows different network interfaces to be selected.

The current network interface can be determined by looking at the My IP properties.

TCP Channel

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

TCP Channel Instance, allows multiple servers and clients to run on the same machine or inside the same simulation.

Incoming Port

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

Port used for incoming communications. 80=HTTP

Ports have to match up to allow communications to be sent and received.

Outgoing Port

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

Port used for outgoing communications. 80=HTTP

Ports have to match up to allow communications to be sent and received.

Connection Mode

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

Specified if this Vnet node is going to connect to another instance of Flowcode running on this PC or a networked PC.

Circular Buffer Size

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

Size of the circular buffers used to temporarily store the incoming and outgoing data.

Remote IP0

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

Remotel IP address to connect to byte 0

Remote IP1

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

Remotel IP address to connect to byte 1

Remote IP2

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

Remotel IP address to connect to byte 2

Remote IP3

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

Remotel IP address to connect to byte 3

My IP0

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

Local IP address byte 0

My IP1

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

Local IP address byte 1

My IP2

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

Local IP address byte 2

My IP3

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

Local IP address byte 3