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

#ifndef TURNER_CYCLOPS_RHODAMINE_H_
#define TURNER_CYCLOPS_RHODAMINE_H_

#include "component/SyncComponent.h"
#include "io/AnalogToDigital.h"
#include "io/LoadControl.h"

class UniversalDataReader;
class UniversalDataWriter;

/**
 *  Provides software interface to the Keller depth sensor
 *  Can also use SimSlate to provide simulated depth values when
 *  they are available.
 *
 *  Turner_Cyclops_rhodamine.h should only be included by rhodamine.cpp
 *  Other classes should include Turner_Cyclops_rhodamineIF.h
 *
 *  \ingroup modules_sensor
 */
class Turner_Cyclops_rhodamine: public SyncSensorComponent
{
public:
    Turner_Cyclops_rhodamine( const Module* module );
    virtual ~Turner_Cyclops_rhodamine();

    virtual void run();

    /// Do what needs to be done to run
    /// Similar to initialize, in old init/run/uninit sequence
    virtual RunState start();

    /// Might follow a STOP...START sequence
    virtual RunState starting();

    /// Pause for a short period (indicated by pauseTime)
    virtual RunState pause();

    /// Should eventually follow a PAUSE request: should set continueTime
    virtual RunState paused();

    /// Resume from PAUSE
    virtual RunState resume();

    /// Might follow a PAUSE...RESUME sequence
    virtual RunState resuming();

    /// Should eventually follow a START request or RESETTING
    virtual RunState runnable();

    /// Might occur in case of Error
    virtual RunState resetting()
    {
        return start();
    }

    /// Initial state -- can be later followed by START
    virtual RunState stop();

    virtual RunState stopping();

    /// Initial state -- can be later followed by START
    virtual RunState stopped();


    /// 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.
    Turner_Cyclops_rhodamine( const Turner_Cyclops_rhodamine& old ); // disallow copy constructor

    ConfigReader* concentrationStandardCfgReader_;
    ConfigReader* voltsStandardCfgReader_;
    ConfigReader* voltsBlankCfgReader_;
    ConfigReader* maxBoundCfgReader_;
    ConfigReader* minBoundCfgReader_;
    ConfigReader* scaleCfgReader_;

    UniversalDataWriter* rhodamineWriter_;
    DataWriter* adcCountWriter_;
    DataWriter* rhodamineVoltsWriter_;

    // the pressure reading is out of bounds. We only want to report the error once
    bool boundingError_;

    float concentrationStandardCfg_;
    float voltsStandardCfg_;
    float voltsBlankCfg_;
    float maxBoundCfg_;
    float minBoundCfg_;
    float scale_;

    AnalogToDigital analogToDigital_;

    LoadControl loadControl_;

    bool readConfig();


    // returns true if data is requested from one of the readers
    bool isDataRequested();

    // Debugging outputs
    bool debug_;


};

#endif /* DEPTH_Keller_H_ */
