Commit 156c8cc2877d87f9d7a5f65cd98cc7f0d4dae332

Authored by nickAS21
1 parent 0710d272

lwm2m: front fix bug create profile lwm2mConfig

... ... @@ -127,9 +127,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
127 127 }
128 128
129 129 private initWriteValue = (): void => {
130   - const modelValue = {objectIds: null, objectsList: []} as ModelValue;
  130 + const modelValue = {objectIds: [], objectsList: []} as ModelValue;
131 131 modelValue.objectIds = this.getObjectsFromJsonAllConfig();
132   - if (modelValue.objectIds !== null) {
  132 + if (modelValue.objectIds.length > 0) {
133 133 const sortOrder = {
134 134 property: 'id',
135 135 direction: Direction.ASC
... ... @@ -205,13 +205,13 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
205 205 if (this.includesNotZeroInstance(attributeArray, telemetryArray)) {
206 206 this.addInstances(attributeArray, telemetryArray, objectLwM2MS);
207 207 }
208   - if (isDefinedAndNotNull(observeArray)) {
  208 + if (isDefinedAndNotNull(observeArray) && observeArray.length > 0) {
209 209 this.updateObserveAttrTelemetryObjects(observeArray, objectLwM2MS, OBSERVE);
210 210 }
211   - if (isDefinedAndNotNull(attributeArray)) {
  211 + if (isDefinedAndNotNull(attributeArray) && attributeArray.length > 0) {
212 212 this.updateObserveAttrTelemetryObjects(attributeArray, objectLwM2MS, ATTRIBUTE);
213 213 }
214   - if (isDefinedAndNotNull(telemetryArray)) {
  214 + if (isDefinedAndNotNull(telemetryArray) && telemetryArray.length > 0) {
215 215 this.updateObserveAttrTelemetryObjects(telemetryArray, objectLwM2MS, TELEMETRY);
216 216 }
217 217 if (isDefinedAndNotNull(keyNameJson)) {
... ... @@ -368,7 +368,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
368 368 });
369 369 }
370 370 }
371   - return (objectsIds.size > 0) ? Array.from(objectsIds) : null;
  371 + return (objectsIds.size > 0) ? Array.from(objectsIds) : [];
372 372 }
373 373
374 374 private upDateJsonAllConfig = (): void => {
... ...
... ... @@ -59,7 +59,7 @@ export const SECURITY_CONFIG_MODE_NAMES = new Map<SECURITY_CONFIG_MODE, string>(
59 59 );
60 60
61 61 export interface ModelValue {
62   - objectIds: string[] | null,
  62 + objectIds: string[],
63 63 objectsList: ObjectLwM2M[]
64 64 }
65 65
... ...