示例#1
0
        public bool Remove(ConnectedApplianceInfo cai, IPData ipd)
        {
            bool changed = false;

            try
            {
                string[] vers = cai.VersionNumber.Replace(" ", "").Split('|');
                if (vers[0] == TVers)
                {
                    ipd.Version = vers[0];
                    ipd.Done    = true;
                    ipd.Result  = "PASS - Product Version changed to final version.";
                    WriteFile(ipd.TabIndex, null);
                    DataRow dr = results.Rows[ipd.TabIndex];
                    results.Rows.Remove(dr);
                    changed = true;
                    DGV_Data.Refresh();
                }
                return(changed);
            }
            catch
            {
                MessageBox.Show("Catastrophic Remove error.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
示例#2
0
        public void Build()
        {
            try
            {
                System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
                ConnectedApplianceInfo cai = null;
                int number = Math.Min(cio.Count, (AMT - iplist.Count));
                //Start a batch
                int j = 0;
                for (int i = 0; i < number; i++)
                {
                    if (cancel_request)
                    {
                        break;
                    }
                    cai = cio.ElementAtOrDefault(j);
                    if (cai != null)
                    {
                        IPData ipd = iplist.FirstOrDefault(x => x.MAC == cai.MacAddress);
                        if (ipd != null && ipd.Done)
                        {
                            Remove(cai, ipd);
                            i--;
                            j++;
                            continue;
                        }
                        if (ipd != null && ipd.Sent)
                        {
                            i--;
                            j++;
                            continue;
                        }
                        if (RunCAITask(cai))
                        {
                            j++;
                            totalran++;
                        }
                        else
                        {
                            j++;
                            i--;
                        }
                    }
                    else
                    {
                        j++;
                        continue;
                    }
                }
            }

            catch
            {
                MessageBox.Show("Catastrophic Remove error.", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 public void Check()
 {
     try
     {
         System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
         ConnectedApplianceInfo cai = null;
         int j      = 0;
         int number = iplist.Count;
         for (int i = 0; i < number; i++)
         {
             if (cancel_request)
             {
                 break;
             }
             cai = cio.ElementAtOrDefault(j);
             if (cai != null)
             {
                 IPData ipd = iplist.FirstOrDefault(x => x.MAC == cai.MacAddress);
                 if (ipd != null && !ipd.Done)
                 {
                     j++;
                     if (Remove(cai, ipd))
                     {
                         iplist.RemoveAt(ipd.TabIndex);
                     }
                 }
                 else
                 {
                     j++;
                     i--;
                     continue;
                 }
             }
             else
             {
                 j++;
                 continue;
             }
         }
     }
     catch
     {
         MessageBox.Show("Catastrophic Check error.", "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#4
0
        public IPData AddResult(ConnectedApplianceInfo cai)
        {
            try
            {
                IPData ipd = new IPData(cai.IPAddress, TB_Payload.Text);
                iplist.Add(ipd);
                ipd.TabIndex  = iplist.IndexOf(ipd);
                ipd.IPAddress = cai.IPAddress;
                ipd.Payload   = TB_Payload.Text;
                ipd.Model     = cai.ModelNumber;
                ipd.Serial    = cai.SerialNumber.Replace(" ", "");
                ipd.MAC       = cai.MacAddress;
                ipd.Result    = "PENDING";

                string[] vers = cai.VersionNumber.Replace(" ", "").Split('|');
                ipd.Version = vers[0];

                // Update window for added IP
                DataRow dr = results.NewRow();

                dr["IP Address"]  = ipd.IPAddress;
                dr["OTA Payload"] = ipd.Payload;
                dr["Model"]       = ipd.Model;
                dr["Serial"]      = ipd.Serial;
                dr["MAC"]         = ipd.MAC;
                dr["Version"]     = ipd.Version;
                dr["OTA Result"]  = ipd.Result;
                results.Rows.Add(dr);

                return(ipd);
            }
            catch
            {
                IPData ipd = new IPData("0.0.0.0", "");
                return(ipd);
            }
        }
示例#5
0
        private void BuildList(ConnectedApplianceInfo cai, string name, string mqttpay, int i)
        {
            IPData newip = new IPData(cai.IPAddress, up);

            newip.MAC      = cai.MacAddress;
            newip.Node     = node;
            newip.MQTTPay  = mqttpay;
            newip.TabIndex = parent.AUTOINDEX;
            newip.Name     = name;
            newip.Down     = dwn;
            newip.Result   = "PENDING";


            string wtype = CB_Type.Text;

            if (wtype.Contains("Indigo"))
            {
                parent.indigo = true;
            }
            else
            {
                parent.tourma = true;
            }

            string pay;

            if (name.Contains("Downgrade"))
            {
                pay        = dwn;
                newip.Type = "DOWNGRADE";
            }
            else
            {
                pay        = up;
                newip.Type = "UPGRADE";
            }


            if (parent.LB_IPs.Items.Count == 0)
            {
                if (parent.iplist.FirstOrDefault(x => x.IPAddress == TB_IP.Text) == null)
                {
                    parent.LB_IPs.Items.Add(cai.IPAddress);
                }

                if (CB_Product.Text.Contains("Cooking") || CB_Product.Text.Contains("Other"))
                {
                    newip.Prod = "Cooking";

                    if (parent.indigo)
                    {
                        //00.08.FF.33.33.03.0F.00.02.01
                        newip.Cncl = "0008FF3333030F000201";
                        newip.Set  = "0008FF33330203000A0A";
                    }

                    else
                    {
                        if (CB_Product.Text.Contains("EMEA"))
                        {
                            newip.Cncl = "0008FF33330408000201";
                            newip.Set  = "0008FF33330203000A0A";
                        }
                        else
                        {
                            //00.08.FF.33.33.03.0F.00.02.01
                            newip.Cncl = "0008FF3333030F000201";
                            //00.08.FF.33.33.02.03.00.0A.0A
                            newip.Set = "0008FF33330203000A0A";
                        }
                    }
                }

                else
                {
                    newip.Set  = "0008FF333302020009";
                    newip.Cncl = "0008FF33330307000101";
                    if (CB_Product.Text.Contains("EMEA Laundry"))
                    {
                        newip.Prod = "EMEA Laundry";
                    }
                    else
                    {
                        newip.Prod = "Laundry";
                    }
                }

                parent.iplist.Add(newip);
            }

            //Update window for added IP
            DataRow dr = parent.results.NewRow();

            dr["IP Address"]      = newip.IPAddress;
            dr["OTA Payload"]     = pay;
            dr["Delivery Method"] = "MQTT";
            dr["OTA Type"]        = newip.Type;
            dr["Node"]            = newip.Node;
            dr["Name"]            = newip.Name;
            dr["OTA Result"]      = newip.Result;
            parent.results.Rows.Add(dr);

            if (parent.PendCheck(i))
            {
                newip.Result = "Skipped by user.";

                parent.results.Rows[i]["OTA Result"] = newip.Result;

                parent.DGV_Data.Rows[i].Cells[6].Style.BackColor = Color.Yellow;
            }

            if (parent.tourma && (i == 0 || i == 1))
            {
                newip.Result = "Test case skipped when using Gen4.";

                parent.results.Rows[i]["OTA Result"] = newip.Result;

                parent.DGV_Data.Rows[i].Cells[6].Style.BackColor = Color.Yellow;
            }

            if (parent.indigo && (i == 0 || i == 1) && CB_Product.Text.Contains("EMEA Laundry"))
            {
                newip.Result = "Test case skipped when using EMEA products.";

                parent.results.Rows[i]["OTA Result"] = newip.Result;

                parent.DGV_Data.Rows[i].Cells[6].Style.BackColor = Color.Yellow;
            }
        }
示例#6
0
文件: PayList.cs 项目: abmantis/InDev
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            string localpay     = TB_Payload.Text;
            string localdeliver = "MQTT"; // CHANGE IF ADDING REVELATION BACK

            System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances;
            ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IPDisplay.Text);

            if (cai != null)
            {
                //if (localdeliver.Equals("MQTT") && !cai.IsMqttConnected) // Add back if tracking MQTT or Revelation
                if (!cai.IsMqttConnected)
                {
                    DialogResult dialogResult = MessageBox.Show("You have selected the OTA delivery method as MQTT but the MQTT connection" +
                                                                " for the entered IP Address of " + TB_IPDisplay.Text + " is not currently connected." +
                                                                " If this is acceptable, click Yes to Continue. Otherwise, click No and setup the" +
                                                                " MQTT connection then try adding the IP Address again.",
                                                                "Error: MQTT Delivery but Device is not the MQTT Broker.",
                                                                MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                }

                try
                {
                    if (parent.iplist.FirstOrDefault(x => x.IPAddress == TB_IPDisplay.Text) == null)
                    {
                        parent.LB_IPs.Items.Add(cai.IPAddress);
                    }

                    IPData newip = new IPData(cai.IPAddress, localpay);
                    parent.iplist.Add(newip);
                    newip.MAC  = cai.MacAddress;
                    newip.Type = CB_Type.Text;
                    newip.Node = CB_Variant.Text;
                    newip.Name = "User Input";
                    // Update window for added IP
                    DataRow dr = parent.results.NewRow();

                    dr["IP Address"]      = newip.IPAddress;
                    dr["OTA Payload"]     = newip.Payload;
                    dr["Delivery Method"] = localdeliver;
                    dr["OTA Type"]        = newip.Type;
                    dr["Node"]            = newip.Node;
                    dr["Name"]            = newip.Name;
                    dr["OTA Result"]      = "PENDING";
                    parent.results.Rows.Add(dr);
                }
                catch
                {
                    MessageBox.Show("Catastrophic Add error.", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            else
            {
                // Else if the IP address is not found in the WifiBasic list
                MessageBox.Show("No IP Address was found in WifiBasic. Please choose a new IP Address or Retry.", "Error: WifiBasic IP Address Not Found",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }