bool StarbookDriver::Sync(double ra, double dec) { ra = ra * 15; // CONVERSION starbook::ResponseCode rc = cmd_interface->Align(ra, dec); LogResponse("Sync", rc); return rc == starbook::OK; }
bool StarbookDriver::Goto(double ra, double dec) { ra = ra * 15; // CONVERSION starbook::ResponseCode rc = cmd_interface->GotoRaDec(ra, dec); LogResponse("GOTO", rc); return rc == starbook::OK; }
int CWebServer::SendResponse(const HTTPRequest& request, int responseStatus, MHD_Response *response) const { LogResponse(request, responseStatus); int ret = MHD_queue_response(request.connection, responseStatus, response); MHD_destroy_response(response); return ret; }
bool StarbookDriver::updateTime(ln_date *utc, double utc_offset) { INDI_UNUSED(utc_offset); if (last_known_state != starbook::INIT) { LOGF_WARN("Can't 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 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 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; }
int CWebServer::AskForAuthentication(const HTTPRequest& request) const { struct MHD_Response *response = create_response(0, nullptr, MHD_NO, MHD_NO); if (!response) { CLog::Log(LOGERROR, "CWebServer[%hu]: unable to create HTTP Unauthorized response", m_port); return MHD_NO; } int ret = AddHeader(response, MHD_HTTP_HEADER_CONNECTION, "close"); if (!ret) { CLog::Log(LOGERROR, "CWebServer[%hu]: unable to prepare HTTP Unauthorized response", m_port); MHD_destroy_response(response); return MHD_NO; } LogResponse(request, MHD_HTTP_UNAUTHORIZED); ret = MHD_queue_basic_auth_fail_response(request.connection, "XBMC", response); MHD_destroy_response(response); return ret; }
bool StarbookDriver::SetSlewRate(int index) { starbook::ResponseCode rc = cmd_interface->SetSpeed(index); LogResponse("Setting slew rate", rc); return rc == starbook::OK; }
bool StarbookDriver::MoveWE(INDI_DIR_WE dir, INDI::Telescope::TelescopeMotionCommand command) { starbook::ResponseCode rc = cmd_interface->Move(dir, command); LogResponse("Move W-E", rc); return rc == starbook::OK; }
bool StarbookDriver::Park() { starbook::ResponseCode rc = cmd_interface->Home(); LogResponse("Parking", rc); return rc == starbook::OK; }
bool StarbookDriver::Abort() { starbook::ResponseCode rc = cmd_interface->Stop(); LogResponse("Aborting", rc); return rc == starbook::OK; }