From d520415d5bb4e34e879226f36bc05d73d41bebbf Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 12 Feb 2021 17:08:43 +0200 Subject: [PATCH 01/69] UI: Improvement load and update time into time series table --- .../timeseries-table-widget.component.html | 130 +++++++++--------- .../lib/timeseries-table-widget.component.ts | 100 ++++++++------ 2 files changed, 123 insertions(+), 107 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html index 5f8c94727d..0b41d35785 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.html @@ -39,73 +39,75 @@ - -
- - - Timestamp - - - - - {{ h.dataKey.label }} - - - - - - - -
- -
-
- - -
+ + Timestamp + + + + + {{ h.dataKey.label }} + + + + + + + +
+ - -
-
-
- - -
- widget.no-data-found -
- - + +
+ + + + +
+ + + + + + widget.no-data-found + + + +
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 4ce340d8ea..a1e8c76ef6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -40,12 +40,12 @@ import { } from '@shared/models/widget.models'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; -import {hashCode, isDefined, isDefinedAndNotNull, isNumber} from '@core/utils'; +import { hashCode, isDefined, isEqual, isNumber } from '@core/utils'; import cssjs from '@core/css/css'; import { PageLink } from '@shared/models/page/page-link'; import { Direction, SortOrder, sortOrderFromString } from '@shared/models/page/sort-order'; import { CollectionViewer, DataSource } from '@angular/cdk/collections'; -import { BehaviorSubject, fromEvent, merge, Observable, of } from 'rxjs'; +import { BehaviorSubject, fromEvent, merge, Observable, of, Subscription } from 'rxjs'; import { emptyPageData, PageData } from '@shared/models/page/page-data'; import { catchError, debounceTime, distinctUntilChanged, map, tap } from 'rxjs/operators'; import { MatPaginator } from '@angular/material/paginator'; @@ -129,6 +129,8 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI public showTimestamp = true; private dateFormatFilter: string; + private subscriptions: Subscription[] = []; + private searchAction: WidgetAction = { name: 'action.search', show: true, @@ -166,40 +168,27 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI debounceTime(150), distinctUntilChanged(), tap(() => { - if (this.displayPagination) { - this.paginators.forEach((paginator) => { - paginator.pageIndex = 0; - }); - } this.sources.forEach((source) => { source.pageLink.textSearch = this.textSearch; + if (this.displayPagination) { + source.pageLink.page = 0; + } }); - this.updateAllData(); + this.loadCurrentSourceRow(); + this.ctx.detectChanges(); }) ) .subscribe(); - if (this.displayPagination) { - this.sorts.forEach((sort, index) => { - sort.sortChange.subscribe(() => this.paginators.toArray()[index].pageIndex = 0); - }); - } - this.sorts.forEach((sort, index) => { - const paginator = this.displayPagination ? this.paginators.toArray()[index] : null; - sort.sortChange.subscribe(() => this.paginators.toArray()[index].pageIndex = 0); - ((this.displayPagination ? merge(sort.sortChange, paginator.page) : sort.sortChange) as Observable) - .pipe( - tap(() => this.updateData(sort, paginator, index)) - ) - .subscribe(); + this.sorts.changes.subscribe(() => { + this.initSubscriptionsToSortAndPaginator(); }); - this.updateAllData(); + + this.initSubscriptionsToSortAndPaginator(); } public onDataUpdated() { - this.sources.forEach((source) => { - source.timeseriesDatasource.dataUpdated(this.data); - }); + this.updateCurrentSourceData(); } private initialize() { @@ -305,7 +294,27 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI this.ctx.activeEntityInfo = activeEntityInfo; } + private initSubscriptionsToSortAndPaginator() { + this.subscriptions.forEach(subscription => subscription.unsubscribe()); + this.sorts.forEach((sort, index) => { + let paginator = null; + const observables = [sort.sortChange]; + if (this.displayPagination) { + paginator = this.paginators.toArray()[index]; + this.subscriptions.push( + sort.sortChange.subscribe(() => paginator.pageIndex = 0) + ); + observables.push(paginator.page); + } + this.updateData(sort, paginator); + this.subscriptions.push(merge(...observables).pipe( + tap(() => this.updateData(sort, paginator)) + ).subscribe()); + }); + } + onSourceIndexChanged() { + this.updateCurrentSourceData(); this.updateActiveEntityInfo(); } @@ -326,30 +335,19 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI exitFilterMode() { this.textSearchMode = false; this.textSearch = null; - this.sources.forEach((source, index) => { + this.sources.forEach((source) => { source.pageLink.textSearch = this.textSearch; - const sort = this.sorts.toArray()[index]; - let paginator = null; if (this.displayPagination) { - paginator = this.paginators.toArray()[index]; - paginator.pageIndex = 0; + source.pageLink.page = 0; } - this.updateData(sort, paginator, index); }); + this.loadCurrentSourceRow(); this.ctx.hideTitlePanel = false; this.ctx.detectChanges(true); } - private updateAllData() { - this.sources.forEach((source, index) => { - const sort = this.sorts.toArray()[index]; - const paginator = this.displayPagination ? this.paginators.toArray()[index] : null; - this.updateData(sort, paginator, index); - }); - } - - private updateData(sort: MatSort, paginator: MatPaginator, index: number) { - const source = this.sources[index]; + private updateData(sort: MatSort, paginator: MatPaginator) { + const source = this.sources[this.sourceIndex]; if (this.displayPagination) { source.pageLink.page = paginator.pageIndex; source.pageLink.pageSize = paginator.pageSize; @@ -418,7 +416,6 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI if (!isDefined(content)) { return ''; - } else { switch (typeof content) { case 'string': @@ -462,6 +459,18 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI } this.ctx.actionsApi.handleWidgetAction($event, actionDescriptor, entityId, entityName, row, entityLabel); } + + public isActiveTab(index: number): boolean { + return index === this.sourceIndex; + } + + private updateCurrentSourceData() { + this.sources[this.sourceIndex].timeseriesDatasource.dataUpdated(this.data); + } + + private loadCurrentSourceRow() { + this.sources[this.sourceIndex].timeseriesDatasource.loadRows(); + } } class TimeseriesDatasource implements DataSource { @@ -482,6 +491,10 @@ class TimeseriesDatasource implements DataSource { } connect(collectionViewer: CollectionViewer): Observable> { + if (this.rowsSubject.isStopped) { + this.rowsSubject.isStopped = false; + this.pageDataSubject.isStopped = false; + } return this.rowsSubject.asObservable(); } @@ -565,7 +578,8 @@ class TimeseriesDatasource implements DataSource { private fetchRows(pageLink: PageLink): Observable> { return this.allRows$.pipe( - map((data) => pageLink.filterData(data)) + map((data) => pageLink.filterData(data)), + distinctUntilChanged((prev, curr) => isEqual(prev, curr)) ); } } From 10cea37abe9249459a4e43e6a4e42edcba06f774 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 15 Feb 2021 18:41:44 +0200 Subject: [PATCH 02/69] UI: Add new setting for subscription reloadOnlyOnDataUpdated --- .../data/json/system/widget_bundles/cards.json | 4 ++-- ui-ngx/src/app/core/api/data-aggregator.ts | 10 ++++++++-- .../src/app/core/api/entity-data-subscription.ts | 4 +++- ui-ngx/src/app/core/api/entity-data.service.ts | 16 +++++++++++----- ui-ngx/src/app/core/api/widget-api.models.ts | 1 + ui-ngx/src/app/core/api/widget-subscription.ts | 6 ++++-- .../lib/timeseries-table-widget.component.ts | 5 ++--- .../widget/widget-component.service.ts | 3 +++ .../home/components/widget/widget.component.ts | 1 + ui-ngx/src/app/shared/models/widget.models.ts | 1 + 10 files changed, 36 insertions(+), 15 deletions(-) diff --git a/application/src/main/data/json/system/widget_bundles/cards.json b/application/src/main/data/json/system/widget_bundles/cards.json index 0d97afd5e7..c0f0d329b3 100644 --- a/application/src/main/data/json/system/widget_bundles/cards.json +++ b/application/src/main/data/json/system/widget_bundles/cards.json @@ -47,7 +47,7 @@ "resources": [], "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeseriesTableWidget.onDataUpdated();\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", + "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeseriesTableWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n reloadOnlyOnDataUpdated: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"TimeseriesTableSettings\",\n \"properties\": {\n \"showTimestamp\": {\n \"title\": \"Display timestamp column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"showMilliseconds\": {\n \"title\": \"Display timestamp milliseconds\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n }, \n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"hideEmptyLines\": {\n \"title\": \"Hide empty lines\",\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"required\": []\n },\n \"form\": [\n \"showTimestamp\",\n \"showMilliseconds\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"hideEmptyLines\"\n ]\n}", "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\"\n }\n ]\n}", "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Temperature °C\",\"color\":\"#2196f3\",\"settings\":{\"useCellStyleFunction\":true,\"cellStyleFunction\":\"if (value) {\\n var percent = (value + 60)/120 * 100;\\n var color = tinycolor.mix('blue', 'red', amount = percent);\\n color.setAlpha(.5);\\n return {\\n paddingLeft: '20px',\\n color: '#ffffff',\\n background: color.toRgbString(),\\n fontSize: '18px'\\n };\\n} else {\\n return {};\\n}\"},\"_hash\":0.8587686344902596,\"funcBody\":\"var value = prevValue + Math.random() * 40 - 20;\\nvar multiplier = Math.pow(10, 1 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -60) {\\n\\tvalue = -60;\\n} else if (value > 60) {\\n\\tvalue = 60;\\n}\\nreturn value;\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Humidity, %\",\"color\":\"#ffc107\",\"settings\":{\"useCellStyleFunction\":true,\"cellStyleFunction\":\"if (value) {\\n var percent = value;\\n var backgroundColor = tinycolor('blue');\\n backgroundColor.setAlpha(value/100);\\n var color = 'blue';\\n if (value > 50) {\\n color = 'white';\\n }\\n \\n return {\\n paddingLeft: '20px',\\n color: color,\\n background: backgroundColor.toRgbString(),\\n fontSize: '18px'\\n };\\n} else {\\n return {};\\n}\",\"useCellContentFunction\":false},\"_hash\":0.12775350966079668,\"funcBody\":\"var value = prevValue + Math.random() * 20 - 10;\\nvar multiplier = Math.pow(10, 1 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < 5) {\\n\\tvalue = 5;\\n} else if (value > 100) {\\n\\tvalue = 100;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":60000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"showTimestamp\":true,\"displayPagination\":true,\"defaultPageSize\":10},\"title\":\"Timeseries table\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"widgetStyle\":{},\"actions\":{},\"showTitleIcon\":false,\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"24px\"}" @@ -134,4 +134,4 @@ } } ] -} \ No newline at end of file +} diff --git a/ui-ngx/src/app/core/api/data-aggregator.ts b/ui-ngx/src/app/core/api/data-aggregator.ts index b78c0ad029..382c97bfcc 100644 --- a/ui-ngx/src/app/core/api/data-aggregator.ts +++ b/ui-ngx/src/app/core/api/data-aggregator.ts @@ -71,6 +71,7 @@ export class DataAggregator { private dataReceived = false; private resetPending = false; + private updatedData = false; private noAggregation = this.aggregationType === AggregationType.NONE; private aggregationTimeout = Math.max(this.interval, 1000); @@ -90,7 +91,8 @@ export class DataAggregator { private timeWindow: number, private interval: number, private stateData: boolean, - private utils: UtilsService) { + private utils: UtilsService, + private isReloadOnlyOnDataUpdated: boolean) { this.tsKeyNames.forEach((key) => { this.dataBuffer[key] = []; }); @@ -140,6 +142,7 @@ export class DataAggregator { this.elapsed = 0; this.aggregationTimeout = Math.max(this.interval, 1000); this.resetPending = true; + this.updatedData = false; this.intervalTimeoutHandle = setTimeout(this.onInterval.bind(this), this.aggregationTimeout); } @@ -180,6 +183,7 @@ export class DataAggregator { this.onInterval(history, detectChanges); } } + this.updatedData = true; } private onInterval(history?: boolean, detectChanges?: boolean) { @@ -201,8 +205,9 @@ export class DataAggregator { } else { this.data = this.updateData(); } - if (this.onDataCb) { + if (this.onDataCb && (!this.isReloadOnlyOnDataUpdated || this.updatedData)) { this.onDataCb(this.data, detectChanges); + this.updatedData = false; } if (!history) { this.intervalTimeoutHandle = setTimeout(this.onInterval.bind(this), this.aggregationTimeout); @@ -223,6 +228,7 @@ export class DataAggregator { this.lastPrevKvPairData[key] = [aggTimestamp, aggData.aggValue]; } aggKeyData.delete(aggTimestamp); + this.updatedData = true; } else if (aggTimestamp <= this.endTs) { const kvPair: [number, any] = [aggTimestamp, aggData.aggValue]; keyData.push(kvPair); diff --git a/ui-ngx/src/app/core/api/entity-data-subscription.ts b/ui-ngx/src/app/core/api/entity-data-subscription.ts index 6a8e21a389..44bbfd4c08 100644 --- a/ui-ngx/src/app/core/api/entity-data-subscription.ts +++ b/ui-ngx/src/app/core/api/entity-data-subscription.ts @@ -66,6 +66,7 @@ export interface EntityDataSubscriptionOptions { type: widgetType; entityFilter?: EntityFilter; isPaginatedDataSubscription?: boolean; + isReloadOnlyOnDataUpdated?: boolean; pageLink?: EntityDataPageLink; keyFilters?: Array; additionalKeyFilters?: Array; @@ -671,7 +672,8 @@ export class EntityDataSubscription { subsTw.aggregation.timeWindow, subsTw.aggregation.interval, subsTw.aggregation.stateData, - this.utils + this.utils, + this.entityDataSubscriptionOptions.isReloadOnlyOnDataUpdated ); } diff --git a/ui-ngx/src/app/core/api/entity-data.service.ts b/ui-ngx/src/app/core/api/entity-data.service.ts index c02f36a290..bd1a55c880 100644 --- a/ui-ngx/src/app/core/api/entity-data.service.ts +++ b/ui-ngx/src/app/core/api/entity-data.service.ts @@ -60,7 +60,8 @@ export class EntityDataService { constructor(private telemetryService: TelemetryWebsocketService, private utils: UtilsService) {} - public prepareSubscription(listener: EntityDataListener): Observable { + public prepareSubscription(listener: EntityDataListener, + isReloadOnlyOnDataUpdated = false): Observable { const datasource = listener.configDatasource; listener.subscriptionOptions = this.createSubscriptionOptions( datasource, @@ -68,7 +69,8 @@ export class EntityDataService { datasource.pageLink, datasource.keyFilters, null, - false); + false, + isReloadOnlyOnDataUpdated); if (datasource.type === DatasourceType.entity && (!datasource.entityFilter || !datasource.pageLink)) { return of(null); } @@ -87,7 +89,8 @@ export class EntityDataService { public subscribeForPaginatedData(listener: EntityDataListener, pageLink: EntityDataPageLink, - keyFilters: KeyFilter[]): Observable { + keyFilters: KeyFilter[], + isReloadOnlyOnDataUpdated = false): Observable { const datasource = listener.configDatasource; listener.subscriptionOptions = this.createSubscriptionOptions( datasource, @@ -95,7 +98,8 @@ export class EntityDataService { pageLink, datasource.keyFilters, keyFilters, - true); + true, + isReloadOnlyOnDataUpdated); if (datasource.type === DatasourceType.entity && (!datasource.entityFilter || !pageLink)) { listener.dataLoaded(emptyPageData(), [], listener.configDatasourceIndex, listener.subscriptionOptions.pageLink); @@ -119,7 +123,8 @@ export class EntityDataService { pageLink: EntityDataPageLink, keyFilters: KeyFilter[], additionalKeyFilters: KeyFilter[], - isPaginatedDataSubscription: boolean): EntityDataSubscriptionOptions { + isPaginatedDataSubscription: boolean, + isReloadOnlyOnDataUpdated: boolean): EntityDataSubscriptionOptions { const subscriptionDataKeys: Array = []; datasource.dataKeys.forEach((dataKey) => { const subscriptionDataKey: SubscriptionDataKey = { @@ -142,6 +147,7 @@ export class EntityDataService { entityDataSubscriptionOptions.additionalKeyFilters = additionalKeyFilters; } entityDataSubscriptionOptions.isPaginatedDataSubscription = isPaginatedDataSubscription; + entityDataSubscriptionOptions.isReloadOnlyOnDataUpdated = isReloadOnlyOnDataUpdated; return entityDataSubscriptionOptions; } } diff --git a/ui-ngx/src/app/core/api/widget-api.models.ts b/ui-ngx/src/app/core/api/widget-api.models.ts index 1579ae8d1e..e6cbb4108e 100644 --- a/ui-ngx/src/app/core/api/widget-api.models.ts +++ b/ui-ngx/src/app/core/api/widget-api.models.ts @@ -226,6 +226,7 @@ export interface WidgetSubscriptionOptions { hasDataPageLink?: boolean; singleEntity?: boolean; warnOnPageDataOverflow?: boolean; + reloadOnlyOnDataUpdated?: boolean; targetDeviceAliasIds?: Array; targetDeviceIds?: Array; useDashboardTimewindow?: boolean; diff --git a/ui-ngx/src/app/core/api/widget-subscription.ts b/ui-ngx/src/app/core/api/widget-subscription.ts index 3e3537941b..7bef682d36 100644 --- a/ui-ngx/src/app/core/api/widget-subscription.ts +++ b/ui-ngx/src/app/core/api/widget-subscription.ts @@ -83,6 +83,7 @@ export class WidgetSubscription implements IWidgetSubscription { hasDataPageLink: boolean; singleEntity: boolean; warnOnPageDataOverflow: boolean; + reloadOnlyOnDataUpdated: boolean; datasourcePages: PageData[]; dataPages: PageData>[]; @@ -200,6 +201,7 @@ export class WidgetSubscription implements IWidgetSubscription { this.hasDataPageLink = options.hasDataPageLink; this.singleEntity = options.singleEntity; this.warnOnPageDataOverflow = options.warnOnPageDataOverflow; + this.reloadOnlyOnDataUpdated = options.reloadOnlyOnDataUpdated; this.datasourcePages = []; this.datasources = []; this.dataPages = []; @@ -423,7 +425,7 @@ export class WidgetSubscription implements IWidgetSubscription { } }; this.entityDataListeners.push(listener); - return this.ctx.entityDataService.prepareSubscription(listener); + return this.ctx.entityDataService.prepareSubscription(listener, this.reloadOnlyOnDataUpdated); }); return forkJoin(resolveResultObservables).pipe( map((resolveResults) => { @@ -815,7 +817,7 @@ export class WidgetSubscription implements IWidgetSubscription { } }; this.entityDataListeners[datasourceIndex] = entityDataListener; - return this.ctx.entityDataService.subscribeForPaginatedData(entityDataListener, pageLink, keyFilters); + return this.ctx.entityDataService.subscribeForPaginatedData(entityDataListener, pageLink, keyFilters, this.reloadOnlyOnDataUpdated); } else { return of(null); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index a1e8c76ef6..937185c7f0 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -40,7 +40,7 @@ import { } from '@shared/models/widget.models'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; -import { hashCode, isDefined, isEqual, isNumber } from '@core/utils'; +import { hashCode, isDefined, isNumber } from '@core/utils'; import cssjs from '@core/css/css'; import { PageLink } from '@shared/models/page/page-link'; import { Direction, SortOrder, sortOrderFromString } from '@shared/models/page/sort-order'; @@ -578,8 +578,7 @@ class TimeseriesDatasource implements DataSource { private fetchRows(pageLink: PageLink): Observable> { return this.allRows$.pipe( - map((data) => pageLink.filterData(data)), - distinctUntilChanged((prev, curr) => isEqual(prev, curr)) + map((data) => pageLink.filterData(data)) ); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts index 2b5c001628..3a9db04714 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts @@ -485,6 +485,9 @@ export class WidgetComponentService { if (isUndefined(result.typeParameters.warnOnPageDataOverflow)) { result.typeParameters.warnOnPageDataOverflow = true; } + if (isUndefined(result.typeParameters.reloadOnlyOnDataUpdated)) { + result.typeParameters.reloadOnlyOnDataUpdated = false; + } if (isUndefined(result.typeParameters.dataKeysOptional)) { result.typeParameters.dataKeysOptional = false; } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index 7838f7e7ba..9d2db23d83 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -895,6 +895,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI hasDataPageLink: this.typeParameters.hasDataPageLink, singleEntity: this.typeParameters.singleEntity, warnOnPageDataOverflow: this.typeParameters.warnOnPageDataOverflow, + reloadOnlyOnDataUpdated: this.typeParameters.reloadOnlyOnDataUpdated, comparisonEnabled: comparisonSettings.comparisonEnabled, timeForComparison: comparisonSettings.timeForComparison }; diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index 179a6ff47b..12734ce364 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -154,6 +154,7 @@ export interface WidgetTypeParameters { hasDataPageLink?: boolean; singleEntity?: boolean; warnOnPageDataOverflow?: boolean; + reloadOnlyOnDataUpdated?: boolean; } export interface WidgetControllerDescriptor { From b6488d8b2d4a6cb5a472fb796e534ad023d12448 Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Tue, 16 Feb 2021 17:42:16 +0200 Subject: [PATCH 03/69] Add entity info for single-entity aliases even if no alarms to display --- ui-ngx/src/app/core/api/widget-subscription.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/core/api/widget-subscription.ts b/ui-ngx/src/app/core/api/widget-subscription.ts index 3e3537941b..c1bf3da44c 100644 --- a/ui-ngx/src/app/core/api/widget-subscription.ts +++ b/ui-ngx/src/app/core/api/widget-subscription.ts @@ -465,7 +465,15 @@ export class WidgetSubscription implements IWidgetSubscription { entityName = this.targetDeviceName; } } else if (this.type === widgetType.alarm) { - if (this.alarms && this.alarms.data.length) { + if (this.alarmSource && this.alarmSource.entityType && this.alarmSource.entityId) { + entityId = { + entityType: this.alarmSource.entityType, + id: this.alarmSource.entityId + }; + entityName = this.alarmSource.entityName; + entityLabel = this.alarmSource.entityLabel; + entityDescription = this.alarmSource.entityDescription; + } else if (this.alarms && this.alarms.data.length) { const data = this.alarms.data[0]; entityId = data.originator; entityName = data.originatorName; From b1dd779532b4a9657379b3c7b673470a74a643fb Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 17 Feb 2021 17:21:50 +0200 Subject: [PATCH 04/69] UI: Added to js/JSON editor always working fullscreen button (include fieldset tag disabled) --- .../app/shared/components/js-func.component.html | 16 ++++++++++------ .../components/json-content.component.html | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/shared/components/js-func.component.html b/ui-ngx/src/app/shared/components/js-func.component.html index 6173cacb99..6721ea2279 100644 --- a/ui-ngx/src/app/shared/components/js-func.component.html +++ b/ui-ngx/src/app/shared/components/js-func.component.html @@ -24,12 +24,16 @@ - +
+
+ +
+
diff --git a/ui-ngx/src/app/shared/components/json-content.component.html b/ui-ngx/src/app/shared/components/json-content.component.html index 596c2fcb36..b815ec6315 100644 --- a/ui-ngx/src/app/shared/components/json-content.component.html +++ b/ui-ngx/src/app/shared/components/json-content.component.html @@ -29,12 +29,16 @@ mat-button *ngIf="!readonly && !disabled" class="tidy" (click)="minifyJSON()"> {{'js-func.mini' | translate }} - +
+
+ +
+
From c01005627b8e3588864d8f26299ebbcbe3987f38 Mon Sep 17 00:00:00 2001 From: ShvaykaD Date: Mon, 22 Feb 2021 13:50:44 +0200 Subject: [PATCH 05/69] [3.3] Fix/psql ts partitions remove action (#4130) * fix psql ts partitions remove action by max ttl * added forced null assigning * added fix to upgrade * added update to upgrade script from 3.1.1 and 3.2.1 --- .../2.4.3/schema_update_psql_drop_partitions.sql | 11 ++++++----- .../server/install/ThingsboardInstallService.java | 4 ++++ .../install/CassandraTsDatabaseUpgradeService.java | 1 + .../service/install/PsqlTsDatabaseUpgradeService.java | 6 ++++++ .../install/TimescaleTsDatabaseUpgradeService.java | 1 + application/src/main/resources/logback.xml | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/application/src/main/data/upgrade/2.4.3/schema_update_psql_drop_partitions.sql b/application/src/main/data/upgrade/2.4.3/schema_update_psql_drop_partitions.sql index a650244d5a..3c2d43e197 100644 --- a/application/src/main/data/upgrade/2.4.3/schema_update_psql_drop_partitions.sql +++ b/application/src/main/data/upgrade/2.4.3/schema_update_psql_drop_partitions.sql @@ -84,11 +84,12 @@ BEGIN END IF; END IF; END IF; - END IF; - IF partition_to_delete IS NOT NULL THEN - RAISE NOTICE 'Partition to delete by max ttl: %', partition_to_delete; - EXECUTE format('DROP TABLE %I', partition_to_delete); - deleted := deleted + 1; + IF partition_to_delete IS NOT NULL THEN + RAISE NOTICE 'Partition to delete by max ttl: %', partition_to_delete; + EXECUTE format('DROP TABLE IF EXISTS %I', partition_to_delete); + partition_to_delete := NULL; + deleted := deleted + 1; + END IF; END IF; END LOOP; END IF; diff --git a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java index 658c4a1fba..d97866fcb5 100644 --- a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java +++ b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java @@ -187,6 +187,10 @@ public class ThingsboardInstallService { databaseEntitiesUpgradeService.upgradeDatabase("3.2.0"); case "3.2.1": log.info("Upgrading ThingsBoard from version 3.2.1 to 3.3.0 ..."); + if (databaseTsUpgradeService != null) { + databaseTsUpgradeService.upgradeDatabase("3.2.1"); + } + log.info("Updating system data..."); systemDataLoaderService.updateSystemWidgets(); break; diff --git a/application/src/main/java/org/thingsboard/server/service/install/CassandraTsDatabaseUpgradeService.java b/application/src/main/java/org/thingsboard/server/service/install/CassandraTsDatabaseUpgradeService.java index 76693192cf..0a64a59a08 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/CassandraTsDatabaseUpgradeService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/CassandraTsDatabaseUpgradeService.java @@ -50,6 +50,7 @@ public class CassandraTsDatabaseUpgradeService extends AbstractCassandraDatabase break; case "2.5.0": case "3.1.1": + case "3.2.1": break; default: throw new RuntimeException("Unable to upgrade Cassandra database, unsupported fromVersion: " + fromVersion); diff --git a/application/src/main/java/org/thingsboard/server/service/install/PsqlTsDatabaseUpgradeService.java b/application/src/main/java/org/thingsboard/server/service/install/PsqlTsDatabaseUpgradeService.java index 1aed8c01c4..fddec0367d 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/PsqlTsDatabaseUpgradeService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/PsqlTsDatabaseUpgradeService.java @@ -196,11 +196,17 @@ public class PsqlTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgradeSe } break; case "3.1.1": + case "3.2.1": try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { log.info("Load TTL functions ..."); loadSql(conn, LOAD_TTL_FUNCTIONS_SQL); log.info("Load Drop Partitions functions ..."); loadSql(conn, LOAD_DROP_PARTITIONS_FUNCTIONS_SQL); + + executeQuery(conn, "DROP PROCEDURE IF EXISTS cleanup_timeseries_by_ttl(character varying, bigint, bigint);"); + executeQuery(conn, "DROP FUNCTION IF EXISTS delete_asset_records_from_ts_kv(character varying, character varying, bigint);"); + executeQuery(conn, "DROP FUNCTION IF EXISTS delete_device_records_from_ts_kv(character varying, character varying, bigint);"); + executeQuery(conn, "DROP FUNCTION IF EXISTS delete_customer_records_from_ts_kv(character varying, character varying, bigint);"); } break; default: diff --git a/application/src/main/java/org/thingsboard/server/service/install/TimescaleTsDatabaseUpgradeService.java b/application/src/main/java/org/thingsboard/server/service/install/TimescaleTsDatabaseUpgradeService.java index 0920c2c07d..112ecc3018 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/TimescaleTsDatabaseUpgradeService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/TimescaleTsDatabaseUpgradeService.java @@ -178,6 +178,7 @@ public class TimescaleTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgr } break; case "3.1.1": + case "3.2.1": break; default: throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); diff --git a/application/src/main/resources/logback.xml b/application/src/main/resources/logback.xml index 6d10a74854..9170a96ea6 100644 --- a/application/src/main/resources/logback.xml +++ b/application/src/main/resources/logback.xml @@ -30,7 +30,7 @@ - + From 16f3146fd41eb678345e78a91f395d6b95adea2e Mon Sep 17 00:00:00 2001 From: VoBa Date: Mon, 22 Feb 2021 13:56:15 +0200 Subject: [PATCH 06/69] Push entity created event to the device profile rule chain and queue if specified (#4131) * Remove device from cache in case null value cached in the distributed redis * Handle case when device was removed from db but message in the queue exists * Code review chagnes * Added usage statistics configuration to yml file * Use msg queue instead of default * Make private * Make private * Push entity created event to the device profile rule chain and queue if specified --- .../actors/ruleChain/DefaultTbContext.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java index 6d27516811..33152b0964 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java @@ -278,7 +278,21 @@ class DefaultTbContext implements TbContext { } public TbMsg deviceCreatedMsg(Device device, RuleNodeId ruleNodeId) { - return entityActionMsg(device, device.getId(), ruleNodeId, DataConstants.ENTITY_CREATED); + RuleChainId ruleChainId = null; + String queueName = ServiceQueue.MAIN; + if (device.getDeviceProfileId() != null) { + DeviceProfile deviceProfile = mainCtx.getDeviceProfileCache().find(device.getDeviceProfileId()); + if (deviceProfile == null) { + log.warn("[{}] Device profile is null!", device.getDeviceProfileId()); + ruleChainId = null; + queueName = ServiceQueue.MAIN; + } else { + ruleChainId = deviceProfile.getDefaultRuleChainId(); + String defaultQueueName = deviceProfile.getDefaultQueueName(); + queueName = defaultQueueName != null ? defaultQueueName : ServiceQueue.MAIN; + } + } + return entityActionMsg(device, device.getId(), ruleNodeId, DataConstants.ENTITY_CREATED, queueName, ruleChainId); } public TbMsg assetCreatedMsg(Asset asset, RuleNodeId ruleNodeId) { @@ -290,8 +304,12 @@ class DefaultTbContext implements TbContext { } public TbMsg entityActionMsg(E entity, I id, RuleNodeId ruleNodeId, String action) { + return entityActionMsg(entity, id, ruleNodeId, action, ServiceQueue.MAIN, null); + } + + public TbMsg entityActionMsg(E entity, I id, RuleNodeId ruleNodeId, String action, String queueName, RuleChainId ruleChainId) { try { - return TbMsg.newMsg(action, id, getActionMetaData(ruleNodeId), mapper.writeValueAsString(mapper.valueToTree(entity))); + return TbMsg.newMsg(queueName, action, id, getActionMetaData(ruleNodeId), mapper.writeValueAsString(mapper.valueToTree(entity)), ruleChainId, null); } catch (JsonProcessingException | IllegalArgumentException e) { throw new RuntimeException("Failed to process " + id.getEntityType().name().toLowerCase() + " " + action + " msg: " + e); } From a4508aa193226e3c2950d4ec9abd0db1343dac8e Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Mon, 22 Feb 2021 17:18:48 +0200 Subject: [PATCH 07/69] Imrpvements to the entity message routing based on the device profile --- .../actors/ruleChain/DefaultTbContext.java | 18 +++++++++++++++++- .../service/queue/DefaultTbClusterService.java | 2 +- .../thingsboard/server/common/msg/TbMsg.java | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java index 33152b0964..e1717e3b9b 100644 --- a/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java +++ b/application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java @@ -37,6 +37,7 @@ import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; +import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.alarm.Alarm; import org.thingsboard.server.common.data.asset.Asset; @@ -300,7 +301,22 @@ class DefaultTbContext implements TbContext { } public TbMsg alarmActionMsg(Alarm alarm, RuleNodeId ruleNodeId, String action) { - return entityActionMsg(alarm, alarm.getId(), ruleNodeId, action); + RuleChainId ruleChainId = null; + String queueName = ServiceQueue.MAIN; + if (EntityType.DEVICE.equals(alarm.getOriginator().getEntityType())) { + DeviceId deviceId = new DeviceId(alarm.getOriginator().getId()); + DeviceProfile deviceProfile = mainCtx.getDeviceProfileCache().get(getTenantId(), deviceId); + if (deviceProfile == null) { + log.warn("[{}] Device profile is null!", deviceId); + ruleChainId = null; + queueName = ServiceQueue.MAIN; + } else { + ruleChainId = deviceProfile.getDefaultRuleChainId(); + String defaultQueueName = deviceProfile.getDefaultQueueName(); + queueName = defaultQueueName != null ? defaultQueueName : ServiceQueue.MAIN; + } + } + return entityActionMsg(alarm, alarm.getId(), ruleNodeId, action, queueName, ruleChainId); } public TbMsg entityActionMsg(E entity, I id, RuleNodeId ruleNodeId, String action) { diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java index 51fd388af9..133447022b 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java @@ -145,7 +145,7 @@ public class DefaultTbClusterService implements TbClusterService { tbMsg = transformMsg(tbMsg, deviceProfileCache.get(tenantId, new DeviceProfileId(entityId.getId()))); } } - TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, tenantId, entityId); + TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, tbMsg.getQueueName(), tenantId, entityId); log.trace("PUSHING msg: {} to:{}", tbMsg, tpi); ToRuleEngineMsg msg = ToRuleEngineMsg.newBuilder() .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) diff --git a/common/message/src/main/java/org/thingsboard/server/common/msg/TbMsg.java b/common/message/src/main/java/org/thingsboard/server/common/msg/TbMsg.java index 348e8021e4..66a3670ddd 100644 --- a/common/message/src/main/java/org/thingsboard/server/common/msg/TbMsg.java +++ b/common/message/src/main/java/org/thingsboard/server/common/msg/TbMsg.java @@ -120,7 +120,7 @@ public final class TbMsg implements Serializable { private TbMsg(String queueName, UUID id, long ts, String type, EntityId originator, TbMsgMetaData metaData, TbMsgDataType dataType, String data, RuleChainId ruleChainId, RuleNodeId ruleNodeId, int ruleNodeExecCounter, TbMsgCallback callback) { this.id = id; - this.queueName = queueName; + this.queueName = queueName != null ? queueName : ServiceQueue.MAIN; if (ts > 0) { this.ts = ts; } else { From 9a9379d1857b3edd32cff843bf7ad435ec74e565 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 23 Feb 2021 11:36:41 +0200 Subject: [PATCH 08/69] UI: Added validation of the obtained value from the cell style function --- .../widget/lib/alarms-table-widget.component.ts | 10 +++++++++- .../widget/lib/entities-table-widget.component.ts | 12 ++++++++++-- .../widget/lib/timeseries-table-widget.component.ts | 10 +++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts index d58ace0a6b..36d96ee875 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarms-table-widget.component.ts @@ -35,7 +35,7 @@ import { DataKey, WidgetActionDescriptor, WidgetConfig } from '@shared/models/wi import { IWidgetSubscription } from '@core/api/widget-api.models'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; -import { createLabelFromDatasource, deepClone, hashCode, isDefined, isNumber } from '@core/utils'; +import { createLabelFromDatasource, deepClone, hashCode, isDefined, isNumber, isObject } from '@core/utils'; import cssjs from '@core/css/css'; import { sortItems } from '@shared/models/page/page-link'; import { Direction } from '@shared/models/page/sort-order'; @@ -598,8 +598,16 @@ export class AlarmsTableWidgetComponent extends PageComponent implements OnInit, if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) { try { style = styleInfo.cellStyleFunction(value); + if (!isObject(style)) { + throw new TypeError(`${style === null ? 'null' : typeof style} instead of style object`); + } + if (Array.isArray(style)) { + throw new TypeError(`Array instead of style object`); + } } catch (e) { style = {}; + console.warn(`Cell style function for data key '${key.label}' in widget '${this.ctx.widgetTitle}' ` + + `returns '${e}'. Please check your cell style function.`); } } else { style = this.defaultStyle(key, value); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.ts index 25b036a467..9d1722ad26 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entities-table-widget.component.ts @@ -40,7 +40,7 @@ import { import { IWidgetSubscription } from '@core/api/widget-api.models'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; -import { createLabelFromDatasource, deepClone, hashCode, isDefined, isNumber } from '@core/utils'; +import { createLabelFromDatasource, deepClone, hashCode, isDefined, isNumber, isObject } from '@core/utils'; import cssjs from '@core/css/css'; import { CollectionViewer, DataSource } from '@angular/cdk/collections'; import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; @@ -515,8 +515,16 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) { try { style = styleInfo.cellStyleFunction(value); + if (!isObject(style)) { + throw new TypeError(`${style === null ? 'null' : typeof style} instead of style object`); + } + if (Array.isArray(style)) { + throw new TypeError(`Array instead of style object`); + } } catch (e) { style = {}; + console.warn(`Cell style function for data key '${key.label}' in widget '${this.ctx.widgetTitle}' ` + + `returns '${e}'. Please check your cell style function.`); } } else { style = {}; @@ -538,7 +546,7 @@ export class EntitiesTableWidgetComponent extends PageComponent implements OnIni try { content = contentInfo.cellContentFunction(value, entity, this.ctx); } catch (e) { - content = '' + value; + content = '' + value; } } else { content = this.defaultContent(key, contentInfo, value); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts index 4ce340d8ea..4d058fc4f1 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts @@ -40,7 +40,7 @@ import { } from '@shared/models/widget.models'; import { UtilsService } from '@core/services/utils.service'; import { TranslateService } from '@ngx-translate/core'; -import {hashCode, isDefined, isDefinedAndNotNull, isNumber} from '@core/utils'; +import { hashCode, isDefined, isNumber, isObject } from '@core/utils'; import cssjs from '@core/css/css'; import { PageLink } from '@shared/models/page/page-link'; import { Direction, SortOrder, sortOrderFromString } from '@shared/models/page/sort-order'; @@ -385,8 +385,16 @@ export class TimeseriesTableWidgetComponent extends PageComponent implements OnI if (styleInfo.useCellStyleFunction && styleInfo.cellStyleFunction) { try { style = styleInfo.cellStyleFunction(value); + if (!isObject(style)) { + throw new TypeError(`${style === null ? 'null' : typeof style} instead of style object`); + } + if (Array.isArray(style)) { + throw new TypeError(`Array instead of style object`); + } } catch (e) { style = {}; + console.warn(`Cell style function for data key '${source.header[index - 1].dataKey.label}' in widget ` + + `'${this.ctx.widgetConfig.title}' returns '${e}'. Please check your cell style function.`); } } } From 667a4459aae57eb6ea39f92cba1971c5b8dc8e18 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Mon, 22 Feb 2021 15:08:08 +0200 Subject: [PATCH 09/69] fixed sas credentials in iot hub node (cherry picked from commit 36ff1a8f9e853da7b5f1d0bf3e564b37ea0d92bc) --- .../rule/engine/credentials/CertPemCredentials.java | 2 +- .../rule/engine/mqtt/azure/AzureIotHubSasCredentials.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/credentials/CertPemCredentials.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/credentials/CertPemCredentials.java index 0a97be3bd0..54be64b7fa 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/credentials/CertPemCredentials.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/credentials/CertPemCredentials.java @@ -56,7 +56,7 @@ import java.security.spec.PKCS8EncodedKeySpec; public class CertPemCredentials implements ClientCredentials { private static final String TLS_VERSION = "TLSv1.2"; - private String caCert; + protected String caCert; private String cert; private String privateKey; private String password; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/mqtt/azure/AzureIotHubSasCredentials.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/mqtt/azure/AzureIotHubSasCredentials.java index 5155acf831..836f94c558 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/mqtt/azure/AzureIotHubSasCredentials.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/mqtt/azure/AzureIotHubSasCredentials.java @@ -40,8 +40,7 @@ import java.security.cert.X509Certificate; @JsonIgnoreProperties(ignoreUnknown = true) public class AzureIotHubSasCredentials extends CertPemCredentials { private String sasKey; - private String caCert; - + @Override public SslContext initSslContext() { try { From 72ea3273c73798aff13c2e808a25f44623856c6d Mon Sep 17 00:00:00 2001 From: Andrew Volostnykh Date: Wed, 24 Feb 2021 11:39:35 +0200 Subject: [PATCH 10/69] Fix of incorrect url for getTenantProfiles in REST Client --- .../src/main/java/org/thingsboard/rest/client/RestClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java index 39fd5c1db1..42db556f71 100644 --- a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java +++ b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java @@ -2188,7 +2188,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { Map params = new HashMap<>(); addPageLinkToParam(params, pageLink); return restTemplate.exchange( - baseURL + "/api/tenantProfiles" + getUrlParams(pageLink), + baseURL + "/api/tenantProfiles?" + getUrlParams(pageLink), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference>() { From 240422aa9479c2f5b8976958f0e4de0080ed9100 Mon Sep 17 00:00:00 2001 From: Andrew Volostnykh Date: Wed, 24 Feb 2021 13:14:10 +0200 Subject: [PATCH 11/69] Correction of the same typos --- .../src/main/java/org/thingsboard/rest/client/RestClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java index 42db556f71..6c537a0d55 100644 --- a/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java +++ b/rest-client/src/main/java/org/thingsboard/rest/client/RestClient.java @@ -2199,7 +2199,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { Map params = new HashMap<>(); addPageLinkToParam(params, pageLink); return restTemplate.exchange( - baseURL + "/api/tenantProfileInfos" + getUrlParams(pageLink), + baseURL + "/api/tenantProfileInfos?" + getUrlParams(pageLink), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference>() { @@ -2256,7 +2256,7 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { Map params = new HashMap<>(); addPageLinkToParam(params, pageLink); return restTemplate.exchange( - baseURL + "/api/users" + getUrlParams(pageLink), + baseURL + "/api/users?" + getUrlParams(pageLink), HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference>() { From c3a9e6917624eb758fcc4f3498a5682a88eedf4c Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Wed, 24 Feb 2021 13:10:58 +0200 Subject: [PATCH 12/69] Make file input work properly when there are multiple on page --- ui-ngx/src/app/shared/components/file-input.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/file-input.component.ts b/ui-ngx/src/app/shared/components/file-input.component.ts index 18162cbe8b..1dc64194d9 100644 --- a/ui-ngx/src/app/shared/components/file-input.component.ts +++ b/ui-ngx/src/app/shared/components/file-input.component.ts @@ -34,6 +34,7 @@ import { Subscription } from 'rxjs'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { FlowDirective } from '@flowjs/ngx-flow'; import { TranslateService } from '@ngx-translate/core'; +import { UtilsService } from '@core/services/utils.service'; @Component({ selector: 'tb-file-input', @@ -59,7 +60,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit, noFileText = 'import.no-file'; @Input() - inputId = 'select'; + inputId = this.utils.guid(); @Input() allowedExtensions: string; @@ -114,6 +115,7 @@ export class FileInputComponent extends PageComponent implements AfterViewInit, private propagateChange = null; constructor(protected store: Store, + private utils: UtilsService, public translate: TranslateService) { super(store); } From 29fd4fb02c5446d065e8ba7cf7d095d8fcbf22ee Mon Sep 17 00:00:00 2001 From: vzikratyi Date: Wed, 24 Feb 2021 12:34:29 +0200 Subject: [PATCH 13/69] Save Attributes to cache --- .../src/main/resources/thingsboard.yml | 5 + .../server/common/data/CacheConstants.java | 1 + .../dao/attributes/AttributeCacheKey.java | 35 ++++ .../server/dao/attributes/AttributeUtils.java | 39 ++++ .../dao/attributes/BaseAttributesService.java | 47 ++--- .../attributes/CachedAttributesService.java | 194 ++++++++++++++++++ 6 files changed, 292 insertions(+), 29 deletions(-) create mode 100644 dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeUtils.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 933c0d38f4..9efa16d911 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -322,6 +322,8 @@ actors: cache: # caffeine or redis type: "${CACHE_TYPE:caffeine}" + attributes: + enabled: "${CACHE_ATTRIBUTES_ENABLED:true}" caffeine: specs: @@ -355,6 +357,9 @@ caffeine: deviceProfiles: timeToLiveInMinutes: 1440 maxSize: 0 + attributes: + timeToLiveInMinutes: 1440 + maxSize: 100000 redis: # standalone or cluster diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java b/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java index 8088652588..c3490aa85f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java @@ -26,4 +26,5 @@ public class CacheConstants { public static final String SECURITY_SETTINGS_CACHE = "securitySettings"; public static final String TENANT_PROFILE_CACHE = "tenantProfiles"; public static final String DEVICE_PROFILE_CACHE = "deviceProfiles"; + public static final String ATTRIBUTES_CACHE = "attributes"; } diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java new file mode 100644 index 0000000000..05a7c55898 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java @@ -0,0 +1,35 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.attributes; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import org.thingsboard.server.common.data.id.EntityId; + +@EqualsAndHashCode +@Getter +@AllArgsConstructor +public class AttributeCacheKey { + private final String scope; + private final EntityId entityId; + private final String key; + + @Override + public String toString() { + return entityId + "_" + scope + "_" + key; + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeUtils.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeUtils.java new file mode 100644 index 0000000000..b1fc82fe88 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeUtils.java @@ -0,0 +1,39 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.attributes; + +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.dao.exception.IncorrectParameterException; +import org.thingsboard.server.dao.service.Validator; + +public class AttributeUtils { + public static void validate(EntityId id, String scope) { + Validator.validateId(id.getId(), "Incorrect id " + id); + Validator.validateString(scope, "Incorrect scope " + scope); + } + + public static void validate(AttributeKvEntry kvEntry) { + if (kvEntry == null) { + throw new IncorrectParameterException("Key value entry can't be null"); + } else if (kvEntry.getDataType() == null) { + throw new IncorrectParameterException("Incorrect kvEntry. Data type can't be null"); + } else { + Validator.validateString(kvEntry.getKey(), "Incorrect kvEntry. Key can't be empty"); + Validator.validatePositiveNumber(kvEntry.getLastUpdateTs(), "Incorrect last update ts. Ts should be positive"); + } + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java index e70604353a..3eee300627 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/BaseAttributesService.java @@ -15,31 +15,39 @@ */ package org.thingsboard.server.dao.attributes; -import com.google.common.collect.Lists; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; -import org.thingsboard.server.dao.exception.IncorrectParameterException; import org.thingsboard.server.dao.service.Validator; import java.util.Collection; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; + +import static org.thingsboard.server.dao.attributes.AttributeUtils.validate; /** * @author Andrew Shvayka */ @Service +@ConditionalOnProperty(prefix = "cache.attributes", value = "enabled", havingValue = "false", matchIfMissing = true) +@Primary +@Slf4j public class BaseAttributesService implements AttributesService { + private final AttributesDao attributesDao; - @Autowired - private AttributesDao attributesDao; + public BaseAttributesService(AttributesDao attributesDao) { + this.attributesDao = attributesDao; + } @Override public ListenableFuture> find(TenantId tenantId, EntityId entityId, String scope, String attributeKey) { @@ -75,33 +83,14 @@ public class BaseAttributesService implements AttributesService { public ListenableFuture> save(TenantId tenantId, EntityId entityId, String scope, List attributes) { validate(entityId, scope); attributes.forEach(attribute -> validate(attribute)); - List> futures = Lists.newArrayListWithExpectedSize(attributes.size()); - for (AttributeKvEntry attribute : attributes) { - futures.add(attributesDao.save(tenantId, entityId, scope, attribute)); - } - return Futures.allAsList(futures); + + List> saveFutures = attributes.stream().map(attribute -> attributesDao.save(tenantId, entityId, scope, attribute)).collect(Collectors.toList()); + return Futures.allAsList(saveFutures); } @Override - public ListenableFuture> removeAll(TenantId tenantId, EntityId entityId, String scope, List keys) { + public ListenableFuture> removeAll(TenantId tenantId, EntityId entityId, String scope, List attributeKeys) { validate(entityId, scope); - return attributesDao.removeAll(tenantId, entityId, scope, keys); - } - - private static void validate(EntityId id, String scope) { - Validator.validateId(id.getId(), "Incorrect id " + id); - Validator.validateString(scope, "Incorrect scope " + scope); - } - - private static void validate(AttributeKvEntry kvEntry) { - if (kvEntry == null) { - throw new IncorrectParameterException("Key value entry can't be null"); - } else if (kvEntry.getDataType() == null) { - throw new IncorrectParameterException("Incorrect kvEntry. Data type can't be null"); - } else { - Validator.validateString(kvEntry.getKey(), "Incorrect kvEntry. Key can't be empty"); - Validator.validatePositiveNumber(kvEntry.getLastUpdateTs(), "Incorrect last update ts. Ts should be positive"); - } + return attributesDao.removeAll(tenantId, entityId, scope, attributeKeys); } - } diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java new file mode 100644 index 0000000000..22e9a95bd6 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java @@ -0,0 +1,194 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.attributes; + +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.EntityType; +import org.thingsboard.server.common.data.id.DeviceProfileId; +import org.thingsboard.server.common.data.id.EntityId; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.common.data.kv.KvEntry; +import org.thingsboard.server.common.stats.DefaultCounter; +import org.thingsboard.server.common.stats.StatsFactory; +import org.thingsboard.server.dao.service.Validator; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +import static org.thingsboard.server.common.data.CacheConstants.ATTRIBUTES_CACHE; +import static org.thingsboard.server.dao.attributes.AttributeUtils.validate; + +@Service +@ConditionalOnProperty(prefix = "cache.attributes", value = "enabled", havingValue = "true") +@Primary +@Slf4j +public class CachedAttributesService implements AttributesService { + private static final String STATS_NAME = "attributes.cache"; + + private final AttributesDao attributesDao; + private final Cache attributesCache; + + private final DefaultCounter hitCounter; + private final DefaultCounter missCounter; + + public CachedAttributesService(AttributesDao attributesDao, + CacheManager cacheManager, + StatsFactory statsFactory) { + this.attributesDao = attributesDao; + this.attributesCache = cacheManager.getCache(ATTRIBUTES_CACHE); + + this.hitCounter = statsFactory.createDefaultCounter(STATS_NAME, "result", "hit"); + this.missCounter = statsFactory.createDefaultCounter(STATS_NAME, "result", "miss"); + } + + @Override + public ListenableFuture> find(TenantId tenantId, EntityId entityId, String scope, String attributeKey) { + validate(entityId, scope); + Validator.validateString(attributeKey, "Incorrect attribute key " + attributeKey); + + AttributeCacheKey attributeCacheKey = new AttributeCacheKey(scope, entityId, attributeKey); + Cache.ValueWrapper cachedAttributeValue = attributesCache.get(attributeCacheKey); + if (cachedAttributeValue != null) { + hitCounter.increment(); + AttributeKvEntry cachedAttributeKvEntry = (AttributeKvEntry) cachedAttributeValue.get(); + return Futures.immediateFuture(Optional.ofNullable(cachedAttributeKvEntry)); + } else { + missCounter.increment(); + ListenableFuture> result = attributesDao.find(tenantId, entityId, scope, attributeKey); + return Futures.transform(result, foundAttrKvEntry -> { + // TODO: think if it's a good idea to store 'empty' attributes + attributesCache.put(attributeKey, foundAttrKvEntry.orElse(null)); + return foundAttrKvEntry; + }, MoreExecutors.directExecutor()); + } + } + + @Override + public ListenableFuture> find(TenantId tenantId, EntityId entityId, String scope, Collection attributeKeys) { + validate(entityId, scope); + attributeKeys.forEach(attributeKey -> Validator.validateString(attributeKey, "Incorrect attribute key " + attributeKey)); + + Map wrappedCachedAttributes = findCachedAttributes(entityId, scope, attributeKeys); + + List cachedAttributes = wrappedCachedAttributes.values().stream() + .map(wrappedCachedAttribute -> (AttributeKvEntry) wrappedCachedAttribute.get()) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + if (wrappedCachedAttributes.size() == attributeKeys.size()) { + return Futures.immediateFuture(cachedAttributes); + } + + ArrayList notFoundAttributeKeys = new ArrayList<>(attributeKeys); + notFoundAttributeKeys.removeAll(wrappedCachedAttributes.keySet()); + + ListenableFuture> result = attributesDao.find(tenantId, entityId, scope, notFoundAttributeKeys); + return Futures.transform(result, foundInDbAttributes -> { + return mergeDbAndCacheAttributes(entityId, scope, cachedAttributes, notFoundAttributeKeys, foundInDbAttributes); + }, MoreExecutors.directExecutor()); + + } + + private Map findCachedAttributes(EntityId entityId, String scope, Collection attributeKeys) { + Map cachedAttributes = new HashMap<>(); + for (String attributeKey : attributeKeys) { + Cache.ValueWrapper cachedAttributeValue = attributesCache.get(new AttributeCacheKey(scope, entityId, attributeKey)); + if (cachedAttributeValue != null) { + hitCounter.increment(); + cachedAttributes.put(attributeKey, cachedAttributeValue); + } else { + missCounter.increment(); + } + } + return cachedAttributes; + } + + private List mergeDbAndCacheAttributes(EntityId entityId, String scope, List cachedAttributes, ArrayList notFoundAttributeKeys, List foundInDbAttributes) { + for (AttributeKvEntry foundInDbAttribute : foundInDbAttributes) { + AttributeCacheKey attributeCacheKey = new AttributeCacheKey(scope, entityId, foundInDbAttribute.getKey()); + attributesCache.put(attributeCacheKey, foundInDbAttribute); + notFoundAttributeKeys.remove(foundInDbAttribute.getKey()); + } + for (String key : notFoundAttributeKeys){ + attributesCache.put(new AttributeCacheKey(scope, entityId, key), null); + } + List mergedAttributes = new ArrayList<>(cachedAttributes); + mergedAttributes.addAll(foundInDbAttributes); + return mergedAttributes; + } + + @Override + public ListenableFuture> findAll(TenantId tenantId, EntityId entityId, String scope) { + validate(entityId, scope); + return attributesDao.findAll(tenantId, entityId, scope); + } + + @Override + public List findAllKeysByDeviceProfileId(TenantId tenantId, DeviceProfileId deviceProfileId) { + return attributesDao.findAllKeysByDeviceProfileId(tenantId, deviceProfileId); + } + + @Override + public List findAllKeysByEntityIds(TenantId tenantId, EntityType entityType, List entityIds) { + return attributesDao.findAllKeysByEntityIds(tenantId, entityType, entityIds); + } + + @Override + public ListenableFuture> save(TenantId tenantId, EntityId entityId, String scope, List attributes) { + validate(entityId, scope); + attributes.forEach(AttributeUtils::validate); + + List> saveFutures = attributes.stream().map(attribute -> attributesDao.save(tenantId, entityId, scope, attribute)).collect(Collectors.toList()); + ListenableFuture> future = Futures.allAsList(saveFutures); + + // TODO: can do if (attributesCache.get() != null) attributesCache.put() instead, but will be more twice more requests to cache + List attributeKeys = attributes.stream().map(KvEntry::getKey).collect(Collectors.toList()); + future.addListener(() -> evictAttributesFromCache(tenantId, entityId, scope, attributeKeys), MoreExecutors.directExecutor()); + return future; + } + + @Override + public ListenableFuture> removeAll(TenantId tenantId, EntityId entityId, String scope, List attributeKeys) { + validate(entityId, scope); + ListenableFuture> future = attributesDao.removeAll(tenantId, entityId, scope, attributeKeys); + future.addListener(() -> evictAttributesFromCache(tenantId, entityId, scope, attributeKeys), MoreExecutors.directExecutor()); + return future; + } + + private void evictAttributesFromCache(TenantId tenantId, EntityId entityId, String scope, List attributeKeys) { + try { + for (String attributeKey : attributeKeys) { + attributesCache.evict(new AttributeCacheKey(scope, entityId, attributeKey)); + } + } catch (Exception e) { + log.error("[{}][{}] Failed to remove values from cache.", tenantId, entityId, e); + } + } +} From ab76d81c6fb6716148f6b40608c8918b9e76c36c Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Thu, 25 Feb 2021 11:10:59 +0200 Subject: [PATCH 14/69] Imrpvements to the cache --- .../server/dao/attributes/AttributeCacheKey.java | 6 +++++- .../server/dao/attributes/CachedAttributesService.java | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java index 05a7c55898..10771656e9 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributeCacheKey.java @@ -20,10 +20,14 @@ import lombok.EqualsAndHashCode; import lombok.Getter; import org.thingsboard.server.common.data.id.EntityId; +import java.io.Serializable; + @EqualsAndHashCode @Getter @AllArgsConstructor -public class AttributeCacheKey { +public class AttributeCacheKey implements Serializable { + private static final long serialVersionUID = 2013369077925351881L; + private final String scope; private final EntityId entityId; private final String key; diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java index 22e9a95bd6..6ebebdbcaa 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java @@ -37,10 +37,12 @@ import org.thingsboard.server.dao.service.Validator; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import static org.thingsboard.server.common.data.CacheConstants.ATTRIBUTES_CACHE; @@ -106,13 +108,11 @@ public class CachedAttributesService implements AttributesService { return Futures.immediateFuture(cachedAttributes); } - ArrayList notFoundAttributeKeys = new ArrayList<>(attributeKeys); + Set notFoundAttributeKeys = new HashSet<>(attributeKeys); notFoundAttributeKeys.removeAll(wrappedCachedAttributes.keySet()); ListenableFuture> result = attributesDao.find(tenantId, entityId, scope, notFoundAttributeKeys); - return Futures.transform(result, foundInDbAttributes -> { - return mergeDbAndCacheAttributes(entityId, scope, cachedAttributes, notFoundAttributeKeys, foundInDbAttributes); - }, MoreExecutors.directExecutor()); + return Futures.transform(result, foundInDbAttributes -> mergeDbAndCacheAttributes(entityId, scope, cachedAttributes, notFoundAttributeKeys, foundInDbAttributes), MoreExecutors.directExecutor()); } @@ -130,7 +130,7 @@ public class CachedAttributesService implements AttributesService { return cachedAttributes; } - private List mergeDbAndCacheAttributes(EntityId entityId, String scope, List cachedAttributes, ArrayList notFoundAttributeKeys, List foundInDbAttributes) { + private List mergeDbAndCacheAttributes(EntityId entityId, String scope, List cachedAttributes, Set notFoundAttributeKeys, List foundInDbAttributes) { for (AttributeKvEntry foundInDbAttribute : foundInDbAttributes) { AttributeCacheKey attributeCacheKey = new AttributeCacheKey(scope, entityId, foundInDbAttribute.getKey()); attributesCache.put(attributeCacheKey, foundInDbAttribute); From c7df356fb7cc4780b6ca72a22722798bf6028410 Mon Sep 17 00:00:00 2001 From: vzikratyi Date: Thu, 25 Feb 2021 12:02:26 +0200 Subject: [PATCH 15/69] Wrapped attr cache requests, fixed bug --- .../attributes/AttributesCacheWrapper.java | 63 +++++++++++++++++++ .../attributes/CachedAttributesService.java | 19 +++--- 2 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesCacheWrapper.java diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesCacheWrapper.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesCacheWrapper.java new file mode 100644 index 0000000000..196204cda1 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/AttributesCacheWrapper.java @@ -0,0 +1,63 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.attributes; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.kv.AttributeKvEntry; + +import static org.thingsboard.server.common.data.CacheConstants.ATTRIBUTES_CACHE; + +@Service +@ConditionalOnProperty(prefix = "cache.attributes", value = "enabled", havingValue = "true") +@Primary +@Slf4j +public class AttributesCacheWrapper { + private final Cache attributesCache; + + public AttributesCacheWrapper(CacheManager cacheManager) { + this.attributesCache = cacheManager.getCache(ATTRIBUTES_CACHE); + } + + public Cache.ValueWrapper get(AttributeCacheKey attributeCacheKey) { + try { + return attributesCache.get(attributeCacheKey); + } catch (Exception e) { + log.debug("Failed to retrieve element from cache for key {}. Reason - {}.", attributeCacheKey, e.getMessage()); + return null; + } + } + + public void put(AttributeCacheKey attributeCacheKey, AttributeKvEntry attributeKvEntry) { + try { + attributesCache.put(attributeCacheKey, attributeKvEntry); + } catch (Exception e) { + log.debug("Failed to put element from cache for key {}. Reason - {}.", attributeCacheKey, e.getMessage()); + } + } + + public void evict(AttributeCacheKey attributeCacheKey) { + try { + attributesCache.evict(attributeCacheKey); + } catch (Exception e) { + log.debug("Failed to evict element from cache for key {}. Reason - {}.", attributeCacheKey, e.getMessage()); + } + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java index 6ebebdbcaa..87ddfeee9a 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/attributes/CachedAttributesService.java @@ -56,16 +56,15 @@ public class CachedAttributesService implements AttributesService { private static final String STATS_NAME = "attributes.cache"; private final AttributesDao attributesDao; - private final Cache attributesCache; - + private final AttributesCacheWrapper cacheWrapper; private final DefaultCounter hitCounter; private final DefaultCounter missCounter; public CachedAttributesService(AttributesDao attributesDao, - CacheManager cacheManager, + AttributesCacheWrapper cacheWrapper, StatsFactory statsFactory) { this.attributesDao = attributesDao; - this.attributesCache = cacheManager.getCache(ATTRIBUTES_CACHE); + this.cacheWrapper = cacheWrapper; this.hitCounter = statsFactory.createDefaultCounter(STATS_NAME, "result", "hit"); this.missCounter = statsFactory.createDefaultCounter(STATS_NAME, "result", "miss"); @@ -77,7 +76,7 @@ public class CachedAttributesService implements AttributesService { Validator.validateString(attributeKey, "Incorrect attribute key " + attributeKey); AttributeCacheKey attributeCacheKey = new AttributeCacheKey(scope, entityId, attributeKey); - Cache.ValueWrapper cachedAttributeValue = attributesCache.get(attributeCacheKey); + Cache.ValueWrapper cachedAttributeValue = cacheWrapper.get(attributeCacheKey); if (cachedAttributeValue != null) { hitCounter.increment(); AttributeKvEntry cachedAttributeKvEntry = (AttributeKvEntry) cachedAttributeValue.get(); @@ -87,7 +86,7 @@ public class CachedAttributesService implements AttributesService { ListenableFuture> result = attributesDao.find(tenantId, entityId, scope, attributeKey); return Futures.transform(result, foundAttrKvEntry -> { // TODO: think if it's a good idea to store 'empty' attributes - attributesCache.put(attributeKey, foundAttrKvEntry.orElse(null)); + cacheWrapper.put(attributeCacheKey, foundAttrKvEntry.orElse(null)); return foundAttrKvEntry; }, MoreExecutors.directExecutor()); } @@ -119,7 +118,7 @@ public class CachedAttributesService implements AttributesService { private Map findCachedAttributes(EntityId entityId, String scope, Collection attributeKeys) { Map cachedAttributes = new HashMap<>(); for (String attributeKey : attributeKeys) { - Cache.ValueWrapper cachedAttributeValue = attributesCache.get(new AttributeCacheKey(scope, entityId, attributeKey)); + Cache.ValueWrapper cachedAttributeValue = cacheWrapper.get(new AttributeCacheKey(scope, entityId, attributeKey)); if (cachedAttributeValue != null) { hitCounter.increment(); cachedAttributes.put(attributeKey, cachedAttributeValue); @@ -133,11 +132,11 @@ public class CachedAttributesService implements AttributesService { private List mergeDbAndCacheAttributes(EntityId entityId, String scope, List cachedAttributes, Set notFoundAttributeKeys, List foundInDbAttributes) { for (AttributeKvEntry foundInDbAttribute : foundInDbAttributes) { AttributeCacheKey attributeCacheKey = new AttributeCacheKey(scope, entityId, foundInDbAttribute.getKey()); - attributesCache.put(attributeCacheKey, foundInDbAttribute); + cacheWrapper.put(attributeCacheKey, foundInDbAttribute); notFoundAttributeKeys.remove(foundInDbAttribute.getKey()); } for (String key : notFoundAttributeKeys){ - attributesCache.put(new AttributeCacheKey(scope, entityId, key), null); + cacheWrapper.put(new AttributeCacheKey(scope, entityId, key), null); } List mergedAttributes = new ArrayList<>(cachedAttributes); mergedAttributes.addAll(foundInDbAttributes); @@ -185,7 +184,7 @@ public class CachedAttributesService implements AttributesService { private void evictAttributesFromCache(TenantId tenantId, EntityId entityId, String scope, List attributeKeys) { try { for (String attributeKey : attributeKeys) { - attributesCache.evict(new AttributeCacheKey(scope, entityId, attributeKey)); + cacheWrapper.evict(new AttributeCacheKey(scope, entityId, attributeKey)); } } catch (Exception e) { log.error("[{}][{}] Failed to remove values from cache.", tenantId, entityId, e); From 43309d2497cb1d7304d3f4d65dd82409f68173cd Mon Sep 17 00:00:00 2001 From: vzikratyi Date: Thu, 25 Feb 2021 12:33:01 +0200 Subject: [PATCH 16/69] Added instruction to update redis config if attr cache enabled --- application/src/main/resources/thingsboard.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 9efa16d911..5983a606e1 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -323,6 +323,7 @@ cache: # caffeine or redis type: "${CACHE_TYPE:caffeine}" attributes: + # make sure that if cache.type is 'redis' and cache.attributes.enabled is 'true' that you change 'maxmemory-policy' Redis config property to 'allkeys-lru', 'allkeys-lfu' or 'allkeys-random' enabled: "${CACHE_ATTRIBUTES_ENABLED:true}" caffeine: From 0f3d1baa3fd75d358f3d0dcffe9e79bf5ff42cb1 Mon Sep 17 00:00:00 2001 From: Illia Barkov Date: Thu, 25 Feb 2021 14:12:15 +0200 Subject: [PATCH 17/69] Added subject alternative names into key generation tool #4114 (#4163) --- tools/src/main/shell/keygen.properties | 1 + tools/src/main/shell/server.keygen.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/src/main/shell/keygen.properties b/tools/src/main/shell/keygen.properties index 0fb36d4524..d2733e5b7b 100644 --- a/tools/src/main/shell/keygen.properties +++ b/tools/src/main/shell/keygen.properties @@ -15,6 +15,7 @@ # DOMAIN_SUFFIX="$(hostname)" +SUBJECT_ALTERNATIVE_NAMES="ip:127.0.0.1" ORGANIZATIONAL_UNIT=Thingsboard ORGANIZATION=Thingsboard CITY=SF diff --git a/tools/src/main/shell/server.keygen.sh b/tools/src/main/shell/server.keygen.sh index e01b17b8b2..7679cbd812 100755 --- a/tools/src/main/shell/server.keygen.sh +++ b/tools/src/main/shell/server.keygen.sh @@ -86,6 +86,12 @@ fi echo "Generating SSL Key Pair..." +EXT="" + +if [[ ! -z "$SUBJECT_ALTERNATIVE_NAMES" ]]; then + EXT="-ext san=$SUBJECT_ALTERNATIVE_NAMES " +fi + keytool -genkeypair -v \ -alias $SERVER_KEY_ALIAS \ -dname "CN=$DOMAIN_SUFFIX, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ @@ -94,7 +100,8 @@ keytool -genkeypair -v \ -storepass $SERVER_KEYSTORE_PASSWORD \ -keyalg $SERVER_KEY_ALG \ -keysize $SERVER_KEY_SIZE \ - -validity 9999 + -validity 9999 \ + $EXT status=$? if [[ $status != 0 ]]; then From 7237497946bd7ca40c8818a19874ff971468d8cd Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 23 Feb 2021 17:26:38 +0200 Subject: [PATCH 18/69] UI: Fixed merge additional info after save entity; Fixed updated alarm rules count --- .../components/entity/entity-details-panel.component.ts | 6 +++++- .../pages/device-profile/device-profile-tabs.component.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-details-panel.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-details-panel.component.ts index 1efcc9211e..0eebbc353e 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-details-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entity-details-panel.component.ts @@ -280,7 +280,11 @@ export class EntityDetailsPanelComponent extends PageComponent implements OnInit saveEntity() { if (this.detailsForm.valid) { - const editingEntity = mergeDeep(this.editingEntity, this.entityComponent.entityFormValue()); + const editingEntity = {...this.editingEntity, ...this.entityComponent.entityFormValue()}; + if (this.editingEntity.hasOwnProperty('additionalInfo')) { + editingEntity.additionalInfo = + mergeDeep((this.editingEntity as any).additionalInfo, this.entityComponent.entityFormValue()?.additionalInfo); + } this.entitiesTableConfig.saveEntity(editingEntity).subscribe( (entity) => { this.entity = entity; diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html index 8022439213..f1a7af1e46 100644 --- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html +++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html @@ -42,7 +42,7 @@
From ece8fcee67c52e8aee53f7b90ea30da538b6173f Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 25 Feb 2021 17:31:24 +0200 Subject: [PATCH 19/69] UI: fixed text search include reserved characters --- ui-ngx/src/app/shared/models/page/page-link.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/models/page/page-link.ts b/ui-ngx/src/app/shared/models/page/page-link.ts index 96fb7d2925..92fe4634f5 100644 --- a/ui-ngx/src/app/shared/models/page/page-link.ts +++ b/ui-ngx/src/app/shared/models/page/page-link.ts @@ -108,7 +108,8 @@ export class PageLink { public toQuery(): string { let query = `?pageSize=${this.pageSize}&page=${this.page}`; if (this.textSearch && this.textSearch.length) { - query += `&textSearch=${this.textSearch}`; + const textSearch = encodeURIComponent(this.textSearch); + query += `&textSearch=${textSearch}`; } if (this.sortOrder) { query += `&sortProperty=${this.sortOrder.property}&sortOrder=${this.sortOrder.direction}`; From 477ee90e50bce2d5412d3664942bd6913ddb2028 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 26 Feb 2021 17:34:42 +0200 Subject: [PATCH 20/69] UI: Added the ability to get the value of a key that contains dots in the name to a table widgets --- ui-ngx/src/app/core/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui-ngx/src/app/core/utils.ts b/ui-ngx/src/app/core/utils.ts index ac79c0f04e..c03b10d4d1 100644 --- a/ui-ngx/src/app/core/utils.ts +++ b/ui-ngx/src/app/core/utils.ts @@ -324,6 +324,9 @@ export function snakeCase(name: string, separator: string): string { } export function getDescendantProp(obj: any, path: string): any { + if (obj.hasOwnProperty(path)) { + return obj[path]; + } return path.split('.').reduce((acc, part) => acc && acc[part], obj); } From 3cd964327a2686f6f2f6db4b8cccdd67b20a10dc Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Fri, 26 Feb 2021 14:14:11 +0200 Subject: [PATCH 21/69] Constant filters for device profile --- .../DefaultSystemDataLoaderService.java | 27 ++- .../data/device/profile/AlarmCondition.java | 2 +- .../device/profile/AlarmConditionFilter.java | 30 +++ .../profile/AlarmConditionFilterKey.java | 26 +++ .../device/profile/AlarmConditionKeyType.java | 23 ++ .../rule/engine/profile/AlarmRuleState.java | 78 ++++--- .../rule/engine/profile/AlarmState.java | 7 +- .../rule/engine/profile/DataSnapshot.java | 85 +++---- .../rule/engine/profile/DeviceState.java | 67 ++---- .../rule/engine/profile/ProfileState.java | 33 +-- .../rule/engine/profile/SnapshotUpdate.java | 8 +- .../profile/TbDeviceProfileNodeTest.java | 209 ++++++++++++++++-- 12 files changed, 414 insertions(+), 181 deletions(-) create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilter.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilterKey.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionKeyType.java diff --git a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java index ac502926f8..9028fe279e 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java @@ -36,6 +36,9 @@ import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.User; import org.thingsboard.server.common.data.alarm.AlarmSeverity; import org.thingsboard.server.common.data.device.profile.AlarmCondition; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilter; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.AlarmRule; import org.thingsboard.server.common.data.device.profile.DefaultDeviceProfileConfiguration; import org.thingsboard.server.common.data.device.profile.DefaultDeviceProfileTransportConfiguration; @@ -290,16 +293,16 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { AlarmCondition temperatureCondition = new AlarmCondition(); temperatureCondition.setSpec(new SimpleAlarmConditionSpec()); - KeyFilter temperatureAlarmFlagAttributeFilter = new KeyFilter(); - temperatureAlarmFlagAttributeFilter.setKey(new EntityKey(EntityKeyType.ATTRIBUTE, "temperatureAlarmFlag")); + AlarmConditionFilter temperatureAlarmFlagAttributeFilter = new AlarmConditionFilter(); + temperatureAlarmFlagAttributeFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, "temperatureAlarmFlag")); temperatureAlarmFlagAttributeFilter.setValueType(EntityKeyValueType.BOOLEAN); BooleanFilterPredicate temperatureAlarmFlagAttributePredicate = new BooleanFilterPredicate(); temperatureAlarmFlagAttributePredicate.setOperation(BooleanFilterPredicate.BooleanOperation.EQUAL); temperatureAlarmFlagAttributePredicate.setValue(new FilterPredicateValue<>(Boolean.TRUE)); temperatureAlarmFlagAttributeFilter.setPredicate(temperatureAlarmFlagAttributePredicate); - KeyFilter temperatureTimeseriesFilter = new KeyFilter(); - temperatureTimeseriesFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter temperatureTimeseriesFilter = new AlarmConditionFilter(); + temperatureTimeseriesFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); temperatureTimeseriesFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate temperatureTimeseriesFilterPredicate = new NumericFilterPredicate(); temperatureTimeseriesFilterPredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); @@ -317,8 +320,8 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { AlarmCondition clearTemperatureCondition = new AlarmCondition(); clearTemperatureCondition.setSpec(new SimpleAlarmConditionSpec()); - KeyFilter clearTemperatureTimeseriesFilter = new KeyFilter(); - clearTemperatureTimeseriesFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter clearTemperatureTimeseriesFilter = new AlarmConditionFilter(); + clearTemperatureTimeseriesFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); clearTemperatureTimeseriesFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate clearTemperatureTimeseriesFilterPredicate = new NumericFilterPredicate(); clearTemperatureTimeseriesFilterPredicate.setOperation(NumericFilterPredicate.NumericOperation.LESS_OR_EQUAL); @@ -340,16 +343,16 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { AlarmCondition humidityCondition = new AlarmCondition(); humidityCondition.setSpec(new SimpleAlarmConditionSpec()); - KeyFilter humidityAlarmFlagAttributeFilter = new KeyFilter(); - humidityAlarmFlagAttributeFilter.setKey(new EntityKey(EntityKeyType.ATTRIBUTE, "humidityAlarmFlag")); + AlarmConditionFilter humidityAlarmFlagAttributeFilter = new AlarmConditionFilter(); + humidityAlarmFlagAttributeFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, "humidityAlarmFlag")); humidityAlarmFlagAttributeFilter.setValueType(EntityKeyValueType.BOOLEAN); BooleanFilterPredicate humidityAlarmFlagAttributePredicate = new BooleanFilterPredicate(); humidityAlarmFlagAttributePredicate.setOperation(BooleanFilterPredicate.BooleanOperation.EQUAL); humidityAlarmFlagAttributePredicate.setValue(new FilterPredicateValue<>(Boolean.TRUE)); humidityAlarmFlagAttributeFilter.setPredicate(humidityAlarmFlagAttributePredicate); - KeyFilter humidityTimeseriesFilter = new KeyFilter(); - humidityTimeseriesFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "humidity")); + AlarmConditionFilter humidityTimeseriesFilter = new AlarmConditionFilter(); + humidityTimeseriesFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "humidity")); humidityTimeseriesFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate humidityTimeseriesFilterPredicate = new NumericFilterPredicate(); humidityTimeseriesFilterPredicate.setOperation(NumericFilterPredicate.NumericOperation.LESS); @@ -368,8 +371,8 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { AlarmCondition clearHumidityCondition = new AlarmCondition(); clearHumidityCondition.setSpec(new SimpleAlarmConditionSpec()); - KeyFilter clearHumidityTimeseriesFilter = new KeyFilter(); - clearHumidityTimeseriesFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "humidity")); + AlarmConditionFilter clearHumidityTimeseriesFilter = new AlarmConditionFilter(); + clearHumidityTimeseriesFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "humidity")); clearHumidityTimeseriesFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate clearHumidityTimeseriesFilterPredicate = new NumericFilterPredicate(); clearHumidityTimeseriesFilterPredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER_OR_EQUAL); diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmCondition.java b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmCondition.java index a13e9d05cc..bbe20bdcaa 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmCondition.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmCondition.java @@ -26,7 +26,7 @@ import java.util.concurrent.TimeUnit; @JsonIgnoreProperties(ignoreUnknown = true) public class AlarmCondition { - private List condition; + private List condition; private AlarmConditionSpec spec; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilter.java b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilter.java new file mode 100644 index 0000000000..86aafc19e5 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilter.java @@ -0,0 +1,30 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.device.profile; + +import lombok.Data; +import org.thingsboard.server.common.data.query.EntityKeyValueType; +import org.thingsboard.server.common.data.query.KeyFilterPredicate; + +@Data +public class AlarmConditionFilter { + + private AlarmConditionFilterKey key; + private EntityKeyValueType valueType; + private Object value; + private KeyFilterPredicate predicate; + +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilterKey.java b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilterKey.java new file mode 100644 index 0000000000..33ee0b0628 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionFilterKey.java @@ -0,0 +1,26 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.device.profile; + +import lombok.Data; + +@Data +public class AlarmConditionFilterKey { + + private final AlarmConditionKeyType type; + private final String key; + +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionKeyType.java b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionKeyType.java new file mode 100644 index 0000000000..d607df8e35 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/device/profile/AlarmConditionKeyType.java @@ -0,0 +1,23 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.device.profile; + +public enum AlarmConditionKeyType { + ATTRIBUTE, + TIME_SERIES, + ENTITY_FIELD, + CONSTANT +} diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmRuleState.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmRuleState.java index 499e9189cc..ab0d9df7c2 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmRuleState.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmRuleState.java @@ -16,9 +16,13 @@ package org.thingsboard.rule.engine.profile; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.thingsboard.rule.engine.profile.state.PersistedAlarmRuleState; import org.thingsboard.server.common.data.alarm.AlarmSeverity; import org.thingsboard.server.common.data.device.profile.AlarmCondition; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilter; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.AlarmConditionSpec; import org.thingsboard.server.common.data.device.profile.AlarmRule; import org.thingsboard.server.common.data.device.profile.CustomTimeSchedule; @@ -45,6 +49,7 @@ import java.util.Set; import java.util.function.Function; @Data +@Slf4j class AlarmRuleState { private final AlarmSeverity severity; @@ -52,12 +57,12 @@ class AlarmRuleState { private final AlarmConditionSpec spec; private final long requiredDurationInMs; private final long requiredRepeats; - private final Set entityKeys; + private final Set entityKeys; private PersistedAlarmRuleState state; private boolean updateFlag; private final DynamicPredicateValueCtx dynamicPredicateValueCtx; - AlarmRuleState(AlarmSeverity severity, AlarmRule alarmRule, Set entityKeys, PersistedAlarmRuleState state, DynamicPredicateValueCtx dynamicPredicateValueCtx) { + AlarmRuleState(AlarmSeverity severity, AlarmRule alarmRule, Set entityKeys, PersistedAlarmRuleState state, DynamicPredicateValueCtx dynamicPredicateValueCtx) { this.severity = severity; this.alarmRule = alarmRule; this.entityKeys = entityKeys; @@ -84,8 +89,8 @@ class AlarmRuleState { this.dynamicPredicateValueCtx = dynamicPredicateValueCtx; } - public boolean validateTsUpdate(Set changedKeys) { - for (EntityKey key : changedKeys) { + public boolean validateTsUpdate(Set changedKeys) { + for (AlarmConditionFilterKey key : changedKeys) { if (entityKeys.contains(key)) { return true; } @@ -93,18 +98,14 @@ class AlarmRuleState { return false; } - public boolean validateAttrUpdate(Set changedKeys) { + public boolean validateAttrUpdate(Set changedKeys) { //If the attribute was updated, but no new telemetry arrived - we ignore this until new telemetry is there. - for (EntityKey key : entityKeys) { - if (key.getType().equals(EntityKeyType.TIME_SERIES)) { + for (AlarmConditionFilterKey key : entityKeys) { + if (key.getType().equals(AlarmConditionKeyType.TIME_SERIES)) { return false; } } - for (EntityKey key : changedKeys) { - EntityKeyType keyType = key.getType(); - if (EntityKeyType.CLIENT_ATTRIBUTE.equals(keyType) || EntityKeyType.SERVER_ATTRIBUTE.equals(keyType) || EntityKeyType.SHARED_ATTRIBUTE.equals(keyType)) { - key = new EntityKey(EntityKeyType.ATTRIBUTE, key.getKey()); - } + for (AlarmConditionFilterKey key : changedKeys) { if (entityKeys.contains(key)) { return true; } @@ -259,16 +260,46 @@ class AlarmRuleState { private boolean eval(AlarmCondition condition, DataSnapshot data) { boolean eval = true; - for (KeyFilter keyFilter : condition.getCondition()) { - EntityKeyValue value = data.getValue(keyFilter.getKey()); + for (var filter : condition.getCondition()) { + EntityKeyValue value; + if (filter.getKey().getType().equals(AlarmConditionKeyType.CONSTANT)) { + try { + value = getConstantValue(filter); + } catch (RuntimeException e) { + log.warn("Failed to parse constant value from filter: {}", filter, e); + value = null; + } + } else { + value = data.getValue(filter.getKey()); + } if (value == null) { return false; } - eval = eval && eval(data, value, keyFilter.getPredicate()); + eval = eval && eval(data, value, filter.getPredicate()); } return eval; } + private EntityKeyValue getConstantValue(AlarmConditionFilter filter) { + EntityKeyValue value = new EntityKeyValue(); + String valueStr = filter.getValue().toString(); + switch (filter.getValueType()) { + case STRING: + value.setStrValue(valueStr); + break; + case DATE_TIME: + value.setLngValue(Long.valueOf(valueStr)); + break; + case NUMERIC: + value.setDblValue(Double.valueOf(valueStr)); + break; + case BOOLEAN: + value.setBoolValue(Boolean.valueOf(valueStr)); + break; + } + return value; + } + private boolean eval(DataSnapshot data, EntityKeyValue value, KeyFilterPredicate predicate) { switch (predicate.getType()) { case STRING: @@ -389,23 +420,14 @@ class AlarmRuleState { if (value.getDynamicValue() != null) { switch (value.getDynamicValue().getSourceType()) { case CURRENT_DEVICE: - ekv = data.getValue(new EntityKey(EntityKeyType.ATTRIBUTE, value.getDynamicValue().getSourceAttribute())); - if (ekv == null) { - ekv = data.getValue(new EntityKey(EntityKeyType.SERVER_ATTRIBUTE, value.getDynamicValue().getSourceAttribute())); - if (ekv == null) { - ekv = data.getValue(new EntityKey(EntityKeyType.SHARED_ATTRIBUTE, value.getDynamicValue().getSourceAttribute())); - if (ekv == null) { - ekv = data.getValue(new EntityKey(EntityKeyType.CLIENT_ATTRIBUTE, value.getDynamicValue().getSourceAttribute())); - } - } - } - if(ekv != null || !value.getDynamicValue().isInherit()) { + ekv = data.getValue(new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, value.getDynamicValue().getSourceAttribute())); + if (ekv != null || !value.getDynamicValue().isInherit()) { break; } case CURRENT_CUSTOMER: ekv = dynamicPredicateValueCtx.getCustomerValue(value.getDynamicValue().getSourceAttribute()); - if(ekv != null || !value.getDynamicValue().isInherit()) { - break; + if (ekv != null || !value.getDynamicValue().isInherit()) { + break; } case CURRENT_TENANT: ekv = dynamicPredicateValueCtx.getTenantValue(value.getDynamicValue().getSourceAttribute()); diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java index 7af0beb505..ca8628f86d 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java @@ -29,6 +29,7 @@ import org.thingsboard.server.common.data.Tenant; import org.thingsboard.server.common.data.alarm.Alarm; import org.thingsboard.server.common.data.alarm.AlarmSeverity; import org.thingsboard.server.common.data.alarm.AlarmStatus; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.DeviceProfileAlarm; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.EntityId; @@ -138,9 +139,9 @@ class AlarmState { public boolean validateUpdate(SnapshotUpdate update, AlarmRuleState state) { if (update != null) { //Check that the update type and that keys match. - if (update.getType().equals(EntityKeyType.TIME_SERIES)) { + if (update.getType().equals(AlarmConditionKeyType.TIME_SERIES)) { return state.validateTsUpdate(update.getKeys()); - } else if (update.getType().equals(EntityKeyType.ATTRIBUTE)) { + } else if (update.getType().equals(AlarmConditionKeyType.ATTRIBUTE)) { return state.validateAttrUpdate(update.getKeys()); } } @@ -252,7 +253,7 @@ class AlarmState { String alarmDetailsStr = ruleState.getAlarmRule().getAlarmDetails(); if (StringUtils.isNotEmpty(alarmDetailsStr)) { - for (KeyFilter keyFilter : ruleState.getAlarmRule().getCondition().getCondition()) { + for (var keyFilter : ruleState.getAlarmRule().getCondition().getCondition()) { EntityKeyValue entityKeyValue = dataSnapshot.getValue(keyFilter.getKey()); alarmDetailsStr = alarmDetailsStr.replaceAll(String.format("\\$\\{%s}", keyFilter.getKey().getKey()), getValueAsString(entityKeyValue)); } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DataSnapshot.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DataSnapshot.java index ed939bc3c1..c7db043dc9 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DataSnapshot.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DataSnapshot.java @@ -17,6 +17,8 @@ package org.thingsboard.rule.engine.profile; import lombok.Getter; import lombok.Setter; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.query.EntityKey; import org.thingsboard.server.common.data.query.EntityKeyType; @@ -30,55 +32,42 @@ class DataSnapshot { @Getter @Setter private long ts; - private final Set keys; - private final Map values = new ConcurrentHashMap<>(); + private final Set keys; + private final Map values = new ConcurrentHashMap<>(); - DataSnapshot(Set entityKeysToFetch) { + DataSnapshot(Set entityKeysToFetch) { this.keys = entityKeysToFetch; } - void removeValue(EntityKey key) { - switch (key.getType()) { - case ATTRIBUTE: - values.remove(key); - values.remove(getAttrKey(key, EntityKeyType.CLIENT_ATTRIBUTE)); - values.remove(getAttrKey(key, EntityKeyType.SHARED_ATTRIBUTE)); - values.remove(getAttrKey(key, EntityKeyType.SERVER_ATTRIBUTE)); - break; - case CLIENT_ATTRIBUTE: - case SHARED_ATTRIBUTE: - case SERVER_ATTRIBUTE: - values.remove(key); - values.remove(getAttrKey(key, EntityKeyType.ATTRIBUTE)); - break; - default: - values.remove(key); - } + static AlarmConditionFilterKey toConditionKey(EntityKey key) { + return new AlarmConditionFilterKey(toConditionKeyType(key.getType()), key.getKey()); } - boolean putValue(EntityKey key, long newTs, EntityKeyValue value) { - boolean updateOfTs = ts != newTs; - boolean result = false; - switch (key.getType()) { + static AlarmConditionKeyType toConditionKeyType(EntityKeyType keyType) { + switch (keyType) { case ATTRIBUTE: - result |= putIfKeyExists(key, value, updateOfTs); - result |= putIfKeyExists(getAttrKey(key, EntityKeyType.CLIENT_ATTRIBUTE), value, updateOfTs); - result |= putIfKeyExists(getAttrKey(key, EntityKeyType.SHARED_ATTRIBUTE), value, updateOfTs); - result |= putIfKeyExists(getAttrKey(key, EntityKeyType.SERVER_ATTRIBUTE), value, updateOfTs); - break; - case CLIENT_ATTRIBUTE: - case SHARED_ATTRIBUTE: case SERVER_ATTRIBUTE: - result |= putIfKeyExists(key, value, updateOfTs); - result |= putIfKeyExists(getAttrKey(key, EntityKeyType.ATTRIBUTE), value, updateOfTs); - break; + case SHARED_ATTRIBUTE: + case CLIENT_ATTRIBUTE: + return AlarmConditionKeyType.ATTRIBUTE; + case TIME_SERIES: + return AlarmConditionKeyType.TIME_SERIES; + case ENTITY_FIELD: + return AlarmConditionKeyType.ENTITY_FIELD; default: - result |= putIfKeyExists(key, value, updateOfTs); + throw new RuntimeException("Not supported entity key: " + keyType.name()); } - return result; } - private boolean putIfKeyExists(EntityKey key, EntityKeyValue value, boolean updateOfTs) { + void removeValue(EntityKey key) { + values.remove(toConditionKey(key)); + } + + boolean putValue(AlarmConditionFilterKey key, long newTs, EntityKeyValue value) { + return putIfKeyExists(key, value, ts != newTs); + } + + private boolean putIfKeyExists(AlarmConditionFilterKey key, EntityKeyValue value, boolean updateOfTs) { if (keys.contains(key)) { EntityKeyValue oldValue = values.put(key, value); if (updateOfTs) { @@ -91,25 +80,7 @@ class DataSnapshot { } } - EntityKeyValue getValue(EntityKey key) { - if (EntityKeyType.ATTRIBUTE.equals(key.getType())) { - EntityKeyValue value = values.get(key); - if (value == null) { - value = values.get(getAttrKey(key, EntityKeyType.CLIENT_ATTRIBUTE)); - if (value == null) { - value = values.get(getAttrKey(key, EntityKeyType.SHARED_ATTRIBUTE)); - if (value == null) { - value = values.get(getAttrKey(key, EntityKeyType.SERVER_ATTRIBUTE)); - } - } - } - return value; - } else { - return values.get(key); - } - } - - private EntityKey getAttrKey(EntityKey key, EntityKeyType clientAttribute) { - return new EntityKey(clientAttribute, key.getKey()); + EntityKeyValue getValue(AlarmConditionFilterKey key) { + return values.get(key); } } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DeviceState.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DeviceState.java index bb7d5f8862..827aa9eeb0 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DeviceState.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/DeviceState.java @@ -26,6 +26,8 @@ import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.alarm.Alarm; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.DeviceProfileAlarm; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.DeviceProfileId; @@ -97,10 +99,10 @@ class DeviceState { } public void updateProfile(TbContext ctx, DeviceProfile deviceProfile) throws ExecutionException, InterruptedException { - Set oldKeys = this.deviceProfile.getEntityKeys(); + Set oldKeys = this.deviceProfile.getEntityKeys(); this.deviceProfile.updateDeviceProfile(deviceProfile); if (latestValues != null) { - Set keysToFetch = new HashSet<>(this.deviceProfile.getEntityKeys()); + Set keysToFetch = new HashSet<>(this.deviceProfile.getEntityKeys()); keysToFetch.removeAll(oldKeys); if (!keysToFetch.isEmpty()) { addEntityKeysToSnapshot(ctx, deviceId, keysToFetch, latestValues); @@ -260,29 +262,29 @@ class DeviceState { } private SnapshotUpdate merge(DataSnapshot latestValues, Long newTs, List data) { - Set keys = new HashSet<>(); + Set keys = new HashSet<>(); for (KvEntry entry : data) { - EntityKey entityKey = new EntityKey(EntityKeyType.TIME_SERIES, entry.getKey()); + AlarmConditionFilterKey entityKey = new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, entry.getKey()); if (latestValues.putValue(entityKey, newTs, toEntityValue(entry))) { keys.add(entityKey); } } latestValues.setTs(newTs); - return new SnapshotUpdate(EntityKeyType.TIME_SERIES, keys); + return new SnapshotUpdate(AlarmConditionKeyType.TIME_SERIES, keys); } private SnapshotUpdate merge(DataSnapshot latestValues, Set attributes, String scope) { long newTs = 0; - Set keys = new HashSet<>(); + Set keys = new HashSet<>(); for (AttributeKvEntry entry : attributes) { newTs = Math.max(newTs, entry.getLastUpdateTs()); - EntityKey entityKey = new EntityKey(getKeyTypeFromScope(scope), entry.getKey()); + AlarmConditionFilterKey entityKey = new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, entry.getKey()); if (latestValues.putValue(entityKey, newTs, toEntityValue(entry))) { keys.add(entityKey); } } latestValues.setTs(newTs); - return new SnapshotUpdate(EntityKeyType.ATTRIBUTE, keys); + return new SnapshotUpdate(AlarmConditionKeyType.ATTRIBUTE, keys); } private static EntityKeyType getKeyTypeFromScope(String scope) { @@ -298,37 +300,22 @@ class DeviceState { } private DataSnapshot fetchLatestValues(TbContext ctx, EntityId originator) throws ExecutionException, InterruptedException { - Set entityKeysToFetch = deviceProfile.getEntityKeys(); + Set entityKeysToFetch = deviceProfile.getEntityKeys(); DataSnapshot result = new DataSnapshot(entityKeysToFetch); addEntityKeysToSnapshot(ctx, originator, entityKeysToFetch, result); return result; } - private void addEntityKeysToSnapshot(TbContext ctx, EntityId originator, Set entityKeysToFetch, DataSnapshot result) throws InterruptedException, ExecutionException { - Set serverAttributeKeys = new HashSet<>(); - Set clientAttributeKeys = new HashSet<>(); - Set sharedAttributeKeys = new HashSet<>(); - Set commonAttributeKeys = new HashSet<>(); + private void addEntityKeysToSnapshot(TbContext ctx, EntityId originator, Set entityKeysToFetch, DataSnapshot result) throws InterruptedException, ExecutionException { + Set attributeKeys = new HashSet<>(); Set latestTsKeys = new HashSet<>(); Device device = null; - for (EntityKey entityKey : entityKeysToFetch) { + for (AlarmConditionFilterKey entityKey : entityKeysToFetch) { String key = entityKey.getKey(); switch (entityKey.getType()) { - case SERVER_ATTRIBUTE: - serverAttributeKeys.add(key); - break; - case CLIENT_ATTRIBUTE: - clientAttributeKeys.add(key); - break; - case SHARED_ATTRIBUTE: - sharedAttributeKeys.add(key); - break; case ATTRIBUTE: - serverAttributeKeys.add(key); - clientAttributeKeys.add(key); - sharedAttributeKeys.add(key); - commonAttributeKeys.add(key); + attributeKeys.add(key); break; case TIME_SERIES: latestTsKeys.add(key); @@ -361,32 +348,22 @@ class DeviceState { List data = ctx.getTimeseriesService().findLatest(ctx.getTenantId(), originator, latestTsKeys).get(); for (TsKvEntry entry : data) { if (entry.getValue() != null) { - result.putValue(new EntityKey(EntityKeyType.TIME_SERIES, entry.getKey()), entry.getTs(), toEntityValue(entry)); + result.putValue(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, entry.getKey()), entry.getTs(), toEntityValue(entry)); } } } - if (!clientAttributeKeys.isEmpty()) { - addToSnapshot(result, commonAttributeKeys, - ctx.getAttributesService().find(ctx.getTenantId(), originator, DataConstants.CLIENT_SCOPE, clientAttributeKeys).get()); - } - if (!sharedAttributeKeys.isEmpty()) { - addToSnapshot(result, commonAttributeKeys, - ctx.getAttributesService().find(ctx.getTenantId(), originator, DataConstants.SHARED_SCOPE, sharedAttributeKeys).get()); - } - if (!serverAttributeKeys.isEmpty()) { - addToSnapshot(result, commonAttributeKeys, - ctx.getAttributesService().find(ctx.getTenantId(), originator, DataConstants.SERVER_SCOPE, serverAttributeKeys).get()); + if (!attributeKeys.isEmpty()) { + addToSnapshot(result, ctx.getAttributesService().find(ctx.getTenantId(), originator, DataConstants.CLIENT_SCOPE, attributeKeys).get()); + addToSnapshot(result, ctx.getAttributesService().find(ctx.getTenantId(), originator, DataConstants.SHARED_SCOPE, attributeKeys).get()); + addToSnapshot(result, ctx.getAttributesService().find(ctx.getTenantId(), originator, DataConstants.SERVER_SCOPE, attributeKeys).get()); } } - private void addToSnapshot(DataSnapshot snapshot, Set commonAttributeKeys, List data) { + private void addToSnapshot(DataSnapshot snapshot, List data) { for (AttributeKvEntry entry : data) { if (entry.getValue() != null) { EntityKeyValue value = toEntityValue(entry); - snapshot.putValue(new EntityKey(EntityKeyType.CLIENT_ATTRIBUTE, entry.getKey()), entry.getLastUpdateTs(), value); - if (commonAttributeKeys.contains(entry.getKey())) { - snapshot.putValue(new EntityKey(EntityKeyType.ATTRIBUTE, entry.getKey()), entry.getLastUpdateTs(), value); - } + snapshot.putValue(new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, entry.getKey()), entry.getLastUpdateTs(), value); } } } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java index 08a230d716..8fbacc120d 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/ProfileState.java @@ -19,6 +19,9 @@ import lombok.AccessLevel; import lombok.Getter; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.alarm.AlarmSeverity; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilter; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.AlarmRule; import org.thingsboard.server.common.data.device.profile.DeviceProfileAlarm; import org.thingsboard.server.common.data.id.DeviceProfileId; @@ -50,10 +53,10 @@ class ProfileState { @Getter(AccessLevel.PACKAGE) private final List alarmSettings = new CopyOnWriteArrayList<>(); @Getter(AccessLevel.PACKAGE) - private final Set entityKeys = ConcurrentHashMap.newKeySet(); + private final Set entityKeys = ConcurrentHashMap.newKeySet(); - private final Map>> alarmCreateKeys = new HashMap<>(); - private final Map> alarmClearKeys = new HashMap<>(); + private final Map>> alarmCreateKeys = new HashMap<>(); + private final Map> alarmClearKeys = new HashMap<>(); ProfileState(DeviceProfile deviceProfile) { updateDeviceProfile(deviceProfile); @@ -68,18 +71,18 @@ class ProfileState { if (deviceProfile.getProfileData().getAlarms() != null) { alarmSettings.addAll(deviceProfile.getProfileData().getAlarms()); for (DeviceProfileAlarm alarm : deviceProfile.getProfileData().getAlarms()) { - Map> createAlarmKeys = alarmCreateKeys.computeIfAbsent(alarm.getId(), id -> new HashMap<>()); + Map> createAlarmKeys = alarmCreateKeys.computeIfAbsent(alarm.getId(), id -> new HashMap<>()); alarm.getCreateRules().forEach(((severity, alarmRule) -> { - Set ruleKeys = createAlarmKeys.computeIfAbsent(severity, id -> new HashSet<>()); - for (KeyFilter keyFilter : alarmRule.getCondition().getCondition()) { + var ruleKeys = createAlarmKeys.computeIfAbsent(severity, id -> new HashSet<>()); + for (var keyFilter : alarmRule.getCondition().getCondition()) { entityKeys.add(keyFilter.getKey()); ruleKeys.add(keyFilter.getKey()); addDynamicValuesRecursively(keyFilter.getPredicate(), entityKeys, ruleKeys); } })); if (alarm.getClearRule() != null) { - Set clearAlarmKeys = alarmClearKeys.computeIfAbsent(alarm.getId(), id -> new HashSet<>()); - for (KeyFilter keyFilter : alarm.getClearRule().getCondition().getCondition()) { + var clearAlarmKeys = alarmClearKeys.computeIfAbsent(alarm.getId(), id -> new HashSet<>()); + for (var keyFilter : alarm.getClearRule().getCondition().getCondition()) { entityKeys.add(keyFilter.getKey()); clearAlarmKeys.add(keyFilter.getKey()); addDynamicValuesRecursively(keyFilter.getPredicate(), entityKeys, clearAlarmKeys); @@ -89,7 +92,7 @@ class ProfileState { } } - private void addDynamicValuesRecursively(KeyFilterPredicate predicate, Set entityKeys, Set ruleKeys) { + private void addDynamicValuesRecursively(KeyFilterPredicate predicate, Set entityKeys, Set ruleKeys) { switch (predicate.getType()) { case STRING: case NUMERIC: @@ -98,7 +101,7 @@ class ProfileState { if (value != null && (value.getSourceType() == DynamicValueSourceType.CURRENT_TENANT || value.getSourceType() == DynamicValueSourceType.CURRENT_CUSTOMER || value.getSourceType() == DynamicValueSourceType.CURRENT_DEVICE)) { - EntityKey entityKey = new EntityKey(EntityKeyType.ATTRIBUTE, value.getSourceAttribute()); + AlarmConditionFilterKey entityKey = new AlarmConditionFilterKey(AlarmConditionKeyType.ATTRIBUTE, value.getSourceAttribute()); entityKeys.add(entityKey); ruleKeys.add(entityKey); } @@ -115,12 +118,12 @@ class ProfileState { return deviceProfile.getId(); } - Set getCreateAlarmKeys(String id, AlarmSeverity severity) { - Map> sKeys = alarmCreateKeys.get(id); + Set getCreateAlarmKeys(String id, AlarmSeverity severity) { + Map> sKeys = alarmCreateKeys.get(id); if (sKeys == null) { return Collections.emptySet(); } else { - Set keys = sKeys.get(severity); + Set keys = sKeys.get(severity); if (keys == null) { return Collections.emptySet(); } else { @@ -129,8 +132,8 @@ class ProfileState { } } - Set getClearAlarmKeys(String id) { - Set keys = alarmClearKeys.get(id); + Set getClearAlarmKeys(String id) { + Set keys = alarmClearKeys.get(id); if (keys == null) { return Collections.emptySet(); } else { diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/SnapshotUpdate.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/SnapshotUpdate.java index 1ad1860d5a..7a3ce5debc 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/SnapshotUpdate.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/SnapshotUpdate.java @@ -16,6 +16,8 @@ package org.thingsboard.rule.engine.profile; import lombok.Getter; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.query.EntityKey; import org.thingsboard.server.common.data.query.EntityKeyType; @@ -24,11 +26,11 @@ import java.util.Set; class SnapshotUpdate { @Getter - private final EntityKeyType type; + private final AlarmConditionKeyType type; @Getter - private final Set keys; + private final Set keys; - SnapshotUpdate(EntityKeyType type, Set keys) { + SnapshotUpdate(AlarmConditionKeyType type, Set keys) { this.type = type; this.keys = keys; } diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeTest.java index 3cdac17b42..b980423c08 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/TbDeviceProfileNodeTest.java @@ -36,6 +36,9 @@ import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.alarm.AlarmSeverity; import org.thingsboard.server.common.data.device.profile.AlarmCondition; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilter; +import org.thingsboard.server.common.data.device.profile.AlarmConditionFilterKey; +import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.AlarmRule; import org.thingsboard.server.common.data.device.profile.DeviceProfileAlarm; import org.thingsboard.server.common.data.device.profile.DeviceProfileData; @@ -44,6 +47,7 @@ import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.kv.AttributeKvEntry; +import org.thingsboard.server.common.data.query.BooleanFilterPredicate; import org.thingsboard.server.common.data.query.DynamicValue; import org.thingsboard.server.common.data.query.DynamicValueSourceType; import org.thingsboard.server.common.data.query.EntityKey; @@ -62,6 +66,7 @@ import org.thingsboard.server.dao.model.sql.AttributeKvCompositeKey; import org.thingsboard.server.dao.model.sql.AttributeKvEntity; import org.thingsboard.server.dao.timeseries.TimeseriesService; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; @@ -69,6 +74,7 @@ import java.util.TreeMap; import java.util.UUID; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @RunWith(MockitoJUnitRunner.class) @@ -141,8 +147,8 @@ public class TbDeviceProfileNodeTest { DeviceProfile deviceProfile = new DeviceProfile(); DeviceProfileData deviceProfileData = new DeviceProfileData(); - KeyFilter highTempFilter = new KeyFilter(); - highTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter highTempFilter = new AlarmConditionFilter(); + highTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); highTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate highTemperaturePredicate = new NumericFilterPredicate(); highTemperaturePredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); @@ -157,8 +163,8 @@ public class TbDeviceProfileNodeTest { dpa.setAlarmType("highTemperatureAlarm"); dpa.setCreateRules(new TreeMap<>(Collections.singletonMap(AlarmSeverity.CRITICAL, alarmRule))); - KeyFilter lowTempFilter = new KeyFilter(); - lowTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter lowTempFilter = new AlarmConditionFilter(); + lowTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); lowTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate lowTemperaturePredicate = new NumericFilterPredicate(); lowTemperaturePredicate.setOperation(NumericFilterPredicate.NumericOperation.LESS); @@ -203,6 +209,175 @@ public class TbDeviceProfileNodeTest { } + @Test + public void testConstantKeyFilterSimple() throws Exception { + init(); + + DeviceProfile deviceProfile = new DeviceProfile(); + deviceProfile.setId(deviceProfileId); + DeviceProfileData deviceProfileData = new DeviceProfileData(); + + Device device = new Device(); + device.setId(deviceId); + device.setCustomerId(customerId); + + AttributeKvCompositeKey compositeKey = new AttributeKvCompositeKey( + EntityType.TENANT, deviceId.getId(), "SERVER_SCOPE", "alarmEnabled" + ); + + AttributeKvEntity attributeKvEntity = new AttributeKvEntity(); + attributeKvEntity.setId(compositeKey); + attributeKvEntity.setBooleanValue(Boolean.TRUE); + attributeKvEntity.setLastUpdateTs(System.currentTimeMillis()); + + AttributeKvEntry entry = attributeKvEntity.toData(); + ListenableFuture> attrListListenableFuture = Futures.immediateFuture(Collections.singletonList(entry)); + + AlarmConditionFilter alarmEnabledFilter = new AlarmConditionFilter(); + alarmEnabledFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.CONSTANT, "alarmEnabled")); + alarmEnabledFilter.setValue(Boolean.TRUE); + alarmEnabledFilter.setValueType(EntityKeyValueType.BOOLEAN); + BooleanFilterPredicate alarmEnabledPredicate = new BooleanFilterPredicate(); + alarmEnabledPredicate.setOperation(BooleanFilterPredicate.BooleanOperation.EQUAL); + alarmEnabledPredicate.setValue(new FilterPredicateValue<>( + Boolean.FALSE, + null, + new DynamicValue<>(DynamicValueSourceType.CURRENT_DEVICE, "alarmEnabled") + )); + alarmEnabledFilter.setPredicate(alarmEnabledPredicate); + + AlarmConditionFilter temperatureFilter = new AlarmConditionFilter(); + temperatureFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); + temperatureFilter.setValueType(EntityKeyValueType.NUMERIC); + NumericFilterPredicate temperaturePredicate = new NumericFilterPredicate(); + temperaturePredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); + temperaturePredicate.setValue(new FilterPredicateValue<>(20.0, null, null)); + temperatureFilter.setPredicate(temperaturePredicate); + + AlarmCondition alarmCondition = new AlarmCondition(); + alarmCondition.setCondition(Arrays.asList(alarmEnabledFilter, temperatureFilter)); + AlarmRule alarmRule = new AlarmRule(); + alarmRule.setCondition(alarmCondition); + DeviceProfileAlarm dpa = new DeviceProfileAlarm(); + dpa.setId("alarmEnabledAlarmID"); + dpa.setAlarmType("alarmEnabledAlarm"); + dpa.setCreateRules(new TreeMap<>(Collections.singletonMap(AlarmSeverity.CRITICAL, alarmRule))); + + deviceProfileData.setAlarms(Collections.singletonList(dpa)); + deviceProfile.setProfileData(deviceProfileData); + + Mockito.when(cache.get(tenantId, deviceId)).thenReturn(deviceProfile); + Mockito.when(timeseriesService.findLatest(tenantId, deviceId, Collections.singleton("temperature"))) + .thenReturn(Futures.immediateFuture(Collections.emptyList())); + Mockito.when(alarmService.findLatestByOriginatorAndType(tenantId, deviceId, "alarmEnabledAlarm")) + .thenReturn(Futures.immediateFuture(null)); + Mockito.when(alarmService.createOrUpdateAlarm(Mockito.any())).thenAnswer(AdditionalAnswers.returnsFirstArg()); + Mockito.when(ctx.getAttributesService()).thenReturn(attributesService); + Mockito.when(attributesService.find(eq(tenantId), eq(deviceId), Mockito.anyString(), Mockito.anySet())) + .thenReturn(attrListListenableFuture); + + TbMsg theMsg = TbMsg.newMsg("ALARM", deviceId, new TbMsgMetaData(), ""); + Mockito.when(ctx.newMsg(Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyString())) + .thenReturn(theMsg); + + ObjectNode data = mapper.createObjectNode(); + data.put("temperature", 21); + TbMsg msg = TbMsg.newMsg(SessionMsgType.POST_TELEMETRY_REQUEST.name(), deviceId, new TbMsgMetaData(), + TbMsgDataType.JSON, mapper.writeValueAsString(data), null, null); + + node.onMsg(ctx, msg); + verify(ctx).tellSuccess(msg); + verify(ctx).tellNext(theMsg, "Alarm Created"); + verify(ctx, Mockito.never()).tellFailure(Mockito.any(), Mockito.any()); + } + + @Test + public void testConstantKeyFilterInherited() throws Exception { + init(); + + DeviceProfile deviceProfile = new DeviceProfile(); + deviceProfile.setId(deviceProfileId); + DeviceProfileData deviceProfileData = new DeviceProfileData(); + + Device device = new Device(); + device.setId(deviceId); + device.setCustomerId(customerId); + + AttributeKvCompositeKey compositeKey = new AttributeKvCompositeKey( + EntityType.TENANT, tenantId.getId(), "SERVER_SCOPE", "alarmEnabled" + ); + + AttributeKvEntity attributeKvEntity = new AttributeKvEntity(); + attributeKvEntity.setId(compositeKey); + attributeKvEntity.setBooleanValue(Boolean.TRUE); + attributeKvEntity.setLastUpdateTs(System.currentTimeMillis()); + + AttributeKvEntry entry = attributeKvEntity.toData(); + ListenableFuture> attrListListenableFuture = Futures.immediateFuture(Optional.of(entry)); + + AlarmConditionFilter alarmEnabledFilter = new AlarmConditionFilter(); + alarmEnabledFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.CONSTANT, "alarmEnabled")); + alarmEnabledFilter.setValue(Boolean.TRUE); + alarmEnabledFilter.setValueType(EntityKeyValueType.BOOLEAN); + BooleanFilterPredicate alarmEnabledPredicate = new BooleanFilterPredicate(); + alarmEnabledPredicate.setOperation(BooleanFilterPredicate.BooleanOperation.EQUAL); + alarmEnabledPredicate.setValue(new FilterPredicateValue<>( + Boolean.FALSE, + null, + new DynamicValue<>(DynamicValueSourceType.CURRENT_DEVICE, "alarmEnabled", true) + )); + alarmEnabledFilter.setPredicate(alarmEnabledPredicate); + + AlarmConditionFilter temperatureFilter = new AlarmConditionFilter(); + temperatureFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); + temperatureFilter.setValueType(EntityKeyValueType.NUMERIC); + NumericFilterPredicate temperaturePredicate = new NumericFilterPredicate(); + temperaturePredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); + temperaturePredicate.setValue(new FilterPredicateValue<>(20.0, null, null)); + temperatureFilter.setPredicate(temperaturePredicate); + + AlarmCondition alarmCondition = new AlarmCondition(); + alarmCondition.setCondition(Arrays.asList(alarmEnabledFilter, temperatureFilter)); + AlarmRule alarmRule = new AlarmRule(); + alarmRule.setCondition(alarmCondition); + DeviceProfileAlarm dpa = new DeviceProfileAlarm(); + dpa.setId("alarmEnabledAlarmID"); + dpa.setAlarmType("alarmEnabledAlarm"); + dpa.setCreateRules(new TreeMap<>(Collections.singletonMap(AlarmSeverity.CRITICAL, alarmRule))); + + deviceProfileData.setAlarms(Collections.singletonList(dpa)); + deviceProfile.setProfileData(deviceProfileData); + + Mockito.when(deviceService.findDeviceById(tenantId, deviceId)).thenReturn(device); + Mockito.when(cache.get(tenantId, deviceId)).thenReturn(deviceProfile); + Mockito.when(timeseriesService.findLatest(tenantId, deviceId, Collections.singleton("temperature"))) + .thenReturn(Futures.immediateFuture(Collections.emptyList())); + Mockito.when(alarmService.findLatestByOriginatorAndType(tenantId, deviceId, "alarmEnabledAlarm")) + .thenReturn(Futures.immediateFuture(null)); + Mockito.when(alarmService.createOrUpdateAlarm(Mockito.any())).thenAnswer(AdditionalAnswers.returnsFirstArg()); + Mockito.when(ctx.getAttributesService()).thenReturn(attributesService); + Mockito.when(attributesService.find(eq(tenantId), eq(deviceId), Mockito.anyString(), Mockito.anySet())) + .thenReturn(Futures.immediateFuture(Collections.emptyList())); + Mockito.when(attributesService.find(eq(tenantId), eq(customerId), Mockito.anyString(), Mockito.anyString())) + .thenReturn(Futures.immediateFuture(Optional.empty())); + Mockito.when(attributesService.find(eq(tenantId), eq(tenantId), Mockito.anyString(), Mockito.anyString())) + .thenReturn(attrListListenableFuture); + + TbMsg theMsg = TbMsg.newMsg("ALARM", deviceId, new TbMsgMetaData(), ""); + Mockito.when(ctx.newMsg(Mockito.anyString(), Mockito.anyString(), Mockito.any(), Mockito.any(), Mockito.anyString())) + .thenReturn(theMsg); + + ObjectNode data = mapper.createObjectNode(); + data.put("temperature", 21); + TbMsg msg = TbMsg.newMsg(SessionMsgType.POST_TELEMETRY_REQUEST.name(), deviceId, new TbMsgMetaData(), + TbMsgDataType.JSON, mapper.writeValueAsString(data), null, null); + + node.onMsg(ctx, msg); + verify(ctx).tellSuccess(msg); + verify(ctx).tellNext(theMsg, "Alarm Created"); + verify(ctx, Mockito.never()).tellFailure(Mockito.any(), Mockito.any()); + } + @Test public void testCurrentDeviceAttributeForDynamicValue() throws Exception { init(); @@ -228,8 +403,8 @@ public class TbDeviceProfileNodeTest { ListenableFuture> listListenableFutureWithLess = Futures.immediateFuture(Collections.singletonList(entry)); - KeyFilter highTempFilter = new KeyFilter(); - highTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter highTempFilter = new AlarmConditionFilter(); + highTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); highTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate highTemperaturePredicate = new NumericFilterPredicate(); highTemperaturePredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); @@ -303,8 +478,8 @@ public class TbDeviceProfileNodeTest { ListenableFuture> optionalListenableFutureWithLess = Futures.immediateFuture(Optional.of(entry)); - KeyFilter lowTempFilter = new KeyFilter(); - lowTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter lowTempFilter = new AlarmConditionFilter(); + lowTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); lowTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate lowTempPredicate = new NumericFilterPredicate(); lowTempPredicate.setOperation(NumericFilterPredicate.NumericOperation.LESS); @@ -382,8 +557,8 @@ public class TbDeviceProfileNodeTest { ListenableFuture> optionalListenableFutureWithLess = Futures.immediateFuture(Optional.of(entry)); - KeyFilter lowTempFilter = new KeyFilter(); - lowTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter lowTempFilter = new AlarmConditionFilter(); + lowTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); lowTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate lowTempPredicate = new NumericFilterPredicate(); lowTempPredicate.setOperation(NumericFilterPredicate.NumericOperation.LESS); @@ -416,7 +591,7 @@ public class TbDeviceProfileNodeTest { Mockito.when(ctx.getAttributesService()).thenReturn(attributesService); Mockito.when(attributesService.find(eq(tenantId), eq(deviceId), Mockito.anyString(), Mockito.anySet())) .thenReturn(listListenableFutureWithLess); - Mockito.when(attributesService.find(eq(tenantId), eq(tenantId), eq(DataConstants.SERVER_SCOPE), Mockito.anyString())) + Mockito.when(attributesService.find(eq(tenantId), eq(tenantId), eq(DataConstants.SERVER_SCOPE), Mockito.anyString())) .thenReturn(optionalListenableFutureWithLess); TbMsg theMsg = TbMsg.newMsg("ALARM", deviceId, new TbMsgMetaData(), ""); @@ -454,8 +629,8 @@ public class TbDeviceProfileNodeTest { ListenableFuture> listListenableFutureWithLess = Futures.immediateFuture(Collections.singletonList(entry)); - KeyFilter lowTempFilter = new KeyFilter(); - lowTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter lowTempFilter = new AlarmConditionFilter(); + lowTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); lowTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate lowTempPredicate = new NumericFilterPredicate(); lowTempPredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); @@ -502,9 +677,9 @@ public class TbDeviceProfileNodeTest { verify(ctx).tellSuccess(msg); verify(ctx).tellNext(theMsg, "Alarm Created"); verify(ctx, Mockito.never()).tellFailure(Mockito.any(), Mockito.any()); - } + @Test public void testCustomerInheritModeForDynamicValues() throws Exception { init(); @@ -527,8 +702,8 @@ public class TbDeviceProfileNodeTest { ListenableFuture> optionalListenableFutureWithLess = Futures.immediateFuture(Optional.of(entry)); - KeyFilter lowTempFilter = new KeyFilter(); - lowTempFilter.setKey(new EntityKey(EntityKeyType.TIME_SERIES, "temperature")); + AlarmConditionFilter lowTempFilter = new AlarmConditionFilter(); + lowTempFilter.setKey(new AlarmConditionFilterKey(AlarmConditionKeyType.TIME_SERIES, "temperature")); lowTempFilter.setValueType(EntityKeyValueType.NUMERIC); NumericFilterPredicate lowTempPredicate = new NumericFilterPredicate(); lowTempPredicate.setOperation(NumericFilterPredicate.NumericOperation.GREATER); @@ -561,7 +736,7 @@ public class TbDeviceProfileNodeTest { Mockito.when(ctx.getAttributesService()).thenReturn(attributesService); Mockito.when(attributesService.find(eq(tenantId), eq(deviceId), Mockito.anyString(), Mockito.anySet())) .thenReturn(listListenableFutureWithLess); - Mockito.when(attributesService.find(eq(tenantId), eq(tenantId), eq(DataConstants.SERVER_SCOPE), Mockito.anyString())) + Mockito.when(attributesService.find(eq(tenantId), eq(tenantId), eq(DataConstants.SERVER_SCOPE), Mockito.anyString())) .thenReturn(optionalListenableFutureWithLess); TbMsg theMsg = TbMsg.newMsg("ALARM", deviceId, new TbMsgMetaData(), ""); From ce9dcd17c6d94b279358656710295c7002c64afe Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 26 Feb 2021 16:02:57 +0200 Subject: [PATCH 22/69] UI: Add Constant keys in the Device Profile Alarm Rules --- ui-ngx/src/app/core/http/entity.service.ts | 1 + .../boolean-filter-predicate.component.html | 1 + .../boolean-filter-predicate.component.ts | 2 ++ ...lex-filter-predicate-dialog.component.html | 1 + ...mplex-filter-predicate-dialog.component.ts | 1 + .../complex-filter-predicate.component.ts | 5 ++- .../filter-predicate-list.component.html | 1 + .../filter/filter-predicate-list.component.ts | 5 ++- .../filter-predicate-value.component.html | 6 ++-- .../filter-predicate-value.component.ts | 2 ++ .../filter/filter-predicate.component.html | 4 +++ .../filter/filter-predicate.component.ts | 2 ++ .../filter/key-filter-dialog.component.html | 32 ++++++++++++++++-- .../filter/key-filter-dialog.component.ts | 33 ++++++++++++------- .../filter/key-filter-list.component.ts | 1 + .../numeric-filter-predicate.component.html | 1 + .../numeric-filter-predicate.component.ts | 2 ++ .../string-filter-predicate.component.html | 1 + .../string-filter-predicate.component.ts | 2 ++ .../app/shared/models/query/query.models.ts | 11 +++++-- .../assets/locale/locale.constant-en_US.json | 3 +- 21 files changed, 96 insertions(+), 21 deletions(-) diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 463183d06e..1118307d06 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -414,6 +414,7 @@ export class EntityService { { key: nameField, valueType: EntityKeyValueType.STRING, + value: null, predicate: { type: FilterPredicateType.STRING, operation: StringOperation.STARTS_WITH, diff --git a/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.html b/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.html index 253f7e2138..f7bae7d797 100644 --- a/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.html @@ -25,6 +25,7 @@ diff --git a/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts b/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts index fbd329dc16..c6c8a5ed51 100644 --- a/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/boolean-filter-predicate.component.ts @@ -41,6 +41,8 @@ export class BooleanFilterPredicateComponent implements ControlValueAccessor, On @Input() allowUserDynamicSource = true; + @Input() onlyUserDynamicSource = false; + valueTypeEnum = EntityKeyValueType; booleanFilterPredicateFormGroup: FormGroup; diff --git a/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.html index bbf4887e5f..e2bee07a3f 100644 --- a/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.html @@ -39,6 +39,7 @@ [valueType]="data.valueType" [displayUserParameters]="data.displayUserParameters" [allowUserDynamicSource]="data.allowUserDynamicSource" + [onlyUserDynamicSource]="data.onlyUserDynamicSource" [operation]="complexFilterFormGroup.get('operation').value" [key]="data.key" formControlName="predicates"> diff --git a/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.ts b/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.ts index 447546ba2f..3f1bb3cace 100644 --- a/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate-dialog.component.ts @@ -37,6 +37,7 @@ export interface ComplexFilterPredicateDialogData { valueType: EntityKeyValueType; displayUserParameters: boolean; allowUserDynamicSource: boolean; + onlyUserDynamicSource: boolean; } @Component({ diff --git a/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate.component.ts b/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate.component.ts index 0843583a52..9f4acfc3c6 100644 --- a/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/complex-filter-predicate.component.ts @@ -52,6 +52,8 @@ export class ComplexFilterPredicateComponent implements ControlValueAccessor, On @Input() allowUserDynamicSource = true; + @Input() onlyUserDynamicSource = false; + private propagateChange = null; private complexFilterPredicate: ComplexFilterPredicateInfo; @@ -89,7 +91,8 @@ export class ComplexFilterPredicateComponent implements ControlValueAccessor, On isAdd: false, key: this.key, displayUserParameters: this.displayUserParameters, - allowUserDynamicSource: this.allowUserDynamicSource + allowUserDynamicSource: this.allowUserDynamicSource, + onlyUserDynamicSource: this.onlyUserDynamicSource } }).afterClosed().subscribe( (result) => { diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.html b/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.html index c6aee52976..e5bb27f20c 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.html @@ -53,6 +53,7 @@ [valueType]="valueType" [displayUserParameters]="displayUserParameters" [allowUserDynamicSource]="allowUserDynamicSource" + [onlyUserDynamicSource]="onlyUserDynamicSource" [key]="key" [formControl]="predicateControl"> diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.ts b/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.ts index e89489e6bb..3c16b01319 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/filter-predicate-list.component.ts @@ -66,6 +66,8 @@ export class FilterPredicateListComponent implements ControlValueAccessor, OnIni @Input() allowUserDynamicSource = true; + @Input() onlyUserDynamicSource = false; + filterListFormGroup: FormGroup; valueTypeEnum = EntityKeyValueType; @@ -159,7 +161,8 @@ export class FilterPredicateListComponent implements ControlValueAccessor, OnIni key: this.key, isAdd: true, displayUserParameters: this.displayUserParameters, - allowUserDynamicSource: this.allowUserDynamicSource + allowUserDynamicSource: this.allowUserDynamicSource, + onlyUserDynamicSource: this.onlyUserDynamicSource } }).afterClosed().pipe( map((result) => { diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-predicate-value.component.html b/ui-ngx/src/app/modules/home/components/filter/filter-predicate-value.component.html index dd1b92cf7f..4bc249837a 100644 --- a/ui-ngx/src/app/modules/home/components/filter/filter-predicate-value.component.html +++ b/ui-ngx/src/app/modules/home/components/filter/filter-predicate-value.component.html @@ -16,7 +16,7 @@ -->
-
+
@@ -45,7 +45,7 @@
filter.default-value
-
+
@@ -78,7 +78,7 @@
-
diff --git a/ui-ngx/src/app/modules/home/components/filter/string-filter-predicate.component.ts b/ui-ngx/src/app/modules/home/components/filter/string-filter-predicate.component.ts index b52f36a572..11b4dad275 100644 --- a/ui-ngx/src/app/modules/home/components/filter/string-filter-predicate.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/string-filter-predicate.component.ts @@ -42,6 +42,8 @@ export class StringFilterPredicateComponent implements ControlValueAccessor, OnI @Input() allowUserDynamicSource = true; + @Input() onlyUserDynamicSource = false; + valueTypeEnum = EntityKeyValueType; stringFilterPredicateFormGroup: FormGroup; diff --git a/ui-ngx/src/app/shared/models/query/query.models.ts b/ui-ngx/src/app/shared/models/query/query.models.ts index dcc89852b7..b8dc2564bc 100644 --- a/ui-ngx/src/app/shared/models/query/query.models.ts +++ b/ui-ngx/src/app/shared/models/query/query.models.ts @@ -35,14 +35,16 @@ export enum EntityKeyType { SERVER_ATTRIBUTE = 'SERVER_ATTRIBUTE', TIME_SERIES = 'TIME_SERIES', ENTITY_FIELD = 'ENTITY_FIELD', - ALARM_FIELD = 'ALARM_FIELD' + ALARM_FIELD = 'ALARM_FIELD', + CONSTANT = 'CONSTANT' } export const entityKeyTypeTranslationMap = new Map( [ [EntityKeyType.ATTRIBUTE, 'filter.key-type.attribute'], [EntityKeyType.TIME_SERIES, 'filter.key-type.timeseries'], - [EntityKeyType.ENTITY_FIELD, 'filter.key-type.entity-field'] + [EntityKeyType.ENTITY_FIELD, 'filter.key-type.entity-field'], + [EntityKeyType.CONSTANT, 'filter.key-type.constant'] ] ); @@ -344,12 +346,14 @@ export interface KeyFilterPredicateInfo { export interface KeyFilter { key: EntityKey; valueType: EntityKeyValueType; + value: string | number | boolean; predicate: KeyFilterPredicate; } export interface KeyFilterInfo { key: EntityKey; valueType: EntityKeyValueType; + value: string | number | boolean; predicates: Array; } @@ -466,6 +470,7 @@ export function keyFilterInfosToKeyFilters(keyFilterInfos: Array) const keyFilter: KeyFilter = { key, valueType: keyFilterInfo.valueType, + value: keyFilterInfo.value, predicate: keyFilterPredicateInfoToKeyFilterPredicate(predicate) }; keyFilters.push(keyFilter); @@ -486,6 +491,7 @@ export function keyFiltersToKeyFilterInfos(keyFilters: Array): Array< keyFilterInfo = { key, valueType: keyFilter.valueType, + value: keyFilter.value, predicates: [] }; keyFilterInfoMap[infoKey] = keyFilterInfo; @@ -508,6 +514,7 @@ export function filterInfoToKeyFilters(filter: FilterInfo): Array { const keyFilter: KeyFilter = { key, valueType: keyFilterInfo.valueType, + value: keyFilterInfo.value, predicate: keyFilterPredicateInfoToKeyFilterPredicate(predicate) }; keyFilters.push(keyFilter); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index dff58d17d0..216ae2c1b7 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1564,7 +1564,8 @@ "key-type": "Key type", "attribute": "Attribute", "timeseries": "Timeseries", - "entity-field": "Entity field" + "entity-field": "Entity field", + "constant": "Constant" }, "value-type": { "value-type": "Value type", From 8ea3dcb80827c9035dd88e80df1613f4160bdb7d Mon Sep 17 00:00:00 2001 From: AndrewVolosytnykhThingsboard Date: Mon, 1 Mar 2021 12:19:57 +0200 Subject: [PATCH 23/69] improvement of solution --- .../thingsboard/server/controller/AuthController.java | 1 + .../src/app/modules/home/pages/user/user.component.html | 4 ++-- ui-ngx/src/app/modules/home/pages/user/user.component.ts | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/AuthController.java b/application/src/main/java/org/thingsboard/server/controller/AuthController.java index 1bda7dfab7..3f77da93f7 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AuthController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AuthController.java @@ -215,6 +215,7 @@ public class AuthController extends BaseController { User user = userService.findUserById(TenantId.SYS_TENANT_ID, credentials.getUserId()); UserPrincipal principal = new UserPrincipal(UserPrincipal.Type.USER_NAME, user.getEmail()); SecurityUser securityUser = new SecurityUser(user, credentials.isEnabled(), principal); + userService.setUserCredentialsEnabled(user.getTenantId(), user.getId(), true); String baseUrl = systemSecurityService.getBaseUrl(user.getTenantId(), user.getCustomerId(), request); String loginUrl = String.format("%s/login", baseUrl); String email = user.getEmail(); diff --git a/ui-ngx/src/app/modules/home/pages/user/user.component.html b/ui-ngx/src/app/modules/home/pages/user/user.component.html index 20821031b0..63154139e3 100644 --- a/ui-ngx/src/app/modules/home/pages/user/user.component.html +++ b/ui-ngx/src/app/modules/home/pages/user/user.component.html @@ -19,13 +19,13 @@ - close + close
- + @@ -128,7 +128,7 @@ {{ translate.get('entity.no-key-matching', {key: truncate.transform(searchText, true, 6, '...')}) | async }} - + entity.create-new-key diff --git a/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts b/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts index c3f138cb80..96bd8c702f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/data-keys.component.ts @@ -16,26 +16,26 @@ import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; import { - AfterViewInit, - Component, - ElementRef, - forwardRef, - Input, - OnChanges, - OnInit, - SimpleChanges, - SkipSelf, - ViewChild + AfterViewInit, + Component, + ElementRef, + forwardRef, + Input, + OnChanges, + OnInit, + SimpleChanges, + SkipSelf, + ViewChild } from '@angular/core'; import { - ControlValueAccessor, - FormBuilder, - FormControl, - FormGroup, - FormGroupDirective, - NG_VALUE_ACCESSOR, - NgForm, - Validators + ControlValueAccessor, + FormBuilder, + FormControl, + FormGroup, + FormGroupDirective, + NG_VALUE_ACCESSOR, + NgForm, + Validators } from '@angular/forms'; import { Observable, of } from 'rxjs'; import { filter, map, mergeMap, publishReplay, refCount, share, tap } from 'rxjs/operators'; @@ -56,8 +56,8 @@ import { TruncatePipe } from '@shared/pipe/truncate.pipe'; import { DialogService } from '@core/services/dialog.service'; import { MatDialog } from '@angular/material/dialog'; import { - DataKeyConfigDialogComponent, - DataKeyConfigDialogData + DataKeyConfigDialogComponent, + DataKeyConfigDialogData } from '@home/components/widget/data-key-config-dialog.component'; import { deepClone } from '@core/utils'; import { MatChipDropEvent } from '@app/shared/components/mat-chip-draggable.directive'; @@ -94,8 +94,15 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie @Input() datasourceType: DatasourceType; + private maxDataKeysValue: number; + get maxDataKeys(): number { + return this.datasourceType === DatasourceType.entityCount ? 1 : this.maxDataKeysValue; + } + @Input() - maxDataKeys: number; + set maxDataKeys(value: number) { + this.maxDataKeysValue = value; + } @Input() optDataKeys: boolean; @@ -114,7 +121,7 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie private requiredValue: boolean; get required(): boolean { - return this.requiredValue || !this.optDataKeys; + return this.requiredValue || !this.optDataKeys || this.datasourceType === DatasourceType.entityCount; } @Input() set required(value: boolean) { @@ -210,8 +217,10 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie if (this.maxDataKeys !== null && this.maxDataKeys > -1) { if (this.datasourceType === DatasourceType.function) { return this.translate.instant('datakey.maximum-function-types', {count: this.maxDataKeys}); - } else { + } else if (this.datasourceType !== DatasourceType.entityCount) { return this.translate.instant('datakey.maximum-timeseries-or-attributes', {count: this.maxDataKeys}); + } else { + return ''; } } else { return ''; @@ -241,6 +250,8 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie private reset() { if (this.widgetType === widgetType.alarm) { this.keys = this.utils.getDefaultAlarmDataKeys(); + } else if (this.datasourceType === DatasourceType.entityCount) { + this.keys = [this.callbacks.generateDataKey('count', DataKeyType.count)]; } else { this.keys = []; } @@ -426,7 +437,7 @@ export class DataKeysComponent implements ControlValueAccessor, OnInit, AfterVie const targetKeysList = this.widgetType === widgetType.alarm ? this.alarmKeys : this.functionTypeKeys; fetchObservable = of(targetKeysList); } else { - if (this.entityAliasId) { + if (this.datasourceType !== DatasourceType.entityCount && this.entityAliasId) { const dataKeyTypes = [DataKeyType.timeseries]; if (this.widgetType === widgetType.latest || this.widgetType === widgetType.alarm) { dataKeyTypes.push(DataKeyType.attribute); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.component.ts index e79f6ef0e4..5fb11d025b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.component.ts @@ -84,7 +84,6 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O private widgetConfig: WidgetConfig; private subscription: IWidgetSubscription; private datasources: Array; - private data: Array>; private nodesMap: {[nodeId: string]: HierarchyNavTreeNode} = {}; private pendingUpdateNodeTasks: {[nodeId: string]: () => void} = {}; @@ -121,7 +120,6 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O this.widgetConfig = this.ctx.widgetConfig; this.subscription = this.ctx.defaultSubscription; this.datasources = this.subscription.datasources as Array; - this.data = this.subscription.dataPages[0].data; this.initializeConfig(); this.ctx.updateWidgetParams(); } @@ -252,12 +250,16 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O public loadNodes: LoadNodesCallback = (node, cb) => { if (node.id === '#') { const childNodes: HierarchyNavTreeNode[] = []; + let dataIndex = 0; this.datasources.forEach((childDatasource, index) => { - childNodes.push(this.datasourceToNode(childDatasource as HierarchyNodeDatasource, this.data[index])); + const datasourceData = this.subscription.data.slice(dataIndex); + childNodes.push(this.datasourceToNode(childDatasource as HierarchyNodeDatasource, datasourceData)); + dataIndex += childDatasource.dataKeys.length; }); cb(this.prepareNodes(childNodes)); } else { - if (node.data && node.data.nodeCtx.entity && node.data.nodeCtx.entity.id && node.data.nodeCtx.entity.id.entityType !== 'function') { + if (node.data && node.data.nodeCtx.entity && node.data.nodeCtx.entity.id && node.data.datasource.type === DatasourceType.entity + && node.data.nodeCtx.entity.id.entityType !== 'function') { this.loadChildren(node, node.data.datasource, cb); /* (error) => { // TODO: let errorText = 'Failed to get relations!'; @@ -369,8 +371,8 @@ export class EntitiesHierarchyWidgetComponent extends PageComponent implements O } private datasourceToNode(datasource: HierarchyNodeDatasource, - data: DatasourceData[], - parentNodeCtx?: HierarchyNodeContext): HierarchyNavTreeNode { + data: DatasourceData[], + parentNodeCtx?: HierarchyNodeContext): HierarchyNavTreeNode { const node: HierarchyNavTreeNode = { id: (++this.nodeIdCounter) + '' }; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts index 07ab91fe5d..74166b1742 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts @@ -153,7 +153,16 @@ export const defaultNodeOpenedFunction: NodeOpenedFunction = nodeCtx => { }; export const defaultNodesSortFunction: NodesSortFunction = (nodeCtx1, nodeCtx2) => { - let result = nodeCtx1.entity.id.entityType.localeCompare(nodeCtx2.entity.id.entityType); + let result = 0; + if (!nodeCtx1.entity.id.entityType || !nodeCtx2.entity.id.entityType ) { + if (nodeCtx1.entity.id.entityType) { + result = 1; + } else if (nodeCtx2.entity.id.entityType) { + result = -1; + } + } else { + result = nodeCtx1.entity.id.entityType.localeCompare(nodeCtx2.entity.id.entityType); + } if (result === 0) { result = nodeCtx1.entity.name.localeCompare(nodeCtx2.entity.name); } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html index e47d96bebe..8b745c480f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html +++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.html @@ -100,87 +100,115 @@
- +
- widget-config.datasource-type + widget-config.datasource-type widget-config.datasource-parameters
-
- {{$index + 1}}. -
-
- - - - {{ datasourceTypesTranslations.get(datasourceType) | translate }} - - - -
- - - - + + + + +
+
+ + {{$index + 1}}. +
+
+
+ + + + {{ datasourceTypesTranslations.get(datasourceType) | translate }} + + - - -
- - - - +
+ + + + + + + + + + + + + + + +
- -
- - -
- -
-
+ + +
+ +
+
+ +
diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.scss b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.scss index 39182661f1..6e1e1cabdf 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.scss +++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.scss @@ -23,10 +23,34 @@ .tb-advanced-widget-config { height: 100%; } + .tb-datasources { + + .handle { + cursor: move; + } + + .mat-list { + min-height: 68px; + padding-left: 0; + } + + .mat-list-item { + height: auto; + min-height: 68px; + display: block; + &.dndDraggingSource { + display: none; + } + &.dndPlaceholder { + display: block; + background-color: #ddd; + } + } + } .tb-datasource-type { - min-width: 110px; + min-width: 120px; @media #{$mat-gt-sm} { - max-width: 110px; + max-width: 120px; } } .tb-datasource { @@ -70,13 +94,18 @@ white-space: normal; } .mat-expansion-panel { - &.tb-datasources{ + &.tb-datasources { &.mat-expanded { overflow: visible; } .mat-expansion-panel-body{ padding: 0 12px 16px; } + .mat-list-base .mat-list-item { + .mat-list-item-content { + padding: 0; + } + } } .mat-expansion-panel-content { font: inherit; @@ -110,6 +139,11 @@ } } } + .tb-datasource-name.no-border-top { + .mat-form-field-infix { + border-top: 0; + } + } } .tb-data-keys { @media #{$mat-gt-sm} { diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts index 05c6264a92..523913afe4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-config.component.ts @@ -40,7 +40,7 @@ import { Validators } from '@angular/forms'; import { WidgetConfigComponentData } from '@home/models/widget-component.models'; -import { deepClone, isDefined, isObject } from '@app/core/utils'; +import { deepClone, isDefined, isObject, isUndefined } from '@app/core/utils'; import { alarmFields, AlarmSearchStatus, @@ -71,6 +71,7 @@ import { Filter, Filters } from '@shared/models/query/query.models'; import { FilterDialogComponent, FilterDialogData } from '@home/components/filter/filter-dialog.component'; import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; import { MatChipInputEvent } from '@angular/material/chips'; +import { DndDropEvent } from 'ngx-drag-drop'; const emptySettingsSchema: JsonSchema = { type: 'object', @@ -141,7 +142,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont widgetType: widgetType; datasourceType = DatasourceType; - datasourceTypes: Array; + datasourceTypes: Array = []; datasourceTypesTranslations = datasourceTypeTranslationMap; widgetConfigCallbacks: WidgetConfigCallbacks = { @@ -186,11 +187,6 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont } ngOnInit(): void { - if (this.functionsOnly) { - this.datasourceTypes = [DatasourceType.function]; - } else { - this.datasourceTypes = [DatasourceType.function, DatasourceType.entity]; - } this.dataSettings = this.fb.group({}); this.targetDeviceSettings = this.fb.group({}); this.alarmSourceSettings = this.fb.group({}); @@ -295,6 +291,14 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont } private buildForms() { + if (this.functionsOnly) { + this.datasourceTypes = [DatasourceType.function]; + } else { + this.datasourceTypes = [DatasourceType.function, DatasourceType.entity]; + if (this.widgetType === widgetType.latest) { + this.datasourceTypes.push(DatasourceType.entityCount); + } + } this.dataSettings = this.fb.group({}); this.targetDeviceSettings = this.fb.group({}); this.alarmSourceSettings = this.fb.group({}); @@ -517,22 +521,28 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont } private buildDatasourceForm(datasource?: Datasource): FormGroup { - const dataKeysRequired = !this.modelValue.typeParameters || !this.modelValue.typeParameters.dataKeysOptional; + let dataKeysRequired = !this.modelValue.typeParameters || !this.modelValue.typeParameters.dataKeysOptional + || datasource?.type === DatasourceType.entityCount; const datasourceFormGroup = this.fb.group( { type: [datasource ? datasource.type : null, [Validators.required]], name: [datasource ? datasource.name : null, []], entityAliasId: [datasource ? datasource.entityAliasId : null, - datasource && datasource.type === DatasourceType.entity ? [Validators.required] : []], + datasource && (datasource.type === DatasourceType.entity || + datasource.type === DatasourceType.entityCount) ? [Validators.required] : []], filterId: [datasource ? datasource.filterId : null, []], dataKeys: [datasource ? datasource.dataKeys : null, dataKeysRequired ? [Validators.required] : []] } ); datasourceFormGroup.get('type').valueChanges.subscribe((type: DatasourceType) => { datasourceFormGroup.get('entityAliasId').setValidators( - type === DatasourceType.entity ? [Validators.required] : [] + (type === DatasourceType.entity || type === DatasourceType.entityCount) ? [Validators.required] : [] ); + dataKeysRequired = !this.modelValue.typeParameters || !this.modelValue.typeParameters.dataKeysOptional + || type === DatasourceType.entityCount; + datasourceFormGroup.get('dataKeys').setValidators(dataKeysRequired ? [Validators.required] : []); datasourceFormGroup.get('entityAliasId').updateValueAndValidity(); + datasourceFormGroup.get('dataKeys').updateValueAndValidity(); }); return datasourceFormGroup; } @@ -659,8 +669,22 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont return !!this.modelValue && !!this.modelValue.settingsSchema && !!this.modelValue.settingsSchema.schema; } + public dndDatasourceMoved(index: number) { + this.datasourcesFormArray().removeAt(index); + } + + public onDatasourceDrop(event: DndDropEvent) { + let index = event.index; + if (isUndefined(index)) { + index = this.datasourcesFormArray().length; + } + this.datasourcesFormArray().insert(index, + this.buildDatasourceForm(event.data) + ); + } + public removeDatasource(index: number) { - (this.dataSettings.get('datasources') as FormArray).removeAt(index); + this.datasourcesFormArray().removeAt(index); } public addDatasource() { @@ -673,8 +697,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont dataKeys: [] }; } - const datasourcesFormArray = this.dataSettings.get('datasources') as FormArray; - datasourcesFormArray.push(this.buildDatasourceForm(newDatasource)); + this.datasourcesFormArray().push(this.buildDatasourceForm(newDatasource)); } public generateDataKey(chip: any, type: DataKeyType): DataKey { @@ -704,6 +727,8 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont if (!result.funcBody) { result.funcBody = 'return prevValue + 1;'; } + } else if (type === DataKeyType.count) { + result.name = 'count'; } if (isDefined(this.modelValue.dataKeySettingsSchema.schema)) { result.settings = this.utils.generateObjectFromJsonSchema(this.modelValue.dataKeySettingsSchema.schema); diff --git a/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts b/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts index 8e99a14016..0be34d5f39 100644 --- a/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts +++ b/ui-ngx/src/app/modules/home/pages/widget/widget-library.component.ts @@ -84,6 +84,7 @@ export class WidgetLibraryComponent extends PageComponent implements OnInit { aliasController: IAliasController = new AliasController(this.utils, this.entityService, + this.translate, () => { return { getStateParams(): StateParams { return {}; diff --git a/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts b/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts index 246f38b87a..f9ada15d64 100644 --- a/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts +++ b/ui-ngx/src/app/shared/components/mat-chip-draggable.directive.ts @@ -124,6 +124,7 @@ class DraggableChip { if (this.preventDrag) { event.preventDefault(); } else { + event.stopPropagation(); this.dragging = true; globalDraggingChipListId = this.chipListElement.id; this.chipListElement.classList.add(draggingClassName); @@ -159,6 +160,7 @@ class DraggableChip { } private onDragEnd(event: Event | any) { + event.stopPropagation(); this.dragging = false; globalDraggingChipListId = null; this.chipListElement.classList.remove(draggingClassName); diff --git a/ui-ngx/src/app/shared/models/query/query.models.ts b/ui-ngx/src/app/shared/models/query/query.models.ts index b8dc2564bc..dc21f70907 100644 --- a/ui-ngx/src/app/shared/models/query/query.models.ts +++ b/ui-ngx/src/app/shared/models/query/query.models.ts @@ -36,7 +36,8 @@ export enum EntityKeyType { TIME_SERIES = 'TIME_SERIES', ENTITY_FIELD = 'ENTITY_FIELD', ALARM_FIELD = 'ALARM_FIELD', - CONSTANT = 'CONSTANT' + CONSTANT = 'CONSTANT', + COUNT = 'COUNT' } export const entityKeyTypeTranslationMap = new Map( @@ -61,6 +62,8 @@ export function entityKeyTypeToDataKeyType(entityKeyType: EntityKeyType): DataKe return DataKeyType.entityField; case EntityKeyType.ALARM_FIELD: return DataKeyType.alarm; + case EntityKeyType.COUNT: + return DataKeyType.count; } } @@ -76,6 +79,8 @@ export function dataKeyTypeToEntityKeyType(dataKeyType: DataKeyType): EntityKeyT return EntityKeyType.ALARM_FIELD; case DataKeyType.entityField: return EntityKeyType.ENTITY_FIELD; + case DataKeyType.count: + return EntityKeyType.COUNT; } } @@ -716,13 +721,13 @@ export const defaultEntityDataPageLink: EntityDataPageLink = createDefaultEntity export interface EntityCountQuery { entityFilter: EntityFilter; + keyFilters?: Array; } export interface AbstractDataQuery extends EntityCountQuery { pageLink: T; entityFields?: Array; latestValues?: Array; - keyFilters?: Array; } export interface EntityDataQuery extends AbstractDataQuery { diff --git a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts index 1e77285667..cfbde53233 100644 --- a/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts +++ b/ui-ngx/src/app/shared/models/telemetry/telemetry.models.ts @@ -23,7 +23,7 @@ import { map } from 'rxjs/operators'; import { NgZone } from '@angular/core'; import { AlarmData, - AlarmDataQuery, + AlarmDataQuery, EntityCountQuery, EntityData, EntityDataQuery, EntityKey, @@ -36,7 +36,8 @@ export enum DataKeyType { attribute = 'attribute', function = 'function', alarm = 'alarm', - entityField = 'entityField' + entityField = 'entityField', + count = 'count' } export enum LatestTelemetry { @@ -181,6 +182,11 @@ export class EntityDataCmd implements WebsocketCmd { } } +export class EntityCountCmd implements WebsocketCmd { + cmdId: number; + query?: EntityCountQuery; +} + export class AlarmDataCmd implements WebsocketCmd { cmdId: number; query?: AlarmDataQuery; @@ -194,6 +200,10 @@ export class EntityDataUnsubscribeCmd implements WebsocketCmd { cmdId: number; } +export class EntityCountUnsubscribeCmd implements WebsocketCmd { + cmdId: number; +} + export class AlarmDataUnsubscribeCmd implements WebsocketCmd { cmdId: number; } @@ -206,6 +216,8 @@ export class TelemetryPluginCmdsWrapper { entityDataUnsubscribeCmds: Array; alarmDataCmds: Array; alarmDataUnsubscribeCmds: Array; + entityCountCmds: Array; + entityCountUnsubscribeCmds: Array; constructor() { this.attrSubCmds = []; @@ -215,6 +227,8 @@ export class TelemetryPluginCmdsWrapper { this.entityDataUnsubscribeCmds = []; this.alarmDataCmds = []; this.alarmDataUnsubscribeCmds = []; + this.entityCountCmds = []; + this.entityCountUnsubscribeCmds = []; } public hasCommands(): boolean { @@ -224,7 +238,9 @@ export class TelemetryPluginCmdsWrapper { this.entityDataCmds.length > 0 || this.entityDataUnsubscribeCmds.length > 0 || this.alarmDataCmds.length > 0 || - this.alarmDataUnsubscribeCmds.length > 0; + this.alarmDataUnsubscribeCmds.length > 0 || + this.entityCountCmds.length > 0 || + this.entityCountUnsubscribeCmds.length > 0; } public clear() { @@ -235,6 +251,8 @@ export class TelemetryPluginCmdsWrapper { this.entityDataUnsubscribeCmds.length = 0; this.alarmDataCmds.length = 0; this.alarmDataUnsubscribeCmds.length = 0; + this.entityCountCmds.length = 0; + this.entityCountUnsubscribeCmds.length = 0; } public preparePublishCommands(maxCommands: number): TelemetryPluginCmdsWrapper { @@ -253,6 +271,10 @@ export class TelemetryPluginCmdsWrapper { preparedWrapper.alarmDataCmds = this.popCmds(this.alarmDataCmds, leftCount); leftCount -= preparedWrapper.alarmDataCmds.length; preparedWrapper.alarmDataUnsubscribeCmds = this.popCmds(this.alarmDataUnsubscribeCmds, leftCount); + leftCount -= preparedWrapper.alarmDataUnsubscribeCmds.length; + preparedWrapper.entityCountCmds = this.popCmds(this.entityCountCmds, leftCount); + leftCount -= preparedWrapper.entityCountCmds.length; + preparedWrapper.entityCountUnsubscribeCmds = this.popCmds(this.entityCountUnsubscribeCmds, leftCount); return preparedWrapper; } @@ -280,40 +302,54 @@ export interface SubscriptionUpdateMsg extends SubscriptionDataHolder { errorMsg: string; } -export enum DataUpdateType { +export enum CmdUpdateType { ENTITY_DATA = 'ENTITY_DATA', - ALARM_DATA = 'ALARM_DATA' + ALARM_DATA = 'ALARM_DATA', + COUNT_DATA = 'COUNT_DATA' } -export interface DataUpdateMsg { +export interface CmdUpdateMsg { cmdId: number; - data?: PageData; - update?: Array; errorCode: number; errorMsg: string; - dataUpdateType: DataUpdateType; + cmdUpdateType: CmdUpdateType; +} + +export interface DataUpdateMsg extends CmdUpdateMsg { + data?: PageData; + update?: Array; } export interface EntityDataUpdateMsg extends DataUpdateMsg { - dataUpdateType: DataUpdateType.ENTITY_DATA; + cmdUpdateType: CmdUpdateType.ENTITY_DATA; } export interface AlarmDataUpdateMsg extends DataUpdateMsg { - dataUpdateType: DataUpdateType.ALARM_DATA; + cmdUpdateType: CmdUpdateType.ALARM_DATA; allowedEntities: number; totalEntities: number; } -export type WebsocketDataMsg = AlarmDataUpdateMsg | EntityDataUpdateMsg | SubscriptionUpdateMsg; +export interface EntityCountUpdateMsg extends CmdUpdateMsg { + cmdUpdateType: CmdUpdateType.COUNT_DATA; + count: number; +} + +export type WebsocketDataMsg = AlarmDataUpdateMsg | EntityDataUpdateMsg | EntityCountUpdateMsg | SubscriptionUpdateMsg; export function isEntityDataUpdateMsg(message: WebsocketDataMsg): message is EntityDataUpdateMsg { - const updateMsg = (message as DataUpdateMsg); - return updateMsg.cmdId !== undefined && updateMsg.dataUpdateType === DataUpdateType.ENTITY_DATA; + const updateMsg = (message as CmdUpdateMsg); + return updateMsg.cmdId !== undefined && updateMsg.cmdUpdateType === CmdUpdateType.ENTITY_DATA; } export function isAlarmDataUpdateMsg(message: WebsocketDataMsg): message is AlarmDataUpdateMsg { - const updateMsg = (message as DataUpdateMsg); - return updateMsg.cmdId !== undefined && updateMsg.dataUpdateType === DataUpdateType.ALARM_DATA; + const updateMsg = (message as CmdUpdateMsg); + return updateMsg.cmdId !== undefined && updateMsg.cmdUpdateType === CmdUpdateType.ALARM_DATA; +} + +export function isEntityCountUpdateMsg(message: WebsocketDataMsg): message is EntityCountUpdateMsg { + const updateMsg = (message as CmdUpdateMsg); + return updateMsg.cmdId !== undefined && updateMsg.cmdUpdateType === CmdUpdateType.COUNT_DATA; } export class SubscriptionUpdate implements SubscriptionUpdateMsg { @@ -365,21 +401,28 @@ export class SubscriptionUpdate implements SubscriptionUpdateMsg { } } -export class DataUpdate implements DataUpdateMsg { +export class CmdUpdate implements CmdUpdateMsg { cmdId: number; errorCode: number; errorMsg: string; - data?: PageData; - update?: Array; - dataUpdateType: DataUpdateType; + cmdUpdateType: CmdUpdateType; - constructor(msg: DataUpdateMsg) { + constructor(msg: CmdUpdateMsg) { this.cmdId = msg.cmdId; this.errorCode = msg.errorCode; this.errorMsg = msg.errorMsg; + this.cmdUpdateType = msg.cmdUpdateType; + } +} + +export class DataUpdate extends CmdUpdate implements DataUpdateMsg { + data?: PageData; + update?: Array; + + constructor(msg: DataUpdateMsg) { + super(msg); this.data = msg.data; this.update = msg.update; - this.dataUpdateType = msg.dataUpdateType; } } @@ -400,6 +443,15 @@ export class AlarmDataUpdate extends DataUpdate { } } +export class EntityCountUpdate extends CmdUpdate { + count: number; + + constructor(msg: EntityCountUpdateMsg) { + super(msg); + this.count = msg.count; + } +} + export interface TelemetryService { subscribe(subscriber: TelemetrySubscriber); update(subscriber: TelemetrySubscriber); @@ -411,6 +463,7 @@ export class TelemetrySubscriber { private dataSubject = new ReplaySubject(1); private entityDataSubject = new ReplaySubject(1); private alarmDataSubject = new ReplaySubject(1); + private entityCountSubject = new ReplaySubject(1); private reconnectSubject = new Subject(); private zone: NgZone; @@ -420,6 +473,7 @@ export class TelemetrySubscriber { public data$ = this.dataSubject.asObservable(); public entityData$ = this.entityDataSubject.asObservable(); public alarmData$ = this.alarmDataSubject.asObservable(); + public entityCount$ = this.entityCountSubject.asObservable(); public reconnect$ = this.reconnectSubject.asObservable(); public static createEntityAttributesSubscription(telemetryService: TelemetryService, @@ -464,6 +518,7 @@ export class TelemetrySubscriber { this.dataSubject.complete(); this.entityDataSubject.complete(); this.alarmDataSubject.complete(); + this.entityCountSubject.complete(); this.reconnectSubject.complete(); } @@ -513,6 +568,18 @@ export class TelemetrySubscriber { } } + public onEntityCount(message: EntityCountUpdate) { + if (this.zone) { + this.zone.run( + () => { + this.entityCountSubject.next(message); + } + ); + } else { + this.entityCountSubject.next(message); + } + } + public onReconnected() { this.reconnectSubject.next(); } diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index 179a6ff47b..55e6b88e34 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -246,13 +246,15 @@ export interface DataKey extends KeyInfo { export enum DatasourceType { function = 'function', - entity = 'entity' + entity = 'entity', + entityCount = 'entityCount' } export const datasourceTypeTranslationMap = new Map( [ [ DatasourceType.function, 'function.function' ], - [ DatasourceType.entity, 'entity.entity' ] + [ DatasourceType.entity, 'entity.entity' ], + [ DatasourceType.entityCount, 'entity.entities-count' ] ] ); diff --git a/ui-ngx/src/app/shared/shared.module.ts b/ui-ngx/src/app/shared/shared.module.ts index ba56ad72fc..a142a48e90 100644 --- a/ui-ngx/src/app/shared/shared.module.ts +++ b/ui-ngx/src/app/shared/shared.module.ts @@ -52,6 +52,7 @@ import { MatTableModule } from '@angular/material/table'; import { MatTabsModule } from '@angular/material/tabs'; import { MatToolbarModule } from '@angular/material/toolbar'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { MatListModule } from '@angular/material/list'; import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core'; import { NgxDaterangepickerMd } from 'ngx-daterangepicker-material'; import { GridsterModule } from 'angular-gridster2'; @@ -132,6 +133,7 @@ import { TbJsonToStringDirective } from '@shared/components/directives/tb-json-t import { JsonObjectEditDialogComponent } from '@shared/components/dialog/json-object-edit-dialog.component'; import { HistorySelectorComponent } from './components/time/history-selector/history-selector.component'; import { EntityGatewaySelectComponent } from '@shared/components/entity/entity-gateway-select.component'; +import { DndModule } from 'ngx-drag-drop'; import { QueueTypeListComponent } from '@shared/components/queue/queue-type-list.component'; import { ContactComponent } from '@shared/components/contact.component'; import { TimezoneSelectComponent } from '@shared/components/time/timezone-select.component'; @@ -259,6 +261,7 @@ import { TimezoneSelectComponent } from '@shared/components/time/timezone-select MatStepperModule, MatAutocompleteModule, MatChipsModule, + MatListModule, GridsterModule, ClipboardModule, FlexLayoutModule.withConfig({addFlexToParent: false}), @@ -269,6 +272,7 @@ import { TimezoneSelectComponent } from '@shared/components/time/timezone-select HotkeyModule, ColorPickerModule, NgxHmCarouselModule, + DndModule, NgxFlowModule, NgxFlowchartModule ], @@ -348,6 +352,7 @@ import { TimezoneSelectComponent } from '@shared/components/time/timezone-select MatStepperModule, MatAutocompleteModule, MatChipsModule, + MatListModule, GridsterModule, ClipboardModule, FlexLayoutModule, @@ -358,6 +363,7 @@ import { TimezoneSelectComponent } from '@shared/components/time/timezone-select HotkeyModule, ColorPickerModule, NgxHmCarouselModule, + DndModule, NgxFlowchartModule, ConfirmDialogComponent, AlertDialogComponent, diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 216ae2c1b7..50fbe58583 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -800,6 +800,7 @@ "datasource": { "type": "Datasource type", "name": "Name", + "label": "Label", "add-datasource-prompt": "Please add datasource" }, "details": { @@ -1094,6 +1095,7 @@ "entity": { "entity": "Entity", "entities": "Entities", + "entities-count": "Entities count", "aliases": "Entity aliases", "entity-alias": "Entity alias", "unable-delete-entity-alias-title": "Unable to delete entity alias", diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index b993a8dbd4..b1c5167ac9 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -6534,6 +6534,13 @@ ngx-daterangepicker-material@^4.0.1: dependencies: tslib "^1.10.0" +ngx-drag-drop@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ngx-drag-drop/-/ngx-drag-drop-2.0.0.tgz#65d970229964803726fb7b9af4aec24005c810c7" + integrity sha512-t+4/eiC8zaXKqU1ruNfFEfGs1GpMNwpffD0baopvZFKjQHCb5rhNqFilJ54wO4T0OwGp4/RnsVhlcxe1mX6UJg== + dependencies: + tslib "^1.9.0" + "ngx-flowchart@git://github.com/thingsboard/ngx-flowchart.git#master": version "0.0.0" resolved "git://github.com/thingsboard/ngx-flowchart.git#078bfd2cedeeab412dee922e8066a19be6da7278" From f8d1fff4cc346f1867a729d1a9c1ed389bf2cfb5 Mon Sep 17 00:00:00 2001 From: Andrii Shvaika Date: Tue, 2 Mar 2021 12:06:50 +0200 Subject: [PATCH 32/69] New Alias --- .../BaseEntityQueryControllerTest.java | 31 ++++++++++++++++++- .../controller/ControllerSqlTestSuite.java | 6 ++-- .../common/data/asset/AssetSearchQuery.java | 4 +-- .../common/data/device/DeviceSearchQuery.java | 4 +-- .../entityview/EntityViewSearchQuery.java | 4 +-- .../common/data/query/EntityFilter.java | 1 + .../common/data/query/EntityFilterType.java | 1 + .../common/data/query/EntityTypeFilter.java | 30 ++++++++++++++++++ .../data/query/RelationsQueryFilter.java | 5 ++- .../data/relation/EntityRelationsQuery.java | 2 +- ...ter.java => RelationEntityTypeFilter.java} | 2 +- .../dao/relation/BaseRelationService.java | 10 +++--- .../query/DefaultEntityQueryRepository.java | 10 ++++-- .../dao/service/BaseEntityServiceTest.java | 8 ++--- .../dao/service/BaseRelationServiceTest.java | 6 ++-- .../rule/engine/data/RelationsQuery.java | 4 +-- .../TbGetRelatedAttrNodeConfiguration.java | 6 ++-- .../TbChangeOriginatorNodeConfiguration.java | 6 ++-- 18 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/query/EntityTypeFilter.java rename common/data/src/main/java/org/thingsboard/server/common/data/relation/{EntityTypeFilter.java => RelationEntityTypeFilter.java} (95%) diff --git a/application/src/test/java/org/thingsboard/server/controller/BaseEntityQueryControllerTest.java b/application/src/test/java/org/thingsboard/server/controller/BaseEntityQueryControllerTest.java index d4e4b4e0d6..5d234d2691 100644 --- a/application/src/test/java/org/thingsboard/server/controller/BaseEntityQueryControllerTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/BaseEntityQueryControllerTest.java @@ -44,6 +44,7 @@ import org.thingsboard.server.common.data.query.EntityDataSortOrder; import org.thingsboard.server.common.data.query.EntityKey; import org.thingsboard.server.common.data.query.EntityKeyType; import org.thingsboard.server.common.data.query.EntityListFilter; +import org.thingsboard.server.common.data.query.EntityTypeFilter; import org.thingsboard.server.common.data.query.FilterPredicateValue; import org.thingsboard.server.common.data.query.KeyFilter; import org.thingsboard.server.common.data.query.NumericFilterPredicate; @@ -132,6 +133,14 @@ public abstract class BaseEntityQueryControllerTest extends AbstractControllerTe count = doPostWithResponse("/api/entitiesQuery/count", countQuery, Long.class); Assert.assertEquals(97, count.longValue()); + + EntityTypeFilter filter2 = new EntityTypeFilter(); + filter2.setEntityType(EntityType.DEVICE); + + EntityCountQuery countQuery2 = new EntityCountQuery(filter2); + + Long count2 = doPostWithResponse("/api/entitiesQuery/count", countQuery2, Long.class); + Assert.assertEquals(97, count2.longValue()); } @Test @@ -198,11 +207,31 @@ public abstract class BaseEntityQueryControllerTest extends AbstractControllerTe Assert.assertEquals(11, data.getTotalElements()); Assert.assertEquals("Device19", data.getData().get(0).getLatest().get(EntityKeyType.ENTITY_FIELD).get("name").getValue()); + + EntityTypeFilter filter2 = new EntityTypeFilter(); + filter2.setEntityType(EntityType.DEVICE); + + EntityDataSortOrder sortOrder2 = new EntityDataSortOrder( + new EntityKey(EntityKeyType.ENTITY_FIELD, "createdTime"), EntityDataSortOrder.Direction.ASC + ); + EntityDataPageLink pageLink2 = new EntityDataPageLink(10, 0, null, sortOrder2); + List entityFields2 = Collections.singletonList(new EntityKey(EntityKeyType.ENTITY_FIELD, "name")); + + EntityDataQuery query2 = new EntityDataQuery(filter2, pageLink2, entityFields2, null, null); + + PageData data2 = + doPostWithTypedResponse("/api/entitiesQuery/find", query2, new TypeReference>() { + }); + + Assert.assertEquals(97, data2.getTotalElements()); + Assert.assertEquals(10, data2.getTotalPages()); + Assert.assertTrue(data2.hasNext()); + Assert.assertEquals(10, data2.getData().size()); + } @Test public void testFindEntityDataByQueryWithAttributes() throws Exception { - List devices = new ArrayList<>(); List temperatures = new ArrayList<>(); List highTemperatures = new ArrayList<>(); diff --git a/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java b/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java index a386f18c37..0f969a848f 100644 --- a/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java +++ b/application/src/test/java/org/thingsboard/server/controller/ControllerSqlTestSuite.java @@ -26,9 +26,9 @@ import java.util.Arrays; @RunWith(ClasspathSuite.class) @ClasspathSuite.ClassnameFilters({ - "org.thingsboard.server.controller.sql.WebsocketApiSqlTest", -// "org.thingsboard.server.controller.sql.TenantProfileControllerSqlTest", -// "org.thingsboard.server.controller.sql.*Test", +// "org.thingsboard.server.controller.sql.WebsocketApiSqlTest", +// "org.thingsboard.server.controller.sql.EntityQueryControllerSqlTest", + "org.thingsboard.server.controller.sql.*Test", }) public class ControllerSqlTestSuite { diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/asset/AssetSearchQuery.java b/common/data/src/main/java/org/thingsboard/server/common/data/asset/AssetSearchQuery.java index 0fcb942de4..fe916f0eaa 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/asset/AssetSearchQuery.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/asset/AssetSearchQuery.java @@ -19,7 +19,7 @@ import lombok.Data; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntityRelationsQuery; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import org.thingsboard.server.common.data.relation.RelationsSearchParameters; import java.util.Collections; @@ -39,7 +39,7 @@ public class AssetSearchQuery { EntityRelationsQuery query = new EntityRelationsQuery(); query.setParameters(parameters); query.setFilters( - Collections.singletonList(new EntityTypeFilter(relationType == null ? EntityRelation.CONTAINS_TYPE : relationType, + Collections.singletonList(new RelationEntityTypeFilter(relationType == null ? EntityRelation.CONTAINS_TYPE : relationType, Collections.singletonList(EntityType.ASSET)))); return query; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/device/DeviceSearchQuery.java b/common/data/src/main/java/org/thingsboard/server/common/data/device/DeviceSearchQuery.java index 2423bda7db..9143fdfece 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/device/DeviceSearchQuery.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/device/DeviceSearchQuery.java @@ -19,7 +19,7 @@ import lombok.Data; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntityRelationsQuery; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import org.thingsboard.server.common.data.relation.RelationsSearchParameters; import java.util.Collections; @@ -36,7 +36,7 @@ public class DeviceSearchQuery { EntityRelationsQuery query = new EntityRelationsQuery(); query.setParameters(parameters); query.setFilters( - Collections.singletonList(new EntityTypeFilter(relationType == null ? EntityRelation.CONTAINS_TYPE : relationType, + Collections.singletonList(new RelationEntityTypeFilter(relationType == null ? EntityRelation.CONTAINS_TYPE : relationType, Collections.singletonList(EntityType.DEVICE)))); return query; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/entityview/EntityViewSearchQuery.java b/common/data/src/main/java/org/thingsboard/server/common/data/entityview/EntityViewSearchQuery.java index 363832c5ce..348f7725b0 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/entityview/EntityViewSearchQuery.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/entityview/EntityViewSearchQuery.java @@ -19,7 +19,7 @@ import lombok.Data; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntityRelationsQuery; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import org.thingsboard.server.common.data.relation.RelationsSearchParameters; import java.util.Collections; @@ -36,7 +36,7 @@ public class EntityViewSearchQuery { EntityRelationsQuery query = new EntityRelationsQuery(); query.setParameters(parameters); query.setFilters( - Collections.singletonList(new EntityTypeFilter(relationType == null ? EntityRelation.CONTAINS_TYPE : relationType, + Collections.singletonList(new RelationEntityTypeFilter(relationType == null ? EntityRelation.CONTAINS_TYPE : relationType, Collections.singletonList(EntityType.ENTITY_VIEW)))); return query; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilter.java b/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilter.java index 78ef869f56..efdd70ec7b 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilter.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilter.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; @JsonSubTypes.Type(value = SingleEntityFilter.class, name = "singleEntity"), @JsonSubTypes.Type(value = EntityListFilter.class, name = "entityList"), @JsonSubTypes.Type(value = EntityNameFilter.class, name = "entityName"), + @JsonSubTypes.Type(value = EntityTypeFilter.class, name = "entityType"), @JsonSubTypes.Type(value = AssetTypeFilter.class, name = "assetType"), @JsonSubTypes.Type(value = DeviceTypeFilter.class, name = "deviceType"), @JsonSubTypes.Type(value = EntityViewTypeFilter.class, name = "entityViewType"), diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilterType.java b/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilterType.java index 62c7546e8e..6b590c4695 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilterType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityFilterType.java @@ -19,6 +19,7 @@ public enum EntityFilterType { SINGLE_ENTITY("singleEntity"), ENTITY_LIST("entityList"), ENTITY_NAME("entityName"), + ENTITY_TYPE("entityType"), ASSET_TYPE("assetType"), DEVICE_TYPE("deviceType"), ENTITY_VIEW_TYPE("entityViewType"), diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityTypeFilter.java b/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityTypeFilter.java new file mode 100644 index 0000000000..22c2212a84 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/query/EntityTypeFilter.java @@ -0,0 +1,30 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.query; + +import lombok.Data; +import org.thingsboard.server.common.data.EntityType; + +@Data +public class EntityTypeFilter implements EntityFilter { + @Override + public EntityFilterType getType() { + return EntityFilterType.ENTITY_TYPE; + } + + private EntityType entityType; + +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/query/RelationsQueryFilter.java b/common/data/src/main/java/org/thingsboard/server/common/data/query/RelationsQueryFilter.java index 0890f48c3a..9c113eb793 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/query/RelationsQueryFilter.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/query/RelationsQueryFilter.java @@ -18,8 +18,7 @@ package org.thingsboard.server.common.data.query; import lombok.Data; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; -import org.thingsboard.server.common.data.relation.RelationTypeGroup; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import java.util.List; @@ -33,7 +32,7 @@ public class RelationsQueryFilter implements EntityFilter { private EntityId rootEntity; private EntitySearchDirection direction; - private List filters; + private List filters; private int maxLevel; private boolean fetchLastLevelOnly; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityRelationsQuery.java b/common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityRelationsQuery.java index b673f60462..1a5415d3c7 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityRelationsQuery.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityRelationsQuery.java @@ -26,6 +26,6 @@ import java.util.List; public class EntityRelationsQuery { private RelationsSearchParameters parameters; - private List filters; + private List filters; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityTypeFilter.java b/common/data/src/main/java/org/thingsboard/server/common/data/relation/RelationEntityTypeFilter.java similarity index 95% rename from common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityTypeFilter.java rename to common/data/src/main/java/org/thingsboard/server/common/data/relation/RelationEntityTypeFilter.java index 8b9849d6a1..1e817dda14 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/relation/EntityTypeFilter.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/relation/RelationEntityTypeFilter.java @@ -26,7 +26,7 @@ import java.util.List; */ @Data @AllArgsConstructor -public class EntityTypeFilter { +public class RelationEntityTypeFilter { private String relationType; diff --git a/dao/src/main/java/org/thingsboard/server/dao/relation/BaseRelationService.java b/dao/src/main/java/org/thingsboard/server/dao/relation/BaseRelationService.java index 1fa9f057b2..44b328fd9f 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/relation/BaseRelationService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/relation/BaseRelationService.java @@ -35,7 +35,7 @@ import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntityRelationInfo; import org.thingsboard.server.common.data.relation.EntityRelationsQuery; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import org.thingsboard.server.common.data.relation.RelationTypeGroup; import org.thingsboard.server.common.data.relation.RelationsSearchParameters; import org.thingsboard.server.dao.entity.EntityService; @@ -457,7 +457,7 @@ public class BaseRelationService implements RelationService { //boolean fetchLastLevelOnly = true; log.trace("Executing findByQuery [{}]", query); RelationsSearchParameters params = query.getParameters(); - final List filters = query.getFilters(); + final List filters = query.getFilters(); if (filters == null || filters.isEmpty()) { log.debug("Filters are not set [{}]", query); } @@ -575,8 +575,8 @@ public class BaseRelationService implements RelationService { }; } - private boolean matchFilters(List filters, EntityRelation relation, EntitySearchDirection direction) { - for (EntityTypeFilter filter : filters) { + private boolean matchFilters(List filters, EntityRelation relation, EntitySearchDirection direction) { + for (RelationEntityTypeFilter filter : filters) { if (match(filter, relation, direction)) { return true; } @@ -584,7 +584,7 @@ public class BaseRelationService implements RelationService { return false; } - private boolean match(EntityTypeFilter filter, EntityRelation relation, EntitySearchDirection direction) { + private boolean match(RelationEntityTypeFilter filter, EntityRelation relation, EntitySearchDirection direction) { if (StringUtils.isEmpty(filter.getRelationType()) || filter.getRelationType().equals(relation.getType())) { if (filter.getEntityTypes() == null || filter.getEntityTypes().isEmpty()) { return true; diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java index 170a2edfa2..4907c03dea 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/query/DefaultEntityQueryRepository.java @@ -40,12 +40,13 @@ import org.thingsboard.server.common.data.query.EntityKeyType; import org.thingsboard.server.common.data.query.EntityListFilter; import org.thingsboard.server.common.data.query.EntityNameFilter; import org.thingsboard.server.common.data.query.EntitySearchQueryFilter; +import org.thingsboard.server.common.data.query.EntityTypeFilter; import org.thingsboard.server.common.data.query.EntityViewSearchQueryFilter; import org.thingsboard.server.common.data.query.EntityViewTypeFilter; import org.thingsboard.server.common.data.query.RelationsQueryFilter; import org.thingsboard.server.common.data.query.SingleEntityFilter; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import java.util.Arrays; import java.util.Collections; @@ -488,6 +489,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository { case ASSET_SEARCH_QUERY: case ENTITY_VIEW_SEARCH_QUERY: case API_USAGE_STATE: + case ENTITY_TYPE: return ""; default: throw new RuntimeException("Not implemented!"); @@ -573,7 +575,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository { boolean single = entityFilter.getFilters() != null && entityFilter.getFilters().size() == 1; if (entityFilter.getFilters() != null && !entityFilter.getFilters().isEmpty()) { int entityTypeFilterIdx = 0; - for (EntityTypeFilter etf : entityFilter.getFilters()) { + for (RelationEntityTypeFilter etf : entityFilter.getFilters()) { String etfCondition = buildEtfCondition(ctx, etf, entityFilter.getDirection(), entityTypeFilterIdx++); if (!etfCondition.isEmpty()) { if (noConditions) { @@ -622,7 +624,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository { return "( " + selectFields + from + ")"; } - private String buildEtfCondition(QueryContext ctx, EntityTypeFilter etf, EntitySearchDirection direction, int entityTypeFilterIdx) { + private String buildEtfCondition(QueryContext ctx, RelationEntityTypeFilter etf, EntitySearchDirection direction, int entityTypeFilterIdx) { StringBuilder whereFilter = new StringBuilder(); String relationType = etf.getRelationType(); List entityTypes = etf.getEntityTypes(); @@ -728,6 +730,8 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository { return ((EntityListFilter) entityFilter).getEntityType(); case ENTITY_NAME: return ((EntityNameFilter) entityFilter).getEntityType(); + case ENTITY_TYPE: + return ((EntityTypeFilter) entityFilter).getEntityType(); case ASSET_TYPE: case ASSET_SEARCH_QUERY: return EntityType.ASSET; diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java index 98934cfaa0..6c899c01c4 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java @@ -58,7 +58,7 @@ import org.thingsboard.server.common.data.query.RelationsQueryFilter; import org.thingsboard.server.common.data.query.StringFilterPredicate; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import org.thingsboard.server.common.data.relation.RelationTypeGroup; import org.thingsboard.server.dao.attributes.AttributesService; import org.thingsboard.server.dao.model.sqlts.ts.TsKvEntity; @@ -160,13 +160,13 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest { long count = entityService.countEntitiesByQuery(tenantId, new CustomerId(CustomerId.NULL_UUID), countQuery); Assert.assertEquals(30, count); - filter.setFilters(Collections.singletonList(new EntityTypeFilter("Contains", Collections.singletonList(EntityType.DEVICE)))); + filter.setFilters(Collections.singletonList(new RelationEntityTypeFilter("Contains", Collections.singletonList(EntityType.DEVICE)))); count = entityService.countEntitiesByQuery(tenantId, new CustomerId(CustomerId.NULL_UUID), countQuery); Assert.assertEquals(25, count); filter.setRootEntity(devices.get(0).getId()); filter.setDirection(EntitySearchDirection.TO); - filter.setFilters(Collections.singletonList(new EntityTypeFilter("Manages", Collections.singletonList(EntityType.TENANT)))); + filter.setFilters(Collections.singletonList(new RelationEntityTypeFilter("Manages", Collections.singletonList(EntityType.TENANT)))); count = entityService.countEntitiesByQuery(tenantId, new CustomerId(CustomerId.NULL_UUID), countQuery); Assert.assertEquals(1, count); @@ -228,7 +228,7 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest { RelationsQueryFilter filter = new RelationsQueryFilter(); filter.setRootEntity(tenantId); filter.setDirection(EntitySearchDirection.FROM); - filter.setFilters(Collections.singletonList(new EntityTypeFilter("Contains", Collections.singletonList(EntityType.DEVICE)))); + filter.setFilters(Collections.singletonList(new RelationEntityTypeFilter("Contains", Collections.singletonList(EntityType.DEVICE)))); EntityDataSortOrder sortOrder = new EntityDataSortOrder( new EntityKey(EntityKeyType.ENTITY_FIELD, "createdTime"), EntityDataSortOrder.Direction.ASC diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java index 84c0a2975c..6f5ea9acb9 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseRelationServiceTest.java @@ -26,7 +26,7 @@ import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntityRelationsQuery; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import org.thingsboard.server.common.data.relation.RelationTypeGroup; import org.thingsboard.server.common.data.relation.RelationsSearchParameters; import org.thingsboard.server.dao.exception.DataValidationException; @@ -221,7 +221,7 @@ public abstract class BaseRelationServiceTest extends AbstractServiceTest { EntityRelationsQuery query = new EntityRelationsQuery(); query.setParameters(new RelationsSearchParameters(assetA, EntitySearchDirection.FROM, -1, false)); - query.setFilters(Collections.singletonList(new EntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.singletonList(EntityType.ASSET)))); + query.setFilters(Collections.singletonList(new RelationEntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.singletonList(EntityType.ASSET)))); List relations = relationService.findByQuery(SYSTEM_TENANT_ID, query).get(); Assert.assertEquals(3, relations.size()); Assert.assertTrue(relations.contains(relationA)); @@ -255,7 +255,7 @@ public abstract class BaseRelationServiceTest extends AbstractServiceTest { EntityRelationsQuery query = new EntityRelationsQuery(); query.setParameters(new RelationsSearchParameters(assetA, EntitySearchDirection.FROM, -1, false)); - query.setFilters(Collections.singletonList(new EntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.singletonList(EntityType.ASSET)))); + query.setFilters(Collections.singletonList(new RelationEntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.singletonList(EntityType.ASSET)))); List relations = relationService.findByQuery(SYSTEM_TENANT_ID, query).get(); Assert.assertEquals(2, relations.size()); Assert.assertTrue(relations.contains(relationAB)); diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/data/RelationsQuery.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/data/RelationsQuery.java index 295690d445..46e3c97e87 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/data/RelationsQuery.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/data/RelationsQuery.java @@ -17,7 +17,7 @@ package org.thingsboard.rule.engine.data; import lombok.Data; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import java.util.List; @@ -26,6 +26,6 @@ public class RelationsQuery { private EntitySearchDirection direction; private int maxLevel = 1; - private List filters; + private List filters; private boolean fetchLastLevelOnly = false; } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetRelatedAttrNodeConfiguration.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetRelatedAttrNodeConfiguration.java index 2ae5fd7add..b9a8df3acd 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetRelatedAttrNodeConfiguration.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetRelatedAttrNodeConfiguration.java @@ -19,7 +19,7 @@ import lombok.Data; import org.thingsboard.rule.engine.data.RelationsQuery; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import java.util.Collections; import java.util.HashMap; @@ -41,8 +41,8 @@ public class TbGetRelatedAttrNodeConfiguration extends TbGetEntityAttrNodeConfig RelationsQuery relationsQuery = new RelationsQuery(); relationsQuery.setDirection(EntitySearchDirection.FROM); relationsQuery.setMaxLevel(1); - EntityTypeFilter entityTypeFilter = new EntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.emptyList()); - relationsQuery.setFilters(Collections.singletonList(entityTypeFilter)); + RelationEntityTypeFilter relationEntityTypeFilter = new RelationEntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.emptyList()); + relationsQuery.setFilters(Collections.singletonList(relationEntityTypeFilter)); configuration.setRelationsQuery(relationsQuery); return configuration; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/transform/TbChangeOriginatorNodeConfiguration.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/transform/TbChangeOriginatorNodeConfiguration.java index 79ed4f5191..6dcc5280ea 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/transform/TbChangeOriginatorNodeConfiguration.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/transform/TbChangeOriginatorNodeConfiguration.java @@ -20,7 +20,7 @@ import org.thingsboard.rule.engine.api.NodeConfiguration; import org.thingsboard.rule.engine.data.RelationsQuery; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntitySearchDirection; -import org.thingsboard.server.common.data.relation.EntityTypeFilter; +import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; import java.util.Collections; @@ -39,8 +39,8 @@ public class TbChangeOriginatorNodeConfiguration extends TbTransformNodeConfigur RelationsQuery relationsQuery = new RelationsQuery(); relationsQuery.setDirection(EntitySearchDirection.FROM); relationsQuery.setMaxLevel(1); - EntityTypeFilter entityTypeFilter = new EntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.emptyList()); - relationsQuery.setFilters(Collections.singletonList(entityTypeFilter)); + RelationEntityTypeFilter relationEntityTypeFilter = new RelationEntityTypeFilter(EntityRelation.CONTAINS_TYPE, Collections.emptyList()); + relationsQuery.setFilters(Collections.singletonList(relationEntityTypeFilter)); configuration.setRelationsQuery(relationsQuery); return configuration; From cbc8991b05833bef9db458fae46436ede0b101a0 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Tue, 2 Mar 2021 13:21:53 +0200 Subject: [PATCH 33/69] UI: Updated value name --- .../main/data/json/system/widget_bundles/cards.json | 2 +- ui-ngx/src/app/core/api/data-aggregator.ts | 4 ++-- ui-ngx/src/app/core/api/entity-data-subscription.ts | 4 ++-- ui-ngx/src/app/core/api/entity-data.service.ts | 12 ++++++------ ui-ngx/src/app/core/api/widget-api.models.ts | 2 +- ui-ngx/src/app/core/api/widget-subscription.ts | 9 +++++---- .../components/widget/widget-component.service.ts | 4 ++-- .../home/components/widget/widget.component.ts | 2 +- ui-ngx/src/app/shared/models/widget.models.ts | 2 +- 9 files changed, 21 insertions(+), 20 deletions(-) diff --git a/application/src/main/data/json/system/widget_bundles/cards.json b/application/src/main/data/json/system/widget_bundles/cards.json index c0f0d329b3..437d56678e 100644 --- a/application/src/main/data/json/system/widget_bundles/cards.json +++ b/application/src/main/data/json/system/widget_bundles/cards.json @@ -47,7 +47,7 @@ "resources": [], "templateHtml": "\n", "templateCss": "", - "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeseriesTableWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n reloadOnlyOnDataUpdated: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", + "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeseriesTableWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n ignoreDataUpdateOnIntervalTick: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"TimeseriesTableSettings\",\n \"properties\": {\n \"showTimestamp\": {\n \"title\": \"Display timestamp column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"showMilliseconds\": {\n \"title\": \"Display timestamp milliseconds\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n }, \n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"hideEmptyLines\": {\n \"title\": \"Hide empty lines\",\n \"type\": \"boolean\",\n \"default\": false\n }\n },\n \"required\": []\n },\n \"form\": [\n \"showTimestamp\",\n \"showMilliseconds\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"hideEmptyLines\"\n ]\n}", "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\"\n }\n ]\n}", "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Temperature °C\",\"color\":\"#2196f3\",\"settings\":{\"useCellStyleFunction\":true,\"cellStyleFunction\":\"if (value) {\\n var percent = (value + 60)/120 * 100;\\n var color = tinycolor.mix('blue', 'red', amount = percent);\\n color.setAlpha(.5);\\n return {\\n paddingLeft: '20px',\\n color: '#ffffff',\\n background: color.toRgbString(),\\n fontSize: '18px'\\n };\\n} else {\\n return {};\\n}\"},\"_hash\":0.8587686344902596,\"funcBody\":\"var value = prevValue + Math.random() * 40 - 20;\\nvar multiplier = Math.pow(10, 1 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -60) {\\n\\tvalue = -60;\\n} else if (value > 60) {\\n\\tvalue = 60;\\n}\\nreturn value;\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Humidity, %\",\"color\":\"#ffc107\",\"settings\":{\"useCellStyleFunction\":true,\"cellStyleFunction\":\"if (value) {\\n var percent = value;\\n var backgroundColor = tinycolor('blue');\\n backgroundColor.setAlpha(value/100);\\n var color = 'blue';\\n if (value > 50) {\\n color = 'white';\\n }\\n \\n return {\\n paddingLeft: '20px',\\n color: color,\\n background: backgroundColor.toRgbString(),\\n fontSize: '18px'\\n };\\n} else {\\n return {};\\n}\",\"useCellContentFunction\":false},\"_hash\":0.12775350966079668,\"funcBody\":\"var value = prevValue + Math.random() * 20 - 10;\\nvar multiplier = Math.pow(10, 1 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < 5) {\\n\\tvalue = 5;\\n} else if (value > 100) {\\n\\tvalue = 100;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":60000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"showTimestamp\":true,\"displayPagination\":true,\"defaultPageSize\":10},\"title\":\"Timeseries table\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"widgetStyle\":{},\"actions\":{},\"showTitleIcon\":false,\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"24px\"}" diff --git a/ui-ngx/src/app/core/api/data-aggregator.ts b/ui-ngx/src/app/core/api/data-aggregator.ts index 382c97bfcc..4437538719 100644 --- a/ui-ngx/src/app/core/api/data-aggregator.ts +++ b/ui-ngx/src/app/core/api/data-aggregator.ts @@ -92,7 +92,7 @@ export class DataAggregator { private interval: number, private stateData: boolean, private utils: UtilsService, - private isReloadOnlyOnDataUpdated: boolean) { + private ignoreDataUpdateOnIntervalTick: boolean) { this.tsKeyNames.forEach((key) => { this.dataBuffer[key] = []; }); @@ -205,7 +205,7 @@ export class DataAggregator { } else { this.data = this.updateData(); } - if (this.onDataCb && (!this.isReloadOnlyOnDataUpdated || this.updatedData)) { + if (this.onDataCb && (!this.ignoreDataUpdateOnIntervalTick || this.updatedData)) { this.onDataCb(this.data, detectChanges); this.updatedData = false; } diff --git a/ui-ngx/src/app/core/api/entity-data-subscription.ts b/ui-ngx/src/app/core/api/entity-data-subscription.ts index 44bbfd4c08..86fa80b794 100644 --- a/ui-ngx/src/app/core/api/entity-data-subscription.ts +++ b/ui-ngx/src/app/core/api/entity-data-subscription.ts @@ -66,7 +66,7 @@ export interface EntityDataSubscriptionOptions { type: widgetType; entityFilter?: EntityFilter; isPaginatedDataSubscription?: boolean; - isReloadOnlyOnDataUpdated?: boolean; + ignoreDataUpdateOnIntervalTick?: boolean; pageLink?: EntityDataPageLink; keyFilters?: Array; additionalKeyFilters?: Array; @@ -673,7 +673,7 @@ export class EntityDataSubscription { subsTw.aggregation.interval, subsTw.aggregation.stateData, this.utils, - this.entityDataSubscriptionOptions.isReloadOnlyOnDataUpdated + this.entityDataSubscriptionOptions.ignoreDataUpdateOnIntervalTick ); } diff --git a/ui-ngx/src/app/core/api/entity-data.service.ts b/ui-ngx/src/app/core/api/entity-data.service.ts index bd1a55c880..198b5c559a 100644 --- a/ui-ngx/src/app/core/api/entity-data.service.ts +++ b/ui-ngx/src/app/core/api/entity-data.service.ts @@ -61,7 +61,7 @@ export class EntityDataService { private utils: UtilsService) {} public prepareSubscription(listener: EntityDataListener, - isReloadOnlyOnDataUpdated = false): Observable { + ignoreDataUpdateOnIntervalTick = false): Observable { const datasource = listener.configDatasource; listener.subscriptionOptions = this.createSubscriptionOptions( datasource, @@ -70,7 +70,7 @@ export class EntityDataService { datasource.keyFilters, null, false, - isReloadOnlyOnDataUpdated); + ignoreDataUpdateOnIntervalTick); if (datasource.type === DatasourceType.entity && (!datasource.entityFilter || !datasource.pageLink)) { return of(null); } @@ -90,7 +90,7 @@ export class EntityDataService { public subscribeForPaginatedData(listener: EntityDataListener, pageLink: EntityDataPageLink, keyFilters: KeyFilter[], - isReloadOnlyOnDataUpdated = false): Observable { + ignoreDataUpdateOnIntervalTick = false): Observable { const datasource = listener.configDatasource; listener.subscriptionOptions = this.createSubscriptionOptions( datasource, @@ -99,7 +99,7 @@ export class EntityDataService { datasource.keyFilters, keyFilters, true, - isReloadOnlyOnDataUpdated); + ignoreDataUpdateOnIntervalTick); if (datasource.type === DatasourceType.entity && (!datasource.entityFilter || !pageLink)) { listener.dataLoaded(emptyPageData(), [], listener.configDatasourceIndex, listener.subscriptionOptions.pageLink); @@ -124,7 +124,7 @@ export class EntityDataService { keyFilters: KeyFilter[], additionalKeyFilters: KeyFilter[], isPaginatedDataSubscription: boolean, - isReloadOnlyOnDataUpdated: boolean): EntityDataSubscriptionOptions { + ignoreDataUpdateOnIntervalTick: boolean): EntityDataSubscriptionOptions { const subscriptionDataKeys: Array = []; datasource.dataKeys.forEach((dataKey) => { const subscriptionDataKey: SubscriptionDataKey = { @@ -147,7 +147,7 @@ export class EntityDataService { entityDataSubscriptionOptions.additionalKeyFilters = additionalKeyFilters; } entityDataSubscriptionOptions.isPaginatedDataSubscription = isPaginatedDataSubscription; - entityDataSubscriptionOptions.isReloadOnlyOnDataUpdated = isReloadOnlyOnDataUpdated; + entityDataSubscriptionOptions.ignoreDataUpdateOnIntervalTick = ignoreDataUpdateOnIntervalTick; return entityDataSubscriptionOptions; } } diff --git a/ui-ngx/src/app/core/api/widget-api.models.ts b/ui-ngx/src/app/core/api/widget-api.models.ts index e6cbb4108e..eff95a6f2d 100644 --- a/ui-ngx/src/app/core/api/widget-api.models.ts +++ b/ui-ngx/src/app/core/api/widget-api.models.ts @@ -226,7 +226,7 @@ export interface WidgetSubscriptionOptions { hasDataPageLink?: boolean; singleEntity?: boolean; warnOnPageDataOverflow?: boolean; - reloadOnlyOnDataUpdated?: boolean; + ignoreDataUpdateOnIntervalTick?: boolean; targetDeviceAliasIds?: Array; targetDeviceIds?: Array; useDashboardTimewindow?: boolean; diff --git a/ui-ngx/src/app/core/api/widget-subscription.ts b/ui-ngx/src/app/core/api/widget-subscription.ts index 7bef682d36..7f38a2f9c2 100644 --- a/ui-ngx/src/app/core/api/widget-subscription.ts +++ b/ui-ngx/src/app/core/api/widget-subscription.ts @@ -83,7 +83,7 @@ export class WidgetSubscription implements IWidgetSubscription { hasDataPageLink: boolean; singleEntity: boolean; warnOnPageDataOverflow: boolean; - reloadOnlyOnDataUpdated: boolean; + ignoreDataUpdateOnIntervalTick: boolean; datasourcePages: PageData[]; dataPages: PageData>[]; @@ -201,7 +201,7 @@ export class WidgetSubscription implements IWidgetSubscription { this.hasDataPageLink = options.hasDataPageLink; this.singleEntity = options.singleEntity; this.warnOnPageDataOverflow = options.warnOnPageDataOverflow; - this.reloadOnlyOnDataUpdated = options.reloadOnlyOnDataUpdated; + this.ignoreDataUpdateOnIntervalTick = options.ignoreDataUpdateOnIntervalTick; this.datasourcePages = []; this.datasources = []; this.dataPages = []; @@ -425,7 +425,7 @@ export class WidgetSubscription implements IWidgetSubscription { } }; this.entityDataListeners.push(listener); - return this.ctx.entityDataService.prepareSubscription(listener, this.reloadOnlyOnDataUpdated); + return this.ctx.entityDataService.prepareSubscription(listener, this.ignoreDataUpdateOnIntervalTick); }); return forkJoin(resolveResultObservables).pipe( map((resolveResults) => { @@ -817,7 +817,8 @@ export class WidgetSubscription implements IWidgetSubscription { } }; this.entityDataListeners[datasourceIndex] = entityDataListener; - return this.ctx.entityDataService.subscribeForPaginatedData(entityDataListener, pageLink, keyFilters, this.reloadOnlyOnDataUpdated); + return this.ctx.entityDataService.subscribeForPaginatedData(entityDataListener, pageLink, keyFilters, + this.ignoreDataUpdateOnIntervalTick); } else { return of(null); } diff --git a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts index 3a9db04714..5166a845f9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget-component.service.ts @@ -485,8 +485,8 @@ export class WidgetComponentService { if (isUndefined(result.typeParameters.warnOnPageDataOverflow)) { result.typeParameters.warnOnPageDataOverflow = true; } - if (isUndefined(result.typeParameters.reloadOnlyOnDataUpdated)) { - result.typeParameters.reloadOnlyOnDataUpdated = false; + if (isUndefined(result.typeParameters.ignoreDataUpdateOnIntervalTick)) { + result.typeParameters.ignoreDataUpdateOnIntervalTick = false; } if (isUndefined(result.typeParameters.dataKeysOptional)) { result.typeParameters.dataKeysOptional = false; diff --git a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts index 9d2db23d83..aa47b97c20 100644 --- a/ui-ngx/src/app/modules/home/components/widget/widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/widget.component.ts @@ -895,7 +895,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI hasDataPageLink: this.typeParameters.hasDataPageLink, singleEntity: this.typeParameters.singleEntity, warnOnPageDataOverflow: this.typeParameters.warnOnPageDataOverflow, - reloadOnlyOnDataUpdated: this.typeParameters.reloadOnlyOnDataUpdated, + ignoreDataUpdateOnIntervalTick: this.typeParameters.ignoreDataUpdateOnIntervalTick, comparisonEnabled: comparisonSettings.comparisonEnabled, timeForComparison: comparisonSettings.timeForComparison }; diff --git a/ui-ngx/src/app/shared/models/widget.models.ts b/ui-ngx/src/app/shared/models/widget.models.ts index 12734ce364..cdfbd12584 100644 --- a/ui-ngx/src/app/shared/models/widget.models.ts +++ b/ui-ngx/src/app/shared/models/widget.models.ts @@ -154,7 +154,7 @@ export interface WidgetTypeParameters { hasDataPageLink?: boolean; singleEntity?: boolean; warnOnPageDataOverflow?: boolean; - reloadOnlyOnDataUpdated?: boolean; + ignoreDataUpdateOnIntervalTick?: boolean; } export interface WidgetControllerDescriptor { From 99c9c099ba2e61d4a3ce917e2c2464bb81a694e3 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 2 Mar 2021 15:13:21 +0200 Subject: [PATCH 34/69] Add Entity Type alias. Fix Key filter value conditional processing. --- .../app/core/api/entity-data-subscription.ts | 54 ++++++++++++------- ui-ngx/src/app/core/http/entity.service.ts | 7 +++ .../entity/entity-filter-view.component.ts | 4 ++ .../entity/entity-filter.component.html | 7 +++ .../entity/entity-filter.component.ts | 5 ++ .../filter/key-filter-dialog.component.ts | 21 +++++--- .../relation/relation-filters.component.ts | 10 ++-- ui-ngx/src/app/shared/models/alias.models.ts | 12 +++-- .../app/shared/models/query/query.models.ts | 4 +- .../src/app/shared/models/relation.models.ts | 4 +- .../assets/locale/locale.constant-en_US.json | 1 + 11 files changed, 89 insertions(+), 40 deletions(-) diff --git a/ui-ngx/src/app/core/api/entity-data-subscription.ts b/ui-ngx/src/app/core/api/entity-data-subscription.ts index 79c505b07a..8a6c2f54e8 100644 --- a/ui-ngx/src/app/core/api/entity-data-subscription.ts +++ b/ui-ngx/src/app/core/api/entity-data-subscription.ts @@ -155,7 +155,7 @@ export class EntityDataSubscription { clearTimeout(this.timer); this.timer = null; } - if (this.datasourceType === DatasourceType.entity) { + if (this.datasourceType === DatasourceType.entity || this.datasourceType === DatasourceType.entityCount) { if (this.subscriber) { this.subscriber.unsubscribe(); this.subscriber = null; @@ -318,24 +318,30 @@ export class EntityDataSubscription { entityType: null }; - const entityData: EntityData = { - entityId, - timeseries: {}, - latest: {} - }; - entityData.latest[EntityKeyType.ENTITY_FIELD] = { - name: {ts: Date.now(), value: DatasourceType.entityCount}, - }; - const countKey = this.entityDataSubscriptionOptions.dataKeys[0]; + let dataReceived = false; + this.subscriber.entityCount$.subscribe( (entityCountUpdate) => { - if (!entityData.latest[EntityKeyType.COUNT]) { - entityData.latest[EntityKeyType.COUNT] = {}; - entityData.latest[EntityKeyType.COUNT][countKey.name] = { - ts: Date.now(), - value: entityCountUpdate.count + '' + if (!dataReceived) { + const entityData: EntityData = { + entityId, + latest: { + [EntityKeyType.ENTITY_FIELD]: { + name: { + ts: Date.now(), + value: DatasourceType.entityCount + } + }, + [EntityKeyType.COUNT]: { + [countKey.name]: { + ts: Date.now(), + value: entityCountUpdate.count + '' + } + } + }, + timeseries: {} }; const pageData: PageData = { data: [entityData], @@ -344,12 +350,20 @@ export class EntityDataSubscription { totalPages: 1 }; this.onPageData(pageData); + dataReceived = true; } else { - const update = [deepClone(entityData)]; - update[0].latest[EntityKeyType.COUNT][countKey.name] = { - ts: Date.now(), - value: entityCountUpdate.count + '' - }; + const update: EntityData[] = [{ + entityId, + latest: { + [EntityKeyType.COUNT]: { + [countKey.name]: { + ts: Date.now(), + value: entityCountUpdate.count + '' + } + } + }, + timeseries: {} + }]; this.onDataUpdate(update); } } diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 17a35b2305..0862e10a76 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -481,6 +481,8 @@ export class EntityService { return entityTypes.indexOf(filter.entityType) > -1 ? true : false; case AliasFilterType.entityName: return entityTypes.indexOf(filter.entityType) > -1 ? true : false; + case AliasFilterType.entityType: + return entityTypes.indexOf(filter.entityType) > -1 ? true : false; case AliasFilterType.stateEntity: return true; case AliasFilterType.assetType: @@ -540,6 +542,8 @@ export class EntityService { return true; case AliasFilterType.entityName: return true; + case AliasFilterType.entityType: + return true; case AliasFilterType.stateEntity: return true; case AliasFilterType.assetType: @@ -805,6 +809,9 @@ export class EntityService { case AliasFilterType.entityName: result.entityFilter = deepClone(filter); return of(result); + case AliasFilterType.entityType: + result.entityFilter = deepClone(filter); + return of(result); case AliasFilterType.stateEntity: result.stateEntity = true; if (stateEntityId) { diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts index 42fb943ef3..07cee4ffb2 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter-view.component.ts @@ -76,6 +76,10 @@ export class EntityFilterViewComponent implements ControlValueAccessor { this.filterDisplayValue = this.translate.instant(entityTypeTranslations.get(entityType).nameStartsWith, {prefix}); break; + case AliasFilterType.entityType: + entityType = this.filter.entityType; + this.filterDisplayValue = this.translate.instant(entityTypeTranslations.get(entityType).typePlural); + break; case AliasFilterType.stateEntity: this.filterDisplayValue = this.translate.instant('alias.filter-type-state-entity-description'); break; diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html index cfd75d7299..5c5ca5ff59 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.html @@ -59,6 +59,13 @@ + + + + alias.state-entity-parameter-name diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts index 992ee75f7b..539d6b3ff8 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/entity-filter.component.ts @@ -123,6 +123,11 @@ export class EntityFilterComponent implements ControlValueAccessor, OnInit { entityNameFilter: [filter ? filter.entityNameFilter : '', [Validators.required]], }); break; + case AliasFilterType.entityType: + this.filterFormGroup = this.fb.group({ + entityType: [filter ? filter.entityType : null, [Validators.required]] + }); + break; case AliasFilterType.stateEntity: this.filterFormGroup = this.fb.group({ stateEntityParamName: [filter ? filter.stateEntityParamName : null, []], diff --git a/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts b/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts index d3e95cb8a2..6c9c85330a 100644 --- a/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.ts @@ -107,12 +107,15 @@ export class KeyFilterDialogComponent extends key: [this.data.keyFilter.key.key, [Validators.required]] } ), - value: [this.data.keyFilter.value], valueType: [this.data.keyFilter.valueType, [Validators.required]], predicates: [this.data.keyFilter.predicates, [Validators.required]] } ); - + if (this.data.telemetryKeysOnly) { + this.keyFilterFormGroup.addControl( + 'value', this.fb.control(this.data.keyFilter.value) + ); + } if (!this.data.readonly) { this.keyFilterFormGroup.get('valueType').valueChanges.pipe( takeUntil(this.destroy$) @@ -144,12 +147,14 @@ export class KeyFilterDialogComponent extends } else { this.showAutocomplete = false; } - if (type === EntityKeyType.CONSTANT) { - this.keyFilterFormGroup.get('value').setValidators(Validators.required); - this.keyFilterFormGroup.get('value').updateValueAndValidity(); - } else { - this.keyFilterFormGroup.get('value').clearValidators(); - this.keyFilterFormGroup.get('value').updateValueAndValidity(); + if (this.data.telemetryKeysOnly) { + if (type === EntityKeyType.CONSTANT) { + this.keyFilterFormGroup.get('value').setValidators(Validators.required); + this.keyFilterFormGroup.get('value').updateValueAndValidity(); + } else { + this.keyFilterFormGroup.get('value').clearValidators(); + this.keyFilterFormGroup.get('value').updateValueAndValidity(); + } } }); diff --git a/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts b/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts index c9bbf02173..43dbfc45f6 100644 --- a/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts +++ b/ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts @@ -24,7 +24,7 @@ import { NG_VALUE_ACCESSOR } from '@angular/forms'; import { AliasEntityType, EntityType } from '@shared/models/entity-type.models'; -import { EntityTypeFilter } from '@shared/models/relation.models'; +import { RelationEntityTypeFilter } from '@shared/models/relation.models'; import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; @@ -80,7 +80,7 @@ export class RelationFiltersComponent extends PageComponent implements ControlVa this.disabled = isDisabled; } - writeValue(filters: Array): void { + writeValue(filters: Array): void { if (this.valueChangeSubscription) { this.valueChangeSubscription.unsubscribe(); } @@ -102,14 +102,14 @@ export class RelationFiltersComponent extends PageComponent implements ControlVa public addFilter() { const relationFiltersFormArray = this.relationFiltersFormGroup.get('relationFilters') as FormArray; - const filter: EntityTypeFilter = { + const filter: RelationEntityTypeFilter = { relationType: null, entityTypes: [] }; relationFiltersFormArray.push(this.createRelationFilterFormGroup(filter)); } - private createRelationFilterFormGroup(filter: EntityTypeFilter): AbstractControl { + private createRelationFilterFormGroup(filter: RelationEntityTypeFilter): AbstractControl { return this.fb.group({ relationType: [filter ? filter.relationType : null], entityTypes: [filter ? filter.entityTypes : []] @@ -117,7 +117,7 @@ export class RelationFiltersComponent extends PageComponent implements ControlVa } private updateModel() { - const filters: Array = this.relationFiltersFormGroup.get('relationFilters').value; + const filters: Array = this.relationFiltersFormGroup.get('relationFilters').value; this.propagateChange(filters); } } diff --git a/ui-ngx/src/app/shared/models/alias.models.ts b/ui-ngx/src/app/shared/models/alias.models.ts index df80125ae4..5c02089b04 100644 --- a/ui-ngx/src/app/shared/models/alias.models.ts +++ b/ui-ngx/src/app/shared/models/alias.models.ts @@ -16,14 +16,14 @@ import { EntityType } from '@shared/models/entity-type.models'; import { EntityId } from '@shared/models/id/entity-id'; -import { EntitySearchDirection, EntityTypeFilter } from '@shared/models/relation.models'; -import { EntityInfo } from './entity.models'; +import { EntitySearchDirection, RelationEntityTypeFilter } from '@shared/models/relation.models'; import { EntityFilter } from '@shared/models/query/query.models'; export enum AliasFilterType { singleEntity = 'singleEntity', entityList = 'entityList', entityName = 'entityName', + entityType = 'entityType', stateEntity = 'stateEntity', assetType = 'assetType', deviceType = 'deviceType', @@ -40,6 +40,7 @@ export const aliasFilterTypeTranslationMap = new Map( [ AliasFilterType.singleEntity, 'alias.filter-type-single-entity' ], [ AliasFilterType.entityList, 'alias.filter-type-entity-list' ], [ AliasFilterType.entityName, 'alias.filter-type-entity-name' ], + [ AliasFilterType.entityType, 'alias.filter-type-entity-type' ], [ AliasFilterType.stateEntity, 'alias.filter-type-state-entity' ], [ AliasFilterType.assetType, 'alias.filter-type-asset-type' ], [ AliasFilterType.deviceType, 'alias.filter-type-device-type' ], @@ -66,6 +67,10 @@ export interface EntityNameFilter { entityNameFilter?: string; } +export interface EntityTypeFilter { + entityType?: EntityType; +} + export interface StateEntityFilter { stateEntityParamName?: string; defaultStateEntity?: EntityId; @@ -92,7 +97,7 @@ export interface RelationsQueryFilter { defaultStateEntity?: EntityId; rootEntity?: EntityId; direction?: EntitySearchDirection; - filters?: Array; + filters?: Array; maxLevel?: number; fetchLastLevelOnly?: boolean; } @@ -129,6 +134,7 @@ export type EntityFilters = SingleEntityFilter & EntityListFilter & EntityNameFilter & + EntityTypeFilter & StateEntityFilter & AssetTypeFilter & DeviceTypeFilter & diff --git a/ui-ngx/src/app/shared/models/query/query.models.ts b/ui-ngx/src/app/shared/models/query/query.models.ts index dc21f70907..25efe437d7 100644 --- a/ui-ngx/src/app/shared/models/query/query.models.ts +++ b/ui-ngx/src/app/shared/models/query/query.models.ts @@ -351,14 +351,14 @@ export interface KeyFilterPredicateInfo { export interface KeyFilter { key: EntityKey; valueType: EntityKeyValueType; - value: string | number | boolean; + value?: string | number | boolean; predicate: KeyFilterPredicate; } export interface KeyFilterInfo { key: EntityKey; valueType: EntityKeyValueType; - value: string | number | boolean; + value?: string | number | boolean; predicates: Array; } diff --git a/ui-ngx/src/app/shared/models/relation.models.ts b/ui-ngx/src/app/shared/models/relation.models.ts index 2f0f2b456f..c9037a5dab 100644 --- a/ui-ngx/src/app/shared/models/relation.models.ts +++ b/ui-ngx/src/app/shared/models/relation.models.ts @@ -52,7 +52,7 @@ export const directionTypeTranslations = new Map( ] ); -export interface EntityTypeFilter { +export interface RelationEntityTypeFilter { relationType: string; entityTypes: Array; } @@ -68,7 +68,7 @@ export interface RelationsSearchParameters { export interface EntityRelationsQuery { parameters: RelationsSearchParameters; - filters: Array; + filters: Array; } export interface EntitySearchQuery { diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 50fbe58583..7b62f680a8 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -299,6 +299,7 @@ "filter-type-single-entity": "Single entity", "filter-type-entity-list": "Entity list", "filter-type-entity-name": "Entity name", + "filter-type-entity-type": "Entity type", "filter-type-state-entity": "Entity from dashboard state", "filter-type-state-entity-description": "Entity taken from dashboard state parameters", "filter-type-asset-type": "Asset type", From 506151185fc34c4abc3f2c006bb95ca3288f4d9d Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Tue, 2 Mar 2021 16:42:59 +0200 Subject: [PATCH 35/69] added ping for WS --- .../controller/plugin/TbWebSocketHandler.java | 46 ++++++++++++++++++- .../src/main/resources/thingsboard.yml | 1 + 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java index ade9797be0..7c6a2f8c9d 100644 --- a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java +++ b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java @@ -41,16 +41,25 @@ import org.thingsboard.server.service.telemetry.TelemetryWebSocketMsgEndpoint; import org.thingsboard.server.service.telemetry.TelemetryWebSocketService; import org.thingsboard.server.service.telemetry.TelemetryWebSocketSessionRef; -import javax.websocket.*; +import javax.annotation.PreDestroy; +import javax.websocket.RemoteEndpoint; +import javax.websocket.SendHandler; +import javax.websocket.SendResult; +import javax.websocket.Session; import java.io.IOException; import java.net.URI; +import java.nio.ByteBuffer; import java.security.InvalidParameterException; import java.util.Queue; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; @Service @TbCoreComponent @@ -79,6 +88,9 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr @Value("${server.ws.limits.max_updates_per_session:}") private String perSessionUpdatesConfiguration; + @Value("${server.ws.ping_timeout:30000}") + private long pingTimeout; + private ConcurrentMap blacklistedSessions = new ConcurrentHashMap<>(); private ConcurrentMap perSessionUpdateLimits = new ConcurrentHashMap<>(); @@ -87,6 +99,8 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr private ConcurrentMap> regularUserSessionsMap = new ConcurrentHashMap<>(); private ConcurrentMap> publicUserSessionsMap = new ConcurrentHashMap<>(); + private ScheduledExecutorService pingExecutor = Executors.newSingleThreadScheduledExecutor(); + @Override public void handleTextMessage(WebSocketSession session, TextMessage message) { try { @@ -120,6 +134,9 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr return; } internalSessionMap.put(internalSessionId, new SessionMetaData(session, sessionRef, maxMsgQueuePerSession)); + + pingExecutor.scheduleWithFixedDelay(() -> internalSessionMap.get(internalSessionId).sendPing(), 10000, 10000, TimeUnit.MILLISECONDS); + externalSessionMap.put(externalSessionId, internalSessionId); processInWebSocketService(sessionRef, SessionEvent.onEstablished()); log.info("[{}][{}][{}] Session is opened", sessionRef.getSecurityCtx().getTenantId(), externalSessionId, session.getId()); @@ -189,6 +206,8 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr private volatile boolean isSending = false; private final Queue msgQueue; + private final AtomicLong lastActivityTime; + SessionMetaData(WebSocketSession session, TelemetryWebSocketSessionRef sessionRef, int maxMsgQueuePerSession) { super(); this.session = session; @@ -196,12 +215,30 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr this.asyncRemote = nativeSession.getAsyncRemote(); this.sessionRef = sessionRef; this.msgQueue = new LinkedBlockingQueue<>(maxMsgQueuePerSession); + this.lastActivityTime = new AtomicLong(System.currentTimeMillis()); + } + + synchronized void sendPing() { + try { + if (System.currentTimeMillis() - lastActivityTime.get() >= pingTimeout) { + this.asyncRemote.sendPing(ByteBuffer.wrap(new byte[]{})); + lastActivityTime.set(System.currentTimeMillis()); + } + } catch (Exception e) { + log.trace("[{}] Failed to send ping msg", session.getId(), e); + try { + close(this.sessionRef, CloseStatus.SESSION_NOT_RELIABLE); + } catch (IOException ioe) { + log.trace("[{}] Session transport error", session.getId(), ioe); + } + } } synchronized void sendMsg(String msg) { if (isSending) { try { msgQueue.add(msg); + lastActivityTime.set(System.currentTimeMillis()); } catch (RuntimeException e) { if (log.isTraceEnabled()) { log.trace("[{}][{}] Session closed due to queue error", sessionRef.getSecurityCtx().getTenantId(), session.getId(), e); @@ -393,4 +430,11 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr } } + @PreDestroy + private void destroy() { + if (pingExecutor != null) { + pingExecutor.shutdownNow(); + } + } + } \ No newline at end of file diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index 7097acd4dd..f750000750 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -34,6 +34,7 @@ server: log_controller_error_stack_trace: "${HTTP_LOG_CONTROLLER_ERROR_STACK_TRACE:false}" ws: send_timeout: "${TB_SERVER_WS_SEND_TIMEOUT:5000}" + ping_timeout: "${TB_SERVER_WS_PING_TIMEOUT:30000}" limits: # Limit the amount of sessions and subscriptions available on each server. Put values to zero to disable particular limitation max_sessions_per_tenant: "${TB_SERVER_WS_TENANT_RATE_LIMITS_MAX_SESSIONS_PER_TENANT:0}" From debf1e0375ca9bd3116d02b31018e942c14dc1ee Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 3 Mar 2021 11:13:44 +0200 Subject: [PATCH 36/69] Update rule nodes config ui --- .../resources/public/static/rulenode/rulenode-core-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rule-engine/rule-engine-components/src/main/resources/public/static/rulenode/rulenode-core-config.js b/rule-engine/rule-engine-components/src/main/resources/public/static/rulenode/rulenode-core-config.js index cc60f46df2..4eea9d1764 100644 --- a/rule-engine/rule-engine-components/src/main/resources/public/static/rulenode/rulenode-core-config.js +++ b/rule-engine/rule-engine-components/src/main/resources/public/static/rulenode/rulenode-core-config.js @@ -12,5 +12,5 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */var y=function(e,t){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function h(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function C(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}Object.create;var F,x=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.emptyConfigForm},r.prototype.onConfigurationSet=function(e){this.emptyConfigForm=this.fb.group({})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-node-empty-config",template:"
"}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),T=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.attributeScopes=Object.keys(a.AttributeScope),n.telemetryTypeTranslationsMap=a.telemetryTypeTranslations,n}return b(r,e),r.prototype.configForm=function(){return this.attributesConfigForm},r.prototype.onConfigurationSet=function(e){this.attributesConfigForm=this.fb.group({scope:[e?e.scope:null,[i.Validators.required]],notifyDevice:[!e||e.scope,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-attributes-config",template:'
\n \n attribute.attributes-scope\n \n \n {{ telemetryTypeTranslationsMap.get(scope) | translate }}\n \n \n \n
\n \n {{ \'tb.rulenode.notify-device\' | translate }}\n \n
tb.rulenode.notify-device-hint
\n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),q=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.timeseriesConfigForm},r.prototype.onConfigurationSet=function(e){this.timeseriesConfigForm=this.fb.group({defaultTTL:[e?e.defaultTTL:null,[i.Validators.required,i.Validators.min(0)]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-timeseries-config",template:'
\n \n tb.rulenode.default-ttl\n \n \n {{ \'tb.rulenode.default-ttl-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-default-ttl-message\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),S=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.rpcRequestConfigForm},r.prototype.onConfigurationSet=function(e){this.rpcRequestConfigForm=this.fb.group({timeoutInSeconds:[e?e.timeoutInSeconds:null,[i.Validators.required,i.Validators.min(0)]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rpc-request-config",template:'
\n \n tb.rulenode.timeout-sec\n \n \n {{ \'tb.rulenode.timeout-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-timeout-message\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),I=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.logConfigForm},r.prototype.onConfigurationSet=function(e){this.logConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.logConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"string",this.translate.instant("tb.rulenode.to-string"),"ToString",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.logConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-log-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),k=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.assignCustomerConfigForm},r.prototype.onConfigurationSet=function(e){this.assignCustomerConfigForm=this.fb.group({customerNamePattern:[e?e.customerNamePattern:null,[i.Validators.required]],createCustomerIfNotExists:[!!e&&e.createCustomerIfNotExists,[]],customerCacheExpiration:[e?e.customerCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-assign-to-customer-config",template:'
\n \n tb.rulenode.customer-name-pattern\n \n \n {{ \'tb.rulenode.customer-name-pattern-required\' | translate }}\n \n \n \n \n {{ \'tb.rulenode.create-customer-if-not-exists\' | translate }}\n \n \n tb.rulenode.customer-cache-expiration\n \n \n {{ \'tb.rulenode.customer-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.customer-cache-expiration-range\' | translate }}\n \n tb.rulenode.customer-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),N=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.clearAlarmConfigForm},r.prototype.onConfigurationSet=function(e){this.clearAlarmConfigForm=this.fb.group({alarmDetailsBuildJs:[e?e.alarmDetailsBuildJs:null,[i.Validators.required]],alarmType:[e?e.alarmType:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.clearAlarmConfigForm.get("alarmDetailsBuildJs").value;this.nodeScriptTestService.testNodeScript(t,"json",this.translate.instant("tb.rulenode.details"),"Details",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.clearAlarmConfigForm.get("alarmDetailsBuildJs").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-clear-alarm-config",template:'
\n \n \n \n
\n \n
\n \n tb.rulenode.alarm-type\n \n \n {{ \'tb.rulenode.alarm-type-required\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),V=function(e){function r(t,r,n,o){var i=e.call(this,t)||this;return i.store=t,i.fb=r,i.nodeScriptTestService=n,i.translate=o,i.alarmSeverities=Object.keys(a.AlarmSeverity),i.alarmSeverityTranslationMap=a.alarmSeverityTranslations,i.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],i}return b(r,e),r.prototype.configForm=function(){return this.createAlarmConfigForm},r.prototype.onConfigurationSet=function(e){this.createAlarmConfigForm=this.fb.group({alarmDetailsBuildJs:[e?e.alarmDetailsBuildJs:null,[i.Validators.required]],useMessageAlarmData:[!!e&&e.useMessageAlarmData,[]],alarmType:[e?e.alarmType:null,[]],severity:[e?e.severity:null,[]],propagate:[!!e&&e.propagate,[]],relationTypes:[e?e.relationTypes:null,[]]})},r.prototype.validatorTriggers=function(){return["useMessageAlarmData"]},r.prototype.updateValidators=function(e){this.createAlarmConfigForm.get("useMessageAlarmData").value?(this.createAlarmConfigForm.get("alarmType").setValidators([]),this.createAlarmConfigForm.get("severity").setValidators([])):(this.createAlarmConfigForm.get("alarmType").setValidators([i.Validators.required]),this.createAlarmConfigForm.get("severity").setValidators([i.Validators.required])),this.createAlarmConfigForm.get("alarmType").updateValueAndValidity({emitEvent:e}),this.createAlarmConfigForm.get("severity").updateValueAndValidity({emitEvent:e})},r.prototype.testScript=function(){var e=this,t=this.createAlarmConfigForm.get("alarmDetailsBuildJs").value;this.nodeScriptTestService.testNodeScript(t,"json",this.translate.instant("tb.rulenode.details"),"Details",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.createAlarmConfigForm.get("alarmDetailsBuildJs").setValue(t)}))},r.prototype.removeKey=function(e,t){var r=this.createAlarmConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.createAlarmConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.createAlarmConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.createAlarmConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-create-alarm-config",template:'
\n \n \n \n
\n \n
\n \n {{ \'tb.rulenode.use-message-alarm-data\' | translate }}\n \n
\n
\n \n tb.rulenode.alarm-type\n \n \n {{ \'tb.rulenode.alarm-type-required\' | translate }}\n \n \n \n \n tb.rulenode.alarm-severity\n \n \n {{ alarmSeverityTranslationMap.get(severity) | translate }}\n \n \n \n {{ \'tb.rulenode.alarm-severity-required\' | translate }}\n \n \n
\n \n {{ \'tb.rulenode.propagate\' | translate }}\n \n
\n \n tb.rulenode.relation-types-list\n \n \n {{key}}\n close\n \n \n \n tb.rulenode.relation-types-list-hint\n \n
\n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),E=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.entityType=a.EntityType,n}return b(r,e),r.prototype.configForm=function(){return this.createRelationConfigForm},r.prototype.onConfigurationSet=function(e){this.createRelationConfigForm=this.fb.group({direction:[e?e.direction:null,[i.Validators.required]],entityType:[e?e.entityType:null,[i.Validators.required]],entityNamePattern:[e?e.entityNamePattern:null,[]],entityTypePattern:[e?e.entityTypePattern:null,[]],relationType:[e?e.relationType:null,[i.Validators.required]],createEntityIfNotExists:[!!e&&e.createEntityIfNotExists,[]],removeCurrentRelations:[!!e&&e.removeCurrentRelations,[]],changeOriginatorToRelatedEntity:[!!e&&e.changeOriginatorToRelatedEntity,[]],entityCacheExpiration:[e?e.entityCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.prototype.validatorTriggers=function(){return["entityType"]},r.prototype.updateValidators=function(e){var t=this.createRelationConfigForm.get("entityType").value;t?this.createRelationConfigForm.get("entityNamePattern").setValidators([i.Validators.required]):this.createRelationConfigForm.get("entityNamePattern").setValidators([]),!t||t!==a.EntityType.DEVICE&&t!==a.EntityType.ASSET?this.createRelationConfigForm.get("entityTypePattern").setValidators([]):this.createRelationConfigForm.get("entityTypePattern").setValidators([i.Validators.required]),this.createRelationConfigForm.get("entityNamePattern").updateValueAndValidity({emitEvent:e}),this.createRelationConfigForm.get("entityTypePattern").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-create-relation-config",template:'
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n
\n \n \n \n tb.rulenode.entity-name-pattern\n \n \n {{ \'tb.rulenode.entity-name-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.entity-type-pattern\n \n \n {{ \'tb.rulenode.entity-type-pattern-required\' | translate }}\n \n \n \n
\n \n tb.rulenode.relation-type-pattern\n \n \n {{ \'tb.rulenode.relation-type-pattern-required\' | translate }}\n \n \n \n
\n \n {{ \'tb.rulenode.create-entity-if-not-exists\' | translate }}\n \n
tb.rulenode.create-entity-if-not-exists-hint
\n
\n \n {{ \'tb.rulenode.remove-current-relations\' | translate }}\n \n
tb.rulenode.remove-current-relations-hint
\n \n {{ \'tb.rulenode.change-originator-to-related-entity\' | translate }}\n \n
tb.rulenode.change-originator-to-related-entity-hint
\n \n tb.rulenode.entity-cache-expiration\n \n \n {{ \'tb.rulenode.entity-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.entity-cache-expiration-range\' | translate }}\n \n tb.rulenode.entity-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),A=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.msgDelayConfigForm},r.prototype.onConfigurationSet=function(e){this.msgDelayConfigForm=this.fb.group({useMetadataPeriodInSecondsPatterns:[!!e&&e.useMetadataPeriodInSecondsPatterns,[]],periodInSeconds:[e?e.periodInSeconds:null,[]],periodInSecondsPattern:[e?e.periodInSecondsPattern:null,[]],maxPendingMsgs:[e?e.maxPendingMsgs:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(1e5)]]})},r.prototype.validatorTriggers=function(){return["useMetadataPeriodInSecondsPatterns"]},r.prototype.updateValidators=function(e){this.msgDelayConfigForm.get("useMetadataPeriodInSecondsPatterns").value?(this.msgDelayConfigForm.get("periodInSecondsPattern").setValidators([i.Validators.required]),this.msgDelayConfigForm.get("periodInSeconds").setValidators([])):(this.msgDelayConfigForm.get("periodInSecondsPattern").setValidators([]),this.msgDelayConfigForm.get("periodInSeconds").setValidators([i.Validators.required,i.Validators.min(0)])),this.msgDelayConfigForm.get("periodInSecondsPattern").updateValueAndValidity({emitEvent:e}),this.msgDelayConfigForm.get("periodInSeconds").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-msg-delay-config",template:'
\n \n {{ \'tb.rulenode.use-metadata-period-in-seconds-patterns\' | translate }}\n \n
tb.rulenode.use-metadata-period-in-seconds-patterns-hint
\n \n tb.rulenode.period-seconds\n \n \n {{ \'tb.rulenode.period-seconds-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-period-0-seconds-message\' | translate }}\n \n \n \n \n tb.rulenode.period-in-seconds-pattern\n \n \n {{ \'tb.rulenode.period-in-seconds-pattern-required\' | translate }}\n \n \n \n \n \n tb.rulenode.max-pending-messages\n \n \n {{ \'tb.rulenode.max-pending-messages-required\' | translate }}\n \n \n {{ \'tb.rulenode.max-pending-messages-range\' | translate }}\n \n \n {{ \'tb.rulenode.max-pending-messages-range\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),L=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.entityType=a.EntityType,n}return b(r,e),r.prototype.configForm=function(){return this.deleteRelationConfigForm},r.prototype.onConfigurationSet=function(e){this.deleteRelationConfigForm=this.fb.group({deleteForSingleEntity:[!!e&&e.deleteForSingleEntity,[]],direction:[e?e.direction:null,[i.Validators.required]],entityType:[e?e.entityType:null,[]],entityNamePattern:[e?e.entityNamePattern:null,[]],relationType:[e?e.relationType:null,[i.Validators.required]],entityCacheExpiration:[e?e.entityCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.prototype.validatorTriggers=function(){return["deleteForSingleEntity","entityType"]},r.prototype.updateValidators=function(e){var t=this.deleteRelationConfigForm.get("deleteForSingleEntity").value,r=this.deleteRelationConfigForm.get("entityType").value;t?this.deleteRelationConfigForm.get("entityType").setValidators([i.Validators.required]):this.deleteRelationConfigForm.get("entityType").setValidators([]),t&&r?this.deleteRelationConfigForm.get("entityNamePattern").setValidators([i.Validators.required]):this.deleteRelationConfigForm.get("entityNamePattern").setValidators([]),this.deleteRelationConfigForm.get("entityType").updateValueAndValidity({emitEvent:!1}),this.deleteRelationConfigForm.get("entityNamePattern").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-delete-relation-config",template:'
\n \n {{ \'tb.rulenode.delete-relation-to-specific-entity\' | translate }}\n \n
tb.rulenode.delete-relation-hint
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n
\n \n \n \n tb.rulenode.entity-name-pattern\n \n \n {{ \'tb.rulenode.entity-name-pattern-required\' | translate }}\n \n \n \n
\n \n tb.rulenode.relation-type-pattern\n \n \n {{ \'tb.rulenode.relation-type-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.entity-cache-expiration\n \n \n {{ \'tb.rulenode.entity-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.entity-cache-expiration-range\' | translate }}\n \n tb.rulenode.entity-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),P=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.generatorConfigForm},r.prototype.onConfigurationSet=function(e){this.generatorConfigForm=this.fb.group({msgCount:[e?e.msgCount:null,[i.Validators.required,i.Validators.min(0)]],periodInSeconds:[e?e.periodInSeconds:null,[i.Validators.required,i.Validators.min(1)]],originator:[e?e.originator:null,[]],jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.prepareInputConfig=function(e){return e&&(e.originatorId&&e.originatorType?e.originator={id:e.originatorId,entityType:e.originatorType}:e.originator=null,delete e.originatorId,delete e.originatorType),e},r.prototype.prepareOutputConfig=function(e){return e.originator?(e.originatorId=e.originator.id,e.originatorType=e.originator.entityType):(e.originatorId=null,e.originatorType=null),delete e.originator,e},r.prototype.testScript=function(){var e=this,t=this.generatorConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"generate",this.translate.instant("tb.rulenode.generator"),"Generate",["prevMsg","prevMetadata","prevMsgType"],this.ruleNodeId).subscribe((function(t){t&&e.generatorConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-generator-config",template:'
\n \n tb.rulenode.message-count\n \n \n {{ \'tb.rulenode.message-count-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-message-count-message\' | translate }}\n \n \n \n tb.rulenode.period-seconds\n \n \n {{ \'tb.rulenode.period-seconds-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-period-seconds-message\' | translate }}\n \n \n
\n \n \n \n
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent);!function(e){e.CUSTOMER="CUSTOMER",e.TENANT="TENANT",e.RELATED="RELATED",e.ALARM_ORIGINATOR="ALARM_ORIGINATOR"}(F||(F={}));var M,w=new Map([[F.CUSTOMER,"tb.rulenode.originator-customer"],[F.TENANT,"tb.rulenode.originator-tenant"],[F.RELATED,"tb.rulenode.originator-related"],[F.ALARM_ORIGINATOR,"tb.rulenode.originator-alarm-originator"]]);!function(e){e.CIRCLE="CIRCLE",e.POLYGON="POLYGON"}(M||(M={}));var R,D=new Map([[M.CIRCLE,"tb.rulenode.perimeter-circle"],[M.POLYGON,"tb.rulenode.perimeter-polygon"]]);!function(e){e.MILLISECONDS="MILLISECONDS",e.SECONDS="SECONDS",e.MINUTES="MINUTES",e.HOURS="HOURS",e.DAYS="DAYS"}(R||(R={}));var O,K=new Map([[R.MILLISECONDS,"tb.rulenode.time-unit-milliseconds"],[R.SECONDS,"tb.rulenode.time-unit-seconds"],[R.MINUTES,"tb.rulenode.time-unit-minutes"],[R.HOURS,"tb.rulenode.time-unit-hours"],[R.DAYS,"tb.rulenode.time-unit-days"]]);!function(e){e.METER="METER",e.KILOMETER="KILOMETER",e.FOOT="FOOT",e.MILE="MILE",e.NAUTICAL_MILE="NAUTICAL_MILE"}(O||(O={}));var B,G=new Map([[O.METER,"tb.rulenode.range-unit-meter"],[O.KILOMETER,"tb.rulenode.range-unit-kilometer"],[O.FOOT,"tb.rulenode.range-unit-foot"],[O.MILE,"tb.rulenode.range-unit-mile"],[O.NAUTICAL_MILE,"tb.rulenode.range-unit-nautical-mile"]]);!function(e){e.TITLE="TITLE",e.COUNTRY="COUNTRY",e.STATE="STATE",e.ZIP="ZIP",e.ADDRESS="ADDRESS",e.ADDRESS2="ADDRESS2",e.PHONE="PHONE",e.EMAIL="EMAIL",e.ADDITIONAL_INFO="ADDITIONAL_INFO"}(B||(B={}));var H,U,j,z=new Map([[B.TITLE,"tb.rulenode.entity-details-title"],[B.COUNTRY,"tb.rulenode.entity-details-country"],[B.STATE,"tb.rulenode.entity-details-state"],[B.ZIP,"tb.rulenode.entity-details-zip"],[B.ADDRESS,"tb.rulenode.entity-details-address"],[B.ADDRESS2,"tb.rulenode.entity-details-address2"],[B.PHONE,"tb.rulenode.entity-details-phone"],[B.EMAIL,"tb.rulenode.entity-details-email"],[B.ADDITIONAL_INFO,"tb.rulenode.entity-details-additional_info"]]);!function(e){e.FIRST="FIRST",e.LAST="LAST",e.ALL="ALL"}(H||(H={})),function(e){e.ASC="ASC",e.DESC="DESC"}(U||(U={})),function(e){e.STANDARD="STANDARD",e.FIFO="FIFO"}(j||(j={}));var Q,_=new Map([[j.STANDARD,"tb.rulenode.sqs-queue-standard"],[j.FIFO,"tb.rulenode.sqs-queue-fifo"]]),$=["anonymous","basic","cert.PEM"],W=new Map([["anonymous","tb.rulenode.credentials-anonymous"],["basic","tb.rulenode.credentials-basic"],["cert.PEM","tb.rulenode.credentials-pem"]]),J=["sas","cert.PEM"],Y=new Map([["sas","tb.rulenode.credentials-sas"],["cert.PEM","tb.rulenode.credentials-pem"]]);!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(Q||(Q={}));var Z=["US-ASCII","ISO-8859-1","UTF-8","UTF-16BE","UTF-16LE","UTF-16"],X=new Map([["US-ASCII","tb.rulenode.charset-us-ascii"],["ISO-8859-1","tb.rulenode.charset-iso-8859-1"],["UTF-8","tb.rulenode.charset-utf-8"],["UTF-16BE","tb.rulenode.charset-utf-16be"],["UTF-16LE","tb.rulenode.charset-utf-16le"],["UTF-16","tb.rulenode.charset-utf-16"]]),ee=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.perimeterType=M,n.perimeterTypes=Object.keys(M),n.perimeterTypeTranslationMap=D,n.rangeUnits=Object.keys(O),n.rangeUnitTranslationMap=G,n.timeUnits=Object.keys(R),n.timeUnitsTranslationMap=K,n}return b(r,e),r.prototype.configForm=function(){return this.geoActionConfigForm},r.prototype.onConfigurationSet=function(e){this.geoActionConfigForm=this.fb.group({latitudeKeyName:[e?e.latitudeKeyName:null,[i.Validators.required]],longitudeKeyName:[e?e.longitudeKeyName:null,[i.Validators.required]],fetchPerimeterInfoFromMessageMetadata:[!!e&&e.fetchPerimeterInfoFromMessageMetadata,[]],perimeterType:[e?e.perimeterType:null,[]],centerLatitude:[e?e.centerLatitude:null,[]],centerLongitude:[e?e.centerLatitude:null,[]],range:[e?e.range:null,[]],rangeUnit:[e?e.rangeUnit:null,[]],polygonsDefinition:[e?e.polygonsDefinition:null,[]],minInsideDuration:[e?e.minInsideDuration:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]],minInsideDurationTimeUnit:[e?e.minInsideDurationTimeUnit:null,[i.Validators.required]],minOutsideDuration:[e?e.minOutsideDuration:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]],minOutsideDurationTimeUnit:[e?e.minOutsideDurationTimeUnit:null,[i.Validators.required]]})},r.prototype.validatorTriggers=function(){return["fetchPerimeterInfoFromMessageMetadata","perimeterType"]},r.prototype.updateValidators=function(e){var t=this.geoActionConfigForm.get("fetchPerimeterInfoFromMessageMetadata").value,r=this.geoActionConfigForm.get("perimeterType").value;t?this.geoActionConfigForm.get("perimeterType").setValidators([]):this.geoActionConfigForm.get("perimeterType").setValidators([i.Validators.required]),t||r!==M.CIRCLE?(this.geoActionConfigForm.get("centerLatitude").setValidators([]),this.geoActionConfigForm.get("centerLongitude").setValidators([]),this.geoActionConfigForm.get("range").setValidators([]),this.geoActionConfigForm.get("rangeUnit").setValidators([])):(this.geoActionConfigForm.get("centerLatitude").setValidators([i.Validators.required,i.Validators.min(-90),i.Validators.max(90)]),this.geoActionConfigForm.get("centerLongitude").setValidators([i.Validators.required,i.Validators.min(-180),i.Validators.max(180)]),this.geoActionConfigForm.get("range").setValidators([i.Validators.required,i.Validators.min(0)]),this.geoActionConfigForm.get("rangeUnit").setValidators([i.Validators.required])),t||r!==M.POLYGON?this.geoActionConfigForm.get("polygonsDefinition").setValidators([]):this.geoActionConfigForm.get("polygonsDefinition").setValidators([i.Validators.required]),this.geoActionConfigForm.get("perimeterType").updateValueAndValidity({emitEvent:!1}),this.geoActionConfigForm.get("centerLatitude").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("centerLongitude").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("range").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("rangeUnit").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("polygonsDefinition").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-gps-geofencing-config",template:'
\n \n tb.rulenode.latitude-key-name\n \n \n {{ \'tb.rulenode.latitude-key-name-required\' | translate }}\n \n \n \n tb.rulenode.longitude-key-name\n \n \n {{ \'tb.rulenode.longitude-key-name-required\' | translate }}\n \n \n \n {{ \'tb.rulenode.fetch-perimeter-info-from-message-metadata\' | translate }}\n \n
\n \n tb.rulenode.perimeter-type\n \n \n {{ perimeterTypeTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n \n tb.rulenode.circle-center-latitude\n \n \n {{ \'tb.rulenode.circle-center-latitude-required\' | translate }}\n \n \n \n tb.rulenode.circle-center-longitude\n \n \n {{ \'tb.rulenode.circle-center-longitude-required\' | translate }}\n \n \n
\n
\n \n tb.rulenode.range\n \n \n {{ \'tb.rulenode.range-required\' | translate }}\n \n \n \n tb.rulenode.range-units\n \n \n {{ rangeUnitTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n \n tb.rulenode.polygon-definition\n \n \n {{ \'tb.rulenode.polygon-definition-required\' | translate }}\n \n \n
\n
\n \n tb.rulenode.min-inside-duration\n \n \n {{ \'tb.rulenode.min-inside-duration-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.min-inside-duration-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n \n tb.rulenode.min-outside-duration\n \n \n {{ \'tb.rulenode.min-outside-duration-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.min-outside-duration-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),te=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.msgCountConfigForm},r.prototype.onConfigurationSet=function(e){this.msgCountConfigForm=this.fb.group({interval:[e?e.interval:null,[i.Validators.required,i.Validators.min(1)]],telemetryPrefix:[e?e.telemetryPrefix:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-msg-count-config",template:'
\n \n tb.rulenode.interval-seconds\n \n \n {{ \'tb.rulenode.interval-seconds-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-interval-seconds-message\' | translate }}\n \n \n \n tb.rulenode.output-timeseries-key-prefix\n \n \n {{ \'tb.rulenode.output-timeseries-key-prefix-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),re=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.rpcReplyConfigForm},r.prototype.onConfigurationSet=function(e){this.rpcReplyConfigForm=this.fb.group({requestIdMetaDataAttribute:[e?e.requestIdMetaDataAttribute:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rpc-reply-config",template:'
\n \n tb.rulenode.request-id-metadata-attribute\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ne=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.saveToCustomTableConfigForm},r.prototype.onConfigurationSet=function(e){this.saveToCustomTableConfigForm=this.fb.group({tableName:[e?e.tableName:null,[i.Validators.required]],fieldsMapping:[e?e.fieldsMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-custom-table-config",template:'
\n \n tb.rulenode.custom-table-name\n \n \n {{ \'tb.rulenode.custom-table-name-required\' | translate }}\n \n tb.rulenode.custom-table-hint\n \n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ae=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.translate=r,o.injector=n,o.fb=a,o.propagateChange=null,o.valueChangeSubscription=null,o}var a;return b(r,e),a=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){this.ngControl=this.injector.get(i.NgControl),null!=this.ngControl&&(this.ngControl.valueAccessor=this),this.kvListFormGroup=this.fb.group({}),this.kvListFormGroup.addControl("keyVals",this.fb.array([]))},r.prototype.keyValsFormArray=function(){return this.kvListFormGroup.get("keyVals")},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.kvListFormGroup.disable({emitEvent:!1}):this.kvListFormGroup.enable({emitEvent:!1})},r.prototype.writeValue=function(e){var t,r,n=this;this.valueChangeSubscription&&this.valueChangeSubscription.unsubscribe();var a=[];if(e)try{for(var o=v(Object.keys(e)),l=o.next();!l.done;l=o.next()){var s=l.value;Object.prototype.hasOwnProperty.call(e,s)&&a.push(this.fb.group({key:[s,[i.Validators.required]],value:[e[s],[i.Validators.required]]}))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this.kvListFormGroup.setControl("keyVals",this.fb.array(a)),this.valueChangeSubscription=this.kvListFormGroup.valueChanges.subscribe((function(){n.updateModel()}))},r.prototype.removeKeyVal=function(e){this.kvListFormGroup.get("keyVals").removeAt(e)},r.prototype.addKeyVal=function(){this.kvListFormGroup.get("keyVals").push(this.fb.group({key:["",[i.Validators.required]],value:["",[i.Validators.required]]}))},r.prototype.validate=function(e){return!this.kvListFormGroup.get("keyVals").value.length&&this.required?{kvMapRequired:!0}:this.kvListFormGroup.valid?null:{kvFieldsRequired:!0}},r.prototype.updateModel=function(){var e=this.kvListFormGroup.get("keyVals").value;if(this.required&&!e.length||!this.kvListFormGroup.valid)this.propagateChange(null);else{var t={};e.forEach((function(e){t[e.key]=e.value})),this.propagateChange(t)}},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:t.Injector},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.Input(),C("design:type",String)],r.prototype,"requiredText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"keyText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"keyRequiredText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"valText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"valRequiredText",void 0),h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),r=a=h([t.Component({selector:"tb-kv-map-config",template:'
\n
\n {{ keyText | translate }}\n {{ valText | translate }}\n \n
\n
\n
\n \n \n \n \n {{ keyRequiredText | translate }}\n \n \n \n \n \n \n {{ valRequiredText | translate }}\n \n \n \n
\n
\n \n
\n \n
\n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return a})),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef((function(){return a})),multi:!0}],styles:[":host .tb-kv-map-config{margin-bottom:16px}:host .tb-kv-map-config .header{padding-left:5px;padding-right:5px;padding-bottom:5px}:host .tb-kv-map-config .header .cell{padding-left:5px;padding-right:5px;color:rgba(0,0,0,.54);font-size:12px;font-weight:700;white-space:nowrap}:host .tb-kv-map-config .body{padding-left:5px;padding-right:5px;padding-bottom:20px;max-height:300px;overflow:auto}:host .tb-kv-map-config .body .row{padding-top:5px;max-height:40px}:host .tb-kv-map-config .body .cell{padding-left:5px;padding-right:5px}:host ::ng-deep .tb-kv-map-config .body mat-form-field.cell{margin:0;max-height:40px}:host ::ng-deep .tb-kv-map-config .body mat-form-field.cell .mat-form-field-infix{border-top:0}:host ::ng-deep .tb-kv-map-config .body button.mat-button{margin:0}"]}),C("design:paramtypes",[o.Store,n.TranslateService,t.Injector,i.FormBuilder])],r)}(a.PageComponent),oe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.entityType=a.EntityType,n.propagateChange=null,n}var n;return b(r,e),n=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){var e=this;this.deviceRelationsQueryFormGroup=this.fb.group({fetchLastLevelOnly:[!1,[]],direction:[null,[i.Validators.required]],maxLevel:[null,[]],relationType:[null],deviceTypes:[null,[i.Validators.required]]}),this.deviceRelationsQueryFormGroup.valueChanges.subscribe((function(t){e.deviceRelationsQueryFormGroup.valid?e.propagateChange(t):e.propagateChange(null)}))},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.deviceRelationsQueryFormGroup.disable({emitEvent:!1}):this.deviceRelationsQueryFormGroup.enable({emitEvent:!1})},r.prototype.writeValue=function(e){this.deviceRelationsQueryFormGroup.reset(e,{emitEvent:!1})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),r=n=h([t.Component({selector:"tb-device-relations-query-config",template:'
\n \n {{ \'alias.last-level-relation\' | translate }}\n \n
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n \n tb.rulenode.max-relation-level\n \n \n
\n
relation.relation-type
\n \n \n
device.device-types
\n \n \n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return n})),multi:!0}]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.PageComponent),ie=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.propagateChange=null,n}var n;return b(r,e),n=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){var e=this;this.relationsQueryFormGroup=this.fb.group({fetchLastLevelOnly:[!1,[]],direction:[null,[i.Validators.required]],maxLevel:[null,[]],filters:[null]}),this.relationsQueryFormGroup.valueChanges.subscribe((function(t){e.relationsQueryFormGroup.valid?e.propagateChange(t):e.propagateChange(null)}))},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.relationsQueryFormGroup.disable({emitEvent:!1}):this.relationsQueryFormGroup.enable({emitEvent:!1})},r.prototype.writeValue=function(e){this.relationsQueryFormGroup.reset(e||{},{emitEvent:!1})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),r=n=h([t.Component({selector:"tb-relations-query-config",template:'
\n \n {{ \'alias.last-level-relation\' | translate }}\n \n
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n \n tb.rulenode.max-relation-level\n \n \n
\n
relation.relation-filters
\n \n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return n})),multi:!0}]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.PageComponent),le=function(e){function r(t,r,n,o){var i,l,s=e.call(this,t)||this;s.store=t,s.translate=r,s.truncate=n,s.fb=o,s.placeholder="tb.rulenode.message-type",s.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],s.messageTypes=[],s.messageTypesList=[],s.searchText="",s.propagateChange=function(e){},s.messageTypeConfigForm=s.fb.group({messageType:[null]});try{for(var u=v(Object.keys(a.MessageType)),d=u.next();!d.done;d=u.next()){var p=d.value;s.messageTypesList.push({name:a.messageTypeNames.get(a.MessageType[p]),value:p})}}catch(e){i={error:e}}finally{try{d&&!d.done&&(l=u.return)&&l.call(u)}finally{if(i)throw i.error}}return s}var l;return b(r,e),l=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.ngOnInit=function(){var e=this;this.filteredMessageTypes=this.messageTypeConfigForm.get("messageType").valueChanges.pipe(f.startWith(""),f.map((function(e){return e||""})),f.mergeMap((function(t){return e.fetchMessageTypes(t)})),f.share())},r.prototype.ngAfterViewInit=function(){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.messageTypeConfigForm.disable({emitEvent:!1}):this.messageTypeConfigForm.enable({emitEvent:!1})},r.prototype.writeValue=function(e){var t=this;this.searchText="",this.messageTypes.length=0,e&&e.forEach((function(e){var r=t.messageTypesList.find((function(t){return t.value===e}));r?t.messageTypes.push({name:r.name,value:r.value}):t.messageTypes.push({name:e,value:e})}))},r.prototype.displayMessageTypeFn=function(e){return e?e.name:void 0},r.prototype.textIsNotEmpty=function(e){return!!(e&&null!=e&&e.length>0)},r.prototype.createMessageType=function(e,t){e.preventDefault(),this.transformMessageType(t)},r.prototype.add=function(e){this.transformMessageType(e.value)},r.prototype.fetchMessageTypes=function(e){if(this.searchText=e,this.searchText&&this.searchText.length){var t=this.searchText.toUpperCase();return c.of(this.messageTypesList.filter((function(e){return e.name.toUpperCase().includes(t)})))}return c.of(this.messageTypesList)},r.prototype.transformMessageType=function(e){if((e||"").trim()){var t=null,r=e.trim(),n=this.messageTypesList.find((function(e){return e.name===r}));(t=n?{name:n.name,value:n.value}:{name:r,value:r})&&this.addMessageType(t)}this.clear("")},r.prototype.remove=function(e){var t=this.messageTypes.indexOf(e);t>=0&&(this.messageTypes.splice(t,1),this.updateModel())},r.prototype.selected=function(e){this.addMessageType(e.option.value),this.clear("")},r.prototype.addMessageType=function(e){-1===this.messageTypes.findIndex((function(t){return t.value===e.value}))&&(this.messageTypes.push(e),this.updateModel())},r.prototype.onFocus=function(){this.messageTypeConfigForm.get("messageType").updateValueAndValidity({onlySelf:!0,emitEvent:!0})},r.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this.messageTypeInput.nativeElement.value=e,this.messageTypeConfigForm.get("messageType").patchValue(null,{emitEvent:!0}),setTimeout((function(){t.messageTypeInput.nativeElement.blur(),t.messageTypeInput.nativeElement.focus()}),0)},r.prototype.updateModel=function(){var e=this.messageTypes.map((function(e){return e.value}));this.required?(this.chipList.errorState=!e.length,this.propagateChange(e.length>0?e:null)):(this.chipList.errorState=!1,this.propagateChange(e))},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:a.TruncatePipe},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),h([t.Input(),C("design:type",String)],r.prototype,"label",void 0),h([t.Input(),C("design:type",Object)],r.prototype,"placeholder",void 0),h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.ViewChild("chipList",{static:!1}),C("design:type",d.MatChipList)],r.prototype,"chipList",void 0),h([t.ViewChild("messageTypeAutocomplete",{static:!1}),C("design:type",p.MatAutocomplete)],r.prototype,"matAutocomplete",void 0),h([t.ViewChild("messageTypeInput",{static:!1}),C("design:type",t.ElementRef)],r.prototype,"messageTypeInput",void 0),r=l=h([t.Component({selector:"tb-message-types-config",template:'\n {{ label }}\n \n \n {{messageType.name}}\n close\n \n \n \n \n \n \n \n \n
\n
\n tb.rulenode.no-message-types-found\n
\n \n \n {{ translate.get(\'tb.rulenode.no-message-type-matching\',\n {messageType: truncate.transform(searchText, true, 6, '...')}) | async }}\n \n \n \n tb.rulenode.create-new-message-type\n \n
\n
\n
\n \n {{ \'tb.rulenode.message-types-required\' | translate }}\n \n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return l})),multi:!0}]}),C("design:paramtypes",[o.Store,n.TranslateService,a.TruncatePipe,i.FormBuilder])],r)}(a.PageComponent),se=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.subscriptions=[],n.disableCertPemCredentials=!1,n.allCredentialsTypes=$,n.credentialsTypeTranslationsMap=W,n.propagateChange=null,n}var n;return b(r,e),n=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){var e=this;this.credentialsConfigFormGroup=this.fb.group({type:[null,[i.Validators.required]],username:[null,[]],password:[null,[]],caCert:[null,[]],caCertFileName:[null,[]],privateKey:[null,[]],privateKeyFileName:[null,[]],cert:[null,[]],certFileName:[null,[]]}),this.subscriptions.push(this.credentialsConfigFormGroup.valueChanges.pipe(f.distinctUntilChanged()).subscribe((function(){e.updateView()}))),this.subscriptions.push(this.credentialsConfigFormGroup.get("type").valueChanges.subscribe((function(){e.credentialsTypeChanged()})))},r.prototype.ngOnChanges=function(e){var t,r,n=this;try{for(var a=v(Object.keys(e)),o=a.next();!o.done;o=a.next()){var i=o.value,l=e[i];if(!l.firstChange&&l.currentValue!==l.previousValue)if(l.currentValue&&"disableCertPemCredentials"===i)"cert.PEM"===this.credentialsConfigFormGroup.get("type").value&&setTimeout((function(){n.credentialsConfigFormGroup.get("type").patchValue("anonymous",{emitEvent:!0})}))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},r.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(e){return e.unsubscribe()}))},r.prototype.writeValue=function(e){s.isDefinedAndNotNull(e)&&(this.credentialsConfigFormGroup.reset(e,{emitEvent:!1}),this.updateValidators(!1))},r.prototype.setDisabledState=function(e){e?this.credentialsConfigFormGroup.disable():(this.credentialsConfigFormGroup.enable(),this.updateValidators())},r.prototype.updateView=function(){var e=this.credentialsConfigFormGroup.value,t=e.type;switch(t){case"anonymous":e={type:t};break;case"basic":e={type:t,username:e.username,password:e.password};break;case"cert.PEM":delete e.username}this.propagateChange(e)},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.validate=function(e){return this.credentialsConfigFormGroup.valid?null:{credentialsConfig:{valid:!1}}},r.prototype.credentialsTypeChanged=function(){this.credentialsConfigFormGroup.patchValue({username:null,password:null,caCert:null,caCertFileName:null,privateKey:null,privateKeyFileName:null,cert:null,certFileName:null}),this.updateValidators()},r.prototype.updateValidators=function(e){void 0===e&&(e=!1);var t=this.credentialsConfigFormGroup.get("type").value;switch(e&&this.credentialsConfigFormGroup.reset({type:t},{emitEvent:!1}),this.credentialsConfigFormGroup.setValidators([]),this.credentialsConfigFormGroup.get("username").setValidators([]),this.credentialsConfigFormGroup.get("password").setValidators([]),t){case"anonymous":break;case"basic":this.credentialsConfigFormGroup.get("username").setValidators([i.Validators.required]),this.credentialsConfigFormGroup.get("password").setValidators([i.Validators.required]);break;case"cert.PEM":this.credentialsConfigFormGroup.setValidators([this.requiredFilesSelected(i.Validators.required,[["caCert","caCertFileName"],["privateKey","privateKeyFileName","cert","certFileName"]])])}this.credentialsConfigFormGroup.get("username").updateValueAndValidity({emitEvent:e}),this.credentialsConfigFormGroup.get("password").updateValueAndValidity({emitEvent:e}),this.credentialsConfigFormGroup.updateValueAndValidity({emitEvent:e})},r.prototype.requiredFilesSelected=function(e,t){return void 0===t&&(t=null),function(r){return t||(t=[Object.keys(r.controls)]),(null==r?void 0:r.controls)&&t.some((function(t){return t.every((function(t){return!e(r.controls[t])}))}))?null:{notAllRequiredFilesSelected:!0}}},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),h([t.Input(),C("design:type",Object)],r.prototype,"disableCertPemCredentials",void 0),r=n=h([t.Component({selector:"tb-credentials-config",template:'
\n \n \n tb.rulenode.credentials\n \n {{ credentialsTypeTranslationsMap.get(credentialsConfigFormGroup.get(\'type\').value) | translate }}\n \n \n \n \n tb.rulenode.credentials-type\n \n \n {{ credentialsTypeTranslationsMap.get(credentialsType) | translate }}\n \n \n \n {{ \'tb.rulenode.credentials-type-required\' | translate }}\n \n \n
\n \n \n \n \n tb.rulenode.username\n \n \n {{ \'tb.rulenode.username-required\' | translate }}\n \n \n \n tb.rulenode.password\n \n \n {{ \'tb.rulenode.password-required\' | translate }}\n \n \n \n \n
{{ \'tb.rulenode.credentials-pem-hint\' | translate }}
\n \n \n \n \n \n \n \n tb.rulenode.private-key-password\n \n \n
\n
\n
\n
\n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return n})),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef((function(){return n})),multi:!0}]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.PageComponent),me=function(){function e(e){this.sanitizer=e}return e.prototype.transform=function(e){return this.sanitizer.bypassSecurityTrustHtml(e)},e.ctorParameters=function(){return[{type:g.DomSanitizer}]},e=h([t.Pipe({name:"safeHtml"}),C("design:paramtypes",[g.DomSanitizer])],e)}(),ue=function(){function e(){}return e=h([t.NgModule({declarations:[ae,oe,ie,le,se,me],imports:[r.CommonModule,a.SharedModule,l.HomeComponentsModule],exports:[ae,oe,ie,le,se,me]})],e)}(),de=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.unassignCustomerConfigForm},r.prototype.onConfigurationSet=function(e){this.unassignCustomerConfigForm=this.fb.group({customerNamePattern:[e?e.customerNamePattern:null,[i.Validators.required]],customerCacheExpiration:[e?e.customerCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-un-assign-to-customer-config",template:'
\n \n tb.rulenode.customer-name-pattern\n \n \n {{ \'tb.rulenode.customer-name-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.customer-cache-expiration\n \n \n {{ \'tb.rulenode.customer-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.customer-cache-expiration-range\' | translate }}\n \n tb.rulenode.customer-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),pe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.snsConfigForm},r.prototype.onConfigurationSet=function(e){this.snsConfigForm=this.fb.group({topicArnPattern:[e?e.topicArnPattern:null,[i.Validators.required]],accessKeyId:[e?e.accessKeyId:null,[i.Validators.required]],secretAccessKey:[e?e.secretAccessKey:null,[i.Validators.required]],region:[e?e.region:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-sns-config",template:'
\n \n tb.rulenode.topic-arn-pattern\n \n \n {{ \'tb.rulenode.topic-arn-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.aws-access-key-id\n \n \n {{ \'tb.rulenode.aws-access-key-id-required\' | translate }}\n \n \n \n tb.rulenode.aws-secret-access-key\n \n \n {{ \'tb.rulenode.aws-secret-access-key-required\' | translate }}\n \n \n \n tb.rulenode.aws-region\n \n \n {{ \'tb.rulenode.aws-region-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ce=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.sqsQueueType=j,n.sqsQueueTypes=Object.keys(j),n.sqsQueueTypeTranslationsMap=_,n}return b(r,e),r.prototype.configForm=function(){return this.sqsConfigForm},r.prototype.onConfigurationSet=function(e){this.sqsConfigForm=this.fb.group({queueType:[e?e.queueType:null,[i.Validators.required]],queueUrlPattern:[e?e.queueUrlPattern:null,[i.Validators.required]],delaySeconds:[e?e.delaySeconds:null,[i.Validators.min(0),i.Validators.max(900)]],messageAttributes:[e?e.messageAttributes:null,[]],accessKeyId:[e?e.accessKeyId:null,[i.Validators.required]],secretAccessKey:[e?e.secretAccessKey:null,[i.Validators.required]],region:[e?e.region:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-sqs-config",template:'
\n \n tb.rulenode.queue-type\n \n \n {{ sqsQueueTypeTranslationsMap.get(type) | translate }}\n \n \n \n \n tb.rulenode.queue-url-pattern\n \n \n {{ \'tb.rulenode.queue-url-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.delay-seconds\n \n \n {{ \'tb.rulenode.min-delay-seconds-message\' | translate }}\n \n \n {{ \'tb.rulenode.max-delay-seconds-message\' | translate }}\n \n \n \n
\n \n \n \n tb.rulenode.aws-access-key-id\n \n \n {{ \'tb.rulenode.aws-access-key-id-required\' | translate }}\n \n \n \n tb.rulenode.aws-secret-access-key\n \n \n {{ \'tb.rulenode.aws-secret-access-key-required\' | translate }}\n \n \n \n tb.rulenode.aws-region\n \n \n {{ \'tb.rulenode.aws-region-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),fe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.pubSubConfigForm},r.prototype.onConfigurationSet=function(e){this.pubSubConfigForm=this.fb.group({projectId:[e?e.projectId:null,[i.Validators.required]],topicName:[e?e.topicName:null,[i.Validators.required]],serviceAccountKey:[e?e.serviceAccountKey:null,[i.Validators.required]],serviceAccountKeyFileName:[e?e.serviceAccountKeyFileName:null,[i.Validators.required]],messageAttributes:[e?e.messageAttributes:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-pub-sub-config",template:'
\n \n tb.rulenode.gcp-project-id\n \n \n {{ \'tb.rulenode.gcp-project-id-required\' | translate }}\n \n \n \n tb.rulenode.pubsub-topic-name\n \n \n {{ \'tb.rulenode.pubsub-topic-name-required\' | translate }}\n \n \n \n \n \n
\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ge=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.ackValues=["all","-1","0","1"],n.ToByteStandartCharsetTypesValues=Z,n.ToByteStandartCharsetTypeTranslationMap=X,n}return b(r,e),r.prototype.configForm=function(){return this.kafkaConfigForm},r.prototype.onConfigurationSet=function(e){this.kafkaConfigForm=this.fb.group({topicPattern:[e?e.topicPattern:null,[i.Validators.required]],bootstrapServers:[e?e.bootstrapServers:null,[i.Validators.required]],retries:[e?e.retries:null,[i.Validators.min(0)]],batchSize:[e?e.batchSize:null,[i.Validators.min(0)]],linger:[e?e.linger:null,[i.Validators.min(0)]],bufferMemory:[e?e.bufferMemory:null,[i.Validators.min(0)]],acks:[e?e.acks:null,[i.Validators.required]],keySerializer:[e?e.keySerializer:null,[i.Validators.required]],valueSerializer:[e?e.valueSerializer:null,[i.Validators.required]],otherProperties:[e?e.otherProperties:null,[]],addMetadataKeyValuesAsKafkaHeaders:[!!e&&e.addMetadataKeyValuesAsKafkaHeaders,[]],kafkaHeadersCharset:[e?e.kafkaHeadersCharset:null,[]]})},r.prototype.validatorTriggers=function(){return["addMetadataKeyValuesAsKafkaHeaders"]},r.prototype.updateValidators=function(e){this.kafkaConfigForm.get("addMetadataKeyValuesAsKafkaHeaders").value?this.kafkaConfigForm.get("kafkaHeadersCharset").setValidators([i.Validators.required]):this.kafkaConfigForm.get("kafkaHeadersCharset").setValidators([]),this.kafkaConfigForm.get("kafkaHeadersCharset").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-kafka-config",template:'
\n \n tb.rulenode.topic-pattern\n \n \n {{ \'tb.rulenode.topic-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.bootstrap-servers\n \n \n {{ \'tb.rulenode.bootstrap-servers-required\' | translate }}\n \n \n \n tb.rulenode.retries\n \n \n {{ \'tb.rulenode.min-retries-message\' | translate }}\n \n \n \n tb.rulenode.batch-size-bytes\n \n \n {{ \'tb.rulenode.min-batch-size-bytes-message\' | translate }}\n \n \n \n tb.rulenode.linger-ms\n \n \n {{ \'tb.rulenode.min-linger-ms-message\' | translate }}\n \n \n \n tb.rulenode.buffer-memory-bytes\n \n \n {{ \'tb.rulenode.min-buffer-memory-bytes-message\' | translate }}\n \n \n \n tb.rulenode.acks\n \n \n {{ ackValue }}\n \n \n \n \n tb.rulenode.key-serializer\n \n \n {{ \'tb.rulenode.key-serializer-required\' | translate }}\n \n \n \n tb.rulenode.value-serializer\n \n \n {{ \'tb.rulenode.value-serializer-required\' | translate }}\n \n \n \n \n \n \n {{ \'tb.rulenode.add-metadata-key-values-as-kafka-headers\' | translate }}\n \n
tb.rulenode.add-metadata-key-values-as-kafka-headers-hint
\n \n tb.rulenode.charset-encoding\n \n \n {{ ToByteStandartCharsetTypeTranslationMap.get(charset) | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ye=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.mqttConfigForm},r.prototype.onConfigurationSet=function(e){this.mqttConfigForm=this.fb.group({topicPattern:[e?e.topicPattern:null,[i.Validators.required]],host:[e?e.host:null,[i.Validators.required]],port:[e?e.port:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]],connectTimeoutSec:[e?e.connectTimeoutSec:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(200)]],clientId:[e?e.clientId:null,[]],cleanSession:[!!e&&e.cleanSession,[]],ssl:[!!e&&e.ssl,[]],credentials:[e?e.credentials:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-mqtt-config",template:'
\n \n tb.rulenode.topic-pattern\n \n \n {{ \'tb.rulenode.topic-pattern-required\' | translate }}\n \n \n \n
\n \n tb.rulenode.host\n \n \n {{ \'tb.rulenode.host-required\' | translate }}\n \n \n \n tb.rulenode.port\n \n \n {{ \'tb.rulenode.port-required\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n \n tb.rulenode.connect-timeout\n \n \n {{ \'tb.rulenode.connect-timeout-required\' | translate }}\n \n \n {{ \'tb.rulenode.connect-timeout-range\' | translate }}\n \n \n {{ \'tb.rulenode.connect-timeout-range\' | translate }}\n \n \n
\n \n tb.rulenode.client-id\n \n \n \n {{ \'tb.rulenode.clean-session\' | translate }}\n \n \n {{ \'tb.rulenode.enable-ssl\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),be=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.messageProperties=[null,"BASIC","TEXT_PLAIN","MINIMAL_BASIC","MINIMAL_PERSISTENT_BASIC","PERSISTENT_BASIC","PERSISTENT_TEXT_PLAIN"],n}return b(r,e),r.prototype.configForm=function(){return this.rabbitMqConfigForm},r.prototype.onConfigurationSet=function(e){this.rabbitMqConfigForm=this.fb.group({exchangeNamePattern:[e?e.exchangeNamePattern:null,[]],routingKeyPattern:[e?e.routingKeyPattern:null,[]],messageProperties:[e?e.messageProperties:null,[]],host:[e?e.host:null,[i.Validators.required]],port:[e?e.port:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]],virtualHost:[e?e.virtualHost:null,[]],username:[e?e.username:null,[]],password:[e?e.password:null,[]],automaticRecoveryEnabled:[!!e&&e.automaticRecoveryEnabled,[]],connectionTimeout:[e?e.connectionTimeout:null,[i.Validators.min(0)]],handshakeTimeout:[e?e.handshakeTimeout:null,[i.Validators.min(0)]],clientProperties:[e?e.clientProperties:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rabbit-mq-config",template:'
\n \n tb.rulenode.exchange-name-pattern\n \n \n \n tb.rulenode.routing-key-pattern\n \n \n \n tb.rulenode.message-properties\n \n \n {{ property }}\n \n \n \n
\n \n tb.rulenode.host\n \n \n {{ \'tb.rulenode.host-required\' | translate }}\n \n \n \n tb.rulenode.port\n \n \n {{ \'tb.rulenode.port-required\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n
\n \n tb.rulenode.virtual-host\n \n \n \n tb.rulenode.username\n \n \n \n tb.rulenode.password\n \n \n \n {{ \'tb.rulenode.automatic-recovery\' | translate }}\n \n \n tb.rulenode.connection-timeout-ms\n \n \n {{ \'tb.rulenode.min-connection-timeout-ms-message\' | translate }}\n \n \n \n tb.rulenode.handshake-timeout-ms\n \n \n {{ \'tb.rulenode.min-handshake-timeout-ms-message\' | translate }}\n \n \n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),he=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.proxySchemes=["http","https"],n.httpRequestTypes=Object.keys(Q),n}return b(r,e),r.prototype.configForm=function(){return this.restApiCallConfigForm},r.prototype.onConfigurationSet=function(e){this.restApiCallConfigForm=this.fb.group({restEndpointUrlPattern:[e?e.restEndpointUrlPattern:null,[i.Validators.required]],requestMethod:[e?e.requestMethod:null,[i.Validators.required]],useSimpleClientHttpFactory:[!!e&&e.useSimpleClientHttpFactory,[]],enableProxy:[!!e&&e.enableProxy,[]],useSystemProxyProperties:[!!e&&e.enableProxy,[]],proxyScheme:[e?e.proxyHost:null,[]],proxyHost:[e?e.proxyHost:null,[]],proxyPort:[e?e.proxyPort:null,[]],proxyUser:[e?e.proxyUser:null,[]],proxyPassword:[e?e.proxyPassword:null,[]],readTimeoutMs:[e?e.readTimeoutMs:null,[]],maxParallelRequestsCount:[e?e.maxParallelRequestsCount:null,[i.Validators.min(0)]],headers:[e?e.headers:null,[]],useRedisQueueForMsgPersistence:[!!e&&e.useRedisQueueForMsgPersistence,[]],trimQueue:[!!e&&e.trimQueue,[]],maxQueueSize:[e?e.maxQueueSize:null,[]],credentials:[e?e.credentials:null,[]]})},r.prototype.validatorTriggers=function(){return["useSimpleClientHttpFactory","useRedisQueueForMsgPersistence","enableProxy","useSystemProxyProperties"]},r.prototype.updateValidators=function(e){var t=this.restApiCallConfigForm.get("useSimpleClientHttpFactory").value,r=this.restApiCallConfigForm.get("useRedisQueueForMsgPersistence").value,n=this.restApiCallConfigForm.get("enableProxy").value,a=this.restApiCallConfigForm.get("useSystemProxyProperties").value;n&&!a?(this.restApiCallConfigForm.get("proxyHost").setValidators(n?[i.Validators.required]:[]),this.restApiCallConfigForm.get("proxyPort").setValidators(n?[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]:[])):(this.restApiCallConfigForm.get("proxyHost").setValidators([]),this.restApiCallConfigForm.get("proxyPort").setValidators([]),t?this.restApiCallConfigForm.get("readTimeoutMs").setValidators([]):this.restApiCallConfigForm.get("readTimeoutMs").setValidators([i.Validators.min(0)])),r?this.restApiCallConfigForm.get("maxQueueSize").setValidators([i.Validators.min(0)]):this.restApiCallConfigForm.get("maxQueueSize").setValidators([]),this.restApiCallConfigForm.get("readTimeoutMs").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("maxQueueSize").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("proxyHost").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("proxyPort").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("credentials").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rest-api-call-config",template:'
\n \n tb.rulenode.endpoint-url-pattern\n \n \n {{ \'tb.rulenode.endpoint-url-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.request-method\n \n \n {{ requestType }}\n \n \n \n \n {{ \'tb.rulenode.enable-proxy\' | translate }}\n \n \n {{ \'tb.rulenode.use-simple-client-http-factory\' | translate }}\n \n
\n \n {{ \'tb.rulenode.use-system-proxy-properties\' | translate }}\n \n
\n
\n \n tb.rulenode.proxy-scheme\n \n \n {{ proxyScheme }}\n \n \n \n \n tb.rulenode.proxy-host\n \n \n {{ \'tb.rulenode.proxy-host-required\' | translate }}\n \n \n \n tb.rulenode.proxy-port\n \n \n {{ \'tb.rulenode.proxy-port-required\' | translate }}\n \n \n {{ \'tb.rulenode.proxy-port-range\' | translate }}\n \n \n
\n \n tb.rulenode.proxy-user\n \n \n \n tb.rulenode.proxy-password\n \n \n
\n
\n \n tb.rulenode.read-timeout\n \n tb.rulenode.read-timeout-hint\n \n \n tb.rulenode.max-parallel-requests-count\n \n tb.rulenode.max-parallel-requests-count-hint\n \n \n
\n \n \n \n {{ \'tb.rulenode.use-redis-queue\' | translate }}\n \n
\n \n {{ \'tb.rulenode.trim-redis-queue\' | translate }}\n \n \n tb.rulenode.redis-queue-max-size\n \n \n
\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ce=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.smtpProtocols=["smtp","smtps"],n.tlsVersions=["TLSv1","TLSv1.1","TLSv1.2","TLSv1.3"],n}return b(r,e),r.prototype.configForm=function(){return this.sendEmailConfigForm},r.prototype.onConfigurationSet=function(e){this.sendEmailConfigForm=this.fb.group({useSystemSmtpSettings:[!!e&&e.useSystemSmtpSettings,[]],smtpProtocol:[e?e.smtpProtocol:null,[]],smtpHost:[e?e.smtpHost:null,[]],smtpPort:[e?e.smtpPort:null,[]],timeout:[e?e.timeout:null,[]],enableTls:[!!e&&e.enableTls,[]],tlsVersion:[e?e.tlsVersion:null,[]],enableProxy:[!!e&&e.enableProxy,[]],proxyHost:[e?e.proxyHost:null,[]],proxyPort:[e?e.proxyPort:null,[]],proxyUser:[e?e.proxyUser:null,[]],proxyPassword:[e?e.proxyPassword:null,[]],username:[e?e.username:null,[]],password:[e?e.password:null,[]]})},r.prototype.validatorTriggers=function(){return["useSystemSmtpSettings","enableProxy"]},r.prototype.updateValidators=function(e){var t=this.sendEmailConfigForm.get("useSystemSmtpSettings").value,r=this.sendEmailConfigForm.get("enableProxy").value;t?(this.sendEmailConfigForm.get("smtpProtocol").setValidators([]),this.sendEmailConfigForm.get("smtpHost").setValidators([]),this.sendEmailConfigForm.get("smtpPort").setValidators([]),this.sendEmailConfigForm.get("timeout").setValidators([]),this.sendEmailConfigForm.get("proxyHost").setValidators([]),this.sendEmailConfigForm.get("proxyPort").setValidators([])):(this.sendEmailConfigForm.get("smtpProtocol").setValidators([i.Validators.required]),this.sendEmailConfigForm.get("smtpHost").setValidators([i.Validators.required]),this.sendEmailConfigForm.get("smtpPort").setValidators([i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]),this.sendEmailConfigForm.get("timeout").setValidators([i.Validators.required,i.Validators.min(0)]),this.sendEmailConfigForm.get("proxyHost").setValidators(r?[i.Validators.required]:[]),this.sendEmailConfigForm.get("proxyPort").setValidators(r?[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]:[])),this.sendEmailConfigForm.get("smtpProtocol").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("smtpHost").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("smtpPort").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("timeout").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("proxyHost").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("proxyPort").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-send-email-config",template:'
\n \n {{ \'tb.rulenode.use-system-smtp-settings\' | translate }}\n \n
\n \n tb.rulenode.smtp-protocol\n \n \n {{ smtpProtocol.toUpperCase() }}\n \n \n \n
\n \n tb.rulenode.smtp-host\n \n \n {{ \'tb.rulenode.smtp-host-required\' | translate }}\n \n \n \n tb.rulenode.smtp-port\n \n \n {{ \'tb.rulenode.smtp-port-required\' | translate }}\n \n \n {{ \'tb.rulenode.smtp-port-range\' | translate }}\n \n \n {{ \'tb.rulenode.smtp-port-range\' | translate }}\n \n \n
\n \n tb.rulenode.timeout-msec\n \n \n {{ \'tb.rulenode.timeout-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-timeout-msec-message\' | translate }}\n \n \n \n {{ \'tb.rulenode.enable-tls\' | translate }}\n \n \n tb.rulenode.tls-version\n \n \n {{ tlsVersion }}\n \n \n \n \n {{ \'tb.rulenode.enable-proxy\' | translate }}\n \n
\n
\n \n tb.rulenode.proxy-host\n \n \n {{ \'tb.rulenode.proxy-host-required\' | translate }}\n \n \n \n tb.rulenode.proxy-port\n \n \n {{ \'tb.rulenode.proxy-port-required\' | translate }}\n \n \n {{ \'tb.rulenode.proxy-port-range\' | translate }}\n \n \n
\n \n tb.rulenode.proxy-user\n \n \n \n tb.rulenode.proxy-password\n \n \n
\n \n tb.rulenode.username\n \n \n \n tb.rulenode.password\n \n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ve=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.serviceType=a.ServiceType.TB_RULE_ENGINE,n}return b(r,e),r.prototype.configForm=function(){return this.checkPointConfigForm},r.prototype.onConfigurationSet=function(e){this.checkPointConfigForm=this.fb.group({queueName:[e?e.queueName:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-check-point-config",template:'
\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Fe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.allAzureIotHubCredentialsTypes=J,n.azureIotHubCredentialsTypeTranslationsMap=Y,n}return b(r,e),r.prototype.configForm=function(){return this.azureIotHubConfigForm},r.prototype.onConfigurationSet=function(e){this.azureIotHubConfigForm=this.fb.group({topicPattern:[e?e.topicPattern:null,[i.Validators.required]],host:[e?e.host:null,[i.Validators.required]],port:[e?e.port:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]],connectTimeoutSec:[e?e.connectTimeoutSec:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(200)]],clientId:[e?e.clientId:null,[i.Validators.required]],cleanSession:[!!e&&e.cleanSession,[]],ssl:[!!e&&e.ssl,[]],credentials:this.fb.group({type:[e&&e.credentials?e.credentials.type:null,[i.Validators.required]],sasKey:[e&&e.credentials?e.credentials.sasKey:null,[]],caCert:[e&&e.credentials?e.credentials.caCert:null,[]],caCertFileName:[e&&e.credentials?e.credentials.caCertFileName:null,[]],privateKey:[e&&e.credentials?e.credentials.privateKey:null,[]],privateKeyFileName:[e&&e.credentials?e.credentials.privateKeyFileName:null,[]],cert:[e&&e.credentials?e.credentials.cert:null,[]],certFileName:[e&&e.credentials?e.credentials.certFileName:null,[]],password:[e&&e.credentials?e.credentials.password:null,[]]})})},r.prototype.prepareOutputConfig=function(e){var t=e.credentials.type;return"sas"===t&&(e.credentials={type:t,sasKey:e.credentials.sasKey,caCert:e.credentials.caCert,caCertFileName:e.credentials.caCertFileName}),e},r.prototype.validatorTriggers=function(){return["credentials.type"]},r.prototype.updateValidators=function(e){var t=this.azureIotHubConfigForm.get("credentials"),r=t.get("type").value;switch(e&&t.reset({type:r},{emitEvent:!1}),t.get("sasKey").setValidators([]),t.get("privateKey").setValidators([]),t.get("privateKeyFileName").setValidators([]),t.get("cert").setValidators([]),t.get("certFileName").setValidators([]),r){case"sas":t.get("sasKey").setValidators([i.Validators.required]);break;case"cert.PEM":t.get("privateKey").setValidators([i.Validators.required]),t.get("privateKeyFileName").setValidators([i.Validators.required]),t.get("cert").setValidators([i.Validators.required]),t.get("certFileName").setValidators([i.Validators.required])}t.get("sasKey").updateValueAndValidity({emitEvent:e}),t.get("privateKey").updateValueAndValidity({emitEvent:e}),t.get("privateKeyFileName").updateValueAndValidity({emitEvent:e}),t.get("cert").updateValueAndValidity({emitEvent:e}),t.get("certFileName").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-azure-iot-hub-config",template:'
\n \n tb.rulenode.topic\n \n \n {{ \'tb.rulenode.topic-required\' | translate }}\n \n \n \n tb.rulenode.hostname\n \n \n {{ \'tb.rulenode.hostname-required\' | translate }}\n \n \n \n tb.rulenode.device-id\n \n \n {{ \'tb.rulenode.device-id-required\' | translate }}\n \n \n \n \n \n tb.rulenode.credentials\n \n {{ azureIotHubCredentialsTypeTranslationsMap.get(azureIotHubConfigForm.get(\'credentials.type\').value) | translate }}\n \n \n
\n \n tb.rulenode.credentials-type\n \n \n {{ azureIotHubCredentialsTypeTranslationsMap.get(credentialsType) | translate }}\n \n \n \n {{ \'tb.rulenode.credentials-type-required\' | translate }}\n \n \n
\n \n \n \n \n tb.rulenode.sas-key\n \n \n {{ \'tb.rulenode.sas-key-required\' | translate }}\n \n \n \n \n \n \n \n \n \n \n \n \n \n tb.rulenode.private-key-password\n \n \n \n
\n
\n
\n
\n
\n',styles:[":host .tb-mqtt-credentials-panel-group{margin:0 6px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),xe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.deviceProfile},r.prototype.onConfigurationSet=function(e){this.deviceProfile=this.fb.group({persistAlarmRulesState:[!!e&&e.persistAlarmRulesState,i.Validators.required],fetchAlarmRulesStateOnStart:[!!e&&e.fetchAlarmRulesStateOnStart,i.Validators.required]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-device-profile-config",template:'
\n \n {{ \'tb.rulenode.persist-alarm-rules\' | translate }}\n \n \n {{ \'tb.rulenode.fetch-alarm-rules\' | translate }}\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Te=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.sendSmsConfigForm},r.prototype.onConfigurationSet=function(e){this.sendSmsConfigForm=this.fb.group({numbersToTemplate:[e?e.numbersToTemplate:null,[i.Validators.required]],smsMessageTemplate:[e?e.smsMessageTemplate:null,[i.Validators.required]],useSystemSmsSettings:[!!e&&e.useSystemSmsSettings,[]],smsProviderConfiguration:[e?e.smsProviderConfiguration:null,[]]})},r.prototype.validatorTriggers=function(){return["useSystemSmsSettings"]},r.prototype.updateValidators=function(e){this.sendSmsConfigForm.get("useSystemSmsSettings").value?this.sendSmsConfigForm.get("smsProviderConfiguration").setValidators([]):this.sendSmsConfigForm.get("smsProviderConfiguration").setValidators([i.Validators.required]),this.sendSmsConfigForm.get("smsProviderConfiguration").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-send-sms-config",template:'
\n \n tb.rulenode.numbers-to-template\n \n \n {{ \'tb.rulenode.numbers-to-template-required\' | translate }}\n \n \n \n \n tb.rulenode.sms-message-template\n \n \n {{ \'tb.rulenode.sms-message-template-required\' | translate }}\n \n \n \n \n {{ \'tb.rulenode.use-system-sms-settings\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),qe=function(){function e(){}return e=h([t.NgModule({declarations:[T,q,S,I,k,N,V,E,A,L,P,ee,te,re,ne,de,pe,ce,fe,ge,ye,be,he,Ce,ve,Fe,xe,Te],imports:[r.CommonModule,a.SharedModule,l.HomeComponentsModule,ue],exports:[T,q,S,I,k,N,V,E,A,L,P,ee,te,re,ne,de,pe,ce,fe,ge,ye,be,he,Ce,ve,Fe,xe,Te]})],e)}(),Se=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.checkMessageConfigForm},r.prototype.onConfigurationSet=function(e){this.checkMessageConfigForm=this.fb.group({messageNames:[e?e.messageNames:null,[]],metadataNames:[e?e.metadataNames:null,[]],checkAllKeys:[!!e&&e.checkAllKeys,[]]})},r.prototype.validateConfig=function(){var e=this.checkMessageConfigForm.get("messageNames").value,t=this.checkMessageConfigForm.get("metadataNames").value;return e.length>0||t.length>0},r.prototype.removeMessageName=function(e){var t=this.checkMessageConfigForm.get("messageNames").value,r=t.indexOf(e);r>=0&&(t.splice(r,1),this.checkMessageConfigForm.get("messageNames").setValue(t,{emitEvent:!0}))},r.prototype.removeMetadataName=function(e){var t=this.checkMessageConfigForm.get("metadataNames").value,r=t.indexOf(e);r>=0&&(t.splice(r,1),this.checkMessageConfigForm.get("metadataNames").setValue(t,{emitEvent:!0}))},r.prototype.addMessageName=function(e){var t=e.input,r=e.value;if((r||"").trim()){r=r.trim();var n=this.checkMessageConfigForm.get("messageNames").value;n&&-1!==n.indexOf(r)||(n||(n=[]),n.push(r),this.checkMessageConfigForm.get("messageNames").setValue(n,{emitEvent:!0}))}t&&(t.value="")},r.prototype.addMetadataName=function(e){var t=e.input,r=e.value;if((r||"").trim()){r=r.trim();var n=this.checkMessageConfigForm.get("metadataNames").value;n&&-1!==n.indexOf(r)||(n||(n=[]),n.push(r),this.checkMessageConfigForm.get("metadataNames").setValue(n,{emitEvent:!0}))}t&&(t.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-check-message-config",template:'
\n \n \n \n \n \n {{messageName}}\n close\n \n \n \n \n
tb.rulenode.separator-hint
\n \n \n \n \n \n {{metadataName}}\n close\n \n \n \n \n
tb.rulenode.separator-hint
\n \n {{ \'tb.rulenode.check-all-keys\' | translate }}\n \n
tb.rulenode.check-all-keys-hint
\n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ie=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.entitySearchDirection=Object.keys(a.EntitySearchDirection),n.entitySearchDirectionTranslationsMap=a.entitySearchDirectionTranslations,n}return b(r,e),r.prototype.configForm=function(){return this.checkRelationConfigForm},r.prototype.onConfigurationSet=function(e){this.checkRelationConfigForm=this.fb.group({checkForSingleEntity:[!!e&&e.checkForSingleEntity,[]],direction:[e?e.direction:null,[]],entityType:[e?e.entityType:null,e&&e.checkForSingleEntity?[i.Validators.required]:[]],entityId:[e?e.entityId:null,e&&e.checkForSingleEntity?[i.Validators.required]:[]],relationType:[e?e.relationType:null,[i.Validators.required]]})},r.prototype.validatorTriggers=function(){return["checkForSingleEntity"]},r.prototype.updateValidators=function(e){var t=this.checkRelationConfigForm.get("checkForSingleEntity").value;this.checkRelationConfigForm.get("entityType").setValidators(t?[i.Validators.required]:[]),this.checkRelationConfigForm.get("entityType").updateValueAndValidity({emitEvent:e}),this.checkRelationConfigForm.get("entityId").setValidators(t?[i.Validators.required]:[]),this.checkRelationConfigForm.get("entityId").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-check-relation-config",template:'
\n \n {{ \'tb.rulenode.check-relation-to-specific-entity\' | translate }}\n \n
tb.rulenode.check-relation-hint
\n \n relation.direction\n \n \n {{ entitySearchDirectionTranslationsMap.get(direction) | translate }}\n \n \n \n
\n \n \n \n \n
\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ke=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.perimeterType=M,n.perimeterTypes=Object.keys(M),n.perimeterTypeTranslationMap=D,n.rangeUnits=Object.keys(O),n.rangeUnitTranslationMap=G,n}return b(r,e),r.prototype.configForm=function(){return this.geoFilterConfigForm},r.prototype.onConfigurationSet=function(e){this.geoFilterConfigForm=this.fb.group({latitudeKeyName:[e?e.latitudeKeyName:null,[i.Validators.required]],longitudeKeyName:[e?e.longitudeKeyName:null,[i.Validators.required]],fetchPerimeterInfoFromMessageMetadata:[!!e&&e.fetchPerimeterInfoFromMessageMetadata,[]],perimeterType:[e?e.perimeterType:null,[]],centerLatitude:[e?e.centerLatitude:null,[]],centerLongitude:[e?e.centerLatitude:null,[]],range:[e?e.range:null,[]],rangeUnit:[e?e.rangeUnit:null,[]],polygonsDefinition:[e?e.polygonsDefinition:null,[]]})},r.prototype.validatorTriggers=function(){return["fetchPerimeterInfoFromMessageMetadata","perimeterType"]},r.prototype.updateValidators=function(e){var t=this.geoFilterConfigForm.get("fetchPerimeterInfoFromMessageMetadata").value,r=this.geoFilterConfigForm.get("perimeterType").value;t?this.geoFilterConfigForm.get("perimeterType").setValidators([]):this.geoFilterConfigForm.get("perimeterType").setValidators([i.Validators.required]),t||r!==M.CIRCLE?(this.geoFilterConfigForm.get("centerLatitude").setValidators([]),this.geoFilterConfigForm.get("centerLongitude").setValidators([]),this.geoFilterConfigForm.get("range").setValidators([]),this.geoFilterConfigForm.get("rangeUnit").setValidators([])):(this.geoFilterConfigForm.get("centerLatitude").setValidators([i.Validators.required,i.Validators.min(-90),i.Validators.max(90)]),this.geoFilterConfigForm.get("centerLongitude").setValidators([i.Validators.required,i.Validators.min(-180),i.Validators.max(180)]),this.geoFilterConfigForm.get("range").setValidators([i.Validators.required,i.Validators.min(0)]),this.geoFilterConfigForm.get("rangeUnit").setValidators([i.Validators.required])),t||r!==M.POLYGON?this.geoFilterConfigForm.get("polygonsDefinition").setValidators([]):this.geoFilterConfigForm.get("polygonsDefinition").setValidators([i.Validators.required]),this.geoFilterConfigForm.get("perimeterType").updateValueAndValidity({emitEvent:!1}),this.geoFilterConfigForm.get("centerLatitude").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("centerLongitude").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("range").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("rangeUnit").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("polygonsDefinition").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-gps-geofencing-config",template:'
\n \n tb.rulenode.latitude-key-name\n \n \n {{ \'tb.rulenode.latitude-key-name-required\' | translate }}\n \n \n \n tb.rulenode.longitude-key-name\n \n \n {{ \'tb.rulenode.longitude-key-name-required\' | translate }}\n \n \n \n {{ \'tb.rulenode.fetch-perimeter-info-from-message-metadata\' | translate }}\n \n
\n \n tb.rulenode.perimeter-type\n \n \n {{ perimeterTypeTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n \n tb.rulenode.circle-center-latitude\n \n \n {{ \'tb.rulenode.circle-center-latitude-required\' | translate }}\n \n \n \n tb.rulenode.circle-center-longitude\n \n \n {{ \'tb.rulenode.circle-center-longitude-required\' | translate }}\n \n \n
\n
\n \n tb.rulenode.range\n \n \n {{ \'tb.rulenode.range-required\' | translate }}\n \n \n \n tb.rulenode.range-units\n \n \n {{ rangeUnitTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n
\n \n tb.rulenode.polygon-definition\n \n \n {{ \'tb.rulenode.polygon-definition-required\' | translate }}\n \n \n
\n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ne=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.messageTypeConfigForm},r.prototype.onConfigurationSet=function(e){this.messageTypeConfigForm=this.fb.group({messageTypes:[e?e.messageTypes:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-message-type-config",template:'
\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ve=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.allowedEntityTypes=[a.EntityType.DEVICE,a.EntityType.ASSET,a.EntityType.ENTITY_VIEW,a.EntityType.TENANT,a.EntityType.CUSTOMER,a.EntityType.USER,a.EntityType.DASHBOARD,a.EntityType.RULE_CHAIN,a.EntityType.RULE_NODE],n}return b(r,e),r.prototype.configForm=function(){return this.originatorTypeConfigForm},r.prototype.onConfigurationSet=function(e){this.originatorTypeConfigForm=this.fb.group({originatorTypes:[e?e.originatorTypes:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-originator-type-config",template:'
\n \n \n \n
\n',styles:[":host ::ng-deep tb-entity-type-list .mat-form-field-flex{padding-top:0}:host ::ng-deep tb-entity-type-list .mat-form-field-infix{border-top:0}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ee=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.scriptConfigForm},r.prototype.onConfigurationSet=function(e){this.scriptConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.scriptConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"filter",this.translate.instant("tb.rulenode.filter"),"Filter",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.scriptConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-filter-node-script-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),Ae=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.switchConfigForm},r.prototype.onConfigurationSet=function(e){this.switchConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.switchConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"switch",this.translate.instant("tb.rulenode.switch"),"Switch",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.switchConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-filter-node-switch-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),Le=function(e){function r(t,r,n){var o,l,s=e.call(this,t)||this;s.store=t,s.translate=r,s.fb=n,s.alarmStatusTranslationsMap=a.alarmStatusTranslations,s.alarmStatusList=[],s.searchText="",s.displayStatusFn=s.displayStatus.bind(s);try{for(var m=v(Object.keys(a.AlarmStatus)),u=m.next();!u.done;u=m.next()){var d=u.value;s.alarmStatusList.push(a.AlarmStatus[d])}}catch(e){o={error:e}}finally{try{u&&!u.done&&(l=m.return)&&l.call(m)}finally{if(o)throw o.error}}return s.statusFormControl=new i.FormControl(""),s.filteredAlarmStatus=s.statusFormControl.valueChanges.pipe(f.startWith(""),f.map((function(e){return e||""})),f.mergeMap((function(e){return s.fetchAlarmStatus(e)})),f.share()),s}return b(r,e),r.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this)},r.prototype.configForm=function(){return this.alarmStatusConfigForm},r.prototype.prepareInputConfig=function(e){return this.searchText="",this.statusFormControl.patchValue("",{emitEvent:!0}),e},r.prototype.onConfigurationSet=function(e){this.alarmStatusConfigForm=this.fb.group({alarmStatusList:[e?e.alarmStatusList:null,[i.Validators.required]]})},r.prototype.displayStatus=function(e){return e?this.translate.instant(a.alarmStatusTranslations.get(e)):void 0},r.prototype.fetchAlarmStatus=function(e){var t=this,r=this.getAlarmStatusList();if(this.searchText=e,this.searchText&&this.searchText.length){var n=this.searchText.toUpperCase();return c.of(r.filter((function(e){return t.translate.instant(a.alarmStatusTranslations.get(a.AlarmStatus[e])).toUpperCase().includes(n)})))}return c.of(r)},r.prototype.alarmStatusSelected=function(e){this.addAlarmStatus(e.option.value),this.clear("")},r.prototype.removeAlarmStatus=function(e){var t=this.alarmStatusConfigForm.get("alarmStatusList").value;if(t){var r=t.indexOf(e);r>=0&&(t.splice(r,1),this.alarmStatusConfigForm.get("alarmStatusList").setValue(t))}},r.prototype.addAlarmStatus=function(e){var t=this.alarmStatusConfigForm.get("alarmStatusList").value;t||(t=[]),-1===t.indexOf(e)&&(t.push(e),this.alarmStatusConfigForm.get("alarmStatusList").setValue(t))},r.prototype.getAlarmStatusList=function(){var e=this;return this.alarmStatusList.filter((function(t){return-1===e.alarmStatusConfigForm.get("alarmStatusList").value.indexOf(t)}))},r.prototype.onAlarmStatusInputFocus=function(){this.statusFormControl.updateValueAndValidity({onlySelf:!0,emitEvent:!0})},r.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this.alarmStatusInput.nativeElement.value=e,this.statusFormControl.patchValue(null,{emitEvent:!0}),setTimeout((function(){t.alarmStatusInput.nativeElement.blur(),t.alarmStatusInput.nativeElement.focus()}),0)},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:i.FormBuilder}]},h([t.ViewChild("alarmStatusInput",{static:!1}),C("design:type",t.ElementRef)],r.prototype,"alarmStatusInput",void 0),r=h([t.Component({selector:"tb-filter-node-check-alarm-status-config",template:'
\n \n tb.rulenode.alarm-status-filter\n \n \n \n {{alarmStatusTranslationsMap.get(alarmStatus) | translate}}\n \n close\n \n \n \n \n \n \n \n \n
\n
\n tb.rulenode.no-alarm-status-matching\n
\n
\n
\n
\n
\n \n
\n\n\n\n'}),C("design:paramtypes",[o.Store,n.TranslateService,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Pe=function(){function e(){}return e=h([t.NgModule({declarations:[Se,Ie,ke,Ne,Ve,Ee,Ae,Le],imports:[r.CommonModule,a.SharedModule,ue],exports:[Se,Ie,ke,Ne,Ve,Ee,Ae,Le]})],e)}(),Me=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.customerAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.customerAttributesConfigForm=this.fb.group({telemetry:[!!e&&e.telemetry,[]],attrMapping:[e?e.attrMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-customer-attributes-config",template:'
\n \n \n {{ \'tb.rulenode.latest-telemetry\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),we=function(e){function r(t,r,n){var a,o,l=e.call(this,t)||this;l.store=t,l.translate=r,l.fb=n,l.entityDetailsTranslationsMap=z,l.entityDetailsList=[],l.searchText="",l.displayDetailsFn=l.displayDetails.bind(l);try{for(var s=v(Object.keys(B)),m=s.next();!m.done;m=s.next()){var u=m.value;l.entityDetailsList.push(B[u])}}catch(e){a={error:e}}finally{try{m&&!m.done&&(o=s.return)&&o.call(s)}finally{if(a)throw a.error}}return l.detailsFormControl=new i.FormControl(""),l.filteredEntityDetails=l.detailsFormControl.valueChanges.pipe(f.startWith(""),f.map((function(e){return e||""})),f.mergeMap((function(e){return l.fetchEntityDetails(e)})),f.share()),l}return b(r,e),r.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this)},r.prototype.configForm=function(){return this.entityDetailsConfigForm},r.prototype.prepareInputConfig=function(e){return this.searchText="",this.detailsFormControl.patchValue("",{emitEvent:!0}),e},r.prototype.onConfigurationSet=function(e){this.entityDetailsConfigForm=this.fb.group({detailsList:[e?e.detailsList:null,[i.Validators.required]],addToMetadata:[!!e&&e.addToMetadata,[]]})},r.prototype.displayDetails=function(e){return e?this.translate.instant(z.get(e)):void 0},r.prototype.fetchEntityDetails=function(e){var t=this;if(this.searchText=e,this.searchText&&this.searchText.length){var r=this.searchText.toUpperCase();return c.of(this.entityDetailsList.filter((function(e){return t.translate.instant(z.get(B[e])).toUpperCase().includes(r)})))}return c.of(this.entityDetailsList)},r.prototype.detailsFieldSelected=function(e){this.addDetailsField(e.option.value),this.clear("")},r.prototype.removeDetailsField=function(e){var t=this.entityDetailsConfigForm.get("detailsList").value;if(t){var r=t.indexOf(e);r>=0&&(t.splice(r,1),this.entityDetailsConfigForm.get("detailsList").setValue(t))}},r.prototype.addDetailsField=function(e){var t=this.entityDetailsConfigForm.get("detailsList").value;t||(t=[]),-1===t.indexOf(e)&&(t.push(e),this.entityDetailsConfigForm.get("detailsList").setValue(t))},r.prototype.onEntityDetailsInputFocus=function(){this.detailsFormControl.updateValueAndValidity({onlySelf:!0,emitEvent:!0})},r.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this.detailsInput.nativeElement.value=e,this.detailsFormControl.patchValue(null,{emitEvent:!0}),setTimeout((function(){t.detailsInput.nativeElement.blur(),t.detailsInput.nativeElement.focus()}),0)},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:i.FormBuilder}]},h([t.ViewChild("detailsInput",{static:!1}),C("design:type",t.ElementRef)],r.prototype,"detailsInput",void 0),r=h([t.Component({selector:"tb-enrichment-node-entity-details-config",template:'
\n \n tb.rulenode.entity-details\n \n \n \n {{entityDetailsTranslationsMap.get(details) | translate}}\n \n close\n \n \n \n \n \n \n \n \n
\n
\n tb.rulenode.no-entity-details-matching\n
\n
\n
\n
\n
\n \n \n {{ \'tb.rulenode.add-to-metadata\' | translate }}\n \n
tb.rulenode.add-to-metadata-hint
\n
\n',styles:[":host ::ng-deep mat-form-field.entity-fields-list .mat-form-field-wrapper{margin-bottom:-1.25em}"]}),C("design:paramtypes",[o.Store,n.TranslateService,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Re=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.deviceAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.deviceAttributesConfigForm=this.fb.group({deviceRelationsQuery:[e?e.deviceRelationsQuery:null,[i.Validators.required]],tellFailureIfAbsent:[!!e&&e.tellFailureIfAbsent,[]],clientAttributeNames:[e?e.clientAttributeNames:null,[]],sharedAttributeNames:[e?e.sharedAttributeNames:null,[]],serverAttributeNames:[e?e.serverAttributeNames:null,[]],latestTsKeyNames:[e?e.latestTsKeyNames:null,[]],getLatestValueWithTs:[!!e&&e.getLatestValueWithTs,[]]})},r.prototype.removeKey=function(e,t){var r=this.deviceAttributesConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.deviceAttributesConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.deviceAttributesConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.deviceAttributesConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-device-attributes-config",template:'
\n \n \n \n \n {{ \'tb.rulenode.tell-failure-if-absent\' | translate }}\n \n
tb.rulenode.tell-failure-if-absent-hint
\n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n {{ \'tb.rulenode.get-latest-value-with-ts\' | translate }}\n \n
tb.rulenode.get-latest-value-with-ts-hint
\n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),De=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.originatorAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.originatorAttributesConfigForm=this.fb.group({tellFailureIfAbsent:[!!e&&e.tellFailureIfAbsent,[]],clientAttributeNames:[e?e.clientAttributeNames:null,[]],sharedAttributeNames:[e?e.sharedAttributeNames:null,[]],serverAttributeNames:[e?e.serverAttributeNames:null,[]],latestTsKeyNames:[e?e.latestTsKeyNames:null,[]],getLatestValueWithTs:[!!e&&e.getLatestValueWithTs,[]]})},r.prototype.removeKey=function(e,t){var r=this.originatorAttributesConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.originatorAttributesConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.originatorAttributesConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.originatorAttributesConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-originator-attributes-config",template:'
\n \n {{ \'tb.rulenode.tell-failure-if-absent\' | translate }}\n \n
tb.rulenode.tell-failure-if-absent-hint
\n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n {{ \'tb.rulenode.get-latest-value-with-ts\' | translate }}\n \n
tb.rulenode.get-latest-value-with-ts-hint
\n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Oe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.originatorFieldsConfigForm},r.prototype.onConfigurationSet=function(e){this.originatorFieldsConfigForm=this.fb.group({fieldsMapping:[e?e.fieldsMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-originator-fields-config",template:'
\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ke=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n.fetchMode=H,n.fetchModes=Object.keys(H),n.samplingOrders=Object.keys(U),n.timeUnits=Object.keys(R),n.timeUnitsTranslationMap=K,n}return b(r,e),r.prototype.configForm=function(){return this.getTelemetryFromDatabaseConfigForm},r.prototype.onConfigurationSet=function(e){this.getTelemetryFromDatabaseConfigForm=this.fb.group({latestTsKeyNames:[e?e.latestTsKeyNames:null,[]],fetchMode:[e?e.fetchMode:null,[i.Validators.required]],orderBy:[e?e.orderBy:null,[]],limit:[e?e.limit:null,[]],useMetadataIntervalPatterns:[!!e&&e.useMetadataIntervalPatterns,[]],startInterval:[e?e.startInterval:null,[]],startIntervalTimeUnit:[e?e.startIntervalTimeUnit:null,[]],endInterval:[e?e.endInterval:null,[]],endIntervalTimeUnit:[e?e.endIntervalTimeUnit:null,[]],startIntervalPattern:[e?e.startIntervalPattern:null,[]],endIntervalPattern:[e?e.endIntervalPattern:null,[]]})},r.prototype.validatorTriggers=function(){return["fetchMode","useMetadataIntervalPatterns"]},r.prototype.updateValidators=function(e){var t=this.getTelemetryFromDatabaseConfigForm.get("fetchMode").value,r=this.getTelemetryFromDatabaseConfigForm.get("useMetadataIntervalPatterns").value;t&&t===H.ALL?(this.getTelemetryFromDatabaseConfigForm.get("orderBy").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("limit").setValidators([i.Validators.required,i.Validators.min(2),i.Validators.max(1e3)])):(this.getTelemetryFromDatabaseConfigForm.get("orderBy").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("limit").setValidators([])),r?(this.getTelemetryFromDatabaseConfigForm.get("startInterval").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalTimeUnit").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("endInterval").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalTimeUnit").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalPattern").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalPattern").setValidators([i.Validators.required])):(this.getTelemetryFromDatabaseConfigForm.get("startInterval").setValidators([i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalTimeUnit").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("endInterval").setValidators([i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalTimeUnit").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalPattern").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalPattern").setValidators([])),this.getTelemetryFromDatabaseConfigForm.get("orderBy").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("limit").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("startInterval").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("startIntervalTimeUnit").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("endInterval").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("endIntervalTimeUnit").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("startIntervalPattern").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("endIntervalPattern").updateValueAndValidity({emitEvent:e})},r.prototype.removeKey=function(e,t){var r=this.getTelemetryFromDatabaseConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.getTelemetryFromDatabaseConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.getTelemetryFromDatabaseConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.getTelemetryFromDatabaseConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-get-telemetry-from-database",template:'
\n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n tb.rulenode.fetch-mode\n \n \n {{ mode }}\n \n \n tb.rulenode.fetch-mode-hint\n \n
\n \n tb.rulenode.order-by\n \n \n {{ order }}\n \n \n tb.rulenode.order-by-hint\n \n \n tb.rulenode.limit\n \n tb.rulenode.limit-hint\n \n
\n \n {{ \'tb.rulenode.use-metadata-interval-patterns\' | translate }}\n \n
tb.rulenode.use-metadata-interval-patterns-hint
\n
\n
\n \n tb.rulenode.start-interval\n \n \n {{ \'tb.rulenode.start-interval-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.start-interval-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n \n tb.rulenode.end-interval\n \n \n {{ \'tb.rulenode.end-interval-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.end-interval-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n \n \n tb.rulenode.start-interval-pattern\n \n \n {{ \'tb.rulenode.start-interval-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.end-interval-pattern\n \n \n {{ \'tb.rulenode.end-interval-pattern-required\' | translate }}\n \n \n \n \n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Be=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.relatedAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.relatedAttributesConfigForm=this.fb.group({relationsQuery:[e?e.relationsQuery:null,[i.Validators.required]],telemetry:[!!e&&e.telemetry,[]],attrMapping:[e?e.attrMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-related-attributes-config",template:'
\n \n \n \n \n \n {{ \'tb.rulenode.latest-telemetry\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ge=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.tenantAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.tenantAttributesConfigForm=this.fb.group({telemetry:[!!e&&e.telemetry,[]],attrMapping:[e?e.attrMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-tenant-attributes-config",template:'
\n \n \n {{ \'tb.rulenode.latest-telemetry\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),He=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.calculateDeltaConfigForm},r.prototype.onConfigurationSet=function(e){this.calculateDeltaConfigForm=this.fb.group({inputValueKey:[e?e.inputValueKey:null,[i.Validators.required]],outputValueKey:[e?e.outputValueKey:null,[i.Validators.required]],useCache:[e?e.useCache:null,[]],addPeriodBetweenMsgs:[!!e&&e.addPeriodBetweenMsgs,[]],periodValueKey:[e?e.periodValueKey:null,[]],round:[e?e.round:null,[i.Validators.min(0),i.Validators.max(15)]],tellFailureIfInputValueKeyIsAbsent:[e?e.tellFailureIfInputValueKeyIsAbsent:null,[]],tellFailureIfDeltaIsNegative:[e?e.tellFailureIfDeltaIsNegative:null,[]]})},r.prototype.updateValidators=function(e){this.calculateDeltaConfigForm.get("addPeriodBetweenMsgs").value?this.calculateDeltaConfigForm.get("periodValueKey").setValidators([i.Validators.required]):this.calculateDeltaConfigForm.get("periodValueKey").setValidators([]),this.calculateDeltaConfigForm.get("periodValueKey").updateValueAndValidity({emitEvent:e})},r.prototype.validatorTriggers=function(){return["addPeriodBetweenMsgs"]},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-calculate-delta-config",template:'
\n
\n \n tb.rulenode.input-value-key\n \n \n {{ \'tb.rulenode.input-value-key-required\' | translate }}\n \n \n \n tb.rulenode.output-value-key\n \n \n {{ \'tb.rulenode.output-value-key-required\' | translate }}\n \n \n \n tb.rulenode.round\n \n \n {{ \'tb.rulenode.round-range\' | translate }}\n \n \n {{ \'tb.rulenode.round-range\' | translate }}\n \n \n
\n \n {{ \'tb.rulenode.use-cache\' | translate }}\n \n \n {{ \'tb.rulenode.tell-failure-if-input-value-key-is-absent\' | translate }}\n \n \n {{ \'tb.rulenode.tell-failure-if-delta-is-negative\' | translate }}\n \n \n {{ \'tb.rulenode.add-period-between-msgs\' | translate }}\n \n \n tb.rulenode.period-value-key\n \n \n {{ \'tb.rulenode.period-value-key-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ue=function(){function e(){}return e=h([t.NgModule({declarations:[Me,we,Re,De,Oe,Ke,Be,Ge,He],imports:[r.CommonModule,a.SharedModule,ue],exports:[Me,we,Re,De,Oe,Ke,Be,Ge,He]})],e)}(),je=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.originatorSource=F,n.originatorSources=Object.keys(F),n.originatorSourceTranslationMap=w,n}return b(r,e),r.prototype.configForm=function(){return this.changeOriginatorConfigForm},r.prototype.onConfigurationSet=function(e){this.changeOriginatorConfigForm=this.fb.group({originatorSource:[e?e.originatorSource:null,[i.Validators.required]],relationsQuery:[e?e.relationsQuery:null,[]]})},r.prototype.validatorTriggers=function(){return["originatorSource"]},r.prototype.updateValidators=function(e){var t=this.changeOriginatorConfigForm.get("originatorSource").value;t&&t===F.RELATED?this.changeOriginatorConfigForm.get("relationsQuery").setValidators([i.Validators.required]):this.changeOriginatorConfigForm.get("relationsQuery").setValidators([]),this.changeOriginatorConfigForm.get("relationsQuery").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-transformation-node-change-originator-config",template:'
\n \n tb.rulenode.originator-source\n \n \n {{ originatorSourceTranslationMap.get(source) | translate }}\n \n \n \n
\n \n \n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ze=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.scriptConfigForm},r.prototype.onConfigurationSet=function(e){this.scriptConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.scriptConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"update",this.translate.instant("tb.rulenode.transformer"),"Transform",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.scriptConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-transformation-node-script-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),Qe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.toEmailConfigForm},r.prototype.onConfigurationSet=function(e){this.toEmailConfigForm=this.fb.group({fromTemplate:[e?e.fromTemplate:null,[i.Validators.required]],toTemplate:[e?e.toTemplate:null,[i.Validators.required]],ccTemplate:[e?e.ccTemplate:null,[]],bccTemplate:[e?e.bccTemplate:null,[]],subjectTemplate:[e?e.subjectTemplate:null,[i.Validators.required]],bodyTemplate:[e?e.bodyTemplate:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-transformation-node-to-email-config",template:'
\n \n tb.rulenode.from-template\n \n \n {{ \'tb.rulenode.from-template-required\' | translate }}\n \n \n \n \n tb.rulenode.to-template\n \n \n {{ \'tb.rulenode.to-template-required\' | translate }}\n \n \n \n \n tb.rulenode.cc-template\n \n \n \n \n tb.rulenode.bcc-template\n \n \n \n \n tb.rulenode.subject-template\n \n \n {{ \'tb.rulenode.subject-template-required\' | translate }}\n \n \n \n \n tb.rulenode.body-template\n \n \n {{ \'tb.rulenode.body-template-required\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),_e=function(){function e(){}return e=h([t.NgModule({declarations:[je,ze,Qe],imports:[r.CommonModule,a.SharedModule,ue],exports:[je,ze,Qe]})],e)}(),$e=function(){function e(e){!function(e){e.setTranslation("en_US",{tb:{rulenode:{"create-entity-if-not-exists":"Create new entity if not exists","create-entity-if-not-exists-hint":"Create a new entity set above if it does not exist.","entity-name-pattern":"Name pattern","entity-name-pattern-required":"Name pattern is required","entity-type-pattern":"Type pattern","entity-type-pattern-required":"Type pattern is required","entity-cache-expiration":"Entities cache expiration time (sec)","entity-cache-expiration-hint":"Specifies maximum time interval allowed to store found entity records. 0 value means that records will never expire.","entity-cache-expiration-required":"Entities cache expiration time is required.","entity-cache-expiration-range":"Entities cache expiration time should be greater than or equal to 0.","customer-name-pattern":"Customer name pattern","customer-name-pattern-required":"Customer name pattern is required","create-customer-if-not-exists":"Create new customer if not exists","customer-cache-expiration":"Customers cache expiration time (sec)","customer-cache-expiration-hint":"Specifies maximum time interval allowed to store found customer records. 0 value means that records will never expire.","customer-cache-expiration-required":"Customers cache expiration time is required.","customer-cache-expiration-range":"Customers cache expiration time should be greater than or equal to 0.","start-interval":"Start Interval","end-interval":"End Interval","start-interval-time-unit":"Start Interval Time Unit","end-interval-time-unit":"End Interval Time Unit","fetch-mode":"Fetch mode","fetch-mode-hint":"If selected fetch mode 'ALL' you able to choose telemetry sampling order.","order-by":"Order by","order-by-hint":"Select to choose telemetry sampling order.",limit:"Limit","limit-hint":"Min limit value is 2, max - 1000. In case you want to fetch a single entry, select fetch mode 'FIRST' or 'LAST'.","time-unit-milliseconds":"Milliseconds","time-unit-seconds":"Seconds","time-unit-minutes":"Minutes","time-unit-hours":"Hours","time-unit-days":"Days","time-value-range":"Time value should be in a range from 1 to 2147483647.","start-interval-value-required":"Start interval value is required.","end-interval-value-required":"End interval value is required.",filter:"Filter",switch:"Switch","message-type":"Message type","message-type-required":"Message type is required.","message-types-filter":"Message types filter","no-message-types-found":"No message types found","no-message-type-matching":"'{{messageType}}' not found.","create-new-message-type":"Create a new one!","message-types-required":"Message types are required.","client-attributes":"Client attributes","shared-attributes":"Shared attributes","server-attributes":"Server attributes","notify-device":"Notify Device","notify-device-hint":"If the message arrives from the device, we will push it back to the device by default.","latest-timeseries":"Latest timeseries","data-keys":"Message data","metadata-keys":"Message metadata","relations-query":"Relations query","device-relations-query":"Device relations query","max-relation-level":"Max relation level","relation-type-pattern":"Relation type pattern","relation-type-pattern-required":"Relation type pattern is required","relation-types-list":"Relation types to propagate","relation-types-list-hint":"If Propagate relation types are not selected, alarms will be propagated without filtering by relation type.","unlimited-level":"Unlimited level","latest-telemetry":"Latest telemetry","attr-mapping":"Attributes mapping","source-attribute":"Source attribute","source-attribute-required":"Source attribute is required.","source-telemetry":"Source telemetry","source-telemetry-required":"Source telemetry is required.","target-attribute":"Target attribute","target-attribute-required":"Target attribute is required.","attr-mapping-required":"At least one attribute mapping should be specified.","fields-mapping":"Fields mapping","fields-mapping-required":"At least one field mapping should be specified.","source-field":"Source field","source-field-required":"Source field is required.","originator-source":"Originator source","originator-customer":"Customer","originator-tenant":"Tenant","originator-related":"Related","originator-alarm-originator":"Alarm Originator","clone-message":"Clone message",transform:"Transform","default-ttl":"Default TTL in seconds","default-ttl-required":"Default TTL is required.","min-default-ttl-message":"Only 0 minimum TTL is allowed.","message-count":"Message count (0 - unlimited)","message-count-required":"Message count is required.","min-message-count-message":"Only 0 minimum message count is allowed.","period-seconds":"Period in seconds","period-seconds-required":"Period is required.","use-metadata-period-in-seconds-patterns":"Use period in seconds pattern","use-metadata-period-in-seconds-patterns-hint":"If selected, rule node use period in seconds interval pattern from message metadata or data assuming that intervals are in the seconds.","period-in-seconds-pattern":"Period in seconds pattern","period-in-seconds-pattern-required":"Period in seconds pattern is required","min-period-seconds-message":"Only 1 second minimum period is allowed.",originator:"Originator","message-body":"Message body","message-metadata":"Message metadata",generate:"Generate","test-generator-function":"Test generator function",generator:"Generator","test-filter-function":"Test filter function","test-switch-function":"Test switch function","test-transformer-function":"Test transformer function",transformer:"Transformer","alarm-create-condition":"Alarm create condition","test-condition-function":"Test condition function","alarm-clear-condition":"Alarm clear condition","alarm-details-builder":"Alarm details builder","test-details-function":"Test details function","alarm-type":"Alarm type","alarm-type-required":"Alarm type is required.","alarm-severity":"Alarm severity","alarm-severity-required":"Alarm severity is required","alarm-status-filter":"Alarm status filter","alarm-status-list-empty":"Alarm status list is empty","no-alarm-status-matching":"No alarm status matching were found.",propagate:"Propagate",condition:"Condition",details:"Details","to-string":"To string","test-to-string-function":"Test to string function","from-template":"From Template","from-template-required":"From Template is required","to-template":"To Template","to-template-required":"To Template is required","mail-address-list-template-hint":'Comma separated address list, use ${metadataKey} for value from metadata, $[messageKey] for value from message body',"cc-template":"Cc Template","bcc-template":"Bcc Template","subject-template":"Subject Template","subject-template-required":"Subject Template is required","body-template":"Body Template","body-template-required":"Body Template is required","request-id-metadata-attribute":"Request Id Metadata attribute name","timeout-sec":"Timeout in seconds","timeout-required":"Timeout is required","min-timeout-message":"Only 0 minimum timeout value is allowed.","endpoint-url-pattern":"Endpoint URL pattern","endpoint-url-pattern-required":"Endpoint URL pattern is required","request-method":"Request method","use-simple-client-http-factory":"Use simple client HTTP factory","read-timeout":"Read timeout in millis","read-timeout-hint":"The value of 0 means an infinite timeout","max-parallel-requests-count":"Max number of parallel requests","max-parallel-requests-count-hint":"The value of 0 specifies no limit in parallel processing",headers:"Headers","headers-hint":'Use ${metadataKey} for value from metadata, $[messageKey] for value from message body in header/value fields',header:"Header","header-required":"Header is required",value:"Value","value-required":"Value is required","topic-pattern":"Topic pattern","topic-pattern-required":"Topic pattern is required",topic:"Topic","topic-required":"Topic is required","bootstrap-servers":"Bootstrap servers","bootstrap-servers-required":"Bootstrap servers value is required","other-properties":"Other properties",key:"Key","key-required":"Key is required",retries:"Automatically retry times if fails","min-retries-message":"Only 0 minimum retries is allowed.","batch-size-bytes":"Produces batch size in bytes","min-batch-size-bytes-message":"Only 0 minimum batch size is allowed.","linger-ms":"Time to buffer locally (ms)","min-linger-ms-message":"Only 0 ms minimum value is allowed.","buffer-memory-bytes":"Client buffer max size in bytes","min-buffer-memory-message":"Only 0 minimum buffer size is allowed.",acks:"Number of acknowledgments","key-serializer":"Key serializer","key-serializer-required":"Key serializer is required","value-serializer":"Value serializer","value-serializer-required":"Value serializer is required","topic-arn-pattern":"Topic ARN pattern","topic-arn-pattern-required":"Topic ARN pattern is required","aws-access-key-id":"AWS Access Key ID","aws-access-key-id-required":"AWS Access Key ID is required","aws-secret-access-key":"AWS Secret Access Key","aws-secret-access-key-required":"AWS Secret Access Key is required","aws-region":"AWS Region","aws-region-required":"AWS Region is required","exchange-name-pattern":"Exchange name pattern","routing-key-pattern":"Routing key pattern","message-properties":"Message properties",host:"Host","host-required":"Host is required",port:"Port","port-required":"Port is required","port-range":"Port should be in a range from 1 to 65535.","virtual-host":"Virtual host",username:"Username",password:"Password","automatic-recovery":"Automatic recovery","connection-timeout-ms":"Connection timeout (ms)","min-connection-timeout-ms-message":"Only 0 ms minimum value is allowed.","handshake-timeout-ms":"Handshake timeout (ms)","min-handshake-timeout-ms-message":"Only 0 ms minimum value is allowed.","client-properties":"Client properties","queue-url-pattern":"Queue URL pattern","queue-url-pattern-required":"Queue URL pattern is required","delay-seconds":"Delay (seconds)","min-delay-seconds-message":"Only 0 seconds minimum value is allowed.","max-delay-seconds-message":"Only 900 seconds maximum value is allowed.",name:"Name","name-required":"Name is required","queue-type":"Queue type","sqs-queue-standard":"Standard","sqs-queue-fifo":"FIFO","gcp-project-id":"GCP project ID","gcp-project-id-required":"GCP project ID is required","gcp-service-account-key":"GCP service account key file","gcp-service-account-key-required":"GCP service account key file is required","pubsub-topic-name":"Topic name","pubsub-topic-name-required":"Topic name is required","message-attributes":"Message attributes","message-attributes-hint":'Use ${metadataKey} for value from metadata, $[messageKey] for value from message body in name/value fields',"connect-timeout":"Connection timeout (sec)","connect-timeout-required":"Connection timeout is required.","connect-timeout-range":"Connection timeout should be in a range from 1 to 200.","client-id":"Client ID","device-id":"Device ID","device-id-required":"Device ID is required.","clean-session":"Clean session","enable-ssl":"Enable SSL",credentials:"Credentials","credentials-type":"Credentials type","credentials-type-required":"Credentials type is required.","credentials-anonymous":"Anonymous","credentials-basic":"Basic","credentials-pem":"PEM","credentials-pem-hint":"At least Server CA certificate file or a pair of Client certificate and Client private key files are required","credentials-sas":"Shared Access Signature","sas-key":"SAS Key","sas-key-required":"SAS Key is required.",hostname:"Hostname","hostname-required":"Hostname is required.","azure-ca-cert":"CA certificate file","username-required":"Username is required.","password-required":"Password is required.","ca-cert":"Server CA certificate file *","private-key":"Client private key file *",cert:"Client certificate file *","no-file":"No file selected.","drop-file":"Drop a file or click to select a file to upload.","private-key-password":"Private key password","use-system-smtp-settings":"Use system SMTP settings","use-metadata-interval-patterns":"Use interval patterns","use-metadata-interval-patterns-hint":"If selected, rule node use start and end interval patterns from message metadata or data assuming that intervals are in the milliseconds.","use-message-alarm-data":"Use message alarm data","check-all-keys":"Check that all selected keys are present","check-all-keys-hint":"If selected, checks that all specified keys are present in the message data and metadata.","check-relation-to-specific-entity":"Check relation to specific entity","check-relation-hint":"Checks existence of relation to specific entity or to any entity based on direction and relation type.","delete-relation-to-specific-entity":"Delete relation to specific entity","delete-relation-hint":"Deletes relation from the originator of the incoming message to the specified entity or list of entities based on direction and type.","remove-current-relations":"Remove current relations","remove-current-relations-hint":"Removes current relations from the originator of the incoming message based on direction and type.","change-originator-to-related-entity":"Change originator to related entity","change-originator-to-related-entity-hint":"Used to process submitted message as a message from another entity.","start-interval-pattern":"Start interval pattern","end-interval-pattern":"End interval pattern","start-interval-pattern-required":"Start interval pattern is required","end-interval-pattern-required":"End interval pattern is required","smtp-protocol":"Protocol","smtp-host":"SMTP host","smtp-host-required":"SMTP host is required.","smtp-port":"SMTP port","smtp-port-required":"You must supply a smtp port.","smtp-port-range":"SMTP port should be in a range from 1 to 65535.","timeout-msec":"Timeout ms","min-timeout-msec-message":"Only 0 ms minimum value is allowed.","enter-username":"Enter username","enter-password":"Enter password","enable-tls":"Enable TLS","tls-version":"TLS version","enable-proxy":"Enable proxy","use-system-proxy-properties":"Use system proxy properties","proxy-host":"Proxy host","proxy-host-required":"Proxy host is required.","proxy-port":"Proxy port","proxy-port-required":"Proxy port is required.","proxy-port-range":"Proxy port should be in a range from 1 to 65535.","proxy-user":"Proxy user","proxy-password":"Proxy password","proxy-scheme":"Proxy scheme","numbers-to-template":"Phone Numbers To Template","numbers-to-template-required":"Phone Numbers To Template is required","numbers-to-template-hint":'Comma separated Phone Numbers, use ${metadataKey} for value from metadata, $[messageKey] for value from message body',"sms-message-template":"SMS message Template","sms-message-template-required":"SMS message Template is required","use-system-sms-settings":"Use system SMS provider settings","min-period-0-seconds-message":"Only 0 second minimum period is allowed.","max-pending-messages":"Maximum pending messages","max-pending-messages-required":"Maximum pending messages is required.","max-pending-messages-range":"Maximum pending messages should be in a range from 1 to 100000.","originator-types-filter":"Originator types filter","interval-seconds":"Interval in seconds","interval-seconds-required":"Interval is required.","min-interval-seconds-message":"Only 1 second minimum interval is allowed.","output-timeseries-key-prefix":"Output timeseries key prefix","output-timeseries-key-prefix-required":"Output timeseries key prefix required.","separator-hint":'You should press "enter" to complete field input.',"entity-details":"Select entity details:","entity-details-title":"Title","entity-details-country":"Country","entity-details-state":"State","entity-details-zip":"Zip","entity-details-address":"Address","entity-details-address2":"Address2","entity-details-additional_info":"Additional Info","entity-details-phone":"Phone","entity-details-email":"Email","add-to-metadata":"Add selected details to message metadata","add-to-metadata-hint":"If selected, adds the selected details keys to the message metadata instead of message data.","entity-details-list-empty":"No entity details selected.","no-entity-details-matching":"No entity details matching were found.","custom-table-name":"Custom table name","custom-table-name-required":"Table Name is required","custom-table-hint":"You should enter the table name without prefix 'cs_tb_'.","message-field":"Message field","message-field-required":"Message field is required.","table-col":"Table column","table-col-required":"Table column is required.","latitude-key-name":"Latitude key name","longitude-key-name":"Longitude key name","latitude-key-name-required":"Latitude key name is required.","longitude-key-name-required":"Longitude key name is required.","fetch-perimeter-info-from-message-metadata":"Fetch perimeter information from message metadata","perimeter-circle":"Circle","perimeter-polygon":"Polygon","perimeter-type":"Perimeter type","circle-center-latitude":"Center latitude","circle-center-latitude-required":"Center latitude is required.","circle-center-longitude":"Center longitude","circle-center-longitude-required":"Center longitude is required.","range-unit-meter":"Meter","range-unit-kilometer":"Kilometer","range-unit-foot":"Foot","range-unit-mile":"Mile","range-unit-nautical-mile":"Nautical mile","range-units":"Range units",range:"Range","range-required":"Range is required.","polygon-definition":"Polygon definition","polygon-definition-required":"Polygon definition is required.","polygon-definition-hint":"Please, use the following format for manual definition of polygon: [[lat1,lon1],[lat2,lon2], ... ,[latN,lonN]].","min-inside-duration":"Minimal inside duration","min-inside-duration-value-required":"Minimal inside duration is required","min-inside-duration-time-unit":"Minimal inside duration time unit","min-outside-duration":"Minimal outside duration","min-outside-duration-value-required":"Minimal outside duration is required","min-outside-duration-time-unit":"Minimal outside duration time unit","tell-failure-if-absent":"Tell Failure","tell-failure-if-absent-hint":'If at least one selected key doesn\'t exist the outbound message will report "Failure".',"get-latest-value-with-ts":"Fetch Latest telemetry with Timestamp","get-latest-value-with-ts-hint":'If selected, latest telemetry values will be added to the outbound message metadata with timestamp, e.g: "temp": "{\\"ts\\":1574329385897,\\"value\\":42}"',"use-redis-queue":"Use redis queue for message persistence","trim-redis-queue":"Trim redis queue","redis-queue-max-size":"Redis queue max size","add-metadata-key-values-as-kafka-headers":"Add Message metadata key-value pairs to Kafka record headers","add-metadata-key-values-as-kafka-headers-hint":"If selected, key-value pairs from message metadata will be added to the outgoing records headers as byte arrays with predefined charset encoding.","charset-encoding":"Charset encoding","charset-encoding-required":"Charset encoding is required.","charset-us-ascii":"US-ASCII","charset-iso-8859-1":"ISO-8859-1","charset-utf-8":"UTF-8","charset-utf-16be":"UTF-16BE","charset-utf-16le":"UTF-16LE","charset-utf-16":"UTF-16","select-queue-hint":"The queue name can be selected from a drop-down list or add a custom name.","persist-alarm-rules":"Persist state of alarm rules","fetch-alarm-rules":"Fetch state of alarm rules","input-value-key":"Input value key","input-value-key-required":"Input value key is required.","output-value-key":"Output value key","output-value-key-required":"Output value key is required.",round:"Decimals","round-range":"Decimals should be in a range from 0 to 15.","use-cache":"Use cache for latest value","tell-failure-if-input-value-key-is-absent":"Tell Failure if input value key is absent","tell-failure-if-delta-is-negative":"Tell Failure if delta is negative","add-period-between-msgs":"Add period between messages","period-value-key":"Period value key","period-key-required":"Period value key is required.","general-pattern-hint":'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body'},"key-val":{key:"Key",value:"Value","remove-entry":"Remove entry","add-entry":"Add entry"}}},!0)}(e)}return e.ctorParameters=function(){return[{type:n.TranslateService}]},e=h([t.NgModule({declarations:[x],imports:[r.CommonModule,a.SharedModule],exports:[qe,Pe,Ue,_e,x]}),C("design:paramtypes",[n.TranslateService])],e)}();e.RuleNodeCoreConfigModule=$e,e.ɵa=x,e.ɵb=qe,e.ɵba=ve,e.ɵbb=Fe,e.ɵbc=xe,e.ɵbd=Te,e.ɵbe=ue,e.ɵbf=ae,e.ɵbg=oe,e.ɵbh=ie,e.ɵbi=le,e.ɵbj=se,e.ɵbk=me,e.ɵbl=Pe,e.ɵbm=Se,e.ɵbn=Ie,e.ɵbo=ke,e.ɵbp=Ne,e.ɵbq=Ve,e.ɵbr=Ee,e.ɵbs=Ae,e.ɵbt=Le,e.ɵbu=Ue,e.ɵbv=Me,e.ɵbw=we,e.ɵbx=Re,e.ɵby=De,e.ɵbz=Oe,e.ɵc=T,e.ɵca=Ke,e.ɵcb=Be,e.ɵcc=Ge,e.ɵcd=He,e.ɵce=_e,e.ɵcf=je,e.ɵcg=ze,e.ɵch=Qe,e.ɵd=q,e.ɵe=S,e.ɵf=I,e.ɵg=k,e.ɵh=N,e.ɵi=V,e.ɵj=E,e.ɵk=A,e.ɵl=L,e.ɵm=P,e.ɵn=ee,e.ɵo=te,e.ɵp=re,e.ɵq=ne,e.ɵr=de,e.ɵs=pe,e.ɵt=ce,e.ɵu=fe,e.ɵv=ge,e.ɵw=ye,e.ɵx=be,e.ɵy=he,e.ɵz=Ce,Object.defineProperty(e,"__esModule",{value:!0})})); + ***************************************************************************** */var y=function(e,t){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function h(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function C(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;function v(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}Object.create;var F,x=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.emptyConfigForm},r.prototype.onConfigurationSet=function(e){this.emptyConfigForm=this.fb.group({})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-node-empty-config",template:"
"}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),T=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.attributeScopes=Object.keys(a.AttributeScope),n.telemetryTypeTranslationsMap=a.telemetryTypeTranslations,n}return b(r,e),r.prototype.configForm=function(){return this.attributesConfigForm},r.prototype.onConfigurationSet=function(e){this.attributesConfigForm=this.fb.group({scope:[e?e.scope:null,[i.Validators.required]],notifyDevice:[!e||e.scope,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-attributes-config",template:'
\n \n attribute.attributes-scope\n \n \n {{ telemetryTypeTranslationsMap.get(scope) | translate }}\n \n \n \n
\n \n {{ \'tb.rulenode.notify-device\' | translate }}\n \n
tb.rulenode.notify-device-hint
\n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),q=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.timeseriesConfigForm},r.prototype.onConfigurationSet=function(e){this.timeseriesConfigForm=this.fb.group({defaultTTL:[e?e.defaultTTL:null,[i.Validators.required,i.Validators.min(0)]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-timeseries-config",template:'
\n \n tb.rulenode.default-ttl\n \n \n {{ \'tb.rulenode.default-ttl-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-default-ttl-message\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),S=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.rpcRequestConfigForm},r.prototype.onConfigurationSet=function(e){this.rpcRequestConfigForm=this.fb.group({timeoutInSeconds:[e?e.timeoutInSeconds:null,[i.Validators.required,i.Validators.min(0)]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rpc-request-config",template:'
\n \n tb.rulenode.timeout-sec\n \n \n {{ \'tb.rulenode.timeout-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-timeout-message\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),I=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.logConfigForm},r.prototype.onConfigurationSet=function(e){this.logConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.logConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"string",this.translate.instant("tb.rulenode.to-string"),"ToString",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.logConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-log-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),k=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.assignCustomerConfigForm},r.prototype.onConfigurationSet=function(e){this.assignCustomerConfigForm=this.fb.group({customerNamePattern:[e?e.customerNamePattern:null,[i.Validators.required,i.Validators.pattern(/.*\S.*/)]],createCustomerIfNotExists:[!!e&&e.createCustomerIfNotExists,[]],customerCacheExpiration:[e?e.customerCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.prototype.prepareOutputConfig=function(e){return e.customerNamePattern=e.customerNamePattern.trim(),e},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-assign-to-customer-config",template:'
\n \n tb.rulenode.customer-name-pattern\n \n \n {{ \'tb.rulenode.customer-name-pattern-required\' | translate }}\n \n \n \n \n {{ \'tb.rulenode.create-customer-if-not-exists\' | translate }}\n \n \n tb.rulenode.customer-cache-expiration\n \n \n {{ \'tb.rulenode.customer-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.customer-cache-expiration-range\' | translate }}\n \n tb.rulenode.customer-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),N=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.clearAlarmConfigForm},r.prototype.onConfigurationSet=function(e){this.clearAlarmConfigForm=this.fb.group({alarmDetailsBuildJs:[e?e.alarmDetailsBuildJs:null,[i.Validators.required]],alarmType:[e?e.alarmType:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.clearAlarmConfigForm.get("alarmDetailsBuildJs").value;this.nodeScriptTestService.testNodeScript(t,"json",this.translate.instant("tb.rulenode.details"),"Details",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.clearAlarmConfigForm.get("alarmDetailsBuildJs").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-clear-alarm-config",template:'
\n \n \n \n
\n \n
\n \n tb.rulenode.alarm-type\n \n \n {{ \'tb.rulenode.alarm-type-required\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),V=function(e){function r(t,r,n,o){var i=e.call(this,t)||this;return i.store=t,i.fb=r,i.nodeScriptTestService=n,i.translate=o,i.alarmSeverities=Object.keys(a.AlarmSeverity),i.alarmSeverityTranslationMap=a.alarmSeverityTranslations,i.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],i}return b(r,e),r.prototype.configForm=function(){return this.createAlarmConfigForm},r.prototype.onConfigurationSet=function(e){this.createAlarmConfigForm=this.fb.group({alarmDetailsBuildJs:[e?e.alarmDetailsBuildJs:null,[i.Validators.required]],useMessageAlarmData:[!!e&&e.useMessageAlarmData,[]],alarmType:[e?e.alarmType:null,[]],severity:[e?e.severity:null,[]],propagate:[!!e&&e.propagate,[]],relationTypes:[e?e.relationTypes:null,[]]})},r.prototype.validatorTriggers=function(){return["useMessageAlarmData"]},r.prototype.updateValidators=function(e){this.createAlarmConfigForm.get("useMessageAlarmData").value?(this.createAlarmConfigForm.get("alarmType").setValidators([]),this.createAlarmConfigForm.get("severity").setValidators([])):(this.createAlarmConfigForm.get("alarmType").setValidators([i.Validators.required]),this.createAlarmConfigForm.get("severity").setValidators([i.Validators.required])),this.createAlarmConfigForm.get("alarmType").updateValueAndValidity({emitEvent:e}),this.createAlarmConfigForm.get("severity").updateValueAndValidity({emitEvent:e})},r.prototype.testScript=function(){var e=this,t=this.createAlarmConfigForm.get("alarmDetailsBuildJs").value;this.nodeScriptTestService.testNodeScript(t,"json",this.translate.instant("tb.rulenode.details"),"Details",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.createAlarmConfigForm.get("alarmDetailsBuildJs").setValue(t)}))},r.prototype.removeKey=function(e,t){var r=this.createAlarmConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.createAlarmConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.createAlarmConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.createAlarmConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-create-alarm-config",template:'
\n \n \n \n
\n \n
\n \n {{ \'tb.rulenode.use-message-alarm-data\' | translate }}\n \n
\n
\n \n tb.rulenode.alarm-type\n \n \n {{ \'tb.rulenode.alarm-type-required\' | translate }}\n \n \n \n \n tb.rulenode.alarm-severity\n \n \n {{ alarmSeverityTranslationMap.get(severity) | translate }}\n \n \n \n {{ \'tb.rulenode.alarm-severity-required\' | translate }}\n \n \n
\n \n {{ \'tb.rulenode.propagate\' | translate }}\n \n
\n \n tb.rulenode.relation-types-list\n \n \n {{key}}\n close\n \n \n \n tb.rulenode.relation-types-list-hint\n \n
\n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),E=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.entityType=a.EntityType,n}return b(r,e),r.prototype.configForm=function(){return this.createRelationConfigForm},r.prototype.onConfigurationSet=function(e){this.createRelationConfigForm=this.fb.group({direction:[e?e.direction:null,[i.Validators.required]],entityType:[e?e.entityType:null,[i.Validators.required]],entityNamePattern:[e?e.entityNamePattern:null,[]],entityTypePattern:[e?e.entityTypePattern:null,[]],relationType:[e?e.relationType:null,[i.Validators.required]],createEntityIfNotExists:[!!e&&e.createEntityIfNotExists,[]],removeCurrentRelations:[!!e&&e.removeCurrentRelations,[]],changeOriginatorToRelatedEntity:[!!e&&e.changeOriginatorToRelatedEntity,[]],entityCacheExpiration:[e?e.entityCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.prototype.validatorTriggers=function(){return["entityType"]},r.prototype.updateValidators=function(e){var t=this.createRelationConfigForm.get("entityType").value;t?this.createRelationConfigForm.get("entityNamePattern").setValidators([i.Validators.required,i.Validators.pattern(/.*\S.*/)]):this.createRelationConfigForm.get("entityNamePattern").setValidators([]),!t||t!==a.EntityType.DEVICE&&t!==a.EntityType.ASSET?this.createRelationConfigForm.get("entityTypePattern").setValidators([]):this.createRelationConfigForm.get("entityTypePattern").setValidators([i.Validators.required,i.Validators.pattern(/.*\S.*/)]),this.createRelationConfigForm.get("entityNamePattern").updateValueAndValidity({emitEvent:e}),this.createRelationConfigForm.get("entityTypePattern").updateValueAndValidity({emitEvent:e})},r.prototype.prepareOutputConfig=function(e){return e.entityNamePattern=e.entityNamePattern?e.entityNamePattern.trim():null,e.entityTypePattern=e.entityTypePattern?e.entityTypePattern.trim():null,e},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-create-relation-config",template:'
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n
\n \n \n \n tb.rulenode.entity-name-pattern\n \n \n {{ \'tb.rulenode.entity-name-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.entity-type-pattern\n \n \n {{ \'tb.rulenode.entity-type-pattern-required\' | translate }}\n \n \n \n
\n \n tb.rulenode.relation-type-pattern\n \n \n {{ \'tb.rulenode.relation-type-pattern-required\' | translate }}\n \n \n \n
\n \n {{ \'tb.rulenode.create-entity-if-not-exists\' | translate }}\n \n
tb.rulenode.create-entity-if-not-exists-hint
\n
\n \n {{ \'tb.rulenode.remove-current-relations\' | translate }}\n \n
tb.rulenode.remove-current-relations-hint
\n \n {{ \'tb.rulenode.change-originator-to-related-entity\' | translate }}\n \n
tb.rulenode.change-originator-to-related-entity-hint
\n \n tb.rulenode.entity-cache-expiration\n \n \n {{ \'tb.rulenode.entity-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.entity-cache-expiration-range\' | translate }}\n \n tb.rulenode.entity-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),A=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.msgDelayConfigForm},r.prototype.onConfigurationSet=function(e){this.msgDelayConfigForm=this.fb.group({useMetadataPeriodInSecondsPatterns:[!!e&&e.useMetadataPeriodInSecondsPatterns,[]],periodInSeconds:[e?e.periodInSeconds:null,[]],periodInSecondsPattern:[e?e.periodInSecondsPattern:null,[]],maxPendingMsgs:[e?e.maxPendingMsgs:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(1e5)]]})},r.prototype.validatorTriggers=function(){return["useMetadataPeriodInSecondsPatterns"]},r.prototype.updateValidators=function(e){this.msgDelayConfigForm.get("useMetadataPeriodInSecondsPatterns").value?(this.msgDelayConfigForm.get("periodInSecondsPattern").setValidators([i.Validators.required]),this.msgDelayConfigForm.get("periodInSeconds").setValidators([])):(this.msgDelayConfigForm.get("periodInSecondsPattern").setValidators([]),this.msgDelayConfigForm.get("periodInSeconds").setValidators([i.Validators.required,i.Validators.min(0)])),this.msgDelayConfigForm.get("periodInSecondsPattern").updateValueAndValidity({emitEvent:e}),this.msgDelayConfigForm.get("periodInSeconds").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-msg-delay-config",template:'
\n \n {{ \'tb.rulenode.use-metadata-period-in-seconds-patterns\' | translate }}\n \n
tb.rulenode.use-metadata-period-in-seconds-patterns-hint
\n \n tb.rulenode.period-seconds\n \n \n {{ \'tb.rulenode.period-seconds-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-period-0-seconds-message\' | translate }}\n \n \n \n \n tb.rulenode.period-in-seconds-pattern\n \n \n {{ \'tb.rulenode.period-in-seconds-pattern-required\' | translate }}\n \n \n \n \n \n tb.rulenode.max-pending-messages\n \n \n {{ \'tb.rulenode.max-pending-messages-required\' | translate }}\n \n \n {{ \'tb.rulenode.max-pending-messages-range\' | translate }}\n \n \n {{ \'tb.rulenode.max-pending-messages-range\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),L=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.entityType=a.EntityType,n}return b(r,e),r.prototype.configForm=function(){return this.deleteRelationConfigForm},r.prototype.onConfigurationSet=function(e){this.deleteRelationConfigForm=this.fb.group({deleteForSingleEntity:[!!e&&e.deleteForSingleEntity,[]],direction:[e?e.direction:null,[i.Validators.required]],entityType:[e?e.entityType:null,[]],entityNamePattern:[e?e.entityNamePattern:null,[]],relationType:[e?e.relationType:null,[i.Validators.required]],entityCacheExpiration:[e?e.entityCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.prototype.validatorTriggers=function(){return["deleteForSingleEntity","entityType"]},r.prototype.updateValidators=function(e){var t=this.deleteRelationConfigForm.get("deleteForSingleEntity").value,r=this.deleteRelationConfigForm.get("entityType").value;t?this.deleteRelationConfigForm.get("entityType").setValidators([i.Validators.required]):this.deleteRelationConfigForm.get("entityType").setValidators([]),t&&r?this.deleteRelationConfigForm.get("entityNamePattern").setValidators([i.Validators.required,i.Validators.pattern(/.*\S.*/)]):this.deleteRelationConfigForm.get("entityNamePattern").setValidators([]),this.deleteRelationConfigForm.get("entityType").updateValueAndValidity({emitEvent:!1}),this.deleteRelationConfigForm.get("entityNamePattern").updateValueAndValidity({emitEvent:e})},r.prototype.prepareOutputConfig=function(e){return e.entityNamePattern=e.entityNamePattern?e.entityNamePattern.trim():null,e},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-delete-relation-config",template:'
\n \n {{ \'tb.rulenode.delete-relation-to-specific-entity\' | translate }}\n \n
tb.rulenode.delete-relation-hint
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n
\n \n \n \n tb.rulenode.entity-name-pattern\n \n \n {{ \'tb.rulenode.entity-name-pattern-required\' | translate }}\n \n \n \n
\n \n tb.rulenode.relation-type-pattern\n \n \n {{ \'tb.rulenode.relation-type-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.entity-cache-expiration\n \n \n {{ \'tb.rulenode.entity-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.entity-cache-expiration-range\' | translate }}\n \n tb.rulenode.entity-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),P=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.generatorConfigForm},r.prototype.onConfigurationSet=function(e){this.generatorConfigForm=this.fb.group({msgCount:[e?e.msgCount:null,[i.Validators.required,i.Validators.min(0)]],periodInSeconds:[e?e.periodInSeconds:null,[i.Validators.required,i.Validators.min(1)]],originator:[e?e.originator:null,[]],jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.prepareInputConfig=function(e){return e&&(e.originatorId&&e.originatorType?e.originator={id:e.originatorId,entityType:e.originatorType}:e.originator=null,delete e.originatorId,delete e.originatorType),e},r.prototype.prepareOutputConfig=function(e){return e.originator?(e.originatorId=e.originator.id,e.originatorType=e.originator.entityType):(e.originatorId=null,e.originatorType=null),delete e.originator,e},r.prototype.testScript=function(){var e=this,t=this.generatorConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"generate",this.translate.instant("tb.rulenode.generator"),"Generate",["prevMsg","prevMetadata","prevMsgType"],this.ruleNodeId).subscribe((function(t){t&&e.generatorConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-action-node-generator-config",template:'
\n \n tb.rulenode.message-count\n \n \n {{ \'tb.rulenode.message-count-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-message-count-message\' | translate }}\n \n \n \n tb.rulenode.period-seconds\n \n \n {{ \'tb.rulenode.period-seconds-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-period-seconds-message\' | translate }}\n \n \n
\n \n \n \n
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent);!function(e){e.CUSTOMER="CUSTOMER",e.TENANT="TENANT",e.RELATED="RELATED",e.ALARM_ORIGINATOR="ALARM_ORIGINATOR"}(F||(F={}));var M,w=new Map([[F.CUSTOMER,"tb.rulenode.originator-customer"],[F.TENANT,"tb.rulenode.originator-tenant"],[F.RELATED,"tb.rulenode.originator-related"],[F.ALARM_ORIGINATOR,"tb.rulenode.originator-alarm-originator"]]);!function(e){e.CIRCLE="CIRCLE",e.POLYGON="POLYGON"}(M||(M={}));var R,D=new Map([[M.CIRCLE,"tb.rulenode.perimeter-circle"],[M.POLYGON,"tb.rulenode.perimeter-polygon"]]);!function(e){e.MILLISECONDS="MILLISECONDS",e.SECONDS="SECONDS",e.MINUTES="MINUTES",e.HOURS="HOURS",e.DAYS="DAYS"}(R||(R={}));var O,K=new Map([[R.MILLISECONDS,"tb.rulenode.time-unit-milliseconds"],[R.SECONDS,"tb.rulenode.time-unit-seconds"],[R.MINUTES,"tb.rulenode.time-unit-minutes"],[R.HOURS,"tb.rulenode.time-unit-hours"],[R.DAYS,"tb.rulenode.time-unit-days"]]);!function(e){e.METER="METER",e.KILOMETER="KILOMETER",e.FOOT="FOOT",e.MILE="MILE",e.NAUTICAL_MILE="NAUTICAL_MILE"}(O||(O={}));var B,G=new Map([[O.METER,"tb.rulenode.range-unit-meter"],[O.KILOMETER,"tb.rulenode.range-unit-kilometer"],[O.FOOT,"tb.rulenode.range-unit-foot"],[O.MILE,"tb.rulenode.range-unit-mile"],[O.NAUTICAL_MILE,"tb.rulenode.range-unit-nautical-mile"]]);!function(e){e.TITLE="TITLE",e.COUNTRY="COUNTRY",e.STATE="STATE",e.ZIP="ZIP",e.ADDRESS="ADDRESS",e.ADDRESS2="ADDRESS2",e.PHONE="PHONE",e.EMAIL="EMAIL",e.ADDITIONAL_INFO="ADDITIONAL_INFO"}(B||(B={}));var H,U,j,z=new Map([[B.TITLE,"tb.rulenode.entity-details-title"],[B.COUNTRY,"tb.rulenode.entity-details-country"],[B.STATE,"tb.rulenode.entity-details-state"],[B.ZIP,"tb.rulenode.entity-details-zip"],[B.ADDRESS,"tb.rulenode.entity-details-address"],[B.ADDRESS2,"tb.rulenode.entity-details-address2"],[B.PHONE,"tb.rulenode.entity-details-phone"],[B.EMAIL,"tb.rulenode.entity-details-email"],[B.ADDITIONAL_INFO,"tb.rulenode.entity-details-additional_info"]]);!function(e){e.FIRST="FIRST",e.LAST="LAST",e.ALL="ALL"}(H||(H={})),function(e){e.ASC="ASC",e.DESC="DESC"}(U||(U={})),function(e){e.STANDARD="STANDARD",e.FIFO="FIFO"}(j||(j={}));var Q,_=new Map([[j.STANDARD,"tb.rulenode.sqs-queue-standard"],[j.FIFO,"tb.rulenode.sqs-queue-fifo"]]),$=["anonymous","basic","cert.PEM"],W=new Map([["anonymous","tb.rulenode.credentials-anonymous"],["basic","tb.rulenode.credentials-basic"],["cert.PEM","tb.rulenode.credentials-pem"]]),J=["sas","cert.PEM"],Y=new Map([["sas","tb.rulenode.credentials-sas"],["cert.PEM","tb.rulenode.credentials-pem"]]);!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(Q||(Q={}));var Z=["US-ASCII","ISO-8859-1","UTF-8","UTF-16BE","UTF-16LE","UTF-16"],X=new Map([["US-ASCII","tb.rulenode.charset-us-ascii"],["ISO-8859-1","tb.rulenode.charset-iso-8859-1"],["UTF-8","tb.rulenode.charset-utf-8"],["UTF-16BE","tb.rulenode.charset-utf-16be"],["UTF-16LE","tb.rulenode.charset-utf-16le"],["UTF-16","tb.rulenode.charset-utf-16"]]),ee=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.perimeterType=M,n.perimeterTypes=Object.keys(M),n.perimeterTypeTranslationMap=D,n.rangeUnits=Object.keys(O),n.rangeUnitTranslationMap=G,n.timeUnits=Object.keys(R),n.timeUnitsTranslationMap=K,n}return b(r,e),r.prototype.configForm=function(){return this.geoActionConfigForm},r.prototype.onConfigurationSet=function(e){this.geoActionConfigForm=this.fb.group({latitudeKeyName:[e?e.latitudeKeyName:null,[i.Validators.required]],longitudeKeyName:[e?e.longitudeKeyName:null,[i.Validators.required]],fetchPerimeterInfoFromMessageMetadata:[!!e&&e.fetchPerimeterInfoFromMessageMetadata,[]],perimeterType:[e?e.perimeterType:null,[]],centerLatitude:[e?e.centerLatitude:null,[]],centerLongitude:[e?e.centerLatitude:null,[]],range:[e?e.range:null,[]],rangeUnit:[e?e.rangeUnit:null,[]],polygonsDefinition:[e?e.polygonsDefinition:null,[]],minInsideDuration:[e?e.minInsideDuration:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]],minInsideDurationTimeUnit:[e?e.minInsideDurationTimeUnit:null,[i.Validators.required]],minOutsideDuration:[e?e.minOutsideDuration:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]],minOutsideDurationTimeUnit:[e?e.minOutsideDurationTimeUnit:null,[i.Validators.required]]})},r.prototype.validatorTriggers=function(){return["fetchPerimeterInfoFromMessageMetadata","perimeterType"]},r.prototype.updateValidators=function(e){var t=this.geoActionConfigForm.get("fetchPerimeterInfoFromMessageMetadata").value,r=this.geoActionConfigForm.get("perimeterType").value;t?this.geoActionConfigForm.get("perimeterType").setValidators([]):this.geoActionConfigForm.get("perimeterType").setValidators([i.Validators.required]),t||r!==M.CIRCLE?(this.geoActionConfigForm.get("centerLatitude").setValidators([]),this.geoActionConfigForm.get("centerLongitude").setValidators([]),this.geoActionConfigForm.get("range").setValidators([]),this.geoActionConfigForm.get("rangeUnit").setValidators([])):(this.geoActionConfigForm.get("centerLatitude").setValidators([i.Validators.required,i.Validators.min(-90),i.Validators.max(90)]),this.geoActionConfigForm.get("centerLongitude").setValidators([i.Validators.required,i.Validators.min(-180),i.Validators.max(180)]),this.geoActionConfigForm.get("range").setValidators([i.Validators.required,i.Validators.min(0)]),this.geoActionConfigForm.get("rangeUnit").setValidators([i.Validators.required])),t||r!==M.POLYGON?this.geoActionConfigForm.get("polygonsDefinition").setValidators([]):this.geoActionConfigForm.get("polygonsDefinition").setValidators([i.Validators.required]),this.geoActionConfigForm.get("perimeterType").updateValueAndValidity({emitEvent:!1}),this.geoActionConfigForm.get("centerLatitude").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("centerLongitude").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("range").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("rangeUnit").updateValueAndValidity({emitEvent:e}),this.geoActionConfigForm.get("polygonsDefinition").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-gps-geofencing-config",template:'
\n \n tb.rulenode.latitude-key-name\n \n \n {{ \'tb.rulenode.latitude-key-name-required\' | translate }}\n \n \n \n tb.rulenode.longitude-key-name\n \n \n {{ \'tb.rulenode.longitude-key-name-required\' | translate }}\n \n \n \n {{ \'tb.rulenode.fetch-perimeter-info-from-message-metadata\' | translate }}\n \n
\n \n tb.rulenode.perimeter-type\n \n \n {{ perimeterTypeTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n \n tb.rulenode.circle-center-latitude\n \n \n {{ \'tb.rulenode.circle-center-latitude-required\' | translate }}\n \n \n \n tb.rulenode.circle-center-longitude\n \n \n {{ \'tb.rulenode.circle-center-longitude-required\' | translate }}\n \n \n
\n
\n \n tb.rulenode.range\n \n \n {{ \'tb.rulenode.range-required\' | translate }}\n \n \n \n tb.rulenode.range-units\n \n \n {{ rangeUnitTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n \n tb.rulenode.polygon-definition\n \n \n {{ \'tb.rulenode.polygon-definition-required\' | translate }}\n \n \n
\n
\n \n tb.rulenode.min-inside-duration\n \n \n {{ \'tb.rulenode.min-inside-duration-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.min-inside-duration-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n \n tb.rulenode.min-outside-duration\n \n \n {{ \'tb.rulenode.min-outside-duration-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.min-outside-duration-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),te=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.msgCountConfigForm},r.prototype.onConfigurationSet=function(e){this.msgCountConfigForm=this.fb.group({interval:[e?e.interval:null,[i.Validators.required,i.Validators.min(1)]],telemetryPrefix:[e?e.telemetryPrefix:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-msg-count-config",template:'
\n \n tb.rulenode.interval-seconds\n \n \n {{ \'tb.rulenode.interval-seconds-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-interval-seconds-message\' | translate }}\n \n \n \n tb.rulenode.output-timeseries-key-prefix\n \n \n {{ \'tb.rulenode.output-timeseries-key-prefix-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),re=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.rpcReplyConfigForm},r.prototype.onConfigurationSet=function(e){this.rpcReplyConfigForm=this.fb.group({requestIdMetaDataAttribute:[e?e.requestIdMetaDataAttribute:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rpc-reply-config",template:'
\n \n tb.rulenode.request-id-metadata-attribute\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ne=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.saveToCustomTableConfigForm},r.prototype.onConfigurationSet=function(e){this.saveToCustomTableConfigForm=this.fb.group({tableName:[e?e.tableName:null,[i.Validators.required,i.Validators.pattern(/.*\S.*/)]],fieldsMapping:[e?e.fieldsMapping:null,[i.Validators.required]]})},r.prototype.prepareOutputConfig=function(e){return e.tableName=e.tableName.trim(),e},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-custom-table-config",template:'
\n \n tb.rulenode.custom-table-name\n \n \n {{ \'tb.rulenode.custom-table-name-required\' | translate }}\n \n tb.rulenode.custom-table-hint\n \n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ae=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.translate=r,o.injector=n,o.fb=a,o.propagateChange=null,o.valueChangeSubscription=null,o}var a;return b(r,e),a=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){this.ngControl=this.injector.get(i.NgControl),null!=this.ngControl&&(this.ngControl.valueAccessor=this),this.kvListFormGroup=this.fb.group({}),this.kvListFormGroup.addControl("keyVals",this.fb.array([]))},r.prototype.keyValsFormArray=function(){return this.kvListFormGroup.get("keyVals")},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.kvListFormGroup.disable({emitEvent:!1}):this.kvListFormGroup.enable({emitEvent:!1})},r.prototype.writeValue=function(e){var t,r,n=this;this.valueChangeSubscription&&this.valueChangeSubscription.unsubscribe();var a=[];if(e)try{for(var o=v(Object.keys(e)),l=o.next();!l.done;l=o.next()){var s=l.value;Object.prototype.hasOwnProperty.call(e,s)&&a.push(this.fb.group({key:[s,[i.Validators.required]],value:[e[s],[i.Validators.required]]}))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this.kvListFormGroup.setControl("keyVals",this.fb.array(a)),this.valueChangeSubscription=this.kvListFormGroup.valueChanges.subscribe((function(){n.updateModel()}))},r.prototype.removeKeyVal=function(e){this.kvListFormGroup.get("keyVals").removeAt(e)},r.prototype.addKeyVal=function(){this.kvListFormGroup.get("keyVals").push(this.fb.group({key:["",[i.Validators.required]],value:["",[i.Validators.required]]}))},r.prototype.validate=function(e){return!this.kvListFormGroup.get("keyVals").value.length&&this.required?{kvMapRequired:!0}:this.kvListFormGroup.valid?null:{kvFieldsRequired:!0}},r.prototype.updateModel=function(){var e=this.kvListFormGroup.get("keyVals").value;if(this.required&&!e.length||!this.kvListFormGroup.valid)this.propagateChange(null);else{var t={};e.forEach((function(e){t[e.key]=e.value})),this.propagateChange(t)}},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:t.Injector},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.Input(),C("design:type",String)],r.prototype,"requiredText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"keyText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"keyRequiredText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"valText",void 0),h([t.Input(),C("design:type",String)],r.prototype,"valRequiredText",void 0),h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),r=a=h([t.Component({selector:"tb-kv-map-config",template:'
\n
\n {{ keyText | translate }}\n {{ valText | translate }}\n \n
\n
\n
\n \n \n \n \n {{ keyRequiredText | translate }}\n \n \n \n \n \n \n {{ valRequiredText | translate }}\n \n \n \n
\n
\n \n
\n \n
\n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return a})),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef((function(){return a})),multi:!0}],styles:[":host .tb-kv-map-config{margin-bottom:16px}:host .tb-kv-map-config .header{padding-left:5px;padding-right:5px;padding-bottom:5px}:host .tb-kv-map-config .header .cell{padding-left:5px;padding-right:5px;color:rgba(0,0,0,.54);font-size:12px;font-weight:700;white-space:nowrap}:host .tb-kv-map-config .body{padding-left:5px;padding-right:5px;padding-bottom:20px;max-height:300px;overflow:auto}:host .tb-kv-map-config .body .row{padding-top:5px;max-height:40px}:host .tb-kv-map-config .body .cell{padding-left:5px;padding-right:5px}:host ::ng-deep .tb-kv-map-config .body mat-form-field.cell{margin:0;max-height:40px}:host ::ng-deep .tb-kv-map-config .body mat-form-field.cell .mat-form-field-infix{border-top:0}:host ::ng-deep .tb-kv-map-config .body button.mat-button{margin:0}"]}),C("design:paramtypes",[o.Store,n.TranslateService,t.Injector,i.FormBuilder])],r)}(a.PageComponent),oe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.entityType=a.EntityType,n.propagateChange=null,n}var n;return b(r,e),n=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){var e=this;this.deviceRelationsQueryFormGroup=this.fb.group({fetchLastLevelOnly:[!1,[]],direction:[null,[i.Validators.required]],maxLevel:[null,[]],relationType:[null],deviceTypes:[null,[i.Validators.required]]}),this.deviceRelationsQueryFormGroup.valueChanges.subscribe((function(t){e.deviceRelationsQueryFormGroup.valid?e.propagateChange(t):e.propagateChange(null)}))},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.deviceRelationsQueryFormGroup.disable({emitEvent:!1}):this.deviceRelationsQueryFormGroup.enable({emitEvent:!1})},r.prototype.writeValue=function(e){this.deviceRelationsQueryFormGroup.reset(e,{emitEvent:!1})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),r=n=h([t.Component({selector:"tb-device-relations-query-config",template:'
\n \n {{ \'alias.last-level-relation\' | translate }}\n \n
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n \n tb.rulenode.max-relation-level\n \n \n
\n
relation.relation-type
\n \n \n
device.device-types
\n \n \n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return n})),multi:!0}]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.PageComponent),ie=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.directionTypes=Object.keys(a.EntitySearchDirection),n.directionTypeTranslations=a.entitySearchDirectionTranslations,n.propagateChange=null,n}var n;return b(r,e),n=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){var e=this;this.relationsQueryFormGroup=this.fb.group({fetchLastLevelOnly:[!1,[]],direction:[null,[i.Validators.required]],maxLevel:[null,[]],filters:[null]}),this.relationsQueryFormGroup.valueChanges.subscribe((function(t){e.relationsQueryFormGroup.valid?e.propagateChange(t):e.propagateChange(null)}))},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.relationsQueryFormGroup.disable({emitEvent:!1}):this.relationsQueryFormGroup.enable({emitEvent:!1})},r.prototype.writeValue=function(e){this.relationsQueryFormGroup.reset(e||{},{emitEvent:!1})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),r=n=h([t.Component({selector:"tb-relations-query-config",template:'
\n \n {{ \'alias.last-level-relation\' | translate }}\n \n
\n \n relation.direction\n \n \n {{ directionTypeTranslations.get(type) | translate }}\n \n \n \n \n tb.rulenode.max-relation-level\n \n \n
\n
relation.relation-filters
\n \n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return n})),multi:!0}]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.PageComponent),le=function(e){function r(t,r,n,o){var i,l,s=e.call(this,t)||this;s.store=t,s.translate=r,s.truncate=n,s.fb=o,s.placeholder="tb.rulenode.message-type",s.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],s.messageTypes=[],s.messageTypesList=[],s.searchText="",s.propagateChange=function(e){},s.messageTypeConfigForm=s.fb.group({messageType:[null]});try{for(var u=v(Object.keys(a.MessageType)),d=u.next();!d.done;d=u.next()){var p=d.value;s.messageTypesList.push({name:a.messageTypeNames.get(a.MessageType[p]),value:p})}}catch(e){i={error:e}}finally{try{d&&!d.done&&(l=u.return)&&l.call(u)}finally{if(i)throw i.error}}return s}var l;return b(r,e),l=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.ngOnInit=function(){var e=this;this.filteredMessageTypes=this.messageTypeConfigForm.get("messageType").valueChanges.pipe(f.startWith(""),f.map((function(e){return e||""})),f.mergeMap((function(t){return e.fetchMessageTypes(t)})),f.share())},r.prototype.ngAfterViewInit=function(){},r.prototype.setDisabledState=function(e){this.disabled=e,this.disabled?this.messageTypeConfigForm.disable({emitEvent:!1}):this.messageTypeConfigForm.enable({emitEvent:!1})},r.prototype.writeValue=function(e){var t=this;this.searchText="",this.messageTypes.length=0,e&&e.forEach((function(e){var r=t.messageTypesList.find((function(t){return t.value===e}));r?t.messageTypes.push({name:r.name,value:r.value}):t.messageTypes.push({name:e,value:e})}))},r.prototype.displayMessageTypeFn=function(e){return e?e.name:void 0},r.prototype.textIsNotEmpty=function(e){return!!(e&&null!=e&&e.length>0)},r.prototype.createMessageType=function(e,t){e.preventDefault(),this.transformMessageType(t)},r.prototype.add=function(e){this.transformMessageType(e.value)},r.prototype.fetchMessageTypes=function(e){if(this.searchText=e,this.searchText&&this.searchText.length){var t=this.searchText.toUpperCase();return c.of(this.messageTypesList.filter((function(e){return e.name.toUpperCase().includes(t)})))}return c.of(this.messageTypesList)},r.prototype.transformMessageType=function(e){if((e||"").trim()){var t=null,r=e.trim(),n=this.messageTypesList.find((function(e){return e.name===r}));(t=n?{name:n.name,value:n.value}:{name:r,value:r})&&this.addMessageType(t)}this.clear("")},r.prototype.remove=function(e){var t=this.messageTypes.indexOf(e);t>=0&&(this.messageTypes.splice(t,1),this.updateModel())},r.prototype.selected=function(e){this.addMessageType(e.option.value),this.clear("")},r.prototype.addMessageType=function(e){-1===this.messageTypes.findIndex((function(t){return t.value===e.value}))&&(this.messageTypes.push(e),this.updateModel())},r.prototype.onFocus=function(){this.messageTypeConfigForm.get("messageType").updateValueAndValidity({onlySelf:!0,emitEvent:!0})},r.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this.messageTypeInput.nativeElement.value=e,this.messageTypeConfigForm.get("messageType").patchValue(null,{emitEvent:!0}),setTimeout((function(){t.messageTypeInput.nativeElement.blur(),t.messageTypeInput.nativeElement.focus()}),0)},r.prototype.updateModel=function(){var e=this.messageTypes.map((function(e){return e.value}));this.required?(this.chipList.errorState=!e.length,this.propagateChange(e.length>0?e:null)):(this.chipList.errorState=!1,this.propagateChange(e))},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:a.TruncatePipe},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),h([t.Input(),C("design:type",String)],r.prototype,"label",void 0),h([t.Input(),C("design:type",Object)],r.prototype,"placeholder",void 0),h([t.Input(),C("design:type",Boolean)],r.prototype,"disabled",void 0),h([t.ViewChild("chipList",{static:!1}),C("design:type",d.MatChipList)],r.prototype,"chipList",void 0),h([t.ViewChild("messageTypeAutocomplete",{static:!1}),C("design:type",p.MatAutocomplete)],r.prototype,"matAutocomplete",void 0),h([t.ViewChild("messageTypeInput",{static:!1}),C("design:type",t.ElementRef)],r.prototype,"messageTypeInput",void 0),r=l=h([t.Component({selector:"tb-message-types-config",template:'\n {{ label }}\n \n \n {{messageType.name}}\n close\n \n \n \n \n \n \n \n \n
\n
\n tb.rulenode.no-message-types-found\n
\n \n \n {{ translate.get(\'tb.rulenode.no-message-type-matching\',\n {messageType: truncate.transform(searchText, true, 6, '...')}) | async }}\n \n \n \n tb.rulenode.create-new-message-type\n \n
\n
\n
\n \n {{ \'tb.rulenode.message-types-required\' | translate }}\n \n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return l})),multi:!0}]}),C("design:paramtypes",[o.Store,n.TranslateService,a.TruncatePipe,i.FormBuilder])],r)}(a.PageComponent),se=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.subscriptions=[],n.disableCertPemCredentials=!1,n.allCredentialsTypes=$,n.credentialsTypeTranslationsMap=W,n.propagateChange=null,n}var n;return b(r,e),n=r,Object.defineProperty(r.prototype,"required",{get:function(){return this.requiredValue},set:function(e){this.requiredValue=u.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),r.prototype.ngOnInit=function(){var e=this;this.credentialsConfigFormGroup=this.fb.group({type:[null,[i.Validators.required]],username:[null,[]],password:[null,[]],caCert:[null,[]],caCertFileName:[null,[]],privateKey:[null,[]],privateKeyFileName:[null,[]],cert:[null,[]],certFileName:[null,[]]}),this.subscriptions.push(this.credentialsConfigFormGroup.valueChanges.pipe(f.distinctUntilChanged()).subscribe((function(){e.updateView()}))),this.subscriptions.push(this.credentialsConfigFormGroup.get("type").valueChanges.subscribe((function(){e.credentialsTypeChanged()})))},r.prototype.ngOnChanges=function(e){var t,r,n=this;try{for(var a=v(Object.keys(e)),o=a.next();!o.done;o=a.next()){var i=o.value,l=e[i];if(!l.firstChange&&l.currentValue!==l.previousValue)if(l.currentValue&&"disableCertPemCredentials"===i)"cert.PEM"===this.credentialsConfigFormGroup.get("type").value&&setTimeout((function(){n.credentialsConfigFormGroup.get("type").patchValue("anonymous",{emitEvent:!0})}))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},r.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(e){return e.unsubscribe()}))},r.prototype.writeValue=function(e){s.isDefinedAndNotNull(e)&&(this.credentialsConfigFormGroup.reset(e,{emitEvent:!1}),this.updateValidators(!1))},r.prototype.setDisabledState=function(e){e?this.credentialsConfigFormGroup.disable():(this.credentialsConfigFormGroup.enable(),this.updateValidators())},r.prototype.updateView=function(){var e=this.credentialsConfigFormGroup.value,t=e.type;switch(t){case"anonymous":e={type:t};break;case"basic":e={type:t,username:e.username,password:e.password};break;case"cert.PEM":delete e.username}this.propagateChange(e)},r.prototype.registerOnChange=function(e){this.propagateChange=e},r.prototype.registerOnTouched=function(e){},r.prototype.validate=function(e){return this.credentialsConfigFormGroup.valid?null:{credentialsConfig:{valid:!1}}},r.prototype.credentialsTypeChanged=function(){this.credentialsConfigFormGroup.patchValue({username:null,password:null,caCert:null,caCertFileName:null,privateKey:null,privateKeyFileName:null,cert:null,certFileName:null}),this.updateValidators()},r.prototype.updateValidators=function(e){void 0===e&&(e=!1);var t=this.credentialsConfigFormGroup.get("type").value;switch(e&&this.credentialsConfigFormGroup.reset({type:t},{emitEvent:!1}),this.credentialsConfigFormGroup.setValidators([]),this.credentialsConfigFormGroup.get("username").setValidators([]),this.credentialsConfigFormGroup.get("password").setValidators([]),t){case"anonymous":break;case"basic":this.credentialsConfigFormGroup.get("username").setValidators([i.Validators.required]),this.credentialsConfigFormGroup.get("password").setValidators([i.Validators.required]);break;case"cert.PEM":this.credentialsConfigFormGroup.setValidators([this.requiredFilesSelected(i.Validators.required,[["caCert","caCertFileName"],["privateKey","privateKeyFileName","cert","certFileName"]])])}this.credentialsConfigFormGroup.get("username").updateValueAndValidity({emitEvent:e}),this.credentialsConfigFormGroup.get("password").updateValueAndValidity({emitEvent:e}),this.credentialsConfigFormGroup.updateValueAndValidity({emitEvent:e})},r.prototype.requiredFilesSelected=function(e,t){return void 0===t&&(t=null),function(r){return t||(t=[Object.keys(r.controls)]),(null==r?void 0:r.controls)&&t.some((function(t){return t.every((function(t){return!e(r.controls[t])}))}))?null:{notAllRequiredFilesSelected:!0}}},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},h([t.Input(),C("design:type",Boolean),C("design:paramtypes",[Boolean])],r.prototype,"required",null),h([t.Input(),C("design:type",Object)],r.prototype,"disableCertPemCredentials",void 0),r=n=h([t.Component({selector:"tb-credentials-config",template:'
\n \n \n tb.rulenode.credentials\n \n {{ credentialsTypeTranslationsMap.get(credentialsConfigFormGroup.get(\'type\').value) | translate }}\n \n \n \n \n tb.rulenode.credentials-type\n \n \n {{ credentialsTypeTranslationsMap.get(credentialsType) | translate }}\n \n \n \n {{ \'tb.rulenode.credentials-type-required\' | translate }}\n \n \n
\n \n \n \n \n tb.rulenode.username\n \n \n {{ \'tb.rulenode.username-required\' | translate }}\n \n \n \n tb.rulenode.password\n \n \n {{ \'tb.rulenode.password-required\' | translate }}\n \n \n \n \n
{{ \'tb.rulenode.credentials-pem-hint\' | translate }}
\n \n \n \n \n \n \n \n tb.rulenode.private-key-password\n \n \n
\n
\n
\n
\n
\n',providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return n})),multi:!0},{provide:i.NG_VALIDATORS,useExisting:t.forwardRef((function(){return n})),multi:!0}]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.PageComponent),me=function(){function e(e){this.sanitizer=e}return e.prototype.transform=function(e){return this.sanitizer.bypassSecurityTrustHtml(e)},e.ctorParameters=function(){return[{type:g.DomSanitizer}]},e=h([t.Pipe({name:"safeHtml"}),C("design:paramtypes",[g.DomSanitizer])],e)}(),ue=function(){function e(){}return e=h([t.NgModule({declarations:[ae,oe,ie,le,se,me],imports:[r.CommonModule,a.SharedModule,l.HomeComponentsModule],exports:[ae,oe,ie,le,se,me]})],e)}(),de=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.unassignCustomerConfigForm},r.prototype.onConfigurationSet=function(e){this.unassignCustomerConfigForm=this.fb.group({customerNamePattern:[e?e.customerNamePattern:null,[i.Validators.required,i.Validators.pattern(/.*\S.*/)]],customerCacheExpiration:[e?e.customerCacheExpiration:null,[i.Validators.required,i.Validators.min(0)]]})},r.prototype.prepareOutputConfig=function(e){return e.customerNamePattern=e.customerNamePattern.trim(),e},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-un-assign-to-customer-config",template:'
\n \n tb.rulenode.customer-name-pattern\n \n \n {{ \'tb.rulenode.customer-name-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.customer-cache-expiration\n \n \n {{ \'tb.rulenode.customer-cache-expiration-required\' | translate }}\n \n \n {{ \'tb.rulenode.customer-cache-expiration-range\' | translate }}\n \n tb.rulenode.customer-cache-expiration-hint\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),pe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.snsConfigForm},r.prototype.onConfigurationSet=function(e){this.snsConfigForm=this.fb.group({topicArnPattern:[e?e.topicArnPattern:null,[i.Validators.required]],accessKeyId:[e?e.accessKeyId:null,[i.Validators.required]],secretAccessKey:[e?e.secretAccessKey:null,[i.Validators.required]],region:[e?e.region:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-sns-config",template:'
\n \n tb.rulenode.topic-arn-pattern\n \n \n {{ \'tb.rulenode.topic-arn-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.aws-access-key-id\n \n \n {{ \'tb.rulenode.aws-access-key-id-required\' | translate }}\n \n \n \n tb.rulenode.aws-secret-access-key\n \n \n {{ \'tb.rulenode.aws-secret-access-key-required\' | translate }}\n \n \n \n tb.rulenode.aws-region\n \n \n {{ \'tb.rulenode.aws-region-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ce=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.sqsQueueType=j,n.sqsQueueTypes=Object.keys(j),n.sqsQueueTypeTranslationsMap=_,n}return b(r,e),r.prototype.configForm=function(){return this.sqsConfigForm},r.prototype.onConfigurationSet=function(e){this.sqsConfigForm=this.fb.group({queueType:[e?e.queueType:null,[i.Validators.required]],queueUrlPattern:[e?e.queueUrlPattern:null,[i.Validators.required]],delaySeconds:[e?e.delaySeconds:null,[i.Validators.min(0),i.Validators.max(900)]],messageAttributes:[e?e.messageAttributes:null,[]],accessKeyId:[e?e.accessKeyId:null,[i.Validators.required]],secretAccessKey:[e?e.secretAccessKey:null,[i.Validators.required]],region:[e?e.region:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-sqs-config",template:'
\n \n tb.rulenode.queue-type\n \n \n {{ sqsQueueTypeTranslationsMap.get(type) | translate }}\n \n \n \n \n tb.rulenode.queue-url-pattern\n \n \n {{ \'tb.rulenode.queue-url-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.delay-seconds\n \n \n {{ \'tb.rulenode.min-delay-seconds-message\' | translate }}\n \n \n {{ \'tb.rulenode.max-delay-seconds-message\' | translate }}\n \n \n \n
\n \n \n \n tb.rulenode.aws-access-key-id\n \n \n {{ \'tb.rulenode.aws-access-key-id-required\' | translate }}\n \n \n \n tb.rulenode.aws-secret-access-key\n \n \n {{ \'tb.rulenode.aws-secret-access-key-required\' | translate }}\n \n \n \n tb.rulenode.aws-region\n \n \n {{ \'tb.rulenode.aws-region-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),fe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.pubSubConfigForm},r.prototype.onConfigurationSet=function(e){this.pubSubConfigForm=this.fb.group({projectId:[e?e.projectId:null,[i.Validators.required]],topicName:[e?e.topicName:null,[i.Validators.required]],serviceAccountKey:[e?e.serviceAccountKey:null,[i.Validators.required]],serviceAccountKeyFileName:[e?e.serviceAccountKeyFileName:null,[i.Validators.required]],messageAttributes:[e?e.messageAttributes:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-pub-sub-config",template:'
\n \n tb.rulenode.gcp-project-id\n \n \n {{ \'tb.rulenode.gcp-project-id-required\' | translate }}\n \n \n \n tb.rulenode.pubsub-topic-name\n \n \n {{ \'tb.rulenode.pubsub-topic-name-required\' | translate }}\n \n \n \n \n \n
\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ge=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.ackValues=["all","-1","0","1"],n.ToByteStandartCharsetTypesValues=Z,n.ToByteStandartCharsetTypeTranslationMap=X,n}return b(r,e),r.prototype.configForm=function(){return this.kafkaConfigForm},r.prototype.onConfigurationSet=function(e){this.kafkaConfigForm=this.fb.group({topicPattern:[e?e.topicPattern:null,[i.Validators.required]],bootstrapServers:[e?e.bootstrapServers:null,[i.Validators.required]],retries:[e?e.retries:null,[i.Validators.min(0)]],batchSize:[e?e.batchSize:null,[i.Validators.min(0)]],linger:[e?e.linger:null,[i.Validators.min(0)]],bufferMemory:[e?e.bufferMemory:null,[i.Validators.min(0)]],acks:[e?e.acks:null,[i.Validators.required]],keySerializer:[e?e.keySerializer:null,[i.Validators.required]],valueSerializer:[e?e.valueSerializer:null,[i.Validators.required]],otherProperties:[e?e.otherProperties:null,[]],addMetadataKeyValuesAsKafkaHeaders:[!!e&&e.addMetadataKeyValuesAsKafkaHeaders,[]],kafkaHeadersCharset:[e?e.kafkaHeadersCharset:null,[]]})},r.prototype.validatorTriggers=function(){return["addMetadataKeyValuesAsKafkaHeaders"]},r.prototype.updateValidators=function(e){this.kafkaConfigForm.get("addMetadataKeyValuesAsKafkaHeaders").value?this.kafkaConfigForm.get("kafkaHeadersCharset").setValidators([i.Validators.required]):this.kafkaConfigForm.get("kafkaHeadersCharset").setValidators([]),this.kafkaConfigForm.get("kafkaHeadersCharset").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-kafka-config",template:'
\n \n tb.rulenode.topic-pattern\n \n \n {{ \'tb.rulenode.topic-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.bootstrap-servers\n \n \n {{ \'tb.rulenode.bootstrap-servers-required\' | translate }}\n \n \n \n tb.rulenode.retries\n \n \n {{ \'tb.rulenode.min-retries-message\' | translate }}\n \n \n \n tb.rulenode.batch-size-bytes\n \n \n {{ \'tb.rulenode.min-batch-size-bytes-message\' | translate }}\n \n \n \n tb.rulenode.linger-ms\n \n \n {{ \'tb.rulenode.min-linger-ms-message\' | translate }}\n \n \n \n tb.rulenode.buffer-memory-bytes\n \n \n {{ \'tb.rulenode.min-buffer-memory-bytes-message\' | translate }}\n \n \n \n tb.rulenode.acks\n \n \n {{ ackValue }}\n \n \n \n \n tb.rulenode.key-serializer\n \n \n {{ \'tb.rulenode.key-serializer-required\' | translate }}\n \n \n \n tb.rulenode.value-serializer\n \n \n {{ \'tb.rulenode.value-serializer-required\' | translate }}\n \n \n \n \n \n \n {{ \'tb.rulenode.add-metadata-key-values-as-kafka-headers\' | translate }}\n \n
tb.rulenode.add-metadata-key-values-as-kafka-headers-hint
\n \n tb.rulenode.charset-encoding\n \n \n {{ ToByteStandartCharsetTypeTranslationMap.get(charset) | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ye=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.mqttConfigForm},r.prototype.onConfigurationSet=function(e){this.mqttConfigForm=this.fb.group({topicPattern:[e?e.topicPattern:null,[i.Validators.required]],host:[e?e.host:null,[i.Validators.required]],port:[e?e.port:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]],connectTimeoutSec:[e?e.connectTimeoutSec:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(200)]],clientId:[e?e.clientId:null,[]],cleanSession:[!!e&&e.cleanSession,[]],ssl:[!!e&&e.ssl,[]],credentials:[e?e.credentials:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-mqtt-config",template:'
\n \n tb.rulenode.topic-pattern\n \n \n {{ \'tb.rulenode.topic-pattern-required\' | translate }}\n \n \n \n
\n \n tb.rulenode.host\n \n \n {{ \'tb.rulenode.host-required\' | translate }}\n \n \n \n tb.rulenode.port\n \n \n {{ \'tb.rulenode.port-required\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n \n tb.rulenode.connect-timeout\n \n \n {{ \'tb.rulenode.connect-timeout-required\' | translate }}\n \n \n {{ \'tb.rulenode.connect-timeout-range\' | translate }}\n \n \n {{ \'tb.rulenode.connect-timeout-range\' | translate }}\n \n \n
\n \n tb.rulenode.client-id\n \n \n \n {{ \'tb.rulenode.clean-session\' | translate }}\n \n \n {{ \'tb.rulenode.enable-ssl\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),be=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.messageProperties=[null,"BASIC","TEXT_PLAIN","MINIMAL_BASIC","MINIMAL_PERSISTENT_BASIC","PERSISTENT_BASIC","PERSISTENT_TEXT_PLAIN"],n}return b(r,e),r.prototype.configForm=function(){return this.rabbitMqConfigForm},r.prototype.onConfigurationSet=function(e){this.rabbitMqConfigForm=this.fb.group({exchangeNamePattern:[e?e.exchangeNamePattern:null,[]],routingKeyPattern:[e?e.routingKeyPattern:null,[]],messageProperties:[e?e.messageProperties:null,[]],host:[e?e.host:null,[i.Validators.required]],port:[e?e.port:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]],virtualHost:[e?e.virtualHost:null,[]],username:[e?e.username:null,[]],password:[e?e.password:null,[]],automaticRecoveryEnabled:[!!e&&e.automaticRecoveryEnabled,[]],connectionTimeout:[e?e.connectionTimeout:null,[i.Validators.min(0)]],handshakeTimeout:[e?e.handshakeTimeout:null,[i.Validators.min(0)]],clientProperties:[e?e.clientProperties:null,[]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rabbit-mq-config",template:'
\n \n tb.rulenode.exchange-name-pattern\n \n \n \n tb.rulenode.routing-key-pattern\n \n \n \n tb.rulenode.message-properties\n \n \n {{ property }}\n \n \n \n
\n \n tb.rulenode.host\n \n \n {{ \'tb.rulenode.host-required\' | translate }}\n \n \n \n tb.rulenode.port\n \n \n {{ \'tb.rulenode.port-required\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n {{ \'tb.rulenode.port-range\' | translate }}\n \n \n
\n \n tb.rulenode.virtual-host\n \n \n \n tb.rulenode.username\n \n \n \n tb.rulenode.password\n \n \n \n {{ \'tb.rulenode.automatic-recovery\' | translate }}\n \n \n tb.rulenode.connection-timeout-ms\n \n \n {{ \'tb.rulenode.min-connection-timeout-ms-message\' | translate }}\n \n \n \n tb.rulenode.handshake-timeout-ms\n \n \n {{ \'tb.rulenode.min-handshake-timeout-ms-message\' | translate }}\n \n \n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),he=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.proxySchemes=["http","https"],n.httpRequestTypes=Object.keys(Q),n}return b(r,e),r.prototype.configForm=function(){return this.restApiCallConfigForm},r.prototype.onConfigurationSet=function(e){this.restApiCallConfigForm=this.fb.group({restEndpointUrlPattern:[e?e.restEndpointUrlPattern:null,[i.Validators.required]],requestMethod:[e?e.requestMethod:null,[i.Validators.required]],useSimpleClientHttpFactory:[!!e&&e.useSimpleClientHttpFactory,[]],enableProxy:[!!e&&e.enableProxy,[]],useSystemProxyProperties:[!!e&&e.enableProxy,[]],proxyScheme:[e?e.proxyHost:null,[]],proxyHost:[e?e.proxyHost:null,[]],proxyPort:[e?e.proxyPort:null,[]],proxyUser:[e?e.proxyUser:null,[]],proxyPassword:[e?e.proxyPassword:null,[]],readTimeoutMs:[e?e.readTimeoutMs:null,[]],maxParallelRequestsCount:[e?e.maxParallelRequestsCount:null,[i.Validators.min(0)]],headers:[e?e.headers:null,[]],useRedisQueueForMsgPersistence:[!!e&&e.useRedisQueueForMsgPersistence,[]],trimQueue:[!!e&&e.trimQueue,[]],maxQueueSize:[e?e.maxQueueSize:null,[]],credentials:[e?e.credentials:null,[]]})},r.prototype.validatorTriggers=function(){return["useSimpleClientHttpFactory","useRedisQueueForMsgPersistence","enableProxy","useSystemProxyProperties"]},r.prototype.updateValidators=function(e){var t=this.restApiCallConfigForm.get("useSimpleClientHttpFactory").value,r=this.restApiCallConfigForm.get("useRedisQueueForMsgPersistence").value,n=this.restApiCallConfigForm.get("enableProxy").value,a=this.restApiCallConfigForm.get("useSystemProxyProperties").value;n&&!a?(this.restApiCallConfigForm.get("proxyHost").setValidators(n?[i.Validators.required]:[]),this.restApiCallConfigForm.get("proxyPort").setValidators(n?[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]:[])):(this.restApiCallConfigForm.get("proxyHost").setValidators([]),this.restApiCallConfigForm.get("proxyPort").setValidators([]),t?this.restApiCallConfigForm.get("readTimeoutMs").setValidators([]):this.restApiCallConfigForm.get("readTimeoutMs").setValidators([i.Validators.min(0)])),r?this.restApiCallConfigForm.get("maxQueueSize").setValidators([i.Validators.min(0)]):this.restApiCallConfigForm.get("maxQueueSize").setValidators([]),this.restApiCallConfigForm.get("readTimeoutMs").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("maxQueueSize").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("proxyHost").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("proxyPort").updateValueAndValidity({emitEvent:e}),this.restApiCallConfigForm.get("credentials").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-rest-api-call-config",template:'
\n \n tb.rulenode.endpoint-url-pattern\n \n \n {{ \'tb.rulenode.endpoint-url-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.request-method\n \n \n {{ requestType }}\n \n \n \n \n {{ \'tb.rulenode.enable-proxy\' | translate }}\n \n \n {{ \'tb.rulenode.use-simple-client-http-factory\' | translate }}\n \n
\n \n {{ \'tb.rulenode.use-system-proxy-properties\' | translate }}\n \n
\n
\n \n tb.rulenode.proxy-scheme\n \n \n {{ proxyScheme }}\n \n \n \n \n tb.rulenode.proxy-host\n \n \n {{ \'tb.rulenode.proxy-host-required\' | translate }}\n \n \n \n tb.rulenode.proxy-port\n \n \n {{ \'tb.rulenode.proxy-port-required\' | translate }}\n \n \n {{ \'tb.rulenode.proxy-port-range\' | translate }}\n \n \n
\n \n tb.rulenode.proxy-user\n \n \n \n tb.rulenode.proxy-password\n \n \n
\n
\n \n tb.rulenode.read-timeout\n \n tb.rulenode.read-timeout-hint\n \n \n tb.rulenode.max-parallel-requests-count\n \n tb.rulenode.max-parallel-requests-count-hint\n \n \n
\n \n \n \n {{ \'tb.rulenode.use-redis-queue\' | translate }}\n \n
\n \n {{ \'tb.rulenode.trim-redis-queue\' | translate }}\n \n \n tb.rulenode.redis-queue-max-size\n \n \n
\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ce=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.smtpProtocols=["smtp","smtps"],n.tlsVersions=["TLSv1","TLSv1.1","TLSv1.2","TLSv1.3"],n}return b(r,e),r.prototype.configForm=function(){return this.sendEmailConfigForm},r.prototype.onConfigurationSet=function(e){this.sendEmailConfigForm=this.fb.group({useSystemSmtpSettings:[!!e&&e.useSystemSmtpSettings,[]],smtpProtocol:[e?e.smtpProtocol:null,[]],smtpHost:[e?e.smtpHost:null,[]],smtpPort:[e?e.smtpPort:null,[]],timeout:[e?e.timeout:null,[]],enableTls:[!!e&&e.enableTls,[]],tlsVersion:[e?e.tlsVersion:null,[]],enableProxy:[!!e&&e.enableProxy,[]],proxyHost:[e?e.proxyHost:null,[]],proxyPort:[e?e.proxyPort:null,[]],proxyUser:[e?e.proxyUser:null,[]],proxyPassword:[e?e.proxyPassword:null,[]],username:[e?e.username:null,[]],password:[e?e.password:null,[]]})},r.prototype.validatorTriggers=function(){return["useSystemSmtpSettings","enableProxy"]},r.prototype.updateValidators=function(e){var t=this.sendEmailConfigForm.get("useSystemSmtpSettings").value,r=this.sendEmailConfigForm.get("enableProxy").value;t?(this.sendEmailConfigForm.get("smtpProtocol").setValidators([]),this.sendEmailConfigForm.get("smtpHost").setValidators([]),this.sendEmailConfigForm.get("smtpPort").setValidators([]),this.sendEmailConfigForm.get("timeout").setValidators([]),this.sendEmailConfigForm.get("proxyHost").setValidators([]),this.sendEmailConfigForm.get("proxyPort").setValidators([])):(this.sendEmailConfigForm.get("smtpProtocol").setValidators([i.Validators.required]),this.sendEmailConfigForm.get("smtpHost").setValidators([i.Validators.required]),this.sendEmailConfigForm.get("smtpPort").setValidators([i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]),this.sendEmailConfigForm.get("timeout").setValidators([i.Validators.required,i.Validators.min(0)]),this.sendEmailConfigForm.get("proxyHost").setValidators(r?[i.Validators.required]:[]),this.sendEmailConfigForm.get("proxyPort").setValidators(r?[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]:[])),this.sendEmailConfigForm.get("smtpProtocol").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("smtpHost").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("smtpPort").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("timeout").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("proxyHost").updateValueAndValidity({emitEvent:e}),this.sendEmailConfigForm.get("proxyPort").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-send-email-config",template:'
\n \n {{ \'tb.rulenode.use-system-smtp-settings\' | translate }}\n \n
\n \n tb.rulenode.smtp-protocol\n \n \n {{ smtpProtocol.toUpperCase() }}\n \n \n \n
\n \n tb.rulenode.smtp-host\n \n \n {{ \'tb.rulenode.smtp-host-required\' | translate }}\n \n \n \n tb.rulenode.smtp-port\n \n \n {{ \'tb.rulenode.smtp-port-required\' | translate }}\n \n \n {{ \'tb.rulenode.smtp-port-range\' | translate }}\n \n \n {{ \'tb.rulenode.smtp-port-range\' | translate }}\n \n \n
\n \n tb.rulenode.timeout-msec\n \n \n {{ \'tb.rulenode.timeout-required\' | translate }}\n \n \n {{ \'tb.rulenode.min-timeout-msec-message\' | translate }}\n \n \n \n {{ \'tb.rulenode.enable-tls\' | translate }}\n \n \n tb.rulenode.tls-version\n \n \n {{ tlsVersion }}\n \n \n \n \n {{ \'tb.rulenode.enable-proxy\' | translate }}\n \n
\n
\n \n tb.rulenode.proxy-host\n \n \n {{ \'tb.rulenode.proxy-host-required\' | translate }}\n \n \n \n tb.rulenode.proxy-port\n \n \n {{ \'tb.rulenode.proxy-port-required\' | translate }}\n \n \n {{ \'tb.rulenode.proxy-port-range\' | translate }}\n \n \n
\n \n tb.rulenode.proxy-user\n \n \n \n tb.rulenode.proxy-password\n \n \n
\n \n tb.rulenode.username\n \n \n \n tb.rulenode.password\n \n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ve=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.serviceType=a.ServiceType.TB_RULE_ENGINE,n}return b(r,e),r.prototype.configForm=function(){return this.checkPointConfigForm},r.prototype.onConfigurationSet=function(e){this.checkPointConfigForm=this.fb.group({queueName:[e?e.queueName:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-check-point-config",template:'
\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Fe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.allAzureIotHubCredentialsTypes=J,n.azureIotHubCredentialsTypeTranslationsMap=Y,n}return b(r,e),r.prototype.configForm=function(){return this.azureIotHubConfigForm},r.prototype.onConfigurationSet=function(e){this.azureIotHubConfigForm=this.fb.group({topicPattern:[e?e.topicPattern:null,[i.Validators.required]],host:[e?e.host:null,[i.Validators.required]],port:[e?e.port:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(65535)]],connectTimeoutSec:[e?e.connectTimeoutSec:null,[i.Validators.required,i.Validators.min(1),i.Validators.max(200)]],clientId:[e?e.clientId:null,[i.Validators.required]],cleanSession:[!!e&&e.cleanSession,[]],ssl:[!!e&&e.ssl,[]],credentials:this.fb.group({type:[e&&e.credentials?e.credentials.type:null,[i.Validators.required]],sasKey:[e&&e.credentials?e.credentials.sasKey:null,[]],caCert:[e&&e.credentials?e.credentials.caCert:null,[]],caCertFileName:[e&&e.credentials?e.credentials.caCertFileName:null,[]],privateKey:[e&&e.credentials?e.credentials.privateKey:null,[]],privateKeyFileName:[e&&e.credentials?e.credentials.privateKeyFileName:null,[]],cert:[e&&e.credentials?e.credentials.cert:null,[]],certFileName:[e&&e.credentials?e.credentials.certFileName:null,[]],password:[e&&e.credentials?e.credentials.password:null,[]]})})},r.prototype.prepareOutputConfig=function(e){var t=e.credentials.type;return"sas"===t&&(e.credentials={type:t,sasKey:e.credentials.sasKey,caCert:e.credentials.caCert,caCertFileName:e.credentials.caCertFileName}),e},r.prototype.validatorTriggers=function(){return["credentials.type"]},r.prototype.updateValidators=function(e){var t=this.azureIotHubConfigForm.get("credentials"),r=t.get("type").value;switch(e&&t.reset({type:r},{emitEvent:!1}),t.get("sasKey").setValidators([]),t.get("privateKey").setValidators([]),t.get("privateKeyFileName").setValidators([]),t.get("cert").setValidators([]),t.get("certFileName").setValidators([]),r){case"sas":t.get("sasKey").setValidators([i.Validators.required]);break;case"cert.PEM":t.get("privateKey").setValidators([i.Validators.required]),t.get("privateKeyFileName").setValidators([i.Validators.required]),t.get("cert").setValidators([i.Validators.required]),t.get("certFileName").setValidators([i.Validators.required])}t.get("sasKey").updateValueAndValidity({emitEvent:e}),t.get("privateKey").updateValueAndValidity({emitEvent:e}),t.get("privateKeyFileName").updateValueAndValidity({emitEvent:e}),t.get("cert").updateValueAndValidity({emitEvent:e}),t.get("certFileName").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-azure-iot-hub-config",template:'
\n \n tb.rulenode.topic\n \n \n {{ \'tb.rulenode.topic-required\' | translate }}\n \n \n \n tb.rulenode.hostname\n \n \n {{ \'tb.rulenode.hostname-required\' | translate }}\n \n \n \n tb.rulenode.device-id\n \n \n {{ \'tb.rulenode.device-id-required\' | translate }}\n \n \n \n \n \n tb.rulenode.credentials\n \n {{ azureIotHubCredentialsTypeTranslationsMap.get(azureIotHubConfigForm.get(\'credentials.type\').value) | translate }}\n \n \n
\n \n tb.rulenode.credentials-type\n \n \n {{ azureIotHubCredentialsTypeTranslationsMap.get(credentialsType) | translate }}\n \n \n \n {{ \'tb.rulenode.credentials-type-required\' | translate }}\n \n \n
\n \n \n \n \n tb.rulenode.sas-key\n \n \n {{ \'tb.rulenode.sas-key-required\' | translate }}\n \n \n \n \n \n \n \n \n \n \n \n \n \n tb.rulenode.private-key-password\n \n \n \n
\n
\n
\n
\n
\n',styles:[":host .tb-mqtt-credentials-panel-group{margin:0 6px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),xe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.deviceProfile},r.prototype.onConfigurationSet=function(e){this.deviceProfile=this.fb.group({persistAlarmRulesState:[!!e&&e.persistAlarmRulesState,i.Validators.required],fetchAlarmRulesStateOnStart:[!!e&&e.fetchAlarmRulesStateOnStart,i.Validators.required]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-device-profile-config",template:'
\n \n {{ \'tb.rulenode.persist-alarm-rules\' | translate }}\n \n \n {{ \'tb.rulenode.fetch-alarm-rules\' | translate }}\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Te=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.sendSmsConfigForm},r.prototype.onConfigurationSet=function(e){this.sendSmsConfigForm=this.fb.group({numbersToTemplate:[e?e.numbersToTemplate:null,[i.Validators.required]],smsMessageTemplate:[e?e.smsMessageTemplate:null,[i.Validators.required]],useSystemSmsSettings:[!!e&&e.useSystemSmsSettings,[]],smsProviderConfiguration:[e?e.smsProviderConfiguration:null,[]]})},r.prototype.validatorTriggers=function(){return["useSystemSmsSettings"]},r.prototype.updateValidators=function(e){this.sendSmsConfigForm.get("useSystemSmsSettings").value?this.sendSmsConfigForm.get("smsProviderConfiguration").setValidators([]):this.sendSmsConfigForm.get("smsProviderConfiguration").setValidators([i.Validators.required]),this.sendSmsConfigForm.get("smsProviderConfiguration").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-action-node-send-sms-config",template:'
\n \n tb.rulenode.numbers-to-template\n \n \n {{ \'tb.rulenode.numbers-to-template-required\' | translate }}\n \n \n \n \n tb.rulenode.sms-message-template\n \n \n {{ \'tb.rulenode.sms-message-template-required\' | translate }}\n \n \n \n \n {{ \'tb.rulenode.use-system-sms-settings\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),qe=function(){function e(){}return e=h([t.NgModule({declarations:[T,q,S,I,k,N,V,E,A,L,P,ee,te,re,ne,de,pe,ce,fe,ge,ye,be,he,Ce,ve,Fe,xe,Te],imports:[r.CommonModule,a.SharedModule,l.HomeComponentsModule,ue],exports:[T,q,S,I,k,N,V,E,A,L,P,ee,te,re,ne,de,pe,ce,fe,ge,ye,be,he,Ce,ve,Fe,xe,Te]})],e)}(),Se=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.checkMessageConfigForm},r.prototype.onConfigurationSet=function(e){this.checkMessageConfigForm=this.fb.group({messageNames:[e?e.messageNames:null,[]],metadataNames:[e?e.metadataNames:null,[]],checkAllKeys:[!!e&&e.checkAllKeys,[]]})},r.prototype.validateConfig=function(){var e=this.checkMessageConfigForm.get("messageNames").value,t=this.checkMessageConfigForm.get("metadataNames").value;return e.length>0||t.length>0},r.prototype.removeMessageName=function(e){var t=this.checkMessageConfigForm.get("messageNames").value,r=t.indexOf(e);r>=0&&(t.splice(r,1),this.checkMessageConfigForm.get("messageNames").setValue(t,{emitEvent:!0}))},r.prototype.removeMetadataName=function(e){var t=this.checkMessageConfigForm.get("metadataNames").value,r=t.indexOf(e);r>=0&&(t.splice(r,1),this.checkMessageConfigForm.get("metadataNames").setValue(t,{emitEvent:!0}))},r.prototype.addMessageName=function(e){var t=e.input,r=e.value;if((r||"").trim()){r=r.trim();var n=this.checkMessageConfigForm.get("messageNames").value;n&&-1!==n.indexOf(r)||(n||(n=[]),n.push(r),this.checkMessageConfigForm.get("messageNames").setValue(n,{emitEvent:!0}))}t&&(t.value="")},r.prototype.addMetadataName=function(e){var t=e.input,r=e.value;if((r||"").trim()){r=r.trim();var n=this.checkMessageConfigForm.get("metadataNames").value;n&&-1!==n.indexOf(r)||(n||(n=[]),n.push(r),this.checkMessageConfigForm.get("metadataNames").setValue(n,{emitEvent:!0}))}t&&(t.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-check-message-config",template:'
\n \n \n \n \n \n {{messageName}}\n close\n \n \n \n \n
tb.rulenode.separator-hint
\n \n \n \n \n \n {{metadataName}}\n close\n \n \n \n \n
tb.rulenode.separator-hint
\n \n {{ \'tb.rulenode.check-all-keys\' | translate }}\n \n
tb.rulenode.check-all-keys-hint
\n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ie=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.entitySearchDirection=Object.keys(a.EntitySearchDirection),n.entitySearchDirectionTranslationsMap=a.entitySearchDirectionTranslations,n}return b(r,e),r.prototype.configForm=function(){return this.checkRelationConfigForm},r.prototype.onConfigurationSet=function(e){this.checkRelationConfigForm=this.fb.group({checkForSingleEntity:[!!e&&e.checkForSingleEntity,[]],direction:[e?e.direction:null,[]],entityType:[e?e.entityType:null,e&&e.checkForSingleEntity?[i.Validators.required]:[]],entityId:[e?e.entityId:null,e&&e.checkForSingleEntity?[i.Validators.required]:[]],relationType:[e?e.relationType:null,[i.Validators.required]]})},r.prototype.validatorTriggers=function(){return["checkForSingleEntity"]},r.prototype.updateValidators=function(e){var t=this.checkRelationConfigForm.get("checkForSingleEntity").value;this.checkRelationConfigForm.get("entityType").setValidators(t?[i.Validators.required]:[]),this.checkRelationConfigForm.get("entityType").updateValueAndValidity({emitEvent:e}),this.checkRelationConfigForm.get("entityId").setValidators(t?[i.Validators.required]:[]),this.checkRelationConfigForm.get("entityId").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-check-relation-config",template:'
\n \n {{ \'tb.rulenode.check-relation-to-specific-entity\' | translate }}\n \n
tb.rulenode.check-relation-hint
\n \n relation.direction\n \n \n {{ entitySearchDirectionTranslationsMap.get(direction) | translate }}\n \n \n \n
\n \n \n \n \n
\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ke=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.perimeterType=M,n.perimeterTypes=Object.keys(M),n.perimeterTypeTranslationMap=D,n.rangeUnits=Object.keys(O),n.rangeUnitTranslationMap=G,n}return b(r,e),r.prototype.configForm=function(){return this.geoFilterConfigForm},r.prototype.onConfigurationSet=function(e){this.geoFilterConfigForm=this.fb.group({latitudeKeyName:[e?e.latitudeKeyName:null,[i.Validators.required]],longitudeKeyName:[e?e.longitudeKeyName:null,[i.Validators.required]],fetchPerimeterInfoFromMessageMetadata:[!!e&&e.fetchPerimeterInfoFromMessageMetadata,[]],perimeterType:[e?e.perimeterType:null,[]],centerLatitude:[e?e.centerLatitude:null,[]],centerLongitude:[e?e.centerLatitude:null,[]],range:[e?e.range:null,[]],rangeUnit:[e?e.rangeUnit:null,[]],polygonsDefinition:[e?e.polygonsDefinition:null,[]]})},r.prototype.validatorTriggers=function(){return["fetchPerimeterInfoFromMessageMetadata","perimeterType"]},r.prototype.updateValidators=function(e){var t=this.geoFilterConfigForm.get("fetchPerimeterInfoFromMessageMetadata").value,r=this.geoFilterConfigForm.get("perimeterType").value;t?this.geoFilterConfigForm.get("perimeterType").setValidators([]):this.geoFilterConfigForm.get("perimeterType").setValidators([i.Validators.required]),t||r!==M.CIRCLE?(this.geoFilterConfigForm.get("centerLatitude").setValidators([]),this.geoFilterConfigForm.get("centerLongitude").setValidators([]),this.geoFilterConfigForm.get("range").setValidators([]),this.geoFilterConfigForm.get("rangeUnit").setValidators([])):(this.geoFilterConfigForm.get("centerLatitude").setValidators([i.Validators.required,i.Validators.min(-90),i.Validators.max(90)]),this.geoFilterConfigForm.get("centerLongitude").setValidators([i.Validators.required,i.Validators.min(-180),i.Validators.max(180)]),this.geoFilterConfigForm.get("range").setValidators([i.Validators.required,i.Validators.min(0)]),this.geoFilterConfigForm.get("rangeUnit").setValidators([i.Validators.required])),t||r!==M.POLYGON?this.geoFilterConfigForm.get("polygonsDefinition").setValidators([]):this.geoFilterConfigForm.get("polygonsDefinition").setValidators([i.Validators.required]),this.geoFilterConfigForm.get("perimeterType").updateValueAndValidity({emitEvent:!1}),this.geoFilterConfigForm.get("centerLatitude").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("centerLongitude").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("range").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("rangeUnit").updateValueAndValidity({emitEvent:e}),this.geoFilterConfigForm.get("polygonsDefinition").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-gps-geofencing-config",template:'
\n \n tb.rulenode.latitude-key-name\n \n \n {{ \'tb.rulenode.latitude-key-name-required\' | translate }}\n \n \n \n tb.rulenode.longitude-key-name\n \n \n {{ \'tb.rulenode.longitude-key-name-required\' | translate }}\n \n \n \n {{ \'tb.rulenode.fetch-perimeter-info-from-message-metadata\' | translate }}\n \n
\n \n tb.rulenode.perimeter-type\n \n \n {{ perimeterTypeTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n \n tb.rulenode.circle-center-latitude\n \n \n {{ \'tb.rulenode.circle-center-latitude-required\' | translate }}\n \n \n \n tb.rulenode.circle-center-longitude\n \n \n {{ \'tb.rulenode.circle-center-longitude-required\' | translate }}\n \n \n
\n
\n \n tb.rulenode.range\n \n \n {{ \'tb.rulenode.range-required\' | translate }}\n \n \n \n tb.rulenode.range-units\n \n \n {{ rangeUnitTranslationMap.get(type) | translate }}\n \n \n \n
\n
\n
\n
\n \n tb.rulenode.polygon-definition\n \n \n {{ \'tb.rulenode.polygon-definition-required\' | translate }}\n \n \n
\n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ne=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.messageTypeConfigForm},r.prototype.onConfigurationSet=function(e){this.messageTypeConfigForm=this.fb.group({messageTypes:[e?e.messageTypes:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-message-type-config",template:'
\n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ve=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.allowedEntityTypes=[a.EntityType.DEVICE,a.EntityType.ASSET,a.EntityType.ENTITY_VIEW,a.EntityType.TENANT,a.EntityType.CUSTOMER,a.EntityType.USER,a.EntityType.DASHBOARD,a.EntityType.RULE_CHAIN,a.EntityType.RULE_NODE],n}return b(r,e),r.prototype.configForm=function(){return this.originatorTypeConfigForm},r.prototype.onConfigurationSet=function(e){this.originatorTypeConfigForm=this.fb.group({originatorTypes:[e?e.originatorTypes:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-filter-node-originator-type-config",template:'
\n \n \n \n
\n',styles:[":host ::ng-deep tb-entity-type-list .mat-form-field-flex{padding-top:0}:host ::ng-deep tb-entity-type-list .mat-form-field-infix{border-top:0}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ee=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.scriptConfigForm},r.prototype.onConfigurationSet=function(e){this.scriptConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.scriptConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"filter",this.translate.instant("tb.rulenode.filter"),"Filter",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.scriptConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-filter-node-script-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),Ae=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.switchConfigForm},r.prototype.onConfigurationSet=function(e){this.switchConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.switchConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"switch",this.translate.instant("tb.rulenode.switch"),"Switch",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.switchConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-filter-node-switch-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),Le=function(e){function r(t,r,n){var o,l,s=e.call(this,t)||this;s.store=t,s.translate=r,s.fb=n,s.alarmStatusTranslationsMap=a.alarmStatusTranslations,s.alarmStatusList=[],s.searchText="",s.displayStatusFn=s.displayStatus.bind(s);try{for(var m=v(Object.keys(a.AlarmStatus)),u=m.next();!u.done;u=m.next()){var d=u.value;s.alarmStatusList.push(a.AlarmStatus[d])}}catch(e){o={error:e}}finally{try{u&&!u.done&&(l=m.return)&&l.call(m)}finally{if(o)throw o.error}}return s.statusFormControl=new i.FormControl(""),s.filteredAlarmStatus=s.statusFormControl.valueChanges.pipe(f.startWith(""),f.map((function(e){return e||""})),f.mergeMap((function(e){return s.fetchAlarmStatus(e)})),f.share()),s}return b(r,e),r.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this)},r.prototype.configForm=function(){return this.alarmStatusConfigForm},r.prototype.prepareInputConfig=function(e){return this.searchText="",this.statusFormControl.patchValue("",{emitEvent:!0}),e},r.prototype.onConfigurationSet=function(e){this.alarmStatusConfigForm=this.fb.group({alarmStatusList:[e?e.alarmStatusList:null,[i.Validators.required]]})},r.prototype.displayStatus=function(e){return e?this.translate.instant(a.alarmStatusTranslations.get(e)):void 0},r.prototype.fetchAlarmStatus=function(e){var t=this,r=this.getAlarmStatusList();if(this.searchText=e,this.searchText&&this.searchText.length){var n=this.searchText.toUpperCase();return c.of(r.filter((function(e){return t.translate.instant(a.alarmStatusTranslations.get(a.AlarmStatus[e])).toUpperCase().includes(n)})))}return c.of(r)},r.prototype.alarmStatusSelected=function(e){this.addAlarmStatus(e.option.value),this.clear("")},r.prototype.removeAlarmStatus=function(e){var t=this.alarmStatusConfigForm.get("alarmStatusList").value;if(t){var r=t.indexOf(e);r>=0&&(t.splice(r,1),this.alarmStatusConfigForm.get("alarmStatusList").setValue(t))}},r.prototype.addAlarmStatus=function(e){var t=this.alarmStatusConfigForm.get("alarmStatusList").value;t||(t=[]),-1===t.indexOf(e)&&(t.push(e),this.alarmStatusConfigForm.get("alarmStatusList").setValue(t))},r.prototype.getAlarmStatusList=function(){var e=this;return this.alarmStatusList.filter((function(t){return-1===e.alarmStatusConfigForm.get("alarmStatusList").value.indexOf(t)}))},r.prototype.onAlarmStatusInputFocus=function(){this.statusFormControl.updateValueAndValidity({onlySelf:!0,emitEvent:!0})},r.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this.alarmStatusInput.nativeElement.value=e,this.statusFormControl.patchValue(null,{emitEvent:!0}),setTimeout((function(){t.alarmStatusInput.nativeElement.blur(),t.alarmStatusInput.nativeElement.focus()}),0)},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:i.FormBuilder}]},h([t.ViewChild("alarmStatusInput",{static:!1}),C("design:type",t.ElementRef)],r.prototype,"alarmStatusInput",void 0),r=h([t.Component({selector:"tb-filter-node-check-alarm-status-config",template:'
\n \n tb.rulenode.alarm-status-filter\n \n \n \n {{alarmStatusTranslationsMap.get(alarmStatus) | translate}}\n \n close\n \n \n \n \n \n \n \n \n
\n
\n tb.rulenode.no-alarm-status-matching\n
\n
\n
\n
\n
\n \n
\n\n\n\n'}),C("design:paramtypes",[o.Store,n.TranslateService,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Pe=function(){function e(){}return e=h([t.NgModule({declarations:[Se,Ie,ke,Ne,Ve,Ee,Ae,Le],imports:[r.CommonModule,a.SharedModule,ue],exports:[Se,Ie,ke,Ne,Ve,Ee,Ae,Le]})],e)}(),Me=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.customerAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.customerAttributesConfigForm=this.fb.group({telemetry:[!!e&&e.telemetry,[]],attrMapping:[e?e.attrMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-customer-attributes-config",template:'
\n \n \n {{ \'tb.rulenode.latest-telemetry\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),we=function(e){function r(t,r,n){var a,o,l=e.call(this,t)||this;l.store=t,l.translate=r,l.fb=n,l.entityDetailsTranslationsMap=z,l.entityDetailsList=[],l.searchText="",l.displayDetailsFn=l.displayDetails.bind(l);try{for(var s=v(Object.keys(B)),m=s.next();!m.done;m=s.next()){var u=m.value;l.entityDetailsList.push(B[u])}}catch(e){a={error:e}}finally{try{m&&!m.done&&(o=s.return)&&o.call(s)}finally{if(a)throw a.error}}return l.detailsFormControl=new i.FormControl(""),l.filteredEntityDetails=l.detailsFormControl.valueChanges.pipe(f.startWith(""),f.map((function(e){return e||""})),f.mergeMap((function(e){return l.fetchEntityDetails(e)})),f.share()),l}return b(r,e),r.prototype.ngOnInit=function(){e.prototype.ngOnInit.call(this)},r.prototype.configForm=function(){return this.entityDetailsConfigForm},r.prototype.prepareInputConfig=function(e){return this.searchText="",this.detailsFormControl.patchValue("",{emitEvent:!0}),e},r.prototype.onConfigurationSet=function(e){this.entityDetailsConfigForm=this.fb.group({detailsList:[e?e.detailsList:null,[i.Validators.required]],addToMetadata:[!!e&&e.addToMetadata,[]]})},r.prototype.displayDetails=function(e){return e?this.translate.instant(z.get(e)):void 0},r.prototype.fetchEntityDetails=function(e){var t=this;if(this.searchText=e,this.searchText&&this.searchText.length){var r=this.searchText.toUpperCase();return c.of(this.entityDetailsList.filter((function(e){return t.translate.instant(z.get(B[e])).toUpperCase().includes(r)})))}return c.of(this.entityDetailsList)},r.prototype.detailsFieldSelected=function(e){this.addDetailsField(e.option.value),this.clear("")},r.prototype.removeDetailsField=function(e){var t=this.entityDetailsConfigForm.get("detailsList").value;if(t){var r=t.indexOf(e);r>=0&&(t.splice(r,1),this.entityDetailsConfigForm.get("detailsList").setValue(t))}},r.prototype.addDetailsField=function(e){var t=this.entityDetailsConfigForm.get("detailsList").value;t||(t=[]),-1===t.indexOf(e)&&(t.push(e),this.entityDetailsConfigForm.get("detailsList").setValue(t))},r.prototype.onEntityDetailsInputFocus=function(){this.detailsFormControl.updateValueAndValidity({onlySelf:!0,emitEvent:!0})},r.prototype.clear=function(e){var t=this;void 0===e&&(e=""),this.detailsInput.nativeElement.value=e,this.detailsFormControl.patchValue(null,{emitEvent:!0}),setTimeout((function(){t.detailsInput.nativeElement.blur(),t.detailsInput.nativeElement.focus()}),0)},r.ctorParameters=function(){return[{type:o.Store},{type:n.TranslateService},{type:i.FormBuilder}]},h([t.ViewChild("detailsInput",{static:!1}),C("design:type",t.ElementRef)],r.prototype,"detailsInput",void 0),r=h([t.Component({selector:"tb-enrichment-node-entity-details-config",template:'
\n \n tb.rulenode.entity-details\n \n \n \n {{entityDetailsTranslationsMap.get(details) | translate}}\n \n close\n \n \n \n \n \n \n \n \n
\n
\n tb.rulenode.no-entity-details-matching\n
\n
\n
\n
\n
\n \n \n {{ \'tb.rulenode.add-to-metadata\' | translate }}\n \n
tb.rulenode.add-to-metadata-hint
\n
\n',styles:[":host ::ng-deep mat-form-field.entity-fields-list .mat-form-field-wrapper{margin-bottom:-1.25em}"]}),C("design:paramtypes",[o.Store,n.TranslateService,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Re=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.deviceAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.deviceAttributesConfigForm=this.fb.group({deviceRelationsQuery:[e?e.deviceRelationsQuery:null,[i.Validators.required]],tellFailureIfAbsent:[!!e&&e.tellFailureIfAbsent,[]],clientAttributeNames:[e?e.clientAttributeNames:null,[]],sharedAttributeNames:[e?e.sharedAttributeNames:null,[]],serverAttributeNames:[e?e.serverAttributeNames:null,[]],latestTsKeyNames:[e?e.latestTsKeyNames:null,[]],getLatestValueWithTs:[!!e&&e.getLatestValueWithTs,[]]})},r.prototype.removeKey=function(e,t){var r=this.deviceAttributesConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.deviceAttributesConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.deviceAttributesConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.deviceAttributesConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-device-attributes-config",template:'
\n \n \n \n \n {{ \'tb.rulenode.tell-failure-if-absent\' | translate }}\n \n
tb.rulenode.tell-failure-if-absent-hint
\n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n {{ \'tb.rulenode.get-latest-value-with-ts\' | translate }}\n \n
tb.rulenode.get-latest-value-with-ts-hint
\n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),De=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.originatorAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.originatorAttributesConfigForm=this.fb.group({tellFailureIfAbsent:[!!e&&e.tellFailureIfAbsent,[]],clientAttributeNames:[e?e.clientAttributeNames:null,[]],sharedAttributeNames:[e?e.sharedAttributeNames:null,[]],serverAttributeNames:[e?e.serverAttributeNames:null,[]],latestTsKeyNames:[e?e.latestTsKeyNames:null,[]],getLatestValueWithTs:[!!e&&e.getLatestValueWithTs,[]]})},r.prototype.removeKey=function(e,t){var r=this.originatorAttributesConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.originatorAttributesConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.originatorAttributesConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.originatorAttributesConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-originator-attributes-config",template:'
\n \n {{ \'tb.rulenode.tell-failure-if-absent\' | translate }}\n \n
tb.rulenode.tell-failure-if-absent-hint
\n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n {{ \'tb.rulenode.get-latest-value-with-ts\' | translate }}\n \n
tb.rulenode.get-latest-value-with-ts-hint
\n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Oe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.originatorFieldsConfigForm},r.prototype.onConfigurationSet=function(e){this.originatorFieldsConfigForm=this.fb.group({fieldsMapping:[e?e.fieldsMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-originator-fields-config",template:'
\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ke=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n.fetchMode=H,n.fetchModes=Object.keys(H),n.samplingOrders=Object.keys(U),n.timeUnits=Object.keys(R),n.timeUnitsTranslationMap=K,n}return b(r,e),r.prototype.configForm=function(){return this.getTelemetryFromDatabaseConfigForm},r.prototype.onConfigurationSet=function(e){this.getTelemetryFromDatabaseConfigForm=this.fb.group({latestTsKeyNames:[e?e.latestTsKeyNames:null,[]],fetchMode:[e?e.fetchMode:null,[i.Validators.required]],orderBy:[e?e.orderBy:null,[]],limit:[e?e.limit:null,[]],useMetadataIntervalPatterns:[!!e&&e.useMetadataIntervalPatterns,[]],startInterval:[e?e.startInterval:null,[]],startIntervalTimeUnit:[e?e.startIntervalTimeUnit:null,[]],endInterval:[e?e.endInterval:null,[]],endIntervalTimeUnit:[e?e.endIntervalTimeUnit:null,[]],startIntervalPattern:[e?e.startIntervalPattern:null,[]],endIntervalPattern:[e?e.endIntervalPattern:null,[]]})},r.prototype.validatorTriggers=function(){return["fetchMode","useMetadataIntervalPatterns"]},r.prototype.updateValidators=function(e){var t=this.getTelemetryFromDatabaseConfigForm.get("fetchMode").value,r=this.getTelemetryFromDatabaseConfigForm.get("useMetadataIntervalPatterns").value;t&&t===H.ALL?(this.getTelemetryFromDatabaseConfigForm.get("orderBy").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("limit").setValidators([i.Validators.required,i.Validators.min(2),i.Validators.max(1e3)])):(this.getTelemetryFromDatabaseConfigForm.get("orderBy").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("limit").setValidators([])),r?(this.getTelemetryFromDatabaseConfigForm.get("startInterval").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalTimeUnit").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("endInterval").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalTimeUnit").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalPattern").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalPattern").setValidators([i.Validators.required])):(this.getTelemetryFromDatabaseConfigForm.get("startInterval").setValidators([i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalTimeUnit").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("endInterval").setValidators([i.Validators.required,i.Validators.min(1),i.Validators.max(2147483647)]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalTimeUnit").setValidators([i.Validators.required]),this.getTelemetryFromDatabaseConfigForm.get("startIntervalPattern").setValidators([]),this.getTelemetryFromDatabaseConfigForm.get("endIntervalPattern").setValidators([])),this.getTelemetryFromDatabaseConfigForm.get("orderBy").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("limit").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("startInterval").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("startIntervalTimeUnit").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("endInterval").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("endIntervalTimeUnit").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("startIntervalPattern").updateValueAndValidity({emitEvent:e}),this.getTelemetryFromDatabaseConfigForm.get("endIntervalPattern").updateValueAndValidity({emitEvent:e})},r.prototype.removeKey=function(e,t){var r=this.getTelemetryFromDatabaseConfigForm.get(t).value,n=r.indexOf(e);n>=0&&(r.splice(n,1),this.getTelemetryFromDatabaseConfigForm.get(t).setValue(r,{emitEvent:!0}))},r.prototype.addKey=function(e,t){var r=e.input,n=e.value;if((n||"").trim()){n=n.trim();var a=this.getTelemetryFromDatabaseConfigForm.get(t).value;a&&-1!==a.indexOf(n)||(a||(a=[]),a.push(n),this.getTelemetryFromDatabaseConfigForm.get(t).setValue(a,{emitEvent:!0}))}r&&(r.value="")},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-get-telemetry-from-database",template:'
\n \n \n \n \n \n {{key}}\n close\n \n \n \n \n \n \n tb.rulenode.fetch-mode\n \n \n {{ mode }}\n \n \n tb.rulenode.fetch-mode-hint\n \n
\n \n tb.rulenode.order-by\n \n \n {{ order }}\n \n \n tb.rulenode.order-by-hint\n \n \n tb.rulenode.limit\n \n tb.rulenode.limit-hint\n \n
\n \n {{ \'tb.rulenode.use-metadata-interval-patterns\' | translate }}\n \n
tb.rulenode.use-metadata-interval-patterns-hint
\n
\n
\n \n tb.rulenode.start-interval\n \n \n {{ \'tb.rulenode.start-interval-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.start-interval-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n \n tb.rulenode.end-interval\n \n \n {{ \'tb.rulenode.end-interval-value-required\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n {{ \'tb.rulenode.time-value-range\' | translate }}\n \n \n \n tb.rulenode.end-interval-time-unit\n \n \n {{ timeUnitsTranslationMap.get(timeUnit) | translate }}\n \n \n \n
\n
\n \n \n tb.rulenode.start-interval-pattern\n \n \n {{ \'tb.rulenode.start-interval-pattern-required\' | translate }}\n \n \n \n \n tb.rulenode.end-interval-pattern\n \n \n {{ \'tb.rulenode.end-interval-pattern-required\' | translate }}\n \n \n \n \n
\n',styles:[":host label.tb-title{margin-bottom:-10px}"]}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Be=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.relatedAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.relatedAttributesConfigForm=this.fb.group({relationsQuery:[e?e.relationsQuery:null,[i.Validators.required]],telemetry:[!!e&&e.telemetry,[]],attrMapping:[e?e.attrMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-related-attributes-config",template:'
\n \n \n \n \n \n {{ \'tb.rulenode.latest-telemetry\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ge=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.tenantAttributesConfigForm},r.prototype.onConfigurationSet=function(e){this.tenantAttributesConfigForm=this.fb.group({telemetry:[!!e&&e.telemetry,[]],attrMapping:[e?e.attrMapping:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-tenant-attributes-config",template:'
\n \n \n {{ \'tb.rulenode.latest-telemetry\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),He=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.separatorKeysCodes=[m.ENTER,m.COMMA,m.SEMICOLON],n}return b(r,e),r.prototype.configForm=function(){return this.calculateDeltaConfigForm},r.prototype.onConfigurationSet=function(e){this.calculateDeltaConfigForm=this.fb.group({inputValueKey:[e?e.inputValueKey:null,[i.Validators.required]],outputValueKey:[e?e.outputValueKey:null,[i.Validators.required]],useCache:[e?e.useCache:null,[]],addPeriodBetweenMsgs:[!!e&&e.addPeriodBetweenMsgs,[]],periodValueKey:[e?e.periodValueKey:null,[]],round:[e?e.round:null,[i.Validators.min(0),i.Validators.max(15)]],tellFailureIfDeltaIsNegative:[e?e.tellFailureIfDeltaIsNegative:null,[]]})},r.prototype.updateValidators=function(e){this.calculateDeltaConfigForm.get("addPeriodBetweenMsgs").value?this.calculateDeltaConfigForm.get("periodValueKey").setValidators([i.Validators.required]):this.calculateDeltaConfigForm.get("periodValueKey").setValidators([]),this.calculateDeltaConfigForm.get("periodValueKey").updateValueAndValidity({emitEvent:e})},r.prototype.validatorTriggers=function(){return["addPeriodBetweenMsgs"]},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-enrichment-node-calculate-delta-config",template:'
\n
\n \n tb.rulenode.input-value-key\n \n \n {{ \'tb.rulenode.input-value-key-required\' | translate }}\n \n \n \n tb.rulenode.output-value-key\n \n \n {{ \'tb.rulenode.output-value-key-required\' | translate }}\n \n \n \n tb.rulenode.round\n \n \n {{ \'tb.rulenode.round-range\' | translate }}\n \n \n {{ \'tb.rulenode.round-range\' | translate }}\n \n \n
\n \n {{ \'tb.rulenode.use-cache\' | translate }}\n \n \n {{ \'tb.rulenode.tell-failure-if-delta-is-negative\' | translate }}\n \n \n {{ \'tb.rulenode.add-period-between-msgs\' | translate }}\n \n \n tb.rulenode.period-value-key\n \n \n {{ \'tb.rulenode.period-value-key-required\' | translate }}\n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),Ue=function(){function e(){}return e=h([t.NgModule({declarations:[Me,we,Re,De,Oe,Ke,Be,Ge,He],imports:[r.CommonModule,a.SharedModule,ue],exports:[Me,we,Re,De,Oe,Ke,Be,Ge,He]})],e)}(),je=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n.originatorSource=F,n.originatorSources=Object.keys(F),n.originatorSourceTranslationMap=w,n}return b(r,e),r.prototype.configForm=function(){return this.changeOriginatorConfigForm},r.prototype.onConfigurationSet=function(e){this.changeOriginatorConfigForm=this.fb.group({originatorSource:[e?e.originatorSource:null,[i.Validators.required]],relationsQuery:[e?e.relationsQuery:null,[]]})},r.prototype.validatorTriggers=function(){return["originatorSource"]},r.prototype.updateValidators=function(e){var t=this.changeOriginatorConfigForm.get("originatorSource").value;t&&t===F.RELATED?this.changeOriginatorConfigForm.get("relationsQuery").setValidators([i.Validators.required]):this.changeOriginatorConfigForm.get("relationsQuery").setValidators([]),this.changeOriginatorConfigForm.get("relationsQuery").updateValueAndValidity({emitEvent:e})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-transformation-node-change-originator-config",template:'
\n \n tb.rulenode.originator-source\n \n \n {{ originatorSourceTranslationMap.get(source) | translate }}\n \n \n \n
\n \n \n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),ze=function(e){function r(t,r,n,a){var o=e.call(this,t)||this;return o.store=t,o.fb=r,o.nodeScriptTestService=n,o.translate=a,o}return b(r,e),r.prototype.configForm=function(){return this.scriptConfigForm},r.prototype.onConfigurationSet=function(e){this.scriptConfigForm=this.fb.group({jsScript:[e?e.jsScript:null,[i.Validators.required]]})},r.prototype.testScript=function(){var e=this,t=this.scriptConfigForm.get("jsScript").value;this.nodeScriptTestService.testNodeScript(t,"update",this.translate.instant("tb.rulenode.transformer"),"Transform",["msg","metadata","msgType"],this.ruleNodeId).subscribe((function(t){t&&e.scriptConfigForm.get("jsScript").setValue(t)}))},r.prototype.onValidate=function(){this.jsFuncComponent.validateOnSubmit()},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder},{type:s.NodeScriptTestService},{type:n.TranslateService}]},h([t.ViewChild("jsFuncComponent",{static:!0}),C("design:type",a.JsFuncComponent)],r.prototype,"jsFuncComponent",void 0),r=h([t.Component({selector:"tb-transformation-node-script-config",template:'
\n \n \n \n
\n \n
\n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder,s.NodeScriptTestService,n.TranslateService])],r)}(a.RuleNodeConfigurationComponent),Qe=function(e){function r(t,r){var n=e.call(this,t)||this;return n.store=t,n.fb=r,n}return b(r,e),r.prototype.configForm=function(){return this.toEmailConfigForm},r.prototype.onConfigurationSet=function(e){this.toEmailConfigForm=this.fb.group({fromTemplate:[e?e.fromTemplate:null,[i.Validators.required]],toTemplate:[e?e.toTemplate:null,[i.Validators.required]],ccTemplate:[e?e.ccTemplate:null,[]],bccTemplate:[e?e.bccTemplate:null,[]],subjectTemplate:[e?e.subjectTemplate:null,[i.Validators.required]],bodyTemplate:[e?e.bodyTemplate:null,[i.Validators.required]]})},r.ctorParameters=function(){return[{type:o.Store},{type:i.FormBuilder}]},r=h([t.Component({selector:"tb-transformation-node-to-email-config",template:'
\n \n tb.rulenode.from-template\n \n \n {{ \'tb.rulenode.from-template-required\' | translate }}\n \n \n \n \n tb.rulenode.to-template\n \n \n {{ \'tb.rulenode.to-template-required\' | translate }}\n \n \n \n \n tb.rulenode.cc-template\n \n \n \n \n tb.rulenode.bcc-template\n \n \n \n \n tb.rulenode.subject-template\n \n \n {{ \'tb.rulenode.subject-template-required\' | translate }}\n \n \n \n \n tb.rulenode.body-template\n \n \n {{ \'tb.rulenode.body-template-required\' | translate }}\n \n \n \n
\n'}),C("design:paramtypes",[o.Store,i.FormBuilder])],r)}(a.RuleNodeConfigurationComponent),_e=function(){function e(){}return e=h([t.NgModule({declarations:[je,ze,Qe],imports:[r.CommonModule,a.SharedModule,ue],exports:[je,ze,Qe]})],e)}(),$e=function(){function e(e){!function(e){e.setTranslation("en_US",{tb:{rulenode:{"create-entity-if-not-exists":"Create new entity if not exists","create-entity-if-not-exists-hint":"Create a new entity set above if it does not exist.","entity-name-pattern":"Name pattern","entity-name-pattern-required":"Name pattern is required","entity-type-pattern":"Type pattern","entity-type-pattern-required":"Type pattern is required","entity-cache-expiration":"Entities cache expiration time (sec)","entity-cache-expiration-hint":"Specifies maximum time interval allowed to store found entity records. 0 value means that records will never expire.","entity-cache-expiration-required":"Entities cache expiration time is required.","entity-cache-expiration-range":"Entities cache expiration time should be greater than or equal to 0.","customer-name-pattern":"Customer name pattern","customer-name-pattern-required":"Customer name pattern is required","create-customer-if-not-exists":"Create new customer if not exists","customer-cache-expiration":"Customers cache expiration time (sec)","customer-cache-expiration-hint":"Specifies maximum time interval allowed to store found customer records. 0 value means that records will never expire.","customer-cache-expiration-required":"Customers cache expiration time is required.","customer-cache-expiration-range":"Customers cache expiration time should be greater than or equal to 0.","start-interval":"Start Interval","end-interval":"End Interval","start-interval-time-unit":"Start Interval Time Unit","end-interval-time-unit":"End Interval Time Unit","fetch-mode":"Fetch mode","fetch-mode-hint":"If selected fetch mode 'ALL' you able to choose telemetry sampling order.","order-by":"Order by","order-by-hint":"Select to choose telemetry sampling order.",limit:"Limit","limit-hint":"Min limit value is 2, max - 1000. In case you want to fetch a single entry, select fetch mode 'FIRST' or 'LAST'.","time-unit-milliseconds":"Milliseconds","time-unit-seconds":"Seconds","time-unit-minutes":"Minutes","time-unit-hours":"Hours","time-unit-days":"Days","time-value-range":"Time value should be in a range from 1 to 2147483647.","start-interval-value-required":"Start interval value is required.","end-interval-value-required":"End interval value is required.",filter:"Filter",switch:"Switch","message-type":"Message type","message-type-required":"Message type is required.","message-types-filter":"Message types filter","no-message-types-found":"No message types found","no-message-type-matching":"'{{messageType}}' not found.","create-new-message-type":"Create a new one!","message-types-required":"Message types are required.","client-attributes":"Client attributes","shared-attributes":"Shared attributes","server-attributes":"Server attributes","notify-device":"Notify Device","notify-device-hint":"If the message arrives from the device, we will push it back to the device by default.","latest-timeseries":"Latest timeseries","data-keys":"Message data","metadata-keys":"Message metadata","relations-query":"Relations query","device-relations-query":"Device relations query","max-relation-level":"Max relation level","relation-type-pattern":"Relation type pattern","relation-type-pattern-required":"Relation type pattern is required","relation-types-list":"Relation types to propagate","relation-types-list-hint":"If Propagate relation types are not selected, alarms will be propagated without filtering by relation type.","unlimited-level":"Unlimited level","latest-telemetry":"Latest telemetry","attr-mapping":"Attributes mapping","source-attribute":"Source attribute","source-attribute-required":"Source attribute is required.","source-telemetry":"Source telemetry","source-telemetry-required":"Source telemetry is required.","target-attribute":"Target attribute","target-attribute-required":"Target attribute is required.","attr-mapping-required":"At least one attribute mapping should be specified.","fields-mapping":"Fields mapping","fields-mapping-required":"At least one field mapping should be specified.","source-field":"Source field","source-field-required":"Source field is required.","originator-source":"Originator source","originator-customer":"Customer","originator-tenant":"Tenant","originator-related":"Related","originator-alarm-originator":"Alarm Originator","clone-message":"Clone message",transform:"Transform","default-ttl":"Default TTL in seconds","default-ttl-required":"Default TTL is required.","min-default-ttl-message":"Only 0 minimum TTL is allowed.","message-count":"Message count (0 - unlimited)","message-count-required":"Message count is required.","min-message-count-message":"Only 0 minimum message count is allowed.","period-seconds":"Period in seconds","period-seconds-required":"Period is required.","use-metadata-period-in-seconds-patterns":"Use period in seconds pattern","use-metadata-period-in-seconds-patterns-hint":"If selected, rule node use period in seconds interval pattern from message metadata or data assuming that intervals are in the seconds.","period-in-seconds-pattern":"Period in seconds pattern","period-in-seconds-pattern-required":"Period in seconds pattern is required","min-period-seconds-message":"Only 1 second minimum period is allowed.",originator:"Originator","message-body":"Message body","message-metadata":"Message metadata",generate:"Generate","test-generator-function":"Test generator function",generator:"Generator","test-filter-function":"Test filter function","test-switch-function":"Test switch function","test-transformer-function":"Test transformer function",transformer:"Transformer","alarm-create-condition":"Alarm create condition","test-condition-function":"Test condition function","alarm-clear-condition":"Alarm clear condition","alarm-details-builder":"Alarm details builder","test-details-function":"Test details function","alarm-type":"Alarm type","alarm-type-required":"Alarm type is required.","alarm-severity":"Alarm severity","alarm-severity-required":"Alarm severity is required","alarm-status-filter":"Alarm status filter","alarm-status-list-empty":"Alarm status list is empty","no-alarm-status-matching":"No alarm status matching were found.",propagate:"Propagate",condition:"Condition",details:"Details","to-string":"To string","test-to-string-function":"Test to string function","from-template":"From Template","from-template-required":"From Template is required","to-template":"To Template","to-template-required":"To Template is required","mail-address-list-template-hint":'Comma separated address list, use ${metadataKey} for value from metadata, $[messageKey] for value from message body',"cc-template":"Cc Template","bcc-template":"Bcc Template","subject-template":"Subject Template","subject-template-required":"Subject Template is required","body-template":"Body Template","body-template-required":"Body Template is required","request-id-metadata-attribute":"Request Id Metadata attribute name","timeout-sec":"Timeout in seconds","timeout-required":"Timeout is required","min-timeout-message":"Only 0 minimum timeout value is allowed.","endpoint-url-pattern":"Endpoint URL pattern","endpoint-url-pattern-required":"Endpoint URL pattern is required","request-method":"Request method","use-simple-client-http-factory":"Use simple client HTTP factory","read-timeout":"Read timeout in millis","read-timeout-hint":"The value of 0 means an infinite timeout","max-parallel-requests-count":"Max number of parallel requests","max-parallel-requests-count-hint":"The value of 0 specifies no limit in parallel processing",headers:"Headers","headers-hint":'Use ${metadataKey} for value from metadata, $[messageKey] for value from message body in header/value fields',header:"Header","header-required":"Header is required",value:"Value","value-required":"Value is required","topic-pattern":"Topic pattern","topic-pattern-required":"Topic pattern is required",topic:"Topic","topic-required":"Topic is required","bootstrap-servers":"Bootstrap servers","bootstrap-servers-required":"Bootstrap servers value is required","other-properties":"Other properties",key:"Key","key-required":"Key is required",retries:"Automatically retry times if fails","min-retries-message":"Only 0 minimum retries is allowed.","batch-size-bytes":"Produces batch size in bytes","min-batch-size-bytes-message":"Only 0 minimum batch size is allowed.","linger-ms":"Time to buffer locally (ms)","min-linger-ms-message":"Only 0 ms minimum value is allowed.","buffer-memory-bytes":"Client buffer max size in bytes","min-buffer-memory-message":"Only 0 minimum buffer size is allowed.",acks:"Number of acknowledgments","key-serializer":"Key serializer","key-serializer-required":"Key serializer is required","value-serializer":"Value serializer","value-serializer-required":"Value serializer is required","topic-arn-pattern":"Topic ARN pattern","topic-arn-pattern-required":"Topic ARN pattern is required","aws-access-key-id":"AWS Access Key ID","aws-access-key-id-required":"AWS Access Key ID is required","aws-secret-access-key":"AWS Secret Access Key","aws-secret-access-key-required":"AWS Secret Access Key is required","aws-region":"AWS Region","aws-region-required":"AWS Region is required","exchange-name-pattern":"Exchange name pattern","routing-key-pattern":"Routing key pattern","message-properties":"Message properties",host:"Host","host-required":"Host is required",port:"Port","port-required":"Port is required","port-range":"Port should be in a range from 1 to 65535.","virtual-host":"Virtual host",username:"Username",password:"Password","automatic-recovery":"Automatic recovery","connection-timeout-ms":"Connection timeout (ms)","min-connection-timeout-ms-message":"Only 0 ms minimum value is allowed.","handshake-timeout-ms":"Handshake timeout (ms)","min-handshake-timeout-ms-message":"Only 0 ms minimum value is allowed.","client-properties":"Client properties","queue-url-pattern":"Queue URL pattern","queue-url-pattern-required":"Queue URL pattern is required","delay-seconds":"Delay (seconds)","min-delay-seconds-message":"Only 0 seconds minimum value is allowed.","max-delay-seconds-message":"Only 900 seconds maximum value is allowed.",name:"Name","name-required":"Name is required","queue-type":"Queue type","sqs-queue-standard":"Standard","sqs-queue-fifo":"FIFO","gcp-project-id":"GCP project ID","gcp-project-id-required":"GCP project ID is required","gcp-service-account-key":"GCP service account key file","gcp-service-account-key-required":"GCP service account key file is required","pubsub-topic-name":"Topic name","pubsub-topic-name-required":"Topic name is required","message-attributes":"Message attributes","message-attributes-hint":'Use ${metadataKey} for value from metadata, $[messageKey] for value from message body in name/value fields',"connect-timeout":"Connection timeout (sec)","connect-timeout-required":"Connection timeout is required.","connect-timeout-range":"Connection timeout should be in a range from 1 to 200.","client-id":"Client ID","device-id":"Device ID","device-id-required":"Device ID is required.","clean-session":"Clean session","enable-ssl":"Enable SSL",credentials:"Credentials","credentials-type":"Credentials type","credentials-type-required":"Credentials type is required.","credentials-anonymous":"Anonymous","credentials-basic":"Basic","credentials-pem":"PEM","credentials-pem-hint":"At least Server CA certificate file or a pair of Client certificate and Client private key files are required","credentials-sas":"Shared Access Signature","sas-key":"SAS Key","sas-key-required":"SAS Key is required.",hostname:"Hostname","hostname-required":"Hostname is required.","azure-ca-cert":"CA certificate file","username-required":"Username is required.","password-required":"Password is required.","ca-cert":"Server CA certificate file *","private-key":"Client private key file *",cert:"Client certificate file *","no-file":"No file selected.","drop-file":"Drop a file or click to select a file to upload.","private-key-password":"Private key password","use-system-smtp-settings":"Use system SMTP settings","use-metadata-interval-patterns":"Use interval patterns","use-metadata-interval-patterns-hint":"If selected, rule node use start and end interval patterns from message metadata or data assuming that intervals are in the milliseconds.","use-message-alarm-data":"Use message alarm data","check-all-keys":"Check that all selected keys are present","check-all-keys-hint":"If selected, checks that all specified keys are present in the message data and metadata.","check-relation-to-specific-entity":"Check relation to specific entity","check-relation-hint":"Checks existence of relation to specific entity or to any entity based on direction and relation type.","delete-relation-to-specific-entity":"Delete relation to specific entity","delete-relation-hint":"Deletes relation from the originator of the incoming message to the specified entity or list of entities based on direction and type.","remove-current-relations":"Remove current relations","remove-current-relations-hint":"Removes current relations from the originator of the incoming message based on direction and type.","change-originator-to-related-entity":"Change originator to related entity","change-originator-to-related-entity-hint":"Used to process submitted message as a message from another entity.","start-interval-pattern":"Start interval pattern","end-interval-pattern":"End interval pattern","start-interval-pattern-required":"Start interval pattern is required","end-interval-pattern-required":"End interval pattern is required","smtp-protocol":"Protocol","smtp-host":"SMTP host","smtp-host-required":"SMTP host is required.","smtp-port":"SMTP port","smtp-port-required":"You must supply a smtp port.","smtp-port-range":"SMTP port should be in a range from 1 to 65535.","timeout-msec":"Timeout ms","min-timeout-msec-message":"Only 0 ms minimum value is allowed.","enter-username":"Enter username","enter-password":"Enter password","enable-tls":"Enable TLS","tls-version":"TLS version","enable-proxy":"Enable proxy","use-system-proxy-properties":"Use system proxy properties","proxy-host":"Proxy host","proxy-host-required":"Proxy host is required.","proxy-port":"Proxy port","proxy-port-required":"Proxy port is required.","proxy-port-range":"Proxy port should be in a range from 1 to 65535.","proxy-user":"Proxy user","proxy-password":"Proxy password","proxy-scheme":"Proxy scheme","numbers-to-template":"Phone Numbers To Template","numbers-to-template-required":"Phone Numbers To Template is required","numbers-to-template-hint":'Comma separated Phone Numbers, use ${metadataKey} for value from metadata, $[messageKey] for value from message body',"sms-message-template":"SMS message Template","sms-message-template-required":"SMS message Template is required","use-system-sms-settings":"Use system SMS provider settings","min-period-0-seconds-message":"Only 0 second minimum period is allowed.","max-pending-messages":"Maximum pending messages","max-pending-messages-required":"Maximum pending messages is required.","max-pending-messages-range":"Maximum pending messages should be in a range from 1 to 100000.","originator-types-filter":"Originator types filter","interval-seconds":"Interval in seconds","interval-seconds-required":"Interval is required.","min-interval-seconds-message":"Only 1 second minimum interval is allowed.","output-timeseries-key-prefix":"Output timeseries key prefix","output-timeseries-key-prefix-required":"Output timeseries key prefix required.","separator-hint":'You should press "enter" to complete field input.',"entity-details":"Select entity details:","entity-details-title":"Title","entity-details-country":"Country","entity-details-state":"State","entity-details-zip":"Zip","entity-details-address":"Address","entity-details-address2":"Address2","entity-details-additional_info":"Additional Info","entity-details-phone":"Phone","entity-details-email":"Email","add-to-metadata":"Add selected details to message metadata","add-to-metadata-hint":"If selected, adds the selected details keys to the message metadata instead of message data.","entity-details-list-empty":"No entity details selected.","no-entity-details-matching":"No entity details matching were found.","custom-table-name":"Custom table name","custom-table-name-required":"Table Name is required","custom-table-hint":"You should enter the table name without prefix 'cs_tb_'.","message-field":"Message field","message-field-required":"Message field is required.","table-col":"Table column","table-col-required":"Table column is required.","latitude-key-name":"Latitude key name","longitude-key-name":"Longitude key name","latitude-key-name-required":"Latitude key name is required.","longitude-key-name-required":"Longitude key name is required.","fetch-perimeter-info-from-message-metadata":"Fetch perimeter information from message metadata","perimeter-circle":"Circle","perimeter-polygon":"Polygon","perimeter-type":"Perimeter type","circle-center-latitude":"Center latitude","circle-center-latitude-required":"Center latitude is required.","circle-center-longitude":"Center longitude","circle-center-longitude-required":"Center longitude is required.","range-unit-meter":"Meter","range-unit-kilometer":"Kilometer","range-unit-foot":"Foot","range-unit-mile":"Mile","range-unit-nautical-mile":"Nautical mile","range-units":"Range units",range:"Range","range-required":"Range is required.","polygon-definition":"Polygon definition","polygon-definition-required":"Polygon definition is required.","polygon-definition-hint":"Please, use the following format for manual definition of polygon: [[lat1,lon1],[lat2,lon2], ... ,[latN,lonN]].","min-inside-duration":"Minimal inside duration","min-inside-duration-value-required":"Minimal inside duration is required","min-inside-duration-time-unit":"Minimal inside duration time unit","min-outside-duration":"Minimal outside duration","min-outside-duration-value-required":"Minimal outside duration is required","min-outside-duration-time-unit":"Minimal outside duration time unit","tell-failure-if-absent":"Tell Failure","tell-failure-if-absent-hint":'If at least one selected key doesn\'t exist the outbound message will report "Failure".',"get-latest-value-with-ts":"Fetch Latest telemetry with Timestamp","get-latest-value-with-ts-hint":'If selected, latest telemetry values will be added to the outbound message metadata with timestamp, e.g: "temp": "{\\"ts\\":1574329385897,\\"value\\":42}"',"use-redis-queue":"Use redis queue for message persistence","trim-redis-queue":"Trim redis queue","redis-queue-max-size":"Redis queue max size","add-metadata-key-values-as-kafka-headers":"Add Message metadata key-value pairs to Kafka record headers","add-metadata-key-values-as-kafka-headers-hint":"If selected, key-value pairs from message metadata will be added to the outgoing records headers as byte arrays with predefined charset encoding.","charset-encoding":"Charset encoding","charset-encoding-required":"Charset encoding is required.","charset-us-ascii":"US-ASCII","charset-iso-8859-1":"ISO-8859-1","charset-utf-8":"UTF-8","charset-utf-16be":"UTF-16BE","charset-utf-16le":"UTF-16LE","charset-utf-16":"UTF-16","select-queue-hint":"The queue name can be selected from a drop-down list or add a custom name.","persist-alarm-rules":"Persist state of alarm rules","fetch-alarm-rules":"Fetch state of alarm rules","input-value-key":"Input value key","input-value-key-required":"Input value key is required.","output-value-key":"Output value key","output-value-key-required":"Output value key is required.",round:"Decimals","round-range":"Decimals should be in a range from 0 to 15.","use-cache":"Use cache for latest value","tell-failure-if-delta-is-negative":"Tell Failure if delta is negative","add-period-between-msgs":"Add period between messages","period-value-key":"Period value key","period-key-required":"Period value key is required.","general-pattern-hint":'Hint: use ${metadataKey} for value from metadata, $[messageKey] for value from message body'},"key-val":{key:"Key",value:"Value","remove-entry":"Remove entry","add-entry":"Add entry"}}},!0)}(e)}return e.ctorParameters=function(){return[{type:n.TranslateService}]},e=h([t.NgModule({declarations:[x],imports:[r.CommonModule,a.SharedModule],exports:[qe,Pe,Ue,_e,x]}),C("design:paramtypes",[n.TranslateService])],e)}();e.RuleNodeCoreConfigModule=$e,e.ɵa=x,e.ɵb=qe,e.ɵba=ve,e.ɵbb=Fe,e.ɵbc=xe,e.ɵbd=Te,e.ɵbe=ue,e.ɵbf=ae,e.ɵbg=oe,e.ɵbh=ie,e.ɵbi=le,e.ɵbj=se,e.ɵbk=me,e.ɵbl=Pe,e.ɵbm=Se,e.ɵbn=Ie,e.ɵbo=ke,e.ɵbp=Ne,e.ɵbq=Ve,e.ɵbr=Ee,e.ɵbs=Ae,e.ɵbt=Le,e.ɵbu=Ue,e.ɵbv=Me,e.ɵbw=we,e.ɵbx=Re,e.ɵby=De,e.ɵbz=Oe,e.ɵc=T,e.ɵca=Ke,e.ɵcb=Be,e.ɵcc=Ge,e.ɵcd=He,e.ɵce=_e,e.ɵcf=je,e.ɵcg=ze,e.ɵch=Qe,e.ɵd=q,e.ɵe=S,e.ɵf=I,e.ɵg=k,e.ɵh=N,e.ɵi=V,e.ɵj=E,e.ɵk=A,e.ɵl=L,e.ɵm=P,e.ɵn=ee,e.ɵo=te,e.ɵp=re,e.ɵq=ne,e.ɵr=de,e.ɵs=pe,e.ɵt=ce,e.ɵu=fe,e.ɵv=ge,e.ɵw=ye,e.ɵx=be,e.ɵy=he,e.ɵz=Ce,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=rulenode-core-config.umd.min.js.map \ No newline at end of file From 0d28d6279cf9cfcf58ee903ea02fd39cd5277d95 Mon Sep 17 00:00:00 2001 From: ShvaykaD Date: Mon, 22 Feb 2021 15:38:50 +0200 Subject: [PATCH 37/69] added fix for partitions save --- .../server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java index 93a7cf5ec7..cec5a5a15f 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java @@ -19,8 +19,10 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import lombok.extern.slf4j.Slf4j; +import org.hibernate.exception.ConstraintViolationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; @@ -114,6 +116,17 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa partitioningRepository.save(psqlPartition); log.trace("Adding partition to Set: {}", psqlPartition); partitions.put(psqlPartition.getStart(), psqlPartition); + } catch (Exception e) { + log.trace("Error occurred during partition save:", e); + if (e instanceof DataIntegrityViolationException) { + DataIntegrityViolationException ex = (DataIntegrityViolationException) e; + Throwable cause = ex.getCause(); + if (cause instanceof ConstraintViolationException) { + ConstraintViolationException constraintViolationException = (ConstraintViolationException) cause; + log.warn("Saving partition [{}] rejected: {}", psqlPartition.getPartitionDate(), constraintViolationException.getCause().getMessage()); + partitions.put(psqlPartition.getStart(), psqlPartition); + } + } } finally { partitionCreationLock.unlock(); } From b418b08d234b95c488a2b8ef76dbb22eeb6367f0 Mon Sep 17 00:00:00 2001 From: ShvaykaD Date: Mon, 22 Feb 2021 17:04:20 +0200 Subject: [PATCH 38/69] code simplified --- .../dao/sqlts/psql/JpaPsqlTimeseriesDao.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java index cec5a5a15f..c751c4a129 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java @@ -116,16 +116,11 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa partitioningRepository.save(psqlPartition); log.trace("Adding partition to Set: {}", psqlPartition); partitions.put(psqlPartition.getStart(), psqlPartition); - } catch (Exception e) { - log.trace("Error occurred during partition save:", e); - if (e instanceof DataIntegrityViolationException) { - DataIntegrityViolationException ex = (DataIntegrityViolationException) e; - Throwable cause = ex.getCause(); - if (cause instanceof ConstraintViolationException) { - ConstraintViolationException constraintViolationException = (ConstraintViolationException) cause; - log.warn("Saving partition [{}] rejected: {}", psqlPartition.getPartitionDate(), constraintViolationException.getCause().getMessage()); - partitions.put(psqlPartition.getStart(), psqlPartition); - } + } catch (DataIntegrityViolationException ex) { + log.trace("Error occurred during partition save:", ex); + if (ex.getCause() instanceof ConstraintViolationException) { + log.warn("Saving partition [{}] rejected. Timeseries data will save to the ts_kv_indefinite (DEFAULT) partition.", psqlPartition.getPartitionDate()); + partitions.put(psqlPartition.getStart(), psqlPartition); } } finally { partitionCreationLock.unlock(); From aa7752e94288256d0370072975cf1457f2b0de89 Mon Sep 17 00:00:00 2001 From: ShvaykaD Date: Mon, 22 Feb 2021 17:14:50 +0200 Subject: [PATCH 39/69] fix typo --- .../thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java b/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java index c751c4a129..64c074fd40 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sqlts/psql/JpaPsqlTimeseriesDao.java @@ -121,6 +121,8 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa if (ex.getCause() instanceof ConstraintViolationException) { log.warn("Saving partition [{}] rejected. Timeseries data will save to the ts_kv_indefinite (DEFAULT) partition.", psqlPartition.getPartitionDate()); partitions.put(psqlPartition.getStart(), psqlPartition); + } else { + throw new RuntimeException(ex); } } finally { partitionCreationLock.unlock(); From 07ed2581bea769dbbad1848448041d97f566264b Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 3 Mar 2021 11:52:19 +0200 Subject: [PATCH 40/69] UI: Refactoring code --- .../server/service/sms/AbstractSmsSender.java | 11 +---------- .../server/service/sms/twilio/TwilioSmsSender.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/sms/AbstractSmsSender.java b/application/src/main/java/org/thingsboard/server/service/sms/AbstractSmsSender.java index d62965d117..84aa972e8a 100644 --- a/application/src/main/java/org/thingsboard/server/service/sms/AbstractSmsSender.java +++ b/application/src/main/java/org/thingsboard/server/service/sms/AbstractSmsSender.java @@ -24,8 +24,7 @@ import java.util.regex.Pattern; @Slf4j public abstract class AbstractSmsSender implements SmsSender { - private static final Pattern E_164_PHONE_NUMBER_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$"); - private static final Pattern PHONE_NUMBERS_SID_MESSAGE_SERVICE_SID = Pattern.compile("^(PN|MG).*$"); + protected static final Pattern E_164_PHONE_NUMBER_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$"); private static final int MAX_SMS_MESSAGE_LENGTH = 1600; private static final int MAX_SMS_SEGMENT_LENGTH = 70; @@ -38,14 +37,6 @@ public abstract class AbstractSmsSender implements SmsSender { return phoneNumber; } - protected String validatePhoneTwilioNumber(String phoneNumber) throws SmsParseException { - phoneNumber = phoneNumber.trim(); - if (!E_164_PHONE_NUMBER_PATTERN.matcher(phoneNumber).matches() && !PHONE_NUMBERS_SID_MESSAGE_SERVICE_SID.matcher(phoneNumber).matches()) { - throw new SmsParseException("Invalid phone number format. Phone number must be in E.164 format/Phone Number's SID/Messaging Service SID."); - } - return phoneNumber; - } - protected String prepareMessage(String message) { message = message.replaceAll("^\"|\"$", "").replaceAll("\\\\n", "\n"); if (message.length() > MAX_SMS_MESSAGE_LENGTH) { diff --git a/application/src/main/java/org/thingsboard/server/service/sms/twilio/TwilioSmsSender.java b/application/src/main/java/org/thingsboard/server/service/sms/twilio/TwilioSmsSender.java index c4bba6ab26..1988013fb0 100644 --- a/application/src/main/java/org/thingsboard/server/service/sms/twilio/TwilioSmsSender.java +++ b/application/src/main/java/org/thingsboard/server/service/sms/twilio/TwilioSmsSender.java @@ -19,16 +19,29 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.api.v2010.account.Message; import com.twilio.type.PhoneNumber; import org.apache.commons.lang3.StringUtils; +import org.thingsboard.rule.engine.api.sms.exception.SmsParseException; import org.thingsboard.server.common.data.sms.config.TwilioSmsProviderConfiguration; import org.thingsboard.rule.engine.api.sms.exception.SmsException; import org.thingsboard.rule.engine.api.sms.exception.SmsSendException; import org.thingsboard.server.service.sms.AbstractSmsSender; +import java.util.regex.Pattern; + public class TwilioSmsSender extends AbstractSmsSender { + private static final Pattern PHONE_NUMBERS_SID_MESSAGE_SERVICE_SID = Pattern.compile("^(PN|MG).*$"); + private TwilioRestClient twilioRestClient; private String numberFrom; + private String validatePhoneTwilioNumber(String phoneNumber) throws SmsParseException { + phoneNumber = phoneNumber.trim(); + if (!E_164_PHONE_NUMBER_PATTERN.matcher(phoneNumber).matches() && !PHONE_NUMBERS_SID_MESSAGE_SERVICE_SID.matcher(phoneNumber).matches()) { + throw new SmsParseException("Invalid phone number format. Phone number must be in E.164 format/Phone Number's SID/Messaging Service SID."); + } + return phoneNumber; + } + public TwilioSmsSender(TwilioSmsProviderConfiguration config) { if (StringUtils.isEmpty(config.getAccountSid()) || StringUtils.isEmpty(config.getAccountToken()) || StringUtils.isEmpty(config.getNumberFrom())) { throw new IllegalArgumentException("Invalid twilio sms provider configuration: accountSid, accountToken and numberFrom should be specified!"); From 3255eb9027792880c063047ae8d51bbbec79d5c2 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 3 Mar 2021 12:02:06 +0200 Subject: [PATCH 41/69] Version set to 3.2.2-SNAPSHOT --- application/pom.xml | 2 +- .../thingsboard/server/install/ThingsboardInstallService.java | 2 +- common/actor/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- dao/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/js-executor/package.json | 2 +- msa/js-executor/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/web-ui/package.json | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 ++-- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- ui-ngx/package.json | 2 +- ui-ngx/pom.xml | 2 +- 41 files changed, 42 insertions(+), 42 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index bbdf3a0bcd..adc3c9b22e 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard application diff --git a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java index d97866fcb5..8b4a5b77a3 100644 --- a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java +++ b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java @@ -186,7 +186,7 @@ public class ThingsboardInstallService { log.info("Upgrading ThingsBoard from version 3.2.0 to 3.2.1 ..."); databaseEntitiesUpgradeService.upgradeDatabase("3.2.0"); case "3.2.1": - log.info("Upgrading ThingsBoard from version 3.2.1 to 3.3.0 ..."); + log.info("Upgrading ThingsBoard from version 3.2.1 to 3.2.2 ..."); if (databaseTsUpgradeService != null) { databaseTsUpgradeService.upgradeDatabase("3.2.1"); } diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 1f4849cb79..359a2362f9 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index ba30e5bb43..3d9699061e 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index 79b3bc8e26..ea4d8cb2d8 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 06ba4aff3b..114b48a65a 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index 11b1e02477..69368ffad4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index e0b30dd654..54098babcc 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/stats/pom.xml b/common/stats/pom.xml index 005c210b7b..94cde12d3a 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index cea8ddc0ce..8fa8cceb2a 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index f229627480..c04ff34adb 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 676593804e..4368aad588 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 667a257a0b..7c1c224f49 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 60700bc3e7..2430cc3d23 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index 13afe4663a..2172563485 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index cbd3899f25..5b7f0f0954 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard dao diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index 9af00d44c7..cefbdf140b 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index 75f009880b..77dcb5992f 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-js-executor", "private": true, - "version": "3.3.0", + "version": "3.2.2", "description": "ThingsBoard JavaScript Executor Microservice", "main": "server.js", "bin": "server.js", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index a254b1acde..769cbf6d36 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/pom.xml b/msa/pom.xml index 3d7bf3f347..f15738fb74 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index 133b81c79d..df1988c3a0 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index efb9a709e9..d35762163c 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 1285cca0ce..890e8b91e8 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index da0688b545..cc85b507a9 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 782b6a228a..c7352d9821 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 4e32be415a..79103f31dd 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index 3897c31f5e..1725a7c3c2 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-web-ui", "private": true, - "version": "3.3.0", + "version": "3.2.2", "description": "ThingsBoard Web UI Microservice", "main": "server.js", "bin": "server.js", diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index 85f5db6ce3..93c7f24e21 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index 3cf567a26f..ce0963d605 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard netty-mqtt - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index c55006ef57..bbf967941a 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index e45db432d8..b8373b351f 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index d4af78f871..3709498312 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index bb348793c1..fe44acac1f 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 31c0c1d824..f435277fcc 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index c7fcf277ea..bb0435d434 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index 1ede01a491..c979a2d2e1 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index 41ca5683a1..b91c5d9dd0 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index 28aaeeab39..b9c651d9c6 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index 81a5ce8116..b3ebf1fbd0 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard transport diff --git a/ui-ngx/package.json b/ui-ngx/package.json index 775a685ae8..a0da1f210b 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -1,6 +1,6 @@ { "name": "thingsboard", - "version": "3.3.0", + "version": "3.2.2", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --open", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index fb8c809260..f06442db25 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.3.0-SNAPSHOT + 3.2.2-SNAPSHOT thingsboard org.thingsboard From f68158c550b2b04c9a9032359a3c0d39af0393d8 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 3 Mar 2021 12:15:21 +0200 Subject: [PATCH 42/69] improvements --- .../controller/plugin/TbWebSocketHandler.java | 42 +++++++++---------- .../DefaultTelemetryWebSocketService.java | 29 ++++++++++--- .../TelemetryWebSocketMsgEndpoint.java | 2 + 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java index 7c6a2f8c9d..13a54e5110 100644 --- a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java +++ b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java @@ -41,7 +41,6 @@ import org.thingsboard.server.service.telemetry.TelemetryWebSocketMsgEndpoint; import org.thingsboard.server.service.telemetry.TelemetryWebSocketService; import org.thingsboard.server.service.telemetry.TelemetryWebSocketSessionRef; -import javax.annotation.PreDestroy; import javax.websocket.RemoteEndpoint; import javax.websocket.SendHandler; import javax.websocket.SendResult; @@ -55,11 +54,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; @Service @TbCoreComponent @@ -99,8 +94,6 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr private ConcurrentMap> regularUserSessionsMap = new ConcurrentHashMap<>(); private ConcurrentMap> publicUserSessionsMap = new ConcurrentHashMap<>(); - private ScheduledExecutorService pingExecutor = Executors.newSingleThreadScheduledExecutor(); - @Override public void handleTextMessage(WebSocketSession session, TextMessage message) { try { @@ -135,8 +128,6 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr } internalSessionMap.put(internalSessionId, new SessionMetaData(session, sessionRef, maxMsgQueuePerSession)); - pingExecutor.scheduleWithFixedDelay(() -> internalSessionMap.get(internalSessionId).sendPing(), 10000, 10000, TimeUnit.MILLISECONDS); - externalSessionMap.put(externalSessionId, internalSessionId); processInWebSocketService(sessionRef, SessionEvent.onEstablished()); log.info("[{}][{}][{}] Session is opened", sessionRef.getSecurityCtx().getTenantId(), externalSessionId, session.getId()); @@ -206,7 +197,7 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr private volatile boolean isSending = false; private final Queue msgQueue; - private final AtomicLong lastActivityTime; + private volatile long lastActivityTime; SessionMetaData(WebSocketSession session, TelemetryWebSocketSessionRef sessionRef, int maxMsgQueuePerSession) { super(); @@ -215,14 +206,14 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr this.asyncRemote = nativeSession.getAsyncRemote(); this.sessionRef = sessionRef; this.msgQueue = new LinkedBlockingQueue<>(maxMsgQueuePerSession); - this.lastActivityTime = new AtomicLong(System.currentTimeMillis()); + this.lastActivityTime = System.currentTimeMillis(); } synchronized void sendPing() { try { - if (System.currentTimeMillis() - lastActivityTime.get() >= pingTimeout) { + if (System.currentTimeMillis() - lastActivityTime >= pingTimeout) { this.asyncRemote.sendPing(ByteBuffer.wrap(new byte[]{})); - lastActivityTime.set(System.currentTimeMillis()); + lastActivityTime = System.currentTimeMillis(); } } catch (Exception e) { log.trace("[{}] Failed to send ping msg", session.getId(), e); @@ -238,7 +229,7 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr if (isSending) { try { msgQueue.add(msg); - lastActivityTime.set(System.currentTimeMillis()); + lastActivityTime = System.currentTimeMillis(); } catch (RuntimeException e) { if (log.isTraceEnabled()) { log.trace("[{}][{}] Session closed due to queue error", sessionRef.getSecurityCtx().getTenantId(), session.getId(), e); @@ -321,6 +312,22 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr } } + @Override + public void sendPing(TelemetryWebSocketSessionRef sessionRef) throws IOException { + String externalId = sessionRef.getSessionId(); + String internalId = externalSessionMap.get(externalId); + if (internalId != null) { + SessionMetaData sessionMd = internalSessionMap.get(internalId); + if (sessionMd != null) { + sessionMd.sendPing(); + } else { + log.warn("[{}][{}] Failed to find session by internal id", externalId, internalId); + } + } else { + log.warn("[{}] Failed to find session by external id", externalId); + } + } + @Override public void close(TelemetryWebSocketSessionRef sessionRef, CloseStatus reason) throws IOException { String externalId = sessionRef.getSessionId(); @@ -430,11 +437,4 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr } } - @PreDestroy - private void destroy() { - if (pingExecutor != null) { - pingExecutor.shutdownNow(); - } - } - } \ No newline at end of file diff --git a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java index 2efbc2d0a8..1987bc354b 100644 --- a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java +++ b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java @@ -51,22 +51,20 @@ import org.thingsboard.server.service.security.ValidationResult; import org.thingsboard.server.service.security.ValidationResultCode; import org.thingsboard.server.service.security.model.UserPrincipal; import org.thingsboard.server.service.security.permission.Operation; +import org.thingsboard.server.service.subscription.TbAttributeSubscription; +import org.thingsboard.server.service.subscription.TbAttributeSubscriptionScope; import org.thingsboard.server.service.subscription.TbEntityDataSubscriptionService; import org.thingsboard.server.service.subscription.TbLocalSubscriptionService; -import org.thingsboard.server.service.subscription.TbAttributeSubscriptionScope; -import org.thingsboard.server.service.subscription.TbAttributeSubscription; import org.thingsboard.server.service.subscription.TbTimeseriesSubscription; +import org.thingsboard.server.service.telemetry.cmd.TelemetryPluginCmdsWrapper; import org.thingsboard.server.service.telemetry.cmd.v1.AttributesSubscriptionCmd; import org.thingsboard.server.service.telemetry.cmd.v1.GetHistoryCmd; import org.thingsboard.server.service.telemetry.cmd.v1.SubscriptionCmd; import org.thingsboard.server.service.telemetry.cmd.v1.TelemetryPluginCmd; -import org.thingsboard.server.service.telemetry.cmd.TelemetryPluginCmdsWrapper; import org.thingsboard.server.service.telemetry.cmd.v1.TimeseriesSubscriptionCmd; import org.thingsboard.server.service.telemetry.cmd.v2.AlarmDataCmd; -import org.thingsboard.server.service.telemetry.cmd.v2.AlarmDataUnsubscribeCmd; import org.thingsboard.server.service.telemetry.cmd.v2.DataUpdate; import org.thingsboard.server.service.telemetry.cmd.v2.EntityDataCmd; -import org.thingsboard.server.service.telemetry.cmd.v2.EntityDataUnsubscribeCmd; import org.thingsboard.server.service.telemetry.cmd.v2.EntityDataUpdate; import org.thingsboard.server.service.telemetry.cmd.v2.UnsubscribeCmd; import org.thingsboard.server.service.telemetry.exception.UnauthorizedException; @@ -89,6 +87,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -151,14 +151,23 @@ public class DefaultTelemetryWebSocketService implements TelemetryWebSocketServi private ExecutorService executor; private String serviceId; + private ScheduledExecutorService pingExecutor; + @PostConstruct public void initExecutor() { serviceId = serviceInfoProvider.getServiceId(); executor = Executors.newWorkStealingPool(50); + + pingExecutor = Executors.newSingleThreadScheduledExecutor(); + pingExecutor.scheduleWithFixedDelay(this::sendPing, 10000, 10000, TimeUnit.MILLISECONDS); } @PreDestroy public void shutdownExecutor() { + if (pingExecutor != null) { + pingExecutor.shutdownNow(); + } + if (executor != null) { executor.shutdownNow(); } @@ -744,6 +753,16 @@ public class DefaultTelemetryWebSocketService implements TelemetryWebSocketServi } } + private void sendPing() { + wsSessionsMap.values().forEach(md -> + executor.submit(() -> { + try { + msgEndpoint.sendPing(md.getSessionRef()); + } catch (IOException e) { + log.warn("[{}] Failed to send ping: {}", md.getSessionRef().getSessionId(), e); + } + })); + } private static Optional> getKeys(TelemetryPluginCmd cmd) { if (!StringUtils.isEmpty(cmd.getKeys())) { diff --git a/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java b/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java index 2c132c745c..9a69e25009 100644 --- a/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java +++ b/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java @@ -26,5 +26,7 @@ public interface TelemetryWebSocketMsgEndpoint { void send(TelemetryWebSocketSessionRef sessionRef, int subscriptionId, String msg) throws IOException; + void sendPing(TelemetryWebSocketSessionRef sessionRef) throws IOException; + void close(TelemetryWebSocketSessionRef sessionRef, CloseStatus withReason) throws IOException; } From e318b49c2dbfa810400f937b9f4d78989ce81b9c Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Wed, 3 Mar 2021 13:22:31 +0200 Subject: [PATCH 43/69] refactoring --- .../server/controller/plugin/TbWebSocketHandler.java | 10 +++++----- .../telemetry/DefaultTelemetryWebSocketService.java | 3 ++- .../telemetry/TelemetryWebSocketMsgEndpoint.java | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java index 13a54e5110..aeb595a193 100644 --- a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java +++ b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java @@ -209,11 +209,11 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr this.lastActivityTime = System.currentTimeMillis(); } - synchronized void sendPing() { + synchronized void sendPing(long currentTime) { try { - if (System.currentTimeMillis() - lastActivityTime >= pingTimeout) { + if (currentTime - lastActivityTime >= pingTimeout) { this.asyncRemote.sendPing(ByteBuffer.wrap(new byte[]{})); - lastActivityTime = System.currentTimeMillis(); + lastActivityTime = currentTime; } } catch (Exception e) { log.trace("[{}] Failed to send ping msg", session.getId(), e); @@ -313,13 +313,13 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr } @Override - public void sendPing(TelemetryWebSocketSessionRef sessionRef) throws IOException { + public void sendPing(TelemetryWebSocketSessionRef sessionRef, long currentTime) throws IOException { String externalId = sessionRef.getSessionId(); String internalId = externalSessionMap.get(externalId); if (internalId != null) { SessionMetaData sessionMd = internalSessionMap.get(internalId); if (sessionMd != null) { - sessionMd.sendPing(); + sessionMd.sendPing(currentTime); } else { log.warn("[{}][{}] Failed to find session by internal id", externalId, internalId); } diff --git a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java index 1987bc354b..07d7af3165 100644 --- a/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java +++ b/application/src/main/java/org/thingsboard/server/service/telemetry/DefaultTelemetryWebSocketService.java @@ -754,10 +754,11 @@ public class DefaultTelemetryWebSocketService implements TelemetryWebSocketServi } private void sendPing() { + long currentTime = System.currentTimeMillis(); wsSessionsMap.values().forEach(md -> executor.submit(() -> { try { - msgEndpoint.sendPing(md.getSessionRef()); + msgEndpoint.sendPing(md.getSessionRef(), currentTime); } catch (IOException e) { log.warn("[{}] Failed to send ping: {}", md.getSessionRef().getSessionId(), e); } diff --git a/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java b/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java index 9a69e25009..f10038f116 100644 --- a/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java +++ b/application/src/main/java/org/thingsboard/server/service/telemetry/TelemetryWebSocketMsgEndpoint.java @@ -26,7 +26,7 @@ public interface TelemetryWebSocketMsgEndpoint { void send(TelemetryWebSocketSessionRef sessionRef, int subscriptionId, String msg) throws IOException; - void sendPing(TelemetryWebSocketSessionRef sessionRef) throws IOException; + void sendPing(TelemetryWebSocketSessionRef sessionRef, long currentTime) throws IOException; void close(TelemetryWebSocketSessionRef sessionRef, CloseStatus withReason) throws IOException; } From f9d1e347981c818d9d232ee576be611a43fb8199 Mon Sep 17 00:00:00 2001 From: Alexander Yurov Date: Fri, 26 Feb 2021 14:47:43 +0200 Subject: [PATCH 44/69] Added USER as originator for 'customer details' rule node --- .../metadata/TbAbstractGetEntityDetailsNode.java | 13 +++++++------ .../engine/metadata/TbGetCustomerDetailsNode.java | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbAbstractGetEntityDetailsNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbAbstractGetEntityDetailsNode.java index 8e69c2b2c6..93d974163a 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbAbstractGetEntityDetailsNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbAbstractGetEntityDetailsNode.java @@ -83,11 +83,8 @@ public abstract class TbAbstractGetEntityDetailsNode getTbMsgListenableFuture(TbContext ctx, TbMsg msg, MessageData messageData, String prefix) { if (!this.config.getDetailsList().isEmpty()) { - ListenableFuture resultObject = null; ListenableFuture contactBasedListenableFuture = getContactBasedListenableFuture(ctx, msg); - for (EntityDetails entityDetails : this.config.getDetailsList()) { - resultObject = addContactProperties(messageData.getData(), contactBasedListenableFuture, entityDetails, prefix); - } + ListenableFuture resultObject = addContactProperties(messageData.getData(), contactBasedListenableFuture, prefix); return transformMsg(ctx, msg, resultObject, messageData); } else { return Futures.immediateFuture(msg); @@ -109,10 +106,14 @@ public abstract class TbAbstractGetEntityDetailsNode addContactProperties(JsonElement data, ListenableFuture entityFuture, EntityDetails entityDetails, String prefix) { + private ListenableFuture addContactProperties(JsonElement data, ListenableFuture entityFuture, String prefix) { return Futures.transformAsync(entityFuture, contactBased -> { if (contactBased != null) { - return Futures.immediateFuture(setProperties(contactBased, data, entityDetails, prefix)); + JsonElement jsonElement = null; + for (EntityDetails entityDetails : this.config.getDetailsList()) { + jsonElement = setProperties(contactBased, data, entityDetails, prefix); + } + return Futures.immediateFuture(jsonElement); } else { return Futures.immediateFuture(null); } diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java index a2a50ff70a..204c602215 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java @@ -27,8 +27,10 @@ import org.thingsboard.rule.engine.api.util.TbNodeUtils; import org.thingsboard.server.common.data.ContactBased; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.id.AssetId; +import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EntityViewId; +import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.plugin.ComponentType; import org.thingsboard.server.common.msg.TbMsg; @@ -105,6 +107,18 @@ public class TbGetCustomerDetailsNode extends TbAbstractGetEntityDetailsNode { + if (user != null) { + if (!user.getCustomerId().isNullUid()) { + return ctx.getCustomerService().findCustomerByIdAsync(ctx.getTenantId(), user.getCustomerId()); + } else { + throw new RuntimeException("User with name '" + user.getName() + "' is not assigned to Customer."); + } + } else { + return Futures.immediateFuture(null); + } + }, MoreExecutors.directExecutor()); default: throw new RuntimeException("Entity with entityType '" + msg.getOriginator().getEntityType() + "' is not supported."); } From ae2ca8af087bf3c9c3ecc9ba320b3ec7743f14c3 Mon Sep 17 00:00:00 2001 From: Alexander Yurov Date: Fri, 26 Feb 2021 15:00:38 +0200 Subject: [PATCH 45/69] Removed unused import --- .../rule/engine/metadata/TbGetCustomerDetailsNode.java | 1 - 1 file changed, 1 deletion(-) diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java index 204c602215..e3303d074e 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/metadata/TbGetCustomerDetailsNode.java @@ -27,7 +27,6 @@ import org.thingsboard.rule.engine.api.util.TbNodeUtils; import org.thingsboard.server.common.data.ContactBased; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.id.AssetId; -import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.EntityViewId; import org.thingsboard.server.common.data.id.UserId; From 8ef06ed5d6ffee2c823aba1d1756b39e8eab8ce3 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 3 Mar 2021 15:30:57 +0200 Subject: [PATCH 46/69] UI: Fixed filter preview text at boolean type in alarm rule --- ui-ngx/src/app/shared/models/query/query.models.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/models/query/query.models.ts b/ui-ngx/src/app/shared/models/query/query.models.ts index 25efe437d7..6bc2d74487 100644 --- a/ui-ngx/src/app/shared/models/query/query.models.ts +++ b/ui-ngx/src/app/shared/models/query/query.models.ts @@ -455,7 +455,9 @@ function simpleKeyFilterPredicateToText(translate: TranslateService, break; case FilterPredicateType.BOOLEAN: operation = translate.instant(booleanOperationTranslationMap.get(keyFilterPredicate.operation)); - value = translate.instant(keyFilterPredicate.value.defaultValue ? 'value.true' : 'value.false'); + if (!dynamicValue) { + value = translate.instant(keyFilterPredicate.value.defaultValue ? 'value.true' : 'value.false'); + } break; } if (!dynamicValue) { From dc8370c8594211470bd80a0d235cb06585c3c297 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Wed, 3 Mar 2021 17:18:49 +0200 Subject: [PATCH 47/69] Lwm2m: front: validateObject on the start --- ...ofile-transport-configuration.component.ts | 51 +++++++++++++------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts index 40ba18ebe9..2fa7c1cb9a 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts @@ -14,24 +14,30 @@ /// limitations under the License. /// -import { DeviceProfileTransportConfiguration, DeviceTransportType } from '@shared/models/device.models'; -import { Component, forwardRef, Inject, Input } from '@angular/core'; -import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; -import { Store } from '@ngrx/store'; -import { AppState } from '@app/core/core.state'; -import { coerceBooleanProperty } from '@angular/cdk/coercion'; +import {DeviceProfileTransportConfiguration, DeviceTransportType} from '@shared/models/device.models'; +import {Component, forwardRef, Inject, Input} from '@angular/core'; +import {ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators} from '@angular/forms'; +import {Store} from '@ngrx/store'; +import {AppState} from '@app/core/core.state'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; import { - INSTANCES, RESOURCES, OBSERVE_ATTR_TELEMETRY, OBSERVE, ATTRIBUTE, TELEMETRY, KEY_NAME, + ATTRIBUTE, getDefaultProfileConfig, + INSTANCES, + KEY_NAME, + ModelValue, ObjectLwM2M, + OBSERVE, + OBSERVE_ATTR_TELEMETRY, ProfileConfigModels, - ModelValue + RESOURCES, + TELEMETRY } from './profile-config.models'; -import { DeviceProfileService } from '@core/http/device-profile.service'; -import { deepClone, isDefinedAndNotNull, isUndefined } from '@core/utils'; -import { WINDOW } from '@core/services/window.service'; -import { JsonObject } from '@angular/compiler-cli/ngcc/src/packages/entry_point'; -import { Direction } from '@shared/models/page/sort-order'; +import {DeviceProfileService} from '@core/http/device-profile.service'; +import {deepClone, isDefinedAndNotNull, isUndefined} from '@core/utils'; +import {WINDOW} from '@core/services/window.service'; +import {JsonArray, JsonObject} from '@angular/compiler-cli/ngcc/src/packages/entry_point'; +import {Direction} from '@shared/models/page/sort-order'; @Component({ selector: 'tb-profile-lwm2m-device-transport-configuration', @@ -64,8 +70,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro this.requiredValue = coerceBooleanProperty(value); } - private propagateChange = (v: any) => { - } + private propagateChange = (v: any) => { } constructor(private store: Store, private fb: FormBuilder, @@ -200,7 +205,7 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro const observeArray = this.configurationValue.observeAttr.observe; const attributeArray = this.configurationValue.observeAttr.attribute; const telemetryArray = this.configurationValue.observeAttr.telemetry; - const keyNameJson = this.configurationValue.observeAttr.keyName; + let keyNameJson = this.configurationValue.observeAttr.keyName; if (this.includesNotZeroInstance(attributeArray, telemetryArray)) { this.addInstances(attributeArray, telemetryArray, clientObserveAttrTelemetry); } @@ -214,6 +219,8 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro this.updateObserveAttrTelemetryObjects(telemetryArray, clientObserveAttrTelemetry, TELEMETRY); } if (isDefinedAndNotNull(keyNameJson)) { + this.configurationValue.observeAttr.keyName = deepClone(this.validateKeyNameObjects(keyNameJson, attributeArray, telemetryArray)); + keyNameJson = this.configurationValue.observeAttr.keyName; this.updateKeyNameObjects(keyNameJson, clientObserveAttrTelemetry); } } @@ -264,6 +271,18 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro }); } + private validateKeyNameObjects = (nameJson: JsonObject, attributeArray: JsonArray, telemetryArray: JsonArray): {} => { + const keyName = JSON.parse(JSON.stringify(nameJson)); + let keyNameValidate = {}; + const keyAttrTelemetry = attributeArray.concat(telemetryArray) ; + Object.keys(keyName).forEach(key => { + if (keyAttrTelemetry.includes(key)) { + keyNameValidate[key] = keyName[key]; + } + }); + return keyNameValidate; + } + private updateObserveAttrTelemetryFromGroupToJson = (val: ObjectLwM2M[]): void => { const observeArray: Array = []; const attributeArray: Array = []; From bf6745274df129087812643842adfc984b273918 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 3 Mar 2021 17:19:24 +0200 Subject: [PATCH 48/69] Add http cookie repository to store oauth2 authorization requests --- .../ThingsboardSecurityConfiguration.java | 8 ++- .../security/auth/oauth2/CookieUtils.java | 72 +++++++++++++++++++ ...eOAuth2AuthorizationRequestRepository.java | 55 ++++++++++++++ .../Oauth2AuthenticationFailureHandler.java | 6 +- .../Oauth2AuthenticationSuccessHandler.java | 12 +++- 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtils.java create mode 100644 application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java diff --git a/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java b/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java index b70c4e2a7c..8b595bd987 100644 --- a/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java +++ b/application/src/main/java/org/thingsboard/server/config/ThingsboardSecurityConfiguration.java @@ -48,6 +48,7 @@ import org.thingsboard.server.service.security.auth.jwt.RefreshTokenAuthenticati import org.thingsboard.server.service.security.auth.jwt.RefreshTokenProcessingFilter; import org.thingsboard.server.service.security.auth.jwt.SkipPathRequestMatcher; import org.thingsboard.server.service.security.auth.jwt.extractor.TokenExtractor; +import org.thingsboard.server.service.security.auth.oauth2.HttpCookieOAuth2AuthorizationRequestRepository; import org.thingsboard.server.service.security.auth.rest.RestAuthenticationProvider; import org.thingsboard.server.service.security.auth.rest.RestLoginProcessingFilter; import org.thingsboard.server.service.security.auth.rest.RestPublicLoginProcessingFilter; @@ -84,6 +85,9 @@ public class ThingsboardSecurityConfiguration extends WebSecurityConfigurerAdapt @Qualifier("oauth2AuthenticationFailureHandler") private AuthenticationFailureHandler oauth2AuthenticationFailureHandler; + @Autowired(required = false) + private HttpCookieOAuth2AuthorizationRequestRepository httpCookieOAuth2AuthorizationRequestRepository; + @Autowired @Qualifier("defaultAuthenticationSuccessHandler") private AuthenticationSuccessHandler successHandler; @@ -213,7 +217,9 @@ public class ThingsboardSecurityConfiguration extends WebSecurityConfigurerAdapt .addFilterAfter(rateLimitProcessingFilter, UsernamePasswordAuthenticationFilter.class); if (oauth2Configuration != null) { http.oauth2Login() - .authorizationEndpoint().authorizationRequestResolver(oAuth2AuthorizationRequestResolver) + .authorizationEndpoint() + .authorizationRequestRepository(httpCookieOAuth2AuthorizationRequestRepository) + .authorizationRequestResolver(oAuth2AuthorizationRequestResolver) .and() .loginPage("/oauth2Login") .loginProcessingUrl(oauth2Configuration.getLoginProcessingUrl()) diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtils.java b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtils.java new file mode 100644 index 0000000000..dc66bcca8e --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/CookieUtils.java @@ -0,0 +1,72 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.security.auth.oauth2; + +import org.springframework.util.SerializationUtils; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Base64; +import java.util.Optional; + +public class CookieUtils { + + public static Optional getCookie(HttpServletRequest request, String name) { + Cookie[] cookies = request.getCookies(); + + if (cookies != null && cookies.length > 0) { + for (Cookie cookie : cookies) { + if (cookie.getName().equals(name)) { + return Optional.of(cookie); + } + } + } + + return Optional.empty(); + } + + public static void addCookie(HttpServletResponse response, String name, String value, int maxAge) { + Cookie cookie = new Cookie(name, value); + cookie.setPath("/"); + cookie.setHttpOnly(true); + cookie.setMaxAge(maxAge); + response.addCookie(cookie); + } + + public static void deleteCookie(HttpServletRequest request, HttpServletResponse response, String name) { + Cookie[] cookies = request.getCookies(); + if (cookies != null && cookies.length > 0) { + for (Cookie cookie: cookies) { + if (cookie.getName().equals(name)) { + cookie.setValue(""); + cookie.setPath("/"); + cookie.setMaxAge(0); + response.addCookie(cookie); + } + } + } + } + + public static String serialize(Object object) { + return Base64.getUrlEncoder() + .encodeToString(SerializationUtils.serialize(object)); + } + + public static T deserialize(Cookie cookie, Class cls) { + return cls.cast(SerializationUtils.deserialize( + Base64.getUrlDecoder().decode(cookie.getValue()))); + } +} diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java new file mode 100644 index 0000000000..27534fe33c --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/HttpCookieOAuth2AuthorizationRequestRepository.java @@ -0,0 +1,55 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.security.auth.oauth2; + +import org.springframework.security.oauth2.client.web.AuthorizationRequestRepository; +import org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Component +public class HttpCookieOAuth2AuthorizationRequestRepository implements AuthorizationRequestRepository { + public static final String OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME = "oauth2_auth_request"; + private static final int cookieExpireSeconds = 180; + + @Override + public OAuth2AuthorizationRequest loadAuthorizationRequest(HttpServletRequest request) { + return CookieUtils.getCookie(request, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME) + .map(cookie -> CookieUtils.deserialize(cookie, OAuth2AuthorizationRequest.class)) + .orElse(null); + } + + @Override + public void saveAuthorizationRequest(OAuth2AuthorizationRequest authorizationRequest, HttpServletRequest request, HttpServletResponse response) { + if (authorizationRequest == null) { + CookieUtils.deleteCookie(request, response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME); + return; + } + CookieUtils.addCookie(response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME, CookieUtils.serialize(authorizationRequest), cookieExpireSeconds); + } + + @SuppressWarnings("deprecation") + @Override + public OAuth2AuthorizationRequest removeAuthorizationRequest(HttpServletRequest request) { + return this.loadAuthorizationRequest(request); + } + + public void removeAuthorizationRequestCookies(HttpServletRequest request, HttpServletResponse response) { + CookieUtils.deleteCookie(request, response, OAUTH2_AUTHORIZATION_REQUEST_COOKIE_NAME); + } +} diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationFailureHandler.java b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationFailureHandler.java index 98d7fd9a20..b6345f1618 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationFailureHandler.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationFailureHandler.java @@ -37,10 +37,13 @@ import java.nio.charset.StandardCharsets; @ConditionalOnProperty(prefix = "security.oauth2", value = "enabled", havingValue = "true") public class Oauth2AuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { + private final HttpCookieOAuth2AuthorizationRequestRepository httpCookieOAuth2AuthorizationRequestRepository; private final SystemSecurityService systemSecurityService; @Autowired - public Oauth2AuthenticationFailureHandler(final SystemSecurityService systemSecurityService) { + public Oauth2AuthenticationFailureHandler(final HttpCookieOAuth2AuthorizationRequestRepository httpCookieOAuth2AuthorizationRequestRepository, + final SystemSecurityService systemSecurityService) { + this.httpCookieOAuth2AuthorizationRequestRepository = httpCookieOAuth2AuthorizationRequestRepository; this.systemSecurityService = systemSecurityService; } @@ -49,6 +52,7 @@ public class Oauth2AuthenticationFailureHandler extends SimpleUrlAuthenticationF HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { String baseUrl = this.systemSecurityService.getBaseUrl(TenantId.SYS_TENANT_ID, new CustomerId(EntityId.NULL_UUID), request); + httpCookieOAuth2AuthorizationRequestRepository.removeAuthorizationRequestCookies(request, response); getRedirectStrategy().sendRedirect(request, response, baseUrl + "/login?loginError=" + URLEncoder.encode(exception.getMessage(), StandardCharsets.UTF_8.toString())); } diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java index 29ef86bcc0..869202e55d 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java @@ -49,6 +49,7 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS private final OAuth2ClientMapperProvider oauth2ClientMapperProvider; private final OAuth2Service oAuth2Service; private final OAuth2AuthorizedClientService oAuth2AuthorizedClientService; + private final HttpCookieOAuth2AuthorizationRequestRepository httpCookieOAuth2AuthorizationRequestRepository; private final SystemSecurityService systemSecurityService; @Autowired @@ -56,12 +57,15 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS final RefreshTokenRepository refreshTokenRepository, final OAuth2ClientMapperProvider oauth2ClientMapperProvider, final OAuth2Service oAuth2Service, - final OAuth2AuthorizedClientService oAuth2AuthorizedClientService, final SystemSecurityService systemSecurityService) { + final OAuth2AuthorizedClientService oAuth2AuthorizedClientService, + final HttpCookieOAuth2AuthorizationRequestRepository httpCookieOAuth2AuthorizationRequestRepository, + final SystemSecurityService systemSecurityService) { this.tokenFactory = tokenFactory; this.refreshTokenRepository = refreshTokenRepository; this.oauth2ClientMapperProvider = oauth2ClientMapperProvider; this.oAuth2Service = oAuth2Service; this.oAuth2AuthorizedClientService = oAuth2AuthorizedClientService; + this.httpCookieOAuth2AuthorizationRequestRepository = httpCookieOAuth2AuthorizationRequestRepository; this.systemSecurityService = systemSecurityService; } @@ -84,10 +88,16 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser); JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser); + clearAuthenticationAttributes(request, response); getRedirectStrategy().sendRedirect(request, response, baseUrl + "/?accessToken=" + accessToken.getToken() + "&refreshToken=" + refreshToken.getToken()); } catch (Exception e) { getRedirectStrategy().sendRedirect(request, response, baseUrl + "/login?loginError=" + URLEncoder.encode(e.getMessage(), StandardCharsets.UTF_8.toString())); } } + + protected void clearAuthenticationAttributes(HttpServletRequest request, HttpServletResponse response) { + super.clearAuthenticationAttributes(request); + httpCookieOAuth2AuthorizationRequestRepository.removeAuthorizationRequestCookies(request, response); + } } From 5d94e5e74a19a876f955afb779d0ffb98a193342 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 3 Mar 2021 17:31:22 +0200 Subject: [PATCH 49/69] Minor improvement for oauth2 success handler --- .../security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java index 869202e55d..3cb75501d9 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java @@ -91,6 +91,7 @@ public class Oauth2AuthenticationSuccessHandler extends SimpleUrlAuthenticationS clearAuthenticationAttributes(request, response); getRedirectStrategy().sendRedirect(request, response, baseUrl + "/?accessToken=" + accessToken.getToken() + "&refreshToken=" + refreshToken.getToken()); } catch (Exception e) { + clearAuthenticationAttributes(request, response); getRedirectStrategy().sendRedirect(request, response, baseUrl + "/login?loginError=" + URLEncoder.encode(e.getMessage(), StandardCharsets.UTF_8.toString())); } From 675e55267283bc589f3e6f38d011ba82ba5d114f Mon Sep 17 00:00:00 2001 From: nickAS21 <44275303+nickAS21@users.noreply.github.com> Date: Wed, 3 Mar 2021 18:18:56 +0200 Subject: [PATCH 50/69] Lwm2m: back fix bug: shared attr & change observe in profile (#4175) * Lwm2m: back fix bug: shared attr & change observe in profile * Lwm2m: replace: lwServer by leshanServer. Remove lwServer from interface LwM2mTransportService * Lwm2m: californium ver 2.6.1 * Lwm2m: californium ver 2.6.1 * Lwm2m: Json clone --- .../lwm2m/server/LwM2mServerListener.java | 11 +- .../lwm2m/server/LwM2mTransportRequest.java | 78 +++--- .../LwM2mTransportServerInitializer.java | 4 +- .../lwm2m/server/LwM2mTransportService.java | 13 +- .../server/LwM2mTransportServiceImpl.java | 248 +++++++++--------- .../server/client/LwM2mClientProfile.java | 28 +- pom.xml | 2 +- 7 files changed, 196 insertions(+), 188 deletions(-) diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mServerListener.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mServerListener.java index 933b3865a8..f89f7ec952 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mServerListener.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mServerListener.java @@ -18,7 +18,6 @@ package org.thingsboard.server.transport.lwm2m.server; import lombok.extern.slf4j.Slf4j; import org.eclipse.leshan.core.observation.Observation; import org.eclipse.leshan.core.response.ObserveResponse; -import org.eclipse.leshan.server.californium.LeshanServer; import org.eclipse.leshan.server.observation.ObservationListener; import org.eclipse.leshan.server.queue.PresenceListener; import org.eclipse.leshan.server.registration.Registration; @@ -30,11 +29,9 @@ import java.util.Collection; @Slf4j public class LwM2mServerListener { - private final LeshanServer lhServer; private final LwM2mTransportServiceImpl service; - public LwM2mServerListener(LeshanServer lhServer, LwM2mTransportServiceImpl service) { - this.lhServer = lhServer; + public LwM2mServerListener(LwM2mTransportServiceImpl service) { this.service = service; } @@ -45,7 +42,7 @@ public class LwM2mServerListener { @Override public void registered(Registration registration, Registration previousReg, Collection previousObservations) { - service.onRegistered(lhServer, registration, previousObservations); + service.onRegistered(registration, previousObservations); } /** @@ -54,7 +51,7 @@ public class LwM2mServerListener { @Override public void updated(RegistrationUpdate update, Registration updatedRegistration, Registration previousRegistration) { - service.updatedReg(lhServer, updatedRegistration); + service.updatedReg(updatedRegistration); } /** @@ -63,7 +60,7 @@ public class LwM2mServerListener { @Override public void unregistered(Registration registration, Collection observations, boolean expired, Registration newReg) { - service.unReg(lhServer, registration, observations); + service.unReg(registration, observations); } }; diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java index c58d2c35e0..b05c79d6db 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java @@ -55,10 +55,7 @@ import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext; import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl; import javax.annotation.PostConstruct; -import java.util.ArrayList; -import java.util.Collection; import java.util.Date; -import java.util.Iterator; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -78,21 +75,27 @@ import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportHandle import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportHandler.RESPONSE_CHANNEL; @Slf4j -@Service("LwM2mTransportRequest") +@Service @TbLwM2mTransportComponent public class LwM2mTransportRequest { private ExecutorService executorResponse; private LwM2mValueConverterImpl converter; - @Autowired - private LwM2mTransportServiceImpl service; + private final LwM2mTransportContextServer context; - @Autowired - private LwM2mTransportContextServer context; + private final LwM2mClientContext lwM2mClientContext; + + private final LeshanServer leshanServer; @Autowired - private LwM2mClientContext lwM2mClientContext; + private LwM2mTransportServiceImpl serviceImpl; + + public LwM2mTransportRequest(LwM2mTransportContextServer context, LwM2mClientContext lwM2mClientContext, LeshanServer leshanServer) { + this.context = context; + this.lwM2mClientContext = lwM2mClientContext; + this.leshanServer = leshanServer; + } @PostConstruct public void init() { @@ -101,32 +104,22 @@ public class LwM2mTransportRequest { new NamedThreadFactory(String.format("LwM2M %s channel response", RESPONSE_CHANNEL))); } - public Collection doGetRegistrations(LeshanServer lwServer) { - Collection registrations = new ArrayList<>(); - for (Iterator iterator = lwServer.getRegistrationService().getAllRegistrations(); iterator - .hasNext(); ) { - registrations.add(iterator.next()); - } - return registrations; - } - /** * Device management and service enablement, including Read, Write, Execute, Discover, Create, Delete and Write-Attributes * - * @param lwServer - * @param registration - * @param target - * @param typeOper - * @param contentFormatParam - * @param observation - */ - public void sendAllRequest(LeshanServer lwServer, Registration registration, String target, String typeOper, + public void sendAllRequest(Registration registration, String target, String typeOper, String contentFormatParam, Observation observation, Object params, long timeoutInMs) { LwM2mPath resultIds = new LwM2mPath(target); if (registration != null && resultIds.getObjectId() >= 0) { DownlinkRequest request = null; ContentFormat contentFormat = contentFormatParam != null ? ContentFormat.fromName(contentFormatParam.toUpperCase()) : null; - ResourceModel resource = service.context.getLwM2MTransportConfigServer().getResourceModel(registration, resultIds); + ResourceModel resource = serviceImpl.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getResourceModel(registration, resultIds); timeoutInMs = timeoutInMs > 0 ? timeoutInMs : DEFAULT_TIMEOUT; switch (typeOper) { case GET_TYPE_OPER_READ: @@ -156,7 +149,7 @@ public class LwM2mTransportRequest { break; case POST_TYPE_OPER_WRITE_REPLACE: // Request to write a String Single-Instance Resource using the TLV content format. - if (resource != null) { + if (resource != null && contentFormat != null) { if (contentFormat.equals(ContentFormat.TLV) && !resource.multiple) { request = this.getWriteRequestSingleResource(null, resultIds.getObjectId(), resultIds.getObjectInstanceId(), resultIds.getResourceId(), params, resource.type, registration); } @@ -168,8 +161,8 @@ public class LwM2mTransportRequest { break; case PUT_TYPE_OPER_WRITE_UPDATE: if (resultIds.getResourceId() >= 0) { - ResourceModel resourceModel = lwServer.getModelProvider().getObjectModel(registration).getObjectModel(resultIds.getObjectId()).resources.get(resultIds.getResourceId()); - ResourceModel.Type typeRes = resourceModel.type; +// ResourceModel resourceModel = leshanServer.getModelProvider().getObjectModel(registration).getObjectModel(resultIds.getObjectId()).resources.get(resultIds.getResourceId()); +// ResourceModel.Type typeRes = resourceModel.type; LwM2mNode node = LwM2mSingleResource.newStringResource(resultIds.getResourceId(), (String) this.converter.convertValue(params, resource.type, ResourceModel.Type.STRING, resultIds)); request = new WriteRequest(WriteRequest.Mode.UPDATE, contentFormat, target, node); } @@ -206,7 +199,7 @@ public class LwM2mTransportRequest { * Attribute pmax = new Attribute(MAXIMUM_PERIOD, "60"); * Attribute [] attrs = {gt, st}; */ - Attribute pmin = new Attribute(MINIMUM_PERIOD, Integer.toUnsignedLong(Integer.valueOf("1"))); + Attribute pmin = new Attribute(MINIMUM_PERIOD, Integer.toUnsignedLong(Integer.parseInt("1"))); Attribute[] attrs = {pmin}; AttributeSet attrSet = new AttributeSet(attrs); if (resultIds.isResource()) { @@ -221,25 +214,24 @@ public class LwM2mTransportRequest { } if (request != null) { - this.sendRequest(lwServer, registration, request, timeoutInMs); + this.sendRequest(registration, request, timeoutInMs); } } } /** * - * @param lwServer - * @param registration - * @param request - * @param timeoutInMs - */ @SuppressWarnings("unchecked") - private void sendRequest(LeshanServer lwServer, Registration registration, DownlinkRequest request, long timeoutInMs) { + private void sendRequest(Registration registration, DownlinkRequest request, long timeoutInMs) { LwM2mClient lwM2MClient = lwM2mClientContext.getLwM2mClientWithReg(registration, null); - lwServer.send(registration, request, timeoutInMs, (ResponseCallback) response -> { + leshanServer.send(registration, request, timeoutInMs, (ResponseCallback) response -> { if (!lwM2MClient.isInit()) { - lwM2MClient.initValue(this.service, request.getPath().toString()); + lwM2MClient.initValue(this.serviceImpl, request.getPath().toString()); } if (isSuccess(((Response) response.getCoapResponse()).getCode())) { this.handleResponse(registration, request.getPath().toString(), response, request); @@ -247,23 +239,23 @@ public class LwM2mTransportRequest { String msg = String.format("%s: sendRequest Replace: CoapCde - %s Lwm2m code - %d name - %s Resource path - %s value - %s SendRequest to Client", LOG_LW2M_INFO, ((Response) response.getCoapResponse()).getCode(), response.getCode().getCode(), response.getCode().getName(), request.getPath().toString(), ((LwM2mSingleResource) ((WriteRequest) request).getNode()).getValue().toString()); - service.sentLogsToThingsboard(msg, registration); + serviceImpl.sentLogsToThingsboard(msg, registration); log.info("[{}] [{}] - [{}] [{}] Update SendRequest[{}]", registration.getEndpoint(), ((Response) response.getCoapResponse()).getCode(), response.getCode(), request.getPath().toString(), ((LwM2mSingleResource) ((WriteRequest) request).getNode()).getValue()); } } else { String msg = String.format("%s: sendRequest: CoapCode - %s Lwm2m code - %d name - %s Resource path - %s SendRequest to Client", LOG_LW2M_ERROR, ((Response) response.getCoapResponse()).getCode(), response.getCode().getCode(), response.getCode().getName(), request.getPath().toString()); - service.sentLogsToThingsboard(msg, registration); - log.error("[{}] - [{}] [{}] error SendRequest", ((Response) response.getCoapResponse()).getCode(), response.getCode(), request.getPath().toString()); + serviceImpl.sentLogsToThingsboard(msg, registration); + log.error("[{}], [{}] - [{}] [{}] error SendRequest", registration.getEndpoint(), ((Response) response.getCoapResponse()).getCode(), response.getCode(), request.getPath().toString()); } }, e -> { if (!lwM2MClient.isInit()) { - lwM2MClient.initValue(this.service, request.getPath().toString()); + lwM2MClient.initValue(this.serviceImpl, request.getPath().toString()); } String msg = String.format("%s: sendRequest: Resource path - %s msg error - %s SendRequest to Client", LOG_LW2M_ERROR, request.getPath().toString(), e.toString()); - service.sentLogsToThingsboard(msg, registration); + serviceImpl.sentLogsToThingsboard(msg, registration); log.error("[{}] - [{}] error SendRequest", request.getPath().toString(), e.toString()); }); @@ -275,15 +267,17 @@ public class LwM2mTransportRequest { case STRING: // String return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, value.toString()) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, value.toString()); case INTEGER: // Long - return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, Integer.toUnsignedLong(Integer.valueOf(value.toString()))) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, Integer.toUnsignedLong(Integer.valueOf(value.toString()))); + final long valueInt = Integer.toUnsignedLong(Integer.parseInt(value.toString())); + return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, valueInt) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, valueInt); case OBJLNK: // ObjectLink return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, ObjectLink.fromPath(value.toString())) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, ObjectLink.fromPath(value.toString())); case BOOLEAN: // Boolean - return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, Boolean.valueOf(value.toString())) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, Boolean.valueOf(value.toString())); + return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, Boolean.parseBoolean(value.toString())) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, Boolean.parseBoolean(value.toString())); case FLOAT: // Double - return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, Double.valueOf(value.toString())) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, Double.valueOf(value.toString())); + return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, Double.parseDouble(value.toString())) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, Double.parseDouble(value.toString())); case TIME: // Date - return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, new Date(Long.decode(value.toString()))) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, new Date((Long) Integer.toUnsignedLong(Integer.valueOf(value.toString())))); + Date date = new Date(Long.decode(value.toString())); + return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, date) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, date); case OPAQUE: // byte[] value, base64 return (contentFormat == null) ? new WriteRequest(objectId, instanceId, resourceId, Hex.decodeHex(value.toString().toCharArray())) : new WriteRequest(contentFormat, objectId, instanceId, resourceId, Hex.decodeHex(value.toString().toCharArray())); default: @@ -293,7 +287,7 @@ public class LwM2mTransportRequest { String patn = "/" + objectId + "/" + instanceId + "/" + resourceId; String msg = String.format(LOG_LW2M_ERROR + ": NumberFormatException: Resource path - %s type - %s value - %s msg error - %s SendRequest to Client", patn, type, value, e.toString()); - service.sentLogsToThingsboard(msg, registration); + serviceImpl.sentLogsToThingsboard(msg, registration); log.error("Path: [{}] type: [{}] value: [{}] errorMsg: [{}]]", patn, type, value, e.toString()); return null; } @@ -317,7 +311,7 @@ public class LwM2mTransportRequest { */ private void sendResponse(Registration registration, String path, LwM2mResponse response, DownlinkRequest request) { if (response instanceof ReadResponse) { - service.onObservationResponse(registration, path, (ReadResponse) response); + serviceImpl.onObservationResponse(registration, path, (ReadResponse) response); } else if (response instanceof CancelObservationResponse) { log.info("[{}] Path [{}] CancelObservationResponse 3_Send", path, response); } else if (response instanceof DeleteResponse) { @@ -330,7 +324,7 @@ public class LwM2mTransportRequest { log.info("[{}] Path [{}] WriteAttributesResponse 8_Send", path, response); } else if (response instanceof WriteResponse) { log.info("[{}] Path [{}] WriteAttributesResponse 9_Send", path, response); - service.onWriteResponseOk(registration, path, (WriteRequest) request); + serviceImpl.onWriteResponseOk(registration, path, (WriteRequest) request); } } } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerInitializer.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerInitializer.java index 9c8d62f1e0..4fad90910a 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerInitializer.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerInitializer.java @@ -33,7 +33,7 @@ public class LwM2mTransportServerInitializer { @Autowired private LwM2mTransportServiceImpl service; - @Autowired(required = false) + @Autowired private LeshanServer leshanServer; @Autowired @@ -49,7 +49,7 @@ public class LwM2mTransportServerInitializer { private void startLhServer() { this.leshanServer.start(); - LwM2mServerListener lhServerCertListener = new LwM2mServerListener(this.leshanServer, service); + LwM2mServerListener lhServerCertListener = new LwM2mServerListener(service); this.leshanServer.getRegistrationService().addListener(lhServerCertListener.registrationListener); this.leshanServer.getPresenceService().addListener(lhServerCertListener.presenceListener); this.leshanServer.getObservationService().addListener(lhServerCertListener.observationListener); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportService.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportService.java index 46c9cf5e64..8d1aff37b5 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportService.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportService.java @@ -17,7 +17,6 @@ package org.thingsboard.server.transport.lwm2m.server; import org.eclipse.leshan.core.observation.Observation; import org.eclipse.leshan.core.response.ReadResponse; -import org.eclipse.leshan.server.californium.LeshanServer; import org.eclipse.leshan.server.registration.Registration; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; @@ -28,17 +27,17 @@ import java.util.Optional; public interface LwM2mTransportService { - void onRegistered(LeshanServer lwServer, Registration registration, Collection previousObsersations); + void onRegistered(Registration registration, Collection previousObsersations); - void updatedReg(LeshanServer lwServer, Registration registration); + void updatedReg(Registration registration); - void unReg(LeshanServer lwServer, Registration registration, Collection observations); + void unReg(Registration registration, Collection observations); void onSleepingDev(Registration registration); - void setCancelObservations(LeshanServer lwServer, Registration registration); + void setCancelObservations(Registration registration); - void setCancelObservationRecourse(LeshanServer lwServer, Registration registration, String path); + void setCancelObservationRecourse(Registration registration, String path); void onObservationResponse(Registration registration, String path, ReadResponse response); @@ -48,7 +47,7 @@ public interface LwM2mTransportService { void onDeviceUpdate(TransportProtos.SessionInfoProto sessionInfo, Device device, Optional deviceProfileOpt); - void doTrigger(LeshanServer lwServer, Registration registration, String path); + void doTrigger(Registration registration, String path); void doDisconnect(TransportProtos.SessionInfoProto sessionInfo); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java index 87a7fcbc07..49a949115f 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java @@ -17,6 +17,7 @@ package org.thingsboard.server.transport.lwm2m.server; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -35,7 +36,7 @@ import org.eclipse.leshan.core.response.ReadResponse; import org.eclipse.leshan.core.util.NamedThreadFactory; import org.eclipse.leshan.server.californium.LeshanServer; import org.eclipse.leshan.server.registration.Registration; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; @@ -105,29 +106,32 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { protected final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); protected final Lock writeLock = readWriteLock.writeLock(); - @Autowired - private TransportService transportService; + private final TransportService transportService; - @Autowired - public LwM2mTransportContextServer context; + public final LwM2mTransportContextServer lwM2mTransportContextServer; - @Autowired - private LwM2mTransportRequest lwM2mTransportRequest; + private final LwM2mClientContext lwM2mClientContext; - @Autowired - private LwM2mClientContext lwM2mClientContext; + private final LeshanServer leshanServer; - @Autowired(required = false) - private LeshanServer leshanServer; + private final LwM2mTransportRequest lwM2mTransportRequest; + + public LwM2mTransportServiceImpl(TransportService transportService, LwM2mTransportContextServer lwM2mTransportContextServer, LwM2mClientContext lwM2mClientContext, LeshanServer leshanServer, @Lazy LwM2mTransportRequest lwM2mTransportRequest) { + this.transportService = transportService; + this.lwM2mTransportContextServer = lwM2mTransportContextServer; + this.lwM2mClientContext = lwM2mClientContext; + this.leshanServer = leshanServer; + this.lwM2mTransportRequest = lwM2mTransportRequest; + } @PostConstruct public void init() { - this.context.getScheduler().scheduleAtFixedRate(this::checkInactivityAndReportActivity, new Random().nextInt((int) context.getLwM2MTransportConfigServer().getSessionReportTimeout()), context.getLwM2MTransportConfigServer().getSessionReportTimeout(), TimeUnit.MILLISECONDS); - this.executorRegistered = Executors.newFixedThreadPool(this.context.getLwM2MTransportConfigServer().getRegisteredPoolSize(), + this.lwM2mTransportContextServer.getScheduler().scheduleAtFixedRate(this::checkInactivityAndReportActivity, new Random().nextInt((int) lwM2mTransportContextServer.getLwM2MTransportConfigServer().getSessionReportTimeout()), lwM2mTransportContextServer.getLwM2MTransportConfigServer().getSessionReportTimeout(), TimeUnit.MILLISECONDS); + this.executorRegistered = Executors.newFixedThreadPool(this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getRegisteredPoolSize(), new NamedThreadFactory(String.format("LwM2M %s channel registered", SERVICE_CHANNEL))); - this.executorUpdateRegistered = Executors.newFixedThreadPool(this.context.getLwM2MTransportConfigServer().getUpdateRegisteredPoolSize(), + this.executorUpdateRegistered = Executors.newFixedThreadPool(this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getUpdateRegisteredPoolSize(), new NamedThreadFactory(String.format("LwM2M %s channel update registered", SERVICE_CHANNEL))); - this.executorUnRegistered = Executors.newFixedThreadPool(this.context.getLwM2MTransportConfigServer().getUnRegisteredPoolSize(), + this.executorUnRegistered = Executors.newFixedThreadPool(this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getUnRegisteredPoolSize(), new NamedThreadFactory(String.format("LwM2M %s channel un registered", SERVICE_CHANNEL))); this.converter = LwM2mValueConverterImpl.getInstance(); } @@ -143,17 +147,15 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * 1.2 Remove from sessions Model by enpPoint * Next -> Create new LwM2MClient for current session -> setModelClient... * - * @param lwServer - LeshanServer * @param registration - Registration LwM2M Client * @param previousObsersations - may be null */ - public void onRegistered(LeshanServer lwServer, Registration registration, Collection previousObsersations) { + public void onRegistered(Registration registration, Collection previousObsersations) { executorRegistered.submit(() -> { try { log.warn("[{}] [{{}] Client: create after Registration", registration.getEndpoint(), registration.getId()); LwM2mClient lwM2MClient = this.lwM2mClientContext.updateInSessionsLwM2MClient(registration); if (lwM2MClient != null) { - this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client Registered", registration); SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); if (sessionInfo != null) { lwM2MClient.setDeviceId(new UUID(sessionInfo.getDeviceIdMSB(), sessionInfo.getDeviceIdLSB())); @@ -163,9 +165,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { transportService.registerAsyncSession(sessionInfo, new LwM2mSessionMsgListener(this, sessionInfo)); transportService.process(sessionInfo, DefaultTransportService.getSessionEventMsg(SessionEvent.OPEN), null); transportService.process(sessionInfo, TransportProtos.SubscribeToAttributeUpdatesMsg.newBuilder().build(), null); - this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client create after Registration", registration); - this.initLwM2mFromClientValue(lwServer, registration, lwM2MClient); - + this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client create after Registration", registration); + this.initLwM2mFromClientValue(registration, lwM2MClient); } else { log.error("Client: [{}] onRegistered [{}] name [{}] sessionInfo ", registration.getId(), registration.getEndpoint(), null); } @@ -181,10 +182,9 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { /** * if sessionInfo removed from sessions, then new registerAsyncSession * - * @param lwServer - LeshanServer * @param registration - Registration LwM2M Client */ - public void updatedReg(LeshanServer lwServer, Registration registration) { + public void updatedReg(Registration registration) { executorUpdateRegistered.submit(() -> { try { SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); @@ -205,10 +205,10 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * @param observations - All paths observations before unReg * !!! Warn: if have not finishing unReg, then this operation will be finished on next Client`s connect */ - public void unReg(LeshanServer lwServer, Registration registration, Collection observations) { + public void unReg(Registration registration, Collection observations) { executorUnRegistered.submit(() -> { try { - this.setCancelObservations(lwServer, registration); + this.setCancelObservations(registration); this.sentLogsToThingsboard(LOG_LW2M_INFO + ": Client unRegistration", registration); this.closeClientSession(registration); } catch (Throwable t) { @@ -238,10 +238,10 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { } @Override - public void setCancelObservations(LeshanServer lwServer, Registration registration) { + public void setCancelObservations(Registration registration) { if (registration != null) { - Set observations = lwServer.getObservationService().getObservations(registration); - observations.forEach(observation -> this.setCancelObservationRecourse(lwServer, registration, observation.getPath().toString())); + Set observations = leshanServer.getObservationService().getObservations(registration); + observations.forEach(observation -> this.setCancelObservationRecourse(registration, observation.getPath().toString())); } } @@ -251,8 +251,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * {@code ObservationService#cancelObservation()} */ @Override - public void setCancelObservationRecourse(LeshanServer lwServer, Registration registration, String path) { - lwServer.getObservationService().cancelObservations(registration, path); + public void setCancelObservationRecourse(Registration registration, String path) { + leshanServer.getObservationService().cancelObservations(registration, path); } /** @@ -294,12 +294,12 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { String path = this.getPathAttributeUpdate(sessionInfo, de.getKey()); String value = de.getValue().getAsString(); LwM2mClient lwM2MClient = lwM2mClientContext.getLwM2mClient(new UUID(sessionInfo.getSessionIdMSB(), sessionInfo.getSessionIdLSB())); - LwM2mClientProfile profile = lwM2mClientContext.getProfile(new UUID(sessionInfo.getDeviceProfileIdMSB(), sessionInfo.getDeviceProfileIdLSB())); - ResourceModel resourceModel = context.getLwM2MTransportConfigServer().getResourceModel(lwM2MClient.getRegistration(), new LwM2mPath(path)); - if (!path.isEmpty() && (this.validatePathInAttrProfile(profile, path) || this.validatePathInTelemetryProfile(profile, path))) { + LwM2mClientProfile clientProfile = lwM2mClientContext.getProfile(new UUID(sessionInfo.getDeviceProfileIdMSB(), sessionInfo.getDeviceProfileIdLSB())); + if (path != null && !path.isEmpty() && (this.validatePathInAttrProfile(clientProfile, path) || this.validatePathInTelemetryProfile(clientProfile, path))) { + ResourceModel resourceModel = lwM2mTransportContextServer.getLwM2MTransportConfigServer().getResourceModel(lwM2MClient.getRegistration(), new LwM2mPath(path)); if (resourceModel != null && resourceModel.operations.isWritable()) { - lwM2mTransportRequest.sendAllRequest(leshanServer, lwM2MClient.getRegistration(), path, POST_TYPE_OPER_WRITE_REPLACE, - ContentFormat.TLV.getName(), null, value, this.context.getLwM2MTransportConfigServer().getTimeout()); + lwM2mTransportRequest.sendAllRequest(lwM2MClient.getRegistration(), path, POST_TYPE_OPER_WRITE_REPLACE, + ContentFormat.TLV.getName(), null, value, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); } else { log.error("Resource path - [{}] value - [{}] is not Writable and cannot be updated", path, value); String logMsg = String.format("%s: attributeUpdate: Resource path - %s value - %s is not Writable and cannot be updated", @@ -353,9 +353,9 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * Trigger bootStrap path = "/1/0/9" - have to implemented on client */ @Override - public void doTrigger(LeshanServer lwServer, Registration registration, String path) { - lwM2mTransportRequest.sendAllRequest(lwServer, registration, path, POST_TYPE_OPER_EXECUTE, - ContentFormat.TLV.getName(), null, null, this.context.getLwM2MTransportConfigServer().getTimeout()); + public void doTrigger(Registration registration, String path) { + lwM2mTransportRequest.sendAllRequest(registration, path, POST_TYPE_OPER_EXECUTE, + ContentFormat.TLV.getName(), null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); } /** @@ -438,7 +438,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { public void updateParametersOnThingsboard(JsonElement msg, String topicName, Registration registration) { SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); if (sessionInfo != null) { - context.sentParametersOnThingsboard(msg, topicName, sessionInfo); + lwM2mTransportContextServer.sentParametersOnThingsboard(msg, topicName, sessionInfo); } else { log.error("Client: [{}] updateParametersOnThingsboard [{}] sessionInfo ", registration, null); } @@ -455,30 +455,29 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * - Request to the client after registration to read all resource values for all objects * - then Observe Request to the client marked as observe from the profile configuration. * - * @param lwServer - LeshanServer * @param registration - Registration LwM2M Client * @param lwM2MClient - object with All parameters off client */ - private void initLwM2mFromClientValue(LeshanServer lwServer, Registration registration, LwM2mClient lwM2MClient) { + private void initLwM2mFromClientValue(Registration registration, LwM2mClient lwM2MClient) { LwM2mClientProfile lwM2MClientProfile = lwM2mClientContext.getProfile(registration); Set clientObjects = this.getAllOjectsInClient(registration); if (clientObjects != null && !LwM2mTransportHandler.getClientOnlyObserveAfterConnect(lwM2MClientProfile)) { // #2 if (!LwM2mTransportHandler.getClientUpdateValueAfterConnect(lwM2MClientProfile)) { - this.initReadAttrTelemetryObserveToClient(lwServer, registration, lwM2MClient, GET_TYPE_OPER_READ); + this.initReadAttrTelemetryObserveToClient(registration, lwM2MClient, GET_TYPE_OPER_READ); } // #3 else { lwM2MClient.getPendingRequests().addAll(clientObjects); clientObjects.forEach(path -> { - lwM2mTransportRequest.sendAllRequest(lwServer, registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), - null, null, this.context.getLwM2MTransportConfigServer().getTimeout()); + lwM2mTransportRequest.sendAllRequest(registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), + null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); }); } } // #1 - this.initReadAttrTelemetryObserveToClient(lwServer, registration, lwM2MClient, GET_TYPE_OPER_OBSERVE); + this.initReadAttrTelemetryObserveToClient(registration, lwM2MClient, GET_TYPE_OPER_OBSERVE); } /** @@ -513,8 +512,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * #2 Update new Resources (replace old Resource Value on new Resource Value) * * @param registration - Registration LwM2M Client - * @param - LwM2mSingleResource response.getContent() - * @param - LwM2mSingleResource response.getContent() + * @param lwM2mResource - LwM2mSingleResource response.getContent() * @param path - resource */ private void updateResourcesValue(Registration registration, LwM2mResource lwM2mResource, String path) { @@ -522,31 +520,21 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { lwM2MClient.updateResourceValue(path, lwM2mResource); Set paths = new HashSet<>(); paths.add(path); - this.updateAttrTelemetry(registration, false, paths); + this.updateAttrTelemetry(registration, paths); } /** * Sent Attribute and Telemetry to Thingsboard - * #1 - get AttrName/TelemetryName with value: - * #1.1 from Client - * #1.2 from LwM2MClient: + * #1 - get AttrName/TelemetryName with value from LwM2MClient: * -- resourceId == path from LwM2MClientProfile.postAttributeProfile/postTelemetryProfile/postObserveProfile * -- AttrName/TelemetryName == resourceName from ModelObject.objectModel, value from ModelObject.instance.resource(resourceId) * #2 - set Attribute/Telemetry * * @param registration - Registration LwM2M Client */ - private void updateAttrTelemetry(Registration registration, boolean start, Set paths) { + private void updateAttrTelemetry(Registration registration, Set paths) { JsonObject attributes = new JsonObject(); JsonObject telemetries = new JsonObject(); - if (start) { - // #1.1 - JsonObject attributeClient = this.getAttributeClient(registration); - if (attributeClient != null) { - attributeClient.entrySet().forEach(p -> attributes.add(p.getKey(), p.getValue())); - } - } - // #1.2 try { writeLock.lock(); this.getParametersFromProfile(attributes, telemetries, registration, paths); @@ -562,25 +550,35 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { } /** - * @param profile - + * @param clientProfile - * @param path - * @return true if path isPresent in postAttributeProfile */ - private boolean validatePathInAttrProfile(LwM2mClientProfile profile, String path) { - Set attributesSet = new Gson().fromJson(profile.getPostAttributeProfile(), new TypeToken<>() { - }.getType()); - return attributesSet.stream().filter(p -> p.equals(path)).findFirst().isPresent(); + private boolean validatePathInAttrProfile(LwM2mClientProfile clientProfile, String path) { + try { + List attributesSet = new Gson().fromJson(clientProfile.getPostAttributeProfile(), new TypeToken<>() { + }.getType()); + return attributesSet.stream().anyMatch(p -> p.equals(path)); + } catch (Exception e) { + log.error("Fail Validate Path [{}] ClientProfile.Attribute", path, e); + return false; + } } /** - * @param profile - + * @param clientProfile - * @param path - * @return true if path isPresent in postAttributeProfile */ - private boolean validatePathInTelemetryProfile(LwM2mClientProfile profile, String path) { - Set telemetriesSet = new Gson().fromJson(profile.getPostTelemetryProfile(), new TypeToken<>() { - }.getType()); - return telemetriesSet.stream().filter(p -> p.equals(path)).findFirst().isPresent(); + private boolean validatePathInTelemetryProfile(LwM2mClientProfile clientProfile, String path) { + try { + List telemetriesSet = new Gson().fromJson(clientProfile.getPostTelemetryProfile(), new TypeToken<>() { + }.getType()); + return telemetriesSet.stream().anyMatch(p -> p.equals(path)); + } catch (Exception e) { + log.error("Fail Validate Path [{}] ClientProfile.Telemetry", path, e); + return false; + } } /** @@ -588,10 +586,9 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * #1 - Analyze: * #1.1 path in resource profile == client resource * - * @param lwServer - * @param registration - */ - private void initReadAttrTelemetryObserveToClient(LeshanServer lwServer, Registration registration, LwM2mClient lwM2MClient, String typeOper) { + private void initReadAttrTelemetryObserveToClient(Registration registration, LwM2mClient lwM2MClient, String typeOper) { try { LwM2mClientProfile lwM2MClientProfile = lwM2mClientContext.getProfile(registration); Set clientInstances = this.getAllInstancesInClient(registration); @@ -606,19 +603,18 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { }); } Set pathSent = ConcurrentHashMap.newKeySet(); - result.forEach(p -> { + result.forEach(target -> { // #1.1 - String target = p; String[] resPath = target.split("/"); String instance = "/" + resPath[1] + "/" + resPath[2]; - if (clientInstances.contains(instance)) { + if (clientInstances != null && clientInstances.size() > 0 && clientInstances.contains(instance)) { pathSent.add(target); } }); lwM2MClient.getPendingRequests().addAll(pathSent); pathSent.forEach(target -> { - lwM2mTransportRequest.sendAllRequest(lwServer, registration, target, typeOper, ContentFormat.TLV.getName(), - null, null, this.context.getLwM2MTransportConfigServer().getTimeout()); + lwM2mTransportRequest.sendAllRequest(registration, target, typeOper, ContentFormat.TLV.getName(), + null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); }); if (GET_TYPE_OPER_OBSERVE.equals(typeOper)) { lwM2MClient.initValue(this, null); @@ -677,26 +673,26 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { return (clientInstances.size() > 0) ? clientInstances : null; } - /** - * get AttrName/TelemetryName with value from Client - * - * @param registration - - * @return - JsonObject, format: {name: value}} - */ - private JsonObject getAttributeClient(Registration registration) { - if (registration.getAdditionalRegistrationAttributes().size() > 0) { - JsonObject resNameValues = new JsonObject(); - registration.getAdditionalRegistrationAttributes().forEach(resNameValues::addProperty); - return resNameValues; - } - return null; - } +// /** +// * get AttrName/TelemetryName with value from Client +// * +// * @param registration - +// * @return - JsonObject, format: {name: value}} +// */ +// private JsonObject getAttributeClient(Registration registration) { +// if (registration.getAdditionalRegistrationAttributes().size() > 0) { +// JsonObject resNameValues = new JsonObject(); +// registration.getAdditionalRegistrationAttributes().forEach(resNameValues::addProperty); +// return resNameValues; +// } +// return null; +// } /** * @param attributes - new JsonObject * @param telemetry - new JsonObject * @param registration - Registration LwM2M Client - * @param path + * @param path - */ private void getParametersFromProfile(JsonObject attributes, JsonObject telemetry, Registration registration, Set path) { LwM2mClientProfile lwM2MClientProfile = lwM2mClientContext.getProfile(registration); @@ -746,7 +742,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { LwM2mPath pathIds = new LwM2mPath(path); ResourceValue resourceValue = this.returnResourceValueFromLwM2MClient(lwM2MClient, pathIds); return resourceValue == null ? null : - this.converter.convertValue(resourceValue.getResourceValue(), this.context.getLwM2MTransportConfigServer().getResourceModelType(lwM2MClient.getRegistration(), pathIds), ResourceModel.Type.STRING, pathIds).toString(); + this.converter.convertValue(resourceValue.getResourceValue(), this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getResourceModelType(lwM2MClient.getRegistration(), pathIds), ResourceModel.Type.STRING, pathIds).toString(); } /** @@ -796,25 +792,21 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * @param deviceProfile - */ private void onDeviceUpdateChangeProfile(Set registrationIds, DeviceProfile deviceProfile) { - LwM2mClientProfile lwM2MClientProfileOld = lwM2mClientContext.getProfiles().get(deviceProfile.getUuidId()); + LwM2mClientProfile lwM2MClientProfileOld = lwM2mClientContext.getProfiles().get(deviceProfile.getUuidId()).clone(); if (lwM2mClientContext.addUpdateProfileParameters(deviceProfile)) { // #1 JsonArray attributeOld = lwM2MClientProfileOld.getPostAttributeProfile(); - Set attributeSetOld = new Gson().fromJson(attributeOld, new TypeToken<>() { - }.getType()); + Set attributeSetOld = this.convertJsonArrayToSet (attributeOld); JsonArray telemetryOld = lwM2MClientProfileOld.getPostTelemetryProfile(); - Set telemetrySetOld = new Gson().fromJson(telemetryOld, new TypeToken<>() { - }.getType()); + Set telemetrySetOld = this.convertJsonArrayToSet (telemetryOld); JsonArray observeOld = lwM2MClientProfileOld.getPostObserveProfile(); JsonObject keyNameOld = lwM2MClientProfileOld.getPostKeyNameProfile(); LwM2mClientProfile lwM2MClientProfileNew = lwM2mClientContext.getProfiles().get(deviceProfile.getUuidId()); JsonArray attributeNew = lwM2MClientProfileNew.getPostAttributeProfile(); - Set attributeSetNew = new Gson().fromJson(attributeNew, new TypeToken<>() { - }.getType()); + Set attributeSetNew = this.convertJsonArrayToSet (attributeNew); JsonArray telemetryNew = lwM2MClientProfileNew.getPostTelemetryProfile(); - Set telemetrySetNew = new Gson().fromJson(telemetryNew, new TypeToken<>() { - }.getType()); + Set telemetrySetNew = this.convertJsonArrayToSet (telemetryNew); JsonArray observeNew = lwM2MClientProfileNew.getPostObserveProfile(); JsonObject keyNameNew = lwM2MClientProfileNew.getPostKeyNameProfile(); @@ -847,11 +839,11 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { if (sentAttrToThingsboard.getPathPostParametersAdd().size() > 0) { // update value in Resources registrationIds.forEach(registrationId -> { - LeshanServer lwServer = leshanServer; +// LeshanServer lwServer = leshanServer; Registration registration = lwM2mClientContext.getRegistration(registrationId); - this.readResourceValueObserve(lwServer, registration, sentAttrToThingsboard.getPathPostParametersAdd(), GET_TYPE_OPER_READ); + this.readResourceValueObserve(registration, sentAttrToThingsboard.getPathPostParametersAdd(), GET_TYPE_OPER_READ); // sent attr/telemetry to tingsboard for new path - this.updateAttrTelemetry(registration, false, sentAttrToThingsboard.getPathPostParametersAdd()); + this.updateAttrTelemetry(registration, sentAttrToThingsboard.getPathPostParametersAdd()); }); } // #4.2 del @@ -862,10 +854,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { // #5.1 if (!observeOld.equals(observeNew)) { - Set observeSetOld = new Gson().fromJson(observeOld, new TypeToken<>() { - }.getType()); - Set observeSetNew = new Gson().fromJson(observeNew, new TypeToken<>() { - }.getType()); + Set observeSetOld = new Gson().fromJson(observeOld, new TypeToken<>() {}.getType()); + Set observeSetNew = new Gson().fromJson(observeNew, new TypeToken<>() {}.getType()); //#5.2 add // path Attr/Telemetry includes newObserve attributeSetOld.addAll(telemetrySetOld); @@ -876,17 +866,22 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { ResultsAnalyzerParameters postObserveAnalyzer = this.getAnalyzerParameters(sentObserveToClientOld.getPathPostParametersAdd(), sentObserveToClientNew.getPathPostParametersAdd()); // sent Request observe to Client registrationIds.forEach(registrationId -> { - LeshanServer lwServer = leshanServer; Registration registration = lwM2mClientContext.getRegistration(registrationId); - this.readResourceValueObserve(lwServer, registration, postObserveAnalyzer.getPathPostParametersAdd(), GET_TYPE_OPER_OBSERVE); + this.readResourceValueObserve(registration, postObserveAnalyzer.getPathPostParametersAdd(), GET_TYPE_OPER_OBSERVE); // 5.3 del // sent Request cancel observe to Client - this.cancelObserveIsValue(lwServer, registration, postObserveAnalyzer.getPathPostParametersDel()); + this.cancelObserveIsValue(registration, postObserveAnalyzer.getPathPostParametersDel()); }); } } } + private Set convertJsonArrayToSet (JsonArray jsonArray) { + List attributeListOld = new Gson().fromJson(jsonArray, new TypeToken<>() { + }.getType()); + return Sets.newConcurrentHashSet(attributeListOld); + } + /** * Compare old list with new list after change AttrTelemetryObserve in config Profile * @@ -917,20 +912,19 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * Update Resource value after change RezAttrTelemetry in config Profile * sent response Read to Client and add path to pathResAttrTelemetry in LwM2MClient.getAttrTelemetryObserveValue() * - * @param lwServer - LeshanServer * @param registration - Registration LwM2M Client * @param targets - path Resources == [ "/2/0/0", "/2/0/1"] */ - private void readResourceValueObserve(LeshanServer lwServer, Registration registration, Set targets, String typeOper) { + private void readResourceValueObserve(Registration registration, Set targets, String typeOper) { targets.forEach(target -> { LwM2mPath pathIds = new LwM2mPath(target); if (pathIds.isResource()) { if (GET_TYPE_OPER_READ.equals(typeOper)) { - lwM2mTransportRequest.sendAllRequest(lwServer, registration, target, typeOper, - ContentFormat.TLV.getName(), null, null, this.context.getLwM2MTransportConfigServer().getTimeout()); + lwM2mTransportRequest.sendAllRequest(registration, target, typeOper, + ContentFormat.TLV.getName(), null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); } else if (GET_TYPE_OPER_OBSERVE.equals(typeOper)) { - lwM2mTransportRequest.sendAllRequest(lwServer, registration, target, typeOper, - null, null, null, this.context.getLwM2MTransportConfigServer().getTimeout()); + lwM2mTransportRequest.sendAllRequest(registration, target, typeOper, + null, null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); } } }); @@ -946,11 +940,11 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { return analyzerParameters; } - private void cancelObserveIsValue(LeshanServer lwServer, Registration registration, Set paramAnallyzer) { + private void cancelObserveIsValue(Registration registration, Set paramAnallyzer) { LwM2mClient lwM2MClient = lwM2mClientContext.getLwM2mClientWithReg(registration, null); paramAnallyzer.forEach(p -> { if (this.returnResourceValueFromLwM2MClient(lwM2MClient, new LwM2mPath(p)) != null) { - this.setCancelObservationRecourse(lwServer, registration, p); + this.setCancelObservationRecourse(registration, p); } } ); @@ -958,8 +952,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { private void putDelayedUpdateResourcesClient(LwM2mClient lwM2MClient, Object valueOld, Object valueNew, String path) { if (valueNew != null && (valueOld == null || !valueNew.toString().equals(valueOld.toString()))) { - lwM2mTransportRequest.sendAllRequest(leshanServer, lwM2MClient.getRegistration(), path, POST_TYPE_OPER_WRITE_REPLACE, - ContentFormat.TLV.getName(), null, valueNew, this.context.getLwM2MTransportConfigServer().getTimeout()); + lwM2mTransportRequest.sendAllRequest(lwM2MClient.getRegistration(), path, POST_TYPE_OPER_WRITE_REPLACE, + ContentFormat.TLV.getName(), null, valueNew, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); } else { log.error("05 delayError"); } @@ -1037,7 +1031,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { /** * @param lwM2MClient - - * @return + * @return SessionInfoProto - */ private SessionInfoProto getNewSessionInfoProto(LwM2mClient lwM2MClient) { if (lwM2MClient != null) { @@ -1048,7 +1042,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { return null; } else { return SessionInfoProto.newBuilder() - .setNodeId(this.context.getNodeId()) + .setNodeId(this.lwM2mTransportContextServer.getNodeId()) .setSessionIdMSB(lwM2MClient.getSessionId().getMostSignificantBits()) .setSessionIdLSB(lwM2MClient.getSessionId().getLeastSignificantBits()) .setDeviceIdMSB(msg.getDeviceInfo().getDeviceIdMSB()) @@ -1114,7 +1108,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { if (attrSharedNames.size() > 0) { //#2.1 try { - TransportProtos.GetAttributeRequestMsg getAttributeMsg = context.getAdaptor().convertToGetAttributes(null, attrSharedNames); + TransportProtos.GetAttributeRequestMsg getAttributeMsg = lwM2mTransportContextServer.getAdaptor().convertToGetAttributes(null, attrSharedNames); transportService.process(sessionInfo, getAttributeMsg, getAckCallback(lwM2MClient, getAttributeMsg.getRequestId(), DEVICE_ATTRIBUTES_REQUEST)); } catch (AdaptorException e) { log.warn("Failed to decode get attributes request", e); @@ -1138,8 +1132,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { ConcurrentMap keyNamesIsWritable = keyNamesMap.entrySet() .stream() - .filter(e -> (attrSet.contains(e.getKey()) && context.getLwM2MTransportConfigServer().getResourceModel(lwM2MClient.getRegistration(), new LwM2mPath(e.getKey())) != null && - context.getLwM2MTransportConfigServer().getResourceModel(lwM2MClient.getRegistration(), new LwM2mPath(e.getKey())).operations.isWritable())) + .filter(e -> (attrSet.contains(e.getKey()) && lwM2mTransportContextServer.getLwM2MTransportConfigServer().getResourceModel(lwM2MClient.getRegistration(), new LwM2mPath(e.getKey())) != null && + lwM2mTransportContextServer.getLwM2MTransportConfigServer().getResourceModel(lwM2MClient.getRegistration(), new LwM2mPath(e.getKey())).operations.isWritable())) .collect(Collectors.toConcurrentMap(Map.Entry::getKey, Map.Entry::getValue)); Set namesIsWritable = ConcurrentHashMap.newKeySet(); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java index 6f28d54d67..810ea253a7 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java @@ -15,6 +15,7 @@ */ package org.thingsboard.server.transport.lwm2m.server.client; +import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import lombok.Data; @@ -25,7 +26,7 @@ public class LwM2mClientProfile { * {"clientLwM2mSettings": { * clientUpdateValueAfterConnect: false; * } - **/ + **/ JsonObject postClientLwM2mSettings; /** @@ -34,7 +35,7 @@ public class LwM2mClientProfile { * "/3/0/0": "manufacturer", * "/3/0/2": "serialNumber" * } - **/ + **/ JsonObject postKeyNameProfile; /** @@ -51,4 +52,27 @@ public class LwM2mClientProfile { * [ "/2/0/0", "/2/0/1"] */ JsonArray postObserveProfile; + + public LwM2mClientProfile clone() { + LwM2mClientProfile lwM2mClientProfile = new LwM2mClientProfile(); + lwM2mClientProfile.postClientLwM2mSettings = this.deepCopy(this.postClientLwM2mSettings, JsonObject.class); + lwM2mClientProfile.postKeyNameProfile = this.deepCopy(this.postKeyNameProfile, JsonObject.class); + lwM2mClientProfile.postAttributeProfile = this.deepCopy(this.postAttributeProfile, JsonArray.class); + lwM2mClientProfile.postTelemetryProfile = this.deepCopy(this.postTelemetryProfile, JsonArray.class); + lwM2mClientProfile.postObserveProfile = this.deepCopy(this.postObserveProfile, JsonArray.class); + return lwM2mClientProfile; + } + + + private T deepCopy(T elements, Class type) { + try { + Gson gson = new Gson(); + return gson.fromJson(gson.toJson(elements), type); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + } diff --git a/pom.xml b/pom.xml index ab7cca1348..aab4726de1 100755 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 2.12.1 2.12.1 2.2.6 - 2.6.0 + 2.6.1 1.3.0 1.3.0 1.3.0 From f29d548d4a5969b3cceb7cf6bbe47821803fadbc Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Wed, 3 Mar 2021 18:47:56 +0200 Subject: [PATCH 51/69] Fix timeseries bars tooltip --- .../modules/home/components/widget/lib/flot-widget.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts index 2d7514014d..4850d08723 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts @@ -1289,6 +1289,7 @@ export class TbFlot { let value: any; let lastValue = 0; let minDistanceHistorical: number; + let deltaX = 0; const results: TbFlotHoverInfo[] = [{ seriesHover: [] }]; @@ -1297,6 +1298,13 @@ export class TbFlot { seriesHover: [] }); } + if (this.chartType === 'bar' && this.options.series.bars.align !== 'left') { + if (this.options.series.bars.align === 'center') { + deltaX = this.options.series.bars.barWidth / 2; + } else { + deltaX = this.options.series.bars.barWidth; + } + } for (i = 0; i < seriesList.length; i++) { series = seriesList[i]; let posx: number; @@ -1305,6 +1313,7 @@ export class TbFlot { } else { posx = pos.x; } + posx += deltaX; hoverIndex = this.findHoverIndexFromData(posx, series); if (series.data[hoverIndex] && series.data[hoverIndex][0]) { hoverDistance = posx - series.data[hoverIndex][0]; From 50d96fb49e4402417540afee94ed2d9a54f87f93 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 4 Mar 2021 10:03:09 +0200 Subject: [PATCH 52/69] Version set to 3.3.0-SNAPSHOT --- application/pom.xml | 2 +- common/actor/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- dao/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/js-executor/package.json | 2 +- msa/js-executor/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/web-ui/package.json | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 ++-- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- ui-ngx/package.json | 2 +- ui-ngx/pom.xml | 2 +- 40 files changed, 41 insertions(+), 41 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index 4d820b0400..1d02f09d16 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard application diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 359a2362f9..1f4849cb79 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 3d9699061e..ba30e5bb43 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index ea4d8cb2d8..79b3bc8e26 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 114b48a65a..06ba4aff3b 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index e5e4eb107c..7568d18ca6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index 54098babcc..e0b30dd654 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/stats/pom.xml b/common/stats/pom.xml index 94cde12d3a..005c210b7b 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 8fa8cceb2a..cea8ddc0ce 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index c04ff34adb..f229627480 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 4368aad588..676593804e 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 7d6be1f5ae..96865036d5 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 5f5bcccc62..491adc189e 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index 8999c3ddb7..6f66da5790 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index aea4ed0af7..e1a08cb74d 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard dao diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index cefbdf140b..9af00d44c7 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index 77dcb5992f..75f009880b 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-js-executor", "private": true, - "version": "3.2.2", + "version": "3.3.0", "description": "ThingsBoard JavaScript Executor Microservice", "main": "server.js", "bin": "server.js", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 769cbf6d36..a254b1acde 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/pom.xml b/msa/pom.xml index f15738fb74..3d7bf3f347 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index df1988c3a0..133b81c79d 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index d35762163c..efb9a709e9 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 890e8b91e8..1285cca0ce 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index cc85b507a9..da0688b545 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index c7352d9821..782b6a228a 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 37ce157c41..84906e42db 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index 1725a7c3c2..3897c31f5e 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-web-ui", "private": true, - "version": "3.2.2", + "version": "3.3.0", "description": "ThingsBoard Web UI Microservice", "main": "server.js", "bin": "server.js", diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index 93c7f24e21..85f5db6ce3 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index f956f6f09a..742aa039be 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard netty-mqtt - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index aab4726de1..7e12adff98 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index b8373b351f..e45db432d8 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index 3709498312..d4af78f871 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index fe44acac1f..bb348793c1 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index f435277fcc..31c0c1d824 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index bb0435d434..c7fcf277ea 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index c979a2d2e1..1ede01a491 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index b91c5d9dd0..41ca5683a1 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index b9c651d9c6..28aaeeab39 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index e45116a8e6..794abceddc 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard transport diff --git a/ui-ngx/package.json b/ui-ngx/package.json index a0da1f210b..775a685ae8 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -1,6 +1,6 @@ { "name": "thingsboard", - "version": "3.2.2", + "version": "3.3.0", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --open", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index f06442db25..fb8c809260 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard org.thingsboard From e3851dcaad4864ab9d00df383b2c5bc9750ae0dd Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 4 Mar 2021 10:50:57 +0200 Subject: [PATCH 53/69] improvements --- .../server/controller/plugin/TbWebSocketHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java index aeb595a193..166403f417 100644 --- a/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java +++ b/application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java @@ -229,7 +229,6 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr if (isSending) { try { msgQueue.add(msg); - lastActivityTime = System.currentTimeMillis(); } catch (RuntimeException e) { if (log.isTraceEnabled()) { log.trace("[{}][{}] Session closed due to queue error", sessionRef.getSecurityCtx().getTenantId(), session.getId(), e); @@ -271,6 +270,7 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr log.trace("[{}] Session transport error", session.getId(), ioe); } } else { + lastActivityTime = System.currentTimeMillis(); String msg = msgQueue.poll(); if (msg != null) { sendMsgInternal(msg); From 8fe6c956c8968761d007578eafd0aab19261f9f0 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 4 Mar 2021 12:37:38 +0200 Subject: [PATCH 54/69] Version set to 3.3.0-SNAPSHOT. Code style improvements. --- application/pom.xml | 2 +- common/actor/pom.xml | 2 +- common/dao-api/pom.xml | 2 +- common/data/pom.xml | 2 +- common/message/pom.xml | 2 +- common/pom.xml | 2 +- common/queue/pom.xml | 2 +- common/stats/pom.xml | 2 +- common/transport/coap/pom.xml | 2 +- common/transport/http/pom.xml | 2 +- common/transport/lwm2m/pom.xml | 18 ----- .../server/LwM2mTransportServiceImpl.java | 73 ++++++++----------- .../store/TbLwM2mRedisRegistrationStore.java | 19 +++-- common/transport/mqtt/pom.xml | 2 +- common/transport/pom.xml | 2 +- common/transport/transport-api/pom.xml | 2 +- common/util/pom.xml | 2 +- .../thingsboard/common/util/JacksonUtil.java | 9 +++ dao/pom.xml | 2 +- msa/black-box-tests/pom.xml | 2 +- msa/js-executor/package.json | 2 +- msa/js-executor/pom.xml | 2 +- msa/pom.xml | 2 +- msa/tb-node/pom.xml | 2 +- msa/tb/pom.xml | 2 +- msa/transport/coap/pom.xml | 2 +- msa/transport/http/pom.xml | 2 +- msa/transport/mqtt/pom.xml | 2 +- msa/transport/pom.xml | 2 +- msa/web-ui/package.json | 2 +- msa/web-ui/pom.xml | 2 +- netty-mqtt/pom.xml | 4 +- pom.xml | 2 +- rest-client/pom.xml | 2 +- rule-engine/pom.xml | 2 +- rule-engine/rule-engine-api/pom.xml | 2 +- rule-engine/rule-engine-components/pom.xml | 2 +- tools/pom.xml | 2 +- transport/coap/pom.xml | 2 +- transport/http/pom.xml | 2 +- transport/mqtt/pom.xml | 2 +- transport/pom.xml | 2 +- ui-ngx/package.json | 2 +- ui-ngx/pom.xml | 2 +- 44 files changed, 90 insertions(+), 111 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index 4d820b0400..1d02f09d16 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard application diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 359a2362f9..1f4849cb79 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 3d9699061e..ba30e5bb43 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index ea4d8cb2d8..79b3bc8e26 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 114b48a65a..06ba4aff3b 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index e5e4eb107c..7568d18ca6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index 54098babcc..e0b30dd654 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/stats/pom.xml b/common/stats/pom.xml index 94cde12d3a..005c210b7b 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 8fa8cceb2a..cea8ddc0ce 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index c04ff34adb..f229627480 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index ee3d5fc759..fe19dae329 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -14,24 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ---> - - diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java index 49a949115f..b907bfbc24 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java @@ -38,6 +38,7 @@ import org.eclipse.leshan.server.californium.LeshanServer; import org.eclipse.leshan.server.registration.Registration; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.transport.TransportService; @@ -470,10 +471,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { // #3 else { lwM2MClient.getPendingRequests().addAll(clientObjects); - clientObjects.forEach(path -> { - lwM2mTransportRequest.sendAllRequest(registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), - null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); - }); + clientObjects.forEach(path -> lwM2mTransportRequest.sendAllRequest(registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), + null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout())); } } // #1 @@ -589,38 +588,29 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { * @param registration - */ private void initReadAttrTelemetryObserveToClient(Registration registration, LwM2mClient lwM2MClient, String typeOper) { - try { - LwM2mClientProfile lwM2MClientProfile = lwM2mClientContext.getProfile(registration); - Set clientInstances = this.getAllInstancesInClient(registration); - Set result; - if (GET_TYPE_OPER_READ.equals(typeOper)) { - result = new ObjectMapper().readValue(lwM2MClientProfile.getPostAttributeProfile().getAsJsonArray().toString().getBytes(), new TypeReference<>() { - }); - result.addAll(new ObjectMapper().readValue(lwM2MClientProfile.getPostTelemetryProfile().getAsJsonArray().toString().getBytes(), new TypeReference<>() { - })); - } else { - result = new ObjectMapper().readValue(lwM2MClientProfile.getPostObserveProfile().getAsJsonArray().toString().getBytes(), new TypeReference<>() { - }); - } - Set pathSent = ConcurrentHashMap.newKeySet(); - result.forEach(target -> { - // #1.1 - String[] resPath = target.split("/"); - String instance = "/" + resPath[1] + "/" + resPath[2]; - if (clientInstances != null && clientInstances.size() > 0 && clientInstances.contains(instance)) { - pathSent.add(target); - } - }); - lwM2MClient.getPendingRequests().addAll(pathSent); - pathSent.forEach(target -> { - lwM2mTransportRequest.sendAllRequest(registration, target, typeOper, ContentFormat.TLV.getName(), - null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout()); - }); - if (GET_TYPE_OPER_OBSERVE.equals(typeOper)) { - lwM2MClient.initValue(this, null); + LwM2mClientProfile lwM2MClientProfile = lwM2mClientContext.getProfile(registration); + Set clientInstances = this.getAllInstancesInClient(registration); + Set result; + if (GET_TYPE_OPER_READ.equals(typeOper)) { + result = JacksonUtil.fromString(lwM2MClientProfile.getPostAttributeProfile().toString(), new TypeReference<>() {}); + result.addAll(JacksonUtil.fromString(lwM2MClientProfile.getPostTelemetryProfile().toString(), new TypeReference<>() {})); + } else { + result = JacksonUtil.fromString(lwM2MClientProfile.getPostObserveProfile().toString(), new TypeReference<>() {}); + } + Set pathSent = ConcurrentHashMap.newKeySet(); + result.forEach(target -> { + // #1.1 + String[] resPath = target.split("/"); + String instance = "/" + resPath[1] + "/" + resPath[2]; + if (clientInstances != null && clientInstances.size() > 0 && clientInstances.contains(instance)) { + pathSent.add(target); } - } catch (IOException e) { - e.printStackTrace(); + }); + lwM2MClient.getPendingRequests().addAll(pathSent); + pathSent.forEach(target -> lwM2mTransportRequest.sendAllRequest(registration, target, typeOper, ContentFormat.TLV.getName(), + null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout())); + if (GET_TYPE_OPER_OBSERVE.equals(typeOper)) { + lwM2MClient.initValue(this, null); } } @@ -796,9 +786,9 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { if (lwM2mClientContext.addUpdateProfileParameters(deviceProfile)) { // #1 JsonArray attributeOld = lwM2MClientProfileOld.getPostAttributeProfile(); - Set attributeSetOld = this.convertJsonArrayToSet (attributeOld); + Set attributeSetOld = this.convertJsonArrayToSet (attributeOld); JsonArray telemetryOld = lwM2MClientProfileOld.getPostTelemetryProfile(); - Set telemetrySetOld = this.convertJsonArrayToSet (telemetryOld); + Set telemetrySetOld = this.convertJsonArrayToSet (telemetryOld); JsonArray observeOld = lwM2MClientProfileOld.getPostObserveProfile(); JsonObject keyNameOld = lwM2MClientProfileOld.getPostKeyNameProfile(); @@ -806,7 +796,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { JsonArray attributeNew = lwM2MClientProfileNew.getPostAttributeProfile(); Set attributeSetNew = this.convertJsonArrayToSet (attributeNew); JsonArray telemetryNew = lwM2MClientProfileNew.getPostTelemetryProfile(); - Set telemetrySetNew = this.convertJsonArrayToSet (telemetryNew); + Set telemetrySetNew = this.convertJsonArrayToSet (telemetryNew); JsonArray observeNew = lwM2MClientProfileNew.getPostObserveProfile(); JsonObject keyNameNew = lwM2MClientProfileNew.getPostKeyNameProfile(); @@ -1036,7 +1026,7 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { private SessionInfoProto getNewSessionInfoProto(LwM2mClient lwM2MClient) { if (lwM2MClient != null) { TransportProtos.ValidateDeviceCredentialsResponseMsg msg = lwM2MClient.getCredentialsResponse(); - if (msg == null || msg.getDeviceInfo() == null) { + if (msg == null) { log.error("[{}] [{}]", lwM2MClient.getEndpoint(), CLIENT_NOT_AUTHORIZED); this.closeClientSession(lwM2MClient.getRegistration()); return null; @@ -1126,9 +1116,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { */ private List getNamesAttrFromProfileIsWritable(LwM2mClient lwM2MClient) { LwM2mClientProfile profile = lwM2mClientContext.getProfile(lwM2MClient.getProfileId()); - Set attrSet = new Gson().fromJson(profile.getPostAttributeProfile(), Set.class); - ConcurrentMap keyNamesMap = new Gson().fromJson(profile.getPostKeyNameProfile().toString(), new TypeToken>() { - }.getType()); + Set attrSet = new Gson().fromJson(profile.getPostAttributeProfile(), new TypeToken<>() {}.getType()); + ConcurrentMap keyNamesMap = new Gson().fromJson(profile.getPostKeyNameProfile().toString(), new TypeToken>() {}.getType()); ConcurrentMap keyNamesIsWritable = keyNamesMap.entrySet() .stream() diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbLwM2mRedisRegistrationStore.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbLwM2mRedisRegistrationStore.java index 6d24ac5ca0..bac4554b04 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbLwM2mRedisRegistrationStore.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbLwM2mRedisRegistrationStore.java @@ -21,9 +21,9 @@ import org.eclipse.californium.elements.EndpointContext; import org.eclipse.leshan.core.observation.Observation; import org.eclipse.leshan.core.util.NamedThreadFactory; import org.eclipse.leshan.core.util.Validate; -import org.eclipse.leshan.server.Destroyable; -import org.eclipse.leshan.server.Startable; -import org.eclipse.leshan.server.Stoppable; +import org.eclipse.leshan.core.Destroyable; +import org.eclipse.leshan.core.Startable; +import org.eclipse.leshan.core.Stoppable; import org.eclipse.leshan.server.californium.observation.ObserveUtil; import org.eclipse.leshan.server.californium.registration.CaliforniumRegistrationStore; import org.eclipse.leshan.server.redis.JedisLock; @@ -278,8 +278,8 @@ public class TbLwM2mRedisRegistrationStore implements CaliforniumRegistrationSto protected class RedisIterator implements Iterator { - private RedisConnectionFactory connectionFactory; - private ScanParams scanParams; + private final RedisConnectionFactory connectionFactory; + private final ScanParams scanParams; private String cursor; private List scanResult; @@ -552,17 +552,16 @@ public class TbLwM2mRedisRegistrationStore implements CaliforniumRegistrationSto @Override public org.eclipse.californium.core.observe.Observation putIfAbsent(Token token, org.eclipse.californium.core.observe.Observation obs) throws ObservationStoreException { - return add(token, obs, true); + return add(obs, true); } @Override public org.eclipse.californium.core.observe.Observation put(Token token, org.eclipse.californium.core.observe.Observation obs) throws ObservationStoreException { - return add(token, obs, false); + return add(obs, false); } - private org.eclipse.californium.core.observe.Observation add(Token token, - org.eclipse.californium.core.observe.Observation obs, boolean ifAbsent) throws ObservationStoreException { + private org.eclipse.californium.core.observe.Observation add(org.eclipse.californium.core.observe.Observation obs, boolean ifAbsent) throws ObservationStoreException { String endpoint = ObserveUtil.validateCoapObservation(obs); org.eclipse.californium.core.observe.Observation previousObservation = null; @@ -577,7 +576,7 @@ public class TbLwM2mRedisRegistrationStore implements CaliforniumRegistrationSto throw new ObservationStoreException("no registration for this Id"); byte[] key = toKey(OBS_TKN, obs.getRequest().getToken().getBytes()); byte[] serializeObs = serializeObs(obs); - byte[] previousValue = null; + byte[] previousValue; if (ifAbsent) { previousValue = j.get(key); if (previousValue == null || previousValue.length == 0) { diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 4368aad588..676593804e 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 7d6be1f5ae..96865036d5 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 5f5bcccc62..491adc189e 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index 8999c3ddb7..6f66da5790 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT common org.thingsboard.common diff --git a/common/util/src/main/java/org/thingsboard/common/util/JacksonUtil.java b/common/util/src/main/java/org/thingsboard/common/util/JacksonUtil.java index b48030f714..8d498fa853 100644 --- a/common/util/src/main/java/org/thingsboard/common/util/JacksonUtil.java +++ b/common/util/src/main/java/org/thingsboard/common/util/JacksonUtil.java @@ -57,6 +57,15 @@ public class JacksonUtil { } } + public static T fromString(String string, TypeReference valueTypeRef) { + try { + return string != null ? OBJECT_MAPPER.readValue(string, valueTypeRef) : null; + } catch (IOException e) { + throw new IllegalArgumentException("The given string value: " + + string + " cannot be transformed to Json object", e); + } + } + public static String toString(Object value) { try { return value != null ? OBJECT_MAPPER.writeValueAsString(value) : null; diff --git a/dao/pom.xml b/dao/pom.xml index aea4ed0af7..e1a08cb74d 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard dao diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index cefbdf140b..9af00d44c7 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/js-executor/package.json b/msa/js-executor/package.json index 77dcb5992f..75f009880b 100644 --- a/msa/js-executor/package.json +++ b/msa/js-executor/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-js-executor", "private": true, - "version": "3.2.2", + "version": "3.3.0", "description": "ThingsBoard JavaScript Executor Microservice", "main": "server.js", "bin": "server.js", diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 769cbf6d36..a254b1acde 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/pom.xml b/msa/pom.xml index f15738fb74..3d7bf3f347 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index df1988c3a0..133b81c79d 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index d35762163c..efb9a709e9 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 890e8b91e8..1285cca0ce 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index cc85b507a9..da0688b545 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index c7352d9821..782b6a228a 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index 37ce157c41..84906e42db 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/msa/web-ui/package.json b/msa/web-ui/package.json index 1725a7c3c2..3897c31f5e 100644 --- a/msa/web-ui/package.json +++ b/msa/web-ui/package.json @@ -1,7 +1,7 @@ { "name": "thingsboard-web-ui", "private": true, - "version": "3.2.2", + "version": "3.3.0", "description": "ThingsBoard Web UI Microservice", "main": "server.js", "bin": "server.js", diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index 93c7f24e21..85f5db6ce3 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index f956f6f09a..742aa039be 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard netty-mqtt - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index aab4726de1..7e12adff98 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index b8373b351f..e45db432d8 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index 3709498312..d4af78f871 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index fe44acac1f..bb348793c1 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index f435277fcc..31c0c1d824 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index bb0435d434..c7fcf277ea 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index c979a2d2e1..1ede01a491 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index b91c5d9dd0..41ca5683a1 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index b9c651d9c6..28aaeeab39 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index e45116a8e6..794abceddc 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard transport diff --git a/ui-ngx/package.json b/ui-ngx/package.json index a0da1f210b..775a685ae8 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -1,6 +1,6 @@ { "name": "thingsboard", - "version": "3.2.2", + "version": "3.3.0", "scripts": { "ng": "ng", "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --host 0.0.0.0 --open", diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index f06442db25..fb8c809260 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 3.2.2-SNAPSHOT + 3.3.0-SNAPSHOT thingsboard org.thingsboard From 03b647c525542c8553d6f39dcc434146eaf70de1 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Thu, 4 Mar 2021 17:19:07 +0200 Subject: [PATCH 55/69] Lwm2m: front: validateObject on the start fix bug --- ...ice-profile-transport-configuration.component.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts index 2fa7c1cb9a..519ecc2981 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.ts @@ -219,9 +219,9 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro this.updateObserveAttrTelemetryObjects(telemetryArray, clientObserveAttrTelemetry, TELEMETRY); } if (isDefinedAndNotNull(keyNameJson)) { - this.configurationValue.observeAttr.keyName = deepClone(this.validateKeyNameObjects(keyNameJson, attributeArray, telemetryArray)); - keyNameJson = this.configurationValue.observeAttr.keyName; - this.updateKeyNameObjects(keyNameJson, clientObserveAttrTelemetry); + this.configurationValue.observeAttr.keyName = this.validateKeyNameObjects(keyNameJson, attributeArray, telemetryArray); + this.upDateJsonAllConfig(); + this.updateKeyNameObjects(clientObserveAttrTelemetry); } } return {clientLwM2M: clientObserveAttrTelemetry}; @@ -260,14 +260,13 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro }); } - private updateKeyNameObjects = (nameJson: JsonObject, clientObserveAttrTelemetry: ObjectLwM2M[]): void => { - const keyName = JSON.parse(JSON.stringify(nameJson)); - Object.keys(keyName).forEach(key => { + private updateKeyNameObjects = (clientObserveAttrTelemetry: ObjectLwM2M[]): void => { + Object.keys(this.configurationValue.observeAttr.keyName).forEach(key => { const [objectId, instanceId, resourceId] = Array.from(key.substring(1).split('/'), Number); clientObserveAttrTelemetry.find(objectLwm2m => objectLwm2m.id === objectId) .instances.find(instance => instance.id === instanceId) .resources.find(resource => resource.id === resourceId) - .keyName = keyName[key]; + .keyName = this.configurationValue.observeAttr.keyName[key]; }); } From 6438f6b0eee75fd9216c36532ed8ab1a4407ae97 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Thu, 4 Mar 2021 18:32:28 +0200 Subject: [PATCH 56/69] added resource dao --- .../server/controller/ResourceController.java | 82 +++++++++++++++++ .../install/ThingsboardInstallService.java | 7 ++ .../DefaultSystemDataLoaderService.java | 5 ++ .../service/install/InstallScripts.java | 44 +++++++++ .../install/SqlDatabaseUpgradeService.java | 19 ++++ .../install/SystemDataLoaderService.java | 2 + .../server/dao/resource/ResourceService.java | 33 +++++++ .../data/transport/resource/Resource.java | 37 ++++++++ .../data/transport/resource/ResourceType.java | 20 +++++ .../server/dao/model/ModelConstants.java | 9 ++ .../dao/model/sql/ResourceCompositeKey.java | 45 ++++++++++ .../server/dao/model/sql/ResourceEntity.java | 77 ++++++++++++++++ .../dao/resource/BaseResourceService.java | 90 +++++++++++++++++++ .../server/dao/resource/ResourceDao.java | 33 +++++++ .../dao/sql/resource/ResourceDaoImpl.java | 73 +++++++++++++++ .../dao/sql/resource/ResourceRepository.java | 28 ++++++ .../main/resources/sql/schema-entities.sql | 8 ++ 17 files changed, 612 insertions(+) create mode 100644 application/src/main/java/org/thingsboard/server/controller/ResourceController.java create mode 100644 common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java diff --git a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java new file mode 100644 index 0000000000..b09e4e23b2 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java @@ -0,0 +1,82 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.resource.ResourceService; +import org.thingsboard.server.queue.util.TbCoreComponent; + +import java.util.List; + +@Slf4j +@RestController +@TbCoreComponent +@RequestMapping("/api") +public class ResourceController extends BaseController { + + private final ResourceService resourceService; + + public ResourceController(ResourceService resourceService) { + this.resourceService = resourceService; + } + + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource", method = RequestMethod.POST) + @ResponseBody + public Resource saveResource(Resource resource) throws ThingsboardException { + try { + resource.setTenantId(getCurrentUser().getTenantId()); + return checkNotNull(resourceService.saveResource(resource)); + } catch (Exception e) { + throw handleException(e); + } + } + + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource", method = RequestMethod.GET) + @ResponseBody + public List getResources(@RequestParam(required = false) boolean system) throws ThingsboardException { + try { + return checkNotNull(resourceService.findByTenantId(system ? TenantId.SYS_TENANT_ID : getCurrentUser().getTenantId())); + } catch (Exception e) { + throw handleException(e); + } + } + + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource/{resourceType}/{resourceId}", method = RequestMethod.DELETE) + @ResponseBody + public boolean deleteResource(@PathVariable("resourceType") ResourceType resourceType, + @PathVariable("resourceId") String resourceId) throws ThingsboardException { + try { + return resourceService.deleteResource(getCurrentUser().getTenantId(), resourceType, resourceId); + } catch (Exception e) { + throw handleException(e); + } + } + +} diff --git a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java index 8b4a5b77a3..63eea2a7fc 100644 --- a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java +++ b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java @@ -194,6 +194,12 @@ public class ThingsboardInstallService { log.info("Updating system data..."); systemDataLoaderService.updateSystemWidgets(); break; + case "3.2.2": + log.info("Upgrading ThingsBoard from version 3.2.2 to 3.3.0 ..."); + databaseEntitiesUpgradeService.upgradeDatabase("3.2.2"); + + log.info("Updating system data..."); + break; default: throw new RuntimeException("Unable to upgrade ThingsBoard, unsupported fromVersion: " + upgradeFromVersion); @@ -226,6 +232,7 @@ public class ThingsboardInstallService { systemDataLoaderService.createAdminSettings(); systemDataLoaderService.loadSystemWidgets(); systemDataLoaderService.createOAuth2Templates(); + systemDataLoaderService.loadSystemLwm2mResources(); // systemDataLoaderService.loadSystemPlugins(); // systemDataLoaderService.loadSystemRules(); diff --git a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java index 9028fe279e..6f257a367e 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java @@ -445,6 +445,11 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { installScripts.loadSystemWidgets(); } + @Override + public void loadSystemLwm2mResources() throws Exception { + installScripts.loadSystemLwm2mResources(); + } + private User createUser(Authority authority, TenantId tenantId, CustomerId customerId, diff --git a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java index 47f8529c11..5029a520e3 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java +++ b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java @@ -29,10 +29,13 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationTemplate; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; import org.thingsboard.server.common.data.widget.WidgetType; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.dao.dashboard.DashboardService; import org.thingsboard.server.dao.oauth2.OAuth2ConfigTemplateService; +import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.dao.rule.RuleChainService; import org.thingsboard.server.dao.widget.WidgetTypeService; import org.thingsboard.server.dao.widget.WidgetsBundleService; @@ -42,6 +45,7 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Base64; import java.util.Optional; import static org.thingsboard.server.service.install.DatabaseHelper.objectMapper; @@ -66,8 +70,11 @@ public class InstallScripts { public static final String WIDGET_BUNDLES_DIR = "widget_bundles"; public static final String OAUTH2_CONFIG_TEMPLATES_DIR = "oauth2_config_templates"; public static final String DASHBOARDS_DIR = "dashboards"; + public static final String MODELS_DIR = "models"; + public static final String CREDENTIALS_DIR = "credentials"; public static final String JSON_EXT = ".json"; + public static final String XML_EXT = ".xml"; @Value("${install.data_dir:}") private String dataDir; @@ -87,6 +94,9 @@ public class InstallScripts { @Autowired private OAuth2ConfigTemplateService oAuth2TemplateService; + @Autowired + private ResourceService resourceService; + public Path getTenantRuleChainsDir() { return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, RULE_CHAINS_DIR); } @@ -186,6 +196,40 @@ public class InstallScripts { } } + public void loadSystemLwm2mResources() throws Exception { + Path modelsDir = Paths.get(getDataDir(), MODELS_DIR); + try (DirectoryStream dirStream = Files.newDirectoryStream(modelsDir, path -> path.toString().endsWith(XML_EXT))) { + dirStream.forEach( + path -> { + try { + Resource resource = new Resource(); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceType(ResourceType.LWM2M_MODEL); + resource.setResourceId(path.getFileName().toString()); + resource.setValue(Files.readString(path)); + resourceService.saveResource(resource); + } catch (Exception e) { + log.error("Unable to load lwm2m model [{}]", path.toString()); + throw new RuntimeException("Unable to load lwm2m model", e); + } + } + ); + } + + Path jksPath = Paths.get(getDataDir(), CREDENTIALS_DIR, "serverKeyStore.jks"); + try { + Resource resource = new Resource(); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceType(ResourceType.LWM2M_KEY_STORE); + resource.setResourceId(jksPath.getFileName().toString()); + resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(jksPath))); + resourceService.saveResource(resource); + } catch (Exception e) { + log.error("Unable to load lwm2m serverKeyStore [{}]", jksPath.toString()); + throw new RuntimeException("Unable to load l2m2m serverKeyStore", e); + } + } + public void loadDashboards(TenantId tenantId, CustomerId customerId) throws Exception { Path dashboardsDir = Paths.get(getDataDir(), JSON_DIR, DEMO_DIR, DASHBOARDS_DIR); try (DirectoryStream dirStream = Files.newDirectoryStream(dashboardsDir, path -> path.toString().endsWith(JSON_EXT))) { diff --git a/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java b/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java index c3495d960b..a56cc7ca25 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java @@ -434,6 +434,25 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService log.info("Schema updated."); } break; + case "3.2.2": + try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { + log.info("Updating schema ..."); + try { + conn.createStatement().execute("CREATE TABLE IF NOT EXISTS resource (" + + " tenant_id uuid NOT NULL," + + " resource_type varchar(32) NOT NULL," + + " resource_id varchar(255) NOT NULL," + + " resource_value varchar," + + " CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id)" + + " );"); + + conn.createStatement().execute("UPDATE tb_schema_settings SET schema_version = 3003000;"); + } catch (Exception e) { + log.error("Failed updating schema!!!", e); + } + log.info("Schema updated."); + } + break; default: throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); } diff --git a/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java index 73e2b6ea57..a6f33f476f 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java @@ -33,4 +33,6 @@ public interface SystemDataLoaderService { void deleteSystemWidgetBundle(String bundleAlias) throws Exception; + void loadSystemLwm2mResources() throws Exception; + } diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java new file mode 100644 index 0000000000..99cf1ef87b --- /dev/null +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java @@ -0,0 +1,33 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.resource; + +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; + +import java.util.List; + + +public interface ResourceService { + Resource saveResource(Resource resource); + + Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + List findByTenantId(TenantId tenantId); +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java new file mode 100644 index 0000000000..c29b704b04 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java @@ -0,0 +1,37 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.transport.resource; + +import lombok.Data; +import org.thingsboard.server.common.data.HasTenantId; +import org.thingsboard.server.common.data.id.TenantId; + +@Data +public class Resource implements HasTenantId { + private TenantId tenantId; + private ResourceType resourceType; + private String resourceId; + private String value; + + @Override + public String toString() { + return "Resource{" + + "tenantId=" + tenantId + + ", resourceType=" + resourceType + + ", resourceId='" + resourceId + '\'' + + '}'; + } +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java new file mode 100644 index 0000000000..2e12bbdda2 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java @@ -0,0 +1,20 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.transport.resource; + +public enum ResourceType { + LWM2M_MODEL, LWM2M_KEY_STORE +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java index fc6a2bed25..3f11a4ed00 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java @@ -453,6 +453,15 @@ public class ModelConstants { public static final String API_USAGE_STATE_EMAIL_EXEC_COLUMN = "email_exec"; public static final String API_USAGE_STATE_SMS_EXEC_COLUMN = "sms_exec"; + /** + * Resource constants. + */ + public static final String RESOURCE_TABLE_NAME = "resource"; + public static final String RESOURCE_TENANT_ID_COLUMN = TENANT_ID_COLUMN; + public static final String RESOURCE_TYPE_COLUMN = "resource_type"; + public static final String RESOURCE_ID_COLUMN = "resource_id"; + public static final String RESOURCE_VALUE_COLUMN = "resource_value"; + /** * Cassandra attributes and timeseries constants. */ diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java new file mode 100644 index 0000000000..828f1f4341 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java @@ -0,0 +1,45 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.model.sql; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.server.common.data.relation.EntityRelation; +import org.thingsboard.server.common.data.transport.resource.Resource; + +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.UUID; + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class ResourceCompositeKey implements Serializable { + + @Transient + private static final long serialVersionUID = -3789469030818742769L; + + private UUID tenantId; + private String resourceType; + private String resourceId; + + public ResourceCompositeKey(Resource resource) { + this.tenantId = resource.getTenantId().getId(); + this.resourceType = resource.getResourceType().name(); + this.resourceId = resource.getResourceId(); + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java new file mode 100644 index 0000000000..a877afa027 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java @@ -0,0 +1,77 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.model.sql; + +import lombok.Data; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.model.ToData; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.Table; +import java.util.UUID; + +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_ID_COLUMN; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TABLE_NAME; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TENANT_ID_COLUMN; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TYPE_COLUMN; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_VALUE_COLUMN; + +@Data +@Entity +@Table(name = RESOURCE_TABLE_NAME) +@IdClass(ResourceCompositeKey.class) +public class ResourceEntity implements ToData { + + @Id + @Column(name = RESOURCE_TENANT_ID_COLUMN, columnDefinition = "uuid") + private UUID tenantId; + + @Id + @Column(name = RESOURCE_TYPE_COLUMN) + private String resourceType; + + @Id + @Column(name = RESOURCE_ID_COLUMN) + private String resourceId; + + @Column(name = RESOURCE_VALUE_COLUMN) + private String value; + + public ResourceEntity() { + } + + public ResourceEntity(Resource resource) { + this.tenantId = resource.getTenantId().getId(); + this.resourceType = resource.getResourceType().name(); + this.resourceId = resource.getResourceId(); + this.value = resource.getValue(); + } + + @Override + public Resource toData() { + Resource resource = new Resource(); + resource.setTenantId(new TenantId(tenantId)); + resource.setResourceType(ResourceType.valueOf(resourceType)); + resource.setResourceId(resourceId); + resource.setValue(value); + return resource; + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java new file mode 100644 index 0000000000..84ce22eef1 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java @@ -0,0 +1,90 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.resource; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.exception.DataValidationException; + +import java.util.List; + +@Service +@Slf4j +public class BaseResourceService implements ResourceService { + + private final ResourceDao resourceDao; + + public BaseResourceService(ResourceDao resourceDao) { + this.resourceDao = resourceDao; + } + + @Override + public Resource saveResource(Resource resource) { + log.trace("Executing saveResource [{}]", resource); + validate(resource); + return resourceDao.saveResource(resource); + } + + @Override + public Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + log.trace("Executing getResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); + validate(tenantId, resourceType, resourceId); + return resourceDao.getResource(tenantId, resourceType, resourceId); + } + + @Override + public boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + log.trace("Executing deleteResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); + validate(tenantId, resourceType, resourceId); + return resourceDao.deleteResource(tenantId, resourceType, resourceId); + } + + @Override + public List findByTenantId(TenantId tenantId) { + log.trace("Executing findByTenantId [{}]", tenantId); + return resourceDao.findAllByTenantId(tenantId); + } + + protected void validate(Resource resource) { + if (resource == null) { + throw new DataValidationException("Resource should be specified!"); + } + + if (resource.getValue() == null) { + throw new DataValidationException("Resource value should be specified!"); + } + validate(resource.getTenantId(), resource.getResourceType(), resource.getResourceId()); + } + + protected void validate(TenantId tenantId, ResourceType resourceType, String resourceId) { + if (resourceType == null) { + throw new DataValidationException("Resource type should be specified!"); + } + if (resourceId == null) { + throw new DataValidationException("Resource id should be specified!"); + } + validate(tenantId); + } + + protected void validate(TenantId tenantId) { + if (tenantId == null) { + throw new DataValidationException("Tenant id should be specified!"); + } + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java new file mode 100644 index 0000000000..f722423412 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java @@ -0,0 +1,33 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.resource; + +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; + +import java.util.List; + +public interface ResourceDao { + + Resource saveResource(Resource resource); + + Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + List findAllByTenantId(TenantId tenantId); +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java new file mode 100644 index 0000000000..b11c14546a --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java @@ -0,0 +1,73 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.sql.resource; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.DaoUtil; +import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; +import org.thingsboard.server.dao.model.sql.ResourceEntity; +import org.thingsboard.server.dao.resource.ResourceDao; + +import java.util.List; + +@Slf4j +@Component +public class ResourceDaoImpl implements ResourceDao { + + private final ResourceRepository resourceRepository; + + public ResourceDaoImpl(ResourceRepository resourceRepository) { + this.resourceRepository = resourceRepository; + } + + @Override + @Transactional + public Resource saveResource(Resource resource) { + return DaoUtil.getData(resourceRepository.save(new ResourceEntity(resource))); + } + + @Override + public Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceCompositeKey key = new ResourceCompositeKey(); + key.setTenantId(tenantId.getId()); + key.setResourceType(resourceType.name()); + key.setResourceId(resourceId); + + return DaoUtil.getData(resourceRepository.findById(key)); + } + + @Override + @Transactional + public boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceCompositeKey key = new ResourceCompositeKey(); + key.setTenantId(tenantId.getId()); + key.setResourceType(resourceType.name()); + key.setResourceId(resourceId); + + resourceRepository.deleteById(key); + return resourceRepository.existsById(key); + } + + @Override + public List findAllByTenantId(TenantId tenantId) { + return DaoUtil.convertDataList(resourceRepository.findAllByTenantId(tenantId)); + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java new file mode 100644 index 0000000000..d2d92b8b55 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java @@ -0,0 +1,28 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.sql.resource; + +import org.springframework.data.repository.CrudRepository; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; +import org.thingsboard.server.dao.model.sql.ResourceEntity; + +import java.util.List; + +public interface ResourceRepository extends CrudRepository { + + List findAllByTenantId(TenantId tenantId); +} diff --git a/dao/src/main/resources/sql/schema-entities.sql b/dao/src/main/resources/sql/schema-entities.sql index 72e00ae85a..3bf5ce29c8 100644 --- a/dao/src/main/resources/sql/schema-entities.sql +++ b/dao/src/main/resources/sql/schema-entities.sql @@ -447,6 +447,14 @@ CREATE TABLE IF NOT EXISTS api_usage_state ( CONSTRAINT api_usage_state_unq_key UNIQUE (tenant_id, entity_id) ); +CREATE TABLE IF NOT EXISTS resource ( + tenant_id uuid NOT NULL, + resource_type varchar(32) NOT NULL, + resource_id varchar(255) NOT NULL, + resource_value varchar, + CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id) +); + CREATE OR REPLACE PROCEDURE cleanup_events_by_ttl(IN ttl bigint, IN debug_ttl bigint, INOUT deleted bigint) LANGUAGE plpgsql AS $$ From 3f4714c2ce64647d0e683c328dc5d591234774f5 Mon Sep 17 00:00:00 2001 From: nickAS21 <44275303+nickAS21@users.noreply.github.com> Date: Fri, 5 Mar 2021 17:40:13 +0200 Subject: [PATCH 57/69] Lwm2m strategy (#4210) * Lwm2m: back: two strategy * Lwm2m: back: add new models * Lwm2m: back: del new models --- .../lwm2m/server/LwM2mTransportHandler.java | 7 +- .../server/LwM2mTransportServiceImpl.java | 35 +- .../lwm2m/src/main/resources/models/10241.xml | 81 -- .../lwm2m/src/main/resources/models/10242.xml | 659 ---------------- .../lwm2m/src/main/resources/models/10243.xml | 263 ------- .../lwm2m/src/main/resources/models/10244.xml | 301 -------- .../lwm2m/src/main/resources/models/10245.xml | 217 ------ .../lwm2m/src/main/resources/models/10246.xml | 108 --- .../lwm2m/src/main/resources/models/10247.xml | 98 --- .../lwm2m/src/main/resources/models/10248.xml | 78 -- .../lwm2m/src/main/resources/models/10249.xml | 138 ---- .../lwm2m/src/main/resources/models/10250.xml | 70 -- .../lwm2m/src/main/resources/models/10251.xml | 96 --- .../lwm2m/src/main/resources/models/10252.xml | 229 ------ .../lwm2m/src/main/resources/models/10253.xml | 72 -- .../lwm2m/src/main/resources/models/10254.xml | 119 --- .../lwm2m/src/main/resources/models/10255.xml | 165 ---- .../lwm2m/src/main/resources/models/10256.xml | 117 --- .../lwm2m/src/main/resources/models/10257.xml | 275 ------- .../lwm2m/src/main/resources/models/10258.xml | 89 --- .../lwm2m/src/main/resources/models/10259.xml | 115 --- .../src/main/resources/models/10260-2_0.xml | 95 --- .../lwm2m/src/main/resources/models/10262.xml | 87 --- .../lwm2m/src/main/resources/models/10263.xml | 90 --- .../lwm2m/src/main/resources/models/10264.xml | 117 --- .../lwm2m/src/main/resources/models/10265.xml | 136 ---- .../lwm2m/src/main/resources/models/10266.xml | 244 ------ .../lwm2m/src/main/resources/models/10267.xml | 244 ------ .../lwm2m/src/main/resources/models/10268.xml | 244 ------ .../lwm2m/src/main/resources/models/10269.xml | 244 ------ .../lwm2m/src/main/resources/models/10270.xml | 244 ------ .../lwm2m/src/main/resources/models/10271.xml | 244 ------ .../lwm2m/src/main/resources/models/10272.xml | 230 ------ .../lwm2m/src/main/resources/models/10273.xml | 230 ------ .../lwm2m/src/main/resources/models/10274.xml | 230 ------ .../lwm2m/src/main/resources/models/10275.xml | 230 ------ .../lwm2m/src/main/resources/models/10276.xml | 230 ------ .../lwm2m/src/main/resources/models/10277.xml | 230 ------ .../lwm2m/src/main/resources/models/10278.xml | 230 ------ .../lwm2m/src/main/resources/models/10279.xml | 230 ------ .../lwm2m/src/main/resources/models/10280.xml | 230 ------ .../lwm2m/src/main/resources/models/10281.xml | 230 ------ .../lwm2m/src/main/resources/models/10282.xml | 230 ------ .../lwm2m/src/main/resources/models/10283.xml | 230 ------ .../lwm2m/src/main/resources/models/10284.xml | 230 ------ .../lwm2m/src/main/resources/models/10286.xml | 48 -- .../lwm2m/src/main/resources/models/10290.xml | 198 ----- .../lwm2m/src/main/resources/models/10291.xml | 208 ----- .../lwm2m/src/main/resources/models/10292.xml | 208 ----- .../lwm2m/src/main/resources/models/10299.xml | 113 --- .../lwm2m/src/main/resources/models/10300.xml | 142 ---- .../src/main/resources/models/10308-2_0.xml | 145 ---- .../lwm2m/src/main/resources/models/10309.xml | 115 --- .../lwm2m/src/main/resources/models/10311.xml | 164 ---- .../lwm2m/src/main/resources/models/10313.xml | 253 ------ .../lwm2m/src/main/resources/models/10314.xml | 106 --- .../lwm2m/src/main/resources/models/10315.xml | 129 ---- .../lwm2m/src/main/resources/models/10316.xml | 233 ------ .../lwm2m/src/main/resources/models/10318.xml | 189 ----- .../lwm2m/src/main/resources/models/10319.xml | 130 ---- .../lwm2m/src/main/resources/models/10320.xml | 141 ---- .../lwm2m/src/main/resources/models/10322.xml | 87 --- .../lwm2m/src/main/resources/models/10323.xml | 90 --- .../lwm2m/src/main/resources/models/10324.xml | 77 -- .../lwm2m/src/main/resources/models/10326.xml | 722 ------------------ .../lwm2m/src/main/resources/models/10327.xml | 68 -- .../lwm2m/src/main/resources/models/10328.xml | 80 -- .../lwm2m/src/main/resources/models/10329.xml | 433 ----------- .../lwm2m/src/main/resources/models/10330.xml | 120 --- .../lwm2m/src/main/resources/models/10331.xml | 221 ------ .../lwm2m/src/main/resources/models/10332.xml | 69 -- .../lwm2m/src/main/resources/models/10333.xml | 88 --- .../lwm2m/src/main/resources/models/10334.xml | 129 ---- .../lwm2m/src/main/resources/models/10335.xml | 97 --- .../lwm2m/src/main/resources/models/10336.xml | 84 -- .../lwm2m/src/main/resources/models/10337.xml | 118 --- .../lwm2m/src/main/resources/models/10338.xml | 124 --- .../lwm2m/src/main/resources/models/10339.xml | 114 --- .../lwm2m/src/main/resources/models/10340.xml | 218 ------ .../lwm2m/src/main/resources/models/10341.xml | 84 -- .../lwm2m/src/main/resources/models/10342.xml | 84 -- .../lwm2m/src/main/resources/models/10343.xml | 96 --- .../lwm2m/src/main/resources/models/10344.xml | 96 --- .../lwm2m/src/main/resources/models/10345.xml | 96 --- .../lwm2m/src/main/resources/models/10346.xml | 96 --- .../lwm2m/src/main/resources/models/10347.xml | 154 ---- .../lwm2m/src/main/resources/models/10348.xml | 96 --- .../lwm2m/src/main/resources/models/10349.xml | 84 -- .../lwm2m/src/main/resources/models/10350.xml | 116 --- .../lwm2m/src/main/resources/models/10351.xml | 79 -- .../lwm2m/src/main/resources/models/10352.xml | 114 --- .../lwm2m/src/main/resources/models/10353.xml | 87 --- .../lwm2m/src/main/resources/models/10354.xml | 217 ------ .../lwm2m/src/main/resources/models/10355.xml | 95 --- .../lwm2m/src/main/resources/models/10356.xml | 203 ----- .../lwm2m/src/main/resources/models/10357.xml | 95 --- .../lwm2m/src/main/resources/models/10358.xml | 70 -- .../lwm2m/src/main/resources/models/10359.xml | 78 -- .../lwm2m/src/main/resources/models/10360.xml | 70 -- .../lwm2m/src/main/resources/models/10361.xml | 92 --- .../lwm2m/src/main/resources/models/10362.xml | 91 --- .../lwm2m/src/main/resources/models/10363.xml | 57 -- .../lwm2m/src/main/resources/models/10364.xml | 57 -- .../lwm2m/src/main/resources/models/10365.xml | 57 -- .../lwm2m/src/main/resources/models/10366.xml | 59 -- .../lwm2m/src/main/resources/models/10368.xml | 96 --- .../lwm2m/src/main/resources/models/10369.xml | 84 -- .../lwm2m/src/main/resources/models/2048.xml | 90 --- .../lwm2m/src/main/resources/models/2049.xml | 59 -- .../lwm2m/src/main/resources/models/2050.xml | 64 -- .../lwm2m/src/main/resources/models/2051.xml | 99 --- .../lwm2m/src/main/resources/models/2052.xml | 111 --- .../lwm2m/src/main/resources/models/2053.xml | 165 ---- .../lwm2m/src/main/resources/models/2054.xml | 69 -- .../lwm2m/src/main/resources/models/2055.xml | 100 --- .../lwm2m/src/main/resources/models/2056.xml | 77 -- .../lwm2m/src/main/resources/models/2057.xml | 92 --- .../lwm2m/src/main/resources/models/31024.xml | 51 -- .../lwm2m/src/main/resources/models/3200.xml | 129 ---- .../lwm2m/src/main/resources/models/3201.xml | 78 -- .../lwm2m/src/main/resources/models/3202.xml | 128 ---- .../lwm2m/src/main/resources/models/3203.xml | 88 --- .../lwm2m/src/main/resources/models/3300.xml | 138 ---- .../lwm2m/src/main/resources/models/3301.xml | 118 --- .../lwm2m/src/main/resources/models/3302.xml | 108 --- .../lwm2m/src/main/resources/models/3303.xml | 118 --- .../lwm2m/src/main/resources/models/3304.xml | 118 --- .../lwm2m/src/main/resources/models/3305.xml | 228 ------ .../lwm2m/src/main/resources/models/3306.xml | 98 --- .../lwm2m/src/main/resources/models/3308.xml | 88 --- .../lwm2m/src/main/resources/models/3310.xml | 108 --- .../lwm2m/src/main/resources/models/3311.xml | 127 --- .../lwm2m/src/main/resources/models/3312.xml | 107 --- .../lwm2m/src/main/resources/models/3313.xml | 107 --- .../lwm2m/src/main/resources/models/3314.xml | 97 --- .../lwm2m/src/main/resources/models/3315.xml | 118 --- .../lwm2m/src/main/resources/models/3316.xml | 139 ---- .../lwm2m/src/main/resources/models/3317.xml | 139 ---- .../lwm2m/src/main/resources/models/3318.xml | 139 ---- .../lwm2m/src/main/resources/models/3319.xml | 139 ---- .../lwm2m/src/main/resources/models/3320.xml | 139 ---- .../lwm2m/src/main/resources/models/3321.xml | 139 ---- .../lwm2m/src/main/resources/models/3322.xml | 139 ---- .../lwm2m/src/main/resources/models/3323.xml | 139 ---- .../lwm2m/src/main/resources/models/3324.xml | 139 ---- .../lwm2m/src/main/resources/models/3325.xml | 139 ---- .../lwm2m/src/main/resources/models/3326.xml | 139 ---- .../lwm2m/src/main/resources/models/3327.xml | 139 ---- .../lwm2m/src/main/resources/models/3328.xml | 139 ---- .../lwm2m/src/main/resources/models/3329.xml | 139 ---- .../lwm2m/src/main/resources/models/3330.xml | 139 ---- .../lwm2m/src/main/resources/models/3331.xml | 89 --- .../lwm2m/src/main/resources/models/3332.xml | 99 --- .../lwm2m/src/main/resources/models/3333.xml | 78 -- .../lwm2m/src/main/resources/models/3334.xml | 189 ----- .../lwm2m/src/main/resources/models/3335.xml | 79 -- .../lwm2m/src/main/resources/models/3336.xml | 119 --- .../lwm2m/src/main/resources/models/3337.xml | 139 ---- .../lwm2m/src/main/resources/models/3338.xml | 99 --- .../lwm2m/src/main/resources/models/3339.xml | 98 --- .../lwm2m/src/main/resources/models/3340.xml | 159 ---- .../lwm2m/src/main/resources/models/3341.xml | 139 ---- .../lwm2m/src/main/resources/models/3342.xml | 98 --- .../lwm2m/src/main/resources/models/3343.xml | 89 --- .../lwm2m/src/main/resources/models/3344.xml | 99 --- .../lwm2m/src/main/resources/models/3345.xml | 109 --- .../lwm2m/src/main/resources/models/3346.xml | 139 ---- .../lwm2m/src/main/resources/models/3347.xml | 79 -- .../lwm2m/src/main/resources/models/3348.xml | 69 -- .../lwm2m/src/main/resources/models/3349.xml | 88 --- .../lwm2m/src/main/resources/models/3350.xml | 88 --- .../lwm2m/src/main/resources/models/3351.xml | 131 ---- .../lwm2m/src/main/resources/models/3352.xml | 124 --- .../lwm2m/src/main/resources/models/3353.xml | 123 --- .../lwm2m/src/main/resources/models/3354.xml | 134 ---- .../lwm2m/src/main/resources/models/3355.xml | 156 ---- .../lwm2m/src/main/resources/models/3356.xml | 120 --- .../lwm2m/src/main/resources/models/3357.xml | 131 ---- .../lwm2m/src/main/resources/models/3358.xml | 106 --- .../lwm2m/src/main/resources/models/3359.xml | 105 --- .../lwm2m/src/main/resources/models/3360.xml | 128 ---- .../lwm2m/src/main/resources/models/3361.xml | 130 ---- .../lwm2m/src/main/resources/models/3362.xml | 97 --- .../lwm2m/src/main/resources/models/3363.xml | 100 --- .../lwm2m/src/main/resources/models/3364.xml | 97 --- .../lwm2m/src/main/resources/models/3365.xml | 123 --- .../lwm2m/src/main/resources/models/3366.xml | 176 ----- .../lwm2m/src/main/resources/models/3367.xml | 138 ---- .../lwm2m/src/main/resources/models/3368.xml | 100 --- .../lwm2m/src/main/resources/models/3369.xml | 105 --- .../lwm2m/src/main/resources/models/3370.xml | 141 ---- .../lwm2m/src/main/resources/models/3371.xml | 141 ---- .../lwm2m/src/main/resources/models/3372.xml | 115 --- .../lwm2m/src/main/resources/models/3373.xml | 115 --- .../lwm2m/src/main/resources/models/3374.xml | 132 ---- .../lwm2m/src/main/resources/models/3375.xml | 150 ---- .../lwm2m/src/main/resources/models/3376.xml | 97 --- .../lwm2m/src/main/resources/models/3377.xml | 168 ---- .../lwm2m/src/main/resources/models/3378.xml | 115 --- .../lwm2m/src/main/resources/models/3379.xml | 123 --- .../src/main/resources/models/3380-2_0.xml | 204 ----- .../lwm2m/src/main/resources/models/3381.xml | 110 --- .../lwm2m/src/main/resources/models/3382.xml | 108 --- .../lwm2m/src/main/resources/models/3383.xml | 99 --- .../lwm2m/src/main/resources/models/3384.xml | 112 --- .../lwm2m/src/main/resources/models/3385.xml | 110 --- .../lwm2m/src/main/resources/models/3386.xml | 105 --- .../LWM2M_APN_Connection_Profile-v1_0_1.xml | 324 -------- .../models/LWM2M_Bearer_Selection-v1_0_1.xml | 211 ----- .../LWM2M_Cellular_Connectivity-v1_0_1.xml | 185 ----- .../models/LWM2M_DevCapMgmt-v1_0.xml | 174 ----- .../models/LWM2M_LOCKWIPE-v1_0_1.xml | 143 ---- .../resources/models/LWM2M_Portfolio-v1_0.xml | 126 --- .../models/LWM2M_Software_Component-v1_0.xml | 139 ---- .../models/LWM2M_Software_Management-v1_0.xml | 279 ------- .../models/LWM2M_WLAN_connectivity4-v1_0.xml | 572 -------------- .../resources/models/LwM2M_EventLog-V1_0.xml | 145 ---- .../lwm2m/src/main/data/models/10241.xml | 98 --- .../lwm2m/src/main/data/models/10242.xml | 647 ---------------- .../lwm2m/src/main/data/models/10243.xml | 251 ------ .../lwm2m/src/main/data/models/10244.xml | 318 -------- .../lwm2m/src/main/data/models/10245.xml | 203 ----- .../lwm2m/src/main/data/models/10246.xml | 93 --- .../lwm2m/src/main/data/models/10247.xml | 83 -- .../lwm2m/src/main/data/models/10248.xml | 63 -- .../lwm2m/src/main/data/models/10249.xml | 123 --- .../lwm2m/src/main/data/models/10250.xml | 87 --- .../lwm2m/src/main/data/models/10251.xml | 83 -- .../lwm2m/src/main/data/models/10252.xml | 168 ---- .../lwm2m/src/main/data/models/10253.xml | 57 -- .../lwm2m/src/main/data/models/10254.xml | 123 --- .../lwm2m/src/main/data/models/10255.xml | 104 --- .../lwm2m/src/main/data/models/10256.xml | 134 ---- .../lwm2m/src/main/data/models/10257.xml | 292 ------- .../lwm2m/src/main/data/models/10258.xml | 93 --- .../lwm2m/src/main/data/models/10259.xml | 100 --- .../lwm2m/src/main/data/models/10260-2_0.xml | 81 -- .../lwm2m/src/main/data/models/10262.xml | 72 -- .../lwm2m/src/main/data/models/10263.xml | 75 -- .../lwm2m/src/main/data/models/10264.xml | 102 --- .../lwm2m/src/main/data/models/10265.xml | 121 --- .../lwm2m/src/main/data/models/10266.xml | 229 ------ .../lwm2m/src/main/data/models/10267.xml | 229 ------ .../lwm2m/src/main/data/models/10268.xml | 229 ------ .../lwm2m/src/main/data/models/10269.xml | 229 ------ .../lwm2m/src/main/data/models/10270.xml | 229 ------ .../lwm2m/src/main/data/models/10271.xml | 229 ------ .../lwm2m/src/main/data/models/10272.xml | 215 ------ .../lwm2m/src/main/data/models/10273.xml | 215 ------ .../lwm2m/src/main/data/models/10274.xml | 215 ------ .../lwm2m/src/main/data/models/10275.xml | 215 ------ .../lwm2m/src/main/data/models/10276.xml | 215 ------ .../lwm2m/src/main/data/models/10277.xml | 215 ------ .../lwm2m/src/main/data/models/10278.xml | 215 ------ .../lwm2m/src/main/data/models/10279.xml | 215 ------ .../lwm2m/src/main/data/models/10280.xml | 215 ------ .../lwm2m/src/main/data/models/10281.xml | 215 ------ .../lwm2m/src/main/data/models/10282.xml | 215 ------ .../lwm2m/src/main/data/models/10283.xml | 215 ------ .../lwm2m/src/main/data/models/10284.xml | 215 ------ .../lwm2m/src/main/data/models/10286.xml | 65 -- .../lwm2m/src/main/data/models/10290.xml | 183 ----- .../lwm2m/src/main/data/models/10291.xml | 193 ----- .../lwm2m/src/main/data/models/10292.xml | 193 ----- .../lwm2m/src/main/data/models/10299.xml | 130 ---- .../lwm2m/src/main/data/models/10300.xml | 142 ---- .../lwm2m/src/main/data/models/10308-2_0.xml | 130 ---- .../lwm2m/src/main/data/models/10309.xml | 114 --- .../lwm2m/src/main/data/models/10311.xml | 149 ---- .../lwm2m/src/main/data/models/10313.xml | 238 ------ .../lwm2m/src/main/data/models/10314.xml | 113 --- .../lwm2m/src/main/data/models/10315.xml | 115 --- .../lwm2m/src/main/data/models/10316.xml | 219 ------ .../lwm2m/src/main/data/models/10318.xml | 175 ----- .../lwm2m/src/main/data/models/10319.xml | 116 --- .../lwm2m/src/main/data/models/10320.xml | 127 --- .../lwm2m/src/main/data/models/10322.xml | 73 -- .../lwm2m/src/main/data/models/10323.xml | 76 -- .../lwm2m/src/main/data/models/10324.xml | 63 -- .../lwm2m/src/main/data/models/10326.xml | 708 ----------------- .../lwm2m/src/main/data/models/10327.xml | 54 -- .../lwm2m/src/main/data/models/10328.xml | 66 -- .../lwm2m/src/main/data/models/10329.xml | 419 ---------- .../lwm2m/src/main/data/models/10330.xml | 106 --- .../lwm2m/src/main/data/models/10331.xml | 207 ----- .../lwm2m/src/main/data/models/10332.xml | 55 -- .../lwm2m/src/main/data/models/10333.xml | 74 -- .../lwm2m/src/main/data/models/10334.xml | 115 --- .../lwm2m/src/main/data/models/10335.xml | 83 -- .../lwm2m/src/main/data/models/10336.xml | 70 -- .../lwm2m/src/main/data/models/10337.xml | 104 --- .../lwm2m/src/main/data/models/10338.xml | 110 --- .../lwm2m/src/main/data/models/10339.xml | 100 --- .../lwm2m/src/main/data/models/10340.xml | 204 ----- .../lwm2m/src/main/data/models/10341.xml | 70 -- .../lwm2m/src/main/data/models/10342.xml | 70 -- .../lwm2m/src/main/data/models/10343.xml | 82 -- .../lwm2m/src/main/data/models/10344.xml | 82 -- .../lwm2m/src/main/data/models/10345.xml | 82 -- .../lwm2m/src/main/data/models/10346.xml | 82 -- .../lwm2m/src/main/data/models/10347.xml | 140 ---- .../lwm2m/src/main/data/models/10348.xml | 82 -- .../lwm2m/src/main/data/models/10349.xml | 70 -- .../lwm2m/src/main/data/models/10350.xml | 102 --- .../lwm2m/src/main/data/models/10351.xml | 65 -- .../lwm2m/src/main/data/models/10352.xml | 100 --- .../lwm2m/src/main/data/models/10353.xml | 73 -- .../lwm2m/src/main/data/models/10354.xml | 203 ----- .../lwm2m/src/main/data/models/10355.xml | 81 -- .../lwm2m/src/main/data/models/10356.xml | 189 ----- .../lwm2m/src/main/data/models/10357.xml | 81 -- .../lwm2m/src/main/data/models/10358.xml | 56 -- .../lwm2m/src/main/data/models/10359.xml | 64 -- .../lwm2m/src/main/data/models/10360.xml | 56 -- .../lwm2m/src/main/data/models/10361.xml | 78 -- .../lwm2m/src/main/data/models/10362.xml | 77 -- .../lwm2m/src/main/data/models/10363.xml | 43 -- .../lwm2m/src/main/data/models/10364.xml | 43 -- .../lwm2m/src/main/data/models/10365.xml | 43 -- .../lwm2m/src/main/data/models/10366.xml | 45 -- .../lwm2m/src/main/data/models/10368.xml | 82 -- .../lwm2m/src/main/data/models/10369.xml | 70 -- transport/lwm2m/src/main/data/models/2048.xml | 75 -- transport/lwm2m/src/main/data/models/2049.xml | 44 -- transport/lwm2m/src/main/data/models/2050.xml | 49 -- transport/lwm2m/src/main/data/models/2051.xml | 84 -- transport/lwm2m/src/main/data/models/2052.xml | 96 --- transport/lwm2m/src/main/data/models/2053.xml | 150 ---- transport/lwm2m/src/main/data/models/2054.xml | 54 -- transport/lwm2m/src/main/data/models/2055.xml | 85 --- transport/lwm2m/src/main/data/models/2056.xml | 62 -- transport/lwm2m/src/main/data/models/2057.xml | 77 -- .../lwm2m/src/main/data/models/31024.xml | 68 -- transport/lwm2m/src/main/data/models/3200.xml | 114 --- transport/lwm2m/src/main/data/models/3201.xml | 63 -- transport/lwm2m/src/main/data/models/3202.xml | 113 --- transport/lwm2m/src/main/data/models/3203.xml | 73 -- transport/lwm2m/src/main/data/models/3300.xml | 123 --- transport/lwm2m/src/main/data/models/3301.xml | 103 --- transport/lwm2m/src/main/data/models/3302.xml | 93 --- transport/lwm2m/src/main/data/models/3303.xml | 103 --- transport/lwm2m/src/main/data/models/3304.xml | 103 --- transport/lwm2m/src/main/data/models/3305.xml | 213 ------ transport/lwm2m/src/main/data/models/3306.xml | 83 -- transport/lwm2m/src/main/data/models/3308.xml | 73 -- transport/lwm2m/src/main/data/models/3310.xml | 93 --- transport/lwm2m/src/main/data/models/3311.xml | 113 --- transport/lwm2m/src/main/data/models/3312.xml | 93 --- transport/lwm2m/src/main/data/models/3313.xml | 93 --- transport/lwm2m/src/main/data/models/3314.xml | 83 -- transport/lwm2m/src/main/data/models/3315.xml | 103 --- transport/lwm2m/src/main/data/models/3316.xml | 124 --- transport/lwm2m/src/main/data/models/3317.xml | 124 --- transport/lwm2m/src/main/data/models/3318.xml | 124 --- transport/lwm2m/src/main/data/models/3319.xml | 124 --- transport/lwm2m/src/main/data/models/3320.xml | 124 --- transport/lwm2m/src/main/data/models/3321.xml | 124 --- transport/lwm2m/src/main/data/models/3322.xml | 124 --- transport/lwm2m/src/main/data/models/3323.xml | 124 --- transport/lwm2m/src/main/data/models/3324.xml | 124 --- transport/lwm2m/src/main/data/models/3325.xml | 124 --- transport/lwm2m/src/main/data/models/3326.xml | 124 --- transport/lwm2m/src/main/data/models/3327.xml | 124 --- transport/lwm2m/src/main/data/models/3328.xml | 124 --- transport/lwm2m/src/main/data/models/3329.xml | 124 --- transport/lwm2m/src/main/data/models/3330.xml | 124 --- transport/lwm2m/src/main/data/models/3331.xml | 74 -- transport/lwm2m/src/main/data/models/3332.xml | 84 -- transport/lwm2m/src/main/data/models/3333.xml | 64 -- transport/lwm2m/src/main/data/models/3334.xml | 174 ----- transport/lwm2m/src/main/data/models/3335.xml | 64 -- transport/lwm2m/src/main/data/models/3336.xml | 104 --- transport/lwm2m/src/main/data/models/3337.xml | 124 --- transport/lwm2m/src/main/data/models/3338.xml | 84 -- transport/lwm2m/src/main/data/models/3339.xml | 83 -- transport/lwm2m/src/main/data/models/3340.xml | 144 ---- transport/lwm2m/src/main/data/models/3341.xml | 124 --- transport/lwm2m/src/main/data/models/3342.xml | 83 -- transport/lwm2m/src/main/data/models/3343.xml | 74 -- transport/lwm2m/src/main/data/models/3344.xml | 84 -- transport/lwm2m/src/main/data/models/3345.xml | 94 --- transport/lwm2m/src/main/data/models/3346.xml | 124 --- transport/lwm2m/src/main/data/models/3347.xml | 64 -- transport/lwm2m/src/main/data/models/3348.xml | 54 -- transport/lwm2m/src/main/data/models/3349.xml | 73 -- transport/lwm2m/src/main/data/models/3350.xml | 73 -- transport/lwm2m/src/main/data/models/3351.xml | 148 ---- transport/lwm2m/src/main/data/models/3352.xml | 141 ---- transport/lwm2m/src/main/data/models/3353.xml | 140 ---- transport/lwm2m/src/main/data/models/3354.xml | 151 ---- transport/lwm2m/src/main/data/models/3355.xml | 173 ----- transport/lwm2m/src/main/data/models/3356.xml | 137 ---- transport/lwm2m/src/main/data/models/3357.xml | 148 ---- transport/lwm2m/src/main/data/models/3358.xml | 123 --- transport/lwm2m/src/main/data/models/3359.xml | 122 --- transport/lwm2m/src/main/data/models/3360.xml | 145 ---- transport/lwm2m/src/main/data/models/3361.xml | 147 ---- transport/lwm2m/src/main/data/models/3362.xml | 114 --- transport/lwm2m/src/main/data/models/3363.xml | 117 --- transport/lwm2m/src/main/data/models/3364.xml | 114 --- transport/lwm2m/src/main/data/models/3365.xml | 140 ---- transport/lwm2m/src/main/data/models/3366.xml | 193 ----- transport/lwm2m/src/main/data/models/3367.xml | 155 ---- transport/lwm2m/src/main/data/models/3368.xml | 117 --- transport/lwm2m/src/main/data/models/3369.xml | 122 --- transport/lwm2m/src/main/data/models/3370.xml | 158 ---- transport/lwm2m/src/main/data/models/3371.xml | 158 ---- transport/lwm2m/src/main/data/models/3372.xml | 132 ---- transport/lwm2m/src/main/data/models/3373.xml | 132 ---- transport/lwm2m/src/main/data/models/3374.xml | 149 ---- transport/lwm2m/src/main/data/models/3375.xml | 167 ---- transport/lwm2m/src/main/data/models/3376.xml | 114 --- transport/lwm2m/src/main/data/models/3377.xml | 185 ----- transport/lwm2m/src/main/data/models/3378.xml | 132 ---- transport/lwm2m/src/main/data/models/3379.xml | 140 ---- .../lwm2m/src/main/data/models/3380-2_0.xml | 221 ------ transport/lwm2m/src/main/data/models/3381.xml | 127 --- transport/lwm2m/src/main/data/models/3382.xml | 125 --- transport/lwm2m/src/main/data/models/3383.xml | 116 --- transport/lwm2m/src/main/data/models/3384.xml | 129 ---- transport/lwm2m/src/main/data/models/3385.xml | 127 --- transport/lwm2m/src/main/data/models/3386.xml | 122 --- .../LWM2M_APN_Connection_Profile-v1_0_1.xml | 287 ------- .../models/LWM2M_Bearer_Selection-v1_0_1.xml | 174 ----- .../LWM2M_Cellular_Connectivity-v1_0_1.xml | 146 ---- .../data/models/LWM2M_DevCapMgmt-v1_0.xml | 130 ---- .../data/models/LWM2M_LOCKWIPE-v1_0_1.xml | 98 --- .../main/data/models/LWM2M_Portfolio-v1_0.xml | 81 -- .../models/LWM2M_Software_Component-v1_0.xml | 95 --- .../models/LWM2M_Software_Management-v1_0.xml | 235 ------ .../models/LWM2M_WLAN_connectivity4-v1_0.xml | 528 ------------- .../main/data/models/LwM2M_EventLog-V1_0.xml | 101 --- ...ile-transport-configuration.component.html | 11 - ...ofile-transport-configuration.component.ts | 4 - .../device/lwm2m/profile-config.models.ts | 4 +- .../assets/locale/locale.constant-en_US.json | 6 +- 436 files changed, 16 insertions(+), 59040 deletions(-) delete mode 100644 common/transport/lwm2m/src/main/resources/models/10241.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10242.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10243.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10244.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10245.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10246.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10247.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10248.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10249.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10250.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10251.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10252.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10253.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10254.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10255.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10256.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10257.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10258.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10259.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10260-2_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10262.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10263.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10264.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10265.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10266.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10267.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10268.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10269.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10270.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10271.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10272.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10273.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10274.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10275.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10276.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10277.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10278.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10279.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10280.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10281.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10282.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10283.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10284.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10286.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10290.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10291.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10292.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10299.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10300.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10308-2_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10309.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10311.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10313.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10314.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10315.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10316.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10318.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10319.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10320.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10322.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10323.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10324.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10326.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10327.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10328.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10329.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10330.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10331.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10332.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10333.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10334.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10335.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10336.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10337.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10338.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10339.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10340.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10341.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10342.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10343.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10344.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10345.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10346.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10347.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10348.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10349.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10350.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10351.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10352.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10353.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10354.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10355.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10356.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10357.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10358.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10359.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10360.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10361.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10362.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10363.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10364.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10365.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10366.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10368.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/10369.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2048.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2049.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2050.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2051.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2052.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2053.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2054.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2055.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2056.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/2057.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/31024.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3200.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3201.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3202.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3203.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3300.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3301.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3302.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3303.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3304.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3305.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3306.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3308.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3310.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3311.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3312.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3313.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3314.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3315.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3316.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3317.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3318.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3319.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3320.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3321.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3322.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3323.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3324.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3325.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3326.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3327.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3328.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3329.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3330.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3331.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3332.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3333.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3334.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3335.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3336.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3337.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3338.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3339.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3340.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3341.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3342.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3343.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3344.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3345.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3346.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3347.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3348.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3349.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3350.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3351.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3352.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3353.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3354.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3355.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3356.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3357.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3358.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3359.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3360.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3361.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3362.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3363.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3364.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3365.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3366.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3367.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3368.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3369.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3370.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3371.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3372.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3373.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3374.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3375.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3376.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3377.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3378.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3379.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3380-2_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3381.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3382.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3383.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3384.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3385.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/3386.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_APN_Connection_Profile-v1_0_1.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_Bearer_Selection-v1_0_1.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_Cellular_Connectivity-v1_0_1.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_DevCapMgmt-v1_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_LOCKWIPE-v1_0_1.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_Portfolio-v1_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Component-v1_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Management-v1_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LWM2M_WLAN_connectivity4-v1_0.xml delete mode 100644 common/transport/lwm2m/src/main/resources/models/LwM2M_EventLog-V1_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/10241.xml delete mode 100644 transport/lwm2m/src/main/data/models/10242.xml delete mode 100644 transport/lwm2m/src/main/data/models/10243.xml delete mode 100644 transport/lwm2m/src/main/data/models/10244.xml delete mode 100644 transport/lwm2m/src/main/data/models/10245.xml delete mode 100644 transport/lwm2m/src/main/data/models/10246.xml delete mode 100644 transport/lwm2m/src/main/data/models/10247.xml delete mode 100644 transport/lwm2m/src/main/data/models/10248.xml delete mode 100644 transport/lwm2m/src/main/data/models/10249.xml delete mode 100644 transport/lwm2m/src/main/data/models/10250.xml delete mode 100644 transport/lwm2m/src/main/data/models/10251.xml delete mode 100644 transport/lwm2m/src/main/data/models/10252.xml delete mode 100644 transport/lwm2m/src/main/data/models/10253.xml delete mode 100644 transport/lwm2m/src/main/data/models/10254.xml delete mode 100644 transport/lwm2m/src/main/data/models/10255.xml delete mode 100644 transport/lwm2m/src/main/data/models/10256.xml delete mode 100644 transport/lwm2m/src/main/data/models/10257.xml delete mode 100644 transport/lwm2m/src/main/data/models/10258.xml delete mode 100644 transport/lwm2m/src/main/data/models/10259.xml delete mode 100644 transport/lwm2m/src/main/data/models/10260-2_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/10262.xml delete mode 100644 transport/lwm2m/src/main/data/models/10263.xml delete mode 100644 transport/lwm2m/src/main/data/models/10264.xml delete mode 100644 transport/lwm2m/src/main/data/models/10265.xml delete mode 100644 transport/lwm2m/src/main/data/models/10266.xml delete mode 100644 transport/lwm2m/src/main/data/models/10267.xml delete mode 100644 transport/lwm2m/src/main/data/models/10268.xml delete mode 100644 transport/lwm2m/src/main/data/models/10269.xml delete mode 100644 transport/lwm2m/src/main/data/models/10270.xml delete mode 100644 transport/lwm2m/src/main/data/models/10271.xml delete mode 100644 transport/lwm2m/src/main/data/models/10272.xml delete mode 100644 transport/lwm2m/src/main/data/models/10273.xml delete mode 100644 transport/lwm2m/src/main/data/models/10274.xml delete mode 100644 transport/lwm2m/src/main/data/models/10275.xml delete mode 100644 transport/lwm2m/src/main/data/models/10276.xml delete mode 100644 transport/lwm2m/src/main/data/models/10277.xml delete mode 100644 transport/lwm2m/src/main/data/models/10278.xml delete mode 100644 transport/lwm2m/src/main/data/models/10279.xml delete mode 100644 transport/lwm2m/src/main/data/models/10280.xml delete mode 100644 transport/lwm2m/src/main/data/models/10281.xml delete mode 100644 transport/lwm2m/src/main/data/models/10282.xml delete mode 100644 transport/lwm2m/src/main/data/models/10283.xml delete mode 100644 transport/lwm2m/src/main/data/models/10284.xml delete mode 100644 transport/lwm2m/src/main/data/models/10286.xml delete mode 100644 transport/lwm2m/src/main/data/models/10290.xml delete mode 100644 transport/lwm2m/src/main/data/models/10291.xml delete mode 100644 transport/lwm2m/src/main/data/models/10292.xml delete mode 100644 transport/lwm2m/src/main/data/models/10299.xml delete mode 100644 transport/lwm2m/src/main/data/models/10300.xml delete mode 100644 transport/lwm2m/src/main/data/models/10308-2_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/10309.xml delete mode 100644 transport/lwm2m/src/main/data/models/10311.xml delete mode 100644 transport/lwm2m/src/main/data/models/10313.xml delete mode 100644 transport/lwm2m/src/main/data/models/10314.xml delete mode 100644 transport/lwm2m/src/main/data/models/10315.xml delete mode 100644 transport/lwm2m/src/main/data/models/10316.xml delete mode 100644 transport/lwm2m/src/main/data/models/10318.xml delete mode 100644 transport/lwm2m/src/main/data/models/10319.xml delete mode 100644 transport/lwm2m/src/main/data/models/10320.xml delete mode 100644 transport/lwm2m/src/main/data/models/10322.xml delete mode 100644 transport/lwm2m/src/main/data/models/10323.xml delete mode 100644 transport/lwm2m/src/main/data/models/10324.xml delete mode 100644 transport/lwm2m/src/main/data/models/10326.xml delete mode 100644 transport/lwm2m/src/main/data/models/10327.xml delete mode 100644 transport/lwm2m/src/main/data/models/10328.xml delete mode 100644 transport/lwm2m/src/main/data/models/10329.xml delete mode 100644 transport/lwm2m/src/main/data/models/10330.xml delete mode 100644 transport/lwm2m/src/main/data/models/10331.xml delete mode 100644 transport/lwm2m/src/main/data/models/10332.xml delete mode 100644 transport/lwm2m/src/main/data/models/10333.xml delete mode 100644 transport/lwm2m/src/main/data/models/10334.xml delete mode 100644 transport/lwm2m/src/main/data/models/10335.xml delete mode 100644 transport/lwm2m/src/main/data/models/10336.xml delete mode 100644 transport/lwm2m/src/main/data/models/10337.xml delete mode 100644 transport/lwm2m/src/main/data/models/10338.xml delete mode 100644 transport/lwm2m/src/main/data/models/10339.xml delete mode 100644 transport/lwm2m/src/main/data/models/10340.xml delete mode 100644 transport/lwm2m/src/main/data/models/10341.xml delete mode 100644 transport/lwm2m/src/main/data/models/10342.xml delete mode 100644 transport/lwm2m/src/main/data/models/10343.xml delete mode 100644 transport/lwm2m/src/main/data/models/10344.xml delete mode 100644 transport/lwm2m/src/main/data/models/10345.xml delete mode 100644 transport/lwm2m/src/main/data/models/10346.xml delete mode 100644 transport/lwm2m/src/main/data/models/10347.xml delete mode 100644 transport/lwm2m/src/main/data/models/10348.xml delete mode 100644 transport/lwm2m/src/main/data/models/10349.xml delete mode 100644 transport/lwm2m/src/main/data/models/10350.xml delete mode 100644 transport/lwm2m/src/main/data/models/10351.xml delete mode 100644 transport/lwm2m/src/main/data/models/10352.xml delete mode 100644 transport/lwm2m/src/main/data/models/10353.xml delete mode 100644 transport/lwm2m/src/main/data/models/10354.xml delete mode 100644 transport/lwm2m/src/main/data/models/10355.xml delete mode 100644 transport/lwm2m/src/main/data/models/10356.xml delete mode 100644 transport/lwm2m/src/main/data/models/10357.xml delete mode 100644 transport/lwm2m/src/main/data/models/10358.xml delete mode 100644 transport/lwm2m/src/main/data/models/10359.xml delete mode 100644 transport/lwm2m/src/main/data/models/10360.xml delete mode 100644 transport/lwm2m/src/main/data/models/10361.xml delete mode 100644 transport/lwm2m/src/main/data/models/10362.xml delete mode 100644 transport/lwm2m/src/main/data/models/10363.xml delete mode 100644 transport/lwm2m/src/main/data/models/10364.xml delete mode 100644 transport/lwm2m/src/main/data/models/10365.xml delete mode 100644 transport/lwm2m/src/main/data/models/10366.xml delete mode 100644 transport/lwm2m/src/main/data/models/10368.xml delete mode 100644 transport/lwm2m/src/main/data/models/10369.xml delete mode 100644 transport/lwm2m/src/main/data/models/2048.xml delete mode 100644 transport/lwm2m/src/main/data/models/2049.xml delete mode 100644 transport/lwm2m/src/main/data/models/2050.xml delete mode 100644 transport/lwm2m/src/main/data/models/2051.xml delete mode 100644 transport/lwm2m/src/main/data/models/2052.xml delete mode 100644 transport/lwm2m/src/main/data/models/2053.xml delete mode 100644 transport/lwm2m/src/main/data/models/2054.xml delete mode 100644 transport/lwm2m/src/main/data/models/2055.xml delete mode 100644 transport/lwm2m/src/main/data/models/2056.xml delete mode 100644 transport/lwm2m/src/main/data/models/2057.xml delete mode 100644 transport/lwm2m/src/main/data/models/31024.xml delete mode 100644 transport/lwm2m/src/main/data/models/3200.xml delete mode 100644 transport/lwm2m/src/main/data/models/3201.xml delete mode 100644 transport/lwm2m/src/main/data/models/3202.xml delete mode 100644 transport/lwm2m/src/main/data/models/3203.xml delete mode 100644 transport/lwm2m/src/main/data/models/3300.xml delete mode 100644 transport/lwm2m/src/main/data/models/3301.xml delete mode 100644 transport/lwm2m/src/main/data/models/3302.xml delete mode 100644 transport/lwm2m/src/main/data/models/3303.xml delete mode 100644 transport/lwm2m/src/main/data/models/3304.xml delete mode 100644 transport/lwm2m/src/main/data/models/3305.xml delete mode 100644 transport/lwm2m/src/main/data/models/3306.xml delete mode 100644 transport/lwm2m/src/main/data/models/3308.xml delete mode 100644 transport/lwm2m/src/main/data/models/3310.xml delete mode 100644 transport/lwm2m/src/main/data/models/3311.xml delete mode 100644 transport/lwm2m/src/main/data/models/3312.xml delete mode 100644 transport/lwm2m/src/main/data/models/3313.xml delete mode 100644 transport/lwm2m/src/main/data/models/3314.xml delete mode 100644 transport/lwm2m/src/main/data/models/3315.xml delete mode 100644 transport/lwm2m/src/main/data/models/3316.xml delete mode 100644 transport/lwm2m/src/main/data/models/3317.xml delete mode 100644 transport/lwm2m/src/main/data/models/3318.xml delete mode 100644 transport/lwm2m/src/main/data/models/3319.xml delete mode 100644 transport/lwm2m/src/main/data/models/3320.xml delete mode 100644 transport/lwm2m/src/main/data/models/3321.xml delete mode 100644 transport/lwm2m/src/main/data/models/3322.xml delete mode 100644 transport/lwm2m/src/main/data/models/3323.xml delete mode 100644 transport/lwm2m/src/main/data/models/3324.xml delete mode 100644 transport/lwm2m/src/main/data/models/3325.xml delete mode 100644 transport/lwm2m/src/main/data/models/3326.xml delete mode 100644 transport/lwm2m/src/main/data/models/3327.xml delete mode 100644 transport/lwm2m/src/main/data/models/3328.xml delete mode 100644 transport/lwm2m/src/main/data/models/3329.xml delete mode 100644 transport/lwm2m/src/main/data/models/3330.xml delete mode 100644 transport/lwm2m/src/main/data/models/3331.xml delete mode 100644 transport/lwm2m/src/main/data/models/3332.xml delete mode 100644 transport/lwm2m/src/main/data/models/3333.xml delete mode 100644 transport/lwm2m/src/main/data/models/3334.xml delete mode 100644 transport/lwm2m/src/main/data/models/3335.xml delete mode 100644 transport/lwm2m/src/main/data/models/3336.xml delete mode 100644 transport/lwm2m/src/main/data/models/3337.xml delete mode 100644 transport/lwm2m/src/main/data/models/3338.xml delete mode 100644 transport/lwm2m/src/main/data/models/3339.xml delete mode 100644 transport/lwm2m/src/main/data/models/3340.xml delete mode 100644 transport/lwm2m/src/main/data/models/3341.xml delete mode 100644 transport/lwm2m/src/main/data/models/3342.xml delete mode 100644 transport/lwm2m/src/main/data/models/3343.xml delete mode 100644 transport/lwm2m/src/main/data/models/3344.xml delete mode 100644 transport/lwm2m/src/main/data/models/3345.xml delete mode 100644 transport/lwm2m/src/main/data/models/3346.xml delete mode 100644 transport/lwm2m/src/main/data/models/3347.xml delete mode 100644 transport/lwm2m/src/main/data/models/3348.xml delete mode 100644 transport/lwm2m/src/main/data/models/3349.xml delete mode 100644 transport/lwm2m/src/main/data/models/3350.xml delete mode 100644 transport/lwm2m/src/main/data/models/3351.xml delete mode 100644 transport/lwm2m/src/main/data/models/3352.xml delete mode 100644 transport/lwm2m/src/main/data/models/3353.xml delete mode 100644 transport/lwm2m/src/main/data/models/3354.xml delete mode 100644 transport/lwm2m/src/main/data/models/3355.xml delete mode 100644 transport/lwm2m/src/main/data/models/3356.xml delete mode 100644 transport/lwm2m/src/main/data/models/3357.xml delete mode 100644 transport/lwm2m/src/main/data/models/3358.xml delete mode 100644 transport/lwm2m/src/main/data/models/3359.xml delete mode 100644 transport/lwm2m/src/main/data/models/3360.xml delete mode 100644 transport/lwm2m/src/main/data/models/3361.xml delete mode 100644 transport/lwm2m/src/main/data/models/3362.xml delete mode 100644 transport/lwm2m/src/main/data/models/3363.xml delete mode 100644 transport/lwm2m/src/main/data/models/3364.xml delete mode 100644 transport/lwm2m/src/main/data/models/3365.xml delete mode 100644 transport/lwm2m/src/main/data/models/3366.xml delete mode 100644 transport/lwm2m/src/main/data/models/3367.xml delete mode 100644 transport/lwm2m/src/main/data/models/3368.xml delete mode 100644 transport/lwm2m/src/main/data/models/3369.xml delete mode 100644 transport/lwm2m/src/main/data/models/3370.xml delete mode 100644 transport/lwm2m/src/main/data/models/3371.xml delete mode 100644 transport/lwm2m/src/main/data/models/3372.xml delete mode 100644 transport/lwm2m/src/main/data/models/3373.xml delete mode 100644 transport/lwm2m/src/main/data/models/3374.xml delete mode 100644 transport/lwm2m/src/main/data/models/3375.xml delete mode 100644 transport/lwm2m/src/main/data/models/3376.xml delete mode 100644 transport/lwm2m/src/main/data/models/3377.xml delete mode 100644 transport/lwm2m/src/main/data/models/3378.xml delete mode 100644 transport/lwm2m/src/main/data/models/3379.xml delete mode 100644 transport/lwm2m/src/main/data/models/3380-2_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/3381.xml delete mode 100644 transport/lwm2m/src/main/data/models/3382.xml delete mode 100644 transport/lwm2m/src/main/data/models/3383.xml delete mode 100644 transport/lwm2m/src/main/data/models/3384.xml delete mode 100644 transport/lwm2m/src/main/data/models/3385.xml delete mode 100644 transport/lwm2m/src/main/data/models/3386.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_APN_Connection_Profile-v1_0_1.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_Bearer_Selection-v1_0_1.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_Cellular_Connectivity-v1_0_1.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_DevCapMgmt-v1_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_LOCKWIPE-v1_0_1.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_Portfolio-v1_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_Software_Component-v1_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_Software_Management-v1_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/LWM2M_WLAN_connectivity4-v1_0.xml delete mode 100644 transport/lwm2m/src/main/data/models/LwM2M_EventLog-V1_0.xml diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java index 8d660b3c22..a62bdf2a49 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java @@ -36,8 +36,8 @@ import org.nustaq.serialization.FSTConfiguration; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.device.profile.Lwm2mDeviceProfileTransportConfiguration; import org.thingsboard.server.common.transport.TransportServiceCallback; -import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientProfile; import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClient; +import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientProfile; import java.io.File; import java.io.IOException; @@ -244,11 +244,6 @@ public class LwM2mTransportHandler { return null; } - public static boolean getClientUpdateValueAfterConnect (LwM2mClientProfile profile) { - return profile.getPostClientLwM2mSettings().getAsJsonObject().has("clientUpdateValueAfterConnect") && - profile.getPostClientLwM2mSettings().getAsJsonObject().get("clientUpdateValueAfterConnect").getAsBoolean(); - } - public static boolean getClientOnlyObserveAfterConnect (LwM2mClientProfile profile) { return profile.getPostClientLwM2mSettings().getAsJsonObject().has("clientOnlyObserveAfterConnect") && profile.getPostClientLwM2mSettings().getAsJsonObject().get("clientOnlyObserveAfterConnect").getAsBoolean(); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java index b907bfbc24..548d750a3f 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java @@ -16,7 +16,6 @@ package org.thingsboard.server.transport.lwm2m.server; import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -58,7 +57,6 @@ import org.thingsboard.server.transport.lwm2m.server.client.ResultsAnalyzerParam import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl; import javax.annotation.PostConstruct; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -446,14 +444,12 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { } /** - * #1 сlientOnlyObserveAfterConnect == true + * #1 clientOnlyObserveAfterConnect == true * - Only Observe Request to the client marked as observe from the profile configuration. - * #2. сlientOnlyObserveAfterConnect == false & clientUpdateValueAfterConnect == false - * - Request to the client after registration to read the values of the resources marked as attribute or telemetry from the profile configuration. - * - then Observe Request to the client marked as observe from the profile configuration. - * #3. сlientOnlyObserveAfterConnect == false & clientUpdateValueAfterConnect == true - * После регистрации отправляю запрос на read всех ресурсов, котрые послк регистрации, а затем запрос на observe (edited) - * - Request to the client after registration to read all resource values for all objects + * #2. clientOnlyObserveAfterConnect == false + * После регистрации отправляю запрос на read всех ресурсов, которые после регистрации есть у клиента, + * а затем запрос на observe (edited) + * - Read Request to the client after registration to read all resource values for all objects * - then Observe Request to the client marked as observe from the profile configuration. * * @param registration - Registration LwM2M Client @@ -464,16 +460,9 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { Set clientObjects = this.getAllOjectsInClient(registration); if (clientObjects != null && !LwM2mTransportHandler.getClientOnlyObserveAfterConnect(lwM2MClientProfile)) { // #2 - if (!LwM2mTransportHandler.getClientUpdateValueAfterConnect(lwM2MClientProfile)) { - this.initReadAttrTelemetryObserveToClient(registration, lwM2MClient, GET_TYPE_OPER_READ); - - } - // #3 - else { - lwM2MClient.getPendingRequests().addAll(clientObjects); - clientObjects.forEach(path -> lwM2mTransportRequest.sendAllRequest(registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), - null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout())); - } + lwM2MClient.getPendingRequests().addAll(clientObjects); + clientObjects.forEach(path -> lwM2mTransportRequest.sendAllRequest(registration, path, GET_TYPE_OPER_READ, ContentFormat.TLV.getName(), + null, null, this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getTimeout())); } // #1 this.initReadAttrTelemetryObserveToClient(registration, lwM2MClient, GET_TYPE_OPER_OBSERVE); @@ -786,17 +775,17 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { if (lwM2mClientContext.addUpdateProfileParameters(deviceProfile)) { // #1 JsonArray attributeOld = lwM2MClientProfileOld.getPostAttributeProfile(); - Set attributeSetOld = this.convertJsonArrayToSet (attributeOld); + Set attributeSetOld = this.convertJsonArrayToSet(attributeOld); JsonArray telemetryOld = lwM2MClientProfileOld.getPostTelemetryProfile(); - Set telemetrySetOld = this.convertJsonArrayToSet (telemetryOld); + Set telemetrySetOld = this.convertJsonArrayToSet(telemetryOld); JsonArray observeOld = lwM2MClientProfileOld.getPostObserveProfile(); JsonObject keyNameOld = lwM2MClientProfileOld.getPostKeyNameProfile(); LwM2mClientProfile lwM2MClientProfileNew = lwM2mClientContext.getProfiles().get(deviceProfile.getUuidId()); JsonArray attributeNew = lwM2MClientProfileNew.getPostAttributeProfile(); - Set attributeSetNew = this.convertJsonArrayToSet (attributeNew); + Set attributeSetNew = this.convertJsonArrayToSet(attributeNew); JsonArray telemetryNew = lwM2MClientProfileNew.getPostTelemetryProfile(); - Set telemetrySetNew = this.convertJsonArrayToSet (telemetryNew); + Set telemetrySetNew = this.convertJsonArrayToSet(telemetryNew); JsonArray observeNew = lwM2MClientProfileNew.getPostObserveProfile(); JsonObject keyNameNew = lwM2MClientProfileNew.getPostKeyNameProfile(); diff --git a/common/transport/lwm2m/src/main/resources/models/10241.xml b/common/transport/lwm2m/src/main/resources/models/10241.xml deleted file mode 100644 index 2b2af520e2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10241.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - HostDeviceInfo - - 10241 - urn:oma:lwm2m:x:10241 - - - Multiple - Optional - - Host Device Manufacturer - R - Multiple - Mandatory - String - - - - - Host Device Model Number - R - Multiple - Mandatory - String - - - - - Host Device Unique ID - R - Multiple - Mandatory - String - - - - - Host Device Software Version - R - Multiple - Mandatory - String - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10242.xml b/common/transport/lwm2m/src/main/resources/models/10242.xml deleted file mode 100644 index 09a62806d3..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10242.xml +++ /dev/null @@ -1,659 +0,0 @@ - - - - - - - 3-Phase Power Meter - - - - 10242 - urn:oma:lwm2m:x:10242 - 1.0 - 1.0 - Multiple - Optional - - - Manufacturer - R - Single - Optional - String - - - - - - - - Model Number - R - Single - Optional - String - - - - - - - - Serial Number - R - Single - Optional - String - - - - - - - - Description - R - Single - Optional - String - - - - - - - - Tension R - R - Single - Mandatory - Float - - V - - - - - - Current R - R - Single - Mandatory - Float - - A - - - - - - Active Power R - R - Single - Optional - Float - - kW - - - - - - Reactive Power R - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power R - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power R - R - Single - Optional - Float - - kvar - - - - - - Apparent Power R - R - Single - Optional - Float - - kVA - - - - - - Power Factor R - R - Single - Optional - Float - -1..1 - - - - - - - THD-V R - R - Single - Optional - Float - - /100 - - - - - - THD-A R - R - Single - Optional - Float - - /100 - - - - - - Tension S - R - Single - Mandatory - Float - - V - - - - - - Current S - R - Single - Mandatory - Float - - A - - - - - - Active Power S - R - Single - Optional - Float - - kW - - - - - - Reactive Power S - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power S - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power S - R - Single - Optional - Float - - kvar - - - - - - Apparent Power S - R - Single - Optional - Float - - kVA - - - - - - Power Factor S - R - Single - Optional - Float - -1..1 - - - - - - - THD-V S - R - Single - Optional - Float - - /100 - - - - - - THD-A S - R - Single - Optional - Float - - /100 - - - - - - Tension T - R - Single - Mandatory - Float - - V - - - - - - Current T - R - Single - Mandatory - Float - - A - - - - - - Active Power T - R - Single - Optional - Float - - kW - - - - - - Reactive Power T - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power T - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power T - R - Single - Optional - Float - - kvar - - - - - - Apparent Power T - R - Single - Optional - Float - - kVA - - - - - - Power Factor T - R - Single - Optional - Float - -1..1 - - - - - - - THD-V T - R - Single - Optional - Float - - /100 - - - - - - THD-A T - R - Single - Optional - Float - - /100 - - - - - - 3-Phase Active Power - R - Single - Optional - Float - - kW - - - - - - 3-Phase Reactive Power - R - Single - Optional - Float - - kvar - - - - - - 3-Phase Inductive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - 3-Phase Capacitive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - 3-Phase Apparent Power - R - Single - Optional - Float - - kVA - - - - - - 3-Phase Power Factor - R - Single - Optional - Float - -1..1 - - - - - - - 3-Phase phi cosine - R - Single - Optional - Float - -1..1 - - - - - - - Active Energy - R - Single - Optional - Float - - kWh - - - - - - Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Inductive Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Capacitive Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Apparent Energy - R - Single - Optional - Float - - kVAh - - - - - - Tension R-S - R - Single - Optional - Float - - V - - - - - - Tension S-T - R - Single - Optional - Float - - V - - - - - - Tension T-R - R - Single - Optional - Float - - V - - - - - - Frequency - R - Single - Optional - Float - - Hz - - - - - - Neutral Current - R - Single - Optional - Float - - A - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10243.xml b/common/transport/lwm2m/src/main/resources/models/10243.xml deleted file mode 100644 index b506162174..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10243.xml +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - Single-Phase Power Meter - - - - 10243 - urn:oma:lwm2m:x:10243 - 1.0 - 1.0 - Multiple - Optional - - - Manufacturer - R - Single - Optional - String - - - - - - - - Model Number - R - Single - Optional - String - - - - - - - - Serial Number - R - Single - Optional - String - - - - - - - - Description - R - Single - Optional - String - - - - - - - - Tension - R - Single - Mandatory - String - - V - - - - - - Current - R - Single - Mandatory - Float - - A - - - - - - Active Power - R - Single - Optional - Float - - kW - - - - - - Reactive Power - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - Apparent Power - R - Single - Optional - Float - - kVA - - - - - - Power Factor - R - Single - Optional - Float - -1..1 - - - - - - - THD-V - R - Single - Optional - Float - - /100 - - - - - - THD-A - R - Single - Optional - Float - - /100 - - - - - - Active Energy - R - Single - Optional - Float - - kWh - - - - - - Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Apparent Energy - R - Single - Optional - Float - - kVAh - - - - - - Frequency - R - Single - Optional - Float - - Hz - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10244.xml b/common/transport/lwm2m/src/main/resources/models/10244.xml deleted file mode 100644 index d1ae9d911e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10244.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - VehicleControlUnit - - 10244 - urn:oma:lwm2m:x:10244 - Single - Optional - - Vehicle UI State - R - Single - Mandatory - Integer - 0..15 - - - - Vehicle Speed - R - Single - Mandatory - Integer - - km/h - - - Vehicle Shift Status - R - Single - Mandatory - Integer - 0..3 - - - - Vehicle AP Position - R - Single - Mandatory - Integer - 0..100 - /100 - - - Vehicle Power - R - Single - Optional - Float - - kW - - - Vehicle Drive Energy - R - Single - Optional - Float - - Wh - - - Vehicle Energy Consumption Efficiency - R - Single - Optional - Float - - Wh/km - - - Vehicle Estimated Mileage - R - Single - Optional - Integer - - km - - - Vehicle Charge Cable Status - R - Single - Mandatory - Boolean - - - - - Vehicle Charge Status - R - Single - Mandatory - Integer - 0..15 - - - - Vehicle Charge Voltage - R - Single - Mandatory - Float - - V - - - Vehicle Charge Current - R - Single - Mandatory - Float - - A - - - Vehicle Charge Remaining Time - R - Single - Mandatory - Integer - - min - - - Battery Pack Voltage - R - Single - Mandatory - Float - - V - - - Battery Pack Current - R - Single - Mandatory - Float - - A - - - Battery Pack Remaining Capacity - R - Single - Mandatory - Integer - - Ah - - - Battery Pack SOC - R - Single - Mandatory - Integer - 0..100 - /100 - - - Battery Pack SOH - R - Single - Mandatory - Integer - 0..100 - /100 - - - Battery Cell MinVolt - R - Single - Mandatory - Integer - - mV - - - Battery Cell MaxVolt - R - Single - Mandatory - Integer - - mV - - - Battery Module MinTemp - R - Single - Mandatory - Integer - - Cel - - - Battery Module MaxTemp - R - Single - Mandatory - Integer - - Cel - - - Battery Connection Status - R - Single - Mandatory - Boolean - - - - - - MCU Voltage - R - Single - Mandatory - Integer - - V - - - MCU Temperature - R - Single - Mandatory - Integer - - Cel - - - Motor Speed - R - Single - Mandatory - Integer - - 1/min - - - Motor Temperature - R - Single - Mandatory - Integer - - Cel - - - Motor OT Warning - R - Single - Optional - Boolean - - - - - MCU OT Warning - R - Single - Optional - Boolean - - - - - Battery Pack OT Warning - R - Single - Optional - Boolean - - - - - MCU fault - R - Single - Optional - Boolean - - - - - Motor Error - R - Single - Optional - Boolean - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10245.xml b/common/transport/lwm2m/src/main/resources/models/10245.xml deleted file mode 100644 index ca8c9da9ae..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10245.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - Relay Management - This LWM2M Object provides a range of eNB related measurements and parameters of which several are changeable. Furthermore, it includes Resources to enable/disable the eNB. - 10245 - urn:oma:lwm2m:x:10245 - - - Single - Optional - - - eNB Availability - R - Single - Mandatory - Boolean - AVAILABLE; UNAVAILABLE - - This field indicates to the CCC whether or not the eNB of the CrowdBox is available for activation: AVAILABLE = TRUE; UNAVAILABLE = FALSE This is set by the CrowdBox itself using an algorithm specific to the use case and based on parameters known to the CrowdBox which may not necessarily be signalled to the network. In the absence of a more specific algorithm, this parameter should be set to AVAILABLE, unless a fault is detected which would prevent activation of the eNB, in which case it should be set to UNAVAILABLE. - - - GPS Status - R - Single - Mandatory - Boolean - UNSYNCHRONISED; SYNCHRONISED - - States whether the CrowdBox GPS receiver is synchronised to GPS time or not: UNSYCHRONISED = FALSE; SYNCHRONISED = TRUE If more than one GPS receiver is used by the CrowdBox, then SYNCHRONISED should be reported only if all receivers are synchronised. - - - Orientation - R - Single - Optional - Integer - -180..180 - deg - Orientation of CrowdBox with respect to magnetic north. The reference orientation of the CrowdBox shall be the pointing direction of the eNB antenna(s) or, in the case of an omni-directional CrowdBox antenna, as defined in the accompanying product documentation. - - - eNB EARFCN - RW - Single - Mandatory - Integer - 0..65535 - - EARFCN currently used by the eNB. Highest valid value in 3GPP is currently 46589. If the requested EARFCN is not supported by the eNB, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - eNB Bandwidth - RW - Single - Mandatory - Integer - 5, 10, 15, 20 - - Bandwidth of the currently used eNB carrier. If the requested bandwidth is not supported by the eNB, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Primary EARFCN - RW - Single - Mandatory - Integer - 0..65535 - - EARFCN of primary cell used for the backhaul. If the requested EARFCN is not supported by the CrowdBox UE, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Secondary EARFCN - RW - Multiple - Mandatory - Integer - 0..65535 - - EARFCN of any secondary cells used for the backhaul, in the event that carrier aggregation is being used. If the requested EARFCN is not supported by the CrowdBox UE, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Cumulative Measurement Window - RW - Single - Mandatory - Integer - 0..65535 - s - The current measurement interval over which cumulative statistics are collected for the following resources: Cumulative Number of Unique Users, Cumulative Downlink Throughput per Connected User, Cumulative Uplink Throughput per Connected User. Note that this measurement period is a sliding window rather than a granularity period. Measurements should never be reset, but rather old measurements should be removed from the cumulative total as they fall outside of the window. A value of 0 shall be interpreted as meaning only the current value should be reported. A value of 65535 shall be interpreted as an infinite window size (i.e. old measurements are never discarded). - - - eNB ECI - R - Single - Mandatory - Integer - 0..2^28-1 - - A 28 bit E-UTRAN Cell Identifier (ECI) - - - eNB Status - RW - Single - Mandatory - Boolean - - - This resource indicates the current status of the eNB and can be used by the CCC to change the state from enabled to disabled. TRUE = eNB enabled FALSE = eNB disabled - - - Enable eNB - E - Single - Mandatory - - - - Enables the eNB. In addition the CrowdBox shall also update its configuration to reflect the current state of other relevant parameters. This might require a reboot. - - - eNB Maximum Power - RW - Single - Mandatory - Integer - 0..63 - dBm - Maximum power for the eNB measured as the sum of input powers to all antenna connectors. The maximum power per antenna port is equal to the maximum eNB power divided by the number of antenna ports. If the requested power is above or below the maximum or minimum power levels of the eNB, then the power level should be set to the maximum or minimum respectively. The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Primary q-OffsetFreq - RW - Single - Mandatory - Integer - -24..24 - dB - q-OffsetFreq parameter for the backhaul primary EARFCN in SIB5 of the CrowdBox eNB BCCH. See TS 36.331 for details. Range: dB-24; dB-22 .. dB24 The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Secondary q-OffsetFreq - RW - Multiple - Mandatory - Integer - -24..24 - dB - q-OffsetFreq parameter for the backhaul secondary EARFCN in SIB5 of the CrowdBox eNB BCCH. See TS 36.331 for details Range: dB-24; dB-22 .. dB24 The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Neighbour CrowdBox EARFCN - RW - Multiple - Mandatory - Integer - 0..66635 - - EARFCN of a neighbour CrowdBox. Each instance of this resource relates to the same instance of resource ID 15. - - - Neighbour CrowdBox q-OffsetFreq - RW - Multiple - Mandatory - Integer - -24..24 - dB - q-OffsetFreq parameter of the Neighbour CrowdBox EARFCN in SIB5 of the Neighbour CrowdBox eNB BCCH. See TS 36.331 for details Range: dB-24; dB-22 .. dB24 Each instance of this resource relates to the same instance of resource ID 14. The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Serving Macro eNB cellIndividualOffset - RW - Single - Mandatory - Integer - -24..24 - dB - Specifies the value of the cellIndividualOffset parameter applicable to the CrowdBox macro serving cell that is to be signalled to connected UEs in their measurement configuration information . See TS 36.331 for details. The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10246.xml b/common/transport/lwm2m/src/main/resources/models/10246.xml deleted file mode 100644 index b1667af963..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10246.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - CrowdBox Measurements - This LWM2M Object provides CrowdBox-related measurements such as serving cell parameters, backhaul timing advance, and neighbour cell reports. - 10246 - urn:oma:lwm2m:x:10246 - - - Single - Optional - - - Serving Cell ID - R - Single - Mandatory - Integer - 0..2^32-1 - - Serving cell ID as specified by the cellIdentity field broadcast in SIB1 of the serving cell (see TS 36.331). - - - Serving Cell RSRP - R - Single - Mandatory - Integer - 0..97 - - Serving cell RSRP, as defined in TS 36.133, Section 9.1.4. Range: RSRP_00; RSRP_01 .. RSRP_97 - - - Serving Cell RSRQ - R - Single - Mandatory - Integer - -30..46 - - Serving cell RSRQ, as defined in TS 36.133, Section 9.1.7. Range: RSRQ_-30; RSRQ_-29 .. RSRQ_46 - - - Serving Cell SINR - R - Single - Mandatory - Integer - -10..30 - dB - SINR of serving cell as estimated by the CrowdBox. Note that this is a proprietary measurement dependent on the UE chipset manufacturer. The UE chipset used should be stated in the accompanying product documentation. - - - Cumulative Backhaul Timing Advance - R - Single - Optional - Integer - 0..65535 - - The cumulative timing advance signalled by the current serving cell to the CrowdBox. This is the sum of the initial timing advance signalled in the MAC payload of the Random Access Response (11 bits, 0 .. 1282) and subsequent adjustments signalled in the MAC PDU of DL-SCH transmissions (6 bits, -31 .. 32). See TS 36.321 for details. - - - Neighbour Cell Report - R - Multiple - Mandatory - Objlnk - - - A link to the "Neighbour Cell Report" object for each neighbour cell of the CrowdBox. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10247.xml b/common/transport/lwm2m/src/main/resources/models/10247.xml deleted file mode 100644 index 17f2f51be2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10247.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - Neighbour Cell Report - This LWM2M Object provides the neighbour cell report. The CrowdBox Measurements Object and the Connected UE Report Object have both Objlnk Resources pointing to this Object. - 10247 - urn:oma:lwm2m:x:10247 - - - Multiple - Optional - - - Neighbour PCI - R - Single - Mandatory - Integer - 0..503 - - Physical Cell ID of neighbouring LTE cell, as defined in TS 36.211 - - - Neighbour Cell ID - R - Single - Optional - Integer - 0..2^32-1 - - Neighbour cell ID as specified by the cellIdentity field broadcast in SIB1 of the neighbour cell (see TS 36.331). - - - Neighbour Cell Rank - R - Single - Mandatory - Integer - 0..255 - - Current neighbour cell rank. Neighbour cells should be ordered (ranked) by the CrowdBox according to neighbour cell RSRP, with a higher RSRP corresponding to a lower index. Hence the neighbouring cell with the highest RSRP should be neighbour cell 0, the second neighbour cell 1, and so on. - - - Neighbour Cell RSRP - R - Single - Mandatory - Integer - 0..97 - - Neighbour cell RSRP, as defined in TS 36.133, Section 9.1.4. Range: RSRP_00; RSRP_01 .. RSRP_97 - - - Neighbour Cell RSRQ - R - Single - Mandatory - Integer - -30..46 - - Neighbour cell RSRQ, as defined in TS 36.133, Section 9.1.7. Range: RSRQ_-30; RSRQ_-29 .. RSRQ_46 - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10248.xml b/common/transport/lwm2m/src/main/resources/models/10248.xml deleted file mode 100644 index 92f2a0a284..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10248.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - Connected UE Measurements - This LWM2M Object provides a range of measurements of connected UEs and provides an Object link to the Connected UE report. - 10248 - urn:oma:lwm2m:x:10248 - - - Single - Optional - - - Number of Connected Users - R - Single - Mandatory - Integer - 0..255 - - The number of different UEs currently connected to the eNB (i.e. in RRC_CONNECTED state). - - - Cumulative Number of Unique Users - R - Single - Mandatory - Integer - 0..65535 - - The number of different UEs that have connected to the eNB over the immediately preceding period specified by the "Cumulative Measurement Window" field. - - - Connected UE Report - R - Multiple - Mandatory - Objlnk - - - Provides an Object link to the Connected UE Report which provides a range of information related to the connected UEs. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10249.xml b/common/transport/lwm2m/src/main/resources/models/10249.xml deleted file mode 100644 index ee9e5a9d5a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10249.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - Connected UE Report - This LWM2M Object provides a range of information related to the connected UEs. - 10249 - urn:oma:lwm2m:x:10249 - - - Multiple - Optional - - - Connected User MMEC - R - Single - Mandatory - Integer - 0..255 - - MMEC signalled by the UE to the eNB in the RRCConnectionRequest message (see TS 36.331). - - - Connected User M-TMSI - R - Single - Mandatory - Integer - 0..2^32-1 - - M-TMSI signalled by the UE to the eNB in the RRCConnectionRequest message (see TS 36.331). - - - Serving Cell (CrowdBox) eNB RSRP - R - Single - Mandatory - Integer - 0..97 - - The RSRP of the CrowdBox eNB, as defined in TS 36.133, Section 9.1.4. Range: RSRP_00; RSRP_01 .. RSRP_97 - - - Serving Cell (CrowdBox) eNB RSRQ - R - Single - Mandatory - Integer - -30..46 - - The RSRQ of the CrowdBox eNB, as defined in TS 36.133, Section 9.1.7. Range: RSRQ_-30; RSRQ_-29 .. RSRQ_46 - - - Cumulative Timing Advance per Connected User - R - Single - Optional - Integer - 0..65535 - - The cumulative timing advance signalled by the eNB to each currently connected UE. This is the sum of the initial timing advance signalled in the MAC payload of the Random Access Response (11 bits, 0 .. 1282) and subsequent adjustments signalled in the MAC PDU of DL-SCH transmissions (6 bits, -31 .. 32). See TS 36.321 for details. - - - Last downlink CQI report per Connected User - R - Single - Mandatory - Integer - 0..255 - - The last downlink wideband CQI reported by a connected user the eNB. The CQI format is defined in Table 7.2.3-1 of TS 36.213. - - - Cumulative Downlink Throughput per Connected User - R - Single - Mandatory - Integer - 0..2^32-1 - B - The total number of MAC bytes sent to the connected user over the immediately preceding period specified by the "Cumulative Measurement Window" field. - - - Cumulative Uplink Throughput per Connected User - R - Single - Mandatory - Integer - 0..2^32-1 - B - The total number of MAC bytes received from the connected user over the immediately preceding period specified by the "Cumulative Measurement Window" field. - - - Neighbour Cell Report - R - Multiple - Mandatory - Objlnk - - - A link to the "Neighbour Cell Report" object for each neighbour cell reported to the CrowdBox by the connected UE - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10250.xml b/common/transport/lwm2m/src/main/resources/models/10250.xml deleted file mode 100644 index a29eda5005..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10250.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - App Data Container - - 10250 - urn:oma:lwm2m:x:10250 - 1.0 - 1.0 - Single - Optional - - - UL data - R - Single - Mandatory - Opaque - - - - - - - - DL data - W - Single - Mandatory - Opaque - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10251.xml b/common/transport/lwm2m/src/main/resources/models/10251.xml deleted file mode 100644 index 3fb1c00154..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10251.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - AT Command - - 10251 - urn:oma:lwm2m:x:10251 - 1.0 - 1.0 - Multiple - Optional - - - Command - RW - Single - Mandatory - String - - - - - - Response - R - Multiple - Mandatory - String - - - - - - Status - R - Multiple - Mandatory - String - - - - - - Timeout - RW - Single - Optional - Integer - - - - - - Run - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10252.xml b/common/transport/lwm2m/src/main/resources/models/10252.xml deleted file mode 100644 index ddaf7cb1f2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10252.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Manifest - - 10252 - urn:oma:lwm2m:x:10252 - 1.0 - 1.0 - Single - Optional - - - Manifest - W - Single - Mandatory - Opaque - - - - - - - - State - R - Single - Mandatory - Integer - 0..8 - - - - - - Manifest Result - R - Single - Mandatory - Integer - 0..19 - - - - - - Payload Result - R - Single - Mandatory - Opaque - - - - - - - - Asset Hash - R - Single - Mandatory - Opaque - - - - - - - - Manifest version - R - Single - Mandatory - Integer - - - - - - - - Asset Installation Progress - R - Single - Mandatory - Integer - - - - - - - - Campaign Id - RW - Single - Mandatory - String - - - - - - - - Manual Trigger - E - Single - Mandatory - - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10253.xml b/common/transport/lwm2m/src/main/resources/models/10253.xml deleted file mode 100644 index 27da37d16a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10253.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - Confidential Data - - 10253 - urn:oma:lwm2m:x:10253 - 1.0 - 1.0 - Single - Optional - - - Public Key - RW - Single - Mandatory - Opaque - - - - - - - - Application Data - R - Single - Mandatory - Opaque - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10254.xml b/common/transport/lwm2m/src/main/resources/models/10254.xml deleted file mode 100644 index 706e1470aa..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10254.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - Current Loop Input - - 10254 - urn:oma:lwm2m:x:10254:1.0 - 1.0 - 1.0 - Multiple - Optional - - - Current Loop Input Current Value - R - Single - Mandatory - Float - 0; 3.8-20.5 - mA - - - - Min Measured Value - R - Single - Optional - Float - - - - - - Max Measured Value - R - Single - Optional - Float - - - - - - Min Range Value - R - Single - Optional - Float - - - - - - Max Range Value - R - Single - Optional - Float - - - - - - Reset Min and Max Measured Values - E - Single - Optional - - - - - - - Sensor Units - R - Single - Optional - String - - - - - - Application Type - RW - Single - Optional - String - - - - - - Current Calibration - RW - Single - Optional - Float - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10255.xml b/common/transport/lwm2m/src/main/resources/models/10255.xml deleted file mode 100644 index fd63016952..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10255.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - Device Metadata - - 10255 - urn:oma:lwm2m:x:10255 - 1.0 - 1.0 - Single - Optional - - - Protocol supported - R - Single - Mandatory - Integer - - - - - - - - Bootloader hash - R - Single - Mandatory - Opaque - - - - - - - - OEM bootloader hash - R - Single - Mandatory - Opaque - - - - - - - - Vendor - R - Single - Mandatory - String - - - - - - - - Class - R - Single - Mandatory - String - - - - - - - - Device - R - Single - Mandatory - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10256.xml b/common/transport/lwm2m/src/main/resources/models/10256.xml deleted file mode 100644 index 77d49f223e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10256.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - ECID-Signal Measurement Information - - 10256 - urn:oma:lwm2m:x:10256 - 1.0 - 1.0 - Multiple - Optional - - - physCellId - R - Single - Mandatory - Integer - - - - - - - - ECGI - R - Single - Optional - Integer - - - - - - - - arfcnEUTRA - R - Single - Mandatory - Integer - - - - - - - - rsrp-Result - R - Single - Mandatory - Integer - - - - - - - - rsrq-Result - R - Single - Optional - Integer - - - - - - - - ue-RxTxTimeDiff - R - Single - Optional - Integer - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10257.xml b/common/transport/lwm2m/src/main/resources/models/10257.xml deleted file mode 100644 index 64c26f5908..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10257.xml +++ /dev/null @@ -1,275 +0,0 @@ - - - - Heat / Cooling meter - - 10257 - urn:oma:lwm2m:x:10257 - 1.0 - 1.0 - Multiple - Optional - - - Manufacturer - R - Single - Optional - String - - - - - - Model Number - R - Single - Optional - String - - - - - - Serial Number - R - Single - Optional - String - - - - - - Description - R - Single - Optional - String - - - - - - Error code - R - Multiple - Optional - Integer - - - - - - - Instantaneous active power - R - Single - Optional - Float - - W - - - - Max Measured active power - R - Multiple - Mandatory - Float - - W - - - - Cumulative active power - R - Single - Optional - Float - - Wh - - - - Flow temperature - R - Single - Optional - Float - - Cel - - - - Max Measured flow temperature - R - Single - Optional - Float - - Cel - - - - Return temperature - R - Single - Optional - Float - - Cel - - - - Max Measured return temperature - R - Single - Optional - Float - - Cel - - - - Temperature difference - R - Single - Optional - Float - - K - - - - Flow rate - R - Single - Optional - Float - - m3/s - - - - Max Measured flow - R - Single - Optional - Float - - m3/s - - - - Flow volume - R - Single - Optional - Float - - m3 - - - - Return volume - R - Single - Optional - Float - - m3 - - - - Current Time - RW - Single - Optional - Time - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10258.xml b/common/transport/lwm2m/src/main/resources/models/10258.xml deleted file mode 100644 index 3fbf7c7c54..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10258.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Current Loop Output - - 10258 - urn:oma:lwm2m:x:10258 - 1.0 - 1.0 - Multiple - Optional - - - Current Loop Output Current Value - RW - Single - Mandatory - Float - 3.8-20.5 - mA - - - - Min Range Value - R - Single - Optional - Float - - - - - - Max Range Value - R - Single - Optional - Float - - - - - - Sensor Units - R - Single - Optional - String - - - - - - Application Type - RW - Single - Optional - String - - - - - - Current Calibration - RW - Single - Optional - Float - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10259.xml b/common/transport/lwm2m/src/main/resources/models/10259.xml deleted file mode 100644 index d75869a122..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10259.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - System Log - - 10259 - urn:oma:lwm2m:x:10259 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - Read All - R - Single - Mandatory - String - - - - - - - - Read - R - Single - Optional - String - - - - - - - - Enabled - RW - Single - Optional - Boolean - - - - - - - - Capture Level - RW - Single - Optional - Integer - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10260-2_0.xml b/common/transport/lwm2m/src/main/resources/models/10260-2_0.xml deleted file mode 100644 index 5cd084af73..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10260-2_0.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - RDB - - 10260 - urn:oma:lwm2m:x:10260:2.0 - 1.0 - 2.0 - Multiple - Optional - - - Key - RW - Single - Mandatory - String - - - - - - - - Value - RW - Single - Optional - String - - - - - - - - Exists - RW - Single - Optional - Boolean - - - - - - - - Persistent - RW - Single - Optional - Boolean - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10262.xml b/common/transport/lwm2m/src/main/resources/models/10262.xml deleted file mode 100644 index 7b2e170c9b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10262.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - Interval Data Delivery - - 10262 - urn:oma:lwm2m:x:10262 - Multiple - Optional - - - Name - RW - Single - Mandatory - String - - - - - - Interval Data Links - RW - Multiple - Mandatory - Objlnk - - - - - - Latest Payload - R - Multiple - Mandatory - Opaque - - - - - - Schedule - RW - Single - Optional - Objlnk - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10263.xml b/common/transport/lwm2m/src/main/resources/models/10263.xml deleted file mode 100644 index 5e18f44244..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10263.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - Event Data Delivery - - 10263 - urn:oma:lwm2m:x:10263 - Multiple - Optional - - - Name - RW - Single - Mandatory - String - - - - - - Event Data Links - RW - Multiple - Mandatory - Objlnk - - - - - - Latest Eventlog - R - Multiple - Mandatory - Opaque - - - - - - Schedule - RW - Single - Mandatory - Objlnk - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10264.xml b/common/transport/lwm2m/src/main/resources/models/10264.xml deleted file mode 100644 index eeaad07447..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10264.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - Delivery Schedule - - 10264 - urn:oma:lwm2m:x:10264 - Multiple - Optional - - - Schedule Start Time - RW - Single - Mandatory - Integer - - - - - - Schedule UTC Offset - RW - Single - Mandatory - String - - - - - - Delivery Frequency - RW - Single - Mandatory - Integer - - - - - - Randomised Delivery Window - RW - Single - Optional - Integer - - - - - - Number of Retries - RW - Single - Optional - Integer - - - - - - Retry Period - RW - Single - Optional - Integer - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10265.xml b/common/transport/lwm2m/src/main/resources/models/10265.xml deleted file mode 100644 index 26657bb754..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10265.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - Leakage Detection Configuration - - 10265 - urn:oma:lwm2m:x:10265 - Single - Optional - - - Sample Times - RW - Multiple - Mandatory - Integer - - - - - - Sample UTC Offset - RW - Single - Optional - String - - - - - - Detection Mode - RW - Single - Mandatory - Integer - 0..3 - - - - - Top Frequency Count - RW - Single - Optional - Integer - - - - - - Frequency Thresholds - RW - Multiple - Optional - Integer - 0..999 - - - - - Frequency Values - R - Multiple - Optional - Integer - - - - - - Firmware Version - R - Single - Mandatory - String - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10266.xml b/common/transport/lwm2m/src/main/resources/models/10266.xml deleted file mode 100644 index 57f7285b84..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10266.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Water Flow Readings - - 10266 - urn:oma:lwm2m:x:10266 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10267.xml b/common/transport/lwm2m/src/main/resources/models/10267.xml deleted file mode 100644 index 3c6734723f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10267.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Daily Maximum Flow Rate Readings - - 10267 - urn:oma:lwm2m:x:10267 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10268.xml b/common/transport/lwm2m/src/main/resources/models/10268.xml deleted file mode 100644 index 9a6d06262e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10268.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Temperature Readings - - 10268 - urn:oma:lwm2m:x:10268 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10269.xml b/common/transport/lwm2m/src/main/resources/models/10269.xml deleted file mode 100644 index 648227a7d7..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10269.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Pressure Readings - - 10269 - urn:oma:lwm2m:x:10269 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10270.xml b/common/transport/lwm2m/src/main/resources/models/10270.xml deleted file mode 100644 index 69e3e7e5f3..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10270.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Battery Level Readings - - 10270 - urn:oma:lwm2m:x:10270 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10271.xml b/common/transport/lwm2m/src/main/resources/models/10271.xml deleted file mode 100644 index f33a3d27e6..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10271.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - Communications Activity Time Readings - - 10271 - urn:oma:lwm2m:x:10271 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10272.xml b/common/transport/lwm2m/src/main/resources/models/10272.xml deleted file mode 100644 index d70236947b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10272.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Meter Customer Leakage Alarm - - 10272 - urn:oma:lwm2m:x:10272 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10273.xml b/common/transport/lwm2m/src/main/resources/models/10273.xml deleted file mode 100644 index 55404b38d5..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10273.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Meter Reverse Flow Alarm - - 10273 - urn:oma:lwm2m:x:10273 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10274.xml b/common/transport/lwm2m/src/main/resources/models/10274.xml deleted file mode 100644 index e0f9de62dc..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10274.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Meter Empty Pipe Alarm - - 10274 - urn:oma:lwm2m:x:10274 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10275.xml b/common/transport/lwm2m/src/main/resources/models/10275.xml deleted file mode 100644 index d0bc4dd350..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10275.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Meter Tamper Alarm - - 10275 - urn:oma:lwm2m:x:10275 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10276.xml b/common/transport/lwm2m/src/main/resources/models/10276.xml deleted file mode 100644 index 24f0e0056a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10276.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Meter High Pressure Alarm - - 10276 - urn:oma:lwm2m:x:10276 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10277.xml b/common/transport/lwm2m/src/main/resources/models/10277.xml deleted file mode 100644 index 07e431b9da..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10277.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Meter Low Pressure Alarm - - 10277 - urn:oma:lwm2m:x:10277 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10278.xml b/common/transport/lwm2m/src/main/resources/models/10278.xml deleted file mode 100644 index 9070e1c70e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10278.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - High Temperature Alarm - - 10278 - urn:oma:lwm2m:x:10278 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10279.xml b/common/transport/lwm2m/src/main/resources/models/10279.xml deleted file mode 100644 index 6eef195800..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10279.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Low Temperature Alarm - - 10279 - urn:oma:lwm2m:x:10279 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10280.xml b/common/transport/lwm2m/src/main/resources/models/10280.xml deleted file mode 100644 index 0fe4976077..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10280.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Water Network Leak Alarm - - 10280 - urn:oma:lwm2m:x:10280 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10281.xml b/common/transport/lwm2m/src/main/resources/models/10281.xml deleted file mode 100644 index a02a83e348..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10281.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Low Battery Alarm - - 10281 - urn:oma:lwm2m:x:10281 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10282.xml b/common/transport/lwm2m/src/main/resources/models/10282.xml deleted file mode 100644 index d7c97729b8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10282.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Daughter Board Failure Alarm - - 10282 - urn:oma:lwm2m:x:10282 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10283.xml b/common/transport/lwm2m/src/main/resources/models/10283.xml deleted file mode 100644 index 6e4df48342..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10283.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Device Reboot Event - - 10283 - urn:oma:lwm2m:x:10283 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10284.xml b/common/transport/lwm2m/src/main/resources/models/10284.xml deleted file mode 100644 index 964df21df9..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10284.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - Time Synchronisation Event - - 10284 - urn:oma:lwm2m:x:10284 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10286.xml b/common/transport/lwm2m/src/main/resources/models/10286.xml deleted file mode 100644 index 39e0809788..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10286.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - App Fota Container - - 10286 - urn:oma:lwm2m:x:10286 - 1.0 - 1.0 - Single - Optional - - - UL data - R - Single - Mandatory - Opaque - - - - - - - - DL data - W - Single - Mandatory - Opaque - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10290.xml b/common/transport/lwm2m/src/main/resources/models/10290.xml deleted file mode 100644 index 7b89cc06c0..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10290.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - Voltage Logging - - 10290 - urn:oma:lwm2m:x:10290 - 1.0 - 1.0 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10291.xml b/common/transport/lwm2m/src/main/resources/models/10291.xml deleted file mode 100644 index a232ed02f9..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10291.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - Voltage Transient - - 10291 - urn:oma:lwm2m:x:10291 - 1.0 - 1.0 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Mandatory - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Mandatory - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - Sample Frequency - RW - Single - Mandatory - Float - 0.0..86400.0 - s - How often the inputs are read/sampled.This value can be changed by doing a write command - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10292.xml b/common/transport/lwm2m/src/main/resources/models/10292.xml deleted file mode 100644 index 00fe33e320..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10292.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - Pressure Transient - - 10292 - urn:oma:lwm2m:x:10292 - 1.0 - 1.0 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Mandatory - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Mandatory - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - Sample Frequency - RW - Single - Mandatory - Float - 0.0..86400.0 - s - How often the inputs are read/sampled.This value can be changed by doing a write command - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10299.xml b/common/transport/lwm2m/src/main/resources/models/10299.xml deleted file mode 100644 index 2c4ea4d2db..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10299.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - HostDevice - This LWM2M Object provides a range of host device related information which can be queried by the LWM2M Server. The host device is any integrated device with an embedded cellular radio module. - 10299 - urn:oma:lwm2m:x:10299 - 1.0 - 1.0 - Single - Optional - - - Manufacturer - R - Single - Mandatory - String - - - Host device manufacturers name (OEM). - - - Model - R - Single - Mandatory - String - - Identifier of the model name or number determined by device manufacturer. - UniqueID - R - Single - Mandatory - String - - - Unique ID assigned by an manufacturer or other body. Used to uniquely identify a host device. Examples include serial # or UUID. - - - FirmwareVersion - R - Single - Mandatory - String - - - Current Firmware version of the host device. (manufacturer specified string). - - SoftwareVersion - R - Single - Optional - String - - - Current software version of the host device. (manufacturer specified string). - - HardwareVersion - R - Single - Optional - String - - - Current hardware version of the host device. (manufacturer specified string). - - - DateStamp - R - Single - Optional - String - - - UTC value of the time and date of the last Firmware or Software update. Format:MM:DD:YYYY HH:MM:SS - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10300.xml b/common/transport/lwm2m/src/main/resources/models/10300.xml deleted file mode 100644 index b290057806..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10300.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - LWM2M Meta Object - - - - 10300 - urn:oma:lwm2m:x:10300 - 1.0 - 1.0 - Multiple - Optional - - - ObjectID - R - Single - Mandatory - Integer - - - - - - - - ObjectURN - R - Single - Mandatory - String - - - - - - - - ObjectInstanceHandle - R - Single - Optional - Objlnk - - - - - - - - URI - R - Multiple - Mandatory - String - - - - - - - - SHAType - R - Single - Optional - Integer - 0..8 - - - - - - - ChecksumValue - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10308-2_0.xml b/common/transport/lwm2m/src/main/resources/models/10308-2_0.xml deleted file mode 100644 index 0ed1a6ea30..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10308-2_0.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - AT&T Connectivity Extension - - 10308 - urn:oma:lwm2m:x:10308:2.0 - 1.0 - 2.0 - Multiple - Optional - - - ICCID - R - Single - Mandatory - String - - - - - - - IMSI - R - Single - Mandatory - String - - - - - - - MSISDN - RW - Single - Mandatory - String - - - - - - - APN Retries - RW - Single - Mandatory - Integer - - - - - - - APN Retry Period - RW - Single - Mandatory - Integer - - - s - - - - APN Retry Back-Off Period - RW - Single - Mandatory - Integer - - - s - - - - SINR - R - Single - Mandatory - Integer - <7 to >12.5 - - - - - SRXLEV - R - Single - Mandatory - Integer - - - - - - - CE_LEVEL - R - Single - Mandatory - Integer - 0,1,2 - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10309.xml b/common/transport/lwm2m/src/main/resources/models/10309.xml deleted file mode 100644 index 333580200e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10309.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - Shareparkinglot - - 10309 - urn:oma:lwm2m:x:10309 - 1.0 - 1.0 - Multiple - Optional - - - LockID - R - Single - Mandatory - Integer - - - - - - LockType - R - Single - Optional - String - - - - - - LightSwitchState - R - Multiple - Optional - Boolean - - - - - - RSSI - R - Multiple - Mandatory - Integer - -30..-120 - dBm - - - - BatteryCapacity - R - Multiple - Optional - Float - 0..100 - %EL - - - - DataUpTime - R - Multiple - Mandatory - Time - - - - - - Latitude - R - Multiple - Optional - String - - - - - - Longitude - R - Multiple - Optional - String - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10311.xml b/common/transport/lwm2m/src/main/resources/models/10311.xml deleted file mode 100644 index e622197164..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10311.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - Solar Radiation - - This object is used to report solar irradiance (SI), i.e. power per unit area received from the Sun in the form of electromagnetic radiation, on a planar surface measured by a pyranometer or similar instrument. A pyranometer measures solar irradiance from the hemisphere above within a wavelength range 0.3 μm to 3 μm. For example, the application of solar radiation measurement can be meteorological networks and solar energy applications. - - 10311 - urn:oma:lwm2m:x:10311 - 1.0 - 1.0 - Multiple - Optional - - - Min Measured Value - R - Single - Optional - Float - - - - The minimum value measured by the sensor since it is ON or Reset, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Max Measured Value - R - Single - Optional - Float - - - - The maximum value measured by the sensor since it is ON or Reset, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Min Range Value - R - Single - Optional - Float - - - - The minimum value that can be measured by the sensor, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Max Range Value - R - Single - Optional - Float - - - - The maximum value that can be measured by the sensor, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Reset Min and Max Measured Values - E - Single - Optional - - - - - Reset the Min and Max Measured Values to current value. - - - - Timestamp - R - Single - Optional - Time - - - The timestamp of when the measurement was performed. - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor expressed in the unit defined by the "Sensor Units" resource if present. - - - Sensor Units - R - Single - Optional - String - - - - Measurement Units Definition. - - - - Application Type - RW - Single - Optional - String - - - - The application type of the sensor or actuator as a string, for instance "Air Pressure". - - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10313.xml b/common/transport/lwm2m/src/main/resources/models/10313.xml deleted file mode 100644 index 4875e5d6b0..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10313.xml +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - Gas Readings - - 10313 - urn:oma:lwm2m:x:103131.0 - 1.0Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - Sensor Warm-up Time - RW - Single - Optional - Integer - 0..86400 - s - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10314.xml b/common/transport/lwm2m/src/main/resources/models/10314.xml deleted file mode 100644 index 69f344ea34..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10314.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - Particulates - - 10314 - urn:oma:lwm2m:x:10314 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - - - - Min Measured Value - R - Single - Optional - Float - - - - - - Max Measured Value - R - Single - Optional - Float - - - - - - Max Range Value - R - Single - Optional - Float - - - - - - Sensor Units - R - Single - Optional - String - - - - - - Application Type - RW - Single - Optional - String - - - The Application type of the device, for example “Particulate Sensor”. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - - - - Measured Particle Size - R - Single - Mandatory - Float - - m - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10315.xml b/common/transport/lwm2m/src/main/resources/models/10315.xml deleted file mode 100644 index fcca456342..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10315.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - Robot - - 10315 - urn:oma:lwm2m:x:10315 - 1.0 - 1.0 - Single - Mandatory - - - Robot ID - R - Single - Mandatory - String - 0..255 - - - - - Robot Type - R - Single - Mandatory - String - 0..63 - - - - - Robot Serial Number - R - Single - Mandatory - String - 0..63 - - - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - % - - - - Charging - R - Single - Mandatory - Boolean - - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - Positioning - R - Single - Optional - Boolean - - - - - - Location - R - Single - Optional - Objlnk - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10316.xml b/common/transport/lwm2m/src/main/resources/models/10316.xml deleted file mode 100644 index 011055fde3..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10316.xml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - RCU - - 10316 - urn:oma:lwm2m:x:10316 - 1.0 - 1.0 - Single - Mandatory - - - RCU ID - R - Single - Mandatory - String - 0..127 - - - - - RCU Serial Number - R - Single - Mandatory - String - 0..63 - - - - - RCU Software Version - R - Single - Mandatory - String - 0..63 - - - - - RCU OS Version - R - Single - Mandatory - String - 0..127 - - - - - RCU CPU Info - R - Single - Mandatory - String - 64 - - - - - RCU RAM Info - R - Single - Mandatory - String - 64 - - - - - RCU ROM Size - R - Single - Mandatory - Integer - - GB - - - - RCU ROM Available Size - R - Single - Mandatory - Integer - - GB - - - - SD Storage - R - Single - Mandatory - Integer - - GB - - - - SD Available Storage - R - Single - Mandatory - Integer - - GB - - - - RCU GPS Location - R - Single - Optional - Objlnk - - - - - - Wi-Fi MAC - R - Single - Optional - String - 12 - - - - - Bluetooth MAC - R - Single - Optional - String - 12 - - - - - Camera Info - R - Single - Optional - String - 64 - - - - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - /100 - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - - Downloaded APP Packages - R - Multiple - Mandatory - String - - - - - - - RCU APPs - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10318.xml b/common/transport/lwm2m/src/main/resources/models/10318.xml deleted file mode 100644 index 989db0de7e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10318.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - RCU PM - - 10318 - urn:oma:lwm2m:x:10318 - 1.0 - 1.0 - Single - Mandatory - - - CPU Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Max CPU Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Memory Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Storage Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Network Bandwidth - R - Single - Mandatory - Float - - Mbit/s - - - - Mobile Signal - R - Single - Mandatory - Integer - - - - - - GPS Signal - R - Single - Optional - Integer - - - - - - Wi-Fi Signal - R - Single - Mandatory - Integer - - - - - - UpLink Rate - R - Single - Mandatory - Float - - Mbit/s - - - - DownLink Rate - R - Single - Mandatory - Float - - Mbit/s - - - - Packet Loss Rate - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Network Latency - R - Single - Mandatory - Integer - - ms - - - - - Battery Temperature - R - Single - Mandatory - Float - - Cel - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10319.xml b/common/transport/lwm2m/src/main/resources/models/10319.xml deleted file mode 100644 index b8ebcef6fb..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10319.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - RCU Control - - 10319 - urn:oma:lwm2m:x:10319 - 1.0 - 1.0 - Single - Mandatory - - - RCU Diagnostics Mode - R - Single - Optional - Boolean - - - - - - RCU Log Recording - R - Single - Optional - Boolean - - - - - - - RCU Shutdown - E - Single - Mandatory - - - - - - - RCU Restart - E - Single - Mandatory - - - - - - - RCU Deactivate - E - Single - Mandatory - - - - - - - RCU Reset - E - Single - Mandatory - - - - - - - RCU Diagnostics Mode Control - E - Single - Mandatory - - - - - - - RCU Log Recording Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10320.xml b/common/transport/lwm2m/src/main/resources/models/10320.xml deleted file mode 100644 index 2b46d7c920..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10320.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - CCU - - 10320 - urn:oma:lwm2m:x:10320 - 1.0 - 1.0 - Multiple - Optional - - - CCU ID - R - Single - Mandatory - String - - - - - - CCU FM Version - R - Single - Mandatory - String - - - - - - CCU SW Version - R - Single - Mandatory - String - - - - - - CCU Memory Size - R - Single - Mandatory - Integer - - GB - - - - CCU Storage - R - Single - Mandatory - Integer - - GB - - - - CCU Available Storage - R - Single - Mandatory - Integer - - GB - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - - Downloaded APP Packages - R - Multiple - Optional - String - - - - - - CCU APPs - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10322.xml b/common/transport/lwm2m/src/main/resources/models/10322.xml deleted file mode 100644 index 98822e0efe..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10322.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - CCU PM - - 10322 - urn:oma:lwm2m:x:10322 - 1.0 - 1.0 - Multiple - Optional - - - CPU Usage - R - Single - Optional - Integer - 0..100 - % - - - - Max CPU Usage - R - Single - Optional - Integer - 0..100 - % - - - - Memory Usage - R - Single - Optional - Integer - 0..100 - % - - - - Storage Usage - R - Single - Optional - Integer - 0..100 - % - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10323.xml b/common/transport/lwm2m/src/main/resources/models/10323.xml deleted file mode 100644 index dcbdaeb91d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10323.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - CCU Control - - 10323 - urn:oma:lwm2m:x:10323 - 1.0 - 1.0 - Multiple - Optional - - - - CCU Restart - E - Single - Mandatory - - - - - - - CCU Reset - E - Single - Mandatory - - - - - - - CCU Self-checking - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10324.xml b/common/transport/lwm2m/src/main/resources/models/10324.xml deleted file mode 100644 index e78bb099de..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10324.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - ECU - - 10324 - urn:oma:lwm2m:x:10324 - 1.0 - 1.0 - Multiple - Optional - - - ECU ID - R - Single - Mandatory - String - - - - - - ECU FM Version - R - Single - Mandatory - String - - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10326.xml b/common/transport/lwm2m/src/main/resources/models/10326.xml deleted file mode 100644 index 353e549829..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10326.xml +++ /dev/null @@ -1,722 +0,0 @@ - - - - - - Robot PM - - 10326 - urn:oma:lwm2m:x:10326 - 1.0 - 1.0 - Single - Mandatory - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - /100 - - - - - Battery Temperature - R - Single - Mandatory - Integer - - Cel - - - - Temperature - R - Single - Optional - Float - - Cel - - - - Humidity - R - Single - Optional - Integer - 0..100 - /100 - - - - PM2.5 - R - Single - Optional - Integer - - ug/m3 - - - - Smog - R - Single - Optional - Float - - ug/m3 - - - - CO - R - Single - Optional - Float - - ppm - - - - CO2 - R - Single - Optional - Float - - ppm - - - - PM10 - R - Single - Optional - Integer - - ug/m3 - - - - Speed - R - Single - Optional - Float - - m/h - - - - Water Used - R - Single - Optional - Integer - 0..100 - /100 - - - - Dust Box Used - R - Single - Optional - Integer - 0..100 - /100 - - - - Obstacle Distance - R - Single - Optional - Integer - - cm - - - - - Robot Temperate - R - Single - Optional - Float - - Cel - - - - Confidence Index - R - Single - Optional - Integer - 0..100 - /100 - - - - - Data Traffic Used - R - Single - Mandatory - Float - - Mbit/s - - - - Images Handled - R - Single - Optional - Integer - - - - - - HARI S-Voice Requests - R - Single - Optional - Integer - - - - - - HARI S-Vision Requests - R - Single - Optional - Integer - - - - - - HARI S-Motion Requests - R - Single - Optional - Integer - - - - - - HARI S-Map Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Voice Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Vision Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Motion Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Map Requests - R - Single - Optional - Integer - - - - - - Questions Answered - R - Single - Optional - Integer - - - - - - Unknown Questions - R - Single - Optional - Integer - - - - - - Mileage - R - Single - Optional - Integer - - m - - - - Cleaned Times - R - Single - Optional - Integer - - - - - - Cleaned Area - R - Single - Optional - Float - - m2 - - - - Cleaned Time - R - Single - Optional - Integer - - s - - - - ASR Recognized - R - Single - Optional - Integer - - B - - - - Incorrect ASR Recognitions - R - Single - Optional - Integer - - B - - - - Tried TTS Texts - R - Single - Optional - Integer - - B - - - - Successful TTS Texts - R - Single - Optional - Integer - - B - - - - ASR Recognized (CH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (CH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (CH) - R - Single - Optional - Integer - - B - - - - ASR Recognized (EN) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (EN) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (EN) - R - Single - Optional - Integer - - B - - - - ASR Recognized (ES) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (ES) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (ES) - R - Single - Optional - Integer - - B - - - - ASR Recognized (JA) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (JA) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (JA) - R - Single - Optional - Integer - - B - - - - ASR Recognized (SCCH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (SCCH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (SCCH) - R - Single - Optional - Integer - - B - - - - ASR Recognized (GDCH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (GDCH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (GDCH) - R - Single - Optional - Integer - - B - - - - ASR Recognized (TCH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (TCH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (TCH) - R - Single - Optional - Integer - - B - - - - - Objects Recognition Tries - R - Single - Optional - Integer - - - - - - Successful Object Recognition - R - Single - Optional - Integer - - - - - - Face Recognition Tries - R - Single - Optional - Integer - - - - - - Successful Face Recognitions - R - Single - Optional - Integer - - - - - - Vehicle Plate Recognition Tries - R - Single - Optional - Integer - - - - - - Successful Vehicle Plate Recognitions - R - Single - Optional - Integer - - - - - - Tasks Assigned - R - Single - Mandatory - Integer - - - - - - Successful Tasks Executed - R - Single - Mandatory - Integer - - - - - - Images Uploaded - R - Single - Optional - Integer - - - - - - Videos Uploaded - R - Single - Optional - Integer - - - - - - Images Matted - R - Single - Optional - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10327.xml b/common/transport/lwm2m/src/main/resources/models/10327.xml deleted file mode 100644 index 5f0e232a22..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10327.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - Compressor - - 10327 - urn:oma:lwm2m:x:10327 - 1.0 - 1.0 - Multiple - Optional - - - Compressor Name - R - Single - Mandatory - String - - - - - - - Compressor Status - R - Single - Mandatory - Boolean - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10328.xml b/common/transport/lwm2m/src/main/resources/models/10328.xml deleted file mode 100644 index fdf39d5dc1..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10328.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - SCA PM - - 10328 - urn:oma:lwm2m:x:10328 - 1.0 - 1.0 - Multiple - Optional - - - SCA Name - R - Single - Mandatory - String - - - - - - - - - SCA Current - R - Single - Mandatory - Float - - A - - - - SCA Temperate - R - Single - Mandatory - Float - - Cel - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10329.xml b/common/transport/lwm2m/src/main/resources/models/10329.xml deleted file mode 100644 index 7470bec6e1..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10329.xml +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - Robot Control - - 10329 - urn:oma:lwm2m:x:10329 - 1.0 - 1.0 - Single - Mandatory - - - Collision Detection - R - Single - Optional - Boolean - - - - - - Drop Detection - R - Single - Optional - Boolean - - - - - - Automatic Navigation - R - Single - Optional - Boolean - - - - - - Robot Shutdown - E - Single - Mandatory - - - - - - - Robot Reboot - E - Single - Mandatory - - - - - - - Robot Reset - E - Single - Mandatory - - - - - - - Robot Wakeup - E - Single - Mandatory - - - - - - - Robot Sleep - E - Single - Mandatory - - - - - - - Robot Self-checking - E - Single - Mandatory - - - - - - - Emergency Braking - E - Single - Mandatory - - - - - - - Emergency Braking Release - E - Single - Mandatory - - - - - - - Action Execution - E - Single - Optional - - - - - - - Action List Upload - E - Single - Optional - - - - - - - Action List Download - E - Single - Optional - - - - - - - Group Dancing Program Control - E - Single - Optional - - - - - - - Navigation Map Upload - E - Single - Optional - - - - - - - Group Dancing Program Control - E - Single - Optional - - - - - - - Navigation Map Download - E - Single - Optional - - - - - - - Route list Execution - E - Single - Optional - - - - - - - Route list Upload - E - Single - Optional - - - - - - - Route list Download - E - Single - Optional - - - - - - - Automatic Navigation Control - E - Single - Optional - - - - - - - Manual Navigation - E - Single - Optional - - - - - - - Moving to Charging Station - E - Single - Optional - - - - - - - Moving to Specified location - E - Single - Optional - - - - - - - Low Frequency Patrol Broadcasting - E - Single - Optional - - - - - - - Task Start - E - Single - Optional - - - - - - - Task Stop - E - Single - Optional - - - - - - - Task Suspend - E - Single - Optional - - - - - - - Task Resume - E - Single - Optional - - - - - - - Video Upload - E - Single - Optional - - - - - - - Picture Upload - E - Single - Optional - - - - - - - Default Language Switching - E - Single - Optional - - - - - - - Intonation Change - E - Single - Optional - - - - - - - Intonation Change - E - Single - Optional - - - - - - - Speaking with Action - E - Single - Optional - - - - - - - Collision Detection Control - E - Single - Mandatory - - - - - - - Drop Detection Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10330.xml b/common/transport/lwm2m/src/main/resources/models/10330.xml deleted file mode 100644 index 75c5a2ecdd..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10330.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - Network Info - - 10330 - urn:oma:lwm2m:x:10330 - 1.0 - 1.0 - Single - Mandatory - - - IMEI - R - Single - Mandatory - String - 15 - - - - - IMSI - R - Single - Mandatory - String - 15 - - - - - Radio Connectivity - R - Single - Mandatory - Objlnk - - - - - - - - GPS Signal Status - R - Single - Optional - Integer - 1..4 - - - - - VBN Connection Status - R - Single - Mandatory - Integer - 0..1 - - - - - HARI Connection Status - R - Single - Mandatory - Integer - 0..1 - - - - - CCU Connection Status - R - Multiple - Optional - Integer - 0..1 - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10331.xml b/common/transport/lwm2m/src/main/resources/models/10331.xml deleted file mode 100644 index ca555cc0d9..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10331.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - Robot Service Info - - 10331 - urn:oma:lwm2m:x:10331 - 1.0 - 1.0 - Single - Mandatory - - - Current status - R - Single - Mandatory - String - 0..127 - - - - - Services Providing - R - Single - Optional - String - 0..127 - - - - - Advertising Contents - R - Single - Mandatory - String - - - - - - Current Language - R - Single - Optional - String - 0..127 - - - - - Volume - R - Single - Optional - String - 0..100 - /100 - - - - Moving Status - R - Single - Optional - Integer - 0..2 - - - - - Moving Speed - R - Single - Optional - Float - - m/h - - - - Location - R - Single - Optional - Objlnk - - - - - - - - Map List - R - Single - Optional - String - - - - - - Planned Route list - R - Single - Optional - String - - - - - - Current Route - R - Single - Optional - String - - - - - - Route to-do List - R - Single - Optional - String - - - - - - Synchronous Whistle - R - Single - Mandatory - Boolean - - - - - - Current Actions - R - Single - Optional - String - - - - - - ASR Type - R - Single - Optional - Integer - 0..2 - - - - - - TTS Vendor - R - Single - Optional - String - - - - - - TTS Speaker - R - Single - Optional - String - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10332.xml b/common/transport/lwm2m/src/main/resources/models/10332.xml deleted file mode 100644 index 6bda413092..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10332.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - Robot Selfcheck Info - - 10332 - urn:oma:lwm2m:x:10332 - 1.0 - 1.0 - Multiple - Optional - - - Entity - R - Single - Mandatory - String - 4..63 - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10333.xml b/common/transport/lwm2m/src/main/resources/models/10333.xml deleted file mode 100644 index 3a1f1f6dfa..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10333.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - PM Threshold - - 10333 - urn:oma:lwm2m:x:10333 - 1.0 - 1.0 - Single - Optional - - - Entity - RW - Multiple - Mandatory - String - 4..63 - - - - - Performance Type - RW - Multiple - Mandatory - String - - - - - - High Threshold - RW - Multiple - Mandatory - Float - - - - - - Low Threshold - RW - Multiple - Mandatory - Float - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10334.xml b/common/transport/lwm2m/src/main/resources/models/10334.xml deleted file mode 100644 index 547fb7a0d5..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10334.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - Robot Alarm - - 10334 - urn:oma:lwm2m:x:10334 - 1.0 - 1.0 - Multiple - Optional - - - Entity - R - Single - Mandatory - String - 4..63 - - - - - Probable Cause - R - Single - Mandatory - Integer - 0..65535 - - - - - Specific Problem - R - Single - Mandatory - String - - - - - - Alarm Type - R - Single - Mandatory - Integer - 2..6 - - - - - Severity - R - Single - Mandatory - Integer - 1..5 - - - - - Report Time - R - Single - Mandatory - Time - - - - - - Sequence No - R - Single - Mandatory - Integer - 0..2^63-1 - - - - - Additional Info - R - Single - Optional - String - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10335.xml b/common/transport/lwm2m/src/main/resources/models/10335.xml deleted file mode 100644 index 49640154e8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10335.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - Event - - 10335 - urn:oma:lwm2m:x:10335 - 1.0 - 1.0 - Multiple - Optional - - - Entity - R - Single - Mandatory - String - 4..63 - - - - - Event Type - R - Single - Mandatory - Integer - 0..65535 - - - - - Time - R - Single - Mandatory - Time - - - - - - Sequence No - R - Single - Mandatory - Integer - 0..2^63-1 - - - - - Additional Info - R - Single - Optional - String - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10336.xml b/common/transport/lwm2m/src/main/resources/models/10336.xml deleted file mode 100644 index 74fae1916a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10336.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - MIC - - 10336 - urn:oma:lwm2m:x:10336 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10337.xml b/common/transport/lwm2m/src/main/resources/models/10337.xml deleted file mode 100644 index 3220c8e3e0..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10337.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - SCA - - 10337 - urn:oma:lwm2m:x:10337 - 1.0 - 1.0 - Multiple - Optional - - - SCA Name - R - Single - Mandatory - String - - - - - - - - - - SCA Motion Status - R - Single - Optional - Integer - 0..2 - - - - - - SCA Motion Control - E - Single - Optional - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10338.xml b/common/transport/lwm2m/src/main/resources/models/10338.xml deleted file mode 100644 index 48213fe176..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10338.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - Speaker - - 10338 - urn:oma:lwm2m:x:10338 - 1.0 - 1.0 - Single - Optional - - - Speaker status - R - Single - Mandatory - Boolean - - - - - - Voice Warning - R - Single - Mandatory - Boolean - - - - - - - Voice Control - E - Single - Mandatory - - - - - - - Voice Warning Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10339.xml b/common/transport/lwm2m/src/main/resources/models/10339.xml deleted file mode 100644 index d93e5fd778..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10339.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - Tripod Head - - 10339 - urn:oma:lwm2m:x:10339 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - Tripod Direction Control - E - Single - Optional - - - - - - - Tripod Automatic Control - E - Single - Optional - - - - - - - Tripod Reset - E - Single - Optional - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10340.xml b/common/transport/lwm2m/src/main/resources/models/10340.xml deleted file mode 100644 index 30123ba665..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10340.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - Camera - - 10340 - urn:oma:lwm2m:x:10340 - 1.0 - 1.0 - Multiple - Optional - - - Camera Name - R - Single - Mandatory - String - - - - - - - - Camera Status - R - Single - Mandatory - Boolean - - - - - - Connection Status - R - Single - Mandatory - Boolean - - - - - - Working Status - R - Single - Mandatory - Integer - 0..15 - - - - - Local Recording - R - Single - Mandatory - Boolean - - - - - - Image Matting - R - Single - Mandatory - Boolean - - - - - - Camera Snapshot - R - Single - Mandatory - Boolean - - - - - - Camera Recording - R - Single - Mandatory - Boolean - - - - - - - Camera Control - E - Single - Mandatory - - - - - - - Local Recording Control - E - Single - Mandatory - - - - - - - Image Matting Control - E - Single - Mandatory - - - - - - - Camera Snapshot Control - E - Single - Mandatory - - - - - - - Camera Recording Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10341.xml b/common/transport/lwm2m/src/main/resources/models/10341.xml deleted file mode 100644 index ca00c3ab0c..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10341.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - GPS - - 10341 - urn:oma:lwm2m:x:10341 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10342.xml b/common/transport/lwm2m/src/main/resources/models/10342.xml deleted file mode 100644 index 5a2c0d1982..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10342.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - IMU - - 10342 - urn:oma:lwm2m:x:10342 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10343.xml b/common/transport/lwm2m/src/main/resources/models/10343.xml deleted file mode 100644 index 309c80884d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10343.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - LiDAR - - 10343 - urn:oma:lwm2m:x:10343 - 1.0 - 1.0 - Multiple - Optional - - - LiDAR Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10344.xml b/common/transport/lwm2m/src/main/resources/models/10344.xml deleted file mode 100644 index 9e3f80a491..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10344.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - Arm - - 10344 - urn:oma:lwm2m:x:10344 - 1.0 - 1.0 - Multiple - Optional - - - Arm Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10345.xml b/common/transport/lwm2m/src/main/resources/models/10345.xml deleted file mode 100644 index 488ada316f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10345.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - Leg - - 10345 - urn:oma:lwm2m:x:10345 - 1.0 - 1.0 - Multiple - Optional - - - Leg Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10346.xml b/common/transport/lwm2m/src/main/resources/models/10346.xml deleted file mode 100644 index f5b22f8763..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10346.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - Servomotor - - 10346 - urn:oma:lwm2m:x:10346 - 1.0 - 1.0 - Multiple - Optional - - - Servomotor Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10347.xml b/common/transport/lwm2m/src/main/resources/models/10347.xml deleted file mode 100644 index 7c20b00a40..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10347.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - Screen - - 10347 - urn:oma:lwm2m:x:10347 - 1.0 - 1.0 - Single - Optional - - - Screen Status - R - Single - Mandatory - Boolean - - - - - - Startup Page - R - Single - Optional - String - - - The Startup Page of the screen. - - - Current Displaying Page or Current Screen Play List - R - Single - Optional - String - - - Current Displaying Page or Current Screen Play List. - - - - Screen Control - E - Single - Mandatory - - - - - - - Startup Page Set - E - Single - Mandatory - - - - - - - Screen Page Set - E - Single - Mandatory - - - - - - - Screen Play List Set - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10348.xml b/common/transport/lwm2m/src/main/resources/models/10348.xml deleted file mode 100644 index 3d8a2d460f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10348.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - Wheel - - 10348 - urn:oma:lwm2m:x:10348 - 1.0 - 1.0 - Multiple - Optional - - - Wheel Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10349.xml b/common/transport/lwm2m/src/main/resources/models/10349.xml deleted file mode 100644 index 8eb7d27ecf..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10349.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - Chassis - - 10349 - urn:oma:lwm2m:x:10349 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10350.xml b/common/transport/lwm2m/src/main/resources/models/10350.xml deleted file mode 100644 index 64295e65bc..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10350.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Light - - 10350 - urn:oma:lwm2m:x:10350 - 1.0 - 1.0 - Multiple - Optional - - - Light Name - R - Single - Mandatory - String - - - - - - - - Light Status - R - Single - Mandatory - Boolean - - - - - - - Light Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10351.xml b/common/transport/lwm2m/src/main/resources/models/10351.xml deleted file mode 100644 index 473b440b02..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10351.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - Door - - 10351 - urn:oma:lwm2m:x:10351 - 1.0 - 1.0 - Multiple - Optional - - - Door Name - R - Single - Mandatory - String - - - - - - - Door Status - R - Single - Mandatory - Boolean - - - - - - - Door Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10352.xml b/common/transport/lwm2m/src/main/resources/models/10352.xml deleted file mode 100644 index da1dac5834..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10352.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - Thermal Imager - - 10352 - urn:oma:lwm2m:x:10352 - 1.0 - 1.0 - Single - Optional - - - - Highest Temperature - R - Single - Mandatory - Float - -100.0..100.0 - Cel - The Highest Temperature of the thermal imager. - - - Lowest Temperature - R - Single - Mandatory - Float - -100.0..100.0 - Cel - The Lowest Temperature of the thermal imager. - - - Average Temperature - R - Single - Mandatory - Float - -100.0..100.0 - Cel - The Average Temperature of the thermal imager. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10353.xml b/common/transport/lwm2m/src/main/resources/models/10353.xml deleted file mode 100644 index 0b6bb56cc4..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10353.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - Warning Light - - 10353 - urn:oma:lwm2m:x:10353 - 1.0 - 1.0 - Single - Optional - - - Light Status - R - Single - Mandatory - Boolean - - - - - - Light Warning - R - Single - Mandatory - Boolean - - - - - - Light Control - E - Single - Mandatory - - - - - - - Light Warning Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10354.xml b/common/transport/lwm2m/src/main/resources/models/10354.xml deleted file mode 100644 index 3459409720..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10354.xml +++ /dev/null @@ -1,217 +0,0 @@ - - - - - - APP - - 10354 - urn:oma:lwm2m:x:10354 - 1.0 - 1.0 - Multiple - Mandatory - - - APP Name - RW - Single - Mandatory - String - - - The name of the APP, human readable string. - - - APP Version - RW - Single - Mandatory - String - - - The version of the APP, human readable string. - - - APP Build No - RW - Single - Optional - String - - - The Build No of the APP, human readable string. - - - APP Patch No - RW - Single - Optional - String - - - The Patch No of the APP, human readable string. - - - Package URI - W - Single - Optional - String - 0-255 bytes - - - - - Vendor Name - RW - Single - Optional - String - - - The vendor of the package. - - - Installation Target - RW - Single - Mandatory - Objlnk - - - - - - APP Status - R - Single - Mandatory - Integer - 0..5 - - The Status of the APP, 0:Downloading, 1:Downloaded, 2:Installed, 3:Verified, 4:Activated, 5:Stopped. - - - APP Restart - E - Single - Mandatory - - - - - - - APP Start - E - Single - Mandatory - - - - - - - APP Stop - E - Single - Mandatory - - - - - - - APP Download - E - Single - Mandatory - - - - - - - APP Install - E - Single - Mandatory - - - - - - - APP Uninstall - E - Single - Mandatory - - - - - - - APP Activate - E - Single - Mandatory - - - - - - - APP Deactivate - E - Single - Mandatory - - - - - - - APP Verify - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10355.xml b/common/transport/lwm2m/src/main/resources/models/10355.xml deleted file mode 100644 index fb38ee2767..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10355.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - General Info - - 10355 - urn:oma:lwm2m:x:10355 - 1.0 - 1.0 - Single - Optional - - - Robot General Info - R - Single - Mandatory - Objlnk - - - - - - - - RCU General Info - R - Single - Mandatory - Objlnk - - - - - - - - CCU General Info - R - Multiple - Optional - Objlnk - - - - - - - - ECU General Info - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10356.xml b/common/transport/lwm2m/src/main/resources/models/10356.xml deleted file mode 100644 index 2e362ce052..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10356.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - Service Info - - 10356 - urn:oma:lwm2m:x:10356 - 1.0 - 1.0 - Single - Optional - - - Robot Service Info - R - Single - Mandatory - Objlnk - - - - - - - - SCA Info - R - Multiple - Optional - Objlnk - - - - - - - - Speaker Info - R - Single - Optional - Objlnk - - - - - - - - Camera Info - R - Multiple - Optional - Objlnk - - - - - - - - Screen Info - R - Single - Optional - Objlnk - - - - - - - - Light Info - R - Multiple - Optional - Objlnk - - - - - - - - Warning Light Info - R - Single - Optional - Objlnk - - - - - - - - Door Info - R - Multiple - Optional - Objlnk - - - - - - - - Thermal Imager Info - R - Single - Optional - Objlnk - - - - - - - - Compressor Info - R - Multiple - Optional - Objlnk - - - - - - - - Lock Info - R - Multiple - Optional - Objlnk - - - - - - - - Collision Sensor Info - R - Multiple - Optional - Objlnk - - - - - - - - Drop Sensor Info - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10357.xml b/common/transport/lwm2m/src/main/resources/models/10357.xml deleted file mode 100644 index 9487b2813d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10357.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - PM - - 10357 - urn:oma:lwm2m:x:10357 - 1.0 - 1.0 - Single - Optional - - - Robot PM - R - Single - Mandatory - Objlnk - - - - - - - - RCU PM - R - Single - Mandatory - Objlnk - - - - - - - - CCU PM - R - Multiple - Optional - Objlnk - - - - - - - - SCA PM - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10358.xml b/common/transport/lwm2m/src/main/resources/models/10358.xml deleted file mode 100644 index 27a3684b22..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10358.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - Fan PM - - 10358 - urn:oma:lwm2m:x:10358 - 1.0 - 1.0 - Multiple - Optional - - - Fan Name - R - Single - Mandatory - String - - - - - - - - - Fan Speed - R - Single - Optional - Integer - - 1/min - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10359.xml b/common/transport/lwm2m/src/main/resources/models/10359.xml deleted file mode 100644 index 2fc8af9677..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10359.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - Lock - - 10359 - urn:oma:lwm2m:x:10359 - 1.0 - 1.0 - Multiple - Optional - - - Lock Name - R - Single - Mandatory - String - - - - - - Lock Status - R - Single - Optional - Boolean - - - - - - - Lock Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10360.xml b/common/transport/lwm2m/src/main/resources/models/10360.xml deleted file mode 100644 index 935fea848c..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10360.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - Ultrasonic Sensor - - 10360 - urn:oma:lwm2m:x:10360 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10361.xml b/common/transport/lwm2m/src/main/resources/models/10361.xml deleted file mode 100644 index 3525647afd..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10361.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - Collision Sensor - - 10361 - urn:oma:lwm2m:x:10361 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - - Collision Detection - R - Single - Optional - Boolean - - - - - - - Collision Detection Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10362.xml b/common/transport/lwm2m/src/main/resources/models/10362.xml deleted file mode 100644 index 8a928e4425..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10362.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - Drop Sensor - - 10362 - urn:oma:lwm2m:x:10362 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - Drop Detection - R - Single - Optional - Boolean - - - - - - - Drop Detection Control - E - Single - Mandatory - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10363.xml b/common/transport/lwm2m/src/main/resources/models/10363.xml deleted file mode 100644 index ca9d064f2f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10363.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - Temperature Sensor - - 10363 - urn:oma:lwm2m:x:10363 - 1.0 - 1.0 - Single - Optional - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10364.xml b/common/transport/lwm2m/src/main/resources/models/10364.xml deleted file mode 100644 index 3519665e62..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10364.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - Humidity Sensor - - 10364 - urn:oma:lwm2m:x:10364 - 1.0 - 1.0 - Single - Optional - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10365.xml b/common/transport/lwm2m/src/main/resources/models/10365.xml deleted file mode 100644 index 792844271e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10365.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - Gas-Dust Sensor - - 10365 - urn:oma:lwm2m:x:10365 - 1.0 - 1.0 - Single - Optional - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10366.xml b/common/transport/lwm2m/src/main/resources/models/10366.xml deleted file mode 100644 index 44e94ae51d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10366.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - Fan - - 10366 - urn:oma:lwm2m:x:10366 - 1.0 - 1.0 - Multiple - Optional - - - Fan Name - R - Single - Mandatory - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10368.xml b/common/transport/lwm2m/src/main/resources/models/10368.xml deleted file mode 100644 index f063e010fe..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10368.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - SpringMotor - - 10368 - urn:oma:lwm2m:x:10368 - 1.0 - 1.0 - Multiple - Optional - - - SpringMotor Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/10369.xml b/common/transport/lwm2m/src/main/resources/models/10369.xml deleted file mode 100644 index 68c345beaf..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/10369.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - MCU - - 10369 - urn:oma:lwm2m:x:10369 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2048.xml b/common/transport/lwm2m/src/main/resources/models/2048.xml deleted file mode 100644 index 0bc99cffd1..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2048.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - CmdhPolicy - - 2048 - urn:oma:lwm2m:ext:20481.0 - 1.0Multiple - Optional - - Name - RW - Single - Mandatory - String - - - - - DefaultRule - RW - Single - Mandatory - Objlnk - - - - - LimiRules - RW - Multiple - Mandatory - Objlnk - - - - - NetworkAccessECRules - RW - Multiple - Mandatory - Objlnk - - - - - BufferRules - RW - Multiple - Mandatory - Objlnk - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2049.xml b/common/transport/lwm2m/src/main/resources/models/2049.xml deleted file mode 100644 index 7509b22160..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2049.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - ActiveCmdhPolicy - - 2049 - urn:oma:lwm2m:ext:20491.0 - 1.0Single - Optional - - ActiveLink - RW - Single - Mandatory - Objlnk - - - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2050.xml b/common/transport/lwm2m/src/main/resources/models/2050.xml deleted file mode 100644 index da27a90de0..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2050.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - CmdhDefaults - - 2050 - urn:oma:lwm2m:ext:20501.0 - 1.0Multiple - Optional - - DefaultEcRules - RW - Multiple - Mandatory - Objlnk - - - - - - DefaultEcParamRules - RW - Multiple - Mandatory - Objlnk - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2051.xml b/common/transport/lwm2m/src/main/resources/models/2051.xml deleted file mode 100644 index f3904e8a2c..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2051.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - CmdhDefEcValues - - 2051 - urn:oma:lwm2m:ext:20511.0 - 1.0Multiple - Optional - - Order - RW - Single - Mandatory - Integer - - - - - DefEcValue - RW - Single - Mandatory - String - - - - - RequestOrigin - RW - Multiple - Mandatory - String - - - - - RequestContext - RW - Single - Optional - String - - - - - RequestContextNotification - RW - Single - Optional - Boolean - - - - - RequestCharacteristics - RW - Single - Optional - String - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2052.xml b/common/transport/lwm2m/src/main/resources/models/2052.xml deleted file mode 100644 index abaae1b54e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2052.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - CmdhEcDefParamValues - - 2052 - urn:oma:lwm2m:ext:20521.0 - 1.0Multiple - Optional - - ApplicableEventCategory - RW - Multiple - Mandatory - Integer - - - - - DefaultRequestExpTime - RW - Single - Mandatory - Integer - - ms - - - - - - - - - DefaultResultExpTime - RW - Single - Mandatory - Integer - - ms - - - - DefaultOpExecTime - RW - Single - Mandatory - Integer - - ms - - - DefaultRespPersistence - RW - Single - Mandatory - Integer - - ms - - - DefaultDelAggregation - RW - Single - Mandatory - Integer - - ms - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2053.xml b/common/transport/lwm2m/src/main/resources/models/2053.xml deleted file mode 100644 index 0b119c70fc..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2053.xml +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - CmdhLimits - - 2053 - urn:oma:lwm2m:ext:20531.0 - 1.0Multiple - Optional - - Order - RW - Single - Mandatory - Integer - - - - - RequestOrigin - RW - Multiple - Mandatory - String - - - - - - - - - - - RequestContext - RW - Single - Optional - String - - - - - - RequestContextNotificatio - RW - Single - Optional - Boolean - - - - - RequestCharacteristics - RW - Single - Optional - String - - - - - LimitsEventCategory - RW - Multiple - Mandatory - Integer - - - - - LimitsRequestExpTime - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsResultExpTime - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsOptExpTime - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsRespPersistence - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsDelAggregation - RW - Multiple - Mandatory - String - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2054.xml b/common/transport/lwm2m/src/main/resources/models/2054.xml deleted file mode 100644 index 3935fb7253..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2054.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - CmdhNetworkAccessRules - - 2054 - urn:oma:lwm2m:ext:20541.0 - 1.0Multiple - Optional - - ApplicableEventCategories - RW - Multiple - Mandatory - Integer - - - - - NetworkAccessRule - RW - Multiple - Optional - Objlnk - - - - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2055.xml b/common/transport/lwm2m/src/main/resources/models/2055.xml deleted file mode 100644 index cbd0dc5796..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2055.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - CmdhNwAccessRule - - 2055 - urn:oma:lwm2m:ext:20551.0 - 1.0Multiple - Optional - - TargetNetwork - RW - Multiple - Mandatory - String - - - - - SpreadingWaitTime - RW - Single - Mandatory - Integer - - ms - - - MinReqVolume - RW - Single - Mandatory - Integer - - B - - - BackOffParameters - RW - Single - Mandatory - Objlnk - - - - - OtherConditions - RW - Single - Mandatory - String - - - - - AllowedSchedule - RW - Multiple - Mandatory - String - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2056.xml b/common/transport/lwm2m/src/main/resources/models/2056.xml deleted file mode 100644 index ddd50e269a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2056.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - CmdhBuffer - - 2056 - urn:oma:lwm2m:ext:20561.0 - 1.0Multiple - Optional - - ApplicableEventCategory - RW - Multiple - Mandatory - Integer - - - - - MaxBufferSize - RW - Single - Mandatory - Integer - - B - - - StoragePriority - RW - Single - Mandatory - Integer - 1..10 - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/2057.xml b/common/transport/lwm2m/src/main/resources/models/2057.xml deleted file mode 100644 index 68d4bcd135..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/2057.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - CmdhBackOffParametersSet - - 2057 - urn:oma:lwm2m:ext:2057 - 1.0 - 1.0 - Multiple - Optional - - NetworkAction - RW - Single - Optional - Integer - 1..5 - - - - InitialBackoffTime - RW - Single - Mandatory - Integer - - ms - - - AdditionalBackoffTime - RW - Single - Mandatory - Integer - - ms - - - MaximumBackoffTime - RW - Single - Mandatory - Integer - - ms - - - OptionalRandomBackoffTime - RW - Multiple - Optional - Integer - - ms - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/31024.xml b/common/transport/lwm2m/src/main/resources/models/31024.xml deleted file mode 100644 index 85ba52a79d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/31024.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Test - A Wakaama object for testing purpose. - - 31024 - urn:oma:lwm2m:x:31024 - Multiple - Optional - - - test - RW - Single - Mandatory - Integer - 0-255 - - - - exec - E - Single - Mandatory - - - - dec - RW - Single - Mandatory - Float - - - - - - sig - RW - Single - Optional - Integer - - - 16-bit signed integer - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3200.xml b/common/transport/lwm2m/src/main/resources/models/3200.xml deleted file mode 100644 index 5a0dce0378..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3200.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - Digital Input - Generic digital input for non-specific sensors - 3200 - urn:oma:lwm2m:ext:3200 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The cumulative value of active state detected. - - - Digital Input Polarity - RW - Single - Optional - Boolean - - - The polarity of the digital input as a Boolean (False = Normal, True = Reversed). - - - Digital Input Debounce - RW - Single - Optional - Integer - - ms - The debounce period in ms. - - - Digital Input Edge Selection - RW - Single - Optional - Integer - 1..3 - - The edge selection as an integer (1 = Falling edge, 2 = Rising edge, 3 = Both Rising and Falling edge). - - - Digital Input Counter Reset - E - Single - Optional - - - - Reset the Counter value. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor (for instance PIR type) - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3201.xml b/common/transport/lwm2m/src/main/resources/models/3201.xml deleted file mode 100644 index 0920d9b030..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3201.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - Digital Output - Generic digital output for non-specific actuators - 3201 - urn:oma:lwm2m:ext:3201 - 1.0 - 1.0 - Multiple - Optional - - - Digital Output State - RW - Single - Mandatory - Boolean - - - The current state of a digital output. - - - Digital Output Polarity - RW - Single - Optional - Boolean - - - The polarity of the digital output as a Boolean (False = Normal, True = Reversed). - - - Application Type - RW - Single - Optional - String - - - The application type of the output as a string, for instance, "LED" - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3202.xml b/common/transport/lwm2m/src/main/resources/models/3202.xml deleted file mode 100644 index 413ba0103b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3202.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - Analog Input - Generic analog input for non-specific sensors - 3202 - urn:oma:lwm2m:ext:3202 - 1.0 - 1.0 - Multiple - Optional - - - Analog Input Current Value - R - Single - Mandatory - Float - - - The current value of the analog input. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor, for instance PIR type - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3203.xml b/common/transport/lwm2m/src/main/resources/models/3203.xml deleted file mode 100644 index e807aca00a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3203.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - Analog Output - This IPSO object is a generic object that can be used with any kind of analog output interface. - 3203 - urn:oma:lwm2m:ext:3203 - 1.0 - 1.0 - Multiple - Optional - - - Analog Output Current Value - RW - Single - Mandatory - Float - 0..1 - - The current state of the analogue output. - - - Application Type - RW - Single - Optional - String - - - If present, the application type of the actuator as a string, for instance, "Valve" - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be set for the output - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be set for the output - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3300.xml b/common/transport/lwm2m/src/main/resources/models/3300.xml deleted file mode 100644 index 58cf4f67cb..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3300.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - Generic Sensor - This IPSO object allows the description of a generic sensor. It is based on the description of a value and a unit according to the SenML specification. Thus, any type of value defined within this specification can be reported using this object. This object may be used as a generic object if a dedicated one does not exist. - 3300 - urn:oma:lwm2m:ext:3300 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Application Type - RW - Single - Optional - String - - - If present, the application type of the sensor as a string, for instance, "CO2" - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor (for instance PIR type) - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3301.xml b/common/transport/lwm2m/src/main/resources/models/3301.xml deleted file mode 100644 index 7dfb81d230..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3301.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - Illuminance - Illuminance sensor, example units = lx - 3301 - urn:oma:lwm2m:ext:3301 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - The current value of the luminosity sensor. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3302.xml b/common/transport/lwm2m/src/main/resources/models/3302.xml deleted file mode 100644 index 0223d2f772..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3302.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - Presence - Presence sensor with digital sensing, optional delay parameters - 3302 - urn:oma:lwm2m:ext:3302 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of the presence sensor - - - Digital Input Counter - R - Single - Optional - Integer - - - The cumulative value of active state detected. - - - Digital Input Counter Reset - E - Single - Optional - - - - Reset the Counter value - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor (for instance PIR type) - - - Busy to Clear delay - RW - Single - Optional - Integer - - ms - Delay from the detection state to the clear state in ms - - - Clear to Busy delay - RW - Single - Optional - Integer - - ms - Delay from the clear state to the busy state in ms - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3303.xml b/common/transport/lwm2m/src/main/resources/models/3303.xml deleted file mode 100644 index b638c932a8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3303.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - Temperature - This IPSO object should be used with a temperature sensor to report a temperature measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the temperature sensor. An example measurement unit is degrees Celsius. - 3303 - urn:oma:lwm2m:ext:3303 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3304.xml b/common/transport/lwm2m/src/main/resources/models/3304.xml deleted file mode 100644 index 61d65c998b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3304.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - Humidity - This IPSO object should be used with a humidity sensor to report a humidity measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the humidity sensor. An example measurement unit is relative humidity as a percentage. - 3304 - urn:oma:lwm2m:ext:3304 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3305.xml b/common/transport/lwm2m/src/main/resources/models/3305.xml deleted file mode 100644 index cd50b18907..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3305.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - Power Measurement - This IPSO object should be used over a power measurement sensor to report a remote power measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range for both active and reactive power. It also provides resources for cumulative energy, calibration, and the power factor. - 3305 - urn:oma:lwm2m:ext:3305 - 1.0 - 1.0 - Multiple - Optional - - - Instantaneous active power - R - Single - Mandatory - Float - - W - The current active power - - - Min Measured active power - R - Single - Optional - Float - - W - The minimum active power measured by the sensor since it is ON - - - Max Measured active power - R - Single - Optional - Float - - W - The maximum active power measured by the sensor since it is ON - - - Min Range active power - R - Single - Optional - Float - - W - The minimum active power that can be measured by the sensor - - - Max Range active power - R - Single - Optional - Float - - W - The maximum active power that can be measured by the sensor - - - Cumulative active power - R - Single - Optional - Float - - Wh - The cumulative active power since the last cumulative energy reset or device start - - - Active Power Calibration - W - Single - Optional - Float - - W - Request an active power calibration by writing the value of a calibrated load. - - - Instantaneous reactive power - R - Single - Optional - Float - - var - The current reactive power - - - Min Measured reactive power - R - Single - Optional - Float - - var - The minimum reactive power measured by the sensor since it is ON - - - Max Measured reactive power - R - Single - Optional - Float - - var - The maximum reactive power measured by the sensor since it is ON - - - Min Range reactive power - R - Single - Optional - Float - - var - The minimum active power that can be measured by the sensor - - - Max Range reactive power - R - Single - Optional - Float - - var - The maximum reactive power that can be measured by the sensor - - - Cumulative reactive power - R - Single - Optional - Float - - varh - The cumulative reactive power since the last cumulative energy reset or device start - - - Reactive Power Calibration - W - Single - Optional - Float - - var - Request a reactive power calibration by writing the value of a calibrated load. - - - Power factor - R - Single - Optional - Float - - - If applicable, the power factor of the current consumption. - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Reset Cumulative energy - E - Single - Optional - - - - Reset both cumulative active/reactive power - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3306.xml b/common/transport/lwm2m/src/main/resources/models/3306.xml deleted file mode 100644 index 6e76808d96..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3306.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - Actuation - This IPSO object is dedicated to remote actuation such as ON/OFF action or dimming. A multi-state output can also be described as a string. This is useful to send pilot wire orders for instance. It also provides a resource to reflect the time that the device has been switched on. - 3306 - urn:oma:lwm2m:ext:3306 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Dimmer - RW - Single - Optional - Integer - 0..100 - /100 - This resource represents a light dimmer setting, which has an Integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the device has been on. Writing a value of 0 resets the counter. - - - Muti-state Output - RW - Single - Optional - String - - - A string describing a state for multiple level output such as Pilot Wire - - - Application Type - RW - Single - Optional - String - - - The Application type of the device, for example "Motion Closure". - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3308.xml b/common/transport/lwm2m/src/main/resources/models/3308.xml deleted file mode 100644 index 865df6235f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3308.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - Set Point - This IPSO object should be used to set a desired value to a controller, such as a thermostat. A special resource is added to set the colour of an object. - 3308 - urn:oma:lwm2m:ext:3308 - 1.0 - 1.0 - Multiple - Optional - - - Set Point Value - RW - Single - Mandatory - Float - - - The setpoint value. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Colour - RW - Single - Optional - String - - - A string representing a value in some color space - - - Application Type - RW - Single - Optional - String - - - The Application type of the device, for example "Motion Closure". - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3310.xml b/common/transport/lwm2m/src/main/resources/models/3310.xml deleted file mode 100644 index 75e381f488..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3310.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - Load Control - This Object is used for demand-response load control and other load control in automation application (not limited to power). - 3310 - urn:oma:lwm2m:ext:3310 - 1.0 - 1.0 - Multiple - Optional - - - Event Identifier - RW - Single - Mandatory - String - - - The event identifier as a string. - - - Start Time - RW - Single - Mandatory - Time - - - Time when the event started. - - - Duration In Min - RW - Single - Mandatory - Integer - - min - The duration of the event in minutes. - - - Criticality Level - RW - Single - Optional - Integer - 0..3 - - The criticality of the event. The device receiving the event will react in an appropriate fashion for the device. - - - Avg Load AdjPct - RW - Single - Optional - Integer - 0..100 - /100 - Defines the maximum energy usage of the receiving device, as a percentage of the device's normal maximum energy usage. - - - Duty Cycle - RW - Single - Optional - Integer - 0..100 - /100 - Defines the duty cycle for the load control event, i.e, what percentage of time the receiving device is allowed to be on. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3311.xml b/common/transport/lwm2m/src/main/resources/models/3311.xml deleted file mode 100644 index 2e7b3977b6..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3311.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - Light Control - This Object is used to control a light source, such as a LED or other light. It allows a light to be turned on or off and its dimmer setting to be control as a % between 0 and 100. An optional colour setting enables a string to be used to indicate the desired colour. - 3311 - urn:oma:lwm2m:ext:3311 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Dimmer - RW - Single - Optional - Integer - 0..100 - /100 - This resource represents a light dimmer setting, which has an Integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the light has been on. Writing a value of 0 resets the counter. - - - Cumulative active power - R - Single - Optional - Float - - Wh - The total power in Wh that the light has used. - - - Power factor - R - Single - Optional - Float - - - The power factor of the light. - - - Colour - RW - Single - Optional - String - - - A string representing a value in some color space - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3312.xml b/common/transport/lwm2m/src/main/resources/models/3312.xml deleted file mode 100644 index fca6d7926a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3312.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - Power Control - This Object is used to control a power source, such as a Smart Plug. It allows a power relay to be turned on or off and its dimmer setting to be control as a % between 0 and 100. - 3312 - urn:oma:lwm2m:ext:3312 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Dimmer - RW - Single - Optional - Integer - 0..100 - /100 - This resource represents a power dimmer setting, which has an Integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the power relay has been on. Writing a value of 0 resets the counter. - - - Cumulative active power - R - Single - Optional - Float - - Wh - The total power in Wh that has been used by the load. - - - Power factor - R - Single - Optional - Float - - - The power factor of the load. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3313.xml b/common/transport/lwm2m/src/main/resources/models/3313.xml deleted file mode 100644 index df8dd8b573..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3313.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - Accelerometer - This IPSO object can be used to represent a 1-3 axis accelerometer. - 3313 - urn:oma:lwm2m:ext:3313 - 1.0 - 1.0 - Multiple - Optional - - - X Value - R - Single - Mandatory - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3314.xml b/common/transport/lwm2m/src/main/resources/models/3314.xml deleted file mode 100644 index 0dcd28e625..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3314.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - Magnetometer - This IPSO object can be used to represent a 1-3 axis magnetometer with optional compass direction. - 3314 - urn:oma:lwm2m:ext:3314 - 1.0 - 1.0 - Multiple - Optional - - - X Value - R - Single - Mandatory - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Compass Direction - R - Single - Optional - Float - 0..360 - deg - The measured compass direction. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3315.xml b/common/transport/lwm2m/src/main/resources/models/3315.xml deleted file mode 100644 index 1e010d3186..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3315.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - Barometer - This IPSO object should be used with an air pressure sensor to report a barometer measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the barometer sensor. An example measurement unit is pascals. - 3315 - urn:oma:lwm2m:ext:3315 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3316.xml b/common/transport/lwm2m/src/main/resources/models/3316.xml deleted file mode 100644 index 63a769bea2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3316.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Voltage - This IPSO object should be used with voltmeter sensor to report measured voltage between two points. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is volts. - - 3316 - urn:oma:lwm2m:ext:3316 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3317.xml b/common/transport/lwm2m/src/main/resources/models/3317.xml deleted file mode 100644 index f3c0303438..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3317.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Current - This IPSO object should be used with an ammeter to report measured electric current in amperes. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is ampere. - - 3317 - urn:oma:lwm2m:ext:3317 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3318.xml b/common/transport/lwm2m/src/main/resources/models/3318.xml deleted file mode 100644 index e7b69cd460..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3318.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Frequency - This IPSO object should be used to report frequency measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is hertz. - - 3318 - urn:oma:lwm2m:ext:3318 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3319.xml b/common/transport/lwm2m/src/main/resources/models/3319.xml deleted file mode 100644 index 19d074a6eb..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3319.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Depth - This IPSO object should be used to report depth measurements. It can, for example, be used to describe a generic rain gauge that measures the accumulated rainfall in millimetres (mm). - - 3319 - urn:oma:lwm2m:ext:3319 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3320.xml b/common/transport/lwm2m/src/main/resources/models/3320.xml deleted file mode 100644 index d43fe7f315..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3320.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Percentage - This IPSO object should can be used to report measurements relative to a 0-100% scale. For example it could be used to measure the level of a liquid in a vessel or container in units of %. - - 3320 - urn:oma:lwm2m:ext:3320 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3321.xml b/common/transport/lwm2m/src/main/resources/models/3321.xml deleted file mode 100644 index 0e57a8917b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3321.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Altitude - This IPSO object should be used with an altitude sensor to report altitude above sea level in meters. Note that Altitude can be calculated from the measured pressure given the local sea level pressure. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is meters. - - 3321 - urn:oma:lwm2m:ext:3321 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3322.xml b/common/transport/lwm2m/src/main/resources/models/3322.xml deleted file mode 100644 index c1eb6557c7..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3322.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Load - This IPSO object should be used with a load sensor (as in a scale) to report the applied weight or force. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is kilograms. - - 3322 - urn:oma:lwm2m:ext:3322 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3323.xml b/common/transport/lwm2m/src/main/resources/models/3323.xml deleted file mode 100644 index 16c409931d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3323.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Pressure - This IPSO object should be used to report pressure measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is pascals. - - 3323 - urn:oma:lwm2m:ext:3323 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3324.xml b/common/transport/lwm2m/src/main/resources/models/3324.xml deleted file mode 100644 index e23c76b5dc..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3324.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Loudness - This IPSO object should be used to report loudness or noise level measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is decibels. - - 3324 - urn:oma:lwm2m:ext:3324 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3325.xml b/common/transport/lwm2m/src/main/resources/models/3325.xml deleted file mode 100644 index 2defd9af1e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3325.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Concentration - This IPSO object should be used to the particle concentration measurement of a medium. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is parts per million. - - 3325 - urn:oma:lwm2m:ext:3325 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3326.xml b/common/transport/lwm2m/src/main/resources/models/3326.xml deleted file mode 100644 index 7d3f940649..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3326.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Acidity - This IPSO object should be used to report an acidity measurement of a liquid. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is pH. - - 3326 - urn:oma:lwm2m:ext:3326 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3327.xml b/common/transport/lwm2m/src/main/resources/models/3327.xml deleted file mode 100644 index 32498aba39..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3327.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Conductivity - This IPSO object should be used to report a measurement of the electric conductivity of a medium or sample. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is Siemens. - - 3327 - urn:oma:lwm2m:ext:3327 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3328.xml b/common/transport/lwm2m/src/main/resources/models/3328.xml deleted file mode 100644 index 4c920b05ae..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3328.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Power - This IPSO object should be used to report power measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is Watts. This object may be used for either real power or apparent power measurements. - - 3328 - urn:oma:lwm2m:ext:3328 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3329.xml b/common/transport/lwm2m/src/main/resources/models/3329.xml deleted file mode 100644 index ba96e5bf9d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3329.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Power Factor - This IPSO object should be used to report a measurement or calculation of the power factor of a reactive electrical load. Power Factor is normally the ratio of non-reactive power to total power. This object also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. - - 3329 - urn:oma:lwm2m:ext:3329 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3330.xml b/common/transport/lwm2m/src/main/resources/models/3330.xml deleted file mode 100644 index 5583596aa8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3330.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Distance - This IPSO object should be used to report a distance measurement. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is Meters. - - 3330 - urn:oma:lwm2m:ext:3330 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3331.xml b/common/transport/lwm2m/src/main/resources/models/3331.xml deleted file mode 100644 index 8933e75c69..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3331.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - Energy - This IPSO object should be used to report energy consumption (Cumulative Power) of an electrical load. An example measurement unit is Watt Hours. - - 3331 - urn:oma:lwm2m:ext:3331 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Cumulative energy - E - Single - Optional - - - - Reset both cumulative active/reactive power. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3332.xml b/common/transport/lwm2m/src/main/resources/models/3332.xml deleted file mode 100644 index e39fb6f182..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3332.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - Direction - This IPSO object is used to report the direction indicated by a compass, wind vane, or other directional indicator. The units of measure is plane angle degrees. - - 3332 - urn:oma:lwm2m:ext:3332 - 1.0 - 1.0 - Multiple - Optional - - - Compass Direction - R - Single - Mandatory - Float - 0..360 - deg - The measured compass direction. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset. - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3333.xml b/common/transport/lwm2m/src/main/resources/models/3333.xml deleted file mode 100644 index 7282e2670a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3333.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - Time - This IPSO object is used to report the current time in seconds since January 1, 1970 UTC. There is also a fractional time counter that has a range of less than one second. - - 3333 - urn:oma:lwm2m:ext:3333 - 1.0 - 1.0 - Multiple - Optional - - - Current Time - RW - Single - Mandatory - Time - - - Unix Time. A signed integer representing the number of seconds since Jan 1st, 1970 in the UTC time zone. - - - Fractional Time - RW - Single - Optional - Float - 0..1 - s - Fractional part of the time when sub-second precision is used (e.g., 0.23 for 230 ms). - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3334.xml b/common/transport/lwm2m/src/main/resources/models/3334.xml deleted file mode 100644 index 8fb30e0164..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3334.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - Gyrometer - This IPSO Object is used to report the current reading of a gyrometer sensor in 3 axes. It provides tracking of the minimum and maximum angular rate in all 3 axes. An example unit of measure is radians per second. - - 3334 - urn:oma:lwm2m:ext:3334 - 1.0 - 1.0 - Multiple - Optional - - - X Value - R - Single - Mandatory - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min X Value - R - Single - Optional - Float - - - The minimum measured value along the X axis - - - Max X Value - R - Single - Optional - Float - - - The maximum measured value along the X axis - - - Min Y Value - R - Single - Optional - Float - - - The minimum measured value along the Y axis - - - Max Y Value - R - Single - Optional - Float - - - The maximum measured value along the Y axis - - - Min Z Value - R - Single - Optional - Float - - - The minimum measured value along the Z axis - - - Max Z Value - R - Single - Optional - Float - - - The maximum measured value along the Z axis - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value. - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3335.xml b/common/transport/lwm2m/src/main/resources/models/3335.xml deleted file mode 100644 index 8d48093231..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3335.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - Colour - This IPSO object should be used to report the measured value of a colour sensor in some colour space described by the units resource. - - 3335 - urn:oma:lwm2m:ext:3335 - 1.0 - 1.0 - Multiple - Optional - - - Colour - RW - Single - Mandatory - String - - - A string representing a value in some colour space. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3336.xml b/common/transport/lwm2m/src/main/resources/models/3336.xml deleted file mode 100644 index 30aba24708..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3336.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - Location - This IPSO object represents GPS coordinates. This object is compatible with the LWM2M management object for location, but uses reusable resources. - - 3336 - urn:oma:lwm2m:ext:3336 - 1.0 - 1.0 - Multiple - Optional - - - Latitude - R - Single - Mandatory - String - - - The decimal notation of latitude, e.g. -43.5723 (World Geodetic System 1984). - - - Longitude - R - Single - Mandatory - String - - - The decimal notation of longitude, e.g. 153.21760 (World Geodetic System 1984). - - - Uncertainty - R - Single - Optional - String - - - The accuracy of the position in meters. - - - Compass Direction - R - Single - Optional - Float - 0..360 - deg - The measured compass direction. - - - Velocity - R - Single - Optional - Opaque - - - The velocity of the device as defined in 3GPP 23.032 GAD specification. This set of values may not be available if the device is static. - - - Timestamp - R - Single - Optional - Time - - - The timestamp of when the measurement was performed. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3337.xml b/common/transport/lwm2m/src/main/resources/models/3337.xml deleted file mode 100644 index 54f3d19d54..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3337.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Positioner - This IPSO object should be used with a generic position actuator with range from 0 to 100%. This object optionally allows setting the transition time for an operation that changes the position of the actuator, and for reading the remaining time of the currently active transition. - - 3337 - urn:oma:lwm2m:ext:3337 - 1.0 - 1.0 - Multiple - Optional - - - Current Position - RW - Single - Mandatory - Float - 0..100 - /100 - Current position or desired position of a positioner actuator. - - - Transition Time - RW - Single - Optional - Float - - s - The time expected to move the actuator to the new position. - - - Remaining Time - R - Single - Optional - Float - - s - The time remaining in an operation. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value set on the actuator since power ON or reset. - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value set on the actuator since power ON or reset. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value. - - - Min Limit - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor. - - - Max Limit - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3338.xml b/common/transport/lwm2m/src/main/resources/models/3338.xml deleted file mode 100644 index 1437a62c65..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3338.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - Buzzer - This IPSO object should be used to actuate an audible alarm such as a buzzer, beeper, or vibration alarm. There is a dimmer control for setting the relative loudness of the alarm, and an optional duration control to limit the length of time the alarm sounds when turned on. Each time "true" is written to the On/Off resource, the alarm will sound again for the configured duration. If no duration is programmed or the setting is "false", writing a "true" to the On/Off resource will result in the alarm sounding continuously until a "false" is written to the On/Off resource. - - 3338 - urn:oma:lwm2m:ext:3338 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Level - RW - Single - Optional - Float - 0..100 - /100 - Audio volume control, float value between 0 and 100 as a percentage. - - - Delay Duration - RW - Single - Optional - Float - - s - The duration of the time delay. - - - Minimum Off-time - RW - Single - Mandatory - Float - - s - The off time when On/Off control remains on. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3339.xml b/common/transport/lwm2m/src/main/resources/models/3339.xml deleted file mode 100644 index edd11709e8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3339.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - Audio Clip - This IPSO object should be used for a speaker that plays a pre-recorded audio clip or an audio output that is sent elsewhere. For example, an elevator which announces the floor of the building. A resource is provided to store the clip, a dimmer resource controls the relative sound level of the playback, and a duration resource limits the maximum playback time. After the duration time is reached, any remaining samples in the clip are ignored, and the clip player will be ready to play another clip. - 3339 - urn:oma:lwm2m:ext:3339 - 1.0 - 1.0 - Multiple - Optional - - - Clip - RW - Single - Mandatory - Opaque - - - Audio clip that is playable (e.g., a short audio recording indicating the floor in an elevator). - - - Trigger - E - Single - Optional - - - - Trigger initiating actuation. - - - Level - RW - Single - Optional - Float - 0..100 - /100 - Audio volume control, float value between 0 and 100 as a percentage. - - - Duration - RW - Single - Optional - Float - - s - The duration of the sound once trigger. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3340.xml b/common/transport/lwm2m/src/main/resources/models/3340.xml deleted file mode 100644 index 16585224fa..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3340.xml +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - Timer - This IPSO object is used to time events and actions, using patterns common to industrial timers. A write to the trigger resource or On/Off input state change starts the timing operation, and the timer remaining time shows zero when the operation is complete. The patterns supported are One-Shot (mode 1), On-Time or Interval (mode 2), Time delay on pick-up or TDPU (mode 3), and Time Delay on Drop-Out or TDDO (mode 4). Mode 0 disables the timer, so the output follows the input with no delay. A counter is provided to count occurrences of the timer output changing from 0 to 1. Writing a value of zero resets the counter. The Digital Input State resource reports the state of the timer output. - - 3340 - urn:oma:lwm2m:ext:3340 - 1.0 - 1.0 - Multiple - Optional - - - Delay Duration - RW - Single - Mandatory - Float - - s - The duration of the time delay. - - - Remaining Time - R - Single - Optional - Float - - s - The time remaining in an operation. - - - Minimum Off-time - RW - Single - Optional - Float - - s - The duration of the rearm delay (i.e. the delay from the end of one cycle until the beginning of the next, the inhibit time). - - - Trigger - E - Single - Optional - - - - Trigger initiating actuation. - - - On/Off - RW - Single - Optional - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input. - - - Cumulative Time - RW - Single - Optional - Float - - s - The total time in seconds that the timer input is true. Writing a 0 resets the time. - - - Digital State - R - Single - Optional - Boolean - - - The current state of the timer output. - - - Counter - RW - Single - Optional - Integer - - - Counts the number of times the timer output transitions from 0 to 1. - - - Timer Mode - RW - Single - Optional - Integer - 0..4 - - Type of timer pattern used by the patterns. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3341.xml b/common/transport/lwm2m/src/main/resources/models/3341.xml deleted file mode 100644 index 55865d0f32..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3341.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Addressable Text Display - This IPSO object is used to send text to a text-only or text mode graphics display. Writing a string of text to the text resource causes it to be displayed at the selected X and Y locations on the display. If X or Y are set to a value greater than the size of the display, the position "wraps around" to the modulus of the setting and the display size. Likewise, if the text string overflows the display size, the text "wraps around" and displays on the next line down or, if the last line has been written, wraps around to the top of the display. Brightness and Contrast controls are provided to allow control of various display types including STN and DSTN type LCD character displays. Writing an empty payload to the Clear Display resource causes the display to be erased. - - 3341 - urn:oma:lwm2m:ext:3341 - 1.0 - 1.0 - Multiple - Optional - - - Text - RW - Single - Mandatory - String - - - A string of text. - - - X Coordinate - RW - Single - Optional - Integer - - - X Coordinate. - - - Y Coordinate - RW - Single - Optional - Integer - - - Y Coordinate. - - - Max X Coordinate - R - Single - Optional - Integer - - - The highest X coordinate the display supports before wrapping to the next line. - - - Max Y Coordinate - R - Single - Optional - Integer - - - The highest Y coordinate the display supports before wrapping to the next line. - - - Clear Display - E - Single - Optional - - - - Command to clear the display. - - - Level - RW - Single - Optional - Float - 0..100 - /100 - Brightness control, integer value between 0 and 100 as a percentage. - - - Contrast - RW - Single - Optional - Float - 0..100 - /100 - Proportional control, integer value between 0 and 100 as a percentage. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3342.xml b/common/transport/lwm2m/src/main/resources/models/3342.xml deleted file mode 100644 index b88ebab9d4..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3342.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - On/Off switch - This IPSO object should be used with an On/Off switch to report the state of the switch. - 3342 - urn:oma:lwm2m:ext:3342 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from 0 to 1. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds since the On command was sent. Writing a value of 0 resets the counter. - - - Off Time - RW - Single - Optional - Integer - - s - The time in seconds since the Off command was sent. Writing a value of 0 resets the counter. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3343.xml b/common/transport/lwm2m/src/main/resources/models/3343.xml deleted file mode 100644 index 63b77c3e91..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3343.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - Dimmer - This IPSO object should be used with a dimmer or level control to report the state of the control. - - 3343 - urn:oma:lwm2m:ext:3343 - 1.0 - 1.0 - Multiple - Optional - - - Level - RW - Single - Mandatory - Float - 0..100 - /100 - Proportional control, integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the dimmer has been on (Dimmer value has to be > 0). Writing a value of 0 resets the counter. - - - Off Time - RW - Single - Optional - Integer - - s - The time in seconds that the dimmer has been off (dimmer value less or equal to 0) Writing a value of 0 resets the counter. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3344.xml b/common/transport/lwm2m/src/main/resources/models/3344.xml deleted file mode 100644 index 2dd8648a19..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3344.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - Up/Down Control - This IPSO object is used to report the state of an up/down control element like a pair of push buttons or a rotary encoder. Counters for increase and decrease operations are provided for counting pulses from a quadrature encoder. - - 3344 - urn:oma:lwm2m:ext:3344 - 1.0 - 1.0 - Multiple - Optional - - - Increase Input State - R - Single - Mandatory - Boolean - - - Indicates an increase control action. - - - Decrease Input State - R - Single - Mandatory - Boolean - - - Indicates a decrease control action. - - - Up Counter - RW - Single - Optional - Integer - - - Counts the number of times the increase control has been operated. Writing a 0 resets the counter. - - - Down Counter - RW - Single - Optional - Integer - - - Counts the times the decrease control has been operated. Writing a 0 resets the counter. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3345.xml b/common/transport/lwm2m/src/main/resources/models/3345.xml deleted file mode 100644 index a5355c94ca..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3345.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - Multiple Axis Joystick - This IPSO object can be used to report the position of a shuttle or joystick control. A digital input is provided to report the state of an associated push button. - - 3345 - urn:oma:lwm2m:ext:3345 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Optional - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from 0 to 1. - - - X Value - R - Single - Optional - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3346.xml b/common/transport/lwm2m/src/main/resources/models/3346.xml deleted file mode 100644 index 8c68054c39..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3346.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Rate - This object type should be used to report a rate measurement, for example the speed of a vehicle, or the rotational speed of a drive shaft. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is meters per second (m/s). - - 3346 - urn:oma:lwm2m:ext:3346 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3347.xml b/common/transport/lwm2m/src/main/resources/models/3347.xml deleted file mode 100644 index f86a986f0a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3347.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - Push button - This IPSO object is used to report the state of a momentary action push button control and to count the number of times the control has been operated since the last observation. - - 3347 - urn:oma:lwm2m:ext:3347 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from 0 to 1. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3348.xml b/common/transport/lwm2m/src/main/resources/models/3348.xml deleted file mode 100644 index a2de51f6af..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3348.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - Multi-state Selector - This IPSO object is used to represent the state of a Multi-state selector switch with a number of fixed positions. - - 3348 - urn:oma:lwm2m:ext:3348 - 1.0 - 1.0 - Multiple - Optional - - - Multi-state Input - R - Single - Mandatory - Integer - - - The current state of a Multi-state input or selector. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3349.xml b/common/transport/lwm2m/src/main/resources/models/3349.xml deleted file mode 100644 index 9a77820703..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3349.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - Bitmap - Summarize several digital inputs to one value by mapping each bit to a digital input. - 3349 - urn:oma:lwm2m:ext:3349 - 1.0 - 1.0 - Multiple - Optional - - - Bitmap Input - R - Single - Mandatory - Integer - - - Integer in which each of the bits are associated with specific digital input value. Represented as a binary signed integer in network byte order, and in two's complement representation. Using values in range 0-127 is recommended to avoid ambiguities with byte order and negative values. - - - Bitmap Input Reset - E - Single - Optional - - - - Reset the Bitmap Input value. - - - Element Description - RW - Multiple - Optional - String - - - The description of each bit as a string. First instance describes the least significant bit, second instance the second least significant bit. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3350.xml b/common/transport/lwm2m/src/main/resources/models/3350.xml deleted file mode 100644 index dc1313cd83..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3350.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - Stopwatch - An ascending timer that counts how long time has passed since the timer was started after reset. - 3350 - urn:oma:lwm2m:ext:3350 - 1.0 - 1.0 - Multiple - Optional - - - Cumulative Time - RW - Single - Mandatory - Float - - s - The total time in seconds that the stopwatch has been on. Writing a 0 resets the time. - - - On/Off - RW - Single - Optional - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from off to on. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3351.xml b/common/transport/lwm2m/src/main/resources/models/3351.xml deleted file mode 100644 index 9219a765df..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3351.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - powerupLog - - 3351 - urn:oma:lwm2m:ext:3351 - 1.0 - 1.0 - Single - Optional - - deviceName - R - Single - Mandatory - String - - - - - toolVersion - R - Single - Mandatory - String - - - - - IMEI - R - Single - Mandatory - String - - - - - IMSI - R - Single - Mandatory - String - - - - - MSISDN - R - Single - Mandatory - String - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3352.xml b/common/transport/lwm2m/src/main/resources/models/3352.xml deleted file mode 100644 index 260daa033a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3352.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - plmnSearchEvent - - 3352 - urn:oma:lwm2m:ext:3352 - 1.0 - 1.0 - Multiple - Optional - - timeScanStart - R - Single - Mandatory - Integer - - - - - plmnID - R - Single - Mandatory - Integer - - - - - BandIndicator - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3353.xml b/common/transport/lwm2m/src/main/resources/models/3353.xml deleted file mode 100644 index 95b87e40b7..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3353.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - scellID - - 3353 - urn:oma:lwm2m:ext:3353 - 1.0 - 1.0 - Single - Optional - - plmnID - R - Single - Mandatory - Integer - - - - - BandIndicator - R - Single - Mandatory - Integer - - - - - TrackingAreaCode - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3354.xml b/common/transport/lwm2m/src/main/resources/models/3354.xml deleted file mode 100644 index 065a330d38..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3354.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - cellReselectionEvent - - 3354 - urn:oma:lwm2m:ext:3354 - 1.0 - 1.0 - Single - Optional - - timeReselectionStart - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - failureType - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3355.xml b/common/transport/lwm2m/src/main/resources/models/3355.xml deleted file mode 100644 index 627d67b68e..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3355.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - handoverEvent - - 3355 - urn:oma:lwm2m:ext:3355 - 1.0 - 1.0 - Single - Optional - - timeHandoverStart - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - handoverResult - R - Single - Mandatory - Integer - - - - - - TargetEarfcn - R - Single - Mandatory - Integer - - - - - TargetPhysicalCellID - R - Single - Mandatory - Integer - - - - - targetCellRsrp - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3356.xml b/common/transport/lwm2m/src/main/resources/models/3356.xml deleted file mode 100644 index 95c7fc7835..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3356.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - radioLinkFailureEvent - - 3356 - urn:oma:lwm2m:ext:3356 - 1.0 - 1.0 - Single - Optional - - timeRLF - R - Single - Mandatory - Integer - - - - - rlfCause - R - Single - Mandatory - Integer - - - - - - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3357.xml b/common/transport/lwm2m/src/main/resources/models/3357.xml deleted file mode 100644 index 935b7c4ba7..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3357.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - rrcStateChangeEvent - - 3357 - urn:oma:lwm2m:ext:3357 - 1.0 - 1.0 - Single - Optional - - rrcState - R - Single - Mandatory - Integer - - - - - rrcStateChangeCause - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3358.xml b/common/transport/lwm2m/src/main/resources/models/3358.xml deleted file mode 100644 index 2784d6a990..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3358.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - rrcTimerExpiryEvent - - 3358 - urn:oma:lwm2m:ext:3358 - 1.0 - 1.0 - Single - Optional - - RrcTimerExpiryEvent - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3359.xml b/common/transport/lwm2m/src/main/resources/models/3359.xml deleted file mode 100644 index 630e52ce8f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3359.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - cellBlacklistEvent - - 3359 - urn:oma:lwm2m:ext:3359 - 1.0 - 1.0 - Single - Optional - - dlEarfcn - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3360.xml b/common/transport/lwm2m/src/main/resources/models/3360.xml deleted file mode 100644 index 12b2302854..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3360.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - esmContextInfo - - 3360 - urn:oma:lwm2m:ext:3360 - 1.0 - 1.0 - Single - Optional - - contextType - R - Single - Mandatory - Integer - - - - - bearerState - R - Single - Mandatory - Integer - - - - - radioBearerId - R - Single - Mandatory - Integer - - - - - qci - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3361.xml b/common/transport/lwm2m/src/main/resources/models/3361.xml deleted file mode 100644 index 3d354bffac..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3361.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - emmStateValue - - 3361 - urn:oma:lwm2m:ext:3361 - 1.0 - 1.0 - Single - Optional - - EmmState - R - Single - Mandatory - Integer - - - - - emmSubstate - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3362.xml b/common/transport/lwm2m/src/main/resources/models/3362.xml deleted file mode 100644 index 3cb73eb79a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3362.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - nasEmmTimerExpiryEvent - - 3362 - urn:oma:lwm2m:ext:3362 - 1.0 - 1.0 - Single - Optional - - NasEmmTimerExpiryEvent - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3363.xml b/common/transport/lwm2m/src/main/resources/models/3363.xml deleted file mode 100644 index 3b44b91f26..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3363.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - nasEsmExpiryEvent - - 3363 - urn:oma:lwm2m:ext:3363 - 1.0 - 1.0 - Single - Optional - - NasEsmExpiryEvent - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3364.xml b/common/transport/lwm2m/src/main/resources/models/3364.xml deleted file mode 100644 index 0a042d12d2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3364.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - emmFailureCauseEvent - - 3364 - urn:oma:lwm2m:ext:3364 - 1.0 - 1.0 - Single - Optional - - EMMCause - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3365.xml b/common/transport/lwm2m/src/main/resources/models/3365.xml deleted file mode 100644 index 99f1b3885c..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3365.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - rachLatency_delay - - 3365 - urn:oma:lwm2m:ext:3365 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - rachLatencyVal - R - Single - Mandatory - Integer - - - - - delay - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3366.xml b/common/transport/lwm2m/src/main/resources/models/3366.xml deleted file mode 100644 index 5498af2a3d..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3366.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - macRachAttemptEvent - - 3366 - urn:oma:lwm2m:ext:3366 - 1.0 - 1.0 - Single - Optional - - rachAttemptCounter - R - Single - Mandatory - Integer - - - - - MacRachAttemptEventType - R - Single - Mandatory - Integer - - - - - contentionBased - R - Single - Mandatory - Boolean - - - - - rachMessage - R - Single - Mandatory - Integer - - - - - preambleIndex - R - Single - Mandatory - Integer - - - - - preamblePowerOffset - R - Single - Mandatory - Integer - - - - - backoffTime - R - Single - Mandatory - Integer - - - - - msg2Result - R - Single - Mandatory - Boolean - - - - - timingAdjustmentValue - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3367.xml b/common/transport/lwm2m/src/main/resources/models/3367.xml deleted file mode 100644 index 1f35cf4cc5..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3367.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - macRachAttemptReasonEvent - - 3367 - urn:oma:lwm2m:ext:3367 - 1.0 - 1.0 - Single - Optional - - MacRachAttemptReasonType - R - Single - Mandatory - Integer - - - - - ueID - R - Single - Mandatory - Integer - - - - - contentionBased - R - Single - Mandatory - Boolean - - - - - preamble - R - Single - Mandatory - Integer - - - - - preambleGroupChosen - R - Single - Mandatory - Boolean - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3368.xml b/common/transport/lwm2m/src/main/resources/models/3368.xml deleted file mode 100644 index 40c17bfd37..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3368.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - macTimerStatusEvent - - 3368 - urn:oma:lwm2m:ext:3368 - 1.0 - 1.0 - Single - Optional - - macTimerName - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3369.xml b/common/transport/lwm2m/src/main/resources/models/3369.xml deleted file mode 100644 index b93bb86644..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3369.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - macTimingAdvanceEvent - - 3369 - urn:oma:lwm2m:ext:3369 - 1.0 - 1.0 - Single - Optional - - timerValue - R - Single - Mandatory - Integer - - - - - timingAdvance - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3370.xml b/common/transport/lwm2m/src/main/resources/models/3370.xml deleted file mode 100644 index c79ff32a75..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3370.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - ServingCellMeasurement - - 3370 - urn:oma:lwm2m:ext:3370 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - pci - R - Single - Mandatory - Integer - - - - - rsrp - R - Single - Mandatory - Integer - - - - - rsrq - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3371.xml b/common/transport/lwm2m/src/main/resources/models/3371.xml deleted file mode 100644 index 8267b8ed81..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3371.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - NeighborCellMeasurements - - 3371 - urn:oma:lwm2m:ext:3371 - 1.0 - 1.0 - Multiple - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - pci - R - Single - Mandatory - Integer - - - - - rsrp - R - Single - Mandatory - Integer - - - - - rsrq - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3372.xml b/common/transport/lwm2m/src/main/resources/models/3372.xml deleted file mode 100644 index d08c1dad3a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3372.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - TimingAdvance - - 3372 - urn:oma:lwm2m:ext:3372 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - timingAdvance - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3373.xml b/common/transport/lwm2m/src/main/resources/models/3373.xml deleted file mode 100644 index 9a4191787f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3373.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - txPowerHeadroomEvent - - 3373 - urn:oma:lwm2m:ext:3373 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - headroom-value - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3374.xml b/common/transport/lwm2m/src/main/resources/models/3374.xml deleted file mode 100644 index abc9cc926f..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3374.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - radioLinkMonitoring - - 3374 - urn:oma:lwm2m:ext:3374 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - outOfSyncCount - R - Single - Mandatory - Integer - - - - - inSyncCount - R - Single - Mandatory - Integer - - - - - t310Timer - R - Single - Mandatory - Boolean - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3375.xml b/common/transport/lwm2m/src/main/resources/models/3375.xml deleted file mode 100644 index e1df9f4851..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3375.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - PagingDRX - - 3375 - urn:oma:lwm2m:ext:3375 - 1.0 - 1.0 - Single - Optional - - dlEarfcn - R - Single - Mandatory - Integer - - - - - pci - R - Single - Mandatory - Integer - - - - - pagingCycle - R - Single - Mandatory - Integer - - - - - DrxNb - R - Single - Mandatory - Integer - - - - - ueID - R - Single - Mandatory - Integer - - - - - drxSysFrameNumOffset - R - Single - Mandatory - Integer - - - - - drxSubFrameNumOffset - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3376.xml b/common/transport/lwm2m/src/main/resources/models/3376.xml deleted file mode 100644 index 542f816da0..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3376.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - txPowerBackOffEvent - - 3376 - urn:oma:lwm2m:ext:3376 - 1.0 - 1.0 - Single - Optional - - TxPowerBackoff - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3377.xml b/common/transport/lwm2m/src/main/resources/models/3377.xml deleted file mode 100644 index 515eb36439..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3377.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - Message3Report - - 3377 - urn:oma:lwm2m:ext:3377 - 1.0 - 1.0 - Single - Optional - - tpc - R - Single - Mandatory - Integer - - - - - resourceIndicatorValue - R - Single - Mandatory - Integer - - - - - cqi - R - Single - Mandatory - Integer - - - - - uplinkDelay - R - Single - Mandatory - Boolean - - - - - hoppingEnabled - R - Single - Mandatory - Boolean - - - - - numRb - R - Single - Mandatory - Integer - - - - - transportBlockSizeIndex - R - Single - Mandatory - Integer - - - - - ModulationType - R - Single - Mandatory - Integer - - - - - redundancyVersionIndex - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3378.xml b/common/transport/lwm2m/src/main/resources/models/3378.xml deleted file mode 100644 index 0855f5798a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3378.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - PbchDecodingResults - - 3378 - urn:oma:lwm2m:ext:3378 - 1.0 - 1.0 - Single - Optional - - servingCellID - R - Single - Mandatory - Integer - - - - - crcResult - R - Single - Mandatory - Boolean - - - - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3379.xml b/common/transport/lwm2m/src/main/resources/models/3379.xml deleted file mode 100644 index 0ac1648961..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3379.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - pucchPowerControl - - 3379 - urn:oma:lwm2m:ext:3379 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - pucchTxPowerValue - - Single - Mandatory - Integer - - - - - dlPathLoss - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3380-2_0.xml b/common/transport/lwm2m/src/main/resources/models/3380-2_0.xml deleted file mode 100644 index 27545a6345..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3380-2_0.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - PrachReport - - 3380 - urn:oma:lwm2m:ext:3380:2.0 - 1.0 - 2.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - rachTxPower - R - Single - Mandatory - Integer - - - - - zadOffSeqNum - R - Single - Mandatory - Integer - - - - - prachConfig - R - Single - Mandatory - Integer - - - - - preambleFormat - R - Single - Mandatory - Integer - - - - - maxTransmissionMsg3 - R - Single - Mandatory - Integer - - - - - raResponseWindowSize - R - Single - Mandatory - Integer - - - - - RachRequestResult - R - Single - Mandatory - Boolean - - - - - ce_mode - R - Single - Mandatory - Integer - - - - - ce_level - R - Single - Mandatory - Integer - - - - - num_prach_repetition - R - Single - Mandatory - Integer - - - - - prach_repetition_seq - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3381.xml b/common/transport/lwm2m/src/main/resources/models/3381.xml deleted file mode 100644 index db2e4d52e8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3381.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - VolteCallEvent - - 3381 - urn:oma:lwm2m:ext:3381 - 1.0 - 1.0 - Single - Optional - - callStatus - R - Single - Mandatory - Integer - - - - - callType - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3382.xml b/common/transport/lwm2m/src/main/resources/models/3382.xml deleted file mode 100644 index 8f066837c8..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3382.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - SipRegistrationEvent - - 3382 - urn:oma:lwm2m:ext:3382 - 1.0 - 1.0 - Single - Optional - - registrationType - R - Single - Mandatory - Integer - - - - - registrationResult - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3383.xml b/common/transport/lwm2m/src/main/resources/models/3383.xml deleted file mode 100644 index 663ac45faa..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3383.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - sipPublishEvent - - 3383 - urn:oma:lwm2m:ext:3383 - 1.0 - 1.0 - Single - Optional - - publishResult - R - Single - Mandatory - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3384.xml b/common/transport/lwm2m/src/main/resources/models/3384.xml deleted file mode 100644 index a18c6b910b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3384.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - sipSubscriptionEvent - - 3384 - urn:oma:lwm2m:ext:3384 - 1.0 - 1.0 - Single - Optional - - eventType - R - Single - Mandatory - Integer - - - - - subscriptionResult - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3385.xml b/common/transport/lwm2m/src/main/resources/models/3385.xml deleted file mode 100644 index cc0a99182a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3385.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - volteCallStateChangeEvent - - 3385 - urn:oma:lwm2m:ext:3385 - 1.0 - 1.0 - Single - Optional - - callStatus - R - Single - Mandatory - Integer - - - - - VolteCallStateChangeCause - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/3386.xml b/common/transport/lwm2m/src/main/resources/models/3386.xml deleted file mode 100644 index 43937efadb..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/3386.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - VoLTErtpPacketLoss - 1]]> - 3386 - urn:oma:lwm2m:ext:3386 - 1.0 - 1.0 - Single - Optional - - ssrc - R - Single - Mandatory - Integer - - - - - packetsLost - R - Single - Mandatory - Integer - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_APN_Connection_Profile-v1_0_1.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_APN_Connection_Profile-v1_0_1.xml deleted file mode 100644 index 924e822fc6..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_APN_Connection_Profile-v1_0_1.xml +++ /dev/null @@ -1,324 +0,0 @@ - - - - - LWM2M APN Connection Profile - - 11 - - urn:oma:lwm2m:oma:11 - 1.0 - 1.0 - Multiple - Optional - - Profile name - RW - Single - Mandatory - String - - - - - APN - RW - Single - Optional - String - - - - - Auto select APN by device - RW - Single - Optional - Boolean - - - - - Enable status - RW - Single - Optional - Boolean - - - - - Authentication Type - RW - Single - Mandatory - Integer - - - - - User Name - RW - Single - Optional - String - - - - - Secret - RW - Single - Optional - String - - - - - Reconnect Schedule - RW - Single - Optional - String - - - - - Validity (MCC, MNC) - RW - Multiple - Optional - String - - - - - Connection establishment time (1) - R - Multiple - Optional - Time - - - - - Connection establishment result (1) - R - Multiple - Optional - Integer - - - - - - Connection establishment reject cause (1) - R - Multiple - Optional - Integer - 0..111 - - - - Connection end time (1) - R - Multiple - Optional - Time - - - - - TotalBytesSent - R - Single - Optional - Integer - - - - - TotalBytesReceived - R - Single - Optional - Integer - - - - - IP address (2) - RW - Multiple - Optional - String - - - - - Prefix length(2) - RW - Multiple - Optional - String - - - - - Subnet mask (2) - RW - Multiple - Optional - String - - - - - Gateway (2) - RW - Multiple - Optional - String - - - - - Primary DNS address (2) - RW - Multiple - Optional - String - - - - - Secondary DNS address (2) - RW - Multiple - Optional - String - - - - - QCI (3) - R - Single - Optional - Integer - 1..9 - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - TotalPacketsSent - R - Single - Optional - Integer - - - - - PDN Type - RW - Single - Optional - Integer - - - - - - APN Rate Control - R - Single - Optional - Integer - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_Bearer_Selection-v1_0_1.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_Bearer_Selection-v1_0_1.xml deleted file mode 100644 index 307df73553..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_Bearer_Selection-v1_0_1.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - LWM2M Bearer Selection - - 13 - urn:oma:lwm2m:oma:13 - 1.0 - 1.0 - Single - Optional - - Preferred Communications Bearer - RW - Multiple - Optional - Integer - 8 bit - - - - Acceptable RSSI (GSM) - RW - Single - Optional - Integer - - - - - Acceptable RSCP (UMTS) - RW - Single - Optional - Integer - - - - - Acceptable RSRP (LTE) - RW - Single - Optional - Integer - - - - - Acceptable RSSI (1xEV-DO) - RW - Single - Optional - Integer - - - - - Cell lock list - RW - Single - Optional - String - - - - - Operator list - RW - Single - Optional - String - - - - - Operator list mode - RW - Single - Optional - Boolean - - - - - List of available PLMNs - R - Single - Optional - String - - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - Acceptable RSRP (NB-IoT) - RW - Single - Optional - Integer - - - - - Higher Priority PLMN Search Timer - RW - Single - Optional - Integer - - - - - Attach without PDN connection - RW - Single - Optional - Boolean - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_Cellular_Connectivity-v1_0_1.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_Cellular_Connectivity-v1_0_1.xml deleted file mode 100644 index 45499202ba..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_Cellular_Connectivity-v1_0_1.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - LWM2M Cellular Connectivity - - 10 - urn:oma:lwm2m:oma:10 - 1.0 - 1.0 - Single - Optional - - SMSC address - RW - Single - Optional - String - - - - - Disable radio period - RW - Single - Optional - Integer - 0..65535 - - 0 the device SHALL disconnect. When the period has elapsed the device MAY reconnect.]]> - - Module activation code - RW - Single - Optional - String - - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - PSM Timer (1) - RW - Single - Optional - Integer - - s - - - Active Timer (1) - RW - Single - Optional - Integer - - s - - - Serving PLMN Rate control - R - Single - Optional - Integer - - - - - eDRX parameters for Iu mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - eDRX parameters for WB-S1 mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - eDRX parameters for NB-S1 mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - eDRX parameters for A/Gb mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - Activated Profile Names - R - Multiple - Mandatory - Objlnk - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_DevCapMgmt-v1_0.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_DevCapMgmt-v1_0.xml deleted file mode 100644 index 6569894e18..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_DevCapMgmt-v1_0.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - DevCapMgmt - - 15 - urn:oma:lwm2m:oma:15 - Multiple - Optional - - Property - R - Single - Mandatory - String - - - - - Group - R - Single - Mandatory - Integer - 0-15 - - - - Description - R - Single - Optional - String - - - - - Attached - R - Single - Optional - Boolean - - - - - Enabled - R - Single - Mandatory - Boolean - - - - - opEnable - E - Single - Mandatory - - - - - - opDisable - E - Multiple - Mandatory - - - - - - NotifyEn - RW - Single - Optional - Boolean - - - - - - - \ No newline at end of file diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_LOCKWIPE-v1_0_1.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_LOCKWIPE-v1_0_1.xml deleted file mode 100644 index 912add1a0a..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_LOCKWIPE-v1_0_1.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - Lock and Wipe - - 8 - urn:oma:lwm2m:oma:8 - Single - Optional - - State - RW - Single - Mandatory - Integer - 0-2 - - - - Lock target - W - Multiple - Mandatory - String - - - - - Wipe item - R - Multiple - Optional - String - - - - - Wipe - E - Single - Mandatory - - - - - - - Wipe target - W - Multiple - Mandatory - String - - - - Lock or Wipe Operation Result - R - Single - Mandatory - Integer - 0-8 - - - - - - \ No newline at end of file diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_Portfolio-v1_0.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_Portfolio-v1_0.xml deleted file mode 100644 index 8147fc64a2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_Portfolio-v1_0.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - Portfolio - - 16 - urn:oma:lwm2m:oma:161.0 - 1.0Multiple - Optional - - Identity - RW - Multiple - Mandatory - String - - - - - GetAuthData - E - Single - Optional - - - - - - AuthData - R - Multiple - Optional - Opaque - - - - - AuthStatus - R - Single - Optional - Integer - [0-2] - - - - - - \ No newline at end of file diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Component-v1_0.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Component-v1_0.xml deleted file mode 100644 index 2cbdc8b76b..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Component-v1_0.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - LWM2M Software Component - - 14 - urn:oma:lwm2m:oma:14 - Multiple - Optional - - - Component Identity - R - Single - Optional - String - 0-255 bytes - - - - - Component Pack - R - Single - Optional - Opaque - - - - - - Component Version - R - Single - Optional - String - 0-255 bytes - - - - - Activate - E - Single - Optional - - - - - - - Deactivate - E - Single - Optional - - - - - - Activation State - R - Single - Optional - Boolean - - - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Management-v1_0.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Management-v1_0.xml deleted file mode 100644 index 33d9a62f4c..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_Software_Management-v1_0.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - LWM2M Software Management - - 9 - urn:oma:lwm2m:oma:9 - Multiple - Optional - - - PkgName - R - Single - Mandatory - String - 0-255 bytes - - - - - PkgVersion - R - Single - Mandatory - String - 0-255 bytes - - - - - Package - W - Single - Optional - Opaque - - - - - - Package URI - W - Single - Optional - String - 0-255 bytes - - - - - Install - E - Single - Mandatory - - - - - - Checkpoint - R - Single - Optional - Objlnk - - - - - Uninstall - E - Single - Mandatory - - - - - - Update State - R - Single - Mandatory - Integer - 0-4 - - - - Update Supported Objects - RW - Single - Optional - Boolean - - - - - Update Result - R - Single - Mandatory - Integer - 0-200 - - - - Activate - E - Single - Mandatory - - - - - - Deactivate - E - Single - Mandatory - - - - - - Activation State - R - Single - Mandatory - Boolean - - - - - Package Settings - RW - Single - Optional - Objlnk - - - - - User Name - W - Single - Optional - String - 0-255 bytes - - - - Password - W - Single - Optional - String - 0-255 bytes - - - - - - diff --git a/common/transport/lwm2m/src/main/resources/models/LWM2M_WLAN_connectivity4-v1_0.xml b/common/transport/lwm2m/src/main/resources/models/LWM2M_WLAN_connectivity4-v1_0.xml deleted file mode 100644 index 71252b2b5c..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LWM2M_WLAN_connectivity4-v1_0.xml +++ /dev/null @@ -1,572 +0,0 @@ - - - - - - - WLAN connectivity - - 12 - urn:oma:lwm2m:oma:12 - - - Multiple - Optional - - Interface name - RW - Single - Mandatory - String - - - - - Enable - RW - Single - Mandatory - Boolean - - - - - Radio Enabled - RW - Single - Optional - Integer - - - - - Status - R - Single - Mandatory - Integer - - - - - BSSID - R - Single - Mandatory - String - 12 bytes - - - - SSID - RW - Single - Mandatory - String - 1-32 Bytes - - - - Broadcast SSID - RW - Single - Optional - Boolean - - - - - Beacon Enabled - RW - Single - Optional - Boolean - - - - - Mode - RW - Single - Mandatory - Integer - - - - - Channel - RW - Single - Mandatory - Integer - 0-255 - - - - Auto Channel - RW - Single - Optional - Boolean - - - - - Supported Channels - RW - Multiple - Optional - Integer - - - - - Channels In Use - RW - Multiple - Optional - Integer - - - - - Regulatory Domain - RW - Single - Optional - String - 3 Bytes - - - - Standard - RW - Single - Mandatory - Integer - - - - - Authentication Mode - RW - Single - Mandatory - Integer - - - - - Encryption Mode - RW - Single - Optional - Integer - - - - - WPA Pre Shared Key - W - Single - Optional - String - 64 Bytes - - - - WPA Key Phrase - W - Single - Optional - String - 1-64 Bytes - - - - WEP Encryption Type - RW - Single - Optional - Integer - - - - - WEP Key Index - RW - Single - Optional - Integer - [1:4] - - - - WEP Key Phrase - W - Single - Optional - String - 1-64 Bytes - - - - WEP Key 1 - W - Single - Optional - String - 0 or 26 Bytes - - - - WEP Key 2 - W - Single - Optional - String - 0 or 26 Bytes - - - - WEP Key 3 - W - Single - Optional - String - 10 or 26 Bytes - - - - WEP Key 4 - W - Single - Optional - String - 10 or 26 Bytes - - - - RADIUS Server - RW - Single - Optional - String - 1-256 Bytes - - - - RADIUS Server Port - RW - Single - Optional - Integer - - - - - RADIUS Secret - W - Single - Optional - String - 1-256 Bytes - - - - WMM Supported - R - Single - Optional - Boolean - - - - - WMM Enabled - RW - Single - Optional - Boolean - - - - - MAC Control Enabled - RW - Single - Optional - Boolean - - - - - MAC Address List - RW - Multiple - Optional - String - 12 Bytes - - - - Total Bytes Sent - R - Single - Optional - Integer - - - - - Total Bytes Received - R - Single - Optional - Integer - - - - - Total Packets Sent - R - Single - Optional - Integer - - - - - Total Packets Received - R - Single - Optional - Integer - - - - - Transmit Errors - R - Single - Optional - Integer - - - - - Receive Errors - R - Single - Optional - Integer - - - - - Unicast Packets Sent - R - Single - Optional - Integer - - - - - Unicast Packets Received - R - Single - Optional - Integer - - - - - Multicast Packets Received - R - Single - Optional - Integer - - - - - Multicast Packets Received - R - Single - Optional - Integer - - - - - Broadcast Packets Sent - R - Single - Optional - Integer - - - - - 44 Broadcast Packets Received - R - Single - Optional - Integer - - - - - Discard Packets Sent - R - Single - Optional - Integer - - - - - Discard Packets Received - R - Single - Optional - Integer - - - - - Unknown Packets Received - R - Single - Optional - Integer - - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - - - \ No newline at end of file diff --git a/common/transport/lwm2m/src/main/resources/models/LwM2M_EventLog-V1_0.xml b/common/transport/lwm2m/src/main/resources/models/LwM2M_EventLog-V1_0.xml deleted file mode 100644 index 7cc3f918b2..0000000000 --- a/common/transport/lwm2m/src/main/resources/models/LwM2M_EventLog-V1_0.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - Event Log - - 20 - urn:oma:lwm2m:oma:20 - 1.0 - 1.0 - Single - Optional - - LogClass - RW - Single - Optional - Integer - 255 - - - - LogStart - E - Single - Optional - - - - - - LogStop - E - Single - Optional - - - - - - LogStatus - R - Single - Optional - Integer - 8-Bits - - - - LogData - R - Single - Mandatory - Opaque - - - - - LogDataFormat - RW - Single - Optional - Integer - 255 - - - - - - \ No newline at end of file diff --git a/transport/lwm2m/src/main/data/models/10241.xml b/transport/lwm2m/src/main/data/models/10241.xml deleted file mode 100644 index 83059a9be8..0000000000 --- a/transport/lwm2m/src/main/data/models/10241.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - HostDeviceInfo - - 10241 - urn:oma:lwm2m:x:10241 - - - Multiple - Optional - - Host Device Manufacturer - R - Multiple - Mandatory - String - - - - - Host Device Model Number - R - Multiple - Mandatory - String - - - - - Host Device Unique ID - R - Multiple - Mandatory - String - - - - - Host Device Software Version - R - Multiple - Mandatory - String - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10242.xml b/transport/lwm2m/src/main/data/models/10242.xml deleted file mode 100644 index f7d1017106..0000000000 --- a/transport/lwm2m/src/main/data/models/10242.xml +++ /dev/null @@ -1,647 +0,0 @@ - - - - - 3-Phase Power Meter - - - - 10242 - urn:oma:lwm2m:x:10242 - 1.0 - 1.0 - Multiple - Optional - - - Manufacturer - R - Single - Optional - String - - - - - - - - Model Number - R - Single - Optional - String - - - - - - - - Serial Number - R - Single - Optional - String - - - - - - - - Description - R - Single - Optional - String - - - - - - - - Tension R - R - Single - Mandatory - Float - - V - - - - - - Current R - R - Single - Mandatory - Float - - A - - - - - - Active Power R - R - Single - Optional - Float - - kW - - - - - - Reactive Power R - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power R - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power R - R - Single - Optional - Float - - kvar - - - - - - Apparent Power R - R - Single - Optional - Float - - kVA - - - - - - Power Factor R - R - Single - Optional - Float - -1..1 - - - - - - - THD-V R - R - Single - Optional - Float - - /100 - - - - - - THD-A R - R - Single - Optional - Float - - /100 - - - - - - Tension S - R - Single - Mandatory - Float - - V - - - - - - Current S - R - Single - Mandatory - Float - - A - - - - - - Active Power S - R - Single - Optional - Float - - kW - - - - - - Reactive Power S - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power S - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power S - R - Single - Optional - Float - - kvar - - - - - - Apparent Power S - R - Single - Optional - Float - - kVA - - - - - - Power Factor S - R - Single - Optional - Float - -1..1 - - - - - - - THD-V S - R - Single - Optional - Float - - /100 - - - - - - THD-A S - R - Single - Optional - Float - - /100 - - - - - - Tension T - R - Single - Mandatory - Float - - V - - - - - - Current T - R - Single - Mandatory - Float - - A - - - - - - Active Power T - R - Single - Optional - Float - - kW - - - - - - Reactive Power T - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power T - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power T - R - Single - Optional - Float - - kvar - - - - - - Apparent Power T - R - Single - Optional - Float - - kVA - - - - - - Power Factor T - R - Single - Optional - Float - -1..1 - - - - - - - THD-V T - R - Single - Optional - Float - - /100 - - - - - - THD-A T - R - Single - Optional - Float - - /100 - - - - - - 3-Phase Active Power - R - Single - Optional - Float - - kW - - - - - - 3-Phase Reactive Power - R - Single - Optional - Float - - kvar - - - - - - 3-Phase Inductive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - 3-Phase Capacitive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - 3-Phase Apparent Power - R - Single - Optional - Float - - kVA - - - - - - 3-Phase Power Factor - R - Single - Optional - Float - -1..1 - - - - - - - 3-Phase phi cosine - R - Single - Optional - Float - -1..1 - - - - - - - Active Energy - R - Single - Optional - Float - - kWh - - - - - - Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Inductive Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Capacitive Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Apparent Energy - R - Single - Optional - Float - - kVAh - - - - - - Tension R-S - R - Single - Optional - Float - - V - - - - - - Tension S-T - R - Single - Optional - Float - - V - - - - - - Tension T-R - R - Single - Optional - Float - - V - - - - - - Frequency - R - Single - Optional - Float - - Hz - - - - - - Neutral Current - R - Single - Optional - Float - - A - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10243.xml b/transport/lwm2m/src/main/data/models/10243.xml deleted file mode 100644 index 7841643a87..0000000000 --- a/transport/lwm2m/src/main/data/models/10243.xml +++ /dev/null @@ -1,251 +0,0 @@ - - - - - Single-Phase Power Meter - - - - 10243 - urn:oma:lwm2m:x:10243 - 1.0 - 1.0 - Multiple - Optional - - - Manufacturer - R - Single - Optional - String - - - - - - - - Model Number - R - Single - Optional - String - - - - - - - - Serial Number - R - Single - Optional - String - - - - - - - - Description - R - Single - Optional - String - - - - - - - - Tension - R - Single - Mandatory - String - - V - - - - - - Current - R - Single - Mandatory - Float - - A - - - - - - Active Power - R - Single - Optional - Float - - kW - - - - - - Reactive Power - R - Single - Optional - Float - - kvar - - - - - - Inductive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - Capacitive Reactive Power - R - Single - Optional - Float - - kvar - - - - - - Apparent Power - R - Single - Optional - Float - - kVA - - - - - - Power Factor - R - Single - Optional - Float - -1..1 - - - - - - - THD-V - R - Single - Optional - Float - - /100 - - - - - - THD-A - R - Single - Optional - Float - - /100 - - - - - - Active Energy - R - Single - Optional - Float - - kWh - - - - - - Reactive Energy - R - Single - Optional - Float - - kvarh - - - - - - Apparent Energy - R - Single - Optional - Float - - kVAh - - - - - - Frequency - R - Single - Optional - Float - - Hz - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10244.xml b/transport/lwm2m/src/main/data/models/10244.xml deleted file mode 100644 index 0eca788cbf..0000000000 --- a/transport/lwm2m/src/main/data/models/10244.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - - VehicleControlUnit - - 10244 - urn:oma:lwm2m:x:10244 - Single - Optional - - Vehicle UI State - R - Single - Mandatory - Integer - 0..15 - - - - Vehicle Speed - R - Single - Mandatory - Integer - - km/h - - - Vehicle Shift Status - R - Single - Mandatory - Integer - 0..3 - - - - Vehicle AP Position - R - Single - Mandatory - Integer - 0..100 - /100 - - - Vehicle Power - R - Single - Optional - Float - - kW - - - Vehicle Drive Energy - R - Single - Optional - Float - - Wh - - - Vehicle Energy Consumption Efficiency - R - Single - Optional - Float - - Wh/km - - - Vehicle Estimated Mileage - R - Single - Optional - Integer - - km - - - Vehicle Charge Cable Status - R - Single - Mandatory - Boolean - - - - - Vehicle Charge Status - R - Single - Mandatory - Integer - 0..15 - - - - Vehicle Charge Voltage - R - Single - Mandatory - Float - - V - - - Vehicle Charge Current - R - Single - Mandatory - Float - - A - - - Vehicle Charge Remaining Time - R - Single - Mandatory - Integer - - min - - - Battery Pack Voltage - R - Single - Mandatory - Float - - V - - - Battery Pack Current - R - Single - Mandatory - Float - - A - - - Battery Pack Remaining Capacity - R - Single - Mandatory - Integer - - Ah - - - Battery Pack SOC - R - Single - Mandatory - Integer - 0..100 - /100 - - - Battery Pack SOH - R - Single - Mandatory - Integer - 0..100 - /100 - - - Battery Cell MinVolt - R - Single - Mandatory - Integer - - mV - - - Battery Cell MaxVolt - R - Single - Mandatory - Integer - - mV - - - Battery Module MinTemp - R - Single - Mandatory - Integer - - Cel - - - Battery Module MaxTemp - R - Single - Mandatory - Integer - - Cel - - - Battery Connection Status - R - Single - Mandatory - Boolean - - - - - - MCU Voltage - R - Single - Mandatory - Integer - - V - - - MCU Temperature - R - Single - Mandatory - Integer - - Cel - - - Motor Speed - R - Single - Mandatory - Integer - - 1/min - - - Motor Temperature - R - Single - Mandatory - Integer - - Cel - - - Motor OT Warning - R - Single - Optional - Boolean - - - - - MCU OT Warning - R - Single - Optional - Boolean - - - - - Battery Pack OT Warning - R - Single - Optional - Boolean - - - - - MCU fault - R - Single - Optional - Boolean - - - - - Motor Error - R - Single - Optional - Boolean - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10245.xml b/transport/lwm2m/src/main/data/models/10245.xml deleted file mode 100644 index 4e16819aca..0000000000 --- a/transport/lwm2m/src/main/data/models/10245.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - Relay Management - This LWM2M Object provides a range of eNB related measurements and parameters of which several are changeable. Furthermore, it includes Resources to enable/disable the eNB. - 10245 - urn:oma:lwm2m:x:10245 - - - Single - Optional - - - eNB Availability - R - Single - Mandatory - Boolean - AVAILABLE; UNAVAILABLE - - This field indicates to the CCC whether or not the eNB of the CrowdBox is available for activation: AVAILABLE = TRUE; UNAVAILABLE = FALSE This is set by the CrowdBox itself using an algorithm specific to the use case and based on parameters known to the CrowdBox which may not necessarily be signalled to the network. In the absence of a more specific algorithm, this parameter should be set to AVAILABLE, unless a fault is detected which would prevent activation of the eNB, in which case it should be set to UNAVAILABLE. - - - GPS Status - R - Single - Mandatory - Boolean - UNSYNCHRONISED; SYNCHRONISED - - States whether the CrowdBox GPS receiver is synchronised to GPS time or not: UNSYCHRONISED = FALSE; SYNCHRONISED = TRUE If more than one GPS receiver is used by the CrowdBox, then SYNCHRONISED should be reported only if all receivers are synchronised. - - - Orientation - R - Single - Optional - Integer - -180..180 - deg - Orientation of CrowdBox with respect to magnetic north. The reference orientation of the CrowdBox shall be the pointing direction of the eNB antenna(s) or, in the case of an omni-directional CrowdBox antenna, as defined in the accompanying product documentation. - - - eNB EARFCN - RW - Single - Mandatory - Integer - 0..65535 - - EARFCN currently used by the eNB. Highest valid value in 3GPP is currently 46589. If the requested EARFCN is not supported by the eNB, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - eNB Bandwidth - RW - Single - Mandatory - Integer - 5, 10, 15, 20 - - Bandwidth of the currently used eNB carrier. If the requested bandwidth is not supported by the eNB, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Primary EARFCN - RW - Single - Mandatory - Integer - 0..65535 - - EARFCN of primary cell used for the backhaul. If the requested EARFCN is not supported by the CrowdBox UE, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Secondary EARFCN - RW - Multiple - Mandatory - Integer - 0..65535 - - EARFCN of any secondary cells used for the backhaul, in the event that carrier aggregation is being used. If the requested EARFCN is not supported by the CrowdBox UE, the response should be "Bad Request". The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Cumulative Measurement Window - RW - Single - Mandatory - Integer - 0..65535 - s - The current measurement interval over which cumulative statistics are collected for the following resources: Cumulative Number of Unique Users, Cumulative Downlink Throughput per Connected User, Cumulative Uplink Throughput per Connected User. Note that this measurement period is a sliding window rather than a granularity period. Measurements should never be reset, but rather old measurements should be removed from the cumulative total as they fall outside of the window. A value of 0 shall be interpreted as meaning only the current value should be reported. A value of 65535 shall be interpreted as an infinite window size (i.e. old measurements are never discarded). - - - eNB ECI - R - Single - Mandatory - Integer - 0..2^28-1 - - A 28 bit E-UTRAN Cell Identifier (ECI) - - - eNB Status - RW - Single - Mandatory - Boolean - - - This resource indicates the current status of the eNB and can be used by the CCC to change the state from enabled to disabled. TRUE = eNB enabled FALSE = eNB disabled - - - Enable eNB - E - Single - Mandatory - - - - Enables the eNB. In addition the CrowdBox shall also update its configuration to reflect the current state of other relevant parameters. This might require a reboot. - - - eNB Maximum Power - RW - Single - Mandatory - Integer - 0..63 - dBm - Maximum power for the eNB measured as the sum of input powers to all antenna connectors. The maximum power per antenna port is equal to the maximum eNB power divided by the number of antenna ports. If the requested power is above or below the maximum or minimum power levels of the eNB, then the power level should be set to the maximum or minimum respectively. The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Primary q-OffsetFreq - RW - Single - Mandatory - Integer - -24..24 - dB - q-OffsetFreq parameter for the backhaul primary EARFCN in SIB5 of the CrowdBox eNB BCCH. See TS 36.331 for details. Range: dB-24; dB-22 .. dB24 The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Backhaul Secondary q-OffsetFreq - RW - Multiple - Mandatory - Integer - -24..24 - dB - q-OffsetFreq parameter for the backhaul secondary EARFCN in SIB5 of the CrowdBox eNB BCCH. See TS 36.331 for details Range: dB-24; dB-22 .. dB24 The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Neighbour CrowdBox EARFCN - RW - Multiple - Mandatory - Integer - 0..66635 - - EARFCN of a neighbour CrowdBox. Each instance of this resource relates to the same instance of resource ID 15. - - - Neighbour CrowdBox q-OffsetFreq - RW - Multiple - Mandatory - Integer - -24..24 - dB - q-OffsetFreq parameter of the Neighbour CrowdBox EARFCN in SIB5 of the Neighbour CrowdBox eNB BCCH. See TS 36.331 for details Range: dB-24; dB-22 .. dB24 Each instance of this resource relates to the same instance of resource ID 14. The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - Serving Macro eNB cellIndividualOffset - RW - Single - Mandatory - Integer - -24..24 - dB - Specifies the value of the cellIndividualOffset parameter applicable to the CrowdBox macro serving cell that is to be signalled to connected UEs in their measurement configuration information . See TS 36.331 for details. The CrowdBox shall only apply a change of this resource upon execution of the “Enable eNB” command. - - - - - diff --git a/transport/lwm2m/src/main/data/models/10246.xml b/transport/lwm2m/src/main/data/models/10246.xml deleted file mode 100644 index d519e6be2c..0000000000 --- a/transport/lwm2m/src/main/data/models/10246.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - CrowdBox Measurements - This LWM2M Object provides CrowdBox-related measurements such as serving cell parameters, backhaul timing advance, and neighbour cell reports. - 10246 - urn:oma:lwm2m:x:10246 - - - Single - Optional - - - Serving Cell ID - R - Single - Mandatory - Integer - 0..2^32-1 - - Serving cell ID as specified by the cellIdentity field broadcast in SIB1 of the serving cell (see TS 36.331). - - - Serving Cell RSRP - R - Single - Mandatory - Integer - 0..97 - - Serving cell RSRP, as defined in TS 36.133, Section 9.1.4. Range: RSRP_00; RSRP_01 .. RSRP_97 - - - Serving Cell RSRQ - R - Single - Mandatory - Integer - -30..46 - - Serving cell RSRQ, as defined in TS 36.133, Section 9.1.7. Range: RSRQ_-30; RSRQ_-29 .. RSRQ_46 - - - Serving Cell SINR - R - Single - Mandatory - Integer - -10..30 - dB - SINR of serving cell as estimated by the CrowdBox. Note that this is a proprietary measurement dependent on the UE chipset manufacturer. The UE chipset used should be stated in the accompanying product documentation. - - - Cumulative Backhaul Timing Advance - R - Single - Optional - Integer - 0..65535 - - The cumulative timing advance signalled by the current serving cell to the CrowdBox. This is the sum of the initial timing advance signalled in the MAC payload of the Random Access Response (11 bits, 0 .. 1282) and subsequent adjustments signalled in the MAC PDU of DL-SCH transmissions (6 bits, -31 .. 32). See TS 36.321 for details. - - - Neighbour Cell Report - R - Multiple - Mandatory - Objlnk - - - A link to the "Neighbour Cell Report" object for each neighbour cell of the CrowdBox. - - - - - diff --git a/transport/lwm2m/src/main/data/models/10247.xml b/transport/lwm2m/src/main/data/models/10247.xml deleted file mode 100644 index aa2cec7ca8..0000000000 --- a/transport/lwm2m/src/main/data/models/10247.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Neighbour Cell Report - This LWM2M Object provides the neighbour cell report. The CrowdBox Measurements Object and the Connected UE Report Object have both Objlnk Resources pointing to this Object. - 10247 - urn:oma:lwm2m:x:10247 - - - Multiple - Optional - - - Neighbour PCI - R - Single - Mandatory - Integer - 0..503 - - Physical Cell ID of neighbouring LTE cell, as defined in TS 36.211 - - - Neighbour Cell ID - R - Single - Optional - Integer - 0..2^32-1 - - Neighbour cell ID as specified by the cellIdentity field broadcast in SIB1 of the neighbour cell (see TS 36.331). - - - Neighbour Cell Rank - R - Single - Mandatory - Integer - 0..255 - - Current neighbour cell rank. Neighbour cells should be ordered (ranked) by the CrowdBox according to neighbour cell RSRP, with a higher RSRP corresponding to a lower index. Hence the neighbouring cell with the highest RSRP should be neighbour cell 0, the second neighbour cell 1, and so on. - - - Neighbour Cell RSRP - R - Single - Mandatory - Integer - 0..97 - - Neighbour cell RSRP, as defined in TS 36.133, Section 9.1.4. Range: RSRP_00; RSRP_01 .. RSRP_97 - - - Neighbour Cell RSRQ - R - Single - Mandatory - Integer - -30..46 - - Neighbour cell RSRQ, as defined in TS 36.133, Section 9.1.7. Range: RSRQ_-30; RSRQ_-29 .. RSRQ_46 - - - - - diff --git a/transport/lwm2m/src/main/data/models/10248.xml b/transport/lwm2m/src/main/data/models/10248.xml deleted file mode 100644 index 945cc4bc0e..0000000000 --- a/transport/lwm2m/src/main/data/models/10248.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Connected UE Measurements - This LWM2M Object provides a range of measurements of connected UEs and provides an Object link to the Connected UE report. - 10248 - urn:oma:lwm2m:x:10248 - - - Single - Optional - - - Number of Connected Users - R - Single - Mandatory - Integer - 0..255 - - The number of different UEs currently connected to the eNB (i.e. in RRC_CONNECTED state). - - - Cumulative Number of Unique Users - R - Single - Mandatory - Integer - 0..65535 - - The number of different UEs that have connected to the eNB over the immediately preceding period specified by the "Cumulative Measurement Window" field. - - - Connected UE Report - R - Multiple - Mandatory - Objlnk - - - Provides an Object link to the Connected UE Report which provides a range of information related to the connected UEs. - - - - - diff --git a/transport/lwm2m/src/main/data/models/10249.xml b/transport/lwm2m/src/main/data/models/10249.xml deleted file mode 100644 index 2f23f8fe74..0000000000 --- a/transport/lwm2m/src/main/data/models/10249.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Connected UE Report - This LWM2M Object provides a range of information related to the connected UEs. - 10249 - urn:oma:lwm2m:x:10249 - - - Multiple - Optional - - - Connected User MMEC - R - Single - Mandatory - Integer - 0..255 - - MMEC signalled by the UE to the eNB in the RRCConnectionRequest message (see TS 36.331). - - - Connected User M-TMSI - R - Single - Mandatory - Integer - 0..2^32-1 - - M-TMSI signalled by the UE to the eNB in the RRCConnectionRequest message (see TS 36.331). - - - Serving Cell (CrowdBox) eNB RSRP - R - Single - Mandatory - Integer - 0..97 - - The RSRP of the CrowdBox eNB, as defined in TS 36.133, Section 9.1.4. Range: RSRP_00; RSRP_01 .. RSRP_97 - - - Serving Cell (CrowdBox) eNB RSRQ - R - Single - Mandatory - Integer - -30..46 - - The RSRQ of the CrowdBox eNB, as defined in TS 36.133, Section 9.1.7. Range: RSRQ_-30; RSRQ_-29 .. RSRQ_46 - - - Cumulative Timing Advance per Connected User - R - Single - Optional - Integer - 0..65535 - - The cumulative timing advance signalled by the eNB to each currently connected UE. This is the sum of the initial timing advance signalled in the MAC payload of the Random Access Response (11 bits, 0 .. 1282) and subsequent adjustments signalled in the MAC PDU of DL-SCH transmissions (6 bits, -31 .. 32). See TS 36.321 for details. - - - Last downlink CQI report per Connected User - R - Single - Mandatory - Integer - 0..255 - - The last downlink wideband CQI reported by a connected user the eNB. The CQI format is defined in Table 7.2.3-1 of TS 36.213. - - - Cumulative Downlink Throughput per Connected User - R - Single - Mandatory - Integer - 0..2^32-1 - B - The total number of MAC bytes sent to the connected user over the immediately preceding period specified by the "Cumulative Measurement Window" field. - - - Cumulative Uplink Throughput per Connected User - R - Single - Mandatory - Integer - 0..2^32-1 - B - The total number of MAC bytes received from the connected user over the immediately preceding period specified by the "Cumulative Measurement Window" field. - - - Neighbour Cell Report - R - Multiple - Mandatory - Objlnk - - - A link to the "Neighbour Cell Report" object for each neighbour cell reported to the CrowdBox by the connected UE - - - - - diff --git a/transport/lwm2m/src/main/data/models/10250.xml b/transport/lwm2m/src/main/data/models/10250.xml deleted file mode 100644 index 43ca19cb75..0000000000 --- a/transport/lwm2m/src/main/data/models/10250.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - App Data Container - - 10250 - urn:oma:lwm2m:x:10250 - 1.0 - 1.0 - Single - Optional - - - UL data - R - Single - Mandatory - Opaque - - - - - - - - DL data - W - Single - Mandatory - Opaque - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10251.xml b/transport/lwm2m/src/main/data/models/10251.xml deleted file mode 100644 index 33d4a683b4..0000000000 --- a/transport/lwm2m/src/main/data/models/10251.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - AT Command - - 10251 - urn:oma:lwm2m:x:10251 - 1.0 - 1.0 - Multiple - Optional - - - Command - RW - Single - Mandatory - String - - - - - - Response - R - Multiple - Mandatory - String - - - - - - Status - R - Multiple - Mandatory - String - - - - - - Timeout - RW - Single - Optional - Integer - - - - - - Run - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10252.xml b/transport/lwm2m/src/main/data/models/10252.xml deleted file mode 100644 index f5b51f57cd..0000000000 --- a/transport/lwm2m/src/main/data/models/10252.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - Manifest - - 10252 - urn:oma:lwm2m:x:10252 - 1.0 - 1.0 - Single - Optional - - - Manifest - W - Single - Mandatory - Opaque - - - - - - - - State - R - Single - Mandatory - Integer - 0..8 - - - - - - Manifest Result - R - Single - Mandatory - Integer - 0..19 - - - - - - Payload Result - R - Single - Mandatory - Opaque - - - - - - - - Asset Hash - R - Single - Mandatory - Opaque - - - - - - - - Manifest version - R - Single - Mandatory - Integer - - - - - - - - Asset Installation Progress - R - Single - Mandatory - Integer - - - - - - - - Campaign Id - RW - Single - Mandatory - String - - - - - - - - Manual Trigger - E - Single - Mandatory - - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10253.xml b/transport/lwm2m/src/main/data/models/10253.xml deleted file mode 100644 index e6aa2fe8ba..0000000000 --- a/transport/lwm2m/src/main/data/models/10253.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Confidential Data - - 10253 - urn:oma:lwm2m:x:10253 - 1.0 - 1.0 - Single - Optional - - - Public Key - RW - Single - Mandatory - Opaque - - - - - - - - Application Data - R - Single - Mandatory - Opaque - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10254.xml b/transport/lwm2m/src/main/data/models/10254.xml deleted file mode 100644 index 5c42b8b127..0000000000 --- a/transport/lwm2m/src/main/data/models/10254.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Current Loop Input - - 10254 - urn:oma:lwm2m:x:10254:1.0 - 1.0 - 1.0 - Multiple - Optional - - - Current Loop Input Current Value - R - Single - Mandatory - Float - 0; 3.8-20.5 - mA - - - - Min Measured Value - R - Single - Optional - Float - - - - - - Max Measured Value - R - Single - Optional - Float - - - - - - Min Range Value - R - Single - Optional - Float - - - - - - Max Range Value - R - Single - Optional - Float - - - - - - Reset Min and Max Measured Values - E - Single - Optional - - - - - - - Sensor Units - R - Single - Optional - String - - - - - - Application Type - RW - Single - Optional - String - - - - - - Current Calibration - RW - Single - Optional - Float - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10255.xml b/transport/lwm2m/src/main/data/models/10255.xml deleted file mode 100644 index 9c41eca0fb..0000000000 --- a/transport/lwm2m/src/main/data/models/10255.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - Device Metadata - - 10255 - urn:oma:lwm2m:x:10255 - 1.0 - 1.0 - Single - Optional - - - Protocol supported - R - Single - Mandatory - Integer - - - - - - - - Bootloader hash - R - Single - Mandatory - Opaque - - - - - - - - OEM bootloader hash - R - Single - Mandatory - Opaque - - - - - - - - Vendor - R - Single - Mandatory - String - - - - - - - - Class - R - Single - Mandatory - String - - - - - - - - Device - R - Single - Mandatory - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10256.xml b/transport/lwm2m/src/main/data/models/10256.xml deleted file mode 100644 index 9d1af33e5d..0000000000 --- a/transport/lwm2m/src/main/data/models/10256.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - ECID-Signal Measurement Information - - 10256 - urn:oma:lwm2m:x:10256 - 1.0 - 1.0 - Multiple - Optional - - - physCellId - R - Single - Mandatory - Integer - - - - - - - - ECGI - R - Single - Optional - Integer - - - - - - - - arfcnEUTRA - R - Single - Mandatory - Integer - - - - - - - - rsrp-Result - R - Single - Mandatory - Integer - - - - - - - - rsrq-Result - R - Single - Optional - Integer - - - - - - - - ue-RxTxTimeDiff - R - Single - Optional - Integer - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10257.xml b/transport/lwm2m/src/main/data/models/10257.xml deleted file mode 100644 index f7db654454..0000000000 --- a/transport/lwm2m/src/main/data/models/10257.xml +++ /dev/null @@ -1,292 +0,0 @@ - - - - - Heat / Cooling meter - - 10257 - urn:oma:lwm2m:x:10257 - 1.0 - 1.0 - Multiple - Optional - - - Manufacturer - R - Single - Optional - String - - - - - - Model Number - R - Single - Optional - String - - - - - - Serial Number - R - Single - Optional - String - - - - - - Description - R - Single - Optional - String - - - - - - Error code - R - Multiple - Optional - Integer - - - - - - - Instantaneous active power - R - Single - Optional - Float - - W - - - - Max Measured active power - R - Multiple - Mandatory - Float - - W - - - - Cumulative active power - R - Single - Optional - Float - - Wh - - - - Flow temperature - R - Single - Optional - Float - - Cel - - - - Max Measured flow temperature - R - Single - Optional - Float - - Cel - - - - Return temperature - R - Single - Optional - Float - - Cel - - - - Max Measured return temperature - R - Single - Optional - Float - - Cel - - - - Temperature difference - R - Single - Optional - Float - - K - - - - Flow rate - R - Single - Optional - Float - - m3/s - - - - Max Measured flow - R - Single - Optional - Float - - m3/s - - - - Flow volume - R - Single - Optional - Float - - m3 - - - - Return volume - R - Single - Optional - Float - - m3 - - - - Current Time - RW - Single - Optional - Time - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10258.xml b/transport/lwm2m/src/main/data/models/10258.xml deleted file mode 100644 index e5534a39e6..0000000000 --- a/transport/lwm2m/src/main/data/models/10258.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Current Loop Output - - 10258 - urn:oma:lwm2m:x:10258 - 1.0 - 1.0 - Multiple - Optional - - - Current Loop Output Current Value - RW - Single - Mandatory - Float - 3.8-20.5 - mA - - - - Min Range Value - R - Single - Optional - Float - - - - - - Max Range Value - R - Single - Optional - Float - - - - - - Sensor Units - R - Single - Optional - String - - - - - - Application Type - RW - Single - Optional - String - - - - - - Current Calibration - RW - Single - Optional - Float - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10259.xml b/transport/lwm2m/src/main/data/models/10259.xml deleted file mode 100644 index e81e9aa711..0000000000 --- a/transport/lwm2m/src/main/data/models/10259.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - System Log - - 10259 - urn:oma:lwm2m:x:10259 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - Read All - R - Single - Mandatory - String - - - - - - - - Read - R - Single - Optional - String - - - - - - - - Enabled - RW - Single - Optional - Boolean - - - - - - - - Capture Level - RW - Single - Optional - Integer - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10260-2_0.xml b/transport/lwm2m/src/main/data/models/10260-2_0.xml deleted file mode 100644 index d6e9b0caf0..0000000000 --- a/transport/lwm2m/src/main/data/models/10260-2_0.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - RDB - - 10260 - urn:oma:lwm2m:x:10260:2.0 - 1.0 - 2.0 - Multiple - Optional - - - Key - RW - Single - Mandatory - String - - - - - - - - Value - RW - Single - Optional - String - - - - - - - - Exists - RW - Single - Optional - Boolean - - - - - - - - Persistent - RW - Single - Optional - Boolean - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10262.xml b/transport/lwm2m/src/main/data/models/10262.xml deleted file mode 100644 index bc444c3cfc..0000000000 --- a/transport/lwm2m/src/main/data/models/10262.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - Interval Data Delivery - - 10262 - urn:oma:lwm2m:x:10262 - Multiple - Optional - - - Name - RW - Single - Mandatory - String - - - - - - Interval Data Links - RW - Multiple - Mandatory - Objlnk - - - - - - Latest Payload - R - Multiple - Mandatory - Opaque - - - - - - Schedule - RW - Single - Optional - Objlnk - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10263.xml b/transport/lwm2m/src/main/data/models/10263.xml deleted file mode 100644 index efe90b704d..0000000000 --- a/transport/lwm2m/src/main/data/models/10263.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - Event Data Delivery - - 10263 - urn:oma:lwm2m:x:10263 - Multiple - Optional - - - Name - RW - Single - Mandatory - String - - - - - - Event Data Links - RW - Multiple - Mandatory - Objlnk - - - - - - Latest Eventlog - R - Multiple - Mandatory - Opaque - - - - - - Schedule - RW - Single - Mandatory - Objlnk - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10264.xml b/transport/lwm2m/src/main/data/models/10264.xml deleted file mode 100644 index 4f1000a044..0000000000 --- a/transport/lwm2m/src/main/data/models/10264.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - Delivery Schedule - - 10264 - urn:oma:lwm2m:x:10264 - Multiple - Optional - - - Schedule Start Time - RW - Single - Mandatory - Integer - - - - - - Schedule UTC Offset - RW - Single - Mandatory - String - - - - - - Delivery Frequency - RW - Single - Mandatory - Integer - - - - - - Randomised Delivery Window - RW - Single - Optional - Integer - - - - - - Number of Retries - RW - Single - Optional - Integer - - - - - - Retry Period - RW - Single - Optional - Integer - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10265.xml b/transport/lwm2m/src/main/data/models/10265.xml deleted file mode 100644 index bc7e8b32cb..0000000000 --- a/transport/lwm2m/src/main/data/models/10265.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Leakage Detection Configuration - - 10265 - urn:oma:lwm2m:x:10265 - Single - Optional - - - Sample Times - RW - Multiple - Mandatory - Integer - - - - - - Sample UTC Offset - RW - Single - Optional - String - - - - - - Detection Mode - RW - Single - Mandatory - Integer - 0..3 - - - - - Top Frequency Count - RW - Single - Optional - Integer - - - - - - Frequency Thresholds - RW - Multiple - Optional - Integer - 0..999 - - - - - Frequency Values - R - Multiple - Optional - Integer - - - - - - Firmware Version - R - Single - Mandatory - String - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10266.xml b/transport/lwm2m/src/main/data/models/10266.xml deleted file mode 100644 index 9d30d58ed8..0000000000 --- a/transport/lwm2m/src/main/data/models/10266.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Water Flow Readings - - 10266 - urn:oma:lwm2m:x:10266 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10267.xml b/transport/lwm2m/src/main/data/models/10267.xml deleted file mode 100644 index 17e251a1e4..0000000000 --- a/transport/lwm2m/src/main/data/models/10267.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Daily Maximum Flow Rate Readings - - 10267 - urn:oma:lwm2m:x:10267 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10268.xml b/transport/lwm2m/src/main/data/models/10268.xml deleted file mode 100644 index 2e8f405bc0..0000000000 --- a/transport/lwm2m/src/main/data/models/10268.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Temperature Readings - - 10268 - urn:oma:lwm2m:x:10268 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10269.xml b/transport/lwm2m/src/main/data/models/10269.xml deleted file mode 100644 index e72e27428e..0000000000 --- a/transport/lwm2m/src/main/data/models/10269.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Pressure Readings - - 10269 - urn:oma:lwm2m:x:10269 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10270.xml b/transport/lwm2m/src/main/data/models/10270.xml deleted file mode 100644 index 2a9470bad7..0000000000 --- a/transport/lwm2m/src/main/data/models/10270.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Battery Level Readings - - 10270 - urn:oma:lwm2m:x:10270 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10271.xml b/transport/lwm2m/src/main/data/models/10271.xml deleted file mode 100644 index 8a3f65f766..0000000000 --- a/transport/lwm2m/src/main/data/models/10271.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - - - Communications Activity Time Readings - - 10271 - urn:oma:lwm2m:x:10271 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10272.xml b/transport/lwm2m/src/main/data/models/10272.xml deleted file mode 100644 index b0971bf35c..0000000000 --- a/transport/lwm2m/src/main/data/models/10272.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Meter Customer Leakage Alarm - - 10272 - urn:oma:lwm2m:x:10272 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10273.xml b/transport/lwm2m/src/main/data/models/10273.xml deleted file mode 100644 index 49e0b80212..0000000000 --- a/transport/lwm2m/src/main/data/models/10273.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Meter Reverse Flow Alarm - - 10273 - urn:oma:lwm2m:x:10273 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10274.xml b/transport/lwm2m/src/main/data/models/10274.xml deleted file mode 100644 index 48f4bb9fbf..0000000000 --- a/transport/lwm2m/src/main/data/models/10274.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Meter Empty Pipe Alarm - - 10274 - urn:oma:lwm2m:x:10274 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10275.xml b/transport/lwm2m/src/main/data/models/10275.xml deleted file mode 100644 index a689b6ea41..0000000000 --- a/transport/lwm2m/src/main/data/models/10275.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Meter Tamper Alarm - - 10275 - urn:oma:lwm2m:x:10275 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10276.xml b/transport/lwm2m/src/main/data/models/10276.xml deleted file mode 100644 index e6f2980b43..0000000000 --- a/transport/lwm2m/src/main/data/models/10276.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Meter High Pressure Alarm - - 10276 - urn:oma:lwm2m:x:10276 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10277.xml b/transport/lwm2m/src/main/data/models/10277.xml deleted file mode 100644 index 53f64a3159..0000000000 --- a/transport/lwm2m/src/main/data/models/10277.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Meter Low Pressure Alarm - - 10277 - urn:oma:lwm2m:x:10277 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10278.xml b/transport/lwm2m/src/main/data/models/10278.xml deleted file mode 100644 index 17ac598967..0000000000 --- a/transport/lwm2m/src/main/data/models/10278.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - High Temperature Alarm - - 10278 - urn:oma:lwm2m:x:10278 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10279.xml b/transport/lwm2m/src/main/data/models/10279.xml deleted file mode 100644 index 1ddf9d6350..0000000000 --- a/transport/lwm2m/src/main/data/models/10279.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Low Temperature Alarm - - 10279 - urn:oma:lwm2m:x:10279 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10280.xml b/transport/lwm2m/src/main/data/models/10280.xml deleted file mode 100644 index d3f8f4a9a6..0000000000 --- a/transport/lwm2m/src/main/data/models/10280.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Water Network Leak Alarm - - 10280 - urn:oma:lwm2m:x:10280 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10281.xml b/transport/lwm2m/src/main/data/models/10281.xml deleted file mode 100644 index 449d9ba35d..0000000000 --- a/transport/lwm2m/src/main/data/models/10281.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Low Battery Alarm - - 10281 - urn:oma:lwm2m:x:10281 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10282.xml b/transport/lwm2m/src/main/data/models/10282.xml deleted file mode 100644 index b9d18ebeae..0000000000 --- a/transport/lwm2m/src/main/data/models/10282.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Daughter Board Failure Alarm - - 10282 - urn:oma:lwm2m:x:10282 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10283.xml b/transport/lwm2m/src/main/data/models/10283.xml deleted file mode 100644 index 1d5535c9ea..0000000000 --- a/transport/lwm2m/src/main/data/models/10283.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Device Reboot Event - - 10283 - urn:oma:lwm2m:x:10283 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10284.xml b/transport/lwm2m/src/main/data/models/10284.xml deleted file mode 100644 index 21985ff1b7..0000000000 --- a/transport/lwm2m/src/main/data/models/10284.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Time Synchronisation Event - - 10284 - urn:oma:lwm2m:x:10284 - Multiple - Optional - - - Event Type - RW - Single - Mandatory - Integer - - - - - - Alarm Realtime - RW - Single - Mandatory - Boolean - - - - - - Alarm State - R - Single - Optional - Boolean - - - - - - Alarm Set Threshold - RW - Single - Optional - Float - - - - - - Alarm Set Operator - RW - Single - Optional - Integer - - - - - - Alarm Clear Threshold - RW - Single - Optional - Float - - - - - - Alarm Clear Operator - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Count - RW - Single - Optional - Integer - - - - - - Alarm Maximum Event Period - RW - Single - Optional - Integer - 1..864000 - s - - - - Latest Delivered Event Time - RW - Single - Optional - Time - - - - - - Latest Recorded Event Time - R - Single - Mandatory - Time - - - - - - Alarm Clear - E - Single - Optional - - - - - - - Alarm Auto Clear - RW - Single - Optional - Boolean - - - - - - Event Code - R - Single - Mandatory - Integer - 100..255 - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10286.xml b/transport/lwm2m/src/main/data/models/10286.xml deleted file mode 100644 index 2b82acfd0e..0000000000 --- a/transport/lwm2m/src/main/data/models/10286.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - App Fota Container - - 10286 - urn:oma:lwm2m:x:10286 - 1.0 - 1.0 - Single - Optional - - - UL data - R - Single - Mandatory - Opaque - - - - - - - - DL data - W - Single - Mandatory - Opaque - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10290.xml b/transport/lwm2m/src/main/data/models/10290.xml deleted file mode 100644 index 2986c01370..0000000000 --- a/transport/lwm2m/src/main/data/models/10290.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Voltage Logging - - 10290 - urn:oma:lwm2m:x:10290 - 1.0 - 1.0 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10291.xml b/transport/lwm2m/src/main/data/models/10291.xml deleted file mode 100644 index 9f1e52c986..0000000000 --- a/transport/lwm2m/src/main/data/models/10291.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Voltage Transient - - 10291 - urn:oma:lwm2m:x:10291 - 1.0 - 1.0 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Mandatory - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Mandatory - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - Sample Frequency - RW - Single - Mandatory - Float - 0.0..86400.0 - s - How often the inputs are read/sampled.This value can be changed by doing a write command - - - - - diff --git a/transport/lwm2m/src/main/data/models/10292.xml b/transport/lwm2m/src/main/data/models/10292.xml deleted file mode 100644 index 66f1f0f718..0000000000 --- a/transport/lwm2m/src/main/data/models/10292.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Pressure Transient - - 10292 - urn:oma:lwm2m:x:10292 - 1.0 - 1.0 - Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Mandatory - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Mandatory - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - Sample Frequency - RW - Single - Mandatory - Float - 0.0..86400.0 - s - How often the inputs are read/sampled.This value can be changed by doing a write command - - - - - diff --git a/transport/lwm2m/src/main/data/models/10299.xml b/transport/lwm2m/src/main/data/models/10299.xml deleted file mode 100644 index b197dd867b..0000000000 --- a/transport/lwm2m/src/main/data/models/10299.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - HostDevice - This LWM2M Object provides a range of host device related information which can be queried by the LWM2M Server. The host device is any integrated device with an embedded cellular radio module. - 10299 - urn:oma:lwm2m:x:10299 - 1.0 - 1.0 - Single - Optional - - - Manufacturer - R - Single - Mandatory - String - - - Host device manufacturers name (OEM). - - - Model - R - Single - Mandatory - String - - Identifier of the model name or number determined by device manufacturer. - UniqueID - R - Single - Mandatory - String - - - Unique ID assigned by an manufacturer or other body. Used to uniquely identify a host device. Examples include serial # or UUID. - - - FirmwareVersion - R - Single - Mandatory - String - - - Current Firmware version of the host device. (manufacturer specified string). - - SoftwareVersion - R - Single - Optional - String - - - Current software version of the host device. (manufacturer specified string). - - HardwareVersion - R - Single - Optional - String - - - Current hardware version of the host device. (manufacturer specified string). - - - DateStamp - R - Single - Optional - String - - - UTC value of the time and date of the last Firmware or Software update. Format:MM:DD:YYYY HH:MM:SS - - - - - diff --git a/transport/lwm2m/src/main/data/models/10300.xml b/transport/lwm2m/src/main/data/models/10300.xml deleted file mode 100644 index 5dfa17144a..0000000000 --- a/transport/lwm2m/src/main/data/models/10300.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - LWM2M Meta Object - - - - 10300 - urn:oma:lwm2m:x:10300 - 1.0 - 1.0 - Multiple - Optional - - - ObjectID - R - Single - Mandatory - Integer - - - - - - - - ObjectURN - R - Single - Mandatory - String - - - - - - - - ObjectInstanceHandle - R - Single - Optional - Objlnk - - - - - - - - URI - R - Multiple - Mandatory - String - - - - - - - - SHAType - R - Single - Optional - Integer - 0..8 - - - - - - - ChecksumValue - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10308-2_0.xml b/transport/lwm2m/src/main/data/models/10308-2_0.xml deleted file mode 100644 index 802429e508..0000000000 --- a/transport/lwm2m/src/main/data/models/10308-2_0.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - AT&T Connectivity Extension - - 10308 - urn:oma:lwm2m:x:10308:2.0 - 1.0 - 2.0 - Multiple - Optional - - - ICCID - R - Single - Mandatory - String - - - - - - - IMSI - R - Single - Mandatory - String - - - - - - - MSISDN - RW - Single - Mandatory - String - - - - - - - APN Retries - RW - Single - Mandatory - Integer - - - - - - - APN Retry Period - RW - Single - Mandatory - Integer - - - s - - - - APN Retry Back-Off Period - RW - Single - Mandatory - Integer - - - s - - - - SINR - R - Single - Mandatory - Integer - <7 to >12.5 - - - - - SRXLEV - R - Single - Mandatory - Integer - - - - - - - CE_LEVEL - R - Single - Mandatory - Integer - 0,1,2 - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10309.xml b/transport/lwm2m/src/main/data/models/10309.xml deleted file mode 100644 index 6d5ece0364..0000000000 --- a/transport/lwm2m/src/main/data/models/10309.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - Shareparkinglot - - 10309 - urn:oma:lwm2m:x:10309 - 1.0 - 1.0 - Multiple - Optional - - - LockID - R - Single - Mandatory - Integer - - - - - - LockType - R - Single - Optional - String - - - - - - LightSwitchState - R - Multiple - Optional - Boolean - - - - - - RSSI - R - Multiple - Mandatory - Integer - -30..-120 - dBm - - - - BatteryCapacity - R - Multiple - Optional - Float - 0..100 - %EL - - - - DataUpTime - R - Multiple - Mandatory - Time - - - - - - Latitude - R - Multiple - Optional - String - - - - - - Longitude - R - Multiple - Optional - String - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10311.xml b/transport/lwm2m/src/main/data/models/10311.xml deleted file mode 100644 index ae66bde934..0000000000 --- a/transport/lwm2m/src/main/data/models/10311.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - Solar Radiation - - This object is used to report solar irradiance (SI), i.e. power per unit area received from the Sun in the form of electromagnetic radiation, on a planar surface measured by a pyranometer or similar instrument. A pyranometer measures solar irradiance from the hemisphere above within a wavelength range 0.3 μm to 3 μm. For example, the application of solar radiation measurement can be meteorological networks and solar energy applications. - - 10311 - urn:oma:lwm2m:x:10311 - 1.0 - 1.0 - Multiple - Optional - - - Min Measured Value - R - Single - Optional - Float - - - - The minimum value measured by the sensor since it is ON or Reset, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Max Measured Value - R - Single - Optional - Float - - - - The maximum value measured by the sensor since it is ON or Reset, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Min Range Value - R - Single - Optional - Float - - - - The minimum value that can be measured by the sensor, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Max Range Value - R - Single - Optional - Float - - - - The maximum value that can be measured by the sensor, expressed in the unit defined by the "Sensor Units" resource if present. - - - - Reset Min and Max Measured Values - E - Single - Optional - - - - - Reset the Min and Max Measured Values to current value. - - - - Timestamp - R - Single - Optional - Time - - - The timestamp of when the measurement was performed. - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor expressed in the unit defined by the "Sensor Units" resource if present. - - - Sensor Units - R - Single - Optional - String - - - - Measurement Units Definition. - - - - Application Type - RW - Single - Optional - String - - - - The application type of the sensor or actuator as a string, for instance "Air Pressure". - - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - - - diff --git a/transport/lwm2m/src/main/data/models/10313.xml b/transport/lwm2m/src/main/data/models/10313.xml deleted file mode 100644 index 17378a2ab1..0000000000 --- a/transport/lwm2m/src/main/data/models/10313.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - Gas Readings - - 10313 - urn:oma:lwm2m:x:103131.0 - 1.0Multiple - Optional - - - Interval Period - R - Single - Mandatory - Integer - 1..864000 - s - - - - Interval Start Offset - R - Single - Optional - Integer - 0..86399 - s - - - - Interval UTC Offset - R - Single - Optional - String - - - - - - Interval Collection Start Time - R - Single - Mandatory - Time - - - - - - Oldest Recorded Interval - R - Single - Mandatory - Time - - - - - - Last Delivered Interval - RW - Single - Optional - Time - - - - - - Latest Recorded Interval - R - Single - Mandatory - Time - - - - - - Interval Delivery Midnight Aligned - RW - Single - Mandatory - Boolean - - - - - - Interval Historical Read - E - Single - Optional - - - - - - - Interval Historical Read Payload - R - Single - Optional - Opaque - - - - - - Interval Change Configuration - E - Single - Optional - - - - - - - Start - E - Single - Optional - - - - - - - Stop - E - Single - Optional - - - - - - - Status - R - Single - Optional - Integer - - - - - - Latest Payload - R - Single - Mandatory - Opaque - - - - - - Sensor Warm-up Time - RW - Single - Optional - Integer - 0..86400 - s - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10314.xml b/transport/lwm2m/src/main/data/models/10314.xml deleted file mode 100644 index 2c64f9198e..0000000000 --- a/transport/lwm2m/src/main/data/models/10314.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Particulates - - 10314 - urn:oma:lwm2m:x:10314 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - - - - Min Measured Value - R - Single - Optional - Float - - - - - - Max Measured Value - R - Single - Optional - Float - - - - - - Max Range Value - R - Single - Optional - Float - - - - - - Sensor Units - R - Single - Optional - String - - - - - - Application Type - RW - Single - Optional - String - - - The Application type of the device, for example “Particulate Sensor”. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - - - - Measured Particle Size - R - Single - Mandatory - Float - - m - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10315.xml b/transport/lwm2m/src/main/data/models/10315.xml deleted file mode 100644 index 771fe508aa..0000000000 --- a/transport/lwm2m/src/main/data/models/10315.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - Robot - - 10315 - urn:oma:lwm2m:x:10315 - 1.0 - 1.0 - Single - Mandatory - - - Robot ID - R - Single - Mandatory - String - 0..255 - - - - - Robot Type - R - Single - Mandatory - String - 0..63 - - - - - Robot Serial Number - R - Single - Mandatory - String - 0..63 - - - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - % - - - - Charging - R - Single - Mandatory - Boolean - - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - Positioning - R - Single - Optional - Boolean - - - - - - Location - R - Single - Optional - Objlnk - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10316.xml b/transport/lwm2m/src/main/data/models/10316.xml deleted file mode 100644 index 210e421449..0000000000 --- a/transport/lwm2m/src/main/data/models/10316.xml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - RCU - - 10316 - urn:oma:lwm2m:x:10316 - 1.0 - 1.0 - Single - Mandatory - - - RCU ID - R - Single - Mandatory - String - 0..127 - - - - - RCU Serial Number - R - Single - Mandatory - String - 0..63 - - - - - RCU Software Version - R - Single - Mandatory - String - 0..63 - - - - - RCU OS Version - R - Single - Mandatory - String - 0..127 - - - - - RCU CPU Info - R - Single - Mandatory - String - 64 - - - - - RCU RAM Info - R - Single - Mandatory - String - 64 - - - - - RCU ROM Size - R - Single - Mandatory - Integer - - GB - - - - RCU ROM Available Size - R - Single - Mandatory - Integer - - GB - - - - SD Storage - R - Single - Mandatory - Integer - - GB - - - - SD Available Storage - R - Single - Mandatory - Integer - - GB - - - - RCU GPS Location - R - Single - Optional - Objlnk - - - - - - Wi-Fi MAC - R - Single - Optional - String - 12 - - - - - Bluetooth MAC - R - Single - Optional - String - 12 - - - - - Camera Info - R - Single - Optional - String - 64 - - - - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - /100 - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - - Downloaded APP Packages - R - Multiple - Mandatory - String - - - - - - - RCU APPs - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10318.xml b/transport/lwm2m/src/main/data/models/10318.xml deleted file mode 100644 index 845194f859..0000000000 --- a/transport/lwm2m/src/main/data/models/10318.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - - RCU PM - - 10318 - urn:oma:lwm2m:x:10318 - 1.0 - 1.0 - Single - Mandatory - - - CPU Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Max CPU Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Memory Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Storage Usage - R - Single - Mandatory - Integer - 0..100 - /100 - - - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Network Bandwidth - R - Single - Mandatory - Float - - Mbit/s - - - - Mobile Signal - R - Single - Mandatory - Integer - - - - - - GPS Signal - R - Single - Optional - Integer - - - - - - Wi-Fi Signal - R - Single - Mandatory - Integer - - - - - - UpLink Rate - R - Single - Mandatory - Float - - Mbit/s - - - - DownLink Rate - R - Single - Mandatory - Float - - Mbit/s - - - - Packet Loss Rate - R - Single - Mandatory - Integer - 0..100 - /100 - - - - Network Latency - R - Single - Mandatory - Integer - - ms - - - - - Battery Temperature - R - Single - Mandatory - Float - - Cel - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10319.xml b/transport/lwm2m/src/main/data/models/10319.xml deleted file mode 100644 index 448ba628b3..0000000000 --- a/transport/lwm2m/src/main/data/models/10319.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - RCU Control - - 10319 - urn:oma:lwm2m:x:10319 - 1.0 - 1.0 - Single - Mandatory - - - RCU Diagnostics Mode - R - Single - Optional - Boolean - - - - - - RCU Log Recording - R - Single - Optional - Boolean - - - - - - - RCU Shutdown - E - Single - Mandatory - - - - - - - RCU Restart - E - Single - Mandatory - - - - - - - RCU Deactivate - E - Single - Mandatory - - - - - - - RCU Reset - E - Single - Mandatory - - - - - - - RCU Diagnostics Mode Control - E - Single - Mandatory - - - - - - - RCU Log Recording Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10320.xml b/transport/lwm2m/src/main/data/models/10320.xml deleted file mode 100644 index 4f6dd55410..0000000000 --- a/transport/lwm2m/src/main/data/models/10320.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - CCU - - 10320 - urn:oma:lwm2m:x:10320 - 1.0 - 1.0 - Multiple - Optional - - - CCU ID - R - Single - Mandatory - String - - - - - - CCU FM Version - R - Single - Mandatory - String - - - - - - CCU SW Version - R - Single - Mandatory - String - - - - - - CCU Memory Size - R - Single - Mandatory - Integer - - GB - - - - CCU Storage - R - Single - Mandatory - Integer - - GB - - - - CCU Available Storage - R - Single - Mandatory - Integer - - GB - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - - Downloaded APP Packages - R - Multiple - Optional - String - - - - - - CCU APPs - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10322.xml b/transport/lwm2m/src/main/data/models/10322.xml deleted file mode 100644 index a09eb22f0e..0000000000 --- a/transport/lwm2m/src/main/data/models/10322.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - CCU PM - - 10322 - urn:oma:lwm2m:x:10322 - 1.0 - 1.0 - Multiple - Optional - - - CPU Usage - R - Single - Optional - Integer - 0..100 - % - - - - Max CPU Usage - R - Single - Optional - Integer - 0..100 - % - - - - Memory Usage - R - Single - Optional - Integer - 0..100 - % - - - - Storage Usage - R - Single - Optional - Integer - 0..100 - % - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10323.xml b/transport/lwm2m/src/main/data/models/10323.xml deleted file mode 100644 index 68fe77dea2..0000000000 --- a/transport/lwm2m/src/main/data/models/10323.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - CCU Control - - 10323 - urn:oma:lwm2m:x:10323 - 1.0 - 1.0 - Multiple - Optional - - - - CCU Restart - E - Single - Mandatory - - - - - - - CCU Reset - E - Single - Mandatory - - - - - - - CCU Self-checking - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10324.xml b/transport/lwm2m/src/main/data/models/10324.xml deleted file mode 100644 index 73e2d1e12a..0000000000 --- a/transport/lwm2m/src/main/data/models/10324.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - ECU - - 10324 - urn:oma:lwm2m:x:10324 - 1.0 - 1.0 - Multiple - Optional - - - ECU ID - R - Single - Mandatory - String - - - - - - ECU FM Version - R - Single - Mandatory - String - - - - - - On time - RW - Single - Mandatory - Integer - - s - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10326.xml b/transport/lwm2m/src/main/data/models/10326.xml deleted file mode 100644 index 4a521e6b90..0000000000 --- a/transport/lwm2m/src/main/data/models/10326.xml +++ /dev/null @@ -1,708 +0,0 @@ - - - - - Robot PM - - 10326 - urn:oma:lwm2m:x:10326 - 1.0 - 1.0 - Single - Mandatory - - - Battery Level - R - Single - Mandatory - Integer - 0..100 - /100 - - - - - Battery Temperature - R - Single - Mandatory - Integer - - Cel - - - - Temperature - R - Single - Optional - Float - - Cel - - - - Humidity - R - Single - Optional - Integer - 0..100 - /100 - - - - PM2.5 - R - Single - Optional - Integer - - ug/m3 - - - - Smog - R - Single - Optional - Float - - ug/m3 - - - - CO - R - Single - Optional - Float - - ppm - - - - CO2 - R - Single - Optional - Float - - ppm - - - - PM10 - R - Single - Optional - Integer - - ug/m3 - - - - Speed - R - Single - Optional - Float - - m/h - - - - Water Used - R - Single - Optional - Integer - 0..100 - /100 - - - - Dust Box Used - R - Single - Optional - Integer - 0..100 - /100 - - - - Obstacle Distance - R - Single - Optional - Integer - - cm - - - - - Robot Temperate - R - Single - Optional - Float - - Cel - - - - Confidence Index - R - Single - Optional - Integer - 0..100 - /100 - - - - - Data Traffic Used - R - Single - Mandatory - Float - - Mbit/s - - - - Images Handled - R - Single - Optional - Integer - - - - - - HARI S-Voice Requests - R - Single - Optional - Integer - - - - - - HARI S-Vision Requests - R - Single - Optional - Integer - - - - - - HARI S-Motion Requests - R - Single - Optional - Integer - - - - - - HARI S-Map Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Voice Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Vision Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Motion Requests - R - Single - Optional - Integer - - - - - - Successful HARI S-Map Requests - R - Single - Optional - Integer - - - - - - Questions Answered - R - Single - Optional - Integer - - - - - - Unknown Questions - R - Single - Optional - Integer - - - - - - Mileage - R - Single - Optional - Integer - - m - - - - Cleaned Times - R - Single - Optional - Integer - - - - - - Cleaned Area - R - Single - Optional - Float - - m2 - - - - Cleaned Time - R - Single - Optional - Integer - - s - - - - ASR Recognized - R - Single - Optional - Integer - - B - - - - Incorrect ASR Recognitions - R - Single - Optional - Integer - - B - - - - Tried TTS Texts - R - Single - Optional - Integer - - B - - - - Successful TTS Texts - R - Single - Optional - Integer - - B - - - - ASR Recognized (CH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (CH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (CH) - R - Single - Optional - Integer - - B - - - - ASR Recognized (EN) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (EN) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (EN) - R - Single - Optional - Integer - - B - - - - ASR Recognized (ES) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (ES) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (ES) - R - Single - Optional - Integer - - B - - - - ASR Recognized (JA) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (JA) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (JA) - R - Single - Optional - Integer - - B - - - - ASR Recognized (SCCH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (SCCH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (SCCH) - R - Single - Optional - Integer - - B - - - - ASR Recognized (GDCH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (GDCH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (GDCH) - R - Single - Optional - Integer - - B - - - - ASR Recognized (TCH) - R - Single - Optional - Integer - - B - - - - Tried TTS Texts (TCH) - R - Single - Optional - Integer - - B - - - - Successful TTS Texts (TCH) - R - Single - Optional - Integer - - B - - - - - Objects Recognition Tries - R - Single - Optional - Integer - - - - - - Successful Object Recognition - R - Single - Optional - Integer - - - - - - Face Recognition Tries - R - Single - Optional - Integer - - - - - - Successful Face Recognitions - R - Single - Optional - Integer - - - - - - Vehicle Plate Recognition Tries - R - Single - Optional - Integer - - - - - - Successful Vehicle Plate Recognitions - R - Single - Optional - Integer - - - - - - Tasks Assigned - R - Single - Mandatory - Integer - - - - - - Successful Tasks Executed - R - Single - Mandatory - Integer - - - - - - Images Uploaded - R - Single - Optional - Integer - - - - - - Videos Uploaded - R - Single - Optional - Integer - - - - - - Images Matted - R - Single - Optional - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10327.xml b/transport/lwm2m/src/main/data/models/10327.xml deleted file mode 100644 index 1dd8d6dc87..0000000000 --- a/transport/lwm2m/src/main/data/models/10327.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Compressor - - 10327 - urn:oma:lwm2m:x:10327 - 1.0 - 1.0 - Multiple - Optional - - - Compressor Name - R - Single - Mandatory - String - - - - - - - Compressor Status - R - Single - Mandatory - Boolean - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10328.xml b/transport/lwm2m/src/main/data/models/10328.xml deleted file mode 100644 index 314e9c78ed..0000000000 --- a/transport/lwm2m/src/main/data/models/10328.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - SCA PM - - 10328 - urn:oma:lwm2m:x:10328 - 1.0 - 1.0 - Multiple - Optional - - - SCA Name - R - Single - Mandatory - String - - - - - - - - - SCA Current - R - Single - Mandatory - Float - - A - - - - SCA Temperate - R - Single - Mandatory - Float - - Cel - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10329.xml b/transport/lwm2m/src/main/data/models/10329.xml deleted file mode 100644 index dce68e80b9..0000000000 --- a/transport/lwm2m/src/main/data/models/10329.xml +++ /dev/null @@ -1,419 +0,0 @@ - - - - - Robot Control - - 10329 - urn:oma:lwm2m:x:10329 - 1.0 - 1.0 - Single - Mandatory - - - Collision Detection - R - Single - Optional - Boolean - - - - - - Drop Detection - R - Single - Optional - Boolean - - - - - - Automatic Navigation - R - Single - Optional - Boolean - - - - - - Robot Shutdown - E - Single - Mandatory - - - - - - - Robot Reboot - E - Single - Mandatory - - - - - - - Robot Reset - E - Single - Mandatory - - - - - - - Robot Wakeup - E - Single - Mandatory - - - - - - - Robot Sleep - E - Single - Mandatory - - - - - - - Robot Self-checking - E - Single - Mandatory - - - - - - - Emergency Braking - E - Single - Mandatory - - - - - - - Emergency Braking Release - E - Single - Mandatory - - - - - - - Action Execution - E - Single - Optional - - - - - - - Action List Upload - E - Single - Optional - - - - - - - Action List Download - E - Single - Optional - - - - - - - Group Dancing Program Control - E - Single - Optional - - - - - - - Navigation Map Upload - E - Single - Optional - - - - - - - Group Dancing Program Control - E - Single - Optional - - - - - - - Navigation Map Download - E - Single - Optional - - - - - - - Route list Execution - E - Single - Optional - - - - - - - Route list Upload - E - Single - Optional - - - - - - - Route list Download - E - Single - Optional - - - - - - - Automatic Navigation Control - E - Single - Optional - - - - - - - Manual Navigation - E - Single - Optional - - - - - - - Moving to Charging Station - E - Single - Optional - - - - - - - Moving to Specified location - E - Single - Optional - - - - - - - Low Frequency Patrol Broadcasting - E - Single - Optional - - - - - - - Task Start - E - Single - Optional - - - - - - - Task Stop - E - Single - Optional - - - - - - - Task Suspend - E - Single - Optional - - - - - - - Task Resume - E - Single - Optional - - - - - - - Video Upload - E - Single - Optional - - - - - - - Picture Upload - E - Single - Optional - - - - - - - Default Language Switching - E - Single - Optional - - - - - - - Intonation Change - E - Single - Optional - - - - - - - Intonation Change - E - Single - Optional - - - - - - - Speaking with Action - E - Single - Optional - - - - - - - Collision Detection Control - E - Single - Mandatory - - - - - - - Drop Detection Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10330.xml b/transport/lwm2m/src/main/data/models/10330.xml deleted file mode 100644 index bbbe3c88f8..0000000000 --- a/transport/lwm2m/src/main/data/models/10330.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - Network Info - - 10330 - urn:oma:lwm2m:x:10330 - 1.0 - 1.0 - Single - Mandatory - - - IMEI - R - Single - Mandatory - String - 15 - - - - - IMSI - R - Single - Mandatory - String - 15 - - - - - Radio Connectivity - R - Single - Mandatory - Objlnk - - - - - - - - GPS Signal Status - R - Single - Optional - Integer - 1..4 - - - - - VBN Connection Status - R - Single - Mandatory - Integer - 0..1 - - - - - HARI Connection Status - R - Single - Mandatory - Integer - 0..1 - - - - - CCU Connection Status - R - Multiple - Optional - Integer - 0..1 - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10331.xml b/transport/lwm2m/src/main/data/models/10331.xml deleted file mode 100644 index 86a64b6c57..0000000000 --- a/transport/lwm2m/src/main/data/models/10331.xml +++ /dev/null @@ -1,207 +0,0 @@ - - - - - Robot Service Info - - 10331 - urn:oma:lwm2m:x:10331 - 1.0 - 1.0 - Single - Mandatory - - - Current status - R - Single - Mandatory - String - 0..127 - - - - - Services Providing - R - Single - Optional - String - 0..127 - - - - - Advertising Contents - R - Single - Mandatory - String - - - - - - Current Language - R - Single - Optional - String - 0..127 - - - - - Volume - R - Single - Optional - String - 0..100 - /100 - - - - Moving Status - R - Single - Optional - Integer - 0..2 - - - - - Moving Speed - R - Single - Optional - Float - - m/h - - - - Location - R - Single - Optional - Objlnk - - - - - - - - Map List - R - Single - Optional - String - - - - - - Planned Route list - R - Single - Optional - String - - - - - - Current Route - R - Single - Optional - String - - - - - - Route to-do List - R - Single - Optional - String - - - - - - Synchronous Whistle - R - Single - Mandatory - Boolean - - - - - - Current Actions - R - Single - Optional - String - - - - - - ASR Type - R - Single - Optional - Integer - 0..2 - - - - - - TTS Vendor - R - Single - Optional - String - - - - - - TTS Speaker - R - Single - Optional - String - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10332.xml b/transport/lwm2m/src/main/data/models/10332.xml deleted file mode 100644 index 7d6f5b96bd..0000000000 --- a/transport/lwm2m/src/main/data/models/10332.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - Robot Selfcheck Info - - 10332 - urn:oma:lwm2m:x:10332 - 1.0 - 1.0 - Multiple - Optional - - - Entity - R - Single - Mandatory - String - 4..63 - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10333.xml b/transport/lwm2m/src/main/data/models/10333.xml deleted file mode 100644 index cfc196772d..0000000000 --- a/transport/lwm2m/src/main/data/models/10333.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - PM Threshold - - 10333 - urn:oma:lwm2m:x:10333 - 1.0 - 1.0 - Single - Optional - - - Entity - RW - Multiple - Mandatory - String - 4..63 - - - - - Performance Type - RW - Multiple - Mandatory - String - - - - - - High Threshold - RW - Multiple - Mandatory - Float - - - - - - Low Threshold - RW - Multiple - Mandatory - Float - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10334.xml b/transport/lwm2m/src/main/data/models/10334.xml deleted file mode 100644 index 4a2ee25614..0000000000 --- a/transport/lwm2m/src/main/data/models/10334.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - Robot Alarm - - 10334 - urn:oma:lwm2m:x:10334 - 1.0 - 1.0 - Multiple - Optional - - - Entity - R - Single - Mandatory - String - 4..63 - - - - - Probable Cause - R - Single - Mandatory - Integer - 0..65535 - - - - - Specific Problem - R - Single - Mandatory - String - - - - - - Alarm Type - R - Single - Mandatory - Integer - 2..6 - - - - - Severity - R - Single - Mandatory - Integer - 1..5 - - - - - Report Time - R - Single - Mandatory - Time - - - - - - Sequence No - R - Single - Mandatory - Integer - 0..2^63-1 - - - - - Additional Info - R - Single - Optional - String - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10335.xml b/transport/lwm2m/src/main/data/models/10335.xml deleted file mode 100644 index d7b1d9a027..0000000000 --- a/transport/lwm2m/src/main/data/models/10335.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Event - - 10335 - urn:oma:lwm2m:x:10335 - 1.0 - 1.0 - Multiple - Optional - - - Entity - R - Single - Mandatory - String - 4..63 - - - - - Event Type - R - Single - Mandatory - Integer - 0..65535 - - - - - Time - R - Single - Mandatory - Time - - - - - - Sequence No - R - Single - Mandatory - Integer - 0..2^63-1 - - - - - Additional Info - R - Single - Optional - String - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10336.xml b/transport/lwm2m/src/main/data/models/10336.xml deleted file mode 100644 index e14d64d5aa..0000000000 --- a/transport/lwm2m/src/main/data/models/10336.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - MIC - - 10336 - urn:oma:lwm2m:x:10336 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10337.xml b/transport/lwm2m/src/main/data/models/10337.xml deleted file mode 100644 index 2720bf7cb9..0000000000 --- a/transport/lwm2m/src/main/data/models/10337.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - SCA - - 10337 - urn:oma:lwm2m:x:10337 - 1.0 - 1.0 - Multiple - Optional - - - SCA Name - R - Single - Mandatory - String - - - - - - - - - - SCA Motion Status - R - Single - Optional - Integer - 0..2 - - - - - - SCA Motion Control - E - Single - Optional - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10338.xml b/transport/lwm2m/src/main/data/models/10338.xml deleted file mode 100644 index d3a0584d60..0000000000 --- a/transport/lwm2m/src/main/data/models/10338.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - Speaker - - 10338 - urn:oma:lwm2m:x:10338 - 1.0 - 1.0 - Single - Optional - - - Speaker status - R - Single - Mandatory - Boolean - - - - - - Voice Warning - R - Single - Mandatory - Boolean - - - - - - - Voice Control - E - Single - Mandatory - - - - - - - Voice Warning Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10339.xml b/transport/lwm2m/src/main/data/models/10339.xml deleted file mode 100644 index 1101f1f66a..0000000000 --- a/transport/lwm2m/src/main/data/models/10339.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Tripod Head - - 10339 - urn:oma:lwm2m:x:10339 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - Tripod Direction Control - E - Single - Optional - - - - - - - Tripod Automatic Control - E - Single - Optional - - - - - - - Tripod Reset - E - Single - Optional - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10340.xml b/transport/lwm2m/src/main/data/models/10340.xml deleted file mode 100644 index 5a6105426e..0000000000 --- a/transport/lwm2m/src/main/data/models/10340.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - Camera - - 10340 - urn:oma:lwm2m:x:10340 - 1.0 - 1.0 - Multiple - Optional - - - Camera Name - R - Single - Mandatory - String - - - - - - - - Camera Status - R - Single - Mandatory - Boolean - - - - - - Connection Status - R - Single - Mandatory - Boolean - - - - - - Working Status - R - Single - Mandatory - Integer - 0..15 - - - - - Local Recording - R - Single - Mandatory - Boolean - - - - - - Image Matting - R - Single - Mandatory - Boolean - - - - - - Camera Snapshot - R - Single - Mandatory - Boolean - - - - - - Camera Recording - R - Single - Mandatory - Boolean - - - - - - - Camera Control - E - Single - Mandatory - - - - - - - Local Recording Control - E - Single - Mandatory - - - - - - - Image Matting Control - E - Single - Mandatory - - - - - - - Camera Snapshot Control - E - Single - Mandatory - - - - - - - Camera Recording Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10341.xml b/transport/lwm2m/src/main/data/models/10341.xml deleted file mode 100644 index a66d9bdc22..0000000000 --- a/transport/lwm2m/src/main/data/models/10341.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - GPS - - 10341 - urn:oma:lwm2m:x:10341 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10342.xml b/transport/lwm2m/src/main/data/models/10342.xml deleted file mode 100644 index 613aa78822..0000000000 --- a/transport/lwm2m/src/main/data/models/10342.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - IMU - - 10342 - urn:oma:lwm2m:x:10342 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10343.xml b/transport/lwm2m/src/main/data/models/10343.xml deleted file mode 100644 index eca0b2f83e..0000000000 --- a/transport/lwm2m/src/main/data/models/10343.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - LiDAR - - 10343 - urn:oma:lwm2m:x:10343 - 1.0 - 1.0 - Multiple - Optional - - - LiDAR Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10344.xml b/transport/lwm2m/src/main/data/models/10344.xml deleted file mode 100644 index ae57e9c433..0000000000 --- a/transport/lwm2m/src/main/data/models/10344.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Arm - - 10344 - urn:oma:lwm2m:x:10344 - 1.0 - 1.0 - Multiple - Optional - - - Arm Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10345.xml b/transport/lwm2m/src/main/data/models/10345.xml deleted file mode 100644 index 0cdbcce721..0000000000 --- a/transport/lwm2m/src/main/data/models/10345.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Leg - - 10345 - urn:oma:lwm2m:x:10345 - 1.0 - 1.0 - Multiple - Optional - - - Leg Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10346.xml b/transport/lwm2m/src/main/data/models/10346.xml deleted file mode 100644 index b07ca48697..0000000000 --- a/transport/lwm2m/src/main/data/models/10346.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Servomotor - - 10346 - urn:oma:lwm2m:x:10346 - 1.0 - 1.0 - Multiple - Optional - - - Servomotor Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10347.xml b/transport/lwm2m/src/main/data/models/10347.xml deleted file mode 100644 index d65e98e26e..0000000000 --- a/transport/lwm2m/src/main/data/models/10347.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Screen - - 10347 - urn:oma:lwm2m:x:10347 - 1.0 - 1.0 - Single - Optional - - - Screen Status - R - Single - Mandatory - Boolean - - - - - - Startup Page - R - Single - Optional - String - - - The Startup Page of the screen. - - - Current Displaying Page or Current Screen Play List - R - Single - Optional - String - - - Current Displaying Page or Current Screen Play List. - - - - Screen Control - E - Single - Mandatory - - - - - - - Startup Page Set - E - Single - Mandatory - - - - - - - Screen Page Set - E - Single - Mandatory - - - - - - - Screen Play List Set - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10348.xml b/transport/lwm2m/src/main/data/models/10348.xml deleted file mode 100644 index 7791092f62..0000000000 --- a/transport/lwm2m/src/main/data/models/10348.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - Wheel - - 10348 - urn:oma:lwm2m:x:10348 - 1.0 - 1.0 - Multiple - Optional - - - Wheel Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10349.xml b/transport/lwm2m/src/main/data/models/10349.xml deleted file mode 100644 index a04702814e..0000000000 --- a/transport/lwm2m/src/main/data/models/10349.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Chassis - - 10349 - urn:oma:lwm2m:x:10349 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10350.xml b/transport/lwm2m/src/main/data/models/10350.xml deleted file mode 100644 index 9ae091575d..0000000000 --- a/transport/lwm2m/src/main/data/models/10350.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - Light - - 10350 - urn:oma:lwm2m:x:10350 - 1.0 - 1.0 - Multiple - Optional - - - Light Name - R - Single - Mandatory - String - - - - - - - - Light Status - R - Single - Mandatory - Boolean - - - - - - - Light Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10351.xml b/transport/lwm2m/src/main/data/models/10351.xml deleted file mode 100644 index 09b124236e..0000000000 --- a/transport/lwm2m/src/main/data/models/10351.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - Door - - 10351 - urn:oma:lwm2m:x:10351 - 1.0 - 1.0 - Multiple - Optional - - - Door Name - R - Single - Mandatory - String - - - - - - - Door Status - R - Single - Mandatory - Boolean - - - - - - - Door Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10352.xml b/transport/lwm2m/src/main/data/models/10352.xml deleted file mode 100644 index 3c497de411..0000000000 --- a/transport/lwm2m/src/main/data/models/10352.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Thermal Imager - - 10352 - urn:oma:lwm2m:x:10352 - 1.0 - 1.0 - Single - Optional - - - - Highest Temperature - R - Single - Mandatory - Float - -100.0..100.0 - Cel - The Highest Temperature of the thermal imager. - - - Lowest Temperature - R - Single - Mandatory - Float - -100.0..100.0 - Cel - The Lowest Temperature of the thermal imager. - - - Average Temperature - R - Single - Mandatory - Float - -100.0..100.0 - Cel - The Average Temperature of the thermal imager. - - - - - diff --git a/transport/lwm2m/src/main/data/models/10353.xml b/transport/lwm2m/src/main/data/models/10353.xml deleted file mode 100644 index 4d40e2c1b7..0000000000 --- a/transport/lwm2m/src/main/data/models/10353.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Warning Light - - 10353 - urn:oma:lwm2m:x:10353 - 1.0 - 1.0 - Single - Optional - - - Light Status - R - Single - Mandatory - Boolean - - - - - - Light Warning - R - Single - Mandatory - Boolean - - - - - - Light Control - E - Single - Mandatory - - - - - - - Light Warning Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10354.xml b/transport/lwm2m/src/main/data/models/10354.xml deleted file mode 100644 index b1b5ab8be1..0000000000 --- a/transport/lwm2m/src/main/data/models/10354.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - APP - - 10354 - urn:oma:lwm2m:x:10354 - 1.0 - 1.0 - Multiple - Mandatory - - - APP Name - RW - Single - Mandatory - String - - - The name of the APP, human readable string. - - - APP Version - RW - Single - Mandatory - String - - - The version of the APP, human readable string. - - - APP Build No - RW - Single - Optional - String - - - The Build No of the APP, human readable string. - - - APP Patch No - RW - Single - Optional - String - - - The Patch No of the APP, human readable string. - - - Package URI - W - Single - Optional - String - 0-255 bytes - - - - - Vendor Name - RW - Single - Optional - String - - - The vendor of the package. - - - Installation Target - RW - Single - Mandatory - Objlnk - - - - - - APP Status - R - Single - Mandatory - Integer - 0..5 - - The Status of the APP, 0:Downloading, 1:Downloaded, 2:Installed, 3:Verified, 4:Activated, 5:Stopped. - - - APP Restart - E - Single - Mandatory - - - - - - - APP Start - E - Single - Mandatory - - - - - - - APP Stop - E - Single - Mandatory - - - - - - - APP Download - E - Single - Mandatory - - - - - - - APP Install - E - Single - Mandatory - - - - - - - APP Uninstall - E - Single - Mandatory - - - - - - - APP Activate - E - Single - Mandatory - - - - - - - APP Deactivate - E - Single - Mandatory - - - - - - - APP Verify - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10355.xml b/transport/lwm2m/src/main/data/models/10355.xml deleted file mode 100644 index f05f470843..0000000000 --- a/transport/lwm2m/src/main/data/models/10355.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - General Info - - 10355 - urn:oma:lwm2m:x:10355 - 1.0 - 1.0 - Single - Optional - - - Robot General Info - R - Single - Mandatory - Objlnk - - - - - - - - RCU General Info - R - Single - Mandatory - Objlnk - - - - - - - - CCU General Info - R - Multiple - Optional - Objlnk - - - - - - - - ECU General Info - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10356.xml b/transport/lwm2m/src/main/data/models/10356.xml deleted file mode 100644 index 082ba8131f..0000000000 --- a/transport/lwm2m/src/main/data/models/10356.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - Service Info - - 10356 - urn:oma:lwm2m:x:10356 - 1.0 - 1.0 - Single - Optional - - - Robot Service Info - R - Single - Mandatory - Objlnk - - - - - - - - SCA Info - R - Multiple - Optional - Objlnk - - - - - - - - Speaker Info - R - Single - Optional - Objlnk - - - - - - - - Camera Info - R - Multiple - Optional - Objlnk - - - - - - - - Screen Info - R - Single - Optional - Objlnk - - - - - - - - Light Info - R - Multiple - Optional - Objlnk - - - - - - - - Warning Light Info - R - Single - Optional - Objlnk - - - - - - - - Door Info - R - Multiple - Optional - Objlnk - - - - - - - - Thermal Imager Info - R - Single - Optional - Objlnk - - - - - - - - Compressor Info - R - Multiple - Optional - Objlnk - - - - - - - - Lock Info - R - Multiple - Optional - Objlnk - - - - - - - - Collision Sensor Info - R - Multiple - Optional - Objlnk - - - - - - - - Drop Sensor Info - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10357.xml b/transport/lwm2m/src/main/data/models/10357.xml deleted file mode 100644 index ea0b0334c1..0000000000 --- a/transport/lwm2m/src/main/data/models/10357.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - PM - - 10357 - urn:oma:lwm2m:x:10357 - 1.0 - 1.0 - Single - Optional - - - Robot PM - R - Single - Mandatory - Objlnk - - - - - - - - RCU PM - R - Single - Mandatory - Objlnk - - - - - - - - CCU PM - R - Multiple - Optional - Objlnk - - - - - - - - SCA PM - R - Multiple - Optional - Objlnk - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10358.xml b/transport/lwm2m/src/main/data/models/10358.xml deleted file mode 100644 index dea3fc72f4..0000000000 --- a/transport/lwm2m/src/main/data/models/10358.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Fan PM - - 10358 - urn:oma:lwm2m:x:10358 - 1.0 - 1.0 - Multiple - Optional - - - Fan Name - R - Single - Mandatory - String - - - - - - - - - Fan Speed - R - Single - Optional - Integer - - 1/min - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10359.xml b/transport/lwm2m/src/main/data/models/10359.xml deleted file mode 100644 index 07e8439600..0000000000 --- a/transport/lwm2m/src/main/data/models/10359.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Lock - - 10359 - urn:oma:lwm2m:x:10359 - 1.0 - 1.0 - Multiple - Optional - - - Lock Name - R - Single - Mandatory - String - - - - - - Lock Status - R - Single - Optional - Boolean - - - - - - - Lock Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10360.xml b/transport/lwm2m/src/main/data/models/10360.xml deleted file mode 100644 index 71b6591557..0000000000 --- a/transport/lwm2m/src/main/data/models/10360.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Ultrasonic Sensor - - 10360 - urn:oma:lwm2m:x:10360 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10361.xml b/transport/lwm2m/src/main/data/models/10361.xml deleted file mode 100644 index c2983e8286..0000000000 --- a/transport/lwm2m/src/main/data/models/10361.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Collision Sensor - - 10361 - urn:oma:lwm2m:x:10361 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - - Collision Detection - R - Single - Optional - Boolean - - - - - - - Collision Detection Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10362.xml b/transport/lwm2m/src/main/data/models/10362.xml deleted file mode 100644 index cdbb99ed75..0000000000 --- a/transport/lwm2m/src/main/data/models/10362.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Drop Sensor - - 10362 - urn:oma:lwm2m:x:10362 - 1.0 - 1.0 - Multiple - Optional - - - Name - R - Single - Mandatory - String - - - - - - - - Status - R - Single - Mandatory - Integer - - - - - - Drop Detection - R - Single - Optional - Boolean - - - - - - - Drop Detection Control - E - Single - Mandatory - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10363.xml b/transport/lwm2m/src/main/data/models/10363.xml deleted file mode 100644 index d3daaca10b..0000000000 --- a/transport/lwm2m/src/main/data/models/10363.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Temperature Sensor - - 10363 - urn:oma:lwm2m:x:10363 - 1.0 - 1.0 - Single - Optional - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10364.xml b/transport/lwm2m/src/main/data/models/10364.xml deleted file mode 100644 index 4cd7fd0aa3..0000000000 --- a/transport/lwm2m/src/main/data/models/10364.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Humidity Sensor - - 10364 - urn:oma:lwm2m:x:10364 - 1.0 - 1.0 - Single - Optional - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10365.xml b/transport/lwm2m/src/main/data/models/10365.xml deleted file mode 100644 index 5a97d94374..0000000000 --- a/transport/lwm2m/src/main/data/models/10365.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Gas-Dust Sensor - - 10365 - urn:oma:lwm2m:x:10365 - 1.0 - 1.0 - Single - Optional - - - Status - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10366.xml b/transport/lwm2m/src/main/data/models/10366.xml deleted file mode 100644 index 352bfcbc5e..0000000000 --- a/transport/lwm2m/src/main/data/models/10366.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Fan - - 10366 - urn:oma:lwm2m:x:10366 - 1.0 - 1.0 - Multiple - Optional - - - Fan Name - R - Single - Mandatory - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10368.xml b/transport/lwm2m/src/main/data/models/10368.xml deleted file mode 100644 index 52838f0209..0000000000 --- a/transport/lwm2m/src/main/data/models/10368.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - SpringMotor - - 10368 - urn:oma:lwm2m:x:10368 - 1.0 - 1.0 - Multiple - Optional - - - SpringMotor Name - R - Single - Mandatory - String - - - - - - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/10369.xml b/transport/lwm2m/src/main/data/models/10369.xml deleted file mode 100644 index 2c9c582091..0000000000 --- a/transport/lwm2m/src/main/data/models/10369.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - MCU - - 10369 - urn:oma:lwm2m:x:10369 - 1.0 - 1.0 - Single - Optional - - - Host Device Unique ID - R - Single - Optional - String - - - - - - - - Host Device Manufacturer - R - Single - Optional - String - - - - - - - - Host Device Model Number - R - Single - Optional - String - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2048.xml b/transport/lwm2m/src/main/data/models/2048.xml deleted file mode 100644 index efdfd2c6aa..0000000000 --- a/transport/lwm2m/src/main/data/models/2048.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - CmdhPolicy - - 2048 - urn:oma:lwm2m:ext:20481.0 - 1.0Multiple - Optional - - Name - RW - Single - Mandatory - String - - - - - DefaultRule - RW - Single - Mandatory - Objlnk - - - - - LimiRules - RW - Multiple - Mandatory - Objlnk - - - - - NetworkAccessECRules - RW - Multiple - Mandatory - Objlnk - - - - - BufferRules - RW - Multiple - Mandatory - Objlnk - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2049.xml b/transport/lwm2m/src/main/data/models/2049.xml deleted file mode 100644 index fbe677bf7c..0000000000 --- a/transport/lwm2m/src/main/data/models/2049.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - ActiveCmdhPolicy - - 2049 - urn:oma:lwm2m:ext:20491.0 - 1.0Single - Optional - - ActiveLink - RW - Single - Mandatory - Objlnk - - - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2050.xml b/transport/lwm2m/src/main/data/models/2050.xml deleted file mode 100644 index c000750fa5..0000000000 --- a/transport/lwm2m/src/main/data/models/2050.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - CmdhDefaults - - 2050 - urn:oma:lwm2m:ext:20501.0 - 1.0Multiple - Optional - - DefaultEcRules - RW - Multiple - Mandatory - Objlnk - - - - - - DefaultEcParamRules - RW - Multiple - Mandatory - Objlnk - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2051.xml b/transport/lwm2m/src/main/data/models/2051.xml deleted file mode 100644 index 1cedc6ab7d..0000000000 --- a/transport/lwm2m/src/main/data/models/2051.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - CmdhDefEcValues - - 2051 - urn:oma:lwm2m:ext:20511.0 - 1.0Multiple - Optional - - Order - RW - Single - Mandatory - Integer - - - - - DefEcValue - RW - Single - Mandatory - String - - - - - RequestOrigin - RW - Multiple - Mandatory - String - - - - - RequestContext - RW - Single - Optional - String - - - - - RequestContextNotification - RW - Single - Optional - Boolean - - - - - RequestCharacteristics - RW - Single - Optional - String - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2052.xml b/transport/lwm2m/src/main/data/models/2052.xml deleted file mode 100644 index c42e0ad212..0000000000 --- a/transport/lwm2m/src/main/data/models/2052.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - CmdhEcDefParamValues - - 2052 - urn:oma:lwm2m:ext:20521.0 - 1.0Multiple - Optional - - ApplicableEventCategory - RW - Multiple - Mandatory - Integer - - - - - DefaultRequestExpTime - RW - Single - Mandatory - Integer - - ms - - - - - - - - - DefaultResultExpTime - RW - Single - Mandatory - Integer - - ms - - - - DefaultOpExecTime - RW - Single - Mandatory - Integer - - ms - - - DefaultRespPersistence - RW - Single - Mandatory - Integer - - ms - - - DefaultDelAggregation - RW - Single - Mandatory - Integer - - ms - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2053.xml b/transport/lwm2m/src/main/data/models/2053.xml deleted file mode 100644 index e3c7f749bb..0000000000 --- a/transport/lwm2m/src/main/data/models/2053.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - CmdhLimits - - 2053 - urn:oma:lwm2m:ext:20531.0 - 1.0Multiple - Optional - - Order - RW - Single - Mandatory - Integer - - - - - RequestOrigin - RW - Multiple - Mandatory - String - - - - - - - - - - - RequestContext - RW - Single - Optional - String - - - - - - RequestContextNotificatio - RW - Single - Optional - Boolean - - - - - RequestCharacteristics - RW - Single - Optional - String - - - - - LimitsEventCategory - RW - Multiple - Mandatory - Integer - - - - - LimitsRequestExpTime - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsResultExpTime - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsOptExpTime - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsRespPersistence - RW - Multiple - Mandatory - Integer - 2 Instances - ms - - - LimitsDelAggregation - RW - Multiple - Mandatory - String - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2054.xml b/transport/lwm2m/src/main/data/models/2054.xml deleted file mode 100644 index 638ad74724..0000000000 --- a/transport/lwm2m/src/main/data/models/2054.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - CmdhNetworkAccessRules - - 2054 - urn:oma:lwm2m:ext:20541.0 - 1.0Multiple - Optional - - ApplicableEventCategories - RW - Multiple - Mandatory - Integer - - - - - NetworkAccessRule - RW - Multiple - Optional - Objlnk - - - - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2055.xml b/transport/lwm2m/src/main/data/models/2055.xml deleted file mode 100644 index f519af9abc..0000000000 --- a/transport/lwm2m/src/main/data/models/2055.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - CmdhNwAccessRule - - 2055 - urn:oma:lwm2m:ext:20551.0 - 1.0Multiple - Optional - - TargetNetwork - RW - Multiple - Mandatory - String - - - - - SpreadingWaitTime - RW - Single - Mandatory - Integer - - ms - - - MinReqVolume - RW - Single - Mandatory - Integer - - B - - - BackOffParameters - RW - Single - Mandatory - Objlnk - - - - - OtherConditions - RW - Single - Mandatory - String - - - - - AllowedSchedule - RW - Multiple - Mandatory - String - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2056.xml b/transport/lwm2m/src/main/data/models/2056.xml deleted file mode 100644 index 95d290545e..0000000000 --- a/transport/lwm2m/src/main/data/models/2056.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - CmdhBuffer - - 2056 - urn:oma:lwm2m:ext:20561.0 - 1.0Multiple - Optional - - ApplicableEventCategory - RW - Multiple - Mandatory - Integer - - - - - MaxBufferSize - RW - Single - Mandatory - Integer - - B - - - StoragePriority - RW - Single - Mandatory - Integer - 1..10 - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/2057.xml b/transport/lwm2m/src/main/data/models/2057.xml deleted file mode 100644 index 1b9c159d47..0000000000 --- a/transport/lwm2m/src/main/data/models/2057.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - CmdhBackOffParametersSet - - 2057 - urn:oma:lwm2m:ext:2057 - 1.0 - 1.0 - Multiple - Optional - - NetworkAction - RW - Single - Optional - Integer - 1..5 - - - - InitialBackoffTime - RW - Single - Mandatory - Integer - - ms - - - AdditionalBackoffTime - RW - Single - Mandatory - Integer - - ms - - - MaximumBackoffTime - RW - Single - Mandatory - Integer - - ms - - - OptionalRandomBackoffTime - RW - Multiple - Optional - Integer - - ms - - - - - diff --git a/transport/lwm2m/src/main/data/models/31024.xml b/transport/lwm2m/src/main/data/models/31024.xml deleted file mode 100644 index c6e1992c14..0000000000 --- a/transport/lwm2m/src/main/data/models/31024.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Test - A Wakaama object for testing purpose. - - 31024 - urn:oma:lwm2m:x:31024 - Multiple - Optional - - - test - RW - Single - Mandatory - Integer - 0-255 - - - - exec - E - Single - Mandatory - - - - dec - RW - Single - Mandatory - Float - - - - - - sig - RW - Single - Optional - Integer - - - 16-bit signed integer - - - - - diff --git a/transport/lwm2m/src/main/data/models/3200.xml b/transport/lwm2m/src/main/data/models/3200.xml deleted file mode 100644 index b74a03a48d..0000000000 --- a/transport/lwm2m/src/main/data/models/3200.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - Digital Input - Generic digital input for non-specific sensors - 3200 - urn:oma:lwm2m:ext:3200 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The cumulative value of active state detected. - - - Digital Input Polarity - RW - Single - Optional - Boolean - - - The polarity of the digital input as a Boolean (False = Normal, True = Reversed). - - - Digital Input Debounce - RW - Single - Optional - Integer - - ms - The debounce period in ms. - - - Digital Input Edge Selection - RW - Single - Optional - Integer - 1..3 - - The edge selection as an integer (1 = Falling edge, 2 = Rising edge, 3 = Both Rising and Falling edge). - - - Digital Input Counter Reset - E - Single - Optional - - - - Reset the Counter value. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor (for instance PIR type) - - - - - diff --git a/transport/lwm2m/src/main/data/models/3201.xml b/transport/lwm2m/src/main/data/models/3201.xml deleted file mode 100644 index 935d2665d3..0000000000 --- a/transport/lwm2m/src/main/data/models/3201.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Digital Output - Generic digital output for non-specific actuators - 3201 - urn:oma:lwm2m:ext:3201 - 1.0 - 1.0 - Multiple - Optional - - - Digital Output State - RW - Single - Mandatory - Boolean - - - The current state of a digital output. - - - Digital Output Polarity - RW - Single - Optional - Boolean - - - The polarity of the digital output as a Boolean (False = Normal, True = Reversed). - - - Application Type - RW - Single - Optional - String - - - The application type of the output as a string, for instance, "LED" - - - - - diff --git a/transport/lwm2m/src/main/data/models/3202.xml b/transport/lwm2m/src/main/data/models/3202.xml deleted file mode 100644 index 66f76ef653..0000000000 --- a/transport/lwm2m/src/main/data/models/3202.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Analog Input - Generic analog input for non-specific sensors - 3202 - urn:oma:lwm2m:ext:3202 - 1.0 - 1.0 - Multiple - Optional - - - Analog Input Current Value - R - Single - Mandatory - Float - - - The current value of the analog input. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor, for instance PIR type - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/transport/lwm2m/src/main/data/models/3203.xml b/transport/lwm2m/src/main/data/models/3203.xml deleted file mode 100644 index 3b216a246f..0000000000 --- a/transport/lwm2m/src/main/data/models/3203.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Analog Output - This IPSO object is a generic object that can be used with any kind of analog output interface. - 3203 - urn:oma:lwm2m:ext:3203 - 1.0 - 1.0 - Multiple - Optional - - - Analog Output Current Value - RW - Single - Mandatory - Float - 0..1 - - The current state of the analogue output. - - - Application Type - RW - Single - Optional - String - - - If present, the application type of the actuator as a string, for instance, "Valve" - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be set for the output - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be set for the output - - - - - diff --git a/transport/lwm2m/src/main/data/models/3300.xml b/transport/lwm2m/src/main/data/models/3300.xml deleted file mode 100644 index dc805f5a2d..0000000000 --- a/transport/lwm2m/src/main/data/models/3300.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Generic Sensor - This IPSO object allows the description of a generic sensor. It is based on the description of a value and a unit according to the SenML specification. Thus, any type of value defined within this specification can be reported using this object. This object may be used as a generic object if a dedicated one does not exist. - 3300 - urn:oma:lwm2m:ext:3300 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Application Type - RW - Single - Optional - String - - - If present, the application type of the sensor as a string, for instance, "CO2" - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor (for instance PIR type) - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/transport/lwm2m/src/main/data/models/3301.xml b/transport/lwm2m/src/main/data/models/3301.xml deleted file mode 100644 index ee20fc6546..0000000000 --- a/transport/lwm2m/src/main/data/models/3301.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Illuminance - Illuminance sensor, example units = lx - 3301 - urn:oma:lwm2m:ext:3301 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - The current value of the luminosity sensor. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3302.xml b/transport/lwm2m/src/main/data/models/3302.xml deleted file mode 100644 index 302980e2f7..0000000000 --- a/transport/lwm2m/src/main/data/models/3302.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Presence - Presence sensor with digital sensing, optional delay parameters - 3302 - urn:oma:lwm2m:ext:3302 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of the presence sensor - - - Digital Input Counter - R - Single - Optional - Integer - - - The cumulative value of active state detected. - - - Digital Input Counter Reset - E - Single - Optional - - - - Reset the Counter value - - - Sensor Type - R - Single - Optional - String - - - The type of the sensor (for instance PIR type) - - - Busy to Clear delay - RW - Single - Optional - Integer - - ms - Delay from the detection state to the clear state in ms - - - Clear to Busy delay - RW - Single - Optional - Integer - - ms - Delay from the clear state to the busy state in ms - - - - - diff --git a/transport/lwm2m/src/main/data/models/3303.xml b/transport/lwm2m/src/main/data/models/3303.xml deleted file mode 100644 index 33d2a8a50f..0000000000 --- a/transport/lwm2m/src/main/data/models/3303.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Temperature - This IPSO object should be used with a temperature sensor to report a temperature measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the temperature sensor. An example measurement unit is degrees Celsius. - 3303 - urn:oma:lwm2m:ext:3303 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/transport/lwm2m/src/main/data/models/3304.xml b/transport/lwm2m/src/main/data/models/3304.xml deleted file mode 100644 index 33f01a13b2..0000000000 --- a/transport/lwm2m/src/main/data/models/3304.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Humidity - This IPSO object should be used with a humidity sensor to report a humidity measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the humidity sensor. An example measurement unit is relative humidity as a percentage. - 3304 - urn:oma:lwm2m:ext:3304 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/transport/lwm2m/src/main/data/models/3305.xml b/transport/lwm2m/src/main/data/models/3305.xml deleted file mode 100644 index 95aef196ac..0000000000 --- a/transport/lwm2m/src/main/data/models/3305.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - Power Measurement - This IPSO object should be used over a power measurement sensor to report a remote power measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range for both active and reactive power. It also provides resources for cumulative energy, calibration, and the power factor. - 3305 - urn:oma:lwm2m:ext:3305 - 1.0 - 1.0 - Multiple - Optional - - - Instantaneous active power - R - Single - Mandatory - Float - - W - The current active power - - - Min Measured active power - R - Single - Optional - Float - - W - The minimum active power measured by the sensor since it is ON - - - Max Measured active power - R - Single - Optional - Float - - W - The maximum active power measured by the sensor since it is ON - - - Min Range active power - R - Single - Optional - Float - - W - The minimum active power that can be measured by the sensor - - - Max Range active power - R - Single - Optional - Float - - W - The maximum active power that can be measured by the sensor - - - Cumulative active power - R - Single - Optional - Float - - Wh - The cumulative active power since the last cumulative energy reset or device start - - - Active Power Calibration - W - Single - Optional - Float - - W - Request an active power calibration by writing the value of a calibrated load. - - - Instantaneous reactive power - R - Single - Optional - Float - - var - The current reactive power - - - Min Measured reactive power - R - Single - Optional - Float - - var - The minimum reactive power measured by the sensor since it is ON - - - Max Measured reactive power - R - Single - Optional - Float - - var - The maximum reactive power measured by the sensor since it is ON - - - Min Range reactive power - R - Single - Optional - Float - - var - The minimum active power that can be measured by the sensor - - - Max Range reactive power - R - Single - Optional - Float - - var - The maximum reactive power that can be measured by the sensor - - - Cumulative reactive power - R - Single - Optional - Float - - varh - The cumulative reactive power since the last cumulative energy reset or device start - - - Reactive Power Calibration - W - Single - Optional - Float - - var - Request a reactive power calibration by writing the value of a calibrated load. - - - Power factor - R - Single - Optional - Float - - - If applicable, the power factor of the current consumption. - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Reset Cumulative energy - E - Single - Optional - - - - Reset both cumulative active/reactive power - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/transport/lwm2m/src/main/data/models/3306.xml b/transport/lwm2m/src/main/data/models/3306.xml deleted file mode 100644 index 1395a4dcdd..0000000000 --- a/transport/lwm2m/src/main/data/models/3306.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Actuation - This IPSO object is dedicated to remote actuation such as ON/OFF action or dimming. A multi-state output can also be described as a string. This is useful to send pilot wire orders for instance. It also provides a resource to reflect the time that the device has been switched on. - 3306 - urn:oma:lwm2m:ext:3306 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Dimmer - RW - Single - Optional - Integer - 0..100 - /100 - This resource represents a light dimmer setting, which has an Integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the device has been on. Writing a value of 0 resets the counter. - - - Muti-state Output - RW - Single - Optional - String - - - A string describing a state for multiple level output such as Pilot Wire - - - Application Type - RW - Single - Optional - String - - - The Application type of the device, for example "Motion Closure". - - - - - diff --git a/transport/lwm2m/src/main/data/models/3308.xml b/transport/lwm2m/src/main/data/models/3308.xml deleted file mode 100644 index 18e4b04fe2..0000000000 --- a/transport/lwm2m/src/main/data/models/3308.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Set Point - This IPSO object should be used to set a desired value to a controller, such as a thermostat. A special resource is added to set the colour of an object. - 3308 - urn:oma:lwm2m:ext:3308 - 1.0 - 1.0 - Multiple - Optional - - - Set Point Value - RW - Single - Mandatory - Float - - - The setpoint value. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Colour - RW - Single - Optional - String - - - A string representing a value in some color space - - - Application Type - RW - Single - Optional - String - - - The Application type of the device, for example "Motion Closure". - - - - - diff --git a/transport/lwm2m/src/main/data/models/3310.xml b/transport/lwm2m/src/main/data/models/3310.xml deleted file mode 100644 index bd989b1800..0000000000 --- a/transport/lwm2m/src/main/data/models/3310.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Load Control - This Object is used for demand-response load control and other load control in automation application (not limited to power). - 3310 - urn:oma:lwm2m:ext:3310 - 1.0 - 1.0 - Multiple - Optional - - - Event Identifier - RW - Single - Mandatory - String - - - The event identifier as a string. - - - Start Time - RW - Single - Mandatory - Time - - - Time when the event started. - - - Duration In Min - RW - Single - Mandatory - Integer - - min - The duration of the event in minutes. - - - Criticality Level - RW - Single - Optional - Integer - 0..3 - - The criticality of the event. The device receiving the event will react in an appropriate fashion for the device. - - - Avg Load AdjPct - RW - Single - Optional - Integer - 0..100 - /100 - Defines the maximum energy usage of the receiving device, as a percentage of the device's normal maximum energy usage. - - - Duty Cycle - RW - Single - Optional - Integer - 0..100 - /100 - Defines the duty cycle for the load control event, i.e, what percentage of time the receiving device is allowed to be on. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3311.xml b/transport/lwm2m/src/main/data/models/3311.xml deleted file mode 100644 index 2969a5e25c..0000000000 --- a/transport/lwm2m/src/main/data/models/3311.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Light Control - This Object is used to control a light source, such as a LED or other light. It allows a light to be turned on or off and its dimmer setting to be control as a % between 0 and 100. An optional colour setting enables a string to be used to indicate the desired colour. - 3311 - urn:oma:lwm2m:ext:3311 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Dimmer - RW - Single - Optional - Integer - 0..100 - /100 - This resource represents a light dimmer setting, which has an Integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the light has been on. Writing a value of 0 resets the counter. - - - Cumulative active power - R - Single - Optional - Float - - Wh - The total power in Wh that the light has used. - - - Power factor - R - Single - Optional - Float - - - The power factor of the light. - - - Colour - RW - Single - Optional - String - - - A string representing a value in some color space - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - - - diff --git a/transport/lwm2m/src/main/data/models/3312.xml b/transport/lwm2m/src/main/data/models/3312.xml deleted file mode 100644 index 231878465f..0000000000 --- a/transport/lwm2m/src/main/data/models/3312.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Power Control - This Object is used to control a power source, such as a Smart Plug. It allows a power relay to be turned on or off and its dimmer setting to be control as a % between 0 and 100. - 3312 - urn:oma:lwm2m:ext:3312 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Dimmer - RW - Single - Optional - Integer - 0..100 - /100 - This resource represents a power dimmer setting, which has an Integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the power relay has been on. Writing a value of 0 resets the counter. - - - Cumulative active power - R - Single - Optional - Float - - Wh - The total power in Wh that has been used by the load. - - - Power factor - R - Single - Optional - Float - - - The power factor of the load. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string, for instance, "Air Pressure" - - - - - diff --git a/transport/lwm2m/src/main/data/models/3313.xml b/transport/lwm2m/src/main/data/models/3313.xml deleted file mode 100644 index c826b5119d..0000000000 --- a/transport/lwm2m/src/main/data/models/3313.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Accelerometer - This IPSO object can be used to represent a 1-3 axis accelerometer. - 3313 - urn:oma:lwm2m:ext:3313 - 1.0 - 1.0 - Multiple - Optional - - - X Value - R - Single - Mandatory - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - - - diff --git a/transport/lwm2m/src/main/data/models/3314.xml b/transport/lwm2m/src/main/data/models/3314.xml deleted file mode 100644 index 4c4c85b517..0000000000 --- a/transport/lwm2m/src/main/data/models/3314.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Magnetometer - This IPSO object can be used to represent a 1-3 axis magnetometer with optional compass direction. - 3314 - urn:oma:lwm2m:ext:3314 - 1.0 - 1.0 - Multiple - Optional - - - X Value - R - Single - Mandatory - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Compass Direction - R - Single - Optional - Float - 0..360 - deg - The measured compass direction. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3315.xml b/transport/lwm2m/src/main/data/models/3315.xml deleted file mode 100644 index e87296c2a8..0000000000 --- a/transport/lwm2m/src/main/data/models/3315.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - Barometer - This IPSO object should be used with an air pressure sensor to report a barometer measurement. It also provides resources for minimum/maximum measured values and the minimum/maximum range that can be measured by the barometer sensor. An example measurement unit is pascals. - 3315 - urn:oma:lwm2m:ext:3315 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - - - diff --git a/transport/lwm2m/src/main/data/models/3316.xml b/transport/lwm2m/src/main/data/models/3316.xml deleted file mode 100644 index 791307f710..0000000000 --- a/transport/lwm2m/src/main/data/models/3316.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Voltage - This IPSO object should be used with voltmeter sensor to report measured voltage between two points. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is volts. - - 3316 - urn:oma:lwm2m:ext:3316 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3317.xml b/transport/lwm2m/src/main/data/models/3317.xml deleted file mode 100644 index 4567e1d1b8..0000000000 --- a/transport/lwm2m/src/main/data/models/3317.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Current - This IPSO object should be used with an ammeter to report measured electric current in amperes. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is ampere. - - 3317 - urn:oma:lwm2m:ext:3317 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3318.xml b/transport/lwm2m/src/main/data/models/3318.xml deleted file mode 100644 index e3b3a2ba51..0000000000 --- a/transport/lwm2m/src/main/data/models/3318.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Frequency - This IPSO object should be used to report frequency measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is hertz. - - 3318 - urn:oma:lwm2m:ext:3318 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3319.xml b/transport/lwm2m/src/main/data/models/3319.xml deleted file mode 100644 index 9bdb7fc290..0000000000 --- a/transport/lwm2m/src/main/data/models/3319.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Depth - This IPSO object should be used to report depth measurements. It can, for example, be used to describe a generic rain gauge that measures the accumulated rainfall in millimetres (mm). - - 3319 - urn:oma:lwm2m:ext:3319 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3320.xml b/transport/lwm2m/src/main/data/models/3320.xml deleted file mode 100644 index 7e6981bcb6..0000000000 --- a/transport/lwm2m/src/main/data/models/3320.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Percentage - This IPSO object should can be used to report measurements relative to a 0-100% scale. For example it could be used to measure the level of a liquid in a vessel or container in units of %. - - 3320 - urn:oma:lwm2m:ext:3320 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3321.xml b/transport/lwm2m/src/main/data/models/3321.xml deleted file mode 100644 index bdccef1146..0000000000 --- a/transport/lwm2m/src/main/data/models/3321.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Altitude - This IPSO object should be used with an altitude sensor to report altitude above sea level in meters. Note that Altitude can be calculated from the measured pressure given the local sea level pressure. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is meters. - - 3321 - urn:oma:lwm2m:ext:3321 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3322.xml b/transport/lwm2m/src/main/data/models/3322.xml deleted file mode 100644 index 6a2fffcd02..0000000000 --- a/transport/lwm2m/src/main/data/models/3322.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Load - This IPSO object should be used with a load sensor (as in a scale) to report the applied weight or force. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is kilograms. - - 3322 - urn:oma:lwm2m:ext:3322 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3323.xml b/transport/lwm2m/src/main/data/models/3323.xml deleted file mode 100644 index b47e8c81f2..0000000000 --- a/transport/lwm2m/src/main/data/models/3323.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Pressure - This IPSO object should be used to report pressure measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is pascals. - - 3323 - urn:oma:lwm2m:ext:3323 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3324.xml b/transport/lwm2m/src/main/data/models/3324.xml deleted file mode 100644 index 68ce6cc5b2..0000000000 --- a/transport/lwm2m/src/main/data/models/3324.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Loudness - This IPSO object should be used to report loudness or noise level measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is decibels. - - 3324 - urn:oma:lwm2m:ext:3324 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3325.xml b/transport/lwm2m/src/main/data/models/3325.xml deleted file mode 100644 index 3df1460efb..0000000000 --- a/transport/lwm2m/src/main/data/models/3325.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Concentration - This IPSO object should be used to the particle concentration measurement of a medium. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is parts per million. - - 3325 - urn:oma:lwm2m:ext:3325 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3326.xml b/transport/lwm2m/src/main/data/models/3326.xml deleted file mode 100644 index 0fbcc361fa..0000000000 --- a/transport/lwm2m/src/main/data/models/3326.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Acidity - This IPSO object should be used to report an acidity measurement of a liquid. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is pH. - - 3326 - urn:oma:lwm2m:ext:3326 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3327.xml b/transport/lwm2m/src/main/data/models/3327.xml deleted file mode 100644 index e6ccea30b0..0000000000 --- a/transport/lwm2m/src/main/data/models/3327.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Conductivity - This IPSO object should be used to report a measurement of the electric conductivity of a medium or sample. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is Siemens. - - 3327 - urn:oma:lwm2m:ext:3327 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3328.xml b/transport/lwm2m/src/main/data/models/3328.xml deleted file mode 100644 index 4a1cc8d521..0000000000 --- a/transport/lwm2m/src/main/data/models/3328.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Power - This IPSO object should be used to report power measurements. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is Watts. This object may be used for either real power or apparent power measurements. - - 3328 - urn:oma:lwm2m:ext:3328 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3329.xml b/transport/lwm2m/src/main/data/models/3329.xml deleted file mode 100644 index 9d184675e9..0000000000 --- a/transport/lwm2m/src/main/data/models/3329.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Power Factor - This IPSO object should be used to report a measurement or calculation of the power factor of a reactive electrical load. Power Factor is normally the ratio of non-reactive power to total power. This object also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. - - 3329 - urn:oma:lwm2m:ext:3329 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3330.xml b/transport/lwm2m/src/main/data/models/3330.xml deleted file mode 100644 index 047d9419c7..0000000000 --- a/transport/lwm2m/src/main/data/models/3330.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Distance - This IPSO object should be used to report a distance measurement. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is Meters. - - 3330 - urn:oma:lwm2m:ext:3330 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3331.xml b/transport/lwm2m/src/main/data/models/3331.xml deleted file mode 100644 index 9dfada1719..0000000000 --- a/transport/lwm2m/src/main/data/models/3331.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Energy - This IPSO object should be used to report energy consumption (Cumulative Power) of an electrical load. An example measurement unit is Watt Hours. - - 3331 - urn:oma:lwm2m:ext:3331 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Reset Cumulative energy - E - Single - Optional - - - - Reset both cumulative active/reactive power. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3332.xml b/transport/lwm2m/src/main/data/models/3332.xml deleted file mode 100644 index 1d1a408f1d..0000000000 --- a/transport/lwm2m/src/main/data/models/3332.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Direction - This IPSO object is used to report the direction indicated by a compass, wind vane, or other directional indicator. The units of measure is plane angle degrees. - - 3332 - urn:oma:lwm2m:ext:3332 - 1.0 - 1.0 - Multiple - Optional - - - Compass Direction - R - Single - Mandatory - Float - 0..360 - deg - The measured compass direction. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset. - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3333.xml b/transport/lwm2m/src/main/data/models/3333.xml deleted file mode 100644 index 1cc818b01b..0000000000 --- a/transport/lwm2m/src/main/data/models/3333.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Time - This IPSO object is used to report the current time in seconds since January 1, 1970 UTC. There is also a fractional time counter that has a range of less than one second. - - 3333 - urn:oma:lwm2m:ext:3333 - 1.0 - 1.0 - Multiple - Optional - - - Current Time - RW - Single - Mandatory - Time - - - Unix Time. A signed integer representing the number of seconds since Jan 1st, 1970 in the UTC time zone. - - - Fractional Time - RW - Single - Optional - Float - 0..1 - s - Fractional part of the time when sub-second precision is used (e.g., 0.23 for 230 ms). - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3334.xml b/transport/lwm2m/src/main/data/models/3334.xml deleted file mode 100644 index a4a22d2eda..0000000000 --- a/transport/lwm2m/src/main/data/models/3334.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - Gyrometer - This IPSO Object is used to report the current reading of a gyrometer sensor in 3 axes. It provides tracking of the minimum and maximum angular rate in all 3 axes. An example unit of measure is radians per second. - - 3334 - urn:oma:lwm2m:ext:3334 - 1.0 - 1.0 - Multiple - Optional - - - X Value - R - Single - Mandatory - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min X Value - R - Single - Optional - Float - - - The minimum measured value along the X axis - - - Max X Value - R - Single - Optional - Float - - - The maximum measured value along the X axis - - - Min Y Value - R - Single - Optional - Float - - - The minimum measured value along the Y axis - - - Max Y Value - R - Single - Optional - Float - - - The maximum measured value along the Y axis - - - Min Z Value - R - Single - Optional - Float - - - The minimum measured value along the Z axis - - - Max Z Value - R - Single - Optional - Float - - - The maximum measured value along the Z axis - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value. - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3335.xml b/transport/lwm2m/src/main/data/models/3335.xml deleted file mode 100644 index e59e170c4f..0000000000 --- a/transport/lwm2m/src/main/data/models/3335.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Colour - This IPSO object should be used to report the measured value of a colour sensor in some colour space described by the units resource. - - 3335 - urn:oma:lwm2m:ext:3335 - 1.0 - 1.0 - Multiple - Optional - - - Colour - RW - Single - Mandatory - String - - - A string representing a value in some colour space. - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3336.xml b/transport/lwm2m/src/main/data/models/3336.xml deleted file mode 100644 index 3aede0ed7f..0000000000 --- a/transport/lwm2m/src/main/data/models/3336.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - Location - This IPSO object represents GPS coordinates. This object is compatible with the LWM2M management object for location, but uses reusable resources. - - 3336 - urn:oma:lwm2m:ext:3336 - 1.0 - 1.0 - Multiple - Optional - - - Latitude - R - Single - Mandatory - String - - - The decimal notation of latitude, e.g. -43.5723 (World Geodetic System 1984). - - - Longitude - R - Single - Mandatory - String - - - The decimal notation of longitude, e.g. 153.21760 (World Geodetic System 1984). - - - Uncertainty - R - Single - Optional - String - - - The accuracy of the position in meters. - - - Compass Direction - R - Single - Optional - Float - 0..360 - deg - The measured compass direction. - - - Velocity - R - Single - Optional - Opaque - - - The velocity of the device as defined in 3GPP 23.032 GAD specification. This set of values may not be available if the device is static. - - - Timestamp - R - Single - Optional - Time - - - The timestamp of when the measurement was performed. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3337.xml b/transport/lwm2m/src/main/data/models/3337.xml deleted file mode 100644 index de169a75c6..0000000000 --- a/transport/lwm2m/src/main/data/models/3337.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Positioner - This IPSO object should be used with a generic position actuator with range from 0 to 100%. This object optionally allows setting the transition time for an operation that changes the position of the actuator, and for reading the remaining time of the currently active transition. - - 3337 - urn:oma:lwm2m:ext:3337 - 1.0 - 1.0 - Multiple - Optional - - - Current Position - RW - Single - Mandatory - Float - 0..100 - /100 - Current position or desired position of a positioner actuator. - - - Transition Time - RW - Single - Optional - Float - - s - The time expected to move the actuator to the new position. - - - Remaining Time - R - Single - Optional - Float - - s - The time remaining in an operation. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value set on the actuator since power ON or reset. - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value set on the actuator since power ON or reset. - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value. - - - Min Limit - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor. - - - Max Limit - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3338.xml b/transport/lwm2m/src/main/data/models/3338.xml deleted file mode 100644 index 09e2ebb028..0000000000 --- a/transport/lwm2m/src/main/data/models/3338.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Buzzer - This IPSO object should be used to actuate an audible alarm such as a buzzer, beeper, or vibration alarm. There is a dimmer control for setting the relative loudness of the alarm, and an optional duration control to limit the length of time the alarm sounds when turned on. Each time "true" is written to the On/Off resource, the alarm will sound again for the configured duration. If no duration is programmed or the setting is "false", writing a "true" to the On/Off resource will result in the alarm sounding continuously until a "false" is written to the On/Off resource. - - 3338 - urn:oma:lwm2m:ext:3338 - 1.0 - 1.0 - Multiple - Optional - - - On/Off - RW - Single - Mandatory - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Level - RW - Single - Optional - Float - 0..100 - /100 - Audio volume control, float value between 0 and 100 as a percentage. - - - Delay Duration - RW - Single - Optional - Float - - s - The duration of the time delay. - - - Minimum Off-time - RW - Single - Mandatory - Float - - s - The off time when On/Off control remains on. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3339.xml b/transport/lwm2m/src/main/data/models/3339.xml deleted file mode 100644 index 9de914fc7c..0000000000 --- a/transport/lwm2m/src/main/data/models/3339.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - Audio Clip - This IPSO object should be used for a speaker that plays a pre-recorded audio clip or an audio output that is sent elsewhere. For example, an elevator which announces the floor of the building. A resource is provided to store the clip, a dimmer resource controls the relative sound level of the playback, and a duration resource limits the maximum playback time. After the duration time is reached, any remaining samples in the clip are ignored, and the clip player will be ready to play another clip. - 3339 - urn:oma:lwm2m:ext:3339 - 1.0 - 1.0 - Multiple - Optional - - - Clip - RW - Single - Mandatory - Opaque - - - Audio clip that is playable (e.g., a short audio recording indicating the floor in an elevator). - - - Trigger - E - Single - Optional - - - - Trigger initiating actuation. - - - Level - RW - Single - Optional - Float - 0..100 - /100 - Audio volume control, float value between 0 and 100 as a percentage. - - - Duration - RW - Single - Optional - Float - - s - The duration of the sound once trigger. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3340.xml b/transport/lwm2m/src/main/data/models/3340.xml deleted file mode 100644 index 3494aab3b6..0000000000 --- a/transport/lwm2m/src/main/data/models/3340.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - Timer - This IPSO object is used to time events and actions, using patterns common to industrial timers. A write to the trigger resource or On/Off input state change starts the timing operation, and the timer remaining time shows zero when the operation is complete. The patterns supported are One-Shot (mode 1), On-Time or Interval (mode 2), Time delay on pick-up or TDPU (mode 3), and Time Delay on Drop-Out or TDDO (mode 4). Mode 0 disables the timer, so the output follows the input with no delay. A counter is provided to count occurrences of the timer output changing from 0 to 1. Writing a value of zero resets the counter. The Digital Input State resource reports the state of the timer output. - - 3340 - urn:oma:lwm2m:ext:3340 - 1.0 - 1.0 - Multiple - Optional - - - Delay Duration - RW - Single - Mandatory - Float - - s - The duration of the time delay. - - - Remaining Time - R - Single - Optional - Float - - s - The time remaining in an operation. - - - Minimum Off-time - RW - Single - Optional - Float - - s - The duration of the rearm delay (i.e. the delay from the end of one cycle until the beginning of the next, the inhibit time). - - - Trigger - E - Single - Optional - - - - Trigger initiating actuation. - - - On/Off - RW - Single - Optional - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input. - - - Cumulative Time - RW - Single - Optional - Float - - s - The total time in seconds that the timer input is true. Writing a 0 resets the time. - - - Digital State - R - Single - Optional - Boolean - - - The current state of the timer output. - - - Counter - RW - Single - Optional - Integer - - - Counts the number of times the timer output transitions from 0 to 1. - - - Timer Mode - RW - Single - Optional - Integer - 0..4 - - Type of timer pattern used by the patterns. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3341.xml b/transport/lwm2m/src/main/data/models/3341.xml deleted file mode 100644 index c8187aa155..0000000000 --- a/transport/lwm2m/src/main/data/models/3341.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Addressable Text Display - This IPSO object is used to send text to a text-only or text mode graphics display. Writing a string of text to the text resource causes it to be displayed at the selected X and Y locations on the display. If X or Y are set to a value greater than the size of the display, the position "wraps around" to the modulus of the setting and the display size. Likewise, if the text string overflows the display size, the text "wraps around" and displays on the next line down or, if the last line has been written, wraps around to the top of the display. Brightness and Contrast controls are provided to allow control of various display types including STN and DSTN type LCD character displays. Writing an empty payload to the Clear Display resource causes the display to be erased. - - 3341 - urn:oma:lwm2m:ext:3341 - 1.0 - 1.0 - Multiple - Optional - - - Text - RW - Single - Mandatory - String - - - A string of text. - - - X Coordinate - RW - Single - Optional - Integer - - - X Coordinate. - - - Y Coordinate - RW - Single - Optional - Integer - - - Y Coordinate. - - - Max X Coordinate - R - Single - Optional - Integer - - - The highest X coordinate the display supports before wrapping to the next line. - - - Max Y Coordinate - R - Single - Optional - Integer - - - The highest Y coordinate the display supports before wrapping to the next line. - - - Clear Display - E - Single - Optional - - - - Command to clear the display. - - - Level - RW - Single - Optional - Float - 0..100 - /100 - Brightness control, integer value between 0 and 100 as a percentage. - - - Contrast - RW - Single - Optional - Float - 0..100 - /100 - Proportional control, integer value between 0 and 100 as a percentage. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3342.xml b/transport/lwm2m/src/main/data/models/3342.xml deleted file mode 100644 index eadcb7a810..0000000000 --- a/transport/lwm2m/src/main/data/models/3342.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - On/Off switch - This IPSO object should be used with an On/Off switch to report the state of the switch. - 3342 - urn:oma:lwm2m:ext:3342 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from 0 to 1. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds since the On command was sent. Writing a value of 0 resets the counter. - - - Off Time - RW - Single - Optional - Integer - - s - The time in seconds since the Off command was sent. Writing a value of 0 resets the counter. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3343.xml b/transport/lwm2m/src/main/data/models/3343.xml deleted file mode 100644 index f3ceaa1bef..0000000000 --- a/transport/lwm2m/src/main/data/models/3343.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Dimmer - This IPSO object should be used with a dimmer or level control to report the state of the control. - - 3343 - urn:oma:lwm2m:ext:3343 - 1.0 - 1.0 - Multiple - Optional - - - Level - RW - Single - Mandatory - Float - 0..100 - /100 - Proportional control, integer value between 0 and 100 as a percentage. - - - On time - RW - Single - Optional - Integer - - s - The time in seconds that the dimmer has been on (Dimmer value has to be > 0). Writing a value of 0 resets the counter. - - - Off Time - RW - Single - Optional - Integer - - s - The time in seconds that the dimmer has been off (dimmer value less or equal to 0) Writing a value of 0 resets the counter. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3344.xml b/transport/lwm2m/src/main/data/models/3344.xml deleted file mode 100644 index e83c2a7054..0000000000 --- a/transport/lwm2m/src/main/data/models/3344.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Up/Down Control - This IPSO object is used to report the state of an up/down control element like a pair of push buttons or a rotary encoder. Counters for increase and decrease operations are provided for counting pulses from a quadrature encoder. - - 3344 - urn:oma:lwm2m:ext:3344 - 1.0 - 1.0 - Multiple - Optional - - - Increase Input State - R - Single - Mandatory - Boolean - - - Indicates an increase control action. - - - Decrease Input State - R - Single - Mandatory - Boolean - - - Indicates a decrease control action. - - - Up Counter - RW - Single - Optional - Integer - - - Counts the number of times the increase control has been operated. Writing a 0 resets the counter. - - - Down Counter - RW - Single - Optional - Integer - - - Counts the times the decrease control has been operated. Writing a 0 resets the counter. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3345.xml b/transport/lwm2m/src/main/data/models/3345.xml deleted file mode 100644 index 3aeae67f44..0000000000 --- a/transport/lwm2m/src/main/data/models/3345.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - Multiple Axis Joystick - This IPSO object can be used to report the position of a shuttle or joystick control. A digital input is provided to report the state of an associated push button. - - 3345 - urn:oma:lwm2m:ext:3345 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Optional - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from 0 to 1. - - - X Value - R - Single - Optional - Float - - - The measured value along the X axis. - - - Y Value - R - Single - Optional - Float - - - The measured value along the Y axis. - - - Z Value - R - Single - Optional - Float - - - The measured value along the Z axis. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3346.xml b/transport/lwm2m/src/main/data/models/3346.xml deleted file mode 100644 index eb5336f7e0..0000000000 --- a/transport/lwm2m/src/main/data/models/3346.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Rate - This object type should be used to report a rate measurement, for example the speed of a vehicle, or the rotational speed of a drive shaft. It also provides resources for minimum and maximum measured values, as well as the minimum and maximum range that can be measured by the sensor. An example measurement unit is meters per second (m/s). - - 3346 - urn:oma:lwm2m:ext:3346 - 1.0 - 1.0 - Multiple - Optional - - - Sensor Value - R - Single - Mandatory - Float - - - Last or Current Measured Value from the Sensor - - - Sensor Units - R - Single - Optional - String - - - Measurement Units Definition. - - - Min Measured Value - R - Single - Optional - Float - - - The minimum value measured by the sensor since power ON or reset - - - Max Measured Value - R - Single - Optional - Float - - - The maximum value measured by the sensor since power ON or reset - - - Min Range Value - R - Single - Optional - Float - - - The minimum value that can be measured by the sensor - - - Max Range Value - R - Single - Optional - Float - - - The maximum value that can be measured by the sensor - - - Reset Min and Max Measured Values - E - Single - Optional - - - - Reset the Min and Max Measured Values to Current Value - - - Current Calibration - RW - Single - Optional - Float - - - Read or Write the current calibration coefficient - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case - - - - - diff --git a/transport/lwm2m/src/main/data/models/3347.xml b/transport/lwm2m/src/main/data/models/3347.xml deleted file mode 100644 index 0b188d5a7e..0000000000 --- a/transport/lwm2m/src/main/data/models/3347.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Push button - This IPSO object is used to report the state of a momentary action push button control and to count the number of times the control has been operated since the last observation. - - 3347 - urn:oma:lwm2m:ext:3347 - 1.0 - 1.0 - Multiple - Optional - - - Digital Input State - R - Single - Mandatory - Boolean - - - The current state of a digital input. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from 0 to 1. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3348.xml b/transport/lwm2m/src/main/data/models/3348.xml deleted file mode 100644 index d8937c4fea..0000000000 --- a/transport/lwm2m/src/main/data/models/3348.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Multi-state Selector - This IPSO object is used to represent the state of a Multi-state selector switch with a number of fixed positions. - - 3348 - urn:oma:lwm2m:ext:3348 - 1.0 - 1.0 - Multiple - Optional - - - Multi-state Input - R - Single - Mandatory - Integer - - - The current state of a Multi-state input or selector. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3349.xml b/transport/lwm2m/src/main/data/models/3349.xml deleted file mode 100644 index e07d1f711b..0000000000 --- a/transport/lwm2m/src/main/data/models/3349.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Bitmap - Summarize several digital inputs to one value by mapping each bit to a digital input. - 3349 - urn:oma:lwm2m:ext:3349 - 1.0 - 1.0 - Multiple - Optional - - - Bitmap Input - R - Single - Mandatory - Integer - - - Integer in which each of the bits are associated with specific digital input value. Represented as a binary signed integer in network byte order, and in two's complement representation. Using values in range 0-127 is recommended to avoid ambiguities with byte order and negative values. - - - Bitmap Input Reset - E - Single - Optional - - - - Reset the Bitmap Input value. - - - Element Description - RW - Multiple - Optional - String - - - The description of each bit as a string. First instance describes the least significant bit, second instance the second least significant bit. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3350.xml b/transport/lwm2m/src/main/data/models/3350.xml deleted file mode 100644 index dc9b0fcafc..0000000000 --- a/transport/lwm2m/src/main/data/models/3350.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Stopwatch - An ascending timer that counts how long time has passed since the timer was started after reset. - 3350 - urn:oma:lwm2m:ext:3350 - 1.0 - 1.0 - Multiple - Optional - - - Cumulative Time - RW - Single - Mandatory - Float - - s - The total time in seconds that the stopwatch has been on. Writing a 0 resets the time. - - - On/Off - RW - Single - Optional - Boolean - - - On/off control. Boolean value where True is On and False is Off. - - - Digital Input Counter - R - Single - Optional - Integer - - - The number of times the input transitions from off to on. - - - Application Type - RW - Single - Optional - String - - - The application type of the sensor or actuator as a string depending on the use case. - - - - - diff --git a/transport/lwm2m/src/main/data/models/3351.xml b/transport/lwm2m/src/main/data/models/3351.xml deleted file mode 100644 index 8f6db38357..0000000000 --- a/transport/lwm2m/src/main/data/models/3351.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - powerupLog - - 3351 - urn:oma:lwm2m:ext:3351 - 1.0 - 1.0 - Single - Optional - - deviceName - R - Single - Mandatory - String - - - - - toolVersion - R - Single - Mandatory - String - - - - - IMEI - R - Single - Mandatory - String - - - - - IMSI - R - Single - Mandatory - String - - - - - MSISDN - R - Single - Mandatory - String - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3352.xml b/transport/lwm2m/src/main/data/models/3352.xml deleted file mode 100644 index c0d3f73c6c..0000000000 --- a/transport/lwm2m/src/main/data/models/3352.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - plmnSearchEvent - - 3352 - urn:oma:lwm2m:ext:3352 - 1.0 - 1.0 - Multiple - Optional - - timeScanStart - R - Single - Mandatory - Integer - - - - - plmnID - R - Single - Mandatory - Integer - - - - - BandIndicator - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3353.xml b/transport/lwm2m/src/main/data/models/3353.xml deleted file mode 100644 index b09c4e62c8..0000000000 --- a/transport/lwm2m/src/main/data/models/3353.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - scellID - - 3353 - urn:oma:lwm2m:ext:3353 - 1.0 - 1.0 - Single - Optional - - plmnID - R - Single - Mandatory - Integer - - - - - BandIndicator - R - Single - Mandatory - Integer - - - - - TrackingAreaCode - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3354.xml b/transport/lwm2m/src/main/data/models/3354.xml deleted file mode 100644 index e05d2d4328..0000000000 --- a/transport/lwm2m/src/main/data/models/3354.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - cellReselectionEvent - - 3354 - urn:oma:lwm2m:ext:3354 - 1.0 - 1.0 - Single - Optional - - timeReselectionStart - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - failureType - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3355.xml b/transport/lwm2m/src/main/data/models/3355.xml deleted file mode 100644 index 061e1ae92f..0000000000 --- a/transport/lwm2m/src/main/data/models/3355.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - handoverEvent - - 3355 - urn:oma:lwm2m:ext:3355 - 1.0 - 1.0 - Single - Optional - - timeHandoverStart - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - handoverResult - R - Single - Mandatory - Integer - - - - - - TargetEarfcn - R - Single - Mandatory - Integer - - - - - TargetPhysicalCellID - R - Single - Mandatory - Integer - - - - - targetCellRsrp - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3356.xml b/transport/lwm2m/src/main/data/models/3356.xml deleted file mode 100644 index 7ebd3050d5..0000000000 --- a/transport/lwm2m/src/main/data/models/3356.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - radioLinkFailureEvent - - 3356 - urn:oma:lwm2m:ext:3356 - 1.0 - 1.0 - Single - Optional - - timeRLF - R - Single - Mandatory - Integer - - - - - rlfCause - R - Single - Mandatory - Integer - - - - - - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3357.xml b/transport/lwm2m/src/main/data/models/3357.xml deleted file mode 100644 index 76ed482171..0000000000 --- a/transport/lwm2m/src/main/data/models/3357.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - rrcStateChangeEvent - - 3357 - urn:oma:lwm2m:ext:3357 - 1.0 - 1.0 - Single - Optional - - rrcState - R - Single - Mandatory - Integer - - - - - rrcStateChangeCause - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3358.xml b/transport/lwm2m/src/main/data/models/3358.xml deleted file mode 100644 index dbbb9e82a8..0000000000 --- a/transport/lwm2m/src/main/data/models/3358.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - rrcTimerExpiryEvent - - 3358 - urn:oma:lwm2m:ext:3358 - 1.0 - 1.0 - Single - Optional - - RrcTimerExpiryEvent - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3359.xml b/transport/lwm2m/src/main/data/models/3359.xml deleted file mode 100644 index 8dbd810603..0000000000 --- a/transport/lwm2m/src/main/data/models/3359.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - cellBlacklistEvent - - 3359 - urn:oma:lwm2m:ext:3359 - 1.0 - 1.0 - Single - Optional - - dlEarfcn - R - Single - Mandatory - Integer - - - - - CellID - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3360.xml b/transport/lwm2m/src/main/data/models/3360.xml deleted file mode 100644 index e920a18637..0000000000 --- a/transport/lwm2m/src/main/data/models/3360.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - esmContextInfo - - 3360 - urn:oma:lwm2m:ext:3360 - 1.0 - 1.0 - Single - Optional - - contextType - R - Single - Mandatory - Integer - - - - - bearerState - R - Single - Mandatory - Integer - - - - - radioBearerId - R - Single - Mandatory - Integer - - - - - qci - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3361.xml b/transport/lwm2m/src/main/data/models/3361.xml deleted file mode 100644 index 60b149e2aa..0000000000 --- a/transport/lwm2m/src/main/data/models/3361.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - emmStateValue - - 3361 - urn:oma:lwm2m:ext:3361 - 1.0 - 1.0 - Single - Optional - - EmmState - R - Single - Mandatory - Integer - - - - - emmSubstate - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3362.xml b/transport/lwm2m/src/main/data/models/3362.xml deleted file mode 100644 index ca096314fb..0000000000 --- a/transport/lwm2m/src/main/data/models/3362.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - nasEmmTimerExpiryEvent - - 3362 - urn:oma:lwm2m:ext:3362 - 1.0 - 1.0 - Single - Optional - - NasEmmTimerExpiryEvent - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3363.xml b/transport/lwm2m/src/main/data/models/3363.xml deleted file mode 100644 index bfde9d423a..0000000000 --- a/transport/lwm2m/src/main/data/models/3363.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - nasEsmExpiryEvent - - 3363 - urn:oma:lwm2m:ext:3363 - 1.0 - 1.0 - Single - Optional - - NasEsmExpiryEvent - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3364.xml b/transport/lwm2m/src/main/data/models/3364.xml deleted file mode 100644 index 732c1548c1..0000000000 --- a/transport/lwm2m/src/main/data/models/3364.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - emmFailureCauseEvent - - 3364 - urn:oma:lwm2m:ext:3364 - 1.0 - 1.0 - Single - Optional - - EMMCause - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3365.xml b/transport/lwm2m/src/main/data/models/3365.xml deleted file mode 100644 index 1f07528f8a..0000000000 --- a/transport/lwm2m/src/main/data/models/3365.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - rachLatency_delay - - 3365 - urn:oma:lwm2m:ext:3365 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - rachLatencyVal - R - Single - Mandatory - Integer - - - - - delay - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3366.xml b/transport/lwm2m/src/main/data/models/3366.xml deleted file mode 100644 index e4f793b96a..0000000000 --- a/transport/lwm2m/src/main/data/models/3366.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - macRachAttemptEvent - - 3366 - urn:oma:lwm2m:ext:3366 - 1.0 - 1.0 - Single - Optional - - rachAttemptCounter - R - Single - Mandatory - Integer - - - - - MacRachAttemptEventType - R - Single - Mandatory - Integer - - - - - contentionBased - R - Single - Mandatory - Boolean - - - - - rachMessage - R - Single - Mandatory - Integer - - - - - preambleIndex - R - Single - Mandatory - Integer - - - - - preamblePowerOffset - R - Single - Mandatory - Integer - - - - - backoffTime - R - Single - Mandatory - Integer - - - - - msg2Result - R - Single - Mandatory - Boolean - - - - - timingAdjustmentValue - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3367.xml b/transport/lwm2m/src/main/data/models/3367.xml deleted file mode 100644 index a97a3d3994..0000000000 --- a/transport/lwm2m/src/main/data/models/3367.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - macRachAttemptReasonEvent - - 3367 - urn:oma:lwm2m:ext:3367 - 1.0 - 1.0 - Single - Optional - - MacRachAttemptReasonType - R - Single - Mandatory - Integer - - - - - ueID - R - Single - Mandatory - Integer - - - - - contentionBased - R - Single - Mandatory - Boolean - - - - - preamble - R - Single - Mandatory - Integer - - - - - preambleGroupChosen - R - Single - Mandatory - Boolean - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3368.xml b/transport/lwm2m/src/main/data/models/3368.xml deleted file mode 100644 index 2f1abcaeba..0000000000 --- a/transport/lwm2m/src/main/data/models/3368.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - macTimerStatusEvent - - 3368 - urn:oma:lwm2m:ext:3368 - 1.0 - 1.0 - Single - Optional - - macTimerName - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3369.xml b/transport/lwm2m/src/main/data/models/3369.xml deleted file mode 100644 index c905081c07..0000000000 --- a/transport/lwm2m/src/main/data/models/3369.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - macTimingAdvanceEvent - - 3369 - urn:oma:lwm2m:ext:3369 - 1.0 - 1.0 - Single - Optional - - timerValue - R - Single - Mandatory - Integer - - - - - timingAdvance - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3370.xml b/transport/lwm2m/src/main/data/models/3370.xml deleted file mode 100644 index a9da3758ce..0000000000 --- a/transport/lwm2m/src/main/data/models/3370.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - ServingCellMeasurement - - 3370 - urn:oma:lwm2m:ext:3370 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - pci - R - Single - Mandatory - Integer - - - - - rsrp - R - Single - Mandatory - Integer - - - - - rsrq - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3371.xml b/transport/lwm2m/src/main/data/models/3371.xml deleted file mode 100644 index 32c0583d91..0000000000 --- a/transport/lwm2m/src/main/data/models/3371.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - NeighborCellMeasurements - - 3371 - urn:oma:lwm2m:ext:3371 - 1.0 - 1.0 - Multiple - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - pci - R - Single - Mandatory - Integer - - - - - rsrp - R - Single - Mandatory - Integer - - - - - rsrq - R - Single - Mandatory - Integer - - - - - dlEarfcn - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3372.xml b/transport/lwm2m/src/main/data/models/3372.xml deleted file mode 100644 index 3b7cf1ca8f..0000000000 --- a/transport/lwm2m/src/main/data/models/3372.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - TimingAdvance - - 3372 - urn:oma:lwm2m:ext:3372 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - timingAdvance - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3373.xml b/transport/lwm2m/src/main/data/models/3373.xml deleted file mode 100644 index 597b3f6842..0000000000 --- a/transport/lwm2m/src/main/data/models/3373.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - txPowerHeadroomEvent - - 3373 - urn:oma:lwm2m:ext:3373 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - headroom-value - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3374.xml b/transport/lwm2m/src/main/data/models/3374.xml deleted file mode 100644 index a74899c7e5..0000000000 --- a/transport/lwm2m/src/main/data/models/3374.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - radioLinkMonitoring - - 3374 - urn:oma:lwm2m:ext:3374 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - outOfSyncCount - R - Single - Mandatory - Integer - - - - - inSyncCount - R - Single - Mandatory - Integer - - - - - t310Timer - R - Single - Mandatory - Boolean - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3375.xml b/transport/lwm2m/src/main/data/models/3375.xml deleted file mode 100644 index 76c7c1ae20..0000000000 --- a/transport/lwm2m/src/main/data/models/3375.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - PagingDRX - - 3375 - urn:oma:lwm2m:ext:3375 - 1.0 - 1.0 - Single - Optional - - dlEarfcn - R - Single - Mandatory - Integer - - - - - pci - R - Single - Mandatory - Integer - - - - - pagingCycle - R - Single - Mandatory - Integer - - - - - DrxNb - R - Single - Mandatory - Integer - - - - - ueID - R - Single - Mandatory - Integer - - - - - drxSysFrameNumOffset - R - Single - Mandatory - Integer - - - - - drxSubFrameNumOffset - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3376.xml b/transport/lwm2m/src/main/data/models/3376.xml deleted file mode 100644 index 39542f5962..0000000000 --- a/transport/lwm2m/src/main/data/models/3376.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - txPowerBackOffEvent - - 3376 - urn:oma:lwm2m:ext:3376 - 1.0 - 1.0 - Single - Optional - - TxPowerBackoff - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3377.xml b/transport/lwm2m/src/main/data/models/3377.xml deleted file mode 100644 index afcddb10d5..0000000000 --- a/transport/lwm2m/src/main/data/models/3377.xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - Message3Report - - 3377 - urn:oma:lwm2m:ext:3377 - 1.0 - 1.0 - Single - Optional - - tpc - R - Single - Mandatory - Integer - - - - - resourceIndicatorValue - R - Single - Mandatory - Integer - - - - - cqi - R - Single - Mandatory - Integer - - - - - uplinkDelay - R - Single - Mandatory - Boolean - - - - - hoppingEnabled - R - Single - Mandatory - Boolean - - - - - numRb - R - Single - Mandatory - Integer - - - - - transportBlockSizeIndex - R - Single - Mandatory - Integer - - - - - ModulationType - R - Single - Mandatory - Integer - - - - - redundancyVersionIndex - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3378.xml b/transport/lwm2m/src/main/data/models/3378.xml deleted file mode 100644 index 3c3972b43e..0000000000 --- a/transport/lwm2m/src/main/data/models/3378.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - PbchDecodingResults - - 3378 - urn:oma:lwm2m:ext:3378 - 1.0 - 1.0 - Single - Optional - - servingCellID - R - Single - Mandatory - Integer - - - - - crcResult - R - Single - Mandatory - Boolean - - - - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3379.xml b/transport/lwm2m/src/main/data/models/3379.xml deleted file mode 100644 index 12062a953e..0000000000 --- a/transport/lwm2m/src/main/data/models/3379.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - pucchPowerControl - - 3379 - urn:oma:lwm2m:ext:3379 - 1.0 - 1.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - pucchTxPowerValue - - Single - Mandatory - Integer - - - - - dlPathLoss - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3380-2_0.xml b/transport/lwm2m/src/main/data/models/3380-2_0.xml deleted file mode 100644 index c1b8822e21..0000000000 --- a/transport/lwm2m/src/main/data/models/3380-2_0.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - PrachReport - - 3380 - urn:oma:lwm2m:ext:3380:2.0 - 1.0 - 2.0 - Single - Optional - - sysFrameNumber - R - Single - Mandatory - Integer - - - - - subFrameNumber - R - Single - Mandatory - Integer - - - - - rachTxPower - R - Single - Mandatory - Integer - - - - - zadOffSeqNum - R - Single - Mandatory - Integer - - - - - prachConfig - R - Single - Mandatory - Integer - - - - - preambleFormat - R - Single - Mandatory - Integer - - - - - maxTransmissionMsg3 - R - Single - Mandatory - Integer - - - - - raResponseWindowSize - R - Single - Mandatory - Integer - - - - - RachRequestResult - R - Single - Mandatory - Boolean - - - - - ce_mode - R - Single - Mandatory - Integer - - - - - ce_level - R - Single - Mandatory - Integer - - - - - num_prach_repetition - R - Single - Mandatory - Integer - - - - - prach_repetition_seq - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3381.xml b/transport/lwm2m/src/main/data/models/3381.xml deleted file mode 100644 index b029984980..0000000000 --- a/transport/lwm2m/src/main/data/models/3381.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - VolteCallEvent - - 3381 - urn:oma:lwm2m:ext:3381 - 1.0 - 1.0 - Single - Optional - - callStatus - R - Single - Mandatory - Integer - - - - - callType - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3382.xml b/transport/lwm2m/src/main/data/models/3382.xml deleted file mode 100644 index 7be3dde5e9..0000000000 --- a/transport/lwm2m/src/main/data/models/3382.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - SipRegistrationEvent - - 3382 - urn:oma:lwm2m:ext:3382 - 1.0 - 1.0 - Single - Optional - - registrationType - R - Single - Mandatory - Integer - - - - - registrationResult - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3383.xml b/transport/lwm2m/src/main/data/models/3383.xml deleted file mode 100644 index 5b094cb491..0000000000 --- a/transport/lwm2m/src/main/data/models/3383.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - sipPublishEvent - - 3383 - urn:oma:lwm2m:ext:3383 - 1.0 - 1.0 - Single - Optional - - publishResult - R - Single - Mandatory - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3384.xml b/transport/lwm2m/src/main/data/models/3384.xml deleted file mode 100644 index ee5c6922fb..0000000000 --- a/transport/lwm2m/src/main/data/models/3384.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - sipSubscriptionEvent - - 3384 - urn:oma:lwm2m:ext:3384 - 1.0 - 1.0 - Single - Optional - - eventType - R - Single - Mandatory - Integer - - - - - subscriptionResult - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3385.xml b/transport/lwm2m/src/main/data/models/3385.xml deleted file mode 100644 index 7039bd3cd4..0000000000 --- a/transport/lwm2m/src/main/data/models/3385.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - volteCallStateChangeEvent - - 3385 - urn:oma:lwm2m:ext:3385 - 1.0 - 1.0 - Single - Optional - - callStatus - R - Single - Mandatory - Integer - - - - - VolteCallStateChangeCause - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/3386.xml b/transport/lwm2m/src/main/data/models/3386.xml deleted file mode 100644 index 4afb12684e..0000000000 --- a/transport/lwm2m/src/main/data/models/3386.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - VoLTErtpPacketLoss - 1]]> - 3386 - urn:oma:lwm2m:ext:3386 - 1.0 - 1.0 - Single - Optional - - ssrc - R - Single - Mandatory - Integer - - - - - packetsLost - R - Single - Mandatory - Integer - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/LWM2M_APN_Connection_Profile-v1_0_1.xml b/transport/lwm2m/src/main/data/models/LWM2M_APN_Connection_Profile-v1_0_1.xml deleted file mode 100644 index cb37a20f0c..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_APN_Connection_Profile-v1_0_1.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - - - LWM2M APN Connection Profile - - 11 - - urn:oma:lwm2m:oma:11 - 1.0 - 1.0 - Multiple - Optional - - Profile name - RW - Single - Mandatory - String - - - - - APN - RW - Single - Optional - String - - - - - Auto select APN by device - RW - Single - Optional - Boolean - - - - - Enable status - RW - Single - Optional - Boolean - - - - - Authentication Type - RW - Single - Mandatory - Integer - - - - - User Name - RW - Single - Optional - String - - - - - Secret - RW - Single - Optional - String - - - - - Reconnect Schedule - RW - Single - Optional - String - - - - - Validity (MCC, MNC) - RW - Multiple - Optional - String - - - - - Connection establishment time (1) - R - Multiple - Optional - Time - - - - - Connection establishment result (1) - R - Multiple - Optional - Integer - - - - - - Connection establishment reject cause (1) - R - Multiple - Optional - Integer - 0..111 - - - - Connection end time (1) - R - Multiple - Optional - Time - - - - - TotalBytesSent - R - Single - Optional - Integer - - - - - TotalBytesReceived - R - Single - Optional - Integer - - - - - IP address (2) - RW - Multiple - Optional - String - - - - - Prefix length(2) - RW - Multiple - Optional - String - - - - - Subnet mask (2) - RW - Multiple - Optional - String - - - - - Gateway (2) - RW - Multiple - Optional - String - - - - - Primary DNS address (2) - RW - Multiple - Optional - String - - - - - Secondary DNS address (2) - RW - Multiple - Optional - String - - - - - QCI (3) - R - Single - Optional - Integer - 1..9 - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - TotalPacketsSent - R - Single - Optional - Integer - - - - - PDN Type - RW - Single - Optional - Integer - - - - - - APN Rate Control - R - Single - Optional - Integer - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/LWM2M_Bearer_Selection-v1_0_1.xml b/transport/lwm2m/src/main/data/models/LWM2M_Bearer_Selection-v1_0_1.xml deleted file mode 100644 index 36e5922107..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_Bearer_Selection-v1_0_1.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - LWM2M Bearer Selection - - 13 - urn:oma:lwm2m:oma:13 - 1.0 - 1.0 - Single - Optional - - Preferred Communications Bearer - RW - Multiple - Optional - Integer - 8 bit - - - - Acceptable RSSI (GSM) - RW - Single - Optional - Integer - - - - - Acceptable RSCP (UMTS) - RW - Single - Optional - Integer - - - - - Acceptable RSRP (LTE) - RW - Single - Optional - Integer - - - - - Acceptable RSSI (1xEV-DO) - RW - Single - Optional - Integer - - - - - Cell lock list - RW - Single - Optional - String - - - - - Operator list - RW - Single - Optional - String - - - - - Operator list mode - RW - Single - Optional - Boolean - - - - - List of available PLMNs - R - Single - Optional - String - - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - Acceptable RSRP (NB-IoT) - RW - Single - Optional - Integer - - - - - Higher Priority PLMN Search Timer - RW - Single - Optional - Integer - - - - - Attach without PDN connection - RW - Single - Optional - Boolean - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/LWM2M_Cellular_Connectivity-v1_0_1.xml b/transport/lwm2m/src/main/data/models/LWM2M_Cellular_Connectivity-v1_0_1.xml deleted file mode 100644 index 6c2cbf0fdc..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_Cellular_Connectivity-v1_0_1.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - LWM2M Cellular Connectivity - - 10 - urn:oma:lwm2m:oma:10 - 1.0 - 1.0 - Single - Optional - - SMSC address - RW - Single - Optional - String - - - - - Disable radio period - RW - Single - Optional - Integer - 0..65535 - - 0 the device SHALL disconnect. When the period has elapsed the device MAY reconnect.]]> - - Module activation code - RW - Single - Optional - String - - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - PSM Timer (1) - RW - Single - Optional - Integer - - s - - - Active Timer (1) - RW - Single - Optional - Integer - - s - - - Serving PLMN Rate control - R - Single - Optional - Integer - - - - - eDRX parameters for Iu mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - eDRX parameters for WB-S1 mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - eDRX parameters for NB-S1 mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - eDRX parameters for A/Gb mode (1) - RW - Single - Optional - Opaque - 8 bit - - - - Activated Profile Names - R - Multiple - Mandatory - Objlnk - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/LWM2M_DevCapMgmt-v1_0.xml b/transport/lwm2m/src/main/data/models/LWM2M_DevCapMgmt-v1_0.xml deleted file mode 100644 index a7f51720db..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_DevCapMgmt-v1_0.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - DevCapMgmt - - 15 - urn:oma:lwm2m:oma:15 - Multiple - Optional - - Property - R - Single - Mandatory - String - - - - - Group - R - Single - Mandatory - Integer - 0-15 - - - - Description - R - Single - Optional - String - - - - - Attached - R - Single - Optional - Boolean - - - - - Enabled - R - Single - Mandatory - Boolean - - - - - opEnable - E - Single - Mandatory - - - - - - opDisable - E - Multiple - Mandatory - - - - - - NotifyEn - RW - Single - Optional - Boolean - - - - - - - \ No newline at end of file diff --git a/transport/lwm2m/src/main/data/models/LWM2M_LOCKWIPE-v1_0_1.xml b/transport/lwm2m/src/main/data/models/LWM2M_LOCKWIPE-v1_0_1.xml deleted file mode 100644 index cad8b9366f..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_LOCKWIPE-v1_0_1.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - Lock and Wipe - - 8 - urn:oma:lwm2m:oma:8 - Single - Optional - - State - RW - Single - Mandatory - Integer - 0-2 - - - - Lock target - W - Multiple - Mandatory - String - - - - - Wipe item - R - Multiple - Optional - String - - - - - Wipe - E - Single - Mandatory - - - - - - - Wipe target - W - Multiple - Mandatory - String - - - - Lock or Wipe Operation Result - R - Single - Mandatory - Integer - 0-8 - - - - - - \ No newline at end of file diff --git a/transport/lwm2m/src/main/data/models/LWM2M_Portfolio-v1_0.xml b/transport/lwm2m/src/main/data/models/LWM2M_Portfolio-v1_0.xml deleted file mode 100644 index a023383bae..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_Portfolio-v1_0.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - Portfolio - - 16 - urn:oma:lwm2m:oma:161.0 - 1.0Multiple - Optional - - Identity - RW - Multiple - Mandatory - String - - - - - GetAuthData - E - Single - Optional - - - - - - AuthData - R - Multiple - Optional - Opaque - - - - - AuthStatus - R - Single - Optional - Integer - [0-2] - - - - - - \ No newline at end of file diff --git a/transport/lwm2m/src/main/data/models/LWM2M_Software_Component-v1_0.xml b/transport/lwm2m/src/main/data/models/LWM2M_Software_Component-v1_0.xml deleted file mode 100644 index 596c54b751..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_Software_Component-v1_0.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - LWM2M Software Component - - 14 - urn:oma:lwm2m:oma:14 - Multiple - Optional - - - Component Identity - R - Single - Optional - String - 0-255 bytes - - - - - Component Pack - R - Single - Optional - Opaque - - - - - - Component Version - R - Single - Optional - String - 0-255 bytes - - - - - Activate - E - Single - Optional - - - - - - - Deactivate - E - Single - Optional - - - - - - Activation State - R - Single - Optional - Boolean - - - - - - - - diff --git a/transport/lwm2m/src/main/data/models/LWM2M_Software_Management-v1_0.xml b/transport/lwm2m/src/main/data/models/LWM2M_Software_Management-v1_0.xml deleted file mode 100644 index fd880e0963..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_Software_Management-v1_0.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - - LWM2M Software Management - - 9 - urn:oma:lwm2m:oma:9 - Multiple - Optional - - - PkgName - R - Single - Mandatory - String - 0-255 bytes - - - - - PkgVersion - R - Single - Mandatory - String - 0-255 bytes - - - - - Package - W - Single - Optional - Opaque - - - - - - Package URI - W - Single - Optional - String - 0-255 bytes - - - - - Install - E - Single - Mandatory - - - - - - Checkpoint - R - Single - Optional - Objlnk - - - - - Uninstall - E - Single - Mandatory - - - - - - Update State - R - Single - Mandatory - Integer - 0-4 - - - - Update Supported Objects - RW - Single - Optional - Boolean - - - - - Update Result - R - Single - Mandatory - Integer - 0-200 - - - - Activate - E - Single - Mandatory - - - - - - Deactivate - E - Single - Mandatory - - - - - - Activation State - R - Single - Mandatory - Boolean - - - - - Package Settings - RW - Single - Optional - Objlnk - - - - - User Name - W - Single - Optional - String - 0-255 bytes - - - - Password - W - Single - Optional - String - 0-255 bytes - - - - - - diff --git a/transport/lwm2m/src/main/data/models/LWM2M_WLAN_connectivity4-v1_0.xml b/transport/lwm2m/src/main/data/models/LWM2M_WLAN_connectivity4-v1_0.xml deleted file mode 100644 index 57550f2b36..0000000000 --- a/transport/lwm2m/src/main/data/models/LWM2M_WLAN_connectivity4-v1_0.xml +++ /dev/null @@ -1,528 +0,0 @@ - - - - - WLAN connectivity - - 12 - urn:oma:lwm2m:oma:12 - - - Multiple - Optional - - Interface name - RW - Single - Mandatory - String - - - - - Enable - RW - Single - Mandatory - Boolean - - - - - Radio Enabled - RW - Single - Optional - Integer - - - - - Status - R - Single - Mandatory - Integer - - - - - BSSID - R - Single - Mandatory - String - 12 bytes - - - - SSID - RW - Single - Mandatory - String - 1-32 Bytes - - - - Broadcast SSID - RW - Single - Optional - Boolean - - - - - Beacon Enabled - RW - Single - Optional - Boolean - - - - - Mode - RW - Single - Mandatory - Integer - - - - - Channel - RW - Single - Mandatory - Integer - 0-255 - - - - Auto Channel - RW - Single - Optional - Boolean - - - - - Supported Channels - RW - Multiple - Optional - Integer - - - - - Channels In Use - RW - Multiple - Optional - Integer - - - - - Regulatory Domain - RW - Single - Optional - String - 3 Bytes - - - - Standard - RW - Single - Mandatory - Integer - - - - - Authentication Mode - RW - Single - Mandatory - Integer - - - - - Encryption Mode - RW - Single - Optional - Integer - - - - - WPA Pre Shared Key - W - Single - Optional - String - 64 Bytes - - - - WPA Key Phrase - W - Single - Optional - String - 1-64 Bytes - - - - WEP Encryption Type - RW - Single - Optional - Integer - - - - - WEP Key Index - RW - Single - Optional - Integer - [1:4] - - - - WEP Key Phrase - W - Single - Optional - String - 1-64 Bytes - - - - WEP Key 1 - W - Single - Optional - String - 0 or 26 Bytes - - - - WEP Key 2 - W - Single - Optional - String - 0 or 26 Bytes - - - - WEP Key 3 - W - Single - Optional - String - 10 or 26 Bytes - - - - WEP Key 4 - W - Single - Optional - String - 10 or 26 Bytes - - - - RADIUS Server - RW - Single - Optional - String - 1-256 Bytes - - - - RADIUS Server Port - RW - Single - Optional - Integer - - - - - RADIUS Secret - W - Single - Optional - String - 1-256 Bytes - - - - WMM Supported - R - Single - Optional - Boolean - - - - - WMM Enabled - RW - Single - Optional - Boolean - - - - - MAC Control Enabled - RW - Single - Optional - Boolean - - - - - MAC Address List - RW - Multiple - Optional - String - 12 Bytes - - - - Total Bytes Sent - R - Single - Optional - Integer - - - - - Total Bytes Received - R - Single - Optional - Integer - - - - - Total Packets Sent - R - Single - Optional - Integer - - - - - Total Packets Received - R - Single - Optional - Integer - - - - - Transmit Errors - R - Single - Optional - Integer - - - - - Receive Errors - R - Single - Optional - Integer - - - - - Unicast Packets Sent - R - Single - Optional - Integer - - - - - Unicast Packets Received - R - Single - Optional - Integer - - - - - Multicast Packets Received - R - Single - Optional - Integer - - - - - Multicast Packets Received - R - Single - Optional - Integer - - - - - Broadcast Packets Sent - R - Single - Optional - Integer - - - - - 44 Broadcast Packets Received - R - Single - Optional - Integer - - - - - Discard Packets Sent - R - Single - Optional - Integer - - - - - Discard Packets Received - R - Single - Optional - Integer - - - - - Unknown Packets Received - R - Single - Optional - Integer - - - - - Vendor specific extensions - R - Single - Optional - Objlnk - - - - - - - \ No newline at end of file diff --git a/transport/lwm2m/src/main/data/models/LwM2M_EventLog-V1_0.xml b/transport/lwm2m/src/main/data/models/LwM2M_EventLog-V1_0.xml deleted file mode 100644 index 4129dd8ce8..0000000000 --- a/transport/lwm2m/src/main/data/models/LwM2M_EventLog-V1_0.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - Event Log - - 20 - urn:oma:lwm2m:oma:20 - 1.0 - 1.0 - Single - Optional - - LogClass - RW - Single - Optional - Integer - 255 - - - - LogStart - E - Single - Optional - - - - - - LogStop - E - Single - Optional - - - - - - LogStatus - R - Single - Optional - Integer - 8-Bits - - - - LogData - R - Single - Mandatory - Opaque - - - - - LogDataFormat - RW - Single - Optional - Integer - 255 - - - - - - \ No newline at end of file diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html index 672098d88a..36dea4c42b 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/lwm2m-device-profile-transport-configuration.component.html @@ -29,17 +29,6 @@ {count: +lwm2mDeviceProfileFormGroup.get('clientOnlyObserveAfterConnect').value} }}
-
- - {{ 'device-profile.lwm2m.client-update-value-after-connect' | translate: - {count: +lwm2mDeviceProfileFormGroup.get('clientUpdateValueAfterConnect').value} }} - -
{ this.lwm2mDeviceProfileFormGroup.patchValue({ clientOnlyObserveAfterConnect: this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect, - clientUpdateValueAfterConnect: this.configurationValue.clientLwM2mSettings.clientUpdateValueAfterConnect, objectIds: value, observeAttrTelemetry: this.getObserveAttrTelemetryObjects(value['objectsList']), shortId: this.configurationValue.bootstrap.servers.shortId, @@ -183,8 +181,6 @@ export class Lwm2mDeviceProfileTransportConfigurationComponent implements Contro if (this.lwm2mDeviceProfileFormGroup.valid) { this.configurationValue.clientLwM2mSettings.clientOnlyObserveAfterConnect = config.clientOnlyObserveAfterConnect; - this.configurationValue.clientLwM2mSettings.clientUpdateValueAfterConnect = - config.clientUpdateValueAfterConnect; this.updateObserveAttrTelemetryFromGroupToJson(config.observeAttrTelemetry.clientLwM2M); this.configurationValue.bootstrap.bootstrapServer = config.bootstrapServer; this.configurationValue.bootstrap.lwm2mServer = config.lwm2mServer; diff --git a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts index 7142648061..b4c0e9a539 100644 --- a/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts +++ b/ui-ngx/src/app/modules/home/components/profile/device/lwm2m/profile-config.models.ts @@ -98,7 +98,6 @@ export interface ProfileConfigModels { export interface ClientLwM2mSettings { clientOnlyObserveAfterConnect: boolean; - clientUpdateValueAfterConnect: boolean; } export interface ObservableAttributes { observe: string[]; @@ -157,8 +156,7 @@ function getDefaultProfileObserveAttrConfig(): ObservableAttributes { function getDefaultProfileClientLwM2mSettingsConfig(): ClientLwM2mSettings { return { - clientOnlyObserveAfterConnect: true, - clientUpdateValueAfterConnect: false + clientOnlyObserveAfterConnect: true }; } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index f406eb4e21..329c472bb4 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1108,10 +1108,8 @@ "schedule-time-to": "To", "schedule-days-of-week-required": "At least one day of week should be selected.", "lwm2m": { - "client-only-observe-after-connect": "{ count, plural, 1 {Only Observe Request to the client after registration} other {Read&Observe Request to the client after registration} }", - "client-only-observe-after-connect-tip": "{ count, plural, 1 {Only Observe Request to the client marked as observe from the profile configuration.} other {Read Request to the client after registration to read the values of the resources then Observe Request to the client marked as observe from the profile configuration.} }", - "client-update-value-after-connect": "{ count, plural, 1 {Request to the client after registration for All resource values} other {Request to the client after registration to read values only as attributes or telemetry} }", - "client-update-value-after-connect-tip": "{ count, plural, 1 {Request to the client after registration to read all resource values for all objects} other {Request to the client after registration to read the values of the resources marked as attribute or telemetry from the profile configuration.} }", + "client-only-observe-after-connect": "{ count, plural, 1 {Strategy 1: Only Observe Request to the client after the initial connection} other {Strategy 2: Read All Resources & Observe Request to the client after registration} }", + "client-only-observe-after-connect-tip": "{ count, plural, 1 {Strategy 1: After the initial connection of the LWM2M Client, the server sends Observe resources Request to the client, those resources that are marked as observation in the Device profile and which exist on the LWM2M client.} other {Strategy 2: After the registration, request the client to read all the resource values for all objects that the LWM2M client has,\n then execute: the server sends Observe resources Request to the client, those resources that are marked as observation in the Device profile and which exist on the LWM2M client.} }", "object-list": "Object list", "object-list-empty": "No objects selected.", "no-objects-matching": "No objects matching '{{object}}' were found.", From bd3185a98fe7049f0f0c02e1e3a0e9585a0ea773 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Fri, 5 Mar 2021 17:43:56 +0200 Subject: [PATCH 58/69] added resource support in transport lvl (get resources and "update", "delete" notifications) --- .../server/controller/ResourceController.java | 17 +++--- .../service/install/InstallScripts.java | 5 +- .../service/lwm2m/LwM2MModelsRepository.java | 2 + .../queue/DefaultTbClusterService.java | 29 ++++++++++ .../service/queue/TbClusterService.java | 5 ++ .../transport/DefaultTransportApiService.java | 54 +++++++++++++++++-- .../server/dao/resource/ResourceService.java | 6 ++- .../data/transport/resource/ResourceType.java | 2 +- .../queue/util/TbLwM2mTransportComponent.java | 2 +- common/queue/src/main/proto/queue.proto | 37 +++++++++++++ .../common/transport/TransportService.java | 4 ++ .../service/DefaultTransportService.java | 16 ++++++ .../dao/resource/BaseResourceService.java | 24 +++++---- .../server/dao/resource/ResourceDao.java | 4 +- .../dao/sql/resource/ResourceDaoImpl.java | 10 ++-- .../dao/sql/resource/ResourceRepository.java | 5 +- 16 files changed, 189 insertions(+), 33 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java index b09e4e23b2..babe444ae7 100644 --- a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java +++ b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java @@ -49,8 +49,10 @@ public class ResourceController extends BaseController { @ResponseBody public Resource saveResource(Resource resource) throws ThingsboardException { try { - resource.setTenantId(getCurrentUser().getTenantId()); - return checkNotNull(resourceService.saveResource(resource)); + resource.setTenantId(getTenantId()); + Resource savedResource = checkNotNull(resourceService.saveResource(resource)); + tbClusterService.onResourceChange(savedResource, null); + return savedResource; } catch (Exception e) { throw handleException(e); } @@ -61,7 +63,7 @@ public class ResourceController extends BaseController { @ResponseBody public List getResources(@RequestParam(required = false) boolean system) throws ThingsboardException { try { - return checkNotNull(resourceService.findByTenantId(system ? TenantId.SYS_TENANT_ID : getCurrentUser().getTenantId())); + return checkNotNull(resourceService.findResourcesByTenantId(system ? TenantId.SYS_TENANT_ID : getTenantId())); } catch (Exception e) { throw handleException(e); } @@ -70,13 +72,14 @@ public class ResourceController extends BaseController { @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") @RequestMapping(value = "/resource/{resourceType}/{resourceId}", method = RequestMethod.DELETE) @ResponseBody - public boolean deleteResource(@PathVariable("resourceType") ResourceType resourceType, - @PathVariable("resourceId") String resourceId) throws ThingsboardException { + public void deleteResource(@PathVariable("resourceType") ResourceType resourceType, + @PathVariable("resourceId") String resourceId) throws ThingsboardException { try { - return resourceService.deleteResource(getCurrentUser().getTenantId(), resourceType, resourceId); + Resource resource = checkNotNull(resourceService.getResource(getTenantId(), resourceType, resourceId)); + resourceService.deleteResource(getTenantId(), resourceType, resourceId); + tbClusterService.onResourceDeleted(resource, null); } catch (Exception e) { throw handleException(e); } } - } diff --git a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java index 5029a520e3..2fc832129f 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java +++ b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java @@ -24,7 +24,6 @@ import org.springframework.util.StringUtils; import org.thingsboard.server.common.data.Dashboard; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationTemplate; import org.thingsboard.server.common.data.rule.RuleChain; @@ -206,7 +205,7 @@ public class InstallScripts { resource.setTenantId(TenantId.SYS_TENANT_ID); resource.setResourceType(ResourceType.LWM2M_MODEL); resource.setResourceId(path.getFileName().toString()); - resource.setValue(Files.readString(path)); + resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(path))); resourceService.saveResource(resource); } catch (Exception e) { log.error("Unable to load lwm2m model [{}]", path.toString()); @@ -220,7 +219,7 @@ public class InstallScripts { try { Resource resource = new Resource(); resource.setTenantId(TenantId.SYS_TENANT_ID); - resource.setResourceType(ResourceType.LWM2M_KEY_STORE); + resource.setResourceType(ResourceType.JKS); resource.setResourceId(jksPath.getFileName().toString()); resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(jksPath))); resourceService.saveResource(resource); diff --git a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java index 5057893d5c..3db41fff8b 100644 --- a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java +++ b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java @@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigBootstrap; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigServer; import org.thingsboard.server.dao.service.Validator; +import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode; import java.math.BigInteger; @@ -61,6 +62,7 @@ import static org.thingsboard.server.dao.service.Validator.validateId; @Slf4j @Service +@TbLwM2mTransportComponent @ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true') || '${service.type:null}'=='monolith' || '${service.type:null}'=='tb-core'") public class LwM2MModelsRepository { diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java index 133447022b..3405ab28d8 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java @@ -34,6 +34,7 @@ import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; +import org.thingsboard.server.common.data.transport.resource.Resource; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.ServiceType; @@ -247,6 +248,34 @@ public class DefaultTbClusterService implements TbClusterService { onEntityDelete(entity.getTenantId(), entity.getId(), entity.getName(), callback); } + @Override + public void onResourceChange(Resource resource, TbQueueCallback callback) { + TenantId tenantId = resource.getTenantId(); + log.trace("[{}][{}][{}] Processing change resource", tenantId, resource.getResourceType(), resource.getResourceId()); + TransportProtos.ResourceUpdateMsg resourceUpdateMsg = TransportProtos.ResourceUpdateMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setResourceType(resource.getResourceType().name()) + .setResourceId(resource.getResourceId()) + .build(); + ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setResourceUpdateMsg(resourceUpdateMsg).build(); + broadcast(transportMsg, callback); + } + + @Override + public void onResourceDeleted(Resource resource, TbQueueCallback callback) { + TenantId tenantId = resource.getTenantId(); + log.trace("[{}][{}][{}] Processing delete resource", tenantId, resource.getResourceType(), resource.getResourceId()); + TransportProtos.ResourceDeleteMsg resourceUpdateMsg = TransportProtos.ResourceDeleteMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setResourceType(resource.getResourceType().name()) + .setResourceId(resource.getResourceId()) + .build(); + ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setResourceDeleteMsg(resourceUpdateMsg).build(); + broadcast(transportMsg, callback); + } + public void onEntityChange(TenantId tenantId, EntityId entityid, T entity, TbQueueCallback callback) { String entityName = (entity instanceof HasName) ? ((HasName) entity).getName() : entity.getClass().getName(); log.trace("[{}][{}][{}] Processing [{}] change event", tenantId, entityid.getEntityType(), entityid.getId(), entityName); diff --git a/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java index 92401ea9c0..c1cafa3379 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; +import org.thingsboard.server.common.data.transport.resource.Resource; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.gen.transport.TransportProtos; @@ -71,4 +72,8 @@ public interface TbClusterService { void onDeviceChange(Device device, TbQueueCallback callback); void onDeviceDeleted(Device device, TbQueueCallback callback); + + void onResourceChange(Resource resource, TbQueueCallback callback); + + void onResourceDeleted(Resource resource, TbQueueCallback callback); } diff --git a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java index b157e0d0a7..ef6d87e4be 100644 --- a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java +++ b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java @@ -25,6 +25,7 @@ import com.google.protobuf.ByteString; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.ApiUsageState; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; @@ -41,6 +42,8 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.security.DeviceCredentials; import org.thingsboard.server.common.data.security.DeviceCredentialsType; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; import org.thingsboard.server.common.msg.EncryptionUtil; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgDataType; @@ -53,14 +56,15 @@ import org.thingsboard.server.dao.device.provision.ProvisionFailedException; import org.thingsboard.server.dao.device.provision.ProvisionRequest; import org.thingsboard.server.dao.device.provision.ProvisionResponse; import org.thingsboard.server.dao.relation.RelationService; +import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.dao.tenant.TbTenantProfileCache; -import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos.DeviceInfoProto; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayResponseMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionResponseStatus; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; @@ -77,11 +81,14 @@ import org.thingsboard.server.service.profile.TbDeviceProfileCache; import org.thingsboard.server.service.queue.TbClusterService; import org.thingsboard.server.service.state.DeviceStateService; +import java.util.Collections; +import java.util.List; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; /** * Created by ashvayka on 05.10.18. @@ -104,6 +111,7 @@ public class DefaultTransportApiService implements TransportApiService { private final TbClusterService tbClusterService; private final DataDecodingEncodingService dataDecodingEncodingService; private final DeviceProvisionService deviceProvisionService; + private final ResourceService resourceService; private final ConcurrentMap deviceCreationLocks = new ConcurrentHashMap<>(); @@ -112,7 +120,7 @@ public class DefaultTransportApiService implements TransportApiService { RelationService relationService, DeviceCredentialsService deviceCredentialsService, DeviceStateService deviceStateService, DbCallbackExecutorService dbCallbackExecutorService, TbClusterService tbClusterService, DataDecodingEncodingService dataDecodingEncodingService, - DeviceProvisionService deviceProvisionService) { + DeviceProvisionService deviceProvisionService, ResourceService resourceService) { this.deviceProfileCache = deviceProfileCache; this.tenantProfileCache = tenantProfileCache; this.apiUsageStateService = apiUsageStateService; @@ -124,6 +132,7 @@ public class DefaultTransportApiService implements TransportApiService { this.tbClusterService = tbClusterService; this.dataDecodingEncodingService = dataDecodingEncodingService; this.deviceProvisionService = deviceProvisionService; + this.resourceService = resourceService; } @Override @@ -157,6 +166,9 @@ public class DefaultTransportApiService implements TransportApiService { } else if (transportApiRequestMsg.hasProvisionDeviceRequestMsg()) { return Futures.transform(handle(transportApiRequestMsg.getProvisionDeviceRequestMsg()), value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); + } else if (transportApiRequestMsg.hasResourcesRequestMsg()) { + return Futures.transform(handle(transportApiRequestMsg.getResourcesRequestMsg()), + value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); } return Futures.transform(getEmptyTransportApiResponseFuture(), value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); @@ -315,9 +327,9 @@ public class DefaultTransportApiService implements TransportApiService { return TransportApiResponseMsg.newBuilder().setProvisionDeviceResponseMsg(TransportProtos.ProvisionDeviceResponseMsg.newBuilder().setStatus(status).build()).build(); } TransportProtos.ProvisionDeviceResponseMsg.Builder provisionResponse = TransportProtos.ProvisionDeviceResponseMsg.newBuilder() - .setCredentialsType(TransportProtos.CredentialsType.valueOf(deviceCredentials.getCredentialsType().name())) - .setStatus(status); - switch (deviceCredentials.getCredentialsType()){ + .setCredentialsType(TransportProtos.CredentialsType.valueOf(deviceCredentials.getCredentialsType().name())) + .setStatus(status); + switch (deviceCredentials.getCredentialsType()) { case ACCESS_TOKEN: provisionResponse.setCredentialsValue(deviceCredentials.getCredentialsId()); break; @@ -353,6 +365,38 @@ public class DefaultTransportApiService implements TransportApiService { return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setEntityProfileResponseMsg(builder).build()); } + private ListenableFuture handle(GetResourcesRequestMsg requestMsg) { + TenantId tenantId = new TenantId(new UUID(requestMsg.getTenantIdMSB(), requestMsg.getTenantIdLSB())); + TransportProtos.GetResourcesResponseMsg.Builder builder = TransportProtos.GetResourcesResponseMsg.newBuilder(); + String resourceType = requestMsg.getResourceType(); + String resourceId = requestMsg.getResourceId(); + + List resources; + + if (resourceType != null && resourceId != null) { + resources = Collections.singletonList(toProto( + resourceService.getResource(tenantId, ResourceType.valueOf(resourceType), resourceId))); + } else { + resources = resourceService.findResourcesByTenantId(tenantId) + .stream() + .map(this::toProto) + .collect(Collectors.toList()); + } + + builder.addAllResources(resources); + return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setResourcesResponseMsg(builder).build()); + } + + private TransportProtos.ResourceMsg toProto(Resource resource) { + return TransportProtos.ResourceMsg.newBuilder() + .setTenantIdMSB(resource.getTenantId().getId().getMostSignificantBits()) + .setTenantIdLSB(resource.getTenantId().getId().getLeastSignificantBits()) + .setResourceType(resource.getResourceType().name()) + .setResourceId(resource.getResourceId()) + .setValue(resource.getValue()) + .build(); + } + private ListenableFuture getDeviceInfo(DeviceId deviceId, DeviceCredentials credentials) { return Futures.transform(deviceService.findDeviceByIdAsync(TenantId.SYS_TENANT_ID, deviceId), device -> { if (device == null) { diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java index 99cf1ef87b..03b6976de8 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java @@ -27,7 +27,9 @@ public interface ResourceService { Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); - boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + List findResourcesByTenantId(TenantId tenantId); - List findByTenantId(TenantId tenantId); + void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + void deleteResourcesByTenantId(TenantId tenantId); } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java index 2e12bbdda2..c43f1997da 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java @@ -16,5 +16,5 @@ package org.thingsboard.server.common.data.transport.resource; public enum ResourceType { - LWM2M_MODEL, LWM2M_KEY_STORE + LWM2M_MODEL, JKS, PKCS_12 } diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java b/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java index 3bc4d494f2..638f9f6fb2 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java @@ -21,6 +21,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) -@ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true' ) || ('${service.type:null}'=='monolith' && '${transport.lwm2m.enabled}'=='true')") +@ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true') || ('${service.type:null}'=='monolith' && '${transport.lwm2m.enabled}'=='true')") public @interface TbLwM2mTransportComponent { } diff --git a/common/queue/src/main/proto/queue.proto b/common/queue/src/main/proto/queue.proto index d5f440d808..42f6267d42 100644 --- a/common/queue/src/main/proto/queue.proto +++ b/common/queue/src/main/proto/queue.proto @@ -201,6 +201,25 @@ message LwM2MResponseMsg { LwM2MRegistrationResponseMsg registrationMsg = 1; } +message ResourceMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; + string value = 5; +} + +message GetResourcesRequestMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; +} + +message GetResourcesResponseMsg { + repeated ResourceMsg resources = 1; +} + message ValidateDeviceLwM2MCredentialsRequestMsg { string credentialsId = 1; } @@ -242,6 +261,20 @@ message EntityDeleteMsg { int64 entityIdLSB = 3; } +message ResourceUpdateMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; +} + +message ResourceDeleteMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; +} + message SessionCloseNotificationProto { string message = 1; } @@ -525,6 +558,7 @@ message TransportApiRequestMsg { ValidateBasicMqttCredRequestMsg validateBasicMqttCredRequestMsg = 6; ProvisionDeviceRequestMsg provisionDeviceRequestMsg = 7; ValidateDeviceLwM2MCredentialsRequestMsg validateDeviceLwM2MCredentialsRequestMsg = 8; + GetResourcesRequestMsg resourcesRequestMsg = 9; } /* Response from ThingsBoard Core Service to Transport Service */ @@ -534,6 +568,7 @@ message TransportApiResponseMsg { GetEntityProfileResponseMsg entityProfileResponseMsg = 3; ProvisionDeviceResponseMsg provisionDeviceResponseMsg = 4; LwM2MResponseMsg lwM2MResponseMsg = 6; + GetResourcesResponseMsg resourcesResponseMsg = 7; } /* Messages that are handled by ThingsBoard Core Service */ @@ -578,6 +613,8 @@ message ToTransportMsg { EntityDeleteMsg entityDeleteMsg = 9; ProvisionDeviceResponseMsg provisionResponse = 10; ToTransportUpdateCredentialsProto toTransportUpdateCredentialsNotification = 11; + ResourceUpdateMsg resourceUpdateMsg = 12; + ResourceDeleteMsg resourceDeleteMsg = 13; } message UsageStatsKVProto{ diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java index e642e7f7b2..ab728af00d 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java @@ -25,6 +25,8 @@ import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeRequestM import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.LwM2MRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.LwM2MResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.PostAttributeMsg; @@ -51,6 +53,8 @@ public interface TransportService { GetEntityProfileResponseMsg getEntityProfile(GetEntityProfileRequestMsg msg); + GetResourcesResponseMsg getResources(GetResourcesRequestMsg msg); + void process(DeviceTransportType transportType, ValidateDeviceTokenRequestMsg msg, TransportServiceCallback callback); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java index 473eeea42c..ed02f7016c 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java @@ -254,6 +254,18 @@ public class DefaultTransportService implements TransportService { } } + @Override + public TransportProtos.GetResourcesResponseMsg getResources(TransportProtos.GetResourcesRequestMsg msg) { + TbProtoQueueMsg protoMsg = + new TbProtoQueueMsg<>(UUID.randomUUID(), TransportProtos.TransportApiRequestMsg.newBuilder().setResourcesRequestMsg(msg).build()); + try { + TbProtoQueueMsg response = transportApiRequestTemplate.send(protoMsg).get(); + return response.getValue().getResourcesResponseMsg(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + } + @Override public void process(DeviceTransportType transportType, TransportProtos.ValidateDeviceTokenRequestMsg msg, TransportServiceCallback callback) { @@ -688,6 +700,10 @@ public class DefaultTransportService implements TransportService { } else if (EntityType.DEVICE.equals(entityType)) { rateLimitService.remove(new DeviceId(entityUuid)); } + } else if (toSessionMsg.hasResourceUpdateMsg()) { + //TODO: update resource cache + } else if (toSessionMsg.hasResourceDeleteMsg()) { + //TODO: remove resource from cache } else { //TODO: should we notify the device actor about missed session? log.debug("[{}] Missing session.", sessionId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java index 84ce22eef1..55394c7266 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java @@ -24,6 +24,9 @@ import org.thingsboard.server.dao.exception.DataValidationException; import java.util.List; +import static org.thingsboard.server.dao.device.DeviceServiceImpl.INCORRECT_TENANT_ID; +import static org.thingsboard.server.dao.service.Validator.validateId; + @Service @Slf4j public class BaseResourceService implements ResourceService { @@ -49,18 +52,26 @@ public class BaseResourceService implements ResourceService { } @Override - public boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + public void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { log.trace("Executing deleteResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); validate(tenantId, resourceType, resourceId); - return resourceDao.deleteResource(tenantId, resourceType, resourceId); + resourceDao.deleteResource(tenantId, resourceType, resourceId); } @Override - public List findByTenantId(TenantId tenantId) { + public List findResourcesByTenantId(TenantId tenantId) { log.trace("Executing findByTenantId [{}]", tenantId); + validateId(tenantId, INCORRECT_TENANT_ID + tenantId); return resourceDao.findAllByTenantId(tenantId); } + @Override + public void deleteResourcesByTenantId(TenantId tenantId) { + log.trace("Executing deleteDevicesByTenantId, tenantId [{}]", tenantId); + validateId(tenantId, INCORRECT_TENANT_ID + tenantId); + resourceDao.removeAllByTenantId(tenantId); + } + protected void validate(Resource resource) { if (resource == null) { throw new DataValidationException("Resource should be specified!"); @@ -79,12 +90,7 @@ public class BaseResourceService implements ResourceService { if (resourceId == null) { throw new DataValidationException("Resource id should be specified!"); } - validate(tenantId); + validateId(tenantId, "Incorrect tenantId "); } - protected void validate(TenantId tenantId) { - if (tenantId == null) { - throw new DataValidationException("Tenant id should be specified!"); - } - } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java index f722423412..a053bc0c74 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java @@ -27,7 +27,9 @@ public interface ResourceDao { Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); - boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); List findAllByTenantId(TenantId tenantId); + + void removeAllByTenantId(TenantId tenantId); } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java index b11c14546a..0cf9fce980 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java @@ -56,18 +56,22 @@ public class ResourceDaoImpl implements ResourceDao { @Override @Transactional - public boolean deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + public void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { ResourceCompositeKey key = new ResourceCompositeKey(); key.setTenantId(tenantId.getId()); key.setResourceType(resourceType.name()); key.setResourceId(resourceId); resourceRepository.deleteById(key); - return resourceRepository.existsById(key); } @Override public List findAllByTenantId(TenantId tenantId) { - return DaoUtil.convertDataList(resourceRepository.findAllByTenantId(tenantId)); + return DaoUtil.convertDataList(resourceRepository.findAllByTenantId(tenantId.getId())); + } + + @Override + public void removeAllByTenantId(TenantId tenantId) { + resourceRepository.removeAllByTenantId(tenantId.getId()); } } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java index d2d92b8b55..65927ce26e 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java @@ -21,8 +21,11 @@ import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; import org.thingsboard.server.dao.model.sql.ResourceEntity; import java.util.List; +import java.util.UUID; public interface ResourceRepository extends CrudRepository { - List findAllByTenantId(TenantId tenantId); + List findAllByTenantId(UUID tenantId); + + void removeAllByTenantId(UUID tenantId); } From 616839a23c4accfe6a5e122213fa21d672148f96 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Fri, 5 Mar 2021 18:05:47 +0200 Subject: [PATCH 59/69] refactoring --- .../thingsboard/server/service/lwm2m/LwM2MModelsRepository.java | 1 - .../server/common/transport/service/DefaultTransportService.java | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java index 3db41fff8b..ddadc6c95c 100644 --- a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java +++ b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java @@ -62,7 +62,6 @@ import static org.thingsboard.server.dao.service.Validator.validateId; @Slf4j @Service -@TbLwM2mTransportComponent @ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true') || '${service.type:null}'=='monolith' || '${service.type:null}'=='tb-core'") public class LwM2MModelsRepository { diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java index ed02f7016c..b273ee48cf 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java @@ -711,6 +711,7 @@ public class DefaultTransportService implements TransportService { } } + public void onProfileUpdate(DeviceProfile deviceProfile) { long deviceProfileIdMSB = deviceProfile.getId().getId().getMostSignificantBits(); long deviceProfileIdLSB = deviceProfile.getId().getId().getLeastSignificantBits(); From c78bd55df5c866125b156d1841fc58dd41262f69 Mon Sep 17 00:00:00 2001 From: YevhenBondarenko Date: Fri, 5 Mar 2021 19:10:44 +0200 Subject: [PATCH 60/69] added resource table to hsql schema --- .../thingsboard/server/dao/tenant/TenantServiceImpl.java | 5 +++++ dao/src/main/resources/sql/schema-entities-hsql.sql | 8 ++++++++ dao/src/test/resources/sql/hsql/drop-all-tables.sql | 1 + dao/src/test/resources/sql/psql/drop-all-tables.sql | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java index 12fdd3a57a..3016474f27 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java @@ -35,6 +35,7 @@ import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.dao.entity.AbstractEntityService; import org.thingsboard.server.dao.entityview.EntityViewService; import org.thingsboard.server.dao.exception.DataValidationException; +import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.dao.rule.RuleChainService; import org.thingsboard.server.dao.service.DataValidator; import org.thingsboard.server.dao.service.PaginatedRemover; @@ -88,6 +89,9 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe @Autowired private RuleChainService ruleChainService; + @Autowired + private ResourceService resourceService; + @Override public Tenant findTenantById(TenantId tenantId) { log.trace("Executing findTenantById [{}]", tenantId); @@ -140,6 +144,7 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe userService.deleteTenantAdmins(tenantId); ruleChainService.deleteRuleChainsByTenantId(tenantId); apiUsageStateService.deleteApiUsageStateByTenantId(tenantId); + resourceService.deleteResourcesByTenantId(tenantId); tenantDao.removeById(tenantId, tenantId.getId()); deleteEntityRelations(tenantId, tenantId); } diff --git a/dao/src/main/resources/sql/schema-entities-hsql.sql b/dao/src/main/resources/sql/schema-entities-hsql.sql index ee658f8da4..787f457c6a 100644 --- a/dao/src/main/resources/sql/schema-entities-hsql.sql +++ b/dao/src/main/resources/sql/schema-entities-hsql.sql @@ -420,3 +420,11 @@ CREATE TABLE IF NOT EXISTS api_usage_state ( sms_exec varchar(32), CONSTRAINT api_usage_state_unq_key UNIQUE (tenant_id, entity_id) ); + +CREATE TABLE IF NOT EXISTS resource ( + tenant_id uuid NOT NULL, + resource_type varchar(32) NOT NULL, + resource_id varchar(255) NOT NULL, + resource_value varchar, + CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id) +); diff --git a/dao/src/test/resources/sql/hsql/drop-all-tables.sql b/dao/src/test/resources/sql/hsql/drop-all-tables.sql index b5629b0560..a548ceec30 100644 --- a/dao/src/test/resources/sql/hsql/drop-all-tables.sql +++ b/dao/src/test/resources/sql/hsql/drop-all-tables.sql @@ -28,4 +28,5 @@ DROP TABLE IF EXISTS oauth2_client_registration; DROP TABLE IF EXISTS oauth2_client_registration_info; DROP TABLE IF EXISTS oauth2_client_registration_template; DROP TABLE IF EXISTS api_usage_state; +DROP TABLE IF EXISTS resource; DROP FUNCTION IF EXISTS to_uuid; diff --git a/dao/src/test/resources/sql/psql/drop-all-tables.sql b/dao/src/test/resources/sql/psql/drop-all-tables.sql index 34985883d7..333ce03fba 100644 --- a/dao/src/test/resources/sql/psql/drop-all-tables.sql +++ b/dao/src/test/resources/sql/psql/drop-all-tables.sql @@ -28,4 +28,5 @@ DROP TABLE IF EXISTS tb_schema_settings; DROP TABLE IF EXISTS oauth2_client_registration; DROP TABLE IF EXISTS oauth2_client_registration_info; DROP TABLE IF EXISTS oauth2_client_registration_template; -DROP TABLE IF EXISTS api_usage_state; \ No newline at end of file +DROP TABLE IF EXISTS api_usage_state; +DROP TABLE IF EXISTS resource; From 65f4ca58001a3a71fdf7a654b53cd47122f1d44c Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Mon, 8 Mar 2021 00:00:44 +0200 Subject: [PATCH 61/69] Lwm2m: back: add tenantId and repositoryTenant - test --- .../install/SqlDatabaseUpgradeService.java | 1 + .../service/lwm2m/LwM2MModelsRepository.java | 5 +- ...TransportBootstrapServerConfiguration.java | 2 +- .../lwm2m/server/LwM2mTransportHandler.java | 5 +- .../LwM2mTransportServerConfiguration.java | 8 +- .../server/LwM2mTransportServiceImpl.java | 2 + .../server/LwM2mVersionedModelProvider.java | 98 +++++++++++++++++++ .../server/client/LwM2mClientProfile.java | 12 ++- .../lwm2m/utils/LwM2mValueConverterImpl.java | 9 +- .../lwm2m/LwM2MTransportConfigServer.java | 18 ++-- 10 files changed, 140 insertions(+), 20 deletions(-) create mode 100644 common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java diff --git a/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java b/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java index a56cc7ca25..2525ebd186 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java @@ -447,6 +447,7 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService " );"); conn.createStatement().execute("UPDATE tb_schema_settings SET schema_version = 3003000;"); + installScripts.loadSystemLwm2mResources(); } catch (Exception e) { log.error("Failed updating schema!!!", e); } diff --git a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java index ddadc6c95c..228562a039 100644 --- a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java +++ b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java @@ -33,7 +33,6 @@ import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigBootstrap; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigServer; import org.thingsboard.server.dao.service.Validator; -import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode; import java.math.BigInteger; @@ -102,8 +101,8 @@ public class LwM2MModelsRepository { */ private List getLwm2mObjects(Predicate predicate, String sortProperty, String sortOrder) { List lwM2mObjects = new ArrayList<>(); - List listObjects = (predicate == null) ? this.contextServer.getModelsValue() : - contextServer.getModelsValue().stream() + List listObjects = (predicate == null) ? this.contextServer.getModelsValueCommon() : + contextServer.getModelsValueCommon().stream() .filter(predicate) .collect(Collectors.toList()); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java index 757b91956b..59e1087f21 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java @@ -94,7 +94,7 @@ public class LwM2MTransportBootstrapServerConfiguration { builder.setCoapConfig(getCoapConfig(bootstrapPortNoSec, bootstrapSecurePort)); /** Define model provider (Create Models )*/ - builder.setModel(new StaticModel(contextS.getLwM2MTransportConfigServer().getModelsValue())); + builder.setModel(new StaticModel(contextS.getLwM2MTransportConfigServer().getModelsValueCommon())); /** Create credentials */ this.setServerWithCredentials(builder); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java index a62bdf2a49..9b99403c7c 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java @@ -188,8 +188,9 @@ public class LwM2mTransportHandler { return null; } - public static LwM2mClientProfile getNewProfileParameters(JsonObject profilesConfigData) { + public static LwM2mClientProfile getNewProfileParameters(JsonObject profilesConfigData, String tenantId) { LwM2mClientProfile lwM2MClientProfile = new LwM2mClientProfile(); + lwM2MClientProfile.setTenantId(tenantId); lwM2MClientProfile.setPostClientLwM2mSettings(profilesConfigData.get(CLIENT_LWM2M_SETTINGS).getAsJsonObject()); lwM2MClientProfile.setPostKeyNameProfile(profilesConfigData.get(OBSERVE_ATTRIBUTE_TELEMETRY).getAsJsonObject().get(KEY_NAME).getAsJsonObject()); lwM2MClientProfile.setPostAttributeProfile(profilesConfigData.get(OBSERVE_ATTRIBUTE_TELEMETRY).getAsJsonObject().get(ATTRIBUTE).getAsJsonArray()); @@ -221,7 +222,7 @@ public class LwM2mTransportHandler { ObjectMapper mapper = new ObjectMapper(); String profileStr = mapper.writeValueAsString(profile); JsonObject profileJson = (profileStr != null) ? validateJson(profileStr) : null; - return (getValidateCredentialsBodyFromThingsboard(profileJson)) ? LwM2mTransportHandler.getNewProfileParameters(profileJson) : null; + return (getValidateCredentialsBodyFromThingsboard(profileJson)) ? LwM2mTransportHandler.getNewProfileParameters(profileJson, deviceProfile.getTenantId().getId().toString()) : null; } catch (IOException e) { log.error("", e); } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java index ace2fb4896..5c4b0af2d0 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java @@ -24,7 +24,6 @@ import org.eclipse.leshan.server.californium.LeshanServer; import org.eclipse.leshan.server.californium.LeshanServerBuilder; import org.eclipse.leshan.server.californium.registration.CaliforniumRegistrationStore; import org.eclipse.leshan.server.model.LwM2mModelProvider; -import org.eclipse.leshan.server.model.VersionedModelProvider; import org.eclipse.leshan.server.security.DefaultAuthorizer; import org.eclipse.leshan.server.security.EditableSecurityStore; import org.eclipse.leshan.server.security.SecurityChecker; @@ -32,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; +import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext; import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl; import java.math.BigInteger; @@ -77,6 +77,9 @@ public class LwM2mTransportServerConfiguration { @Autowired private EditableSecurityStore securityStore; + @Autowired + private LwM2mClientContext lwM2mClientContext;; + @Bean public LeshanServer getLeshanServer() { log.info("Starting LwM2M transport Server... PostConstruct"); @@ -95,7 +98,8 @@ public class LwM2mTransportServerConfiguration { builder.setCoapConfig(getCoapConfig(serverPortNoSec, serverSecurePort)); /** Define model provider (Create Models )*/ - LwM2mModelProvider modelProvider = new VersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValue()); +// LwM2mModelProvider modelProvider = new VersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueCommon()); + LwM2mModelProvider modelProvider = new LwM2mVersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueServer(), this.lwM2mClientContext); builder.setObjectModelProvider(modelProvider); /** Create credentials */ diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java index 548d750a3f..43bd9d8022 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java @@ -153,6 +153,8 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { executorRegistered.submit(() -> { try { log.warn("[{}] [{{}] Client: create after Registration", registration.getEndpoint(), registration.getId()); + ((LwM2mVersionedModelProvider)leshanServer.getModelProvider()).setRepository(this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getModelsValueCommon()); +// (((VersionedModelProvider) (leshanServer)).modelProvider).repository; LwM2mClient lwM2MClient = this.lwM2mClientContext.updateInSessionsLwM2MClient(registration); if (lwM2MClient != null) { SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java new file mode 100644 index 0000000000..b426b8fa93 --- /dev/null +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java @@ -0,0 +1,98 @@ +package org.thingsboard.server.transport.lwm2m.server; + +import org.eclipse.leshan.core.model.LwM2mModel; +import org.eclipse.leshan.core.model.LwM2mModelRepository; +import org.eclipse.leshan.core.model.ObjectModel; +import org.eclipse.leshan.core.model.ResourceModel; +import org.eclipse.leshan.server.model.LwM2mModelProvider; +import org.eclipse.leshan.server.registration.Registration; +import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class LwM2mVersionedModelProvider implements LwM2mModelProvider { + + private LwM2mModelRepository repository; + private Map repositoriesTenant; + private LwM2mClientContext lwM2mClientContext; + + public LwM2mVersionedModelProvider(Collection objectModels, LwM2mClientContext lwM2mClientContext) { + this.repository = new LwM2mModelRepository(objectModels); + this.lwM2mClientContext = lwM2mClientContext; + this.repositoriesTenant = new ConcurrentHashMap<>(); + } + + public LwM2mVersionedModelProvider(LwM2mModelRepository repository, LwM2mClientContext lwM2mClientContext) { + this.repository = repository; + this.lwM2mClientContext = lwM2mClientContext; + this.repositoriesTenant = new ConcurrentHashMap<>(); + } + + public void setRepositoriesTenant (String tenantID, LwM2mModelRepository repositoryTenant) { + this.repositoriesTenant.put(tenantID, repositoryTenant); + } + + public LwM2mModelRepository getRepositoriesTenant (String tenantID) { + return this.repositoriesTenant.get(tenantID); + } + + public void setRepository (Collection objectModels) { + this.repository = new LwM2mModelRepository(objectModels); + } + + public LwM2mModelRepository getRepositoriesCommonTenant (String tenantID) { + LwM2mModelRepository repository = new LwM2mModelRepository(); + + return repository; + } + + @Override + public LwM2mModel getObjectModel(Registration registration) { + return new DynamicModel(registration, this.lwM2mClientContext.getProfile(registration).getTenantId()); + } + + private class DynamicModel implements LwM2mModel { + + private final Registration registration; + private final String tenantId; + + public DynamicModel(Registration registration, String tenantId) { + this.registration = registration; + this.tenantId = tenantId; + } + + @Override + public ResourceModel getResourceModel(int objectId, int resourceId) { + ObjectModel objectModel = getObjectModel(objectId); + if (objectModel != null) + return objectModel.resources.get(resourceId); + else + return null; + } + + @Override + public ObjectModel getObjectModel(int objectId) { + String version = registration.getSupportedVersion(objectId); + if (version != null) { + return repository.getObjectModel(objectId, version); + } + return null; + } + + @Override + public Collection getObjectModels() { + Map supportedObjects = registration.getSupportedObject(); + Collection result = new ArrayList<>(supportedObjects.size()); + for (Map.Entry supportedObject : supportedObjects.entrySet()) { + ObjectModel objectModel = repository.getObjectModel(supportedObject.getKey(), + supportedObject.getValue()); + if (objectModel != null) + result.add(objectModel); + } + return result; + } + } +} diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java index 810ea253a7..1e2df43b5d 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java @@ -22,12 +22,14 @@ import lombok.Data; @Data public class LwM2mClientProfile { + + private String tenantId; /** * {"clientLwM2mSettings": { * clientUpdateValueAfterConnect: false; * } **/ - JsonObject postClientLwM2mSettings; + private JsonObject postClientLwM2mSettings; /** * {"keyName": { @@ -36,22 +38,22 @@ public class LwM2mClientProfile { * "/3/0/2": "serialNumber" * } **/ - JsonObject postKeyNameProfile; + private JsonObject postKeyNameProfile; /** * [ "/2/0/0", "/2/0/1"] */ - JsonArray postAttributeProfile; + private JsonArray postAttributeProfile; /** * [ "/2/0/0", "/2/0/1"] */ - JsonArray postTelemetryProfile; + private JsonArray postTelemetryProfile; /** * [ "/2/0/0", "/2/0/1"] */ - JsonArray postObserveProfile; + private JsonArray postObserveProfile; public LwM2mClientProfile clone() { LwM2mClientProfile lwM2mClientProfile = new LwM2mClientProfile(); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java index 67ce459d9b..136de3eb95 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java @@ -26,6 +26,7 @@ import org.eclipse.leshan.core.util.StringUtils; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; +import java.math.BigInteger; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -130,7 +131,13 @@ public class LwM2mValueConverterImpl implements LwM2mValueConverter { return String.valueOf(value); case TIME: String DATE_FORMAT = "MMM d, yyyy HH:mm a"; - Long timeValue = ((Date) value).getTime(); + Long timeValue; + try { + timeValue = ((Date) value).getTime(); + } + catch (Exception e){ + timeValue = new BigInteger((byte [])value).longValue(); + } DateFormat formatter = new SimpleDateFormat(DATE_FORMAT); return formatter.format(new Date(timeValue)); default: diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java index 810848a5ca..4f3e0a8c9c 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java @@ -84,7 +84,11 @@ public class LwM2MTransportConfigServer { @Getter @Setter - private List modelsValue; + private List modelsValueCommon; + + @Getter + @Setter + private List modelsValueServer; @Getter @Value("${transport.lwm2m.timeout:}") @@ -188,11 +192,13 @@ public class LwM2MTransportConfigServer { @PostConstruct public void init() { - modelsValue = ObjectLoader.loadDefault(); + modelsValueServer = ObjectLoader.loadDefault(); + modelsValueServer.remove(3); + modelsValueCommon = ObjectLoader.loadDefault(); File path = getPathModels(); if (path.isDirectory()) { try { - modelsValue.addAll(ObjectLoader.loadObjectsFromDir(path)); + modelsValueCommon.addAll(ObjectLoader.loadObjectsFromDir(path)); log.info(" [{}] Models directory is a directory", path.getAbsoluteFile()); } catch (Exception e) { log.error(" [{}] Could not parse the resource definition file", e.toString()); @@ -255,9 +261,9 @@ public class LwM2MTransportConfigServer { public ResourceModel getResourceModel(Registration registration, LwM2mPath pathIds) { String pathLink = "/" + pathIds.getObjectId() + "/" + pathIds.getObjectInstanceId(); return (Arrays.stream(registration.getObjectLinks()).filter(p-> p.getUrl().equals(pathLink)).findFirst().isPresent() && - this.modelsValue.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).size() > 0) && - this.modelsValue.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0).resources.containsKey(pathIds.getResourceId()) ? - this.modelsValue.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0).resources.get(pathIds.getResourceId()) : + this.modelsValueCommon.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).size() > 0) && + this.modelsValueCommon.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0).resources.containsKey(pathIds.getResourceId()) ? + this.modelsValueCommon.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0).resources.get(pathIds.getResourceId()) : null; } From 447bf05b7b9bd3e3d37bc53d42780b613d3a4ea9 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Mon, 8 Mar 2021 19:24:33 +0200 Subject: [PATCH 62/69] Lwm2m: back: add tenantId and repositoryTenant - test2 --- .../server/controller/ResourceController.java | 12 +++++ .../transport/DefaultTransportApiService.java | 7 ++- .../server/dao/resource/ResourceService.java | 2 + .../server/LwM2mTransportContextServer.java | 44 ++++++++++++++++--- .../lwm2m/server/LwM2mTransportHandler.java | 5 ++- .../lwm2m/server/LwM2mTransportRequest.java | 10 +++-- .../LwM2mTransportServerConfiguration.java | 4 ++ .../server/LwM2mVersionedModelProvider.java | 20 ++++++++- .../server/client/LwM2mClientContextImpl.java | 3 +- .../server/client/LwM2mClientProfile.java | 4 +- .../lwm2m/LwM2MTransportConfigServer.java | 4 +- .../dao/resource/BaseResourceService.java | 7 +++ .../server/dao/resource/ResourceDao.java | 2 + .../dao/sql/resource/ResourceDaoImpl.java | 5 +++ .../dao/sql/resource/ResourceRepository.java | 3 +- 15 files changed, 113 insertions(+), 19 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java index babe444ae7..b1c709a811 100644 --- a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java +++ b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java @@ -69,6 +69,18 @@ public class ResourceController extends BaseController { } } + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource/{resourceType}", method = RequestMethod.GET) + @ResponseBody + public List getResources(@RequestParam(required = false) boolean system, + @PathVariable("resourceType") ResourceType resourceType) throws ThingsboardException { + try { + return checkNotNull(resourceService.findResourcesByTenantIdResourceType(system ? TenantId.SYS_TENANT_ID : getTenantId(), resourceType)); + } catch (Exception e) { + throw handleException(e); + } + } + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") @RequestMapping(value = "/resource/{resourceType}/{resourceId}", method = RequestMethod.DELETE) @ResponseBody diff --git a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java index ef6d87e4be..21a96c1bf9 100644 --- a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java +++ b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java @@ -373,9 +373,14 @@ public class DefaultTransportApiService implements TransportApiService { List resources; - if (resourceType != null && resourceId != null) { + if (resourceType != null && resourceId != null && !resourceId.isEmpty()) { resources = Collections.singletonList(toProto( resourceService.getResource(tenantId, ResourceType.valueOf(resourceType), resourceId))); + } else if (resourceType != null && !resourceType.isEmpty()) { + resources = resourceService.findResourcesByTenantIdResourceType(tenantId, ResourceType.valueOf(resourceType)) + .stream() + .map(this::toProto) + .collect(Collectors.toList()); } else { resources = resourceService.findResourcesByTenantId(tenantId) .stream() diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java index 03b6976de8..e88b276d1c 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java @@ -29,6 +29,8 @@ public interface ResourceService { List findResourcesByTenantId(TenantId tenantId); + List findResourcesByTenantIdResourceType(TenantId tenantId, ResourceType resourceType); + void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); void deleteResourcesByTenantId(TenantId tenantId); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java index 062c0f1148..3dd73ae620 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java @@ -34,16 +34,25 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.eclipse.leshan.core.model.ObjectModel; import org.springframework.stereotype.Component; import org.thingsboard.server.common.transport.TransportContext; import org.thingsboard.server.common.transport.TransportService; import org.thingsboard.server.common.transport.TransportServiceCallback; import org.thingsboard.server.common.transport.adaptor.AdaptorException; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigServer; -import org.thingsboard.server.gen.transport.TransportProtos; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesResponseMsg; +import org.thingsboard.server.gen.transport.TransportProtos.PostAttributeMsg; +import org.thingsboard.server.gen.transport.TransportProtos.PostTelemetryMsg; +import org.thingsboard.server.gen.transport.TransportProtos.SessionInfoProto; +import org.thingsboard.server.gen.transport.TransportProtos.ValidateDeviceCredentialsResponseMsg; import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.server.adaptors.LwM2MJsonAdaptor; +import java.util.List; +import java.util.UUID; + import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportHandler.LOG_LW2M_TELEMETRY; @Slf4j @@ -56,6 +65,8 @@ public class LwM2mTransportContextServer extends TransportContext { private final TransportService transportService; + private List modelsValueServer; + @Getter private final LwM2MJsonAdaptor adaptor; @@ -89,14 +100,14 @@ public class LwM2mTransportContextServer extends TransportContext { }; } - public void sentParametersOnThingsboard(JsonElement msg, String topicName, TransportProtos.SessionInfoProto sessionInfo) { + public void sentParametersOnThingsboard(JsonElement msg, String topicName, SessionInfoProto sessionInfo) { try { if (topicName.equals(LwM2mTransportHandler.DEVICE_ATTRIBUTES_TOPIC)) { - TransportProtos.PostAttributeMsg postAttributeMsg = adaptor.convertToPostAttributes(msg); + PostAttributeMsg postAttributeMsg = adaptor.convertToPostAttributes(msg); TransportServiceCallback call = this.getPubAckCallbackSentAttrTelemetry(postAttributeMsg); transportService.process(sessionInfo, postAttributeMsg, this.getPubAckCallbackSentAttrTelemetry(call)); } else if (topicName.equals(LwM2mTransportHandler.DEVICE_TELEMETRY_TOPIC)) { - TransportProtos.PostTelemetryMsg postTelemetryMsg = adaptor.convertToPostTelemetry(msg); + PostTelemetryMsg postTelemetryMsg = adaptor.convertToPostTelemetry(msg); TransportServiceCallback call = this.getPubAckCallbackSentAttrTelemetry(postTelemetryMsg); transportService.process(sessionInfo, postTelemetryMsg, this.getPubAckCallbackSentAttrTelemetry(call)); } @@ -115,8 +126,8 @@ public class LwM2mTransportContextServer extends TransportContext { /** * @return - sessionInfo after access connect client */ - public TransportProtos.SessionInfoProto getValidateSessionInfo(TransportProtos.ValidateDeviceCredentialsResponseMsg msg, long mostSignificantBits, long leastSignificantBits) { - return TransportProtos.SessionInfoProto.newBuilder() + public SessionInfoProto getValidateSessionInfo(ValidateDeviceCredentialsResponseMsg msg, long mostSignificantBits, long leastSignificantBits) { + return SessionInfoProto.newBuilder() .setNodeId(this.getNodeId()) .setSessionIdMSB(mostSignificantBits) .setSessionIdLSB(leastSignificantBits) @@ -131,4 +142,25 @@ public class LwM2mTransportContextServer extends TransportContext { .build(); } + + + + /** + * ResourcesRequestMsg + * + * @param resourceType + * @return + */ + public GetResourcesResponseMsg getResourceTenant (UUID tenantId, String resourceType) { + + GetResourcesResponseMsg responseMsg = + this.getTransportService() + .getResources(GetResourcesRequestMsg.newBuilder() + .setResourceType(resourceType) + .setTenantIdLSB(tenantId.getLeastSignificantBits()) + .setTenantIdMSB(tenantId.getMostSignificantBits()) + .build()); + return responseMsg; + } + } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java index 9b99403c7c..150fe9b5d0 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java @@ -45,6 +45,7 @@ import java.util.Arrays; import java.util.Date; import java.util.LinkedList; import java.util.Optional; +import java.util.UUID; @Slf4j //@Component("LwM2MTransportHandler") @@ -188,7 +189,7 @@ public class LwM2mTransportHandler { return null; } - public static LwM2mClientProfile getNewProfileParameters(JsonObject profilesConfigData, String tenantId) { + public static LwM2mClientProfile getNewProfileParameters(JsonObject profilesConfigData, UUID tenantId) { LwM2mClientProfile lwM2MClientProfile = new LwM2mClientProfile(); lwM2MClientProfile.setTenantId(tenantId); lwM2MClientProfile.setPostClientLwM2mSettings(profilesConfigData.get(CLIENT_LWM2M_SETTINGS).getAsJsonObject()); @@ -222,7 +223,7 @@ public class LwM2mTransportHandler { ObjectMapper mapper = new ObjectMapper(); String profileStr = mapper.writeValueAsString(profile); JsonObject profileJson = (profileStr != null) ? validateJson(profileStr) : null; - return (getValidateCredentialsBodyFromThingsboard(profileJson)) ? LwM2mTransportHandler.getNewProfileParameters(profileJson, deviceProfile.getTenantId().getId().toString()) : null; + return (getValidateCredentialsBodyFromThingsboard(profileJson)) ? LwM2mTransportHandler.getNewProfileParameters(profileJson, deviceProfile.getTenantId().getId()) : null; } catch (IOException e) { log.error("", e); } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java index b05c79d6db..fc14b9c080 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java @@ -47,7 +47,6 @@ import org.eclipse.leshan.core.util.Hex; import org.eclipse.leshan.core.util.NamedThreadFactory; import org.eclipse.leshan.server.californium.LeshanServer; import org.eclipse.leshan.server.registration.Registration; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClient; @@ -88,13 +87,16 @@ public class LwM2mTransportRequest { private final LeshanServer leshanServer; - @Autowired - private LwM2mTransportServiceImpl serviceImpl; +// @Autowired +// private LwM2mTransportServiceImpl serviceImpl; - public LwM2mTransportRequest(LwM2mTransportContextServer context, LwM2mClientContext lwM2mClientContext, LeshanServer leshanServer) { + private final LwM2mTransportServiceImpl serviceImpl; + + public LwM2mTransportRequest(LwM2mTransportContextServer context, LwM2mClientContext lwM2mClientContext, LeshanServer leshanServer, LwM2mTransportServiceImpl serviceImpl) { this.context = context; this.lwM2mClientContext = lwM2mClientContext; this.leshanServer = leshanServer; + this.serviceImpl = serviceImpl; } @PostConstruct diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java index 5c4b0af2d0..56cf6b5c2e 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java @@ -30,6 +30,9 @@ import org.eclipse.leshan.server.security.SecurityChecker; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext; import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl; @@ -98,6 +101,7 @@ public class LwM2mTransportServerConfiguration { builder.setCoapConfig(getCoapConfig(serverPortNoSec, serverSecurePort)); /** Define model provider (Create Models )*/ + TransportProtos.GetResourcesResponseMsg responseMsg= this.context.getResourceTenant(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); // LwM2mModelProvider modelProvider = new VersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueCommon()); LwM2mModelProvider modelProvider = new LwM2mVersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueServer(), this.lwM2mClientContext); builder.setObjectModelProvider(modelProvider); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java index b426b8fa93..64e9f67199 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java @@ -1,3 +1,18 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.thingsboard.server.transport.lwm2m.server; import org.eclipse.leshan.core.model.LwM2mModel; @@ -11,6 +26,7 @@ import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext; import java.util.ArrayList; import java.util.Collection; import java.util.Map; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; public class LwM2mVersionedModelProvider implements LwM2mModelProvider { @@ -57,9 +73,9 @@ public class LwM2mVersionedModelProvider implements LwM2mModelProvider { private class DynamicModel implements LwM2mModel { private final Registration registration; - private final String tenantId; + private final UUID tenantId; - public DynamicModel(Registration registration, String tenantId) { + public DynamicModel(Registration registration, UUID tenantId) { this.registration = registration; this.tenantId = tenantId; } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java index b965c99611..b41e7cfdaa 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java @@ -15,7 +15,6 @@ */ package org.thingsboard.server.transport.lwm2m.server.client; -import lombok.extern.slf4j.Slf4j; import org.eclipse.leshan.server.registration.Registration; import org.eclipse.leshan.server.security.EditableSecurityStore; import org.springframework.stereotype.Service; @@ -105,6 +104,7 @@ public class LwM2mClientContextImpl implements LwM2mClientContext { /** * Add new LwM2MClient to session + * * @param identity- * @return SecurityInfo. If error - SecurityInfoError * and log: @@ -168,4 +168,5 @@ public class LwM2mClientContextImpl implements LwM2mClientContext { } return false; } + } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java index 1e2df43b5d..dcda2cc62b 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java @@ -20,10 +20,12 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import lombok.Data; +import java.util.UUID; + @Data public class LwM2mClientProfile { - private String tenantId; + private UUID tenantId; /** * {"clientLwM2mSettings": { * clientUpdateValueAfterConnect: false; diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java index 4f3e0a8c9c..4e57e61190 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java @@ -47,7 +47,6 @@ import java.util.stream.Collectors; @ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true') || '${service.type:null}'=='monolith' || '${service.type:null}'=='tb-core'") public class LwM2MTransportConfigServer { - @Getter private String MODEL_PATH_DEFAULT = "models"; @@ -190,6 +189,8 @@ public class LwM2MTransportConfigServer { @Value("${transport.lwm2m.server.secure.alias:}") private String serverAlias; + + @PostConstruct public void init() { modelsValueServer = ObjectLoader.loadDefault(); @@ -276,4 +277,5 @@ public class LwM2MTransportConfigServer { ResourceModel resource = this.getResourceModel(registration, pathIds); return (resource == null) ? ResourceModel.Operations.NONE : resource.operations; } + } diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java index 55394c7266..c33c1b1b7e 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java @@ -65,6 +65,13 @@ public class BaseResourceService implements ResourceService { return resourceDao.findAllByTenantId(tenantId); } + @Override + public List findResourcesByTenantIdResourceType(TenantId tenantId, ResourceType resourceType) { + log.trace("Executing findByTenantId [{}]", tenantId); + validateId(tenantId, INCORRECT_TENANT_ID + tenantId); + return resourceDao.findAllByTenantIdResourceType(tenantId, resourceType); + } + @Override public void deleteResourcesByTenantId(TenantId tenantId) { log.trace("Executing deleteDevicesByTenantId, tenantId [{}]", tenantId); diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java index a053bc0c74..defca18533 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java @@ -31,5 +31,7 @@ public interface ResourceDao { List findAllByTenantId(TenantId tenantId); + List findAllByTenantIdResourceType(TenantId tenantId, ResourceType resourceType); + void removeAllByTenantId(TenantId tenantId); } diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java index 0cf9fce980..e1137562da 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java @@ -70,6 +70,11 @@ public class ResourceDaoImpl implements ResourceDao { return DaoUtil.convertDataList(resourceRepository.findAllByTenantId(tenantId.getId())); } + @Override + public List findAllByTenantIdResourceType(TenantId tenantId, ResourceType resourceType) { + return DaoUtil.convertDataList(resourceRepository.findAllByTenantIdAndResourceType(tenantId.getId(), resourceType.name())); + } + @Override public void removeAllByTenantId(TenantId tenantId) { resourceRepository.removeAllByTenantId(tenantId.getId()); diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java index 65927ce26e..49cc71b972 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java @@ -16,7 +16,6 @@ package org.thingsboard.server.dao.sql.resource; import org.springframework.data.repository.CrudRepository; -import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; import org.thingsboard.server.dao.model.sql.ResourceEntity; @@ -27,5 +26,7 @@ public interface ResourceRepository extends CrudRepository findAllByTenantId(UUID tenantId); + List findAllByTenantIdAndResourceType(UUID tenantId, String resourceType); + void removeAllByTenantId(UUID tenantId); } From d8ea6ac37d568bb31be72fa4115e15e1691d2789 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Tue, 9 Mar 2021 11:08:51 +0200 Subject: [PATCH 63/69] Lwm2m: back: add tenantId and repositoryTenant - test3 --- .../server/LwM2mTransportContextServer.java | 38 ++++++++++++++++++- .../LwM2mTransportServerConfiguration.java | 3 +- .../server/LwM2mTransportServiceImpl.java | 7 +++- .../common/transport/TransportService.java | 5 ++- .../service/DefaultTransportService.java | 12 +++++- 5 files changed, 59 insertions(+), 6 deletions(-) diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java index 3dd73ae620..bc7737aebb 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java @@ -52,6 +52,8 @@ import org.thingsboard.server.transport.lwm2m.server.adaptors.LwM2MJsonAdaptor; import java.util.List; import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportHandler.LOG_LW2M_TELEMETRY; @@ -152,7 +154,7 @@ public class LwM2mTransportContextServer extends TransportContext { * @return */ public GetResourcesResponseMsg getResourceTenant (UUID tenantId, String resourceType) { - + CountDownLatch latch = new CountDownLatch(1); GetResourcesResponseMsg responseMsg = this.getTransportService() .getResources(GetResourcesRequestMsg.newBuilder() @@ -160,7 +162,41 @@ public class LwM2mTransportContextServer extends TransportContext { .setTenantIdLSB(tenantId.getLeastSignificantBits()) .setTenantIdMSB(tenantId.getMostSignificantBits()) .build()); + latch.countDown(); + try { + latch.await(this.getLwM2MTransportConfigServer().getTimeout(), TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + log.error("Failed to await credentials!", e); + } + return responseMsg; } + public GetResourcesResponseMsg getResourceTenantProcess (UUID tenantId, String resourceType) { + CountDownLatch latch = new CountDownLatch(2); + final GetResourcesResponseMsg[] responseMsg = {null}; + this.getTransportService().process(GetResourcesRequestMsg.newBuilder() + .setResourceType(resourceType) + .setTenantIdLSB(tenantId.getLeastSignificantBits()) + .setTenantIdMSB(tenantId.getMostSignificantBits()) + .build(), + new TransportServiceCallback<>() { + @Override + public void onSuccess(GetResourcesResponseMsg msg) { responseMsg[0] = msg; + latch.countDown(); + } + + @Override + public void onError(Throwable e) { + log.trace("[{}] [{}] Failed to process credentials ", tenantId, e); + latch.countDown(); + } + }); + try { + latch.await(this.getLwM2MTransportConfigServer().getTimeout(), TimeUnit.MILLISECONDS); + } catch (InterruptedException e) { + log.error("Failed to await credentials!", e); + } + return responseMsg[0]; + } } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java index 56cf6b5c2e..df29c435bd 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java @@ -101,7 +101,8 @@ public class LwM2mTransportServerConfiguration { builder.setCoapConfig(getCoapConfig(serverPortNoSec, serverSecurePort)); /** Define model provider (Create Models )*/ - TransportProtos.GetResourcesResponseMsg responseMsg= this.context.getResourceTenant(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); + TransportProtos.GetResourcesResponseMsg responseMsg= this.context.getResourceTenantProcess(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); +// TransportProtos.GetResourcesResponseMsg responseMsg= this.context.getResourceTenant(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); // LwM2mModelProvider modelProvider = new VersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueCommon()); LwM2mModelProvider modelProvider = new LwM2mVersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueServer(), this.lwM2mClientContext); builder.setObjectModelProvider(modelProvider); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java index 43bd9d8022..0032946302 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java @@ -40,6 +40,8 @@ import org.springframework.stereotype.Service; import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.common.data.DeviceProfile; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.ResourceType; import org.thingsboard.server.common.transport.TransportService; import org.thingsboard.server.common.transport.adaptor.AdaptorException; import org.thingsboard.server.common.transport.adaptor.JsonConverter; @@ -154,7 +156,10 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { try { log.warn("[{}] [{{}] Client: create after Registration", registration.getEndpoint(), registration.getId()); ((LwM2mVersionedModelProvider)leshanServer.getModelProvider()).setRepository(this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getModelsValueCommon()); -// (((VersionedModelProvider) (leshanServer)).modelProvider).repository; + TransportProtos.GetResourcesResponseMsg responseMsg= this.lwM2mTransportContextServer.getResourceTenantProcess(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); +// TransportProtos.GetResourcesResponseMsg responseMsg= this.lwM2mTransportContextServer.getResourceTenant(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); + + // (((VersionedModelProvider) (leshanServer)).modelProvider).repository; LwM2mClient lwM2MClient = this.lwM2mClientContext.updateInSessionsLwM2MClient(registration); if (lwM2MClient != null) { SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java index ab728af00d..cce43b3995 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java @@ -75,8 +75,9 @@ public interface TransportService { void onProfileUpdate(DeviceProfile deviceProfile); - void process(LwM2MRequestMsg msg, - TransportServiceCallback callback); + void process(LwM2MRequestMsg msg, TransportServiceCallback callback); + + void process(GetResourcesRequestMsg msg, TransportServiceCallback callback); void process(SessionInfoProto sessionInfo, SessionEventMsg msg, TransportServiceCallback callback); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java index b273ee48cf..1f1d6c6c26 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java @@ -61,7 +61,6 @@ import org.thingsboard.server.common.transport.util.JsonUtils; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceResponseMsg; -import org.thingsboard.server.gen.transport.TransportProtos.SessionInfoProto; import org.thingsboard.server.gen.transport.TransportProtos.ToCoreMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg; @@ -266,6 +265,16 @@ public class DefaultTransportService implements TransportService { } } + @Override + public void process(TransportProtos.GetResourcesRequestMsg msg, TransportServiceCallback callback) { + log.trace("Processing msg: {}", msg); + TbProtoQueueMsg protoMsg = + new TbProtoQueueMsg<>(UUID.randomUUID(), TransportProtos.TransportApiRequestMsg.newBuilder().setResourcesRequestMsg(msg).build()); + AsyncCallbackTemplate.withCallback(transportApiRequestTemplate.send(protoMsg), + response -> callback.onSuccess(response.getValue().getResourcesResponseMsg()), callback::onError, transportCallbackExecutor); + } + + @Override public void process(DeviceTransportType transportType, TransportProtos.ValidateDeviceTokenRequestMsg msg, TransportServiceCallback callback) { @@ -292,6 +301,7 @@ public class DefaultTransportService implements TransportService { response -> callback.onSuccess(response.getValue().getValidateCredResponseMsg()), callback::onError, transportCallbackExecutor); } + @Override public void process(DeviceTransportType transportType, TransportProtos.ValidateDeviceX509CertRequestMsg msg, TransportServiceCallback callback) { log.trace("Processing msg: {}", msg); TbProtoQueueMsg protoMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), TransportApiRequestMsg.newBuilder().setValidateX509CertRequestMsg(msg).build()); From e2dd5b96aef5aca4c6a21012a5bbbda9b489169d Mon Sep 17 00:00:00 2001 From: Yevhen Bondarenko <56396344+YevhenBondarenko@users.noreply.github.com> Date: Tue, 9 Mar 2021 19:45:28 +0200 Subject: [PATCH 64/69] added resource dao support (#4213) * Version set to 3.3.0-SNAPSHOT * added resource dao * added resource support in transport lvl (get resources and "update", "delete" notifications) * refactoring * added resource table to hsql schema * added check for models dir in InstallScripts * added pageLink support to getResources --- .../server/controller/ResourceController.java | 90 +++++++++++++++++ .../install/ThingsboardInstallService.java | 7 ++ .../DefaultSystemDataLoaderService.java | 5 + .../service/install/InstallScripts.java | 48 +++++++++- .../install/SqlDatabaseUpgradeService.java | 19 ++++ .../install/SystemDataLoaderService.java | 2 + .../service/lwm2m/LwM2MModelsRepository.java | 1 + .../queue/DefaultTbClusterService.java | 29 ++++++ .../service/queue/TbClusterService.java | 5 + .../transport/DefaultTransportApiService.java | 57 ++++++++++- .../server/dao/resource/ResourceService.java | 35 +++++++ .../data/transport/resource/Resource.java | 37 +++++++ .../data/transport/resource/ResourceType.java | 20 ++++ .../queue/util/TbLwM2mTransportComponent.java | 2 +- common/queue/src/main/proto/queue.proto | 37 +++++++ .../common/transport/TransportService.java | 4 + .../service/DefaultTransportService.java | 17 ++++ .../server/dao/model/ModelConstants.java | 9 ++ .../dao/model/sql/ResourceCompositeKey.java | 45 +++++++++ .../server/dao/model/sql/ResourceEntity.java | 77 +++++++++++++++ .../dao/resource/BaseResourceService.java | 96 +++++++++++++++++++ .../server/dao/resource/ResourceDao.java | 35 +++++++ .../dao/sql/resource/ResourceDaoImpl.java | 77 +++++++++++++++ .../dao/sql/resource/ResourceRepository.java | 31 ++++++ .../server/dao/tenant/TenantServiceImpl.java | 5 + .../resources/sql/schema-entities-hsql.sql | 8 ++ .../main/resources/sql/schema-entities.sql | 8 ++ .../resources/sql/hsql/drop-all-tables.sql | 1 + .../resources/sql/psql/drop-all-tables.sql | 3 +- 29 files changed, 801 insertions(+), 9 deletions(-) create mode 100644 application/src/main/java/org/thingsboard/server/controller/ResourceController.java create mode 100644 common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java create mode 100644 dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java diff --git a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java new file mode 100644 index 0000000000..8939fa28b7 --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java @@ -0,0 +1,90 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.controller; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.thingsboard.server.common.data.exception.ThingsboardException; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.resource.ResourceService; +import org.thingsboard.server.queue.util.TbCoreComponent; + +@Slf4j +@RestController +@TbCoreComponent +@RequestMapping("/api") +public class ResourceController extends BaseController { + + private final ResourceService resourceService; + + public ResourceController(ResourceService resourceService) { + this.resourceService = resourceService; + } + + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource", method = RequestMethod.POST) + @ResponseBody + public Resource saveResource(Resource resource) throws ThingsboardException { + try { + resource.setTenantId(getTenantId()); + Resource savedResource = checkNotNull(resourceService.saveResource(resource)); + tbClusterService.onResourceChange(savedResource, null); + return savedResource; + } catch (Exception e) { + throw handleException(e); + } + } + + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource", method = RequestMethod.GET) + @ResponseBody + public PageData getResources(@RequestParam(required = false) boolean system, + @RequestParam int pageSize, + @RequestParam int page, + @RequestParam(required = false) String sortProperty, + @RequestParam(required = false) String sortOrder) throws ThingsboardException { + try { + PageLink pageLink = createPageLink(pageSize, page, null, sortProperty, sortOrder); + return checkNotNull(resourceService.findResourcesByTenantId(system ? TenantId.SYS_TENANT_ID : getTenantId(), pageLink)); + } catch (Exception e) { + throw handleException(e); + } + } + + @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN')") + @RequestMapping(value = "/resource/{resourceType}/{resourceId}", method = RequestMethod.DELETE) + @ResponseBody + public void deleteResource(@PathVariable("resourceType") ResourceType resourceType, + @PathVariable("resourceId") String resourceId) throws ThingsboardException { + try { + Resource resource = checkNotNull(resourceService.getResource(getTenantId(), resourceType, resourceId)); + resourceService.deleteResource(getTenantId(), resourceType, resourceId); + tbClusterService.onResourceDeleted(resource, null); + } catch (Exception e) { + throw handleException(e); + } + } +} diff --git a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java index 8b4a5b77a3..63eea2a7fc 100644 --- a/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java +++ b/application/src/main/java/org/thingsboard/server/install/ThingsboardInstallService.java @@ -194,6 +194,12 @@ public class ThingsboardInstallService { log.info("Updating system data..."); systemDataLoaderService.updateSystemWidgets(); break; + case "3.2.2": + log.info("Upgrading ThingsBoard from version 3.2.2 to 3.3.0 ..."); + databaseEntitiesUpgradeService.upgradeDatabase("3.2.2"); + + log.info("Updating system data..."); + break; default: throw new RuntimeException("Unable to upgrade ThingsBoard, unsupported fromVersion: " + upgradeFromVersion); @@ -226,6 +232,7 @@ public class ThingsboardInstallService { systemDataLoaderService.createAdminSettings(); systemDataLoaderService.loadSystemWidgets(); systemDataLoaderService.createOAuth2Templates(); + systemDataLoaderService.loadSystemLwm2mResources(); // systemDataLoaderService.loadSystemPlugins(); // systemDataLoaderService.loadSystemRules(); diff --git a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java index 9028fe279e..6f257a367e 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/DefaultSystemDataLoaderService.java @@ -445,6 +445,11 @@ public class DefaultSystemDataLoaderService implements SystemDataLoaderService { installScripts.loadSystemWidgets(); } + @Override + public void loadSystemLwm2mResources() throws Exception { + installScripts.loadSystemLwm2mResources(); + } + private User createUser(Authority authority, TenantId tenantId, CustomerId customerId, diff --git a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java index 47f8529c11..36b85da719 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java +++ b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java @@ -24,15 +24,17 @@ import org.springframework.util.StringUtils; import org.thingsboard.server.common.data.Dashboard; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.EntityId; -import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationTemplate; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; import org.thingsboard.server.common.data.widget.WidgetType; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.dao.dashboard.DashboardService; import org.thingsboard.server.dao.oauth2.OAuth2ConfigTemplateService; +import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.dao.rule.RuleChainService; import org.thingsboard.server.dao.widget.WidgetTypeService; import org.thingsboard.server.dao.widget.WidgetsBundleService; @@ -42,6 +44,7 @@ import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Base64; import java.util.Optional; import static org.thingsboard.server.service.install.DatabaseHelper.objectMapper; @@ -66,8 +69,11 @@ public class InstallScripts { public static final String WIDGET_BUNDLES_DIR = "widget_bundles"; public static final String OAUTH2_CONFIG_TEMPLATES_DIR = "oauth2_config_templates"; public static final String DASHBOARDS_DIR = "dashboards"; + public static final String MODELS_DIR = "models"; + public static final String CREDENTIALS_DIR = "credentials"; public static final String JSON_EXT = ".json"; + public static final String XML_EXT = ".xml"; @Value("${install.data_dir:}") private String dataDir; @@ -87,6 +93,9 @@ public class InstallScripts { @Autowired private OAuth2ConfigTemplateService oAuth2TemplateService; + @Autowired + private ResourceService resourceService; + public Path getTenantRuleChainsDir() { return Paths.get(getDataDir(), JSON_DIR, TENANT_DIR, RULE_CHAINS_DIR); } @@ -186,6 +195,42 @@ public class InstallScripts { } } + public void loadSystemLwm2mResources() throws Exception { + Path modelsDir = Paths.get(getDataDir(), MODELS_DIR); + if (Files.isDirectory(modelsDir)) { + try (DirectoryStream dirStream = Files.newDirectoryStream(modelsDir, path -> path.toString().endsWith(XML_EXT))) { + dirStream.forEach( + path -> { + try { + Resource resource = new Resource(); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceType(ResourceType.LWM2M_MODEL); + resource.setResourceId(path.getFileName().toString()); + resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(path))); + resourceService.saveResource(resource); + } catch (Exception e) { + log.error("Unable to load lwm2m model [{}]", path.toString()); + throw new RuntimeException("Unable to load lwm2m model", e); + } + } + ); + } + } + + Path jksPath = Paths.get(getDataDir(), CREDENTIALS_DIR, "serverKeyStore.jks"); + try { + Resource resource = new Resource(); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceType(ResourceType.JKS); + resource.setResourceId(jksPath.getFileName().toString()); + resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(jksPath))); + resourceService.saveResource(resource); + } catch (Exception e) { + log.error("Unable to load lwm2m serverKeyStore [{}]", jksPath.toString()); + throw new RuntimeException("Unable to load l2m2m serverKeyStore", e); + } + } + public void loadDashboards(TenantId tenantId, CustomerId customerId) throws Exception { Path dashboardsDir = Paths.get(getDataDir(), JSON_DIR, DEMO_DIR, DASHBOARDS_DIR); try (DirectoryStream dirStream = Files.newDirectoryStream(dashboardsDir, path -> path.toString().endsWith(JSON_EXT))) { @@ -208,7 +253,6 @@ public class InstallScripts { } } - public void loadDemoRuleChains(TenantId tenantId) throws Exception { try { createDefaultRuleChains(tenantId); diff --git a/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java b/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java index c3495d960b..a56cc7ca25 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/SqlDatabaseUpgradeService.java @@ -434,6 +434,25 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService log.info("Schema updated."); } break; + case "3.2.2": + try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { + log.info("Updating schema ..."); + try { + conn.createStatement().execute("CREATE TABLE IF NOT EXISTS resource (" + + " tenant_id uuid NOT NULL," + + " resource_type varchar(32) NOT NULL," + + " resource_id varchar(255) NOT NULL," + + " resource_value varchar," + + " CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id)" + + " );"); + + conn.createStatement().execute("UPDATE tb_schema_settings SET schema_version = 3003000;"); + } catch (Exception e) { + log.error("Failed updating schema!!!", e); + } + log.info("Schema updated."); + } + break; default: throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); } diff --git a/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java b/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java index 73e2b6ea57..a6f33f476f 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java +++ b/application/src/main/java/org/thingsboard/server/service/install/SystemDataLoaderService.java @@ -33,4 +33,6 @@ public interface SystemDataLoaderService { void deleteSystemWidgetBundle(String bundleAlias) throws Exception; + void loadSystemLwm2mResources() throws Exception; + } diff --git a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java index 5057893d5c..ddadc6c95c 100644 --- a/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java +++ b/application/src/main/java/org/thingsboard/server/service/lwm2m/LwM2MModelsRepository.java @@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigBootstrap; import org.thingsboard.server.common.transport.lwm2m.LwM2MTransportConfigServer; import org.thingsboard.server.dao.service.Validator; +import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode; import java.math.BigInteger; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java index 133447022b..3405ab28d8 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java @@ -34,6 +34,7 @@ import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; +import org.thingsboard.server.common.data.transport.resource.Resource; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.ServiceType; @@ -247,6 +248,34 @@ public class DefaultTbClusterService implements TbClusterService { onEntityDelete(entity.getTenantId(), entity.getId(), entity.getName(), callback); } + @Override + public void onResourceChange(Resource resource, TbQueueCallback callback) { + TenantId tenantId = resource.getTenantId(); + log.trace("[{}][{}][{}] Processing change resource", tenantId, resource.getResourceType(), resource.getResourceId()); + TransportProtos.ResourceUpdateMsg resourceUpdateMsg = TransportProtos.ResourceUpdateMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setResourceType(resource.getResourceType().name()) + .setResourceId(resource.getResourceId()) + .build(); + ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setResourceUpdateMsg(resourceUpdateMsg).build(); + broadcast(transportMsg, callback); + } + + @Override + public void onResourceDeleted(Resource resource, TbQueueCallback callback) { + TenantId tenantId = resource.getTenantId(); + log.trace("[{}][{}][{}] Processing delete resource", tenantId, resource.getResourceType(), resource.getResourceId()); + TransportProtos.ResourceDeleteMsg resourceUpdateMsg = TransportProtos.ResourceDeleteMsg.newBuilder() + .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) + .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()) + .setResourceType(resource.getResourceType().name()) + .setResourceId(resource.getResourceId()) + .build(); + ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setResourceDeleteMsg(resourceUpdateMsg).build(); + broadcast(transportMsg, callback); + } + public void onEntityChange(TenantId tenantId, EntityId entityid, T entity, TbQueueCallback callback) { String entityName = (entity instanceof HasName) ? ((HasName) entity).getName() : entity.getClass().getName(); log.trace("[{}][{}][{}] Processing [{}] change event", tenantId, entityid.getEntityType(), entityid.getId(), entityName); diff --git a/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java index 92401ea9c0..c1cafa3379 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; +import org.thingsboard.server.common.data.transport.resource.Resource; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.gen.transport.TransportProtos; @@ -71,4 +72,8 @@ public interface TbClusterService { void onDeviceChange(Device device, TbQueueCallback callback); void onDeviceDeleted(Device device, TbQueueCallback callback); + + void onResourceChange(Resource resource, TbQueueCallback callback); + + void onResourceDeleted(Resource resource, TbQueueCallback callback); } diff --git a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java index b157e0d0a7..eea7af582c 100644 --- a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java +++ b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java @@ -25,6 +25,7 @@ import com.google.protobuf.ByteString; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.common.data.ApiUsageState; import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.Device; @@ -38,9 +39,12 @@ import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.security.DeviceCredentials; import org.thingsboard.server.common.data.security.DeviceCredentialsType; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; import org.thingsboard.server.common.msg.EncryptionUtil; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgDataType; @@ -53,14 +57,15 @@ import org.thingsboard.server.dao.device.provision.ProvisionFailedException; import org.thingsboard.server.dao.device.provision.ProvisionRequest; import org.thingsboard.server.dao.device.provision.ProvisionResponse; import org.thingsboard.server.dao.relation.RelationService; +import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.dao.tenant.TbTenantProfileCache; -import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos.DeviceInfoProto; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayResponseMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionResponseStatus; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; @@ -77,11 +82,14 @@ import org.thingsboard.server.service.profile.TbDeviceProfileCache; import org.thingsboard.server.service.queue.TbClusterService; import org.thingsboard.server.service.state.DeviceStateService; +import java.util.Collections; +import java.util.List; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; /** * Created by ashvayka on 05.10.18. @@ -104,6 +112,7 @@ public class DefaultTransportApiService implements TransportApiService { private final TbClusterService tbClusterService; private final DataDecodingEncodingService dataDecodingEncodingService; private final DeviceProvisionService deviceProvisionService; + private final ResourceService resourceService; private final ConcurrentMap deviceCreationLocks = new ConcurrentHashMap<>(); @@ -112,7 +121,7 @@ public class DefaultTransportApiService implements TransportApiService { RelationService relationService, DeviceCredentialsService deviceCredentialsService, DeviceStateService deviceStateService, DbCallbackExecutorService dbCallbackExecutorService, TbClusterService tbClusterService, DataDecodingEncodingService dataDecodingEncodingService, - DeviceProvisionService deviceProvisionService) { + DeviceProvisionService deviceProvisionService, ResourceService resourceService) { this.deviceProfileCache = deviceProfileCache; this.tenantProfileCache = tenantProfileCache; this.apiUsageStateService = apiUsageStateService; @@ -124,6 +133,7 @@ public class DefaultTransportApiService implements TransportApiService { this.tbClusterService = tbClusterService; this.dataDecodingEncodingService = dataDecodingEncodingService; this.deviceProvisionService = deviceProvisionService; + this.resourceService = resourceService; } @Override @@ -157,6 +167,9 @@ public class DefaultTransportApiService implements TransportApiService { } else if (transportApiRequestMsg.hasProvisionDeviceRequestMsg()) { return Futures.transform(handle(transportApiRequestMsg.getProvisionDeviceRequestMsg()), value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); + } else if (transportApiRequestMsg.hasResourcesRequestMsg()) { + return Futures.transform(handle(transportApiRequestMsg.getResourcesRequestMsg()), + value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); } return Futures.transform(getEmptyTransportApiResponseFuture(), value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); @@ -315,9 +328,9 @@ public class DefaultTransportApiService implements TransportApiService { return TransportApiResponseMsg.newBuilder().setProvisionDeviceResponseMsg(TransportProtos.ProvisionDeviceResponseMsg.newBuilder().setStatus(status).build()).build(); } TransportProtos.ProvisionDeviceResponseMsg.Builder provisionResponse = TransportProtos.ProvisionDeviceResponseMsg.newBuilder() - .setCredentialsType(TransportProtos.CredentialsType.valueOf(deviceCredentials.getCredentialsType().name())) - .setStatus(status); - switch (deviceCredentials.getCredentialsType()){ + .setCredentialsType(TransportProtos.CredentialsType.valueOf(deviceCredentials.getCredentialsType().name())) + .setStatus(status); + switch (deviceCredentials.getCredentialsType()) { case ACCESS_TOKEN: provisionResponse.setCredentialsValue(deviceCredentials.getCredentialsId()); break; @@ -353,6 +366,40 @@ public class DefaultTransportApiService implements TransportApiService { return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setEntityProfileResponseMsg(builder).build()); } + private ListenableFuture handle(GetResourcesRequestMsg requestMsg) { + TenantId tenantId = new TenantId(new UUID(requestMsg.getTenantIdMSB(), requestMsg.getTenantIdLSB())); + TransportProtos.GetResourcesResponseMsg.Builder builder = TransportProtos.GetResourcesResponseMsg.newBuilder(); + String resourceType = requestMsg.getResourceType(); + String resourceId = requestMsg.getResourceId(); + + List resources; + + if (resourceType != null && resourceId != null) { + resources = Collections.singletonList(toProto( + resourceService.getResource(tenantId, ResourceType.valueOf(resourceType), resourceId))); + } else { + //TODO: add page link params to request proto if need or remove this + resources = resourceService.findResourcesByTenantId(tenantId, new PageLink(100)) + .getData() + .stream() + .map(this::toProto) + .collect(Collectors.toList()); + } + + builder.addAllResources(resources); + return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setResourcesResponseMsg(builder).build()); + } + + private TransportProtos.ResourceMsg toProto(Resource resource) { + return TransportProtos.ResourceMsg.newBuilder() + .setTenantIdMSB(resource.getTenantId().getId().getMostSignificantBits()) + .setTenantIdLSB(resource.getTenantId().getId().getLeastSignificantBits()) + .setResourceType(resource.getResourceType().name()) + .setResourceId(resource.getResourceId()) + .setValue(resource.getValue()) + .build(); + } + private ListenableFuture getDeviceInfo(DeviceId deviceId, DeviceCredentials credentials) { return Futures.transform(deviceService.findDeviceByIdAsync(TenantId.SYS_TENANT_ID, deviceId), device -> { if (device == null) { diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java new file mode 100644 index 0000000000..d07b090494 --- /dev/null +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java @@ -0,0 +1,35 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.resource; + +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; + + +public interface ResourceService { + Resource saveResource(Resource resource); + + Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + PageData findResourcesByTenantId(TenantId tenantId, PageLink pageLink); + + void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + void deleteResourcesByTenantId(TenantId tenantId); +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java new file mode 100644 index 0000000000..c29b704b04 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java @@ -0,0 +1,37 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.transport.resource; + +import lombok.Data; +import org.thingsboard.server.common.data.HasTenantId; +import org.thingsboard.server.common.data.id.TenantId; + +@Data +public class Resource implements HasTenantId { + private TenantId tenantId; + private ResourceType resourceType; + private String resourceId; + private String value; + + @Override + public String toString() { + return "Resource{" + + "tenantId=" + tenantId + + ", resourceType=" + resourceType + + ", resourceId='" + resourceId + '\'' + + '}'; + } +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java new file mode 100644 index 0000000000..c43f1997da --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java @@ -0,0 +1,20 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.transport.resource; + +public enum ResourceType { + LWM2M_MODEL, JKS, PKCS_12 +} diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java b/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java index 3bc4d494f2..638f9f6fb2 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/util/TbLwM2mTransportComponent.java @@ -21,6 +21,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) -@ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true' ) || ('${service.type:null}'=='monolith' && '${transport.lwm2m.enabled}'=='true')") +@ConditionalOnExpression("('${service.type:null}'=='tb-transport' && '${transport.lwm2m.enabled:false}'=='true') || ('${service.type:null}'=='monolith' && '${transport.lwm2m.enabled}'=='true')") public @interface TbLwM2mTransportComponent { } diff --git a/common/queue/src/main/proto/queue.proto b/common/queue/src/main/proto/queue.proto index d5f440d808..42f6267d42 100644 --- a/common/queue/src/main/proto/queue.proto +++ b/common/queue/src/main/proto/queue.proto @@ -201,6 +201,25 @@ message LwM2MResponseMsg { LwM2MRegistrationResponseMsg registrationMsg = 1; } +message ResourceMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; + string value = 5; +} + +message GetResourcesRequestMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; +} + +message GetResourcesResponseMsg { + repeated ResourceMsg resources = 1; +} + message ValidateDeviceLwM2MCredentialsRequestMsg { string credentialsId = 1; } @@ -242,6 +261,20 @@ message EntityDeleteMsg { int64 entityIdLSB = 3; } +message ResourceUpdateMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; +} + +message ResourceDeleteMsg { + int64 tenantIdMSB = 1; + int64 tenantIdLSB = 2; + string resourceType = 3; + string resourceId = 4; +} + message SessionCloseNotificationProto { string message = 1; } @@ -525,6 +558,7 @@ message TransportApiRequestMsg { ValidateBasicMqttCredRequestMsg validateBasicMqttCredRequestMsg = 6; ProvisionDeviceRequestMsg provisionDeviceRequestMsg = 7; ValidateDeviceLwM2MCredentialsRequestMsg validateDeviceLwM2MCredentialsRequestMsg = 8; + GetResourcesRequestMsg resourcesRequestMsg = 9; } /* Response from ThingsBoard Core Service to Transport Service */ @@ -534,6 +568,7 @@ message TransportApiResponseMsg { GetEntityProfileResponseMsg entityProfileResponseMsg = 3; ProvisionDeviceResponseMsg provisionDeviceResponseMsg = 4; LwM2MResponseMsg lwM2MResponseMsg = 6; + GetResourcesResponseMsg resourcesResponseMsg = 7; } /* Messages that are handled by ThingsBoard Core Service */ @@ -578,6 +613,8 @@ message ToTransportMsg { EntityDeleteMsg entityDeleteMsg = 9; ProvisionDeviceResponseMsg provisionResponse = 10; ToTransportUpdateCredentialsProto toTransportUpdateCredentialsNotification = 11; + ResourceUpdateMsg resourceUpdateMsg = 12; + ResourceDeleteMsg resourceDeleteMsg = 13; } message UsageStatsKVProto{ diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java index e642e7f7b2..ab728af00d 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java @@ -25,6 +25,8 @@ import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeRequestM import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.LwM2MRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.LwM2MResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.PostAttributeMsg; @@ -51,6 +53,8 @@ public interface TransportService { GetEntityProfileResponseMsg getEntityProfile(GetEntityProfileRequestMsg msg); + GetResourcesResponseMsg getResources(GetResourcesRequestMsg msg); + void process(DeviceTransportType transportType, ValidateDeviceTokenRequestMsg msg, TransportServiceCallback callback); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java index 473eeea42c..b273ee48cf 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java @@ -254,6 +254,18 @@ public class DefaultTransportService implements TransportService { } } + @Override + public TransportProtos.GetResourcesResponseMsg getResources(TransportProtos.GetResourcesRequestMsg msg) { + TbProtoQueueMsg protoMsg = + new TbProtoQueueMsg<>(UUID.randomUUID(), TransportProtos.TransportApiRequestMsg.newBuilder().setResourcesRequestMsg(msg).build()); + try { + TbProtoQueueMsg response = transportApiRequestTemplate.send(protoMsg).get(); + return response.getValue().getResourcesResponseMsg(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + } + @Override public void process(DeviceTransportType transportType, TransportProtos.ValidateDeviceTokenRequestMsg msg, TransportServiceCallback callback) { @@ -688,6 +700,10 @@ public class DefaultTransportService implements TransportService { } else if (EntityType.DEVICE.equals(entityType)) { rateLimitService.remove(new DeviceId(entityUuid)); } + } else if (toSessionMsg.hasResourceUpdateMsg()) { + //TODO: update resource cache + } else if (toSessionMsg.hasResourceDeleteMsg()) { + //TODO: remove resource from cache } else { //TODO: should we notify the device actor about missed session? log.debug("[{}] Missing session.", sessionId); @@ -695,6 +711,7 @@ public class DefaultTransportService implements TransportService { } } + public void onProfileUpdate(DeviceProfile deviceProfile) { long deviceProfileIdMSB = deviceProfile.getId().getId().getMostSignificantBits(); long deviceProfileIdLSB = deviceProfile.getId().getId().getLeastSignificantBits(); diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java index fc6a2bed25..3f11a4ed00 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/ModelConstants.java @@ -453,6 +453,15 @@ public class ModelConstants { public static final String API_USAGE_STATE_EMAIL_EXEC_COLUMN = "email_exec"; public static final String API_USAGE_STATE_SMS_EXEC_COLUMN = "sms_exec"; + /** + * Resource constants. + */ + public static final String RESOURCE_TABLE_NAME = "resource"; + public static final String RESOURCE_TENANT_ID_COLUMN = TENANT_ID_COLUMN; + public static final String RESOURCE_TYPE_COLUMN = "resource_type"; + public static final String RESOURCE_ID_COLUMN = "resource_id"; + public static final String RESOURCE_VALUE_COLUMN = "resource_value"; + /** * Cassandra attributes and timeseries constants. */ diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java new file mode 100644 index 0000000000..828f1f4341 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java @@ -0,0 +1,45 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.model.sql; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.thingsboard.server.common.data.relation.EntityRelation; +import org.thingsboard.server.common.data.transport.resource.Resource; + +import javax.persistence.Transient; +import java.io.Serializable; +import java.util.UUID; + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class ResourceCompositeKey implements Serializable { + + @Transient + private static final long serialVersionUID = -3789469030818742769L; + + private UUID tenantId; + private String resourceType; + private String resourceId; + + public ResourceCompositeKey(Resource resource) { + this.tenantId = resource.getTenantId().getId(); + this.resourceType = resource.getResourceType().name(); + this.resourceId = resource.getResourceId(); + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java new file mode 100644 index 0000000000..a877afa027 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java @@ -0,0 +1,77 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.model.sql; + +import lombok.Data; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.model.ToData; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.Table; +import java.util.UUID; + +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_ID_COLUMN; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TABLE_NAME; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TENANT_ID_COLUMN; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_TYPE_COLUMN; +import static org.thingsboard.server.dao.model.ModelConstants.RESOURCE_VALUE_COLUMN; + +@Data +@Entity +@Table(name = RESOURCE_TABLE_NAME) +@IdClass(ResourceCompositeKey.class) +public class ResourceEntity implements ToData { + + @Id + @Column(name = RESOURCE_TENANT_ID_COLUMN, columnDefinition = "uuid") + private UUID tenantId; + + @Id + @Column(name = RESOURCE_TYPE_COLUMN) + private String resourceType; + + @Id + @Column(name = RESOURCE_ID_COLUMN) + private String resourceId; + + @Column(name = RESOURCE_VALUE_COLUMN) + private String value; + + public ResourceEntity() { + } + + public ResourceEntity(Resource resource) { + this.tenantId = resource.getTenantId().getId(); + this.resourceType = resource.getResourceType().name(); + this.resourceId = resource.getResourceId(); + this.value = resource.getValue(); + } + + @Override + public Resource toData() { + Resource resource = new Resource(); + resource.setTenantId(new TenantId(tenantId)); + resource.setResourceType(ResourceType.valueOf(resourceType)); + resource.setResourceId(resourceId); + resource.setValue(value); + return resource; + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java new file mode 100644 index 0000000000..f5f23836b6 --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java @@ -0,0 +1,96 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.resource; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.exception.DataValidationException; + +import static org.thingsboard.server.dao.device.DeviceServiceImpl.INCORRECT_TENANT_ID; +import static org.thingsboard.server.dao.service.Validator.validateId; + +@Service +@Slf4j +public class BaseResourceService implements ResourceService { + + private final ResourceDao resourceDao; + + public BaseResourceService(ResourceDao resourceDao) { + this.resourceDao = resourceDao; + } + + @Override + public Resource saveResource(Resource resource) { + log.trace("Executing saveResource [{}]", resource); + validate(resource); + return resourceDao.saveResource(resource); + } + + @Override + public Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + log.trace("Executing getResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); + validate(tenantId, resourceType, resourceId); + return resourceDao.getResource(tenantId, resourceType, resourceId); + } + + @Override + public void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + log.trace("Executing deleteResource [{}] [{}] [{}]", tenantId, resourceType, resourceId); + validate(tenantId, resourceType, resourceId); + resourceDao.deleteResource(tenantId, resourceType, resourceId); + } + + @Override + public PageData findResourcesByTenantId(TenantId tenantId, PageLink pageLink) { + log.trace("Executing findByTenantId [{}]", tenantId); + validateId(tenantId, INCORRECT_TENANT_ID + tenantId); + return resourceDao.findAllByTenantId(tenantId, pageLink); + } + + @Override + public void deleteResourcesByTenantId(TenantId tenantId) { + log.trace("Executing deleteDevicesByTenantId, tenantId [{}]", tenantId); + validateId(tenantId, INCORRECT_TENANT_ID + tenantId); + resourceDao.removeAllByTenantId(tenantId); + } + + protected void validate(Resource resource) { + if (resource == null) { + throw new DataValidationException("Resource should be specified!"); + } + + if (resource.getValue() == null) { + throw new DataValidationException("Resource value should be specified!"); + } + validate(resource.getTenantId(), resource.getResourceType(), resource.getResourceId()); + } + + protected void validate(TenantId tenantId, ResourceType resourceType, String resourceId) { + if (resourceType == null) { + throw new DataValidationException("Resource type should be specified!"); + } + if (resourceId == null) { + throw new DataValidationException("Resource id should be specified!"); + } + validateId(tenantId, "Incorrect tenantId "); + } + +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java new file mode 100644 index 0000000000..f8fae8b19d --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java @@ -0,0 +1,35 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.resource; + +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; + +public interface ResourceDao { + + Resource saveResource(Resource resource); + + Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId); + + PageData findAllByTenantId(TenantId tenantId, PageLink pageLink); + + void removeAllByTenantId(TenantId tenantId); +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java new file mode 100644 index 0000000000..0f97d51f8a --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java @@ -0,0 +1,77 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.sql.resource; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.page.PageData; +import org.thingsboard.server.common.data.page.PageLink; +import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.dao.DaoUtil; +import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; +import org.thingsboard.server.dao.model.sql.ResourceEntity; +import org.thingsboard.server.dao.resource.ResourceDao; + +@Slf4j +@Component +public class ResourceDaoImpl implements ResourceDao { + + private final ResourceRepository resourceRepository; + + public ResourceDaoImpl(ResourceRepository resourceRepository) { + this.resourceRepository = resourceRepository; + } + + @Override + @Transactional + public Resource saveResource(Resource resource) { + return DaoUtil.getData(resourceRepository.save(new ResourceEntity(resource))); + } + + @Override + public Resource getResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceCompositeKey key = new ResourceCompositeKey(); + key.setTenantId(tenantId.getId()); + key.setResourceType(resourceType.name()); + key.setResourceId(resourceId); + + return DaoUtil.getData(resourceRepository.findById(key)); + } + + @Override + @Transactional + public void deleteResource(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceCompositeKey key = new ResourceCompositeKey(); + key.setTenantId(tenantId.getId()); + key.setResourceType(resourceType.name()); + key.setResourceId(resourceId); + + resourceRepository.deleteById(key); + } + + @Override + public PageData findAllByTenantId(TenantId tenantId, PageLink pageLink) { + return DaoUtil.toPageData(resourceRepository.findAllByTenantId(tenantId.getId(), DaoUtil.toPageable(pageLink))); + } + + @Override + public void removeAllByTenantId(TenantId tenantId) { + resourceRepository.removeAllByTenantId(tenantId.getId()); + } +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java new file mode 100644 index 0000000000..ba7472d7ec --- /dev/null +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceRepository.java @@ -0,0 +1,31 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.dao.sql.resource; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.CrudRepository; +import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; +import org.thingsboard.server.dao.model.sql.ResourceEntity; + +import java.util.UUID; + +public interface ResourceRepository extends CrudRepository { + + Page findAllByTenantId(UUID tenantId, Pageable pageable); + + void removeAllByTenantId(UUID tenantId); +} diff --git a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java index 12fdd3a57a..3016474f27 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/tenant/TenantServiceImpl.java @@ -35,6 +35,7 @@ import org.thingsboard.server.dao.device.DeviceService; import org.thingsboard.server.dao.entity.AbstractEntityService; import org.thingsboard.server.dao.entityview.EntityViewService; import org.thingsboard.server.dao.exception.DataValidationException; +import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.dao.rule.RuleChainService; import org.thingsboard.server.dao.service.DataValidator; import org.thingsboard.server.dao.service.PaginatedRemover; @@ -88,6 +89,9 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe @Autowired private RuleChainService ruleChainService; + @Autowired + private ResourceService resourceService; + @Override public Tenant findTenantById(TenantId tenantId) { log.trace("Executing findTenantById [{}]", tenantId); @@ -140,6 +144,7 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe userService.deleteTenantAdmins(tenantId); ruleChainService.deleteRuleChainsByTenantId(tenantId); apiUsageStateService.deleteApiUsageStateByTenantId(tenantId); + resourceService.deleteResourcesByTenantId(tenantId); tenantDao.removeById(tenantId, tenantId.getId()); deleteEntityRelations(tenantId, tenantId); } diff --git a/dao/src/main/resources/sql/schema-entities-hsql.sql b/dao/src/main/resources/sql/schema-entities-hsql.sql index ee658f8da4..787f457c6a 100644 --- a/dao/src/main/resources/sql/schema-entities-hsql.sql +++ b/dao/src/main/resources/sql/schema-entities-hsql.sql @@ -420,3 +420,11 @@ CREATE TABLE IF NOT EXISTS api_usage_state ( sms_exec varchar(32), CONSTRAINT api_usage_state_unq_key UNIQUE (tenant_id, entity_id) ); + +CREATE TABLE IF NOT EXISTS resource ( + tenant_id uuid NOT NULL, + resource_type varchar(32) NOT NULL, + resource_id varchar(255) NOT NULL, + resource_value varchar, + CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id) +); diff --git a/dao/src/main/resources/sql/schema-entities.sql b/dao/src/main/resources/sql/schema-entities.sql index 72e00ae85a..3bf5ce29c8 100644 --- a/dao/src/main/resources/sql/schema-entities.sql +++ b/dao/src/main/resources/sql/schema-entities.sql @@ -447,6 +447,14 @@ CREATE TABLE IF NOT EXISTS api_usage_state ( CONSTRAINT api_usage_state_unq_key UNIQUE (tenant_id, entity_id) ); +CREATE TABLE IF NOT EXISTS resource ( + tenant_id uuid NOT NULL, + resource_type varchar(32) NOT NULL, + resource_id varchar(255) NOT NULL, + resource_value varchar, + CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id) +); + CREATE OR REPLACE PROCEDURE cleanup_events_by_ttl(IN ttl bigint, IN debug_ttl bigint, INOUT deleted bigint) LANGUAGE plpgsql AS $$ diff --git a/dao/src/test/resources/sql/hsql/drop-all-tables.sql b/dao/src/test/resources/sql/hsql/drop-all-tables.sql index b5629b0560..a548ceec30 100644 --- a/dao/src/test/resources/sql/hsql/drop-all-tables.sql +++ b/dao/src/test/resources/sql/hsql/drop-all-tables.sql @@ -28,4 +28,5 @@ DROP TABLE IF EXISTS oauth2_client_registration; DROP TABLE IF EXISTS oauth2_client_registration_info; DROP TABLE IF EXISTS oauth2_client_registration_template; DROP TABLE IF EXISTS api_usage_state; +DROP TABLE IF EXISTS resource; DROP FUNCTION IF EXISTS to_uuid; diff --git a/dao/src/test/resources/sql/psql/drop-all-tables.sql b/dao/src/test/resources/sql/psql/drop-all-tables.sql index 34985883d7..333ce03fba 100644 --- a/dao/src/test/resources/sql/psql/drop-all-tables.sql +++ b/dao/src/test/resources/sql/psql/drop-all-tables.sql @@ -28,4 +28,5 @@ DROP TABLE IF EXISTS tb_schema_settings; DROP TABLE IF EXISTS oauth2_client_registration; DROP TABLE IF EXISTS oauth2_client_registration_info; DROP TABLE IF EXISTS oauth2_client_registration_template; -DROP TABLE IF EXISTS api_usage_state; \ No newline at end of file +DROP TABLE IF EXISTS api_usage_state; +DROP TABLE IF EXISTS resource; From 43fe84a2840cfb25d6b36ffe9ef73ce9473ef71f Mon Sep 17 00:00:00 2001 From: Yevhen Bondarenko <56396344+YevhenBondarenko@users.noreply.github.com> Date: Fri, 12 Mar 2021 13:00:51 +0200 Subject: [PATCH 65/69] created TransportResourceCache (#4232) * created TransportResourceCache * return resource by sysadmin if not found by tenant in DefaultTransportApiService --- .../server/controller/ResourceController.java | 4 +- .../service/install/InstallScripts.java | 4 +- .../queue/DefaultTbClusterService.java | 2 +- .../service/queue/TbClusterService.java | 2 +- .../transport/DefaultTransportApiService.java | 50 ++----- .../server/dao/resource/ResourceService.java | 4 +- .../{transport/resource => }/Resource.java | 10 +- .../resource => }/ResourceType.java | 2 +- common/queue/src/main/proto/queue.proto | 18 +-- .../transport/TransportResourceCache.java | 29 ++++ .../common/transport/TransportService.java | 6 +- .../DefaultTransportResourceCache.java | 130 ++++++++++++++++++ .../service/DefaultTransportService.java | 25 +++- .../transport/util/ProtoWithFSTService.java | 6 +- .../dao/model/sql/ResourceCompositeKey.java | 3 +- .../server/dao/model/sql/ResourceEntity.java | 4 +- .../dao/resource/BaseResourceService.java | 4 +- .../server/dao/resource/ResourceDao.java | 4 +- .../dao/sql/resource/ResourceDaoImpl.java | 4 +- 19 files changed, 227 insertions(+), 84 deletions(-) rename common/data/src/main/java/org/thingsboard/server/common/data/{transport/resource => }/Resource.java (83%) rename common/data/src/main/java/org/thingsboard/server/common/data/{transport/resource => }/ResourceType.java (91%) create mode 100644 common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportResourceCache.java create mode 100644 common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportResourceCache.java diff --git a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java index 8939fa28b7..3eaf797b86 100644 --- a/application/src/main/java/org/thingsboard/server/controller/ResourceController.java +++ b/application/src/main/java/org/thingsboard/server/controller/ResourceController.java @@ -27,8 +27,8 @@ import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.dao.resource.ResourceService; import org.thingsboard.server.queue.util.TbCoreComponent; diff --git a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java index 36b85da719..2800f97661 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java +++ b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java @@ -28,8 +28,8 @@ import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationTemplate; import org.thingsboard.server.common.data.rule.RuleChain; import org.thingsboard.server.common.data.rule.RuleChainMetaData; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.data.widget.WidgetType; import org.thingsboard.server.common.data.widget.WidgetsBundle; import org.thingsboard.server.dao.dashboard.DashboardService; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java index 3405ab28d8..a2a04ce3bd 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/DefaultTbClusterService.java @@ -34,7 +34,7 @@ import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; -import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.Resource; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.plugin.ComponentLifecycleMsg; import org.thingsboard.server.common.msg.queue.ServiceType; diff --git a/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java b/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java index c1cafa3379..ae6dca5378 100644 --- a/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java +++ b/application/src/main/java/org/thingsboard/server/service/queue/TbClusterService.java @@ -24,7 +24,7 @@ import org.thingsboard.server.common.data.TenantProfile; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.plugin.ComponentLifecycleEvent; -import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.Resource; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.gen.transport.TransportProtos; diff --git a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java index eea7af582c..b12d71e9f4 100644 --- a/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java +++ b/application/src/main/java/org/thingsboard/server/service/transport/DefaultTransportApiService.java @@ -39,12 +39,11 @@ import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.DeviceId; import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.security.DeviceCredentials; import org.thingsboard.server.common.data.security.DeviceCredentialsType; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.msg.EncryptionUtil; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgDataType; @@ -65,7 +64,7 @@ import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileRequ import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayResponseMsg; -import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourceRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionResponseStatus; import org.thingsboard.server.gen.transport.TransportProtos.TransportApiRequestMsg; @@ -82,14 +81,11 @@ import org.thingsboard.server.service.profile.TbDeviceProfileCache; import org.thingsboard.server.service.queue.TbClusterService; import org.thingsboard.server.service.state.DeviceStateService; -import java.util.Collections; -import java.util.List; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import java.util.stream.Collectors; /** * Created by ashvayka on 05.10.18. @@ -167,8 +163,8 @@ public class DefaultTransportApiService implements TransportApiService { } else if (transportApiRequestMsg.hasProvisionDeviceRequestMsg()) { return Futures.transform(handle(transportApiRequestMsg.getProvisionDeviceRequestMsg()), value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); - } else if (transportApiRequestMsg.hasResourcesRequestMsg()) { - return Futures.transform(handle(transportApiRequestMsg.getResourcesRequestMsg()), + } else if (transportApiRequestMsg.hasResourceRequestMsg()) { + return Futures.transform(handle(transportApiRequestMsg.getResourceRequestMsg()), value -> new TbProtoQueueMsg<>(tbProtoQueueMsg.getKey(), value, tbProtoQueueMsg.getHeaders()), MoreExecutors.directExecutor()); } return Futures.transform(getEmptyTransportApiResponseFuture(), @@ -366,38 +362,22 @@ public class DefaultTransportApiService implements TransportApiService { return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setEntityProfileResponseMsg(builder).build()); } - private ListenableFuture handle(GetResourcesRequestMsg requestMsg) { + private ListenableFuture handle(GetResourceRequestMsg requestMsg) { TenantId tenantId = new TenantId(new UUID(requestMsg.getTenantIdMSB(), requestMsg.getTenantIdLSB())); - TransportProtos.GetResourcesResponseMsg.Builder builder = TransportProtos.GetResourcesResponseMsg.newBuilder(); - String resourceType = requestMsg.getResourceType(); + ResourceType resourceType = ResourceType.valueOf(requestMsg.getResourceType()); String resourceId = requestMsg.getResourceId(); + TransportProtos.GetResourceResponseMsg.Builder builder = TransportProtos.GetResourceResponseMsg.newBuilder(); + Resource resource = resourceService.getResource(tenantId, resourceType, resourceId); - List resources; - - if (resourceType != null && resourceId != null) { - resources = Collections.singletonList(toProto( - resourceService.getResource(tenantId, ResourceType.valueOf(resourceType), resourceId))); - } else { - //TODO: add page link params to request proto if need or remove this - resources = resourceService.findResourcesByTenantId(tenantId, new PageLink(100)) - .getData() - .stream() - .map(this::toProto) - .collect(Collectors.toList()); + if (resource == null && !tenantId.equals(TenantId.SYS_TENANT_ID)) { + resource = resourceService.getResource(TenantId.SYS_TENANT_ID, resourceType, resourceId); } - builder.addAllResources(resources); - return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setResourcesResponseMsg(builder).build()); - } + if (resource != null) { + builder.setResource(ByteString.copyFrom(dataDecodingEncodingService.encode(resource))); + } - private TransportProtos.ResourceMsg toProto(Resource resource) { - return TransportProtos.ResourceMsg.newBuilder() - .setTenantIdMSB(resource.getTenantId().getId().getMostSignificantBits()) - .setTenantIdLSB(resource.getTenantId().getId().getLeastSignificantBits()) - .setResourceType(resource.getResourceType().name()) - .setResourceId(resource.getResourceId()) - .setValue(resource.getValue()) - .build(); + return Futures.immediateFuture(TransportApiResponseMsg.newBuilder().setResourceResponseMsg(builder).build()); } private ListenableFuture getDeviceInfo(DeviceId deviceId, DeviceCredentials credentials) { diff --git a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java index d07b090494..e79a2297e1 100644 --- a/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java +++ b/common/dao-api/src/main/java/org/thingsboard/server/dao/resource/ResourceService.java @@ -18,8 +18,8 @@ package org.thingsboard.server.dao.resource; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; public interface ResourceService { diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java b/common/data/src/main/java/org/thingsboard/server/common/data/Resource.java similarity index 83% rename from common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java rename to common/data/src/main/java/org/thingsboard/server/common/data/Resource.java index c29b704b04..2e7cde8185 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/Resource.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/Resource.java @@ -13,14 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.server.common.data.transport.resource; +package org.thingsboard.server.common.data; import lombok.Data; -import org.thingsboard.server.common.data.HasTenantId; import org.thingsboard.server.common.data.id.TenantId; +import java.io.Serializable; + @Data -public class Resource implements HasTenantId { +public class Resource implements HasTenantId, Serializable { + + private static final long serialVersionUID = 7379609705527272306L; + private TenantId tenantId; private ResourceType resourceType; private String resourceId; diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java b/common/data/src/main/java/org/thingsboard/server/common/data/ResourceType.java similarity index 91% rename from common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java rename to common/data/src/main/java/org/thingsboard/server/common/data/ResourceType.java index c43f1997da..a9bb27432a 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/transport/resource/ResourceType.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/ResourceType.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.server.common.data.transport.resource; +package org.thingsboard.server.common.data; public enum ResourceType { LWM2M_MODEL, JKS, PKCS_12 diff --git a/common/queue/src/main/proto/queue.proto b/common/queue/src/main/proto/queue.proto index 42f6267d42..0a9e6d7652 100644 --- a/common/queue/src/main/proto/queue.proto +++ b/common/queue/src/main/proto/queue.proto @@ -201,23 +201,15 @@ message LwM2MResponseMsg { LwM2MRegistrationResponseMsg registrationMsg = 1; } -message ResourceMsg { +message GetResourceRequestMsg { int64 tenantIdMSB = 1; int64 tenantIdLSB = 2; string resourceType = 3; string resourceId = 4; - string value = 5; } -message GetResourcesRequestMsg { - int64 tenantIdMSB = 1; - int64 tenantIdLSB = 2; - string resourceType = 3; - string resourceId = 4; -} - -message GetResourcesResponseMsg { - repeated ResourceMsg resources = 1; +message GetResourceResponseMsg { + bytes resource = 1; } message ValidateDeviceLwM2MCredentialsRequestMsg { @@ -558,7 +550,7 @@ message TransportApiRequestMsg { ValidateBasicMqttCredRequestMsg validateBasicMqttCredRequestMsg = 6; ProvisionDeviceRequestMsg provisionDeviceRequestMsg = 7; ValidateDeviceLwM2MCredentialsRequestMsg validateDeviceLwM2MCredentialsRequestMsg = 8; - GetResourcesRequestMsg resourcesRequestMsg = 9; + GetResourceRequestMsg resourceRequestMsg = 9; } /* Response from ThingsBoard Core Service to Transport Service */ @@ -568,7 +560,7 @@ message TransportApiResponseMsg { GetEntityProfileResponseMsg entityProfileResponseMsg = 3; ProvisionDeviceResponseMsg provisionDeviceResponseMsg = 4; LwM2MResponseMsg lwM2MResponseMsg = 6; - GetResourcesResponseMsg resourcesResponseMsg = 7; + GetResourceResponseMsg resourceResponseMsg = 7; } /* Messages that are handled by ThingsBoard Core Service */ diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportResourceCache.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportResourceCache.java new file mode 100644 index 0000000000..447ad3e6fa --- /dev/null +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportResourceCache.java @@ -0,0 +1,29 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.transport; + +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; + +public interface TransportResourceCache { + + Resource get(TenantId tenantId, ResourceType resourceType, String resourceId); + + void update(TenantId tenantId, ResourceType resourceType, String resourceI); + + void evict(TenantId tenantId, ResourceType resourceType, String resourceId); +} diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java index ab728af00d..04b08272b1 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/TransportService.java @@ -25,8 +25,8 @@ import org.thingsboard.server.gen.transport.TransportProtos.GetAttributeRequestM import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetEntityProfileResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.GetOrCreateDeviceFromGatewayRequestMsg; -import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesRequestMsg; -import org.thingsboard.server.gen.transport.TransportProtos.GetResourcesResponseMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourceRequestMsg; +import org.thingsboard.server.gen.transport.TransportProtos.GetResourceResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.LwM2MRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.LwM2MResponseMsg; import org.thingsboard.server.gen.transport.TransportProtos.PostAttributeMsg; @@ -53,7 +53,7 @@ public interface TransportService { GetEntityProfileResponseMsg getEntityProfile(GetEntityProfileRequestMsg msg); - GetResourcesResponseMsg getResources(GetResourcesRequestMsg msg); + GetResourceResponseMsg getResource(GetResourceRequestMsg msg); void process(DeviceTransportType transportType, ValidateDeviceTokenRequestMsg msg, TransportServiceCallback callback); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportResourceCache.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportResourceCache.java new file mode 100644 index 0000000000..9d14acbaf1 --- /dev/null +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportResourceCache.java @@ -0,0 +1,130 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.transport.service; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.id.TenantId; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; +import org.thingsboard.server.common.transport.TransportResourceCache; +import org.thingsboard.server.common.transport.TransportService; +import org.thingsboard.server.common.transport.util.DataDecodingEncodingService; +import org.thingsboard.server.gen.transport.TransportProtos; +import org.thingsboard.server.queue.util.TbTransportComponent; + +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +@Slf4j +@Component +@TbTransportComponent +public class DefaultTransportResourceCache implements TransportResourceCache { + + private final Lock resourceFetchLock = new ReentrantLock(); + private final ConcurrentMap resources = new ConcurrentHashMap<>(); + private final Set keys = ConcurrentHashMap.newKeySet(); + private final DataDecodingEncodingService dataDecodingEncodingService; + private final TransportService transportService; + + public DefaultTransportResourceCache(DataDecodingEncodingService dataDecodingEncodingService, @Lazy TransportService transportService) { + this.dataDecodingEncodingService = dataDecodingEncodingService; + this.transportService = transportService; + } + + @Override + public Resource get(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceKey resourceKey = new ResourceKey(tenantId, resourceType, resourceId); + Resource resource; + + if (keys.contains(resourceKey)) { + resource = resources.get(resourceKey); + if (resource == null) { + resource = resources.get(resourceKey.getSystemKey()); + } + } else { + resourceFetchLock.lock(); + try { + if (keys.contains(resourceKey)) { + resource = resources.get(resourceKey); + if (resource == null) { + resource = resources.get(resourceKey.getSystemKey()); + } + } else { + resource = fetchResource(resourceKey); + keys.add(resourceKey); + } + } finally { + resourceFetchLock.unlock(); + } + } + + return resource; + } + + private Resource fetchResource(ResourceKey resourceKey) { + UUID tenantId = resourceKey.getTenantId().getId(); + TransportProtos.GetResourceRequestMsg.Builder builder = TransportProtos.GetResourceRequestMsg.newBuilder(); + builder + .setTenantIdLSB(tenantId.getLeastSignificantBits()) + .setTenantIdMSB(tenantId.getMostSignificantBits()) + .setResourceType(resourceKey.resourceType.name()) + .setResourceId(resourceKey.resourceId); + TransportProtos.GetResourceResponseMsg responseMsg = transportService.getResource(builder.build()); + + Optional optionalResource = dataDecodingEncodingService.decode(responseMsg.getResource().toByteArray()); + if (optionalResource.isPresent()) { + Resource resource = optionalResource.get(); + resources.put(new ResourceKey(resource.getTenantId(), resource.getResourceType(), resource.getResourceId()), resource); + return resource; + } + + return null; + } + + @Override + public void update(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceKey resourceKey = new ResourceKey(tenantId, resourceType, resourceId); + if (keys.contains(resourceKey) || resources.containsKey(resourceKey)) { + fetchResource(resourceKey); + } + } + + @Override + public void evict(TenantId tenantId, ResourceType resourceType, String resourceId) { + ResourceKey resourceKey = new ResourceKey(tenantId, resourceType, resourceId); + keys.remove(resourceKey); + resources.remove(resourceKey); + } + + @Data + private static class ResourceKey { + private final TenantId tenantId; + private final ResourceType resourceType; + private final String resourceId; + + public ResourceKey getSystemKey() { + return new ResourceKey(TenantId.SYS_TENANT_ID, resourceType, resourceId); + } + } +} diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java index b273ee48cf..539921492b 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/service/DefaultTransportService.java @@ -37,6 +37,7 @@ import org.thingsboard.server.common.data.id.DeviceProfileId; import org.thingsboard.server.common.data.id.RuleChainId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.TenantProfileId; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.common.msg.queue.ServiceQueue; @@ -49,6 +50,7 @@ import org.thingsboard.server.common.stats.StatsFactory; import org.thingsboard.server.common.stats.StatsType; import org.thingsboard.server.common.transport.SessionMsgListener; import org.thingsboard.server.common.transport.TransportDeviceProfileCache; +import org.thingsboard.server.common.transport.TransportResourceCache; import org.thingsboard.server.common.transport.TransportService; import org.thingsboard.server.common.transport.TransportServiceCallback; import org.thingsboard.server.common.transport.TransportTenantProfileCache; @@ -61,7 +63,6 @@ import org.thingsboard.server.common.transport.util.JsonUtils; import org.thingsboard.server.gen.transport.TransportProtos; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceRequestMsg; import org.thingsboard.server.gen.transport.TransportProtos.ProvisionDeviceResponseMsg; -import org.thingsboard.server.gen.transport.TransportProtos.SessionInfoProto; import org.thingsboard.server.gen.transport.TransportProtos.ToCoreMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToRuleEngineMsg; import org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg; @@ -131,6 +132,7 @@ public class DefaultTransportService implements TransportService { private final TransportRateLimitService rateLimitService; private final DataDecodingEncodingService dataDecodingEncodingService; private final SchedulerComponent scheduler; + private final TransportResourceCache transportResourceCache; protected TbQueueRequestTemplate, TbProtoQueueMsg> transportApiRequestTemplate; protected TbQueueProducer> ruleEngineMsgProducer; @@ -157,7 +159,7 @@ public class DefaultTransportService implements TransportService { TransportDeviceProfileCache deviceProfileCache, TransportTenantProfileCache tenantProfileCache, TbApiUsageClient apiUsageClient, TransportRateLimitService rateLimitService, - DataDecodingEncodingService dataDecodingEncodingService, SchedulerComponent scheduler) { + DataDecodingEncodingService dataDecodingEncodingService, SchedulerComponent scheduler, TransportResourceCache transportResourceCache) { this.serviceInfoProvider = serviceInfoProvider; this.queueProvider = queueProvider; this.producerProvider = producerProvider; @@ -169,6 +171,7 @@ public class DefaultTransportService implements TransportService { this.rateLimitService = rateLimitService; this.dataDecodingEncodingService = dataDecodingEncodingService; this.scheduler = scheduler; + this.transportResourceCache = transportResourceCache; } @PostConstruct @@ -255,12 +258,12 @@ public class DefaultTransportService implements TransportService { } @Override - public TransportProtos.GetResourcesResponseMsg getResources(TransportProtos.GetResourcesRequestMsg msg) { + public TransportProtos.GetResourceResponseMsg getResource(TransportProtos.GetResourceRequestMsg msg) { TbProtoQueueMsg protoMsg = - new TbProtoQueueMsg<>(UUID.randomUUID(), TransportProtos.TransportApiRequestMsg.newBuilder().setResourcesRequestMsg(msg).build()); + new TbProtoQueueMsg<>(UUID.randomUUID(), TransportProtos.TransportApiRequestMsg.newBuilder().setResourceRequestMsg(msg).build()); try { TbProtoQueueMsg response = transportApiRequestTemplate.send(protoMsg).get(); - return response.getValue().getResourcesResponseMsg(); + return response.getValue().getResourceResponseMsg(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } @@ -701,9 +704,17 @@ public class DefaultTransportService implements TransportService { rateLimitService.remove(new DeviceId(entityUuid)); } } else if (toSessionMsg.hasResourceUpdateMsg()) { - //TODO: update resource cache + TransportProtos.ResourceUpdateMsg msg = toSessionMsg.getResourceUpdateMsg(); + TenantId tenantId = new TenantId(new UUID(msg.getTenantIdMSB(), msg.getTenantIdLSB())); + ResourceType resourceType = ResourceType.valueOf(msg.getResourceType()); + String resourceId = msg.getResourceId(); + transportResourceCache.update(tenantId, resourceType, resourceId); } else if (toSessionMsg.hasResourceDeleteMsg()) { - //TODO: remove resource from cache + TransportProtos.ResourceDeleteMsg msg = toSessionMsg.getResourceDeleteMsg(); + TenantId tenantId = new TenantId(new UUID(msg.getTenantIdMSB(), msg.getTenantIdLSB())); + ResourceType resourceType = ResourceType.valueOf(msg.getResourceType()); + String resourceId = msg.getResourceId(); + transportResourceCache.evict(tenantId, resourceType, resourceId); } else { //TODO: should we notify the device actor about missed session? log.debug("[{}] Missing session.", sessionId); diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/ProtoWithFSTService.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/ProtoWithFSTService.java index a3b65c2248..4d0b8bb86a 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/ProtoWithFSTService.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/util/ProtoWithFSTService.java @@ -18,8 +18,6 @@ package org.thingsboard.server.common.transport.util; import lombok.extern.slf4j.Slf4j; import org.nustaq.serialization.FSTConfiguration; import org.springframework.stereotype.Service; -import org.thingsboard.server.common.msg.TbActorMsg; -import org.thingsboard.server.common.transport.util.DataDecodingEncodingService; import java.util.Optional; @@ -33,8 +31,8 @@ public class ProtoWithFSTService implements DataDecodingEncodingService { public Optional decode(byte[] byteArray) { try { @SuppressWarnings("unchecked") - T msg = (T) config.asObject(byteArray); - return Optional.of(msg); + T msg = byteArray != null && byteArray.length > 0 ? (T) config.asObject(byteArray) : null; + return Optional.ofNullable(msg); } catch (IllegalArgumentException e) { log.error("Error during deserialization message, [{}]", e.getMessage()); return Optional.empty(); diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java index 828f1f4341..6592cf757d 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceCompositeKey.java @@ -18,8 +18,7 @@ package org.thingsboard.server.dao.model.sql; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import org.thingsboard.server.common.data.relation.EntityRelation; -import org.thingsboard.server.common.data.transport.resource.Resource; +import org.thingsboard.server.common.data.Resource; import javax.persistence.Transient; import java.io.Serializable; diff --git a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java index a877afa027..c3b242bfe5 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java +++ b/dao/src/main/java/org/thingsboard/server/dao/model/sql/ResourceEntity.java @@ -17,8 +17,8 @@ package org.thingsboard.server.dao.model.sql; import lombok.Data; import org.thingsboard.server.common.data.id.TenantId; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.dao.model.ToData; import javax.persistence.Column; diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java index f5f23836b6..41eda77d54 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/BaseResourceService.java @@ -20,8 +20,8 @@ import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.dao.exception.DataValidationException; import static org.thingsboard.server.dao.device.DeviceServiceImpl.INCORRECT_TENANT_ID; diff --git a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java index f8fae8b19d..0c03a474c2 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java +++ b/dao/src/main/java/org/thingsboard/server/dao/resource/ResourceDao.java @@ -18,8 +18,8 @@ package org.thingsboard.server.dao.resource; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; public interface ResourceDao { diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java index 0f97d51f8a..c5436b2535 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/resource/ResourceDaoImpl.java @@ -21,8 +21,8 @@ import org.springframework.transaction.annotation.Transactional; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; -import org.thingsboard.server.common.data.transport.resource.Resource; -import org.thingsboard.server.common.data.transport.resource.ResourceType; +import org.thingsboard.server.common.data.Resource; +import org.thingsboard.server.common.data.ResourceType; import org.thingsboard.server.dao.DaoUtil; import org.thingsboard.server.dao.model.sql.ResourceCompositeKey; import org.thingsboard.server.dao.model.sql.ResourceEntity; From 648e8ec262ee4aea594aa438d4d2b651f09bed80 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Fri, 12 Mar 2021 17:53:03 +0200 Subject: [PATCH 66/69] lwm2m: add Lwm2m provider for models --- .../service/install/InstallScripts.java | 91 ++++++++++---- ...TransportBootstrapServerConfiguration.java | 3 +- .../server/LwM2mTransportContextServer.java | 87 ++++---------- .../lwm2m/server/LwM2mTransportHandler.java | 6 +- .../lwm2m/server/LwM2mTransportRequest.java | 4 +- .../LwM2mTransportServerConfiguration.java | 30 ++--- .../server/LwM2mTransportServiceImpl.java | 20 ---- .../server/LwM2mVersionedModelProvider.java | 112 +++++++++++------- .../server/client/LwM2mClientContextImpl.java | 1 - .../server/client/LwM2mClientProfile.java | 5 +- .../lwm2m/utils/LwM2mValueConverterImpl.java | 5 + .../lwm2m/LwM2MTransportConfigServer.java | 37 +----- pom.xml | 6 +- 13 files changed, 189 insertions(+), 218 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java index 4cb4fbd059..f9ef8e03e1 100644 --- a/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java +++ b/application/src/main/java/org/thingsboard/server/service/install/InstallScripts.java @@ -17,6 +17,10 @@ package org.thingsboard.server.service.install; import com.fasterxml.jackson.databind.JsonNode; import lombok.extern.slf4j.Slf4j; +import org.eclipse.leshan.core.model.DDFFileParser; +import org.eclipse.leshan.core.model.DefaultDDFFileValidator; +import org.eclipse.leshan.core.model.InvalidDDFFileException; +import org.eclipse.leshan.core.model.ObjectModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -39,6 +43,8 @@ import org.thingsboard.server.dao.rule.RuleChainService; import org.thingsboard.server.dao.widget.WidgetTypeService; import org.thingsboard.server.dao.widget.WidgetsBundleService; +import java.io.ByteArrayInputStream; +import java.io.File; import java.io.IOException; import java.nio.file.DirectoryStream; import java.nio.file.Files; @@ -196,37 +202,70 @@ public class InstallScripts { } public void loadSystemLwm2mResources() throws Exception { +// Path modelsDir = Paths.get("/home/nick/Igor_project/thingsboard_ce_3_2_docker/thingsboard/common/transport/lwm2m/src/main/resources/models/"); Path modelsDir = Paths.get(getDataDir(), MODELS_DIR); - try (DirectoryStream dirStream = Files.newDirectoryStream(modelsDir, path -> path.toString().endsWith(XML_EXT))) { - dirStream.forEach( - path -> { - try { - Resource resource = new Resource(); - resource.setTenantId(TenantId.SYS_TENANT_ID); - resource.setResourceType(ResourceType.LWM2M_MODEL); - resource.setResourceId(path.getFileName().toString()); - resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(path))); - resourceService.saveResource(resource); - } catch (Exception e) { - log.error("Unable to load lwm2m model [{}]", path.toString()); - throw new RuntimeException("Unable to load lwm2m model", e); + if (Files.isDirectory(modelsDir)) { + try (DirectoryStream dirStream = Files.newDirectoryStream(modelsDir, path -> path.toString().endsWith(XML_EXT))) { + dirStream.forEach( + path -> { + try { + byte[] fileBytes = Files.readAllBytes(path); + String key = getObjectModelLwm2mValid(fileBytes, path.getFileName().toString(), new DefaultDDFFileValidator()); + if (key != null) { + Resource resource = new Resource(); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceType(ResourceType.LWM2M_MODEL); + resource.setResourceId(key); + resource.setValue(Base64.getEncoder().encodeToString(fileBytes)); + resourceService.saveResource(resource); + } + } catch (Exception e) { + log.error("Unable to load lwm2m model [{}]", path.toString()); + throw new RuntimeException("Unable to load lwm2m model", e); + } } - } - ); + ); + } } Path jksPath = Paths.get(getDataDir(), CREDENTIALS_DIR, "serverKeyStore.jks"); - try { - Resource resource = new Resource(); - resource.setTenantId(TenantId.SYS_TENANT_ID); - resource.setResourceType(ResourceType.JKS); - resource.setResourceId(jksPath.getFileName().toString()); - resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(jksPath))); - resourceService.saveResource(resource); - } catch (Exception e) { - log.error("Unable to load lwm2m serverKeyStore [{}]", jksPath.toString()); - throw new RuntimeException("Unable to load l2m2m serverKeyStore", e); - } + try { + Resource resource = new Resource(); + resource.setTenantId(TenantId.SYS_TENANT_ID); + resource.setResourceType(ResourceType.JKS); + resource.setResourceId(jksPath.getFileName().toString()); + resource.setValue(Base64.getEncoder().encodeToString(Files.readAllBytes(jksPath))); + resourceService.saveResource(resource); + } catch (Exception e) { + log.error("Unable to load lwm2m serverKeyStore [{}]", jksPath.toString()); + throw new RuntimeException("Unable to load l2m2m serverKeyStore", e); + } + } + + private String getObjectModelLwm2mValid(byte[] xmlByte, String streamName, DefaultDDFFileValidator ddfValidator) { + try { + DDFFileParser ddfFileParser = new DDFFileParser(ddfValidator); + ObjectModel objectModel = ddfFileParser.parseEx(new ByteArrayInputStream(xmlByte), streamName).get(0); + return objectModel.id + "##" + objectModel.getVersion(); + } catch (IOException | InvalidDDFFileException e) { + log.error("Could not parse the XML file [{}]", streamName, e); + return null; + } + + } + + private void removeFile(Path modelsDir, String nameFile, byte[] fileBytes) { + String path = "/home/nick/Igor_project/thingsboard_ce_3_2_docker/thingsboard/common/transport/lwm2m/src/main/resources/models/"; + File file = new File(path + nameFile); + if (!file.isDirectory()) { + try { + Files.write(Paths.get(path + "server/" + nameFile), fileBytes); + file.delete(); + } catch (IOException e) { + e.printStackTrace(); + } + + } } public void loadDashboards(TenantId tenantId, CustomerId customerId) throws Exception { diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java index 59e1087f21..e531de3628 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/bootstrap/LwM2MTransportBootstrapServerConfiguration.java @@ -17,7 +17,6 @@ package org.thingsboard.server.transport.lwm2m.bootstrap; import lombok.extern.slf4j.Slf4j; import org.eclipse.californium.scandium.config.DtlsConnectorConfig; -import org.eclipse.leshan.core.model.StaticModel; import org.eclipse.leshan.core.util.Hex; import org.eclipse.leshan.server.bootstrap.BootstrapSessionManager; import org.eclipse.leshan.server.californium.bootstrap.LeshanBootstrapServer; @@ -94,7 +93,7 @@ public class LwM2MTransportBootstrapServerConfiguration { builder.setCoapConfig(getCoapConfig(bootstrapPortNoSec, bootstrapSecurePort)); /** Define model provider (Create Models )*/ - builder.setModel(new StaticModel(contextS.getLwM2MTransportConfigServer().getModelsValueCommon())); +// builder.setModel(new StaticModel(contextS.getLwM2MTransportConfigServer().getModelsValueCommon())); /** Create credentials */ this.setServerWithCredentials(builder); diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java index 92db005094..2fffd17a4c 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportContextServer.java @@ -16,13 +16,13 @@ package org.thingsboard.server.transport.lwm2m.server; /** * Copyright © 2016-2020 The Thingsboard Authors - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,9 +34,13 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.eclipse.leshan.core.model.DDFFileParser; +import org.eclipse.leshan.core.model.DefaultDDFFileValidator; +import org.eclipse.leshan.core.model.InvalidDDFFileException; import org.eclipse.leshan.core.model.ObjectModel; import org.springframework.stereotype.Component; import org.thingsboard.server.common.transport.TransportContext; +import org.thingsboard.server.common.transport.TransportResourceCache; import org.thingsboard.server.common.transport.TransportService; import org.thingsboard.server.common.transport.TransportServiceCallback; import org.thingsboard.server.common.transport.adaptor.AdaptorException; @@ -48,7 +52,8 @@ import org.thingsboard.server.gen.transport.TransportProtos.ValidateDeviceCreden import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; import org.thingsboard.server.transport.lwm2m.server.adaptors.LwM2MJsonAdaptor; -import java.util.List; +import java.io.ByteArrayInputStream; +import java.io.IOException; import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportHandler.LOG_LW2M_TELEMETRY; @@ -62,14 +67,16 @@ public class LwM2mTransportContextServer extends TransportContext { private final TransportService transportService; - private List modelsValueServer; + private final TransportResourceCache transportResourceCache; + @Getter private final LwM2MJsonAdaptor adaptor; - public LwM2mTransportContextServer(LwM2MTransportConfigServer lwM2MTransportConfigServer, TransportService transportService, LwM2MJsonAdaptor adaptor) { + public LwM2mTransportContextServer(LwM2MTransportConfigServer lwM2MTransportConfigServer, TransportService transportService, TransportResourceCache transportResourceCache, LwM2MJsonAdaptor adaptor) { this.lwM2MTransportConfigServer = lwM2MTransportConfigServer; this.transportService = transportService; + this.transportResourceCache = transportResourceCache; this.adaptor = adaptor; } @@ -77,6 +84,10 @@ public class LwM2mTransportContextServer extends TransportContext { return this.lwM2MTransportConfigServer; } + public TransportResourceCache getTransportResourceCache() { + return this.transportResourceCache; + } + /** * Sent to Thingsboard Attribute || Telemetry * @@ -139,59 +150,13 @@ public class LwM2mTransportContextServer extends TransportContext { .build(); } - - - -// /** -// * ResourcesRequestMsg -// * -// * @param resourceType -// * @return -// */ -// public GetResourcesResponseMsg getResourceTenant (UUID tenantId, String resourceType) { -// CountDownLatch latch = new CountDownLatch(1); -// GetResourcesResponseMsg responseMsg = -// this.getTransportService() -// .getResources(GetResourcesRequestMsg.newBuilder() -// .setResourceType(resourceType) -// .setTenantIdLSB(tenantId.getLeastSignificantBits()) -// .setTenantIdMSB(tenantId.getMostSignificantBits()) -// .build()); -// latch.countDown(); -// try { -// latch.await(this.getLwM2MTransportConfigServer().getTimeout(), TimeUnit.MILLISECONDS); -// } catch (InterruptedException e) { -// log.error("Failed to await credentials!", e); -// } -// -// return responseMsg; -// } - -// public GetResourcesResponseMsg getResourceTenantProcess (UUID tenantId, String resourceType) { -// CountDownLatch latch = new CountDownLatch(2); -// final GetResourcesResponseMsg[] responseMsg = {null}; -// this.getTransportService().process(GetResourcesRequestMsg.newBuilder() -// .setResourceType(resourceType) -// .setTenantIdLSB(tenantId.getLeastSignificantBits()) -// .setTenantIdMSB(tenantId.getMostSignificantBits()) -// .build(), -// new TransportServiceCallback<>() { -// @Override -// public void onSuccess(GetResourcesResponseMsg msg) { responseMsg[0] = msg; -// latch.countDown(); -// } -// -// @Override -// public void onError(Throwable e) { -// log.trace("[{}] [{}] Failed to process credentials ", tenantId, e); -// latch.countDown(); -// } -// }); -// try { -// latch.await(this.getLwM2MTransportConfigServer().getTimeout(), TimeUnit.MILLISECONDS); -// } catch (InterruptedException e) { -// log.error("Failed to await credentials!", e); -// } -// return responseMsg[0]; -// } + public ObjectModel parseFromXmlToObjectModel(byte[] xmlByte, String streamName, DefaultDDFFileValidator ddfValidator) { + try { + DDFFileParser ddfFileParser = new DDFFileParser(ddfValidator); + return ddfFileParser.parseEx(new ByteArrayInputStream(xmlByte), streamName).get(0); + } catch (IOException | InvalidDDFFileException e) { + log.error("Could not parse the XML file [{}]", streamName, e); + return null; + } + } } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java index 150fe9b5d0..5b6ec23a6e 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportHandler.java @@ -35,6 +35,7 @@ import org.eclipse.leshan.server.californium.LeshanServerBuilder; import org.nustaq.serialization.FSTConfiguration; import org.thingsboard.server.common.data.DeviceProfile; import org.thingsboard.server.common.data.device.profile.Lwm2mDeviceProfileTransportConfiguration; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.transport.TransportServiceCallback; import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClient; import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientProfile; @@ -45,7 +46,6 @@ import java.util.Arrays; import java.util.Date; import java.util.LinkedList; import java.util.Optional; -import java.util.UUID; @Slf4j //@Component("LwM2MTransportHandler") @@ -189,7 +189,7 @@ public class LwM2mTransportHandler { return null; } - public static LwM2mClientProfile getNewProfileParameters(JsonObject profilesConfigData, UUID tenantId) { + public static LwM2mClientProfile getNewProfileParameters(JsonObject profilesConfigData, TenantId tenantId) { LwM2mClientProfile lwM2MClientProfile = new LwM2mClientProfile(); lwM2MClientProfile.setTenantId(tenantId); lwM2MClientProfile.setPostClientLwM2mSettings(profilesConfigData.get(CLIENT_LWM2M_SETTINGS).getAsJsonObject()); @@ -223,7 +223,7 @@ public class LwM2mTransportHandler { ObjectMapper mapper = new ObjectMapper(); String profileStr = mapper.writeValueAsString(profile); JsonObject profileJson = (profileStr != null) ? validateJson(profileStr) : null; - return (getValidateCredentialsBodyFromThingsboard(profileJson)) ? LwM2mTransportHandler.getNewProfileParameters(profileJson, deviceProfile.getTenantId().getId()) : null; + return (getValidateCredentialsBodyFromThingsboard(profileJson)) ? LwM2mTransportHandler.getNewProfileParameters(profileJson, deviceProfile.getTenantId()) : null; } catch (IOException e) { log.error("", e); } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java index fc14b9c080..fa7f0d68b8 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportRequest.java @@ -87,9 +87,6 @@ public class LwM2mTransportRequest { private final LeshanServer leshanServer; -// @Autowired -// private LwM2mTransportServiceImpl serviceImpl; - private final LwM2mTransportServiceImpl serviceImpl; public LwM2mTransportRequest(LwM2mTransportContextServer context, LwM2mClientContext lwM2mClientContext, LeshanServer leshanServer, LwM2mTransportServiceImpl serviceImpl) { @@ -232,6 +229,7 @@ public class LwM2mTransportRequest { private void sendRequest(Registration registration, DownlinkRequest request, long timeoutInMs) { LwM2mClient lwM2MClient = lwM2mClientContext.getLwM2mClientWithReg(registration, null); leshanServer.send(registration, request, timeoutInMs, (ResponseCallback) response -> { + if (!lwM2MClient.isInit()) { lwM2MClient.initValue(this.serviceImpl, request.getPath().toString()); } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java index 7fa417b145..0af20b3e51 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServerConfiguration.java @@ -27,7 +27,6 @@ import org.eclipse.leshan.server.model.LwM2mModelProvider; import org.eclipse.leshan.server.security.DefaultAuthorizer; import org.eclipse.leshan.server.security.EditableSecurityStore; import org.eclipse.leshan.server.security.SecurityChecker; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; @@ -61,24 +60,23 @@ import static org.eclipse.californium.scandium.dtls.cipher.CipherSuite.TLS_PSK_W import static org.thingsboard.server.transport.lwm2m.server.LwM2mTransportHandler.getCoapConfig; @Slf4j -@Component("LwM2MTransportServerConfiguration") +@Component @TbLwM2mTransportComponent public class LwM2mTransportServerConfiguration { private PublicKey publicKey; private PrivateKey privateKey; private boolean pskMode = false; + private final LwM2mTransportContextServer context; + private final CaliforniumRegistrationStore registrationStore; + private final EditableSecurityStore securityStore; + private final LwM2mClientContext lwM2mClientContext; - @Autowired - private LwM2mTransportContextServer context; - - @Autowired - private CaliforniumRegistrationStore registrationStore; - - @Autowired - private EditableSecurityStore securityStore; - - @Autowired - private LwM2mClientContext lwM2mClientContext;; + public LwM2mTransportServerConfiguration(LwM2mTransportContextServer context, CaliforniumRegistrationStore registrationStore, EditableSecurityStore securityStore, LwM2mClientContext lwM2mClientContext) { + this.context = context; + this.registrationStore = registrationStore; + this.securityStore = securityStore; + this.lwM2mClientContext = lwM2mClientContext; + } @Bean public LeshanServer getLeshanServer() { @@ -98,10 +96,8 @@ public class LwM2mTransportServerConfiguration { builder.setCoapConfig(getCoapConfig(serverPortNoSec, serverSecurePort)); /** Define model provider (Create Models )*/ -// TransportProtos.GetResourcesResponseMsg responseMsg= this.context.getResourceTenantProcess(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); -// TransportProtos.GetResourcesResponseMsg responseMsg= this.context.getResourceTenant(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); -// LwM2mModelProvider modelProvider = new VersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueCommon()); - LwM2mModelProvider modelProvider = new LwM2mVersionedModelProvider(this.context.getLwM2MTransportConfigServer().getModelsValueServer(), this.lwM2mClientContext); + LwM2mModelProvider modelProvider = new LwM2mVersionedModelProvider(this.lwM2mClientContext, this.context); + this.context.getLwM2MTransportConfigServer().setModelProvider(modelProvider); builder.setObjectModelProvider(modelProvider); /** Create credentials */ diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java index df469d5a96..1af4e8bfd8 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mTransportServiceImpl.java @@ -153,11 +153,6 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { executorRegistered.submit(() -> { try { log.warn("[{}] [{{}] Client: create after Registration", registration.getEndpoint(), registration.getId()); - ((LwM2mVersionedModelProvider)leshanServer.getModelProvider()).setRepository(this.lwM2mTransportContextServer.getLwM2MTransportConfigServer().getModelsValueCommon()); -// TransportProtos.GetResourcesResponseMsg responseMsg= this.lwM2mTransportContextServer.getResourceTenantProcess(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); -// TransportProtos.GetResourcesResponseMsg responseMsg= this.lwM2mTransportContextServer.getResourceTenant(TenantId.SYS_TENANT_ID.getId(), ResourceType.LWM2M_MODEL.name()); - - // (((VersionedModelProvider) (leshanServer)).modelProvider).repository; LwM2mClient lwM2MClient = this.lwM2mClientContext.updateInSessionsLwM2MClient(registration); if (lwM2MClient != null) { SessionInfoProto sessionInfo = this.getValidateSessionInfo(registration); @@ -657,21 +652,6 @@ public class LwM2mTransportServiceImpl implements LwM2mTransportService { return (clientInstances.size() > 0) ? clientInstances : null; } -// /** -// * get AttrName/TelemetryName with value from Client -// * -// * @param registration - -// * @return - JsonObject, format: {name: value}} -// */ -// private JsonObject getAttributeClient(Registration registration) { -// if (registration.getAdditionalRegistrationAttributes().size() > 0) { -// JsonObject resNameValues = new JsonObject(); -// registration.getAdditionalRegistrationAttributes().forEach(resNameValues::addProperty); -// return resNameValues; -// } -// return null; -// } - /** * @param attributes - new JsonObject * @param telemetry - new JsonObject diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java index 64e9f67199..503af176af 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/LwM2mVersionedModelProvider.java @@ -15,100 +15,122 @@ */ package org.thingsboard.server.transport.lwm2m.server; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.leshan.core.model.DefaultDDFFileValidator; import org.eclipse.leshan.core.model.LwM2mModel; -import org.eclipse.leshan.core.model.LwM2mModelRepository; import org.eclipse.leshan.core.model.ObjectModel; import org.eclipse.leshan.core.model.ResourceModel; import org.eclipse.leshan.server.model.LwM2mModelProvider; import org.eclipse.leshan.server.registration.Registration; +import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.transport.lwm2m.server.client.LwM2mClientContext; import java.util.ArrayList; +import java.util.Base64; import java.util.Collection; +import java.util.Iterator; import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -public class LwM2mVersionedModelProvider implements LwM2mModelProvider { +import static org.thingsboard.server.common.data.ResourceType.LWM2M_MODEL; - private LwM2mModelRepository repository; - private Map repositoriesTenant; - private LwM2mClientContext lwM2mClientContext; +@Slf4j +public class LwM2mVersionedModelProvider implements LwM2mModelProvider { - public LwM2mVersionedModelProvider(Collection objectModels, LwM2mClientContext lwM2mClientContext) { - this.repository = new LwM2mModelRepository(objectModels); - this.lwM2mClientContext = lwM2mClientContext; - this.repositoriesTenant = new ConcurrentHashMap<>(); - } + /** + * int objectId + * String version ("1.01") + * Key = objectId + "##" + version + * Value = TenantId + */ + private final LwM2mClientContext lwM2mClientContext; + private final LwM2mTransportContextServer lwM2mTransportContextServer; - public LwM2mVersionedModelProvider(LwM2mModelRepository repository, LwM2mClientContext lwM2mClientContext) { - this.repository = repository; + public LwM2mVersionedModelProvider(LwM2mClientContext lwM2mClientContext, LwM2mTransportContextServer lwM2mTransportContextServer) { this.lwM2mClientContext = lwM2mClientContext; - this.repositoriesTenant = new ConcurrentHashMap<>(); + this.lwM2mTransportContextServer = lwM2mTransportContextServer; } - - public void setRepositoriesTenant (String tenantID, LwM2mModelRepository repositoryTenant) { - this.repositoriesTenant.put(tenantID, repositoryTenant); + private String getIdVer(ObjectModel objectModel) { + return objectModel.id + "##" + ((objectModel.getVersion() == null || objectModel.getVersion().isEmpty()) ? ObjectModel.DEFAULT_VERSION : objectModel.getVersion()); } - public LwM2mModelRepository getRepositoriesTenant (String tenantID) { - return this.repositoriesTenant.get(tenantID); - } - - public void setRepository (Collection objectModels) { - this.repository = new LwM2mModelRepository(objectModels); - } - - public LwM2mModelRepository getRepositoriesCommonTenant (String tenantID) { - LwM2mModelRepository repository = new LwM2mModelRepository(); - - return repository; + private String getIdVer(Integer objectId, String version) { + return objectId != null ? objectId + "##" + ((version == null || version.isEmpty()) ? ObjectModel.DEFAULT_VERSION : version) : null; } + /** + * Update repository if need + * + * @param registration + * @return + */ @Override public LwM2mModel getObjectModel(Registration registration) { - return new DynamicModel(registration, this.lwM2mClientContext.getProfile(registration).getTenantId()); + return new DynamicModel(registration + ); } private class DynamicModel implements LwM2mModel { private final Registration registration; - private final UUID tenantId; + private final TenantId tenantId; - public DynamicModel(Registration registration, UUID tenantId) { + public DynamicModel(Registration registration) { this.registration = registration; - this.tenantId = tenantId; + this.tenantId = lwM2mClientContext.getProfile(registration).getTenantId(); } @Override public ResourceModel getResourceModel(int objectId, int resourceId) { - ObjectModel objectModel = getObjectModel(objectId); - if (objectModel != null) - return objectModel.resources.get(resourceId); - else + try { + ObjectModel objectModel = getObjectModel(objectId); + if (objectModel != null) + return objectModel.resources.get(resourceId); + else + return null; + } catch (Exception e) { + log.error("", e); return null; + } } @Override public ObjectModel getObjectModel(int objectId) { String version = registration.getSupportedVersion(objectId); if (version != null) { - return repository.getObjectModel(objectId, version); + return this.getObjectModelDynamic(objectId, version); } return null; } @Override public Collection getObjectModels() { - Map supportedObjects = registration.getSupportedObject(); - Collection result = new ArrayList<>(supportedObjects.size()); - for (Map.Entry supportedObject : supportedObjects.entrySet()) { - ObjectModel objectModel = repository.getObjectModel(supportedObject.getKey(), - supportedObject.getValue()); - if (objectModel != null) + Map supportedObjects = this.registration.getSupportedObject(); + Collection result = new ArrayList(supportedObjects.size()); + Iterator i$ = supportedObjects.entrySet().iterator(); + + while (i$.hasNext()) { + Map.Entry supportedObject = (Map.Entry) i$.next(); + ObjectModel objectModel = this.getObjectModelDynamic((Integer) supportedObject.getKey(), (String) supportedObject.getValue()); + if (objectModel != null) { result.add(objectModel); + } } return result; } + + private ObjectModel getObjectModelDynamic(Integer objectId, String version) { + String key = getIdVer(objectId, version); + String xmlB64 = lwM2mTransportContextServer.getTransportResourceCache().get( + this.tenantId, + LWM2M_MODEL, + key). + getValue(); + return xmlB64 != null && !xmlB64.isEmpty() ? + lwM2mTransportContextServer.parseFromXmlToObjectModel( + Base64.getDecoder().decode(xmlB64), + key + ".xml", + new DefaultDDFFileValidator()) : + null; + } } } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java index b41e7cfdaa..d30628a43f 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientContextImpl.java @@ -168,5 +168,4 @@ public class LwM2mClientContextImpl implements LwM2mClientContext { } return false; } - } diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java index dcda2cc62b..8285c9bc8b 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/client/LwM2mClientProfile.java @@ -19,13 +19,12 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import lombok.Data; - -import java.util.UUID; +import org.thingsboard.server.common.data.id.TenantId; @Data public class LwM2mClientProfile { - private UUID tenantId; + private TenantId tenantId; /** * {"clientLwM2mSettings": { * clientUpdateValueAfterConnect: false; diff --git a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java index 136de3eb95..85283749dc 100644 --- a/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java +++ b/common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/utils/LwM2mValueConverterImpl.java @@ -31,6 +31,8 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; +import static org.eclipse.leshan.core.model.ResourceModel.Type.OPAQUE; + @Slf4j public class LwM2mValueConverterImpl implements LwM2mValueConverter { @@ -52,6 +54,9 @@ public class LwM2mValueConverterImpl implements LwM2mValueConverter { /** expected type */ return value; } + if (currentType == null) { + currentType = OPAQUE; + } switch (expectedType) { case INTEGER: diff --git a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java index 4e57e61190..1208ace313 100644 --- a/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java +++ b/common/transport/transport-api/src/main/java/org/thingsboard/server/common/transport/lwm2m/LwM2MTransportConfigServer.java @@ -18,10 +18,10 @@ package org.thingsboard.server.common.transport.lwm2m; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; -import org.eclipse.leshan.core.model.ObjectLoader; import org.eclipse.leshan.core.model.ObjectModel; import org.eclipse.leshan.core.model.ResourceModel; import org.eclipse.leshan.core.node.LwM2mPath; +import org.eclipse.leshan.server.model.LwM2mModelProvider; import org.eclipse.leshan.server.registration.Registration; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; @@ -38,9 +38,7 @@ import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; -import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; @Slf4j @Component @@ -87,7 +85,7 @@ public class LwM2MTransportConfigServer { @Getter @Setter - private List modelsValueServer; + private LwM2mModelProvider modelProvider; @Getter @Value("${transport.lwm2m.timeout:}") @@ -189,35 +187,11 @@ public class LwM2MTransportConfigServer { @Value("${transport.lwm2m.server.secure.alias:}") private String serverAlias; - - @PostConstruct public void init() { - modelsValueServer = ObjectLoader.loadDefault(); - modelsValueServer.remove(3); - modelsValueCommon = ObjectLoader.loadDefault(); - File path = getPathModels(); - if (path.isDirectory()) { - try { - modelsValueCommon.addAll(ObjectLoader.loadObjectsFromDir(path)); - log.info(" [{}] Models directory is a directory", path.getAbsoluteFile()); - } catch (Exception e) { - log.error(" [{}] Could not parse the resource definition file", e.toString()); - } - } else { - log.error(" [{}] Read Models", path.getAbsoluteFile()); - } this.getInKeyStore(); } - private File getPathModels() { - Path pathModels = (modelPathFile != null && !modelPathFile.isEmpty()) ? Paths.get(modelPathFile) : - (new File(Paths.get(getBaseDirPath(), PATH_DATA, MODEL_PATH_DEFAULT).toUri()).isDirectory()) ? - Paths.get(getBaseDirPath(), PATH_DATA, MODEL_PATH_DEFAULT) : - Paths.get(getBaseDirPath(), APP_DIR, TRANSPORT_DIR, LWM2M_DIR, SRC_DIR, MAIN_DIR, RESOURCES_DIR, MODEL_PATH_DEFAULT); - return (pathModels != null) ? new File(pathModels.toUri()) : null; - } - private KeyStore getInKeyStore() { try { if (keyStoreValue != null && keyStoreValue.size() > 0) @@ -260,12 +234,7 @@ public class LwM2MTransportConfigServer { } public ResourceModel getResourceModel(Registration registration, LwM2mPath pathIds) { - String pathLink = "/" + pathIds.getObjectId() + "/" + pathIds.getObjectInstanceId(); - return (Arrays.stream(registration.getObjectLinks()).filter(p-> p.getUrl().equals(pathLink)).findFirst().isPresent() && - this.modelsValueCommon.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).size() > 0) && - this.modelsValueCommon.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0).resources.containsKey(pathIds.getResourceId()) ? - this.modelsValueCommon.stream().filter(v -> v.id == pathIds.getObjectId()).collect(Collectors.toList()).get(0).resources.get(pathIds.getResourceId()) : - null; + return this.modelProvider.getObjectModel(registration).getResourceModel(pathIds.getObjectId(), pathIds.getResourceId()); } public ResourceModel.Type getResourceModelType(Registration registration, LwM2mPath pathIds) { diff --git a/pom.xml b/pom.xml index 7e12adff98..4f8c7d3790 100755 --- a/pom.xml +++ b/pom.xml @@ -66,9 +66,9 @@ 2.12.1 2.2.6 2.6.1 - 1.3.0 - 1.3.0 - 1.3.0 + 1.3.1 + 1.3.1 + 1.3.1 2.6.2 2.3.30 1.6.2 From e30ec49d2bfc9a2e6c35e7c88370e8f779361d9f Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Mon, 15 Mar 2021 17:09:35 +0200 Subject: [PATCH 67/69] [3.3] [PROD-806] Implement alarm condition metadata displaying (#4185) * Implement alarm condition metadata displaying * Refactor --- .../server/common/data/DataConstants.java | 2 + .../rule/engine/profile/AlarmState.java | 19 +++- .../rule/engine/profile/AlarmStateTest.java | 87 +++++++++++++++++++ 3 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/AlarmStateTest.java diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java b/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java index cc78e2cb45..39fa30b07f 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/DataConstants.java @@ -33,6 +33,8 @@ public class DataConstants { public static final String IS_EXISTING_ALARM = "isExistingAlarm"; public static final String IS_SEVERITY_UPDATED_ALARM = "isSeverityUpdated"; public static final String IS_CLEARED_ALARM = "isClearedAlarm"; + public static final String ALARM_CONDITION_REPEATS = "alarmConditionRepeats"; + public static final String ALARM_CONDITION_DURATION = "alarmConditionDuration"; public static final String[] allScopes() { return new String[]{CLIENT_SCOPE, SHARED_SCOPE, SERVER_SCOPE}; diff --git a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java index 78092f5473..d59ffee3ea 100644 --- a/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java +++ b/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/profile/AlarmState.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.rule.engine.action.TbAlarmResult; import org.thingsboard.rule.engine.api.TbContext; import org.thingsboard.rule.engine.profile.state.PersistedAlarmRuleState; @@ -28,6 +29,7 @@ import org.thingsboard.server.common.data.DataConstants; import org.thingsboard.server.common.data.alarm.Alarm; import org.thingsboard.server.common.data.alarm.AlarmSeverity; import org.thingsboard.server.common.data.alarm.AlarmStatus; +import org.thingsboard.server.common.data.device.profile.AlarmConditionSpecType; import org.thingsboard.server.common.data.device.profile.AlarmConditionKeyType; import org.thingsboard.server.common.data.device.profile.DeviceProfileAlarm; import org.thingsboard.server.common.data.id.EntityId; @@ -36,7 +38,6 @@ import org.thingsboard.server.common.data.query.KeyFilter; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.common.msg.TbMsgMetaData; import org.thingsboard.server.common.msg.queue.ServiceQueue; -import org.thingsboard.common.util.JacksonUtil; import java.util.ArrayList; import java.util.Comparator; @@ -101,7 +102,7 @@ class AlarmState { if (resultState != null) { TbAlarmResult result = calculateAlarmResult(ctx, resultState); if (result != null) { - pushMsg(ctx, result); + pushMsg(ctx, result, resultState); } stateUpdate = clearAlarmState(stateUpdate, clearState); } else if (currentAlarm != null && clearState != null) { @@ -116,7 +117,7 @@ class AlarmState { stateUpdate = clearAlarmState(stateUpdate, state); } ctx.getAlarmService().clearAlarm(ctx.getTenantId(), currentAlarm.getId(), createDetails(clearState), System.currentTimeMillis()); - pushMsg(ctx, new TbAlarmResult(false, false, true, currentAlarm)); + pushMsg(ctx, new TbAlarmResult(false, false, true, currentAlarm), clearState); currentAlarm = null; } else if (AlarmEvalResult.FALSE.equals(evalResult)) { stateUpdate = clearAlarmState(stateUpdate, clearState); @@ -155,7 +156,7 @@ class AlarmState { } } - public void pushMsg(TbContext ctx, TbAlarmResult alarmResult) { + public void pushMsg(TbContext ctx, TbAlarmResult alarmResult, AlarmRuleState ruleState) { JsonNode jsonNodes = JacksonUtil.valueToTree(alarmResult.getAlarm()); String data = jsonNodes.toString(); TbMsgMetaData metaData = lastMsgMetaData != null ? lastMsgMetaData.copy() : new TbMsgMetaData(); @@ -174,10 +175,20 @@ class AlarmState { relationType = "Alarm Cleared"; metaData.putValue(DataConstants.IS_CLEARED_ALARM, Boolean.TRUE.toString()); } + setAlarmConditionMetadata(ruleState, metaData); TbMsg newMsg = ctx.newMsg(lastMsgQueueName != null ? lastMsgQueueName : ServiceQueue.MAIN, "ALARM", originator, metaData, data); ctx.tellNext(newMsg, relationType); } + protected void setAlarmConditionMetadata(AlarmRuleState ruleState, TbMsgMetaData metaData) { + if (ruleState.getSpec().getType() == AlarmConditionSpecType.REPEATING) { + metaData.putValue(DataConstants.ALARM_CONDITION_REPEATS, String.valueOf(ruleState.getState().getEventCount())); + } + if (ruleState.getSpec().getType() == AlarmConditionSpecType.DURATION) { + metaData.putValue(DataConstants.ALARM_CONDITION_DURATION, String.valueOf(ruleState.getState().getDuration())); + } + } + public void updateState(DeviceProfileAlarm alarm, PersistedAlarmState alarmState) { this.alarmDefinition = alarm; this.createRulesSortedBySeverityDesc = new ArrayList<>(); diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/AlarmStateTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/AlarmStateTest.java new file mode 100644 index 0000000000..c7b9eb8a12 --- /dev/null +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/profile/AlarmStateTest.java @@ -0,0 +1,87 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.rule.engine.profile; + +import org.junit.Test; +import org.thingsboard.server.common.data.DataConstants; +import org.thingsboard.server.common.data.device.profile.AlarmCondition; +import org.thingsboard.server.common.data.device.profile.AlarmConditionSpec; +import org.thingsboard.server.common.data.device.profile.AlarmConditionSpecType; +import org.thingsboard.server.common.data.device.profile.AlarmRule; +import org.thingsboard.server.common.data.device.profile.DeviceProfileAlarm; +import org.thingsboard.server.common.data.device.profile.DurationAlarmConditionSpec; +import org.thingsboard.server.common.data.device.profile.RepeatingAlarmConditionSpec; +import org.thingsboard.server.common.msg.TbMsgMetaData; + +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; + +public class AlarmStateTest { + + @Test + public void testSetAlarmConditionMetadata_repeatingCondition() { + AlarmRuleState ruleState = createMockAlarmRuleState(new RepeatingAlarmConditionSpec()); + int eventCount = 3; + ruleState.getState().setEventCount(eventCount); + + AlarmState alarmState = createMockAlarmState(); + TbMsgMetaData metaData = new TbMsgMetaData(); + + alarmState.setAlarmConditionMetadata(ruleState, metaData); + + assertEquals(AlarmConditionSpecType.REPEATING, ruleState.getSpec().getType()); + assertNotNull(metaData.getValue(DataConstants.ALARM_CONDITION_REPEATS)); + assertNull(metaData.getValue(DataConstants.ALARM_CONDITION_DURATION)); + assertEquals(String.valueOf(eventCount), metaData.getValue(DataConstants.ALARM_CONDITION_REPEATS)); + } + + @Test + public void testSetAlarmConditionMetadata_durationCondition() { + DurationAlarmConditionSpec spec = new DurationAlarmConditionSpec(); + spec.setUnit(TimeUnit.SECONDS); + AlarmRuleState ruleState = createMockAlarmRuleState(spec); + int duration = 12; + ruleState.getState().setDuration(duration); + + AlarmState alarmState = createMockAlarmState(); + TbMsgMetaData metaData = new TbMsgMetaData(); + + alarmState.setAlarmConditionMetadata(ruleState, metaData); + + assertEquals(AlarmConditionSpecType.DURATION, ruleState.getSpec().getType()); + assertNotNull(metaData.getValue(DataConstants.ALARM_CONDITION_DURATION)); + assertNull(metaData.getValue(DataConstants.ALARM_CONDITION_REPEATS)); + assertEquals(String.valueOf(duration), metaData.getValue(DataConstants.ALARM_CONDITION_DURATION)); + } + + private AlarmRuleState createMockAlarmRuleState(AlarmConditionSpec spec) { + AlarmCondition alarmCondition = new AlarmCondition(); + alarmCondition.setSpec(spec); + + AlarmRule alarmRule = new AlarmRule(); + alarmRule.setCondition(alarmCondition); + + return new AlarmRuleState(null, alarmRule, null, null, null); + } + + private AlarmState createMockAlarmState() { + return new AlarmState(null, null, mock(DeviceProfileAlarm.class), null, null); + } +} From bc6efa5e1e339b07e8b20ac2b59d26eb2713cd4f Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Mon, 15 Mar 2021 17:11:23 +0200 Subject: [PATCH 68/69] [3.3] [PROD-685] Provide user's session expiration when his auth data is changed (#4201) * Provide user's session expiration when his auth data is changed * Provide mock TokenOutdatingService for dao tests * Increase time gap when checking if token is outdated * Add license header for TokenOutdatingTest * Refactor tokens outdating functionality to events usage * Reset tokens on front-end after changing password --- .../server/config/JwtSettings.java | 2 +- .../server/controller/AuthController.java | 61 +++--- .../server/controller/UserController.java | 28 +-- .../security/auth/TokenOutdatingService.java | 85 ++++++++ .../auth/jwt/JwtAuthenticationProvider.java | 17 +- .../RefreshTokenAuthenticationProvider.java | 21 +- .../auth/jwt/RefreshTokenRepository.java | 2 +- .../Oauth2AuthenticationSuccessHandler.java | 3 +- ...RestAwareAuthenticationSuccessHandler.java | 2 +- .../exception/JwtExpiredTokenException.java | 2 +- .../security/model/token/AccessJwtToken.java | 1 + .../security/model/token/JwtTokenFactory.java | 26 ++- .../model/token/RawAccessJwtToken.java | 33 +--- .../src/main/resources/thingsboard.yml | 3 + .../security/auth/TokenOutdatingTest.java | 184 ++++++++++++++++++ .../server/common/data/CacheConstants.java | 1 + .../event/UserAuthDataChangedEvent.java | 30 +++ .../common/data/security/model}/JwtToken.java | 2 +- .../server/dao/user/UserServiceImpl.java | 39 ++-- ui-ngx/src/app/core/auth/auth.service.ts | 7 +- 20 files changed, 427 insertions(+), 122 deletions(-) create mode 100644 application/src/main/java/org/thingsboard/server/service/security/auth/TokenOutdatingService.java create mode 100644 application/src/test/java/org/thingsboard/server/service/security/auth/TokenOutdatingTest.java create mode 100644 common/data/src/main/java/org/thingsboard/server/common/data/security/event/UserAuthDataChangedEvent.java rename {application/src/main/java/org/thingsboard/server/service/security/model/token => common/data/src/main/java/org/thingsboard/server/common/data/security/model}/JwtToken.java (92%) diff --git a/application/src/main/java/org/thingsboard/server/config/JwtSettings.java b/application/src/main/java/org/thingsboard/server/config/JwtSettings.java index 6e19cfb729..04a6f5a9b4 100644 --- a/application/src/main/java/org/thingsboard/server/config/JwtSettings.java +++ b/application/src/main/java/org/thingsboard/server/config/JwtSettings.java @@ -17,7 +17,7 @@ package org.thingsboard.server.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; -import org.thingsboard.server.service.security.model.token.JwtToken; +import org.thingsboard.server.common.data.security.model.JwtToken; @Configuration @ConfigurationProperties(prefix = "security.jwt") diff --git a/application/src/main/java/org/thingsboard/server/controller/AuthController.java b/application/src/main/java/org/thingsboard/server/controller/AuthController.java index 3f77da93f7..d281de9009 100644 --- a/application/src/main/java/org/thingsboard/server/controller/AuthController.java +++ b/application/src/main/java/org/thingsboard/server/controller/AuthController.java @@ -18,8 +18,9 @@ package org.thingsboard.server.controller; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; +import org.thingsboard.common.util.JacksonUtil; import org.thingsboard.rule.engine.api.MailService; import org.thingsboard.server.common.data.User; import org.thingsboard.server.common.data.audit.ActionType; @@ -39,48 +41,37 @@ import org.thingsboard.server.common.data.exception.ThingsboardErrorCode; import org.thingsboard.server.common.data.exception.ThingsboardException; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.security.UserCredentials; +import org.thingsboard.server.common.data.security.event.UserAuthDataChangedEvent; +import org.thingsboard.server.common.data.security.model.JwtToken; +import org.thingsboard.server.common.data.security.model.SecuritySettings; +import org.thingsboard.server.common.data.security.model.UserPasswordPolicy; import org.thingsboard.server.dao.audit.AuditLogService; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository; import org.thingsboard.server.service.security.auth.rest.RestAuthenticationDetails; -import org.thingsboard.server.common.data.security.model.SecuritySettings; import org.thingsboard.server.service.security.model.SecurityUser; -import org.thingsboard.server.common.data.security.model.UserPasswordPolicy; import org.thingsboard.server.service.security.model.UserPrincipal; -import org.thingsboard.server.service.security.model.token.JwtToken; import org.thingsboard.server.service.security.model.token.JwtTokenFactory; import org.thingsboard.server.service.security.system.SystemSecurityService; -import org.thingsboard.server.utils.MiscUtils; import ua_parser.Client; import javax.servlet.http.HttpServletRequest; import java.net.URI; import java.net.URISyntaxException; -import java.util.List; @RestController @TbCoreComponent @RequestMapping("/api") @Slf4j +@RequiredArgsConstructor public class AuthController extends BaseController { - - @Autowired - private BCryptPasswordEncoder passwordEncoder; - - @Autowired - private JwtTokenFactory tokenFactory; - - @Autowired - private RefreshTokenRepository refreshTokenRepository; - - @Autowired - private MailService mailService; - - @Autowired - private SystemSecurityService systemSecurityService; - - @Autowired - private AuditLogService auditLogService; + private final BCryptPasswordEncoder passwordEncoder; + private final JwtTokenFactory tokenFactory; + private final RefreshTokenRepository refreshTokenRepository; + private final MailService mailService; + private final SystemSecurityService systemSecurityService; + private final AuditLogService auditLogService; + private final ApplicationEventPublisher eventPublisher; @PreAuthorize("isAuthenticated()") @RequestMapping(value = "/auth/user", method = RequestMethod.GET) @@ -103,8 +94,7 @@ public class AuthController extends BaseController { @PreAuthorize("isAuthenticated()") @RequestMapping(value = "/auth/changePassword", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) - public void changePassword ( - @RequestBody JsonNode changePasswordRequest) throws ThingsboardException { + public ObjectNode changePassword(@RequestBody JsonNode changePasswordRequest) throws ThingsboardException { try { String currentPassword = changePasswordRequest.get("currentPassword").asText(); String newPassword = changePasswordRequest.get("newPassword").asText(); @@ -119,6 +109,12 @@ public class AuthController extends BaseController { } userCredentials.setPassword(passwordEncoder.encode(newPassword)); userService.replaceUserCredentials(securityUser.getTenantId(), userCredentials); + + eventPublisher.publishEvent(new UserAuthDataChangedEvent(securityUser.getId())); + ObjectNode response = JacksonUtil.newObjectNode(); + response.put("token", tokenFactory.createAccessJwtToken(securityUser).getToken()); + response.put("refreshToken", tokenFactory.createRefreshToken(securityUser).getToken()); + return response; } catch (Exception e) { throw handleException(e); } @@ -135,7 +131,7 @@ public class AuthController extends BaseController { throw handleException(e); } } - + @RequestMapping(value = "/noauth/activate", params = { "activateToken" }, method = RequestMethod.GET) public ResponseEntity checkActivateToken( @RequestParam(value = "activateToken") String activateToken) { @@ -157,7 +153,7 @@ public class AuthController extends BaseController { } return new ResponseEntity<>(headers, responseStatus); } - + @RequestMapping(value = "/noauth/resetPasswordByEmail", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public void requestResetPasswordByEmail ( @@ -170,13 +166,13 @@ public class AuthController extends BaseController { String baseUrl = systemSecurityService.getBaseUrl(user.getTenantId(), user.getCustomerId(), request); String resetUrl = String.format("%s/api/noauth/resetPassword?resetToken=%s", baseUrl, userCredentials.getResetToken()); - + mailService.sendResetPasswordEmail(resetUrl, email); } catch (Exception e) { throw handleException(e); } } - + @RequestMapping(value = "/noauth/resetPassword", params = { "resetToken" }, method = RequestMethod.GET) public ResponseEntity checkResetToken( @RequestParam(value = "resetToken") String resetToken) { @@ -198,7 +194,7 @@ public class AuthController extends BaseController { } return new ResponseEntity<>(headers, responseStatus); } - + @RequestMapping(value = "/noauth/activate", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) @ResponseBody @@ -240,7 +236,7 @@ public class AuthController extends BaseController { throw handleException(e); } } - + @RequestMapping(value = "/noauth/resetPassword", method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) @ResponseBody @@ -268,6 +264,7 @@ public class AuthController extends BaseController { String email = user.getEmail(); mailService.sendPasswordWasResetEmail(loginUrl, email); + eventPublisher.publishEvent(new UserAuthDataChangedEvent(securityUser.getId())); JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser); JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser); diff --git a/application/src/main/java/org/thingsboard/server/controller/UserController.java b/application/src/main/java/org/thingsboard/server/controller/UserController.java index e1c3328176..ca3ecdc36c 100644 --- a/application/src/main/java/org/thingsboard/server/controller/UserController.java +++ b/application/src/main/java/org/thingsboard/server/controller/UserController.java @@ -19,8 +19,9 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import lombok.Getter; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PathVariable; @@ -44,11 +45,12 @@ import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.common.data.security.UserCredentials; +import org.thingsboard.server.common.data.security.event.UserAuthDataChangedEvent; +import org.thingsboard.server.common.data.security.model.JwtToken; import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository; import org.thingsboard.server.service.security.model.SecurityUser; import org.thingsboard.server.service.security.model.UserPrincipal; -import org.thingsboard.server.service.security.model.token.JwtToken; import org.thingsboard.server.service.security.model.token.JwtTokenFactory; import org.thingsboard.server.service.security.permission.Operation; import org.thingsboard.server.service.security.permission.Resource; @@ -56,6 +58,7 @@ import org.thingsboard.server.service.security.system.SystemSecurityService; import javax.servlet.http.HttpServletRequest; +@RequiredArgsConstructor @RestController @TbCoreComponent @RequestMapping("/api") @@ -69,18 +72,11 @@ public class UserController extends BaseController { @Getter private boolean userTokenAccessEnabled; - @Autowired - private MailService mailService; - - @Autowired - private JwtTokenFactory tokenFactory; - - @Autowired - private RefreshTokenRepository refreshTokenRepository; - - @Autowired - private SystemSecurityService systemSecurityService; - + private final MailService mailService; + private final JwtTokenFactory tokenFactory; + private final RefreshTokenRepository refreshTokenRepository; + private final SystemSecurityService systemSecurityService; + private final ApplicationEventPublisher eventPublisher; @PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')") @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET) @@ -341,6 +337,10 @@ public class UserController extends BaseController { User user = checkUserId(userId, Operation.WRITE); TenantId tenantId = getCurrentUser().getTenantId(); userService.setUserCredentialsEnabled(tenantId, userId, userCredentialsEnabled); + + if (!userCredentialsEnabled) { + eventPublisher.publishEvent(new UserAuthDataChangedEvent(userId)); + } } catch (Exception e) { throw handleException(e); } diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/TokenOutdatingService.java b/application/src/main/java/org/thingsboard/server/service/security/auth/TokenOutdatingService.java new file mode 100644 index 0000000000..175242b09a --- /dev/null +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/TokenOutdatingService.java @@ -0,0 +1,85 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.security.auth; + +import io.jsonwebtoken.Claims; +import lombok.RequiredArgsConstructor; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Service; +import org.thingsboard.server.common.data.CacheConstants; +import org.thingsboard.server.common.data.id.UserId; +import org.thingsboard.server.common.data.security.event.UserAuthDataChangedEvent; +import org.thingsboard.server.common.data.security.model.JwtToken; +import org.thingsboard.server.config.JwtSettings; +import org.thingsboard.server.service.security.model.token.JwtTokenFactory; + +import javax.annotation.PostConstruct; +import java.util.Optional; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; + +@Service +@RequiredArgsConstructor +public class TokenOutdatingService { + private final CacheManager cacheManager; + private final JwtTokenFactory tokenFactory; + private final JwtSettings jwtSettings; + private Cache tokenOutdatageTimeCache; + + @PostConstruct + protected void initCache() { + tokenOutdatageTimeCache = cacheManager.getCache(CacheConstants.TOKEN_OUTDATAGE_TIME_CACHE); + } + + @EventListener(classes = UserAuthDataChangedEvent.class) + public void onUserAuthDataChanged(UserAuthDataChangedEvent userAuthDataChangedEvent) { + outdateOldUserTokens(userAuthDataChangedEvent.getUserId()); + } + + public boolean isOutdated(JwtToken token, UserId userId) { + Claims claims = tokenFactory.parseTokenClaims(token).getBody(); + long issueTime = claims.getIssuedAt().getTime(); + + return Optional.ofNullable(tokenOutdatageTimeCache.get(toKey(userId), Long.class)) + .map(outdatageTime -> { + if (System.currentTimeMillis() - outdatageTime <= SECONDS.toMillis(jwtSettings.getRefreshTokenExpTime())) { + return MILLISECONDS.toSeconds(issueTime) < MILLISECONDS.toSeconds(outdatageTime); + } else { + /* + * Means that since the outdating has passed more than + * the lifetime of refresh token (the longest lived) + * and there is no need to store outdatage time anymore + * as all the tokens issued before the outdatage time + * are now expired by themselves + * */ + tokenOutdatageTimeCache.evict(toKey(userId)); + return false; + } + }) + .orElse(false); + } + + public void outdateOldUserTokens(UserId userId) { + tokenOutdatageTimeCache.put(toKey(userId), System.currentTimeMillis()); + } + + private String toKey(UserId userId) { + return userId.getId().toString(); + } +} diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/JwtAuthenticationProvider.java b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/JwtAuthenticationProvider.java index ac11e8b48d..68291c9ac0 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/JwtAuthenticationProvider.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/JwtAuthenticationProvider.java @@ -15,31 +15,34 @@ */ package org.thingsboard.server.service.security.auth.jwt; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; +import org.thingsboard.server.service.security.auth.TokenOutdatingService; import org.thingsboard.server.service.security.auth.JwtAuthenticationToken; +import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; import org.thingsboard.server.service.security.model.SecurityUser; import org.thingsboard.server.service.security.model.token.JwtTokenFactory; import org.thingsboard.server.service.security.model.token.RawAccessJwtToken; @Component -@SuppressWarnings("unchecked") +@RequiredArgsConstructor public class JwtAuthenticationProvider implements AuthenticationProvider { private final JwtTokenFactory tokenFactory; - - @Autowired - public JwtAuthenticationProvider(JwtTokenFactory tokenFactory) { - this.tokenFactory = tokenFactory; - } + private final TokenOutdatingService tokenOutdatingService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { RawAccessJwtToken rawAccessToken = (RawAccessJwtToken) authentication.getCredentials(); SecurityUser securityUser = tokenFactory.parseAccessJwtToken(rawAccessToken); + + if (tokenOutdatingService.isOutdated(rawAccessToken, securityUser.getId())) { + throw new JwtExpiredTokenException("Token is outdated"); + } + return new JwtAuthenticationToken(securityUser); } diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenAuthenticationProvider.java b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenAuthenticationProvider.java index e697ada876..7899c15b70 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenAuthenticationProvider.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenAuthenticationProvider.java @@ -15,9 +15,10 @@ */ package org.thingsboard.server.service.security.auth.jwt; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.RequiredArgsConstructor; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.CredentialsExpiredException; import org.springframework.security.authentication.DisabledException; import org.springframework.security.authentication.InsufficientAuthenticationException; import org.springframework.security.core.Authentication; @@ -32,6 +33,7 @@ import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.service.security.auth.TokenOutdatingService; import org.thingsboard.server.common.data.security.UserCredentials; import org.thingsboard.server.dao.customer.CustomerService; import org.thingsboard.server.dao.user.UserService; @@ -44,18 +46,12 @@ import org.thingsboard.server.service.security.model.token.RawAccessJwtToken; import java.util.UUID; @Component +@RequiredArgsConstructor public class RefreshTokenAuthenticationProvider implements AuthenticationProvider { - private final JwtTokenFactory tokenFactory; private final UserService userService; private final CustomerService customerService; - - @Autowired - public RefreshTokenAuthenticationProvider(final UserService userService, final CustomerService customerService, final JwtTokenFactory tokenFactory) { - this.userService = userService; - this.customerService = customerService; - this.tokenFactory = tokenFactory; - } + private final TokenOutdatingService tokenOutdatingService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { @@ -63,12 +59,18 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide RawAccessJwtToken rawAccessToken = (RawAccessJwtToken) authentication.getCredentials(); SecurityUser unsafeUser = tokenFactory.parseRefreshToken(rawAccessToken); UserPrincipal principal = unsafeUser.getUserPrincipal(); + SecurityUser securityUser; if (principal.getType() == UserPrincipal.Type.USER_NAME) { securityUser = authenticateByUserId(unsafeUser.getId()); } else { securityUser = authenticateByPublicId(principal.getValue()); } + + if (tokenOutdatingService.isOutdated(rawAccessToken, securityUser.getId())) { + throw new CredentialsExpiredException("Token is outdated"); + } + return new RefreshAuthenticationToken(securityUser); } @@ -91,7 +93,6 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide if (user.getAuthority() == null) throw new InsufficientAuthenticationException("User has no authority assigned"); UserPrincipal userPrincipal = new UserPrincipal(UserPrincipal.Type.USER_NAME, user.getEmail()); - SecurityUser securityUser = new SecurityUser(user, userCredentials.isEnabled(), userPrincipal); return securityUser; diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenRepository.java b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenRepository.java index be24f927c8..0860229e28 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenRepository.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/jwt/RefreshTokenRepository.java @@ -17,8 +17,8 @@ package org.thingsboard.server.service.security.auth.jwt; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.security.model.JwtToken; import org.thingsboard.server.service.security.model.SecurityUser; -import org.thingsboard.server.service.security.model.token.JwtToken; import org.thingsboard.server.service.security.model.token.JwtTokenFactory; @Component diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java index 3cb75501d9..72a6c65f7c 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/Oauth2AuthenticationSuccessHandler.java @@ -26,13 +26,12 @@ import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.EntityId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.oauth2.OAuth2ClientRegistrationInfo; +import org.thingsboard.server.common.data.security.model.JwtToken; import org.thingsboard.server.dao.oauth2.OAuth2Service; import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository; import org.thingsboard.server.service.security.model.SecurityUser; -import org.thingsboard.server.service.security.model.token.JwtToken; import org.thingsboard.server.service.security.model.token.JwtTokenFactory; import org.thingsboard.server.service.security.system.SystemSecurityService; -import org.thingsboard.server.utils.MiscUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/application/src/main/java/org/thingsboard/server/service/security/auth/rest/RestAwareAuthenticationSuccessHandler.java b/application/src/main/java/org/thingsboard/server/service/security/auth/rest/RestAwareAuthenticationSuccessHandler.java index a393161292..116fbe09e4 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/auth/rest/RestAwareAuthenticationSuccessHandler.java +++ b/application/src/main/java/org/thingsboard/server/service/security/auth/rest/RestAwareAuthenticationSuccessHandler.java @@ -23,9 +23,9 @@ import org.springframework.security.core.Authentication; import org.springframework.security.web.WebAttributes; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.stereotype.Component; +import org.thingsboard.server.common.data.security.model.JwtToken; import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository; import org.thingsboard.server.service.security.model.SecurityUser; -import org.thingsboard.server.service.security.model.token.JwtToken; import org.thingsboard.server.service.security.model.token.JwtTokenFactory; import javax.servlet.ServletException; diff --git a/application/src/main/java/org/thingsboard/server/service/security/exception/JwtExpiredTokenException.java b/application/src/main/java/org/thingsboard/server/service/security/exception/JwtExpiredTokenException.java index 47bd5220a3..dc4b04e87e 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/exception/JwtExpiredTokenException.java +++ b/application/src/main/java/org/thingsboard/server/service/security/exception/JwtExpiredTokenException.java @@ -16,7 +16,7 @@ package org.thingsboard.server.service.security.exception; import org.springframework.security.core.AuthenticationException; -import org.thingsboard.server.service.security.model.token.JwtToken; +import org.thingsboard.server.common.data.security.model.JwtToken; public class JwtExpiredTokenException extends AuthenticationException { private static final long serialVersionUID = -5959543783324224864L; diff --git a/application/src/main/java/org/thingsboard/server/service/security/model/token/AccessJwtToken.java b/application/src/main/java/org/thingsboard/server/service/security/model/token/AccessJwtToken.java index 4bf16d135b..a8ab344295 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/model/token/AccessJwtToken.java +++ b/application/src/main/java/org/thingsboard/server/service/security/model/token/AccessJwtToken.java @@ -17,6 +17,7 @@ package org.thingsboard.server.service.security.model.token; import com.fasterxml.jackson.annotation.JsonIgnore; import io.jsonwebtoken.Claims; +import org.thingsboard.server.common.data.security.model.JwtToken; public final class AccessJwtToken implements JwtToken { private final String rawToken; diff --git a/application/src/main/java/org/thingsboard/server/service/security/model/token/JwtTokenFactory.java b/application/src/main/java/org/thingsboard/server/service/security/model/token/JwtTokenFactory.java index cfbf051cad..9315b3bcc1 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/model/token/JwtTokenFactory.java +++ b/application/src/main/java/org/thingsboard/server/service/security/model/token/JwtTokenFactory.java @@ -16,18 +16,26 @@ package org.thingsboard.server.service.security.model.token; import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.Jws; import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.MalformedJwtException; import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.SignatureException; +import io.jsonwebtoken.UnsupportedJwtException; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.GrantedAuthority; import org.springframework.stereotype.Component; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.data.id.TenantId; import org.thingsboard.server.common.data.id.UserId; import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.common.data.security.model.JwtToken; import org.thingsboard.server.config.JwtSettings; +import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; import org.thingsboard.server.service.security.model.SecurityUser; import org.thingsboard.server.service.security.model.UserPrincipal; @@ -39,6 +47,7 @@ import java.util.UUID; import java.util.stream.Collectors; @Component +@Slf4j public class JwtTokenFactory { private static final String SCOPES = "scopes"; @@ -97,7 +106,7 @@ public class JwtTokenFactory { } public SecurityUser parseAccessJwtToken(RawAccessJwtToken rawAccessToken) { - Jws jwsClaims = rawAccessToken.parseClaims(settings.getTokenSigningKey()); + Jws jwsClaims = parseTokenClaims(rawAccessToken); Claims claims = jwsClaims.getBody(); String subject = claims.getSubject(); @SuppressWarnings("unchecked") @@ -153,7 +162,7 @@ public class JwtTokenFactory { } public SecurityUser parseRefreshToken(RawAccessJwtToken rawAccessToken) { - Jws jwsClaims = rawAccessToken.parseClaims(settings.getTokenSigningKey()); + Jws jwsClaims = parseTokenClaims(rawAccessToken); Claims claims = jwsClaims.getBody(); String subject = claims.getSubject(); @SuppressWarnings("unchecked") @@ -171,4 +180,17 @@ public class JwtTokenFactory { return securityUser; } + public Jws parseTokenClaims(JwtToken token) { + try { + return Jwts.parser() + .setSigningKey(settings.getTokenSigningKey()) + .parseClaimsJws(token.getToken()); + } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) { + log.debug("Invalid JWT Token", ex); + throw new BadCredentialsException("Invalid JWT token: ", ex); + } catch (ExpiredJwtException expiredEx) { + log.debug("JWT Token is expired", expiredEx); + throw new JwtExpiredTokenException(token, "JWT Token expired", expiredEx); + } + } } diff --git a/application/src/main/java/org/thingsboard/server/service/security/model/token/RawAccessJwtToken.java b/application/src/main/java/org/thingsboard/server/service/security/model/token/RawAccessJwtToken.java index 0e966fe678..af67706659 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/model/token/RawAccessJwtToken.java +++ b/application/src/main/java/org/thingsboard/server/service/security/model/token/RawAccessJwtToken.java @@ -15,22 +15,10 @@ */ package org.thingsboard.server.service.security.model.token; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.ExpiredJwtException; -import io.jsonwebtoken.Jws; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.MalformedJwtException; -import io.jsonwebtoken.SignatureException; -import io.jsonwebtoken.UnsupportedJwtException; -import lombok.extern.slf4j.Slf4j; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.security.authentication.BadCredentialsException; -import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; +import org.thingsboard.server.common.data.security.model.JwtToken; import java.io.Serializable; -@Slf4j public class RawAccessJwtToken implements JwtToken, Serializable { private static final long serialVersionUID = -797397445703066079L; @@ -41,25 +29,6 @@ public class RawAccessJwtToken implements JwtToken, Serializable { this.token = token; } - /** - * Parses and validates JWT Token signature. - * - * @throws BadCredentialsException - * @throws JwtExpiredTokenException - * - */ - public Jws parseClaims(String signingKey) { - try { - return Jwts.parser().setSigningKey(signingKey).parseClaimsJws(this.token); - } catch (UnsupportedJwtException | MalformedJwtException | IllegalArgumentException | SignatureException ex) { - log.debug("Invalid JWT Token", ex); - throw new BadCredentialsException("Invalid JWT token: ", ex); - } catch (ExpiredJwtException expiredEx) { - log.debug("JWT Token is expired", expiredEx); - throw new JwtExpiredTokenException(this, "JWT Token expired", expiredEx); - } - } - @Override public String getToken() { return token; diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index ea471b0e11..15243ec96a 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -362,6 +362,9 @@ caffeine: attributes: timeToLiveInMinutes: 1440 maxSize: 100000 + tokensOutdatageTime: + timeToLiveInMinutes: 20000 + maxSize: 10000 redis: # standalone or cluster diff --git a/application/src/test/java/org/thingsboard/server/service/security/auth/TokenOutdatingTest.java b/application/src/test/java/org/thingsboard/server/service/security/auth/TokenOutdatingTest.java new file mode 100644 index 0000000000..39abc09365 --- /dev/null +++ b/application/src/test/java/org/thingsboard/server/service/security/auth/TokenOutdatingTest.java @@ -0,0 +1,184 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.service.security.auth; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.cache.concurrent.ConcurrentMapCacheManager; +import org.springframework.security.authentication.CredentialsExpiredException; +import org.thingsboard.server.common.data.CacheConstants; +import org.thingsboard.server.common.data.User; +import org.thingsboard.server.common.data.id.UserId; +import org.thingsboard.server.common.data.security.Authority; +import org.thingsboard.server.common.data.security.UserCredentials; +import org.thingsboard.server.common.data.security.model.JwtToken; +import org.thingsboard.server.config.JwtSettings; +import org.thingsboard.server.dao.customer.CustomerService; +import org.thingsboard.server.dao.user.UserService; +import org.thingsboard.server.service.security.auth.jwt.JwtAuthenticationProvider; +import org.thingsboard.server.service.security.auth.jwt.RefreshTokenAuthenticationProvider; +import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; +import org.thingsboard.server.service.security.model.SecurityUser; +import org.thingsboard.server.service.security.model.UserPrincipal; +import org.thingsboard.server.service.security.model.token.JwtTokenFactory; +import org.thingsboard.server.service.security.model.token.RawAccessJwtToken; + +import java.util.UUID; + +import static java.util.concurrent.TimeUnit.DAYS; +import static java.util.concurrent.TimeUnit.MINUTES; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class TokenOutdatingTest { + private JwtAuthenticationProvider accessTokenAuthenticationProvider; + private RefreshTokenAuthenticationProvider refreshTokenAuthenticationProvider; + + private TokenOutdatingService tokenOutdatingService; + private ConcurrentMapCacheManager cacheManager; + private JwtTokenFactory tokenFactory; + private JwtSettings jwtSettings; + + private UserId userId; + + @BeforeEach + public void setUp() { + jwtSettings = new JwtSettings(); + jwtSettings.setTokenIssuer("test.io"); + jwtSettings.setTokenExpirationTime((int) MINUTES.toSeconds(10)); + jwtSettings.setRefreshTokenExpTime((int) DAYS.toSeconds(7)); + jwtSettings.setTokenSigningKey("secret"); + tokenFactory = new JwtTokenFactory(jwtSettings); + + cacheManager = new ConcurrentMapCacheManager(); + tokenOutdatingService = new TokenOutdatingService(cacheManager, tokenFactory, jwtSettings); + tokenOutdatingService.initCache(); + + userId = new UserId(UUID.randomUUID()); + + UserService userService = mock(UserService.class); + + User user = new User(); + user.setId(userId); + user.setAuthority(Authority.TENANT_ADMIN); + user.setEmail("email"); + when(userService.findUserById(any(), eq(userId))).thenReturn(user); + + UserCredentials userCredentials = new UserCredentials(); + userCredentials.setEnabled(true); + when(userService.findUserCredentialsByUserId(any(), eq(userId))).thenReturn(userCredentials); + + accessTokenAuthenticationProvider = new JwtAuthenticationProvider(tokenFactory, tokenOutdatingService); + refreshTokenAuthenticationProvider = new RefreshTokenAuthenticationProvider(tokenFactory, userService, mock(CustomerService.class), tokenOutdatingService); + } + + @Test + public void testOutdateOldUserTokens() throws Exception { + JwtToken jwtToken = createAccessJwtToken(userId); + + SECONDS.sleep(1); // need to wait before outdating so that outdatage time is strictly after token issue time + tokenOutdatingService.outdateOldUserTokens(userId); + assertTrue(tokenOutdatingService.isOutdated(jwtToken, userId)); + + SECONDS.sleep(1); + + JwtToken newJwtToken = tokenFactory.createAccessJwtToken(createMockSecurityUser(userId)); + assertFalse(tokenOutdatingService.isOutdated(newJwtToken, userId)); + } + + @Test + public void testAuthenticateWithOutdatedAccessToken() throws InterruptedException { + RawAccessJwtToken accessJwtToken = getRawJwtToken(createAccessJwtToken(userId)); + + assertDoesNotThrow(() -> { + accessTokenAuthenticationProvider.authenticate(new JwtAuthenticationToken(accessJwtToken)); + }); + + SECONDS.sleep(1); + tokenOutdatingService.outdateOldUserTokens(userId); + + assertThrows(JwtExpiredTokenException.class, () -> { + accessTokenAuthenticationProvider.authenticate(new JwtAuthenticationToken(accessJwtToken)); + }); + } + + @Test + public void testAuthenticateWithOutdatedRefreshToken() throws InterruptedException { + RawAccessJwtToken refreshJwtToken = getRawJwtToken(createRefreshJwtToken(userId)); + + assertDoesNotThrow(() -> { + refreshTokenAuthenticationProvider.authenticate(new RefreshAuthenticationToken(refreshJwtToken)); + }); + + SECONDS.sleep(1); + tokenOutdatingService.outdateOldUserTokens(userId); + + assertThrows(CredentialsExpiredException.class, () -> { + refreshTokenAuthenticationProvider.authenticate(new RefreshAuthenticationToken(refreshJwtToken)); + }); + } + + @Test + public void testTokensOutdatageTimeRemovalFromCache() throws Exception { + JwtToken jwtToken = createAccessJwtToken(userId); + + SECONDS.sleep(1); + tokenOutdatingService.outdateOldUserTokens(userId); + + int refreshTokenExpirationTime = 5; + jwtSettings.setRefreshTokenExpTime(refreshTokenExpirationTime); + + SECONDS.sleep(refreshTokenExpirationTime - 2); + + assertTrue(tokenOutdatingService.isOutdated(jwtToken, userId)); + assertNotNull(cacheManager.getCache(CacheConstants.TOKEN_OUTDATAGE_TIME_CACHE).get(userId.getId().toString())); + + SECONDS.sleep(3); + + assertFalse(tokenOutdatingService.isOutdated(jwtToken, userId)); + assertNull(cacheManager.getCache(CacheConstants.TOKEN_OUTDATAGE_TIME_CACHE).get(userId.getId().toString())); + } + + private JwtToken createAccessJwtToken(UserId userId) { + return tokenFactory.createAccessJwtToken(createMockSecurityUser(userId)); + } + + private JwtToken createRefreshJwtToken(UserId userId) { + return tokenFactory.createRefreshToken(createMockSecurityUser(userId)); + } + + private RawAccessJwtToken getRawJwtToken(JwtToken token) { + return new RawAccessJwtToken(token.getToken()); + } + + private SecurityUser createMockSecurityUser(UserId userId) { + SecurityUser securityUser = new SecurityUser(); + securityUser.setEmail("email"); + securityUser.setUserPrincipal(new UserPrincipal(UserPrincipal.Type.USER_NAME, securityUser.getEmail())); + securityUser.setAuthority(Authority.CUSTOMER_USER); + securityUser.setId(userId); + return securityUser; + } +} diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java b/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java index c3490aa85f..62f625f285 100644 --- a/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/CacheConstants.java @@ -27,4 +27,5 @@ public class CacheConstants { public static final String TENANT_PROFILE_CACHE = "tenantProfiles"; public static final String DEVICE_PROFILE_CACHE = "deviceProfiles"; public static final String ATTRIBUTES_CACHE = "attributes"; + public static final String TOKEN_OUTDATAGE_TIME_CACHE = "tokensOutdatageTime"; } diff --git a/common/data/src/main/java/org/thingsboard/server/common/data/security/event/UserAuthDataChangedEvent.java b/common/data/src/main/java/org/thingsboard/server/common/data/security/event/UserAuthDataChangedEvent.java new file mode 100644 index 0000000000..27a43670b5 --- /dev/null +++ b/common/data/src/main/java/org/thingsboard/server/common/data/security/event/UserAuthDataChangedEvent.java @@ -0,0 +1,30 @@ +/** + * Copyright © 2016-2021 The Thingsboard Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.thingsboard.server.common.data.security.event; + +import org.thingsboard.server.common.data.id.UserId; + +public class UserAuthDataChangedEvent { + private final UserId userId; + + public UserAuthDataChangedEvent(UserId userId) { + this.userId = userId; + } + + public UserId getUserId() { + return userId; + } +} diff --git a/application/src/main/java/org/thingsboard/server/service/security/model/token/JwtToken.java b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/JwtToken.java similarity index 92% rename from application/src/main/java/org/thingsboard/server/service/security/model/token/JwtToken.java rename to common/data/src/main/java/org/thingsboard/server/common/data/security/model/JwtToken.java index ca4c969bcf..d11522cf9a 100644 --- a/application/src/main/java/org/thingsboard/server/service/security/model/token/JwtToken.java +++ b/common/data/src/main/java/org/thingsboard/server/common/data/security/model/JwtToken.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.thingsboard.server.service.security.model.token; +package org.thingsboard.server.common.data.security.model; import java.io.Serializable; diff --git a/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java b/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java index 5cb4c693fc..ada6208b6b 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java +++ b/dao/src/main/java/org/thingsboard/server/dao/user/UserServiceImpl.java @@ -22,8 +22,8 @@ import com.google.common.util.concurrent.ListenableFuture; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.Customer; @@ -38,6 +38,7 @@ import org.thingsboard.server.common.data.page.PageData; import org.thingsboard.server.common.data.page.PageLink; import org.thingsboard.server.common.data.security.Authority; import org.thingsboard.server.common.data.security.UserCredentials; +import org.thingsboard.server.common.data.security.event.UserAuthDataChangedEvent; import org.thingsboard.server.common.data.tenant.profile.DefaultTenantProfileConfiguration; import org.thingsboard.server.dao.customer.CustomerDao; import org.thingsboard.server.dao.entity.AbstractEntityService; @@ -75,21 +76,26 @@ public class UserServiceImpl extends AbstractEntityService implements UserServic @Value("${security.user_login_case_sensitive:true}") private boolean userLoginCaseSensitive; - @Autowired - private UserDao userDao; - - @Autowired - private UserCredentialsDao userCredentialsDao; - - @Autowired - private TenantDao tenantDao; - - @Autowired - private CustomerDao customerDao; - - @Autowired - @Lazy - private TbTenantProfileCache tenantProfileCache; + private final UserDao userDao; + private final UserCredentialsDao userCredentialsDao; + private final TenantDao tenantDao; + private final CustomerDao customerDao; + private final TbTenantProfileCache tenantProfileCache; + private final ApplicationEventPublisher eventPublisher; + + public UserServiceImpl(UserDao userDao, + UserCredentialsDao userCredentialsDao, + TenantDao tenantDao, + CustomerDao customerDao, + @Lazy TbTenantProfileCache tenantProfileCache, + ApplicationEventPublisher eventPublisher) { + this.userDao = userDao; + this.userCredentialsDao = userCredentialsDao; + this.tenantDao = tenantDao; + this.customerDao = customerDao; + this.tenantProfileCache = tenantProfileCache; + this.eventPublisher = eventPublisher; + } @Override public User findUserByEmail(TenantId tenantId, String email) { @@ -225,6 +231,7 @@ public class UserServiceImpl extends AbstractEntityService implements UserServic userCredentialsDao.removeById(tenantId, userCredentials.getUuidId()); deleteEntityRelations(tenantId, userId); userDao.removeById(tenantId, userId.getId()); + eventPublisher.publishEvent(new UserAuthDataChangedEvent(userId)); } @Override diff --git a/ui-ngx/src/app/core/auth/auth.service.ts b/ui-ngx/src/app/core/auth/auth.service.ts index 073f60654e..50160ad2d3 100644 --- a/ui-ngx/src/app/core/auth/auth.service.ts +++ b/ui-ngx/src/app/core/auth/auth.service.ts @@ -149,8 +149,11 @@ export class AuthService { } public changePassword(currentPassword: string, newPassword: string) { - return this.http.post('/api/auth/changePassword', - {currentPassword, newPassword}, defaultHttpOptions()); + return this.http.post('/api/auth/changePassword', {currentPassword, newPassword}, defaultHttpOptions()).pipe( + tap((loginResponse: LoginResponse) => { + this.setUserFromJwtToken(loginResponse.token, loginResponse.refreshToken, false); + } + )); } public activateByEmailCode(emailCode: string): Observable { From 3420eeb9d71e6dc542004d4dc5c7f75fc2d0fe0b Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Tue, 16 Mar 2021 15:29:46 +0200 Subject: [PATCH 69/69] [3.3] [PROD-800] Fix empty search result when query is empty (#4209) * Fix empty search result when query is empty * Refactor --- .../dao/sql/query/EntityKeyMapping.java | 23 ++- .../dao/service/BaseEntityServiceTest.java | 154 ++++++++++++++++++ 2 files changed, 165 insertions(+), 12 deletions(-) diff --git a/dao/src/main/java/org/thingsboard/server/dao/sql/query/EntityKeyMapping.java b/dao/src/main/java/org/thingsboard/server/dao/sql/query/EntityKeyMapping.java index 313a44f4a3..9ed515f518 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/sql/query/EntityKeyMapping.java +++ b/dao/src/main/java/org/thingsboard/server/dao/sql/query/EntityKeyMapping.java @@ -519,6 +519,9 @@ public class EntityKeyMapping { String operationField = field; String paramName = getNextParameterName(field); String value = stringFilterPredicate.getValue().getValue(); + if (value.isEmpty()) { + return null; + } String stringOperationQuery = ""; if (stringFilterPredicate.isIgnoreCase()) { value = value.toLowerCase(); @@ -526,30 +529,26 @@ public class EntityKeyMapping { } switch (stringFilterPredicate.getOperation()) { case EQUAL: - stringOperationQuery = String.format("%s = :%s) or (%s is null and :%s = '')", operationField, paramName, operationField, paramName); + stringOperationQuery = String.format("%s = :%s)", operationField, paramName); break; case NOT_EQUAL: - stringOperationQuery = String.format("%s != :%s) or (%s is null and :%s != '')", operationField, paramName, operationField, paramName); + stringOperationQuery = String.format("%s != :%s or %s is null)", operationField, paramName, operationField); break; case STARTS_WITH: value += "%"; - stringOperationQuery = String.format("%s like :%s) or (%s is null and :%s = '%%')", operationField, paramName, operationField, paramName); + stringOperationQuery = String.format("%s like :%s)", operationField, paramName); break; case ENDS_WITH: value = "%" + value; - stringOperationQuery = String.format("%s like :%s) or (%s is null and :%s = '%%')", operationField, paramName, operationField, paramName); + stringOperationQuery = String.format("%s like :%s)", operationField, paramName); break; case CONTAINS: - if (value.length() > 0) { - value = "%" + value + "%"; - } - stringOperationQuery = String.format("%s like :%s) or (%s is null and :%s = '')", operationField, paramName, operationField, paramName); + value = "%" + value + "%"; + stringOperationQuery = String.format("%s like :%s)", operationField, paramName); break; case NOT_CONTAINS: - if (value.length() > 0) { - value = "%" + value + "%"; - } - stringOperationQuery = String.format("%s not like :%s) or (%s is null and :%s != '')", operationField, paramName, operationField, paramName); + value = "%" + value + "%"; + stringOperationQuery = String.format("%s not like :%s or %s is null)", operationField, paramName, operationField); break; } ctx.addStringParameter(paramName, value); diff --git a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java index 6c899c01c4..6b7530c4c3 100644 --- a/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java +++ b/dao/src/test/java/org/thingsboard/server/dao/service/BaseEntityServiceTest.java @@ -17,6 +17,7 @@ package org.thingsboard.server.dao.service; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import org.apache.commons.lang3.RandomUtils; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -56,6 +57,7 @@ import org.thingsboard.server.common.data.query.KeyFilter; import org.thingsboard.server.common.data.query.NumericFilterPredicate; import org.thingsboard.server.common.data.query.RelationsQueryFilter; import org.thingsboard.server.common.data.query.StringFilterPredicate; +import org.thingsboard.server.common.data.query.StringFilterPredicate.StringOperation; import org.thingsboard.server.common.data.relation.EntityRelation; import org.thingsboard.server.common.data.relation.EntitySearchDirection; import org.thingsboard.server.common.data.relation.RelationEntityTypeFilter; @@ -72,6 +74,9 @@ import java.util.List; import java.util.Random; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.junit.Assert.assertEquals; public abstract class BaseEntityServiceTest extends AbstractServiceTest { @@ -541,6 +546,155 @@ public abstract class BaseEntityServiceTest extends AbstractServiceTest { deviceService.deleteDevicesByTenantId(tenantId); } + @Test + public void testFindEntityDataByQuery_operationEqual_emptySearchQuery() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = ""; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.EQUAL, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size(), result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationNotEqual() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = devices.get(2).getLabel(); + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.NOT_EQUAL, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size() - 1, result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationNotEqual_emptySearchQuery() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = ""; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.NOT_EQUAL, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size(), result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationStartsWith_emptySearchQuery() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = ""; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.STARTS_WITH, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size(), result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationEndsWith_emptySearchQuery() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = ""; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.ENDS_WITH, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size(), result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationContains_emptySearchQuery() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = ""; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.CONTAINS, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size(), result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationNotContains() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = "label-"; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.NOT_CONTAINS, searchQuery); + + PageData result = searchEntities(query); + assertEquals(2, result.getTotalElements()); + } + + @Test + public void testFindEntityDataByQuery_operationNotContains_emptySearchQuery() { + List devices = createMockDevices(10); + devices.get(0).setLabel(""); + devices.get(1).setLabel(null); + devices.forEach(deviceService::saveDevice); + + String searchQuery = ""; + EntityDataQuery query = createDeviceSearchQuery("label", StringOperation.NOT_CONTAINS, searchQuery); + + PageData result = searchEntities(query); + assertEquals(devices.size(), result.getTotalElements()); + } + + private PageData searchEntities(EntityDataQuery query) { + return entityService.findEntityDataByQuery(tenantId, new CustomerId(CustomerId.NULL_UUID), query); + } + + private EntityDataQuery createDeviceSearchQuery(String deviceField, StringOperation operation, String searchQuery) { + DeviceTypeFilter deviceTypeFilter = new DeviceTypeFilter(); + deviceTypeFilter.setDeviceType("default"); + deviceTypeFilter.setDeviceNameFilter(""); + + EntityDataSortOrder sortOrder = new EntityDataSortOrder( + new EntityKey(EntityKeyType.ENTITY_FIELD, "createdTime"), EntityDataSortOrder.Direction.ASC + ); + EntityDataPageLink pageLink = new EntityDataPageLink(1000, 0, null, sortOrder); + List entityFields = Arrays.asList( + new EntityKey(EntityKeyType.ENTITY_FIELD, "name"), + new EntityKey(EntityKeyType.ENTITY_FIELD, "label") + ); + + List keyFilters = createStringKeyFilters(deviceField, EntityKeyType.ENTITY_FIELD, operation, searchQuery); + + return new EntityDataQuery(deviceTypeFilter, pageLink, entityFields, null, keyFilters); + } + + private List createMockDevices(int count) { + return Stream.iterate(1, i -> i + 1) + .map(i -> { + Device device = new Device(); + device.setTenantId(tenantId); + device.setName("Device " + i); + device.setType("default"); + device.setLabel("label-" + RandomUtils.nextInt(100, 10000)); + return device; + }) + .limit(count) + .collect(Collectors.toList()); + } + @Test public void testFindEntityDataByQueryWithAttributes() throws ExecutionException, InterruptedException {