Compare commits

..

32 Commits

Author SHA1 Message Date
3fd821ebdf Update version to v4.0.0-test.7. 2022-06-29 14:10:50 +01:00
a04d47833f Render empty bar and heatmap charts. 2022-06-29 09:26:42 +01:00
462ff3665d Fix missing Card import. 2022-06-28 15:12:34 +01:00
a01f8565fd Implement support for quick device measurement metrics. 2022-06-28 15:05:42 +01:00
4fa9341139 Bump version. 2022-06-10 12:32:09 +01:00
8a695d341c Add missing classCTimeout and abpRx1DrOffset on template select.
Closes #27.
2022-06-10 12:22:07 +01:00
32cf56af53 Bump crossbeam-utils from 0.8.6 to 0.8.8 (#26)
Bumps [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) from 0.8.6 to 0.8.8.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-utils-0.8.6...crossbeam-utils-0.8.8)

---
updated-dependencies:
- dependency-name: crossbeam-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 14:15:31 +01:00
804c876aa7 Format UI code. 2022-06-08 14:10:04 +01:00
fef42fa192 Update openidconnect dependency. 2022-06-07 19:51:48 +01:00
1fbc4e5391 Fix accidentally committed changes. 2022-06-07 19:50:14 +01:00
1236b4dba9 Update rust-embed dependency. 2022-06-07 19:42:15 +01:00
32c4495f0f Bump openssl-src from 111.17.0+1.1.1m to 111.20.0+1.1.1o (#25)
Bumps [openssl-src](https://github.com/alexcrichton/openssl-src-rs) from 111.17.0+1.1.1m to 111.20.0+1.1.1o.
- [Release notes](https://github.com/alexcrichton/openssl-src-rs/releases)
- [Commits](https://github.com/alexcrichton/openssl-src-rs/commits)

---
updated-dependencies:
- dependency-name: openssl-src
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-07 19:30:47 +01:00
8594c14c24 Bump protobufjs from 6.11.2 to 6.11.3 in /api/js (#24)
Bumps [protobufjs](https://github.com/protobufjs/protobuf.js) from 6.11.2 to 6.11.3.
- [Release notes](https://github.com/protobufjs/protobuf.js/releases)
- [Changelog](https://github.com/protobufjs/protobuf.js/blob/v6.11.3/CHANGELOG.md)
- [Commits](https://github.com/protobufjs/protobuf.js/compare/v6.11.2...v6.11.3)

---
updated-dependencies:
- dependency-name: protobufjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-07 19:30:33 +01:00
d9d3f14e80 Implement support for device-profile templates + TTN importer. 2022-06-07 19:29:59 +01:00
d1630e5722 User should not be able to delete its own user record. (#13)
Signed-off-by: SAGAR PATEL <sagar.a.patel@slscorp.com>
2022-06-07 11:53:23 +01:00
ba4aeb849c Bump follow-redirects from 1.13.2 to 1.15.0 in /ui (#18)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.2 to 1.15.0.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.13.2...v1.15.0)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-07 11:51:25 +01:00
25c71c5483 Do not flush dev_ and join_ nonces when updating AppKey for OTAA (#22)
Signed-off-by: SAGAR PATEL <sagar.a.patel@slscorp.com>
2022-06-07 11:51:04 +01:00
3b426471b3 Re-implement copy to clipboard (DevAddr, EUI and AES keys). 2022-06-07 11:47:25 +01:00
2e1c907df0 Add generate api docs in Markdown. 2022-06-05 08:25:13 +01:00
bd79e72bdb Add check to make sure gateway region = device-profile region. 2022-05-24 20:53:20 +01:00
3486d94441 Fix Buffer to Protobuf setData casting. 2022-05-24 20:28:36 +01:00
3199276c83 Fix missing Buffer reference.
Closes #23.
2022-05-24 16:22:54 +01:00
f4478864ee Fix clippy warnings. 2022-05-24 16:15:12 +01:00
a0f56c0ff6 Fix updating rx1 delay on config change. 2022-05-24 16:09:08 +01:00
5b1d70cdbf Integrate Buffer class into JS codec runtime. 2022-05-10 14:08:47 +01:00
a656b9f3a1 Bump browserslist from 4.16.3 to 4.20.3 in /ui (#21)
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.3 to 4.20.3.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.16.3...4.20.3)

---
updated-dependencies:
- dependency-name: browserslist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:07:47 +01:00
3908fc0846 Bump path-parse from 1.0.6 to 1.0.7 in /ui (#20)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:07:37 +01:00
3c3f813167 Bump tmpl from 1.0.4 to 1.0.5 in /ui (#19)
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:07:26 +01:00
8f9d4a224b Bump ansi-regex from 5.0.0 to 5.0.1 in /ui (#17)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:06:36 +01:00
5c05628fd1 Bump moment from 2.29.1 to 2.29.3 in /ui (#16)
Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.3.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/2.29.3/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.1...2.29.3)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:06:23 +01:00
2355a1ecc6 Bump minimist from 1.2.5 to 1.2.6 in /ui (#15)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:06:15 +01:00
755791878b Bump async from 2.6.3 to 2.6.4 in /ui (#14)
Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4)

---
updated-dependencies:
- dependency-name: async
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-10 09:05:25 +01:00
131 changed files with 27786 additions and 3994 deletions

169
Cargo.lock generated
View File

@ -574,7 +574,7 @@ dependencies = [
[[package]]
name = "backend"
version = "4.0.0-test.5"
version = "4.0.0-test.7"
dependencies = [
"aes-kw",
"anyhow",
@ -626,14 +626,14 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.59.2"
version = "0.60.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"
checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"clap",
"clap 3.1.18",
"env_logger",
"lazy_static",
"lazycell",
@ -800,7 +800,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack"
version = "4.0.0-test.5"
version = "4.0.0-test.7"
dependencies = [
"aes 0.7.5",
"anyhow",
@ -814,7 +814,7 @@ dependencies = [
"bigdecimal",
"chirpstack_api",
"chrono",
"clap",
"clap 2.34.0",
"diesel",
"diesel_migrations",
"futures",
@ -851,6 +851,7 @@ dependencies = [
"rust-embed",
"serde",
"serde_json",
"serde_yaml",
"sha2 0.10.1",
"thiserror",
"tokio",
@ -871,7 +872,7 @@ dependencies = [
[[package]]
name = "chirpstack_api"
version = "4.0.0-test.5"
version = "4.0.0-test.7"
dependencies = [
"hex",
"pbjson",
@ -939,12 +940,36 @@ dependencies = [
"ansi_term",
"atty",
"bitflags",
"strsim",
"textwrap",
"strsim 0.8.0",
"textwrap 0.11.0",
"unicode-width",
"vec_map",
]
[[package]]
name = "clap"
version = "3.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
dependencies = [
"atty",
"bitflags",
"clap_lex",
"indexmap",
"strsim 0.10.0",
"termcolor",
"textwrap 0.15.0",
]
[[package]]
name = "clap_lex"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "cmac"
version = "0.6.0"
@ -1020,9 +1045,9 @@ checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff"
[[package]]
name = "crossbeam-utils"
version = "0.8.6"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120"
checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
dependencies = [
"cfg-if",
"lazy_static",
@ -1864,15 +1889,6 @@ dependencies = [
"waker-fn",
]
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.10.3"
@ -1937,7 +1953,7 @@ dependencies = [
"bit-set",
"diff",
"ena",
"itertools 0.10.3",
"itertools",
"lalrpop-util",
"petgraph 0.5.1",
"pico-args",
@ -2020,6 +2036,12 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "linked-hash-map"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "lock_api"
version = "0.4.5"
@ -2041,7 +2063,7 @@ dependencies = [
[[package]]
name = "lrwn"
version = "4.0.0-test.5"
version = "4.0.0-test.7"
dependencies = [
"aes 0.7.5",
"anyhow",
@ -2281,9 +2303,9 @@ dependencies = [
[[package]]
name = "oauth2"
version = "4.1.0"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e47cfc4c0a1a519d9a025ebfbac3a2439d1b5cdf397d72dcb79b11d9920dab"
checksum = "c3bd7d544f02ae0fa9e06137962703d043870d7ad6e6d44786d6a5f20679b2c9"
dependencies = [
"base64",
"chrono",
@ -2294,7 +2316,7 @@ dependencies = [
"serde",
"serde_json",
"serde_path_to_error",
"sha2 0.9.9",
"sha2 0.10.1",
"thiserror",
"url",
]
@ -2319,14 +2341,14 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "openidconnect"
version = "2.2.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6db0c030c3036f53c7108668641151b244358d221303a17985b07ac9bb60091"
checksum = "32f73e47a1766acd7bedd605742a1a2651c111f34ed3e0be117d8651432d509c"
dependencies = [
"base64",
"chrono",
"http",
"itertools 0.9.0",
"itertools",
"log",
"num-bigint 0.4.3",
"oauth2",
@ -2338,7 +2360,6 @@ dependencies = [
"serde_json",
"serde_path_to_error",
"thiserror",
"untrusted",
"url",
]
@ -2364,9 +2385,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
version = "111.17.0+1.1.1m"
version = "111.20.0+1.1.1o"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d6a336abd10814198f66e2a91ccd7336611f30334119ca8ce300536666fcf4"
checksum = "92892c4f87d56e376e469ace79f1128fdaded07646ddf73aa0be4706ff712dec"
dependencies = [
"cc",
]
@ -2387,13 +2408,19 @@ dependencies = [
[[package]]
name = "ordered-float"
version = "1.1.1"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7"
checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87"
dependencies = [
"num-traits",
]
[[package]]
name = "os_str_bytes"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
[[package]]
name = "paho-mqtt"
version = "0.9.1"
@ -2477,7 +2504,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956a449e8a85fc040e9f8cd8fd4dd2e68059d179092401f0d8570ba059f76dae"
dependencies = [
"heck",
"itertools 0.10.3",
"itertools",
"prost",
"prost-types",
]
@ -2721,7 +2748,7 @@ dependencies = [
"cfg-if",
"cmake",
"heck",
"itertools 0.10.3",
"itertools",
"lazy_static",
"log",
"multimap",
@ -2740,7 +2767,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df35198f0777b75e9ff669737c6da5136b59dba33cf5a010a6d1cc4d56defc6f"
dependencies = [
"anyhow",
"itertools 0.10.3",
"itertools",
"proc-macro2",
"quote",
"syn",
@ -2905,6 +2932,12 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "relative-path"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4e112eddc95bbf25365df3b5414354ad2fe7ee465eddb9965a515faf8c3b6d9"
[[package]]
name = "remove_dir_all"
version = "0.5.3"
@ -2972,27 +3005,29 @@ dependencies = [
[[package]]
name = "rquickjs"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91e309f4594ccf077c2373a1fb00f632bf6c26fc0035ef9f90da9a627404c32"
checksum = "989910af47b3f21c95205a1e1974bfb0f460e5492f469631297cc44c3340967e"
dependencies = [
"rquickjs-core",
]
[[package]]
name = "rquickjs-core"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6da4f2b300a58f9fb368bb68b21e288586e503cc0e0c3c3f94af9b28a717e2c"
checksum = "e78ca2361848dddf910c27296d98bd62be9467d1d1d703eeead8c732adbd4e32"
dependencies = [
"chrono",
"relative-path",
"rquickjs-sys",
]
[[package]]
name = "rquickjs-sys"
version = "0.1.5"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db8ac81ef510279adb2e464073a0ed2f774253742d4cbd85d79383c7b0d931df"
checksum = "263a9a14fc68f2f3403c67e94e5def69af60afbcf7914d2a7fb8f9e17027fa25"
dependencies = [
"bindgen",
"cc",
@ -3000,9 +3035,9 @@ dependencies = [
[[package]]
name = "rust-embed"
version = "5.9.0"
version = "6.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fe1fe6aac5d6bb9e1ffd81002340363272a7648234ec7bdfac5ee202cb65523"
checksum = "9a17e5ac65b318f397182ae94e532da0ba56b88dd1200b774715d36c4943b1c3"
dependencies = [
"rust-embed-impl",
"rust-embed-utils",
@ -3011,9 +3046,9 @@ dependencies = [
[[package]]
name = "rust-embed-impl"
version = "5.9.0"
version = "6.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed91c41c42ef7bf687384439c312e75e0da9c149b0390889b94de3c7d9d9e66"
checksum = "94e763e24ba2bf0c72bc6be883f967f794a019fafd1b86ba1daff9c91a7edd30"
dependencies = [
"proc-macro2",
"quote",
@ -3024,10 +3059,11 @@ dependencies = [
[[package]]
name = "rust-embed-utils"
version = "5.1.0"
version = "7.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a512219132473ab0a77b52077059f1c47ce4af7fbdc94503e9862a34422876d"
checksum = "756feca3afcbb1487a1d01f4ecd94cf8ec98ea074c55a69e7136d29fb6166029"
dependencies = [
"sha2 0.9.9",
"walkdir",
]
@ -3231,9 +3267,9 @@ dependencies = [
[[package]]
name = "serde-value"
version = "0.6.0"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a65a7291a8a568adcae4c10a677ebcedbc6c9cec91c054dee2ce40b0e3290eb"
checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
dependencies = [
"ordered-float",
"serde",
@ -3292,6 +3328,18 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_yaml"
version = "0.8.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc"
dependencies = [
"indexmap",
"ryu",
"serde",
"yaml-rust",
]
[[package]]
name = "sha-1"
version = "0.8.2"
@ -3472,6 +3520,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "subtle"
version = "2.4.1"
@ -3538,6 +3592,12 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "thiserror"
version = "1.0.30"
@ -4407,6 +4467,15 @@ version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8"
[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
[[package]]
name = "zeroize"
version = "1.5.1"

9
api/Dockerfile-md vendored Normal file
View File

@ -0,0 +1,9 @@
FROM golang:1.18-alpine
ENV PROJECT_PATH=/chirpstack/api
RUN apk add --no-cache make git bash protobuf protobuf-dev
RUN git clone https://github.com/googleapis/googleapis.git /googleapis
RUN mkdir -p $PROJECT_PATH
WORKDIR $PROJECT_PATH

3
api/Makefile vendored
View File

@ -17,3 +17,6 @@ js:
python:
docker-compose run --rm chirpstack-api-python
md:
docker-compose run --rm chirpstack-api-md

View File

@ -35,3 +35,10 @@ services:
command: bash -c "cd js && make all"
volumes:
- ./:/chirpstack/api
chirpstack-api-md:
build:
context: .
dockerfile: Dockerfile-md
command: bash -c "cd md && make all"
volumes:
- ./:/chirpstack/api

1
api/go/Makefile vendored
View File

@ -21,6 +21,7 @@ api:
protoc ${PROTOC_ARGS} api/tenant.proto
protoc ${PROTOC_ARGS} api/application.proto
protoc ${PROTOC_ARGS} api/device_profile.proto
protoc ${PROTOC_ARGS} api/device_profile_template.proto
protoc ${PROTOC_ARGS} api/device.proto
protoc ${PROTOC_ARGS} api/gateway.proto
protoc ${PROTOC_ARGS} api/frame_log.proto

1074
api/go/api/device.pb.go vendored

File diff suppressed because it is too large Load Diff

View File

@ -51,8 +51,12 @@ type DeviceServiceClient interface {
GetActivation(ctx context.Context, in *GetDeviceActivationRequest, opts ...grpc.CallOption) (*GetDeviceActivationResponse, error)
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
GetRandomDevAddr(ctx context.Context, in *GetRandomDevAddrRequest, opts ...grpc.CallOption) (*GetRandomDevAddrResponse, error)
// GetStats returns the device stats.
GetStats(ctx context.Context, in *GetDeviceStatsRequest, opts ...grpc.CallOption) (*GetDeviceStatsResponse, error)
// GetMetrics returns the device metrics.
// Note that this requires a device-profile with codec and measurements configured.
GetMetrics(ctx context.Context, in *GetDeviceMetricsRequest, opts ...grpc.CallOption) (*GetDeviceMetricsResponse, error)
// GetLinkMetrics returns the device link metrics.
// This includes uplinks, downlinks, RSSI, SNR, etc...
GetLinkMetrics(ctx context.Context, in *GetDeviceLinkMetricsRequest, opts ...grpc.CallOption) (*GetDeviceLinkMetricsResponse, error)
// Enqueue adds the given item to the downlink queue.
Enqueue(ctx context.Context, in *EnqueueDeviceQueueItemRequest, opts ...grpc.CallOption) (*EnqueueDeviceQueueItemResponse, error)
// FlushQueue flushes the downlink device-queue.
@ -195,9 +199,18 @@ func (c *deviceServiceClient) GetRandomDevAddr(ctx context.Context, in *GetRando
return out, nil
}
func (c *deviceServiceClient) GetStats(ctx context.Context, in *GetDeviceStatsRequest, opts ...grpc.CallOption) (*GetDeviceStatsResponse, error) {
out := new(GetDeviceStatsResponse)
err := c.cc.Invoke(ctx, "/api.DeviceService/GetStats", in, out, opts...)
func (c *deviceServiceClient) GetMetrics(ctx context.Context, in *GetDeviceMetricsRequest, opts ...grpc.CallOption) (*GetDeviceMetricsResponse, error) {
out := new(GetDeviceMetricsResponse)
err := c.cc.Invoke(ctx, "/api.DeviceService/GetMetrics", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceServiceClient) GetLinkMetrics(ctx context.Context, in *GetDeviceLinkMetricsRequest, opts ...grpc.CallOption) (*GetDeviceLinkMetricsResponse, error) {
out := new(GetDeviceLinkMetricsResponse)
err := c.cc.Invoke(ctx, "/api.DeviceService/GetLinkMetrics", in, out, opts...)
if err != nil {
return nil, err
}
@ -263,8 +276,12 @@ type DeviceServiceServer interface {
GetActivation(context.Context, *GetDeviceActivationRequest) (*GetDeviceActivationResponse, error)
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
GetRandomDevAddr(context.Context, *GetRandomDevAddrRequest) (*GetRandomDevAddrResponse, error)
// GetStats returns the device stats.
GetStats(context.Context, *GetDeviceStatsRequest) (*GetDeviceStatsResponse, error)
// GetMetrics returns the device metrics.
// Note that this requires a device-profile with codec and measurements configured.
GetMetrics(context.Context, *GetDeviceMetricsRequest) (*GetDeviceMetricsResponse, error)
// GetLinkMetrics returns the device link metrics.
// This includes uplinks, downlinks, RSSI, SNR, etc...
GetLinkMetrics(context.Context, *GetDeviceLinkMetricsRequest) (*GetDeviceLinkMetricsResponse, error)
// Enqueue adds the given item to the downlink queue.
Enqueue(context.Context, *EnqueueDeviceQueueItemRequest) (*EnqueueDeviceQueueItemResponse, error)
// FlushQueue flushes the downlink device-queue.
@ -320,8 +337,11 @@ func (UnimplementedDeviceServiceServer) GetActivation(context.Context, *GetDevic
func (UnimplementedDeviceServiceServer) GetRandomDevAddr(context.Context, *GetRandomDevAddrRequest) (*GetRandomDevAddrResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetRandomDevAddr not implemented")
}
func (UnimplementedDeviceServiceServer) GetStats(context.Context, *GetDeviceStatsRequest) (*GetDeviceStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented")
func (UnimplementedDeviceServiceServer) GetMetrics(context.Context, *GetDeviceMetricsRequest) (*GetDeviceMetricsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMetrics not implemented")
}
func (UnimplementedDeviceServiceServer) GetLinkMetrics(context.Context, *GetDeviceLinkMetricsRequest) (*GetDeviceLinkMetricsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetLinkMetrics not implemented")
}
func (UnimplementedDeviceServiceServer) Enqueue(context.Context, *EnqueueDeviceQueueItemRequest) (*EnqueueDeviceQueueItemResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Enqueue not implemented")
@ -597,20 +617,38 @@ func _DeviceService_GetRandomDevAddr_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler)
}
func _DeviceService_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDeviceStatsRequest)
func _DeviceService_GetMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDeviceMetricsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceServiceServer).GetStats(ctx, in)
return srv.(DeviceServiceServer).GetMetrics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceService/GetStats",
FullMethod: "/api.DeviceService/GetMetrics",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceServiceServer).GetStats(ctx, req.(*GetDeviceStatsRequest))
return srv.(DeviceServiceServer).GetMetrics(ctx, req.(*GetDeviceMetricsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceService_GetLinkMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDeviceLinkMetricsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceServiceServer).GetLinkMetrics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceService/GetLinkMetrics",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceServiceServer).GetLinkMetrics(ctx, req.(*GetDeviceLinkMetricsRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -733,8 +771,12 @@ var DeviceService_ServiceDesc = grpc.ServiceDesc{
Handler: _DeviceService_GetRandomDevAddr_Handler,
},
{
MethodName: "GetStats",
Handler: _DeviceService_GetStats_Handler,
MethodName: "GetMetrics",
Handler: _DeviceService_GetMetrics_Handler,
},
{
MethodName: "GetLinkMetrics",
Handler: _DeviceService_GetLinkMetrics_Handler,
},
{
MethodName: "Enqueue",

File diff suppressed because it is too large Load Diff

1268
api/go/api/device_profile_template.pb.go vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,261 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.18.1
// source: api/device_profile_template.proto
package api
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// DeviceProfileTemplateServiceClient is the client API for DeviceProfileTemplateService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type DeviceProfileTemplateServiceClient interface {
// Create the given device-profile template.
Create(ctx context.Context, in *CreateDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Get the device-profile template for the given ID.
Get(ctx context.Context, in *GetDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*GetDeviceProfileTemplateResponse, error)
// Update the given device-profile template.
Update(ctx context.Context, in *UpdateDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Delete the device-profile template with the given ID.
Delete(ctx context.Context, in *DeleteDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// List the available device-profile templates.
List(ctx context.Context, in *ListDeviceProfileTemplatesRequest, opts ...grpc.CallOption) (*ListDeviceProfileTemplatesResponse, error)
}
type deviceProfileTemplateServiceClient struct {
cc grpc.ClientConnInterface
}
func NewDeviceProfileTemplateServiceClient(cc grpc.ClientConnInterface) DeviceProfileTemplateServiceClient {
return &deviceProfileTemplateServiceClient{cc}
}
func (c *deviceProfileTemplateServiceClient) Create(ctx context.Context, in *CreateDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.DeviceProfileTemplateService/Create", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceProfileTemplateServiceClient) Get(ctx context.Context, in *GetDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*GetDeviceProfileTemplateResponse, error) {
out := new(GetDeviceProfileTemplateResponse)
err := c.cc.Invoke(ctx, "/api.DeviceProfileTemplateService/Get", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceProfileTemplateServiceClient) Update(ctx context.Context, in *UpdateDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.DeviceProfileTemplateService/Update", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceProfileTemplateServiceClient) Delete(ctx context.Context, in *DeleteDeviceProfileTemplateRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.DeviceProfileTemplateService/Delete", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *deviceProfileTemplateServiceClient) List(ctx context.Context, in *ListDeviceProfileTemplatesRequest, opts ...grpc.CallOption) (*ListDeviceProfileTemplatesResponse, error) {
out := new(ListDeviceProfileTemplatesResponse)
err := c.cc.Invoke(ctx, "/api.DeviceProfileTemplateService/List", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DeviceProfileTemplateServiceServer is the server API for DeviceProfileTemplateService service.
// All implementations must embed UnimplementedDeviceProfileTemplateServiceServer
// for forward compatibility
type DeviceProfileTemplateServiceServer interface {
// Create the given device-profile template.
Create(context.Context, *CreateDeviceProfileTemplateRequest) (*emptypb.Empty, error)
// Get the device-profile template for the given ID.
Get(context.Context, *GetDeviceProfileTemplateRequest) (*GetDeviceProfileTemplateResponse, error)
// Update the given device-profile template.
Update(context.Context, *UpdateDeviceProfileTemplateRequest) (*emptypb.Empty, error)
// Delete the device-profile template with the given ID.
Delete(context.Context, *DeleteDeviceProfileTemplateRequest) (*emptypb.Empty, error)
// List the available device-profile templates.
List(context.Context, *ListDeviceProfileTemplatesRequest) (*ListDeviceProfileTemplatesResponse, error)
mustEmbedUnimplementedDeviceProfileTemplateServiceServer()
}
// UnimplementedDeviceProfileTemplateServiceServer must be embedded to have forward compatible implementations.
type UnimplementedDeviceProfileTemplateServiceServer struct {
}
func (UnimplementedDeviceProfileTemplateServiceServer) Create(context.Context, *CreateDeviceProfileTemplateRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedDeviceProfileTemplateServiceServer) Get(context.Context, *GetDeviceProfileTemplateRequest) (*GetDeviceProfileTemplateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedDeviceProfileTemplateServiceServer) Update(context.Context, *UpdateDeviceProfileTemplateRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (UnimplementedDeviceProfileTemplateServiceServer) Delete(context.Context, *DeleteDeviceProfileTemplateRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedDeviceProfileTemplateServiceServer) List(context.Context, *ListDeviceProfileTemplatesRequest) (*ListDeviceProfileTemplatesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedDeviceProfileTemplateServiceServer) mustEmbedUnimplementedDeviceProfileTemplateServiceServer() {
}
// UnsafeDeviceProfileTemplateServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DeviceProfileTemplateServiceServer will
// result in compilation errors.
type UnsafeDeviceProfileTemplateServiceServer interface {
mustEmbedUnimplementedDeviceProfileTemplateServiceServer()
}
func RegisterDeviceProfileTemplateServiceServer(s grpc.ServiceRegistrar, srv DeviceProfileTemplateServiceServer) {
s.RegisterService(&DeviceProfileTemplateService_ServiceDesc, srv)
}
func _DeviceProfileTemplateService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateDeviceProfileTemplateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceProfileTemplateServiceServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceProfileTemplateService/Create",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceProfileTemplateServiceServer).Create(ctx, req.(*CreateDeviceProfileTemplateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceProfileTemplateService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDeviceProfileTemplateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceProfileTemplateServiceServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceProfileTemplateService/Get",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceProfileTemplateServiceServer).Get(ctx, req.(*GetDeviceProfileTemplateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceProfileTemplateService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateDeviceProfileTemplateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceProfileTemplateServiceServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceProfileTemplateService/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceProfileTemplateServiceServer).Update(ctx, req.(*UpdateDeviceProfileTemplateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceProfileTemplateService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteDeviceProfileTemplateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceProfileTemplateServiceServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceProfileTemplateService/Delete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceProfileTemplateServiceServer).Delete(ctx, req.(*DeleteDeviceProfileTemplateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _DeviceProfileTemplateService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListDeviceProfileTemplatesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DeviceProfileTemplateServiceServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.DeviceProfileTemplateService/List",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DeviceProfileTemplateServiceServer).List(ctx, req.(*ListDeviceProfileTemplatesRequest))
}
return interceptor(ctx, in, info, handler)
}
// DeviceProfileTemplateService_ServiceDesc is the grpc.ServiceDesc for DeviceProfileTemplateService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var DeviceProfileTemplateService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "api.DeviceProfileTemplateService",
HandlerType: (*DeviceProfileTemplateServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Create",
Handler: _DeviceProfileTemplateService_Create_Handler,
},
{
MethodName: "Get",
Handler: _DeviceProfileTemplateService_Get_Handler,
},
{
MethodName: "Update",
Handler: _DeviceProfileTemplateService_Update_Handler,
},
{
MethodName: "Delete",
Handler: _DeviceProfileTemplateService_Delete_Handler,
},
{
MethodName: "List",
Handler: _DeviceProfileTemplateService_List_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "api/device_profile_template.proto",
}

View File

@ -768,7 +768,7 @@ func (x *GenerateGatewayClientCertificateResponse) GetExpiresAt() *timestamppb.T
return nil
}
type GetGatewayStatsRequest struct {
type GetGatewayMetricsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -779,10 +779,12 @@ type GetGatewayStatsRequest struct {
Start *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=start,proto3" json:"start,omitempty"`
// Interval end timestamp.
End *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=end,proto3" json:"end,omitempty"`
// Aggregation.
Aggregation common.Aggregation `protobuf:"varint,4,opt,name=aggregation,proto3,enum=common.Aggregation" json:"aggregation,omitempty"`
}
func (x *GetGatewayStatsRequest) Reset() {
*x = GetGatewayStatsRequest{}
func (x *GetGatewayMetricsRequest) Reset() {
*x = GetGatewayMetricsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_gateway_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -790,13 +792,13 @@ func (x *GetGatewayStatsRequest) Reset() {
}
}
func (x *GetGatewayStatsRequest) String() string {
func (x *GetGatewayMetricsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetGatewayStatsRequest) ProtoMessage() {}
func (*GetGatewayMetricsRequest) ProtoMessage() {}
func (x *GetGatewayStatsRequest) ProtoReflect() protoreflect.Message {
func (x *GetGatewayMetricsRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_gateway_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -808,42 +810,62 @@ func (x *GetGatewayStatsRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetGatewayStatsRequest.ProtoReflect.Descriptor instead.
func (*GetGatewayStatsRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use GetGatewayMetricsRequest.ProtoReflect.Descriptor instead.
func (*GetGatewayMetricsRequest) Descriptor() ([]byte, []int) {
return file_api_gateway_proto_rawDescGZIP(), []int{11}
}
func (x *GetGatewayStatsRequest) GetGatewayId() string {
func (x *GetGatewayMetricsRequest) GetGatewayId() string {
if x != nil {
return x.GatewayId
}
return ""
}
func (x *GetGatewayStatsRequest) GetStart() *timestamppb.Timestamp {
func (x *GetGatewayMetricsRequest) GetStart() *timestamppb.Timestamp {
if x != nil {
return x.Start
}
return nil
}
func (x *GetGatewayStatsRequest) GetEnd() *timestamppb.Timestamp {
func (x *GetGatewayMetricsRequest) GetEnd() *timestamppb.Timestamp {
if x != nil {
return x.End
}
return nil
}
type GetGatewayStatsResponse struct {
func (x *GetGatewayMetricsRequest) GetAggregation() common.Aggregation {
if x != nil {
return x.Aggregation
}
return common.Aggregation(0)
}
type GetGatewayMetricsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result []*GatewayStats `protobuf:"bytes,1,rep,name=result,proto3" json:"result,omitempty"`
// RX packets.
RxPackets *common.Metric `protobuf:"bytes,1,opt,name=rx_packets,json=rxPackets,proto3" json:"rx_packets,omitempty"`
// TX packets.
TxPackets *common.Metric `protobuf:"bytes,2,opt,name=tx_packets,json=txPackets,proto3" json:"tx_packets,omitempty"`
// TX packets / frequency.
TxPacketsPerFreq *common.Metric `protobuf:"bytes,3,opt,name=tx_packets_per_freq,json=txPacketsPerFreq,proto3" json:"tx_packets_per_freq,omitempty"`
// RX packets / frequency.
RxPacketsPerFreq *common.Metric `protobuf:"bytes,4,opt,name=rx_packets_per_freq,json=rxPacketsPerFreq,proto3" json:"rx_packets_per_freq,omitempty"`
// TX packets / DR.
TxPacketsPerDr *common.Metric `protobuf:"bytes,5,opt,name=tx_packets_per_dr,json=txPacketsPerDr,proto3" json:"tx_packets_per_dr,omitempty"`
// RX packets / DR.
RxPacketsPerDr *common.Metric `protobuf:"bytes,6,opt,name=rx_packets_per_dr,json=rxPacketsPerDr,proto3" json:"rx_packets_per_dr,omitempty"`
// TX packets per status.
TxPacketsPerStatus *common.Metric `protobuf:"bytes,7,opt,name=tx_packets_per_status,json=txPacketsPerStatus,proto3" json:"tx_packets_per_status,omitempty"`
}
func (x *GetGatewayStatsResponse) Reset() {
*x = GetGatewayStatsResponse{}
func (x *GetGatewayMetricsResponse) Reset() {
*x = GetGatewayMetricsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_gateway_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -851,13 +873,13 @@ func (x *GetGatewayStatsResponse) Reset() {
}
}
func (x *GetGatewayStatsResponse) String() string {
func (x *GetGatewayMetricsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetGatewayStatsResponse) ProtoMessage() {}
func (*GetGatewayMetricsResponse) ProtoMessage() {}
func (x *GetGatewayStatsResponse) ProtoReflect() protoreflect.Message {
func (x *GetGatewayMetricsResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_gateway_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -869,123 +891,54 @@ func (x *GetGatewayStatsResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use GetGatewayStatsResponse.ProtoReflect.Descriptor instead.
func (*GetGatewayStatsResponse) Descriptor() ([]byte, []int) {
// Deprecated: Use GetGatewayMetricsResponse.ProtoReflect.Descriptor instead.
func (*GetGatewayMetricsResponse) Descriptor() ([]byte, []int) {
return file_api_gateway_proto_rawDescGZIP(), []int{12}
}
func (x *GetGatewayStatsResponse) GetResult() []*GatewayStats {
if x != nil {
return x.Result
}
return nil
}
type GatewayStats struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Timestamp of the (aggregated) measurement.
Time *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
// Packets received.
RxPackets uint32 `protobuf:"varint,2,opt,name=rx_packets,json=rxPackets,proto3" json:"rx_packets,omitempty"`
// Packets emitted.
TxPackets uint32 `protobuf:"varint,3,opt,name=tx_packets,json=txPackets,proto3" json:"tx_packets,omitempty"`
// Tx packets per frequency.
TxPacketsPerFrequency map[uint32]uint32 `protobuf:"bytes,4,rep,name=tx_packets_per_frequency,json=txPacketsPerFrequency,proto3" json:"tx_packets_per_frequency,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
// Rx packets per frequency.
RxPacketsPerFrequency map[uint32]uint32 `protobuf:"bytes,5,rep,name=rx_packets_per_frequency,json=rxPacketsPerFrequency,proto3" json:"rx_packets_per_frequency,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
// Tx packets per DR.
TxPacketsPerDr map[uint32]uint32 `protobuf:"bytes,6,rep,name=tx_packets_per_dr,json=txPacketsPerDr,proto3" json:"tx_packets_per_dr,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
// Rx packets per DR.
RxPacketsPerDr map[uint32]uint32 `protobuf:"bytes,7,rep,name=rx_packets_per_dr,json=rxPacketsPerDr,proto3" json:"rx_packets_per_dr,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
// Tx packets per status.
TxPacketsPerStatus map[string]uint32 `protobuf:"bytes,8,rep,name=tx_packets_per_status,json=txPacketsPerStatus,proto3" json:"tx_packets_per_status,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *GatewayStats) Reset() {
*x = GatewayStats{}
if protoimpl.UnsafeEnabled {
mi := &file_api_gateway_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GatewayStats) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GatewayStats) ProtoMessage() {}
func (x *GatewayStats) ProtoReflect() protoreflect.Message {
mi := &file_api_gateway_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GatewayStats.ProtoReflect.Descriptor instead.
func (*GatewayStats) Descriptor() ([]byte, []int) {
return file_api_gateway_proto_rawDescGZIP(), []int{13}
}
func (x *GatewayStats) GetTime() *timestamppb.Timestamp {
if x != nil {
return x.Time
}
return nil
}
func (x *GatewayStats) GetRxPackets() uint32 {
func (x *GetGatewayMetricsResponse) GetRxPackets() *common.Metric {
if x != nil {
return x.RxPackets
}
return 0
return nil
}
func (x *GatewayStats) GetTxPackets() uint32 {
func (x *GetGatewayMetricsResponse) GetTxPackets() *common.Metric {
if x != nil {
return x.TxPackets
}
return 0
return nil
}
func (x *GatewayStats) GetTxPacketsPerFrequency() map[uint32]uint32 {
func (x *GetGatewayMetricsResponse) GetTxPacketsPerFreq() *common.Metric {
if x != nil {
return x.TxPacketsPerFrequency
return x.TxPacketsPerFreq
}
return nil
}
func (x *GatewayStats) GetRxPacketsPerFrequency() map[uint32]uint32 {
func (x *GetGatewayMetricsResponse) GetRxPacketsPerFreq() *common.Metric {
if x != nil {
return x.RxPacketsPerFrequency
return x.RxPacketsPerFreq
}
return nil
}
func (x *GatewayStats) GetTxPacketsPerDr() map[uint32]uint32 {
func (x *GetGatewayMetricsResponse) GetTxPacketsPerDr() *common.Metric {
if x != nil {
return x.TxPacketsPerDr
}
return nil
}
func (x *GatewayStats) GetRxPacketsPerDr() map[uint32]uint32 {
func (x *GetGatewayMetricsResponse) GetRxPacketsPerDr() *common.Metric {
if x != nil {
return x.RxPacketsPerDr
}
return nil
}
func (x *GatewayStats) GetTxPacketsPerStatus() map[string]uint32 {
func (x *GetGatewayMetricsResponse) GetTxPacketsPerStatus() *common.Metric {
if x != nil {
return x.TxPacketsPerStatus
}
@ -1117,118 +1070,86 @@ var file_api_gateway_proto_rawDesc = []byte{
0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72,
0x65, 0x73, 0x41, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65,
0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x1d, 0x0a, 0x0a, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x49, 0x64, 0x12, 0x30,
0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,
0x12, 0x2c, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x44,
0x0a, 0x17, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x72, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x06, 0x72, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x22, 0xad, 0x07, 0x0a, 0x0c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79,
0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x2e, 0x0a, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x78, 0x50, 0x61, 0x63,
0x6b, 0x65, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x73, 0x12, 0x65, 0x0a, 0x18, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74,
0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x18,
0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x61, 0x74, 0x65,
0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x54, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x73, 0x50, 0x65, 0x72, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x52, 0x15, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65,
0x72, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x12, 0x65, 0x0a, 0x18, 0x72, 0x78,
0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x65,
0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e,
0x52, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x46, 0x72, 0x65, 0x71,
0x75, 0x65, 0x6e, 0x63, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x15, 0x72, 0x78, 0x50, 0x61,
0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63,
0x79, 0x12, 0x50, 0x0a, 0x11, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x5f,
0x70, 0x65, 0x72, 0x5f, 0x64, 0x72, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e,
0x54, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x44, 0x72, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x52, 0x0e, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65,
0x72, 0x44, 0x72, 0x12, 0x50, 0x0a, 0x11, 0x72, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74,
0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x64, 0x72, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74,
0x73, 0x2e, 0x52, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x44, 0x72,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x72, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73,
0x50, 0x65, 0x72, 0x44, 0x72, 0x12, 0x5c, 0x0a, 0x15, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77,
0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x54, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74,
0x73, 0x50, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x12, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x1a, 0x48, 0x0a, 0x1a, 0x54, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73,
0x50, 0x65, 0x72, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x48, 0x0a,
0x1a, 0x52, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x46, 0x72, 0x65,
0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x41, 0x0a, 0x13, 0x54, 0x78, 0x50, 0x61, 0x63,
0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x44, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x41, 0x0a, 0x13, 0x52, 0x78,
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x44, 0x72, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x45, 0x0a,
0x17, 0x54, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x3a, 0x02, 0x38, 0x01, 0x32, 0x8b, 0x04, 0x0a, 0x0e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x61,
0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x16, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47,
0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
0x12, 0x3d, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12,
0x3d, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3d,
0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73,
0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77,
0x61, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x7a, 0x0a,
0x19, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43,
0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79,
0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47,
0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x43, 0x6c,
0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x08, 0x47, 0x65, 0x74,
0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47,
0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65,
0x77, 0x61, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x00, 0x42, 0x53, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74,
0x61, 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x0c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63,
0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f,
0x2f, 0x76, 0x34, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x73, 0x41, 0x74, 0x22, 0xd0, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65,
0x77, 0x61, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5f, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x49, 0x64,
0x12, 0x30, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x73, 0x74, 0x61,
0x72, 0x74, 0x12, 0x2c, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x03, 0x65, 0x6e, 0x64,
0x12, 0x35, 0x0a, 0x0b, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x41,
0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x67, 0x67, 0x72,
0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xb0, 0x03, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x47,
0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x72, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x09, 0x72, 0x78, 0x50, 0x61, 0x63,
0x6b, 0x65, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x0a, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x09, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x73, 0x12, 0x3d, 0x0a, 0x13, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74,
0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x65, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
0x52, 0x10, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x46, 0x72,
0x65, 0x71, 0x12, 0x3d, 0x0a, 0x13, 0x72, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73,
0x5f, 0x70, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x65, 0x71, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52,
0x10, 0x72, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x46, 0x72, 0x65,
0x71, 0x12, 0x39, 0x0a, 0x11, 0x74, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x5f,
0x70, 0x65, 0x72, 0x5f, 0x64, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x0e, 0x74, 0x78,
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x50, 0x65, 0x72, 0x44, 0x72, 0x12, 0x39, 0x0a, 0x11,
0x72, 0x78, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x64,
0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x0e, 0x72, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x73, 0x50, 0x65, 0x72, 0x44, 0x72, 0x12, 0x41, 0x0a, 0x15, 0x74, 0x78, 0x5f, 0x70, 0x61,
0x63, 0x6b, 0x65, 0x74, 0x73, 0x5f, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x12, 0x74, 0x78, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74,
0x73, 0x50, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x32, 0x91, 0x04, 0x0a, 0x0e, 0x47,
0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a,
0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72,
0x65, 0x61, 0x74, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x03,
0x47, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74,
0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x12, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x61, 0x74,
0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12,
0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x47, 0x61, 0x74, 0x65,
0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
0x74, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73,
0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x12, 0x7a, 0x0a, 0x19, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x43,
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65,
0x12, 0x2c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x47,
0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74,
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x47, 0x61, 0x74,
0x65, 0x77, 0x61, 0x79, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
0x4d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x1d, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4d, 0x65,
0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4d, 0x65, 0x74,
0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x53,
0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e,
0x61, 0x70, 0x69, 0x42, 0x0c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70,
0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x34, 0x2f,
0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1243,7 +1164,7 @@ func file_api_gateway_proto_rawDescGZIP() []byte {
return file_api_gateway_proto_rawDescData
}
var file_api_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_api_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_api_gateway_proto_goTypes = []interface{}{
(*Gateway)(nil), // 0: api.Gateway
(*GatewayListItem)(nil), // 1: api.GatewayListItem
@ -1256,66 +1177,63 @@ var file_api_gateway_proto_goTypes = []interface{}{
(*ListGatewaysResponse)(nil), // 8: api.ListGatewaysResponse
(*GenerateGatewayClientCertificateRequest)(nil), // 9: api.GenerateGatewayClientCertificateRequest
(*GenerateGatewayClientCertificateResponse)(nil), // 10: api.GenerateGatewayClientCertificateResponse
(*GetGatewayStatsRequest)(nil), // 11: api.GetGatewayStatsRequest
(*GetGatewayStatsResponse)(nil), // 12: api.GetGatewayStatsResponse
(*GatewayStats)(nil), // 13: api.GatewayStats
nil, // 14: api.Gateway.TagsEntry
nil, // 15: api.Gateway.PropertiesEntry
nil, // 16: api.GatewayListItem.PropertiesEntry
nil, // 17: api.GatewayStats.TxPacketsPerFrequencyEntry
nil, // 18: api.GatewayStats.RxPacketsPerFrequencyEntry
nil, // 19: api.GatewayStats.TxPacketsPerDrEntry
nil, // 20: api.GatewayStats.RxPacketsPerDrEntry
nil, // 21: api.GatewayStats.TxPacketsPerStatusEntry
(*common.Location)(nil), // 22: common.Location
(*timestamppb.Timestamp)(nil), // 23: google.protobuf.Timestamp
(*emptypb.Empty)(nil), // 24: google.protobuf.Empty
(*GetGatewayMetricsRequest)(nil), // 11: api.GetGatewayMetricsRequest
(*GetGatewayMetricsResponse)(nil), // 12: api.GetGatewayMetricsResponse
nil, // 13: api.Gateway.TagsEntry
nil, // 14: api.Gateway.PropertiesEntry
nil, // 15: api.GatewayListItem.PropertiesEntry
(*common.Location)(nil), // 16: common.Location
(*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp
(common.Aggregation)(0), // 18: common.Aggregation
(*common.Metric)(nil), // 19: common.Metric
(*emptypb.Empty)(nil), // 20: google.protobuf.Empty
}
var file_api_gateway_proto_depIdxs = []int32{
22, // 0: api.Gateway.location:type_name -> common.Location
14, // 1: api.Gateway.tags:type_name -> api.Gateway.TagsEntry
15, // 2: api.Gateway.properties:type_name -> api.Gateway.PropertiesEntry
22, // 3: api.GatewayListItem.location:type_name -> common.Location
16, // 4: api.GatewayListItem.properties:type_name -> api.GatewayListItem.PropertiesEntry
23, // 5: api.GatewayListItem.created_at:type_name -> google.protobuf.Timestamp
23, // 6: api.GatewayListItem.updated_at:type_name -> google.protobuf.Timestamp
23, // 7: api.GatewayListItem.last_seen_at:type_name -> google.protobuf.Timestamp
16, // 0: api.Gateway.location:type_name -> common.Location
13, // 1: api.Gateway.tags:type_name -> api.Gateway.TagsEntry
14, // 2: api.Gateway.properties:type_name -> api.Gateway.PropertiesEntry
16, // 3: api.GatewayListItem.location:type_name -> common.Location
15, // 4: api.GatewayListItem.properties:type_name -> api.GatewayListItem.PropertiesEntry
17, // 5: api.GatewayListItem.created_at:type_name -> google.protobuf.Timestamp
17, // 6: api.GatewayListItem.updated_at:type_name -> google.protobuf.Timestamp
17, // 7: api.GatewayListItem.last_seen_at:type_name -> google.protobuf.Timestamp
0, // 8: api.CreateGatewayRequest.gateway:type_name -> api.Gateway
0, // 9: api.GetGatewayResponse.gateway:type_name -> api.Gateway
23, // 10: api.GetGatewayResponse.created_at:type_name -> google.protobuf.Timestamp
23, // 11: api.GetGatewayResponse.updated_at:type_name -> google.protobuf.Timestamp
23, // 12: api.GetGatewayResponse.last_seen_at:type_name -> google.protobuf.Timestamp
17, // 10: api.GetGatewayResponse.created_at:type_name -> google.protobuf.Timestamp
17, // 11: api.GetGatewayResponse.updated_at:type_name -> google.protobuf.Timestamp
17, // 12: api.GetGatewayResponse.last_seen_at:type_name -> google.protobuf.Timestamp
0, // 13: api.UpdateGatewayRequest.gateway:type_name -> api.Gateway
1, // 14: api.ListGatewaysResponse.result:type_name -> api.GatewayListItem
23, // 15: api.GenerateGatewayClientCertificateResponse.expires_at:type_name -> google.protobuf.Timestamp
23, // 16: api.GetGatewayStatsRequest.start:type_name -> google.protobuf.Timestamp
23, // 17: api.GetGatewayStatsRequest.end:type_name -> google.protobuf.Timestamp
13, // 18: api.GetGatewayStatsResponse.result:type_name -> api.GatewayStats
23, // 19: api.GatewayStats.time:type_name -> google.protobuf.Timestamp
17, // 20: api.GatewayStats.tx_packets_per_frequency:type_name -> api.GatewayStats.TxPacketsPerFrequencyEntry
18, // 21: api.GatewayStats.rx_packets_per_frequency:type_name -> api.GatewayStats.RxPacketsPerFrequencyEntry
19, // 22: api.GatewayStats.tx_packets_per_dr:type_name -> api.GatewayStats.TxPacketsPerDrEntry
20, // 23: api.GatewayStats.rx_packets_per_dr:type_name -> api.GatewayStats.RxPacketsPerDrEntry
21, // 24: api.GatewayStats.tx_packets_per_status:type_name -> api.GatewayStats.TxPacketsPerStatusEntry
2, // 25: api.GatewayService.Create:input_type -> api.CreateGatewayRequest
3, // 26: api.GatewayService.Get:input_type -> api.GetGatewayRequest
5, // 27: api.GatewayService.Update:input_type -> api.UpdateGatewayRequest
6, // 28: api.GatewayService.Delete:input_type -> api.DeleteGatewayRequest
7, // 29: api.GatewayService.List:input_type -> api.ListGatewaysRequest
9, // 30: api.GatewayService.GenerateClientCertificate:input_type -> api.GenerateGatewayClientCertificateRequest
11, // 31: api.GatewayService.GetStats:input_type -> api.GetGatewayStatsRequest
24, // 32: api.GatewayService.Create:output_type -> google.protobuf.Empty
4, // 33: api.GatewayService.Get:output_type -> api.GetGatewayResponse
24, // 34: api.GatewayService.Update:output_type -> google.protobuf.Empty
24, // 35: api.GatewayService.Delete:output_type -> google.protobuf.Empty
8, // 36: api.GatewayService.List:output_type -> api.ListGatewaysResponse
10, // 37: api.GatewayService.GenerateClientCertificate:output_type -> api.GenerateGatewayClientCertificateResponse
12, // 38: api.GatewayService.GetStats:output_type -> api.GetGatewayStatsResponse
32, // [32:39] is the sub-list for method output_type
25, // [25:32] is the sub-list for method input_type
25, // [25:25] is the sub-list for extension type_name
25, // [25:25] is the sub-list for extension extendee
0, // [0:25] is the sub-list for field type_name
17, // 15: api.GenerateGatewayClientCertificateResponse.expires_at:type_name -> google.protobuf.Timestamp
17, // 16: api.GetGatewayMetricsRequest.start:type_name -> google.protobuf.Timestamp
17, // 17: api.GetGatewayMetricsRequest.end:type_name -> google.protobuf.Timestamp
18, // 18: api.GetGatewayMetricsRequest.aggregation:type_name -> common.Aggregation
19, // 19: api.GetGatewayMetricsResponse.rx_packets:type_name -> common.Metric
19, // 20: api.GetGatewayMetricsResponse.tx_packets:type_name -> common.Metric
19, // 21: api.GetGatewayMetricsResponse.tx_packets_per_freq:type_name -> common.Metric
19, // 22: api.GetGatewayMetricsResponse.rx_packets_per_freq:type_name -> common.Metric
19, // 23: api.GetGatewayMetricsResponse.tx_packets_per_dr:type_name -> common.Metric
19, // 24: api.GetGatewayMetricsResponse.rx_packets_per_dr:type_name -> common.Metric
19, // 25: api.GetGatewayMetricsResponse.tx_packets_per_status:type_name -> common.Metric
2, // 26: api.GatewayService.Create:input_type -> api.CreateGatewayRequest
3, // 27: api.GatewayService.Get:input_type -> api.GetGatewayRequest
5, // 28: api.GatewayService.Update:input_type -> api.UpdateGatewayRequest
6, // 29: api.GatewayService.Delete:input_type -> api.DeleteGatewayRequest
7, // 30: api.GatewayService.List:input_type -> api.ListGatewaysRequest
9, // 31: api.GatewayService.GenerateClientCertificate:input_type -> api.GenerateGatewayClientCertificateRequest
11, // 32: api.GatewayService.GetMetrics:input_type -> api.GetGatewayMetricsRequest
20, // 33: api.GatewayService.Create:output_type -> google.protobuf.Empty
4, // 34: api.GatewayService.Get:output_type -> api.GetGatewayResponse
20, // 35: api.GatewayService.Update:output_type -> google.protobuf.Empty
20, // 36: api.GatewayService.Delete:output_type -> google.protobuf.Empty
8, // 37: api.GatewayService.List:output_type -> api.ListGatewaysResponse
10, // 38: api.GatewayService.GenerateClientCertificate:output_type -> api.GenerateGatewayClientCertificateResponse
12, // 39: api.GatewayService.GetMetrics:output_type -> api.GetGatewayMetricsResponse
33, // [33:40] is the sub-list for method output_type
26, // [26:33] is the sub-list for method input_type
26, // [26:26] is the sub-list for extension type_name
26, // [26:26] is the sub-list for extension extendee
0, // [0:26] is the sub-list for field type_name
}
func init() { file_api_gateway_proto_init() }
@ -1457,7 +1375,7 @@ func file_api_gateway_proto_init() {
}
}
file_api_gateway_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetGatewayStatsRequest); i {
switch v := v.(*GetGatewayMetricsRequest); i {
case 0:
return &v.state
case 1:
@ -1469,19 +1387,7 @@ func file_api_gateway_proto_init() {
}
}
file_api_gateway_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetGatewayStatsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_gateway_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GatewayStats); i {
switch v := v.(*GetGatewayMetricsResponse); i {
case 0:
return &v.state
case 1:
@ -1499,7 +1405,7 @@ func file_api_gateway_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_gateway_proto_rawDesc,
NumEnums: 0,
NumMessages: 22,
NumMessages: 16,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -35,8 +35,8 @@ type GatewayServiceClient interface {
List(ctx context.Context, in *ListGatewaysRequest, opts ...grpc.CallOption) (*ListGatewaysResponse, error)
// Generate client-certificate for the gateway.
GenerateClientCertificate(ctx context.Context, in *GenerateGatewayClientCertificateRequest, opts ...grpc.CallOption) (*GenerateGatewayClientCertificateResponse, error)
// GetStats returns the gateway stats.
GetStats(ctx context.Context, in *GetGatewayStatsRequest, opts ...grpc.CallOption) (*GetGatewayStatsResponse, error)
// GetMetrics returns the gateway metrics.
GetMetrics(ctx context.Context, in *GetGatewayMetricsRequest, opts ...grpc.CallOption) (*GetGatewayMetricsResponse, error)
}
type gatewayServiceClient struct {
@ -101,9 +101,9 @@ func (c *gatewayServiceClient) GenerateClientCertificate(ctx context.Context, in
return out, nil
}
func (c *gatewayServiceClient) GetStats(ctx context.Context, in *GetGatewayStatsRequest, opts ...grpc.CallOption) (*GetGatewayStatsResponse, error) {
out := new(GetGatewayStatsResponse)
err := c.cc.Invoke(ctx, "/api.GatewayService/GetStats", in, out, opts...)
func (c *gatewayServiceClient) GetMetrics(ctx context.Context, in *GetGatewayMetricsRequest, opts ...grpc.CallOption) (*GetGatewayMetricsResponse, error) {
out := new(GetGatewayMetricsResponse)
err := c.cc.Invoke(ctx, "/api.GatewayService/GetMetrics", in, out, opts...)
if err != nil {
return nil, err
}
@ -126,8 +126,8 @@ type GatewayServiceServer interface {
List(context.Context, *ListGatewaysRequest) (*ListGatewaysResponse, error)
// Generate client-certificate for the gateway.
GenerateClientCertificate(context.Context, *GenerateGatewayClientCertificateRequest) (*GenerateGatewayClientCertificateResponse, error)
// GetStats returns the gateway stats.
GetStats(context.Context, *GetGatewayStatsRequest) (*GetGatewayStatsResponse, error)
// GetMetrics returns the gateway metrics.
GetMetrics(context.Context, *GetGatewayMetricsRequest) (*GetGatewayMetricsResponse, error)
mustEmbedUnimplementedGatewayServiceServer()
}
@ -153,8 +153,8 @@ func (UnimplementedGatewayServiceServer) List(context.Context, *ListGatewaysRequ
func (UnimplementedGatewayServiceServer) GenerateClientCertificate(context.Context, *GenerateGatewayClientCertificateRequest) (*GenerateGatewayClientCertificateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GenerateClientCertificate not implemented")
}
func (UnimplementedGatewayServiceServer) GetStats(context.Context, *GetGatewayStatsRequest) (*GetGatewayStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented")
func (UnimplementedGatewayServiceServer) GetMetrics(context.Context, *GetGatewayMetricsRequest) (*GetGatewayMetricsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMetrics not implemented")
}
func (UnimplementedGatewayServiceServer) mustEmbedUnimplementedGatewayServiceServer() {}
@ -277,20 +277,20 @@ func _GatewayService_GenerateClientCertificate_Handler(srv interface{}, ctx cont
return interceptor(ctx, in, info, handler)
}
func _GatewayService_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetGatewayStatsRequest)
func _GatewayService_GetMetrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetGatewayMetricsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GatewayServiceServer).GetStats(ctx, in)
return srv.(GatewayServiceServer).GetMetrics(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.GatewayService/GetStats",
FullMethod: "/api.GatewayService/GetMetrics",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GatewayServiceServer).GetStats(ctx, req.(*GetGatewayStatsRequest))
return srv.(GatewayServiceServer).GetMetrics(ctx, req.(*GetGatewayMetricsRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -327,8 +327,8 @@ var GatewayService_ServiceDesc = grpc.ServiceDesc{
Handler: _GatewayService_GenerateClientCertificate_Handler,
},
{
MethodName: "GetStats",
Handler: _GatewayService_GetStats_Handler,
MethodName: "GetMetrics",
Handler: _GatewayService_GetMetrics_Handler,
},
},
Streams: []grpc.StreamDesc{},

View File

@ -9,6 +9,7 @@ package common
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
@ -424,6 +425,58 @@ func (LocationSource) EnumDescriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{5}
}
type Aggregation int32
const (
// Hour.
Aggregation_HOUR Aggregation = 0
// Day.
Aggregation_DAY Aggregation = 1
// Month.
Aggregation_MONTH Aggregation = 2
)
// Enum value maps for Aggregation.
var (
Aggregation_name = map[int32]string{
0: "HOUR",
1: "DAY",
2: "MONTH",
}
Aggregation_value = map[string]int32{
"HOUR": 0,
"DAY": 1,
"MONTH": 2,
}
)
func (x Aggregation) Enum() *Aggregation {
p := new(Aggregation)
*p = x
return p
}
func (x Aggregation) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Aggregation) Descriptor() protoreflect.EnumDescriptor {
return file_common_common_proto_enumTypes[6].Descriptor()
}
func (Aggregation) Type() protoreflect.EnumType {
return &file_common_common_proto_enumTypes[6]
}
func (x Aggregation) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Aggregation.Descriptor instead.
func (Aggregation) EnumDescriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{6}
}
type Location struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -565,81 +618,222 @@ func (x *KeyEnvelope) GetAesKey() []byte {
return nil
}
type Metric struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Name.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Timestamps.
Timestamps []*timestamppb.Timestamp `protobuf:"bytes,2,rep,name=timestamps,proto3" json:"timestamps,omitempty"`
// Datasets.
Datasets []*MetricDataset `protobuf:"bytes,3,rep,name=datasets,proto3" json:"datasets,omitempty"`
}
func (x *Metric) Reset() {
*x = Metric{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Metric) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Metric) ProtoMessage() {}
func (x *Metric) ProtoReflect() protoreflect.Message {
mi := &file_common_common_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
func (*Metric) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{2}
}
func (x *Metric) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *Metric) GetTimestamps() []*timestamppb.Timestamp {
if x != nil {
return x.Timestamps
}
return nil
}
func (x *Metric) GetDatasets() []*MetricDataset {
if x != nil {
return x.Datasets
}
return nil
}
type MetricDataset struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Label.
Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
// Data.
// Each value index corresponds with the same timestamp index of the Metric.
Data []float32 `protobuf:"fixed32,2,rep,packed,name=data,proto3" json:"data,omitempty"`
}
func (x *MetricDataset) Reset() {
*x = MetricDataset{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MetricDataset) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MetricDataset) ProtoMessage() {}
func (x *MetricDataset) ProtoReflect() protoreflect.Message {
mi := &file_common_common_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MetricDataset.ProtoReflect.Descriptor instead.
func (*MetricDataset) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{3}
}
func (x *MetricDataset) GetLabel() string {
if x != nil {
return x.Label
}
return ""
}
func (x *MetricDataset) GetData() []float32 {
if x != nil {
return x.Data
}
return nil
}
var File_common_common_proto protoreflect.FileDescriptor
var file_common_common_proto_rawDesc = []byte{
0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0xac, 0x01,
0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61,
0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61,
0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74,
0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69,
0x74, 0x75, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65,
0x12, 0x2e, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x75, 0x72, 0x61, 0x63, 0x79, 0x18, 0x05, 0x20, 0x01,
0x28, 0x02, 0x52, 0x08, 0x61, 0x63, 0x63, 0x75, 0x72, 0x61, 0x63, 0x79, 0x22, 0x43, 0x0a, 0x0b,
0x4b, 0x65, 0x79, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6b,
0x65, 0x6b, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x6b, 0x65, 0x6b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x65, 0x73, 0x5f,
0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x61, 0x65, 0x73, 0x4b, 0x65,
0x79, 0x2a, 0x2c, 0x0a, 0x0a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x52, 0x41, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x53, 0x4b,
0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x52, 0x5f, 0x46, 0x48, 0x53, 0x53, 0x10, 0x02, 0x2a,
0xaa, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x55,
0x38, 0x36, 0x38, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x55, 0x53, 0x39, 0x31, 0x35, 0x10, 0x02,
0x12, 0x09, 0x0a, 0x05, 0x43, 0x4e, 0x37, 0x37, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45,
0x55, 0x34, 0x33, 0x33, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x39, 0x31, 0x35, 0x10,
0x05, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4e, 0x34, 0x37, 0x30, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05,
0x41, 0x53, 0x39, 0x32, 0x33, 0x10, 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33,
0x5f, 0x32, 0x10, 0x0c, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x33, 0x10,
0x0d, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x34, 0x10, 0x0e, 0x12, 0x09,
0x0a, 0x05, 0x4b, 0x52, 0x39, 0x32, 0x30, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4e, 0x38,
0x36, 0x35, 0x10, 0x09, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x55, 0x38, 0x36, 0x34, 0x10, 0x0a, 0x12,
0x0b, 0x0a, 0x07, 0x49, 0x53, 0x4d, 0x32, 0x34, 0x30, 0x30, 0x10, 0x0b, 0x2a, 0xb3, 0x01, 0x0a,
0x05, 0x4d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x52,
0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4a, 0x4f, 0x49, 0x4e,
0x5f, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x4e, 0x43,
0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50,
0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45,
0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, 0x15, 0x0a,
0x11, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f,
0x55, 0x50, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45,
0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x05, 0x12, 0x12, 0x0a,
0x0e, 0x52, 0x45, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10,
0x06, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x52, 0x4f, 0x50, 0x52, 0x49, 0x45, 0x54, 0x41, 0x52, 0x59,
0x10, 0x07, 0x2a, 0x7e, 0x0a, 0x0a, 0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x1a, 0x1f, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74,
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xac,
0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c,
0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c,
0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69,
0x74, 0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67,
0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75, 0x64,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x61, 0x6c, 0x74, 0x69, 0x74, 0x75, 0x64,
0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x75, 0x72, 0x61, 0x63, 0x79, 0x18, 0x05, 0x20,
0x01, 0x28, 0x02, 0x52, 0x08, 0x61, 0x63, 0x63, 0x75, 0x72, 0x61, 0x63, 0x79, 0x22, 0x43, 0x0a,
0x0b, 0x4b, 0x65, 0x79, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09,
0x6b, 0x65, 0x6b, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x6b, 0x65, 0x6b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x65, 0x73,
0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x61, 0x65, 0x73, 0x4b,
0x65, 0x79, 0x22, 0x8b, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x73, 0x12, 0x31, 0x0a,
0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x15, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x44,
0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73,
0x22, 0x39, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65,
0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18,
0x02, 0x20, 0x03, 0x28, 0x02, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x2a, 0x2c, 0x0a, 0x0a, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x4f, 0x52,
0x41, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x46, 0x53, 0x4b, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07,
0x4c, 0x52, 0x5f, 0x46, 0x48, 0x53, 0x53, 0x10, 0x02, 0x2a, 0xaa, 0x01, 0x0a, 0x06, 0x52, 0x65,
0x67, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x55, 0x38, 0x36, 0x38, 0x10, 0x00, 0x12,
0x09, 0x0a, 0x05, 0x55, 0x53, 0x39, 0x31, 0x35, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4e,
0x37, 0x37, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x55, 0x34, 0x33, 0x33, 0x10, 0x04,
0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x39, 0x31, 0x35, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x43,
0x4e, 0x34, 0x37, 0x30, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x53, 0x39, 0x32, 0x33, 0x10,
0x07, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x32, 0x10, 0x0c, 0x12, 0x0b,
0x0a, 0x07, 0x41, 0x53, 0x39, 0x32, 0x33, 0x5f, 0x33, 0x10, 0x0d, 0x12, 0x0b, 0x0a, 0x07, 0x41,
0x53, 0x39, 0x32, 0x33, 0x5f, 0x34, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x4b, 0x52, 0x39, 0x32,
0x30, 0x10, 0x08, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4e, 0x38, 0x36, 0x35, 0x10, 0x09, 0x12, 0x09,
0x0a, 0x05, 0x52, 0x55, 0x38, 0x36, 0x34, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x53, 0x4d,
0x32, 0x34, 0x30, 0x30, 0x10, 0x0b, 0x2a, 0xb3, 0x01, 0x0a, 0x05, 0x4d, 0x54, 0x79, 0x70, 0x65,
0x12, 0x10, 0x0a, 0x0c, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54,
0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4a, 0x4f, 0x49, 0x4e, 0x5f, 0x41, 0x43, 0x43, 0x45, 0x50,
0x54, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d,
0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15,
0x55, 0x4e, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41,
0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4e, 0x46, 0x49,
0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x55, 0x50, 0x10, 0x04, 0x12, 0x17,
0x0a, 0x13, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41,
0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x45, 0x4a, 0x4f, 0x49,
0x4e, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x06, 0x12, 0x0f, 0x0a, 0x0b, 0x50,
0x52, 0x4f, 0x50, 0x52, 0x49, 0x45, 0x54, 0x41, 0x52, 0x59, 0x10, 0x07, 0x2a, 0x7e, 0x0a, 0x0a,
0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f,
0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x10, 0x00, 0x12, 0x11, 0x0a,
0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10, 0x01,
0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f,
0x30, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31,
0x5f, 0x30, 0x5f, 0x31, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41,
0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x32, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52,
0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x33, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d,
0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x34, 0x10, 0x04, 0x12,
0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x31, 0x5f, 0x30,
0x10, 0x05, 0x2a, 0x65, 0x0a, 0x11, 0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52,
0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x00, 0x12, 0x05,
0x0a, 0x01, 0x42, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31,
0x5f, 0x30, 0x5f, 0x30, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f,
0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32,
0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x32, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30,
0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x33, 0x10, 0x05, 0x2a, 0x8e, 0x01, 0x0a, 0x0e, 0x4c, 0x6f,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x50, 0x53,
0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x02, 0x12, 0x15,
0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x54,
0x44, 0x4f, 0x41, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53,
0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x52, 0x53, 0x53, 0x49, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11,
0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x47, 0x4e, 0x53,
0x53, 0x10, 0x05, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c,
0x56, 0x45, 0x52, 0x5f, 0x57, 0x49, 0x46, 0x49, 0x10, 0x06, 0x42, 0x55, 0x0a, 0x11, 0x69, 0x6f,
0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42,
0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70,
0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b,
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76, 0x34, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x32, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31,
0x5f, 0x30, 0x5f, 0x33, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52, 0x41, 0x57, 0x41,
0x4e, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x34, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x52,
0x41, 0x57, 0x41, 0x4e, 0x5f, 0x31, 0x5f, 0x31, 0x5f, 0x30, 0x10, 0x05, 0x2a, 0x65, 0x0a, 0x11,
0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x01, 0x12,
0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x10, 0x02,
0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x31, 0x10,
0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f, 0x32,
0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x50, 0x30, 0x30, 0x32, 0x5f, 0x31, 0x5f, 0x30, 0x5f,
0x33, 0x10, 0x05, 0x2a, 0x8e, 0x01, 0x0a, 0x0e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57,
0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x50, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06,
0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f,
0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x54, 0x44, 0x4f, 0x41, 0x10, 0x03, 0x12,
0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f,
0x52, 0x53, 0x53, 0x49, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45,
0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x47, 0x4e, 0x53, 0x53, 0x10, 0x05, 0x12, 0x15, 0x0a,
0x11, 0x47, 0x45, 0x4f, 0x5f, 0x52, 0x45, 0x53, 0x4f, 0x4c, 0x56, 0x45, 0x52, 0x5f, 0x57, 0x49,
0x46, 0x49, 0x10, 0x06, 0x2a, 0x2b, 0x0a, 0x0b, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x55, 0x52, 0x10, 0x00, 0x12, 0x07, 0x0a,
0x03, 0x44, 0x41, 0x59, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x4f, 0x4e, 0x54, 0x48, 0x10,
0x02, 0x42, 0x55, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61,
0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x63, 0x68, 0x69,
0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x76,
0x34, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -654,25 +848,31 @@ func file_common_common_proto_rawDescGZIP() []byte {
return file_common_common_proto_rawDescData
}
var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 7)
var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_common_common_proto_goTypes = []interface{}{
(Modulation)(0), // 0: common.Modulation
(Region)(0), // 1: common.Region
(MType)(0), // 2: common.MType
(MacVersion)(0), // 3: common.MacVersion
(RegParamsRevision)(0), // 4: common.RegParamsRevision
(LocationSource)(0), // 5: common.LocationSource
(*Location)(nil), // 6: common.Location
(*KeyEnvelope)(nil), // 7: common.KeyEnvelope
(Modulation)(0), // 0: common.Modulation
(Region)(0), // 1: common.Region
(MType)(0), // 2: common.MType
(MacVersion)(0), // 3: common.MacVersion
(RegParamsRevision)(0), // 4: common.RegParamsRevision
(LocationSource)(0), // 5: common.LocationSource
(Aggregation)(0), // 6: common.Aggregation
(*Location)(nil), // 7: common.Location
(*KeyEnvelope)(nil), // 8: common.KeyEnvelope
(*Metric)(nil), // 9: common.Metric
(*MetricDataset)(nil), // 10: common.MetricDataset
(*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
}
var file_common_common_proto_depIdxs = []int32{
5, // 0: common.Location.source:type_name -> common.LocationSource
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
5, // 0: common.Location.source:type_name -> common.LocationSource
11, // 1: common.Metric.timestamps:type_name -> google.protobuf.Timestamp
10, // 2: common.Metric.datasets:type_name -> common.MetricDataset
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_common_common_proto_init() }
@ -705,14 +905,38 @@ func file_common_common_proto_init() {
return nil
}
}
file_common_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Metric); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MetricDataset); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_common_proto_rawDesc,
NumEnums: 6,
NumMessages: 2,
NumEnums: 7,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -20,6 +20,7 @@ api:
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/tenant.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/application.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/device_profile.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/device_profile_template.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/device.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/gateway.proto
protoc -I=$(GOOGLEAPIS_PATH) -I=../protobuf -I=../proto $(PROTOC_ARGS) ../proto/api/frame_log.proto

View File

@ -107,12 +107,19 @@ export class DeviceServiceClient {
response: api_device_pb.GetRandomDevAddrResponse) => void
): grpcWeb.ClientReadableStream<api_device_pb.GetRandomDevAddrResponse>;
getStats(
request: api_device_pb.GetDeviceStatsRequest,
getMetrics(
request: api_device_pb.GetDeviceMetricsRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: api_device_pb.GetDeviceStatsResponse) => void
): grpcWeb.ClientReadableStream<api_device_pb.GetDeviceStatsResponse>;
response: api_device_pb.GetDeviceMetricsResponse) => void
): grpcWeb.ClientReadableStream<api_device_pb.GetDeviceMetricsResponse>;
getLinkMetrics(
request: api_device_pb.GetDeviceLinkMetricsRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: api_device_pb.GetDeviceLinkMetricsResponse) => void
): grpcWeb.ClientReadableStream<api_device_pb.GetDeviceLinkMetricsResponse>;
enqueue(
request: api_device_pb.EnqueueDeviceQueueItemRequest,
@ -212,10 +219,15 @@ export class DeviceServicePromiseClient {
metadata?: grpcWeb.Metadata
): Promise<api_device_pb.GetRandomDevAddrResponse>;
getStats(
request: api_device_pb.GetDeviceStatsRequest,
getMetrics(
request: api_device_pb.GetDeviceMetricsRequest,
metadata?: grpcWeb.Metadata
): Promise<api_device_pb.GetDeviceStatsResponse>;
): Promise<api_device_pb.GetDeviceMetricsResponse>;
getLinkMetrics(
request: api_device_pb.GetDeviceLinkMetricsRequest,
metadata?: grpcWeb.Metadata
): Promise<api_device_pb.GetDeviceLinkMetricsResponse>;
enqueue(
request: api_device_pb.EnqueueDeviceQueueItemRequest,

View File

@ -16,6 +16,8 @@ const grpc = {};
grpc.web = require('grpc-web');
var common_common_pb = require('../common/common_pb.js')
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js')
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js')
@ -1199,80 +1201,160 @@ proto.api.DeviceServicePromiseClient.prototype.getRandomDevAddr =
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.GetDeviceStatsRequest,
* !proto.api.GetDeviceStatsResponse>}
* !proto.api.GetDeviceMetricsRequest,
* !proto.api.GetDeviceMetricsResponse>}
*/
const methodDescriptor_DeviceService_GetStats = new grpc.web.MethodDescriptor(
'/api.DeviceService/GetStats',
const methodDescriptor_DeviceService_GetMetrics = new grpc.web.MethodDescriptor(
'/api.DeviceService/GetMetrics',
grpc.web.MethodType.UNARY,
proto.api.GetDeviceStatsRequest,
proto.api.GetDeviceStatsResponse,
proto.api.GetDeviceMetricsRequest,
proto.api.GetDeviceMetricsResponse,
/**
* @param {!proto.api.GetDeviceStatsRequest} request
* @param {!proto.api.GetDeviceMetricsRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetDeviceStatsResponse.deserializeBinary
proto.api.GetDeviceMetricsResponse.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.GetDeviceStatsRequest,
* !proto.api.GetDeviceStatsResponse>}
* !proto.api.GetDeviceMetricsRequest,
* !proto.api.GetDeviceMetricsResponse>}
*/
const methodInfo_DeviceService_GetStats = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetDeviceStatsResponse,
const methodInfo_DeviceService_GetMetrics = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetDeviceMetricsResponse,
/**
* @param {!proto.api.GetDeviceStatsRequest} request
* @param {!proto.api.GetDeviceMetricsRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetDeviceStatsResponse.deserializeBinary
proto.api.GetDeviceMetricsResponse.deserializeBinary
);
/**
* @param {!proto.api.GetDeviceStatsRequest} request The
* @param {!proto.api.GetDeviceMetricsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.api.GetDeviceStatsResponse)}
* @param {function(?grpc.web.Error, ?proto.api.GetDeviceMetricsResponse)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.api.GetDeviceStatsResponse>|undefined}
* @return {!grpc.web.ClientReadableStream<!proto.api.GetDeviceMetricsResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceServiceClient.prototype.getStats =
proto.api.DeviceServiceClient.prototype.getMetrics =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceService/GetStats',
'/api.DeviceService/GetMetrics',
request,
metadata || {},
methodDescriptor_DeviceService_GetStats,
methodDescriptor_DeviceService_GetMetrics,
callback);
};
/**
* @param {!proto.api.GetDeviceStatsRequest} request The
* @param {!proto.api.GetDeviceMetricsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.api.GetDeviceStatsResponse>}
* @return {!Promise<!proto.api.GetDeviceMetricsResponse>}
* Promise that resolves to the response
*/
proto.api.DeviceServicePromiseClient.prototype.getStats =
proto.api.DeviceServicePromiseClient.prototype.getMetrics =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceService/GetStats',
'/api.DeviceService/GetMetrics',
request,
metadata || {},
methodDescriptor_DeviceService_GetStats);
methodDescriptor_DeviceService_GetMetrics);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.GetDeviceLinkMetricsRequest,
* !proto.api.GetDeviceLinkMetricsResponse>}
*/
const methodDescriptor_DeviceService_GetLinkMetrics = new grpc.web.MethodDescriptor(
'/api.DeviceService/GetLinkMetrics',
grpc.web.MethodType.UNARY,
proto.api.GetDeviceLinkMetricsRequest,
proto.api.GetDeviceLinkMetricsResponse,
/**
* @param {!proto.api.GetDeviceLinkMetricsRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetDeviceLinkMetricsResponse.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.GetDeviceLinkMetricsRequest,
* !proto.api.GetDeviceLinkMetricsResponse>}
*/
const methodInfo_DeviceService_GetLinkMetrics = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetDeviceLinkMetricsResponse,
/**
* @param {!proto.api.GetDeviceLinkMetricsRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetDeviceLinkMetricsResponse.deserializeBinary
);
/**
* @param {!proto.api.GetDeviceLinkMetricsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.api.GetDeviceLinkMetricsResponse)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.api.GetDeviceLinkMetricsResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceServiceClient.prototype.getLinkMetrics =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceService/GetLinkMetrics',
request,
metadata || {},
methodDescriptor_DeviceService_GetLinkMetrics,
callback);
};
/**
* @param {!proto.api.GetDeviceLinkMetricsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.api.GetDeviceLinkMetricsResponse>}
* Promise that resolves to the response
*/
proto.api.DeviceServicePromiseClient.prototype.getLinkMetrics =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceService/GetLinkMetrics',
request,
metadata || {},
methodDescriptor_DeviceService_GetLinkMetrics);
};

View File

@ -1,5 +1,6 @@
import * as jspb from 'google-protobuf'
import * as common_common_pb from '../common/common_pb';
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
import * as google_protobuf_struct_pb from 'google-protobuf/google/protobuf/struct_pb';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
@ -613,97 +614,165 @@ export namespace GetRandomDevAddrResponse {
}
}
export class GetDeviceStatsRequest extends jspb.Message {
export class GetDeviceMetricsRequest extends jspb.Message {
getDevEui(): string;
setDevEui(value: string): GetDeviceStatsRequest;
setDevEui(value: string): GetDeviceMetricsRequest;
getStart(): google_protobuf_timestamp_pb.Timestamp | undefined;
setStart(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceStatsRequest;
setStart(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceMetricsRequest;
hasStart(): boolean;
clearStart(): GetDeviceStatsRequest;
clearStart(): GetDeviceMetricsRequest;
getEnd(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceStatsRequest;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceMetricsRequest;
hasEnd(): boolean;
clearEnd(): GetDeviceStatsRequest;
clearEnd(): GetDeviceMetricsRequest;
getAggregation(): common_common_pb.Aggregation;
setAggregation(value: common_common_pb.Aggregation): GetDeviceMetricsRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceStatsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceStatsRequest): GetDeviceStatsRequest.AsObject;
static serializeBinaryToWriter(message: GetDeviceStatsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceStatsRequest;
static deserializeBinaryFromReader(message: GetDeviceStatsRequest, reader: jspb.BinaryReader): GetDeviceStatsRequest;
toObject(includeInstance?: boolean): GetDeviceMetricsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceMetricsRequest): GetDeviceMetricsRequest.AsObject;
static serializeBinaryToWriter(message: GetDeviceMetricsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceMetricsRequest;
static deserializeBinaryFromReader(message: GetDeviceMetricsRequest, reader: jspb.BinaryReader): GetDeviceMetricsRequest;
}
export namespace GetDeviceStatsRequest {
export namespace GetDeviceMetricsRequest {
export type AsObject = {
devEui: string,
start?: google_protobuf_timestamp_pb.Timestamp.AsObject,
end?: google_protobuf_timestamp_pb.Timestamp.AsObject,
aggregation: common_common_pb.Aggregation,
}
}
export class GetDeviceStatsResponse extends jspb.Message {
getResultList(): Array<DeviceStats>;
setResultList(value: Array<DeviceStats>): GetDeviceStatsResponse;
clearResultList(): GetDeviceStatsResponse;
addResult(value?: DeviceStats, index?: number): DeviceStats;
export class GetDeviceMetricsResponse extends jspb.Message {
getMetricsMap(): jspb.Map<string, common_common_pb.Metric>;
clearMetricsMap(): GetDeviceMetricsResponse;
getStatesMap(): jspb.Map<string, DeviceState>;
clearStatesMap(): GetDeviceMetricsResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceStatsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceStatsResponse): GetDeviceStatsResponse.AsObject;
static serializeBinaryToWriter(message: GetDeviceStatsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceStatsResponse;
static deserializeBinaryFromReader(message: GetDeviceStatsResponse, reader: jspb.BinaryReader): GetDeviceStatsResponse;
toObject(includeInstance?: boolean): GetDeviceMetricsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceMetricsResponse): GetDeviceMetricsResponse.AsObject;
static serializeBinaryToWriter(message: GetDeviceMetricsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceMetricsResponse;
static deserializeBinaryFromReader(message: GetDeviceMetricsResponse, reader: jspb.BinaryReader): GetDeviceMetricsResponse;
}
export namespace GetDeviceStatsResponse {
export namespace GetDeviceMetricsResponse {
export type AsObject = {
resultList: Array<DeviceStats.AsObject>,
metricsMap: Array<[string, common_common_pb.Metric.AsObject]>,
statesMap: Array<[string, DeviceState.AsObject]>,
}
}
export class DeviceStats extends jspb.Message {
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
setTime(value?: google_protobuf_timestamp_pb.Timestamp): DeviceStats;
hasTime(): boolean;
clearTime(): DeviceStats;
export class DeviceState extends jspb.Message {
getName(): string;
setName(value: string): DeviceState;
getRxPackets(): number;
setRxPackets(value: number): DeviceStats;
getGwRssi(): number;
setGwRssi(value: number): DeviceStats;
getGwSnr(): number;
setGwSnr(value: number): DeviceStats;
getRxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearRxPacketsPerFrequencyMap(): DeviceStats;
getRxPacketsPerDrMap(): jspb.Map<number, number>;
clearRxPacketsPerDrMap(): DeviceStats;
getErrorsMap(): jspb.Map<string, number>;
clearErrorsMap(): DeviceStats;
getValue(): string;
setValue(value: string): DeviceState;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceStats.AsObject;
static toObject(includeInstance: boolean, msg: DeviceStats): DeviceStats.AsObject;
static serializeBinaryToWriter(message: DeviceStats, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceStats;
static deserializeBinaryFromReader(message: DeviceStats, reader: jspb.BinaryReader): DeviceStats;
toObject(includeInstance?: boolean): DeviceState.AsObject;
static toObject(includeInstance: boolean, msg: DeviceState): DeviceState.AsObject;
static serializeBinaryToWriter(message: DeviceState, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceState;
static deserializeBinaryFromReader(message: DeviceState, reader: jspb.BinaryReader): DeviceState;
}
export namespace DeviceStats {
export namespace DeviceState {
export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
rxPackets: number,
gwRssi: number,
gwSnr: number,
rxPacketsPerFrequencyMap: Array<[number, number]>,
rxPacketsPerDrMap: Array<[number, number]>,
errorsMap: Array<[string, number]>,
name: string,
value: string,
}
}
export class GetDeviceLinkMetricsRequest extends jspb.Message {
getDevEui(): string;
setDevEui(value: string): GetDeviceLinkMetricsRequest;
getStart(): google_protobuf_timestamp_pb.Timestamp | undefined;
setStart(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceLinkMetricsRequest;
hasStart(): boolean;
clearStart(): GetDeviceLinkMetricsRequest;
getEnd(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceLinkMetricsRequest;
hasEnd(): boolean;
clearEnd(): GetDeviceLinkMetricsRequest;
getAggregation(): common_common_pb.Aggregation;
setAggregation(value: common_common_pb.Aggregation): GetDeviceLinkMetricsRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceLinkMetricsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceLinkMetricsRequest): GetDeviceLinkMetricsRequest.AsObject;
static serializeBinaryToWriter(message: GetDeviceLinkMetricsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceLinkMetricsRequest;
static deserializeBinaryFromReader(message: GetDeviceLinkMetricsRequest, reader: jspb.BinaryReader): GetDeviceLinkMetricsRequest;
}
export namespace GetDeviceLinkMetricsRequest {
export type AsObject = {
devEui: string,
start?: google_protobuf_timestamp_pb.Timestamp.AsObject,
end?: google_protobuf_timestamp_pb.Timestamp.AsObject,
aggregation: common_common_pb.Aggregation,
}
}
export class GetDeviceLinkMetricsResponse extends jspb.Message {
getRxPackets(): common_common_pb.Metric | undefined;
setRxPackets(value?: common_common_pb.Metric): GetDeviceLinkMetricsResponse;
hasRxPackets(): boolean;
clearRxPackets(): GetDeviceLinkMetricsResponse;
getGwRssi(): common_common_pb.Metric | undefined;
setGwRssi(value?: common_common_pb.Metric): GetDeviceLinkMetricsResponse;
hasGwRssi(): boolean;
clearGwRssi(): GetDeviceLinkMetricsResponse;
getGwSnr(): common_common_pb.Metric | undefined;
setGwSnr(value?: common_common_pb.Metric): GetDeviceLinkMetricsResponse;
hasGwSnr(): boolean;
clearGwSnr(): GetDeviceLinkMetricsResponse;
getRxPacketsPerFreq(): common_common_pb.Metric | undefined;
setRxPacketsPerFreq(value?: common_common_pb.Metric): GetDeviceLinkMetricsResponse;
hasRxPacketsPerFreq(): boolean;
clearRxPacketsPerFreq(): GetDeviceLinkMetricsResponse;
getRxPacketsPerDr(): common_common_pb.Metric | undefined;
setRxPacketsPerDr(value?: common_common_pb.Metric): GetDeviceLinkMetricsResponse;
hasRxPacketsPerDr(): boolean;
clearRxPacketsPerDr(): GetDeviceLinkMetricsResponse;
getErrors(): common_common_pb.Metric | undefined;
setErrors(value?: common_common_pb.Metric): GetDeviceLinkMetricsResponse;
hasErrors(): boolean;
clearErrors(): GetDeviceLinkMetricsResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceLinkMetricsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceLinkMetricsResponse): GetDeviceLinkMetricsResponse.AsObject;
static serializeBinaryToWriter(message: GetDeviceLinkMetricsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceLinkMetricsResponse;
static deserializeBinaryFromReader(message: GetDeviceLinkMetricsResponse, reader: jspb.BinaryReader): GetDeviceLinkMetricsResponse;
}
export namespace GetDeviceLinkMetricsResponse {
export type AsObject = {
rxPackets?: common_common_pb.Metric.AsObject,
gwRssi?: common_common_pb.Metric.AsObject,
gwSnr?: common_common_pb.Metric.AsObject,
rxPacketsPerFreq?: common_common_pb.Metric.AsObject,
rxPacketsPerDr?: common_common_pb.Metric.AsObject,
errors?: common_common_pb.Metric.AsObject,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,9 @@ export class DeviceProfile extends jspb.Message {
getName(): string;
setName(value: string): DeviceProfile;
getDescription(): string;
setDescription(value: string): DeviceProfile;
getRegion(): common_common_pb.Region;
setRegion(value: common_common_pb.Region): DeviceProfile;
@ -81,6 +84,9 @@ export class DeviceProfile extends jspb.Message {
getTagsMap(): jspb.Map<string, string>;
clearTagsMap(): DeviceProfile;
getMeasurementsMap(): jspb.Map<string, Measurement>;
clearMeasurementsMap(): DeviceProfile;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceProfile.AsObject;
static toObject(includeInstance: boolean, msg: DeviceProfile): DeviceProfile.AsObject;
@ -94,6 +100,7 @@ export namespace DeviceProfile {
id: string,
tenantId: string,
name: string,
description: string,
region: common_common_pb.Region,
macVersion: common_common_pb.MacVersion,
regParamsRevision: common_common_pb.RegParamsRevision,
@ -116,6 +123,29 @@ export namespace DeviceProfile {
abpRx2Dr: number,
abpRx2Freq: number,
tagsMap: Array<[string, string]>,
measurementsMap: Array<[string, Measurement.AsObject]>,
}
}
export class Measurement extends jspb.Message {
getName(): string;
setName(value: string): Measurement;
getKind(): MeasurementKind;
setKind(value: MeasurementKind): Measurement;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Measurement.AsObject;
static toObject(includeInstance: boolean, msg: Measurement): Measurement.AsObject;
static serializeBinaryToWriter(message: Measurement, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Measurement;
static deserializeBinaryFromReader(message: Measurement, reader: jspb.BinaryReader): Measurement;
}
export namespace Measurement {
export type AsObject = {
name: string,
kind: MeasurementKind,
}
}
@ -408,3 +438,10 @@ export enum CodecRuntime {
CAYENNE_LPP = 1,
JS = 2,
}
export enum MeasurementKind {
UNKNOWN = 0,
COUNTER = 1,
ABSOLUTE = 2,
GAUGE = 3,
STRING = 4,
}

View File

@ -33,6 +33,8 @@ goog.exportSymbol('proto.api.GetDeviceProfileResponse', null, global);
goog.exportSymbol('proto.api.ListDeviceProfileAdrAlgorithmsResponse', null, global);
goog.exportSymbol('proto.api.ListDeviceProfilesRequest', null, global);
goog.exportSymbol('proto.api.ListDeviceProfilesResponse', null, global);
goog.exportSymbol('proto.api.Measurement', null, global);
goog.exportSymbol('proto.api.MeasurementKind', null, global);
goog.exportSymbol('proto.api.UpdateDeviceProfileRequest', null, global);
/**
* Generated by JsPbCodeGenerator.
@ -55,6 +57,27 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.api.DeviceProfile.displayName = 'proto.api.DeviceProfile';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.api.Measurement = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.Measurement, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.api.Measurement.displayName = 'proto.api.Measurement';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
@ -321,6 +344,7 @@ proto.api.DeviceProfile.toObject = function(includeInstance, msg) {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
tenantId: jspb.Message.getFieldWithDefault(msg, 2, ""),
name: jspb.Message.getFieldWithDefault(msg, 3, ""),
description: jspb.Message.getFieldWithDefault(msg, 26, ""),
region: jspb.Message.getFieldWithDefault(msg, 4, 0),
macVersion: jspb.Message.getFieldWithDefault(msg, 5, 0),
regParamsRevision: jspb.Message.getFieldWithDefault(msg, 6, 0),
@ -342,7 +366,8 @@ proto.api.DeviceProfile.toObject = function(includeInstance, msg) {
abpRx1DrOffset: jspb.Message.getFieldWithDefault(msg, 22, 0),
abpRx2Dr: jspb.Message.getFieldWithDefault(msg, 23, 0),
abpRx2Freq: jspb.Message.getFieldWithDefault(msg, 24, 0),
tagsMap: (f = msg.getTagsMap()) ? f.toObject(includeInstance, undefined) : []
tagsMap: (f = msg.getTagsMap()) ? f.toObject(includeInstance, undefined) : [],
measurementsMap: (f = msg.getMeasurementsMap()) ? f.toObject(includeInstance, proto.api.Measurement.toObject) : []
};
if (includeInstance) {
@ -391,6 +416,10 @@ proto.api.DeviceProfile.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 26:
var value = /** @type {string} */ (reader.readString());
msg.setDescription(value);
break;
case 4:
var value = /** @type {!proto.common.Region} */ (reader.readEnum());
msg.setRegion(value);
@ -481,6 +510,12 @@ proto.api.DeviceProfile.deserializeBinaryFromReader = function(msg, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
});
break;
case 27:
var value = msg.getMeasurementsMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.api.Measurement.deserializeBinaryFromReader, "", new proto.api.Measurement());
});
break;
default:
reader.skipField();
break;
@ -531,6 +566,13 @@ proto.api.DeviceProfile.serializeBinaryToWriter = function(message, writer) {
f
);
}
f = message.getDescription();
if (f.length > 0) {
writer.writeString(
26,
f
);
}
f = message.getRegion();
if (f !== 0.0) {
writer.writeEnum(
@ -682,6 +724,10 @@ proto.api.DeviceProfile.serializeBinaryToWriter = function(message, writer) {
if (f && f.getLength() > 0) {
f.serializeBinary(25, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
}
f = message.getMeasurementsMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(27, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.api.Measurement.serializeBinaryToWriter);
}
};
@ -739,6 +785,24 @@ proto.api.DeviceProfile.prototype.setName = function(value) {
};
/**
* optional string description = 26;
* @return {string}
*/
proto.api.DeviceProfile.prototype.getDescription = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 26, ""));
};
/**
* @param {string} value
* @return {!proto.api.DeviceProfile} returns this
*/
proto.api.DeviceProfile.prototype.setDescription = function(value) {
return jspb.Message.setProto3StringField(this, 26, value);
};
/**
* optional common.Region region = 4;
* @return {!proto.common.Region}
@ -1139,6 +1203,188 @@ proto.api.DeviceProfile.prototype.clearTagsMap = function() {
return this;};
/**
* map<string, Measurement> measurements = 27;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<string,!proto.api.Measurement>}
*/
proto.api.DeviceProfile.prototype.getMeasurementsMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<string,!proto.api.Measurement>} */ (
jspb.Message.getMapField(this, 27, opt_noLazyCreate,
proto.api.Measurement));
};
/**
* Clears values from the map. The map will be non-null.
* @return {!proto.api.DeviceProfile} returns this
*/
proto.api.DeviceProfile.prototype.clearMeasurementsMap = function() {
this.getMeasurementsMap().clear();
return this;};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.Measurement.prototype.toObject = function(opt_includeInstance) {
return proto.api.Measurement.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.Measurement} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.api.Measurement.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 2, ""),
kind: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.Measurement}
*/
proto.api.Measurement.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.Measurement;
return proto.api.Measurement.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.Measurement} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.Measurement}
*/
proto.api.Measurement.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 3:
var value = /** @type {!proto.api.MeasurementKind} */ (reader.readEnum());
msg.setKind(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.Measurement.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.api.Measurement.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.api.Measurement} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.api.Measurement.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getKind();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};
/**
* optional string name = 2;
* @return {string}
*/
proto.api.Measurement.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.api.Measurement} returns this
*/
proto.api.Measurement.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional MeasurementKind kind = 3;
* @return {!proto.api.MeasurementKind}
*/
proto.api.Measurement.prototype.getKind = function() {
return /** @type {!proto.api.MeasurementKind} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {!proto.api.MeasurementKind} value
* @return {!proto.api.Measurement} returns this
*/
proto.api.Measurement.prototype.setKind = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};
@ -3295,4 +3541,15 @@ proto.api.CodecRuntime = {
JS: 2
};
/**
* @enum {number}
*/
proto.api.MeasurementKind = {
UNKNOWN: 0,
COUNTER: 1,
ABSOLUTE: 2,
GAUGE: 3,
STRING: 4
};
goog.object.extend(exports, proto.api);

View File

@ -0,0 +1,80 @@
import * as grpcWeb from 'grpc-web';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
import * as api_device_profile_template_pb from '../api/device_profile_template_pb';
export class DeviceProfileTemplateServiceClient {
constructor (hostname: string,
credentials?: null | { [index: string]: string; },
options?: null | { [index: string]: any; });
create(
request: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
get(
request: api_device_profile_template_pb.GetDeviceProfileTemplateRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: api_device_profile_template_pb.GetDeviceProfileTemplateResponse) => void
): grpcWeb.ClientReadableStream<api_device_profile_template_pb.GetDeviceProfileTemplateResponse>;
update(
request: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
delete(
request: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: google_protobuf_empty_pb.Empty) => void
): grpcWeb.ClientReadableStream<google_protobuf_empty_pb.Empty>;
list(
request: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: api_device_profile_template_pb.ListDeviceProfileTemplatesResponse) => void
): grpcWeb.ClientReadableStream<api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>;
}
export class DeviceProfileTemplateServicePromiseClient {
constructor (hostname: string,
credentials?: null | { [index: string]: string; },
options?: null | { [index: string]: any; });
create(
request: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest,
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
get(
request: api_device_profile_template_pb.GetDeviceProfileTemplateRequest,
metadata?: grpcWeb.Metadata
): Promise<api_device_profile_template_pb.GetDeviceProfileTemplateResponse>;
update(
request: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest,
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
delete(
request: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest,
metadata?: grpcWeb.Metadata
): Promise<google_protobuf_empty_pb.Empty>;
list(
request: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest,
metadata?: grpcWeb.Metadata
): Promise<api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>;
}

View File

@ -0,0 +1,482 @@
/**
* @fileoverview gRPC-Web generated client stub for api
* @enhanceable
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
const grpc = {};
grpc.web = require('grpc-web');
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js')
var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js')
var common_common_pb = require('../common/common_pb.js')
var api_device_profile_pb = require('../api/device_profile_pb.js')
const proto = {};
proto.api = require('./device_profile_template_pb.js');
/**
* @param {string} hostname
* @param {?Object} credentials
* @param {?Object} options
* @constructor
* @struct
* @final
*/
proto.api.DeviceProfileTemplateServiceClient =
function(hostname, credentials, options) {
if (!options) options = {};
options['format'] = 'text';
/**
* @private @const {!grpc.web.GrpcWebClientBase} The client
*/
this.client_ = new grpc.web.GrpcWebClientBase(options);
/**
* @private @const {string} The hostname
*/
this.hostname_ = hostname;
};
/**
* @param {string} hostname
* @param {?Object} credentials
* @param {?Object} options
* @constructor
* @struct
* @final
*/
proto.api.DeviceProfileTemplateServicePromiseClient =
function(hostname, credentials, options) {
if (!options) options = {};
options['format'] = 'text';
/**
* @private @const {!grpc.web.GrpcWebClientBase} The client
*/
this.client_ = new grpc.web.GrpcWebClientBase(options);
/**
* @private @const {string} The hostname
*/
this.hostname_ = hostname;
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.CreateDeviceProfileTemplateRequest,
* !proto.google.protobuf.Empty>}
*/
const methodDescriptor_DeviceProfileTemplateService_Create = new grpc.web.MethodDescriptor(
'/api.DeviceProfileTemplateService/Create',
grpc.web.MethodType.UNARY,
proto.api.CreateDeviceProfileTemplateRequest,
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.CreateDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.CreateDeviceProfileTemplateRequest,
* !proto.google.protobuf.Empty>}
*/
const methodInfo_DeviceProfileTemplateService_Create = new grpc.web.AbstractClientBase.MethodInfo(
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.CreateDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @param {!proto.api.CreateDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.google.protobuf.Empty>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceProfileTemplateServiceClient.prototype.create =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Create',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Create,
callback);
};
/**
* @param {!proto.api.CreateDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.google.protobuf.Empty>}
* Promise that resolves to the response
*/
proto.api.DeviceProfileTemplateServicePromiseClient.prototype.create =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Create',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Create);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.GetDeviceProfileTemplateRequest,
* !proto.api.GetDeviceProfileTemplateResponse>}
*/
const methodDescriptor_DeviceProfileTemplateService_Get = new grpc.web.MethodDescriptor(
'/api.DeviceProfileTemplateService/Get',
grpc.web.MethodType.UNARY,
proto.api.GetDeviceProfileTemplateRequest,
proto.api.GetDeviceProfileTemplateResponse,
/**
* @param {!proto.api.GetDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetDeviceProfileTemplateResponse.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.GetDeviceProfileTemplateRequest,
* !proto.api.GetDeviceProfileTemplateResponse>}
*/
const methodInfo_DeviceProfileTemplateService_Get = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetDeviceProfileTemplateResponse,
/**
* @param {!proto.api.GetDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetDeviceProfileTemplateResponse.deserializeBinary
);
/**
* @param {!proto.api.GetDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.api.GetDeviceProfileTemplateResponse)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.api.GetDeviceProfileTemplateResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceProfileTemplateServiceClient.prototype.get =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Get',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Get,
callback);
};
/**
* @param {!proto.api.GetDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.api.GetDeviceProfileTemplateResponse>}
* Promise that resolves to the response
*/
proto.api.DeviceProfileTemplateServicePromiseClient.prototype.get =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Get',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Get);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.UpdateDeviceProfileTemplateRequest,
* !proto.google.protobuf.Empty>}
*/
const methodDescriptor_DeviceProfileTemplateService_Update = new grpc.web.MethodDescriptor(
'/api.DeviceProfileTemplateService/Update',
grpc.web.MethodType.UNARY,
proto.api.UpdateDeviceProfileTemplateRequest,
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.UpdateDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.UpdateDeviceProfileTemplateRequest,
* !proto.google.protobuf.Empty>}
*/
const methodInfo_DeviceProfileTemplateService_Update = new grpc.web.AbstractClientBase.MethodInfo(
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.UpdateDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @param {!proto.api.UpdateDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.google.protobuf.Empty>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceProfileTemplateServiceClient.prototype.update =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Update',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Update,
callback);
};
/**
* @param {!proto.api.UpdateDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.google.protobuf.Empty>}
* Promise that resolves to the response
*/
proto.api.DeviceProfileTemplateServicePromiseClient.prototype.update =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Update',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Update);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.DeleteDeviceProfileTemplateRequest,
* !proto.google.protobuf.Empty>}
*/
const methodDescriptor_DeviceProfileTemplateService_Delete = new grpc.web.MethodDescriptor(
'/api.DeviceProfileTemplateService/Delete',
grpc.web.MethodType.UNARY,
proto.api.DeleteDeviceProfileTemplateRequest,
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.DeleteDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.DeleteDeviceProfileTemplateRequest,
* !proto.google.protobuf.Empty>}
*/
const methodInfo_DeviceProfileTemplateService_Delete = new grpc.web.AbstractClientBase.MethodInfo(
google_protobuf_empty_pb.Empty,
/**
* @param {!proto.api.DeleteDeviceProfileTemplateRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
google_protobuf_empty_pb.Empty.deserializeBinary
);
/**
* @param {!proto.api.DeleteDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.google.protobuf.Empty>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceProfileTemplateServiceClient.prototype.delete =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Delete',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Delete,
callback);
};
/**
* @param {!proto.api.DeleteDeviceProfileTemplateRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.google.protobuf.Empty>}
* Promise that resolves to the response
*/
proto.api.DeviceProfileTemplateServicePromiseClient.prototype.delete =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceProfileTemplateService/Delete',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_Delete);
};
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.ListDeviceProfileTemplatesRequest,
* !proto.api.ListDeviceProfileTemplatesResponse>}
*/
const methodDescriptor_DeviceProfileTemplateService_List = new grpc.web.MethodDescriptor(
'/api.DeviceProfileTemplateService/List',
grpc.web.MethodType.UNARY,
proto.api.ListDeviceProfileTemplatesRequest,
proto.api.ListDeviceProfileTemplatesResponse,
/**
* @param {!proto.api.ListDeviceProfileTemplatesRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.ListDeviceProfileTemplatesResponse.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.ListDeviceProfileTemplatesRequest,
* !proto.api.ListDeviceProfileTemplatesResponse>}
*/
const methodInfo_DeviceProfileTemplateService_List = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.ListDeviceProfileTemplatesResponse,
/**
* @param {!proto.api.ListDeviceProfileTemplatesRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.ListDeviceProfileTemplatesResponse.deserializeBinary
);
/**
* @param {!proto.api.ListDeviceProfileTemplatesRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.api.ListDeviceProfileTemplatesResponse)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.api.ListDeviceProfileTemplatesResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.api.DeviceProfileTemplateServiceClient.prototype.list =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.DeviceProfileTemplateService/List',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_List,
callback);
};
/**
* @param {!proto.api.ListDeviceProfileTemplatesRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.api.ListDeviceProfileTemplatesResponse>}
* Promise that resolves to the response
*/
proto.api.DeviceProfileTemplateServicePromiseClient.prototype.list =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.DeviceProfileTemplateService/List',
request,
metadata || {},
methodDescriptor_DeviceProfileTemplateService_List);
};
module.exports = proto.api;

View File

@ -0,0 +1,354 @@
import * as jspb from 'google-protobuf'
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
import * as google_protobuf_empty_pb from 'google-protobuf/google/protobuf/empty_pb';
import * as common_common_pb from '../common/common_pb';
import * as api_device_profile_pb from '../api/device_profile_pb';
export class DeviceProfileTemplate extends jspb.Message {
getId(): string;
setId(value: string): DeviceProfileTemplate;
getName(): string;
setName(value: string): DeviceProfileTemplate;
getDescription(): string;
setDescription(value: string): DeviceProfileTemplate;
getVendor(): string;
setVendor(value: string): DeviceProfileTemplate;
getFirmware(): string;
setFirmware(value: string): DeviceProfileTemplate;
getRegion(): common_common_pb.Region;
setRegion(value: common_common_pb.Region): DeviceProfileTemplate;
getMacVersion(): common_common_pb.MacVersion;
setMacVersion(value: common_common_pb.MacVersion): DeviceProfileTemplate;
getRegParamsRevision(): common_common_pb.RegParamsRevision;
setRegParamsRevision(value: common_common_pb.RegParamsRevision): DeviceProfileTemplate;
getAdrAlgorithmId(): string;
setAdrAlgorithmId(value: string): DeviceProfileTemplate;
getPayloadCodecRuntime(): api_device_profile_pb.CodecRuntime;
setPayloadCodecRuntime(value: api_device_profile_pb.CodecRuntime): DeviceProfileTemplate;
getPayloadCodecScript(): string;
setPayloadCodecScript(value: string): DeviceProfileTemplate;
getFlushQueueOnActivate(): boolean;
setFlushQueueOnActivate(value: boolean): DeviceProfileTemplate;
getUplinkInterval(): number;
setUplinkInterval(value: number): DeviceProfileTemplate;
getDeviceStatusReqInterval(): number;
setDeviceStatusReqInterval(value: number): DeviceProfileTemplate;
getSupportsOtaa(): boolean;
setSupportsOtaa(value: boolean): DeviceProfileTemplate;
getSupportsClassB(): boolean;
setSupportsClassB(value: boolean): DeviceProfileTemplate;
getSupportsClassC(): boolean;
setSupportsClassC(value: boolean): DeviceProfileTemplate;
getClassBTimeout(): number;
setClassBTimeout(value: number): DeviceProfileTemplate;
getClassBPingSlotPeriod(): number;
setClassBPingSlotPeriod(value: number): DeviceProfileTemplate;
getClassBPingSlotDr(): number;
setClassBPingSlotDr(value: number): DeviceProfileTemplate;
getClassBPingSlotFreq(): number;
setClassBPingSlotFreq(value: number): DeviceProfileTemplate;
getClassCTimeout(): number;
setClassCTimeout(value: number): DeviceProfileTemplate;
getAbpRx1Delay(): number;
setAbpRx1Delay(value: number): DeviceProfileTemplate;
getAbpRx1DrOffset(): number;
setAbpRx1DrOffset(value: number): DeviceProfileTemplate;
getAbpRx2Dr(): number;
setAbpRx2Dr(value: number): DeviceProfileTemplate;
getAbpRx2Freq(): number;
setAbpRx2Freq(value: number): DeviceProfileTemplate;
getTagsMap(): jspb.Map<string, string>;
clearTagsMap(): DeviceProfileTemplate;
getMeasurementsMap(): jspb.Map<string, api_device_profile_pb.Measurement>;
clearMeasurementsMap(): DeviceProfileTemplate;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceProfileTemplate.AsObject;
static toObject(includeInstance: boolean, msg: DeviceProfileTemplate): DeviceProfileTemplate.AsObject;
static serializeBinaryToWriter(message: DeviceProfileTemplate, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceProfileTemplate;
static deserializeBinaryFromReader(message: DeviceProfileTemplate, reader: jspb.BinaryReader): DeviceProfileTemplate;
}
export namespace DeviceProfileTemplate {
export type AsObject = {
id: string,
name: string,
description: string,
vendor: string,
firmware: string,
region: common_common_pb.Region,
macVersion: common_common_pb.MacVersion,
regParamsRevision: common_common_pb.RegParamsRevision,
adrAlgorithmId: string,
payloadCodecRuntime: api_device_profile_pb.CodecRuntime,
payloadCodecScript: string,
flushQueueOnActivate: boolean,
uplinkInterval: number,
deviceStatusReqInterval: number,
supportsOtaa: boolean,
supportsClassB: boolean,
supportsClassC: boolean,
classBTimeout: number,
classBPingSlotPeriod: number,
classBPingSlotDr: number,
classBPingSlotFreq: number,
classCTimeout: number,
abpRx1Delay: number,
abpRx1DrOffset: number,
abpRx2Dr: number,
abpRx2Freq: number,
tagsMap: Array<[string, string]>,
measurementsMap: Array<[string, api_device_profile_pb.Measurement.AsObject]>,
}
}
export class DeviceProfileTemplateListItem extends jspb.Message {
getId(): string;
setId(value: string): DeviceProfileTemplateListItem;
getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): DeviceProfileTemplateListItem;
hasCreatedAt(): boolean;
clearCreatedAt(): DeviceProfileTemplateListItem;
getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): DeviceProfileTemplateListItem;
hasUpdatedAt(): boolean;
clearUpdatedAt(): DeviceProfileTemplateListItem;
getName(): string;
setName(value: string): DeviceProfileTemplateListItem;
getVendor(): string;
setVendor(value: string): DeviceProfileTemplateListItem;
getFirmware(): string;
setFirmware(value: string): DeviceProfileTemplateListItem;
getRegion(): common_common_pb.Region;
setRegion(value: common_common_pb.Region): DeviceProfileTemplateListItem;
getMacVersion(): common_common_pb.MacVersion;
setMacVersion(value: common_common_pb.MacVersion): DeviceProfileTemplateListItem;
getRegParamsRevision(): common_common_pb.RegParamsRevision;
setRegParamsRevision(value: common_common_pb.RegParamsRevision): DeviceProfileTemplateListItem;
getSupportsOtaa(): boolean;
setSupportsOtaa(value: boolean): DeviceProfileTemplateListItem;
getSupportsClassB(): boolean;
setSupportsClassB(value: boolean): DeviceProfileTemplateListItem;
getSupportsClassC(): boolean;
setSupportsClassC(value: boolean): DeviceProfileTemplateListItem;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceProfileTemplateListItem.AsObject;
static toObject(includeInstance: boolean, msg: DeviceProfileTemplateListItem): DeviceProfileTemplateListItem.AsObject;
static serializeBinaryToWriter(message: DeviceProfileTemplateListItem, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceProfileTemplateListItem;
static deserializeBinaryFromReader(message: DeviceProfileTemplateListItem, reader: jspb.BinaryReader): DeviceProfileTemplateListItem;
}
export namespace DeviceProfileTemplateListItem {
export type AsObject = {
id: string,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
name: string,
vendor: string,
firmware: string,
region: common_common_pb.Region,
macVersion: common_common_pb.MacVersion,
regParamsRevision: common_common_pb.RegParamsRevision,
supportsOtaa: boolean,
supportsClassB: boolean,
supportsClassC: boolean,
}
}
export class CreateDeviceProfileTemplateRequest extends jspb.Message {
getDeviceProfileTemplate(): DeviceProfileTemplate | undefined;
setDeviceProfileTemplate(value?: DeviceProfileTemplate): CreateDeviceProfileTemplateRequest;
hasDeviceProfileTemplate(): boolean;
clearDeviceProfileTemplate(): CreateDeviceProfileTemplateRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateDeviceProfileTemplateRequest): CreateDeviceProfileTemplateRequest.AsObject;
static serializeBinaryToWriter(message: CreateDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: CreateDeviceProfileTemplateRequest, reader: jspb.BinaryReader): CreateDeviceProfileTemplateRequest;
}
export namespace CreateDeviceProfileTemplateRequest {
export type AsObject = {
deviceProfileTemplate?: DeviceProfileTemplate.AsObject,
}
}
export class GetDeviceProfileTemplateRequest extends jspb.Message {
getId(): string;
setId(value: string): GetDeviceProfileTemplateRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceProfileTemplateRequest): GetDeviceProfileTemplateRequest.AsObject;
static serializeBinaryToWriter(message: GetDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: GetDeviceProfileTemplateRequest, reader: jspb.BinaryReader): GetDeviceProfileTemplateRequest;
}
export namespace GetDeviceProfileTemplateRequest {
export type AsObject = {
id: string,
}
}
export class GetDeviceProfileTemplateResponse extends jspb.Message {
getDeviceProfileTemplate(): DeviceProfileTemplate | undefined;
setDeviceProfileTemplate(value?: DeviceProfileTemplate): GetDeviceProfileTemplateResponse;
hasDeviceProfileTemplate(): boolean;
clearDeviceProfileTemplate(): GetDeviceProfileTemplateResponse;
getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceProfileTemplateResponse;
hasCreatedAt(): boolean;
clearCreatedAt(): GetDeviceProfileTemplateResponse;
getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): GetDeviceProfileTemplateResponse;
hasUpdatedAt(): boolean;
clearUpdatedAt(): GetDeviceProfileTemplateResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceProfileTemplateResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceProfileTemplateResponse): GetDeviceProfileTemplateResponse.AsObject;
static serializeBinaryToWriter(message: GetDeviceProfileTemplateResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceProfileTemplateResponse;
static deserializeBinaryFromReader(message: GetDeviceProfileTemplateResponse, reader: jspb.BinaryReader): GetDeviceProfileTemplateResponse;
}
export namespace GetDeviceProfileTemplateResponse {
export type AsObject = {
deviceProfileTemplate?: DeviceProfileTemplate.AsObject,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
export class UpdateDeviceProfileTemplateRequest extends jspb.Message {
getDeviceProfileTemplate(): DeviceProfileTemplate | undefined;
setDeviceProfileTemplate(value?: DeviceProfileTemplate): UpdateDeviceProfileTemplateRequest;
hasDeviceProfileTemplate(): boolean;
clearDeviceProfileTemplate(): UpdateDeviceProfileTemplateRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: UpdateDeviceProfileTemplateRequest): UpdateDeviceProfileTemplateRequest.AsObject;
static serializeBinaryToWriter(message: UpdateDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: UpdateDeviceProfileTemplateRequest, reader: jspb.BinaryReader): UpdateDeviceProfileTemplateRequest;
}
export namespace UpdateDeviceProfileTemplateRequest {
export type AsObject = {
deviceProfileTemplate?: DeviceProfileTemplate.AsObject,
}
}
export class DeleteDeviceProfileTemplateRequest extends jspb.Message {
getId(): string;
setId(value: string): DeleteDeviceProfileTemplateRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeleteDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: DeleteDeviceProfileTemplateRequest): DeleteDeviceProfileTemplateRequest.AsObject;
static serializeBinaryToWriter(message: DeleteDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeleteDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: DeleteDeviceProfileTemplateRequest, reader: jspb.BinaryReader): DeleteDeviceProfileTemplateRequest;
}
export namespace DeleteDeviceProfileTemplateRequest {
export type AsObject = {
id: string,
}
}
export class ListDeviceProfileTemplatesRequest extends jspb.Message {
getLimit(): number;
setLimit(value: number): ListDeviceProfileTemplatesRequest;
getOffset(): number;
setOffset(value: number): ListDeviceProfileTemplatesRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListDeviceProfileTemplatesRequest.AsObject;
static toObject(includeInstance: boolean, msg: ListDeviceProfileTemplatesRequest): ListDeviceProfileTemplatesRequest.AsObject;
static serializeBinaryToWriter(message: ListDeviceProfileTemplatesRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListDeviceProfileTemplatesRequest;
static deserializeBinaryFromReader(message: ListDeviceProfileTemplatesRequest, reader: jspb.BinaryReader): ListDeviceProfileTemplatesRequest;
}
export namespace ListDeviceProfileTemplatesRequest {
export type AsObject = {
limit: number,
offset: number,
}
}
export class ListDeviceProfileTemplatesResponse extends jspb.Message {
getTotalCount(): number;
setTotalCount(value: number): ListDeviceProfileTemplatesResponse;
getResultList(): Array<DeviceProfileTemplateListItem>;
setResultList(value: Array<DeviceProfileTemplateListItem>): ListDeviceProfileTemplatesResponse;
clearResultList(): ListDeviceProfileTemplatesResponse;
addResult(value?: DeviceProfileTemplateListItem, index?: number): DeviceProfileTemplateListItem;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListDeviceProfileTemplatesResponse.AsObject;
static toObject(includeInstance: boolean, msg: ListDeviceProfileTemplatesResponse): ListDeviceProfileTemplatesResponse.AsObject;
static serializeBinaryToWriter(message: ListDeviceProfileTemplatesResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListDeviceProfileTemplatesResponse;
static deserializeBinaryFromReader(message: ListDeviceProfileTemplatesResponse, reader: jspb.BinaryReader): ListDeviceProfileTemplatesResponse;
}
export namespace ListDeviceProfileTemplatesResponse {
export type AsObject = {
totalCount: number,
resultList: Array<DeviceProfileTemplateListItem.AsObject>,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -51,12 +51,12 @@ export class GatewayServiceClient {
response: api_gateway_pb.GenerateGatewayClientCertificateResponse) => void
): grpcWeb.ClientReadableStream<api_gateway_pb.GenerateGatewayClientCertificateResponse>;
getStats(
request: api_gateway_pb.GetGatewayStatsRequest,
getMetrics(
request: api_gateway_pb.GetGatewayMetricsRequest,
metadata: grpcWeb.Metadata | undefined,
callback: (err: grpcWeb.Error,
response: api_gateway_pb.GetGatewayStatsResponse) => void
): grpcWeb.ClientReadableStream<api_gateway_pb.GetGatewayStatsResponse>;
response: api_gateway_pb.GetGatewayMetricsResponse) => void
): grpcWeb.ClientReadableStream<api_gateway_pb.GetGatewayMetricsResponse>;
}
@ -95,10 +95,10 @@ export class GatewayServicePromiseClient {
metadata?: grpcWeb.Metadata
): Promise<api_gateway_pb.GenerateGatewayClientCertificateResponse>;
getStats(
request: api_gateway_pb.GetGatewayStatsRequest,
getMetrics(
request: api_gateway_pb.GetGatewayMetricsRequest,
metadata?: grpcWeb.Metadata
): Promise<api_gateway_pb.GetGatewayStatsResponse>;
): Promise<api_gateway_pb.GetGatewayMetricsResponse>;
}

View File

@ -559,80 +559,80 @@ proto.api.GatewayServicePromiseClient.prototype.generateClientCertificate =
/**
* @const
* @type {!grpc.web.MethodDescriptor<
* !proto.api.GetGatewayStatsRequest,
* !proto.api.GetGatewayStatsResponse>}
* !proto.api.GetGatewayMetricsRequest,
* !proto.api.GetGatewayMetricsResponse>}
*/
const methodDescriptor_GatewayService_GetStats = new grpc.web.MethodDescriptor(
'/api.GatewayService/GetStats',
const methodDescriptor_GatewayService_GetMetrics = new grpc.web.MethodDescriptor(
'/api.GatewayService/GetMetrics',
grpc.web.MethodType.UNARY,
proto.api.GetGatewayStatsRequest,
proto.api.GetGatewayStatsResponse,
proto.api.GetGatewayMetricsRequest,
proto.api.GetGatewayMetricsResponse,
/**
* @param {!proto.api.GetGatewayStatsRequest} request
* @param {!proto.api.GetGatewayMetricsRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetGatewayStatsResponse.deserializeBinary
proto.api.GetGatewayMetricsResponse.deserializeBinary
);
/**
* @const
* @type {!grpc.web.AbstractClientBase.MethodInfo<
* !proto.api.GetGatewayStatsRequest,
* !proto.api.GetGatewayStatsResponse>}
* !proto.api.GetGatewayMetricsRequest,
* !proto.api.GetGatewayMetricsResponse>}
*/
const methodInfo_GatewayService_GetStats = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetGatewayStatsResponse,
const methodInfo_GatewayService_GetMetrics = new grpc.web.AbstractClientBase.MethodInfo(
proto.api.GetGatewayMetricsResponse,
/**
* @param {!proto.api.GetGatewayStatsRequest} request
* @param {!proto.api.GetGatewayMetricsRequest} request
* @return {!Uint8Array}
*/
function(request) {
return request.serializeBinary();
},
proto.api.GetGatewayStatsResponse.deserializeBinary
proto.api.GetGatewayMetricsResponse.deserializeBinary
);
/**
* @param {!proto.api.GetGatewayStatsRequest} request The
* @param {!proto.api.GetGatewayMetricsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @param {function(?grpc.web.Error, ?proto.api.GetGatewayStatsResponse)}
* @param {function(?grpc.web.Error, ?proto.api.GetGatewayMetricsResponse)}
* callback The callback function(error, response)
* @return {!grpc.web.ClientReadableStream<!proto.api.GetGatewayStatsResponse>|undefined}
* @return {!grpc.web.ClientReadableStream<!proto.api.GetGatewayMetricsResponse>|undefined}
* The XHR Node Readable Stream
*/
proto.api.GatewayServiceClient.prototype.getStats =
proto.api.GatewayServiceClient.prototype.getMetrics =
function(request, metadata, callback) {
return this.client_.rpcCall(this.hostname_ +
'/api.GatewayService/GetStats',
'/api.GatewayService/GetMetrics',
request,
metadata || {},
methodDescriptor_GatewayService_GetStats,
methodDescriptor_GatewayService_GetMetrics,
callback);
};
/**
* @param {!proto.api.GetGatewayStatsRequest} request The
* @param {!proto.api.GetGatewayMetricsRequest} request The
* request proto
* @param {?Object<string, string>} metadata User defined
* call metadata
* @return {!Promise<!proto.api.GetGatewayStatsResponse>}
* @return {!Promise<!proto.api.GetGatewayMetricsResponse>}
* Promise that resolves to the response
*/
proto.api.GatewayServicePromiseClient.prototype.getStats =
proto.api.GatewayServicePromiseClient.prototype.getMetrics =
function(request, metadata) {
return this.client_.unaryCall(this.hostname_ +
'/api.GatewayService/GetStats',
'/api.GatewayService/GetMetrics',
request,
metadata || {},
methodDescriptor_GatewayService_GetStats);
methodDescriptor_GatewayService_GetMetrics);
};

View File

@ -325,101 +325,93 @@ export namespace GenerateGatewayClientCertificateResponse {
}
}
export class GetGatewayStatsRequest extends jspb.Message {
export class GetGatewayMetricsRequest extends jspb.Message {
getGatewayId(): string;
setGatewayId(value: string): GetGatewayStatsRequest;
setGatewayId(value: string): GetGatewayMetricsRequest;
getStart(): google_protobuf_timestamp_pb.Timestamp | undefined;
setStart(value?: google_protobuf_timestamp_pb.Timestamp): GetGatewayStatsRequest;
setStart(value?: google_protobuf_timestamp_pb.Timestamp): GetGatewayMetricsRequest;
hasStart(): boolean;
clearStart(): GetGatewayStatsRequest;
clearStart(): GetGatewayMetricsRequest;
getEnd(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): GetGatewayStatsRequest;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): GetGatewayMetricsRequest;
hasEnd(): boolean;
clearEnd(): GetGatewayStatsRequest;
clearEnd(): GetGatewayMetricsRequest;
getAggregation(): common_common_pb.Aggregation;
setAggregation(value: common_common_pb.Aggregation): GetGatewayMetricsRequest;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetGatewayStatsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayStatsRequest): GetGatewayStatsRequest.AsObject;
static serializeBinaryToWriter(message: GetGatewayStatsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayStatsRequest;
static deserializeBinaryFromReader(message: GetGatewayStatsRequest, reader: jspb.BinaryReader): GetGatewayStatsRequest;
toObject(includeInstance?: boolean): GetGatewayMetricsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayMetricsRequest): GetGatewayMetricsRequest.AsObject;
static serializeBinaryToWriter(message: GetGatewayMetricsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayMetricsRequest;
static deserializeBinaryFromReader(message: GetGatewayMetricsRequest, reader: jspb.BinaryReader): GetGatewayMetricsRequest;
}
export namespace GetGatewayStatsRequest {
export namespace GetGatewayMetricsRequest {
export type AsObject = {
gatewayId: string,
start?: google_protobuf_timestamp_pb.Timestamp.AsObject,
end?: google_protobuf_timestamp_pb.Timestamp.AsObject,
aggregation: common_common_pb.Aggregation,
}
}
export class GetGatewayStatsResponse extends jspb.Message {
getResultList(): Array<GatewayStats>;
setResultList(value: Array<GatewayStats>): GetGatewayStatsResponse;
clearResultList(): GetGatewayStatsResponse;
addResult(value?: GatewayStats, index?: number): GatewayStats;
export class GetGatewayMetricsResponse extends jspb.Message {
getRxPackets(): common_common_pb.Metric | undefined;
setRxPackets(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasRxPackets(): boolean;
clearRxPackets(): GetGatewayMetricsResponse;
getTxPackets(): common_common_pb.Metric | undefined;
setTxPackets(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasTxPackets(): boolean;
clearTxPackets(): GetGatewayMetricsResponse;
getTxPacketsPerFreq(): common_common_pb.Metric | undefined;
setTxPacketsPerFreq(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasTxPacketsPerFreq(): boolean;
clearTxPacketsPerFreq(): GetGatewayMetricsResponse;
getRxPacketsPerFreq(): common_common_pb.Metric | undefined;
setRxPacketsPerFreq(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasRxPacketsPerFreq(): boolean;
clearRxPacketsPerFreq(): GetGatewayMetricsResponse;
getTxPacketsPerDr(): common_common_pb.Metric | undefined;
setTxPacketsPerDr(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasTxPacketsPerDr(): boolean;
clearTxPacketsPerDr(): GetGatewayMetricsResponse;
getRxPacketsPerDr(): common_common_pb.Metric | undefined;
setRxPacketsPerDr(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasRxPacketsPerDr(): boolean;
clearRxPacketsPerDr(): GetGatewayMetricsResponse;
getTxPacketsPerStatus(): common_common_pb.Metric | undefined;
setTxPacketsPerStatus(value?: common_common_pb.Metric): GetGatewayMetricsResponse;
hasTxPacketsPerStatus(): boolean;
clearTxPacketsPerStatus(): GetGatewayMetricsResponse;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetGatewayStatsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayStatsResponse): GetGatewayStatsResponse.AsObject;
static serializeBinaryToWriter(message: GetGatewayStatsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayStatsResponse;
static deserializeBinaryFromReader(message: GetGatewayStatsResponse, reader: jspb.BinaryReader): GetGatewayStatsResponse;
toObject(includeInstance?: boolean): GetGatewayMetricsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayMetricsResponse): GetGatewayMetricsResponse.AsObject;
static serializeBinaryToWriter(message: GetGatewayMetricsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayMetricsResponse;
static deserializeBinaryFromReader(message: GetGatewayMetricsResponse, reader: jspb.BinaryReader): GetGatewayMetricsResponse;
}
export namespace GetGatewayStatsResponse {
export namespace GetGatewayMetricsResponse {
export type AsObject = {
resultList: Array<GatewayStats.AsObject>,
}
}
export class GatewayStats extends jspb.Message {
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
setTime(value?: google_protobuf_timestamp_pb.Timestamp): GatewayStats;
hasTime(): boolean;
clearTime(): GatewayStats;
getRxPackets(): number;
setRxPackets(value: number): GatewayStats;
getTxPackets(): number;
setTxPackets(value: number): GatewayStats;
getTxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearTxPacketsPerFrequencyMap(): GatewayStats;
getRxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearRxPacketsPerFrequencyMap(): GatewayStats;
getTxPacketsPerDrMap(): jspb.Map<number, number>;
clearTxPacketsPerDrMap(): GatewayStats;
getRxPacketsPerDrMap(): jspb.Map<number, number>;
clearRxPacketsPerDrMap(): GatewayStats;
getTxPacketsPerStatusMap(): jspb.Map<string, number>;
clearTxPacketsPerStatusMap(): GatewayStats;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GatewayStats.AsObject;
static toObject(includeInstance: boolean, msg: GatewayStats): GatewayStats.AsObject;
static serializeBinaryToWriter(message: GatewayStats, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GatewayStats;
static deserializeBinaryFromReader(message: GatewayStats, reader: jspb.BinaryReader): GatewayStats;
}
export namespace GatewayStats {
export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
rxPackets: number,
txPackets: number,
txPacketsPerFrequencyMap: Array<[number, number]>,
rxPacketsPerFrequencyMap: Array<[number, number]>,
txPacketsPerDrMap: Array<[number, number]>,
rxPacketsPerDrMap: Array<[number, number]>,
txPacketsPerStatusMap: Array<[string, number]>,
rxPackets?: common_common_pb.Metric.AsObject,
txPackets?: common_common_pb.Metric.AsObject,
txPacketsPerFreq?: common_common_pb.Metric.AsObject,
rxPacketsPerFreq?: common_common_pb.Metric.AsObject,
txPacketsPerDr?: common_common_pb.Metric.AsObject,
rxPacketsPerDr?: common_common_pb.Metric.AsObject,
txPacketsPerStatus?: common_common_pb.Metric.AsObject,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
import * as jspb from 'google-protobuf'
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
export class Location extends jspb.Message {
@ -60,6 +61,60 @@ export namespace KeyEnvelope {
}
}
export class Metric extends jspb.Message {
getName(): string;
setName(value: string): Metric;
getTimestampsList(): Array<google_protobuf_timestamp_pb.Timestamp>;
setTimestampsList(value: Array<google_protobuf_timestamp_pb.Timestamp>): Metric;
clearTimestampsList(): Metric;
addTimestamps(value?: google_protobuf_timestamp_pb.Timestamp, index?: number): google_protobuf_timestamp_pb.Timestamp;
getDatasetsList(): Array<MetricDataset>;
setDatasetsList(value: Array<MetricDataset>): Metric;
clearDatasetsList(): Metric;
addDatasets(value?: MetricDataset, index?: number): MetricDataset;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Metric.AsObject;
static toObject(includeInstance: boolean, msg: Metric): Metric.AsObject;
static serializeBinaryToWriter(message: Metric, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Metric;
static deserializeBinaryFromReader(message: Metric, reader: jspb.BinaryReader): Metric;
}
export namespace Metric {
export type AsObject = {
name: string,
timestampsList: Array<google_protobuf_timestamp_pb.Timestamp.AsObject>,
datasetsList: Array<MetricDataset.AsObject>,
}
}
export class MetricDataset extends jspb.Message {
getLabel(): string;
setLabel(value: string): MetricDataset;
getDataList(): Array<number>;
setDataList(value: Array<number>): MetricDataset;
clearDataList(): MetricDataset;
addData(value: number, index?: number): MetricDataset;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MetricDataset.AsObject;
static toObject(includeInstance: boolean, msg: MetricDataset): MetricDataset.AsObject;
static serializeBinaryToWriter(message: MetricDataset, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MetricDataset;
static deserializeBinaryFromReader(message: MetricDataset, reader: jspb.BinaryReader): MetricDataset;
}
export namespace MetricDataset {
export type AsObject = {
label: string,
dataList: Array<number>,
}
}
export enum Modulation {
LORA = 0,
FSK = 1,
@ -116,3 +171,8 @@ export enum LocationSource {
GEO_RESOLVER_GNSS = 5,
GEO_RESOLVER_WIFI = 6,
}
export enum Aggregation {
HOUR = 0,
DAY = 1,
MONTH = 2,
}

View File

@ -15,11 +15,16 @@ var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
goog.object.extend(proto, google_protobuf_timestamp_pb);
goog.exportSymbol('proto.common.Aggregation', null, global);
goog.exportSymbol('proto.common.KeyEnvelope', null, global);
goog.exportSymbol('proto.common.Location', null, global);
goog.exportSymbol('proto.common.LocationSource', null, global);
goog.exportSymbol('proto.common.MType', null, global);
goog.exportSymbol('proto.common.MacVersion', null, global);
goog.exportSymbol('proto.common.Metric', null, global);
goog.exportSymbol('proto.common.MetricDataset', null, global);
goog.exportSymbol('proto.common.Modulation', null, global);
goog.exportSymbol('proto.common.RegParamsRevision', null, global);
goog.exportSymbol('proto.common.Region', null, global);
@ -65,6 +70,48 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.common.KeyEnvelope.displayName = 'proto.common.KeyEnvelope';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.common.Metric = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.common.Metric.repeatedFields_, null);
};
goog.inherits(proto.common.Metric, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.common.Metric.displayName = 'proto.common.Metric';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.common.MetricDataset = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.common.MetricDataset.repeatedFields_, null);
};
goog.inherits(proto.common.MetricDataset, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.common.MetricDataset.displayName = 'proto.common.MetricDataset';
}
@ -499,6 +546,437 @@ proto.common.KeyEnvelope.prototype.setAesKey = function(value) {
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.common.Metric.repeatedFields_ = [2,3];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.common.Metric.prototype.toObject = function(opt_includeInstance) {
return proto.common.Metric.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.common.Metric} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.common.Metric.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
timestampsList: jspb.Message.toObjectList(msg.getTimestampsList(),
google_protobuf_timestamp_pb.Timestamp.toObject, includeInstance),
datasetsList: jspb.Message.toObjectList(msg.getDatasetsList(),
proto.common.MetricDataset.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.common.Metric}
*/
proto.common.Metric.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.common.Metric;
return proto.common.Metric.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.common.Metric} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.common.Metric}
*/
proto.common.Metric.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 2:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.addTimestamps(value);
break;
case 3:
var value = new proto.common.MetricDataset;
reader.readMessage(value,proto.common.MetricDataset.deserializeBinaryFromReader);
msg.addDatasets(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.common.Metric.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.common.Metric.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.common.Metric} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.common.Metric.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getTimestampsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = message.getDatasetsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
3,
f,
proto.common.MetricDataset.serializeBinaryToWriter
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.common.Metric.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.common.Metric} returns this
*/
proto.common.Metric.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* repeated google.protobuf.Timestamp timestamps = 2;
* @return {!Array<!proto.google.protobuf.Timestamp>}
*/
proto.common.Metric.prototype.getTimestampsList = function() {
return /** @type{!Array<!proto.google.protobuf.Timestamp>} */ (
jspb.Message.getRepeatedWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2));
};
/**
* @param {!Array<!proto.google.protobuf.Timestamp>} value
* @return {!proto.common.Metric} returns this
*/
proto.common.Metric.prototype.setTimestampsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.google.protobuf.Timestamp=} opt_value
* @param {number=} opt_index
* @return {!proto.google.protobuf.Timestamp}
*/
proto.common.Metric.prototype.addTimestamps = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.protobuf.Timestamp, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.common.Metric} returns this
*/
proto.common.Metric.prototype.clearTimestampsList = function() {
return this.setTimestampsList([]);
};
/**
* repeated MetricDataset datasets = 3;
* @return {!Array<!proto.common.MetricDataset>}
*/
proto.common.Metric.prototype.getDatasetsList = function() {
return /** @type{!Array<!proto.common.MetricDataset>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.common.MetricDataset, 3));
};
/**
* @param {!Array<!proto.common.MetricDataset>} value
* @return {!proto.common.Metric} returns this
*/
proto.common.Metric.prototype.setDatasetsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 3, value);
};
/**
* @param {!proto.common.MetricDataset=} opt_value
* @param {number=} opt_index
* @return {!proto.common.MetricDataset}
*/
proto.common.Metric.prototype.addDatasets = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.common.MetricDataset, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.common.Metric} returns this
*/
proto.common.Metric.prototype.clearDatasetsList = function() {
return this.setDatasetsList([]);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.common.MetricDataset.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.common.MetricDataset.prototype.toObject = function(opt_includeInstance) {
return proto.common.MetricDataset.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.common.MetricDataset} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.common.MetricDataset.toObject = function(includeInstance, msg) {
var f, obj = {
label: jspb.Message.getFieldWithDefault(msg, 1, ""),
dataList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 2)) == null ? undefined : f
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.common.MetricDataset}
*/
proto.common.MetricDataset.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.common.MetricDataset;
return proto.common.MetricDataset.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.common.MetricDataset} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.common.MetricDataset}
*/
proto.common.MetricDataset.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setLabel(value);
break;
case 2:
var values = /** @type {!Array<number>} */ (reader.isDelimited() ? reader.readPackedFloat() : [reader.readFloat()]);
for (var i = 0; i < values.length; i++) {
msg.addData(values[i]);
}
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.common.MetricDataset.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.common.MetricDataset.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.common.MetricDataset} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.common.MetricDataset.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getLabel();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getDataList();
if (f.length > 0) {
writer.writePackedFloat(
2,
f
);
}
};
/**
* optional string label = 1;
* @return {string}
*/
proto.common.MetricDataset.prototype.getLabel = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.common.MetricDataset} returns this
*/
proto.common.MetricDataset.prototype.setLabel = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* repeated float data = 2;
* @return {!Array<number>}
*/
proto.common.MetricDataset.prototype.getDataList = function() {
return /** @type {!Array<number>} */ (jspb.Message.getRepeatedFloatingPointField(this, 2));
};
/**
* @param {!Array<number>} value
* @return {!proto.common.MetricDataset} returns this
*/
proto.common.MetricDataset.prototype.setDataList = function(value) {
return jspb.Message.setField(this, 2, value || []);
};
/**
* @param {number} value
* @param {number=} opt_index
* @return {!proto.common.MetricDataset} returns this
*/
proto.common.MetricDataset.prototype.addData = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 2, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.common.MetricDataset} returns this
*/
proto.common.MetricDataset.prototype.clearDataList = function() {
return this.setDataList([]);
};
/**
* @enum {number}
*/
@ -579,4 +1057,13 @@ proto.common.LocationSource = {
GEO_RESOLVER_WIFI: 6
};
/**
* @enum {number}
*/
proto.common.Aggregation = {
HOUR: 0,
DAY: 1,
MONTH: 2
};
goog.object.extend(exports, proto.common);

View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api-grpc-web",
"version": "4.0.0-test.5",
"version": "4.0.0-test.7",
"description": "Chirpstack gRPC-web API",
"license": "MIT",
"devDependencies": {

1
api/js/Makefile vendored
View File

@ -23,6 +23,7 @@ api:
protoc ${PROTOC_GRPC_ARGS} ../proto/api/tenant.proto
protoc ${PROTOC_GRPC_ARGS} ../proto/api/application.proto
protoc ${PROTOC_GRPC_ARGS} ../proto/api/device_profile.proto
protoc ${PROTOC_GRPC_ARGS} ../proto/api/device_profile_template.proto
protoc ${PROTOC_GRPC_ARGS} ../proto/api/device.proto
protoc ${PROTOC_GRPC_ARGS} ../proto/api/gateway.proto
protoc ${PROTOC_GRPC_ARGS} ../proto/api/frame_log.proto

View File

@ -22,7 +22,8 @@ interface IDeviceServiceService extends grpc.ServiceDefinition<grpc.UntypedServi
deactivate: grpc.MethodDefinition<api_device_pb.DeactivateDeviceRequest, google_protobuf_empty_pb.Empty>;
getActivation: grpc.MethodDefinition<api_device_pb.GetDeviceActivationRequest, api_device_pb.GetDeviceActivationResponse>;
getRandomDevAddr: grpc.MethodDefinition<api_device_pb.GetRandomDevAddrRequest, api_device_pb.GetRandomDevAddrResponse>;
getStats: grpc.MethodDefinition<api_device_pb.GetDeviceStatsRequest, api_device_pb.GetDeviceStatsResponse>;
getMetrics: grpc.MethodDefinition<api_device_pb.GetDeviceMetricsRequest, api_device_pb.GetDeviceMetricsResponse>;
getLinkMetrics: grpc.MethodDefinition<api_device_pb.GetDeviceLinkMetricsRequest, api_device_pb.GetDeviceLinkMetricsResponse>;
enqueue: grpc.MethodDefinition<api_device_pb.EnqueueDeviceQueueItemRequest, api_device_pb.EnqueueDeviceQueueItemResponse>;
flushQueue: grpc.MethodDefinition<api_device_pb.FlushDeviceQueueRequest, google_protobuf_empty_pb.Empty>;
getQueue: grpc.MethodDefinition<api_device_pb.GetDeviceQueueItemsRequest, api_device_pb.GetDeviceQueueItemsResponse>;
@ -45,7 +46,8 @@ export interface IDeviceServiceServer extends grpc.UntypedServiceImplementation
deactivate: grpc.handleUnaryCall<api_device_pb.DeactivateDeviceRequest, google_protobuf_empty_pb.Empty>;
getActivation: grpc.handleUnaryCall<api_device_pb.GetDeviceActivationRequest, api_device_pb.GetDeviceActivationResponse>;
getRandomDevAddr: grpc.handleUnaryCall<api_device_pb.GetRandomDevAddrRequest, api_device_pb.GetRandomDevAddrResponse>;
getStats: grpc.handleUnaryCall<api_device_pb.GetDeviceStatsRequest, api_device_pb.GetDeviceStatsResponse>;
getMetrics: grpc.handleUnaryCall<api_device_pb.GetDeviceMetricsRequest, api_device_pb.GetDeviceMetricsResponse>;
getLinkMetrics: grpc.handleUnaryCall<api_device_pb.GetDeviceLinkMetricsRequest, api_device_pb.GetDeviceLinkMetricsResponse>;
enqueue: grpc.handleUnaryCall<api_device_pb.EnqueueDeviceQueueItemRequest, api_device_pb.EnqueueDeviceQueueItemResponse>;
flushQueue: grpc.handleUnaryCall<api_device_pb.FlushDeviceQueueRequest, google_protobuf_empty_pb.Empty>;
getQueue: grpc.handleUnaryCall<api_device_pb.GetDeviceQueueItemsRequest, api_device_pb.GetDeviceQueueItemsResponse>;
@ -95,9 +97,12 @@ export class DeviceServiceClient extends grpc.Client {
getRandomDevAddr(argument: api_device_pb.GetRandomDevAddrRequest, callback: grpc.requestCallback<api_device_pb.GetRandomDevAddrResponse>): grpc.ClientUnaryCall;
getRandomDevAddr(argument: api_device_pb.GetRandomDevAddrRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetRandomDevAddrResponse>): grpc.ClientUnaryCall;
getRandomDevAddr(argument: api_device_pb.GetRandomDevAddrRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetRandomDevAddrResponse>): grpc.ClientUnaryCall;
getStats(argument: api_device_pb.GetDeviceStatsRequest, callback: grpc.requestCallback<api_device_pb.GetDeviceStatsResponse>): grpc.ClientUnaryCall;
getStats(argument: api_device_pb.GetDeviceStatsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceStatsResponse>): grpc.ClientUnaryCall;
getStats(argument: api_device_pb.GetDeviceStatsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceStatsResponse>): grpc.ClientUnaryCall;
getMetrics(argument: api_device_pb.GetDeviceMetricsRequest, callback: grpc.requestCallback<api_device_pb.GetDeviceMetricsResponse>): grpc.ClientUnaryCall;
getMetrics(argument: api_device_pb.GetDeviceMetricsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceMetricsResponse>): grpc.ClientUnaryCall;
getMetrics(argument: api_device_pb.GetDeviceMetricsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceMetricsResponse>): grpc.ClientUnaryCall;
getLinkMetrics(argument: api_device_pb.GetDeviceLinkMetricsRequest, callback: grpc.requestCallback<api_device_pb.GetDeviceLinkMetricsResponse>): grpc.ClientUnaryCall;
getLinkMetrics(argument: api_device_pb.GetDeviceLinkMetricsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceLinkMetricsResponse>): grpc.ClientUnaryCall;
getLinkMetrics(argument: api_device_pb.GetDeviceLinkMetricsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.GetDeviceLinkMetricsResponse>): grpc.ClientUnaryCall;
enqueue(argument: api_device_pb.EnqueueDeviceQueueItemRequest, callback: grpc.requestCallback<api_device_pb.EnqueueDeviceQueueItemResponse>): grpc.ClientUnaryCall;
enqueue(argument: api_device_pb.EnqueueDeviceQueueItemRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.EnqueueDeviceQueueItemResponse>): grpc.ClientUnaryCall;
enqueue(argument: api_device_pb.EnqueueDeviceQueueItemRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_pb.EnqueueDeviceQueueItemResponse>): grpc.ClientUnaryCall;

View File

@ -3,6 +3,7 @@
'use strict';
var grpc = require('@grpc/grpc-js');
var api_device_pb = require('../api/device_pb.js');
var common_common_pb = require('../common/common_pb.js');
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js');
@ -161,6 +162,50 @@ function deserialize_api_GetDeviceKeysResponse(buffer_arg) {
return api_device_pb.GetDeviceKeysResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceLinkMetricsRequest(arg) {
if (!(arg instanceof api_device_pb.GetDeviceLinkMetricsRequest)) {
throw new Error('Expected argument of type api.GetDeviceLinkMetricsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceLinkMetricsRequest(buffer_arg) {
return api_device_pb.GetDeviceLinkMetricsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceLinkMetricsResponse(arg) {
if (!(arg instanceof api_device_pb.GetDeviceLinkMetricsResponse)) {
throw new Error('Expected argument of type api.GetDeviceLinkMetricsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceLinkMetricsResponse(buffer_arg) {
return api_device_pb.GetDeviceLinkMetricsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceMetricsRequest(arg) {
if (!(arg instanceof api_device_pb.GetDeviceMetricsRequest)) {
throw new Error('Expected argument of type api.GetDeviceMetricsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceMetricsRequest(buffer_arg) {
return api_device_pb.GetDeviceMetricsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceMetricsResponse(arg) {
if (!(arg instanceof api_device_pb.GetDeviceMetricsResponse)) {
throw new Error('Expected argument of type api.GetDeviceMetricsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceMetricsResponse(buffer_arg) {
return api_device_pb.GetDeviceMetricsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceQueueItemsRequest(arg) {
if (!(arg instanceof api_device_pb.GetDeviceQueueItemsRequest)) {
throw new Error('Expected argument of type api.GetDeviceQueueItemsRequest');
@ -205,28 +250,6 @@ function deserialize_api_GetDeviceResponse(buffer_arg) {
return api_device_pb.GetDeviceResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceStatsRequest(arg) {
if (!(arg instanceof api_device_pb.GetDeviceStatsRequest)) {
throw new Error('Expected argument of type api.GetDeviceStatsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceStatsRequest(buffer_arg) {
return api_device_pb.GetDeviceStatsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceStatsResponse(arg) {
if (!(arg instanceof api_device_pb.GetDeviceStatsResponse)) {
throw new Error('Expected argument of type api.GetDeviceStatsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceStatsResponse(buffer_arg) {
return api_device_pb.GetDeviceStatsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetRandomDevAddrRequest(arg) {
if (!(arg instanceof api_device_pb.GetRandomDevAddrRequest)) {
throw new Error('Expected argument of type api.GetRandomDevAddrRequest');
@ -475,17 +498,31 @@ getRandomDevAddr: {
responseSerialize: serialize_api_GetRandomDevAddrResponse,
responseDeserialize: deserialize_api_GetRandomDevAddrResponse,
},
// GetStats returns the device stats.
getStats: {
path: '/api.DeviceService/GetStats',
// GetMetrics returns the device metrics.
// Note that this requires a device-profile with codec and measurements configured.
getMetrics: {
path: '/api.DeviceService/GetMetrics',
requestStream: false,
responseStream: false,
requestType: api_device_pb.GetDeviceStatsRequest,
responseType: api_device_pb.GetDeviceStatsResponse,
requestSerialize: serialize_api_GetDeviceStatsRequest,
requestDeserialize: deserialize_api_GetDeviceStatsRequest,
responseSerialize: serialize_api_GetDeviceStatsResponse,
responseDeserialize: deserialize_api_GetDeviceStatsResponse,
requestType: api_device_pb.GetDeviceMetricsRequest,
responseType: api_device_pb.GetDeviceMetricsResponse,
requestSerialize: serialize_api_GetDeviceMetricsRequest,
requestDeserialize: deserialize_api_GetDeviceMetricsRequest,
responseSerialize: serialize_api_GetDeviceMetricsResponse,
responseDeserialize: deserialize_api_GetDeviceMetricsResponse,
},
// GetLinkMetrics returns the device link metrics.
// This includes uplinks, downlinks, RSSI, SNR, etc...
getLinkMetrics: {
path: '/api.DeviceService/GetLinkMetrics',
requestStream: false,
responseStream: false,
requestType: api_device_pb.GetDeviceLinkMetricsRequest,
responseType: api_device_pb.GetDeviceLinkMetricsResponse,
requestSerialize: serialize_api_GetDeviceLinkMetricsRequest,
requestDeserialize: deserialize_api_GetDeviceLinkMetricsRequest,
responseSerialize: serialize_api_GetDeviceLinkMetricsResponse,
responseDeserialize: deserialize_api_GetDeviceLinkMetricsResponse,
},
// Enqueue adds the given item to the downlink queue.
enqueue: {

View File

@ -2,6 +2,7 @@
// file: api/device.proto
import * as jspb from "google-protobuf";
import * as common_common_pb from "../common/common_pb";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
import * as google_protobuf_struct_pb from "google-protobuf/google/protobuf/struct_pb";
import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb";
@ -658,7 +659,7 @@ export namespace GetRandomDevAddrResponse {
}
}
export class GetDeviceStatsRequest extends jspb.Message {
export class GetDeviceMetricsRequest extends jspb.Message {
getDevEui(): string;
setDevEui(value: string): void;
@ -672,86 +673,159 @@ export class GetDeviceStatsRequest extends jspb.Message {
getEnd(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): void;
getAggregation(): common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap];
setAggregation(value: common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceStatsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceStatsRequest): GetDeviceStatsRequest.AsObject;
toObject(includeInstance?: boolean): GetDeviceMetricsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceMetricsRequest): GetDeviceMetricsRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceStatsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceStatsRequest;
static deserializeBinaryFromReader(message: GetDeviceStatsRequest, reader: jspb.BinaryReader): GetDeviceStatsRequest;
static serializeBinaryToWriter(message: GetDeviceMetricsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceMetricsRequest;
static deserializeBinaryFromReader(message: GetDeviceMetricsRequest, reader: jspb.BinaryReader): GetDeviceMetricsRequest;
}
export namespace GetDeviceStatsRequest {
export namespace GetDeviceMetricsRequest {
export type AsObject = {
devEui: string,
start?: google_protobuf_timestamp_pb.Timestamp.AsObject,
end?: google_protobuf_timestamp_pb.Timestamp.AsObject,
aggregation: common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap],
}
}
export class GetDeviceStatsResponse extends jspb.Message {
clearResultList(): void;
getResultList(): Array<DeviceStats>;
setResultList(value: Array<DeviceStats>): void;
addResult(value?: DeviceStats, index?: number): DeviceStats;
export class GetDeviceMetricsResponse extends jspb.Message {
getMetricsMap(): jspb.Map<string, common_common_pb.Metric>;
clearMetricsMap(): void;
getStatesMap(): jspb.Map<string, DeviceState>;
clearStatesMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceStatsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceStatsResponse): GetDeviceStatsResponse.AsObject;
toObject(includeInstance?: boolean): GetDeviceMetricsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceMetricsResponse): GetDeviceMetricsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceStatsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceStatsResponse;
static deserializeBinaryFromReader(message: GetDeviceStatsResponse, reader: jspb.BinaryReader): GetDeviceStatsResponse;
static serializeBinaryToWriter(message: GetDeviceMetricsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceMetricsResponse;
static deserializeBinaryFromReader(message: GetDeviceMetricsResponse, reader: jspb.BinaryReader): GetDeviceMetricsResponse;
}
export namespace GetDeviceStatsResponse {
export namespace GetDeviceMetricsResponse {
export type AsObject = {
resultList: Array<DeviceStats.AsObject>,
metricsMap: Array<[string, common_common_pb.Metric.AsObject]>,
statesMap: Array<[string, DeviceState.AsObject]>,
}
}
export class DeviceStats extends jspb.Message {
hasTime(): boolean;
clearTime(): void;
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
setTime(value?: google_protobuf_timestamp_pb.Timestamp): void;
export class DeviceState extends jspb.Message {
getName(): string;
setName(value: string): void;
getRxPackets(): number;
setRxPackets(value: number): void;
getValue(): string;
setValue(value: string): void;
getGwRssi(): number;
setGwRssi(value: number): void;
getGwSnr(): number;
setGwSnr(value: number): void;
getRxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearRxPacketsPerFrequencyMap(): void;
getRxPacketsPerDrMap(): jspb.Map<number, number>;
clearRxPacketsPerDrMap(): void;
getErrorsMap(): jspb.Map<string, number>;
clearErrorsMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceStats.AsObject;
static toObject(includeInstance: boolean, msg: DeviceStats): DeviceStats.AsObject;
toObject(includeInstance?: boolean): DeviceState.AsObject;
static toObject(includeInstance: boolean, msg: DeviceState): DeviceState.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeviceStats, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceStats;
static deserializeBinaryFromReader(message: DeviceStats, reader: jspb.BinaryReader): DeviceStats;
static serializeBinaryToWriter(message: DeviceState, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceState;
static deserializeBinaryFromReader(message: DeviceState, reader: jspb.BinaryReader): DeviceState;
}
export namespace DeviceStats {
export namespace DeviceState {
export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
rxPackets: number,
gwRssi: number,
gwSnr: number,
rxPacketsPerFrequencyMap: Array<[number, number]>,
rxPacketsPerDrMap: Array<[number, number]>,
errorsMap: Array<[string, number]>,
name: string,
value: string,
}
}
export class GetDeviceLinkMetricsRequest extends jspb.Message {
getDevEui(): string;
setDevEui(value: string): void;
hasStart(): boolean;
clearStart(): void;
getStart(): google_protobuf_timestamp_pb.Timestamp | undefined;
setStart(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasEnd(): boolean;
clearEnd(): void;
getEnd(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): void;
getAggregation(): common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap];
setAggregation(value: common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceLinkMetricsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceLinkMetricsRequest): GetDeviceLinkMetricsRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceLinkMetricsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceLinkMetricsRequest;
static deserializeBinaryFromReader(message: GetDeviceLinkMetricsRequest, reader: jspb.BinaryReader): GetDeviceLinkMetricsRequest;
}
export namespace GetDeviceLinkMetricsRequest {
export type AsObject = {
devEui: string,
start?: google_protobuf_timestamp_pb.Timestamp.AsObject,
end?: google_protobuf_timestamp_pb.Timestamp.AsObject,
aggregation: common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap],
}
}
export class GetDeviceLinkMetricsResponse extends jspb.Message {
hasRxPackets(): boolean;
clearRxPackets(): void;
getRxPackets(): common_common_pb.Metric | undefined;
setRxPackets(value?: common_common_pb.Metric): void;
hasGwRssi(): boolean;
clearGwRssi(): void;
getGwRssi(): common_common_pb.Metric | undefined;
setGwRssi(value?: common_common_pb.Metric): void;
hasGwSnr(): boolean;
clearGwSnr(): void;
getGwSnr(): common_common_pb.Metric | undefined;
setGwSnr(value?: common_common_pb.Metric): void;
hasRxPacketsPerFreq(): boolean;
clearRxPacketsPerFreq(): void;
getRxPacketsPerFreq(): common_common_pb.Metric | undefined;
setRxPacketsPerFreq(value?: common_common_pb.Metric): void;
hasRxPacketsPerDr(): boolean;
clearRxPacketsPerDr(): void;
getRxPacketsPerDr(): common_common_pb.Metric | undefined;
setRxPacketsPerDr(value?: common_common_pb.Metric): void;
hasErrors(): boolean;
clearErrors(): void;
getErrors(): common_common_pb.Metric | undefined;
setErrors(value?: common_common_pb.Metric): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceLinkMetricsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceLinkMetricsResponse): GetDeviceLinkMetricsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceLinkMetricsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceLinkMetricsResponse;
static deserializeBinaryFromReader(message: GetDeviceLinkMetricsResponse, reader: jspb.BinaryReader): GetDeviceLinkMetricsResponse;
}
export namespace GetDeviceLinkMetricsResponse {
export type AsObject = {
rxPackets?: common_common_pb.Metric.AsObject,
gwRssi?: common_common_pb.Metric.AsObject,
gwSnr?: common_common_pb.Metric.AsObject,
rxPacketsPerFreq?: common_common_pb.Metric.AsObject,
rxPacketsPerDr?: common_common_pb.Metric.AsObject,
errors?: common_common_pb.Metric.AsObject,
}
}

1039
api/js/api/device_pb.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,9 @@ export class DeviceProfile extends jspb.Message {
getName(): string;
setName(value: string): void;
getDescription(): string;
setDescription(value: string): void;
getRegion(): common_common_pb.RegionMap[keyof common_common_pb.RegionMap];
setRegion(value: common_common_pb.RegionMap[keyof common_common_pb.RegionMap]): void;
@ -81,6 +84,8 @@ export class DeviceProfile extends jspb.Message {
getTagsMap(): jspb.Map<string, string>;
clearTagsMap(): void;
getMeasurementsMap(): jspb.Map<string, Measurement>;
clearMeasurementsMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceProfile.AsObject;
static toObject(includeInstance: boolean, msg: DeviceProfile): DeviceProfile.AsObject;
@ -96,6 +101,7 @@ export namespace DeviceProfile {
id: string,
tenantId: string,
name: string,
description: string,
region: common_common_pb.RegionMap[keyof common_common_pb.RegionMap],
macVersion: common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap],
regParamsRevision: common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap],
@ -118,6 +124,31 @@ export namespace DeviceProfile {
abpRx2Dr: number,
abpRx2Freq: number,
tagsMap: Array<[string, string]>,
measurementsMap: Array<[string, Measurement.AsObject]>,
}
}
export class Measurement extends jspb.Message {
getName(): string;
setName(value: string): void;
getKind(): MeasurementKindMap[keyof MeasurementKindMap];
setKind(value: MeasurementKindMap[keyof MeasurementKindMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Measurement.AsObject;
static toObject(includeInstance: boolean, msg: Measurement): Measurement.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Measurement, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Measurement;
static deserializeBinaryFromReader(message: Measurement, reader: jspb.BinaryReader): Measurement;
}
export namespace Measurement {
export type AsObject = {
name: string,
kind: MeasurementKindMap[keyof MeasurementKindMap],
}
}
@ -435,3 +466,13 @@ export interface CodecRuntimeMap {
export const CodecRuntime: CodecRuntimeMap;
export interface MeasurementKindMap {
UNKNOWN: 0;
COUNTER: 1;
ABSOLUTE: 2;
GAUGE: 3;
STRING: 4;
}
export const MeasurementKind: MeasurementKindMap;

View File

@ -24,6 +24,8 @@ goog.exportSymbol('proto.api.GetDeviceProfileResponse', null, global);
goog.exportSymbol('proto.api.ListDeviceProfileAdrAlgorithmsResponse', null, global);
goog.exportSymbol('proto.api.ListDeviceProfilesRequest', null, global);
goog.exportSymbol('proto.api.ListDeviceProfilesResponse', null, global);
goog.exportSymbol('proto.api.Measurement', null, global);
goog.exportSymbol('proto.api.MeasurementKind', null, global);
goog.exportSymbol('proto.api.UpdateDeviceProfileRequest', null, global);
/**
@ -74,6 +76,7 @@ proto.api.DeviceProfile.toObject = function(includeInstance, msg) {
id: msg.getId(),
tenantId: msg.getTenantId(),
name: msg.getName(),
description: msg.getDescription(),
region: msg.getRegion(),
macVersion: msg.getMacVersion(),
regParamsRevision: msg.getRegParamsRevision(),
@ -95,7 +98,8 @@ proto.api.DeviceProfile.toObject = function(includeInstance, msg) {
abpRx1DrOffset: msg.getAbpRx1DrOffset(),
abpRx2Dr: msg.getAbpRx2Dr(),
abpRx2Freq: msg.getAbpRx2Freq(),
tagsMap: (f = msg.getTagsMap(true)) ? f.toArray() : []
tagsMap: (f = msg.getTagsMap(true)) ? f.toArray() : [],
measurementsMap: (f = msg.getMeasurementsMap(true)) ? f.toArray() : []
};
if (includeInstance) {
@ -144,6 +148,10 @@ proto.api.DeviceProfile.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 26:
var value = /** @type {string} */ (reader.readString());
msg.setDescription(value);
break;
case 4:
var value = /** @type {!proto.common.Region} */ (reader.readEnum());
msg.setRegion(value);
@ -234,6 +242,12 @@ proto.api.DeviceProfile.deserializeBinaryFromReader = function(msg, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString);
});
break;
case 27:
var value = msg.getMeasurementsMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.api.Measurement.deserializeBinaryFromReader);
});
break;
default:
reader.skipField();
break;
@ -293,6 +307,13 @@ proto.api.DeviceProfile.prototype.serializeBinaryToWriter = function (writer) {
f
);
}
f = this.getDescription();
if (f.length > 0) {
writer.writeString(
26,
f
);
}
f = this.getRegion();
if (f !== 0.0) {
writer.writeEnum(
@ -444,6 +465,10 @@ proto.api.DeviceProfile.prototype.serializeBinaryToWriter = function (writer) {
if (f && f.getLength() > 0) {
f.serializeBinary(25, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
}
f = this.getMeasurementsMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(27, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.api.Measurement.serializeBinaryToWriter);
}
};
@ -501,6 +526,21 @@ proto.api.DeviceProfile.prototype.setName = function(value) {
};
/**
* optional string description = 26;
* @return {string}
*/
proto.api.DeviceProfile.prototype.getDescription = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 26, ""));
};
/** @param {string} value */
proto.api.DeviceProfile.prototype.setDescription = function(value) {
jspb.Message.setField(this, 26, value);
};
/**
* optional common.Region region = 4;
* @return {!proto.common.Region}
@ -837,6 +877,205 @@ proto.api.DeviceProfile.prototype.getTagsMap = function(opt_noLazyCreate) {
};
/**
* map<string, Measurement> measurements = 27;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<string,!proto.api.Measurement>}
*/
proto.api.DeviceProfile.prototype.getMeasurementsMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<string,!proto.api.Measurement>} */ (
jspb.Message.getMapField(this, 27, opt_noLazyCreate,
proto.api.Measurement));
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.api.Measurement = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.Measurement, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.api.Measurement.displayName = 'proto.api.Measurement';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.Measurement.prototype.toObject = function(opt_includeInstance) {
return proto.api.Measurement.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.Measurement} msg The msg instance to transform.
* @return {!Object}
*/
proto.api.Measurement.toObject = function(includeInstance, msg) {
var f, obj = {
name: msg.getName(),
kind: msg.getKind()
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.Measurement}
*/
proto.api.Measurement.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.Measurement;
return proto.api.Measurement.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.Measurement} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.Measurement}
*/
proto.api.Measurement.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 3:
var value = /** @type {!proto.api.MeasurementKind} */ (reader.readEnum());
msg.setKind(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.api.Measurement} message
* @param {!jspb.BinaryWriter} writer
*/
proto.api.Measurement.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.Measurement.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.api.Measurement.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getName();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = this.getKind();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.api.Measurement} The clone.
*/
proto.api.Measurement.prototype.cloneMessage = function() {
return /** @type {!proto.api.Measurement} */ (jspb.Message.cloneMessage(this));
};
/**
* optional string name = 2;
* @return {string}
*/
proto.api.Measurement.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, ""));
};
/** @param {string} value */
proto.api.Measurement.prototype.setName = function(value) {
jspb.Message.setField(this, 2, value);
};
/**
* optional MeasurementKind kind = 3;
* @return {!proto.api.MeasurementKind}
*/
proto.api.Measurement.prototype.getKind = function() {
return /** @type {!proto.api.MeasurementKind} */ (jspb.Message.getFieldProto3(this, 3, 0));
};
/** @param {!proto.api.MeasurementKind} value */
proto.api.Measurement.prototype.setKind = function(value) {
jspb.Message.setField(this, 3, value);
};
/**
* Generated by JsPbCodeGenerator.
@ -3217,4 +3456,15 @@ proto.api.CodecRuntime = {
JS: 2
};
/**
* @enum {number}
*/
proto.api.MeasurementKind = {
UNKNOWN: 0,
COUNTER: 1,
ABSOLUTE: 2,
GAUGE: 3,
STRING: 4
};
goog.object.extend(exports, proto.api);

View File

@ -0,0 +1,45 @@
// GENERATED CODE -- DO NOT EDIT!
// package: api
// file: api/device_profile_template.proto
import * as api_device_profile_template_pb from "../api/device_profile_template_pb";
import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb";
import * as grpc from "@grpc/grpc-js";
interface IDeviceProfileTemplateServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
create: grpc.MethodDefinition<api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, google_protobuf_empty_pb.Empty>;
get: grpc.MethodDefinition<api_device_profile_template_pb.GetDeviceProfileTemplateRequest, api_device_profile_template_pb.GetDeviceProfileTemplateResponse>;
update: grpc.MethodDefinition<api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, google_protobuf_empty_pb.Empty>;
delete: grpc.MethodDefinition<api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, google_protobuf_empty_pb.Empty>;
list: grpc.MethodDefinition<api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>;
}
export const DeviceProfileTemplateServiceService: IDeviceProfileTemplateServiceService;
export interface IDeviceProfileTemplateServiceServer extends grpc.UntypedServiceImplementation {
create: grpc.handleUnaryCall<api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, google_protobuf_empty_pb.Empty>;
get: grpc.handleUnaryCall<api_device_profile_template_pb.GetDeviceProfileTemplateRequest, api_device_profile_template_pb.GetDeviceProfileTemplateResponse>;
update: grpc.handleUnaryCall<api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, google_protobuf_empty_pb.Empty>;
delete: grpc.handleUnaryCall<api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, google_protobuf_empty_pb.Empty>;
list: grpc.handleUnaryCall<api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>;
}
export class DeviceProfileTemplateServiceClient extends grpc.Client {
constructor(address: string, credentials: grpc.ChannelCredentials, options?: object);
create(argument: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
create(argument: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
create(argument: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
get(argument: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, callback: grpc.requestCallback<api_device_profile_template_pb.GetDeviceProfileTemplateResponse>): grpc.ClientUnaryCall;
get(argument: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_profile_template_pb.GetDeviceProfileTemplateResponse>): grpc.ClientUnaryCall;
get(argument: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_profile_template_pb.GetDeviceProfileTemplateResponse>): grpc.ClientUnaryCall;
update(argument: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
update(argument: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
update(argument: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
delete(argument: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
delete(argument: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
delete(argument: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<google_protobuf_empty_pb.Empty>): grpc.ClientUnaryCall;
list(argument: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, callback: grpc.requestCallback<api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>): grpc.ClientUnaryCall;
list(argument: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>): grpc.ClientUnaryCall;
list(argument: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_device_profile_template_pb.ListDeviceProfileTemplatesResponse>): grpc.ClientUnaryCall;
}

View File

@ -0,0 +1,164 @@
// GENERATED CODE -- DO NOT EDIT!
'use strict';
var grpc = require('@grpc/grpc-js');
var api_device_profile_template_pb = require('../api/device_profile_template_pb.js');
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js');
var common_common_pb = require('../common/common_pb.js');
var api_device_profile_pb = require('../api/device_profile_pb.js');
function serialize_api_CreateDeviceProfileTemplateRequest(arg) {
if (!(arg instanceof api_device_profile_template_pb.CreateDeviceProfileTemplateRequest)) {
throw new Error('Expected argument of type api.CreateDeviceProfileTemplateRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_CreateDeviceProfileTemplateRequest(buffer_arg) {
return api_device_profile_template_pb.CreateDeviceProfileTemplateRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_DeleteDeviceProfileTemplateRequest(arg) {
if (!(arg instanceof api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest)) {
throw new Error('Expected argument of type api.DeleteDeviceProfileTemplateRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_DeleteDeviceProfileTemplateRequest(buffer_arg) {
return api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceProfileTemplateRequest(arg) {
if (!(arg instanceof api_device_profile_template_pb.GetDeviceProfileTemplateRequest)) {
throw new Error('Expected argument of type api.GetDeviceProfileTemplateRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceProfileTemplateRequest(buffer_arg) {
return api_device_profile_template_pb.GetDeviceProfileTemplateRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetDeviceProfileTemplateResponse(arg) {
if (!(arg instanceof api_device_profile_template_pb.GetDeviceProfileTemplateResponse)) {
throw new Error('Expected argument of type api.GetDeviceProfileTemplateResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetDeviceProfileTemplateResponse(buffer_arg) {
return api_device_profile_template_pb.GetDeviceProfileTemplateResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_ListDeviceProfileTemplatesRequest(arg) {
if (!(arg instanceof api_device_profile_template_pb.ListDeviceProfileTemplatesRequest)) {
throw new Error('Expected argument of type api.ListDeviceProfileTemplatesRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_ListDeviceProfileTemplatesRequest(buffer_arg) {
return api_device_profile_template_pb.ListDeviceProfileTemplatesRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_ListDeviceProfileTemplatesResponse(arg) {
if (!(arg instanceof api_device_profile_template_pb.ListDeviceProfileTemplatesResponse)) {
throw new Error('Expected argument of type api.ListDeviceProfileTemplatesResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_ListDeviceProfileTemplatesResponse(buffer_arg) {
return api_device_profile_template_pb.ListDeviceProfileTemplatesResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_UpdateDeviceProfileTemplateRequest(arg) {
if (!(arg instanceof api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest)) {
throw new Error('Expected argument of type api.UpdateDeviceProfileTemplateRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_UpdateDeviceProfileTemplateRequest(buffer_arg) {
return api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_google_protobuf_Empty(arg) {
if (!(arg instanceof google_protobuf_empty_pb.Empty)) {
throw new Error('Expected argument of type google.protobuf.Empty');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_google_protobuf_Empty(buffer_arg) {
return google_protobuf_empty_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg));
}
// DeviceProfileTemplateService is the service providing API methods for managing device-profile templates.
var DeviceProfileTemplateServiceService = exports.DeviceProfileTemplateServiceService = {
// Create the given device-profile template.
create: {
path: '/api.DeviceProfileTemplateService/Create',
requestStream: false,
responseStream: false,
requestType: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest,
responseType: google_protobuf_empty_pb.Empty,
requestSerialize: serialize_api_CreateDeviceProfileTemplateRequest,
requestDeserialize: deserialize_api_CreateDeviceProfileTemplateRequest,
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// Get the device-profile template for the given ID.
get: {
path: '/api.DeviceProfileTemplateService/Get',
requestStream: false,
responseStream: false,
requestType: api_device_profile_template_pb.GetDeviceProfileTemplateRequest,
responseType: api_device_profile_template_pb.GetDeviceProfileTemplateResponse,
requestSerialize: serialize_api_GetDeviceProfileTemplateRequest,
requestDeserialize: deserialize_api_GetDeviceProfileTemplateRequest,
responseSerialize: serialize_api_GetDeviceProfileTemplateResponse,
responseDeserialize: deserialize_api_GetDeviceProfileTemplateResponse,
},
// Update the given device-profile template.
update: {
path: '/api.DeviceProfileTemplateService/Update',
requestStream: false,
responseStream: false,
requestType: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest,
responseType: google_protobuf_empty_pb.Empty,
requestSerialize: serialize_api_UpdateDeviceProfileTemplateRequest,
requestDeserialize: deserialize_api_UpdateDeviceProfileTemplateRequest,
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// Delete the device-profile template with the given ID.
delete: {
path: '/api.DeviceProfileTemplateService/Delete',
requestStream: false,
responseStream: false,
requestType: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest,
responseType: google_protobuf_empty_pb.Empty,
requestSerialize: serialize_api_DeleteDeviceProfileTemplateRequest,
requestDeserialize: deserialize_api_DeleteDeviceProfileTemplateRequest,
responseSerialize: serialize_google_protobuf_Empty,
responseDeserialize: deserialize_google_protobuf_Empty,
},
// List the available device-profile templates.
list: {
path: '/api.DeviceProfileTemplateService/List',
requestStream: false,
responseStream: false,
requestType: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest,
responseType: api_device_profile_template_pb.ListDeviceProfileTemplatesResponse,
requestSerialize: serialize_api_ListDeviceProfileTemplatesRequest,
requestDeserialize: deserialize_api_ListDeviceProfileTemplatesRequest,
responseSerialize: serialize_api_ListDeviceProfileTemplatesResponse,
responseDeserialize: deserialize_api_ListDeviceProfileTemplatesResponse,
},
};
exports.DeviceProfileTemplateServiceClient = grpc.makeGenericClientConstructor(DeviceProfileTemplateServiceService);

View File

@ -0,0 +1,371 @@
// package: api
// file: api/device_profile_template.proto
import * as jspb from "google-protobuf";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
import * as google_protobuf_empty_pb from "google-protobuf/google/protobuf/empty_pb";
import * as common_common_pb from "../common/common_pb";
import * as api_device_profile_pb from "../api/device_profile_pb";
export class DeviceProfileTemplate extends jspb.Message {
getId(): string;
setId(value: string): void;
getName(): string;
setName(value: string): void;
getDescription(): string;
setDescription(value: string): void;
getVendor(): string;
setVendor(value: string): void;
getFirmware(): string;
setFirmware(value: string): void;
getRegion(): common_common_pb.RegionMap[keyof common_common_pb.RegionMap];
setRegion(value: common_common_pb.RegionMap[keyof common_common_pb.RegionMap]): void;
getMacVersion(): common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap];
setMacVersion(value: common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap]): void;
getRegParamsRevision(): common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap];
setRegParamsRevision(value: common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap]): void;
getAdrAlgorithmId(): string;
setAdrAlgorithmId(value: string): void;
getPayloadCodecRuntime(): api_device_profile_pb.CodecRuntimeMap[keyof api_device_profile_pb.CodecRuntimeMap];
setPayloadCodecRuntime(value: api_device_profile_pb.CodecRuntimeMap[keyof api_device_profile_pb.CodecRuntimeMap]): void;
getPayloadCodecScript(): string;
setPayloadCodecScript(value: string): void;
getFlushQueueOnActivate(): boolean;
setFlushQueueOnActivate(value: boolean): void;
getUplinkInterval(): number;
setUplinkInterval(value: number): void;
getDeviceStatusReqInterval(): number;
setDeviceStatusReqInterval(value: number): void;
getSupportsOtaa(): boolean;
setSupportsOtaa(value: boolean): void;
getSupportsClassB(): boolean;
setSupportsClassB(value: boolean): void;
getSupportsClassC(): boolean;
setSupportsClassC(value: boolean): void;
getClassBTimeout(): number;
setClassBTimeout(value: number): void;
getClassBPingSlotPeriod(): number;
setClassBPingSlotPeriod(value: number): void;
getClassBPingSlotDr(): number;
setClassBPingSlotDr(value: number): void;
getClassBPingSlotFreq(): number;
setClassBPingSlotFreq(value: number): void;
getClassCTimeout(): number;
setClassCTimeout(value: number): void;
getAbpRx1Delay(): number;
setAbpRx1Delay(value: number): void;
getAbpRx1DrOffset(): number;
setAbpRx1DrOffset(value: number): void;
getAbpRx2Dr(): number;
setAbpRx2Dr(value: number): void;
getAbpRx2Freq(): number;
setAbpRx2Freq(value: number): void;
getTagsMap(): jspb.Map<string, string>;
clearTagsMap(): void;
getMeasurementsMap(): jspb.Map<string, api_device_profile_pb.Measurement>;
clearMeasurementsMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceProfileTemplate.AsObject;
static toObject(includeInstance: boolean, msg: DeviceProfileTemplate): DeviceProfileTemplate.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeviceProfileTemplate, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceProfileTemplate;
static deserializeBinaryFromReader(message: DeviceProfileTemplate, reader: jspb.BinaryReader): DeviceProfileTemplate;
}
export namespace DeviceProfileTemplate {
export type AsObject = {
id: string,
name: string,
description: string,
vendor: string,
firmware: string,
region: common_common_pb.RegionMap[keyof common_common_pb.RegionMap],
macVersion: common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap],
regParamsRevision: common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap],
adrAlgorithmId: string,
payloadCodecRuntime: api_device_profile_pb.CodecRuntimeMap[keyof api_device_profile_pb.CodecRuntimeMap],
payloadCodecScript: string,
flushQueueOnActivate: boolean,
uplinkInterval: number,
deviceStatusReqInterval: number,
supportsOtaa: boolean,
supportsClassB: boolean,
supportsClassC: boolean,
classBTimeout: number,
classBPingSlotPeriod: number,
classBPingSlotDr: number,
classBPingSlotFreq: number,
classCTimeout: number,
abpRx1Delay: number,
abpRx1DrOffset: number,
abpRx2Dr: number,
abpRx2Freq: number,
tagsMap: Array<[string, string]>,
measurementsMap: Array<[string, api_device_profile_pb.Measurement.AsObject]>,
}
}
export class DeviceProfileTemplateListItem extends jspb.Message {
getId(): string;
setId(value: string): void;
hasCreatedAt(): boolean;
clearCreatedAt(): void;
getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasUpdatedAt(): boolean;
clearUpdatedAt(): void;
getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): void;
getName(): string;
setName(value: string): void;
getVendor(): string;
setVendor(value: string): void;
getFirmware(): string;
setFirmware(value: string): void;
getRegion(): common_common_pb.RegionMap[keyof common_common_pb.RegionMap];
setRegion(value: common_common_pb.RegionMap[keyof common_common_pb.RegionMap]): void;
getMacVersion(): common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap];
setMacVersion(value: common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap]): void;
getRegParamsRevision(): common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap];
setRegParamsRevision(value: common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap]): void;
getSupportsOtaa(): boolean;
setSupportsOtaa(value: boolean): void;
getSupportsClassB(): boolean;
setSupportsClassB(value: boolean): void;
getSupportsClassC(): boolean;
setSupportsClassC(value: boolean): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeviceProfileTemplateListItem.AsObject;
static toObject(includeInstance: boolean, msg: DeviceProfileTemplateListItem): DeviceProfileTemplateListItem.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeviceProfileTemplateListItem, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeviceProfileTemplateListItem;
static deserializeBinaryFromReader(message: DeviceProfileTemplateListItem, reader: jspb.BinaryReader): DeviceProfileTemplateListItem;
}
export namespace DeviceProfileTemplateListItem {
export type AsObject = {
id: string,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
name: string,
vendor: string,
firmware: string,
region: common_common_pb.RegionMap[keyof common_common_pb.RegionMap],
macVersion: common_common_pb.MacVersionMap[keyof common_common_pb.MacVersionMap],
regParamsRevision: common_common_pb.RegParamsRevisionMap[keyof common_common_pb.RegParamsRevisionMap],
supportsOtaa: boolean,
supportsClassB: boolean,
supportsClassC: boolean,
}
}
export class CreateDeviceProfileTemplateRequest extends jspb.Message {
hasDeviceProfileTemplate(): boolean;
clearDeviceProfileTemplate(): void;
getDeviceProfileTemplate(): DeviceProfileTemplate | undefined;
setDeviceProfileTemplate(value?: DeviceProfileTemplate): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateDeviceProfileTemplateRequest): CreateDeviceProfileTemplateRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: CreateDeviceProfileTemplateRequest, reader: jspb.BinaryReader): CreateDeviceProfileTemplateRequest;
}
export namespace CreateDeviceProfileTemplateRequest {
export type AsObject = {
deviceProfileTemplate?: DeviceProfileTemplate.AsObject,
}
}
export class GetDeviceProfileTemplateRequest extends jspb.Message {
getId(): string;
setId(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceProfileTemplateRequest): GetDeviceProfileTemplateRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: GetDeviceProfileTemplateRequest, reader: jspb.BinaryReader): GetDeviceProfileTemplateRequest;
}
export namespace GetDeviceProfileTemplateRequest {
export type AsObject = {
id: string,
}
}
export class GetDeviceProfileTemplateResponse extends jspb.Message {
hasDeviceProfileTemplate(): boolean;
clearDeviceProfileTemplate(): void;
getDeviceProfileTemplate(): DeviceProfileTemplate | undefined;
setDeviceProfileTemplate(value?: DeviceProfileTemplate): void;
hasCreatedAt(): boolean;
clearCreatedAt(): void;
getCreatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreatedAt(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasUpdatedAt(): boolean;
clearUpdatedAt(): void;
getUpdatedAt(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdatedAt(value?: google_protobuf_timestamp_pb.Timestamp): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetDeviceProfileTemplateResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetDeviceProfileTemplateResponse): GetDeviceProfileTemplateResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetDeviceProfileTemplateResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetDeviceProfileTemplateResponse;
static deserializeBinaryFromReader(message: GetDeviceProfileTemplateResponse, reader: jspb.BinaryReader): GetDeviceProfileTemplateResponse;
}
export namespace GetDeviceProfileTemplateResponse {
export type AsObject = {
deviceProfileTemplate?: DeviceProfileTemplate.AsObject,
createdAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updatedAt?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
export class UpdateDeviceProfileTemplateRequest extends jspb.Message {
hasDeviceProfileTemplate(): boolean;
clearDeviceProfileTemplate(): void;
getDeviceProfileTemplate(): DeviceProfileTemplate | undefined;
setDeviceProfileTemplate(value?: DeviceProfileTemplate): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): UpdateDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: UpdateDeviceProfileTemplateRequest): UpdateDeviceProfileTemplateRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: UpdateDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): UpdateDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: UpdateDeviceProfileTemplateRequest, reader: jspb.BinaryReader): UpdateDeviceProfileTemplateRequest;
}
export namespace UpdateDeviceProfileTemplateRequest {
export type AsObject = {
deviceProfileTemplate?: DeviceProfileTemplate.AsObject,
}
}
export class DeleteDeviceProfileTemplateRequest extends jspb.Message {
getId(): string;
setId(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DeleteDeviceProfileTemplateRequest.AsObject;
static toObject(includeInstance: boolean, msg: DeleteDeviceProfileTemplateRequest): DeleteDeviceProfileTemplateRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: DeleteDeviceProfileTemplateRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): DeleteDeviceProfileTemplateRequest;
static deserializeBinaryFromReader(message: DeleteDeviceProfileTemplateRequest, reader: jspb.BinaryReader): DeleteDeviceProfileTemplateRequest;
}
export namespace DeleteDeviceProfileTemplateRequest {
export type AsObject = {
id: string,
}
}
export class ListDeviceProfileTemplatesRequest extends jspb.Message {
getLimit(): number;
setLimit(value: number): void;
getOffset(): number;
setOffset(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListDeviceProfileTemplatesRequest.AsObject;
static toObject(includeInstance: boolean, msg: ListDeviceProfileTemplatesRequest): ListDeviceProfileTemplatesRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListDeviceProfileTemplatesRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListDeviceProfileTemplatesRequest;
static deserializeBinaryFromReader(message: ListDeviceProfileTemplatesRequest, reader: jspb.BinaryReader): ListDeviceProfileTemplatesRequest;
}
export namespace ListDeviceProfileTemplatesRequest {
export type AsObject = {
limit: number,
offset: number,
}
}
export class ListDeviceProfileTemplatesResponse extends jspb.Message {
getTotalCount(): number;
setTotalCount(value: number): void;
clearResultList(): void;
getResultList(): Array<DeviceProfileTemplateListItem>;
setResultList(value: Array<DeviceProfileTemplateListItem>): void;
addResult(value?: DeviceProfileTemplateListItem, index?: number): DeviceProfileTemplateListItem;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ListDeviceProfileTemplatesResponse.AsObject;
static toObject(includeInstance: boolean, msg: ListDeviceProfileTemplatesResponse): ListDeviceProfileTemplatesResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ListDeviceProfileTemplatesResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ListDeviceProfileTemplatesResponse;
static deserializeBinaryFromReader(message: ListDeviceProfileTemplatesResponse, reader: jspb.BinaryReader): ListDeviceProfileTemplatesResponse;
}
export namespace ListDeviceProfileTemplatesResponse {
export type AsObject = {
totalCount: number,
resultList: Array<DeviceProfileTemplateListItem.AsObject>,
}
}

2736
api/js/api/device_profile_template_pb.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ interface IGatewayServiceService extends grpc.ServiceDefinition<grpc.UntypedServ
delete: grpc.MethodDefinition<api_gateway_pb.DeleteGatewayRequest, google_protobuf_empty_pb.Empty>;
list: grpc.MethodDefinition<api_gateway_pb.ListGatewaysRequest, api_gateway_pb.ListGatewaysResponse>;
generateClientCertificate: grpc.MethodDefinition<api_gateway_pb.GenerateGatewayClientCertificateRequest, api_gateway_pb.GenerateGatewayClientCertificateResponse>;
getStats: grpc.MethodDefinition<api_gateway_pb.GetGatewayStatsRequest, api_gateway_pb.GetGatewayStatsResponse>;
getMetrics: grpc.MethodDefinition<api_gateway_pb.GetGatewayMetricsRequest, api_gateway_pb.GetGatewayMetricsResponse>;
}
export const GatewayServiceService: IGatewayServiceService;
@ -26,7 +26,7 @@ export interface IGatewayServiceServer extends grpc.UntypedServiceImplementation
delete: grpc.handleUnaryCall<api_gateway_pb.DeleteGatewayRequest, google_protobuf_empty_pb.Empty>;
list: grpc.handleUnaryCall<api_gateway_pb.ListGatewaysRequest, api_gateway_pb.ListGatewaysResponse>;
generateClientCertificate: grpc.handleUnaryCall<api_gateway_pb.GenerateGatewayClientCertificateRequest, api_gateway_pb.GenerateGatewayClientCertificateResponse>;
getStats: grpc.handleUnaryCall<api_gateway_pb.GetGatewayStatsRequest, api_gateway_pb.GetGatewayStatsResponse>;
getMetrics: grpc.handleUnaryCall<api_gateway_pb.GetGatewayMetricsRequest, api_gateway_pb.GetGatewayMetricsResponse>;
}
export class GatewayServiceClient extends grpc.Client {
@ -49,7 +49,7 @@ export class GatewayServiceClient extends grpc.Client {
generateClientCertificate(argument: api_gateway_pb.GenerateGatewayClientCertificateRequest, callback: grpc.requestCallback<api_gateway_pb.GenerateGatewayClientCertificateResponse>): grpc.ClientUnaryCall;
generateClientCertificate(argument: api_gateway_pb.GenerateGatewayClientCertificateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_gateway_pb.GenerateGatewayClientCertificateResponse>): grpc.ClientUnaryCall;
generateClientCertificate(argument: api_gateway_pb.GenerateGatewayClientCertificateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_gateway_pb.GenerateGatewayClientCertificateResponse>): grpc.ClientUnaryCall;
getStats(argument: api_gateway_pb.GetGatewayStatsRequest, callback: grpc.requestCallback<api_gateway_pb.GetGatewayStatsResponse>): grpc.ClientUnaryCall;
getStats(argument: api_gateway_pb.GetGatewayStatsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_gateway_pb.GetGatewayStatsResponse>): grpc.ClientUnaryCall;
getStats(argument: api_gateway_pb.GetGatewayStatsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_gateway_pb.GetGatewayStatsResponse>): grpc.ClientUnaryCall;
getMetrics(argument: api_gateway_pb.GetGatewayMetricsRequest, callback: grpc.requestCallback<api_gateway_pb.GetGatewayMetricsResponse>): grpc.ClientUnaryCall;
getMetrics(argument: api_gateway_pb.GetGatewayMetricsRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<api_gateway_pb.GetGatewayMetricsResponse>): grpc.ClientUnaryCall;
getMetrics(argument: api_gateway_pb.GetGatewayMetricsRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<api_gateway_pb.GetGatewayMetricsResponse>): grpc.ClientUnaryCall;
}

View File

@ -51,6 +51,28 @@ function deserialize_api_GenerateGatewayClientCertificateResponse(buffer_arg) {
return api_gateway_pb.GenerateGatewayClientCertificateResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetGatewayMetricsRequest(arg) {
if (!(arg instanceof api_gateway_pb.GetGatewayMetricsRequest)) {
throw new Error('Expected argument of type api.GetGatewayMetricsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetGatewayMetricsRequest(buffer_arg) {
return api_gateway_pb.GetGatewayMetricsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetGatewayMetricsResponse(arg) {
if (!(arg instanceof api_gateway_pb.GetGatewayMetricsResponse)) {
throw new Error('Expected argument of type api.GetGatewayMetricsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetGatewayMetricsResponse(buffer_arg) {
return api_gateway_pb.GetGatewayMetricsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetGatewayRequest(arg) {
if (!(arg instanceof api_gateway_pb.GetGatewayRequest)) {
throw new Error('Expected argument of type api.GetGatewayRequest');
@ -73,28 +95,6 @@ function deserialize_api_GetGatewayResponse(buffer_arg) {
return api_gateway_pb.GetGatewayResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetGatewayStatsRequest(arg) {
if (!(arg instanceof api_gateway_pb.GetGatewayStatsRequest)) {
throw new Error('Expected argument of type api.GetGatewayStatsRequest');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetGatewayStatsRequest(buffer_arg) {
return api_gateway_pb.GetGatewayStatsRequest.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_GetGatewayStatsResponse(arg) {
if (!(arg instanceof api_gateway_pb.GetGatewayStatsResponse)) {
throw new Error('Expected argument of type api.GetGatewayStatsResponse');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_api_GetGatewayStatsResponse(buffer_arg) {
return api_gateway_pb.GetGatewayStatsResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_api_ListGatewaysRequest(arg) {
if (!(arg instanceof api_gateway_pb.ListGatewaysRequest)) {
throw new Error('Expected argument of type api.ListGatewaysRequest');
@ -214,17 +214,17 @@ generateClientCertificate: {
responseSerialize: serialize_api_GenerateGatewayClientCertificateResponse,
responseDeserialize: deserialize_api_GenerateGatewayClientCertificateResponse,
},
// GetStats returns the gateway stats.
getStats: {
path: '/api.GatewayService/GetStats',
// GetMetrics returns the gateway metrics.
getMetrics: {
path: '/api.GatewayService/GetMetrics',
requestStream: false,
responseStream: false,
requestType: api_gateway_pb.GetGatewayStatsRequest,
responseType: api_gateway_pb.GetGatewayStatsResponse,
requestSerialize: serialize_api_GetGatewayStatsRequest,
requestDeserialize: deserialize_api_GetGatewayStatsRequest,
responseSerialize: serialize_api_GetGatewayStatsResponse,
responseDeserialize: deserialize_api_GetGatewayStatsResponse,
requestType: api_gateway_pb.GetGatewayMetricsRequest,
responseType: api_gateway_pb.GetGatewayMetricsResponse,
requestSerialize: serialize_api_GetGatewayMetricsRequest,
requestDeserialize: deserialize_api_GetGatewayMetricsRequest,
responseSerialize: serialize_api_GetGatewayMetricsResponse,
responseDeserialize: deserialize_api_GetGatewayMetricsResponse,
},
};

View File

@ -345,7 +345,7 @@ export namespace GenerateGatewayClientCertificateResponse {
}
}
export class GetGatewayStatsRequest extends jspb.Message {
export class GetGatewayMetricsRequest extends jspb.Message {
getGatewayId(): string;
setGatewayId(value: string): void;
@ -359,88 +359,83 @@ export class GetGatewayStatsRequest extends jspb.Message {
getEnd(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEnd(value?: google_protobuf_timestamp_pb.Timestamp): void;
getAggregation(): common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap];
setAggregation(value: common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetGatewayStatsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayStatsRequest): GetGatewayStatsRequest.AsObject;
toObject(includeInstance?: boolean): GetGatewayMetricsRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayMetricsRequest): GetGatewayMetricsRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetGatewayStatsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayStatsRequest;
static deserializeBinaryFromReader(message: GetGatewayStatsRequest, reader: jspb.BinaryReader): GetGatewayStatsRequest;
static serializeBinaryToWriter(message: GetGatewayMetricsRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayMetricsRequest;
static deserializeBinaryFromReader(message: GetGatewayMetricsRequest, reader: jspb.BinaryReader): GetGatewayMetricsRequest;
}
export namespace GetGatewayStatsRequest {
export namespace GetGatewayMetricsRequest {
export type AsObject = {
gatewayId: string,
start?: google_protobuf_timestamp_pb.Timestamp.AsObject,
end?: google_protobuf_timestamp_pb.Timestamp.AsObject,
aggregation: common_common_pb.AggregationMap[keyof common_common_pb.AggregationMap],
}
}
export class GetGatewayStatsResponse extends jspb.Message {
clearResultList(): void;
getResultList(): Array<GatewayStats>;
setResultList(value: Array<GatewayStats>): void;
addResult(value?: GatewayStats, index?: number): GatewayStats;
export class GetGatewayMetricsResponse extends jspb.Message {
hasRxPackets(): boolean;
clearRxPackets(): void;
getRxPackets(): common_common_pb.Metric | undefined;
setRxPackets(value?: common_common_pb.Metric): void;
hasTxPackets(): boolean;
clearTxPackets(): void;
getTxPackets(): common_common_pb.Metric | undefined;
setTxPackets(value?: common_common_pb.Metric): void;
hasTxPacketsPerFreq(): boolean;
clearTxPacketsPerFreq(): void;
getTxPacketsPerFreq(): common_common_pb.Metric | undefined;
setTxPacketsPerFreq(value?: common_common_pb.Metric): void;
hasRxPacketsPerFreq(): boolean;
clearRxPacketsPerFreq(): void;
getRxPacketsPerFreq(): common_common_pb.Metric | undefined;
setRxPacketsPerFreq(value?: common_common_pb.Metric): void;
hasTxPacketsPerDr(): boolean;
clearTxPacketsPerDr(): void;
getTxPacketsPerDr(): common_common_pb.Metric | undefined;
setTxPacketsPerDr(value?: common_common_pb.Metric): void;
hasRxPacketsPerDr(): boolean;
clearRxPacketsPerDr(): void;
getRxPacketsPerDr(): common_common_pb.Metric | undefined;
setRxPacketsPerDr(value?: common_common_pb.Metric): void;
hasTxPacketsPerStatus(): boolean;
clearTxPacketsPerStatus(): void;
getTxPacketsPerStatus(): common_common_pb.Metric | undefined;
setTxPacketsPerStatus(value?: common_common_pb.Metric): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetGatewayStatsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayStatsResponse): GetGatewayStatsResponse.AsObject;
toObject(includeInstance?: boolean): GetGatewayMetricsResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetGatewayMetricsResponse): GetGatewayMetricsResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetGatewayStatsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayStatsResponse;
static deserializeBinaryFromReader(message: GetGatewayStatsResponse, reader: jspb.BinaryReader): GetGatewayStatsResponse;
static serializeBinaryToWriter(message: GetGatewayMetricsResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetGatewayMetricsResponse;
static deserializeBinaryFromReader(message: GetGatewayMetricsResponse, reader: jspb.BinaryReader): GetGatewayMetricsResponse;
}
export namespace GetGatewayStatsResponse {
export namespace GetGatewayMetricsResponse {
export type AsObject = {
resultList: Array<GatewayStats.AsObject>,
}
}
export class GatewayStats extends jspb.Message {
hasTime(): boolean;
clearTime(): void;
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
setTime(value?: google_protobuf_timestamp_pb.Timestamp): void;
getRxPackets(): number;
setRxPackets(value: number): void;
getTxPackets(): number;
setTxPackets(value: number): void;
getTxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearTxPacketsPerFrequencyMap(): void;
getRxPacketsPerFrequencyMap(): jspb.Map<number, number>;
clearRxPacketsPerFrequencyMap(): void;
getTxPacketsPerDrMap(): jspb.Map<number, number>;
clearTxPacketsPerDrMap(): void;
getRxPacketsPerDrMap(): jspb.Map<number, number>;
clearRxPacketsPerDrMap(): void;
getTxPacketsPerStatusMap(): jspb.Map<string, number>;
clearTxPacketsPerStatusMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GatewayStats.AsObject;
static toObject(includeInstance: boolean, msg: GatewayStats): GatewayStats.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GatewayStats, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GatewayStats;
static deserializeBinaryFromReader(message: GatewayStats, reader: jspb.BinaryReader): GatewayStats;
}
export namespace GatewayStats {
export type AsObject = {
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
rxPackets: number,
txPackets: number,
txPacketsPerFrequencyMap: Array<[number, number]>,
rxPacketsPerFrequencyMap: Array<[number, number]>,
txPacketsPerDrMap: Array<[number, number]>,
rxPacketsPerDrMap: Array<[number, number]>,
txPacketsPerStatusMap: Array<[string, number]>,
rxPackets?: common_common_pb.Metric.AsObject,
txPackets?: common_common_pb.Metric.AsObject,
txPacketsPerFreq?: common_common_pb.Metric.AsObject,
rxPacketsPerFreq?: common_common_pb.Metric.AsObject,
txPacketsPerDr?: common_common_pb.Metric.AsObject,
rxPacketsPerDr?: common_common_pb.Metric.AsObject,
txPacketsPerStatus?: common_common_pb.Metric.AsObject,
}
}

View File

@ -16,13 +16,12 @@ goog.exportSymbol('proto.api.CreateGatewayRequest', null, global);
goog.exportSymbol('proto.api.DeleteGatewayRequest', null, global);
goog.exportSymbol('proto.api.Gateway', null, global);
goog.exportSymbol('proto.api.GatewayListItem', null, global);
goog.exportSymbol('proto.api.GatewayStats', null, global);
goog.exportSymbol('proto.api.GenerateGatewayClientCertificateRequest', null, global);
goog.exportSymbol('proto.api.GenerateGatewayClientCertificateResponse', null, global);
goog.exportSymbol('proto.api.GetGatewayMetricsRequest', null, global);
goog.exportSymbol('proto.api.GetGatewayMetricsResponse', null, global);
goog.exportSymbol('proto.api.GetGatewayRequest', null, global);
goog.exportSymbol('proto.api.GetGatewayResponse', null, global);
goog.exportSymbol('proto.api.GetGatewayStatsRequest', null, global);
goog.exportSymbol('proto.api.GetGatewayStatsResponse', null, global);
goog.exportSymbol('proto.api.ListGatewaysRequest', null, global);
goog.exportSymbol('proto.api.ListGatewaysResponse', null, global);
goog.exportSymbol('proto.api.UpdateGatewayRequest', null, global);
@ -2648,12 +2647,12 @@ proto.api.GenerateGatewayClientCertificateResponse.prototype.hasExpiresAt = func
* @extends {jspb.Message}
* @constructor
*/
proto.api.GetGatewayStatsRequest = function(opt_data) {
proto.api.GetGatewayMetricsRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.GetGatewayStatsRequest, jspb.Message);
goog.inherits(proto.api.GetGatewayMetricsRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.api.GetGatewayStatsRequest.displayName = 'proto.api.GetGatewayStatsRequest';
proto.api.GetGatewayMetricsRequest.displayName = 'proto.api.GetGatewayMetricsRequest';
}
@ -2668,8 +2667,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.GetGatewayStatsRequest.prototype.toObject = function(opt_includeInstance) {
return proto.api.GetGatewayStatsRequest.toObject(opt_includeInstance, this);
proto.api.GetGatewayMetricsRequest.prototype.toObject = function(opt_includeInstance) {
return proto.api.GetGatewayMetricsRequest.toObject(opt_includeInstance, this);
};
@ -2678,14 +2677,15 @@ proto.api.GetGatewayStatsRequest.prototype.toObject = function(opt_includeInstan
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.GetGatewayStatsRequest} msg The msg instance to transform.
* @param {!proto.api.GetGatewayMetricsRequest} msg The msg instance to transform.
* @return {!Object}
*/
proto.api.GetGatewayStatsRequest.toObject = function(includeInstance, msg) {
proto.api.GetGatewayMetricsRequest.toObject = function(includeInstance, msg) {
var f, obj = {
gatewayId: msg.getGatewayId(),
start: (f = msg.getStart()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
end: (f = msg.getEnd()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f)
end: (f = msg.getEnd()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
aggregation: msg.getAggregation()
};
if (includeInstance) {
@ -2699,23 +2699,23 @@ proto.api.GetGatewayStatsRequest.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.GetGatewayStatsRequest}
* @return {!proto.api.GetGatewayMetricsRequest}
*/
proto.api.GetGatewayStatsRequest.deserializeBinary = function(bytes) {
proto.api.GetGatewayMetricsRequest.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.GetGatewayStatsRequest;
return proto.api.GetGatewayStatsRequest.deserializeBinaryFromReader(msg, reader);
var msg = new proto.api.GetGatewayMetricsRequest;
return proto.api.GetGatewayMetricsRequest.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.GetGatewayStatsRequest} msg The message object to deserialize into.
* @param {!proto.api.GetGatewayMetricsRequest} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.GetGatewayStatsRequest}
* @return {!proto.api.GetGatewayMetricsRequest}
*/
proto.api.GetGatewayStatsRequest.deserializeBinaryFromReader = function(msg, reader) {
proto.api.GetGatewayMetricsRequest.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -2736,6 +2736,10 @@ proto.api.GetGatewayStatsRequest.deserializeBinaryFromReader = function(msg, rea
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.setEnd(value);
break;
case 4:
var value = /** @type {!proto.common.Aggregation} */ (reader.readEnum());
msg.setAggregation(value);
break;
default:
reader.skipField();
break;
@ -2748,10 +2752,10 @@ proto.api.GetGatewayStatsRequest.deserializeBinaryFromReader = function(msg, rea
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.api.GetGatewayStatsRequest} message
* @param {!proto.api.GetGatewayMetricsRequest} message
* @param {!jspb.BinaryWriter} writer
*/
proto.api.GetGatewayStatsRequest.serializeBinaryToWriter = function(message, writer) {
proto.api.GetGatewayMetricsRequest.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
@ -2760,7 +2764,7 @@ proto.api.GetGatewayStatsRequest.serializeBinaryToWriter = function(message, wri
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.GetGatewayStatsRequest.prototype.serializeBinary = function() {
proto.api.GetGatewayMetricsRequest.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
@ -2772,7 +2776,7 @@ proto.api.GetGatewayStatsRequest.prototype.serializeBinary = function() {
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.api.GetGatewayStatsRequest.prototype.serializeBinaryToWriter = function (writer) {
proto.api.GetGatewayMetricsRequest.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getGatewayId();
if (f.length > 0) {
@ -2797,15 +2801,22 @@ proto.api.GetGatewayStatsRequest.prototype.serializeBinaryToWriter = function (w
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = this.getAggregation();
if (f !== 0.0) {
writer.writeEnum(
4,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.api.GetGatewayStatsRequest} The clone.
* @return {!proto.api.GetGatewayMetricsRequest} The clone.
*/
proto.api.GetGatewayStatsRequest.prototype.cloneMessage = function() {
return /** @type {!proto.api.GetGatewayStatsRequest} */ (jspb.Message.cloneMessage(this));
proto.api.GetGatewayMetricsRequest.prototype.cloneMessage = function() {
return /** @type {!proto.api.GetGatewayMetricsRequest} */ (jspb.Message.cloneMessage(this));
};
@ -2813,13 +2824,13 @@ proto.api.GetGatewayStatsRequest.prototype.cloneMessage = function() {
* optional string gateway_id = 1;
* @return {string}
*/
proto.api.GetGatewayStatsRequest.prototype.getGatewayId = function() {
proto.api.GetGatewayMetricsRequest.prototype.getGatewayId = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
};
/** @param {string} value */
proto.api.GetGatewayStatsRequest.prototype.setGatewayId = function(value) {
proto.api.GetGatewayMetricsRequest.prototype.setGatewayId = function(value) {
jspb.Message.setField(this, 1, value);
};
@ -2828,19 +2839,19 @@ proto.api.GetGatewayStatsRequest.prototype.setGatewayId = function(value) {
* optional google.protobuf.Timestamp start = 2;
* @return {proto.google.protobuf.Timestamp}
*/
proto.api.GetGatewayStatsRequest.prototype.getStart = function() {
proto.api.GetGatewayMetricsRequest.prototype.getStart = function() {
return /** @type{proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2));
};
/** @param {proto.google.protobuf.Timestamp|undefined} value */
proto.api.GetGatewayStatsRequest.prototype.setStart = function(value) {
proto.api.GetGatewayMetricsRequest.prototype.setStart = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
proto.api.GetGatewayStatsRequest.prototype.clearStart = function() {
proto.api.GetGatewayMetricsRequest.prototype.clearStart = function() {
this.setStart(undefined);
};
@ -2849,7 +2860,7 @@ proto.api.GetGatewayStatsRequest.prototype.clearStart = function() {
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GetGatewayStatsRequest.prototype.hasStart = function() {
proto.api.GetGatewayMetricsRequest.prototype.hasStart = function() {
return jspb.Message.getField(this, 2) != null;
};
@ -2858,19 +2869,19 @@ proto.api.GetGatewayStatsRequest.prototype.hasStart = function() {
* optional google.protobuf.Timestamp end = 3;
* @return {proto.google.protobuf.Timestamp}
*/
proto.api.GetGatewayStatsRequest.prototype.getEnd = function() {
proto.api.GetGatewayMetricsRequest.prototype.getEnd = function() {
return /** @type{proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3));
};
/** @param {proto.google.protobuf.Timestamp|undefined} value */
proto.api.GetGatewayStatsRequest.prototype.setEnd = function(value) {
proto.api.GetGatewayMetricsRequest.prototype.setEnd = function(value) {
jspb.Message.setWrapperField(this, 3, value);
};
proto.api.GetGatewayStatsRequest.prototype.clearEnd = function() {
proto.api.GetGatewayMetricsRequest.prototype.clearEnd = function() {
this.setEnd(undefined);
};
@ -2879,186 +2890,23 @@ proto.api.GetGatewayStatsRequest.prototype.clearEnd = function() {
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GetGatewayStatsRequest.prototype.hasEnd = function() {
proto.api.GetGatewayMetricsRequest.prototype.hasEnd = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
* optional common.Aggregation aggregation = 4;
* @return {!proto.common.Aggregation}
*/
proto.api.GetGatewayStatsResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.api.GetGatewayStatsResponse.repeatedFields_, null);
};
goog.inherits(proto.api.GetGatewayStatsResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.api.GetGatewayStatsResponse.displayName = 'proto.api.GetGatewayStatsResponse';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.api.GetGatewayStatsResponse.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.GetGatewayStatsResponse.prototype.toObject = function(opt_includeInstance) {
return proto.api.GetGatewayStatsResponse.toObject(opt_includeInstance, this);
proto.api.GetGatewayMetricsRequest.prototype.getAggregation = function() {
return /** @type {!proto.common.Aggregation} */ (jspb.Message.getFieldProto3(this, 4, 0));
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.GetGatewayStatsResponse} msg The msg instance to transform.
* @return {!Object}
*/
proto.api.GetGatewayStatsResponse.toObject = function(includeInstance, msg) {
var f, obj = {
resultList: jspb.Message.toObjectList(msg.getResultList(),
proto.api.GatewayStats.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.GetGatewayStatsResponse}
*/
proto.api.GetGatewayStatsResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.GetGatewayStatsResponse;
return proto.api.GetGatewayStatsResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.GetGatewayStatsResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.GetGatewayStatsResponse}
*/
proto.api.GetGatewayStatsResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.api.GatewayStats;
reader.readMessage(value,proto.api.GatewayStats.deserializeBinaryFromReader);
msg.getResultList().push(value);
msg.setResultList(msg.getResultList());
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.api.GetGatewayStatsResponse} message
* @param {!jspb.BinaryWriter} writer
*/
proto.api.GetGatewayStatsResponse.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.GetGatewayStatsResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.api.GetGatewayStatsResponse.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getResultList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.api.GatewayStats.serializeBinaryToWriter
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.api.GetGatewayStatsResponse} The clone.
*/
proto.api.GetGatewayStatsResponse.prototype.cloneMessage = function() {
return /** @type {!proto.api.GetGatewayStatsResponse} */ (jspb.Message.cloneMessage(this));
};
/**
* repeated GatewayStats result = 1;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<!proto.api.GatewayStats>}
*/
proto.api.GetGatewayStatsResponse.prototype.getResultList = function() {
return /** @type{!Array.<!proto.api.GatewayStats>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.api.GatewayStats, 1));
};
/** @param {Array.<!proto.api.GatewayStats>} value */
proto.api.GetGatewayStatsResponse.prototype.setResultList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 1, value);
};
proto.api.GetGatewayStatsResponse.prototype.clearResultList = function() {
this.setResultList([]);
/** @param {!proto.common.Aggregation} value */
proto.api.GetGatewayMetricsRequest.prototype.setAggregation = function(value) {
jspb.Message.setField(this, 4, value);
};
@ -3073,12 +2921,12 @@ proto.api.GetGatewayStatsResponse.prototype.clearResultList = function() {
* @extends {jspb.Message}
* @constructor
*/
proto.api.GatewayStats = function(opt_data) {
proto.api.GetGatewayMetricsResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.GatewayStats, jspb.Message);
goog.inherits(proto.api.GetGatewayMetricsResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.api.GatewayStats.displayName = 'proto.api.GatewayStats';
proto.api.GetGatewayMetricsResponse.displayName = 'proto.api.GetGatewayMetricsResponse';
}
@ -3093,8 +2941,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) {
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.api.GatewayStats.prototype.toObject = function(opt_includeInstance) {
return proto.api.GatewayStats.toObject(opt_includeInstance, this);
proto.api.GetGatewayMetricsResponse.prototype.toObject = function(opt_includeInstance) {
return proto.api.GetGatewayMetricsResponse.toObject(opt_includeInstance, this);
};
@ -3103,19 +2951,18 @@ proto.api.GatewayStats.prototype.toObject = function(opt_includeInstance) {
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.api.GatewayStats} msg The msg instance to transform.
* @param {!proto.api.GetGatewayMetricsResponse} msg The msg instance to transform.
* @return {!Object}
*/
proto.api.GatewayStats.toObject = function(includeInstance, msg) {
proto.api.GetGatewayMetricsResponse.toObject = function(includeInstance, msg) {
var f, obj = {
time: (f = msg.getTime()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f),
rxPackets: msg.getRxPackets(),
txPackets: msg.getTxPackets(),
txPacketsPerFrequencyMap: (f = msg.getTxPacketsPerFrequencyMap(true)) ? f.toArray() : [],
rxPacketsPerFrequencyMap: (f = msg.getRxPacketsPerFrequencyMap(true)) ? f.toArray() : [],
txPacketsPerDrMap: (f = msg.getTxPacketsPerDrMap(true)) ? f.toArray() : [],
rxPacketsPerDrMap: (f = msg.getRxPacketsPerDrMap(true)) ? f.toArray() : [],
txPacketsPerStatusMap: (f = msg.getTxPacketsPerStatusMap(true)) ? f.toArray() : []
rxPackets: (f = msg.getRxPackets()) && common_common_pb.Metric.toObject(includeInstance, f),
txPackets: (f = msg.getTxPackets()) && common_common_pb.Metric.toObject(includeInstance, f),
txPacketsPerFreq: (f = msg.getTxPacketsPerFreq()) && common_common_pb.Metric.toObject(includeInstance, f),
rxPacketsPerFreq: (f = msg.getRxPacketsPerFreq()) && common_common_pb.Metric.toObject(includeInstance, f),
txPacketsPerDr: (f = msg.getTxPacketsPerDr()) && common_common_pb.Metric.toObject(includeInstance, f),
rxPacketsPerDr: (f = msg.getRxPacketsPerDr()) && common_common_pb.Metric.toObject(includeInstance, f),
txPacketsPerStatus: (f = msg.getTxPacketsPerStatus()) && common_common_pb.Metric.toObject(includeInstance, f)
};
if (includeInstance) {
@ -3129,23 +2976,23 @@ proto.api.GatewayStats.toObject = function(includeInstance, msg) {
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.api.GatewayStats}
* @return {!proto.api.GetGatewayMetricsResponse}
*/
proto.api.GatewayStats.deserializeBinary = function(bytes) {
proto.api.GetGatewayMetricsResponse.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.api.GatewayStats;
return proto.api.GatewayStats.deserializeBinaryFromReader(msg, reader);
var msg = new proto.api.GetGatewayMetricsResponse;
return proto.api.GetGatewayMetricsResponse.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.api.GatewayStats} msg The message object to deserialize into.
* @param {!proto.api.GetGatewayMetricsResponse} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.api.GatewayStats}
* @return {!proto.api.GetGatewayMetricsResponse}
*/
proto.api.GatewayStats.deserializeBinaryFromReader = function(msg, reader) {
proto.api.GetGatewayMetricsResponse.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
@ -3153,47 +3000,39 @@ proto.api.GatewayStats.deserializeBinaryFromReader = function(msg, reader) {
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.setTime(value);
break;
case 2:
var value = /** @type {number} */ (reader.readUint32());
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setRxPackets(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint32());
case 2:
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setTxPackets(value);
break;
case 3:
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setTxPacketsPerFreq(value);
break;
case 4:
var value = msg.getTxPacketsPerFrequencyMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readUint32);
});
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setRxPacketsPerFreq(value);
break;
case 5:
var value = msg.getRxPacketsPerFrequencyMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readUint32);
});
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setTxPacketsPerDr(value);
break;
case 6:
var value = msg.getTxPacketsPerDrMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readUint32);
});
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setRxPacketsPerDr(value);
break;
case 7:
var value = msg.getRxPacketsPerDrMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readUint32, jspb.BinaryReader.prototype.readUint32);
});
break;
case 8:
var value = msg.getTxPacketsPerStatusMap();
reader.readMessage(value, function(message, reader) {
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readUint32);
});
var value = new common_common_pb.Metric;
reader.readMessage(value,common_common_pb.Metric.deserializeBinaryFromReader);
msg.setTxPacketsPerStatus(value);
break;
default:
reader.skipField();
@ -3207,10 +3046,10 @@ proto.api.GatewayStats.deserializeBinaryFromReader = function(msg, reader) {
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.api.GatewayStats} message
* @param {!proto.api.GetGatewayMetricsResponse} message
* @param {!jspb.BinaryWriter} writer
*/
proto.api.GatewayStats.serializeBinaryToWriter = function(message, writer) {
proto.api.GetGatewayMetricsResponse.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
@ -3219,7 +3058,7 @@ proto.api.GatewayStats.serializeBinaryToWriter = function(message, writer) {
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.api.GatewayStats.prototype.serializeBinary = function() {
proto.api.GetGatewayMetricsResponse.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
@ -3231,80 +3070,94 @@ proto.api.GatewayStats.prototype.serializeBinary = function() {
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.api.GatewayStats.prototype.serializeBinaryToWriter = function (writer) {
proto.api.GetGatewayMetricsResponse.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getTime();
f = this.getRxPackets();
if (f != null) {
writer.writeMessage(
1,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = this.getRxPackets();
if (f !== 0) {
writer.writeUint32(
2,
f
common_common_pb.Metric.serializeBinaryToWriter
);
}
f = this.getTxPackets();
if (f !== 0) {
writer.writeUint32(
3,
f
if (f != null) {
writer.writeMessage(
2,
f,
common_common_pb.Metric.serializeBinaryToWriter
);
}
f = this.getTxPacketsPerFrequencyMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeUint32);
f = this.getTxPacketsPerFreq();
if (f != null) {
writer.writeMessage(
3,
f,
common_common_pb.Metric.serializeBinaryToWriter
);
}
f = this.getRxPacketsPerFrequencyMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeUint32);
f = this.getRxPacketsPerFreq();
if (f != null) {
writer.writeMessage(
4,
f,
common_common_pb.Metric.serializeBinaryToWriter
);
}
f = this.getTxPacketsPerDrMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeUint32);
f = this.getTxPacketsPerDr();
if (f != null) {
writer.writeMessage(
5,
f,
common_common_pb.Metric.serializeBinaryToWriter
);
}
f = this.getRxPacketsPerDrMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeUint32, jspb.BinaryWriter.prototype.writeUint32);
f = this.getRxPacketsPerDr();
if (f != null) {
writer.writeMessage(
6,
f,
common_common_pb.Metric.serializeBinaryToWriter
);
}
f = this.getTxPacketsPerStatusMap(true);
if (f && f.getLength() > 0) {
f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeUint32);
f = this.getTxPacketsPerStatus();
if (f != null) {
writer.writeMessage(
7,
f,
common_common_pb.Metric.serializeBinaryToWriter
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.api.GatewayStats} The clone.
* @return {!proto.api.GetGatewayMetricsResponse} The clone.
*/
proto.api.GatewayStats.prototype.cloneMessage = function() {
return /** @type {!proto.api.GatewayStats} */ (jspb.Message.cloneMessage(this));
proto.api.GetGatewayMetricsResponse.prototype.cloneMessage = function() {
return /** @type {!proto.api.GetGatewayMetricsResponse} */ (jspb.Message.cloneMessage(this));
};
/**
* optional google.protobuf.Timestamp time = 1;
* @return {proto.google.protobuf.Timestamp}
* optional common.Metric rx_packets = 1;
* @return {proto.common.Metric}
*/
proto.api.GatewayStats.prototype.getTime = function() {
return /** @type{proto.google.protobuf.Timestamp} */ (
jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 1));
proto.api.GetGatewayMetricsResponse.prototype.getRxPackets = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 1));
};
/** @param {proto.google.protobuf.Timestamp|undefined} value */
proto.api.GatewayStats.prototype.setTime = function(value) {
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setRxPackets = function(value) {
jspb.Message.setWrapperField(this, 1, value);
};
proto.api.GatewayStats.prototype.clearTime = function() {
this.setTime(undefined);
proto.api.GetGatewayMetricsResponse.prototype.clearRxPackets = function() {
this.setRxPackets(undefined);
};
@ -3312,103 +3165,188 @@ proto.api.GatewayStats.prototype.clearTime = function() {
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GatewayStats.prototype.hasTime = function() {
proto.api.GetGatewayMetricsResponse.prototype.hasRxPackets = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional uint32 rx_packets = 2;
* @return {number}
* optional common.Metric tx_packets = 2;
* @return {proto.common.Metric}
*/
proto.api.GatewayStats.prototype.getRxPackets = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0));
proto.api.GetGatewayMetricsResponse.prototype.getTxPackets = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 2));
};
/** @param {number} value */
proto.api.GatewayStats.prototype.setRxPackets = function(value) {
jspb.Message.setField(this, 2, value);
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setTxPackets = function(value) {
jspb.Message.setWrapperField(this, 2, value);
};
proto.api.GetGatewayMetricsResponse.prototype.clearTxPackets = function() {
this.setTxPackets(undefined);
};
/**
* optional uint32 tx_packets = 3;
* @return {number}
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GatewayStats.prototype.getTxPackets = function() {
return /** @type {number} */ (jspb.Message.getFieldProto3(this, 3, 0));
};
/** @param {number} value */
proto.api.GatewayStats.prototype.setTxPackets = function(value) {
jspb.Message.setField(this, 3, value);
proto.api.GetGatewayMetricsResponse.prototype.hasTxPackets = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* map<uint32, uint32> tx_packets_per_frequency = 4;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<number,number>}
* optional common.Metric tx_packets_per_freq = 3;
* @return {proto.common.Metric}
*/
proto.api.GatewayStats.prototype.getTxPacketsPerFrequencyMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<number,number>} */ (
jspb.Message.getMapField(this, 4, opt_noLazyCreate,
null));
proto.api.GetGatewayMetricsResponse.prototype.getTxPacketsPerFreq = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 3));
};
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setTxPacketsPerFreq = function(value) {
jspb.Message.setWrapperField(this, 3, value);
};
proto.api.GetGatewayMetricsResponse.prototype.clearTxPacketsPerFreq = function() {
this.setTxPacketsPerFreq(undefined);
};
/**
* map<uint32, uint32> rx_packets_per_frequency = 5;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<number,number>}
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GatewayStats.prototype.getRxPacketsPerFrequencyMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<number,number>} */ (
jspb.Message.getMapField(this, 5, opt_noLazyCreate,
null));
proto.api.GetGatewayMetricsResponse.prototype.hasTxPacketsPerFreq = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* map<uint32, uint32> tx_packets_per_dr = 6;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<number,number>}
* optional common.Metric rx_packets_per_freq = 4;
* @return {proto.common.Metric}
*/
proto.api.GatewayStats.prototype.getTxPacketsPerDrMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<number,number>} */ (
jspb.Message.getMapField(this, 6, opt_noLazyCreate,
null));
proto.api.GetGatewayMetricsResponse.prototype.getRxPacketsPerFreq = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 4));
};
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setRxPacketsPerFreq = function(value) {
jspb.Message.setWrapperField(this, 4, value);
};
proto.api.GetGatewayMetricsResponse.prototype.clearRxPacketsPerFreq = function() {
this.setRxPacketsPerFreq(undefined);
};
/**
* map<uint32, uint32> rx_packets_per_dr = 7;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<number,number>}
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GatewayStats.prototype.getRxPacketsPerDrMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<number,number>} */ (
jspb.Message.getMapField(this, 7, opt_noLazyCreate,
null));
proto.api.GetGatewayMetricsResponse.prototype.hasRxPacketsPerFreq = function() {
return jspb.Message.getField(this, 4) != null;
};
/**
* map<string, uint32> tx_packets_per_status = 8;
* @param {boolean=} opt_noLazyCreate Do not create the map if
* empty, instead returning `undefined`
* @return {!jspb.Map<string,number>}
* optional common.Metric tx_packets_per_dr = 5;
* @return {proto.common.Metric}
*/
proto.api.GatewayStats.prototype.getTxPacketsPerStatusMap = function(opt_noLazyCreate) {
return /** @type {!jspb.Map<string,number>} */ (
jspb.Message.getMapField(this, 8, opt_noLazyCreate,
null));
proto.api.GetGatewayMetricsResponse.prototype.getTxPacketsPerDr = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 5));
};
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setTxPacketsPerDr = function(value) {
jspb.Message.setWrapperField(this, 5, value);
};
proto.api.GetGatewayMetricsResponse.prototype.clearTxPacketsPerDr = function() {
this.setTxPacketsPerDr(undefined);
};
/**
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GetGatewayMetricsResponse.prototype.hasTxPacketsPerDr = function() {
return jspb.Message.getField(this, 5) != null;
};
/**
* optional common.Metric rx_packets_per_dr = 6;
* @return {proto.common.Metric}
*/
proto.api.GetGatewayMetricsResponse.prototype.getRxPacketsPerDr = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 6));
};
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setRxPacketsPerDr = function(value) {
jspb.Message.setWrapperField(this, 6, value);
};
proto.api.GetGatewayMetricsResponse.prototype.clearRxPacketsPerDr = function() {
this.setRxPacketsPerDr(undefined);
};
/**
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GetGatewayMetricsResponse.prototype.hasRxPacketsPerDr = function() {
return jspb.Message.getField(this, 6) != null;
};
/**
* optional common.Metric tx_packets_per_status = 7;
* @return {proto.common.Metric}
*/
proto.api.GetGatewayMetricsResponse.prototype.getTxPacketsPerStatus = function() {
return /** @type{proto.common.Metric} */ (
jspb.Message.getWrapperField(this, common_common_pb.Metric, 7));
};
/** @param {proto.common.Metric|undefined} value */
proto.api.GetGatewayMetricsResponse.prototype.setTxPacketsPerStatus = function(value) {
jspb.Message.setWrapperField(this, 7, value);
};
proto.api.GetGatewayMetricsResponse.prototype.clearTxPacketsPerStatus = function() {
this.setTxPacketsPerStatus(undefined);
};
/**
* Returns whether this field is set.
* @return{!boolean}
*/
proto.api.GetGatewayMetricsResponse.prototype.hasTxPacketsPerStatus = function() {
return jspb.Message.getField(this, 7) != null;
};

View File

@ -2,6 +2,7 @@
// file: common/common.proto
import * as jspb from "google-protobuf";
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
export class Location extends jspb.Message {
getLatitude(): number;
@ -65,6 +66,64 @@ export namespace KeyEnvelope {
}
}
export class Metric extends jspb.Message {
getName(): string;
setName(value: string): void;
clearTimestampsList(): void;
getTimestampsList(): Array<google_protobuf_timestamp_pb.Timestamp>;
setTimestampsList(value: Array<google_protobuf_timestamp_pb.Timestamp>): void;
addTimestamps(value?: google_protobuf_timestamp_pb.Timestamp, index?: number): google_protobuf_timestamp_pb.Timestamp;
clearDatasetsList(): void;
getDatasetsList(): Array<MetricDataset>;
setDatasetsList(value: Array<MetricDataset>): void;
addDatasets(value?: MetricDataset, index?: number): MetricDataset;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Metric.AsObject;
static toObject(includeInstance: boolean, msg: Metric): Metric.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Metric, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Metric;
static deserializeBinaryFromReader(message: Metric, reader: jspb.BinaryReader): Metric;
}
export namespace Metric {
export type AsObject = {
name: string,
timestampsList: Array<google_protobuf_timestamp_pb.Timestamp.AsObject>,
datasetsList: Array<MetricDataset.AsObject>,
}
}
export class MetricDataset extends jspb.Message {
getLabel(): string;
setLabel(value: string): void;
clearDataList(): void;
getDataList(): Array<number>;
setDataList(value: Array<number>): void;
addData(value: number, index?: number): number;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): MetricDataset.AsObject;
static toObject(includeInstance: boolean, msg: MetricDataset): MetricDataset.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: MetricDataset, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): MetricDataset;
static deserializeBinaryFromReader(message: MetricDataset, reader: jspb.BinaryReader): MetricDataset;
}
export namespace MetricDataset {
export type AsObject = {
label: string,
dataList: Array<number>,
}
}
export interface ModulationMap {
LORA: 0;
FSK: 1;
@ -139,3 +198,11 @@ export interface LocationSourceMap {
export const LocationSource: LocationSourceMap;
export interface AggregationMap {
HOUR: 0;
DAY: 1;
MONTH: 2;
}
export const Aggregation: AggregationMap;

View File

@ -9,11 +9,15 @@ var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
goog.exportSymbol('proto.common.Aggregation', null, global);
goog.exportSymbol('proto.common.KeyEnvelope', null, global);
goog.exportSymbol('proto.common.Location', null, global);
goog.exportSymbol('proto.common.LocationSource', null, global);
goog.exportSymbol('proto.common.MType', null, global);
goog.exportSymbol('proto.common.MacVersion', null, global);
goog.exportSymbol('proto.common.Metric', null, global);
goog.exportSymbol('proto.common.MetricDataset', null, global);
goog.exportSymbol('proto.common.Modulation', null, global);
goog.exportSymbol('proto.common.RegParamsRevision', null, global);
goog.exportSymbol('proto.common.Region', null, global);
@ -494,6 +498,450 @@ proto.common.KeyEnvelope.prototype.setAesKey = function(value) {
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.common.Metric = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.common.Metric.repeatedFields_, null);
};
goog.inherits(proto.common.Metric, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.common.Metric.displayName = 'proto.common.Metric';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.common.Metric.repeatedFields_ = [2,3];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.common.Metric.prototype.toObject = function(opt_includeInstance) {
return proto.common.Metric.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.common.Metric} msg The msg instance to transform.
* @return {!Object}
*/
proto.common.Metric.toObject = function(includeInstance, msg) {
var f, obj = {
name: msg.getName(),
timestampsList: jspb.Message.toObjectList(msg.getTimestampsList(),
google_protobuf_timestamp_pb.Timestamp.toObject, includeInstance),
datasetsList: jspb.Message.toObjectList(msg.getDatasetsList(),
proto.common.MetricDataset.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.common.Metric}
*/
proto.common.Metric.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.common.Metric;
return proto.common.Metric.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.common.Metric} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.common.Metric}
*/
proto.common.Metric.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 2:
var value = new google_protobuf_timestamp_pb.Timestamp;
reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader);
msg.getTimestampsList().push(value);
msg.setTimestampsList(msg.getTimestampsList());
break;
case 3:
var value = new proto.common.MetricDataset;
reader.readMessage(value,proto.common.MetricDataset.deserializeBinaryFromReader);
msg.getDatasetsList().push(value);
msg.setDatasetsList(msg.getDatasetsList());
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.common.Metric} message
* @param {!jspb.BinaryWriter} writer
*/
proto.common.Metric.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.common.Metric.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.common.Metric.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = this.getTimestampsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter
);
}
f = this.getDatasetsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
3,
f,
proto.common.MetricDataset.serializeBinaryToWriter
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.common.Metric} The clone.
*/
proto.common.Metric.prototype.cloneMessage = function() {
return /** @type {!proto.common.Metric} */ (jspb.Message.cloneMessage(this));
};
/**
* optional string name = 1;
* @return {string}
*/
proto.common.Metric.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
};
/** @param {string} value */
proto.common.Metric.prototype.setName = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* repeated google.protobuf.Timestamp timestamps = 2;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<!proto.google.protobuf.Timestamp>}
*/
proto.common.Metric.prototype.getTimestampsList = function() {
return /** @type{!Array.<!proto.google.protobuf.Timestamp>} */ (
jspb.Message.getRepeatedWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2));
};
/** @param {Array.<!proto.google.protobuf.Timestamp>} value */
proto.common.Metric.prototype.setTimestampsList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 2, value);
};
proto.common.Metric.prototype.clearTimestampsList = function() {
this.setTimestampsList([]);
};
/**
* repeated MetricDataset datasets = 3;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<!proto.common.MetricDataset>}
*/
proto.common.Metric.prototype.getDatasetsList = function() {
return /** @type{!Array.<!proto.common.MetricDataset>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.common.MetricDataset, 3));
};
/** @param {Array.<!proto.common.MetricDataset>} value */
proto.common.Metric.prototype.setDatasetsList = function(value) {
jspb.Message.setRepeatedWrapperField(this, 3, value);
};
proto.common.Metric.prototype.clearDatasetsList = function() {
this.setDatasetsList([]);
};
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.common.MetricDataset = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.common.MetricDataset.repeatedFields_, null);
};
goog.inherits(proto.common.MetricDataset, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.common.MetricDataset.displayName = 'proto.common.MetricDataset';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.common.MetricDataset.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto suitable for use in Soy templates.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* @return {!Object}
*/
proto.common.MetricDataset.prototype.toObject = function(opt_includeInstance) {
return proto.common.MetricDataset.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.common.MetricDataset} msg The msg instance to transform.
* @return {!Object}
*/
proto.common.MetricDataset.toObject = function(includeInstance, msg) {
var f, obj = {
label: msg.getLabel(),
dataList: jspb.Message.getRepeatedFloatingPointField(msg, 2)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.common.MetricDataset}
*/
proto.common.MetricDataset.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.common.MetricDataset;
return proto.common.MetricDataset.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.common.MetricDataset} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.common.MetricDataset}
*/
proto.common.MetricDataset.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setLabel(value);
break;
case 2:
var value = /** @type {!Array.<number>} */ (reader.readPackedFloat());
msg.setDataList(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Class method variant: serializes the given message to binary data
* (in protobuf wire format), writing to the given BinaryWriter.
* @param {!proto.common.MetricDataset} message
* @param {!jspb.BinaryWriter} writer
*/
proto.common.MetricDataset.serializeBinaryToWriter = function(message, writer) {
message.serializeBinaryToWriter(writer);
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.common.MetricDataset.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
this.serializeBinaryToWriter(writer);
return writer.getResultBuffer();
};
/**
* Serializes the message to binary data (in protobuf wire format),
* writing to the given BinaryWriter.
* @param {!jspb.BinaryWriter} writer
*/
proto.common.MetricDataset.prototype.serializeBinaryToWriter = function (writer) {
var f = undefined;
f = this.getLabel();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = this.getDataList();
if (f.length > 0) {
writer.writePackedFloat(
2,
f
);
}
};
/**
* Creates a deep clone of this proto. No data is shared with the original.
* @return {!proto.common.MetricDataset} The clone.
*/
proto.common.MetricDataset.prototype.cloneMessage = function() {
return /** @type {!proto.common.MetricDataset} */ (jspb.Message.cloneMessage(this));
};
/**
* optional string label = 1;
* @return {string}
*/
proto.common.MetricDataset.prototype.getLabel = function() {
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, ""));
};
/** @param {string} value */
proto.common.MetricDataset.prototype.setLabel = function(value) {
jspb.Message.setField(this, 1, value);
};
/**
* repeated float data = 2;
* If you change this array by adding, removing or replacing elements, or if you
* replace the array itself, then you must call the setter to update it.
* @return {!Array.<number>}
*/
proto.common.MetricDataset.prototype.getDataList = function() {
return /** @type {!Array.<number>} */ (jspb.Message.getRepeatedFloatingPointField(this, 2));
};
/** @param {Array.<number>} value */
proto.common.MetricDataset.prototype.setDataList = function(value) {
jspb.Message.setField(this, 2, value || []);
};
proto.common.MetricDataset.prototype.clearDataList = function() {
jspb.Message.setField(this, 2, []);
};
/**
* @enum {number}
*/
@ -574,4 +1022,13 @@ proto.common.LocationSource = {
GEO_RESOLVER_WIFI: 6
};
/**
* @enum {number}
*/
proto.common.Aggregation = {
HOUR: 0,
DAY: 1,
MONTH: 2
};
goog.object.extend(exports, proto.common);

2
api/js/package.json vendored
View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api",
"version": "4.0.0-test.5",
"version": "4.0.0-test.7",
"description": "Chirpstack JS and TS API",
"license": "MIT",
"devDependencies": {

34
api/js/yarn.lock vendored
View File

@ -39,7 +39,7 @@
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf"
integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78=
integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==
"@protobufjs/base64@^1.1.2":
version "1.1.2"
@ -54,12 +54,12 @@
"@protobufjs/eventemitter@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70"
integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A=
integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==
"@protobufjs/fetch@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45"
integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=
integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==
dependencies:
"@protobufjs/aspromise" "^1.1.1"
"@protobufjs/inquire" "^1.1.0"
@ -67,27 +67,27 @@
"@protobufjs/float@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1"
integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=
integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==
"@protobufjs/inquire@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089"
integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=
integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==
"@protobufjs/path@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d"
integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=
integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==
"@protobufjs/pool@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54"
integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=
integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==
"@protobufjs/utf8@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=
integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==
"@types/google-protobuf@^3.15.5":
version "3.15.5"
@ -95,14 +95,14 @@
integrity sha512-6bgv24B+A2bo9AfzReeg5StdiijKzwwnRflA8RLd1V4Yv995LeTmo0z69/MPbBDFSiZWdZHQygLo/ccXhMEDgw==
"@types/long@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9"
integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==
version "4.0.2"
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a"
integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==
"@types/node@>=12.12.47", "@types/node@>=13.7.0":
version "17.0.23"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.23.tgz#3b41a6e643589ac6442bdbd7a4a3ded62f33f7da"
integrity sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==
version "17.0.40"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.40.tgz#76ee88ae03650de8064a6cf75b8d95f9f4a16090"
integrity sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==
abbrev@1:
version "1.1.1"
@ -407,9 +407,9 @@ path-is-absolute@^1.0.0:
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
protobufjs@^6.10.0:
version "6.11.2"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b"
integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==
version "6.11.3"
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.3.tgz#637a527205a35caa4f3e2a9a4a13ddffe0e7af74"
integrity sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg==
dependencies:
"@protobufjs/aspromise" "^1.1.2"
"@protobufjs/base64" "^1.1.2"

18
api/md/Makefile vendored Normal file
View File

@ -0,0 +1,18 @@
.PHONY: requirements api
all: requirements
requirements:
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.5.1
api:
protoc -I=/googleapis -I=../proto --doc_out=./api --doc_opt=markdown,api.md \
api/application.proto \
api/device.proto \
api/device_profile.proto \
api/frame_log.proto \
api/gateway.proto \
api/multicast_group.proto \
api/tenant.proto \
api/user.proto

3866
api/md/api/api.md vendored Normal file

File diff suppressed because it is too large Load Diff

544
api/md/api/internal.md vendored Normal file
View File

@ -0,0 +1,544 @@
# Protocol Documentation
<a name="top"></a>
## Table of Contents
- [api/internal.proto](#api_internal-proto)
- [ApiKey](#api-ApiKey)
- [CreateApiKeyRequest](#api-CreateApiKeyRequest)
- [CreateApiKeyResponse](#api-CreateApiKeyResponse)
- [DeleteApiKeyRequest](#api-DeleteApiKeyRequest)
- [GetDevicesSummaryRequest](#api-GetDevicesSummaryRequest)
- [GetDevicesSummaryResponse](#api-GetDevicesSummaryResponse)
- [GetDevicesSummaryResponse.DrCountEntry](#api-GetDevicesSummaryResponse-DrCountEntry)
- [GetGatewaysSummaryRequest](#api-GetGatewaysSummaryRequest)
- [GetGatewaysSummaryResponse](#api-GetGatewaysSummaryResponse)
- [GlobalSearchRequest](#api-GlobalSearchRequest)
- [GlobalSearchResponse](#api-GlobalSearchResponse)
- [GlobalSearchResult](#api-GlobalSearchResult)
- [ListApiKeysRequest](#api-ListApiKeysRequest)
- [ListApiKeysResponse](#api-ListApiKeysResponse)
- [LogItem](#api-LogItem)
- [LogItem.PropertiesEntry](#api-LogItem-PropertiesEntry)
- [LoginRequest](#api-LoginRequest)
- [LoginResponse](#api-LoginResponse)
- [OpenIdConnect](#api-OpenIdConnect)
- [OpenIdConnectLoginRequest](#api-OpenIdConnectLoginRequest)
- [OpenIdConnectLoginResponse](#api-OpenIdConnectLoginResponse)
- [ProfileResponse](#api-ProfileResponse)
- [SettingsResponse](#api-SettingsResponse)
- [StreamDeviceEventsRequest](#api-StreamDeviceEventsRequest)
- [StreamDeviceFramesRequest](#api-StreamDeviceFramesRequest)
- [StreamGatewayFramesRequest](#api-StreamGatewayFramesRequest)
- [UserTenantLink](#api-UserTenantLink)
- [InternalService](#api-InternalService)
- [Scalar Value Types](#scalar-value-types)
<a name="api_internal-proto"></a>
<p align="right"><a href="#top">Top</a></p>
## api/internal.proto
<a name="api-ApiKey"></a>
### ApiKey
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) | | API key ID. This value will be automatically generated on create. |
| name | [string](#string) | | Name. |
| is_admin | [bool](#bool) | | Is global admin key. |
| tenant_id | [string](#string) | | Tenant ID. In case the API key is intended to manage resources under a single tenant. |
<a name="api-CreateApiKeyRequest"></a>
### CreateApiKeyRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| api_key | [ApiKey](#api-ApiKey) | | The API key to create. |
<a name="api-CreateApiKeyResponse"></a>
### CreateApiKeyResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) | | API key ID. |
| token | [string](#string) | | API token for authentication API requests. |
<a name="api-DeleteApiKeyRequest"></a>
### DeleteApiKeyRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) | | API key ID. |
<a name="api-GetDevicesSummaryRequest"></a>
### GetDevicesSummaryRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| tenant_id | [string](#string) | | Tenant ID (UUID). |
<a name="api-GetDevicesSummaryResponse"></a>
### GetDevicesSummaryResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| active_count | [uint32](#uint32) | | Active count. |
| inactive_count | [uint32](#uint32) | | Inactive count. |
| dr_count | [GetDevicesSummaryResponse.DrCountEntry](#api-GetDevicesSummaryResponse-DrCountEntry) | repeated | per data-rate count. Devices that have never been seen are excluded. |
| never_seen_count | [uint32](#uint32) | | Never seen count. |
<a name="api-GetDevicesSummaryResponse-DrCountEntry"></a>
### GetDevicesSummaryResponse.DrCountEntry
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| key | [uint32](#uint32) | | |
| value | [uint32](#uint32) | | |
<a name="api-GetGatewaysSummaryRequest"></a>
### GetGatewaysSummaryRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| tenant_id | [string](#string) | | Tenant ID (UUID). |
<a name="api-GetGatewaysSummaryResponse"></a>
### GetGatewaysSummaryResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| active_count | [uint32](#uint32) | | Active count. |
| inactive_count | [uint32](#uint32) | | Inactive count. |
| never_seen_count | [uint32](#uint32) | | Never seen count. |
<a name="api-GlobalSearchRequest"></a>
### GlobalSearchRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| search | [string](#string) | | Search query. |
| limit | [int64](#int64) | | Max number of results to return. |
| offset | [int64](#int64) | | Offset offset of the result-set (for pagination). |
<a name="api-GlobalSearchResponse"></a>
### GlobalSearchResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| result | [GlobalSearchResult](#api-GlobalSearchResult) | repeated | |
<a name="api-GlobalSearchResult"></a>
### GlobalSearchResult
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| kind | [string](#string) | | Record kind. |
| score | [float](#float) | | Search score. |
| tenant_id | [string](#string) | | Organization id. |
| tenant_name | [string](#string) | | Organization name. |
| application_id | [string](#string) | | Application id. |
| application_name | [string](#string) | | Application name. |
| device_dev_eui | [string](#string) | | Device DevEUI (hex encoded). |
| device_name | [string](#string) | | Device name. |
| gateway_id | [string](#string) | | Gateway MAC (hex encoded). |
| gateway_name | [string](#string) | | Gateway name. |
<a name="api-ListApiKeysRequest"></a>
### ListApiKeysRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| limit | [uint32](#uint32) | | Max number of items to return. |
| offset | [uint32](#uint32) | | Offset in the result-set (for pagination). |
| is_admin | [bool](#bool) | | Return only admin keys. |
| tenant_id | [string](#string) | | Filter on tenant ID. |
<a name="api-ListApiKeysResponse"></a>
### ListApiKeysResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| total_count | [uint32](#uint32) | | Total number of API keys. |
| result | [ApiKey](#api-ApiKey) | repeated | |
<a name="api-LogItem"></a>
### LogItem
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| id | [string](#string) | | ID. |
| time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Timestamp. |
| description | [string](#string) | | Message. |
| body | [string](#string) | | Body. |
| properties | [LogItem.PropertiesEntry](#api-LogItem-PropertiesEntry) | repeated | Properties. |
<a name="api-LogItem-PropertiesEntry"></a>
### LogItem.PropertiesEntry
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| key | [string](#string) | | |
| value | [string](#string) | | |
<a name="api-LoginRequest"></a>
### LoginRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| email | [string](#string) | | Email of the user. |
| password | [string](#string) | | Password of the user. |
<a name="api-LoginResponse"></a>
### LoginResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| jwt | [string](#string) | | The JWT tag to be used to access chirpstack-application-server interfaces. |
<a name="api-OpenIdConnect"></a>
### OpenIdConnect
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| enabled | [bool](#bool) | | Enable OpenId Connect authentication. |
| login_url | [string](#string) | | Login url. |
| login_label | [string](#string) | | Login label. |
| logout_url | [string](#string) | | Logout url. |
<a name="api-OpenIdConnectLoginRequest"></a>
### OpenIdConnectLoginRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| code | [string](#string) | | OpenId Connect callback code. |
| state | [string](#string) | | OpenId Connect callback state. |
<a name="api-OpenIdConnectLoginResponse"></a>
### OpenIdConnectLoginResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| token | [string](#string) | | Token to use for authentication. |
<a name="api-ProfileResponse"></a>
### ProfileResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| user | [User](#api-User) | | User object. |
| tenants | [UserTenantLink](#api-UserTenantLink) | repeated | Tenants to which the user is associated. |
<a name="api-SettingsResponse"></a>
### SettingsResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| openid_connect | [OpenIdConnect](#api-OpenIdConnect) | | OpenId Connect settings. |
<a name="api-StreamDeviceEventsRequest"></a>
### StreamDeviceEventsRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| dev_eui | [string](#string) | | Device EUI. |
<a name="api-StreamDeviceFramesRequest"></a>
### StreamDeviceFramesRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| dev_eui | [string](#string) | | Device EUI. |
<a name="api-StreamGatewayFramesRequest"></a>
### StreamGatewayFramesRequest
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| gateway_id | [string](#string) | | Gateway ID (EUI64). |
<a name="api-UserTenantLink"></a>
### UserTenantLink
Defines a tenant to which the user is associated.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| created_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Created at timestamp. |
| updated_at | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | Last update timestamp. |
| tenant_id | [string](#string) | | Tenant ID. |
| is_admin | [bool](#bool) | | User is admin within the context of this tenant. There is no need to set the is_device_admin and is_gateway_admin flags. |
| is_device_admin | [bool](#bool) | | User is able to modify device related resources (applications, device-profiles, devices, multicast-groups). |
| is_gateway_admin | [bool](#bool) | | User is able to modify gateways. |
<a name="api-InternalService"></a>
### InternalService
InternalService is the service providing API endpoints for internal usage.
| Method Name | Request Type | Response Type | Description |
| ----------- | ------------ | ------------- | ------------|
| Login | [LoginRequest](#api-LoginRequest) | [LoginResponse](#api-LoginResponse) | Log in a user |
| Profile | [.google.protobuf.Empty](#google-protobuf-Empty) | [ProfileResponse](#api-ProfileResponse) | Get the current user&#39;s profile |
| GlobalSearch | [GlobalSearchRequest](#api-GlobalSearchRequest) | [GlobalSearchResponse](#api-GlobalSearchResponse) | Perform a global search. |
| CreateApiKey | [CreateApiKeyRequest](#api-CreateApiKeyRequest) | [CreateApiKeyResponse](#api-CreateApiKeyResponse) | CreateApiKey creates the given API key. |
| DeleteApiKey | [DeleteApiKeyRequest](#api-DeleteApiKeyRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | DeleteApiKey deletes the API key. |
| ListApiKeys | [ListApiKeysRequest](#api-ListApiKeysRequest) | [ListApiKeysResponse](#api-ListApiKeysResponse) | ListApiKeys lists the available API keys. |
| Settings | [.google.protobuf.Empty](#google-protobuf-Empty) | [SettingsResponse](#api-SettingsResponse) | Get the global settings. |
| OpenIdConnectLogin | [OpenIdConnectLoginRequest](#api-OpenIdConnectLoginRequest) | [OpenIdConnectLoginResponse](#api-OpenIdConnectLoginResponse) | OpenId Connect login. |
| GetDevicesSummary | [GetDevicesSummaryRequest](#api-GetDevicesSummaryRequest) | [GetDevicesSummaryResponse](#api-GetDevicesSummaryResponse) | GetDevicesSummary returns an aggregated summary of the devices. |
| GetGatewaysSummary | [GetGatewaysSummaryRequest](#api-GetGatewaysSummaryRequest) | [GetGatewaysSummaryResponse](#api-GetGatewaysSummaryResponse) | GetGatewaysSummary returns an aggregated summary of the gateways. |
| StreamGatewayFrames | [StreamGatewayFramesRequest](#api-StreamGatewayFramesRequest) | [LogItem](#api-LogItem) stream | Stream frame for the given Gateway ID. |
| StreamDeviceFrames | [StreamDeviceFramesRequest](#api-StreamDeviceFramesRequest) | [LogItem](#api-LogItem) stream | Stream frames for the given Device EUI. |
| StreamDeviceEvents | [StreamDeviceEventsRequest](#api-StreamDeviceEventsRequest) | [LogItem](#api-LogItem) stream | Stream events for the given Device EUI. |
## Scalar Value Types
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
| <a name="double" /> double | | double | double | float | float64 | double | float | Float |
| <a name="float" /> float | | float | float | float | float32 | float | float | Float |
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |

View File

@ -7,6 +7,7 @@ option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProto";
import "common/common.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
@ -55,8 +56,13 @@ service DeviceService {
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
rpc GetRandomDevAddr(GetRandomDevAddrRequest) returns (GetRandomDevAddrResponse) {}
// GetStats returns the device stats.
rpc GetStats(GetDeviceStatsRequest) returns (GetDeviceStatsResponse) {}
// GetMetrics returns the device metrics.
// Note that this requires a device-profile with codec and measurements configured.
rpc GetMetrics(GetDeviceMetricsRequest) returns (GetDeviceMetricsResponse) {}
// GetLinkMetrics returns the device link metrics.
// This includes uplinks, downlinks, RSSI, SNR, etc...
rpc GetLinkMetrics(GetDeviceLinkMetricsRequest) returns (GetDeviceLinkMetricsResponse) {}
// Enqueue adds the given item to the downlink queue.
rpc Enqueue(EnqueueDeviceQueueItemRequest) returns (EnqueueDeviceQueueItemResponse) {}
@ -309,7 +315,7 @@ message GetRandomDevAddrResponse {
string dev_addr = 1;
}
message GetDeviceStatsRequest {
message GetDeviceMetricsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
@ -318,33 +324,57 @@ message GetDeviceStatsRequest {
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetDeviceStatsResponse {
repeated DeviceStats result = 1;
message GetDeviceMetricsResponse {
map<string, common.Metric> metrics = 1;
map<string, DeviceState> states = 2;
}
message DeviceStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
message DeviceState {
// Name.
string name = 2;
// Value.
string value = 3;
}
message GetDeviceLinkMetricsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetDeviceLinkMetricsResponse {
// Packets received from the device.
uint32 rx_packets = 2;
common.Metric rx_packets = 1;
// Average RSSI (as reported by the gateway(s)).
float gw_rssi = 3;
// RSSI (as reported by the gateway(s)).
common.Metric gw_rssi = 2;
// Average SNR (as reported by the gateway(s)).
float gw_snr = 4;
// SNR (as reported by the gateway(s)).
common.Metric gw_snr = 3;
// Packets received by frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
common.Metric rx_packets_per_freq = 4;
// Packets received by DR.
map<uint32, uint32> rx_packets_per_dr = 6;
common.Metric rx_packets_per_dr = 5;
// Error count.
map<string, uint32> errors = 7;
// Errors.
common.Metric errors = 6;
}
message DeviceQueueItem {

View File

@ -22,6 +22,23 @@ enum CodecRuntime {
JS = 2;
}
enum MeasurementKind {
// Unknown (in which case it is not tracked).
UNKNOWN = 0;
// Incrementing counters that never decrease (these are not reset on each reading).
COUNTER = 1;
// Counters that do get reset upon reading.
ABSOLUTE = 2;
// E.g. a temperature value.
GAUGE = 3;
// E.g. a firmware version, true / false value.
STRING = 4;
}
// DeviceProfileService is the service providing API methods for managing device-profiles.
service DeviceProfileService {
// Create the given device-profile.
@ -54,6 +71,9 @@ message DeviceProfile {
// Name.
string name = 3;
// Description.
string description = 26;
// Region.
common.Region region = 4;
@ -126,6 +146,18 @@ message DeviceProfile {
// User defined tags.
map<string, string> tags = 25;
// Measurements.
// If defined, ChirpStack will visualize these metrics in the web-interface.
map<string, Measurement> measurements = 27;
}
message Measurement {
// Name (user defined).
string name = 2;
// Kind.
MeasurementKind kind = 3;
}
message DeviceProfileListItem {

View File

@ -0,0 +1,211 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileTemplateProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
import "api/device_profile.proto";
// DeviceProfileTemplateService is the service providing API methods for managing device-profile templates.
service DeviceProfileTemplateService {
// Create the given device-profile template.
rpc Create(CreateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {}
// Get the device-profile template for the given ID.
rpc Get(GetDeviceProfileTemplateRequest) returns (GetDeviceProfileTemplateResponse) {}
// Update the given device-profile template.
rpc Update(UpdateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {}
// Delete the device-profile template with the given ID.
rpc Delete(DeleteDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {}
// List the available device-profile templates.
rpc List(ListDeviceProfileTemplatesRequest) returns (ListDeviceProfileTemplatesResponse) {}
}
message DeviceProfileTemplate {
// Device-profile template ID.
string id = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Vendor.
string vendor = 4;
// Firmware.
string firmware = 5;
// Region.
common.Region region = 6;
// LoRaWAN mac-version.
common.MacVersion mac_version = 7;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 8;
// ADR algorithm ID.
string adr_algorithm_id = 9;
// Payload codec runtime.
CodecRuntime payload_codec_runtime = 10;
// Payload codec script.
string payload_codec_script = 11;
// Flush queue on device activation.
bool flush_queue_on_activate = 12;
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. When the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 13;
// Device-status request interval (times / day).
// This defines the times per day that ChirpStack will request the device-status
// from the device.
uint32 device_status_req_interval = 14;
// Supports OTAA.
bool supports_otaa = 15;
// Supports Class B.
bool supports_class_b = 16;
// Supports Class-C.
bool supports_class_c = 17;
// Class-B timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_b_timeout = 18;
// Class-B ping-slot periodicity.
uint32 class_b_ping_slot_period = 19;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 20;
// Class-B ping-slot freq (Hz).
uint32 class_b_ping_slot_freq = 21;
// Class-C timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_c_timeout = 22;
// RX1 delay (for ABP).
uint32 abp_rx1_delay = 23;
// RX1 DR offset (for ABP).
uint32 abp_rx1_dr_offset = 24;
// RX2 DR (for ABP).
uint32 abp_rx2_dr = 25;
// RX2 frequency (for ABP, Hz).
uint32 abp_rx2_freq = 26;
// User defined tags.
map<string, string> tags = 27;
// Measurements.
// If defined, ChirpStack will visualize these metrics in the web-interface.
map<string, Measurement> measurements = 28;
}
message DeviceProfileTemplateListItem {
// Device-profile template ID.
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Vendor.
string vendor = 5;
// Firmware.
string firmware = 6;
// Region.
common.Region region = 7;
// LoRaWAN mac-version.
common.MacVersion mac_version = 8;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 9;
// Supports OTAA.
bool supports_otaa = 10;
// Supports Class-B.
bool supports_class_b = 11;
// Supports Class-C.
bool supports_class_c = 12;
}
message CreateDeviceProfileTemplateRequest {
// Object to create.
DeviceProfileTemplate device_profile_template = 1;
}
message GetDeviceProfileTemplateRequest {
// ID.
string id = 1;
}
message GetDeviceProfileTemplateResponse {
// Device-profile template object.
DeviceProfileTemplate device_profile_template = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceProfileTemplateRequest {
// Object to update.
DeviceProfileTemplate device_profile_template = 1;
}
message DeleteDeviceProfileTemplateRequest {
// ID.
string id = 1;
}
message ListDeviceProfileTemplatesRequest {
// Max number of device-profile templates to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
}
message ListDeviceProfileTemplatesResponse {
// Total number of device-profile templates.
uint32 total_count = 1;
// Result-set.
repeated DeviceProfileTemplateListItem result = 2;
}

View File

@ -31,8 +31,8 @@ service GatewayService {
// Generate client-certificate for the gateway.
rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {}
// GetStats returns the gateway stats.
rpc GetStats(GetGatewayStatsRequest) returns (GetGatewayStatsResponse) {}
// GetMetrics returns the gateway metrics.
rpc GetMetrics(GetGatewayMetricsRequest) returns (GetGatewayMetricsResponse) {}
}
message Gateway {
@ -163,7 +163,7 @@ message GenerateGatewayClientCertificateResponse {
google.protobuf.Timestamp expires_at = 4;
}
message GetGatewayStatsRequest {
message GetGatewayMetricsRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
@ -172,34 +172,30 @@ message GetGatewayStatsRequest {
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetGatewayStatsResponse {
repeated GatewayStats result = 1;
}
message GatewayStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
// Packets received.
uint32 rx_packets = 2;
// Packets emitted.
uint32 tx_packets = 3;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 4;
// Rx packets per frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
// Tx packets per DR.
map<uint32, uint32> tx_packets_per_dr = 6;
// Rx packets per DR.
map<uint32, uint32> rx_packets_per_dr = 7;
// Tx packets per status.
map<string, uint32> tx_packets_per_status = 8;
message GetGatewayMetricsResponse {
// RX packets.
common.Metric rx_packets = 1;
// TX packets.
common.Metric tx_packets = 2;
// TX packets / frequency.
common.Metric tx_packets_per_freq = 3;
// RX packets / frequency.
common.Metric rx_packets_per_freq = 4;
// TX packets / DR.
common.Metric tx_packets_per_dr = 5;
// RX packets / DR.
common.Metric rx_packets_per_dr = 6;
// TX packets per status.
common.Metric tx_packets_per_status = 7;
}

View File

@ -7,6 +7,8 @@ option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
import "google/protobuf/timestamp.proto";
enum Modulation {
// LoRa
LORA = 0;
@ -129,6 +131,17 @@ enum LocationSource {
GEO_RESOLVER_WIFI = 6;
}
enum Aggregation {
// Hour.
HOUR = 0;
// Day.
DAY = 1;
// Month.
MONTH = 2;
}
message Location {
// Latitude.
double latitude = 1;
@ -153,3 +166,23 @@ message KeyEnvelope {
// AES key (when the kek_label is set, this value must first be decrypted).
bytes aes_key = 2;
}
message Metric {
// Name.
string name = 1;
// Timestamps.
repeated google.protobuf.Timestamp timestamps = 2;
// Datasets.
repeated MetricDataset datasets = 3;
}
message MetricDataset {
// Label.
string label = 1;
// Data.
// Each value index corresponds with the same timestamp index of the Metric.
repeated float data = 2;
}

1
api/python/Makefile vendored
View File

@ -32,6 +32,7 @@ api:
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/tenant.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/application.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/device_profile.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/device_profile_template.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/device.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/gateway.proto
$(PROTOC) ${PROTOC_ARGS} chirpstack-api/api/frame_log.proto

View File

@ -18,7 +18,7 @@ CLASSIFIERS = [
setup(
name='chirpstack-api',
version = "4.0.0-test.5",
version = "4.0.0-test.7",
url='https://github.com/brocaar/chirpstack-api',
author='Orne Brocaar',
author_email='info@brocaar.com',

2
api/rust/Cargo.lock generated vendored
View File

@ -121,7 +121,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack_api"
version = "4.0.0-test.1"
version = "4.0.0-test.6"
dependencies = [
"hex",
"pbjson",

2
api/rust/Cargo.toml vendored
View File

@ -1,7 +1,7 @@
[package]
name = "chirpstack_api"
description = "ChirpStack Protobuf / gRPC API definitions."
version = "4.0.0-test.5"
version = "4.0.0-test.7"
authors = ["Orne Brocaar <info@brocaar.com>"]
license = "MIT"
homepage = "https://www.chirpstack.io"

1
api/rust/build.rs vendored
View File

@ -136,6 +136,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"api/tenant.proto",
"api/application.proto",
"api/device_profile.proto",
"api/device_profile_template.proto",
"api/device.proto",
"api/gateway.proto",
"api/frame_log.proto",

View File

@ -7,6 +7,7 @@ option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProto";
import "common/common.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/empty.proto";
@ -55,8 +56,13 @@ service DeviceService {
// GetRandomDevAddr returns a random DevAddr taking the NwkID prefix into account.
rpc GetRandomDevAddr(GetRandomDevAddrRequest) returns (GetRandomDevAddrResponse) {}
// GetStats returns the device stats.
rpc GetStats(GetDeviceStatsRequest) returns (GetDeviceStatsResponse) {}
// GetMetrics returns the device metrics.
// Note that this requires a device-profile with codec and measurements configured.
rpc GetMetrics(GetDeviceMetricsRequest) returns (GetDeviceMetricsResponse) {}
// GetLinkMetrics returns the device link metrics.
// This includes uplinks, downlinks, RSSI, SNR, etc...
rpc GetLinkMetrics(GetDeviceLinkMetricsRequest) returns (GetDeviceLinkMetricsResponse) {}
// Enqueue adds the given item to the downlink queue.
rpc Enqueue(EnqueueDeviceQueueItemRequest) returns (EnqueueDeviceQueueItemResponse) {}
@ -309,7 +315,7 @@ message GetRandomDevAddrResponse {
string dev_addr = 1;
}
message GetDeviceStatsRequest {
message GetDeviceMetricsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
@ -318,33 +324,57 @@ message GetDeviceStatsRequest {
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetDeviceStatsResponse {
repeated DeviceStats result = 1;
message GetDeviceMetricsResponse {
map<string, common.Metric> metrics = 1;
map<string, DeviceState> states = 2;
}
message DeviceStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
message DeviceState {
// Name.
string name = 2;
// Value.
string value = 3;
}
message GetDeviceLinkMetricsRequest {
// DevEUI (EUI64).
string dev_eui = 1;
// Interval start timestamp.
google.protobuf.Timestamp start = 2;
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetDeviceLinkMetricsResponse {
// Packets received from the device.
uint32 rx_packets = 2;
common.Metric rx_packets = 1;
// Average RSSI (as reported by the gateway(s)).
float gw_rssi = 3;
// RSSI (as reported by the gateway(s)).
common.Metric gw_rssi = 2;
// Average SNR (as reported by the gateway(s)).
float gw_snr = 4;
// SNR (as reported by the gateway(s)).
common.Metric gw_snr = 3;
// Packets received by frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
common.Metric rx_packets_per_freq = 4;
// Packets received by DR.
map<uint32, uint32> rx_packets_per_dr = 6;
common.Metric rx_packets_per_dr = 5;
// Error count.
map<string, uint32> errors = 7;
// Errors.
common.Metric errors = 6;
}
message DeviceQueueItem {

View File

@ -22,6 +22,23 @@ enum CodecRuntime {
JS = 2;
}
enum MeasurementKind {
// Unknown (in which case it is not tracked).
UNKNOWN = 0;
// Incrementing counters that never decrease (these are not reset on each reading).
COUNTER = 1;
// Counters that do get reset upon reading.
ABSOLUTE = 2;
// E.g. a temperature value.
GAUGE = 3;
// E.g. a firmware version, true / false value.
STRING = 4;
}
// DeviceProfileService is the service providing API methods for managing device-profiles.
service DeviceProfileService {
// Create the given device-profile.
@ -54,6 +71,9 @@ message DeviceProfile {
// Name.
string name = 3;
// Description.
string description = 26;
// Region.
common.Region region = 4;
@ -126,6 +146,18 @@ message DeviceProfile {
// User defined tags.
map<string, string> tags = 25;
// Measurements.
// If defined, ChirpStack will visualize these metrics in the web-interface.
map<string, Measurement> measurements = 27;
}
message Measurement {
// Name (user defined).
string name = 2;
// Kind.
MeasurementKind kind = 3;
}
message DeviceProfileListItem {

View File

@ -0,0 +1,211 @@
syntax = "proto3";
package api;
option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileTemplateProto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";
import "api/device_profile.proto";
// DeviceProfileTemplateService is the service providing API methods for managing device-profile templates.
service DeviceProfileTemplateService {
// Create the given device-profile template.
rpc Create(CreateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {}
// Get the device-profile template for the given ID.
rpc Get(GetDeviceProfileTemplateRequest) returns (GetDeviceProfileTemplateResponse) {}
// Update the given device-profile template.
rpc Update(UpdateDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {}
// Delete the device-profile template with the given ID.
rpc Delete(DeleteDeviceProfileTemplateRequest) returns (google.protobuf.Empty) {}
// List the available device-profile templates.
rpc List(ListDeviceProfileTemplatesRequest) returns (ListDeviceProfileTemplatesResponse) {}
}
message DeviceProfileTemplate {
// Device-profile template ID.
string id = 1;
// Name.
string name = 2;
// Description.
string description = 3;
// Vendor.
string vendor = 4;
// Firmware.
string firmware = 5;
// Region.
common.Region region = 6;
// LoRaWAN mac-version.
common.MacVersion mac_version = 7;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 8;
// ADR algorithm ID.
string adr_algorithm_id = 9;
// Payload codec runtime.
CodecRuntime payload_codec_runtime = 10;
// Payload codec script.
string payload_codec_script = 11;
// Flush queue on device activation.
bool flush_queue_on_activate = 12;
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. When the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 13;
// Device-status request interval (times / day).
// This defines the times per day that ChirpStack will request the device-status
// from the device.
uint32 device_status_req_interval = 14;
// Supports OTAA.
bool supports_otaa = 15;
// Supports Class B.
bool supports_class_b = 16;
// Supports Class-C.
bool supports_class_c = 17;
// Class-B timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_b_timeout = 18;
// Class-B ping-slot periodicity.
uint32 class_b_ping_slot_period = 19;
// Class-B ping-slot DR.
uint32 class_b_ping_slot_dr = 20;
// Class-B ping-slot freq (Hz).
uint32 class_b_ping_slot_freq = 21;
// Class-C timeout (seconds).
// This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested).
uint32 class_c_timeout = 22;
// RX1 delay (for ABP).
uint32 abp_rx1_delay = 23;
// RX1 DR offset (for ABP).
uint32 abp_rx1_dr_offset = 24;
// RX2 DR (for ABP).
uint32 abp_rx2_dr = 25;
// RX2 frequency (for ABP, Hz).
uint32 abp_rx2_freq = 26;
// User defined tags.
map<string, string> tags = 27;
// Measurements.
// If defined, ChirpStack will visualize these metrics in the web-interface.
map<string, Measurement> measurements = 28;
}
message DeviceProfileTemplateListItem {
// Device-profile template ID.
string id = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
// Name.
string name = 4;
// Vendor.
string vendor = 5;
// Firmware.
string firmware = 6;
// Region.
common.Region region = 7;
// LoRaWAN mac-version.
common.MacVersion mac_version = 8;
// Regional parameters revision.
common.RegParamsRevision reg_params_revision = 9;
// Supports OTAA.
bool supports_otaa = 10;
// Supports Class-B.
bool supports_class_b = 11;
// Supports Class-C.
bool supports_class_c = 12;
}
message CreateDeviceProfileTemplateRequest {
// Object to create.
DeviceProfileTemplate device_profile_template = 1;
}
message GetDeviceProfileTemplateRequest {
// ID.
string id = 1;
}
message GetDeviceProfileTemplateResponse {
// Device-profile template object.
DeviceProfileTemplate device_profile_template = 1;
// Created at timestamp.
google.protobuf.Timestamp created_at = 2;
// Last update timestamp.
google.protobuf.Timestamp updated_at = 3;
}
message UpdateDeviceProfileTemplateRequest {
// Object to update.
DeviceProfileTemplate device_profile_template = 1;
}
message DeleteDeviceProfileTemplateRequest {
// ID.
string id = 1;
}
message ListDeviceProfileTemplatesRequest {
// Max number of device-profile templates to return in the result-set.
uint32 limit = 1;
// Offset in the result-set (for pagination).
uint32 offset = 2;
}
message ListDeviceProfileTemplatesResponse {
// Total number of device-profile templates.
uint32 total_count = 1;
// Result-set.
repeated DeviceProfileTemplateListItem result = 2;
}

View File

@ -31,8 +31,8 @@ service GatewayService {
// Generate client-certificate for the gateway.
rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {}
// GetStats returns the gateway stats.
rpc GetStats(GetGatewayStatsRequest) returns (GetGatewayStatsResponse) {}
// GetMetrics returns the gateway metrics.
rpc GetMetrics(GetGatewayMetricsRequest) returns (GetGatewayMetricsResponse) {}
}
message Gateway {
@ -163,7 +163,7 @@ message GenerateGatewayClientCertificateResponse {
google.protobuf.Timestamp expires_at = 4;
}
message GetGatewayStatsRequest {
message GetGatewayMetricsRequest {
// Gateway ID (EUI64).
string gateway_id = 1;
@ -172,34 +172,30 @@ message GetGatewayStatsRequest {
// Interval end timestamp.
google.protobuf.Timestamp end = 3;
// Aggregation.
common.Aggregation aggregation = 4;
}
message GetGatewayStatsResponse {
repeated GatewayStats result = 1;
}
message GatewayStats {
// Timestamp of the (aggregated) measurement.
google.protobuf.Timestamp time = 1;
// Packets received.
uint32 rx_packets = 2;
// Packets emitted.
uint32 tx_packets = 3;
// Tx packets per frequency.
map<uint32, uint32> tx_packets_per_frequency = 4;
// Rx packets per frequency.
map<uint32, uint32> rx_packets_per_frequency = 5;
// Tx packets per DR.
map<uint32, uint32> tx_packets_per_dr = 6;
// Rx packets per DR.
map<uint32, uint32> rx_packets_per_dr = 7;
// Tx packets per status.
map<string, uint32> tx_packets_per_status = 8;
message GetGatewayMetricsResponse {
// RX packets.
common.Metric rx_packets = 1;
// TX packets.
common.Metric tx_packets = 2;
// TX packets / frequency.
common.Metric tx_packets_per_freq = 3;
// RX packets / frequency.
common.Metric rx_packets_per_freq = 4;
// TX packets / DR.
common.Metric tx_packets_per_dr = 5;
// RX packets / DR.
common.Metric rx_packets_per_dr = 6;
// TX packets per status.
common.Metric tx_packets_per_status = 7;
}

View File

@ -7,6 +7,8 @@ option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
import "google/protobuf/timestamp.proto";
enum Modulation {
// LoRa
LORA = 0;
@ -129,6 +131,17 @@ enum LocationSource {
GEO_RESOLVER_WIFI = 6;
}
enum Aggregation {
// Hour.
HOUR = 0;
// Day.
DAY = 1;
// Month.
MONTH = 2;
}
message Location {
// Latitude.
double latitude = 1;
@ -153,3 +166,23 @@ message KeyEnvelope {
// AES key (when the kek_label is set, this value must first be decrypted).
bytes aes_key = 2;
}
message Metric {
// Name.
string name = 1;
// Timestamps.
repeated google.protobuf.Timestamp timestamps = 2;
// Datasets.
repeated MetricDataset datasets = 3;
}
message MetricDataset {
// Label.
string label = 1;
// Data.
// Each value index corresponds with the same timestamp index of the Metric.
repeated float data = 2;
}

View File

@ -1,6 +1,6 @@
[package]
name = "backend"
version = "4.0.0-test.5"
version = "4.0.0-test.7"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
publish = false

View File

@ -3,7 +3,7 @@ name = "chirpstack"
description = "ChirpStack is an open-source LoRaWAN(TM) Network Server"
repository = "https://github.com/chirpstack/chirpstack"
homepage="https://www.chirpstack.io/"
version = "4.0.0-test.5"
version = "4.0.0-test.7"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
publish = false
@ -15,6 +15,7 @@ clap = "2.33"
# Configuration
serde = { version = "1.0", features = ["derive", "rc"] }
serde_yaml = "0.8"
serde_json = "1.0"
humantime-serde = "1.0"
toml = "0.5"
@ -68,7 +69,7 @@ tower = "0.4"
futures = "0.3"
http = "0.2"
http-body = "0.4"
rust-embed = "5.9"
rust-embed = "6.4"
mime_guess = "2.0"
tower-http = { version = "0.1", features = ["trace", "auth"] }
@ -82,14 +83,14 @@ rand_core = { version = "0.6", features = ["std"] }
# jsonwebtoken = "8.0"
jsonwebtoken = "8.1.0"
openssl = { version = "0.10", features = ["vendored"] }
openidconnect = { version = "2.2.0", features = ["accept-rfc3339-timestamps"] }
openidconnect = { version = "2.3.1", features = ["accept-rfc3339-timestamps"] }
# MQTT
paho-mqtt = { version = "0.9", features = ["vendored-ssl"] }
hex = "0.4"
# Codecs
rquickjs = { version = "0.1.5", features = ["bindgen"] }
rquickjs = { version = "0.1.6", features = ["bindgen", "loader", "array-buffer", "chrono"] }
# Misc
lazy_static = "1.4"

View File

@ -0,0 +1,5 @@
alter table device_profile
alter column class_b_ping_slot_dr type integer,
drop column description;
drop table device_profile_template;

View File

@ -0,0 +1,38 @@
create table device_profile_template (
id text primary key,
created_at timestamp with time zone not null,
updated_at timestamp with time zone not null,
name varchar(100) not null,
description text not null,
vendor varchar(100) not null,
firmware varchar(100) not null,
region varchar(10) not null,
mac_version varchar(10) not null,
reg_params_revision varchar(20) not null,
adr_algorithm_id varchar(100) not null,
payload_codec_runtime varchar(20) not null,
payload_codec_script text not null,
uplink_interval integer not null,
device_status_req_interval integer not null,
flush_queue_on_activate boolean not null,
supports_otaa boolean not null,
supports_class_b boolean not null,
supports_class_c boolean not null,
class_b_timeout integer not null,
class_b_ping_slot_period integer not null,
class_b_ping_slot_dr smallint not null,
class_b_ping_slot_freq bigint not null,
class_c_timeout integer not null,
abp_rx1_delay smallint not null,
abp_rx1_dr_offset smallint not null,
abp_rx2_dr smallint not null,
abp_rx2_freq bigint not null,
tags jsonb not null
);
alter table device_profile
alter column class_b_ping_slot_dr type smallint,
add column description text not null default '';
alter table device_profile
alter column description drop default;

View File

@ -0,0 +1,5 @@
alter table device_profile
drop column measurements;
alter table device_profile_template
drop column measurements;

View File

@ -0,0 +1,11 @@
alter table device_profile
add column measurements jsonb not null default '{}';
alter table device_profile_template
add column measurements jsonb not null default '{}';
alter table device_profile
alter column measurements drop default;
alter table device_profile_template
alter column measurements drop default;

View File

@ -960,6 +960,157 @@ impl Validator for ValidateApplicationAccess {
}
}
pub struct ValidateDeviceProfileTemplatesAccess {
flag: Flag,
}
impl ValidateDeviceProfileTemplatesAccess {
pub fn new(flag: Flag) -> Self {
ValidateDeviceProfileTemplatesAccess { flag }
}
}
#[async_trait]
impl Validator for ValidateDeviceProfileTemplatesAccess {
async fn validate_user(&self, id: &Uuid) -> Result<i64, Error> {
task::spawn_blocking({
let id = *id;
let flag = self.flag;
move || -> Result<i64, Error> {
let c = get_db_conn()?;
let mut q = user::dsl::user
.select(dsl::count_star())
.filter(user::dsl::id.eq(&id).and(user::dsl::is_active.eq(true)))
.into_boxed();
match flag {
// global admin
Flag::Create => {
q = q.filter(user::dsl::is_admin.eq(true));
}
// any active user
Flag::List => {}
_ => {
return Ok(0);
}
};
Ok(q.first(&c)?)
}
})
.await?
}
async fn validate_key(&self, id: &Uuid) -> Result<i64, Error> {
task::spawn_blocking({
let id = *id;
let flag = self.flag;
move || -> Result<i64, Error> {
let c = get_db_conn()?;
let mut q = api_key::dsl::api_key
.select(dsl::count_star())
.find(&id)
.into_boxed();
match flag {
// admin api key
Flag::Create => {
q = q.filter(api_key::dsl::is_admin.eq(true));
}
// any api key
Flag::List => {}
_ => {
return Ok(0);
}
};
Ok(q.first(&c)?)
}
})
.await?
}
}
pub struct ValidateDeviceProfileTemplateAccess {
flag: Flag,
device_profile_template_id: String,
}
impl ValidateDeviceProfileTemplateAccess {
pub fn new(flag: Flag, device_profile_template_id: &str) -> Self {
let device_profile_template_id = device_profile_template_id.to_string();
ValidateDeviceProfileTemplateAccess {
flag,
device_profile_template_id,
}
}
}
#[async_trait]
impl Validator for ValidateDeviceProfileTemplateAccess {
async fn validate_user(&self, id: &Uuid) -> Result<i64, Error> {
task::spawn_blocking({
let id = *id;
let flag = self.flag;
move || -> Result<i64, Error> {
let c = get_db_conn()?;
let mut q = user::dsl::user
.select(dsl::count_star())
.filter(user::dsl::id.eq(&id).and(user::dsl::is_active.eq(true)))
.into_boxed();
match flag {
// any active user
Flag::Read => {}
// global admin user
Flag::Update | Flag::Delete => {
q = q.filter(user::dsl::is_admin.eq(true));
}
_ => {
return Ok(0);
}
};
Ok(q.first(&c)?)
}
})
.await?
}
async fn validate_key(&self, id: &Uuid) -> Result<i64, Error> {
task::spawn_blocking({
let id = *id;
let flag = self.flag;
move || -> Result<i64, Error> {
let c = get_db_conn()?;
let mut q = api_key::dsl::api_key
.select(dsl::count_star())
.find(&id)
.into_boxed();
match flag {
// any api key
Flag::Read => {}
// admin api key
Flag::Update | Flag::Delete => {
q = q.filter(api_key::dsl::is_admin.eq(true));
}
_ => {
return Ok(0);
}
};
Ok(q.first(&c)?)
}
})
.await?
}
}
pub struct ValidateDeviceProfilesAccess {
flag: Flag,
tenant_id: Uuid,
@ -2043,7 +2194,8 @@ impl Validator for ValidateMulticastGroupQueueAccess {
pub mod test {
use super::*;
use crate::storage::{
api_key, application, device, device_profile, gateway, multicast, tenant, user,
api_key, application, device, device_profile, device_profile_template, gateway, multicast,
tenant, user,
};
use crate::test;
use std::str::FromStr;
@ -2959,6 +3111,153 @@ pub mod test {
run_tests(tests).await;
}
#[tokio::test]
async fn device_profile_test() {
let _guard = test::prepare().await;
let user_active = user::User {
email: "user@user".into(),
is_active: true,
..Default::default()
};
let user_admin = user::User {
email: "admin@user".into(),
is_active: true,
is_admin: true,
..Default::default()
};
for u in vec![&user_active, &user_admin] {
user::create(u.clone()).await.unwrap();
}
let api_key_admin = api_key::test::create_api_key(true, false).await;
let api_key_tenant = api_key::test::create_api_key(false, true).await;
let dp = device_profile_template::create(device_profile_template::DeviceProfileTemplate {
id: "test-dp".to_string(),
name: "test-dp".to_string(),
vendor: "Test Vendor".to_string(),
firmware: "1.2.3".to_string(),
..Default::default()
})
.await
.unwrap();
// device-profile templates with user
let tests = vec![
// admin user can create and list
ValidatorTest {
validators: vec![
ValidateDeviceProfileTemplatesAccess::new(Flag::Create),
ValidateDeviceProfileTemplatesAccess::new(Flag::List),
],
id: AuthID::User(user_admin.id),
ok: true,
},
// user can list
ValidatorTest {
validators: vec![ValidateDeviceProfileTemplatesAccess::new(Flag::List)],
id: AuthID::User(user_active.id),
ok: true,
},
// user can not create
ValidatorTest {
validators: vec![ValidateDeviceProfileTemplatesAccess::new(Flag::Create)],
id: AuthID::User(user_active.id),
ok: false,
},
];
run_tests(tests).await;
// device-profile templates with api key
let tests = vec![
// admin api can create and list
ValidatorTest {
validators: vec![
ValidateDeviceProfileTemplatesAccess::new(Flag::Create),
ValidateDeviceProfileTemplatesAccess::new(Flag::List),
],
id: AuthID::Key(api_key_admin.id),
ok: true,
},
// tenant api key can list
ValidatorTest {
validators: vec![ValidateDeviceProfileTemplatesAccess::new(Flag::List)],
id: AuthID::Key(api_key_tenant.id),
ok: true,
},
// tenant api can not create
ValidatorTest {
validators: vec![ValidateDeviceProfileTemplatesAccess::new(Flag::Create)],
id: AuthID::Key(api_key_tenant.id),
ok: false,
},
];
run_tests(tests).await;
// device-profile template with user
let tests = vec![
// admin user can read, update and delete
ValidatorTest {
validators: vec![
ValidateDeviceProfileTemplateAccess::new(Flag::Read, &dp.id),
ValidateDeviceProfileTemplateAccess::new(Flag::Update, &dp.id),
ValidateDeviceProfileTemplateAccess::new(Flag::Delete, &dp.id),
],
id: AuthID::User(user_admin.id),
ok: true,
},
// user can read
ValidatorTest {
validators: vec![ValidateDeviceProfileTemplateAccess::new(Flag::Read, &dp.id)],
id: AuthID::User(user_active.id),
ok: true,
},
// user can not update or delete
ValidatorTest {
validators: vec![
ValidateDeviceProfileTemplateAccess::new(Flag::Update, &dp.id),
ValidateDeviceProfileTemplateAccess::new(Flag::Delete, &dp.id),
],
id: AuthID::User(user_active.id),
ok: false,
},
];
run_tests(tests).await;
// device-profile template with api key
let tests = vec![
// admin api key can read, update and delete
ValidatorTest {
validators: vec![
ValidateDeviceProfileTemplateAccess::new(Flag::Read, &dp.id),
ValidateDeviceProfileTemplateAccess::new(Flag::Update, &dp.id),
ValidateDeviceProfileTemplateAccess::new(Flag::Delete, &dp.id),
],
id: AuthID::Key(api_key_admin.id),
ok: true,
},
// tenant api key can read
ValidatorTest {
validators: vec![ValidateDeviceProfileTemplateAccess::new(Flag::Read, &dp.id)],
id: AuthID::Key(api_key_tenant.id),
ok: true,
},
// tenant api key can not update or delete
ValidatorTest {
validators: vec![
ValidateDeviceProfileTemplateAccess::new(Flag::Update, &dp.id),
ValidateDeviceProfileTemplateAccess::new(Flag::Delete, &dp.id),
],
id: AuthID::Key(api_key_tenant.id),
ok: false,
},
];
run_tests(tests).await;
}
#[tokio::test]
async fn device_profile() {
let _guard = test::prepare().await;

View File

@ -1,8 +1,9 @@
use std::collections::HashSet;
use std::str::FromStr;
use std::time::SystemTime;
use bigdecimal::ToPrimitive;
use chrono::{DateTime, Local};
use chrono::{DateTime, Local, Utc};
use rand::RngCore;
use tonic::{Request, Response, Status};
use uuid::Uuid;
@ -13,7 +14,7 @@ use lrwn::{AES128Key, DevAddr, EUI64};
use super::auth::validator;
use super::error::ToStatus;
use super::helpers::{self, ToProto};
use super::helpers::{self, FromProto, ToProto};
use crate::storage::error::Error;
use crate::storage::{
device, device_keys, device_profile, device_queue, device_session, fields, metrics,
@ -351,6 +352,8 @@ impl DeviceService for Device {
let dk = device_keys::DeviceKeys {
dev_eui: dk.dev_eui,
created_at: dk.created_at,
dev_nonces: dk.dev_nonces,
join_nonce: dk.join_nonce,
nwk_key: AES128Key::from_str(&req_dk.nwk_key).map_err(|e| e.status())?,
app_key: if !req_dk.app_key.is_empty() {
AES128Key::from_str(&req_dk.app_key).map_err(|e| e.status())?
@ -561,10 +564,10 @@ impl DeviceService for Device {
}))
}
async fn get_stats(
async fn get_metrics(
&self,
request: Request<api::GetDeviceStatsRequest>,
) -> Result<Response<api::GetDeviceStatsResponse>, Status> {
request: Request<api::GetDeviceMetricsRequest>,
) -> Result<Response<api::GetDeviceMetricsResponse>, Status> {
let req = request.get_ref();
let dev_eui = EUI64::from_str(&req.dev_eui).map_err(|e| e.status())?;
@ -595,62 +598,313 @@ impl DeviceService for Device {
let start: DateTime<Local> = start.into();
let end: DateTime<Local> = end.into();
let aggregation = req.aggregation().from_proto();
let dev = device::get(&dev_eui).await.map_err(|e| e.status())?;
let dp = device_profile::get(&dev.device_profile_id)
.await
.map_err(|e| e.status())?;
let mut out = api::GetDeviceMetricsResponse {
..Default::default()
};
for (k, v) in dp.measurements.iter() {
match v.kind {
fields::MeasurementKind::UNKNOWN => {
continue;
}
fields::MeasurementKind::STRING => {
out.states.insert(
k.to_string(),
api::DeviceState {
name: v.name.to_string(),
value: metrics::get_state(&format!("device:{}:{}", dev.dev_eui, k))
.await
.map_err(|e| e.status())?,
},
);
}
fields::MeasurementKind::COUNTER
| fields::MeasurementKind::ABSOLUTE
| fields::MeasurementKind::GAUGE => {
let m = metrics::get(
&format!("device:{}:{}", dev.dev_eui, k),
match v.kind {
fields::MeasurementKind::COUNTER => metrics::Kind::COUNTER,
fields::MeasurementKind::ABSOLUTE => metrics::Kind::ABSOLUTE,
fields::MeasurementKind::GAUGE => metrics::Kind::GAUGE,
_ => panic!("Unexpected MeasurementKind: {:?}", v.kind),
},
aggregation,
start,
end,
)
.await
.map_err(|e| e.status())?;
out.metrics.insert(
k.to_string(),
common::Metric {
name: v.name.to_string(),
timestamps: m
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: vec![common::MetricDataset {
label: k.to_string(),
data: m
.iter()
.map(|row| {
row.metrics.get("value").cloned().unwrap_or(0.0) as f32
})
.collect(),
}],
},
);
}
}
}
Ok(Response::new(out))
}
async fn get_link_metrics(
&self,
request: Request<api::GetDeviceLinkMetricsRequest>,
) -> Result<Response<api::GetDeviceLinkMetricsResponse>, Status> {
let req = request.get_ref();
let dev_eui = EUI64::from_str(&req.dev_eui).map_err(|e| e.status())?;
self.validator
.validate(
request.extensions(),
validator::ValidateDeviceAccess::new(validator::Flag::Read, dev_eui),
)
.await?;
let start = SystemTime::try_from(
req.start
.as_ref()
.ok_or(anyhow!("start is None"))
.map_err(|e| e.status())?
.clone(),
)
.map_err(|e| e.status())?;
let end = SystemTime::try_from(
req.end
.as_ref()
.ok_or(anyhow!("end is None"))
.map_err(|e| e.status())?
.clone(),
)
.map_err(|e| e.status())?;
let start: DateTime<Local> = start.into();
let end: DateTime<Local> = end.into();
let aggregation = req.aggregation().from_proto();
let device_metrics = metrics::get(
&format!("device:{}", dev_eui),
metrics::Aggregation::DAY,
metrics::Kind::ABSOLUTE,
aggregation,
start,
end,
)
.await
.map_err(|e| e.status())?;
let mut out: api::GetDeviceStatsResponse = Default::default();
for m in device_metrics {
let ts: SystemTime = m.time.into();
let ts: prost_types::Timestamp = ts.into();
let mut item = api::DeviceStats {
time: Some(ts),
..Default::default()
};
item.rx_packets = m.metrics.get("rx_count").cloned().unwrap_or(0.0) as u32;
if item.rx_packets > 0 {
let gw_rssi_sum = m.metrics.get("gw_rssi_sum").cloned().unwrap_or(0.0) as f32;
let gw_snr_sum = m.metrics.get("gw_snr_sum").cloned().unwrap_or(0.0) as f32;
item.gw_rssi = gw_rssi_sum / (item.rx_packets as f32);
item.gw_snr = gw_snr_sum / (item.rx_packets as f32);
}
for (k, v) in m.metrics {
if k.starts_with("rx_freq_") {
let freq: u32 = k
.trim_start_matches("rx_freq_")
.parse()
.map_err(|e: std::num::ParseIntError| e.status())?;
item.rx_packets_per_frequency.insert(freq, v as u32);
let out = api::GetDeviceLinkMetricsResponse {
rx_packets: Some(common::Metric {
name: "Received".to_string(),
timestamps: device_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: vec![common::MetricDataset {
label: "rx_count".to_string(),
data: device_metrics
.iter()
.map(|row| row.metrics.get("rx_count").cloned().unwrap_or(0.0) as f32)
.collect(),
}],
}),
gw_rssi: Some(common::Metric {
name: "RSSI".to_string(),
timestamps: device_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: vec![common::MetricDataset {
label: "rssi".to_string(),
data: device_metrics
.iter()
.map(|row| {
let rx_packets = row.metrics.get("rx_count").cloned().unwrap_or(0.0);
let rssi_sum = row.metrics.get("gw_rssi_sum").cloned().unwrap_or(0.0);
if rx_packets > 0.0 {
(rssi_sum / rx_packets) as f32
} else {
0.0
}
})
.collect(),
}],
}),
gw_snr: Some(common::Metric {
name: "SNR".to_string(),
timestamps: device_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: vec![common::MetricDataset {
label: "snr".to_string(),
data: device_metrics
.iter()
.map(|row| {
let rx_packets = row.metrics.get("rx_count").cloned().unwrap_or(0.0);
let rssi_sum = row.metrics.get("gw_snr_sum").cloned().unwrap_or(0.0);
if rx_packets > 0.0 {
(rssi_sum / rx_packets) as f32
} else {
0.0
}
})
.collect(),
}],
}),
rx_packets_per_freq: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &device_metrics {
for k in m.metrics.keys() {
if k.starts_with("rx_freq_") {
datasets.insert(k.trim_start_matches("rx_freq_").to_string());
}
}
}
if k.starts_with("rx_dr_") {
let dr: u32 = k
.trim_start_matches("rx_dr_")
.parse()
.map_err(|e: std::num::ParseIntError| e.status())?;
item.rx_packets_per_dr.insert(dr, v as u32);
common::Metric {
name: "Received / frequency".to_string(),
timestamps: device_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: device_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("rx_freq_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
rx_packets_per_dr: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &device_metrics {
for k in m.metrics.keys() {
if k.starts_with("rx_dr_") {
datasets.insert(k.trim_start_matches("rx_dr_").to_string());
}
}
}
if k.starts_with("error_") {
let code = k.trim_start_matches("error_").to_string();
item.errors.insert(code, v as u32);
common::Metric {
name: "Received / DR".to_string(),
timestamps: device_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: device_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("rx_dr_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
errors: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &device_metrics {
for k in m.metrics.keys() {
if k.starts_with("error_") {
datasets.insert(k.trim_start_matches("error_").to_string());
}
}
}
}
out.result.push(item);
}
common::Metric {
name: "Errors".to_string(),
timestamps: device_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: device_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("error_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
};
Ok(Response::new(out))
}

View File

@ -47,6 +47,7 @@ impl DeviceProfileService for DeviceProfile {
let mut dp = device_profile::DeviceProfile {
tenant_id,
name: req_dp.name.clone(),
description: req_dp.description.clone(),
region: req_dp.region().from_proto(),
mac_version: req_dp.mac_version().from_proto(),
reg_params_revision: req_dp.reg_params_revision().from_proto(),
@ -61,7 +62,7 @@ impl DeviceProfileService for DeviceProfile {
supports_class_c: req_dp.supports_class_c,
class_b_timeout: req_dp.class_b_timeout as i32,
class_b_ping_slot_period: req_dp.class_b_ping_slot_period as i32,
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i32,
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
class_c_timeout: req_dp.class_c_timeout as i32,
abp_rx1_delay: req_dp.abp_rx1_delay as i16,
@ -69,6 +70,21 @@ impl DeviceProfileService for DeviceProfile {
abp_rx2_dr: req_dp.abp_rx2_dr as i16,
abp_rx2_freq: req_dp.abp_rx2_freq as i64,
tags: fields::KeyValue::new(req_dp.tags.clone()),
measurements: fields::Measurements::new(
req_dp
.measurements
.iter()
.map(|(k, v)| {
(
k.to_string(),
fields::Measurement {
name: v.name.clone(),
kind: v.kind().from_proto(),
},
)
})
.collect(),
),
..Default::default()
};
@ -100,6 +116,7 @@ impl DeviceProfileService for DeviceProfile {
id: dp.id.to_string(),
tenant_id: dp.tenant_id.to_string(),
name: dp.name,
description: dp.description,
region: dp.region.to_proto().into(),
mac_version: dp.mac_version.to_proto().into(),
reg_params_revision: dp.reg_params_revision.to_proto().into(),
@ -122,6 +139,20 @@ impl DeviceProfileService for DeviceProfile {
abp_rx2_dr: dp.abp_rx2_dr as u32,
abp_rx2_freq: dp.abp_rx2_freq as u32,
tags: dp.tags.into_hashmap(),
measurements: dp
.measurements
.into_hashmap()
.iter()
.map(|(k, v)| {
(
k.to_string(),
api::Measurement {
name: v.name.clone(),
kind: v.kind.to_proto().into(),
},
)
})
.collect(),
}),
created_at: Some(helpers::datetime_to_prost_timestamp(&dp.created_at)),
updated_at: Some(helpers::datetime_to_prost_timestamp(&dp.updated_at)),
@ -151,6 +182,7 @@ impl DeviceProfileService for DeviceProfile {
let _ = device_profile::update(device_profile::DeviceProfile {
id: dp_id,
name: req_dp.name.clone(),
description: req_dp.description.clone(),
region: req_dp.region().from_proto(),
mac_version: req_dp.mac_version().from_proto(),
reg_params_revision: req_dp.reg_params_revision().from_proto(),
@ -165,7 +197,7 @@ impl DeviceProfileService for DeviceProfile {
supports_class_c: req_dp.supports_class_c,
class_b_timeout: req_dp.class_b_timeout as i32,
class_b_ping_slot_period: req_dp.class_b_ping_slot_period as i32,
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i32,
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
class_c_timeout: req_dp.class_c_timeout as i32,
abp_rx1_delay: req_dp.abp_rx1_delay as i16,
@ -173,6 +205,21 @@ impl DeviceProfileService for DeviceProfile {
abp_rx2_dr: req_dp.abp_rx2_dr as i16,
abp_rx2_freq: req_dp.abp_rx2_freq as i64,
tags: fields::KeyValue::new(req_dp.tags.clone()),
measurements: fields::Measurements::new(
req_dp
.measurements
.iter()
.map(|(k, v)| {
(
k.to_string(),
fields::Measurement {
name: v.name.clone(),
kind: v.kind().from_proto(),
},
)
})
.collect(),
),
..Default::default()
})
.await

View File

@ -0,0 +1,453 @@
use tonic::{Request, Response, Status};
use chirpstack_api::api;
use chirpstack_api::api::device_profile_template_service_server::DeviceProfileTemplateService;
use super::auth::validator;
use super::error::ToStatus;
use super::helpers;
use super::helpers::{FromProto, ToProto};
use crate::storage::{device_profile_template, fields};
pub struct DeviceProfileTemplate {
validator: validator::RequestValidator,
}
impl DeviceProfileTemplate {
pub fn new(validator: validator::RequestValidator) -> Self {
DeviceProfileTemplate { validator }
}
}
#[tonic::async_trait]
impl DeviceProfileTemplateService for DeviceProfileTemplate {
async fn create(
&self,
request: Request<api::CreateDeviceProfileTemplateRequest>,
) -> Result<Response<()>, Status> {
let req_dp = match &request.get_ref().device_profile_template {
Some(v) => v,
None => {
return Err(Status::invalid_argument(
"device_profile_template is missing",
));
}
};
self.validator
.validate(
request.extensions(),
validator::ValidateDeviceProfileTemplatesAccess::new(validator::Flag::Create),
)
.await?;
let dp = device_profile_template::DeviceProfileTemplate {
id: req_dp.id.clone(),
name: req_dp.name.clone(),
description: req_dp.description.clone(),
vendor: req_dp.vendor.clone(),
firmware: req_dp.firmware.clone(),
region: req_dp.region().from_proto(),
mac_version: req_dp.mac_version().from_proto(),
reg_params_revision: req_dp.reg_params_revision().from_proto(),
adr_algorithm_id: req_dp.adr_algorithm_id.clone(),
payload_codec_runtime: req_dp.payload_codec_runtime().from_proto(),
payload_codec_script: req_dp.payload_codec_script.clone(),
flush_queue_on_activate: req_dp.flush_queue_on_activate,
uplink_interval: req_dp.uplink_interval as i32,
device_status_req_interval: req_dp.device_status_req_interval as i32,
supports_otaa: req_dp.supports_otaa,
supports_class_b: req_dp.supports_class_b,
supports_class_c: req_dp.supports_class_c,
class_b_timeout: req_dp.class_b_timeout as i32,
class_b_ping_slot_period: req_dp.class_b_ping_slot_period as i32,
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
class_c_timeout: req_dp.class_c_timeout as i32,
abp_rx1_delay: req_dp.abp_rx1_delay as i16,
abp_rx1_dr_offset: req_dp.abp_rx1_dr_offset as i16,
abp_rx2_dr: req_dp.abp_rx2_dr as i16,
abp_rx2_freq: req_dp.abp_rx2_freq as i64,
tags: fields::KeyValue::new(req_dp.tags.clone()),
measurements: fields::Measurements::new(
req_dp
.measurements
.iter()
.map(|(k, v)| {
(
k.to_string(),
fields::Measurement {
name: v.name.clone(),
kind: v.kind().from_proto(),
},
)
})
.collect(),
),
..Default::default()
};
device_profile_template::create(dp)
.await
.map_err(|e| e.status())?;
Ok(Response::new(()))
}
async fn get(
&self,
request: Request<api::GetDeviceProfileTemplateRequest>,
) -> Result<Response<api::GetDeviceProfileTemplateResponse>, Status> {
let req = request.get_ref();
self.validator
.validate(
request.extensions(),
validator::ValidateDeviceProfileTemplateAccess::new(validator::Flag::Read, &req.id),
)
.await?;
let dp = device_profile_template::get(&req.id)
.await
.map_err(|e| e.status())?;
Ok(Response::new(api::GetDeviceProfileTemplateResponse {
device_profile_template: Some(api::DeviceProfileTemplate {
id: dp.id.to_string(),
name: dp.name,
description: dp.description,
vendor: dp.vendor,
firmware: dp.firmware,
region: dp.region.to_proto().into(),
mac_version: dp.mac_version.to_proto().into(),
reg_params_revision: dp.reg_params_revision.to_proto().into(),
adr_algorithm_id: dp.adr_algorithm_id,
payload_codec_runtime: dp.payload_codec_runtime.to_proto().into(),
payload_codec_script: dp.payload_codec_script,
flush_queue_on_activate: dp.flush_queue_on_activate,
uplink_interval: dp.uplink_interval as u32,
device_status_req_interval: dp.device_status_req_interval as u32,
supports_otaa: dp.supports_otaa,
supports_class_b: dp.supports_class_b,
supports_class_c: dp.supports_class_c,
class_b_timeout: dp.class_c_timeout as u32,
class_b_ping_slot_period: dp.class_b_ping_slot_period as u32,
class_b_ping_slot_dr: dp.class_b_ping_slot_dr as u32,
class_b_ping_slot_freq: dp.class_b_ping_slot_freq as u32,
class_c_timeout: dp.class_c_timeout as u32,
abp_rx1_delay: dp.abp_rx1_delay as u32,
abp_rx1_dr_offset: dp.abp_rx1_dr_offset as u32,
abp_rx2_dr: dp.abp_rx2_dr as u32,
abp_rx2_freq: dp.abp_rx2_freq as u32,
tags: dp.tags.into_hashmap(),
measurements: dp
.measurements
.into_hashmap()
.iter()
.map(|(k, v)| {
(
k.to_string(),
api::Measurement {
name: v.name.clone(),
kind: v.kind.to_proto().into(),
},
)
})
.collect(),
}),
created_at: Some(helpers::datetime_to_prost_timestamp(&dp.created_at)),
updated_at: Some(helpers::datetime_to_prost_timestamp(&dp.updated_at)),
}))
}
async fn update(
&self,
request: Request<api::UpdateDeviceProfileTemplateRequest>,
) -> Result<Response<()>, Status> {
let req_dp = match &request.get_ref().device_profile_template {
Some(v) => v,
None => {
return Err(Status::invalid_argument(
"device_profile_template is missing",
));
}
};
self.validator
.validate(
request.extensions(),
validator::ValidateDeviceProfileTemplateAccess::new(
validator::Flag::Update,
&req_dp.id,
),
)
.await?;
device_profile_template::update(device_profile_template::DeviceProfileTemplate {
id: req_dp.id.clone(),
name: req_dp.name.clone(),
description: req_dp.description.clone(),
vendor: req_dp.vendor.clone(),
firmware: req_dp.firmware.clone(),
region: req_dp.region().from_proto(),
mac_version: req_dp.mac_version().from_proto(),
reg_params_revision: req_dp.reg_params_revision().from_proto(),
adr_algorithm_id: req_dp.adr_algorithm_id.clone(),
payload_codec_runtime: req_dp.payload_codec_runtime().from_proto(),
payload_codec_script: req_dp.payload_codec_script.clone(),
flush_queue_on_activate: req_dp.flush_queue_on_activate,
uplink_interval: req_dp.uplink_interval as i32,
device_status_req_interval: req_dp.device_status_req_interval as i32,
supports_otaa: req_dp.supports_otaa,
supports_class_b: req_dp.supports_class_b,
supports_class_c: req_dp.supports_class_c,
class_b_timeout: req_dp.class_b_timeout as i32,
class_b_ping_slot_period: req_dp.class_b_ping_slot_period as i32,
class_b_ping_slot_dr: req_dp.class_b_ping_slot_dr as i16,
class_b_ping_slot_freq: req_dp.class_b_ping_slot_freq as i64,
class_c_timeout: req_dp.class_c_timeout as i32,
abp_rx1_delay: req_dp.abp_rx1_delay as i16,
abp_rx1_dr_offset: req_dp.abp_rx1_dr_offset as i16,
abp_rx2_dr: req_dp.abp_rx2_dr as i16,
abp_rx2_freq: req_dp.abp_rx2_freq as i64,
tags: fields::KeyValue::new(req_dp.tags.clone()),
measurements: fields::Measurements::new(
req_dp
.measurements
.iter()
.map(|(k, v)| {
(
k.to_string(),
fields::Measurement {
name: v.name.clone(),
kind: v.kind().from_proto(),
},
)
})
.collect(),
),
..Default::default()
})
.await
.map_err(|e| e.status())?;
Ok(Response::new(()))
}
async fn delete(
&self,
request: Request<api::DeleteDeviceProfileTemplateRequest>,
) -> Result<Response<()>, Status> {
let req = request.get_ref();
self.validator
.validate(
request.extensions(),
validator::ValidateDeviceProfileTemplateAccess::new(
validator::Flag::Delete,
&req.id,
),
)
.await?;
device_profile_template::delete(&req.id)
.await
.map_err(|e| e.status())?;
Ok(Response::new(()))
}
async fn list(
&self,
request: Request<api::ListDeviceProfileTemplatesRequest>,
) -> Result<Response<api::ListDeviceProfileTemplatesResponse>, Status> {
let req = request.get_ref();
self.validator
.validate(
request.extensions(),
validator::ValidateDeviceProfileTemplatesAccess::new(validator::Flag::List),
)
.await?;
let count = device_profile_template::get_count()
.await
.map_err(|e| e.status())?;
let items = device_profile_template::list(req.limit as i64, req.offset as i64)
.await
.map_err(|e| e.status())?;
Ok(Response::new(api::ListDeviceProfileTemplatesResponse {
total_count: count as u32,
result: items
.iter()
.map(|dp| api::DeviceProfileTemplateListItem {
id: dp.id.to_string(),
created_at: Some(helpers::datetime_to_prost_timestamp(&dp.created_at)),
updated_at: Some(helpers::datetime_to_prost_timestamp(&dp.updated_at)),
name: dp.name.clone(),
vendor: dp.vendor.clone(),
firmware: dp.firmware.clone(),
region: dp.region.to_proto().into(),
mac_version: dp.mac_version.to_proto().into(),
reg_params_revision: dp.reg_params_revision.to_proto().into(),
supports_otaa: dp.supports_otaa,
supports_class_b: dp.supports_class_b,
supports_class_c: dp.supports_class_c,
})
.collect(),
}))
}
}
#[cfg(test)]
pub mod test {
use super::*;
use crate::api::auth::validator::RequestValidator;
use crate::api::auth::AuthID;
use crate::storage::user;
use crate::test;
use chirpstack_api::common;
use uuid::Uuid;
#[tokio::test]
async fn test_device_profile_template() {
let _guard = test::prepare().await;
// setup admin user
let u = user::User {
is_admin: true,
is_active: true,
email: "admin@admin".into(),
email_verified: true,
..Default::default()
};
let u = user::create(u).await.unwrap();
// setup the api
let service = DeviceProfileTemplate::new(RequestValidator::new());
// create
let create_req = get_request(
&u.id,
api::CreateDeviceProfileTemplateRequest {
device_profile_template: Some(api::DeviceProfileTemplate {
id: "test-id".into(),
name: "test-template".into(),
vendor: "Test Vendor".into(),
firmware: "1.2.3".into(),
region: common::Region::Eu868.into(),
mac_version: common::MacVersion::Lorawan103.into(),
reg_params_revision: common::RegParamsRevision::A.into(),
adr_algorithm_id: "default".into(),
..Default::default()
}),
},
);
let _ = service.create(create_req).await.unwrap();
// get
let get_req = get_request(
&u.id,
api::GetDeviceProfileTemplateRequest {
id: "test-id".into(),
},
);
let get_resp = service.get(get_req).await.unwrap();
assert_eq!(
Some(api::DeviceProfileTemplate {
id: "test-id".into(),
name: "test-template".into(),
vendor: "Test Vendor".into(),
firmware: "1.2.3".into(),
region: common::Region::Eu868.into(),
mac_version: common::MacVersion::Lorawan103.into(),
reg_params_revision: common::RegParamsRevision::A.into(),
adr_algorithm_id: "default".into(),
..Default::default()
}),
get_resp.get_ref().device_profile_template
);
// update
let update_req = get_request(
&u.id,
api::UpdateDeviceProfileTemplateRequest {
device_profile_template: Some(api::DeviceProfileTemplate {
id: "test-id".into(),
name: "test-template-updated".into(),
vendor: "Test Vendor".into(),
firmware: "1.2.3".into(),
region: common::Region::Eu868.into(),
mac_version: common::MacVersion::Lorawan103.into(),
reg_params_revision: common::RegParamsRevision::A.into(),
adr_algorithm_id: "default".into(),
..Default::default()
}),
},
);
let _ = service.update(update_req).await.unwrap();
// get
let get_req = get_request(
&u.id,
api::GetDeviceProfileTemplateRequest {
id: "test-id".into(),
},
);
let get_resp = service.get(get_req).await.unwrap();
assert_eq!(
Some(api::DeviceProfileTemplate {
id: "test-id".into(),
name: "test-template-updated".into(),
vendor: "Test Vendor".into(),
firmware: "1.2.3".into(),
region: common::Region::Eu868.into(),
mac_version: common::MacVersion::Lorawan103.into(),
reg_params_revision: common::RegParamsRevision::A.into(),
adr_algorithm_id: "default".into(),
..Default::default()
}),
get_resp.get_ref().device_profile_template
);
// list
let list_req = get_request(
&u.id,
api::ListDeviceProfileTemplatesRequest {
limit: 10,
offset: 0,
..Default::default()
},
);
let list_resp = service.list(list_req).await.unwrap();
let list_resp = list_resp.get_ref();
assert_eq!(1, list_resp.total_count);
assert_eq!(1, list_resp.result.len());
assert_eq!("test-id".to_string(), list_resp.result[0].id);
// delete
let del_req = get_request(
&u.id,
api::DeleteDeviceProfileTemplateRequest {
id: "test-id".into(),
},
);
let _ = service.delete(del_req).await.unwrap();
let del_req = get_request(
&u.id,
api::DeleteDeviceProfileTemplateRequest {
id: "test-id".into(),
},
);
let del_resp = service.delete(del_req).await;
assert!(del_resp.is_err());
}
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
let mut req = Request::new(req);
req.extensions_mut().insert(AuthID::User(user_id.clone()));
req
}
}

View File

@ -1,7 +1,8 @@
use std::collections::HashSet;
use std::str::FromStr;
use std::time::SystemTime;
use chrono::{DateTime, Local};
use chrono::{DateTime, Local, Utc};
use tonic::{Request, Response, Status};
use uuid::Uuid;
@ -11,7 +12,7 @@ use lrwn::EUI64;
use super::auth::validator;
use super::error::ToStatus;
use super::helpers;
use super::helpers::{self, FromProto};
use crate::certificate;
use crate::storage::{fields, gateway, metrics};
@ -261,10 +262,10 @@ impl GatewayService for Gateway {
))
}
async fn get_stats(
async fn get_metrics(
&self,
request: Request<api::GetGatewayStatsRequest>,
) -> Result<Response<api::GetGatewayStatsResponse>, Status> {
request: Request<api::GetGatewayMetricsRequest>,
) -> Result<Response<api::GetGatewayMetricsResponse>, Status> {
let req = request.get_ref();
let gateway_id = EUI64::from_str(&req.gateway_id).map_err(|e| e.status())?;
@ -295,71 +296,246 @@ impl GatewayService for Gateway {
let start: DateTime<Local> = start.into();
let end: DateTime<Local> = end.into();
let aggregation = req.aggregation().from_proto();
let gw_metrics = metrics::get(
&format!("gw:{}", gateway_id),
metrics::Aggregation::DAY,
metrics::Kind::ABSOLUTE,
aggregation,
start,
end,
)
.await
.map_err(|e| e.status())?;
let mut out: api::GetGatewayStatsResponse = Default::default();
for m in gw_metrics {
let ts: SystemTime = m.time.into();
let ts: prost_types::Timestamp = ts.into();
let mut item = api::GatewayStats {
time: Some(ts),
..Default::default()
};
item.rx_packets = m.metrics.get("rx_count").cloned().unwrap_or(0.0) as u32;
item.tx_packets = m.metrics.get("tx_count").cloned().unwrap_or(0.0) as u32;
for (k, v) in m.metrics {
if k.starts_with("tx_freq_") {
let freq: u32 = k
.trim_start_matches("tx_freq_")
.parse()
.map_err(|e: std::num::ParseIntError| e.status())?;
item.tx_packets_per_frequency.insert(freq, v as u32);
let out = api::GetGatewayMetricsResponse {
rx_packets: Some(common::Metric {
name: "Received".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: vec![common::MetricDataset {
label: "rx_count".to_string(),
data: gw_metrics
.iter()
.map(|row| row.metrics.get("rx_count").cloned().unwrap_or(0.0) as f32)
.collect(),
}],
}),
tx_packets: Some(common::Metric {
name: "Transmitted".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: vec![common::MetricDataset {
label: "tx_count".to_string(),
data: gw_metrics
.iter()
.map(|row| row.metrics.get("tx_count").cloned().unwrap_or(0.0) as f32)
.collect(),
}],
}),
tx_packets_per_freq: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &gw_metrics {
for k in m.metrics.keys() {
if k.starts_with("tx_freq_") {
datasets.insert(k.trim_start_matches("tx_freq_").to_string());
}
}
}
if k.starts_with("rx_freq_") {
let freq: u32 = k
.trim_start_matches("rx_freq_")
.parse()
.map_err(|e: std::num::ParseIntError| e.status())?;
item.rx_packets_per_frequency.insert(freq, v as u32);
common::Metric {
name: "Transmitted / frequency".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: gw_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("tx_freq_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
rx_packets_per_freq: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &gw_metrics {
for k in m.metrics.keys() {
if k.starts_with("rx_freq_") {
datasets.insert(k.trim_start_matches("rx_freq_").to_string());
}
}
}
if k.starts_with("tx_status_") {
let code = k.trim_start_matches("tx_status_").to_string();
item.tx_packets_per_status.insert(code, v as u32);
common::Metric {
name: "Received / frequency".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: gw_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("rx_freq_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
rx_packets_per_dr: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &gw_metrics {
for k in m.metrics.keys() {
if k.starts_with("rx_dr_") {
datasets.insert(k.trim_start_matches("rx_dr_").to_string());
}
}
}
if k.starts_with("tx_dr_") {
let dr: u32 = k
.trim_start_matches("tx_dr_")
.parse()
.map_err(|e: std::num::ParseIntError| e.status())?;
item.tx_packets_per_dr.insert(dr, v as u32);
common::Metric {
name: "Received / DR".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: gw_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("rx_dr_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
tx_packets_per_dr: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &gw_metrics {
for k in m.metrics.keys() {
if k.starts_with("tx_dr_") {
datasets.insert(k.trim_start_matches("tx_dr_").to_string());
}
}
}
if k.starts_with("rx_dr_") {
let dr: u32 = k
.trim_start_matches("rx_dr_")
.parse()
.map_err(|e: std::num::ParseIntError| e.status())?;
item.rx_packets_per_dr.insert(dr, v as u32);
common::Metric {
name: "Transmitted / DR".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: gw_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("tx_dr_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
tx_packets_per_status: Some({
// discover all data-sets
let mut datasets: HashSet<String> = HashSet::new();
for m in &gw_metrics {
for k in m.metrics.keys() {
if k.starts_with("tx_status_") {
datasets.insert(k.trim_start_matches("tx_status_").to_string());
}
}
}
}
out.result.push(item);
}
common::Metric {
name: "TX packets / status".to_string(),
timestamps: gw_metrics
.iter()
.map(|row| {
let ts: DateTime<Utc> = row.time.into();
let ts: pbjson_types::Timestamp = ts.into();
ts
})
.collect(),
datasets: datasets
.iter()
.map(|label| common::MetricDataset {
label: label.to_string(),
data: gw_metrics
.iter()
.map(|row| {
row.metrics
.get(&format!("tx_status_{}", label))
.cloned()
.unwrap_or(0.0) as f32
})
.collect(),
})
.collect(),
}
}),
};
Ok(Response::new(out))
}
@ -558,6 +734,7 @@ pub mod test {
// insert stats
let mut m = metrics::Record {
kind: metrics::Kind::ABSOLUTE,
time: now.into(),
metrics: HashMap::new(),
};
@ -577,36 +754,35 @@ pub mod test {
// request stats
let now_st: SystemTime = now.into();
let stats_req = api::GetGatewayStatsRequest {
let stats_req = api::GetGatewayMetricsRequest {
gateway_id: "0102030405060708".into(),
start: Some(now_st.into()),
end: Some(now_st.into()),
aggregation: common::Aggregation::Day.into(),
};
let mut stats_req = Request::new(stats_req);
stats_req
.extensions_mut()
.insert(AuthID::User(u.id.clone()));
let stats_resp = service.get_stats(stats_req).await.unwrap();
let stats_resp = service.get_metrics(stats_req).await.unwrap();
let stats_resp = stats_resp.get_ref();
assert_eq!(1, stats_resp.result.len());
assert_eq!(
api::GatewayStats {
time: Some({
Some(common::Metric {
name: "Received".to_string(),
timestamps: vec![{
let ts = Local
.ymd(now.year(), now.month(), now.day())
.and_hms(0, 0, 0);
let ts: SystemTime = ts.into();
//let ts: SystemTime = ts.into();
let ts: DateTime<Utc> = ts.into();
ts.into()
}),
rx_packets: 10,
tx_packets: 5,
rx_packets_per_frequency: [(868100000, 10)].iter().cloned().collect(),
rx_packets_per_dr: [(5, 10)].iter().cloned().collect(),
tx_packets_per_frequency: [(868200000, 5)].iter().cloned().collect(),
tx_packets_per_dr: [(4, 5)].iter().cloned().collect(),
..Default::default()
},
stats_resp.result[0]
}],
datasets: vec![common::MetricDataset {
label: "rx_count".to_string(),
data: vec![10.0],
}],
}),
stats_resp.rx_packets
);
}
}

View File

@ -1,6 +1,8 @@
use chrono::{DateTime, Utc};
use crate::codec::Codec;
use crate::storage::fields::MeasurementKind;
use crate::storage::metrics::Aggregation;
use chirpstack_api::{api, common};
use lrwn::region::{CommonName, MacVersion, Revision};
@ -140,6 +142,50 @@ impl FromProto<Codec> for api::CodecRuntime {
}
}
impl ToProto<api::MeasurementKind> for MeasurementKind {
fn to_proto(self) -> api::MeasurementKind {
match self {
MeasurementKind::UNKNOWN => api::MeasurementKind::Unknown,
MeasurementKind::COUNTER => api::MeasurementKind::Counter,
MeasurementKind::ABSOLUTE => api::MeasurementKind::Absolute,
MeasurementKind::GAUGE => api::MeasurementKind::Gauge,
MeasurementKind::STRING => api::MeasurementKind::String,
}
}
}
impl FromProto<MeasurementKind> for api::MeasurementKind {
fn from_proto(self) -> MeasurementKind {
match self {
api::MeasurementKind::Unknown => MeasurementKind::UNKNOWN,
api::MeasurementKind::Counter => MeasurementKind::COUNTER,
api::MeasurementKind::Absolute => MeasurementKind::ABSOLUTE,
api::MeasurementKind::Gauge => MeasurementKind::GAUGE,
api::MeasurementKind::String => MeasurementKind::STRING,
}
}
}
impl ToProto<common::Aggregation> for Aggregation {
fn to_proto(self) -> common::Aggregation {
match self {
Aggregation::HOUR => common::Aggregation::Hour,
Aggregation::DAY => common::Aggregation::Day,
Aggregation::MONTH => common::Aggregation::Month,
}
}
}
impl FromProto<Aggregation> for common::Aggregation {
fn from_proto(self) -> Aggregation {
match self {
common::Aggregation::Hour => Aggregation::HOUR,
common::Aggregation::Day => Aggregation::DAY,
common::Aggregation::Month => Aggregation::MONTH,
}
}
}
pub fn datetime_to_prost_timestamp(dt: &DateTime<Utc>) -> prost_types::Timestamp {
let ts = dt.timestamp_nanos();

View File

@ -18,6 +18,7 @@ use warp::{http::header::HeaderValue, path::Tail, reply::Response, Filter, Rejec
use chirpstack_api::api::application_service_server::ApplicationServiceServer;
use chirpstack_api::api::device_profile_service_server::DeviceProfileServiceServer;
use chirpstack_api::api::device_profile_template_service_server::DeviceProfileTemplateServiceServer;
use chirpstack_api::api::device_service_server::DeviceServiceServer;
use chirpstack_api::api::gateway_service_server::GatewayServiceServer;
use chirpstack_api::api::internal_service_server::InternalServiceServer;
@ -32,6 +33,7 @@ pub mod application;
pub mod auth;
pub mod device;
pub mod device_profile;
pub mod device_profile_template;
pub mod error;
pub mod gateway;
pub mod helpers;
@ -88,6 +90,14 @@ pub async fn setup() -> Result<()> {
auth::auth_interceptor,
),
))
.add_service(tonic_web::enable(
DeviceProfileTemplateServiceServer::with_interceptor(
device_profile_template::DeviceProfileTemplate::new(
validator::RequestValidator::new(),
),
auth::auth_interceptor,
),
))
.add_service(tonic_web::enable(TenantServiceServer::with_interceptor(
tenant::Tenant::new(validator::RequestValidator::new()),
auth::auth_interceptor,
@ -229,7 +239,7 @@ async fn http_serve(path: Tail) -> Result<impl Reply, Rejection> {
let asset = Asset::get(path).ok_or_else(warp::reject::not_found)?;
let mime = mime_guess::from_path(path).first_or_octet_stream();
let mut res = Response::new(asset.into());
let mut res = Response::new(asset.data.into());
res.headers_mut().insert(
"content-type",
HeaderValue::from_str(mime.as_ref()).unwrap(),

View File

@ -334,6 +334,15 @@ impl TenantService for Tenant {
)
.await?;
let auth_id = request.extensions().get::<AuthID>().unwrap();
if let AuthID::User(id) = auth_id {
if id == &user_id {
return Err(Status::invalid_argument(
"you can not delete yourself from the user",
));
}
}
tenant::delete_user(&tenant_id, &user_id)
.await
.map_err(|e| e.status())?;

View File

@ -7,7 +7,7 @@ use uuid::Uuid;
use chirpstack_api::api;
use chirpstack_api::api::user_service_server::UserService;
use super::auth::validator;
use super::auth::{validator, AuthID};
use super::error::ToStatus;
use super::helpers;
use crate::storage::{tenant, user};
@ -158,6 +158,15 @@ impl UserService for User {
)
.await?;
let auth_id = request.extensions().get::<AuthID>().unwrap();
if let AuthID::User(id) = auth_id {
if id == &user_id {
return Err(Status::invalid_argument(
"you can not delete yourself from the user",
));
}
}
user::delete(&user_id).await.map_err(|e| e.status())?;
Ok(Response::new(()))
@ -359,5 +368,13 @@ pub mod test {
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
let del_resp = service.delete(del_req).await;
assert!(del_resp.is_err());
let del_req = api::DeleteUserRequest {
id: u.id.to_string(),
};
let mut del_req = Request::new(del_req);
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
let del_resp = service.delete(del_req).await;
assert!(del_resp.is_err());
}
}

View File

@ -0,0 +1,292 @@
use std::collections::{HashMap, HashSet};
use std::fs::{read_to_string, File};
use std::path::Path;
use std::str::FromStr;
use anyhow::Result;
use serde::Deserialize;
use tracing::{info, warn};
use crate::codec::Codec;
use crate::storage::{self, device_profile_template};
use lrwn::region::{CommonName, MacVersion, Revision};
#[derive(Deserialize, Default)]
#[serde(default)]
struct Vendors {
pub vendors: Vec<Vendor>,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct Vendor {
pub id: String,
pub name: String,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct Devices {
#[serde(rename = "endDevices")]
pub end_devices: Vec<String>,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct Device {
pub name: String,
pub description: String,
#[serde(rename = "firmwareVersions")]
pub firmware_versions: Vec<FirmwareVersion>,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct FirmwareVersion {
pub version: String,
pub profiles: HashMap<String, ProfileMeta>,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct ProfileMeta {
#[serde(rename = "vendorID")]
pub vendor_id: String,
pub id: String,
pub codec: String,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct Profile {
#[serde(rename = "vendorProfileID")]
pub vendor_profile_id: String,
#[serde(rename = "macVersion")]
pub mac_version: String,
#[serde(rename = "regionalParametersVersion")]
pub region_parameters_version: String,
#[serde(rename = "supportsJoin")]
pub supports_join: bool,
#[serde(rename = "rx1Delay")]
pub rx1_delay: u8,
#[serde(rename = "rx1DataRateOffset")]
pub rx1_data_rate_offset: u8,
#[serde(rename = "rx2DataRateIndex")]
pub rx2_data_rate_index: u8,
#[serde(rename = "rx2Frequency")]
pub rx2_frequency: f64,
#[serde(rename = "supportsClassB")]
pub supports_class_b: bool,
#[serde(rename = "classBTimeout")]
pub class_b_timeout: usize, // seconds
#[serde(rename = "pingSlotPeriod")]
pub ping_slot_period: usize,
#[serde(rename = "pingSlotDataRateIndex")]
pub ping_slot_data_rate_index: u8,
#[serde(rename = "pingSlotFrequency")]
pub ping_slot_frequency: f64,
#[serde(rename = "supportsClassC")]
pub supports_class_c: bool,
#[serde(rename = "classCTimeout")]
pub class_c_timeout: usize,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct JsCodec {
#[serde(rename = "uplinkDecoder")]
pub uplink_decoder: Option<CodecFunction>,
#[serde(rename = "downlinkEncoder")]
pub downlink_encoder: Option<CodecFunction>,
#[serde(rename = "downlinkDecoder")]
pub downlink_decoder: Option<CodecFunction>,
}
#[derive(Deserialize, Default)]
#[serde(default)]
struct CodecFunction {
#[serde(rename = "fileName")]
pub filename: String,
}
pub async fn run(dir: &Path) -> Result<()> {
storage::setup().await?;
let vendor_index_yml = dir.join("vendor").join("index.yaml");
info!(path = ?vendor_index_yml, "Reading vendor index file");
let vendors: Vendors = serde_yaml::from_reader(File::open(&vendor_index_yml)?)?;
for vendor in &vendors.vendors {
if vendor.id == "example" {
continue;
}
info!(vendor_id = %vendor.id, vendor_name = %vendor.name, "Found vendor");
let vendor_dir = dir.join("vendor").join(&vendor.id);
let devices_index_yml = vendor_dir.join("index.yaml");
info!(path = ?devices_index_yml, "Reading devices index file");
let devices: Devices = serde_yaml::from_reader(match File::open(&devices_index_yml) {
Ok(v) => v,
Err(e) => {
warn!(path = ?devices_index_yml, error = %e, "Failed opening index.yaml within vendor folder, it might not have any devices");
continue;
}
})?;
for device_id in &devices.end_devices {
let device_yml = vendor_dir.join(format!("{}.yaml", device_id));
info!(path = ?device_yml, "Reading device file");
let dev: Device = serde_yaml::from_reader(File::open(&device_yml)?)?;
import_device(&vendor_dir, vendor, device_id, &dev).await?;
}
}
Ok(())
}
async fn import_device(
dir: &Path,
vendor: &Vendor,
device_id: &str,
device: &Device,
) -> Result<()> {
info!(vendor_id = %vendor.id, device_id = %device_id, "Importing device");
let id_regex = regex::Regex::new(r"[^\w-]+").unwrap();
for fw in &device.firmware_versions {
for (region, profile) in &fw.profiles {
info!(fw_version = %fw.version, region = %region, vendor_id = %profile.vendor_id, profile = %profile.id, codec = %profile.codec, "Found profile");
let profile_yml = if profile.vendor_id.is_empty() {
dir.join(format!("{}.yaml", profile.id))
} else {
dir.join("..")
.join(&profile.vendor_id)
.join(format!("{}.yaml", profile.id))
};
info!(path = ?profile_yml, "Reading profile");
let prof: Profile = serde_yaml::from_reader(File::open(&profile_yml)?)?;
let codec = if profile.codec.is_empty() {
None
} else {
let codec_yml = dir.join(format!("{}.yaml", profile.codec));
info!(path = ?codec_yml, "Reading codec");
let codec: JsCodec = serde_yaml::from_reader(File::open(&codec_yml)?)?;
let mut files_to_read: HashSet<String> = HashSet::new();
if let Some(c) = &codec.uplink_decoder {
files_to_read.insert(c.filename.clone());
}
if let Some(c) = &codec.downlink_encoder {
files_to_read.insert(c.filename.clone());
}
if let Some(c) = &codec.downlink_decoder {
files_to_read.insert(c.filename.clone());
}
let mut codec_js: String = "".to_string();
for f in &files_to_read {
let codec_f = dir.join(f);
info!(path = ?codec_f, "Reading codec function code");
codec_js.push_str(&read_to_string(codec_f)?);
}
Some(codec_js)
};
let regions: Vec<CommonName> = match region.as_ref() {
"EU863-870" => vec![CommonName::EU868],
"US902-928" => vec![CommonName::US915],
"AU915-928" => vec![CommonName::AU915],
"AS923" => vec![
CommonName::AS923,
CommonName::AS923_2,
CommonName::AS923_3,
CommonName::AS923_4,
],
"CN779-787" => vec![CommonName::CN779],
"EU433" => vec![CommonName::EU433],
"CN470-510" => vec![CommonName::CN470],
"KR920-923" => vec![CommonName::KR920],
"IN865-867" => vec![CommonName::IN865],
"RU864-870" => vec![CommonName::RU864],
_ => {
return Err(anyhow!("Unexpected region: {}", region));
}
};
for region in regions {
let id = format!(
"{}-{}-{}-{}-{}",
vendor.id, device_id, fw.version, region, profile.id
);
let id = id_regex.replace_all(&id, "-").to_string();
let dp = device_profile_template::DeviceProfileTemplate {
id,
name: truncate(&device.name, 100).to_string(),
description: format!(
"{}\n\nSource: https://github.com/TheThingsNetwork/lorawan-devices",
device.description
),
vendor: vendor.name.clone(),
firmware: fw.version.clone(),
region,
mac_version: MacVersion::from_str(&prof.mac_version)?,
reg_params_revision: match prof.region_parameters_version.as_ref() {
"TS001-1.0" => Revision::A,
"TS001-1.0.1" => Revision::A,
"RP001-1.0.2" => Revision::A,
"RP001-1.0.2-RevB" => Revision::B,
"RP001-1.0.3-RevA" => Revision::A,
"RP001-1.1-RevA" => Revision::A,
"RP001-1.1-RevB" => Revision::B,
_ => Revision::from_str(&prof.region_parameters_version)?,
},
adr_algorithm_id: "default".into(),
payload_codec_runtime: match &codec {
None => Codec::NONE,
Some(_) => Codec::JS,
},
payload_codec_script: match &codec {
None => "".to_string(),
Some(v) => v.to_string(),
},
uplink_interval: 60 * 60,
device_status_req_interval: 1,
flush_queue_on_activate: true,
supports_otaa: prof.supports_join,
supports_class_b: prof.supports_class_b,
supports_class_c: prof.supports_class_c,
class_b_timeout: prof.class_b_timeout as i32,
class_b_ping_slot_period: prof.ping_slot_period as i32,
class_b_ping_slot_dr: prof.ping_slot_data_rate_index as i16,
class_b_ping_slot_freq: (prof.ping_slot_frequency * 1_000_000.0) as i64,
class_c_timeout: prof.class_c_timeout as i32,
abp_rx1_delay: prof.rx1_delay as i16,
abp_rx1_dr_offset: prof.rx1_data_rate_offset as i16,
abp_rx2_dr: prof.rx2_data_rate_index as i16,
abp_rx2_freq: (prof.rx2_frequency * 1_000_000.0) as i64,
..Default::default()
};
device_profile_template::upsert(dp).await?;
}
}
}
Ok(())
}
fn truncate(s: &str, max_chars: usize) -> &str {
match s.char_indices().nth(max_chars) {
None => s,
Some((idx, _)) => &s[..idx],
}
}

View File

@ -1,3 +1,4 @@
pub mod configfile;
pub mod import_ttn_lorawan_devices;
pub mod print_ds;
pub mod root;

View File

@ -110,32 +110,27 @@ pub fn pb_json_to_prost(obj: &pbjson_types::Struct) -> prost_types::Struct {
fn _pb_json_to_prost(v: &pbjson_types::Value) -> prost_types::Value {
prost_types::Value {
kind: match &v.kind {
None => None,
Some(v) => Some(match v {
pbjson_types::value::Kind::NullValue(v) => prost_types::value::Kind::NullValue(*v),
pbjson_types::value::Kind::NumberValue(v) => {
prost_types::value::Kind::NumberValue(*v)
}
pbjson_types::value::Kind::StringValue(v) => {
prost_types::value::Kind::StringValue(v.to_string())
}
pbjson_types::value::Kind::BoolValue(v) => prost_types::value::Kind::BoolValue(*v),
pbjson_types::value::Kind::StructValue(v) => {
prost_types::value::Kind::StructValue(prost_types::Struct {
fields: v
.fields
.iter()
.map(|(k, v)| (k.to_string(), _pb_json_to_prost(v)))
.collect(),
})
}
pbjson_types::value::Kind::ListValue(v) => {
prost_types::value::Kind::ListValue(prost_types::ListValue {
values: v.values.iter().map(|i| _pb_json_to_prost(i)).collect(),
})
}
}),
},
kind: v.kind.as_ref().map(|v| match v {
pbjson_types::value::Kind::NullValue(v) => prost_types::value::Kind::NullValue(*v),
pbjson_types::value::Kind::NumberValue(v) => prost_types::value::Kind::NumberValue(*v),
pbjson_types::value::Kind::StringValue(v) => {
prost_types::value::Kind::StringValue(v.to_string())
}
pbjson_types::value::Kind::BoolValue(v) => prost_types::value::Kind::BoolValue(*v),
pbjson_types::value::Kind::StructValue(v) => {
prost_types::value::Kind::StructValue(prost_types::Struct {
fields: v
.fields
.iter()
.map(|(k, v)| (k.to_string(), _pb_json_to_prost(v)))
.collect(),
})
}
pbjson_types::value::Kind::ListValue(v) => {
prost_types::value::Kind::ListValue(prost_types::ListValue {
values: v.values.iter().map(_pb_json_to_prost).collect(),
})
}
}),
}
}

View File

@ -2,12 +2,18 @@ use std::collections::HashMap;
use std::time::SystemTime;
use anyhow::Result;
use chrono::{DateTime, Utc};
use rquickjs::IntoJs;
use super::convert;
use crate::config;
mod vendor_base64_js;
mod vendor_buffer;
mod vendor_ieee754;
pub async fn decode(
recv_time: DateTime<Utc>,
f_port: u8,
variables: &HashMap<String, String>,
decode_config: &str,
@ -16,8 +22,18 @@ pub async fn decode(
let conf = config::get();
let max_run_ts = SystemTime::now() + conf.codec.js.max_execution_time;
let resolver = rquickjs::BuiltinResolver::default()
.with_module("base64-js")
.with_module("ieee754")
.with_module("buffer");
let loader = rquickjs::BuiltinLoader::default()
.with_module("base64-js", vendor_base64_js::SCRIPT)
.with_module("ieee754", vendor_ieee754::SCRIPT)
.with_module("buffer", vendor_buffer::SCRIPT);
let rt = rquickjs::Runtime::new()?;
rt.set_interrupt_handler(Some(Box::new(move || SystemTime::now() > max_run_ts)));
rt.set_loader(resolver, loader);
let ctx = rquickjs::Context::full(&rt)?;
@ -25,31 +41,61 @@ pub async fn decode(
r#"
{}
export {{ decodeUplink }};
decodeUplink(chirpstack_input)
"#,
decode_config
);
let b = b.to_vec();
let out = ctx.with(|ctx| -> Result<pbjson_types::Struct> {
let m = ctx.compile("script", script)?;
let func: rquickjs::Function = m.get("decodeUplink")?;
// We need to export the Buffer class, as eval / eval_with_options
// does not allow using import statement.
let buff: rquickjs::Module = ctx.compile(
"b",
r#"
import { Buffer } from "buffer";
export { Buffer }
"#,
)?;
let buff: rquickjs::Function = buff.get("Buffer")?;
let input = rquickjs::Object::new(ctx)?;
input.set("fPort", f_port.into_js(ctx)?)?;
input.set("variables", variables.into_js(ctx)?)?;
input.set("bytes", b.into_js(ctx)?)?;
input.set("fPort", f_port.into_js(ctx)?)?;
input.set("recvTime", recv_time.into_js(ctx)?)?;
input.set("variables", variables.into_js(ctx)?)?;
let globals = ctx.globals();
globals.set("chirpstack_input", input)?;
globals.set("Buffer", buff)?;
let res: rquickjs::Object = ctx.eval_with_options(
script,
rquickjs::EvalOptions {
strict: false,
..Default::default()
},
)?;
let errors: Result<Vec<String>, rquickjs::Error> = res.get("errors");
if let Ok(errors) = errors {
if !errors.is_empty() {
return Err(anyhow!(
"decodeUplink returned errors: {}",
errors.join(", ")
));
}
}
let res: rquickjs::Object = func.call((input,))?;
Ok(convert::rquickjs_to_struct(&res))
})?;
let obj = out.fields.get("object").cloned().unwrap_or_default();
if let Some(pbjson_types::value::Kind::StructValue(v)) = obj.kind {
let data = out.fields.get("data").cloned().unwrap_or_default();
if let Some(pbjson_types::value::Kind::StructValue(v)) = data.kind {
return Ok(v);
}
Err(anyhow!("decodeUplink did not return 'object'"))
Err(anyhow!("decodeUplink did not return 'data'"))
}
pub async fn encode(
@ -61,29 +107,69 @@ pub async fn encode(
let conf = config::get();
let max_run_ts = SystemTime::now() + conf.codec.js.max_execution_time;
let resolver = rquickjs::BuiltinResolver::default()
.with_module("base64-js")
.with_module("ieee754")
.with_module("buffer");
let loader = rquickjs::BuiltinLoader::default()
.with_module("base64-js", vendor_base64_js::SCRIPT)
.with_module("ieee754", vendor_ieee754::SCRIPT)
.with_module("buffer", vendor_buffer::SCRIPT);
let rt = rquickjs::Runtime::new()?;
rt.set_interrupt_handler(Some(Box::new(move || SystemTime::now() > max_run_ts)));
rt.set_loader(resolver, loader);
let ctx = rquickjs::Context::full(&rt)?;
let script = format!(
r#"
{}
export {{ encodeDownlink }};
encodeDownlink(chirpstack_input)
"#,
encode_config,
);
ctx.with(|ctx| {
let m = ctx.compile("script", script)?;
let func: rquickjs::Function = m.get("encodeDownlink")?;
// We need to export the Buffer class, as eval / eval_with_options
// does not allow using import statement.
let buff: rquickjs::Module = ctx.compile(
"b",
r#"
import { Buffer } from "buffer";
export { Buffer }
"#,
)?;
let buff: rquickjs::Function = buff.get("Buffer")?;
let input = rquickjs::Object::new(ctx)?;
input.set("fPort", f_port.into_js(ctx)?)?;
input.set("variables", variables.into_js(ctx)?)?;
input.set("data", convert::struct_to_rquickjs(ctx, s))?;
let res: rquickjs::Object = func.call((input,))?;
let globals = ctx.globals();
globals.set("chirpstack_input", input)?;
globals.set("Buffer", buff)?;
let res: rquickjs::Object = ctx.eval_with_options(
script,
rquickjs::EvalOptions {
strict: false,
..Default::default()
},
)?;
let errors: Result<Vec<String>, rquickjs::Error> = res.get("errors");
if let Ok(errors) = errors {
if !errors.is_empty() {
return Err(anyhow!(
"encodeDownlink returned errors: {}",
errors.join(", ")
));
}
}
let v: Vec<u8> = res.get("bytes")?;
Ok(v)
})
@ -92,6 +178,7 @@ pub async fn encode(
#[cfg(test)]
pub mod test {
use super::*;
use chrono::TimeZone;
#[tokio::test]
pub async fn test_decode_timeout() {
@ -105,19 +192,25 @@ pub mod test {
.to_string();
let vars: HashMap<String, String> = HashMap::new();
let out = decode(10, &vars, &decoder, &[0x01, 0x02, 0x03]).await;
let out = decode(Utc::now(), 10, &vars, &decoder, &[0x01, 0x02, 0x03]).await;
assert!(out.is_err());
}
#[tokio::test]
pub async fn test_decode() {
let recv_time = Utc.ymd(2014, 7, 8).and_hms(9, 10, 11);
let decoder = r#"
function decodeUplink(input) {
var buff = new Buffer(input.bytes);
return {
object: {
data: {
f_port: input.fPort,
variables: input.variables,
data: input.bytes
data_hex: buff.toString('hex'),
data: input.bytes,
recv_time: input.recvTime.toString()
}
};
}
@ -127,7 +220,7 @@ pub mod test {
let mut vars: HashMap<String, String> = HashMap::new();
vars.insert("foo".into(), "bar".into());
let out = decode(10, &vars, &decoder, &[0x01, 0x02, 0x03])
let out = decode(recv_time, 10, &vars, &decoder, &[0x01, 0x02, 0x03])
.await
.unwrap();
@ -159,6 +252,12 @@ pub mod test {
)),
},
),
(
"data_hex".to_string(),
pbjson_types::Value {
kind: Some(pbjson_types::value::Kind::StringValue("010203".to_string())),
},
),
(
"data".to_string(),
pbjson_types::Value {
@ -179,6 +278,14 @@ pub mod test {
)),
},
),
(
"recv_time".to_string(),
pbjson_types::Value {
kind: Some(pbjson_types::value::Kind::StringValue(
"Tue Jul 08 2014 09:10:11 GMT+0000".to_string(),
)),
},
),
]
.iter()
.cloned()

View File

@ -0,0 +1,155 @@
// base64-js does basic base64 encoding/decoding in pure JS.
//
// License: MIT
// Source: https://github.com/beatgammit/base64-js
pub const SCRIPT: &str = r#"
'use strict'
export { byteLength, toByteArray, fromByteArray };
var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
lookup[i] = code[i]
revLookup[code.charCodeAt(i)] = i
}
// Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63
function getLens (b64) {
var len = b64.length
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4')
}
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
var validLen = b64.indexOf('=')
if (validLen === -1) validLen = len
var placeHoldersLen = validLen === len
? 0
: 4 - (validLen % 4)
return [validLen, placeHoldersLen]
}
// base64 is 4/3 + up to two characters of the original data
function byteLength (b64) {
var lens = getLens(b64)
var validLen = lens[0]
var placeHoldersLen = lens[1]
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function _byteLength (b64, validLen, placeHoldersLen) {
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
}
function toByteArray (b64) {
var tmp
var lens = getLens(b64)
var validLen = lens[0]
var placeHoldersLen = lens[1]
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
var curByte = 0
// if there are placeholders, only get up to the last complete 4 chars
var len = placeHoldersLen > 0
? validLen - 4
: validLen
var i
for (i = 0; i < len; i += 4) {
tmp =
(revLookup[b64.charCodeAt(i)] << 18) |
(revLookup[b64.charCodeAt(i + 1)] << 12) |
(revLookup[b64.charCodeAt(i + 2)] << 6) |
revLookup[b64.charCodeAt(i + 3)]
arr[curByte++] = (tmp >> 16) & 0xFF
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
}
if (placeHoldersLen === 2) {
tmp =
(revLookup[b64.charCodeAt(i)] << 2) |
(revLookup[b64.charCodeAt(i + 1)] >> 4)
arr[curByte++] = tmp & 0xFF
}
if (placeHoldersLen === 1) {
tmp =
(revLookup[b64.charCodeAt(i)] << 10) |
(revLookup[b64.charCodeAt(i + 1)] << 4) |
(revLookup[b64.charCodeAt(i + 2)] >> 2)
arr[curByte++] = (tmp >> 8) & 0xFF
arr[curByte++] = tmp & 0xFF
}
return arr
}
function tripletToBase64 (num) {
return lookup[num >> 18 & 0x3F] +
lookup[num >> 12 & 0x3F] +
lookup[num >> 6 & 0x3F] +
lookup[num & 0x3F]
}
function encodeChunk (uint8, start, end) {
var tmp
var output = []
for (var i = start; i < end; i += 3) {
tmp =
((uint8[i] << 16) & 0xFF0000) +
((uint8[i + 1] << 8) & 0xFF00) +
(uint8[i + 2] & 0xFF)
output.push(tripletToBase64(tmp))
}
return output.join('')
}
function fromByteArray (uint8) {
var tmp
var len = uint8.length
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
var parts = []
var maxChunkLength = 16383 // must be multiple of 3
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1]
parts.push(
lookup[tmp >> 2] +
lookup[(tmp << 4) & 0x3F] +
'=='
)
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
parts.push(
lookup[tmp >> 10] +
lookup[(tmp >> 4) & 0x3F] +
lookup[(tmp << 2) & 0x3F] +
'='
)
}
return parts.join('')
}
"#;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,110 @@
// Read/write IEEE754 floating point numbers from/to a Buffer or array-like object.
//
// License: BSD (3 clause)
// Source: https://github.com/feross/ieee754
pub const SCRIPT: &str = r#"
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
export function read(buffer, offset, isLE, mLen, nBytes) {
let e, m
const eLen = (nBytes * 8) - mLen - 1
const eMax = (1 << eLen) - 1
const eBias = eMax >> 1
let nBits = -7
let i = isLE ? (nBytes - 1) : 0
const d = isLE ? -1 : 1
let s = buffer[offset + i]
i += d
e = s & ((1 << (-nBits)) - 1)
s >>= (-nBits)
nBits += eLen
while (nBits > 0) {
e = (e * 256) + buffer[offset + i]
i += d
nBits -= 8
}
m = e & ((1 << (-nBits)) - 1)
e >>= (-nBits)
nBits += mLen
while (nBits > 0) {
m = (m * 256) + buffer[offset + i]
i += d
nBits -= 8
}
if (e === 0) {
e = 1 - eBias
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen)
e = e - eBias
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
export function write(buffer, value, offset, isLE, mLen, nBytes) {
let e, m, c
let eLen = (nBytes * 8) - mLen - 1
const eMax = (1 << eLen) - 1
const eBias = eMax >> 1
const rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
let i = isLE ? 0 : (nBytes - 1)
const d = isLE ? 1 : -1
const s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
value = Math.abs(value)
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0
e = eMax
} else {
e = Math.floor(Math.log(value) / Math.LN2)
if (value * (c = Math.pow(2, -e)) < 1) {
e--
c *= 2
}
if (e + eBias >= 1) {
value += rt / c
} else {
value += rt * Math.pow(2, 1 - eBias)
}
if (value * c >= 2) {
e++
c /= 2
}
if (e + eBias >= eMax) {
m = 0
e = eMax
} else if (e + eBias >= 1) {
m = ((value * c) - 1) * Math.pow(2, mLen)
e = e + eBias
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
e = 0
}
}
while (mLen >= 8) {
buffer[offset + i] = m & 0xff
i += d
m /= 256
mLen -= 8
}
e = (e << mLen) | m
eLen += mLen
while (eLen > 0) {
buffer[offset + i] = e & 0xff
i += d
e /= 256
eLen -= 8
}
buffer[offset + i - d] |= s * 128
}
"#;

View File

@ -4,6 +4,7 @@ use std::io::Write;
use std::str::FromStr;
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use diesel::backend::Backend;
use diesel::sql_types::Text;
use diesel::{deserialize, serialize};
@ -66,6 +67,7 @@ impl FromStr for Codec {
pub async fn binary_to_struct(
codec: Codec,
recv_time: DateTime<Utc>,
f_port: u8,
variables: &HashMap<String, String>,
decoder_config: &str,
@ -74,7 +76,7 @@ pub async fn binary_to_struct(
Ok(match codec {
Codec::NONE => None,
Codec::CAYENNE_LPP => Some(cayenne_lpp::decode(b).context("CayenneLpp decode")?),
Codec::JS => Some(js::decode(f_port, variables, decoder_config, b).await?),
Codec::JS => Some(js::decode(recv_time, f_port, variables, decoder_config, b).await?),
})
}
@ -93,3 +95,84 @@ pub async fn struct_to_binary(
.context("JavaScript encoder")?,
})
}
/*
pub fn get_data_keys(s: &pbjson_types::Struct) -> Vec<String> {
let mut out: Vec<String> = Vec::new();
for (k, v) in &s.fields {
out.extend_from_slice(&_get_data_keys(k, v));
}
out
}
fn _get_data_keys(prefix: &str, v: &pbjson_types::Value) -> Vec<String> {
match &v.kind {
None => vec![prefix.to_string()],
Some(v) => match v {
pbjson_types::value::Kind::NullValue(_)
| pbjson_types::value::Kind::NumberValue(_)
| pbjson_types::value::Kind::StringValue(_)
| pbjson_types::value::Kind::BoolValue(_) => {
vec![prefix.to_string()]
}
pbjson_types::value::Kind::StructValue(v) => {
let mut out: Vec<String> = Vec::new();
for (k, v) in &v.fields {
out.extend_from_slice(&_get_data_keys(&format!("{}_{}", prefix, k), v));
}
out
}
pbjson_types::value::Kind::ListValue(v) => {
let mut out: Vec<String> = Vec::new();
for (i, v) in v.values.iter().enumerate() {
out.extend_from_slice(&_get_data_keys(&format!("{}_{}", prefix, i), v));
}
out
}
},
}
}
*/
pub fn get_measurements(s: &pbjson_types::Struct) -> HashMap<String, pbjson_types::value::Kind> {
let mut out: HashMap<String, pbjson_types::value::Kind> = HashMap::new();
for (k, v) in &s.fields {
out.extend(_get_measurements(k, v));
}
out
}
fn _get_measurements(
prefix: &str,
v: &pbjson_types::Value,
) -> HashMap<String, pbjson_types::value::Kind> {
let mut out: HashMap<String, pbjson_types::value::Kind> = HashMap::new();
match &v.kind {
None => {}
Some(v) => match v {
pbjson_types::value::Kind::NullValue(_) => {}
pbjson_types::value::Kind::NumberValue(_)
| pbjson_types::value::Kind::StringValue(_)
| pbjson_types::value::Kind::BoolValue(_) => {
out.insert(prefix.to_string(), v.clone());
}
pbjson_types::value::Kind::StructValue(v) => {
for (k, v) in &v.fields {
out.extend(_get_measurements(&format!("{}_{}", prefix, k), v));
}
}
pbjson_types::value::Kind::ListValue(v) => {
for (i, v) in v.values.iter().enumerate() {
out.extend(_get_measurements(&format!("{}_{}", prefix, i), v));
}
}
},
}
out
}

View File

@ -977,6 +977,14 @@ impl Data {
self.mac_commands.push(set);
}
let rx1_delay = self.device_session.rx1_delay as u8;
if rx1_delay != self.network_conf.rx1_delay {
let set = maccommand::rx_timing_setup::request(self.network_conf.rx1_delay);
mac_command::set_pending(&self.device.dev_eui, lrwn::CID::RxTimingSetupReq, &set)
.await?;
self.mac_commands.push(set);
}
Ok(())
}

View File

@ -150,7 +150,7 @@ impl<'a> Integration<'a> {
info!("Starting MQTT consumer loop");
while let Some(msg_opt) = stream.next().await {
if let Some(msg) = msg_opt {
let caps = match command_regex.captures(&msg.topic()) {
let caps = match command_regex.captures(msg.topic()) {
Some(v) => v,
None => {
error!(topic = %msg.topic(), "Error parsing command topic (regex captures returned None)");
@ -398,7 +398,7 @@ async fn message_callback(
match command.as_ref() {
"down" => {
let cmd: integration::DownlinkCommand = match json {
true => serde_json::from_slice(&b)?,
true => serde_json::from_slice(b)?,
false => integration::DownlinkCommand::decode(&mut Cursor::new(b))?,
};
if dev_eui != cmd.dev_eui {

View File

@ -73,11 +73,38 @@ async fn main() -> Result<()> {
.takes_value(true),
),
)
.subcommand(
App::new("import-ttn-lorawan-devices")
.about("Import TheThingsNetwork LoRaWAN devices repository")
.arg(
Arg::with_name("dir")
.required(true)
.short("d")
.long("dir")
.value_name("DIR")
.multiple(false)
.number_of_values(1)
.help("Path to repository root")
.takes_value(true),
),
)
.get_matches();
let config_dir = matches.value_of_lossy("config-dir").unwrap();
config::load(Path::new(config_dir.as_ref()))?;
let conf = config::get();
let filter = filter::Targets::new().with_targets(vec![
("chirpstack", Level::from_str(&conf.logging.level).unwrap()),
("backend", Level::from_str(&conf.logging.level).unwrap()),
("lrwn", Level::from_str(&conf.logging.level).unwrap()),
]);
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(filter)
.init();
if matches.subcommand_matches("configfile").is_some() {
cmd::configfile::run();
process::exit(0);
@ -91,23 +118,13 @@ async fn main() -> Result<()> {
process::exit(0);
}
/*
tracing_subscriber::fmt()
.with_max_level(tracing::Level::from_str(&config::get().logging.level).unwrap())
.init();
*/
let conf = config::get();
let filter = filter::Targets::new().with_targets(vec![
("chirpstack", Level::from_str(&conf.logging.level).unwrap()),
("backend", Level::from_str(&conf.logging.level).unwrap()),
("lrwn", Level::from_str(&conf.logging.level).unwrap()),
]);
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer())
.with(filter)
.init();
if let Some(v) = matches.subcommand_matches("import-ttn-lorawan-devices") {
let dir = v.value_of_lossy("dir").unwrap();
cmd::import_ttn_lorawan_devices::run(Path::new(&*dir))
.await
.unwrap();
process::exit(0);
}
cmd::root::run().await?;

View File

@ -36,7 +36,7 @@ pub struct DeviceProfile {
pub supports_class_c: bool,
pub class_b_timeout: i32,
pub class_b_ping_slot_period: i32,
pub class_b_ping_slot_dr: i32,
pub class_b_ping_slot_dr: i16,
pub class_b_ping_slot_freq: i64,
pub class_c_timeout: i32,
pub abp_rx1_delay: i16,
@ -46,6 +46,8 @@ pub struct DeviceProfile {
pub tags: fields::KeyValue,
pub payload_codec_script: String,
pub flush_queue_on_activate: bool,
pub description: String,
pub measurements: fields::Measurements,
}
impl DeviceProfile {
@ -67,6 +69,7 @@ impl Default for DeviceProfile {
created_at: now,
updated_at: now,
name: "".into(),
description: "".into(),
region: CommonName::EU868,
mac_version: MacVersion::LORAWAN_1_0_0,
reg_params_revision: Revision::A,
@ -89,6 +92,7 @@ impl Default for DeviceProfile {
abp_rx2_dr: 0,
abp_rx2_freq: 0,
tags: fields::KeyValue::new(HashMap::new()),
measurements: fields::Measurements::new(HashMap::new()),
}
}
}
@ -179,6 +183,7 @@ pub async fn update(dp: DeviceProfile) -> Result<DeviceProfile, Error> {
.set((
device_profile::updated_at.eq(Utc::now()),
device_profile::name.eq(&dp.name),
device_profile::description.eq(&dp.description),
device_profile::region.eq(&dp.region),
device_profile::mac_version.eq(&dp.mac_version),
device_profile::reg_params_revision.eq(&dp.reg_params_revision),
@ -201,6 +206,7 @@ pub async fn update(dp: DeviceProfile) -> Result<DeviceProfile, Error> {
device_profile::abp_rx2_dr.eq(&dp.abp_rx2_dr),
device_profile::abp_rx2_freq.eq(&dp.abp_rx2_freq),
device_profile::tags.eq(&dp.tags),
device_profile::measurements.eq(&dp.measurements),
))
.get_result(&c)
.map_err(|e| error::Error::from_diesel(e, dp.id.to_string()))
@ -211,6 +217,22 @@ pub async fn update(dp: DeviceProfile) -> Result<DeviceProfile, Error> {
Ok(dp)
}
pub async fn set_measurements(id: Uuid, m: &fields::Measurements) -> Result<DeviceProfile, Error> {
let dp = task::spawn_blocking({
let m = m.clone();
move || -> Result<DeviceProfile, Error> {
let c = get_db_conn()?;
diesel::update(device_profile::dsl::device_profile.find(&id))
.set(device_profile::measurements.eq(m))
.get_result(&c)
.map_err(|e| Error::from_diesel(e, id.to_string()))
}
})
.await??;
info!(id = %id, "Device-profile measurements updated");
Ok(dp)
}
pub async fn delete(id: &Uuid) -> Result<(), Error> {
task::spawn_blocking({
let id = *id;

View File

@ -0,0 +1,401 @@
use std::collections::HashMap;
use anyhow::Result;
use chrono::{DateTime, Utc};
use diesel::dsl;
use diesel::prelude::*;
use regex::Regex;
use tokio::task;
use tracing::info;
use lrwn::region::{CommonName, MacVersion, Revision};
use super::error::Error;
use super::schema::device_profile_template;
use super::{error, fields, get_db_conn};
use crate::codec::Codec;
#[derive(Clone, Queryable, Insertable, AsChangeset, Debug, PartialEq)]
#[table_name = "device_profile_template"]
pub struct DeviceProfileTemplate {
pub id: String,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub name: String,
pub description: String,
pub vendor: String,
pub firmware: String,
pub region: CommonName,
pub mac_version: MacVersion,
pub reg_params_revision: Revision,
pub adr_algorithm_id: String,
pub payload_codec_runtime: Codec,
pub payload_codec_script: String,
pub uplink_interval: i32,
pub device_status_req_interval: i32,
pub flush_queue_on_activate: bool,
pub supports_otaa: bool,
pub supports_class_b: bool,
pub supports_class_c: bool,
pub class_b_timeout: i32,
pub class_b_ping_slot_period: i32,
pub class_b_ping_slot_dr: i16,
pub class_b_ping_slot_freq: i64,
pub class_c_timeout: i32,
pub abp_rx1_delay: i16,
pub abp_rx1_dr_offset: i16,
pub abp_rx2_dr: i16,
pub abp_rx2_freq: i64,
pub tags: fields::KeyValue,
pub measurements: fields::Measurements,
}
impl DeviceProfileTemplate {
fn validate(&self) -> Result<(), Error> {
let id_regex = Regex::new(r"^[\w-]+$").unwrap();
if !id_regex.is_match(&self.id) {
return Err(Error::Validation(
"id can only contain alphanumeric chars or dashes".into(),
));
}
if self.name.is_empty() {
return Err(Error::Validation("name is not set".into()));
}
if self.vendor.is_empty() {
return Err(Error::Validation("vendor is not set".into()));
}
if self.firmware.is_empty() {
return Err(Error::Validation("firmware is not set".into()));
}
Ok(())
}
}
impl Default for DeviceProfileTemplate {
fn default() -> Self {
let now = Utc::now();
DeviceProfileTemplate {
id: "".into(),
created_at: now,
updated_at: now,
name: "".into(),
description: "".into(),
vendor: "".into(),
firmware: "".into(),
region: CommonName::EU868,
mac_version: MacVersion::LORAWAN_1_0_0,
reg_params_revision: Revision::A,
adr_algorithm_id: "".into(),
payload_codec_runtime: Codec::NONE,
payload_codec_script: "".into(),
uplink_interval: 0,
device_status_req_interval: 0,
flush_queue_on_activate: false,
supports_otaa: false,
supports_class_b: false,
supports_class_c: false,
class_b_timeout: 0,
class_b_ping_slot_period: 0,
class_b_ping_slot_dr: 0,
class_b_ping_slot_freq: 0,
class_c_timeout: 0,
abp_rx1_delay: 0,
abp_rx1_dr_offset: 0,
abp_rx2_dr: 0,
abp_rx2_freq: 0,
tags: fields::KeyValue::new(HashMap::new()),
measurements: fields::Measurements::new(HashMap::new()),
}
}
}
#[derive(Queryable, PartialEq, Debug)]
pub struct DeviceProfileTemplateListItem {
pub id: String,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub name: String,
pub vendor: String,
pub firmware: String,
pub region: CommonName,
pub mac_version: MacVersion,
pub reg_params_revision: Revision,
pub supports_otaa: bool,
pub supports_class_b: bool,
pub supports_class_c: bool,
}
pub async fn create(dp: DeviceProfileTemplate) -> Result<DeviceProfileTemplate, Error> {
dp.validate()?;
let dp = task::spawn_blocking({
move || -> Result<DeviceProfileTemplate, Error> {
let c = get_db_conn()?;
diesel::insert_into(device_profile_template::table)
.values(&dp)
.get_result(&c)
.map_err(|e| error::Error::from_diesel(e, dp.id.to_string()))
}
})
.await??;
info!(id = %dp.id, "Device-profile template created");
Ok(dp)
}
pub async fn upsert(dp: DeviceProfileTemplate) -> Result<DeviceProfileTemplate, Error> {
dp.validate()?;
let dp = task::spawn_blocking({
move || -> Result<DeviceProfileTemplate, Error> {
let c = get_db_conn()?;
diesel::insert_into(device_profile_template::table)
.values(&dp)
.on_conflict(device_profile_template::id)
.do_update()
.set((
device_profile_template::updated_at.eq(Utc::now()),
device_profile_template::name.eq(&dp.name),
device_profile_template::description.eq(&dp.description),
device_profile_template::vendor.eq(&dp.vendor),
device_profile_template::firmware.eq(&dp.firmware),
device_profile_template::region.eq(&dp.region),
device_profile_template::mac_version.eq(&dp.mac_version),
device_profile_template::reg_params_revision.eq(&dp.reg_params_revision),
device_profile_template::adr_algorithm_id.eq(&dp.adr_algorithm_id),
device_profile_template::payload_codec_runtime.eq(&dp.payload_codec_runtime),
device_profile_template::payload_codec_script.eq(&dp.payload_codec_script),
device_profile_template::uplink_interval.eq(&dp.uplink_interval),
device_profile_template::device_status_req_interval
.eq(&dp.device_status_req_interval),
device_profile_template::flush_queue_on_activate
.eq(&dp.flush_queue_on_activate),
device_profile_template::supports_otaa.eq(&dp.supports_otaa),
device_profile_template::supports_class_b.eq(&dp.supports_class_b),
device_profile_template::supports_class_c.eq(&dp.supports_class_c),
device_profile_template::class_b_timeout.eq(&dp.class_b_timeout),
device_profile_template::class_b_ping_slot_period
.eq(&dp.class_b_ping_slot_period),
device_profile_template::class_b_ping_slot_dr.eq(&dp.class_b_ping_slot_dr),
device_profile_template::class_b_ping_slot_freq.eq(&dp.class_b_ping_slot_freq),
device_profile_template::class_c_timeout.eq(&dp.class_c_timeout),
device_profile_template::abp_rx1_delay.eq(&dp.abp_rx1_delay),
device_profile_template::abp_rx1_dr_offset.eq(&dp.abp_rx1_dr_offset),
device_profile_template::abp_rx2_dr.eq(&dp.abp_rx2_dr),
device_profile_template::abp_rx2_freq.eq(&dp.abp_rx2_freq),
device_profile_template::tags.eq(&dp.tags),
device_profile_template::measurements.eq(&dp.measurements),
))
.get_result(&c)
.map_err(|e| error::Error::from_diesel(e, dp.id.to_string()))
}
})
.await??;
info!(id = %dp.id, "Device-profile template upserted");
Ok(dp)
}
pub async fn get(id: &str) -> Result<DeviceProfileTemplate, Error> {
task::spawn_blocking({
let id = id.to_string();
move || -> Result<DeviceProfileTemplate, Error> {
let c = get_db_conn()?;
let dp = device_profile_template::dsl::device_profile_template
.find(&id)
.first(&c)
.map_err(|e| error::Error::from_diesel(e, id.clone()))?;
Ok(dp)
}
})
.await?
}
pub async fn update(dp: DeviceProfileTemplate) -> Result<DeviceProfileTemplate, Error> {
dp.validate()?;
let dp = task::spawn_blocking({
move || -> Result<DeviceProfileTemplate, Error> {
let c = get_db_conn()?;
diesel::update(device_profile_template::dsl::device_profile_template.find(&dp.id))
.set((
device_profile_template::updated_at.eq(Utc::now()),
device_profile_template::name.eq(&dp.name),
device_profile_template::description.eq(&dp.description),
device_profile_template::vendor.eq(&dp.vendor),
device_profile_template::firmware.eq(&dp.firmware),
device_profile_template::region.eq(&dp.region),
device_profile_template::mac_version.eq(&dp.mac_version),
device_profile_template::reg_params_revision.eq(&dp.reg_params_revision),
device_profile_template::adr_algorithm_id.eq(&dp.adr_algorithm_id),
device_profile_template::payload_codec_runtime.eq(&dp.payload_codec_runtime),
device_profile_template::payload_codec_script.eq(&dp.payload_codec_script),
device_profile_template::uplink_interval.eq(&dp.uplink_interval),
device_profile_template::device_status_req_interval
.eq(&dp.device_status_req_interval),
device_profile_template::flush_queue_on_activate
.eq(&dp.flush_queue_on_activate),
device_profile_template::supports_otaa.eq(&dp.supports_otaa),
device_profile_template::supports_class_b.eq(&dp.supports_class_b),
device_profile_template::supports_class_c.eq(&dp.supports_class_c),
device_profile_template::class_b_timeout.eq(&dp.class_b_timeout),
device_profile_template::class_b_ping_slot_period
.eq(&dp.class_b_ping_slot_period),
device_profile_template::class_b_ping_slot_dr.eq(&dp.class_b_ping_slot_dr),
device_profile_template::class_b_ping_slot_freq.eq(&dp.class_b_ping_slot_freq),
device_profile_template::class_c_timeout.eq(&dp.class_c_timeout),
device_profile_template::abp_rx1_delay.eq(&dp.abp_rx1_delay),
device_profile_template::abp_rx1_dr_offset.eq(&dp.abp_rx1_dr_offset),
device_profile_template::abp_rx2_dr.eq(&dp.abp_rx2_dr),
device_profile_template::abp_rx2_freq.eq(&dp.abp_rx2_freq),
device_profile_template::tags.eq(&dp.tags),
))
.get_result(&c)
.map_err(|e| error::Error::from_diesel(e, dp.id.clone()))
}
})
.await??;
info!(id = %dp.id, "Device-profile template updated");
Ok(dp)
}
pub async fn delete(id: &str) -> Result<(), Error> {
task::spawn_blocking({
let id = id.to_string();
move || -> Result<(), Error> {
let c = get_db_conn()?;
let ra =
diesel::delete(device_profile_template::dsl::device_profile_template.find(&id))
.execute(&c)?;
if ra == 0 {
return Err(error::Error::NotFound(id));
}
Ok(())
}
})
.await??;
info!(id = %id, "Device-profile template deleted");
Ok(())
}
pub async fn get_count() -> Result<i64, Error> {
task::spawn_blocking({
move || -> Result<i64, Error> {
let c = get_db_conn()?;
Ok(device_profile_template::dsl::device_profile_template
.select(dsl::count_star())
.first(&c)?)
}
})
.await?
}
pub async fn list(limit: i64, offset: i64) -> Result<Vec<DeviceProfileTemplateListItem>, Error> {
task::spawn_blocking({
move || -> Result<Vec<DeviceProfileTemplateListItem>, Error> {
let c = get_db_conn()?;
let items = device_profile_template::dsl::device_profile_template
.select((
device_profile_template::id,
device_profile_template::created_at,
device_profile_template::updated_at,
device_profile_template::name,
device_profile_template::vendor,
device_profile_template::firmware,
device_profile_template::region,
device_profile_template::mac_version,
device_profile_template::reg_params_revision,
device_profile_template::supports_otaa,
device_profile_template::supports_class_b,
device_profile_template::supports_class_c,
))
.order_by((
device_profile_template::dsl::vendor,
device_profile_template::dsl::name,
device_profile_template::dsl::firmware,
device_profile_template::dsl::region,
))
.limit(limit)
.offset(offset)
.load(&c)?;
Ok(items)
}
})
.await?
}
#[cfg(test)]
pub mod test {
use super::*;
use crate::test;
struct FilterTest<'a> {
dps: Vec<&'a DeviceProfileTemplate>,
count: usize,
limit: i64,
offset: i64,
}
#[tokio::test]
async fn test_device_profile_test() {
let _guard = test::prepare().await;
let dp = DeviceProfileTemplate {
id: "test-dp".into(),
name: "test-template".into(),
vendor: "Test Vendor".into(),
firmware: "1.2.3".into(),
..Default::default()
};
// create
let mut dp = create(dp).await.unwrap();
// get
let dp_get = get(&dp.id).await.unwrap();
assert_eq!(dp, dp_get);
// update
dp.name = "test-template-updated".into();
dp = update(dp).await.unwrap();
let dp_get = get(&dp.id).await.unwrap();
assert_eq!(dp, dp_get);
// upsert
dp.name = "test-template-upsert".into();
dp = upsert(dp).await.unwrap();
let dp_get = get(&dp.id).await.unwrap();
assert_eq!(dp, dp_get);
// get count and list
let tests = vec![
FilterTest {
dps: vec![&dp],
count: 1,
limit: 10,
offset: 0,
},
FilterTest {
dps: vec![],
count: 1,
limit: 0,
offset: 0,
},
];
for tst in tests {
let count = get_count().await.unwrap() as usize;
assert_eq!(tst.count, count);
let items = list(tst.limit, tst.offset).await.unwrap();
assert_eq!(
tst.dps.iter().map(|dp| dp.id.clone()).collect::<String>(),
items.iter().map(|dp| dp.id.clone()).collect::<String>()
);
}
// delete
delete(&dp.id).await.unwrap();
assert_eq!(true, delete(&dp.id).await.is_err());
}
}

View File

@ -5,6 +5,7 @@ use std::ops::{Deref, DerefMut};
use diesel::pg::types::sql_types::Jsonb;
use diesel::pg::Pg;
use diesel::{deserialize, serialize};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, AsExpression, FromSqlRow)]
#[sql_type = "Jsonb"]
@ -49,3 +50,69 @@ impl serialize::ToSql<Jsonb, Pg> for KeyValue {
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, out)
}
}
#[derive(Debug, Clone, AsExpression, FromSqlRow, PartialEq)]
#[sql_type = "Jsonb"]
pub struct Measurements(HashMap<String, Measurement>);
impl Measurements {
pub fn new(m: HashMap<String, Measurement>) -> Self {
Measurements(m)
}
#[allow(clippy::wrong_self_convention)]
pub fn into_hashmap(&self) -> HashMap<String, Measurement> {
self.0.clone()
}
}
impl Deref for Measurements {
type Target = HashMap<String, Measurement>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for Measurements {
fn deref_mut(&mut self) -> &mut HashMap<String, Measurement> {
&mut self.0
}
}
impl deserialize::FromSql<Jsonb, Pg> for Measurements {
fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result<Self> {
let value = <serde_json::Value as deserialize::FromSql<Jsonb, Pg>>::from_sql(bytes)?;
let kv: HashMap<String, Measurement> = serde_json::from_value(value)?;
Ok(Measurements::new(kv))
}
}
impl serialize::ToSql<Jsonb, Pg> for Measurements {
fn to_sql<W: Write>(&self, out: &mut serialize::Output<W, Pg>) -> serialize::Result {
let value = serde_json::to_value(&self.0)?;
<serde_json::Value as serialize::ToSql<Jsonb, Pg>>::to_sql(&value, out)
}
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub struct Measurement {
pub name: String,
pub kind: MeasurementKind,
}
#[allow(clippy::upper_case_acronyms)]
#[allow(non_camel_case_types)]
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
pub enum MeasurementKind {
// Unknown.
UNKNOWN,
// Incrementing counters which are not reset on each reporting.
COUNTER,
// Counters that do get reset upon reading.
ABSOLUTE,
// E.g. a temperature value.
GAUGE,
// E.g. a firmware version, true / false value.
STRING,
}

View File

@ -10,6 +10,7 @@ use tracing::info;
use crate::storage::{get_redis_conn, redis_key};
#[allow(clippy::upper_case_acronyms)]
#[allow(non_camel_case_types)]
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Eq, PartialEq)]
pub enum Aggregation {
@ -24,9 +25,25 @@ impl fmt::Display for Aggregation {
}
}
#[allow(clippy::upper_case_acronyms)]
#[allow(non_camel_case_types)]
#[derive(Deserialize, Serialize, Copy, Clone, Debug, Eq, PartialEq)]
pub enum Kind {
COUNTER,
ABSOLUTE,
GAUGE,
}
impl fmt::Display for Kind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
}
}
#[derive(Debug, PartialEq, Clone)]
pub struct Record {
pub time: DateTime<Local>,
pub kind: Kind,
pub metrics: HashMap<String, f64>,
}
@ -51,6 +68,29 @@ fn get_key(name: &str, a: Aggregation, dt: DateTime<Local>) -> String {
))
}
pub async fn save_state(name: &str, state: &str) -> Result<()> {
task::spawn_blocking({
let key = redis_key(format!("metrics:{{{}}}", name));
let state = state.to_string();
let ttl = get_ttl(Aggregation::MONTH);
move || -> Result<()> {
let mut c = get_redis_conn()?;
redis::cmd("PSETEX")
.arg(key)
.arg(ttl.as_millis() as usize)
.arg(state)
.query(&mut *c)?;
Ok(())
}
})
.await??;
info!(state = %state, "State saved");
Ok(())
}
pub async fn save(name: &str, record: &Record) -> Result<()> {
for a in get_aggregations() {
save_for_interval(a, name, record).await?;
@ -91,7 +131,23 @@ async fn save_for_interval(a: Aggregation, name: &str, record: &Record) -> Resul
// Passing a reference to hincr will return a runtime error.
let k = k.clone();
let v = *v;
pipe.cmd("HINCRBYFLOAT").arg(&key).arg(k).arg(v).ignore();
match record.kind {
Kind::COUNTER => {
pipe.cmd("HSET").arg(&key).arg(k).arg(v).ignore();
}
Kind::ABSOLUTE => {
pipe.cmd("HINCRBYFLOAT").arg(&key).arg(k).arg(v).ignore();
}
Kind::GAUGE => {
pipe.cmd("HINCRBYFLOAT")
.arg(&key)
.arg(format!("_{}_count", k))
.arg(1.0)
.ignore();
pipe.cmd("HINCRBYFLOAT").arg(&key).arg(k).arg(v).ignore();
}
}
}
pipe.cmd("PEXPIRE")
@ -109,8 +165,21 @@ async fn save_for_interval(a: Aggregation, name: &str, record: &Record) -> Resul
Ok(())
}
pub async fn get_state(name: &str) -> Result<String> {
task::spawn_blocking({
let key = redis_key(format!("metrics:{{{}}}", name));
move || -> Result<String> {
let mut c = get_redis_conn()?;
let v: Option<String> = redis::cmd("GET").arg(key).query(&mut *c)?;
Ok(v.unwrap_or_default())
}
})
.await?
}
pub async fn get(
name: &str,
kind: Kind,
a: Aggregation,
start: DateTime<Local>,
end: DateTime<Local>,
@ -183,9 +252,33 @@ pub async fn get(
let mut out: Vec<Record> = Vec::new();
for (i, r) in res.iter().enumerate() {
let mut metrics = r.clone();
// In case of GAUGE values, the total aggregated value must be divided by the
// number of measurements.
if kind == Kind::GAUGE {
let counts: HashMap<String, f64> = r
.iter()
.filter(|(k, _)| k.starts_with('_') && k.ends_with("_count"))
.map(|(k, v)| (k.to_string(), *v))
.collect();
for (k, count) in counts {
let k = k.strip_prefix('_').unwrap().strip_suffix("_count").unwrap();
if let Some(v) = metrics.get_mut(k) {
*v /= count;
}
}
}
out.push(Record {
time: timestamps[i],
metrics: r.clone(),
kind,
metrics: metrics
.iter()
.filter(|(k, _)| !k.starts_with('_'))
.map(|(k, v)| (k.to_string(), *v))
.collect(),
});
}
@ -207,6 +300,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
.cloned()
@ -214,6 +308,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
.cloned()
@ -221,6 +316,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(2, 1, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -235,6 +331,7 @@ pub mod test {
let resp = get(
"test",
Kind::ABSOLUTE,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(2, 0, 0),
@ -246,6 +343,7 @@ pub mod test {
vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -253,6 +351,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(2, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -270,6 +369,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
.cloned()
@ -277,6 +377,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(2, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
.cloned()
@ -284,6 +385,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 2).and_hms(1, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -298,6 +400,7 @@ pub mod test {
let resp = get(
"test",
Kind::ABSOLUTE,
Aggregation::DAY,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 2).and_hms(1, 0, 0),
@ -309,6 +412,7 @@ pub mod test {
vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -316,6 +420,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 2).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -333,6 +438,7 @@ pub mod test {
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1f64), ("bar".into(), 2f64)]
.iter()
.cloned()
@ -340,6 +446,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 1, 2).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3f64), ("bar".into(), 4f64)]
.iter()
.cloned()
@ -347,6 +454,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 2, 1).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -361,6 +469,7 @@ pub mod test {
let resp = get(
"test",
Kind::ABSOLUTE,
Aggregation::MONTH,
Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
Local.ymd(2018, 2, 1).and_hms(0, 0, 0),
@ -372,6 +481,7 @@ pub mod test {
vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 4f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -379,6 +489,7 @@ pub mod test {
},
Record {
time: Local.ymd(2018, 2, 1).and_hms(0, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 5f64), ("bar".into(), 6f64)]
.iter()
.cloned()
@ -388,4 +499,157 @@ pub mod test {
resp
);
}
#[tokio::test]
async fn test_counter() {
let _guard = test::prepare().await;
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
kind: Kind::COUNTER,
metrics: [("foo".into(), 1.0), ("bar".into(), 2.0)]
.iter()
.cloned()
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
kind: Kind::COUNTER,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
.cloned()
.collect(),
},
];
for r in &records {
save_for_interval(Aggregation::HOUR, "test", r)
.await
.unwrap();
}
let resp = get(
"test",
Kind::COUNTER,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
)
.await
.unwrap();
assert_eq!(
vec![Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
kind: Kind::COUNTER,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
.cloned()
.collect(),
},],
resp
);
}
#[tokio::test]
async fn test_absolute() {
let _guard = test::prepare().await;
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 1.0), ("bar".into(), 2.0)]
.iter()
.cloned()
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
.cloned()
.collect(),
},
];
for r in &records {
save_for_interval(Aggregation::HOUR, "test", r)
.await
.unwrap();
}
let resp = get(
"test",
Kind::ABSOLUTE,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
)
.await
.unwrap();
assert_eq!(
vec![Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
kind: Kind::ABSOLUTE,
metrics: [("foo".into(), 3.0), ("bar".into(), 6.0)]
.iter()
.cloned()
.collect(),
},],
resp
);
}
#[tokio::test]
async fn test_gauge() {
let _guard = test::prepare().await;
let records = vec![
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 1, 0),
kind: Kind::GAUGE,
metrics: [("foo".into(), 1.0), ("bar".into(), 2.0)]
.iter()
.cloned()
.collect(),
},
Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 2, 0),
kind: Kind::GAUGE,
metrics: [("foo".into(), 2.0), ("bar".into(), 4.0)]
.iter()
.cloned()
.collect(),
},
];
for r in &records {
save_for_interval(Aggregation::HOUR, "test", r)
.await
.unwrap();
}
let resp = get(
"test",
Kind::GAUGE,
Aggregation::HOUR,
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
)
.await
.unwrap();
assert_eq!(
vec![Record {
time: Local.ymd(2018, 1, 1).and_hms(1, 0, 0),
kind: Kind::GAUGE,
metrics: [("foo".into(), 1.5), ("bar".into(), 3.0)]
.iter()
.cloned()
.collect(),
},],
resp
);
}
}

View File

@ -16,6 +16,7 @@ pub mod device;
pub mod device_gateway;
pub mod device_keys;
pub mod device_profile;
pub mod device_profile_template;
pub mod device_queue;
pub mod device_session;
pub mod downlink_frame;

View File

@ -88,7 +88,7 @@ table! {
supports_class_c -> Bool,
class_b_timeout -> Int4,
class_b_ping_slot_period -> Int4,
class_b_ping_slot_dr -> Int4,
class_b_ping_slot_dr -> Int2,
class_b_ping_slot_freq -> Int8,
class_c_timeout -> Int4,
abp_rx1_delay -> Int2,
@ -98,6 +98,43 @@ table! {
tags -> Jsonb,
payload_codec_script -> Text,
flush_queue_on_activate -> Bool,
description -> Text,
measurements -> Jsonb,
}
}
table! {
device_profile_template (id) {
id -> Text,
created_at -> Timestamptz,
updated_at -> Timestamptz,
name -> Varchar,
description -> Text,
vendor -> Varchar,
firmware -> Varchar,
region -> Varchar,
mac_version -> Varchar,
reg_params_revision -> Varchar,
adr_algorithm_id -> Varchar,
payload_codec_runtime -> Varchar,
payload_codec_script -> Text,
uplink_interval -> Int4,
device_status_req_interval -> Int4,
flush_queue_on_activate -> Bool,
supports_otaa -> Bool,
supports_class_b -> Bool,
supports_class_c -> Bool,
class_b_timeout -> Int4,
class_b_ping_slot_period -> Int4,
class_b_ping_slot_dr -> Int2,
class_b_ping_slot_freq -> Int8,
class_c_timeout -> Int4,
abp_rx1_delay -> Int2,
abp_rx1_dr_offset -> Int2,
abp_rx2_dr -> Int2,
abp_rx2_freq -> Int8,
tags -> Jsonb,
measurements -> Jsonb,
}
}
@ -240,6 +277,7 @@ allow_tables_to_appear_in_same_query!(
device,
device_keys,
device_profile,
device_profile_template,
device_queue_item,
gateway,
multicast_group,

Some files were not shown because too many files have changed in this diff Show More