class DeviceImpl : public POA_Tango Device, public PortableServer RefCountServantBase

Base class for all TANGO device

Inheritance:


Public

Constructors
DeviceImpl(DeviceClass *device_class, string &dev_name)
Constructs a newly allocated DeviceImpl object from its name
DeviceImpl(DeviceClass *device_class, string &dev_name, string &desc)
Constructs a newly allocated DeviceImpl object from its name and its description
DeviceImpl(DeviceClass *device_class, string &dev_name, string &desc, Tango::DevState dev_state, string &dev_status)
Constructs a newly allocated DeviceImpl object from all its creation parameters
DeviceImpl(DeviceClass *device_class, const char *dev_name, const char *desc = "A TANGO device", Tango::DevState dev_state = Tango::UNKNOWN, const char *dev_status = "Not Initialised")
Constructs a newly allocated DeviceImpl object from all its creation parameters with some default values
Destructor
virtual ~DeviceImpl()
The device desctructor
Get/Set object members.
string& get_status()
Get device status
void set_status(const string &new_status)
Set device status
Tango::DevState& get_state()
Get device state
void set_state(const Tango::DevState &new_state)
Set device state
string& get_name()
Get device name
DeviceClass* get_device_class()
Get device class singleton
MultiAttribute* get_device_attr()
Get device multi attribute object
void set_device_attr(MultiAttribute *ptr)
Set device multi attribute object
DbDevice* get_db_device()
Get a pointer to the associated DbDevice object
void set_d_var(Tango::Device_ptr d)
Set the associated CORBA object reference
Tango::Device_var get_d_var()
Get the associated CORBA object reference
void set_obj_id(PortableServer::ObjectId_var o)
Set the associated CORBA object identifier
PortableServer::ObjectId_var& get_obj_id()
Get the associated CORBA object identifier
virtual PortableServer::POA_ptr _default_POA()
Return device POA
CORBA attribute methods
virtual char* name() throw(CORBA::SystemException)
Get device name
virtual char* adm_name() throw(CORBA::SystemException)
Get administrator device name
virtual char* description() throw(CORBA::SystemException)
Get device description
virtual char* status() throw(CORBA::SystemException)
Get device status
virtual Tango::DevState state() throw(CORBA::SystemException)
Get device state
CORBA operation methods
virtual CORBA::Any* command_inout(const char *in_cmd, const CORBA::Any &in_data) throw(Tango::DevFailed, CORBA::SystemException)
Execute a command
virtual Tango::DevVarStringArray* black_box(CORBA::Long n) throw(Tango::DevFailed, CORBA::SystemException)
Get device black box
virtual Tango::DevCmdInfoList* command_list_query() throw(Tango::DevFailed, CORBA::SystemException)
Get device command list
virtual Tango::DevCmdInfo* command_query(const char *command) throw(Tango::DevFailed, CORBA::SystemException)
Get command info
virtual Tango::DevInfo* info() throw(Tango::DevFailed, CORBA::SystemException)
Get device info
virtual void ping() throw(Tango::DevFailed, CORBA::SystemException)
Ping the device to check if it is still alive
virtual Tango::AttributeConfigList* get_attribute_config(const Tango::DevVarStringArray& names) throw(Tango::DevFailed, CORBA::SystemException)
Get attribute(s) configuration
virtual void set_attribute_config(const Tango::AttributeConfigList& new_conf) throw(Tango::DevFailed, CORBA::SystemException)
Set attribute(s) configuration
virtual Tango::AttributeValueList* read_attributes(const Tango::DevVarStringArray& names) throw(Tango::DevFailed, CORBA::SystemException)
Read attribute(s) value
virtual void write_attributes(const Tango::AttributeValueList& values) throw(Tango::DevFailed, CORBA::SystemException)
Write attribute(s) value
Methods to build Tango array types.
inline Tango::DevVarCharArray* create_DevVarCharArray(unsigned char *ptr, long length)
Create a DevVarCharArray type
inline Tango::DevVarShortArray* create_DevVarShortArray(short *ptr, long length)
Create a DevVarShortArray type
inline Tango::DevVarLongArray* create_DevVarLongArray(long *ptr, long length)
Create a DevVarLongArray type
inline Tango::DevVarFloatArray* create_DevVarFloatArray(float *ptr, long length)
Create a DevVarFloatArray type
inline Tango::DevVarDoubleArray* create_DevVarDoubleArray(double *ptr, long length)
Create a DevVarDoubleArray type
inline Tango::DevVarUShortArray* create_DevVarUShortArray(unsigned short *ptr, long length)
Create a DevVarUShortArray type
inline Tango::DevVarULongArray* create_DevVarULongArray(unsigned long *ptr, long length)
Create a DevVarULongArray type
inline Tango::DevVarStringArray* create_DevVarStringArray(char **ptr, long length)
Create a DevVarStringArray type
Miscellaneous methods
virtual void init_device()
Intialise a device
virtual void always_executed_hook(void)
Hook method
virtual void read_attr_hardware(vector &attr_list)
Read the hardware to return attribute value(s)
virtual void read_attr(Attribute &attr)
Set the attribute read value
virtual void write_attr_hardware(vector &attr_list)
Write the hardware for attributes
virtual Tango::DevState dev_state()
Get device state
virtual Tango::ConstDevString dev_status()
Get device status
Signal related methods
void register_signal(long signo, bool own_handler = false)
Register a signal to be executed in a signal handler
void register_signal(long signo)
Register a signal
void unregister_signal(long signo)
Unregister a signal
virtual void signal_handler(long signo)
Signal handler

