Development User - Guide Smart Spot
Development User - Guide Smart Spot
Luis Buñuel 6
30562
Ceutí, Murcia
Spain
Index
Homard API REST______________________________________ 2
Homard RESTFul API Examples_________________________ 6
URL Manager__________________________________________ 15
URL Manager RESTFul API____________________________ 16
URL Manager RESTFul API Examples__________________ 16
FIWARE Integration____________________________________ 19
Orion Context Broker NGSI RESTFul API_______________ 22
ANNEX 1: OMA LwM2M_______________________________ 52
DEVELOPMENT GUIDE
API-RESTFul
There are two API types synchronous and asynchronous, will send to a callback URL defined by the client. This API
on one hand it is synchronous API, that corresponds requires the HTTP basic authentication using a Homard
with Server request such as get the client list, get a client account.
specific data or list the observes set on a device. On the
other hand it is device request. The device requests are The following diagram shows the differences between
launched on background, this means that the response synchronous and asynchronous API.
Synchronous request
Synchronous response
User Callback
User HTTP Client Homard
Client Server
Asynchronous request
Asynchronous response
This subsection will present the synchronous API and an example. The available synchronous API resources are as
follows:
3
DEVELOPMENT GUIDE
The API is very useful in special for applications that can not setup a HTTP server in its architecture. This synchronous
API can be outdated, to solve it, the user can enable a simple observer, which constantly updates the resource. In order
to create an internal observer to maintain the value updated for a specific resource is as follows:
4
SMART SPOT
5
DEVELOPMENT GUIDE
Query
GET /api/rest
Result
[ },
{ “objectId”:4
“endpoint”:”HOP-Sensor-Debug”, },
“registrationId”:”MTKt5ejSeu”, {
“registrationDate”:”2015-02-16T01:06:27+01:00”, “url”:”/5”,
“address”:”/127.0.0.1:54604”, “attributes”:{
“lwM2MmVersion”:”1.0”,
“lifetime”:120, },
“bindingMode”:”UQ”, “objectId”:5
“rootPath”:”/”, },
“objectLinks”:[ {
{ “url”:”/3201/0”,
“url”:”/1/0”, “attributes”:{
“attributes”:{
},
}, “objectId”:3201,
“objectId”:1, “objectInstanceId”:0
“objectInstanceId”:0 },
}, {
{ “url”:”/3201/1”,
“url”:”/3”, “attributes”:{
“attributes”:{
},
}, “objectId”:3201,
“objectId”:3 “objectInstanceId”:1
}, }
{ ]
“url”:”/4”, }
“attributes”:{ ]
6
SMART SPOT
Query
GET /api/rest/HOP-Sensor-Debug
Result
{ “objectId”:4
“endpoint”:”HOP-Sensor-Debug”, },
“registrationId”:”MTKt5ejSeu”, {
“registrationDate”:”2015-02-16T01:06:27+01:00”, “url”:”/5”,
“address”:”/127.0.0.1:54604”, “attributes”:{
“lwM2MmVersion”:”1.0”,
“lifetime”:120, },
“bindingMode”:”UQ”, “objectId”:5
“rootPath”:”/”, },
“objectLinks”:[ {
{ “url”:”/3201/0”,
“url”:”/1/0”, “attributes”:{
“attributes”:{
},
}, “objectId”:3201,
“objectId”:1, “objectInstanceId”:0
“objectInstanceId”:0 },
}, {
{ “url”:”/3201/1”,
“url”:”/3”, “attributes”:{
“attributes”:{
},
}, “objectId”:3201,
“objectId”:3 “objectInstanceId”:1
}, }
{ ]
“url”:”/4”, }
“attributes”:{
},
7
DEVELOPMENT GUIDE
Query
GET /api/rest/UBI8086f2759cbb/observes
Result
[ {
{ “field”: “value”,
“client”: “HOPf4b85eab962b”, “value”: “$value”
“path”: },
{ {
“objectId”: 3303, “field”: “r”,
“objectInstanceId”: 0, “value”: “$resource”
“resourceId”: 5700 },
}, {
“ocos”: “field”: “threshold”,
[ “value”: “$threshold”
{ }
“url”: “homard.hopu.eu:8090/co”, ],
“protocol”: “https://”, “id”: 1,
“threshold”: 0, “type”: 0,
“condition”: “>=”, “endpoint”: “HOPf4b85eab962b”,
“method”: “POST”, “path”: “/3303/0/5700”
“oneShot”: false, }
“outputFormat”: ]
[ }
{ ]
“field”: “sensor”,
“value”: “$eID”
},
Query
DELETE /api/rest/HOPf4b85eab9b03/3303/0/5700/observe
Result
HTTP Response 200 OK
8
SMART SPOT
GET parameters:
• proto (mandatory): Determines the protocol to use • cbauthusr (optional): Used if the destination server
(HTTP or HTTPS). requires Basic authentication.
• cburl (mandatory): Determines the response • cbauthpass (optional): Used if the destination server
destination url. requires Basic authentication.
PUT parameters: proto (mandatory), cburl (mandatory), cbauthusr (optative), cbauthpass (optative).
{
“id”: 5,
“value”: 2
}
9
DEVELOPMENT GUIDE
{ “type”: “string”
“$schema”: “http://json-schema.org/draft-04/ },
schema#”, “authUsr”: {
“id”: “http://jsonschema.net”, “id”: “http://jsonschema.net/authUsr”,
“type”: “object”, “type”: “string”
“properties”: { },
“threshold”: { “authPass”: {
“id”: “http://jsonschema.net/threshold”, “id”: “http://jsonschema.net/authPass”,
“type”: “string” “type”: “string”
}, }
“op”: { },
“id”: “http://jsonschema.net/op”, “required”: [
“type”: “string” “threshold”,
}, “op”,
“typeShot”: { “typeShot”,
“id”: “http://jsonschema.net/typeShot”, “method”,
“type”: “string” “durl”,
}, “proto”
“method”: { ]
“id”: “http://jsonschema.net/method”, }
“type”: “string”
},
“durl”: {
“id”: “http://jsonschema.net/durl”,
“type”: “string”
},
“proto”: {
“id”: “http://jsonschema.net/proto”,
10
SMART SPOT
Example of request:
Create Observation
POST /api/rest/HOPf4b85eab9b3a/3303/0/5700/co
Required Payload
{
“threshold”: “0”,
“op”: “>=”,
“typeShot”:”repeat”,
“method”: “POST”,
“durl”:”homard.hopu.eu:8090/co”,
“proto”:”https://”,
“authUsr”: “”,
“authPass”: “”
}
Response Received
HTTP response 200
11
DEVELOPMENT GUIDE
{
...,
“outputPacket”:[
{“field”:”name”, “value”:”$eID”},
{“field”: “value”, “value”:”$value”},
{“field”: “uuid”, “value”:”067e6162-3b6f-4ae2-a171-2470b63dff00”}
]
}
12
SMART SPOT
{ {
“$schema”: “http://json-schema.org/draft-04/schema#”, “id”: “http://jsonschema.net/outputPacket/0”,
“id”: “http://jsonschema.net”, “type”: “object”,
“type”: “object”, “properties”: {
“properties”: { “field”: {
“threshold”: { “id”: “http://jsonschema.net/outputPacket/0/field”,
“id”: “http://jsonschema.net/threshold”, “type”: “string”
“type”: “string” },
}, “value”: {
“op”: { “id”: “http://jsonschema.net/outputPacket/0/value”,
“id”: “http://jsonschema.net/op”, “type”: “string”
“type”: “string” }
}, }
“typeShot”: { },
“id”: “http://jsonschema.net/typeShot”, {
“type”: “string” “id”: “http://jsonschema.net/outputPacket/1”,
}, “type”: “object”,
“method”: { “properties”: {
“id”: “http://jsonschema.net/method”, “field”: {
“type”: “string” “id”: “http://jsonschema.net/outputPacket/1/field”,
}, “type”: “string”
“durl”: { },
“id”: “http://jsonschema.net/durl”, “value”: {
“type”: “string” “id”: “http://jsonschema.net/outputPacket/1/value”,
}, “type”: “string”
“proto”: { }
“id”: “http://jsonschema.net/proto”, }
“type”: “string” }
}, ]
“authUsr”: { }
“id”: “http://jsonschema.net/authUsr”, },
“type”: “string” “required”: [
}, “threshold”,
“authPass”: { “op”,
“id”: “http://jsonschema.net/authPass”, “typeShot”,
“type”: “string” “method”,
}, “durl”,
“outputPacket”: { “proto”
“id”: “http://jsonschema.net/outputPacket”, ]
“type”: “array”, }
“items”: [
13
DEVELOPMENT GUIDE
Example of request:
Create Observation
POST /api/rest/HOPf4b85eab9b3a/3303/0/5700/observe
Required Payload
{
“threshold”: “0”,
“op”: “>=”,
“typeShot”:”repeat”,
“method”: “POST”,
“durl”:”homard.hopu.eu:8090/co”,
“proto”:”https://”,
“authUsr”: “”,
“authPass”: “”,
“outputPacket”:[
{“field”:”name”, “value”:”$eID”},
{“field”: “value”, “value”:”$value”}
]
}
Response Received
HTTP response 200
14
SMART SPOT
15
DEVELOPMENT GUIDE
Smart PhoneS detect the Eddystone URL advertisement More information in the repository: https://github.com/
with a fixed device url that point to the Device URL HOP-Ubiquitous/DeviceUrlManager
Create device
Sample Call
$.ajax({
url: “/api/v1/devices”,
dataType: “json”,
data: { “mac”: “001122334455”, “external_url”: “https://google.es/” },
type : “POST”,
success : function(r) {
console.log(r);
}
});
16
SMART SPOT
Success Response
Code: 200 (Ok)
Content: { “mac”: “001122334455”, “external_url”: “https://google.es/” }
Error Response
Code: 404 (Not Found)
Content: { “detail”: “Device Not Found” }
Sample Call
$.ajax({
url: “/api/v1/devices/001122334455”,
dataType: “json”,
type : “GET”,
success : function(r) {
console.log(r);
}
});
17
DEVELOPMENT GUIDE
Success Response
Code: 200 (Ok)
Content: { “mac”: “001122334455”, “external_url”: “https://google.es/” }
Error Response
Code: 404 (Not Found)
Content: { “detail”: “Device Not Found” }
Sample Call
$.ajax({
url: “/api/v1/devices/001122334455”,
dataType: “json”,
data: { “external_url”: “https://google.es/” },
type : “PUT”,
success : function(r) {
console.log(r);
}
});
18
SMART SPOT
FIWARE Integration
FIWARE (www.fiware.org) in an open platform promoted FIWARE and the solutions from HOP Ubiquitous are
by the European Commision and maintained by the contributing to the creation of adapted and standardized
FIWARE Foundation, where HOP Ubiquitous is Gold solutions to satisfy the described process from the co-
Member. creation and citizens engagement to the deployment of
solutions based on IoT to reach the digitalization and
FIWARE offers an Open Ecosystem that join different enhancement of different areas in the city.
technology enablers for scalable data mangement and
make feasible to integrate different services and Internet Thanks to the LwM2M Bootstrap Server deployed and
of Things devices into a common and interoperable integrated in the Homard platform, it is really easy to
framework based on Open Standards. In particular, setup the server configuration for a the device. In this
FIWARE is based on Open Standards such as OMA way, anyone can deploy its own LwM2M IOTAgent with a
NGSI for the Services Interface and ETSI ISG CIM for the public server IP and configure the device to integrate it in
data models. HOP Ubiquitous is an active member and FIWARE.
contributor in ETSI ISG CIM and also an active contributor
in OMA; being one of pioneer and main companies A tutorial about Orion Context Broker has been
working around OMA LwM2M protocol. developed by FIWARE and HOP Ubiquitous, which can be
downloaded in: http://goo.gl/o1KXcT
In details, FIWARE has a strong role in the Smart Cities
market, since the is key to the growth and functionality
of Smart Cities, for this reason we are committed to
initiatives such as Open and Agile Smart Cities (OASC)
association with over 100 cities enrolled and FIWARE
technology as the basis for making it feasible.
19
DEVELOPMENT GUIDE
The functionality of LwM2M protocol is carried out The FIWARE Foundation counts with its own set of
through a set of basic objects such as “Server”, “Security”, services for the IOT. One of this kind of services is called
“Device”, “Statistics”... but there are also more specific FIWARE IOT Agent, and we can find one that is fully
objects defined by the IPSO Alliance which aims to compatible with our device architecture and connection
cover the need common definitions for sensors such as protocols. HOP Ubiquitous in collaboration with ATOS and
temperature, humidity, presence, etc. Or actuators such as Telefonica are maintaining the integration of OMA LwM2M
power/light/load control, buzzers, etc. protocol with FIWARE via the Orion Context Broker. It is
fully Open Source (URL al IoT Agent de HOPU en GitHub),
CoAP (Constrained Application Protocol) defines the and it counts with a simple deployment over FIWARE and
message header, request/response codes, message Linux-based platforms.
options and retransmission mechanisms, this protocol
together with UDP is used by LwM2M as a transport In addition, HOP Ubiquitous offers containers and Cloud-
mechanism. enabled services with the integration of FIWARE and
Orion Context Broker (including OMA LwM2M IoT Agent).
There are a large variety of topologies on the IoT but they Contact HOP Ubiquitous support team for more details.
have three common parts; devices, routers and backends.
20
SMART SPOT
Store Aggregated Data
STH Comet
Store Subscriptions
Subscription Cygnus Orion Context Broker
NGSI Interface
OMA LwM2M
• Get and configure the Hopu modified FiWARE Docker makes really simple the previous steps.
IOTAgent:
1. git clone https://github.com/HOP-Ubiquitous/ • Make sure that the Smart Spot knows where is the
lightweightm2m-iotagent/tree/hopu IoTAgent to connect with:
2. change the file content for confi g.js, 1. Notify The Smart Spot about the IOTAgent IP with
omaRegistry.json and omaInverseRegistry. the bootstrap procedure.
json in order to set up our device configuration to
connect with. • Rock & Roll:
3. execute: npm install 1. Change directory (cd) to the IOTAgent one and
4. Launch a mongoDB instance for the IOTAgent execute ./bin/lwm2mAgent.js
with external port 7900. 2. Turn on the Smart Spot
21
DEVELOPMENT GUIDE
Create entity v2
Return
Returns an error message, if already exists an entity in the service with the same id.
22
SMART SPOT
Retrieve entity v2
Return
If the search has been successful then it returns the information else it returns an message error.
Return
If the search has been successful then it returns the information of compressed way else returns an error message.
Retrieve entities v2
http://{{url}}:{{port-orion}}/v2/ Url: Link to the service that will be consulted. Method to retrieve all
GET
entities?limit=50 Port-orion: Port to connect with the service. entities.
Return
All entities of the service and for each entity shows their information
23
DEVELOPMENT GUIDE
Return
All entities of the service and for each entity shows their information of compressed way.
Update entity v2
24
SMART SPOT
Delete entity v2
Return
If the search has been successful then the attribute is retrieved and shows their information else an error message is
returned
25
DEVELOPMENT GUIDE
Return
If the search has been successful then the attribute is retrieved and shows their information, else it returns a message
error.
Return
If the search has been successful then type is retrieved and shows all their information, else an error message is
returned
26
SMART SPOT
Retrieve types v2
http://{{url}}:{{port-orion}}/v2/ Url: Link to the service that will be consulted. The different entity types
GET in the service and their
types Port-orion: port to connect with the service. information.
Create subscription v2
http://{{url}}:{{port-orion}}/v2/ Url: Link to the service that will be consulted. Method to create a
POST subscription to one or
subscriptions Port-orion: Port to connect with the service. many entities
Body
{ }
“description”: “Definition of the subscription”, },
“subject”: { “notification”: {
“entinties”: [ “http”: {
{ “url”: “http://localhost:1028/accumulate”
“id”: “Room1” },
“type: “Room” “attrs”: [
} “temperature”
], ]
“condition”: { },
“attrs”: [ “expires”: “2040-01-01T14:00:00.00Z”,
“pressure” “throttling”: “5”
] }
27
DEVELOPMENT GUIDE
Retrieve subcriptions v2
http://{{url}}:{{port-orion}}/v2/ Url: Link to the service that will be consulted. Method to retrieve all
GET
subscriptions Port-orion: Port to connect with the service. subscriptions of a service.
Return
All existing subscriptions of the service and for each subscription show their information.
Remove subscription v2
28
SMART SPOT
http://{{url}}:{{port-orion}}/v1/ Url: Link to the service that will be consulted. Method to create a context
POST of entity, an entity without
registry/registerContext Port-orion: Port to connect with the service. values.
Body
{ “name”: “nombre_atributo”,
“contextRegistrations”: [ “type”: “attribute_type”,
{ “isDomain”: “false”
“entities”: [ }
{ ],
“type”: “entity_type”, “providingApplication”: “http://homard.hopu.
“isPattern”: “false”, eu:1026/v2/entities”
“id”: “entity_id” }
} ],
], “duration”: “P1M”
“attributes”: [ }
{
Return
{
“duration”: “P1M”,
“registrationId”: “5a79812d777fc523840b8446”
}
29
DEVELOPMENT GUIDE
Body Return
30
SMART SPOT
Create/update entity v1
http://{{url}}:{{port-orion}}/v1/ Url: Link to the service that will be consulted. Method to create or update
POST an entity, depends on
updateContext Port-orion: Port to connect with the service. method’s body.
{ {
“contextElements”: [ “contextElements”: [
{ {
“type”: “entity_type”, “type”: “entity_type”,
“isPattern”: “false”, “isPattern”: “false”,
“id”: “entity_id “, “id”: “entity_id “,
“attributes”: [ “attributes”: [
{ {
“name”:”attribute_id “, “name”:”attribute_id”,
“type”: “attribute_type”, “type”: “attribute_type”,
“value”: “attribute_value” “value”: “attribute_value”
} }
] ]
} }
], ],
“updateAction”: “APPEND” “updateAction”: “UPDATE”
} }
Return
In case of performing the method correctly, it return 200 OK together with the information of the entity.
In UPDATE, in case of not find that entity, it return a 404 ERROR “No context element found”.
31
DEVELOPMENT GUIDE
Create entity v1
Body Return
Return
In case of performing the method correctly, it return 200 OK together with the information of the entity.
In case of not find that entity, it return a 404 ERROR “No context element found”.
32
SMART SPOT
Return
In case of performing the method correctly, it returns 200 OK together with the information of the entity with object JSON format.
In case of not find that entity, it return a 404 ERROR “No context element found”.
Body Return
33
DEVELOPMENT GUIDE
Body Return
Retrieve entities v1
Return
34
SMART SPOT
Return
Return
In case of performing the method correctly, it returns 200 OK together with the information of the all entities of this type.
In UPDATE, in case of not finding that entity, it returns a 404 ERROR “No context element found”.
35
DEVELOPMENT GUIDE
Return
In case of performing the method correctly, it returns 200 OK together with the information of the all entities of this type with object
JSON format.
In UPDATE, in case of not finding that entity, it returns a 404 ERROR “No context element found”.
Delete entity v1
Return
In case of performing the method correctly and delete the entity defined, it returns 200 OK .
In case of not finding that entity, it returns a 404 ERROR “No context element found”.
36
SMART SPOT
Create a new attribute. We transmit a new attribute in the body: Update an attribute. We transmit an existing/available attribute
with a new value.
{
“attributes”: [ {
{ “attributes”: [
“name”: “attribute_id”, {
“type”: “attribute_type”, “name”: “attribute_id_nuevo”,
“value”: “attribute_value” “type”: “attribute_type_nuevo”,
} “value”: “attribute_value_nuevo”
] }
} ]
}
Return
In case of performing the method correctly, it returns 200 OK together with the information of the entity updating.
In case of not finding that entity, it returns a 404 ERROR “No context element found”.
37
DEVELOPMENT GUIDE
Return
In case of performing the method correctly, it returns 200 OK together the attribute value defining by its ID for a specific entity.
In case of not finding that entity or attribute, it returns 404 ERROR “No context element found”.
In UPDATE, in case of not finding that entity, it returns a 404 ERROR “No context element found”.
Return
In case of performing the method correctly, it returns 200 OK together the attribute value defined by its ID for a specific entity with
object JSON format.
In case of not finding that entity or attribute, it returns 404 ERROR “No context element found”.
38
SMART SPOT
Return
In case of performing the method correctly, it returns 200 OK together with the information of defined attributes of all entities of this
type.
In UPDATE, in case of not finding that entity, it returns a 404 ERROR “No context element found”.
Return
In case of performing the method correctly, it returns 200 OK together with the information of defined attributes of all entities of this
type with object JSON format.
In UPDATE, in case of not finding that entity, it returns a 404 ERROR “No context element found”.
39
DEVELOPMENT GUIDE
Return
In case of performing the method correctly and delete the entity defined, it returns 200 OK.
In case of not finding that entity or attribute, it returns 404 ERROR “No context element found”.
Retrieve type v1
Return
In case of performing the method correctly, it returns 200 OK together the information of this entities type.
In case of not finding that entities type, it returns 404 ERROR “No context element found”.
40
SMART SPOT
Retrieve types v1
Return
In case of performing the method correctly, it returns 200 OK together the information of all entities type.
In case of not finding that entities type, it returns 404 ERROR “No context element found”.
Body
{ “reference”: “http://cygnus:5050/notify”,
“entities”: [ “duration”: “P1M”
{ }
“type”: “id_entity_type”,
“isPattern”: “false”, • isPattern: Nowadays, it is not being used. Threfore, value is
“id”: “.*” always “false”.
} • id: To which entity it wants to subscribe. In this case, to all
], entities of those type.
“attributes”: [ • reference: URL of client that it want to subscribe.
“id_attribute” • duration: The duration of the subscription. In ISO 8601
], standard format..
Return
{
“subscriptionId”: “subscription_id”,
“duration”: “P1M”
}
41
DEVELOPMENT GUIDE
Body
{ “reference”: “http://cygnus:5050/notify”,
“entities”: [ “duration”: “P1M”
{ }
“type”: “id_entity_type”,
“isPattern”: “false”,
“id”: “.*” • isPattern: Nowadays, it is not being used. Threfore, value is
} always “false”.
], • id: To which entity it wants to subscribe. In this case, to all
“attributes”: [ entities of those type.
“id_attribute” • reference: URL of client that it want to subscribe.
], • duration: The duration of the subscription. In ISO 8601
standard format..
Return
{
“subscriptionId”: “subscription_id”,
“duration”: “P1M”
}
42
SMART SPOT
Body Return
{ {
“entities”: [ “subscribeResponse”: {
{ “subscriptionId”: “id_subscription”,
“type”: “id_entity_type”, “id_parameter”: “value_parameter”
“isPattern”: “false”, }
“id”: “.*” }
}
],
“duration”: “P1M”
“subscriptionId”: “subscription_id”
}
43
DEVELOPMENT GUIDE
Body Return
{ {
“entities”: [ “subscribeResponse”: {
{ “subscriptionId”: “id_subscription”,
“type”: “id_entity_type”, “id_parameter”: “value_parameter”
“isPattern”: “false”, }
“id”: “.*” }
}
],
“duration”: “P1M”
“subscriptionId”: “subscription_id”
}
44
SMART SPOT
Body Return
Return
In case of performing the method correctly and delete the entity defined, it returns 200 OK together with the removed subscription ID.
In case of not finding that subscription, it returns 404 ERROR “No context element found”.
45
DEVELOPMENT GUIDE
Body
Return
{
“subscribeResponse”: {
“subscriptionId”: “id_subscription”,
“duration”: “P1M”
}
}
46
SMART SPOT
Body
Return
{
“subscribeResponse”: {
“subscriptionId”: “id_subscription”,
“duration”: “P1M”
}
}
47
DEVELOPMENT GUIDE
Body Return
{ {
“subscriptionId”: “id_subscription”, “subscribeResponse”: {
“id_parameter”: “value_parameter” “subscriptionId”: “id_subscription”,
} “id_parameter”: “value_parameter”
}
}
Body Return
{ {
“subscriptionId”: “id_subscription”, “subscribeResponse”: {
“id_parameter”: “value_parameter” “subscriptionId”: “id_subscription”,
} “id_parameter”: “value_parameter”
}
}
48
SMART SPOT
Delete subscription v1
Return
{
“subscribeResponse”: {
“subscriptionId”: “id_subscription”,
“id_parameter”: “value_parameter”
}
}
49
ANNEXES
DEVELOPMENT GUIDE
Resource model
The LwM2M Enabler defines a simple resource model Write, Execute) which are individually supported by the
where each piece of information made available by the Resources belonging to that Object; this specification also
LwM2M Client is a Resource. Resources are organized defines the Mandatory or Optional characteristics of such
into Objects, and each Resource is given a unique Resources.
identifier within that Object.
Objects and Resources have the capability to have
Each Objec is assigned a unique OMA LwM2M Object multiple instances. Multiple-Instances Resources can be
identifier allocated and maintained by the OMA Naming instantiated by LwM2M Server operations in using JSON
Authority (OMNA). Further Objects may be added by OMA or TLV formats. The LwM2M Client also has the capability
or other organizations to enable additional M2M Services. to instantiate Single or Multiple-Instances Resources.
As an Object only specifies a grouping of Resources, an The LwM2M Enabler defines an access control
Object must be firstly instantiated so that the LwM2M mechanism per Object Instance. Object Instances should
Client can use the Resources of such an Object and the have an associated Access Control Object Instance. An
associated functionalities. Access Control Object Instances contains Access Control
Lists (ACLs) that define which operations on a given
When an Object is instantiated an Object Instance is Object Instance are allowed for which LwM2M Server(s).
created with a subset of the Resources defined in the
Object specification; a LwM2M Server can then access
that Object Instance and its set of instantiated Resources.
52
SMART SPOT
Objects
Each Object definition, which may be found in the LwM2M from 0 to many. If this field is “Single” then the number
specification, features the following information: of Object Instance can be from 0 to 1.
• Mandatory: if this field is “Mandatory”, then the
• Name: specifies the Object name. LwM2M Client MUST support this Object. If this field
• Object ID: specifies the Object ID. is “Optional”, then the LwM2M Client SHOULD support
• Instances: indicates whether this Object supports this Object.
multiple Object Instances or not. If this field is • Object URN
“Multiple” then the number of Object Instance can be • Resource definitions
Attributes
Attributes are metadata which can be attached to an Than”, “Less Than”, or “Step”) and the “Minimum
Object, an Object Instance or a Resource. The value of an Period” timing conditions are both fulfilled for that
Attribute is LwM2M Server specific. Resource.
Regardless to the LwM2M entity a given Attribute is This behaviour can be modified using the following
attached to, the value of such an Attribute can be set at available attributes:
various levels: Object, Object Instance, Resource levels. ◊ Minimum Period (pmin): The Minimum Period
Attribute indicates the minimum time in seconds
• <PROPERTIES> Class Attributes: The role of these the LwM2M Client must wait between two
Attributes is to provide metadata which may notifications.
communicate helpful information to LwM2M Server ◊ Maximum Period (pmax): The Maximum Period
for example easing data management. These include: Attribute indicates the maximum time in seconds
◊ Dimension (dim): Number of Instantiations for a the LwM2M Client MAY wait between two
Multiple Resource. notifications.
◊ Object Version (ver): Provide the version of the ◊ Greater Than (gt) and Less Than (lt): This
associated Object. Attributes defines a threshold high value and
• <NOTIFICATION> Class Attributes: The role of low value. When these Attributes is present, the
these R-Attributes is to provide parameters to the LwM2M Client must notify the Server each time
“Notify” operation; any readable Resource can have the Observed Resource value crosses these
such Rattributes. In the message sent by a LwM2M thresholds with respect to pmin parameter and to
Client in response to an “Observe” operation, the pmax parameter.
current Resource value is reported; this event can be ◊ Step (st): This Attribute defines a minimum
considered as the initial notification. change value between two notifications. When
this Attribute is present, the change value
Each time a Resource notification is sent, the condition will occur when the value variation since
“Minimum Period” and “Maximum Period” timers the last notification of the Observed Resource, is
associated to this Resource are restarted. greater or equal to the “Step” Attribute value.
53
DEVELOPMENT GUIDE
Bootstrap Interface
The Bootstrap Interface is used to provision essential
information into the LwM2M Client to enable the LwM2M
Client to perform the operation “Register” with one or
more LwM2M Servers.
• Factory Bootstrap
• Bootstrap from Smartcard
• Client Initiated Bootstrap
• Server Initiated Bootstrap
54
SMART SPOT
The Client Registration Interface is used by a LwM2M The Binding Resource of the LwM2M Server Object
Client to register with one or more LwM2M Servers, informs the LwM2M Client of the transport protocol
maintain each registration and de-register from a LwM2M preferences of the LwM2M Server for the communication
Server. The registration is based on the Resource Model session between the LwM2M Client and LwM2M Server.
and Identifiers defined in Section 6 Identifiers and
Resources. When registering, the LwM2M Client performs The LwM2M Client should perform the operations with the
the “Register” operation and provides the properties the modes indicated by the Binding Resource of the LwM2M
LwM2M Server requires to contact the LwM2M Client Server Object Instance.
(e.g., End Point Name); maintain the registration and
session (e.g., Lifetime, Queue Mode) between the LwM2M
Client and LwM2M Server as well as knowledge of the
Objects the LwM2M Client supports and existing Object
Instances in the LwM2M Client. The registration is soft
state, with a lifetime indicated by the Lifetime Resource
of that LwM2M Server Object Instance. The LwM2M
Client periodically performs an update of its registration
information to the registered LwM2M Server(s) by
performing the “Update” operation– possibly without any
parameters. If the lifetime of a registration expires without
receiving an update from the LwM2M Client:
55
DEVELOPMENT GUIDE
56
SMART SPOT
57
hopu.eu