Hello!

I am trying to make a node send a data packet to another node, but i cannot
figure out how i can achieve this..

For example, I have created a struct:

typedef nx_struct msg_send_temp {
 uint8_t msg_type;
 uint8_t temp
} msg_send_temp_t;

I try to send it with the help of Packet, and AMSend interfaces like this:

 void msg_send_temp(am_addr_t XXXXX) {
  msg_send_temp_t* pkt = (msg_send_temp_t*)call Packet.getPayload(&packet,
sizeof(msg_send_temp_t));
  if(pkt == NULL){
     return;
  }
  pkt->msg_type = (uint8_t)SEND_TEMP_MSG;
  pkt->temp = node_temp;
  call AMSend.send(XXXXX, &packet, sizeof(msg_send_temp_t));
  dbg("NodeC","Temp information sent, node id = %hu.\n", node_id);
  return;
 }

The XXXXX written above, is supposed to be an am_addr_t of the other node,
whose am_addr_t needs to be taken from a Receive function like this:

 event message_t * Receive.receive(message_t * msg, void * payload, uint8_t
len){
  if(len == sizeof(msg_request_temp_t)){
  msg_request_temp_t* pkt = (msg_request_temp_t*)payload;
  if (pkt->msg_type == REQUEST_IS_HEAD_MSG){
  msg_send_temp(XXXXX);   //Here i should try to get the  msg's am_addr_t..
  }
  return msg;
  }


However, i cannot figure out how to take the address of the source node, to
correctly pass it to the msg_send_temp(am_addr_t) function..

Can i use simultaneously both the AMPacket and the Packet interface?

Thank you in advance for your time,

Artemis Voulkidis

National Technical University of Athens
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to