UI: Add support use Obj19 for OTA updated in LWM2M transport configuration

This commit is contained in:
Vladyslav_Prykhodko 2025-02-28 15:34:21 +02:00
parent d419212684
commit 6e6d57e60a
4 changed files with 53 additions and 36 deletions

View File

@ -52,39 +52,47 @@
<ng-template matTabContent [formGroup]="lwm2mDeviceProfileFormGroup">
<section formGroupName="clientLwM2mSettings">
<fieldset class="fields-group">
<legend class="group-title" translate>device-profile.lwm2m.fw-update</legend>
<mat-form-field class="mat-block flex-1">
<mat-label>{{ 'device-profile.lwm2m.fw-update-strategy' | translate }}</mat-label>
<mat-select formControlName="fwUpdateStrategy">
<mat-option [value]=1>{{ 'device-profile.lwm2m.fw-update-strategy-package' | translate }}</mat-option>
<mat-option [value]=2>{{ 'device-profile.lwm2m.fw-update-strategy-package-uri' | translate }}</mat-option>
<mat-option [value]=3>{{ 'device-profile.lwm2m.fw-update-strategy-data' | translate }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="mat-block flex-1" *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateStrategy').value === 2">
<mat-label>{{ 'device-profile.lwm2m.fw-update-resource' | translate }}</mat-label>
<input matInput formControlName="fwUpdateResource" required>
<mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateResource').hasError('required')">
{{ 'device-profile.lwm2m.fw-update-resource-required' | translate }}
</mat-error>
</mat-form-field>
</fieldset>
<fieldset class="fields-group">
<legend class="group-title" translate>device-profile.lwm2m.sw-update</legend>
<mat-form-field class="mat-block flex-1">
<mat-label>{{ 'device-profile.lwm2m.sw-update-strategy' | translate }}</mat-label>
<mat-select formControlName="swUpdateStrategy">
<mat-option [value]=1>{{ 'device-profile.lwm2m.sw-update-strategy-package' | translate }}</mat-option>
<mat-option [value]=2>{{ 'device-profile.lwm2m.sw-update-strategy-package-uri' | translate }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="mat-block flex-1" *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.swUpdateStrategy').value === 2">
<mat-label>{{ 'device-profile.lwm2m.sw-update-resource' | translate }}</mat-label>
<input matInput formControlName="swUpdateResource" required>
<mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.swUpdateResource').hasError('required')">
{{ 'device-profile.lwm2m.sw-update-resource-required' | translate }}
</mat-error>
</mat-form-field>
<legend class="group-title" translate>device-profile.lwm2m.ota-update</legend>
<mat-checkbox formControlName="useObject19ForOta">
<span tb-hint-tooltip-icon="{{ 'device-profile.lwm2m.use-object-19-for-ota-update-hint' | translate }}">
{{ 'device-profile.lwm2m.use-object-19-for-ota-update' | translate }}
</span>
</mat-checkbox>
<fieldset class="fields-group">
<legend class="group-title" translate>device-profile.lwm2m.fw-update</legend>
<mat-form-field class="mat-block flex-1">
<mat-label>{{ 'device-profile.lwm2m.fw-update-strategy' | translate }}</mat-label>
<mat-select formControlName="fwUpdateStrategy">
<mat-option [value]=1>{{ 'device-profile.lwm2m.fw-update-strategy-package' | translate }}</mat-option>
<mat-option [value]=2>{{ 'device-profile.lwm2m.fw-update-strategy-package-uri' | translate }}</mat-option>
<mat-option [value]=3>{{ 'device-profile.lwm2m.fw-update-strategy-data' | translate }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="mat-block flex-1" *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateStrategy').value === 2">
<mat-label>{{ 'device-profile.lwm2m.fw-update-resource' | translate }}</mat-label>
<input matInput formControlName="fwUpdateResource" required>
<mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateResource').hasError('required')">
{{ 'device-profile.lwm2m.fw-update-resource-required' | translate }}
</mat-error>
</mat-form-field>
</fieldset>
<fieldset class="fields-group">
<legend class="group-title" translate>device-profile.lwm2m.sw-update</legend>
<mat-form-field class="mat-block flex-1">
<mat-label>{{ 'device-profile.lwm2m.sw-update-strategy' | translate }}</mat-label>
<mat-select formControlName="swUpdateStrategy">
<mat-option [value]=1>{{ 'device-profile.lwm2m.sw-update-strategy-package' | translate }}</mat-option>
<mat-option [value]=2>{{ 'device-profile.lwm2m.sw-update-strategy-package-uri' | translate }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="mat-block flex-1" *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.swUpdateStrategy').value === 2">
<mat-label>{{ 'device-profile.lwm2m.sw-update-resource' | translate }}</mat-label>
<input matInput formControlName="swUpdateResource" required>
<mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.swUpdateResource').hasError('required')">
{{ 'device-profile.lwm2m.sw-update-resource-required' | translate }}
</mat-error>
</mat-form-field>
</fieldset>
</fieldset>
<fieldset class="fields-group">
<legend class="group-title" translate>device-profile.power-saving-mode</legend>

View File

@ -104,6 +104,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
bootstrap: [[]],
clientLwM2mSettings: this.fb.group({
clientOnlyObserveAfterConnect: [1, []],
useObject19ForOta: [false],
fwUpdateStrategy: [1, []],
swUpdateStrategy: [1, []],
fwUpdateResource: [{value: '', disabled: true}, []],
@ -262,6 +263,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
bootstrapServerUpdateEnable: this.configurationValue.bootstrapServerUpdateEnable || false,
clientLwM2mSettings: {
clientOnlyObserveAfterConnect: this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect,
useObject19ForOta: this.configurationValue.clientLwM2mSettings.useObject19ForOta ?? false,
fwUpdateStrategy: this.configurationValue.clientLwM2mSettings.fwUpdateStrategy || 1,
swUpdateStrategy: this.configurationValue.clientLwM2mSettings.swUpdateStrategy || 1,
fwUpdateResource: this.configurationValue.clientLwM2mSettings.fwUpdateResource || '',

View File

@ -124,13 +124,15 @@ export const PowerModeTranslationMap = new Map<PowerMode, string>(
export enum ObjectIDVer {
V1_0 = '1.0',
V1_1 = '1.1'
V1_1 = '1.1',
V1_2 = '1.2',
}
export const ObjectIDVerTranslationMap = new Map<ObjectIDVer, string>(
[
[ObjectIDVer.V1_0, 'device-profile.lwm2m.default-object-id-ver.v1-0'],
[ObjectIDVer.V1_1, 'device-profile.lwm2m.default-object-id-ver.v1-1']
[ObjectIDVer.V1_1, 'device-profile.lwm2m.default-object-id-ver.v1-1'],
[ObjectIDVer.V1_2, 'device-profile.lwm2m.default-object-id-ver.v1-2'],
]
);
@ -167,6 +169,7 @@ export interface Lwm2mProfileConfigModels {
export interface ClientLwM2mSettings {
clientOnlyObserveAfterConnect: number;
useObject19ForOta?: boolean;
fwUpdateStrategy: number;
swUpdateStrategy: number;
fwUpdateResource?: string;

View File

@ -2077,6 +2077,9 @@
"add-lwm2m-server-config": "Add LwM2M server",
"no-config-servers": "No servers configured",
"others-tab": "Other settings",
"ota-update": "OTA update",
"use-object-19-for-ota-update": "Use Object 19 for OTA update",
"use-object-19-for-ota-update-hint": "Use Resource ObjectId = 19 for OTA updates: FirmWare → InstanceId = 65534, SoftWare → InstanceId = 65535. The data format is JSON wrapped in Base64. The main field in JSON: \"Checksum\" (SHA256). Additional fields: \"Title\" (OTA name), \"Version\" (OTA version), \"File Name\" (file name for storing OTA on the client), \"File Size\" (OTA size in bytes).",
"client-strategy": "Client strategy when connecting",
"client-strategy-label": "Strategy",
"client-strategy-only-observe": "Only Observe Request to the client after the initial connection",
@ -2107,7 +2110,8 @@
"default-object-id": "Default Object Version (Attribute)",
"default-object-id-ver": {
"v1-0": "1.0",
"v1-1": "1.1"
"v1-1": "1.1",
"v1-2": "1.2"
}
},
"snmp": {