129 lines
3.9 KiB
C#
129 lines
3.9 KiB
C#
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;
|
|
}
|
|
|
|
}
|
|
}
|