@hello.nrfcloud.com/proto-map 12.0.0 → 12.1.1

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.
@@ -80,10 +80,10 @@ export var isLwM2MObject = function(object) {
80
80
  // All values must be number, string, boolean
81
81
  for(var _iterator = Object.values(object.Resources)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
82
82
  var v = _step.value;
83
- if (v === undefined) continue;
84
- if (typeof v === 'string') continue;
85
- if (typeof v === 'boolean') continue;
86
- if (typeof v === 'number') continue;
83
+ if (isSimpleResource(v)) continue;
84
+ if (Array.isArray(v) && v.every(function(v) {
85
+ return isSimpleResource(v);
86
+ })) continue;
87
87
  return error("Invalid value type ".concat(typeof v === "undefined" ? "undefined" : _type_of(v)));
88
88
  }
89
89
  } catch (err) {
@@ -104,6 +104,13 @@ export var isLwM2MObject = function(object) {
104
104
  object: object
105
105
  };
106
106
  };
107
+ var isSimpleResource = function(v) {
108
+ if (v === undefined) return true;
109
+ if (typeof v === 'string') return true;
110
+ if (typeof v === 'boolean') return true;
111
+ if (typeof v === 'number') return true;
112
+ return false;
113
+ };
107
114
  export var validateInstance = function(ObjectID, ObjectVersion, Resources) {
108
115
  return function(o) {
109
116
  var error = function(message) {
@@ -165,3 +172,8 @@ export var OptionalResource = function(validator) {
165
172
  return r === undefined ? true : validator(r);
166
173
  };
167
174
  };
175
+ export var MultipleInstanceResource = function(validator) {
176
+ return function(r) {
177
+ return Array.isArray(r) && r.every(validator);
178
+ };
179
+ };
@@ -0,0 +1,39 @@
1
+ import assert from 'node:assert';
2
+ import { describe, it } from 'node:test';
3
+ import { MultipleInstanceResource, OptionalResource, StringResource } from './validation.js';
4
+ void describe('MultipleInstanceResource()', function() {
5
+ void it('should validate a multiple instance resource', function() {
6
+ assert.equal(true, MultipleInstanceResource(StringResource)([
7
+ 'BOOT',
8
+ 'MODEM',
9
+ 'APP'
10
+ ]));
11
+ });
12
+ });
13
+ void describe('StringResource()', function() {
14
+ void it('should validate a string', function() {
15
+ assert.equal(true, StringResource('test'));
16
+ });
17
+ });
18
+ void describe('OptionalResource()', function() {
19
+ void it('should validate an undefined resource', function() {
20
+ assert.equal(true, OptionalResource(StringResource)(undefined));
21
+ });
22
+ void it('should validate an defined resource', function() {
23
+ assert.equal(true, OptionalResource(StringResource)('foo'));
24
+ });
25
+ void it('should not validate an invalid defined resource', function() {
26
+ assert.equal(false, OptionalResource(StringResource)(true));
27
+ });
28
+ });
29
+ void describe('combination', function() {
30
+ void it('should validate OptionalResource(MultipleInstanceResource(StringResource))', function() {
31
+ assert.equal(true, OptionalResource(MultipleInstanceResource(StringResource))([
32
+ 'BOOT',
33
+ 'MODEM',
34
+ 'APP'
35
+ ]));
36
+ assert.equal(true, OptionalResource(MultipleInstanceResource(StringResource))(undefined));
37
+ assert.equal(false, OptionalResource(MultipleInstanceResource(StringResource))('foo'));
38
+ });
39
+ });
@@ -9,6 +9,7 @@ import { validate14220 } from "./object/validate14220.js";
9
9
  import { validate14230 } from "./object/validate14230.js";
10
10
  import { validate14240 } from "./object/validate14240.js";
11
11
  import { validate14301 } from "./object/validate14301.js";
12
+ import { validate14401 } from "./object/validate14401.js";
12
13
  /**
13
14
  * Contains the validators for all registered LwM2M objects.
14
15
  */ export var validators = new Map();
@@ -22,3 +23,4 @@ validators.set(LwM2MObjectID.ButtonPress_14220, validate14220);
22
23
  validators.set(LwM2MObjectID.SeaWaterLevel_14230, validate14230);
23
24
  validators.set(LwM2MObjectID.RGBLED_14240, validate14240);
24
25
  validators.set(LwM2MObjectID.ApplicationConfiguration_14301, validate14301);
26
+ validators.set(LwM2MObjectID.NRFCloudServiceInfo_14401, validate14401);
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://openmobilealliance.org/tech/profiles/LWM2M-v1_1.xsd">
3
+ <Object ObjectType="MODefinition">
4
+ <Name>nRF Cloud Service Info</Name>
5
+ <Description1><![CDATA[Describes the services supported by the device.]]></Description1>
6
+ <ObjectID>14401</ObjectID>
7
+ <ObjectURN>urn:oma:lwm2m:x:14401</ObjectURN>
8
+ <MultipleInstances>Multiple</MultipleInstances>
9
+ <Mandatory>Optional</Mandatory>
10
+ <Resources>
11
+ <Item ID="0">
12
+ <Name>FOTA</Name>
13
+ <Operations>RW</Operations>
14
+ <MultipleInstances>Multiple</MultipleInstances>
15
+ <Mandatory>Optional</Mandatory>
16
+ <Type>String</Type>
17
+ <RangeEnumeration/>
18
+ <Units/>
19
+ <Description><![CDATA[The types of firmwares the device supports. Examples: "APP", "MODEM".]]></Description>
20
+ </Item>
21
+ <Item ID="99">
22
+ <Name>Timestamp</Name>
23
+ <Operations>R</Operations>
24
+ <MultipleInstances>Single</MultipleInstances>
25
+ <Mandatory>Mandatory</Mandatory>
26
+ <Type>Time</Type>
27
+ <RangeEnumeration/>
28
+ <Units/>
29
+ <Description><![CDATA[The timestamp of when the service info was updated.]]></Description>
30
+ </Item>
31
+ </Resources>
32
+ <Description2/>
33
+ </Object>
34
+ </LWM2M>
@@ -49,7 +49,10 @@ export const LWM2MObjectDefinition = Type.Object(
49
49
  Type.Literal('W'),
50
50
  Type.Literal('RW'),
51
51
  ]),
52
- MultipleInstances: Type.Literal('Single'),
52
+ MultipleInstances: Type.Union([
53
+ Type.Literal('Single'),
54
+ Type.Literal('Multiple'),
55
+ ]),
53
56
  Mandatory: Type.Union([
54
57
  Type.Literal('Optional'),
55
58
  Type.Literal('Mandatory'),
@@ -19,6 +19,7 @@ export type LwM2MResourceInfo = {
19
19
  Description: string // e.g. 'The decimal notation of latitude, e.g. -43.5723 [World Geodetic System 1984].'
20
20
  RangeEnumeration?: Range
21
21
  Units?: string // e.g. 'lat'
22
+ Multiple: boolean
22
23
  }
23
24
 
24
25
  export type Range = {
@@ -61,7 +61,13 @@ export enum LwM2MObjectID {
61
61
  *
62
62
  * Describes application configuration
63
63
  */
64
- ApplicationConfiguration_14301 = 14301
64
+ ApplicationConfiguration_14301 = 14301,
65
+ /**
66
+ * nRF Cloud Service Info (14401)
67
+ *
68
+ * Describes the services supported by the device.
69
+ */
70
+ NRFCloudServiceInfo_14401 = 14401
65
71
  }
66
72
  /**
67
73
  * The LwM2M Object IDs defined in this repo.
@@ -86,4 +92,6 @@ export const LwM2MObjectIDs = [
86
92
  // RGB LED (14240)
87
93
  LwM2MObjectID.RGBLED_14240,
88
94
  // Application Configuration (14301)
89
- LwM2MObjectID.ApplicationConfiguration_14301];
95
+ LwM2MObjectID.ApplicationConfiguration_14301,
96
+ // nRF Cloud Service Info (14401)
97
+ LwM2MObjectID.NRFCloudServiceInfo_14401];
@@ -1,6 +1,13 @@
1
1
  import type { LwM2MObjectID } from './LwM2MObjectID.js'
2
2
 
3
- export type LwM2MResourceValue = string | number | boolean
3
+ export type LwM2MResourceValue =
4
+ | string
5
+ | number
6
+ | boolean
7
+ | Array<string>
8
+ | Array<number>
9
+ | Array<boolean>
10
+
4
11
  type GenericLwM2MObjectInstance = {
5
12
  ObjectID: LwM2MObjectID
6
13
  /**
@@ -4,7 +4,7 @@ export type Resource = {
4
4
  }
5
5
  Name: string // e.g. 'Latitude'
6
6
  Operations: 'R'
7
- MultipleInstances: 'Single'
7
+ MultipleInstances: 'Single' | 'Multiple'
8
8
  Mandatory: 'Optional' | 'Mandatory'
9
9
  Type: 'String' | 'Integer' | 'Float' | 'Boolean' | 'Opaque' | 'Time'
10
10
  RangeEnumeration: string // e.g. -10..10
@@ -16,7 +16,7 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
16
16
  * Minimum: -90
17
17
  * Maximum: 90
18
18
  */
19
- 0: { ResourceID: 0, Name: "Latitude", Mandatory: true, Type: ResourceType.Float, Description: "The decimal notation of latitude in degrees, e.g. -43.5723 [World Geodetic System 1984].", RangeEnumeration: { min: -90, max: 90 }, Units: "\u00B0" }, /**
19
+ 0: { ResourceID: 0, Name: "Latitude", Mandatory: true, Type: ResourceType.Float, Multiple: false, Description: "The decimal notation of latitude in degrees, e.g. -43.5723 [World Geodetic System 1984].", RangeEnumeration: { min: -90, max: 90 }, Units: "\u00B0" }, /**
20
20
  * Longitude (Float)
21
21
  *
22
22
  * The decimal notation of longitude in degrees, e.g. 153.21760 [World Geodetic System 1984].
@@ -24,22 +24,22 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
24
24
  * Minimum: -180
25
25
  * Maximum: 180
26
26
  */
27
- 1: { ResourceID: 1, Name: "Longitude", Mandatory: true, Type: ResourceType.Float, Description: "The decimal notation of longitude in degrees, e.g. 153.21760 [World Geodetic System 1984].", RangeEnumeration: { min: -180, max: 180 }, Units: "\u00B0" }, /**
27
+ 1: { ResourceID: 1, Name: "Longitude", Mandatory: true, Type: ResourceType.Float, Multiple: false, Description: "The decimal notation of longitude in degrees, e.g. 153.21760 [World Geodetic System 1984].", RangeEnumeration: { min: -180, max: 180 }, Units: "\u00B0" }, /**
28
28
  * Altitude (Float)
29
29
  *
30
30
  * The decimal notation of altitude in meters above sea level.
31
31
  */
32
- 2: { ResourceID: 2, Name: "Altitude", Mandatory: false, Type: ResourceType.Float, Description: "The decimal notation of altitude in meters above sea level.", Units: "m" }, /**
32
+ 2: { ResourceID: 2, Name: "Altitude", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "The decimal notation of altitude in meters above sea level.", Units: "m" }, /**
33
33
  * Radius (Float)
34
34
  *
35
35
  * 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.
36
36
  */
37
- 3: { ResourceID: 3, Name: "Radius", Mandatory: false, Type: ResourceType.Float, 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.", Units: "m" }, /**
37
+ 3: { ResourceID: 3, Name: "Radius", Mandatory: false, Type: ResourceType.Float, Multiple: false, 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.", Units: "m" }, /**
38
38
  * Speed (Float)
39
39
  *
40
40
  * Speed is the time rate of change in position.
41
41
  */
42
- 4: { ResourceID: 4, Name: "Speed", Mandatory: false, Type: ResourceType.Float, Description: "Speed is the time rate of change in position.", Units: "m/s" }, /**
42
+ 4: { ResourceID: 4, Name: "Speed", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Speed is the time rate of change in position.", Units: "m/s" }, /**
43
43
  * Heading (Float)
44
44
  *
45
45
  * The angle of movement in degrees.
@@ -47,17 +47,17 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
47
47
  * Minimum: 0
48
48
  * Maximum: 360
49
49
  */
50
- 5: { ResourceID: 5, Name: "Heading", Mandatory: false, Type: ResourceType.Float, Description: "The angle of movement in degrees.", RangeEnumeration: { min: 0, max: 360 }, Units: "\u00B0" }, /**
50
+ 5: { ResourceID: 5, Name: "Heading", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "The angle of movement in degrees.", RangeEnumeration: { min: 0, max: 360 }, Units: "\u00B0" }, /**
51
51
  * Source (String)
52
52
  *
53
53
  * The source of the geo location, e.g. GNSS, SCELL, MCELL, WIFI.
54
54
  */
55
- 6: { ResourceID: 6, Name: "Source", Mandatory: true, Type: ResourceType.String, Description: "The source of the geo location, e.g. GNSS, SCELL, MCELL, WIFI." }, /**
55
+ 6: { ResourceID: 6, Name: "Source", Mandatory: true, Type: ResourceType.String, Multiple: false, Description: "The source of the geo location, e.g. GNSS, SCELL, MCELL, WIFI." }, /**
56
56
  * Timestamp (Time)
57
57
  *
58
58
  * The timestamp of when the location measurement was performed.
59
59
  */
60
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the location measurement was performed." } } }, /**
60
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the location measurement was performed." } } }, /**
61
61
  * Battery and Power (14202)
62
62
  *
63
63
  * Information about the battery and power status of the device.
@@ -70,37 +70,37 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
70
70
  * Minimum: 0
71
71
  * Maximum: 100
72
72
  */
73
- 0: { ResourceID: 0, Name: "State of charge", Mandatory: false, Type: ResourceType.Integer, Description: "State of charge in percent. Examples: 23, 1, 100.", RangeEnumeration: { min: 0, max: 100 }, Units: "%" }, /**
73
+ 0: { ResourceID: 0, Name: "State of charge", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "State of charge in percent. Examples: 23, 1, 100.", RangeEnumeration: { min: 0, max: 100 }, Units: "%" }, /**
74
74
  * Voltage (Float)
75
75
  *
76
76
  * Battery voltage in Volt. Examples: 2.754, 3.3.
77
77
  */
78
- 1: { ResourceID: 1, Name: "Voltage", Mandatory: false, Type: ResourceType.Float, Description: "Battery voltage in Volt. Examples: 2.754, 3.3.", Units: "V" }, /**
78
+ 1: { ResourceID: 1, Name: "Voltage", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Battery voltage in Volt. Examples: 2.754, 3.3.", Units: "V" }, /**
79
79
  * Charge current (Float)
80
80
  *
81
81
  * Charge current in mA. Examples: 429, -244.
82
82
  */
83
- 2: { ResourceID: 2, Name: "Charge current", Mandatory: false, Type: ResourceType.Float, Description: "Charge current in mA. Examples: 429, -244.", Units: "mA" }, /**
83
+ 2: { ResourceID: 2, Name: "Charge current", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Charge current in mA. Examples: 429, -244.", Units: "mA" }, /**
84
84
  * Battery temperature (Float)
85
85
  *
86
86
  * Battery temperature in Celsius. Examples: 21.7, 23.123.
87
87
  */
88
- 3: { ResourceID: 3, Name: "Battery temperature", Mandatory: false, Type: ResourceType.Float, Description: "Battery temperature in Celsius. Examples: 21.7, 23.123.", Units: "C" }, /**
88
+ 3: { ResourceID: 3, Name: "Battery temperature", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Battery temperature in Celsius. Examples: 21.7, 23.123.", Units: "C" }, /**
89
89
  * Time to full (Integer)
90
90
  *
91
91
  * Time to full in seconds. Examples: 4652.
92
92
  */
93
- 4: { ResourceID: 4, Name: "Time to full", Mandatory: false, Type: ResourceType.Integer, Description: "Time to full in seconds. Examples: 4652.", Units: "s" }, /**
93
+ 4: { ResourceID: 4, Name: "Time to full", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "Time to full in seconds. Examples: 4652.", Units: "s" }, /**
94
94
  * Time to empty (Integer)
95
95
  *
96
96
  * Time to empty in seconds. Examples: 4652.
97
97
  */
98
- 5: { ResourceID: 5, Name: "Time to empty", Mandatory: false, Type: ResourceType.Integer, Description: "Time to empty in seconds. Examples: 4652.", Units: "s" }, /**
98
+ 5: { ResourceID: 5, Name: "Time to empty", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "Time to empty in seconds. Examples: 4652.", Units: "s" }, /**
99
99
  * Timestamp (Time)
100
100
  *
101
101
  * The timestamp of when the measurement was performed.
102
102
  */
103
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the measurement was performed." } } }, /**
103
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the measurement was performed." } } }, /**
104
104
  * Connection information (14203)
105
105
  *
106
106
  * Details about the device's connection.
@@ -110,47 +110,47 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
110
110
  *
111
111
  * Examples: LTE-M, NB-IoT.
112
112
  */
113
- 0: { ResourceID: 0, Name: "Network mode", Mandatory: false, Type: ResourceType.String, Description: "Examples: LTE-M, NB-IoT." }, /**
113
+ 0: { ResourceID: 0, Name: "Network mode", Mandatory: false, Type: ResourceType.String, Multiple: false, Description: "Examples: LTE-M, NB-IoT." }, /**
114
114
  * Band (Integer)
115
115
  *
116
116
  * 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
117
117
  */
118
- 1: { ResourceID: 1, Name: "Band", Mandatory: false, Type: ResourceType.Integer, 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" }, /**
118
+ 1: { ResourceID: 1, Name: "Band", Mandatory: false, Type: ResourceType.Integer, Multiple: false, 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" }, /**
119
119
  * RSRP (Integer)
120
120
  *
121
121
  * 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.
122
122
  */
123
- 2: { ResourceID: 2, Name: "RSRP", Mandatory: false, Type: ResourceType.Integer, 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.", Units: "dBm" }, /**
123
+ 2: { ResourceID: 2, Name: "RSRP", Mandatory: false, Type: ResourceType.Integer, Multiple: false, 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.", Units: "dBm" }, /**
124
124
  * Area (Integer)
125
125
  *
126
126
  * Area code. Examples: 12
127
127
  */
128
- 3: { ResourceID: 3, Name: "Area", Mandatory: false, Type: ResourceType.Integer, Description: "Area code. Examples: 12" }, /**
128
+ 3: { ResourceID: 3, Name: "Area", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "Area code. Examples: 12" }, /**
129
129
  * Cell (Integer)
130
130
  *
131
131
  * The cell ID the User Equipment (UE) is camped on. 4-byte Evolved Terrestrial Radio Access Network (E-UTRAN) cell ID. Examples: 33703719
132
132
  */
133
- 4: { ResourceID: 4, Name: "Cell", Mandatory: false, Type: ResourceType.Integer, Description: "The cell ID the User Equipment (UE) is camped on. 4-byte Evolved Terrestrial Radio Access Network (E-UTRAN) cell ID. Examples: 33703719" }, /**
133
+ 4: { ResourceID: 4, Name: "Cell", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "The cell ID the User Equipment (UE) is camped on. 4-byte Evolved Terrestrial Radio Access Network (E-UTRAN) cell ID. Examples: 33703719" }, /**
134
134
  * Mobile country code and mobile network code (Integer)
135
135
  *
136
136
  * Examples: 24202, 310410
137
137
  */
138
- 5: { ResourceID: 5, Name: "Mobile country code and mobile network code", Mandatory: false, Type: ResourceType.Integer, Description: "Examples: 24202, 310410" }, /**
138
+ 5: { ResourceID: 5, Name: "Mobile country code and mobile network code", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "Examples: 24202, 310410" }, /**
139
139
  * IP address (String)
140
140
  *
141
141
  * Examples: 10.81.183.99, 2001:0db8:85a3:0000:0000:8a2e:0370:7334, 2001:db8:85a3::8a2e:370:7334
142
142
  */
143
- 6: { ResourceID: 6, Name: "IP address", Mandatory: false, Type: ResourceType.String, Description: "Examples: 10.81.183.99, 2001:0db8:85a3:0000:0000:8a2e:0370:7334, 2001:db8:85a3::8a2e:370:7334" }, /**
143
+ 6: { ResourceID: 6, Name: "IP address", Mandatory: false, Type: ResourceType.String, Multiple: false, Description: "Examples: 10.81.183.99, 2001:0db8:85a3:0000:0000:8a2e:0370:7334, 2001:db8:85a3::8a2e:370:7334" }, /**
144
144
  * Energy Estimate (Integer)
145
145
  *
146
146
  * 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
147
147
  */
148
- 11: { ResourceID: 11, Name: "Energy Estimate", Mandatory: false, Type: ResourceType.Integer, 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" }, /**
148
+ 11: { ResourceID: 11, Name: "Energy Estimate", Mandatory: false, Type: ResourceType.Integer, Multiple: false, 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" }, /**
149
149
  * Timestamp (Time)
150
150
  *
151
151
  * The timestamp of when the measurement was performed.
152
152
  */
153
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the measurement was performed." } } }, /**
153
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the measurement was performed." } } }, /**
154
154
  * Device information (14204)
155
155
  *
156
156
  * Details about the device's connection.
@@ -160,37 +160,37 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
160
160
  *
161
161
  * Board IMEI. Examples: 352656106111232.
162
162
  */
163
- 0: { ResourceID: 0, Name: "IMEI", Mandatory: true, Type: ResourceType.String, Description: "Board IMEI. Examples: 352656106111232." }, /**
163
+ 0: { ResourceID: 0, Name: "IMEI", Mandatory: true, Type: ResourceType.String, Multiple: false, Description: "Board IMEI. Examples: 352656106111232." }, /**
164
164
  * SIM ICCID (String)
165
165
  *
166
166
  * Examples: 89450421180216216095.
167
167
  */
168
- 1: { ResourceID: 1, Name: "SIM ICCID", Mandatory: false, Type: ResourceType.String, Description: "Examples: 89450421180216216095." }, /**
168
+ 1: { ResourceID: 1, Name: "SIM ICCID", Mandatory: false, Type: ResourceType.String, Multiple: false, Description: "Examples: 89450421180216216095." }, /**
169
169
  * Modem firmware version (String)
170
170
  *
171
171
  * Examples: mfw_nrf9160_1.0.0.
172
172
  */
173
- 2: { ResourceID: 2, Name: "Modem firmware version", Mandatory: true, Type: ResourceType.String, Description: "Examples: mfw_nrf9160_1.0.0." }, /**
173
+ 2: { ResourceID: 2, Name: "Modem firmware version", Mandatory: true, Type: ResourceType.String, Multiple: false, Description: "Examples: mfw_nrf9160_1.0.0." }, /**
174
174
  * Application firmware version (String)
175
175
  *
176
176
  * Examples: v1.0.0-rc1-327-g6fc8c16b239f.
177
177
  */
178
- 3: { ResourceID: 3, Name: "Application firmware version", Mandatory: true, Type: ResourceType.String, Description: "Examples: v1.0.0-rc1-327-g6fc8c16b239f." }, /**
178
+ 3: { ResourceID: 3, Name: "Application firmware version", Mandatory: true, Type: ResourceType.String, Multiple: false, Description: "Examples: v1.0.0-rc1-327-g6fc8c16b239f." }, /**
179
179
  * Board version (String)
180
180
  *
181
181
  * Examples: thingy91_nrf9160.
182
182
  */
183
- 4: { ResourceID: 4, Name: "Board version", Mandatory: true, Type: ResourceType.String, Description: "Examples: thingy91_nrf9160." }, /**
183
+ 4: { ResourceID: 4, Name: "Board version", Mandatory: true, Type: ResourceType.String, Multiple: false, Description: "Examples: thingy91_nrf9160." }, /**
184
184
  * Battery model (String)
185
185
  *
186
186
  * Examples: LP302535, LP502540, LP803035.
187
187
  */
188
- 5: { ResourceID: 5, Name: "Battery model", Mandatory: false, Type: ResourceType.String, Description: "Examples: LP302535, LP502540, LP803035." }, /**
188
+ 5: { ResourceID: 5, Name: "Battery model", Mandatory: false, Type: ResourceType.String, Multiple: false, Description: "Examples: LP302535, LP502540, LP803035." }, /**
189
189
  * Timestamp (Time)
190
190
  *
191
191
  * The timestamp of when the measurement was performed.
192
192
  */
193
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the measurement was performed." } } }, /**
193
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the measurement was performed." } } }, /**
194
194
  * Environment (14205)
195
195
  *
196
196
  * Environment information.
@@ -200,7 +200,7 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
200
200
  *
201
201
  * Environmental temperature in Celsius. Examples: 23.5, -10.2.
202
202
  */
203
- 0: { ResourceID: 0, Name: "Temperature", Mandatory: false, Type: ResourceType.Float, Description: "Environmental temperature in Celsius. Examples: 23.5, -10.2.", Units: "\u00B0C" }, /**
203
+ 0: { ResourceID: 0, Name: "Temperature", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Environmental temperature in Celsius. Examples: 23.5, -10.2.", Units: "\u00B0C" }, /**
204
204
  * Humidity (Float)
205
205
  *
206
206
  * Environmental humidity in percent. Examples: 44.2, 72.
@@ -208,22 +208,22 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
208
208
  * Minimum: 0
209
209
  * Maximum: 100
210
210
  */
211
- 1: { ResourceID: 1, Name: "Humidity", Mandatory: false, Type: ResourceType.Float, Description: "Environmental humidity in percent. Examples: 44.2, 72.", RangeEnumeration: { min: 0, max: 100 }, Units: "%" }, /**
211
+ 1: { ResourceID: 1, Name: "Humidity", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Environmental humidity in percent. Examples: 44.2, 72.", RangeEnumeration: { min: 0, max: 100 }, Units: "%" }, /**
212
212
  * Atmospheric pressure (Float)
213
213
  *
214
214
  * Atmospheric pressure in hectopascal. Examples: 1003.6, 977.
215
215
  */
216
- 2: { ResourceID: 2, Name: "Atmospheric pressure", Mandatory: false, Type: ResourceType.Float, Description: "Atmospheric pressure in hectopascal. Examples: 1003.6, 977.", Units: "hPa" }, /**
216
+ 2: { ResourceID: 2, Name: "Atmospheric pressure", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Atmospheric pressure in hectopascal. Examples: 1003.6, 977.", Units: "hPa" }, /**
217
217
  * Air Quality Index (Integer)
218
218
  *
219
219
  * The Bosch BME680 sensor calculates an Air Quality Index. See https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
220
220
  */
221
- 10: { ResourceID: 10, Name: "Air Quality Index", Mandatory: false, Type: ResourceType.Integer, Description: "The Bosch BME680 sensor calculates an Air Quality Index. See https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf" }, /**
221
+ 10: { ResourceID: 10, Name: "Air Quality Index", Mandatory: false, Type: ResourceType.Integer, Multiple: false, Description: "The Bosch BME680 sensor calculates an Air Quality Index. See https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf" }, /**
222
222
  * Timestamp (Time)
223
223
  *
224
224
  * The timestamp of when the measurement was performed.
225
225
  */
226
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the measurement was performed." } } }, /**
226
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the measurement was performed." } } }, /**
227
227
  * Solar charge (14210)
228
228
  *
229
229
  * Measurements from the solar shield.
@@ -233,17 +233,17 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
233
233
  *
234
234
  * The current gain from the solar shield, measured in mA. Example: 3.123, -0.0032.
235
235
  */
236
- 0: { ResourceID: 0, Name: "Gain", Mandatory: true, Type: ResourceType.Float, Description: "The current gain from the solar shield, measured in mA. Example: 3.123, -0.0032.", Units: "mA" }, /**
236
+ 0: { ResourceID: 0, Name: "Gain", Mandatory: true, Type: ResourceType.Float, Multiple: false, Description: "The current gain from the solar shield, measured in mA. Example: 3.123, -0.0032.", Units: "mA" }, /**
237
237
  * Voltage (Float)
238
238
  *
239
239
  * Battery voltage in Volt. Examples: 2.754, 3.3.
240
240
  */
241
- 1: { ResourceID: 1, Name: "Voltage", Mandatory: false, Type: ResourceType.Float, Description: "Battery voltage in Volt. Examples: 2.754, 3.3.", Units: "V" }, /**
241
+ 1: { ResourceID: 1, Name: "Voltage", Mandatory: false, Type: ResourceType.Float, Multiple: false, Description: "Battery voltage in Volt. Examples: 2.754, 3.3.", Units: "V" }, /**
242
242
  * Timestamp (Time)
243
243
  *
244
244
  * The timestamp of when the measurement was performed.
245
245
  */
246
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the measurement was performed." } } }, /**
246
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the measurement was performed." } } }, /**
247
247
  * Button press (14220)
248
248
  *
249
249
  * Describes a button press event. The ObjectInstanceID is used to describe which button has been pressed.
@@ -253,7 +253,7 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
253
253
  *
254
254
  * The timestamp of when the button was pressed.
255
255
  */
256
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the button was pressed." } } }, /**
256
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the button was pressed." } } }, /**
257
257
  * Sea Water Level (14230)
258
258
  *
259
259
  * Describes observed sea water level.
@@ -263,17 +263,17 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
263
263
  *
264
264
  * The observed sea water level relative the the sea level elevation of the sea map. Examples: 134.2, 104.5.
265
265
  */
266
- 0: { ResourceID: 0, Name: "Sea Water Level", Mandatory: true, Type: ResourceType.Float, Description: "The observed sea water level relative the the sea level elevation of the sea map. Examples: 134.2, 104.5.", Units: "cm" }, /**
266
+ 0: { ResourceID: 0, Name: "Sea Water Level", Mandatory: true, Type: ResourceType.Float, Multiple: false, Description: "The observed sea water level relative the the sea level elevation of the sea map. Examples: 134.2, 104.5.", Units: "cm" }, /**
267
267
  * Station code (String)
268
268
  *
269
269
  * The code of the observation station. Examples: TRD, SVG.
270
270
  */
271
- 1: { ResourceID: 1, Name: "Station code", Mandatory: true, Type: ResourceType.String, Description: "The code of the observation station. Examples: TRD, SVG." }, /**
271
+ 1: { ResourceID: 1, Name: "Station code", Mandatory: true, Type: ResourceType.String, Multiple: false, Description: "The code of the observation station. Examples: TRD, SVG." }, /**
272
272
  * Timestamp (Time)
273
273
  *
274
274
  * The timestamp of when the observation was made.
275
275
  */
276
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the observation was made." } } }, /**
276
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the observation was made." } } }, /**
277
277
  * RGB LED (14240)
278
278
  *
279
279
  * Describes an RGB LED. Use different instances to address different LEDs.
@@ -286,7 +286,7 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
286
286
  * Minimum: 0
287
287
  * Maximum: 255
288
288
  */
289
- 0: { ResourceID: 0, Name: "Red", Mandatory: true, Type: ResourceType.Integer, Description: "The red brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
289
+ 0: { ResourceID: 0, Name: "Red", Mandatory: true, Type: ResourceType.Integer, Multiple: false, Description: "The red brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
290
290
  * Green (Integer)
291
291
  *
292
292
  * The green brightness level of the LED.
@@ -294,7 +294,7 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
294
294
  * Minimum: 0
295
295
  * Maximum: 255
296
296
  */
297
- 1: { ResourceID: 1, Name: "Green", Mandatory: true, Type: ResourceType.Integer, Description: "The green brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
297
+ 1: { ResourceID: 1, Name: "Green", Mandatory: true, Type: ResourceType.Integer, Multiple: false, Description: "The green brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
298
298
  * Blue (Integer)
299
299
  *
300
300
  * The blue brightness level of the LED.
@@ -302,12 +302,12 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
302
302
  * Minimum: 0
303
303
  * Maximum: 255
304
304
  */
305
- 2: { ResourceID: 2, Name: "Blue", Mandatory: true, Type: ResourceType.Integer, Description: "The blue brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
305
+ 2: { ResourceID: 2, Name: "Blue", Mandatory: true, Type: ResourceType.Integer, Multiple: false, Description: "The blue brightness level of the LED.", RangeEnumeration: { min: 0, max: 255 } }, /**
306
306
  * Timestamp (Time)
307
307
  *
308
308
  * The timestamp of when the LED was changed.
309
309
  */
310
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the LED was changed." } } }, /**
310
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the LED was changed." } } }, /**
311
311
  * Application Configuration (14301)
312
312
  *
313
313
  * Describes application configuration
@@ -320,14 +320,29 @@ export const definitions: Record<LwM2MObjectID, LWM2MObjectInfo> = { /**
320
320
  * Minimum: 0
321
321
  * Maximum: 31622400
322
322
  */
323
- 0: { ResourceID: 0, Name: "Update interval", Mandatory: true, Type: ResourceType.Integer, Description: "The update interval in seconds. Examples: 10, 3600.", RangeEnumeration: { min: 0, max: 31622400 } }, /**
323
+ 0: { ResourceID: 0, Name: "Update interval", Mandatory: true, Type: ResourceType.Integer, Multiple: false, Description: "The update interval in seconds. Examples: 10, 3600.", RangeEnumeration: { min: 0, max: 31622400 } }, /**
324
324
  * GNSS enabled (Boolean)
325
325
  *
326
326
  * Whether to enabled the device's GNSS receiver.
327
327
  */
328
- 1: { ResourceID: 1, Name: "GNSS enabled", Mandatory: true, Type: ResourceType.Boolean, Description: "Whether to enabled the device's GNSS receiver." }, /**
328
+ 1: { ResourceID: 1, Name: "GNSS enabled", Mandatory: true, Type: ResourceType.Boolean, Multiple: false, Description: "Whether to enabled the device's GNSS receiver." }, /**
329
329
  * Timestamp (Time)
330
330
  *
331
331
  * The timestamp of when the configuration was updated.
332
332
  */
333
- 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Description: "The timestamp of when the configuration was updated." } } } };
333
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the configuration was updated." } } }, /**
334
+ * nRF Cloud Service Info (14401)
335
+ *
336
+ * Describes the services supported by the device.
337
+ */
338
+ [LwM2MObjectID.NRFCloudServiceInfo_14401]: { ObjectID: LwM2MObjectID.NRFCloudServiceInfo_14401, ObjectVersion: "1.0", Name: "nRF Cloud Service Info", Description: "Describes the services supported by the device.", Resources: { /**
339
+ * FOTA (String)
340
+ *
341
+ * The types of firmwares the device supports. Examples: "APP", "MODEM".
342
+ */
343
+ 0: { ResourceID: 0, Name: "FOTA", Mandatory: false, Type: ResourceType.String, Multiple: true, Description: "The types of firmwares the device supports. Examples: \"APP\", \"MODEM\"." }, /**
344
+ * Timestamp (Time)
345
+ *
346
+ * The timestamp of when the service info was updated.
347
+ */
348
+ 99: { ResourceID: 99, Name: "Timestamp", Mandatory: true, Type: ResourceType.Time, Multiple: false, Description: "The timestamp of when the service info was updated." } } } };
@@ -0,0 +1,25 @@
1
+ import type { LwM2MObject } from "../LwM2MObject.js";
2
+ import { LwM2MObjectID } from "../LwM2MObjectID.js";
3
+ /**
4
+ * nRF Cloud Service Info (14401)
5
+ *
6
+ * Describes the services supported by the device.
7
+ */
8
+ export type NRFCloudServiceInfo_14401 = LwM2MObject<{
9
+ ObjectID: LwM2MObjectID.NRFCloudServiceInfo_14401;
10
+ ObjectVersion: "1.0";
11
+ Resources: {
12
+ /**
13
+ * Timestamp
14
+ *
15
+ * The timestamp of when the service info was updated.
16
+ */
17
+ 99: number;
18
+ /**
19
+ * FOTA
20
+ *
21
+ * The types of firmwares the device supports. Examples: "APP", "MODEM".
22
+ */
23
+ 0?: Array<string>;
24
+ };
25
+ }>;
@@ -0,0 +1,14 @@
1
+ import type { LwM2MObjectInstance } from "../LwM2MObjectInstance.js";
2
+ import { TimeResource, StringResource, OptionalResource, MultipleInstanceResource, validateInstance } from "../validation.js";
3
+ import type { NRFCloudServiceInfo_14401 } from "../objects.js";
4
+ import { LwM2MObjectID } from "../LwM2MObjectID.js";
5
+ /**
6
+ * Validate nRF Cloud Service Info (14401)
7
+ *
8
+ * Ensures the given object is an LwM2M object according to the schema 14401.xml.
9
+ */
10
+ export const validate14401 = (o: unknown): {
11
+ error: Error;
12
+ } | {
13
+ object: LwM2MObjectInstance<NRFCloudServiceInfo_14401>;
14
+ } => validateInstance<NRFCloudServiceInfo_14401>(LwM2MObjectID.NRFCloudServiceInfo_14401, "1.0", { 99: TimeResource, 0: OptionalResource(MultipleInstanceResource(StringResource)) })(o);
package/lwm2m/objects.ts CHANGED
@@ -17,4 +17,6 @@ export { validate14230 } from "./object/validate14230.js";
17
17
  export type { RGBLED_14240 } from "./object/14240.js";
18
18
  export { validate14240 } from "./object/validate14240.js";
19
19
  export type { ApplicationConfiguration_14301 } from "./object/14301.js";
20
- export { validate14301 } from "./object/validate14301.js";
20
+ export { validate14301 } from "./object/validate14301.js";
21
+ export type { NRFCloudServiceInfo_14401 } from "./object/14401.js";
22
+ export { validate14401 } from "./object/validate14401.js";
@@ -2,4 +2,4 @@ import { LwM2MObjectID } from "./LwM2MObjectID.js";
2
2
  /**
3
3
  * Contains the ID of the resource that defines the timestamp for each LwM2M object definition
4
4
  */
5
- export const timestampResources: Readonly<Map<LwM2MObjectID, number>> = new Map<LwM2MObjectID, number>([[LwM2MObjectID.Geolocation_14201, 99], [LwM2MObjectID.BatteryAndPower_14202, 99], [LwM2MObjectID.ConnectionInformation_14203, 99], [LwM2MObjectID.DeviceInformation_14204, 99], [LwM2MObjectID.Environment_14205, 99], [LwM2MObjectID.SolarCharge_14210, 99], [LwM2MObjectID.ButtonPress_14220, 99], [LwM2MObjectID.SeaWaterLevel_14230, 99], [LwM2MObjectID.RGBLED_14240, 99], [LwM2MObjectID.ApplicationConfiguration_14301, 99]]);
5
+ export const timestampResources: Readonly<Map<LwM2MObjectID, number>> = new Map<LwM2MObjectID, number>([[LwM2MObjectID.Geolocation_14201, 99], [LwM2MObjectID.BatteryAndPower_14202, 99], [LwM2MObjectID.ConnectionInformation_14203, 99], [LwM2MObjectID.DeviceInformation_14204, 99], [LwM2MObjectID.Environment_14205, 99], [LwM2MObjectID.SolarCharge_14210, 99], [LwM2MObjectID.ButtonPress_14220, 99], [LwM2MObjectID.SeaWaterLevel_14230, 99], [LwM2MObjectID.RGBLED_14240, 99], [LwM2MObjectID.ApplicationConfiguration_14301, 99], [LwM2MObjectID.NRFCloudServiceInfo_14401, 99]]);