Protected

Class data members
BlackBox* blackbox_ptr
The device black box pointer
long blackbox_depth
The device black box depth
string device_name
The device name
string desc
The device description
string device_status
The device status
Tango::DevState device_state
The device state
Tango::DevSecurity access
The device access
long version
The device version
DeviceClass* device_class
Pointer to the device-class object associated with the device
MultiAttribute* dev_attr
Pointer to the multi attribute object
DbDevice* db_dev
Pointer to the associated DbDevice object
string adm_device_name
The administration device name

Documentation

Base class for all TANGO device. This class inherits from CORBA classes where all the network layer is implemented.
Constructors
Miscellaneous constructors

DeviceImpl(DeviceClass *device_class, string &dev_name)
Constructs a newly allocated DeviceImpl object from its name. The device description field is set to A Tango device. The device state is set to unknown and the device status is set to Not Initialised
Parameters:
device_class - Pointer to the device class object
dev_name - The device name

DeviceImpl(DeviceClass *device_class, string &dev_name, string &desc)
Constructs a newly allocated DeviceImpl object from its name and its description. The device state is set to unknown and the device status is set to Not Initialised
Parameters:
device_class - Pointer to the device class object
dev_name - The device name
desc - The device description

DeviceImpl(DeviceClass *device_class, string &dev_name, string &desc, Tango::DevState dev_state, string &dev_status)
Constructs a newly allocated DeviceImpl object from all its creation parameters. The device is constructed from its name, its description, an original state and status
Parameters:
device_class - Pointer to the device class object
dev_name - The device name
desc - The device description
dev_state - The device initial state
dev_status - The device initial status

DeviceImpl(DeviceClass *device_class, const char *dev_name, const char *desc = "A TANGO device", Tango::DevState dev_state = Tango::UNKNOWN, const char *dev_status = "Not Initialised")
Constructs a newly allocated DeviceImpl object from all its creation parameters with some default values. The device is constructed from its name, its description, an original state and status. This constructor defined default values for the description, state and status parameters. The default device description is A TANGO device. The default device state is UNKNOWN and the default device status is Not initialised.
Parameters:
device_class - Pointer to the device class object
dev_name - The device name
desc - The device desc
dev_state - The device initial state
dev_status - The device initial status

Destructor
Only one desctructor is defined for this class

virtual ~DeviceImpl()
The device desctructor

Get/Set object members.
These methods allows the external world to get/set DeviceImpl instance data members

string& get_status()
Get device status. Return the device dev_status field. This method does the same thing than the default status_cmd method.
Returns:
Device status

void set_status(const string &new_status)
Set device status.
Parameters:
new_status - The new device status

Tango::DevState& get_state()
Get device state. Return the device dev_state field. This method does the same thing than the default state_cmd method.
Returns:
Device state

void set_state(const Tango::DevState &new_state)
Set device state.
Parameters:
new_state - The new device state

string& get_name()
Get device name. Return the device name (dev_name field)
Returns:
Device name

DeviceClass* get_device_class()
Get device class singleton. Return the device class singleton (device_class field)
Returns:
Pointer to the device class singleton

MultiAttribute* get_device_attr()
Get device multi attribute object. Return a pointer to the device multi attribute object
Returns:
Pointer to the device multi attribute object

void set_device_attr(MultiAttribute *ptr)
Set device multi attribute object. Set the pointer to the device multi attribute object
Returns:
Pointer to the device multi attribute object

