Class FrameChannel


  • public class FrameChannel
    extends Object
    Class that wraps input/output streams to send and receive frames from a OpenWebNet gateway
    Author:
    M. Valla - Initial contribution
    • Field Detail

      • handshakeCompleted

        protected boolean handshakeCompleted
    • Method Detail

      • getName

        protected String getName()
      • sendFrame

        protected void sendFrame​(String frame)
                          throws IOException
        Sends a frame on the channel
        Parameters:
        frame - the frame
        Throws:
        IOException - in case of problems while writing on the OutputStream
      • readFrames

        protected String readFrames()
                             throws IOException
        Returns the first frame String from the readFrames queue. If queue is empty, tries to read (blocking read) available data from InputStream and extract all frames terminated with "##" putting them in the readFrames queue. If no new frame can be read from InputStream because end of steam reached, returns null.
        Returns:
        the first frame already in the receiving queue, or the first new frame read from InputStream, or null if end of steam reached
        Throws:
        IOException - in case of problems while reading frames from InputStream
      • disconnect

        protected void disconnect()