kuzzle-device-manager-types 2.4.0-beta.13 → 2.4.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/modules/asset/AssetService.d.ts +1 -1
- package/dist/lib/modules/decoder/types/DecoderContent.d.ts +1 -0
- package/dist/lib/modules/measure/MeasureExporter.d.ts +4 -1
- package/dist/lib/modules/model/ModelService.d.ts +3 -3
- package/dist/lib/modules/model/ModelsRegister.d.ts +27 -3
- package/dist/lib/modules/model/types/ModelApi.d.ts +7 -3
- package/dist/lib/modules/model/types/ModelContent.d.ts +110 -2
- package/dist/lib/modules/model/types/ModelDefinition.d.ts +82 -5
- package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +71 -8
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export declare class AssetService extends BaseService {
|
|
|
17
17
|
/**
|
|
18
18
|
* Update or Create an asset metadata
|
|
19
19
|
*/
|
|
20
|
-
upsert(engineId: string,
|
|
20
|
+
upsert(engineId: string, model: string, reference: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
21
21
|
/**
|
|
22
22
|
* Create an asset metadata
|
|
23
23
|
*/
|
|
@@ -38,7 +38,10 @@ export declare class MeasureExporter extends AbstractExporter<MeasureExportParam
|
|
|
38
38
|
* Never return a rejected promise and write potential error on the stream
|
|
39
39
|
*/
|
|
40
40
|
prepareExport(engineId: string, user: User, params: MeasureSearchParams): Promise<string>;
|
|
41
|
-
protected formatHit(columns: Column
|
|
41
|
+
protected formatHit(columns: Array<Column & {
|
|
42
|
+
shouldCheckName: boolean;
|
|
43
|
+
name: string;
|
|
44
|
+
}>, hit: KHit<MeasureContent>): any[];
|
|
42
45
|
/**
|
|
43
46
|
* Retrieve a prepared export and write each document as a CSV in the stream
|
|
44
47
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { JSONObject, KDocument } from "kuzzle-sdk";
|
|
2
2
|
import { DeviceManagerPlugin } from "../plugin";
|
|
3
3
|
import { BaseService } from "../shared";
|
|
4
|
-
import { AssetModelContent, DeviceModelContent, MeasureModelContent } from "./types/ModelContent";
|
|
4
|
+
import { AssetModelContent, DeviceModelContent, MeasureModelContent, MetadataDetails, MetadataGroups, MetadataMappings } from "./types/ModelContent";
|
|
5
5
|
export declare class ModelService extends BaseService {
|
|
6
6
|
constructor(plugin: DeviceManagerPlugin);
|
|
7
7
|
registerAskEvents(): void;
|
|
8
|
-
writeAsset(engineGroup: string, model: string, metadataMappings:
|
|
8
|
+
writeAsset(engineGroup: string, model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: AssetModelContent["asset"]["measures"]): Promise<KDocument<AssetModelContent>>;
|
|
9
9
|
private checkDefaultValues;
|
|
10
|
-
writeDevice(model: string, metadataMappings:
|
|
10
|
+
writeDevice(model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: DeviceModelContent["device"]["measures"]): Promise<KDocument<DeviceModelContent>>;
|
|
11
11
|
writeMeasure(type: string, valuesMappings: JSONObject): Promise<KDocument<MeasureModelContent>>;
|
|
12
12
|
deleteAsset(_id: string): Promise<void>;
|
|
13
13
|
deleteDevice(_id: string): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { JSONObject } from "kuzzle-sdk";
|
|
2
1
|
import { DeviceManagerPlugin } from "../plugin";
|
|
3
2
|
import { NamedMeasures } from "../decoder";
|
|
4
3
|
import { MeasureDefinition } from "../measure";
|
|
4
|
+
import { MetadataDetails, MetadataGroups, MetadataMappings } from "./types/ModelContent";
|
|
5
|
+
import { JSONObject } from "kuzzle-sdk";
|
|
5
6
|
export declare class ModelsRegister {
|
|
6
7
|
private config;
|
|
7
8
|
private context;
|
|
@@ -11,8 +12,31 @@ export declare class ModelsRegister {
|
|
|
11
12
|
private get sdk();
|
|
12
13
|
init(plugin: DeviceManagerPlugin): void;
|
|
13
14
|
loadModels(): Promise<void>;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Registers an asset model.
|
|
17
|
+
*
|
|
18
|
+
* @param engineGroup - The engine group name.
|
|
19
|
+
* @param model - The name of the asset model, which must be in PascalCase.
|
|
20
|
+
* @param measures - The measures associated with this asset model.
|
|
21
|
+
* @param metadataMappings - The metadata mappings for the model, defaults to an empty object.
|
|
22
|
+
* @param defaultMetadata - The default metadata values for the model, defaults to an empty object.
|
|
23
|
+
* @param metadataDetails - Optional detailed metadata descriptions and localizations.
|
|
24
|
+
* @param metadataGroups - Optional groups for organizing metadata, with localizations.
|
|
25
|
+
* @throws PluginImplementationError if the model name is not in PascalCase.
|
|
26
|
+
*/
|
|
27
|
+
registerAsset(engineGroup: string, model: string, measures: NamedMeasures, metadataMappings?: MetadataMappings, defaultMetadata?: JSONObject, metadataDetails?: MetadataDetails, metadataGroups?: MetadataGroups): void;
|
|
28
|
+
/**
|
|
29
|
+
* Registers a device model.
|
|
30
|
+
*
|
|
31
|
+
* @param model - The name of the device model, which must be in PascalCase.
|
|
32
|
+
* @param measures - The measures associated with this device model.
|
|
33
|
+
* @param metadataMappings - The metadata mappings for the model, defaults to an empty object.
|
|
34
|
+
* @param defaultMetadata - The default metadata values for the model, defaults to an empty object.
|
|
35
|
+
* @param metadataDetails - Optional detailed metadata descriptions and localizations.
|
|
36
|
+
* @param metadataGroups - Optional groups for organizing metadata, with localizations.
|
|
37
|
+
* @throws PluginImplementationError if the model name is not in PascalCase.
|
|
38
|
+
*/
|
|
39
|
+
registerDevice(model: string, measures: NamedMeasures, metadataMappings?: MetadataMappings, defaultMetadata?: JSONObject, metadataDetails?: MetadataDetails, metadataGroups?: MetadataGroups): void;
|
|
16
40
|
registerMeasure(type: string, measureDefinition: MeasureDefinition): void;
|
|
17
41
|
private load;
|
|
18
42
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONObject, KDocument } from "kuzzle-sdk";
|
|
2
|
-
import { AssetModelContent, DeviceModelContent, MeasureModelContent } from "./ModelContent";
|
|
2
|
+
import { AssetModelContent, DeviceModelContent, MeasureModelContent, MetadataDetails, MetadataGroups, MetadataMappings } from "./ModelContent";
|
|
3
3
|
interface ModelsControllerRequest {
|
|
4
4
|
controller: "device-manager/models";
|
|
5
5
|
}
|
|
@@ -24,7 +24,9 @@ export interface ApiModelWriteAssetRequest extends ModelsControllerRequest {
|
|
|
24
24
|
body: {
|
|
25
25
|
engineGroup: string;
|
|
26
26
|
model: string;
|
|
27
|
-
|
|
27
|
+
metadataDetails?: MetadataDetails;
|
|
28
|
+
metadataGroups?: MetadataGroups;
|
|
29
|
+
metadataMappings?: MetadataMappings;
|
|
28
30
|
defaultValues?: JSONObject;
|
|
29
31
|
measures?: AssetModelContent["asset"]["measures"];
|
|
30
32
|
};
|
|
@@ -34,7 +36,9 @@ export interface ApiModelWriteDeviceRequest extends ModelsControllerRequest {
|
|
|
34
36
|
action: "writeDevice";
|
|
35
37
|
body: {
|
|
36
38
|
model: string;
|
|
37
|
-
|
|
39
|
+
metadataDetails?: MetadataDetails;
|
|
40
|
+
metadataGroups?: MetadataGroups;
|
|
41
|
+
metadataMappings?: MetadataMappings;
|
|
38
42
|
defaultValues?: JSONObject;
|
|
39
43
|
measures: DeviceModelContent["device"]["measures"];
|
|
40
44
|
};
|
|
@@ -7,6 +7,39 @@ export interface MeasureModelContent extends KDocumentContent {
|
|
|
7
7
|
type: string;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
+
interface MetadataProperty {
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
export interface MetadataMappings {
|
|
14
|
+
[key: string]: MetadataProperty | {
|
|
15
|
+
properties: {
|
|
16
|
+
[key: string]: MetadataProperty;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface LocaleDetails {
|
|
21
|
+
friendlyName: string;
|
|
22
|
+
description: string;
|
|
23
|
+
}
|
|
24
|
+
export interface MetadataDetails {
|
|
25
|
+
[key: string]: {
|
|
26
|
+
group?: string;
|
|
27
|
+
locales: {
|
|
28
|
+
[locale: string]: LocaleDetails;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface MetadataGroupLocale {
|
|
33
|
+
groupFriendlyName: string;
|
|
34
|
+
description: string;
|
|
35
|
+
}
|
|
36
|
+
export interface MetadataGroups {
|
|
37
|
+
[groupName: string]: {
|
|
38
|
+
locales: {
|
|
39
|
+
[locale: string]: MetadataGroupLocale;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
10
43
|
export interface AssetModelContent extends KDocumentContent {
|
|
11
44
|
type: "asset";
|
|
12
45
|
engineGroup: string;
|
|
@@ -27,7 +60,7 @@ export interface AssetModelContent extends KDocumentContent {
|
|
|
27
60
|
* }
|
|
28
61
|
* }
|
|
29
62
|
*/
|
|
30
|
-
metadataMappings:
|
|
63
|
+
metadataMappings: MetadataMappings;
|
|
31
64
|
/**
|
|
32
65
|
* Default values for metadata.
|
|
33
66
|
*
|
|
@@ -37,6 +70,43 @@ export interface AssetModelContent extends KDocumentContent {
|
|
|
37
70
|
* }
|
|
38
71
|
*/
|
|
39
72
|
defaultMetadata: JSONObject;
|
|
73
|
+
/**
|
|
74
|
+
* Metadata details
|
|
75
|
+
* @example
|
|
76
|
+
* {
|
|
77
|
+
* "extTemp": {
|
|
78
|
+
* "group": "buildingEnv",
|
|
79
|
+
* "locales": {
|
|
80
|
+
* "en": {
|
|
81
|
+
* "friendlyName": "External temperature",
|
|
82
|
+
* "description": "Building external temperature"
|
|
83
|
+
* },
|
|
84
|
+
* "fr": {
|
|
85
|
+
* "friendlyName": "Température extérieure",
|
|
86
|
+
* "description": "Température à l'exterieur du bâtiment"
|
|
87
|
+
* },
|
|
88
|
+
* }
|
|
89
|
+
*/
|
|
90
|
+
metadataDetails?: MetadataDetails;
|
|
91
|
+
/**
|
|
92
|
+
* Metadata groups list
|
|
93
|
+
* @example
|
|
94
|
+
* {
|
|
95
|
+
* "buildingEnv": {
|
|
96
|
+
* "locales": {
|
|
97
|
+
* "en": {
|
|
98
|
+
* "groupFriendlyName": "Building environment",
|
|
99
|
+
* "description": "The building environment"
|
|
100
|
+
* },
|
|
101
|
+
* "fr": {
|
|
102
|
+
* "groupFriendlyName": "Environnement du bâtiment",
|
|
103
|
+
* "description": "L'environnement du bâtiment"
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* }
|
|
107
|
+
* }
|
|
108
|
+
*/
|
|
109
|
+
metadataGroups?: MetadataGroups;
|
|
40
110
|
/**
|
|
41
111
|
* List of accepted measures for this model
|
|
42
112
|
*
|
|
@@ -70,7 +140,7 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
70
140
|
* }
|
|
71
141
|
* }
|
|
72
142
|
*/
|
|
73
|
-
metadataMappings:
|
|
143
|
+
metadataMappings: MetadataMappings;
|
|
74
144
|
/**
|
|
75
145
|
* Default values for metadata.
|
|
76
146
|
*
|
|
@@ -80,6 +150,43 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
80
150
|
* }
|
|
81
151
|
*/
|
|
82
152
|
defaultMetadata: JSONObject;
|
|
153
|
+
/**
|
|
154
|
+
* Metadata details
|
|
155
|
+
* @example
|
|
156
|
+
* {
|
|
157
|
+
* "sensorVersion": {
|
|
158
|
+
* "group": "sensorSpecs",
|
|
159
|
+
* "locales": {
|
|
160
|
+
* "en": {
|
|
161
|
+
* "friendlyName": "Sensor version",
|
|
162
|
+
* "description": "Firmware version of the sensor"
|
|
163
|
+
* },
|
|
164
|
+
* "fr": {
|
|
165
|
+
* "friendlyName": "Version du capteur",
|
|
166
|
+
* "description": "Version du micrologiciel du capteur"
|
|
167
|
+
* },
|
|
168
|
+
* }
|
|
169
|
+
*/
|
|
170
|
+
metadataDetails?: MetadataDetails;
|
|
171
|
+
/**
|
|
172
|
+
* Metadata groups list
|
|
173
|
+
* @example
|
|
174
|
+
* {
|
|
175
|
+
* "sensorSpecs": {
|
|
176
|
+
* "locales": {
|
|
177
|
+
* "en": {
|
|
178
|
+
* "groupFriendlyName": "Sensor specifications",
|
|
179
|
+
* "description" : "All sensors specifications"
|
|
180
|
+
* },
|
|
181
|
+
* "fr": {
|
|
182
|
+
* "groupFriendlyName": "Spécifications techniques",
|
|
183
|
+
* "description": "Toutes les spécifications techniques"
|
|
184
|
+
* }
|
|
185
|
+
* }
|
|
186
|
+
* }
|
|
187
|
+
* }
|
|
188
|
+
*/
|
|
189
|
+
metadataGroups?: MetadataGroups;
|
|
83
190
|
/**
|
|
84
191
|
* List of decoded measures for this model
|
|
85
192
|
*
|
|
@@ -95,3 +202,4 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
95
202
|
};
|
|
96
203
|
}
|
|
97
204
|
export type ModelContent = MeasureModelContent | AssetModelContent | DeviceModelContent;
|
|
205
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONObject } from "kuzzle-sdk";
|
|
2
2
|
import { Decoder, NamedMeasures } from "../../../modules/decoder";
|
|
3
|
+
import { MetadataDetails, MetadataGroups, MetadataMappings } from "./ModelContent";
|
|
3
4
|
/**
|
|
4
5
|
* Define an asset model
|
|
5
6
|
*
|
|
@@ -16,6 +17,35 @@ import { Decoder, NamedMeasures } from "../../../modules/decoder";
|
|
|
16
17
|
* },
|
|
17
18
|
* defaultMetadata: {
|
|
18
19
|
* height: 20
|
|
20
|
+
* },
|
|
21
|
+
* metadataDetails: {
|
|
22
|
+
* "extTemp": {
|
|
23
|
+
* "group": "buildingEnv",
|
|
24
|
+
* "locales": {
|
|
25
|
+
* "en": {
|
|
26
|
+
* "friendlyName": "External temperature",
|
|
27
|
+
* "description": "Container external temperature"
|
|
28
|
+
* },
|
|
29
|
+
* "fr": {
|
|
30
|
+
* "friendlyName": "Température externe",
|
|
31
|
+
* "description": "Température externe du conteneur"
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* },
|
|
36
|
+
* metadataGroups: {
|
|
37
|
+
* buildingEnv: {
|
|
38
|
+
* locales: {
|
|
39
|
+
* en: {
|
|
40
|
+
* groupFriendlyName: "Building environment",
|
|
41
|
+
* description: "The building environment"
|
|
42
|
+
* },
|
|
43
|
+
* fr: {
|
|
44
|
+
* groupFriendlyName: "Environnement du bâtiment",
|
|
45
|
+
* description: "L'environnement du bâtiment"
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
19
49
|
* }
|
|
20
50
|
* }
|
|
21
51
|
*
|
|
@@ -28,11 +58,19 @@ export type AssetModelDefinition = {
|
|
|
28
58
|
/**
|
|
29
59
|
* Metadata mappings definition
|
|
30
60
|
*/
|
|
31
|
-
metadataMappings?:
|
|
61
|
+
metadataMappings?: MetadataMappings;
|
|
32
62
|
/**
|
|
33
63
|
* Default metadata values
|
|
34
64
|
*/
|
|
35
65
|
defaultMetadata?: JSONObject;
|
|
66
|
+
/**
|
|
67
|
+
* Metadata details including tanslations and group.
|
|
68
|
+
*/
|
|
69
|
+
metadataDetails?: MetadataDetails;
|
|
70
|
+
/**
|
|
71
|
+
* Metadata groups
|
|
72
|
+
*/
|
|
73
|
+
metadataGroups?: MetadataGroups;
|
|
36
74
|
};
|
|
37
75
|
/**
|
|
38
76
|
* Define a device model
|
|
@@ -42,9 +80,40 @@ export type AssetModelDefinition = {
|
|
|
42
80
|
* decoder: new DummyTempPositionDecoder(),
|
|
43
81
|
* metadataMappings: {
|
|
44
82
|
* serial: { type: "keyword" },
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
*
|
|
83
|
+
* },
|
|
84
|
+
* defaultMetadata: {
|
|
85
|
+
* company: "Firebird"
|
|
86
|
+
* },
|
|
87
|
+
* metadataDetails: {
|
|
88
|
+
* sensorType: {
|
|
89
|
+
* group: "sensorSpecs",
|
|
90
|
+
* locales: {
|
|
91
|
+
* en: {
|
|
92
|
+
* friendlyName: "Sensor type",
|
|
93
|
+
* description: "Type of the sensor"
|
|
94
|
+
* },
|
|
95
|
+
* fr: {
|
|
96
|
+
* friendlyName: "Type de traceur",
|
|
97
|
+
* description: "Type du traceur"
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
* },
|
|
102
|
+
* metadataGroups: {
|
|
103
|
+
* sensorSpecs: {
|
|
104
|
+
* locales: {
|
|
105
|
+
* en: {
|
|
106
|
+
* groupFriendlyName: "Sensor specifications",
|
|
107
|
+
* description : "All sensors specifications"
|
|
108
|
+
* },
|
|
109
|
+
* fr: {
|
|
110
|
+
* groupFriendlyName: "Spécifications techniques",
|
|
111
|
+
* description: "Toutes les spécifications techniques"
|
|
112
|
+
* }
|
|
113
|
+
* }
|
|
114
|
+
* }
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
48
117
|
*/
|
|
49
118
|
export type DeviceModelDefinition = {
|
|
50
119
|
/**
|
|
@@ -54,9 +123,17 @@ export type DeviceModelDefinition = {
|
|
|
54
123
|
/**
|
|
55
124
|
* Metadata mappings definition
|
|
56
125
|
*/
|
|
57
|
-
metadataMappings?:
|
|
126
|
+
metadataMappings?: MetadataMappings;
|
|
58
127
|
/**
|
|
59
128
|
* Default metadata values
|
|
60
129
|
*/
|
|
61
130
|
defaultMetadata?: JSONObject;
|
|
131
|
+
/**
|
|
132
|
+
* Metadata details including tanslations and group.
|
|
133
|
+
*/
|
|
134
|
+
metadataDetails?: MetadataDetails;
|
|
135
|
+
/**
|
|
136
|
+
* Metadata groups list and details.
|
|
137
|
+
*/
|
|
138
|
+
metadataGroups?: MetadataGroups;
|
|
62
139
|
};
|
|
@@ -22,10 +22,13 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
22
22
|
* Register an asset model
|
|
23
23
|
*
|
|
24
24
|
* @param engineGroup Engine group name
|
|
25
|
-
* @param model Name of the asset model
|
|
26
|
-
* @param definition
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* @param model Name of the asset model. Must follow a naming convention in PascalCase.
|
|
26
|
+
* @param definition Object containing the asset model definition, including:
|
|
27
|
+
* - measures: Array describing measure names and their types.
|
|
28
|
+
* - metadataMappings: Definition of metadata mappings, specifying types for each metadata field.
|
|
29
|
+
* - defaultMetadata: Default values for metadata fields, applied when actual data is not provided.
|
|
30
|
+
* - metadataDetails: Optional detailed descriptions for each metadata, including group association and localizations.
|
|
31
|
+
* - metadataGroups: Optional description of metadata groups, organizing metadata logically, with localizations for group names.
|
|
29
32
|
*
|
|
30
33
|
* @example
|
|
31
34
|
* ```
|
|
@@ -44,6 +47,33 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
44
47
|
* },
|
|
45
48
|
* defaultMetadata: {
|
|
46
49
|
* height: 20
|
|
50
|
+
* },
|
|
51
|
+
* metadataDetails: {
|
|
52
|
+
* "extTemp": {
|
|
53
|
+
* "group": "environment",
|
|
54
|
+
* "locales": {
|
|
55
|
+
* "en": {
|
|
56
|
+
* "friendlyName": "External Temperature",
|
|
57
|
+
* "description": "The temperature outside the container"
|
|
58
|
+
* },
|
|
59
|
+
* "fr": {
|
|
60
|
+
* "friendlyName": "Température Externe",
|
|
61
|
+
* "description": "La température à l'extérieur du conteneur"
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* },
|
|
66
|
+
* metadataGroups: {
|
|
67
|
+
* "environment": {
|
|
68
|
+
* "locales": {
|
|
69
|
+
* "en": {
|
|
70
|
+
* "groupFriendlyName": "Environment"
|
|
71
|
+
* },
|
|
72
|
+
* "fr": {
|
|
73
|
+
* "groupFriendlyName": "Environnement"
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
47
77
|
* }
|
|
48
78
|
* }
|
|
49
79
|
* );
|
|
@@ -51,12 +81,15 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
51
81
|
*/
|
|
52
82
|
registerAsset: (engineGroup: string, model: string, definition: AssetModelDefinition) => void;
|
|
53
83
|
/**
|
|
54
|
-
* Register a device
|
|
84
|
+
* Register a device.
|
|
55
85
|
*
|
|
56
86
|
* @param model Name of the device model
|
|
57
|
-
* @param definition
|
|
58
|
-
*
|
|
59
|
-
*
|
|
87
|
+
* @param definition Object containing the device model definition, including:
|
|
88
|
+
* - decoder: Decoder used to decode payloads
|
|
89
|
+
* - metadataMappings: Metadata mappings definition
|
|
90
|
+
* - defaultMetadata: Default metadata values
|
|
91
|
+
* - metadataDetails: Detailed metadata descriptions and localizations
|
|
92
|
+
* - metadataGroups: Groups for organizing metadata, with localizations
|
|
60
93
|
*
|
|
61
94
|
* @example
|
|
62
95
|
* ```
|
|
@@ -66,6 +99,36 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
66
99
|
* decoder: new DummyTempPositionDecoder(),
|
|
67
100
|
* metadataMappings: {
|
|
68
101
|
* serial: { type: "keyword" },
|
|
102
|
+
* },
|
|
103
|
+
* defaultMetadata: {
|
|
104
|
+
* company: "Acme Inc"
|
|
105
|
+
* },
|
|
106
|
+
* metadataDetails: {
|
|
107
|
+
* sensorVersion: {
|
|
108
|
+
* group: "sensorSpecs",
|
|
109
|
+
* locales: {
|
|
110
|
+
* en: {
|
|
111
|
+
* friendlyName: "Sensor version",
|
|
112
|
+
* description: "Firmware version of the sensor"
|
|
113
|
+
* },
|
|
114
|
+
* fr: {
|
|
115
|
+
* friendlyName: "Version du capteur",
|
|
116
|
+
* description: "Version du micrologiciel du capteur"
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* },
|
|
121
|
+
* metadataGroups: {
|
|
122
|
+
* sensorSpecs: {
|
|
123
|
+
* locales: {
|
|
124
|
+
* en: {
|
|
125
|
+
* groupFriendlyName: "Sensors specifications"
|
|
126
|
+
* },
|
|
127
|
+
* fr: {
|
|
128
|
+
* groupFriendlyName: "Spécifications des capteurs"
|
|
129
|
+
* }
|
|
130
|
+
* }
|
|
131
|
+
* }
|
|
69
132
|
* }
|
|
70
133
|
* }
|
|
71
134
|
* );
|