Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] The Observe functionality

David,

Thanks for the reply indeed.

This does the trick, this works nice now. 

Summary of what I did:  I added a process (pthread) within the client that operates on the contents of a resource. Every time when the resource gets an update (e.g. time, or temperature), the function lwm2m_resource_value_changed() is called with the arguments lwm2mH defined in main(), and the uri which can be composed using the function lwm2m_stringToUri() to point to the resource. After the lwm2m Leshun server invocation to observe the resource, I get an update every minute.  This is not in the frequency of the actual resource update which is fine.

Thanks and regards,

    - Dirk Gooris


On 10-8-2016 10:54, Navarro, David wrote:

Hi Dirk,

 

It seems you are not looking in the right place. If you modify a resource value (like the one representing the current time), you have to call lwm2m_resource_value_changed() and that’s it.

 

Prv_change() is part of the example client and is just one of the callbacks for the command-line interface. It is called when the user enters the command “change” in the prompt.

 

Regards,

David Navarro

 

From: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] On Behalf Of Dirk Gooris
Sent: Tuesday, 9 August, 2016 18:15
To: wakaama-dev@xxxxxxxxxxx
Subject: [wakaama-dev] The Observe functionality

 

Team,

I am using the Wakaama client and register it to the Leshun server. I have object 1024, and within that an instance with a resource that represents the current time.
Within the client I made a small change so that the time gets renewed every few seconds. The function prv_change() is called with the appropriate Uri of that resource.

At Leshun, I press the 'Observe' button for that resource. I expect to see Non-Confirmable messages going to the server to update the selected resource, but they are absent.

I did some investigation why it does not work, and I think I found the reason.  It seems that when the function prv_change() is being called, the lwm2mH gets an entirely new assignment of the lwm2m_context, while during the receiving action of the Observe request, the Uri was saved in the structure which was active at that moment. This means that the observed Uri is in the observedList, but is not being used when the prv_change() function becomes in use.  It takes a new, and empty lwm2m_context structure.
To test my idea's I store the contextP pointer in a global variable GLcontextP in function observe_step(). When the prv_change() function is called, it validates whether the GLcontextP is valid (defined before) and it proceeds with that one instead of assigning it locally. In this way, the previous defined contextP is in use with the observedList. Then I do get the Non-Confirmables every one minute.

Since Wakaama is quite stable and is out there for a while, It could well be that I am totally wrong in my interpretation how the Observe function should work, please apologize if so.

So, my Q is whether the Observe function works as it should with the current release (Aug 2016), or should it have some attention in this area ?

Thank you in advance and regards,

    - Dirk Gooris

Trace of CoAP after my change:
3.3052101  127.0.0.1 56830  127.0.0.1 5683   CoAP CON, MID:33237, POST, TKN:d5 81 59 e1, /rd?ep=myclient&b=U&lt=300
3.3158532  127.0.0.1 5683   127.0.0.1 56830  CoAP ACK, MID:33237, 2.01 Created, TKN:d5 81 59 e1
24.583735  127.0.0.1 5683   127.0.0.1 56830  CoAP CON, MID:53186, GET, TKN:2b c6 66 09 e2 15, /1024/1
24.584105  127.0.0.1 56830  127.0.0.1 5683   CoAP ACK, MID:53186, 2.05 Content, TKN:2b c6 66 09 e2 15
65.006014  127.0.0.1 5683   127.0.0.1 56830  CoAP CON, MID:53187, GET, TKN:52 b3 51 e4, /1024/1/5
65.006423  127.0.0.1 56830  127.0.0.1 5683   CoAP ACK, MID:53187, 2.05 Content, TKN:52 b3 51 e4 (text/plain)
125.06626  127.0.0.1 56830  127.0.0.1 5683   CoAP NON, MID:33238, 2.05 Content, TKN:52 b3 51 e4 (text/plain)
185.12648  127.0.0.1 56830  127.0.0.1 5683   CoAP NON, MID:33239, 2.05 Content, TKN:52 b3 51 e4 (text/plain)
245.12912  127.0.0.1 56830  127.0.0.1 5683   CoAP NON, MID:33240, 2.05 Content, TKN:52 b3 51 e4 (text/plain)

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



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


Back to the top