Commit 17ba1341 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

Merge branch 'http_port' into 'master'

Configurable detector http and zmq ports

Closes #3

See merge request !9
parents b93b54a0 0bbc1371
Pipeline #25720 passed with stages
in 4 minutes and 9 seconds
......@@ -27,6 +27,7 @@ requirements:
build:
- git
- cmake
- make
- {{ compiler('cxx') }}
run:
- python {{ python }}
......
......@@ -19,6 +19,7 @@ build:
requirements:
build:
- cmake
- make
- git
- lima-core
run:
......
......@@ -11,6 +11,8 @@ Properties
Property name Mandatory Default value Description
==================== =============== =============== =========================================================================
detector_ip_address Yes N/A The ip address or the hostname of the detector computer interface
http_port No 80 The http port number for control API
stream_port No 9999 The port number for the data stream API
==================== =============== =============== =========================================================================
......@@ -20,12 +22,21 @@ Attributes
Attribute name RW Type Description
========================= ======= ======================= ======================================================================
auto_summation rw DevString If enable image depth is bpp32 and, if not image depth is bpp16 **(\*)**
cam_status ro DevString The internal camera status
compression_type rw DevString For data stream, supported compression are:
- NONE
- LZ4
- BSLZ4
countrate_correction rw DevString Enable or disable the countrate correction **(\*)**
efficency_correction rw DevString Enable the efficienty correction
flatfield_correction rw DevString Enable or disable the internal (vs. lima) flatfield correction **(\*)**
humidity ro DevFloat Return the humidity percentage
pixel_mask rw DevString Enable or disable the pixel mask correction **(\*)**
photon_energy rw DevFloat The photon energy,it should be set to the incoming beam energy. Actually it’s an helper which set the threshold
plugin_status ro DevString The camera plugin status
serie_id ro DevLong The current acquisition serie identifier
stream_last_info ro DevString Information on data stream, encoding, frame_dim and packed_size
stream_stats ro DevDouble ave_size, ave_time, ave_speed
threshold_energy rw DevFloat The threshold energy, it will set the camera detection threshold. This should be set between 50 to 60 % of the incoming beam energy.
temperature ro DevFloat The sensor temperature
virtual_pixel_correction rw DevString Enable or disable the virtual-pixel correction **(\*)**
......@@ -42,6 +53,11 @@ Commands
Command name Arg. in Arg. out Description
======================= =============== ======================= ===========================================
deleteMemoryFiles DevVoid DevVoid To remove the temporary mem. files
initialize DevVoid DevVoid To initialize the detector
latchStreamStatistics DevBoolean DevVarDoubleArray: If True, reset the statistics
- ave_size,
- ave_time,
- ave_speed
Init DevVoid DevVoid Do not use
State DevVoid DevLong Return the device state
Status DevVoid DevString Return the device state as a string
......
......@@ -73,7 +73,7 @@ class LIBEIGER Camera : public HwMaxImageSizeCallbackGen, public EventCallbackGe
enum Status { Initializing, Ready, Armed, Exposure, Fault };
enum CompressionType {NoCompression,LZ4,BSLZ4};
Camera(const std::string& detector_ip);
Camera(const std::string& host, int http_port=80, int stream_port=9999);
~Camera();
void initialize();
......@@ -159,7 +159,8 @@ class LIBEIGER Camera : public HwMaxImageSizeCallbackGen, public EventCallbackGe
void deleteMemoryFiles();
void disarm();
const std::string& getDetectorIp() const;
const std::string& getDetectorHost() const;
int getDetectorStreamPort() const;
private:
friend class Interface;
......@@ -249,7 +250,9 @@ class LIBEIGER Camera : public HwMaxImageSizeCallbackGen, public EventCallbackGe
double m_readout_time;
double m_x_pixelsize, m_y_pixelsize;
Cond m_cond;
std::string m_detector_ip;
std::string m_detector_host;
int m_detector_http_port;
int m_detector_stream_port;
double m_min_frame_time;
CompressionType m_compression_type;
};
......
......@@ -32,7 +32,7 @@ namespace Eiger
enum Status { Initializing, Ready, Armed, Exposure, Fault };
enum CompressionType {NoCompression,LZ4,BSLZ4};
Camera(const std::string& detector_ip);
Camera(const std::string& detector_ip, int http_port = 80, int stream_port = 9999) /KeywordArgs="Optional"/;
~Camera();
void initialize();
......
......@@ -101,7 +101,7 @@ private:
//-----------------------------------------------------------------------------
/// Ctor
//-----------------------------------------------------------------------------
Camera::Camera(const std::string& detector_ip) ///< [in] Ip address of the detector server
Camera::Camera(const std::string& host, int http_port, int stream_port) ///< [in] Ip address of the detector server
: m_frames_triggered(0),
m_frames_acquired(0),
m_latency_time(0.),
......@@ -110,12 +110,16 @@ Camera::Camera(const std::string& detector_ip) ///< [in] Ip address of the dete
m_trigger_state(IDLE),
m_armed(false),
m_serie_id(0),
m_requests(new Requests(detector_ip)),
m_exp_time(1.),
m_detector_ip(detector_ip)
m_detector_host(host),
m_detector_http_port(http_port),
m_detector_stream_port(stream_port)
{
DEB_CONSTRUCTOR();
DEB_PARAM() << DEB_VAR1(detector_ip);
DEB_PARAM() << DEB_VAR1(host);
std::string http_address = host + ":" + std::to_string(http_port);
m_requests = new Requests(http_address);
// Detect EigerAPI version
std::string api_version = m_requests->get_api_version();
......@@ -1170,7 +1174,13 @@ void Camera::disarm()
sendCommand(Requests::DISARM);
}
const std::string& Camera::getDetectorIp() const
const std::string& Camera::getDetectorHost() const
{
return m_detector_ip;
return m_detector_host;
}
int Camera::getDetectorStreamPort() const
{
return m_detector_stream_port;
}
......@@ -263,7 +263,8 @@ void Stream::_ZmqThread::_run_sequence()
char stream_endpoint[256];
snprintf(stream_endpoint,sizeof(stream_endpoint),
"tcp://%s:9999",cam.getDetectorIp().c_str());
"tcp://%s:%d",cam.getDetectorHost().c_str(),
cam.getDetectorStreamPort());
if(zmq_connect(stream_socket,stream_endpoint) != 0) {
char error_buffer[256];
const char *error_msg = strerror_r(errno,error_buffer,sizeof(error_buffer));
......
......@@ -197,6 +197,12 @@ class EigerClass(PyTango.DeviceClass):
'detector_ip_address':
[PyTango.DevString,
"Detector ip address",[]],
'http_port':
[PyTango.DevLong,
"HTTP port number",[]],
'stream_port':
[PyTango.DevLong,
"Stream port number",[]],
}
......@@ -309,7 +315,12 @@ def get_control(detector_ip_address = "0", **keys) :
global _EigerInterface
global _EigerCamera
if _EigerInterface is None:
_EigerCamera = EigerAcq.Camera(detector_ip_address)
http_port = keys.pop('http_port', 80)
stream_port = keys.pop('stream_port', 9999)
_EigerCamera = EigerAcq.Camera(detector_ip_address,
http_port=http_port,
stream_port=stream_port)
_EigerInterface = EigerAcq.Interface(_EigerCamera)
return Core.CtControl(_EigerInterface)
......
Markdown is supported
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