Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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

Attachment: Screen Shot 2015-07-22 at 13.01.25.png
Description: Screen Shot 2015-07-22 at 13.01.25.png


Back to the top