Class BinaryMsgClient
java.lang.Object
com.kosdev.kos.commons.core.client.binarymsg.BinaryMsgClient
Client for
BinaryMsg protocol. Allows adapter simulators
to be written in java.- Since:
- 1
- Version:
- 1
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBinaryMsgClient(String blinkName, BinaryMsgIdentity identity, String server, int port) Create a new client. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBoardIface(String type, String instanceId, String identity, String mfgSerialNum) Add Board iface with the specified board info.voidaddIface(BinaryMsgClientIface iface) Add a new iface to the client.Get the byte order of the client.booleanReturn true if the client is enabled.voidSend a message to the remote side of the connection.voidsetEnabled(boolean enabled) Enable the client.voidstart()Connect to the server and start processing messages.voidstop()Disconnect from the server.
-
Field Details
-
DEFAULT_SERVER
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
-
Constructor Details
-
BinaryMsgClient
Create a new client.- Parameters:
blinkName- name of the blink connectionidentity- the identity to send, null for defaultserver- server address, null for localhostport- server port, 0 for default- Since:
- 1
-
-
Method Details
-
getByteOrder
Get the byte order of the client.- Since:
- 1
-
addIface
Add a new iface to the client.- Since:
- 1
-
addBoardIface
Add Board iface with the specified board info.- Parameters:
type- board typeinstanceId- instance of the boardidentity- unique identifier such as mac addr or serial nummfgSerialNum- serial number if available
-
setEnabled
public void setEnabled(boolean enabled) Enable the client. This simply callsstart()orstop()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
Send a message to the remote side of the connection.- Parameters:
msg- the message to send- Throws:
IOException- Since:
- 1
-
getCoreIface
-