Skip to content

Commit 34ac8bc

Browse files
authored
GatewayToBackend API: add otap target related changes (#127)
* GatewayToBackend API: add otap target related changes
1 parent 16108d0 commit 34ac8bc

File tree

4 files changed

+81
-9
lines changed

4 files changed

+81
-9
lines changed

gateway_to_backend/README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,24 @@ _Consequently, it is highly recommended to keep this field._
371371
372372
- **Response:**
373373

374-
> **topics:** gw-response/otap_status/*\<gw-id\>/\<sink-id\>*
374+
> **topics:** gw-response/otap_process_scratchpad/*\<gw-id\>/\<sink-id\>*
375375
>
376376
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].[ProcessScratchpadResp][message_ProcessScratchpadResp]
377377
378+
#### Set target scratchpad and action
379+
380+
- **Request:**
381+
382+
> **topic:** gw-request/otap_set_target_scratchpad/*\<gw-id\>/\<sink-id\>*
383+
>
384+
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].[SetScratchpadTargetAndActionReq][message_SetScratchpadTargetAndActionReq]
385+
386+
- **Response:**
387+
388+
> **topics:** gw-response/otap_set_target_scratchpad/*\<gw-id\>/\<sink-id\>*
389+
>
390+
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].[SetScratchpadTargetAndActionResp][message_SetScratchpadTargetAndActionResp]
391+
378392
## API extension
379393

380394
This API is the minimal set of services to be integrated to be
@@ -501,6 +515,9 @@ definition)
501515
gw-request/otap_load_scratchpad/<gw-id>/<sink-id>
502516
503517
gw-request/otap_process_scratchpad/<gw-id>/<sink-id>
518+
519+
gw-request/otap_set_target_scratchpad/<gw-id>/<sink-id>
520+
504521
```
505522

506523
*Response* from a gateway to a backend:
@@ -519,6 +536,8 @@ definition)
519536
gw-response/otap_load_scratchpad/<gw-id>/<sink-id>
520537
521538
gw-response/otap_process_scratchpad/<gw-id>/<sink-id>
539+
540+
gw-response/otap_set_target_scratchpad/<gw-id>/<sink-id>
522541
```
523542

524543
*Asynchronous* event from a gateway:
@@ -555,11 +574,6 @@ definition)
555574

556575
[message_GetConfigsResp]: https://github.com/wirepas/backend-apis/blob/982974eb6069d89aef527862cb7b5f1b2e2c4385/gateway_to_backend/protocol_buffers_files/config_message.proto#L121-L125
557576

558-
559-
560-
561-
562-
563577
[message_SetConfigReq]: https://github.com/wirepas/backend-apis/blob/8580ee52eb71dbef3afce6b0207d3312153ced42/gateway_to_backend/protocol_buffers_files/config_message.proto#L127-L131
564578

565579
[message_SetConfigResp]: https://github.com/wirepas/backend-apis/blob/8580ee52eb71dbef3afce6b0207d3312153ced42/gateway_to_backend/protocol_buffers_files/config_message.proto#L133-L138
@@ -592,4 +606,8 @@ definition)
592606

593607
[message_WirepasMessage]: https://github.com/wirepas/backend-apis/blob/127f4a0025078aa7b118a6b10661461a50aaf33e/gateway_to_backend/protocol_buffers_files/generic_message.proto#L9-L26
594608

609+
[message_SetScratchpadTargetAndActionReq]:
610+
611+
[message_SetScratchpadTargetAndActionRsp]:
612+
595613
[protobuf_homepage]: https://developers.google.com/protocol-buffers

gateway_to_backend/protocol_buffers_files/config_message.proto

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ message GatewayInfo {
9898
optional string gw_version = 3 /*[(nanopb).max_size = 128]*/;
9999

100100
// API version implemented in the gateway
101-
// This field must be explicitely set from code and must be
102-
// the one defined in each released verion.
103-
// Current version is 1
101+
// This field must be explicitly set from code and must be
102+
// the one defined in each released version.
103+
// Current version is 2
104+
// Version 1: Initial release
105+
// Version 2: Addition of setScratchpadTargetAndAction
106+
// It should be replaced by a feature list
104107
optional uint32 implemented_api_version = 4;
105108
}
106109

