Commit d45faa9c authored by Vincent van Beveren's avatar Vincent van Beveren

Merge branch 'master' of git@ohwr.org:sfp/sfp-plus-i2c.git

parents 53e66a60 505e191f
......@@ -31,6 +31,8 @@ public abstract class DDMIElement {
private String _sourceId;
private String _passwordId;
public void setSourceId(String id)
......@@ -51,6 +53,23 @@ public abstract class DDMIElement {
return _sourceId;
}
public void setPasswordId(String id)
{
_passwordId = id;
}
public String getPasswordId()
{
if (_passwordId == null) {
DDMIElement parent = getParent();
if (!(parent instanceof DDMIGroup))
return null;
return DDMIGroup.class.cast(parent).getPasswordId();
}
return _passwordId;
}
public void setLabel(String label) {
......
......@@ -79,6 +79,31 @@ public class DDMILoader {
};
private static class DDMIConstMetaProxy extends XOLProxyBase<Void> {
@Override
public boolean setAttribute(String name, String obj) {
return true;
}
@Override
public void setParent(XOLProxy<?> obj) {
//_value = DDMIValue.class.cast(obj.getInstance());
}
@Override
public boolean setContent(String data) {
return true;
}
@Override
public String getTypeName() {
return "DDMI Const Meta";
}
};
private static class DDMIBitFieldMetaProxy extends XOLProxyBase<Void> {
private DDMIValue _value;
......@@ -174,6 +199,11 @@ public class DDMILoader {
return new DDMIConversionMetaProxy();
}
if (_meta == DDMIMeta.CONST) {
return new DDMIConstMetaProxy();
}
return null;
}
......@@ -393,6 +423,7 @@ public class DDMILoader {
_xol.setMapping("int", new DDMIValueFactory(DDMIValue.DDMIType.INT_TYPE));
_xol.setMapping("uint", new DDMIValueFactory(DDMIValue.DDMIType.UINT_TYPE));
_xol.setMapping("bitmap", new DDMIValueFactory(DDMIValue.DDMIType.BITMAP_TYPE));
_xol.setMapping("password", new DDMIValueFactory(DDMIValue.DDMIType.BITMAP_TYPE));
_xol.setMapping("text", new DDMIValueFactory(DDMIValue.DDMIType.TEXT_TYPE));
_xol.setMapping("float", new DDMIValueFactory(DDMIValue.DDMIType.DECIMAL_TYPE_FLOAT));
_xol.setMapping("sfix", new DDMIValueFactory(DDMIValue.DDMIType.DECIMAL_TYPE_SFIXED));
......@@ -412,6 +443,8 @@ public class DDMILoader {
_xol.setMapping("map", new DDMIMapMetaFactory(DDMIMeta.LOOKUP));
_xol.setMapping("bool", new DDMIMapMetaFactory(DDMIMeta.BITFIELD));
_xol.setMapping("scale", new DDMIMapMetaFactory(DDMIMeta.CONV));
_xol.setMapping("const", new DDMIMapMetaFactory(DDMIMeta.CONST));
_fxml = new FXML(base, xsd);
......
......@@ -173,5 +173,7 @@ public class DDMIMeta<T extends Object> {
public static final DDMIMeta<Integer> DEC_PLACES = new DDMIMeta<Integer>(Integer.class);
public static final DDMIMeta<String> CONST = new DDMIMeta<String>(String.class);
}
......@@ -50,6 +50,7 @@
<xs:attribute type="xs:string" name="label" use="optional" />
<xs:attribute type="xs:string" name="short" use="optional" />
<xs:attribute type="xs:string" name="name" use="optional" />
<xs:attribute type="xs:IDREF" name="password-id" use="optional" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
......@@ -155,6 +156,7 @@
<xs:element ref="float" />
<xs:element ref="ufix" />
<xs:element ref="sfix" />
<xs:element ref="password" />
</xs:choice>
<xs:attribute type="xs:IDREF" name="source-id" use="optional" />
<xs:attribute type="xs:string" name="showIf" use="optional" />
......@@ -202,6 +204,21 @@
</xs:complexType>
</xs:element>
<xs:element name="password">
<xs:complexType>
<xs:complexContent>
<xs:extension base="value">
<xs:sequence>
<!-- when a const password is set the value is applied each time on write -->
<!-- otherwise the password is asked by the password manager (TODO) -->
<xs:element name="const" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="text">
<xs:complexType>
<xs:complexContent>
......@@ -289,6 +306,7 @@
<xs:element ref="source"/>
<xs:element ref="cache"/>
<xs:element ref="checksum"/>
<xs:element ref="password"/>
</xs:choice>
</xs:complexType>
</xs:element>
......
......@@ -25,14 +25,17 @@
<group id="root">
<group label="OE Solutions custom">
<group source-id="diag" showIf="isset(id.montype, 6)">
<bitmap label="Password (4F 45 53 50)" writable="true"
offset="x7b" length="4" level="basic">
</bitmap>
<!-- implicit hard-coded password -->
<password id="oe-password" offset="x7b" length="4">
<const>4F 45 53 50</const>
</password>
</group>
<group source-id="diag_p4" showIf="isset(id.montype, 6)">
<uint label="Tune value" writable="true"
offset="x8B" length="2" level="basic">
offset="x8B" length="2" level="basic"
password-id="oe-password">
</uint>
</group>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment