Commit a41d78ee authored by Yuelong Yu's avatar Yuelong Yu
Browse files

read out spectrum data from TTTGW

parent 4f86234b
......@@ -60,10 +60,8 @@ static const char *RcsId = "$Id: $";
//
// Command name | Method name
//================================================================
// State | dev_state
// Status | dev_status
// Start | start
// Stop | stop
// State | Inherited (no method)
// Status | Inherited (no method)
//================================================================
//================================================================
......@@ -311,84 +309,40 @@ void AGIPDMC::add_dynamic_attributes()
/*----- PROTECTED REGION END -----*/ // AGIPDMC::add_dynamic_attributes
}
//--------------------------------------------------------
/**
* Command State related method
* Description: This command gets the device state (stored in its device_state data member) and returns it to the caller.
*
* @returns Device state
*/
//--------------------------------------------------------
Tango::DevState AGIPDMC::dev_state()
{
DEBUG_STREAM << "AGIPDMC::State() - " << device_name << endl;
/*----- PROTECTED REGION ID(AGIPDMC::dev_state) ENABLED START -----*/
Tango::DevState argout = Tango::UNKNOWN; // replace by your own algorithm
// Add your own code
/*----- PROTECTED REGION END -----*/ // AGIPDMC::dev_state
set_state(argout); // Give the state to Tango.
if (argout!=Tango::ALARM)
DeviceImpl::dev_state();
return get_state(); // Return it after Tango management.
}
//--------------------------------------------------------
/**
* Command Status related method
* Description: This command gets the device status (stored in its device_status data member) and returns it to the caller.
*
* @returns Device status
*/
//--------------------------------------------------------
Tango::ConstDevString AGIPDMC::dev_status()
{
DEBUG_STREAM << "AGIPDMC::Status() - " << device_name << endl;
/*----- PROTECTED REGION ID(AGIPDMC::dev_status) ENABLED START -----*/
string status = "Device is OK";
// Add your own code
/*----- PROTECTED REGION END -----*/ // AGIPDMC::dev_status
set_status(status); // Give the status to Tango.
return DeviceImpl::dev_status(); // Return it.
}
//--------------------------------------------------------
/**
* Command Start related method
* Description: start update the data returned by TTTGW tango server
*
*/
//--------------------------------------------------------
void AGIPDMC::start()
{
DEBUG_STREAM << "AGIPDMC::Start() - " << device_name << endl;
/*----- PROTECTED REGION ID(AGIPDMC::start) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AGIPDMC::start
}
//--------------------------------------------------------
/**
* Command Stop related method
* Description: stop update the data returned by TTTGW tango server
*
*/
//--------------------------------------------------------
void AGIPDMC::stop()
{
DEBUG_STREAM << "AGIPDMC::Stop() - " << device_name << endl;
/*----- PROTECTED REGION ID(AGIPDMC::stop) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AGIPDMC::stop
}
/*----- PROTECTED REGION ID(AGIPDMC::namespace_ending) ENABLED START -----*/
// Additional Methods
// //--------------------------------------------------------
// /**
// * Command Start related method
// * Description: start update the data returned by TTTGW tango server
// *
// */
// //--------------------------------------------------------
// void AGIPDMC::start()
// {
// DEBUG_STREAM << "AGIPDMC::Start() - " << device_name << endl;
//
// // Add your own code
//
// }
// //--------------------------------------------------------
// /**
// * Command Stop related method
// * Description: stop update the data returned by TTTGW tango server
// *
// */
// //--------------------------------------------------------
// void AGIPDMC::stop()
// {
// DEBUG_STREAM << "AGIPDMC::Stop() - " << device_name << endl;
//
// // Add your own code
//
// }
/*----- PROTECTED REGION END -----*/ // AGIPDMC::namespace_ending
} // namespace
......@@ -168,34 +168,6 @@ public:
// Command related methods
public:
/**
* Command State related method
* Description: This command gets the device state (stored in its device_state data member) and returns it to the caller.
*
* @returns Device state
*/
virtual Tango::DevState dev_state();
/**
* Command Status related method
* Description: This command gets the device status (stored in its device_status data member) and returns it to the caller.
*
* @returns Device status
*/
virtual Tango::ConstDevString dev_status();
/**
* Command Start related method
* Description: start update the data returned by TTTGW tango server
*
*/
virtual void start();
virtual bool is_Start_allowed(const CORBA::Any &any);
/**
* Command Stop related method
* Description: stop update the data returned by TTTGW tango server
*
*/
virtual void stop();
virtual bool is_Stop_allowed(const CORBA::Any &any);
/*----- PROTECTED REGION ID(AGIPDMC::Additional Method prototypes) ENABLED START -----*/
......
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<classes name="AGIPDMC" pogoRevision="8.1">
<description description="A tango server used to communicate with AGIPD microcontroller. One TINE server&#xA;is running on microcontroller. TTTGW tango server is used to communicate with the&#xA;TINE server. This tango server communicates with TTTGW tango server and read out&#xA;related data returned by TTTGW tango server." title="AGIPDMC" sourcePath="/home/yuelong/src/gitrepo/detsoftware/tango/agipdmc" language="Cpp" filestogenerate="XMI file,Code files,Makefile,html Pages" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false" descriptionHtmlExists="false">
<description description="A tango server used to communicate with AGIPD microcontroller. One TINE server&#xA;is running on microcontroller. TTTGW tango server is used to communicate with the&#xA;TINE server. This tango server communicates with TTTGW tango server and read out&#xA;related data returned by TTTGW tango server." title="AGIPDMC" sourcePath="/home/yuelong/src/gitrepo/detsoftware/tango/agipdmc" language="Cpp" filestogenerate="XMI file,Code files,html Pages" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false" descriptionHtmlExists="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at desy.de - yuelong.yu" author="yuelong.yu" emailDomain="desy.de" classFamily="Acquisition" siteSpecific="" platform="Unix Like" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
......@@ -16,7 +16,7 @@
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true" concreteHere="true"/>
<status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
......@@ -25,25 +25,7 @@
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true" concreteHere="true"/>
</commands>
<commands name="Start" description="start update the data returned by TTTGW tango server" execMethod="start" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="Stop" description="stop update the data returned by TTTGW tango server" execMethod="stop" displayLevel="OPERATOR" polledPeriod="0">
<argin description="">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<status abstract="true" inherited="true" concrete="true" concreteHere="false"/>
</commands>
<attributes name="RawMatrix" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="6000" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:ShortType"/>
......@@ -51,7 +33,7 @@
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="RawMatrix" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<states name="ON" description="">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
......
......@@ -158,42 +158,6 @@ AGIPDMCClass *AGIPDMCClass::instance()
//===================================================================
// Command execution method calls
//===================================================================
//--------------------------------------------------------
/**
* method : StartClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
* @param in_any The command input data
*
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *StartClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "StartClass::execute(): arrived" << endl;
((static_cast<AGIPDMC *>(device))->start());
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : StopClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
* @param in_any The command input data
*
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *StopClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
cout2 << "StopClass::execute(): arrived" << endl;
((static_cast<AGIPDMC *>(device))->stop());
return new CORBA::Any();
}
//===================================================================
// Properties management
......@@ -487,7 +451,7 @@ void AGIPDMCClass::attribute_factory(vector<Tango::Attr *> &att_list)
RawMatrixAttrib *rawmatrix = new RawMatrixAttrib();
Tango::UserDefaultAttrProp rawmatrix_prop;
// description not set for RawMatrix
rawmatrix_prop.set_label("RawMatrix");
// label not set for RawMatrix
// unit not set for RawMatrix
// standard_unit not set for RawMatrix
// display_unit not set for RawMatrix
......@@ -531,24 +495,6 @@ void AGIPDMCClass::command_factory()
/*----- PROTECTED REGION END -----*/ // AGIPDMCClass::command_factory_before
// Command Start
StartClass *pStartCmd =
new StartClass("Start",
Tango::DEV_VOID, Tango::DEV_VOID,
"",
"",
Tango::OPERATOR);
command_list.push_back(pStartCmd);
// Command Stop
StopClass *pStopCmd =
new StopClass("Stop",
Tango::DEV_VOID, Tango::DEV_VOID,
"",
"",
Tango::OPERATOR);
command_list.push_back(pStopCmd);
/*----- PROTECTED REGION ID(AGIPDMCClass::command_factory_after) ENABLED START -----*/
// Add your own code
......
......@@ -73,56 +73,6 @@ public:
};
//=========================================
// Define classes for commands
//=========================================
// Command Start class definition
class StartClass : public Tango::Command
{
public:
StartClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
StartClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~StartClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<AGIPDMC *>(dev))->is_Start_allowed(any);}
};
// Command Stop class definition
class StopClass : public Tango::Command
{
public:
StopClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
StopClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~StopClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return (static_cast<AGIPDMC *>(dev))->is_Stop_allowed(any);}
};
/**
* The AGIPDMCClass singleton definition
*/
......
......@@ -72,34 +72,4 @@ bool AGIPDMC::is_RawMatrix_allowed(TANGO_UNUSED(Tango::AttReqType type))
// Commands Allowed Methods
//=================================================
//--------------------------------------------------------
/**
* Method : AGIPDMC::is_Start_allowed()
* Description : Execution allowed for Start attribute
*/
//--------------------------------------------------------
bool AGIPDMC::is_Start_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Start command.
/*----- PROTECTED REGION ID(AGIPDMC::StartStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AGIPDMC::StartStateAllowed
return true;
}
//--------------------------------------------------------
/**
* Method : AGIPDMC::is_Stop_allowed()
* Description : Execution allowed for Stop attribute
*/
//--------------------------------------------------------
bool AGIPDMC::is_Stop_allowed(TANGO_UNUSED(const CORBA::Any &any))
{
// Not any excluded states for Stop command.
/*----- PROTECTED REGION ID(AGIPDMC::StopStateAllowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AGIPDMC::StopStateAllowed
return true;
}
} // End of namespace
......@@ -3,13 +3,13 @@
namespace AGIPDMC_ns
{
UpdateDataThread::UpdateDataThread(AGIPDMC* _sptrAGIPDMC,
Tango::DeviceProxy* _sptrDP,
UpdateDataThread::UpdateDataThread(AGIPDMC* _objAGIPDMC,
Tango::DeviceProxy* _objDP,
omni_mutex& _mtxData)
:omni_thread(),
Tango::LogAdapter(_sptrAGIPDMC),
m_sptrAGIPDMC(_sptrAGIPDMC),
m_sptrDP(_sptrDP),
Tango::LogAdapter(_objAGIPDMC),
m_objAGIPDMC(_objAGIPDMC),
m_objDP(_objDP),
m_mtxData(_mtxData)
{
start_undetached();
......@@ -28,18 +28,46 @@ namespace AGIPDMC_ns
{
omni_mutex_lock l(m_mtxData);
if(m_sptrAGIPDMC->m_bSysExit)
if(m_objAGIPDMC->m_bSysExit)
break;
ReadOutSpectrum();
ReadOutSpectrum(string("short_spectrum_ro"));
}
}
omni_thread::exit();
}
void UpdateDataThread::ReadOutSpectrum()
void UpdateDataThread::ReadOutSpectrum(string strAttrName)
{
cout<<"Read out spectrum"<<endl;
//cout<<"Read out spectrum"<<endl;
try
{
Tango::DeviceAttribute objAttr = m_objDP->read_attribute(strAttrName);
// T tVal;
// (objAttr)>>tVal;
int nLen = objAttr.get_dim_x();
vector<Tango::DevShort> vshData;//(nLen,0);
if(objAttr.extract_read(vshData))
{
m_objAGIPDMC->m_nDataLength = nLen;
std::copy(vshData.begin(),vshData.end(),(m_objAGIPDMC->attr_RawMatrix_read));
//cout<<"read"<<endl;
}
// else
// cout<<"read out failed"<<endl;
}
catch(exception& e)
{
cout<<"read spectrum:"<<strAttrName<<" error!!!"<<e.what()<<endl;
}
catch(...)
{
cout<<"unknown exception caught"<<endl;
}
}
}
......@@ -10,18 +10,18 @@ namespace AGIPDMC_ns
{
public:
UpdateDataThread(AGIPDMC* _sptrAGIPDMC,
Tango::DeviceProxy* _sptrDP,
UpdateDataThread(AGIPDMC* _objAGIPDMC,
Tango::DeviceProxy* _objDP,
omni_mutex& _mtxData);
~UpdateDataThread();
void *run_undetached(void*);
private:
void ReadOutSpectrum();
void ReadOutSpectrum(string);
/// member variables
AGIPDMC* m_sptrAGIPDMC;
Tango::DeviceProxy* m_sptrDP;
AGIPDMC* m_objAGIPDMC;
Tango::DeviceProxy* m_objDP;
omni_mutex& m_mtxData;
};
}
......
......@@ -62,7 +62,7 @@
</tr>
<tr>
<td> label </td>
<td> RawMatrix </td>
<td> </td>
</tr>
<tr>
<td> unit </td>
......
......@@ -36,7 +36,7 @@
</tr>
<tr>
<td> Abstract </td>
<td> false </td>
<td> true </td>
<td> .. </td>
</tr>
<tr>
......
......@@ -36,7 +36,7 @@
</tr>
<tr>
<td> Abstract </td>
<td> false </td>
<td> true </td>
<td> .. </td>
</tr>
<tr>
......
......@@ -29,20 +29,6 @@
<td> OPERATOR </td>
<td> This command gets the device status (stored in its device_status data member) and returns it to the caller. </td>
</tr>
<tr>
<td> <a href="CmdStart.html"> Start </a> </td>
<td> DEV_VOID </td>
<td> DEV_VOID </td>
<td> OPERATOR </td>
<td> start update the data returned by TTTGW tango server </td>
</tr>
<tr>
<td> <a href="CmdStop.html"> Stop </a> </td>
<td> DEV_VOID </td>
<td> DEV_VOID </td>
<td> OPERATOR </td>
<td> stop update the data returned by TTTGW tango server </td>
</tr>
</table>
</body>
</html>
......@@ -62,8 +62,6 @@
<ul>
<li> <a href="FullDocument.html#cmdState"> State </a>
<li> <a href="FullDocument.html#cmdStatus"> Status </a>
<li> <a href="FullDocument.html#cmdStart"> Start </a>
<li> <a href="FullDocument.html#cmdStop"> Stop </a>
</ul>
<li> <a href="FullDocument.html#attributes"> Attributes </a>
<ul>
......@@ -182,20 +180,6 @@
<td> OPERATOR </td>
<td> This command gets the device status (stored in its device_status data member) and returns it to the caller. </td>
</tr>
<tr>
<td> <a href="CmdStart.html"> Start </a> </td>
<td> DEV_VOID </td>
<td> DEV_VOID </td>
<td> OPERATOR </td>
<td> start update the data returned by TTTGW tango server </td>
</tr>
<tr>
<td> <a href="CmdStop.html"> Stop </a> </td>
<td> DEV_VOID </td>
<td> DEV_VOID </td>
<td> OPERATOR </td>
<td> stop update the data returned by TTTGW tango server </td>
</tr>
</table>
<br><br><hr>
<a name="cmdState"> </a>
......@@ -231,7 +215,7 @@
</tr>
<tr>
<td> Abstract </td>
<td> false </td>
<td> true </td>
<td> .. </td>
</tr>
<tr>
......@@ -280,105 +264,7 @@
</tr>
<tr>
<td> Abstract </td>
<td> false </td>
<td> .. </td>
</tr>
<tr>
<td> Polling Period </td>
<td> Not polled </td>
<td> .. </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td><Td><Hr></Td></Tr>
<tr>
<td> Command allowed for </td>
<td> All states </td>
<td> .. </td>
</tr>
</table>
<br><br><hr>
<a name="cmdStart"> </a>
<br><br><br>
<font size="+1"><u><b> Command Start : </b></u></font>
<ul>
start update the data returned by TTTGW tango server
</ul>
<br><br><br>
<Table Border=2 Cellpadding=3 CELLSPACING=0>
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=0> <font size=+1> <center><b> Start Definition </b></font></center></td>
</tr>
<tr>
<td> Input Argument </td>
<td> Tango::DEV_VOID </td>
<td> </td>
</tr>
<tr>
<td> Output Argument </td>
<td> Tango::DEV_VOID </td>
<td> </td>
</tr>
<tr>
<td> DisplayLevel </td>
<td> OPERATOR </td>
<td> .. </td>
</tr>
<tr>
<td> Inherited </td>
<td> false </td>