Here is a piece of code that executes a command on the TangoTest server. The corresponding makefile can be found below.
// // This piece of code executed the command DevDouble on the TangoTest server. // The supplied value is 'reflected' by the server. // // #include <iostream> #include <tango.h> using namespace std; using namespace Tango; int main(int argc, char **argv) { DeviceData devData_in; DeviceData devData_out; Tango::DevDouble d_in = 1.234; Tango::DevDouble d_out; char command[80]; strcpy( command, "DevDouble"); DeviceProxy *tangotest = new DeviceProxy( "sys/tg_test/1"); devData_in << d_in; try { devData_out = tangotest->command_inout( (const char *) command, devData_in); } catch ( Tango::DevFailed &e) { cout << " name: " << tangotest->dev_name() << endl; cout << " reason: " << e.errors[0].reason.in() << endl; cout << " desc: " << e.errors[0].desc.in() << endl; cout << " origin: " << e.errors[0].origin.in() << endl; } devData_out >> d_out; cout << " got " << d_out << endl; delete tangotest; return 1; }
The makefile:
SRC_DIR=/usr/local/experiment/Spectra/src TANGO_LIB = -L/usr/lib/x86_64-linux-gnu -ltango -llog4tango -lomniORB4 -lomniDynamic4 -lomnithread SIS3100_LIB=-L/usr/lib -l_sis3100 PYTHON_LIB=-L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 GPIB_LIB=-L/usr/lib -lgpib TINE_LIB=-L/usr/lib -ltinemt -ltbufsrv PERL_LIB=-Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -lperl -ldl -lm -lpthread -lc -lcrypt LIB_DIR=/usr/local/experiment/Spectra/lib LIBS=$(SRC_DIR)/cmc_dummy.o \ $(SRC_DIR)/can_dummy.o \ -L$(LIB_DIR) -lgra -ltng_ifc -ladslib \ $(PERL_LIB) \ $(SIS3100_LIB) $(PYTHON_LIB) $(GPIB_LIB) $(TINE_LIB) \ -lnsl -ldl -lm -lc -lpthread -lstdc++ \ $(TANGO_LIB) -ljsoncpp \ -L/usr/X11R6/lib -lX11 all: inoutTest inoutTest.o: inoutTest.cpp g++ -c -Wall -std=c++0x -I/usr/include/tango -o inoutTest.o inoutTest.cpp inoutTest: inoutTest.o g++ inoutTest.o $(LIBS) -o inoutTest