传递串口实例问题 [英] Passing a serial port instance problem

查看:154
本文介绍了传递串口实例问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的



我是C#的新手,我正在寻求以下问题的帮助。



我打算用C#构建一个适应性强的测试平台,以实现以下功能,就像NI-Teststand一样,但非常支持.Net Only。



这是虚拟测试树,每一步都会使用反射调用.Net程序集



================== ===

初始化MCU串行端口(串口实例)

初始化NI-Visa(签证端口实例)

向MCU发送命令并检查结果

将GPIB cmmand发送给DUT

....

关闭MCU SerialPort

关闭NI-VISA < br $>
=====================



汇编dll可能会改变形式项目到项目,可能是dll不同的每个步骤。



现在我的问题是如何将串口实例和签证实例传递给以下步骤,以便按照步骤可以使用它而无需创建新实例提高效率。



我的尝试:



我'我试图用XML序列化,但我不知道继续...

Dear

I am quite new for C#,I'm looking for help with the following questions.

I am Plan to build one adaptable test platform with C# to achieve the following features,it just like NI-Teststand, but quite support .Net Only.

This is dummy Test Tree, Each Step will use Reflection Call .Net Assembly

=====================
Init MCU SerialPort (serial port instance)
Init NI-Visa (visa port instance)
Send Command to MCU and check result
Send GPIB cmmand to DUT
....
Close MCU SerialPort
Close NI-VISA
=====================

The assembly dll may change form project to project, may be each steps the dll is different.

Now my question is how to pass the serial port instance and visa instance to following steps, so that the follow steps can use it without create new instance to improve efficiency.

What I have tried:

I've tried to serialize with XML, but I have no idea to continue...

推荐答案

XML在两个进程之间传递数据效率最高。这里有一个Google搜索,它提供了一些不同的解决方案,而不是只指定一种方法: c#在进程之间传递 - Google搜索 [< a href =https://www.google.com.au/search?q=c%23+passing+between+processes&oq=c%23+passing+between+processes&aqs=chrome..69i57j69i58j0l4.11725j0j1& ; sourceid = chrome& ie = UTF-8target =_ blanktitle =New Window> ^ ]
XML is not the most efficient at passing data between two processes. Rather than specifying only one way of doing this, here is a Google Search that will give you a few different solutions: c# passing between processes - Google Search[^]


引用:

它没有创建新实例来提高效率。

it without create new instance to improve efficiency.

你真的认为你需要它吗?

我强烈怀疑你是否会观察到性能提升。

Do you really think you need that?
I strongly doubt you are going to observe a performance improvement.


这篇关于传递串口实例问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