You can write your own applications using the ControlDeck framework. You don't even need a setup file! Here is an example that you might put in a main() loop:
cd_control_system* csys = new cd_control_system("MySystem"); CD2module* cdm = new CD2module("test module"); csys->add_control_module(cdm); cd_control_deck* cdeck = new cd_control_deck(); cdeck->add_control_system(csys); cdeck->initialize(); cdeck->start();
If you want to do more complex operations, cd_control_deck::run_step() and cd_control_deck::delay_step() can be used to control the execution.
The following sample module reads a number into a Control Deck system, and reads it back to confirm the software is working.
#include <iostream> #import "CD2module.h" using namespace std; CD2module::CD2module(const char* mod_name) : cd_control_module(mod_name) { a = 1.234; b = 9.999; a1 = 0.000; b1 = 0.000; cout << "Constructing CD2module" << endl; } void CD2module::initialize_data() { a_ref = create_data(NULL, "a_path", sd_type_double, "m", "fake data in meters", &a); } void CD2module::initialize_data_requests() { a1_ref = request_data(NULL, "a_path", sd_type_double); } void CD2module::show_variables() { double t1(0.00); double t2(0.00); double t3(0.00); double t4(0.00); bool x1 = value_as_type(a_ref, sd_type_double, &t1); bool x2 = value_as_type(a1_ref, sd_type_double, &t2); cout << "did retrieving a_ref succeed? " << x1 << endl; cout << "a: " << a << " and from CD: " << t1 << endl; cout << "\n" << endl; cout << "did retrieving a1_ref succeed? " << x2<< endl; cout << "a: " << a << " and from CD: " << t2 << endl; }