Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow selection of com port from a list of available ports when starting. #8

Open
fasteddy516 opened this issue Apr 4, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@fasteddy516
Copy link
Owner

I almost always have multiple CircuitPython devices connected, which means I almost always have to run ss.exe with the -c command-line option to specify which device to connect to. If there is more than one com port available, SimplySerial should - by default - display a list of com ports and allow the user to choose which one to connect to.

@fasteddy516 fasteddy516 added the enhancement New feature or request label Apr 4, 2021
@fasteddy516 fasteddy516 added this to the v0.5.0 milestone Apr 4, 2021
@fasteddy516 fasteddy516 self-assigned this Apr 4, 2021
@fasteddy516
Copy link
Owner Author

Note that the auto-connect functionality will have to work in conjunction with this feature. The ONE option is straight-forward enough. The ANY option should probably display the connection list again if there is still more than one available device.

@fasteddy516
Copy link
Owner Author

It would also be nice if this list would auto-update when new devices are connected. I'm not sure what options are available with regards to "listening" for new com ports. A polling-type operation is certainly possible, but far from ideal.

@Pharap
Copy link

Pharap commented May 5, 2021

I came across your repo because someone I watch recently took an interest in it, and since serial communication is something I have some experience with, I thought I'd drop by to provide some info that you might find useful...

I'm not sure what options are available with regards to "listening" for new com ports.

You may find this old project of mine interesting/useful:
https://github.com/Pharap/SimpleSerialCommunication

In particular, this class provides a means of watching for being notified of serial devices being connected and disconnected:
https://github.com/Pharap/SimpleSerialCommunication/blob/master/SerialCommunication/DeviceChangeWatcher.cs

And its usage is demonstrated in the main file:
https://github.com/Pharap/SimpleSerialCommunication/blob/master/SerialCommunication/Program.cs

This is done using the System.Management namespace, which leverages the 'Windows Management Instrumentation' (WMI) system. via WMI queries (which are essentially a variant of SQL). Honestly, WMI isn't a particularly well designed system, but it does the job.

Another alternative would be to use Win32 calls, but it depends how you feel about using unsafe code and marshalling/interop, and enumerating serial ports using Win32 is a bit more complicated anyway.

@fasteddy516
Copy link
Owner Author

That is excellent information, thank you for sharing! I will likely be looking into this in the very near future, and will see what I can manage. This application is literally the first .NET app I wrote after working through a "C# for beginners" book, and I've done depressingly little C#/.NET since then. The examples in your demo code - particularly with regards to utilizing events/handlers - are greatly appreciated.

@fasteddy516 fasteddy516 modified the milestones: v0.5.0, v0.6.0 May 8, 2021
@fasteddy516 fasteddy516 modified the milestones: v0.6.0, v0.7.0 Jul 9, 2021
@fasteddy516 fasteddy516 modified the milestones: v0.7.0, v0.8.0 Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants