#include "qgscopedevice.h"

QgScopeDevice::QgScopeDevice(const QString &name, const QString& nickName_):
    QgScopeObject(name),
    m_deviceActive(true),
    m_nickName(nickName_),
    m_chronoTimer(name)
{
    setScriptableName(nickName_);
    setTooltipString(name);
}

QgScopeDevice::~QgScopeDevice()
{
}


bool QgScopeDevice::deviceActive() const
{
    return m_deviceActive;
}


bool QgScopeDevice::onActivate(bool activate)
{
    if (activate!=m_deviceActive)
    {
        m_deviceActive=activate;
        Q_EMIT deviceActivated(m_deviceActive);
    }
    return true;
}

void QgScopeDevice::setDeviceActive(bool activate)
{
    onActivate(activate);
/*
    if (activate!=m_deviceActive)
    {
        m_deviceActive=activate;
        Q_EMIT deviceActivated(m_deviceActive);
    }
*/
}

QgScopeChronoTimer& QgScopeDevice::chronoTimer()
{
    return m_chronoTimer;
}

