您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ IDSetNumber函数代码示例

51自学网 2021-06-01 21:28:01
  C++
这篇教程C++ IDSetNumber函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中IDSetNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ IDSetNumber函数的具体用法?C++ IDSetNumber怎么用?C++ IDSetNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了IDSetNumber函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: IUUpdateNumber

/**************************************************************************************** Client is asking us to set a new number***************************************************************************************/bool RadioSim::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n){    if (strcmp (dev, getDeviceName()))        return false;    if (!strcmp(name, DetectorPropertiesNP.name))    {        IUUpdateNumber(&DetectorPropertiesNP, values, names, n);        DishSize = (DetectorPropertiesN[0].value);        DetectorPropertiesNP.s = IPS_OK;        IDSetNumber(&DetectorPropertiesNP, nullptr);        return true;    }    if (!strcmp(name, DetectorCoordsNP.name))    {        IUUpdateNumber(&DetectorCoordsNP, values, names, n);        DetectorCoordsNP.s = IPS_OK;        IDSetNumber(&DetectorCoordsNP, nullptr);        return true;    }    return INDI::Detector::ISNewNumber(dev, name, values, names, n);}
开发者ID:azwing,项目名称:indi,代码行数:30,


示例2: IDSetNumber

bool Weather::processLocationInfo(double latitude, double longitude, double elevation){    // Do not update if not necessary    if (latitude == LocationN[LOCATION_LATITUDE].value && longitude == LocationN[LOCATION_LONGITUDE].value &&        elevation == LocationN[LOCATION_ELEVATION].value)    {        LocationNP.s = IPS_OK;        IDSetNumber(&LocationNP, nullptr);    }    if (updateLocation(latitude, longitude, elevation))    {        LocationNP.s                        = IPS_OK;        LocationN[LOCATION_LATITUDE].value  = latitude;        LocationN[LOCATION_LONGITUDE].value = longitude;        LocationN[LOCATION_ELEVATION].value = elevation;        //  Update client display        IDSetNumber(&LocationNP, nullptr);        return true;    }    else    {        LocationNP.s = IPS_ALERT;        //  Update client display        IDSetNumber(&LocationNP, nullptr);        return false;    }}
开发者ID:geehalel,项目名称:indi,代码行数:29,


示例3: if

void MICCD::updateTemperature(){    float ccdtemp  = 0;    float ccdpower = 0;    int err        = 0;    if (isSimulation())    {        ccdtemp = TemperatureN[0].value;        if (TemperatureN[0].value < TemperatureRequest)            ccdtemp += TEMP_THRESHOLD;        else if (TemperatureN[0].value > TemperatureRequest)            ccdtemp -= TEMP_THRESHOLD;        ccdpower = 30;    }    else    {        if (gxccd_get_value(cameraHandle, GV_CHIP_TEMPERATURE, &ccdtemp) < 0)        {            char errorStr[MAX_ERROR_LEN];            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));            LOGF_ERROR("Getting temperature failed: %s.", errorStr);            err |= 1;        }        if (gxccd_get_value(cameraHandle, GV_POWER_UTILIZATION, &ccdpower) < 0)        {            char errorStr[MAX_ERROR_LEN];            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));            LOGF_ERROR("Getting voltage failed: %s.", errorStr);            err |= 2;        }    }    TemperatureN[0].value = ccdtemp;    CoolerN[0].value      = ccdpower * 100.0;    if (TemperatureNP.s == IPS_BUSY && fabs(TemperatureN[0].value - TemperatureRequest) <= TEMP_THRESHOLD)    {        // end of temperature ramp        TemperatureN[0].value = TemperatureRequest;        TemperatureNP.s       = IPS_OK;    }    if (err)    {        if (err & 1)            TemperatureNP.s = IPS_ALERT;        if (err & 2)            CoolerNP.s = IPS_ALERT;    }    else    {        CoolerNP.s = IPS_OK;    }    IDSetNumber(&TemperatureNP, nullptr);    IDSetNumber(&CoolerNP, nullptr);    temperatureID = IEAddTimer(POLLMS, MICCD::updateTemperatureHelper, this);}
开发者ID:azwing,项目名称:indi,代码行数:60,


示例4: IUUpdateNumber

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);}
开发者ID:jochym,项目名称:indilib,代码行数:60,


