Showing
10 changed files
with
118 additions
and
59 deletions
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 | 16 | package org.thingsboard.server.common.data.device.data.lwm2m; |
17 | 17 | |
18 | 18 | import lombok.Data; |
19 | +import org.thingsboard.server.common.data.device.data.PowerMode; | |
19 | 20 | |
20 | 21 | @Data |
21 | 22 | public class OtherConfiguration { |
22 | 23 | |
23 | 24 | private Integer fwUpdateStrategy; |
25 | + private String fwUpdateResource; | |
24 | 26 | private Integer swUpdateStrategy; |
27 | + private String swUpdateResource; | |
25 | 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 | 64 | import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_WITH_AES_128_CBC_SHA256; |
65 | 65 | import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_WITH_AES_128_CCM_8; |
66 | 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 | 69 | @Slf4j |
70 | 70 | @Component |
... | ... | @@ -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 | 108 | this.server.coap().getServer().add(otaCoapResource); |
109 | 109 | this.startLhServer(); |
110 | 110 | this.context.setServer(server); | ... | ... |
... | ... | @@ -32,8 +32,8 @@ import java.util.concurrent.ConcurrentHashMap; |
32 | 32 | import java.util.concurrent.ConcurrentMap; |
33 | 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 | 38 | @Slf4j |
39 | 39 | public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { |
... | ... | @@ -72,8 +72,8 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource { |
72 | 72 | protected void processHandleGet(CoapExchange exchange) { |
73 | 73 | log.warn("90) processHandleGet [{}]", exchange); |
74 | 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 | 77 | this.sendOtaData(exchange); |
78 | 78 | } |
79 | 79 | } | ... | ... |
... | ... | @@ -137,7 +137,7 @@ public class LwM2mTransportUtil { |
137 | 137 | |
138 | 138 | |
139 | 139 | // Firmware |
140 | - public static final String FIRMWARE_UPDATE_COAP_RECOURSE = "firmwareUpdateCoapRecourse"; | |
140 | + public static final String FIRMWARE_UPDATE_COAP_RESOURCE = "firmwareUpdateCoapResource"; | |
141 | 141 | public static final String FW_UPDATE = "Firmware update"; |
142 | 142 | public static final Integer FW_5_ID = 5; |
143 | 143 | public static final Integer FW_19_ID = 19; |
... | ... | @@ -169,7 +169,7 @@ public class LwM2mTransportUtil { |
169 | 169 | public static final String FW_UPDATE_ID = "/5/0/2"; |
170 | 170 | |
171 | 171 | // Software |
172 | - public static final String SOFTWARE_UPDATE_COAP_RECOURSE = "softwareUpdateCoapRecourse"; | |
172 | + public static final String SOFTWARE_UPDATE_COAP_RESOURCE = "softwareUpdateCoapResource"; | |
173 | 173 | public static final String SW_UPDATE = "Software update"; |
174 | 174 | public static final Integer SW_ID = 9; |
175 | 175 | // Package W | ... | ... |
... | ... | @@ -49,7 +49,7 @@ import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.INIT |
49 | 49 | import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.UPDATED; |
50 | 50 | import static org.thingsboard.server.common.data.ota.OtaPackageUpdateStatus.UPDATING; |
51 | 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 | 53 | import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_3_VER_ID; |
54 | 54 | import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_5_VER_ID; |
55 | 55 | import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportUtil.FW_NAME_ID; |
... | ... | @@ -199,7 +199,7 @@ public class LwM2mFwSwUpdate { |
199 | 199 | request.sendWriteReplaceRequest(lwM2MClient, downlink, new TbLwM2MWriteResponseCallback(handler, lwM2MClient, targetIdVer)); |
200 | 200 | } else if (LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_5_TEMP_URL.code == this.updateStrategy) { |
201 | 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 | 203 | log.warn("89) coapUri: [{}]", uri); |
204 | 204 | //TODO: user this.rpcRequest??? |
205 | 205 | TbLwM2MWriteReplaceRequest downlink = TbLwM2MWriteReplaceRequest.builder().versionedId(targetIdVer).value(uri).timeout(handler.config.getTimeout()).build(); | ... | ... |
... | ... | @@ -126,10 +126,10 @@ |
126 | 126 | </mat-select> |
127 | 127 | </mat-form-field> |
128 | 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 | 133 | </mat-error> |
134 | 134 | </mat-form-field> |
135 | 135 | </fieldset> |
... | ... | @@ -143,13 +143,25 @@ |
143 | 143 | </mat-select> |
144 | 144 | </mat-form-field> |
145 | 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 | 150 | </mat-error> |
151 | 151 | </mat-form-field> |
152 | 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 | 165 | <!-- <mat-accordion multi="true">--> |
154 | 166 | <!-- <div *ngIf="false">--> |
155 | 167 | <!-- <mat-expansion-panel>--> |
... | ... | @@ -160,9 +172,9 @@ |
160 | 172 | <!-- <div fxLayout="column">--> |
161 | 173 | <!-- <mat-form-field class="mat-block">--> |
162 | 174 | <!-- <mat-label>{{ 'device-profile.lwm2m.client-strategy-label' | translate }}</mat-label>--> |
163 | -<!-- <mat-select formControlName="clientStrategy"--> | |
175 | +<!-- <mat-select formControlName="clientOnlyObserveAfterConnect"--> | |
164 | 176 | <!-- matTooltip="{{ 'device-profile.lwm2m.client-strategy-tip' | translate:--> |
165 | -<!-- { count: +lwm2mDeviceProfileFormGroup.get('clientStrategy').value } }}"--> | |
177 | +<!-- { count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value } }}"--> | |
166 | 178 | <!-- matTooltipPosition="above">--> |
167 | 179 | <!-- <mat-option value=1>{{ 'device-profile.lwm2m.client-strategy-connect' | translate:--> |
168 | 180 | <!-- {count: 1} }}</mat-option>--> | ... | ... |
... | ... | @@ -32,7 +32,7 @@ import { |
32 | 32 | ModelValue, |
33 | 33 | ObjectLwM2M, |
34 | 34 | OBSERVE, |
35 | - OBSERVE_ATTR_TELEMETRY, | |
35 | + OBSERVE_ATTR_TELEMETRY, powerMode, powerModeNames, | |
36 | 36 | RESOURCES, |
37 | 37 | TELEMETRY |
38 | 38 | } from './lwm2m-profile-config.models'; |
... | ... | @@ -72,6 +72,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
72 | 72 | sortFunction: (key: string, value: object) => object; |
73 | 73 | isFwUpdateStrategy: boolean; |
74 | 74 | isSwUpdateStrategy: boolean; |
75 | + powerModeLwM2MType = powerMode; | |
76 | + powerModeLwM2MTypes = Object.keys(powerMode); | |
77 | + powerModeLwM2MNamesMap = powerModeNames; | |
75 | 78 | |
76 | 79 | get required(): boolean { |
77 | 80 | return this.requiredValue; |
... | ... | @@ -97,11 +100,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
97 | 100 | binding: [], |
98 | 101 | bootstrapServer: [null, Validators.required], |
99 | 102 | lwm2mServer: [null, Validators.required], |
100 | - clientStrategy: [1, []], | |
103 | + clientOnlyObserveAfterConnect: [1, []], | |
101 | 104 | fwUpdateStrategy: [1, []], |
102 | 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 | 110 | this.lwm2mDeviceConfigFormGroup = this.fb.group({ |
107 | 111 | configurationJson: [null, Validators.required] |
... | ... | @@ -110,11 +114,11 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
110 | 114 | takeUntil(this.destroy$) |
111 | 115 | ).subscribe((fwStrategy) => { |
112 | 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 | 119 | this.isFwUpdateStrategy = true; |
116 | 120 | } else { |
117 | - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').disable({emitEvent: false}); | |
121 | + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').disable({emitEvent: false}); | |
118 | 122 | this.isFwUpdateStrategy = false; |
119 | 123 | } |
120 | 124 | this.otaUpdateFwStrategyValidate(true); |
... | ... | @@ -123,12 +127,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
123 | 127 | takeUntil(this.destroy$) |
124 | 128 | ).subscribe((swStrategy) => { |
125 | 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 | 132 | this.isSwUpdateStrategy = true; |
129 | 133 | } else { |
130 | 134 | this.isSwUpdateStrategy = false; |
131 | - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').disable({emitEvent: false}); | |
135 | + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').disable({emitEvent: false}); | |
132 | 136 | } |
133 | 137 | this.otaUpdateSwStrategyValidate(true); |
134 | 138 | }); |
... | ... | @@ -202,10 +206,10 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
202 | 206 | } |
203 | 207 | |
204 | 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 | 213 | this.lwm2mDeviceProfileFormGroup.patchValue({ |
210 | 214 | objectIds: value, |
211 | 215 | observeAttrTelemetry: this.getObserveAttrTelemetryObjects(value.objectsList), |
... | ... | @@ -216,15 +220,16 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
216 | 220 | binding: this.configurationValue.bootstrap.servers.binding, |
217 | 221 | bootstrapServer: this.configurationValue.bootstrap.bootstrapServer, |
218 | 222 | lwm2mServer: this.configurationValue.bootstrap.lwm2mServer, |
219 | - clientStrategy: this.configurationValue.clientLwM2mSettings.clientStrategy, | |
223 | + clientOnlyObserveAfterConnect: this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect, | |
220 | 224 | fwUpdateStrategy: this.configurationValue.clientLwM2mSettings.fwUpdateStrategy || 1, |
221 | 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 | 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 | 233 | this.isFwUpdateStrategy = this.configurationValue.clientLwM2mSettings.fwUpdateStrategy === 2; |
229 | 234 | this.isSwUpdateStrategy = this.configurationValue.clientLwM2mSettings.swUpdateStrategy === 2; |
230 | 235 | this.otaUpdateSwStrategyValidate(); |
... | ... | @@ -257,11 +262,12 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
257 | 262 | bootstrapServers.defaultMinPeriod = config.defaultMinPeriod; |
258 | 263 | bootstrapServers.notifIfDisabled = config.notifIfDisabled; |
259 | 264 | bootstrapServers.binding = config.binding; |
260 | - this.configurationValue.clientLwM2mSettings.clientStrategy = config.clientStrategy; | |
265 | + this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect = config.clientOnlyObserveAfterConnect; | |
261 | 266 | this.configurationValue.clientLwM2mSettings.fwUpdateStrategy = config.fwUpdateStrategy; |
262 | 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 | 271 | this.upDateJsonAllConfig(); |
266 | 272 | } |
267 | 273 | this.updateModel(); |
... | ... | @@ -539,20 +545,20 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro |
539 | 545 | |
540 | 546 | private otaUpdateFwStrategyValidate(updated = false): void { |
541 | 547 | if (this.isFwUpdateStrategy) { |
542 | - this.lwm2mDeviceProfileFormGroup.get('fwUpdateRecourse').setValidators([Validators.required]); | |
548 | + this.lwm2mDeviceProfileFormGroup.get('fwUpdateResource').setValidators([Validators.required]); | |
543 | 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 | 555 | private otaUpdateSwStrategyValidate(updated = false): void { |
550 | 556 | if (this.isSwUpdateStrategy) { |
551 | - this.lwm2mDeviceProfileFormGroup.get('swUpdateRecourse').setValidators([Validators.required]); | |
557 | + this.lwm2mDeviceProfileFormGroup.get('swUpdateResource').setValidators([Validators.required]); | |
552 | 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 | 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 | 145 | export interface ModelValue { |
132 | 146 | objectIds: string[]; |
133 | 147 | objectsList: ObjectLwM2M[]; |
... | ... | @@ -168,11 +182,12 @@ export interface Lwm2mProfileConfigModels { |
168 | 182 | } |
169 | 183 | |
170 | 184 | export interface ClientLwM2mSettings { |
171 | - clientStrategy: string; | |
185 | + clientOnlyObserveAfterConnect: string; | |
172 | 186 | fwUpdateStrategy: number; |
173 | 187 | swUpdateStrategy: number; |
174 | - fwUpdateRecourse: string; | |
175 | - swUpdateRecourse: string; | |
188 | + fwUpdateResource: string; | |
189 | + swUpdateResource: string; | |
190 | + powerMode: powerMode; | |
176 | 191 | } |
177 | 192 | |
178 | 193 | export interface ObservableAttributes { |
... | ... | @@ -240,11 +255,12 @@ export function getDefaultProfileConfig(hostname?: any): Lwm2mProfileConfigModel |
240 | 255 | |
241 | 256 | function getDefaultProfileClientLwM2mSettingsConfig(): ClientLwM2mSettings { |
242 | 257 | return { |
243 | - clientStrategy: '1', | |
258 | + clientOnlyObserveAfterConnect: '1', | |
244 | 259 | fwUpdateStrategy: 1, |
245 | 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 | 1288 | "sw-update-strategy": "Software update strategy", |
1289 | 1289 | "sw-update-strategy-package": "Push binary file using Object 9 and Resource 2 (Package)", |
1290 | 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 | 1299 | "dialog": { | ... | ... |