New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lwm2m-id

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lwm2m-id

lwm2m-id is a module that implements a dictionary of ip-based smart object(IPSO) identifiers defined by lwm2m spec.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
505
increased by7.91%
Maintainers
1
Weekly downloads
 
Created
Source

lwm2m-id


## Table of Contents
  1. Overiew
  2. Installation
  3. Usage
  4. APIs
  5. Table of Identifiers

1. Overview

lwm2m-id is a dictionary of identifiers defined by OMA LightweightM2M(v1.0) and IPSO SmartObject Guideline(Smart Objects Starter Pack1.0). Please visit their websites for more information.

2. Installation

$ npm install lwm2m-id --save

3. Usage

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 m2mid = require('lwm2m-id')

// get Object Id
var oidItem1 = m2mid.getOid('device');      // { key: 'device', value: 3 }
var oidItem2 = m2mid.getOid(3);             // { key: 'device', value: 3 }
var oidItem3 = m2mid.getOid('3');           // { key: 'device', value: 3 }
var oidItem4 = m2mid.getOid(999);           // undefined
var oidItem5 = m2mid.getOid('noSuchId');    // undefined

var oidKey = m2mid.getOid(3).key;           // 'device'
var oidId = m2mid.getOid('device').value;   // 3

// get Resource Id
//   (1) The rid is specific to an Object
var ridItem1 = m2mid.getRid('lightCtrl', 'onOff');    // { key: 'onOff', value: 5850 }
var ridItem2 = m2mid.getRid(3311, 'onOff');           // { key: 'onOff', value: 5850 }
var ridItem3 = m2mid.getRid(3311, 5850);              // { key: 'onOff', value: 5850 }
var ridItem4 = m2mid.getRid('3311', '5850');          // { key: 'onOff', value: 5850 }
var ridItem5 = m2mid.getOid('lightCtrl', 'noSuchId'); // undefined
var ridItem6 = m2mid.getOid('noSuchId', 5850);        // undefined

var ridKey = m2mid.getRid('lightCtrl', 5850).key;     // 'onOff'
var ridId = m2mid.getRid(3311, 'onOff').value;        // 5850

//   (2) The rid is an unique id
var ridItem7 = m2mid.getRid('sensorValue');           // { key: 'sensorValue', value: 5700 }
var ridItem8 = m2mid.getRid(5700);                    // { key: 'sensorValue', value: 5700 }
var ridItem8 = m2mid.getRid('5700');                  // { key: 'sensorValue', value: 5700 }

var ridKey = m2mid.getRid(5700).key;                  // 'sensorValue'
var ridId = m2mid.getRid('sensorValue').value;        // 5700

4. APIs


.getOid(oid)

Returns an item of the Object identifier.

Arguments

  • oid (String|Number): 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:

  • (Object | Undefined) Returns an item of { key: 'sampleId', value: 1234 }, otherwise returns undefined if not found.

Example

lwm2mid.getOid('tempSensor');   // { key: 'tempSensor', value: 3303 }
lwm2mid.getOid(3303);           // { key: 'tempSensor', value: 3303 }
lwm2mid.getOid('3303');         // { key: 'tempSensor', value: 3303 }

lwm2mid.getOid('xxxx');         // undefined 
lwm2mid.getOid('9999');         // undefined 
lwm2mid.getOid(9999);           // undefined 


.getRid([oid,] rid)

Returns an item of the Resource identifier.

There are two kinds of Resource id, the Resource id specific to an Object and the unique Resource id. In the former case, the meaning of a Resource is specific to an Object that holds it. An unique Resource id indicates that the Resouce id is a reusable one and its id number is always constant and unique across Objects. In addition, an Object can use both of these two kinds of Resource id to define its characteristic.

To query a Resource id specific to an Object, both oid and rid should be given.
To query an unique Resource id, only the single argument rid is needed.

Arguments

  • oid (String|Number, optional): 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 (String|Number): 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.

Example

