Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 91 additions & 8 deletions sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,78 @@
<model>Model 123 Uniblab</model>
<hardwareVersion>EC 415</hardwareVersion>
<softwareVersion>1.2.3.4</softwareVersion>
<link ref="http://openlcb.org">Link to OpenLCB.org documentation</link>
<map>
<relation><property>Size</property><value>8 cm by 12 cm</value></relation>
</map>
</identification>

<segment origin="0" space="0">
<group offset="0" replication="2">
<link ref="http://openlcb.org">Link to OpenLCB.org documentation</link>
<group replication="2">
<name>Produced Events</name>
<description>The EventIDs for the producers</description>
<link ref="http://openlcb.org">Link to OpenLCB.org documentation</link>
<hints>
<visibility hideable="yes" hidden="yes" />
<readOnly />
</hints>
<eventid/>
<eventid/>
<int size="2"/>
<int size="2">
<min>1</min>
<max>250</max>
<default>12</default>
<hints>
<slider tickSpacing="50" showValue="true"/>
</hints>
</int>
<float size="4"/>
<string size="5">
<name>Status Field</name>
<description>As first string, this content will appear in the tab</description>
</string>
<string size="100"/>
</group>
<group replication="2">
<group offset="0" replication="2">
<name>Consumed Events</name>
<description>The EventIDs for the consumers</description>
<hints>
<visibility hideable="yes" hidden="yes" />
</hints>
<eventid/>
<eventid/>
<blob size="10" mode="readwrite">
<name>Blob to see if works in group element</name>
</blob>
<float size="2">
<float size="8">
<name>Float to see if works in group element</name>
</float>
<int size="4">
<name>Int of size 4 so that each group is 32 long</name>
</int>
<group>
<name>Hideable and Hidden Nested Group</name>
<hints>
<visibility hideable="yes" hidden="true" />
</hints>
<eventid/>
<eventid/>
</group>
<group>
<name>Hideable and Not Hidden Nested Group</name>
<hints>
<visibility hideable="yes" hidden="no" />
</hints>
<eventid/>
<eventid/>
</group>
<group>
<name>Non-hideable Nested Group</name>
<eventid/>
<eventid/>
</group>
</group>
<int size="2">
<name>Sample integer variable</name>
Expand All @@ -42,14 +88,28 @@
<max>999</max>
<default>12</default>
</int>
<float size="2">
<name>Sample float variable</name>
<description>Doesn't do anything</description>
<min>1</min>
<max>999</max>
<default>12</default>
</float>
<float size="2" offset="-2">
<name>Same float variable</name>
<description>Overlaps previous</description>
<min>0</min>
<max>10000</max>
<default>12</default>
</float>
<int size="2">
<name>Sample integer slider</name>
<description>Doesn't do anything either</description>
<min>0</min>
<max>1000</max>
<min>1</min>
<max>250</max>
<default>12</default>
<hints>
<slider divisions="5" />
<slider tickSpacing="50"/>
</hints>
</int>
<int size="2">
Expand All @@ -59,7 +119,27 @@
<max>1000</max>
<default>12</default>
<hints>
<slider divisions="5" immediate="yes" />
<slider tickSpacing="200" immediate="yes"/>
</hints>
</int>
<int size="2">
<name>Sample integer slider with view</name>
<description>And another</description>
<min>1</min>
<max>250</max>
<default>12</default>
<hints>
<slider tickSpacing="50" showValue="true"/>
</hints>
</int>
<int size="2">
<name>Immediate-write integer slider with view</name>
<description>You guessed it!</description>
<min>0</min>
<max>1000</max>
<default>12</default>
<hints>
<slider tickSpacing="200" immediate="yes" showValue="1"/>
</hints>
</int>
</segment>
Expand All @@ -72,10 +152,13 @@
Board must be restarted for this to take effect.
</description>
<map>
<relation><property>0</property><value>No reset (0)</value></relation>
<relation><property>10</property><value>No reset (10)</value></relation>
<relation><property>85</property><value>Reset just EventIDs to defaults (85)</value></relation>
<relation><property>170</property><value>Reset all to defaults (170)</value></relation>
</map>
<hints>
<radiobutton/>
</hints>
</int>
<int size="1" offset="-1">
<name>Reset Directly</name>
Expand Down
16 changes: 13 additions & 3 deletions src/org/openlcb/ProducerConsumerEventReportMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,19 @@ public byte[] getPayloadArray() {

@Override
public String toString() {
return super.toString()
+" Producer/Consumer Event Report "+eventID.toString()
+" payload of "+getPayloadSize();
String retval = " Producer/Consumer Event Report "+eventID.toString();

if ( getPayloadSize() > 0 ) {
retval = retval + " payload of "+getPayloadSize()+" : ";
int n = getPayloadSize();
boolean first = true;
for (byte data : payload) {
if (!first) retval = retval + ".";
retval = retval + Integer.toHexString((int)(data&0xFF)).toUpperCase();
first = false;
}
}
return retval;
}

public boolean equals(Object o) {
Expand Down
2 changes: 1 addition & 1 deletion src/org/openlcb/ProtocolIdentification.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public List<String> getProtocolNames() {
* @param protocol enum representing the protocol bit to test
* @return true if protocol is supported, false otherwise.
*/
boolean hasProtocol(Protocol protocol) {
public boolean hasProtocol(Protocol protocol) {
return protocol.supports(value);
}
}
15 changes: 14 additions & 1 deletion src/org/openlcb/cdi/CdiRep.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public static interface Identification {
public String getModel();
public String getHardwareVersion();
public String getSoftwareVersion();
public String getLinkText();
public String getLinkURL();
public Map getMap();
}

Expand All @@ -29,6 +31,8 @@ public static interface Segment {

public String getName();
public String getDescription();
public String getLinkText();
public String getLinkURL();
public Map getMap();
public int getIndexInParent();
}
Expand All @@ -44,7 +48,12 @@ public static interface Item {
public static interface Group extends Item {
public java.util.List<Item> getItems();
public int getReplication();
public String getLinkText();
public String getLinkURL();
public String getRepName(int index, int replications);
public boolean isHideable();
public boolean isHidden();
public boolean isReadOnly();
}

public static interface Map {
Expand Down Expand Up @@ -102,8 +111,12 @@ public static interface IntegerRep extends Item {
// Should the slider itself immediately write its value on change?
public boolean isSliderImmediate();
// Optionally specifies the 'distance' between tick marks on the slider.
// If 0 (default value), don't show tick marks.
// If 0 (default value) or 1, don't show tick marks.
public int getSliderTickSpacing();
// Optionally specifies if the slider value should be shown in text box
public boolean isSliderShowValue();
// Did the CDI content hint that this value should be presented as a radio button?
public boolean isRadioButtonHint();
}

public static interface FloatRep extends Item {
Expand Down
19 changes: 19 additions & 0 deletions src/org/openlcb/cdi/impl/ConfigRepresentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ public void reload() {
MemorySpaceCache cache = getCacheForSpace(space);
cache.reload(origin, size, isNullTerminated());
}

boolean flaggedReadOnly = false;
public boolean isFlaggedReadOnly() { return flaggedReadOnly; }
public void setFlaggedReadOnly(boolean state) {flaggedReadOnly = state; }
}

public class Root implements CdiContainer {
Expand Down Expand Up @@ -574,6 +578,21 @@ public class GroupEntry extends GroupBase {
}
}
}

public boolean isHideable() {
return group.isHideable();
}

public boolean isHidden() {
return group.isHidden();
}

/**
* Does this entry carry the readOnly hint?
*/
public boolean isReadOnlyConfigured() {
return group.isReadOnly();
}
}

/**
Expand Down
Loading