Sending AT Command to a USB-Connected GPRS Modem in C#

徘徊边缘 提交于 2019-12-10 10:10:45

问题


Can anyone give me a good direction or guide on how I can access a GPRS modem that is connected to a Usb Port. Should I make a USB driver for my program to send AT command to the modem? or Is like a router where in i can access it using an IP address? thanks


回答1:


If its recognised by windows as a modem then the required drivers should automatically present it as a serial port, just like any other modem & you can communicate with it using its port name & System.IO.Ports.SerialPort. If you want to access the AT/GSM command set there are libraries like GSMComm.




回答2:


Typically, these devices mount themselves with a virtual serial port, that you can open, and send your commands to.




回答3:


Probably not useful to anymore, but when I plug-in my USB GPRS Modem, and install the software/drivers that came along with it, it created a virtual COM port.

Though it keeps changing after every reboot. Following code works for me.

var port = new System.IO.Ports.SerialPort();
.
.
port.WriteLine("AT+CREG=2");


来源:https://stackoverflow.com/questions/5937119/sending-at-command-to-a-usb-connected-gprs-modem-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!