From b8ab0182de7c869ff2a3ece4e5c70ce6775e37f0 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Wed, 5 Mar 2025 11:04:40 +0000 Subject: [PATCH] ui: Make app-layer params configurable. --- api/proto/api/device_profile.proto | 13 ++- .../proto/chirpstack/api/device_profile.proto | 13 ++- chirpstack/src/api/device_profile.rs | 6 ++ .../device-profiles/CreateDeviceProfile.tsx | 8 +- .../device-profiles/DeviceProfileForm.tsx | 89 ++++++++++++++++++- 5 files changed, 122 insertions(+), 7 deletions(-) diff --git a/api/proto/api/device_profile.proto b/api/proto/api/device_profile.proto index 15b573bf..bc1e7b74 100644 --- a/api/proto/api/device_profile.proto +++ b/api/proto/api/device_profile.proto @@ -462,11 +462,20 @@ message AppLayerParams { // TS003 version (Application Layer Clock Sync). Ts003Version ts003_version = 1; + // TS003 fPort. + uint32 ts003_f_port = 2; + // TS004 version (Fragmented Data Block Transport). - Ts004Version ts004_version = 2; + Ts004Version ts004_version = 3; + + // TS004 fPort. + uint32 ts004_f_port = 4; // TS005 version (Remote Multicast Setup). - Ts005Version ts005_version = 3; + Ts005Version ts005_version = 5; + + // TS005 fPort. + uint32 ts005_f_port = 6; } message DeviceProfileListItem { diff --git a/api/rust/proto/chirpstack/api/device_profile.proto b/api/rust/proto/chirpstack/api/device_profile.proto index 15b573bf..bc1e7b74 100644 --- a/api/rust/proto/chirpstack/api/device_profile.proto +++ b/api/rust/proto/chirpstack/api/device_profile.proto @@ -462,11 +462,20 @@ message AppLayerParams { // TS003 version (Application Layer Clock Sync). Ts003Version ts003_version = 1; + // TS003 fPort. + uint32 ts003_f_port = 2; + // TS004 version (Fragmented Data Block Transport). - Ts004Version ts004_version = 2; + Ts004Version ts004_version = 3; + + // TS004 fPort. + uint32 ts004_f_port = 4; // TS005 version (Remote Multicast Setup). - Ts005Version ts005_version = 3; + Ts005Version ts005_version = 5; + + // TS005 fPort. + uint32 ts005_f_port = 6; } message DeviceProfileListItem { diff --git a/chirpstack/src/api/device_profile.rs b/chirpstack/src/api/device_profile.rs index 41942b3f..3cd1718c 100644 --- a/chirpstack/src/api/device_profile.rs +++ b/chirpstack/src/api/device_profile.rs @@ -264,8 +264,11 @@ impl DeviceProfileService for DeviceProfile { rx1_delay: dp.rx1_delay as u32, app_layer_params: Some(api::AppLayerParams { ts003_version: dp.app_layer_params.ts003_version.to_proto().into(), + ts003_f_port: dp.app_layer_params.ts003_f_port as u32, ts004_version: dp.app_layer_params.ts004_version.to_proto().into(), + ts004_f_port: dp.app_layer_params.ts004_f_port as u32, ts005_version: dp.app_layer_params.ts005_version.to_proto().into(), + ts005_f_port: dp.app_layer_params.ts005_f_port as u32, }), }), created_at: Some(helpers::datetime_to_prost_timestamp(&dp.created_at)), @@ -398,8 +401,11 @@ impl DeviceProfileService for DeviceProfile { fields::AppLayerParams { ts003_version: app_layer_params.ts003_version().from_proto(), + ts003_f_port: app_layer_params.ts003_f_port as u8, ts004_version: app_layer_params.ts004_version().from_proto(), + ts004_f_port: app_layer_params.ts004_f_port as u8, ts005_version: app_layer_params.ts005_version().from_proto(), + ts005_f_port: app_layer_params.ts005_f_port as u8, ..Default::default() } }, diff --git a/ui/src/views/device-profiles/CreateDeviceProfile.tsx b/ui/src/views/device-profiles/CreateDeviceProfile.tsx index 8d52140a..9bdd47a0 100644 --- a/ui/src/views/device-profiles/CreateDeviceProfile.tsx +++ b/ui/src/views/device-profiles/CreateDeviceProfile.tsx @@ -5,7 +5,7 @@ import { PageHeader } from "@ant-design/pro-layout"; import { MacVersion, RegParamsRevision } from "@chirpstack/chirpstack-api-grpc-web/common/common_pb"; import type { CreateDeviceProfileResponse } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; -import { DeviceProfile, CreateDeviceProfileRequest } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; +import { DeviceProfile, CreateDeviceProfileRequest, AppLayerParams } from "@chirpstack/chirpstack-api-grpc-web/api/device_profile_pb"; import type { Tenant } from "@chirpstack/chirpstack-api-grpc-web/api/tenant_pb"; @@ -77,6 +77,12 @@ function encodeDownlink(input) { deviceProfile.setFlushQueueOnActivate(true); deviceProfile.setAutoDetectMeasurements(true); + const appLayer = new AppLayerParams(); + appLayer.setTs003FPort(202); + appLayer.setTs004FPort(201); + appLayer.setTs005FPort(200); + deviceProfile.setAppLayerParams(appLayer); + return ( )} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {(fields, { add, remove }) => ( <> @@ -1089,7 +1174,7 @@ function DeviceProfileForm(props: IProps) { )} - +

ChirpStack can aggregate and visualize decoded device measurements in the device dashboard. To setup the