Hi, I'm looking for a mechanism allowing me to enumerate serial (Com) ports on Windows/Mac. I also need to be able to retrieve the name of a given serial device. I've had a quick look at boost::asio, but it isn't clear to me if it can do what I want. I'd be grateful for any advice, including alternatives if boost and/or ASIO aren't up to the job. Best wishes. Tim Burgess Raised Bar Ltd. E: mailto:tim@raisedbar.net tim@raisedbar.net M: +44 (0)7989 486976
On windows, the easiest way is trying to open COM1, COM2 in sequence and see whether open succeeded.
If you'll enumerate more than 10 ports, you should name them as \\.\COM10file://./COM10 etc.
From: Boost-users
The boost.asio is for communication, not for the hardware management, so in order to enumerate the port the program requires to call local API. On Windows, check here https://social.msdn.microsoft.com/Forums/vstudio/en-US/588b7967-cce4-4412-87... Once you have the port, just use boost.asio to communicate with it. If you're not familiar with the usage of boost.asio, please read the tutorial and examples for the network applications, the serial port is the same. Good luck. On Wed, Sep 5, 2018 at 7:46 PM Tim Burgess via Boost-users < boost-users@lists.boost.org> wrote:
Hi,
I’m looking for a mechanism allowing me to enumerate serial (Com) ports on Windows/Mac. I also need to be able to retrieve the name of a given serial device. I’ve had a quick look at boost::asio, but it isn’t clear to me if it can do what I want.
I’d be grateful for any advice, including alternatives if boost and/or ASIO aren’t up to the job.
Best wishes.
Tim Burgess
Raised Bar Ltd.
E: tim@raisedbar.net
M: +44 (0)7989 486976
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Bo Zhou
-
Stian Zeljko Vrba
-
tim@raisedbar.net