Compare commits
No commits in common. "7bb4a6dc66e5ede9494fd1aa16b9e743853ae4d9" and "627374669343623431bc03307b224a121ddbeff6" have entirely different histories.
7bb4a6dc66
...
6273746693
@ -1057,9 +1057,8 @@ namespace AppServer
|
|||||||
catch (Exception exe)
|
catch (Exception exe)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#210#4#AppServer stoped#");
|
udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#4#AppServer stoped#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#4#AppServer stoped#").Length);
|
||||||
udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
@ -1106,9 +1105,8 @@ namespace AppServer
|
|||||||
errorOnScreen = true;
|
errorOnScreen = true;
|
||||||
error = true;
|
error = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#210#2#Dongle missing Application server stopped#");
|
udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#2#Dongle missing Application server stopped#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#2#Dongle missing Application server stopped#").Length);
|
||||||
udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
@ -1228,10 +1226,8 @@ namespace AppServer
|
|||||||
|
|
||||||
|
|
||||||
MainForm.websocketLocationQueue.PostItem(data);
|
MainForm.websocketLocationQueue.PostItem(data);
|
||||||
|
if(!sendWebsocketTimer.Enabled)
|
||||||
if (!sendWebsocketTimer.Enabled)
|
|
||||||
sendWebsocketTimer.Enabled = true;
|
sendWebsocketTimer.Enabled = true;
|
||||||
|
|
||||||
if (!checkWebsocketServerStatus.Enabled)
|
if (!checkWebsocketServerStatus.Enabled)
|
||||||
checkWebsocketServerStatus.Enabled = true;
|
checkWebsocketServerStatus.Enabled = true;
|
||||||
}
|
}
|
||||||
@ -1283,12 +1279,10 @@ namespace AppServer
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast($"#0.0#{Utils.enumConvertToString(MessageBusCmds.WebsocketStatusToMsgBus)}#offline#");
|
udp.Send(Utils.Convert_text_For_multicast($"#0.0#{Utils.enumConvertToString(MessageBusCmds.WebsocketStatusToMsgBus)}#offline#"),
|
||||||
udp.Send(dataToSend, dataToSend.Length);
|
Utils.Convert_text_For_multicast($"#0.0#{Utils.enumConvertToString(MessageBusCmds.WebsocketStatusToMsgBus)}#offline#").Length);
|
||||||
|
udp.Send(Utils.Convert_text_For_multicast("#0.0#210#4#Application server stopped#"),
|
||||||
|
Utils.Convert_text_For_multicast("#0.0#210#4#Application server stopped#").Length);
|
||||||
dataToSend = Utils.Convert_text_For_multicast("#0.0#210#4#Application server stopped#");
|
|
||||||
udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
@ -1303,9 +1297,8 @@ namespace AppServer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#210#5#Application server restart#");
|
udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#5#Application server restart#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#5#Application server restart#").Length);
|
||||||
udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
|
@ -606,8 +606,7 @@ namespace AppServer
|
|||||||
Utils.WriteLine("Radio disable was sent on " + sysPos.Gw_id + "." + sysPos.R_gw_id + " gateway", ConsoleColor.Cyan);
|
Utils.WriteLine("Radio disable was sent on " + sysPos.Gw_id + "." + sysPos.R_gw_id + " gateway", ConsoleColor.Cyan);
|
||||||
//send radio disable to GW
|
//send radio disable to GW
|
||||||
string test2 = "#150#" + dest + "#0#";
|
string test2 = "#150#" + dest + "#0#";
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0" + test2);
|
MainForm.udp.Send(Utils.Convert_text_For_multicast("#0.0" + test2), Utils.Convert_text_For_multicast("#0.0" + test2).Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -727,10 +726,8 @@ namespace AppServer
|
|||||||
int unitSC_ID = DBvehInfo.getSCID(radioID3.ToString());
|
int unitSC_ID = DBvehInfo.getSCID(radioID3.ToString());
|
||||||
UnitSysPosition sysPos = DBvehInfo.getSystemPosition(unitSC_ID);
|
UnitSysPosition sysPos = DBvehInfo.getSystemPosition(unitSC_ID);
|
||||||
string message = string.Format("Ticket no. {0} is no longer active!", dec3.delete_ticket_id);
|
string message = string.Format("Ticket no. {0} is no longer active!", dec3.delete_ticket_id);
|
||||||
string test1 = "#143#" + sysPos.Gw_id + "." + sysPos.R_gw_id + "." + radioID3 + "#" + message + "#" + 0 + "#";
|
string test1 = "#143#" + sysPos.Gw_id + "." + sysPos.R_gw_id + "." + radioID3 + "#" + message + "#" + 0 + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0"+test1), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0"+test1).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0" + test1);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
//send to email if was sms->email type
|
//send to email if was sms->email type
|
||||||
if (dec3.isEmail)
|
if (dec3.isEmail)
|
||||||
@ -752,9 +749,8 @@ namespace AppServer
|
|||||||
UnitSysPosition sysPos = DBvehInfo.getSystemPosition(unitSC_ID);
|
UnitSysPosition sysPos = DBvehInfo.getSystemPosition(unitSC_ID);
|
||||||
string dest = $"0.0.{radioID3}";
|
string dest = $"0.0.{radioID3}";
|
||||||
if (sysPos != null) dest = $"{sysPos.Gw_id}.{sysPos.R_gw_id}.{radioID3}";
|
if (sysPos != null) dest = $"{sysPos.Gw_id}.{sysPos.R_gw_id}.{radioID3}";
|
||||||
|
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#154#" + dest + "#");
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#154#" + dest + "#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#154#" + dest + "#").Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -931,10 +927,8 @@ namespace AppServer
|
|||||||
DBtel.AddTelemetryHist(radioID, tObj.Id, 1);
|
DBtel.AddTelemetryHist(radioID, tObj.Id, 1);
|
||||||
System.Threading.Thread.Sleep(100);
|
System.Threading.Thread.Sleep(100);
|
||||||
SM.Debug("Sending telemetry alarm to SD; digital:" + tObj.DigitalNr);
|
SM.Debug("Sending telemetry alarm to SD; digital:" + tObj.DigitalNr);
|
||||||
test = $"#140#{radioID}#{tObj.Name}#";
|
test = $"#140#{radioID}#{tObj.Name}#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0" + test), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0"+test).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0" + test);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -944,9 +938,8 @@ namespace AppServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IhaveData)
|
if (IhaveData)
|
||||||
{
|
{
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#154#" + dest + "#");
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#154#" + dest + "#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#154#" + dest + "#").Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -1039,9 +1032,8 @@ namespace AppServer
|
|||||||
object[] param = { dirBackup, posgresPath };
|
object[] param = { dirBackup, posgresPath };
|
||||||
bgWorkerDBbackup.RunWorkerAsync(param);
|
bgWorkerDBbackup.RunWorkerAsync(param);
|
||||||
|
|
||||||
//send ACK back to SUM
|
//send ACK back to SUM
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#71#1#");
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#71#1#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#71#1#").Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -1069,14 +1061,12 @@ namespace AppServer
|
|||||||
object[] param2 = { completeFileName, posgresPath };
|
object[] param2 = { completeFileName, posgresPath };
|
||||||
bgWorkerDBrestore.RunWorkerAsync(param2);
|
bgWorkerDBrestore.RunWorkerAsync(param2);
|
||||||
//send ACK back to SUM
|
//send ACK back to SUM
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#72#1#");
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#72#1#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#72#1#").Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SM.Debug("DB restored failed !!!" + "File " + completeFileName + " missing!!!");
|
SM.Debug("DB restored failed !!!" + "File " + completeFileName + " missing!!!");
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#62#0#");
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#62#0#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#62#0#").Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -1148,9 +1138,7 @@ namespace AppServer
|
|||||||
//send broadcast messages I'm back in business
|
//send broadcast messages I'm back in business
|
||||||
Utils.WriteLine(string.Format("receive 500 from radio: Gateway {0} is ON", ((RadioGateway)MainForm.RadioGWHash[key]).Name), ConsoleColor.Green);
|
Utils.WriteLine(string.Format("receive 500 from radio: Gateway {0} is ON", ((RadioGateway)MainForm.RadioGWHash[key]).Name), ConsoleColor.Green);
|
||||||
string test1 = "#501#" + tempArr[4] + "#" + tempArr[5] + "#" + "ON#" + ((RadioGateway)MainForm.RadioGWHash[key]).Name + "#";
|
string test1 = "#501#" + tempArr[4] + "#" + tempArr[5] + "#" + "ON#" + ((RadioGateway)MainForm.RadioGWHash[key]).Name + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + seqID4 + test1), SafeMobileLib.Utils.Convert_text_For_multicast("#" + seqID4 + test1).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + seqID4 + test1);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
((RadioGateway)MainForm.RadioGWHash[key]).Alive = true;
|
((RadioGateway)MainForm.RadioGWHash[key]).Alive = true;
|
||||||
((RadioGateway)MainForm.RadioGWHash[key]).LastUpdate = DateTime.UtcNow;
|
((RadioGateway)MainForm.RadioGWHash[key]).LastUpdate = DateTime.UtcNow;
|
||||||
@ -1177,9 +1165,7 @@ namespace AppServer
|
|||||||
string status = ((RadioGateway)(entry.Value)).Alive ? "ON" : "OFF";
|
string status = ((RadioGateway)(entry.Value)).Alive ? "ON" : "OFF";
|
||||||
Utils.WriteLine(string.Format("Response for SD request: Gateway {0} is {1}", ((RadioGateway)(entry.Value)).Name, status), status == "ON" ? ConsoleColor.Green : ConsoleColor.Red);
|
Utils.WriteLine(string.Format("Response for SD request: Gateway {0} is {1}", ((RadioGateway)(entry.Value)).Name, status), status == "ON" ? ConsoleColor.Green : ConsoleColor.Red);
|
||||||
string test1 = "#501#" + ((RadioGateway)(entry.Value)).Gw_id + "#" + ((RadioGateway)(entry.Value)).Id + "#" + status + "#" + ((RadioGateway)(entry.Value)).Name + "#";
|
string test1 = "#501#" + ((RadioGateway)(entry.Value)).Gw_id + "#" + ((RadioGateway)(entry.Value)).Id + "#" + status + "#" + ((RadioGateway)(entry.Value)).Name + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + "0.0" + test1), SafeMobileLib.Utils.Convert_text_For_multicast("#" + "0.0" + test1).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + "0.0" + test1);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1302,14 +1288,11 @@ namespace AppServer
|
|||||||
if (sysPos != null) dest = sysPos.Gw_id + "." + sysPos.R_gw_id + "." + radioID.ToString();
|
if (sysPos != null) dest = sysPos.Gw_id + "." + sysPos.R_gw_id + "." + radioID.ToString();
|
||||||
|
|
||||||
String test = "#154#" + dest + "#";
|
String test = "#154#" + dest + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + seqId + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + seqId + test).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + seqId + test);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
|
|
||||||
//send emergency alarm to SD
|
//send emergency alarm to SD
|
||||||
test = "#134#" + radioID.ToString() + "#" + emergencyType;
|
test = "#134#" + radioID.ToString() + "#" + emergencyType;
|
||||||
dataToSend = Utils.Convert_text_For_multicast("#" + seqId + test);
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + seqId + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + seqId + test).Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
|
|
||||||
((VehicleStatus)MainForm.VehicleHashStat[radioID]).curentStatus = Status_for_tab.EMERG;
|
((VehicleStatus)MainForm.VehicleHashStat[radioID]).curentStatus = Status_for_tab.EMERG;
|
||||||
((VehicleStatus)MainForm.VehicleHashStat[radioID]).lastArsTime = DateTime.Now;
|
((VehicleStatus)MainForm.VehicleHashStat[radioID]).lastArsTime = DateTime.Now;
|
||||||
@ -1390,9 +1373,7 @@ namespace AppServer
|
|||||||
UnitSysPosition tmpX = dbvehs.getSystemPosition(msg.sc_id_dest);
|
UnitSysPosition tmpX = dbvehs.getSystemPosition(msg.sc_id_dest);
|
||||||
//string test = "#143#" + tmpX.Gw_id + "." + tmpX.R_gw_id+"."+msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#";
|
//string test = "#143#" + tmpX.Gw_id + "." + tmpX.R_gw_id+"."+msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#";
|
||||||
string test = "#143#" + tmpX.Gw_id + "." + tmpX.R_gw_id + "." + msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#" + msg.dispatcherID + "#";
|
string test = "#143#" + tmpX.Gw_id + "." + tmpX.R_gw_id + "." + msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#" + msg.dispatcherID + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + msg.seq_id + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + msg.seq_id + test).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + msg.seq_id + test);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SM.Debug("message will be sent at a later time - schedule: " + msg.sched_timeGMT + " current:" + DateTime.Now.ToUniversalTime().DateTo70Format());
|
SM.Debug("message will be sent at a later time - schedule: " + msg.sched_timeGMT + " current:" + DateTime.Now.ToUniversalTime().DateTo70Format());
|
||||||
@ -1424,8 +1405,7 @@ namespace AppServer
|
|||||||
string test = "";
|
string test = "";
|
||||||
String cmdok = "";
|
String cmdok = "";
|
||||||
var subsBlackList = new List<int> { (int)Status_for_tab.OFF, (int)Status_for_tab.DISABLE, (int)Status_for_tab.MADEOFF };
|
var subsBlackList = new List<int> { (int)Status_for_tab.OFF, (int)Status_for_tab.DISABLE, (int)Status_for_tab.MADEOFF };
|
||||||
byte[] dataToSend = null;
|
|
||||||
|
|
||||||
foreach (smsmessage msg in smss)
|
foreach (smsmessage msg in smss)
|
||||||
{
|
{
|
||||||
long sc_id = msg.sc_id_dest;
|
long sc_id = msg.sc_id_dest;
|
||||||
@ -1436,10 +1416,8 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
if (SysPosList[sc_id]!=null)
|
if (SysPosList[sc_id]!=null)
|
||||||
test = "#143#" + ((UnitSysPosition)SysPosList[sc_id]).Gw_id + "." + ((UnitSysPosition)SysPosList[sc_id]).R_gw_id + "." + msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#" + msg.dispatcherID + "#";
|
test = "#143#" + ((UnitSysPosition)SysPosList[sc_id]).Gw_id + "." + ((UnitSysPosition)SysPosList[sc_id]).R_gw_id + "." + msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#" + msg.dispatcherID + "#";
|
||||||
else test = "#143#" + "0.0" + "." + msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#" + msg.dispatcherID + "#";
|
else test = "#143#" + "0.0" + "." + msg.imei_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#" + msg.dispatcherID + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + msg.seq_id + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + msg.seq_id + test).Length);
|
||||||
dataToSend = Utils.Convert_text_For_multicast("#" + msg.seq_id + test);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SM.Debug("message will be sent at a later time - schedule: " + msg.sched_timeGMT + " current:" + DateTime.Now.ToUniversalTime().DateTo70Format());
|
SM.Debug("message will be sent at a later time - schedule: " + msg.sched_timeGMT + " current:" + DateTime.Now.ToUniversalTime().DateTo70Format());
|
||||||
@ -1451,9 +1429,8 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
UnitSysPosition tmpX = dbvehs.getSystemPosition_for_group(msg.imei_dest);
|
UnitSysPosition tmpX = dbvehs.getSystemPosition_for_group(msg.imei_dest);
|
||||||
|
|
||||||
test = "#145#" + tmpX.Gw_id + "." + tmpX.R_gw_id + "." + msg.sc_id_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#";
|
test = "#145#" + tmpX.Gw_id + "." + tmpX.R_gw_id + "." + msg.sc_id_dest + "#" + msg.mess + "#" + msg.sched_timeGMT + "#";
|
||||||
dataToSend = Utils.Convert_text_For_multicast("#" + msg.seq_id + test);
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + msg.seq_id + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + msg.seq_id + test).Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.WriteLine($"Undelivered {undeliveredSMS} private messages and {smss.Count} group messages", ConsoleColor.White);
|
Utils.WriteLine($"Undelivered {undeliveredSMS} private messages and {smss.Count} group messages", ConsoleColor.White);
|
||||||
@ -1469,19 +1446,19 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
//Check4ExpiredTickets
|
//Check4ExpiredTickets
|
||||||
List<JobTickets> jtlist = new List<JobTickets>();
|
List<JobTickets> jtlist = new List<JobTickets>();
|
||||||
|
string list_of_id_text = "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DBTicketingManager DBT = new DBTicketingManager(Program.cfg.DB_IP, Program.cfg.DB_schema, Program.cfg.DB_user, Program.cfg.DB_passwd, Program.cfg.DB_port);
|
DBTicketingManager DBT = new DBTicketingManager(Program.cfg.DB_IP, Program.cfg.DB_schema, Program.cfg.DB_user, Program.cfg.DB_passwd, Program.cfg.DB_port);
|
||||||
List<Int32> ExpiredTicketsIdList = DBT.updateTicketExpireDate(DateTo70Format(DateTime.UtcNow));
|
List<Int32> ExpiredTicketsIdList = DBT.updateTicketExpireDate(DateTo70Format(DateTime.UtcNow));
|
||||||
if(ExpiredTicketsIdList.Count>0)
|
if(ExpiredTicketsIdList.Count>0)
|
||||||
{
|
{
|
||||||
|
foreach(Int32 id in ExpiredTicketsIdList)
|
||||||
// get comma separated list
|
{
|
||||||
string list_of_id_text = string.Join<string>(",", ExpiredTicketsIdList.Select(x => $"{x}"));
|
list_of_id_text += id + ",";
|
||||||
|
}
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast($"#0.0#251#{list_of_id_text}#");
|
list_of_id_text = list_of_id_text.Substring(0, list_of_id_text.Length - 1);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#251#" + list_of_id_text + "#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#251#" + list_of_id_text + "#").Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -1518,11 +1495,8 @@ namespace AppServer
|
|||||||
string message = string.Format("You need to finish job no.{0}, {1} in 10 minutes!", ticket.Ticket_id, ticket.Name);
|
string message = string.Format("You need to finish job no.{0}, {1} in 10 minutes!", ticket.Ticket_id, ticket.Name);
|
||||||
string head = "#143#0.0." + ticket.Imei + "#";
|
string head = "#143#0.0." + ticket.Imei + "#";
|
||||||
if (SysPosList[ticket.sc_id] != null) head = "#143#" + ((UnitSysPosition)SysPosList[ticket.sc_id]).Gw_id + "." + ((UnitSysPosition)SysPosList[ticket.sc_id]).R_gw_id + "." + ticket.Imei + "#";
|
if (SysPosList[ticket.sc_id] != null) head = "#143#" + ((UnitSysPosition)SysPosList[ticket.sc_id]).Gw_id + "." + ((UnitSysPosition)SysPosList[ticket.sc_id]).R_gw_id + "." + ticket.Imei + "#";
|
||||||
string test = head + message + "#" + 0 + "#";
|
string test = head + message + "#" + 0 + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + ticket.seq_id + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + ticket.seq_id + test).Length);
|
||||||
|
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + ticket.seq_id + test);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1547,9 +1521,8 @@ namespace AppServer
|
|||||||
string head = "#143#0.0." + ticket.Imei + "#";
|
string head = "#143#0.0." + ticket.Imei + "#";
|
||||||
if (SysPosList[ticket.sc_id] != null) head = "#143#" + ((UnitSysPosition)SysPosList[ticket.sc_id]).Gw_id + "." + ((UnitSysPosition)SysPosList[ticket.sc_id]).R_gw_id + "." + ticket.Imei + "#";
|
if (SysPosList[ticket.sc_id] != null) head = "#143#" + ((UnitSysPosition)SysPosList[ticket.sc_id]).Gw_id + "." + ((UnitSysPosition)SysPosList[ticket.sc_id]).R_gw_id + "." + ticket.Imei + "#";
|
||||||
|
|
||||||
string test = head + ticket.Name + "#" + 0 + "#";
|
string test = head + ticket.Name + "#" + 0 + "#";
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + ticket.seq_id + test);
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + ticket.seq_id + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + ticket.seq_id + test).Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SM.Debug("ticket will be sent at a later time - schedule: " + ticket.sched_timegmt + " current:" + DateTime.Now.ToUniversalTime().DateTo70Format());
|
SM.Debug("ticket will be sent at a later time - schedule: " + ticket.sched_timegmt + " current:" + DateTime.Now.ToUniversalTime().DateTo70Format());
|
||||||
@ -1580,10 +1553,8 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
if (DateTime.Now.ToUniversalTime() > item.Timegmt.AddSeconds(item.ArsInterval + 10))// added 10 seconds; marja erroare
|
if (DateTime.Now.ToUniversalTime() > item.Timegmt.AddSeconds(item.ArsInterval + 10))// added 10 seconds; marja erroare
|
||||||
{
|
{
|
||||||
SM.Debug("Unit:" + item.Imei + " ARS interval expired. Marking unit as OFF");
|
SM.Debug("Unit:" + item.Imei + " ARS interval expired. Marking unit as OFF");
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#130#" + item.Imei + "#OFF#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#130#" + item.Imei + "#OFF#").Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#130#" + item.Imei + "#OFF#");
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1629,9 +1600,7 @@ namespace AppServer
|
|||||||
|
|
||||||
|
|
||||||
string test = "#501#" + ((RadioGateway)(entry.Value)).Gw_id + "#" + ((RadioGateway)(entry.Value)).Id + "#" + "OFF" + "#" + ((RadioGateway)(entry.Value)).Name + "#";
|
string test = "#501#" + ((RadioGateway)(entry.Value)).Gw_id + "#" + ((RadioGateway)(entry.Value)).Id + "#" + "OFF" + "#" + ((RadioGateway)(entry.Value)).Name + "#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#" + "0.0" + test), SafeMobileLib.Utils.Convert_text_For_multicast("#" + "0.0" + test).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#" + "0.0" + test);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
((RadioGateway)(entry.Value)).Alive = false;
|
((RadioGateway)(entry.Value)).Alive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1716,9 +1685,7 @@ namespace AppServer
|
|||||||
public static void PushStatus(String IMEI,Status_for_tab stat)
|
public static void PushStatus(String IMEI,Status_for_tab stat)
|
||||||
{
|
{
|
||||||
Utils.WriteLine("Send PushStatus:" + stat+" Imei:"+IMEI,ConsoleColor.Yellow);
|
Utils.WriteLine("Send PushStatus:" + stat+" Imei:"+IMEI,ConsoleColor.Yellow);
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#153#" + IMEI + "#" + (Int32)stat + "#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#153#" + IMEI + "#" + (Int32)stat + "#").Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0#153#" + IMEI + "#" + (Int32)stat + "#");
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2116,9 +2083,8 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
messageOnScreen = true;
|
messageOnScreen = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#Application server database connection failed#");
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#Application server database connection failed#"), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0#210#3#Application server database connection failed#").Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
@ -2554,9 +2520,8 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
//send emergency alarm to SD
|
//send emergency alarm to SD
|
||||||
//send ACK back to GW
|
//send ACK back to GW
|
||||||
string code = (backupDOne == true) ? "#61#1#" : "#61#0#";
|
string test = (backupDOne == true) ? "#61#1#" : "#61#0#";
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0" + code);
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0" + test), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0" + test).Length);
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -2583,10 +2548,8 @@ namespace AppServer
|
|||||||
{
|
{
|
||||||
//send emergency alarm to SD
|
//send emergency alarm to SD
|
||||||
//send ACK back to GW
|
//send ACK back to GW
|
||||||
string code = (restoreDOne == true) ? "#62#1#" : "#252#0#";
|
string test = (restoreDOne == true) ? "#62#1#" : "#252#0#";
|
||||||
|
MainForm.udp.Send(SafeMobileLib.Utils.Convert_text_For_multicast("#0.0" + test), SafeMobileLib.Utils.Convert_text_For_multicast("#0.0" + test).Length);
|
||||||
byte[] dataToSend = Utils.Convert_text_For_multicast("#0.0" + code);
|
|
||||||
MainForm.udp.Send(dataToSend, dataToSend.Length);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -42,28 +42,36 @@ namespace SafeMobileLib
|
|||||||
recv = s.Receive(b);
|
recv = s.Receive(b);
|
||||||
else
|
else
|
||||||
break;//break if socket == null
|
break;//break if socket == null
|
||||||
|
|
||||||
if (recv == 0)
|
if (recv == 0)
|
||||||
continue;//continue if return nr bytes == 0
|
continue;//continue if return nr bytes == 0
|
||||||
|
|
||||||
|
if (OnNewDataRecv != null)
|
||||||
byte[] tmp = new byte[recv];
|
|
||||||
for (int i = 0; i < recv; i++)
|
|
||||||
{
|
{
|
||||||
tmp[i] = b[i];
|
byte[] tmp = new byte[recv];
|
||||||
|
for (int i = 0; i < recv; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = b[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] decByte = Encrypted ? Encryption.Decrypt(tmp, EncryptionAlgorithm.Des64) : tmp;
|
||||||
|
|
||||||
|
// trigger event
|
||||||
|
OnNewDataRecv(decByte, decByte.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] decByte = Encrypted ? Encryption.Decrypt(tmp, EncryptionAlgorithm.Des64) : tmp;
|
|
||||||
|
|
||||||
// trigger event
|
|
||||||
if (OnNewDataRecv != null)
|
|
||||||
OnNewDataRecv(decByte, decByte.Length);
|
|
||||||
|
|
||||||
|
|
||||||
// trigger event
|
|
||||||
if (OnNewDataReceived != null)
|
if (OnNewDataReceived != null)
|
||||||
|
{
|
||||||
|
byte[] tmp = new byte[recv];
|
||||||
|
for (int i = 0; i < recv; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = b[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] decByte = Encrypted ? Encryption.Decrypt(tmp, EncryptionAlgorithm.Des64) : tmp;
|
||||||
|
|
||||||
|
// trigger event
|
||||||
OnNewDataReceived(mcastGroup, decByte, decByte.Length);
|
OnNewDataReceived(mcastGroup, decByte, decByte.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (s == null)
|
if (s == null)
|
||||||
@ -100,19 +108,27 @@ namespace SafeMobileLib
|
|||||||
byte[] b = new byte[65507];
|
byte[] b = new byte[65507];
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
int recv = s.Receive(b);
|
int recv = s.Receive(b);
|
||||||
|
if (OnNewDataRecv != null)
|
||||||
byte[] tmp = new byte[recv];
|
|
||||||
for (int i = 0; i < recv; i++)
|
|
||||||
{
|
{
|
||||||
tmp[i] = b[i];
|
byte[] tmp = new byte[recv];
|
||||||
|
for (int i = 0; i < recv; i++)
|
||||||
|
{
|
||||||
|
tmp[i] = b[i];
|
||||||
|
}
|
||||||
|
if (this.OnNewDataRecv != null)
|
||||||
|
this.OnNewDataRecv(tmp, tmp.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.OnNewDataRecv != null)
|
if (OnNewDataReceived != null)
|
||||||
this.OnNewDataRecv(tmp, tmp.Length);
|
{
|
||||||
|
byte[] tmp = new byte[recv];
|
||||||
if (this.OnNewDataReceived != null)
|
for (int i = 0; i < recv; i++)
|
||||||
this.OnNewDataReceived(mcastGroup, tmp, tmp.Length);
|
{
|
||||||
|
tmp[i] = b[i];
|
||||||
|
}
|
||||||
|
if (this.OnNewDataReceived != null)
|
||||||
|
this.OnNewDataReceived(mcastGroup, tmp, tmp.Length);
|
||||||
|
}
|
||||||
|
|
||||||
if (s == null)
|
if (s == null)
|
||||||
{
|
{
|
||||||
@ -201,17 +217,16 @@ namespace SafeMobileLib
|
|||||||
IPEndPoint ipep = new IPEndPoint(myIP, port);
|
IPEndPoint ipep = new IPEndPoint(myIP, port);
|
||||||
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
|
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
|
||||||
s.Bind(ipep);
|
s.Bind(ipep);
|
||||||
|
|
||||||
IPAddress ip = IPAddress.Parse(mcastGroup);
|
IPAddress ip = IPAddress.Parse(mcastGroup);
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, myIP));
|
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, myIP));
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
s.SetSocketOption(SocketOptionLevel.IP,
|
||||||
|
SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
||||||
listenThread = new Thread(new ThreadStart(Listen));
|
listenThread = new Thread(new ThreadStart(Listen));
|
||||||
listenThread.IsBackground = true;
|
listenThread.IsBackground = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenThread != null)
|
if (listenThread != null)
|
||||||
listenThread.Start();
|
listenThread.Start();
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
Utils.WriteLine($"++++++++++++++++++++++++++++++++++++++++++\nUdpMulticast bind on {mcastGroup}:{port} Ethernet: {myIP}\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
Utils.WriteLine($"++++++++++++++++++++++++++++++++++++++++++\nUdpMulticast bind on {mcastGroup}:{port} Ethernet: {myIP}\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||||
@ -228,14 +243,12 @@ namespace SafeMobileLib
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
working = true;
|
working = true;
|
||||||
useThreadPool = true;
|
useThreadPool = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (s == null)
|
if (s == null)
|
||||||
{
|
{
|
||||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s != null)
|
if (s != null)
|
||||||
{
|
{
|
||||||
Utils.WriteLine(String.Format("[### {0:H:mm:ss} ###] Port multi cast {1}", DateTime.Now, port));
|
Utils.WriteLine(String.Format("[### {0:H:mm:ss} ###] Port multi cast {1}", DateTime.Now, port));
|
||||||
@ -244,7 +257,8 @@ namespace SafeMobileLib
|
|||||||
s.Bind(ipep);
|
s.Bind(ipep);
|
||||||
IPAddress ip = IPAddress.Parse(mcastGroup);
|
IPAddress ip = IPAddress.Parse(mcastGroup);
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, IPAddress.Any));
|
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, IPAddress.Any));
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
s.SetSocketOption(SocketOptionLevel.IP,
|
||||||
|
SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(new WaitCallback(Listen_pool));
|
ThreadPool.QueueUserWorkItem(new WaitCallback(Listen_pool));
|
||||||
|
|
||||||
@ -268,7 +282,6 @@ namespace SafeMobileLib
|
|||||||
{
|
{
|
||||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s != null)
|
if (s != null)
|
||||||
{
|
{
|
||||||
Utils.WriteLine(String.Format("[### {0:H:mm:ss} ###] Port multi cast {1}", DateTime.Now, port));
|
Utils.WriteLine(String.Format("[### {0:H:mm:ss} ###] Port multi cast {1}", DateTime.Now, port));
|
||||||
@ -277,14 +290,13 @@ namespace SafeMobileLib
|
|||||||
s.Bind(ipep);
|
s.Bind(ipep);
|
||||||
IPAddress ip = IPAddress.Parse(mcastGroup);
|
IPAddress ip = IPAddress.Parse(mcastGroup);
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, IPAddress.Any));
|
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, IPAddress.Any));
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
s.SetSocketOption(SocketOptionLevel.IP,
|
||||||
|
SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
||||||
listenThread = new Thread(new ThreadStart(Listen_Decoded));
|
listenThread = new Thread(new ThreadStart(Listen_Decoded));
|
||||||
listenThread.IsBackground = true;
|
listenThread.IsBackground = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenThread != null)
|
if (listenThread != null)
|
||||||
listenThread.Start();
|
listenThread.Start();
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
Loading…
Reference in New Issue
Block a user