Hi Miklos,

Since I am new to the nesC programming this is my pseudo code to implement
this. Can you help to see I am on the right track? The lines with //new are
mine.

Thanks.


Oscilloscope.h:
===========

typedef nx_struct oscilloscope {
  .....
  nx_uint8_t tx_power; //new

} oscilloscope_t;



OscilloscopeAppC.nc:
===============

...
implementation
{
    components ..., RF230ActiveMessageC... //new

    Oscillosope.RF230ActiveMessageC ->RF230ActiveMessageC; //new
}

OscilloscopeC.nc:
===========
module OscilloscopeC
{
    uses{.... RF230ActiveMessageC...};   //new

}
implementation
{

...
uint_8_t tx_power_reading = 0;    //new
....

 event void Timer.fired() {
    if (reading == NREADINGS)
      {
    if (!sendBusy && sizeof local <= call AMSend.maxPayloadLength())
      {
        // Don't need to check for null because we've already checked length
        // above

        tx_power_reading =
RF230ActiveMessageC.PacketTransmitPower.get(&sendBuf); //new
            local.tx_power = tx_power_reading;     //new

        memcpy(call AMSend.getPayload(&sendBuf, sizeof(local)), &local,
sizeof local);

        if (call AMSend.send(AM_BROADCAST_ADDR, &sendBuf, sizeof local) ==
SUCCESS)
          sendBusy = TRUE;
      }
}



On Wed, May 20, 2009 at 10:55 PM, Miklos Maroti <mmar...@math.u-szeged.hu>wrote:

> Hi David,
>
> On Thu, May 21, 2009 at 2:57 AM, David Li <w.david...@gmail.com> wrote:
> >
> > Thanks.
> >
> > I think I got the idea. One missing piece is how to read the Tx power. Do
> > you have an interface to recommend?
>
> PacketTransmigtPower provided by RF230ActiveMessageC.
>
> Miklos
>
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to