[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/SystemCore/MementoMori/java
PrintFailed.class, NONE, 1.1 PrintFailed.java, NONE,
1.1 RosterMsg.class, NONE, 1.1 RosterMsg.java, NONE, 1.1
Stan Rost
stanrost at users.sourceforge.net
Thu Oct 14 07:42:54 PDT 2004
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/SystemCore/MementoMori/java - New directory
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/SystemCore/MementoMori
PacketTypes.h, NONE, 1.1 AggressiveSendControl.nc, 1.1,
1.2 AggressiveSendM.nc, 1.3, 1.4 CompressedSet.h, 1.4,
1.5 ExptM.nc, 1.2, 1.3 RollCallC.nc, 1.4, 1.5 RollCallM.nc,
1.5, 1.6 failureSched.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/SystemCore/MementoMori/java
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1966/java
Added Files:
PrintFailed.class PrintFailed.java RosterMsg.class
RosterMsg.java
Log Message:
- RollCallM
- Now preventing stale liveness information
from contaminating the network
- Improved stats accounting
- Padding the live set size to 1 (if originally 0)
to make SerialForwarder happy
- Abstracted packet types into headers, Java counterparts
- AggressiveSendControl:
- Added callback to allow retransmission accounting
--- NEW FILE: PrintFailed.class ---
Êþº¾
SourceFile
Count =
Y·
Y·
Y·
Y·
--- NEW FILE: PrintFailed.java ---
import net.tinyos.util.*;
import net.tinyos.message.*;
public class PrintFailed implements MessageListener {
MoteIF mote;
PrintFailed() {
// OK, connect to the serial forwarder and start receiving data
mote = new MoteIF(PrintStreamMessenger.err);
mote.registerListener(new RosterMsg(), this);
}
/**
* This method is called to signal message reception. to is
* the destination of message m.
* @param to the destination of the message (Note: to is only valid
* when using TOSBase base stations)
* @param m the received message
*/
public void messageReceived(int to, Message m) {
if (m instanceof RosterMsg) {
RosterMsg rm = (RosterMsg)m;
int i, j, moteID = 0, cnt = 0, byteLen;
short curByte;
System.out.print("Received message (round = "
+ rm.get_round() +
", compressed = "
+ rm.get_alive_compressed() +
", len = "
+ rm.get_alive_len() + ") ");
byteLen = rm.get_alive_len();
for (i = 0; i < byteLen; i++) {
curByte = rm.getElement_alive_data(i);
for (j = 0; j < 8; j++) {
if ((curByte & (1 << j)) != 0) {
cnt++;
System.out.print(moteID + " ");
}
moteID++;
}
}
System.out.println("\nCount = "+cnt);
} else {
throw new RuntimeException("messageReceived: Got bad message type: "
+m);
}
}
static PrintFailed pf;
public static void main(String[] args) {
pf = new PrintFailed();
}
}
--- NEW FILE: RosterMsg.class ---
Êþº¾
size_round
SourceFile
+¶
+¶
+¶
»
YOL
!¶
--- NEW FILE: RosterMsg.java ---
import net.tinyos.util.*;
import net.tinyos.message.*;
/**
* This class is automatically generated by mig. DO NOT EDIT THIS FILE.
* This class implements a Java interface to the 'RosterMsg'
* message type.
*/
public class RosterMsg extends net.tinyos.message.Message {
/** The default size of this message type in bytes. */
public static final int DEFAULT_MESSAGE_SIZE = 4;
/** The Active Message type associated with this message. */
public static final int AM_TYPE = 215;
/** Create a new RosterMsg of size 4. */
public RosterMsg() {
super(DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/** Create a new RosterMsg of the given data_length. */
public RosterMsg(int data_length) {
super(data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new RosterMsg with the given data_length
* and base offset.
*/
public RosterMsg(int data_length, int base_offset) {
super(data_length, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new RosterMsg using the given byte array
* as backing store.
*/
public RosterMsg(byte[] data) {
super(data);
amTypeSet(AM_TYPE);
}
/**
* Create a new RosterMsg using the given byte array
* as backing store, with the given base offset.
*/
public RosterMsg(byte[] data, int base_offset) {
super(data, base_offset);
amTypeSet(AM_TYPE);
}
/**
* Create a new RosterMsg using the given byte array
* as backing store, with the given base offset and data length.
*/
public RosterMsg(byte[] data, int base_offset, int data_length) {
super(data, base_offset, data_length);
amTypeSet(AM_TYPE);
}
/**
* Create a new RosterMsg embedded in the given message
* at the given base offset.
*/
public RosterMsg(net.tinyos.message.Message msg, int base_offset) {
super(msg, base_offset, DEFAULT_MESSAGE_SIZE);
amTypeSet(AM_TYPE);
}
/**
* Create a new RosterMsg embedded in the given message
* at the given base offset and length.
*/
public RosterMsg(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 <RosterMsg> \n";
try {
s += " [round=0x"+Long.toHexString(get_round())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [alive.compressed=0x"+Long.toHexString(get_alive_compressed())+"]\n";
} catch (ArrayIndexOutOfBoundsException aioobe) { /* Skip field */ }
try {
s += " [alive.len=0x"+Long.toHexString(get_alive_len())+"]\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: round
// Field type: int
// Offset (bits): 0
// Size (bits): 16
/////////////////////////////////////////////////////////
/**
* Return whether the field 'round' is signed (false).
*/
public static boolean isSigned_round() {
return false;
}
/**
* Return whether the field 'round' is an array (false).
*/
public static boolean isArray_round() {
return false;
}
/**
* Return the offset (in bytes) of the field 'round'
*/
public static int offset_round() {
return (0 / 8);
}
/**
* Return the offset (in bits) of the field 'round'
*/
public static int offsetBits_round() {
return 0;
}
/**
* Return the value (as a int) of the field 'round'
*/
public int get_round() {
return (int)getUIntElement(offsetBits_round(), 16);
}
/**
* Set the value of the field 'round'
*/
public void set_round(int value) {
setUIntElement(offsetBits_round(), 16, value);
}
/**
* Return the size, in bytes, of the field 'round'
*/
public static int size_round() {
return (16 / 8);
}
/**
* Return the size, in bits, of the field 'round'
*/
public static int sizeBits_round() {
return 16;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: alive.compressed
// Field type: byte
// Offset (bits): 16
// Size (bits): 1
/////////////////////////////////////////////////////////
/**
* Return whether the field 'alive.compressed' is signed (false).
*/
public static boolean isSigned_alive_compressed() {
return false;
}
/**
* Return whether the field 'alive.compressed' is an array (false).
*/
public static boolean isArray_alive_compressed() {
return false;
}
/**
* Return the offset (in bytes) of the field 'alive.compressed'
*/
public static int offset_alive_compressed() {
return (16 / 8);
}
/**
* Return the offset (in bits) of the field 'alive.compressed'
*/
public static int offsetBits_alive_compressed() {
return 16;
}
/**
* Return the value (as a byte) of the field 'alive.compressed'
*/
public byte get_alive_compressed() {
return (byte)getUIntElement(offsetBits_alive_compressed(), 1);
}
/**
* Set the value of the field 'alive.compressed'
*/
public void set_alive_compressed(byte value) {
setUIntElement(offsetBits_alive_compressed(), 1, value);
}
/**
* Return the size, in bytes, of the field 'alive.compressed'
* WARNING: This field is not an even-sized number of bytes (1 bits).
*/
public static int size_alive_compressed() {
return (1 / 8) + 1;
}
/**
* Return the size, in bits, of the field 'alive.compressed'
*/
public static int sizeBits_alive_compressed() {
return 1;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: alive.len
// Field type: byte
// Offset (bits): 17
// Size (bits): 7
/////////////////////////////////////////////////////////
/**
* Return whether the field 'alive.len' is signed (false).
*/
public static boolean isSigned_alive_len() {
return false;
}
/**
* Return whether the field 'alive.len' is an array (false).
*/
public static boolean isArray_alive_len() {
return false;
}
/**
* Return the offset (in bytes) of the field 'alive.len'
*/
public static int offset_alive_len() {
return (17 / 8);
}
/**
* Return the offset (in bits) of the field 'alive.len'
*/
public static int offsetBits_alive_len() {
return 17;
}
/**
* Return the value (as a byte) of the field 'alive.len'
*/
public byte get_alive_len() {
return (byte)getUIntElement(offsetBits_alive_len(), 7);
}
/**
* Set the value of the field 'alive.len'
*/
public void set_alive_len(byte value) {
setUIntElement(offsetBits_alive_len(), 7, value);
}
/**
* Return the size, in bytes, of the field 'alive.len'
* WARNING: This field is not an even-sized number of bytes (7 bits).
*/
public static int size_alive_len() {
return (7 / 8) + 1;
}
/**
* Return the size, in bits, of the field 'alive.len'
*/
public static int sizeBits_alive_len() {
return 7;
}
/////////////////////////////////////////////////////////
// Accessor methods for field: alive.data
// Field type: short[]
// Offset (bits): 24
// Size of each element (bits): 8
/////////////////////////////////////////////////////////
/**
* Return whether the field 'alive.data' is signed (false).
*/
public static boolean isSigned_alive_data() {
return false;
}
/**
* Return whether the field 'alive.data' is an array (true).
*/
public static boolean isArray_alive_data() {
return true;
}
/**
* Return the offset (in bytes) of the field 'alive.data'
*/
public static int offset_alive_data(int index1) {
int offset = 24;
if (index1 < 0) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 8;
return (offset / 8);
}
/**
* Return the offset (in bits) of the field 'alive.data'
*/
public static int offsetBits_alive_data(int index1) {
int offset = 24;
if (index1 < 0) throw new ArrayIndexOutOfBoundsException();
offset += 0 + index1 * 8;
return offset;
}
/**
* Return the entire array 'alive.data' as a short[]
*/
public short[] get_alive_data() {
throw new IllegalArgumentException("Cannot get field as array - unknown size");
}
/**
* Set the contents of the array 'alive.data' from the given short[]
*/
public void set_alive_data(short[] value) {
for (int index0 = 0; index0 < value.length; index0++) {
setElement_alive_data(index0, value[index0]);
}
}
/**
* Return an element (as a short) of the array 'alive.data'
*/
public short getElement_alive_data(int index1) {
return (short)getUIntElement(offsetBits_alive_data(index1), 8);
}
/**
* Set an element of the array 'alive.data'
*/
public void setElement_alive_data(int index1, short value) {
setUIntElement(offsetBits_alive_data(index1), 8, value);
}
/**
* Return the size, in bytes, of each element of the array 'alive.data'
*/
public static int elementSize_alive_data() {
return (8 / 8);
}
/**
* Return the size, in bits, of each element of the array 'alive.data'
*/
public static int elementSizeBits_alive_data() {
return 8;
}
/**
* Return the number of dimensions in the array 'alive.data'
*/
public static int numDimensions_alive_data() {
return 1;
}
/**
* Return the number of elements in the array 'alive.data'
* for the given dimension.
*/
public static int numElements_alive_data(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 'alive.data' with a String
*/
public void setString_alive_data(String s) {
int len = s.length();
int i;
for (i = 0; i < len; i++) {
setElement_alive_data(i, (short)s.charAt(i));
}
setElement_alive_data(i, (short)0); //null terminate
}
/**
* Read the array 'alive.data' as a String
*/
public String getString_alive_data() {
char carr[] = new char[net.tinyos.message.Message.MAX_CONVERTED_STRING_LENGTH];
int i;
for (i = 0; i < carr.length; i++) {
if ((char)getElement_alive_data(i) == (char)0) break;
carr[i] = (char)getElement_alive_data(i);
}
return new String(carr,0,i);
}
}
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/SystemCore/MementoMori/java - New directory
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/SystemCore/MementoMori
PacketTypes.h, NONE, 1.1 AggressiveSendControl.nc, 1.1,
1.2 AggressiveSendM.nc, 1.3, 1.4 CompressedSet.h, 1.4,
1.5 ExptM.nc, 1.2, 1.3 RollCallC.nc, 1.4, 1.5 RollCallM.nc,
1.5, 1.6 failureSched.h, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list