Solved

Mock serial port communication C#

Posted on 2013-12-12
2
1,211 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 75

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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 join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:

895 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

19 Experts available now in Live!

Get 1:1 Help Now