Hi Pablo The MiniPacketize.h file does not have a definition of AM_PAYLOAD which mig is looking for to create Payload.java. Instead there is AMTYPE_MINI. You can add another entry for AM_PAYLOAD = 0x51 right before AMTYPE_MINI in MiniPacketizer.h. Then regenerate Payload.java by doing the folowing
make -f jmakefile clean make -f jmakefile This might solve the message length problem. Shweta On Thu, 2 Feb 2006, Pablo Guerrero wrote: > Hi again Shweta, > > I tried your java code. As it was, it did not receive anything. I > figured out that the Active Message handler ID that my mote is > generating is 0x51 (81), so I changed the Payload class and recompiled > it. However, now I get the following message: > > receive error for net.tinyos.rfid.Payload (AM type 81): invalid length > message received (too short) > > I will keep looking at what can be wrong with the reader (perhaps a > malfunction). Do you have the version with or without buttons? > > Pablo > > Shweta Jain wrote: > > Hello Pablo, > > > > Did you send be a PDf attachment? I didnt receive it so not sure what your > > analysis is. The output from Listen is raw bytes and you need to convert > > them to appropriate integers of character values before you can work with > > it. The message interface file does that conversion for you making it easy > > to understand the output. > > > > Shweta > > > > On Thu, 2 Feb 2006, Pablo Guerrero wrote: > > > >> Hello Shweta, > >> thanks for the hints. I am currently inspecting the code you sent, I > >> appreciate it. In the meantime I sent you a pdf with my analysis of what > >> I was receiving with the Listen tool. Because still that is what I > >> receive, right? > >> > >> To make my scenario clearer: > >> > >> First Mote: > >> Mica2 with Skyetek M1Mini RFID reader attached (through a basic sensor > >> board MTS101CA). Running 'TestSkyeReadMini2_Poll'. > >> Should read tags' info and put it in the radio. > >> > >> Second Mote: > >> Mica2 attached to the programming board, running 'TOSBase'. > >> Should forward what receives through UART and put it in the radio and > >> viceversa. > >> > >> PC: > >> Running the java 'SerialForwarder' and 'Listen' programs. > >> > >> What software are you using in the first mote? > >> > >> I also have an xRFID but could not use it since some libs are missing :( > >> > >> Thanks > >> > >> Pablo > >> > >> > >> > >> Shweta Jain wrote: > >>> It is quite difficult to interpret the bit pattern via Listen. The best > >>> way to read the data sent by the motes is through a message > >>> interface file. Like the one I generated. (Payload.java attached). > >>> You can generate this file by running make -f jmakefile (jmakefile > >>> attached). Finally call the functions from your class file like > >>> in RFID.java that I wrote. You will get an error when compiling RFID.java > >>> because I hae modified the MoteIf constructor. You can look into > >>> MoteIf.java for a list of constructors that can be used. > >>> > >>> > >>> Shweta > >>> > >>> On Wed, 1 Feb 2006, Pablo Guerrero wrote: > >>> > >>>> Hi Shweta, > >>>> I am using the Skyetek's M1 mini. Or actually, trying to. It has been > >>>> really difficult for me to get it "working". Unfortunately I cannot > >>>> answer your question since I think it exceeds my knowledge about it. But > >>>> actually I thought I was one of the fewer guys who were using it. > >>>> > >>>> I was wondering if we could stay in touch and perhaps help each > >>>> other. May I ask you which software are you using with it? We bought our > >>>> skyetek M1 mini from crossbow, and their tech support provided me with > >>>> both the: > >>>> > >>>> \opt\tinyos-1.x\contrib\xbow\apps\SkyeReadMini2_MICA2\TestSkyeReadMini2, > >>>> and > >>>> \opt\tinyos-1.x\contrib\xbow\apps\SkyeReadMini2_MICA2\TestSkyeReadMini2_Poll > >>>> > >>>> I am using the 'poll' version since our reader doesn't have buttons. > >>>> That means it keeps polling the whole time. > >>>> > >>>> I can get the whole stuff working, by having a TOSBase mote attached to > >>>> a programming board and running the java app net.tinyos.tools.Listen, > >>>> however the bit pattern I get is quite weird... I don't really > >>>> understand it. Do you have any idea on how to interpret this bit > >>>> pattern? Or do you use some other application to do this? > >>>> > >>>> Looking forward to help and contribute, regards, > >>>> > >>>> > >>>> Pablo Guerrero > >>>> > >>>> Shweta Jain wrote: > >>>>> Hi all, > >>>>> > >>>>> I was wondering if anyone would know the voltage to db conversion > >>>>> formula > >>>>> for the RSSI value read from skyetek's M1 mini. > >>>>> > >>>>> > >>>>> Shweta > >>>>> _______________________________________________ > >>>>> Tinyos-help mailing list > >>>>> [email protected] > >>>>> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > >>> > >>> ------------------------------------------------------------------------ > >>> > >>> /** > >>> * This class is automatically generated by mig. DO NOT EDIT THIS FILE. > >>> * This class implements a Java interface to the 'Payload' > >>> * message type. > >>> */ > >>> > >>> package net.tinyos.rfid; > >>> > >>> public class Payload extends net.tinyos.message.Message { > >>> > >>> /** The default size of this message type in bytes. */ > >>> public static final int DEFAULT_MESSAGE_SIZE = 29; > >>> > >>> /** The Active Message type associated with this message. */ > >>> public static final int AM_TYPE = -1; > >>> > >>> /** Create a new Payload of size 29. */ > >>> public Payload() { > >>> super(DEFAULT_MESSAGE_SIZE); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** Create a new Payload of the given data_length. */ > >>> public Payload(int data_length) { > >>> super(data_length); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> * Create a new Payload with the given data_length > >>> * and base offset. > >>> */ > >>> public Payload(int data_length, int base_offset) { > >>> super(data_length, base_offset); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> * Create a new Payload using the given byte array > >>> * as backing store. > >>> */ > >>> public Payload(byte[] data) { > >>> super(data); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> * Create a new Payload using the given byte array > >>> * as backing store, with the given base offset. > >>> */ > >>> public Payload(byte[] data, int base_offset) { > >>> super(data, base_offset); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> * Create a new Payload using the given byte array > >>> * as backing store, with the given base offset and data length. > >>> */ > >>> public Payload(byte[] data, int base_offset, int data_length) { > >>> super(data, base_offset, data_length); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> * Create a new Payload embedded in the given message > >>> * at the given base offset. > >>> */ > >>> public Payload(net.tinyos.message.Message msg, int base_offset) { > >>> super(msg, base_offset, DEFAULT_MESSAGE_SIZE); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> * Create a new Payload embedded in the given message > >>> * at the given base offset and length. > >>> */ > >>> public Payload(net.tinyos.message.Message msg, int base_offset, int > >>> data_length) { > >>> super(msg, base_offset, data_length); > >>> amTypeSet(AM_TYPE); > >>> } > >>> > >>> /** > >>> /* Return a String representation of this message. Includes the > >>> * message type name and the non-indexed field values. > >>> */ > >>> public String toString() { > >>> String s = "Message <Payload> \n"; > >>> try { > >>> s += " [num=0x"+Long.toHexString(get_num())+"]\n"; > >>> } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } > >>> try { > >>> s += " [pidx=0x"+Long.toHexString(get_pidx())+"]\n"; > >>> } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } > >>> try { > >>> s += " [RID=0x"+Long.toHexString(get_RID())+"]\n"; > >>> } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } > >>> try { > >>> s += " [SG=0x"+Long.toHexString(get_SG())+"]\n"; > >>> } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } > >>> try { > >>> s += " [data="; > >>> for (int i = 0; i < 23; i++) { > >>> s += "0x"+Long.toHexString(getElement_data(i) & 0xff)+" "; > >>> } > >>> s += "]\n"; > >>> } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } > >>> return s; > >>> } > >>> > >>> // Message-type-specific access methods appear below. > >>> > >>> ///////////////////////////////////////////////////////// > >>> // Accessor methods for field: num > >>> // Field type: short, unsigned > >>> // Offset (bits): 0 > >>> // Size (bits): 8 > >>> ///////////////////////////////////////////////////////// > >>> > >>> /** > >>> * Return whether the field 'num' is signed (false). > >>> */ > >>> public static boolean isSigned_num() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return whether the field 'num' is an array (false). > >>> */ > >>> public static boolean isArray_num() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return the offset (in bytes) of the field 'num' > >>> */ > >>> public static int offset_num() { > >>> return (0 / 8); > >>> } > >>> > >>> /** > >>> * Return the offset (in bits) of the field 'num' > >>> */ > >>> public static int offsetBits_num() { > >>> return 0; > >>> } > >>> > >>> /** > >>> * Return the value (as a short) of the field 'num' > >>> */ > >>> public short get_num() { > >>> return (short)getUIntElement(offsetBits_num(), 8); > >>> } > >>> > >>> /** > >>> * Set the value of the field 'num' > >>> */ > >>> public void set_num(short value) { > >>> setUIntElement(offsetBits_num(), 8, value); > >>> } > >>> > >>> /** > >>> * Return the size, in bytes, of the field 'num' > >>> */ > >>> public static int size_num() { > >>> return (8 / 8); > >>> } > >>> > >>> /** > >>> * Return the size, in bits, of the field 'num' > >>> */ > >>> public static int sizeBits_num() { > >>> return 8; > >>> } > >>> > >>> ///////////////////////////////////////////////////////// > >>> // Accessor methods for field: pidx > >>> // Field type: short, unsigned > >>> // Offset (bits): 8 > >>> // Size (bits): 8 > >>> ///////////////////////////////////////////////////////// > >>> > >>> /** > >>> * Return whether the field 'pidx' is signed (false). > >>> */ > >>> public static boolean isSigned_pidx() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return whether the field 'pidx' is an array (false). > >>> */ > >>> public static boolean isArray_pidx() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return the offset (in bytes) of the field 'pidx' > >>> */ > >>> public static int offset_pidx() { > >>> return (8 / 8); > >>> } > >>> > >>> /** > >>> * Return the offset (in bits) of the field 'pidx' > >>> */ > >>> public static int offsetBits_pidx() { > >>> return 8; > >>> } > >>> > >>> /** > >>> * Return the value (as a short) of the field 'pidx' > >>> */ > >>> public short get_pidx() { > >>> return (short)getUIntElement(offsetBits_pidx(), 8); > >>> } > >>> > >>> /** > >>> * Set the value of the field 'pidx' > >>> */ > >>> public void set_pidx(short value) { > >>> setUIntElement(offsetBits_pidx(), 8, value); > >>> } > >>> > >>> /** > >>> * Return the size, in bytes, of the field 'pidx' > >>> */ > >>> public static int size_pidx() { > >>> return (8 / 8); > >>> } > >>> > >>> /** > >>> * Return the size, in bits, of the field 'pidx' > >>> */ > >>> public static int sizeBits_pidx() { > >>> return 8; > >>> } > >>> > >>> ///////////////////////////////////////////////////////// > >>> // Accessor methods for field: RID > >>> // Field type: int, unsigned > >>> // Offset (bits): 16 > >>> // Size (bits): 16 > >>> ///////////////////////////////////////////////////////// > >>> > >>> /** > >>> * Return whether the field 'RID' is signed (false). > >>> */ > >>> public static boolean isSigned_RID() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return whether the field 'RID' is an array (false). > >>> */ > >>> public static boolean isArray_RID() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return the offset (in bytes) of the field 'RID' > >>> */ > >>> public static int offset_RID() { > >>> return (16 / 8); > >>> } > >>> > >>> /** > >>> * Return the offset (in bits) of the field 'RID' > >>> */ > >>> public static int offsetBits_RID() { > >>> return 16; > >>> } > >>> > >>> /** > >>> * Return the value (as a int) of the field 'RID' > >>> */ > >>> public int get_RID() { > >>> return (int)getUIntElement(offsetBits_RID(), 16); > >>> } > >>> > >>> /** > >>> * Set the value of the field 'RID' > >>> */ > >>> public void set_RID(int value) { > >>> setUIntElement(offsetBits_RID(), 16, value); > >>> } > >>> > >>> /** > >>> * Return the size, in bytes, of the field 'RID' > >>> */ > >>> public static int size_RID() { > >>> return (16 / 8); > >>> } > >>> > >>> /** > >>> * Return the size, in bits, of the field 'RID' > >>> */ > >>> public static int sizeBits_RID() { > >>> return 16; > >>> } > >>> > >>> ///////////////////////////////////////////////////////// > >>> // Accessor methods for field: SG > >>> // Field type: int, unsigned > >>> // Offset (bits): 32 > >>> // Size (bits): 16 > >>> ///////////////////////////////////////////////////////// > >>> > >>> /** > >>> * Return whether the field 'SG' is signed (false). > >>> */ > >>> public static boolean isSigned_SG() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return whether the field 'SG' is an array (false). > >>> */ > >>> public static boolean isArray_SG() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return the offset (in bytes) of the field 'SG' > >>> */ > >>> public static int offset_SG() { > >>> return (32 / 8); > >>> } > >>> > >>> /** > >>> * Return the offset (in bits) of the field 'SG' > >>> */ > >>> public static int offsetBits_SG() { > >>> return 32; > >>> } > >>> > >>> /** > >>> * Return the value (as a int) of the field 'SG' > >>> */ > >>> public int get_SG() { > >>> return (int)getUIntElement(offsetBits_SG(), 16); > >>> } > >>> > >>> /** > >>> * Set the value of the field 'SG' > >>> */ > >>> public void set_SG(int value) { > >>> setUIntElement(offsetBits_SG(), 16, value); > >>> } > >>> > >>> /** > >>> * Return the size, in bytes, of the field 'SG' > >>> */ > >>> public static int size_SG() { > >>> return (16 / 8); > >>> } > >>> > >>> /** > >>> * Return the size, in bits, of the field 'SG' > >>> */ > >>> public static int sizeBits_SG() { > >>> return 16; > >>> } > >>> > >>> ///////////////////////////////////////////////////////// > >>> // Accessor methods for field: data > >>> // Field type: short[], unsigned > >>> // Offset (bits): 48 > >>> // Size of each element (bits): 8 > >>> ///////////////////////////////////////////////////////// > >>> > >>> /** > >>> * Return whether the field 'data' is signed (false). > >>> */ > >>> public static boolean isSigned_data() { > >>> return false; > >>> } > >>> > >>> /** > >>> * Return whether the field 'data' is an array (true). > >>> */ > >>> public static boolean isArray_data() { > >>> return true; > >>> } > >>> > >>> /** > >>> * Return the offset (in bytes) of the field 'data' > >>> */ > >>> public static int offset_data(int index1) { > >>> int offset = 48; > >>> if (index1 < 0 || index1 >= 23) throw new > >>> ArrayIndexOutOfBoundsException(); > >>> offset += 0 + index1 * 8; > >>> return (offset / 8); > >>> } > >>> > >>> /** > >>> * Return the offset (in bits) of the field 'data' > >>> */ > >>> public static int offsetBits_data(int index1) { > >>> int offset = 48; > >>> if (index1 < 0 || index1 >= 23) throw new > >>> ArrayIndexOutOfBoundsException(); > >>> offset += 0 + index1 * 8; > >>> return offset; > >>> } > >>> > >>> /** > >>> * Return the entire array 'data' as a short[] > >>> */ > >>> public short[] get_data() { > >>> short[] tmp = new short[23]; > >>> for (int index0 = 0; index0 < numElements_data(0); index0++) { > >>> tmp[index0] = getElement_data(index0); > >>> } > >>> return tmp; > >>> } > >>> > >>> /** > >>> * Set the contents of the array 'data' from the given short[] > >>> */ > >>> public void set_data(short[] value) { > >>> for (int index0 = 0; index0 < value.length; index0++) { > >>> setElement_data(index0, value[index0]); > >>> } > >>> } > >>> > >>> /** > >>> * Return an element (as a short) of the array 'data' > >>> */ > >>> public short getElement_data(int index1) { > >>> return (short)getUIntElement(offsetBits_data(index1), 8); > >>> } > >>> > >>> /** > >>> * Set an element of the array 'data' > >>> */ > >>> public void setElement_data(int index1, short value) { > >>> setUIntElement(offsetBits_data(index1), 8, value); > >>> } > >>> > >>> /** > >>> * Return the total size, in bytes, of the array 'data' > >>> */ > >>> public static int totalSize_data() { > >>> return (184 / 8); > >>> } > >>> > >>> /** > >>> * Return the total size, in bits, of the array 'data' > >>> */ > >>> public static int totalSizeBits_data() { > >>> return 184; > >>> } > >>> > >>> /** > >>> * Return the size, in bytes, of each element of the array 'data' > >>> */ > >>> public static int elementSize_data() { > >>> return (8 / 8); > >>> } > >>> > >>> /** > >>> * Return the size, in bits, of each element of the array 'data' > >>> */ > >>> public static int elementSizeBits_data() { > >>> return 8; > >>> } > >>> > >>> /** > >>> * Return the number of dimensions in the array 'data' > >>> */ > >>> public static int numDimensions_data() { > >>> return 1; > >>> } > >>> > >>> /** > >>> * Return the number of elements in the array 'data' > >>> */ > >>> public static int numElements_data() { > >>> return 23; > >>> } > >>> > >>> /** > >>> * Return the number of elements in the array 'data' > >>> * for the given dimension. > >>> */ > >>> public static int numElements_data(int dimension) { > >>> int array_dims[] = { 23, }; > >>> if (dimension < 0 || dimension >= 1) throw new > >>> ArrayIndexOutOfBoundsException(); > >>> if (array_dims[dimension] == 0) throw new > >>> IllegalArgumentException("Array dimension "+dimension+" has unknown > >>> size"); > >>> return array_dims[dimension]; > >>> } > >>> > >>> /** > >>> * Fill in the array 'data' with a String > >>> */ > >>> public void setString_data(String s) { > >>> int len = s.length(); > >>> int i; > >>> for (i = 0; i < len; i++) { > >>> setElement_data(i, (short)s.charAt(i)); > >>> } > >>> setElement_data(i, (short)0); //null terminate > >>> } > >>> > >>> /** > >>> * Read the array 'data' as a String > >>> */ > >>> public String getString_data() { > >>> char carr[] = new > >>> char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,23)]; > >>> int i; > >>> for (i = 0; i < carr.length; i++) { > >>> if ((char)getElement_data(i) == (char)0) break; > >>> carr[i] = (char)getElement_data(i); > >>> } > >>> return new String(carr,0,i); > >>> } > >>> > >>> } > _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
