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

Revert "When writing a string to the PLC and length more than declared exception occurs" #366

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ private void AddMemberInitialization(IStringTypeDeclaration type, IStorageDeclar
AddToSource($"{field.Name}");
AddToSource($"= @Connector.ConnectorAdapter.AdapterFactory.Create{IecToAdapterExtensions.ToAdapterType(type)}");
AddToSource($"(this, \"{field.GetAttributeNameValue(field.Name)}\", \"{field.Name}\");");
AddToSource($"{field.Name}.Capacity = {type.Capacity};");

}

// We get warning here about unused method, it is false positive, but we will need to investigate further the object hierarchy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public partial class class_all_primitives : AXSharp.Connector.ITwinObject
public OnlinerDateTime myDATE_AND_TIME { get; }
public OnlinerString mySTRING { get; }
public OnlinerWString myWSTRING { get; }
public OnlinerString mySTRING_25 { get; }
public OnlinerWString myWSTRING_55 { get; }

partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
Expand Down Expand Up @@ -63,13 +61,7 @@ public class_all_primitives(AXSharp.Connector.ITwinObject parent, string readabl
myTIME_OF_DAY = @Connector.ConnectorAdapter.AdapterFactory.CreateTIME_OF_DAY(this, "myTIME_OF_DAY", "myTIME_OF_DAY");
myDATE_AND_TIME = @Connector.ConnectorAdapter.AdapterFactory.CreateDATE_AND_TIME(this, "myDATE_AND_TIME", "myDATE_AND_TIME");
mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING");
mySTRING.Capacity = 254;
myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING");
myWSTRING.Capacity = 254;
mySTRING_25 = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING_25", "mySTRING_25");
mySTRING_25.Capacity = 25;
myWSTRING_55 = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING_55", "myWSTRING_55");
myWSTRING_55.Capacity = 55;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down Expand Up @@ -106,8 +98,6 @@ public async virtual Task<T> OnlineToPlain<T>()
plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue;
plain.mySTRING = mySTRING.LastValue;
plain.myWSTRING = myWSTRING.LastValue;
plain.mySTRING_25 = mySTRING_25.LastValue;
plain.myWSTRING_55 = myWSTRING_55.LastValue;
return plain;
}

Expand Down Expand Up @@ -138,8 +128,6 @@ public async virtual Task<T> OnlineToPlain<T>()
plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue;
plain.mySTRING = mySTRING.LastValue;
plain.myWSTRING = myWSTRING.LastValue;
plain.mySTRING_25 = mySTRING_25.LastValue;
plain.myWSTRING_55 = myWSTRING_55.LastValue;
return plain;
}

Expand Down Expand Up @@ -169,8 +157,6 @@ public async virtual Task<T> OnlineToPlain<T>()
plain.myDATE_AND_TIME = myDATE_AND_TIME.LastValue;
plain.mySTRING = mySTRING.LastValue;
plain.myWSTRING = myWSTRING.LastValue;
plain.mySTRING_25 = mySTRING_25.LastValue;
plain.myWSTRING_55 = myWSTRING_55.LastValue;
return plain;
}

Expand Down Expand Up @@ -246,12 +232,6 @@ public async Task<IEnumerable<ITwinPrimitive>> PlainToOnlineAsync(global::Pocos.
#pragma warning restore CS0612
#pragma warning disable CS0612
myWSTRING.LethargicWrite(plain.myWSTRING);
#pragma warning restore CS0612
#pragma warning disable CS0612
mySTRING_25.LethargicWrite(plain.mySTRING_25);
#pragma warning restore CS0612
#pragma warning disable CS0612
myWSTRING_55.LethargicWrite(plain.myWSTRING_55);
#pragma warning restore CS0612
return await this.WriteAsync<IgnoreOnPocoOperation>();
}
Expand Down Expand Up @@ -325,12 +305,6 @@ public async Task _PlainToOnlineNoacAsync(global::Pocos.class_all_primitives pla
#pragma warning restore CS0612
#pragma warning disable CS0612
myWSTRING.LethargicWrite(plain.myWSTRING);
#pragma warning restore CS0612
#pragma warning disable CS0612
mySTRING_25.LethargicWrite(plain.mySTRING_25);
#pragma warning restore CS0612
#pragma warning disable CS0612
myWSTRING_55.LethargicWrite(plain.myWSTRING_55);
#pragma warning restore CS0612
}

Expand Down Expand Up @@ -364,8 +338,6 @@ public async virtual Task<T> ShadowToPlain<T>()
plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow;
plain.mySTRING = mySTRING.Shadow;
plain.myWSTRING = myWSTRING.Shadow;
plain.mySTRING_25 = mySTRING_25.Shadow;
plain.myWSTRING_55 = myWSTRING_55.Shadow;
return plain;
}

Expand Down Expand Up @@ -393,8 +365,6 @@ public async virtual Task<T> ShadowToPlain<T>()
plain.myDATE_AND_TIME = myDATE_AND_TIME.Shadow;
plain.mySTRING = mySTRING.Shadow;
plain.myWSTRING = myWSTRING.Shadow;
plain.mySTRING_25 = mySTRING_25.Shadow;
plain.myWSTRING_55 = myWSTRING_55.Shadow;
return plain;
}

Expand Down Expand Up @@ -427,8 +397,6 @@ public async Task<IEnumerable<ITwinPrimitive>> PlainToShadowAsync(global::Pocos.
myDATE_AND_TIME.Shadow = plain.myDATE_AND_TIME;
mySTRING.Shadow = plain.mySTRING;
myWSTRING.Shadow = plain.myWSTRING;
mySTRING_25.Shadow = plain.mySTRING_25;
myWSTRING_55.Shadow = plain.myWSTRING_55;
return this.RetrievePrimitives();
}

Expand Down Expand Up @@ -493,10 +461,6 @@ public async Task<bool> DetectsAnyChangeAsync(global::Pocos.class_all_primitives
somethingChanged = true;
if (plain.myWSTRING != myWSTRING.LastValue)
somethingChanged = true;
if (plain.mySTRING_25 != mySTRING_25.LastValue)
somethingChanged = true;
if (plain.myWSTRING_55 != myWSTRING_55.LastValue)
somethingChanged = true;
plain = latest;
return somethingChanged;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public AbstractState(AXSharp.Connector.ITwinObject parent, string readableTail,
PreConstruct(parent, readableTail, symbolTail);
StateID = @Connector.ConnectorAdapter.AdapterFactory.CreateINT(this, "StateID", "StateID");
StateName = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "StateName", "StateName");
StateName.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ public ClassWithPrimitiveTypes(AXSharp.Connector.ITwinObject parent, string read
myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR");
myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR");
mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING");
mySTRING.Capacity = 254;
myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING");
myWSTRING.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString");
HelloString.Capacity = 254;
Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id");
parent.AddChild(this);
parent.AddKid(this);
Expand Down Expand Up @@ -961,7 +960,6 @@ public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, stri
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable");
SomeClassVariable.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down Expand Up @@ -1866,7 +1864,6 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString");
HelloString.Capacity = 254;
Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id");
parent.AddChild(this);
parent.AddKid(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public ComplexForConfig(AXSharp.Connector.ITwinObject parent, string readableTai
myCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateCHAR(this, "myCHAR", "myCHAR");
myWCHAR = @Connector.ConnectorAdapter.AdapterFactory.CreateWCHAR(this, "myWCHAR", "myWCHAR");
mySTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "mySTRING", "mySTRING");
mySTRING.Capacity = 254;
myWSTRING = @Connector.ConnectorAdapter.AdapterFactory.CreateWSTRING(this, "myWSTRING", "myWSTRING");
myWSTRING.Capacity = 254;
myMotor = new Motor(this, "myMotor", "myMotor");
parent.AddChild(this);
parent.AddKid(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ public MembersWithMakeReadOnce(AXSharp.Connector.ITwinObject parent, string read
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember");
makeReadOnceMember.Capacity = 254;
makeReadOnceMember.MakeReadOnce();
someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember");
someOtherMember.Capacity = 254;
makeReadComplexMember = new makereadonce.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember");
makeReadComplexMember.MakeReadOnce();
someotherComplexMember = new makereadonce.ComplexMember(this, "someotherComplexMember", "someotherComplexMember");
Expand Down Expand Up @@ -301,9 +299,7 @@ public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail,
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember");
someMember.Capacity = 254;
someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember");
someOtherMember.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ public MembersWithMakeReadOnly(AXSharp.Connector.ITwinObject parent, string read
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
makeReadOnceMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "makeReadOnceMember", "makeReadOnceMember");
makeReadOnceMember.Capacity = 254;
makeReadOnceMember.MakeReadOnly();
someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember");
someOtherMember.Capacity = 254;
makeReadComplexMember = new makereadonly.ComplexMember(this, "makeReadComplexMember", "makeReadComplexMember");
makeReadComplexMember.MakeReadOnly();
someotherComplexMember = new makereadonly.ComplexMember(this, "someotherComplexMember", "someotherComplexMember");
Expand Down Expand Up @@ -301,9 +299,7 @@ public ComplexMember(AXSharp.Connector.ITwinObject parent, string readableTail,
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
someMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someMember", "someMember");
someMember.Capacity = 254;
someOtherMember = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "someOtherMember", "someOtherMember");
someOtherMember.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ public SomeClass(AXSharp.Connector.ITwinObject parent, string readableTail, stri
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable");
SomeClassVariable.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down Expand Up @@ -1413,7 +1412,6 @@ public Complex(AXSharp.Connector.ITwinObject parent, string readableTail, string
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
HelloString = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "HelloString", "HelloString");
HelloString.Capacity = 254;
Id = @Connector.ConnectorAdapter.AdapterFactory.CreateULINT(this, "Id", "Id");
parent.AddChild(this);
parent.AddKid(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ public NoAccessModifierClass(AXSharp.Connector.ITwinObject parent, string readab
HumanReadable = AXSharp.Connector.Connector.CreateHumanReadable(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
SomeClassVariable = @Connector.ConnectorAdapter.AdapterFactory.CreateSTRING(this, "SomeClassVariable", "SomeClassVariable");
SomeClassVariable.Capacity = 254;
parent.AddChild(this);
parent.AddKid(this);
PostConstruct(parent, readableTail, symbolTail);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,5 @@ public class_all_primitives()
public DateTime myDATE_AND_TIME { get; set; } = new DateTime(1970, 1, 1);
public string mySTRING { get; set; } = string.Empty;
public string myWSTRING { get; set; } = string.Empty;
public string mySTRING_25 { get; set; } = string.Empty;
public string myWSTRING_55 { get; set; } = string.Empty;
}
}

This file was deleted.

Loading