From d9d3f14e8043054c660c9fcce09ecbce0b0d9e14 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Tue, 7 Jun 2022 19:28:41 +0100 Subject: [PATCH] Implement support for device-profile templates + TTN importer. --- Cargo.lock | 95 +- api/go/Makefile | 1 + api/go/api/device_profile.pb.go | 399 +-- api/go/api/device_profile_template.pb.go | 1243 ++++++++ api/go/api/device_profile_template_grpc.pb.go | 261 ++ api/grpc-web/Makefile | 1 + api/grpc-web/api/device_profile_pb.d.ts | 4 + api/grpc-web/api/device_profile_pb.js | 30 + .../device_profile_template_grpc_web_pb.d.ts | 80 + .../device_profile_template_grpc_web_pb.js | 482 +++ .../api/device_profile_template_pb.d.ts | 350 ++ .../api/device_profile_template_pb.js | 2804 +++++++++++++++++ api/js/Makefile | 1 + api/js/api/device_profile_pb.d.ts | 4 + api/js/api/device_profile_pb.js | 27 + .../api/device_profile_template_grpc_pb.d.ts | 45 + api/js/api/device_profile_template_grpc_pb.js | 164 + api/js/api/device_profile_template_pb.d.ts | 368 +++ api/js/api/device_profile_template_pb.js | 2712 ++++++++++++++++ api/proto/api/device_profile.proto | 3 + api/proto/api/device_profile_template.proto | 207 ++ api/python/Makefile | 1 + api/rust/build.rs | 1 + .../proto/chirpstack/api/device_profile.proto | 3 + .../api/device_profile_template.proto | 207 ++ chirpstack/Cargo.toml | 3 +- chirpstack/configuration/chirpstack.toml | 26 +- .../down.sql | 5 + .../up.sql | 38 + chirpstack/src/api/auth/validator.rs | 301 +- chirpstack/src/api/device_profile.rs | 7 +- chirpstack/src/api/device_profile_template.rs | 409 +++ chirpstack/src/api/mod.rs | 10 + .../src/cmd/import_ttn_lorawan_devices.rs | 292 ++ chirpstack/src/cmd/mod.rs | 1 + chirpstack/src/codec/js/mod.rs | 111 +- chirpstack/src/codec/mod.rs | 4 +- chirpstack/src/main.rs | 51 +- chirpstack/src/storage/device_profile.rs | 5 +- .../src/storage/device_profile_template.rs | 398 +++ chirpstack/src/storage/mod.rs | 1 + chirpstack/src/storage/schema.rs | 38 +- chirpstack/src/uplink/data.rs | 1 + test.js | 8 + ui/package.json | 2 +- ui/src/App.tsx | 13 + ui/src/components/CodeEditor.tsx | 12 + ui/src/components/Menu.tsx | 10 + ui/src/stores/DeviceProfileTemplateStore.ts | 97 + ui/src/views/api-keys/ListAdminApiKeys.tsx | 2 +- .../CreateDeviceProfileTemplate.tsx | 96 + .../DeviceProfileTemplateForm.tsx | 419 +++ .../EditDeviceProfileTemplate.tsx | 115 + .../ListDeviceProfileTemplates.tsx | 87 + .../device-profiles/CreateDeviceProfile.tsx | 2 +- .../device-profiles/DeviceProfileForm.tsx | 291 +- ui/src/views/tenants/ListTenants.tsx | 2 +- ui/src/views/users/ListUsers.tsx | 2 +- ui/yarn.lock | 21 +- 59 files changed, 12091 insertions(+), 282 deletions(-) create mode 100644 api/go/api/device_profile_template.pb.go create mode 100644 api/go/api/device_profile_template_grpc.pb.go create mode 100644 api/grpc-web/api/device_profile_template_grpc_web_pb.d.ts create mode 100644 api/grpc-web/api/device_profile_template_grpc_web_pb.js create mode 100644 api/grpc-web/api/device_profile_template_pb.d.ts create mode 100644 api/grpc-web/api/device_profile_template_pb.js create mode 100644 api/js/api/device_profile_template_grpc_pb.d.ts create mode 100644 api/js/api/device_profile_template_grpc_pb.js create mode 100644 api/js/api/device_profile_template_pb.d.ts create mode 100644 api/js/api/device_profile_template_pb.js create mode 100644 api/proto/api/device_profile_template.proto create mode 100644 api/rust/proto/chirpstack/api/device_profile_template.proto create mode 100644 chirpstack/migrations/2022-05-11-084032_device_profile_templates/down.sql create mode 100644 chirpstack/migrations/2022-05-11-084032_device_profile_templates/up.sql create mode 100644 chirpstack/src/api/device_profile_template.rs create mode 100644 chirpstack/src/cmd/import_ttn_lorawan_devices.rs create mode 100644 chirpstack/src/storage/device_profile_template.rs create mode 100644 test.js create mode 100644 ui/src/stores/DeviceProfileTemplateStore.ts create mode 100644 ui/src/views/device-profile-templates/CreateDeviceProfileTemplate.tsx create mode 100644 ui/src/views/device-profile-templates/DeviceProfileTemplateForm.tsx create mode 100644 ui/src/views/device-profile-templates/EditDeviceProfileTemplate.tsx create mode 100644 ui/src/views/device-profile-templates/ListDeviceProfileTemplates.tsx diff --git a/Cargo.lock b/Cargo.lock index 732a86cc..70bb54c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", @@ -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", @@ -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" @@ -2020,6 +2045,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" @@ -2394,6 +2425,12 @@ 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" @@ -2978,28 +3015,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", @@ -3299,6 +3337,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" @@ -3479,6 +3529,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" @@ -3545,6 +3601,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" @@ -4414,6 +4476,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" diff --git a/api/go/Makefile b/api/go/Makefile index 615417d2..36b08f02 100644 --- a/api/go/Makefile +++ b/api/go/Makefile @@ -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 diff --git a/api/go/api/device_profile.pb.go b/api/go/api/device_profile.pb.go index 67a139a9..b7c559a0 100644 --- a/api/go/api/device_profile.pb.go +++ b/api/go/api/device_profile.pb.go @@ -87,6 +87,8 @@ type DeviceProfile struct { TenantId string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"` // Name. Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // Description. + Description string `protobuf:"bytes,26,opt,name=description,proto3" json:"description,omitempty"` // Region. Region common.Region `protobuf:"varint,4,opt,name=region,proto3,enum=common.Region" json:"region,omitempty"` // LoRaWAN mac-version. @@ -193,6 +195,13 @@ func (x *DeviceProfile) GetName() string { return "" } +func (x *DeviceProfile) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + func (x *DeviceProfile) GetRegion() common.Region { if x != nil { return x.Region @@ -1038,208 +1047,210 @@ var file_api_device_profile_proto_rawDesc = []byte{ 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x97, 0x09, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xb9, 0x09, 0x0a, 0x0d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, - 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, - 0x0b, 0x6d, 0x61, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x63, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x13, 0x72, 0x65, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x19, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, 0x65, 0x67, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, - 0x10, 0x61, 0x64, 0x72, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x5f, 0x69, - 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x15, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x64, - 0x65, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x13, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x30, - 0x0a, 0x14, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x5f, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x70, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x12, 0x35, 0x0a, 0x17, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, - 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x14, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, 0x6e, 0x41, - 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x75, 0x70, 0x6c, 0x69, 0x6e, - 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0e, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, - 0x12, 0x3b, 0x0a, 0x1a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x5f, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x17, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x71, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x23, 0x0a, - 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x6f, 0x74, 0x61, 0x61, 0x18, 0x0d, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x4f, 0x74, - 0x61, 0x61, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, - 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x12, 0x28, 0x0a, 0x10, - 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x63, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, - 0x62, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x36, - 0x0a, 0x18, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, - 0x6c, 0x6f, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x14, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x50, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, - 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, - 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x64, 0x72, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x50, 0x69, 0x6e, 0x67, - 0x53, 0x6c, 0x6f, 0x74, 0x44, 0x72, 0x12, 0x32, 0x0a, 0x16, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, - 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x66, 0x72, 0x65, 0x71, - 0x18, 0x13, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x50, 0x69, - 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x46, 0x72, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x5f, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x14, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x54, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x31, 0x5f, 0x64, 0x65, - 0x6c, 0x61, 0x79, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x61, 0x62, 0x70, 0x52, 0x78, - 0x31, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x29, 0x0a, 0x11, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, - 0x31, 0x5f, 0x64, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x0e, 0x61, 0x62, 0x70, 0x52, 0x78, 0x31, 0x44, 0x72, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x12, 0x1c, 0x0a, 0x0a, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x32, 0x5f, 0x64, 0x72, 0x18, - 0x17, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x62, 0x70, 0x52, 0x78, 0x32, 0x44, 0x72, 0x12, - 0x20, 0x0a, 0x0c, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x32, 0x5f, 0x66, 0x72, 0x65, 0x71, 0x18, - 0x18, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x61, 0x62, 0x70, 0x52, 0x78, 0x32, 0x46, 0x72, 0x65, - 0x71, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, - 0x69, 0x6c, 0x65, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, - 0x61, 0x67, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x54, 0x61, 0x67, 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, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd2, 0x03, 0x0a, - 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x4c, 0x69, - 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x5f, 0x61, 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, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, - 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, - 0x13, 0x72, 0x65, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x69, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, - 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x70, 0x70, - 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x6f, 0x74, 0x61, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x4f, 0x74, 0x61, 0x61, 0x12, 0x28, 0x0a, - 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, - 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, - 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, - 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x63, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x43, 0x22, 0x57, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x39, 0x0a, 0x0e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, 0x64, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x2d, 0x0a, 0x1b, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x29, 0x0a, 0x17, 0x47, 0x65, 0x74, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x22, 0xcb, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x39, 0x0a, 0x0e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, + 0x33, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, + 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x13, 0x72, 0x65, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, 0x65, + 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x28, 0x0a, 0x10, 0x61, 0x64, 0x72, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, + 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x72, 0x41, 0x6c, + 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x15, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, + 0x6f, 0x64, 0x65, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x13, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, + 0x12, 0x30, 0x0a, 0x14, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, + 0x63, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x53, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x12, 0x35, 0x0a, 0x17, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x5f, 0x71, 0x75, 0x65, 0x75, + 0x65, 0x5f, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x14, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x75, 0x65, 0x4f, + 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x75, 0x70, 0x6c, + 0x69, 0x6e, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x0e, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x12, 0x3b, 0x0a, 0x1a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x17, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, + 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x6f, 0x74, 0x61, 0x61, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x4f, 0x74, 0x61, 0x61, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, + 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, + 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x12, 0x28, + 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x5f, 0x63, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x62, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x12, 0x36, 0x0a, 0x18, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, + 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x14, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x50, 0x69, 0x6e, 0x67, 0x53, 0x6c, + 0x6f, 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x14, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x64, 0x72, + 0x18, 0x12, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x50, 0x69, + 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x44, 0x72, 0x12, 0x32, 0x0a, 0x16, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x66, 0x72, + 0x65, 0x71, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, + 0x50, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x46, 0x72, 0x65, 0x71, 0x12, 0x26, 0x0a, 0x0f, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x54, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x31, 0x5f, + 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x61, 0x62, 0x70, + 0x52, 0x78, 0x31, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x29, 0x0a, 0x11, 0x61, 0x62, 0x70, 0x5f, + 0x72, 0x78, 0x31, 0x5f, 0x64, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x16, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x61, 0x62, 0x70, 0x52, 0x78, 0x31, 0x44, 0x72, 0x4f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x0a, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x32, 0x5f, 0x64, + 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x62, 0x70, 0x52, 0x78, 0x32, 0x44, + 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x32, 0x5f, 0x66, 0x72, 0x65, + 0x71, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x61, 0x62, 0x70, 0x52, 0x78, 0x32, 0x46, + 0x72, 0x65, 0x71, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x19, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, + 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x54, 0x61, 0x67, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd2, + 0x03, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 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, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x0b, 0x6d, 0x61, + 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x49, 0x0a, 0x13, 0x72, 0x65, 0x67, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x72, 0x65, + 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, + 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x6f, 0x74, 0x61, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x4f, 0x74, 0x61, 0x61, 0x12, + 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, + 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, + 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x63, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x43, 0x22, 0x57, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x39, 0x0a, 0x0e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, 0x64, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x39, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 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, 0x09, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x61, 0x74, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, - 0x41, 0x74, 0x22, 0x57, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x39, 0x0a, 0x0e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, 0x64, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x2c, 0x0a, 0x1a, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x7e, 0x0a, 0x19, 0x4c, 0x69, 0x73, - 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1b, 0x0a, 0x09, - 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x71, 0x0a, 0x1a, 0x4c, 0x69, 0x73, - 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, - 0x49, 0x74, 0x65, 0x6d, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x7c, 0x0a, 0x26, - 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x64, - 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, - 0x65, 0x6d, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x0a, 0x14, 0x41, 0x64, - 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, - 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x31, 0x0a, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x52, - 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, - 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x41, 0x59, 0x45, 0x4e, 0x4e, 0x45, 0x5f, 0x4c, 0x50, 0x50, 0x10, - 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4a, 0x53, 0x10, 0x02, 0x32, 0xdc, 0x03, 0x0a, 0x14, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x2d, 0x0a, 0x1b, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x29, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xcb, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x0e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, + 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, + 0x0d, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x39, + 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 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, 0x09, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x22, 0x57, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 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, 0x43, 0x0a, 0x06, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, - 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, 0x49, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5a, 0x0a, 0x11, - 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2b, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, - 0x65, 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x59, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, - 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x12, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 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, + 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x0d, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x2c, 0x0a, + 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x7e, 0x0a, 0x19, 0x4c, + 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1b, + 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x71, 0x0a, 0x1a, 0x4c, + 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x06, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x7c, + 0x0a, 0x26, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x74, 0x65, 0x6d, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x3a, 0x0a, 0x14, + 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x2a, 0x31, 0x0a, 0x0c, 0x43, 0x6f, 0x64, 0x65, + 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, + 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x41, 0x59, 0x45, 0x4e, 0x4e, 0x45, 0x5f, 0x4c, 0x50, + 0x50, 0x10, 0x01, 0x12, 0x06, 0x0a, 0x02, 0x4a, 0x53, 0x10, 0x02, 0x32, 0xdc, 0x03, 0x0a, 0x14, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x4d, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1f, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, + 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x06, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 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, 0x43, + 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, + 0x6c, 0x65, 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, 0x49, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5a, + 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, + 0x68, 0x6d, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2b, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x41, 0x64, 0x72, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x59, 0x0a, 0x11, 0x69, 0x6f, + 0x2e, 0x63, 0x68, 0x69, 0x72, 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42, + 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 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 ( diff --git a/api/go/api/device_profile_template.pb.go b/api/go/api/device_profile_template.pb.go new file mode 100644 index 00000000..f1012b11 --- /dev/null +++ b/api/go/api/device_profile_template.pb.go @@ -0,0 +1,1243 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.18.1 +// source: api/device_profile_template.proto + +package api + +import ( + common "github.com/chirpstack/chirpstack/api/go/v4/common" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type DeviceProfileTemplate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Device-profile template ID. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Name. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Description. + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + // Vendor. + Vendor string `protobuf:"bytes,4,opt,name=vendor,proto3" json:"vendor,omitempty"` + // Firmware. + Firmware string `protobuf:"bytes,5,opt,name=firmware,proto3" json:"firmware,omitempty"` + // Region. + Region common.Region `protobuf:"varint,6,opt,name=region,proto3,enum=common.Region" json:"region,omitempty"` + // LoRaWAN mac-version. + MacVersion common.MacVersion `protobuf:"varint,7,opt,name=mac_version,json=macVersion,proto3,enum=common.MacVersion" json:"mac_version,omitempty"` + // Regional parameters revision. + RegParamsRevision common.RegParamsRevision `protobuf:"varint,8,opt,name=reg_params_revision,json=regParamsRevision,proto3,enum=common.RegParamsRevision" json:"reg_params_revision,omitempty"` + // ADR algorithm ID. + AdrAlgorithmId string `protobuf:"bytes,9,opt,name=adr_algorithm_id,json=adrAlgorithmId,proto3" json:"adr_algorithm_id,omitempty"` + // Payload codec runtime. + PayloadCodecRuntime CodecRuntime `protobuf:"varint,10,opt,name=payload_codec_runtime,json=payloadCodecRuntime,proto3,enum=api.CodecRuntime" json:"payload_codec_runtime,omitempty"` + // Payload codec script. + PayloadCodecScript string `protobuf:"bytes,11,opt,name=payload_codec_script,json=payloadCodecScript,proto3" json:"payload_codec_script,omitempty"` + // Flush queue on device activation. + FlushQueueOnActivate bool `protobuf:"varint,12,opt,name=flush_queue_on_activate,json=flushQueueOnActivate,proto3" json:"flush_queue_on_activate,omitempty"` + // 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. + UplinkInterval uint32 `protobuf:"varint,13,opt,name=uplink_interval,json=uplinkInterval,proto3" json:"uplink_interval,omitempty"` + // Device-status request interval (times / day). + // This defines the times per day that ChirpStack will request the device-status + // from the device. + DeviceStatusReqInterval uint32 `protobuf:"varint,14,opt,name=device_status_req_interval,json=deviceStatusReqInterval,proto3" json:"device_status_req_interval,omitempty"` + // Supports OTAA. + SupportsOtaa bool `protobuf:"varint,15,opt,name=supports_otaa,json=supportsOtaa,proto3" json:"supports_otaa,omitempty"` + // Supports Class B. + SupportsClassB bool `protobuf:"varint,16,opt,name=supports_class_b,json=supportsClassB,proto3" json:"supports_class_b,omitempty"` + // Supports Class-C. + SupportsClassC bool `protobuf:"varint,17,opt,name=supports_class_c,json=supportsClassC,proto3" json:"supports_class_c,omitempty"` + // Class-B timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested). + ClassBTimeout uint32 `protobuf:"varint,18,opt,name=class_b_timeout,json=classBTimeout,proto3" json:"class_b_timeout,omitempty"` + // Class-B ping-slot periodicity. + ClassBPingSlotPeriod uint32 `protobuf:"varint,19,opt,name=class_b_ping_slot_period,json=classBPingSlotPeriod,proto3" json:"class_b_ping_slot_period,omitempty"` + // Class-B ping-slot DR. + ClassBPingSlotDr uint32 `protobuf:"varint,20,opt,name=class_b_ping_slot_dr,json=classBPingSlotDr,proto3" json:"class_b_ping_slot_dr,omitempty"` + // Class-B ping-slot freq (Hz). + ClassBPingSlotFreq uint32 `protobuf:"varint,21,opt,name=class_b_ping_slot_freq,json=classBPingSlotFreq,proto3" json:"class_b_ping_slot_freq,omitempty"` + // Class-C timeout (seconds). + // This is the maximum time ChirpStack will wait to receive an acknowledgement from the device (if requested). + ClassCTimeout uint32 `protobuf:"varint,22,opt,name=class_c_timeout,json=classCTimeout,proto3" json:"class_c_timeout,omitempty"` + // RX1 delay (for ABP). + AbpRx1Delay uint32 `protobuf:"varint,23,opt,name=abp_rx1_delay,json=abpRx1Delay,proto3" json:"abp_rx1_delay,omitempty"` + // RX1 DR offset (for ABP). + AbpRx1DrOffset uint32 `protobuf:"varint,24,opt,name=abp_rx1_dr_offset,json=abpRx1DrOffset,proto3" json:"abp_rx1_dr_offset,omitempty"` + // RX2 DR (for ABP). + AbpRx2Dr uint32 `protobuf:"varint,25,opt,name=abp_rx2_dr,json=abpRx2Dr,proto3" json:"abp_rx2_dr,omitempty"` + // RX2 frequency (for ABP, Hz). + AbpRx2Freq uint32 `protobuf:"varint,26,opt,name=abp_rx2_freq,json=abpRx2Freq,proto3" json:"abp_rx2_freq,omitempty"` + // User defined tags. + Tags map[string]string `protobuf:"bytes,27,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *DeviceProfileTemplate) Reset() { + *x = DeviceProfileTemplate{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceProfileTemplate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProfileTemplate) ProtoMessage() {} + +func (x *DeviceProfileTemplate) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[0] + 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 DeviceProfileTemplate.ProtoReflect.Descriptor instead. +func (*DeviceProfileTemplate) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{0} +} + +func (x *DeviceProfileTemplate) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DeviceProfileTemplate) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeviceProfileTemplate) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *DeviceProfileTemplate) GetVendor() string { + if x != nil { + return x.Vendor + } + return "" +} + +func (x *DeviceProfileTemplate) GetFirmware() string { + if x != nil { + return x.Firmware + } + return "" +} + +func (x *DeviceProfileTemplate) GetRegion() common.Region { + if x != nil { + return x.Region + } + return common.Region(0) +} + +func (x *DeviceProfileTemplate) GetMacVersion() common.MacVersion { + if x != nil { + return x.MacVersion + } + return common.MacVersion(0) +} + +func (x *DeviceProfileTemplate) GetRegParamsRevision() common.RegParamsRevision { + if x != nil { + return x.RegParamsRevision + } + return common.RegParamsRevision(0) +} + +func (x *DeviceProfileTemplate) GetAdrAlgorithmId() string { + if x != nil { + return x.AdrAlgorithmId + } + return "" +} + +func (x *DeviceProfileTemplate) GetPayloadCodecRuntime() CodecRuntime { + if x != nil { + return x.PayloadCodecRuntime + } + return CodecRuntime_NONE +} + +func (x *DeviceProfileTemplate) GetPayloadCodecScript() string { + if x != nil { + return x.PayloadCodecScript + } + return "" +} + +func (x *DeviceProfileTemplate) GetFlushQueueOnActivate() bool { + if x != nil { + return x.FlushQueueOnActivate + } + return false +} + +func (x *DeviceProfileTemplate) GetUplinkInterval() uint32 { + if x != nil { + return x.UplinkInterval + } + return 0 +} + +func (x *DeviceProfileTemplate) GetDeviceStatusReqInterval() uint32 { + if x != nil { + return x.DeviceStatusReqInterval + } + return 0 +} + +func (x *DeviceProfileTemplate) GetSupportsOtaa() bool { + if x != nil { + return x.SupportsOtaa + } + return false +} + +func (x *DeviceProfileTemplate) GetSupportsClassB() bool { + if x != nil { + return x.SupportsClassB + } + return false +} + +func (x *DeviceProfileTemplate) GetSupportsClassC() bool { + if x != nil { + return x.SupportsClassC + } + return false +} + +func (x *DeviceProfileTemplate) GetClassBTimeout() uint32 { + if x != nil { + return x.ClassBTimeout + } + return 0 +} + +func (x *DeviceProfileTemplate) GetClassBPingSlotPeriod() uint32 { + if x != nil { + return x.ClassBPingSlotPeriod + } + return 0 +} + +func (x *DeviceProfileTemplate) GetClassBPingSlotDr() uint32 { + if x != nil { + return x.ClassBPingSlotDr + } + return 0 +} + +func (x *DeviceProfileTemplate) GetClassBPingSlotFreq() uint32 { + if x != nil { + return x.ClassBPingSlotFreq + } + return 0 +} + +func (x *DeviceProfileTemplate) GetClassCTimeout() uint32 { + if x != nil { + return x.ClassCTimeout + } + return 0 +} + +func (x *DeviceProfileTemplate) GetAbpRx1Delay() uint32 { + if x != nil { + return x.AbpRx1Delay + } + return 0 +} + +func (x *DeviceProfileTemplate) GetAbpRx1DrOffset() uint32 { + if x != nil { + return x.AbpRx1DrOffset + } + return 0 +} + +func (x *DeviceProfileTemplate) GetAbpRx2Dr() uint32 { + if x != nil { + return x.AbpRx2Dr + } + return 0 +} + +func (x *DeviceProfileTemplate) GetAbpRx2Freq() uint32 { + if x != nil { + return x.AbpRx2Freq + } + return 0 +} + +func (x *DeviceProfileTemplate) GetTags() map[string]string { + if x != nil { + return x.Tags + } + return nil +} + +type DeviceProfileTemplateListItem struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Device-profile template ID. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Created at timestamp. + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + // Last update timestamp. + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + // Name. + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // Vendor. + Vendor string `protobuf:"bytes,5,opt,name=vendor,proto3" json:"vendor,omitempty"` + // Firmware. + Firmware string `protobuf:"bytes,6,opt,name=firmware,proto3" json:"firmware,omitempty"` + // Region. + Region common.Region `protobuf:"varint,7,opt,name=region,proto3,enum=common.Region" json:"region,omitempty"` + // LoRaWAN mac-version. + MacVersion common.MacVersion `protobuf:"varint,8,opt,name=mac_version,json=macVersion,proto3,enum=common.MacVersion" json:"mac_version,omitempty"` + // Regional parameters revision. + RegParamsRevision common.RegParamsRevision `protobuf:"varint,9,opt,name=reg_params_revision,json=regParamsRevision,proto3,enum=common.RegParamsRevision" json:"reg_params_revision,omitempty"` + // Supports OTAA. + SupportsOtaa bool `protobuf:"varint,10,opt,name=supports_otaa,json=supportsOtaa,proto3" json:"supports_otaa,omitempty"` + // Supports Class-B. + SupportsClassB bool `protobuf:"varint,11,opt,name=supports_class_b,json=supportsClassB,proto3" json:"supports_class_b,omitempty"` + // Supports Class-C. + SupportsClassC bool `protobuf:"varint,12,opt,name=supports_class_c,json=supportsClassC,proto3" json:"supports_class_c,omitempty"` +} + +func (x *DeviceProfileTemplateListItem) Reset() { + *x = DeviceProfileTemplateListItem{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceProfileTemplateListItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProfileTemplateListItem) ProtoMessage() {} + +func (x *DeviceProfileTemplateListItem) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[1] + 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 DeviceProfileTemplateListItem.ProtoReflect.Descriptor instead. +func (*DeviceProfileTemplateListItem) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{1} +} + +func (x *DeviceProfileTemplateListItem) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DeviceProfileTemplateListItem) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *DeviceProfileTemplateListItem) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *DeviceProfileTemplateListItem) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DeviceProfileTemplateListItem) GetVendor() string { + if x != nil { + return x.Vendor + } + return "" +} + +func (x *DeviceProfileTemplateListItem) GetFirmware() string { + if x != nil { + return x.Firmware + } + return "" +} + +func (x *DeviceProfileTemplateListItem) GetRegion() common.Region { + if x != nil { + return x.Region + } + return common.Region(0) +} + +func (x *DeviceProfileTemplateListItem) GetMacVersion() common.MacVersion { + if x != nil { + return x.MacVersion + } + return common.MacVersion(0) +} + +func (x *DeviceProfileTemplateListItem) GetRegParamsRevision() common.RegParamsRevision { + if x != nil { + return x.RegParamsRevision + } + return common.RegParamsRevision(0) +} + +func (x *DeviceProfileTemplateListItem) GetSupportsOtaa() bool { + if x != nil { + return x.SupportsOtaa + } + return false +} + +func (x *DeviceProfileTemplateListItem) GetSupportsClassB() bool { + if x != nil { + return x.SupportsClassB + } + return false +} + +func (x *DeviceProfileTemplateListItem) GetSupportsClassC() bool { + if x != nil { + return x.SupportsClassC + } + return false +} + +type CreateDeviceProfileTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Object to create. + DeviceProfileTemplate *DeviceProfileTemplate `protobuf:"bytes,1,opt,name=device_profile_template,json=deviceProfileTemplate,proto3" json:"device_profile_template,omitempty"` +} + +func (x *CreateDeviceProfileTemplateRequest) Reset() { + *x = CreateDeviceProfileTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDeviceProfileTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDeviceProfileTemplateRequest) ProtoMessage() {} + +func (x *CreateDeviceProfileTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_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 CreateDeviceProfileTemplateRequest.ProtoReflect.Descriptor instead. +func (*CreateDeviceProfileTemplateRequest) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateDeviceProfileTemplateRequest) GetDeviceProfileTemplate() *DeviceProfileTemplate { + if x != nil { + return x.DeviceProfileTemplate + } + return nil +} + +type GetDeviceProfileTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetDeviceProfileTemplateRequest) Reset() { + *x = GetDeviceProfileTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeviceProfileTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeviceProfileTemplateRequest) ProtoMessage() {} + +func (x *GetDeviceProfileTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_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 GetDeviceProfileTemplateRequest.ProtoReflect.Descriptor instead. +func (*GetDeviceProfileTemplateRequest) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{3} +} + +func (x *GetDeviceProfileTemplateRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetDeviceProfileTemplateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Device-profile template object. + DeviceProfileTemplate *DeviceProfileTemplate `protobuf:"bytes,1,opt,name=device_profile_template,json=deviceProfileTemplate,proto3" json:"device_profile_template,omitempty"` + // Created at timestamp. + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + // Last update timestamp. + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *GetDeviceProfileTemplateResponse) Reset() { + *x = GetDeviceProfileTemplateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeviceProfileTemplateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeviceProfileTemplateResponse) ProtoMessage() {} + +func (x *GetDeviceProfileTemplateResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[4] + 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 GetDeviceProfileTemplateResponse.ProtoReflect.Descriptor instead. +func (*GetDeviceProfileTemplateResponse) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{4} +} + +func (x *GetDeviceProfileTemplateResponse) GetDeviceProfileTemplate() *DeviceProfileTemplate { + if x != nil { + return x.DeviceProfileTemplate + } + return nil +} + +func (x *GetDeviceProfileTemplateResponse) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *GetDeviceProfileTemplateResponse) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type UpdateDeviceProfileTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Object to update. + DeviceProfileTemplate *DeviceProfileTemplate `protobuf:"bytes,1,opt,name=device_profile_template,json=deviceProfileTemplate,proto3" json:"device_profile_template,omitempty"` +} + +func (x *UpdateDeviceProfileTemplateRequest) Reset() { + *x = UpdateDeviceProfileTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDeviceProfileTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDeviceProfileTemplateRequest) ProtoMessage() {} + +func (x *UpdateDeviceProfileTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[5] + 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 UpdateDeviceProfileTemplateRequest.ProtoReflect.Descriptor instead. +func (*UpdateDeviceProfileTemplateRequest) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{5} +} + +func (x *UpdateDeviceProfileTemplateRequest) GetDeviceProfileTemplate() *DeviceProfileTemplate { + if x != nil { + return x.DeviceProfileTemplate + } + return nil +} + +type DeleteDeviceProfileTemplateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // ID. + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteDeviceProfileTemplateRequest) Reset() { + *x = DeleteDeviceProfileTemplateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDeviceProfileTemplateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDeviceProfileTemplateRequest) ProtoMessage() {} + +func (x *DeleteDeviceProfileTemplateRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[6] + 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 DeleteDeviceProfileTemplateRequest.ProtoReflect.Descriptor instead. +func (*DeleteDeviceProfileTemplateRequest) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteDeviceProfileTemplateRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type ListDeviceProfileTemplatesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Max number of device-profile templates to return in the result-set. + Limit uint32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + // Offset in the result-set (for pagination). + Offset uint32 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` +} + +func (x *ListDeviceProfileTemplatesRequest) Reset() { + *x = ListDeviceProfileTemplatesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDeviceProfileTemplatesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDeviceProfileTemplatesRequest) ProtoMessage() {} + +func (x *ListDeviceProfileTemplatesRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[7] + 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 ListDeviceProfileTemplatesRequest.ProtoReflect.Descriptor instead. +func (*ListDeviceProfileTemplatesRequest) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{7} +} + +func (x *ListDeviceProfileTemplatesRequest) GetLimit() uint32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *ListDeviceProfileTemplatesRequest) GetOffset() uint32 { + if x != nil { + return x.Offset + } + return 0 +} + +type ListDeviceProfileTemplatesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Total number of device-profile templates. + TotalCount uint32 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` + // Result-set. + Result []*DeviceProfileTemplateListItem `protobuf:"bytes,2,rep,name=result,proto3" json:"result,omitempty"` +} + +func (x *ListDeviceProfileTemplatesResponse) Reset() { + *x = ListDeviceProfileTemplatesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_device_profile_template_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDeviceProfileTemplatesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDeviceProfileTemplatesResponse) ProtoMessage() {} + +func (x *ListDeviceProfileTemplatesResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_device_profile_template_proto_msgTypes[8] + 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 ListDeviceProfileTemplatesResponse.ProtoReflect.Descriptor instead. +func (*ListDeviceProfileTemplatesResponse) Descriptor() ([]byte, []int) { + return file_api_device_profile_template_proto_rawDescGZIP(), []int{8} +} + +func (x *ListDeviceProfileTemplatesResponse) GetTotalCount() uint32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +func (x *ListDeviceProfileTemplatesResponse) GetResult() []*DeviceProfileTemplateListItem { + if x != nil { + return x.Result + } + return nil +} + +var File_api_device_profile_template_proto protoreflect.FileDescriptor + +var file_api_device_profile_template_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x61, 0x70, 0x69, 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, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x18, 0x61, 0x70, 0x69, + 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe0, 0x09, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, + 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, + 0x6e, 0x12, 0x33, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x4d, 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x13, 0x72, 0x65, 0x67, 0x5f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, + 0x72, 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x64, 0x72, 0x5f, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, + 0x68, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x72, + 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x15, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x5f, 0x72, 0x75, 0x6e, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x52, 0x13, 0x70, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x52, 0x75, 0x6e, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x63, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x63, 0x53, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x12, 0x35, 0x0a, 0x17, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x5f, 0x71, 0x75, + 0x65, 0x75, 0x65, 0x5f, 0x6f, 0x6e, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x66, 0x6c, 0x75, 0x73, 0x68, 0x51, 0x75, 0x65, 0x75, + 0x65, 0x4f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x75, + 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x75, 0x70, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x76, 0x61, 0x6c, 0x12, 0x3b, 0x0a, 0x1a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x17, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, + 0x6c, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x6f, 0x74, + 0x61, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x73, 0x4f, 0x74, 0x61, 0x61, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, + 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x42, + 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x5f, 0x63, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, + 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x5f, 0x62, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x12, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x54, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x12, 0x36, 0x0a, 0x18, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, + 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x13, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x50, 0x69, 0x6e, 0x67, + 0x53, 0x6c, 0x6f, 0x74, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x14, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, + 0x64, 0x72, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x42, + 0x50, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x44, 0x72, 0x12, 0x32, 0x0a, 0x16, 0x63, 0x6c, + 0x61, 0x73, 0x73, 0x5f, 0x62, 0x5f, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x6c, 0x6f, 0x74, 0x5f, + 0x66, 0x72, 0x65, 0x71, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x42, 0x50, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x6f, 0x74, 0x46, 0x72, 0x65, 0x71, 0x12, 0x26, + 0x0a, 0x0f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x63, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x54, + 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, + 0x31, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x61, + 0x62, 0x70, 0x52, 0x78, 0x31, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x29, 0x0a, 0x11, 0x61, 0x62, + 0x70, 0x5f, 0x72, 0x78, 0x31, 0x5f, 0x64, 0x72, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x18, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x61, 0x62, 0x70, 0x52, 0x78, 0x31, 0x44, 0x72, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x0a, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x32, + 0x5f, 0x64, 0x72, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x61, 0x62, 0x70, 0x52, 0x78, + 0x32, 0x44, 0x72, 0x12, 0x20, 0x0a, 0x0c, 0x61, 0x62, 0x70, 0x5f, 0x72, 0x78, 0x32, 0x5f, 0x66, + 0x72, 0x65, 0x71, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x61, 0x62, 0x70, 0x52, 0x78, + 0x32, 0x46, 0x72, 0x65, 0x71, 0x12, 0x38, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x1b, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, + 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x1a, + 0x37, 0x0a, 0x09, 0x54, 0x61, 0x67, 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, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x8e, 0x04, 0x0a, 0x1d, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 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, 0x09, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 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, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, + 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, + 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, + 0x12, 0x33, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x4d, + 0x61, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x49, 0x0a, 0x13, 0x72, 0x65, 0x67, 0x5f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x5f, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x67, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x72, + 0x65, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x6f, 0x74, 0x61, + 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x4f, 0x74, 0x61, 0x61, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, + 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x62, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x42, 0x12, + 0x28, 0x0a, 0x10, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x5f, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x63, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x73, 0x75, 0x70, 0x70, 0x6f, + 0x72, 0x74, 0x73, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x22, 0x78, 0x0a, 0x22, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x52, 0x0a, 0x17, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x15, 0x64, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x22, 0x31, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xec, 0x01, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x17, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x15, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, + 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 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, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 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, 0x09, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x78, 0x0a, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x52, 0x0a, 0x17, 0x64, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x15, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, + 0x34, 0x0a, 0x22, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x51, 0x0a, 0x21, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x81, 0x01, 0x0a, 0x22, 0x4c, 0x69, 0x73, + 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x3a, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, + 0x49, 0x74, 0x65, 0x6d, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xb6, 0x03, 0x0a, + 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4b, 0x0a, + 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 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, 0x54, 0x0a, 0x03, 0x47, 0x65, + 0x74, 0x12, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, + 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4b, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 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, 0x4b, 0x0a, + 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x27, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 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, 0x59, 0x0a, 0x04, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x26, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, + 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x61, 0x0a, 0x11, 0x69, 0x6f, 0x2e, 0x63, 0x68, 0x69, 0x72, + 0x70, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x1a, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 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 ( + file_api_device_profile_template_proto_rawDescOnce sync.Once + file_api_device_profile_template_proto_rawDescData = file_api_device_profile_template_proto_rawDesc +) + +func file_api_device_profile_template_proto_rawDescGZIP() []byte { + file_api_device_profile_template_proto_rawDescOnce.Do(func() { + file_api_device_profile_template_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_device_profile_template_proto_rawDescData) + }) + return file_api_device_profile_template_proto_rawDescData +} + +var file_api_device_profile_template_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_api_device_profile_template_proto_goTypes = []interface{}{ + (*DeviceProfileTemplate)(nil), // 0: api.DeviceProfileTemplate + (*DeviceProfileTemplateListItem)(nil), // 1: api.DeviceProfileTemplateListItem + (*CreateDeviceProfileTemplateRequest)(nil), // 2: api.CreateDeviceProfileTemplateRequest + (*GetDeviceProfileTemplateRequest)(nil), // 3: api.GetDeviceProfileTemplateRequest + (*GetDeviceProfileTemplateResponse)(nil), // 4: api.GetDeviceProfileTemplateResponse + (*UpdateDeviceProfileTemplateRequest)(nil), // 5: api.UpdateDeviceProfileTemplateRequest + (*DeleteDeviceProfileTemplateRequest)(nil), // 6: api.DeleteDeviceProfileTemplateRequest + (*ListDeviceProfileTemplatesRequest)(nil), // 7: api.ListDeviceProfileTemplatesRequest + (*ListDeviceProfileTemplatesResponse)(nil), // 8: api.ListDeviceProfileTemplatesResponse + nil, // 9: api.DeviceProfileTemplate.TagsEntry + (common.Region)(0), // 10: common.Region + (common.MacVersion)(0), // 11: common.MacVersion + (common.RegParamsRevision)(0), // 12: common.RegParamsRevision + (CodecRuntime)(0), // 13: api.CodecRuntime + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 15: google.protobuf.Empty +} +var file_api_device_profile_template_proto_depIdxs = []int32{ + 10, // 0: api.DeviceProfileTemplate.region:type_name -> common.Region + 11, // 1: api.DeviceProfileTemplate.mac_version:type_name -> common.MacVersion + 12, // 2: api.DeviceProfileTemplate.reg_params_revision:type_name -> common.RegParamsRevision + 13, // 3: api.DeviceProfileTemplate.payload_codec_runtime:type_name -> api.CodecRuntime + 9, // 4: api.DeviceProfileTemplate.tags:type_name -> api.DeviceProfileTemplate.TagsEntry + 14, // 5: api.DeviceProfileTemplateListItem.created_at:type_name -> google.protobuf.Timestamp + 14, // 6: api.DeviceProfileTemplateListItem.updated_at:type_name -> google.protobuf.Timestamp + 10, // 7: api.DeviceProfileTemplateListItem.region:type_name -> common.Region + 11, // 8: api.DeviceProfileTemplateListItem.mac_version:type_name -> common.MacVersion + 12, // 9: api.DeviceProfileTemplateListItem.reg_params_revision:type_name -> common.RegParamsRevision + 0, // 10: api.CreateDeviceProfileTemplateRequest.device_profile_template:type_name -> api.DeviceProfileTemplate + 0, // 11: api.GetDeviceProfileTemplateResponse.device_profile_template:type_name -> api.DeviceProfileTemplate + 14, // 12: api.GetDeviceProfileTemplateResponse.created_at:type_name -> google.protobuf.Timestamp + 14, // 13: api.GetDeviceProfileTemplateResponse.updated_at:type_name -> google.protobuf.Timestamp + 0, // 14: api.UpdateDeviceProfileTemplateRequest.device_profile_template:type_name -> api.DeviceProfileTemplate + 1, // 15: api.ListDeviceProfileTemplatesResponse.result:type_name -> api.DeviceProfileTemplateListItem + 2, // 16: api.DeviceProfileTemplateService.Create:input_type -> api.CreateDeviceProfileTemplateRequest + 3, // 17: api.DeviceProfileTemplateService.Get:input_type -> api.GetDeviceProfileTemplateRequest + 5, // 18: api.DeviceProfileTemplateService.Update:input_type -> api.UpdateDeviceProfileTemplateRequest + 6, // 19: api.DeviceProfileTemplateService.Delete:input_type -> api.DeleteDeviceProfileTemplateRequest + 7, // 20: api.DeviceProfileTemplateService.List:input_type -> api.ListDeviceProfileTemplatesRequest + 15, // 21: api.DeviceProfileTemplateService.Create:output_type -> google.protobuf.Empty + 4, // 22: api.DeviceProfileTemplateService.Get:output_type -> api.GetDeviceProfileTemplateResponse + 15, // 23: api.DeviceProfileTemplateService.Update:output_type -> google.protobuf.Empty + 15, // 24: api.DeviceProfileTemplateService.Delete:output_type -> google.protobuf.Empty + 8, // 25: api.DeviceProfileTemplateService.List:output_type -> api.ListDeviceProfileTemplatesResponse + 21, // [21:26] is the sub-list for method output_type + 16, // [16:21] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name +} + +func init() { file_api_device_profile_template_proto_init() } +func file_api_device_profile_template_proto_init() { + if File_api_device_profile_template_proto != nil { + return + } + file_api_device_profile_proto_init() + if !protoimpl.UnsafeEnabled { + file_api_device_profile_template_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceProfileTemplate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceProfileTemplateListItem); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDeviceProfileTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDeviceProfileTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetDeviceProfileTemplateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDeviceProfileTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDeviceProfileTemplateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDeviceProfileTemplatesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_device_profile_template_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDeviceProfileTemplatesResponse); 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_api_device_profile_template_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_device_profile_template_proto_goTypes, + DependencyIndexes: file_api_device_profile_template_proto_depIdxs, + MessageInfos: file_api_device_profile_template_proto_msgTypes, + }.Build() + File_api_device_profile_template_proto = out.File + file_api_device_profile_template_proto_rawDesc = nil + file_api_device_profile_template_proto_goTypes = nil + file_api_device_profile_template_proto_depIdxs = nil +} diff --git a/api/go/api/device_profile_template_grpc.pb.go b/api/go/api/device_profile_template_grpc.pb.go new file mode 100644 index 00000000..acf80135 --- /dev/null +++ b/api/go/api/device_profile_template_grpc.pb.go @@ -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", +} diff --git a/api/grpc-web/Makefile b/api/grpc-web/Makefile index 37bdf428..ae5c98df 100644 --- a/api/grpc-web/Makefile +++ b/api/grpc-web/Makefile @@ -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 diff --git a/api/grpc-web/api/device_profile_pb.d.ts b/api/grpc-web/api/device_profile_pb.d.ts index da760a2f..e6dcbffd 100644 --- a/api/grpc-web/api/device_profile_pb.d.ts +++ b/api/grpc-web/api/device_profile_pb.d.ts @@ -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; @@ -94,6 +97,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, diff --git a/api/grpc-web/api/device_profile_pb.js b/api/grpc-web/api/device_profile_pb.js index e61b7d44..d484e55b 100644 --- a/api/grpc-web/api/device_profile_pb.js +++ b/api/grpc-web/api/device_profile_pb.js @@ -321,6 +321,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), @@ -391,6 +392,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); @@ -531,6 +536,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( @@ -739,6 +751,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} diff --git a/api/grpc-web/api/device_profile_template_grpc_web_pb.d.ts b/api/grpc-web/api/device_profile_template_grpc_web_pb.d.ts new file mode 100644 index 00000000..30d5a9f1 --- /dev/null +++ b/api/grpc-web/api/device_profile_template_grpc_web_pb.d.ts @@ -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; + + 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; + + 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; + + 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; + + 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; + +} + +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; + + get( + request: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + update( + request: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + delete( + request: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + list( + request: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, + metadata?: grpcWeb.Metadata + ): Promise; + +} + diff --git a/api/grpc-web/api/device_profile_template_grpc_web_pb.js b/api/grpc-web/api/device_profile_template_grpc_web_pb.js new file mode 100644 index 00000000..93bbcb3c --- /dev/null +++ b/api/grpc-web/api/device_profile_template_grpc_web_pb.js @@ -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} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|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} metadata User defined + * call metadata + * @return {!Promise} + * 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} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.api.GetDeviceProfileTemplateResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|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} metadata User defined + * call metadata + * @return {!Promise} + * 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} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|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} metadata User defined + * call metadata + * @return {!Promise} + * 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} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.google.protobuf.Empty)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|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} metadata User defined + * call metadata + * @return {!Promise} + * 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} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.api.ListDeviceProfileTemplatesResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|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} metadata User defined + * call metadata + * @return {!Promise} + * 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; + diff --git a/api/grpc-web/api/device_profile_template_pb.d.ts b/api/grpc-web/api/device_profile_template_pb.d.ts new file mode 100644 index 00000000..1658c7d2 --- /dev/null +++ b/api/grpc-web/api/device_profile_template_pb.d.ts @@ -0,0 +1,350 @@ +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; + clearTagsMap(): 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]>, + } +} + +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; + setResultList(value: Array): 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, + } +} + diff --git a/api/grpc-web/api/device_profile_template_pb.js b/api/grpc-web/api/device_profile_template_pb.js new file mode 100644 index 00000000..fcd8f32a --- /dev/null +++ b/api/grpc-web/api/device_profile_template_pb.js @@ -0,0 +1,2804 @@ +// source: api/device_profile_template.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +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); +var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); +goog.object.extend(proto, google_protobuf_empty_pb); +var common_common_pb = require('../common/common_pb.js'); +goog.object.extend(proto, common_common_pb); +var api_device_profile_pb = require('../api/device_profile_pb.js'); +goog.object.extend(proto, api_device_profile_pb); +goog.exportSymbol('proto.api.CreateDeviceProfileTemplateRequest', null, global); +goog.exportSymbol('proto.api.DeleteDeviceProfileTemplateRequest', null, global); +goog.exportSymbol('proto.api.DeviceProfileTemplate', null, global); +goog.exportSymbol('proto.api.DeviceProfileTemplateListItem', null, global); +goog.exportSymbol('proto.api.GetDeviceProfileTemplateRequest', null, global); +goog.exportSymbol('proto.api.GetDeviceProfileTemplateResponse', null, global); +goog.exportSymbol('proto.api.ListDeviceProfileTemplatesRequest', null, global); +goog.exportSymbol('proto.api.ListDeviceProfileTemplatesResponse', null, global); +goog.exportSymbol('proto.api.UpdateDeviceProfileTemplateRequest', null, global); +/** + * 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.DeviceProfileTemplate = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.DeviceProfileTemplate, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.DeviceProfileTemplate.displayName = 'proto.api.DeviceProfileTemplate'; +} +/** + * 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.DeviceProfileTemplateListItem = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.DeviceProfileTemplateListItem, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.DeviceProfileTemplateListItem.displayName = 'proto.api.DeviceProfileTemplateListItem'; +} +/** + * 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.CreateDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.CreateDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.CreateDeviceProfileTemplateRequest.displayName = 'proto.api.CreateDeviceProfileTemplateRequest'; +} +/** + * 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.GetDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.GetDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.GetDeviceProfileTemplateRequest.displayName = 'proto.api.GetDeviceProfileTemplateRequest'; +} +/** + * 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.GetDeviceProfileTemplateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.GetDeviceProfileTemplateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.GetDeviceProfileTemplateResponse.displayName = 'proto.api.GetDeviceProfileTemplateResponse'; +} +/** + * 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.UpdateDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.UpdateDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.UpdateDeviceProfileTemplateRequest.displayName = 'proto.api.UpdateDeviceProfileTemplateRequest'; +} +/** + * 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.DeleteDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.DeleteDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.DeleteDeviceProfileTemplateRequest.displayName = 'proto.api.DeleteDeviceProfileTemplateRequest'; +} +/** + * 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.ListDeviceProfileTemplatesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.ListDeviceProfileTemplatesRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.ListDeviceProfileTemplatesRequest.displayName = 'proto.api.ListDeviceProfileTemplatesRequest'; +} +/** + * 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.ListDeviceProfileTemplatesResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.api.ListDeviceProfileTemplatesResponse.repeatedFields_, null); +}; +goog.inherits(proto.api.ListDeviceProfileTemplatesResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.api.ListDeviceProfileTemplatesResponse.displayName = 'proto.api.ListDeviceProfileTemplatesResponse'; +} + + + +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_, 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.DeviceProfileTemplate.prototype.toObject = function(opt_includeInstance) { + return proto.api.DeviceProfileTemplate.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.DeviceProfileTemplate} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.DeviceProfileTemplate.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, ""), + description: jspb.Message.getFieldWithDefault(msg, 3, ""), + vendor: jspb.Message.getFieldWithDefault(msg, 4, ""), + firmware: jspb.Message.getFieldWithDefault(msg, 5, ""), + region: jspb.Message.getFieldWithDefault(msg, 6, 0), + macVersion: jspb.Message.getFieldWithDefault(msg, 7, 0), + regParamsRevision: jspb.Message.getFieldWithDefault(msg, 8, 0), + adrAlgorithmId: jspb.Message.getFieldWithDefault(msg, 9, ""), + payloadCodecRuntime: jspb.Message.getFieldWithDefault(msg, 10, 0), + payloadCodecScript: jspb.Message.getFieldWithDefault(msg, 11, ""), + flushQueueOnActivate: jspb.Message.getBooleanFieldWithDefault(msg, 12, false), + uplinkInterval: jspb.Message.getFieldWithDefault(msg, 13, 0), + deviceStatusReqInterval: jspb.Message.getFieldWithDefault(msg, 14, 0), + supportsOtaa: jspb.Message.getBooleanFieldWithDefault(msg, 15, false), + supportsClassB: jspb.Message.getBooleanFieldWithDefault(msg, 16, false), + supportsClassC: jspb.Message.getBooleanFieldWithDefault(msg, 17, false), + classBTimeout: jspb.Message.getFieldWithDefault(msg, 18, 0), + classBPingSlotPeriod: jspb.Message.getFieldWithDefault(msg, 19, 0), + classBPingSlotDr: jspb.Message.getFieldWithDefault(msg, 20, 0), + classBPingSlotFreq: jspb.Message.getFieldWithDefault(msg, 21, 0), + classCTimeout: jspb.Message.getFieldWithDefault(msg, 22, 0), + abpRx1Delay: jspb.Message.getFieldWithDefault(msg, 23, 0), + abpRx1DrOffset: jspb.Message.getFieldWithDefault(msg, 24, 0), + abpRx2Dr: jspb.Message.getFieldWithDefault(msg, 25, 0), + abpRx2Freq: jspb.Message.getFieldWithDefault(msg, 26, 0), + tagsMap: (f = msg.getTagsMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + 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.DeviceProfileTemplate} + */ +proto.api.DeviceProfileTemplate.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.DeviceProfileTemplate; + return proto.api.DeviceProfileTemplate.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.DeviceProfileTemplate} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.DeviceProfileTemplate} + */ +proto.api.DeviceProfileTemplate.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.setId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setDescription(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVendor(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setFirmware(value); + break; + case 6: + var value = /** @type {!proto.common.Region} */ (reader.readEnum()); + msg.setRegion(value); + break; + case 7: + var value = /** @type {!proto.common.MacVersion} */ (reader.readEnum()); + msg.setMacVersion(value); + break; + case 8: + var value = /** @type {!proto.common.RegParamsRevision} */ (reader.readEnum()); + msg.setRegParamsRevision(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.setAdrAlgorithmId(value); + break; + case 10: + var value = /** @type {!proto.api.CodecRuntime} */ (reader.readEnum()); + msg.setPayloadCodecRuntime(value); + break; + case 11: + var value = /** @type {string} */ (reader.readString()); + msg.setPayloadCodecScript(value); + break; + case 12: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFlushQueueOnActivate(value); + break; + case 13: + var value = /** @type {number} */ (reader.readUint32()); + msg.setUplinkInterval(value); + break; + case 14: + var value = /** @type {number} */ (reader.readUint32()); + msg.setDeviceStatusReqInterval(value); + break; + case 15: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsOtaa(value); + break; + case 16: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassB(value); + break; + case 17: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassC(value); + break; + case 18: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBTimeout(value); + break; + case 19: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBPingSlotPeriod(value); + break; + case 20: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBPingSlotDr(value); + break; + case 21: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBPingSlotFreq(value); + break; + case 22: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassCTimeout(value); + break; + case 23: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx1Delay(value); + break; + case 24: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx1DrOffset(value); + break; + case 25: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx2Dr(value); + break; + case 26: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx2Freq(value); + break; + case 27: + var value = msg.getTagsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.DeviceProfileTemplate.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.DeviceProfileTemplate.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.DeviceProfileTemplate} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.DeviceProfileTemplate.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getDescription(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getVendor(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getFirmware(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getRegion(); + if (f !== 0.0) { + writer.writeEnum( + 6, + f + ); + } + f = message.getMacVersion(); + if (f !== 0.0) { + writer.writeEnum( + 7, + f + ); + } + f = message.getRegParamsRevision(); + if (f !== 0.0) { + writer.writeEnum( + 8, + f + ); + } + f = message.getAdrAlgorithmId(); + if (f.length > 0) { + writer.writeString( + 9, + f + ); + } + f = message.getPayloadCodecRuntime(); + if (f !== 0.0) { + writer.writeEnum( + 10, + f + ); + } + f = message.getPayloadCodecScript(); + if (f.length > 0) { + writer.writeString( + 11, + f + ); + } + f = message.getFlushQueueOnActivate(); + if (f) { + writer.writeBool( + 12, + f + ); + } + f = message.getUplinkInterval(); + if (f !== 0) { + writer.writeUint32( + 13, + f + ); + } + f = message.getDeviceStatusReqInterval(); + if (f !== 0) { + writer.writeUint32( + 14, + f + ); + } + f = message.getSupportsOtaa(); + if (f) { + writer.writeBool( + 15, + f + ); + } + f = message.getSupportsClassB(); + if (f) { + writer.writeBool( + 16, + f + ); + } + f = message.getSupportsClassC(); + if (f) { + writer.writeBool( + 17, + f + ); + } + f = message.getClassBTimeout(); + if (f !== 0) { + writer.writeUint32( + 18, + f + ); + } + f = message.getClassBPingSlotPeriod(); + if (f !== 0) { + writer.writeUint32( + 19, + f + ); + } + f = message.getClassBPingSlotDr(); + if (f !== 0) { + writer.writeUint32( + 20, + f + ); + } + f = message.getClassBPingSlotFreq(); + if (f !== 0) { + writer.writeUint32( + 21, + f + ); + } + f = message.getClassCTimeout(); + if (f !== 0) { + writer.writeUint32( + 22, + f + ); + } + f = message.getAbpRx1Delay(); + if (f !== 0) { + writer.writeUint32( + 23, + f + ); + } + f = message.getAbpRx1DrOffset(); + if (f !== 0) { + writer.writeUint32( + 24, + f + ); + } + f = message.getAbpRx2Dr(); + if (f !== 0) { + writer.writeUint32( + 25, + f + ); + } + f = message.getAbpRx2Freq(); + if (f !== 0) { + writer.writeUint32( + 26, + f + ); + } + f = message.getTagsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(27, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string name = 2; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string description = 3; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getDescription = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setDescription = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string vendor = 4; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getVendor = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setVendor = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string firmware = 5; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getFirmware = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setFirmware = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional common.Region region = 6; + * @return {!proto.common.Region} + */ +proto.api.DeviceProfileTemplate.prototype.getRegion = function() { + return /** @type {!proto.common.Region} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {!proto.common.Region} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setRegion = function(value) { + return jspb.Message.setProto3EnumField(this, 6, value); +}; + + +/** + * optional common.MacVersion mac_version = 7; + * @return {!proto.common.MacVersion} + */ +proto.api.DeviceProfileTemplate.prototype.getMacVersion = function() { + return /** @type {!proto.common.MacVersion} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {!proto.common.MacVersion} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setMacVersion = function(value) { + return jspb.Message.setProto3EnumField(this, 7, value); +}; + + +/** + * optional common.RegParamsRevision reg_params_revision = 8; + * @return {!proto.common.RegParamsRevision} + */ +proto.api.DeviceProfileTemplate.prototype.getRegParamsRevision = function() { + return /** @type {!proto.common.RegParamsRevision} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {!proto.common.RegParamsRevision} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setRegParamsRevision = function(value) { + return jspb.Message.setProto3EnumField(this, 8, value); +}; + + +/** + * optional string adr_algorithm_id = 9; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getAdrAlgorithmId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setAdrAlgorithmId = function(value) { + return jspb.Message.setProto3StringField(this, 9, value); +}; + + +/** + * optional CodecRuntime payload_codec_runtime = 10; + * @return {!proto.api.CodecRuntime} + */ +proto.api.DeviceProfileTemplate.prototype.getPayloadCodecRuntime = function() { + return /** @type {!proto.api.CodecRuntime} */ (jspb.Message.getFieldWithDefault(this, 10, 0)); +}; + + +/** + * @param {!proto.api.CodecRuntime} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setPayloadCodecRuntime = function(value) { + return jspb.Message.setProto3EnumField(this, 10, value); +}; + + +/** + * optional string payload_codec_script = 11; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getPayloadCodecScript = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 11, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setPayloadCodecScript = function(value) { + return jspb.Message.setProto3StringField(this, 11, value); +}; + + +/** + * optional bool flush_queue_on_activate = 12; + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getFlushQueueOnActivate = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 12, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setFlushQueueOnActivate = function(value) { + return jspb.Message.setProto3BooleanField(this, 12, value); +}; + + +/** + * optional uint32 uplink_interval = 13; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getUplinkInterval = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setUplinkInterval = function(value) { + return jspb.Message.setProto3IntField(this, 13, value); +}; + + +/** + * optional uint32 device_status_req_interval = 14; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getDeviceStatusReqInterval = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setDeviceStatusReqInterval = function(value) { + return jspb.Message.setProto3IntField(this, 14, value); +}; + + +/** + * optional bool supports_otaa = 15; + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getSupportsOtaa = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 15, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setSupportsOtaa = function(value) { + return jspb.Message.setProto3BooleanField(this, 15, value); +}; + + +/** + * optional bool supports_class_b = 16; + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getSupportsClassB = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 16, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setSupportsClassB = function(value) { + return jspb.Message.setProto3BooleanField(this, 16, value); +}; + + +/** + * optional bool supports_class_c = 17; + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getSupportsClassC = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 17, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setSupportsClassC = function(value) { + return jspb.Message.setProto3BooleanField(this, 17, value); +}; + + +/** + * optional uint32 class_b_timeout = 18; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBTimeout = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 18, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setClassBTimeout = function(value) { + return jspb.Message.setProto3IntField(this, 18, value); +}; + + +/** + * optional uint32 class_b_ping_slot_period = 19; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBPingSlotPeriod = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 19, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setClassBPingSlotPeriod = function(value) { + return jspb.Message.setProto3IntField(this, 19, value); +}; + + +/** + * optional uint32 class_b_ping_slot_dr = 20; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBPingSlotDr = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 20, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setClassBPingSlotDr = function(value) { + return jspb.Message.setProto3IntField(this, 20, value); +}; + + +/** + * optional uint32 class_b_ping_slot_freq = 21; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBPingSlotFreq = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 21, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setClassBPingSlotFreq = function(value) { + return jspb.Message.setProto3IntField(this, 21, value); +}; + + +/** + * optional uint32 class_c_timeout = 22; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassCTimeout = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 22, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setClassCTimeout = function(value) { + return jspb.Message.setProto3IntField(this, 22, value); +}; + + +/** + * optional uint32 abp_rx1_delay = 23; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx1Delay = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 23, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx1Delay = function(value) { + return jspb.Message.setProto3IntField(this, 23, value); +}; + + +/** + * optional uint32 abp_rx1_dr_offset = 24; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx1DrOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 24, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx1DrOffset = function(value) { + return jspb.Message.setProto3IntField(this, 24, value); +}; + + +/** + * optional uint32 abp_rx2_dr = 25; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx2Dr = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 25, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx2Dr = function(value) { + return jspb.Message.setProto3IntField(this, 25, value); +}; + + +/** + * optional uint32 abp_rx2_freq = 26; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx2Freq = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 26, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx2Freq = function(value) { + return jspb.Message.setProto3IntField(this, 26, value); +}; + + +/** + * map tags = 27; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.api.DeviceProfileTemplate.prototype.getTagsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 27, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.api.DeviceProfileTemplate} returns this + */ +proto.api.DeviceProfileTemplate.prototype.clearTagsMap = function() { + this.getTagsMap().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_, 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.DeviceProfileTemplateListItem.prototype.toObject = function(opt_includeInstance) { + return proto.api.DeviceProfileTemplateListItem.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.DeviceProfileTemplateListItem} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.DeviceProfileTemplateListItem.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + updatedAt: (f = msg.getUpdatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + name: jspb.Message.getFieldWithDefault(msg, 4, ""), + vendor: jspb.Message.getFieldWithDefault(msg, 5, ""), + firmware: jspb.Message.getFieldWithDefault(msg, 6, ""), + region: jspb.Message.getFieldWithDefault(msg, 7, 0), + macVersion: jspb.Message.getFieldWithDefault(msg, 8, 0), + regParamsRevision: jspb.Message.getFieldWithDefault(msg, 9, 0), + supportsOtaa: jspb.Message.getBooleanFieldWithDefault(msg, 10, false), + supportsClassB: jspb.Message.getBooleanFieldWithDefault(msg, 11, false), + supportsClassC: jspb.Message.getBooleanFieldWithDefault(msg, 12, false) + }; + + 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.DeviceProfileTemplateListItem} + */ +proto.api.DeviceProfileTemplateListItem.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.DeviceProfileTemplateListItem; + return proto.api.DeviceProfileTemplateListItem.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.DeviceProfileTemplateListItem} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.DeviceProfileTemplateListItem} + */ +proto.api.DeviceProfileTemplateListItem.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.setId(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setCreatedAt(value); + break; + case 3: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setUpdatedAt(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setVendor(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setFirmware(value); + break; + case 7: + var value = /** @type {!proto.common.Region} */ (reader.readEnum()); + msg.setRegion(value); + break; + case 8: + var value = /** @type {!proto.common.MacVersion} */ (reader.readEnum()); + msg.setMacVersion(value); + break; + case 9: + var value = /** @type {!proto.common.RegParamsRevision} */ (reader.readEnum()); + msg.setRegParamsRevision(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsOtaa(value); + break; + case 11: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassB(value); + break; + case 12: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassC(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.DeviceProfileTemplateListItem.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.DeviceProfileTemplateListItem.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.DeviceProfileTemplateListItem} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.DeviceProfileTemplateListItem.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getCreatedAt(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getUpdatedAt(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getVendor(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getFirmware(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = message.getRegion(); + if (f !== 0.0) { + writer.writeEnum( + 7, + f + ); + } + f = message.getMacVersion(); + if (f !== 0.0) { + writer.writeEnum( + 8, + f + ); + } + f = message.getRegParamsRevision(); + if (f !== 0.0) { + writer.writeEnum( + 9, + f + ); + } + f = message.getSupportsOtaa(); + if (f) { + writer.writeBool( + 10, + f + ); + } + f = message.getSupportsClassB(); + if (f) { + writer.writeBool( + 11, + f + ); + } + f = message.getSupportsClassC(); + if (f) { + writer.writeBool( + 12, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional google.protobuf.Timestamp created_at = 2; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getCreatedAt = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this +*/ +proto.api.DeviceProfileTemplateListItem.prototype.setCreatedAt = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.clearCreatedAt = function() { + return this.setCreatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.hasCreatedAt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.Timestamp updated_at = 3; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getUpdatedAt = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this +*/ +proto.api.DeviceProfileTemplateListItem.prototype.setUpdatedAt = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.clearUpdatedAt = function() { + return this.setUpdatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.hasUpdatedAt = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string name = 4; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string vendor = 5; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getVendor = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setVendor = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional string firmware = 6; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getFirmware = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setFirmware = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + +/** + * optional common.Region region = 7; + * @return {!proto.common.Region} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getRegion = function() { + return /** @type {!proto.common.Region} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); +}; + + +/** + * @param {!proto.common.Region} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setRegion = function(value) { + return jspb.Message.setProto3EnumField(this, 7, value); +}; + + +/** + * optional common.MacVersion mac_version = 8; + * @return {!proto.common.MacVersion} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getMacVersion = function() { + return /** @type {!proto.common.MacVersion} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); +}; + + +/** + * @param {!proto.common.MacVersion} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setMacVersion = function(value) { + return jspb.Message.setProto3EnumField(this, 8, value); +}; + + +/** + * optional common.RegParamsRevision reg_params_revision = 9; + * @return {!proto.common.RegParamsRevision} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getRegParamsRevision = function() { + return /** @type {!proto.common.RegParamsRevision} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); +}; + + +/** + * @param {!proto.common.RegParamsRevision} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setRegParamsRevision = function(value) { + return jspb.Message.setProto3EnumField(this, 9, value); +}; + + +/** + * optional bool supports_otaa = 10; + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getSupportsOtaa = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 10, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setSupportsOtaa = function(value) { + return jspb.Message.setProto3BooleanField(this, 10, value); +}; + + +/** + * optional bool supports_class_b = 11; + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getSupportsClassB = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 11, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setSupportsClassB = function(value) { + return jspb.Message.setProto3BooleanField(this, 11, value); +}; + + +/** + * optional bool supports_class_c = 12; + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getSupportsClassC = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 12, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.api.DeviceProfileTemplateListItem} returns this + */ +proto.api.DeviceProfileTemplateListItem.prototype.setSupportsClassC = function(value) { + return jspb.Message.setProto3BooleanField(this, 12, value); +}; + + + + + +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_, 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.CreateDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.CreateDeviceProfileTemplateRequest.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.CreateDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.CreateDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + deviceProfileTemplate: (f = msg.getDeviceProfileTemplate()) && proto.api.DeviceProfileTemplate.toObject(includeInstance, 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.api.CreateDeviceProfileTemplateRequest} + */ +proto.api.CreateDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.CreateDeviceProfileTemplateRequest; + return proto.api.CreateDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.CreateDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.CreateDeviceProfileTemplateRequest} + */ +proto.api.CreateDeviceProfileTemplateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.api.DeviceProfileTemplate; + reader.readMessage(value,proto.api.DeviceProfileTemplate.deserializeBinaryFromReader); + msg.setDeviceProfileTemplate(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.CreateDeviceProfileTemplateRequest.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.CreateDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.CreateDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeviceProfileTemplate(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.api.DeviceProfileTemplate.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DeviceProfileTemplate device_profile_template = 1; + * @return {?proto.api.DeviceProfileTemplate} + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.getDeviceProfileTemplate = function() { + return /** @type{?proto.api.DeviceProfileTemplate} */ ( + jspb.Message.getWrapperField(this, proto.api.DeviceProfileTemplate, 1)); +}; + + +/** + * @param {?proto.api.DeviceProfileTemplate|undefined} value + * @return {!proto.api.CreateDeviceProfileTemplateRequest} returns this +*/ +proto.api.CreateDeviceProfileTemplateRequest.prototype.setDeviceProfileTemplate = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.CreateDeviceProfileTemplateRequest} returns this + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.clearDeviceProfileTemplate = function() { + return this.setDeviceProfileTemplate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.hasDeviceProfileTemplate = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +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_, 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.GetDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.GetDeviceProfileTemplateRequest.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.GetDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.GetDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + 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.GetDeviceProfileTemplateRequest} + */ +proto.api.GetDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.GetDeviceProfileTemplateRequest; + return proto.api.GetDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.GetDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.GetDeviceProfileTemplateRequest} + */ +proto.api.GetDeviceProfileTemplateRequest.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.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.GetDeviceProfileTemplateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.GetDeviceProfileTemplateRequest.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.GetDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.GetDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.GetDeviceProfileTemplateRequest.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.GetDeviceProfileTemplateRequest} returns this + */ +proto.api.GetDeviceProfileTemplateRequest.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +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_, 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.GetDeviceProfileTemplateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.api.GetDeviceProfileTemplateResponse.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.GetDeviceProfileTemplateResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.GetDeviceProfileTemplateResponse.toObject = function(includeInstance, msg) { + var f, obj = { + deviceProfileTemplate: (f = msg.getDeviceProfileTemplate()) && proto.api.DeviceProfileTemplate.toObject(includeInstance, f), + createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + updatedAt: (f = msg.getUpdatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, 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.api.GetDeviceProfileTemplateResponse} + */ +proto.api.GetDeviceProfileTemplateResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.GetDeviceProfileTemplateResponse; + return proto.api.GetDeviceProfileTemplateResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.GetDeviceProfileTemplateResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.GetDeviceProfileTemplateResponse} + */ +proto.api.GetDeviceProfileTemplateResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.api.DeviceProfileTemplate; + reader.readMessage(value,proto.api.DeviceProfileTemplate.deserializeBinaryFromReader); + msg.setDeviceProfileTemplate(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setCreatedAt(value); + break; + case 3: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setUpdatedAt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.GetDeviceProfileTemplateResponse.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.GetDeviceProfileTemplateResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.GetDeviceProfileTemplateResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeviceProfileTemplate(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.api.DeviceProfileTemplate.serializeBinaryToWriter + ); + } + f = message.getCreatedAt(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = message.getUpdatedAt(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DeviceProfileTemplate device_profile_template = 1; + * @return {?proto.api.DeviceProfileTemplate} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.getDeviceProfileTemplate = function() { + return /** @type{?proto.api.DeviceProfileTemplate} */ ( + jspb.Message.getWrapperField(this, proto.api.DeviceProfileTemplate, 1)); +}; + + +/** + * @param {?proto.api.DeviceProfileTemplate|undefined} value + * @return {!proto.api.GetDeviceProfileTemplateResponse} returns this +*/ +proto.api.GetDeviceProfileTemplateResponse.prototype.setDeviceProfileTemplate = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.GetDeviceProfileTemplateResponse} returns this + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.clearDeviceProfileTemplate = function() { + return this.setDeviceProfileTemplate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.hasDeviceProfileTemplate = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional google.protobuf.Timestamp created_at = 2; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.getCreatedAt = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 2)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.api.GetDeviceProfileTemplateResponse} returns this +*/ +proto.api.GetDeviceProfileTemplateResponse.prototype.setCreatedAt = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.GetDeviceProfileTemplateResponse} returns this + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.clearCreatedAt = function() { + return this.setCreatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.hasCreatedAt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.Timestamp updated_at = 3; + * @return {?proto.google.protobuf.Timestamp} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.getUpdatedAt = function() { + return /** @type{?proto.google.protobuf.Timestamp} */ ( + jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 3)); +}; + + +/** + * @param {?proto.google.protobuf.Timestamp|undefined} value + * @return {!proto.api.GetDeviceProfileTemplateResponse} returns this +*/ +proto.api.GetDeviceProfileTemplateResponse.prototype.setUpdatedAt = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.GetDeviceProfileTemplateResponse} returns this + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.clearUpdatedAt = function() { + return this.setUpdatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.hasUpdatedAt = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +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_, 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.UpdateDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.UpdateDeviceProfileTemplateRequest.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.UpdateDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.UpdateDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + deviceProfileTemplate: (f = msg.getDeviceProfileTemplate()) && proto.api.DeviceProfileTemplate.toObject(includeInstance, 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.api.UpdateDeviceProfileTemplateRequest} + */ +proto.api.UpdateDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.UpdateDeviceProfileTemplateRequest; + return proto.api.UpdateDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.UpdateDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.UpdateDeviceProfileTemplateRequest} + */ +proto.api.UpdateDeviceProfileTemplateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.api.DeviceProfileTemplate; + reader.readMessage(value,proto.api.DeviceProfileTemplate.deserializeBinaryFromReader); + msg.setDeviceProfileTemplate(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.UpdateDeviceProfileTemplateRequest.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.UpdateDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.UpdateDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeviceProfileTemplate(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.api.DeviceProfileTemplate.serializeBinaryToWriter + ); + } +}; + + +/** + * optional DeviceProfileTemplate device_profile_template = 1; + * @return {?proto.api.DeviceProfileTemplate} + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.getDeviceProfileTemplate = function() { + return /** @type{?proto.api.DeviceProfileTemplate} */ ( + jspb.Message.getWrapperField(this, proto.api.DeviceProfileTemplate, 1)); +}; + + +/** + * @param {?proto.api.DeviceProfileTemplate|undefined} value + * @return {!proto.api.UpdateDeviceProfileTemplateRequest} returns this +*/ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.setDeviceProfileTemplate = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.api.UpdateDeviceProfileTemplateRequest} returns this + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.clearDeviceProfileTemplate = function() { + return this.setDeviceProfileTemplate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.hasDeviceProfileTemplate = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +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_, 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.DeleteDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.DeleteDeviceProfileTemplateRequest.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.DeleteDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.DeleteDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + 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.DeleteDeviceProfileTemplateRequest} + */ +proto.api.DeleteDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.DeleteDeviceProfileTemplateRequest; + return proto.api.DeleteDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.DeleteDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.DeleteDeviceProfileTemplateRequest} + */ +proto.api.DeleteDeviceProfileTemplateRequest.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.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.DeleteDeviceProfileTemplateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.DeleteDeviceProfileTemplateRequest.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.DeleteDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.DeleteDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.DeleteDeviceProfileTemplateRequest.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.api.DeleteDeviceProfileTemplateRequest} returns this + */ +proto.api.DeleteDeviceProfileTemplateRequest.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + + + + +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_, 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.ListDeviceProfileTemplatesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.ListDeviceProfileTemplatesRequest.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.ListDeviceProfileTemplatesRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.ListDeviceProfileTemplatesRequest.toObject = function(includeInstance, msg) { + var f, obj = { + limit: jspb.Message.getFieldWithDefault(msg, 1, 0), + offset: jspb.Message.getFieldWithDefault(msg, 2, 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.ListDeviceProfileTemplatesRequest} + */ +proto.api.ListDeviceProfileTemplatesRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.ListDeviceProfileTemplatesRequest; + return proto.api.ListDeviceProfileTemplatesRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.ListDeviceProfileTemplatesRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.ListDeviceProfileTemplatesRequest} + */ +proto.api.ListDeviceProfileTemplatesRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLimit(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOffset(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.ListDeviceProfileTemplatesRequest.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.ListDeviceProfileTemplatesRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.ListDeviceProfileTemplatesRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getLimit(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getOffset(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } +}; + + +/** + * optional uint32 limit = 1; + * @return {number} + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.getLimit = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.ListDeviceProfileTemplatesRequest} returns this + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.setLimit = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional uint32 offset = 2; + * @return {number} + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.getOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.ListDeviceProfileTemplatesRequest} returns this + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.setOffset = function(value) { + return jspb.Message.setProto3IntField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.api.ListDeviceProfileTemplatesResponse.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_, 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.ListDeviceProfileTemplatesResponse.prototype.toObject = function(opt_includeInstance) { + return proto.api.ListDeviceProfileTemplatesResponse.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.ListDeviceProfileTemplatesResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.ListDeviceProfileTemplatesResponse.toObject = function(includeInstance, msg) { + var f, obj = { + totalCount: jspb.Message.getFieldWithDefault(msg, 1, 0), + resultList: jspb.Message.toObjectList(msg.getResultList(), + proto.api.DeviceProfileTemplateListItem.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.ListDeviceProfileTemplatesResponse} + */ +proto.api.ListDeviceProfileTemplatesResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.ListDeviceProfileTemplatesResponse; + return proto.api.ListDeviceProfileTemplatesResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.ListDeviceProfileTemplatesResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.ListDeviceProfileTemplatesResponse} + */ +proto.api.ListDeviceProfileTemplatesResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTotalCount(value); + break; + case 2: + var value = new proto.api.DeviceProfileTemplateListItem; + reader.readMessage(value,proto.api.DeviceProfileTemplateListItem.deserializeBinaryFromReader); + msg.addResult(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.api.ListDeviceProfileTemplatesResponse.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.ListDeviceProfileTemplatesResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.api.ListDeviceProfileTemplatesResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getTotalCount(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = message.getResultList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.api.DeviceProfileTemplateListItem.serializeBinaryToWriter + ); + } +}; + + +/** + * optional uint32 total_count = 1; + * @return {number} + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.getTotalCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.api.ListDeviceProfileTemplatesResponse} returns this + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.setTotalCount = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * repeated DeviceProfileTemplateListItem result = 2; + * @return {!Array} + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.getResultList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.api.DeviceProfileTemplateListItem, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.api.ListDeviceProfileTemplatesResponse} returns this +*/ +proto.api.ListDeviceProfileTemplatesResponse.prototype.setResultList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.api.DeviceProfileTemplateListItem=} opt_value + * @param {number=} opt_index + * @return {!proto.api.DeviceProfileTemplateListItem} + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.addResult = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.api.DeviceProfileTemplateListItem, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.api.ListDeviceProfileTemplatesResponse} returns this + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.clearResultList = function() { + return this.setResultList([]); +}; + + +goog.object.extend(exports, proto.api); diff --git a/api/js/Makefile b/api/js/Makefile index 8ac93c6b..da712489 100644 --- a/api/js/Makefile +++ b/api/js/Makefile @@ -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 diff --git a/api/js/api/device_profile_pb.d.ts b/api/js/api/device_profile_pb.d.ts index 3a30e5f0..247d5ca5 100644 --- a/api/js/api/device_profile_pb.d.ts +++ b/api/js/api/device_profile_pb.d.ts @@ -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; @@ -96,6 +99,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], diff --git a/api/js/api/device_profile_pb.js b/api/js/api/device_profile_pb.js index 869caa9b..a3adb2a4 100644 --- a/api/js/api/device_profile_pb.js +++ b/api/js/api/device_profile_pb.js @@ -74,6 +74,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(), @@ -144,6 +145,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); @@ -293,6 +298,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( @@ -501,6 +513,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} diff --git a/api/js/api/device_profile_template_grpc_pb.d.ts b/api/js/api/device_profile_template_grpc_pb.d.ts new file mode 100644 index 00000000..105781a4 --- /dev/null +++ b/api/js/api/device_profile_template_grpc_pb.d.ts @@ -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 { + create: grpc.MethodDefinition; + get: grpc.MethodDefinition; + update: grpc.MethodDefinition; + delete: grpc.MethodDefinition; + list: grpc.MethodDefinition; +} + +export const DeviceProfileTemplateServiceService: IDeviceProfileTemplateServiceService; + +export interface IDeviceProfileTemplateServiceServer extends grpc.UntypedServiceImplementation { + create: grpc.handleUnaryCall; + get: grpc.handleUnaryCall; + update: grpc.handleUnaryCall; + delete: grpc.handleUnaryCall; + list: grpc.handleUnaryCall; +} + +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): grpc.ClientUnaryCall; + create(argument: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + create(argument: api_device_profile_template_pb.CreateDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + get(argument: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + get(argument: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + get(argument: api_device_profile_template_pb.GetDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + update(argument: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + update(argument: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + update(argument: api_device_profile_template_pb.UpdateDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + delete(argument: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + delete(argument: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + delete(argument: api_device_profile_template_pb.DeleteDeviceProfileTemplateRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + list(argument: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, callback: grpc.requestCallback): grpc.ClientUnaryCall; + list(argument: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; + list(argument: api_device_profile_template_pb.ListDeviceProfileTemplatesRequest, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback): grpc.ClientUnaryCall; +} diff --git a/api/js/api/device_profile_template_grpc_pb.js b/api/js/api/device_profile_template_grpc_pb.js new file mode 100644 index 00000000..13346f5e --- /dev/null +++ b/api/js/api/device_profile_template_grpc_pb.js @@ -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); diff --git a/api/js/api/device_profile_template_pb.d.ts b/api/js/api/device_profile_template_pb.d.ts new file mode 100644 index 00000000..7fe4a9db --- /dev/null +++ b/api/js/api/device_profile_template_pb.d.ts @@ -0,0 +1,368 @@ +// 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; + clearTagsMap(): void; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeviceProfileTemplate.AsObject; + static toObject(includeInstance: boolean, msg: DeviceProfileTemplate): DeviceProfileTemplate.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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]>, + } +} + +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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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; + setResultList(value: Array): 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}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + 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, + } +} + diff --git a/api/js/api/device_profile_template_pb.js b/api/js/api/device_profile_template_pb.js new file mode 100644 index 00000000..aba1f1d8 --- /dev/null +++ b/api/js/api/device_profile_template_pb.js @@ -0,0 +1,2712 @@ +/** + * @fileoverview + * @enhanceable + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +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'); +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'); +goog.exportSymbol('proto.api.CreateDeviceProfileTemplateRequest', null, global); +goog.exportSymbol('proto.api.DeleteDeviceProfileTemplateRequest', null, global); +goog.exportSymbol('proto.api.DeviceProfileTemplate', null, global); +goog.exportSymbol('proto.api.DeviceProfileTemplateListItem', null, global); +goog.exportSymbol('proto.api.GetDeviceProfileTemplateRequest', null, global); +goog.exportSymbol('proto.api.GetDeviceProfileTemplateResponse', null, global); +goog.exportSymbol('proto.api.ListDeviceProfileTemplatesRequest', null, global); +goog.exportSymbol('proto.api.ListDeviceProfileTemplatesResponse', null, global); +goog.exportSymbol('proto.api.UpdateDeviceProfileTemplateRequest', null, global); + +/** + * 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.DeviceProfileTemplate = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.DeviceProfileTemplate, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.DeviceProfileTemplate.displayName = 'proto.api.DeviceProfileTemplate'; +} + + +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_, 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.DeviceProfileTemplate.prototype.toObject = function(opt_includeInstance) { + return proto.api.DeviceProfileTemplate.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.DeviceProfileTemplate} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.DeviceProfileTemplate.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + name: msg.getName(), + description: msg.getDescription(), + vendor: msg.getVendor(), + firmware: msg.getFirmware(), + region: msg.getRegion(), + macVersion: msg.getMacVersion(), + regParamsRevision: msg.getRegParamsRevision(), + adrAlgorithmId: msg.getAdrAlgorithmId(), + payloadCodecRuntime: msg.getPayloadCodecRuntime(), + payloadCodecScript: msg.getPayloadCodecScript(), + flushQueueOnActivate: msg.getFlushQueueOnActivate(), + uplinkInterval: msg.getUplinkInterval(), + deviceStatusReqInterval: msg.getDeviceStatusReqInterval(), + supportsOtaa: msg.getSupportsOtaa(), + supportsClassB: msg.getSupportsClassB(), + supportsClassC: msg.getSupportsClassC(), + classBTimeout: msg.getClassBTimeout(), + classBPingSlotPeriod: msg.getClassBPingSlotPeriod(), + classBPingSlotDr: msg.getClassBPingSlotDr(), + classBPingSlotFreq: msg.getClassBPingSlotFreq(), + classCTimeout: msg.getClassCTimeout(), + abpRx1Delay: msg.getAbpRx1Delay(), + abpRx1DrOffset: msg.getAbpRx1DrOffset(), + abpRx2Dr: msg.getAbpRx2Dr(), + abpRx2Freq: msg.getAbpRx2Freq(), + tagsMap: (f = msg.getTagsMap(true)) ? f.toArray() : [] + }; + + 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.DeviceProfileTemplate} + */ +proto.api.DeviceProfileTemplate.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.DeviceProfileTemplate; + return proto.api.DeviceProfileTemplate.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.DeviceProfileTemplate} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.DeviceProfileTemplate} + */ +proto.api.DeviceProfileTemplate.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.setId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setDescription(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVendor(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setFirmware(value); + break; + case 6: + var value = /** @type {!proto.common.Region} */ (reader.readEnum()); + msg.setRegion(value); + break; + case 7: + var value = /** @type {!proto.common.MacVersion} */ (reader.readEnum()); + msg.setMacVersion(value); + break; + case 8: + var value = /** @type {!proto.common.RegParamsRevision} */ (reader.readEnum()); + msg.setRegParamsRevision(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.setAdrAlgorithmId(value); + break; + case 10: + var value = /** @type {!proto.api.CodecRuntime} */ (reader.readEnum()); + msg.setPayloadCodecRuntime(value); + break; + case 11: + var value = /** @type {string} */ (reader.readString()); + msg.setPayloadCodecScript(value); + break; + case 12: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setFlushQueueOnActivate(value); + break; + case 13: + var value = /** @type {number} */ (reader.readUint32()); + msg.setUplinkInterval(value); + break; + case 14: + var value = /** @type {number} */ (reader.readUint32()); + msg.setDeviceStatusReqInterval(value); + break; + case 15: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsOtaa(value); + break; + case 16: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassB(value); + break; + case 17: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassC(value); + break; + case 18: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBTimeout(value); + break; + case 19: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBPingSlotPeriod(value); + break; + case 20: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBPingSlotDr(value); + break; + case 21: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassBPingSlotFreq(value); + break; + case 22: + var value = /** @type {number} */ (reader.readUint32()); + msg.setClassCTimeout(value); + break; + case 23: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx1Delay(value); + break; + case 24: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx1DrOffset(value); + break; + case 25: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx2Dr(value); + break; + case 26: + var value = /** @type {number} */ (reader.readUint32()); + msg.setAbpRx2Freq(value); + break; + case 27: + var value = msg.getTagsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString); + }); + 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.DeviceProfileTemplate} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.DeviceProfileTemplate.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.DeviceProfileTemplate.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.DeviceProfileTemplate.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = this.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = this.getDescription(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = this.getVendor(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = this.getFirmware(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = this.getRegion(); + if (f !== 0.0) { + writer.writeEnum( + 6, + f + ); + } + f = this.getMacVersion(); + if (f !== 0.0) { + writer.writeEnum( + 7, + f + ); + } + f = this.getRegParamsRevision(); + if (f !== 0.0) { + writer.writeEnum( + 8, + f + ); + } + f = this.getAdrAlgorithmId(); + if (f.length > 0) { + writer.writeString( + 9, + f + ); + } + f = this.getPayloadCodecRuntime(); + if (f !== 0.0) { + writer.writeEnum( + 10, + f + ); + } + f = this.getPayloadCodecScript(); + if (f.length > 0) { + writer.writeString( + 11, + f + ); + } + f = this.getFlushQueueOnActivate(); + if (f) { + writer.writeBool( + 12, + f + ); + } + f = this.getUplinkInterval(); + if (f !== 0) { + writer.writeUint32( + 13, + f + ); + } + f = this.getDeviceStatusReqInterval(); + if (f !== 0) { + writer.writeUint32( + 14, + f + ); + } + f = this.getSupportsOtaa(); + if (f) { + writer.writeBool( + 15, + f + ); + } + f = this.getSupportsClassB(); + if (f) { + writer.writeBool( + 16, + f + ); + } + f = this.getSupportsClassC(); + if (f) { + writer.writeBool( + 17, + f + ); + } + f = this.getClassBTimeout(); + if (f !== 0) { + writer.writeUint32( + 18, + f + ); + } + f = this.getClassBPingSlotPeriod(); + if (f !== 0) { + writer.writeUint32( + 19, + f + ); + } + f = this.getClassBPingSlotDr(); + if (f !== 0) { + writer.writeUint32( + 20, + f + ); + } + f = this.getClassBPingSlotFreq(); + if (f !== 0) { + writer.writeUint32( + 21, + f + ); + } + f = this.getClassCTimeout(); + if (f !== 0) { + writer.writeUint32( + 22, + f + ); + } + f = this.getAbpRx1Delay(); + if (f !== 0) { + writer.writeUint32( + 23, + f + ); + } + f = this.getAbpRx1DrOffset(); + if (f !== 0) { + writer.writeUint32( + 24, + f + ); + } + f = this.getAbpRx2Dr(); + if (f !== 0) { + writer.writeUint32( + 25, + f + ); + } + f = this.getAbpRx2Freq(); + if (f !== 0) { + writer.writeUint32( + 26, + f + ); + } + f = this.getTagsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(27, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.DeviceProfileTemplate} The clone. + */ +proto.api.DeviceProfileTemplate.prototype.cloneMessage = function() { + return /** @type {!proto.api.DeviceProfileTemplate} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional string name = 2; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 2, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setName = function(value) { + jspb.Message.setField(this, 2, value); +}; + + +/** + * optional string description = 3; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getDescription = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 3, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setDescription = function(value) { + jspb.Message.setField(this, 3, value); +}; + + +/** + * optional string vendor = 4; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getVendor = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 4, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setVendor = function(value) { + jspb.Message.setField(this, 4, value); +}; + + +/** + * optional string firmware = 5; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getFirmware = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 5, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setFirmware = function(value) { + jspb.Message.setField(this, 5, value); +}; + + +/** + * optional common.Region region = 6; + * @return {!proto.common.Region} + */ +proto.api.DeviceProfileTemplate.prototype.getRegion = function() { + return /** @type {!proto.common.Region} */ (jspb.Message.getFieldProto3(this, 6, 0)); +}; + + +/** @param {!proto.common.Region} value */ +proto.api.DeviceProfileTemplate.prototype.setRegion = function(value) { + jspb.Message.setField(this, 6, value); +}; + + +/** + * optional common.MacVersion mac_version = 7; + * @return {!proto.common.MacVersion} + */ +proto.api.DeviceProfileTemplate.prototype.getMacVersion = function() { + return /** @type {!proto.common.MacVersion} */ (jspb.Message.getFieldProto3(this, 7, 0)); +}; + + +/** @param {!proto.common.MacVersion} value */ +proto.api.DeviceProfileTemplate.prototype.setMacVersion = function(value) { + jspb.Message.setField(this, 7, value); +}; + + +/** + * optional common.RegParamsRevision reg_params_revision = 8; + * @return {!proto.common.RegParamsRevision} + */ +proto.api.DeviceProfileTemplate.prototype.getRegParamsRevision = function() { + return /** @type {!proto.common.RegParamsRevision} */ (jspb.Message.getFieldProto3(this, 8, 0)); +}; + + +/** @param {!proto.common.RegParamsRevision} value */ +proto.api.DeviceProfileTemplate.prototype.setRegParamsRevision = function(value) { + jspb.Message.setField(this, 8, value); +}; + + +/** + * optional string adr_algorithm_id = 9; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getAdrAlgorithmId = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 9, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setAdrAlgorithmId = function(value) { + jspb.Message.setField(this, 9, value); +}; + + +/** + * optional CodecRuntime payload_codec_runtime = 10; + * @return {!proto.api.CodecRuntime} + */ +proto.api.DeviceProfileTemplate.prototype.getPayloadCodecRuntime = function() { + return /** @type {!proto.api.CodecRuntime} */ (jspb.Message.getFieldProto3(this, 10, 0)); +}; + + +/** @param {!proto.api.CodecRuntime} value */ +proto.api.DeviceProfileTemplate.prototype.setPayloadCodecRuntime = function(value) { + jspb.Message.setField(this, 10, value); +}; + + +/** + * optional string payload_codec_script = 11; + * @return {string} + */ +proto.api.DeviceProfileTemplate.prototype.getPayloadCodecScript = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 11, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplate.prototype.setPayloadCodecScript = function(value) { + jspb.Message.setField(this, 11, value); +}; + + +/** + * optional bool flush_queue_on_activate = 12; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getFlushQueueOnActivate = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 12, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplate.prototype.setFlushQueueOnActivate = function(value) { + jspb.Message.setField(this, 12, value); +}; + + +/** + * optional uint32 uplink_interval = 13; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getUplinkInterval = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 13, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setUplinkInterval = function(value) { + jspb.Message.setField(this, 13, value); +}; + + +/** + * optional uint32 device_status_req_interval = 14; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getDeviceStatusReqInterval = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 14, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setDeviceStatusReqInterval = function(value) { + jspb.Message.setField(this, 14, value); +}; + + +/** + * optional bool supports_otaa = 15; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getSupportsOtaa = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 15, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplate.prototype.setSupportsOtaa = function(value) { + jspb.Message.setField(this, 15, value); +}; + + +/** + * optional bool supports_class_b = 16; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getSupportsClassB = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 16, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplate.prototype.setSupportsClassB = function(value) { + jspb.Message.setField(this, 16, value); +}; + + +/** + * optional bool supports_class_c = 17; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplate.prototype.getSupportsClassC = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 17, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplate.prototype.setSupportsClassC = function(value) { + jspb.Message.setField(this, 17, value); +}; + + +/** + * optional uint32 class_b_timeout = 18; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBTimeout = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 18, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setClassBTimeout = function(value) { + jspb.Message.setField(this, 18, value); +}; + + +/** + * optional uint32 class_b_ping_slot_period = 19; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBPingSlotPeriod = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 19, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setClassBPingSlotPeriod = function(value) { + jspb.Message.setField(this, 19, value); +}; + + +/** + * optional uint32 class_b_ping_slot_dr = 20; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBPingSlotDr = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 20, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setClassBPingSlotDr = function(value) { + jspb.Message.setField(this, 20, value); +}; + + +/** + * optional uint32 class_b_ping_slot_freq = 21; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassBPingSlotFreq = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 21, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setClassBPingSlotFreq = function(value) { + jspb.Message.setField(this, 21, value); +}; + + +/** + * optional uint32 class_c_timeout = 22; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getClassCTimeout = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 22, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setClassCTimeout = function(value) { + jspb.Message.setField(this, 22, value); +}; + + +/** + * optional uint32 abp_rx1_delay = 23; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx1Delay = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 23, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx1Delay = function(value) { + jspb.Message.setField(this, 23, value); +}; + + +/** + * optional uint32 abp_rx1_dr_offset = 24; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx1DrOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 24, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx1DrOffset = function(value) { + jspb.Message.setField(this, 24, value); +}; + + +/** + * optional uint32 abp_rx2_dr = 25; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx2Dr = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 25, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx2Dr = function(value) { + jspb.Message.setField(this, 25, value); +}; + + +/** + * optional uint32 abp_rx2_freq = 26; + * @return {number} + */ +proto.api.DeviceProfileTemplate.prototype.getAbpRx2Freq = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 26, 0)); +}; + + +/** @param {number} value */ +proto.api.DeviceProfileTemplate.prototype.setAbpRx2Freq = function(value) { + jspb.Message.setField(this, 26, value); +}; + + +/** + * map tags = 27; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.api.DeviceProfileTemplate.prototype.getTagsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 27, opt_noLazyCreate, + 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 + */ +proto.api.DeviceProfileTemplateListItem = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.DeviceProfileTemplateListItem, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.DeviceProfileTemplateListItem.displayName = 'proto.api.DeviceProfileTemplateListItem'; +} + + +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_, 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.DeviceProfileTemplateListItem.prototype.toObject = function(opt_includeInstance) { + return proto.api.DeviceProfileTemplateListItem.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.DeviceProfileTemplateListItem} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.DeviceProfileTemplateListItem.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId(), + createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + updatedAt: (f = msg.getUpdatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + name: msg.getName(), + vendor: msg.getVendor(), + firmware: msg.getFirmware(), + region: msg.getRegion(), + macVersion: msg.getMacVersion(), + regParamsRevision: msg.getRegParamsRevision(), + supportsOtaa: msg.getSupportsOtaa(), + supportsClassB: msg.getSupportsClassB(), + supportsClassC: msg.getSupportsClassC() + }; + + 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.DeviceProfileTemplateListItem} + */ +proto.api.DeviceProfileTemplateListItem.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.DeviceProfileTemplateListItem; + return proto.api.DeviceProfileTemplateListItem.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.DeviceProfileTemplateListItem} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.DeviceProfileTemplateListItem} + */ +proto.api.DeviceProfileTemplateListItem.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.setId(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setCreatedAt(value); + break; + case 3: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setUpdatedAt(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setVendor(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setFirmware(value); + break; + case 7: + var value = /** @type {!proto.common.Region} */ (reader.readEnum()); + msg.setRegion(value); + break; + case 8: + var value = /** @type {!proto.common.MacVersion} */ (reader.readEnum()); + msg.setMacVersion(value); + break; + case 9: + var value = /** @type {!proto.common.RegParamsRevision} */ (reader.readEnum()); + msg.setRegParamsRevision(value); + break; + case 10: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsOtaa(value); + break; + case 11: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassB(value); + break; + case 12: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setSupportsClassC(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.DeviceProfileTemplateListItem} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.DeviceProfileTemplateListItem.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.DeviceProfileTemplateListItem.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.DeviceProfileTemplateListItem.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = this.getCreatedAt(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = this.getUpdatedAt(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = this.getName(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = this.getVendor(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = this.getFirmware(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } + f = this.getRegion(); + if (f !== 0.0) { + writer.writeEnum( + 7, + f + ); + } + f = this.getMacVersion(); + if (f !== 0.0) { + writer.writeEnum( + 8, + f + ); + } + f = this.getRegParamsRevision(); + if (f !== 0.0) { + writer.writeEnum( + 9, + f + ); + } + f = this.getSupportsOtaa(); + if (f) { + writer.writeBool( + 10, + f + ); + } + f = this.getSupportsClassB(); + if (f) { + writer.writeBool( + 11, + f + ); + } + f = this.getSupportsClassC(); + if (f) { + writer.writeBool( + 12, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.DeviceProfileTemplateListItem} The clone. + */ +proto.api.DeviceProfileTemplateListItem.prototype.cloneMessage = function() { + return /** @type {!proto.api.DeviceProfileTemplateListItem} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setId = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional google.protobuf.Timestamp created_at = 2; + * @return {proto.google.protobuf.Timestamp} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getCreatedAt = 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.DeviceProfileTemplateListItem.prototype.setCreatedAt = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +proto.api.DeviceProfileTemplateListItem.prototype.clearCreatedAt = function() { + this.setCreatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.hasCreatedAt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.Timestamp updated_at = 3; + * @return {proto.google.protobuf.Timestamp} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getUpdatedAt = 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.DeviceProfileTemplateListItem.prototype.setUpdatedAt = function(value) { + jspb.Message.setWrapperField(this, 3, value); +}; + + +proto.api.DeviceProfileTemplateListItem.prototype.clearUpdatedAt = function() { + this.setUpdatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.hasUpdatedAt = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string name = 4; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 4, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setName = function(value) { + jspb.Message.setField(this, 4, value); +}; + + +/** + * optional string vendor = 5; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getVendor = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 5, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setVendor = function(value) { + jspb.Message.setField(this, 5, value); +}; + + +/** + * optional string firmware = 6; + * @return {string} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getFirmware = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 6, "")); +}; + + +/** @param {string} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setFirmware = function(value) { + jspb.Message.setField(this, 6, value); +}; + + +/** + * optional common.Region region = 7; + * @return {!proto.common.Region} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getRegion = function() { + return /** @type {!proto.common.Region} */ (jspb.Message.getFieldProto3(this, 7, 0)); +}; + + +/** @param {!proto.common.Region} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setRegion = function(value) { + jspb.Message.setField(this, 7, value); +}; + + +/** + * optional common.MacVersion mac_version = 8; + * @return {!proto.common.MacVersion} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getMacVersion = function() { + return /** @type {!proto.common.MacVersion} */ (jspb.Message.getFieldProto3(this, 8, 0)); +}; + + +/** @param {!proto.common.MacVersion} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setMacVersion = function(value) { + jspb.Message.setField(this, 8, value); +}; + + +/** + * optional common.RegParamsRevision reg_params_revision = 9; + * @return {!proto.common.RegParamsRevision} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getRegParamsRevision = function() { + return /** @type {!proto.common.RegParamsRevision} */ (jspb.Message.getFieldProto3(this, 9, 0)); +}; + + +/** @param {!proto.common.RegParamsRevision} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setRegParamsRevision = function(value) { + jspb.Message.setField(this, 9, value); +}; + + +/** + * optional bool supports_otaa = 10; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getSupportsOtaa = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 10, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setSupportsOtaa = function(value) { + jspb.Message.setField(this, 10, value); +}; + + +/** + * optional bool supports_class_b = 11; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getSupportsClassB = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 11, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setSupportsClassB = function(value) { + jspb.Message.setField(this, 11, value); +}; + + +/** + * optional bool supports_class_c = 12; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.api.DeviceProfileTemplateListItem.prototype.getSupportsClassC = function() { + return /** @type {boolean} */ (jspb.Message.getFieldProto3(this, 12, false)); +}; + + +/** @param {boolean} value */ +proto.api.DeviceProfileTemplateListItem.prototype.setSupportsClassC = function(value) { + jspb.Message.setField(this, 12, 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.api.CreateDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.CreateDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.CreateDeviceProfileTemplateRequest.displayName = 'proto.api.CreateDeviceProfileTemplateRequest'; +} + + +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_, 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.CreateDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.CreateDeviceProfileTemplateRequest.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.CreateDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.CreateDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + deviceProfileTemplate: (f = msg.getDeviceProfileTemplate()) && proto.api.DeviceProfileTemplate.toObject(includeInstance, 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.api.CreateDeviceProfileTemplateRequest} + */ +proto.api.CreateDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.CreateDeviceProfileTemplateRequest; + return proto.api.CreateDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.CreateDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.CreateDeviceProfileTemplateRequest} + */ +proto.api.CreateDeviceProfileTemplateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.api.DeviceProfileTemplate; + reader.readMessage(value,proto.api.DeviceProfileTemplate.deserializeBinaryFromReader); + msg.setDeviceProfileTemplate(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.CreateDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.CreateDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.CreateDeviceProfileTemplateRequest.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.CreateDeviceProfileTemplateRequest.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getDeviceProfileTemplate(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.api.DeviceProfileTemplate.serializeBinaryToWriter + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.CreateDeviceProfileTemplateRequest} The clone. + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.cloneMessage = function() { + return /** @type {!proto.api.CreateDeviceProfileTemplateRequest} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional DeviceProfileTemplate device_profile_template = 1; + * @return {proto.api.DeviceProfileTemplate} + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.getDeviceProfileTemplate = function() { + return /** @type{proto.api.DeviceProfileTemplate} */ ( + jspb.Message.getWrapperField(this, proto.api.DeviceProfileTemplate, 1)); +}; + + +/** @param {proto.api.DeviceProfileTemplate|undefined} value */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.setDeviceProfileTemplate = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +proto.api.CreateDeviceProfileTemplateRequest.prototype.clearDeviceProfileTemplate = function() { + this.setDeviceProfileTemplate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.CreateDeviceProfileTemplateRequest.prototype.hasDeviceProfileTemplate = function() { + return jspb.Message.getField(this, 1) != 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 + */ +proto.api.GetDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.GetDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.GetDeviceProfileTemplateRequest.displayName = 'proto.api.GetDeviceProfileTemplateRequest'; +} + + +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_, 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.GetDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.GetDeviceProfileTemplateRequest.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.GetDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.GetDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId() + }; + + 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.GetDeviceProfileTemplateRequest} + */ +proto.api.GetDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.GetDeviceProfileTemplateRequest; + return proto.api.GetDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.GetDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.GetDeviceProfileTemplateRequest} + */ +proto.api.GetDeviceProfileTemplateRequest.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.setId(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.GetDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.GetDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.GetDeviceProfileTemplateRequest.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.GetDeviceProfileTemplateRequest.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.GetDeviceProfileTemplateRequest} The clone. + */ +proto.api.GetDeviceProfileTemplateRequest.prototype.cloneMessage = function() { + return /** @type {!proto.api.GetDeviceProfileTemplateRequest} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.GetDeviceProfileTemplateRequest.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); +}; + + +/** @param {string} value */ +proto.api.GetDeviceProfileTemplateRequest.prototype.setId = function(value) { + jspb.Message.setField(this, 1, 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.api.GetDeviceProfileTemplateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.GetDeviceProfileTemplateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.GetDeviceProfileTemplateResponse.displayName = 'proto.api.GetDeviceProfileTemplateResponse'; +} + + +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_, 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.GetDeviceProfileTemplateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.api.GetDeviceProfileTemplateResponse.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.GetDeviceProfileTemplateResponse} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.GetDeviceProfileTemplateResponse.toObject = function(includeInstance, msg) { + var f, obj = { + deviceProfileTemplate: (f = msg.getDeviceProfileTemplate()) && proto.api.DeviceProfileTemplate.toObject(includeInstance, f), + createdAt: (f = msg.getCreatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), + updatedAt: (f = msg.getUpdatedAt()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, 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.api.GetDeviceProfileTemplateResponse} + */ +proto.api.GetDeviceProfileTemplateResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.GetDeviceProfileTemplateResponse; + return proto.api.GetDeviceProfileTemplateResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.GetDeviceProfileTemplateResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.GetDeviceProfileTemplateResponse} + */ +proto.api.GetDeviceProfileTemplateResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.api.DeviceProfileTemplate; + reader.readMessage(value,proto.api.DeviceProfileTemplate.deserializeBinaryFromReader); + msg.setDeviceProfileTemplate(value); + break; + case 2: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setCreatedAt(value); + break; + case 3: + var value = new google_protobuf_timestamp_pb.Timestamp; + reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); + msg.setUpdatedAt(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.GetDeviceProfileTemplateResponse} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.GetDeviceProfileTemplateResponse.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.GetDeviceProfileTemplateResponse.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.GetDeviceProfileTemplateResponse.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getDeviceProfileTemplate(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.api.DeviceProfileTemplate.serializeBinaryToWriter + ); + } + f = this.getCreatedAt(); + if (f != null) { + writer.writeMessage( + 2, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } + f = this.getUpdatedAt(); + if (f != null) { + writer.writeMessage( + 3, + f, + google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.GetDeviceProfileTemplateResponse} The clone. + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.cloneMessage = function() { + return /** @type {!proto.api.GetDeviceProfileTemplateResponse} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional DeviceProfileTemplate device_profile_template = 1; + * @return {proto.api.DeviceProfileTemplate} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.getDeviceProfileTemplate = function() { + return /** @type{proto.api.DeviceProfileTemplate} */ ( + jspb.Message.getWrapperField(this, proto.api.DeviceProfileTemplate, 1)); +}; + + +/** @param {proto.api.DeviceProfileTemplate|undefined} value */ +proto.api.GetDeviceProfileTemplateResponse.prototype.setDeviceProfileTemplate = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +proto.api.GetDeviceProfileTemplateResponse.prototype.clearDeviceProfileTemplate = function() { + this.setDeviceProfileTemplate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.hasDeviceProfileTemplate = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional google.protobuf.Timestamp created_at = 2; + * @return {proto.google.protobuf.Timestamp} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.getCreatedAt = 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.GetDeviceProfileTemplateResponse.prototype.setCreatedAt = function(value) { + jspb.Message.setWrapperField(this, 2, value); +}; + + +proto.api.GetDeviceProfileTemplateResponse.prototype.clearCreatedAt = function() { + this.setCreatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.hasCreatedAt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional google.protobuf.Timestamp updated_at = 3; + * @return {proto.google.protobuf.Timestamp} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.getUpdatedAt = 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.GetDeviceProfileTemplateResponse.prototype.setUpdatedAt = function(value) { + jspb.Message.setWrapperField(this, 3, value); +}; + + +proto.api.GetDeviceProfileTemplateResponse.prototype.clearUpdatedAt = function() { + this.setUpdatedAt(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.GetDeviceProfileTemplateResponse.prototype.hasUpdatedAt = 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 + */ +proto.api.UpdateDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.UpdateDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.UpdateDeviceProfileTemplateRequest.displayName = 'proto.api.UpdateDeviceProfileTemplateRequest'; +} + + +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_, 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.UpdateDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.UpdateDeviceProfileTemplateRequest.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.UpdateDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.UpdateDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + deviceProfileTemplate: (f = msg.getDeviceProfileTemplate()) && proto.api.DeviceProfileTemplate.toObject(includeInstance, 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.api.UpdateDeviceProfileTemplateRequest} + */ +proto.api.UpdateDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.UpdateDeviceProfileTemplateRequest; + return proto.api.UpdateDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.UpdateDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.UpdateDeviceProfileTemplateRequest} + */ +proto.api.UpdateDeviceProfileTemplateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.api.DeviceProfileTemplate; + reader.readMessage(value,proto.api.DeviceProfileTemplate.deserializeBinaryFromReader); + msg.setDeviceProfileTemplate(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.UpdateDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.UpdateDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.UpdateDeviceProfileTemplateRequest.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.UpdateDeviceProfileTemplateRequest.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getDeviceProfileTemplate(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.api.DeviceProfileTemplate.serializeBinaryToWriter + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.UpdateDeviceProfileTemplateRequest} The clone. + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.cloneMessage = function() { + return /** @type {!proto.api.UpdateDeviceProfileTemplateRequest} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional DeviceProfileTemplate device_profile_template = 1; + * @return {proto.api.DeviceProfileTemplate} + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.getDeviceProfileTemplate = function() { + return /** @type{proto.api.DeviceProfileTemplate} */ ( + jspb.Message.getWrapperField(this, proto.api.DeviceProfileTemplate, 1)); +}; + + +/** @param {proto.api.DeviceProfileTemplate|undefined} value */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.setDeviceProfileTemplate = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +proto.api.UpdateDeviceProfileTemplateRequest.prototype.clearDeviceProfileTemplate = function() { + this.setDeviceProfileTemplate(undefined); +}; + + +/** + * Returns whether this field is set. + * @return{!boolean} + */ +proto.api.UpdateDeviceProfileTemplateRequest.prototype.hasDeviceProfileTemplate = function() { + return jspb.Message.getField(this, 1) != 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 + */ +proto.api.DeleteDeviceProfileTemplateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.DeleteDeviceProfileTemplateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.DeleteDeviceProfileTemplateRequest.displayName = 'proto.api.DeleteDeviceProfileTemplateRequest'; +} + + +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_, 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.DeleteDeviceProfileTemplateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.DeleteDeviceProfileTemplateRequest.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.DeleteDeviceProfileTemplateRequest} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.DeleteDeviceProfileTemplateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + id: msg.getId() + }; + + 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.DeleteDeviceProfileTemplateRequest} + */ +proto.api.DeleteDeviceProfileTemplateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.DeleteDeviceProfileTemplateRequest; + return proto.api.DeleteDeviceProfileTemplateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.DeleteDeviceProfileTemplateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.DeleteDeviceProfileTemplateRequest} + */ +proto.api.DeleteDeviceProfileTemplateRequest.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.setId(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.DeleteDeviceProfileTemplateRequest} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.DeleteDeviceProfileTemplateRequest.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.DeleteDeviceProfileTemplateRequest.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.DeleteDeviceProfileTemplateRequest.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.DeleteDeviceProfileTemplateRequest} The clone. + */ +proto.api.DeleteDeviceProfileTemplateRequest.prototype.cloneMessage = function() { + return /** @type {!proto.api.DeleteDeviceProfileTemplateRequest} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.api.DeleteDeviceProfileTemplateRequest.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); +}; + + +/** @param {string} value */ +proto.api.DeleteDeviceProfileTemplateRequest.prototype.setId = function(value) { + jspb.Message.setField(this, 1, 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.api.ListDeviceProfileTemplatesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.api.ListDeviceProfileTemplatesRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.ListDeviceProfileTemplatesRequest.displayName = 'proto.api.ListDeviceProfileTemplatesRequest'; +} + + +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_, 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.ListDeviceProfileTemplatesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.api.ListDeviceProfileTemplatesRequest.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.ListDeviceProfileTemplatesRequest} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.ListDeviceProfileTemplatesRequest.toObject = function(includeInstance, msg) { + var f, obj = { + limit: msg.getLimit(), + offset: msg.getOffset() + }; + + 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.ListDeviceProfileTemplatesRequest} + */ +proto.api.ListDeviceProfileTemplatesRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.ListDeviceProfileTemplatesRequest; + return proto.api.ListDeviceProfileTemplatesRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.ListDeviceProfileTemplatesRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.ListDeviceProfileTemplatesRequest} + */ +proto.api.ListDeviceProfileTemplatesRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setLimit(value); + break; + case 2: + var value = /** @type {number} */ (reader.readUint32()); + msg.setOffset(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.ListDeviceProfileTemplatesRequest} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.ListDeviceProfileTemplatesRequest.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.ListDeviceProfileTemplatesRequest.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.ListDeviceProfileTemplatesRequest.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getLimit(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = this.getOffset(); + if (f !== 0) { + writer.writeUint32( + 2, + f + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.ListDeviceProfileTemplatesRequest} The clone. + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.cloneMessage = function() { + return /** @type {!proto.api.ListDeviceProfileTemplatesRequest} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint32 limit = 1; + * @return {number} + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.getLimit = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.setLimit = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * optional uint32 offset = 2; + * @return {number} + */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.getOffset = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 2, 0)); +}; + + +/** @param {number} value */ +proto.api.ListDeviceProfileTemplatesRequest.prototype.setOffset = function(value) { + jspb.Message.setField(this, 2, 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.api.ListDeviceProfileTemplatesResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.api.ListDeviceProfileTemplatesResponse.repeatedFields_, null); +}; +goog.inherits(proto.api.ListDeviceProfileTemplatesResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.api.ListDeviceProfileTemplatesResponse.displayName = 'proto.api.ListDeviceProfileTemplatesResponse'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.api.ListDeviceProfileTemplatesResponse.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_, 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.ListDeviceProfileTemplatesResponse.prototype.toObject = function(opt_includeInstance) { + return proto.api.ListDeviceProfileTemplatesResponse.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.ListDeviceProfileTemplatesResponse} msg The msg instance to transform. + * @return {!Object} + */ +proto.api.ListDeviceProfileTemplatesResponse.toObject = function(includeInstance, msg) { + var f, obj = { + totalCount: msg.getTotalCount(), + resultList: jspb.Message.toObjectList(msg.getResultList(), + proto.api.DeviceProfileTemplateListItem.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.ListDeviceProfileTemplatesResponse} + */ +proto.api.ListDeviceProfileTemplatesResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.api.ListDeviceProfileTemplatesResponse; + return proto.api.ListDeviceProfileTemplatesResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.api.ListDeviceProfileTemplatesResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.api.ListDeviceProfileTemplatesResponse} + */ +proto.api.ListDeviceProfileTemplatesResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readUint32()); + msg.setTotalCount(value); + break; + case 2: + var value = new proto.api.DeviceProfileTemplateListItem; + reader.readMessage(value,proto.api.DeviceProfileTemplateListItem.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.ListDeviceProfileTemplatesResponse} message + * @param {!jspb.BinaryWriter} writer + */ +proto.api.ListDeviceProfileTemplatesResponse.serializeBinaryToWriter = function(message, writer) { + message.serializeBinaryToWriter(writer); +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.api.ListDeviceProfileTemplatesResponse.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.ListDeviceProfileTemplatesResponse.prototype.serializeBinaryToWriter = function (writer) { + var f = undefined; + f = this.getTotalCount(); + if (f !== 0) { + writer.writeUint32( + 1, + f + ); + } + f = this.getResultList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.api.DeviceProfileTemplateListItem.serializeBinaryToWriter + ); + } +}; + + +/** + * Creates a deep clone of this proto. No data is shared with the original. + * @return {!proto.api.ListDeviceProfileTemplatesResponse} The clone. + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.cloneMessage = function() { + return /** @type {!proto.api.ListDeviceProfileTemplatesResponse} */ (jspb.Message.cloneMessage(this)); +}; + + +/** + * optional uint32 total_count = 1; + * @return {number} + */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.getTotalCount = function() { + return /** @type {number} */ (jspb.Message.getFieldProto3(this, 1, 0)); +}; + + +/** @param {number} value */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.setTotalCount = function(value) { + jspb.Message.setField(this, 1, value); +}; + + +/** + * repeated DeviceProfileTemplateListItem result = 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.api.ListDeviceProfileTemplatesResponse.prototype.getResultList = function() { + return /** @type{!Array.} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.api.DeviceProfileTemplateListItem, 2)); +}; + + +/** @param {Array.} value */ +proto.api.ListDeviceProfileTemplatesResponse.prototype.setResultList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +proto.api.ListDeviceProfileTemplatesResponse.prototype.clearResultList = function() { + this.setResultList([]); +}; + + +goog.object.extend(exports, proto.api); diff --git a/api/proto/api/device_profile.proto b/api/proto/api/device_profile.proto index 5aaf1a19..4e778dcd 100644 --- a/api/proto/api/device_profile.proto +++ b/api/proto/api/device_profile.proto @@ -54,6 +54,9 @@ message DeviceProfile { // Name. string name = 3; + // Description. + string description = 26; + // Region. common.Region region = 4; diff --git a/api/proto/api/device_profile_template.proto b/api/proto/api/device_profile_template.proto new file mode 100644 index 00000000..d795fe61 --- /dev/null +++ b/api/proto/api/device_profile_template.proto @@ -0,0 +1,207 @@ +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 tags = 27; +} + +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; +} diff --git a/api/python/Makefile b/api/python/Makefile index 8bfe80ec..ad7695bc 100644 --- a/api/python/Makefile +++ b/api/python/Makefile @@ -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 diff --git a/api/rust/build.rs b/api/rust/build.rs index 6e1e39ba..18ad4458 100644 --- a/api/rust/build.rs +++ b/api/rust/build.rs @@ -136,6 +136,7 @@ fn main() -> Result<(), Box> { "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", diff --git a/api/rust/proto/chirpstack/api/device_profile.proto b/api/rust/proto/chirpstack/api/device_profile.proto index 5aaf1a19..4e778dcd 100644 --- a/api/rust/proto/chirpstack/api/device_profile.proto +++ b/api/rust/proto/chirpstack/api/device_profile.proto @@ -54,6 +54,9 @@ message DeviceProfile { // Name. string name = 3; + // Description. + string description = 26; + // Region. common.Region region = 4; diff --git a/api/rust/proto/chirpstack/api/device_profile_template.proto b/api/rust/proto/chirpstack/api/device_profile_template.proto new file mode 100644 index 00000000..d795fe61 --- /dev/null +++ b/api/rust/proto/chirpstack/api/device_profile_template.proto @@ -0,0 +1,207 @@ +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 tags = 27; +} + +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; +} diff --git a/chirpstack/Cargo.toml b/chirpstack/Cargo.toml index 447ca2ec..7272a413 100644 --- a/chirpstack/Cargo.toml +++ b/chirpstack/Cargo.toml @@ -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" @@ -89,7 +90,7 @@ paho-mqtt = { version = "0.9", features = ["vendored-ssl"] } hex = "0.4" # Codecs -rquickjs = { version = "0.1.5", features = ["bindgen", "loader", "array-buffer"] } +rquickjs = { version = "0.1.6", features = ["bindgen", "loader", "array-buffer", "chrono"] } # Misc lazy_static = "1.4" diff --git a/chirpstack/configuration/chirpstack.toml b/chirpstack/configuration/chirpstack.toml index f22e1ef9..2508daa1 100644 --- a/chirpstack/configuration/chirpstack.toml +++ b/chirpstack/configuration/chirpstack.toml @@ -65,20 +65,20 @@ # Multiple regions can be enabled simultaneously. Each region must match # the 'name' parameter of the region configuration in '[[regions]]'. enabled_regions=[ - "as923", - "as923_2", - "as923_3", - "as923_4", - "au915_0", - "cn779", - "eu433", + #"as923", + #"as923_2", + #"as923_3", + #"as923_4", + #"au915_0", + #"cn779", + #"eu433", "eu868", - "in865", - "ism2400", - "kr920", - "ru864", - "us915_0", - "us915_1", + #"in865", + #"ism2400", + #"kr920", + #"ru864", + #"us915_0", + #"us915_1", ] diff --git a/chirpstack/migrations/2022-05-11-084032_device_profile_templates/down.sql b/chirpstack/migrations/2022-05-11-084032_device_profile_templates/down.sql new file mode 100644 index 00000000..e79f0b8e --- /dev/null +++ b/chirpstack/migrations/2022-05-11-084032_device_profile_templates/down.sql @@ -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; diff --git a/chirpstack/migrations/2022-05-11-084032_device_profile_templates/up.sql b/chirpstack/migrations/2022-05-11-084032_device_profile_templates/up.sql new file mode 100644 index 00000000..27a715e9 --- /dev/null +++ b/chirpstack/migrations/2022-05-11-084032_device_profile_templates/up.sql @@ -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; diff --git a/chirpstack/src/api/auth/validator.rs b/chirpstack/src/api/auth/validator.rs index 5be7a33c..5b4689c3 100644 --- a/chirpstack/src/api/auth/validator.rs +++ b/chirpstack/src/api/auth/validator.rs @@ -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 { + task::spawn_blocking({ + let id = *id; + let flag = self.flag; + + move || -> Result { + 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 { + task::spawn_blocking({ + let id = *id; + let flag = self.flag; + + move || -> Result { + 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 { + task::spawn_blocking({ + let id = *id; + let flag = self.flag; + + move || -> Result { + 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 { + task::spawn_blocking({ + let id = *id; + let flag = self.flag; + + move || -> Result { + 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; diff --git a/chirpstack/src/api/device_profile.rs b/chirpstack/src/api/device_profile.rs index 850d91a6..8fec57be 100644 --- a/chirpstack/src/api/device_profile.rs +++ b/chirpstack/src/api/device_profile.rs @@ -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, @@ -100,6 +101,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(), @@ -151,6 +153,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 +168,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, diff --git a/chirpstack/src/api/device_profile_template.rs b/chirpstack/src/api/device_profile_template.rs new file mode 100644 index 00000000..b1af4551 --- /dev/null +++ b/chirpstack/src/api/device_profile_template.rs @@ -0,0 +1,409 @@ +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, + ) -> Result, 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()), + ..Default::default() + }; + + device_profile_template::create(dp) + .await + .map_err(|e| e.status())?; + + Ok(Response::new(())) + } + + async fn get( + &self, + request: Request, + ) -> Result, 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(), + }), + 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, + ) -> Result, 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()), + ..Default::default() + }) + .await + .map_err(|e| e.status())?; + + Ok(Response::new(())) + } + + async fn delete( + &self, + request: Request, + ) -> Result, 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, + ) -> Result, 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(user_id: &Uuid, req: T) -> Request { + let mut req = Request::new(req); + req.extensions_mut().insert(AuthID::User(user_id.clone())); + req + } +} diff --git a/chirpstack/src/api/mod.rs b/chirpstack/src/api/mod.rs index aedd5973..295d4077 100644 --- a/chirpstack/src/api/mod.rs +++ b/chirpstack/src/api/mod.rs @@ -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, diff --git a/chirpstack/src/cmd/import_ttn_lorawan_devices.rs b/chirpstack/src/cmd/import_ttn_lorawan_devices.rs new file mode 100644 index 00000000..86d5f216 --- /dev/null +++ b/chirpstack/src/cmd/import_ttn_lorawan_devices.rs @@ -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, +} + +#[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, +} + +#[derive(Deserialize, Default)] +#[serde(default)] +struct Device { + pub name: String, + pub description: String, + #[serde(rename = "firmwareVersions")] + pub firmware_versions: Vec, +} + +#[derive(Deserialize, Default)] +#[serde(default)] +struct FirmwareVersion { + pub version: String, + pub profiles: HashMap, +} + +#[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, + #[serde(rename = "downlinkEncoder")] + pub downlink_encoder: Option, + #[serde(rename = "downlinkDecoder")] + pub downlink_decoder: Option, +} + +#[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 = 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 = 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], + } +} diff --git a/chirpstack/src/cmd/mod.rs b/chirpstack/src/cmd/mod.rs index 5c0f37bb..f9b4e53f 100644 --- a/chirpstack/src/cmd/mod.rs +++ b/chirpstack/src/cmd/mod.rs @@ -1,3 +1,4 @@ pub mod configfile; +pub mod import_ttn_lorawan_devices; pub mod print_ds; pub mod root; diff --git a/chirpstack/src/codec/js/mod.rs b/chirpstack/src/codec/js/mod.rs index c071cbcc..91c5bf8c 100644 --- a/chirpstack/src/codec/js/mod.rs +++ b/chirpstack/src/codec/js/mod.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use std::time::SystemTime; use anyhow::Result; +use chrono::{DateTime, Utc}; use rquickjs::IntoJs; use super::convert; @@ -12,6 +13,7 @@ mod vendor_buffer; mod vendor_ieee754; pub async fn decode( + recv_time: DateTime, f_port: u8, variables: &HashMap, decode_config: &str, @@ -37,35 +39,63 @@ pub async fn decode( let script = format!( r#" - import {{ Buffer }} from "buffer"; - {} - export {{ decodeUplink }}; + decodeUplink(chirpstack_input) "#, decode_config ); let b = b.to_vec(); let out = ctx.with(|ctx| -> Result { - 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, 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( @@ -94,25 +124,52 @@ pub async fn encode( let script = format!( r#" - import {{ Buffer }} from "buffer"; - {} - 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, 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 = res.get("bytes")?; Ok(v) }) @@ -121,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() { @@ -134,22 +192,25 @@ pub mod test { .to_string(); let vars: HashMap = 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_hex: buff.toString('hex'), - data: input.bytes + data: input.bytes, + recv_time: input.recvTime.toString() } }; } @@ -159,7 +220,7 @@ pub mod test { let mut vars: HashMap = 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(); @@ -217,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() diff --git a/chirpstack/src/codec/mod.rs b/chirpstack/src/codec/mod.rs index 89f971e8..e7d7dea5 100644 --- a/chirpstack/src/codec/mod.rs +++ b/chirpstack/src/codec/mod.rs @@ -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, f_port: u8, variables: &HashMap, 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?), }) } diff --git a/chirpstack/src/main.rs b/chirpstack/src/main.rs index a8f3016a..d08b8a6a 100644 --- a/chirpstack/src/main.rs +++ b/chirpstack/src/main.rs @@ -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?; diff --git a/chirpstack/src/storage/device_profile.rs b/chirpstack/src/storage/device_profile.rs index 93569687..82ad8121 100644 --- a/chirpstack/src/storage/device_profile.rs +++ b/chirpstack/src/storage/device_profile.rs @@ -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,7 @@ pub struct DeviceProfile { pub tags: fields::KeyValue, pub payload_codec_script: String, pub flush_queue_on_activate: bool, + pub description: String, } impl DeviceProfile { @@ -67,6 +68,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, @@ -179,6 +181,7 @@ pub async fn update(dp: DeviceProfile) -> Result { .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), diff --git a/chirpstack/src/storage/device_profile_template.rs b/chirpstack/src/storage/device_profile_template.rs new file mode 100644 index 00000000..402a5787 --- /dev/null +++ b/chirpstack/src/storage/device_profile_template.rs @@ -0,0 +1,398 @@ +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, + pub updated_at: DateTime, + 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, +} + +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()), + } + } +} + +#[derive(Queryable, PartialEq, Debug)] +pub struct DeviceProfileTemplateListItem { + pub id: String, + pub created_at: DateTime, + pub updated_at: DateTime, + 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 { + dp.validate()?; + let dp = task::spawn_blocking({ + move || -> Result { + 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 { + dp.validate()?; + let dp = task::spawn_blocking({ + move || -> Result { + 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), + )) + .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 { + task::spawn_blocking({ + let id = id.to_string(); + move || -> Result { + 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 { + dp.validate()?; + let dp = task::spawn_blocking({ + move || -> Result { + 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 { + task::spawn_blocking({ + move || -> Result { + 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, Error> { + task::spawn_blocking({ + move || -> Result, 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::(), + items.iter().map(|dp| dp.id.clone()).collect::() + ); + } + + // delete + delete(&dp.id).await.unwrap(); + assert_eq!(true, delete(&dp.id).await.is_err()); + } +} diff --git a/chirpstack/src/storage/mod.rs b/chirpstack/src/storage/mod.rs index 40ddaf7e..74daf90c 100644 --- a/chirpstack/src/storage/mod.rs +++ b/chirpstack/src/storage/mod.rs @@ -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; diff --git a/chirpstack/src/storage/schema.rs b/chirpstack/src/storage/schema.rs index 88576d37..70eff91d 100644 --- a/chirpstack/src/storage/schema.rs +++ b/chirpstack/src/storage/schema.rs @@ -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,41 @@ table! { tags -> Jsonb, payload_codec_script -> Text, flush_queue_on_activate -> Bool, + description -> Text, + } +} + +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, } } @@ -240,6 +275,7 @@ allow_tables_to_appear_in_same_query!( device, device_keys, device_profile, + device_profile_template, device_queue_item, gateway, multicast_group, diff --git a/chirpstack/src/uplink/data.rs b/chirpstack/src/uplink/data.rs index 3958b418..95362e0e 100644 --- a/chirpstack/src/uplink/data.rs +++ b/chirpstack/src/uplink/data.rs @@ -594,6 +594,7 @@ impl Data { pl.object = match codec::binary_to_struct( dp.payload_codec_runtime, + ts, mac.f_port.unwrap_or(0), &dev.variables, &dp.payload_codec_script, diff --git a/test.js b/test.js new file mode 100644 index 00000000..52a8e38f --- /dev/null +++ b/test.js @@ -0,0 +1,8 @@ +"use strict"; + +function test() { + foo = "bar"; + return foo; +} + +console.log(test()) diff --git a/ui/package.json b/ui/package.json index e975ad29..c793d7c5 100644 --- a/ui/package.json +++ b/ui/package.json @@ -19,7 +19,7 @@ "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "@types/react-router-dom": "^5.3.3", - "antd": "^4.20.1", + "antd": "^4.20.6", "antd-mask-input": "^2.0.7", "buffer": "^6.0.3", "chart.js": "^3.7.1", diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 349bc941..7d3ce97f 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -30,6 +30,11 @@ import ChangeUserPassword from "./views/users/ChangeUserPassword"; import ListAdminApiKeys from "./views/api-keys/ListAdminApiKeys"; import CreateAdminApiKey from "./views/api-keys/CreateAdminApiKey"; +// device-profile templates +import ListDeviceProfileTemplates from "./views/device-profile-templates/ListDeviceProfileTemplates"; +import EditDeviceProfileTemplate from "./views/device-profile-templates/EditDeviceProfileTemplate"; +import CreateDeviceProfileTemplate from "./views/device-profile-templates/CreateDeviceProfileTemplate"; + // stores import SessionStore from "./stores/SessionStore"; @@ -93,6 +98,14 @@ class App extends Component { + + + + diff --git a/ui/src/components/CodeEditor.tsx b/ui/src/components/CodeEditor.tsx index 489f0868..8ca5f0ce 100644 --- a/ui/src/components/CodeEditor.tsx +++ b/ui/src/components/CodeEditor.tsx @@ -35,6 +35,18 @@ class CodeEditor extends Component { } } + componentDidUpdate(oldProps: IProps) { + if (this.props === oldProps) { + return; + } + + if (this.props.value) { + this.setState({ + value: this.props.value, + }); + } + } + updateField = () => { let value = this.state.value; diff --git a/ui/src/components/Menu.tsx b/ui/src/components/Menu.tsx index 66a1772f..1a8d04c1 100644 --- a/ui/src/components/Menu.tsx +++ b/ui/src/components/Menu.tsx @@ -118,6 +118,11 @@ class SideMenu extends Component { this.setState({ selectedKey: "ns-api-keys" }); } + // ns device-profile templates + if (/\/device-profile-templates(\/([\w-]{36}\/edit|create))?/g.exec(path)) { + this.setState({ selectedKey: "ns-device-profile-templates" }); + } + // tenant dashboard if (/\/tenants\/[\w-]{36}/g.exec(path)) { this.setState({ selectedKey: "tenant-dashboard" }); @@ -163,6 +168,11 @@ class SideMenu extends Component { { key: "ns-tenants", icon: , label: Tenants }, { key: "ns-users", icon: , label: Users }, { key: "ns-api-keys", icon: , label: API keys }, + { + key: "ns-device-profile-templates", + icon: , + label: Device-profile templates, + }, ], }); } diff --git a/ui/src/stores/DeviceProfileTemplateStore.ts b/ui/src/stores/DeviceProfileTemplateStore.ts new file mode 100644 index 00000000..19c7dc6e --- /dev/null +++ b/ui/src/stores/DeviceProfileTemplateStore.ts @@ -0,0 +1,97 @@ +import { notification } from "antd"; +import { EventEmitter } from "events"; +import { DeviceProfileTemplateServiceClient } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_grpc_web_pb"; +import { + CreateDeviceProfileTemplateRequest, + GetDeviceProfileTemplateRequest, + GetDeviceProfileTemplateResponse, + UpdateDeviceProfileTemplateRequest, + DeleteDeviceProfileTemplateRequest, + ListDeviceProfileTemplatesRequest, + ListDeviceProfileTemplatesResponse, +} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb"; + +import SessionStore from "./SessionStore"; +import { HandleError } from "./helpers"; + +class DeviceProfileTemplateStore extends EventEmitter { + client: DeviceProfileTemplateServiceClient; + + constructor() { + super(); + this.client = new DeviceProfileTemplateServiceClient(""); + } + + create = (req: CreateDeviceProfileTemplateRequest, callbackFunc: () => void) => { + this.client.create(req, SessionStore.getMetadata(), (err, resp) => { + if (err !== null) { + HandleError(err); + return; + } + + notification.success({ + message: "Device-profile template created", + duration: 3, + }); + + callbackFunc(); + }); + }; + + get = (req: GetDeviceProfileTemplateRequest, callbackFunc: (resp: GetDeviceProfileTemplateResponse) => void) => { + this.client.get(req, SessionStore.getMetadata(), (err, resp) => { + if (err !== null) { + HandleError(err); + return; + } + + callbackFunc(resp); + }); + }; + + update = (req: UpdateDeviceProfileTemplateRequest, callbackFunc: () => void) => { + this.client.update(req, SessionStore.getMetadata(), err => { + if (err !== null) { + HandleError(err); + return; + } + + notification.success({ + message: "Device-profile template updated", + duration: 3, + }); + + callbackFunc(); + }); + }; + + delete = (req: DeleteDeviceProfileTemplateRequest, callbackFunc: () => void) => { + this.client.delete(req, SessionStore.getMetadata(), err => { + if (err !== null) { + HandleError(err); + return; + } + + notification.success({ + message: "Device-profile template deleted", + duration: 3, + }); + + callbackFunc(); + }); + }; + + list = (req: ListDeviceProfileTemplatesRequest, callbackFunc: (resp: ListDeviceProfileTemplatesResponse) => void) => { + this.client.list(req, SessionStore.getMetadata(), (err, resp) => { + if (err !== null) { + HandleError(err); + return; + } + + callbackFunc(resp); + }); + }; +} + +const deviceProfileTemplateStore = new DeviceProfileTemplateStore(); +export default deviceProfileTemplateStore; diff --git a/ui/src/views/api-keys/ListAdminApiKeys.tsx b/ui/src/views/api-keys/ListAdminApiKeys.tsx index f4cd43e8..5a7dfb5b 100644 --- a/ui/src/views/api-keys/ListAdminApiKeys.tsx +++ b/ui/src/views/api-keys/ListAdminApiKeys.tsx @@ -91,7 +91,7 @@ class ListAdminApiKeys extends Component { breadcrumbRender={() => ( - Network-server + Network Server API keys diff --git a/ui/src/views/device-profile-templates/CreateDeviceProfileTemplate.tsx b/ui/src/views/device-profile-templates/CreateDeviceProfileTemplate.tsx new file mode 100644 index 00000000..932dbb00 --- /dev/null +++ b/ui/src/views/device-profile-templates/CreateDeviceProfileTemplate.tsx @@ -0,0 +1,96 @@ +import React, { Component } from "react"; +import { Link, RouteComponentProps } from "react-router-dom"; + +import { Space, Breadcrumb, Card, PageHeader } from "antd"; + +import { MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; +import { + DeviceProfileTemplate, + CreateDeviceProfileTemplateRequest, +} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb"; + +import DeviceProfileTemplateForm from "./DeviceProfileTemplateForm"; +import DeviceProfileTemplateStore from "../../stores/DeviceProfileTemplateStore"; + +class CreateDeviceProfileTemplate extends Component { + onFinish = (obj: DeviceProfileTemplate) => { + let req = new CreateDeviceProfileTemplateRequest(); + req.setDeviceProfileTemplate(obj); + + DeviceProfileTemplateStore.create(req, () => { + this.props.history.push(`/device-profile-templates`); + }); + }; + + render() { + const codecScript = `// Decode uplink function. +// +// Input is an object with the following fields: +// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0] +// - fPort = Uplink fPort. +// - variables = Object containing the configured device variables. +// +// Output must be an object with the following fields: +// - data = Object representing the decoded payload. +function decodeUplink(input) { + return { + object: { + temp: 22.5 + } + }; +} + +// Encode downlink function. +// +// Input is an object with the following fields: +// - data = Object representing the payload that must be encoded. +// - variables = Object containing the configured device variables. +// +// Output must be an object with the following fields: +// - bytes = Byte array containing the downlink payload. +function encodeDownlink(input) { + return { + data: [225, 230, 255, 0] + }; +} +`; + + let deviceProfileTemplate = new DeviceProfileTemplate(); + deviceProfileTemplate.setPayloadCodecScript(codecScript); + deviceProfileTemplate.setSupportsOtaa(true); + deviceProfileTemplate.setUplinkInterval(3600); + deviceProfileTemplate.setDeviceStatusReqInterval(1); + deviceProfileTemplate.setAdrAlgorithmId("default"); + deviceProfileTemplate.setMacVersion(MacVersion.LORAWAN_1_0_3); + deviceProfileTemplate.setRegParamsRevision(RegParamsRevision.A); + deviceProfileTemplate.setFlushQueueOnActivate(true); + + return ( + + ( + + + Network Server + + + + Device-profile templates + + + + Add + + + )} + title="Add device-profile template" + /> + + + + + ); + } +} + +export default CreateDeviceProfileTemplate; diff --git a/ui/src/views/device-profile-templates/DeviceProfileTemplateForm.tsx b/ui/src/views/device-profile-templates/DeviceProfileTemplateForm.tsx new file mode 100644 index 00000000..af45c245 --- /dev/null +++ b/ui/src/views/device-profile-templates/DeviceProfileTemplateForm.tsx @@ -0,0 +1,419 @@ +import React, { Component } from "react"; + +import { Form, Input, Select, InputNumber, Switch, Row, Col, Button, Tabs } from "antd"; +import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; + +import { DeviceProfileTemplate } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb"; +import { CodecRuntime } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; +import { Region, MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; +import { ListDeviceProfileAdrAlgorithmsResponse } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; + +import DeviceProfileStore from "../../stores/DeviceProfileStore"; +import CodeEditor from "../../components/CodeEditor"; + +interface IProps { + initialValues: DeviceProfileTemplate; + onFinish: (obj: DeviceProfileTemplate) => void; + update?: boolean; +} + +interface IState { + supportsOtaa: boolean; + supportsClassB: boolean; + supportsClassC: boolean; + payloadCodecRuntime: CodecRuntime; + adrAlgorithms: [string, string][]; +} + +class DeviceProfileTemplateForm extends Component { + formRef = React.createRef(); + + constructor(props: IProps) { + super(props); + this.state = { + supportsOtaa: false, + supportsClassB: false, + supportsClassC: false, + payloadCodecRuntime: CodecRuntime.NONE, + adrAlgorithms: [], + }; + } + + componentDidMount() { + const v = this.props.initialValues; + + this.setState({ + supportsOtaa: v.getSupportsOtaa(), + supportsClassB: v.getSupportsClassB(), + supportsClassC: v.getSupportsClassC(), + payloadCodecRuntime: v.getPayloadCodecRuntime(), + }); + + DeviceProfileStore.listAdrAlgorithms((resp: ListDeviceProfileAdrAlgorithmsResponse) => { + let adrAlgorithms: [string, string][] = []; + for (const a of resp.getResultList()) { + adrAlgorithms.push([a.getId(), a.getName()]); + } + + this.setState({ + adrAlgorithms: adrAlgorithms, + }); + }); + } + + onFinish = (values: DeviceProfileTemplate.AsObject) => { + const v = Object.assign(this.props.initialValues.toObject(), values); + let dp = new DeviceProfileTemplate(); + dp.setId(v.id); + + dp.setName(v.name); + dp.setDescription(v.description); + dp.setVendor(v.vendor); + dp.setFirmware(v.firmware); + dp.setRegion(v.region); + dp.setMacVersion(v.macVersion); + dp.setRegParamsRevision(v.regParamsRevision); + dp.setAdrAlgorithmId(v.adrAlgorithmId); + dp.setFlushQueueOnActivate(v.flushQueueOnActivate); + dp.setUplinkInterval(v.uplinkInterval); + dp.setDeviceStatusReqInterval(v.deviceStatusReqInterval); + + // join otaa /abp + dp.setSupportsOtaa(v.supportsOtaa); + dp.setAbpRx1Delay(v.abpRx1Delay); + dp.setAbpRx1DrOffset(v.abpRx1DrOffset); + dp.setAbpRx2Dr(v.abpRx2Dr); + dp.setAbpRx2Freq(v.abpRx2Freq); + + // class-b + dp.setSupportsClassB(v.supportsClassB); + dp.setClassBTimeout(v.classBTimeout); + + // class-c + dp.setSupportsClassC(v.supportsClassC); + dp.setClassCTimeout(v.classCTimeout); + + // codec + dp.setPayloadCodecRuntime(v.payloadCodecRuntime); + dp.setPayloadCodecScript(v.payloadCodecScript); + + // tags + for (const elm of v.tagsMap) { + dp.getTagsMap().set(elm[0], elm[1]); + } + + this.props.onFinish(dp); + }; + + onSupportsOtaaChange = (checked: boolean) => { + this.setState({ + supportsOtaa: checked, + }); + }; + + onSupportsClassBChnage = (checked: boolean) => { + this.setState({ + supportsClassB: checked, + }); + }; + + onSupportsClassCChange = (checked: boolean) => { + this.setState({ + supportsClassC: checked, + }); + }; + + onPayloadCodecRuntimeChange = (value: CodecRuntime) => { + this.setState({ + payloadCodecRuntime: value, + }); + }; + + render() { + const adrOptions = this.state.adrAlgorithms.map(v => {v[1]}); + + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {!this.state.supportsOtaa && ( + + + + + + + + + + + + + )} + {!this.state.supportsOtaa && ( + + + + + + + + + + + + + )} + + + + + + {this.state.supportsClassB && ( + + + + )} + + + + + + {this.state.supportsClassC && ( + + + + )} + + + + + + {this.state.payloadCodecRuntime === CodecRuntime.JS && ( + + )} + + + + {(fields, { add, remove }) => ( + <> + {fields.map(({ key, name, ...restField }) => ( + + + + + + + + + + + + + remove(name)} /> + + + ))} + + + + + )} + + + + + + +
+ ); + } +} + +export default DeviceProfileTemplateForm; diff --git a/ui/src/views/device-profile-templates/EditDeviceProfileTemplate.tsx b/ui/src/views/device-profile-templates/EditDeviceProfileTemplate.tsx new file mode 100644 index 00000000..cdd9ec63 --- /dev/null +++ b/ui/src/views/device-profile-templates/EditDeviceProfileTemplate.tsx @@ -0,0 +1,115 @@ +import React, { Component } from "react"; +import { RouteComponentProps, Link } from "react-router-dom"; + +import { Space, Breadcrumb, Card, Button, PageHeader } from "antd"; + +import { + DeviceProfileTemplate, + GetDeviceProfileTemplateRequest, + GetDeviceProfileTemplateResponse, + UpdateDeviceProfileTemplateRequest, + DeleteDeviceProfileTemplateRequest, +} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb"; + +import DeviceProfileTemplateForm from "./DeviceProfileTemplateForm"; +import DeviceProfileTemplateStore from "../../stores/DeviceProfileTemplateStore"; +import DeleteConfirm from "../../components/DeleteConfirm"; + +interface IState { + deviceProfileTemplate?: DeviceProfileTemplate; +} + +interface MatchParams { + deviceProfileTemplateId: string; +} + +interface IProps extends RouteComponentProps {} + +class EditDeviceProfileTemplate extends Component { + constructor(props: IProps) { + super(props); + this.state = {}; + } + + componentDidMount() { + this.getDeviceProfileTemplate(); + } + + getDeviceProfileTemplate = () => { + const id = this.props.match.params.deviceProfileTemplateId; + let req = new GetDeviceProfileTemplateRequest(); + req.setId(id); + + DeviceProfileTemplateStore.get(req, (resp: GetDeviceProfileTemplateResponse) => { + this.setState({ + deviceProfileTemplate: resp.getDeviceProfileTemplate(), + }); + }); + }; + + onFinish = (obj: DeviceProfileTemplate) => { + let req = new UpdateDeviceProfileTemplateRequest(); + req.setDeviceProfileTemplate(obj); + + DeviceProfileTemplateStore.update(req, () => { + this.props.history.push(`/device-profile-templates`); + }); + }; + + deleteDeviceProfileTemplate = () => { + let req = new DeleteDeviceProfileTemplateRequest(); + req.setId(this.props.match.params.deviceProfileTemplateId); + + DeviceProfileTemplateStore.delete(req, () => { + this.props.history.push(`/device-profile-templates`); + }); + }; + + render() { + const dp = this.state.deviceProfileTemplate; + + if (!dp) { + return null; + } + + return ( + + ( + + + Network Server + + + + Device-profile templates + + + + {dp.getName()} + + + )} + title={dp.getName()} + subTitle={`device-profile template id: ${dp.getId()}`} + extra={[ + + + , + ]} + /> + + + + + ); + } +} + +export default EditDeviceProfileTemplate; diff --git a/ui/src/views/device-profile-templates/ListDeviceProfileTemplates.tsx b/ui/src/views/device-profile-templates/ListDeviceProfileTemplates.tsx new file mode 100644 index 00000000..147d51fb --- /dev/null +++ b/ui/src/views/device-profile-templates/ListDeviceProfileTemplates.tsx @@ -0,0 +1,87 @@ +import React, { Component } from "react"; +import { Link } from "react-router-dom"; + +import { Space, Breadcrumb, Button, PageHeader } from "antd"; +import { ColumnsType } from "antd/es/table"; + +import { + ListDeviceProfileTemplatesRequest, + ListDeviceProfileTemplatesResponse, + DeviceProfileTemplateListItem, +} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb"; +import { Region } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; + +import { getEnumName } from "../helpers"; +import DataTable, { GetPageCallbackFunc } from "../../components/DataTable"; +import DeviceProfileTemplateStore from "../../stores/DeviceProfileTemplateStore"; + +class ListDeviceProfileTemplates extends Component { + columns = (): ColumnsType => { + return [ + { + title: "Vendor", + dataIndex: "vendor", + key: "vendor", + }, + { + title: "Name", + dataIndex: "name", + key: "name", + render: (text, record) => {text}, + }, + { + title: "Firmware", + dataIndex: "firmware", + key: "firmware", + }, + { + title: "Region", + dataIndex: "region", + key: "region", + width: 150, + render: (text, record) => { + return getEnumName(Region, record.region); + }, + }, + ]; + }; + + getPage = (limit: number, offset: number, callbackFunc: GetPageCallbackFunc) => { + let req = new ListDeviceProfileTemplatesRequest(); + req.setLimit(limit); + req.setOffset(offset); + + DeviceProfileTemplateStore.list(req, (resp: ListDeviceProfileTemplatesResponse) => { + const obj = resp.toObject(); + callbackFunc(obj.totalCount, obj.resultList); + }); + }; + + render() { + return ( + + ( + + + Network Server + + + Device-profile templates + + + )} + title="Device-profile templates" + extra={[ + , + ]} + /> + + + ); + } +} + +export default ListDeviceProfileTemplates; diff --git a/ui/src/views/device-profiles/CreateDeviceProfile.tsx b/ui/src/views/device-profiles/CreateDeviceProfile.tsx index eb6df541..45c80096 100644 --- a/ui/src/views/device-profiles/CreateDeviceProfile.tsx +++ b/ui/src/views/device-profiles/CreateDeviceProfile.tsx @@ -43,7 +43,7 @@ class CreateDeviceProfile extends Component { // - data = Object representing the decoded payload. function decodeUplink(input) { return { - object: { + data: { temp: 22.5 } }; diff --git a/ui/src/views/device-profiles/DeviceProfileForm.tsx b/ui/src/views/device-profiles/DeviceProfileForm.tsx index 698c3b38..8326089c 100644 --- a/ui/src/views/device-profiles/DeviceProfileForm.tsx +++ b/ui/src/views/device-profiles/DeviceProfileForm.tsx @@ -1,14 +1,184 @@ import React, { Component } from "react"; -import { Form, Input, Select, InputNumber, Switch, Row, Col, Button, Tabs } from "antd"; +import { Form, Input, Select, InputNumber, Switch, Row, Col, Button, Tabs, Modal, Spin, Cascader } from "antd"; import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; import { DeviceProfile, CodecRuntime } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; import { Region, MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; import { ListDeviceProfileAdrAlgorithmsResponse } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; +import { + ListDeviceProfileTemplatesRequest, + ListDeviceProfileTemplatesResponse, + GetDeviceProfileTemplateRequest, + GetDeviceProfileTemplateResponse, + DeviceProfileTemplateListItem, + DeviceProfileTemplate, +} from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_template_pb"; + +import { getEnumName } from "../helpers"; import DeviceProfileStore from "../../stores/DeviceProfileStore"; +import DeviceProfileTemplateStore from "../../stores/DeviceProfileTemplateStore"; import CodeEditor from "../../components/CodeEditor"; +interface ModalProps { + onOk: (dp: DeviceProfileTemplate) => void; + onCancel: () => void; + visible: boolean; +} + +interface ModalState { + templates: DeviceProfileTemplateListItem[]; + templatesLoaded: boolean; + templateId?: string; +} + +interface Option { + value: string; + label: string; + children?: Option[]; +} + +class TemplateModal extends Component { + constructor(props: ModalProps) { + super(props); + this.state = { + templates: [], + templatesLoaded: false, + }; + } + + componentDidUpdate(prevProps: ModalProps) { + if (prevProps === this.props) { + return; + } + + if (this.props.visible) { + this.setState({ + templatesLoaded: false, + }); + + let req = new ListDeviceProfileTemplatesRequest(); + req.setLimit(99999); + + DeviceProfileTemplateStore.list(req, (resp: ListDeviceProfileTemplatesResponse) => { + this.setState({ + templatesLoaded: true, + templates: resp.getResultList(), + }); + }); + } + } + + onChange = (value: (string | number)[]) => { + this.setState({ + templateId: value.at(-1)! as string, + }); + }; + + onOk = () => { + if (this.state.templateId) { + let req = new GetDeviceProfileTemplateRequest(); + req.setId(this.state.templateId); + + DeviceProfileTemplateStore.get(req, (resp: GetDeviceProfileTemplateResponse) => { + const dp = resp.getDeviceProfileTemplate(); + if (dp) { + this.props.onOk(dp); + } + }); + } + }; + + render() { + let options: Option[] = []; + let vendor = ""; + let device = ""; + let firmware = ""; + let region = ""; + + for (const item of this.state.templates) { + if (vendor !== item.getVendor()) { + options.push({ + value: item.getId(), + label: item.getVendor(), + children: [], + }); + + vendor = item.getVendor(); + device = ""; + firmware = ""; + region = ""; + } + + if (device !== item.getName()) { + options.at(-1)!.children!.push({ + value: item.getId(), + label: item.getName(), + children: [], + }); + + device = item.getName(); + firmware = ""; + region = ""; + } + + if (firmware !== item.getFirmware()) { + options + .at(-1)! + .children!.at(-1)! + .children!.push({ + value: item.getId(), + label: "FW version: " + item.getFirmware(), + children: [], + }); + + firmware = item.getFirmware(); + region = ""; + } + + if (region !== getEnumName(Region, item.getRegion())) { + options + .at(-1)! + .children!.at(-1)! + .children!.at(-1)! + .children!.push({ + value: item.getId(), + label: getEnumName(Region, item.getRegion()), + children: [], + }); + + region = getEnumName(Region, item.getRegion()); + } + } + + return ( + + {!this.state.templatesLoaded && ( +
+ +
+ )} + {this.state.templatesLoaded && ( + + )} +
+ ); + } +} + interface IProps { initialValues: DeviceProfile; onFinish: (obj: DeviceProfile) => void; @@ -21,6 +191,8 @@ interface IState { supportsClassC: boolean; payloadCodecRuntime: CodecRuntime; adrAlgorithms: [string, string][]; + templateModalVisible: boolean; + tabActive: string; } class DeviceProfileForm extends Component { @@ -34,6 +206,8 @@ class DeviceProfileForm extends Component { supportsClassC: false, payloadCodecRuntime: CodecRuntime.NONE, adrAlgorithms: [], + templateModalVisible: false, + tabActive: "1", }; } @@ -59,13 +233,21 @@ class DeviceProfileForm extends Component { }); } + onTabChange = (activeKey: string) => { + this.setState({ + tabActive: activeKey, + }); + } + onFinish = (values: DeviceProfile.AsObject) => { const v = Object.assign(this.props.initialValues.toObject(), values); + let dp = new DeviceProfile(); dp.setId(v.id); dp.setTenantId(v.tenantId); dp.setName(v.name); + dp.setDescription(v.description); dp.setRegion(v.region); dp.setMacVersion(v.macVersion); dp.setRegParamsRevision(v.regParamsRevision); @@ -98,6 +280,7 @@ class DeviceProfileForm extends Component { dp.getTagsMap().set(elm[0], elm[1]); } + this.props.onFinish(dp); }; @@ -125,8 +308,102 @@ class DeviceProfileForm extends Component { }); }; + showTemplateModal = () => { + this.setState({ + templateModalVisible: true, + }); + }; + + onTemplateModalOk = (dp: DeviceProfileTemplate) => { + this.setState({ + templateModalVisible: false, + }); + + this.formRef.current.setFieldsValue({ + name: dp.getName(), + description: dp.getDescription(), + region: dp.getRegion(), + macVersion: dp.getMacVersion(), + regParamsRevision: dp.getRegParamsRevision(), + adrAlgorithmId: dp.getAdrAlgorithmId(), + payloadCodecRuntime: dp.getPayloadCodecRuntime(), + payloadCodecScript: dp.getPayloadCodecScript(), + flushQueueOnActivate: dp.getFlushQueueOnActivate(), + uplinkInterval: dp.getUplinkInterval(), + deviceStatusReqInterval: dp.getDeviceStatusReqInterval(), + supportsOtaa: dp.getSupportsOtaa(), + supportsClassB: dp.getSupportsClassB(), + supportsClassC: dp.getSupportsClassC(), + classBTimeout: dp.getClassBTimeout(), + abpRx1Delay: dp.getAbpRx1Delay(), + abpRx2Dr: dp.getAbpRx2Dr(), + abpRx2Freq: dp.getAbpRx2Freq(), + tagsMap: [ + ["firmware", dp.getFirmware()], + ["vendor", dp.getVendor()], + ["device", dp.getName()], + ["device_profile_template_id", dp.getId()], + ], + }); + + const tabActive = this.state.tabActive; + + this.setState({ + supportsOtaa: dp.getSupportsOtaa(), + supportsClassB: dp.getSupportsClassB(), + supportsClassC: dp.getSupportsClassC(), + payloadCodecRuntime: dp.getPayloadCodecRuntime(), + }, () => { + // This is a workaround as without rendering the TabPane (e.g. the user + // does not click through the different tabs), setFieldsValue does not + // actually update the fields. For example if selecting a template with + // a codec script and immediately click the save button, no codec script + // is passed to the onFinish function. This seems to be with every field + // that is not actually rendered before clicking the Save button. + this.setState({ + tabActive: "1", + }, () => { + this.setState({ + tabActive: "2", + }, () => { + this.setState({ + tabActive: "3", + }, () => { + this.setState({ + tabActive: "4", + }, () => { + this.setState({ + tabActive: "5", + }, () => { + this.setState({ + tabActive: "6", + }, () => { + this.setState({ + tabActive: tabActive, + }); + }); + }); + }); + }); + }); + }); + }); + + }; + + onTemplateModalCancel = () => { + this.setState({ + templateModalVisible: false, + }); + }; + render() { const adrOptions = this.state.adrAlgorithms.map(v => {v[1]}); + const operations = ( + + ); return (
{ onFinish={this.onFinish} ref={this.formRef} > - + + + + +