Commit 6fe0aee70b4991256d934bcf1e336c59aa60038a
Committed by
Andrew Shvayka
1 parent
872800c8
UI: Refactoring CoAP power mode setting
Showing
8 changed files
with
157 additions
and
153 deletions
... | ... | @@ -141,6 +141,7 @@ import { DashboardImageDialogComponent } from '@home/components/dashboard-page/d |
141 | 141 | import { WidgetContainerComponent } from '@home/components/widget/widget-container.component'; |
142 | 142 | import { SnmpDeviceProfileTransportModule } from '@home/components/profile/device/snpm/snmp-device-profile-transport.module'; |
143 | 143 | import { DeviceCredentialsModule } from '@home/components/device/device-credentials.module'; |
144 | +import { PowerModeSettingComponent } from '@home/components/profile/device/common/power-mode-setting.component'; | |
144 | 145 | |
145 | 146 | @NgModule({ |
146 | 147 | declarations: |
... | ... | @@ -259,7 +260,8 @@ import { DeviceCredentialsModule } from '@home/components/device/device-credenti |
259 | 260 | DashboardStateDialogComponent, |
260 | 261 | DashboardImageDialogComponent, |
261 | 262 | EmbedDashboardDialogComponent, |
262 | - DisplayWidgetTypesPanelComponent | |
263 | + DisplayWidgetTypesPanelComponent, | |
264 | + PowerModeSettingComponent | |
263 | 265 | ], |
264 | 266 | imports: [ |
265 | 267 | CommonModule, |
... | ... | @@ -369,7 +371,8 @@ import { DeviceCredentialsModule } from '@home/components/device/device-credenti |
369 | 371 | DashboardStateDialogComponent, |
370 | 372 | DashboardImageDialogComponent, |
371 | 373 | EmbedDashboardDialogComponent, |
372 | - DisplayWidgetTypesPanelComponent | |
374 | + DisplayWidgetTypesPanelComponent, | |
375 | + PowerModeSettingComponent | |
373 | 376 | ], |
374 | 377 | providers: [ |
375 | 378 | WidgetComponentService, | ... | ... |
... | ... | @@ -84,49 +84,8 @@ |
84 | 84 | <section formGroupName="clientSettings"> |
85 | 85 | <fieldset class="fields-group"> |
86 | 86 | <legend class="group-title" translate>device-profile.power-saving-mode</legend> |
87 | - <mat-form-field class="mat-block" fxFlex> | |
88 | - <mat-label> </mat-label> | |
89 | - <mat-select formControlName="powerMode"> | |
90 | - <mat-option *ngFor="let powerMod of powerMods" [value]="powerMod"> | |
91 | - {{ powerModeTranslationMap.get(powerMod) | translate}} | |
92 | - </mat-option> | |
93 | - </mat-select> | |
94 | - </mat-form-field> | |
95 | - <section class="mat-block" fxFlex *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.powerMode').value === 'E_DRX'"> | |
96 | - <mat-form-field class="mat-block" fxFlex> | |
97 | - <mat-label>{{ 'device-profile.edrx-cycle' | translate }}</mat-label> | |
98 | - <input matInput type="number" min="0" formControlName="edrxCycle" required> | |
99 | - <mat-error *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.edrxCycle').hasError('required')"> | |
100 | - {{ 'device-profile.edrx-cycle-required' | translate }} | |
101 | - </mat-error> | |
102 | - <mat-error *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.edrxCycle').hasError('pattern') || | |
103 | - coapTransportConfigurationFormGroup.get('clientSettings.edrxCycle').hasError('min')"> | |
104 | - {{ 'device-profile.edrx-cycle-pattern' | translate }} | |
105 | - </mat-error> | |
106 | - </mat-form-field> | |
107 | - <mat-form-field class="mat-block" fxFlex> | |
108 | - <mat-label>{{ 'device-profile.paging-transmission-window' | translate }}</mat-label> | |
109 | - <input matInput type="number" min="0" formControlName="pagingTransmissionWindow" required> | |
110 | - <mat-error *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.pagingTransmissionWindow').hasError('required')"> | |
111 | - {{ 'device-profile.paging-transmission-window-required' | translate }} | |
112 | - </mat-error> | |
113 | - <mat-error *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.pagingTransmissionWindow').hasError('pattern') || | |
114 | - coapTransportConfigurationFormGroup.get('clientSettings.pagingTransmissionWindow').hasError('min')"> | |
115 | - {{ 'device-profile.paging-transmission-window-pattern' | translate }} | |
116 | - </mat-error> | |
117 | - </mat-form-field> | |
118 | - </section> | |
119 | - <mat-form-field class="mat-block" fxFlex *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.powerMode').value === 'PSM'"> | |
120 | - <mat-label>{{ 'device-profile.psm-activity-timer' | translate }}</mat-label> | |
121 | - <input matInput type="number" min="0" formControlName="psmActivityTimer" required> | |
122 | - <mat-error *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.psmActivityTimer').hasError('required')"> | |
123 | - {{ 'device-profile.psm-activity-timer-required' | translate }} | |
124 | - </mat-error> | |
125 | - <mat-error *ngIf="coapTransportConfigurationFormGroup.get('clientSettings.psmActivityTimer').hasError('pattern') || | |
126 | - coapTransportConfigurationFormGroup.get('clientSettings.psmActivityTimer').hasError('min')"> | |
127 | - {{ 'device-profile.psm-activity-timer-pattern' | translate }} | |
128 | - </mat-error> | |
129 | - </mat-form-field> | |
87 | + <tb-power-mode-settings [parentForm]="clientSettingsFormGroup"> | |
88 | + </tb-power-mode-settings> | |
130 | 89 | </fieldset> |
131 | 90 | </section> |
132 | 91 | </form> | ... | ... |
... | ... | @@ -35,7 +35,7 @@ import { |
35 | 35 | import { isDefinedAndNotNull } from '@core/utils'; |
36 | 36 | import { Subject } from 'rxjs'; |
37 | 37 | import { takeUntil } from 'rxjs/operators'; |
38 | -import { PowerMode, PowerModeTranslationMap } from '@home/components/profile/device/lwm2m/lwm2m-profile-config.models'; | |
38 | +import { PowerMode } from '@home/components/profile/device/lwm2m/lwm2m-profile-config.models'; | |
39 | 39 | |
40 | 40 | @Component({ |
41 | 41 | selector: 'tb-coap-device-profile-transport-configuration', |
... | ... | @@ -55,9 +55,6 @@ export class CoapDeviceProfileTransportConfigurationComponent implements Control |
55 | 55 | transportPayloadTypes = Object.values(TransportPayloadType); |
56 | 56 | transportPayloadTypeTranslations = transportPayloadTypeTranslationMap; |
57 | 57 | |
58 | - powerMods = Object.values(PowerMode); | |
59 | - powerModeTranslationMap = PowerModeTranslationMap; | |
60 | - | |
61 | 58 | coapTransportConfigurationFormGroup: FormGroup; |
62 | 59 | |
63 | 60 | private destroy$ = new Subject(); |
... | ... | @@ -114,21 +111,6 @@ export class CoapDeviceProfileTransportConfigurationComponent implements Control |
114 | 111 | ).subscribe(coapDeviceType => { |
115 | 112 | this.updateCoapDeviceTypeBasedControls(coapDeviceType, true); |
116 | 113 | }); |
117 | - this.coapTransportConfigurationFormGroup.get('clientSettings.powerMode').valueChanges.pipe( | |
118 | - takeUntil(this.destroy$) | |
119 | - ).subscribe((powerMode: PowerMode) => { | |
120 | - if (powerMode === PowerMode.E_DRX) { | |
121 | - this.coapTransportConfigurationFormGroup.get('clientSettings.edrxCycle').enable({emitEvent: false}); | |
122 | - this.coapTransportConfigurationFormGroup.get('clientSettings.pagingTransmissionWindow').enable({emitEvent: false}); | |
123 | - this.disablePSKMode(); | |
124 | - } else if (powerMode === PowerMode.PSM) { | |
125 | - this.coapTransportConfigurationFormGroup.get('clientSettings.psmActivityTimer').enable({emitEvent: false}); | |
126 | - this.disableEdrxMode(); | |
127 | - } else { | |
128 | - this.disableEdrxMode(); | |
129 | - this.disablePSKMode(); | |
130 | - } | |
131 | - }); | |
132 | 114 | this.coapTransportConfigurationFormGroup.valueChanges.pipe( |
133 | 115 | takeUntil(this.destroy$) |
134 | 116 | ).subscribe(() => { |
... | ... | @@ -152,6 +134,9 @@ export class CoapDeviceProfileTransportConfigurationComponent implements Control |
152 | 134 | return transportPayloadType === TransportPayloadType.PROTOBUF; |
153 | 135 | } |
154 | 136 | |
137 | + get clientSettingsFormGroup(): FormGroup { | |
138 | + return this.coapTransportConfigurationFormGroup.get('clientSettings') as FormGroup; | |
139 | + } | |
155 | 140 | |
156 | 141 | private updateCoapDeviceTypeBasedControls(type: CoapTransportDeviceType, forceUpdated = false) { |
157 | 142 | const coapDeviceTypeConfigurationFormGroup = this.coapTransportConfigurationFormGroup |
... | ... | @@ -201,16 +186,4 @@ export class CoapDeviceProfileTransportConfigurationComponent implements Control |
201 | 186 | } |
202 | 187 | this.propagateChange(configuration); |
203 | 188 | } |
204 | - | |
205 | - private disablePSKMode() { | |
206 | - this.coapTransportConfigurationFormGroup.get('clientSettings.psmActivityTimer').disable({emitEvent: false}); | |
207 | - this.coapTransportConfigurationFormGroup.get('clientSettings.psmActivityTimer').reset(0, {emitEvent: false}); | |
208 | - } | |
209 | - | |
210 | - private disableEdrxMode() { | |
211 | - this.coapTransportConfigurationFormGroup.get('clientSettings.edrxCycle').disable({emitEvent: false}); | |
212 | - this.coapTransportConfigurationFormGroup.get('clientSettings.edrxCycle').reset(0, {emitEvent: false}); | |
213 | - this.coapTransportConfigurationFormGroup.get('clientSettings.pagingTransmissionWindow').disable({emitEvent: false}); | |
214 | - this.coapTransportConfigurationFormGroup.get('clientSettings.pagingTransmissionWindow').reset(0, {emitEvent: false}); | |
215 | - } | |
216 | 189 | } | ... | ... |
ui-ngx/src/app/modules/home/components/profile/device/common/power-mode-setting.component.html
0 → 100644
1 | +<!-- | |
2 | + | |
3 | + Copyright © 2016-2021 The Thingsboard Authors | |
4 | + | |
5 | + Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | + you may not use this file except in compliance with the License. | |
7 | + You may obtain a copy of the License at | |
8 | + | |
9 | + http://www.apache.org/licenses/LICENSE-2.0 | |
10 | + | |
11 | + Unless required by applicable law or agreed to in writing, software | |
12 | + distributed under the License is distributed on an "AS IS" BASIS, | |
13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | + See the License for the specific language governing permissions and | |
15 | + limitations under the License. | |
16 | + | |
17 | +--> | |
18 | +<section [formGroup]="parentForm"> | |
19 | + <mat-form-field class="mat-block" fxFlex> | |
20 | + <mat-label>{{ isDeviceSetting ? ("device-profile.power-saving-mode" | translate) : " "}}</mat-label> | |
21 | + <mat-select formControlName="powerMode"> | |
22 | + <mat-option [value]="null" *ngIf="isDeviceSetting">{{ "device-profile.power-saving-mode-type.default" | translate }}</mat-option> | |
23 | + <mat-option *ngFor="let powerMod of powerMods" [value]="powerMod"> | |
24 | + {{ powerModeTranslationMap.get(powerMod) | translate}} | |
25 | + </mat-option> | |
26 | + </mat-select> | |
27 | + </mat-form-field> | |
28 | + <section class="mat-block" fxFlex *ngIf="parentForm.get('powerMode').value === 'E_DRX'"> | |
29 | + <mat-form-field class="mat-block" fxFlex> | |
30 | + <mat-label>{{ 'device-profile.edrx-cycle' | translate }}</mat-label> | |
31 | + <input matInput type="number" min="0" formControlName="edrxCycle" required> | |
32 | + <mat-error *ngIf="parentForm.get('edrxCycle').hasError('required')"> | |
33 | + {{ 'device-profile.edrx-cycle-required' | translate }} | |
34 | + </mat-error> | |
35 | + <mat-error *ngIf="parentForm.get('edrxCycle').hasError('pattern') || | |
36 | + parentForm.get('edrxCycle').hasError('min')"> | |
37 | + {{ 'device-profile.edrx-cycle-pattern' | translate }} | |
38 | + </mat-error> | |
39 | + </mat-form-field> | |
40 | + <mat-form-field class="mat-block" fxFlex> | |
41 | + <mat-label>{{ 'device-profile.paging-transmission-window' | translate }}</mat-label> | |
42 | + <input matInput type="number" min="0" formControlName="pagingTransmissionWindow" required> | |
43 | + <mat-error *ngIf="parentForm.get('pagingTransmissionWindow').hasError('required')"> | |
44 | + {{ 'device-profile.paging-transmission-window-required' | translate }} | |
45 | + </mat-error> | |
46 | + <mat-error *ngIf="parentForm.get('pagingTransmissionWindow').hasError('pattern') || | |
47 | + parentForm.get('pagingTransmissionWindow').hasError('min')"> | |
48 | + {{ 'device-profile.paging-transmission-window-pattern' | translate }} | |
49 | + </mat-error> | |
50 | + </mat-form-field> | |
51 | + </section> | |
52 | + <mat-form-field class="mat-block" fxFlex *ngIf="parentForm.get('powerMode').value === 'PSM'"> | |
53 | + <mat-label>{{ 'device-profile.psm-activity-timer' | translate }}</mat-label> | |
54 | + <input matInput type="number" min="0" formControlName="psmActivityTimer" required> | |
55 | + <mat-error *ngIf="parentForm.get('psmActivityTimer').hasError('required')"> | |
56 | + {{ 'device-profile.psm-activity-timer-required' | translate }} | |
57 | + </mat-error> | |
58 | + <mat-error *ngIf="parentForm.get('psmActivityTimer').hasError('pattern') || | |
59 | + parentForm.get('psmActivityTimer').hasError('min')"> | |
60 | + {{ 'device-profile.psm-activity-timer-pattern' | translate }} | |
61 | + </mat-error> | |
62 | + </mat-form-field> | |
63 | +</section> | ... | ... |
ui-ngx/src/app/modules/home/components/profile/device/common/power-mode-setting.component.ts
0 → 100644
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 | + | |
17 | +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; | |
18 | +import { FormGroup } from '@angular/forms'; | |
19 | +import { PowerMode, PowerModeTranslationMap } from '@home/components/profile/device/lwm2m/lwm2m-profile-config.models'; | |
20 | +import { takeUntil } from 'rxjs/operators'; | |
21 | +import { Subject } from 'rxjs'; | |
22 | + | |
23 | +@Component({ | |
24 | + selector: 'tb-power-mode-settings', | |
25 | + templateUrl: './power-mode-setting.component.html', | |
26 | + styleUrls: [] | |
27 | +}) | |
28 | +export class PowerModeSettingComponent implements OnInit, OnDestroy { | |
29 | + | |
30 | + powerMods = Object.values(PowerMode); | |
31 | + powerModeTranslationMap = PowerModeTranslationMap; | |
32 | + | |
33 | + private destroy$ = new Subject(); | |
34 | + | |
35 | + @Input() | |
36 | + parentForm: FormGroup; | |
37 | + | |
38 | + @Input() | |
39 | + isDeviceSetting = false; | |
40 | + | |
41 | + ngOnInit() { | |
42 | + this.parentForm.get('powerMode').valueChanges.pipe( | |
43 | + takeUntil(this.destroy$) | |
44 | + ).subscribe((powerMode: PowerMode) => { | |
45 | + if (powerMode === PowerMode.E_DRX) { | |
46 | + this.parentForm.get('edrxCycle').enable({emitEvent: false}); | |
47 | + this.parentForm.get('pagingTransmissionWindow').enable({emitEvent: false}); | |
48 | + this.disablePSKMode(); | |
49 | + } else if (powerMode === PowerMode.PSM) { | |
50 | + this.parentForm.get('psmActivityTimer').enable({emitEvent: false}); | |
51 | + this.disableEdrxMode(); | |
52 | + } else { | |
53 | + this.disableEdrxMode(); | |
54 | + this.disablePSKMode(); | |
55 | + } | |
56 | + }); | |
57 | + } | |
58 | + | |
59 | + ngOnDestroy() { | |
60 | + this.destroy$.next(); | |
61 | + this.destroy$.complete(); | |
62 | + } | |
63 | + | |
64 | + private disablePSKMode() { | |
65 | + this.parentForm.get('psmActivityTimer').disable({emitEvent: false}); | |
66 | + this.parentForm.get('psmActivityTimer').reset(0, {emitEvent: false}); | |
67 | + } | |
68 | + | |
69 | + private disableEdrxMode() { | |
70 | + this.parentForm.get('edrxCycle').disable({emitEvent: false}); | |
71 | + this.parentForm.get('edrxCycle').reset(0, {emitEvent: false}); | |
72 | + this.parentForm.get('pagingTransmissionWindow').disable({emitEvent: false}); | |
73 | + this.parentForm.get('pagingTransmissionWindow').reset(0, {emitEvent: false}); | |
74 | + } | |
75 | +} | ... | ... |
... | ... | @@ -16,48 +16,6 @@ |
16 | 16 | |
17 | 17 | --> |
18 | 18 | <form [formGroup]="coapDeviceTransportForm" style="padding-bottom: 16px;"> |
19 | - <mat-form-field class="mat-block" fxFlex> | |
20 | - <mat-label translate>device-profile.power-saving-mode</mat-label> | |
21 | - <mat-select formControlName="powerMode"> | |
22 | - <mat-option [value]="null">{{ "device-profile.power-saving-mode-type.default" | translate }}</mat-option> | |
23 | - <mat-option *ngFor="let powerMod of powerMods" [value]="powerMod"> | |
24 | - {{ powerModeTranslationMap.get(powerMod) | translate }} | |
25 | - </mat-option> | |
26 | - </mat-select> | |
27 | - </mat-form-field> | |
28 | - <section class="mat-block" fxFlex *ngIf="coapDeviceTransportForm.get('powerMode').value === 'E_DRX'"> | |
29 | - <mat-form-field class="mat-block" fxFlex> | |
30 | - <mat-label>{{ 'device-profile.edrx-cycle' | translate }}</mat-label> | |
31 | - <input matInput type="number" min="0" formControlName="edrxCycle" required> | |
32 | - <mat-error *ngIf="coapDeviceTransportForm.get('edrxCycle').hasError('required')"> | |
33 | - {{ 'device-profile.edrx-cycle-required' | translate }} | |
34 | - </mat-error> | |
35 | - <mat-error *ngIf="coapDeviceTransportForm.get('edrxCycle').hasError('pattern') || | |
36 | - coapDeviceTransportForm.get('edrxCycle').hasError('min')"> | |
37 | - {{ 'device-profile.edrx-cycle-pattern' | translate }} | |
38 | - </mat-error> | |
39 | - </mat-form-field> | |
40 | - <mat-form-field class="mat-block" fxFlex> | |
41 | - <mat-label>{{ 'device-profile.paging-transmission-window' | translate }}</mat-label> | |
42 | - <input matInput type="number" min="0" formControlName="pagingTransmissionWindow" required> | |
43 | - <mat-error *ngIf="coapDeviceTransportForm.get('pagingTransmissionWindow').hasError('required')"> | |
44 | - {{ 'device-profile.paging-transmission-window-required' | translate }} | |
45 | - </mat-error> | |
46 | - <mat-error *ngIf="coapDeviceTransportForm.get('pagingTransmissionWindow').hasError('pattern') || | |
47 | - coapDeviceTransportForm.get('pagingTransmissionWindow').hasError('min')"> | |
48 | - {{ 'device-profile.paging-transmission-window-pattern' | translate }} | |
49 | - </mat-error> | |
50 | - </mat-form-field> | |
51 | - </section> | |
52 | - <mat-form-field class="mat-block" fxFlex *ngIf="coapDeviceTransportForm.get('powerMode').value === 'PSM'"> | |
53 | - <mat-label>{{ 'device-profile.psm-activity-timer' | translate }}</mat-label> | |
54 | - <input matInput type="number" min="0" formControlName="psmActivityTimer" required> | |
55 | - <mat-error *ngIf="coapDeviceTransportForm.get('psmActivityTimer').hasError('required')"> | |
56 | - {{ 'device-profile.psm-activity-timer-required' | translate }} | |
57 | - </mat-error> | |
58 | - <mat-error *ngIf="coapDeviceTransportForm.get('psmActivityTimer').hasError('pattern') || | |
59 | - coapDeviceTransportForm.get('psmActivityTimer').hasError('min')"> | |
60 | - {{ 'device-profile.psm-activity-timer-pattern' | translate }} | |
61 | - </mat-error> | |
62 | - </mat-form-field> | |
19 | + <tb-power-mode-settings [parentForm]="coapDeviceTransportForm" [isDeviceSetting]="true"> | |
20 | + </tb-power-mode-settings> | |
63 | 21 | </form> | ... | ... |
... | ... | @@ -24,7 +24,6 @@ import { |
24 | 24 | DeviceTransportConfiguration, |
25 | 25 | DeviceTransportType |
26 | 26 | } from '@shared/models/device.models'; |
27 | -import { PowerMode, PowerModeTranslationMap } from '@home/components/profile/device/lwm2m/lwm2m-profile-config.models'; | |
28 | 27 | import { Subject } from 'rxjs'; |
29 | 28 | import { takeUntil } from 'rxjs/operators'; |
30 | 29 | import { isDefinedAndNotNull } from '@core/utils'; |
... | ... | @@ -43,9 +42,6 @@ export class CoapDeviceTransportConfigurationComponent implements ControlValueAc |
43 | 42 | |
44 | 43 | coapDeviceTransportForm: FormGroup; |
45 | 44 | |
46 | - powerMods = Object.values(PowerMode); | |
47 | - powerModeTranslationMap = PowerModeTranslationMap; | |
48 | - | |
49 | 45 | private requiredValue: boolean; |
50 | 46 | get required(): boolean { |
51 | 47 | return this.requiredValue; |
... | ... | @@ -79,21 +75,6 @@ export class CoapDeviceTransportConfigurationComponent implements ControlValueAc |
79 | 75 | psmActivityTimer: [{disabled: true, value: 0}, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]], |
80 | 76 | pagingTransmissionWindow: [{disabled: true, value: 0}, [Validators.required, Validators.min(0), Validators.pattern('[0-9]*')]] |
81 | 77 | }); |
82 | - this.coapDeviceTransportForm.get('powerMode').valueChanges.pipe( | |
83 | - takeUntil(this.destroy$) | |
84 | - ).subscribe((powerMode: PowerMode) => { | |
85 | - if (powerMode === PowerMode.E_DRX) { | |
86 | - this.coapDeviceTransportForm.get('edrxCycle').enable({emitEvent: false}); | |
87 | - this.coapDeviceTransportForm.get('pagingTransmissionWindow').enable({emitEvent: false}); | |
88 | - this.disablePSKMode(); | |
89 | - } else if (powerMode === PowerMode.PSM) { | |
90 | - this.coapDeviceTransportForm.get('psmActivityTimer').enable({emitEvent: false}); | |
91 | - this.disableEdrxMode(); | |
92 | - } else { | |
93 | - this.disableEdrxMode(); | |
94 | - this.disablePSKMode(); | |
95 | - } | |
96 | - }); | |
97 | 78 | this.coapDeviceTransportForm.valueChanges.pipe( |
98 | 79 | takeUntil(this.destroy$) |
99 | 80 | ).subscribe(() => { |
... | ... | @@ -135,16 +116,4 @@ export class CoapDeviceTransportConfigurationComponent implements ControlValueAc |
135 | 116 | } |
136 | 117 | this.propagateChange(configuration); |
137 | 118 | } |
138 | - | |
139 | - private disablePSKMode() { | |
140 | - this.coapDeviceTransportForm.get('psmActivityTimer').disable({emitEvent: false}); | |
141 | - this.coapDeviceTransportForm.get('psmActivityTimer').reset(0, {emitEvent: false}); | |
142 | - } | |
143 | - | |
144 | - private disableEdrxMode() { | |
145 | - this.coapDeviceTransportForm.get('edrxCycle').disable({emitEvent: false}); | |
146 | - this.coapDeviceTransportForm.get('edrxCycle').reset(0, {emitEvent: false}); | |
147 | - this.coapDeviceTransportForm.get('pagingTransmissionWindow').disable({emitEvent: false}); | |
148 | - this.coapDeviceTransportForm.get('pagingTransmissionWindow').reset(0, {emitEvent: false}); | |
149 | - } | |
150 | 119 | } | ... | ... |
... | ... | @@ -361,6 +361,9 @@ export function createDeviceProfileTransportConfiguration(type: DeviceTransportT |
361 | 361 | coapDeviceTypeConfiguration: { |
362 | 362 | coapDeviceType: CoapTransportDeviceType.DEFAULT, |
363 | 363 | transportPayloadTypeConfiguration: {transportPayloadType: TransportPayloadType.JSON} |
364 | + }, | |
365 | + clientSettings: { | |
366 | + powerMode: PowerMode.DRX | |
364 | 367 | } |
365 | 368 | }; |
366 | 369 | transportConfiguration = {...coapTransportConfiguration, type: DeviceTransportType.COAP}; |
... | ... | @@ -395,7 +398,9 @@ export function createDeviceTransportConfiguration(type: DeviceTransportType): D |
395 | 398 | transportConfiguration = {...mqttTransportConfiguration, type: DeviceTransportType.MQTT}; |
396 | 399 | break; |
397 | 400 | case DeviceTransportType.COAP: |
398 | - const coapTransportConfiguration: CoapDeviceTransportConfiguration = {}; | |
401 | + const coapTransportConfiguration: CoapDeviceTransportConfiguration = { | |
402 | + powerMode: null | |
403 | + }; | |
399 | 404 | transportConfiguration = {...coapTransportConfiguration, type: DeviceTransportType.COAP}; |
400 | 405 | break; |
401 | 406 | case DeviceTransportType.LWM2M: |
... | ... | @@ -582,7 +587,6 @@ export interface CoapDeviceTransportConfiguration { |
582 | 587 | edrxCycle?: number; |
583 | 588 | pagingTransmissionWindow?: number; |
584 | 589 | psmActivityTimer?: number; |
585 | - [key: string]: any; | |
586 | 590 | } |
587 | 591 | |
588 | 592 | export interface Lwm2mDeviceTransportConfiguration { | ... | ... |