All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.gatech.cc.is.communication.TransceiverHard

java.lang.Object
   |
   +----EDU.gatech.cc.is.communication.TransceiverHard

public class TransceiverHard
extends Object
implements Transceiver, Runnable
The TransceiverHard class implements the Transceiver interface so a robot can communicate.

Copyright (c)1998 Tucker Balch

Version:
$Revision: 1.2 $
Author:
Tucker Balch

Variable Index

 o BUF_SIZE
The maximum number of messages the receive buffer can hold.

Constructor Index

 o TransceiverHard(String, int)
Make a real transceiver object.

Method Index

 o broadcast(Message)
Broadcast a message to all teammates, except self.
 o connected()
Check to see if the transceiver is connected to the server.
 o getReceiveChannel()
Get an enumeration of the incoming messages.
 o main(String[])
Code to test the communication system.
 o multicast(int[], Message)
Transmit a message to specific teammates.
 o quit()
quit.
 o run()
Thread to monitor incoming messages.
 o setCommunicationMaxRange(double)
NOT IMPLEMENTED Set the maximum range at which communication can occur.
 o unicast(int, Message)
Transmit a message to just one teammate.

Variables

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

Constructors

 o TransceiverHard
 public TransceiverHard(String s,
                        int i)
Make a real transceiver object.

Parameters:
s - String, the server host.
i - int, the robot id.

Methods

 o run
 public void run()
Thread to monitor incoming messages.

 o broadcast
 public void broadcast(Message m)
Broadcast a message to all teammates, except self.

Parameters:
m - Message, the message to be broadcast.
 o unicast
 public void unicast(int i,
                     Message m) throws CommunicationException
Transmit a message to just one teammate. Transmission to self is allowed.

Parameters:
i - 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.
 o multicast
 public void multicast(int ids[],
                       Message m) throws CommunicationException
Transmit a message to specific teammates. Transmission to self is 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. NOT IMPLEMENTED.
 o getReceiveChannel
 public Enumeration getReceiveChannel()
Get an enumeration of the incoming messages. The messages are automatically buffered for you. Since this is implemented as a circular you cannot count on all messages being delivered unless you read from the buffer faster than messages are received. Example, to print all incoming messages:
 Transceiver c = new TranscieverHard();
 Enumeration r = c.getReceiveChannel();
 while (r.hasMoreElements())
 	System.out.println(r.nextElement());
 

Returns:
the Enumeration.
 o setCommunicationMaxRange
 public void setCommunicationMaxRange(double r)
NOT IMPLEMENTED Set the maximum range at which communication can occur. In simulation, this corresponds to a simulation of physical limits, on mobile robots it corresponds to a signal strength setting.

Parameters:
r - double, the maximum range.
 o connected
 public boolean connected()
Check to see if the transceiver is connected to the server.

 o quit
 public void quit()
quit.

 o main
 public static void main(String args[])
Code to test the communication system.


All Packages  Class Hierarchy  This Package  Previous  Next  Index