| 
 
Thanks again Achim, 
I have done already exactly what you suggested but the problem is that when I create the lwm2m_context_t * after initialization and pass it to  lwm2m_resource_value_changed through a global
 variable, the segmentation fault occurs in the method below.  targetP = contextP->observedList; is basically NULL. 
 
static obs_list_t * prv_getObservedList(lwm2m_context_t * contextP, 
                                        lwm2m_uri_t * uriP) 
{ 
    obs_list_t * resultP; 
    lwm2m_observed_t * targetP; 
 
    resultP = NULL; 
 
    targetP = contextP->observedList; 
    if (targetP!=NULL) 
    { fprintf(stderr, “targetP is not NULL: %s \n",targetP->uri.objectId); 
        /* code */ 
    } 
    else fprintf(stderr, "targetP is NULL\n"); 
     
    fprintf(stderr, "%s ObjectID: \n",targetP->uri.objectId); 
 … 
 
 
Any suggestion about it?  
 
Thanks 
 
From: "Kraus Achim (INST/ESY4)"Reply-To: Wakaama developer discussions
 Date: Wednesday 22 July 2015 17:09
 To: Wakaama developer discussions
 Subject: 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       
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. 
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       
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.  
    temperature = rand() % 10 + 20; 
//fake accelerometer data producer starts// 
#define INTERVAL 5000        /* number of milliseconds to go off */ 
  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"); 
  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()"); 
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.  |