void KStars::setINDIUTC(const QString &UTCDateTime)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "startINDIUTC: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("TIME_UTC");
    if (!prop) return;

    el   = prop->findElement("UTC");
    if (!el) return;
    if (!el->write_w) return;

    el->write_w->setText(UTCDateTime);

    prop->newText();

}
void KStars::setINDIFocusSpeed(unsigned int speed)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "setINDIFocusSpeed: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("FOCUS_SPEED");
    if (!prop) return;

    el   = prop->findElement("SPEED");
    if (!el) return;
    if (!el->write_w) return;

    el->write_w->setText(QString::number(speed));

    prop->newText();

}
void KStars::setINDIFilterNum(int filter_num)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "setINDIFilterNum: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("FILTER_SLOT");
    if (!prop) return;

    el   = prop->findElement("SLOT");
    if (!el) return;

    if (el->write_w)
        el->write_w->setText(QString::number(filter_num));
    else if (el->spin_w)
        el->spin_w->setValue(filter_num);

    prop->newText();

}
void KStars::setINDIPort(const QString &port)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "setINDIPort: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("DEVICE_PORT");
    if (!prop) return;

    el   = prop->findElement("PORT");

    if (!el || !el->write_w)
        return;

    el->write_w->setText(port);

    prop->newText();

}
void KStars::switchINDI(bool turnOn)
{
    INDI_D *dev;
    INDI_P *prop;

    if (!indidriver || !indimenu)
    {
        kDebug() << "switchINDI: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    if (turnOn && dev->isOn() || (!turnOn && !dev->isOn()))
        return;

    prop = dev->findProp("CONNECTION");
    if (!prop) return;

    if (turnOn)
        prop->newSwitch(0);
    else
        prop->newSwitch(1);

}
void KStars::setINDIGeoLocation(double longitude, double latitude)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "setINDIGeoLocation: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("GEOGRAPHICAL_COORD");
    if (!prop) return;

    el   = prop->findElement("LONG");
    if (!el) return;
    if (!el->write_w) return;

    el->write_w->setText(QString::number(longitude));

    el  = prop->findElement("LAT");
    if (!el) return;
    if (!el->write_w) return;

    el->write_w->setText(QString::number(latitude));

    prop->newText();

}
void KStars::setINDITargetCoord(double RA, double DEC)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "setINDITarget: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("EQUATORIAL_EOD_COORD");
    if (!prop) return;

    el   = prop->findElement("RA");
    if (!el) return;
    if (!el->write_w) return;

    el->write_w->setText(QString::number(RA));

    el  = prop->findElement("DEC");
    if (!el) return;
    if (!el->write_w) return;

    el->write_w->setText(QString::number(DEC));

    prop->newText();

}
void KStars::setINDITargetName(const QString &objectName)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu) {
        kDebug() << "setINDITarget: establishINDI() failed.";
        return;
    }

    SkyObject *target = data()->objectNamed( objectName );
    if (!target) return;

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev) {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("EQUATORIAL_EOD_COORD");
    if (!prop) return;

    el = prop->findElement("RA");
    if( !el || !el->write_w)
        return;
    el->write_w->setText(QString::number(target->ra().Hours()));

    el  = prop->findElement("DEC");
    if( !el || !el->write_w)
        return;
    el->write_w->setText(QString::number(target->dec().Degrees()));

    prop->newText();
}
void KStars::startINDIExposure(int timeout)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "startINDIExposure: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("CCD_EXPOSE_DURATION");
    if (!prop) return;

    el   = prop->findElement("EXPOSE_DURATION");
    if (!el) return;

    if (el->write_w)
        el->write_w->setText(QString::number(timeout));
    else if (el->spin_w)
        el->spin_w->setValue(timeout);


    prop->newText();

}
Beispiel #10
0
void KStars::setINDICCDTemp(int temp)
{
    INDI_D *dev;
    INDI_P *prop;
    INDI_E *el;

    if (!indidriver || !indimenu)
    {
        kDebug() << "setINDICCDTemp: establishINDI() failed.";
        return;
    }

    dev = indimenu->findDevice(indimenu->getCurrentDevice());
    if (!dev)
        dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice());
    if (!dev)
    {
        kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!";
        return;
    }

    prop = dev->findProp("CCD_TEMPERATURE");
    if (!prop) return;

    el   = prop->findElement("TEMPERATURE");
    if (!el) return;

    if (el->write_w)
        el->write_w->setText(QString::number(temp));
    else if (el->spin_w)
        el->spin_w->setValue(temp);


    prop->newText();

}