bool WeatherSafetyProxy::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (strcmp(name, keywordTP.name) == 0) { keywordTP.s = IPS_OK; IUUpdateText(&keywordTP, texts, names, n); // update client display IDSetText(&keywordTP, nullptr); return true; } if (strcmp(name, ScriptsTP.name) == 0) { ScriptsTP.s = IPS_OK; IUUpdateText(&ScriptsTP, texts, names, n); // update client display IDSetText(&ScriptsTP, nullptr); return true; } if (strcmp(name, UrlTP.name) == 0) { UrlTP.s = IPS_OK; IUUpdateText(&UrlTP, texts, names, n); // update client display IDSetText(&UrlTP, nullptr); return true; } } return INDI::Weather::ISNewText(dev, name, texts, names, n); }
bool WeatherWatcher::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (!strcmp(watchFileTP.name, name)) { IUUpdateText(&watchFileTP, texts, names, n); watchFileTP.s = IPS_OK; IDSetText(&watchFileTP, nullptr); return true; } if (!strcmp(keywordTP.name, name)) { IUUpdateText(&keywordTP, texts, names, n); keywordTP.s = IPS_OK; IDSetText(&keywordTP, nullptr); return true; } if (!strcmp(separatorTP.name, name)) { IUUpdateText(&separatorTP, texts, names, n); separatorTP.s = IPS_OK; IDSetText(&separatorTP, nullptr); return true; } } return INDI::Weather::ISNewText(dev, name, texts, names, n); }
bool IpFocus::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if(strcmp(name,"FOCUSER_API_ENDPOINT")==0) { IUUpdateText(&FocuserEndpointTP, texts, names, n); FocuserEndpointTP.s = IPS_OK; IDSetText(&FocuserEndpointTP, NULL); return true; } if(strcmp(name,"BACKLASH_APPROACH_SETTINGS")==0) { IUUpdateText(&AlwaysApproachDirectionP, texts, names, n); AlwaysApproachDirectionP.s = IPS_OK; IDSetText(&AlwaysApproachDirectionP, NULL); return true; } if(strcmp(name,"BACKLASH_STEPS_SETTINGS")==0) { IUUpdateText(&BacklashStepsP, texts, names, n); BacklashStepsP.s = IPS_OK; IDSetText(&BacklashStepsP, NULL); return true; } } return INDI::Focuser::ISNewText(dev,name,texts,names,n); }
void SynscanDriver::sendStatus() { bool BasicMountInfoHasChanged = false; if (std::string(StatusT[MI_GOTO_STATUS].text) != m_MountInfo[MI_GOTO_STATUS]) { IUSaveText(&StatusT[MI_GOTO_STATUS], m_MountInfo[MI_GOTO_STATUS].c_str()); BasicMountInfoHasChanged = true; } if (std::string(StatusT[MI_POINT_STATUS].text) != m_MountInfo[MI_POINT_STATUS]) { IUSaveText(&StatusT[MI_POINT_STATUS], m_MountInfo[MI_POINT_STATUS].c_str()); BasicMountInfoHasChanged = true; } if (std::string(StatusT[MI_TRACK_MODE].text) != m_MountInfo[MI_TRACK_MODE]) { IUSaveText(&StatusT[MI_TRACK_MODE], m_MountInfo[MI_TRACK_MODE].c_str()); BasicMountInfoHasChanged = true; } if (BasicMountInfoHasChanged) { StatusTP.s = IPS_OK; IDSetText(&StatusTP, nullptr); } }
bool EQModSimulator::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { // first check if it's for our device if(strcmp(dev,telescope->getDeviceName())==0) { ITextVectorProperty *tvp =telescope->getText(name); if (tvp) { if ((tvp != SimMCVersionTP)) return false; if (telescope->isConnected()) { DEBUGDEVICE(telescope->getDeviceName(), INDI::Logger::DBG_WARNING,"Can not change simulation settings when mount is already connected"); return false; } tvp->s=IPS_OK; IUUpdateText(tvp,texts,names,n); IDSetText(tvp,NULL); return true; } } return false; }
bool INDI::CCD::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { // Ok, lets see if this is a property wer process //IDLog("IndiTelescope got %d new text items name %s\n",n,name); // first check if it's for our device if(strcmp(dev,getDeviceName())==0) { // This is for our device // Now lets see if it's something we process here if(strcmp(name,ActiveDeviceTP->name)==0) { int rc; //IDLog("calling update text\n"); ActiveDeviceTP->s=IPS_OK; rc=IUUpdateText(ActiveDeviceTP,texts,names,n); //IDLog("update text returns %d\n",rc); // Update client display IDSetText(ActiveDeviceTP,NULL); saveConfig(); IUFillNumberVector(&EqNP,EqN,2,ActiveDeviceT[0].text,"EQUATORIAL_PEC","EQ PEC",MAIN_CONTROL_TAB,IP_RW,60,IPS_IDLE); IDSnoopDevice(ActiveDeviceT[0].text,"EQUATORIAL_PEC"); IDSnoopDevice(ActiveDeviceT[0].text,"TELESCOPE_INFO"); IDSnoopDevice(ActiveDeviceT[1].text,"FWHM"); // We processed this one, so, tell the world we did it return true; } } return INDI::DefaultDevice::ISNewText(dev,name,texts,names,n); }
bool QikFlat::getFirmwareVersion() { DEBUG(INDI::Logger::DBG_SESSION, "GetFW version"); IUSaveText(&FirmwareT[0], sf->firmata_name); IDSetText(&FirmwareTP, NULL); return true; }
bool Controller::ISNewText (const char * dev, const char * name, char * texts[], char * names[], int n) { if(strcmp(dev,device->getDeviceName())==0) { if (!strcmp(name, "JOYSTICKSETTINGS") && n <= JoystickSettingTP.ntp) { for (int i=0; i < JoystickSettingTP.ntp; i++) { IText * tp = IUFindText(&JoystickSettingTP, names[i]); if (tp) { ControllerType cType = getControllerType(texts[i]); ControllerType myType = *((ControllerType *) JoystickSettingT[i].aux0); if (cType != myType) { JoystickSettingTP.s = IPS_ALERT; IDSetText(&JoystickSettingTP, NULL); DEBUGFDEVICE(dev, INDI::Logger::DBG_ERROR, "Cannot change controller type to %s.", texts[i]); return false; } } } IUUpdateText(&JoystickSettingTP, texts, names, n); for (int i=0; i < n; i++) { if (strstr(JoystickSettingT[i].text, "JOYSTICK_")) IDSnoopDevice("Joystick", JoystickSettingT[i].text); } JoystickSettingTP.s = IPS_OK; IDSetText(&JoystickSettingTP, NULL); return true; } } return false; }
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 ScopeScript::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (strcmp(dev, getDeviceName()) == 0 && strcmp(name, ScriptsTP.name) == 0) { IUUpdateText(&ScriptsTP, texts, names, n); IDSetText(&ScriptsTP, nullptr); return true; } return Telescope::ISNewText(dev, name, texts, names, n); }
bool FlipFlat::getFirmwareVersion() { if (isSimulation()) { IUSaveText(&FirmwareT[0], "Simulation"); IDSetText(&FirmwareTP, nullptr); return true; } char response[FLAT_RES]={0}; if (!sendCommand(">V000", response)) return false; char versionString[4] = { 0 }; snprintf(versionString, 4, "%s", response + 4); IUSaveText(&FirmwareT[0], versionString); IDSetText(&FirmwareTP, nullptr); return true; }
bool GPhotoCCD::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if(strcmp(name,PortTP.name)==0) { PortTP.s=IPS_OK; IUUpdateText(&PortTP,texts,names,n); IDSetText(&PortTP, NULL); return true; } if(CamOptions.find(name) != CamOptions.end()) { cam_opt *opt = CamOptions[name]; if (opt->widget->type != GP_WIDGET_TEXT) { DEBUGF(INDI::Logger::DBG_ERROR, "ERROR: Property '%s'is not a string", name); return false; } if (opt->widget->readonly) { DEBUGF(INDI::Logger::DBG_WARNING, "WARNING: Property %s is read-only", name); IDSetText(&opt->prop.text, NULL); return false; } if (IUUpdateText(&opt->prop.text, texts, names, n) < 0) return false; gphoto_set_widget_text(gphotodrv, opt->widget, texts[0]); opt->prop.num.s = IPS_OK; IDSetText(&opt->prop.text, NULL); return true; } } return INDI::CCD::ISNewText(dev, name, texts, names, n); }
bool QSICCD::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { int maxFilters = (int) FilterSlotN[0].max; //std::string filterDesignation[maxFilters]; if(strcmp(dev,getDeviceName())==0) { if (!strcmp(name, FilterNameTP->name)) { if (IUUpdateText(FilterNameTP, texts, names, n) < 0) { FilterNameTP->s = IPS_ALERT; IDSetText(FilterNameTP, "Error updating names. XML corrupted."); return false; } for (int i=0; i < maxFilters; i++) filterDesignation[i] = FilterNameT[i].text; if (SetFilterNames() == true) { FilterNameTP->s = IPS_OK; IDSetText(FilterNameTP, NULL); return true; } else { FilterNameTP->s = IPS_ALERT; IDSetText(FilterNameTP, "Error updating filter names."); return false; } } } return INDI::CCD::ISNewText(dev, name, texts, names, n); }
void INDI::GPS::TimerHit() { if (!isConnected()) { timerID = SetTimer(POLLMS); return; } IPState state = updateGPS(); LocationNP.s = state; TimeTP.s = state; RefreshSP.s = state; switch (state) { // Ok case IPS_OK: IDSetNumber(&LocationNP, nullptr); IDSetText(&TimeTP, nullptr); // We got data OK, but if we are required to update once in a while, we'll call it. if (PeriodN[0].value > 0) timerID = SetTimer(PeriodN[0].value*1000); return; break; // GPS fix is in progress or alert case IPS_ALERT: IDSetNumber(&LocationNP, nullptr); IDSetText(&TimeTP, nullptr); break; default: break; } timerID = SetTimer(POLLMS); }
bool DomeScript::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (strcmp(name, ScriptsTP.name) == 0) { IUUpdateText(&ScriptsTP, texts, names, n); ScriptsTP.s = IPS_OK; IDSetText(&ScriptsTP, nullptr); return true; } } return Dome::ISNewText(dev, name, texts, names, n); }
bool WatchDog::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { // first check if it's for our device if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (!strcmp(SettingsTP.name, name)) { IUUpdateText(&SettingsTP, texts, names, n); SettingsTP.s = IPS_OK; IDSetText(&SettingsTP, nullptr); return true; } if (!strcmp(ActiveDeviceTP.name, name)) { if (watchdogClient->isBusy()) { ActiveDeviceTP.s = IPS_ALERT; IDSetText(&ActiveDeviceTP, nullptr); LOG_ERROR("Cannot change devices names while shutdown is in progress..."); return true; } IUUpdateText(&ActiveDeviceTP, texts, names, n); ActiveDeviceTP.s = IPS_OK; IDSetText(&ActiveDeviceTP, nullptr); //watchdogClient->setTelescope(ActiveDeviceT[0].text); //watchdogClient->setDome(ActiveDeviceT[1].text); return true; } } return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n); }
/* Handle a request to change text. */ bool ShelyakEshel::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (!strcmp(dev, getDeviceName())) // check if the message is for our device { if (!strcmp(PortTP.name, name)) //check if is a port change request { IUUpdateText(&PortTP, texts, names, n); // update port PortTP.s = IPS_OK; // set state to ok IDSetText(&PortTP, nullptr); // tell clients to update the port return true; } } return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n); }
bool XAGYLWheel::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if (!strcmp(PortTP.name, name)) { IUUpdateText(&PortTP, texts, names, n); PortTP.s = IPS_OK; IDSetText(&PortTP, NULL); return true; } } return INDI::FilterWheel::ISNewText(dev, name, texts, names, n); }
bool Vantage::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(!strcmp(dev,getDeviceName())) { if (!strcmp(PortTP.name, name)) { IUUpdateText(&PortTP, texts, names, n); PortTP.s = IPS_OK; IDSetText(&PortTP, NULL); return true; } } return INDI::Weather::ISNewText(dev,name,texts,names,n); }
bool QSICCD::SetFilterNames() { try { QSICam.put_Names(filterDesignation); } catch (std::runtime_error err) { DEBUGF(INDI::Logger::DBG_ERROR, "put_Names() failed. %s.", err.what()); IDSetText(FilterNameTP, NULL); return false; } return true; }
bool WunderGround::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(!strcmp(dev,getDeviceName())) { if (!strcmp(wunderAPIKeyTP.name, name)) { IUUpdateText(&wunderAPIKeyTP, texts, names, n); wunderAPIKeyTP.s = IPS_OK; IDSetText(&wunderAPIKeyTP, NULL); return true; } } return INDI::Weather::ISNewText(dev,name,texts,names,n); }
bool TCP::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (!strcmp(dev, device->getDeviceName())) { // TCP Server settings if (!strcmp(name, AddressTP.name)) { IUUpdateText(&AddressTP, texts, names, n); AddressTP.s = IPS_OK; IDSetText(&AddressTP, nullptr); return true; } } return false; }
bool INDI::Focuser::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if (!strcmp(name, PortTP.name)) { IUUpdateText(&PortTP, texts, names, n); PortTP.s = IPS_OK; IDSetText(&PortTP, NULL); return true; } } controller->ISNewText(dev, name, texts, names, n); return DefaultDevice::ISNewText(dev, name, texts, names, n); }
bool INDI::Weather::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { // first check if it's for our device if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (!strcmp(name, ActiveDeviceTP.name)) { ActiveDeviceTP.s = IPS_OK; IUUpdateText(&ActiveDeviceTP, texts, names, n); // Update client display IDSetText(&ActiveDeviceTP, nullptr); IDSnoopDevice(ActiveDeviceT[0].text, "GEOGRAPHIC_COORD"); return true; } } return DefaultDevice::ISNewText(dev, name, texts, names, n); }
bool StarbookDriver::getFirmwareVersion() { starbook::VersionResponse res; starbook::ResponseCode rc = cmd_interface->Version(res); if (rc != starbook::OK) { LogResponse("Get version", rc); return false; } if (res.major_minor < 2.7) { LOGF_WARN("Get version [OK]: %s (< 2.7) not well supported", res.full_str.c_str()); } else { LOGF_INFO("Get version [OK]: %s", res.full_str.c_str()); } IUSaveText(&VersionT[0], res.full_str.c_str()); IDSetText(&VersionTP, nullptr); return true; }
bool FlipFlat::ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n) { if(strcmp(dev,getDeviceName())==0) { if (processLightBoxText(dev, name, texts, names, n)) return true; if (!strcmp(PortTP.name, name)) { IUUpdateText(&PortTP, texts, names, n); PortTP.s = IPS_OK; IDSetText(&PortTP, NULL); return true; } } return INDI::DefaultDevice::ISNewText(dev, name, texts, names, n); }
// Called by Weather::TimerHit every UpdatePeriodN[0].value seconds if we return IPS_OK or every 5 seconds otherwise IPState WeatherSafetyProxy::updateWeather() { IPState ret = IPS_ALERT; if (ScriptOrCurlS[WSP_USE_SCRIPT].s == ISS_ON) { ret = executeScript(); } else { ret = executeCurl(); } if (ret != IPS_OK) { if (Safety == WSP_SAFE) { SofterrorCount++; LOGF_WARN("Soft error %d occured during SAFE conditions, counting", SofterrorCount); if (SofterrorCount > softErrorHysteresisN[WSP_SOFT_ERROR_MAX].value) { char Warning[] = "Max softerrors reached while Weather was SAFE"; LOG_WARN(Warning); Safety = WSP_UNSAFE; setParameterValue("WEATHER_SAFETY", WSP_UNSAFE); IUSaveText(&reasonsT[0], Warning); reasonsTP.s = IPS_OK; IDSetText(&reasonsTP, nullptr); SofterrorRecoveryMode = true; ret = IPS_OK; // So that indiweather actually syncs the CriticalParameters we just set } } else { LOG_WARN("Soft error occured during UNSAFE conditions, ignore"); SofterrorCount = 0; SofterrorRecoveryCount = 0; } } else { SofterrorCount = 0; } return ret; }
bool JoyStick::ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) { if (dev != nullptr && strcmp(dev, getDeviceName()) == 0) { if (strcmp(name, PortTP.name) == 0) { PortTP.s = IPS_OK; IUUpdateText(&PortTP, texts, names, n); // Update client display IDSetText(&PortTP, nullptr); driver->setPort(PortT[0].text); return true; } } return DefaultDevice::ISNewText(dev, name, texts, names, n); }
bool INDI::LightBoxInterface::processLightBoxText(const char *dev, const char *name, char *texts[], char *names[], int n) { if(strcmp(dev,device->getDeviceName()) == 0) { if(!strcmp(name,ActiveDeviceTP.name)) { ActiveDeviceTP.s=IPS_OK; IUUpdateText(&ActiveDeviceTP,texts,names,n); // Update client display IDSetText(&ActiveDeviceTP,NULL); IDSnoopDevice(ActiveDeviceT[0].text,"FILTER_SLOT"); IDSnoopDevice(ActiveDeviceT[0].text,"FILTER_NAME"); return true; } } return false; }
void LX200Autostar::getBasicData() { // process parent LX200Generic::getBasicData(); if (!isSimulation()) { VersionTP.tp[0].text = new char[64]; getVersionDate(PortFD, VersionTP.tp[0].text); VersionTP.tp[1].text = new char[64]; getVersionTime(PortFD, VersionTP.tp[1].text); VersionTP.tp[2].text = new char[64]; getVersionNumber(PortFD, VersionTP.tp[2].text); VersionTP.tp[3].text = new char[128]; getFullVersion(PortFD, VersionTP.tp[3].text); VersionTP.tp[4].text = new char[128]; getProductName(PortFD, VersionTP.tp[4].text); IDSetText(&VersionTP, nullptr); } }