Thread: Receive and read data in wireless mote communication

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    2

    Receive and read data in wireless mote communication

    Hi, I'm doing a project in which interchange packets between sensors, but I don't know how I can take the data from a packet with the interface ReceiveMsg.

    I get the package so:
    Code:
    event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr msg){
    	call Leds.redToggle();
    	return msg;
    	}
    The struct of the packet is this:
    Code:
    typedef struct XSensorHeader{
      uint8_t  board_id;
      uint8_t  packet_id; // 3
      uint8_t  node_id;
      uint8_t  rsvd;
    }__attribute__ ((packed)) XSensorHeader;
    
    typedef struct PData1 {
      uint16_t vref;
      uint16_t thermistor;
      uint16_t light;
      uint16_t mic;
      uint16_t accelX;
      uint16_t accelY;
      uint16_t magX;
      uint16_t magY;
      uint16_t constante;
      } __attribute__ ((packed)) PData1;
    
    typedef struct XDataMsg {
      XSensorHeader xSensorHeader;
      union {
      PData1    datap1;
      }xData;
    } __attribute__ ((packed)) XDataMsg;
    I have to do, for example, if I want take the data of light of the message I get.

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Huh?

    > call Leds.redToggle();
    This isn't even valid C or C++ code.

    What kind of interface (USB/Ethernet/Other)

    What is at each end - PC / target board (state make/model).

    What compilers are you using? What operating system(s) are involved.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    2
    I use nesC for TinyOS platform. TinyOS is an operating environment designed to run on embedded devices used in distributed Wireless Sensor Networks. nesC is built as an extension to the C programming language with components "wired" together to run applications on TinyOS.

    I use IRIS motes for the wireless sensor network.

    I use the compiler Programmers Notepad 2. And Windows XP operating system.



    I hope this clarifies your questions.

  4. #4
    Registered User
    Join Date
    Dec 2010
    Posts
    1
    do you slove this problem

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to read data from 15 pin connection?
    By Euphorica in forum Networking/Device Communication
    Replies: 0
    Last Post: 06-27-2008, 03:38 PM
  2. Replies: 3
    Last Post: 04-18-2008, 10:06 AM
  3. Replies: 3
    Last Post: 02-29-2008, 01:29 PM
  4. Serial communication packets
    By Roaring_Tiger in forum C Programming
    Replies: 3
    Last Post: 04-26-2003, 08:33 AM
  5. WSASend & WSARecv :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-16-2002, 05:51 PM