Dear List,

In my application I have several types of messages, and to handle that, I have 
one general struct:
/typedef nx_struct GenericMsg {
     nx_uint8_t msgID;
     nx_uint8_t msgLen;
     nx_uint8_t msgPayload[0];
}GenericMsg;/
Other messages are casted to the msgPayload variable, and sent over radio with 
given length. Between motes, this works, when I send for example a 
CounterMsg casted into msgPayload, motes can read all the values, leds are 
shining. Now I want to receive this kind of message structure in Java, 
using MIG.

Problem: with msgPayload[0], I receve only msgID and msgLen. After checking the 
mig generated GenericMsg.java, I'm aware of the reason, the size of 
message is hardcoded and every array indexes are set according to 
DEFAULT_MESSAGE_SIZE.
So I tried to set GenericMsg with msgPayload[TOSH_DATA_SIZE-2], and now I have 
the error:
/receive error for GenericMsg (AM type 1): invalid length message received (too 
short)/

Again, checked the reason, net.tinyos.message.Receiver.java throws this, if 
dataGet().length > msg.get_header_length();

Now I'm pretty much lost, and hoping that one of you already dealt with this 
kind of problem, and can say me a few magic words about the solution.

Thanks for your assistance!
Viktor
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to