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