Sending AT Command to a USB-Connected GPRS Modem i

2019-05-10 15:10发布

问题:

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