本文整理汇总了C++中IDSetNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ IDSetNumber函数的具体用法?C++ IDSetNumber怎么用?C++ IDSetNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IDSetNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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.");
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例13: IDSetNumber
void SestoSenso::GetFocusParams()
{
if (updatePosition())
IDSetNumber(&FocusAbsPosNP, nullptr);
if (updateTemperature())
IDSetNumber(&TemperatureNP, nullptr);
}
示例14: IDSetNumber
bool MaxDomeII::SetupParms()
{
DomeAbsPosN[0].value = 0;
IDSetNumber(&DomeAbsPosNP, NULL);
IDSetNumber(&DomeParamNP, NULL);
return true;
}
示例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;
}