Hi,
I am currently running the "TestNetwork" application with 4 nodes. Using
the Listen tool, I am getting the following data:
00 FF FF F4 01 17 00 05 00 01 00 19 00 06 04 EE 00 06 00 04 01 F4 00 19
00 06 00 00 00 00 00
00 FF FF F4 01 17 00 05 - Serial Header
00 01 00 19 00 06 04 EE - CtpDataMsg (1st part of payload)
00 06 00 04 01 F4 00 19 00 06 00 00 00 00 00 - TestNetworkMsg (2nd part
of payload)
The data that I am getting is correct but I want to generate two java
files using 'mig' such that I have a TestNetworkMsg and CtpDataMSg.java
file so that I can use "MsgReader" tool.
My Makefile looks as follows:
--------------------------------Makefile--------------------------------
---------------------
TestNetwork.class: $(wildcard *.java) TestNetworkMsg.java
CtpDataMsg.java
javac *.java
TestNetworkMsg.java:
mig java -target=null -java-classname=TestNetworkMsg
../TestNetwork.h TestNetworkMsg -o $@
CtpDataMsg.java:
mig java -target=null -java-classname=CtpDataMsg
-I$(TOSDIR)/lib/net/ctp/Ctp.h ctp_data_header_t -o $@
I am getting error while generating CtpDataMsg but I am able to generate
the TestNetworkMsg.java and .class file if I comment out the CtpDataMsg
part. Though, TestNetworkMsg file also has problem. A part of the file
looks like this:
/////////////////////////////////////////////////////////
// Accessor methods for field: source
// Field type: int, unsigned
// Offset (bits): 0
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'source' is signed (false).
*/
public static boolean isSigned_source() {
return false;
}
/**
* Return whether the field 'source' is an array (false).
*/
public static boolean isArray_source() {
return false;
}
/**
* Return the offset (in bytes) of the field 'source'
*/
public static int offset_source() {
return (0 / 8);
}
/**
* Return the offset (in bits) of the field 'source'
*/
public static int offsetBits_source() {
return 0;
}
/**
* Return the value (as a int) of the field 'source'
*/
public int get_source() {
return (int)getUIntBEElement(offsetBits_source(), 16);
}
/**
* Set the value of the field 'source'
*/
public void set_source(int value) {
setUIntBEElement(offsetBits_source(), 16, value);
}
/**
* Return the size, in bytes, of the field 'source'
*/
public static int size_source() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'source'
*/
public static int sizeBits_source() {
return 16;
}
The problem I think is that the received message's payload that is sent
to the UART has two parts, Ctp_data_header and TestNetworkMsg, so when I
try to read the TestNetworkMsg, it gives me the values of the
ctp_data_header. After generating the TestNetworkMsg.java file, If I
change the offset values manually from 0 to 64 for the source and
correspondingly for other variables such as:
public static int offset_source() {
return (0 -> 64 / 8); }
then I get the correct data which is understandable because actually the
TestNetworkMsg starts at bit-64 in the payload.
My query is how can I generate the TestNetworkMsg USING MIG such that it
starts from bit-64 (of the serial payload) and consequently generate a
CtpDataMsg file to access the first 8 bytes of the serial's payload.
Thanks,
Varun Jain
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help