]> git.mxchange.org Git - simgear.git/blob - simgear/serial/testserial.cxx
Working 'noshadow' animation
[simgear.git] / simgear / serial / testserial.cxx
1 #include <simgear/compiler.h>
2
3 #include <string>
4 #include <iostream>
5
6 #include <simgear/debug/logstream.hxx>
7
8 #include "serial.hxx"
9
10 using std::cout;
11 using std::endl;
12
13 int main () {
14     SGSerialPort port;
15     string value;
16     bool result;
17
18     sglog().setLogLevels( SG_ALL, SG_INFO );
19
20     cout << "start of main" << endl;
21
22     result = port.open_port("/dev/ttyS1");
23     cout << "opened port, result = " << result << endl;
24
25     result = port.set_baud(4800);
26     cout << "set baud, result = " << result << endl;
27
28     port.write_port("ATDT 626-9800\n");
29
30     while ( true ) {
31         value = port.read_port();
32         if ( value.length() ) {
33             cout << "-> " << value << endl;
34         }
35     }
36
37     return 0;
38 }