Cpp Client

Cpp example for setting the properties of new MCA8715 device to default values.

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

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

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

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

  // Write value to attributes

  DeviceAttribute *da_write1 = new DeviceAttribute( "BankId", (long)0);
  device->write_attribute(*da_write1);

  DeviceAttribute *da_write2 = new DeviceAttribute( "DataLength", (long)1000);
  device->write_attribute(*da_write2);

  // Write default values to properties
 
  unsigned long base = 28672;
  unsigned long channel = 0;
  unsigned long base2 = 13631488;
  long maxdatalength = 8192;

  DbDatum base_toput("Base"), channel_toput("Channel");
  DbDatum base2_toput("Base2"), maxdatalength_toput("MaxDataLength");
  DbData db_data;
  base_toput << base;
  channel_toput << channel;
  base2_toput << base2;
  maxdatalength_toput << maxdatalength;
  db_data.push_back(base_toput);
  db_data.push_back(channel_toput);
  db_data.push_back(base2_toput);
  db_data.push_back(maxdatalength_toput);

  device->put_property(db_data);

}