DbDevice* get_db_device()
Get a pointer to the associated DbDevice object. Return a pointer to DbDevice object associated with the device
Returns:
Pointer to the DbDevice object

void set_d_var(Tango::Device_ptr d)
Set the associated CORBA object reference. Set the associated CORBA object reference. Tango supports only a one to one servant-CORBA object link.
Parameters:
d - The CORBA object reference

Tango::Device_var get_d_var()
Get the associated CORBA object reference. Get the associated CORBA object reference. Tango supports only a one to one servant-CORBA object link.
Returns:
The CORBA object reference

void set_obj_id(PortableServer::ObjectId_var o)
Set the associated CORBA object identifier. Set the associated CORBA object identifier.
Parameters:
o - The CORBA object identifier

PortableServer::ObjectId_var& get_obj_id()
Get the associated CORBA object identifier. Return the CORBA object identifier as a _var type variable
Returns:
The CORBA object identifier

virtual PortableServer::POA_ptr _default_POA()
Return device POA. Return a pointer to the device POA. This method is necessary for the CORBA object implicit activation by the _this() method.
Returns:
Pointer to the device POA

CORBA attribute methods
Method defined to implement TANGO device CORBA attribute

virtual char* name() throw(CORBA::SystemException)
Get device name. It's the master method executed when the device name is requested via a CORBA attribute. It updates the device black-box and return the device name
Returns:
The device name

virtual char* adm_name() throw(CORBA::SystemException)
Get administrator device name. It's the master method executed when the administrator device name is requested via a CORBA attribute. It updates the device black-box and return the administrator device name
Returns:
The device name

virtual char* description() throw(CORBA::SystemException)
Get device description. It's the master method executed when the device description is requested via a CORBA attribute. It updates the device black-box and return the device description field
Returns:
The device description

virtual char* status() throw(CORBA::SystemException)
Get device status. It's the master method executed when the device status is requested via a CORBA attribute. It updates the device black-box and return the device state. This method calls the status_cmd device method but catch all the execption and does not re-throw them because exception can't be thrown to a client for CORBA attribute
Returns:
The device status

virtual Tango::DevState state() throw(CORBA::SystemException)
Get device state. It's the master method executed when the device state is requested via a CORBA attribute. It updates the device black-box and return the device state. This method calls the state_cmd device method but catch all the execption and does not re-throw them because exception can't be thrown to a client for CORBA attribute
Returns:
The device state

CORBA operation methods
Method defined to implement TANGO device CORBA operation

virtual CORBA::Any* command_inout(const char *in_cmd, const CORBA::Any &in_data) throw(Tango::DevFailed, CORBA::SystemException)
Execute a command. It's the master method executed when a "command_inout" CORBA operation is requested by a client. It updates the device black-box, call the TANGO command handler and returned the output Any
Throws:
DevFailed Re-throw of the exception thrown by the command_handler method. Click here to read DevFailed exception specification
Returns:
The command output data packed in a CORBA Any object
Parameters:
in_cmd - The command name
in_any - The command input data packed in a CORBA Any

virtual Tango::DevVarStringArray* black_box(CORBA::Long n) throw(Tango::DevFailed, CORBA::SystemException)
Get device black box. It's the master method executed when the device black box is requested. It reads the device black box, update it and return black-box data to the client
Throws:
DevFailed If it is not possible to read the device black box. Click here to read DevFailed exception specification
Returns:
The device black box with one String for each action requested on the device
Parameters:
n - The number of actions description which must be returned to the client. The number of returned element is limited to the number of elements stored in the black-box or to the complete black-box depth if it is full.

virtual Tango::DevCmdInfoList* command_list_query() throw(Tango::DevFailed, CORBA::SystemException)
Get device command list. Invoked when the client request the command_list_query CORBA operation. It updates the device black box and returns an array of DevCmdInfo object with one object for each command.
Returns:
The device command list. One DevCmdInfo is initialised for each device command

virtual Tango::DevCmdInfo* command_query(const char *command) throw(Tango::DevFailed, CORBA::SystemException)
Get command info. Invoked when the client request the command_query CORBA operation. It updates the device black box and returns a DevCmdInfo object for the command with name passed to the method as parameter.
Throws:
DevFailed Thrown if the command does not exist. Click here to read DevFailed exception specification
Returns:
A DevCmdInfo initialised for the wanted command
Parameters:
command - The command name

virtual Tango::DevInfo* info() throw(Tango::DevFailed, CORBA::SystemException)
Get device info. Invoked when the client request the info CORBA operation. It updates the black box and returns a DevInfo object with miscellaneous device info
Returns:
A DevInfo object

