QXRD  0.11.16
Public Slots | Public Member Functions | Static Public Member Functions | Properties | Private Types | Private Member Functions | Private Attributes | List of all members
QxrdDetectorPilatus Class Reference

#include <qxrddetectorpilatus.h>

Inheritance diagram for QxrdDetectorPilatus:
Inheritance graph
[legend]
Collaboration diagram for QxrdDetectorPilatus:
Collaboration graph
[legend]

Public Slots

void startDetector ()
 
void stopDetector ()
 
void beginAcquisition (double exposure)
 
void endAcquisition ()
 
void shutdownAcquisition ()
 
void beginFrame ()
 
void remoteConnect (QString sshCmd)
 
void remoteCommand (QString cmd)
 
void remoteCopy (QString file)
 
void remoteDelete (QString file)
 
void remoteTransfer (QString file)
 
void executeCommand (QString cmd)
 
- Public Slots inherited from QxrdDetector
bool isEnabled ()
 
bool checkDetectorEnabled ()
 
virtual void startDetector ()
 
virtual void stopDetector ()
 
virtual void onExposureTimeChanged ()
 
virtual void beginAcquisition (double exposure)
 
virtual void endAcquisition ()
 
virtual void shutdownAcquisition ()
 
void openControlWindow ()
 
QxrdDetectorProcessorPtr processor ()
 
void startOrStop (bool enabled)
 
virtual void beginFrame ()
 
virtual QcepImageDataBasePtr acquireFrameIfAvailable ()
 
virtual QcepImageDataBasePtr acquireFrame ()
 
int roiCount ()
 
QxrdROICoordinatesPtr roi (int i)
 
QcepDoubleVector scalerCounts ()
 
double scalerCounts (int chan)
 
- Public Slots inherited from QcepObject
virtual void printLine (QString line)
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Public Member Functions

 QxrdDetectorPilatus (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr expt, QxrdAcquisitionWPtr acq, int detNum, QcepObject *parent)
 
virtual ~QxrdDetectorPilatus ()
 
void pushPropertiesToProxy (QxrdDetectorProxyPtr proxy)
 
void pullPropertiesfromProxy (QxrdDetectorProxyPtr proxy)
 
- Public Member Functions inherited from QxrdDetector
 QxrdDetector (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr expt, QxrdAcquisitionWPtr acq, int detType, int detNum, QcepObject *parent)
 
void initialize ()
 
virtual ~QxrdDetector ()
 
QxrdExperimentWPtr experiment ()
 
QxrdAcquisitionWPtr acquisition ()
 
void printMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 
void enqueueAcquiredFrame (QcepImageDataBasePtr img)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
QString get_Name () const
 
void set_Name (QString name)
 

Static Public Member Functions

static void pushDefaultsToProxy (QxrdDetectorProxyPtr proxy)
 
- Static Public Member Functions inherited from QxrdDetector
static QScriptValue toScriptValue (QScriptEngine *engine, const QxrdDetectorPtr &det)
 
static void fromScriptValue (const QScriptValue &obj, QxrdDetectorPtr &det)
 
static void pushDefaultsToProxy (QxrdDetectorProxyPtr proxy, int detType)
 
- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Properties

QString pilatusHost
 
int pilatusPort
 
QString pilatusUser
 
QString pilatusSSH
 
QString pilatusSCP
 
QString pilatusDataDirectory
 
bool readFilesLocally
 
bool deleteFilesAfterReading
 
int exposureMode
 
double enableFrequency
 
QString pilatusExtension
 
- Properties inherited from QxrdDetector
int detectorNumber
 
int detectorType
 
QString detectorTypeName
 
bool enabled
 
QString detectorName
 
int nCols
 
int nRows
 
int hBinning
 
int vBinning
 
QString extension
 
- Properties inherited from QcepObject
QString name
 

Private Types

enum  { NoExternalTrigger, ExternalTrigger, ExternalEnable }
 

Private Member Functions

void beginExposure (double exposure)
 
void interpretReply (QString reply)
 
void expose ()
 
void imagePath (QString path)
 
void sendCommand (QString cmd)
 
void readyRead ()
 
void loadAndPush (QString f)
 

Private Attributes

QTcpSocket m_PilatusSocket
 
QString m_PilatusReply
 
