summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/doc/blockingmaster.qdoc24
-rw-r--r--examples/doc/blockingslave.qdoc24
-rw-r--r--examples/doc/terminal.qdoc16
3 files changed, 32 insertions, 32 deletions
diff --git a/examples/doc/blockingmaster.qdoc b/examples/doc/blockingmaster.qdoc
index c828914..f45530e 100644
--- a/examples/doc/blockingmaster.qdoc
+++ b/examples/doc/blockingmaster.qdoc
@@ -73,7 +73,7 @@
We will start with the MasterThread class, which handles the serial
programming code.
- \snippet examples/blockingmaster/masterthread.h 0
+ \snippet blockingmaster/masterthread.h 0
MasterThread is a QThread subclass that provides an API for scheduling
requests to Slave, and it has signals for delivering responses and reporting
@@ -88,15 +88,15 @@
data members from different threads concurrently, we use QMutex to
synchronize access.
- \snippet examples/blockingmaster/masterthread.cpp 2
+ \snippet blockingmaster/masterthread.cpp 2
The transaction() function stores the serial port name, timeout and request
data, and we lock the mutex with QMutexLocker to protect this data. We then
start the thread, unless it is already running. We will come back to the
QWaitCondition::wakeOne() call later.
- \snippet examples/blockingmaster/masterthread.cpp 4
- \snippet examples/blockingmaster/masterthread.cpp 5
+ \snippet blockingmaster/masterthread.cpp 4
+ \snippet blockingmaster/masterthread.cpp 5
In the run() function, we start by acquiring the mutex lock, fetching the
serial port name, timeout and request data from the member data, and then
@@ -110,7 +110,7 @@
The QSerialPort object we construct on stack into run() function before loop
enter:
- \snippet examples/blockingmaster/masterthread.cpp 6
+ \snippet blockingmaster/masterthread.cpp 6
This allows us once to create an object, while running loop, and also means
that all the methods of the object will be executed in the context of the
@@ -120,12 +120,12 @@
current transaction. And if the name is changed then re-open and re-configure
the serial port.
- \snippet examples/blockingmaster/masterthread.cpp 7
+ \snippet blockingmaster/masterthread.cpp 7
The loop will continue creating request data, write to serial port and wait
until all data is transferred.
- \snippet examples/blockingmaster/masterthread.cpp 8
+ \snippet blockingmaster/masterthread.cpp 8
\warning The method waitForBytesWritten() should be used after each write()
call for the blocking approach, because it processes all the I/O routines
@@ -133,11 +133,11 @@
The timeout() signal is emitted if error occurs when transferring data.
- \snippet examples/blockingmaster/masterthread.cpp 9
+ \snippet blockingmaster/masterthread.cpp 9
After a successful request, we start wait until response and try read it.
- \snippet examples/blockingmaster/masterthread.cpp 10
+ \snippet blockingmaster/masterthread.cpp 10
\warning The method waitForReadyRead() should be used before each read()
call for the blocking approach, because it processes all the I/O routines
@@ -145,18 +145,18 @@
The timeout() signal is emitted if error occurs when receiving data.
- \snippet examples/blockingmaster/masterthread.cpp 11
+ \snippet blockingmaster/masterthread.cpp 11
After a successful transaction is emitted response() signal containing the
data received from the Slave application:
- \snippet examples/blockingmaster/masterthread.cpp 12
+ \snippet blockingmaster/masterthread.cpp 12
Next, the thread goes to sleep until the next transaction is appear. On
waking, the thread re-reads the new data of members and run loop from the
beginning.
- \snippet examples/blockingmaster/masterthread.cpp 13
+ \snippet blockingmaster/masterthread.cpp 13
\sa {Simple Terminal Example}, {Blocking Slave Example}
*/
diff --git a/examples/doc/blockingslave.qdoc b/examples/doc/blockingslave.qdoc
index 8f3910e..4b1017f 100644
--- a/examples/doc/blockingslave.qdoc
+++ b/examples/doc/blockingslave.qdoc
@@ -73,7 +73,7 @@
We will start with the SlaveThread class, which handles the serial
programming code.
- \snippet examples/blockingslave/Slavethread.h 0
+ \snippet blockingslave/Slavethread.h 0
SlaveThread is a QThread subclass that provides an API for receive requests
from Master, and it has signals for delivering responses and reporting
@@ -91,15 +91,15 @@
data members from different threads concurrently, we use QMutex to
synchronize access.
- \snippet examples/blockingslave/slavethread.cpp 2
+ \snippet blockingslave/slavethread.cpp 2
The startSlave() function stores the serial port name, timeout and response
data, and we lock the mutex with QMutexLocker to protect this data. We then
start the thread, unless it is already running. We will come back to the
QWaitCondition::wakeOne() call later.
- \snippet examples/blockingslave/slavethread.cpp 4
- \snippet examples/blockingslave/slavethread.cpp 5
+ \snippet blockingslave/slavethread.cpp 4
+ \snippet blockingslave/slavethread.cpp 5
In the run() function, we start by acquiring the mutex lock, fetching the
serial port name, timeout and response data from the member data, and then
@@ -113,7 +113,7 @@
The QSerialPort object we construct on stack into run() function before loop
enter:
- \snippet examples/blockingslave/slavethread.cpp 6
+ \snippet blockingslave/slavethread.cpp 6
This allows us once to create an object, while running loop, and also means
that all the methods of the object will be executed in the context of the
@@ -123,11 +123,11 @@
current startup. And if the name is changed then re-open and re-configure
the serial port.
- \snippet examples/blockingslave/slavethread.cpp 7
+ \snippet blockingslave/slavethread.cpp 7
The loop will continue wait for reading request data:
- \snippet examples/blockingslave/slavethread.cpp 8
+ \snippet blockingslave/slavethread.cpp 8
\warning The method waitForReadyRead() should be used before each read()
call for the blocking approach, because it processes all the I/O routines
@@ -135,12 +135,12 @@
The timeout() signal is emitted if error occurs when reading data.
- \snippet examples/blockingslave/slavethread.cpp 9
+ \snippet blockingslave/slavethread.cpp 9
After a successful read, we try send response and wait completion of the
transfer:
- \snippet examples/blockingslave/slavethread.cpp 10
+ \snippet blockingslave/slavethread.cpp 10
\warning The method waitForBytesWritten() should be used after each write()
call for the blocking approach, because it processes all the I/O routines
@@ -148,18 +148,18 @@
The timeout() signal is emitted if error occurs when writing data.
- \snippet examples/blockingslave/slavethread.cpp 11
+ \snippet blockingslave/slavethread.cpp 11
After a successful writing is emitted request() signal containing the
data received from the Master application:
- \snippet examples/blockingslave/slavethread.cpp 12
+ \snippet blockingslave/slavethread.cpp 12
Next, the thread goes to re-reads the current parameters for serial interface,
because they can be updated when new startSlave() and run loop from the
beginning.
- \snippet examples/blockingslave/slavethread.cpp 13
+ \snippet blockingslave/slavethread.cpp 13
\sa {Simple Terminal Example}, {Blocking Master Example}
*/
diff --git a/examples/doc/terminal.qdoc b/examples/doc/terminal.qdoc
index fd948c3..d5ce209 100644
--- a/examples/doc/terminal.qdoc
+++ b/examples/doc/terminal.qdoc
@@ -84,22 +84,22 @@
constructor. The main widget is passed as the parent, so the object deletion
happens automatically according to the the parent and child mechanism in Qt:
- \snippet examples/terminal/mainwindow.cpp 0
+ \snippet terminal/mainwindow.cpp 0
\dots
- \snippet examples/terminal/mainwindow.cpp 1
+ \snippet terminal/mainwindow.cpp 1
The only QSerialPort signal invoked in this example is
QSerialPort::readyRead(), which shows that new data has been received and
hence available:
\dots
- \snippet examples/terminal/mainwindow.cpp 2
+ \snippet terminal/mainwindow.cpp 2
\dots
- \snippet examples/terminal/mainwindow.cpp 3
+ \snippet terminal/mainwindow.cpp 3
Clicking on the \b{Connect} button invokes the \c openSerialPort() slot:
- \snippet examples/terminal/mainwindow.cpp 4
+ \snippet terminal/mainwindow.cpp 4
In this slot, the settings are read from \l{examples/terminal/settingsdialog.cpp}
{SettingsDialog} and an attempt is made to open and initialize the serial
@@ -113,13 +113,13 @@
Clicking on the \b{Disconnect} button invokes the \c closeSerialPort()
slot:
- \snippet examples/terminal/mainwindow.cpp 5
+ \snippet terminal/mainwindow.cpp 5
In this case, handled by the closure of the serial port.
Typing characters in the console invokes the \c writeData() slot:
- \snippet examples/terminal/mainwindow.cpp 6
+ \snippet terminal/mainwindow.cpp 6
This slot sends the characters typed in the given
\l{examples/terminal/console.cpp}{Console} widget to the serial port.
@@ -128,7 +128,7 @@
\l{QTcpSocket::readyRead()}{readyRead()} is emitted, and that signal is
connected to the \c MainWindow::readData() slot:
- \snippet examples/terminal/mainwindow.cpp 7
+ \snippet terminal/mainwindow.cpp 7
This slot reads the data from the serial port and displays that in the
\l{examples/terminal/console.cpp}{Console} widget.