ETMLW – handles the LwM2M protocol

Manages the LwM2M protocol, which enables you to add, delete and update LwM2M resource values. Before you can use ETMLW, ensure that you have enabled the LwM2M protocol using AT+ETMSTATE="startlwm2m". For more information, see ETMSTATE – check current state.

Type Syntax Response
Test

AT+ETMLW=?

+ETMLW: "add",<id>,<uri>,<datatype>,<value>

+ETMLW: "remove",<id|uri>

+ETMLW: "update",<id|uri>,<send><,<value>>

 

OK

Read

AT+ETMLW? – returns the current list of user resources, which were added using AT+ETMLW="add"..., as well as resources specified in the lwm2m_resources.ini file.

 

 

+ETMLW: <id>,<uri>,<datatype>,<status>

+ETMLW: <id>,<uri>,<datatype>,<status>

...

 

OK

where:

  • id – the unique identifier for the LwM2M resource
  • uri – the unique URI for the LwM2M resource
  • datatype – the data format (either "Integer", "String", or "Boolean").
  • <status> – indicates the resource status, either:
    • "adding" – waiting to register the resource on the server
    • "removing" – waiting to de-register (delete) the resource from the server
    • "ready" – resource registered on the server

or

ERROR

Write

AT+ETMLW=<parameters>

where <parameters> is either:

  • "add",<id>,<uri>,<datatype>,<value> – adds a new LwM2M resource.
  • "remove",<id|"uri"> – deletes the current LwM2M resource.
  • "update",<id|"uri">,<send><,<value>> – modifies the LwM2M resource value.

and:

  • id – the unique identifier for the LwM2M resource. Minimum value: -1; Maximum value: 65535.

    If the id is -1 with the "add" command, AnyNet SMARTconnect™ will assign the first available ID to the new resource.

    id is only used internally by AnyNet SMARTconnect™.

  • uri – the unique LwM2M uniform resource identifier for the resource, in the following format:

    "/<objectId>/<objectInstanceId>/<resourceId>/<resourceInstanceId>".

    For example: "/5/2/0" or "/6/1/1/2".

    The following URIs are reserved and you cannot delete or modify them:

    • /1/0 – LwM2M server instance object.
    • /3/0 – Device object instance, contains information about the BG95 modem.
    • /3/1 – Device object instance, contains information about AnyNet SMARTconnect™.
    • /4/0 – Connectivity monitoring object instance.
  • datatype – for classifying the LwM2M resource data value, either "Integer", "String", or "Boolean".
  • value – the data sent in the specified datatype.

    For "Integer", the value is an integer without quotes. For example: 23. The integer range is -(2^63) to 2^63 - 1.

    For "String", enclose the value in double quotes. For example: "This is a literal string." The modem may impose a limit on string length. We recommend you do not exceed 1024 characters.

    For "Boolean" enclose "true" or "false" with double quotes. For example: "true"

  • send – indicates whether the data is sent immediately to the LwM2M server. Use either:

    0 – the new value is saved locally in AnyNet SMARTconnect™. The LwM2M server must fetch the value.

    1 – the new value is saved locally and AnyNet SMARTconnect™ immediately pushes the data to the LwM2M server.

    Ensure the value you are sending as an update is configured in the correct format for the resource datatype (as an integer, string or boolean value).

OK

 

+ETMLW: <id>,<uri>,"ADD"|"REMOVE"|"UPDATE",<statusCode>

where statusCode is the returned operation status code, either:

  • 0 – Successful operation – LwM2M resource either added, deleted or modified.

or any of the following errors:

  • -1 – Parameters not valid. Check that the command syntax is correct.
  • -2 – ID not found. The resource must first exist before you can delete or update it.
  • -3 – ID not valid. Check the format and number is correct.
  • -4 – ID already exists. You cannot add a new resource using an existing resource's ID.
  • -5 – URI not found. The URI must first exist before you can delete or update the associated resource.
  • -6 – URI not valid. Check the URI syntax.
  • -7 – URI resource instance required. Include a resourceInstanceIdin the URI.
  • -8 – URI resource instance not required. Exclude the resourceInstanceId from the URI.
  • -9 – URI already exists. You cannot add a new resource using an existing resource's URI.
  • -10 – System object. You cannot add, delete or update a reserved URI resource. Check the URI is correct.
  • -11 – Data type not supported. Only use either integer, string, or boolean.
  • -12 – Data type not allowed. A different data type was previously set in the URI hierarchy.
  • -13 – Data encode failed. The data type value was not added or updated. Check that the sent value is the correct data type.
  • -14 AnyNet SMARTconnect™ memory allocation failed. Contact Support: support@eseye.com.
  • -15 AnyNet SMARTconnect™ internal error. Contact Support.

or

ERROR – returned when the command fails, for example a parameter is missing or incorrect. Check your syntax. Ensure you have sent AT+ETMSTATE="startlwm2m" to enable the LwM2M protocol.

Example

AT+ETMLW="add",-1,"/32769/0/1","Integer",123

 

 

OK

 

+ETMLW: 0,"/32769/0/1","ADD",0

 

AT+ETMLW="add",-1,"/32769/1/1","String","Temp: 17°C"

 

OK

 

+ETMLW: 0,"/32769/1/1","ADD",-12

 

AT+ETMLW="add",-1,"/32769/1/1","Integer",17

 

OK

 

+ETMLW: 1,"/32769/1/1","ADD",0

 

AT+ETMLW?

+ETMLW: 0,"/32769/0/1","integer","ready"

+ETMLW: 1,"/32769/1/1","integer","ready"

 

 

OK