Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5   7.6    Statistic  

SerialPort.AvailableBytes

Queries number of bytes available in buffer.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SerialPort 4.4 Yes Yes Yes No No

MBS( "SerialPort.AvailableBytes"; PortReference )

Parameters

Parameter Description Example value
PortReference The reference number of the port. You get this number from SerialPort.Open when you open the port. $port

Result

Returns number or error.

Description

Queries number of bytes available in buffer.

Examples

Queries bytes and reads them:

$count = MBS( "SerialPort.AvailableBytes"; $PortReference )
$text = MBS( "SerialPort.Read"; $PortReference; $count; "windows" )

Read in loop as long as data comes in:

# read data until end
Set Variable [$data; Value:""]
Loop
    Pause/Resume Script [Duration (seconds): ,1]
    #exit when no more data
    Exit Loop If [not (MBS( "SerialPort.AvailableBytes"; $port ) > 0)]
    #read some data
    Set Variable [$newdata; Value:MBS( "SerialPort.Read"; $port; 10000; "windows" )]
    Set Variable [$data; Value:$data & $newdata]
    #next
    Pause/Resume Script [Duration (seconds): ,1]
End Loop

See also


SendMail.SetSubject   -   SerialPort.Clear

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins