Example #1
0
        private bool OpenWiFi()
        {
            try
            {
                if (!wifi.IsOpen)
                {
                    wifi.Open();
                }
            }
            catch (NetworkInterfaceExtensionException e)
            {
                switch (e.errorCode)
                {
                case NetworkInterfaceExtensionException.ErrorCode.AlreadyActivated: break;

                case NetworkInterfaceExtensionException.ErrorCode.HardwareFirmwareVersionMismatch:
                    wifi.UpdateFirmware();
                    wifi.Open();
                    break;

                case NetworkInterfaceExtensionException.ErrorCode.HardwareCommunicationFailure:
                case NetworkInterfaceExtensionException.ErrorCode.HardwareNotEnabled:
                case NetworkInterfaceExtensionException.ErrorCode.HardwareCommunicationTimeout:
                    Debug.Print("Error Message: " + e.ErrorMsg);
                    Debug.Print("Check WiFi module hardware connections and SPI/signals configurations.");
                    wifi.Open();
                    break;

                default:
                    Debug.Print("Error Message: " + e.ErrorMsg);
                    return(false);
                }
            }
            catch (Exception e)
            {
                Debug.Print("EnableWiFi Error: " + e.Message);
                return(false);
            }

            //NetworkInterfaceExtension.AssignNetworkingStackTo(wifi);
            Debug.Print("\nEnabled successfully!\nAt this point, the on-board LED on RS9110_N_11_21_1_Compatible module is ON.\n");
            return(true);
        }