package mde.jini.service;

import java.rmi.*;
import net.jini.core.lookup.ServiceID;

/**
 * The TankProxy interface represents the functionality of the LegoMindstorms tank. The tank proxy
 * implementation is a Jini proxy which takes part in the discovery/join protocols, making the 
 * functionality of the tank available as a Jini service.
 */
public interface TankProxy extends Remote {
   
   /** Start a tank proxy with a given tank id and a give set of Jini groups */
   public void startup(byte tankID, String[] groups) throws RemoteException;
   
   /** Shutdown a tank proxy */
   public void shutdown() throws RemoteException;

   /**
    * This method is called to allow clients to register with the tank proxy.  A single client
    * can be registered with the proxy at any one time.
    */
   public boolean register() throws RemoteException;
   
   /** Called by a client to unregister itselft with the proxy, freeing the proxy for another registration. */
   public void unregister() throws RemoteException;

   /** Send a command to the tank (@see TankCommands) */
   public void sendCommand(byte command) throws RemoteException;

   /** Called by the TankDaemon to get the next queued tank command to execute */
   public byte getCommand() throws RemoteException;

   /** Called by the TankDaemon to notify the proxy of tank status changes (@see TankCommands) */
   public void updateStatus(TankEvent e) throws RemoteException;

   /** Called by clients wishing to be notified of TankEvents */ 
   public void addTankEventListener(TankEventListener l) throws RemoteException;

   /** Called by clients not longer interested in receiving TankEvent notifications */
   public void removeTankEventListener(TankEventListener l) throws RemoteException;
   
   /** Returns the id of the tank this proxy is representing */
   public byte getTankID() throws RemoteException;

   /** Returns the Jini service id of this proxy */
   public ServiceID getServiceID() throws RemoteException;
   
}