Dear Mr Kai,
Thanks for the reply. My suggestion is that from a server point of view it will be difficult to query the attributes of the client(attributes in an object instance ). If the Client update the attributes as well along with object ID and Object Instance it would have been more better . I earlier read in this forum somebody requesting a spec change regarding this .
Thannks
Subhash
On Sun, Mar 27, 2016 at 3:16 PM, Kai <
sophokles.kh@xxxxxxxxx> wrote:
When a LWM2M client registers with a server it only provides information about the type of objects it supports and which instances of these object types it manages (so far). The current state of these object instances needs to be explicitly queried from the server side. A RegistrationListener is only forwarded the information conveyed by the registration request from the client.
You might find it helpful to read the LWM2M spec in order to better understand the interactions between devices (LWM2M clients) and servers.
Regards,
Kai
On Sat, Mar 26, 2016 at 12:27 PM Subhash Nair p <
edu.subhashnair@xxxxxxxxx> wrote:
Hi All,
During Registration I am getting the following information and able to push to an Enterprise Platform.
{
"endpoint": "ccccc",
"registrationId": "crtLar6TES",
"registrationDate": "2016-03-26T16:50:43+05:30",
"lastUpdate": "2016-03-26T16:51:37+05:30",
"address": "
127.0.0.1:57653",
"lwM2mVersion": "1.0",
"lifetime": 30,
"bindingMode": "U",
"rootPath": "/",
"objectLinks": [{
"url": "/",
"attributes": {
"rt": "oma.lwm2m"
}
}, {
"url": "/1/0",
"attributes": {},
"objectId": 1,
"objectInstanceId": 0
}, {
"url": "/3/0",
"attributes": {},
"objectId": 3,
"objectInstanceId": 0
}, {
"url": "/6/0",
"attributes": {},
"objectId": 6,
"objectInstanceId": 0
}],
"secure": false,
"additionalRegistrationAttributes": {}
}
But where are the attributes ?why it is null?
Thanks
Subhash
On Wed, Mar 9, 2016 at 3:24 PM, Simon Bernard <
contact@xxxxxxxxxxxxxxx> wrote:
The Leshan Java API expose a listener on ClientRegistry (as I explained before), so if you need PUSH notification you can implement it easily.
The examples[1] that I gave in my previous email, use this listener to push new registration/update/deregistration as a "Server-sent events"[2]. (This API is used by our demo UI [3])
Up to you to implement it with the technology adapted to your use case. (e.g. AMQP ..)
[1]
https://github.com/eclipse/leshan/blob/master/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/EventServlet.java
[2]
https://en.wikipedia.org/wiki/Server-sent_events
[3]
https://github.com/eclipse/leshan/blob/master/leshan-server-demo/src/main/resources/webapp/js/client-controllers.js#L88
Le 09/03/2016 07:08, Subhash Nair p a écrit :
Hi,
Thanks all for the suggestions.
To clarify more about my question- Many OMA DM servers will implement a PUSH Notification about the registration info to Enterprise Platforms so that Enterprises can easily integrate a external OMA DM server.
Similar way say Enterprise will have its on User interface to do Device management. An Enterprise Platform Connects to a Boot Strap Server and this server Provision the LwM2M field device to Register to a Leshan Server. And Once the registration is done ,Leshan should PUSH this Info to the Enterprise platform .
I understood from previous replies that either a Enterprise platform have to periodically poll the Lesahn or PULL the info from Leshan. But I think for Platform Integration point of view Leshan should have a PUSH Notification implementation.
thanks and regards
Subhash Nair
On Tue, Mar 8, 2016 at 10:57 PM, Simon Bernard <
contact@xxxxxxxxxxxxxxx> wrote:
Leshan is just java libraries which help people to develop their own Lightweight M2M server.
It only provides a Java API (for now).
In that case, the clean way should be to use Leshan to develop your Lightweight M2M server and implements your remote API. (e.g. using REST or any other protocols ...)
The leshan-server-demo is an example of this. You could have a look at ClientServlet[1] and EventServlet[2].
Simon
[1]
https://github.com/eclipse/leshan/blob/master/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/ClientServlet.java
[2]
https://github.com/eclipse/leshan/blob/master/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/EventServlet.java
Le 08/03/2016 18:07, Pablo Punal a écrit :
In that case you need to embedded leshan in your application. But if leshan is running in other machine. How can you use the API?
//pablo
-------- Original message --------
From: Simon Bernard <
contact@xxxxxxxxxxxxxxx>
Date: 3/8/2016 18:02 (GMT+01:00)
To: leshan developer discussions <
leshan-dev@xxxxxxxxxxx>
Subject: Re: [leshan-dev] Registration Listener
...
Please consider using the Leshan API instead of using this kind of hack.
// create a server
LeshanServer server = new LeshanServerBuilder().build();
server.start();
// get current registered clients
Collection<Client> allClients = server.getClientRegistry().allClients();
// be notified of new registration
server.getClientRegistry().addListener(new ClientRegistryListener() {
public void updated(Client client) {
}
public void unregistered(Client client) {
}
public void registered(Client newClient) {
System.out.println("New registration:" + newClient);
}
});
If you're limited by the current API please open an issue[1].
[1]
https://github.com/eclipse/leshan/issues/new
Le 08/03/2016 16:59, Pablo Punal a écrit :
Hi,
You can add a Simple CoAP resource on Leshan and request periodically (also you can implement it with observe).
Modify "leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/impl/RegisterResource.java” and add this:
@Override
public void handleGET(CoapExchange exchange) {
Request request = exchange.advanced().getRequest();
Collection<Client> clients = registrationHandler.clientRegistry.allClients();
ArrayList<JSONObject> clientsArray = new ArrayList<>();
Client client;
JSONObject json;
for(int i=0; i<clients.size(); i++) {
client = (Client)clients.toArray()[i];
json = new JSONObject();
json.put("endPoint", client.getEndpoint());
json.put("registrationId", client.getRegistrationId());
json.put("address", client.getAddress().toString());
json.put("port", client.getPort());
json.put("objectLinks", Arrays.toString(client.getObjectLinks()));
clientsArray.add(json);
}
String resp = clientsArray.toString();
exchange.respond(ResponseCode.CONTENT, resp, MediaTypeRegistry.APPLICATION_LINK_FORMAT);
}
Now you can request to Leshan server for connected devices. In this example you will receive this:
[