David, The PacketTransmitPower interface also provides a command like "isValid", so you have to call that first. If that returns FALSE (most probably) then you did not set the transmit power of he outgoing message before calling send().
Miklos On Mon, Jul 27, 2009 at 9:23 PM, David Li<[email protected]> wrote: > Hello, > > I am modifying RssiDemo to read tx power values in addition to rssi values. > What I did was: > > 1. added a field in the RssiMsg: > > typedef nx_struct RssiMsg{ > nx_int16_t rssi; > nx_uint16_t tx_power_reading; //new > } RssiMsg; > > > 2. read the tx power on the SendingMote: > > event void SendTimer.fired(){ > > RssiMsg* buf = (RssiMsg*)(call RssiMsgSend.getPayload(&msg, > sizeof(RssiMsg))); > > tx_power = call PacketTransmitPower.get(&msg); /*new*/ > buf->tx_power_reading = tx_power; /*new*/ > > call RssiMsgSend.send(AM_BROADCAST_ADDR, &msg, sizeof(RssiMsg)); > } > > 3. In java code (after make), print out the tx power: > > public void messageReceived(int to, Message message) { > RssiMsg msg = (RssiMsg) message; > int source = message.getSerialPacket().get_header_src(); > System.out.println("Rssi Message received from node " + source + > ": Rssi = " + msg.get_rssi() + > ": Tx power = " + msg.get_tx_power_reading()); /*new*/ > } > > > So everything was compiled and installed ok. But the tx power output is > always 0 even it's actually should be 0xF as defined by > tos/platform/iris/chips/rf230/HplRF230.h. > > > Any idea? > > David > > > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
