diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html
index f4dbafb6e8..94b4b70207 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html
@@ -25,6 +25,20 @@
(removeList)="removeObjectsList($event)"
formControlName="objectIds">
+
+ device-profile.lwm2m.observe-strategy.observe-strategy
+
+
+ {{ observeStrategyMap.get(lwm2mDeviceProfileFormGroup.get('observeStrategy').value)?.name | translate }}
+
+
+ {{ observeStrategyMap.get(strategy).name | translate }}
+
+ {{ observeStrategyMap.get(strategy).description | translate }}
+
+
+
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts
index f7885aa9e5..c1189103f9 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts
@@ -43,7 +43,9 @@ import {
RESOURCES,
ServerSecurityConfig,
TELEMETRY,
- ObjectIDVerTranslationMap
+ ObjectIDVerTranslationMap,
+ ObserveStrategy,
+ ObserveStrategyMap
} from './lwm2m-profile-config.models';
import { DeviceProfileService } from '@core/http/device-profile.service';
import { deepClone, isDefinedAndNotNull, isEmpty } from '@core/utils';
@@ -84,6 +86,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
objectIDVers = Object.values(ObjectIDVer) as ObjectIDVer[];
objectIDVerTranslationMap = ObjectIDVerTranslationMap;
+ observeStrategyList = Object.values(ObserveStrategy) as ObserveStrategy[];
+ observeStrategyMap = ObserveStrategyMap;
+
sortFunction: (key: string, value: object) => object;
@Input()
@@ -102,6 +107,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
observeAttrTelemetry: [null],
bootstrapServerUpdateEnable: [false],
bootstrap: [[]],
+ observeStrategy: [null, []],
clientLwM2mSettings: this.fb.group({
clientOnlyObserveAfterConnect: [1, []],
useObject19ForOtaInfo: [false],
@@ -173,6 +179,10 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
}
});
+ this.lwm2mDeviceProfileFormGroup.get('objectIds').valueChanges.pipe(
+ takeUntil(this.destroy$)
+ ).subscribe(value => this.updateObserveStrategy(value));
+
this.lwm2mDeviceProfileFormGroup.valueChanges.pipe(
takeUntil(this.destroy$)
).subscribe((value) => {
@@ -261,6 +271,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
observeAttrTelemetry: this.getObserveAttrTelemetryObjects(value),
bootstrap: this.configurationValue.bootstrap,
bootstrapServerUpdateEnable: this.configurationValue.bootstrapServerUpdateEnable || false,
+ observeStrategy: this.configurationValue.observeAttr.observeStrategy || ObserveStrategy.SINGLE,
clientLwM2mSettings: {
clientOnlyObserveAfterConnect: this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect,
useObject19ForOtaInfo: this.configurationValue.clientLwM2mSettings.useObject19ForOtaInfo ?? false,
@@ -283,6 +294,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.fwUpdateStrategy').updateValueAndValidity({onlySelf: true});
this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings.swUpdateStrategy').updateValueAndValidity({onlySelf: true});
}
+ this.updateObserveStrategy(value);
this.cd.markForCheck();
}
@@ -427,6 +439,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
const telemetryArray: Array = [];
const attributes: any = {};
const keyNameNew = {};
+ const observeStrategyValue = this.lwm2mDeviceProfileFormGroup.get('observeStrategy').value;
const observeJson: ObjectLwM2M[] = JSON.parse(JSON.stringify(val));
observeJson.forEach(obj => {
if (isDefinedAndNotNull(obj.attributes) && !isEmpty(obj.attributes)) {
@@ -467,7 +480,8 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
attribute: attributeArray,
telemetry: telemetryArray,
keyName: this.sortObjectKeyPathJson(KEY_NAME, keyNameNew),
- attributeLwm2m: attributes
+ attributeLwm2m: attributes,
+ observeStrategy: observeStrategyValue
};
}
@@ -568,4 +582,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
return this.lwm2mDeviceProfileFormGroup.get('clientLwM2mSettings') as UntypedFormGroup;
}
+ private updateObserveStrategy(value: ObjectLwM2M[]) {
+ if (value.length && !this.disabled) {
+ this.lwm2mDeviceProfileFormGroup.get('observeStrategy').enable({onlySelf: true});
+ } else {
+ this.lwm2mDeviceProfileFormGroup.get('observeStrategy').disable({onlySelf: true});
+ }
+ }
+
}
diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts
index 3972964a5b..48b6c3284c 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-profile-config.models.ts
@@ -136,6 +136,41 @@ export const ObjectIDVerTranslationMap = new Map(
]
);
+export interface ObserveStrategyData {
+ name: string;
+ description: string;
+}
+
+export enum ObserveStrategy {
+ SINGLE = 'SINGLE',
+ COMPOSITE_ALL = 'COMPOSITE_ALL',
+ COMPOSITE_BY_OBJECT = 'COMPOSITE_BY_OBJECT'
+}
+
+export const ObserveStrategyMap = new Map([
+ [
+ ObserveStrategy.SINGLE,
+ {
+ name: 'device-profile.lwm2m.observe-strategy.single',
+ description: 'device-profile.lwm2m.observe-strategy.single-description'
+ }
+ ],
+ [
+ ObserveStrategy.COMPOSITE_ALL,
+ {
+ name: 'device-profile.lwm2m.observe-strategy.composite-all',
+ description: 'device-profile.lwm2m.observe-strategy.composite-all-description'
+ }
+ ],
+ [
+ ObserveStrategy.COMPOSITE_BY_OBJECT,
+ {
+ name: 'device-profile.lwm2m.observe-strategy.composite-by-object',
+ description: 'device-profile.lwm2m.observe-strategy.composite-by-object-description'
+ }
+ ]
+]);
+
export interface ServerSecurityConfig {
host?: string;
port?: number;
@@ -187,6 +222,7 @@ export interface ObservableAttributes {
telemetry: string[];
keyName: {};
attributeLwm2m: AttributesNameValueMap;
+ observeStrategy: ObserveStrategy;
}
export function getDefaultProfileObserveAttrConfig(): ObservableAttributes {
@@ -195,7 +231,8 @@ export function getDefaultProfileObserveAttrConfig(): ObservableAttributes {
attribute: [],
telemetry: [],
keyName: {},
- attributeLwm2m: {}
+ attributeLwm2m: {},
+ observeStrategy: ObserveStrategy.SINGLE
};
}
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index b160a44b0e..8c8c7dd9f3 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -2209,6 +2209,15 @@
"v1-0": "1.0",
"v1-1": "1.1",
"v1-2": "1.2"
+ },
+ "observe-strategy": {
+ "observe-strategy": "Observe strategy",
+ "single": "Single",
+ "single-description": "One Observe request per resource (higher precision, more network traffic)",
+ "composite-all": "Composite all",
+ "composite-all-description": "All resources are observed with a single Composite Observe request (more efficient, less flexible)",
+ "composite-by-object": "Composite by objects",
+ "composite-by-object-description": "Resources are grouped by object type and observed using separate Composite Observe requests (balanced approach)"
}
},
"snmp": {