void Focus::newFITS(IBLOB *bp) { INDI_UNUSED(bp); QString HFRText; // Ignore guide head if there is any. if (!strcmp(bp->name, "CCD2")) return; ISD::CCDChip *targetChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD); FITSView *targetImage = targetChip->getImage(FITS_FOCUS); FITSImage *image_data = targetImage->getImageData(); currentCCD->disconnect(this); if (targetImage == NULL) { qDebug() << "Error: targetImage is NULL!" << endl; return; } image_data->findStars(); double currentHFR= image_data->getHFR(HFR_MAX); HFRText = QString("%1").arg(currentHFR, 0,'g', 3); if (inFocusLoop == false && focusType == FOCUS_MANUAL && HFR == -1) appendLogText(i18n("FITS received. No stars detected.")); HFROut->setText(HFRText); if (inFocusLoop) { capture(); return; } if (focusType == FOCUS_MANUAL || inAutoFocus==false) return; if (canAbsMove) autoFocusAbs(currentHFR); else autoFocusRel(currentHFR); }
bool StarbookDriver::updateTime(ln_date *utc, double utc_offset) { INDI_UNUSED(utc_offset); if (last_known_state != starbook::INIT) { LOGF_WARN("Cannot update time in %s state", starbook::STATE_TO_STR.at(last_known_state).c_str()); return false; } starbook::ResponseCode rc; utc->hours += floor(utc_offset); // starbook stores local time, go figure rc = cmd_interface->SetTime(*utc); LogResponse("Updating time", rc); return rc == starbook::OK; }
bool FocusMaster::sendCommand(const uint8_t *command, char *response) { INDI_UNUSED(response); int rc = hid_write(handle, command, 2); LOGF_DEBUG("CMD <%#02X %#02X>", command[0], command[1]); if (rc < 0) { LOGF_ERROR("<%#02X %#02X>: Error writing to device %s", command[0], command[1], hid_error(handle)); return false; } return true; }
bool StarbookDriver::updateLocation(double latitude, double longitude, double elevation) { INDI_UNUSED(elevation); if (last_known_state != starbook::INIT) { LOGF_WARN("Can't update location in %s state", starbook::STATE_TO_STR.at(last_known_state).c_str()); return false; } if (TimeT[1].text == nullptr) { LOG_WARN("Can't update location before time"); return false; } auto utc_offset = static_cast<short>(std::floor(std::strtof(TimeT[1].text, nullptr))); LOGF_WARN("UTC offset for location: %i", utc_offset); starbook::LnLat posn(latitude, longitude); starbook::ResponseCode rc = cmd_interface->SetPlace(posn, utc_offset); LogResponse("Updating location", rc); return rc == starbook::OK; }
void Guide::newFITS(IBLOB *bp) { INDI_UNUSED(bp); FITSViewer *fv = currentCCD->getViewer(); disconnect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*))); ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD); FITSView *targetImage = targetChip->getImage(FITS_GUIDE); FITSImage *image_data = targetImage->getImageData(); image_data->findStars(); pmath->set_image(targetImage); guider->set_image(targetImage); calibration->set_image(targetImage); fv->show(); if (guider->is_guiding()) { guider->guide(); if (guider->is_guiding()) capture(); } else if (calibration->is_calibrating()) { pmath->do_processing(); calibration->process_calibration(); if (calibration->is_calibrating()) capture(); if (calibration->is_finished()) { guider->set_ready(true); tabWidget->setTabEnabled(1, true); } } }
bool ScopeScript::ReadScopeStatus() { char name[1024]; char *s = tmpnam(name); INDI_UNUSED(s); bool status = RunScript(SCRIPT_STATUS, name, nullptr); if (status) { int parked = 0; float ra = 0, dec = 0; FILE *file = fopen(name, "r"); int ret = 0; ret = fscanf(file, "%d %f %f", &parked, &ra, &dec); fclose(file); unlink(name); if (parked != 0) { if (!isParked()) { SetParked(true); LOG_INFO("Park succesfully executed"); } } else { if (isParked()) { SetParked(false); LOG_INFO("Unpark succesfully executed"); } } NewRaDec(ra, dec); } else { LOG_ERROR("Failed to read status"); } return status; }
TTYBase::TTY_RESPONSE TTYBase::checkTimeout(uint8_t timeout) { #if defined(_WIN32) || defined(ANDROID) INDI_UNUSED(timeout); return TTY_ERRNO; #else if (m_PortFD == -1) return TTY_ERRNO; struct timeval tv; fd_set readout; int retval; FD_ZERO(&readout); FD_SET(m_PortFD, &readout); /* wait for 'timeout' seconds */ tv.tv_sec = timeout; tv.tv_usec = 0; /* Wait till we have a change in the m_PortFD status */ retval = select(m_PortFD + 1, &readout, nullptr, nullptr, &tv); /* Return 0 on successful m_PortFD change */ if (retval > 0) return TTY_OK; /* Return -1 due to an error */ else if (retval == -1) return TTY_SELECT_ERROR; /* Return -2 if time expires before anything interesting happens */ else return TTY_TIME_OUT; #endif }
void ISSnoopDevice(XMLEle* root) { INDI_UNUSED(root); }
bool ScopeSim::SetTrackMode(uint8_t mode) { INDI_UNUSED(mode); return true; }
bool INDI::FilterWheel::GetFilterNames(const char * groupName) { INDI_UNUSED(groupName); return false; }
IPState DomeSim::ControlShutter(ShutterOperation operation) { INDI_UNUSED(operation); shutterTimer = SHUTTER_TIMER; return IPS_BUSY; }
void QFW::simulationTriggered(bool enable) { INDI_UNUSED(enable); }
void DomeScript::TimerHit() { if (!isConnected()) return; char name[1024]={0}; // N.B. INDI_UNUSED to make it compile on MacOS // DO NOT CHANGE char *s = tmpnam(name); INDI_UNUSED(s); bool status = RunScript(SCRIPT_STATUS, name, nullptr); if (status) { int parked = 0, shutter = 0; float az = 0; FILE *file = fopen(name, "r"); int ret = 0; ret = fscanf(file, "%d %d %f", &parked, &shutter, &az); fclose(file); unlink(name); DomeAbsPosN[0].value = az = round(range360(az) * 10) / 10; if (parked != 0) { if (getDomeState() == DOME_PARKING || getDomeState() == DOME_UNPARKED) { SetParked(true); TargetAz = az; LOG_INFO("Park succesfully executed"); } } else { if (getDomeState() == DOME_UNPARKING || getDomeState() == DOME_PARKED) { SetParked(false); TargetAz = az; LOG_INFO("Unpark succesfully executed"); } } if (std::round(az * 10) != std::round(TargetAz * 10)) { LOGF_INFO("Moving %g -> %g %d", std::round(az * 10) / 10, std::round(TargetAz * 10) / 10, getDomeState()); IDSetNumber(&DomeAbsPosNP, nullptr); } else if (getDomeState() == DOME_MOVING) { setDomeState(DOME_SYNCED); IDSetNumber(&DomeAbsPosNP, nullptr); } if (shutterState == SHUTTER_OPENED) { if (shutter == 0) { shutterState = SHUTTER_CLOSED; DomeShutterSP.s = IPS_OK; IDSetSwitch(&DomeShutterSP, nullptr); LOG_INFO("Shutter was succesfully closed"); } } else { if (shutter == 1) { shutterState = SHUTTER_OPENED; DomeShutterSP.s = IPS_OK; IDSetSwitch(&DomeShutterSP, nullptr); LOG_INFO("Shutter was succesfully opened"); } } } else { LOG_ERROR("Failed to read status"); } SetTimer(POLLMS); if (!isParked() && TimeSinceUpdate++ > 4) { TimeSinceUpdate = 0; UpdateMountCoords(); } }
void Triangulate::AddPoint(HtmID id) { INDI_UNUSED(id); isvalid = false; }
bool INDI::LightBoxInterface::SetLightBoxBrightness(uint16_t value) { INDI_UNUSED(value); // Must be implemented by child class return false; }
bool FocuserInterface::SyncFocuser(uint32_t ticks) { INDI_UNUSED(ticks); DEBUGDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_ERROR, "Focuser does not support syncing."); return false; }
bool FocuserInterface::SetFocuserMaxPosition(uint32_t ticks) { INDI_UNUSED(ticks); return true; }
bool FocuserInterface::ReverseFocuser(bool enabled) { INDI_UNUSED(enabled); DEBUGDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_ERROR, "Focuser does not support reverse motion."); return false; }
IPState FocuserInterface::MoveAbsFocuser(uint32_t ticks) { INDI_UNUSED(ticks); // Must be implemented by child class return IPS_ALERT; }
bool FocuserInterface::processSwitch(const char * dev, const char * name, ISState * states, char * names[], int n) { INDI_UNUSED(dev); // This one is for focus motion if (!strcmp(name, FocusMotionSP.name)) { // Record last direction and state. FocusDirection prevDirection = FocusMotionS[FOCUS_INWARD].s == ISS_ON ? FOCUS_INWARD : FOCUS_OUTWARD; IPState prevState = FocusMotionSP.s; IUUpdateSwitch(&FocusMotionSP, states, names, n); FocusDirection targetDirection = FocusMotionS[FOCUS_INWARD].s == ISS_ON ? FOCUS_INWARD : FOCUS_OUTWARD; if (CanRelMove() || CanAbsMove() || HasVariableSpeed()) { FocusMotionSP.s = IPS_OK; } // If we are dealing with a simple dumb DC focuser, we move in a specific direction in an open-loop fashion until stopped. else { // If we are reversing direction let's issue abort first. if (prevDirection != targetDirection && prevState == IPS_BUSY) AbortFocuser(); FocusMotionSP.s = MoveFocuser(targetDirection, 0, 0); } IDSetSwitch(&FocusMotionSP, nullptr); return true; } // Abort Focuser if (!strcmp(name, FocusAbortSP.name)) { IUResetSwitch(&FocusAbortSP); if (AbortFocuser()) { FocusAbortSP.s = IPS_OK; if (CanAbsMove() && FocusAbsPosNP.s != IPS_IDLE) { FocusAbsPosNP.s = IPS_IDLE; IDSetNumber(&FocusAbsPosNP, nullptr); } if (CanRelMove() && FocusRelPosNP.s != IPS_IDLE) { FocusRelPosNP.s = IPS_IDLE; IDSetNumber(&FocusRelPosNP, nullptr); } } else FocusAbortSP.s = IPS_ALERT; IDSetSwitch(&FocusAbortSP, nullptr); return true; } // Reverse Motion if (!strcmp(name, FocusReverseSP.name)) { bool enabled = !strcmp("ENABLED", IUFindOnSwitchName(states, names, n)); if (ReverseFocuser(enabled)) { IUUpdateSwitch(&FocusReverseSP, states, names, n); FocusReverseSP.s = IPS_OK; } else { FocusReverseSP.s = IPS_ALERT; } IDSetSwitch(&FocusReverseSP, nullptr); return true; } return false; }
bool ScopeSim::SetTrackEnabled(bool enabled) { INDI_UNUSED(enabled); return true; }
bool RotatorInterface::SyncRotator(double angle) { INDI_UNUSED(angle); DEBUGDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_ERROR, "Rotator does not support syncing."); return false; }
bool ScopeSim::SetTrackRate(double raRate, double deRate) { INDI_UNUSED(raRate); INDI_UNUSED(deRate); return true; }
bool INDI::LightBoxInterface::EnableLightBox(bool enable) { INDI_UNUSED(enable); // Must be implemented by child class return false; }
void QFW::debugTriggered(bool enable) { INDI_UNUSED(enable); }
bool FocusMaster::sync(uint32_t ticks) { INDI_UNUSED(ticks); return false; }
bool RotatorInterface::processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { INDI_UNUSED(states); INDI_UNUSED(names); INDI_UNUSED(n); if (dev != nullptr && strcmp(dev, m_defaultDevice->getDeviceName()) == 0) { //////////////////////////////////////////// // Abort //////////////////////////////////////////// if (strcmp(name, AbortRotatorSP.name) == 0) { AbortRotatorSP.s = AbortRotator() ? IPS_OK : IPS_ALERT; IDSetSwitch(&AbortRotatorSP, nullptr); if (AbortRotatorSP.s == IPS_OK) { if (GotoRotatorNP.s != IPS_OK) { GotoRotatorNP.s = IPS_OK; IDSetNumber(&GotoRotatorNP, nullptr); } } return true; } //////////////////////////////////////////// // Home //////////////////////////////////////////// else if (strcmp(name, HomeRotatorSP.name) == 0) { HomeRotatorSP.s = HomeRotator(); IUResetSwitch(&HomeRotatorSP); if (HomeRotatorSP.s == IPS_BUSY) HomeRotatorS[0].s = ISS_ON; IDSetSwitch(&HomeRotatorSP, nullptr); return true; } //////////////////////////////////////////// // Reverse Rotator //////////////////////////////////////////// else if (strcmp(name, ReverseRotatorSP.name) == 0) { bool rc = false; bool enabled = (!strcmp(IUFindOnSwitchName(states, names, n), "ENABLED")); rc = ReverseRotator(enabled); if (rc) { IUUpdateSwitch(&ReverseRotatorSP, states, names, n); ReverseRotatorSP.s = IPS_OK; DEBUGFDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_SESSION, "Rotator direction is %s.", (enabled ? "reversed" : "normal")); } else { ReverseRotatorSP.s = IPS_ALERT; DEBUGDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_SESSION, "Rotator reverse direction failed."); } IDSetSwitch(&ReverseRotatorSP, nullptr); return true; } } return false; }
bool INDI::CCD::updateCCDFrameType(CCDChip::CCD_FRAME fType) { INDI_UNUSED(fType); // Child classes can override this return true; }
bool RotatorInterface::ReverseRotator(bool enabled) { INDI_UNUSED(enabled); DEBUGDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_ERROR, "Rotator does not support reverse."); return false; }
bool FocusMaster::getPosition(uint32_t *ticks) { INDI_UNUSED(ticks); return false; }