Xentara v1.2.1
User Manual
Loading...
Searching...
No Matches
JSON Format for Execution Tracks

The Track Object

A JSON object describing an execution track has the following syntax:

{
"@Track": {
"id": "Track 1",
"uuid": "31537d09-b27f-4cd2-bbf3-2bcfcc21547e",
"threadCount": 1,
"events": [
...
],
"timers": [
...
]
}
}

Object Members
idA string value containing the ID of the group. The ID is used to construct the group’s primary key.
uuidA string value containing the unique UUID of the group.
threadCountAn integer value describing the size of the thread pool used for this track. This value must be greater than 0. Usually, the thread count should not be greater than the number of cores available on the target machine. If you specify 1 as the thread count, all tasks in the track will run sequentially.
eventsA JSON array containing all of the track’s events.
timersA JSON array containing all of the track’s timers.

Event Objects

A JSON object describing an event within an execution track has the following syntax:

"events": [
{
"source": "Loading Dock B.Door.Closed.changed",
"pipeline": {
...
}
},
{
"source": "Loading Dock B.Door.Moving.changed",
"pipeline": {
...
}
}
]

The array can contain as many events as desired. If no events are desired, the array can be empty, or the entire events member can be omitted.

Object Members
sourceA string value describing the event that should trigger the pipeline. The string value must contain the primary key of the event.
pipelineA JSON object describing the pipeline to execute.
Note
Execution track events are not real Xentara elements and hence do not use the double layer of JSON objects used for real elements.

Timer Objects

The array member describing the timers within an execution track has the following syntax:

"timers": [
{
"period": "0.5ms",
"offset": "0",
"pipeline": {
...
}
},
{
"period": "1s",
"offset": "150µs",
"sequence": 0,
"pipeline": {
...
}
}
]

The array can contain as many timers as desired. If no timers are desired, the array can be empty, or the entire timers member can be omitted.

Object Members
period

A string value containing the period of the timer. The string must be a number followed by one of the units "ns", "ms", "µs", "s", "m", or "h", for nanoseconds, microseconds, milliseconds, second, minutes, or hours respectively. For microseconds, you can write "us" instead of "µs".

The period can contain fractions. The string "0.5ms" is a valid period.

offset

A string value containing the offset of the timer. The timer will be offset by the specified time interval compared to a timer with offset 0. A positive offset will make the timer fire later, a negative offset will make the timer fire earlier.

The offset must must be string value containing either "0" for no offset, or a number followed by one of the units "ns", "ms", "µs", "s", "m", or "h", for nanoseconds, microseconds, milliseconds, second, minutes, or hours respectively. For microseconds, you can write "us" instead of "µs".

The offset can be negative, and contain fractions. The string "-0.5µs" is a valid offset.

sequenceAn optional integer value containing the sequence number of the timer. The sequence number is used to fine-tune the in which concurrent timers are executed. If you do not specify a sequence number, a sequence number of 0 will be used.
pipelineA JSON object containing the pipeline to execute when the timer fires.
Note
Timers are not normal Xentara elements and hence do not use the double layer of JSON objects used for normal elements.

Pipeline Objects

The object member describing the pipeline of an event or timer has the following syntax:

"pipeline": {
"checkPoints": [
{},
{}
],
"segments": [
...
]
}

Object Members
checkPointsA JSON array containing the check points of the pipeline. Since the check points do not have any properties of their own, each check point is represented by an empty JSON object ({}). The array can contain as many check points as desired, but there must be at least two.
segmentsA JSON array containing the segments of the pipeline.
Note
Pipelines are not normal Xentara elements and hence do not use the double layer of JSON objects used for normal elements.

Pipeline Segment Objects

A JSON object describing describing a pipeline segment of an execution pipeline has the following syntax:

"segments": [
{
"start": 0,
"end": 1,
"tasks": [
{
"function": "Building.Rack.DAQ 1.reconnect"
},
{
"function": "Building.Rack.DAQ 1.poll"
}
]
},
{
"start": 0,
"end": 1,
"tasks": [
{
"function": "Building.Rack.DAQ 2.reconnect"
},
{
"function": "Building.Rack.DAQ 2.poll"
}
]
}
]

The array can contain as many segments as desired, but there must be at least one.

Object Members
startAn integer value containing the index of the starting check point of the segment. The index is 0-based, so that the first check point has index 0, and the last checkpoint has index (number of checkpoints) - 1. If the pipeline has four check points, for example, then indices must be between 0 and 3.
endAn integer value containing the index of the ending check point of the segment. The index must be higher than the start index.
tasksA JSON array containing the tasks to be executed. The array can contain as many tasks as desired, but there must be at least one.
functionA string value describing the actual Xentara element task to be executed for each task entry. The string value must contain the primary key of the task.
Note
Pipeline segments are not normal Xentara elements and hence do not use the double layer of JSON objects used for normal elements.

Full Example

Here is an example of a complete track:

{
"@Track": {
"id": "Security",
"uuid": "6763a781-d8b2-4dba-9146-8a568f6e9b46",
"threadCount": 1,
"events": [
{
"source": "Building.Security.Motion.on",
"pipeline": {
"checkPoints": [
{},
{}
],
"segments": [
{
"start": 0,
"end": 1,
"tasks": [
{
"function": "Building.Exterior.Light.on"
},
{
"function": "Building.Exterior.Camera.record"
}
]
}
]
}
},
{
"source": "Building.Doorbell.ring",
"pipeline": {
"checkPoints": [
{},
{}
],
"segments": [
{
"start": 0,
"end": 1,
"tasks": [
{
"function": "Building.Porch.Light.on"
},
{
"function": "Building.Doorbell.record"
}
]
}
]
}
}
],
"timers": [
{
"period": "1h",
"offset": "0",
"pipeline": {
"checkPoints": [
{},
{}
],
"segments": [
{
"start": 0,
"end": 1,
"tasks": [
{
"function": "Building.Exterior.Camera.upload"
}
]
}
]
}
}
]
}
}