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

[modbus] Expose modbus exceptions #4067

Merged
merged 4 commits into from
Oct 5, 2018

Conversation

mrbig
Copy link

@mrbig mrbig commented Oct 1, 2018

This is a minor addition to the modbus transport.

The modbus protocol uses a custom error handling method, where a few predefined exceptions can be sent to the master by the salve when it can not fulfill the request. These exception codes will tell the master what is the exact cause of the failure.

The modbus implementation in the master branch failed to expose this value, and that made writing sophisticated error handling impossible.

This change is related to an upcoming extension of the modbus addon, see #3216

This value tells what is the exact cause of the error. Clients receiving
this exception can use this value to handle errors better.

Also added documentation to error constants

Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much. Code looks good so far. I added some remarks.

Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@cweitkamp cweitkamp merged commit a4f1c7c into openhab:master Oct 5, 2018
@martinvw martinvw added this to the 2.4 milestone Dec 9, 2018
chaton78 pushed a commit to chaton78/openhab-addons that referenced this pull request Jan 1, 2019
* Added type getter to ModbusSlaveErrorResponseException

This value tells what is the exact cause of the error. Clients receiving
this exception can use this value to handle errors better.

* Added documentation to error constants

Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
Signed-off-by: Pascal Larin <plarin@gmail.com>
magx2 pushed a commit to magx2/openhab2-addons that referenced this pull request Mar 18, 2019
* Added type getter to ModbusSlaveErrorResponseException

This value tells what is the exact cause of the error. Clients receiving
this exception can use this value to handle errors better.

* Added documentation to error constants

Signed-off-by: Nagy Attila Gabor <mrbig@sneaker.hu>
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.

None yet

3 participants