Bug fixes in structure parsing

This commit is contained in:
2026-03-16 13:16:06 +01:00
parent 16f638301b
commit 38b617728c
5 changed files with 31 additions and 20 deletions

View File

@@ -378,6 +378,13 @@ export class Frame implements IFrame {
if (routingSection) {
structure.push(routingSection);
}
// Add data type identifier section
structure.push({
name: "data type",
data: new TextEncoder().encode(this.payload.charAt(0)).buffer,
isString: true,
fields: [{ type: FieldType.CHAR, name: "identifier", length: 1 }],
});
if (payloadsegment) {
structure.push(...payloadsegment);
}
@@ -2306,34 +2313,34 @@ const parseFrame = (data: string): Frame => {
pathFields.push({
type: FieldType.CHAR,
name: `Path separator ${i}`,
name: `path separator ${i}`,
length: 1,
});
pathFields.push({
type: FieldType.STRING,
name: `Repeater ${i}`,
name: `repeater ${i}`,
length: pathStr.length,
});
}
const routingSection: Segment = {
name: "Routing",
data: encoder.encode(data.slice(0, routeSepIndex)).buffer,
name: "routing",
data: encoder.encode(data.slice(0, routeSepIndex + 1)).buffer,
isString: true,
fields: [
{
type: FieldType.STRING,
name: "Source address",
name: "source address",
length: sourceStr.length,
},
{ type: FieldType.CHAR, name: "Route separator", length: 1 },
{ type: FieldType.CHAR, name: "route separator", length: 1 },
{
type: FieldType.STRING,
name: "Destination address",
name: "destination address",
length: destinationStr.length,
},
...pathFields,
{ type: FieldType.CHAR, name: "Payload separator", length: 1 },
{ type: FieldType.CHAR, name: "payload separator", length: 1 },
],
};