}
}
+ guess_sampling_rate(mdata);
+
switch (mdata->file_type) {
case HPCS_TYPE_CE_CCD:
pret = read_signal(datafile, &mdata->data, &mdata->data_count, CE_CCD_STEP, mdata->sampling_rate, SIGTYPE_FLOATING);
return ret;
}
-static enum HPCS_ParseCode autodetect_file_type(FILE* datafile, enum HPCS_File_Type* file_type, const bool p_means_pressure)
+static enum HPCS_ParseCode autodetect_file_type(FILE* datafile, enum HPCS_FileType* file_type, const bool p_means_pressure)
{
char* type_id;
enum HPCS_ParseCode pret;
return DCHECK_NO_MARKER;
}
-static HPCS_step guess_current_step(struct HPCS_MeasuredData* const mdata)
+static HPCS_step guess_current_step(const struct HPCS_MeasuredData* mdata)
{
if (strcmp(mdata->cs_ver, CHEMSTAT_VER_B0625) == 0)
return CE_CURRENT_STEP;
return CE_WORK_PARAM_STEP;
}
-static bool guess_p_meaning(struct HPCS_MeasuredData* const mdata)
+static bool guess_p_meaning(const struct HPCS_MeasuredData* mdata)
{
if (strcmp(mdata->cs_ver, CHEMSTAT_VER_B0625) == 0)
return false;
return true;
}
+static void guess_sampling_rate(struct HPCS_MeasuredData* mdata)
+{
+ if (strcmp(mdata->cs_ver, CHEMSTAT_VER_B0625)) {
+ switch (mdata->file_type) {
+ case HPCS_TYPE_CE_DAD:
+ mdata->sampling_rate *= 10;
+ break;
+ default:
+ mdata->sampling_rate = 1.67;
+ }
+ }
+}
+
static enum HPCS_ParseCode read_dad_wavelength(FILE* datafile, struct HPCS_Wavelength* const measured, struct HPCS_Wavelength* const reference)
{
char* start_idx, *interv_idx, *end_idx, *temp, *str;
#define LIBHPCS_CC
#endif
-enum HPCS_File_Type {
+enum HPCS_FileType {
HPCS_TYPE_CE_CCD,
HPCS_TYPE_CE_CURRENT,
HPCS_TYPE_CE_DAD,
HPCS_E_UNKNOWN_TYPE
};
+enum HPCS_SignalType {
+ SIGTYPE_FIXED,
+ SIGTYPE_FLOATING
+};
+
struct HPCS_Date {
uint32_t year;
uint8_t month;
double sampling_rate;
struct HPCS_Wavelength dad_wavelength_msr;
struct HPCS_Wavelength dad_wavelength_ref;
- enum HPCS_File_Type file_type;
+ enum HPCS_FileType file_type;
struct HPCS_TVPair* data;
size_t data_count;
};
PARSE_W_NO_DATA
};
-enum HPCS_SignalType {
- SIGTYPE_FIXED,
- SIGTYPE_FLOATING
-};
-
-enum HPCS_Wavelength_Type {
+enum HPCS_WavelengthType {
WAVELENGTH_MEASURED,
WAVELENGTH_REFERENCE
};
const char* HPCS_E_UNKNOWN_TYPE_STR = "The specified file contains an unknown type of measurement.";
const char* HPCS_E__UNKNOWN_EC_STR = "Unknown error code.";
-static enum HPCS_ParseCode autodetect_file_type(FILE* datafile, enum HPCS_File_Type* file_type, const bool p_means_pressure);
+static enum HPCS_ParseCode autodetect_file_type(FILE* datafile, enum HPCS_FileType* file_type, const bool p_means_pressure);
static enum HPCS_DataCheckCode check_for_marker(const char* const segment, size_t* const next_marker_idx);
-static HPCS_step guess_current_step(struct HPCS_MeasuredData* const mdata);
-static bool guess_p_meaning(struct HPCS_MeasuredData* const mdata);
+static HPCS_step guess_current_step(const struct HPCS_MeasuredData* mdata);
+static bool guess_p_meaning(const struct HPCS_MeasuredData* mdata);
+static void guess_sampling_rate(struct HPCS_MeasuredData* mdata);
static enum HPCS_ParseCode read_dad_wavelength(FILE* datafile, struct HPCS_Wavelength* const measured, struct HPCS_Wavelength* const reference);
static uint8_t month_to_number(const char* const month);
static enum HPCS_ParseCode read_date(FILE* datafile, struct HPCS_Date* const date);