
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A dictionary of ip-based smart object(IPSO) identifiers defined by lwm2m spec.
A dictionary of ip-based smart object(IPSO) identifiers defined by lwm2m spec.
lwm2m-id is a dictionary of identifiers defined by OMA LightweightM2M(v1.0), IPSO SmartObject Guideline(Smart Objects Starter Pack1.0 and Smart Objects Expansion Pack). Please visit their websites for more information.
$ npm install lwm2m-id --save
lwm2m-id provides you with two getters, i.e. getOid()
and getRid()
, to get the key-value pair of an Object and a Resource identifier. The getter returns an item which has properties of 'key'
and 'value'
, or returns undefined
if not found. In the returned item, item.key
is the idetifier in string and item.value
is the identifier in number.
Let me show you some examples.
var lwm2mid = require('lwm2m-id')
// get Object Id
var oidItem1 = lwm2mid.getOid('device'); // { key: 'device', value: 3 }
var oidItem2 = lwm2mid.getOid(3); // { key: 'device', value: 3 }
var oidItem3 = lwm2mid.getOid('3'); // { key: 'device', value: 3 }
var oidItem4 = lwm2mid.getOid(999); // undefined
var oidItem5 = lwm2mid.getOid('noSuchId'); // undefined
var oidKey = lwm2mid.getOid(3).key; // 'device'
var oidId = lwm2mid.getOid('device').value; // 3
// get Resource Id
// (1) The rid is specific to an Object
var ridItem1 = lwm2mid.getRid('lightCtrl', 'onOff'); // { key: 'onOff', value: 5850 }
var ridItem2 = lwm2mid.getRid(3311, 'onOff'); // { key: 'onOff', value: 5850 }
var ridItem3 = lwm2mid.getRid(3311, 5850); // { key: 'onOff', value: 5850 }
var ridItem4 = lwm2mid.getRid('3311', '5850'); // { key: 'onOff', value: 5850 }
var ridItem5 = lwm2mid.getOid('lightCtrl', 'noSuchId'); // undefined
var ridItem6 = lwm2mid.getOid('noSuchId', 5850); // undefined
var ridKey = lwm2mid.getRid('lightCtrl', 5850).key; // 'onOff'
var ridId = lwm2mid.getRid(3311, 'onOff').value; // 5850
// (2) The rid is an unique id
var ridItem7 = lwm2mid.getRid('sensorValue'); // { key: 'sensorValue', value: 5700 }
var ridItem8 = lwm2mid.getRid(5700); // { key: 'sensorValue', value: 5700 }
var ridItem8 = lwm2mid.getRid('5700'); // { key: 'sensorValue', value: 5700 }
var ridKey = lwm2mid.getRid(5700).key; // 'sensorValue'
var ridId = lwm2mid.getRid('sensorValue').value; // 5700
Returns an item of the Object identifier.
Arguments
oid
can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.Returns:
{ key: 'sampleId', value: 1234 }
, otherwise returns undefined
if not found.Example
lwm2mid.getOid('temperature'); // { key: 'temperature', value: 3303 }
lwm2mid.getOid(3303); // { key: 'temperature', value: 3303 }
lwm2mid.getOid('3303'); // { key: 'temperature', value: 3303 }
lwm2mid.getOid('xxxx'); // undefined
lwm2mid.getOid('9999'); // undefined
lwm2mid.getOid(9999); // undefined
Returns an item of the Resource identifier.
There are two kinds of Resource id, the unique Resource id and the Resource id specific to an Object. An Object can use both of these two kinds of Resource id to define its characteristic.
rid
is needed.oid
and rid
should be given.Arguments
oid
can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.rid
can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.Returns:
{ key: 'sampleId', value: 1234 }
, otherwise returns undefined
if not found.Example
// get a Resource id specific to an Object
lwm2mid.getRid('location', 'lon'); // { key: 'lon', value: 1 }
lwm2mid.getRid(6, 1); // { key: 'lon', value: 1 }
lwm2mid.getRid('temperature', 'sensorValue'); // { key: 'sensorValue', value: 5700 }
lwm2mid.getRid(3303, 5700); // { key: 'sensorValue', value: 5700 }
lwm2mid.getRid('temperature', '5700'); // { key: 'sensorValue', value: 5700 }
// get an unqiue Resource id
lwm2mid.getRid('appType'); // { key: 'appType', value: 5750 }
lwm2mid.getRid(5750); // { key: 'appType', value: 5700 }
lwm2mid.getRid('5750'); // { key: 'appType', value: 5750 }
Returns the sepc. definitions of an Object.
Arguments
oid
can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.Returns:
undefined
if not found. The definition object is of the form: { multi: false, mand: true }
Property | Description | Possilbe Settings |
---|---|---|
multi | Allow multiple instances | true, false |
mand | Mandatory | true, false |
* Please refer to Appendix in OMA LightweightM2M(v1.0) specification for details.
Example
lwm2mid.getOdef('temperature');
// returns { "multi": true, "mand": false }
lwm2mid.getOdef('lightCtrl');
// returns { "multi": true, "mand": false }
lwm2mid.getOdef('device');
// returns { "multi": false, "mand": true }
lwm2mid.getOdef('xxxx'); // undefined
Returns the definitions of a Resource specific to an Object.
Arguments
oid
can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.rid
can be given with a string or a number. Notice that a numbered string will be recognized as a number, e.g. '128' is equal to 128.Returns:
undefined
if not found. The definition object is of the form: { access: null, multi: false, mand: true, type: "boolean", range: null, init: false }
Property | Description | Possilbe Settings |
---|---|---|
access | Access control | 'R', 'W', 'RW', 'E', null (cannot access) |
multi | Allow multiple instances | true, false |
mand | Mandatory | true, false |
type* | Resource value data type | 'boolean', integer', 'float', string', 'time', execute', 'opaque' |
range | Limit of Resource value | A number, null if no limit. |
* Please refer to Appendix C. Data Types in OMA LightweightM2M(v1.0) specification for details.
Example
lwm2mid.getRdef('temperature', 'sensorValue');
// returns { "access": "R", "multi": false, "mand": true, "type": "float", "range": null }
lwm2mid.getRdef('lightCtrl', 5850);
// returns { "access": "RW", "multi": false, "mand": true, "type": "boolean", "range": null }
lwm2mid.getRdef('temperature'); // undefined. rid should be given
lwm2mid.getRdef('xxxx', 1234); // undefined
Object Id | lwm2m-id Key | Description/Object Name |
---|---|---|
0 | lwm2mSecurity | LWM2M Security |
1 | lwm2mServer | LWM2M Server |
2 | accessCtrl | Access Control |
3 | device | Device |
4 | connMonitor | Connectivity Monitoring |
5 | firmware | Firmware |
6 | location | Location |
7 | connStatistics | Connectivity Statistics |
8 | lockAndWipe | Lock and Wipe |
9 | swUpdate | Sofware Update |
10 | cellularConn | Cellular connectivity |
11 | apnConnProfile | APN connection profile |
12 | wlanConn | WLAN connectivity |
13 | bearerSelection | Bearer selection |
15 | devCapMgmt | DevCapMgmt |
2048 | cmdhPolicy | CmdhPolicy |
2049 | activeCmdhPolicy | ActiveCmdhPolicy |
2050 | cmdhDefaults | CmdhDefaults |
2051 | cmdhDefEcValues | CmdhDefEcValues |
2052 | cmdhDefEcParamsValues | CmdhDefEcParamsValues |
2053 | cmdhLimits | CmdhLimits |
2054 | cmdhNetworkAccessRules | CmdhNetworkAccessRules |
2055 | cmdhNwAccessRule | CmdhNwAccessRule |
2056 | cmdhBuffer | CmdhBuffer |
3200 | dIn | Digital Input |
3201 | dOut | Digital Output |
3202 | aIn | Analogue Input |
3203 | aOut | Analogue Output |
3300 | generic | Generic Sensor |
3301 | illuminance | Illuminance Sensor |
3302 | presence | Presence Sensor |
3303 | temperature | Temperature Sensor |
3304 | humidity | Humidity Sensor |
3305 | pwrMea | Power Measurement |
3306 | actuation | Actuation |
3308 | setPoint | Set Point |
3310 | loadCtrl | Load Control |
3311 | lightCtrl | Light Control |
3312 | pwrCtrl | Power Control |
3313 | accelerometer | Accelerometer |
3314 | magnetometer | Magnetometer |
3315 | barometer | Barometer |
3316 | voltage | Voltage |
3317 | current | Current |
3318 | frequency | Frequency |
3319 | depth | Depth |
3320 | percentage | Percentage |
3321 | altitude | Altitude |
3322 | load | Load |
3323 | pressure | Pressure |
3324 | loudness | Loudness |
3325 | concentration | Concentration |
3326 | acidity | Acidity |
3327 | conductivity | Conductivity |
3328 | power | Power |
3329 | powerFactor | Power Factor |
3330 | distance | Distance |
3331 | energy | Energy |
3332 | direction | Direction |
3333 | time | Time |
3334 | gyrometer | Gyrometer |
3335 | color | Color |
3336 | gpsLocation | GPS Location |
3337 | positioner | Positioner |
3338 | buzzer | Buzzer |
3339 | audioClip | Audio Clip |
3340 | timer | Timer |
3341 | addressableTextDisplay | Addressable Text Display |
3342 | onOffSwitch | On/Off Switch |
3343 | levelControl | Level Controller |
3344 | upDownControl | Up/Down Controller |
3345 | multipleAxisJoystick | Multiple Axis Joystick |
3346 | rate | Rate |
3347 | pushButton | Push Button |
3348 | multistateSelector | Multi-state Selector |
Resource Id | lwm2m-id Key | Description/Resource Name |
---|---|---|
4000 | objectInstanceHandle | Object Instance Handle |
4001 | objectVersion | Object Version |
5500 | dInState | Digital Input State |
5501 | counter | Digital Input Counter |
5502 | dInPolarity | Digital Input Polarity |
5503 | debouncePeriod | Digital Input Debounce Period |
5504 | edgeSelection | Digital Input Edge Selection |
5505 | counterReset | Digital Input Counter Reset |
5550 | dOutState | Digital Output State |
5551 | dOutPolarity | Digital Output Polarity |
5600 | aInCurrValue | Analog Input Current Value |
5601 | minMeaValue | Min Measured Value |
5602 | maxMeaValue | Max Measured Value |
5603 | minRangeValue | Min Range Value |
5604 | maxRangeValue | Max Range Value |
5605 | resetMinMaxMeaValues | Reset Min and Max Measured Values |
5650 | aOutCurrValue | Analog Output Current Value |
5700 | sensorValue | Sensor Value |
5701 | units | Sensor Units |
5702 | xValue | X Value |
5703 | yValue | Y Value |
5704 | zValue | Z Value |
5705 | compassDir | Compass Direction |
5706 | colour | Colour |
5750 | appType | Application Type |
5751 | sensorType | Sensor Type |
5800 | instActivePwr | Instantaneous active power |
5801 | minMeaActivePwr | Min Measured active power |
5802 | maxMeaActivePwr | Max Measured active power |
5803 | minRangeActivePwr | Min Range active power |
5804 | maxRangeActivePwr | Max Range active power |
5805 | cumulActivePwr | Cumulative active power |
5806 | activePwrCal | Active Power Calibration |
5810 | instReactivePwr | Instantaneous reactive power |
5811 | minMeaReactivePwr | Min Measured reactive power |
5812 | maxMeaReactivePwr | Max Measured reactive power |
5813 | minRangeReactivePwr | Min Range reactive power |
5814 | maxRangeReactivePwr | Max Range reactive power |
5815 | cumulReactivePwr | Cumulative reactive power |
5816 | reactivePwrCal | Reactive Power Calibration |
5820 | pwrFactor | Power factor |
5821 | currCal | Current Calibration |
5822 | resetCumulEnergy | Reset Cumulative energy |
5823 | eventId | Event Identifier |
5824 | startTime | Start Time |
5825 | durationInMin | Duration In Min |
5826 | criticalLevel | Critical Level |
5827 | avgLoadAdjPct | Avg Load AdjPct |
5828 | dutyCycle | Duty Cycle |
5850 | onOff | On/Off |
5851 | dimmer | Dimmer |
5852 | onTime | On time |
5853 | mStateOut | Muti-state Output |
5854 | offTime | Off time |
5900 | setPointValue | Set Point Value |
5903 | busyToClearDelay | Busy to Clear delay |
5904 | clearToBusyDelay | Clear to Busy delay |
5905 | hostDeviceManuf | Host Device Manufacturer |
5906 | hostDeviceMdl | Host Device Model Number |
5907 | hostDeviceUID | Host Device Unique ID |
5908 | hostDeviceSwVer | Host Device Software Version |
IPSO/OMA-LWM2M specified Resource ids (this class of ids is specified with Objects)
{
"lwm2mServerURI": 0,
"bootstrapServer": 1,
"securityMode": 2,
"pubKeyId": 3,
"serverPubKeyId": 4,
"secretKey": 5,
"smsSecurityMode": 6,
"smsBindingKeyParam": 7,
"smsBindingSecretKey": 8,
"lwm2mServerSmsNum": 9,
"shortServerId": 10,
"clientHoldOffTime": 11
}
{
"shortServerId": 0,
"lifetime": 1,
"defaultMinPeriod": 2,
"defaultMaxPeriod": 3,
"disable": 4,
"disableTimeout": 5,
"notificationStoring": 6,
"binding": 7,
"regUpdateTrigger": 8
}
{
"objectId": 0,
"objectInstanceId": 1,
"ACL": 2,
"ACLOwner": 3
}
{
"manuf": 0,
"model": 1,
"serial": 2,
"firmware": 3,
"reboot": 4,
"factoryReset": 5,
"availPwrSrc": 6,
"pwrSrcVoltage": 7,
"pwrSrcCurrent": 8,
"battLevel": 9,
"memFree": 10,
"errCode": 11,
"resetErrCode": 12,
"currTime": 13,
"UTCOffset": 14,
"timezone": 15,
"bindAndModes": 16,
"devType": 17,
"hwVer": 18,
"swVer": 19,
"battStatus": 20,
"memTotal": 21
}
{
"nwkBearer": 0,
"availNwkBearer": 1,
"radioStrength": 2,
"linkQuality": 3,
"ip": 4,
"routeIp": 5,
"linkUtil": 6,
"APN": 7,
"cellId": 8,
"SMNC": 9,
"SMCC": 10
}
{
"package": 0,
"packageURI": 1,
"update": 2,
"state": 3,
"updateSuppObjects": 4,
"updateResult": 5,
"pkgName": 6,
"pkgVer": 7
}
{
"lat": 0,
"lon": 1,
"alt": 2,
"uncertainty": 3,
"velocity": 4,
"timestamp": 5
}
{
"SMSTxCounter": 0,
"SMSRxCounter": 1,
"txData": 2,
"rxData": 3,
"maxMsgSize": 4,
"avgMsgSize": 5,
"startOrReset": 6
}
{
"dInState": 5500,
"counter": 5501,
"dInPolarity": 5502,
"debouncePeriod": 5503,
"edgeSelection": 5504,
"counterReset": 5505,
"appType": 5750,
"sensorType": 5751
}
{
"dOutState": 5550,
"dOutPolarity": 5551,
"appType": 5750
}
{
"aInCurrValue": 5600,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605,
"appType": 5750,
"sensorType": 5751
}
{
"aOutCurrValue": 5650,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"appType": 5750
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605,
"appType": 5750,
"sensorType": 5751
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605
}
{
"dInState": 5500,
"counter": 5501,
"counterReset": 5505,
"sensorType": 5751,
"busyToClearDelay": 5903,
"clearToBusyDelay": 5904
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605
}
{
"instActivePwr": 5800,
"minMeaActivePwr": 5801,
"maxMeaActivePwr": 5802,
"minRangeActivePwr": 5803,
"maxRangeActivePwr": 5804,
"cumulActivePwr": 5805,
"activePwrCal": 5806,
"instReactivePwr": 5810,
"minMeaReactivePwr": 5811,
"maxMeaReactivePwr": 5812,
"minRangeReactivePwr": 5813,
"maxRangeReactivePwr": 5814,
"resetMinMaxMeaValues": 5605,
"cumulReactivePwr": 5815,
"reactivePwrCal": 5816,
"pwrFactor": 5820,
"currCal": 5821,
"resetCumulEnergy": 5822
}
{
"onOff": 5850,
"dimmer": 5851,
"onTime": 5852,
"mStateOut": 5853,
"appType": 5750
}
{
"setPointValue": 5900,
"colour": 5706,
"units": 5701,
"appType": 5750
}
{
"eventId": 5823,
"startTime": 5824,
"durationInMin": 5825,
"criticalLevel": 5826,
"avgLoadAdjPct": 5827,
"dutyCycle": 5828
}
{
"onOff": 5850,
"dimmer": 5851,
"colour": 5706,
"units": 5701,
"onTime": 5852,
"cumulActivePwr": 5805,
"pwrFactor": 5820
}
{
"onOff": 5850,
"dimmer": 5851,
"onTime": 5852,
"cumulActivePwr": 5805,
"pwrFactor": 5820
}
{
"units": 5701,
"xValue": 5702,
"yValue": 5703,
"zValue": 5704,
"minRangeValue": 5603,
"maxRangeValue": 5604
}
{
"units": 5701,
"xValue": 5702,
"yValue": 5703,
"zValue": 5704,
"compassDir": 5705
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605,
"calOffset": 5535,
"appType": 5750
}
{
"cumulActivePwr": 5805,
"units": 5701,
"resetCumulEnergy": 5822,
"appType": 5750
}
{
"compassDir": 5705,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"resetMinMaxMeaValues": 5605,
"appType": 5750
}
{
"currentTime": 5506,
"fracTime": 5507,
"appType": 5750
}
{
"units": 5701,
"xValue": 5702,
"yValue": 5703,
"zValue": 5704,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"minXValue": 5508,
"maxXValue": 5509,
"minYValue": 5510,
"maxYValue": 5511,
"minZValue": 5512,
"maxZValue": 5513,
"resetMinMaxMeaValues": 5605,
"appType": 5750
}
{
"colour": 5706,
"units": 5701,
"appType": 5750
}
{
"latitude": 5514,
"longitude": 5515,
"uncertainty": 5516,
"compassDir": 5705,
"velocity": 5517,
"timestamp": 5518,
"appType": 5750
}
{
"currentPos": 5536,
"transTime": 5537,
"remainTime": 5538,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"resetMinMaxMeaValues": 5605,
"minLimit": 5519,
"maxLimit": 5520,
"appType": 5750
}
{
"onOff": 5850,
"level": 5548,
"timeDuration": 5521,
"minOffTime": 5525,
"appType": 5750
}
{
"clip": 5522,
"trigger": 5523,
"level": 5548,
"soundDuration": 5524,
"appType": 5750
}
{
"timeDuration": 5521,
"remainTime": 5538,
"minOffTime": 5525,
"trigger": 5523,
"onOff": 5850,
"counter": 5501,
"cumulTime": 5544,
"digitalState": 5543,
"eventCounter": 5534,
"mode": 5526,
"appType": 5750
}
{
"text": 5527,
"xCoord": 5528,
"yCoord": 5529,
"maxXCoord": 5545,
"maxYCoord": 5546,
"clearDisplay": 5530,
"contrast": 5531,
"level": 5548,
"appType": 5750
}
{
"dInState": 5500,
"counter": 5501,
"onTime": 5852,
"offTime": 5854,
"appType": 5750
}
{
"level": 5548,
"onTime": 5852,
"offTime": 5854,
"appType": 5750
}
{
"incInputState": 5532,
"decInputState": 5533,
"upCounter": 5541,
"downCounter": 5542,
"appType": 5750
}
{
"dInState": 5500,
"counter": 5501,
"xValue": 5702,
"yValue": 5703,
"zValue": 5704,
"appType": 5750
}
{
"sensorValue": 5700,
"units": 5701,
"minMeaValue": 5601,
"maxMeaValue": 5602,
"minRangeValue": 5603,
"maxRangeValue": 5604,
"resetMinMaxMeaValues": 5605,
"calOffset": 5535,
"appType": 5750
}
{
"dInState": 5500,
"counter": 5501,
"appType": 5750
}
{
"mStateIn": 5547,
"appType": 5750
}
FAQs
A dictionary of ip-based smart object(IPSO) identifiers defined by lwm2m spec.
The npm package lwm2m-id receives a total of 460 weekly downloads. As such, lwm2m-id popularity was classified as not popular.
We found that lwm2m-id demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.