Updatable¶
The Updatable element represents an updatable entity such as a firmware binary or lookup table data, providing functions to query its version and to get or set its contents.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 | <Controller Name="Arcas 5EG-0">
<Template Name="PositionControlTemplate" TemplateType="ProcessingBlock">
<Updatable Name="Updatable">
<FilePath>PositionControlSimple-windows-x86_64.bin</FilePath>
</Updatable>
</Template>
<Updatable Name="PersistentStorage0">
<Content>
RGl0IGlzIGVlbiB0ZXN0IG9tIGVlbiBiYXNlIDY0IGZvcm1hdCBzdHJpbmcgdGUgdmVya3Jpamdlbg==
</Content>
</Updatable>
</Controller>
|
Note
The
contentof the updatable can be set using an absolute or relative path. Alternatively, a binary encoded as a Base64-string can be used. Both methods can be under controller and sub-controller.Setting/loading the content of an updatable is not reversible: When an error occurs during setting/loading the content, the original content is destroyed.
Base64 conversion¶
Instead of referencing a binary file, the binary content can be converted to base64 format and embedded in the configuration file as text via Content.
An advantage of this method is that linking to other files is no longer necessary. Binary file can be converted to base64 format as followed:
1 2 3 4 5 6 7 | import base64
with open("Feedforward-windows-x86_64.bin", "rb") as file:
binary_content = file.read()
base64_content = base64.b64encode(binary_content)
print(f"Base64 content: {base64_content.decode('utf-8')}")
|
1 2 3 4 5 6 | binaryfile = fopen('Feedforward-windows-x86_64.bin');
binarycontent = uint8(fread(binaryfile));
base64content = matlab.net.base64encode(binarycontent);
fclose(binaryfile);
fprintf('Base64 content: %s', base64content);
|
XML schema¶
UpdatableType¶1 2 3 4 5 6 7 8 | <xs:complexType name="UpdatableType">
<xs:choice minOccurs="0" maxOccurs="1">
<xs:element name="FilePath" type="PathType"/>
<xs:element name="Content" type="xs:base64Binary"/>
<xs:element name="Variant" type="UpdatableVariantType"/>
</xs:choice>
<xs:attribute name="Name" type="xs:string" use="required"/>
</xs:complexType>
|
Attribute |
Description |
|---|---|
|
Used to define a name for an updatable. |
UpdatableVariantType¶1 2 3 4 5 6 7 8 9 10 11 | <xs:complexType name="UpdatableVariantType">
<xs:complexContent>
<xs:extension base="BaseVariantType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="FilePath" type="PathType"/>
<xs:element name="Content" type="xs:base64Binary"/>
<xs:element name="Variant" type="UpdatableVariantType"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
|
PathType¶1 2 3 4 5 6 7 | <xs:complexType name="PathType">
<xs:simpleContent>
<xs:extension base='xs:string'>
<xs:attribute name="RelativeTo" type="RelativeToType" use="optional" default="CurrentWorkingDirectory"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
|
RelativeToType¶1 2 3 4 5 6 | <xs:simpleType name="RelativeToType">
<xs:restriction base="xs:string">
<xs:enumeration value="CurrentWorkingDirectory"/>
<xs:enumeration value="File"/>
</xs:restriction>
</xs:simpleType>
|