diff options
author | Olli Savia <ops@iki.fi> | 2014-12-20 10:11:25 +0200 |
---|---|---|
committer | Olli Savia <ops@iki.fi> | 2014-12-20 10:11:25 +0200 |
commit | 6dbb05a2f8cfdead9c0683256ba59594c5df1464 (patch) | |
tree | 42aa1cb0a400a4d676239f3192962706b1bd35e5 | |
parent | 2c79817583b064c2ba223bf9d01cae5e4824546e (diff) | |
download | ATCD-6dbb05a2f8cfdead9c0683256ba59594c5df1464.tar.gz |
Updated TTY_IO examples. This fixes Bugzilla Bug #3424
-rw-r--r-- | ACE/examples/IPC_SAP/DEV_SAP/reader/reader.cpp | 28 | ||||
-rw-r--r-- | ACE/examples/IPC_SAP/DEV_SAP/writer/writer.cpp | 30 |
2 files changed, 23 insertions, 35 deletions
diff --git a/ACE/examples/IPC_SAP/DEV_SAP/reader/reader.cpp b/ACE/examples/IPC_SAP/DEV_SAP/reader/reader.cpp index d3658c424e4..80b25ee180e 100644 --- a/ACE/examples/IPC_SAP/DEV_SAP/reader/reader.cpp +++ b/ACE/examples/IPC_SAP/DEV_SAP/reader/reader.cpp @@ -4,8 +4,6 @@ #include "ace/DEV_Connector.h" #include "ace/TTY_IO.h" - - int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (argc < 2) @@ -25,25 +23,21 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) 1); ACE_TTY_IO::Serial_Params myparams; + // Try to read default parameters + if (read_dev.control (ACE_TTY_IO::GETPARAMS, &myparams) == -1) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("GETPARAMS is not supported\n"))); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("GETPARAMS is supported\n"))); + } + myparams.baudrate = 19200; - myparams.xonlim = 0; - myparams.xofflim = 0; myparams.readmincharacters = 0; myparams.readtimeoutmsec = 10*1000; // 10 seconds - myparams.paritymode = "EVEN"; - myparams.ctsenb = false; - myparams.rtsenb = 0; - myparams.xinenb = false; - myparams.xoutenb = false; - myparams.modem = false; - myparams.rcvenb = true; - myparams.dsrenb = false; - myparams.dtrdisable = false; - myparams.databits = 8; - myparams.stopbits = 1; - if (read_dev.control (ACE_TTY_IO::SETPARAMS, - &myparams) == -1) + if (read_dev.control (ACE_TTY_IO::SETPARAMS, &myparams) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p control\n"), argv[1]), diff --git a/ACE/examples/IPC_SAP/DEV_SAP/writer/writer.cpp b/ACE/examples/IPC_SAP/DEV_SAP/writer/writer.cpp index f011530843f..a86c965c02b 100644 --- a/ACE/examples/IPC_SAP/DEV_SAP/writer/writer.cpp +++ b/ACE/examples/IPC_SAP/DEV_SAP/writer/writer.cpp @@ -4,8 +4,6 @@ #include "ace/TTY_IO.h" #include "ace/OS_NS_unistd.h" - - int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (argc < 2) @@ -24,25 +22,21 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) 1); ACE_TTY_IO::Serial_Params myparams; + // Try to read default parameters + if (write_dev.control (ACE_TTY_IO::GETPARAMS, &myparams) == -1) + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("GETPARAMS is not supported\n"))); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("GETPARAMS is supported\n"))); + } + myparams.baudrate = 19200; - myparams.xonlim = 0; - myparams.xofflim = 0; myparams.readmincharacters = 0; - myparams.readtimeoutmsec = 10000; - myparams.paritymode = "EVEN"; - myparams.ctsenb = false; - myparams.rtsenb = 0; - myparams.xinenb = false; - myparams.xoutenb = false; - myparams.modem = false; - myparams.rcvenb = true; - myparams.dsrenb = false; - myparams.dtrdisable = false; - myparams.databits = 8; - myparams.stopbits = 1; + myparams.readtimeoutmsec = 10*1000; // 10 seconds - if (write_dev.control (ACE_TTY_IO::SETPARAMS, - &myparams) == -1) + if (write_dev.control (ACE_TTY_IO::SETPARAMS, &myparams) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("control")), |