如何与 USB 3G 调制解调器通信?

How to communicate with USB 3G modem?(如何与 USB 3G 调制解调器通信?)
本文介绍了如何与 USB 3G 调制解调器通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 D-Link DWM-156 3G USB 调制解调器,我想从我的应用程序(在 Windows XP SP3 上运行的 C# .NET 4.0)发送 AT 命令.

I have a D-Link DWM-156 3G USB modem that I want to send AT-commands to from my application (C# .NET 4.0 running on Windows XP SP3).

插入并安装驱动程序后,调制解调器显示如下:

After plug-in and installation of drivers the modem shows up like this:

设备管理器中,添加了两个串口:

In Device Manager, two serial ports are added:

  • D-Link HSPADataCard 诊断接口 (COM4)
  • D-Link HSPADataCard NMEA 设备 (COM5)

控制面板、电话和调制解调器选项中,添加了一个新的调制解调器:

In Control Panel, Phone and Modem Options, a new modem is added:

  • D-Link HSPADataCard 专有 USB 调制解调器(连接到 COM19)
  • D-Link HSPADataCard Proprietary USB Modem (attached to COM19)

问题:我应该使用哪个 com 端口来发送 AT 命令,以及以什么速度?

我以不同的速度尝试了所有三个端口,但没有任何运气.

I have tried all three ports at different speeds, but with no luck whatsoever.

为了学习,我随后安装了 Free Serial Port Monitor" 嗅探器应用程序,希望能够在打开和关闭互联网连接时监控与 D-Link 实用程序的通信(工作正常).

In order to learn, I then installed the "Free Serial Port Monitor" sniffer app, hoping to be able to monitor the communication with the D-Link ustility as it opens and closes the internet connection (which works OK).

在启动时,嗅探器应用会询问我要监控哪个端口,并提供以下端口名称供我选择:

On start, the sniffer app asks me which port to monitor and offers me the following port names to choose from:

  • Agere Systems HDA 调制解调器",
  • D-Link HSPADataCard 专有 USB 调制解调器",
  • COM3",
  • COM4",
  • COM5"
  • ...还有更多,包括COM19".

选择 D-Link..." 名称可以正常工作,现在我可以看到正在使用的所有 AT 命令,但我无法确定端口使用的波特率.此外,COM4、COM5 或 COM19 都不能以这种方式进行嗅探(这些端口上似乎没有发生任何事情).

Choosing the "D-Link..." name works OK, now I can watch all the AT commands being used as they happen, but I cannot determine at which baud rate the port is used. Further, neither COM4, COM5 or COM19 works for sniffing this way (nothing seems to happen on those ports).

现在我想使用 .NET 中的 SerialPort 类打开 "D-Link..." 端口并与 USB 调制解调器通信,但是SerialPort 类要求端口名称以COM"开头,否则抛出异常.但是普通的 COM 端口都不起作用.而且我仍然不知道使用哪个波特率.我很困惑并被关在这里 - 我该怎么做才能弄清楚这件事?

Now I would like to use the SerialPort class in .NET to open the "D-Link..." port and talk with the USB modem, but the SerialPort class requires the port name to start with "COM", otherwise an exception is thrown. But none of the ordinary COM-ports work. And I still don't know which baud rate to use. I'm pretty much confused and locked up here - what could I do to get to the bottom of this?

推荐答案

好的,谢谢大家的想法和意见.我做了一些更多的研究,最后我意识到,为了做我想做的事,我根本不必为串行端口和 AT 命令而烦恼.所需要的只是执行几个 Windows RAS 调用.

Ok folks, thank you for all your thoughts and your input. I have done some more research, and finally i realized, that in order to do what i wanted i did not have to bother with serial ports and AT-commands at all. All that was needed was to do a few Windows RAS calls.

如果我的问题更具体一点,即我想用我的 AT 命令做什么,那么您肯定会在很久以前就告诉我 RAS!

If I had just been a bit more specific in my question about what I wanted to do with my AT-commands, you would surely have told me about RAS long time ago!

我找到了一个很好的 .Net DLL (DotRas),它封装了本地 Windows RAS 以供托管代码使用,它似乎可以满足我的需要(使用我连接的任何类型的 3G 调制解调器,从代码中拨打 3G 调制解调器连接).

I found a nice .Net DLL (DotRas) that wraps native Windows RAS for use from managed code, and it seems to do just what I need (dial a 3G modem connection from code, with any type of 3G modem I attach).

再次感谢您的宝贵时间.

Thank you again for your time.

这篇关于如何与 USB 3G 调制解调器通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)