Reputation: 31
How to autodetect or autoconnect the port that is connected by GSM Modem. Assuming that I already have the variables. What I want to do is that I don't want to set the portName that it will automatically get the portName. Please help!!! Thanks in advance!
using GsmComm.GsmCommunication;
using GsmComm.PduConverter;
using GsmComm.PduConverter.SmartMessaging;
using GsmComm.Interfaces;
using GsmComm.Server;
public void SetData(string portName, int baudRate, int timeout)
{
this.portName = portName;
this.baudRate = baudRate;
this.timeout = timeout;
}
public void GetData(out string portName, out int baudRate, out int timeout)
{
portName = this.portName;
baudRate = this.baudRate;
timeout = this.timeout;
}
private void FormLoad(object sender, EventArgs e)
{
portName = "COM43";
baudRate = 9600;
timeout = 300;
comm = new GsmCommMain(portName, baudRate, timeout);
comm.Open();
}
Upvotes: 0
Views: 2131
Reputation: 1455
You can cycle through all the COM ports in the system (their list is easily get programmatically) and send command receiving GSM modem version or model (as i remember yo can do it via GsmComm library).
Upvotes: 1