I need to develop a Windows Form application that communicates with a device that is connected via Com1. This will allow the application to report current parameters on the device as well as change parameters.
First trick is the communication link with the device needs to be kept active so the device won't drop the link. I'm thinking some kind of timer to trigger the sending of a standard command to the device.
Second trick is I need to have access to the device from third-party program through a DLL. I'm thinking of using WCF service for a link to my custom program or should I just write all the device communication into the WCF service and have both the DLL and my Windows Form applicaiton pull information from the WCF service?
Any guidance or help would be appreciated. I have no problem writing stand-alone programs it is just the communication between applications I have confusion about.
For the desktop, a Windows Service may be the best always-on listener for your COM1 device.
A Winforms app can communicate with the Windows Service which is pretty straight forward.
You can also write a system tray icon app that surfaces the Windows Service with interactive UI, since they are not otherwise interactive.
Why WCF? Is the interactivity network-wide? Sound like your messing with an LED display or something... TCP sockets...
Like John, I would also go with a Windows Service for the COM1 port -- create some form of API to allow reading and setting of the device parameters and expose this through something like WCF (as this is relatively simple to code in .NET and allows the most flexibility of how you expose the methods).
Then you have a centralised service that you can access through a WinForms app, from a DLL plug-in in a 3rd party app, of from anywhere else you can think of in the future depending on how you expose the endpoints.
I always used to enjoy controlling devices through code (when I used to get to do that sort of thing), is it an interesting device?
BubbaGee, how on earth does this thing support COM1? (j/k)
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.