EDU.gatech.cc.is.abstractrobot
Class TransceiverSim

java.lang.Object
  |
  +--EDU.gatech.cc.is.abstractrobot.TransceiverSim

public class TransceiverSim
extends java.lang.Object

Implements the Transceiver interface. You can use objects of this class in your simulated robot code to easily implement the Transceiver interface for the robot.

Copyright (c)1997, 1998 Tucker Balch


Field Summary
static int BUF_SIZE
          The maximum number of messages the receive buffer can hold.
static boolean DEBUG
           
 
Constructor Summary
TransceiverSim(SimulatedObject rs, Simple r)
          Instantiate a TransceiverSim object.
 
Method Summary
 void broadcast(Message m, SimulatedObject[] all_objects)
          Transmit a message to all teammates but self.
 boolean connected()
          Check to see if the transceiver is connected to the server.
 CircularBufferEnumeration getReceiveChannel()
          Get an enumeration of the incoming messages.
 void multicast(int[] ids, Message m, SimulatedObject[] all_objects)
          Transmit a message to a list of teammates.
 void receive(Message m)
          Receive a message.
 void setCommunicationMaxRange(double range)
          Set the maximum range at which a sensor reading should be considered kin.
 void unicast(int id, Message m, SimulatedObject[] all_objects)
          Transmit a message to just one teammate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUF_SIZE

public static final int BUF_SIZE
The maximum number of messages the receive buffer can hold.

DEBUG

public static final boolean DEBUG
Constructor Detail

TransceiverSim

public TransceiverSim(SimulatedObject rs,
                      Simple r)
Instantiate a TransceiverSim object.
Parameters:
r - SimulatedObject, the robot on which the Transceiver resides.
Method Detail

multicast

public void multicast(int[] ids,
                      Message m,
                      SimulatedObject[] all_objects)
               throws CommunicationException
Transmit a message to a list of teammates. Transmission to self allowed.
Parameters:
ids - int[], the IDs of the agents to receive the message.
m - Message, the message to transmit.
Throws:
CommunicationException - if one of the receiving agents does not exist.

broadcast

public void broadcast(Message m,
                      SimulatedObject[] all_objects)
Transmit a message to all teammates but self.
Parameters:
m - Message, the message to transmit.

unicast

public void unicast(int id,
                    Message m,
                    SimulatedObject[] all_objects)
             throws CommunicationException
Transmit a message to just one teammate. Transmission to self is allowed.
Parameters:
id - int, the ID of the agent to receive the message.
m - Message, the message to transmit.
Throws:
CommunicationException - if the receiving agent does not exist.

getReceiveChannel

public CircularBufferEnumeration getReceiveChannel()
Get an enumeration of the incoming messages. The messages are automatically buffered by the implementation. You cannot count on all messages being delivered, unless you read them as fast as they arrive.
Returns:
the Enumeration.

receive

public void receive(Message m)
Receive a message.
Parameters:
m - the message.

setCommunicationMaxRange

public void setCommunicationMaxRange(double range)
Set the maximum range at which a sensor reading should be considered kin. Beyond this range, the readings are ignored.
Parameters:
range - the range in meters.

connected

public boolean connected()
Check to see if the transceiver is connected to the server.