Skip to main content

Suspend/Resume Serial Port (script step reference)

By July 1, 2023July 17th, 2023Online Help, Troi Serial Plug-in
Troi Serial Plug-in > Script steps reference > Suspend/Resume Serial Port
Troi Serial Plug-in for FileMaker Pro

Suspend/Resume Serial Port

Suspends or resumes the serial port with the specified name. The port needs to be opened first.

SyntaxScript step badge

Suspend/Resume Serial Port [ Select ; Result (error) ; Action ; Portname ]

Options

Select entire contents replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error) an error code
Action select "Suspend" to suspend reading the incoming stream of data or select "Resume" to resume reading the incoming stream of data
Portname the name of the serial port to control

Returned Result

Data type returned

Error code

Result

The returned result is an error code. An error always starts with 2 dollars, followed by the error code. Returned error codes can be:

0 no error the action was performed
$$-28 notOpenErr the port is not open
$$-50 paramErr there was an error with the parameter

Other errors may be returned.

Originated in

Troi Serial Plug-in 5.0

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

The buffer will be emptied when the port is suspended. So when you resume, only the data received after you resume will be available. While suspended you can still send data to the serial port.

This script step is very useful for devices that send out continuous data, like an electronic weighing scale. See the Weigh.fmp12 example file.

The port needs to be opened first (see also the “Open Serial Port” script step).

Example

Suspend/Resume Serial Port [ Select ; $ErrorCode ;  Suspend ;  "COM1" ]

This will suspend the incoming stream of data of port COM1.

Example 2

For devices that send out continuous data, like an electronic weighing scale, you open the port and suspend the incoming data. Then when you want a reading you resume the incoming stream. The script will be like this:

Open Serial Port [ Select ; $ErrorCode ; $PortName ; 
                   $Settings ;
                   "" ; "" ]

Suspend/Resume Serial Port [ Select ; $ErrorCode ;  Suspend ;  $PortName ]

# Do other stuff here, until you need data from the device ...

# Now resume the serial port:
Suspend/Resume Serial Port [ Select ; $ErrorCode ;  Resume ;  $PortName ]
# Read data until you got the expected data:
Receive Serial Data [ $PortName ]
# Next line will suspend reception of data from the port in variable $PortName:
Suspend/Resume Serial Port [ Select ; $ErrorCode ; Suspend ; $PortName ]

Related script stepScript step badge

Open Serial Port

Related functionsFunction badge

Serial_Control
Serial_Open

Related topics

Troi Serial Plug-in online help (overview)


Online Help Page for Troi Serial Plug-in for 16 to 2023 –> Suspend/Resume Serial Port (serip7801) 2023-0717 13:16:02