Home > Language Reference > Classes > StreamSerial

Ready Property

Number of bytes ready for reading or writing in a buffer.

Syntax

Public Property Get Ready(ByVal eDirection As HbStream) As Long

ParameterDescription
eDirectionSpecifies the buffer to test.

Remarks

The Ready property returns the number of bytes waiting in the internal buffers. The eDirection parameter can take one of the following two values, and specifies which buffer to test:

ConstantDescription
hbStreamReadThe input buffer is tested.
hbStreamWriteThe output buffer is tested.

This property is typically used together with a timer to carry out polling on a port. The following example illustrates this, by assuming that the application is waiting for a packet of 10 bytes:

Private sComm as new StreamSerial
Private Tim as new Timer

Private Sub Form_Load()
  sComm.Open hbPortIrComm, 57600
  Tim.Interval=200
  Tim.Enabled=True
End Sub

Private Sub Form_Unload()
  Tim.Enabled=False
  sComm.Close
End Sub

Private Sub Tim_Timer()
  While sComm.Ready(hbStreamRead)>=10
    sComm.Read  ... ' reads a packet of 10 bytes
  Wend
End Sub

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.3N/A