/** \file
 *
 *  Contains the DropWeight class declaration.
 *
 *  DropWeight.h should only be included by DropWeight.cpp
 *  Other classes should include DropWeightIF.h
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#ifndef DROPWEIGHT_H
#define DROPWEIGHT_H

#include "component/SyncComponent.h"
#include "io/UartStream.h"
#include "logger/Logger.h"

/**
 *  Provides software interface to the DVL Micro.
 *
 *  \ingroup modules_sensor
 */


class DropWeight : public SyncSensorComponent
{
public:

    DropWeight( const Module* module );

    virtual ~DropWeight();

    void initialize();

    // The actual "payload" of the component
    void run();

    void uninitialize();

    /// Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc
    virtual ConfigURI getConfigURI( ConfigOption configOption ) const;

private:

    // Note that the copy constructor below is private and not given a body.
    // Any attempt to call it will return a compiler error.
    DropWeight( const DropWeight& old ); // disallow copy constructor

    /// Sets the state of the drop weight - True == present, False == non present
    DataWriter* dropWeightStateWriter_;

    int dropWeightOK_;

    Timestamp countdownTimer_;

    // Holds the time of when dropweight scanning was started
    Timestamp startTime_;
    Timespan dropWeightScanTimeout_;

    typedef enum
    {
        POWERON,   // Activate the sense circuit
        CHECK,     // Check for presence/absence
        POWEROFF,  // De activate the circuit
        DONE,      // All done
    } DropweightSequence;

    DropweightSequence dropweightcheck_;

    // write the state and logs faults if necessary
    void writeAndLog( void );


};
#endif /*DROPWEIGHT_H*/
