//=========================================================================
// Summary  : DropWeight Interface File
// Filename : DropWeightIF.idl
// Author   : Marsh
// Project  : DropWeight
// Version  : $Revision: #2 $
// Created  : 04/12/00
// Modified : 2002.03.04 Reed Christenson.  Updated enum Weight.
// Archived :
//=========================================================================
// Modification History:
//=========================================================================

#include "DeviceIF.idl"

interface DropWeightIF : DeviceIF {

     enum Event {
	  Online,
	  Offline,
	  Installed,
	  Released
     };

    // Emergency needs to be assigned an appropriate value.
     enum Weight {
	 Unassigned = 0,
	 Ascend    = 10,
	 Descend   = 13,
	 AbortFire = 15,
	 Emergency
     };

     struct WeightStruct {
	  Name name;
	  boolean isFiring;
	  boolean hasFired;
     };

     /////////////////////////////////////////////////////////
     // This drop weight interface is design around an essentially open
     // interface allowing an arbitrary number of dropweights, each of which 
     // may be identified, queried, and fired.  Later version of the interface
     // may allow storage of additional dropweight parameters, such as weight,
     // time of burn (For manual on/off), etc.
     //
     // For now, the interface assumes a table of weights has been loaded 
     // into the dropWeightServer.  This list is keyed off an integer
     // value ('index') but is also searchable by a string value 'name'.
     // It is incumbent upon the client-side to have name agreement with
     // the 'dropWeight.cfg' -- or to test for the existence of a
     // dropweight before mision launch.
     //

     // Naturally, there is a problem with this: dropweights are
     // specified as a run-time argument.  This allows a certain amount
     // of flexibility (for example, missions could specify a dropweight
     // name as a text string in a parameter to a behavior), it also
     // introduces the danger that a piece of code will request a
     // non-existent drop weight.
     // 

     // To get around this problem, a defacto set of dropweights will
     // be defined as an enumeration, effectively restricting the
     // effetiveness of the open interface, but producing a compile-time
     // error when referencing a non-existent dropweight.  Ideally in the
     // future, some compromise could be reached allowing dropweight
     // users to check for the existence of a weight while still in a
     // state where a users could be warned (i.e. during mission file
     // read-in and check-out).

     /////////////////////////////////////////////////////////
     // Returns the number of dropWeights registered.  Note that the weights
     // themselves are number 'C-style', starting at 0 and going to (count-1)
     short dropWeightCount();

     /////////////////////////////////////////////////////////
     // For a given index number (0 to (count-1)), return the name.
     // If the weight is undefined, the name will be returned unchanged.
     // Returns 0 on success, -1 on failure.
     short findByIndex( in short index, out Name name );

     /////////////////////////////////////////////////////////
     //  For a given name, returns the matching index number.
     // Note this search is case-insensitive.
     // index is set to -1 if the name cannot be found.
     // Returns 0 on success, 1 on failure.
     short findByName( in Name name, out short index );

     /////////////////////////////////////////////////////////
     // Get the whole thing
     short getInfo( in short index, out WeightStruct info );
     short getInfo( in Name name, out WeightStruct info );

     /////////////////////////////////////////////////////////
     // Release drop-weight
     void fire(in short index);
     void fire(in Name name );

     /////////////////////////////////////////////////////////
     // Stop, as necessary
     void unfire( in short index );
     void unfire( in Name name );

     /////////////////////////////////////////////////////////
     // Weight released?
     boolean isFiring(in short index);
     boolean isFiring(in Name name);


     boolean hasFired( in short index );
     boolean hasFired( in Name name );


};
