Skip to content

Commit

Permalink
Update wnt api examples for WNT 4.0.0 (#143)
Browse files Browse the repository at this point in the history
* Update WNT protocol buffer files for WNT 4.0.0

* Update WNT websocket API helpers for WNT 4.0.0

* Updated WNT examples for WNT 4.0.0

Contains following changes:
- Modifications based on the changes in message structures
- Updated examples to be compatible with newer websocket-client versions (on_close callback)

* Fix realtime situation message handling in componentsinformation.py

* Improve compatibility with different websocket-client library versions

- Default values to on_close callback handler parameters to support old versions
- Disable tracing by default to avoid too verbose output in newer versions

* Add requirements.txt to help running e.g. in virtual environments

* Remove unnecessary originator_token fields from get type of messages
  • Loading branch information
MauriKuorilehto committed Jun 9, 2021
1 parent 769a45e commit 53d6a10
Show file tree
Hide file tree
Showing 26 changed files with 452 additions and 195 deletions.
21 changes: 12 additions & 9 deletions wnt/protocol_buffers_files/commons.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/
syntax="proto2";

import "nanopb.proto";

package com.wirepas.proto.wnt;

enum BaseRole {
Expand All @@ -18,6 +16,16 @@ enum BaseRole {
ROLE_UNKNOWN = 255;
}

enum MessageSendingType {
MESSAGE_SENDING_TYPE_INSTANT = 1;
MESSAGE_SENDING_TYPE_DISTRIBUTED = 2;
}

enum SelectionType {
SELECTION_TYPE_NETWORK = 1;
SELECTION_TYPE_SINK = 2;
}

message FullRole {
optional BaseRole base_role = 1;
optional bool cb_mac = 2; // True = low latency, false = low energy
Expand All @@ -26,15 +34,10 @@ message FullRole {
}

message AppConfigData {
enum Type {
NETWORK = 1;
SINK = 2;
}

optional uint32 interval = 1; // Diagnostics interval in seconds
optional uint32 sequence = 2;
optional bytes app_config = 3 [(nanopb).max_size = 1024];
optional bytes app_config = 3;
optional uint32 max_length = 4; // Maximum length of the app config
optional bool is_override_on = 5; // WNT backend will override appconfig if it is changed outside of WNT
optional Type type = 6;
optional SelectionType selection_type = 6;
}
12 changes: 8 additions & 4 deletions wnt/protocol_buffers_files/internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
syntax="proto2";

import "nanopb.proto";
import "commons.proto";

package com.wirepas.proto.wnt;
Expand Down Expand Up @@ -70,6 +69,9 @@ message BackendMessage { // Used for backend internal messaging
RTSituationSendPositioningData = 9;
RTSituationComponentInformation = 10;
RTSituationQueryNodeMetadata = 11;
RTSituationQueryNetworkMetadata = 12;
RTSituationQueryBuildingAndFloorPlanMetadata = 13;
RTSituationQueryAreaMetadata = 14;
}

optional MessageType message = 1;
Expand All @@ -88,6 +90,7 @@ message OnlineStatus { // Node online status
optional Status status = 1;
optional uint32 update_time = 2; // Epoch
optional uint32 last_time_series_write = 3; // Epoch
optional Status previous_status = 4;

optional bool is_sink_online_in_gateway = 10;
}
Expand Down Expand Up @@ -140,6 +143,7 @@ message Network {
optional uint32 id = 1;
optional string name = 2;
optional uint32 update_time = 3;
optional bool is_delete_nodes = 4;
}

message User {
Expand Down Expand Up @@ -262,12 +266,12 @@ message MetadataUpdateMessage {
}

message SinkPseudoIdMap {
optional string pseudo_id = 1 [(nanopb).max_size = 1024];
optional string pseudo_id = 1;

optional uint32 network_id = 10;
optional uint32 address = 11; // Node id
optional string gateway_id = 12 [(nanopb).max_size = 128];
optional string gateway_sink_id = 13 [(nanopb).max_size = 128];
optional string gateway_id = 12;
optional string gateway_sink_id = 13;

optional AppConfigData app_config = 20;
optional uint32 stored_scratchpad_sequence = 21;
Expand Down

0 comments on commit 53d6a10

Please sign in to comment.