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); } }
public bool RunCAITask(ConnectedApplianceInfo cai) { try { string[] parts; IPData ipd; if (cai != null) { parts = cai.VersionNumber.Replace(" ", "").Split('|'); if (parts[0] == TVers) { return(false); } ipd = AddResult(cai); if (!RevelationConnect(cai)) { ipd.Result = "FAIL - Revelation unable to connect."; ipd.Done = true; results.Rows[ipd.TabIndex]["OTA Result"] = iplist[ipd.TabIndex].Result; WriteFile(ipd.TabIndex, null); return(false); } else { if (SendRevelation(cai)) { ipd.Result = "Revelation OTA payload sent."; ipd.Sent = true; results.Rows[ipd.TabIndex]["OTA Result"] = iplist[ipd.TabIndex].Result; } else { ipd.Result = "FAIL - Revelation unable to connect."; ipd.Done = true; results.Rows[ipd.TabIndex]["OTA Result"] = iplist[ipd.TabIndex].Result; WriteFile(ipd.TabIndex, null); return(false); } } DGV_Data.Refresh(); return(true); } else { ipd = AddResult(cai); ipd.Result = "FAIL - " + cai.IPAddress + " was unable to connect from WifiBasic."; ipd.Done = true; results.Rows[ipd.TabIndex]["OTA Result"] = iplist[ipd.TabIndex].Result; DGV_Data.Refresh(); WriteFile(ipd.TabIndex, null); return(false); } } catch { MessageBox.Show("Catastrophic CAITask error.", "Error: RunCAITask", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
//If the product responds to a ping, set the ping data and also check its MQTT connection from the Trace. Also re-enable the Trace if it has been lost due to disconnection/reboot/power loss void p_PingCompleted(object sender, PingCompletedEventArgs e) { string ip = (string)e.UserState; if (e.Reply != null) { lock (lockObj) { //gets the list of appliances from WifiBasic System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; //Selects the appliance based on IP address ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == ip); //If an appliance with the specified IP address is found in the list... if (cai != null) { mqttresp = cai.IsTraceOn; //check if Trace is currently enabled if (!cai.IsTraceOn) { //if it's not and Revelation is also not enabled, enable Revelation if (!cai.IsRevelationConnected) { WifiLocal.ConnectTo(cai); } else { //If Revelation is enabled, enable Trace WifiLocal.EnableTrace(cai, true); } mqttresp = false; } else { //If the Trace is enabled and Revelation is also connected, close the Revelation connection if (cai.IsRevelationConnected) { WifiLocal.CloseRevelation(System.Net.IPAddress.Parse(cai.IPAddress)); } mqttresp = true; } } // Else if the IP address is not found in the WifiBasic list, connection has been lost else { mqttresp = false; } if (e.Reply.Status == IPStatus.Success) { pingresp = ip + "\t" + e.Reply.RoundtripTime + "ms" + "\t" + mqttresp.ToString(); } else { pingresp = ip + "\t" + e.Reply.Status.ToString() + "\t" + mqttresp.ToString(); } responses.Add(pingresp); } } }
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); } }
bool RevelationConnect(ConnectedApplianceInfo cai) { int revatt = 0; while (revatt < ATTEMPTMAX) { try { if (cancel_request) { return(false); } revatt++; if (cai != null) { //if it's not and Revelation is also not enabled, enable Revelation if (!cai.IsRevelationConnected) { WifiLocal.ConnectTo(cai); Wait(2000); } if (!cai.IsRevelationConnected) { //If Revelation is enabled, enable Trace continue; } //If the Trace is enabled and Revelation is also connected return if (cai.IsRevelationConnected) { return(true); } } else { MessageBox.Show("Revelation was not able to be connected due to error in WifiBasic." + "If persists, you may need to close Widebox and try again.", "Error: Unable to start", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } catch { MessageBox.Show("Revelation was not able to be connected due to error in WifiBasic." + "If persists, you may need to close Widebox and try again.", "Error: Unable to start", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } return(true); }
public bool SendRevelation(ConnectedApplianceInfo cai) { bool revconnect = false; try { if (cai != null && !cai.IsRevelationConnected) { // Connect revelation WifiLocal.ConnectTo(cai); Wait(2000); } // Send Revelation message if (cai != null && cai.IsRevelationConnected) { WifiLocal.SendRevelationMessage(cai, new RevelationPacket() { API = 0xF1, Opcode = 00, Payload = paybytes, }); Wait(2000); revconnect = true; } // Close revelation if (revconnect) { WifiLocal.CloseRevelation(System.Net.IPAddress.Parse(cai.IPAddress)); //WifiLocal.Close(cai); Wait(2000); return(true); } else { return(false); } } catch { MessageBox.Show("Catastrophic SendRevelation error.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
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); } }
//Not used right now, was used when pinging was done serially rather than asynchronously public bool PingHost(string nameOrAddress) { bool pingable = false; Ping pinger = null; try { System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == nameOrAddress); if (cai != null) { mqttresp = cai.IsMqttConnected; } else { mqttresp = false; } pinger = new Ping(); PingReply reply = pinger.Send(nameOrAddress, pingtimeout); pingable = reply.Status == IPStatus.Success; if (pingable) { pingresp = reply.Address + "\t" + reply.RoundtripTime + "ms" + "\t" + mqttresp.ToString(); } else { pingresp = nameOrAddress + "\t" + reply.Status.ToString() + "\t" + mqttresp.ToString(); } } catch (PingException) { // Discard PingExceptions and return false; mqttresp = false; pingresp = nameOrAddress + "\t" + "FAIL" + "\t" + mqttresp.ToString(); } finally { if (pinger != null) { pinger.Dispose(); } } return(pingable); }
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); } }
private void BTN_Add_Click(object sender, EventArgs e) { try { if (iplist.FirstOrDefault(x => x.IPAddress == TB_IP.Text) == null) { System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text); if (cai != null) { LB_IPs.Items.Add(cai.IPAddress); IPData newip = new IPData(cai.IPAddress, cai.MacAddress); iplist.Add(newip); DataRow dr = results.NewRow(); dr["IP Address"] = newip.IPAddress; dr["MAC Address"] = newip.MACAddress; results.Rows.Add(dr); } } } catch { } }
public bool SendRevelation(string ips, byte[] paybytes, byte[] orgbytes)//, ConnectedApplianceInfo cai) { int revattempt = 0; bool revconnect = false; // Check CAI and set IP address System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == ips); var myDestination = WifiLocal.ConnectedAppliances.FirstOrDefault(i => i.IPAddress.Equals(ips)); // See if Revelation is Connected and attempt to connect until it is while (!revconnect && (revattempt < ATTEMPTMAX)) { try { revattempt++; // Send Revelation message(s) if (myDestination != null && cai.IsRevelationConnected) { if (CB_MQTT.Checked || BTN_GET.Text == "Running") { WifiLocal.SendRevelationMessage(myDestination, new RevelationPacket() { API = 0xF0, Opcode = 00, Payload = paybytes, }); Wait(2000); } if (CB_Org.Checked || BTN_GET.Text == "Running") { WifiLocal.SendRevelationMessage(myDestination, new RevelationPacket() { API = 0xF0, Opcode = 00, Payload = orgbytes, }); Wait(2000); } revconnect = true; } // Close revelation if (revconnect) { WifiLocal.CloseRevelation(System.Net.IPAddress.Parse(cai.IPAddress)); Wait(2000); return(true); } } catch { MessageBox.Show("Revelation connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" + " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } MessageBox.Show("Revelation connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" + " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); }
/// <summary> /// Send a Reveal Message over the Mqtt connection. /// Use WifiLocal.ConnectedAppliances to get the list of current scanned and/or connected appliances. /// </summary> /// <param name="connectedAppliance">The connected Applicance</param> /// <param name="destination">Address to send the message</param> /// <param name="api">Reveal Api</param> /// <param name="opcode">Reveal Opcode</param> /// <param name="isFeedback">Set true if the message is a feedback</param> /// <param name="payload">payload bytes</param> public void SendRevealMessageOverMQTT(ConnectedApplianceInfo connectedAppliance, byte destination, byte api, byte opcode, bool isFeedback, byte[] payload) { RevealPacket pkt = new RevealPacket(api, opcode, 0, destination, isFeedback, payload); WifiLocal.SendMqttMessage(connectedAppliance, pkt.ToMqtt()); }
/// <summary> /// Send a Reveal Message over the Mqtt connection. /// Use WifiLocal.ConnectedAppliances to get the list of current scanned and/or connected appliances. /// </summary> /// <param name="connectedAppliance">The connected Applicance</param> /// <param name="pkt">Reveal packet containing the command or feedback to be sent</param> public void SendRevealMessageOverMQTT(ConnectedApplianceInfo connectedAppliance, RevealPacket pkt) { WifiLocal.SendMqttMessage(connectedAppliance, pkt.ToMqtt()); }
/// <summary> /// Send a Reveal Message List over the Revelation connection. /// Use WifiLocal.ConnectedAppliances to get the list of current scanned and/or connected appliances. /// </summary> /// <param name="connectedAppliance">The connected Applicance</param> /// <param name="pktList">Reveal packet list containing the commands and/or feedbacks to be sent</param> public void SendRevealMessageOverRevelation(ConnectedApplianceInfo connectedAppliance, List <RevealPacket> pktList) { WifiLocal.SendRevelationMessage(connectedAppliance, pktList.ToRevelation()); }
private void BTN_GET_Click(object sender, EventArgs e) { if (BTN_GET.Text == "Get") { try { DialogResult dialogurl; if (!CB_Suppress.Checked) { if (MessageBox.Show("Before continuing, please verify that IP Address of " + TB_IP.Text + " is currently" + " listed within WifiBasic and UITracer is NOT running. If not, press 'No' on this window and open WifiBasic then press 'Data Start'" + " and finally, press 'Scan Appliances' to populate the list in WifiBasic.", "Verify IP Address is Listed", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { return; } } string get = "get"; BTN_GET.Text = "Running"; BTN_GET.Enabled = false; CB_EMEAP.Enabled = false; CB_NARS.Enabled = false; CB_NARP.Enabled = false; CB_Custom.Enabled = false; CB_Org.Enabled = false; CB_Org.Checked = false; CB_MQTT.Enabled = false; CB_MQTT.Checked = false; BTN_Reset.Enabled = false; TB_IP.Enabled = false; BTN_Payload.Enabled = false; CB_Legacy.Enabled = false; //CycleWifi(); //Wait(2000); System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text); byte[] orgbytes = Encoding.ASCII.GetBytes(OrgSelection()); byte[] paybytes = Encoding.ASCII.GetBytes(PaySelection()); if (cai != null) { if (RevelationConnect(get, cai)) { if (SendRevelation(TB_IP.Text, paybytes, orgbytes)) { for (int i = 0; i < ATTEMPTMAX; i++) { if (mqtt_url.Contains(".")) { break; } else { Wait(1000); } } } } if (mqtt_url != "") { if (mqtt_url == "0") { mqtt_url = "DEFAULT"; } if (org_id == "0") { org_id = "DEFAULT"; } dialogurl = MessageBox.Show("The MQTT URL for " + TB_IP.Text + " is currently " + mqtt_url + "." + " The ORG ID for " + TB_IP.Text + " is currently " + org_id + "." + " Request completed. Closing all open connections.", "Get MQTT URL and ORG ID", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { dialogurl = MessageBox.Show("The MQTT URl/Org ID for " + TB_IP.Text + " was NOT returned successfuly." + " Request completed. Closing all open connections.", "Get MQTT URL and ORG ID", MessageBoxButtons.OK, MessageBoxIcon.Information); } Reset(false); mqtt_url = ""; TB_IP.Enabled = true; BTN_Reset.Enabled = true; BTN_Payload.Enabled = true; WifiLocal.CloseAll(true); return; } else { MessageBox.Show("Connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" + " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Reset(false); return; } } catch { Reset(false); mqtt_url = ""; TB_IP.Enabled = true; BTN_Reset.Enabled = true; BTN_Payload.Enabled = true; return; } } else { try { Reset(false); TB_IP.Enabled = true; BTN_Reset.Enabled = true; return; } catch { Reset(false); return; } } }
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; } }
private void BTN_Payload_Click(object sender, EventArgs e) { if (BTN_Payload.Text == "Set") { try { DialogResult dialogurl; if (!Valid()) { DialogResult dialogResult = MessageBox.Show("No selection made. Please choose a selection from the check boxes.", "No Selection", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!CB_Suppress.Checked) { if (MessageBox.Show("Before continuing, please verify that IP Address of " + TB_IP.Text + " is currently" + " listed within WifiBasic. If not, press 'No' on this window and open WifiBasic then press 'Data Start'" + " and finally, press 'Scan Appliances' to populate the list in WifiBasic.", "Verify IP Address is Listed", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { return; } } string set = "set"; bool result = false; BTN_Payload.Text = "Running"; BTN_Payload.Enabled = false; CB_EMEAP.Enabled = false; CB_NARS.Enabled = false; CB_NARP.Enabled = false; CB_Custom.Enabled = false; CB_MQTT.Enabled = false; CB_Org.Enabled = false; BTN_Reset.Enabled = false; TB_IP.Enabled = false; BTN_GET.Enabled = false; CB_Legacy.Enabled = false; //CycleWifi(); //Wait(2000); System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text); byte[] paybytes = Encoding.ASCII.GetBytes(PaySelection()); byte[] orgbytes = Encoding.ASCII.GetBytes(OrgSelection()); if (cai != null) { if (RevelationConnect(set, cai)) { result = SendRevelation(TB_IP.Text, paybytes, orgbytes);//, cai); Wait(2000); } if (result) { dialogurl = MessageBox.Show("The MQTT URl for " + TB_IP.Text + " WAS CHANGED successfuly." + " Request completed. Closing all open connections.", "Set MQTT URL", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { dialogurl = MessageBox.Show("The MQTT URl for " + TB_IP.Text + " was NOT CHANGED successfuly." + " Request completed. Closing all open connections.", "Set MQTT URL", MessageBoxButtons.OK, MessageBoxIcon.Information); } Reset(false); BTN_Payload.Enabled = true; TB_IP.Enabled = true; BTN_Reset.Enabled = true; BTN_GET.Enabled = true; WifiLocal.CloseAll(true); return; } else { MessageBox.Show("Unable to connect. Verify IP Address of " + TB_IP.Text + " has been correctly typed" + " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Reset(false); return; } } catch { Reset(false); return; } } else { try { Reset(false); TB_IP.Enabled = true; BTN_Reset.Enabled = true; return; } catch { Reset(false); return; } } }
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); } }
private void BTN_Gen_Click(object sender, EventArgs e) { // DialogResult dialogResult = MessageBox.Show("This will automatically create a new test plan run from the current IP. " + // "This will then clear the current payload list and update the table accordingly. " + // "Press Yes to Create or No to Cancel.", "Verify Full Clear and Auto Generation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //if (dialogResult == DialogResult.Yes) // { System.Collections.ObjectModel.ReadOnlyCollection <ConnectedApplianceInfo> cio = WifiLocal.ConnectedAppliances; ConnectedApplianceInfo cai = cio.FirstOrDefault(x => x.IPAddress == TB_IP.Text); if (cai == null) { MessageBox.Show("Target IP Address of " + TB_IP.Text + " is not currently listed within Wifibasic. " + "Please verify the IP Address is connected and listed in Wifibasic, then retry generation.", "Error: WifiBasic IP Address Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!CheckFill()) { DialogResult checkresult = MessageBox.Show("You have NOT filled out all required text boxes and drop downs. " + "Please check each text box and drop down and retry again.", "Error: Form Improperly Filled Out", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (parent.LB_IPs.Items.Count != 0) { parent.ResetForm(true); } string mqttpay = ""; //Set MQTT payload to start standard bake 350 for whatever product or allow user to input one if (CB_Product.Text.Equals("NAR Cooking")) { mqttpay = "001BFF33330310000C02030D00010000005A0310000106E6030F000202"; // Standard bake 350 for upper oven for 1.5 minute; } else if (CB_Product.Text.Equals("EMEA Cooking")) { mqttpay = "001BFF33330B02001B0104090001028F04060001000000780408000202"; // Standard bake for Speed Oven (MWO bake instead of upper oven) } else if (CB_Product.Text.Equals("NAR Laundry")) { mqttpay = "0026FF333305050006010505001503050500180305050014000505000A010505000D000307000102"; // Standard wash cycle for Janus washer (wash cavity) } else { mqttpay = CB_Product.Text; } string allskip = ""; //See if anything is skipped if (CB_NoCyc.Checked) { allskip += "Remote cycle "; parent.skipcyc = true; } if (CB_NoTTF.Checked) { if (!String.IsNullOrEmpty(allskip)) { allskip += "and "; } allskip += "Tests to Fail "; parent.skipttf = true; } if (CB_NoGen.Checked) { if (!String.IsNullOrEmpty(allskip)) { allskip += "and "; } allskip += "Generic "; parent.skipgen = true; } if (!String.IsNullOrEmpty(allskip)) { DialogResult dialogResult = MessageBox.Show("Please verify skipping " + allskip + "test case(s)." + '\n' + "Press Yes to Confirm or No to Cancel.", "Verify Skip and Auto Generation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult != DialogResult.Yes) { return; } } try { //ClearAll(); parent.glblip = TB_IP.Text; for (int i = 0; i < parent.TESTCASEMAX; i++) { switch (i) { case 0: BuildList(cai, "RQM 131835 OTA : Remote : User Starts Cycle from App in Download", mqttpay, i); break; case 1: BuildList(cai, "RQM 131837 OTA : Remote : User Changes Settings from App in Download", mqttpay, i); break; case 2: BuildList(cai, "RQM 131839 OTA : Remote : User Starts Cycle from App in IAP", mqttpay, i); break; case 3: BuildList(cai, "RQM 131841 OTA : Remote : User Changes Settings from App in IAP", mqttpay, i); break; case 4: BuildList(cai, "RQM 131812 OTA : Generic : Forced Update : Unit in Idle State", mqttpay, i); break; case 5: BuildList(cai, "RQM 154635 OTA : Generic : Forced Update : Downgrade : Unit in Idle State", mqttpay, i); break; case 6: BuildList(cai, "RQM 131844 OTA : Generic : Forced Update : Upgrade : Model/Serial Consistency Check", mqttpay, i); break; case 7: BuildList(cai, "RQM 131845 OTA : Generic : Forced Update : Upgrade : Version Number Check", mqttpay, i); break; case 8: BuildList(cai, "RQM 131846 OTA : Generic : Forced Update : Downgrade : Model/Serial Consistency Check", mqttpay, i); break; case 9: BuildList(cai, "RQM 131847 OTA : Generic : Forced Update : Downgrade : Version Number Check", mqttpay, i); break; case 10: BuildList(cai, "RQM 131849 OTA : Generic : Forced Update : Upgrade : CCURI Check", mqttpay, i); break; case 11: BuildList(cai, "RQM 131850 OTA : Generic : Forced Update : Downgrade : CCURI Check", mqttpay, i); break; case 12: BuildList(cai, "RQM 131851 OTA : Generic : Check Provision State", mqttpay, i); break; case 13: BuildList(cai, "RQM 131852 OTA : Generic : Check Claimed Status", mqttpay, i); break; case 14: BuildList(cai, "RQM 186300 OTA : Generic : Consumer is informed of the update status on app", mqttpay, i); break; case 15: if (node == "HMI") { BuildList(cai, "RQM 131821 OTA : Generic : Forced Update : HMI Update", mqttpay, i); } if (node == "WiFi") { BuildList(cai, "RQM 132549 OTA : Generic : Forced Update : Wifi Radio", mqttpay, i); } if (node == "Expansion") { BuildList(cai, "RQM 132550 OTA : Generic : Forced Update : All Updatable Modules Updated", mqttpay, i); } if (node == "ACU") { BuildList(cai, "RQM 131822 OTA : Generic : Forced Update : ACU Update", mqttpay, i); } break; case 16: BuildList(cai, "RQM 131863 OTA : Generic : RSSI Strong Signal", mqttpay, i); break; case 17: BuildList(cai, "RQM 186529 OTA : Generic : Post Condition : After OTA is successful OTAs are still possible (Appliances are able to receive and apply OTAs)", mqttpay, i); break; case 18: BuildList(cai, "RQM 154667 OTA : Generic : Forced Update : ISPPartNumber check", mqttpay, i); break; case 19: BuildList(cai, "RQM 132552 OTA : TTF : Download Times Out After 5 Attempts", mqttpay, i); break; case 20: BuildList(cai, "RQM 131865 OTA : TTF : Invalid URL", mqttpay, i); break; case 21: BuildList(cai, "RQM 131854 OTA : TTF : Incorrect CRC", mqttpay, i); break; case 22: BuildList(cai, "RQM 131862 OTA : TTF : Forced OTA Payload Sent Multiple Times", mqttpay, i); break; default: break; } } parent.DGV_Data.Refresh(); parent.autogen = true; parent.BTN_MakeList.Enabled = false; parent.BTN_Import.Enabled = false; parent.SizeCol(); } /*catch * { * }*/ catch (Exception f) { /*MessageBox.Show("Catastrophic ProcessPayload error. source was " + source + " raw was " + raw + " sb was " + sb + " and call was " + call, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);*/ LogException("Venom BTN_Gen(): Message and Stacktrace were "); LogException(f, true); return; } }
bool RevelationConnect(string sent, ConnectedApplianceInfo cai) { int revattempt = 0; while (revattempt < ATTEMPTMAX) { revattempt++; try { if (cai != null) { if (sent == "set") { if (!cai.IsRevelationConnected) { WifiLocal.ConnectTo(cai); Wait(2000); } if (!cai.IsRevelationConnected) { continue; } if (cai.IsRevelationConnected) { return(true); } } if (sent == "get") { if (!cai.IsTraceOn) { //if it's not and Revelation is also not enabled, enable Revelation if (!cai.IsRevelationConnected) { WifiLocal.ConnectTo(cai); Wait(2000); } if (cai.IsRevelationConnected) { //If Revelation is enabled, enable Trace WifiLocal.EnableTrace(cai, true); Wait(2000); } } if (cai.IsTraceOn) { return(true); } } } else { MessageBox.Show("Revelation connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" + " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } catch { if (sent == "get") { MessageBox.Show("Connection failed. Verify that UITracer is NOT RUNNING and is Closed. You may need to close" + "Widebox and try again.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("Revelation connection failed. Verify IP Address of " + TB_IP.Text + " has been correctly typed" + " and that the IP Address is listed within WifiBasic.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(false); } } /*if (CycleWifi()) * { * try * { * if (!cai.IsRevelationConnected) * { * WifiLocal.ConnectTo(cai); * Wait(2000); * } * * if (cai.IsRevelationConnected) * return true; * * else * { * MessageBox.Show("Revelation connection failed. You may need to close" + * " Widebox and/or power cycle the product and try again.", "Error: Unable to connect.", * MessageBoxButtons.OK, MessageBoxIcon.Exclamation); * return false; * } * * * } * catch { return false; } * }*/ MessageBox.Show("Revelation connection failed. You may need to close" + " Widebox and/or power cycle the product and try again.", "Error: Unable to connect.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); }