diff --git a/src/DataVampire.cpp b/src/DataVampire.cpp index c49a881befa573c6faa8f4e4efdfcb6ae5a1565b..b129bfbb60e8f8d76a8dda46717bd3eb0ed4e25d 100644 --- a/src/DataVampire.cpp +++ b/src/DataVampire.cpp @@ -37,6 +37,10 @@ #include "DataVampire.h" #include "DataVampireClass.h" + +#include "acqthread.h" + + /* clang-format off */ /*----- PROTECTED REGION END -----*/ // DataVampire.cpp @@ -57,8 +61,8 @@ // GetMean | get_mean // GetHorPos | get_hor_pos // GetVerPos | get_ver_pos -// GetHorSigma | get_hor_sigma -// GetVerSigma | get_ver_sigma +// GetHorPosStd | get_hor_pos_std +// GetVerPosStd | get_ver_pos_std // GetValidValues | get_valid_values // SetBackground | set_background //================================================================ @@ -69,21 +73,22 @@ // MinThreshold | Tango::DevDouble Scalar // MaxThreshold | Tango::DevDouble Scalar // CommandString | Tango::DevString Scalar -// PollingTime | Tango::DevLong Scalar +// PollingPeriod | Tango::DevLong Scalar // PollingSamples | Tango::DevLong Scalar // Sum | Tango::DevDouble Scalar // Mean | Tango::DevDouble Scalar // HorPos | Tango::DevDouble Scalar // VerPos | Tango::DevDouble Scalar -// HorSigma | Tango::DevDouble Scalar -// VerSigma | Tango::DevDouble Scalar +// HorPosStd | Tango::DevDouble Scalar // ValidValues | Tango::DevLong Scalar -// Enable | Tango::DevBoolean Scalar +// EnableAcquisition | Tango::DevBoolean Scalar // CacheSize | Tango::DevLong Scalar // AutoBackgroundSamples | Tango::DevLong Scalar // PostAcqRoi | Tango::DevBoolean Scalar // Width | Tango::DevLong Scalar // Height | Tango::DevLong Scalar +// VerPosStd | Tango::DevDouble Scalar +// EnablePolling | Tango::DevBoolean Scalar // RoiParam | Tango::DevLong Spectrum ( max = 4) // Spectrum | Tango::DevDouble Spectrum ( max = 1000000) // HorBackground | Tango::DevDouble Spectrum ( max = 1000000) @@ -149,6 +154,12 @@ void DataVampire::delete_device() /* clang-format on */ // Delete device allocated objects /* clang-format off */ + abort_flag = true; + if (acqloop) { + acqloop->join(NULL); + acqloop = 0; + } + if (attr_CommandString_read) { delete [] *attr_CommandString_read; attr_CommandString_read = 0; @@ -157,27 +168,33 @@ void DataVampire::delete_device() if (device) delete device; + if (bn_device) + delete bn_device; + + delete mutex; + free_cache_buffer(); /*----- PROTECTED REGION END -----*/ // DataVampire::delete_device delete[] attr_MinThreshold_read; delete[] attr_MaxThreshold_read; delete[] attr_CommandString_read; - delete[] attr_PollingTime_read; + delete[] attr_PollingPeriod_read; delete[] attr_PollingSamples_read; delete[] attr_Sum_read; delete[] attr_Mean_read; delete[] attr_HorPos_read; delete[] attr_VerPos_read; - delete[] attr_HorSigma_read; - delete[] attr_VerSigma_read; + delete[] attr_HorPosStd_read; delete[] attr_ValidValues_read; - delete[] attr_Enable_read; + delete[] attr_EnableAcquisition_read; delete[] attr_CacheSize_read; delete[] attr_AutoBackgroundSamples_read; delete[] attr_PostAcqRoi_read; delete[] attr_Width_read; delete[] attr_Height_read; + delete[] attr_VerPosStd_read; + delete[] attr_EnablePolling_read; delete[] attr_RoiParam_read; delete[] attr_Spectrum_read; delete[] attr_HorBackground_read; @@ -207,21 +224,22 @@ void DataVampire::init_device() attr_MinThreshold_read = new Tango::DevDouble[1]; attr_MaxThreshold_read = new Tango::DevDouble[1]; attr_CommandString_read = new Tango::DevString[1]; - attr_PollingTime_read = new Tango::DevLong[1]; + attr_PollingPeriod_read = new Tango::DevLong[1]; attr_PollingSamples_read = new Tango::DevLong[1]; attr_Sum_read = new Tango::DevDouble[1]; attr_Mean_read = new Tango::DevDouble[1]; attr_HorPos_read = new Tango::DevDouble[1]; attr_VerPos_read = new Tango::DevDouble[1]; - attr_HorSigma_read = new Tango::DevDouble[1]; - attr_VerSigma_read = new Tango::DevDouble[1]; + attr_HorPosStd_read = new Tango::DevDouble[1]; attr_ValidValues_read = new Tango::DevLong[1]; - attr_Enable_read = new Tango::DevBoolean[1]; + attr_EnableAcquisition_read = new Tango::DevBoolean[1]; attr_CacheSize_read = new Tango::DevLong[1]; attr_AutoBackgroundSamples_read = new Tango::DevLong[1]; attr_PostAcqRoi_read = new Tango::DevBoolean[1]; attr_Width_read = new Tango::DevLong[1]; attr_Height_read = new Tango::DevLong[1]; + attr_VerPosStd_read = new Tango::DevDouble[1]; + attr_EnablePolling_read = new Tango::DevBoolean[1]; attr_RoiParam_read = new Tango::DevLong[4]; attr_Spectrum_read = new Tango::DevDouble[1000000]; attr_HorBackground_read = new Tango::DevDouble[1000000]; @@ -239,6 +257,7 @@ void DataVampire::init_device() *attr_MaxThreshold_read = 99999; *attr_CacheSize_read = 100; *attr_PostAcqRoi_read = false; + *attr_EnableAcquisition_read = true; num_rows_image = 0; num_cols_image = 0; @@ -276,10 +295,39 @@ void DataVampire::init_device() set_state(Tango::FAULT); set_status("Failed to execute device command, check CommandString property and restart device"); } + + + std::vector<std::string> results_a; + std::string bn_attr(bunchNumberString); + string_explode(bn_attr, "/", &results_a); + bn_attr_name = results[results_a.size()-1]; + pos = bn_attr.find(bn_attr_name); + if (pos != std::string::npos) { // if str2 found in str1 + bn_attr.erase(pos-1, bn_attr_name.length()+1); // erase str2 from str1 + } + bn_device_name = bn_attr; + + try { + bn_device = new Tango::DeviceProxy(bn_device_name); + } + catch(...) { + set_state(Tango::FAULT); + set_status("Failed to connect to BunchNumber device"); + } + + + + + cache_buffer = 0; allocate_cache_buffer(); + mutex = new omni_mutex(); + + acqloop = 0; + acqloop = new acqthread(this); + acqloop->start_undetached(); /*----- PROTECTED REGION END -----*/ // DataVampire::init_device } @@ -305,6 +353,7 @@ void DataVampire::get_device_property() dev_prop.push_back(Tango::DbDatum("VerCalib")); dev_prop.push_back(Tango::DbDatum("RoiParam")); dev_prop.push_back(Tango::DbDatum("CommandString")); + dev_prop.push_back(Tango::DbDatum("BunchNumberString")); // is there at least one property to be read ? if (dev_prop.size()>0) @@ -363,6 +412,17 @@ void DataVampire::get_device_property() // And try to extract CommandString value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> commandString; + // Try to initialize BunchNumberString from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> bunchNumberString; + else { + // Try to initialize BunchNumberString from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> bunchNumberString; + } + // And try to extract BunchNumberString value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> bunchNumberString; + } /*----- PROTECTED REGION ID(DataVampire::get_device_property_after) ENABLED START -----*/ @@ -567,45 +627,41 @@ void DataVampire::write_CommandString(Tango::WAttribute &attr) } //-------------------------------------------------------- /** - * Read attribute PollingTime related method + * Read attribute PollingPeriod related method * Description: -1: disabled * * Data type: Tango::DevLong * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::read_PollingTime(Tango::Attribute &attr) +void DataVampire::read_PollingPeriod(Tango::Attribute &attr) { - DEBUG_STREAM << "DataVampire::read_PollingTime(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(DataVampire::read_PollingTime) ENABLED START -----*/ - /* clang-format on */ + DEBUG_STREAM << "DataVampire::read_PollingPeriod(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_PollingPeriod) ENABLED START -----*/ // Set the attribute value - attr.set_value(attr_PollingTime_read); - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::read_PollingTime + attr.set_value(attr_PollingPeriod_read); + + /*----- PROTECTED REGION END -----*/ // DataVampire::read_PollingPeriod } //-------------------------------------------------------- /** - * Write attribute PollingTime related method + * Write attribute PollingPeriod related method * Description: -1: disabled * * Data type: Tango::DevLong * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::write_PollingTime(Tango::WAttribute &attr) +void DataVampire::write_PollingPeriod(Tango::WAttribute &attr) { - DEBUG_STREAM << "DataVampire::write_PollingTime(Tango::WAttribute &attr) entering... " << endl; + DEBUG_STREAM << "DataVampire::write_PollingPeriod(Tango::WAttribute &attr) entering... " << endl; // Retrieve write value Tango::DevLong w_val; attr.get_write_value(w_val); - /*----- PROTECTED REGION ID(DataVampire::write_PollingTime) ENABLED START -----*/ - /* clang-format on */ - // Add your own code - /* clang-format off */ - *attr_PollingTime_read = w_val; - - /*----- PROTECTED REGION END -----*/ // DataVampire::write_PollingTime + /*----- PROTECTED REGION ID(DataVampire::write_PollingPeriod) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // DataVampire::write_PollingPeriod } //-------------------------------------------------------- /** @@ -726,41 +782,21 @@ void DataVampire::read_VerPos(Tango::Attribute &attr) } //-------------------------------------------------------- /** - * Read attribute HorSigma related method + * Read attribute HorPosStd related method * Description: * * Data type: Tango::DevDouble * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::read_HorSigma(Tango::Attribute &attr) +void DataVampire::read_HorPosStd(Tango::Attribute &attr) { - DEBUG_STREAM << "DataVampire::read_HorSigma(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(DataVampire::read_HorSigma) ENABLED START -----*/ - /* clang-format on */ + DEBUG_STREAM << "DataVampire::read_HorPosStd(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_HorPosStd) ENABLED START -----*/ // Set the attribute value - attr.set_value(attr_HorSigma_read); - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::read_HorSigma -} -//-------------------------------------------------------- -/** - * Read attribute VerSigma related method - * Description: - * - * Data type: Tango::DevDouble - * Attr type: Scalar - */ -//-------------------------------------------------------- -void DataVampire::read_VerSigma(Tango::Attribute &attr) -{ - DEBUG_STREAM << "DataVampire::read_VerSigma(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(DataVampire::read_VerSigma) ENABLED START -----*/ - /* clang-format on */ - // Set the attribute value - attr.set_value(attr_VerSigma_read); - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::read_VerSigma + attr.set_value(attr_HorPosStd_read); + + /*----- PROTECTED REGION END -----*/ // DataVampire::read_HorPosStd } //-------------------------------------------------------- /** @@ -783,44 +819,41 @@ void DataVampire::read_ValidValues(Tango::Attribute &attr) } //-------------------------------------------------------- /** - * Read attribute Enable related method + * Read attribute EnableAcquisition related method * Description: * * Data type: Tango::DevBoolean * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::read_Enable(Tango::Attribute &attr) +void DataVampire::read_EnableAcquisition(Tango::Attribute &attr) { - DEBUG_STREAM << "DataVampire::read_Enable(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(DataVampire::read_Enable) ENABLED START -----*/ - /* clang-format on */ + DEBUG_STREAM << "DataVampire::read_EnableAcquisition(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_EnableAcquisition) ENABLED START -----*/ // Set the attribute value - attr.set_value(attr_Enable_read); - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::read_Enable + attr.set_value(attr_EnableAcquisition_read); + + /*----- PROTECTED REGION END -----*/ // DataVampire::read_EnableAcquisition } //-------------------------------------------------------- /** - * Write attribute Enable related method + * Write attribute EnableAcquisition related method * Description: * * Data type: Tango::DevBoolean * Attr type: Scalar */ //-------------------------------------------------------- -void DataVampire::write_Enable(Tango::WAttribute &attr) +void DataVampire::write_EnableAcquisition(Tango::WAttribute &attr) { - DEBUG_STREAM << "DataVampire::write_Enable(Tango::WAttribute &attr) entering... " << endl; + DEBUG_STREAM << "DataVampire::write_EnableAcquisition(Tango::WAttribute &attr) entering... " << endl; // Retrieve write value Tango::DevBoolean w_val; attr.get_write_value(w_val); - /*----- PROTECTED REGION ID(DataVampire::write_Enable) ENABLED START -----*/ - /* clang-format on */ - // Add your own code - /* clang-format off */ - *attr_Enable_read = w_val; - /*----- PROTECTED REGION END -----*/ // DataVampire::write_Enable + /*----- PROTECTED REGION ID(DataVampire::write_EnableAcquisition) ENABLED START -----*/ + *attr_EnableAcquisition_read = w_val; + + /*----- PROTECTED REGION END -----*/ // DataVampire::write_EnableAcquisition } //-------------------------------------------------------- /** @@ -1025,6 +1058,62 @@ void DataVampire::write_Height(Tango::WAttribute &attr) /*----- PROTECTED REGION END -----*/ // DataVampire::write_Height } //-------------------------------------------------------- +/** + * Read attribute VerPosStd related method + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ +//-------------------------------------------------------- +void DataVampire::read_VerPosStd(Tango::Attribute &attr) +{ + DEBUG_STREAM << "DataVampire::read_VerPosStd(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_VerPosStd) ENABLED START -----*/ + // Set the attribute value + attr.set_value(attr_VerPosStd_read); + + /*----- PROTECTED REGION END -----*/ // DataVampire::read_VerPosStd +} +//-------------------------------------------------------- +/** + * Read attribute EnablePolling related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void DataVampire::read_EnablePolling(Tango::Attribute &attr) +{ + DEBUG_STREAM << "DataVampire::read_EnablePolling(Tango::Attribute &attr) entering... " << endl; + /*----- PROTECTED REGION ID(DataVampire::read_EnablePolling) ENABLED START -----*/ + // Set the attribute value + attr.set_value(attr_EnablePolling_read); + + /*----- PROTECTED REGION END -----*/ // DataVampire::read_EnablePolling +} +//-------------------------------------------------------- +/** + * Write attribute EnablePolling related method + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ +//-------------------------------------------------------- +void DataVampire::write_EnablePolling(Tango::WAttribute &attr) +{ + DEBUG_STREAM << "DataVampire::write_EnablePolling(Tango::WAttribute &attr) entering... " << endl; + // Retrieve write value + Tango::DevBoolean w_val; + attr.get_write_value(w_val); + /*----- PROTECTED REGION ID(DataVampire::write_EnablePolling) ENABLED START -----*/ + + + /*----- PROTECTED REGION END -----*/ // DataVampire::write_EnablePolling +} +//-------------------------------------------------------- /** * Read attribute RoiParam related method * Description: @@ -1300,18 +1389,18 @@ Tango::DevVarDoubleArray *DataVampire::get_ver_pos(const Tango::DevVarLongArray } //-------------------------------------------------------- /** - * Command GetHorSigma related method + * Command GetHorPosStd related method * Description: * * @param argin mode,samples; mode,bunch start,bunch end * @returns values */ //-------------------------------------------------------- -Tango::DevVarDoubleArray *DataVampire::get_hor_sigma(const Tango::DevVarLongArray *argin) +Tango::DevVarDoubleArray *DataVampire::get_hor_pos_std(const Tango::DevVarLongArray *argin) { Tango::DevVarDoubleArray *argout; - DEBUG_STREAM << "DataVampire::GetHorSigma() - " << device_name << endl; - /*----- PROTECTED REGION ID(DataVampire::get_hor_sigma) ENABLED START -----*/ + DEBUG_STREAM << "DataVampire::GetHorPosStd() - " << device_name << endl; + /*----- PROTECTED REGION ID(DataVampire::get_hor_pos_std) ENABLED START -----*/ /* clang-format on */ // Add your own code @@ -1323,26 +1412,26 @@ Tango::DevVarDoubleArray *DataVampire::get_hor_sigma(const Tango::DevVarLongArra argout->length(rec_data->num_samples); for (int i = 0; i < rec_data->num_samples; i++) - (*argout)[i] = rec_data->horsigma[i]; + (*argout)[i] = rec_data->horposstd[i]; /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::get_hor_sigma + /*----- PROTECTED REGION END -----*/ // DataVampire::get_hor_pos_std return argout; } //-------------------------------------------------------- /** - * Command GetVerSigma related method + * Command GetVerPosStd related method * Description: * * @param argin mode,samples; mode,bunch start,bunch end * @returns values */ //-------------------------------------------------------- -Tango::DevVarDoubleArray *DataVampire::get_ver_sigma(const Tango::DevVarLongArray *argin) +Tango::DevVarDoubleArray *DataVampire::get_ver_pos_std(const Tango::DevVarLongArray *argin) { Tango::DevVarDoubleArray *argout; - DEBUG_STREAM << "DataVampire::GetVerSigma() - " << device_name << endl; - /*----- PROTECTED REGION ID(DataVampire::get_ver_sigma) ENABLED START -----*/ + DEBUG_STREAM << "DataVampire::GetVerPosStd() - " << device_name << endl; + /*----- PROTECTED REGION ID(DataVampire::get_ver_pos_std) ENABLED START -----*/ /* clang-format on */ // Add your own code @@ -1354,10 +1443,10 @@ Tango::DevVarDoubleArray *DataVampire::get_ver_sigma(const Tango::DevVarLongArra argout->length(rec_data->num_samples); for (int i = 0; i < rec_data->num_samples; i++) - (*argout)[i] = rec_data->versigma[i]; + (*argout)[i] = rec_data->verposstd[i]; /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::get_ver_sigma + /*----- PROTECTED REGION END -----*/ // DataVampire::get_ver_pos_std return argout; } //-------------------------------------------------------- @@ -1946,10 +2035,10 @@ void DataVampire::free_cache_buffer(void) free(cache_buffer[i].horpos); if (cache_buffer[i].verpos) free(cache_buffer[i].verpos); - if (cache_buffer[i].horsigma) - free(cache_buffer[i].horsigma); - if (cache_buffer[i].versigma) - free(cache_buffer[i].versigma); + if (cache_buffer[i].horposstd) + free(cache_buffer[i].horposstd); + if (cache_buffer[i].verposstd) + free(cache_buffer[i].verposstd); if (cache_buffer[i].validvalues) free(cache_buffer[i].validvalues); } @@ -1980,8 +2069,8 @@ void DataVampire::allocate_cache_buffer(void) cache_buffer[i].mean = 0; cache_buffer[i].horpos = 0; cache_buffer[i].verpos = 0; - cache_buffer[i].horsigma = 0; - cache_buffer[i].versigma = 0; + cache_buffer[i].horposstd = 0; + cache_buffer[i].verposstd = 0; cache_buffer[i].validvalues = 0; clock_gettime(CLOCK_REALTIME, &cache_buffer[i].timerec); cache_buffer[i].bn_start = 0; @@ -2008,6 +2097,13 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, std::vector<double> val; std::vector<std::string> val_string; + if (*attr_EnableAcquisition_read) { + Tango::Except::throw_exception ( + (const char *)"Failed to store data", + (const char *)"Acquisition is disabled", + __FUNCTION__); + } + clock_gettime(CLOCK_REALTIME, &cache_buffer[cache_idx].timerec); cmd_extract_values(cmd_value, val, val_string); @@ -2056,10 +2152,10 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, cache_buffer[cache_idx].sum = (double *)realloc(cache_buffer[cache_idx].sum, num_samples * sizeof(double)); cache_buffer[cache_idx].mean = (double *)realloc(cache_buffer[cache_idx].mean, num_samples * sizeof(double)); cache_buffer[cache_idx].horpos = (double *)realloc(cache_buffer[cache_idx].horpos, num_samples * sizeof(double)); - cache_buffer[cache_idx].horsigma = (double *)realloc(cache_buffer[cache_idx].horsigma, num_samples * sizeof(double)); + cache_buffer[cache_idx].horposstd = (double *)realloc(cache_buffer[cache_idx].horposstd, num_samples * sizeof(double)); if (num_rows > 1) { cache_buffer[cache_idx].verpos = (double *)realloc(cache_buffer[cache_idx].verpos, num_samples * sizeof(double)); - cache_buffer[cache_idx].versigma = (double *)realloc(cache_buffer[cache_idx].versigma, num_samples * sizeof(double)); + cache_buffer[cache_idx].verposstd = (double *)realloc(cache_buffer[cache_idx].verposstd, num_samples * sizeof(double)); } cache_buffer[cache_idx].validvalues = (double *)realloc(cache_buffer[cache_idx].validvalues, num_samples * sizeof(double)); } @@ -2068,7 +2164,7 @@ void DataVampire::store_data(Tango::DeviceData *cmd_value, int32_t num_samples, for (int i = 0; i < cache_buffer[cache_idx].data_size; i++) { cache_buffer[cache_idx].databuf[i] = val[i]; - if ((val[i] >= *attr_MinThreshold_read) || (val[i] <= *attr_MaxThreshold_read)) + if ((val[i] >= *attr_MinThreshold_read) && (val[i] <= *attr_MaxThreshold_read)) cache_buffer[cache_idx].datavalid[i] = true; else cache_buffer[cache_idx].datavalid[i] = false; @@ -2324,10 +2420,20 @@ void DataVampire::process_2D(int32_t cache_idx, int32_t auto_bck_samples) cache_buffer[cache_idx].mean[i] = total_sum / (double)valid_values; cache_buffer[cache_idx].horpos[i] = hor_pos; cache_buffer[cache_idx].verpos[i] = ver_pos; - cache_buffer[cache_idx].horsigma[i] = std_hor_pos; - cache_buffer[cache_idx].versigma[i] = std_ver_pos; + cache_buffer[cache_idx].horposstd[i] = std_hor_pos; + cache_buffer[cache_idx].verposstd[i] = std_ver_pos; cache_buffer[cache_idx].validvalues[i] = valid_values; + if (i == 0) { + *attr_Mean_read = cache_buffer[cache_idx].mean[i]; + *attr_HorPos_read = cache_buffer[cache_idx].horpos[i]; + *attr_VerPos_read = cache_buffer[cache_idx].verpos[i]; + *attr_HorPosStd_read = cache_buffer[cache_idx].horposstd[i]; + *attr_VerPosStd_read = cache_buffer[cache_idx].verposstd[i]; + *attr_ValidValues_read = cache_buffer[cache_idx].validvalues[i]; + } + + } free(hor_profile_bck); @@ -2436,7 +2542,7 @@ void DataVampire::process_1D(int32_t cache_idx, int32_t auto_bck_samples) cache_buffer[cache_idx].sum[i] = sum; cache_buffer[cache_idx].mean[i] = mean; cache_buffer[cache_idx].horpos[i] = pos; - cache_buffer[cache_idx].horsigma[i] = std; + cache_buffer[cache_idx].horposstd[i] = std; cache_buffer[cache_idx].validvalues[i] = cnt; @@ -2484,6 +2590,42 @@ void DataVampire::recover_data(const Tango::DevVarLongArray *argin, struct acq_b } +// //-------------------------------------------------------- +// /** +// * Read attribute VerPosStd related method +// * Description: +// * +// * Data type: Tango::DevDouble +// * Attr type: Scalar +// */ +// //-------------------------------------------------------- +// void DataVampire::read_VerPosStd(Tango::Attribute &attr) +// { +// DEBUG_STREAM << "DataVampire::read_VerPosStd(Tango::Attribute &attr) entering... " << endl; +// /* clang-format on */ +// // Set the attribute value +// attr.set_value(attr_VerPosStd_read); +// /* clang-format off */ +// } + +// //-------------------------------------------------------- +// /** +// * Read attribute VerPosStd related method +// * Description: +// * +// * Data type: Tango::DevDouble +// * Attr type: Scalar +// */ +// //-------------------------------------------------------- +// void DataVampire::read_VerPosStd(Tango::Attribute &attr) +// { +// DEBUG_STREAM << "DataVampire::read_VerPosStd(Tango::Attribute &attr) entering... " << endl; +// /* clang-format on */ +// // Set the attribute value +// attr.set_value(attr_VerPosStd_read); +// /* clang-format off */ +// } + /*----- PROTECTED REGION END -----*/ // DataVampire::namespace_ending } // namespace diff --git a/src/DataVampire.h b/src/DataVampire.h index f9f3ac614cdc1fb73e1b4d659b093d8d3b67aede..838826dad49c19a7a9fd85fb6048cc8f6da284bb 100644 --- a/src/DataVampire.h +++ b/src/DataVampire.h @@ -42,6 +42,8 @@ #define DATAVAMPIRE_MAX_STR_LEN 256 +class acqthread; + /* clang-format off */ /*----- PROTECTED REGION END -----*/ // DataVampire.h @@ -70,33 +72,40 @@ class DataVampire : public TANGO_BASE_CLASS // Add your own data members /* clang-format off */ +public: -struct acq_buffer_t -{ - struct timespec timerec; - uint32_t bn_start, bn_end; - uint32_t num_samples; - uint32_t num_rows, num_cols; - uint32_t data_size; - double *databuf; - bool *datavalid; - double *sum; - double *mean; - double *horpos; - double *verpos; - double *horsigma; - double *versigma; - double *validvalues; -}; + friend class acqthread; + + struct acq_buffer_t + { + struct timespec timerec; + uint32_t bn_start, bn_end; + uint32_t num_samples; + uint32_t num_rows, num_cols; + uint32_t data_size; + double *databuf; + bool *datavalid; + double *sum; + double *mean; + double *horpos; + double *verpos; + double *horposstd; + double *verposstd; + double *validvalues; + }; + + Tango::DeviceProxy *device, *bn_device; + std::string device_name, command_name, bn_device_name, bn_attr_name; -Tango::DeviceProxy *device; -std::string device_name, command_name; + acq_buffer_t *cache_buffer; + uint32_t cache_idx, roi_dim; + long cmd_in_type, cmd_out_type; + int32_t num_rows_image, num_cols_image, num_cols_spectrum; -acq_buffer_t *cache_buffer; -uint32_t cache_idx, roi_dim; -long cmd_in_type, cmd_out_type; -int32_t num_rows_image, num_cols_image, num_cols_spectrum; + omni_mutex *mutex; + bool abort_flag; + acqthread *acqloop; /*----- PROTECTED REGION END -----*/ // DataVampire::Data Members @@ -111,27 +120,30 @@ public: vector<Tango::DevLong> roiParam; // CommandString: string commandString; + // BunchNumberString: + string bunchNumberString; // Attribute data members public: Tango::DevDouble *attr_MinThreshold_read; Tango::DevDouble *attr_MaxThreshold_read; Tango::DevString *attr_CommandString_read; - Tango::DevLong *attr_PollingTime_read; + Tango::DevLong *attr_PollingPeriod_read; Tango::DevLong *attr_PollingSamples_read; Tango::DevDouble *attr_Sum_read; Tango::DevDouble *attr_Mean_read; Tango::DevDouble *attr_HorPos_read; Tango::DevDouble *attr_VerPos_read; - Tango::DevDouble *attr_HorSigma_read; - Tango::DevDouble *attr_VerSigma_read; + Tango::DevDouble *attr_HorPosStd_read; Tango::DevLong *attr_ValidValues_read; - Tango::DevBoolean *attr_Enable_read; + Tango::DevBoolean *attr_EnableAcquisition_read; Tango::DevLong *attr_CacheSize_read; Tango::DevLong *attr_AutoBackgroundSamples_read; Tango::DevBoolean *attr_PostAcqRoi_read; Tango::DevLong *attr_Width_read; Tango::DevLong *attr_Height_read; + Tango::DevDouble *attr_VerPosStd_read; + Tango::DevBoolean *attr_EnablePolling_read; Tango::DevLong *attr_RoiParam_read; Tango::DevDouble *attr_Spectrum_read; Tango::DevDouble *attr_HorBackground_read; @@ -236,15 +248,15 @@ public: virtual void write_CommandString(Tango::WAttribute &attr); virtual bool is_CommandString_allowed(Tango::AttReqType type); /** - * Attribute PollingTime related methods + * Attribute PollingPeriod related methods * Description: -1: disabled * * Data type: Tango::DevLong * Attr type: Scalar */ - virtual void read_PollingTime(Tango::Attribute &attr); - virtual void write_PollingTime(Tango::WAttribute &attr); - virtual bool is_PollingTime_allowed(Tango::AttReqType type); + virtual void read_PollingPeriod(Tango::Attribute &attr); + virtual void write_PollingPeriod(Tango::WAttribute &attr); + virtual bool is_PollingPeriod_allowed(Tango::AttReqType type); /** * Attribute PollingSamples related methods * Description: -1: disabled @@ -292,23 +304,14 @@ public: virtual void read_VerPos(Tango::Attribute &attr); virtual bool is_VerPos_allowed(Tango::AttReqType type); /** - * Attribute HorSigma related methods - * Description: - * - * Data type: Tango::DevDouble - * Attr type: Scalar - */ - virtual void read_HorSigma(Tango::Attribute &attr); - virtual bool is_HorSigma_allowed(Tango::AttReqType type); -/** - * Attribute VerSigma related methods + * Attribute HorPosStd related methods * Description: * * Data type: Tango::DevDouble * Attr type: Scalar */ - virtual void read_VerSigma(Tango::Attribute &attr); - virtual bool is_VerSigma_allowed(Tango::AttReqType type); + virtual void read_HorPosStd(Tango::Attribute &attr); + virtual bool is_HorPosStd_allowed(Tango::AttReqType type); /** * Attribute ValidValues related methods * Description: @@ -319,15 +322,15 @@ public: virtual void read_ValidValues(Tango::Attribute &attr); virtual bool is_ValidValues_allowed(Tango::AttReqType type); /** - * Attribute Enable related methods + * Attribute EnableAcquisition related methods * Description: * * Data type: Tango::DevBoolean * Attr type: Scalar */ - virtual void read_Enable(Tango::Attribute &attr); - virtual void write_Enable(Tango::WAttribute &attr); - virtual bool is_Enable_allowed(Tango::AttReqType type); + virtual void read_EnableAcquisition(Tango::Attribute &attr); + virtual void write_EnableAcquisition(Tango::WAttribute &attr); + virtual bool is_EnableAcquisition_allowed(Tango::AttReqType type); /** * Attribute CacheSize related methods * Description: @@ -378,6 +381,25 @@ public: virtual void read_Height(Tango::Attribute &attr); virtual void write_Height(Tango::WAttribute &attr); virtual bool is_Height_allowed(Tango::AttReqType type); +/** + * Attribute VerPosStd related methods + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ + virtual void read_VerPosStd(Tango::Attribute &attr); + virtual bool is_VerPosStd_allowed(Tango::AttReqType type); +/** + * Attribute EnablePolling related methods + * Description: + * + * Data type: Tango::DevBoolean + * Attr type: Scalar + */ + virtual void read_EnablePolling(Tango::Attribute &attr); + virtual void write_EnablePolling(Tango::WAttribute &attr); + virtual bool is_EnablePolling_allowed(Tango::AttReqType type); /** * Attribute RoiParam related methods * Description: @@ -476,23 +498,23 @@ public: virtual Tango::DevVarDoubleArray *get_ver_pos(const Tango::DevVarLongArray *argin); virtual bool is_GetVerPos_allowed(const CORBA::Any &any); /** - * Command GetHorSigma related method + * Command GetHorPosStd related method * Description: * * @param argin mode,samples; mode,bunch start,bunch end * @returns values */ - virtual Tango::DevVarDoubleArray *get_hor_sigma(const Tango::DevVarLongArray *argin); - virtual bool is_GetHorSigma_allowed(const CORBA::Any &any); + virtual Tango::DevVarDoubleArray *get_hor_pos_std(const Tango::DevVarLongArray *argin); + virtual bool is_GetHorPosStd_allowed(const CORBA::Any &any); /** - * Command GetVerSigma related method + * Command GetVerPosStd related method * Description: * * @param argin mode,samples; mode,bunch start,bunch end * @returns values */ - virtual Tango::DevVarDoubleArray *get_ver_sigma(const Tango::DevVarLongArray *argin); - virtual bool is_GetVerSigma_allowed(const CORBA::Any &any); + virtual Tango::DevVarDoubleArray *get_ver_pos_std(const Tango::DevVarLongArray *argin); + virtual bool is_GetVerPosStd_allowed(const CORBA::Any &any); /** * Command GetValidValues related method * Description: diff --git a/src/DataVampire.xmi b/src/DataVampire.xmi index d93154291f18c5b45d0c47382186814c1231ceea..88be59f965dfb49e752274baf322894a165e2bd5 100644 --- a/src/DataVampire.xmi +++ b/src/DataVampire.xmi @@ -23,6 +23,10 @@ <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> + <deviceProperties name="BunchNumberString" description=""> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </deviceProperties> <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> @@ -81,7 +85,7 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <excludedStates>FAULT</excludedStates> </commands> - <commands name="GetHorSigma" description="" execMethod="get_hor_sigma" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <commands name="GetHorPosStd" description="" execMethod="get_hor_pos_std" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> <argin description="mode,samples; mode,bunch start,bunch end"> <type xsi:type="pogoDsl:IntArrayType"/> </argin> @@ -91,7 +95,7 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <excludedStates>FAULT</excludedStates> </commands> - <commands name="GetVerSigma" description="" execMethod="get_ver_sigma" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> + <commands name="GetVerPosStd" description="" execMethod="get_ver_pos_std" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> <argin description="mode,samples; mode,bunch start,bunch end"> <type xsi:type="pogoDsl:IntArrayType"/> </argin> @@ -145,7 +149,7 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> - <attributes name="PollingTime" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> + <attributes name="PollingPeriod" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:IntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> @@ -159,7 +163,7 @@ <archiveEvent fire="false" libCheckCriteria="false"/> <dataReadyEvent fire="false" libCheckCriteria="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - <properties description="-1: disabled" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="1000000" minValue="-1000000" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <properties description="-1: disabled" label="" unit="" standardUnit="" displayUnit="" format="%d" maxValue="1000000" minValue="-1000000" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> <attributes name="Sum" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:DoubleType"/> @@ -197,16 +201,7 @@ <properties description="" label="" unit="" standardUnit="" displayUnit="" format="%.5f" maxValue="9999999999" minValue="-9999999999" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> <readExcludedStates>FAULT</readExcludedStates> </attributes> - <attributes name="HorSigma" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> - <dataType xsi:type="pogoDsl:DoubleType"/> - <changeEvent fire="false" libCheckCriteria="false"/> - <archiveEvent fire="false" libCheckCriteria="false"/> - <dataReadyEvent fire="false" libCheckCriteria="true"/> - <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - <properties description="" label="" unit="" standardUnit="" displayUnit="" format="%.5f" maxValue="9999999999" minValue="-9999999999" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> - <readExcludedStates>FAULT</readExcludedStates> - </attributes> - <attributes name="VerSigma" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <attributes name="HorPosStd" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:DoubleType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> @@ -224,7 +219,7 @@ <properties description="" label="" unit="" standardUnit="" displayUnit="" format="%d" maxValue="99999999" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> <readExcludedStates>FAULT</readExcludedStates> </attributes> - <attributes name="Enable" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> + <attributes name="EnableAcquisition" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:BooleanType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> @@ -272,6 +267,23 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="%d" maxValue="9999" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> </attributes> + <attributes name="VerPosStd" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:DoubleType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <properties description="" label="" unit="" standardUnit="" displayUnit="" format="%.5f" maxValue="9999999999" minValue="-9999999999" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + <readExcludedStates>FAULT</readExcludedStates> + </attributes> + <attributes name="EnablePolling" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false"> + <dataType xsi:type="pogoDsl:BooleanType"/> + <changeEvent fire="false" libCheckCriteria="false"/> + <archiveEvent fire="false" libCheckCriteria="false"/> + <dataReadyEvent fire="false" libCheckCriteria="true"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> + </attributes> <attributes name="RoiParam" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="4" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:IntType"/> <changeEvent fire="false" libCheckCriteria="false"/> diff --git a/src/DataVampireClass.cpp b/src/DataVampireClass.cpp index a3cdf68bc2abfb043e4f0db2221f25cb728ea5f9..070669a7f813c360ff909d56b6065d3c9490d393 100644 --- a/src/DataVampireClass.cpp +++ b/src/DataVampireClass.cpp @@ -229,7 +229,7 @@ CORBA::Any *GetVerPosClass::execute(Tango::DeviceImpl *device, const CORBA::Any //-------------------------------------------------------- /** - * method : GetHorSigmaClass::execute() + * method : GetHorPosStdClass::execute() * description : method to trigger the execution of the command. * * @param device The device on which the command must be executed @@ -238,17 +238,17 @@ CORBA::Any *GetVerPosClass::execute(Tango::DeviceImpl *device, const CORBA::Any * returns The command output data (packed in the Any object) */ //-------------------------------------------------------- -CORBA::Any *GetHorSigmaClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) +CORBA::Any *GetHorPosStdClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) { - cout2 << "GetHorSigmaClass::execute(): arrived" << endl; + cout2 << "GetHorPosStdClass::execute(): arrived" << endl; const Tango::DevVarLongArray *argin; extract(in_any, argin); - return insert((static_cast<DataVampire *>(device))->get_hor_sigma(argin)); + return insert((static_cast<DataVampire *>(device))->get_hor_pos_std(argin)); } //-------------------------------------------------------- /** - * method : GetVerSigmaClass::execute() + * method : GetVerPosStdClass::execute() * description : method to trigger the execution of the command. * * @param device The device on which the command must be executed @@ -257,12 +257,12 @@ CORBA::Any *GetHorSigmaClass::execute(Tango::DeviceImpl *device, const CORBA::An * returns The command output data (packed in the Any object) */ //-------------------------------------------------------- -CORBA::Any *GetVerSigmaClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) +CORBA::Any *GetVerPosStdClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) { - cout2 << "GetVerSigmaClass::execute(): arrived" << endl; + cout2 << "GetVerPosStdClass::execute(): arrived" << endl; const Tango::DevVarLongArray *argin; extract(in_any, argin); - return insert((static_cast<DataVampire *>(device))->get_ver_sigma(argin)); + return insert((static_cast<DataVampire *>(device))->get_ver_pos_std(argin)); } //-------------------------------------------------------- @@ -425,6 +425,19 @@ void DataVampireClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); + prop_name = "BunchNumberString"; + prop_desc = ""; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); } //-------------------------------------------------------- @@ -606,30 +619,30 @@ void DataVampireClass::attribute_factory(vector<Tango::Attr *> &att_list) commandstring->set_memorized_init(true); att_list.push_back(commandstring); - // Attribute : PollingTime - PollingTimeAttrib *pollingtime = new PollingTimeAttrib(); - Tango::UserDefaultAttrProp pollingtime_prop; - pollingtime_prop.set_description("-1: disabled"); - // label not set for PollingTime - pollingtime_prop.set_unit("ms"); - // standard_unit not set for PollingTime - pollingtime_prop.set_display_unit("ms"); - pollingtime_prop.set_format("%d"); - pollingtime_prop.set_max_value("100000"); - pollingtime_prop.set_min_value("-1"); - // max_alarm not set for PollingTime - // min_alarm not set for PollingTime - // max_warning not set for PollingTime - // min_warning not set for PollingTime - // delta_t not set for PollingTime - // delta_val not set for PollingTime + // Attribute : PollingPeriod + PollingPeriodAttrib *pollingperiod = new PollingPeriodAttrib(); + Tango::UserDefaultAttrProp pollingperiod_prop; + pollingperiod_prop.set_description("-1: disabled"); + // label not set for PollingPeriod + pollingperiod_prop.set_unit("ms"); + // standard_unit not set for PollingPeriod + pollingperiod_prop.set_display_unit("ms"); + pollingperiod_prop.set_format("%d"); + pollingperiod_prop.set_max_value("100000"); + pollingperiod_prop.set_min_value("-1"); + // max_alarm not set for PollingPeriod + // min_alarm not set for PollingPeriod + // max_warning not set for PollingPeriod + // min_warning not set for PollingPeriod + // delta_t not set for PollingPeriod + // delta_val not set for PollingPeriod - pollingtime->set_default_properties(pollingtime_prop); + pollingperiod->set_default_properties(pollingperiod_prop); // Not Polled - pollingtime->set_disp_level(Tango::OPERATOR); - pollingtime->set_memorized(); - pollingtime->set_memorized_init(true); - att_list.push_back(pollingtime); + pollingperiod->set_disp_level(Tango::OPERATOR); + pollingperiod->set_memorized(); + pollingperiod->set_memorized_init(true); + att_list.push_back(pollingperiod); // Attribute : PollingSamples PollingSamplesAttrib *pollingsamples = new PollingSamplesAttrib(); @@ -639,7 +652,7 @@ void DataVampireClass::attribute_factory(vector<Tango::Attr *> &att_list) // unit not set for PollingSamples // standard_unit not set for PollingSamples // display_unit not set for PollingSamples - // format not set for PollingSamples + pollingsamples_prop.set_format("%d"); pollingsamples_prop.set_max_value("1000000"); pollingsamples_prop.set_min_value("-1000000"); // max_alarm not set for PollingSamples @@ -752,53 +765,29 @@ void DataVampireClass::attribute_factory(vector<Tango::Attr *> &att_list) // Not Memorized att_list.push_back(verpos); - // Attribute : HorSigma - HorSigmaAttrib *horsigma = new HorSigmaAttrib(); - Tango::UserDefaultAttrProp horsigma_prop; - // description not set for HorSigma - // label not set for HorSigma - // unit not set for HorSigma - // standard_unit not set for HorSigma - // display_unit not set for HorSigma - horsigma_prop.set_format("%.5f"); - horsigma_prop.set_max_value("9999999999"); - horsigma_prop.set_min_value("-9999999999"); - // max_alarm not set for HorSigma - // min_alarm not set for HorSigma - // max_warning not set for HorSigma - // min_warning not set for HorSigma - // delta_t not set for HorSigma - // delta_val not set for HorSigma + // Attribute : HorPosStd + HorPosStdAttrib *horposstd = new HorPosStdAttrib(); + Tango::UserDefaultAttrProp horposstd_prop; + // description not set for HorPosStd + // label not set for HorPosStd + // unit not set for HorPosStd + // standard_unit not set for HorPosStd + // display_unit not set for HorPosStd + horposstd_prop.set_format("%.5f"); + horposstd_prop.set_max_value("9999999999"); + horposstd_prop.set_min_value("-9999999999"); + // max_alarm not set for HorPosStd + // min_alarm not set for HorPosStd + // max_warning not set for HorPosStd + // min_warning not set for HorPosStd + // delta_t not set for HorPosStd + // delta_val not set for HorPosStd - horsigma->set_default_properties(horsigma_prop); + horposstd->set_default_properties(horposstd_prop); // Not Polled - horsigma->set_disp_level(Tango::OPERATOR); + horposstd->set_disp_level(Tango::OPERATOR); // Not Memorized - att_list.push_back(horsigma); - - // Attribute : VerSigma - VerSigmaAttrib *versigma = new VerSigmaAttrib(); - Tango::UserDefaultAttrProp versigma_prop; - // description not set for VerSigma - // label not set for VerSigma - // unit not set for VerSigma - // standard_unit not set for VerSigma - // display_unit not set for VerSigma - versigma_prop.set_format("%.5f"); - versigma_prop.set_max_value("9999999999"); - versigma_prop.set_min_value("-9999999999"); - // max_alarm not set for VerSigma - // min_alarm not set for VerSigma - // max_warning not set for VerSigma - // min_warning not set for VerSigma - // delta_t not set for VerSigma - // delta_val not set for VerSigma - - versigma->set_default_properties(versigma_prop); - // Not Polled - versigma->set_disp_level(Tango::OPERATOR); - // Not Memorized - att_list.push_back(versigma); + att_list.push_back(horposstd); // Attribute : ValidValues ValidValuesAttrib *validvalues = new ValidValuesAttrib(); @@ -824,30 +813,30 @@ void DataVampireClass::attribute_factory(vector<Tango::Attr *> &att_list) // Not Memorized att_list.push_back(validvalues); - // Attribute : Enable - EnableAttrib *enable = new EnableAttrib(); - Tango::UserDefaultAttrProp enable_prop; - // description not set for Enable - // label not set for Enable - // unit not set for Enable - // standard_unit not set for Enable - // display_unit not set for Enable - // format not set for Enable - // max_value not set for Enable - // min_value not set for Enable - // max_alarm not set for Enable - // min_alarm not set for Enable - // max_warning not set for Enable - // min_warning not set for Enable - // delta_t not set for Enable - // delta_val not set for Enable + // Attribute : EnableAcquisition + EnableAcquisitionAttrib *enableacquisition = new EnableAcquisitionAttrib(); + Tango::UserDefaultAttrProp enableacquisition_prop; + // description not set for EnableAcquisition + // label not set for EnableAcquisition + // unit not set for EnableAcquisition + // standard_unit not set for EnableAcquisition + // display_unit not set for EnableAcquisition + // format not set for EnableAcquisition + // max_value not set for EnableAcquisition + // min_value not set for EnableAcquisition + // max_alarm not set for EnableAcquisition + // min_alarm not set for EnableAcquisition + // max_warning not set for EnableAcquisition + // min_warning not set for EnableAcquisition + // delta_t not set for EnableAcquisition + // delta_val not set for EnableAcquisition - enable->set_default_properties(enable_prop); + enableacquisition->set_default_properties(enableacquisition_prop); // Not Polled - enable->set_disp_level(Tango::OPERATOR); - enable->set_memorized(); - enable->set_memorized_init(true); - att_list.push_back(enable); + enableacquisition->set_disp_level(Tango::OPERATOR); + enableacquisition->set_memorized(); + enableacquisition->set_memorized_init(true); + att_list.push_back(enableacquisition); // Attribute : CacheSize CacheSizeAttrib *cachesize = new CacheSizeAttrib(); @@ -974,6 +963,55 @@ void DataVampireClass::attribute_factory(vector<Tango::Attr *> &att_list) height->set_memorized_init(true); att_list.push_back(height); + // Attribute : VerPosStd + VerPosStdAttrib *verposstd = new VerPosStdAttrib(); + Tango::UserDefaultAttrProp verposstd_prop; + // description not set for VerPosStd + // label not set for VerPosStd + // unit not set for VerPosStd + // standard_unit not set for VerPosStd + // display_unit not set for VerPosStd + verposstd_prop.set_format("%.5f"); + verposstd_prop.set_max_value("9999999999"); + verposstd_prop.set_min_value("-9999999999"); + // max_alarm not set for VerPosStd + // min_alarm not set for VerPosStd + // max_warning not set for VerPosStd + // min_warning not set for VerPosStd + // delta_t not set for VerPosStd + // delta_val not set for VerPosStd + + verposstd->set_default_properties(verposstd_prop); + // Not Polled + verposstd->set_disp_level(Tango::OPERATOR); + // Not Memorized + att_list.push_back(verposstd); + + // Attribute : EnablePolling + EnablePollingAttrib *enablepolling = new EnablePollingAttrib(); + Tango::UserDefaultAttrProp enablepolling_prop; + // description not set for EnablePolling + // label not set for EnablePolling + // unit not set for EnablePolling + // standard_unit not set for EnablePolling + // display_unit not set for EnablePolling + // format not set for EnablePolling + // max_value not set for EnablePolling + // min_value not set for EnablePolling + // max_alarm not set for EnablePolling + // min_alarm not set for EnablePolling + // max_warning not set for EnablePolling + // min_warning not set for EnablePolling + // delta_t not set for EnablePolling + // delta_val not set for EnablePolling + + enablepolling->set_default_properties(enablepolling_prop); + // Not Polled + enablepolling->set_disp_level(Tango::OPERATOR); + enablepolling->set_memorized(); + enablepolling->set_memorized_init(true); + att_list.push_back(enablepolling); + // Attribute : RoiParam RoiParamAttrib *roiparam = new RoiParamAttrib(); Tango::UserDefaultAttrProp roiparam_prop; @@ -1175,23 +1213,23 @@ void DataVampireClass::command_factory() Tango::OPERATOR); command_list.push_back(pGetVerPosCmd); - // Command GetHorSigma - GetHorSigmaClass *pGetHorSigmaCmd = - new GetHorSigmaClass("GetHorSigma", + // Command GetHorPosStd + GetHorPosStdClass *pGetHorPosStdCmd = + new GetHorPosStdClass("GetHorPosStd", Tango::DEVVAR_LONGARRAY, Tango::DEVVAR_DOUBLEARRAY, "mode,samples; mode,bunch start,bunch end", "values", Tango::OPERATOR); - command_list.push_back(pGetHorSigmaCmd); + command_list.push_back(pGetHorPosStdCmd); - // Command GetVerSigma - GetVerSigmaClass *pGetVerSigmaCmd = - new GetVerSigmaClass("GetVerSigma", + // Command GetVerPosStd + GetVerPosStdClass *pGetVerPosStdCmd = + new GetVerPosStdClass("GetVerPosStd", Tango::DEVVAR_LONGARRAY, Tango::DEVVAR_DOUBLEARRAY, "mode,samples; mode,bunch start,bunch end", "values", Tango::OPERATOR); - command_list.push_back(pGetVerSigmaCmd); + command_list.push_back(pGetVerPosStdCmd); // Command GetValidValues GetValidValuesClass *pGetValidValuesCmd = diff --git a/src/DataVampireClass.h b/src/DataVampireClass.h index 02f93e7a477d2e7fa67d695f835f8ed412f929ef..b203327e5a38c84a73d1f7ddab295ee276c696cb 100644 --- a/src/DataVampireClass.h +++ b/src/DataVampireClass.h @@ -101,19 +101,19 @@ public: {return (static_cast<DataVampire *>(dev))->is_CommandString_allowed(ty);} }; -// Attribute PollingTime class definition -class PollingTimeAttrib: public Tango::Attr +// Attribute PollingPeriod class definition +class PollingPeriodAttrib: public Tango::Attr { public: - PollingTimeAttrib():Attr("PollingTime", + PollingPeriodAttrib():Attr("PollingPeriod", Tango::DEV_LONG, Tango::READ_WRITE) {}; - ~PollingTimeAttrib() {}; + ~PollingPeriodAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<DataVampire *>(dev))->read_PollingTime(att);} + {(static_cast<DataVampire *>(dev))->read_PollingPeriod(att);} virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<DataVampire *>(dev))->write_PollingTime(att);} + {(static_cast<DataVampire *>(dev))->write_PollingPeriod(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<DataVampire *>(dev))->is_PollingTime_allowed(ty);} + {return (static_cast<DataVampire *>(dev))->is_PollingPeriod_allowed(ty);} }; // Attribute PollingSamples class definition @@ -183,30 +183,17 @@ public: {return (static_cast<DataVampire *>(dev))->is_VerPos_allowed(ty);} }; -// Attribute HorSigma class definition -class HorSigmaAttrib: public Tango::Attr +// Attribute HorPosStd class definition +class HorPosStdAttrib: public Tango::Attr { public: - HorSigmaAttrib():Attr("HorSigma", + HorPosStdAttrib():Attr("HorPosStd", Tango::DEV_DOUBLE, Tango::READ) {}; - ~HorSigmaAttrib() {}; + ~HorPosStdAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<DataVampire *>(dev))->read_HorSigma(att);} + {(static_cast<DataVampire *>(dev))->read_HorPosStd(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<DataVampire *>(dev))->is_HorSigma_allowed(ty);} -}; - -// Attribute VerSigma class definition -class VerSigmaAttrib: public Tango::Attr -{ -public: - VerSigmaAttrib():Attr("VerSigma", - Tango::DEV_DOUBLE, Tango::READ) {}; - ~VerSigmaAttrib() {}; - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<DataVampire *>(dev))->read_VerSigma(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<DataVampire *>(dev))->is_VerSigma_allowed(ty);} + {return (static_cast<DataVampire *>(dev))->is_HorPosStd_allowed(ty);} }; // Attribute ValidValues class definition @@ -222,19 +209,19 @@ public: {return (static_cast<DataVampire *>(dev))->is_ValidValues_allowed(ty);} }; -// Attribute Enable class definition -class EnableAttrib: public Tango::Attr +// Attribute EnableAcquisition class definition +class EnableAcquisitionAttrib: public Tango::Attr { public: - EnableAttrib():Attr("Enable", + EnableAcquisitionAttrib():Attr("EnableAcquisition", Tango::DEV_BOOLEAN, Tango::READ_WRITE) {}; - ~EnableAttrib() {}; + ~EnableAcquisitionAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<DataVampire *>(dev))->read_Enable(att);} + {(static_cast<DataVampire *>(dev))->read_EnableAcquisition(att);} virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<DataVampire *>(dev))->write_Enable(att);} + {(static_cast<DataVampire *>(dev))->write_EnableAcquisition(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<DataVampire *>(dev))->is_Enable_allowed(ty);} + {return (static_cast<DataVampire *>(dev))->is_EnableAcquisition_allowed(ty);} }; // Attribute CacheSize class definition @@ -312,6 +299,34 @@ public: {return (static_cast<DataVampire *>(dev))->is_Height_allowed(ty);} }; +// Attribute VerPosStd class definition +class VerPosStdAttrib: public Tango::Attr +{ +public: + VerPosStdAttrib():Attr("VerPosStd", + Tango::DEV_DOUBLE, Tango::READ) {}; + ~VerPosStdAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<DataVampire *>(dev))->read_VerPosStd(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<DataVampire *>(dev))->is_VerPosStd_allowed(ty);} +}; + +// Attribute EnablePolling class definition +class EnablePollingAttrib: public Tango::Attr +{ +public: + EnablePollingAttrib():Attr("EnablePolling", + Tango::DEV_BOOLEAN, Tango::READ_WRITE) {}; + ~EnablePollingAttrib() {}; + virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) + {(static_cast<DataVampire *>(dev))->read_EnablePolling(att);} + virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) + {(static_cast<DataVampire *>(dev))->write_EnablePolling(att);} + virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) + {return (static_cast<DataVampire *>(dev))->is_EnablePolling_allowed(ty);} +}; + // Attribute RoiParam class definition class RoiParamAttrib: public Tango::SpectrumAttr { @@ -475,11 +490,11 @@ public: {return (static_cast<DataVampire *>(dev))->is_GetVerPos_allowed(any);} }; -// Command GetHorSigma class definition -class GetHorSigmaClass : public Tango::Command +// Command GetHorPosStd class definition +class GetHorPosStdClass : public Tango::Command { public: - GetHorSigmaClass(const char *name, + GetHorPosStdClass(const char *name, Tango::CmdArgType in, Tango::CmdArgType out, const char *in_desc, @@ -487,22 +502,22 @@ public: Tango::DispLevel level) :Command(name,in,out,in_desc,out_desc, level) {}; - GetHorSigmaClass(const char *name, + GetHorPosStdClass(const char *name, Tango::CmdArgType in, Tango::CmdArgType out) :Command(name,in,out) {}; - ~GetHorSigmaClass() {}; + ~GetHorPosStdClass() {}; virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) - {return (static_cast<DataVampire *>(dev))->is_GetHorSigma_allowed(any);} + {return (static_cast<DataVampire *>(dev))->is_GetHorPosStd_allowed(any);} }; -// Command GetVerSigma class definition -class GetVerSigmaClass : public Tango::Command +// Command GetVerPosStd class definition +class GetVerPosStdClass : public Tango::Command { public: - GetVerSigmaClass(const char *name, + GetVerPosStdClass(const char *name, Tango::CmdArgType in, Tango::CmdArgType out, const char *in_desc, @@ -510,15 +525,15 @@ public: Tango::DispLevel level) :Command(name,in,out,in_desc,out_desc, level) {}; - GetVerSigmaClass(const char *name, + GetVerPosStdClass(const char *name, Tango::CmdArgType in, Tango::CmdArgType out) :Command(name,in,out) {}; - ~GetVerSigmaClass() {}; + ~GetVerPosStdClass() {}; virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) - {return (static_cast<DataVampire *>(dev))->is_GetVerSigma_allowed(any);} + {return (static_cast<DataVampire *>(dev))->is_GetVerPosStd_allowed(any);} }; // Command GetValidValues class definition diff --git a/src/DataVampireStateMachine.cpp b/src/DataVampireStateMachine.cpp index bd7295448930b4af40818f9cb98e068d240e2483..37bcec4bfc6e559549560bfc37f34ab769f26ba9 100644 --- a/src/DataVampireStateMachine.cpp +++ b/src/DataVampireStateMachine.cpp @@ -116,23 +116,21 @@ bool DataVampire::is_CommandString_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : DataVampire::is_PollingTime_allowed() - * Description : Execution allowed for PollingTime attribute + * Method : DataVampire::is_PollingPeriod_allowed() + * Description : Execution allowed for PollingPeriod attribute */ //-------------------------------------------------------- -bool DataVampire::is_PollingTime_allowed(TANGO_UNUSED(Tango::AttReqType type)) +bool DataVampire::is_PollingPeriod_allowed(TANGO_UNUSED(Tango::AttReqType type)) { - // Not any excluded states for PollingTime attribute in Write access. - /*----- PROTECTED REGION ID(DataVampire::PollingTimeStateAllowed_WRITE) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::PollingTimeStateAllowed_WRITE + // Not any excluded states for PollingPeriod attribute in Write access. + /*----- PROTECTED REGION ID(DataVampire::PollingPeriodStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::PollingPeriodStateAllowed_WRITE - // Not any excluded states for PollingTime attribute in read access. - /*----- PROTECTED REGION ID(DataVampire::PollingTimeStateAllowed_READ) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::PollingTimeStateAllowed_READ + // Not any excluded states for PollingPeriod attribute in read access. + /*----- PROTECTED REGION ID(DataVampire::PollingPeriodStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::PollingPeriodStateAllowed_READ return true; } @@ -264,37 +262,11 @@ bool DataVampire::is_VerPos_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : DataVampire::is_HorSigma_allowed() - * Description : Execution allowed for HorSigma attribute - */ -//-------------------------------------------------------- -bool DataVampire::is_HorSigma_allowed(TANGO_UNUSED(Tango::AttReqType type)) -{ - - // Check access type. - if ( type==Tango::READ_REQ ) - { - // Compare device state with not allowed states for READ - if (get_state()==Tango::FAULT) - { - /*----- PROTECTED REGION ID(DataVampire::HorSigmaStateAllowed_READ) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::HorSigmaStateAllowed_READ - return false; - } - return true; - } - return true; -} - -//-------------------------------------------------------- -/** - * Method : DataVampire::is_VerSigma_allowed() - * Description : Execution allowed for VerSigma attribute + * Method : DataVampire::is_HorPosStd_allowed() + * Description : Execution allowed for HorPosStd attribute */ //-------------------------------------------------------- -bool DataVampire::is_VerSigma_allowed(TANGO_UNUSED(Tango::AttReqType type)) +bool DataVampire::is_HorPosStd_allowed(TANGO_UNUSED(Tango::AttReqType type)) { // Check access type. @@ -303,10 +275,9 @@ bool DataVampire::is_VerSigma_allowed(TANGO_UNUSED(Tango::AttReqType type)) // Compare device state with not allowed states for READ if (get_state()==Tango::FAULT) { - /*----- PROTECTED REGION ID(DataVampire::VerSigmaStateAllowed_READ) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::VerSigmaStateAllowed_READ + /*----- PROTECTED REGION ID(DataVampire::HorPosStdStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::HorPosStdStateAllowed_READ return false; } return true; @@ -342,23 +313,21 @@ bool DataVampire::is_ValidValues_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : DataVampire::is_Enable_allowed() - * Description : Execution allowed for Enable attribute + * Method : DataVampire::is_EnableAcquisition_allowed() + * Description : Execution allowed for EnableAcquisition attribute */ //-------------------------------------------------------- -bool DataVampire::is_Enable_allowed(TANGO_UNUSED(Tango::AttReqType type)) +bool DataVampire::is_EnableAcquisition_allowed(TANGO_UNUSED(Tango::AttReqType type)) { - // Not any excluded states for Enable attribute in Write access. - /*----- PROTECTED REGION ID(DataVampire::EnableStateAllowed_WRITE) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::EnableStateAllowed_WRITE + // Not any excluded states for EnableAcquisition attribute in Write access. + /*----- PROTECTED REGION ID(DataVampire::EnableAcquisitionStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::EnableAcquisitionStateAllowed_WRITE - // Not any excluded states for Enable attribute in read access. - /*----- PROTECTED REGION ID(DataVampire::EnableStateAllowed_READ) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::EnableStateAllowed_READ + // Not any excluded states for EnableAcquisition attribute in read access. + /*----- PROTECTED REGION ID(DataVampire::EnableAcquisitionStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::EnableAcquisitionStateAllowed_READ return true; } @@ -468,6 +437,51 @@ bool DataVampire::is_Height_allowed(TANGO_UNUSED(Tango::AttReqType type)) return true; } +//-------------------------------------------------------- +/** + * Method : DataVampire::is_VerPosStd_allowed() + * Description : Execution allowed for VerPosStd attribute + */ +//-------------------------------------------------------- +bool DataVampire::is_VerPosStd_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + + // Check access type. + if ( type==Tango::READ_REQ ) + { + // Compare device state with not allowed states for READ + if (get_state()==Tango::FAULT) + { + /*----- PROTECTED REGION ID(DataVampire::VerPosStdStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::VerPosStdStateAllowed_READ + return false; + } + return true; + } + return true; +} + +//-------------------------------------------------------- +/** + * Method : DataVampire::is_EnablePolling_allowed() + * Description : Execution allowed for EnablePolling attribute + */ +//-------------------------------------------------------- +bool DataVampire::is_EnablePolling_allowed(TANGO_UNUSED(Tango::AttReqType type)) +{ + // Not any excluded states for EnablePolling attribute in Write access. + /*----- PROTECTED REGION ID(DataVampire::EnablePollingStateAllowed_WRITE) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::EnablePollingStateAllowed_WRITE + + // Not any excluded states for EnablePolling attribute in read access. + /*----- PROTECTED REGION ID(DataVampire::EnablePollingStateAllowed_READ) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::EnablePollingStateAllowed_READ + return true; +} + //-------------------------------------------------------- /** * Method : DataVampire::is_RoiParam_allowed() @@ -645,19 +659,18 @@ bool DataVampire::is_GetVerPos_allowed(TANGO_UNUSED(const CORBA::Any &any)) //-------------------------------------------------------- /** - * Method : DataVampire::is_GetHorSigma_allowed() - * Description : Execution allowed for GetHorSigma attribute + * Method : DataVampire::is_GetHorPosStd_allowed() + * Description : Execution allowed for GetHorPosStd attribute */ //-------------------------------------------------------- -bool DataVampire::is_GetHorSigma_allowed(TANGO_UNUSED(const CORBA::Any &any)) +bool DataVampire::is_GetHorPosStd_allowed(TANGO_UNUSED(const CORBA::Any &any)) { // Compare device state with not allowed states. if (get_state()==Tango::FAULT) { - /*----- PROTECTED REGION ID(DataVampire::GetHorSigmaStateAllowed) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::GetHorSigmaStateAllowed + /*----- PROTECTED REGION ID(DataVampire::GetHorPosStdStateAllowed) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::GetHorPosStdStateAllowed return false; } return true; @@ -665,19 +678,18 @@ bool DataVampire::is_GetHorSigma_allowed(TANGO_UNUSED(const CORBA::Any &any)) //-------------------------------------------------------- /** - * Method : DataVampire::is_GetVerSigma_allowed() - * Description : Execution allowed for GetVerSigma attribute + * Method : DataVampire::is_GetVerPosStd_allowed() + * Description : Execution allowed for GetVerPosStd attribute */ //-------------------------------------------------------- -bool DataVampire::is_GetVerSigma_allowed(TANGO_UNUSED(const CORBA::Any &any)) +bool DataVampire::is_GetVerPosStd_allowed(TANGO_UNUSED(const CORBA::Any &any)) { // Compare device state with not allowed states. if (get_state()==Tango::FAULT) { - /*----- PROTECTED REGION ID(DataVampire::GetVerSigmaStateAllowed) ENABLED START -----*/ - /* clang-format on */ - /* clang-format off */ - /*----- PROTECTED REGION END -----*/ // DataVampire::GetVerSigmaStateAllowed + /*----- PROTECTED REGION ID(DataVampire::GetVerPosStdStateAllowed) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // DataVampire::GetVerPosStdStateAllowed return false; } return true; diff --git a/src/acqthread.cpp b/src/acqthread.cpp new file mode 100644 index 0000000000000000000000000000000000000000..186e56ae21b38982e47a49eea95c5825e0650ef4 --- /dev/null +++ b/src/acqthread.cpp @@ -0,0 +1,29 @@ +/* + * acqthread.cpp + * + * 17.08.04 - GG: first release + */ + + +#include "acqthread.h" + +/* + * acqthread::run() + * Run + */ +void *acqthread::run_undetached(void *) +{ + + + while (myobj->abort_flag == false) { + + sleep(1); + + + } + + myobj->abort_flag = false; + +} /* end acqthread::run() */ + + diff --git a/src/acqthread.h b/src/acqthread.h new file mode 100644 index 0000000000000000000000000000000000000000..3ce21a538767888d38e5ca9c25b3a0f8cbdc5eaf --- /dev/null +++ b/src/acqthread.h @@ -0,0 +1,41 @@ +/* + * acqthread.h + * + * 17.08.04 - GG: first release + */ + +#ifndef ACQTHREAD_H +#define ACQTHREAD_H + +#include <omnithread.h> +#include <tango.h> +#include <DataVampire.h> + + +class acqthread : public omni_thread, public Tango::LogAdapter +{ + private: + DataVampire_ns::DataVampire *myobj; + + public: + /* acqthread::acqthread(): initialize search loop */ + acqthread(DataVampire_ns::DataVampire *s):Tango::LogAdapter(s) { myobj = s;}; + + /* acqthread::~acqthread(): object destructor */ + ~acqthread(){}; + + void start_undetached(void) { + omni_thread::start_undetached(); + }; + + protected: + /* acqthread::run(): start setting loop */ + void *run_undetached(void *); + +}; /* end class acqthread() */ + + +#endif + +/* EOF */ +