/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IWSENS_SENSOR_H
#define __IWSENS_SENSOR_H

#ifndef __IWEAR_CONSTANTS_H
#include <iwear/constants.h>
#endif

#ifndef __IWEAR_MODULE_H
#include <iwear/module.h>
#endif

#ifndef __IWSENS_SENSOR_ENUM_H
#include <iwsens/sensor_enum.h>
#endif

namespace iwear 
{
namespace sensor
{
/// forward declaration    
class SensorManager;

/**
 * The Sensor itself is just a hirachial placeholder to derive from, so the
 * SensorManager can handle them. No class should directly derive from it,
 * rather then from the IWLocator or DataSensor classes.
 */
class Sensor: public Module
{
    friend class SensorManager;
public:
    /**
     * A caller *must* provide a valid pointer to a sensor manager.
     */
    Sensor( SensorManager* sensman );

    /**
     * Every sensor can be of a specific type, defined via enum sensor_type
     * defined in sensor_enums.h. Currently there are only locator and
     * data_sensor, and its not planned to add more. See there for what to
     * use.
     */
    virtual sensor_type get_sensor_type( void ) const = 0;

    /**
     * We are a Sensor Module. So we tell it.
     */
    virtual module_type get_module_type( void ) const { return sensor_module; }

    bool is_authorative( void ) const { return authorative; }
    void set_authorative( bool s = true ) { authorative = s; }

    /**
     * This function returns true if the next check of the sensor would return
     * a reliable value. If it returns yes, then getting some data from this
     * sensor may not throw an error. If its false, then it may throw an error,
     * but the sensorhandler/sensormanager checks will not be done any more at
     * this point.
     */
//    bool is_available( void ) const = 0;
protected:
    /**
     * We need to keep track of the SensorManager to deregister there at
     * destruction time...
     */
    SensorManager* SensMan;
    /**
     * This is true if the sensor is authorative and should be used for its
     * type reference. Its usually false for all network bound sensors since we
     * usually dont want to include them in our data-mixture.
     */
    bool authorative : 1;
private:
};
}
}
#endif

