Documentation
Please see the main ASL documentation
Description
A helper library allowing creation and modification of mutable TLV trees, as well as conversion from and to byte arrays
Goal and usage
How to?
Create a TLV Tree
Code Block |
---|
// New, empty
TlvTree tree = TlvTree.Empty();
// From a tlv byte array
TlvTree tree = TlvTree.FromRaw(tlvByteArray); |
Serialize to a byte array
Code Block |
---|
byte[] rawTlv = tree.AsBytes(); |
Add a binary element
Code Block |
---|
tree.AddBin(tag, new byte[] { 0x10, 0x00 }); |
Add an ASCII element
Info |
---|
This is a helper over AddBin - there are no differences on the underlying TLV content |
Code Block |
---|
tree.AddAscii(tag, "ascii content"); |
Add a child Data Object (TLV Container)
TlvTree childTree = tree.AddChild(tag);
Retrieve an element’s content
Code Block |
---|
byte[] value = tree.GetElementValue(tag);
String value = tree.GetElementAscii(tag); |
Retrieve a child Data Object
Code Block |
---|
TlvTree childTree = tree.GetChild(tag);
TlvTree childTree = tree.GetOrCreateChild(tag); |
Retrieve a list of child Data Objects with a given tag
Code Block |
---|
TlvTree[] childTrees = tree.GetChildren(tag); |