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

Updating the protobuf messages to handle request on the gateway status #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions gateway_to_backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,24 @@ _Even if this version is increased, the API remains backward compatible.
It just help backends development to identify if new features are
present in a gateway._

#### Get gateway status

- **Request:**

> **topic:** gw-request/get_gw_status
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have <gw-id>?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to trigger for all gateways.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, exactly, the goal of this new message was to request the status of all gateways to know which ones are online. Therefore, gw-id is not present in the topic.

>
> **content:** NA

- **Response:**

> **topics:** gw-response/get_gw_status/*\<gw-id\>/\<sink-id\>*
Copy link
Contributor

Choose a reason for hiding this comment

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

Sink-id needed?

Copy link
Author

Choose a reason for hiding this comment

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

You are right sink-id is not used and should be removed from the readme

>
> **content:** [GenericMessage][message_GenericMessage].[WirepasMessage][message_WirepasMessage].[GetGwInfoResp][message_GetGwInfoResp]

This request should be handled by Gateways only if retain flag is not supported.
When receiving a message on this topic, a gateway must resend its status as described
in [Status message](#status_message)

### Data module

---
Expand Down Expand Up @@ -518,6 +536,7 @@ definition)

gw-request/otap_set_target_scratchpad/<gw-id>/<sink-id>

gw-request/get_gw_status
```

*Response* from a gateway to a backend:
Expand All @@ -538,6 +557,8 @@ definition)
gw-response/otap_process_scratchpad/<gw-id>/<sink-id>

gw-response/otap_set_target_scratchpad/<gw-id>/<sink-id>

gw-response/get_gw_status/<gw-id>/<sink-id>
Copy link
Contributor

Choose a reason for hiding this comment

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

```

*Asynchronous* event from a gateway:
Expand Down
20 changes: 20 additions & 0 deletions gateway_to_backend/protocol_buffers_files/config_message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ message GatewayInfo {
optional uint32 implemented_api_version = 4;
}

message GatewayStatus {
// Wirepas Gateway's protobuff message definition version
// This field is used to represent the version of the
// protobuff messages as a whole implemented by the
// gateway. Any breaking change in the message definition
// must lead to an increment of the version's value reported
required uint32 version = 2;
required OnOffState state = 3;
}

/*
* Commands definition
*/
Expand Down Expand Up @@ -154,3 +164,13 @@ message GetGwInfoResp {

required GatewayInfo info = 2;
}

message GetGwStatusReq {
required RequestHeader header = 1;
}

message GetGwStatusResp {
required ResponseHeader header = 1;

required GatewayStatus status = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ message WirepasMessage {
optional GetGwInfoResp get_gateway_info_resp = 16;
optional SetScratchpadTargetAndActionReq set_scratchpad_target_and_action_req = 17;
optional SetScratchpadTargetAndActionResp set_scratchpad_target_and_action_resp = 18;
optional GetGwStatusReq get_gateway_status_req = 19;
optional GetGwStatusResp get_gateway_status_resp = 20;
}

message CustomerMessage {
Expand Down