Ok. I resolved my query myself. My solution:

Here is my RadioCountToLeds.h code:

#ifndef RADIO_COUNT_TO_LEDS_H
#define RADIO_COUNT_TO_LEDS_H

typedef nx_struct radio_count_msg {
  nx_uint16_t counter;
nx_uint16_t senderId;
} radio_count_msg_t;

enum {
  AM_RADIO_COUNT_MSG = 6,
};

And then I used below line in RadioCountToLedsC.nc file to receive the address:

senderId = (am_addr_t) call AMPacket.source(&packet);


What I assume from my solution is that, nesc does not accept nx_am_addr_t type 
in header file, though "am_addr_t type is just an uint16_t"(copied from this 
link: 
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2007-January/022030.html.



Please correct me if my understanding is wrong.

Thanks.
Jenis

From: tinyos-help-boun...@millennium.berkeley.edu 
[mailto:tinyos-help-boun...@millennium.berkeley.edu] On Behalf Of Modi, Jenis 
Ashokkumar
Sent: Tuesday, August 28, 2012 12:53 PM
To: tinyos-help@millennium.berkeley.edu
Subject: [Tinyos-help] Error and Warning while trying to get packet address

Hi All,

I am trying to get packet address using AMPacket.source(&packet) in 
apps/RadioCountToLeds application.

Here is my RadioCountToLeds.h code:

#ifndef RADIO_COUNT_TO_LEDS_H
#define RADIO_COUNT_TO_LEDS_H

typedef nx_struct radio_count_msg {
  nx_uint16_t counter;
nx_am_addr_t senderId;
} radio_count_msg_t;

enum {
  AM_RADIO_COUNT_MSG = 6,
};

And then I use below line in RadioCountToLedsC.nc file to receive the address:

am_addr_t senderId = call AMPacket.source(&packet);

I get the following error when I compile my application with telosb:

RadioCountToLeds.h:46: syntax error before `nx_am_addr_t'
RadioCountToLeds.h:46: warning: no semicolon at end of struct or union
RadioCountToLeds.h:48: warning: data definition has no type or storage class
failed to parse message file RadioCountToLeds.h
make: *** [RadioCountMsg.py] Error 1


Can anybody help me out, what am I doing wrong? And why I am getting this error?

Thanks.
Jenis

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to