Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] Observe Method Problem

Hi,

 

to call

 

void lwm2m_resource_value_changed(lwm2m_context_t * contextP,

                                  lwm2m_uri_t * uriP)

 

you need a "lwm2m_context_t *", which is the result of the initial call of

 

lwm2m_context_t * lwm2m_init(lwm2m_connect_server_callback_t connectCallback,

                             lwm2m_buffer_send_callback_t bufferSendCallback,

                             void * userData)

 

This is usually called during initialization (see „lwm2mclient/main.c“) and may be shared

via a global variable or set by calling specific user defined function into the different

modules after the lwm2m_init call.

                                                                                                             

Mit freundlichen Grüßen / Best regards

 

Achim Kraus

 

Bosch Software Innovations GmbH

Communications (INST/ESY4)

Stuttgarter Straße 130

71332 Waiblingen

GERMANY

www.bosch-si.de

www.blog.bosch-si.com

 

achim.kraus@xxxxxxxxxxxx

 

Registered office: Berlin, Register court: Amtsgericht Charlottenburg, HRB 148411 B

Executives: Dr.-Ing. Rainer Kallenbach; Michael Hahn

 

 

Von: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] Im Auftrag von Ugur Kirbac
Gesendet: Mittwoch, 22. Juli 2015 15:09
An: Wakaama developer discussions
Betreff: Re: [wakaama-dev] Observe Method Problem

 

Thanks for the quick reply,

Where should I use “lwm2m_resource_value_changed”? When I try to use it in object_temperature.c, I get a segmentation fault. I’m not sure how to get the context pointer “lwm2mH” inside object_temperature.c.

Any idea?

Thanks

From: "Kraus Achim (INST/ESY4)"
Reply-To: Wakaama developer discussions
Date: Wednesday 22 July 2015 13:53
To: Wakaama developer discussions
Subject: Re: [wakaama-dev] Observe Method Problem

 

Hi,

 

only changing the „float temperature“ is not detected by the wakaama core.

If you change a resource, you must call „lwm2m_resource_value_changed“

with the associated uri.

 

e.g.

 

        lwm2m_uri_t uri;

        if (lwm2m_stringToUri("/3/0/9", 6, &uri))

       {

                lwm2m_resource_value_changed(lwm2mH, uri);

        }

  

to inform the core about a battery level change (uri „/3/0/9“).

 

Mit freundlichen Grüßen / Best regards

 

Achim Kraus

 

Bosch Software Innovations GmbH

Communications (INST/ESY4)

Stuttgarter Straße 130

71332 Waiblingen

GERMANY

www.bosch-si.de

www.blog.bosch-si.com

 

achim.kraus@xxxxxxxxxxxx

 

Registered office: Berlin, Register court: Amtsgericht Charlottenburg, HRB 148411 B

Executives: Dr.-Ing. Rainer Kallenbach; Michael Hahn

 

 

Von: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] Im Auftrag von Ugur Kirbac
Gesendet: Mittwoch, 22. Juli 2015 12:07
An: wakaama-dev@xxxxxxxxxxx
Betreff: [wakaama-dev] Observe Method Problem

 

Hello,

I’m currently experimenting a Leshan server and Wakaama client. I have been trying to get Observe method working for Wakaama client however I couldn’t manage it so far. First, I tried to observe the device object and I haven’t seen any notification from Wakaama client to Leshan server. After that, I created two IPSO Objects and update the values using a timer because right now I don’t have any real sensor connected to the client so I’m kinda faking the resources.  

The code I used for updating is the below. 

 

 float temperature;

 

 void randomTemp(void){

    temperature = rand() % 10 + 20;

    

}

//fake accelerometer data producer starts//

#define INTERVAL 5000        /* number of milliseconds to go off */

 

void update(void) {

 

  struct itimerval it_val;  /* for setting itimer */

 

  /* Upon SIGALRM, call DoStuff().

   * Set interval timer.  We want frequency in ms, 

   * but the setitimer call needs seconds and useconds. */

  if (signal(SIGALRM, (void (*)(int)) randomTemp) == SIG_ERR) {

    perror("Unable to catch SIGALRM");

    exit(1);

  }

  it_val.it_value.tv_sec =     INTERVAL/1000;

  it_val.it_value.tv_usec =    (INTERVAL*1000) % 1000000;   

  it_val.it_interval = it_val.it_value;

  if (setitimer(ITIMER_REAL, &it_val, NULL) == -1) {

    perror("error calling setitimer()");

    exit(1);

  }

 

Is there any problem with Observe method in Wakaama client? Any suggestion?

 

I have also attached an image showing the CoAP Messages logs for Leshan server on the browser. 

 

Cheers

 


Back to the top