Bootstrap Read operation
Bootstrap Read
The "Read" operation in Bootstrap Interface is a restricted form of the "Read" operation in Device Management and Service Enablement interface, and must be limited to target Objects which are strictly necessary to setup a proper configuration in a LWM2M Client; typically in LWM2M 1.1, the only acceptable targets for the Bootstrap "Read" is the LWM2M Server Object and the Access Control Object. This operation allows the Bootstrap- Server to query the existing Server Account(s) to determine validity and to add new Server Account(s) without breaking the access rights already in place in the targeted LWM2M Client.
The "Read" operation has the following parameters:
Parameter | Required | Default value | Notes |
---|---|---|---|
Object ID | Yes | - | Indicates the Object. |
Object Instance ID | No | - | Indicates the Object instance to read. |
Following is an example for Bootstrap Read request on /1 (server object):
Script:
<primitiveImplementation type="BSLWM2M" id="lwm2m.new.bootstrap.psk.read"><![CDATA[
var pskId = client.getPskId();
var psk = client.generatePsk();
var reguri = client.getRegistrationServerUri();
var jsonRegSec = "{\"e\":[{\"n\":\"0\",\"sv\":\"" + reguri + "\"},{\"n\":\"1\",\"bv\":false},{\"n\":\"2\",\"v\":0},{\"n\":\"3\",\"sv\":\"" + pskId + "\"},{\"n\":\"5\",\"sv\":\""+ psk + "\"},{\"n\":\"10\",\"v\":1}]}";
var jsonRegSrv = "{\"e\":[{\"n\":\"0\",\"v\":1},{\"n\":\"1\",\"v\":60},{\"n\":\"2\",\"v\":1},{\"n\":\"3\",\"v\":1000},{\"n\":\"5\",\"v\":84600},{\"n\":\"6\",\"bv\":true},{\"n\":\"7\",\"sv\":\"UQ\"}]}";
lwm2m.write('/0/1', jsonRegSec);
lwm2m.write('/1/1', jsonRegSrv);
client.setCredentials(pskId, psk);
var response = lwm2m.read('/1');
output.set("responseCode", response.code);
output.set("responseStatus", response.status);
output.set("resourceValue", response.value);
lwm2m.finished();
]]>
</primitiveImplementation>
Response:
"{\"bn\":\"/1\",\"e\":[
{\"n\":\"0/0\",\"v\":12345}
,
{\"n\":\"0/1\",\"v\":84600}
,
{\"n\":\"0/6\",\"bv\":false}
,
{\"n\":\"0/7\",\"sv\":\"U\"}
,
{\"n\":\"1/0\",\"v\":1}
,
{\"n\":\"1/1\",\"v\":60}
,
{\"n\":\"1/2\",\"v\":1}
,
{\"n\":\"1/3\",\"v\":1000}
,
{\"n\":\"1/5\",\"v\":84600}
,
{\"n\":\"1/6\",\"bv\":true}
,
{\"n\":\"1/7\",\"sv\":\"UQ\"}
]}"