private void GetWIFIProfileComplete(string result)
        {
            Debug.Log(result);
            WifiInterfaces all = JsonUtil.Deserialize <WifiInterfaces>(result);

            List <string> profileName = new List <string>();

            for (int i = 0; i < all.Interfaces.Count; i++)
            {
                WifiInterface inter = all.Interfaces[i];
                string        uid   = inter.GUID;
                uid = uid.Trim();
                uid = uid.Substring(1, uid.Length - 2);

                Debug.Log("find uid=" + uid);
                Debug.Log("networkId=" + networkID);

                if (uid == networkID)
                {
                    for (int j = 0; j < inter.ProfilesList.Count; j++)
                    {
                        WifiProfile profile = inter.ProfilesList[j];
                        profileName.Add(profile.Name);
                    }
                    Debug.Log("Find!!! profile count=" + profileName.Count);
                }
            }

            panel.hololensStatusPanel.ShowWifiProfileResult(profileName);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            if (args.Any(arg => arg.IndexOf("help") > -1 || arg.IndexOf("-h") > -1))
            {
                usage();
            }
            else
            {
                var info = WifiInterface.GetInfo();
                scanargs(args, info);

                Console.WriteLine("EsptouchInfo:");
                Console.WriteLine($"    {info}");
                Console.WriteLine();

                if (info == null || info.IP == null || string.IsNullOrEmpty(info.SSID) || string.IsNullOrEmpty(info.BSSID) || info.Devices == 0)
                {
                    Console.WriteLine("Exception: Argument Incomplete!");
                    Console.WriteLine();
                    usage();
                }
                else
                {
                    try
                    {
                        Console.WriteLine($"ESPTOUCH VERSION: {EsptouchTask.ESPTOUCH_VERSION} \n");
                        /// broadcast = false  组播模式下, 必须跟esp8266 在一个 wifi 路由下 esp8266 才能收到
                        EsptouchTask eh = new EsptouchTask(info.SSID, info.BSSID, info.Password, info.Broadcast);

                        eh.Find += Eh_Find;

                        Console.Write("Search ");

                        var lst = eh.ExecuteForResults(info.Devices, info.IP);

                        Console.WriteLine("\n");

                        if (lst.Count == 0)
                        {
                            Console.WriteLine("No device response");
                        }
                        else
                        {
                            Console.WriteLine($"{lst.Count} devices were configured successfully");
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine($"Exception: {e.Message}");
                    }
                }
            }
        }