/// <summary>
        /// The setup <c>WIFI</c>.
        /// </summary>
        /// <param name="security">
        /// The security.
        /// </param>
        /// <param name="ssid">
        /// The SSID.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool SetupWifi(WifiSecurity security, string ssid, string password)
        {
            this.port.Open();

            if (!this.port.IsOpen)
            {
                this.port.Close();
                return false;
            }

            var connectionString = string.Format("{0}\0{1}\0{2}\0", Convert.ToChar(security), ssid, password);

            this.port.Write(connectionString);

            while (!this.completed)
            {
            }

            this.port.Close();
            return true;
        }
        private void ShowParameters(PropertyBag props)
        {
            if (props.GetValue <string>("Error") != null)
            {
                return;
            }

            string alias = props.GetValue <string>("alias");

            if (alias != device.CameraInfo.Name)
            {
                device.CameraInfo.Name = alias;
            }

            int          wifi_enable    = props.GetValue <int>("wifi_enable");
            string       wifi_ssid      = props.GetValue <string>("wifi_ssid");
            WifiSecurity wifi_encrypt   = (WifiSecurity)props.GetValue <int>("wifi_encrypt");
            int          wifi_authtype  = props.GetValue <int>("wifi_authtype");
            int          wifi_keyformat = props.GetValue <int>("wifi_keyformat");

            // ignore all this WEP crap, hopefully user doesn't have
            string wifi_defkey = props.GetValue <string>("wifi_defkey");
            string wifi_key1   = props.GetValue <string>("wifi_key1");
            string wifi_key2   = props.GetValue <string>("wifi_key2");
            string wifi_key3   = props.GetValue <string>("wifi_key3");
            string wifi_key4   = props.GetValue <string>("wifi_key4");

            string wifi_key1_bits = props.GetValue <string>("wifi_key1_bits");
            string wifi_key2_bits = props.GetValue <string>("wifi_key2_bits");
            string wifi_key3_bits = props.GetValue <string>("wifi_key3_bits");
            string wifi_key4_bits = props.GetValue <string>("wifi_key4_bits");

            // this is where mode 4 key shows up
            string wifi_wpa_psk = props.GetValue <string>("wifi_wpa_psk");

            switch (wifi_encrypt)
            {
            case WifiSecurity.None:
                break;

            case WifiSecurity.WepTkip:
                break;

            case WifiSecurity.WpaAes:
                break;

            case WifiSecurity.Wpa2Aes:
                break;

            case WifiSecurity.Wpa2Tkip:
                device.CameraInfo.WifiPassword = wifi_wpa_psk;
                break;

            default:
                break;
            }

            if (!string.IsNullOrEmpty(wifi_ssid))
            {
                var network = new WifiNetworkInfo()
                {
                    SSID     = wifi_ssid,
                    Mode     = WifiMode.Infrastructure,
                    Security = wifi_encrypt
                };

                device.CameraInfo.WifiNetwork = network;
            }
        }