示例#1
0
 public static void SendISBeacon()
 {
     APRSIS.SendData(MiniGate.FullCall + ">" + MiniGate.MiniGateDest + ",TCPIP*:" + BText + " " + Toolbox.GetVin() + "\r\n");
 }
示例#2
0
        static void ConfigPrompt()
        {
            Connection.Send(new byte[] { IAC, DO, ECHO });
            Connection.Send(new byte[] { IAC, WONT, ECHO });    // Turn client echo on
            SendData("\r\nMiniGate Console\n\r\n");
            while (IsConnected())
            {
                SendData("cmd: ");
                string   InFull = GetInput();
                string[] InCmd  = InFull.Split(' ');
                switch (InCmd[0].ToUpper())
                {
                case "QUIT":
                case "EXIT":
                    return;

                case "DISP":
                    string Mon = "";
                    if (RFMonEnable)
                    {
                        Mon = "ON";
                    }
                    else
                    {
                        Mon = "OFF";
                    }
                    SendData("MONITOR: " + Mon + "\r\n");
                    SendData("MYCALL: " + MiniGate.FullCall + "\r\n");
                    SendData("APRSSRV: " + APRSIS.Server + ":" + APRSIS.Port + "\r\n");
                    SendData("APRSPASS: "******"\r\n");
                    SendData("MYIP: " + MiniGate.eth[0].IPAddress +
                             " GW: " + MiniGate.eth[0].GatewayAddress +
                             " SN: " + MiniGate.eth[0].SubnetMask + "\r\n");
                    SendData("DNSSRV: ");
                    for (int i = 0; i < MiniGate.eth[0].DnsAddresses.Length; i++)
                    {
                        SendData(MiniGate.eth[0].DnsAddresses[i] + "\r\n");
                    }
                    SendData("TXDELAY: " + Packet.TXDelay.ToString() + "\r\n");
                    SendData("BTEXT: " + Beacon.BText + "\r\n");
                    SendData("BINTERVAL: " + Beacon.Interval.ToString() + "\r\n");
                    break;

                case "MON":
                case "MONITOR":
                    if (InCmd.Length == 2)
                    {
                        RFMon(InCmd[1].ToUpper());
                    }
                    else
                    {
                        SendData("?\r\n");
                    }
                    break;

                case "MYCALL":
                    if (InCmd.Length == 2)
                    {
                        ChangeCall(InCmd[1]);
                        break;
                    }
                    if (InCmd.Length == 1)
                    {
                        SendData(MiniGate.FullCall + "\r\n");
                        break;
                    }
                    SendData("?\r\n");
                    break;

                case "APRSSRV":
                    if (InCmd.Length == 2)
                    {
                        ChangeAPRSSrv(InCmd[1]);
                        break;
                    }
                    if (InCmd.Length == 1)
                    {
                        SendData(APRSIS.Server + ":" + APRSIS.Port + "\r\n");
                        break;
                    }
                    SendData("?\r\n");
                    break;

                case "APRSPASS":
                    if (InCmd.Length == 2)
                    {
                        try
                        {
                            APRSIS.Pass = int.Parse(InCmd[1]);
                            Config.Write("aprsis.pass", InCmd[1]);
                            break;
                        }
                        catch       // User must not have entered an integer
                        { }
                    }
                    if (InCmd.Length == 1)
                    {
                        break;
                    }
                    SendData("?\r\n");
                    break;

                case "DHCP":
                    break;

                case "MYIP":
                    SendData("IP: " + MiniGate.eth[0].IPAddress + "\r\n" +
                             "GW: " + MiniGate.eth[0].GatewayAddress + "\r\n" +
                             "SN: " + MiniGate.eth[0].SubnetMask + "\r\n");
                    break;

                case "DNSSRV":
                    for (int i = 0; i < MiniGate.eth[0].DnsAddresses.Length; i++)
                    {
                        SendData(MiniGate.eth[0].DnsAddresses[i] + "\r\n");
                    }
                    break;

                case "TXD":
                case "TXDELAY":
                    if (InCmd.Length == 2)
                    {
                        try
                        {
                            Packet.TXDelay = int.Parse(InCmd[1]);
                            Config.Write("stn.txdelay", InCmd[1]);
                            break;
                        }
                        catch           // User must not have entered an integer
                        {
                            SendData("?\r\n");
                            break;
                        }
                    }
                    if (InCmd.Length == 1)
                    {
                        SendData(Packet.TXDelay.ToString() + "\r\n");
                        break;
                    }
                    SendData("?\r\n");
                    break;

                case "PASSWD":
                    if (InCmd.Length > 1)
                    {
                        Config.Write("telnet.pass", InFull.Substring(InCmd[0].Length + 1));
                        TelnetServer.Pass = InFull.Substring(InCmd[0].Length + 1);
                        break;
                    }
                    SendData("?\r\n");      // We're not gonna tell you the password...
                    break;

                case "BTEXT":
                    if (InCmd.Length > 1)
                    {
                        Config.Write("stn.btext", InFull.Substring(InCmd[0].Length + 1));
                        Beacon.BText = InFull.Substring(InCmd[0].Length + 1);
                        break;
                    }
                    SendData(Beacon.BText + "\r\n");
                    break;

                case "BINT":
                case "BINTERVAL":
                    if (InCmd.Length == 2)
                    {
                        try
                        {
                            Beacon.Interval = int.Parse(InCmd[1]);
                            Config.Write("stn.binterval", InCmd[1]);
                            break;
                        }
                        catch       // User must not have entered an integer
                        {
                            SendData("?\r\n");
                            break;
                        }
                    }
                    if (InCmd.Length == 1)
                    {
                        SendData(Beacon.Interval.ToString() + "\r\n");
                        break;
                    }
                    SendData("?\r\n");
                    break;

                case "PATH":
                    break;

                case "VOLT":
                    SendData(Toolbox.GetVin() + "\r\n");
                    break;

                default:
                    SendData("?\r\n");
                    break;
                }
            }
        }