public class MemoryConfigurationService extends Object
Meant to shield the using code from all the details of that process via read and write primitives.
Can accept requests without the using code having to serialize them.
Modifier and Type | Class and Description |
---|---|
static class |
MemoryConfigurationService.AddrSpaceDatagramMemo |
class |
MemoryConfigurationService.ConfigDatagramMemo |
private static class |
MemoryConfigurationService.McsAddressedRequestMemo
Common base class for all request/response memos that take a space byte and an address
offset, such as read, write, read stream, write stream.
|
static class |
MemoryConfigurationService.McsAddrSpaceMemo |
static class |
MemoryConfigurationService.McsConfigMemo |
static interface |
MemoryConfigurationService.McsReadHandler |
(package private) static class |
MemoryConfigurationService.McsReadMemo |
private static class |
MemoryConfigurationService.McsRequestMemo |
static interface |
MemoryConfigurationService.McsWriteHandler |
(package private) static class |
MemoryConfigurationService.McsWriteMemo |
static class |
MemoryConfigurationService.McsWriteStreamMemo |
private static interface |
MemoryConfigurationService.RequestWithNoReply
Request memos that do not have to receive a reply datagram must implement this method in
order to allow the datagram transmit OK to be forwarded back to the client.
|
private static interface |
MemoryConfigurationService.RequestWithReplyDatagram
Request memos that can receive a reply must implement this method to handle the response
datagram.
|
class |
MemoryConfigurationService.WriteStreamMemo |
Constructor and Description |
---|
MemoryConfigurationService(MemoryConfigurationService mcs) |
MemoryConfigurationService(NodeID here,
DatagramService downstream) |
private static final Logger logger
private static final int DATAGRAM_TYPE
public static final int SPACE_CDI
public static final int SPACE_ALL_MEM
public static final int SPACE_CONFIG
public static final int SPACE_ACDI_CONST
public static final int SPACE_ACDI_USER
public static final int SPACE_TRACTION_FDI
public static final int SPACE_TRACTION_FUNCTION
private static final int SUBCMD_REPLY
private static final int SUBCMD_ERROR
private static final int SUBCMD_WRITE
private static final int SUBCMD_WRITE_STREAM
private static final int SUBCMD_READ
private static final int SUBCMD_READ_STREAM
private static final long TIMEOUT
private long timeoutMillis
private static final long MAX_TRIES
NodeID here
DatagramService downstream
private Timer retryTimer
final Map<Integer,MemoryConfigurationService.McsRequestMemo> pendingRequests
final Map<Integer,ArrayDeque<MemoryConfigurationService.McsRequestMemo>> queuedRequests
MemoryConfigurationService.McsWriteStreamMemo writeStreamMemo
MemoryConfigurationService.McsConfigMemo configMemo
MemoryConfigurationService.McsAddrSpaceMemo addrSpaceMemo
public MemoryConfigurationService(NodeID here, DatagramService downstream)
here
- our node IDdownstream
- Connection in the direction of the layoutpublic MemoryConfigurationService(MemoryConfigurationService mcs)
public void setTimeoutMillis(long t)
public void waitForTimer() throws InterruptedException
InterruptedException
- if interruptedpublic static int getSpaceFromPayload(int[] data)
public static int getRequestTypeFromResponseType(int subCmd)
subCmd
- data[1] of an incoming response.private void checkAndPopMemo(MemoryConfigurationService.McsRequestMemo memo)
memo
- the memo to test.private boolean isBlockingPendingQueue(MemoryConfigurationService.McsRequestMemo memo)
memo
- a request memoprivate void delayRetryMemo(MemoryConfigurationService.McsRequestMemo memo)
memo
- request memo with expected response.private void sendRequest(MemoryConfigurationService.McsRequestMemo memo)
public void request(MemoryConfigurationService.McsRequestMemo memo)
public void requestWrite(NodeID dest, int space, long address, byte[] data, MemoryConfigurationService.McsWriteHandler cb)
public void requestRead(NodeID dest, int space, long address, int len, MemoryConfigurationService.McsReadHandler cb)
public void request(MemoryConfigurationService.McsWriteStreamMemo memo)
public void request(MemoryConfigurationService.McsConfigMemo memo)
public void request(MemoryConfigurationService.McsAddrSpaceMemo memo)
private void checkAndPopConfigMemo(MemoryConfigurationService.McsConfigMemo memo)
private void checkAndPopAddrspaceMemo(MemoryConfigurationService.McsAddrSpaceMemo memo)
public void dispose()
Copyright © 2018 The OpenLCB Group. All rights reserved.