-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
Reading and writing custom types #22
Comments
This feature should support types that include arrays. For example; s7Client.Read<PlcRequestDataBlock>(...); //generic reading operation //the c# entity model of the data block
public class PlcRequestDataBlock
{
public byte Var0 { get; set; }
public PlcRequest[] PlcRequests { get; set; } = new PlcRequest[3];
}
public class PlcRequest
{
public byte Var1 { get; set; }
public byte Var2 { get; set; }
public string Var3 { get; set; } = "";
} |
Hi! Thank you for your contributions and for this feature request. We may be would start a discussion based on this topic so I prepared this short post. Please let me know what do you think about it. Please, don't let me reinvent the wheelThe Problem of transmit complex object from a system to another is already solved for communications with PLC. Why Struct(s)?Because they can be parsed to byte arrays in a deterministic way, just like S7 also does. The ProblemS7 works with BigEndian variables, C# and almost the rest of the world works with LittleEndian. So what?
The Question
A feasible PathI think a good solution would be to offer this functionality into an extension of Sharp7 like Sharp7.Rx or your own struct-swiss-knife. |
Hi, Thanks a lot for your interest. I've just tried to read data with Sharp7.Rx. The reactive approach and the S7-variable-name-based mapping looks very usable. But the same issue comes up: the reading/writing custom types (structs or objects). I think the mapping between the S7 variables and the C# variables should be like Entity Framework data annotations or with like the About the subject, I'm ready to contribute, accordingly the issues that you open at the Sharp7.Rx repository. |
Reading and writing custom types (struct or class) required like below;
s7Client.Read<T>(...)
The text was updated successfully, but these errors were encountered: