Commit b581909c authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

Read the camserver version

parent 703b25ba
...@@ -127,7 +127,7 @@ public: ...@@ -127,7 +127,7 @@ public:
std::string sendAnyCommandAndGetErrorMsg(const std::string& message); std::string sendAnyCommandAndGetErrorMsg(const std::string& message);
int nbAcquiredImages() const; int nbAcquiredImages() const;
void version(int& major,int& minor,int& patch) const;
private: private:
static const double TIME_OUT = 3.; static const double TIME_OUT = 3.;
...@@ -176,6 +176,9 @@ private: ...@@ -176,6 +176,9 @@ private:
int m_nb_acquired_images; int m_nb_acquired_images;
bool m_has_cmd_setenergy; bool m_has_cmd_setenergy;
bool m_pilatus3_threshold_mode; bool m_pilatus3_threshold_mode;
int m_major_version;
int m_minor_version;
int m_patch_version;
}; };
} }
} }
......
...@@ -96,5 +96,6 @@ namespace Pilatus ...@@ -96,5 +96,6 @@ namespace Pilatus
void sendAnyCommand(const std::string& message); void sendAnyCommand(const std::string& message);
int nbAcquiredImages() const; int nbAcquiredImages() const;
void version(int& major /Out/,int& minor /Out/,int& patch /Out/) const;
}; };
}; };
...@@ -109,7 +109,10 @@ Camera::Camera(const char *host,int port) ...@@ -109,7 +109,10 @@ Camera::Camera(const char *host,int port)
m_state(DISCONNECTED), m_state(DISCONNECTED),
m_nb_acquired_images(0), m_nb_acquired_images(0),
m_has_cmd_setenergy(true), m_has_cmd_setenergy(true),
m_pilatus3_threshold_mode(false) m_pilatus3_threshold_mode(false),
m_major_version(-1),
m_minor_version(-1),
m_patch_version(-1)
{ {
DEB_CONSTRUCTOR(); DEB_CONSTRUCTOR();
m_server_ip = host; m_server_ip = host;
...@@ -283,6 +286,7 @@ void Camera::_resync() ...@@ -283,6 +286,7 @@ void Camera::_resync()
send("nexpframe"); send("nexpframe");
send("setackint 0"); send("setackint 0");
send("dbglvl 1"); send("dbglvl 1");
send("version");
} }
//----------------------------------------------------- //-----------------------------------------------------
...@@ -559,6 +563,11 @@ void Camera::_run() ...@@ -559,6 +563,11 @@ void Camera::_run()
m_has_cmd_setenergy = false; m_has_cmd_setenergy = false;
_resync(); _resync();
} }
else if(msg.find("Unrecognized command: version") !=
std::string::npos)
{
DEB_TRACE() << "Can't retrieved camserver version";
}
else else
{ {
DEB_TRACE() << "-- ERROR"; DEB_TRACE() << "-- ERROR";
...@@ -585,6 +594,22 @@ void Camera::_run() ...@@ -585,6 +594,22 @@ void Camera::_run()
DEB_TRACE() << m_error_message; DEB_TRACE() << m_error_message;
} }
} }
else if(msg.substr(0,2) == "24")
{
if(msg.substr(3,2) == "OK" &&
msg.substr(6,12) == "Code release")
{
DEB_TRACE() << msg.substr(6);
std::vector<std::string> version_vector;
_split(msg.substr(20),".",version_vector);
if(version_vector.size() == 3)
{
m_major_version = atoi(version_vector[0].c_str());
m_minor_version = atoi(version_vector[1].c_str());
m_patch_version = atoi(version_vector[2].c_str());
}
}
}
} }
} }
} }
...@@ -1086,5 +1111,14 @@ int Camera::nbAcquiredImages() const ...@@ -1086,5 +1111,14 @@ int Camera::nbAcquiredImages() const
AutoMutex aLock(m_cond.mutex()); AutoMutex aLock(m_cond.mutex());
return m_nb_acquired_images; return m_nb_acquired_images;
} }
//-----------------------------------------------------
//
//-----------------------------------------------------
void Camera::version(int& major,int& minor,int& patch) const
{
major = m_major_version;
minor = m_minor_version;
patch = m_patch_version;
}
//----------------------------------------------------- //-----------------------------------------------------
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