Hi,

I was finally able to solve the "MsgReader" issue as I was trying to build a 
"TestNetworkMsg.java" and try to see just that structure. Earlier I could just 
use the Listen tool and correctly see the Serial Frame. The problem was that my 
"SerialAMSenderC" had [CL_TEST] as the Active message type... whereas it should 
have been AM_TESTNETWORKMSG as "SerialAMSenderC[AM_TESTNETWORKMSG]", so once I 
changed to this, I started receiving the messages as:

 

$ java net.tinyos.tools.MsgReader TestNetworkMsg

[EMAIL PROTECTED]:57600: resynchronising

1216087012968: Message <TestNetworkMsg>

  [source=0x1]

  [seqno=0x15]

  [parent=0x3]

  [metric=0x1ee]

  [eventdata=0x3]

  [hopcount=0x0]

  [sendCount=0x101]

  [sendSuccessCount=0xf400]

 

 

BUT NOW the problem is that the data I am getting is firstly the ctp_header:

 

typedef nx_struct {

  nx_ctp_options_t    options;

  nx_uint8_t          thl;

  nx_uint16_t         etx;

  nx_am_addr_t        origin;

  nx_uint8_t          originSeqNo;

  nx_collection_id_t  type;

  nx_uint8_t          data[0];

} ctp_data_header_t;

 

 

As the SerialPacket is

 

typedef nx_struct serial_packet {

  serial_header_t header;

  nx_uint8_t data[];

} serial_packet_t;

 

And the data[] part in the "TestNetwork application" consists of  the 
ctp_header and then the TestNetworkMsg

 

Using the Listen tool, I get and output as:

 

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 - Ctp Header

00 06 00 04 01 F4 00 19 00 06 00 00 00 00 00 - TestNetworkMsg

 

My makefile looks like this:

 

BUILD_EXTRA_DEPS += TestNetwork.class

CLEAN_EXTRA = *.class TestNetworkMsg.java

                

TestNetwork.class: $(wildcard *.java) TestNetworkMsg.java

                javac *.java

 

TestNetworkMsg.java:

                mig java -target=null -java-classname=TestNetworkMsg 
../TestNetwork.h TestNetworkMsg -o $@

                

I know that I somehow need to tell here that it needs to take the ctp_header as 
well into consideration while building the TestNetworkMsg.java file.  Can 
anyone suggest how can I do that?

 

If I go and change the automatically mig generated TestNetworkMsg.java file, 
then I get the correct data but I have to modify the TestNetwork file as marked 
in RED:

 

// Message-type-specific access methods appear below.

 

    /////////////////////////////////////////////////////////

    // Accessor methods for field: source

    //   Field type: int, unsigned

    //   Offset (bits): 0 --à 64

    //   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 (64 / 8);

    }

 

    /**

     * Return the offset (in bits) of the field 'source'

     */

    public static int offsetBits_source() {

        return 64;

    }

 

    /**

     * 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;

    }

 

I hope I was able to explain the issue......

 

Cheers,

 

Varun Jain

 

 

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

Reply via email to