Skip to content

Commit

Permalink
feat(lwm2m): add manually generated types
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Nov 6, 2023
1 parent 03885d5 commit e0921d9
Show file tree
Hide file tree
Showing 11 changed files with 360 additions and 1 deletion.
1 change: 1 addition & 0 deletions export.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './dist/senml/senMLtoLwM2M.js'
export * from './dist/models/models.js'
export * from './dist/models/types.js'
export * from './dist/lwm2m/timestampResources.js'
export * from './dist/lwm2m/objects.js'
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './senml/senMLtoLwM2M.js'
export * from './models/models.js'
export * from './models/types.js'
export * from './lwm2m/timestampResources.js'
export * from './lwm2m/objects.js'
67 changes: 67 additions & 0 deletions lwm2m/14201.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Geolocation (14201)
*
* Describes the geo location of a device
*/
export type Geolocation_14201 = LwM2MObject & {
ObjectID: 14201
ObjectVersion: '1.0'
Resources: {
/**
* Latitude (lat)
*
* The decimal notation of latitude, e.g. -43.5723 [World Geodetic
* System 1984].
*/
0: number
/**
* Longitude (lon)
*
* The decimal notation of longitude, e.g. 153.21760 [World Geodetic
* System 1984].
*/
1: number
/**
* Altitude (m)
*
* The decimal notation of altitude in meters above sea level.
*/
2?: number
/**
* Radius (m)
*
* 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.
*/
3?: number
/**
* Speed (m/s)
*
* Speed is the time rate of change in position.
*/
4?: number
/**
* Heading (degrees)
*
* The angle of movement.
*/
5?: number
/**
* Source (GNSS,SCELL,MCELL,WIFI)
*
* The source of the geo location, e.g. GNSS, SCELL, MCELL, WIFI.
*/
6: string
/**
* Timestamp (Time)
*
* The timestamp of when the location measurement was performed.
*/
99: Date
}
}
49 changes: 49 additions & 0 deletions lwm2m/14202.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Battery and Power (14202)
*
* Information about the battery and power status of the device.
*/
export type BatteryAndPower_14202 = LwM2MObject & {
ObjectID: 14202
ObjectVersion: '1.0'
Resources: {
/**
* State of charge (%, 0-100)
*
* State of charge in percent. Examples: 23, 1, 100.
*/
0?: number
/**
* Voltage (V)
*
* CDATA[Battery voltage in Volt. Examples: 2.754, 3.3.
*/
1: number
/**
* Charge current (mA)
*
* Charge current in mA. Examples: 429, -244.
*/
2?: number
/**
* Battery temperature (C)
*
* Battery temperature in Celsius. Examples: 21.7, 23.123.
*/
3?: number
/**
* Time to full (s)
*
* Time to full in seconds. Examples: 4652.
*/
4?: number
/**
* Timestamp (Time)
*
* The timestamp of when the measurement was performed.
*/
99: Date
}
}
85 changes: 85 additions & 0 deletions lwm2m/14203.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Connection information (14203)
*
* Details about the device's connection.
*/
export type ConnectionInformation_14203 = LwM2MObject & {
ObjectID: 14203
ObjectVersion: '1.0'
Resources: {
/**
* Network mode
*
* Examples: LTE-M, NB-IoT.
*/
0?: string
/**
* Band
*
* 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
*/
1?: number
/**
* RSRP (dBm)
*
* 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.
*/
2?: number
/**
* Area
*
* Area code. Examples: 12
*/
3?: number
/**
* Cell
*
* The cell ID the User Equipment (UE) is camped on. 4-byte Evolved
* Terrestrial Radio Access Network (E-UTRAN) cell ID. Examples:
* 33703719
*/
4?: number
/**
* Mobile country code and mobile network code
*
* Examples: 24202, 310410
*/
5?: number
/**
* IP address
* Examples: 10.81.183.99, 2001:0db8:85a3:0000:0000:8a2e:0370:7334,
* 2001:db8:85a3::8a2e:370:7334
*/
6?: string
/**
* Energy Estimate
*
* 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
*/
11?: number
/**
* Timestamp (Time)
*
* The timestamp of when the measurement was performed.
*/
99: Date
}
}
55 changes: 55 additions & 0 deletions lwm2m/14204.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Device information (14204)
*
* Details about the device's connection.
*/
export type DeviceInformation_14204 = LwM2MObject & {
ObjectID: 14204
ObjectVersion: '1.0'
Resources: {
/**
* IMEI
*
* Board IMEI. Examples: 352656106111232.
*/
0: string
/**
* SIM ICCID
*
* Examples: 89450421180216216095.
*/
1?: string
/**
* Modem firmware version
*
* Examples: mfw_nrf9160_1.0.0.
*/
2: string
/**
* Application firmware version
*
* Examples: v1.0.0-rc1-327-g6fc8c16b239f.
*/
3: string
/**
* Board version
*
* Examples: thingy91_nrf9160.
*/
4: string
/**
* Battery model
*
* Examples: LP302535, LP502540, LP803035.
*/
5?: string
/**
* Timestamp (Time)
*
* The timestamp of when the measurement was performed.
*/
99: Date
}
}
44 changes: 44 additions & 0 deletions lwm2m/14205.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Environment (14205)
*
* Environment information.
*/
export type Environment_14205 = LwM2MObject & {
ObjectID: 14205
ObjectVersion: '1.0'
Resources: {
/**
* Temperature (C)
*
* Environmental temperature in Celsius. Examples: 23.5, -10.2.
*/
0?: number
/**
* Humidity (%)
*
* Environmental humidity in percent. Examples: 44.2, 72.
*/
1?: number
/**
* Atmoshperic pressure Pa
*
* Atmoshperic pressure in pascal. Examples: 1003.6, 977.
*/
2?: number
/**
* Air Quality Index
*
* The Bosch BME680 sensor calculates an Air Quality Index. See
* https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
*/
10?: number
/**
* Timestamp (Time)
*
* The timestamp of when the measurement was performed.
*/
99: Date
}
}
25 changes: 25 additions & 0 deletions lwm2m/14210.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Solar charge (14210)
*
* Measurements from the solar shield.
*/
export type SolarCharge_14210 = LwM2MObject & {
ObjectID: 14210
ObjectVersion: '1.0'
Resources: {
/**
* Gain (mA)
*
* The current gain from the solar shield, measured in mA. Example: 3.123, -0.0032.
*/
0: number
/**
* Timestamp (Time)
*
* The timestamp of when the measurement was performed.
*/
99: Date
}
}
25 changes: 25 additions & 0 deletions lwm2m/14220.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { LwM2MObject } from '../senml/senMLtoLwM2M'

/**
* Button press (14220)
*
* Describes a button press event.
*/
export type ButtonPress_14220 = LwM2MObject & {
ObjectID: 14220
ObjectVersion: '1.0'
Resources: {
/**
* Button ID
*
* The ID of the button that was pressed. Examples: 1, 2.
*/
0: number
/**
* Timestamp (Time)
*
* The timestamp of when the button was pressed.
*/
99: Date
}
}
2 changes: 1 addition & 1 deletion lwm2m/14220.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Type>Time</Type>
<RangeEnumeration/>
<Units/>
<Description><![CDATA[The timestamp of when the measurement was performed.]]></Description>
<Description><![CDATA[The timestamp of when the button was pressed.]]></Description>
</Item>
</Resources>
<Description2/>
Expand Down
7 changes: 7 additions & 0 deletions lwm2m/objects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from './14201.js'
export * from './14203.js'
export * from './14204.js'
export * from './14205.js'
export * from './14210.js'
export * from './14220.js'
export * from './14202.js'

0 comments on commit e0921d9

Please sign in to comment.