开发者

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

开发者 https://www.devze.com 2023-03-04 11:56 出处:网络
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 开发者_StackOverflowmy program to send AT command to the m

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 开发者_StackOverflowmy program to send AT command to the modem? or Is like a router where in i can access it using an IP address? thanks


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.


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


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");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号