Ejemplo n.º 1
0
bool IntConstraint::getMax(int& max) const
{
    if (!hasMax())
        return false;

    max = m_max;
    return true;
}
Ejemplo n.º 2
0
bool DoubleConstraint::getMax(double& max) const
{
    if (!hasMax())
        return false;
    
    max = m_max;
    return true;
}
Ejemplo n.º 3
0
int Test_Rdr(SaHpiSessionIdT sessionId,
	     SaHpiResourceIdT resourceId, SaHpiRdrT rdr)
{
	SaErrorT status;
	int retval = SAF_TEST_NOTSUPPORT;
	SaHpiSensorRecT *sensorRec;
	SaHpiSensorThresholdsT threshold;
	SaHpiSensorReadingTypeT type;
	SaHpiSensorReadingUnionT maxValue;

	if (canTest(sessionId, resourceId, &rdr)) {

		sensorRec = &rdr.RdrTypeUnion.SensorRec;
		type = sensorRec->DataFormat.ReadingType;

		if (hasMax(sensorRec)) {

			maxValue = getMaxValue(sensorRec);
			if (!isOverflow(maxValue, type)) {

				if (hasWriteThreshold
				    (sensorRec, SAHPI_STM_UP_CRIT)) {

					initThresholds(&threshold, type);

					threshold.UpCritical.IsSupported =
					    SAHPI_TRUE;
					threshold.UpCritical.Value =
					    increaseValue(maxValue, type);

					status =
					    saHpiSensorThresholdsSet(sessionId,
								     resourceId,
								     sensorRec->
								     Num,
								     &threshold);

					if (status == SA_ERR_HPI_INVALID_CMD) {
						retval = SAF_TEST_PASS;
					} else {
						retval = SAF_TEST_FAIL;
						e_print
						    (saHpiSensorThresholdsSet,
						     SA_ERR_HPI_INVALID_CMD,
						     status);
					}
				} else
				    if (hasWriteThreshold
					(sensorRec, SAHPI_STM_UP_MAJOR)) {

					initThresholds(&threshold, type);

					threshold.UpMajor.IsSupported =
					    SAHPI_TRUE;
					threshold.UpMajor.Value =
					    increaseValue(maxValue, type);

					status =
					    saHpiSensorThresholdsSet(sessionId,
								     resourceId,
								     sensorRec->
								     Num,
								     &threshold);

					if (status == SA_ERR_HPI_INVALID_CMD) {
						retval = SAF_TEST_PASS;
					} else {
						retval = SAF_TEST_FAIL;
						e_print
						    (saHpiSensorThresholdsSet,
						     SA_ERR_HPI_INVALID_CMD,
						     status);
					}
				} else
				    if (hasWriteThreshold
					(sensorRec, SAHPI_STM_UP_MINOR)) {

					initThresholds(&threshold, type);

					threshold.UpMinor.IsSupported =
					    SAHPI_TRUE;
					threshold.UpMinor.Value =
					    increaseValue(maxValue, type);

					status =
					    saHpiSensorThresholdsSet(sessionId,
								     resourceId,
								     sensorRec->
								     Num,
								     &threshold);

					if (status == SA_ERR_HPI_INVALID_CMD) {
						retval = SAF_TEST_PASS;
					} else {
						retval = SAF_TEST_FAIL;
						e_print
						    (saHpiSensorThresholdsSet,
						     SA_ERR_HPI_INVALID_CMD,
						     status);
					}
				}
			}
		}
	}

	return retval;
}