示例5: LOG_DEBUG

bool ArmPlat::AbortFocuser(){    if ( port == -1 )        return false;    int rc = -1;    char cmd[SLP_SEND_BUF_SIZE]={0};    LOG_DEBUG("Aborting motion" );    sprintf(cmd, "!step stop %d#", port );    if ( slpSendRxInt( cmd, &rc ) )    {        if ( rc == 0 )        {                FocusAbsPosNP.s = IPS_IDLE;                FocusRelPosNP.s = IPS_IDLE;                IDSetNumber(&FocusAbsPosNP, nullptr);                IDSetNumber(&FocusRelPosNP, nullptr);                return true;        }    }    return true;}
开发者ID:azwing,项目名称:indi,代码行数:25,


示例6: IDSetSwitch

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.");    }}
开发者ID:rrogge,项目名称:indi,代码行数:35,


示例7: abortSlew

bool LX200_16::handleAltAzSlew(){	char altStr[64], azStr[64];      if (HorizontalCoordsNP.s == IPS_BUSY)	  {         abortSlew(PortFD);	     // sleep for 100 mseconds	     usleep(100000);	  }      if (isSimulation() == false && slewToAltAz(PortFD))	  {        HorizontalCoordsNP.s = IPS_ALERT;        IDSetNumber(&HorizontalCoordsNP, "Slew is not possible.");        return false;	  }      HorizontalCoordsNP.s = IPS_BUSY;	  fs_sexa(azStr, targetAZ, 2, 3600);	  fs_sexa(altStr, targetALT, 2, 3600);      TrackState = SCOPE_SLEWING;      IDSetNumber(&HorizontalCoordsNP, "Slewing to Alt %s - Az %s", altStr, azStr);      return true;}
开发者ID:A-j-K,项目名称:indi,代码行数:27,


示例8: IUUpdateNumber

/********************************************************************************* Client is asking us to set a new number*******************************************************************************/bool DSICCD::ISNewNumber(const char *dev, const char *name,                         double values[], char *names[], int n){    if (!strcmp(dev, getDeviceName()))    {        if (!strcmp(name, GainNP.name))        {	    IUUpdateNumber(&GainNP, values, names, n);	    GainNP.s = IPS_OK;	    IDSetNumber(&GainNP, NULL);            return true;        }        if (!strcmp(name, OffsetNP.name))        {	    IUUpdateNumber(&OffsetNP, values, names, n);	    OffsetNP.s = IPS_OK;	    IDSetNumber(&OffsetNP, NULL);            return true;        }    }    // If we didn't process anything above, let the parent handle it.    return INDI::CCD::ISNewNumber(dev,name,values,names,n);}
开发者ID:jochym,项目名称:indilib,代码行数:31,


示例9: catch

bool QSICCD::SelectFilter(int targetFilter){    short filter = targetFilter - 1;    try    {        QSICam.put_Position(filter);    }    catch (std::runtime_error err)    {        FilterSlotNP.s = IPS_ALERT;        DEBUGF(INDI::Logger::DBG_ERROR, "put_Position() failed. %s.", err.what());        return false;    }    // Check current filter position    short newFilter = QueryFilter();    if (newFilter == targetFilter)    {        FilterSlotN[0].value = targetFilter;        FilterSlotNP.s       = IPS_OK;        DEBUGF(INDI::Logger::DBG_DEBUG, "Filter set to slot #%d", targetFilter);        IDSetNumber(&FilterSlotNP, nullptr);        return true;    }    IDSetNumber(&FilterSlotNP, nullptr);    FilterSlotNP.s = IPS_ALERT;    return false;}
开发者ID:rrogge,项目名称:indi,代码行数:30,


示例10: LOG_WARN

IPState TCFS::MoveRelFocuser(FocusDirection dir, uint32_t ticks){    if (FocusModeSP.sp[0].s != ISS_ON)    {        LOG_WARN("The focuser can only be moved in Manual mode.");        return IPS_ALERT;    }    targetTicks    = ticks;    targetPosition = currentPosition;    // Inward    if (dir == FOCUS_INWARD)    {        targetPosition -= targetTicks;        dispatch_command(FIN);    }    // Outward    else    {        targetPosition += targetTicks;        dispatch_command(FOUT);    }    FocusAbsPosNP.s = IPS_BUSY;    FocusRelPosNP.s = IPS_BUSY;    IDSetNumber(&FocusAbsPosNP, nullptr);    IDSetNumber(&FocusRelPosNP, nullptr);    simulated_position = targetPosition;    return IPS_BUSY;}
开发者ID:djibb,项目名称:indi,代码行数:33,


示例11: IDSetNumber

bool DomeSim::SetupParms(){    targetAz = 0;    shutterTimer = SHUTTER_TIMER;    DomeAbsPosN[0].value = 0;    DomeParamN[0].value  = 5;    IDSetNumber(&DomeAbsPosNP, NULL);    IDSetNumber(&DomeParamNP, NULL);    if (InitPark())    {        // If loading parking data is successful, we just set the default parking values.        SetAxis1ParkDefault(90);    }    else    {        // Otherwise, we set all parking data to default in case no parking data is found.        SetAxis1Park(90);        SetAxis1ParkDefault(90);    }    return true;}
开发者ID:mp77,项目名称:indi,代码行数:26,


示例12: INDI_UNUSED

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;}
开发者ID:djibb,项目名称:indi,代码行数:60,


示例13: IDSetNumber

void SestoSenso::GetFocusParams(){    if (updatePosition())        IDSetNumber(&FocusAbsPosNP, nullptr);    if (updateTemperature())        IDSetNumber(&TemperatureNP, nullptr);}
开发者ID:rrogge,项目名称:indi,代码行数:8,


示例14: IDSetNumber

bool MaxDomeII::SetupParms(){    DomeAbsPosN[0].value = 0;    IDSetNumber(&DomeAbsPosNP, NULL);    IDSetNumber(&DomeParamNP, NULL);    return true;}
开发者ID:mp77,项目名称:indi,代码行数:9,


示例15: IUFindOnSwitchIndex

bool ioptronHC8406::Sync(double ra, double dec){    char syncString[256];    int syncType = IUFindOnSwitchIndex(&SyncCMRSP);    if (!isSimulation())    {        if (setObjectRA(PortFD, ra) < 0 || setObjectDEC(PortFD, dec) < 0)        {            EqNP.s = IPS_ALERT;            IDSetNumber(&EqNP, "Error setting RA/DEC. Unable to Sync.");            return false;        }        bool syncOK = true;        switch (syncType)        {        case USE_REGULAR_SYNC:            if (::Sync(PortFD, syncString) < 0)                syncOK = false;            break;        case USE_CMR_SYNC:            if (ioptronHC8406SyncCMR(syncString) < 0)                syncOK = false;            break;        default:            break;        }        if (syncOK == false)        {            EqNP.s = IPS_ALERT;            IDSetNumber(&EqNP, "Synchronization failed.");            return false;        }    }    currentRA  = ra;    currentDEC = dec;    DEBUGF(INDI::Logger::DBG_DEBUG, "%s Synchronization successful %s", (syncType == USE_REGULAR_SYNC ? "CM" : "CMR"), syncString);    DEBUG(INDI::Logger::DBG_SESSION, "Synchronization successful.");    EqNP.s     = IPS_OK;    NewRaDec(currentRA, currentDEC);    return true;}
开发者ID:rrogge,项目名称:indi,代码行数:54,


示例16: readU32

/************************************************************************************ ** ***********************************************************************************/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;}
开发者ID:sterne-jaeger,项目名称:indi,代码行数:56,


示例17: isSimulation

bool MICCD::setupParams(){    bool sim = isSimulation();    if (sim)    {        SetCCDParams(4032, 2688, 16, 9, 9);    }    else    {        int chipW, chipD, pixelW, pixelD;        gxccd_get_integer_parameter(cameraHandle, GIP_CHIP_W, &chipW);        gxccd_get_integer_parameter(cameraHandle, GIP_CHIP_D, &chipD);        gxccd_get_integer_parameter(cameraHandle, GIP_PIXEL_W, &pixelW);        gxccd_get_integer_parameter(cameraHandle, GIP_PIXEL_D, &pixelD);        SetCCDParams(chipW, chipD, 16, pixelW / 1000.0, pixelD / 1000.0);    }    int nbuf = PrimaryCCD.getXRes() * PrimaryCCD.getYRes() * PrimaryCCD.getBPP() / 8;    nbuf += 512;    PrimaryCCD.setFrameBufferSize(nbuf);    int expTime = 0;    gxccd_get_integer_parameter(cameraHandle, GIP_MINIMAL_EXPOSURE, &expTime);    minExpTime = expTime / 1000000.0; // convert to seconds    PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", minExpTime, 3600, 1, false);    gxccd_get_integer_parameter(cameraHandle, GIP_MAX_BINNING_X, &maxBinX);    gxccd_get_integer_parameter(cameraHandle, GIP_MAX_BINNING_Y, &maxBinY);    if (!sim && hasGain)    {        float gain = 0;        if (gxccd_get_value(cameraHandle, GV_ADC_GAIN, &gain) < 0)        {            char errorStr[MAX_ERROR_LEN];            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));            DEBUGF(INDI::Logger::DBG_ERROR, "Getting gain failed: %s.", errorStr);            GainN[0].value = 0;            GainNP.s = IPS_ALERT;            IDSetNumber(&GainNP, NULL);            return false;        }        else        {            GainN[0].value = gain;            GainNP.s = IPS_OK;            IDSetNumber(&GainNP, NULL);        }    }    return true;}
开发者ID:garlick,项目名称:indi,代码行数:53,


示例18: DEBUG

bool IEQPro::ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n){    if (!strcmp (dev, getDeviceName()))    {        // Custom Tracking Rate        if (!strcmp(name, CustomTrackRateNP.name))        {            if (TrackModeS[TRACK_CUSTOM].s != ISS_ON)            {                CustomTrackRateNP.s = IPS_IDLE;                DEBUG(INDI::Logger::DBG_ERROR, "Can only set tracking rate if tracking mode is set to custom.");                IDSetNumber(&CustomTrackRateNP, NULL);                return true;            }            IUUpdateNumber(&CustomTrackRateNP, values, names, n);            if (set_ieqpro_custom_track_rate(PortFD, CustomTrackRateN[0].value))                CustomTrackRateNP.s = IPS_OK;            else                CustomTrackRateNP.s = IPS_ALERT;            IDSetNumber(&CustomTrackRateNP, NULL);            return true;        }        // Guiding Rate        if (!strcmp(name, GuideRateNP.name))        {            IUUpdateNumber(&GuideRateNP, values, names, n);            if (set_ieqpro_guide_rate(PortFD, GuideRateN[0].value))                GuideRateNP.s = IPS_OK;            else                GuideRateNP.s = IPS_ALERT;            IDSetNumber(&GuideRateNP, NULL);            return true;        }        if (!strcmp(name,GuideNSNP.name) || !strcmp(name,GuideWENP.name))        {            processGuiderProperties(name, values, names, n);            return true;        }    }    return INDI::Telescope::ISNewNumber (dev, name, values, names, n);}
开发者ID:mp77,项目名称:indi,代码行数:53,


示例19: IUFindIndex

bool Weather::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n){    //  first check if it's for our device    if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)    {        if (strcmp(name, "GEOGRAPHIC_COORD") == 0)        {            int latindex       = IUFindIndex("LAT", names, n);            int longindex      = IUFindIndex("LONG", names, n);            int elevationindex = IUFindIndex("ELEV", names, n);            if (latindex == -1 || longindex == -1 || elevationindex == -1)            {                LocationNP.s = IPS_ALERT;                IDSetNumber(&LocationNP, "Location data missing or corrupted.");            }            double targetLat  = values[latindex];            double targetLong = values[longindex];            double targetElev = values[elevationindex];            return processLocationInfo(targetLat, targetLong, targetElev);        }        // Update period        if (strcmp(name, "WEATHER_UPDATE") == 0)        {            IUUpdateNumber(&UpdatePeriodNP, values, names, n);            UpdatePeriodNP.s = IPS_OK;            IDSetNumber(&UpdatePeriodNP, nullptr);            if (UpdatePeriodN[0].value == 0)                DEBUG(Logger::DBG_SESSION, "Periodic updates are disabled.");            else            {                if (updateTimerID > 0)                    RemoveTimer(updateTimerID);                updateTimerID = SetTimer(UpdatePeriodN[0].value * 1000);            }            return true;        }        // Pass to weather interface        if (processNumber(dev, name, values, names, n))            return true;    }    return DefaultDevice::ISNewNumber(dev, name, values, names, n);}
开发者ID:geehalel,项目名称:indi,代码行数:51,


示例20: IUFindNumber

bool LX200_16::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n){    double newAlt = 0, newAz = 0;    if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)    {        if (!strcmp(name, HorizontalCoordsNP.name))        {            int i = 0, nset = 0;            for (nset = i = 0; i < n; i++)            {                INumber *horp = IUFindNumber(&HorizontalCoordsNP, names[i]);                if (horp == &HorizontalCoordsN[0])                {                    newAlt = values[i];                    nset += newAlt >= -90. && newAlt <= 90.0;                }                else if (horp == &HorizontalCoordsN[1])                {                    newAz = values[i];                    nset += newAz >= 0. && newAz <= 360.0;                }            }            if (nset == 2)            {                if (!isSimulation() && (setObjAz(PortFD, newAz) < 0 || setObjAlt(PortFD, newAlt) < 0))                {                    HorizontalCoordsNP.s = IPS_ALERT;                    IDSetNumber(&HorizontalCoordsNP, "Error setting Alt/Az.");                    return false;                }                targetAZ  = newAz;                targetALT = newAlt;                return handleAltAzSlew();            }            else            {                HorizontalCoordsNP.s = IPS_ALERT;                IDSetNumber(&HorizontalCoordsNP, "Altitude or Azimuth missing or invalid");                return false;            }        }    }    LX200GPS::ISNewNumber(dev, name, values, names, n);    return true;}
开发者ID:rrogge,项目名称:indi,代码行数:50,


示例21: INDI_UNUSED

bool RotatorInterface::processNumber(const char *dev, const char *name, double values[], char *names[], int n){    INDI_UNUSED(names);    INDI_UNUSED(n);    if (dev != nullptr && strcmp(dev, m_defaultDevice->getDeviceName()) == 0)    {        ////////////////////////////////////////////        // Move Absolute Angle        ////////////////////////////////////////////        if (strcmp(name, GotoRotatorNP.name) == 0)        {            if (values[0] == GotoRotatorN[0].value)            {                GotoRotatorNP.s = IPS_OK;                IDSetNumber(&GotoRotatorNP, nullptr);                return true;            }            GotoRotatorNP.s = MoveRotator(values[0]);            IDSetNumber(&GotoRotatorNP, nullptr);            if (GotoRotatorNP.s == IPS_BUSY)                DEBUGFDEVICE(m_defaultDevice->getDeviceName(), Logger::DBG_SESSION, "Rotator moving to %.2f degrees...", values[0]);            return true;        }        ////////////////////////////////////////////        // Sync        ////////////////////////////////////////////        else if (strcmp(name, SyncRotatorNP.name) == 0)        {            if (values[0] == GotoRotatorN[0].value)            {                SyncRotatorNP.s = IPS_OK;                IDSetNumber(&SyncRotatorNP, nullptr);                return true;            }            bool rc = SyncRotator(values[0]);            SyncRotatorNP.s = rc ? IPS_OK : IPS_ALERT;            if (rc)                SyncRotatorN[0].value = values[0];            IDSetNumber(&SyncRotatorNP, nullptr);            return true;        }    }    return false;}
开发者ID:azwing,项目名称:indi,代码行数:49,


示例22: CalcTimeLeft

void FocusMaster::TimerHit(){    if (!isConnected())        return;    //uint32_t currentTicks = 0;    if (FocusTimerNP.s == IPS_BUSY)    {        float remaining = CalcTimeLeft(focusMoveStart, focusMoveRequest);        if (remaining <= 0)        {            FocusTimerNP.s       = IPS_OK;            FocusTimerN[0].value = 0;            AbortFocuser();        }        else            FocusTimerN[0].value = remaining * 1000.0;        IDSetNumber(&FocusTimerNP, nullptr);    }#if 0    bool rc = getPosition(&currentTicks);    if (rc)        FocusAbsPosN[0].value = currentTicks;        if (FocusAbsPosNP.s == IPS_BUSY || FocusRelPosNP.s == IPS_BUSY)    {        if (targetPosition == FocusAbsPosN[0].value)        {            if (FocusRelPosNP.s == IPS_BUSY)            {                FocusRelPosNP.s = IPS_OK;                IDSetNumber(&FocusRelPosNP, nullptr);            }            FocusAbsPosNP.s = IPS_OK;            LOG_DEBUG("Focuser reached target position.");        }    }    IDSetNumber(&FocusAbsPosNP, nullptr);#endif    SetTimer(POLLMS);}
开发者ID:azwing,项目名称:indi,代码行数:49,


示例23: switch

void INDI::GuiderInterface::GuideComplete(INDI_EQ_AXIS axis){    switch (axis)    {        case AXIS_DE:            GuideNSNP.s = IPS_IDLE;            IDSetNumber(&GuideNSNP, nullptr);            break;        case AXIS_RA:            GuideWENP.s = IPS_IDLE;            IDSetNumber(&GuideWENP, nullptr);            break;    }}
开发者ID:rumengb,项目名称:indi,代码行数:15,


示例24: IDSetNumber

bool WatchDog::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n){    if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)    {        if (!strcmp(HeartBeatNP.name, name))        {            double prevHeartBeat = HeartBeatN[0].value;            if (watchdogClient->isBusy())            {                HeartBeatNP.s = IPS_ALERT;                IDSetNumber(&HeartBeatNP, nullptr);                LOG_ERROR("Cannot change heart beat while shutdown is in progress...");                return true;            }            IUUpdateNumber(&HeartBeatNP, values, names, n);            HeartBeatNP.s = IPS_OK;            if (HeartBeatN[0].value == 0)                LOG_INFO("Watchdog is disabled.");            else            {                if (isConnected())                {                    if (prevHeartBeat != HeartBeatN[0].value)                        DEBUGF(INDI::Logger::DBG_SESSION,                               "Watchdog is enabled. Shutdown is triggered after %g minutes of communication loss with "                               "the client.",                               HeartBeatN[0].value);                    LOG_DEBUG("Received heart beat from client.");                    RemoveTimer(watchDogTimer);                    watchDogTimer = SetTimer(HeartBeatN[0].value * 60 * 1000);                }                else                    LOG_INFO("Watchdog is armed. Please connect to enable it.");            }            IDSetNumber(&HeartBeatNP, nullptr);            return true;        }    }    return DefaultDevice::ISNewNumber(dev, name, values, names, n);}
开发者ID:azwing,项目名称:indi,代码行数:48,


示例25: SetTimer

void SestoSenso::TimerHit(){    if (!isConnected())    {        SetTimer(POLLMS);        return;    }    if (FocusAbsPosNP.s == IPS_BUSY || FocusRelPosNP.s == IPS_BUSY)    {        if (isMotionComplete())        {            FocusAbsPosNP.s = IPS_OK;            FocusRelPosNP.s = IPS_OK;            IDSetNumber(&FocusRelPosNP, nullptr);            IDSetNumber(&FocusAbsPosNP, nullptr);            DEBUG(INDI::Logger::DBG_SESSION, "Focuser reached requested position.");        }        else            IDSetNumber(&FocusAbsPosNP, nullptr);        lastPos = FocusAbsPosN[0].value;        SetTimer(POLLMS);        return;    }    bool rc = updatePosition();    if (rc)    {        if (lastPos != FocusAbsPosN[0].value)        {            IDSetNumber(&FocusAbsPosNP, nullptr);            lastPos = FocusAbsPosN[0].value;        }    }    rc = updateTemperature();    if (rc)    {        if (fabs(lastTemperature - TemperatureN[0].value) >= 0.1)        {            IDSetNumber(&TemperatureNP, nullptr);            lastTemperature = TemperatureN[0].value;        }    }    SetTimer(POLLMS);}
开发者ID:rrogge,项目名称:indi,代码行数:48,


示例26: while

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;}
开发者ID:mp77,项目名称:indi,代码行数:30,


示例27: IDMessage

IPState FocusSim::MoveAbsFocuser(uint32_t targetTicks){    if (targetTicks < FocusAbsPosN[0].min || targetTicks > FocusAbsPosN[0].max)    {        IDMessage(getDeviceName(), "Error, requested absolute position is out of range.");        return IPS_ALERT;    }    double mid = (FocusAbsPosN[0].max - FocusAbsPosN[0].min)/2;    IDMessage(getDeviceName() , "Focuser is moving to requested position...");    // Limit to +/- 10 from initTicks    ticks = initTicks + (targetTicks - mid) / 5000.0;    if (isDebug())        IDLog("Current ticks: %g/n", ticks);    // simulate delay in motion as the focuser moves to the new position    usleep( abs(targetTicks - FocusAbsPosN[0].value) * FOCUS_MOTION_DELAY);    FocusAbsPosN[0].value = targetTicks;    FWHMN[0].value = 0.5625*ticks*ticks +  SeeingN[0].value;    if (FWHMN[0].value < SeeingN[0].value)        FWHMN[0].value = SeeingN[0].value;    IDSetNumber(&FWHMNP, NULL);    return IPS_OK;}
开发者ID:A-j-K,项目名称:indi,代码行数:34,


示例28: LOGF_INFO

bool lacerta_mfoc::SetTempComp(double values[], char *names[], int n){    LOGF_INFO("-> TEMPCOMP_SETTINGS", 0);    char MFOC_cmd[32]  = ": D ";    char MFOC_res[32]  = {0};    int nbytes_read    =  0;    int nbytes_written =  0;    int MFOC_tc_measd = 0;    int tc_int = 0;    char tc_char[32]  = {0};    char MFOC_res_type[32]  = "0";    TempCompNP.s = IPS_OK;    IUUpdateNumber(&TempCompNP, values, names, n);    tc_int = TempCompN[0].value;    sprintf(tc_char, "%d", tc_int);    strcat(tc_char, " #");    strcat(MFOC_cmd, tc_char);    tty_write_string(PortFD, MFOC_cmd, &nbytes_written);    LOGF_DEBUG("CMD <%s>", MFOC_cmd);    tty_write_string(PortFD, ": U #", &nbytes_written);    tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);    sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tc_measd);    LOGF_DEBUG("RES <%s>", MFOC_res);    IDSetNumber(&TempCompNP, nullptr);    return true;}
开发者ID:azwing,项目名称:indi,代码行数:32,


示例29: LOGF_DEBUG

bool lacerta_mfoc::SetBacklash(double values[], char *names[], int n){    LOGF_DEBUG("-> BACKLASH_SETTINGS", 0);    char MFOC_cmd[32]  = ": B ";    char MFOC_res[32]  = {0};    int nbytes_read    =  0;    int nbytes_written =  0;    int MFOC_tdir_measd = 0;    int bl_int = 0;    char bl_char[32]  = {0};    char MFOC_res_type[32]  = "0";    BacklashNP.s = IPS_OK;    IUUpdateNumber(&BacklashNP, values, names, n);    bl_int = BacklashN[0].value;    sprintf(bl_char, "%d", bl_int);    strcat(bl_char, " #");    strcat(MFOC_cmd, bl_char);    tty_write_string(PortFD, MFOC_cmd, &nbytes_written);    LOGF_DEBUG("CMD <%s>", MFOC_cmd);    tty_write_string(PortFD, ": J #", &nbytes_written);    tty_read_section(PortFD, MFOC_res, 0xD, FOCUSMFOC_TIMEOUT, &nbytes_read);    sscanf (MFOC_res, "%s %d", MFOC_res_type, &MFOC_tdir_measd);    LOGF_DEBUG("RES <%s>", MFOC_res);    IDSetNumber(&BacklashNP, nullptr);    return true;}
开发者ID:azwing,项目名称:indi,代码行数:32,



注:本文中的IDSetNumber函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ IDSetSwitch函数代码示例
C++ IDS_OPTION_HOOK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。