Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [leshan-dev] Observing a reource on a device on registration is not working.

Thanks for the response Simon !

The LeshanClientExample uses LeshanClient and it works perfectly for it ! But not with the real device. I will work with the embedded team to try a few more things and if there is an update will post it here.

 

From: Simon Bernard <contact@xxxxxxxxxxxxxxx>
To: Joey Smith <talkjoey@xxxxxxxxx>; leshan developer discussions <leshan-dev@xxxxxxxxxxx>
Sent: Friday, November 6, 2015 2:22 AM
Subject: Re: [leshan-dev] Observing a reource on a device on registration is not working.

Hi,
  There is long discussion about that here.
  This is clearly not really clean that we send the observe request before sending the CREATED response for the REGISTER request, but we don't find any correct solution to fix that :/.
  Anyway,  as the response is not acknowledgeable and as UDP can not guarantee package order, clients should support this "bad behavior". Here you could find a discussion from Wakaama.
  (I'm not sure to understand if this works with the LeshanClient. If not we should fix that at client side. Could you confirm that ?)
  A possible workaround at server side, is to send the observe request asynchronously few second later ... :s !

  HTH
Simon

Le 06/11/2015 01:22, Joey Smith a écrit :


Hi,
I want to observe a resource on a device. I have implemented it such that when a client registers with the server it starts observing that resource. I updated code in LeshanServer.java as follows :

     // Cancel observations on client unregistering
        this.clientRegistry.addListener(new ClientRegistryListener() {
            @Override
            public void updated(final Client clientUpdated) {
            }
            @Override
            public void unregistered(final Client client) {
                SandCLeshanServer.this.observationRegistry.cancelObservations(client);
            }
            @Override
            public void registered(final Client client) {
                observeResource(client);
            }
        }); 

    private void observeResource(final Client client){
        ObserveRequest request = new ObserveRequest("/500/10/0");
        ObserveResponse cResponse = this.send(client, request);
        LOG.debug("cResponse : " + cResponse);
        cResponse.getObservation().addListener(new ObservationListener() {
            @Override
            public void cancelled(Observation observation) {
                LOG.debug("Observation Cancelled ....");
            }
            @Override
            public void newValue(Observation observation, LwM2mNode value) {
                writeToFile(observation, value);
            }
        });
    }

I updated the oma-objects-spec.json file and the device too has a resource with that id.

This all works fine with ClientExample. But now that the actual device is ready to talk to the server, I am not able to observe the resource.

I see this in the logs :
cResponse : ObserveResponse [code=NOT_FOUND, errormessage=]

I have used wireshark to find out what is going on with the request. My guess is that, the client is waiting for an ACK from the server that it has been registered. But before it gets this ACK it gets an ObserveRequest instead. And does not accept the ObserveRequest. Is that correct ?

If that is the case, which would be a good place to start observing a resource on a device after the client has registered?

Thanks


_______________________________________________
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