gateway_to_backend/protocol_buffers_files/generic_message.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ message WirepasMessage {
2323
optional ProcessScratchpadResp process_scratchpad_resp = 14;
2424
optional GetGwInfoReq get_gateway_info_req = 15;
2525
optional GetGwInfoResp get_gateway_info_resp = 16;
26+
optional SetScratchpadTargetAndActionReq set_scratchpad_target_and_action_req = 17;
27+
optional SetScratchpadTargetAndActionResp set_scratchpad_target_and_action_resp = 18;
2628
}
2729

2830
message CustomerMessage {

gateway_to_backend/protocol_buffers_files/otap_message.proto

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,49 @@ enum ScratchpadStatus {
1818
ERROR = 3;
1919
}
2020

21+
enum ScratchpadAction {
22+
// Will be the default value in case it is later extended
23+
UNKNOWN_ACTION = 0;
24+
// No propagation, no processing of scratchpad
25+
NO_OTAP = 1;
26+
// Propagate the target scratchpad but no processing
27+
PROPAGATE_ONLY = 2;
28+
// Propagate the target scratchpad and process it as soon as received
29+
PROPAGATE_AND_PROCESS = 3;
30+
// Propagate the target scratchpad and process it after delay (starting when scratchpad is present and this info received)
31+
PROPAGATE_AND_PROCESS_WITH_DELAY = 4;
32+
// Otap propagation works as before with sequence comparison and processing through remote API
33+
LEGACY_OTAP = 5;
34+
}
35+
36+
enum ProcessingDelay {
37+
UNKNOWN_DELAY = 0;
38+
TEN_MINUTES = 1;
39+
THIRTY_MINUTES = 2;
40+
ONE_HOUR = 3;
41+
SIX_HOURS = 4;
42+
ONE_DAY = 5;
43+
TWO_DAYS = 6;
44+
FIVE_DAYS = 7;
45+
}
46+
47+
2148
message ScratchpadInfo {
2249
required uint32 len = 1;
2350
required uint32 crc = 2;
2451
required uint32 seq = 3;
2552
}
2653

54+
message TargetScratchpadAndAction {
55+
required ScratchpadAction action = 1; // What is the action to perform with the current scratchpad
56+
optional uint32 target_sequence = 2; // Between 1 and 254 (if missing using local scratchpad sequence if present)
57+
optional uint32 target_crc = 3; // Between 0 and 0xffff (if missing using local scratchpad CRC if present)
58+
oneof param {
59+
ProcessingDelay delay = 4; // Delay parameter for action PROPAGATE_AND_PROCESS_WITH_DELAY
60+
uint32 raw = 5; // Raw parameter for the action (between 0 and 255)
61+
}
62+
}
63+
2764
/*
2865
* Request/Responses definition
2966
*/
@@ -39,6 +76,8 @@ message GetScratchpadStatusResp {
3976
optional ScratchpadType stored_type = 4;
4077
optional ScratchpadInfo processed_scratchpad = 5;
4178
optional uint32 firmware_area_id = 6;
79+
80+
optional TargetScratchpadAndAction target_and_action = 7; // Unset if sink doesn't support it
4281
}
4382

4483
message UploadScratchpadReq {
@@ -60,3 +99,13 @@ message ProcessScratchpadReq {
6099
message ProcessScratchpadResp {
61100
required ResponseHeader header = 1;
62101
}
102+
103+
message SetScratchpadTargetAndActionReq {
104+
required RequestHeader header = 1;
105+
106+
required TargetScratchpadAndAction target_and_action = 2;
107+
}
108+
109+
message SetScratchpadTargetAndActionResp {
110+
required ResponseHeader header = 1;
111+
}

0 commit comments

Comments
 (0)