diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.html b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.html
index a2102bfae..26bc6e396 100644
--- a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.html
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.html
@@ -1,4 +1,4 @@
-
{{ "IOTDEVICE.DOWNLINK.DIALOG-TITLE" | translate }}
+{{ "IOTDEVICE.DOWNLINK.FLUSH-QUEUE" | translate }}
{{ "IOTDEVICE.DOWNLINK.DIALOG-MESSAGE" | translate }}
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.ts b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.ts
index b74863749..a8684b1d3 100644
--- a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.ts
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component.ts
@@ -1,7 +1,7 @@
import { Component, OnInit } from "@angular/core";
import { MatDialogRef } from "@angular/material/dialog";
import { TranslateService } from "@ngx-translate/core";
-import { DownlinkComponent } from "../downlink.component";
+import { DownlinkComponent } from "../downlinks/downlink.component";
@Component({
selector: "app-downlink-dialog",
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-queue-dto.ts b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-queue-dto.ts
new file mode 100644
index 000000000..0dcd26e18
--- /dev/null
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-queue-dto.ts
@@ -0,0 +1,9 @@
+export class DownlinkQueueDto {
+ fCntDown: number;
+ payload: string;
+ port: number;
+ sendAt: Date;
+ acknowledgedAt: Date;
+ acknowledged: boolean;
+ createdAt: Date;
+}
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.html b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.html
new file mode 100644
index 000000000..05683ce2f
--- /dev/null
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.html
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
+
+
+
+ {{ "IOTDEVICE.CREATED" | translate }}
+ |
+
+ {{ element.createdAt | dkTimeWithSeconds }}
+ |
+
+
+
+
+ {{ "USERS.STATUS" | translate }} |
+
+ {{ getStatus(element) }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.PAYLOADTITLE" | translate }} |
+
+ {{ element.payload }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.MQTT.PORT" | translate }} |
+
+ {{ element.port }}
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ "IOTDEVICE.CREATED" | translate }}
+ |
+
+ {{ element.createdAt | dkTimeWithSeconds }}
+ |
+
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.SENDAT" | translate }}
+ |
+
+ {{ element.sendAt | dkTimeWithSeconds }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.RECEIVEDAT" | translate }} |
+
+ {{
+ element.acknowledgedAt
+ ? (element.acknowledgedAt | dkTimeWithSeconds)
+ : ("IOTDEVICE.DOWNLINK.NOT-RECEIVED" | translate)
+ }}
+ |
+
+
+
+
+ {{ "USERS.STATUS" | translate }} |
+
+ {{ getStatus(element) }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.FRAMECOUNTER" | translate }} |
+
+ {{ element.fCntDown }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.CONFIRMED" | translate }} |
+
+ {{ isAcknowledged(element) }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.PAYLOADTITLE" | translate }} |
+
+ {{ element.payload }}
+ |
+
+
+
+
+ {{ "IOTDEVICE.MQTT.PORT" | translate }} |
+
+ {{ element.port }}
+ |
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.scss b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.scss
new file mode 100644
index 000000000..b94e834dc
--- /dev/null
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.scss
@@ -0,0 +1,8 @@
+.headerStyle {
+ margin-bottom: 50px !important;
+}
+
+.buttons {
+ gap: 10px;
+ display: flex;
+}
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.ts b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.ts
new file mode 100644
index 000000000..264ef32e5
--- /dev/null
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink-tables/downlink-tables.component.ts
@@ -0,0 +1,130 @@
+import { HttpErrorResponse } from "@angular/common/http";
+import { Component, Input, OnInit } from "@angular/core";
+import { MatDialog } from "@angular/material/dialog";
+import { MatSnackBar } from "@angular/material/snack-bar";
+import { IotDevice } from "@applications/iot-devices/iot-device.model";
+import { TranslateService } from "@ngx-translate/core";
+import { DeviceType } from "@shared/enums/device-type";
+import { ErrorMessageService } from "@shared/error-message.service";
+import { DownlinkService } from "@shared/services/downlink.service";
+import { DownlinkDialogComponent } from "../downlink-dialog/downlink-dialog.component";
+import { DownlinkQueueDto } from "../downlink-queue-dto";
+
+@Component({
+ selector: "app-downlink-tables",
+ templateUrl: "./downlink-tables.component.html",
+ styleUrls: ["./downlink-tables.component.scss"],
+})
+export class DownlinkTablesComponent implements OnInit {
+ @Input() device: IotDevice;
+ @Input() errorMessages: string[];
+ @Input() downlinkQueue: DownlinkQueueDto[];
+ public downlinkHistoryQueue: DownlinkQueueDto[];
+ public isLoadingResults = false;
+ public displayedColumns: string[] = ["createdAt", "status", "payload", "port"];
+ public displayedColumnsHistory: string[] = [
+ "createdAt",
+ "sendAt",
+ "acknowledgedAt",
+ "status",
+ "fCntDown",
+ "acknowledged",
+ "payload",
+ "port",
+ ];
+
+ constructor(
+ private snackBar: MatSnackBar,
+ private translate: TranslateService,
+ private downlinkService: DownlinkService,
+ public dialog: MatDialog,
+ private errorMessageService: ErrorMessageService
+ ) {}
+
+ ngOnInit(): void {
+ this.errorMessages = [];
+
+ this.getDownlinksQueue();
+ this.getHistoricalDownlinksQueue();
+ }
+
+ getDownlinksQueue() {
+ this.isLoadingResults = true;
+ this.downlinkService.getDownlinkQueue(this.device.id).subscribe(
+ (response: DownlinkQueueDto[]) => {
+ this.downlinkQueue = response;
+ this.isLoadingResults = false;
+ },
+ error => {
+ this.handleError(error);
+ this.isLoadingResults = false;
+ }
+ );
+ }
+
+ getHistoricalDownlinksQueue() {
+ this.isLoadingResults = true;
+ this.downlinkService.getHistoricalDownlinkQueue(this.device.id).subscribe(
+ (response: DownlinkQueueDto[]) => {
+ this.downlinkHistoryQueue = response;
+ this.isLoadingResults = false;
+ },
+ error => {
+ this.handleError(error);
+ this.isLoadingResults = false;
+ }
+ );
+ }
+
+ handleReload() {
+ this.getDownlinksQueue();
+ this.getHistoricalDownlinksQueue();
+ }
+
+ handleFlushQueue() {
+ this.openDownlinkDialog();
+ }
+
+ private handleError(error: HttpErrorResponse) {
+ this.errorMessages = this.errorMessageService.handleErrorMessage(error);
+ }
+
+ openDownlinkDialog() {
+ const dialog = this.dialog.open(DownlinkDialogComponent, {});
+
+ dialog.afterClosed().subscribe(result => {
+ if (result === true) {
+ this.downlinkService.flushQueue(this.device.id).subscribe(
+ response => {
+ this.snackBar.open(
+ this.translate.instant("IOTDEVICE.DOWNLINK.QUEUE-FLUSHED"),
+ this.translate.instant("DIALOG.OK"),
+ {
+ duration: 10000,
+ }
+ );
+ this.getDownlinksQueue();
+ },
+ error => {
+ this.handleError(error);
+ }
+ );
+ }
+ });
+ }
+
+ getStatus(downlink: DownlinkQueueDto) {
+ if (!downlink.acknowledgedAt && !downlink.sendAt) {
+ return this.translate.instant("IOTDEVICE.DOWNLINK.IN-QUEUE");
+ }
+ if (downlink.acknowledgedAt) {
+ return this.translate.instant("IOTDEVICE.DOWNLINK.RECEIVEDAT");
+ }
+
+ return this.translate.instant("IOTDEVICE.DOWNLINK.SENDAT");
+ }
+
+ isAcknowledged(downlink: DownlinkQueueDto) {
+ return !downlink.acknowledged ? this.translate.instant("false") : this.translate.instant("true");
+ }
+}
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.html b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.html
deleted file mode 100644
index 7edc2d4e1..000000000
--- a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.html
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
- -
- {{ error | translate }}
-
-
-
-
{{ "IOTDEVICE.DOWNLINK.DESCRIPTION" | translate }}
-
- {{ "IOTDEVICE.DOWNLINK.CONFIRMEDDOWNLINK" | translate }}
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ "IOTDEVICE.DOWNLINK.SIGFOX-PAYLOAD-LENGTH" | translate }}
-
-
-
-
-
-
-
-
-
- {{ "IOTDEVICE.DOWNLINK.NOTIMPLEMENTED" | translate }}
-
-
-
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.scss b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/app/applications/iot-devices/downlink.model.ts b/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.model.ts
similarity index 100%
rename from src/app/applications/iot-devices/downlink.model.ts
rename to src/app/applications/iot-devices/iot-device-detail/downlink/downlink.model.ts
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.html b/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.html
new file mode 100644
index 000000000..cd66ac7af
--- /dev/null
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.html
@@ -0,0 +1,66 @@
+
+
+
+
+ -
+ {{ error | translate }}
+
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.CONFIRMEDDOWNLINK" | translate }}
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ "IOTDEVICE.DOWNLINK.SIGFOX-PAYLOAD-LENGTH" | translate }}
+
+
+
+
+
+
+
+
+
+ {{ "IOTDEVICE.DOWNLINK.NOTIMPLEMENTED" | translate }}
+
+
+
+
+
+
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.scss b/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.scss
new file mode 100644
index 000000000..efe0805a7
--- /dev/null
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.scss
@@ -0,0 +1,3 @@
+.headerStyle {
+ margin-bottom: 50px !important;
+}
diff --git a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.ts b/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.ts
similarity index 75%
rename from src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.ts
rename to src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.ts
index ae5033e7f..339f71d09 100644
--- a/src/app/applications/iot-devices/iot-device-detail/downlink/downlink.component.ts
+++ b/src/app/applications/iot-devices/iot-device-detail/downlink/downlinks/downlink.component.ts
@@ -2,13 +2,13 @@ import { HttpErrorResponse } from "@angular/common/http";
import { Component, Input, OnInit } from "@angular/core";
import { MatDialog } from "@angular/material/dialog";
import { MatSnackBar } from "@angular/material/snack-bar";
-import { Downlink } from "@applications/iot-devices/downlink.model";
import { IotDevice } from "@applications/iot-devices/iot-device.model";
import { TranslateService } from "@ngx-translate/core";
import { DeviceType } from "@shared/enums/device-type";
import { ErrorMessageService } from "@shared/error-message.service";
import { DownlinkService } from "@shared/services/downlink.service";
-import { DownlinkDialogComponent } from "./downlink-dialog/downlink-dialog.component";
+import { Downlink } from "../downlink.model";
+import { DownlinkQueueDto } from "../downlink-queue-dto";
@Component({
selector: "app-downlink",
@@ -18,8 +18,9 @@ import { DownlinkDialogComponent } from "./downlink-dialog/downlink-dialog.compo
export class DownlinkComponent implements OnInit {
@Input() device: IotDevice;
@Input() errorMessages: string[];
- public downlinkText: string;
public downlink = new Downlink();
+ public downlinkQueue: DownlinkQueueDto[];
+ public isLoadingResults = false;
constructor(
private snackBar: MatSnackBar,
@@ -31,23 +32,28 @@ export class DownlinkComponent implements OnInit {
ngOnInit(): void {
this.errorMessages = [];
+ this.isLoadingResults = true;
+
+ this.getDownlinksQueue();
}
- clickDownlink() {
+ getDownlinksQueue() {
+ this.downlinkService.getDownlinkQueue(this.device.id).subscribe(
+ (response: DownlinkQueueDto[]) => {
+ this.downlinkQueue = response;
+ this.isLoadingResults = false;
+ },
+ error => {
+ this.handleError(error);
+ console.log(error);
+ this.isLoadingResults = false;
+ }
+ );
+ }
+
+ handleQueueDownlink() {
if (this.validateHex(this.downlink.data)) {
- this.downlinkService.get(this.device.id).subscribe(
- (response: any) => {
- if (response.totalCount > 0) {
- this.openDownlinkDialog();
- } else {
- this.startDownlink();
- }
- },
- error => {
- this.handleError(error);
- console.log(error);
- }
- );
+ this.startDownlink();
}
}
@@ -61,7 +67,7 @@ export class DownlinkComponent implements OnInit {
private startDownlink() {
this.errorMessages = [];
- this.downlinkService.post(this.downlink, this.device.id).subscribe(
+ this.downlinkService.postDownlink(this.downlink, this.device.id).subscribe(
response => {
this.snackBar.open("Element sat i kø", "Downlink", {
duration: 10000,
@@ -71,6 +77,7 @@ export class DownlinkComponent implements OnInit {
this.handleError(error);
}
);
+ this.getDownlinksQueue();
}
private validateHex(input: string): boolean {
@@ -104,15 +111,4 @@ export class DownlinkComponent implements OnInit {
return 256;
}
}
-
- openDownlinkDialog() {
- const dialog = this.dialog.open(DownlinkDialogComponent, {});
-
- dialog.afterClosed().subscribe(result => {
- if (result === true) {
- this.startDownlink();
- console.log(`Dialog result: ${result}`);
- }
- });
- }
}
diff --git a/src/app/applications/iot-devices/iot-device-detail/iot-device-downlink-tab/iot-device-downlink-tab.component.html b/src/app/applications/iot-devices/iot-device-detail/iot-device-downlink-tab/iot-device-downlink-tab.component.html
index 95ed6312a..40decb74b 100644
--- a/src/app/applications/iot-devices/iot-device-detail/iot-device-downlink-tab/iot-device-downlink-tab.component.html
+++ b/src/app/applications/iot-devices/iot-device-detail/iot-device-downlink-tab/iot-device-downlink-tab.component.html
@@ -1,3 +1 @@
-
+
diff --git a/src/app/applications/iot-devices/iot-devices.module.ts b/src/app/applications/iot-devices/iot-devices.module.ts
index 8b47cb1ef..b4782f72b 100644
--- a/src/app/applications/iot-devices/iot-devices.module.ts
+++ b/src/app/applications/iot-devices/iot-devices.module.ts
@@ -5,7 +5,7 @@ import { RouterModule } from "@angular/router";
import { TranslateModule } from "@ngx-translate/core";
import { FormModule } from "@shared/components/forms/form.module";
import { NGMaterialModule } from "@shared/Modules/materiale.module";
-import { DownlinkComponent } from "./iot-device-detail/downlink/downlink.component";
+import { DownlinkComponent } from "./iot-device-detail/downlink/downlinks/downlink.component";
import { IotDeviceDetailGenericComponent } from "./iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component";
import { IotDeviceDetailLorawanComponent } from "./iot-device-detail/iot-device-detail-lorawan/iot-device-detail-lorawan.component";
import { IotDeviceDetailSigfoxComponent } from "./iot-device-detail/iot-device-detail-sigfox/iot-device-detail-sigfox.component";
@@ -33,6 +33,7 @@ import { ClipboardModule } from "@angular/cdk/clipboard";
import { ExportCsvDialogComponent } from "./iot-devices-tab/export-csv-dialog/export-csv-dialog.component";
import { IotDeviceDetailsMqttInternalBrokerComponent } from "@applications/iot-devices/iot-device-detail/iot-device-details-mqtt-internal-broker/iot-device-details-mqtt-internal-broker.component";
import { IotDeviceDetailsMqttExternalBrokerComponent } from "@applications/iot-devices/iot-device-detail/iot-device-details-mqtt-external-broker/iot-device-details-mqtt-external-broker.component";
+import { DownlinkTablesComponent } from "./iot-device-detail/downlink/downlink-tables/downlink-tables.component";
@NgModule({
declarations: [
@@ -45,6 +46,7 @@ import { IotDeviceDetailsMqttExternalBrokerComponent } from "@applications/iot-d
IotDeviceDetailSigfoxComponent,
DownlinkComponent,
DownlinkDialogComponent,
+ DownlinkTablesComponent,
DeviceModelComponent,
DataPackageComponent,
DataPackagesTimestampComponent,
diff --git a/src/app/applications/multicast/multicast-detail/multicast-detail.component.ts b/src/app/applications/multicast/multicast-detail/multicast-detail.component.ts
index 2b03d891b..334e27eee 100644
--- a/src/app/applications/multicast/multicast-detail/multicast-detail.component.ts
+++ b/src/app/applications/multicast/multicast-detail/multicast-detail.component.ts
@@ -9,13 +9,13 @@ import { Multicast } from "../multicast.model";
import { Location } from "@angular/common";
import { MulticastService } from "../multicast.service";
import { SnackService } from "@shared/services/snack.service";
-import { Downlink } from "@applications/iot-devices/downlink.model";
import { HttpErrorResponse } from "@angular/common/http";
import { ErrorMessageService } from "@shared/error-message.service";
import { MatDialog } from "@angular/material/dialog";
import { DownlinkDialogComponent } from "@applications/iot-devices/iot-device-detail/downlink/downlink-dialog/downlink-dialog.component";
import { keyPressedHex } from "@shared/constants/regex-constants";
import { DownlinkService } from "@shared/services/downlink.service";
+import { Downlink } from "@applications/iot-devices/iot-device-detail/downlink/downlink.model";
@Component({
selector: "app-multicast-detail",
diff --git a/src/app/applications/multicast/multicast.service.ts b/src/app/applications/multicast/multicast.service.ts
index a3255700a..cf7b70819 100644
--- a/src/app/applications/multicast/multicast.service.ts
+++ b/src/app/applications/multicast/multicast.service.ts
@@ -1,11 +1,11 @@
import { Injectable } from "@angular/core";
import { UserMinimalService } from "@app/admin/users/user-minimal.service";
-import { Downlink } from "@applications/iot-devices/downlink.model";
import { RestService } from "@shared/services/rest.service";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
import { MulticastResponse } from "./multicast-response.model";
import { Multicast, MulticastData } from "./multicast.model";
+import { Downlink } from "@applications/iot-devices/iot-device-detail/downlink/downlink.model";
@Injectable({
providedIn: "root",
diff --git a/src/app/shared/pipes/custom-date.pipe.ts b/src/app/shared/pipes/custom-date.pipe.ts
index ab19873f7..ce74324b3 100644
--- a/src/app/shared/pipes/custom-date.pipe.ts
+++ b/src/app/shared/pipes/custom-date.pipe.ts
@@ -10,6 +10,15 @@ export class CustomDatePipe extends DatePipe implements PipeTransform {
}
}
+@Pipe({
+ name: "dkTimeWithSeconds",
+})
+export class CustomDatePipeWithSeconds extends DatePipe implements PipeTransform {
+ transform(value: any, args?: any): any {
+ return super.transform(value, " 'den' dd-MM-yyyy kl. HH:mm:ss");
+ }
+}
+
@Pipe({
name: "tableDatePipe",
})
diff --git a/src/app/shared/pipes/pipes.module.ts b/src/app/shared/pipes/pipes.module.ts
index c11555e6c..64a1d15a1 100644
--- a/src/app/shared/pipes/pipes.module.ts
+++ b/src/app/shared/pipes/pipes.module.ts
@@ -4,7 +4,7 @@ import { YesNoPipe } from "./yesNo.pipe";
import { ActiveDeactivePipe } from "./activeDeactive.pipe";
import { IsGlobalAdminPipe } from "./permission/is-global-admin.pipe";
import { CreatedUpdatedByPipe } from "./created-updated-by.pipe";
-import { CustomDatePipe, CustomTableDatePipe, CustomTableDateWithSecondsPipe, DateOnlyPipe } from "./custom-date.pipe";
+import { CustomDatePipe, CustomDatePipeWithSeconds, CustomTableDatePipe, CustomTableDateWithSecondsPipe, DateOnlyPipe } from "./custom-date.pipe";
import { FilterDevicesPipe } from "./filter-devices.pipe";
import { TranslatePermissionsPipe } from "./permission/translate-permissions.pipe";
import { SortByPipe } from "./sort-by.pipe";
@@ -19,6 +19,7 @@ import { SortByTranslationPipe } from "./sort-by-translation.pipe";
ActiveDeactivePipe,
YesNoPipe,
CustomDatePipe,
+ CustomDatePipeWithSeconds,
CustomTableDatePipe,
CustomTableDateWithSecondsPipe,
DateOnlyPipe,
@@ -37,6 +38,7 @@ import { SortByTranslationPipe } from "./sort-by-translation.pipe";
ActiveDeactivePipe,
YesNoPipe,
CustomDatePipe,
+ CustomDatePipeWithSeconds,
CustomTableDatePipe,
CustomTableDateWithSecondsPipe,
DateOnlyPipe,
diff --git a/src/app/shared/services/downlink.service.ts b/src/app/shared/services/downlink.service.ts
index b695f11a3..1216f7b34 100644
--- a/src/app/shared/services/downlink.service.ts
+++ b/src/app/shared/services/downlink.service.ts
@@ -1,31 +1,44 @@
import { Injectable } from "@angular/core";
import { RestService } from "./rest.service";
import { Observable } from "rxjs";
-import { Downlink } from "@applications/iot-devices/downlink.model";
import { MatSnackBar } from "@angular/material/snack-bar";
import { TranslateService } from "@ngx-translate/core";
+import { Downlink } from "@applications/iot-devices/iot-device-detail/downlink/downlink.model";
@Injectable({
providedIn: "root",
})
export class DownlinkService {
- private IOTDEVICEURL = "iot-device/";
- private DOWNLINKURL = "downlink";
+ private IOT_DEVICE_URL = "iot-device/";
+ private DOWNLINK_URL = "downlink";
+ private HISTORICAL_DOWNLINK_URL = "historicalDownlink";
+ private DOWNLINK_FLUSH_URL = "flushDownlinkQueue";
constructor(private restService: RestService, private snackBar: MatSnackBar, public translate: TranslateService) {}
- public get(deviceId: number, params = {}): Observable {
- const url = this.IOTDEVICEURL + deviceId + "/" + this.DOWNLINKURL;
+ public getDownlinkQueue(deviceId: number, params = {}): Observable {
+ const url = this.IOT_DEVICE_URL + deviceId + "/" + this.DOWNLINK_URL;
return this.restService.get(url, params);
}
- public post(downlink: Downlink, deviceId: number, params = {}): Observable {
- const url = this.IOTDEVICEURL + deviceId + "/" + this.DOWNLINKURL;
+ public getHistoricalDownlinkQueue(deviceId: number, params = {}): Observable {
+ const url = this.IOT_DEVICE_URL + deviceId + "/" + this.HISTORICAL_DOWNLINK_URL;
+ return this.restService.get(url, params);
+ }
+
+ public postDownlink(downlink: Downlink, deviceId: number, params = {}): Observable {
+ const url = this.IOT_DEVICE_URL + deviceId + "/" + this.DOWNLINK_URL;
return this.restService.post(url, downlink, params);
}
+
public showSendDownlinkFailNoDevices() {
this.snackBar.open(this.translate.instant("SNACK.NODEVICES"), this.translate.instant("SNACK.CLOSE"), {
duration: 10000,
});
}
+
+ public flushQueue(id: number, params = {}): Observable {
+ const url = this.IOT_DEVICE_URL + id + "/" + this.DOWNLINK_FLUSH_URL;
+ return this.restService.post(url, params);
+ }
}
diff --git a/src/assets/i18n/da.json b/src/assets/i18n/da.json
index 40769bebf..c4e1b2038 100644
--- a/src/assets/i18n/da.json
+++ b/src/assets/i18n/da.json
@@ -895,14 +895,27 @@
"DESCRIPTION": "Her kan du starte et downlink til din enhed",
"CONFIRMEDDOWNLINK": "Bekræft downlink",
"DIALOG-TITLE": "Downlink",
- "DIALOG-MESSAGE": "Der ligger allerede et downlink i kø, vil du overskrive?",
+ "DIALOG-MESSAGE": "Er du sikker på, at du vil rydde køen?",
"DIALOG-DECLINE": "Annuller",
- "DIALOG-CONFIRM": "Ja, overskriv",
+ "DIALOG-CONFIRM": "Ja, ryd køen",
"NOTIMPLEMENTED": "Denne feature er endnu ikke implementeret for den pågældende enhedstype",
"NO-PORT-OR-PAYLOAD": "Angiv en port og en payload",
"NO-PAYLOAD": "Angiv en payload",
"SIGFOX-PAYLOAD-LENGTH": "Downlink payload til Sigfox skal være præcis 16 tegn (Hexadecimal)",
- "FORMAT-ERROR": "Payload skal angives som Hexadecimal"
+ "FORMAT-ERROR": "Payload skal angives som Hexadecimal",
+ "FLUSH-QUEUE": "Ryd køen",
+ "RELOAD": "Reload",
+ "PAYLOADTITLE": "Payload (Hex)",
+ "DOWNLINKQUEUE": "Downlink kø",
+ "STARTDOWNLINK": "Start downlink til enhed",
+ "HISTORICQUEUE": "Historisk kø",
+ "FRAMECOUNTER": "Frame counter",
+ "SENDAT": "Leveret",
+ "RECEIVEDAT": "Modtaget",
+ "CONFIRMED": "Bekræftet (Ja/nej)",
+ "NOT-RECEIVED": "Ikke bekræftet modtaget",
+ "IN-QUEUE": "I kø",
+ "QUEUE-FLUSHED": "Kø ryddet"
},
"CREATED": "Oprettet",
"UPDATED": "Senest opdateret",
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index d167bd07b..5e6e0a1d2 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -1,48 +1,48 @@
{
- "GEN": {
- "CANCEL": "Cancel",
- "SHOW": "Show",
- "PER-PAGE": "Per page"
- },
- "NAV": {
- "DASHBOARD": "Dashboard",
- "APPLICATIONS": "Applications",
- "ALL-IOT-DEVICES": "All IoT Devices"
- },
- "APPLICATION": {
- "CREATE": "Create application",
- "SAVE": "Save application"
- },
- "APPLICATION-TABLE": {
- "NAME": "NAME",
- "IOT-DEVICES": "IOT DEVICES",
- "UPDATED": "LAST UPDATED"
- },
- "APPLICATION-TABLE-ROW": {
- "DELETE": "Delete",
- "EDIT": "Edit",
- "SHOW-OPTIONS": "Show options"
- },
- "FORM": {
- "CREATE-NEW-APPLICATION": "Create new application",
- "EDIT-NEW-APPLICATION": "Edit application",
- "CREATE-NEW-IOT-DEVICE": "Add IoT unit"
- },
- "QUESTION": {
- "APPLICATION-NAME-PLACEHOLDER": "Name of the application",
- "APPLICATION-DESCRIPTION-PLACEHOLDER": "Short description of the application"
- },
- "SORT": {
- "SORT": "Sort by",
- "UPDATED-ASCENDING": "Last updated: acsending",
- "UPDATED-DESCENDING": "Last updated: faldende",
- "CREATED-ASCENDING": "Created: acsending",
- "CREATED-DESCENDING": "Created: faldende",
- "NAME-ASCENDING": "Name: acsending",
- "NAME-DESCENDING": "Name: faldende"
- },
- "DBLCLICKINFO": "Doubleclick on the map or drag the marker to place the marker",
- "HEIGHTCURVESINFO": "The activated contour lines are only displayed at the innermost zoom levels.",
- "HEIGHTCURVES": "Height curves (0,5 m)",
- "SATELLITEDENMARK": "Satellite Denmark"
+ "GEN": {
+ "CANCEL": "Cancel",
+ "SHOW": "Show",
+ "PER-PAGE": "Per page"
+ },
+ "NAV": {
+ "DASHBOARD": "Dashboard",
+ "APPLICATIONS": "Applications",
+ "ALL-IOT-DEVICES": "All IoT Devices"
+ },
+ "APPLICATION": {
+ "CREATE": "Create application",
+ "SAVE": "Save application"
+ },
+ "APPLICATION-TABLE": {
+ "NAME": "NAME",
+ "IOT-DEVICES": "IOT DEVICES",
+ "UPDATED": "LAST UPDATED"
+ },
+ "APPLICATION-TABLE-ROW": {
+ "DELETE": "Delete",
+ "EDIT": "Edit",
+ "SHOW-OPTIONS": "Show options"
+ },
+ "FORM": {
+ "CREATE-NEW-APPLICATION": "Create new application",
+ "EDIT-NEW-APPLICATION": "Edit application",
+ "CREATE-NEW-IOT-DEVICE": "Add IoT unit"
+ },
+ "QUESTION": {
+ "APPLICATION-NAME-PLACEHOLDER": "Name of the application",
+ "APPLICATION-DESCRIPTION-PLACEHOLDER": "Short description of the application"
+ },
+ "SORT": {
+ "SORT": "Sort by",
+ "UPDATED-ASCENDING": "Last updated: acsending",
+ "UPDATED-DESCENDING": "Last updated: faldende",
+ "CREATED-ASCENDING": "Created: acsending",
+ "CREATED-DESCENDING": "Created: faldende",
+ "NAME-ASCENDING": "Name: acsending",
+ "NAME-DESCENDING": "Name: faldende"
+ },
+ "DBLCLICKINFO": "Doubleclick on the map or drag the marker to place the marker",
+ "HEIGHTCURVESINFO": "The activated contour lines are only displayed at the innermost zoom levels.",
+ "HEIGHTCURVES": "Height curves (0,5 m)",
+ "SATELLITEDENMARK": "Satellite Denmark"
}