virtual void ping() throw(Tango::DevFailed, CORBA::SystemException)
Ping the device to check if it is still alive. Invoked when the client request the ping CORBA operation. It updates the device black box and simply returns

virtual Tango::AttributeConfigList* get_attribute_config(const Tango::DevVarStringArray& names) throw(Tango::DevFailed, CORBA::SystemException)
Get attribute(s) configuration. Invoked when the client request the get_attribute_config CORBA operation. It returns to the client one AttributeConfig structure for each wanted attribute. All the attribute properties value are returned in this AttributeConfig structure.
Throws:
DevFailed Thrown if the command does not exist. Click here to read DevFailed exception specification
Returns:
A sequence of AttributeConfig structure. One structure is initialised for each wanted attribute. Click here to read AttributeConfig structure specification.
Parameters:
names - The attribute(s) name list

virtual void set_attribute_config(const Tango::AttributeConfigList& new_conf) throw(Tango::DevFailed, CORBA::SystemException)
Set attribute(s) configuration. Invoked when the client request the set_attribute_config CORBA operation. It updates the device attribute configuration actually used by the device but this method also updates the Tango database. One structure of the AttributeConfig type is needed for each attribute to update configuration. Click here to read AttributeConfig structure specification.
Throws:
DevFailed Thrown if the command does not exist. Click here to read DevFailed exception specification
Parameters:
new_conf - The attribute(s) new configuration structure sequence

virtual Tango::AttributeValueList* read_attributes(const Tango::DevVarStringArray& names) throw(Tango::DevFailed, CORBA::SystemException)
Read attribute(s) value. Invoked when the client request the read_attributes CORBA operation. It returns to the client one AttributeConfig structure for each wanted attribute.
Throws:
DevFailed Thrown if the command does not exist. Click here to read DevFailed exception specification
Returns:
A sequence of AttributeValue structure. One structure is initialised for each wanted attribute with the attribute value, the date and the attribute value quality. Click here to read AttributeValue structure definition.
Parameters:
names - The attribute(s) name list

virtual void write_attributes(const Tango::AttributeValueList& values) throw(Tango::DevFailed, CORBA::SystemException)
Write attribute(s) value. Invoked when the client request the write_attributes CORBA operation. It sets the attribute(s) with the new value(s) passed as parameter.
Throws:
DevFailed Thrown if the command does not exist. Click here to read DevFailed exception specification
Parameters:
values - The attribute(s) new value(s). One structure is initialised for each wanted attribute with the attribute value. The attribute quality and date are not used by this method. Click here to read AttributeValue structure definition.

Methods to build Tango array types.
These methods are helper methods to build Tango array types from an already existing buffer (Tango array types are CORBA sequences)

inline Tango::DevVarCharArray* create_DevVarCharArray(unsigned char *ptr, long length)
Create a DevVarCharArray type. Create a DevVarCharArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarCharArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarShortArray* create_DevVarShortArray(short *ptr, long length)
Create a DevVarShortArray type. Create a DevVarShortArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarShortArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarLongArray* create_DevVarLongArray(long *ptr, long length)
Create a DevVarLongArray type. Create a DevVarLongArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarLongArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarFloatArray* create_DevVarFloatArray(float *ptr, long length)
Create a DevVarFloatArray type. Create a DevVarFloatArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarFloatArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarDoubleArray* create_DevVarDoubleArray(double *ptr, long length)
Create a DevVarDoubleArray type. Create a DevVarDoubleArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarDoubleArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarUShortArray* create_DevVarUShortArray(unsigned short *ptr, long length)
Create a DevVarUShortArray type. Create a DevVarUShortArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarUShortArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarULongArray* create_DevVarULongArray(unsigned long *ptr, long length)
Create a DevVarULongArray type. Create a DevVarULongArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarULongArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

inline Tango::DevVarStringArray* create_DevVarStringArray(char **ptr, long length)
Create a DevVarStringArray type. Create a DevVarStringArray type data and return a pointer to it. The array is build using the input pointer with the given length
Returns:
Pointer to the created DevVarStringArray type data
Parameters:
ptr - Pointer to the basic type data buffer
length - Number of element in the previous buffer

Miscellaneous methods

virtual void init_device()
Intialise a device. In the DeviceImpl class, this method is pure abstract and must be defined in sub-class. Its rule is to initialise a device. This method is called during device creation an dby the DevRestart command
Throws:
DevFailed This method does not throw exception but a redefined method can. Click here to read DevFailed exception specification

