Class BinaryMsgClient

java.lang.Object
com.kosdev.kos.commons.core.client.binarymsg.BinaryMsgClient

public class BinaryMsgClient extends Object
Client for BinaryMsg protocol. Allows adapter simulators to be written in java.
Since:
1
Version:
1
  • Field Details

  • Constructor Details

    • BinaryMsgClient

      public BinaryMsgClient(String blinkName, BinaryMsgIdentity identity, String server, int port)
      Create a new client.
      Parameters:
      blinkName - name of the blink connection
      identity - the identity to send, null for default
      server - server address, null for localhost
      port - server port, 0 for default
      Since:
      1
  • Method Details

    • getByteOrder

      public ByteOrder getByteOrder()
      Get the byte order of the client.
      Since:
      1
    • addIface

      public void addIface(BinaryMsgClientIface iface)
      Add a new iface to the client.
      Since:
      1
    • addBoardIface

      public void addBoardIface(String type, String instanceId, String identity, String mfgSerialNum)
      Add Board iface with the specified board info.
      Parameters:
      type - board type
      instanceId - instance of the board
      identity - unique identifier such as mac addr or serial num
      mfgSerialNum - serial number if available
    • setEnabled

      public void setEnabled(boolean enabled)
      Enable the client. This simply calls start() or stop() based on the provided value.
      Parameters:
      enabled - true to start the client, false to stop it
    • isEnabled

      public boolean isEnabled()
      Return true if the client is enabled. This returns true if the client has been started.
    • start

      public void start()
      Connect to the server and start processing messages.
      Since:
      1
    • stop

      public void stop()
      Disconnect from the server.
      Since:
      1
    • send

      public void send(BinaryMsg msg) throws IOException
      Send a message to the remote side of the connection.
      Parameters:
      msg - the message to send
      Throws:
      IOException
      Since:
      1
    • getCoreIface

      public BinaryMsgClientIface getCoreIface()