Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Module.Create(string, string, Address?) not implementing address #44

Open
jojoguy10 opened this issue Nov 19, 2024 · 3 comments
Open
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@jojoguy10
Copy link

I tried using the Module.Create(string name, string catalogNumber, [Address? address = null]) method, but it looks like the address parameter is not implemented in the constructor:

public static Module Create(string name, string catalogNumber, Address? address = null)
{
    CatalogEntry catalogEntry = new ModuleCatalog().Lookup(catalogNumber);
    return new Module
    {
        Name = name,
        CatalogNumber = catalogEntry.CatalogNumber,
        Revision = catalogEntry.Revisions.Max(),
        Vendor = catalogEntry.Vendor,
        ProductType = catalogEntry.ProductType,
        ProductCode = catalogEntry.ProductCode,
        Ports = new LogixContainer<Port>(catalogEntry.Ports.Select((PortInfo p) => new Port
        {
            Id = p.Number,
            Type = p.Type,
            Address = ((p.Type == "Ethernet") ? Address.IP() : Address.Slot(0)),
            Upstream = !p.DownstreamOnly
        }).ToList()),
        Description = catalogEntry.Description
    };
}
@jojoguy10
Copy link
Author

Along with that (and I can put in a separate issue if you want), is there a reason the Module.IP property is read-only? It would be really useful to be able to set the IP address of modules.

@tnunnink
Copy link
Owner

Good find. I must have just missed this when I created that method. I'll get it implemented for the next update.

IP was sort of a helper property to get the value configured on the Ethernet Port. But I agree that it would be valuable to set in the same way. I can also see about adding that in.

@tnunnink tnunnink added bug Something isn't working enhancement New feature or request labels Nov 20, 2024
@tnunnink tnunnink self-assigned this Nov 20, 2024
@tnunnink
Copy link
Owner

Okay this was fixed for 4.7.2 but have not had the chance to fully test it. If it works for you let me know and I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants