Hi.

I'm using Drip to inject packets in a network of tmotes. I hadn't had any problem so far, but now I'm trying to send a message which is a bit mor complex. The structure of the packet is:


typedef struct DripChannelMsg{
    uint8_t nChannels;
    ChannelDesc_t channel[MAX_CHANNELS];
}DripChannelMsg_t;

At the moment, MAX_CHANNELS=1
The structure ChannelDesc is:

typedef struct ChannelDesc{
    uint8_t channelId;
    uint8_t groupType;
    uint16_t groupId;
    uint8_t attrName;
    uint8_t period;               
}ChannelDesc_t;

I have monitored the packets with TOSBase and the motes send one byte more than usual: they put one byte 0x00 after the field nChannels in the structure DripChannelMsg_t . However, if I generate a java class for this type of packet with mig and use it as explained in tinyos-1.x/tos/lib/Drip/README, this byte is not inserted (i.e.: packets sent from the computer are one byte shorter), so the motes do not interpret them correctly (in order to access the fields in the structure they expect that extra byte).
I guess that there must been some kind of problem with the structure ChannelDesc_t, because I send simpler structures with Drip and there is no problem.
(I attach the mig-generated file.)

Any ideas?



LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
/**
 * This class is automatically generated by mig. DO NOT EDIT THIS FILE.
 * This class implements a Java interface to the 'DripChannelMsg'
 * message type.
 */

public class DripChannelMsg extends net.tinyos.message.Message {

    /** The default size of this message type in bytes. */
    public static final int DEFAULT_MESSAGE_SIZE = 7;

    /** The Active Message type associated with this message. */
    public static final int AM_TYPE = 4;

    /** Create a new DripChannelMsg of size 7. */
    public DripChannelMsg() {
        super(DEFAULT_MESSAGE_SIZE);
        amTypeSet(AM_TYPE);
    }

    /** Create a new DripChannelMsg of the given data_length. */
    public DripChannelMsg(int data_length) {
        super(data_length);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new DripChannelMsg with the given data_length
     * and base offset.
     */
    public DripChannelMsg(int data_length, int base_offset) {
        super(data_length, base_offset);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new DripChannelMsg using the given byte array
     * as backing store.
     */
    public DripChannelMsg(byte[] data) {
        super(data);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new DripChannelMsg using the given byte array
     * as backing store, with the given base offset.
     */
    public DripChannelMsg(byte[] data, int base_offset) {
        super(data, base_offset);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new DripChannelMsg using the given byte array
     * as backing store, with the given base offset and data length.
     */
    public DripChannelMsg(byte[] data, int base_offset, int data_length) {
        super(data, base_offset, data_length);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new DripChannelMsg embedded in the given message
     * at the given base offset.
     */
    public DripChannelMsg(net.tinyos.message.Message msg, int base_offset) {
        super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
        amTypeSet(AM_TYPE);
    }

    /**
     * Create a new DripChannelMsg embedded in the given message
     * at the given base offset and length.
     */
    public DripChannelMsg(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 <DripChannelMsg> \n";
      try {
        s += "  [nChannels=0x"+Long.toHexString(get_nChannels())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [channel.channelId=";
        for (int i = 0; i < 1; i++) {
          s += "0x"+Long.toHexString(getElement_channel_channelId(i) & 0xff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [channel.groupType=";
        for (int i = 0; i < 1; i++) {
          s += "0x"+Long.toHexString(getElement_channel_groupType(i) & 0xff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [channel.groupId=";
        for (int i = 0; i < 1; i++) {
          s += "0x"+Long.toHexString(getElement_channel_groupId(i) & 0xff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [channel.attrName=";
        for (int i = 0; i < 1; i++) {
          s += "0x"+Long.toHexString(getElement_channel_attrName(i) & 0xff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [channel.period=";
        for (int i = 0; i < 1; i++) {
          s += "0x"+Long.toHexString(getElement_channel_period(i) & 0xff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      return s;
    }

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

    /////////////////////////////////////////////////////////
    // Accessor methods for field: nChannels
    //   Field type: short
    //   Offset (bits): 0
    //   Size (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'nChannels' is signed (false).
     */
    public static boolean isSigned_nChannels() {
        return false;
    }

    /**
     * Return whether the field 'nChannels' is an array (false).
     */
    public static boolean isArray_nChannels() {
        return false;
    }

    /**
     * Return the offset (in bytes) of the field 'nChannels'
     */
    public static int offset_nChannels() {
        return (0 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'nChannels'
     */
    public static int offsetBits_nChannels() {
        return 0;
    }

    /**
     * Return the value (as a short) of the field 'nChannels'
     */
    public short get_nChannels() {
        return (short)getUIntElement(offsetBits_nChannels(), 8);
    }

    /**
     * Set the value of the field 'nChannels'
     */
    public void set_nChannels(short value) {
        setUIntElement(offsetBits_nChannels(), 8, value);
    }

    /**
     * Return the size, in bytes, of the field 'nChannels'
     */
    public static int size_nChannels() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of the field 'nChannels'
     */
    public static int sizeBits_nChannels() {
        return 8;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: channel.channelId
    //   Field type: short[]
    //   Offset (bits): 0
    //   Size of each element (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'channel.channelId' is signed (false).
     */
    public static boolean isSigned_channel_channelId() {
        return false;
    }

    /**
     * Return whether the field 'channel.channelId' is an array (true).
     */
    public static boolean isArray_channel_channelId() {
        return true;
    }

    /**
     * Return the offset (in bytes) of the field 'channel.channelId'
     */
    public static int offset_channel_channelId(int index1) {
        int offset = 0;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'channel.channelId'
     */
    public static int offsetBits_channel_channelId(int index1) {
        int offset = 0;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return offset;
    }

    /**
     * Return the entire array 'channel.channelId' as a short[]
     */
    public short[] get_channel_channelId() {
        short[] tmp = new short[1];
        for (int index0 = 0; index0 < numElements_channel_channelId(0); index0++) {
            tmp[index0] = getElement_channel_channelId(index0);
        }
        return tmp;
    }

    /**
     * Set the contents of the array 'channel.channelId' from the given short[]
     */
    public void set_channel_channelId(short[] value) {
        for (int index0 = 0; index0 < value.length; index0++) {
            setElement_channel_channelId(index0, value[index0]);
        }
    }

    /**
     * Return an element (as a short) of the array 'channel.channelId'
     */
    public short getElement_channel_channelId(int index1) {
        return (short)getUIntElement(offsetBits_channel_channelId(index1), 8);
    }

    /**
     * Set an element of the array 'channel.channelId'
     */
    public void setElement_channel_channelId(int index1, short value) {
        setUIntElement(offsetBits_channel_channelId(index1), 8, value);
    }

    /**
     * Return the total size, in bytes, of the array 'channel.channelId'
     */
    public static int totalSize_channel_channelId() {
        return (48 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'channel.channelId'
     */
    public static int totalSizeBits_channel_channelId() {
        return 48;
    }

    /**
     * Return the size, in bytes, of each element of the array 'channel.channelId'
     */
    public static int elementSize_channel_channelId() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'channel.channelId'
     */
    public static int elementSizeBits_channel_channelId() {
        return 8;
    }

    /**
     * Return the number of dimensions in the array 'channel.channelId'
     */
    public static int numDimensions_channel_channelId() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.channelId'
     */
    public static int numElements_channel_channelId() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.channelId'
     * for the given dimension.
     */
    public static int numElements_channel_channelId(int dimension) {
      int array_dims[] = { 1,  };
        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 'channel.channelId' with a String
     */
    public void setString_channel_channelId(String s) { 
         int len = s.length();
         int i;
         for (i = 0; i < len; i++) {
             setElement_channel_channelId(i, (short)s.charAt(i));
         }
         setElement_channel_channelId(i, (short)0); //null terminate
    }

    /**
     * Read the array 'channel.channelId' as a String
     */
    public String getString_channel_channelId() { 
         char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,1)];
         int i;
         for (i = 0; i < carr.length; i++) {
             if ((char)getElement_channel_channelId(i) == (char)0) break;
             carr[i] = (char)getElement_channel_channelId(i);
         }
         return new String(carr,0,i);
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: channel.groupType
    //   Field type: short[]
    //   Offset (bits): 8
    //   Size of each element (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'channel.groupType' is signed (false).
     */
    public static boolean isSigned_channel_groupType() {
        return false;
    }

    /**
     * Return whether the field 'channel.groupType' is an array (true).
     */
    public static boolean isArray_channel_groupType() {
        return true;
    }

    /**
     * Return the offset (in bytes) of the field 'channel.groupType'
     */
    public static int offset_channel_groupType(int index1) {
        int offset = 8;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'channel.groupType'
     */
    public static int offsetBits_channel_groupType(int index1) {
        int offset = 8;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return offset;
    }

    /**
     * Return the entire array 'channel.groupType' as a short[]
     */
    public short[] get_channel_groupType() {
        short[] tmp = new short[1];
        for (int index0 = 0; index0 < numElements_channel_groupType(0); index0++) {
            tmp[index0] = getElement_channel_groupType(index0);
        }
        return tmp;
    }

    /**
     * Set the contents of the array 'channel.groupType' from the given short[]
     */
    public void set_channel_groupType(short[] value) {
        for (int index0 = 0; index0 < value.length; index0++) {
            setElement_channel_groupType(index0, value[index0]);
        }
    }

    /**
     * Return an element (as a short) of the array 'channel.groupType'
     */
    public short getElement_channel_groupType(int index1) {
        return (short)getUIntElement(offsetBits_channel_groupType(index1), 8);
    }

    /**
     * Set an element of the array 'channel.groupType'
     */
    public void setElement_channel_groupType(int index1, short value) {
        setUIntElement(offsetBits_channel_groupType(index1), 8, value);
    }

    /**
     * Return the total size, in bytes, of the array 'channel.groupType'
     */
    public static int totalSize_channel_groupType() {
        return (48 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'channel.groupType'
     */
    public static int totalSizeBits_channel_groupType() {
        return 48;
    }

    /**
     * Return the size, in bytes, of each element of the array 'channel.groupType'
     */
    public static int elementSize_channel_groupType() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'channel.groupType'
     */
    public static int elementSizeBits_channel_groupType() {
        return 8;
    }

    /**
     * Return the number of dimensions in the array 'channel.groupType'
     */
    public static int numDimensions_channel_groupType() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.groupType'
     */
    public static int numElements_channel_groupType() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.groupType'
     * for the given dimension.
     */
    public static int numElements_channel_groupType(int dimension) {
      int array_dims[] = { 1,  };
        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 'channel.groupType' with a String
     */
    public void setString_channel_groupType(String s) { 
         int len = s.length();
         int i;
         for (i = 0; i < len; i++) {
             setElement_channel_groupType(i, (short)s.charAt(i));
         }
         setElement_channel_groupType(i, (short)0); //null terminate
    }

    /**
     * Read the array 'channel.groupType' as a String
     */
    public String getString_channel_groupType() { 
         char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,1)];
         int i;
         for (i = 0; i < carr.length; i++) {
             if ((char)getElement_channel_groupType(i) == (char)0) break;
             carr[i] = (char)getElement_channel_groupType(i);
         }
         return new String(carr,0,i);
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: channel.groupId
    //   Field type: int[]
    //   Offset (bits): 16
    //   Size of each element (bits): 16
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'channel.groupId' is signed (false).
     */
    public static boolean isSigned_channel_groupId() {
        return false;
    }

    /**
     * Return whether the field 'channel.groupId' is an array (true).
     */
    public static boolean isArray_channel_groupId() {
        return true;
    }

    /**
     * Return the offset (in bytes) of the field 'channel.groupId'
     */
    public static int offset_channel_groupId(int index1) {
        int offset = 16;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'channel.groupId'
     */
    public static int offsetBits_channel_groupId(int index1) {
        int offset = 16;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return offset;
    }

    /**
     * Return the entire array 'channel.groupId' as a int[]
     */
    public int[] get_channel_groupId() {
        int[] tmp = new int[1];
        for (int index0 = 0; index0 < numElements_channel_groupId(0); index0++) {
            tmp[index0] = getElement_channel_groupId(index0);
        }
        return tmp;
    }

    /**
     * Set the contents of the array 'channel.groupId' from the given int[]
     */
    public void set_channel_groupId(int[] value) {
        for (int index0 = 0; index0 < value.length; index0++) {
            setElement_channel_groupId(index0, value[index0]);
        }
    }

    /**
     * Return an element (as a int) of the array 'channel.groupId'
     */
    public int getElement_channel_groupId(int index1) {
        return (int)getUIntElement(offsetBits_channel_groupId(index1), 16);
    }

    /**
     * Set an element of the array 'channel.groupId'
     */
    public void setElement_channel_groupId(int index1, int value) {
        setUIntElement(offsetBits_channel_groupId(index1), 16, value);
    }

    /**
     * Return the total size, in bytes, of the array 'channel.groupId'
     */
    public static int totalSize_channel_groupId() {
        return (48 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'channel.groupId'
     */
    public static int totalSizeBits_channel_groupId() {
        return 48;
    }

    /**
     * Return the size, in bytes, of each element of the array 'channel.groupId'
     */
    public static int elementSize_channel_groupId() {
        return (16 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'channel.groupId'
     */
    public static int elementSizeBits_channel_groupId() {
        return 16;
    }

    /**
     * Return the number of dimensions in the array 'channel.groupId'
     */
    public static int numDimensions_channel_groupId() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.groupId'
     */
    public static int numElements_channel_groupId() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.groupId'
     * for the given dimension.
     */
    public static int numElements_channel_groupId(int dimension) {
      int array_dims[] = { 1,  };
        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];
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: channel.attrName
    //   Field type: short[]
    //   Offset (bits): 32
    //   Size of each element (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'channel.attrName' is signed (false).
     */
    public static boolean isSigned_channel_attrName() {
        return false;
    }

    /**
     * Return whether the field 'channel.attrName' is an array (true).
     */
    public static boolean isArray_channel_attrName() {
        return true;
    }

    /**
     * Return the offset (in bytes) of the field 'channel.attrName'
     */
    public static int offset_channel_attrName(int index1) {
        int offset = 32;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'channel.attrName'
     */
    public static int offsetBits_channel_attrName(int index1) {
        int offset = 32;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return offset;
    }

    /**
     * Return the entire array 'channel.attrName' as a short[]
     */
    public short[] get_channel_attrName() {
        short[] tmp = new short[1];
        for (int index0 = 0; index0 < numElements_channel_attrName(0); index0++) {
            tmp[index0] = getElement_channel_attrName(index0);
        }
        return tmp;
    }

    /**
     * Set the contents of the array 'channel.attrName' from the given short[]
     */
    public void set_channel_attrName(short[] value) {
        for (int index0 = 0; index0 < value.length; index0++) {
            setElement_channel_attrName(index0, value[index0]);
        }
    }

    /**
     * Return an element (as a short) of the array 'channel.attrName'
     */
    public short getElement_channel_attrName(int index1) {
        return (short)getUIntElement(offsetBits_channel_attrName(index1), 8);
    }

    /**
     * Set an element of the array 'channel.attrName'
     */
    public void setElement_channel_attrName(int index1, short value) {
        setUIntElement(offsetBits_channel_attrName(index1), 8, value);
    }

    /**
     * Return the total size, in bytes, of the array 'channel.attrName'
     */
    public static int totalSize_channel_attrName() {
        return (48 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'channel.attrName'
     */
    public static int totalSizeBits_channel_attrName() {
        return 48;
    }

    /**
     * Return the size, in bytes, of each element of the array 'channel.attrName'
     */
    public static int elementSize_channel_attrName() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'channel.attrName'
     */
    public static int elementSizeBits_channel_attrName() {
        return 8;
    }

    /**
     * Return the number of dimensions in the array 'channel.attrName'
     */
    public static int numDimensions_channel_attrName() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.attrName'
     */
    public static int numElements_channel_attrName() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.attrName'
     * for the given dimension.
     */
    public static int numElements_channel_attrName(int dimension) {
      int array_dims[] = { 1,  };
        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 'channel.attrName' with a String
     */
    public void setString_channel_attrName(String s) { 
         int len = s.length();
         int i;
         for (i = 0; i < len; i++) {
             setElement_channel_attrName(i, (short)s.charAt(i));
         }
         setElement_channel_attrName(i, (short)0); //null terminate
    }

    /**
     * Read the array 'channel.attrName' as a String
     */
    public String getString_channel_attrName() { 
         char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,1)];
         int i;
         for (i = 0; i < carr.length; i++) {
             if ((char)getElement_channel_attrName(i) == (char)0) break;
             carr[i] = (char)getElement_channel_attrName(i);
         }
         return new String(carr,0,i);
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: channel.period
    //   Field type: short[]
    //   Offset (bits): 40
    //   Size of each element (bits): 8
    /////////////////////////////////////////////////////////

    /**
     * Return whether the field 'channel.period' is signed (false).
     */
    public static boolean isSigned_channel_period() {
        return false;
    }

    /**
     * Return whether the field 'channel.period' is an array (true).
     */
    public static boolean isArray_channel_period() {
        return true;
    }

    /**
     * Return the offset (in bytes) of the field 'channel.period'
     */
    public static int offset_channel_period(int index1) {
        int offset = 40;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'channel.period'
     */
    public static int offsetBits_channel_period(int index1) {
        int offset = 40;
        if (index1 < 0 || index1 >= 1) throw new ArrayIndexOutOfBoundsException();
        offset += 8 + index1 * 48;
        return offset;
    }

    /**
     * Return the entire array 'channel.period' as a short[]
     */
    public short[] get_channel_period() {
        short[] tmp = new short[1];
        for (int index0 = 0; index0 < numElements_channel_period(0); index0++) {
            tmp[index0] = getElement_channel_period(index0);
        }
        return tmp;
    }

    /**
     * Set the contents of the array 'channel.period' from the given short[]
     */
    public void set_channel_period(short[] value) {
        for (int index0 = 0; index0 < value.length; index0++) {
            setElement_channel_period(index0, value[index0]);
        }
    }

    /**
     * Return an element (as a short) of the array 'channel.period'
     */
    public short getElement_channel_period(int index1) {
        return (short)getUIntElement(offsetBits_channel_period(index1), 8);
    }

    /**
     * Set an element of the array 'channel.period'
     */
    public void setElement_channel_period(int index1, short value) {
        setUIntElement(offsetBits_channel_period(index1), 8, value);
    }

    /**
     * Return the total size, in bytes, of the array 'channel.period'
     */
    public static int totalSize_channel_period() {
        return (48 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'channel.period'
     */
    public static int totalSizeBits_channel_period() {
        return 48;
    }

    /**
     * Return the size, in bytes, of each element of the array 'channel.period'
     */
    public static int elementSize_channel_period() {
        return (8 / 8);
    }

    /**
     * Return the size, in bits, of each element of the array 'channel.period'
     */
    public static int elementSizeBits_channel_period() {
        return 8;
    }

    /**
     * Return the number of dimensions in the array 'channel.period'
     */
    public static int numDimensions_channel_period() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.period'
     */
    public static int numElements_channel_period() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'channel.period'
     * for the given dimension.
     */
    public static int numElements_channel_period(int dimension) {
      int array_dims[] = { 1,  };
        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 'channel.period' with a String
     */
    public void setString_channel_period(String s) { 
         int len = s.length();
         int i;
         for (i = 0; i < len; i++) {
             setElement_channel_period(i, (short)s.charAt(i));
         }
         setElement_channel_period(i, (short)0); //null terminate
    }

    /**
     * Read the array 'channel.period' as a String
     */
    public String getString_channel_period() { 
         char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,1)];
         int i;
         for (i = 0; i < carr.length; i++) {
             if ((char)getElement_channel_period(i) == (char)0) break;
             carr[i] = (char)getElement_channel_period(i);
         }
         return new String(carr,0,i);
    }

}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to