Client examples

Cpp example for setting the properties of new IK220 Device to default values.

/* 
 * File for setting the properties of a new IK220 device to
 * default values.
 *
 */
#include <tango.h>
using namespace Tango;


main(unsigned int argc, char **argv)
{

 
  //  
  // create a connection to the new IK220 TANGO device
  //

  DeviceProxy *device = new DeviceProxy( "tango://has107k:10000/exp/line1/enc1");

  // Write default values to properties
 
  unsigned long channel = 0;
  unsigned long mode = 0; // 0 voltage, 1 current

  DbDatum channel_toput("Channel"), mode_toput("Mode");
  DbData db_data;
  channel_toput << channel;
  mode_toput << mode;
  db_data.push_back(channel_toput);
  db_data.push_back(mode_toput);
 
  device->put_property(db_data);

  // Write value to attributes

  DeviceAttribute *da_write1 = new DeviceAttribute( "Offset", (double)0);
  device->write_attribute(*da_write1);

  DeviceAttribute *da_write2 = new DeviceAttribute( "Conversion", (double)1);
  device->write_attribute(*da_write2);

  DeviceAttribute *da_write3 = new DeviceAttribute( "FlagIgnoreStatus", (long)1); // If set to 1 the encoder is used without reference mark search.
  device->write_attribute(*da_write3);
 

}