Compare commits
No commits in common. "5291e2cb5b40b862e36af6c9a0676561314fe08c" and "6737c17c27d41a71bf83c4e2ae07ef0fb90b2f7f" have entirely different histories.
5291e2cb5b
...
6737c17c27
@ -376,8 +376,34 @@ namespace MotoTrbo_GW
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void FetchAudioSettings()
|
private void ContinueConstructor()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!registeredIP)
|
||||||
|
{
|
||||||
|
tabVoice.Enabled = false;
|
||||||
|
|
||||||
|
DialogResult result = FeedbackRadMessageBox.ShowExclamation("Please register your copy of MotoTrbo Gateway using the Administrative Module.\n Your IP address is:" + YourIPaddress, "Info");
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
else if (registeredIP && !App.isValidVersion(APP_SERVER_VERSION,
|
||||||
|
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()))
|
||||||
|
{
|
||||||
|
DialogResult dr = RadMessageBox.Show("Please update your version of software to the latest one required by Application Server. Do you wish to update now?",
|
||||||
|
"Update required...", MessageBoxButtons.YesNo, RadMessageIcon.Exclamation);
|
||||||
|
|
||||||
|
if (dr == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
CheckForUpdate(true);
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get Audio settings
|
||||||
DBsettingsManager dbSettings = new DBsettingsManager(DBServer, DBSchema, DBUser, DBPass, DBPort);
|
DBsettingsManager dbSettings = new DBsettingsManager(DBServer, DBSchema, DBUser, DBPass, DBPort);
|
||||||
|
|
||||||
string tmpSamplaRate = dbSettings.getSettingValue(0, "sampleRate");
|
string tmpSamplaRate = dbSettings.getSettingValue(0, "sampleRate");
|
||||||
@ -408,99 +434,6 @@ namespace MotoTrbo_GW
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ContinueConstructor()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!registeredIP)
|
|
||||||
{
|
|
||||||
tabVoice.Enabled = false;
|
|
||||||
|
|
||||||
DialogResult result = FeedbackRadMessageBox.ShowExclamation("Please register your copy of MotoTrbo Gateway using the Administrative Module.\n Your IP address is:" + YourIPaddress, "Info");
|
|
||||||
if (result == DialogResult.OK)
|
|
||||||
Application.Exit();
|
|
||||||
}
|
|
||||||
else if (registeredIP && !App.isValidVersion(APP_SERVER_VERSION,
|
|
||||||
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()))
|
|
||||||
{
|
|
||||||
DialogResult dr = RadMessageBox.Show("Please update your version of software to the latest one required by Application Server. Do you wish to update now?",
|
|
||||||
"Update required...", MessageBoxButtons.YesNo, RadMessageIcon.Exclamation);
|
|
||||||
|
|
||||||
if (dr == DialogResult.Yes)
|
|
||||||
CheckForUpdate(true);
|
|
||||||
|
|
||||||
Application.Exit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//new code
|
|
||||||
List <Gateway> listGW = new List<Gateway>();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(DBServer))
|
|
||||||
{
|
|
||||||
listGW = getGWidFromDB(DBServer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (listGW.Count == 0)
|
|
||||||
{
|
|
||||||
DBServer = "127.0.0.1";
|
|
||||||
listGW = getGWidFromDB(DBServer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
SafeMobileLib.Utils.WriteLine("Ex on find automat the gateway ID:" + ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (listGW.Count == 0)
|
|
||||||
{
|
|
||||||
FeedbackRadMessageBox.ShowError("Gateway IP not present in DB\n\r Please go to Administrative module and register this GW with IP:!!!" + DBServer, "IP missing");
|
|
||||||
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GWID = ((Gateway)listGW[0]).Id;
|
|
||||||
source = new IniConfigSource(Main.CFG_FILE);
|
|
||||||
source.Configs["Gateway"].Set("id", GWID);
|
|
||||||
// source.Configs["NAI"].Set("peerID", ((Gateway)listGW[0]).Peer_id);
|
|
||||||
source.Save();
|
|
||||||
|
|
||||||
SafeMobileLib.Utils.WriteLine("Gateway ID is " + GWID, ConsoleColor.Cyan);
|
|
||||||
|
|
||||||
//SafeMobileLib.Utils.WriteLine("ID:" + GWID + " saved to config file.");
|
|
||||||
btGWID.Text = GWID.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
SafeMobileLib.Utils.WriteLine("DB error!!!");
|
|
||||||
SafeMobileLib.Utils.WriteLine(ex.ToString());
|
|
||||||
|
|
||||||
FeedbackRadMessageBox.ShowError("DB error.\n\rPlease turn down the firewall or add an exception for the Datebase in the firewall and try again!!!\n\r DB ip:" + DBServer,
|
|
||||||
"DB error");
|
|
||||||
|
|
||||||
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
//System.Windows.Forms.Application.Exit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//end of new code
|
|
||||||
|
|
||||||
|
|
||||||
// Get Audio settings
|
|
||||||
FetchAudioSettings();
|
|
||||||
|
|
||||||
|
|
||||||
//int asio driver object
|
//int asio driver object
|
||||||
if (Main.AudioDriver == AudioDriverType.Asio)
|
if (Main.AudioDriver == AudioDriverType.Asio)
|
||||||
@ -536,7 +469,91 @@ namespace MotoTrbo_GW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//old code
|
||||||
|
/*if (GWID == -1)
|
||||||
|
{
|
||||||
|
int id = getGWidFromDB(YourIPaddress);
|
||||||
|
if (id == -1)
|
||||||
|
{
|
||||||
|
RadMessageBox.Show("Gateway IP not present in DB\n\r Please go to Administrative module and register this GW with IP:!!!" + YourIPaddress, "IP missing", MessageBoxButtons.OK, RadMessageIcon.Error);
|
||||||
|
System.Environment.Exit(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GWID = id;
|
||||||
|
source = new IniConfigSource(Main.CFG_FILE);
|
||||||
|
source.Configs["Gateway"].Set("id", id);
|
||||||
|
source.Save();
|
||||||
|
SafeMobileLib.Utils.WriteLine("ID:" + id +" saved to config file.");
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//new code
|
||||||
|
List <Gateway> listGW = new List<Gateway>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
listGW = getGWidFromDB(YourIPaddress);
|
||||||
|
|
||||||
|
if (listGW.Count == 0)
|
||||||
|
{
|
||||||
|
if (DBServer.Contains("127.0.0.1") || (DBServer.ToUpper().Contains("LOCALHOST")))
|
||||||
|
listGW = getGWidFromDB("127.0.0.1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GWID != -1)
|
||||||
|
{
|
||||||
|
Boolean find = false;
|
||||||
|
foreach (Gateway obj in listGW)
|
||||||
|
if (obj.Id == GWID) { find = true; break; }
|
||||||
|
if ((!find) && (DBServer.Contains("127.0.0.1") || (DBServer.ToUpper().Contains("LOCALHOST"))))
|
||||||
|
listGW = getGWidFromDB("127.0.0.1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SafeMobileLib.Utils.WriteLine("Ex on find automat the gateway ID:" + ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (listGW.Count == 0)
|
||||||
|
{
|
||||||
|
FeedbackRadMessageBox.ShowError("Gateway IP not present in DB\n\r Please go to Administrative module and register this GW with IP:!!!" + YourIPaddress, "IP missing");
|
||||||
|
|
||||||
|
System.Environment.Exit(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GWID = ((Gateway)listGW[0]).Id;
|
||||||
|
source = new IniConfigSource(Main.CFG_FILE);
|
||||||
|
source.Configs["Gateway"].Set("id", GWID);
|
||||||
|
// source.Configs["NAI"].Set("peerID", ((Gateway)listGW[0]).Peer_id);
|
||||||
|
source.Save();
|
||||||
|
|
||||||
|
SafeMobileLib.Utils.WriteLine("Gateway ID is " + GWID, ConsoleColor.Cyan);
|
||||||
|
|
||||||
|
//SafeMobileLib.Utils.WriteLine("ID:" + GWID + " saved to config file.");
|
||||||
|
btGWID.Text = GWID.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SafeMobileLib.Utils.WriteLine("DB error!!!");
|
||||||
|
SafeMobileLib.Utils.WriteLine(ex.ToString());
|
||||||
|
|
||||||
|
FeedbackRadMessageBox.ShowError("DB error.\n\rPlease turn down the firewall or add an exception for the Datebase in the firewall and try again!!!\n\r DB ip:" + YourIPaddress,
|
||||||
|
"DB error");
|
||||||
|
|
||||||
|
|
||||||
|
System.Environment.Exit(0);
|
||||||
|
//System.Windows.Forms.Application.Exit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//end of new code
|
||||||
|
|
||||||
/*try
|
/*try
|
||||||
{
|
{
|
||||||
@ -1257,7 +1274,7 @@ because base station {radioGwID} failed to send PTT", ConsoleColor.Red);
|
|||||||
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(Main.ApplicationServer), registrationPort);
|
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(Main.ApplicationServer), registrationPort);
|
||||||
client.Connect(serverEndPoint);
|
client.Connect(serverEndPoint);
|
||||||
NetworkStream clientStream = client.GetStream();
|
NetworkStream clientStream = client.GetStream();
|
||||||
YourIPaddress = (client.Client.LocalEndPoint.ToString().Split(":".ToCharArray()))[0];
|
YourIPaddress = (client.Client.LocalEndPoint.ToString().Split(':'))[0];
|
||||||
|
|
||||||
Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user