[Firebug-cvs] firebug/project/java/src/org/firebug/gps LogMsg.java,NONE,1.1 gpsBcast.java,NONE,1.1 g
Brought to you by:
doolin
|
From: <cs...@us...> - 2003-05-23 15:44:57
|
Update of /cvsroot/firebug/firebug/project/java/src/org/firebug/gps
In directory sc8-pr-cvs1:/tmp/cvs-serv14871
Added Files:
LogMsg.java gpsBcast.java gpsCmdMsg.java
Log Message:
gps java files added
--- NEW FILE: LogMsg.java ---
/**
* This class is automatically generated by mig. DO NOT EDIT THIS FILE.
* This class implements a Java interface to the 'LogMsg'
* message type.
*/
package org.firebug.gps;
public class LogMsg extends net.tinyos.message.Message {
/** The default size of this message type in bytes. */
public static final int DEFAULT_MESSAGE_SIZE = 18;
/** The Active Message type associated with this message. */
public static final int AM_TYPE = 9;
/** Create a new LogMsg of size 18. */
public LogMsg() {
super(DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/** Create a new LogMsg of the given data_length. */
public LogMsg(int data_length) {
super(data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new LogMsg with the given data_length
* and base offset.
*/
public LogMsg(int data_length, int base_offset) {
super(data_length, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new LogMsg using the given byte array
* as backing store.
*/
public LogMsg(byte[] data) {
super(data);
amTypeSet(AM_TYPE);
}
/**
* Create a new LogMsg using the given byte array
* as backing store, with the given base offset.
*/
public LogMsg(byte[] data, int base_offset) {
super(data, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new LogMsg using the given byte array
* as backing store, with the given base offset and data length.
*/
public LogMsg(byte[] data, int base_offset, int data_length) {
super(data, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new LogMsg embedded in the given message
* at the given base offset.
*/
public LogMsg(net.tinyos.message.Message msg, int base_offset) {
super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/**
* Create a new LogMsg embedded in the given message
* at the given base offset and length.
*/
public LogMsg(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 <LogMsg> \n";
try {
s += " [sourceaddr=0x"+Long.toHexString(get_sourceaddr())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [log=";
for (int i = 0; i < 16; i++) {
s += "0x"+Long.toHexString(getElement_log(i) & 0xff)+" ";
}
s += "]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
return s;
}
// Message-type-specific access methods appear below.
/////////////////////////////////////////////////////////
// Accessor methods for field: sourceaddr
// Field type: int, unsigned
// Offset (bits): 0
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'sourceaddr' is signed (false).
*/
public static boolean isSigned_sourceaddr() {
return false;
}
/**
* Return whether the field 'sourceaddr' is an array (false).
*/
public static boolean isArray_sourceaddr() {
return false;
}
/**
* Return the offset (in bytes) of the field 'sourceaddr'
*/
public static int offset_sourceaddr() {
return (0 / 8);
}
/**
* Return the offset (in bits) of the field 'sourceaddr'
*/
public static int offsetBits_sourceaddr() {
return 0;
}
/**
* Return the value (as a int) of the field 'sourceaddr'
*/
public int get_sourceaddr() {
return (int)getUIntElement(offsetBits_sourceaddr(), 16);
}
/**
* Set the value of the field 'sourceaddr'
*/
public void set_sourceaddr(int value) {
setUIntElement(offsetBits_sourceaddr(), 16, value);
}
/**
* Return the size, in bytes, of the field 'sourceaddr'
*/
public static int size_sourceaddr() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'sourceaddr'
*/
public static int sizeBits_sourceaddr() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: log
// Field type: short[], unsigned
// Offset (bits): 16
// Size of each element (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'log' is signed (false).
*/
public static boolean isSigned_log() {
return false;
}
/**
* Return whether the field 'log' is an array (true).
*/
public static boolean isArray_log() {
return true;
}
/**
* Return the offset (in bytes) of the field 'log'
*/
public static int offset_log(int index1) {
int offset = 16;
if (index1 < 0 || index1 >= 16) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 8;
return (offset / 8);
}
/**
* Return the offset (in bits) of the field 'log'
*/
public static int offsetBits_log(int index1) {
int offset = 16;
if (index1 < 0 || index1 >= 16) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 8;
return offset;
}
/**
* Return the entire array 'log' as a short[]
*/
public short[] get_log() {
short[] tmp = new short[16];
for (int index0 = 0; index0 < numElements_log(0); index0++) {
tmp[index0] = getElement_log(index0);
}
return tmp;
}
/**
* Set the contents of the array 'log' from the given short[]
*/
public void set_log(short[] value) {
for (int index0 = 0; index0 < value.length; index0++) {
setElement_log(index0, value[index0]);
}
}
/**
* Return an element (as a short) of the array 'log'
*/
public short getElement_log(int index1) {
return (short)getUIntElement(offsetBits_log(index1), 8);
}
/**
* Set an element of the array 'log'
*/
public void setElement_log(int index1, short value) {
setUIntElement(offsetBits_log(index1), 8, value);
}
/**
* Return the total size, in bytes, of the array 'log'
*/
public static int totalSize_log() {
return (128 / 8);
}
/**
* Return the total size, in bits, of the array 'log'
*/
public static int totalSizeBits_log() {
return 128;
}
/**
* Return the size, in bytes, of each element of the array 'log'
*/
public static int elementSize_log() {
return (8 / 8);
}
/**
* Return the size, in bits, of each element of the array 'log'
*/
public static int elementSizeBits_log() {
return 8;
}
/**
* Return the number of dimensions in the array 'log'
*/
public static int numDimensions_log() {
return 1;
}
/**
* Return the number of elements in the array 'log'
*/
public static int numElements_log() {
return 16;
}
/**
* Return the number of elements in the array 'log'
* for the given dimension.
*/
public static int numElements_log(int dimension) {
int array_dims[] = { 16, };
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 'log' with a String
*/
public void setString_log(String s) {
int len = s.length();
int i;
for (i = 0; i < len; i++) {
setElement_log(i, (short)s.charAt(i));
}
setElement_log(i, (short)0); //null terminate
}
/**
* Read the array 'log' as a String
*/
public String getString_log() {
char carr[] = new char[Math.min(net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH,16)];
int i;
for (i = 0; i < carr.length; i++) {
if ((char)getElement_log(i) == (char)0) break;
carr[i] = (char)getElement_log(i);
}
return new String(carr,0,i);
}
}
--- NEW FILE: gpsBcast.java ---
package org.firebug.gps;
import net.tinyos.util.*;
import java.io.*;
import java.util.Properties;
import net.tinyos.message.*;
public class gpsBcast implements MessageListener {
static Properties p = new Properties();
public static final byte UTC = 1;
public static final byte LONGITUDE = 2;
public static final byte NS_INDICATOR = 3;
public static final byte LATITUDE = 4;
public static final byte EW_INDICATOR = 5;
public boolean read_log_done = false;
public static final short TOS_BCAST_ADDR = (short) 0xffff;
public static void usage() {
System.err.println("Usage: java net.tinyos.tools.gpsBcast"+
" <group_id> <command> [arguments]");
System.err.println("\twhere <command> and [arguments] can be one of the following:");
System.err.println("\t\tUTC [dest_address]");
System.err.println("\t\tLONGITUDE [dest_address]");
System.err.println("\t\tNS_INDICATOR [dest_address]");
System.err.println("\t\tLATITUDE [dest_address]");
System.err.println("\t\tEW_INDICATOR [dest_address]");
}
public static byte restoreSequenceNo() {
try {
FileInputStream fis = new FileInputStream("bcast.properties");
p.load(fis);
byte i = (byte)Integer.parseInt(p.getProperty("sequenceNo", "1"));
fis.close();
return i;
} catch (IOException e) {
p.setProperty("sequenceNo", "1");
return 1;
}
}
public static void saveSequenceNo(int i) {
try {
FileOutputStream fos = new FileOutputStream("bcast.properties");
p.setProperty("sequenceNo", Integer.toString(i));
p.store(fos, "#Properties for gpsBcast\n");
} catch (IOException e) {
System.err.println("Exception while saving sequence number" +
e);
e.printStackTrace();
}
}
public static void main(String[] argv) throws IOException{
String cmd;
byte group_id = 0;
byte sequenceNo = 0;
if (argv.length < 2) {
usage();
System.exit(-1);
}
try {
group_id = (byte)(Integer.parseInt(argv[0]) & 0xff);
} catch (NumberFormatException nfe) {
usage();
System.exit(-1);
}
cmd = argv[1];
gpsCmdMsg packet = new gpsCmdMsg();
sequenceNo = restoreSequenceNo();
packet.set_seqno(sequenceNo);
packet.set_hop_count((short)0);
packet.set_source(0);
if (cmd.equals("UTC")) {
packet.set_action(UTC);
short address = (short)Integer.parseInt(argv[2]);
packet.set_args_rl_args_destaddr(address);
} else if (cmd.equals("LONGITUDE")) {
packet.set_action(LONGITUDE);
short address = (short)Integer.parseInt(argv[2]);
packet.set_args_rl_args_destaddr(address);
} else if (cmd.equals("NS_INDICATOR")) {
packet.set_action(NS_INDICATOR);
short address = (short)Integer.parseInt(argv[2]);
packet.set_args_rl_args_destaddr(address);
} else if (cmd.equals("LATITUDE")) {
packet.set_action(LATITUDE);
short address = (short)Integer.parseInt(argv[2]);
packet.set_args_rl_args_destaddr(address);
} else if (cmd.equals("EW_INDICATOR")) {
packet.set_action(EW_INDICATOR);
short address = (short)Integer.parseInt(argv[2]);
packet.set_args_rl_args_destaddr(address);
} else {
usage();
System.exit(-1);
}
try {
System.err.print("Sending payload: ");
for (int i = 0; i < packet.dataLength(); i++) {
System.err.print(Integer.toHexString(packet.dataGet()[i] & 0xff)+ " ");
}
System.err.println();
MoteIF mote = new MoteIF("127.0.0.1", 9000, group_id);
gpsBcast bc = null;
bc = new gpsBcast();
mote.registerListener(new LogMsg(), bc);
mote.start();
mote.send(TOS_BCAST_ADDR, packet);
synchronized (bc) {
if (bc.read_log_done == false) {
System.err.println("Waiting for response to read_log...");
bc.wait(10000);
}
if (bc.read_log_done == false) {
System.err.println("Warning: Timed out waiting for response to read_log command!");
}
}
saveSequenceNo(sequenceNo+1);
System.exit(0);
} catch(Exception e) {
e.printStackTrace();
}
}
public void messageReceived(int dest_addr, Message m) {
LogMsg lm = (LogMsg) m;
System.err.println("Received log message: "+lm);
System.err.print("Log values: ");
for (int i = 0; i < lm.numElements_log(); i++) {
short val = lm.getElement_log(i);
System.err.print(Integer.toHexString((int)val)+" ");
}
System.err.println("");
synchronized (this) {
read_log_done = true;
this.notifyAll();
}
}
}
--- NEW FILE: gpsCmdMsg.java ---
/**
* This class is automatically generated by mig. DO NOT EDIT THIS FILE.
* This class implements a Java interface to the 'gpsCmdMsg'
* message type.
*/
package org.firebug.gps;
public class gpsCmdMsg extends net.tinyos.message.Message {
/** The default size of this message type in bytes. */
public static final int DEFAULT_MESSAGE_SIZE = 11;
/** The Active Message type associated with this message. */
public static final int AM_TYPE = 8;
/** Create a new gpsCmdMsg of size 11. */
public gpsCmdMsg() {
super(DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/** Create a new gpsCmdMsg of the given data_length. */
public gpsCmdMsg(int data_length) {
super(data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new gpsCmdMsg with the given data_length
* and base offset.
*/
public gpsCmdMsg(int data_length, int base_offset) {
super(data_length, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new gpsCmdMsg using the given byte array
* as backing store.
*/
public gpsCmdMsg(byte[] data) {
super(data);
amTypeSet(AM_TYPE);
}
/**
* Create a new gpsCmdMsg using the given byte array
* as backing store, with the given base offset.
*/
public gpsCmdMsg(byte[] data, int base_offset) {
super(data, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new gpsCmdMsg using the given byte array
* as backing store, with the given base offset and data length.
*/
public gpsCmdMsg(byte[] data, int base_offset, int data_length) {
super(data, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new gpsCmdMsg embedded in the given message
* at the given base offset.
*/
public gpsCmdMsg(net.tinyos.message.Message msg, int base_offset) {
super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/**
* Create a new gpsCmdMsg embedded in the given message
* at the given base offset and length.
*/
public gpsCmdMsg(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 <gpsCmdMsg> \n";
try {
s += " [seqno=0x"+Long.toHexString(get_seqno())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [action=0x"+Long.toHexString(get_action())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [source=0x"+Long.toHexString(get_source())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [hop_count=0x"+Long.toHexString(get_hop_count())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [args.ss_args.nsamples=0x"+Long.toHexString(get_args_ss_args_nsamples())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [args.ss_args.interval=0x"+Long.toHexString(get_args_ss_args_interval())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [args.rl_args.destaddr=0x"+Long.toHexString(get_args_rl_args_destaddr())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
return s;
}
// Message-type-specific access methods appear below.
/////////////////////////////////////////////////////////
// Accessor methods for field: seqno
// Field type: byte
// Offset (bits): 0
// Size (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'seqno' is signed (false).
*/
public static boolean isSigned_seqno() {
return false;
}
/**
* Return whether the field 'seqno' is an array (false).
*/
public static boolean isArray_seqno() {
return false;
}
/**
* Return the offset (in bytes) of the field 'seqno'
*/
public static int offset_seqno() {
return (0 / 8);
}
/**
* Return the offset (in bits) of the field 'seqno'
*/
public static int offsetBits_seqno() {
return 0;
}
/**
* Return the value (as a byte) of the field 'seqno'
*/
public byte get_seqno() {
return (byte)getSIntElement(offsetBits_seqno(), 8);
}
/**
* Set the value of the field 'seqno'
*/
public void set_seqno(byte value) {
setSIntElement(offsetBits_seqno(), 8, value);
}
/**
* Return the size, in bytes, of the field 'seqno'
*/
public static int size_seqno() {
return (8 / 8);
}
/**
* Return the size, in bits, of the field 'seqno'
*/
public static int sizeBits_seqno() {
return 8;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: action
// Field type: byte
// Offset (bits): 8
// Size (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'action' is signed (false).
*/
public static boolean isSigned_action() {
return false;
}
/**
* Return whether the field 'action' is an array (false).
*/
public static boolean isArray_action() {
return false;
}
/**
* Return the offset (in bytes) of the field 'action'
*/
public static int offset_action() {
return (8 / 8);
}
/**
* Return the offset (in bits) of the field 'action'
*/
public static int offsetBits_action() {
return 8;
}
/**
* Return the value (as a byte) of the field 'action'
*/
public byte get_action() {
return (byte)getSIntElement(offsetBits_action(), 8);
}
/**
* Set the value of the field 'action'
*/
public void set_action(byte value) {
setSIntElement(offsetBits_action(), 8, value);
}
/**
* Return the size, in bytes, of the field 'action'
*/
public static int size_action() {
return (8 / 8);
}
/**
* Return the size, in bits, of the field 'action'
*/
public static int sizeBits_action() {
return 8;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: source
// Field type: int
// Offset (bits): 16
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'source' is signed (false).
*/
public static boolean isSigned_source() {
return false;
}
/**
* Return whether the field 'source' is an array (false).
*/
public static boolean isArray_source() {
return false;
}
/**
* Return the offset (in bytes) of the field 'source'
*/
public static int offset_source() {
return (16 / 8);
}
/**
* Return the offset (in bits) of the field 'source'
*/
public static int offsetBits_source() {
return 16;
}
/**
* Return the value (as a int) of the field 'source'
*/
public int get_source() {
return (int)getUIntElement(offsetBits_source(), 16);
}
/**
* Set the value of the field 'source'
*/
public void set_source(int value) {
setUIntElement(offsetBits_source(), 16, value);
}
/**
* Return the size, in bytes, of the field 'source'
*/
public static int size_source() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'source'
*/
public static int sizeBits_source() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: hop_count
// Field type: short
// Offset (bits): 32
// Size (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'hop_count' is signed (false).
*/
public static boolean isSigned_hop_count() {
return false;
}
/**
* Return whether the field 'hop_count' is an array (false).
*/
public static boolean isArray_hop_count() {
return false;
}
/**
* Return the offset (in bytes) of the field 'hop_count'
*/
public static int offset_hop_count() {
return (32 / 8);
}
/**
* Return the offset (in bits) of the field 'hop_count'
*/
public static int offsetBits_hop_count() {
return 32;
}
/**
* Return the value (as a short) of the field 'hop_count'
*/
public short get_hop_count() {
return (short)getUIntElement(offsetBits_hop_count(), 8);
}
/**
* Set the value of the field 'hop_count'
*/
public void set_hop_count(short value) {
setUIntElement(offsetBits_hop_count(), 8, value);
}
/**
* Return the size, in bytes, of the field 'hop_count'
*/
public static int size_hop_count() {
return (8 / 8);
}
/**
* Return the size, in bits, of the field 'hop_count'
*/
public static int sizeBits_hop_count() {
return 8;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: args.ss_args.nsamples
// Field type: short
// Offset (bits): 40
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'args.ss_args.nsamples' is signed (false).
*/
public static boolean isSigned_args_ss_args_nsamples() {
return false;
}
/**
* Return whether the field 'args.ss_args.nsamples' is an array (false).
*/
public static boolean isArray_args_ss_args_nsamples() {
return false;
}
/**
* Return the offset (in bytes) of the field 'args.ss_args.nsamples'
*/
public static int offset_args_ss_args_nsamples() {
return (40 / 8);
}
/**
* Return the offset (in bits) of the field 'args.ss_args.nsamples'
*/
public static int offsetBits_args_ss_args_nsamples() {
return 40;
}
/**
* Return the value (as a short) of the field 'args.ss_args.nsamples'
*/
public short get_args_ss_args_nsamples() {
return (short)getSIntElement(offsetBits_args_ss_args_nsamples(), 16);
}
/**
* Set the value of the field 'args.ss_args.nsamples'
*/
public void set_args_ss_args_nsamples(short value) {
setSIntElement(offsetBits_args_ss_args_nsamples(), 16, value);
}
/**
* Return the size, in bytes, of the field 'args.ss_args.nsamples'
*/
public static int size_args_ss_args_nsamples() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'args.ss_args.nsamples'
*/
public static int sizeBits_args_ss_args_nsamples() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: args.ss_args.interval
// Field type: long
// Offset (bits): 56
// Size (bits): 32
/////////////////////////////////////////////////////////
/**
* Return whether the field 'args.ss_args.interval' is signed (false).
*/
public static boolean isSigned_args_ss_args_interval() {
return false;
}
/**
* Return whether the field 'args.ss_args.interval' is an array (false).
*/
public static boolean isArray_args_ss_args_interval() {
return false;
}
/**
* Return the offset (in bytes) of the field 'args.ss_args.interval'
*/
public static int offset_args_ss_args_interval() {
return (56 / 8);
}
/**
* Return the offset (in bits) of the field 'args.ss_args.interval'
*/
public static int offsetBits_args_ss_args_interval() {
return 56;
}
/**
* Return the value (as a long) of the field 'args.ss_args.interval'
*/
public long get_args_ss_args_interval() {
return (long)getUIntElement(offsetBits_args_ss_args_interval(), 32);
}
/**
* Set the value of the field 'args.ss_args.interval'
*/
public void set_args_ss_args_interval(long value) {
setUIntElement(offsetBits_args_ss_args_interval(), 32, value);
}
/**
* Return the size, in bytes, of the field 'args.ss_args.interval'
*/
public static int size_args_ss_args_interval() {
return (32 / 8);
}
/**
* Return the size, in bits, of the field 'args.ss_args.interval'
*/
public static int sizeBits_args_ss_args_interval() {
return 32;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: args.rl_args.destaddr
// Field type: int
// Offset (bits): 40
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'args.rl_args.destaddr' is signed (false).
*/
public static boolean isSigned_args_rl_args_destaddr() {
return false;
}
/**
* Return whether the field 'args.rl_args.destaddr' is an array (false).
*/
public static boolean isArray_args_rl_args_destaddr() {
return false;
}
/**
* Return the offset (in bytes) of the field 'args.rl_args.destaddr'
*/
public static int offset_args_rl_args_destaddr() {
return (40 / 8);
}
/**
* Return the offset (in bits) of the field 'args.rl_args.destaddr'
*/
public static int offsetBits_args_rl_args_destaddr() {
return 40;
}
/**
* Return the value (as a int) of the field 'args.rl_args.destaddr'
*/
public int get_args_rl_args_destaddr() {
return (int)getUIntElement(offsetBits_args_rl_args_destaddr(), 16);
}
/**
* Set the value of the field 'args.rl_args.destaddr'
*/
public void set_args_rl_args_destaddr(int value) {
setUIntElement(offsetBits_args_rl_args_destaddr(), 16, value);
}
/**
* Return the size, in bytes, of the field 'args.rl_args.destaddr'
*/
public static int size_args_rl_args_destaddr() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'args.rl_args.destaddr'
*/
public static int sizeBits_args_rl_args_destaddr() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: args.untyped_args
// Field type: short[]
// Offset (bits): 40
// Size of each element (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'args.untyped_args' is signed (false).
*/
public static boolean isSigned_args_untyped_args() {
return false;
}
/**
* Return whether the field 'args.untyped_args' is an array (true).
*/
public static boolean isArray_args_untyped_args() {
return true;
}
/**
* Return the offset (in bytes) of the field 'args.untyped_args'
*/
public static int offset_args_untyped_args(int index1) {
int offset = 40;
if (index1 < 0) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 8;
return (offset / 8);
}
/**
* Return the offset (in bits) of the field 'args.untyped_args'
*/
public static int offsetBits_args_untyped_args(int index1) {
int offset = 40;
if (index1 < 0) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 8;
return offset;
}
/**
* Return the entire array 'args.untyped_args' as a short[]
*/
public short[] get_args_untyped_args() {
throw new IllegalArgumentException("Cannot get field as array - unknown size");
}
/**
* Set the contents of the array 'args.untyped_args' from the given short[]
*/
public void set_args_untyped_args(short[] value) {
for (int index0 = 0; index0 < value.length; index0++) {
setElement_args_untyped_args(index0, value[index0]);
}
}
/**
* Return an element (as a short) of the array 'args.untyped_args'
*/
public short getElement_args_untyped_args(int index1) {
return (short)getUIntElement(offsetBits_args_untyped_args(index1), 8);
}
/**
* Set an element of the array 'args.untyped_args'
*/
public void setElement_args_untyped_args(int index1, short value) {
setUIntElement(offsetBits_args_untyped_args(index1), 8, value);
}
/**
* Return the size, in bytes, of each element of the array 'args.untyped_args'
*/
public static int elementSize_args_untyped_args() {
return (8 / 8);
}
/**
* Return the size, in bits, of each element of the array 'args.untyped_args'
*/
public static int elementSizeBits_args_untyped_args() {
return 8;
}
/**
* Return the number of dimensions in the array 'args.untyped_args'
*/
public static int numDimensions_args_untyped_args() {
return 1;
}
/**
* Return the number of elements in the array 'args.untyped_args'
* for the given dimension.
*/
public static int numElements_args_untyped_args(int dimension) {
int array_dims[] = { 0, };
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 'args.untyped_args' with a String
*/
public void setString_args_untyped_args(String s) {
int len = s.length();
int i;
for (i = 0; i < len; i++) {
setElement_args_untyped_args(i, (short)s.charAt(i));
}
setElement_args_untyped_args(i, (short)0); //null terminate
}
/**
* Read the array 'args.untyped_args' as a String
*/
public String getString_args_untyped_args() {
char carr[] = new char[net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH];
int i;
for (i = 0; i < carr.length; i++) {
if ((char)getElement_args_untyped_args(i) == (char)0) break;
carr[i] = (char)getElement_args_untyped_args(i);
}
return new String(carr,0,i);
}
}
|