/**
 * This class is automatically generated by mig. DO NOT EDIT THIS FILE.
 * This class implements a Java interface to the 'DataMsg'
 * message type.
 */

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

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

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

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

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

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

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

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

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

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

    /**
     * Create a new DataMsg embedded in the given message
     * at the given base offset and length.
     */
    public DataMsg(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 <DataMsg> \n";
      try {
        s += "  [AccelX_data=0x"+Long.toHexString(get_AccelX_data())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [AccelY_data=0x"+Long.toHexString(get_AccelY_data())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [Intersema_data=";
        for (int i = 0; i < 2; i++) {
          s += "0x"+Long.toHexString(getElement_Intersema_data(i) & 0xffff)+" ";
        }
        s += "]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [Temp_data=0x"+Long.toHexString(get_Temp_data())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [Hum_data=0x"+Long.toHexString(get_Hum_data())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [VisLight_data=0x"+Long.toHexString(get_VisLight_data())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      try {
        s += "  [InfLight_data=0x"+Long.toHexString(get_InfLight_data())+"]\n";
      } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
      return s;
    }

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

    /////////////////////////////////////////////////////////
    // Accessor methods for field: AccelX_data
    //   Field type: int, unsigned
    //   Offset (bits): 0
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

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

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

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

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

    /**
     * Return the value (as a int) of the field 'AccelX_data'
     */
    public int get_AccelX_data() {
        return (int)getUIntBEElement(offsetBits_AccelX_data(), 16);
    }

    /**
     * Set the value of the field 'AccelX_data'
     */
    public void set_AccelX_data(int value) {
        setUIntBEElement(offsetBits_AccelX_data(), 16, value);
    }

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

    /**
     * Return the size, in bits, of the field 'AccelX_data'
     */
    public static int sizeBits_AccelX_data() {
        return 16;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: AccelY_data
    //   Field type: int, unsigned
    //   Offset (bits): 16
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

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

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

    /**
     * Return the offset (in bytes) of the field 'AccelY_data'
     */
    public static int offset_AccelY_data() {
        return (16 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'AccelY_data'
     */
    public static int offsetBits_AccelY_data() {
        return 16;
    }

    /**
     * Return the value (as a int) of the field 'AccelY_data'
     */
    public int get_AccelY_data() {
        return (int)getUIntBEElement(offsetBits_AccelY_data(), 16);
    }

    /**
     * Set the value of the field 'AccelY_data'
     */
    public void set_AccelY_data(int value) {
        setUIntBEElement(offsetBits_AccelY_data(), 16, value);
    }

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

    /**
     * Return the size, in bits, of the field 'AccelY_data'
     */
    public static int sizeBits_AccelY_data() {
        return 16;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: Intersema_data
    //   Field type: short[], unsigned
    //   Offset (bits): 32
    //   Size of each element (bits): 16
    /////////////////////////////////////////////////////////

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

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

    /**
     * Return the offset (in bytes) of the field 'Intersema_data'
     */
    public static int offset_Intersema_data(int index1) {
        int offset = 32;
        if (index1 < 0 || index1 >= 2) throw new ArrayIndexOutOfBoundsException();
        offset += 0 + index1 * 16;
        return (offset / 8);
    }

    /**
     * Return the offset (in bits) of the field 'Intersema_data'
     */
    public static int offsetBits_Intersema_data(int index1) {
        int offset = 32;
        if (index1 < 0 || index1 >= 2) throw new ArrayIndexOutOfBoundsException();
        offset += 0 + index1 * 16;
        return offset;
    }

    /**
     * Return the entire array 'Intersema_data' as a short[]
     */
    public short[] get_Intersema_data() {
        short[] tmp = new short[2];
        for (int index0 = 0; index0 < numElements_Intersema_data(0); index0++) {
            tmp[index0] = getElement_Intersema_data(index0);
        }
        return tmp;
    }

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

    /**
     * Return an element (as a short) of the array 'Intersema_data'
     */
    public short getElement_Intersema_data(int index1) {
        return (short)getSIntBEElement(offsetBits_Intersema_data(index1), 16);
    }

    /**
     * Set an element of the array 'Intersema_data'
     */
    public void setElement_Intersema_data(int index1, short value) {
        setSIntBEElement(offsetBits_Intersema_data(index1), 16, value);
    }

    /**
     * Return the total size, in bytes, of the array 'Intersema_data'
     */
    public static int totalSize_Intersema_data() {
        return (32 / 8);
    }

    /**
     * Return the total size, in bits, of the array 'Intersema_data'
     */
    public static int totalSizeBits_Intersema_data() {
        return 32;
    }

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

    /**
     * Return the size, in bits, of each element of the array 'Intersema_data'
     */
    public static int elementSizeBits_Intersema_data() {
        return 16;
    }

    /**
     * Return the number of dimensions in the array 'Intersema_data'
     */
    public static int numDimensions_Intersema_data() {
        return 1;
    }

    /**
     * Return the number of elements in the array 'Intersema_data'
     */
    public static int numElements_Intersema_data() {
        return 2;
    }

    /**
     * Return the number of elements in the array 'Intersema_data'
     * for the given dimension.
     */
    public static int numElements_Intersema_data(int dimension) {
      int array_dims[] = { 2,  };
        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: Temp_data
    //   Field type: int, unsigned
    //   Offset (bits): 64
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

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

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

    /**
     * Return the offset (in bytes) of the field 'Temp_data'
     */
    public static int offset_Temp_data() {
        return (64 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'Temp_data'
     */
    public static int offsetBits_Temp_data() {
        return 64;
    }

    /**
     * Return the value (as a int) of the field 'Temp_data'
     */
    public int get_Temp_data() {
        return (int)getUIntBEElement(offsetBits_Temp_data(), 16);
    }

    /**
     * Set the value of the field 'Temp_data'
     */
    public void set_Temp_data(int value) {
        setUIntBEElement(offsetBits_Temp_data(), 16, value);
    }

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

    /**
     * Return the size, in bits, of the field 'Temp_data'
     */
    public static int sizeBits_Temp_data() {
        return 16;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: Hum_data
    //   Field type: int, unsigned
    //   Offset (bits): 80
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

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

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

    /**
     * Return the offset (in bytes) of the field 'Hum_data'
     */
    public static int offset_Hum_data() {
        return (80 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'Hum_data'
     */
    public static int offsetBits_Hum_data() {
        return 80;
    }

    /**
     * Return the value (as a int) of the field 'Hum_data'
     */
    public int get_Hum_data() {
        return (int)getUIntBEElement(offsetBits_Hum_data(), 16);
    }

    /**
     * Set the value of the field 'Hum_data'
     */
    public void set_Hum_data(int value) {
        setUIntBEElement(offsetBits_Hum_data(), 16, value);
    }

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

    /**
     * Return the size, in bits, of the field 'Hum_data'
     */
    public static int sizeBits_Hum_data() {
        return 16;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: VisLight_data
    //   Field type: int, unsigned
    //   Offset (bits): 96
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

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

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

    /**
     * Return the offset (in bytes) of the field 'VisLight_data'
     */
    public static int offset_VisLight_data() {
        return (96 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'VisLight_data'
     */
    public static int offsetBits_VisLight_data() {
        return 96;
    }

    /**
     * Return the value (as a int) of the field 'VisLight_data'
     */
    public int get_VisLight_data() {
        return (int)getUIntBEElement(offsetBits_VisLight_data(), 16);
    }

    /**
     * Set the value of the field 'VisLight_data'
     */
    public void set_VisLight_data(int value) {
        setUIntBEElement(offsetBits_VisLight_data(), 16, value);
    }

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

    /**
     * Return the size, in bits, of the field 'VisLight_data'
     */
    public static int sizeBits_VisLight_data() {
        return 16;
    }

    /////////////////////////////////////////////////////////
    // Accessor methods for field: InfLight_data
    //   Field type: int, unsigned
    //   Offset (bits): 112
    //   Size (bits): 16
    /////////////////////////////////////////////////////////

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

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

    /**
     * Return the offset (in bytes) of the field 'InfLight_data'
     */
    public static int offset_InfLight_data() {
        return (112 / 8);
    }

    /**
     * Return the offset (in bits) of the field 'InfLight_data'
     */
    public static int offsetBits_InfLight_data() {
        return 112;
    }

    /**
     * Return the value (as a int) of the field 'InfLight_data'
     */
    public int get_InfLight_data() {
        return (int)getUIntBEElement(offsetBits_InfLight_data(), 16);
    }

    /**
     * Set the value of the field 'InfLight_data'
     */
    public void set_InfLight_data(int value) {
        setUIntBEElement(offsetBits_InfLight_data(), 16, value);
    }

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

    /**
     * Return the size, in bits, of the field 'InfLight_data'
     */
    public static int sizeBits_InfLight_data() {
        return 16;
    }

}
