/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 * In particular this file is part of the (WLAN) Location package
 *
 *
 * 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 __IWLOCATOR_APINFO_H
#define __IWLOCATOR_APINFO_H

#ifndef __IWLOCATOR_WLOCATION_H
#include <iwlocator/wlocation.h>
#endif

namespace iwear 
{
    namespace sensor
    {
	namespace location
	{

class APInfo : public db::dbstorable
{
private:
   /**
    * This is the bssid or MAC of the wireless access point. It should never
    * change.
    */
    string bssid;

   /**
    * The essid (Network Identifier) of the wireless network. Although this may
    * change over time, we assume it fixed here, since we make no real use of
    * it.
    */
    string essid;

   /**
    * A Pointer to a known location. Must not be set, but if set, the AP is there.
    */
    const WLocation* whereami;

    /**
     * Set to true if we may use this ap for positioning.
     */
    bool positioning;
protected:
public:
    inline APInfo( const string& bs, const string& es, const WLocation* w, bool p )
	: bssid(bs),
    	essid(es),
	whereami(w),
	positioning(p)
    { }

    inline bool use_me( void ) const { return positioning; }
    inline const string& get_bssid( void ) const { return bssid; }
    inline const string& get_essid( void ) const { return essid; }
    inline const WLocation* where( void ) const { return whereami; }

    virtual bool SaveToDatabase( const string& tablename, db::db& dbref );
    virtual bool LoadFromDatabase( uint32_t ID, const string& tablename, db::db& dbref );
    virtual bool UpdateToDatabase( const string& tablename, db::db& dbref );

};
}
}
}
#endif
