propellersession.h
1 #pragma once
2 
3 #include "../manager/propellermanager.h"
4 
5 #include <QTimer>
6 #include <QStringList>
7 
41 class PropellerManager;
42 
43 class PropellerSession : public QObject
44 {
45  Q_OBJECT
46 
47 private:
48  QString port;
49  PropellerManager * manager;
50 
51 public:
53  PropellerManager * manager,
54  const QString & portname = QString(),
55  QObject * parent = 0);
57 
58  const QString & portName();
59  void setPortName(const QString & name);
60  bool isOpen();
61 
66  bool reserve();
67  bool isReserved();
68  void release();
69 
70  void pause();
71  bool isPaused();
72  void unpause();
80  bool clear();
81  bool setBaudRate(quint32 baudRate);
82 
83  qint64 bytesToWrite();
84  qint64 bytesAvailable();
85 
86  QByteArray read(qint64 maxSize);
87  QByteArray readAll();
88 
89  bool putChar(char c);
90  qint64 write(const QByteArray & byteArray);
91  int error();
92  QString errorString();
100  void useReset(const QString & name, int pin);
101  void useDefaultReset();
102  bool reset();
103  quint32 resetPeriod();
104 
105  quint32 minimumTimeout();
106  void setMinimumTimeout(quint32 milliseconds);
107  quint32 calculateTimeout(quint32 bytes);
110 signals:
111  void bytesWritten(qint64 bytes);
112  void readyRead();
113  void baudRateChanged(qint32 baudRate);
114  void sendError(const QString & message);
115  void deviceFree();
116  void deviceBusy();
117 
118 };
119 
QByteArray readAll()
Definition: propellersession.cpp:162
bool setBaudRate(quint32 baudRate)
Definition: propellersession.cpp:116
bool isOpen()
Definition: propellersession.cpp:45
void setMinimumTimeout(quint32 milliseconds)
Definition: propellersession.cpp:204
void setPortName(const QString &name)
Definition: propellersession.cpp:37
void unpause()
Definition: propellersession.cpp:95
quint32 resetPeriod()
Definition: propellersession.cpp:256
bool clear()
Definition: propellersession.cpp:104
void pause()
Definition: propellersession.cpp:79
int error()
Definition: propellersession.cpp:268
qint64 bytesAvailable()
Definition: propellersession.cpp:138
bool reset()
Definition: propellersession.cpp:251
QString errorString()
Definition: propellersession.cpp:280
~PropellerSession()
Definition: propellersession.cpp:21
quint32 calculateTimeout(quint32 bytes)
Definition: propellersession.cpp:215
QByteArray read(qint64 maxSize)
Definition: propellersession.cpp:150
The PropellerManager class provides an abstraction layer between PropellerSession and PropellerDevice...
Definition: propellermanager.h:86
void sendError(const QString &message)
qint64 bytesToWrite()
Definition: propellersession.cpp:127
void release()
Definition: propellersession.cpp:71
The PropellerSession class provides a persistent interface to Propeller hardware via PropellerManager...
Definition: propellersession.h:43
PropellerSession(PropellerManager *manager, const QString &portname=QString(), QObject *parent=0)
Definition: propellersession.cpp:9
bool putChar(char c)
Definition: propellersession.cpp:174
bool reserve()
Definition: propellersession.cpp:55
void bytesWritten(qint64 bytes)
quint32 minimumTimeout()
Definition: propellersession.cpp:195
const QString & portName()
Definition: propellersession.cpp:29
bool isReserved()
Definition: propellersession.cpp:63
void useReset(const QString &name, int pin)
Definition: propellersession.cpp:228
qint64 write(const QByteArray &byteArray)
Definition: propellersession.cpp:186
void baudRateChanged(qint32 baudRate)
void useDefaultReset()
Definition: propellersession.cpp:240
bool isPaused()
Definition: propellersession.cpp:87