#include <AsyncSerial.h>
#include <iostream> #include <AsyncCppApplication.h> #include <AsyncSerial.h> using namespace std; using namespace Async; class MyClass : public SigC::Object { public: MyClass(void) { serial = new Serial("/dev/ttyS0"); serial->charactersReceived.connect( slot(this, &MyClass::onCharactersReceived)); if (!serial->open()) { perror("Open serial port failed"); exit(1); } serial->setParams(9600, Serial::PARITY_NONE, 8, 1, Serial::FLOW_NONE); serial->write("Hello, serial\n", 14); } ~MyClass(void) { serial->close(); delete serial; } private: Serial *serial; void onCharactersReceived(char *buf, int count) { cout << "Read " << count << " characters from serial port: " << buf << endl; } }; int main(int argc, char **argv) { CppApplication app; MyClass my_class; app.exec(); }
Definition at line 129 of file AsyncSerial.h.
|
|
A type that defines the possible choices for flow control.
Definition at line 145 of file AsyncSerial.h. |
|
|
A type that defines the possible choices for parity.
Definition at line 135 of file AsyncSerial.h. |
|
|
A type that defines the read/write pins in the serial port.
Definition at line 155 of file AsyncSerial.h. |
|
|
Constuctor.
|
|
|
Destructor.
|
|
|
Close a previously opened serial port.
|
|
||||||||||||
|
Get the state of one of the input pins in the serial port.
|
|
|
Open the serial port using the previously defined parameters.
|
|
|
Set or clear canonical mode.
This function may be called both before or after the port has been opened and the setting is remembered after a close. |
|
||||||||||||||||||||||||
|
Setup the serial port communications parameter.
|
|
||||||||||||
|
Set the state of one of the output pins in the serial port.
|
|
|
Stop/start input of data.
|
|
||||||||||||
|
Write data to the serial port.
Definition at line 233 of file AsyncSerial.h. |
|
|
A signal that is emitted when there is data to read.
Definition at line 304 of file AsyncSerial.h. |
|
|
The maximum number of characters that can be read at once.
Definition at line 169 of file AsyncSerial.h. |
1.4.4