00001 #include <simgear/compiler.h>
00002
00003 #include <string>
00004 #include <iostream>
00005
00006 #include <simgear/debug/logstream.hxx>
00007
00008 #include "serial.hxx"
00009
00010 using std::cout;
00011 using std::endl;
00012
00013 int main () {
00014 SGSerialPort port;
00015 string value;
00016 bool result;
00017
00018 sglog().setLogLevels( SG_ALL, SG_INFO );
00019
00020 cout << "start of main" << endl;
00021
00022 result = port.open_port("/dev/ttyS1");
00023 cout << "opened port, result = " << result << endl;
00024
00025 result = port.set_baud(4800);
00026 cout << "set baud, result = " << result << endl;
00027
00028 port.write_port("ATDT 626-9800\n");
00029
00030 while ( true ) {
00031 value = port.read_port();
00032 if ( value.length() ) {
00033 cout << "-> " << value << endl;
00034 }
00035 }
00036
00037 return 0;
00038 }