Compare commits
No commits in common. "96b2bf8b22905fb820b011262da5ba218dc57587" and "ce69fef4568fc8d506d00a5866412ddb4c6d3dee" have entirely different histories.
96b2bf8b22
...
ce69fef456
@ -1 +0,0 @@
|
|||||||
12
|
|
@ -1 +0,0 @@
|
|||||||
12
|
|
@ -1,698 +0,0 @@
|
|||||||
namespace Simulator_CS_GTW
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
|
||||||
this.cbPP = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntPP = new System.Windows.Forms.TextBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.panel2 = new System.Windows.Forms.Panel();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntUnitReq = new System.Windows.Forms.TextBox();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.cbUnitReq = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel3 = new System.Windows.Forms.Panel();
|
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntTMReq = new System.Windows.Forms.TextBox();
|
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
|
||||||
this.cbTMReq = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel4 = new System.Windows.Forms.Panel();
|
|
||||||
this.label7 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntPollReq = new System.Windows.Forms.TextBox();
|
|
||||||
this.label8 = new System.Windows.Forms.Label();
|
|
||||||
this.cbPollReq = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel5 = new System.Windows.Forms.Panel();
|
|
||||||
this.label9 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntCSListReq = new System.Windows.Forms.TextBox();
|
|
||||||
this.label10 = new System.Windows.Forms.Label();
|
|
||||||
this.cbCSListReq = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel6 = new System.Windows.Forms.Panel();
|
|
||||||
this.label11 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntTMRep = new System.Windows.Forms.TextBox();
|
|
||||||
this.label12 = new System.Windows.Forms.Label();
|
|
||||||
this.cbTMRep = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel7 = new System.Windows.Forms.Panel();
|
|
||||||
this.label13 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntPosRep = new System.Windows.Forms.TextBox();
|
|
||||||
this.label14 = new System.Windows.Forms.Label();
|
|
||||||
this.cbPosRep = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel8 = new System.Windows.Forms.Panel();
|
|
||||||
this.label15 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntARSRep = new System.Windows.Forms.TextBox();
|
|
||||||
this.label16 = new System.Windows.Forms.Label();
|
|
||||||
this.cbARSRep = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel9 = new System.Windows.Forms.Panel();
|
|
||||||
this.label17 = new System.Windows.Forms.Label();
|
|
||||||
this.tbIntPollRep = new System.Windows.Forms.TextBox();
|
|
||||||
this.label18 = new System.Windows.Forms.Label();
|
|
||||||
this.cbPollRep = new System.Windows.Forms.CheckBox();
|
|
||||||
this.textBoxSerial = new System.Windows.Forms.TextBox();
|
|
||||||
this.label19 = new System.Windows.Forms.Label();
|
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
|
||||||
this.panel1.SuspendLayout();
|
|
||||||
this.panel2.SuspendLayout();
|
|
||||||
this.panel3.SuspendLayout();
|
|
||||||
this.panel4.SuspendLayout();
|
|
||||||
this.panel5.SuspendLayout();
|
|
||||||
this.panel6.SuspendLayout();
|
|
||||||
this.panel7.SuspendLayout();
|
|
||||||
this.panel8.SuspendLayout();
|
|
||||||
this.panel9.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// cbPP
|
|
||||||
//
|
|
||||||
this.cbPP.AutoSize = true;
|
|
||||||
this.cbPP.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbPP.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbPP.Name = "cbPP";
|
|
||||||
this.cbPP.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbPP.TabIndex = 0;
|
|
||||||
this.cbPP.Text = "is Enabled";
|
|
||||||
this.cbPP.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
this.panel1.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel1.Controls.Add(this.label2);
|
|
||||||
this.panel1.Controls.Add(this.tbIntPP);
|
|
||||||
this.panel1.Controls.Add(this.label1);
|
|
||||||
this.panel1.Controls.Add(this.cbPP);
|
|
||||||
this.panel1.Location = new System.Drawing.Point(0, 30);
|
|
||||||
this.panel1.Name = "panel1";
|
|
||||||
this.panel1.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel1.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label2.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label2.TabIndex = 3;
|
|
||||||
this.label2.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntPP
|
|
||||||
//
|
|
||||||
this.tbIntPP.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntPP.Name = "tbIntPP";
|
|
||||||
this.tbIntPP.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntPP.TabIndex = 2;
|
|
||||||
this.tbIntPP.Text = "5";
|
|
||||||
this.tbIntPP.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label1.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label1.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(65, 13);
|
|
||||||
this.label1.TabIndex = 1;
|
|
||||||
this.label1.Text = "Ping-Pong";
|
|
||||||
//
|
|
||||||
// panel2
|
|
||||||
//
|
|
||||||
this.panel2.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel2.Controls.Add(this.label3);
|
|
||||||
this.panel2.Controls.Add(this.tbIntUnitReq);
|
|
||||||
this.panel2.Controls.Add(this.label4);
|
|
||||||
this.panel2.Controls.Add(this.cbUnitReq);
|
|
||||||
this.panel2.Location = new System.Drawing.Point(0, 62);
|
|
||||||
this.panel2.Name = "panel2";
|
|
||||||
this.panel2.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel2.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label3.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label3.TabIndex = 3;
|
|
||||||
this.label3.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntUnitReq
|
|
||||||
//
|
|
||||||
this.tbIntUnitReq.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntUnitReq.Name = "tbIntUnitReq";
|
|
||||||
this.tbIntUnitReq.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntUnitReq.TabIndex = 2;
|
|
||||||
this.tbIntUnitReq.Text = "5";
|
|
||||||
this.tbIntUnitReq.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label4.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label4.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(81, 13);
|
|
||||||
this.label4.TabIndex = 1;
|
|
||||||
this.label4.Text = "Unit Request";
|
|
||||||
//
|
|
||||||
// cbUnitReq
|
|
||||||
//
|
|
||||||
this.cbUnitReq.AutoSize = true;
|
|
||||||
this.cbUnitReq.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbUnitReq.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbUnitReq.Name = "cbUnitReq";
|
|
||||||
this.cbUnitReq.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbUnitReq.TabIndex = 0;
|
|
||||||
this.cbUnitReq.Text = "is Enabled";
|
|
||||||
this.cbUnitReq.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel3
|
|
||||||
//
|
|
||||||
this.panel3.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel3.Controls.Add(this.label5);
|
|
||||||
this.panel3.Controls.Add(this.tbIntTMReq);
|
|
||||||
this.panel3.Controls.Add(this.label6);
|
|
||||||
this.panel3.Controls.Add(this.cbTMReq);
|
|
||||||
this.panel3.Location = new System.Drawing.Point(0, 94);
|
|
||||||
this.panel3.Name = "panel3";
|
|
||||||
this.panel3.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel3.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// label5
|
|
||||||
//
|
|
||||||
this.label5.AutoSize = true;
|
|
||||||
this.label5.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label5.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label5.Name = "label5";
|
|
||||||
this.label5.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label5.TabIndex = 3;
|
|
||||||
this.label5.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntTMReq
|
|
||||||
//
|
|
||||||
this.tbIntTMReq.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntTMReq.Name = "tbIntTMReq";
|
|
||||||
this.tbIntTMReq.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntTMReq.TabIndex = 2;
|
|
||||||
this.tbIntTMReq.Text = "5";
|
|
||||||
this.tbIntTMReq.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label6
|
|
||||||
//
|
|
||||||
this.label6.AutoSize = true;
|
|
||||||
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label6.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label6.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label6.Name = "label6";
|
|
||||||
this.label6.Size = new System.Drawing.Size(137, 13);
|
|
||||||
this.label6.TabIndex = 1;
|
|
||||||
this.label6.Text = "Text Message Request";
|
|
||||||
//
|
|
||||||
// cbTMReq
|
|
||||||
//
|
|
||||||
this.cbTMReq.AutoSize = true;
|
|
||||||
this.cbTMReq.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbTMReq.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbTMReq.Name = "cbTMReq";
|
|
||||||
this.cbTMReq.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbTMReq.TabIndex = 0;
|
|
||||||
this.cbTMReq.Text = "is Enabled";
|
|
||||||
this.cbTMReq.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel4
|
|
||||||
//
|
|
||||||
this.panel4.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel4.Controls.Add(this.label7);
|
|
||||||
this.panel4.Controls.Add(this.tbIntPollReq);
|
|
||||||
this.panel4.Controls.Add(this.label8);
|
|
||||||
this.panel4.Controls.Add(this.cbPollReq);
|
|
||||||
this.panel4.Location = new System.Drawing.Point(0, 126);
|
|
||||||
this.panel4.Name = "panel4";
|
|
||||||
this.panel4.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel4.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// label7
|
|
||||||
//
|
|
||||||
this.label7.AutoSize = true;
|
|
||||||
this.label7.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label7.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label7.Name = "label7";
|
|
||||||
this.label7.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label7.TabIndex = 3;
|
|
||||||
this.label7.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntPollReq
|
|
||||||
//
|
|
||||||
this.tbIntPollReq.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntPollReq.Name = "tbIntPollReq";
|
|
||||||
this.tbIntPollReq.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntPollReq.TabIndex = 2;
|
|
||||||
this.tbIntPollReq.Text = "5";
|
|
||||||
this.tbIntPollReq.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label8
|
|
||||||
//
|
|
||||||
this.label8.AutoSize = true;
|
|
||||||
this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label8.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label8.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label8.Name = "label8";
|
|
||||||
this.label8.Size = new System.Drawing.Size(79, 13);
|
|
||||||
this.label8.TabIndex = 1;
|
|
||||||
this.label8.Text = "Poll Request";
|
|
||||||
//
|
|
||||||
// cbPollReq
|
|
||||||
//
|
|
||||||
this.cbPollReq.AutoSize = true;
|
|
||||||
this.cbPollReq.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbPollReq.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbPollReq.Name = "cbPollReq";
|
|
||||||
this.cbPollReq.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbPollReq.TabIndex = 0;
|
|
||||||
this.cbPollReq.Text = "is Enabled";
|
|
||||||
this.cbPollReq.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel5
|
|
||||||
//
|
|
||||||
this.panel5.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel5.Controls.Add(this.label9);
|
|
||||||
this.panel5.Controls.Add(this.tbIntCSListReq);
|
|
||||||
this.panel5.Controls.Add(this.label10);
|
|
||||||
this.panel5.Controls.Add(this.cbCSListReq);
|
|
||||||
this.panel5.Location = new System.Drawing.Point(0, 158);
|
|
||||||
this.panel5.Name = "panel5";
|
|
||||||
this.panel5.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel5.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// label9
|
|
||||||
//
|
|
||||||
this.label9.AutoSize = true;
|
|
||||||
this.label9.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label9.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label9.Name = "label9";
|
|
||||||
this.label9.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label9.TabIndex = 3;
|
|
||||||
this.label9.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntCSListReq
|
|
||||||
//
|
|
||||||
this.tbIntCSListReq.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntCSListReq.Name = "tbIntCSListReq";
|
|
||||||
this.tbIntCSListReq.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntCSListReq.TabIndex = 2;
|
|
||||||
this.tbIntCSListReq.Text = "5";
|
|
||||||
this.tbIntCSListReq.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label10
|
|
||||||
//
|
|
||||||
this.label10.AutoSize = true;
|
|
||||||
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label10.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label10.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label10.Name = "label10";
|
|
||||||
this.label10.Size = new System.Drawing.Size(98, 13);
|
|
||||||
this.label10.TabIndex = 1;
|
|
||||||
this.label10.Text = "CS List Request";
|
|
||||||
//
|
|
||||||
// cbCSListReq
|
|
||||||
//
|
|
||||||
this.cbCSListReq.AutoSize = true;
|
|
||||||
this.cbCSListReq.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbCSListReq.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbCSListReq.Name = "cbCSListReq";
|
|
||||||
this.cbCSListReq.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbCSListReq.TabIndex = 0;
|
|
||||||
this.cbCSListReq.Text = "is Enabled";
|
|
||||||
this.cbCSListReq.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel6
|
|
||||||
//
|
|
||||||
this.panel6.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel6.Controls.Add(this.label11);
|
|
||||||
this.panel6.Controls.Add(this.tbIntTMRep);
|
|
||||||
this.panel6.Controls.Add(this.label12);
|
|
||||||
this.panel6.Controls.Add(this.cbTMRep);
|
|
||||||
this.panel6.Location = new System.Drawing.Point(0, 190);
|
|
||||||
this.panel6.Name = "panel6";
|
|
||||||
this.panel6.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel6.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// label11
|
|
||||||
//
|
|
||||||
this.label11.AutoSize = true;
|
|
||||||
this.label11.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label11.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label11.Name = "label11";
|
|
||||||
this.label11.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label11.TabIndex = 3;
|
|
||||||
this.label11.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntTMRep
|
|
||||||
//
|
|
||||||
this.tbIntTMRep.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntTMRep.Name = "tbIntTMRep";
|
|
||||||
this.tbIntTMRep.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntTMRep.TabIndex = 2;
|
|
||||||
this.tbIntTMRep.Text = "5";
|
|
||||||
this.tbIntTMRep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label12
|
|
||||||
//
|
|
||||||
this.label12.AutoSize = true;
|
|
||||||
this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label12.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label12.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label12.Name = "label12";
|
|
||||||
this.label12.Size = new System.Drawing.Size(128, 13);
|
|
||||||
this.label12.TabIndex = 1;
|
|
||||||
this.label12.Text = "Text Message Report";
|
|
||||||
//
|
|
||||||
// cbTMRep
|
|
||||||
//
|
|
||||||
this.cbTMRep.AutoSize = true;
|
|
||||||
this.cbTMRep.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbTMRep.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbTMRep.Name = "cbTMRep";
|
|
||||||
this.cbTMRep.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbTMRep.TabIndex = 0;
|
|
||||||
this.cbTMRep.Text = "is Enabled";
|
|
||||||
this.cbTMRep.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel7
|
|
||||||
//
|
|
||||||
this.panel7.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel7.Controls.Add(this.label13);
|
|
||||||
this.panel7.Controls.Add(this.tbIntPosRep);
|
|
||||||
this.panel7.Controls.Add(this.label14);
|
|
||||||
this.panel7.Controls.Add(this.cbPosRep);
|
|
||||||
this.panel7.Location = new System.Drawing.Point(0, 222);
|
|
||||||
this.panel7.Name = "panel7";
|
|
||||||
this.panel7.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel7.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// label13
|
|
||||||
//
|
|
||||||
this.label13.AutoSize = true;
|
|
||||||
this.label13.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label13.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label13.Name = "label13";
|
|
||||||
this.label13.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label13.TabIndex = 3;
|
|
||||||
this.label13.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntPosRep
|
|
||||||
//
|
|
||||||
this.tbIntPosRep.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntPosRep.Name = "tbIntPosRep";
|
|
||||||
this.tbIntPosRep.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntPosRep.TabIndex = 2;
|
|
||||||
this.tbIntPosRep.Text = "5";
|
|
||||||
this.tbIntPosRep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label14
|
|
||||||
//
|
|
||||||
this.label14.AutoSize = true;
|
|
||||||
this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label14.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label14.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label14.Name = "label14";
|
|
||||||
this.label14.Size = new System.Drawing.Size(94, 13);
|
|
||||||
this.label14.TabIndex = 1;
|
|
||||||
this.label14.Text = "Position Report";
|
|
||||||
//
|
|
||||||
// cbPosRep
|
|
||||||
//
|
|
||||||
this.cbPosRep.AutoSize = true;
|
|
||||||
this.cbPosRep.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbPosRep.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbPosRep.Name = "cbPosRep";
|
|
||||||
this.cbPosRep.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbPosRep.TabIndex = 0;
|
|
||||||
this.cbPosRep.Text = "is Enabled";
|
|
||||||
this.cbPosRep.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel8
|
|
||||||
//
|
|
||||||
this.panel8.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel8.Controls.Add(this.label15);
|
|
||||||
this.panel8.Controls.Add(this.tbIntARSRep);
|
|
||||||
this.panel8.Controls.Add(this.label16);
|
|
||||||
this.panel8.Controls.Add(this.cbARSRep);
|
|
||||||
this.panel8.Location = new System.Drawing.Point(0, 254);
|
|
||||||
this.panel8.Name = "panel8";
|
|
||||||
this.panel8.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel8.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// label15
|
|
||||||
//
|
|
||||||
this.label15.AutoSize = true;
|
|
||||||
this.label15.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label15.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label15.Name = "label15";
|
|
||||||
this.label15.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label15.TabIndex = 3;
|
|
||||||
this.label15.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntARSRep
|
|
||||||
//
|
|
||||||
this.tbIntARSRep.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntARSRep.Name = "tbIntARSRep";
|
|
||||||
this.tbIntARSRep.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntARSRep.TabIndex = 2;
|
|
||||||
this.tbIntARSRep.Text = "5";
|
|
||||||
this.tbIntARSRep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label16
|
|
||||||
//
|
|
||||||
this.label16.AutoSize = true;
|
|
||||||
this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label16.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label16.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label16.Name = "label16";
|
|
||||||
this.label16.Size = new System.Drawing.Size(74, 13);
|
|
||||||
this.label16.TabIndex = 1;
|
|
||||||
this.label16.Text = "ARS Report";
|
|
||||||
//
|
|
||||||
// cbARSRep
|
|
||||||
//
|
|
||||||
this.cbARSRep.AutoSize = true;
|
|
||||||
this.cbARSRep.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbARSRep.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbARSRep.Name = "cbARSRep";
|
|
||||||
this.cbARSRep.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbARSRep.TabIndex = 0;
|
|
||||||
this.cbARSRep.Text = "is Enabled";
|
|
||||||
this.cbARSRep.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// panel9
|
|
||||||
//
|
|
||||||
this.panel9.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.panel9.Controls.Add(this.label17);
|
|
||||||
this.panel9.Controls.Add(this.tbIntPollRep);
|
|
||||||
this.panel9.Controls.Add(this.label18);
|
|
||||||
this.panel9.Controls.Add(this.cbPollRep);
|
|
||||||
this.panel9.Location = new System.Drawing.Point(0, 286);
|
|
||||||
this.panel9.Name = "panel9";
|
|
||||||
this.panel9.Size = new System.Drawing.Size(436, 32);
|
|
||||||
this.panel9.TabIndex = 10;
|
|
||||||
this.panel9.Visible = false;
|
|
||||||
//
|
|
||||||
// label17
|
|
||||||
//
|
|
||||||
this.label17.AutoSize = true;
|
|
||||||
this.label17.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label17.Location = new System.Drawing.Point(350, 9);
|
|
||||||
this.label17.Name = "label17";
|
|
||||||
this.label17.Size = new System.Drawing.Size(42, 13);
|
|
||||||
this.label17.TabIndex = 3;
|
|
||||||
this.label17.Text = "Interval";
|
|
||||||
//
|
|
||||||
// tbIntPollRep
|
|
||||||
//
|
|
||||||
this.tbIntPollRep.Location = new System.Drawing.Point(398, 6);
|
|
||||||
this.tbIntPollRep.Name = "tbIntPollRep";
|
|
||||||
this.tbIntPollRep.Size = new System.Drawing.Size(35, 20);
|
|
||||||
this.tbIntPollRep.TabIndex = 2;
|
|
||||||
this.tbIntPollRep.Text = "5";
|
|
||||||
this.tbIntPollRep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label18
|
|
||||||
//
|
|
||||||
this.label18.AutoSize = true;
|
|
||||||
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label18.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label18.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.label18.Name = "label18";
|
|
||||||
this.label18.Size = new System.Drawing.Size(70, 13);
|
|
||||||
this.label18.TabIndex = 1;
|
|
||||||
this.label18.Text = "Poll Report";
|
|
||||||
//
|
|
||||||
// cbPollRep
|
|
||||||
//
|
|
||||||
this.cbPollRep.AutoSize = true;
|
|
||||||
this.cbPollRep.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbPollRep.Location = new System.Drawing.Point(165, 8);
|
|
||||||
this.cbPollRep.Name = "cbPollRep";
|
|
||||||
this.cbPollRep.Size = new System.Drawing.Size(75, 17);
|
|
||||||
this.cbPollRep.TabIndex = 0;
|
|
||||||
this.cbPollRep.Text = "is Enabled";
|
|
||||||
this.cbPollRep.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// textBoxSerial
|
|
||||||
//
|
|
||||||
this.textBoxSerial.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.textBoxSerial.Location = new System.Drawing.Point(165, 4);
|
|
||||||
this.textBoxSerial.Name = "textBoxSerial";
|
|
||||||
this.textBoxSerial.Size = new System.Drawing.Size(124, 20);
|
|
||||||
this.textBoxSerial.TabIndex = 11;
|
|
||||||
this.textBoxSerial.Text = "005G8544W550";
|
|
||||||
this.textBoxSerial.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
//
|
|
||||||
// label19
|
|
||||||
//
|
|
||||||
this.label19.AutoSize = true;
|
|
||||||
this.label19.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label19.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label19.Location = new System.Drawing.Point(3, 7);
|
|
||||||
this.label19.Name = "label19";
|
|
||||||
this.label19.Size = new System.Drawing.Size(86, 13);
|
|
||||||
this.label19.TabIndex = 12;
|
|
||||||
this.label19.Text = "Serial Number";
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
this.button1.Location = new System.Drawing.Point(353, 1);
|
|
||||||
this.button1.Name = "button1";
|
|
||||||
this.button1.Size = new System.Drawing.Size(77, 23);
|
|
||||||
this.button1.TabIndex = 13;
|
|
||||||
this.button1.Text = "Connect";
|
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
|
||||||
//
|
|
||||||
// Form1
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.BackgroundImage = global::Simulator_CS_GTW.Properties.Resources.back;
|
|
||||||
this.ClientSize = new System.Drawing.Size(442, 322);
|
|
||||||
this.Controls.Add(this.button1);
|
|
||||||
this.Controls.Add(this.label19);
|
|
||||||
this.Controls.Add(this.textBoxSerial);
|
|
||||||
this.Controls.Add(this.panel9);
|
|
||||||
this.Controls.Add(this.panel8);
|
|
||||||
this.Controls.Add(this.panel7);
|
|
||||||
this.Controls.Add(this.panel6);
|
|
||||||
this.Controls.Add(this.panel5);
|
|
||||||
this.Controls.Add(this.panel4);
|
|
||||||
this.Controls.Add(this.panel3);
|
|
||||||
this.Controls.Add(this.panel2);
|
|
||||||
this.Controls.Add(this.panel1);
|
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
||||||
this.Name = "Form1";
|
|
||||||
this.Text = "Form1";
|
|
||||||
this.Load += new System.EventHandler(this.Form1_Load);
|
|
||||||
this.panel1.ResumeLayout(false);
|
|
||||||
this.panel1.PerformLayout();
|
|
||||||
this.panel2.ResumeLayout(false);
|
|
||||||
this.panel2.PerformLayout();
|
|
||||||
this.panel3.ResumeLayout(false);
|
|
||||||
this.panel3.PerformLayout();
|
|
||||||
this.panel4.ResumeLayout(false);
|
|
||||||
this.panel4.PerformLayout();
|
|
||||||
this.panel5.ResumeLayout(false);
|
|
||||||
this.panel5.PerformLayout();
|
|
||||||
this.panel6.ResumeLayout(false);
|
|
||||||
this.panel6.PerformLayout();
|
|
||||||
this.panel7.ResumeLayout(false);
|
|
||||||
this.panel7.PerformLayout();
|
|
||||||
this.panel8.ResumeLayout(false);
|
|
||||||
this.panel8.PerformLayout();
|
|
||||||
this.panel9.ResumeLayout(false);
|
|
||||||
this.panel9.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.CheckBox cbPP;
|
|
||||||
private System.Windows.Forms.Panel panel1;
|
|
||||||
private System.Windows.Forms.Label label2;
|
|
||||||
private System.Windows.Forms.TextBox tbIntPP;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private System.Windows.Forms.Panel panel2;
|
|
||||||
private System.Windows.Forms.Label label3;
|
|
||||||
private System.Windows.Forms.TextBox tbIntUnitReq;
|
|
||||||
private System.Windows.Forms.Label label4;
|
|
||||||
private System.Windows.Forms.CheckBox cbUnitReq;
|
|
||||||
private System.Windows.Forms.Panel panel3;
|
|
||||||
private System.Windows.Forms.Label label5;
|
|
||||||
private System.Windows.Forms.TextBox tbIntTMReq;
|
|
||||||
private System.Windows.Forms.Label label6;
|
|
||||||
private System.Windows.Forms.CheckBox cbTMReq;
|
|
||||||
private System.Windows.Forms.Panel panel4;
|
|
||||||
private System.Windows.Forms.Label label7;
|
|
||||||
private System.Windows.Forms.TextBox tbIntPollReq;
|
|
||||||
private System.Windows.Forms.Label label8;
|
|
||||||
private System.Windows.Forms.CheckBox cbPollReq;
|
|
||||||
private System.Windows.Forms.Panel panel5;
|
|
||||||
private System.Windows.Forms.Label label9;
|
|
||||||
private System.Windows.Forms.TextBox tbIntCSListReq;
|
|
||||||
private System.Windows.Forms.Label label10;
|
|
||||||
private System.Windows.Forms.CheckBox cbCSListReq;
|
|
||||||
private System.Windows.Forms.Panel panel6;
|
|
||||||
private System.Windows.Forms.Label label11;
|
|
||||||
private System.Windows.Forms.TextBox tbIntTMRep;
|
|
||||||
private System.Windows.Forms.Label label12;
|
|
||||||
private System.Windows.Forms.CheckBox cbTMRep;
|
|
||||||
private System.Windows.Forms.Panel panel7;
|
|
||||||
private System.Windows.Forms.Label label13;
|
|
||||||
private System.Windows.Forms.TextBox tbIntPosRep;
|
|
||||||
private System.Windows.Forms.Label label14;
|
|
||||||
private System.Windows.Forms.CheckBox cbPosRep;
|
|
||||||
private System.Windows.Forms.Panel panel8;
|
|
||||||
private System.Windows.Forms.Label label15;
|
|
||||||
private System.Windows.Forms.TextBox tbIntARSRep;
|
|
||||||
private System.Windows.Forms.Label label16;
|
|
||||||
private System.Windows.Forms.CheckBox cbARSRep;
|
|
||||||
private System.Windows.Forms.Panel panel9;
|
|
||||||
private System.Windows.Forms.Label label17;
|
|
||||||
private System.Windows.Forms.TextBox tbIntPollRep;
|
|
||||||
private System.Windows.Forms.Label label18;
|
|
||||||
private System.Windows.Forms.CheckBox cbPollRep;
|
|
||||||
private System.Windows.Forms.TextBox textBoxSerial;
|
|
||||||
private System.Windows.Forms.Label label19;
|
|
||||||
private System.Windows.Forms.Button button1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace LumiSoft.Media.Wave.Native
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This class represents WAVEOUTCAPS structure.
|
|
||||||
/// </summary>
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct WAVEOUTCAPS
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Manufacturer identifier for the device driver for the device.
|
|
||||||
/// </summary>
|
|
||||||
public ushort wMid;
|
|
||||||
/// <summary>
|
|
||||||
/// Product identifier for the device.
|
|
||||||
/// </summary>
|
|
||||||
public ushort wPid;
|
|
||||||
/// <summary>
|
|
||||||
/// Version number of the device driver for the device.
|
|
||||||
/// </summary>
|
|
||||||
public uint vDriverVersion;
|
|
||||||
/// <summary>
|
|
||||||
/// Product name in a null-terminated string.
|
|
||||||
/// </summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr,SizeConst = 32)]
|
|
||||||
public string szPname;
|
|
||||||
/// <summary>
|
|
||||||
/// Standard formats that are supported.
|
|
||||||
/// </summary>
|
|
||||||
public uint dwFormats;
|
|
||||||
/// <summary>
|
|
||||||
/// Number specifying whether the device supports mono (1) or stereo (2) output.
|
|
||||||
/// </summary>
|
|
||||||
public ushort wChannels;
|
|
||||||
/// <summary>
|
|
||||||
/// Packing.
|
|
||||||
/// </summary>
|
|
||||||
public ushort wReserved1;
|
|
||||||
/// <summary>
|
|
||||||
/// Optional functionality supported by the device.
|
|
||||||
/// </summary>
|
|
||||||
public uint dwSupport;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
; config.ini
|
|
||||||
; This file is used to run the ConnectPlus_SOC Gateway application
|
|
||||||
; Please do not modify if you are not an admin
|
|
||||||
|
|
||||||
[MotoTRBO_ports]
|
|
||||||
LocationPort = 4001
|
|
||||||
ARSPort = 4005
|
|
||||||
SMSPort = 4007
|
|
||||||
TALLYSMANPort = 4010
|
|
||||||
|
|
||||||
;GPS_trig_refresh - in hours
|
|
||||||
[GATEWAY]
|
|
||||||
id = 90999
|
|
||||||
report = 60
|
|
||||||
GPS_trig_refresh = 8
|
|
||||||
capPlus = True
|
|
||||||
MasterRadioIP = 192.168.10.50
|
|
||||||
confSMS = True
|
|
||||||
gw_restart = true
|
|
||||||
gw_restart_inactive_seconds = 50
|
|
||||||
autoupdate = true
|
|
||||||
|
|
||||||
[MySQL]
|
|
||||||
;SERVER = ifqNConpwMO2SAGta2monK+/fXuIK0gG+yH/By/fKWTTSHvNzVOJB6WKfOLHGcA1R9csQWwX4kU=
|
|
||||||
;SERVER = 440j5IlHnEcbFgsQToeQmg==
|
|
||||||
SERVER = hFuM7LKiA0sMM7MEXYT8NA==
|
|
||||||
DATABASE = 9F5Ufu/mgM9Btd7HWDylwg==
|
|
||||||
UID = 5wQPPYB9Xwg=
|
|
||||||
PASSWORD = YTXqw1P9AMJH1yxBbBfiRQ==
|
|
||||||
|
|
||||||
[EmailService]
|
|
||||||
Enable = false
|
|
||||||
User = bigutransfer@gmail.com
|
|
||||||
Pass = gigelamd01
|
|
||||||
Pop3Server = pop.gmail.com
|
|
||||||
SmtpServer = smtp.gmail.com
|
|
||||||
EnableSSL = True
|
|
||||||
Pop3Port = 995
|
|
||||||
SmtpPort = 587
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("LMdirectGW")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("SafeMobile")]
|
|
||||||
[assembly: AssemblyProduct("LMdirectGW")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © SafeMobile")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("f8055860-aaee-42fe-8fc1-036cb38d5edf")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
Before Width: | Height: | Size: 4.1 KiB |
@ -1,241 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Net;
|
|
||||||
using OpenPOP.POP3;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
public class EmailServerSSL
|
|
||||||
{
|
|
||||||
private POPClient popClient;
|
|
||||||
private string serverIP;
|
|
||||||
private int port;
|
|
||||||
private string loginNAme;
|
|
||||||
private string password;
|
|
||||||
|
|
||||||
//constructor
|
|
||||||
public EmailServerSSL(string _serverIP, string _port, string _logName, string _pass)
|
|
||||||
{
|
|
||||||
bool result = Int32.TryParse(_port, out port);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Email port not numeric, error in EmailServerSSL constructor.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
serverIP = _serverIP;
|
|
||||||
loginNAme = _logName;
|
|
||||||
password = _pass;
|
|
||||||
|
|
||||||
popClient = new POPClient();
|
|
||||||
popClient.AuthenticationBegan += new EventHandler(popClient_AuthenticationBegan);
|
|
||||||
popClient.AuthenticationFinished += new EventHandler(popClient_AuthenticationFinished);
|
|
||||||
popClient.CommunicationBegan += new EventHandler(popClient_CommunicationBegan);
|
|
||||||
popClient.CommunicationOccured += new EventHandler(popClient_CommunicationOccured);
|
|
||||||
popClient.CommunicationLost += new EventHandler(popClient_CommunicationLost);
|
|
||||||
popClient.MessageTransferBegan += new EventHandler(popClient_MessageTransferBegan);
|
|
||||||
popClient.MessageTransferFinished += new EventHandler(popClient_MessageTransferFinished);
|
|
||||||
}
|
|
||||||
#region popCLient events
|
|
||||||
private void AddEvent(string strEvent)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
lstEvents.Items.Add(strEvent);
|
|
||||||
lstEvents.SelectedIndex = lstEvents.Items.Count - 1;
|
|
||||||
*/
|
|
||||||
//Console.WriteLine("popClient event = " +strEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_CommunicationBegan(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("CommunicationBegan");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_CommunicationOccured(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("CommunicationOccured");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_AuthenticationBegan(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("AuthenticationBegan");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_AuthenticationFinished(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("AuthenticationFinished");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_MessageTransferBegan(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("MessageTransferBegan");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_MessageTransferFinished(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("MessageTransferFinished");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_CommunicationLost(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("CommunicationLost");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public ArrayList getEmails()
|
|
||||||
{
|
|
||||||
ArrayList ret = new ArrayList();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
popClient.IsUsingSsl = true;
|
|
||||||
popClient.Disconnect();
|
|
||||||
popClient.Connect(serverIP, port);
|
|
||||||
popClient.Authenticate(loginNAme, password);
|
|
||||||
|
|
||||||
|
|
||||||
int count = popClient.GetMessageCount();
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Got " + count + " emails");
|
|
||||||
|
|
||||||
for (int i = count; i >= 1; i -= 1)
|
|
||||||
{
|
|
||||||
OpenPOP.MIMEParser.Message email = popClient.GetMessage(i, false);
|
|
||||||
if (email != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "-----------------------------------------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "From: " + email.FromEmail);
|
|
||||||
if (email.TO.Length >= 0)
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "To: " + email.TO[0]);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Subject: " + email.Subject);
|
|
||||||
if (email.MessageBody.Count > 0)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Text: " + (string)email.MessageBody[email.MessageBody.Count - 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
EmailtoSMS ets = processMessage(email.Subject, (string)email.MessageBody[email.MessageBody.Count - 1], email.FromEmail);
|
|
||||||
if ((ets.id != "") && (ets.text == ""))
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Incorrect email body " + (string)email.MessageBody[email.MessageBody.Count - 1]);
|
|
||||||
}
|
|
||||||
else if ((ets.id != "") && (ets.text != ""))
|
|
||||||
{
|
|
||||||
popClient.DeleteMessage(i);
|
|
||||||
ret.Add(ets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "-----------------------------------------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "BAD email");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
popClient.Disconnect();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "getEmails() from EmailServerSSL Exception: " + ex.Message + ex.ToString());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EmailtoSMS processMessage(string subj, string body, string from)
|
|
||||||
{
|
|
||||||
EmailtoSMS obj = new EmailtoSMS();
|
|
||||||
obj.from = from;
|
|
||||||
String s = subj.ToUpper();
|
|
||||||
if (s.Contains("ID[") && subj.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.id = s;
|
|
||||||
obj.id = obj.id.Remove(0, s.IndexOf("ID[") + 3);
|
|
||||||
obj.id = obj.id.Remove(obj.id.IndexOf("]"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.id.Length > 0)
|
|
||||||
{ // ID prezent in subject
|
|
||||||
s = body.ToUpper();
|
|
||||||
// SM.Debug("Email text:" + s.ToString() + " " + s.Contains("BODY[") + " " + body.Contains("]"));
|
|
||||||
if (s.Contains("BODY[") && body.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.text = body;
|
|
||||||
obj.text = obj.text.Remove(0, s.IndexOf("BODY[") + 5);
|
|
||||||
obj.text = obj.text.Remove(obj.text.IndexOf("]"));
|
|
||||||
if (obj.text.Length > 139)
|
|
||||||
obj.text = obj.text.Remove(140);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ //check for id in email body
|
|
||||||
s = body.ToUpper();
|
|
||||||
if (s.Contains("ID[") && s.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.id = body;
|
|
||||||
obj.id = obj.id.Remove(0, s.IndexOf("ID[") + 3);
|
|
||||||
obj.id = obj.id.Remove(obj.id.IndexOf("]"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.id.Length > 0)
|
|
||||||
{
|
|
||||||
s = body.ToUpper();
|
|
||||||
//SM.Debug("Email text2:" + s.ToString() + " " + s.Contains("BODY[") + " " + body.Contains("]"));
|
|
||||||
if (s.Contains("BODY[") && s.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.text = body;
|
|
||||||
obj.text = obj.text.Remove(0, s.IndexOf("BODY[") + 5);
|
|
||||||
obj.text = obj.text.Remove(obj.text.IndexOf("]"));
|
|
||||||
if (obj.text.Length > 139)
|
|
||||||
obj.text = obj.text.Remove(140);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "ID: " + obj.id);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Text: " + obj.text);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "-----------------------------------------------------------------");
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendEmail(string server, string _port, string user, string pass, MailMessage mailMessage, Boolean enableSSL)
|
|
||||||
{
|
|
||||||
int port = 0;
|
|
||||||
bool result = Int32.TryParse(_port, out port);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
SmtpClient mailClient = new SmtpClient();
|
|
||||||
mailClient.Host = server;
|
|
||||||
mailClient.Port = port;
|
|
||||||
NetworkCredential cred = new NetworkCredential(user, pass);
|
|
||||||
mailClient.Credentials = cred;
|
|
||||||
mailClient.EnableSsl = enableSSL;
|
|
||||||
mailClient.Send(mailMessage);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------Sending email on " + server + " TO: " + mailMessage.To[0].ToString() + "--------------");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Email port not numeric, error in sendEmail.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EmailtoSMS
|
|
||||||
{
|
|
||||||
public String from;
|
|
||||||
public String id;
|
|
||||||
public String text;
|
|
||||||
|
|
||||||
public EmailtoSMS()
|
|
||||||
{
|
|
||||||
from = "";
|
|
||||||
id = "";
|
|
||||||
text = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,263 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Net;
|
|
||||||
using System.Drawing;
|
|
||||||
using libZPlay;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.IO;
|
|
||||||
using System;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
using LumiSoft.Media.Wave;
|
|
||||||
|
|
||||||
|
|
||||||
namespace ConsoleApplication1
|
|
||||||
{
|
|
||||||
class Test
|
|
||||||
{
|
|
||||||
[DllImport("libzplay.dll", CharSet = CharSet.Unicode)]
|
|
||||||
public static extern int ZPlay();
|
|
||||||
static ConfigurablePlayer player1;
|
|
||||||
|
|
||||||
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
player1 = new ConfigurablePlayer(0, 8000, 16, 1);
|
|
||||||
|
|
||||||
player1.PlayInQueue(new byte[] {0, 9});
|
|
||||||
|
|
||||||
UDPClient client = new UDPClient(player1);
|
|
||||||
|
|
||||||
//Thread t = new Thread(NewThread);
|
|
||||||
//t.Start();
|
|
||||||
|
|
||||||
Console.WriteLine("blabla");
|
|
||||||
|
|
||||||
System.Threading.Thread.Sleep(400000);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static void NewThread()
|
|
||||||
{
|
|
||||||
UDPServer server = new UDPServer(player1);
|
|
||||||
|
|
||||||
server.Listen();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UDPClient
|
|
||||||
{
|
|
||||||
|
|
||||||
private IPAddress addr;
|
|
||||||
private IPEndPoint ipep;
|
|
||||||
public static Socket newsock;
|
|
||||||
private ConfigurablePlayer player;
|
|
||||||
|
|
||||||
public UDPClient(ConfigurablePlayer player)
|
|
||||||
{
|
|
||||||
|
|
||||||
this.player = player;
|
|
||||||
|
|
||||||
byte[] data = new byte[] { 1, 2, 3, 4, 5, 6, 7 };
|
|
||||||
|
|
||||||
|
|
||||||
addr = IPAddress.Parse("10.120.1.111");
|
|
||||||
|
|
||||||
ipep = new IPEndPoint(addr, 9050);
|
|
||||||
|
|
||||||
|
|
||||||
Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
|
||||||
|
|
||||||
|
|
||||||
//IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
|
|
||||||
Console.WriteLine("intra");
|
|
||||||
player.GetMicData += new ConfigurablePlayer.GetMicDataHandler(Send);
|
|
||||||
player.TurnOnMic(0, 8000, 16, 1, 400);
|
|
||||||
//newsock.Send(data, data.Length, ipep);
|
|
||||||
//newsock.SendTo(data, data.Length, SocketFlags.None, ipep);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Send(byte[] data)
|
|
||||||
{
|
|
||||||
//Console.WriteLine("kk");
|
|
||||||
IPAddress addr = IPAddress.Parse("10.120.1.111");
|
|
||||||
|
|
||||||
IPEndPoint ipep = new IPEndPoint(addr, 9050);
|
|
||||||
|
|
||||||
|
|
||||||
Socket newsock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
|
||||||
//Console.WriteLine("se trimite din microphone" + newsock.ToString());
|
|
||||||
newsock.SendTo(data, data.Length, SocketFlags.None, ipep);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class UDPServer
|
|
||||||
{
|
|
||||||
byte[] data;
|
|
||||||
private UdpClient newsock;
|
|
||||||
private IPEndPoint sender;
|
|
||||||
private ConfigurablePlayer player;
|
|
||||||
public UDPServer(ConfigurablePlayer player)
|
|
||||||
{
|
|
||||||
this.player = player;
|
|
||||||
//data = new byte[1024];
|
|
||||||
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 9051);
|
|
||||||
newsock = new UdpClient(ipep);
|
|
||||||
sender = new IPEndPoint(IPAddress.Any, 0);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Listen()
|
|
||||||
{
|
|
||||||
Console.WriteLine("waiting for client...");
|
|
||||||
|
|
||||||
|
|
||||||
//ConfigurablePlayer player2 = new ConfigurablePlayer(ConfigurablePlayer.ChannelType.Right, ConfigurablePlayer.FormatType.Wav);
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
|
|
||||||
data = newsock.Receive(ref sender);
|
|
||||||
Console.WriteLine("recived");
|
|
||||||
player.PlayInQueue(data);
|
|
||||||
//Console.WriteLine(Encoding.ASCII.GetString(data, 0, data.Length));
|
|
||||||
//newsock.Send(data, data.Length, sender);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ConfigurablePlayer
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private WaveOut m_pSoundSender = null;
|
|
||||||
|
|
||||||
private WaveIn m_pSoundReceiver = null;
|
|
||||||
|
|
||||||
public event GetMicDataHandler GetMicData;
|
|
||||||
|
|
||||||
public delegate void GetMicDataHandler(byte[] micData);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="deviceNumber"></param>
|
|
||||||
/// <param name="channel"></param>
|
|
||||||
/// <param name="format"></param>
|
|
||||||
public ConfigurablePlayer(int outputDevice, int samplesPerSec, int bitsPerSample, int channels)
|
|
||||||
{
|
|
||||||
m_pSoundSender = new WaveOut(WaveOut.Devices[outputDevice], samplesPerSec, bitsPerSample, channels);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Plays the data. If the player already plays someting, the data is queued.
|
|
||||||
/// ATENTION!!! if you call this function for more than one time
|
|
||||||
/// make sure that you don't pass the same reference of bytes
|
|
||||||
/// user like this: byte[] bytes = new byte[size];
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bytes"></param>
|
|
||||||
public void PlayInQueue(byte[] bytes)
|
|
||||||
{
|
|
||||||
m_pSoundSender.Play(bytes, 0, bytes.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stops the current player. Also resets the queue.
|
|
||||||
/// </summary>
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
m_pSoundSender.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Turn on the microphone.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="micDeviceNumber"></param>
|
|
||||||
/// <param name="samplesPerSec"></param>
|
|
||||||
/// <param name="bitsPerSample"></param>
|
|
||||||
/// <param name="channels"></param>
|
|
||||||
/// <param name="bufferSize"></param>
|
|
||||||
public void TurnOnMic(int micDeviceNumber, int samplesPerSec, int bitsPerSample, int channels, int bufferSize)
|
|
||||||
{
|
|
||||||
// G711 needs 8KHZ 16 bit 1 channel audio,
|
|
||||||
// 400kb buffer gives us 25ms audio frame.
|
|
||||||
//m_pSoundReceiver = new WaveIn(WaveIn.Devices[0],8000,16,1,400);
|
|
||||||
m_pSoundReceiver = new WaveIn(WaveIn.Devices[micDeviceNumber], samplesPerSec, bitsPerSample, channels, bufferSize);
|
|
||||||
m_pSoundReceiver.BufferFull += new BufferFullHandler
|
|
||||||
(m_pSoundReceiver_BufferFull);
|
|
||||||
m_pSoundReceiver.Start();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void TurnOffMic()
|
|
||||||
{
|
|
||||||
if (m_pSoundReceiver != null)
|
|
||||||
{
|
|
||||||
m_pSoundReceiver.Stop();
|
|
||||||
m_pSoundReceiver = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This method is called when recording buffer is full
|
|
||||||
/// and we need to process it.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="buffer">Recorded data.</param>
|
|
||||||
private void m_pSoundReceiver_BufferFull(byte[] buffer)
|
|
||||||
{
|
|
||||||
//Console.WriteLine("mic");
|
|
||||||
if (GetMicData != null)
|
|
||||||
{
|
|
||||||
GetMicData(buffer);
|
|
||||||
//Console.WriteLine("mare");
|
|
||||||
}
|
|
||||||
//Console.WriteLine("crazy");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public bool setLeftRightPercentage(int left, int right)
|
|
||||||
{
|
|
||||||
if (!(0 <= left && left <= 100))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(0 <= right && right <= 100))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pSoundSender.SetVolume((ushort)left, (ushort)right);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 2.9 KiB |
@ -1,92 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{6439324E-58FB-4CEA-A197-737FE9DC0BBC}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Teltonika_SOC</RootNamespace>
|
|
||||||
<AssemblyName>Teltonika_SOC</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>
|
|
||||||
</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Nini">
|
|
||||||
<HintPath>..\lib\Nini.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Config.cs" />
|
|
||||||
<Compile Include="ConnectionThread.cs" />
|
|
||||||
<Compile Include="DBconnThreads.cs" />
|
|
||||||
<Compile Include="LocationThread.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="UdpConnectionThread.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="config.ini">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="setupmode.conf">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SafeNetLib\SafeNetLib.csproj">
|
|
||||||
<Project>{5AFA65B8-32DA-4924-BD06-7C8802F02BE4}</Project>
|
|
||||||
<Name>SafeNetLib</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
<SvnVersion LocalPath="$(MSBuildProjectDirectory)" ToolPath="$(ProgramFiles)\SlikSVN\bin">
|
|
||||||
<Output TaskParameter="Revision" PropertyName="Revision" />
|
|
||||||
</SvnVersion>
|
|
||||||
<FileUpdate Files="Properties\AssemblyInfo.cs" Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)" ReplacementText="$1.$2.$3.$(Revision)" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("SN_Server")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("SN_Server")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("70b9e5dd-510f-498a-8a7d-9750ba440983")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,304 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Threading;
|
|
||||||
using SN_Server;
|
|
||||||
using SN_Server.ServerMSGS;
|
|
||||||
|
|
||||||
|
|
||||||
namespace MotoRepeater_SOC
|
|
||||||
{
|
|
||||||
class QueueManagerThread
|
|
||||||
{
|
|
||||||
private bool working = false;
|
|
||||||
private ServerConnector connector;
|
|
||||||
|
|
||||||
public QueueManagerThread(ServerConnector connector)
|
|
||||||
{
|
|
||||||
working = true;
|
|
||||||
this.connector = connector;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
working = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
working = false;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
//for ARS DB thread
|
|
||||||
public void HandleConnectionARS()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "ARS DB thread...");
|
|
||||||
|
|
||||||
while (working)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
while (!connector._connected)
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.always, "Reconneting to DB!!!");
|
|
||||||
//StartDB();
|
|
||||||
|
|
||||||
//wait for valid DB connection!!!
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "ARS MAnager thread waiting for valid Server connection!!!");
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
//add ARS in DB
|
|
||||||
ArsMSG ars_msg = SN_Queues.arsMsgQueue.GetItem(10);
|
|
||||||
while (ars_msg != null)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, "Got ARS updating Server suid:" + ars_msg.imei + "msg:" + ars_msg.msg);
|
|
||||||
|
|
||||||
|
|
||||||
int suDBid = MotoRepeater_GW.unitList.GetDBid(ars_msg.imei);
|
|
||||||
if (suDBid == 0)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, "Unit with IMEI:" + ars_msg.imei + " not found in DB!!!!");
|
|
||||||
LOGS.LOG("Unit with IMEI:" + ars_msg.imei + " not found in DB!!!!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ars_msg.imei != "0" && ars_msg.imei != "")
|
|
||||||
{
|
|
||||||
connector.InsertARS(suDBid.ToString(), ars_msg.msg);
|
|
||||||
//DB.Insert_ARSmsg(suDBid, ars_msg.msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, "%%%%% Got ARS invalid suid:" + ars_msg.suid + "msg:" + ars_msg.msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ars_msg = SN_Queues.arsMsgQueue.GetItem(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ThreadAbortException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
//for GPS Server thread
|
|
||||||
public void HandleConnectionGPS()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "GPS DB thread...");
|
|
||||||
|
|
||||||
while (working)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
while (!connector._connected)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Reconneting to Server!!!");
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
}
|
|
||||||
htCell_t cell = SN_Queues.DBQueueLocation.GetItem(100);
|
|
||||||
|
|
||||||
if (cell != null)
|
|
||||||
{
|
|
||||||
//SN_Queues.initAddressQueue.PostItem(cell);
|
|
||||||
|
|
||||||
DateTime before = DateTime.Now;
|
|
||||||
//bool ret = DB.Insert_messages(cell);
|
|
||||||
int suDBid = MotoRepeater_GW.unitList.GetDBid(cell.suid);
|
|
||||||
if (suDBid != 0)
|
|
||||||
{
|
|
||||||
GPS gps = converCell2GPS(cell, suDBid);
|
|
||||||
|
|
||||||
if (gps != null)
|
|
||||||
{
|
|
||||||
bool ret = connector.InsertGPS(gps);
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
DateTime after = DateTime.Now;
|
|
||||||
TimeSpan diff = after.Subtract(before);
|
|
||||||
count++;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "GPS SUID: " + cell.suid + " LAT<" + cell.lat + " > LNG<" + cell.lng + ">");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Sent to server count:" + count + " in queue:" + SN_Queues.DBQueueLocation.Count + " Time for insert(msecs):" + diff.Ticks / TimeSpan.TicksPerMillisecond + "." + diff.Ticks % TimeSpan.TicksPerMillisecond);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, "Unit with IMEI:" + cell.suid + " not found in DB!!!!");
|
|
||||||
LOGS.LOG("Unit with IMEI:" + cell.suid + " not found in DB!!!!");
|
|
||||||
}
|
|
||||||
Console.WriteLine("-----------------------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (ThreadAbortException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
//for SMS Server thread
|
|
||||||
public void HandleConnectionSMS()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "SMS DB thread ...");
|
|
||||||
|
|
||||||
while (working)
|
|
||||||
{
|
|
||||||
while (!connector._connected)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Reconneting to Server!!!");
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//check for new SMS in DB only every 30s
|
|
||||||
Thread.Sleep(30 * 1000);
|
|
||||||
|
|
||||||
//check SMS recv
|
|
||||||
SMS recv_msg = SM_SMS.recvSMSQueue.GetItem(100);
|
|
||||||
while (recv_msg != null)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "We got new messages.Sending them to server. RadioID:" + recv_msg.RadioID + " msg:" + recv_msg.Msg);
|
|
||||||
connector.InsertSMS(recv_msg);
|
|
||||||
recv_msg = SM_SMS.recvSMSQueue.GetItem(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//check SMS confirmation
|
|
||||||
SMS msg = SM_SMS.confSMSQueue.GetItem(100);
|
|
||||||
while (msg != null)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Confirming SMS to server. DBmsgID:" + msg.DBid + " msg:" + msg.Msg);
|
|
||||||
connector.InsertSMSack(msg);
|
|
||||||
msg = SM_SMS.confSMSQueue.GetItem(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
//for poll Thread
|
|
||||||
public void HandleConnectionPOLL()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "POLL Server thread ...");
|
|
||||||
|
|
||||||
while (working)
|
|
||||||
{
|
|
||||||
while (!connector._connected)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Reconneting to Server!!!");
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
//check for new POLL requests in DB every 3s
|
|
||||||
Thread.Sleep(3000);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Checking for poll at:" + DateTime.Now);
|
|
||||||
|
|
||||||
//check Poll read
|
|
||||||
SN_Server.ServerMSGS.SM_POLLmsg p_msg1 = SM_GPS.readPOLLQueue.GetItem(100);
|
|
||||||
if (p_msg1 != null)
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.DEV, "MotoTRBOGW.sentPOLLQueue.GetItem(100);");
|
|
||||||
connector.InsertPOLL(1, p_msg1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//check Poll sent
|
|
||||||
SN_Server.ServerMSGS.SM_POLLmsg p_msg2 = SM_GPS.sentPOLLQueue.GetItem(100);
|
|
||||||
if (p_msg2 != null)
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.DEV, "MotoTRBOGW.sentPOLLQueue.GetItem(100);");
|
|
||||||
connector.InsertPOLL(2, p_msg2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//update GPS in DB from poll response
|
|
||||||
SN_Server.ServerMSGS.SM_POLLmsg p_msg3 = SM_GPS.recvPOLLQueue.GetItem(100);
|
|
||||||
if (p_msg3 != null)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DEV, "Got poll location updating DB suid:" + p_msg3.suid);
|
|
||||||
connector.InsertPOLL(3, p_msg3);
|
|
||||||
|
|
||||||
//remove poll from hashtable ... poll completed sucsessfully
|
|
||||||
lock (SN_Queues.ht_POLL_List.SyncRoot)
|
|
||||||
{
|
|
||||||
SN_Queues.ht_POLL_List.Remove(p_msg3.DBid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static GPS converCell2GPS(htCell_t cell, int dbid)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
GPS gps = new GPS();
|
|
||||||
|
|
||||||
gps.s_suid = cell.suid;
|
|
||||||
gps.i_dbid = dbid;
|
|
||||||
gps.s_lat = cell.lat;
|
|
||||||
gps.s_lng = cell.lng;
|
|
||||||
gps.d_lat = cell.d_lat;
|
|
||||||
gps.d_lng = cell.d_lng;
|
|
||||||
gps.dt_time = cell.location_time;
|
|
||||||
if (!Int32.TryParse(cell.spd, out gps.i_spd))
|
|
||||||
gps.i_spd = 0;
|
|
||||||
TimeSpan span = (cell.location_time - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc));
|
|
||||||
gps.i_time = (int)span.TotalSeconds;
|
|
||||||
|
|
||||||
return gps;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private SMS convertSms(SMSmsg old_msg, int sudbid)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SMS new_msg = new SMS();
|
|
||||||
|
|
||||||
new_msg.DBid = (int)old_msg.DBmsg_id;
|
|
||||||
new_msg.Msg = old_msg.msg;
|
|
||||||
new_msg.RadioID = old_msg.suid;
|
|
||||||
new_msg.SUDBid = sudbid;
|
|
||||||
|
|
||||||
return new_msg;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,237 +0,0 @@
|
|||||||
/* generic.h -- anything you don't #undef at the end remains in effect.
|
|
||||||
The ONLY things that go in here are generic indicator flags; it's up
|
|
||||||
to your programs to declare and call things based on those flags.
|
|
||||||
|
|
||||||
You should only need to make changes via a minimal system-specific section
|
|
||||||
at the end of this file. To build a new section, rip through this and
|
|
||||||
check everything it mentions on your platform, and #undef that which needs
|
|
||||||
it. If you generate a system-specific section you didn't find in here,
|
|
||||||
please mail me a copy so I can update the "master".
|
|
||||||
|
|
||||||
I realize I'm probably inventing another pseudo-standard here, but
|
|
||||||
goddamnit, everybody ELSE has already, and I can't include all of their
|
|
||||||
hairball schemes too. HAVE_xx conforms to the gnu/autoconf usage and
|
|
||||||
seems to be the most common format. In fact, I dug a lot of these out
|
|
||||||
of autoconf and tried to common them all together using "stupidh" to
|
|
||||||
collect data from platforms.
|
|
||||||
|
|
||||||
In disgust... _H* 940910, 941115. Pseudo-version: 1.1 */
|
|
||||||
|
|
||||||
#ifndef GENERIC_H /* only run through this once */
|
|
||||||
#define GENERIC_H
|
|
||||||
|
|
||||||
/* =============================== */
|
|
||||||
/* System calls, lib routines, etc */
|
|
||||||
/* =============================== */
|
|
||||||
|
|
||||||
/* How does your system declare malloc, void or char? Usually void, but go
|
|
||||||
ask the SunOS people why they had to be different... */
|
|
||||||
#define VOID_MALLOC
|
|
||||||
|
|
||||||
/* notably from fwtk/firewall.h: posix locking? */
|
|
||||||
#define HAVE_FLOCK /* otherwise it's lockf() */
|
|
||||||
|
|
||||||
/* if you don't have setsid(), you might have setpgrp().
|
|
||||||
#define HAVE_SETSID
|
|
||||||
|
|
||||||
/* random() is generally considered better than rand() */
|
|
||||||
/* xxx: rand48? */
|
|
||||||
#define HAVE_RANDOM
|
|
||||||
|
|
||||||
/* if your machine doesn't have lstat(), it should have stat() [dos...] */
|
|
||||||
#define HAVE_LSTAT
|
|
||||||
|
|
||||||
/* different kinds of term ioctls. How to recognize them, very roughly:
|
|
||||||
sysv/POSIX_ME_HARDER: termio[s].h, struct termio[s], tty.c_*[]
|
|
||||||
bsd/old stuff: sgtty.h, ioctl(TIOCSETP), sgttyb.sg_*, tchars.t_*
|
|
||||||
#define HAVE_TERMIOS
|
|
||||||
|
|
||||||
/* dbm vs ndbm */
|
|
||||||
#define HAVE_NDBM
|
|
||||||
|
|
||||||
/* extended utmp/wtmp stuff. MOST machines still do NOT have this SV-ism */
|
|
||||||
#define UTMPX
|
|
||||||
|
|
||||||
/* some systems have nice() which takes *relative* values... [resource.h] */
|
|
||||||
#define HAVE_SETPRIORITY
|
|
||||||
|
|
||||||
/* a sysvism, I think, but ... */
|
|
||||||
#define HAVE_SYSINFO
|
|
||||||
|
|
||||||
/* punted for now: setown / siocspgrp ... see firewall.h */
|
|
||||||
|
|
||||||
/* ============= */
|
|
||||||
/* Include files */
|
|
||||||
/* ============= */
|
|
||||||
|
|
||||||
/* Presence of these can be determined via a script that sniffs them
|
|
||||||
out if you aren't sure. */
|
|
||||||
|
|
||||||
/* stdlib comes with most modern compilers, but ya never know */
|
|
||||||
#define HAVE_STDLIB_H
|
|
||||||
|
|
||||||
/* not on a DOS box! */
|
|
||||||
#define HAVE_UNISTD_H
|
|
||||||
|
|
||||||
/* stdarg is a weird one */
|
|
||||||
#define HAVE_STDARG_H
|
|
||||||
|
|
||||||
/* dir.h or maybe ndir.h otherwise. */
|
|
||||||
#define HAVE_DIRENT_H
|
|
||||||
|
|
||||||
/* string or strings */
|
|
||||||
#define HAVE_STRINGS_H
|
|
||||||
|
|
||||||
/* if you don't have lastlog.h, what you want might be in login.h */
|
|
||||||
#define HAVE_LASTLOG_H
|
|
||||||
|
|
||||||
/* predefines for _PATH_various */
|
|
||||||
#define HAVE_PATHS_H
|
|
||||||
|
|
||||||
/* assorted others */
|
|
||||||
#define HAVE_PARAM_H
|
|
||||||
#define HAVE_SYSMACROS_H /* in sys/! */
|
|
||||||
#define HAVE_TTYENT_H /* securetty et al */
|
|
||||||
|
|
||||||
/* ==================== */
|
|
||||||
|
|
||||||
/* Still maybe have to do something about the following, if it's even
|
|
||||||
worth it. I just grepped a lot of these out of various code, without
|
|
||||||
looking them up yet:
|
|
||||||
|
|
||||||
#define HAVE_EINPROGRESS
|
|
||||||
#define HAVE_F_SETOWN
|
|
||||||
#define HAVE_SETENV ... now *there's* a hairy one; **environ is portable
|
|
||||||
#define BIG_ENDIAN/little_endian ... *please* try to avoid this stupidity
|
|
||||||
#define HAVE_GETUSERSHELL ... you could always pull it out of getpwent()
|
|
||||||
#define HAVE_SETE[UG]ID ... lib or syscall, it varies on diff platforms
|
|
||||||
#define HAVE_STRCHR ... should actually be handled by string/strings
|
|
||||||
#define HAVE_PSTAT
|
|
||||||
#define HAVE_ST_BLKSIZE ... a stat() thing?
|
|
||||||
#define HAVE_IP_TOS
|
|
||||||
#define HAVE_STRFTIME ... screw this, we should just INCLUDE one for lame
|
|
||||||
old boxes that don't have it [sunos 3.x, early 4.x?]
|
|
||||||
#define HAVE_VFPRINTF
|
|
||||||
#define HAVE_SHADOW_PASSWD ... in its multitudinous schemes?? ... how
|
|
||||||
about sumpin' like #define SHADOW_PASSWD_TYPE ... could get grody.
|
|
||||||
#define SIG* ... what a swamp, punt for now; should all be in signal.h
|
|
||||||
#define HAVE_STRCSPN ... see larry wall's comment in the fwtk regex code
|
|
||||||
#define ULTRIX_AUTH ... bwahaha.
|
|
||||||
#define HAVE_YP or NIS or whatever you wanna call it this week
|
|
||||||
randomness about VARARGS??
|
|
||||||
|
|
||||||
There's also the issue about WHERE various .h files live, sys/ or otherwise.
|
|
||||||
There's a BIG swamp lurking where network code of any sort lives.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ======================== */
|
|
||||||
/* System-specific sections */
|
|
||||||
/* ======================== */
|
|
||||||
|
|
||||||
/* By turning OFF various bits of the above, you can customize for
|
|
||||||
a given platform. /*
|
|
||||||
|
|
||||||
/* DOS boxes, with MSC; you may need to adapt to a different compiler. */
|
|
||||||
#ifdef MSDOS
|
|
||||||
#undef HAVE_FLOCK
|
|
||||||
#undef HAVE_RANDOM
|
|
||||||
#undef HAVE_LSTAT
|
|
||||||
#undef HAVE_TERMIOS
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_SYSINFO
|
|
||||||
#undef HAVE_UNISTD_H
|
|
||||||
#undef HAVE_DIRENT_H /* unless you have the k00l little wrapper from L5!! */
|
|
||||||
#undef HAVE_STRINGS_H
|
|
||||||
#undef HAVE_LASTLOG_H
|
|
||||||
#undef HAVE_PATHS_H
|
|
||||||
#undef HAVE_PARAM_H
|
|
||||||
#undef HAVE_SYSMACROS_H
|
|
||||||
#undef HAVE_TTYENT_H
|
|
||||||
#endif /* MSDOS */
|
|
||||||
|
|
||||||
/* buglix 4.x; dunno about 3.x on down. should be bsd4.2. */
|
|
||||||
#ifdef ULTRIX
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_PATHS_H
|
|
||||||
#undef HAVE_SYSMACROS_H
|
|
||||||
#endif /* buglix */
|
|
||||||
|
|
||||||
/* some of this might still be broken on older sunoses */
|
|
||||||
#ifdef SUNOS
|
|
||||||
#undef VOID_MALLOC
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_PATHS_H
|
|
||||||
#endif /* sunos */
|
|
||||||
|
|
||||||
/* "contact your vendor for a fix" */
|
|
||||||
#ifdef SOLARIS
|
|
||||||
/* has UTMPX */
|
|
||||||
#undef HAVE_SETPRIORITY
|
|
||||||
#undef HAVE_STRINGS_H /* this is genuinely the case, go figure */
|
|
||||||
#undef HAVE_PATHS_H
|
|
||||||
#undef HAVE_TTYENT_H
|
|
||||||
#endif /* SOLARIS */
|
|
||||||
|
|
||||||
/* whatever aix variant MIT had at the time */
|
|
||||||
#ifdef AIX
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_LASTLOG_H
|
|
||||||
#define HAVE_LOGIN_H /* "special", in the educational sense */
|
|
||||||
#endif /* aix */
|
|
||||||
|
|
||||||
/* linux, which is trying as desperately as the gnu folks can to be
|
|
||||||
POSIXLY_CORRECT. I think I'm gonna hurl... */
|
|
||||||
#ifdef LINUX
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_SYSINFO
|
|
||||||
#undef HAVE_TTYENT_H
|
|
||||||
#endif /* linux */
|
|
||||||
|
|
||||||
/* irix 5.x; may not be correct for earlier ones */
|
|
||||||
#ifdef IRIX
|
|
||||||
/* wow, does irix really have everything?! */
|
|
||||||
#endif /* irix */
|
|
||||||
|
|
||||||
/* osf on alphas */
|
|
||||||
#ifdef OSF
|
|
||||||
#undef UTMPX
|
|
||||||
#endif /* osf */
|
|
||||||
|
|
||||||
/* they's some FUCKED UP paths in this one! */
|
|
||||||
#ifdef FREEBSD
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_SYSINFO
|
|
||||||
#undef HAVE_LASTLOG_H
|
|
||||||
#undef HAVE_SYSMACROS_H
|
|
||||||
#endif /* freebsd */
|
|
||||||
|
|
||||||
/* From the sidewinder site, of all places; may be unreliable */
|
|
||||||
#ifdef BSDI
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_LASTLOG_H
|
|
||||||
#undef HAVE_SYSMACROS_H
|
|
||||||
#undef HAVE_TTYENT_H
|
|
||||||
/* and their malloc.h was in sys/ ?! */
|
|
||||||
#endif /* bsdi */
|
|
||||||
|
|
||||||
/* netbsd/44lite, jives with amiga-netbsd from cactus */
|
|
||||||
#ifdef NETBSD
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_SYSINFO
|
|
||||||
#undef HAVE_LASTLOG_H
|
|
||||||
#endif /* netbsd */
|
|
||||||
|
|
||||||
/* Make some "generic" assumptions if all else fails */
|
|
||||||
#ifdef GENERIC
|
|
||||||
#undef HAVE_FLOCK
|
|
||||||
#if defined(SYSV) && (SYSV < 4) /* TW leftover: old SV doesnt have symlinks */
|
|
||||||
#undef HAVE_LSTAT
|
|
||||||
#endif /* old SYSV */
|
|
||||||
#undef HAVE_TERMIOS
|
|
||||||
#undef UTMPX
|
|
||||||
#undef HAVE_PATHS_H
|
|
||||||
#endif /* generic */
|
|
||||||
|
|
||||||
/* ================ */
|
|
||||||
#endif /* GENERIC_H */
|
|
@ -1,8 +0,0 @@
|
|||||||
[{000214A0-0000-0000-C000-000000000046}]
|
|
||||||
Prop3=19,11
|
|
||||||
[InternetShortcut]
|
|
||||||
URL=https://safenet.safemobile.com/
|
|
||||||
IDList=
|
|
||||||
HotKey=0
|
|
||||||
IconFile=G:\Workspace C#\SafeNet_GW\MotoTRBO_SOC\Resources\safenet_icon.ico
|
|
||||||
IconIndex=0
|
|
@ -1,340 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Library General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
|
||||||
void, and will automatically terminate your rights under this License.
|
|
||||||
However, parties who have received copies, or rights, from you under
|
|
||||||
this License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Library General
|
|
||||||
Public License instead of this License.
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Simulator")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Simulator")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("005e5ff4-241a-42d5-9e96-b2f2442cc4c8")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
Before Width: | Height: | Size: 13 KiB |
@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LumiSoft.Media.Wave
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This class represents wav output device.
|
|
||||||
/// </summary>
|
|
||||||
public class WavOutDevice
|
|
||||||
{
|
|
||||||
private int m_Index = 0;
|
|
||||||
private string m_Name = "";
|
|
||||||
private int m_Channels = 1;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Default constructor.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">Device index in devices.</param>
|
|
||||||
/// <param name="name">Device name.</param>
|
|
||||||
/// <param name="channels">Number of audio channels.</param>
|
|
||||||
internal WavOutDevice(int index,string name,int channels)
|
|
||||||
{
|
|
||||||
m_Index = index;
|
|
||||||
m_Name = name;
|
|
||||||
m_Channels = channels;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties Implementation
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets device name.
|
|
||||||
/// </summary>
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get{ return m_Name; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets number of output channels(mono,stereo,...) supported.
|
|
||||||
/// </summary>
|
|
||||||
public int Channels
|
|
||||||
{
|
|
||||||
get{ return m_Channels; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets device index in devices.
|
|
||||||
/// </summary>
|
|
||||||
internal int Index
|
|
||||||
{
|
|
||||||
get{ return m_Index; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,136 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Collections;
|
|
||||||
using MySql.Data.MySqlClient;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace Hytera_SOC
|
|
||||||
{
|
|
||||||
class EmailHandler
|
|
||||||
{
|
|
||||||
//emai stuff
|
|
||||||
private EmailServerSSL sslServer;
|
|
||||||
private static System.Threading.Timer tCheckMail;
|
|
||||||
private string MyConString;
|
|
||||||
private string gatewayID;
|
|
||||||
|
|
||||||
public EmailHandler(string p_dbConStr, string p_gatewayID)
|
|
||||||
{
|
|
||||||
MyConString = p_dbConStr;
|
|
||||||
gatewayID = p_gatewayID;
|
|
||||||
|
|
||||||
//emai server ini
|
|
||||||
if (Hytera_GW.cfg.enableEmailService)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Turning on EmailService on " + Hytera_GW.cfg.user);
|
|
||||||
sslServer = new EmailServerSSL(Hytera_GW.cfg.pop3Server, Hytera_GW.cfg.pop3Port, Hytera_GW.cfg.user, Hytera_GW.cfg.psw);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "EmailService disabled!!!");
|
|
||||||
|
|
||||||
//start email timer... refresh time 1 min
|
|
||||||
if (Hytera_GW.cfg.enableEmailService)
|
|
||||||
{
|
|
||||||
tCheckMail = new System.Threading.Timer(CheckMAil, null, new TimeSpan(0, 0, 0), new TimeSpan(0, 1, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#region email
|
|
||||||
|
|
||||||
private void CheckMAil(Object state)
|
|
||||||
{
|
|
||||||
// This method is executed by a thread pool thread
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, new string[] { "Checking mail at:" + DateTime.Now.ToString(), "For " + Hytera_GW.cfg.user.ToString() + " on " + Hytera_GW.cfg.smtpServer.ToString() });
|
|
||||||
ArrayList EmailList = sslServer.getEmails();
|
|
||||||
|
|
||||||
foreach (EmailtoSMS obj in EmailList)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, new string[] {"-----START OK----",
|
|
||||||
"From: " + obj.from,
|
|
||||||
"ID: " + obj.id,
|
|
||||||
"Text: " + obj.text});
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
obj.text = obj.text.Replace("'", "`");
|
|
||||||
obj.text = obj.text.Replace("#", " ");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Error on converting email:" + ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.text.Length > 140 - 3 - obj.from.Length)
|
|
||||||
obj.text = obj.text.Remove(140 - 3 - obj.from.Length) + " [" + obj.from + "]";
|
|
||||||
else
|
|
||||||
obj.text = obj.text + " [" + obj.from + "]";
|
|
||||||
//SendSMS(obj.id, obj.text, -1); // don't wait for confirmation
|
|
||||||
InsertSMSinDB(obj.text, obj.id);
|
|
||||||
LOGS.LOG(Hytera_GW.cfg.gatewayID + obj.id + " Email sms:" + obj.text);
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Email check done!!!");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error on CheckMAil:" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//sms-> email
|
|
||||||
public static void sendMail(string mailAdr, string mailBody, string radioID)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Sending mail to " + mailAdr + " from radioId " + radioID.ToString());
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MailMessage message = new MailMessage();
|
|
||||||
message.From = new MailAddress(Hytera_GW.cfg.user);
|
|
||||||
message.To.Add(mailAdr);
|
|
||||||
message.Subject = "RadioID: " + radioID.ToString() + " Subject:" + (mailBody.Length < 25 ? mailBody : (mailBody.Remove(25) + "..."));
|
|
||||||
message.Body = "You received a message from radio id " + radioID.ToString() +
|
|
||||||
"\n------------------------------\n" +
|
|
||||||
mailBody +
|
|
||||||
"\n------------------------------\n ";
|
|
||||||
message.IsBodyHtml = true;
|
|
||||||
|
|
||||||
EmailServerSSL.sendEmail(Hytera_GW.cfg.smtpServer, Hytera_GW.cfg.smtpPort, Hytera_GW.cfg.user, Hytera_GW.cfg.psw, message, Hytera_GW.cfg.sslState);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in sendMail: "+ex.ToString());
|
|
||||||
//Console.WriteLine(e.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//insert SMS in DB for further processing
|
|
||||||
private bool InsertSMSinDB(string body, string id)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MySqlConnection connection = new MySqlConnection(MyConString);
|
|
||||||
MySqlCommand command = connection.CreateCommand();
|
|
||||||
MySqlDataReader Reader;
|
|
||||||
command.CommandText = "insert into SMS_OUT (message,sent,subscriber,time) "+
|
|
||||||
"values ('" + body +
|
|
||||||
"',0"+
|
|
||||||
",'" + gatewayID+id+
|
|
||||||
"','" + DateTime.Now.ToUniversalTime().ToString("yyyy:MM:dd HH:mm:ss") +"')";
|
|
||||||
connection.Open();
|
|
||||||
Reader = command.ExecuteReader();
|
|
||||||
|
|
||||||
connection.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error inserting ARS in database");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,331 +0,0 @@
|
|||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
partial class FormMain
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
|
||||||
this.labelAppTitle = new System.Windows.Forms.Label();
|
|
||||||
this.labelGwStatus = new System.Windows.Forms.Label();
|
|
||||||
this.labelStatus = new System.Windows.Forms.Label();
|
|
||||||
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
|
||||||
this.notifyIconContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
|
||||||
this.pictureBoxClose = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxMinimize = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
|
||||||
this.labelVersion = new System.Windows.Forms.Label();
|
|
||||||
this.pictureBoxLoading = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxArs = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxPosition = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxSMS = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxDatabase = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxSettings = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
|
||||||
this.tbEvent = new System.Windows.Forms.TextBox();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxClose)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMinimize)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLoading)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxArs)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPosition)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSMS)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxDatabase)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSettings)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// labelAppTitle
|
|
||||||
//
|
|
||||||
this.labelAppTitle.AutoSize = true;
|
|
||||||
this.labelAppTitle.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.labelAppTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.labelAppTitle.ForeColor = System.Drawing.Color.DarkGray;
|
|
||||||
this.labelAppTitle.Location = new System.Drawing.Point(45, 10);
|
|
||||||
this.labelAppTitle.Name = "labelAppTitle";
|
|
||||||
this.labelAppTitle.Size = new System.Drawing.Size(134, 15);
|
|
||||||
this.labelAppTitle.TabIndex = 1;
|
|
||||||
this.labelAppTitle.Text = "MotoTRBO Gateway";
|
|
||||||
this.labelAppTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseDown);
|
|
||||||
this.labelAppTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseMove);
|
|
||||||
this.labelAppTitle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseUp);
|
|
||||||
//
|
|
||||||
// labelGwStatus
|
|
||||||
//
|
|
||||||
this.labelGwStatus.AutoSize = true;
|
|
||||||
this.labelGwStatus.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.labelGwStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 27F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.labelGwStatus.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.labelGwStatus.Location = new System.Drawing.Point(38, 57);
|
|
||||||
this.labelGwStatus.Name = "labelGwStatus";
|
|
||||||
this.labelGwStatus.Size = new System.Drawing.Size(152, 40);
|
|
||||||
this.labelGwStatus.TabIndex = 2;
|
|
||||||
this.labelGwStatus.Text = "Loading";
|
|
||||||
//
|
|
||||||
// labelStatus
|
|
||||||
//
|
|
||||||
this.labelStatus.AutoSize = true;
|
|
||||||
this.labelStatus.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.labelStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.labelStatus.ForeColor = System.Drawing.Color.DarkGray;
|
|
||||||
this.labelStatus.Location = new System.Drawing.Point(46, 93);
|
|
||||||
this.labelStatus.MinimumSize = new System.Drawing.Size(89, 12);
|
|
||||||
this.labelStatus.Name = "labelStatus";
|
|
||||||
this.labelStatus.Size = new System.Drawing.Size(89, 12);
|
|
||||||
this.labelStatus.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// notifyIcon
|
|
||||||
//
|
|
||||||
this.notifyIcon.Text = "notifyIcon1";
|
|
||||||
this.notifyIcon.Visible = true;
|
|
||||||
this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_DoubleClick);
|
|
||||||
//
|
|
||||||
// notifyIconContextMenuStrip
|
|
||||||
//
|
|
||||||
this.notifyIconContextMenuStrip.Name = "notifyIconContextMenuStrip";
|
|
||||||
this.notifyIconContextMenuStrip.Size = new System.Drawing.Size(61, 4);
|
|
||||||
//
|
|
||||||
// pictureBoxClose
|
|
||||||
//
|
|
||||||
this.pictureBoxClose.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxClose.Image = global::MotoTRBO_SOC.Properties.Resources.close;
|
|
||||||
this.pictureBoxClose.Location = new System.Drawing.Point(329, 5);
|
|
||||||
this.pictureBoxClose.Name = "pictureBoxClose";
|
|
||||||
this.pictureBoxClose.Size = new System.Drawing.Size(20, 22);
|
|
||||||
this.pictureBoxClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxClose.TabIndex = 5;
|
|
||||||
this.pictureBoxClose.TabStop = false;
|
|
||||||
this.pictureBoxClose.Click += new System.EventHandler(this.pictureBoxClose_Click);
|
|
||||||
this.pictureBoxClose.MouseEnter += new System.EventHandler(this.pictureBoxClose_MouseEnter);
|
|
||||||
this.pictureBoxClose.MouseLeave += new System.EventHandler(this.pictureBoxClose_MouseLeave);
|
|
||||||
//
|
|
||||||
// pictureBoxMinimize
|
|
||||||
//
|
|
||||||
this.pictureBoxMinimize.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxMinimize.Image = global::MotoTRBO_SOC.Properties.Resources.minimize;
|
|
||||||
this.pictureBoxMinimize.Location = new System.Drawing.Point(301, 4);
|
|
||||||
this.pictureBoxMinimize.Name = "pictureBoxMinimize";
|
|
||||||
this.pictureBoxMinimize.Size = new System.Drawing.Size(20, 22);
|
|
||||||
this.pictureBoxMinimize.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxMinimize.TabIndex = 4;
|
|
||||||
this.pictureBoxMinimize.TabStop = false;
|
|
||||||
this.pictureBoxMinimize.Click += new System.EventHandler(this.pictureBoxMinimize_Click);
|
|
||||||
this.pictureBoxMinimize.MouseEnter += new System.EventHandler(this.pictureBoxMinimize_MouseEnter);
|
|
||||||
this.pictureBoxMinimize.MouseLeave += new System.EventHandler(this.pictureBoxMinimize_MouseLeave);
|
|
||||||
//
|
|
||||||
// pictureBox1
|
|
||||||
//
|
|
||||||
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBox1.Image = global::MotoTRBO_SOC.Properties.Resources.logo_mg;
|
|
||||||
this.pictureBox1.Location = new System.Drawing.Point(9, 5);
|
|
||||||
this.pictureBox1.Name = "pictureBox1";
|
|
||||||
this.pictureBox1.Size = new System.Drawing.Size(37, 25);
|
|
||||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBox1.TabIndex = 0;
|
|
||||||
this.pictureBox1.TabStop = false;
|
|
||||||
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseDown);
|
|
||||||
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseMove);
|
|
||||||
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseUp);
|
|
||||||
//
|
|
||||||
// labelVersion
|
|
||||||
//
|
|
||||||
this.labelVersion.AutoSize = true;
|
|
||||||
this.labelVersion.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.labelVersion.Font = new System.Drawing.Font("OCR A Extended", 9.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.labelVersion.ForeColor = System.Drawing.Color.DarkGray;
|
|
||||||
this.labelVersion.Location = new System.Drawing.Point(16, 377);
|
|
||||||
this.labelVersion.Name = "labelVersion";
|
|
||||||
this.labelVersion.Size = new System.Drawing.Size(15, 13);
|
|
||||||
this.labelVersion.TabIndex = 6;
|
|
||||||
this.labelVersion.Text = "2";
|
|
||||||
this.labelVersion.DoubleClick += new System.EventHandler(this.labelVersion_DoubleClick);
|
|
||||||
//
|
|
||||||
// pictureBoxLoading
|
|
||||||
//
|
|
||||||
this.pictureBoxLoading.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxLoading.Image = global::MotoTRBO_SOC.Properties.Resources.loading;
|
|
||||||
this.pictureBoxLoading.Location = new System.Drawing.Point(3, 57);
|
|
||||||
this.pictureBoxLoading.Name = "pictureBoxLoading";
|
|
||||||
this.pictureBoxLoading.Size = new System.Drawing.Size(43, 44);
|
|
||||||
this.pictureBoxLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxLoading.TabIndex = 7;
|
|
||||||
this.pictureBoxLoading.TabStop = false;
|
|
||||||
//
|
|
||||||
// pictureBoxArs
|
|
||||||
//
|
|
||||||
this.pictureBoxArs.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxArs.Image = global::MotoTRBO_SOC.Properties.Resources.ars_icon_disabled;
|
|
||||||
this.pictureBoxArs.Location = new System.Drawing.Point(42, 121);
|
|
||||||
this.pictureBoxArs.Name = "pictureBoxArs";
|
|
||||||
this.pictureBoxArs.Size = new System.Drawing.Size(32, 32);
|
|
||||||
this.pictureBoxArs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxArs.TabIndex = 10;
|
|
||||||
this.pictureBoxArs.TabStop = false;
|
|
||||||
this.pictureBoxArs.Tag = "Disabled";
|
|
||||||
//
|
|
||||||
// pictureBoxPosition
|
|
||||||
//
|
|
||||||
this.pictureBoxPosition.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxPosition.Image = global::MotoTRBO_SOC.Properties.Resources.gps_icon_disabled;
|
|
||||||
this.pictureBoxPosition.Location = new System.Drawing.Point(122, 121);
|
|
||||||
this.pictureBoxPosition.Name = "pictureBoxPosition";
|
|
||||||
this.pictureBoxPosition.Size = new System.Drawing.Size(32, 32);
|
|
||||||
this.pictureBoxPosition.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxPosition.TabIndex = 11;
|
|
||||||
this.pictureBoxPosition.TabStop = false;
|
|
||||||
this.pictureBoxPosition.Tag = "Disabled";
|
|
||||||
//
|
|
||||||
// pictureBoxSMS
|
|
||||||
//
|
|
||||||
this.pictureBoxSMS.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxSMS.Image = global::MotoTRBO_SOC.Properties.Resources.sms_icon_disabled;
|
|
||||||
this.pictureBoxSMS.Location = new System.Drawing.Point(202, 121);
|
|
||||||
this.pictureBoxSMS.Name = "pictureBoxSMS";
|
|
||||||
this.pictureBoxSMS.Size = new System.Drawing.Size(32, 32);
|
|
||||||
this.pictureBoxSMS.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxSMS.TabIndex = 12;
|
|
||||||
this.pictureBoxSMS.TabStop = false;
|
|
||||||
this.pictureBoxSMS.Tag = "Disabled";
|
|
||||||
//
|
|
||||||
// pictureBoxDatabase
|
|
||||||
//
|
|
||||||
this.pictureBoxDatabase.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxDatabase.Image = global::MotoTRBO_SOC.Properties.Resources.database_icon_disabled;
|
|
||||||
this.pictureBoxDatabase.Location = new System.Drawing.Point(282, 121);
|
|
||||||
this.pictureBoxDatabase.Name = "pictureBoxDatabase";
|
|
||||||
this.pictureBoxDatabase.Size = new System.Drawing.Size(32, 32);
|
|
||||||
this.pictureBoxDatabase.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxDatabase.TabIndex = 13;
|
|
||||||
this.pictureBoxDatabase.TabStop = false;
|
|
||||||
this.pictureBoxDatabase.Tag = "Disabled";
|
|
||||||
//
|
|
||||||
// pictureBoxSettings
|
|
||||||
//
|
|
||||||
this.pictureBoxSettings.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxSettings.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
||||||
this.pictureBoxSettings.Image = global::MotoTRBO_SOC.Properties.Resources.settings_icon;
|
|
||||||
this.pictureBoxSettings.Location = new System.Drawing.Point(316, 371);
|
|
||||||
this.pictureBoxSettings.Name = "pictureBoxSettings";
|
|
||||||
this.pictureBoxSettings.Size = new System.Drawing.Size(32, 32);
|
|
||||||
this.pictureBoxSettings.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxSettings.TabIndex = 14;
|
|
||||||
this.pictureBoxSettings.TabStop = false;
|
|
||||||
this.pictureBoxSettings.Click += new System.EventHandler(this.pictureBoxSettings_Click);
|
|
||||||
//
|
|
||||||
// pictureBox2
|
|
||||||
//
|
|
||||||
this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
||||||
this.pictureBox2.Image = global::MotoTRBO_SOC.Properties.Resources.SafeNet_logo;
|
|
||||||
this.pictureBox2.Location = new System.Drawing.Point(231, 373);
|
|
||||||
this.pictureBox2.Name = "pictureBox2";
|
|
||||||
this.pictureBox2.Size = new System.Drawing.Size(88, 32);
|
|
||||||
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBox2.TabIndex = 15;
|
|
||||||
this.pictureBox2.TabStop = false;
|
|
||||||
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
|
|
||||||
//
|
|
||||||
// tbEvent
|
|
||||||
//
|
|
||||||
this.tbEvent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25)))));
|
|
||||||
this.tbEvent.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
this.tbEvent.Enabled = false;
|
|
||||||
this.tbEvent.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.tbEvent.Location = new System.Drawing.Point(39, 166);
|
|
||||||
this.tbEvent.Multiline = true;
|
|
||||||
this.tbEvent.Name = "tbEvent";
|
|
||||||
this.tbEvent.ReadOnly = true;
|
|
||||||
this.tbEvent.Size = new System.Drawing.Size(282, 199);
|
|
||||||
this.tbEvent.TabIndex = 16;
|
|
||||||
//
|
|
||||||
// FormMain
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.BackgroundImage = global::MotoTRBO_SOC.Properties.Resources.bg;
|
|
||||||
this.ClientSize = new System.Drawing.Size(355, 406);
|
|
||||||
this.Controls.Add(this.pictureBoxSettings);
|
|
||||||
this.Controls.Add(this.pictureBoxDatabase);
|
|
||||||
this.Controls.Add(this.pictureBoxSMS);
|
|
||||||
this.Controls.Add(this.pictureBoxPosition);
|
|
||||||
this.Controls.Add(this.pictureBoxArs);
|
|
||||||
this.Controls.Add(this.pictureBoxLoading);
|
|
||||||
this.Controls.Add(this.labelVersion);
|
|
||||||
this.Controls.Add(this.pictureBoxClose);
|
|
||||||
this.Controls.Add(this.pictureBoxMinimize);
|
|
||||||
this.Controls.Add(this.labelStatus);
|
|
||||||
this.Controls.Add(this.labelGwStatus);
|
|
||||||
this.Controls.Add(this.pictureBox1);
|
|
||||||
this.Controls.Add(this.labelAppTitle);
|
|
||||||
this.Controls.Add(this.pictureBox2);
|
|
||||||
this.Controls.Add(this.tbEvent);
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
||||||
this.Name = "FormMain";
|
|
||||||
this.Text = "Safenet MototTRBO Gateway";
|
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
|
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
|
||||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseDown);
|
|
||||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseMove);
|
|
||||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseUp);
|
|
||||||
this.Resize += new System.EventHandler(this.FormMain_Resize);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxClose)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMinimize)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLoading)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxArs)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPosition)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSMS)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxDatabase)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSettings)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.PictureBox pictureBox1;
|
|
||||||
private System.Windows.Forms.Label labelAppTitle;
|
|
||||||
private System.Windows.Forms.Label labelGwStatus;
|
|
||||||
private System.Windows.Forms.Label labelStatus;
|
|
||||||
private System.Windows.Forms.NotifyIcon notifyIcon;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxMinimize;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxClose;
|
|
||||||
private System.Windows.Forms.ContextMenuStrip notifyIconContextMenuStrip;
|
|
||||||
private System.Windows.Forms.Label labelVersion;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxLoading;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxArs;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxPosition;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxSMS;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxDatabase;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxSettings;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBox2;
|
|
||||||
private System.Windows.Forms.TextBox tbEvent;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,153 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Collections;
|
|
||||||
using MySql.Data.MySqlClient;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace ConnectPlus_SOC
|
|
||||||
{
|
|
||||||
class EmailHandler
|
|
||||||
{
|
|
||||||
//emai stuff
|
|
||||||
private EmailServerSSL sslServer;
|
|
||||||
private static System.Threading.Timer tCheckMail;
|
|
||||||
private string MyConString;
|
|
||||||
private string gatewayID;
|
|
||||||
|
|
||||||
public EmailHandler(string p_dbConStr, string p_gatewayID)
|
|
||||||
{
|
|
||||||
MyConString = p_dbConStr;
|
|
||||||
gatewayID = p_gatewayID;
|
|
||||||
|
|
||||||
//emai server ini
|
|
||||||
if (ConnectPlus_GW.cfg.enableEmailService)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Turning on EmailService on " + ConnectPlus_GW.cfg.user);
|
|
||||||
sslServer = new EmailServerSSL(ConnectPlus_GW.cfg.pop3Server, ConnectPlus_GW.cfg.pop3Port, ConnectPlus_GW.cfg.user, ConnectPlus_GW.cfg.psw);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "EmailService disabled!!!");
|
|
||||||
|
|
||||||
//start email timer... refresh time 1 min
|
|
||||||
if (ConnectPlus_GW.cfg.enableEmailService)
|
|
||||||
{
|
|
||||||
tCheckMail = new System.Threading.Timer(CheckMAil, null, new TimeSpan(0, 0, 0), new TimeSpan(0, 1, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#region email
|
|
||||||
|
|
||||||
private void CheckMAil(Object state)
|
|
||||||
{
|
|
||||||
// This method is executed by a thread pool thread
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, new string[] { "Checking mail at:" + DateTime.Now.ToString(), "For " + ConnectPlus_GW.cfg.user.ToString() + " on " + ConnectPlus_GW.cfg.smtpServer.ToString() });
|
|
||||||
ArrayList EmailList = sslServer.getEmails();
|
|
||||||
|
|
||||||
foreach (EmailtoSMS obj in EmailList)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, new string[] {"-----START OK----",
|
|
||||||
"From: " + obj.from,
|
|
||||||
"ID: " + obj.id,
|
|
||||||
"Text: " + obj.text});
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
obj.text = obj.text.Replace("'", "`");
|
|
||||||
obj.text = obj.text.Replace("#", " ");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Error on converting email:" + ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.text.Length > 140 - 3 - obj.from.Length)
|
|
||||||
obj.text = obj.text.Remove(140 - 3 - obj.from.Length) + " [" + obj.from + "]";
|
|
||||||
else
|
|
||||||
obj.text = obj.text + " [" + obj.from + "]";
|
|
||||||
//SendSMS(obj.id, obj.text, -1); // don't wait for confirmation
|
|
||||||
InsertSMSinDB(obj.text, obj.id);
|
|
||||||
//LOGS.LOG(ConnectPlus_GW.cfg.gw_id + obj.id + " Email sms:" + obj.text);
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Email check done!!!");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error on CheckMAil:" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//sms-> email
|
|
||||||
public static void sendMail(string mailAdr, string mailBody, string radioID)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Sending mail to " + mailAdr + " from radioId " + radioID.ToString());
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MailMessage message = new MailMessage();
|
|
||||||
message.From = new MailAddress(ConnectPlus_GW.cfg.user);
|
|
||||||
message.To.Add(mailAdr);
|
|
||||||
message.Subject = "RadioID: " + radioID.ToString() + " Subject:" + (mailBody.Length < 25 ? mailBody : (mailBody.Remove(25) + "..."));
|
|
||||||
message.Body = "You received a message from radio id " + radioID.ToString() +
|
|
||||||
"\n------------------------------\n" +
|
|
||||||
mailBody +
|
|
||||||
"\n------------------------------\n ";
|
|
||||||
message.IsBodyHtml = true;
|
|
||||||
|
|
||||||
EmailServerSSL.sendEmail(ConnectPlus_GW.cfg.smtpServer, ConnectPlus_GW.cfg.smtpPort, ConnectPlus_GW.cfg.user, ConnectPlus_GW.cfg.psw, message, ConnectPlus_GW.cfg.sslState);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in sendMail: "+ex.ToString());
|
|
||||||
//Console.WriteLine(e.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//insert SMS in DB for further processing
|
|
||||||
private bool InsertSMSinDB(string body, string p_radioID)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int suDBid = 0;
|
|
||||||
lock (SN_Queues.ht_SUInfo.SyncRoot)
|
|
||||||
{
|
|
||||||
if (SN_Queues.ht_SUInfo != null)
|
|
||||||
{
|
|
||||||
if (SN_Queues.ht_SUInfo.ContainsKey(p_radioID))
|
|
||||||
suDBid = ((SUinfo)SN_Queues.ht_SUInfo[p_radioID]).DBid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (suDBid == 0)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, "Unit with IMEI:" + p_radioID + " not found in DB!!!!");
|
|
||||||
//LOGS.LOG("Unit with IMEI:" + p_radioID + " not found in DB!!!!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MySqlConnection connection = new MySqlConnection(MyConString);
|
|
||||||
MySqlConnection connectionSet = new MySqlConnection(MyConString);
|
|
||||||
string query = "insert into text_message (message_content,unit_id,date_created,time_sent_or_received,message_type,is_sent) values ('" + body +
|
|
||||||
"'," + suDBid +
|
|
||||||
",'" + DateTime.Now.ToUniversalTime().ToString("yyyy:MM:dd HH:mm:ss") +
|
|
||||||
"','" + DateTime.Now.ToUniversalTime().ToString("yyyy:MM:dd HH:mm:ss") +
|
|
||||||
"','OUT',0)";
|
|
||||||
MySqlCommand setSent = new MySqlCommand(query, connectionSet);
|
|
||||||
|
|
||||||
connectionSet.Open();
|
|
||||||
setSent.ExecuteNonQuery();
|
|
||||||
connectionSet.Close();
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "SMS added to DB : ID " + suDBid + " body:" + body);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error InsertSMSinDB in database by EmailHandler");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{A06DA654-9872-4980-A63D-BF68F4E63913}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>ConsoleApplication1</RootNamespace>
|
|
||||||
<AssemblyName>ConsoleApplication1</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<PublishUrl>publish\</PublishUrl>
|
|
||||||
<Install>true</Install>
|
|
||||||
<InstallFrom>Disk</InstallFrom>
|
|
||||||
<UpdateEnabled>false</UpdateEnabled>
|
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
|
||||||
<UpdateInterval>7</UpdateInterval>
|
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
|
||||||
<UpdateRequired>false</UpdateRequired>
|
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="MIMEParser">
|
|
||||||
<HintPath>..\lib\MIMEParser.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Nini">
|
|
||||||
<HintPath>..\lib\Nini.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="OpenPOP">
|
|
||||||
<HintPath>..\lib\OpenPOP.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Definitions.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\MMSYSERR.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\WavConstants.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\WAVEFORMATEX.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\WAVEHDR.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\WAVEOUTCAPS.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\WavFormat.cs" />
|
|
||||||
<Compile Include="Media\Wave\native\WavMethods.cs" />
|
|
||||||
<Compile Include="Media\Wave\WaveIn.cs" />
|
|
||||||
<Compile Include="Media\Wave\WaveOut.cs" />
|
|
||||||
<Compile Include="Media\Wave\WavInDevice.cs" />
|
|
||||||
<Compile Include="Media\Wave\WavOutDevice.cs" />
|
|
||||||
<Compile Include="SM.cs" />
|
|
||||||
<Compile Include="Encryption.cs" />
|
|
||||||
<Compile Include="UdpMulticast.cs" />
|
|
||||||
<Compile Include="Config.cs" />
|
|
||||||
<Compile Include="EmailServer.cs" />
|
|
||||||
<Compile Include="libZPlay.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="config.ini">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Windows Installer 3.1</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SafeNetLib\SafeNetLib.csproj">
|
|
||||||
<Project>{5AFA65B8-32DA-4924-BD06-7C8802F02BE4}</Project>
|
|
||||||
<Name>SafeNetLib</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
@ -1,315 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace Teltonika_SOC
|
|
||||||
{
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
public static Config cfg;
|
|
||||||
public static bool unitsLoaded = false;
|
|
||||||
public static bool addressLoaded = false;
|
|
||||||
public static DateTime startTime;
|
|
||||||
public static LOGS hLOG;
|
|
||||||
|
|
||||||
LocationThread LocationConnection = null; // the threads for the 5 services we handle
|
|
||||||
DBconnThread DBConnection = null;
|
|
||||||
|
|
||||||
Thread LocationThreadobj = null;
|
|
||||||
Thread DBThreadobjGPS = null;
|
|
||||||
Thread DBThreadobjAddr = null;
|
|
||||||
Thread DBThreadobjAux = null;
|
|
||||||
|
|
||||||
//alerts
|
|
||||||
private static AlertHandler alertHandler;
|
|
||||||
|
|
||||||
#region setupmode variables
|
|
||||||
public static string[] commands;
|
|
||||||
public static List<string> commandsList = new List<string>();
|
|
||||||
public static int parametersCount = 0;
|
|
||||||
public static bool setupMode = false;
|
|
||||||
public static bool loadUnitsFromFile = false;
|
|
||||||
public static readonly object locker = new object();
|
|
||||||
public static Hashtable ImeiHT = new Hashtable();
|
|
||||||
public static bool isUnix = false;
|
|
||||||
#endregion setupmode variables
|
|
||||||
|
|
||||||
#region Connection_TYPE
|
|
||||||
public static Connection_TYPE con_type = Connection_TYPE.TCP;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
|
|
||||||
hLOG = new LOGS();
|
|
||||||
Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
||||||
Console.WriteLine("Safemobile Teltonika Gateway for Safenet " + v.ToString() + ", Copyright 2012");
|
|
||||||
Console.WriteLine(" (www.Safemobile.com) ");
|
|
||||||
Console.WriteLine("-----------------------------------\n");
|
|
||||||
Console.WriteLine("Version: " + v.ToString());
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : Application started!!!!");
|
|
||||||
startTime = DateTime.Now;
|
|
||||||
isUnix = Utils.isUnix();
|
|
||||||
if (args.Length > 0)
|
|
||||||
{
|
|
||||||
if (args[0] == "-v")
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Application ended!!!!");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : Application ended!!!!");
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
}
|
|
||||||
if (args[0] == "-h" || args[0] == "--help")
|
|
||||||
{
|
|
||||||
Console.WriteLine("-v : Version Number");
|
|
||||||
Console.WriteLine("-s <file path> : Setup Mode (OVER TCP ONLY)");
|
|
||||||
//Console.WriteLine("-u : Start UDP Server");
|
|
||||||
//Console.WriteLine("-t : Start TCP Server");
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
}
|
|
||||||
//if (args[0] == "-u")
|
|
||||||
//{
|
|
||||||
// con_type = Connection_TYPE.UDP;
|
|
||||||
//}
|
|
||||||
//if (args[0] == "-t")
|
|
||||||
//{
|
|
||||||
// con_type = Connection_TYPE.TCP;
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (args[0] == "-s")
|
|
||||||
{
|
|
||||||
if (args.Count() == 2 && File.Exists(args[1]))
|
|
||||||
{
|
|
||||||
lock (locker)
|
|
||||||
{
|
|
||||||
ThreadPool.QueueUserWorkItem(state => ReadSetupFile(args[1]));
|
|
||||||
setupMode = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.WriteLine("Unable to start Setupmode! Invalid setup file location! ", ConsoleColor.Red, Program.isUnix);
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//creat PID file
|
|
||||||
Process currentProcess = Process.GetCurrentProcess();
|
|
||||||
int procid = currentProcess.Id;
|
|
||||||
if (File.Exists("pid.pid"))
|
|
||||||
{
|
|
||||||
File.Delete("pid.pid");
|
|
||||||
}
|
|
||||||
System.IO.File.WriteAllText("pid.pid", procid.ToString());
|
|
||||||
|
|
||||||
Program p = new Program();
|
|
||||||
//load config
|
|
||||||
|
|
||||||
if (!p.LoadConfig())
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "EERROR loading configs!!!!\nPlease fix configs in DB/cfg file and restart the GW!!!");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : EERROR loading configs!!!!\nPlease fix configs in DB/cfg file and restart the GW!!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (cfg.transport == "udp")
|
|
||||||
con_type = Connection_TYPE.UDP;
|
|
||||||
else
|
|
||||||
con_type = Connection_TYPE.TCP;
|
|
||||||
|
|
||||||
lock (locker)
|
|
||||||
{
|
|
||||||
Utils.WriteLine("»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»««««««««««««««««««««««««««««««", ConsoleColor.Magenta, Program.isUnix);
|
|
||||||
Utils.WriteLine(string.Format("»»»»»»»»»»»»»»»» {0} Server Mode ««««««««««««««««", con_type.ToString()), ConsoleColor.Magenta, Program.isUnix);
|
|
||||||
Utils.WriteLine("»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»««««««««««««««««««««««««««««««", ConsoleColor.Magenta, Program.isUnix);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (args.Length > 0 && args[0] != null && args[0] != "" && args[0].Substring(0,1) != "-")
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "GW started with param:" + args[0]);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "Replacing config.ini GW_ID:" + cfg.gatewayID + " with:" + args[0]);
|
|
||||||
cfg.gatewayID = args[0];
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//start DEBUG
|
|
||||||
//SafeNetLib.Debug d = new SafeNetLib.Debug(cfg.debug_port);
|
|
||||||
|
|
||||||
p.StartDBService();
|
|
||||||
//wait
|
|
||||||
while (!Program.unitsLoaded)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Waiting for units to be fetched!!! sleep 5 secs!!!");
|
|
||||||
Thread.Sleep(10000);
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "---- Unit load finished -----");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : ---- Unit load finished -----");
|
|
||||||
|
|
||||||
p.StartLocationService();
|
|
||||||
|
|
||||||
p.StartAlertService();
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "###### Gateway started #######");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : ###### Gateway started #######");
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
Thread.Sleep(10000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool LoadConfig()
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
cfg = new Config();
|
|
||||||
ret = true;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartDBService()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//SOC_connection sc = new SOC_connection(Server_IP, Server_Port, gatewayID);
|
|
||||||
string MyConString = "SERVER=" + cfg.SERVER + ";" +
|
|
||||||
"DATABASE=" + cfg.DATABASE + ";" +
|
|
||||||
"UID=" + cfg.UID + ";" +
|
|
||||||
"PASSWORD=" + cfg.PASSWORD + ";Pooling=false;";
|
|
||||||
|
|
||||||
DBConnection = new DBconnThread(MyConString, cfg.gatewayID);
|
|
||||||
|
|
||||||
//Start GPS DB thread
|
|
||||||
DBThreadobjGPS = new Thread(new ThreadStart(DBConnection.HandleConnectionGPS));
|
|
||||||
DBThreadobjGPS.IsBackground = true;
|
|
||||||
DBThreadobjGPS.Start();
|
|
||||||
|
|
||||||
//Start Units DB thread
|
|
||||||
DBThreadobjAux = new Thread(new ThreadStart(DBConnection.HandleConnectionAux));
|
|
||||||
DBThreadobjAux.IsBackground = true;
|
|
||||||
DBThreadobjAux.Start();
|
|
||||||
|
|
||||||
//Start Addres insert thread
|
|
||||||
DBThreadobjAddr = new Thread(new ThreadStart(DBConnection.HandleConnectionAddr));
|
|
||||||
DBThreadobjAddr.IsBackground = true;
|
|
||||||
DBThreadobjAddr.Start();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Could not intialize the connection with location server!\r\n" + e.Message + "\r\nPlease check your internet connection !!");
|
|
||||||
//System.Environment.Exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartLocationService()
|
|
||||||
{
|
|
||||||
if (con_type == Connection_TYPE.TCP)
|
|
||||||
{
|
|
||||||
// create thread to listen TCP
|
|
||||||
LocationConnection = new LocationThread();
|
|
||||||
LocationConnection.port = cfg.locPort;
|
|
||||||
//LocationConnection.parent = this;
|
|
||||||
LocationThreadobj = new Thread(new ThreadStart(LocationConnection.HandleConnection));
|
|
||||||
LocationThreadobj.IsBackground = true;
|
|
||||||
LocationThreadobj.Start();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UdpConnectionThread udpConnection = new UdpConnectionThread();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartAlertService()
|
|
||||||
{
|
|
||||||
string MyConString = "SERVER=" + cfg.SERVER + ";" +
|
|
||||||
"DATABASE=" + cfg.DATABASE + ";" +
|
|
||||||
"UID=" + cfg.UID + ";" +
|
|
||||||
"PASSWORD=" + cfg.PASSWORD + ";Pooling=false;";
|
|
||||||
DBhandle DB = new DBhandle(MyConString, cfg.gatewayID);
|
|
||||||
alertHandler = new AlertHandler(DB, cfg.alert_smtpServer, cfg.alert_smtpPort, cfg.alert_user, cfg.alert_psw, cfg.alert_sslState);
|
|
||||||
|
|
||||||
//alertHandler.TestSendEmail("gabriel.oprea@safemobile.com", "test");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ReadSetupFile(string filename)
|
|
||||||
{
|
|
||||||
lock (locker)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (File.ReadLines(filename).Count() == 0)
|
|
||||||
{
|
|
||||||
Utils.WriteLine("Setup file is empty! ", ConsoleColor.Red, Program.isUnix);
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
}
|
|
||||||
using (var rd = new StreamReader(filename))
|
|
||||||
{
|
|
||||||
lock (locker)
|
|
||||||
{
|
|
||||||
Utils.WriteLine("Reading setup file... ", ConsoleColor.Yellow, Program.isUnix);
|
|
||||||
|
|
||||||
while (!rd.EndOfStream)
|
|
||||||
{
|
|
||||||
int param = -1;
|
|
||||||
var command = rd.ReadLine().TrimStart().TrimEnd();
|
|
||||||
var splits = command.Split(':');
|
|
||||||
if (splits[0] == "command")
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
commandsList.Add(splits[1].TrimStart().TrimEnd());
|
|
||||||
parametersCount++;
|
|
||||||
Utils.WriteLine("Add command: <<" + splits[1].TrimStart().TrimEnd() + ">> to commands array!", ConsoleColor.Green, Program.isUnix);
|
|
||||||
}
|
|
||||||
if (command.StartsWith("units[") && command.Contains("units[") && command.Contains("]"))
|
|
||||||
{
|
|
||||||
loadUnitsFromFile = true;
|
|
||||||
command = command.Remove(0, command.IndexOf("units[") + 6);
|
|
||||||
command = command.Remove(command.IndexOf("]"));
|
|
||||||
var units = command.Split(',');
|
|
||||||
foreach (var unit in units)
|
|
||||||
{
|
|
||||||
if (!ImeiHT.Contains(unit))
|
|
||||||
ImeiHT.Add(unit, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (loadUnitsFromFile)
|
|
||||||
{
|
|
||||||
Utils.WriteLine("Setup mode: Done loading " + Program.ImeiHT.Count + " units from Setup file!", ConsoleColor.Cyan, Program.isUnix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Utils.WriteLine("Setup commands successfully read from file! ", ConsoleColor.Yellow, Program.isUnix);
|
|
||||||
commands = commandsList.ToArray();
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
Utils.WriteLine("File used by another process! ", ConsoleColor.Red,Program.isUnix);
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Nini.Config;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace LMdirect_SOC
|
|
||||||
{
|
|
||||||
public class Config
|
|
||||||
{
|
|
||||||
private IConfigSource source = null;
|
|
||||||
private string CFG_FILE = "config.ini";
|
|
||||||
|
|
||||||
public string gatewayID;
|
|
||||||
public int locPort;
|
|
||||||
|
|
||||||
public string SERVER;
|
|
||||||
public string DATABASE;
|
|
||||||
public string UID;
|
|
||||||
public string PASSWORD;
|
|
||||||
public bool db_active;
|
|
||||||
|
|
||||||
public int debug_port;
|
|
||||||
|
|
||||||
//email service for alerts
|
|
||||||
public string alert_smtpServer = "";
|
|
||||||
public string alert_pop3Server = "";
|
|
||||||
public string alert_pop3Port = "";
|
|
||||||
public string alert_smtpPort = "";
|
|
||||||
public bool alert_sslState = false;
|
|
||||||
public string alert_user, alert_psw;
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList ar_radioIPs = new ArrayList();
|
|
||||||
|
|
||||||
public Config(string CFG_FILE = "config.ini")
|
|
||||||
{
|
|
||||||
LoadConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadConfig()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
source = new IniConfigSource(CFG_FILE);
|
|
||||||
|
|
||||||
gatewayID = source.Configs["GATEWAY"].Get("id");
|
|
||||||
locPort = Convert.ToInt32(source.Configs["GATEWAY"].Get("port"));
|
|
||||||
|
|
||||||
//MySQL connection info (for SMS)
|
|
||||||
SERVER = source.Configs["MySQL"].Get("SERVER");
|
|
||||||
DATABASE = source.Configs["MySQL"].Get("DATABASE");
|
|
||||||
UID = source.Configs["MySQL"].Get("UID");
|
|
||||||
PASSWORD = source.Configs["MySQL"].Get("PASSWORD");
|
|
||||||
|
|
||||||
db_active = Convert.ToBoolean(source.Configs["MySQL"].Get("active"));
|
|
||||||
|
|
||||||
//debug port is GWID with the first digit replage by 3. ex: 95001 -> 35001
|
|
||||||
string str_debug_port = "3" + gatewayID.Substring(1);
|
|
||||||
debug_port = Int32.Parse(str_debug_port);
|
|
||||||
|
|
||||||
////for alerts
|
|
||||||
//alert_pop3Server = source.Configs["EmailServiceAlerts"].Get("Pop3Server");
|
|
||||||
//alert_smtpServer = source.Configs["EmailServiceAlerts"].Get("SmtpServer");
|
|
||||||
//alert_pop3Port = source.Configs["EmailServiceAlerts"].Get("Pop3Port");
|
|
||||||
//alert_smtpPort = source.Configs["EmailServiceAlerts"].Get("SmtpPort");
|
|
||||||
//alert_sslState = Convert.ToBoolean(source.Configs["EmailServiceAlerts"].Get("EnableSSL"));
|
|
||||||
//alert_user = source.Configs["EmailServiceAlerts"].Get("User");
|
|
||||||
//alert_psw = source.Configs["EmailServiceAlerts"].Get("Pass");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "LoadSetup() Exception: " + ex.ToString());
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CTRL, "LoadSetup file OK !");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,73 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{BFB0214B-E107-406D-9D31-AC87948F7E62}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Landmarks_Import</RootNamespace>
|
|
||||||
<AssemblyName>Landmarks_Import</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Nini">
|
|
||||||
<HintPath>..\lib\Nini.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SafeNetLib">
|
|
||||||
<HintPath>..\SafeNetLib\bin\Debug\SafeNetLib.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Config.cs" />
|
|
||||||
<Compile Include="GoogleSignedUrl.cs" />
|
|
||||||
<Compile Include="MainClass.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
<None Include="config.ini">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
Before Width: | Height: | Size: 25 KiB |
@ -1,213 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace PAL_SOC
|
|
||||||
{
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
public static DateTime lastEntry = DateTime.Now;
|
|
||||||
|
|
||||||
public static Config cfg;
|
|
||||||
public static bool unitsLoaded = false;
|
|
||||||
public static bool addressLoaded = false;
|
|
||||||
|
|
||||||
public static LOGS hLOG;
|
|
||||||
|
|
||||||
LocationThread LocationConnection = null; // the threads for the 5 services we handle
|
|
||||||
DBconnThread DBConnection = null;
|
|
||||||
|
|
||||||
Thread LocationThreadobj = null;
|
|
||||||
Thread DBThreadobjGPS = null;
|
|
||||||
Thread DBThreadobjAddr = null;
|
|
||||||
Thread DBThreadobjAux = null;
|
|
||||||
|
|
||||||
//alerts
|
|
||||||
private static AlertHandler alertHandler;
|
|
||||||
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
|
|
||||||
hLOG = new LOGS();
|
|
||||||
Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
||||||
Console.WriteLine("Safemobile PAL Gateway for Safenet " + v.ToString() + ", Copyright 2012");
|
|
||||||
Console.WriteLine(" (www.Safemobile.com) ");
|
|
||||||
Console.WriteLine("-----------------------------------\n");
|
|
||||||
Console.WriteLine("Version: " + v.ToString());
|
|
||||||
|
|
||||||
if (args.Length > 0)
|
|
||||||
{
|
|
||||||
if (args[0] == "-v")
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Application ended!!!!");
|
|
||||||
System.Environment.Exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//creat PID file
|
|
||||||
Process currentProcess = Process.GetCurrentProcess();
|
|
||||||
int procid = currentProcess.Id;
|
|
||||||
if (File.Exists("pid.pid"))
|
|
||||||
{
|
|
||||||
File.Delete("pid.pid");
|
|
||||||
}
|
|
||||||
System.IO.File.WriteAllText("pid.pid", procid.ToString());
|
|
||||||
|
|
||||||
Program p = new Program();
|
|
||||||
//load config
|
|
||||||
|
|
||||||
if (!p.LoadConfig())
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "EERROR loading configs!!!!\nPlease fix configs in DB/cfg file and restart the GW!!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (args.Length > 0 && args[0] != null && args[0] != "")
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "GW started with param:" + args[0]);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "Replacing config.ini GW_ID:" + cfg.gatewayID + " with:" + args[0]);
|
|
||||||
cfg.gatewayID = args[0];
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CFG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//start DEBUG
|
|
||||||
//SafeNetLib.Debug d = new SafeNetLib.Debug(cfg.debug_port);
|
|
||||||
|
|
||||||
p.StartDBService();
|
|
||||||
//wait
|
|
||||||
while (!Program.unitsLoaded)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Waiting for units to be fetched!!! sleep 5 secs!!!");
|
|
||||||
Thread.Sleep(10000);
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "---- Unit load finished -----");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "------------------------------");
|
|
||||||
|
|
||||||
p.StartLocationService();
|
|
||||||
|
|
||||||
p.StartAlertService();
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "###### Gateway started #######");
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
Thread.Sleep(10000);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Last entry at:" + Program.lastEntry + " Current time :" + DateTime.Now);
|
|
||||||
LOGS.LOG("Last entry at:" + Program.lastEntry + " Current time :" + DateTime.Now);
|
|
||||||
TimeSpan span = DateTime.Now.Subtract(Program.lastEntry);
|
|
||||||
if (span.TotalMinutes > 10)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Nothing added to BD for 10 minutes.\nRestareting all DB threads.");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
LOGS.LOG("Nothing added to BD for 10 minutes.");
|
|
||||||
Program.lastEntry = DateTime.Now;
|
|
||||||
|
|
||||||
//p.RestartApp();
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Adding restart INFO to LOG file");
|
|
||||||
string format = "dd/MM/yyyy HH:mm";
|
|
||||||
string s_time = "[" + DateTime.Now.ToString(format) + "] ";
|
|
||||||
LOGS.LOG("@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
LOGS.LOG(s_time + "no GPS received for 10 minutes");
|
|
||||||
LOGS.LOG(s_time + "should restart");
|
|
||||||
LOGS.LOG("@@@@@@@@@@@@@@@@@@@@@");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool LoadConfig()
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
cfg = new Config();
|
|
||||||
ret = true;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartDBService()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//SOC_connection sc = new SOC_connection(Server_IP, Server_Port, gatewayID);
|
|
||||||
string MyConString = "SERVER=" + cfg.SERVER + ";" +
|
|
||||||
"DATABASE=" + cfg.DATABASE + ";" +
|
|
||||||
"UID=" + cfg.UID + ";" +
|
|
||||||
"PASSWORD=" + cfg.PASSWORD + ";Pooling=false;";
|
|
||||||
|
|
||||||
DBConnection = new DBconnThread(MyConString, cfg.gatewayID);
|
|
||||||
|
|
||||||
//Start GPS DB thread
|
|
||||||
DBThreadobjGPS = new Thread(new ThreadStart(DBConnection.HandleConnectionGPS));
|
|
||||||
DBThreadobjGPS.IsBackground = true;
|
|
||||||
DBThreadobjGPS.Start();
|
|
||||||
|
|
||||||
//Start Units DB thread
|
|
||||||
DBThreadobjAux = new Thread(new ThreadStart(DBConnection.HandleConnectionAux));
|
|
||||||
DBThreadobjAux.IsBackground = true;
|
|
||||||
DBThreadobjAux.Start();
|
|
||||||
|
|
||||||
//Start Addres insert thread
|
|
||||||
DBThreadobjAddr = new Thread(new ThreadStart(DBConnection.HandleConnectionAddr));
|
|
||||||
DBThreadobjAddr.IsBackground = true;
|
|
||||||
DBThreadobjAddr.Start();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Could not intialize the connection with location server!\r\n" + e.Message + "\r\nPlease check your internet connection !!");
|
|
||||||
//System.Environment.Exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartLocationService()
|
|
||||||
{
|
|
||||||
// create thread to listen UDP
|
|
||||||
LocationConnection = new LocationThread();
|
|
||||||
LocationConnection.port = cfg.locPort;
|
|
||||||
//LocationConnection.parent = this;
|
|
||||||
LocationThreadobj = new Thread(new ThreadStart(LocationConnection.HandleConnection));
|
|
||||||
LocationThreadobj.IsBackground = true;
|
|
||||||
LocationThreadobj.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void StartAlertService()
|
|
||||||
{
|
|
||||||
string MyConString = "SERVER=" + cfg.SERVER + ";" +
|
|
||||||
"DATABASE=" + cfg.DATABASE + ";" +
|
|
||||||
"UID=" + cfg.UID + ";" +
|
|
||||||
"PASSWORD=" + cfg.PASSWORD + ";Pooling=false;";
|
|
||||||
DBhandle DB = new DBhandle(MyConString, cfg.gatewayID);
|
|
||||||
alertHandler = new AlertHandler(DB, cfg.alert_smtpServer, cfg.alert_smtpPort, cfg.alert_user, cfg.alert_psw,cfg.alert_sslState);
|
|
||||||
|
|
||||||
//alertHandler.TestSendEmail("gabriel.oprea@safemobile.com", "test");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void RestartApp()
|
|
||||||
{
|
|
||||||
Process oldProcess = Process.GetCurrentProcess();
|
|
||||||
oldProcess.WaitForExit(5000);
|
|
||||||
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
|
||||||
System.Environment.Exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace SN_Server
|
|
||||||
{
|
|
||||||
public class UnitList
|
|
||||||
{
|
|
||||||
private Hashtable ht_unitlist;
|
|
||||||
public int Count;
|
|
||||||
|
|
||||||
public UnitList()
|
|
||||||
{
|
|
||||||
ht_unitlist = new Hashtable();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(Unit unit)
|
|
||||||
{
|
|
||||||
if (ht_unitlist.ContainsKey(unit.RadioID))
|
|
||||||
{
|
|
||||||
ht_unitlist.Remove(unit.RadioID);
|
|
||||||
}
|
|
||||||
|
|
||||||
ht_unitlist.Add(unit.RadioID, unit);
|
|
||||||
Count = ht_unitlist.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Print()
|
|
||||||
{
|
|
||||||
Console.WriteLine("Unit list count: {0}", ht_unitlist.Count);
|
|
||||||
foreach(DictionaryEntry de in ht_unitlist)
|
|
||||||
{
|
|
||||||
Console.WriteLine("unit Key:" + de.Key + " value: DBid:" + ((Unit)de.Value).DBid
|
|
||||||
+ " RepInterval:" + ((Unit)de.Value).Reporting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Unit getUnitAtPosition(int position)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
foreach (DictionaryEntry de in ht_unitlist)
|
|
||||||
{
|
|
||||||
if(position == i)
|
|
||||||
return (Unit)de.Value;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetReportingInterval(string radioID)
|
|
||||||
{
|
|
||||||
return ((Unit)ht_unitlist[radioID]).Reporting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetDBid(string radioID)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
lock (ht_unitlist.SyncRoot)
|
|
||||||
{
|
|
||||||
if (ht_unitlist.ContainsKey(radioID))
|
|
||||||
{
|
|
||||||
ret = ((Unit)ht_unitlist[radioID]).DBid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
#1111#1#
|
|
||||||
#1655#1#
|
|
||||||
#1657#1#
|
|
||||||
#1658#1#
|
|
||||||
#1659#1#
|
|
||||||
#1660#1#
|
|
||||||
#1755#1#
|
|
||||||
#1151#1#
|
|
||||||
#1380#1#
|
|
||||||
#1319#1#
|
|
||||||
#1361#1#
|
|
||||||
#1362#1#
|
|
||||||
#1360#1#
|
|
||||||
#1650#1#
|
|
||||||
#5108#1#
|
|
||||||
#1650#1#
|
|
||||||
#1655#1#
|
|
||||||
#1657#1#
|
|
||||||
#1658#1#
|
|
||||||
#1659#1#
|
|
||||||
#1660#1#
|
|
||||||
#24#1#
|
|
||||||
#29#1#
|
|
||||||
#1320#1#
|
|
||||||
#6500#1#
|
|
||||||
#6400#1#
|
|
||||||
#6100#1#
|
|
||||||
#6200#1#
|
|
||||||
#6300#1#
|
|
||||||
#1647#1#
|
|
||||||
#1755#1#
|
|
||||||
#1328#1#
|
|
||||||
#1331#1#
|
|
||||||
#1719#1#
|
|
||||||
#1752#1#
|
|
||||||
#1380#1#
|
|
||||||
#8241#1#
|
|
||||||
#1753#1#
|
|
||||||
#1370#1#
|
|
||||||
#1343#1#
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Teltonika_SOC")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Teltonika_SOC")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("85e8b3ea-cf85-4a61-8732-a1009142768d")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.7361")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.7361")]
|
|
@ -1,137 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
using MySql.Data.MySqlClient;
|
|
||||||
|
|
||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
public class EmailHandler
|
|
||||||
{
|
|
||||||
//emai stuff
|
|
||||||
private EmailServerSSL sslServer;
|
|
||||||
private static System.Threading.Timer tCheckMail;
|
|
||||||
private string MyConString;
|
|
||||||
private string gatewayID;
|
|
||||||
|
|
||||||
public EmailHandler(string p_dbConStr, string p_gatewayID)
|
|
||||||
{
|
|
||||||
MyConString = p_dbConStr;
|
|
||||||
gatewayID = p_gatewayID;
|
|
||||||
|
|
||||||
//emai server ini
|
|
||||||
if (MotoTRBO_GW.cfg.enableEmailService)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Turning on EmailService on " + MotoTRBO_GW.cfg.user);
|
|
||||||
sslServer = new EmailServerSSL(MotoTRBO_GW.cfg.pop3Server, MotoTRBO_GW.cfg.pop3Port, MotoTRBO_GW.cfg.user, MotoTRBO_GW.cfg.psw);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "EmailService disabled!!!");
|
|
||||||
|
|
||||||
//start email timer... refresh time 1 min
|
|
||||||
if (MotoTRBO_GW.cfg.enableEmailService)
|
|
||||||
{
|
|
||||||
tCheckMail = new System.Threading.Timer(CheckMAil, null, new TimeSpan(0, 0, 0), new TimeSpan(0, 1, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#region email
|
|
||||||
|
|
||||||
private void CheckMAil(Object state)
|
|
||||||
{
|
|
||||||
// This method is executed by a thread pool thread
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, new string[] { "Checking mail at:" + DateTime.Now.ToString(), "For " + MotoTRBO_GW.cfg.user.ToString() + " on " + MotoTRBO_GW.cfg.smtpServer.ToString() });
|
|
||||||
ArrayList EmailList = sslServer.getEmails();
|
|
||||||
|
|
||||||
foreach (EmailtoSMS obj in EmailList)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, new string[] {"-----START OK----",
|
|
||||||
"From: " + obj.from,
|
|
||||||
"ID: " + obj.id,
|
|
||||||
"Text: " + obj.text});
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
obj.text = obj.text.Replace("'", "`");
|
|
||||||
obj.text = obj.text.Replace("#", " ");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Error on converting email:" + ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.text.Length > 140 - 3 - obj.from.Length)
|
|
||||||
obj.text = obj.text.Remove(140 - 3 - obj.from.Length) + " [" + obj.from + "]";
|
|
||||||
else
|
|
||||||
obj.text = obj.text + " [" + obj.from + "]";
|
|
||||||
//SendSMS(obj.id, obj.text, -1); // don't wait for confirmation
|
|
||||||
InsertSMSinDB(obj.text, obj.id);
|
|
||||||
LOGS.LOG(MotoTRBO_GW.cfg.gw_id + obj.id + " Email sms:" + obj.text);
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Email check done!!!");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error on CheckMAil:" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//sms-> email
|
|
||||||
public static void sendMail(string mailAdr, string mailBody, string radioID)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Email, "Sending mail to " + mailAdr + " from radioId " + radioID.ToString());
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MailMessage message = new MailMessage();
|
|
||||||
message.From = new MailAddress(MotoTRBO_GW.cfg.user);
|
|
||||||
message.To.Add(mailAdr);
|
|
||||||
message.Subject = "RadioID: " + radioID.ToString() + " Subject:" + (mailBody.Length < 25 ? mailBody : (mailBody.Remove(25) + "..."));
|
|
||||||
message.Body = "You received a message from radio id " + radioID.ToString() +
|
|
||||||
"\n------------------------------\n" +
|
|
||||||
mailBody +
|
|
||||||
"\n------------------------------\n ";
|
|
||||||
message.IsBodyHtml = true;
|
|
||||||
|
|
||||||
EmailServerSSL.sendEmail(MotoTRBO_GW.cfg.smtpServer, MotoTRBO_GW.cfg.smtpPort, MotoTRBO_GW.cfg.user, MotoTRBO_GW.cfg.psw, message, MotoTRBO_GW.cfg.sslState);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in sendMail: "+ex.ToString());
|
|
||||||
//Console.WriteLine(e.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//insert SMS in DB for further processing
|
|
||||||
private bool InsertSMSinDB(string body, string id)
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
MySqlConnection connection = new MySqlConnection(MyConString);
|
|
||||||
MySqlCommand command = connection.CreateCommand();
|
|
||||||
MySqlDataReader Reader;
|
|
||||||
command.CommandText = "insert into SMS_OUT (message,sent,subscriber,time) "+
|
|
||||||
"values ('" + body +
|
|
||||||
"',0"+
|
|
||||||
",'" + gatewayID+id+
|
|
||||||
"','" + DateTime.Now.ToUniversalTime().ToString("yyyy:MM:dd HH:mm:ss") +"')";
|
|
||||||
connection.Open();
|
|
||||||
Reader = command.ExecuteReader();
|
|
||||||
|
|
||||||
connection.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error inserting ARS in database");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 19 KiB |
@ -1,360 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
/*
|
|
||||||
< rsp sid="SID" id="100111" mode="MOD" HW_Type="Hw_type"
|
|
||||||
subscriber="Phone_nr" RFID="RFID" time="TIME"
|
|
||||||
Latitude="" Longitude="" Speed="" ai1="" ai2="" ai3="" ai4=""
|
|
||||||
ai5="" ai6="" ai7="" ai8="" di="" ao1="" ao2="" do=""> </rsp>
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
|
|
||||||
public class ReceiveSMSThread
|
|
||||||
{
|
|
||||||
public static readonly int READ_TIMEOUT = 8640;
|
|
||||||
|
|
||||||
public UInt16 port;
|
|
||||||
//public MotoTRBOGW parent;
|
|
||||||
string gwID;
|
|
||||||
string connStr;
|
|
||||||
DBhandle DB;
|
|
||||||
|
|
||||||
public ReceiveSMSThread(ushort p_port, string p_connStr, string p_gwID)
|
|
||||||
{
|
|
||||||
port = p_port;
|
|
||||||
gwID = p_gwID;
|
|
||||||
connStr = p_connStr;
|
|
||||||
DB = new DBhandle(p_connStr, p_gwID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Main
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
|
|
||||||
while (MotoTRBO_GW.running)
|
|
||||||
{
|
|
||||||
while (MotoTRBO_GW.smsUDPclient != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// update that the Thread is still running
|
|
||||||
MotoTRBO_GW.lastSMSThreadUpdate = DateTime.Now;
|
|
||||||
|
|
||||||
//IPEndPoint object will allow us to read datagrams sent from any source.
|
|
||||||
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "Init SMS Thread on port " + port +" ..waiting for SMS:");
|
|
||||||
// Blocks until a message returns on this socket from a remote host.
|
|
||||||
Byte[] receiveBytes = MotoTRBO_GW.smsUDPclient.Receive(ref RemoteIpEndPoint);
|
|
||||||
string returnData = Encoding.ASCII.GetString(receiveBytes);
|
|
||||||
|
|
||||||
// Uses the IPEndPoint object to determine which of these two hosts responded.
|
|
||||||
// Utils.ConsWrite(DebugMSG_Type.SMS, "\n--------------------");
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "SMS Recv: " + LocationThread.Byte2String(receiveBytes, 0, receiveBytes[1] + 2));
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "From " + RemoteIpEndPoint.Address.ToString() + ":" + RemoteIpEndPoint.Port.ToString());
|
|
||||||
|
|
||||||
header_T hret = DecodePacket(receiveBytes, RemoteIpEndPoint);
|
|
||||||
|
|
||||||
|
|
||||||
//we got ACK for message add it to DB
|
|
||||||
if ((hret.header == 0xBF) || (hret.header == 0x9F))
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "»»» SMS ACK with header " + hret.header + " [" + hret.seq_no + "]");
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
int index = -1;
|
|
||||||
int count = 0;
|
|
||||||
foreach (SMSmsg msg in SN_Queues.waitConfSMSList)
|
|
||||||
{
|
|
||||||
if (msg.seq_no == hret.seq_no)
|
|
||||||
{
|
|
||||||
index = count;
|
|
||||||
SN_Queues.confSMSQueue.PostItem(msg);
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if (index > -1)//we've found the message
|
|
||||||
SN_Queues.waitConfSMSList.RemoveAt(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "»»» SMS [" + hret.message + "] from " + hret.suid);
|
|
||||||
|
|
||||||
// fire event
|
|
||||||
if (OnSMSReceived != null)
|
|
||||||
OnSMSReceived(hret.message, hret.suid);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
if (e.ToString().Contains("A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"))
|
|
||||||
{
|
|
||||||
// read timeout has expired. This is a normal behaviour in my case when the udp socket is supposed to have a timout of 5 seconds
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "##### LocationThread Exception #########\n" + e.ToString());
|
|
||||||
MotoTRBO_GW.smsUDPclient = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set udp client to null if I want to recreate the udp client
|
|
||||||
//udpClient = null;
|
|
||||||
}
|
|
||||||
Thread.Sleep(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OnUDPConnectionChanged != null)
|
|
||||||
OnUDPConnectionChanged(false);
|
|
||||||
|
|
||||||
int c = 0;
|
|
||||||
|
|
||||||
while (MotoTRBO_GW.running && c < 6)
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// here the udpClient should be null so I have to recreate it
|
|
||||||
MotoTRBO_GW.smsUDPclient = new UdpClient(port);
|
|
||||||
MotoTRBO_GW.smsUDPclient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
|
||||||
//udpClient.Client.Bind(new IPEndPoint(IPAddress.Any, port));
|
|
||||||
MotoTRBO_GW.smsUDPclient.Client.ReceiveTimeout = 1000 * READ_TIMEOUT;
|
|
||||||
|
|
||||||
if (OnUDPConnectionChanged != null)
|
|
||||||
OnUDPConnectionChanged(true);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end while
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Aux functions
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct header_T
|
|
||||||
{
|
|
||||||
public string address;
|
|
||||||
public bool ext, ext2, ack, cntl;
|
|
||||||
public byte pdu_type;
|
|
||||||
public byte seq_no;
|
|
||||||
public byte encoding;
|
|
||||||
public byte header;
|
|
||||||
public string message;
|
|
||||||
public string suid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
header_T DecodePacket(Byte[] data, IPEndPoint RemoteIpEndPoint)
|
|
||||||
{
|
|
||||||
header_T hret = new header_T();
|
|
||||||
int i, j, pdata;
|
|
||||||
|
|
||||||
char[] separator = { '.' };
|
|
||||||
string[] su = RemoteIpEndPoint.Address.ToString().Split(separator);
|
|
||||||
uint radioID = (Convert.ToUInt32(su[1])) * 256 * 256 + (Convert.ToUInt32(su[2])) * 256 + Convert.ToUInt32(su[3]);
|
|
||||||
string suid = radioID.ToString();
|
|
||||||
|
|
||||||
|
|
||||||
pdata = (int)data[0];
|
|
||||||
pdata <<= 8;
|
|
||||||
pdata |= (int)data[1];
|
|
||||||
|
|
||||||
/*
|
|
||||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Length =" + pdata + "(0x" + data[0].ToString("X") + "," + data[1].ToString("X") + ")");
|
|
||||||
|
|
||||||
Console.Write("Data: ");
|
|
||||||
for (i = 2; i < pdata + 2; i++)
|
|
||||||
Console.Write(" 0x" + data[i].ToString("X"));
|
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// parse header
|
|
||||||
int header = data[2];
|
|
||||||
hret.header = data[2];
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Header: " + header.ToString("X"));
|
|
||||||
if ((header & 0x80) != 0)
|
|
||||||
hret.ext = true;
|
|
||||||
else hret.ext = false;
|
|
||||||
|
|
||||||
if ((header & 0x40) != 0)
|
|
||||||
{
|
|
||||||
hret.ack = true;
|
|
||||||
}
|
|
||||||
else hret.ack = false;
|
|
||||||
|
|
||||||
if ((header & 0x10) != 0)
|
|
||||||
hret.cntl = true;
|
|
||||||
else hret.cntl = false; // txt message
|
|
||||||
|
|
||||||
hret.pdu_type = (byte)(header & 0x0f);
|
|
||||||
|
|
||||||
// parse address
|
|
||||||
int addrsize = data[3];
|
|
||||||
i = 4;
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.DB, "Address: ");
|
|
||||||
for (j = 0; j < addrsize; j++)
|
|
||||||
{
|
|
||||||
//Console.Write(data[i + j].ToString("X"));
|
|
||||||
}
|
|
||||||
i += j;
|
|
||||||
if (addrsize == 0)
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "no len");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse rest of headers
|
|
||||||
if (hret.ext)
|
|
||||||
{
|
|
||||||
byte h2 = data[i];
|
|
||||||
if ((h2 & 0x80) != 0)
|
|
||||||
hret.ext2 = true;
|
|
||||||
else hret.ext2 = false;
|
|
||||||
|
|
||||||
hret.seq_no = (byte)(h2 & 0x1F);
|
|
||||||
i++;
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Seq no: " + hret.seq_no);
|
|
||||||
|
|
||||||
if (hret.ext2)
|
|
||||||
{ // parse third header
|
|
||||||
hret.encoding = (byte)(data[i] & 0x0f);
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Encoding: " + hret.encoding);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hret.ack)
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
// The client needs an ACK
|
|
||||||
Byte[] sendBytes = new Byte[10];
|
|
||||||
sendBytes[0] = 0x00; // len (2B)
|
|
||||||
sendBytes[1] = 0x03;
|
|
||||||
sendBytes[2] = 0xBF; // first header (req)
|
|
||||||
sendBytes[3] = 0x00; // addr len
|
|
||||||
sendBytes[4] = hret.seq_no; // 2nd header (opt)
|
|
||||||
|
|
||||||
MotoTRBO_GW.smsUDPclient.Send(sendBytes, sendBytes[1] + 2, RemoteIpEndPoint.Address.ToString(), RemoteIpEndPoint.Port);
|
|
||||||
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"SMS ACK sent");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int crc = 0;
|
|
||||||
if ((!hret.cntl) && (hret.pdu_type == 0))
|
|
||||||
{ // the rest is the txt message
|
|
||||||
//Console.Write("SMS Message: ");
|
|
||||||
Char[] cs = new Char[100];
|
|
||||||
int k;
|
|
||||||
for (j = i, k = 0; j < pdata + 2; j++)
|
|
||||||
{
|
|
||||||
//Console.Write(" 0x" + data[j].ToString("X"));
|
|
||||||
if (data[j] != 0)
|
|
||||||
{
|
|
||||||
cs[k++] = (Char)data[j];
|
|
||||||
crc |= (Char)data[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// save message in inbox ht
|
|
||||||
string s = new string(cs, 0, k);
|
|
||||||
s.Replace("\r\n", "");
|
|
||||||
s = s.Replace(System.Environment.NewLine, string.Empty);
|
|
||||||
|
|
||||||
|
|
||||||
// safe message for hret
|
|
||||||
hret.message = s;
|
|
||||||
hret.suid = suid;
|
|
||||||
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Message [" + s + "]");
|
|
||||||
|
|
||||||
if (s.StartsWith("Rfid"))
|
|
||||||
{
|
|
||||||
string rfid_string = new string(cs, 4, s.Length - 4);
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"RFID detected:" + rfid_string);
|
|
||||||
OC4Jrfid rfid = new OC4Jrfid();
|
|
||||||
rfid.suid = suid;
|
|
||||||
rfid.rfid = rfid_string;
|
|
||||||
//MotoTRBOGW.DBQueueRFID.PostItem(rfid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//insert message into database
|
|
||||||
if (!DB.insertSMSinDB("" + suid, s))
|
|
||||||
{
|
|
||||||
SMSmsg sms = new SMSmsg();
|
|
||||||
sms.suid = suid;
|
|
||||||
sms.msg = "Unit not assigned to this SafeNet Gateway";
|
|
||||||
sms.req_conf = false;
|
|
||||||
SN_Queues.sendSMSQueue.PostItem(sms);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGS.LOG(MotoTRBO_GW.cfg.gw_id + suid + " " + s);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string email_addr = "";
|
|
||||||
string email_body = "";
|
|
||||||
if (s.Contains("@") && s.Contains(":") && s.Contains("."))
|
|
||||||
{ // this may be an email so analyze further
|
|
||||||
char[] sep = { ':' };
|
|
||||||
string[] all_msg = s.Split(sep);
|
|
||||||
email_addr = all_msg[0];
|
|
||||||
email_body = all_msg[1];
|
|
||||||
|
|
||||||
if (email_addr.Contains("@") && email_addr.Contains("."))
|
|
||||||
{
|
|
||||||
// this is email
|
|
||||||
|
|
||||||
EmailHandler.sendMail(email_addr, email_body, suid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"i=" + i);
|
|
||||||
|
|
||||||
return hret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void SMSReceivedDEl(String sms, String radioID);
|
|
||||||
public event SMSReceivedDEl OnSMSReceived;
|
|
||||||
|
|
||||||
|
|
||||||
public delegate void UDPConnectionChangedDelegate(bool isConnected);
|
|
||||||
public event UDPConnectionChangedDelegate OnUDPConnectionChanged;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
public partial class DebugCmd : Form
|
|
||||||
{
|
|
||||||
int seqID = 1;
|
|
||||||
|
|
||||||
public DebugCmd()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
textBox1_TextChanged(textBox1, null);
|
|
||||||
textBox1.Focus();
|
|
||||||
|
|
||||||
if (MotoTRBO_GW.isConsoleEnabled)
|
|
||||||
{
|
|
||||||
buttonConsole.Text = "Hide console";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buttonConsole.Text = "Show console";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSendSMS_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonSendSMS.Enabled = false;
|
|
||||||
SendSMSThread smsThread = new SendSMSThread(MotoTRBO_GW.cfg.smsPort);
|
|
||||||
|
|
||||||
SMSmsg msg = new SMSmsg();
|
|
||||||
msg.conf = true;
|
|
||||||
msg.msg = tbMessage.Text;
|
|
||||||
msg.seq_no = seqID++;
|
|
||||||
msg.suid = numericRadioID.Value.ToString();
|
|
||||||
|
|
||||||
smsThread.SendSMSmsg(msg);
|
|
||||||
|
|
||||||
Utils.WriteLine("««« Debug SMS request", ConsoleColor.Cyan);
|
|
||||||
|
|
||||||
Timer p = new Timer();
|
|
||||||
p.Interval = 3000;
|
|
||||||
p.Start();
|
|
||||||
p.Tick += delegate(object sender2, EventArgs e2)
|
|
||||||
{
|
|
||||||
this.Invoke((MethodInvoker)delegate()
|
|
||||||
{
|
|
||||||
buttonSendSMS.Enabled = true;
|
|
||||||
p.Stop();
|
|
||||||
p.Dispose();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonImmediate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonImmediate.Enabled = false;
|
|
||||||
Utils.WriteLine("««« DEbug POLL location request", ConsoleColor.Cyan);
|
|
||||||
LocationThread.SendPollRequest(numericRadioID.Value.ToString(), (byte)seqID++);
|
|
||||||
|
|
||||||
Timer p = new Timer();
|
|
||||||
p.Interval = 3000;
|
|
||||||
p.Start();
|
|
||||||
p.Tick += delegate(object sender2, EventArgs e2)
|
|
||||||
{
|
|
||||||
this.Invoke((MethodInvoker)delegate()
|
|
||||||
{
|
|
||||||
buttonImmediate.Enabled = true;
|
|
||||||
p.Stop();
|
|
||||||
p.Dispose();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
private void buttonTriggered_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonTriggered.Enabled = false;
|
|
||||||
LocationThread.SendTriggeredLocationSTOP(numericRadioID.Value.ToString(), LocationThread.REQ_ID);
|
|
||||||
|
|
||||||
Timer p = new Timer();
|
|
||||||
p.Interval = 1500;
|
|
||||||
p.Start();
|
|
||||||
p.Tick += delegate(object sender2, EventArgs e2)
|
|
||||||
{
|
|
||||||
Utils.WriteLine("««« Debug Triggered location request", ConsoleColor.Cyan);
|
|
||||||
LocationThread.SendTriggeredLocationRequest(numericRadioID.Value.ToString(), (int)numericInterval.Value);
|
|
||||||
|
|
||||||
this.Invoke((MethodInvoker)delegate()
|
|
||||||
{
|
|
||||||
buttonTriggered.Enabled = true;
|
|
||||||
p.Stop();
|
|
||||||
p.Dispose();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonConsole_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (MotoTRBO_GW.isConsoleEnabled)
|
|
||||||
{
|
|
||||||
MotoTRBO_GW.setConsoleWindowVisibility(false, Console.Title);
|
|
||||||
buttonConsole.Text = "Show console";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MotoTRBO_GW.setConsoleWindowVisibility(true, Console.Title);
|
|
||||||
buttonConsole.Text = "Hide console";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (textBox1.Text.Equals("safemobile123") || textBox1.Text.Equals("andrei"))
|
|
||||||
panelCmds.Enabled = true;
|
|
||||||
else
|
|
||||||
panelCmds.Enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,284 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Threading;
|
|
||||||
using HyteraWrapper;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace Hytera_SOC
|
|
||||||
{
|
|
||||||
class SMShandle
|
|
||||||
{
|
|
||||||
private GatewayRadio gw;
|
|
||||||
private Thread thread;
|
|
||||||
//private Thread t_manage_waitSMSack;
|
|
||||||
int sms_seq_id = 1;
|
|
||||||
public bool isAlive = false;
|
|
||||||
private DBhandle DB;
|
|
||||||
|
|
||||||
public SMShandle(GatewayRadio _gw)
|
|
||||||
{
|
|
||||||
gw = _gw;
|
|
||||||
thread = new Thread(new ThreadStart(HandleConnection));
|
|
||||||
thread.IsBackground = true;
|
|
||||||
|
|
||||||
//t_manage_waitSMSack = new Thread(new ThreadStart(HandleSMSacks));
|
|
||||||
//t_manage_waitSMSack.IsBackground = true;
|
|
||||||
if (gw != null)
|
|
||||||
{
|
|
||||||
DB = new DBhandle(Hytera_GW.MyConString, Hytera_GW.cfg.gatewayID);
|
|
||||||
isAlive = true;
|
|
||||||
thread.Start();
|
|
||||||
//t_manage_waitSMSack.Start();
|
|
||||||
|
|
||||||
gw.OnTM_CS += new GatewayRadio.OnTM_CS_del(gw_OnTM_CS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
isAlive = false;
|
|
||||||
if (thread != null)
|
|
||||||
{
|
|
||||||
thread.Abort();
|
|
||||||
thread = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
while (isAlive)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//MotoTRBOcmdMsg msg = MotoTRBOGW.locationQueue.GetItem(100);
|
|
||||||
SMSmsg msg = SN_Queues.sendSMSQueue.GetItem(-1);//block until message is in queue
|
|
||||||
bool ret = SendSMSmsg(msg);
|
|
||||||
if (msg.req_conf)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Requesting SMS Confirmation!!!!");
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
msg.seq_no = this.sms_seq_id - 1;//-1 because was alraedy incremented for next id
|
|
||||||
msg.waitConfSMSList_time = DateTime.Now;
|
|
||||||
|
|
||||||
SN_Queues.waitConfSMSList.Add(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.Sleep(1200);//minimum interval between SMS as per MotoTRBO specs
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in SMShandle:HandleConnection(): \r\n\tData=" +
|
|
||||||
ex.Data + "\r\n\tSource=" +
|
|
||||||
ex.Source + "\r\n\tStackTrace=" +
|
|
||||||
ex.StackTrace + "\r\n\tMessage=" +
|
|
||||||
ex.Message + "\r\n\tInnerException=" +
|
|
||||||
ex.InnerException);
|
|
||||||
}
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
//if SMS acks are stuck in here delete them and let them be send again
|
|
||||||
public void HandleSMSacks()
|
|
||||||
{
|
|
||||||
while (isAlive)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Managing SMS's ACKs!!!!");
|
|
||||||
LOGS.LOG("Managing SMS's ACKs!!!!");
|
|
||||||
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
ArrayList delID_list = new ArrayList();
|
|
||||||
int count = 0;
|
|
||||||
foreach (SMSmsg msgTmp in SN_Queues.waitConfSMSList)
|
|
||||||
{
|
|
||||||
if (msgTmp.waitConfSMSList_time.AddMinutes(5) < DateTime.Now)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Found SMS waiting in ACK queue from:" + msgTmp.waitConfSMSList_time + " Current time:" + DateTime.Now);
|
|
||||||
LOGS.LOG("Found SMS waiting in ACK queue from:" + msgTmp.waitConfSMSList_time + " Current time:" + DateTime.Now);
|
|
||||||
delID_list.Add(count);
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (int i in delID_list)
|
|
||||||
{
|
|
||||||
SN_Queues.waitConfSMSList.RemoveAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in SMShandle:HandleSMSacks(): \r\n\tData=" +
|
|
||||||
ex.Data + "\r\n\tSource=" +
|
|
||||||
ex.Source + "\r\n\tStackTrace=" +
|
|
||||||
ex.StackTrace + "\r\n\tMessage=" +
|
|
||||||
ex.Message + "\r\n\tInnerException=" +
|
|
||||||
ex.InnerException);
|
|
||||||
}
|
|
||||||
} // end while (true
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SendSMSmsg(SMSmsg p_msg)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
uint u_suid = Convert.ToUInt32(p_msg.suid);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "MSG sent to:" + p_msg.suid);
|
|
||||||
bool ret = gw.SendSMS(u_suid, p_msg.msg);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, exc.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gw_OnTM_CS(StringBuilder value)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
if (value.Length == 0)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Empty message... Droping it!!!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string temp = value.ToString();
|
|
||||||
string[] split_temp = temp.Split('#');
|
|
||||||
if (split_temp.Length == 0)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Empty message... Droping it!!!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((split_temp[0] != "ACK") && (split_temp[0] != "ACKG"))
|
|
||||||
{
|
|
||||||
//received message... send it to messagebus
|
|
||||||
string rawMessage = value.ToString();
|
|
||||||
string message = rawMessage;
|
|
||||||
if (rawMessage.Contains("'"))
|
|
||||||
{
|
|
||||||
message = rawMessage.Replace("'", "`");
|
|
||||||
}
|
|
||||||
//bigu code remove # from text
|
|
||||||
Int32 x1 = message.IndexOf("#132#");
|
|
||||||
Int32 x2 = message.IndexOf("#hyt#");
|
|
||||||
Int32 x3 = message.IndexOf('#', x1 + 5, x2 - (x1 + 5) - 1);
|
|
||||||
Boolean finish = false;
|
|
||||||
while (!finish)
|
|
||||||
{
|
|
||||||
Int32 x4 = message.IndexOf('#', x3 + 1, x2 - (x3 + 1) - 1);
|
|
||||||
if (x4 == -1) finish = true;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message = message.Remove(x4, 1);
|
|
||||||
message = message.Insert(x4, " ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//end of bigu code
|
|
||||||
|
|
||||||
//byte[] buf = System.Text.Encoding.ASCII.GetBytes(message);
|
|
||||||
//send to messagebus
|
|
||||||
//udpMulticast.Send(buf, buf.Length);
|
|
||||||
//SM.Debug("TX:" + value.ToString());
|
|
||||||
string[] msg_arr = message.Split('#');
|
|
||||||
|
|
||||||
string s = msg_arr[5];
|
|
||||||
//insert message into database
|
|
||||||
if (!DB.insertSMSinDB("" + msg_arr[4], msg_arr[5]))
|
|
||||||
{
|
|
||||||
SMSmsg sms = new SMSmsg();
|
|
||||||
sms.suid = msg_arr[4];
|
|
||||||
sms.msg = "ERROR sending message to server!";
|
|
||||||
sms.req_conf = false;
|
|
||||||
SN_Queues.sendSMSQueue.PostItem(sms);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOGS.LOG(Hytera_GW.cfg.gatewayID + msg_arr[4] + " " + msg_arr[5]);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string email_addr = "";
|
|
||||||
string email_body = "";
|
|
||||||
if (s.Contains("@") && s.Contains(":") && s.Contains("."))
|
|
||||||
{ // this may be an email so analyze further
|
|
||||||
char[] sep = { ':' };
|
|
||||||
string[] all_msg = s.Split(sep);
|
|
||||||
email_addr = all_msg[0];
|
|
||||||
email_body = all_msg[1];
|
|
||||||
|
|
||||||
if (email_addr.Contains("@") && email_addr.Contains("."))
|
|
||||||
{
|
|
||||||
// this is email
|
|
||||||
|
|
||||||
EmailHandler.sendMail(email_addr, email_body, msg_arr[4]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (split_temp[0] == "ACK")
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//received ACK
|
|
||||||
int destID = int.Parse(split_temp[1]);
|
|
||||||
int result = int.Parse(split_temp[2]);
|
|
||||||
if (result == 0)
|
|
||||||
{
|
|
||||||
//send ACK on message bus
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Got SMS ACK for suid :" + destID);
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
int index = -1;
|
|
||||||
int count = 0;
|
|
||||||
SMSmsg temp_SMS = null;
|
|
||||||
foreach (SMSmsg msg in SN_Queues.waitConfSMSList)
|
|
||||||
{
|
|
||||||
if (msg.suid == destID.ToString())
|
|
||||||
{
|
|
||||||
index = count;
|
|
||||||
temp_SMS = msg;
|
|
||||||
//SN_Queues.confSMSQueue.PostItem(msg);
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if (temp_SMS != null)
|
|
||||||
{
|
|
||||||
SN_Queues.confSMSQueue.PostItem(temp_SMS);
|
|
||||||
}
|
|
||||||
if (index > -1)//we've found the message
|
|
||||||
SN_Queues.waitConfSMSList.RemoveAt(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "ERROR parsing SMS ACK");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "ERROR in gw_OnTM_CS");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("MotoRepeater_SOC")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("MotoRepeater_SOC")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("fb68f416-d541-4a3c-972f-cc577291edc7")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,119 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{001808E2-10FA-43F1-B317-0FC2F595C1BC}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>PAL_SOC</RootNamespace>
|
|
||||||
<AssemblyName>PAL_SOC</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>
|
|
||||||
</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<PublishUrl>publish\</PublishUrl>
|
|
||||||
<Install>true</Install>
|
|
||||||
<InstallFrom>Disk</InstallFrom>
|
|
||||||
<UpdateEnabled>false</UpdateEnabled>
|
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
|
||||||
<UpdateInterval>7</UpdateInterval>
|
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
|
||||||
<UpdateRequired>false</UpdateRequired>
|
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Nini">
|
|
||||||
<HintPath>..\lib\Nini.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Config.cs" />
|
|
||||||
<Compile Include="ConnectionThread.cs" />
|
|
||||||
<Compile Include="DBconnThreads.cs" />
|
|
||||||
<Compile Include="LocationThread.cs" />
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="app.config" />
|
|
||||||
<None Include="config.ini">
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SafeNetLib\SafeNetLib.csproj">
|
|
||||||
<Project>{5AFA65B8-32DA-4924-BD06-7C8802F02BE4}</Project>
|
|
||||||
<Name>SafeNetLib</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Windows Installer 3.1</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
<SvnVersion LocalPath="$(MSBuildProjectDirectory)" ToolPath="$(ProgramFiles)\SlikSVN\bin">
|
|
||||||
<Output TaskParameter="Revision" PropertyName="Revision" />
|
|
||||||
</SvnVersion>
|
|
||||||
<FileUpdate Files="Properties\AssemblyInfo.cs" Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)" ReplacementText="$1.$2.$3.$(Revision)" />
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace ConsoleApplication1
|
|
||||||
{
|
|
||||||
static public class Encryption
|
|
||||||
{
|
|
||||||
static byte[] bytes = ASCIIEncoding.ASCII.GetBytes("SafeMobi"); //DES 64bit !
|
|
||||||
|
|
||||||
static public byte[] Encrypt(byte[] inputArray)
|
|
||||||
{
|
|
||||||
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
|
|
||||||
MemoryStream memoryStream = new MemoryStream();
|
|
||||||
CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoProvider.CreateEncryptor(bytes, bytes), CryptoStreamMode.Write);
|
|
||||||
|
|
||||||
cryptoStream.Write(inputArray, 0, inputArray.Length);
|
|
||||||
|
|
||||||
cryptoStream.Close(); memoryStream.Close();
|
|
||||||
return memoryStream.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
static public byte[] Decrypt(byte[] DataToDecrypt)
|
|
||||||
{
|
|
||||||
DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
|
|
||||||
MemoryStream memoryStream = new MemoryStream();
|
|
||||||
CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoProvider.CreateDecryptor(bytes, bytes), CryptoStreamMode.Write);
|
|
||||||
|
|
||||||
cryptoStream.Write(DataToDecrypt, 0, DataToDecrypt.Length);
|
|
||||||
cryptoStream.Close(); memoryStream.Close();
|
|
||||||
return memoryStream.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 3.4 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<configuration>
|
|
||||||
|
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup><system.data>
|
|
||||||
<DbProviderFactories>
|
|
||||||
<remove invariant="MySql.Data.MySqlClient"/>
|
|
||||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
|
|
||||||
</DbProviderFactories>
|
|
||||||
</system.data></configuration>
|
|
Before Width: | Height: | Size: 166 KiB |
@ -1,211 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
|
|
||||||
namespace Teltonika_SOC
|
|
||||||
{
|
|
||||||
class DBconnThread
|
|
||||||
{
|
|
||||||
private static string MyConString;
|
|
||||||
private string gatewayID;
|
|
||||||
|
|
||||||
private DBhandle DB;
|
|
||||||
|
|
||||||
public DBconnThread(string p_dbConStr, string p_gatewayID)
|
|
||||||
{
|
|
||||||
MyConString = p_dbConStr;
|
|
||||||
gatewayID = p_gatewayID;
|
|
||||||
|
|
||||||
DB = new DBhandle(MyConString, gatewayID);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StartDB()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DB.StartDB();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StopDB()
|
|
||||||
{
|
|
||||||
DB.StopDB();
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
//for GPS DB thread
|
|
||||||
public void HandleConnectionGPS()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "GPS DB thread...");
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
while (!DB.DBconnected)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Reconneting to DB!!!");
|
|
||||||
StartDB();
|
|
||||||
Thread.Sleep(3000);
|
|
||||||
}
|
|
||||||
htCell_t cell = SN_Queues.DBQueueLocation.GetItem(100);
|
|
||||||
|
|
||||||
if (cell != null)
|
|
||||||
{
|
|
||||||
DateTime before = DateTime.Now;
|
|
||||||
bool ret = DB.Insert_messages(cell);
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
SN_Queues.initAddressQueue.PostItem(cell);
|
|
||||||
|
|
||||||
DateTime after = DateTime.Now;
|
|
||||||
TimeSpan diff = after.Subtract(before);
|
|
||||||
count++;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "GPS SUID: " + cell.suid + " LAT<" + cell.lat + " > LNG<" + cell.lng + ">");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : GPS SUID: " + cell.suid + " LAT<" + cell.lat + " > LNG<" + cell.lng + ">");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Added count:" + count + " in queue:" + SN_Queues.DBQueueLocation.Count + " Time for insert(msecs):" + diff.Ticks / TimeSpan.TicksPerMillisecond + "." + diff.Ticks % TimeSpan.TicksPerMillisecond);
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : Added count:" + count + " in queue:" + SN_Queues.DBQueueLocation.Count + " Time for insert(msecs):" + diff.Ticks / TimeSpan.TicksPerMillisecond + "." + diff.Ticks % TimeSpan.TicksPerMillisecond);
|
|
||||||
Console.WriteLine("-----------------------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
DB.DBconnected = false;
|
|
||||||
}
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
//for Aux DB thread (units, gateway status)
|
|
||||||
int countUnit = 30 * 61;
|
|
||||||
public void HandleConnectionAux()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Aux DB thread ...");
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
if (count % 60 == 0)
|
|
||||||
{
|
|
||||||
Int64 upTime = Utils.DateTo70Format(DateTime.Now) - Utils.DateTo70Format(Program.startTime);
|
|
||||||
Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
||||||
GWstatus gws = new GWstatus();
|
|
||||||
gws.gw_id = Program.cfg.gatewayID;
|
|
||||||
gws.status = 1;
|
|
||||||
gws.message = String.Format("Teltonika GW: Uptime:{0};Version:{1};Connections:{2}", upTime, v.ToString(), ConnectionThread.connections);
|
|
||||||
SN_Queues.gwstatusQueue.PostItem(gws);
|
|
||||||
|
|
||||||
}
|
|
||||||
while (!DB.DBconnected)
|
|
||||||
{
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
if (countUnit > 5 * 60)//every 5 minutes
|
|
||||||
{
|
|
||||||
Program.unitsLoaded = DB.LoadUnitInfo(gatewayID);
|
|
||||||
countUnit = 0;
|
|
||||||
if (Program.setupMode && !Program.loadUnitsFromFile)
|
|
||||||
{
|
|
||||||
DB.LoadImeiHashtable(gatewayID, ref Program.ImeiHT);
|
|
||||||
Utils.WriteLine("Setup mode: Done loading " + Program.ImeiHT.Count + " units from DB!", ConsoleColor.Cyan, Program.isUnix);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
GWstatus gw_msg = SN_Queues.gwstatusQueue.GetItem(10);
|
|
||||||
while (gw_msg != null)
|
|
||||||
{
|
|
||||||
DB.Insert_GW_status(gw_msg.gw_id, gw_msg.status, gw_msg.message);
|
|
||||||
gw_msg = SN_Queues.gwstatusQueue.GetItem(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
countUnit++;
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
|
|
||||||
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
//for inserting address Thread
|
|
||||||
public void HandleConnectionAddr()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Address DB thread ...");
|
|
||||||
|
|
||||||
//get address list
|
|
||||||
while (!DB.DBconnected)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Address DB thread waiting for DB connection!!");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : Address DB thread waiting for DB connection!!");
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Program.addressLoaded = DB.LoadAddressList(gatewayID);
|
|
||||||
|
|
||||||
while (!Program.addressLoaded)
|
|
||||||
{
|
|
||||||
Program.addressLoaded = DB.LoadAddressList(gatewayID);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "Address DB thread waiting for address list!!");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : Address DB thread waiting for address list!!");
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, " SN_Queues.ht_addressList.Count" + SN_Queues.ht_addressList.Count);
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : SN_Queues.ht_addressList.Count" + SN_Queues.ht_addressList.Count);
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
while (!Program.addressLoaded)
|
|
||||||
Thread.Sleep(100);
|
|
||||||
//add addr to tb if needed
|
|
||||||
|
|
||||||
htCell_t cell = SN_Queues.initAddressQueue.GetItem(100);
|
|
||||||
if (cell != null)
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.DB, "Address thread item fetched from queue...");
|
|
||||||
string addr_hash = Utils.Compute4digitALG(cell.d_lat, cell.d_lng);
|
|
||||||
Address addr = new Address(cell);
|
|
||||||
|
|
||||||
lock (SN_Queues.ht_addressList.SyncRoot)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!SN_Queues.ht_addressList.ContainsKey(addr_hash))
|
|
||||||
{
|
|
||||||
//insert value in DB
|
|
||||||
DB.Insert_AddressList(cell);
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "addr_hash:" + addr_hash + " addr.addr_hash:" + addr.addr_hash + " SN_Queues.ht_addressList.Count" + SN_Queues.ht_addressList.Count);
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : addr_hash:" + addr_hash + " addr.addr_hash:" + addr.addr_hash + " SN_Queues.ht_addressList.Count" + SN_Queues.ht_addressList.Count);
|
|
||||||
//add to comp addr queue
|
|
||||||
/*
|
|
||||||
if (SN_Queues.computeAddressQueue.Count < 100)
|
|
||||||
{
|
|
||||||
SN_Queues.computeAddressQueue.PostItem(addr);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//add in our own ht
|
|
||||||
SN_Queues.ht_addressList.Add(addr.addr_hash, addr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//no need to add to DB .. addr already in
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,259 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
using SN_Server.ServerMSGS;
|
|
||||||
using SN_Server;
|
|
||||||
|
|
||||||
/*
|
|
||||||
< rsp sid="SID" id="100111" mode="MOD" HW_Type="Hw_type"
|
|
||||||
subscriber="Phone_nr" RFID="RFID" time="TIME"
|
|
||||||
Latitude="" Longitude="" Speed="" ai1="" ai2="" ai3="" ai4=""
|
|
||||||
ai5="" ai6="" ai7="" ai8="" di="" ao1="" ao2="" do=""> </rsp>
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace MotoRepeater_SOC
|
|
||||||
{
|
|
||||||
|
|
||||||
class ReceiveSMSThread
|
|
||||||
{
|
|
||||||
public UInt16 port;
|
|
||||||
//public MotoTRBOGW parent;
|
|
||||||
|
|
||||||
public ReceiveSMSThread(ushort p_port)
|
|
||||||
{
|
|
||||||
port = p_port;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Main
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//IPEndPoint object will allow us to read datagrams sent from any source.
|
|
||||||
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Init SMS Thread on port " + port +" ..waiting for SMS:");
|
|
||||||
// Blocks until a message returns on this socket from a remote host.
|
|
||||||
Byte[] receiveBytes = MotoRepeater_GW.smsUDPclient.Receive(ref RemoteIpEndPoint);
|
|
||||||
string returnData = Encoding.ASCII.GetString(receiveBytes);
|
|
||||||
|
|
||||||
// Uses the IPEndPoint object to determine which of these two hosts responded.
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "\n--------------------");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "SMSThRecv(" + port + "): " + LocationThread.Byte2String(receiveBytes, 0, receiveBytes[1] + 2));
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "From " + RemoteIpEndPoint.Address.ToString() +
|
|
||||||
":" + RemoteIpEndPoint.Port.ToString());
|
|
||||||
|
|
||||||
header_T hret = DecodePacket(receiveBytes, RemoteIpEndPoint);
|
|
||||||
|
|
||||||
|
|
||||||
//we got ACK for message add it to DB
|
|
||||||
if ((hret.header == 0xBF) || (hret.header == 0x9F))
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Got ACK with header:" + hret.header + " with seq_id :" + hret.seq_no);
|
|
||||||
lock (SM_SMS.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
int index = -1;
|
|
||||||
int count = 0;
|
|
||||||
foreach (SMS msg in SM_SMS.waitConfSMSList)
|
|
||||||
{
|
|
||||||
if (msg.seq_no == hret.seq_no)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Posting in confSMSQueue:");
|
|
||||||
index = count;
|
|
||||||
SM_SMS.confSMSQueue.PostItem(msg);
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if (index > -1)//we've found the message
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Removing from waitConfSMSList");
|
|
||||||
SM_SMS.waitConfSMSList.RemoveAt(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in SMSThread:HandleConnection()" +ex.ToString());
|
|
||||||
}
|
|
||||||
Thread.Sleep(1);
|
|
||||||
} // end while
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Aux functions
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct header_T
|
|
||||||
{
|
|
||||||
public string address;
|
|
||||||
public bool ext, ext2, ack, cntl;
|
|
||||||
public byte pdu_type;
|
|
||||||
public byte seq_no;
|
|
||||||
public byte encoding;
|
|
||||||
public byte header;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
header_T DecodePacket(Byte[] data, IPEndPoint RemoteIpEndPoint)
|
|
||||||
{
|
|
||||||
header_T hret = new header_T();
|
|
||||||
int i, j, pdata;
|
|
||||||
|
|
||||||
char[] separator = { '.' };
|
|
||||||
string[] su = RemoteIpEndPoint.Address.ToString().Split(separator);
|
|
||||||
uint radioID = (Convert.ToUInt32(su[1])) * 256 * 256 + (Convert.ToUInt32(su[2])) * 256 + Convert.ToUInt32(su[3]);
|
|
||||||
string suid = radioID.ToString();
|
|
||||||
|
|
||||||
|
|
||||||
pdata = (int)data[0];
|
|
||||||
pdata <<= 8;
|
|
||||||
pdata |= (int)data[1];
|
|
||||||
/*
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,"Length =" + pdata + "(0x" + data[0].ToString("X") + "," + data[1].ToString("X") + ")");
|
|
||||||
|
|
||||||
Console.Write("Data: ");
|
|
||||||
for (i = 2; i < pdata + 2; i++)
|
|
||||||
Console.Write(" 0x" + data[i].ToString("X"));
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// parse header
|
|
||||||
int header = data[2];
|
|
||||||
hret.header = data[2];
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Header: " + header.ToString("X"));
|
|
||||||
if ((header & 0x80) != 0)
|
|
||||||
hret.ext = true;
|
|
||||||
else hret.ext = false;
|
|
||||||
|
|
||||||
if ((header & 0x40) != 0)
|
|
||||||
{
|
|
||||||
hret.ack = true;
|
|
||||||
}
|
|
||||||
else hret.ack = false;
|
|
||||||
|
|
||||||
if ((header & 0x10) != 0)
|
|
||||||
hret.cntl = true;
|
|
||||||
else hret.cntl = false; // txt message
|
|
||||||
|
|
||||||
hret.pdu_type = (byte)(header & 0x0f);
|
|
||||||
|
|
||||||
// parse address
|
|
||||||
int addrsize = data[3];
|
|
||||||
i = 4;
|
|
||||||
Console.Write("Address: ");
|
|
||||||
for (j = 0; j < addrsize; j++)
|
|
||||||
{
|
|
||||||
Console.Write(data[i + j].ToString("X"));
|
|
||||||
}
|
|
||||||
i += j;
|
|
||||||
if (addrsize == 0)
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,"no len");
|
|
||||||
else Utils.ConsWrite(DebugMSG_Type.SMS,"");
|
|
||||||
|
|
||||||
|
|
||||||
// parse rest of headers
|
|
||||||
if (hret.ext)
|
|
||||||
{
|
|
||||||
byte h2 = data[i];
|
|
||||||
if ((h2 & 0x80) != 0)
|
|
||||||
hret.ext2 = true;
|
|
||||||
else hret.ext2 = false;
|
|
||||||
|
|
||||||
hret.seq_no = (byte)(h2 & 0x1F);
|
|
||||||
i++;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,"Seq no: " + hret.seq_no);
|
|
||||||
|
|
||||||
if (hret.ext2)
|
|
||||||
{ // parse third header
|
|
||||||
hret.encoding = (byte)(data[i] & 0x0f);
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"Encoding: " + hret.encoding);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hret.ack)
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
// The client needs an ACK
|
|
||||||
Byte[] sendBytes = new Byte[10];
|
|
||||||
sendBytes[0] = 0x00; // len (2B)
|
|
||||||
sendBytes[1] = 0x03;
|
|
||||||
sendBytes[2] = 0xBF; // first header (req)
|
|
||||||
sendBytes[3] = 0x00; // addr len
|
|
||||||
sendBytes[4] = hret.seq_no; // 2nd header (opt)
|
|
||||||
|
|
||||||
MotoRepeater_GW.smsUDPclient.Send(sendBytes, sendBytes[1] + 2, RemoteIpEndPoint.Address.ToString(), RemoteIpEndPoint.Port);
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,"SMS ACK sent");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int crc = 0;
|
|
||||||
if ((!hret.cntl) && (hret.pdu_type == 0))
|
|
||||||
{ // the rest is the txt message
|
|
||||||
//Console.Write("SMS Message: ");
|
|
||||||
Char[] cs = new Char[100];
|
|
||||||
int k;
|
|
||||||
for (j = i, k = 0; j < pdata + 2; j++)
|
|
||||||
{
|
|
||||||
//Console.Write(" 0x" + data[j].ToString("X"));
|
|
||||||
if (data[j] != 0)
|
|
||||||
{
|
|
||||||
cs[k++] = (Char)data[j];
|
|
||||||
crc |= (Char)data[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// save message in inbox ht
|
|
||||||
string s = new string(cs, 0, k);
|
|
||||||
s.Replace("\r\n", "");
|
|
||||||
s = s.Replace(System.Environment.NewLine, string.Empty);
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,"Message [" + s + "]");
|
|
||||||
|
|
||||||
if (s.StartsWith("Rfid"))
|
|
||||||
{
|
|
||||||
string rfid_string = new string(cs, 4, s.Length - 4);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS,"RFID detected:" + rfid_string);
|
|
||||||
OC4Jrfid rfid = new OC4Jrfid();
|
|
||||||
rfid.suid = suid;
|
|
||||||
rfid.rfid = rfid_string;
|
|
||||||
//MotoTRBOGW.DBQueueRFID.PostItem(rfid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//insert message into queue
|
|
||||||
SMS sms = new SMS();
|
|
||||||
sms.RadioID = suid;
|
|
||||||
sms.SUDBid = MotoRepeater_GW.unitList.GetDBid(suid);
|
|
||||||
sms.Msg = s;
|
|
||||||
|
|
||||||
SM_SMS.recvSMSQueue.PostItem(sms);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS,"i=" + i);
|
|
||||||
|
|
||||||
|
|
||||||
return hret;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 68 KiB |
@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Simulator_CS_GTW
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new Form1());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,6 +0,0 @@
|
|||||||
[UDP]
|
|
||||||
IP = 127.0.0.1
|
|
||||||
PORT = 9358
|
|
||||||
|
|
||||||
[TCP]
|
|
||||||
PORT = 4005
|
|
@ -1,155 +0,0 @@
|
|||||||
|
|
||||||
UPDATE 12/27/04 security fix in -e option for Windows
|
|
||||||
|
|
||||||
Netcat 1.11 for NT - nc111nt.zip
|
|
||||||
|
|
||||||
The original version of Netcat was written by *hobbit* <hobbit@avian.org>
|
|
||||||
The NT version was done by Weld Pond <weld@vulnwatch.org>
|
|
||||||
|
|
||||||
Netcat for NT is the tcp/ip "Swiss Army knife" that never made it into any
|
|
||||||
of the resource kits. It has proved to be an extremely versatile tool on
|
|
||||||
the unix platform. So why should NT always be unix's poor cousin when it
|
|
||||||
comes to tcp/ip testing and exploration? I bet many NT admins out there
|
|
||||||
keep a unix box around to use tools such as Netcat or to test their systems
|
|
||||||
with the unix version of an NT vulnerability exploit. With Netcat for NT
|
|
||||||
part of that feeling disempowerment is over.
|
|
||||||
|
|
||||||
Included with this release is Hobbit's original description of the powers
|
|
||||||
of Netcat. In this document I will briefly describe some of the things an
|
|
||||||
NT admin might want to do and know about with Netcat on NT. For more
|
|
||||||
detailed technical information please read hobbit.txt included in the
|
|
||||||
nc11nt.zip archive.
|
|
||||||
|
|
||||||
Basic Features
|
|
||||||
|
|
||||||
* Outbound or inbound connections, TCP or UDP, to or from any ports
|
|
||||||
* Full DNS forward/reverse checking, with appropriate warnings
|
|
||||||
* Ability to use any local source port
|
|
||||||
* Ability to use any locally-configured network source address
|
|
||||||
* Built-in port-scanning capabilities, with randomizer
|
|
||||||
* Can read command line arguments from standard input
|
|
||||||
* Slow-send mode, one line every N seconds
|
|
||||||
* Hex dump of transmitted and received data
|
|
||||||
* Ability to let another program service established
|
|
||||||
connections
|
|
||||||
* Telnet-options responder
|
|
||||||
|
|
||||||
New for NT
|
|
||||||
|
|
||||||
* Ability to run in the background without a console window
|
|
||||||
* Ability to restart as a single-threaded server to handle a new
|
|
||||||
connection
|
|
||||||
|
|
||||||
|
|
||||||
A simple example of using Netcat is to pull down a web page from a web
|
|
||||||
server. With Netcat you get to see the full HTTP header so you can see
|
|
||||||
which web server a particular site is running.
|
|
||||||
|
|
||||||
Since NT has a rather anemic command processor, some of the things that are
|
|
||||||
easy in unix may be a bit more clunky in NT. For the web page example first
|
|
||||||
create a file get.txt that contains the following line and then a blank
|
|
||||||
line:
|
|
||||||
|
|
||||||
GET / HTTP/1.0
|
|
||||||
|
|
||||||
To use Netcat to retrieve the home page of a web site use the command:
|
|
||||||
nc -v www.website.com 80 < get.txt
|
|
||||||
|
|
||||||
You will see Netcat make a connection to port 80, send the text contained
|
|
||||||
in the file get.txt, and then output the web server's response to stdout.
|
|
||||||
The -v is for verbose. It tells you a little info about the connection
|
|
||||||
when it starts.
|
|
||||||
|
|
||||||
It is a bit easier to just open the connection and then type at the console
|
|
||||||
to do the same thing.
|
|
||||||
nc -v www.website.com 80
|
|
||||||
|
|
||||||
Then just type in GET / HTTP/1.0 and hit a couple of returns. You will
|
|
||||||
see the same thing as above.
|
|
||||||
|
|
||||||
A far more exciting thing to do is to get a quick shell going on a remote
|
|
||||||
machine by using the -l or "listen" option and the -e or "execute"
|
|
||||||
option. You run Netcat listening on particular port for a connection.
|
|
||||||
When a connection is made, Netcat executes the program of your choice
|
|
||||||
and connects the stdin and stdout of the program to the network connection.
|
|
||||||
|
|
||||||
nc -l -p 23 -t -e cmd.exe
|
|
||||||
|
|
||||||
will get Netcat listening on port 23 (telnet). When it gets connected to
|
|
||||||
by a client it will spawn a shell (cmd.exe). The -t option tells Netcat
|
|
||||||
to handle any telnet negotiation the client might expect.
|
|
||||||
|
|
||||||
This will allow you to telnet to the machine you have Netcat listening on
|
|
||||||
and get a cmd.exe shell when you connect. You could just as well use
|
|
||||||
Netcat instead of telnet:
|
|
||||||
|
|
||||||
nc xxx.xxx.xxx.xxx 23
|
|
||||||
|
|
||||||
will get the job done. There is no authentication on the listening side
|
|
||||||
so be a bit careful here. The shell is running with the permissions of the
|
|
||||||
process that started Netcat so be very careful. If you were to use the
|
|
||||||
AT program to schedule Netcat to run listening on a port with the
|
|
||||||
-e cmd.exe option, when you connected you would get a shell with user
|
|
||||||
NT AUTHORITY\SYSTEM.
|
|
||||||
|
|
||||||
The beauty of Netcat really shines when you realize that you can get it
|
|
||||||
listening on ANY port doing the same thing. Do a little exploring and
|
|
||||||
see if the firewall you may be behind lets port 53 through. Run Netcat
|
|
||||||
listening behind the firewall on port 53.
|
|
||||||
|
|
||||||
nc -L -p 53 -e cmd.exe
|
|
||||||
|
|
||||||
Then from outside the firewall connect to the listening machine:
|
|
||||||
|
|
||||||
nc -v xxx.xxx.xxx.xx 53
|
|
||||||
|
|
||||||
If you get a command prompt then you are executing commands on the
|
|
||||||
listening machine. Use 'exit' at the command prompt for a clean
|
|
||||||
disconnect. The -L (note the capital L) option will restart Netcat with
|
|
||||||
the same command line when the connection is terminated. This way you can
|
|
||||||
connect over and over to the same Netcat process.
|
|
||||||
|
|
||||||
A new feature for the NT version is the -d or detach from console flag.
|
|
||||||
This will let Netcat run without an ugly console window cluttering up the
|
|
||||||
screen or showing up in the task list.
|
|
||||||
|
|
||||||
You can even get Netcat to listen on the NETBIOS ports that are probably
|
|
||||||
running on most NT machines. This way you can get a connection to a
|
|
||||||
machine that may have port filtering enabled in the TCP/IP Security Network
|
|
||||||
control panel. Unlike Unix, NT does not seem to have any security around
|
|
||||||
which ports that user programs are allowed to bind to. This means any
|
|
||||||
user can run a program that will bind to the NETBIOS ports.
|
|
||||||
|
|
||||||
You will need to bind "in front of" some services that may already be
|
|
||||||
listening on those ports. An example is the NETBIOS Session Service that
|
|
||||||
is running on port 139 of NT machines that are sharing files. You need
|
|
||||||
to bind to a specific source address (one of the IP addresses of the
|
|
||||||
machine) to accomplish this. This gives Netcat priority over the NETBIOS
|
|
||||||
service which is at a lower priority because it is bound to ANY IP address.
|
|
||||||
This is done with the Netcat -s option:
|
|
||||||
|
|
||||||
nc -v -L -e cmd.exe -p 139 -s xxx.xxx.xxx.xxx
|
|
||||||
|
|
||||||
Now you can connect to the machine on port 139 and Netcat will field
|
|
||||||
the connection before NETBIOS does. You have effectively shut off
|
|
||||||
file sharing on this machine by the way. You have done this with just
|
|
||||||
user privileges to boot.
|
|
||||||
|
|
||||||
PROBLEMS with Netcat 1.1 for NT
|
|
||||||
|
|
||||||
There are a few known problems that will eventually be fixed. One is
|
|
||||||
the -w or timeout option. This works for final net reads but not
|
|
||||||
for connections. Another problem is using the -e option in UDP mode.
|
|
||||||
You may find that some of the features work on Windows 95. Most
|
|
||||||
of the listening features will not work on Windows 95 however. These will
|
|
||||||
be fixed in a later release.
|
|
||||||
|
|
||||||
Netcat is distributed with full source code so that people can build
|
|
||||||
upon this work. If you add something useful or discover something
|
|
||||||
interesting about NT TCP/IP let met know.
|
|
||||||
|
|
||||||
Weld Pond <weld@l0pht.com>, 2/2/98
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
namespace Landmarks_Import
|
|
||||||
{
|
|
||||||
internal class Program
|
|
||||||
{
|
|
||||||
private static void Main(string[] args)
|
|
||||||
{
|
|
||||||
MainClass mc = new MainClass();
|
|
||||||
mc.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace SN_Server
|
|
||||||
{
|
|
||||||
public class SMS
|
|
||||||
{
|
|
||||||
private int dbid;
|
|
||||||
public int DBid
|
|
||||||
{
|
|
||||||
get { return dbid; }
|
|
||||||
set { dbid = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private int suDBid;
|
|
||||||
public int SUDBid
|
|
||||||
{
|
|
||||||
get { return suDBid; }
|
|
||||||
set { suDBid = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string radioID;
|
|
||||||
public string RadioID
|
|
||||||
{
|
|
||||||
get { return radioID; }
|
|
||||||
set { radioID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string msg;
|
|
||||||
public string Msg
|
|
||||||
{
|
|
||||||
get { return msg; }
|
|
||||||
set { msg = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool conf;
|
|
||||||
public bool Conf
|
|
||||||
{
|
|
||||||
get { return conf; }
|
|
||||||
set { conf = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private int _seq_no;
|
|
||||||
|
|
||||||
public int seq_no
|
|
||||||
{
|
|
||||||
get { return _seq_no; }
|
|
||||||
set { _seq_no = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private DateTime _waitConfSMSList_time;
|
|
||||||
|
|
||||||
public DateTime waitConfSMSList_time
|
|
||||||
{
|
|
||||||
get { return _waitConfSMSList_time; }
|
|
||||||
set { _waitConfSMSList_time = value; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,601 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
|
|
||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
public class ARSThread
|
|
||||||
{
|
|
||||||
private readonly int READ_TIMEOUT = 8640; // (seconds)
|
|
||||||
|
|
||||||
public UInt16 port;
|
|
||||||
//public MotoTRBOGW parent;
|
|
||||||
private UdpClient udpClient;
|
|
||||||
private IPEndPoint RemoteIpEndPoint;
|
|
||||||
|
|
||||||
public ARSThread(UInt16 p_port)
|
|
||||||
{
|
|
||||||
|
|
||||||
port = p_port;
|
|
||||||
|
|
||||||
// update that the Thread is still running
|
|
||||||
MotoTRBO_GW.lastARSThreadUpdate = DateTime.Now;
|
|
||||||
|
|
||||||
|
|
||||||
//LOGS.LOG("Init ARS Thread on port " + port);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.ARS, "Initiating ARS Thread on port " + port);
|
|
||||||
if (!MotoTRBO_GW.cfg.capPlus)
|
|
||||||
{
|
|
||||||
CreateUDPConnection();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CreateUDPConnectionCapPlus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create the UDP Connection with every network interface
|
|
||||||
/// </summary>
|
|
||||||
private void CreateUDPConnection()
|
|
||||||
{
|
|
||||||
foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
|
|
||||||
{
|
|
||||||
if (netInterface.Description.ToUpper().Contains("MOTOTRBO") ||
|
|
||||||
netInterface.Description.ToUpper().Contains("MOTOROLA"))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Name: " + netInterface.Name);
|
|
||||||
Console.WriteLine("Description: " + netInterface.Description);
|
|
||||||
Console.WriteLine("Addresses: ");
|
|
||||||
IPInterfaceProperties ipProps = netInterface.GetIPProperties();
|
|
||||||
foreach (UnicastIPAddressInformation addr in ipProps.UnicastAddresses)
|
|
||||||
{
|
|
||||||
Console.WriteLine(" " + addr.Address.ToString());
|
|
||||||
|
|
||||||
|
|
||||||
if (addr.Address.ToString().Contains(":"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
IPAddress ip = null;
|
|
||||||
if (IPAddress.TryParse(addr.Address.ToString(), out ip) == true)
|
|
||||||
{
|
|
||||||
String ipAddress = ip.ToString();
|
|
||||||
var udpClient2 = new UdpClient(AddressFamily.InterNetwork);
|
|
||||||
udpClient2.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
|
||||||
udpClient2.Client.Bind(new IPEndPoint(IPAddress.Parse(ipAddress), port));
|
|
||||||
// fire event for UDP Connection successfully
|
|
||||||
if (OnUDPConnectionChanged != null)
|
|
||||||
OnUDPConnectionChanged(true, ipAddress);
|
|
||||||
//udpClient2.JoinMulticastGroup(multicastAddress, localAddress);
|
|
||||||
udpClient2.BeginReceive(OnReceiveSink,
|
|
||||||
new object[]
|
|
||||||
{
|
|
||||||
udpClient2, new IPEndPoint(IPAddress.Parse(ipAddress), ((IPEndPoint) udpClient2.Client.LocalEndPoint).Port)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Console.WriteLine("");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create the UDP Connection with the master radio in case of the Capacity Plus system
|
|
||||||
/// </summary>
|
|
||||||
private void CreateUDPConnectionCapPlus()
|
|
||||||
{
|
|
||||||
|
|
||||||
// fire event for UDP Connection is not up
|
|
||||||
if (OnUDPConnectionChanged != null)
|
|
||||||
OnUDPConnectionChanged(false, "");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
udpClient = new UdpClient(port);
|
|
||||||
udpClient.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
|
||||||
//udpClient.Client.Bind(new IPEndPoint(IPAddress.Any, port));
|
|
||||||
udpClient.Client.ReceiveTimeout = 1000 * READ_TIMEOUT;
|
|
||||||
|
|
||||||
Utils.WriteLine("ARS udp client initiated", ConsoleColor.Green);
|
|
||||||
//UpdateLabelEvent("Registered for ARS messages");
|
|
||||||
|
|
||||||
// fire event for UDP Connection successfully
|
|
||||||
if (OnUDPConnectionChanged != null)
|
|
||||||
OnUDPConnectionChanged(true, "");
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (ex.ToString().Contains(" Only one usage of each socket address"))
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "UDP Port for ARS is already in use. Please try again after fixing the error. \n" + ex.ToString());
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
|
|
||||||
Thread.Sleep(500);
|
|
||||||
//MessageBox.Show("UDP Port for SMS is already in use. Please try again after fixing the error.", "SMS Error");
|
|
||||||
//System.Windows.Forms.Application.Exit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "ARS UDP Exception: " + ex.ToString());
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
//MessageBox.Show("Could not create UDP Connection for SMS. Application will now close", "SMS Error");
|
|
||||||
//System.Windows.Forms.Application.Exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void OnReceiveSink(IAsyncResult result)
|
|
||||||
{
|
|
||||||
IPEndPoint ep = null;
|
|
||||||
var args = (object[])result.AsyncState;
|
|
||||||
var session = (UdpClient)args[0];
|
|
||||||
var local = (IPEndPoint)args[1];
|
|
||||||
|
|
||||||
byte[] buffer = session.EndReceive(result, ref ep);
|
|
||||||
//Do what you want here with the data of the buffer
|
|
||||||
|
|
||||||
Console.WriteLine("Message received from " + ep + " to " + local);
|
|
||||||
ParseReceivedBytes(buffer, ep, local, session);
|
|
||||||
|
|
||||||
// update that the Thread is still running
|
|
||||||
MotoTRBO_GW.lastARSThreadUpdate = DateTime.Now;
|
|
||||||
|
|
||||||
//We make the next call to the begin receive
|
|
||||||
session.BeginReceive(OnReceiveSink, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
|
|
||||||
while (MotoTRBO_GW.running)
|
|
||||||
{
|
|
||||||
while (udpClient != null && MotoTRBO_GW.running)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// update that the Thread is still running
|
|
||||||
MotoTRBO_GW.lastARSThreadUpdate = DateTime.Now;
|
|
||||||
|
|
||||||
//IPEndPoint object will allow us to read datagrams sent from any source.
|
|
||||||
RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
|
||||||
|
|
||||||
// Blocks until a message returns on this socket from a remote host.
|
|
||||||
Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
|
|
||||||
ParseReceivedBytes(receiveBytes, RemoteIpEndPoint, RemoteIpEndPoint, udpClient);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (ex.ToString().Contains("A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"))
|
|
||||||
{
|
|
||||||
// read timeout has expired. This is a normal behaviour in my case when the udp socket is supposed to have a timout of 5 seconds
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.DB, "##### ARSThread Exception #########\n" + ex.ToString());
|
|
||||||
udpClient = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end while
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.always, "### Error: UDPclient is NULL !!! - ARS thread closed");
|
|
||||||
|
|
||||||
|
|
||||||
if (udpClient == null)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
while (MotoTRBO_GW.running && count < 6)
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// recreate the udp connection
|
|
||||||
if (!MotoTRBO_GW.cfg.capPlus)
|
|
||||||
{
|
|
||||||
//CreateUDPConnection();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CreateUDPConnectionCapPlus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Parse an ARS message received and add route if needed using the interface on which it was Received
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="receiveBytes">ARS message bytes as received</param>
|
|
||||||
/// <param name="ep">IP Address of the unit which reported the ARS. From it the subscriber id will be parsed
|
|
||||||
/// by doing a transformation to decimal of the 2nd,3rd and 4th octets</param>
|
|
||||||
/// <param name="interfaceReceived">The network interface on which the ARS was received. In the system with multiple
|
|
||||||
/// radio gateways, you will need to know on which network adapter to redirect all the traffic with that unit. This
|
|
||||||
/// is done by creating a route using cmd.</param>
|
|
||||||
/// <param name="udpClient">The udp client on which the ACK response will be sent</param>
|
|
||||||
private void ParseReceivedBytes(Byte[] receiveBytes, IPEndPoint ep, IPEndPoint interfaceReceived, UdpClient udpClient)
|
|
||||||
{
|
|
||||||
string returnData = Encoding.ASCII.GetString(receiveBytes);
|
|
||||||
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.always, "»»» ARS RECEIVED " + returnData);
|
|
||||||
//Utils.printBytesArray(receiveBytes);
|
|
||||||
|
|
||||||
char[] separator = { '.' };
|
|
||||||
string[] su = ep.Address.ToString().Split(separator);
|
|
||||||
|
|
||||||
uint radioID = (Convert.ToUInt32(su[1])) * 256 * 256 + (Convert.ToUInt32(su[2])) * 256 + Convert.ToUInt32(su[3]);
|
|
||||||
|
|
||||||
string radioIP = su[0] + "." + su[1] + "." + su[2] + "." + su[3];
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.always, "»»» ARS RECEIVED from IP " + radioIP);
|
|
||||||
|
|
||||||
string suid = radioID.ToString();
|
|
||||||
|
|
||||||
header_T reth = DecodePacket(receiveBytes);
|
|
||||||
|
|
||||||
// detect type of ARS
|
|
||||||
String arsType = (reth.pdu_type == 0x00 ? "ON" : (reth.pdu_type == 0x01 ? "OFF" : "??"));
|
|
||||||
|
|
||||||
// trigger ARS received event
|
|
||||||
if (reth.pdu_type == 0x00 || reth.pdu_type == 0x01)
|
|
||||||
OnArsReceived(suid, (reth.pdu_type == 0x00 ? true : false));
|
|
||||||
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.ARS, "»»» ARS " + arsType + " from " + suid);
|
|
||||||
|
|
||||||
// do not do anything with this units because it is not assigned to this gateway
|
|
||||||
if (DBconnThread.GetDbID4RadioID(suid) <= 0)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.ARS, "+++ Unit " + suid + " not assigned to this gateway");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arsType.Contains("ON"))
|
|
||||||
{
|
|
||||||
LocationThread.SendTriggeredLocationSTOP(suid, LocationThread.REQ_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reth.events == header_event.Initial_Event || reth.events == header_event.Refresh_Event)
|
|
||||||
{
|
|
||||||
// Sends ACK
|
|
||||||
Byte[] sendBytes = { 0x00, 0x02, 0xBF, 0x00 };
|
|
||||||
udpClient.Send(sendBytes, sendBytes.Length, ep.Address.ToString(), ep.Port);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.ARS, "««« ARS ACK for " + suid);
|
|
||||||
//LOGS.LOG("ARS ACK sent !");
|
|
||||||
}
|
|
||||||
if (reth.events == header_event.Initial_Event)
|
|
||||||
{
|
|
||||||
SMSmsg sms = new SMSmsg();
|
|
||||||
sms.suid = suid;
|
|
||||||
sms.msg = "GPS started";
|
|
||||||
sms.req_conf = false;
|
|
||||||
//MotoTRBOGW.sendSMSQueue.PostItem(sms);
|
|
||||||
|
|
||||||
|
|
||||||
//resend all SMS waiting but check id the SMS is still in the list
|
|
||||||
/*
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
ArrayList temp = new ArrayList();
|
|
||||||
foreach (SMSmsg msg in SN_Queues.waitConfSMSList)
|
|
||||||
{
|
|
||||||
if (msg.suid == suid)
|
|
||||||
{
|
|
||||||
//SN_Queues.sendSMSQueue.PostItem(msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
temp.Add(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
SN_Queues.waitConfSMSList = temp;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (reth.pdu_type)
|
|
||||||
{
|
|
||||||
case 0x00: // registration
|
|
||||||
PerformeARSon(suid);
|
|
||||||
|
|
||||||
InsertARSinQueue(suid, "ON");
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.ARS, "SU " + suid + " registered");
|
|
||||||
//LocationThread.SendTriggeredLocationSTOP(suid, 0x01);
|
|
||||||
|
|
||||||
Thread p = new Thread(delegate()
|
|
||||||
{
|
|
||||||
int coun = 0;
|
|
||||||
while (MotoTRBO_GW.running && (coun++) < 6)
|
|
||||||
{
|
|
||||||
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
if (LocationThread.SendTriggeredLocationRequest(suid, ((SUinfo)SN_Queues.ht_SUInfo[suid]).repInterval))
|
|
||||||
if (OnTriggeredLocationRequest != null)
|
|
||||||
OnTriggeredLocationRequest(suid, ((SUinfo)SN_Queues.ht_SUInfo[suid]).repInterval);
|
|
||||||
});
|
|
||||||
p.Start();
|
|
||||||
|
|
||||||
|
|
||||||
//LocationThread.SendTriggeredLocationRequestCSBK(suid, ((SUinfo)SN_Queues.ht_SUInfo[suid]).repInterval);
|
|
||||||
if(!MotoTRBO_GW.cfg.capPlus)
|
|
||||||
RouteManager.RegisterRouteARS(suid, interfaceReceived);
|
|
||||||
goto case 0x0F;
|
|
||||||
case 0x0F: // query reply
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x01: // deregistration
|
|
||||||
InsertARSinQueue(suid, "OFF");
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.ARS, "SU " + suid + " unregistered");
|
|
||||||
LOGS.LOG("SU " + suid + " unregistered");
|
|
||||||
|
|
||||||
//mark ARS off in SUinfo
|
|
||||||
//add ars info to HT
|
|
||||||
|
|
||||||
((SUinfo)SN_Queues.ht_SUInfo[suid]).arsCheckTime = DateTime.UtcNow;
|
|
||||||
((SUinfo)SN_Queues.ht_SUInfo[suid]).ARSon = false;
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Aux functions
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct header_T
|
|
||||||
{
|
|
||||||
public bool ext, ack, priority, cntl;
|
|
||||||
public byte pdu_type;
|
|
||||||
public header_event events;
|
|
||||||
public byte encoding;
|
|
||||||
}
|
|
||||||
|
|
||||||
header_T DecodePacket(Byte[] data)
|
|
||||||
{
|
|
||||||
int i, pdata;
|
|
||||||
|
|
||||||
pdata = (int)data[0];
|
|
||||||
pdata <<= 8;
|
|
||||||
pdata |= (int)data[1];
|
|
||||||
|
|
||||||
/*
|
|
||||||
LOGS.WriteLine("Length =" + pdata + "(0x" + data[0].ToString("X") + "," + data[1].ToString("X") + ")");
|
|
||||||
|
|
||||||
Console.Write("Data: ");
|
|
||||||
for (i = 2; i < pdata + 2; i++)
|
|
||||||
Console.Write(" 0x" + data[i].ToString("X"));
|
|
||||||
LOGS.WriteLine();
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// parse header
|
|
||||||
// ----------------------------------------
|
|
||||||
header_T header = new header_T();
|
|
||||||
header.ext = false;
|
|
||||||
if ((data[2] & 0x80) != 0)
|
|
||||||
header.ext = true;
|
|
||||||
|
|
||||||
header.ack = false;
|
|
||||||
if ((data[2] & 0x40) != 0)
|
|
||||||
header.ack = true;
|
|
||||||
|
|
||||||
header.priority = false;
|
|
||||||
if ((data[2] & 0x20) != 0)
|
|
||||||
header.priority = true;
|
|
||||||
|
|
||||||
header.cntl = false;
|
|
||||||
if ((data[2] & 0x10) != 0)
|
|
||||||
header.cntl = true;
|
|
||||||
|
|
||||||
header.pdu_type = (byte)(data[2] & 0x0F);
|
|
||||||
|
|
||||||
switch (header.pdu_type)
|
|
||||||
{
|
|
||||||
case 0x00: Utils.ConsWrite(DebugMSG_Type.ARS, "ARS Registration"); break;
|
|
||||||
case 0x0F: Utils.ConsWrite(DebugMSG_Type.ARS, "Query ACK"); break;
|
|
||||||
case 0x01: Utils.ConsWrite(DebugMSG_Type.ARS, "Deregistration message"); break;
|
|
||||||
default: Utils.ConsWrite(DebugMSG_Type.ARS, "Unknown ARS message"); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 3;
|
|
||||||
if (i >= pdata + 2)
|
|
||||||
{
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
if (header.ext)
|
|
||||||
{
|
|
||||||
// read second header octet
|
|
||||||
byte evt = data[i];
|
|
||||||
evt &= 0x70;
|
|
||||||
evt >>= 5;
|
|
||||||
switch (evt)
|
|
||||||
{
|
|
||||||
case 0: header.events = header_event.Unqualified_Event; break;
|
|
||||||
case 1: header.events = header_event.Initial_Event; break;
|
|
||||||
case 2: header.events = header_event.Refresh_Event; break;
|
|
||||||
default: header.events = header_event.UNKNOWN; break;
|
|
||||||
}
|
|
||||||
header.events = (header_event)evt;
|
|
||||||
|
|
||||||
header.encoding = (byte)(data[i] & 0x0f);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (i >= pdata + 2)
|
|
||||||
{
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// parse address len
|
|
||||||
// ----------------------------------------
|
|
||||||
int addr_len = data[i];
|
|
||||||
i++;
|
|
||||||
if (i >= pdata + 2)
|
|
||||||
{
|
|
||||||
return header;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (addr_len > 0)
|
|
||||||
Console.Write("Address: ");
|
|
||||||
for (int k = 0; k < addr_len; k++)
|
|
||||||
Console.Write(" 0x" + data[i++].ToString("X"));
|
|
||||||
LOGS.WriteLine();
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// parse address len
|
|
||||||
// ----------------------------------------
|
|
||||||
|
|
||||||
i -= 2;
|
|
||||||
//LOGS.WriteLine("i=" + i);
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool InsertARSinQueue(string p_radioID, string p_message)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ArsMSG ars = new ArsMSG();
|
|
||||||
ars.imei = p_radioID;
|
|
||||||
ars.msg = p_message;
|
|
||||||
SN_Queues.arsMsgQueue.PostItem(ars);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Error inserting ARS in Queue");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PerformeARSon(string SUID)
|
|
||||||
{
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (SN_Queues.ht_SUInfo.Contains(SUID))
|
|
||||||
{
|
|
||||||
//add ars info to HT
|
|
||||||
((SUinfo)SN_Queues.ht_SUInfo[SUID]).arsCheckTime = DateTime.UtcNow;
|
|
||||||
((SUinfo)SN_Queues.ht_SUInfo[SUID]).ARSon = true;
|
|
||||||
|
|
||||||
//get reporting interval
|
|
||||||
int repInter = ((SUinfo)SN_Queues.ht_SUInfo[SUID]).repInterval;
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.GPS, "Interval for SUID:" + SUID + " =" + repInter);
|
|
||||||
|
|
||||||
//create location message!!
|
|
||||||
MotoTRBOcmdMsg msg = new MotoTRBOcmdMsg();
|
|
||||||
msg.m_cmd = (byte)MotoTRBOcmd.SET_REPORT_INTERVAL;
|
|
||||||
msg.m_suid = SUID;
|
|
||||||
msg.m_payload = repInter.ToString();
|
|
||||||
if (repInter != 0)
|
|
||||||
{
|
|
||||||
SN_Queues.locationQueue.PostItem(msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.GPS, "SUID:" + SUID + " interval=0 , no GPS reporting needed.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.GPS, "!!!!!! SUID:" + SUID + " Not found in DB!!!!!!!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.ARS, "SUID:" + SUID + " ERROT in PerformeARSon");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopARSThread()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (udpClient != null)
|
|
||||||
{
|
|
||||||
udpClient.Close();
|
|
||||||
udpClient = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// this method is designed to send a
|
|
||||||
public void onPowerUPGateway()
|
|
||||||
{
|
|
||||||
// run through all the units
|
|
||||||
lock (SN_Queues.ht_SUInfo.SyncRoot)
|
|
||||||
{
|
|
||||||
if (SN_Queues.ht_SUInfo != null)
|
|
||||||
{
|
|
||||||
foreach (DictionaryEntry de in SN_Queues.ht_SUInfo)
|
|
||||||
{
|
|
||||||
string radioID = (string) de.Key;
|
|
||||||
SUinfo unitInfo = (SUinfo) de.Value;
|
|
||||||
Console.WriteLine(" {0,-17}{1}", de.Key, de.Value);
|
|
||||||
|
|
||||||
// build all procedure to stop previous location trigger
|
|
||||||
// and to send a new one
|
|
||||||
LocationThread.SendTriggeredLocationSTOP(unitInfo.suid, 0xEE);
|
|
||||||
int coun = 0;
|
|
||||||
while (MotoTRBO_GW.running && (coun++) < 6)
|
|
||||||
{
|
|
||||||
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
if (LocationThread.SendTriggeredLocationRequest(unitInfo.suid, ((SUinfo)SN_Queues.ht_SUInfo[unitInfo.suid]).repInterval))
|
|
||||||
if (OnTriggeredLocationRequest != null)
|
|
||||||
OnTriggeredLocationRequest(unitInfo.suid, ((SUinfo)SN_Queues.ht_SUInfo[unitInfo.suid]).repInterval);
|
|
||||||
RouteManager.RegisterRouteARS(unitInfo.suid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public delegate void UDPConnectionChangedDelegate(bool isConnected, String gateway);
|
|
||||||
public event UDPConnectionChangedDelegate OnUDPConnectionChanged;
|
|
||||||
|
|
||||||
public delegate void ARSReceivedDEl(string suid, bool isOn);
|
|
||||||
public event ARSReceivedDEl OnArsReceived;
|
|
||||||
|
|
||||||
public delegate void TriggeredLocationRequestDEl(String radioID, int reportingInterval);
|
|
||||||
public event TriggeredLocationRequestDEl OnTriggeredLocationRequest;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
|
||||||
<StartArguments>-c</StartArguments>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
|
@ -1,72 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{879BC4B0-635E-4438-BCC4-A372565A64BC}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>MotoRepeater_SOC</RootNamespace>
|
|
||||||
<AssemblyName>MotoRepeater_SOC</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="QueueManagerThread.cs" />
|
|
||||||
<Compile Include="LocationThread.cs" />
|
|
||||||
<Compile Include="MotoRepeater_GW.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="ReceiveSMSThread.cs" />
|
|
||||||
<Compile Include="SendSMSThread.cs" />
|
|
||||||
<Compile Include="WatcherServerThread.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SafeNetLib\SafeNetLib.csproj">
|
|
||||||
<Project>{5AFA65B8-32DA-4924-BD06-7C8802F02BE4}</Project>
|
|
||||||
<Name>SafeNetLib</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\SN_Server\SN_Server.csproj">
|
|
||||||
<Project>{89C11FB7-4EA7-4840-8276-188EC8CA52C2}</Project>
|
|
||||||
<Name>SN_Server</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
@ -1,452 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace LMdirect_SOC
|
|
||||||
{
|
|
||||||
class LMDirectParser
|
|
||||||
{
|
|
||||||
private string time;
|
|
||||||
private string lat;
|
|
||||||
private string lng;
|
|
||||||
private string speed;
|
|
||||||
private string IMEI;
|
|
||||||
private int DImask = 0;
|
|
||||||
|
|
||||||
private Int32 IDLength = 0;
|
|
||||||
public Int64 ID = 0;
|
|
||||||
private Int32 IDTypeLength = 0;
|
|
||||||
private Int32 IDType = 0;
|
|
||||||
private Int32 ServiceType = 0;
|
|
||||||
private Int32 UpdateTime = 0;
|
|
||||||
|
|
||||||
public Int32 MessageType = 0;
|
|
||||||
public Int32 SequenceNr = 0;
|
|
||||||
public Int32 TimeofFix = 0;
|
|
||||||
public Double Lat = 0;
|
|
||||||
public Double Long = 0;
|
|
||||||
public Int32 Speed = 0;
|
|
||||||
|
|
||||||
public Byte ForACKMobidIDLength = 0x00;
|
|
||||||
public Byte[] ForACKMobidID;
|
|
||||||
public Byte ForACKMobidIDTypeLength = 0x00;
|
|
||||||
public Byte[] ForACKMobidType;
|
|
||||||
public Byte ForACKServiceType = 0x00;
|
|
||||||
public Byte ForACKMessageType = 0x00;
|
|
||||||
public Byte[] ForACKSequnceNumber;
|
|
||||||
|
|
||||||
private Double Alitude = 0;
|
|
||||||
private Int32 Heading = 0;
|
|
||||||
private Int32 Satellites = 0;
|
|
||||||
private Int32 FixStatus = 0;
|
|
||||||
private Int32 Carrier = 0;
|
|
||||||
private Int32 RSSI = 0;
|
|
||||||
private Int32 CommState = 0;
|
|
||||||
private Int32 HDOP = 0;
|
|
||||||
private Int32 Inputs = 0;
|
|
||||||
private Int32 UnitStatus = 0;
|
|
||||||
|
|
||||||
private Int32 EventIndex = 0;
|
|
||||||
private Int32 EventCode = 0;
|
|
||||||
private Int32 Accums = 0;
|
|
||||||
private Int32 Spare = 0;
|
|
||||||
|
|
||||||
private Int32 UserMessageRoute = 0;
|
|
||||||
private Int32 UserMessageID = 0;
|
|
||||||
private Int32 UserMessageLength = 0;
|
|
||||||
private String UserMessage = "";
|
|
||||||
private ArrayList AccumList = new ArrayList();
|
|
||||||
private Boolean parseSucceded = false;
|
|
||||||
|
|
||||||
public Boolean MsgWith_MobileID = false;
|
|
||||||
public Boolean MsgWith_MobileIDType = false;
|
|
||||||
public Boolean MsgWith_AuthWord = false;
|
|
||||||
public Boolean MsgWith_Routing = false;
|
|
||||||
public Boolean MsgWith_Forward = false;
|
|
||||||
public Boolean MsgWith_ResponseRedir = false;
|
|
||||||
|
|
||||||
|
|
||||||
public LMDirectParser(byte[] data, int len)
|
|
||||||
{
|
|
||||||
|
|
||||||
int offset = 0;
|
|
||||||
|
|
||||||
if (data == null || data.Length == 0)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Message is null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//parse optional header
|
|
||||||
|
|
||||||
/*if (!((data[offset] & 0x83) != 0))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Option Byte not found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else Console.WriteLine("Option Byte found");*/
|
|
||||||
|
|
||||||
if ((data[offset] & 0x01) == 1) MsgWith_MobileID = true;
|
|
||||||
if ((data[offset] & 0x02) == 2) MsgWith_MobileIDType = true;
|
|
||||||
if ((data[offset] & 0x04) == 4) MsgWith_AuthWord = true;
|
|
||||||
if ((data[offset] & 0x08) == 8) MsgWith_Routing = true;
|
|
||||||
if ((data[offset] & 0x10) == 16) MsgWith_Forward = true;
|
|
||||||
if ((data[offset] & 0x20) == 32) MsgWith_ResponseRedir = true;
|
|
||||||
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
IDLength = data[offset];
|
|
||||||
ForACKMobidIDLength = data[offset];
|
|
||||||
//Console.WriteLine("Id lenght is :"+IDLength);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
ID=0;
|
|
||||||
Int32 step = 1;
|
|
||||||
if (((data[offset + IDLength - 1] % 16) == 0xF))
|
|
||||||
step = 0;
|
|
||||||
ForACKMobidID = new Byte[IDLength];
|
|
||||||
for (int i = offset; i < (offset+IDLength); i++)
|
|
||||||
{
|
|
||||||
ID += ((Int32)(data[i] / 16)) * (long)Math.Pow(10, 2 * (offset + IDLength - i - 1)+step);
|
|
||||||
ID += ((Int32)(data[i] % 16)) * (long)Math.Pow(10, 2 * (offset + IDLength - i - 1)+step-1);
|
|
||||||
ForACKMobidID[i-offset] = data[i];
|
|
||||||
}
|
|
||||||
//Console.WriteLine("ID is :"+ID);
|
|
||||||
IMEI = ID.ToString();
|
|
||||||
offset += IDLength;
|
|
||||||
|
|
||||||
IDTypeLength = data[offset];
|
|
||||||
ForACKMobidIDTypeLength = data[offset];
|
|
||||||
//Console.WriteLine("Id TYPE lenght is :" + IDTypeLength);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
IDType = 0;
|
|
||||||
ForACKMobidType = new Byte[IDTypeLength];
|
|
||||||
for (int i = offset; i < (offset + IDTypeLength); i++)
|
|
||||||
{
|
|
||||||
IDType += data[i] * (Int32)Math.Pow(256, offset + IDTypeLength - i - 1);
|
|
||||||
ForACKMobidType[i - offset] = data[i];
|
|
||||||
}
|
|
||||||
//Console.WriteLine("Mobid type is :" + IDType);
|
|
||||||
offset += IDTypeLength;
|
|
||||||
|
|
||||||
if (MsgWith_AuthWord) offset += 5;
|
|
||||||
if (MsgWith_Routing) offset += 9;
|
|
||||||
if (MsgWith_Forward) offset += 9;
|
|
||||||
if (MsgWith_ResponseRedir) offset += 7;
|
|
||||||
|
|
||||||
ServiceType = data[offset];
|
|
||||||
ForACKServiceType = data[offset];
|
|
||||||
//Console.WriteLine("Service type is :" + ServiceType);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
MessageType = data[offset];
|
|
||||||
ForACKMessageType = data[offset];
|
|
||||||
//Console.WriteLine("Message type is :" + MessageType);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
ForACKSequnceNumber = new Byte[2];
|
|
||||||
ForACKSequnceNumber[0] = data[offset];
|
|
||||||
ForACKSequnceNumber[1] = data[offset+1];
|
|
||||||
SequenceNr = data[offset] * 256 + data[offset + 1];
|
|
||||||
//Console.WriteLine("Sequence number is :" + SequenceNr);
|
|
||||||
offset += 2;
|
|
||||||
|
|
||||||
UpdateTime = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("UpdateTime is :" + UpdateTime);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
if (MessageType != 10)
|
|
||||||
{
|
|
||||||
TimeofFix = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("TimeTofix is :" + TimeofFix);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
Lat = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("Lat is :" + Lat);
|
|
||||||
|
|
||||||
byte[] vector8 = { data[offset], data[offset + 1], data[offset + 2], data[offset + 3] };
|
|
||||||
int integerLat = ToInt(vector8);
|
|
||||||
float floatLat = ToDegres(integerLat);
|
|
||||||
Lat = (double)floatLat;
|
|
||||||
//Console.WriteLine("Lat: " + floatLat);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
|
|
||||||
Long = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("Long is :" + Long);
|
|
||||||
|
|
||||||
byte[] vector3 = { data[offset], data[offset + 1], data[offset + 2], data[offset + 3] };
|
|
||||||
int integerLong = ToInt(vector3);
|
|
||||||
float floatLong = ToDegres(integerLong);
|
|
||||||
Long = (double)floatLong;
|
|
||||||
//Console.WriteLine("Long: " + floatLong);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
Alitude = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("Altitude is :" + Alitude);
|
|
||||||
Alitude = Alitude / 100;
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
Speed = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("Speed is :" + Speed);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
Heading = data[offset] * 256 + data[offset + 1];
|
|
||||||
//Console.WriteLine("Heading is :" + Heading);
|
|
||||||
offset += 2;
|
|
||||||
|
|
||||||
Satellites = data[offset];
|
|
||||||
//Console.WriteLine("Satellites is :" + Satellites);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
FixStatus = data[offset];
|
|
||||||
//Console.WriteLine("Fixstatus is :" + Convert.ToString(FixStatus, 2).PadLeft(8, '0'));
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
Carrier = data[offset] * 256 + data[offset + 1];
|
|
||||||
//Console.WriteLine("Carrier is :" + Carrier);
|
|
||||||
offset += 2;
|
|
||||||
|
|
||||||
RSSI = data[offset] * 256 + data[offset + 1];
|
|
||||||
//Console.WriteLine("RSSI is :" + RSSI);
|
|
||||||
offset += 2;
|
|
||||||
|
|
||||||
CommState = data[offset];
|
|
||||||
//Console.WriteLine("CommState is :" + Convert.ToString(CommState, 2).PadLeft(8, '0'));
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
HDOP = data[offset];
|
|
||||||
//Console.WriteLine("HDOP is :" + HDOP);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
Inputs = data[offset];
|
|
||||||
//Console.WriteLine("Inputs is :" + Convert.ToString(Inputs, 2).PadLeft(8, '0'));
|
|
||||||
DImask = Inputs;
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
UnitStatus = data[offset];
|
|
||||||
//Console.WriteLine("UnitStatus is :" + Convert.ToString(UnitStatus, 2).PadLeft(8, '0'));
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
/*EventIndex = data[offset];
|
|
||||||
Console.WriteLine("EventIndex is :" + EventIndex);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
EventCode = data[offset];
|
|
||||||
Console.WriteLine("EventCode is :" + EventCode);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
Accums = data[offset];
|
|
||||||
Console.WriteLine("Accums is :" + Accums);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
Spare = data[offset];
|
|
||||||
Console.WriteLine("Spare is :" + Spare);
|
|
||||||
offset++;*/
|
|
||||||
|
|
||||||
UserMessageRoute = data[offset];
|
|
||||||
//Console.WriteLine("UserMessageRoute is :" + UserMessageRoute);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
UserMessageID = data[offset];
|
|
||||||
//Console.WriteLine("UserMessageID is :" + UserMessageID);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
UserMessageLength = data[offset] * 256 + data[offset + 1];
|
|
||||||
//Console.WriteLine("UserMessageLength is :" + UserMessageLength);
|
|
||||||
offset += 2;
|
|
||||||
|
|
||||||
//UserMessage = "";
|
|
||||||
//for (int i = offset; i < (offset + IDLength); i++)
|
|
||||||
//{
|
|
||||||
// UserMessage += data[i].ToString("X2") + " ";
|
|
||||||
//}
|
|
||||||
//Console.WriteLine("UserMessage is :" + UserMessage);
|
|
||||||
//offset += IDLength;
|
|
||||||
UserMessage = "";
|
|
||||||
if (UserMessageLength < len - offset)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < UserMessageLength; i++)
|
|
||||||
{
|
|
||||||
UserMessage += data[offset].ToString("X2") + " ";
|
|
||||||
offset++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Console.WriteLine("UserMessage is :" + UserMessage);
|
|
||||||
offset += IDLength;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Lat = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("Lat is :" + Lat);
|
|
||||||
|
|
||||||
byte[] vector8 = { data[offset], data[offset + 1], data[offset + 2], data[offset + 3] };
|
|
||||||
int integerLat = ToInt(vector8);
|
|
||||||
float floatLat = ToDegres(integerLat);
|
|
||||||
Lat = (double)floatLat;
|
|
||||||
//Console.WriteLine("Lat: " + floatLat);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
Long = data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3];
|
|
||||||
//Console.WriteLine("Long is :" + Long);
|
|
||||||
|
|
||||||
byte[] vector3 = { data[offset], data[offset + 1], data[offset + 2], data[offset + 3] };
|
|
||||||
int integerLong = ToInt(vector3);
|
|
||||||
float floatLong = ToDegres(integerLong);
|
|
||||||
Long = (double)floatLong;
|
|
||||||
//Console.WriteLine("Long: " + floatLong);
|
|
||||||
offset += 4;
|
|
||||||
|
|
||||||
Heading = data[offset] * 256 + data[offset + 1];
|
|
||||||
//Console.WriteLine("Heading is :" + Heading);
|
|
||||||
offset += 2;
|
|
||||||
|
|
||||||
Speed = data[offset];
|
|
||||||
//Console.WriteLine("Speed is :" + Speed);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
FixStatus = data[offset];
|
|
||||||
//Console.WriteLine("Fixstatus is :" + Convert.ToString(FixStatus, 2).PadLeft(8, '0'));
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
CommState = data[offset];
|
|
||||||
//Console.WriteLine("CommState is :" + Convert.ToString(CommState, 2).PadLeft(8, '0'));
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
Inputs = data[offset];
|
|
||||||
//Console.WriteLine("Inputs is :" + Convert.ToString(Inputs, 2).PadLeft(8, '0'));
|
|
||||||
DImask = Inputs;
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
EventCode = data[offset];
|
|
||||||
//Console.WriteLine("EventCode is :" + EventCode);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
Accums = data[offset];
|
|
||||||
//Console.WriteLine("Accums is :" + Accums);
|
|
||||||
offset++;
|
|
||||||
|
|
||||||
//AccumList
|
|
||||||
if (Accums < len - offset)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < Accums; i++)
|
|
||||||
{
|
|
||||||
AccumList.Add(data[offset] * 256 * 256 * 256 + data[offset + 1] * 256 * 256 + data[offset + 2] * 256 + data[offset + 3]);
|
|
||||||
offset += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//add data to location QUEUE
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//locManager.SendLoc2messagebus(imei, (Int32)(itime70/1000), iSpeed.ToString(), pLat, pLong);
|
|
||||||
htCell_t cell = new htCell_t();
|
|
||||||
cell.suid = IMEI;
|
|
||||||
Speed = (int)(Speed * 0.036); //convert from cm/s to km/h
|
|
||||||
cell.spd = Speed.ToString();
|
|
||||||
cell.lat = Lat.ToString();
|
|
||||||
cell.lng = Long.ToString();
|
|
||||||
cell.d_lat = Lat;
|
|
||||||
cell.d_lng = Long;
|
|
||||||
cell.location_time = Utils.UnixTimeStampToDateTime(UpdateTime);
|
|
||||||
//cell.telemetryList = new List<Telemetry>(sourceTelemetry);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.GPS, "GPS for SUID: " + IMEI + " with time: " + cell.location_time + " lat: " + Lat + " lng: " + Long);
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : GPS for SUID: " + IMEI + " with time: " + cell.location_time + " lat: " + Lat + " lng: " + Long);
|
|
||||||
SN_Queues.DBQueueLocation.PostItem(cell);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.GPS, "Message added to queue!!!");
|
|
||||||
LOGS.LOG(DateTime.Now.ToString() + " : Message added to queue!!!");
|
|
||||||
//process ALERTS
|
|
||||||
//if (SN_Queues.ht_SUInfo.ContainsKey(IMEI))
|
|
||||||
//{
|
|
||||||
// Utils.ConsWrite(DebugMSG_Type.ALERTS, "Processing alerts for :" + IMEI);
|
|
||||||
// Utils.ConsWrite(DebugMSG_Type.ALERTS, "Message mask:" + DImask);
|
|
||||||
// SUinfo sui = (SUinfo)SN_Queues.ht_SUInfo[IMEI];
|
|
||||||
// foreach (Alert alert in sui.alertList)
|
|
||||||
// {
|
|
||||||
// if (alert.Type == Alert_TYPE.DI)
|
|
||||||
// if (alert.DImask1 == DImask)
|
|
||||||
// {
|
|
||||||
// alert.Alert_latitude = Lat.ToString();
|
|
||||||
// alert.Alert_longitude = Long.ToString();
|
|
||||||
// alert.Speed = Speed;
|
|
||||||
// alert.Digital_in = DImask;
|
|
||||||
// alert.Position_time = Utils.UnixTimeStampToDateTime(UpdateTime).ToString("yyyy:MM:dd HH:mm:ss");
|
|
||||||
// SN_Queues.alertQueue.PostItem(alert);
|
|
||||||
// Utils.ConsWrite(DebugMSG_Type.ALERTS, "Alert: " + alert.Alert_name + " added to queue");
|
|
||||||
// LOGS.LOG(DateTime.Now.ToString() + " : Alert: " + alert.Alert_name + " added to queue");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "ConnectionThread.cs =>> Error adding location to queue!!!");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static byte Mirror(int input)
|
|
||||||
{
|
|
||||||
int returnval = 0;
|
|
||||||
int bit;
|
|
||||||
for (int i = 0; i < 7; ++i)
|
|
||||||
{
|
|
||||||
bit = input & 0x01;
|
|
||||||
returnval |= bit;
|
|
||||||
input >>= 1;
|
|
||||||
returnval <<= 1;
|
|
||||||
}
|
|
||||||
bit = input & 0x01;
|
|
||||||
returnval |= bit;
|
|
||||||
|
|
||||||
return (byte)returnval;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ToInt(byte[] bytes)
|
|
||||||
{
|
|
||||||
if (BitConverter.IsLittleEndian)
|
|
||||||
Array.Reverse(bytes);
|
|
||||||
|
|
||||||
int i = BitConverter.ToInt32(bytes, 0);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint ToUInt(byte[] bytes)
|
|
||||||
{
|
|
||||||
if (BitConverter.IsLittleEndian)
|
|
||||||
Array.Reverse(bytes);
|
|
||||||
|
|
||||||
uint i = BitConverter.ToUInt32(bytes, 0);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
short ToShort(byte[] bytes)
|
|
||||||
{
|
|
||||||
if (BitConverter.IsLittleEndian)
|
|
||||||
Array.Reverse(bytes);
|
|
||||||
|
|
||||||
short i = BitConverter.ToInt16(bytes, 0);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
ushort ToUShort(byte[] bytes)
|
|
||||||
{
|
|
||||||
if (BitConverter.IsLittleEndian)
|
|
||||||
Array.Reverse(bytes);
|
|
||||||
|
|
||||||
ushort i = BitConverter.ToUInt16(bytes, 0);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
float ToDegres(int degree)
|
|
||||||
{
|
|
||||||
return (float)degree / 10000000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Landmarks_Import
|
|
||||||
{
|
|
||||||
|
|
||||||
public struct GoogleSignedUrl
|
|
||||||
{
|
|
||||||
|
|
||||||
public static string Sign(string url, string keyString)
|
|
||||||
{
|
|
||||||
ASCIIEncoding encoding = new ASCIIEncoding();
|
|
||||||
|
|
||||||
// converting key to bytes will throw an exception, need to replace '-' and '_' characters first.
|
|
||||||
string usablePrivateKey = keyString.Replace("-", "+").Replace("_", "/");
|
|
||||||
byte[] privateKeyBytes = Convert.FromBase64String(usablePrivateKey);
|
|
||||||
|
|
||||||
Uri uri = new Uri(url);
|
|
||||||
byte[] encodedPathAndQueryBytes = encoding.GetBytes(uri.LocalPath + uri.Query);
|
|
||||||
|
|
||||||
// compute the hash
|
|
||||||
HMACSHA1 algorithm = new HMACSHA1(privateKeyBytes);
|
|
||||||
byte[] hash = algorithm.ComputeHash(encodedPathAndQueryBytes);
|
|
||||||
|
|
||||||
// convert the bytes to string and make url-safe by replacing '+' and '/' characters
|
|
||||||
string signature = Convert.ToBase64String(hash).Replace("+", "-").Replace("/", "_");
|
|
||||||
|
|
||||||
// Add the signature to the existing URI.
|
|
||||||
return uri.Scheme + "://" + uri.Host + uri.LocalPath + uri.Query + "&signature=" + signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{B4C75BED-7E7D-4E0E-84C7-6FB1429A91DE}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>Simulator_CS_GTW</RootNamespace>
|
|
||||||
<AssemblyName>Simulator_CS_GTW</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<StartupObject />
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Deployment" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Form1.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Form1.Designer.cs">
|
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<EmbeddedResource Include="Form1.resx">
|
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</EmbeddedResource>
|
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
</Compile>
|
|
||||||
<None Include="Properties\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<Compile Include="Properties\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Resources\back.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="icon.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SafeNetLib\SafeNetLib.csproj">
|
|
||||||
<Project>{5AFA65B8-32DA-4924-BD06-7C8802F02BE4}</Project>
|
|
||||||
<Name>SafeNetLib</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\SN_Server\SN_Server.csproj">
|
|
||||||
<Project>{89C11FB7-4EA7-4840-8276-188EC8CA52C2}</Project>
|
|
||||||
<Name>SN_Server</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
Before Width: | Height: | Size: 10 KiB |
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Landmarks_Import")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Landmarks_Import")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("fa3381ee-7c49-4f41-9df6-04ab186ed563")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,48 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Threading;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace Teltonika_SOC
|
|
||||||
{
|
|
||||||
class LocationThread
|
|
||||||
{
|
|
||||||
public int port;
|
|
||||||
private TcpListener server;
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// Main
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
public LocationThread()
|
|
||||||
{
|
|
||||||
// init the TCP client listener
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, " Location Thread created ....");
|
|
||||||
server = new TcpListener(System.Net.IPAddress.Any, Program.cfg.locPort);
|
|
||||||
server.Start();
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, "Location Thread listennig on port:" + Program.cfg.locPort);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.Debug, ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
while (!server.Pending())
|
|
||||||
{
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
}
|
|
||||||
//assign new thread for each connection
|
|
||||||
ConnectionThread newconnection = new ConnectionThread();
|
|
||||||
newconnection.client = server.AcceptTcpClient();
|
|
||||||
Thread newthread = new Thread(new ThreadStart(newconnection.HandleConnection));
|
|
||||||
newthread.IsBackground = true;
|
|
||||||
newthread.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,462 +0,0 @@
|
|||||||
// for license see license.txt
|
|
||||||
|
|
||||||
// Modified 12/27/2004 by Chris Wysopal <weld@vulnwatch.com>
|
|
||||||
// fixed vulnerability found by hat-squad
|
|
||||||
|
|
||||||
// portions Copyright (C) 1994 Nathaniel W. Mishkin
|
|
||||||
// code taken from rlogind.exe
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <winbase.h>
|
|
||||||
|
|
||||||
#ifdef GAPING_SECURITY_HOLE
|
|
||||||
|
|
||||||
|
|
||||||
#define BUFFER_SIZE 200
|
|
||||||
|
|
||||||
extern char * pr00gie;
|
|
||||||
void holler(char * str, char * p1, char * p2, char * p3, char * p4, char * p5, char * p6);
|
|
||||||
char smbuff[20];
|
|
||||||
//
|
|
||||||
// Structure used to describe each session
|
|
||||||
//
|
|
||||||
typedef struct {
|
|
||||||
|
|
||||||
//
|
|
||||||
// These fields are filled in at session creation time
|
|
||||||
//
|
|
||||||
HANDLE ReadPipeHandle; // Handle to shell stdout pipe
|
|
||||||
HANDLE WritePipeHandle; // Handle to shell stdin pipe
|
|
||||||
HANDLE ProcessHandle; // Handle to shell process
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// These fields are filled in at session connect time and are only
|
|
||||||
// valid when the session is connected
|
|
||||||
//
|
|
||||||
SOCKET ClientSocket;
|
|
||||||
HANDLE ReadShellThreadHandle; // Handle to session shell-read thread
|
|
||||||
HANDLE WriteShellThreadHandle; // Handle to session shell-read thread
|
|
||||||
|
|
||||||
} SESSION_DATA, *PSESSION_DATA;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Private prototypes
|
|
||||||
//
|
|
||||||
|
|
||||||
static HANDLE
|
|
||||||
StartShell(
|
|
||||||
HANDLE StdinPipeHandle,
|
|
||||||
HANDLE StdoutPipeHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
static VOID
|
|
||||||
SessionReadShellThreadFn(
|
|
||||||
LPVOID Parameter
|
|
||||||
);
|
|
||||||
|
|
||||||
static VOID
|
|
||||||
SessionWriteShellThreadFn(
|
|
||||||
LPVOID Parameter
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// **********************************************************************
|
|
||||||
//
|
|
||||||
// CreateSession
|
|
||||||
//
|
|
||||||
// Creates a new session. Involves creating the shell process and establishing
|
|
||||||
// pipes for communication with it.
|
|
||||||
//
|
|
||||||
// Returns a handle to the session or NULL on failure.
|
|
||||||
//
|
|
||||||
|
|
||||||
static PSESSION_DATA
|
|
||||||
CreateSession(
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PSESSION_DATA Session = NULL;
|
|
||||||
BOOL Result;
|
|
||||||
SECURITY_ATTRIBUTES SecurityAttributes;
|
|
||||||
HANDLE ShellStdinPipe = NULL;
|
|
||||||
HANDLE ShellStdoutPipe = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Allocate space for the session data
|
|
||||||
//
|
|
||||||
Session = (PSESSION_DATA) malloc(sizeof(SESSION_DATA));
|
|
||||||
if (Session == NULL) {
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reset fields in preparation for failure
|
|
||||||
//
|
|
||||||
Session->ReadPipeHandle = NULL;
|
|
||||||
Session->WritePipeHandle = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create the I/O pipes for the shell
|
|
||||||
//
|
|
||||||
SecurityAttributes.nLength = sizeof(SecurityAttributes);
|
|
||||||
SecurityAttributes.lpSecurityDescriptor = NULL; // Use default ACL
|
|
||||||
SecurityAttributes.bInheritHandle = TRUE; // Shell will inherit handles
|
|
||||||
|
|
||||||
Result = CreatePipe(&Session->ReadPipeHandle, &ShellStdoutPipe,
|
|
||||||
&SecurityAttributes, 0);
|
|
||||||
if (!Result) {
|
|
||||||
holler("Failed to create shell stdout pipe, error = %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
goto Failure;
|
|
||||||
}
|
|
||||||
Result = CreatePipe(&ShellStdinPipe, &Session->WritePipeHandle,
|
|
||||||
&SecurityAttributes, 0);
|
|
||||||
|
|
||||||
if (!Result) {
|
|
||||||
holler("Failed to create shell stdin pipe, error = %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
goto Failure;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Start the shell
|
|
||||||
//
|
|
||||||
Session->ProcessHandle = StartShell(ShellStdinPipe, ShellStdoutPipe);
|
|
||||||
|
|
||||||
//
|
|
||||||
// We're finished with our copy of the shell pipe handles
|
|
||||||
// Closing the runtime handles will close the pipe handles for us.
|
|
||||||
//
|
|
||||||
CloseHandle(ShellStdinPipe);
|
|
||||||
CloseHandle(ShellStdoutPipe);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check result of shell start
|
|
||||||
//
|
|
||||||
if (Session->ProcessHandle == NULL) {
|
|
||||||
holler("Failed to execute shell", NULL,
|
|
||||||
NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
goto Failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// The session is not connected, initialize variables to indicate that
|
|
||||||
//
|
|
||||||
Session->ClientSocket = INVALID_SOCKET;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Success, return the session pointer as a handle
|
|
||||||
//
|
|
||||||
return(Session);
|
|
||||||
|
|
||||||
Failure:
|
|
||||||
|
|
||||||
//
|
|
||||||
// We get here for any failure case.
|
|
||||||
// Free up any resources and exit
|
|
||||||
//
|
|
||||||
|
|
||||||
if (ShellStdinPipe != NULL)
|
|
||||||
CloseHandle(ShellStdinPipe);
|
|
||||||
if (ShellStdoutPipe != NULL)
|
|
||||||
CloseHandle(ShellStdoutPipe);
|
|
||||||
if (Session->ReadPipeHandle != NULL)
|
|
||||||
CloseHandle(Session->ReadPipeHandle);
|
|
||||||
if (Session->WritePipeHandle != NULL)
|
|
||||||
CloseHandle(Session->WritePipeHandle);
|
|
||||||
|
|
||||||
free(Session);
|
|
||||||
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
doexec(
|
|
||||||
SOCKET ClientSocket
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PSESSION_DATA Session = CreateSession();
|
|
||||||
SECURITY_ATTRIBUTES SecurityAttributes;
|
|
||||||
DWORD ThreadId;
|
|
||||||
HANDLE HandleArray[3];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
SecurityAttributes.nLength = sizeof(SecurityAttributes);
|
|
||||||
SecurityAttributes.lpSecurityDescriptor = NULL; // Use default ACL
|
|
||||||
SecurityAttributes.bInheritHandle = FALSE; // No inheritance
|
|
||||||
|
|
||||||
//
|
|
||||||
// Store the client socket handle in the session structure so the thread
|
|
||||||
// can get at it. This also signals that the session is connected.
|
|
||||||
//
|
|
||||||
Session->ClientSocket = ClientSocket;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create the session threads
|
|
||||||
//
|
|
||||||
Session->ReadShellThreadHandle =
|
|
||||||
CreateThread(&SecurityAttributes, 0,
|
|
||||||
(LPTHREAD_START_ROUTINE) SessionReadShellThreadFn,
|
|
||||||
(LPVOID) Session, 0, &ThreadId);
|
|
||||||
|
|
||||||
if (Session->ReadShellThreadHandle == NULL) {
|
|
||||||
holler("Failed to create ReadShell session thread, error = %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reset the client pipe handle to indicate this session is disconnected
|
|
||||||
//
|
|
||||||
Session->ClientSocket = INVALID_SOCKET;
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Session->WriteShellThreadHandle =
|
|
||||||
CreateThread(&SecurityAttributes, 0,
|
|
||||||
(LPTHREAD_START_ROUTINE) SessionWriteShellThreadFn,
|
|
||||||
(LPVOID) Session, 0, &ThreadId);
|
|
||||||
|
|
||||||
if (Session->WriteShellThreadHandle == NULL) {
|
|
||||||
holler("Failed to create ReadShell session thread, error = %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Reset the client pipe handle to indicate this session is disconnected
|
|
||||||
//
|
|
||||||
Session->ClientSocket = INVALID_SOCKET;
|
|
||||||
|
|
||||||
TerminateThread(Session->WriteShellThreadHandle, 0);
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Wait for either thread or the shell process to finish
|
|
||||||
//
|
|
||||||
|
|
||||||
HandleArray[0] = Session->ReadShellThreadHandle;
|
|
||||||
HandleArray[1] = Session->WriteShellThreadHandle;
|
|
||||||
HandleArray[2] = Session->ProcessHandle;
|
|
||||||
|
|
||||||
|
|
||||||
i = WaitForMultipleObjects(3, HandleArray, FALSE, 0xffffffff);
|
|
||||||
|
|
||||||
|
|
||||||
switch (i) {
|
|
||||||
case WAIT_OBJECT_0 + 0:
|
|
||||||
TerminateThread(Session->WriteShellThreadHandle, 0);
|
|
||||||
TerminateProcess(Session->ProcessHandle, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WAIT_OBJECT_0 + 1:
|
|
||||||
TerminateThread(Session->ReadShellThreadHandle, 0);
|
|
||||||
TerminateProcess(Session->ProcessHandle, 1);
|
|
||||||
break;
|
|
||||||
case WAIT_OBJECT_0 + 2:
|
|
||||||
TerminateThread(Session->WriteShellThreadHandle, 0);
|
|
||||||
TerminateThread(Session->ReadShellThreadHandle, 0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
holler("WaitForMultipleObjects error: %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Close my handles to the threads, the shell process, and the shell pipes
|
|
||||||
shutdown(Session->ClientSocket, SD_BOTH);
|
|
||||||
closesocket(Session->ClientSocket);
|
|
||||||
|
|
||||||
DisconnectNamedPipe(Session->ReadPipeHandle);
|
|
||||||
CloseHandle(Session->ReadPipeHandle);
|
|
||||||
|
|
||||||
DisconnectNamedPipe(Session->WritePipeHandle);
|
|
||||||
CloseHandle(Session->WritePipeHandle);
|
|
||||||
|
|
||||||
|
|
||||||
CloseHandle(Session->ReadShellThreadHandle);
|
|
||||||
CloseHandle(Session->WriteShellThreadHandle);
|
|
||||||
|
|
||||||
CloseHandle(Session->ProcessHandle);
|
|
||||||
|
|
||||||
free(Session);
|
|
||||||
|
|
||||||
return(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// **********************************************************************
|
|
||||||
//
|
|
||||||
// StartShell
|
|
||||||
//
|
|
||||||
// Execs the shell with the specified handle as stdin, stdout/err
|
|
||||||
//
|
|
||||||
// Returns process handle or NULL on failure
|
|
||||||
//
|
|
||||||
|
|
||||||
static HANDLE
|
|
||||||
StartShell(
|
|
||||||
HANDLE ShellStdinPipeHandle,
|
|
||||||
HANDLE ShellStdoutPipeHandle
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PROCESS_INFORMATION ProcessInformation;
|
|
||||||
STARTUPINFO si;
|
|
||||||
HANDLE ProcessHandle = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Initialize process startup info
|
|
||||||
//
|
|
||||||
si.cb = sizeof(STARTUPINFO);
|
|
||||||
si.lpReserved = NULL;
|
|
||||||
si.lpTitle = NULL;
|
|
||||||
si.lpDesktop = NULL;
|
|
||||||
si.dwX = si.dwY = si.dwXSize = si.dwYSize = 0L;
|
|
||||||
si.wShowWindow = SW_HIDE;
|
|
||||||
si.lpReserved2 = NULL;
|
|
||||||
si.cbReserved2 = 0;
|
|
||||||
|
|
||||||
si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
|
|
||||||
|
|
||||||
si.hStdInput = ShellStdinPipeHandle;
|
|
||||||
si.hStdOutput = ShellStdoutPipeHandle;
|
|
||||||
|
|
||||||
DuplicateHandle(GetCurrentProcess(), ShellStdoutPipeHandle,
|
|
||||||
GetCurrentProcess(), &si.hStdError,
|
|
||||||
DUPLICATE_SAME_ACCESS, TRUE, 0);
|
|
||||||
|
|
||||||
if (CreateProcess(NULL, pr00gie, NULL, NULL, TRUE, 0, NULL, NULL,
|
|
||||||
&si, &ProcessInformation))
|
|
||||||
{
|
|
||||||
ProcessHandle = ProcessInformation.hProcess;
|
|
||||||
CloseHandle(ProcessInformation.hThread);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
holler("Failed to execute shell, error = %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
|
|
||||||
return(ProcessHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// **********************************************************************
|
|
||||||
// SessionReadShellThreadFn
|
|
||||||
//
|
|
||||||
// The read thread procedure. Reads from the pipe connected to the shell
|
|
||||||
// process, writes to the socket.
|
|
||||||
//
|
|
||||||
|
|
||||||
static VOID
|
|
||||||
SessionReadShellThreadFn(
|
|
||||||
LPVOID Parameter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PSESSION_DATA Session = Parameter;
|
|
||||||
BYTE Buffer[BUFFER_SIZE];
|
|
||||||
BYTE Buffer2[BUFFER_SIZE*2+30];
|
|
||||||
DWORD BytesRead;
|
|
||||||
|
|
||||||
// this bogus peek is here because win32 won't let me close the pipe if it is
|
|
||||||
// in waiting for input on a read.
|
|
||||||
while (PeekNamedPipe(Session->ReadPipeHandle, Buffer, sizeof(Buffer),
|
|
||||||
&BytesRead, NULL, NULL))
|
|
||||||
{
|
|
||||||
DWORD BufferCnt, BytesToWrite;
|
|
||||||
BYTE PrevChar = 0;
|
|
||||||
|
|
||||||
if (BytesRead > 0)
|
|
||||||
{
|
|
||||||
ReadFile(Session->ReadPipeHandle, Buffer, sizeof(Buffer),
|
|
||||||
&BytesRead, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Sleep(50);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Process the data we got from the shell: replace any naked LF's
|
|
||||||
// with CR-LF pairs.
|
|
||||||
//
|
|
||||||
for (BufferCnt = 0, BytesToWrite = 0; BufferCnt < BytesRead; BufferCnt++) {
|
|
||||||
if (Buffer[BufferCnt] == '\n' && PrevChar != '\r')
|
|
||||||
Buffer2[BytesToWrite++] = '\r';
|
|
||||||
PrevChar = Buffer2[BytesToWrite++] = Buffer[BufferCnt];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (send(Session->ClientSocket, Buffer2, BytesToWrite, 0) <= 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetLastError() != ERROR_BROKEN_PIPE)
|
|
||||||
holler("SessionReadShellThreadFn exitted, error = %s",
|
|
||||||
itoa(GetLastError(), smbuff, 10), NULL, NULL, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
ExitThread(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// **********************************************************************
|
|
||||||
// SessionWriteShellThreadFn
|
|
||||||
//
|
|
||||||
// The write thread procedure. Reads from socket, writes to pipe connected
|
|
||||||
// to shell process.
|
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
|
||||||
SessionWriteShellThreadFn(
|
|
||||||
LPVOID Parameter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
PSESSION_DATA Session = Parameter;
|
|
||||||
BYTE RecvBuffer[1];
|
|
||||||
BYTE Buffer[BUFFER_SIZE];
|
|
||||||
DWORD BytesWritten;
|
|
||||||
DWORD BufferCnt;
|
|
||||||
|
|
||||||
BufferCnt = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Loop, reading one byte at a time from the socket.
|
|
||||||
//
|
|
||||||
while (recv(Session->ClientSocket, RecvBuffer, sizeof(RecvBuffer), 0) != 0) {
|
|
||||||
|
|
||||||
Buffer[BufferCnt++] = RecvBuffer[0];
|
|
||||||
if (RecvBuffer[0] == '\r')
|
|
||||||
Buffer[BufferCnt++] = '\n';
|
|
||||||
|
|
||||||
|
|
||||||
// Trap exit as it causes problems
|
|
||||||
if (strnicmp(Buffer, "exit\r\n", 6) == 0)
|
|
||||||
ExitThread(0);
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// If we got a CR, it's time to send what we've buffered up down to the
|
|
||||||
// shell process.
|
|
||||||
// SECURITY FIX: CW 12/27/04 Add BufferCnt size check. If we hit end of buffer, flush it
|
|
||||||
if (RecvBuffer[0] == '\n' || RecvBuffer[0] == '\r' || BufferCnt > BUFFER_SIZE-1) {
|
|
||||||
if (! WriteFile(Session->WritePipeHandle, Buffer, BufferCnt,
|
|
||||||
&BytesWritten, NULL))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
BufferCnt = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ExitThread(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||||||
; config.ini
|
|
||||||
; This file is used to run the SafeNet Teltonika Gateway application
|
|
||||||
; Please do not modify if you are not an admin
|
|
||||||
|
|
||||||
|
|
||||||
[GATEWAY]
|
|
||||||
id = 0
|
|
||||||
port = 49999
|
|
||||||
transport = tcp
|
|
||||||
|
|
||||||
;MySQL INFO
|
|
||||||
;SERVER - mysql server IP
|
|
||||||
;DATABASE - mysql schema
|
|
||||||
;UID - mysql user ID
|
|
||||||
;PASSWORD -mysql password
|
|
||||||
[MySQL]
|
|
||||||
SERVER = safenet.crnnlkxkkb0y.us-east-1.rds.amazonaws.com
|
|
||||||
DATABASE = safenet301
|
|
||||||
UID = safenet
|
|
||||||
PASSWORD = sE4reg3Q
|
|
||||||
active = true
|
|
||||||
|
|
||||||
[EmailServiceAlerts]
|
|
||||||
Enable = false
|
|
||||||
User = safemobilealerts@gmail.com
|
|
||||||
Pass = SafeMobile2012
|
|
||||||
Pop3Server = pop.gmail.com
|
|
||||||
SmtpServer = smtp.gmail.com
|
|
||||||
EnableSSL = True
|
|
||||||
Pop3Port = 995
|
|
||||||
SmtpPort = 587
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace LumiSoft.Media.Wave.Native
|
|
||||||
{
|
|
||||||
// Why this must be class ? otherwise in win XP won't work.
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This class represents WAVEFORMATEX structure.
|
|
||||||
/// </summary>
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal class WAVEFORMATEX
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Waveform-audio format type. Format tags are registered with Microsoft Corporation for many
|
|
||||||
/// compression algorithms. A complete list of format tags can be found in the Mmreg.h header file.
|
|
||||||
/// For one- or two-channel PCM data, this value should be WAVE_FORMAT_PCM. When this structure is
|
|
||||||
/// included in a WAVEFORMATEXTENSIBLE structure, this value must be WAVE_FORMAT_EXTENSIBLE.</summary>
|
|
||||||
public ushort wFormatTag;
|
|
||||||
/// <summary>
|
|
||||||
/// Number of channels in the waveform-audio data. Monaural data uses one channel and stereo data
|
|
||||||
/// uses two channels.
|
|
||||||
/// </summary>
|
|
||||||
public ushort nChannels;
|
|
||||||
/// <summary>
|
|
||||||
/// Sample rate, in samples per second (hertz). If wFormatTag is WAVE_FORMAT_PCM, then common
|
|
||||||
/// values for nSamplesPerSec are 8.0 kHz, 11.025 kHz, 22.05 kHz, and 44.1 kHz.
|
|
||||||
/// </summary>
|
|
||||||
public uint nSamplesPerSec;
|
|
||||||
/// <summary>
|
|
||||||
/// Required average data-transfer rate, in bytes per second, for the format tag. If wFormatTag
|
|
||||||
/// is WAVE_FORMAT_PCM, nAvgBytesPerSec should be equal to the product of nSamplesPerSec and nBlockAlign.
|
|
||||||
/// </summary>
|
|
||||||
public uint nAvgBytesPerSec;
|
|
||||||
/// <summary>
|
|
||||||
/// Block alignment, in bytes. The block alignment is the minimum atomic unit of data for the wFormatTag
|
|
||||||
/// format type. If wFormatTag is WAVE_FORMAT_PCM or WAVE_FORMAT_EXTENSIBLE, nBlockAlign must be equal
|
|
||||||
/// to the product of nChannels and wBitsPerSample divided by 8 (bits per byte).
|
|
||||||
/// </summary>
|
|
||||||
public ushort nBlockAlign;
|
|
||||||
/// <summary>
|
|
||||||
/// Bits per sample for the wFormatTag format type. If wFormatTag is WAVE_FORMAT_PCM, then
|
|
||||||
/// wBitsPerSample should be equal to 8 or 16.
|
|
||||||
/// </summary>
|
|
||||||
public ushort wBitsPerSample;
|
|
||||||
/// <summary>
|
|
||||||
/// Size, in bytes, of extra format information appended to the end of the WAVEFORMATEX structure.
|
|
||||||
/// </summary>
|
|
||||||
public ushort cbSize;
|
|
||||||
|
|
||||||
#region method ToString
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns this object field values as string list.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Returns this object field values as string list.</returns>
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
StringBuilder retVal = new StringBuilder();
|
|
||||||
retVal.Append("wFormatTag: " + wFormatTag + "\r\n");
|
|
||||||
retVal.Append("nChannels: " + nChannels + "\r\n");
|
|
||||||
retVal.Append("nSamplesPerSec: " + nSamplesPerSec + "\r\n");
|
|
||||||
retVal.Append("nAvgBytesPerSec: " + nAvgBytesPerSec + "\r\n");
|
|
||||||
retVal.Append("nBlockAlign: " + nBlockAlign + "\r\n");
|
|
||||||
retVal.Append("wBitsPerSample: " + wBitsPerSample + "\r\n");
|
|
||||||
retVal.Append("cbSize: " + cbSize + "\r\n");
|
|
||||||
|
|
||||||
return retVal.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 8.3 KiB |
@ -1,116 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Nini.Config;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace Hytera_SOC
|
|
||||||
{
|
|
||||||
public class Config
|
|
||||||
{
|
|
||||||
private IConfigSource source = null;
|
|
||||||
private string CFG_FILE = "config.ini";
|
|
||||||
|
|
||||||
public string hyteraIP;
|
|
||||||
public string hyteraIMEI;
|
|
||||||
public string gatewayID;
|
|
||||||
public byte subNet;
|
|
||||||
public int ping_interval;
|
|
||||||
public bool useRadioTime;
|
|
||||||
public bool gw_restart;
|
|
||||||
|
|
||||||
public string SERVER;
|
|
||||||
public string DATABASE;
|
|
||||||
public string UID;
|
|
||||||
public string PASSWORD;
|
|
||||||
public string report;
|
|
||||||
public bool db_active;
|
|
||||||
|
|
||||||
public int debug_port;
|
|
||||||
//email service
|
|
||||||
public string smtpServer = "";
|
|
||||||
public string pop3Server = "";
|
|
||||||
public string pop3Port = "";
|
|
||||||
public string smtpPort = "";
|
|
||||||
public bool sslState = false;
|
|
||||||
public bool enableEmailService = false;
|
|
||||||
public string user, psw;
|
|
||||||
|
|
||||||
public ArrayList ar_radioIPs = new ArrayList();
|
|
||||||
|
|
||||||
public Config(string CFG_FILE = "config.ini")
|
|
||||||
{
|
|
||||||
LoadConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadConfig()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
source = new IniConfigSource(CFG_FILE);
|
|
||||||
|
|
||||||
pop3Server = source.Configs["EmailService"].Get("Pop3Server");
|
|
||||||
smtpServer = source.Configs["EmailService"].Get("SmtpServer");
|
|
||||||
pop3Port = source.Configs["EmailService"].Get("Pop3Port");
|
|
||||||
smtpPort = source.Configs["EmailService"].Get("SmtpPort");
|
|
||||||
sslState = Convert.ToBoolean(source.Configs["EmailService"].Get("EnableSSL"));
|
|
||||||
enableEmailService = Convert.ToBoolean(source.Configs["EmailService"].Get("Enable"));
|
|
||||||
user = source.Configs["EmailService"].Get("User");
|
|
||||||
psw = source.Configs["EmailService"].Get("Pass");
|
|
||||||
|
|
||||||
gatewayID = source.Configs["GATEWAY"].Get("id");
|
|
||||||
report = source.Configs["GATEWAY"].Get("report");
|
|
||||||
hyteraIP = source.Configs["GATEWAY"].Get("MasterRadioIP");
|
|
||||||
hyteraIMEI = source.Configs["GATEWAY"].Get("MasterRadioIMEI");
|
|
||||||
subNet = Convert.ToByte(source.Configs["GATEWAY"].Get("MR_subnet"));
|
|
||||||
ping_interval = Convert.ToInt32(source.Configs["GATEWAY"].Get("ping_interval"));
|
|
||||||
useRadioTime = Convert.ToBoolean(source.Configs["GATEWAY"].Get("UseRadioTime"));
|
|
||||||
gw_restart = Convert.ToBoolean(source.Configs["GATEWAY"].Get("gw_restart"));
|
|
||||||
|
|
||||||
//MySQL connection info (for SMS)
|
|
||||||
SERVER = source.Configs["MySQL"].Get("SERVER");
|
|
||||||
DATABASE = source.Configs["MySQL"].Get("DATABASE");
|
|
||||||
UID = source.Configs["MySQL"].Get("UID");
|
|
||||||
PASSWORD = source.Configs["MySQL"].Get("PASSWORD");
|
|
||||||
|
|
||||||
db_active = Convert.ToBoolean(source.Configs["MySQL"].Get("active"));
|
|
||||||
|
|
||||||
//debug port is GWID with the first digit replage by 3. ex: 95001 -> 35001
|
|
||||||
string str_debug_port = "3" + gatewayID.Substring(1);
|
|
||||||
debug_port = Int32.Parse(str_debug_port);
|
|
||||||
|
|
||||||
LoadRadioIP();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "LoadSetup() Exception: " + ex.ToString());
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CTRL, "LoadSetup file OK !");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadRadioIP()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
source = new IniConfigSource(CFG_FILE);
|
|
||||||
ar_radioIPs.Add(source.Configs["GATEWAY"].Get("MasterRadioIP"));
|
|
||||||
/*
|
|
||||||
string[] keys = source.Configs["GATEWAY_IPS"].GetKeys();
|
|
||||||
foreach (string key in keys)
|
|
||||||
{
|
|
||||||
if (!ar_radioIPs.Contains(source.Configs["GATEWAY_IPS"].Get(key)))
|
|
||||||
ar_radioIPs.Add(source.Configs["GATEWAY_IPS"].Get(key));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "LoadRadiosIP() Exception: " + ex.ToString());
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CTRL, "LoadRadiosIP OK !");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\obj\x86\Debug\ResolveAssemblyReference.cache
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\config.ini
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\MIMEParser.dll
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\Nini.dll
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\OpenPOP.dll
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\SafeNetLib.dll
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\MySql.Data.dll
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\bin\Debug\SafeNetLib.pdb
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.exe
|
|
||||||
D:\workspace\SafeNet_GW\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.pdb
|
|
@ -1,20 +0,0 @@
|
|||||||
; This file is used to run the SafeNet LMU Gateway application
|
|
||||||
; Please do not modify if you are not an admin
|
|
||||||
|
|
||||||
|
|
||||||
[GATEWAY]
|
|
||||||
id = 222
|
|
||||||
|
|
||||||
;MySQL INFO
|
|
||||||
;SERVER - mysql server IP
|
|
||||||
;DATABASE - mysql schema
|
|
||||||
;UID - mysql user ID
|
|
||||||
;PASSWORD -mysql password
|
|
||||||
[MySQL]
|
|
||||||
SERVER = 10.120.1.136
|
|
||||||
DATABASE = safenet301
|
|
||||||
UID = safenet
|
|
||||||
PASSWORD = sE4reg3Q
|
|
||||||
active = true
|
|
||||||
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("Hytera_GW")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("Hytera_GW")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2012")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("08cba58a-1d72-4808-a40c-4f23971c46bd")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,292 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
|
|
||||||
using System.Threading;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace ConnectPlus_SOC
|
|
||||||
{
|
|
||||||
|
|
||||||
class SendSMSThread
|
|
||||||
{
|
|
||||||
private byte WAIT_SMS_SEC = 5; // max no of seconds to wait for SMS ack
|
|
||||||
int remoteSMSport;
|
|
||||||
public SendSMSThread(int p_remoteSMSport)
|
|
||||||
{
|
|
||||||
remoteSMSport = p_remoteSMSport;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "Waiting for new SMS!!!");
|
|
||||||
//MotoTRBOcmdMsg msg = MotoTRBOGW.locationQueue.GetItem(100);
|
|
||||||
SMSmsg msg = SN_Queues.sendSMSQueue.GetItem(100);//block until message is in queue
|
|
||||||
if (msg != null)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "SendSMSthread.cs -> HandleConnection");
|
|
||||||
SendSMSmsg(msg);
|
|
||||||
if (msg.req_conf)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Requesting Receive Confirmation");
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
msg.seq_no = this.sms_seq_id - 1;//-1 because was alraedy incremented for next id
|
|
||||||
msg.waitConfSMSList_time = DateTime.Now;
|
|
||||||
|
|
||||||
SN_Queues.waitConfSMSList.Add(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Thread.Sleep(1200);//minimum interval between SMS as per MotoTRBO specs
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in OC4JconnThread:HandleConnection(): \r\n\tData=" +
|
|
||||||
ex.Data + "\r\n\tSource=" +
|
|
||||||
ex.Source + "\r\n\tStackTrace=" +
|
|
||||||
ex.StackTrace + "\r\n\tMessage=" +
|
|
||||||
ex.Message + "\r\n\tInnerException=" +
|
|
||||||
ex.InnerException);
|
|
||||||
}
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SendSMSmsg(SMSmsg p_msg)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "SendSMSthread.cs->SendSMSmsg msg:" + p_msg.msg);
|
|
||||||
SendSMS_with_addrs("10000.4@tserv<mailto:" + p_msg.suid + ".1>", p_msg.msg, p_msg.conf);
|
|
||||||
|
|
||||||
//LOGS.LOG("Sending SMS suid:"+p_msg.suid+" "+ p_msg.msg);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, exc.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendSMS_with_addrs(string address, string msg, bool conf)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Sending SMS to:" + address + " msg:" + msg);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
IPAddress ctrIP = null;
|
|
||||||
if (!IPAddress.TryParse(ConnectPlus_GW.cfg.ctrlIP, out ctrIP))
|
|
||||||
{
|
|
||||||
ctrIP = Dns.GetHostAddresses(ConnectPlus_GW.cfg.ctrlIP)[0];
|
|
||||||
}
|
|
||||||
if (ctrIP == null)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Location Thread invalid host address for: " + ConnectPlus_GW.cfg.ctrlIP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conf)
|
|
||||||
{
|
|
||||||
Byte[] sendBytes = PackSMS_with_addrs(address, msg, true);
|
|
||||||
//Console.WriteLine("Send SMS to SU " + SUID + " with confirmation");
|
|
||||||
|
|
||||||
ConnectPlus_GW.smsUDPclient.Send(sendBytes, sendBytes.Length, ctrIP.ToString(), ConnectPlus_GW.cfg.smsPort);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Byte[] sendBytes = PackSMS_with_addrs(address, msg, false);
|
|
||||||
//Console.WriteLine("Send SMS to SU " + SUID + " without confirmation");
|
|
||||||
ConnectPlus_GW.smsUDPclient.Send(sendBytes, sendBytes.Length, ctrIP.ToString(), ConnectPlus_GW.cfg.smsPort);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always,"Exc in:SendSMS_with_addrs: \n"+ exc.ToString());
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "ConnectPlus_GW.cfg.ctrlIP" + ConnectPlus_GW.cfg.ctrlIP);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "ConnectPlus_GW.cfg.smsPort" + ConnectPlus_GW.cfg.smsPort);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Send_Reg_msg(string address)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Sending TMS Service Availability to:" + address);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Byte[] sendBytes = Pack_TMS(address);
|
|
||||||
//Console.WriteLine("Send SMS to SU " + SUID + " with confirmation");
|
|
||||||
ConnectPlus_GW.smsUDPclient.Send(sendBytes, sendBytes.Length, ConnectPlus_GW.cfg.ctrlIP, ConnectPlus_GW.cfg.smsPort);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, exc.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] PackSMS_with_addrs(string addrs, string msg_body, bool confirm)
|
|
||||||
{
|
|
||||||
int msg_len = msg_body.Length;
|
|
||||||
int addrs_len = addrs.Length;
|
|
||||||
|
|
||||||
if (msg_len > MAX_SMS_SIZE)
|
|
||||||
{
|
|
||||||
msg_len = MAX_SMS_SIZE;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Warning: SMS truncated to " + msg_len + " characters");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msg_len > msg_body.Length)
|
|
||||||
{
|
|
||||||
msg_body = msg_body.Remove(MAX_SMS_SIZE);
|
|
||||||
}
|
|
||||||
// compute the len
|
|
||||||
int len = msg_len + addrs_len;
|
|
||||||
|
|
||||||
len *= 2; // each character is encoded on 2B
|
|
||||||
len += 4; // this is for the headers
|
|
||||||
Byte[] data = new Byte[len + 2]; //+2 for the msg size
|
|
||||||
|
|
||||||
int msb = (len & 0xff00) >> 8;
|
|
||||||
data[0] = (byte)(msb & 0x00ff);
|
|
||||||
data[1] = (byte)(len & 0x00ff);
|
|
||||||
|
|
||||||
// put the headers
|
|
||||||
if (confirm)
|
|
||||||
{
|
|
||||||
data[2] = 0xe0; // first header
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data[2] = 0xa0; // first header
|
|
||||||
}
|
|
||||||
|
|
||||||
data[3] = (byte)(addrs_len * 2); // addr size
|
|
||||||
for (int i = 0; i < addrs_len; i++)
|
|
||||||
{
|
|
||||||
data[4 + i * 2] = (byte)addrs[i];
|
|
||||||
data[4 + i * 2 + 1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte lsb_id = (byte)(sms_seq_id & 0x1f);
|
|
||||||
data[4 + addrs_len * 2] = (byte)(0x80 | lsb_id);
|
|
||||||
byte msb_id = (byte)(sms_seq_id & 0x60); // keep bits 6:5
|
|
||||||
data[5 + addrs_len * 2] = (byte)(msb_id | 0x04);
|
|
||||||
|
|
||||||
for (int i = 0; i < msg_len; i++)
|
|
||||||
{
|
|
||||||
data[6 + i * 2 + addrs_len * 2] = (byte)msg_body[i];
|
|
||||||
data[6 + i * 2 + 1 + addrs_len * 2] = 0;
|
|
||||||
}
|
|
||||||
sms_seq_id++;
|
|
||||||
//Console.WriteLine("SMS packed: " + Utils.Byte2String(data, 0, data[1] + 2) + "\n\rSMS_SeQ_ID = " + sms_seq_id);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static byte[] Pack_TMS(string addrs)
|
|
||||||
{
|
|
||||||
int msg_len = 0;
|
|
||||||
int addrs_len = addrs.Length;
|
|
||||||
// compute the len
|
|
||||||
int len = msg_len + addrs_len;
|
|
||||||
|
|
||||||
len *= 2; // each character is encoded on 2B
|
|
||||||
len += 3; // this is for the headers
|
|
||||||
Byte[] data = new Byte[len + 2]; //+2 for the msg size
|
|
||||||
|
|
||||||
int msb = (len & 0xff00) >> 8;
|
|
||||||
data[0] = (byte)(msb & 0x00ff);
|
|
||||||
data[1] = (byte)(len & 0x00ff);
|
|
||||||
|
|
||||||
// put the headers
|
|
||||||
|
|
||||||
data[2] = 0xD0; // first header
|
|
||||||
|
|
||||||
data[3] = (byte)(addrs_len * 2); // addr size
|
|
||||||
for (int i = 0; i < addrs_len; i++)
|
|
||||||
{
|
|
||||||
data[4 + i * 2] = (byte)addrs[i];
|
|
||||||
data[4 + i * 2 + 1] = 0;
|
|
||||||
}
|
|
||||||
//second header
|
|
||||||
data[4 + addrs_len * 2] = 0x00;
|
|
||||||
|
|
||||||
//Console.WriteLine("SMS packed: " + Utils.Byte2String(data, 0, data[1] + 2) + "\n\rSMS_SeQ_ID = " + sms_seq_id);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MAX_SMS_SIZE = 120;
|
|
||||||
int MAX_ID_VAL = 100;
|
|
||||||
int sms_seq_id = 1;
|
|
||||||
Byte[] PackSMS(string msg_body, bool confirm)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Byte[] sendBytes = {
|
|
||||||
0x00 , 0x0E , // len
|
|
||||||
0xE0 , // header 1
|
|
||||||
0x00 , // addr size
|
|
||||||
0x88 , 0x04 , // header 2,3
|
|
||||||
0x41 , 0x00 , 0x64 , 0x00 , 0x67, 0x00 , 0x6A , 0x00, 0x6D , 0x00 //data
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
int msg_len = msg_body.Length;
|
|
||||||
if (msg_len > MAX_SMS_SIZE)
|
|
||||||
{
|
|
||||||
msg_len = MAX_SMS_SIZE;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Warning: SMS truncked to " + msg_len);
|
|
||||||
}
|
|
||||||
if (sms_seq_id > MAX_ID_VAL)
|
|
||||||
sms_seq_id = 1;
|
|
||||||
|
|
||||||
if (msg_len > msg_body.Length)
|
|
||||||
{
|
|
||||||
msg_body = msg_body.Remove(MAX_SMS_SIZE);
|
|
||||||
}
|
|
||||||
// compute the len
|
|
||||||
int len = msg_len;
|
|
||||||
|
|
||||||
len *= 2; // each character is encoded on 2B
|
|
||||||
len += 4; // this is for the headers
|
|
||||||
Byte[] data = new Byte[len + 2]; //+2 for the msg size
|
|
||||||
|
|
||||||
int msb = (len & 0xff00) >> 8;
|
|
||||||
data[0] = (byte)(msb & 0x00ff);
|
|
||||||
data[1] = (byte)(len & 0x00ff);
|
|
||||||
|
|
||||||
// put the headers
|
|
||||||
if (confirm)
|
|
||||||
{
|
|
||||||
data[2] = 0xe0; // first header
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data[2] = 0xa0; // first header
|
|
||||||
}
|
|
||||||
|
|
||||||
data[3] = 0x00; // addr size
|
|
||||||
|
|
||||||
byte lsb_id = (byte)(sms_seq_id & 0x1f);
|
|
||||||
data[4] = (byte)(0x80 | lsb_id);
|
|
||||||
byte msb_id = (byte)(sms_seq_id & 0x60); // keep bits 6:5
|
|
||||||
data[5] = (byte)(msb_id | 0x04);
|
|
||||||
|
|
||||||
for (int i = 0; i < msg_len; i++)
|
|
||||||
{
|
|
||||||
data[6 + i * 2] = (byte)msg_body[i];
|
|
||||||
data[6 + i * 2 + 1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sms_seq_id++;
|
|
||||||
//Console.WriteLine("SMS packed: " + LocationThread.Byte2String(data, 0, data[1] + 2) + "\n\rSMS_SeQ_ID = " + sms_seq_id);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,246 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Mail;
|
|
||||||
using System.Net;
|
|
||||||
using OpenPOP.POP3;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Net.Security;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
|
|
||||||
namespace ConsoleApplication1
|
|
||||||
{
|
|
||||||
public class EmailServerSSL
|
|
||||||
{
|
|
||||||
private POPClient popClient;
|
|
||||||
private string serverIP;
|
|
||||||
private int port;
|
|
||||||
private string loginNAme;
|
|
||||||
private string password;
|
|
||||||
|
|
||||||
//constructor
|
|
||||||
public EmailServerSSL(string _serverIP, string _port, string _logName, string _pass)
|
|
||||||
{
|
|
||||||
bool result = Int32.TryParse(_port, out port);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Email port not numeric, error in EmailServerSSL constructor.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
serverIP = _serverIP;
|
|
||||||
loginNAme = _logName;
|
|
||||||
password = _pass;
|
|
||||||
|
|
||||||
popClient = new POPClient();
|
|
||||||
popClient.AuthenticationBegan += new EventHandler(popClient_AuthenticationBegan);
|
|
||||||
popClient.AuthenticationFinished += new EventHandler(popClient_AuthenticationFinished);
|
|
||||||
popClient.CommunicationBegan += new EventHandler(popClient_CommunicationBegan);
|
|
||||||
popClient.CommunicationOccured += new EventHandler(popClient_CommunicationOccured);
|
|
||||||
popClient.CommunicationLost += new EventHandler(popClient_CommunicationLost);
|
|
||||||
popClient.MessageTransferBegan += new EventHandler(popClient_MessageTransferBegan);
|
|
||||||
popClient.MessageTransferFinished += new EventHandler(popClient_MessageTransferFinished);
|
|
||||||
}
|
|
||||||
#region popCLient events
|
|
||||||
private void AddEvent(string strEvent)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
lstEvents.Items.Add(strEvent);
|
|
||||||
lstEvents.SelectedIndex = lstEvents.Items.Count - 1;
|
|
||||||
*/
|
|
||||||
//Console.WriteLine("popClient event = " +strEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_CommunicationBegan(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("CommunicationBegan");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_CommunicationOccured(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("CommunicationOccured");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_AuthenticationBegan(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("AuthenticationBegan");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_AuthenticationFinished(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("AuthenticationFinished");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_MessageTransferBegan(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("MessageTransferBegan");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_MessageTransferFinished(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("MessageTransferFinished");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void popClient_CommunicationLost(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
AddEvent("CommunicationLost");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public ArrayList getEmails()
|
|
||||||
{
|
|
||||||
ArrayList ret = new ArrayList();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
popClient.IsUsingSsl = true;
|
|
||||||
popClient.Disconnect();
|
|
||||||
popClient.Connect(serverIP, port);
|
|
||||||
popClient.Authenticate(loginNAme, password);
|
|
||||||
|
|
||||||
|
|
||||||
int count = popClient.GetMessageCount();
|
|
||||||
Console.WriteLine("Got " + count + " emails");
|
|
||||||
|
|
||||||
for (int i = count; i >= 1; i -= 1)
|
|
||||||
{
|
|
||||||
OpenPOP.MIMEParser.Message email = popClient.GetMessage(i, false);
|
|
||||||
if (email != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
Console.WriteLine("-----------------------------------------------------------------");
|
|
||||||
Console.WriteLine("From: " + email.FromEmail);
|
|
||||||
if (email.TO.Length >= 0)
|
|
||||||
Console.WriteLine("To: " + email.TO[0]);
|
|
||||||
Console.WriteLine("Subject: " + email.Subject);
|
|
||||||
if (email.MessageBody.Count > 0)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Text: " + (string)email.MessageBody[email.MessageBody.Count - 1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
EmailtoSMS ets = processMessage(email.Subject, (string)email.MessageBody[email.MessageBody.Count - 1], email.FromEmail);
|
|
||||||
if ((ets.id != "") && (ets.text == ""))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Incorrect email body " + (string)email.MessageBody[email.MessageBody.Count - 1]);
|
|
||||||
}
|
|
||||||
else if ((ets.id != "") && (ets.text != ""))
|
|
||||||
{
|
|
||||||
popClient.DeleteMessage(i);
|
|
||||||
ret.Add(ets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("-----------------------------------------------------------------");
|
|
||||||
Console.WriteLine("BAD email");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
popClient.Disconnect();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("getEmails() from EmailServerSSL Exception: " + ex.Message + ex.ToString());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EmailtoSMS processMessage(string subj, string body, string from)
|
|
||||||
{
|
|
||||||
EmailtoSMS obj = new EmailtoSMS();
|
|
||||||
obj.from = from;
|
|
||||||
String s = subj.ToUpper();
|
|
||||||
if (s.Contains("ID[") && subj.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.id = s;
|
|
||||||
obj.id = obj.id.Remove(0, s.IndexOf("ID[") + 3);
|
|
||||||
obj.id = obj.id.Remove(obj.id.IndexOf("]"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.id.Length > 0)
|
|
||||||
{ // ID prezent in subject
|
|
||||||
s = body.ToUpper();
|
|
||||||
// SM.Debug("Email text:" + s.ToString() + " " + s.Contains("BODY[") + " " + body.Contains("]"));
|
|
||||||
if (s.Contains("BODY[") && body.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.text = body;
|
|
||||||
obj.text = obj.text.Remove(0, s.IndexOf("BODY[") + 5);
|
|
||||||
obj.text = obj.text.Remove(obj.text.IndexOf("]"));
|
|
||||||
if (obj.text.Length > 139)
|
|
||||||
obj.text = obj.text.Remove(140);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ //check for id in email body
|
|
||||||
s = body.ToUpper();
|
|
||||||
if (s.Contains("ID[") && s.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.id = body;
|
|
||||||
obj.id = obj.id.Remove(0, s.IndexOf("ID[") + 3);
|
|
||||||
obj.id = obj.id.Remove(obj.id.IndexOf("]"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.id.Length > 0)
|
|
||||||
{
|
|
||||||
s = body.ToUpper();
|
|
||||||
//SM.Debug("Email text2:" + s.ToString() + " " + s.Contains("BODY[") + " " + body.Contains("]"));
|
|
||||||
if (s.Contains("BODY[") && s.Contains("]"))
|
|
||||||
{
|
|
||||||
obj.text = body;
|
|
||||||
obj.text = obj.text.Remove(0, s.IndexOf("BODY[") + 5);
|
|
||||||
obj.text = obj.text.Remove(obj.text.IndexOf("]"));
|
|
||||||
if (obj.text.Length > 139)
|
|
||||||
obj.text = obj.text.Remove(140);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("ID: " + obj.id);
|
|
||||||
Console.WriteLine("Text: " + obj.text);
|
|
||||||
Console.WriteLine("-----------------------------------------------------------------");
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void sendEmail(string server, string _port, string user, string pass, MailMessage mailMessage, Boolean enableSSL)
|
|
||||||
{
|
|
||||||
int port = 0;
|
|
||||||
bool result = Int32.TryParse(_port, out port);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
|
|
||||||
SmtpClient mailClient = new SmtpClient();
|
|
||||||
mailClient.Host = server;
|
|
||||||
mailClient.Port = port;
|
|
||||||
NetworkCredential cred = new NetworkCredential(user, pass);
|
|
||||||
mailClient.Credentials = cred;
|
|
||||||
mailClient.EnableSsl = enableSSL;
|
|
||||||
//ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
|
|
||||||
mailClient.Send(mailMessage);
|
|
||||||
Console.WriteLine("------Sending email on " + server + " TO: " + mailMessage.To[0].ToString() + "--------------");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Email port not numeric, error in sendEmail.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EmailtoSMS
|
|
||||||
{
|
|
||||||
public String from;
|
|
||||||
public String id;
|
|
||||||
public String text;
|
|
||||||
|
|
||||||
public EmailtoSMS()
|
|
||||||
{
|
|
||||||
from = "";
|
|
||||||
id = "";
|
|
||||||
text = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,468 +0,0 @@
|
|||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
partial class SettingsForm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
|
||||||
this.buttonImmediate = new System.Windows.Forms.Button();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.numericRadioID = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.buttonTriggered = new System.Windows.Forms.Button();
|
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
|
||||||
this.numericInterval = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.cbLocationStop = new System.Windows.Forms.CheckBox();
|
|
||||||
this.cbCapacityPlus = new System.Windows.Forms.CheckBox();
|
|
||||||
this.btSave = new System.Windows.Forms.Button();
|
|
||||||
this.panel3 = new System.Windows.Forms.Panel();
|
|
||||||
this.dividerSoftware = new System.Windows.Forms.Panel();
|
|
||||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
|
||||||
this.tbRadioIP = new System.Windows.Forms.TextBox();
|
|
||||||
this.lbRadioIP = new System.Windows.Forms.Label();
|
|
||||||
this.npRadioID = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
|
||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
|
||||||
this.pictureBoxClose = new System.Windows.Forms.PictureBox();
|
|
||||||
this.npGwCode = new System.Windows.Forms.NumericUpDown();
|
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
|
||||||
this.panel2 = new System.Windows.Forms.Panel();
|
|
||||||
this.panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericRadioID)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericInterval)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.npRadioID)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxClose)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.npGwCode)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
this.panel1.BackgroundImage = global::MotoTRBO_SOC.Properties.Resources.bg;
|
|
||||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
|
||||||
this.panel1.Controls.Add(this.buttonImmediate);
|
|
||||||
this.panel1.Controls.Add(this.label1);
|
|
||||||
this.panel1.Controls.Add(this.numericRadioID);
|
|
||||||
this.panel1.Controls.Add(this.buttonTriggered);
|
|
||||||
this.panel1.Controls.Add(this.label4);
|
|
||||||
this.panel1.Controls.Add(this.numericInterval);
|
|
||||||
this.panel1.Controls.Add(this.cbLocationStop);
|
|
||||||
this.panel1.Controls.Add(this.cbCapacityPlus);
|
|
||||||
this.panel1.Controls.Add(this.btSave);
|
|
||||||
this.panel1.Controls.Add(this.panel3);
|
|
||||||
this.panel1.Controls.Add(this.dividerSoftware);
|
|
||||||
this.panel1.Controls.Add(this.pictureBox2);
|
|
||||||
this.panel1.Controls.Add(this.tbRadioIP);
|
|
||||||
this.panel1.Controls.Add(this.lbRadioIP);
|
|
||||||
this.panel1.Controls.Add(this.npRadioID);
|
|
||||||
this.panel1.Controls.Add(this.label3);
|
|
||||||
this.panel1.Controls.Add(this.pictureBox1);
|
|
||||||
this.panel1.Controls.Add(this.pictureBoxClose);
|
|
||||||
this.panel1.Controls.Add(this.npGwCode);
|
|
||||||
this.panel1.Controls.Add(this.label6);
|
|
||||||
this.panel1.Controls.Add(this.label2);
|
|
||||||
this.panel1.Controls.Add(this.panel2);
|
|
||||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.panel1.Location = new System.Drawing.Point(1, 1);
|
|
||||||
this.panel1.Name = "panel1";
|
|
||||||
this.panel1.Size = new System.Drawing.Size(330, 526);
|
|
||||||
this.panel1.TabIndex = 21;
|
|
||||||
this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// buttonImmediate
|
|
||||||
//
|
|
||||||
this.buttonImmediate.BackColor = System.Drawing.Color.DeepSkyBlue;
|
|
||||||
this.buttonImmediate.Font = new System.Drawing.Font("Calibri", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.buttonImmediate.ForeColor = System.Drawing.Color.Black;
|
|
||||||
this.buttonImmediate.Location = new System.Drawing.Point(180, 230);
|
|
||||||
this.buttonImmediate.Name = "buttonImmediate";
|
|
||||||
this.buttonImmediate.Size = new System.Drawing.Size(118, 47);
|
|
||||||
this.buttonImmediate.TabIndex = 39;
|
|
||||||
this.buttonImmediate.Text = "Immediate Location Request";
|
|
||||||
this.buttonImmediate.UseVisualStyleBackColor = false;
|
|
||||||
this.buttonImmediate.Click += new System.EventHandler(this.buttonImmediate_Click);
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label1.Font = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label1.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label1.Location = new System.Drawing.Point(25, 185);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(89, 18);
|
|
||||||
this.label1.TabIndex = 37;
|
|
||||||
this.label1.Text = "Subscriber ID";
|
|
||||||
//
|
|
||||||
// numericRadioID
|
|
||||||
//
|
|
||||||
this.numericRadioID.Location = new System.Drawing.Point(26, 204);
|
|
||||||
this.numericRadioID.Maximum = new decimal(new int[] {
|
|
||||||
16777215,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericRadioID.Minimum = new decimal(new int[] {
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericRadioID.Name = "numericRadioID";
|
|
||||||
this.numericRadioID.Size = new System.Drawing.Size(118, 20);
|
|
||||||
this.numericRadioID.TabIndex = 34;
|
|
||||||
this.numericRadioID.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
this.numericRadioID.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// buttonTriggered
|
|
||||||
//
|
|
||||||
this.buttonTriggered.BackColor = System.Drawing.Color.DeepSkyBlue;
|
|
||||||
this.buttonTriggered.Font = new System.Drawing.Font("Calibri", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.buttonTriggered.ForeColor = System.Drawing.Color.Black;
|
|
||||||
this.buttonTriggered.Location = new System.Drawing.Point(26, 230);
|
|
||||||
this.buttonTriggered.Name = "buttonTriggered";
|
|
||||||
this.buttonTriggered.Size = new System.Drawing.Size(118, 47);
|
|
||||||
this.buttonTriggered.TabIndex = 36;
|
|
||||||
this.buttonTriggered.Text = "Triggered Location Request";
|
|
||||||
this.buttonTriggered.UseVisualStyleBackColor = false;
|
|
||||||
this.buttonTriggered.Click += new System.EventHandler(this.buttonTriggered_Click);
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
this.label4.AutoSize = true;
|
|
||||||
this.label4.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label4.Font = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label4.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label4.Location = new System.Drawing.Point(179, 184);
|
|
||||||
this.label4.Name = "label4";
|
|
||||||
this.label4.Size = new System.Drawing.Size(120, 18);
|
|
||||||
this.label4.TabIndex = 38;
|
|
||||||
this.label4.Text = "Rep. Interval (sec)";
|
|
||||||
//
|
|
||||||
// numericInterval
|
|
||||||
//
|
|
||||||
this.numericInterval.Location = new System.Drawing.Point(180, 204);
|
|
||||||
this.numericInterval.Maximum = new decimal(new int[] {
|
|
||||||
1000,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericInterval.Minimum = new decimal(new int[] {
|
|
||||||
10,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.numericInterval.Name = "numericInterval";
|
|
||||||
this.numericInterval.Size = new System.Drawing.Size(118, 20);
|
|
||||||
this.numericInterval.TabIndex = 35;
|
|
||||||
this.numericInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
this.numericInterval.Value = new decimal(new int[] {
|
|
||||||
10,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// cbLocationStop
|
|
||||||
//
|
|
||||||
this.cbLocationStop.AutoSize = true;
|
|
||||||
this.cbLocationStop.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.cbLocationStop.Font = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.cbLocationStop.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbLocationStop.Location = new System.Drawing.Point(26, 153);
|
|
||||||
this.cbLocationStop.Name = "cbLocationStop";
|
|
||||||
this.cbLocationStop.Size = new System.Drawing.Size(230, 22);
|
|
||||||
this.cbLocationStop.TabIndex = 33;
|
|
||||||
this.cbLocationStop.Text = "Refresh Location Request on ARS";
|
|
||||||
this.cbLocationStop.UseVisualStyleBackColor = false;
|
|
||||||
//
|
|
||||||
// cbCapacityPlus
|
|
||||||
//
|
|
||||||
this.cbCapacityPlus.AutoSize = true;
|
|
||||||
this.cbCapacityPlus.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.cbCapacityPlus.Font = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.cbCapacityPlus.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.cbCapacityPlus.Location = new System.Drawing.Point(26, 352);
|
|
||||||
this.cbCapacityPlus.Name = "cbCapacityPlus";
|
|
||||||
this.cbCapacityPlus.Size = new System.Drawing.Size(121, 22);
|
|
||||||
this.cbCapacityPlus.TabIndex = 32;
|
|
||||||
this.cbCapacityPlus.Text = "CAPACITY PLUS";
|
|
||||||
this.cbCapacityPlus.UseVisualStyleBackColor = false;
|
|
||||||
this.cbCapacityPlus.CheckedChanged += new System.EventHandler(this.cbCapacityPlus_CheckedChanged);
|
|
||||||
//
|
|
||||||
// btSave
|
|
||||||
//
|
|
||||||
this.btSave.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
|
||||||
this.btSave.BackColor = System.Drawing.Color.DeepSkyBlue;
|
|
||||||
this.btSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.btSave.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.btSave.ForeColor = System.Drawing.Color.Black;
|
|
||||||
this.btSave.Location = new System.Drawing.Point(95, 473);
|
|
||||||
this.btSave.Name = "btSave";
|
|
||||||
this.btSave.Size = new System.Drawing.Size(141, 39);
|
|
||||||
this.btSave.TabIndex = 31;
|
|
||||||
this.btSave.Text = "Save Settings";
|
|
||||||
this.btSave.UseVisualStyleBackColor = false;
|
|
||||||
this.btSave.Click += new System.EventHandler(this.btSave_Click);
|
|
||||||
//
|
|
||||||
// panel3
|
|
||||||
//
|
|
||||||
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.panel3.BackColor = System.Drawing.Color.DeepSkyBlue;
|
|
||||||
this.panel3.Location = new System.Drawing.Point(16, 86);
|
|
||||||
this.panel3.Name = "panel3";
|
|
||||||
this.panel3.Size = new System.Drawing.Size(301, 3);
|
|
||||||
this.panel3.TabIndex = 30;
|
|
||||||
//
|
|
||||||
// dividerSoftware
|
|
||||||
//
|
|
||||||
this.dividerSoftware.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.dividerSoftware.BackColor = System.Drawing.Color.DeepSkyBlue;
|
|
||||||
this.dividerSoftware.Location = new System.Drawing.Point(16, 342);
|
|
||||||
this.dividerSoftware.Name = "dividerSoftware";
|
|
||||||
this.dividerSoftware.Size = new System.Drawing.Size(301, 3);
|
|
||||||
this.dividerSoftware.TabIndex = 29;
|
|
||||||
//
|
|
||||||
// pictureBox2
|
|
||||||
//
|
|
||||||
this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBox2.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
||||||
this.pictureBox2.Image = global::MotoTRBO_SOC.Properties.Resources.i_gw;
|
|
||||||
this.pictureBox2.Location = new System.Drawing.Point(26, 54);
|
|
||||||
this.pictureBox2.Name = "pictureBox2";
|
|
||||||
this.pictureBox2.Size = new System.Drawing.Size(39, 29);
|
|
||||||
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBox2.TabIndex = 27;
|
|
||||||
this.pictureBox2.TabStop = false;
|
|
||||||
this.pictureBox2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// tbRadioIP
|
|
||||||
//
|
|
||||||
this.tbRadioIP.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.tbRadioIP.Location = new System.Drawing.Point(180, 407);
|
|
||||||
this.tbRadioIP.Name = "tbRadioIP";
|
|
||||||
this.tbRadioIP.Size = new System.Drawing.Size(118, 24);
|
|
||||||
this.tbRadioIP.TabIndex = 26;
|
|
||||||
this.tbRadioIP.Text = "192.168.10.1";
|
|
||||||
this.tbRadioIP.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
this.tbRadioIP.TextChanged += new System.EventHandler(this.tbRadioIP_TextChanged);
|
|
||||||
//
|
|
||||||
// lbRadioIP
|
|
||||||
//
|
|
||||||
this.lbRadioIP.AutoSize = true;
|
|
||||||
this.lbRadioIP.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.lbRadioIP.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.lbRadioIP.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.lbRadioIP.Location = new System.Drawing.Point(176, 385);
|
|
||||||
this.lbRadioIP.Name = "lbRadioIP";
|
|
||||||
this.lbRadioIP.Size = new System.Drawing.Size(70, 19);
|
|
||||||
this.lbRadioIP.TabIndex = 25;
|
|
||||||
this.lbRadioIP.Text = "RADIO IP";
|
|
||||||
this.lbRadioIP.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// npRadioID
|
|
||||||
//
|
|
||||||
this.npRadioID.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.npRadioID.ForeColor = System.Drawing.SystemColors.WindowText;
|
|
||||||
this.npRadioID.Location = new System.Drawing.Point(26, 407);
|
|
||||||
this.npRadioID.Maximum = new decimal(new int[] {
|
|
||||||
16777215,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.npRadioID.Minimum = new decimal(new int[] {
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.npRadioID.Name = "npRadioID";
|
|
||||||
this.npRadioID.Size = new System.Drawing.Size(118, 24);
|
|
||||||
this.npRadioID.TabIndex = 24;
|
|
||||||
this.npRadioID.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
this.npRadioID.Value = new decimal(new int[] {
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
this.label3.AutoSize = true;
|
|
||||||
this.label3.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label3.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label3.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label3.Location = new System.Drawing.Point(22, 385);
|
|
||||||
this.label3.Name = "label3";
|
|
||||||
this.label3.Size = new System.Drawing.Size(71, 19);
|
|
||||||
this.label3.TabIndex = 23;
|
|
||||||
this.label3.Text = "RADIO ID";
|
|
||||||
this.label3.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// pictureBox1
|
|
||||||
//
|
|
||||||
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
||||||
this.pictureBox1.Image = global::MotoTRBO_SOC.Properties.Resources.i_dm;
|
|
||||||
this.pictureBox1.Location = new System.Drawing.Point(26, 307);
|
|
||||||
this.pictureBox1.Name = "pictureBox1";
|
|
||||||
this.pictureBox1.Size = new System.Drawing.Size(60, 29);
|
|
||||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBox1.TabIndex = 22;
|
|
||||||
this.pictureBox1.TabStop = false;
|
|
||||||
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// pictureBoxClose
|
|
||||||
//
|
|
||||||
this.pictureBoxClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.pictureBoxClose.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.pictureBoxClose.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
||||||
this.pictureBoxClose.Image = global::MotoTRBO_SOC.Properties.Resources.close;
|
|
||||||
this.pictureBoxClose.Location = new System.Drawing.Point(307, 3);
|
|
||||||
this.pictureBoxClose.Name = "pictureBoxClose";
|
|
||||||
this.pictureBoxClose.Size = new System.Drawing.Size(20, 22);
|
|
||||||
this.pictureBoxClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
|
||||||
this.pictureBoxClose.TabIndex = 21;
|
|
||||||
this.pictureBoxClose.TabStop = false;
|
|
||||||
this.pictureBoxClose.Click += new System.EventHandler(this.pictureBoxClose_Click);
|
|
||||||
//
|
|
||||||
// npGwCode
|
|
||||||
//
|
|
||||||
this.npGwCode.Font = new System.Drawing.Font("Calibri", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.npGwCode.ForeColor = System.Drawing.SystemColors.WindowText;
|
|
||||||
this.npGwCode.Location = new System.Drawing.Point(26, 115);
|
|
||||||
this.npGwCode.Maximum = new decimal(new int[] {
|
|
||||||
900000,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.npGwCode.Minimum = new decimal(new int[] {
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
this.npGwCode.Name = "npGwCode";
|
|
||||||
this.npGwCode.Size = new System.Drawing.Size(118, 24);
|
|
||||||
this.npGwCode.TabIndex = 20;
|
|
||||||
this.npGwCode.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
||||||
this.npGwCode.Value = new decimal(new int[] {
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// label6
|
|
||||||
//
|
|
||||||
this.label6.AutoSize = true;
|
|
||||||
this.label6.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label6.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label6.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label6.Location = new System.Drawing.Point(22, 93);
|
|
||||||
this.label6.Name = "label6";
|
|
||||||
this.label6.Size = new System.Drawing.Size(116, 19);
|
|
||||||
this.label6.TabIndex = 16;
|
|
||||||
this.label6.Text = "GATEWAY CODE";
|
|
||||||
this.label6.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
this.label2.AutoSize = true;
|
|
||||||
this.label2.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.label2.Font = new System.Drawing.Font("Calibri", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
||||||
this.label2.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.label2.Location = new System.Drawing.Point(12, 14);
|
|
||||||
this.label2.Name = "label2";
|
|
||||||
this.label2.Size = new System.Drawing.Size(108, 29);
|
|
||||||
this.label2.TabIndex = 1;
|
|
||||||
this.label2.Text = "SETTINGS";
|
|
||||||
this.label2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
//
|
|
||||||
// panel2
|
|
||||||
//
|
|
||||||
this.panel2.BackColor = System.Drawing.Color.DeepSkyBlue;
|
|
||||||
this.panel2.Location = new System.Drawing.Point(0, 13);
|
|
||||||
this.panel2.Name = "panel2";
|
|
||||||
this.panel2.Size = new System.Drawing.Size(9, 31);
|
|
||||||
this.panel2.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// SettingsForm
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.BackColor = System.Drawing.Color.DarkGray;
|
|
||||||
this.ClientSize = new System.Drawing.Size(332, 528);
|
|
||||||
this.Controls.Add(this.panel1);
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
|
||||||
this.Name = "SettingsForm";
|
|
||||||
this.Padding = new System.Windows.Forms.Padding(1);
|
|
||||||
this.Text = "Settings";
|
|
||||||
this.Load += new System.EventHandler(this.SettingsForm_Load);
|
|
||||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SettingsForm_MouseMove);
|
|
||||||
this.panel1.ResumeLayout(false);
|
|
||||||
this.panel1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericRadioID)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericInterval)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.npRadioID)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxClose)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.npGwCode)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.Label label6;
|
|
||||||
private System.Windows.Forms.NumericUpDown npGwCode;
|
|
||||||
private System.Windows.Forms.Panel panel1;
|
|
||||||
private System.Windows.Forms.Label label2;
|
|
||||||
private System.Windows.Forms.Panel panel2;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBox1;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBoxClose;
|
|
||||||
private System.Windows.Forms.Label lbRadioIP;
|
|
||||||
private System.Windows.Forms.NumericUpDown npRadioID;
|
|
||||||
private System.Windows.Forms.Label label3;
|
|
||||||
private System.Windows.Forms.PictureBox pictureBox2;
|
|
||||||
private System.Windows.Forms.TextBox tbRadioIP;
|
|
||||||
private System.Windows.Forms.Panel panel3;
|
|
||||||
private System.Windows.Forms.Panel dividerSoftware;
|
|
||||||
private System.Windows.Forms.Button btSave;
|
|
||||||
private System.Windows.Forms.CheckBox cbCapacityPlus;
|
|
||||||
private System.Windows.Forms.CheckBox cbLocationStop;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private System.Windows.Forms.NumericUpDown numericRadioID;
|
|
||||||
private System.Windows.Forms.Button buttonTriggered;
|
|
||||||
private System.Windows.Forms.Label label4;
|
|
||||||
private System.Windows.Forms.NumericUpDown numericInterval;
|
|
||||||
private System.Windows.Forms.Button buttonImmediate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using Nini.Config;
|
|
||||||
using System.Collections;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace PAL_SOC
|
|
||||||
{
|
|
||||||
public class Config
|
|
||||||
{
|
|
||||||
private IConfigSource source = null;
|
|
||||||
private string CFG_FILE = "config.ini";
|
|
||||||
|
|
||||||
public string gatewayID;
|
|
||||||
public int locPort;
|
|
||||||
|
|
||||||
public string SERVER;
|
|
||||||
public string DATABASE;
|
|
||||||
public string UID;
|
|
||||||
public string PASSWORD;
|
|
||||||
public bool db_active;
|
|
||||||
|
|
||||||
public int debug_port;
|
|
||||||
|
|
||||||
//email service for alerts
|
|
||||||
public string alert_smtpServer = "";
|
|
||||||
public string alert_pop3Server = "";
|
|
||||||
public string alert_pop3Port = "";
|
|
||||||
public string alert_smtpPort = "";
|
|
||||||
public bool alert_sslState = false;
|
|
||||||
public string alert_user, alert_psw;
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList ar_radioIPs = new ArrayList();
|
|
||||||
|
|
||||||
public Config(string CFG_FILE = "config.ini")
|
|
||||||
{
|
|
||||||
LoadConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadConfig()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
source = new IniConfigSource(CFG_FILE);
|
|
||||||
|
|
||||||
gatewayID = source.Configs["GATEWAY"].Get("id");
|
|
||||||
locPort = Convert.ToInt32(source.Configs["GATEWAY"].Get("port"));
|
|
||||||
|
|
||||||
//MySQL connection info (for SMS)
|
|
||||||
SERVER = source.Configs["MySQL"].Get("SERVER");
|
|
||||||
DATABASE = source.Configs["MySQL"].Get("DATABASE");
|
|
||||||
UID = source.Configs["MySQL"].Get("UID");
|
|
||||||
PASSWORD = source.Configs["MySQL"].Get("PASSWORD");
|
|
||||||
|
|
||||||
db_active = Convert.ToBoolean(source.Configs["MySQL"].Get("active"));
|
|
||||||
|
|
||||||
//debug port is GWID with the first digit replage by 3. ex: 95001 -> 35001
|
|
||||||
string str_debug_port = "3" + gatewayID.Substring(1);
|
|
||||||
debug_port = Int32.Parse(str_debug_port);
|
|
||||||
|
|
||||||
//for alerts
|
|
||||||
alert_pop3Server = source.Configs["EmailServiceAlerts"].Get("Pop3Server");
|
|
||||||
alert_smtpServer = source.Configs["EmailServiceAlerts"].Get("SmtpServer");
|
|
||||||
alert_pop3Port = source.Configs["EmailServiceAlerts"].Get("Pop3Port");
|
|
||||||
alert_smtpPort = source.Configs["EmailServiceAlerts"].Get("SmtpPort");
|
|
||||||
alert_sslState = Convert.ToBoolean(source.Configs["EmailServiceAlerts"].Get("EnableSSL"));
|
|
||||||
alert_user = source.Configs["EmailServiceAlerts"].Get("User");
|
|
||||||
alert_psw = source.Configs["EmailServiceAlerts"].Get("Pass");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "LoadSetup() Exception: " + ex.ToString());
|
|
||||||
}
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.CTRL, "LoadSetup file OK !");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,214 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Net;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace ConsoleApplication1
|
|
||||||
{
|
|
||||||
public class UdpMulticast
|
|
||||||
{
|
|
||||||
private Socket s;
|
|
||||||
private Thread listenThread;
|
|
||||||
private string mcastGroup;
|
|
||||||
private int port;
|
|
||||||
|
|
||||||
public UdpMulticast(string mcastGroup, int port)
|
|
||||||
{
|
|
||||||
this.mcastGroup = mcastGroup;
|
|
||||||
this.port = port;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Listen()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
byte[] b = new byte[1024];
|
|
||||||
Thread.Sleep(1);
|
|
||||||
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[] decByte = Encryption.Decrypt(tmp);
|
|
||||||
if (this.OnNewDataRecv != null)
|
|
||||||
this.OnNewDataRecv(decByte, decByte.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s == null)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ThreadAbortException)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
|
|
||||||
SM.Debug("UdpMulticast.cs->Listen" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Listen_Decoded()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
byte[] b = new byte[1024];
|
|
||||||
Thread.Sleep(1);
|
|
||||||
int recv = s.Receive(b);
|
|
||||||
if (OnNewDataRecv != null)
|
|
||||||
{
|
|
||||||
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 (s == null)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ThreadAbortException)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
SM.Debug("UdpMulticast.cs->Listen" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void newData4Send(byte[] data, int dataLen);
|
|
||||||
public event newData4Send OnNewDataRecv;
|
|
||||||
|
|
||||||
public bool StartListen()
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (s == null)
|
|
||||||
{
|
|
||||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
|
||||||
}
|
|
||||||
if (s != null)
|
|
||||||
{
|
|
||||||
Console.WriteLine("PORT multi cast :" + port);
|
|
||||||
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, port);
|
|
||||||
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
|
|
||||||
s.Bind(ipep);
|
|
||||||
IPAddress ip = IPAddress.Parse(mcastGroup);
|
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, IPAddress.Any));
|
|
||||||
s.SetSocketOption(SocketOptionLevel.IP,
|
|
||||||
SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
|
||||||
listenThread = new Thread(new ThreadStart(Listen));
|
|
||||||
listenThread.IsBackground = true;
|
|
||||||
}
|
|
||||||
if (listenThread != null)
|
|
||||||
listenThread.Start();
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
SM.Debug("Ex:" + ex.ToString());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool StartListen_Decoded()
|
|
||||||
{
|
|
||||||
bool ret = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (s == null)
|
|
||||||
{
|
|
||||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
|
||||||
}
|
|
||||||
if (s != null)
|
|
||||||
{
|
|
||||||
Console.WriteLine("PORT multi cast :" + port);
|
|
||||||
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, port);
|
|
||||||
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
|
|
||||||
s.Bind(ipep);
|
|
||||||
IPAddress ip = IPAddress.Parse(mcastGroup);
|
|
||||||
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip, IPAddress.Any));
|
|
||||||
s.SetSocketOption(SocketOptionLevel.IP,
|
|
||||||
SocketOptionName.MulticastTimeToLive, int.Parse("1"));
|
|
||||||
listenThread = new Thread(new ThreadStart(Listen_Decoded));
|
|
||||||
listenThread.IsBackground = true;
|
|
||||||
}
|
|
||||||
if (listenThread != null)
|
|
||||||
listenThread.Start();
|
|
||||||
ret = true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
SM.Debug("Ex:" + ex.ToString());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StopListen()
|
|
||||||
{
|
|
||||||
if (listenThread != null)
|
|
||||||
{
|
|
||||||
if (listenThread.IsAlive)
|
|
||||||
{
|
|
||||||
listenThread.Abort();
|
|
||||||
listenThread = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (s != null)
|
|
||||||
{
|
|
||||||
s.Close();
|
|
||||||
s = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Send(byte[] data, int len)
|
|
||||||
{
|
|
||||||
if (s == null)
|
|
||||||
{
|
|
||||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s != null)
|
|
||||||
{
|
|
||||||
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(mcastGroup), port);
|
|
||||||
byte[] encByte = Encryption.Encrypt(data);
|
|
||||||
s.SendTo(encByte, encByte.Length, SocketFlags.None, ipep);
|
|
||||||
}
|
|
||||||
else SM.Debug("s is NULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Send_decoded(byte[] data, int len)
|
|
||||||
{
|
|
||||||
if (s == null)
|
|
||||||
{
|
|
||||||
s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s != null)
|
|
||||||
{
|
|
||||||
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(mcastGroup), port);
|
|
||||||
s.SendTo(data, data.Length, SocketFlags.None, ipep);
|
|
||||||
}
|
|
||||||
else SM.Debug("s is NULL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 9.4 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<system.data>
|
|
||||||
<DbProviderFactories>
|
|
||||||
<remove invariant="MySql.Data.MySqlClient" />
|
|
||||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
|
||||||
</DbProviderFactories>
|
|
||||||
</system.data>
|
|
||||||
</configuration>
|
|
@ -1,150 +0,0 @@
|
|||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
|
|
||||||
using System.Threading;
|
|
||||||
using SafeNetLib;
|
|
||||||
|
|
||||||
namespace MotoTRBO_SOC
|
|
||||||
{
|
|
||||||
|
|
||||||
public class SendSMSThread
|
|
||||||
{
|
|
||||||
|
|
||||||
int remoteSMSport;
|
|
||||||
public SendSMSThread(int p_remoteSMSport)
|
|
||||||
{
|
|
||||||
remoteSMSport = p_remoteSMSport;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleConnection()
|
|
||||||
{
|
|
||||||
while (MotoTRBO_GW.running)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//MotoTRBOcmdMsg msg = MotoTRBOGW.locationQueue.GetItem(100);
|
|
||||||
SMSmsg msg = SN_Queues.sendSMSQueue.GetItem(-1);//block until message is in queue
|
|
||||||
SendSMSmsg(msg);
|
|
||||||
if (msg.req_conf)
|
|
||||||
{
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "Requesting SMS Confirmation!!!!");
|
|
||||||
lock (SN_Queues.waitConfSMSList.SyncRoot)
|
|
||||||
{
|
|
||||||
msg.seq_no = this.sms_seq_id - 1;//-1 because was alraedy incremented for next id
|
|
||||||
msg.waitConfSMSList_time = DateTime.Now;
|
|
||||||
|
|
||||||
SN_Queues.waitConfSMSList.Add(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Thread.Sleep(1200);//minimum interval between SMS as per MotoTRBO specs
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, "Exception in OC4JconnThread:HandleConnection(): \r\n\tData=" +
|
|
||||||
ex.Data + "\r\n\tSource=" +
|
|
||||||
ex.Source + "\r\n\tStackTrace=" +
|
|
||||||
ex.StackTrace + "\r\n\tMessage=" +
|
|
||||||
ex.Message + "\r\n\tInnerException=" +
|
|
||||||
ex.InnerException);
|
|
||||||
}
|
|
||||||
} // end while (true)
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SendSMSmsg(SMSmsg p_msg)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Byte[] sendBytes = PackSMS(p_msg.msg, p_msg.req_conf);
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "««« SMS [" + p_msg.msg + "] to " + p_msg.suid);
|
|
||||||
MotoTRBO_GW.smsUDPclient.Send(sendBytes, sendBytes.Length, (new RadioID2IP("12", p_msg.suid)).GetIP(), remoteSMSport);
|
|
||||||
|
|
||||||
if(OnSMSSent != null)
|
|
||||||
OnSMSSent(p_msg.msg, p_msg.suid);
|
|
||||||
// update into database
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception exc)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.always, exc.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MAX_SMS_SIZE = 120;
|
|
||||||
int MAX_ID_VAL = 100;
|
|
||||||
int sms_seq_id = 1;
|
|
||||||
Byte[] PackSMS(string msg_body, bool confirm)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Byte[] sendBytes = {
|
|
||||||
0x00 , 0x0E , // len
|
|
||||||
0xE0 , // header 1
|
|
||||||
0x00 , // addr size
|
|
||||||
0x88 , 0x04 , // header 2,3
|
|
||||||
0x41 , 0x00 , 0x64 , 0x00 , 0x67, 0x00 , 0x6A , 0x00, 0x6D , 0x00 //data
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
int msg_len = msg_body.Length;
|
|
||||||
if (msg_len > MAX_SMS_SIZE)
|
|
||||||
{
|
|
||||||
msg_len = MAX_SMS_SIZE;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.SMS, "Warning: SMS truncked to " + msg_len);
|
|
||||||
}
|
|
||||||
if (sms_seq_id > MAX_ID_VAL)
|
|
||||||
sms_seq_id = 1;
|
|
||||||
|
|
||||||
if (msg_len > msg_body.Length)
|
|
||||||
{
|
|
||||||
msg_body = msg_body.Remove(MAX_SMS_SIZE);
|
|
||||||
}
|
|
||||||
// compute the len
|
|
||||||
int len = msg_len;
|
|
||||||
|
|
||||||
len *= 2; // each character is encoded on 2B
|
|
||||||
len += 4; // this is for the headers
|
|
||||||
Byte[] data = new Byte[len + 2]; //+2 for the msg size
|
|
||||||
|
|
||||||
int msb = (len & 0xff00) >> 8;
|
|
||||||
data[0] = (byte)(msb & 0x00ff);
|
|
||||||
data[1] = (byte)(len & 0x00ff);
|
|
||||||
|
|
||||||
// put the headers
|
|
||||||
if (confirm)
|
|
||||||
{
|
|
||||||
data[2] = 0xe0; // first header
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
data[2] = 0xa0; // first header
|
|
||||||
}
|
|
||||||
|
|
||||||
data[3] = 0x00; // addr size
|
|
||||||
|
|
||||||
byte lsb_id = (byte)(sms_seq_id & 0x1f);
|
|
||||||
data[4] = (byte)(0x80 | lsb_id);
|
|
||||||
byte msb_id = (byte)(sms_seq_id & 0x60); // keep bits 6:5
|
|
||||||
data[5] = (byte)(msb_id | 0x04);
|
|
||||||
|
|
||||||
for (int i = 0; i < msg_len; i++)
|
|
||||||
{
|
|
||||||
data[6 + i * 2] = (byte)msg_body[i];
|
|
||||||
data[6 + i * 2 + 1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sms_seq_id++;
|
|
||||||
//Utils.ConsWrite(DebugMSG_Type.SMS, "SMS packed: " + LocationThread.Byte2String(data, 0, data[1] + 2) + "\n\rSMS_SeQ_ID = " + sms_seq_id);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void SMSSentDEl(String message, String radioID);
|
|
||||||
public event SMSSentDEl OnSMSSent;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
<h2>SafeNET™</h2>
|
|
||||||
|
|
||||||
SafeNET™ is SafeMobile’s affordable, entirely web-based, solution to all fleet management needs. From anywhere in the world with an internet connected PC, fleet managers are able to effectively manage and monitor their two-way radio or Cellular-based, GPS-equipped mobile workforce. When used in conjunction with a DMR or Tetra Radio system, SafeNET™ provides you with invaluable tools to maximize efficiency, achieve seamless communication and analyze critical data via key reports.
|
|
@ -1,107 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using SafeNetLib;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace ConnectPlus_SOC
|
|
||||||
{
|
|
||||||
class TestGPS
|
|
||||||
{
|
|
||||||
private int freq; // in seconds
|
|
||||||
private double latStart;
|
|
||||||
private double lngStart;
|
|
||||||
private static System.Threading.Timer tSim;
|
|
||||||
private DateTime gpsTime;
|
|
||||||
|
|
||||||
public TestGPS(int _freq, double _latStart, double _lngStart)
|
|
||||||
{
|
|
||||||
freq = _freq;
|
|
||||||
latStart = _latStart;
|
|
||||||
lngStart = _lngStart;
|
|
||||||
gpsTime = DateTime.UtcNow;
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (int i = 0; i < 100; i++)
|
|
||||||
{
|
|
||||||
GPSpos pos = getLocation(lngStart, latStart, 30000);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
tSim = new System.Threading.Timer(Sim_callback, null, new TimeSpan(0, 0, 5), new TimeSpan(0, 0, freq));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Sim_callback(Object state)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
gpsTime = DateTime.UtcNow;
|
|
||||||
foreach (DictionaryEntry entry in SN_Queues.ht_SUInfo)
|
|
||||||
{
|
|
||||||
SUinfo su = (SUinfo)entry.Value;
|
|
||||||
GPSpos pos = getLocation(lngStart, latStart, 30000);
|
|
||||||
|
|
||||||
htCell_t cell = new htCell_t();
|
|
||||||
|
|
||||||
cell.lat = pos.lat.ToString();
|
|
||||||
cell.d_lat = pos.lat;
|
|
||||||
cell.lng = pos.lng.ToString();
|
|
||||||
cell.d_lng = pos.lng;
|
|
||||||
cell.di = "0";
|
|
||||||
cell.suid = su.suid;
|
|
||||||
cell.location_time = gpsTime;
|
|
||||||
cell.activity_time = gpsTime;
|
|
||||||
cell.triggered = true;
|
|
||||||
cell.spd = "50";
|
|
||||||
|
|
||||||
SN_Queues.DBQueueLocation.PostItem(cell);
|
|
||||||
//LOGS.LOG(ConnectPlus_GW.cfg.gw_id + cell.suid + " Trig GPS<lat:" + cell.lat + "><lng:" + cell.lng + ">");
|
|
||||||
//su.suid;
|
|
||||||
//Console.WriteLine("{0}, {1}", entry.Key, entry.Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.test, "Sim_callback errot : " + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//r is in meters
|
|
||||||
public GPSpos getLocation(double x0, double y0, int radius)
|
|
||||||
{
|
|
||||||
Random random = new Random();
|
|
||||||
|
|
||||||
// Convert radius from meters to degrees
|
|
||||||
double radiusInDegrees = radius / 111000f;
|
|
||||||
|
|
||||||
double u = random.NextDouble();
|
|
||||||
double v = random.NextDouble();
|
|
||||||
Thread.Sleep(10);
|
|
||||||
double w = radiusInDegrees * Math.Sqrt(u);
|
|
||||||
double t = 2 * Math.PI * v;
|
|
||||||
double x = w * Math.Cos(t);
|
|
||||||
double y = w * Math.Sin(t);
|
|
||||||
|
|
||||||
// Adjust the x-coordinate for the shrinking of the east-west distances
|
|
||||||
double new_x = x / Math.Cos(y0);
|
|
||||||
|
|
||||||
double foundLongitude = new_x + x0;
|
|
||||||
double foundLatitude = y + y0;
|
|
||||||
Utils.ConsWrite(DebugMSG_Type.test, "Longitude: " + foundLongitude + " Latitude: " + foundLatitude);
|
|
||||||
|
|
||||||
GPSpos pos = new GPSpos();
|
|
||||||
pos.lat = foundLatitude;
|
|
||||||
pos.lng = foundLongitude;
|
|
||||||
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GPSpos
|
|
||||||
{
|
|
||||||
public double lat;
|
|
||||||
public double lng;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace MotoRepeater
|
|
||||||
{
|
|
||||||
static class TallysmanConfirm
|
|
||||||
{
|
|
||||||
private static Dictionary<int, String> toBeConfirmed = new Dictionary<int, String>();
|
|
||||||
private static int index;
|
|
||||||
|
|
||||||
static TallysmanConfirm()
|
|
||||||
{
|
|
||||||
index = 65534;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int addToConfirmationQueue(String seq_idFromSD)
|
|
||||||
{
|
|
||||||
lock (toBeConfirmed)
|
|
||||||
{
|
|
||||||
if (!toBeConfirmed.ContainsKey(index))
|
|
||||||
{
|
|
||||||
toBeConfirmed.Add(index, seq_idFromSD);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toBeConfirmed[index] = seq_idFromSD;
|
|
||||||
}
|
|
||||||
if (index < 65535)
|
|
||||||
{
|
|
||||||
index++;
|
|
||||||
return index - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
index = 1;
|
|
||||||
return 65535;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getFromConfirmationQueue(int index)
|
|
||||||
{
|
|
||||||
String toReturn;
|
|
||||||
lock (toBeConfirmed)
|
|
||||||
{
|
|
||||||
if (toBeConfirmed.ContainsKey(index))
|
|
||||||
{
|
|
||||||
toReturn = toBeConfirmed[index];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toReturn = "";
|
|
||||||
}
|
|
||||||
return toReturn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace SN_Server.ServerMSGS
|
|
||||||
{
|
|
||||||
public class SM_IPList
|
|
||||||
{
|
|
||||||
private ServerMSG _sm;
|
|
||||||
public List<ServerIdent> ipList;
|
|
||||||
|
|
||||||
public SM_IPList(ServerMSG sm)
|
|
||||||
{
|
|
||||||
_sm = sm;
|
|
||||||
ipList = new List<ServerIdent>();
|
|
||||||
DecodePayload(sm.Payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DecodePayload(string paylaod)
|
|
||||||
{
|
|
||||||
string[] temp = paylaod.Split('/');
|
|
||||||
foreach (string ident in temp)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Got new serverIdent:" + ident);
|
|
||||||
ServerIdent si = new ServerIdent(ident);
|
|
||||||
ipList.Add(si);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] GenRequestMsg()
|
|
||||||
{
|
|
||||||
string msg = ServerMSG.GenMsg(0x0005, ServerConnector.serialNr, "");
|
|
||||||
return System.Text.Encoding.ASCII.GetBytes(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,218 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Hytera_SOC
|
|
||||||
{
|
|
||||||
class GPSconvertor
|
|
||||||
{
|
|
||||||
public string GPSmsg_str = "";
|
|
||||||
public GPSconvertor(int radioID, byte[] pbPayload, int size, int start, int poll, string gw_id)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int idx = start;
|
|
||||||
|
|
||||||
//gps status Data valid bit(A/V)
|
|
||||||
char gps_status = (char)pbPayload[idx];
|
|
||||||
Console.WriteLine("gps_status: {0}", gps_status);
|
|
||||||
idx++;
|
|
||||||
//gps time Greenwich time,Hour/minute/second occupy 2bytes each
|
|
||||||
int gps_h = (pbPayload[idx] - 0x30) * 10 + (pbPayload[idx + 1] - 0x30);
|
|
||||||
idx += 2;
|
|
||||||
int gps_m = (pbPayload[idx] - 0x30) * 10 + (pbPayload[idx + 1] - 0x30);
|
|
||||||
idx += 2;
|
|
||||||
int gps_s = (pbPayload[idx] - 0x30) * 10 + (pbPayload[idx + 1] - 0x30);
|
|
||||||
idx += 2;
|
|
||||||
//Console.WriteLine("time {0}:{1}:{2}", gps_h, gps_m, gps_s);
|
|
||||||
//gps date Day/month/year occupy 2 bytes each,
|
|
||||||
int gps_d = (pbPayload[idx] - 0x30) * 10 + (pbPayload[idx + 1] - 0x30);
|
|
||||||
idx += 2;
|
|
||||||
int gps_mon = (pbPayload[idx] - 0x30) * 10 + (pbPayload[idx + 1] - 0x30);
|
|
||||||
idx += 2;
|
|
||||||
int gps_y = (pbPayload[idx] - 0x30) * 10 + (pbPayload[idx + 1] - 0x30);
|
|
||||||
idx += 2;
|
|
||||||
//Console.WriteLine("date {0}/{1}/{2}", gps_d, gps_mon, gps_y);
|
|
||||||
//gps northsouth N:North S:South
|
|
||||||
string gps_northsouth = ((char)pbPayload[idx]).ToString();
|
|
||||||
idx++;
|
|
||||||
//std::cout<<"gps_northsouth:"<<gps_northsouth<<endl;
|
|
||||||
//gps latitude Latitude Format: DDFF.FFFF
|
|
||||||
string lat = "";
|
|
||||||
for (int i = 0; i < 9; i++)
|
|
||||||
{
|
|
||||||
lat += ((char)pbPayload[idx + i]).ToString();
|
|
||||||
}
|
|
||||||
idx += 9;
|
|
||||||
//_cprintf("gps latitude: \n",lat);
|
|
||||||
//gps_eastwest E:East,W:West
|
|
||||||
string gps_eastwest = ((char)pbPayload[idx]).ToString();
|
|
||||||
idx++;
|
|
||||||
//std::cout<<"gps_eastwest:"<<gps_eastwest<<endl;
|
|
||||||
//gps_longitude Latitude Format: DDDFF.FFFF
|
|
||||||
string lng = "";
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
lng += ((char)pbPayload[idx + i]).ToString();
|
|
||||||
}
|
|
||||||
idx += 10;
|
|
||||||
//gps speed
|
|
||||||
string speed = "";
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
speed += ((char)pbPayload[idx + i]).ToString();
|
|
||||||
//Console.WriteLine("spd:" + ((char)pbPayload[idx + i]).ToString());
|
|
||||||
}
|
|
||||||
idx += 3;
|
|
||||||
Console.WriteLine("speed:" + speed);
|
|
||||||
|
|
||||||
// add by bigu for system with are not English
|
|
||||||
string decimalSeparator = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
|
||||||
if (decimalSeparator == ",") speed = speed.Replace('.', ',');
|
|
||||||
try
|
|
||||||
{
|
|
||||||
speed = Convert.ToString((Int32)Math.Round(Convert.ToDouble(speed) * (Double)1.85));
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Error on conver Speed:\n\r" + ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
DateTime dt = DateTime.Now;
|
|
||||||
if (Hytera_GW.cfg.useRadioTime)
|
|
||||||
if (gps_status == 'A') dt = new DateTime(gps_y + 2000, gps_mon, gps_d, gps_h, gps_m, gps_s);
|
|
||||||
string strTime = DateTo70Format(dt).ToString();
|
|
||||||
|
|
||||||
string lat_str = ProcessGPSLat(lat, gps_northsouth).ToString();
|
|
||||||
string lng_str = ProcessGPSLong(lng, gps_eastwest).ToString();
|
|
||||||
//send to message bus
|
|
||||||
string msgOPcode = "131";
|
|
||||||
if (poll == 1) msgOPcode = "231";
|
|
||||||
|
|
||||||
GPSmsg_str = "#" + gw_id + "." + DateTo70Format(dt) + "#" + msgOPcode + "#"
|
|
||||||
+ radioID + "#" + strTime + "#" +
|
|
||||||
speed + "#" + lat_str + "#" + lng_str + "#";
|
|
||||||
|
|
||||||
int len2 = GPSmsg_str.Length + 1;
|
|
||||||
len2 = len2 + ((len2).ToString()).Length;
|
|
||||||
GPSmsg_str = "#" + len2.ToString() + GPSmsg_str;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("GPSconvertor ERROR:\n\r" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float ProcessGPSLat(String latitude, String lat_dir)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
long LAT, LAT2;
|
|
||||||
char LAT3;
|
|
||||||
long llat, grade, zec;
|
|
||||||
char[] param = new char[50];
|
|
||||||
String[] latList;
|
|
||||||
float flat;
|
|
||||||
|
|
||||||
param = lat_dir.ToCharArray();
|
|
||||||
if (param[0] != 'N' && param[0] != 'S')
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
//Console.WriteLine("Latitude " + latitude + " dir " + lat_dir);
|
|
||||||
|
|
||||||
latList = latitude.Split('.');
|
|
||||||
LAT = Convert.ToInt32(latList[0]);
|
|
||||||
if (latList[1].Length > 4)
|
|
||||||
latList[1] = latList[1].Remove(4);
|
|
||||||
LAT2 = Convert.ToInt32(latList[1]);
|
|
||||||
LAT3 = param[0];
|
|
||||||
|
|
||||||
// process the lat and lng for display
|
|
||||||
grade = (LAT / 100L);
|
|
||||||
zec = (LAT % 100L) * 1000L + LAT2 / 10; // get MMMMM*1000, from MM.mmmmm by MM*1000+mmm (0-59999)
|
|
||||||
zec = (zec * 100L) / 60L; // translate MMMMM*1000 to DD * 100 * 1000 (0-99998)
|
|
||||||
grade = grade * 100000 + zec; // translate all to DDddddd
|
|
||||||
llat = grade;
|
|
||||||
|
|
||||||
flat = (float)llat / 100000;
|
|
||||||
|
|
||||||
if (param[0] == 'S')
|
|
||||||
flat = -flat;
|
|
||||||
|
|
||||||
if (flat < -90 || flat > 90)
|
|
||||||
{
|
|
||||||
Console.WriteLine("[warning \"overflow lat\": flat={0} llat={1}]",
|
|
||||||
flat, llat);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return flat;
|
|
||||||
}
|
|
||||||
catch (Exception ee)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Error in ProcessGPSLat" + ee.ToString());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float ProcessGPSLong(String longitude, String lng_dir)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
long LNG, LNG2;
|
|
||||||
char LNG3;
|
|
||||||
long llng, grade, zec;
|
|
||||||
char[] param = new char[50];
|
|
||||||
String[] lngList;
|
|
||||||
float flong;
|
|
||||||
|
|
||||||
param = lng_dir.ToCharArray();
|
|
||||||
if (param[0] != 'E' && param[0] != 'W')
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
lngList = longitude.Split('.');
|
|
||||||
LNG = Convert.ToInt32(lngList[0]);
|
|
||||||
if (lngList[1].Length > 4)
|
|
||||||
lngList[1] = lngList[1].Remove(4);
|
|
||||||
LNG2 = Convert.ToInt32(lngList[1]);
|
|
||||||
LNG3 = param[0];
|
|
||||||
|
|
||||||
grade = LNG / 100; // get DD (0-90)
|
|
||||||
zec = (LNG % 100L) * 1000L + LNG2 / 10; // get MMMMM*1000, from MM.mmmmm by MM*1000+mmm (0-59999)
|
|
||||||
zec = (zec * 100L) / 60L; // translate MMMMM*1000 to DD * 100 * 1000 (0-99998)
|
|
||||||
grade = grade * 100000 + zec; // translate all to DDddddd
|
|
||||||
llng = grade;
|
|
||||||
|
|
||||||
flong = (float)llng / 100000;
|
|
||||||
|
|
||||||
if (param[0] == 'W')
|
|
||||||
flong = -flong;
|
|
||||||
|
|
||||||
if (flong < -180 || flong > 180)
|
|
||||||
{
|
|
||||||
Console.WriteLine("[warning \"overflow lng\": flng={0} llng={1}]",
|
|
||||||
flong, llng);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return flong;
|
|
||||||
}
|
|
||||||
catch (Exception ee)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Error in ProcessGPSLong" + ee.ToString());
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint DateTo70Format(DateTime param)
|
|
||||||
{
|
|
||||||
long nOfSeconds;
|
|
||||||
//Console.WriteLine("DateTo70Format param=" + param);
|
|
||||||
System.DateTime dt70 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
|
||||||
TimeSpan span = param - dt70;
|
|
||||||
nOfSeconds = (long)span.TotalSeconds;
|
|
||||||
return ((uint)nOfSeconds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace SN_Server.ServerMSGS
|
|
||||||
{
|
|
||||||
public class SM_PingPong
|
|
||||||
{
|
|
||||||
private ServerMSG _sm;
|
|
||||||
private string response;
|
|
||||||
|
|
||||||
public SM_PingPong(ServerMSG sm)
|
|
||||||
{
|
|
||||||
_sm = sm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] GenResponse()
|
|
||||||
{
|
|
||||||
string msg = ServerMSG.GenMsg(0xB0B0, ServerConnector.serialNr, "");
|
|
||||||
return System.Text.Encoding.ASCII.GetBytes(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,161 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using System.Collections;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Simulator
|
|
||||||
{
|
|
||||||
class CTRL
|
|
||||||
{
|
|
||||||
private TCPServer tcp;
|
|
||||||
private int tcp_port;
|
|
||||||
|
|
||||||
public static string udpIP;
|
|
||||||
public static int udpPort;
|
|
||||||
|
|
||||||
private NetworkStream ns;
|
|
||||||
System.Threading.Timer ping_timer;
|
|
||||||
|
|
||||||
private static ArrayList unitlist = new ArrayList();
|
|
||||||
|
|
||||||
public CTRL(int tcpport)
|
|
||||||
{
|
|
||||||
tcp_port = tcpport;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tcp = new TCPServer();
|
|
||||||
tcp.OnConnectionRecv += new TCPServer.ConnectionRecv(tcp_OnConnectionRecv);
|
|
||||||
tcp.OnConnectionEnded += new TCPServer.ConnectionEnded(tcp_OnConnectionEnded);
|
|
||||||
tcp.OnMessageRecv += new TCPServer.MessageRecv(tcp_OnMessageRecv);
|
|
||||||
tcp.Start(tcp_port);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tcp_OnConnectionRecv(System.Net.Sockets.NetworkStream ns, string IP)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.ns = ns;
|
|
||||||
Console.WriteLine("GW with IP:" + IP + " Connected");
|
|
||||||
//start ping timer
|
|
||||||
ping_timer = new System.Threading.Timer(PingGW, null, 0, 10000);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// file read
|
|
||||||
unitlist = new ArrayList();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (StreamReader sr = new StreamReader("dataGPS.txt"))
|
|
||||||
{
|
|
||||||
String line;
|
|
||||||
while ((line = sr.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
String[] tmp = line.Split('#');
|
|
||||||
Unit u = new Unit(tmp[1], Int32.Parse(tmp[2]), ns);
|
|
||||||
u.Start();
|
|
||||||
unitlist.Add(u);
|
|
||||||
Thread.Sleep(23);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("The file could not be read:");
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
void tcp_OnConnectionEnded(string IP)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
Console.WriteLine("GW with IP:" + IP + " Disconnect");
|
|
||||||
this.ns = null;
|
|
||||||
ping_timer = null;
|
|
||||||
|
|
||||||
if (unitlist != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < unitlist.Count; i++)
|
|
||||||
{
|
|
||||||
if ((Unit)unitlist[i] != null)
|
|
||||||
{
|
|
||||||
((Unit)unitlist[i]).Stop();
|
|
||||||
unitlist[i] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
unitlist = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void tcp_OnMessageRecv(byte[] data, int recv, System.Net.Sockets.NetworkStream ns)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (recv == 12)
|
|
||||||
{
|
|
||||||
if ((data[4] == 0x50) && (data[6] == 0x4f))
|
|
||||||
{
|
|
||||||
//Pong received
|
|
||||||
Console.WriteLine("Pong recv");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("tcp_OnMessageRecv:" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PingGW(Object state)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Console.WriteLine("Send PING");
|
|
||||||
byte[] msg = new byte[12];
|
|
||||||
//length
|
|
||||||
msg[0] = 0x00;
|
|
||||||
msg[1] = 0x0a;
|
|
||||||
// message ID
|
|
||||||
msg[2] = 0xff;
|
|
||||||
// body length
|
|
||||||
msg[3] = 0x08;
|
|
||||||
//PONG -utf16 LE string
|
|
||||||
//P
|
|
||||||
msg[4] = 0x50;
|
|
||||||
msg[5] = 0x00;
|
|
||||||
//I
|
|
||||||
msg[6] = 0x49;
|
|
||||||
msg[7] = 0x00;
|
|
||||||
//N
|
|
||||||
msg[8] = 0x4e;
|
|
||||||
msg[9] = 0x00;
|
|
||||||
//G
|
|
||||||
msg[10] = 0x47;
|
|
||||||
msg[11] = 0x00;
|
|
||||||
|
|
||||||
if(tcp !=null && ns != null)
|
|
||||||
TCPServer.Send(msg, msg.Length, ns);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("ERROR in PingGW:\n" + ex.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
; config.ini
|
|
||||||
; This file is used to run the SafeNet Hytera Gateway application
|
|
||||||
; Please do not modify if you are not an admin
|
|
||||||
|
|
||||||
|
|
||||||
;GATEWAY INFO
|
|
||||||
;id - gateway identifier
|
|
||||||
;report - default reporting intervall in seconds
|
|
||||||
;MasterRadioIP - Hytera base station IP (set in DMR)
|
|
||||||
;MasterRadioIMEI - Hytera base station ID(set in DMR)
|
|
||||||
;MR_subnet - Hytera base station sub network value(set in DMR)(ex:if MR_subnet=10 and MasterRadioIMEI=80 then Hytra internal IP will be 10.0.0.80)
|
|
||||||
;ping_interval - Time(in seconds) that is used to check the connection between Hytera base station and the gateway application
|
|
||||||
;UseRadioTime - uses the radio time for GPS messages. If it set to false it will use the Computer time
|
|
||||||
[GATEWAY]
|
|
||||||
id = 81000
|
|
||||||
report = 30
|
|
||||||
MasterRadioIP = 192.168.80.1
|
|
||||||
MR_subnet = 10
|
|
||||||
MasterRadioIMEI = 101
|
|
||||||
ping_interval = 60000
|
|
||||||
UseRadioTime = true
|
|
||||||
gw_restart = False
|
|
||||||
|
|
||||||
;MySQL_SMS INFO
|
|
||||||
;SERVER - mysql server IP
|
|
||||||
;DATABASE - mysql schema
|
|
||||||
;UID - mysql user ID
|
|
||||||
;PASSWORD -mysql password
|
|
||||||
[MySQL]
|
|
||||||
SERVER = safenet.crnnlkxkkb0y.us-east-1.rds.amazonaws.com
|
|
||||||
DATABASE = safenet301
|
|
||||||
UID = safenet
|
|
||||||
PASSWORD = sE4reg3Q
|
|
||||||
active = true
|
|
||||||
restartTime = 10
|
|
||||||
|
|
||||||
[EmailService]
|
|
||||||
Enable = false
|
|
||||||
User = bigutransfer@gmail.com
|
|
||||||
Pass = gigelamd01
|
|
||||||
Pop3Server = pop.gmail.com
|
|
||||||
SmtpServer = smtp.gmail.com
|
|
||||||
EnableSSL = True
|
|
||||||
Pop3Port = 995
|
|
||||||
SmtpPort = 587
|
|
@ -1,136 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace SN_Server
|
|
||||||
{
|
|
||||||
public class ServerMSG
|
|
||||||
{
|
|
||||||
private int len;
|
|
||||||
public int Len
|
|
||||||
{
|
|
||||||
get { return len; }
|
|
||||||
set { len = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private int opcode;
|
|
||||||
public int OPcode
|
|
||||||
{
|
|
||||||
get { return opcode; }
|
|
||||||
set { opcode = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string sn; //serial number
|
|
||||||
public string SN
|
|
||||||
{
|
|
||||||
get { return sn; }
|
|
||||||
set { sn = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string payload;
|
|
||||||
public string Payload
|
|
||||||
{
|
|
||||||
get { return payload; }
|
|
||||||
set { payload = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private string oldMSG;
|
|
||||||
|
|
||||||
public bool valid;
|
|
||||||
|
|
||||||
public ServerMSG()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
public ServerMSG(string msg, int len)
|
|
||||||
{
|
|
||||||
oldMSG = msg;
|
|
||||||
//decode
|
|
||||||
valid = Decode(msg, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool Decode(string data, int actualLen)
|
|
||||||
{
|
|
||||||
bool ret = false ;
|
|
||||||
string[] tempArr = data.Split('#');
|
|
||||||
if ((tempArr.Length == 0) || (tempArr.Length == 1))
|
|
||||||
{
|
|
||||||
Console.WriteLine("incorect message=" + data);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
//get len
|
|
||||||
len = Convert.ToInt32(tempArr[1]);
|
|
||||||
|
|
||||||
if (actualLen != len)
|
|
||||||
{
|
|
||||||
Console.WriteLine("message length({0}) != actual length({1})", len, actualLen);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
//get opcode
|
|
||||||
opcode = Convert.ToInt32(tempArr[2],16);
|
|
||||||
|
|
||||||
//get serial number
|
|
||||||
sn = tempArr[3];
|
|
||||||
|
|
||||||
//get payload
|
|
||||||
payload = tempArr[4];
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GenMsg(int opcode, string serialNr, string paylaod)
|
|
||||||
{
|
|
||||||
string temp = "#" + opcode.ToString("X4") + "#" + serialNr + "#" + paylaod + "#";
|
|
||||||
int strlen = ("#" + (temp.Length).ToString() + temp).Length;
|
|
||||||
temp = "#" + strlen.ToString() + temp;
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static ArrayList Split(string data, int actualLen)
|
|
||||||
{
|
|
||||||
ArrayList ar = new ArrayList();
|
|
||||||
|
|
||||||
string[] tempArr = data.Split('#');
|
|
||||||
if ((tempArr.Length == 0) || (tempArr.Length == 1))
|
|
||||||
{
|
|
||||||
Console.WriteLine("incorect message=" + data);
|
|
||||||
return null ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//get len
|
|
||||||
int len = Convert.ToInt32(tempArr[1]);
|
|
||||||
|
|
||||||
if (actualLen != len)
|
|
||||||
{
|
|
||||||
Console.WriteLine("message length({0}) != actual length({1})", len, actualLen);
|
|
||||||
Console.WriteLine(data);
|
|
||||||
|
|
||||||
if (len < actualLen)
|
|
||||||
{
|
|
||||||
string first = data.Substring(0, len);
|
|
||||||
ar.Add(first);
|
|
||||||
|
|
||||||
string leftOver = data.Substring(len, actualLen - len);
|
|
||||||
|
|
||||||
ArrayList ar_new = Split(leftOver, leftOver.Length);
|
|
||||||
if (ar_new != null)
|
|
||||||
{
|
|
||||||
foreach (string str in ar_new)
|
|
||||||
ar.Add(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ar.Add(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return ar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|