qavrg 0.0.28
|
#include <qavrgfillpattern.h>
Signals | |
void | fillPatternChanged () |
Public Member Functions | |
QavrgFillPattern (QavrgEpicsInterface *ifc) | |
~QavrgFillPattern () | |
void | valueChanged (struct event_handler_args args) |
QVector< bool > | fillPattern () |
int | filledBunch (int n) |
Private Attributes | |
QavrgEpicsInterface * | m_EpicsInterface |
chid | m_Ch |
QVector< bool > | m_FillPattern |
long | m_Magic |
Definition at line 11 of file qavrgfillpattern.h.
QavrgFillPattern::QavrgFillPattern | ( | QavrgEpicsInterface * | ifc | ) |
Definition at line 10 of file qavrgfillpattern.cpp.
References connectionChanged(), and m_Ch.
: QObject(), m_EpicsInterface(ifc), m_FillPattern(), // m_FillSignature(QCryptographicHash::Sha1), m_Magic(MAGIC_VALUE) { int stat; stat = ca_create_channel("Mt:S:FillPatternWF",::connectionChanged, this, CA_PRIORITY_DEFAULT, &m_Ch); if (stat != ECA_NORMAL) { printf("ca_create_channel failed:\n%s\n",ca_message(stat)); } ca_set_puser(m_Ch, this); }
QavrgFillPattern::~QavrgFillPattern | ( | ) |
int QavrgFillPattern::filledBunch | ( | int | n | ) |
Definition at line 128 of file qavrgfillpattern.cpp.
References m_FillPattern.
{ int nfilled = 0; int i; int nf = m_FillPattern.count(); for (i=0; i<nf; i++) { if (m_FillPattern.value(i)) { nfilled++; if (nfilled == n) { return i; } } } return -1; }
QVector< bool > QavrgFillPattern::fillPattern | ( | ) |
Definition at line 116 of file qavrgfillpattern.cpp.
References m_FillPattern.
{ QVector<bool> res; double v; foreach(v, m_FillPattern) { res.append(v); } return res; }
void QavrgFillPattern::fillPatternChanged | ( | ) | [signal] |
Referenced by valueChanged().
void QavrgFillPattern::valueChanged | ( | struct event_handler_args | args | ) |
Definition at line 75 of file qavrgfillpattern.cpp.
References fillPatternChanged(), m_FillPattern, m_Magic, and MAGIC_VALUE.
Referenced by valueChanged().
{ if (m_Magic != MAGIC_VALUE) { printf("Bad magic value\n"); } if (args.status == ECA_NORMAL && args.dbr) { char* p = (char*) args.dbr; chid pCh = args.chid; int nelem = ca_element_count(pCh); m_FillPattern.resize(0); int first = true; for (int i=0; i<nelem; i++) { m_FillPattern.append(p[i]); if (p[i]) { if (first) { printf("Fill: %d", i); first = false; } else { printf(", %d", i); } } } printf("\n"); // m_FillSignature.reset(); // m_FillSignature.addData(m_FillPattern); // printf("Fill Pattern Signature: %s\n", (const char*) m_FillSignature.result().toHex()); emit fillPatternChanged(); } else { printf("Bad value\n"); } }
chid QavrgFillPattern::m_Ch [private] |
Definition at line 29 of file qavrgfillpattern.h.
Referenced by QavrgFillPattern(), and ~QavrgFillPattern().
Definition at line 28 of file qavrgfillpattern.h.
QVector<bool> QavrgFillPattern::m_FillPattern [private] |
Definition at line 30 of file qavrgfillpattern.h.
Referenced by filledBunch(), fillPattern(), and valueChanged().
long QavrgFillPattern::m_Magic [private] |
Definition at line 32 of file qavrgfillpattern.h.
Referenced by valueChanged().