|
From: <jac...@us...> - 2012-05-20 20:27:18
|
Revision: 2258
http://openlcb.svn.sourceforge.net/openlcb/?rev=2258&view=rev
Author: jacobsen
Date: 2012-05-20 20:27:12 +0000 (Sun, 20 May 2012)
Log Message:
-----------
adapt to updated datagramService; order next message when reading
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java
trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java
Modified: trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java 2012-05-20 20:26:24 UTC (rev 2257)
+++ trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java 2012-05-20 20:27:12 UTC (rev 2258)
@@ -1,11 +1,9 @@
package org.openlcb.implementations;
-import org.openlcb.*;
+import net.jcip.annotations.Immutable;
+import net.jcip.annotations.ThreadSafe;
+import org.openlcb.NodeID;
-// For annotations
-import net.jcip.annotations.*;
-import edu.umd.cs.findbugs.annotations.*;
-
/**
* Service for reading and writing via the Memory Configuration protocol
*
@@ -32,7 +30,9 @@
// nor to multiple nodes
//
// doesn't check for match of reply to memo, but eventually should.
- public int handleData(NodeID dest, int[] data) {
+ @Override
+ public void handleData(NodeID dest, int[] data, DatagramService.ReplyMemo service) {
+ service.acceptData(0);
if (readMemo != null) {
byte[] content = new byte[data.length-6];
for (int i = 0; i<content.length; i++) content[i] = (byte)data[i+6];
@@ -61,7 +61,6 @@
addrSpaceMemo = null;
memo.handleConfigData(dest, space, highAddress, lowAddress, flags, "");
}
- return 0;
}
});
}
@@ -110,11 +109,12 @@
this.dest = dest;
}
- int count;
- long address;
- int space;
- NodeID dest;
+ final int count;
+ final long address;
+ final int space;
+ final NodeID dest;
+ @Override
public boolean equals(Object o) {
if (o == null) return false;
if (! (o instanceof McsReadMemo)) return false;
@@ -125,10 +125,12 @@
return this.count == m.count;
}
+ @Override
public String toString() {
return "McsReadMemo: "+address;
}
+ @Override
public int hashCode() { return dest.hashCode()+space+((int)address)+count; }
/**
@@ -170,6 +172,7 @@
this.memo = memo;
}
McsReadMemo memo;
+ @Override
public void handleReply(int code) {
memo.handleWriteReply(code);
}
@@ -186,10 +189,11 @@
}
byte[] data;
- long address;
- int space;
- NodeID dest;
+ final long address;
+ final int space;
+ final NodeID dest;
+ @Override
public boolean equals(Object o) {
if (o == null) return false;
if (! (o instanceof McsWriteMemo)) return false;
@@ -203,10 +207,12 @@
return true;
}
+ @Override
public String toString() {
return "McsWriteMemo: "+address;
}
+ @Override
public int hashCode() { return this.data.length+this.data[0]+dest.hashCode()+((int)address)+space; }
/**
@@ -257,8 +263,9 @@
this.dest = dest;
}
- NodeID dest;
+ final NodeID dest;
+ @Override
public boolean equals(Object o) {
if (o == null) return false;
if (! (o instanceof McsConfigMemo)) return false;
@@ -266,10 +273,12 @@
return this.dest == m.dest;
}
+ @Override
public String toString() {
return "McsConfigMemo";
}
+ @Override
public int hashCode() { return dest.hashCode(); }
/**
Modified: trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java 2012-05-20 20:26:24 UTC (rev 2257)
+++ trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java 2012-05-20 20:27:12 UTC (rev 2258)
@@ -1,11 +1,10 @@
package org.openlcb.implementations;
-import org.openlcb.*;
-
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.openlcb.*;
/**
* @author Bob Jacobsen Copyright 2012
@@ -21,10 +20,12 @@
DatagramService datagramService;
MemoryConfigurationService service;
+ @Override
public void setUp() {
messagesReceived = new java.util.ArrayList<Message>();
flag = false;
testConnection = new AbstractConnection(){
+ @Override
public void put(Message msg, Connection sender) {
messagesReceived.add(msg);
}
@@ -56,7 +57,7 @@
Assert.assertTrue(m20.equals(m20));
Assert.assertTrue(m20.equals(m20a));
- Assert.assertTrue(!m20.equals(null));
+ Assert.assertTrue(m20 != null);
Assert.assertTrue(!m20.equals(m21));
Assert.assertTrue(!m20.equals(m22));
@@ -86,7 +87,7 @@
Assert.assertTrue(m20.equals(m20));
Assert.assertTrue(m20.equals(m20a));
- Assert.assertTrue(!m20.equals(null));
+ Assert.assertTrue(m20 != null);
Assert.assertTrue(!m20.equals(m21));
Assert.assertTrue(!m20.equals(m22));
@@ -152,9 +153,11 @@
int length = 4;
MemoryConfigurationService.McsReadMemo memo =
new MemoryConfigurationService.McsReadMemo(farID, space, address, length) {
+ @Override
public void handleWriteReply(int code) {
flag = true;
}
+ @Override
public void handleReadData(NodeID dest, int space, long address, byte[] data) {
flag = true;
}
@@ -215,7 +218,7 @@
Assert.assertTrue(m20.equals(m20));
Assert.assertTrue(m20.equals(m20a));
- Assert.assertTrue(!m20.equals(null));
+ Assert.assertTrue(m20 != null);
Assert.assertTrue(!m20.equals(m21));
@@ -224,9 +227,11 @@
public void testGetConfig() {
MemoryConfigurationService.McsConfigMemo memo =
new MemoryConfigurationService.McsConfigMemo(farID) {
+ @Override
public void handleWriteReply(int code) {
flag = true;
}
+ @Override
public void handleConfigData(NodeID dest, int commands, int lengths, int highSpace, int lowSpace, String name) {
flag = true;
}
@@ -278,7 +283,7 @@
Assert.assertTrue(m20.equals(m20));
Assert.assertTrue(m20.equals(m20a));
- Assert.assertTrue(!m20.equals(null));
+ Assert.assertTrue(m20 != null);
Assert.assertTrue(!m20.equals(m22));
Assert.assertTrue(!m20.equals(m23));
@@ -289,9 +294,11 @@
int space = 0xFD;
MemoryConfigurationService.McsAddrSpaceMemo memo =
new MemoryConfigurationService.McsAddrSpaceMemo(farID, space) {
+ @Override
public void handleWriteReply(int code) {
flag = true;
}
+ @Override
public void handleConfigData(NodeID dest, int space, long hiAddress, long lowAddress, int flags, String desc) {
flag = true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-05-20 20:27:47
|
Revision: 2259
http://openlcb.svn.sourceforge.net/openlcb/?rev=2259&view=rev
Author: jacobsen
Date: 2012-05-20 20:27:42 +0000 (Sun, 20 May 2012)
Log Message:
-----------
0.4.10
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-05-20 20:27:12 UTC (rev 2258)
+++ trunk/prototypes/java/manifest 2012-05-20 20:27:42 UTC (rev 2259)
@@ -7,6 +7,6 @@
Specification-Version: \xD20.4.2\xD3
Specification-Vendor: \xD2OpenLCB group"
Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.4.9\xD3
+Package-Version: \xD20.4.10\xD3
Package-Vendor: \xD2OpenLCB group\xD3
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-05-20 23:29:00
|
Revision: 2268
http://openlcb.svn.sourceforge.net/openlcb/?rev=2268&view=rev
Author: jacobsen
Date: 2012-05-20 23:28:54 +0000 (Sun, 20 May 2012)
Log Message:
-----------
with replicated labels
Modified Paths:
--------------
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-05-21 03:03:15
|
Revision: 2274
http://openlcb.svn.sourceforge.net/openlcb/?rev=2274&view=rev
Author: jacobsen
Date: 2012-05-21 03:03:09 +0000 (Mon, 21 May 2012)
Log Message:
-----------
0.5.1
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-05-21 03:01:45 UTC (rev 2273)
+++ trunk/prototypes/java/manifest 2012-05-21 03:03:09 UTC (rev 2274)
@@ -4,9 +4,9 @@
Name: org.openlcb
Specification-Title: \xD2OpenLCB\xD3
-Specification-Version: \xD20.4.2\xD3
+Specification-Version: \xD20.5.1\xD3
Specification-Vendor: \xD2OpenLCB group"
Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.4.10\xD3
+Package-Version: \xD20.5.1\xD3
Package-Vendor: \xD2OpenLCB group\xD3
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-05-25 04:04:05
|
Revision: 2306
http://openlcb.svn.sourceforge.net/openlcb/?rev=2306&view=rev
Author: jacobsen
Date: 2012-05-25 04:03:58 +0000 (Fri, 25 May 2012)
Log Message:
-----------
other address handling
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/implementations/DatagramMeteringBuffer.java
trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java
trunk/prototypes/java/test/org/openlcb/implementations/DatagramMeteringBufferTest.java
trunk/prototypes/java/test/org/openlcb/implementations/DatagramServiceTest.java
Modified: trunk/prototypes/java/src/org/openlcb/implementations/DatagramMeteringBuffer.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/implementations/DatagramMeteringBuffer.java 2012-05-25 04:03:15 UTC (rev 2305)
+++ trunk/prototypes/java/src/org/openlcb/implementations/DatagramMeteringBuffer.java 2012-05-25 04:03:58 UTC (rev 2306)
@@ -56,7 +56,7 @@
@Override
public void put(Message msg, Connection toUpstream) {
if (msg instanceof DatagramMessage)
- queue.add(new MessageMemo(msg, toUpstream, toDownstream));
+ queue.add(new MessageMemo((DatagramMessage)msg, toUpstream, toDownstream));
else
toDownstream.put(msg, fromDownstream);
}
@@ -73,11 +73,11 @@
}
class MessageMemo extends MessageDecoder {
- Message message;
+ DatagramMessage message;
Connection toDownstream;
Connection toUpstream;
- MessageMemo(Message msg, Connection toUpstream, Connection toDownstream) {
+ MessageMemo(DatagramMessage msg, Connection toUpstream, Connection toDownstream) {
message = msg;
this.toUpstream = toUpstream;
this.toDownstream = toDownstream;
@@ -103,9 +103,13 @@
* Handle "Datagram Rejected" message
*/
@Override
- public void handleDatagramRejected(DatagramRejectedMessage msg, Connection sender){
- // need to check if this is from right source
-
+ public void handleDatagramRejected(DatagramRejectedMessage msg, Connection sender) {
+ // check if this is from right source & to us
+ if ( ! (msg.getDestNodeID().equals(message.getSourceNodeID()) && message.getDestNodeID().equals(msg.getSourceNodeID()) ) ) {
+ // not for us, just forward
+ toUpstream.put(msg, toUpstream);
+ return;
+ }
// check if resend permitted
if (msg.canResend()) {
toDownstream.put(message, fromDownstream);
Modified: trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java 2012-05-25 04:03:15 UTC (rev 2305)
+++ trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java 2012-05-25 04:03:58 UTC (rev 2306)
@@ -48,6 +48,9 @@
*/
@Override
public void handleDatagram(DatagramMessage msg, Connection sender){
+ // ignore if not for here
+ if (!msg.getDestNodeID().equals(here)) return;
+
// forward
int retval = DEFAULT_ERROR_CODE;
ReplyMemo replyMemo = new ReplyMemo(msg, downstream, here, this);
@@ -68,7 +71,7 @@
*/
@Override
public void handleDatagramRejected(DatagramRejectedMessage msg, Connection sender){
- if (xmtMemo != null) {
+ if (xmtMemo != null && msg.getDestNodeID().equals(here) && xmtMemo.dest.equals(msg.getSourceNodeID()) ) {
xmtMemo.handleReply(msg.getCode());
}
xmtMemo = null;
@@ -79,7 +82,7 @@
*/
@Override
public void handleDatagramAcknowledged(DatagramAcknowledgedMessage msg, Connection sender){
- if (xmtMemo != null) {
+ if (xmtMemo != null && msg.getDestNodeID().equals(here) && xmtMemo.dest.equals(msg.getSourceNodeID()) ) {
xmtMemo.handleReply(0);
}
xmtMemo = null;
Modified: trunk/prototypes/java/test/org/openlcb/implementations/DatagramMeteringBufferTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/implementations/DatagramMeteringBufferTest.java 2012-05-25 04:03:15 UTC (rev 2305)
+++ trunk/prototypes/java/test/org/openlcb/implementations/DatagramMeteringBufferTest.java 2012-05-25 04:03:58 UTC (rev 2306)
@@ -127,6 +127,36 @@
Assert.assertTrue(repliesReturned1.get(0).equals(replyOK));
}
+ public void testSendReplyOtherNakNoInterfere() throws InterruptedException {
+ buffer.put(datagram1, replyConnection1);
+
+ Thread.currentThread().sleep(10);
+
+ Message otherReply = new DatagramRejectedMessage(farID, farID, 0x210);
+ returnConnection.put(otherReply, null);
+
+ Assert.assertEquals("forwarded messages", 1, messagesForwarded.size());
+ Assert.assertEquals("reply messages", 1, repliesReturned1.size());
+ Assert.assertTrue(repliesReturned1.get(0).equals(otherReply));
+
+ otherReply = new DatagramAcknowledgedMessage(farID, farID);
+ returnConnection.put(otherReply, null);
+
+ Assert.assertEquals("forwarded messages", 1, messagesForwarded.size());
+ Assert.assertEquals("reply messages", 2, repliesReturned1.size());
+ Assert.assertTrue(repliesReturned1.get(1).equals(otherReply));
+
+ returnConnection.put(replyNAKresend, null);
+
+ Assert.assertEquals("forwarded messages", 2, messagesForwarded.size());
+ Assert.assertTrue(messagesForwarded.get(1).equals(datagram1));
+
+ returnConnection.put(replyOK, null);
+
+ Assert.assertEquals("reply messages", 3, repliesReturned1.size());
+ Assert.assertTrue(repliesReturned1.get(2).equals(replyOK));
+ }
+
public void testSendTwoNonDatagramGoesThrough() throws InterruptedException {
Message m = new InitializationCompleteMessage(hereID);
buffer.put(m, replyConnection1);
Modified: trunk/prototypes/java/test/org/openlcb/implementations/DatagramServiceTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/implementations/DatagramServiceTest.java 2012-05-25 04:03:15 UTC (rev 2305)
+++ trunk/prototypes/java/test/org/openlcb/implementations/DatagramServiceTest.java 2012-05-25 04:03:58 UTC (rev 2306)
@@ -141,7 +141,28 @@
Assert.assertTrue(messagesReceived.get(0) instanceof DatagramRejectedMessage);
}
+ public void testReceiveWrongDest() {
+ DatagramService.DatagramServiceReceiveMemo m20 =
+ new DatagramService.DatagramServiceReceiveMemo(0x20){
+ @Override
+ public void handleData(NodeID n, int[] data, DatagramService.ReplyMemo service) {
+ flag = true;
+ service.acceptData(0);
+ }
+ };
+ service.registerForReceive(m20);
+
+ Message m = new DatagramMessage(farID, farID, new int[]{0x20});
+
+ Assert.assertTrue(!flag);
+ service.put(m, null);
+ Assert.assertTrue(!flag);
+
+ Assert.assertEquals(0,messagesReceived.size());
+ }
+
+
public void testSendOK() {
int[] data = new int[]{1,2,3,4,5};
DatagramService.DatagramServiceTransmitMemo memo =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-05-25 04:05:38
|
Revision: 2308
http://openlcb.svn.sourceforge.net/openlcb/?rev=2308&view=rev
Author: jacobsen
Date: 2012-05-25 04:05:32 +0000 (Fri, 25 May 2012)
Log Message:
-----------
0.5.2
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-05-25 04:04:27 UTC (rev 2307)
+++ trunk/prototypes/java/manifest 2012-05-25 04:05:32 UTC (rev 2308)
@@ -7,6 +7,6 @@
Specification-Version: \xD20.5.1\xD3
Specification-Vendor: \xD2OpenLCB group"
Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.5.1\xD3
+Package-Version: \xD20.5.2\xD3
Package-Vendor: \xD2OpenLCB group\xD3
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-05-27 00:01:09
|
Revision: 2317
http://openlcb.svn.sourceforge.net/openlcb/?rev=2317&view=rev
Author: jacobsen
Date: 2012-05-27 00:00:57 +0000 (Sun, 27 May 2012)
Log Message:
-----------
0.5.1
Added Paths:
-----------
trunk/prototypes/java/doc/
trunk/prototypes/java/doc/allclasses-frame.html
trunk/prototypes/java/doc/allclasses-noframe.html
trunk/prototypes/java/doc/constant-values.html
trunk/prototypes/java/doc/deprecated-list.html
trunk/prototypes/java/doc/help-doc.html
trunk/prototypes/java/doc/index-all.html
trunk/prototypes/java/doc/index.html
trunk/prototypes/java/doc/org/
trunk/prototypes/java/doc/org/openlcb/
trunk/prototypes/java/doc/org/openlcb/AbstractConnection.html
trunk/prototypes/java/doc/org/openlcb/AddressedMessage.html
trunk/prototypes/java/doc/org/openlcb/ConfigurationPortal.html
trunk/prototypes/java/doc/org/openlcb/Connection.ConnectionListener.html
trunk/prototypes/java/doc/org/openlcb/Connection.html
trunk/prototypes/java/doc/org/openlcb/ConsumerIdentifiedMessage.html
trunk/prototypes/java/doc/org/openlcb/DatagramAcknowledgedMessage.html
trunk/prototypes/java/doc/org/openlcb/DatagramMessage.html
trunk/prototypes/java/doc/org/openlcb/DatagramRejectedMessage.html
trunk/prototypes/java/doc/org/openlcb/EventID.html
trunk/prototypes/java/doc/org/openlcb/Gateway.html
trunk/prototypes/java/doc/org/openlcb/IdentifyConsumersMessage.html
trunk/prototypes/java/doc/org/openlcb/IdentifyEventsMessage.html
trunk/prototypes/java/doc/org/openlcb/IdentifyProducersMessage.html
trunk/prototypes/java/doc/org/openlcb/InitializationCompleteMessage.html
trunk/prototypes/java/doc/org/openlcb/LearnEventMessage.html
trunk/prototypes/java/doc/org/openlcb/Message.html
trunk/prototypes/java/doc/org/openlcb/MessageDecoder.html
trunk/prototypes/java/doc/org/openlcb/MessageTypeIdentifier.html
trunk/prototypes/java/doc/org/openlcb/MimicNodeStore.NodeMemo.html
trunk/prototypes/java/doc/org/openlcb/MimicNodeStore.html
trunk/prototypes/java/doc/org/openlcb/Node.html
trunk/prototypes/java/doc/org/openlcb/NodeID.html
trunk/prototypes/java/doc/org/openlcb/OpenLcb.html
trunk/prototypes/java/doc/org/openlcb/ProducerConsumerEventReportMessage.html
trunk/prototypes/java/doc/org/openlcb/ProducerIdentifiedMessage.html
trunk/prototypes/java/doc/org/openlcb/ProtocolIdentification.Protocols.html
trunk/prototypes/java/doc/org/openlcb/ProtocolIdentification.html
trunk/prototypes/java/doc/org/openlcb/ProtocolIdentificationReplyMessage.html
trunk/prototypes/java/doc/org/openlcb/ProtocolIdentificationRequestMessage.html
trunk/prototypes/java/doc/org/openlcb/SimpleNodeIdent.html
trunk/prototypes/java/doc/org/openlcb/SimpleNodeIdentInfoReplyMessage.html
trunk/prototypes/java/doc/org/openlcb/SimpleNodeIdentInfoRequestMessage.html
trunk/prototypes/java/doc/org/openlcb/SingleLinkNode.html
trunk/prototypes/java/doc/org/openlcb/StreamDataCompleteMessage.html
trunk/prototypes/java/doc/org/openlcb/StreamDataProceedMessage.html
trunk/prototypes/java/doc/org/openlcb/StreamDataSendMessage.html
trunk/prototypes/java/doc/org/openlcb/StreamInitReplyMessage.html
trunk/prototypes/java/doc/org/openlcb/StreamInitRequestMessage.html
trunk/prototypes/java/doc/org/openlcb/Utilities.html
trunk/prototypes/java/doc/org/openlcb/VerifiedNodeIDNumberMessage.html
trunk/prototypes/java/doc/org/openlcb/VerifyNodeIDNumberMessage.html
trunk/prototypes/java/doc/org/openlcb/can/
trunk/prototypes/java/doc/org/openlcb/can/AliasMap.html
trunk/prototypes/java/doc/org/openlcb/can/CanFrame.html
trunk/prototypes/java/doc/org/openlcb/can/MessageBuilder.html
trunk/prototypes/java/doc/org/openlcb/can/NIDa.html
trunk/prototypes/java/doc/org/openlcb/can/NIDaAlgorithm.html
trunk/prototypes/java/doc/org/openlcb/can/OpenLcbCanFrame.html
trunk/prototypes/java/doc/org/openlcb/can/class-use/
trunk/prototypes/java/doc/org/openlcb/can/class-use/AliasMap.html
trunk/prototypes/java/doc/org/openlcb/can/class-use/CanFrame.html
trunk/prototypes/java/doc/org/openlcb/can/class-use/MessageBuilder.html
trunk/prototypes/java/doc/org/openlcb/can/class-use/NIDa.html
trunk/prototypes/java/doc/org/openlcb/can/class-use/NIDaAlgorithm.html
trunk/prototypes/java/doc/org/openlcb/can/class-use/OpenLcbCanFrame.html
trunk/prototypes/java/doc/org/openlcb/can/package-frame.html
trunk/prototypes/java/doc/org/openlcb/can/package-summary.html
trunk/prototypes/java/doc/org/openlcb/can/package-tree.html
trunk/prototypes/java/doc/org/openlcb/can/package-use.html
trunk/prototypes/java/doc/org/openlcb/cdi/
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Bit.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.BitRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.EventID.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Group.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Identification.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Int.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.IntegerRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Item.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Map.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.Segment.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.StringRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/CdiRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Bit.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.BitRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.EventID.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Group.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Identification.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Int.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.IntegerRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Item.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Map.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.Segment.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.StringRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/class-use/CdiRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/CdiMemConfigReader.ReaderAccess.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/CdiMemConfigReader.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiReader.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Bit.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.BitRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.EventID.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Group.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Identification.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Int.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.IntRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Item.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Map.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.Segment.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.StringRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/JdomCdiRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/CdiMemConfigReader.ReaderAccess.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/CdiMemConfigReader.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiReader.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Bit.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.BitRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.EventID.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Group.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Identification.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Int.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.IntRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Item.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Map.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.Segment.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.StringRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/class-use/JdomCdiRep.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/package-frame.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/package-summary.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/package-tree.html
trunk/prototypes/java/doc/org/openlcb/cdi/jdom/package-use.html
trunk/prototypes/java/doc/org/openlcb/cdi/package-frame.html
trunk/prototypes/java/doc/org/openlcb/cdi/package-summary.html
trunk/prototypes/java/doc/org/openlcb/cdi/package-tree.html
trunk/prototypes/java/doc/org/openlcb/cdi/package-use.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/
trunk/prototypes/java/doc/org/openlcb/cdi/swing/CdiPanel.ReadReturn.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/CdiPanel.ReadWriteAccess.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/CdiPanel.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/class-use/
trunk/prototypes/java/doc/org/openlcb/cdi/swing/class-use/CdiPanel.ReadReturn.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/class-use/CdiPanel.ReadWriteAccess.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/class-use/CdiPanel.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/package-frame.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/package-summary.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/package-tree.html
trunk/prototypes/java/doc/org/openlcb/cdi/swing/package-use.html
trunk/prototypes/java/doc/org/openlcb/class-use/
trunk/prototypes/java/doc/org/openlcb/class-use/AbstractConnection.html
trunk/prototypes/java/doc/org/openlcb/class-use/AddressedMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/ConfigurationPortal.html
trunk/prototypes/java/doc/org/openlcb/class-use/Connection.ConnectionListener.html
trunk/prototypes/java/doc/org/openlcb/class-use/Connection.html
trunk/prototypes/java/doc/org/openlcb/class-use/ConsumerIdentifiedMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/DatagramAcknowledgedMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/DatagramMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/DatagramRejectedMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/EventID.html
trunk/prototypes/java/doc/org/openlcb/class-use/Gateway.html
trunk/prototypes/java/doc/org/openlcb/class-use/IdentifyConsumersMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/IdentifyEventsMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/IdentifyProducersMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/InitializationCompleteMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/LearnEventMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/Message.html
trunk/prototypes/java/doc/org/openlcb/class-use/MessageDecoder.html
trunk/prototypes/java/doc/org/openlcb/class-use/MessageTypeIdentifier.html
trunk/prototypes/java/doc/org/openlcb/class-use/MimicNodeStore.NodeMemo.html
trunk/prototypes/java/doc/org/openlcb/class-use/MimicNodeStore.html
trunk/prototypes/java/doc/org/openlcb/class-use/Node.html
trunk/prototypes/java/doc/org/openlcb/class-use/NodeID.html
trunk/prototypes/java/doc/org/openlcb/class-use/OpenLcb.html
trunk/prototypes/java/doc/org/openlcb/class-use/ProducerConsumerEventReportMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/ProducerIdentifiedMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/ProtocolIdentification.Protocols.html
trunk/prototypes/java/doc/org/openlcb/class-use/ProtocolIdentification.html
trunk/prototypes/java/doc/org/openlcb/class-use/ProtocolIdentificationReplyMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/ProtocolIdentificationRequestMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/SimpleNodeIdent.html
trunk/prototypes/java/doc/org/openlcb/class-use/SimpleNodeIdentInfoReplyMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/SimpleNodeIdentInfoRequestMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/SingleLinkNode.html
trunk/prototypes/java/doc/org/openlcb/class-use/StreamDataCompleteMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/StreamDataProceedMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/StreamDataSendMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/StreamInitReplyMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/StreamInitRequestMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/Utilities.html
trunk/prototypes/java/doc/org/openlcb/class-use/VerifiedNodeIDNumberMessage.html
trunk/prototypes/java/doc/org/openlcb/class-use/VerifyNodeIDNumberMessage.html
trunk/prototypes/java/doc/org/openlcb/implementations/
trunk/prototypes/java/doc/org/openlcb/implementations/BlueGoldEngine.html
trunk/prototypes/java/doc/org/openlcb/implementations/BlueGoldExtendedEngine.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramMeteringBuffer.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramReceiver.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramService.DatagramServiceReceiveMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramService.DatagramServiceTransmitMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramService.ReplyMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramService.html
trunk/prototypes/java/doc/org/openlcb/implementations/DatagramTransmitter.html
trunk/prototypes/java/doc/org/openlcb/implementations/EventFilterGateway.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.AddrSpaceDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.ConfigDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.McsAddrSpaceMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.McsConfigMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.McsReadMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.McsWriteMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.ReadDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.WriteDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/MemoryConfigurationService.html
trunk/prototypes/java/doc/org/openlcb/implementations/ScatterGather.html
trunk/prototypes/java/doc/org/openlcb/implementations/SingleConsumer.html
trunk/prototypes/java/doc/org/openlcb/implementations/SingleConsumerNode.html
trunk/prototypes/java/doc/org/openlcb/implementations/SingleProducer.html
trunk/prototypes/java/doc/org/openlcb/implementations/SingleProducerNode.html
trunk/prototypes/java/doc/org/openlcb/implementations/StreamReceiver.html
trunk/prototypes/java/doc/org/openlcb/implementations/StreamTransmitter.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/BlueGoldEngine.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/BlueGoldExtendedEngine.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramMeteringBuffer.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramReceiver.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramService.DatagramServiceReceiveMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramService.DatagramServiceTransmitMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramService.ReplyMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramService.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/DatagramTransmitter.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/EventFilterGateway.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.AddrSpaceDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.ConfigDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.McsAddrSpaceMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.McsConfigMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.McsReadMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.McsWriteMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.ReadDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.WriteDatagramMemo.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/MemoryConfigurationService.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/ScatterGather.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/SingleConsumer.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/SingleConsumerNode.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/SingleProducer.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/SingleProducerNode.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/StreamReceiver.html
trunk/prototypes/java/doc/org/openlcb/implementations/class-use/StreamTransmitter.html
trunk/prototypes/java/doc/org/openlcb/implementations/package-frame.html
trunk/prototypes/java/doc/org/openlcb/implementations/package-summary.html
trunk/prototypes/java/doc/org/openlcb/implementations/package-tree.html
trunk/prototypes/java/doc/org/openlcb/implementations/package-use.html
trunk/prototypes/java/doc/org/openlcb/package-frame.html
trunk/prototypes/java/doc/org/openlcb/package-summary.html
trunk/prototypes/java/doc/org/openlcb/package-tree.html
trunk/prototypes/java/doc/org/openlcb/package-use.html
trunk/prototypes/java/doc/org/openlcb/swing/
trunk/prototypes/java/doc/org/openlcb/swing/ConsumerPane.html
trunk/prototypes/java/doc/org/openlcb/swing/EventIdTextField.html
trunk/prototypes/java/doc/org/openlcb/swing/MonPane.html
trunk/prototypes/java/doc/org/openlcb/swing/NodeSelector.html
trunk/prototypes/java/doc/org/openlcb/swing/ProducerPane.html
trunk/prototypes/java/doc/org/openlcb/swing/class-use/
trunk/prototypes/java/doc/org/openlcb/swing/class-use/ConsumerPane.html
trunk/prototypes/java/doc/org/openlcb/swing/class-use/EventIdTextField.html
trunk/prototypes/java/doc/org/openlcb/swing/class-use/MonPane.html
trunk/prototypes/java/doc/org/openlcb/swing/class-use/NodeSelector.html
trunk/prototypes/java/doc/org/openlcb/swing/class-use/ProducerPane.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/MemConfigDescriptionPane.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/MemConfigReadWritePane.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/class-use/
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/class-use/MemConfigDescriptionPane.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/class-use/MemConfigReadWritePane.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/package-frame.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/package-summary.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/package-tree.html
trunk/prototypes/java/doc/org/openlcb/swing/memconfig/package-use.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/
trunk/prototypes/java/doc/org/openlcb/swing/networktree/NodeTreeRep.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/TreePane.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/class-use/
trunk/prototypes/java/doc/org/openlcb/swing/networktree/class-use/NodeTreeRep.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/class-use/TreePane.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/package-frame.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/package-summary.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/package-tree.html
trunk/prototypes/java/doc/org/openlcb/swing/networktree/package-use.html
trunk/prototypes/java/doc/org/openlcb/swing/package-frame.html
trunk/prototypes/java/doc/org/openlcb/swing/package-summary.html
trunk/prototypes/java/doc/org/openlcb/swing/package-tree.html
trunk/prototypes/java/doc/org/openlcb/swing/package-use.html
trunk/prototypes/java/doc/overview-frame.html
trunk/prototypes/java/doc/overview-summary.html
trunk/prototypes/java/doc/overview-tree.html
trunk/prototypes/java/doc/package-list
trunk/prototypes/java/doc/resources/
trunk/prototypes/java/doc/resources/inherit.gif
trunk/prototypes/java/doc/serialized-form.html
trunk/prototypes/java/doc/stylesheet.css
Added: trunk/prototypes/java/doc/allclasses-frame.html
===================================================================
--- trunk/prototypes/java/doc/allclasses-frame.html (rev 0)
+++ trunk/prototypes/java/doc/allclasses-frame.html 2012-05-27 00:00:57 UTC (rev 2317)
@@ -0,0 +1,243 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_31) on Sat May 26 16:56:50 PDT 2012 -->
+<TITLE>
+All Classes (OpenLCB)
+</TITLE>
+
+<META NAME="date" CONTENT="2012-05-26">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+
+</HEAD>
+
+<BODY BGCOLOR="white">
+<FONT size="+1" CLASS="FrameHeadingFont">
+<B>All Classes</B></FONT>
+<BR>
+
+<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
+<TR>
+<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="org/openlcb/AbstractConnection.html" title="class in org.openlcb" target="classFrame">AbstractConnection</A>
+<BR>
+<A HREF="org/openlcb/AddressedMessage.html" title="class in org.openlcb" target="classFrame">AddressedMessage</A>
+<BR>
+<A HREF="org/openlcb/can/AliasMap.html" title="class in org.openlcb.can" target="classFrame">AliasMap</A>
+<BR>
+<A HREF="org/openlcb/implementations/BlueGoldEngine.html" title="class in org.openlcb.implementations" target="classFrame">BlueGoldEngine</A>
+<BR>
+<A HREF="org/openlcb/implementations/BlueGoldExtendedEngine.html" title="class in org.openlcb.implementations" target="classFrame">BlueGoldExtendedEngine</A>
+<BR>
+<A HREF="org/openlcb/can/CanFrame.html" title="interface in org.openlcb.can" target="classFrame"><I>CanFrame</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/CdiMemConfigReader.html" title="class in org.openlcb.cdi.jdom" target="classFrame">CdiMemConfigReader</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/CdiMemConfigReader.ReaderAccess.html" title="interface in org.openlcb.cdi.jdom" target="classFrame"><I>CdiMemConfigReader.ReaderAccess</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/swing/CdiPanel.html" title="class in org.openlcb.cdi.swing" target="classFrame">CdiPanel</A>
+<BR>
+<A HREF="org/openlcb/cdi/swing/CdiPanel.ReadWriteAccess.html" title="class in org.openlcb.cdi.swing" target="classFrame">CdiPanel.ReadWriteAccess</A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.BitRep.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.BitRep</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.EventID.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.EventID</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.Group.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.Group</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.Identification.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.Identification</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.IntegerRep.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.IntegerRep</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.Item.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.Item</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.Map.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.Map</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.Segment.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.Segment</I></A>
+<BR>
+<A HREF="org/openlcb/cdi/CdiRep.StringRep.html" title="interface in org.openlcb.cdi" target="classFrame"><I>CdiRep.StringRep</I></A>
+<BR>
+<A HREF="org/openlcb/ConfigurationPortal.html" title="class in org.openlcb" target="classFrame">ConfigurationPortal</A>
+<BR>
+<A HREF="org/openlcb/Connection.html" title="interface in org.openlcb" target="classFrame"><I>Connection</I></A>
+<BR>
+<A HREF="org/openlcb/Connection.ConnectionListener.html" title="class in org.openlcb" target="classFrame">Connection.ConnectionListener</A>
+<BR>
+<A HREF="org/openlcb/ConsumerIdentifiedMessage.html" title="class in org.openlcb" target="classFrame">ConsumerIdentifiedMessage</A>
+<BR>
+<A HREF="org/openlcb/swing/ConsumerPane.html" title="class in org.openlcb.swing" target="classFrame">ConsumerPane</A>
+<BR>
+<A HREF="org/openlcb/DatagramAcknowledgedMessage.html" title="class in org.openlcb" target="classFrame">DatagramAcknowledgedMessage</A>
+<BR>
+<A HREF="org/openlcb/DatagramMessage.html" title="class in org.openlcb" target="classFrame">DatagramMessage</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramMeteringBuffer.html" title="class in org.openlcb.implementations" target="classFrame">DatagramMeteringBuffer</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramReceiver.html" title="class in org.openlcb.implementations" target="classFrame">DatagramReceiver</A>
+<BR>
+<A HREF="org/openlcb/DatagramRejectedMessage.html" title="class in org.openlcb" target="classFrame">DatagramRejectedMessage</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramService.html" title="class in org.openlcb.implementations" target="classFrame">DatagramService</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramService.DatagramServiceReceiveMemo.html" title="class in org.openlcb.implementations" target="classFrame">DatagramService.DatagramServiceReceiveMemo</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramService.DatagramServiceTransmitMemo.html" title="class in org.openlcb.implementations" target="classFrame">DatagramService.DatagramServiceTransmitMemo</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramService.ReplyMemo.html" title="class in org.openlcb.implementations" target="classFrame">DatagramService.ReplyMemo</A>
+<BR>
+<A HREF="org/openlcb/implementations/DatagramTransmitter.html" title="class in org.openlcb.implementations" target="classFrame">DatagramTransmitter</A>
+<BR>
+<A HREF="org/openlcb/implementations/EventFilterGateway.html" title="class in org.openlcb.implementations" target="classFrame">EventFilterGateway</A>
+<BR>
+<A HREF="org/openlcb/EventID.html" title="class in org.openlcb" target="classFrame">EventID</A>
+<BR>
+<A HREF="org/openlcb/swing/EventIdTextField.html" title="class in org.openlcb.swing" target="classFrame">EventIdTextField</A>
+<BR>
+<A HREF="org/openlcb/Gateway.html" title="class in org.openlcb" target="classFrame">Gateway</A>
+<BR>
+<A HREF="org/openlcb/IdentifyConsumersMessage.html" title="class in org.openlcb" target="classFrame">IdentifyConsumersMessage</A>
+<BR>
+<A HREF="org/openlcb/IdentifyEventsMessage.html" title="class in org.openlcb" target="classFrame">IdentifyEventsMessage</A>
+<BR>
+<A HREF="org/openlcb/IdentifyProducersMessage.html" title="class in org.openlcb" target="classFrame">IdentifyProducersMessage</A>
+<BR>
+<A HREF="org/openlcb/InitializationCompleteMessage.html" title="class in org.openlcb" target="classFrame">InitializationCompleteMessage</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiReader.html" title="class in org.openlcb.cdi.jdom" target="classFrame">JdomCdiReader</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiRep.html" title="class in org.openlcb.cdi.jdom" target="classFrame">JdomCdiRep</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiRep.BitRep.html" title="class in org.openlcb.cdi.jdom" target="classFrame">JdomCdiRep.BitRep</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiRep.EventID.html" title="class in org.openlcb.cdi.jdom" target="classFrame">JdomCdiRep.EventID</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiRep.Group.html" title="class in org.openlcb.cdi.jdom" target="classFrame">JdomCdiRep.Group</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiRep.Identification.html" title="class in org.openlcb.cdi.jdom" target="classFrame">JdomCdiRep.Identification</A>
+<BR>
+<A HREF="org/openlcb/cdi/jdom/JdomCdiRep.IntRep.html" title="class in org.openl...
[truncated message content] |
|
From: <jac...@us...> - 2012-06-02 00:06:31
|
Revision: 2366
http://openlcb.svn.sourceforge.net/openlcb/?rev=2366&view=rev
Author: jacobsen
Date: 2012-06-02 00:06:25 +0000 (Sat, 02 Jun 2012)
Log Message:
-----------
fix bug in skipping of user-part version byte
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/SimpleNodeIdent.java
trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java
Modified: trunk/prototypes/java/src/org/openlcb/SimpleNodeIdent.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/SimpleNodeIdent.java 2012-05-31 16:03:11 UTC (rev 2365)
+++ trunk/prototypes/java/src/org/openlcb/SimpleNodeIdent.java 2012-06-02 00:06:25 UTC (rev 2366)
@@ -101,12 +101,13 @@
public String getUserName() {
int len = 1;
int start = 1;
- // skip mfg, model, hardware_version, software_version
+ // skip mfg, model, hardware_version, software_version, version byte
for (int i = 0; i<4; i++) {
for (; len < bytes.length; len++)
if (bytes[len] == 0) break;
start = ++len;
}
+ if (len < bytes.length) start = ++len;
// find this string
for (; len < bytes.length; len++)
@@ -119,12 +120,18 @@
public String getUserDesc() {
int len = 1;
int start = 1;
- // skip mfg, model, hardware_version, software_version, user_name
- for (int i = 0; i<5; i++) {
+ // skip mfg, model, hardware_version, software_version, version byte, user_name
+ for (int i = 0; i<4; i++) {
for (; len < bytes.length; len++)
if (bytes[len] == 0) break;
start = ++len;
}
+ if (len < bytes.length) start = ++len;
+ for (int i = 0; i<1; i++) {
+ for (; len < bytes.length; len++)
+ if (bytes[len] == 0) break;
+ start = ++len;
+ }
// find this string
for (; len < bytes.length; len++)
Modified: trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java 2012-05-31 16:03:11 UTC (rev 2365)
+++ trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java 2012-06-02 00:06:25 UTC (rev 2366)
@@ -52,6 +52,21 @@
Assert.assertEquals("Z", id.getHardwareVersion());
}
+ public void testCreationWithUserPart() {
+ SimpleNodeIdent id = new SimpleNodeIdent(
+ new SimpleNodeIdentInfoReplyMessage(
+ new NodeID(new byte[]{1,2,3,4,5,6}),
+ new byte[]{1,'a','b',0,'1',0,'2',0,'A',0,1,'u','s',0,'3','4',0}));
+
+ Assert.assertEquals("ab", id.getMfgName());
+ Assert.assertEquals("1", id.getModelName());
+ Assert.assertEquals("2", id.getHardwareVersion());
+ Assert.assertEquals("A", id.getSoftwareVersion());
+ Assert.assertEquals("us", id.getUserName());
+ Assert.assertEquals("34", id.getUserDesc());
+ }
+
+
// from here down is testing infrastructure
public SimpleNodeIdentTest(String s) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-06-02 04:18:42
|
Revision: 2367
http://openlcb.svn.sourceforge.net/openlcb/?rev=2367&view=rev
Author: jacobsen
Date: 2012-06-02 04:18:36 +0000 (Sat, 02 Jun 2012)
Log Message:
-----------
as of today
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-06-02 00:06:25 UTC (rev 2366)
+++ trunk/prototypes/java/manifest 2012-06-02 04:18:36 UTC (rev 2367)
@@ -7,6 +7,6 @@
Specification-Version: \xD20.5.1\xD3
Specification-Vendor: \xD2OpenLCB group"
Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.5.2\xD3
+Package-Version: \xD20.5.3\xD3
Package-Vendor: \xD2OpenLCB group\xD3
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-06-16 04:01:03
|
Revision: 2441
http://openlcb.svn.sourceforge.net/openlcb/?rev=2441&view=rev
Author: jacobsen
Date: 2012-06-16 04:00:57 +0000 (Sat, 16 Jun 2012)
Log Message:
-----------
improvements to SNIP retry
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java
trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java
Modified: trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java 2012-06-16 03:59:52 UTC (rev 2440)
+++ trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java 2012-06-16 04:00:57 UTC (rev 2441)
@@ -92,6 +92,14 @@
return pSimpleNode;
}
+ public void handleOptionalIntRejected(OptionalIntRejectedMessage msg, Connection sender){
+ if (msg.getMti() == 0x0c) {
+ // check for temporary error
+ // have to resend the SNII request
+ connection.put(new SimpleNodeIdentInfoRequestMessage(id, msg.getSourceNodeID()), null);
+ }
+ }
+
java.beans.PropertyChangeSupport pcs = new java.beans.PropertyChangeSupport(this);
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener l) {pcs.addPropertyChangeListener(l);}
public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener l) {pcs.removePropertyChangeListener(l);}
Modified: trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java 2012-06-16 03:59:52 UTC (rev 2440)
+++ trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java 2012-06-16 04:00:57 UTC (rev 2441)
@@ -23,17 +23,24 @@
ProducerIdentifiedMessage pim2 = new ProducerIdentifiedMessage(nid2,
new EventID(new byte[]{1,0,0,0,0,0,1,0}));
-
+
+ SimpleNodeIdentInfoReplyMessage snii1 = new SimpleNodeIdentInfoReplyMessage(nid1,
+ new byte[]{1,'a','b','c'});
+
PropertyChangeListener listener;
boolean listenerFired;
+ Message lastMessage;
Connection connection = new AbstractConnection() {
- public void put(Message msg, Connection sender) {}
+ public void put(Message msg, Connection sender) {
+ lastMessage = msg;
+ }
};
NodeID node = new NodeID(new byte[]{1,2,3,4,5,6});
public void setUp() {
store = new MimicNodeStore(connection, node);
+ lastMessage = null;
listener = new PropertyChangeListener(){
public void propertyChange(java.beans.PropertyChangeEvent e) { listenerFired = true; }
@@ -145,6 +152,38 @@
Assert.assertTrue(listenerFired);
}
+
+ public void testNoDefaultSimpleInfo() {
+ store.put(pim1,null);
+ Collection<MimicNodeStore.NodeMemo> list = store.getNodeMemos();
+ MimicNodeStore.NodeMemo memo = list.iterator().next();
+
+ Assert.assertNull(memo.getSimpleNodeIdent());
+ }
+
+ public void testSimpleInfoAvailableFromNode() {
+ store.put(pim1,null);
+ Collection<MimicNodeStore.NodeMemo> list = store.getNodeMemos();
+ MimicNodeStore.NodeMemo memo = list.iterator().next();
+ store.put(snii1, null);
+
+ Assert.assertNotNull(memo.getSimpleNodeIdent());
+
+ Assert.assertEquals("abc", memo.getSimpleNodeIdent().getMfgName());
+ }
+
+ public void testSimpleInfoRetry() {
+ store.put(pim1,null);
+ Collection<MimicNodeStore.NodeMemo> list = store.getNodeMemos();
+ MimicNodeStore.NodeMemo memo = list.iterator().next();
+
+ Assert.assertNull(lastMessage);
+ store.put(new OptionalIntRejectedMessage(nid1,nid1,0x0c,1), null);
+ Assert.assertNotNull(lastMessage);
+
+ Assert.assertEquals(lastMessage, new SimpleNodeIdentInfoRequestMessage(nid1, nid1) );
+ }
+
// from here down is testing infrastructure
public MimicNodeStoreTest(String s) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-07-22 03:09:28
|
Revision: 2514
http://openlcb.svn.sourceforge.net/openlcb/?rev=2514&view=rev
Author: jacobsen
Date: 2012-07-22 03:09:19 +0000 (Sun, 22 Jul 2012)
Log Message:
-----------
update to new MTI and frame structure, called 0.6.0
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
trunk/prototypes/java/src/org/openlcb/MessageTypeIdentifier.java
trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
trunk/prototypes/java/src/org/openlcb/can/OpenLcbCanFrame.java
trunk/prototypes/java/test/org/openlcb/MessageTypeIdentifierTest.java
trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-07-21 21:18:50 UTC (rev 2513)
+++ trunk/prototypes/java/manifest 2012-07-22 03:09:19 UTC (rev 2514)
@@ -4,9 +4,9 @@
Name: org.openlcb
Specification-Title: \xD2OpenLCB\xD3
-Specification-Version: \xD20.5.1\xD3
+Specification-Version: \xD20.6.0\xD3
Specification-Vendor: \xD2OpenLCB group"
Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.5.3\xD3
+Package-Version: \xD20.6.0\xD3
Package-Vendor: \xD2OpenLCB group\xD3
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/src/org/openlcb/MessageTypeIdentifier.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/MessageTypeIdentifier.java 2012-07-21 21:18:50 UTC (rev 2513)
+++ trunk/prototypes/java/src/org/openlcb/MessageTypeIdentifier.java 2012-07-22 03:09:19 UTC (rev 2514)
@@ -21,65 +21,78 @@
// Arguments are
// addressed?
// contains Event ID?
- // Flags in Header?
// Simple node message?
+ // Upper special bits (nibble)
// Priority Group
// Type number
+ // Modifier (0-3)
+ // Name
- InitializationComplete ( false, false, false, false, 0x0, 0x08, "InitializationComplete"),
- VerifyNodeIdAddressed ( true, false, false, false, 0x0, 0x0A, "VerifyNodeIdAddressed"),
- VerifyNodeIdGlobal ( false, false, false, true, 0x0, 0x0A, "VerifyNodeIdGlobal"),
- VerifiedNodeId ( false, false, false, true, 0x0, 0x0B, "VerifiedNodeId"),
- OptionalInteractionRejected ( true, false, false, false, 0x0, 0x0C, "OptionalInteractionRejected"),
- TerminateDueToError ( true, false, false, false, 0x0, 0x0D, "TerminateDueToError"),
+ InitializationComplete ( false, false, false, 0, 0, 8, 0, "InitializationComplete"),
+ VerifyNodeIdAddressed ( true, false, false, 0, 1, 4, 0, "VerifyNodeIdAddressed"),
+ VerifyNodeIdGlobal ( false, false, true, 0, 1, 4, 0, "VerifyNodeIdGlobal"),
+ VerifiedNodeId ( false, false, true, 0, 0, 11, 0, "VerifiedNodeId"),
+ OptionalInteractionRejected ( true, false, false, 0, 0, 3, 0, "OptionalInteractionRejected"),
+ TerminateDueToError ( true, false, false, 0, 0, 5, 0, "TerminateDueToError"),
- ProtocolSupportInquiry ( true, false, false, false, 0x1, 0x0E, "ProtocolSupportInquiry"),
- ProtocolSupportReply ( true, false, false, false, 0x1, 0x0F, "ProtocolSupportReply"),
+ ProtocolSupportInquiry ( true, false, false, 0, 2, 1, 0, "ProtocolSupportInquiry"),
+ ProtocolSupportReply ( true, false, false, 0, 1, 19, 0, "ProtocolSupportReply"),
- IdentifyConsumer ( false, true, false, true, 0x1, 0x04, "IdentifyConsumer"),
- ConsumerIdentifyRange ( false, true, false, false, 0x1, 0x05, "ConsumerIdentifyRange"),
- ConsumerIdentified ( false, true, true, false, 0x1, 0x06, "ConsumerIdentified"),
+ IdentifyConsumer ( false, true, true, 0, 2, 7, 0, "IdentifyConsumer"),
+ ConsumerIdentifyRange ( false, true, false, 0, 1, 5, 0, "ConsumerIdentifyRange"),
+ ConsumerIdentified ( false, true, false, 0, 1, 6, 0, "ConsumerIdentified"),
- IdentifyProducer ( false, true, false, true, 0x1, 0x08, "IdentifyProducer"),
- ProducerIdentifyRange ( false, true, false, false, 0x1, 0x09, "ProducerIdentifyRange"),
- ProducerIdentified ( false, true, true, false, 0x1, 0x0A, "ProducerIdentified"),
+ IdentifyProducer ( false, true, true, 0, 2, 8, 0, "IdentifyProducer"),
+ ProducerIdentifyRange ( false, true, false, 0, 1, 9, 0, "ProducerIdentifyRange"),
+ ProducerIdentified ( false, true, false, 0, 1, 10, 0, "ProducerIdentified"),
- IdentifyEventsAddressed ( true, false, false, false, 0x1, 0x0B, "IdentifyEventsAddressed"),
- IdentifyEventsGlobal ( false, false, false, true, 0x1, 0x0B, "IdentifyEventsGlobal"),
+ IdentifyEventsAddressed ( true, false, false, 0, 2, 11, 0, "IdentifyEventsAddressed"),
+ IdentifyEventsGlobal ( false, false, true, 0, 2, 11, 0, "IdentifyEventsGlobal"),
- LearnEvent ( false, true, false, true, 0x1, 0x0C, "LearnEvent"),
- ProducerConsumerEventReport ( false, true, false, true, 0x1, 0x0D, "ProducerConsumerEventReport"),
+ LearnEvent ( false, true, true, 0, 1, 12, 0, "LearnEvent"),
+ ProducerConsumerEventReport ( false, true, true, 0, 1, 13, 0, "ProducerConsumerEventReport"),
- SimpleNodeIdentInfoRequest ( true, false, false, false, 0x2, 0x12, "SimpleNodeIdentInfoRequest"),
- SimpleNodeIdentInfoReply ( true, false, false, false, 0x2, 0x13, "SimpleNodeIdentInfoReply"),
+ SimpleNodeIdentInfoRequest ( true, false, false, 0, 3, 15, 0, "SimpleNodeIdentInfoRequest"),
+ SimpleNodeIdentInfoReply ( true, false, false, 0, 2, 16, 0, "SimpleNodeIdentInfoReply"),
- Datagram ( true, false, false, false, 0x2, 0x00, "Datagram"),
- DatagramReceivedOK ( true, false, false, false, 0x2, 0x0C, "DatagramReceivedOK"),
- DatagramRejected ( true, false, false, false, 0x2, 0x0D, "DatagramRejected"),
+ Datagram ( true, false, false, 1, 3, 2, 0, "Datagram"),
+ DatagramReceivedOK ( true, false, false, 0, 2, 17, 0, "DatagramReceivedOK"),
+ DatagramRejected ( true, false, false, 0, 2, 18, 0, "DatagramRejected"),
- StreamInitiateRequest ( true, false, false, false, 0x2, 0x0E, "StreamInitiateRequest"),
- StreamInitiateReply ( true, false, false, false, 0x2, 0x0F, "StreamDataSend"),
- StreamDataSend ( true, false, false, false, 0x3, 0x09, "StreamDataSend"),
- StreamDataProceed ( true, false, false, false, 0x3, 0x0A, "StreamDataProceed"),
- StreamDataComplete ( true, false, false, false, 0x3, 0x0B, "StreamDataComplete");
+ StreamInitiateRequest ( true, false, false, 0, 3, 6, 0, "StreamInitiateRequest"),
+ StreamInitiateReply ( true, false, false, 0, 2, 3, 0, "StreamInitiateReply"),
+ StreamDataSend ( true, false, false, 1, 3, 28, 0, "StreamDataSend"),
+ StreamDataProceed ( true, false, false, 0, 2, 4, 0, "StreamDataProceed"),
+ StreamDataComplete ( true, false, false, 0, 2, 5, 0, "StreamDataComplete");
- MessageTypeIdentifier(boolean addressed, boolean hasEventID, boolean hasFlagsInHeader,
- boolean isSimpleModeMessage, int priorityGroup, int typeNumber, String name) {
+ private static java.util.Map<Integer, MessageTypeIdentifier> mapping;
+ private static java.util.Map<Integer, MessageTypeIdentifier> getMap() {
+ if (mapping == null)
+ mapping = new java.util.HashMap<Integer, MessageTypeIdentifier>();
+ return mapping;
+ }
+
+ MessageTypeIdentifier(boolean addressed, boolean hasEventID, boolean isSimpleModeMessage,
+ int upper, int priorityGroup, int typeNumber, int modifier, String name) {
this.addressed = addressed;
this.hasEventID = hasEventID;
- this.hasFlagsInHeader = hasFlagsInHeader;
+ this.modifier = modifier;
this.isSimpleModeMessage = isSimpleModeMessage;
this.priorityGroup = priorityGroup;
this.typeNumber = typeNumber;
+ this.upper = upper;
this.name = name;
+
+ getMap().put(Integer.valueOf(mti()), this);
}
boolean addressed;
boolean hasEventID;
- boolean hasFlagsInHeader;
+ int modifier;
boolean isSimpleModeMessage;
int priorityGroup;
int typeNumber;
+ int upper;
String name;
@@ -87,16 +100,26 @@
return name;
}
- public long mti() {
- long retval = 0x1000;
- if (addressed) retval = retval | 0x0004;
- if (hasEventID) retval = retval | 0x0002;
- if (hasFlagsInHeader) retval = retval | 0x0001;
- if (isSimpleModeMessage) retval = retval | 0x0800;
-
- retval = retval | (priorityGroup << 4+5);
- retval = retval | (typeNumber << 4);
-
+ public int mti() {
+ int retval = 0x0000;
+
+ retval = retval | (upper << 12);
+ retval = retval | (priorityGroup << 10);
+ retval = retval | (typeNumber << 5);
+
+ if (addressed) retval = retval | 0x0008;
+ if (hasEventID) retval = retval | 0x0004;
+ if (modifier != 0) retval = retval | modifier;
+ if (isSimpleModeMessage) retval = retval | 0x0010;
+
return retval;
}
+
+ /**
+ * Provide the enum object matching a particular MTI value
+ */
+ public static MessageTypeIdentifier get(int mti) {
+ return mapping.get(Integer.valueOf(mti));
+ }
+
}
Modified: trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-07-21 21:18:50 UTC (rev 2513)
+++ trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-07-22 03:09:19 UTC (rev 2514)
@@ -70,50 +70,83 @@
HashMap<NodeID, List<Integer>> datagramData = new HashMap<NodeID, List<Integer>>();
int getSourceID(CanFrame f) { return f.getHeader()&0x00000FFF; }
- int getType(CanFrame f) { return ( f.getHeader() & 0x00FF0000 ) >> 16; }
+ int getMTI(CanFrame f) { return ( f.getHeader() & 0x00FFF000 ) >> 12; }
EventID getEventID(CanFrame f) { return new EventID(f.getData()); }
List<Message> processFormat0(CanFrame f) {
- // simple MTI
+ // reserved
+ return null;
+ }
+
+ List<Message> processFormat1(CanFrame f) {
+ // MTI
List<Message> retlist = new java.util.ArrayList<Message>();
NodeID source = map.getNodeID(getSourceID(f));
+ NodeID dest = null;
+ int mti = getMTI(f);
+ if ( ((mti&0x008) != 0) && (f.getNumDataElements() >= 2) ) // addressed message
+ dest = map.getNodeID( ( (f.getElement(0) << 8) + f.getElement(1) ) & 0xFFF );
- int type = getType(f);
- switch (type) {
- case 0x8A:
+ MessageTypeIdentifier value = MessageTypeIdentifier.get(mti);
+ if (value == null) System.out.println(" found null from "+mti);
+ switch (value) {
+ case InitializationComplete:
+ retlist.add(new InitializationCompleteMessage(source));
+ return retlist;
+ case VerifyNodeIdGlobal:
retlist.add(new VerifyNodeIDNumberMessage(source));
return retlist;
- case 0x8B:
+ case VerifiedNodeId:
retlist.add(new VerifiedNodeIDNumberMessage(source));
return retlist;
- case 0xA4:
+
+ case ProtocolSupportInquiry:
+ retlist.add(new ProtocolIdentificationRequestMessage(source));
+ return retlist;
+ case ProtocolSupportReply:
+ retlist.add(new ProtocolIdentificationReplyMessage(source,f.bodyAsLong()));
+ return retlist;
+
+ case IdentifyConsumer:
retlist.add(new IdentifyConsumersMessage(source, getEventID(f)));
return retlist;
- case 0xA8:
+ case ConsumerIdentified:
+ retlist.add(new ConsumerIdentifiedMessage(source, getEventID(f)));
+ return retlist;
+ case IdentifyProducer:
retlist.add(new IdentifyProducersMessage(source, getEventID(f)));
return retlist;
- case 0xAC:
- retlist.add(new LearnEventMessage(source, getEventID(f)));
+ case ProducerIdentified:
+ retlist.add(new ProducerIdentifiedMessage(source, getEventID(f)));
return retlist;
- case 0xAD:
+ case ProducerConsumerEventReport:
retlist.add(new ProducerConsumerEventReportMessage(source, getEventID(f)));
return retlist;
- case 0x08:
- retlist.add(new InitializationCompleteMessage(source));
+
+ case LearnEvent:
+ retlist.add(new LearnEventMessage(source, getEventID(f)));
return retlist;
- case 0x26:
- retlist.add(new ConsumerIdentifiedMessage(source, getEventID(f)));
+
+ case SimpleNodeIdentInfoRequest:
+ retlist.add(new SimpleNodeIdentInfoRequestMessage(source, dest));
return retlist;
- case 0x2A:
- retlist.add(new ProducerIdentifiedMessage(source, getEventID(f)));
+ case SimpleNodeIdentInfoReply:
+ byte[] content = f.getData();
+ byte[] data = new byte[content.length-1];
+ System.arraycopy(content, 1, data, 0, data.length);
+
+ retlist.add(new SimpleNodeIdentInfoReplyMessage(source,data));
return retlist;
+
+ case DatagramReceivedOK:
+ retlist.add(new DatagramAcknowledgedMessage(source,dest));
+ return retlist;
+ case DatagramRejected:
+ retlist.add(new DatagramRejectedMessage(source,dest,(int)f.bodyAsLong()));
+ return retlist;
default: return null;
}
}
- List<Message> processFormat1(CanFrame f) {
- // reserved
- return null;
- }
List<Message> processFormat2(CanFrame f) {
// datagram only-segment
NodeID source = map.getNodeID(getSourceID(f));
@@ -191,35 +224,8 @@
return retlist;
}
List<Message> processFormat6(CanFrame f) {
- List<Message> retlist = new java.util.ArrayList<Message>();
- NodeID source = map.getNodeID(getSourceID(f));
- NodeID dest = map.getNodeID( (f.getHeader() & 0x00FFF000) >> 12);
- int type = f.getElement(0);
- switch (type) {
- case 0x2E:
- retlist.add(new ProtocolIdentificationRequestMessage(source));
- return retlist;
- case 0x2F:
- retlist.add(new ProtocolIdentificationReplyMessage(source,f.bodyAsLong()));
- return retlist;
- case 0x4C:
- retlist.add(new DatagramAcknowledgedMessage(source,dest));
- return retlist;
- case 0x4D:
- retlist.add(new DatagramRejectedMessage(source,dest,(int)f.bodyAsLong()));
- return retlist;
- case 0x52:
- retlist.add(new SimpleNodeIdentInfoRequestMessage(source, dest));
- return retlist;
- case 0x53:
- byte[] content = f.getData();
- byte[] data = new byte[content.length-1];
- System.arraycopy(content, 1, data, 0, data.length);
-
- retlist.add(new SimpleNodeIdentInfoReplyMessage(source,data));
- return retlist;
- default: return null;
- }
+ // reserved
+ return null;
}
List<Message> processFormat7(CanFrame f) {
// stream data
@@ -309,7 +315,7 @@
@Override
public void handleIdentifyConsumers(IdentifyConsumersMessage msg, Connection sender){
OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
- f.setGlobalMessage(0xA4F);
+ f.setOpenLcbMTI(MessageTypeIdentifier.IdentifyConsumer.mti());
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
f.loadFromEid(msg.getEventID());
retlist.add(f);
@@ -327,7 +333,7 @@
@Override
public void handleIdentifyProducers(IdentifyProducersMessage msg, Connection sender){
OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
- f.setGlobalMessage(0xA8F);
+ f.setOpenLcbMTI(MessageTypeIdentifier.IdentifyProducer.mti());
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
f.loadFromEid(msg.getEventID());
retlist.add(f);
@@ -345,7 +351,8 @@
@Override
public void handleIdentifyEvents(IdentifyEventsMessage msg, Connection sender){
OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
- f.setAddressedMessage(map.getAlias(msg.getDestNodeID()), (byte)0x2B);
+ f.setOpenLcbMTI(MessageTypeIdentifier.IdentifyProducer.mti());
+ f.setDestAlias(map.getAlias(msg.getDestNodeID()));
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
retlist.add(f);
}
@@ -362,7 +369,8 @@
@Override
public void handleSimpleNodeIdentInfoRequest(SimpleNodeIdentInfoRequestMessage msg, Connection sender){
OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
- f.setAddressedMessage(map.getAlias(msg.getDestNodeID()), (byte)0x52);
+ f.setOpenLcbMTI(MessageTypeIdentifier.SimpleNodeIdentInfoRequest.mti());
+ f.setDestAlias(map.getAlias(msg.getDestNodeID()));
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
retlist.add(f);
}
@@ -399,9 +407,10 @@
@Override
public void handleDatagramRejected(DatagramRejectedMessage msg, Connection sender){
OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
- f.setAddressedMessage(map.getAlias(msg.getDestNodeID()), (byte)0x4D);
+ f.setOpenLcbMTI(MessageTypeIdentifier.DatagramRejected.mti());
+ f.setData(new byte[]{(byte)0, (byte)0, (byte)((msg.getCode()>>8)&0xFF), (byte)(msg.getCode()&0xFF)});
+ f.setDestAlias(map.getAlias(msg.getDestNodeID()));
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
- f.setData(new byte[]{(byte)0x4D, (byte)((msg.getCode()>>8)&0xFF), (byte)(msg.getCode()&0xFF)});
retlist.add(f);
}
/**
@@ -410,7 +419,8 @@
@Override
public void handleDatagramAcknowledged(DatagramAcknowledgedMessage msg, Connection sender){
OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
- f.setAddressedMessage(map.getAlias(msg.getDestNodeID()), (byte)0x4C);
+ f.setOpenLcbMTI(MessageTypeIdentifier.DatagramReceivedOK.mti());
+ f.setDestAlias(map.getAlias(msg.getDestNodeID()));
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
retlist.add(f);
}
Modified: trunk/prototypes/java/src/org/openlcb/can/OpenLcbCanFrame.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/OpenLcbCanFrame.java 2012-07-21 21:18:50 UTC (rev 2513)
+++ trunk/prototypes/java/src/org/openlcb/can/OpenLcbCanFrame.java 2012-07-22 03:09:19 UTC (rev 2514)
@@ -85,6 +85,12 @@
return (int)(id & MASK_SRC_ALIAS);
}
+ void setDestAlias(int a) {
+ data[0] = (byte)((a>>8)&0xF);
+ data[1] = (byte)(a&0xFF);
+ length = (length<2) ? 2 : length;
+ }
+
void setFrameTypeCAN() {
id &= ~MASK_FRAME_TYPE;
}
@@ -103,8 +109,7 @@
void setVariableField(int f) {
id &= ~MASK_VARIABLE_FIELD;
- int temp = f; // ensure 32 bit arithmetic
- id |= ((temp << SHIFT_VARIABLE_FIELD) & MASK_VARIABLE_FIELD);
+ id |= ((f << SHIFT_VARIABLE_FIELD) & MASK_VARIABLE_FIELD);
}
int getVariableField() {
@@ -158,27 +163,16 @@
int now = getVariableField() & ~MASK_OPENLCB_FORMAT;
setVariableField( ((i << SHIFT_OPENLCB_FORMAT) & MASK_OPENLCB_FORMAT) | now);
}
-
- // is the variable field a destID?
- boolean isOpenLcDestIdFormat() {
- return ( getOpenLcbFormat() == MTI_FORMAT_ADDRESSED_NON_DATAGRAM);
- }
- // is the variable field a stream ID?
- boolean isOpenLcbStreamIdFormat() {
- return ( getOpenLcbFormat() == MTI_FORMAT_STREAM_CODE);
- }
-
- void setOpenLcbMTI(int fmt, int mtiHeaderByte) {
+ void setOpenLcbMTI(int mti) {
setFrameTypeOpenLcb();
- setVariableField(mtiHeaderByte);
- setOpenLcbFormat(fmt); // order matters here
+ setVariableField(mti | (FRAME_FORMAT_MTI << 12) );
}
- boolean isOpenLcbMTI(int fmt, int mtiHeaderByte) {
+ boolean isOpenLcbMTI(int mti) {
return isFrameTypeOpenLcb()
- && ( getOpenLcbFormat() == fmt )
- && ( (getVariableField()&~MASK_OPENLCB_FORMAT) == mtiHeaderByte );
+ && ( getOpenLcbFormat() == FRAME_FORMAT_MTI )
+ && ( (getVariableField()&~MASK_OPENLCB_FORMAT) == mti );
}
// end of OpenLCB format and decode support
@@ -187,30 +181,30 @@
void setPCEventReport(EventID eid) {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_PC_EVENT_REPORT);
+ setOpenLcbMTI(MessageTypeIdentifier.ProducerConsumerEventReport.mti());
length=8;
loadFromEid(eid);
}
boolean isPCEventReport() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_PC_EVENT_REPORT);
+ return isOpenLcbMTI(MessageTypeIdentifier.ProducerConsumerEventReport.mti());
}
void setLearnEvent(EventID eid) {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_LEARN_EVENT);
+ setOpenLcbMTI(MessageTypeIdentifier.LearnEvent.mti());
length=8;
loadFromEid(eid);
}
boolean isLearnEvent() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_LEARN_EVENT);
+ return isOpenLcbMTI(MessageTypeIdentifier.LearnEvent.mti());
}
void setInitializationComplete(int alias, NodeID nid) {
nodeAlias = alias;
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_INITIALIZATION_COMPLETE);
+ setOpenLcbMTI(MessageTypeIdentifier.InitializationComplete.mti());
length=6;
byte[] val = nid.getContents();
data[0] = val[0];
@@ -222,7 +216,7 @@
}
boolean isInitializationComplete() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_INITIALIZATION_COMPLETE);
+ return isOpenLcbMTI(MessageTypeIdentifier.InitializationComplete.mti());
}
EventID getEventID() {
@@ -234,22 +228,22 @@
}
boolean isVerifyNID() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_VERIFY_NID);
+ return isOpenLcbMTI(MessageTypeIdentifier.VerifyNodeIdGlobal.mti());
}
void setVerifyNID(NodeID nid) {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_VERIFY_NID);
+ setOpenLcbMTI(MessageTypeIdentifier.VerifyNodeIdGlobal.mti());
length=0;
}
boolean isVerifiedNID() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_VERIFIED_NID);
+ return isOpenLcbMTI(MessageTypeIdentifier.VerifiedNodeId.mti());
}
void setVerifiedNID(NodeID nid) {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_VERIFIED_NID);
+ setOpenLcbMTI(MessageTypeIdentifier.VerifiedNodeId.mti());
length=6;
byte[] val = nid.getContents();
data[0] = val[0];
@@ -261,12 +255,12 @@
}
boolean isIdentifyConsumers() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_IDENTIFY_CONSUMERS);
+ return isOpenLcbMTI(MessageTypeIdentifier.IdentifyConsumer.mti());
}
void setConsumerIdentified(EventID eid) {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_CONSUMER_IDENTIFIED);
+ setOpenLcbMTI(MessageTypeIdentifier.IdentifyConsumer.mti());
length=8;
loadFromEid(eid);
}
@@ -274,18 +268,18 @@
void setConsumerIdentifyRange(EventID eid, EventID mask) {
// does send a message, but not complete yet - RGJ 2009-06-14
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_IDENTIFY_CONSUMERS_RANGE);
+ setOpenLcbMTI(MessageTypeIdentifier.ConsumerIdentifyRange.mti());
length=8;
loadFromEid(eid);
}
boolean isIdentifyProducers() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_IDENTIFY_PRODUCERS);
+ return isOpenLcbMTI(MessageTypeIdentifier.IdentifyProducer.mti());
}
void setProducerIdentified(EventID eid) {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_PRODUCER_IDENTIFIED);
+ setOpenLcbMTI(MessageTypeIdentifier.ProducerIdentified.mti());
length=8;
loadFromEid(eid);
}
@@ -293,33 +287,21 @@
void setProducerIdentifyRange(EventID eid, EventID mask) {
// does send a message, but not complete yet - RGJ 2009-06-14
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_IDENTIFY_PRODUCERS_RANGE);
+ setOpenLcbMTI(MessageTypeIdentifier.ProducerIdentifyRange.mti());
length=8;
loadFromEid(eid);
}
boolean isIdentifyEventsGlobal() {
- return isOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI, MTI_IDENTIFY_EVENTS);
+ return isOpenLcbMTI(MessageTypeIdentifier.IdentifyEventsGlobal.mti());
}
void setIdentifyEventsGlobal() {
init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,MTI_IDENTIFY_EVENTS);
+ setOpenLcbMTI(MessageTypeIdentifier.IdentifyEventsGlobal.mti());
length=0;
}
- void setGlobalMessage(int mti) {
- init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_UNADDRESSED_MTI,mti);
- length=0;
- }
- void setAddressedMessage(int destAlias, byte mti) {
- init(nodeAlias);
- setOpenLcbMTI(MTI_FORMAT_ADDRESSED_NON_DATAGRAM,destAlias);
- length=1;
- data[0] = mti;
- }
-
void loadFromEid(EventID eid) {
length = 8;
byte[] val = eid.getContents();
@@ -336,15 +318,15 @@
// general, but not efficient
boolean isDatagram() {
return isFrameTypeOpenLcb()
- && ( (getOpenLcbFormat() == MTI_FORMAT_ADDRESSED_DATAGRAM_ALL)
- || (getOpenLcbFormat() == MTI_FORMAT_ADDRESSED_DATAGRAM_FIRST)
- || (getOpenLcbFormat() == MTI_FORMAT_ADDRESSED_DATAGRAM_MID)
- || (getOpenLcbFormat() == MTI_FORMAT_ADDRESSED_DATAGRAM_LAST) )
+ && ( (getOpenLcbFormat() == FRAME_FORMAT_ADDRESSED_DATAGRAM_ALL)
+ || (getOpenLcbFormat() == FRAME_FORMAT_ADDRESSED_DATAGRAM_FIRST)
+ || (getOpenLcbFormat() == FRAME_FORMAT_ADDRESSED_DATAGRAM_MID)
+ || (getOpenLcbFormat() == FRAME_FORMAT_ADDRESSED_DATAGRAM_LAST) )
&& (nodeAlias == getVariableField() );
}
// just checks 1st, assumes datagram already checked.
boolean isLastDatagram() {
- return (getOpenLcbFormat() == MTI_FORMAT_ADDRESSED_DATAGRAM_LAST);
+ return (getOpenLcbFormat() == FRAME_FORMAT_ADDRESSED_DATAGRAM_LAST);
}
/**
@@ -354,14 +336,14 @@
init(nodeAlias);
if (last) {
if (first)
- setOpenLcbMTI(MTI_FORMAT_ADDRESSED_DATAGRAM_ALL,destAlias);
+ setVariableField((FRAME_FORMAT_ADDRESSED_DATAGRAM_ALL << 12 ) | destAlias);
else
- setOpenLcbMTI(MTI_FORMAT_ADDRESSED_DATAGRAM_LAST,destAlias);
+ setVariableField((FRAME_FORMAT_ADDRESSED_DATAGRAM_LAST << 12 ) | destAlias);
} else {
if (first)
- setOpenLcbMTI(MTI_FORMAT_ADDRESSED_DATAGRAM_FIRST,destAlias);
+ setVariableField((FRAME_FORMAT_ADDRESSED_DATAGRAM_FIRST << 12 ) | destAlias);
else
- setOpenLcbMTI(MTI_FORMAT_ADDRESSED_DATAGRAM_MID,destAlias);
+ setVariableField((FRAME_FORMAT_ADDRESSED_DATAGRAM_MID << 12 ) | destAlias);
}
length=content.length;
for (int i = 0; i< content.length; i++) {
@@ -400,42 +382,14 @@
/**
* OpenLCB CAN MTI format bits
*/
- static final int MTI_FORMAT_UNADDRESSED_MTI = 0;
+ static final int FRAME_FORMAT_MTI = 1;
//
//
- static final int MTI_FORMAT_ADDRESSED_DATAGRAM_ALL = 2;
- static final int MTI_FORMAT_ADDRESSED_DATAGRAM_FIRST = 3;
- static final int MTI_FORMAT_ADDRESSED_DATAGRAM_MID = 4;
- static final int MTI_FORMAT_ADDRESSED_DATAGRAM_LAST = 5;
- static final int MTI_FORMAT_ADDRESSED_NON_DATAGRAM = 6;
- static final int MTI_FORMAT_STREAM_CODE = 7;
-
-
- /**
- * Basic 12-bit header MTI definitions for OpenLCB on CAN.
- */
-
- static final int MTI_INITIALIZATION_COMPLETE = 0x087;
-
- static final int MTI_VERIFY_NID = 0x8A7;
- static final int MTI_VERIFIED_NID = 0x8B7;
-
- static final...
[truncated message content] |
|
From: <jac...@us...> - 2012-07-22 04:28:12
|
Revision: 2519
http://openlcb.svn.sourceforge.net/openlcb/?rev=2519&view=rev
Author: jacobsen
Date: 2012-07-22 04:28:07 +0000 (Sun, 22 Jul 2012)
Log Message:
-----------
0.6.0 jar files
Modified Paths:
--------------
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-07-31 14:23:34
|
Revision: 2555
http://openlcb.svn.sourceforge.net/openlcb/?rev=2555&view=rev
Author: jacobsen
Date: 2012-07-31 14:23:23 +0000 (Tue, 31 Jul 2012)
Log Message:
-----------
refactor creation of prompt messages
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java
trunk/prototypes/java/src/org/openlcb/ProtocolIdentificationRequestMessage.java
trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java
trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationRequestMessageTest.java
trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java
Modified: trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java 2012-07-31 14:22:30 UTC (rev 2554)
+++ trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java 2012-07-31 14:23:23 UTC (rev 2555)
@@ -49,12 +49,29 @@
}
long value = 0; // multiple bits, e.g. from a node
-
+ NodeID source;
+ NodeID dest;
+
public ProtocolIdentification( ProtocolIdentificationReplyMessage msg) {
value = msg.getValue();
}
public ProtocolIdentification() {
value = 0;
}
+ public ProtocolIdentification(NodeID source, NodeID dest) {
+ this.source = source;
+ this.dest = dest;
+ value = 0;
+ }
+
+ void start(Connection connection) {
+ connection.put(new ProtocolIdentificationRequestMessage(source, dest), null);
+ }
+ public long getValue() {
+ return value;
+ }
+ public List<String> getProtocols() {
+ return Protocols.decode(value);
+ }
}
Modified: trunk/prototypes/java/src/org/openlcb/ProtocolIdentificationRequestMessage.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/ProtocolIdentificationRequestMessage.java 2012-07-31 14:22:30 UTC (rev 2554)
+++ trunk/prototypes/java/src/org/openlcb/ProtocolIdentificationRequestMessage.java 2012-07-31 14:23:23 UTC (rev 2555)
@@ -12,10 +12,10 @@
*/
@Immutable
@ThreadSafe
-public class ProtocolIdentificationRequestMessage extends Message {
+public class ProtocolIdentificationRequestMessage extends AddressedMessage {
- public ProtocolIdentificationRequestMessage(NodeID source) {
- super(source);
+ public ProtocolIdentificationRequestMessage(NodeID source, NodeID dest) {
+ super(source, dest);
}
/**
Modified: trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java 2012-07-31 14:22:30 UTC (rev 2554)
+++ trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java 2012-07-31 14:23:23 UTC (rev 2555)
@@ -97,14 +97,14 @@
Collection<MimicNodeStore.NodeMemo> list = store.getNodeMemos();
MimicNodeStore.NodeMemo memo = list.iterator().next();
- Assert.assertNull(memo.getProtocolIdentification());
+ Assert.assertNotNull(memo.getProtocolIdentification());
}
public void testProtocolInfoAvailableFromNode() {
store.put(pim1,null);
Collection<MimicNodeStore.NodeMemo> list = store.getNodeMemos();
MimicNodeStore.NodeMemo memo = list.iterator().next();
- store.put(new ProtocolIdentificationReplyMessage(nid1, 0x03), null);
+ store.put(new ProtocolIdentificationReplyMessage(nid1, 0xF00000000000L), null);
Assert.assertNotNull(memo.getProtocolIdentification());
}
@@ -120,7 +120,7 @@
store.put(pim1,null);
Assert.assertFalse(listenerFired);
- store.put(new ProtocolIdentificationReplyMessage(nid1, 0x03), null);
+ store.put(new ProtocolIdentificationReplyMessage(nid1, 0xF00000000000L), null);
Assert.assertTrue(listenerFired);
}
@@ -138,10 +138,10 @@
store.put(pim2,null);
Assert.assertFalse(listenerFired);
- store.put(new ProtocolIdentificationReplyMessage(nid1, 0x03), null);
+ store.put(new ProtocolIdentificationReplyMessage(nid1, 0xF00000000000L), null);
Assert.assertFalse(listenerFired);
- store.put(new ProtocolIdentificationReplyMessage(nid2, 0x03), null);
+ store.put(new ProtocolIdentificationReplyMessage(nid2, 0xF00000000000L), null);
Assert.assertTrue(listenerFired);
}
@@ -158,7 +158,7 @@
Collection<MimicNodeStore.NodeMemo> list = store.getNodeMemos();
MimicNodeStore.NodeMemo memo = list.iterator().next();
- Assert.assertNull(memo.getSimpleNodeIdent());
+ Assert.assertNotNull(memo.getSimpleNodeIdent());
}
public void testSimpleInfoAvailableFromNode() {
Modified: trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationRequestMessageTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationRequestMessageTest.java 2012-07-31 14:22:30 UTC (rev 2554)
+++ trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationRequestMessageTest.java 2012-07-31 14:23:23 UTC (rev 2555)
@@ -17,23 +17,32 @@
public void testEqualsSame() {
Message m1 = new ProtocolIdentificationRequestMessage(
- nodeID1 );
+ nodeID1, nodeID2 );
Message m2 = new ProtocolIdentificationRequestMessage(
- nodeID1 );
+ nodeID1, nodeID2 );
Assert.assertTrue(m1.equals(m2));
}
- public void testNotEqualsDifferentNode() {
+ public void testNotEqualsDifferentSrcNode() {
Message m1 = new ProtocolIdentificationRequestMessage(
- nodeID1 );
+ nodeID1, nodeID2 );
Message m2 = new ProtocolIdentificationRequestMessage(
- nodeID2 );
+ nodeID2, nodeID2 );
Assert.assertTrue( ! m1.equals(m2));
}
+ public void testNotEqualsDifferentDestNode() {
+ Message m1 = new ProtocolIdentificationRequestMessage(
+ nodeID2, nodeID1 );
+ Message m2 = new ProtocolIdentificationRequestMessage(
+ nodeID2, nodeID2 );
+
+ Assert.assertTrue( ! m1.equals(m2));
+ }
+
public void testHandling() {
result = false;
Node n = new Node(){
@@ -42,7 +51,7 @@
result = true;
}
};
- Message m = new ProtocolIdentificationRequestMessage(nodeID1);
+ Message m = new ProtocolIdentificationRequestMessage(nodeID1, nodeID2);
n.put(m, null);
Modified: trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java 2012-07-31 14:22:30 UTC (rev 2554)
+++ trunk/prototypes/java/test/org/openlcb/SimpleNodeIdentTest.java 2012-07-31 14:23:23 UTC (rev 2555)
@@ -11,7 +11,8 @@
*/
public class SimpleNodeIdentTest extends TestCase {
public void testCtor() {
- new SimpleNodeIdent();
+ new SimpleNodeIdent(new NodeID(new byte[]{1,3,3,4,5,6}),
+ new NodeID(new byte[]{1,3,3,4,5,7}));
}
public void testCreationFromMessage() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-01 11:29:21
|
Revision: 2565
http://openlcb.svn.sourceforge.net/openlcb/?rev=2565&view=rev
Author: jacobsen
Date: 2012-08-01 11:29:15 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
0.6.2
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-08-01 11:27:34 UTC (rev 2564)
+++ trunk/prototypes/java/manifest 2012-08-01 11:29:15 UTC (rev 2565)
@@ -7,6 +7,6 @@
Specification-Version: \xD20.6.0\xD3
Specification-Vendor: \xD2OpenLCB group"
Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.6.0\xD3
+Package-Version: \xD20.6.2\xD3
Package-Vendor: \xD2OpenLCB group\xD3
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-01 13:10:14
|
Revision: 2568
http://openlcb.svn.sourceforge.net/openlcb/?rev=2568&view=rev
Author: jacobsen
Date: 2012-08-01 13:10:07 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
proper value handling; add CDI
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java
trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationTest.java
Modified: trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java 2012-08-01 13:09:35 UTC (rev 2567)
+++ trunk/prototypes/java/src/org/openlcb/ProtocolIdentification.java 2012-08-01 13:10:07 UTC (rev 2568)
@@ -15,20 +15,22 @@
*/
public class ProtocolIdentification {
- public enum Protocols {
- ProtocolIdentification( 0x800000000000L,"ProtocolIdentification"),
- Datagram( 0x400000000000L,"Datagram"),
- Stream( 0x200000000000L,"Stream"),
- Configuration( 0x100000000000L,"Configuration"),
- Reservation( 0x080000000000L,"Reservation"),
- ProducerConsumer( 0x040000000000L,"ProducerConsumer"),
- Identification( 0x020000000000L,"Identification"),
+ public enum Protocol {
+ ProtocolIdentification( 0x800000000000L,"ProtocolIdentification"),
+ Datagram( 0x400000000000L,"Datagram"),
+ Stream( 0x200000000000L,"Stream"),
+ Configuration( 0x100000000000L,"Configuration"),
+ Reservation( 0x080000000000L,"Reservation"),
+ ProducerConsumer( 0x040000000000L,"ProducerConsumer"),
+ Identification( 0x020000000000L,"Identification"),
TeachingLearningConfiguration(0x010000000000L,"TeachingLearningConfiguration"),
- RemoteButton( 0x008000000000L,"RemoteButton"),
- AbbreviatedDefaultCDI( 0x004000000000L,"AbbreviatedDefaultCDI"),
- Display( 0x002000000000L,"Display");
+ RemoteButton( 0x008000000000L,"RemoteButton"),
+ AbbreviatedDefaultCDI( 0x004000000000L,"AbbreviatedDefaultCDI"),
+ Display( 0x002000000000L,"Display"),
+ SimpleNodeID( 0x001000000000L,"SNII"),
+ ConfigurationDescription(0x000800000000L,"CDI");
- Protocols(long value, String name) {
+ Protocol(long value, String name) {
this.value = value;
this.name = name;
}
@@ -38,14 +40,22 @@
boolean supports(long r) {
return ( (this.value & r) != 0 );
}
+ public String getName() { return name; }
- static List<String> decode(long r) {
+ static List<String> decodeNames(long r) {
ArrayList<String> retval = new ArrayList<String>();
- for (Protocols t : Protocols.values()) {
+ for (Protocol t : Protocol.values()) {
if ( t.supports(r) ) retval.add(t.name);
}
return retval;
}
+ static List<Protocol> decode(long r) {
+ ArrayList<Protocol> retval = new ArrayList<Protocol>();
+ for (Protocol t : Protocol.values()) {
+ if ( t.supports(r) ) retval.add(t);
+ }
+ return retval;
+ }
}
long value = 0; // multiple bits, e.g. from a node
@@ -71,7 +81,10 @@
public long getValue() {
return value;
}
- public List<String> getProtocols() {
- return Protocols.decode(value);
+ public List<Protocol> getProtocols() {
+ return Protocol.decode(value);
}
+ public List<String> getProtocolNames() {
+ return Protocol.decodeNames(value);
+ }
}
Modified: trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationTest.java 2012-08-01 13:09:35 UTC (rev 2567)
+++ trunk/prototypes/java/test/org/openlcb/ProtocolIdentificationTest.java 2012-08-01 13:10:07 UTC (rev 2568)
@@ -15,43 +15,56 @@
}
public void testDecode0() {
- java.util.List result = ProtocolIdentification.Protocols.decode(0x000000000000L);
+ java.util.List result = ProtocolIdentification.Protocol.decode(0x000000000000L);
Assert.assertEquals("length", 0, result.size());
}
public void testDecode1() {
- java.util.List result = ProtocolIdentification.Protocols.decode(0x800000000000L);
+ java.util.List result = ProtocolIdentification.Protocol.decodeNames(0x800000000000L);
Assert.assertEquals("length", 1, result.size());
Assert.assertEquals("result 1", "ProtocolIdentification", result.get(0));
}
public void testDecode2() {
- java.util.List result = ProtocolIdentification.Protocols.decode(0x880000000000L);
+ java.util.List result = ProtocolIdentification.Protocol.decodeNames(0x880000000000L);
Assert.assertEquals("length", 2, result.size());
Assert.assertEquals("result 1", "ProtocolIdentification", result.get(0));
Assert.assertEquals("result 2", "Reservation", result.get(1));
}
+ public void testDecode3() {
+ java.util.List result = ProtocolIdentification.Protocol.decodeNames(0xF01800000000L);
+
+ Assert.assertEquals("length", 6, result.size());
+ Assert.assertEquals("result 1", "ProtocolIdentification", result.get(0));
+ Assert.assertEquals("result 2", "Datagram", result.get(1));
+ Assert.assertEquals("result 3", "Stream", result.get(2));
+ Assert.assertEquals("result 4", "Configuration", result.get(3));
+ Assert.assertEquals("result 5", "SNII", result.get(4));
+ Assert.assertEquals("result 6", "CDI", result.get(5));
+ }
+
public void testSupports1() {
- ProtocolIdentification.Protocols p = ProtocolIdentification.Protocols.Datagram;
+ ProtocolIdentification.Protocol p = ProtocolIdentification.Protocol.Datagram;
Assert.assertTrue("supports", p.supports(~0));
}
public void testSupports2() {
- ProtocolIdentification.Protocols p = ProtocolIdentification.Protocols.Datagram;
+ ProtocolIdentification.Protocol p = ProtocolIdentification.Protocol.Datagram;
Assert.assertTrue("supports", !p.supports(0));
}
public void testCreationFromMessage() {
- new ProtocolIdentification(
+ ProtocolIdentification pi = new ProtocolIdentification(
new ProtocolIdentificationReplyMessage(
new NodeID(new byte[]{1,3,3,4,5,6}),
0x03));
+ Assert.assertTrue((long)0x03 == pi.getValue());
}
// from here down is testing infrastructure
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-01 13:11:14
|
Revision: 2569
http://openlcb.svn.sourceforge.net/openlcb/?rev=2569&view=rev
Author: jacobsen
Date: 2012-08-01 13:11:08 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
PIP
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
Modified: trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-08-01 13:10:07 UTC (rev 2568)
+++ trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-08-01 13:11:08 UTC (rev 2569)
@@ -100,11 +100,21 @@
retlist.add(new VerifiedNodeIDNumberMessage(source));
return retlist;
+ case OptionalInteractionRejected: {
+ int d2 = f.getNumDataElements() >= 2 ? f.getElement(2) : 0;
+ int d3 = f.getNumDataElements() >= 3 ? f.getElement(3) : 0;
+ int d4 = f.getNumDataElements() >= 4 ? f.getElement(4) : 0;
+ int d5 = f.getNumDataElements() >= 5 ? f.getElement(5) : 0;
+ int retmti = ((d2&0xff)<<8) | (d3&0xff);
+ int code = ((d4&0xff)<<8) | (d5&0xff);;
+ retlist.add(new OptionalIntRejectedMessage(source, dest,retmti,code));
+ return retlist;
+ }
case ProtocolSupportInquiry:
retlist.add(new ProtocolIdentificationRequestMessage(source, dest));
return retlist;
case ProtocolSupportReply:
- retlist.add(new ProtocolIdentificationReplyMessage(source,f.bodyAsLong()));
+ retlist.add(new ProtocolIdentificationReplyMessage(source,f.dataAsLong()));
return retlist;
case IdentifyConsumer:
@@ -142,7 +152,7 @@
retlist.add(new DatagramAcknowledgedMessage(source,dest));
return retlist;
case DatagramRejected:
- retlist.add(new DatagramRejectedMessage(source,dest,(int)f.bodyAsLong()));
+ retlist.add(new DatagramRejectedMessage(source,dest,(int)f.dataAsLong()));
return retlist;
default: return null;
}
@@ -299,7 +309,19 @@
f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
retlist.add(f);
}
+
/**
+ * Handle "Protocol Identification Inquiry (Request)" message
+ */
+ public void handleProtocolIdentificationRequest(ProtocolIdentificationRequestMessage msg, Connection sender){
+ OpenLcbCanFrame f = new OpenLcbCanFrame(0x00);
+ f.setOpenLcbMTI(MessageTypeIdentifier.ProtocolSupportInquiry.mti());
+ f.setDestAlias(map.getAlias(msg.getDestNodeID()));
+ f.setSourceAlias(map.getAlias(msg.getSourceNodeID()));
+ retlist.add(f);
+ }
+
+ /**
* Handle "Producer/Consumer Event Report" message
*/
@Override
Modified: trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-08-01 13:10:07 UTC (rev 2568)
+++ trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-08-01 13:11:08 UTC (rev 2569)
@@ -203,6 +203,42 @@
Assert.assertEquals(13,data[4]);
}
+ public void testPipReplyFrame() {
+ OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19668071);
+ frame.setData(new byte[]{0x02, (byte)0xB4, (byte)0xD5, 0x00, 0x00, 0x00, 0x00, 0x00});
+
+ MessageBuilder b = new MessageBuilder(map);
+
+ List<Message> list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 1, list.size());
+ Message msg = list.get(0);
+
+ Assert.assertTrue(msg instanceof ProtocolIdentificationReplyMessage);
+
+ Assert.assertTrue(((ProtocolIdentificationReplyMessage)msg).getValue() == 0xD50000000000L);
+ }
+
+ public void testOptionalRejectFrame() {
+ OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19068071);
+ frame.setData(new byte[]{0x02, 0x02, (byte)0x12, 0x34, 0x56, 0x78, 0x00, 0x00});
+
+ MessageBuilder b = new MessageBuilder(map);
+
+ List<Message> list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 1, list.size());
+ Message msg = list.get(0);
+
+ Assert.assertTrue(msg instanceof OptionalIntRejectedMessage);
+
+ Assert.assertEquals(0x1234, ((OptionalIntRejectedMessage)msg).getMti());
+ Assert.assertEquals(0x5678, ((OptionalIntRejectedMessage)msg).getCode());
+ }
+
+
// from here down is testing infrastructure
public MessageBuilderTest(String s) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-01 13:14:27
|
Revision: 2572
http://openlcb.svn.sourceforge.net/openlcb/?rev=2572&view=rev
Author: jacobsen
Date: 2012-08-01 13:14:18 +0000 (Wed, 01 Aug 2012)
Log Message:
-----------
improve CDI access from network tree
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java
trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java
trunk/prototypes/java/src/org/openlcb/swing/networktree/NodeTreeRep.java
trunk/prototypes/java/src/org/openlcb/swing/networktree/TreePane.java
trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java
trunk/prototypes/java/test/org/openlcb/swing/networktree/TreePaneTest.java
Modified: trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java 2012-08-01 13:13:28 UTC (rev 2571)
+++ trunk/prototypes/java/src/org/openlcb/MimicNodeStore.java 2012-08-01 13:14:18 UTC (rev 2572)
@@ -107,7 +107,7 @@
}
public void handleOptionalIntRejected(OptionalIntRejectedMessage msg, Connection sender){
- if (msg.getMti() == 0x0c) {
+ if (msg.getMti() == MessageTypeIdentifier.SimpleNodeIdentInfoRequest.mti()) {
// check for temporary error
// have to resend the SNII request
connection.put(new SimpleNodeIdentInfoRequestMessage(id, msg.getSourceNodeID()), null);
Modified: trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java 2012-08-01 13:13:28 UTC (rev 2571)
+++ trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java 2012-08-01 13:14:18 UTC (rev 2572)
@@ -20,12 +20,25 @@
public CdiPanel () { super(); }
+ /**
+ * @param accessor Provides access for read, write operations back to layout
+ * @param factory Implements hooks for optional interface elements
+ */
+ public void initComponents(ReadWriteAccess accessor, GuiItemFactory factory) {
+ initComponents(accessor);
+ this.factory = new GuiItemFactory();
+ }
+
+ /**
+ * @param accessor Provides access for read, write operations back to layout
+ */
public void initComponents(ReadWriteAccess accessor) {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.accessor = accessor;
}
ReadWriteAccess accessor;
+ GuiItemFactory factory;
public void loadCDI(CdiRep c) {
add(createIdentificationPane(c));
@@ -547,18 +560,34 @@
}
/**
- * Memo class for adding access to e.g. a MemoryConfig service.
+ * Provide access to e.g. a MemoryConfig service.
*
* Default just writes output for debug
*/
- abstract public static class ReadWriteAccess {
- abstract public void doWrite(long address, int space, byte[] data);
- abstract public void doRead(long address, int space, int length, final ReadReturn handler);
- }
- /**
- * Memo class for handling read-return data
- */
- abstract public class ReadReturn {
- abstract public void returnData(byte[] data);
- }
+ public static class ReadWriteAccess {
+ public void doWrite(long address, int space, byte[] data) {
+ System.out.println("Write to "+address+" in space "+space);
+ }
+ public void doRead(long address, int space, int length, final ReadReturn handler) {
+ System.out.println("Read from "+address+" in space "+space);
+ }
+ }
+
+ /**
+ * Handle GUI hook requests if needed
+ *
+ * Default behavior is to do nothing
+ */
+ public static class GuiItemFactory {
+ public JButton readButton(JButton button) {
+ return button;
+ }
+ }
+
+ /**
+ * Memo class for handling read-return data
+ */
+ abstract public class ReadReturn {
+ abstract public void returnData(byte[] data);
+ }
}
Modified: trunk/prototypes/java/src/org/openlcb/swing/networktree/NodeTreeRep.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/swing/networktree/NodeTreeRep.java 2012-08-01 13:13:28 UTC (rev 2571)
+++ trunk/prototypes/java/src/org/openlcb/swing/networktree/NodeTreeRep.java 2012-08-01 13:14:18 UTC (rev 2572)
@@ -25,11 +25,14 @@
DefaultMutableTreeNode getThis() { return this; }
DefaultTreeModel getTreeModel() { return treeModel; }
- public NodeTreeRep(MimicNodeStore.NodeMemo memo, MimicNodeStore store, DefaultTreeModel treeModel) {
+ SelectionKeyLoader loader;
+
+ public NodeTreeRep(MimicNodeStore.NodeMemo memo, MimicNodeStore store, DefaultTreeModel treeModel, SelectionKeyLoader loader) {
super("Node");
this.memo = memo;
this.store = store;
this.treeModel = treeModel;
+ this.loader = loader;
}
void initConnections() {
@@ -45,31 +48,44 @@
updateSimpleNodeIdent((SimpleNodeIdent)e.getNewValue());
}
if (e.getPropertyName().equals("updateConsumers")) {
- getTreeModel().insertNodeInto(new DefaultMutableTreeNode("Supported Consumers"), getThis(),
+ getTreeModel().insertNodeInto(newNode("Supported Consumers"), getThis(),
getThis().getChildCount());
}
if (e.getPropertyName().equals("updateProducers")) {
- getTreeModel().insertNodeInto(new DefaultMutableTreeNode("Supported Producers"), getThis(),
+ getTreeModel().insertNodeInto(newNode("Supported Producers"), getThis(),
getThis().getChildCount());
}
}
});
+ // see if protocol info already present
+ ProtocolIdentification pip = store.getProtocolIdentification(memo.getNodeID());
+ if (pip != null) updateProtocolIdent(pip); // otherwise, will be notified later
+
// see if simple ID info already present
SimpleNodeIdent snii = store.getSimpleNodeIdent(memo.getNodeID());
if (snii != null) updateSimpleNodeIdent(snii); // otherwise, will be notified later
- // see if protocol info already present
- ProtocolIdentification pip = store.getProtocolIdentification(memo.getNodeID());
- if (pip != null) updateProtocolIdent(pip); // otherwise, will be notified later
}
+ DefaultMutableTreeNode newNode(String name, SelectionKey key) {
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode(name);
+ node.setUserObject(key);
+ return node;
+ }
+
+ DefaultMutableTreeNode newNode(String name) {
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode(name);
+ node.setUserObject(new SelectionKey(name, memo.getNodeID()));
+ return node;
+ }
+
void updateSimpleNodeIdent(SimpleNodeIdent e) {
if (simpleInfoMfgNode == null) {
if (e.getMfgName().replace(" ","").length()>0) {
- simpleInfoMfgNode = new DefaultMutableTreeNode("Mfg: "+e.getMfgName());
+ simpleInfoMfgNode = newNode("Mfg: "+e.getMfgName());
getTreeModel().insertNodeInto(simpleInfoMfgNode,
getThis(),
getThis().getChildCount());
@@ -79,7 +95,7 @@
}
if (simpleInfoModelNode == null) {
if (e.getModelName().replace(" ","").length()>0) {
- simpleInfoModelNode = new DefaultMutableTreeNode("Mod: "+e.getModelName());
+ simpleInfoModelNode = newNode("Mod: "+e.getModelName());
getTreeModel().insertNodeInto(simpleInfoModelNode,
getThis(),
getThis().getChildCount());
@@ -89,7 +105,7 @@
}
if (simpleInfoHardwareVersionNode == null) {
if (e.getHardwareVersion().replace(" ","").length()>0) {
- simpleInfoHardwareVersionNode = new DefaultMutableTreeNode("Hardware: "+e.getHardwareVersion());
+ simpleInfoHardwareVersionNode = newNode("Hardware: "+e.getHardwareVersion());
getTreeModel().insertNodeInto(simpleInfoHardwareVersionNode,
getThis(),
getThis().getChildCount());
@@ -99,7 +115,7 @@
}
if (simpleInfoSoftwareVersionNode == null) {
if (e.getSoftwareVersion().replace(" ","").length()>0) {
- simpleInfoSoftwareVersionNode = new DefaultMutableTreeNode("Software: "+e.getSoftwareVersion());
+ simpleInfoSoftwareVersionNode = newNode("Software: "+e.getSoftwareVersion());
getTreeModel().insertNodeInto(simpleInfoSoftwareVersionNode,
getThis(),
getThis().getChildCount());
@@ -119,7 +135,7 @@
}
if (simpleInfoUserDescNode == null ) {
if (e.getUserDesc().replace(" ","").length()>0) {
- simpleInfoUserDescNode = new DefaultMutableTreeNode("Desc: "+e.getUserDesc());
+ simpleInfoUserDescNode = newNode("Desc: "+e.getUserDesc());
getTreeModel().insertNodeInto(simpleInfoUserDescNode,
getThis(),
getThis().getChildCount());
@@ -129,17 +145,39 @@
}
}
+ DefaultMutableTreeNode pipNode;
+
void updateProtocolIdent(ProtocolIdentification pi) {
- DefaultMutableTreeNode node = new DefaultMutableTreeNode("Supported Protocols");
- getTreeModel().insertNodeInto(node, getThis(),
- getThis().getChildCount());
+ if (pi.getValue() != 0) {
- List<String> protocols = pi.getProtocols();
-
- for (String s : protocols) {
-
- getTreeModel().insertNodeInto(new DefaultMutableTreeNode(s), node,
- node.getChildCount());
+ if (pipNode == null) {
+ pipNode = newNode("Supported Protocols");
+ getTreeModel().insertNodeInto(pipNode, getThis(),
+ getThis().getChildCount());
+ }
+
+ List<ProtocolIdentification.Protocol> protocols = pi.getProtocols();
+
+ for (ProtocolIdentification.Protocol p : protocols) {
+ DefaultMutableTreeNode node = null;
+
+ // try to figure out type
+ switch (p) {
+ case ConfigurationDescription:
+ node = newNode(p.getName(), loader.cdiKey(p.getName(), memo.getNodeID()));
+ break;
+ case ProtocolIdentification:
+ case Datagram:
+ case Configuration:
+ case SimpleNodeID:
+ default:
+ node = newNode(p.getName());
+ break;
+ }
+
+ getTreeModel().insertNodeInto(node, pipNode,
+ pipNode.getChildCount());
+ }
}
}
@@ -157,4 +195,45 @@
return memo.getNodeID().toString();
}
+
+ /**
+ * When a JTree node is selected, it's user object
+ * (of this class) is pulled and invoked.
+ *
+ * Inherit from this to modify.
+ */
+ static public class SelectionKey {
+ public SelectionKey(String name, NodeID node) { this.name = name; this.node = node; }
+ protected String name;
+ protected NodeID node;
+ public void select(DefaultMutableTreeNode rep) {
+ System.out.println("Selected: "+rep+" for "+name+" on "+node);
+ }
+ public String toString() {
+ return name;
+ }
+ }
+
+ /**
+ * Invoked for various protocols to load the
+ * selection key object
+ */
+ static public class SelectionKeyLoader {
+ public SelectionKey pipKey(String name, NodeID node) {
+ return new SelectionKey(name, node);
+ }
+ public SelectionKey sniiKey(String name, NodeID node) {
+ return new SelectionKey(name, node);
+ }
+ public SelectionKey datagramKey(String name, NodeID node) {
+ return new SelectionKey(name, node);
+ }
+ public SelectionKey configurationKey(String name, NodeID node) {
+ return new SelectionKey(name, node);
+ }
+ public SelectionKey cdiKey(String name, NodeID node) {
+ return new SelectionKey(name, node);
+ }
+ }
+
}
Modified: trunk/prototypes/java/src/org/openlcb/swing/networktree/TreePane.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/swing/networktree/TreePane.java 2012-08-01 13:13:28 UTC (rev 2571)
+++ trunk/prototypes/java/src/org/openlcb/swing/networktree/TreePane.java 2012-08-01 13:14:18 UTC (rev 2572)
@@ -3,6 +3,7 @@
package org.openlcb.swing.networktree;
import javax.swing.*;
+import javax.swing.event.*;
import javax.swing.tree.*;
import java.beans.PropertyChangeListener;
@@ -27,19 +28,23 @@
MimicNodeStore getStore() { return store; }
DefaultTreeModel getTreeModel() { return treeModel; }
+ JTree tree;
- public void initComponents(MimicNodeStore store, final Connection connection, final NodeID node) {
-
+ NodeID nullNode = new NodeID(new byte[]{0,0,0,0,0,0});
+
+ public void initComponents(MimicNodeStore store, final Connection connection,
+ final NodeID node, final NodeTreeRep.SelectionKeyLoader loader) {
this.store = store;
nodes = new DefaultMutableTreeNode("OpenLCB Network");
-
+
// build GUI
setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));
treeModel = new DefaultTreeModel(nodes);
- JTree tree = new JTree(treeModel);
+ tree = new JTree(treeModel);
tree.setEditable(true);
+ tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
JScrollPane treeView = new JScrollPane(tree);
add(treeView);
@@ -50,20 +55,23 @@
if (e.getPropertyName().equals("AddNode")) {
MimicNodeStore.NodeMemo memo = (MimicNodeStore.NodeMemo) e.getNewValue();
-
- NodeTreeRep n = new NodeTreeRep(memo, getStore(), getTreeModel());
- treeModel.insertNodeInto(n, nodes,
- nodes.getChildCount());
- n.initConnections();
+ if (!memo.getNodeID().equals(nullNode)) {
+ NodeTreeRep n = new NodeTreeRep(memo, getStore(), getTreeModel(), loader);
+ treeModel.insertNodeInto(n, nodes,
+ nodes.getChildCount());
+ n.initConnections();
+ }
}
}
});
// add nodes that exist now
for (MimicNodeStore.NodeMemo memo : store.getNodeMemos() ) {
- NodeTreeRep n = new NodeTreeRep(memo, store, treeModel);
- nodes.add(n);
- n.initConnections();
+ if (!memo.getNodeID().equals(nullNode)) {
+ NodeTreeRep n = new NodeTreeRep(memo, store, treeModel, loader);
+ nodes.add(n);
+ n.initConnections();
+ }
}
// start with top level expanded
@@ -80,5 +88,9 @@
}
+
+ public void addTreeSelectionListener(TreeSelectionListener listener) {
+ tree.addTreeSelectionListener(listener);
+ }
}
Modified: trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java 2012-08-01 13:13:28 UTC (rev 2571)
+++ trunk/prototypes/java/test/org/openlcb/MimicNodeStoreTest.java 2012-08-01 13:14:18 UTC (rev 2572)
@@ -178,7 +178,7 @@
MimicNodeStore.NodeMemo memo = list.iterator().next();
Assert.assertNull(lastMessage);
- store.put(new OptionalIntRejectedMessage(nid1,nid1,0x0c,1), null);
+ store.put(new OptionalIntRejectedMessage(nid1,nid1,0x0DE8,1), null);
Assert.assertNotNull(lastMessage);
Assert.assertEquals(lastMessage, new SimpleNodeIdentInfoRequestMessage(nid1, nid1) );
Modified: trunk/prototypes/java/test/org/openlcb/swing/networktree/TreePaneTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/swing/networktree/TreePaneTest.java 2012-08-01 13:13:28 UTC (rev 2571)
+++ trunk/prototypes/java/test/org/openlcb/swing/networktree/TreePaneTest.java 2012-08-01 13:14:18 UTC (rev 2572)
@@ -3,12 +3,15 @@
import org.openlcb.*;
import org.openlcb.implementations.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import javax.swing.event.*;
+
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import javax.swing.*;
/**
* Simulate nine nodes interacting on a single gather/scatter
* "link", and feed them to monitor.
@@ -37,6 +40,8 @@
EventID eventB = new EventID(new byte[]{1,0,0,0,0,0,2,0});
EventID eventC = new EventID(new byte[]{1,0,0,0,0,0,3,0});
+ Message pipmsg = new ProtocolIdentificationReplyMessage(nid2, 0xF01800000000L);
+
JFrame frame;
TreePane pane;
Connection connection = new AbstractConnection() {
@@ -53,9 +58,18 @@
// Test is really popping a window before doing all else
frame = new JFrame();
frame.setTitle("TreePane Test");
- TreePane pane = new TreePane();
+ pane = new TreePane();
frame.add( pane );
- pane.initComponents(store, null, null);
+ pane.initComponents(store, null, null,
+ new NodeTreeRep.SelectionKeyLoader() {
+ public NodeTreeRep.SelectionKey cdiKey(String name, NodeID node) {
+ return new NodeTreeRep.SelectionKey(name, node) {
+ public void select(DefaultMutableTreeNode rep) {
+ System.out.println("Making special fuss over: "+rep+" for "+name+" on "+node);
+ }
+ };
+ }
+ });
frame.pack();
frame.setMinimumSize(new java.awt.Dimension(200,200));
frame.setVisible(true);
@@ -82,8 +96,7 @@
Message msg;
msg = new ProducerIdentifiedMessage(nid2, eventA);
store.put(msg, null);
- msg = new ProtocolIdentificationReplyMessage(nid2, 0xF00000000000L);
- store.put(msg, null);
+ store.put(pipmsg, null);
}
public void testWith1stSNII() {
@@ -91,15 +104,44 @@
Message msg;
msg = new ProducerIdentifiedMessage(nid2, eventA);
store.put(msg, null);
- msg = new ProtocolIdentificationReplyMessage(nid2, 0xF00000000000L);
+ store.put(pipmsg, null);
+
+ msg = new SimpleNodeIdentInfoReplyMessage(nid2,
+ new byte[]{0x01, 0x31, 0x32, 0x33, 0x41, 0x42, (byte)0xC2, (byte)0xA2, 0x44, 0x00}
+ );
store.put(msg, null);
+ }
+
+ public void testWithSelect() {
+ frame.setTitle("listener test");
+
+ pane.addTreeSelectionListener(new TreeSelectionListener() {
+ public void valueChanged(TreeSelectionEvent e) {
+ JTree tree = (JTree) e.getSource();
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode)
+ tree.getLastSelectedPathComponent();
+
+ if (node == null) return;
+ System.out.print("Test prints selected treenode "+node);
+ if (node.getUserObject() instanceof NodeTreeRep.SelectionKey) {
+ System.out.println(" and invokes");
+ ((NodeTreeRep.SelectionKey)node.getUserObject()).select((DefaultMutableTreeNode)node);
+ } else {
+ System.out.println();
+ }
+ }
+ });
+ Message msg;
+ msg = new ProducerIdentifiedMessage(nid2, eventA);
+ store.put(msg, null);
+ store.put(pipmsg, null);
msg = new SimpleNodeIdentInfoReplyMessage(nid2,
new byte[]{0x01, 0x31, 0x32, 0x33, 0x41, 0x42, (byte)0xC2, (byte)0xA2, 0x44, 0x00}
);
store.put(msg, null);
}
-
+
// from here down is testing infrastructure
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-04 20:13:11
|
Revision: 2584
http://openlcb.svn.sourceforge.net/openlcb/?rev=2584&view=rev
Author: jacobsen
Date: 2012-08-04 20:13:04 +0000 (Sat, 04 Aug 2012)
Log Message:
-----------
handle short replies OK
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
Modified: trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-08-04 20:08:54 UTC (rev 2583)
+++ trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-08-04 20:13:04 UTC (rev 2584)
@@ -101,10 +101,10 @@
return retlist;
case OptionalInteractionRejected: {
- int d2 = f.getNumDataElements() >= 2 ? f.getElement(2) : 0;
- int d3 = f.getNumDataElements() >= 3 ? f.getElement(3) : 0;
- int d4 = f.getNumDataElements() >= 4 ? f.getElement(4) : 0;
- int d5 = f.getNumDataElements() >= 5 ? f.getElement(5) : 0;
+ int d2 = f.getNumDataElements() >= 3 ? f.getElement(2) : 0;
+ int d3 = f.getNumDataElements() >= 4 ? f.getElement(3) : 0;
+ int d4 = f.getNumDataElements() >= 5 ? f.getElement(4) : 0;
+ int d5 = f.getNumDataElements() >= 6 ? f.getElement(5) : 0;
int retmti = ((d2&0xff)<<8) | (d3&0xff);
int code = ((d4&0xff)<<8) | (d5&0xff);;
retlist.add(new OptionalIntRejectedMessage(source, dest,retmti,code));
Modified: trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-08-04 20:08:54 UTC (rev 2583)
+++ trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-08-04 20:13:04 UTC (rev 2584)
@@ -220,7 +220,7 @@
Assert.assertTrue(((ProtocolIdentificationReplyMessage)msg).getValue() == 0xD50000000000L);
}
- public void testOptionalRejectFrame() {
+ public void testOptionalRejectFrame1() {
OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
frame.setHeader(0x19068071);
frame.setData(new byte[]{0x02, 0x02, (byte)0x12, 0x34, 0x56, 0x78, 0x00, 0x00});
@@ -238,6 +238,42 @@
Assert.assertEquals(0x5678, ((OptionalIntRejectedMessage)msg).getCode());
}
+ public void testOptionalRejectFrame2() {
+ OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19068071);
+ frame.setData(new byte[]{0x02, 0x02, (byte)0x12, 0x34, 0x56, 0x78});
+
+ MessageBuilder b = new MessageBuilder(map);
+
+ List<Message> list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 1, list.size());
+ Message msg = list.get(0);
+
+ Assert.assertTrue(msg instanceof OptionalIntRejectedMessage);
+
+ Assert.assertEquals(0x1234, ((OptionalIntRejectedMessage)msg).getMti());
+ Assert.assertEquals(0x5678, ((OptionalIntRejectedMessage)msg).getCode());
+ }
+
+ public void testOptionalRejectFrame3() {
+ OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19068071);
+ frame.setData(new byte[]{0x02, 0x02, (byte)0x12, 0x34});
+
+ MessageBuilder b = new MessageBuilder(map);
+
+ List<Message> list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 1, list.size());
+ Message msg = list.get(0);
+
+ Assert.assertTrue(msg instanceof OptionalIntRejectedMessage);
+
+ Assert.assertEquals(0x1234, ((OptionalIntRejectedMessage)msg).getMti());
+ Assert.assertEquals(0, ((OptionalIntRejectedMessage)msg).getCode());
+ }
+
// from here down is testing infrastructure
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-04 22:51:44
|
Revision: 2589
http://openlcb.svn.sourceforge.net/openlcb/?rev=2589&view=rev
Author: jacobsen
Date: 2012-08-04 22:51:38 +0000 (Sat, 04 Aug 2012)
Log Message:
-----------
testing of version class
Modified Paths:
--------------
trunk/prototypes/java/manifest
trunk/prototypes/java/test/org/openlcb/PackageTest.java
Added Paths:
-----------
trunk/prototypes/java/test/org/openlcb/VersionTest.java
Modified: trunk/prototypes/java/manifest
===================================================================
--- trunk/prototypes/java/manifest 2012-08-04 20:47:34 UTC (rev 2588)
+++ trunk/prototypes/java/manifest 2012-08-04 22:51:38 UTC (rev 2589)
@@ -3,10 +3,10 @@
Class-Path: lib/junit.jar lib/jdom.jar lib/jlfgr-1_0.jar
Name: org.openlcb
-Specification-Title: \xD2OpenLCB\xD3
-Specification-Version: \xD20.6.0\xD3
-Specification-Vendor: \xD2OpenLCB group"
-Package-Title: \xD2openlcb\xD3
-Package-Version: \xD20.6.2\xD3
-Package-Vendor: \xD2OpenLCB group\xD3
+Specification-Title: OpenLCB
+Specification-Version: 0.6.1
+Specification-Vendor: OpenLCB group
+Package-Title: openlcb
+Package-Version: 0.6.3
+Package-Vendor: OpenLCB group
Modified: trunk/prototypes/java/test/org/openlcb/PackageTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/PackageTest.java 2012-08-04 20:47:34 UTC (rev 2588)
+++ trunk/prototypes/java/test/org/openlcb/PackageTest.java 2012-08-04 22:51:38 UTC (rev 2589)
@@ -30,6 +30,7 @@
TestSuite suite = new TestSuite(PackageTest.class);
suite.addTest(UtilitiesTest.suite());
+ suite.addTest(VersionTest.suite());
suite.addTest(EventIDTest.suite());
suite.addTest(NodeIDTest.suite());
Copied: trunk/prototypes/java/test/org/openlcb/VersionTest.java (from rev 2563, trunk/prototypes/java/test/org/openlcb/NodeIDTest.java)
===================================================================
--- trunk/prototypes/java/test/org/openlcb/VersionTest.java (rev 0)
+++ trunk/prototypes/java/test/org/openlcb/VersionTest.java 2012-08-04 22:51:38 UTC (rev 2589)
@@ -0,0 +1,46 @@
+package org.openlcb;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import java.util.*;
+import java.util.jar.*;
+import java.io.*;
+import java.net.*;
+
+/**
+ * @author Bob Jacobsen Copyright 2012
+ * @version $Revision$
+ */
+public class VersionTest extends TestCase {
+
+ public void testLibVersion() throws Exception {
+ Manifest manifest = new Manifest(new FileInputStream("manifest"));
+ Assert.assertEquals("Manifest must match Version class", manifest.getEntries().get("org.openlcb").getValue("Package-Version"), Version.libVersion());
+ }
+
+ public void testSpecVersion() throws Exception {
+ Manifest manifest = new Manifest(new FileInputStream("manifest"));
+ Assert.assertEquals("Manifest must match Version class", manifest.getEntries().get("org.openlcb").getValue("Specification-Version"), Version.specVersion());
+ }
+
+ // from here down is testing infrastructure
+
+ public VersionTest(String s) {
+ super(s);
+ }
+
+ // Main entry point
+ static public void main(String[] args) {
+ String[] testCaseName = {VersionTest.class.getName()};
+ junit.swingui.TestRunner.main(testCaseName);
+ }
+
+ // test suite from all defined tests
+ public static Test suite() {
+ TestSuite suite = new TestSuite(VersionTest.class);
+ return suite;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-06 05:43:33
|
Revision: 2597
http://openlcb.svn.sourceforge.net/openlcb/?rev=2597&view=rev
Author: jacobsen
Date: 2012-08-06 05:43:26 +0000 (Mon, 06 Aug 2012)
Log Message:
-----------
first implementation of THrottle
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java
trunk/prototypes/java/test/org/openlcb/PackageTest.java
Added Paths:
-----------
trunk/prototypes/java/src/org/openlcb/Throttle.java
trunk/prototypes/java/test/org/openlcb/ThrottleTest.java
Copied: trunk/prototypes/java/src/org/openlcb/Throttle.java (from rev 2596, trunk/prototypes/java/src/org/openlcb/Node.java)
===================================================================
--- trunk/prototypes/java/src/org/openlcb/Throttle.java (rev 0)
+++ trunk/prototypes/java/src/org/openlcb/Throttle.java 2012-08-06 05:43:26 UTC (rev 2597)
@@ -0,0 +1,29 @@
+package org.openlcb;
+
+import org.openlcb.implementations.DatagramService;
+
+/**
+ * Provides a Throttle end-point for the Traction Protocol
+ *
+ * @author Bob Jacobsen Copyright 2012
+ * @version $Revision$
+ */
+public class Throttle {
+ public Throttle(NodeID trainNode, DatagramService downstream) {
+ this.trainNode = trainNode;
+ this.downstream = downstream;
+ }
+
+ private static final int DATAGRAM_MOTIVE = 0x30;
+ private static final int DATAGRAM_MOTIVE_SETSPEED = 0x01;
+
+ public void setSpeed(float speed) {
+
+ int[] data = new int[]{DATAGRAM_MOTIVE, DATAGRAM_MOTIVE_SETSPEED, 0, 0, 0, 0};
+ downstream.sendData(trainNode, data);
+ }
+
+ protected NodeID trainNode;
+ protected DatagramService downstream;
+
+}
Modified: trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java 2012-08-05 20:02:04 UTC (rev 2596)
+++ trunk/prototypes/java/src/org/openlcb/implementations/DatagramService.java 2012-08-06 05:43:26 UTC (rev 2597)
@@ -44,6 +44,16 @@
}
/**
+ * Send data to layout
+ */
+ public void sendData(NodeID dest, int[] data){
+ DatagramServiceTransmitMemo memo = new DatagramServiceTransmitMemo(dest, data);
+ xmtMemo = memo;
+ Message m = new DatagramMessage(here, memo.dest, memo.data);
+ downstream.put(m, this);
+ }
+
+ /**
* Handle "Datagram" message from layout
*/
@Override
Modified: trunk/prototypes/java/test/org/openlcb/PackageTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/PackageTest.java 2012-08-05 20:02:04 UTC (rev 2596)
+++ trunk/prototypes/java/test/org/openlcb/PackageTest.java 2012-08-06 05:43:26 UTC (rev 2597)
@@ -75,6 +75,8 @@
suite.addTest(GatewayTest.suite());
+ suite.addTest(ThrottleTest.suite());
+
suite.addTest(MimicNodeStoreTest.suite());
// test implementation classes
Copied: trunk/prototypes/java/test/org/openlcb/ThrottleTest.java (from rev 2596, trunk/prototypes/java/test/org/openlcb/NodeTest.java)
===================================================================
--- trunk/prototypes/java/test/org/openlcb/ThrottleTest.java (rev 0)
+++ trunk/prototypes/java/test/org/openlcb/ThrottleTest.java 2012-08-06 05:43:26 UTC (rev 2597)
@@ -0,0 +1,75 @@
+package org.openlcb;
+
+import org.openlcb.implementations.DatagramService;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * @author Bob Jacobsen Copyright 2009
+ * @version $Revision$
+ */
+public class ThrottleTest extends TestCase {
+
+
+ NodeID hereID = new NodeID(new byte[]{1,2,3,4,5,10});
+ NodeID farID = new NodeID(new byte[]{1,2,3,4,5,7});
+ Connection testConnection;
+ java.util.ArrayList<Message> messagesReceived;
+ boolean flag;
+ DatagramService datagramService;
+
+ @Override
+ public void setUp() {
+ messagesReceived = new java.util.ArrayList<Message>();
+ flag = false;
+ testConnection = new AbstractConnection(){
+ @Override
+ public void put(Message msg, Connection sender) {
+ messagesReceived.add(msg);
+ }
+ };
+ datagramService = new DatagramService(hereID, testConnection);
+ }
+
+
+ public void testCtor() {
+ new Throttle(farID, datagramService);
+ }
+ public void testSend() {
+ Throttle t = new Throttle(farID, datagramService);
+
+ t.setSpeed(0.0f);
+
+ // should have sent datagram
+ Assert.assertEquals("Message count",1,messagesReceived.size());
+ Assert.assertTrue(messagesReceived.get(0) instanceof DatagramMessage);
+
+ // check format of datagram write
+ int[] content = ((DatagramMessage)messagesReceived.get(0)).getData();
+ Assert.assertTrue(content.length >= 6);
+ Assert.assertEquals("datagram type", 0x30, content[0]);
+ Assert.assertEquals("set speed command", 0x01, (content[1]));
+
+ }
+
+ // from here down is testing infrastructure
+
+ public ThrottleTest(String s) {
+ super(s);
+ }
+
+ // Main entry point
+ static public void main(String[] args) {
+ String[] testCaseName = {ThrottleTest.class.getName()};
+ junit.swingui.TestRunner.main(testCaseName);
+ }
+
+ // test suite from all defined tests
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ThrottleTest.class);
+ return suite;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-14 01:51:43
|
Revision: 2619
http://openlcb.svn.sourceforge.net/openlcb/?rev=2619&view=rev
Author: jacobsen
Date: 2012-08-14 01:51:37 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
better UTF handling to avoid trailing nulls, which drive UTF coder/decoder nuts
Modified Paths:
--------------
trunk/prototypes/java/openlcb-demo.jar
trunk/prototypes/java/openlcb.jar
trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java
Modified: trunk/prototypes/java/openlcb-demo.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/openlcb.jar
===================================================================
(Binary files differ)
Modified: trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java 2012-08-13 11:53:23 UTC (rev 2618)
+++ trunk/prototypes/java/src/org/openlcb/cdi/swing/CdiPanel.java 2012-08-14 01:51:37 UTC (rev 2619)
@@ -525,7 +525,14 @@
final ReadReturn handler = new ReadReturn() {
@Override
public void returnData(byte[] data) {
- textField.setText(new String(data, UTF8));
+ int first;
+ for (first = 0; first < data.length; first++)
+ if (data[first] == 0) break;
+
+ // first contains the index of the 1st null
+ byte[] store = new byte[first]; // bytes to first null
+ System.arraycopy(data, 0, store, 0, first);
+ textField.setText(new String(store, UTF8));
}
};
b.addActionListener(new java.awt.event.ActionListener() {
@@ -541,15 +548,14 @@
public void actionPerformed(java.awt.event.ActionEvent e) {
byte[] data = textField.getText().getBytes(UTF8);
byte[] content = new byte[(data.length+1 > size) ? size : data.length+1];
- for (int i = 0; i < content.length-1; i++) {
- content[i] = data[i];
- }
+ System.arraycopy(data, 0, content, 0, content.length-1);
content[content.length-1] = 0;
// write it back in case of truncation
byte[] writeBack = new byte[content.length-1];
- for (int i = 0; i< writeBack.length; i++) writeBack[i] = content[i];
+ System.arraycopy(content, 0, writeBack, 0, writeBack.length);
textField.setText(new String(writeBack, UTF8));
+
// and to the node
accessor.doWrite(getOrigin(), getVarSpace(), content);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-14 02:35:58
|
Revision: 2620
http://openlcb.svn.sourceforge.net/openlcb/?rev=2620&view=rev
Author: jacobsen
Date: 2012-08-14 02:35:52 +0000 (Tue, 14 Aug 2012)
Log Message:
-----------
fix problem reading addr space < 0xFD via CDI
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java
trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java
Modified: trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java 2012-08-14 01:51:37 UTC (rev 2619)
+++ trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java 2012-08-14 02:35:52 UTC (rev 2620)
@@ -34,8 +34,10 @@
public void handleData(NodeID dest, int[] data, DatagramService.ReplyMemo service) {
service.acceptData(0);
if (readMemo != null) {
- byte[] content = new byte[data.length-6];
- for (int i = 0; i<content.length; i++) content[i] = (byte)data[i+6];
+ // figure out address space uses byte?
+ boolean spaceByte = ((data[1] & 0x03) == 0);
+ byte[] content = new byte[data.length-6+(spaceByte ? -1 : 0)];
+ for (int i = 0; i<content.length; i++) content[i] = (byte)data[i+6+(spaceByte?1:0)];
McsReadMemo memo = readMemo;
readMemo = null;
memo.handleReadData(dest, memo.space, memo.address, content);
Modified: trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java 2012-08-14 01:51:37 UTC (rev 2619)
+++ trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java 2012-08-14 02:35:52 UTC (rev 2620)
@@ -158,8 +158,12 @@
flag = true;
}
@Override
- public void handleReadData(NodeID dest, int space, long address, byte[] data) {
+ public void handleReadData(NodeID dest, int readSpace, long readAddress, byte[] readData) {
flag = true;
+ Assert.assertEquals("space", space, readSpace);
+ Assert.assertEquals("address", address, readAddress);
+ Assert.assertEquals("data length", 1, readData.length);
+ Assert.assertEquals("data[0]", 0xAA, readData[0]&0xFF);
}
};
@@ -197,8 +201,9 @@
// now return data
flag = false;
- content[1] = content[1]|0x01;
- // needs to have pseudo-data added to end of array
+ content[1] = content[1]|0x04; //change command to response
+ content[content.length-1] = 0xAA; // 1st data byte
+
m = new DatagramMessage(farID, hereID, content);
Assert.assertTrue(!flag);
@@ -206,6 +211,71 @@
Assert.assertTrue(flag);
}
+
+ public void testSimpleReadFromSpace1() {
+ int space = 0x01;
+ long address = 0x12345678;
+ int length = 4;
+ MemoryConfigurationService.McsReadMemo memo =
+ new MemoryConfigurationService.McsReadMemo(farID, space, address, length) {
+ @Override
+ public void handleWriteReply(int code) {
+ flag = true;
+ }
+ @Override
+ public void handleReadData(NodeID dest, int readSpace, long readAddress, byte[] readData) {
+ flag = true;
+ Assert.assertEquals("space", space, readSpace);
+ Assert.assertEquals("address", address, readAddress);
+ Assert.assertEquals("data length", 1, readData.length);
+ Assert.assertEquals("data[0]", 0xAA, readData[0]&0xFF);
+ }
+ };
+
+ // test executes the callbacks instantly; real connections might not
+ Assert.assertTrue(!flag);
+ service.request(memo);
+ Assert.assertTrue(!flag);
+
+ // should have sent datagram
+ Assert.assertEquals(1,messagesReceived.size());
+ Assert.assertTrue(messagesReceived.get(0) instanceof DatagramMessage);
+
+ // check format of datagram read
+ int[] content = ((DatagramMessage)messagesReceived.get(0)).getData();
+ Assert.assertTrue(content.length >= 6);
+ Assert.assertEquals("datagram type", 0x20, content[0]);
+ Assert.assertEquals("read command", 0x40, (content[1]&0xFC));
+
+ Assert.assertEquals("address", address, ((long)content[2]<<24)+((long)content[3]<<16)+((long)content[4]<<8)+(long)content[5] );
+
+ if (space >= 0xFD) {
+ Assert.assertEquals("space bits", space&0x3, content[1]&0x3);
+ Assert.assertEquals("data length", length, content[6]);
+ } else {
+ Assert.assertEquals("space byte", space, content[6]);
+ Assert.assertEquals("data length", length, content[7]);
+ }
+
+ // datagram reply comes back
+ Message m = new DatagramAcknowledgedMessage(farID, hereID);
+
+ Assert.assertTrue(!flag);
+ datagramService.put(m, null);
+ Assert.assertTrue(flag);
+
+ // now return data
+ flag = false;
+ content[1] = content[1]|0x04; //change command to response
+ content[content.length-1] = 0xAA; // 1st data byte
+
+ m = new DatagramMessage(farID, hereID, content);
+
+ Assert.assertTrue(!flag);
+ datagramService.put(m, null);
+ Assert.assertTrue(flag);
+
+ }
public void testConfigMemoIsRealClass() {
MemoryConfigurationService.McsConfigMemo m20 =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-08-20 06:31:00
|
Revision: 2637
http://openlcb.svn.sourceforge.net/openlcb/?rev=2637&view=rev
Author: jacobsen
Date: 2012-08-20 06:30:53 +0000 (Mon, 20 Aug 2012)
Log Message:
-----------
handle start-end bits in messages
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
Modified: trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-08-20 06:27:19 UTC (rev 2636)
+++ trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-08-20 06:30:53 UTC (rev 2637)
@@ -78,15 +78,74 @@
return null;
}
+ class AccumulationMemo {
+ long header;
+ NodeID source;
+ NodeID dest;
+ byte[] data;
+
+ public AccumulationMemo(long header, NodeID source, NodeID dest, byte[] data) {
+ this.header = header;
+ this.source = source;
+ this.dest = dest;
+ this.data = data;
+ }
+
+ public boolean equals(Object obj) {
+ if (! (obj instanceof AccumulationMemo) )
+ return false;
+
+ AccumulationMemo other = (AccumulationMemo)obj;
+ if (header != other.header) return false;
+ if ( ! source.equals(other.source)) return false;
+ if ( ! dest.equals(other.dest)) return false;
+ return true;
+ }
+
+ // data varies in length, not considered.
+ public int hashCode() {
+ return (int)(header+dest.hashCode()+source.hashCode());
+ }
+ }
+
+ HashMap<Integer, AccumulationMemo> accumulations = new HashMap<Integer, AccumulationMemo>();
+
List<Message> processFormat1(CanFrame f) {
// MTI
List<Message> retlist = new java.util.ArrayList<Message>();
NodeID source = map.getNodeID(getSourceID(f));
NodeID dest = null;
int mti = getMTI(f);
- if ( ((mti&0x008) != 0) && (f.getNumDataElements() >= 2) ) // addressed message
+ byte[] data = f.getData();
+
+ if ( ((mti&0x008) != 0) && (f.getNumDataElements() >= 2) ) {
+ // addressed message
dest = map.getNodeID( ( (f.getElement(0) << 8) + f.getElement(1) ) & 0xFFF );
-
+
+ AccumulationMemo mnew = new AccumulationMemo(f.getHeader(), source, dest, data);
+ // is header already in map?
+ AccumulationMemo mold = accumulations.get(f.getHeader());
+ if (mold == null) {
+ // no - start accumulation
+ accumulations.put(f.getHeader(),mnew);
+ mold = mnew;
+ } else {
+ // combine data into old one
+ byte[] newdata = new byte[mold.data.length+mnew.data.length-2]; // skip address
+ System.arraycopy(mold.data, 0, newdata, 0, mold.data.length);
+ System.arraycopy(mnew.data, 2, newdata, mold.data.length, mnew.data.length-2);
+ mold.data = newdata;
+ }
+ // see if final bit active
+ if ( (f.getElement(0) & 0x10 ) != 0) {
+ // no, accumulate
+ return retlist; // which is null right now
+ }
+ // we're going to continue processing with the accumulated data
+ data = mold.data;
+ accumulations.remove(f.getHeader());
+ }
+
MessageTypeIdentifier value = MessageTypeIdentifier.get(mti);
if (value == null) System.out.println(" found null from "+mti);
switch (value) {
@@ -101,10 +160,10 @@
return retlist;
case OptionalInteractionRejected: {
- int d2 = f.getNumDataElements() >= 3 ? f.getElement(2) : 0;
- int d3 = f.getNumDataElements() >= 4 ? f.getElement(3) : 0;
- int d4 = f.getNumDataElements() >= 5 ? f.getElement(4) : 0;
- int d5 = f.getNumDataElements() >= 6 ? f.getElement(5) : 0;
+ int d2 = data.length >= 3 ? f.getElement(2) : 0;
+ int d3 = data.length >= 4 ? f.getElement(3) : 0;
+ int d4 = data.length >= 5 ? f.getElement(4) : 0;
+ int d5 = data.length >= 6 ? f.getElement(5) : 0;
int retmti = ((d2&0xff)<<8) | (d3&0xff);
int code = ((d4&0xff)<<8) | (d5&0xff);;
retlist.add(new OptionalIntRejectedMessage(source, dest,retmti,code));
@@ -141,11 +200,10 @@
retlist.add(new SimpleNodeIdentInfoRequestMessage(source, dest));
return retlist;
case SimpleNodeIdentInfoReply:
- byte[] content = f.getData();
- byte[] data = new byte[content.length-2];
- System.arraycopy(content, 2, data, 0, data.length);
+ byte[] content = new byte[data.length-2];
+ System.arraycopy(data, 2, content, 0, content.length);
- retlist.add(new SimpleNodeIdentInfoReplyMessage(source,data));
+ retlist.add(new SimpleNodeIdentInfoReplyMessage(source,content));
return retlist;
case DatagramReceivedOK:
Modified: trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-08-20 06:27:19 UTC (rev 2636)
+++ trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-08-20 06:30:53 UTC (rev 2637)
@@ -274,7 +274,52 @@
Assert.assertEquals(0, ((OptionalIntRejectedMessage)msg).getCode());
}
+ public void testAccumulateSniipReply() {
+ // start frame
+ OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19A08071);
+ frame.setData(new byte[]{0x12, 0x02, 0x12, 0x34});
+
+ MessageBuilder b = new MessageBuilder(map);
+
+ List<Message> list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 0, list.size());
+
+ // end frame
+ frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19A08071);
+ frame.setData(new byte[]{0x22, 0x02, 0x56, 0x78});
+
+ list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 1, list.size());
+ Message msg = list.get(0);
+ Assert.assertTrue(msg instanceof SimpleNodeIdentInfoReplyMessage);
+
+ Assert.assertEquals(0x12, ((SimpleNodeIdentInfoReplyMessage)msg).getData()[0]);
+ Assert.assertEquals(0x34, ((SimpleNodeIdentInfoReplyMessage)msg).getData()[1]);
+ Assert.assertEquals(0x56, ((SimpleNodeIdentInfoReplyMessage)msg).getData()[2]);
+ Assert.assertEquals(0x78, ((SimpleNodeIdentInfoReplyMessage)msg).getData()[3]);
+
+ // check for no stored state
+ frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19A08071);
+ frame.setData(new byte[]{0x02, 0x02, 0x12, 0x34});
+ list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 1, list.size());
+ msg = list.get(0);
+ Assert.assertTrue(msg instanceof SimpleNodeIdentInfoReplyMessage);
+
+ Assert.assertEquals(2, ((SimpleNodeIdentInfoReplyMessage)msg).getData().length);
+ Assert.assertEquals(0x12, ((SimpleNodeIdentInfoReplyMessage)msg).getData()[0]);
+ Assert.assertEquals(0x34, ((SimpleNodeIdentInfoReplyMessage)msg).getData()[1]);
+
+
+ }
+
// from here down is testing infrastructure
public MessageBuilderTest(String s) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-09-04 16:47:14
|
Revision: 2698
http://openlcb.svn.sourceforge.net/openlcb/?rev=2698&view=rev
Author: jacobsen
Date: 2012-09-04 16:47:05 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
improve messages for failed MTI parse
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
Modified: trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-09-04 07:30:21 UTC (rev 2697)
+++ trunk/prototypes/java/src/org/openlcb/can/MessageBuilder.java 2012-09-04 16:47:05 UTC (rev 2698)
@@ -147,7 +147,14 @@
}
MessageTypeIdentifier value = MessageTypeIdentifier.get(mti);
- if (value == null) System.out.println(" found null from "+mti);
+ if (value == null) {
+ // something bad happened
+ String mtiString = "000"+Integer.toHexString(mti).toUpperCase();
+ mtiString = mtiString.substring(mtiString.length()-3);
+ System.out.println(" failed to parse MTI 0x"+mtiString);
+ return retlist; // nothing in it from this
+ }
+
switch (value) {
case InitializationComplete:
retlist.add(new InitializationCompleteMessage(source));
Modified: trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-09-04 07:30:21 UTC (rev 2697)
+++ trunk/prototypes/java/test/org/openlcb/can/MessageBuilderTest.java 2012-09-04 16:47:05 UTC (rev 2698)
@@ -274,6 +274,19 @@
Assert.assertEquals(0, ((OptionalIntRejectedMessage)msg).getCode());
}
+ public void testBogusMti() {
+ // should emit "failed to parse MTI 0x541"
+ OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
+ frame.setHeader(0x19541071);
+ frame.setData(new byte[]{0x02, 0x02, (byte)0x12, 0x34});
+
+ MessageBuilder b = new MessageBuilder(map);
+
+ List<Message> list = b.processFrame(frame);
+
+ Assert.assertEquals("count", 0, list.size());
+ }
+
public void testAccumulateSniipReply() {
// start frame
OpenLcbCanFrame frame = new OpenLcbCanFrame(0x123);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jac...@us...> - 2012-09-04 19:33:34
|
Revision: 2703
http://openlcb.svn.sourceforge.net/openlcb/?rev=2703&view=rev
Author: jacobsen
Date: 2012-09-04 19:33:28 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
remove some race conditions
Modified Paths:
--------------
trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java
trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java
Modified: trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java
===================================================================
--- trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java 2012-09-04 18:45:10 UTC (rev 2702)
+++ trunk/prototypes/java/src/org/openlcb/implementations/MemoryConfigurationService.java 2012-09-04 19:33:28 UTC (rev 2703)
@@ -42,6 +42,18 @@
readMemo = null;
memo.handleReadData(dest, memo.space, memo.address, content);
}
+ if (addrSpaceMemo != null) {
+ // doesn't handle decode of desc string, but should
+ int space = data[2]&0xFF;
+ long highAddress = ((data[3]&0xFF)<<24)|((data[4]&0xFF)<<16)|((data[5]&0xFF)<<8)|(data[6]&0xFF);
+ int flags = data[7]&0xFF;
+ long lowAddress = 0; // doesn't handle optional value
+
+ McsAddrSpaceMemo memo = addrSpaceMemo;
+ addrSpaceMemo = null;
+ memo.handleAddrSpaceData(dest, space, highAddress, lowAddress, flags, "");
+ }
+ // config memo may trigger address space read, so do second
if (configMemo != null) {
// doesn't handle decode of name string, but should
int commands = (data[2]<<8)+data[3];
@@ -52,17 +64,6 @@
configMemo = null;
memo.handleConfigData(dest, commands, options, highSpace, lowSpace,"");
}
- if (addrSpaceMemo != null) {
- // doesn't handle decode of desc string, but should
- int space = data[2];
- long highAddress = (data[3]<<24)+(data[4]<<16)+(data[5]<<8)+data[6];
- int flags = data[7];
- long lowAddress = 0; // doesn't handle optional value
-
- McsAddrSpaceMemo memo = addrSpaceMemo;
- addrSpaceMemo = null;
- memo.handleConfigData(dest, space, highAddress, lowAddress, flags, "");
- }
}
});
}
@@ -351,7 +352,7 @@
/**
* Overload this for notification of data.
*/
- public void handleConfigData(NodeID dest, int space, long hiAddress, long lowAddress, int flags, String desc) {
+ public void handleAddrSpaceData(NodeID dest, int space, long hiAddress, long lowAddress, int flags, String desc) {
}
}
Modified: trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java
===================================================================
--- trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java 2012-09-04 18:45:10 UTC (rev 2702)
+++ trunk/prototypes/java/test/org/openlcb/implementations/MemoryConfigurationServiceTest.java 2012-09-04 19:33:28 UTC (rev 2703)
@@ -369,7 +369,7 @@
flag = true;
}
@Override
- public void handleConfigData(NodeID dest, int space, long hiAddress, long lowAddress, int flags, String desc) {
+ public void handleAddrSpaceData(NodeID dest, int space, long hiAddress, long lowAddress, int flags, String desc) {
flag = true;
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|