/***********************************************************************
**
**   hwinfo.h 
**
**   This file is part of Cumulus.
**
************************************************************************
**
**   Copyright (c):  2004 by Eckhard Völlm 
**
**   This file is distributed under the terms of the General Public
**   Licence. See the file COPYING for more information.
**
**   $Id: hwinfo.h,v 1.10 2005/02/13 14:56:40 axel Exp $
**
***********************************************************************/

#define PATH_PROC_CPUINFO  "/proc/cpuinfo"
#define PATH_PROC_MEMINFO "/proc/meminfo"
/* This number (0,5 MB in KB) is substracted from the amount of free space
    on the heap, to allow for memoryfragmentation. It may need to be
    adjusted, but first experiments show that this would be a reasonable
    factor. The free space on the heap can most often not be fully used,
    because one can't put large memoryblocks in small holes. Continious
    creating and deleting of objects leads to memory fragmentation, resulting
    in some free memory on the heap that in effect can't be put to use. */
#define HEAP_FRAGMENTATION_FACTOR 256 
#define PATH_CF_INFO	"/var/lib/pcmcia/stab"

// Path under OpenZaurus
#define PATH_CF_INFO1	"/var/run/stab"

/**
 * @short Returns the type of underlying hardware
 * @author Eckhard Völlm
 *
 * This class is used for all hardware depending-functions. It can
 * return things like the type of device, and other usefull hardware
 * information.
 */

class HwInfo
{
public:
    enum hwType
    {
      unknown,
      desktop,
      ipaq,
      sharp,
      simpad,
      journada,
      ramses
    };

    /**
     * @returns the instance of the class, and creates an instance if there was none.
     */
    static HwInfo * instance( void );
    /**
     * @returns the type of hardware device Cumulus is running on.
     */
    hwType getType( void ) { return _hwType; };
    /**
     * @returns the hardware device string Cumulus is running on.
     */
    const QString getTypeString( void ) { return _hwString; };
    /**
     * Reads the still usable memory (free + cache + buffers) from /proc/meminfo
     * @returns the usable memory in kB.
     */
    int getFreeMemory();
    /**
     * Reads /var/lib/pcmcia/stab to find out the device for the CF GPS
     */
    const QString getCfDevice( void );

private:
    /**
     * Because this is a singleton, the constructor is private!
     */
    HwInfo();
    ~HwInfo();
    static HwInfo *theInstance;
    enum hwType _hwType;
    QString _hwString;
};

#define HWINFO HwInfo::instance() 
