Skip to content

Commit

Permalink
Revert "Makes the demo read-write happen more similar to how JMRI rea…
Browse files Browse the repository at this point in the history
…ds stuff from the nodes. (#184)" (#185)

This reverts commit 1cdf8bb.

Reverts #184

The new behavior seems to upset most of the tests that use this class.
  • Loading branch information
balazsracz authored Mar 27, 2021
1 parent 1cdf8bb commit 3881371
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/org/openlcb/cdi/impl/DemoReadWriteAccess.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.openlcb.cdi.impl;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
Expand All @@ -14,9 +12,6 @@
import org.jdom2.input.SAXBuilder;
import org.openlcb.implementations.MemoryConfigurationService;

import javax.swing.SwingUtilities;
import javax.swing.Timer;

/**
* Helper class for various demo and test code to put in as a fake into the ConfigRepresentation constructor.
* Created by bracz on 11/20/16.
Expand All @@ -35,18 +30,10 @@ public void doWrite(long address, int space, byte[] data, MemoryConfigurationSer
public void doRead(long address, int space, int length, MemoryConfigurationService.McsReadHandler handler) {
byte[] resp = new byte[length];
for (int i = 0; i < resp.length; ++i) {
resp[i] = 0;//(byte)(((address + i) % 91) + 32);
resp[i] = (byte)(((address + i) % 91) + 32);
}
Timer t = new Timer(40, new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
handler.handleReadData(null, space, address, resp);
logger.log(Level.ALL, "read {0} {1}", new Object[]{address, space});
System.out.println(address);
}
});
t.setRepeats(false);
t.start();
handler.handleReadData(null, space, address, resp);
logger.log(Level.INFO, "read {0} {1}", new Object[]{address, space});
}

static public ConfigRepresentation demoRepFromSample(Element root) {
Expand Down

0 comments on commit 3881371

Please sign in to comment.