QByteArray m_Buffer
 
QString m_CurrentFile
 
double m_ExposureTime
 
int m_ExposuresPerFrame
 
int m_ExposureFrameCount
 
QxrdDetectorPilatusRemotePtr m_Remote
 

Additional Inherited Members

- Public Types inherited from QxrdDetector
enum  { FileIndexScaler, FilePhaseScaler, ExtraScalers }
 
- Protected Attributes inherited from QxrdDetector
QcepSettingsSaverWPtr m_Saver
 
QxrdExperimentWPtr m_Experiment
 
QxrdAcquisitionWPtr m_Acquisition
 
QxrdDetectorProcessorPtr m_Processor
 
QxrdDetectorControlWindowPtr m_DetectorControlWindow
 

Detailed Description

Definition at line 9 of file qxrddetectorpilatus.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
NoExternalTrigger 
ExternalTrigger 
ExternalEnable 

Definition at line 41 of file qxrddetectorpilatus.h.

Constructor & Destructor Documentation

QxrdDetectorPilatus::QxrdDetectorPilatus ( QcepSettingsSaverWPtr  saver,
QxrdExperimentWPtr  expt,
QxrdAcquisitionWPtr  acq,
int  detNum,
QcepObject parent 
)
explicit

Definition at line 15 of file qxrddetectorpilatus.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

19  :
20  QxrdDetector(saver, expt, acq, QxrdDetectorThread::PilatusDetector, detNum, parent),
22  m_ExposureTime(-1),
26  m_PilatusHost (saver, this, "pilatusHost", "s11id-pilatus", "Host Address of Computer running Camserver"),
27  m_PilatusPort (saver, this, "pilatusPort", 41234, "Camserver Port Number"),
28  m_PilatusUser (saver, this, "pilatusUser", "det", "Camserver User Name"),
29  m_PilatusSSH (saver, this, "pilatusSSH", "ssh", "ssh command path"),
30  m_PilatusSCP (saver, this, "pilatusSCP", "scp", "scp command path"),
31  m_PilatusDataDirectory (saver, this, "pilatusDataDirectory", "/home/det/shareddata/test/", "Data directory on Camserver computer"),
32  m_ReadFilesLocally (saver, this, "readFilesLocally", true, "Attempt to read acquired files into QXRD for further processing"),
33  m_DeleteFilesAfterReading(saver, this, "deleteFilesAfterReading", false, "Delete files from Camserver computer after reading"),
34  m_ExposureMode (saver, this, "exposureMode", 0, "Pilatus Exposure Mode = (0:No Trigger, 1:ExtTrigger, 2:ExtEnable"),
35  m_EnableFrequency (saver, this, "enableFrequency", 1000, "Frequency of ext enable signal"),
36  m_PilatusExtension (saver, this, "pilatusExtension", "cbf", "File format to be used by camserver")
37 {
39  printf("QxrdDetectorPilatus::QxrdDetectorPilatus(%p)\n", this);
40  }
41 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
QxrdDetector(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr expt, QxrdAcquisitionWPtr acq, int detType, int detNum, QcepObject *parent)
QxrdDetectorPilatusRemotePtr m_Remote

Here is the call graph for this function:

QxrdDetectorPilatus::~QxrdDetectorPilatus ( )
virtual

Definition at line 43 of file qxrddetectorpilatus.cpp.

References DEBUG_CONSTRUCTORS, and qcepDebug().

44 {
45 #ifndef QT_NO_DEBUG
46  printf("Deleting Pilatus detector\n");
47 #endif
48 
50  printf("QxrdDetectorPilatus::~QxrdDetectorPilatus(%p)\n", this);
51  }
52 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26

Here is the call graph for this function:

Member Function Documentation

void QxrdDetectorPilatus::beginAcquisition ( double  exposure)
slot

Definition at line 93 of file qxrddetectorpilatus.cpp.

References QxrdDetector::beginAcquisition(), beginExposure(), DEBUG_PILATUS, imagePath(), QxrdDetector::printMessage(), and qcepDebug().

