LogoLogo
HomeSign UpGithub
  • Home
  • Release Notes
  • Getting Started
    • Create your first Test
    • Create Run Settings
    • Analyze the results
      • Job Summary
      • Logs
      • State
      • Payload
    • Look deeper with Metrics
  • Concepts
    • Workspaces
      • Role Based Access Control (RBAC)
      • Invitation Management
      • GitHub Integration
      • Deletion of Workspaces
      • System Status
    • Understanding Tests
      • Stages Management
        • Init Stage
        • Running Stage(s)
        • Finished State
      • Generating Messages
        • Scripting Environment
        • State Object
      • Response Handler
      • Preview Tests
      • Exporting/Importing Tests
        • Import OpenAPI JSON/YAML
      • Locking/Unlocking a test
    • Stateful Simulation
      • Mapping the IoT device lifecycle
    • Protocol Settings
      • MQTT
      • HTTP
      • Using other protocols
    • Run Settings
      • Network Simulation
      • Execution Strategies
      • Client Distribution
    • Scenarios
    • Glob Storage
    • Metrics
    • Mailbox
    • Licensing and Limits
    • Deployment Models
  • Additional Helpers
    • External Libraries
    • Inbuilt Libraries
    • IoTIFY Helper Functions
      • Job Functions
      • Messaging Functions
      • Glob Functions
      • Metrics Functions
      • Mailbox Functions
      • Data Generation Functions
  • platform integrations
    • AWS IoT Connector
  • Guides
    • Smart City
    • Smart Home
    • Load Testing Kafka
  • IoT Testing
    • Overview
      • Feed offline sensor data from Google Sheets to your IoT platform
    • Functional Testing
      • Basic functional test
      • Geofencing Validation
    • Performance Testing
      • MQTT end to end latency Measurement
    • Security Testing
    • Load Testing
    • Test Automation & CI/CD integration
  • API
    • Simulation API
    • Glob APIs
    • Metrics API
  • Glossary
  • Create Account
  • TEMP
    • Getting Started
      • Beginner
      • Developer
      • Tester
    • Walkthrough
    • Protocol Settings
      • CoAP
      • Raw (TCP/UDP/TLS/DTLS)
      • LWM2M
      • NONE
    • Under the hood
    • Google Sheets API
    • Azure IoT
    • Losant IoT
      • Losant Connector
      • Parking Space Management
      • Waste Management
      • Connected Truck
      • Delivery Van
    • Google Cloud IoT Core
    • IBM Cloud
      • Simple Messaging
      • IBM Bluemix: Monitoring Energy Consumption
    • Dweet.io
    • JMeter and why it fails at IoT
Powered by GitBook
On this page

Was this helpful?

  1. TEMP
  2. Protocol Settings

LWM2M

LWM2M simulator is an enterprise only feature currently limited in preview.

PreviousRaw (TCP/UDP/TLS/DTLS)NextNONE

Last updated 4 years ago

Was this helpful?

LWM2M is currently in a preview only mode for Enterprise. Please contact us to get a demo.

specification is based on CoAP and is developed by the for the Internet of Things. The advantage of LWM2M over others is that it runs on UDP/DTLS and could even use SMS in some constrained cases. The underlying protocol for LWM2M is the (CoAP).

Currently the LWM2M client settings are minimalist. The client will automatically try to register to the provided server. In order to use the LWM2M client, you must build a smartobject in your state variable in device initialization. An example of a LWM2M device initialization code is

{
  state.temp = 20;
  state.led = false;
  
  state.so = new smartObject(); 
  state.so.init('temperature', 0, 
    {
        _state : state,
        sensorValue: {
        read: function (cb) {
            console.log('Read called for Sensor'); 
            cb(null,state.temp); },
        write: function (value, cb){ 
            console.log('Write called for Sensor with value', value)
            cb(null,state.temp); 
        }},
        units: 'C'	
    }); 


    // led
  state.so.init('lightCtrl', 0 , {
        _state: state,
        onOff: {
            read: function (cb) {
                cb(null, state.led);
            },
            write: function (val, cb) {
                state.led = val;
                cb(null, state.led);
            }
        }
    });


  //no need for return 
}

Above Function will initiate two resource objects for your device. The server could read/write and observe to these resources and the handlers will be invoked.

The message sending functions are also a little different in case of LWM2M

{
    state.temp = 25+index();
    
    /* Update using a trigger method
    state.so.write('temperature', 0, 'sensorValue', state.temp , function (err, data) {
        if (err) {
            console.log(err);   // Error: 'Resource is unwritable.'
            console.log(data);  // _unwritable_
        }
    });
    */
    
    
    // Read using trigger method
    /*
    state.so.dump('temperature', 0, function (err, data) {
        console.log(data);
        
    })
    */
    
	var payload = {
        pathname: '/.well-known/core',
        payload: '</>;hb,</1/0>;obs,</3/0>;obs,</4/0>;obs,</3303/0>;obs', 
        method: 'GET', 
        waitResponse: false,
        options: { 
            'Content-Format': 'application/link-format' 
        },
        query: '' 
	}
	
    return JSON.stringify(payload);
}

A JSON object must be returned in stringified form, indicating the next action to be performed.

Lightweight Machine to Machine
Open Mobile Alliance
Constrained Application Protocol