@hello.nrfcloud.com/proto-map 11.0.0 → 12.1.0
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/README.md +0 -2
- package/dist/generator/generateLwM2MDefinitions.js +1 -0
- package/dist/generator/generateLwM2MDefinitions.spec.js +11 -0
- package/dist/generator/generateLwm2mTimestampResources.js +18 -6
- package/dist/generator/generateType.js +7 -1
- package/dist/generator/lwm2m.js +2 -1
- package/dist/lwm2m/LWM2MObjectDefinition.js +4 -1
- package/dist/lwm2m/LwM2MObjectID.js +7 -1
- package/dist/lwm2m/definitions.js +81 -0
- package/dist/lwm2m/instanceTs.js +1 -1
- package/dist/lwm2m/object/14401.d.js +5 -0
- package/dist/lwm2m/object/validate14401.js +12 -0
- package/dist/lwm2m/objects.js +1 -0
- package/dist/lwm2m/timestampResources.js +47 -12
- package/dist/lwm2m/validators.js +2 -0
- package/dist/senml/lwm2mToSenML.js +1 -1
- package/dist/senml/senMLtoLwM2M.js +1 -1
- package/lwm2m/14401.xml +34 -0
- package/lwm2m/LWM2MObjectDefinition.ts +4 -1
- package/lwm2m/LWM2MObjectInfo.ts +1 -0
- package/lwm2m/LwM2MObjectID.ts +10 -2
- package/lwm2m/LwM2MObjectInstance.ts +8 -1
- package/lwm2m/ParsedLwM2MObjectDefinition.ts +1 -1
- package/lwm2m/definitions.ts +65 -50
- package/lwm2m/instanceTs.ts +1 -1
- package/lwm2m/object/14401.d.ts +25 -0
- package/lwm2m/object/validate14401.ts +14 -0
- package/lwm2m/objects.ts +3 -1
- package/lwm2m/timestampResources.ts +2 -1
- package/lwm2m/validators.ts +3 -1
- package/package.json +7 -7
- package/senml/lwm2mToSenML.ts +1 -1
- package/senml/senMLtoLwM2M.ts +1 -1
package/README.md
CHANGED
|
@@ -38,8 +38,6 @@ in a meaningful way to users without the need for custom implementation.
|
|
|
38
38
|
- All objects must define one `Time` property.
|
|
39
39
|
- Objects must be `Multiple` instance.
|
|
40
40
|
- Objects must be `Optional`.
|
|
41
|
-
- Resources must be `Single` instance. `Multiple` could be useful in some cases,
|
|
42
|
-
e.g. IP addresses, but until it is really needed, we do not support it.
|
|
43
41
|
- Resources should only be marked as mandatory in case they must be published
|
|
44
42
|
together (e.g. latitude and longitude). This allows devices to only update the
|
|
45
43
|
values that have changed.
|
|
@@ -59,6 +59,7 @@ var createResource = function(Resource) {
|
|
|
59
59
|
ts.factory.createPropertyAssignment('Name', ts.factory.createStringLiteral(Resource.Name)),
|
|
60
60
|
ts.factory.createPropertyAssignment('Mandatory', ts.factory.createIdentifier(Resource.Mandatory === 'Mandatory' ? 'true' : 'false')),
|
|
61
61
|
ts.factory.createPropertyAssignment('Type', ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('ResourceType'), Resource.Type)),
|
|
62
|
+
ts.factory.createPropertyAssignment('Multiple', ts.factory.createIdentifier(Resource.MultipleInstances === 'Multiple' ? 'true' : 'false')),
|
|
62
63
|
ts.factory.createPropertyAssignment('Description', ts.factory.createStringLiteral(Resource.Description))
|
|
63
64
|
];
|
|
64
65
|
if (Resource.RangeEnumeration.length > 0) {
|
|
@@ -5,6 +5,7 @@ import { LwM2MObjectID } from '../lwm2m/LwM2MObjectID.js';
|
|
|
5
5
|
import { ResourceType } from '../lwm2m/LWM2MObjectInfo.js';
|
|
6
6
|
void describe('generateLwM2MDefinitions()', function() {
|
|
7
7
|
void it('should have generated definitions from the XML files', function() {
|
|
8
|
+
var _definitions_LwM2MObjectID_NRFCloudServiceInfo_14401_Resources_;
|
|
8
9
|
assert.deepEqual(definitions[LwM2MObjectID.Geolocation_14201], {
|
|
9
10
|
ObjectID: 14201,
|
|
10
11
|
ObjectVersion: '1.0',
|
|
@@ -16,6 +17,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
16
17
|
Name: 'Latitude',
|
|
17
18
|
Mandatory: true,
|
|
18
19
|
Type: ResourceType.Float,
|
|
20
|
+
Multiple: false,
|
|
19
21
|
Description: 'The decimal notation of latitude in degrees, e.g. -43.5723 [World Geodetic System 1984].',
|
|
20
22
|
Units: '°',
|
|
21
23
|
RangeEnumeration: {
|
|
@@ -28,6 +30,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
28
30
|
Name: 'Longitude',
|
|
29
31
|
Mandatory: true,
|
|
30
32
|
Type: ResourceType.Float,
|
|
33
|
+
Multiple: false,
|
|
31
34
|
Description: 'The decimal notation of longitude in degrees, e.g. 153.21760 [World Geodetic System 1984].',
|
|
32
35
|
Units: '°',
|
|
33
36
|
RangeEnumeration: {
|
|
@@ -40,6 +43,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
40
43
|
Name: 'Altitude',
|
|
41
44
|
Mandatory: false,
|
|
42
45
|
Type: ResourceType.Float,
|
|
46
|
+
Multiple: false,
|
|
43
47
|
Description: 'The decimal notation of altitude in meters above sea level.',
|
|
44
48
|
Units: 'm'
|
|
45
49
|
},
|
|
@@ -48,6 +52,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
48
52
|
Name: 'Radius',
|
|
49
53
|
Mandatory: false,
|
|
50
54
|
Type: ResourceType.Float,
|
|
55
|
+
Multiple: false,
|
|
51
56
|
Description: 'The value in this resource indicates the radius of a circular area in meters. The circular area is used to describe uncertainty about a point for coordinates in a two-dimensional coordinate reference systems (CRS). The center point of a circular area is specified by using the Latitude and the Longitude Resources.',
|
|
52
57
|
Units: 'm'
|
|
53
58
|
},
|
|
@@ -56,6 +61,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
56
61
|
Name: 'Speed',
|
|
57
62
|
Mandatory: false,
|
|
58
63
|
Type: ResourceType.Float,
|
|
64
|
+
Multiple: false,
|
|
59
65
|
Description: 'Speed is the time rate of change in position.',
|
|
60
66
|
Units: 'm/s'
|
|
61
67
|
},
|
|
@@ -64,6 +70,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
64
70
|
Name: 'Heading',
|
|
65
71
|
Mandatory: false,
|
|
66
72
|
Type: ResourceType.Float,
|
|
73
|
+
Multiple: false,
|
|
67
74
|
Description: 'The angle of movement in degrees.',
|
|
68
75
|
Units: '°',
|
|
69
76
|
RangeEnumeration: {
|
|
@@ -76,6 +83,7 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
76
83
|
Name: 'Source',
|
|
77
84
|
Mandatory: true,
|
|
78
85
|
Type: ResourceType.String,
|
|
86
|
+
Multiple: false,
|
|
79
87
|
Description: 'The source of the geo location, e.g. GNSS, SCELL, MCELL, WIFI.'
|
|
80
88
|
},
|
|
81
89
|
99: {
|
|
@@ -83,9 +91,12 @@ void describe('generateLwM2MDefinitions()', function() {
|
|
|
83
91
|
Name: 'Timestamp',
|
|
84
92
|
Mandatory: true,
|
|
85
93
|
Type: ResourceType.Time,
|
|
94
|
+
Multiple: false,
|
|
86
95
|
Description: 'The timestamp of when the location measurement was performed.'
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
});
|
|
99
|
+
// Support for multiple instance resources
|
|
100
|
+
assert.deepEqual((_definitions_LwM2MObjectID_NRFCloudServiceInfo_14401_Resources_ = definitions[LwM2MObjectID.NRFCloudServiceInfo_14401].Resources[0]) === null || _definitions_LwM2MObjectID_NRFCloudServiceInfo_14401_Resources_ === void 0 ? void 0 : _definitions_LwM2MObjectID_NRFCloudServiceInfo_14401_Resources_.Multiple, true);
|
|
90
101
|
});
|
|
91
102
|
});
|
|
@@ -47,23 +47,35 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
47
47
|
import ts from 'typescript';
|
|
48
48
|
import { addDocBlock } from './addDocBlock.js';
|
|
49
49
|
export var generateLwm2mTimestampResources = function(timestampResources) {
|
|
50
|
+
var importLwM2MObjectID = ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([
|
|
51
|
+
ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier("LwM2MObjectID"))
|
|
52
|
+
])), ts.factory.createStringLiteral('./LwM2MObjectID.js'));
|
|
50
53
|
var type = ts.factory.createVariableStatement([
|
|
51
54
|
ts.factory.createToken(ts.SyntaxKind.ExportKeyword)
|
|
52
55
|
], ts.factory.createVariableDeclarationList([
|
|
53
56
|
ts.factory.createVariableDeclaration(ts.factory.createIdentifier("timestampResources"), undefined, ts.factory.createTypeReferenceNode('Readonly', [
|
|
54
|
-
ts.factory.createTypeReferenceNode('
|
|
55
|
-
ts.factory.createTypeReferenceNode('
|
|
57
|
+
ts.factory.createTypeReferenceNode('Map', [
|
|
58
|
+
ts.factory.createTypeReferenceNode('LwM2MObjectID'),
|
|
56
59
|
ts.factory.createTypeReferenceNode('number')
|
|
57
60
|
])
|
|
58
|
-
]), ts.factory.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
]), ts.factory.createNewExpression(ts.factory.createIdentifier('Map'), [
|
|
62
|
+
ts.factory.createTypeReferenceNode('LwM2MObjectID'),
|
|
63
|
+
ts.factory.createTypeReferenceNode('number')
|
|
64
|
+
], [
|
|
65
|
+
ts.factory.createArrayLiteralExpression(Object.entries(timestampResources).map(function(param) {
|
|
66
|
+
var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
|
|
67
|
+
return ts.factory.createArrayLiteralExpression([
|
|
68
|
+
ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('LwM2MObjectID'), ts.factory.createIdentifier(k)),
|
|
69
|
+
ts.factory.createNumericLiteral(v)
|
|
70
|
+
]);
|
|
71
|
+
}))
|
|
72
|
+
]))
|
|
62
73
|
], ts.NodeFlags.Const));
|
|
63
74
|
addDocBlock([
|
|
64
75
|
'Contains the ID of the resource that defines the timestamp for each LwM2M object definition'
|
|
65
76
|
], type);
|
|
66
77
|
return [
|
|
78
|
+
importLwM2MObjectID,
|
|
67
79
|
type
|
|
68
80
|
];
|
|
69
81
|
};
|
|
@@ -25,7 +25,13 @@ export var generateType = function(param) {
|
|
|
25
25
|
ts.factory.createPropertySignature(undefined, ts.factory.createIdentifier('Resources'), undefined, ts.factory.createTypeLiteralNode(byImportance(Array.isArray(Resources.Item) ? Resources.Item : [
|
|
26
26
|
Resources.Item
|
|
27
27
|
]).map(function(resource) {
|
|
28
|
-
var
|
|
28
|
+
var valueType = typeScriptResourceType(resource.Type);
|
|
29
|
+
if (resource.MultipleInstances === 'Multiple') {
|
|
30
|
+
valueType = ts.factory.createTypeReferenceNode('Array', [
|
|
31
|
+
valueType
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
var res = ts.factory.createPropertySignature(undefined, ts.factory.createIdentifier("".concat(resource.$.ID)), resource.Mandatory === 'Mandatory' ? undefined : ts.factory.createToken(ts.SyntaxKind.QuestionToken), valueType);
|
|
29
35
|
var docs = [
|
|
30
36
|
"".concat(resource.Name).concat(resource.Units.length > 0 ? " (".concat(resource.Units, ")") : ''),
|
|
31
37
|
"",
|
package/dist/generator/lwm2m.js
CHANGED
|
@@ -33,6 +33,7 @@ import { generateLwm2mTimestampResources } from './generateLwm2mTimestampResourc
|
|
|
33
33
|
import { printNode } from './printNode.js';
|
|
34
34
|
import os from 'node:os';
|
|
35
35
|
import { generateLwM2MDefinitions } from './generateLwM2MDefinitions.js';
|
|
36
|
+
import { generateName } from './generateType.js';
|
|
36
37
|
var baseDir = process.cwd();
|
|
37
38
|
var subDir = function() {
|
|
38
39
|
for(var _len = arguments.length, tree = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -87,7 +88,7 @@ try {
|
|
|
87
88
|
if (Item.Type === 'Time') ResourceId = parseInt(Item.$.ID, 10);
|
|
88
89
|
}
|
|
89
90
|
if (ResourceId === undefined) throw new Error("No Time resource found in ".concat(ObjectID, "!"));
|
|
90
|
-
timestampResources[
|
|
91
|
+
timestampResources[generateName(definition1)] = ResourceId;
|
|
91
92
|
console.log(' ', chalk.gray('·'), "".concat(chalk.white(ObjectID)).concat(chalk.gray('.')).concat(chalk.white(ResourceId)));
|
|
92
93
|
}
|
|
93
94
|
} catch (err) {
|
|
@@ -55,7 +55,10 @@ export var LWM2MObjectDefinition = Type.Object({
|
|
|
55
55
|
Type.Literal('W'),
|
|
56
56
|
Type.Literal('RW')
|
|
57
57
|
]),
|
|
58
|
-
MultipleInstances: Type.
|
|
58
|
+
MultipleInstances: Type.Union([
|
|
59
|
+
Type.Literal('Single'),
|
|
60
|
+
Type.Literal('Multiple')
|
|
61
|
+
]),
|
|
59
62
|
Mandatory: Type.Union([
|
|
60
63
|
Type.Literal('Optional'),
|
|
61
64
|
Type.Literal('Mandatory')
|
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
*
|
|
53
53
|
* Describes application configuration
|
|
54
54
|
*/ LwM2MObjectID[LwM2MObjectID["ApplicationConfiguration_14301"] = 14301] = "ApplicationConfiguration_14301";
|
|
55
|
+
/**
|
|
56
|
+
* nRF Cloud Service Info (14401)
|
|
57
|
+
*
|
|
58
|
+
* Describes the services supported by the device.
|
|
59
|
+
*/ LwM2MObjectID[LwM2MObjectID["NRFCloudServiceInfo_14401"] = 14401] = "NRFCloudServiceInfo_14401";
|
|
55
60
|
})(LwM2MObjectID || (LwM2MObjectID = {}));
|
|
56
61
|
/**
|
|
57
62
|
* The LwM2M Object IDs defined in this repo.
|
|
@@ -65,5 +70,6 @@
|
|
|
65
70
|
14220,
|
|
66
71
|
14230,
|
|
67
72
|
14240,
|
|
68
|
-
14301
|
|
73
|
+
14301,
|
|
74
|
+
14401
|
|
69
75
|
];
|
|
@@ -27,6 +27,7 @@ var _obj;
|
|
|
27
27
|
Name: "Latitude",
|
|
28
28
|
Mandatory: true,
|
|
29
29
|
Type: ResourceType.Float,
|
|
30
|
+
Multiple: false,
|
|
30
31
|
Description: "The decimal notation of latitude in degrees, e.g. -43.5723 [World Geodetic System 1984].",
|
|
31
32
|
RangeEnumeration: {
|
|
32
33
|
min: -90,
|
|
@@ -46,6 +47,7 @@ var _obj;
|
|
|
46
47
|
Name: "Longitude",
|
|
47
48
|
Mandatory: true,
|
|
48
49
|
Type: ResourceType.Float,
|
|
50
|
+
Multiple: false,
|
|
49
51
|
Description: "The decimal notation of longitude in degrees, e.g. 153.21760 [World Geodetic System 1984].",
|
|
50
52
|
RangeEnumeration: {
|
|
51
53
|
min: -180,
|
|
@@ -62,6 +64,7 @@ var _obj;
|
|
|
62
64
|
Name: "Altitude",
|
|
63
65
|
Mandatory: false,
|
|
64
66
|
Type: ResourceType.Float,
|
|
67
|
+
Multiple: false,
|
|
65
68
|
Description: "The decimal notation of altitude in meters above sea level.",
|
|
66
69
|
Units: "m"
|
|
67
70
|
},
|
|
@@ -74,6 +77,7 @@ var _obj;
|
|
|
74
77
|
Name: "Radius",
|
|
75
78
|
Mandatory: false,
|
|
76
79
|
Type: ResourceType.Float,
|
|
80
|
+
Multiple: false,
|
|
77
81
|
Description: "The value in this resource indicates the radius of a circular area in meters. The circular area is used to describe uncertainty about a point for coordinates in a two-dimensional coordinate reference systems (CRS). The center point of a circular area is specified by using the Latitude and the Longitude Resources.",
|
|
78
82
|
Units: "m"
|
|
79
83
|
},
|
|
@@ -86,6 +90,7 @@ var _obj;
|
|
|
86
90
|
Name: "Speed",
|
|
87
91
|
Mandatory: false,
|
|
88
92
|
Type: ResourceType.Float,
|
|
93
|
+
Multiple: false,
|
|
89
94
|
Description: "Speed is the time rate of change in position.",
|
|
90
95
|
Units: "m/s"
|
|
91
96
|
},
|
|
@@ -101,6 +106,7 @@ var _obj;
|
|
|
101
106
|
Name: "Heading",
|
|
102
107
|
Mandatory: false,
|
|
103
108
|
Type: ResourceType.Float,
|
|
109
|
+
Multiple: false,
|
|
104
110
|
Description: "The angle of movement in degrees.",
|
|
105
111
|
RangeEnumeration: {
|
|
106
112
|
min: 0,
|
|
@@ -117,6 +123,7 @@ var _obj;
|
|
|
117
123
|
Name: "Source",
|
|
118
124
|
Mandatory: true,
|
|
119
125
|
Type: ResourceType.String,
|
|
126
|
+
Multiple: false,
|
|
120
127
|
Description: "The source of the geo location, e.g. GNSS, SCELL, MCELL, WIFI."
|
|
121
128
|
},
|
|
122
129
|
/**
|
|
@@ -128,6 +135,7 @@ var _obj;
|
|
|
128
135
|
Name: "Timestamp",
|
|
129
136
|
Mandatory: true,
|
|
130
137
|
Type: ResourceType.Time,
|
|
138
|
+
Multiple: false,
|
|
131
139
|
Description: "The timestamp of when the location measurement was performed."
|
|
132
140
|
}
|
|
133
141
|
}
|
|
@@ -146,6 +154,7 @@ var _obj;
|
|
|
146
154
|
Name: "State of charge",
|
|
147
155
|
Mandatory: false,
|
|
148
156
|
Type: ResourceType.Integer,
|
|
157
|
+
Multiple: false,
|
|
149
158
|
Description: "State of charge in percent. Examples: 23, 1, 100.",
|
|
150
159
|
RangeEnumeration: {
|
|
151
160
|
min: 0,
|
|
@@ -162,6 +171,7 @@ var _obj;
|
|
|
162
171
|
Name: "Voltage",
|
|
163
172
|
Mandatory: false,
|
|
164
173
|
Type: ResourceType.Float,
|
|
174
|
+
Multiple: false,
|
|
165
175
|
Description: "Battery voltage in Volt. Examples: 2.754, 3.3.",
|
|
166
176
|
Units: "V"
|
|
167
177
|
},
|
|
@@ -174,6 +184,7 @@ var _obj;
|
|
|
174
184
|
Name: "Charge current",
|
|
175
185
|
Mandatory: false,
|
|
176
186
|
Type: ResourceType.Float,
|
|
187
|
+
Multiple: false,
|
|
177
188
|
Description: "Charge current in mA. Examples: 429, -244.",
|
|
178
189
|
Units: "mA"
|
|
179
190
|
},
|
|
@@ -186,6 +197,7 @@ var _obj;
|
|
|
186
197
|
Name: "Battery temperature",
|
|
187
198
|
Mandatory: false,
|
|
188
199
|
Type: ResourceType.Float,
|
|
200
|
+
Multiple: false,
|
|
189
201
|
Description: "Battery temperature in Celsius. Examples: 21.7, 23.123.",
|
|
190
202
|
Units: "C"
|
|
191
203
|
},
|
|
@@ -198,6 +210,7 @@ var _obj;
|
|
|
198
210
|
Name: "Time to full",
|
|
199
211
|
Mandatory: false,
|
|
200
212
|
Type: ResourceType.Integer,
|
|
213
|
+
Multiple: false,
|
|
201
214
|
Description: "Time to full in seconds. Examples: 4652.",
|
|
202
215
|
Units: "s"
|
|
203
216
|
},
|
|
@@ -210,6 +223,7 @@ var _obj;
|
|
|
210
223
|
Name: "Time to empty",
|
|
211
224
|
Mandatory: false,
|
|
212
225
|
Type: ResourceType.Integer,
|
|
226
|
+
Multiple: false,
|
|
213
227
|
Description: "Time to empty in seconds. Examples: 4652.",
|
|
214
228
|
Units: "s"
|
|
215
229
|
},
|
|
@@ -222,6 +236,7 @@ var _obj;
|
|
|
222
236
|
Name: "Timestamp",
|
|
223
237
|
Mandatory: true,
|
|
224
238
|
Type: ResourceType.Time,
|
|
239
|
+
Multiple: false,
|
|
225
240
|
Description: "The timestamp of when the measurement was performed."
|
|
226
241
|
}
|
|
227
242
|
}
|
|
@@ -240,6 +255,7 @@ var _obj;
|
|
|
240
255
|
Name: "Network mode",
|
|
241
256
|
Mandatory: false,
|
|
242
257
|
Type: ResourceType.String,
|
|
258
|
+
Multiple: false,
|
|
243
259
|
Description: "Examples: LTE-M, NB-IoT."
|
|
244
260
|
},
|
|
245
261
|
/**
|
|
@@ -251,6 +267,7 @@ var _obj;
|
|
|
251
267
|
Name: "Band",
|
|
252
268
|
Mandatory: false,
|
|
253
269
|
Type: ResourceType.Integer,
|
|
270
|
+
Multiple: false,
|
|
254
271
|
Description: "E-UTRA Absolute Radio Frequency Channel Number (EARFCN) of the current cell where the EARFCN is as defined in 3GPP TS 36.101. LTE carrier channel number for unique identification of LTE band and carrier frequency. Examples: 262143"
|
|
255
272
|
},
|
|
256
273
|
/**
|
|
@@ -262,6 +279,7 @@ var _obj;
|
|
|
262
279
|
Name: "RSRP",
|
|
263
280
|
Mandatory: false,
|
|
264
281
|
Type: ResourceType.Integer,
|
|
282
|
+
Multiple: false,
|
|
265
283
|
Description: "Reference Signal Received Power (RSRP). The average power level in dBm received from a single reference signal in an LTE (Long-term Evolution) network. Typically this value ranges from -140 to -40 dBm. Examples: -97, -104.",
|
|
266
284
|
Units: "dBm"
|
|
267
285
|
},
|
|
@@ -274,6 +292,7 @@ var _obj;
|
|
|
274
292
|
Name: "Area",
|
|
275
293
|
Mandatory: false,
|
|
276
294
|
Type: ResourceType.Integer,
|
|
295
|
+
Multiple: false,
|
|
277
296
|
Description: "Area code. Examples: 12"
|
|
278
297
|
},
|
|
279
298
|
/**
|
|
@@ -285,6 +304,7 @@ var _obj;
|
|
|
285
304
|
Name: "Cell",
|
|
286
305
|
Mandatory: false,
|
|
287
306
|
Type: ResourceType.Integer,
|
|
307
|
+
Multiple: false,
|
|
288
308
|
Description: "The cell ID the User Equipment (UE) is camped on. 4-byte Evolved Terrestrial Radio Access Network (E-UTRAN) cell ID. Examples: 33703719"
|
|
289
309
|
},
|
|
290
310
|
/**
|
|
@@ -296,6 +316,7 @@ var _obj;
|
|
|
296
316
|
Name: "Mobile country code and mobile network code",
|
|
297
317
|
Mandatory: false,
|
|
298
318
|
Type: ResourceType.Integer,
|
|
319
|
+
Multiple: false,
|
|
299
320
|
Description: "Examples: 24202, 310410"
|
|
300
321
|
},
|
|
301
322
|
/**
|
|
@@ -307,6 +328,7 @@ var _obj;
|
|
|
307
328
|
Name: "IP address",
|
|
308
329
|
Mandatory: false,
|
|
309
330
|
Type: ResourceType.String,
|
|
331
|
+
Multiple: false,
|
|
310
332
|
Description: "Examples: 10.81.183.99, 2001:0db8:85a3:0000:0000:8a2e:0370:7334, 2001:db8:85a3::8a2e:370:7334"
|
|
311
333
|
},
|
|
312
334
|
/**
|
|
@@ -318,6 +340,7 @@ var _obj;
|
|
|
318
340
|
Name: "Energy Estimate",
|
|
319
341
|
Mandatory: false,
|
|
320
342
|
Type: ResourceType.Integer,
|
|
343
|
+
Multiple: false,
|
|
321
344
|
Description: "The %CONEVAL AT command returns amongst other data the energy estimate: Relative estimated energy consumption of data transmission compared to nominal consumption. A higher value means smaller energy consumption. 5: Difficulties in setting up connections. Maximum number of repetitions might be needed for data. 6: Poor conditions. Setting up a connection might require retries and a higher number of repetitions for data. 7: Normal conditions for cIoT device. No repetitions for data or only a few repetitions in the worst case. 8: Good conditions. Possibly very good conditions for small amounts of data. 9: Very good conditions. Efficient data transfer estimated also for larger amounts of data. Examples: 5, 7"
|
|
322
345
|
},
|
|
323
346
|
/**
|
|
@@ -329,6 +352,7 @@ var _obj;
|
|
|
329
352
|
Name: "Timestamp",
|
|
330
353
|
Mandatory: true,
|
|
331
354
|
Type: ResourceType.Time,
|
|
355
|
+
Multiple: false,
|
|
332
356
|
Description: "The timestamp of when the measurement was performed."
|
|
333
357
|
}
|
|
334
358
|
}
|
|
@@ -347,6 +371,7 @@ var _obj;
|
|
|
347
371
|
Name: "IMEI",
|
|
348
372
|
Mandatory: true,
|
|
349
373
|
Type: ResourceType.String,
|
|
374
|
+
Multiple: false,
|
|
350
375
|
Description: "Board IMEI. Examples: 352656106111232."
|
|
351
376
|
},
|
|
352
377
|
/**
|
|
@@ -358,6 +383,7 @@ var _obj;
|
|
|
358
383
|
Name: "SIM ICCID",
|
|
359
384
|
Mandatory: false,
|
|
360
385
|
Type: ResourceType.String,
|
|
386
|
+
Multiple: false,
|
|
361
387
|
Description: "Examples: 89450421180216216095."
|
|
362
388
|
},
|
|
363
389
|
/**
|
|
@@ -369,6 +395,7 @@ var _obj;
|
|
|
369
395
|
Name: "Modem firmware version",
|
|
370
396
|
Mandatory: true,
|
|
371
397
|
Type: ResourceType.String,
|
|
398
|
+
Multiple: false,
|
|
372
399
|
Description: "Examples: mfw_nrf9160_1.0.0."
|
|
373
400
|
},
|
|
374
401
|
/**
|
|
@@ -380,6 +407,7 @@ var _obj;
|
|
|
380
407
|
Name: "Application firmware version",
|
|
381
408
|
Mandatory: true,
|
|
382
409
|
Type: ResourceType.String,
|
|
410
|
+
Multiple: false,
|
|
383
411
|
Description: "Examples: v1.0.0-rc1-327-g6fc8c16b239f."
|
|
384
412
|
},
|
|
385
413
|
/**
|
|
@@ -391,6 +419,7 @@ var _obj;
|
|
|
391
419
|
Name: "Board version",
|
|
392
420
|
Mandatory: true,
|
|
393
421
|
Type: ResourceType.String,
|
|
422
|
+
Multiple: false,
|
|
394
423
|
Description: "Examples: thingy91_nrf9160."
|
|
395
424
|
},
|
|
396
425
|
/**
|
|
@@ -402,6 +431,7 @@ var _obj;
|
|
|
402
431
|
Name: "Battery model",
|
|
403
432
|
Mandatory: false,
|
|
404
433
|
Type: ResourceType.String,
|
|
434
|
+
Multiple: false,
|
|
405
435
|
Description: "Examples: LP302535, LP502540, LP803035."
|
|
406
436
|
},
|
|
407
437
|
/**
|
|
@@ -413,6 +443,7 @@ var _obj;
|
|
|
413
443
|
Name: "Timestamp",
|
|
414
444
|
Mandatory: true,
|
|
415
445
|
Type: ResourceType.Time,
|
|
446
|
+
Multiple: false,
|
|
416
447
|
Description: "The timestamp of when the measurement was performed."
|
|
417
448
|
}
|
|
418
449
|
}
|
|
@@ -431,6 +462,7 @@ var _obj;
|
|
|
431
462
|
Name: "Temperature",
|
|
432
463
|
Mandatory: false,
|
|
433
464
|
Type: ResourceType.Float,
|
|
465
|
+
Multiple: false,
|
|
434
466
|
Description: "Environmental temperature in Celsius. Examples: 23.5, -10.2.",
|
|
435
467
|
Units: "\u00B0C"
|
|
436
468
|
},
|
|
@@ -446,6 +478,7 @@ var _obj;
|
|
|
446
478
|
Name: "Humidity",
|
|
447
479
|
Mandatory: false,
|
|
448
480
|
Type: ResourceType.Float,
|
|
481
|
+
Multiple: false,
|
|
449
482
|
Description: "Environmental humidity in percent. Examples: 44.2, 72.",
|
|
450
483
|
RangeEnumeration: {
|
|
451
484
|
min: 0,
|
|
@@ -462,6 +495,7 @@ var _obj;
|
|
|
462
495
|
Name: "Atmospheric pressure",
|
|
463
496
|
Mandatory: false,
|
|
464
497
|
Type: ResourceType.Float,
|
|
498
|
+
Multiple: false,
|
|
465
499
|
Description: "Atmospheric pressure in hectopascal. Examples: 1003.6, 977.",
|
|
466
500
|
Units: "hPa"
|
|
467
501
|
},
|
|
@@ -474,6 +508,7 @@ var _obj;
|
|
|
474
508
|
Name: "Air Quality Index",
|
|
475
509
|
Mandatory: false,
|
|
476
510
|
Type: ResourceType.Integer,
|
|
511
|
+
Multiple: false,
|
|
477
512
|
Description: "The Bosch BME680 sensor calculates an Air Quality Index. See https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf"
|
|
478
513
|
},
|
|
479
514
|
/**
|
|
@@ -485,6 +520,7 @@ var _obj;
|
|
|
485
520
|
Name: "Timestamp",
|
|
486
521
|
Mandatory: true,
|
|
487
522
|
Type: ResourceType.Time,
|
|
523
|
+
Multiple: false,
|
|
488
524
|
Description: "The timestamp of when the measurement was performed."
|
|
489
525
|
}
|
|
490
526
|
}
|
|
@@ -503,6 +539,7 @@ var _obj;
|
|
|
503
539
|
Name: "Gain",
|
|
504
540
|
Mandatory: true,
|
|
505
541
|
Type: ResourceType.Float,
|
|
542
|
+
Multiple: false,
|
|
506
543
|
Description: "The current gain from the solar shield, measured in mA. Example: 3.123, -0.0032.",
|
|
507
544
|
Units: "mA"
|
|
508
545
|
},
|
|
@@ -515,6 +552,7 @@ var _obj;
|
|
|
515
552
|
Name: "Voltage",
|
|
516
553
|
Mandatory: false,
|
|
517
554
|
Type: ResourceType.Float,
|
|
555
|
+
Multiple: false,
|
|
518
556
|
Description: "Battery voltage in Volt. Examples: 2.754, 3.3.",
|
|
519
557
|
Units: "V"
|
|
520
558
|
},
|
|
@@ -527,6 +565,7 @@ var _obj;
|
|
|
527
565
|
Name: "Timestamp",
|
|
528
566
|
Mandatory: true,
|
|
529
567
|
Type: ResourceType.Time,
|
|
568
|
+
Multiple: false,
|
|
530
569
|
Description: "The timestamp of when the measurement was performed."
|
|
531
570
|
}
|
|
532
571
|
}
|
|
@@ -545,6 +584,7 @@ var _obj;
|
|
|
545
584
|
Name: "Timestamp",
|
|
546
585
|
Mandatory: true,
|
|
547
586
|
Type: ResourceType.Time,
|
|
587
|
+
Multiple: false,
|
|
548
588
|
Description: "The timestamp of when the button was pressed."
|
|
549
589
|
}
|
|
550
590
|
}
|
|
@@ -563,6 +603,7 @@ var _obj;
|
|
|
563
603
|
Name: "Sea Water Level",
|
|
564
604
|
Mandatory: true,
|
|
565
605
|
Type: ResourceType.Float,
|
|
606
|
+
Multiple: false,
|
|
566
607
|
Description: "The observed sea water level relative the the sea level elevation of the sea map. Examples: 134.2, 104.5.",
|
|
567
608
|
Units: "cm"
|
|
568
609
|
},
|
|
@@ -575,6 +616,7 @@ var _obj;
|
|
|
575
616
|
Name: "Station code",
|
|
576
617
|
Mandatory: true,
|
|
577
618
|
Type: ResourceType.String,
|
|
619
|
+
Multiple: false,
|
|
578
620
|
Description: "The code of the observation station. Examples: TRD, SVG."
|
|
579
621
|
},
|
|
580
622
|
/**
|
|
@@ -586,6 +628,7 @@ var _obj;
|
|
|
586
628
|
Name: "Timestamp",
|
|
587
629
|
Mandatory: true,
|
|
588
630
|
Type: ResourceType.Time,
|
|
631
|
+
Multiple: false,
|
|
589
632
|
Description: "The timestamp of when the observation was made."
|
|
590
633
|
}
|
|
591
634
|
}
|
|
@@ -604,6 +647,7 @@ var _obj;
|
|
|
604
647
|
Name: "Red",
|
|
605
648
|
Mandatory: true,
|
|
606
649
|
Type: ResourceType.Integer,
|
|
650
|
+
Multiple: false,
|
|
607
651
|
Description: "The red brightness level of the LED.",
|
|
608
652
|
RangeEnumeration: {
|
|
609
653
|
min: 0,
|
|
@@ -622,6 +666,7 @@ var _obj;
|
|
|
622
666
|
Name: "Green",
|
|
623
667
|
Mandatory: true,
|
|
624
668
|
Type: ResourceType.Integer,
|
|
669
|
+
Multiple: false,
|
|
625
670
|
Description: "The green brightness level of the LED.",
|
|
626
671
|
RangeEnumeration: {
|
|
627
672
|
min: 0,
|
|
@@ -640,6 +685,7 @@ var _obj;
|
|
|
640
685
|
Name: "Blue",
|
|
641
686
|
Mandatory: true,
|
|
642
687
|
Type: ResourceType.Integer,
|
|
688
|
+
Multiple: false,
|
|
643
689
|
Description: "The blue brightness level of the LED.",
|
|
644
690
|
RangeEnumeration: {
|
|
645
691
|
min: 0,
|
|
@@ -655,6 +701,7 @@ var _obj;
|
|
|
655
701
|
Name: "Timestamp",
|
|
656
702
|
Mandatory: true,
|
|
657
703
|
Type: ResourceType.Time,
|
|
704
|
+
Multiple: false,
|
|
658
705
|
Description: "The timestamp of when the LED was changed."
|
|
659
706
|
}
|
|
660
707
|
}
|
|
@@ -673,6 +720,7 @@ var _obj;
|
|
|
673
720
|
Name: "Update interval",
|
|
674
721
|
Mandatory: true,
|
|
675
722
|
Type: ResourceType.Integer,
|
|
723
|
+
Multiple: false,
|
|
676
724
|
Description: "The update interval in seconds. Examples: 10, 3600.",
|
|
677
725
|
RangeEnumeration: {
|
|
678
726
|
min: 0,
|
|
@@ -688,6 +736,7 @@ var _obj;
|
|
|
688
736
|
Name: "GNSS enabled",
|
|
689
737
|
Mandatory: true,
|
|
690
738
|
Type: ResourceType.Boolean,
|
|
739
|
+
Multiple: false,
|
|
691
740
|
Description: "Whether to enabled the device's GNSS receiver."
|
|
692
741
|
},
|
|
693
742
|
/**
|
|
@@ -699,7 +748,39 @@ var _obj;
|
|
|
699
748
|
Name: "Timestamp",
|
|
700
749
|
Mandatory: true,
|
|
701
750
|
Type: ResourceType.Time,
|
|
751
|
+
Multiple: false,
|
|
702
752
|
Description: "The timestamp of when the configuration was updated."
|
|
703
753
|
}
|
|
704
754
|
}
|
|
755
|
+
}), /**
|
|
756
|
+
* nRF Cloud Service Info (14401)
|
|
757
|
+
*
|
|
758
|
+
* Describes the services supported by the device.
|
|
759
|
+
*/ _define_property(_obj, LwM2MObjectID.NRFCloudServiceInfo_14401, {
|
|
760
|
+
ObjectID: LwM2MObjectID.NRFCloudServiceInfo_14401,
|
|
761
|
+
ObjectVersion: "1.0",
|
|
762
|
+
Name: "nRF Cloud Service Info",
|
|
763
|
+
Description: "Describes the services supported by the device.",
|
|
764
|
+
Resources: {
|
|
765
|
+
0: {
|
|
766
|
+
ResourceID: 0,
|
|
767
|
+
Name: "FOTA",
|
|
768
|
+
Mandatory: false,
|
|
769
|
+
Type: ResourceType.String,
|
|
770
|
+
Multiple: true,
|
|
771
|
+
Description: "The types of firmwares the device supports. Examples: \"APP\", \"MODEM\"."
|
|
772
|
+
},
|
|
773
|
+
/**
|
|
774
|
+
* Timestamp (Time)
|
|
775
|
+
*
|
|
776
|
+
* The timestamp of when the service info was updated.
|
|
777
|
+
*/ 99: {
|
|
778
|
+
ResourceID: 99,
|
|
779
|
+
Name: "Timestamp",
|
|
780
|
+
Mandatory: true,
|
|
781
|
+
Type: ResourceType.Time,
|
|
782
|
+
Multiple: false,
|
|
783
|
+
Description: "The timestamp of when the service info was updated."
|
|
784
|
+
}
|
|
785
|
+
}
|
|
705
786
|
}), _obj);
|
package/dist/lwm2m/instanceTs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { definitions } from './definitions.js';
|
|
|
2
2
|
import { timestampResources } from './timestampResources.js';
|
|
3
3
|
export var instanceTs = function(instance) {
|
|
4
4
|
var definition = definitions[instance.ObjectID];
|
|
5
|
-
var tsResourceId = timestampResources
|
|
5
|
+
var tsResourceId = timestampResources.get(definition.ObjectID)// All registered objects must have a timestamp resource
|
|
6
6
|
;
|
|
7
7
|
return instance.Resources[tsResourceId];
|
|
8
8
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TimeResource, StringResource, OptionalResource, validateInstance } from "../validation.js";
|
|
2
|
+
import { LwM2MObjectID } from "../LwM2MObjectID.js";
|
|
3
|
+
/**
|
|
4
|
+
* Validate nRF Cloud Service Info (14401)
|
|
5
|
+
*
|
|
6
|
+
* Ensures the given object is an LwM2M object according to the schema 14401.xml.
|
|
7
|
+
*/ export var validate14401 = function(o) {
|
|
8
|
+
return validateInstance(LwM2MObjectID.NRFCloudServiceInfo_14401, "1.0", {
|
|
9
|
+
99: TimeResource,
|
|
10
|
+
0: OptionalResource(StringResource)
|
|
11
|
+
})(o);
|
|
12
|
+
};
|
package/dist/lwm2m/objects.js
CHANGED
|
@@ -8,3 +8,4 @@ export { validate14220 } from "./object/validate14220.js";
|
|
|
8
8
|
export { validate14230 } from "./object/validate14230.js";
|
|
9
9
|
export { validate14240 } from "./object/validate14240.js";
|
|
10
10
|
export { validate14301 } from "./object/validate14301.js";
|
|
11
|
+
export { validate14401 } from "./object/validate14401.js";
|