virtual void always_executed_hook(void)
Hook method. Default method to implement an action necessary on a device before any command is executed. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs
Throws:
DevFailed This method does not throw exception but a redefined method can. Click here to read DevFailed exception specification

virtual void read_attr_hardware(vector &attr_list)
Read the hardware to return attribute value(s). Default method to implement an action necessary on a device to read the hardware involved in a a read attribute CORBA call. This method must be redefined in sub-classes in order to support attribute reading
Throws:
DevFailed This method does not throw exception but a redefined method can. Click here to read DevFailed exception specification
Parameters:
attr_list - Reference to a vector with Integer object. Each element in this vector is the index in the device onject attribute vector of an attribute to be read.

virtual void read_attr(Attribute &attr)
Set the attribute read value. Default method to set an attribute read value. This method must be redefined in sub-classes when attributes are needed
Throws:
DevFailed This method does not throw exception but a redefined method can. Click here to read DevFailed exception specification
Parameters:
attr - The attribute object

virtual void write_attr_hardware(vector &attr_list)
Write the hardware for attributes. Default method to implement an action necessary on a device to write the hardware involved in a a write attribute. This method must be redefined in sub-classes in order to support writable attribute
Throws:
DevFailed This method does not throw exception but a redefined method can. Click here to read DevFailed exception specification
Parameters:
attr_list - Reference to a vector of Integer objects. Each element in this vector is the index in the main attribute vector of an attribute to be written.

virtual Tango::DevState dev_state()
Get device state. Default method to get device state. The behaviour of this method depends on the device state. If the device state is ON or ALARM, it reads the attribute(s) with an alarm level defined, check if the read value is above/below the alarm and eventually change the state to ALARM, return the device state. For all th eother device state, ti smethod simply returns the state This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs
Throws:
DevFailed If it is necessary to read attribute(s) and a problem occurs during the reading. Click here to read DevFailed exception specification
Returns:
The device state

virtual Tango::ConstDevString dev_status()
Get device status. Default method to get device status. It returns the contents of the device dev_status field. If the device state is ALARM, alarm messages are added to the device status. This method can be redefined in sub-classes in case of the default behaviour does not fullfill the needs
Throws:
DevFailed This method does not throw exception but a redefined method can. Click here to read DevFailed exception specification
Returns:
The device status

Signal related methods
These methods allow a signal management at device level

void register_signal(long signo, bool own_handler = false)
Register a signal to be executed in a signal handler. Register this device as device to be informed when signal signo is sent to to the device server process. This method is available only under Linux.
Throws:
DevFailed Thrown if the signal number is out of range or if the operating system failed to register a signal for the process. Click here to read DevFailed exception specification
Parameters:
signo - The signal number
own_handler - A boolean set to true if you want the device signal handler to be executed in its own handler instead of being executed by the signal thread. If this parameter is set to true, care should be taken on how the handler is written. A default false value is provided

void register_signal(long signo)
Register a signal. Register this device as device to be informed when signal signo is sent to to the device server process
Throws:
DevFailed Thrown if the signal number is out of range or if the operating system failed to register a signal for the process. Click here to read DevFailed exception specification
Parameters:
signo - The signal number

void unregister_signal(long signo)
Unregister a signal. Unregister this device as device to be informed when signal signo is sent to to the device server process
Throws:
DevFailed Thrown if the signal number is out of range or if the operating system failed to unregister a signal for the process. Unregister a device for a signal number for a device not previously registered is not an error. This simply will do nothing. Click here to read DevFailed exception specification
Parameters:
signo - The signal number

virtual void signal_handler(long signo)
Signal handler. The method executed when the signal arrived in the device server process. This method is defined as virtual and then, can be redefined following device needs.
Parameters:
signo - The signal number

Class data members

BlackBox* blackbox_ptr
The device black box pointer

long blackbox_depth
The device black box depth

string device_name
The device name

string desc
The device description

string device_status
The device status

Tango::DevState device_state
The device state

Tango::DevSecurity access
The device access

long version
The device version

DeviceClass* device_class
Pointer to the device-class object associated with the device

MultiAttribute* dev_attr
Pointer to the multi attribute object

DbDevice* db_dev
Pointer to the associated DbDevice object

string adm_device_name
The administration device name


This class has no child classes.
Author:
$Author: taurel $
Version:
$Revision: 1.3 $

alphabetic index hierarchy of classes


generated by doc++