📄 s4beaconmessage.java
字号:
/** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This class implements a Java interface to the 'S4BeaconMessage' * message type. */package net.tinyos.cr.messages;public class S4BeaconMessage extends net.tinyos.message.Message { /** The default size of this message type in bytes. */ public static final int DEFAULT_MESSAGE_SIZE = 26; /** The Active Message type associated with this message. */ public static final int AM_TYPE = 56; /** Create a new S4BeaconMessage of size 26. */ public S4BeaconMessage() { super(DEFAULT_MESSAGE_SIZE); amTypeSet(AM_TYPE); } /** Create a new S4BeaconMessage of the given data_length. */ public S4BeaconMessage(int data_length) { super(data_length); amTypeSet(AM_TYPE); } /** * Create a new S4BeaconMessage with the given data_length * and base offset. */ public S4BeaconMessage(int data_length, int base_offset) { super(data_length, base_offset); amTypeSet(AM_TYPE); } /** * Create a new S4BeaconMessage using the given byte array * as backing store. */ public S4BeaconMessage(byte[] data) { super(data); amTypeSet(AM_TYPE); } /** * Create a new S4BeaconMessage using the given byte array * as backing store, with the given base offset. */ public S4BeaconMessage(byte[] data, int base_offset) { super(data, base_offset); amTypeSet(AM_TYPE); } /** * Create a new S4BeaconMessage using the given byte array * as backing store, with the given base offset and data length. */ public S4BeaconMessage(byte[] data, int base_offset, int data_length) { super(data, base_offset, data_length); amTypeSet(AM_TYPE); } /** * Create a new S4BeaconMessage embedded in the given message * at the given base offset. */ public S4BeaconMessage(net.tinyos.message.Message msg, int base_offset) { super(msg, base_offset, DEFAULT_MESSAGE_SIZE); amTypeSet(AM_TYPE); } /** * Create a new S4BeaconMessage embedded in the given message * at the given base offset and length. */ public S4BeaconMessage(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 <S4BeaconMessage> \n"; try { s += " [header.last_hop=0x"+Long.toHexString(get_header_last_hop())+"]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [header.seqno=0x"+Long.toHexString(get_header_seqno())+"]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [type_data.seqno=0x"+Long.toHexString(get_type_data_seqno())+"]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [type_data.beacons.beacon_id="; for (int i = 0; i < 5; i++) { s += "0x"+Long.toHexString(getElement_type_data_beacons_beacon_id(i) & 0xff)+" "; } s += "]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [type_data.beacons.hopcount="; for (int i = 0; i < 5; i++) { s += "0x"+Long.toHexString(getElement_type_data_beacons_hopcount(i) & 0xff)+" "; } s += "]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [type_data.beacons.seqno="; for (int i = 0; i < 5; i++) { s += "0x"+Long.toHexString(getElement_type_data_beacons_seqno(i) & 0xff)+" "; } s += "]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } try { s += " [type_data.beacons.quality="; for (int i = 0; i < 5; i++) { s += "0x"+Long.toHexString(getElement_type_data_beacons_quality(i) & 0xff)+" "; } s += "]\n"; } catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ } return s; } // Message-type-specific access methods appear below. ///////////////////////////////////////////////////////// // Accessor methods for field: header.last_hop // Field type: int // Offset (bits): 0 // Size (bits): 16 ///////////////////////////////////////////////////////// /** * Return whether the field 'header.last_hop' is signed (false). */ public static boolean isSigned_header_last_hop() { return false; } /** * Return whether the field 'header.last_hop' is an array (false). */ public static boolean isArray_header_last_hop() { return false; } /** * Return the offset (in bytes) of the field 'header.last_hop' */ public static int offset_header_last_hop() { return (0 / 8); } /** * Return the offset (in bits) of the field 'header.last_hop' */ public static int offsetBits_header_last_hop() { return 0; } /** * Return the value (as a int) of the field 'header.last_hop' */ public int get_header_last_hop() { return (int)getUIntElement(offsetBits_header_last_hop(), 16); } /** * Set the value of the field 'header.last_hop' */ public void set_header_last_hop(int value) { setUIntElement(offsetBits_header_last_hop(), 16, value); } /** * Return the size, in bytes, of the field 'header.last_hop' */ public static int size_header_last_hop() { return (16 / 8); } /** * Return the size, in bits, of the field 'header.last_hop' */ public static int sizeBits_header_last_hop() { return 16; } ///////////////////////////////////////////////////////// // Accessor methods for field: header.seqno // Field type: int // Offset (bits): 16 // Size (bits): 16 ///////////////////////////////////////////////////////// /** * Return whether the field 'header.seqno' is signed (false). */ public static boolean isSigned_header_seqno() { return false; } /** * Return whether the field 'header.seqno' is an array (false). */ public static boolean isArray_header_seqno() { return false; } /** * Return the offset (in bytes) of the field 'header.seqno' */ public static int offset_header_seqno() { return (16 / 8); } /** * Return the offset (in bits) of the field 'header.seqno' */ public static int offsetBits_header_seqno() { return 16; } /** * Return the value (as a int) of the field 'header.seqno' */ public int get_header_seqno() { return (int)getUIntElement(offsetBits_header_seqno(), 16); } /** * Set the value of the field 'header.seqno' */ public void set_header_seqno(int value) { setUIntElement(offsetBits_header_seqno(), 16, value); } /** * Return the size, in bytes, of the field 'header.seqno' */ public static int size_header_seqno() { return (16 / 8); } /** * Return the size, in bits, of the field 'header.seqno' */ public static int sizeBits_header_seqno() { return 16; } ///////////////////////////////////////////////////////// // Accessor methods for field: type_data.seqno // Field type: int // Offset (bits): 32 // Size (bits): 16 ///////////////////////////////////////////////////////// /** * Return whether the field 'type_data.seqno' is signed (false). */ public static boolean isSigned_type_data_seqno() { return false; } /** * Return whether the field 'type_data.seqno' is an array (false). */ public static boolean isArray_type_data_seqno() { return false; } /** * Return the offset (in bytes) of the field 'type_data.seqno' */ public static int offset_type_data_seqno() { return (32 / 8); } /** * Return the offset (in bits) of the field 'type_data.seqno' */ public static int offsetBits_type_data_seqno() { return 32; } /** * Return the value (as a int) of the field 'type_data.seqno' */ public int get_type_data_seqno() { return (int)getUIntElement(offsetBits_type_data_seqno(), 16); } /** * Set the value of the field 'type_data.seqno' */ public void set_type_data_seqno(int value) { setUIntElement(offsetBits_type_data_seqno(), 16, value); } /** * Return the size, in bytes, of the field 'type_data.seqno' */ public static int size_type_data_seqno() { return (16 / 8); } /** * Return the size, in bits, of the field 'type_data.seqno' */ public static int sizeBits_type_data_seqno() { return 16; } ///////////////////////////////////////////////////////// // Accessor methods for field: type_data.beacons.beacon_id // Field type: short[] // Offset (bits): 0 // Size of each element (bits): 8 ///////////////////////////////////////////////////////// /** * Return whether the field 'type_data.beacons.beacon_id' is signed (false). */ public static boolean isSigned_type_data_beacons_beacon_id() { return false; } /** * Return whether the field 'type_data.beacons.beacon_id' is an array (true). */ public static boolean isArray_type_data_beacons_beacon_id() { return true; } /** * Return the offset (in bytes) of the field 'type_data.beacons.beacon_id' */ public static int offset_type_data_beacons_beacon_id(int index1) { int offset = 0; if (index1 < 0 || index1 >= 5) throw new ArrayIndexOutOfBoundsException(); offset += 48 + index1 * 32; return (offset / 8); } /** * Return the offset (in bits) of the field 'type_data.beacons.beacon_id' */ public static int offsetBits_type_data_beacons_beacon_id(int index1) { int offset = 0; if (index1 < 0 || index1 >= 5) throw new ArrayIndexOutOfBoundsException(); offset += 48 + index1 * 32; return offset; } /** * Return the entire array 'type_data.beacons.beacon_id' as a short[] */ public short[] get_type_data_beacons_beacon_id() { short[] tmp = new short[5]; for (int index0 = 0; index0 < numElements_type_data_beacons_beacon_id(0); index0++) { tmp[index0] = getElement_type_data_beacons_beacon_id(index0); } return tmp; } /** * Set the contents of the array 'type_data.beacons.beacon_id' from the given short[] */ public void set_type_data_beacons_beacon_id(short[] value) { for (int index0 = 0; index0 < value.length; index0++) { setElement_type_data_beacons_beacon_id(index0, value[index0]); } } /** * Return an element (as a short) of the array 'type_data.beacons.beacon_id' */ public short getElement_type_data_beacons_beacon_id(int index1) { return (short)getUIntElement(offsetBits_type_data_beacons_beacon_id(index1), 8); } /** * Set an element of the array 'type_data.beacons.beacon_id' */ public void setElement_type_data_beacons_beacon_id(int index1, short value) { setUIntElement(offsetBits_type_data_beacons_beacon_id(index1), 8, value); } /** * Return the total size, in bytes, of the array 'type_data.beacons.beacon_id' */ public static int totalSize_type_data_beacons_beacon_id() { return (160 / 8); } /** * Return the total size, in bits, of the array 'type_data.beacons.beacon_id' */ public static int totalSizeBits_type_data_beacons_beacon_id() { return 160; } /** * Return the size, in bytes, of each element of the array 'type_data.beacons.beacon_id' */ public static int elementSize_type_data_beacons_beacon_id() { return (8 / 8); } /** * Return the size, in bits, of each element of the array 'type_data.beacons.beacon_id' */ public static int elementSizeBits_type_data_beacons_beacon_id() { return 8; } /** * Return the number of dimensions in the array 'type_data.beacons.beacon_id' */ public static int numDimensions_type_data_beacons_beacon_id() { return 1; } /** * Return the number of elements in the array 'type_data.beacons.beacon_id' */ public static int numElements_type_data_beacons_beacon_id() { return 5; } /** * Return the number of elements in the array 'type_data.beacons.beacon_id' * for the given dimension. */ public static int numElements_type_data_beacons_beacon_id(int dimension) { int array_dims[] = { 5, }; 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 'type_data.beacons.beacon_id' with a String */ public void setString_type_data_beacons_beacon_id(String s) { int len = s.length(); int i; for (i = 0; i < len; i++) { setElement_type_data_beacons_beacon_id(i, (short)s.charAt(i)); } setElement_type_data_beacons_beacon_id(i, (short)0); //null terminate } /** * Read the array 'type_data.beacons.beacon_id' as a String */ public String getString_type_data_beacons_beacon_id() { char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,5)]; int i; for (i = 0; i < carr.length; i++) { if ((char)getElement_type_data_beacons_beacon_id(i) == (char)0) break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -