/************************************************************************************ * * ***********************************************************************************/ bool BaaderDome::SetupParms() { targetAz = 0; if (UpdatePosition()) IDSetNumber(&DomeAbsPosNP, nullptr); if (UpdateShutterStatus()) IDSetSwitch(&DomeShutterSP, nullptr); if (UpdateFlapStatus()) IDSetSwitch(&DomeFlapSP, nullptr); if (InitPark()) { // If loading parking data is successful, we just set the default parking values. SetAxis1ParkDefault(0); } else { // Otherwise, we set all parking data to default in case no parking data is found. SetAxis1Park(0); SetAxis1ParkDefault(0); } return true; }
bool FocuserInterface::processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { INDI_UNUSED(dev); // This one is for us if (strcmp(name, "FOCUS_MOTION") == 0) { // 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; } if (strcmp(name, "FOCUS_ABORT_MOTION") == 0) { IUResetSwitch(&AbortSP); if (AbortFocuser()) { AbortSP.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 AbortSP.s = IPS_ALERT; IDSetSwitch(&AbortSP, nullptr); return true; } return false; }
void QHYCCD::setCooler(bool enable) { if (enable && coolerEnabled == false) { CoolerS[0].s = ISS_ON; CoolerS[1].s = ISS_OFF; CoolerSP.s = IPS_OK; IDSetSwitch(&CoolerSP, NULL); CoolerNP.s = IPS_BUSY; IDSetNumber(&CoolerNP, NULL); DEBUG(INDI::Logger::DBG_SESSION, "Cooler on."); coolerEnabled = true; } else if (!enable && coolerEnabled == true) { coolerEnabled = false; if (sim == false) SetQHYCCDParam(camhandle, CONTROL_MANULPWM, 0); CoolerSP.s = IPS_IDLE; CoolerS[0].s = ISS_OFF; CoolerS[1].s = ISS_ON; IDSetSwitch(&CoolerSP, NULL); CoolerNP.s = IPS_IDLE; IDSetNumber(&CoolerNP, NULL); TemperatureNP.s = IPS_IDLE; IDSetNumber(&TemperatureNP, NULL); DEBUG(INDI::Logger::DBG_SESSION, "Cooler off."); } }
bool LX200Autostar::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { int index = 0; if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { // Focus Motion if (!strcmp(name, FocusMotionSP.name)) { // If speed is "halt" if (FocusSpeedN[0].value == 0) { FocusMotionSP.s = IPS_IDLE; IDSetSwitch(&FocusMotionSP, nullptr); return false; } int last_motion = IUFindOnSwitchIndex(&FocusMotionSP); if (IUUpdateSwitch(&FocusMotionSP, states, names, n) < 0) return false; index = IUFindOnSwitchIndex(&FocusMotionSP); // If same direction and we're busy, stop if (last_motion == index && FocusMotionSP.s == IPS_BUSY) { IUResetSwitch(&FocusMotionSP); FocusMotionSP.s = IPS_IDLE; setFocuserSpeedMode(PortFD, 0); IDSetSwitch(&FocusMotionSP, nullptr); return true; } if (!isSimulation() && setFocuserMotion(PortFD, index) < 0) { FocusMotionSP.s = IPS_ALERT; IDSetSwitch(&FocusMotionSP, "Error setting focuser speed."); return false; } FocusMotionSP.s = IPS_BUSY; // with a timer if (FocusTimerNP.np[0].value > 0) { FocusTimerNP.s = IPS_BUSY; if (isDebug()) IDLog("Starting Focus Timer BUSY\n"); IEAddTimer(50, LX200Generic::updateFocusHelper, this); } IDSetSwitch(&FocusMotionSP, nullptr); return true; } } return LX200Generic::ISNewSwitch(dev, name, states, names, n); }
bool FocusMaster::AbortFocuser() { uint8_t command[MAX_FM_BUF] = {0}; command[0] = 0x30; command[1] = 0x30; LOG_DEBUG("Aborting Focuser..."); bool rc = sendCommand(command); if (rc) { if (FullMotionSP.s == IPS_BUSY) { IUResetSwitch(&FullMotionSP); FullMotionSP.s = IPS_IDLE; IDSetSwitch(&FullMotionSP, nullptr); } if (FocusMotionSP.s == IPS_BUSY) { IUResetSwitch(&FocusMotionSP); FocusMotionSP.s = IPS_IDLE; IDSetSwitch(&FocusMotionSP, nullptr); } } return rc; }
void ASIEAF::GetFocusParams() { if (readPosition()) IDSetNumber(&FocusAbsPosNP, nullptr); if (readReverse()) IDSetSwitch(&FocusReverseSP, nullptr); if (readBeep()) IDSetSwitch(&BeepSP, nullptr); }
/************************************************************************************ * * ***********************************************************************************/ bool ScopeDome::SetupParms() { targetAz = 0; readU32(GetImpPerTurn, stepsPerTurn); LOGF_INFO("Steps per turn read as %d", stepsPerTurn); StepsPerRevolutionN[0].value = stepsPerTurn; StepsPerRevolutionNP.s = IPS_OK; IDSetNumber(&StepsPerRevolutionNP, nullptr); readS32(GetHomeSensorPosition, homePosition); LOGF_INFO("Home position read as %d", homePosition); if (UpdatePosition()) IDSetNumber(&DomeAbsPosNP, nullptr); if (UpdateShutterStatus()) IDSetSwitch(&DomeShutterSP, nullptr); UpdateSensorStatus(); UpdateRelayStatus(); if (InitPark()) { // If loading parking data is successful, we just set the default parking // values. SetAxis1ParkDefault(0); } else { // Otherwise, we set all parking data to default in case no parking data is // found. SetAxis1Park(0); SetAxis1ParkDefault(0); } uint8_t calibrationNeeded = false; readU8(IsFullSystemCalReq, calibrationNeeded); CalibrationNeededS[0].s = calibrationNeeded ? ISS_ON : ISS_OFF; CalibrationNeededSP.s = IPS_OK; IDSetSwitch(&CalibrationNeededSP, nullptr); uint16_t fwVersion; readU16(GetVersionFirmware, fwVersion); FirmwareVersionsN[0].value = fwVersion / 100.0; uint8_t fwVersionRotary; readU8(GetVersionFirmwareRotary, fwVersionRotary); FirmwareVersionsN[1].value = (fwVersionRotary + 9) / 10.0; FirmwareVersionsNP.s = IPS_OK; IDSetNumber(&FirmwareVersionsNP, nullptr); return true; }
bool INDI::Focuser::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if (!strcmp(PresetGotoSP.name, name)) { IUUpdateSwitch(&PresetGotoSP, states, names, n); int index = IUFindOnSwitchIndex(&PresetGotoSP); if (PresetN[index].value < FocusAbsPosN[0].min) { PresetGotoSP.s = IPS_ALERT; IDSetSwitch(&PresetGotoSP, NULL); DEBUGFDEVICE(dev, INDI::Logger::DBG_ERROR, "Requested position out of bound. Focus minimum position is %g", FocusAbsPosN[0].min); return false; } else if (PresetN[index].value > FocusAbsPosN[0].max) { PresetGotoSP.s = IPS_ALERT; IDSetSwitch(&PresetGotoSP, NULL); DEBUGFDEVICE(dev, INDI::Logger::DBG_ERROR, "Requested position out of bound. Focus maximum position is %g", FocusAbsPosN[0].max); return false; } int rc = MoveAbsFocuser(PresetN[index].value); if (rc >= 0) { PresetGotoSP.s = IPS_OK; DEBUGF(INDI::Logger::DBG_SESSION, "Moving to Preset %d with position %g.", index+1, PresetN[index].value); IDSetSwitch(&PresetGotoSP, NULL); return true; } PresetGotoSP.s = IPS_ALERT; IDSetSwitch(&PresetGotoSP, NULL); return false; } if (strstr(name, "FOCUS_")) return processFocuserSwitch(dev, name, states, names, n); } controller->ISNewSwitch(dev, name, states, names, n); // Nobody has claimed this, so, ignore it return DefaultDevice::ISNewSwitch(dev,name,states,names,n); }
bool ASIEAF::ISNewSwitch(const char * dev, const char * name, ISState * states, char * names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { // Turn on/off beep if (!strcmp(name, BeepSP.name)) { EAF_ERROR_CODE rc = EAF_SUCCESS; if (!strcmp(BeepS[BEEP_ON].name, IUFindOnSwitchName(states, names, n))) rc = EAFSetBeep(m_ID, true); else rc = EAFSetBeep(m_ID, false); if (rc == EAF_SUCCESS) { IUUpdateSwitch(&BeepSP, states, names, n); BeepSP.s = IPS_OK; } else { BeepSP.s = IPS_ALERT; LOGF_ERROR("Failed to set beep state. Error: %d", rc); } IDSetSwitch(&BeepSP, nullptr); return true; } } return INDI::Focuser::ISNewSwitch(dev, name, states, names, n); }
bool DSICCD::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) { int index=0; if(strcmp(dev,getDeviceName())==0) { /* Vdd on/off switch for DSI III exposure control (gs) */ if (!strcmp(name,VddExpSP.name)) { if (IUUpdateSwitch(&VddExpSP, states, names, n) < 0) return false; index = IUFindOnSwitchIndex(&VddExpSP); if (index == 0) dsi->setVddOn(true); else dsi->setVddOn(false); VddExpSP.s = IPS_OK; IDSetSwitch (&VddExpSP, index == 0 ? "Vdd mode is ON" : "Vdd mode is OFF" ); return true; } } return INDI::CCD::ISNewSwitch (dev, name, states, names, n); }
bool ASICCD::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n) { ASI_ERROR_CODE errCode = ASI_SUCCESS; if(!strcmp(dev,getDeviceName())) { if (!strcmp(name, ControlNP.name)) { double oldValues[ControlNP.nnp]; for (int i=0; i < ControlNP.nnp; i++) oldValues[i] = ControlN[i].value; IUUpdateNumber(&ControlNP, values, names, n); for (int i=0; i < ControlNP.nnp; i++) { ASI_BOOL nAuto = *((ASI_BOOL *) ControlN[i].aux1); ASI_CONTROL_TYPE nType = *((ASI_CONTROL_TYPE *) ControlN[i].aux0); // If value didn't change or if USB bandwidth control is to change, then only continue if ExposureRequest < 250 ms if (ControlN[i].value == oldValues[i] || (nType == ASI_BANDWIDTHOVERLOAD && ExposureRequest > 0.25)) continue; if ( (errCode = ASISetControlValue(m_camInfo->CameraID, nType, ControlN[i].value, ASI_FALSE)) != ASI_SUCCESS) { DEBUGF(INDI::Logger::DBG_ERROR, "ASISetControlValue (%s=%g) error (%d)", ControlN[i].name, ControlN[i].value, errCode); ControlNP.s = IPS_ALERT; for (int i=0; i < ControlNP.nnp; i++) ControlN[i].value = oldValues[i]; IDSetNumber(&ControlNP, NULL); return false; } // If it was set to nAuto value to turn it off if (nAuto) { for (int j=0; j < ControlSP.nsp; j++) { ASI_CONTROL_TYPE swType = *((ASI_CONTROL_TYPE *) ControlS[j].aux); if (swType == nType) { ControlS[j].s = ISS_OFF; break; } } IDSetSwitch(&ControlSP, NULL); } } ControlNP.s = IPS_OK; IDSetNumber(&ControlNP, NULL); return true; } } return INDI::CCD::ISNewNumber(dev,name,values,names,n); }
bool INDI::LightBoxInterface::processLightBoxSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { if (strcmp(dev, device->getDeviceName()) == 0) { // Light if (!strcmp(LightSP.name, name)) { int prevIndex = IUFindOnSwitchIndex(&LightSP); IUUpdateSwitch(&LightSP, states, names, n); bool rc = EnableLightBox(LightS[FLAT_LIGHT_ON].s == ISS_ON ? true : false); LightSP.s = rc ? IPS_OK : IPS_ALERT; if (!rc) { IUResetSwitch(&LightSP); LightS[prevIndex].s = ISS_ON; } IDSetSwitch(&LightSP, nullptr); return true; } } return false; }
bool ASICCD::StartStreaming() { ASI_IMG_TYPE type = getImageType(); if (type != ASI_IMG_Y8 && type != ASI_IMG_RGB24) { IUResetSwitch(&VideoFormatSP); ISwitch *vf = IUFindSwitch(&VideoFormatSP,"ASI_IMG_Y8"); if (vf == NULL) vf = IUFindSwitch(&VideoFormatSP,"ASI_IMG_RAW8"); if (vf) { vf->s = ISS_ON; DEBUGF(INDI::Logger::DBG_DEBUG, "Switching to %s video format.", vf->label); PrimaryCCD.setBPP(8); UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); IDSetSwitch(&VideoFormatSP, NULL); } else { DEBUG(INDI::Logger::DBG_ERROR, "No 8 bit video format found, cannot start stream."); return false; } } ASIStartVideoCapture(m_camInfo->CameraID); pthread_mutex_lock(&condMutex); streamPredicate = 1; pthread_mutex_unlock(&condMutex); pthread_cond_signal(&cv); return true; }
bool MaxDomeII::Abort() { int error=0; int nRetry = 3; while (nRetry) { error = Abort_Azimuth_MaxDomeII(PortFD); handle_driver_error(&error, &nRetry); } while (nRetry) { error = Abort_Shutter_MaxDomeII(PortFD); handle_driver_error(&error, &nRetry); } DomeAbsPosNP.s = IPS_IDLE; IDSetNumber(&DomeAbsPosNP, NULL); // If we abort while in the middle of opening/closing shutter, alert. if (DomeShutterSP.s == IPS_BUSY) { DomeShutterSP.s = IPS_ALERT; IDSetSwitch(&DomeShutterSP, "Shutter operation aborted."); return false; } return true; }
/******************************************************************************************** ** Client is asking us to update a switch *********************************************************************************************/ bool RainDetector::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (strcmp(name, RainSP.name) == 0) { IUUpdateSwitch(&RainSP, states, names, n); if (RainS[0].s == ISS_ON) { RainL[0].s = IPS_ALERT; RainLP.s = IPS_ALERT; IDSetLight(&RainLP, "Alert! Alert! Rain detected!"); } else { RainL[0].s = IPS_IDLE; RainLP.s = IPS_OK; IDSetLight(&RainLP, "Rain threat passed. The skies are clear."); } RainSP.s = IPS_OK; IDSetSwitch(&RainSP, nullptr); return true; } } return INDI::DefaultDevice::ISNewSwitch(dev, name, states, names, n); }
bool QikFlat::Disconnect() { sf->closePort(); delete sf; DEBUG(INDI::Logger::DBG_SESSION, "ARDUINO BOARD DISCONNECTED."); IDSetSwitch (getSwitch("CONNECTION"),"DISCONNECTED\n"); return true; }
bool ATIKCCD::activateCooler(bool enable) { IUResetSwitch(&CoolerSP); if (enable) { if (TemperatureRequest < TemperatureN[0].value) { if (CoolerSP.s != IPS_BUSY) LOG_INFO("Camera cooler is on."); CoolerS[COOLER_ON].s = ISS_ON; CoolerS[COOLER_OFF].s = ISS_OFF; CoolerSP.s = IPS_BUSY; } else { CoolerS[COOLER_ON].s = ISS_OFF; CoolerS[COOLER_OFF].s = ISS_ON; CoolerSP.s = IPS_IDLE; LOG_WARN("Cooler cannot be activated manually. Set a lower temperature to activate it."); IDSetSwitch(&CoolerSP, nullptr); return false; } } else if (enable == false) { int rc = ArtemisCoolerWarmUp(hCam); if (rc != ARTEMIS_OK) { CoolerS[COOLER_ON].s = ISS_ON; CoolerS[COOLER_OFF].s = ISS_OFF; CoolerSP.s = IPS_ALERT; LOGF_ERROR("Failed to warm camera (%d).", rc); IDSetSwitch(&CoolerSP, nullptr); return false; } CoolerS[COOLER_ON].s = ISS_OFF; CoolerS[COOLER_OFF].s = ISS_ON; CoolerSP.s = IPS_IDLE; LOG_INFO("Camera is warming up..."); } IDSetSwitch(&CoolerSP, nullptr); return true; }
/************************************************************************************ * * ***********************************************************************************/ bool ScopeDome::UpdateRelayStatus() { PowerRelaysS[0].s = getInputState(OUT_CCD); PowerRelaysS[1].s = getInputState(OUT_SCOPE); PowerRelaysS[2].s = getInputState(OUT_LIGHT); PowerRelaysS[3].s = getInputState(OUT_FAN); PowerRelaysSP.s = IPS_OK; IDSetSwitch(&PowerRelaysSP, nullptr); RelaysS[0].s = getInputState(OUT_RELAY1); RelaysS[0].s = getInputState(OUT_RELAY1); RelaysS[0].s = getInputState(OUT_RELAY1); RelaysS[0].s = getInputState(OUT_RELAY1); RelaysSP.s = IPS_OK; IDSetSwitch(&RelaysSP, nullptr); return true; }
void GPhotoCCD::UpdateWidget(cam_opt *opt) { struct tm *tm; switch(opt->widget->type) { case GP_WIDGET_RADIO: case GP_WIDGET_MENU: for (int i = 0; i < opt->widget->choice_cnt; i++) opt->item.sw[i].s = opt->widget->value.index == i ? ISS_ON : ISS_OFF; IDSetSwitch(&opt->prop.sw, NULL); break; case GP_WIDGET_TEXT: free(opt->item.text.text); opt->item.text.text = strdup(opt->widget->value.text); IDSetText(&opt->prop.text, NULL); break; case GP_WIDGET_TOGGLE: if(opt->widget->value.toggle) { opt->item.sw[0].s = ISS_ON; opt->item.sw[0].s = ISS_OFF; } else { opt->item.sw[0].s = ISS_OFF; opt->item.sw[0].s = ISS_ON; } IDSetSwitch(&opt->prop.sw, NULL); break; case GP_WIDGET_RANGE: opt->item.num.value = opt->widget->value.num; IDSetNumber(&opt->prop.num, NULL); break; case GP_WIDGET_DATE: free(opt->item.text.text); tm = gmtime((time_t *)&opt->widget->value.date); opt->item.text.text = strdup(asctime(tm)); IDSetText(&opt->prop.text, NULL); break; default: delete opt; return; } }
bool Weather::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { // Refresh if (!strcmp(name, RefreshSP.name)) { RefreshS[0].s = ISS_OFF; RefreshSP.s = IPS_OK; IDSetSwitch(&RefreshSP, nullptr); TimerHit(); } // Override if (!strcmp(name, OverrideSP.name)) { IUUpdateSwitch(&OverrideSP, states, names, n); if (OverrideS[0].s == ISS_ON) { LOG_WARN("Weather override is enabled. Observatory is not safe. Turn off override as soon as possible."); OverrideSP.s = IPS_BUSY; critialParametersLP.s = IPS_OK; IDSetLight(&critialParametersLP, nullptr); } else { LOG_INFO("Weather override is disabled"); OverrideSP.s = IPS_IDLE; syncCriticalParameters(); } IDSetSwitch(&OverrideSP, nullptr); return true; } } return DefaultDevice::ISNewSwitch(dev, name, states, names, n); }
/* Handle a request to change a switch. */ bool ShelyakEshel::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { if (!strcmp(dev, getDeviceName())) // check if the message is for our device { if (!strcmp(LampSP.name, name)) // check if its lamp request { LampSP.s = IPS_OK; // set state to ok (change later if something goes wrong) for (int i = 0; i < n; i++) { ISwitch *s = IUFindSwitch(&LampSP, names[i]); if (states[i] != s->s) { // check if state has changed bool rc = calibrationUnitCommand(COMMANDS[states[i]], PARAMETERS[names[i]]); if (!rc) LampSP.s = IPS_ALERT; } } IUUpdateSwitch(&LampSP, states, names, n); // update lamps IDSetSwitch(&LampSP, nullptr); // tell clients to update return true; } else if (!strcmp(MirrorSP.name, name)) // check if its a mirror request { ISState s = MirrorS[0].s; // save current mirror state IUUpdateSwitch(&MirrorSP, states, names, n); // update mirror MirrorSP.s = IPS_OK; // set state to ok (change later if something goes wrong) if (s != MirrorS[0].s) { // if mirror state has changed send command bool rc = calibrationUnitCommand(COMMANDS[MirrorS[0].s], PARAMETERS["MIRROR"]); if (!rc) MirrorSP.s = IPS_ALERT; } IDSetSwitch(&MirrorSP, nullptr); // tell clients to update return true; } } return INDI::DefaultDevice::ISNewSwitch(dev, name, states, names, n); // send it to the parent classes }
bool DomeSim::Abort() { // If we abort while in the middle of opening/closing shutter, alert. if (DomeShutterSP.s == IPS_BUSY) { DomeShutterSP.s = IPS_ALERT; IDSetSwitch(&DomeShutterSP, "Shutter operation aborted. Status: unknown."); return false; } return true; }
void JoyStick::buttonEvent(int button_n, int value) { if (!isConnected()) return; DEBUGF(INDI::Logger::DBG_DEBUG, "buttonEvent[%d]: %s", button_n, value > 0 ? "On" : "Off"); ButtonSP.s = IPS_OK; ButtonS[button_n].s = (value == 0) ? ISS_OFF : ISS_ON; IDSetSwitch(&ButtonSP, nullptr); }
void JoyStick::buttonEvent(int button_n, int value) { if (isConnected() == false) return; if (isDebug()) IDLog("buttonEvent[%d]: %s\n", button_n, value > 0 ? "On" : "Off"); ButtonSP.s = IPS_OK; ButtonS[button_n].s = (value == 0 )? ISS_OFF : ISS_ON; IDSetSwitch(&ButtonSP, NULL); }
bool StarbookDriver::performStart() { IUResetSwitch(&StartSP); if (last_known_state == starbook::INIT) { if (cmd_interface->Start()) { StartSP.s = IPS_OK; } } else { LOGF_WARN("Can't initialize in %s state, must be INIT", starbook::STATE_TO_STR.at(last_known_state).c_str()); StartSP.s = IPS_ALERT; } IDSetSwitch(&StartSP, nullptr); return true; }
bool RollOff::Abort() { MotionRequest=-1; // If both limit switches are off, then we're neither parked nor unparked. if (fullOpenLimitSwitch == false && fullClosedLimitSwitch == false) { IUResetSwitch(&ParkSP); ParkSP.s = IPS_IDLE; IDSetSwitch(&ParkSP, NULL); } return true; }
bool Vantage::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if (!strcmp(BaudRateSP.name, name)) { IUUpdateSwitch(&BaudRateSP, states, names, n); BaudRateSP.s = IPS_OK; IDSetSwitch(&BaudRateSP, NULL); return true; } } return INDI::Weather::ISNewSwitch(dev, name, states, names, n); }
bool MICCD::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) { if (strcmp(dev, getDeviceName()) == 0) { if (!strcmp(name, ReadModeSP.name)) { IUUpdateSwitch(&ReadModeSP, states, names, n); ReadModeSP.s = IPS_OK; IDSetSwitch(&ReadModeSP, nullptr); return true; } } return INDI::CCD::ISNewSwitch(dev, name, states, names, n); }
bool ASICCD::activateCooler(bool enable) { bool rc = (ASISetControlValue(m_camInfo->CameraID, ASI_COOLER_ON, enable ? ASI_TRUE : ASI_FALSE, ASI_FALSE) == ASI_SUCCESS); if (rc == false) CoolerSP.s = IPS_ALERT; else { CoolerS[0].s = enable ? ISS_ON : ISS_OFF; CoolerS[1].s = enable ? ISS_OFF: ISS_ON; CoolerSP.s = IPS_BUSY; } IDSetSwitch(&CoolerSP, NULL); return rc; }
bool XAGYLWheel::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if (!strcmp(ResetSP.name, name)) { IUUpdateSwitch(&ResetSP, states, names, n); int value = IUFindOnSwitchIndex(&ResetSP); IUResetSwitch(&ResetSP); if (value == 3) value = 6; bool rc = reset(value); if (rc) { switch (value) { case 0: DEBUG(INDI::Logger::DBG_SESSION, "Executing hard reboot..."); break; case 1: DEBUG(INDI::Logger::DBG_SESSION, "Restarting and moving to filter position #1..."); break; case 2: DEBUG(INDI::Logger::DBG_SESSION, "Calibration removed."); break; case 6: DEBUG(INDI::Logger::DBG_SESSION, "Calibrating..."); break; } } ResetSP.s = rc ? IPS_OK : IPS_ALERT; IDSetSwitch(&ResetSP, NULL); return true; } } return INDI::FilterWheel::ISNewSwitch(dev, name, states, names, n); }