/*
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef __PVRUSB2_PVRUSB2DEVICE_H
#define __PVRUSB2_PVRUSB2DEVICE_H

#include "common.h"

enum eControlValue
{
    eControlCurrentValue,
    eControlMinValue,
    eControlMaxValue
};

class cPvrUsb2Device:
    public cRMDevice
{
    private:
        int itemArraySize;
        cRMDeviceItem* deviceItems;

        int videoDeviceId;
        char* videoDeviceName;
        char* videoControlName;
        
    protected:
        // device configuration item functions
        virtual int NumItems();
        virtual eSetupItem Item(int _iterIndex);
        virtual bool IsValidItem(eSetupItem _item) const;
        virtual const char* ItemName(eSetupItem _item) const;
        virtual bool IsCriticalItem(eSetupItem _item);
        virtual const char* ControlName(eControlValue _type) const;

        // device manipulation and interface functions
        virtual int Value(eSetupItem _item, eControlValue _type) const;
        virtual char* StringValue(eSetupItem _item, eControlValue _type) const;
        virtual bool SetValue(eSetupItem _item, int _value);
        virtual bool SetValue(eSetupItem _item, const char* _value);
 
        // helper functions
        virtual char* ReadValue(const char* _path) const;
        virtual const char* VideoDeviceName() { return videoDeviceName; };
        virtual bool SetVideoDevice(int _device);
        virtual int VideoDevice();

    public:
        // initialization
        cPvrUsb2Device(int _index, char* _id);
        virtual ~cPvrUsb2Device();

        // device interface functions
        virtual int MinValue(eSetupItem _item) const;
        virtual int MaxValue(eSetupItem _item) const;
        virtual int CurrentValue(eSetupItem _item) const;

        static const char* DeviceBase() { return "/sys/class/pvrusb2"; };
};

#endif // __PVRUSB2_PVRUSB2DEVICE_H


