Commit 4b1b4f0f authored by Yuelong Yu's avatar Yuelong Yu
Browse files

fixed cannot read temperature problem

parent 7bd8d2ef
......@@ -2226,26 +2226,29 @@ void AGIPD::add_dynamic_commands()
bool AGIPD::ConnectUC(string strUC)
{
try
{
Tango::DeviceProxy* m_objUC = new Tango::DeviceProxy(strUC);
m_objUC->ping();
usleep(100);
return true;
}
catch(std::exception& e)
if(!strUC.empty())
{
cout<<e.what()<<endl;
}
catch(Tango::DevFailed& df)
{
cout<<"Tango::DevFailed exception during init"<<endl;
for(unsigned int err=0; err<df.errors.length(); err++)
cout<<"Error: " << df.errors[err].desc.in() <<endl;
}
try
{
m_objUC = new Tango::DeviceProxy(strUC);
m_objUC->ping();
usleep(100);
return true;
}
catch(std::exception& e)
{
cout<<e.what()<<endl;
}
catch(Tango::DevFailed& df)
{
cout<<"Tango::DevFailed exception during init"<<endl;
for(unsigned int err=0; err<df.errors.length(); err++)
cout<<"Error: " << df.errors[err].desc.in() <<endl;
}
return false;
}
return false;
}
// //--------------------------------------------------------
// /**
......
......@@ -135,6 +135,7 @@ namespace AGIPD_ns
strFileName = m_strFileName + "_" + chNum;
m_nFileIndex++;
}
cout<<"create file:"<<strFileName<<endl;
int nRet = 0;
nRet = m_objNXFileWriter->FileConfig(strFileName
......@@ -261,6 +262,10 @@ namespace AGIPD_ns
m_bManualSplitEnabled = true;
m_vImg.resize(m_nX*m_nY,0);
//read temperature
m_vTemperature = ReadOutTemperature();
}
template <typename T>
......@@ -318,7 +323,6 @@ namespace AGIPD_ns
{
if(*(m_objAGIPD->attr_RotateImage_read))
std::reverse(m_ptrShData,m_ptrShData+m_nX*m_nY);
}
......@@ -357,7 +361,8 @@ namespace AGIPD_ns
else
{
if(m_bManualSplitEnabled && m_bSaveAllImages
&& m_lAcquiredImgs != 0 && (*(m_objAGIPD->attr_FramesPerFile_read) == 0))
&& m_lAcquiredImgs != 0
&& (m_lAcquiredImgs % (*(m_objAGIPD->attr_FramesPerFile_read))) == 0)
{
int nRet = m_objNXFileWriter->CloseFile();
DisplayError(string("Close file"),nRet);
......@@ -555,17 +560,13 @@ namespace AGIPD_ns
DisplayError(string("write udp ip address"),nRet);
if(nRet != 0)
return false;
//write temperature
vector<float> vTemperature = ReadOutTemperature();
if(vTemperature.size() != 0)
if(m_vTemperature.size() != 0)
{
nRet = m_objNXFileWriter->DumpAllAttributesFromTango(
string("/entry/instrument/detector/collection/"),
"temperature",
vTemperature,
vTemperature.size(),
m_vTemperature,
m_vTemperature.size(),
"Celsius");
DisplayError(string("write temeprature"),nRet);
......@@ -587,6 +588,7 @@ namespace AGIPD_ns
Tango::DeviceProxy* objUC = m_objAGIPD->m_objUC;
string strAttrName = "Temperature"+to_string(m_objAGIPD->moduleIDInUc);
cout<<objUC<<" - "<<m_objAGIPD->m_objUC<<endl;
if(objUC == NULL)
return vector<float>();
......@@ -597,7 +599,8 @@ namespace AGIPD_ns
{
Tango::DeviceAttribute objAttr = objUC->read_attribute(strAttrName);
(objAttr)>>strDevVal;
cout<<strDevVal<<endl;
}
catch(Tango::DevFailed& df)
{
......@@ -702,6 +705,7 @@ namespace AGIPD_ns
m_bManualSplitEnabled;
vector<short> m_vImg;
vector<float> m_vTemperature;
};
}
......
Supports Markdown
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