// get a Resource id specific to an Object
lwm2mid.getRid('tempSensor', 'sensorValue');   // { key: 'sensorValue', value: 5700 }
lwm2mid.getRid(3303, 5700);                    // { key: 'sensorValue', value: 5700 }
lwm2mid.getRid('tempSensor', '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 }



5. Table of Identifiers

  • IPSO/OMA-LWM2M Object ids
Object Idlwm2m-id KeyDescription/Object Name
0lwm2mSecurityLWM2M Security
1lwm2mServerLWM2M Server
2accessControlAccess Control
3deviceDevice
4connMonitorConnectivity Monitoring
5firmwareFirmware
6locationLocation
7connStatisticsConnectivity Statistics
8lockAndWipeLock and Wipe
9swUpdateSofware Update
10cellularConnCellular connectivity
11apnConnProfileAPN connection profile
12wlanConnWLAN connectivity
13bearerSelectionBearer selection
15devCapMgmtDevCapMgmt
2048cmdhPolicyCmdhPolicy
2049activeCmdhPolicyActiveCmdhPolicy
2050cmdhDefaultsCmdhDefaults
2051cmdhDefEcValuesCmdhDefEcValues
2052cmdhDefEcParamsValuesCmdhDefEcParamsValues
2053cmdhLimitsCmdhLimits
2054cmdhNetworkAccessRulesCmdhNetworkAccessRules
2055cmdhNwAccessRuleCmdhNwAccessRule
2056cmdhBufferCmdhBuffer
3200digitalInputDigital Input
3201digitalOutputDigital Output
3202analogInputAnalogue Input
3203analogOutputAnalogue Output
3300genericSensorGeneric Sensor
3301presenceSensorIlluminance Sensor
3302presenceSensorPresence Sensor
3303tempSensorTemperature Sensor
3304humidSensorHumidity Sensor
3305pwrMeaPower Measurement
3306actuationActuation
3308setPointSet Point
3310loadCtrlLoad Control
3311lightCtrlLight Control
3312pwrCtrlPower Control
3313accelerometerAccelerometer
3314magnetometerMagnetometer
3315barometerBarometer
  • IPSO/OMA-LWM2M unique Resource ids (this class of ids is reusable with Objects)
Resource Idlwm2m-id KeyResource Name
4000objectInstanceHandle
4001objectVersion
5500dInState
5501counter
5502dInPolarity
5503debouncePeriod
5504edgeSelection
5505counterReset
5550dOutState
5551dOutpolarity
5600aInCurrValue
5601minMeaValue
5602maxMeaValue
5603minRangeValue
5604maxRangeValue
5605resetMinMaxMeaValues
5650aOutCurrValue
5700sensorValue
5701units
5702xValue
5703yValue
5704zValue
5705compassDir
5706colour
5750appType
5751sensorType
5800instActivePwr
5801minMeaActivePwr
5802maxMeaActivePwr
5803minRangeActivePwr
5804maxRangeActivePwr
5805cumulActivePwr
5806activePwrCal
5810instReactivePwr
5811minMeaReactivePwr
5812maxMeaReactivePwr
5813minRangeReactivePwr
5814maxRangeReactivePwr
5815cumulReactivePwr
5816reactivePwrCal
5820pwrFactor
5821currCal
5822resetCumulEnergy
5823eventId
5824startTime
5825durationInMin
5826criticalLevel
5827avgLoadAdjPct
5828dutyCycle
5850onOff
5851dimmer
5852onTime
5853mstateOut
5900setPointValue
5903busyToClearDelay
5904clearToBusyDelay
5905hostDeviceManuf
5906hostDeviceMdl
5907hostDeviceUID
5908hostDeviceSwVer
  • IPSO/OMA-LWM2M specified Resource ids (this class of ids is specified with Objects)

    • oid = lwm2mSecurity
        {
            "lwm2mServerURI": 0,
            "bootstrapServer": 1,
            "securityMode": 2,
            "pubKeyId": 3,
            "serverPubKeyId": 4,
            "secretKey": 5,
            "smsSecurityMode": 6,
            "smsBindingKeyParam": 7,
            "smsBindingSecretKey": 8,
            "lwm2mServerSmsNum": 9,
            "shortServerId": 10,
            "clientHoldOffTime": 11
        }
    
    • oid = lwm2mServer
        {
            "shortServerId": 0,
            "lifetime": 1,
            "defaultMinPeriod": 2,
            "defaultMaxPeriod": 3,
            "disable": 4,
            "disableTimeout": 5,
            "notificationStoring": 6,
            "binding": 7,
            "regUpdateTrigger": 8
        }
    
    • oid = accessControl
        {
            "objectId": 0,
            "objectInstanceId": 1,
            "ACL": 2,
            "ACLOwner": 3
        }
    
    • oid = device
            "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,
            "suppBindAndMode": 16,
            "devType": 17,
            "hwVer": 18,
            "swVer": 19,
            "battStatus": 20,
            "memTotal": 21
    
    • oid = connMonitor
        {
            "nwkBearer": 0,
            "availNwkBearer": 1,
            "radioSS": 2,
            "linkQuality": 3,
            "ip": 4,
            "routeIp": 5,
            "linkUtil": 6,
            "APN": 7,
            "cellId": 8,
            "SMNC": 9,
            "SMCC": 10
        }
    
    • oid = firmware
        {
            "package": 0,
            "packageURI": 1,
            "update": 2,
            "state": 3,
            "updateSuppObjects": 4,
            "updateResult": 5,
            "pkgName": 6,
            "pkgVer": 7
        }
    
    • oid = location
        {
            "lat": 0,
            "lon": 1,
            "alt": 2,
            "uncertainty": 3,
            "velocity": 4,
            "timestamp": 5
        }
    
    • oid = connStatistics
        {
            "SMSTxCounter": 0,
            "SMSRxCounter": 1,
            "txData": 2,
            "rxData": 3,
            "maxMsgSize": 4,
            "avgMsgSize": 5,
            "startOrReset": 6
        }
    
    • oid = digitalInput
        {
            "dInState": 5500,
            "counter": 5501,
            "dInPolarity": 5502,
            "debouncePeriod": 5503,
            "edgeSelection": 5504,
            "counterReset": 5505,
            "appType": 5750,
            "sensorType": 5751
        }
    
    • oid = digitalOutput
        {
            "dOutState": 5550,
            "dOutpolarity": 5551,
            "appType": 5750
        }
    
    • oid = analogInput
        {
            "aInCurrValue": 5600,
            "minMeaValue": 5601,
            "maxMeaValue": 5602,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "resetMinMaxMeaValues": 5605,
            "appType": 5750,
            "sensorType": 5751
        }
    
    • oid = analogOutput
        {
            "aOutCurrValue": 5650,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "appType": 5750
        }
    
    • oid = genericSensor
        {
            "sensorValue": 5700,
            "units": 5701,
            "minMeaValue": 5601,
            "maxMeaValue": 5602,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "resetMinMaxMeaValues": 5605,
            "appType": 5750,
            "sensorType": 5751
        }
    
    • oid = illumSensor
        {
            "sensorValue": 5700,
            "units": 5701,
            "minMeaValue": 5601,
            "maxMeaValue": 5602,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "resetMinMaxMeaValues": 5605
        }
    
    • oid = presenceSensor
        {
            "dInState": 5500,
            "counter": 5501,
            "counterReset": 5505,
            "sensorType": 5751,
            "busyToClearDelay": 5903,
            "clearToBusyDelay": 5904
        }
    
    • oid = tempSensor
        {
            "sensorValue": 5700,
            "units": 5701,
            "minMeaValue": 5601,
            "maxMeaValue": 5602,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "resetMinMaxMeaValues": 5605
        }
    
    • oid = humidSensor
        {
            "sensorValue": 5700,
            "units": 5701,
            "minMeaValue": 5601,
            "maxMeaValue": 5602,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "resetMinMaxMeaValues": 5605
        }
    
    • oid = pwrMea
        {
            "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
        }
    
    • oid = actuation
        {
            "onOff": 5850,
            "dimmer": 5851,
            "onTime": 5852,
            "mstateOut": 5853,
            "appType": 5750
        }
    
    • oid = setPoint
        {
            "setPointValue": 5900,
            "colour": 5706,
            "units": 5701,
            "appType": 5750
        }
    
    • oid = loadCtrl
        {
            "eventId": 5823,
            "startTime": 5824,
            "durationInMin": 5825,
            "criticalLevel": 5826,
            "avgLoadAdjPct": 5827,
            "dutyCycle": 5828
        }
    
    • oid = lightCtrl
        {
            "onOff": 5850,
            "dimmer": 5851,
            "colour": 5706,
            "units": 5701,
            "onTime": 5852,
            "cumulActivePwr": 5805,
            "pwrFactor": 5820
        }
    
    • oid = pwrCtrl
        {
            "onOff": 5850,
            "dimmer": 5851,
            "onTime": 5852,
            "cumulActivePwr": 5805,
            "pwrFactor": 5820
        }
    
    • oid = accelerometer
        {
            "units": 5701,
            "xValue": 5702,
            "yValue": 5703,
            "zValue": 5704,
            "minRangeValue": 5603,
            "maxRangeValue": 5604
        }
    
    • oid = magnetometer
        {
            "units": 5701,
            "xValue": 5702,
            "yValue": 5703,
            "zValue": 5704,
            "compassDir": 5705
        }
    
    • oid = barometer
        {
            "sensorValue": 5700,
            "units": 5701,
            "minMeaValue": 5601,
            "maxMeaValue": 5602,
            "minRangeValue": 5603,
            "maxRangeValue": 5604,
            "resetMinMaxMeaValues": 5605
        }
    

Keywords

FAQs

Package last updated on 18 Jan 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc