Commit 5ea77d15 authored by Yuelong Yu's avatar Yuelong Yu
Browse files

added heightmax and widthmax

parent b24a21eb
Pipeline #38799 passed with stage
in 1 minute and 48 seconds
......@@ -103,6 +103,15 @@ namespace EoSensCam_ns
m_phx->RunCMD(cmd, reply);
return stoi(string(reply.begin(), reply.end()));
}
bool EoSensCL::GetMaxImageSize(uint32_t& x, uint32_t& y)
{
m_fl("EoSensCL::GetMaxImageSize", EDEBUG);
m_fl("no max size info for this camera", EERROR);
x = 0;
y = 0;
return false;
}
bool EoSensCL::SetBlackLevel(uint16_t b)
{
......
......@@ -24,6 +24,8 @@ namespace EoSensCam_ns
string GetCameraID() override;
int16_t GetTemerature();
bool GetMaxImageSize(uint32_t& x, uint32_t& y) override;
bool SetBlackLevel(uint16_t b) override;
bool GetBlackLevel(uint16_t& b) override;
......
......@@ -123,6 +123,14 @@ namespace EoSensCam_ns
return static_cast<int16_t>(t);
}
bool EoSensCXP::GetMaxImageSize(uint32_t& x, uint32_t& y)
{
m_fl("EoSensCXP::GetMaxImageSize", EDEBUG);
x = m_max_x;
y = m_max_y;
return true;
}
bool EoSensCXP::SetBlackLevel(uint16_t b)
{
......
......@@ -25,6 +25,8 @@ namespace EoSensCam_ns
string GetCameraID() override;
int16_t GetTemerature() override;
bool GetMaxImageSize(uint32_t& x, uint32_t& y) override;
bool SetBlackLevel(uint16_t b) override;
bool GetBlackLevel(uint16_t& b) override;
......
......@@ -22,6 +22,7 @@ namespace EoSensCam_ns
virtual string GetCameraID() = 0;
virtual int16_t GetTemerature() = 0;
virtual bool GetMaxImageSize(uint32_t& x, uint32_t& y) = 0;
virtual bool SetBlackLevel(uint16_t b) = 0;
virtual bool GetBlackLevel(uint16_t& b) = 0;
......
......@@ -98,6 +98,8 @@
// Width | Tango::DevLong Scalar
// XStart | Tango::DevLong Scalar
// YStart | Tango::DevLong Scalar
// HeightMax | Tango::DevLong Scalar
// WidthMax | Tango::DevLong Scalar
// ROI | Tango::DevLong Spectrum ( max = 128)
// LiveImage | Tango::DevUChar Image ( max = 2000 x 2000)
//================================================================
......@@ -198,6 +200,8 @@ void FireBird::delete_device()
delete[] attr_Width_read;
delete[] attr_XStart_read;
delete[] attr_YStart_read;
delete[] attr_HeightMax_read;
delete[] attr_WidthMax_read;
delete[] attr_ROI_read;
delete[] attr_LiveImage_read;
}
......@@ -256,6 +260,8 @@ void FireBird::init_device()
attr_Width_read = new Tango::DevLong[1];
attr_XStart_read = new Tango::DevLong[1];
attr_YStart_read = new Tango::DevLong[1];
attr_HeightMax_read = new Tango::DevLong[1];
attr_WidthMax_read = new Tango::DevLong[1];
attr_ROI_read = new Tango::DevLong[128];
attr_LiveImage_read = new Tango::DevUChar[2000*2000];
/*----- PROTECTED REGION ID(FireBird::init_device) ENABLED START -----*/
......@@ -299,6 +305,7 @@ void FireBird::init_device()
m_user_set_variable = false;
m_thread_status = 0;
m_gain_support = false;
m_has_max_size = false;
std::fill(attr_ROI_read, attr_ROI_read + 128,0);
std::fill(attr_LiveImage_read, attr_LiveImage_read + 2000*2000, 0);
......@@ -1775,6 +1782,44 @@ void FireBird::write_YStart(Tango::WAttribute &attr)
/*----- PROTECTED REGION END -----*/ // FireBird::write_YStart
}
//--------------------------------------------------------
/**
* Read attribute HeightMax related method
* Description: max height of image
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
//--------------------------------------------------------
void FireBird::read_HeightMax(Tango::Attribute &attr)
{
DEBUG_STREAM << "FireBird::read_HeightMax(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(FireBird::read_HeightMax) ENABLED START -----*/
// Set the attribute value
if(m_has_max_size)
attr.set_value(attr_HeightMax_read);
/*----- PROTECTED REGION END -----*/ // FireBird::read_HeightMax
}
//--------------------------------------------------------
/**
* Read attribute WidthMax related method
* Description: maximum width of image size
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
//--------------------------------------------------------
void FireBird::read_WidthMax(Tango::Attribute &attr)
{
DEBUG_STREAM << "FireBird::read_WidthMax(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(FireBird::read_WidthMax) ENABLED START -----*/
// Set the attribute value
if(m_has_max_size)
attr.set_value(attr_WidthMax_read);
/*----- PROTECTED REGION END -----*/ // FireBird::read_WidthMax
}
//--------------------------------------------------------
/**
* Read attribute ROI related method
* Description: ROI format: x-start,y-start,x-length,y-length
......@@ -2248,6 +2293,11 @@ bool FireBird::UpdateCamera()
ERROR_STREAM<<"camera pixel clock failed"<<endl;
m_pixelclock_support = false;
}
uint32_t x_max,y_max;
m_has_max_size = m_cam->GetMaxImageSize(x_max, y_max);
*attr_WidthMax_read = x_max;
*attr_HeightMax_read = y_max;
INFO_STREAM<<"camera SN: "<<camera_sn <<endl
<< "camera id: "<<camera_id <<endl
<<"camera temperature: "<<camera_temperature
......
......@@ -80,7 +80,8 @@ class FireBird : public TANGO_BASE_CLASS
bool m_gain_support,
m_camera_mode_support,
m_run_mode_support,
m_pixelclock_support;
m_pixelclock_support,
m_has_max_size;
//stringstream m_ssinfo;
public:
string m_save_filename;
......@@ -159,6 +160,8 @@ public:
Tango::DevLong *attr_Width_read;
Tango::DevLong *attr_XStart_read;
Tango::DevLong *attr_YStart_read;
Tango::DevLong *attr_HeightMax_read;
Tango::DevLong *attr_WidthMax_read;
Tango::DevLong *attr_ROI_read;
Tango::DevUChar *attr_LiveImage_read;
......@@ -590,6 +593,24 @@ public:
virtual void read_YStart(Tango::Attribute &attr);
virtual void write_YStart(Tango::WAttribute &attr);
virtual bool is_YStart_allowed(Tango::AttReqType type);
/**
* Attribute HeightMax related methods
* Description: max height of image
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
virtual void read_HeightMax(Tango::Attribute &attr);
virtual bool is_HeightMax_allowed(Tango::AttReqType type);
/**
* Attribute WidthMax related methods
* Description: maximum width of image size
*
* Data type: Tango::DevLong
* Attr type: Scalar
*/
virtual void read_WidthMax(Tango::Attribute &attr);
virtual bool is_WidthMax_allowed(Tango::AttReqType type);
/**
* Attribute ROI related methods
* Description: ROI format: x-start,y-start,x-length,y-length
......
......@@ -405,6 +405,22 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="start pixel of image in y-direction" label="YStart" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="HeightMax" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="max height of image" label="HeightMax" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="WidthMax" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="maximum width of image size" label="WidthMax" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="ROI" attType="Spectrum" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="128" maxY="" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:IntType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......
......@@ -1372,6 +1372,54 @@ void FireBirdClass::attribute_factory(vector<Tango::Attr *> &att_list)
ystart->set_memorized_init(false);
att_list.push_back(ystart);
// Attribute : HeightMax
HeightMaxAttrib *heightmax = new HeightMaxAttrib();
Tango::UserDefaultAttrProp heightmax_prop;
heightmax_prop.set_description("max height of image");
heightmax_prop.set_label("HeightMax");
// unit not set for HeightMax
// standard_unit not set for HeightMax
// display_unit not set for HeightMax
// format not set for HeightMax
// max_value not set for HeightMax
// min_value not set for HeightMax
// max_alarm not set for HeightMax
// min_alarm not set for HeightMax
// max_warning not set for HeightMax
// min_warning not set for HeightMax
// delta_t not set for HeightMax
// delta_val not set for HeightMax
heightmax->set_default_properties(heightmax_prop);
// Not Polled
heightmax->set_disp_level(Tango::OPERATOR);
// Not Memorized
att_list.push_back(heightmax);
// Attribute : WidthMax
WidthMaxAttrib *widthmax = new WidthMaxAttrib();
Tango::UserDefaultAttrProp widthmax_prop;
widthmax_prop.set_description("maximum width of image size");
widthmax_prop.set_label("WidthMax");
// unit not set for WidthMax
// standard_unit not set for WidthMax
// display_unit not set for WidthMax
// format not set for WidthMax
// max_value not set for WidthMax
// min_value not set for WidthMax
// max_alarm not set for WidthMax
// min_alarm not set for WidthMax
// max_warning not set for WidthMax
// min_warning not set for WidthMax
// delta_t not set for WidthMax
// delta_val not set for WidthMax
widthmax->set_default_properties(widthmax_prop);
// Not Polled
widthmax->set_disp_level(Tango::OPERATOR);
// Not Memorized
att_list.push_back(widthmax);
// Attribute : ROI
ROIAttrib *roi = new ROIAttrib();
Tango::UserDefaultAttrProp roi_prop;
......
......@@ -555,6 +555,32 @@ public:
{return (static_cast<FireBird *>(dev))->is_YStart_allowed(ty);}
};
// Attribute HeightMax class definition
class HeightMaxAttrib: public Tango::Attr
{
public:
HeightMaxAttrib():Attr("HeightMax",
Tango::DEV_LONG, Tango::READ) {};
~HeightMaxAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<FireBird *>(dev))->read_HeightMax(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<FireBird *>(dev))->is_HeightMax_allowed(ty);}
};
// Attribute WidthMax class definition
class WidthMaxAttrib: public Tango::Attr
{
public:
WidthMaxAttrib():Attr("WidthMax",
Tango::DEV_LONG, Tango::READ) {};
~WidthMaxAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<FireBird *>(dev))->read_WidthMax(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<FireBird *>(dev))->is_WidthMax_allowed(ty);}
};
// Attribute ROI class definition
class ROIAttrib: public Tango::SpectrumAttr
{
......
......@@ -844,6 +844,38 @@ bool FireBird::is_YStart_allowed(TANGO_UNUSED(Tango::AttReqType type))
return true;
}
//--------------------------------------------------------
/**
* Method : FireBird::is_HeightMax_allowed()
* Description : Execution allowed for HeightMax attribute
*/
//--------------------------------------------------------
bool FireBird::is_HeightMax_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for HeightMax attribute in read access.
/*----- PROTECTED REGION ID(FireBird::HeightMaxStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // FireBird::HeightMaxStateAllowed_READ
return true;
}
//--------------------------------------------------------
/**
* Method : FireBird::is_WidthMax_allowed()
* Description : Execution allowed for WidthMax attribute
*/
//--------------------------------------------------------
bool FireBird::is_WidthMax_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for WidthMax attribute in read access.
/*----- PROTECTED REGION ID(FireBird::WidthMaxStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // FireBird::WidthMaxStateAllowed_READ
return true;
}
//--------------------------------------------------------
/**
* Method : FireBird::is_ROI_allowed()
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title> FireBird Tango Class Attribute HeightMax </title>
</head>
<body text="Black" bgcolor="White" link="Blue" vlink="Purple" alink="Red">
<br><br><br>
<font size="+1"><u><b> Attribute HeightMax : </b></u></font>
<ul>
max height of image
</ul>
<br><br><br>
<Table Border=0 Cellpadding=0 CELLSPACING=20>
<TR>
<TD ALIGN="left" VALIGN=top>
<Table Border=2 Cellpadding=3 CELLSPACING=0>
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=0> <font size=+1> <center><b> Attribute Definition </b></font></center></td>
</tr>
<tr>
<td> Attribute Type </td>
<td> Scalar </td>
</tr>
<tr>
<td> R/W Type </td>
<td> READ </td>
</tr>
<tr>
<td> Data Type </td>
<td> Tango::DEV_LONG </td>
</tr>
<tr>
<td> Display Level </td>
<td> OPERATOR </td>
</tr>
<tr>
<td> Inherited </td>
<td> false </td>
</tr>
<tr>
<td> Abstract </td>
<td> false </td>
</tr>
<tr>
<td> Polling Period </td>
<td> Not polled </td>
</tr>
<tr>
<td> Memorized </td>
<td> Not set </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td></Tr>
<tr>
<td> Read allowed for </td>
<td> All states </td>
</tr>
</table>
</td>
<TD ALIGN="Center" VALIGN=top>
<Table Border=2 Cellpadding=3 CELLSPACING=0>
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=0> <font size=+1> <center><b> Attribute Properties </b></font></center></td>
</tr>
<tr>
<td> label </td>
<td> HeightMax </td>
</tr>
<tr>
<td> unit </td>
<td> </td>
</tr>
<tr>
<td> standard unit </td>
<td> </td>
</tr>
<tr>
<td> display unit </td>
<td> </td>
</tr>
<tr>
<td> format </td>
<td> </td>
</tr>
<tr>
<td> max_value </td>
<td> </td>
</tr>
<tr>
<td> min_value </td>
<td> </td>
</tr>
<tr>
<td> max_alarm </td>
<td> </td>
</tr>
<tr>
<td> min_alarm </td>
<td> </td>
</tr>
<tr>
<td> max_warning </td>
<td> </td>
</tr>
<tr>
<td> min_warning </td>
<td> </td>
</tr>
<tr>
<td> delta_time </td>
<td> </td>
</tr>
<tr>
<td> delta_val </td>
<td> </td>
</tr>
</table>
</td>
<TD ALIGN="Right" VALIGN=top>
<Table Border=2 Cellpadding=3 CELLSPACING=0>
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=0> <font size=+1> <center><b> Attribute Event Criteria </b></font></center></td>
</tr>
<tr>
<td> Periodic </td>
<td> Not set </td>
</tr>
<tr>
<td> Relative Change </td>
<td> Not set </td>
</tr>
<tr>
<td> Absolute Change </td>
<td> Not set </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td></Tr>
<tr>
<td> Archive Periodic </td>
<td> Not set </td>
</tr>
<tr>
<td> Archive Relative Change </td>
<td> Not set </td>
</tr>
<tr>
<td> Archive Absolute Change </td>
<td> Not set </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td></Tr>
<tr>
<td> Push Change event by user code </td>
<td> false </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td> </Td><Td> </Td></Tr>
<tr>
<td> Push Archive event by user code </td>
<td> false </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td> </Td><Td> </Td></Tr>
<tr>
<td> Push DataReady event by user code </td>
<td> false </td>
</tr>
</table>
</td>
</TR>
</table>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title> FireBird Tango Class Attribute WidthMax </title>
</head>
<body text="Black" bgcolor="White" link="Blue" vlink="Purple" alink="Red">
<br><br><br>
<font size="+1"><u><b> Attribute WidthMax : </b></u></font>
<ul>
maximum width of image size
</ul>
<br><br><br>
<Table Border=0 Cellpadding=0 CELLSPACING=20>
<TR>
<TD ALIGN="left" VALIGN=top>
<Table Border=2 Cellpadding=3 CELLSPACING=0>
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=0> <font size=+1> <center><b> Attribute Definition </b></font></center></td>
</tr>
<tr>
<td> Attribute Type </td>
<td> Scalar </td>
</tr>
<tr>
<td> R/W Type </td>
<td> READ </td>
</tr>
<tr>
<td> Data Type </td>
<td> Tango::DEV_LONG </td>
</tr>
<tr>
<td> Display Level </td>
<td> OPERATOR </td>
</tr>
<tr>
<td> Inherited </td>
<td> false </td>
</tr>
<tr>
<td> Abstract </td>
<td> false </td>
</tr>
<tr>
<td> Polling Period </td>
<td> Not polled </td>
</tr>
<tr>
<td> Memorized </td>
<td> Not set </td>
</tr>
<Tr BGCOLOR="#CCCCFF"><Td><Hr></Td><Td><Hr></Td></Tr>
<tr>
<td> Read allowed for </td>
<td> All states </td>
</tr>
</table>
</td>
<TD ALIGN="Center" VALIGN=top>
<Table Border=2 Cellpadding=3 CELLSPACING=0>
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=0> <font size=+1> <center><b> Attribute Properties </b></font></center></td>
</tr>
<tr>
<td> label </td>
<td> WidthMax </td>
</tr>
<tr>
<td> unit </td>
<td> </td>
</tr>
<tr>
<td> standard unit </td>
<td> </td>
</tr>
<tr>
<td> display unit </td>
<td> </td>
</tr>
<tr>
<td> format </td>
<td> </td>
</tr>
<tr>
<td> max_value </td>
<td> </td>
</tr>
<tr>
<td> min_value </td>
<td> </td>
</tr>
<tr>
<td> max_alarm </td>
<td> </td>
</tr>
<tr>
<td> min_alarm </td>
<td> </td>
</tr>
<tr>
<td> max_warning </td>