Yeah,

You are on the right track. However, since you are not changing the
power level for the outgoing packet, only query it, this information
will not be very interesting, as it will always return the default tx
power level as defined by RF230_DEF_RFPOWER, which is always 0. I
assumed that you want to dynamically change the TX power level for
outgoing packets. (Just to clarify, I assume you really wanted to get
the tx power level and not the received RSSI signal, right?)

Miklos

On Fri, May 22, 2009 at 8:20 PM, David Li <[email protected]> wrote:
>
> 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 <[email protected]>
> wrote:
>>
>> Hi David,
>>
>> On Thu, May 21, 2009 at 2:57 AM, David Li <[email protected]> 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
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to