Commit b1204ebe5c2b110c276ab2d63eae3fd4b46b863b

Authored by YevhenBondarenko
1 parent 6d7a8706

added PowerMode for LwM2M

  1 +/**
  2 + * Copyright © 2016-2021 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +package org.thingsboard.server.common.data.device.data;
  17 +
  18 +public enum PowerMode {
  19 + PSM, DRX, E_DRX
  20 +}
@@ -16,12 +16,16 @@ @@ -16,12 +16,16 @@
16 package org.thingsboard.server.common.data.device.data.lwm2m; 16 package org.thingsboard.server.common.data.device.data.lwm2m;
17 17
18 import lombok.Data; 18 import lombok.Data;
  19 +import org.thingsboard.server.common.data.device.data.PowerMode;
19 20
20 @Data 21 @Data
21 public class OtherConfiguration { 22 public class OtherConfiguration {
22 23
23 private Integer fwUpdateStrategy; 24 private Integer fwUpdateStrategy;
  25 + private String fwUpdateResource;
24 private Integer swUpdateStrategy; 26 private Integer swUpdateStrategy;
  27 + private String swUpdateResource;
25 private Integer clientOnlyObserveAfterConnect; 28 private Integer clientOnlyObserveAfterConnect;
  29 + private PowerMode powerMode;
26 30
27 } 31 }
@@ -64,7 +64,7 @@ import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_ECDHE @@ -64,7 +64,7 @@ import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_ECDHE
64 import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_WITH_AES_128_CBC_SHA256; 64 import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_WITH_AES_128_CBC_SHA256;
65 import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_WITH_AES_128_CCM_8; 65 import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_WITH_AES_128_CCM_8;
66 import static org.thingsboard.server.transport.lwm2m.server.LwM2mNetworkConfig.getCoapConfig; 66 import static org.thingsboard.server.transport.lwm2m.server.LwM2mNetworkConfig.getCoapConfig;
67 -import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FIRMWARE_UPDATE_COAP_RECOURSE; 67 +import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FIRMWARE_UPDATE_COAP_RESOURCE;
68 68
69 @Slf4j 69 @Slf4j
70 @Component 70 @Component
@@ -104,7 +104,7 @@ public class DefaultLwM2mTransportService implements LwM2MTransportService { @@ -104,7 +104,7 @@ public class DefaultLwM2mTransportService implements LwM2MTransportService {
104 */ 104 */
105 105
106 106
107 - LwM2mTransportCoapResource otaCoapResource = new LwM2mTransportCoapResource(handler, FIRMWARE_UPDATE_COAP_RECOURSE); 107 + LwM2mTransportCoapResource otaCoapResource = new LwM2mTransportCoapResource(handler, FIRMWARE_UPDATE_COAP_RESOURCE);
108 this.server.coap().getServer().add(otaCoapResource); 108 this.server.coap().getServer().add(otaCoapResource);
109 this.startLhServer(); 109 this.startLhServer();
110 this.context.setServer(server); 110 this.context.setServer(server);
@@ -32,8 +32,8 @@ import java.util.concurrent.ConcurrentHashMap; @@ -32,8 +32,8 @@ import java.util.concurrent.ConcurrentHashMap;
32 import java.util.concurrent.ConcurrentMap; 32 import java.util.concurrent.ConcurrentMap;
33 import java.util.concurrent.atomic.AtomicInteger; 33 import java.util.concurrent.atomic.AtomicInteger;
34 34
35 -import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FIRMWARE_UPDATE_COAP_RECOURSE;  
36 -import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.SOFTWARE_UPDATE_COAP_RECOURSE; 35 +import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FIRMWARE_UPDATE_COAP_RESOURCE;
  36 +import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.SOFTWARE_UPDATE_COAP_RESOURCE;
