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

New PLCException #65

Merged
merged 5 commits into from
Nov 13, 2016
Merged

New PLCException #65

merged 5 commits into from
Nov 13, 2016

Conversation

StefanHasensperling
Copy link
Contributor

@StefanHasensperling StefanHasensperling commented Oct 31, 2016

  1. The Auto-Connect feature now has its own subroutine for easier handling, and also throws an exception if the Connection is not established and not set to AutoConnect

  2. Implemented PLCException. The idea is that we have an Exception for PLC (libnodave) related error codes, with the corresponding ErrorCode to String conversion mechanisms. I refactored all "Exceptions" to "PLCExcetions" and thus eliminating nearly all calls to the "libnodave.daveStrerror".
    Of course there is the "_errorCodeConverter" variable, that is not considered correctly at the moment. But it does not affect anything at the moment (The exception use the Managed version of the converter).

  3. PLCGetBlockInMC7 now throws an Exception instead of returning Null on failure
    This is very important for bugfixing, because if it returns Null there is no information about the actual error that caused the fucntion to fail

StefanHasensperling and others added 4 commits October 25, 2016 13:38
…s an Exception if the connection is not established

2. Implementation of PLCException. This Exception holds the Libnodave Error code for easier debugging

3. PLCGetBlockAsMC7 now throws an Exception if it is not able to upload
@StefanHasensperling
Copy link
Contributor Author

just a Question. Why does it fail on an Readonly Autoproperty?

@jogibear9988
Copy link
Member

Communication\PLCException.cs(11,24): error CS0840: 'DotNetSiemensPLCToolBoxLibrary.Communication.PLCException.ErrorCode.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accesors

@jogibear9988
Copy link
Member

Thank you for your work.
I will look into this and merge this week.

I also wanted to rework some parts of the Library, at least my connection configuration class is from my C# starting days and needs to be reworked

@StefanHasensperling
Copy link
Contributor Author

I also want to rework the connection configuration. I think tomorrow i will be able to make an new pull request. I have planed to replace all Int with their corresponding Enums.

@jogibear9988
Copy link
Member

that was also a plan from me. if you done this already, thanks.

The Connection configuration is now using Enumerations and Timespans where apropiate. This means existing code, using the configuration class directly might break. The configuration file also changed, but the system can load both, the new and old one! So the Configuration file loading mechanism is backwards compatible.

1. Changed int to corresponding Enumerations in PLCConnectionConfiguration and created new Enums where needed.

2. Changed ConnectionConfiguration Loading code, to minimize Breaking change impact. When the Connection file can not be loaded, it tries to fix the existing file and then retries once more. This means, the Configuration file is stil backwards compatible!

3. Timeouts are now defined as Timespan and not as int. PLCConnection is making apropiate use where necesary.

4. Refactored PLCConnection to use Enumerations

5. Refactored PLCConnection.Connect for better readability

6. Change ConnectionEditor so that the Timeout is now edited as miliseconds instead of microseconds. Internally it is an timespan anyway and the PLCConnection still converts it to Microseconds apropiatly

7. Addes lots of Comments to configuration parameters
@StefanHasensperling
Copy link
Contributor Author

StefanHasensperling commented Nov 1, 2016

OK. I just commited the reworked Configuration, its still not perfect, but its getting better. All Ints are Enumerations or Timespans now where appropriate. I but in some effort to keep the config file loading mechanism backward compatible.
Please read the commit message for more details (there where a lot of changes)

@jogibear9988
Copy link
Member

i will look

@jogibear9988
Copy link
Member

thanks

@jogibear9988 jogibear9988 merged commit befc950 into dotnetprojects:master Nov 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants