Serial_Debug (function reference)

By May 10, 2017 August 6th, 2018 Online Help, Troi Serial Plug-in
Troi Serial Plug-in for FileMaker Pro

Serial_Debug

Use this function to troubleshoot the serial port and test scripting.

SyntaxFunction badge

Serial_Debug ( switches )

Parameters

switchesdetermine the behaviour of the function

Switches

switches can be one of this:

-BeepWhenDataArrivesthe plug-in will beep when data arrives at the serial port
-BeepOffthe plug-in no longer beeps when data arrives at the serial port
-TestTriggerScriptthe plug-in will trigger the dispatch script with some test data

You can also add this switch in combination with the -TestTriggerScript switch:

-UseTextAllBytes0To255sends a string with all bytes from 0-255 as the test data to the trigger script

Returned Result

Data type returned

Error code

Result

If successful it returns 0. If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:

$$-28notOpenErrmake sure you have opened a port and specified a dispatch script
$$-50paramErrthere was an error with the parameter (an unknown switch was given)

Other errors may be returned.

Originated in

Troi Serial Plug-in 3.0

Compatibility

FileMaker Pro 13 to 17

Considerations

To be able to test the trigger script the serial port must be opened and a dispatch script must be specified.

See the Debug.fmp12 example file.

NOTE The wait time to trigger the script is now 5 seconds (was 10 seconds).

Example

Set Field [ gErrorCode ; Serial_Debug ( "-BeepWhenDataArrives" ) ]

The plug-in will now beep when data arrives at the serial port. If data keeps on coming in, the plug-in will beep every 2 seconds.

How to test if data comes in:
– Set the plug-in to beep if data comes in.
– Get the device attached to the serial port to send data to the serial port.
– When you hear beeps you know data is arriving at the serial port and in the plug-in.
– To stop the beeping use this command:

Set Field [ gErrorCode ; Serial_Debug ( "-BeepOff" ) ]

Example 2

Serial_Debug ( "-TestTriggerScript" )

will trigger the dispatch script after 5 seconds.

You can also give this command:

Serial_Debug ( "-TestTriggerScript -UseTextAllBytes0To255" )

This will trigger the dispatch script after 5 seconds, the data received is a string with all the bytes from 0 to 255.

Related script stepsScript step badge

Beep for Serial Data
Trigger Serial Test Script

Related topics

Troi Serial Plug-in online help (overview)


Online Help Page for Troi Serial Plug-in for 13 to 17 –> Serial_Debug (serip4803) 2018-0806 08:43:38