37 37
38 @Slf4j 38 @Slf4j
39 public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { 39 public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource {
@@ -72,8 +72,8 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { @@ -72,8 +72,8 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource {
72 protected void processHandleGet(CoapExchange exchange) { 72 protected void processHandleGet(CoapExchange exchange) {
73 log.warn("90) processHandleGet [{}]", exchange); 73 log.warn("90) processHandleGet [{}]", exchange);
74 if (exchange.getRequestOptions().getUriPath().size() >= 2 && 74 if (exchange.getRequestOptions().getUriPath().size() >= 2 &&
75 - (FIRMWARE_UPDATE_COAP_RECOURSE.equals(exchange.getRequestOptions().getUriPath().get(exchange.getRequestOptions().getUriPath().size()-2)) ||  
76 - SOFTWARE_UPDATE_COAP_RECOURSE.equals(exchange.getRequestOptions().getUriPath().get(exchange.getRequestOptions().getUriPath().size()-2)))) { 75 + (FIRMWARE_UPDATE_COAP_RESOURCE.equals(exchange.getRequestOptions().getUriPath().get(exchange.getRequestOptions().getUriPath().size()-2)) ||
  76 + SOFTWARE_UPDATE_COAP_RESOURCE.equals(exchange.getRequestOptions().getUriPath().get(exchange.getRequestOptions().getUriPath().size()-2)))) {
77 this.sendOtaData(exchange); 77 this.sendOtaData(exchange);
78 } 78 }
79 } 79 }
@@ -137,7 +137,7 @@ public class LwM2mTransportUtil { @@ -137,7 +137,7 @@ public class LwM2mTransportUtil {
137 137
138 138
139 // Firmware 139 // Firmware
140 - public static final String FIRMWARE_UPDATE_COAP_RECOURSE = "firmwareUpdateCoapRecourse"; 140 + public static final String FIRMWARE_UPDATE_COAP_RESOURCE = "firmwareUpdateCoapResource";
141 public static final String FW_UPDATE = "Firmware update"; 141 public static final String FW_UPDATE = "Firmware update";
142 public static final Integer FW_5_ID = 5; 142 public static final Integer FW_5_ID = 5;
143 public static final Integer FW_19_ID = 19; 143 public static final Integer FW_19_ID = 19;
@@ -169,7 +169,7 @@ public class LwM2mTransportUtil { @@ -169,7 +169,7 @@ public class LwM2mTransportUtil {
169 public static final String FW_UPDATE_ID = "/5/0/2"; 169 public static final String FW_UPDATE_ID = "/5/0/2";
170 170
171 // Software 171 // Software
172 - public static final String SOFTWARE_UPDATE_COAP_RECOURSE = "softwareUpdateCoapRecourse"; 172 + public static final String SOFTWARE_UPDATE_COAP_RESOURCE = "softwareUpdateCoapResource";
173 public static final String SW_UPDATE = "Software update"; 173 public static final String SW_UPDATE = "Software update";
174 public static final Integer SW_ID = 9; 174 public static final Integer SW_ID = 9;
175 // Package W 175 // Package W
@@ -49,7 +49,7 @@ import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.INIT @@ -49,7 +49,7 @@ import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.INIT
49 import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.UPDATED; 49 import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.UPDATED;
50 import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.UPDATING; 50 import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.UPDATING;
51 import static org.thingsboard.server.common.data.ota.OtaPackageUtil.getAttributeKey; 51 import static org.thingsboard.server.common.data.ota.OtaPackageUtil.getAttributeKey;
52 -import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FIRMWARE_UPDATE_COAP_RECOURSE; 52 +import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FIRMWARE_UPDATE_COAP_RESOURCE;
53 import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_3_VER_ID; 53 import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_3_VER_ID;
54 import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_5_VER_ID; 54 import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_5_VER_ID;
55 import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_NAME_ID; 55 import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_NAME_ID;
@@ -199,7 +199,7 @@ public class LwM2mFwSwUpdate { @@ -199,7 +199,7 @@ public class LwM2mFwSwUpdate {
199 request.sendWriteReplaceRequest(lwM2MClient, downlink, new TbLwM2MWriteResponseCallback(handler, lwM2MClient, targetIdVer)); 199 request.sendWriteReplaceRequest(lwM2MClient, downlink, new TbLwM2MWriteResponseCallback(handler, lwM2MClient, targetIdVer));
200 } else if (LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_5_TEMP_URL.code == this.updateStrategy) { 200 } else if (LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_5_TEMP_URL.code == this.updateStrategy) {
201 String apiFont = "coap://176.36.143.9:5685"; 201 String apiFont = "coap://176.36.143.9:5685";
202 - String uri = apiFont + "/" + FIRMWARE_UPDATE_COAP_RECOURSE + "/" + this.currentId.toString(); 202 + String uri = apiFont + "/" + FIRMWARE_UPDATE_COAP_RESOURCE + "/" + this.currentId.toString();
203 log.warn("89) coapUri: [{}]", uri); 203 log.warn("89) coapUri: [{}]", uri);
204 //TODO: user this.rpcRequest??? 204 //TODO: user this.rpcRequest???
205 TbLwM2MWriteReplaceRequest downlink = TbLwM2MWriteReplaceRequest.builder().versionedId(targetIdVer).value(uri).timeout(handler.config.getTimeout()).build(); 205 TbLwM2MWriteReplaceRequest downlink = TbLwM2MWriteReplaceRequest.builder().versionedId(targetIdVer).value(uri).timeout(handler.config.getTimeout()).build();
@@ -126,10 +126,10 @@ @@ -126,10 +126,10 @@
126 </mat-select> 126 </mat-select>
127 </mat-form-field> 127 </mat-form-field>
128 <mat-form-field class="mat-block" fxFlex *ngIf="isFwUpdateStrategy"> 128 <mat-form-field class="mat-block" fxFlex *ngIf="isFwUpdateStrategy">
129 - <mat-label>{{ 'device-profile.lwm2m.fw-update-recourse' | translate }}</mat-label>  
130 - <input matInput formControlName="fwUpdateRecourse" required>  
131 - <mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').hasError('required')">  
132 - {{ 'device-profile.lwm2m.fw-update-recourse-required' | translate }} 129 + <mat-label>{{ 'device-profile.lwm2m.fw-update-resource' | translate }}</mat-label>
  130 + <input matInput formControlName="fwUpdateResource" required>
  131 + <mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('fwUpdateResource').hasError('required')">
  132 + {{ 'device-profile.lwm2m.fw-update-resource-required' | translate }}
133 </mat-error> 133 </mat-error>
134 </mat-form-field> 134 </mat-form-field>
135 </fieldset> 135 </fieldset>
@@ -143,13 +143,25 @@ @@ -143,13 +143,25 @@
143 </mat-select> 143 </mat-select>
144 </mat-form-field> 144 </mat-form-field>
145 <mat-form-field class="mat-block" fxFlex *ngIf="isSwUpdateStrategy"> 145 <mat-form-field class="mat-block" fxFlex *ngIf="isSwUpdateStrategy">
146 - <mat-label>{{ 'device-profile.lwm2m.sw-update-recourse' | translate }}</mat-label>  
147 - <input matInput formControlName="swUpdateRecourse" required>  
148 - <mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').hasError('required')">  
149 - {{ 'device-profile.lwm2m.sw-update-recourse-required' | translate }} 146 + <mat-label>{{ 'device-profile.lwm2m.sw-update-resource' | translate }}</mat-label>
  147 + <input matInput formControlName="swUpdateResource" required>
  148 + <mat-error *ngIf="lwm2mDeviceProfileFormGroup.get('swUpdateResource').hasError('required')">
  149 + {{ 'device-profile.lwm2m.sw-update-resource-required' | translate }}
150 </mat-error> 150 </mat-error>
151 </mat-form-field> 151 </mat-form-field>
152 </fieldset> 152 </fieldset>
  153 + <fieldset class="fields-group">
  154 + <legend class="group-title" translate>device-profile.lwm2m.power-mode</legend>
  155 + <mat-form-field class="mat-block" fxFlex>
  156 + <mat-label> </mat-label>
  157 + <mat-select formControlName="powerMode">
  158 + <mat-option *ngFor="let powerMode of powerModeLwM2MTypes"
  159 + [value]="powerMode">
  160 + {{ powerModeLwM2MNamesMap.get(powerModeLwM2MType[powerMode]) }}
  161 + </mat-option>
  162 + </mat-select>
  163 + </mat-form-field>
  164 + </fieldset>
153 <!-- <mat-accordion multi="true">--> 165 <!-- <mat-accordion multi="true">-->
154 <!-- <div *ngIf="false">--> 166 <!-- <div *ngIf="false">-->
155 <!-- <mat-expansion-panel>--> 167 <!-- <mat-expansion-panel>-->
@@ -160,9 +172,9 @@ @@ -160,9 +172,9 @@
160 <!-- <div fxLayout="column">--> 172 <!-- <div fxLayout="column">-->
161 <!-- <mat-form-field class="mat-block">--> 173 <!-- <mat-form-field class="mat-block">-->
162 <!-- <mat-label>{{ 'device-profile.lwm2m.client-strategy-label' | translate }}</mat-label>--> 174 <!-- <mat-label>{{ 'device-profile.lwm2m.client-strategy-label' | translate }}</mat-label>-->
163 -<!-- <mat-select formControlName="clientStrategy"--> 175 +<!-- <mat-select formControlName="clientOnlyObserveAfterConnect"-->
164 <!-- matTooltip="{{ 'device-profile.lwm2m.client-strategy-tip' | translate:--> 176 <!-- matTooltip="{{ 'device-profile.lwm2m.client-strategy-tip' | translate:-->
165 -<!-- { count: +lwm2mDeviceProfileFormGroup.get('clientStrategy').value } }}"--> 177 +<!-- { count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value } }}"-->
166 <!-- matTooltipPosition="above">--> 178 <!-- matTooltipPosition="above">-->
167 <!-- <mat-option value=1>{{ 'device-profile.lwm2m.client-strategy-connect' | translate:--> 179 <!-- <mat-option value=1>{{ 'device-profile.lwm2m.client-strategy-connect' | translate:-->
168 <!-- {count: 1} }}</mat-option>--> 180 <!-- {count: 1} }}</mat-option>-->
@@ -32,7 +32,7 @@ import { @@ -32,7 +32,7 @@ import {
32 ModelValue, 32 ModelValue,
33 ObjectLwM2M, 33 ObjectLwM2M,
34 OBSERVE, 34 OBSERVE,
35 - OBSERVE_ATTR_TELEMETRY, 35 + OBSERVE_ATTR_TELEMETRY, powerMode, powerModeNames,
36 RESOURCES, 36 RESOURCES,
37 TELEMETRY 37 TELEMETRY
38 } from './lwm2m-profile-config.models'; 38 } from './lwm2m-profile-config.models';
@@ -72,6 +72,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -72,6 +72,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
72 sortFunction: (key: string, value: object) => object; 72 sortFunction: (key: string, value: object) => object;
73 isFwUpdateStrategy: boolean; 73 isFwUpdateStrategy: boolean;
74 isSwUpdateStrategy: boolean; 74 isSwUpdateStrategy: boolean;
  75 + powerModeLwM2MType = powerMode;
  76 + powerModeLwM2MTypes = Object.keys(powerMode);
  77 + powerModeLwM2MNamesMap = powerModeNames;
75 78
76 get required(): boolean { 79 get required(): boolean {
77 return this.requiredValue; 80 return this.requiredValue;
@@ -97,11 +100,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -97,11 +100,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
97 binding: [], 100 binding: [],
98 bootstrapServer: [null, Validators.required], 101 bootstrapServer: [null, Validators.required],
99 lwm2mServer: [null, Validators.required], 102 lwm2mServer: [null, Validators.required],
100 - clientStrategy: [1, []], 103 + clientOnlyObserveAfterConnect: [1, []],
101 fwUpdateStrategy: [1, []], 104 fwUpdateStrategy: [1, []],
102 swUpdateStrategy: [1, []], 105 swUpdateStrategy: [1, []],
103 - fwUpdateRecourse: [{value: '', disabled: true}, []],  
104 - swUpdateRecourse: [{value: '', disabled: true}, []] 106 + fwUpdateResource: [{value: '', disabled: true}, []],
  107 + swUpdateResource: [{value: '', disabled: true}, []],
  108 + powerMode: [null, Validators.required]
105 }); 109 });
106 this.lwm2mDeviceConfigFormGroup = this.fb.group({ 110 this.lwm2mDeviceConfigFormGroup = this.fb.group({
107 configurationJson: [null, Validators.required] 111 configurationJson: [null, Validators.required]
@@ -110,11 +114,11 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -110,11 +114,11 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
110 takeUntil(this.destroy$) 114 takeUntil(this.destroy$)
111 ).subscribe((fwStrategy) => { 115 ).subscribe((fwStrategy) => {
112 if (fwStrategy === 2) { 116 if (fwStrategy === 2) {
113 - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').enable({emitEvent: false});  
114 - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').patchValue(DEFAULT_FW_UPDATE_RESOURCE, {emitEvent: false}); 117 + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').enable({emitEvent: false});
  118 + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').patchValue(DEFAULT_FW_UPDATE_RESOURCE, {emitEvent: false});
115 this.isFwUpdateStrategy = true; 119 this.isFwUpdateStrategy = true;
116 } else { 120 } else {
117 - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').disable({emitEvent: false}); 121 + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').disable({emitEvent: false});
118 this.isFwUpdateStrategy = false; 122 this.isFwUpdateStrategy = false;
119 } 123 }
120 this.otaUpdateFwStrategyValidate(true); 124 this.otaUpdateFwStrategyValidate(true);
@@ -123,12 +127,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -123,12 +127,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
123 takeUntil(this.destroy$) 127 takeUntil(this.destroy$)
124 ).subscribe((swStrategy) => { 128 ).subscribe((swStrategy) => {
125 if (swStrategy === 2) { 129 if (swStrategy === 2) {
126 - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').enable({emitEvent: false});  
127 - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').patchValue(DEFAULT_SW_UPDATE_RESOURCE, {emitEvent: false}); 130 + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').enable({emitEvent: false});
  131 + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').patchValue(DEFAULT_SW_UPDATE_RESOURCE, {emitEvent: false});
128 this.isSwUpdateStrategy = true; 132 this.isSwUpdateStrategy = true;
129 } else { 133 } else {
130 this.isSwUpdateStrategy = false; 134 this.isSwUpdateStrategy = false;
131 - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').disable({emitEvent: false}); 135 + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').disable({emitEvent: false});
132 } 136 }
133 this.otaUpdateSwStrategyValidate(true); 137 this.otaUpdateSwStrategyValidate(true);
134 }); 138 });
@@ -202,10 +206,10 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -202,10 +206,10 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
202 } 206 }
203 207
204 private updateWriteValue = (value: ModelValue): void => { 208 private updateWriteValue = (value: ModelValue): void => {
205 - const fwResource = isDefinedAndNotNull(this.configurationValue.clientLwM2mSettings.fwUpdateRecourse) ?  
206 - this.configurationValue.clientLwM2mSettings.fwUpdateRecourse : '';  
207 - const swResource = isDefinedAndNotNull(this.configurationValue.clientLwM2mSettings.fwUpdateRecourse) ?  
208 - this.configurationValue.clientLwM2mSettings.swUpdateRecourse : ''; 209 + const fwResource = isDefinedAndNotNull(this.configurationValue.clientLwM2mSettings.fwUpdateResource) ?
  210 + this.configurationValue.clientLwM2mSettings.fwUpdateResource : '';
  211 + const swResource = isDefinedAndNotNull(this.configurationValue.clientLwM2mSettings.fwUpdateResource) ?
  212 + this.configurationValue.clientLwM2mSettings.swUpdateResource : '';
209 this.lwm2mDeviceProfileFormGroup.patchValue({ 213 this.lwm2mDeviceProfileFormGroup.patchValue({
210 objectIds: value, 214 objectIds: value,
211 observeAttrTelemetry: this.getObserveAttrTelemetryObjects(value.objectsList), 215 observeAttrTelemetry: this.getObserveAttrTelemetryObjects(value.objectsList),
@@ -216,15 +220,16 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -216,15 +220,16 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
216 binding: this.configurationValue.bootstrap.servers.binding, 220 binding: this.configurationValue.bootstrap.servers.binding,
217 bootstrapServer: this.configurationValue.bootstrap.bootstrapServer, 221 bootstrapServer: this.configurationValue.bootstrap.bootstrapServer,
218 lwm2mServer: this.configurationValue.bootstrap.lwm2mServer, 222 lwm2mServer: this.configurationValue.bootstrap.lwm2mServer,
219 - clientStrategy: this.configurationValue.clientLwM2mSettings.clientStrategy, 223 + clientOnlyObserveAfterConnect: this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect,
220 fwUpdateStrategy: this.configurationValue.clientLwM2mSettings.fwUpdateStrategy || 1, 224 fwUpdateStrategy: this.configurationValue.clientLwM2mSettings.fwUpdateStrategy || 1,
221 swUpdateStrategy: this.configurationValue.clientLwM2mSettings.swUpdateStrategy || 1, 225 swUpdateStrategy: this.configurationValue.clientLwM2mSettings.swUpdateStrategy || 1,
222 - fwUpdateRecourse: fwResource,  
223 - swUpdateRecourse: swResource 226 + fwUpdateResource: fwResource,
  227 + swUpdateResource: swResource,
  228 + powerMode: this.configurationValue.clientLwM2mSettings.powerMode
224 }, 229 },
225 {emitEvent: false}); 230 {emitEvent: false});
226 - this.configurationValue.clientLwM2mSettings.fwUpdateRecourse = fwResource;  
227 - this.configurationValue.clientLwM2mSettings.swUpdateRecourse = swResource; 231 + this.configurationValue.clientLwM2mSettings.fwUpdateResource = fwResource;
  232 + this.configurationValue.clientLwM2mSettings.swUpdateResource = swResource;
228 this.isFwUpdateStrategy = this.configurationValue.clientLwM2mSettings.fwUpdateStrategy === 2; 233 this.isFwUpdateStrategy = this.configurationValue.clientLwM2mSettings.fwUpdateStrategy === 2;
229 this.isSwUpdateStrategy = this.configurationValue.clientLwM2mSettings.swUpdateStrategy === 2; 234 this.isSwUpdateStrategy = this.configurationValue.clientLwM2mSettings.swUpdateStrategy === 2;
230 this.otaUpdateSwStrategyValidate(); 235 this.otaUpdateSwStrategyValidate();
@@ -257,11 +262,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -257,11 +262,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
257 bootstrapServers.defaultMinPeriod = config.defaultMinPeriod; 262 bootstrapServers.defaultMinPeriod = config.defaultMinPeriod;
258 bootstrapServers.notifIfDisabled = config.notifIfDisabled; 263 bootstrapServers.notifIfDisabled = config.notifIfDisabled;
259 bootstrapServers.binding = config.binding; 264 bootstrapServers.binding = config.binding;
260 - this.configurationValue.clientLwM2mSettings.clientStrategy = config.clientStrategy; 265 + this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect = config.clientOnlyObserveAfterConnect;
261 this.configurationValue.clientLwM2mSettings.fwUpdateStrategy = config.fwUpdateStrategy; 266 this.configurationValue.clientLwM2mSettings.fwUpdateStrategy = config.fwUpdateStrategy;
262 this.configurationValue.clientLwM2mSettings.swUpdateStrategy = config.swUpdateStrategy; 267 this.configurationValue.clientLwM2mSettings.swUpdateStrategy = config.swUpdateStrategy;
263 - this.configurationValue.clientLwM2mSettings.fwUpdateRecourse = config.fwUpdateRecourse;  
264 - this.configurationValue.clientLwM2mSettings.swUpdateRecourse = config.swUpdateRecourse; 268 + this.configurationValue.clientLwM2mSettings.fwUpdateResource = config.fwUpdateResource;
  269 + this.configurationValue.clientLwM2mSettings.swUpdateResource = config.swUpdateResource;
  270 + this.configurationValue.clientLwM2mSettings.powerMode = config.powerMode;
265 this.upDateJsonAllConfig(); 271 this.upDateJsonAllConfig();
266 } 272 }
267 this.updateModel(); 273 this.updateModel();
@@ -539,20 +545,20 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro @@ -539,20 +545,20 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro
539 545
540 private otaUpdateFwStrategyValidate(updated = false): void { 546 private otaUpdateFwStrategyValidate(updated = false): void {
541 if (this.isFwUpdateStrategy) { 547 if (this.isFwUpdateStrategy) {
542 - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').setValidators([Validators.required]); 548 + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').setValidators([Validators.required]);
543 } else { 549 } else {
544 - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').clearValidators(); 550 + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').clearValidators();
545 } 551 }
546 - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').updateValueAndValidity({emitEvent: updated}); 552 + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').updateValueAndValidity({emitEvent: updated});
547 } 553 }
548 554
549 private otaUpdateSwStrategyValidate(updated = false): void { 555 private otaUpdateSwStrategyValidate(updated = false): void {
550 if (this.isSwUpdateStrategy) { 556 if (this.isSwUpdateStrategy) {
551 - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').setValidators([Validators.required]); 557 + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').setValidators([Validators.required]);
552 } else { 558 } else {
553 - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').clearValidators(); 559 + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').clearValidators();
554 } 560 }
555 - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').updateValueAndValidity({emitEvent: updated}); 561 + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').updateValueAndValidity({emitEvent: updated});
556 } 562 }
557 563
558 } 564 }
@@ -128,6 +128,20 @@ export const securityConfigModeNames = new Map<securityConfigMode, string>( @@ -128,6 +128,20 @@ export const securityConfigModeNames = new Map<securityConfigMode, string>(
128 ] 128 ]
129 ); 129 );
130 130
  131 +export enum powerMode {
  132 + PSM = 'PSM',
  133 + DRX = 'DRX',
  134 + E_DRX = 'E_DRX'
  135 +}
  136 +
  137 +export const powerModeNames = new Map<powerMode, string>(
  138 + [
  139 + [powerMode.PSM, 'Power Saving Mode (PSM)'],
  140 + [powerMode.DRX, 'Discontinuous Reception (DRX)'],
  141 + [powerMode.E_DRX, 'Extended Discontinuous Reception (eDRX)']
  142 + ]
  143 +);
  144 +
