Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 450. Inverse bounded range support. #452

Merged
merged 5 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions spec/VISSv2_Core.html
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,35 @@ <h2>Time Based Filter Operation</h2>
<section id="range-filter-operation">
<h2>Range Filter Operation</h2>
<p>
The value contains the range boundary, and the logical operator, {"logic-op":"X", "boundary": "Y"},
where X is one of the supported logical operators (**), and Y is the boundary of the range.
The value may be an array of two of these objects,
which will then be combined through a logical AND to support expressions of a bounded range.
A range event is triggered whenever a signal is updated, and fulfilling the range expression.<br><br>
(**)The supported logical operators are ["eq", "ne", "gt", "gte", "lt", "lte"],
The range filter operation supports two types of ranges, see the following sub chapters.<br>
<section id="single-boundary-range">
<h2>Single Boundary Range</h2>
<p>
One logical "boundary operator" evaluates the current signal value in relation to the boundary.
If evaluated to true, the server issues a notification message containing the signal value to the subscribing client.
The boundary operator MUST be one of the values shown in the footer (**).<br>
Examples<br>
{"boundary-op":"gt", "boundary": "5"} // x > 5<br>
{"boundary-op":"eq", "boundary": "5"} // x == 5
</p>
</section>
<section id="multi-boundary-range">
<h2>Multi Boundary Range</h2>
<p>
Two boundaries with respective boundary operators are evaluated relative to the current signal value.
The logical outcome of the two evaluations are applied as input to a logical AND/OR operation.
If evaluated to true, the server issues a notification message containing the signal value to the subscribing client.
Besides the mandatory "boundary-op", and "boundary" key-value pairs in each JSON object,
the first object may contain a "combination-op" key value pair, which then MUST have either the value "AND", or the value "OR".
If omitted, the result of the two boundary evaluations is per default applied to an AND operation.
The JSON array MUST contain two objects.
The boundary operator MUST be one of the values shown in the footer (**).<br>
Examples<br>
[{"boundary-op":"gt", "boundary": "5"},{"boundary-op":"lt", "boundary": "10"}] // x > 5 AND x < 10<br>
[{"boundary-op":"lt", "boundary": "5", "combination-op":"OR"},{"boundary-op":"gt", "boundary": "10"}] // x < 5 OR x > 10
</p>
</section>
(**)The supported boundary operators are ["eq", "ne", "gt", "gte", "lt", "lte"],
where "eq" is "equal", "ne" is "not equal", "gt" is "greater than", "gte" is "greater than or equal", "lt" is "less than",
"lte" is "less than or equal".<br>
Examples can be found in the <a data-link-type="dfn" href="https://www.w3.org/TR/viss2-transport/#authorized-subscribe">authorized subscribe</a> and
Expand All @@ -685,7 +708,7 @@ <h2>Change Filter Operation</h2>
"value":{"logic-op":"lt", "diff": "0"} This leads to a trigger event when the value goes true->false.<br>
"value":{"logic-op":"ne", "diff": "0"} This leads to a trigger event when the value goes true->false OR false->true.
<br><br>
(**)The supported logical operators are ["eq", "ne", "gt", "gte", "lt", "lte"],
(**)The supported logic operators are ["eq", "ne", "gt", "gte", "lt", "lte"],
where "eq" is "equal", "ne" is "not equal", "gt" is "greater than", "gte" is "greater than or equal",
"lt" is "less than", "lte" is "less than or equal".<br>
Examples can be found in the [[viss2-transport]] specification.
Copy link
Contributor

@erikbosch erikbosch Apr 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks good, but when I reviewed them I noticed that we say that examples on logic-op (with diff) exists in Transport-section. But it doesn't, right`? Remove line or add example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand Down
45 changes: 42 additions & 3 deletions spec/VISSv2_Transport.html
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ <h2>Authorized Subscribe</h2>
{
"action": "subscribe",
"path": "Vehicle/Drivetrain/FuelSystem/Level",
"filter": {"type":"range", "value":[{"logic-op":"gt", "boundary":"49"}, {"logic-op":"lt", "boundary":"51"}]},
"filter": {"type":"range", "value":[{"boundary-op":"gt", "boundary":"49"}, {"boundary-op":"lt", "boundary":"51"}]},
"authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1...Zw_KSsds",
"requestId": "6578"
}
Expand Down Expand Up @@ -1239,7 +1239,7 @@ <h2>Curve Logging Subscribe</h2>
<section id="range-subscribe">
<h2>Range Subscribe</h2>
<p>
Subscription to a range of values, that can be either unbounded, or bounded as in the example below.
Subscription to a range of values, that can have either a single boundary, or multipe boundaries as in the example below.
For a more information how to use range of values, refer the Range Filter Operation chapter in the [[viss2-core]] documentation.
</p>
<p>
Expand All @@ -1249,7 +1249,7 @@ <h2>Range Subscribe</h2>
{
"action": "subscribe",
"path": "Vehicle/Drivetrain/FuelSystem/Level",
"filter": "filter":{"type":"range","value":[{"logic-op":"gt","boundary":"50"},{"logic-op":"lt","boundary":"55"}]},
"filter": "filter":{"type":"range","value":[{"boundary-op":"lt","boundary":"50","combination-op":"OR"},{"boundary-op":"gt","boundary":"55"}]},
"requestId": "6578"
}
</code></pre>
Expand All @@ -1274,6 +1274,45 @@ <h2>Range Subscribe</h2>
</code></pre>
</p>
</section>

<section id="change-subscribe">
<h2>Change Subscribe</h2>
<p>
Subscription to when a signal has changed between two sequential captures.
For a more information how to use change of values, refer the Change Filter Operation chapter in the [[viss2-core]] documentation.
</p>
<p>
<b>Example:</b><br>
Request:
<pre><code>
{
"action": "subscribe",
"path": "Vehicle/Drivetrain/FuelSystem/Level",
"filter": "filter":{"type":"change","value":{"logic-op":"gt","diff":"10"}},
"requestId": "6578"
}
</code></pre>
Successful response:
<pre><code>
{
"action": "subscribe",
"subscriptionId": "12345",
"requestId": "6578",
"ts": "2020-04-15T13:37:00Z"
}
</code></pre>
Notification:
<pre><code>
{
"action": "subscription",
"subscriptionId": "12345",
“data”:{“path”: ”Vehicle/Drivetrain/FuelSystem/Level”,
“dp”:{“value”: ”101”, “ts”: ”2020-04-15T14:00:00Z”},
"ts": "2020-04-15T14:00:00Z"
}
</code></pre>
</p>
</section>
</section>

<section id="unsubscribe">
Expand Down