Im read thread and find similar problem.
My Cobra with FW 4.1.7.0 need exactly 30 seconds to estabilish connection. In my project I using Motorola G24 modem, on start INIt all settings, unlock SIM(If is PIN locked) and start connecting.
Connecting method look like this:
Log.WriteDebugLog("Network.Modem.Connect() - Dial-in using AT commands");
modem.Write(new byte[] { 0x7E, 0xFF, 0x7D, 0x23, 0xC0, 0x21, 0x7D, 0x25, 0x7D, 0x2A, 0x7D, 0x20, 0x7D, 0x30, 0x2B, 0xD3, 0x45, 0xAF, 0x7D, 0x20, 0x3C, 0xCD, 0x74, 0x7D, 0x20, 0x7D, 0x20, 0x7D, 0x20, 0x7D, 0x20, 0x2A, 0x9D, 0x7E }, 0, 34);// Terminate request
modem.DiscardInBuffer();
//Setup GPRS PDP Context
bool returnPDP = Write(modem, "AT+CGDCONT=1,\"IP\",\"" + APN + "\"", "OK");
modem.DiscardInBuffer();
modem.Write(Encoding.UTF8.GetBytes("ATD*99***1#\r"), 0, 12);
Thread.Sleep(100);
if (!PPP.IsEnabled)
{
Log.WriteDebugLog("Network.Modem.Connect() - Enabling PPP");
PPP.Enable(modem);
Log.WriteDebugLog("Network.Modem.Connect() - Enabling PPP Completed");
}
if (!PPP.IsLinkConnected)
{
Log.WriteDebugLog("Network.Modem.Connect() - PPP Link is not connected");
PPP.ConnectionStatus status = PPP.Connect(Username, Password);
if (status == PPP.ConnectionStatus.Connected)
{
Log.WriteDebugLog("Network.Modem.Connect() - PPP Connected");
Network.netif = NetworkInterface.GetAllNetworkInterfaces();
Debug.Print("PPP Network settings:");
Debug.Print("IP Address: " + netif[0].IPAddress);
Debug.Print("Subnet Mask: " + netif[0].SubnetMask);
Debug.Print("Default Getway: " + netif[0].GatewayAddress);
Debug.Print("DNS Server: " + netif[0].DnsAddresses[0]);
network_is_read = true;
}
else if (status == PPP.ConnectionStatus.Authentication_Faild)
{
Log.WriteDebugLog("Network.Modem.Connect() - PPP Authentication Failed");
}
else if (status == PPP.ConnectionStatus.Connection_Faild)
{
Log.WriteDebugLog("Network.Modem.Connect() - PPP Connection Failed");
}
}
My network provider need APN, Username and Password to estabilish connection. Settings are public avalible so I use:
APN="internet"
Username="mobitel"
Password=“internet”
modem is connected to COM2 with baudrate 115200, 8N1, Handshake=RequestToSend.
Log file from Cobra:
01/03/2009 20:42:47: Network.Modem.UnlockSIM() - SIM Ready
01/03/2009 20:42:47: Network.Modem.Connect() - Dial-in using AT commands
01/03/2009 20:42:47: Network.Modem.Connect() - Enabling PPP
01/03/2009 20:42:48: Network.Modem.Connect() - Enabling PPP Completed
01/03/2009 20:42:48: Network.Modem.Connect() - PPP Link is not connected
01/03/2009 20:43:18: Network - PPP connection was established!
01/03/2009 20:43:18: Network.Modem.Connect() - PPP Connected
PPP Network settings:
IP Address: 188.196.99.100
Subnet Mask: 255.255.255.0
Default Getway: 192.168.100.101
DNS Server: 213.229.249.161
Any sugestion or fix?