|
QDaq
0.2.6
Qt-based Data Aqcuisition
|
Base class of objects representing digital communications interfaces. More...
#include <QDaqInterface.h>


Public Slots | |
| bool | open () |
| Opens the interface and returns true if succesful. | |
| void | close () |
| Closes the interface. | |
| void | clear () |
| Clears the interface. | |
Public Slots inherited from QDaqObject | |
| QString | errorBacktrace (int maxItems=10) const |
| Print a backtrace of recent errors in this QDaqObject. | |
| QString | path () const |
| Return the object's path in the QDaq tree. More... | |
| QString | objectTree () const |
| Output in a string the object hierarchy beneath this object. | |
| QString | listProperties () const |
| List the objects properties. | |
| QString | listFunctions () const |
| List the objects scriptable functions. | |
| QDaqObject * | parent () const |
| QDaqObjectList | children () const |
| Return a list of children of this object. | |
| bool | hasChildren () const |
| Returns true if the object has children. | |
| QDaqObject * | appendChild (QDaqObject *obj) |
| Adds a new child QDaqObject, as the last child and returns a pointer to it. | |
| QDaqObject * | insertBefore (QDaqObject *newobj, QDaqObject *existingobj) |
| Adds a new child QDaqObject, before an existing child and returns a pointer to it. | |
| QDaqObject * | clone () |
| Clone a QDaqObject with its child objects. | |
| QDaqObject * | removeChild (QDaqObject *obj) |
| Remove a child and return a pointer to it. | |
| QDaqObject * | replaceChild (QDaqObject *newobj, QDaqObject *oldobj) |
| Replace a child and return a pointer to the old child. | |
| QDaqObject * | findChild (const QString &name) const |
| Find the first child QDaqObject with objectName equal to name. | |
Public Member Functions | |
| QDaqInterface (const QString &name) | |
| Construct a QDaqInterface with object-name name. | |
| virtual void | detach () |
| When a QDaqInterface is detached it is also closed. | |
| virtual bool | open_port (uint i, QDaqDevice *d) |
| Open communication port no. More... | |
| virtual void | close_port (uint i) |
| Closes port i. | |
| virtual void | clear_port (uint i) |
| Clear the communication channel with port i (interface specific). | |
| virtual int | read (uint port, char *buff, int len, int eos=0) |
| Read data from a port. More... | |
| virtual int | write (uint port, const char *buff, int len, int eos=0) |
| Write data to a port. More... | |
| virtual bool | isValidPort (uint i) |
| Returns true is i is a valid port number. | |
| virtual int | readStatusByte (uint port) |
| Returns a status byte for a port (interface specific). | |
| virtual void | trigger (uint port) |
| Trigger a device connected to port (interface specific). | |
Public Member Functions inherited from QDaqObject | |
| Q_INVOKABLE | QDaqObject (const QString &name) |
| Construct a QDaqObject with a name. More... | |
| virtual void | attach () |
| Attach this QDaqObject to the QDaq tree. More... | |
| bool | isAttached () const |
| Returns true is this object is attached to the QDaq tree. | |
Protected Member Functions | |
| virtual bool | open_ () |
| Implementation of interface open. | |
| virtual void | close_ () |
| Implementation of interface close. | |
| virtual void | clear_ () |
| Implementation of interface clear. | |
| virtual void | setTimeout_ (uint v) |
| Implementation of setting the timeout. | |
| bool | throwIfOpen () |
| Throws a script error and a QDaqError if called on an open interface. | |
Protected Member Functions inherited from QDaqObject | |
| void | pushError (const QString &type, const QString &descr=QString()) const |
| Push an error in the error queue. | |
| void | throwScriptError (const QString &msg) const |
| Throw a script error with message msg. | |
| bool | checkName (const QString &name) const |
| Check if name is a legal name for an QDaqObject. More... | |
| virtual void | writeh5 (H5::Group *g, QDaqH5File *f) const |
| Write contents of the object to a H5 group. More... | |
| virtual void | readh5 (H5::Group *g, QDaqH5File *f) |
| Read contents of the object from a H5 group. More... | |
Properties | |
| uint | address |
| Address of this interface. More... | |
| uint | timeout |
| Communications timeout in ms. | |
| bool | isOpen |
| Returns true if the interface is open. | |
Additional Inherited Members | |
Signals inherited from QDaqObject | |
| void | propertiesChanged () |
| Fired when object properties have changed. | |
| void | updateWidgets () |
| Fired when widgets need update. | |
Static Public Member Functions inherited from QDaqObject | |
| static QDaqRoot * | root () |
| Obtain a pointer to the one-and-only QDaqRoot object. | |
| static QDaqObject * | fromPath (const QString &path) |
| Return a pointer to an object given its full path in the QDaq tree. More... | |
Public Attributes inherited from QDaqObject | |
| QMutex | comm_lock |
| A recursive mutex for synching thread access to this object. | |
Base class of objects representing digital communications interfaces.
QDaqInterface provides a common implementation for communication interfaces as, e.g., serial (RS232,RS485,USB), ethernet (TCP/IP), MODBUS and GPIB.
The QDaqInstrument class utilizes a descendant of QDaqInterface for performing the actual communications with the instrument.
A QDaqInterface has a number of communication "ports", which have different meaning depending on the specific interface implementation. On memory/register based interfaces like MODBUS, a port represents the register number to be read/written. On interfaces that support connection with multiple instruments (GPIB, RS485), the port is essentially the address of each instrument. On interfaces that support only one-to-one communication with an instrument (RS232, TCP/IP) the port is not used.
Definition at line 31 of file QDaqInterface.h.
|
virtual |
Open communication port no.
i for QDaqDevice d
Returns true if the port was succesfully opened.
Definition at line 44 of file QDaqInterface.cpp.
|
virtual |
Read data from a port.
The meaning of the port parameter is different depending on the type of communication interface.
In message based communications (e.g. GPIB) the port is the instrument address.
In memory based interfaces (e.g. MODBUS) the port number represents the starting register address to access. The number of registers read/written depends on len, the size of the buffer in bytes. A MODBUS register is 16 bit, ie, occupies 2 bytes.
| port | Port number. |
| buff | Pointer to memory buffer. |
| len | Allocated number of bytes. |
| eos | End of string byte |
Definition at line 58 of file QDaqInterface.cpp.
|
virtual |
Write data to a port.
The meaning of the port parameter is different depending on the type of communication interface.
In message based communications (e.g. GPIB) the port is the instrument address.
In memory based interfaces (e.g. MODBUS) the port number represents the starting register address to access. The number of registers read/written depends on len, the size of the buffer in bytes. A MODBUS register is 16 bit, ie, occupies 2 bytes.
| p | Port number. |
| buff | Pointer to memory buffer. |
| len | Number of bytes to write. |
| eos | End of string byte |
Definition at line 67 of file QDaqInterface.cpp.
|
readwrite |
Address of this interface.
The meaning of address depends on the type of interface.
The address can be changed when the interface is closed.
Definition at line 42 of file QDaqInterface.h.
1.8.5