Solved

Mock serial port communication C#

Posted on 2013-12-12
2
1,188 Views
Last Modified: 2014-04-22
I have written a c# application designed to receive and send data to and from a COM port. Unfortunately I am awaiting the arrival of the COM device I need to test this application, so what I am looking for is a way to simulate the COM port.

This should allow me to connect to the 'mock' serial port send messages to it and send messages back. I dont want to use a third party application for this if possible - i.e. if I can write a C# application to acheive this that would be ideal as I would need to customise it very heavily.

Whatever the solution is I am sure it will be a new concept for me so a simple solution with a step by step approach would be appreciated!
0
Comment
Question by:Blowfelt82
2 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39715823
Without using a 3rd-party emulator, the closest you can get would be to create a new class that exposes the same properties and methods that the SerialPort class exposes. Once your device arrives, simply swap in the SerialPort class for your mock class.

I think an emulator would be more flexible and easier to set up, but if you want to keep it all in .NET, then I think this would be your only recourse.
0
 

Author Comment

by:Blowfelt82
ID: 39715908
Ok sounds good, do you have a cose sample of how this might be done? Also out of curiosity what third party tool might you recommend?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
Teach the user how to rename, unmount, delete and upgrade VMFS datastores. Open vSphere Web Client: Rename VMFS and NFS datastores: Upgrade VMFS-3 volume to VMFS-5: Unmount VMFS datastore: Delete a VMFS datastore:
Teach the user how to configure vSphere Replication and how to protect and recover VMs Open vSphere Web Client: Verify vsphere Replication is enabled: Enable vSphere Replication for a virtual machine: Verify replicated VM is created: Recover replica…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now