/*************************************************************************** * Copyright (C) 2001 by Rick L. Vinyard, Jr. * * rvinyard@cs.nmsu.edu * * * * This file is part of the conexus library. * * * * The conexus library is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License version 3 * * as published by the Free Software Foundation. * * * * The conexus library is distributed in the hope that it will be * * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this software. If not see <http://www.gnu.org/licenses/>. * ***************************************************************************/ #include <conexus.h> #include <iostream> int main(int argc, char* argv[]) { Conexus::init(); // The data to send char data[] = "0123456789\r\n"; char default_serial[] = "/dev/ttyS0"; char* serial = default_serial; // Check to see if user provided command line arguments and change // variables if necessary if (argc > 1) serial = argv[1]; Conexus::TTY::pointer tty = Conexus::TTY::create(serial); tty->set_flow_control( Conexus::FLOW_NONE ); tty->set_speed( 115200 ); tty->write(data, 13); std::cout << "1 transmitted" << std::endl; Conexus::Data d = Conexus::Data(data, 13); *tty << d; std::cout << "2 transmitted" << std::endl; return 0; }