Hi Team,
I have created a custom DUT class that inherits from Dut.
In that class I have created a Property of type List Port>
When I use DutSettings.Current.Save();, XML file is created ,but List is always null.
public class CustomDutSettings : Dut
{
[Display(CommonVariableNames.PinDetails, Order: 5)]
public List<Port> PinDetails { get; set; }
Is there something I missed out?
Regards
Jestin CI
1 Like
@justin_c_i you also need to create the individual Ports and then initialize your list:
Since you want to save these values, you will want to remove the [XmlIgnore] from that example:
public class ListTestInstr : Instrument
{
public Port P1 { get; set; }
public Port P2 { get; set; }
public List<Port> Ports { get; set; }
public ListTestInstr()
{
P1 = new Port(this, "Port1");
P2 = new Port(this, "Port2");
Ports = new List<Port> { new Port(this, "Port3"), new Port(this, "Port4") };
}
}
1 Like
I used the following class
public class CustomDutSettings : Dut
{
private string dutName;
private List portdetails;
public Port P1 { get; set; }
public Port P2 { get; set; }
public List<Port> Ports { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="CustomDutSettings"/> class.
/// </summary>
public CustomDutSettings()
{
this.ID = string.Empty;
this.SerialNumber = string.Empty;
this.DutName = string.Empty;
this.Result = DutResult.UnDefined;
this.PanelBoard = PanelBoardEnum.PANEL1;
this.IsEnabled = true;
this.TestOperations = new List<TestOperation>();
this.PinDetails = new List<PinDetails>();
this.PinPrefix = "P";
this.Pins = 1;
P1 = new Port(this, "Port1");
P2 = new Port(this, "Port2");
Ports = new List<Port> { new Port(this, "Port3"), new Port(this, "Port4") };
}
@brennen_direnzo I used exactly same code, but still Ports are empty in the XML.
2 Likes
So, at that point, a Port just exists, but there are no settings associated with it. The values are set when you map the ports in the Connections Settings:
In Connections.xml:
<?xml version="1.0" encoding="utf-8"?>
<ConnectionSettings type="OpenTap.ConnectionSettings">
<RfConnection type="OpenTap.RfConnection" Source="">
<CableLoss />
<Name>Route1</Name>
<Port1 Name="PortA">
<Device type="OpenTap.Plugins.PluginDevelopment.TwoPortInstrument" Source="OpenTap.InstrumentSettings">Inst1</Device>
</Port1>
<Port2 Name="PortA">
<Device type="OpenTap.Plugins.PluginDevelopment.FourPortDut" Source="OpenTap.DutSettings">FourPortDut</Device>
</Port2>
<Via>
<SwitchPosition type="OpenTap.SwitchPosition" Name="PosA">
<Device type="OpenTap.Plugins.PluginDevelopment.TwoPositionSwitchInstrument" Source="OpenTap.InstrumentSettings">Switch</Device>
</SwitchPosition>
</Via>
</RfConnection>
<Package.Dependencies>
<Package Name="OpenTAP" Version="9.12.0+78ddca2e" />
</Package.Dependencies>
</ConnectionSettings>
1 Like
@brennen_direnzo ,
If I need to create List Port> in DUTs and save it in XML , is not possible.?
Just save List Port> in XML, I will Be adding Port name like P1,P2,P3 and need to save in DUTs.xml.
I will not be Opening Connections Window
1 Like
What are you trying to accomplish from there maybe we can point you in the right direction on an approach.
@gordonong has been looking into some updates to switching recently so he may be able to help.
2 Likes
@justin_c_i We’re aware the Port information are not serialized into DUT.xml file. The team is working to fix this issue.
3 Likes