Dear Gnawali and all,

I really need a good Link Estimation that works on many different
platforms (e.g. Telosb, mica2, micaz etc). It will be good to have a 4-bit
link estimation that is reliable.
I have tried to use the LinkEstimation interface however, it always return
same 255 value. Can someone please guide me that what I am doing wrong? I
really appreciate your help.

Here is the code.

+++++++++++++ LinkEstTestC.nc ++++++++++++
#include <Timer.h>
#include "printf.h"

module LinkEstTestC {
  uses interface Boot;
  uses interface SplitControl as RadioControl;
  uses interface StdControl as LEStart;
  uses interface Leds;
  uses interface LinkEstimator;
  uses interface Timer<TMilli>;
}

implementation {

  event void Boot.booted() {
    call RadioControl.start();
  }

  event void RadioControl.startDone(error_t err) {
    if (err != SUCCESS) {
      call RadioControl.start();
    } else {
      call LEStart.start();
      call Timer.startPeriodic(2000);
    }
  }

  event void RadioControl.stopDone(error_t err) {}

  event void Timer.fired() {
      uint16_t linkQuality = call LinkEstimator.getLinkQuality(5);
      printf("LinkQ = %u \n", linkQuality);
      call Leds.led2Toggle();
      printfflush();
  }

  event void LinkEstimator.evicted(am_addr_t neighbor) {}
}

+++++++++++++++++ LinkEstTestAppC.nc ++++++++++++
configuration LinkEstTestAppC {}
implementation {
  components LinkEstTestC, MainC, LedsC, ActiveMessageC;
  components new TimerMilliC(), LinkEstimatorP;

  LinkEstTestC.Boot -> MainC;
  LinkEstTestC.RadioControl -> ActiveMessageC;
  LinkEstTestC.Leds -> LedsC;
  LinkEstTestC.Timer -> TimerMilliC;
  LinkEstTestC.LEStart -> LinkEstimatorP;
  LinkEstTestC.LinkEstimator -> LinkEstimatorP;
}

+++++++++++++++++++++ Makefile ++++++++++++++++++++
COMPONENT=LinkEstTestAppC
CFLAGS += -I$(TOSDIR)/lib/printf \
          -I$(TOSDIR)/lib/net \
          -I$(TOSDIR)/lib/net/le \
          -I$(TOSDIR)/lib/net/ctp
include $(MAKERULES)


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to