Example #1
0
        //public void RaiseWiFiEvent(string msg)
        //{
        //    if (WiFiEvent != null)
        //    {
        //        WiFiEvent(msg);
        //    }
        //}

        private void OnTimedEvent(Object source, ElapsedEventArgs e)
        {
            string ssid = EsMount.GetConnectedSsid();

            //Console.WriteLine("SSID: " + ssid);
            //RaiseWiFiEvent(ssid);
            tsCurrentWiFi.Text = ssid;
        }
Example #2
0
        public void SetMountFromGui()
        {
            string     selectedItem = "";
            MountModel m            = MountModel.Exos2;
            string     ipAddr       = "";
            Int32      ipPort       = 0;
            string     comPort      = "";

            try
            {
                selectedItem = cmbBasic2MountType.SelectedItem.ToString();
                m            = (MountModel)Enum.Parse(typeof(MountModel), selectedItem);
                ipAddr       = txtBasic2IpAddress.Text;
                ipPort       = Convert.ToInt32(txtBasic2IpPort.Text);
                comPort      = cmbBasic2SerialPort.Text;
                Mount        = EsMount.GetConnectedMount(m, ipAddr, ipPort);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please make sure all settings are valid", "Error");
            }
        }
Example #3
0
        public static EsMount GetConnectedMount(MountModel model, string ipAddress, Int32 ipPort)
        {
            //If wifi Connected
            //If PMC SSID
            //If TCP  --> Return TCP connected mount
            //if UDP --> Return UDP connected mount
            //if Serial ports exist
            //Try Each serial port -->return serial connected mount

            EsMount tcpMount = new EsMount(model, ConnectionMethod.TCP, ipAddress, ipPort);

            if (tcpMount.IsConnectedViaTcp())
            {
                tcpMount.ConnectionMethod = ConnectionMethod.TCP;
                return(tcpMount);
            }

            EsMount udpMount = new EsMount(model, ConnectionMethod.UDP, ipAddress, ipPort);

            if (tcpMount.IsConnectedViaUdp())
            {
                udpMount.ConnectionMethod = ConnectionMethod.UDP;
                return(udpMount);
            }

            EsMount serialMount = null;

            foreach (var item in SerialPort.GetPortNames())
            {
                serialMount = new EsMount(model, item);
                if (serialMount.IsConnectedViaSerial())
                {
                    serialMount.ConnectionMethod = ConnectionMethod.Serial;
                    return(serialMount);
                }
            }
            return(null);
        }