qmca  0.0.20
Public Slots | Signals | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
EpicsBoolean Class Reference

#include <epicsboolean.h>

Inheritance diagram for EpicsBoolean:
Inheritance graph

Public Slots

void changeValue (bool val)
 
void set ()
 
void clear ()
 
void caput (bool val)
 

Signals

void valueChanged (bool val)
 
- Signals inherited from EpicsObject
void valueChanged ()
 

Public Member Functions

 EpicsBoolean (QString pvName, QObject *parent=0, int debug=0)
 
virtual ~EpicsBoolean ()
 
void changeConnection (QString pv)
 
bool value ()
 
- Public Member Functions inherited from EpicsObject
 EpicsObject (QString pvName, QObject *parent=0, int debug=0)
 
virtual ~EpicsObject ()
 
void changeConnection (QString pv)
 
int count ()
 
QString pvName ()
 
QString toolTip ()
 
virtual void connected ()
 
virtual void disconnected ()
 
chid channelID ()
 
int debug ()
 
void setDebug (int dbg)
 
void settle (double t)
 
void ca_pend_io (double t)
 

Private Member Functions

virtual caEventCallBackFunc * get_event_handler ()
 

Static Private Member Functions

static void event_handler (struct event_handler_args arg)
 

Private Attributes

bool m_Value
 

Additional Inherited Members

- Static Public Attributes inherited from EpicsObject
static QMutex m_Mutex
 
- Protected Attributes inherited from EpicsObject
chid m_ChannelID
 
evid m_EventID
 
bool m_HasEventHandler
 
int m_Debug
 

Detailed Description

Definition at line 7 of file epicsboolean.h.

Constructor & Destructor Documentation

EpicsBoolean::EpicsBoolean ( QString  pvName,
QObject *  parent = 0,
int  debug = 0 
)

Definition at line 5 of file epicsboolean.cpp.

6  : EpicsObject(pvName, parent, debug),
7  m_Value(0)
8 {
9 }
QString pvName()
Definition: epicsobject.cpp:30
EpicsObject(QString pvName, QObject *parent=0, int debug=0)
Definition: epicsobject.cpp:7
EpicsBoolean::~EpicsBoolean ( )
virtual

Definition at line 11 of file epicsboolean.cpp.

12 {
13 }

Member Function Documentation

void EpicsBoolean::caput ( bool  val)
slot

Definition at line 79 of file epicsboolean.cpp.

References EpicsObject::ca_pend_io(), and EpicsObject::channelID().

Referenced by clear(), set(), and EpicsA2DConverter::setCoincidence().

80 {
81  int nval = val;
82 
83  ca_put(DBR_INT, channelID(), &nval);
84  ca_pend_io(0.5);
85 }
chid channelID()
Definition: epicsobject.cpp:63
void ca_pend_io(double t)
void EpicsBoolean::changeConnection ( QString  pv)
void EpicsBoolean::changeValue ( bool  val)
slot

Definition at line 64 of file epicsboolean.cpp.

References EpicsObject::m_Mutex, m_Value, and EpicsObject::valueChanged().

Referenced by event_handler().

65 {
66 // printf("ca_put(%d,%p,%g)\n", DBR_INT, channelID(), newval);
67 
68 // ca_put(DBR_INT, channelID(), &newval);
69 
70  QMutexLocker lock(&m_Mutex);
71 
72  if (m_Value != newval) {
73 
74  m_Value = newval;
75  emit valueChanged(m_Value);
76  }
77 }
void valueChanged()
static QMutex m_Mutex
Definition: epicsobject.h:42
void EpicsBoolean::clear ( )
slot

Definition at line 20 of file epicsboolean.cpp.

References caput().

21 {
22  caput(false);
23 }
void caput(bool val)
void EpicsBoolean::event_handler ( struct event_handler_args  arg)
staticprivate

Definition at line 25 of file epicsboolean.cpp.

References changeValue().

Referenced by get_event_handler().

26 {
27  union db_access_val *pb = (union db_access_val *) args.dbr;
28 
29  bool res=0;
30 
31  switch (args.type) {
32  case DBR_SHORT:
33  res = pb->shrtval;
34  break;
35  case DBR_LONG:
36  res = pb->longval;
37  break;
38  case DBR_FLOAT:
39  res = pb->fltval;
40  break;
41  case DBR_ENUM:
42  res = pb->enmval;
43  break;
44  case DBR_CHAR:
45  res = pb->charval;
46  break;
47  case DBR_DOUBLE:
48  res = pb->doubleval;
49  break;
50  default:
51  printf("data type %ld not supported\n", args.type);
52  }
53 
54 // printf("%s Epics Boolean Event Handler called %ld = %d\n", ca_name(args.chid), args.type, res);
55 
56  ((EpicsBoolean*) args.usr) -> changeValue(res);
57 }
void changeValue(bool val)
caEventCallBackFunc * EpicsBoolean::get_event_handler ( )
privatevirtual

Implements EpicsObject.

Definition at line 59 of file epicsboolean.cpp.

References event_handler().

60 {
62 }
static void event_handler(struct event_handler_args arg)
void EpicsBoolean::set ( )
slot

Definition at line 15 of file epicsboolean.cpp.

References caput().

Referenced by EpicsMCA::erase(), EpicsMCA::eraseAndStart(), EpicsMCA::start(), and EpicsMCA::stop().

16 {
17  caput(true);
18 }
void caput(bool val)
bool EpicsBoolean::value ( )

Definition at line 87 of file epicsboolean.cpp.

References EpicsObject::m_Mutex, and m_Value.

88 {
89  QMutexLocker lock(&m_Mutex);
90 
91  return m_Value;
92 }
static QMutex m_Mutex
Definition: epicsobject.h:42
void EpicsBoolean::valueChanged ( bool  val)
signal

Member Data Documentation

bool EpicsBoolean::m_Value
private

Definition at line 33 of file epicsboolean.h.

Referenced by changeValue(), and value().


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