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

#ifndef __PVRUSB2_CHANNEL_H
#define __PVRUSB2_CHANNEL_H

class cRMChannel:
    public cListObject
{
    private:
        bool modified;
        int startFrequency;
        int frequency;
        int endFrequency;
        int offset;

        tEditableTextBuffer name;

        int channel;

    public:
        cRMChannel(int _frequency);
        cRMChannel(cRMChannel* _channel);
        cRMChannel(cChannel* _channel);

        virtual void SetName(const char* _name);
        virtual const char* Name();
        virtual tEditableTextBuffer& NameReference() { return name; };

        // if no frequency is set it will say yes to any frequency
        virtual bool IsChannel(int _frequency);
        virtual void AddFrequency(int _frequency);

        virtual int StartFrequency() { return startFrequency; };
        virtual int EndFrequency() { return endFrequency; };
        virtual int Frequency() { return frequency; };
        virtual int* FrequencyReference() { return &frequency; };

        virtual int Offset() { return offset; };
        virtual int* OffsetReference() { return &offset; };
        virtual void SetOffset(int _offset) { offset=_offset; modified=true; };

        virtual bool HaveVdrChannel() { return channel>=0; };
        virtual cChannel* VdrChannel() { return (channel>=0)?Channels.GetByNumber(channel):NULL; };
        virtual void UpdateVdrChannel();
        virtual int VdrChannelNumber() { return channel; };
        virtual void ClearVdrChannel() { channel=-1; name[0]=0; modified=true; };
        virtual void SetVdrChannel(int _channel) { channel=_channel; };
        virtual bool Write2VdrChannel();
        virtual bool DeleteVdrChannel();

        virtual bool IsModified() { return modified; };
};

class cRMChannelList:
    public cList<cRMChannel>
{
};


#endif // __PVRUSB2_CHANNEL_H

