Skip to content
Snippets Groups Projects
Commit 2f11649d authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

First import

parent db51ebe7
No related branches found
Tags 1.0.1
No related merge requests found
.nse_depinfo
bin
obj
# Eclipse
.cproject
.project
.settings
NAME_SRV = adio-srv
CXXFLAGS =
LDFLAGS =
include ../makefiles/Make-8.1.2.c.in
This diff is collapsed.
//=============================================================================
//
// file : Adio.h
//
// description : Include for the Adio class.
//
// project : Adio
//
// $Author: graziano $
//
// $Revision: 1.2 $
//
// $Log: Adio.h,v $
// Revision 1.2 2013-10-29 11:27:03 graziano
// Tango 8, Device_4Impl
//
// Revision 1.1 2008/06/24 10:24:38 graziano
// first commit
//
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#ifndef _ADIO_H
#define _ADIO_H
#include <tango.h>
//using namespace Tango;
/**
* @author $Author: graziano $
* @version $Revision: 1.2 $
*/
// Add your own constants definitions here.
//-----------------------------------------------
namespace Adio_ns
{
/**
* Class Description:
* This is the device server of the ADIO INCAA Digital Adc/Dac board
*/
/*
* Device States Description:
* Tango::ON : The server is ON when the driver is opened and there are non errors from system
* calls.
* Tango::FAULT : The status is set to FAULT when there is an error from a system call.
* Tango::DISABLE : The status is set to DISABLE if there is an error opening the device.
* In this case all command are not allowed.
*/
class Adio: public Tango::Device_4Impl
{
public :
// Add your own data members here
//-----------------------------------------
// Here is the Start of the automatic code generation part
//-------------------------------------------------------------
/**
* @name attributes
* Attributs member data.
*/
//@{
//@}
/**
* @name Device properties
* Device properties member data.
*/
//@{
/**
* Adio devicename Ex. /dev/adio0
*/
string adioname;
/**
* This is the the P2 Vme backplane pinout of the ADIO board.
* Channel 0-7:digital In/Out
* Channel 8-11:digital In
* Channel 12: DAC
* Channel 13: ADC
*/
vector<string> ioconnector;
/**
* Config input output channels bitmask: 0=output 1=input
*/
string iomask;
//@}
/**@name Constructors
* Miscellaneous constructors */
//@{
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
Adio(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
Adio(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
Adio(Tango::DeviceClass *cl,const char *s,const char *d);
//@}
/**@name Destructor
* Only one desctructor is defined for this class */
//@{
/**
* The object desctructor.
*/
~Adio() {delete_device();};
/**
* will be called at device destruction or at init command.
*/
void delete_device();
//@}
/**@name Miscellaneous methods */
//@{
/**
* Initialize the device
*/
virtual void init_device();
/**
* Always executed method befor execution command method.
*/
virtual void always_executed_hook();
//@}
/**
* @name Adio methods prototypes
*/
//@{
/**
* Execution allowed for EnabIrqMask command.
*/
virtual bool is_EnabIrqMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for DisabIrqMask command.
*/
virtual bool is_DisabIrqMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetDebounce command.
*/
virtual bool is_SetDebounce_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDebounce command.
*/
virtual bool is_GetDebounce_allowed(const CORBA::Any &any);
/**
* Execution allowed for ConfigIOMask command.
*/
virtual bool is_ConfigIOMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDigInMask command.
*/
virtual bool is_GetDigInMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for DigIn command.
*/
virtual bool is_DigIn_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetDigOutMask command.
*/
virtual bool is_SetDigOutMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDigOutMask command.
*/
virtual bool is_GetDigOutMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for DigOut command.
*/
virtual bool is_DigOut_allowed(const CORBA::Any &any);
/**
* Execution allowed for DigOn command.
*/
virtual bool is_DigOn_allowed(const CORBA::Any &any);
/**
* Execution allowed for DigOff command.
*/
virtual bool is_DigOff_allowed(const CORBA::Any &any);
/**
* Execution allowed for DigPulse command.
*/
virtual bool is_DigPulse_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDacCtrl command.
*/
virtual bool is_GetDacCtrl_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetDcDac command.
*/
virtual bool is_SetDcDac_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDcDac command.
*/
virtual bool is_GetDcDac_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetAcDac command.
*/
virtual bool is_SetAcDac_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetAcDac command.
*/
virtual bool is_GetAcDac_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetAdc command.
*/
virtual bool is_GetAdc_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetAdcVolt command.
*/
virtual bool is_GetAdcVolt_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetDacLowTh command.
*/
virtual bool is_SetDacLowTh_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDacLowTh command.
*/
virtual bool is_GetDacLowTh_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetDacHighTh command.
*/
virtual bool is_SetDacHighTh_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetDacHighTh command.
*/
virtual bool is_GetDacHighTh_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetSetPnt command.
*/
virtual bool is_GetSetPnt_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetPinConnector command.
*/
virtual bool is_GetPinConnector_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetAcDacVolt command.
*/
virtual bool is_GetAcDacVolt_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetConfigIOMask command.
*/
virtual bool is_GetConfigIOMask_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetAcDacVolt command.
*/
virtual bool is_SetAcDacVolt_allowed(const CORBA::Any &any);
/**
* Execution allowed for SetDcDacVolt command.
*/
virtual bool is_SetDcDacVolt_allowed(const CORBA::Any &any);
/**
* Execution allowed for RegisterChannels command.
*/
virtual bool is_RegisterChannels_allowed(const CORBA::Any &any);
/**
* Execution allowed for UnregisterChannels command.
*/
virtual bool is_UnregisterChannels_allowed(const CORBA::Any &any);
/**
* Execution allowed for GetChannelsConfig command.
*/
virtual bool is_GetChannelsConfig_allowed(const CORBA::Any &any);
/**
* Set enabling irq configuration mask.
* bit 0-7: 0->1 interrupt generation
* bit 8-15: 1->0 interrupt generation
* @param argin
* @exception DevFailed
*/
void enab_irq_mask(Tango::DevUShort);
/**
* Set disabling irq configuration mask.
* bit 0-7: 0->1 interrupt generation
* bit 8-15: 1->0 interrupt generation
* @param argin
* @exception DevFailed
*/
void disab_irq_mask(Tango::DevUShort);
/**
* Set debounce factor.
* Allowed values are 0,1,2,3.
* @param argin debounce factor
* @exception DevFailed
*/
void set_debounce(Tango::DevShort);
/**
* Get debounce factor.
* @return
* @exception DevFailed
*/
Tango::DevShort get_debounce();
/**
* Config input output channels: 0=output 1=input
* @param argin iomask
* @exception DevFailed
*/
void config_iomask(Tango::DevUShort);
/**
* Get digital input mask
* @return mask
* @exception DevFailed
*/
Tango::DevUShort get_dig_in_mask();
/**
* Get a digital input level.
* @param argin array of channels
* @return array of levels
* @exception DevFailed
*/
Tango::DevVarShortArray *dig_in(const Tango::DevVarShortArray *);
/**
* Set digital output mask
* @param argin
* @exception DevFailed
*/
void set_dig_out_mask(Tango::DevUShort);
/**
* Get digital output setting mask
* @return
* @exception DevFailed
*/
Tango::DevUShort get_dig_out_mask();
/**
* Get a digital output setting level.
* @param argin channel
* @return level
* @exception DevFailed
*/
Tango::DevVarShortArray *dig_out(const Tango::DevVarShortArray *);
/**
* Set channel level to 1.
* @param argin array of channel
* @exception DevFailed
*/
void dig_on(const Tango::DevVarShortArray *);
/**
* Set digital output channel to 0.
* @param argin array of channels
* @exception DevFailed
*/
void dig_off(const Tango::DevVarShortArray *);
/**
* Generate a pulse of 100ms. on a digital channel.
* @param argin array of channels
* @exception DevFailed
*/
void dig_pulse(const Tango::DevVarShortArray *);
/**
* Get DAC control register.
* @return
* @exception DevFailed
*/
Tango::DevShort get_dac_ctrl();
/**
* Set DC DAC component.
* @param argin dc value
* @exception DevFailed
*/
void set_dc_dac(Tango::DevShort);
/**
* Get DC DAC component
* @return
* @exception DevFailed
*/
Tango::DevShort get_dc_dac();
/**
* Set AC DAC component.
* @param argin
* @exception DevFailed
*/
void set_ac_dac(Tango::DevShort);
/**
* Get AC DAC component.
* @return
* @exception DevFailed
*/
Tango::DevShort get_ac_dac();
/**
* Get ADC value.
* @return
* @exception DevFailed
*/
Tango::DevShort get_adc();
/**
* Get ADC value in Volt
* @return
* @exception DevFailed
*/
Tango::DevDouble get_adc_volt();
/**
* Set ADC low threshold.
* Default value is 0x8000.
* @param argin
* @exception DevFailed
*/
void set_dac_low_th(Tango::DevShort);
/**
* Get DAC low threshold.
* @return
* @exception DevFailed
*/
Tango::DevShort get_dac_low_th();
/**
* Set DAC high threshold.
* Default value is 0x7fff.
* @param argin
* @exception DevFailed
*/
void set_dac_high_th(Tango::DevShort);
/**
* Get DAC high threshold.
* @return
* @exception DevFailed
*/
Tango::DevShort get_dac_high_th();
/**
* Get output setpoint.
* @return
* @exception DevFailed
*/
Tango::DevShort get_set_pnt();
/**
* This command returns the P2 VME pinout of the ADIO.
* Channel 0-7:digital In/Out
* Channel 8-11:digital In
* Channel 12: DAC
* Channel 13: ADC
* @param argin channel
* @return pinout
* @exception DevFailed
*/
Tango::DevString get_pin_connector(Tango::DevShort);
/**
* Get DAC AC component in volt
* @return
* @exception DevFailed
*/
Tango::DevDouble get_ac_dac_volt();
/**
* Get IO configuration mask.
* 1=input, 0=output
* @return
* @exception DevFailed
*/
Tango::DevUShort get_config_iomask();
/**
* Set AC DAC component in Volt
* @param argin
* @exception DevFailed
*/
void set_ac_dac_volt(Tango::DevDouble);
/**
* Set DC DAC component in Volt.
* @param argin
* @exception DevFailed
*/
void set_dc_dac_volt(Tango::DevDouble);
/**
* Set channel listed as used
* @param argin list of channel to set as used
* @exception DevFailed
*/
void register_channels(const Tango::DevVarUShortArray *);
/**
* Set channel listed as not used
* @param argin list of channel to set as not used
* @exception DevFailed
*/
void unregister_channels(const Tango::DevVarUShortArray *);
/**
* Return the configuration of each channel: if it is set as input or output, and if it is actually used or not used.
* @return config (in/out, used/not_used) of every digital channel
* @exception DevFailed
*/
Tango::DevVarStringArray *get_channels_config();
/**
* Read the device properties from database
*/
void get_device_property();
//@}
// Here is the end of the automatic code generation part
//-------------------------------------------------------------
protected :
// Add your own data members here
//-----------------------------------------
int fd;
Tango::DevShort *DigIn,*DigOut;
Tango::DevVarShortArray chanConfig;
};
} // namespace_ns
#endif // _ADIO_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/adio/src/ClassFactory.cpp,v 1.2 2013-10-29 11:27:03 graziano Exp $";
//+=============================================================================
//
// file : ClassFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible to create
// all class singletin for a device server. It is called
// at device server startup
//
// project : TANGO Device Server
//
// $Author: graziano $ Giulio Gaio
//
// $Revision: 1.2 $ 1.0
//
// $Log: ClassFactory.cpp,v $
// Revision 1.2 2013-10-29 11:27:03 graziano
// Tango 8, Device_4Impl
//
// Revision 1.1 2008/06/24 10:24:38 graziano
// first commit
//
//
// copyleft : Sincrotrone Trieste S.C.p.A.
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34012 Basovizza, Trieste ITALY
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <tango.h>
#include <AdioClass.h>
/**
* Create AdiosClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(Adio_ns::AdioClass::init("Adio"));
}
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/adio/src/main.cpp,v 1.2 2013-10-29 11:27:03 graziano Exp $";
//+=============================================================================
//
// file : main.cpp
//
// description : C++ source for a TANGO device server main.
// The main rule is to initialise (and create) the Tango
// system and to create the DServerClass singleton.
// The main should be the same for every Tango device server.
//
// project : TANGO Device Server
//
// $Author: graziano $ Giulio Gaio
//
// $Revision: 1.2 $ 1.0
//
// $Log: main.cpp,v $
// Revision 1.2 2013-10-29 11:27:03 graziano
// Tango 8, Device_4Impl
//
// Revision 1.1 2009/10/23 12:21:01 graziano
// first commit
//
// Revision 1.1 2008/06/24 10:24:38 graziano
// first commit
//
//
// copyleft : Sincrotrone Trieste S.C.p.A.
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34012 Basovizza, Trieste ITALY
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <tango.h>
int main(int argc,char *argv[])
{
Tango::Util *tg;
try
{
// Initialise the device server
//----------------------------------------
tg = Tango::Util::init(argc,argv);
// Create the device server singleton
// which will create everything
//----------------------------------------
tg->server_init(false);
// Run the endless loop
//----------------------------------------
cout << "Ready to accept request" << endl;
tg->server_run();
}
catch (bad_alloc)
{
cout << "Can't allocate memory to store device object !!!" << endl;
cout << "Exiting" << endl;
}
catch (CORBA::Exception &e)
{
Tango::Except::print_exception(e);
cout << "Received a CORBA_Exception" << endl;
cout << "Exiting" << endl;
}
tg->server_cleanup();
return(0);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment