Hi,

I have been struggling for days trying to tunnel a CTP header over serial
and receive the header in Java. I have just modified the
MultihopOscilloscope program. Here is my code:

The base node of a CTP network receives packets and forwards them on serial
as follows:

event message_t* Receive.receive(message_t* msg, void* payload, uint8_t
len) {
ctp_data_header_t* in = (ctp_data_header_t*) payload;
ctp_data_header_t* out;
out = (ctp_data_header_t*) call SerialSend.getPayload(&uartbuf,
sizeof(ctp_data_header_t));
memcpy(out, in, sizeof(ctp_data_header_t));
uartlen = sizeof(ctp_data_header_t);
call SerialSend.send(0xffff, &uartbuf, uartlen);
return msg;
}

The Java program running on the PC tries to capture the headers as follows:

public class HeaderReceiver implements MessageListener {

MoteIF mote;

void run() {
mote = new MoteIF(PrintStreamMessenger.err);
mote.registerListener(new CtpDataHeader(), this);
}

synchronized public void messageReceived(int dest_addr, Message msg) {
//never called.
}
}

The *CtpDataHeader* class was created with MIG.

Any thoughts on what I am doing wrong?

Thanks a million,

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

Reply via email to