public class UartBus extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
protected Closeable |
connResource |
protected int |
fromAddress |
protected eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> |
invalidPackets |
protected static eu.javaexperience.log.Logger |
LOG |
protected eu.javaexperience.patterns.behavioral.mediator.EventMediator<ParsedUartBusPacket> |
onNewValidPackageReceived |
protected LinkedList<UartbusTransaction> |
pendingRequests |
protected eu.javaexperience.interfaces.simple.publish.SimplePublish1<byte[]> |
sendPacket |
protected eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> |
unrelatedPackets |
Constructor and Description |
---|
UartBus(Closeable resource,
eu.javaexperience.interfaces.simple.publish.SimplePublish1<byte[]> sendPacket,
int fromAddress) |
Modifier and Type | Method and Description |
---|---|
void |
addPendingRequest(UartbusTransaction req) |
void |
close() |
UartBusDevice |
device(int addr) |
static UartBus |
fromConnection(eu.javaexperience.interfaces.simple.SimpleGet<UartbusConnection> gSrv,
Closeable onClose,
int busFromAddress) |
static UartBus |
fromConnection(UartbusConnection srv,
boolean closeConnOnClose,
int busFromAddress) |
static UartBus |
fromTcp(String ip,
int port,
int fromAddress) |
int |
getFromAddress() |
eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> |
getInvalidPacketListener() |
eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> |
getUnrelatedPacketListener() |
UartbusTransaction |
newTransaction(int to,
byte[] path,
byte[] payloadData,
boolean zeroNamespaceAnswer) |
void |
processPacket(byte[] packet) |
boolean |
revokePendingRequest(UartbusTransaction req) |
void |
sendRawPacket(byte[] data) |
UartbusTransaction |
subscribeResponse(int from,
int to,
byte[] path,
boolean zeroNamespace) |
protected static final eu.javaexperience.log.Logger LOG
protected Closeable connResource
protected int fromAddress
protected eu.javaexperience.interfaces.simple.publish.SimplePublish1<byte[]> sendPacket
protected final eu.javaexperience.patterns.behavioral.mediator.EventMediator<ParsedUartBusPacket> onNewValidPackageReceived
protected final LinkedList<UartbusTransaction> pendingRequests
protected final eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> invalidPackets
protected final eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> unrelatedPackets
public UartBus(Closeable resource, eu.javaexperience.interfaces.simple.publish.SimplePublish1<byte[]> sendPacket, int fromAddress)
public eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> getInvalidPacketListener()
public eu.javaexperience.patterns.behavioral.mediator.EventMediator<byte[]> getUnrelatedPacketListener()
public void processPacket(byte[] packet)
public void addPendingRequest(UartbusTransaction req)
public boolean revokePendingRequest(UartbusTransaction req)
public UartbusTransaction newTransaction(int to, byte[] path, byte[] payloadData, boolean zeroNamespaceAnswer) throws IOException
IOException
public UartbusTransaction subscribeResponse(int from, int to, byte[] path, boolean zeroNamespace)
public static UartBus fromTcp(String ip, int port, int fromAddress) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public int getFromAddress()
public UartBusDevice device(int addr)
public void sendRawPacket(byte[] data)
public static UartBus fromConnection(UartbusConnection srv, boolean closeConnOnClose, int busFromAddress)
public static UartBus fromConnection(eu.javaexperience.interfaces.simple.SimpleGet<UartbusConnection> gSrv, Closeable onClose, int busFromAddress)
Copyright © 2020. All rights reserved.