void imagesequence::checkCCD(int ccdNum) { INDI_D *idevice = NULL; QString targetCCD = CCDCombo->text(ccdNum); INDIMenu *imenu = ksw->getINDIMenu(); if (!imenu) { KMessageBox::error(this, i18n("INDI Menu has not been initialized properly. Restart KStars.")); return; } idevice = imenu->findDeviceByLabel(targetCCD); if (!idevice) { KMessageBox::error(this, i18n("INDI device %1 no longer exists.").arg(targetCCD)); CCDCombo->removeItem(ccdNum); lastCCD = CCDCombo->currentItem(); if (lastCCD != -1) checkCCD(lastCCD); return; } if (!idevice->isOn()) { KMessageBox::error(this, i18n("%1 is disconnected. Establish a connection to the device using the INDI Control Panel.").arg(targetCCD)); CCDCombo->setCurrentItem(lastCCD); return; } currentCCD = targetCCD; }
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::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::setINDIAction(const QString &action) { INDI_D *dev; INDI_E *el; if (!indidriver || !indimenu) { kDebug() << "setINDIAction: establishINDI() failed."; return; } dev = indimenu->findDevice(indimenu->getCurrentDevice()); if (!dev) dev = indimenu->findDeviceByLabel(indimenu->getCurrentDevice()); if (!dev) { kDebug() << "Device " << indimenu->getCurrentDevice() << " not found!"; return; } el = dev->findElem(action); if( !el ) return; el->pp->activateSwitch(action); }
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::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); }
bool imagesequence::verifyCCDIntegrity() { QString targetCCD; INDI_D *idevice = NULL; INDI_P *exposeProp; INDI_E *exposeElem; stdDevCCD = NULL; INDIMenu *imenu = ksw->getINDIMenu(); if (!imenu) { KMessageBox::error(this, i18n("INDI Menu has not been initialized properly. Restart KStars.")); return false; } targetCCD = CCDCombo->currentText(); if (targetCCD.isEmpty()) return false; // #2 Check if the device exists idevice = imenu->findDeviceByLabel(targetCCD); if (!idevice) { KMessageBox::error(this, i18n("INDI device %1 no longer exists.").arg(targetCCD)); CCDCombo->removeItem(CCDCombo->currentItem()); lastCCD = CCDCombo->currentItem(); return false; } if (!idevice->isOn()) { KMessageBox::error(this, i18n("%1 is disconnected. Establish a connection to the device using the INDI Control Panel.").arg(currentCCD)); return false; } stdDevCCD = idevice->stdDev; exposeProp = stdDevCCD->dp->findProp("CCD_EXPOSE_DURATION"); if (!exposeProp) { KMessageBox::error(this, i18n("Device does not support CCD_EXPOSE_DURATION property.")); return false; } exposeElem = exposeProp->findElement("EXPOSE_DURATION"); if (!exposeElem) { KMessageBox::error(this, i18n("CCD_EXPOSE_DURATION property is missing DURATION element.")); return false; } return true; }
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(); }
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(); }
bool imagesequence::verifyFilterIntegrity() { QString targetFilter; INDIMenu *devMenu = ksw->getINDIMenu(); INDI_D *filterDevice (NULL); INDI_E *filterElem(NULL); if (devMenu == NULL) return false; targetFilter = filterCombo->currentText(); if (targetFilter.isEmpty() || targetFilter == i18n("None")) { filterPosCombo->clear(); return false; } // #1 Check the device exists filterDevice = devMenu->findDeviceByLabel(targetFilter); if (filterDevice == NULL) { KMessageBox::error(this, i18n("INDI device %1 no longer exists.").arg(targetFilter)); filterCombo->removeItem(filterCombo->currentItem()); filterCombo->setCurrentItem(0); currentFilter = filterCombo->currentText(); filterPosCombo->clear(); stdDevFilter = NULL; return false; } // #2 Make sure it's connected if (!filterDevice->isOn()) { KMessageBox::error(this, i18n("%1 is disconnected. Establish a connection to the device using the INDI Control Panel.").arg(targetFilter)); filterCombo->setCurrentItem(0); currentFilter = filterCombo->currentText(); filterPosCombo->clear(); stdDevFilter = NULL; return false; } // #3 Make sure it has FILTER_SLOT std property by searching for its SLOT element filterElem = filterDevice->findElem("SLOT"); if (filterElem == NULL) { KMessageBox::error(this, i18n("Device does not support FILTER_SLOT property.")); filterCombo->setCurrentItem(0); currentFilter = filterCombo->currentText(); filterPosCombo->clear(); stdDevFilter = NULL; return false; } stdDevFilter = filterDevice->stdDev; lastFilter = filterCombo->currentItem(); currentFilter = targetFilter; // We're good return true; }