Skip to content
Snippets Groups Projects
Commit 957ce694 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

code cleaning: move the one-time initialisation stuff out of eq_create into eq_init_prolog

parent 858c24ad
No related branches found
No related tags found
No related merge requests found
......@@ -88,9 +88,11 @@ public:
/** Override the Doocs auto_init() method, which is called after initialising the value of
* the property from the config file. */
void auto_init (void) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
D_spectrum::auto_init();
// send the current value to the device
if (_processArray->isWriteable()){
std::cout << "write... " << _processArray->getName() << std::endl;
sendToDevice();
}
}
......
......@@ -88,9 +88,11 @@ public:
/** Override the Doocs auto_init() method, which is called after initialising the value of
* the property from the config file. */
void auto_init (void) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
DOOCS_T::auto_init();
// send the current value to the device
if (_processScalar->isWriteable()){
std::cout << "write... " << _processScalar->getName() << std::endl;
_processScalar->accessData(0) = DOOCS_T::value();
_processScalar->write();
}
......
// all the bloat we have to implement for DOOCS although we don't need it
void eq_init_prolog() {}
void eq_init_epilog() {}
void refresh_prolog() {}
void refresh_epilog() {}
void interrupt_usr1_prolog(int) {}
void interrupt_usr2_prolog(void) {}
void interrupt_usr2_prolog() {}
void interrupt_usr1_epilog(int) {}
void interrupt_usr2_epilog(void) {}
void post_init_prolog(void) {}
void post_init_epilog(void) {}
void eq_cancel(void) {}
void interrupt_usr2_epilog() {}
void post_init_prolog() {}
void eq_cancel() {}
......@@ -4,23 +4,26 @@
char const *object_name;
EqFct* eq_create (int eq_code, void *) {
static ChimeraTK::DoocsAdapter doocsAdapter;
static ChimeraTK::DoocsAdapter doocsAdapter;
static bool isInitialised = false;
if(!isInitialised) {
// set the DOOCS server name to the application name
object_name = ChimeraTK::ApplicationBase::getInstance().getName().c_str();
// Create static instances for all applications cores. They must not have overlapping
// process variable names ("location/protery" must be unique).
ChimeraTK::ApplicationBase::getInstance().setPVManager(doocsAdapter.getDevicePVManager());
ChimeraTK::ApplicationBase::getInstance().initialise();
isInitialised = true;
}
/* eq_init_prolog is called before the locations are created, i.e. before the first call to eq_create.
* We initialise the application, i.e. all process variables are created in this function. */
void eq_init_prolog() {
// set the DOOCS server name to the application name
object_name = ChimeraTK::ApplicationBase::getInstance().getName().c_str();
// Create static instances for all applications cores. They must not have overlapping
// process variable names ("location/protery" must be unique).
ChimeraTK::ApplicationBase::getInstance().setPVManager(doocsAdapter.getDevicePVManager());
ChimeraTK::ApplicationBase::getInstance().initialise();
}
return new ChimeraTK::CSAdapterEqFct(eq_code, doocsAdapter.getControlSystemPVManager());
/* eq_create returns a ControlSystemAdapter-based location for any location type */
EqFct* eq_create (int eq_code, void *) {
return new ChimeraTK::CSAdapterEqFct(eq_code, doocsAdapter.getControlSystemPVManager());
}
void eq_init_epilog() {
/* post_init_epilog is called after all DOOCS properties are fully intialised, including any value intialisation from
* the config file. We start the application here. It will be launched in a separate thread. */
void post_init_epilog() {
ChimeraTK::ApplicationBase::getInstance().run();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment