Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/app/network-server/adr-algorithm.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class AdrAlgorithm {
public id: string;
public name: string;
}
export interface AdrAlgorithmResponse {
adrAlgorithms: AdrAlgorithm[];
}
20 changes: 20 additions & 0 deletions src/app/network-server/network-server.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Injectable } from '@angular/core';
import { RestService } from '@shared/services/rest.service';
import { Observable } from 'rxjs';
import { AdrAlgorithmResponse } from '@app/network-server/adr-algorithm.model';


@Injectable({
providedIn: 'root'
})
export class NetworkServerService {
URL = 'chirpstack/network-server';

constructor(
private restService: RestService) {}


getAllAdrAlgorithms(): Observable<AdrAlgorithmResponse> {
return this.restService.get(`${this.URL}/adr-algorithms`, {});
}
}
1 change: 1 addition & 0 deletions src/app/profiles/device-profiles/device-profile.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EditPermission } from '@shared/models/edit-permission.model';
export class DeviceProfile extends EditPermission {
public id: string;
public name: string;
public adrAlgorithmID = 'default';
public classBTimeout = 0;
public classCTimeout = 0;
public factoryPresetFreqs: number[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ <h3>{{ 'PROFILES.DEVICE_PROFILE.DETAILS' | translate }}</h3>
</mat-select>
</mat-form-field>
</div>

<div class="col-xs-12 form-group">
<label
class="form-label asterisk-if-mandatory">{{ 'PROFILES.DEVICE_PROFILE.ADRALGORITHM' | translate }}</label>
<mat-form-field appearance="outline">
<mat-select matNativeControl required name="adrAlgorithmID" [disabled]="!deviceProfile.canEdit"
[(value)]="deviceProfile.adrAlgorithmID" [compareWith]="compare">
<mat-option *ngFor="let adr of adrAlgorithms" [value]="adr.id">{{ adr.name }}</mat-option>
</mat-select>
</mat-form-field>
</div>

<div class="col-xs-12 form-group">
<label for="maxEIRP"
class="form-label asterisk-if-mandatory">{{'PROFILES.DEVICE_PROFILE.MAXEIRP' | translate}}</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Subscription } from 'rxjs';
import { DeviceProfile } from '../device-profile.model';
import { DeviceProfileService } from '../device-profile.service';
import { OrganizationAccessScope } from '@shared/enums/access-scopes';
import { AdrAlgorithm, AdrAlgorithmResponse } from '@app/network-server/adr-algorithm.model';
import { NetworkServerService } from '@app/network-server/network-server.service';

@Component({
selector: 'app-device-profiles-edit',
Expand All @@ -27,14 +29,16 @@ export class DeviceProfilesEditComponent implements OnInit, OnDestroy {
public formFailedSubmit = false;
public title = '';
public backButton: BackButton = { label: '', routerLink: '/profiles' };
public adrAlgorithms: AdrAlgorithm[] = [];

constructor(
private route: ActivatedRoute,
private translate: TranslateService,
private deviceProfileService: DeviceProfileService,
private location: Location,
private meService: MeService,
private errorMessageService: ErrorMessageService
private errorMessageService: ErrorMessageService,
private networkServerService: NetworkServerService
) { }

ngOnInit(): void {
Expand All @@ -44,6 +48,12 @@ export class DeviceProfilesEditComponent implements OnInit, OnDestroy {
this.backButton.label = translations['PROFILES.NAME'];
});

this.networkServerService.getAllAdrAlgorithms()
.subscribe(
response => {
this.adrAlgorithms = response.adrAlgorithms;
});

this.id = this.route.snapshot.paramMap.get('deviceId');
if (this.id) {
this.getDeviceProfile(this.id);
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@
"NAME": "Device profil navn",
"NAME_PLACEHOLDER": "Device profil navn",
"MACVERSION": "LoRaWAN MAC version ",
"ADRALGORITHM": "ADR algoritme ",
"REGPARAMSREVISION": "LoRaWAN regional parameters revision ",
"MAXEIRP": "Max EIRP ",
"GEOLOCBUFFERTTL": "Geolocation buffer TTL (seconds)",
Expand Down