Skip to main content

Serial_DataWasReceived (function reference)

By July 1, 2023July 17th, 2023Online Help, Troi Serial Plug-in
Troi Serial Plug-in > Functions reference > Serial_DataWasReceived
Troi Serial Plug-in for FileMaker Pro

Serial_DataWasReceived

Returns the name of the port when data was received on a serial port. Use this function to see if this is an event that needs to be handled.

SyntaxFunction badge

Serial_DataWasReceived ( switches )

Parameters

switches determines what is returned

Switches

Switches currently needs to be:

-FirstPortname return the name of the first port for which data was received

Returned Result

Data type returned

Text

Result

The returned result is either empty (no data was received) or a port name (data was received in the buffer for this port).

Originated in

Troi Serial Plug-in 3.0

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

When this function returns something else than “” you can get the data with the function Serial_Receive.

If you have opened more than one port, the plug-in just indicates the first portname (in its internal list) that has received data.
If you want to read the data from *all* open ports you should read this in a loop: read the data from the first portname and then loop and read from the next portname until there is no more data.

In some cases you might want to read the data from the ports in your own order. That is fine with the plug-in. The Serial_DataWasReceived function just helps in determining which port has data.

Example

Set Field [ gPortname ; Serial_DataWasReceived ( "-FirstPortname" ) ]
If [ gPortname = "COM1" ]
	Perform Script [ Sub-scripts ; “Process Data Received COM1" ]
Else
	... do something else
End If

Used in example file

Terminal.fmp12

Related functionFunction badge

Serial_Receive

Related topics

Troi Serial Plug-in online help (overview)


Online Help Page for Troi Serial Plug-in for 16 to 2023 –> Serial_DataWasReceived (serip4802) 2023-0717 12:46:59