Closed arnegue closed 6 years ago
You are probably looking for this: examples/serial_to_tcp.cpp
Thanks for your answer. I was talking about writing and reading on the serial bus with the default_nmea_reader or similar. Sorry for the confusion.
Using boost::asio you can read and write to interfaces (TCP, serial). There are some examples using it, e.g. example/read_nmea_boostasio.cpp
, examples/serial_to_tcp.cpp
and example/simple_seatalk_nmea_converter.cpp
.
Okay, sorry i did not see the boost_asio_serial with writing too. I will have a look at it this evening.
A further question (maybe i should open up a issue more, but seems over the top). The serial read/write (especially read) is blocking. Is there a way for you to put in a timeout? I don't want to unnecessarily spawn a thread for every serial port i'm reading/writing on.
Yes of course, asynchronous communication is possible. You could use select
on a file descriptor or use boost.asio
. I'm sure there are other options.
The issue has obviously been dead, closing it.
I want to build up a multiplexing system, which writes AND receives messages from TCP (only write right now, but doesn't matter), NMEA-0183-Devices and one Seatalk-Bus.
I am able to receive seatalk messages (convert them to NMEA) and from NMEA-Devices.
The problem is, that i also want to WRITE to these buses. TCP is no problem.
But the examples (with default_nmea_reader or seatalk message_reader) only show message-receivers, but no writers. OR if there is a writer, it's is not a receiver.
Could you give an example how to do both?