#include "status.h"
#include "menu.h"


cStatusMonitor::cStatusMonitor()

{
  data.ActualSource=0;
  transfer=false;
}

void cStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber)
{
  Aktiv=false;
  device=cDevice::GetDevice(data.DvbCard);
  if (ChannelNumber)
  {
    if (Device!=cDevice::PrimaryDevice() || cDevice::ActualDevice()==cDevice::PrimaryDevice() || cDevice::PrimaryDevice()->cDevice::HasProgramme() && transfer)
    {
      Channel = Channels.GetByNumber(ChannelNumber);
      int channelsource = RotorPositions.GetfromSource(Channel->Source())->GetCode();
      if (data.card[Device->CardIndex()] && channelsource)      
        if (channelsource!=data.ActualSource)  
        {
          if (data.UseGotoX || data.UseGotoPos)
          {
            data.ActualSource=channelsource;
            if (data.UseGotoX)
              GotoX(data.ActualSource);
            if (data.UseGotoPos && RotorPositions.GetfromSource(data.ActualSource)->GetPos())
              DiseqcCommand(Goto,RotorPositions.GetfromSource(data.ActualSource)->GetPos());
          }
        }
    }
    if ((cDevice::ActualDevice()!=cDevice::PrimaryDevice()) && (Device==cDevice::PrimaryDevice()) )
      transfer=true;
    if ((cDevice::ActualDevice()==cDevice::PrimaryDevice()) && (Device==cDevice::PrimaryDevice())) transfer=false;
  }
}
