#include "pidf_local.h" /* This will return the *REAL* number of sensors modified by calibration data */ SDDAS_INT CalNSets (SDDAS_ULONG key, const SDDAS_CHAR *exten, SDDAS_INT calnum, SDDAS_INT *nsets) { SDDAS_INT num_sets; SDDAS_INT sen_mod; SDDAS_INT error_code; if ((error_code = ReadNewPidf (key, exten, CAL_DATA, calnum, NOTUSED, NSETS, (void *) &num_sets)) != ALL_OKAY) return (error_code); /* Was able to read number of cal sets - if its only one, see if it really */ /* means all */ if (num_sets == 1) { if ((error_code = ReadNewPidf (key, exten, CAL_DATA, calnum, NOTUSED, SENSETS, (void *) &sen_mod)) != ALL_OKAY) return (error_code); /* if the sensors modified is -1, we need to return full number of sensors */ if (sen_mod == -1) if ((error_code = ReadNewPidf (key, exten, SENSOR, NOTUSED, NOTUSED, NUMOF, (void *) &num_sets)) != ALL_OKAY) return (error_code); /* by now, num_sets should equal the right value */ } *nsets = num_sets; return (ALL_OKAY); } /* Return the real array of sensors modified */ SDDAS_INT CalSenSets (SDDAS_ULONG key, const SDDAS_CHAR *exten, SDDAS_INT calnum, SDDAS_INT *nsets) { SDDAS_INT error_code; SDDAS_INT num_sets; SDDAS_INT i; if ((error_code = ReadNewPidf (key, exten, CAL_DATA, calnum, NOTUSED, SENSETS, (void *) nsets)) != ALL_OKAY) return (error_code); /* Was able to read the sensors modified - if its a -1, it really means all */ if (nsets [0] == -1) { if ((error_code = ReadNewPidf (key, exten, SENSOR, NOTUSED, NOTUSED, NUMOF, (void *) &num_sets)) != ALL_OKAY) return (error_code); /* put each sensor in the array */ for (i = 0; i < num_sets; i++) nsets [i] = i; } return (ALL_OKAY); } SDDAS_INT CalSrcFlag (SDDAS_ULONG key, const SDDAS_CHAR *exten, SDDAS_INT calnum, SDDAS_CHAR *cal_src_flag) { SDDAS_CHAR src_flag; SDDAS_INT error_code; /* For Backwards compatibility, if this field is not defined within the current */ /* PIDF file, set to it's default value of 'V' for VIDF definition. */ if ((error_code = ReadNewPidf (key, exten, CAL_DATA, calnum, NOTUSED, SRCFLAG, (void *) &src_flag)) != ALL_OKAY) *cal_src_flag = 'V'; /* Make sure legitimate value. Anything other 'V', 'S' or 'A' defaults to 'V' */ else if (src_flag != 'V' && src_flag != 'S' && src_flag != 'A' && src_flag != 'v' && src_flag != 's' && src_flag != 'a') *cal_src_flag = 'V'; else *cal_src_flag = src_flag; return (1); }