94 {
95  if (QThread::currentThread() != thread()) {
96  QMetaObject::invokeMethod(this, "beginAcquisition", Qt::BlockingQueuedConnection, Q_ARG(double, exposure));
97  } else {
99 
100  if (qcepDebug(DEBUG_PILATUS)) {
101  printMessage(tr("QxrdDetectorPilatus::beginAcquisition(%1)").arg(exposure));
102  }
103 
104  imagePath(get_PilatusDataDirectory());
105 
106  beginExposure(exposure);
107  }
108 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void imagePath(QString path)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void beginExposure(double exposure)
virtual void beginAcquisition(double exposure)

Here is the call graph for this function:

void QxrdDetectorPilatus::beginExposure ( double  exposure)
private

Definition at line 199 of file qxrddetectorpilatus.cpp.

References ExternalEnable, ExternalTrigger, NoExternalTrigger, and sendCommand().

Referenced by beginAcquisition().

200 {
201  int expMode = get_ExposureMode();
202 
203  if (expMode == NoExternalTrigger) {
204  sendCommand(tr("ExpTime %1").arg(exposure));
205  sendCommand("nexpframe 1");
206  } else if (expMode == ExternalTrigger) {
207  sendCommand("Delay 0");
208  sendCommand(tr("ExpPeriod %1").arg(exposure));
209  sendCommand(tr("ExpTime %1").arg(exposure));
210  sendCommand("nexpframe 1");
211  } else if (expMode == ExternalEnable) {
212  int nFrames = (int) (get_EnableFrequency()*exposure);
213  sendCommand(tr("nexpframe %1").arg(nFrames));
214  }
215 }
void sendCommand(QString cmd)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::beginFrame ( )
slot

Definition at line 242 of file qxrddetectorpilatus.cpp.

References QxrdDetector::beginFrame(), DEBUG_PILATUS, expose(), QxrdDetector::printMessage(), and qcepDebug().

243 {
244  if (QThread::currentThread() != thread()) {
245  QMetaObject::invokeMethod(this, "beginFrame", Qt::BlockingQueuedConnection);
246  } else {
247  if (qcepDebug(DEBUG_PILATUS)) {
248  printMessage("QxrdDetectorPilatus::beginFrame");
249  }
250 
252 
253  expose();
254  }
255 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
virtual void beginFrame()

Here is the call graph for this function:

void QxrdDetectorPilatus::endAcquisition ( )
slot

Definition at line 110 of file qxrddetectorpilatus.cpp.

References QxrdDetector::endAcquisition().

111 {
112  if (QThread::currentThread() != thread()) {
113  QMetaObject::invokeMethod(this, "endAcquisition", Qt::BlockingQueuedConnection);
114  } else {
116  }
117 }
virtual void endAcquisition()

Here is the call graph for this function:

void QxrdDetectorPilatus::executeCommand ( QString  cmd)
slot

Definition at line 128 of file qxrddetectorpilatus.cpp.

References sendCommand().

129 {
130  if (QThread::currentThread() != thread()) {
131  QMetaObject::invokeMethod(this, "executeCommand", Qt::BlockingQueuedConnection, Q_ARG(QString, cmd));
132  } else {
133  sendCommand(cmd);
134  }
135 }
void sendCommand(QString cmd)

Here is the call graph for this function:

void QxrdDetectorPilatus::expose ( )
private

Definition at line 217 of file qxrddetectorpilatus.cpp.

References ExternalEnable, ExternalTrigger, QxrdDetector::m_Acquisition, m_CurrentFile, NoExternalTrigger, and sendCommand().

Referenced by beginFrame().

218 {
220 
221  if (acq) {
222  m_CurrentFile = acq->currentFileBase(get_DetectorNumber(), get_PilatusExtension());
223 
224  if (get_ReadFilesLocally()) { // Check to see if file exists...
225  if (get_DeleteFilesAfterReading()) {
226  // Attempt to delete file before acquisition...
227  }
228  }
229 
230  int expMode = get_ExposureMode();
231 
232  if (expMode == NoExternalTrigger) {
233  sendCommand(tr("Exposure \"%1\"").arg(m_CurrentFile));
234  } else if (expMode == ExternalTrigger) {
235  sendCommand(tr("ExtTrigger \"%1\"").arg(m_CurrentFile));
236  } else if (expMode == ExternalEnable) {
237  sendCommand(tr("ExtEnable \"%1\"").arg(m_CurrentFile));
238  }
239  }
240 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr m_Acquisition
Definition: qxrddetector.h:94
void sendCommand(QString cmd)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::imagePath ( QString  path)
private

Definition at line 192 of file qxrddetectorpilatus.cpp.

References QxrdDetector::checkDetectorEnabled(), and sendCommand().

Referenced by beginAcquisition(), and startDetector().

193 {
194  if (checkDetectorEnabled()) {
195  sendCommand(tr("imgpath \"%1\"").arg(path));
196  }
197 }
bool checkDetectorEnabled()
void sendCommand(QString cmd)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::interpretReply ( QString  reply)
private

Definition at line 257 of file qxrddetectorpilatus.cpp.

References QxrdDetector::criticalMessage(), DEBUG_PILATUS, QxrdDetector::enqueueAcquiredFrame(), loadAndPush(), m_CurrentFile, QxrdDetector::printMessage(), qcepDebug(), remoteCopy(), and remoteDelete().

Referenced by readyRead().

258 {
259  if (qcepDebug(DEBUG_PILATUS)) {
260  printMessage(tr("QxrdDetectorPilatus::interpretReply(\"%1\")").arg(reply));
261  }
262 
263  if (reply.startsWith("1 ERR")) {
264  criticalMessage(tr("Error with pilatus detector: %1").arg(reply));
265  } else if (reply.startsWith("7 OK")) { // Image has been saved...
266  if (get_ReadFilesLocally() == false) {
268  } else {
270 // pushFileExpected(m_CurrentFile);
272 
273  if (get_DeleteFilesAfterReading()) {
275  }
276  }
277  } else if (reply.startsWith("Image format:")) {
278  QRegExp matcher("Image format\\: (\\d+)\\(w\\) x (\\d+)\\(h\\) pixels(.*)");
279 
280  if (matcher.exactMatch(reply)) {
281  int width = matcher.cap(1).toInt();
282  int height = matcher.cap(2).toInt();
283 
284  printMessage(tr("Detector dimensions %1 cols x %2 rows").arg(width).arg(height));
285 
286  set_NRows(height);
287  set_NCols(width);
288  set_HBinning(1);
289  set_VBinning(1);
290  } else {
291  printMessage(tr("Unmatched: %1, %2").arg(reply).arg(matcher.pattern()));
292  printMessage(tr("Matched Length %1").arg(matcher.matchedLength()));
293  }
294  }
295 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void enqueueAcquiredFrame(QcepImageDataBasePtr img)
void remoteCopy(QString file)
QSharedPointer< QcepInt16ImageData > QcepInt16ImageDataPtr
void remoteDelete(QString file)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::loadAndPush ( QString  f)
private

Definition at line 442 of file qxrddetectorpilatus.cpp.

References QcepAllocator::AllocateFromReserve, QxrdDetector::enqueueAcquiredFrame(), QxrdDetector::m_Experiment, QcepAllocator::newInt32Image(), and QxrdDetector::printMessage().

Referenced by interpretReply().

443 {
445 
446  if (expt) {
447  QxrdDataProcessorPtr proc = expt->dataProcessor();
448 
449  if (proc) {
450  QString dest = proc->filePathInRawOutputDirectory(f);
451 
453 
454  if (data->readImage(dest)) {
455  printMessage(tr("Read %1 successfully").arg(dest));
456  }
457 
458  enqueueAcquiredFrame(data);
459  }
460  }
461 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
Definition: qxrddetector.h:93
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void enqueueAcquiredFrame(QcepImageDataBasePtr img)
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
static QcepInt32ImageDataPtr newInt32Image(AllocationStrategy strat, int width, int height, QcepObject *parent)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::pullPropertiesfromProxy ( QxrdDetectorProxyPtr  proxy)
virtual

Reimplemented from QxrdDetector.

Definition at line 335 of file qxrddetectorpilatus.cpp.

References QxrdDetector::pullPropertiesfromProxy().

336 {
338 
339  if (proxy) {
340  set_PilatusHost (proxy->property("pilatusHost").toString());
341  set_PilatusUser (proxy->property("pilatusUser").toString());
342  set_PilatusSSH (proxy->property("pilatusSSH").toString());
343  set_PilatusSCP (proxy->property("pilatusSCP").toString());
344  set_PilatusDataDirectory (proxy->property("pilatusDataDirectory").toString());
345  set_ReadFilesLocally (proxy->property("readFilesLocally").toBool());
346  set_DeleteFilesAfterReading(proxy->property("deleteFilesAfterReading").toBool());
347  set_PilatusExtension (proxy->property("pilatusExtension").toString());
348  set_ExposureMode (proxy->property("exposureMode").toInt());
349  set_EnableFrequency (proxy->property("enableFrequency").toDouble());
350  }
351 }
virtual void pullPropertiesfromProxy(QxrdDetectorProxyPtr proxy)

Here is the call graph for this function:

void QxrdDetectorPilatus::pushDefaultsToProxy ( QxrdDetectorProxyPtr  proxy)
static

Definition at line 297 of file qxrddetectorpilatus.cpp.

References QxrdDetectorProxy::BooleanProperty, QxrdDetectorProxy::DirectoryProperty, QxrdDetectorProxy::DoubleProperty, QxrdDetectorProxy::ExtensionProperty, QxrdDetectorProxy::FilenameProperty, QxrdDetectorProxy::FixedIntegerProperty, QxrdDetectorThread::PilatusDetector, QxrdDetectorProxy::PilatusModeProperty, QxrdDetector::pushDefaultsToProxy(), and QxrdDetectorProxy::StringProperty.

Referenced by QxrdDetectorThread::pushDefaultsToProxy().

298 {
300 
301  if (proxy) {
302  proxy->pushProperty(QxrdDetectorProxy::StringProperty, "pilatusHost", "Camserver Host", "s11id-pilatus");
303  proxy->pushProperty(QxrdDetectorProxy::FixedIntegerProperty, "pilatusPort", "Camserver Port", 41234);
304  proxy->pushProperty(QxrdDetectorProxy::StringProperty, "pilatusUser", "Camserver User", "det");
305  proxy->pushProperty(QxrdDetectorProxy::FilenameProperty, "pilatusSSH", "ssh command", "ssh");
306  proxy->pushProperty(QxrdDetectorProxy::FilenameProperty, "pilatusSCP", "scp command", "scp");
307  proxy->pushProperty(QxrdDetectorProxy::DirectoryProperty, "pilatusDataDirectory", "Camserver Data Directory", "/home/det/shareddata/test/");
308  proxy->pushProperty(QxrdDetectorProxy::BooleanProperty, "readFilesLocally", "Attempt to read acquired files into QXRD for further processing", true);
309  proxy->pushProperty(QxrdDetectorProxy::BooleanProperty, "deleteFilesAfterReading", "Delete files from camserver computer after use", false);
310  proxy->pushProperty(QxrdDetectorProxy::ExtensionProperty, "pilatusExtension", "File format for camserver", "cbf");
311  proxy->pushProperty(QxrdDetectorProxy::PilatusModeProperty, "exposureMode", "Pilatus Exposure Mode", 0);
312  proxy->pushProperty(QxrdDetectorProxy::DoubleProperty, "enableFrequency", "Ext Enable Frequency", 1000);
313  }
314 }
static void pushDefaultsToProxy(QxrdDetectorProxyPtr proxy, int detType)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::pushPropertiesToProxy ( QxrdDetectorProxyPtr  proxy)
virtual

Reimplemented from QxrdDetector.

Definition at line 316 of file qxrddetectorpilatus.cpp.

References QxrdDetectorProxy::BooleanProperty, QxrdDetectorProxy::DirectoryProperty, QxrdDetectorProxy::DoubleProperty, QxrdDetectorProxy::ExtensionProperty, QxrdDetectorProxy::FilenameProperty, QxrdDetectorProxy::FixedIntegerProperty, QxrdDetectorProxy::PilatusModeProperty, QxrdDetector::pushPropertiesToProxy(), and QxrdDetectorProxy::StringProperty.

317 {
319 
320  if (proxy) {
321  proxy->pushProperty(QxrdDetectorProxy::StringProperty, "pilatusHost", "Camserver Host", get_PilatusHost());
322  proxy->pushProperty(QxrdDetectorProxy::FixedIntegerProperty, "pilatusPort", "Camserver Port", get_PilatusPort());
323  proxy->pushProperty(QxrdDetectorProxy::StringProperty, "pilatusUser", "Camserver User", get_PilatusUser());
324  proxy->pushProperty(QxrdDetectorProxy::FilenameProperty, "pilatusSSH", "ssh command", get_PilatusSSH());
325  proxy->pushProperty(QxrdDetectorProxy::FilenameProperty, "pilatusSCP", "scp command", get_PilatusSCP());
326  proxy->pushProperty(QxrdDetectorProxy::DirectoryProperty, "pilatusDataDirectory", "Camserver Data Directory", get_PilatusDataDirectory());
327  proxy->pushProperty(QxrdDetectorProxy::BooleanProperty, "readFilesLocally", "Attempt to read acquired files into QXRD for further processing", get_ReadFilesLocally());
328  proxy->pushProperty(QxrdDetectorProxy::BooleanProperty, "deleteFilesAfterReading", "Delete files from camserver computer after use", get_DeleteFilesAfterReading());
329  proxy->pushProperty(QxrdDetectorProxy::ExtensionProperty, "pilatusExtension", "File format for camserver", get_PilatusExtension());
330  proxy->pushProperty(QxrdDetectorProxy::PilatusModeProperty, "exposureMode", "Pilatus Exposure Mode", get_ExposureMode());
331  proxy->pushProperty(QxrdDetectorProxy::DoubleProperty, "enableFrequency", "Ext Enable Frequency", get_EnableFrequency());
332  }
333 }
virtual void pushPropertiesToProxy(QxrdDetectorProxyPtr proxy)

Here is the call graph for this function:

void QxrdDetectorPilatus::readyRead ( )
private

Definition at line 137 of file qxrddetectorpilatus.cpp.

References DEBUG_PILATUS, interpretReply(), m_Buffer, m_PilatusSocket, QxrdDetector::printMessage(), and qcepDebug().

Referenced by startDetector().

138 {
139  if (qcepDebug(DEBUG_PILATUS)) {
140  printMessage("QxrdDetectorPilatus::readyRead");
141 
142  printMessage(tr("%1 bytes available").arg(m_PilatusSocket.bytesAvailable()));
143  }
144 
145  m_Buffer.append(m_PilatusSocket.readAll());
146 
147  while(1) {
148  int ind1 = m_Buffer.indexOf('\n');
149  int ind2 = m_Buffer.indexOf(char(24));
150 
151  int ind = ind1;
152 
153  if (ind1 >= 0 && ind2 >= 0) {
154  if (ind1 < ind2) {
155  ind = ind1;
156  } else {
157  ind = ind2;
158  }
159  } else if (ind1 >= 0) {
160  ind = ind1;
161  } else {
162  ind = ind2;
163  }
164 
165  if (ind >= 0) {
166  QString line = m_Buffer.left(ind); // Don't include newline
167  m_Buffer.remove(0, ind+1);
168 
169  if (qcepDebug(DEBUG_PILATUS)) {
170  printMessage(tr("(%1) : \"%2\"").arg(line.count()).arg(QString(line)));
171  }
172 
173  interpretReply(line);
174  } else { // No new lines when expected
175  return;
176  }
177  }
178 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void interpretReply(QString reply)

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::remoteCommand ( QString  cmd)
slot

Definition at line 364 of file qxrddetectorpilatus.cpp.

References m_Remote.

Referenced by remoteTransfer().

365 {
366  if (QThread::currentThread() != thread()) {
367  QMetaObject::invokeMethod(this, "remoteCommand", Q_ARG(QString, cmd));
368  } else {
369  if (m_Remote) {
370  m_Remote->executeRemote(cmd);
371  }
372  }
373 }
QxrdDetectorPilatusRemotePtr m_Remote

Here is the caller graph for this function:

void QxrdDetectorPilatus::remoteConnect ( QString  sshCmd)
slot

Definition at line 353 of file qxrddetectorpilatus.cpp.

References m_Remote.

354 {
355  if (QThread::currentThread() != thread()) {
356  QMetaObject::invokeMethod(this, "remoteConnect", Q_ARG(QString, sshCmd));
357  } else {
358  if (m_Remote) {
359  m_Remote->connectToRemote(sshCmd);
360  }
361  }
362 }
QxrdDetectorPilatusRemotePtr m_Remote
void QxrdDetectorPilatus::remoteCopy ( QString  file)
slot

Definition at line 394 of file qxrddetectorpilatus.cpp.

References DEBUG_PILATUS, QxrdDetector::m_Experiment, QxrdDetector::printMessage(), and qcepDebug().

Referenced by interpretReply().

395 {
397 
398  if (expt) {
399  QxrdDataProcessorPtr proc = expt->dataProcessor();
400 
401  if (proc) {
402  QString dest = proc->filePathInRawOutputDirectory(file);
403 
404  QString cmd = tr("%1 -o ForwardX11=No %2@%3:%4/%5 %6")
405  .arg(get_PilatusSCP())
406  .arg(get_PilatusUser())
407  .arg(get_PilatusHost())
408  .arg(get_PilatusDataDirectory()).arg(file)
409  .arg(dest);
410 
411  if (qcepDebug(DEBUG_PILATUS)) {
412  printMessage(cmd);
413  }
414 
415  int rc = QProcess::execute(cmd);
416 
417  if (rc) {
418  printMessage(tr("rc = %1").arg(rc));
419  }
420  }
421  }
422 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
Definition: qxrddetector.h:93
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::remoteDelete ( QString  file)
slot

Definition at line 375 of file qxrddetectorpilatus.cpp.

References DEBUG_PILATUS, QxrdDetector::printMessage(), and qcepDebug().

Referenced by interpretReply().

376 {
377  QString cmd = tr("%1 -o ForwardX11=No %2@%3 rm %4/%5")
378  .arg(get_PilatusSSH())
379  .arg(get_PilatusUser())
380  .arg(get_PilatusHost())
381  .arg(get_PilatusDataDirectory()).arg(file);
382 
383  if (qcepDebug(DEBUG_PILATUS)) {
384  printMessage(tr("Deleting: %1").arg(cmd));
385  }
386 
387  int rc = QProcess::execute(cmd);
388 
389  if (rc) {
390  printMessage(tr("rc = %1").arg(rc));
391  }
392 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::remoteTransfer ( QString  file)
slot

Definition at line 424 of file qxrddetectorpilatus.cpp.

References QxrdDetector::m_Experiment, and remoteCommand().

425 {
426  // Transfer contents of a remote file to a local memory buffer:"
427 
429 
430  if (expt) {
431  QxrdDataProcessorPtr proc = expt->dataProcessor();
432 
433  if (proc) {
434  QString dest = proc->filePathInRawOutputDirectory(file);
435 
436  remoteCommand(tr("echo -n transfer: ; ls -la %1").arg(file));
437  remoteCommand(tr("cat %1").arg(file));
438  }
439  }
440 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr m_Experiment
Definition: qxrddetector.h:93
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void remoteCommand(QString cmd)

Here is the call graph for this function:

void QxrdDetectorPilatus::sendCommand ( QString  cmd)
private

Definition at line 180 of file qxrddetectorpilatus.cpp.

References DEBUG_PILATUS, m_PilatusSocket, QxrdDetector::printMessage(), qcepDebug(), and THREAD_CHECK.

Referenced by beginExposure(), executeCommand(), expose(), imagePath(), and startDetector().

181 {
182  THREAD_CHECK;
183 
184  if (qcepDebug(DEBUG_PILATUS)) {
185  printMessage(tr("QxrdDetectorPilatus::sendCommand(\"%1\")").arg(cmd));
186  }
187 
188  m_PilatusSocket.write(qPrintable(cmd+"\n"));
189  m_PilatusSocket.waitForBytesWritten();
190 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
#define THREAD_CHECK
Definition: qcepmacros.h:11

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdDetectorPilatus::shutdownAcquisition ( )
slot

Definition at line 119 of file qxrddetectorpilatus.cpp.

References QxrdDetector::shutdownAcquisition().

120 {
121  if (QThread::currentThread() != thread()) {
122  QMetaObject::invokeMethod(this, "shutdownAcquisition", Qt::BlockingQueuedConnection);
123  } else {
125  }
126 }
virtual void shutdownAcquisition()

Here is the call graph for this function:

void QxrdDetectorPilatus::startDetector ( )
slot

Definition at line 54 of file qxrddetectorpilatus.cpp.

References DEBUG_PILATUS, imagePath(), m_PilatusSocket, QxrdDetector::printMessage(), qcepDebug(), readyRead(), sendCommand(), and QxrdDetector::startDetector().

55 {
56  if (QThread::currentThread() != thread()) {
57  QMetaObject::invokeMethod(this, "startDetector"/*, Qt::BlockingQueuedConnection*/);
58  } else {
60 
61  printMessage(tr("Starting Pilatus Detector at %1:%2").arg(get_PilatusHost()).arg(get_PilatusPort()));
62 
63  m_PilatusSocket.connectToHost(get_PilatusHost(), get_PilatusPort());
64  m_PilatusSocket.waitForConnected();
65 
66  if (qcepDebug(DEBUG_PILATUS)) {
67  printMessage("Connected to pilatus...");
68  }
69 
70  connect(&m_PilatusSocket, &QTcpSocket::readyRead, this, &QxrdDetectorPilatus::readyRead);
71 
72  sendCommand("telemetry");
73  sendCommand("nimages 1");
74  sendCommand("nexpframe 1");
75 
76  imagePath(get_PilatusDataDirectory());
77  }
78 }
qint64 qcepDebug(int cond)
Definition: qcepdebug.cpp:26
void imagePath(QString path)
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void sendCommand(QString cmd)
virtual void startDetector()

Here is the call graph for this function:

void QxrdDetectorPilatus::stopDetector ( )
slot

Definition at line 80 of file qxrddetectorpilatus.cpp.

References m_PilatusSocket, QxrdDetector::printMessage(), and QxrdDetector::stopDetector().

81 {
82  if (QThread::currentThread() != thread()) {
83  QMetaObject::invokeMethod(this, "stopDetector");
84  } else {
86 
87  printMessage(tr("Stopping Pilatus Detector at %1").arg(get_PilatusHost()));
88 
89  m_PilatusSocket.close();
90  }
91 }
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
virtual void stopDetector()

Here is the call graph for this function:

Member Data Documentation

QByteArray QxrdDetectorPilatus::m_Buffer
private

Definition at line 63 of file qxrddetectorpilatus.h.

Referenced by readyRead().

QString QxrdDetectorPilatus::m_CurrentFile
private

Definition at line 64 of file qxrddetectorpilatus.h.

Referenced by expose(), and interpretReply().

int QxrdDetectorPilatus::m_ExposureFrameCount
private

Definition at line 68 of file qxrddetectorpilatus.h.

int QxrdDetectorPilatus::m_ExposuresPerFrame
private

Definition at line 67 of file qxrddetectorpilatus.h.

double QxrdDetectorPilatus::m_ExposureTime
private

Definition at line 66 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::m_PilatusReply
private

Definition at line 62 of file qxrddetectorpilatus.h.

QTcpSocket QxrdDetectorPilatus::m_PilatusSocket
private

Definition at line 61 of file qxrddetectorpilatus.h.

Referenced by readyRead(), sendCommand(), startDetector(), and stopDetector().

QxrdDetectorPilatusRemotePtr QxrdDetectorPilatus::m_Remote
private

Definition at line 70 of file qxrddetectorpilatus.h.

Referenced by remoteCommand(), and remoteConnect().

Property Documentation

bool QxrdDetectorPilatus::deleteFilesAfterReading
readwrite

Definition at line 94 of file qxrddetectorpilatus.h.

double QxrdDetectorPilatus::enableFrequency
readwrite

Definition at line 100 of file qxrddetectorpilatus.h.

int QxrdDetectorPilatus::exposureMode
readwrite

Definition at line 97 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::pilatusDataDirectory
readwrite

Definition at line 88 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::pilatusExtension
readwrite

Definition at line 103 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::pilatusHost
readwrite

Definition at line 73 of file qxrddetectorpilatus.h.

int QxrdDetectorPilatus::pilatusPort
readwrite

Definition at line 76 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::pilatusSCP
readwrite

Definition at line 85 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::pilatusSSH
readwrite

Definition at line 82 of file qxrddetectorpilatus.h.

QString QxrdDetectorPilatus::pilatusUser
readwrite

Definition at line 79 of file qxrddetectorpilatus.h.

bool QxrdDetectorPilatus::readFilesLocally
readwrite

Definition at line 91 of file qxrddetectorpilatus.h.


The documentation for this class was generated from the following files: