Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[leshan-dev] Fwd: Registration Listener

Dear Achim Kraus.
    Please   find the comments in lined..
---------- Forwarded message ----------
From: Kraus Achim (INST/ESY1) <Achim.Kraus@xxxxxxxxxxxx>
Date: Tue, Mar 29, 2016 at 1:36 PM
Subject: Re: [leshan-dev] Registration Listener
To: leshan developer discussions <leshan-dev@xxxxxxxxxxx>


Dear Subhash,

"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'm not sure, if we talking about Attributes defined in LWM2M TS, 5.1
or about Resources (LWM2M TS, 6).

Can you clarify this?

My point was  if a device register itself with a capability say /3  (Device ),   then server has no idea whether device support   /3/0/0, /3/0/1   and so on.  Server just know there is a device URI /3   and it has  to further query what are the sub objects under /3.  For example some device may support /3/0/9  and some may not.  So  My suggestion was why the device cannot do the uplink  of   this information as well at least for /3. 

For 5.1, thought right now attributes are just related to the "5.5 Information reporting interface",
I'm not sure, if such attributes could be already set before a registration.
See
https://github.com/OpenMobileAlliance/OMA-LwM2M-Public-Review/issues/71


"I earlier  read in this forum somebody requesting a spec change regarding this ."

Hm, is the leshan forum the right place to request changes of the OMA/LWM2M spec.?
I don't think so. In my opinion the above link to the OMA issue page would be a better place.

Sorry:   I read a similar request in another forum  on the OMA/LWM2M SPEC where the similar request was raised.


Mit freundlichen Grüßen / Best regards

Achim Kraus

Bosch Software Innovations GmbH
Communications (INST/ESY1)
Stuttgarter Straße 130
71332 Waiblingen
GERMANY
www.bosch-si.de
www.blog.bosch-si.com

Registered office: Berlin, Register court: Amtsgericht Charlottenburg, HRB 148411 B
Executives: Dr.-Ing. Rainer Kallenbach; Michael Hahn


Von: leshan-dev-bounces@xxxxxxxxxxx [mailto:leshan-dev-bounces@xxxxxxxxxxx] Im Auftrag von Subhash Nair p
Gesendet: Montag, 28. März 2016 06:16
An: leshan developer discussions
Betreff: Re: [leshan-dev] Registration Listener

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:

[
1. {
o "endPoint":"mulle-216",
o "address":"\/fdfd:0:0:0:0:0:0:1",
o "objectLinks":"[<\/1\/1>, <\/1\/2>, <\/2\/0>, <\/3\/0>, <\/4\/0>, <\/3311\/0>, <\/3311\/1>]",
o "port":5683,
o "registrationId":"3KnmBsPJ8T"
},
2. {
o "endPoint":"mulle-248",
o "address":"\/fdfd:0:0:0:f95e:73b7:a8e7:eeb0",
o "objectLinks":"[<\/1\/1>, <\/1\/2>, <\/2\/0>, <\/3\/0>, <\/4\/0>, <\/3311\/1>, <\/3311\/2>, <\/3311\/3>, <\/3311\/4>]",
o "port":5683,
o "registrationId":"YmDbZUBAph"
}
]

I implement this on one SCADA system that you can look at: https://github.com/punyal/BlackHole
The code to sniff new devices is at: https://github.com/punyal/BlackHole/blob/master/src/main/java/com/punyal/blackhole/core/net/lwm2m/LWM2Msniffer.java

I hope this help you.

________________________________________
Pablo Puñal Pereira
pablo.punal@xxxxxx






-------- Forwarded Message --------
Subject:
Re: [leshan-dev] Registration Listener
Date: 
Tue, 8 Mar 2016 11:56:02 +0100
From: 
Simon Bernard <contact@xxxxxxxxxxxxxxx>
Reply-To:
leshan developer discussions <leshan-dev@xxxxxxxxxxx>
To: 
leshan developer discussions <leshan-dev@xxxxxxxxxxx>


You should have a look at ClientRegistry[1] and ClientRegistryListener[2]

[1]https://github.com/eclipse/leshan/blob/master/leshan-server-core/src/main/java/org/eclipse/leshan/server/client/ClientRegistry.java
[2]https://github.com/eclipse/leshan/blob/master/leshan-server-core/src/main/java/org/eclipse/leshan/server/client/ClientRegistryListener.java
Le 08/03/2016 11:08, Subhash Nair p a écrit :
Hi ,

    I have an idea about using Leshan as Device management server .My Platform does not have a Device Management Capability and so  I am looking for a ways where I can keep Leshan as an external entity to which I can redirect the DM operations.

Whenever  LWM2M  clients are getting registered to the Leshan server  I am looking for a mechanism like where I would implement a Registration Listener in my platform ,   and Leshan will notify this Listener about the registered client and its capabilities.
    
   Such kind of Notification service is there currently.?

Thanks in advance for the advcie .


Regards
Subhash Nair

_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev


<Attached Message Part.txt>


_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev


_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev


_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev


_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev


_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev

_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev

_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev

_______________________________________________
leshan-dev mailing list
leshan-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/leshan-dev


Back to the top