gsulc / wagomodbusnet Goto Github PK
View Code? Open in Web Editor NEW.Net Modbus Master Library made by WAGO Kontakttechnik GmbH & Co.KG
License: MIT License
.Net Modbus Master Library made by WAGO Kontakttechnik GmbH & Co.KG
License: MIT License
.NET standard targeting maximizes the compatibility across platforms. Targeting the lowest version possible further increases the compatibility. Libraries targeting .NET Standard allow all .NET platforms to use it. The .NET Standard API is implemented by .NET Framework, .NET Core, and Xamarin (Mono).
Reading:
https://msdn.microsoft.com/en-us/magazine/mt842506.aspx
https://docs.microsoft.com/en-us/dotnet/standard/net-standard
The Microsoft provided libraries for opening connections: Socket and SerialPort both implement IDisposable. However, the ModbusMaster$ that use them do not implement that interface nor a finalizer. This causes the problem when a ModbusMaster reference is set to null: the connection is not released.
Catching exceptions as part of the normal operational case is bad practice.
Remove all error/return codes and replace them with exceptions. By the end, wmnRet and wmnErrorOffset will be removed.
Return codes clutter the caller. It is better to throw an exception when you encounter an error. (Martin, R. C. (2009). Clean Code: a handbook of agile software craftsmanship. p 104)
This is because the method is looking for a TimeoutException in the WagoModbusNet namespace. This new exception should be removed. Also, the logic should be moved out of the finally block top the catch block. Not operating on an expected Exception is the ultimate goal.
Found several errors in the first update. Unit Tests should be created to avoid these. Currently, the various ModbusMasters cannot have unit tests for their modbus operations, save connection failure. The data manipulation methods should be turned protected/internal, so that unit tests can be run on them.
IModbusMaster may seem pedantic to have as an interface given the ModbusMaster abstract class, however under my understanding, this can make using Dependency Injection containers a bit more straightforward. Need to research this more.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.