public class InterProcessCommRxThread
extends java.lang.Object
InterProcessCommRx_ifc.execRxData(byte[], int, Address_InterProcessComm)
which's instance should be given by construction.
create(String, InterProcessCommRx_ifc)
or the constructor to create the instance
with the given receive port and the given callback on received data.
start()
to open the communication and start the receive thread. It returns false on failures, true on success.
shutdown()
to close and finish the receive thread.
createDstAddr(String)
to create a destination address for the given InterProcessComm for sending activities.
send(byte[], int, Address_InterProcessComm)
to send.
Modifier and Type | Field and Description |
---|---|
private boolean |
bEnablePrintfOnComm |
private int |
ctErrorTelg |
private byte[] |
data_rxBuffer
Use a static receive buffer.
|
private InterProcessCommRx_ifc |
execRxData
Reference to the execute routine on receiving data.
|
private InterProcessComm |
ipc |
private Address_InterProcessComm |
myAnswerAddress |
private int[] |
nrofBytesReceived |
private byte[] |
rxBuffer
For C: store the reference and length of the SimpleArray in the next structure.
|
private char |
state
State of function.
|
private java.lang.Thread |
thread |
private java.lang.Runnable |
threadRoutine |
static java.lang.String |
version
Version, history and license.
|
Constructor and Description |
---|
InterProcessCommRxThread(java.lang.String ownAddrIpc,
InterProcessCommRx_ifc execRxData)
Creates the communication but does not open it yet.
|
Modifier and Type | Method and Description |
---|---|
static InterProcessCommRxThread |
create(java.lang.String ownAddrIpc,
InterProcessCommRx_ifc execRxData)
Static method to create invokes the constructor.
|
Address_InterProcessComm |
createDstAddr(java.lang.String sAddr)
Create any destination address for the given InterprocessComm implementation.
|
private boolean |
openComm(boolean blocking) |
private void |
receiveAndExecute() |
private void |
runThread() |
int |
send(byte[] data,
int nrofBytesToSend,
Address_InterProcessComm dstAddr)
Send a telegram to the given dst.
|
void |
shutdown()
Shutdown the communication, close the thread.
|
boolean |
start()
Start opens the InterProcessComm and starts the receiver thread.
|
public static final java.lang.String version
Comm
which uses this class as super class yet.
private final InterProcessCommRx_ifc execRxData
private char state
private boolean bEnablePrintfOnComm
private final InterProcessComm ipc
private int ctErrorTelg
private final java.lang.Thread thread
private final int[] nrofBytesReceived
private final byte[] data_rxBuffer
private final byte[] rxBuffer
private final Address_InterProcessComm myAnswerAddress
private final java.lang.Runnable threadRoutine
public InterProcessCommRxThread(java.lang.String ownAddrIpc, InterProcessCommRx_ifc execRxData)
start()
The InterProcessComm interface implementation is got depending on
ownAddrIpc
- The address String for receiving data. This String determines the kind of InterProcessComm.
Use "UDP:127.9.0.1:6000" to open an UDP-Communication for this example via loop-back on port 6000.
See InterProcessCommFactory
, InterProcessCommFactorySocket
.execRxData
- aggregation of executer of all commands.public static InterProcessCommRxThread create(java.lang.String ownAddrIpc, InterProcessCommRx_ifc execRxData)
ownAddrIpc
- execRxData
- public final Address_InterProcessComm createDstAddr(java.lang.String sAddr)
send(byte[], int, Address_InterProcessComm)
sAddr
- Proper String to create the address, see InterProcessComm.createAddress(String)
.
Hint: For Socket communication it should not start with "UDP:", only the own address on constructor should start with the protocol.
It should have the form "192.168.1.123:6000" with ip and port.private final boolean openComm(boolean blocking)
public final boolean start()
public final int send(byte[] data, int nrofBytesToSend, Address_InterProcessComm dstAddr)
InterProcessComm.send(byte[], int, Address_InterProcessComm)
.
An address should be create using createDstAddr(String)
.data
- nrofBytesToSend
- dstAddr
- private final void runThread()
private final void receiveAndExecute()
public final void shutdown()
#start(Object)
.