131 export interface ModelValue { 145 export interface ModelValue {
132 objectIds: string[]; 146 objectIds: string[];
133 objectsList: ObjectLwM2M[]; 147 objectsList: ObjectLwM2M[];
@@ -168,11 +182,12 @@ export interface Lwm2mProfileConfigModels { @@ -168,11 +182,12 @@ export interface Lwm2mProfileConfigModels {
168 } 182 }
169 183
170 export interface ClientLwM2mSettings { 184 export interface ClientLwM2mSettings {
171 - clientStrategy: string; 185 + clientOnlyObserveAfterConnect: string;
172 fwUpdateStrategy: number; 186 fwUpdateStrategy: number;
173 swUpdateStrategy: number; 187 swUpdateStrategy: number;
174 - fwUpdateRecourse: string;  
175 - swUpdateRecourse: string; 188 + fwUpdateResource: string;
  189 + swUpdateResource: string;
  190 + powerMode: powerMode;
176 } 191 }
177 192
178 export interface ObservableAttributes { 193 export interface ObservableAttributes {
@@ -240,11 +255,12 @@ export function getDefaultProfileConfig(hostname?: any): Lwm2mProfileConfigModel @@ -240,11 +255,12 @@ export function getDefaultProfileConfig(hostname?: any): Lwm2mProfileConfigModel
240 255
241 function getDefaultProfileClientLwM2mSettingsConfig(): ClientLwM2mSettings { 256 function getDefaultProfileClientLwM2mSettingsConfig(): ClientLwM2mSettings {
242 return { 257 return {
243 - clientStrategy: '1', 258 + clientOnlyObserveAfterConnect: '1',
244 fwUpdateStrategy: 1, 259 fwUpdateStrategy: 1,
245 swUpdateStrategy: 1, 260 swUpdateStrategy: 1,
246 - fwUpdateRecourse: DEFAULT_FW_UPDATE_RESOURCE,  
247 - swUpdateRecourse: DEFAULT_SW_UPDATE_RESOURCE 261 + fwUpdateResource: DEFAULT_FW_UPDATE_RESOURCE,
  262 + swUpdateResource: DEFAULT_SW_UPDATE_RESOURCE,
  263 + powerMode: powerMode.DRX
248 }; 264 };
249 } 265 }
250 266
@@ -1288,11 +1288,12 @@ @@ -1288,11 +1288,12 @@
1288 "sw-update-strategy": "Software update strategy", 1288 "sw-update-strategy": "Software update strategy",
1289 "sw-update-strategy-package": "Push binary file using Object 9 and Resource 2 (Package)", 1289 "sw-update-strategy-package": "Push binary file using Object 9 and Resource 2 (Package)",
1290 "sw-update-strategy-package-uri": "Auto-generate unique CoAP URL to download the package and push software update using Object 9 and Resource 3 (Package URI)", 1290 "sw-update-strategy-package-uri": "Auto-generate unique CoAP URL to download the package and push software update using Object 9 and Resource 3 (Package URI)",
1291 - "fw-update-recourse": "Firmware update CoAP recourse",  
1292 - "fw-update-recourse-required": "Firmware update CoAP recourse is required.",  
1293 - "sw-update-recourse": "Software update CoAP recourse",  
1294 - "sw-update-recourse-required": "Software update CoAP recourse is required.",  
1295 - "config-json-tab": "Json Config Profile Device" 1291 + "fw-update-resource": "Firmware update CoAP resource",
  1292 + "fw-update-resource-required": "Firmware update CoAP resource is required.",
  1293 + "sw-update-resource": "Software update CoAP resource",
  1294 + "sw-update-resource-required": "Software update CoAP resource is required.",
  1295 + "config-json-tab": "Json Config Profile Device",
  1296 + "power-mode": "Power Mode"
1296 } 1297 }
1297 }, 1298 },
1298 "dialog": { 1299 "dialog": {