Suspend/Resume Serial Port (script step reference)

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 contentsreplaces the contents of a field with the result. If you do not use Select entire contents, the result is added to the currently selected portion of the field
Result (error)an error code
Actionselect "Suspend" to suspend reading the incoming stream of data or select "Resume" to resume reading the incoming stream of data
Portnamethe 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:

0no errorthe action was performed
$$-28notOpenErrthe port is not open
$$-50paramErrthere was an error with the parameter

Other errors may be returned.

Originated in

Troi Serial Plug-in 9.0

Compatibility

FileMaker Pro 16

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

Online Help Page for Troi Serial Plug-in for 12 to 16 –> Suspend/Resume Serial Port (serip7801) 2017-0525 11:41:59