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.
Syntax
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 function
Serial_Receive |
Related topics
Troi Serial Plug-in online help (overview)