[Boost-users] Simple serial port demonstration with boost asio asynchronous I/O

1,440 views
Skip to first unread message

Jeff Gray

unread,
Oct 6, 2008, 9:27:17 PM10/6/08
to boost...@lists.boost.org
A couple of weeks ago I posted a simple asynchronous demonstration of a
telnet client using boost asio TCP network code.

I have changed this code to turn it into a simple serial terminal
application using the serial port support in the new version of boost asio.

It required no changes at all the the read or write code. I just altered
the initialization to use a serial port instead of a socket.

Note that this is not intended to show how a fully functional
application would work. There are plenty of areas that are not handled
in this code. But it shows the idea and it's easy to build on this once
you've got it working.

Hope this helps someone else get started...
Jeff

minicom.cpp

Andrew Maclean

unread,
Oct 6, 2008, 10:23:40 PM10/6/08
to boost...@lists.boost.org
Once again a nice example.
On line 34 just change:

if (not serialPort.is_open())
to:
if (!serialPort.is_open())

The CMakeLists.txt file I posted in your telent client thread also
works here by changing two lines, line 1 the project name and line 92
the source file.

These are good convincing demonstrations of the utulity of asio!

Thanks
Andrew

> _______________________________________________
> Boost-users mailing list
> Boost...@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

jhodapp

unread,
Jan 25, 2011, 10:23:00 PM1/25/11
to boost...@lists.boost.org

Jeff,

I am writing to get your permission to use your simple serial port
example, minicom, based on boost::serial_port in my open source project.
Your example was most useful and the only example that I could find that
would adequately show an effective way to use serial_port and also
boost::asio::io_service with it. I have based the structure of my
implementation on what you have done with some adaptations. For your
information, my project will be licensed under the Simplified BSD License.

Thanks,

Jim
--
View this message in context: http://boost.2283326.n4.nabble.com/Simple-serial-port-demonstration-with-boost-asio-asynchronous-I-O-tp2582657p3237410.html
Sent from the Boost - Users mailing list archive at Nabble.com.

jhodapp

unread,
Aug 27, 2011, 10:53:00 AM8/27/11
to boost...@lists.boost.org
Any reason why you can't use Ubuntu's package for Boost? Do you need the latest version of Boost? If you use the Ubuntu packages, you should have no issues as I was successfully able to run that example on my Ubuntu installation.


On Aug 27, 2011, at 9:55 AM, drwho [via Boost] wrote:

New to boost. (Ubuntu 10.10) Downloaded boost 1.47 source.  Built it with ./bootstrap.sh and ./b2 Keep getting linker failure, undefined reference to `boost::system::get_system_category() in my QT app. Tried your serial example from bash, same thing....

drwho@drwho-desktop:~/Projects/prog$ g++ -Lboost/stage/lib -lboost_system -lboost_thread serial.cpp -o test
/tmp/ccvTv9iN.o: In function `__static_initialization_and_destruction_0(int, int)':
serial.cpp:(.text+0x3cf): undefined reference to `boost::system::get_system_category()'
serial.cpp:(.text+0x3d9): undefined reference to `boost::system::get_generic_category()'
serial.cpp:(.text+0x3e3): undefined reference to `boost::system::get_generic_category()'
serial.cpp:(.text+0x3ed): undefined reference to `boost::system::get_generic_category()'
serial.cpp:(.text+0x3f7): undefined reference to `boost::system::get_system_category()'
/tmp/ccvTv9iN.o: In function `boost::system::error_code::error_code()':
serial.cpp:(.text._ZN5boost6system10error_codeC1Ev[boost::system::error_code::error_code()]+0x10): undefined reference to `boost::system::get_system_category()'
/tmp/ccvTv9iN.o: In function `boost::asio::error::get_system_category()':
serial.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x7): undefined reference to `boost::system::get_system_category()'
collect2: ld returned 1 exit status



If you reply to this email, your message will be added to the discussion below:
http://boost.2283326.n4.nabble.com/Simple-serial-port-demonstration-with-boost-asio-asynchronous-I-O-tp2582657p3773016.html
To unsubscribe from Simple serial port demonstration with boost asio asynchronous I/O, click here.



View this message in context: Re: Simple serial port demonstration with boost asio asynchronous I/O
Reply all
Reply to author
Forward
0 new messages