public Pdu[] CreatePortAConfigurationCommands(PortAConfiguration portAConfiguration) { if (!PortAInstalled) { return(null); } var oidList = new List <SnmpOid>(); var pdus = new Pdu[7]; if (portAConfiguration != null) { _logger.WriteAsIs("Confiugration to download - \r\n" + portAConfiguration.ToString()); oidList.AddRange(new[] { conv4000ConvAFrequency.Default.oid, conv4000ConvAMute.Default.oid, conv4000ConvAConfigMuteMode.Default.oid, conv4000ConvAAttenuator.Default.oid, conv4000ConvASlope.Default.oid, conv4000convASpectrumInversion.Default.oid }); var vbCollection = new VbCollection(); vbCollection.Add(CreateVb(oidList[0], portAConfiguration.Frequency)); vbCollection.Add(CreateVb(oidList[1], portAConfiguration.Mute)); vbCollection.Add(CreateVb(oidList[2], portAConfiguration.ConfigMute)); vbCollection.Add(CreateVb(oidList[3], portAConfiguration.Attenuation)); vbCollection.Add(CreateVb(oidList[4], portAConfiguration.Slope)); vbCollection.Add(CreateVb(oidList[5], portAConfiguration.Inverse)); var counter = 0; foreach (var vb in vbCollection) { pdus[counter] = Pdu.SetPdu(new VbCollection(new[] { vb })); counter += 1; } return(pdus); } return(null); }
public Pdu CreatePortAConfigurationCommand(PortAConfiguration portAConfiguration) { var oidList = new List <SnmpOid>(); if (portAConfiguration != null) { _logger.WriteAsIs("Confiugration to download - \r\n" + portAConfiguration.ToString()); oidList.AddRange(new[] { conv4000ConvAFrequency.Default.oid, conv4000ConvAMute.Default.oid, conv4000ConvAConfigMuteMode.Default.oid, conv4000ConvAAttenuator.Default.oid, conv4000ConvASlope.Default.oid, conv4000convASpectrumInversion.Default.oid }); var vbCollection = new VbCollection(new[] { CreateVb(oidList[0], portAConfiguration.Frequency), CreateVb(oidList[1], portAConfiguration.Mute), CreateVb(oidList[2], portAConfiguration.ConfigMute), CreateVb(oidList[3], portAConfiguration.Attenuation), CreateVb(oidList[4], portAConfiguration.Slope), CreateVb(oidList[5], portAConfiguration.Inverse) }); return(Pdu.SetPdu(vbCollection)); } return(null); }
public void AddConfigureAllCommand(PortAConfiguration portA, PortBConfiguration portB) { if (PortAInstalled) { _logger.WriteMessage("Port A installed!", DebugLevel.DEBUG); var PortAConfigurationCommand = CreatePortAConfigurationCommand(portA); AddCommand(PortAConfigurationCommand); _logger.WriteMessage("Added port A configuration command.", DebugLevel.DEBUG); } else { _logger.WriteMessage("Port A not installed", DebugLevel.DEBUG); } if (PortBInstalled) { _logger.WriteMessage("Port B installed!", DebugLevel.DEBUG); var PortBConfigurationCommand = CreatePortBConfigurationCommand(portB); AddCommand(PortBConfigurationCommand); _logger.WriteMessage("Added port B confiugration command.", DebugLevel.DEBUG); } else { _logger.WriteMessage("Port B not installed", DebugLevel.DEBUG); } }
private bool ParseCurrentInformation() { if (_result == null) { return(false); } var vbList = _result.Pdu.VbList; var portA = new PortAConfiguration((Integer32)vbList[1].Value, //frequency (Integer32)vbList[2].Value, //mute (Integer32)vbList[3].Value, //mute configure (Integer32)vbList[4].Value, //attenuator (Integer32)vbList[5].Value, //slope (Integer32)vbList[7].Value); //inverse var portB = new PortBConfiguration((Integer32)vbList[9].Value, //frequency (Integer32)vbList[10].Value, //mute (Integer32)vbList[11].Value, //mute configure (Integer32)vbList[12].Value, //attenuator (Integer32)vbList[13].Value, //slope (Integer32)vbList[14].Value); //inverse _logger.WriteAsIs(portA.ToString()); _logger.WriteAsIs(portB.ToString()); var faults = new FaultList((Integer32)vbList[15].Value, (Integer32)vbList[16].Value, (Integer32)vbList[17].Value, (Integer32)vbList[18].Value, (Integer32)vbList[19].Value, (Integer32)vbList[20].Value, (Integer32)vbList[21].Value, (Integer32)vbList[22].Value, (Integer32)vbList[23].Value, (Integer32)vbList[24].Value, (Integer32)vbList[25].Value, (Integer32)vbList[26].Value, (Integer32)vbList[27].Value); Status = new Lbc4000Status(portA, portB, faults); return(true); }
private void downloadConfigBtn_Click(object sender, EventArgs e) { try { this.Text = "DCController - Sending command..."; var aFrequency = Int32.Parse(aFrequencyTB.Text); var aMute = (MuteOptions)aMuteCB.SelectedItem; var aConfigureMute = (ConfigMuteOptions)aConfigureMuteCB.SelectedItem; var aAttenuation = Int32.Parse(aAttenuationTB.Text); var aInverse = (InverseOptions)aInverseCB.SelectedItem; var aSlope = Int32.Parse(aSlopeTB.Text); var bFrequency = Int32.Parse(bFrequencyTB.Text); var bMute = (MuteOptions)bMuteCB.SelectedItem; var bConfigureMute = (ConfigMuteOptions)bConfigureMuteCB.SelectedItem; var bAttenuation = Int32.Parse(bAttenuationTB.Text); var bSlope = Int32.Parse(aSlopeTB.Text); var bInverse = (InverseOptions)bInverseCB.SelectedItem; try { var portA = new PortAConfiguration(aFrequency, aMute, aConfigureMute, aAttenuation, aSlope, aInverse); var portB = new PortBConfiguration(bFrequency, bMute, bConfigureMute, bAttenuation, bSlope, bInverse); _device.AddConfigureAllCommand(portA, portB); } catch (Exception ex) { _logger.WriteMessage(ex.Message, DebugLevel.ERROR); this.Text = "DCController - Connected"; MessageBox.Show(String.Format("Invalid argument!\r\n{0}", ex.Message), "Sorry", MessageBoxButtons.OK); } } catch (Exception ex) { _logger.WriteMessage(ex.Message, DebugLevel.ERROR); MessageBox.Show(String.Format("Invalid operation!\r\n{0}", ex.Message), "Sorry", MessageBoxButtons.OK); } getStateBtn_Click(sender, e); }