Radio[] destinations = conn.getDestinations();
if (destinations != null && destinations.length > 0) {
for (int i = 0; i < destinations.length; i++) {
// Source pos
out.write("SRC_POS\t".getBytes());
Position pos = conn.getSource().getPosition();
out.write(Double.toString(pos.getXCoordinate()).getBytes());
out.write("\t".getBytes());
out.write(Double.toString(pos.getYCoordinate()).getBytes());
out.write("\t".getBytes());
out.write(Double.toString(pos.getZCoordinate()).getBytes());
out.write("\t".getBytes());
// Source data
out.write("SRC_DATA\t".getBytes());
// TODO We need to log destination data again...
for (byte b : ((PacketRadio) conn.getSource())
.getLastPacketTransmitted()) {
String hexString = Integer.toHexString((int) b);
if (hexString.length() == 1)
hexString = "0" + hexString;
out.write(hexString.getBytes());
}
out.write("\t".getBytes());
// Destination pos
out.write("DEST_POS\t".getBytes());
pos = destinations[i].getPosition();
out.write(Double.toString(pos.getXCoordinate()).getBytes());
out.write("\t".getBytes());
out.write(Double.toString(pos.getYCoordinate()).getBytes());
out.write("\t".getBytes());
out.write(Double.toString(pos.getZCoordinate()).getBytes());
out.write("\t".getBytes());
// Source data
out.write("DEST_DATA\t".getBytes());
// TODO We need to log destination data again...
for (byte b : ((PacketRadio) destinations[i])
.getLastPacketReceived()) {
String hexString = Integer.toHexString((int) b);
if (hexString.length() == 1)
hexString = "0" + hexString;
out.write(hexString.getBytes());
}
out.write("\t".getBytes());
out.write("\n".getBytes());
}
} else {
// Source pos
out.write("SRC_POS\t".getBytes());
Position pos = conn.getSource().getPosition();
out.write(Double.toString(pos.getXCoordinate()).getBytes());
out.write("\t".getBytes());
out.write(Double.toString(pos.getYCoordinate()).getBytes());
out.write("\t".getBytes());
out.write(Double.toString(pos.getZCoordinate()).getBytes());
out.write("\t".getBytes());
// Source data
out.write("SRC_DATA\t".getBytes());
// TODO We need to log destination data again...