variablerequestresponse.java
来自「tinyos最新版」· Java 代码 · 共 321 行
JAVA
321 行
/** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This class implements a Java interface to the 'VariableRequestResponse' * message type. */package net.tinyos.sim.msg;public class VariableRequestResponse extends net.tinyos.message.Message { /** The default size of this message type in bytes. */ public static final int DEFAULT_MESSAGE_SIZE = 260; /** The Active Message type associated with this message. */ public static final int AM_TYPE = 4108; /** Create a new VariableRequestResponse of size 260. */ public VariableRequestResponse() { super(DEFAULT_MESSAGE_SIZE); amTypeSet(AM_TYPE); } /** Create a new VariableRequestResponse of the given data_length. */ public VariableRequestResponse(int data_length) { super(data_length); amTypeSet(AM_TYPE); } /** * Create a new VariableRequestResponse with the given data_length * and base offset. */ public VariableRequestResponse(int data_length, int base_offset) { super(data_length, base_offset); amTypeSet(AM_TYPE); } /** * Create a new VariableRequestResponse using the given byte array * as backing store. */ public VariableRequestResponse(byte[] data) { super(data); amTypeSet(AM_TYPE); } /** * Create a new VariableRequestResponse using the given byte array * as backing store, with the given base offset. */ public VariableRequestResponse(byte[] data, int base_offset) { super(data, base_offset); amTypeSet(AM_TYPE); } /** * Create a new VariableRequestResponse using the given byte array * as backing store, with the given base offset and data length. */ public VariableRequestResponse(byte[] data, int base_offset, int data_length) { super(data, base_offset, data_length); amTypeSet(AM_TYPE); } /** * Create a new VariableRequestResponse embedded in the given message * at the given base offset. */ public VariableRequestResponse(net.tinyos.message.Message msg, int base_offset) { super(msg, base_offset, DEFAULT_MESSAGE_SIZE); amTypeSet(AM_TYPE); } /** * Create a new VariableRequestResponse embedded in the given message * at the given base offset and length. */ public VariableRequestResponse(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 <VariableRequestResponse> \n"; try { s += " [length=0x"+Long.toHexString(get_length())+"]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [value="; for (int i = 0; i < 256; i++) { s += "0x"+Long.toHexString(getElement_value(i) & 0xff)+" "; } s += "]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } return s; } // Message-type-specific access methods appear below. ///////////////////////////////////////////////////////// // Accessor methods for field: length // Field type: long, signed // Offset (bits): 0 // Size (bits): 32 ///////////////////////////////////////////////////////// /** * Return whether the field 'length' is signed (true). */ public static boolean isSigned_length() { return true; } /** * Return whether the field 'length' is an array (false). */ public static boolean isArray_length() { return false; } /** * Return the offset (in bytes) of the field 'length' */ public static int offset_length() { return (0 / 8); } /** * Return the offset (in bits) of the field 'length' */ public static int offsetBits_length() { return 0; } /** * Return the value (as a long) of the field 'length' */ public long get_length() { return (long)getUIntElement(offsetBits_length(), 32); } /** * Set the value of the field 'length' */ public void set_length(long value) { setUIntElement(offsetBits_length(), 32, value); } /** * Return the size, in bytes, of the field 'length' */ public static int size_length() { return (32 / 8); } /** * Return the size, in bits, of the field 'length' */ public static int sizeBits_length() { return 32; } ///////////////////////////////////////////////////////// // Accessor methods for field: value // Field type: byte[], signed // Offset (bits): 32 // Size of each element (bits): 8 ///////////////////////////////////////////////////////// /** * Return whether the field 'value' is signed (true). */ public static boolean isSigned_value() { return true; } /** * Return whether the field 'value' is an array (true). */ public static boolean isArray_value() { return true; } /** * Return the offset (in bytes) of the field 'value' */ public static int offset_value(int index1) { int offset = 32; if (index1 < 0 || index1 >= 256) throw new ArrayIndexOutOfBoundsException(); offset += 0 + index1 * 8; return (offset / 8); } /** * Return the offset (in bits) of the field 'value' */ public static int offsetBits_value(int index1) { int offset = 32; if (index1 < 0 || index1 >= 256) throw new ArrayIndexOutOfBoundsException(); offset += 0 + index1 * 8; return offset; } /** * Return the entire array 'value' as a byte[] */ public byte[] get_value() { byte[] tmp = new byte[256]; for (int index0 = 0; index0 < numElements_value(0); index0++) { tmp[index0] = getElement_value(index0); } return tmp; } /** * Set the contents of the array 'value' from the given byte[] */ public void set_value(byte[] value) { for (int index0 = 0; index0 < value.length; index0++) { setElement_value(index0, value[index0]); } } /** * Return an element (as a byte) of the array 'value' */ public byte getElement_value(int index1) { return (byte)getSIntElement(offsetBits_value(index1), 8); } /** * Set an element of the array 'value' */ public void setElement_value(int index1, byte value) { setSIntElement(offsetBits_value(index1), 8, value); } /** * Return the total size, in bytes, of the array 'value' */ public static int totalSize_value() { return (2048 / 8); } /** * Return the total size, in bits, of the array 'value' */ public static int totalSizeBits_value() { return 2048; } /** * Return the size, in bytes, of each element of the array 'value' */ public static int elementSize_value() { return (8 / 8); } /** * Return the size, in bits, of each element of the array 'value' */ public static int elementSizeBits_value() { return 8; } /** * Return the number of dimensions in the array 'value' */ public static int numDimensions_value() { return 1; } /** * Return the number of elements in the array 'value' */ public static int numElements_value() { return 256; } /** * Return the number of elements in the array 'value' * for the given dimension. */ public static int numElements_value(int dimension) { int array_dims[] = { 256, }; 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 'value' with a String */ public void setString_value(String s) { int len = s.length(); int i; for (i = 0; i < len; i++) { setElement_value(i, (byte)s.charAt(i)); } setElement_value(i, (byte)0); //null terminate } /** * Read the array 'value' as a String */ public String getString_value() { char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,256)]; int i; for (i = 0; i < carr.length; i++) { if ((char)getElement_value(i) == (char)0) break; carr[i] = (char)getElement_value(i); } return new String(carr,0,i); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?