-
Notifications
You must be signed in to change notification settings - Fork 1k
#82 error response api #262
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
Conversation
response codes
Eg:
response = client.write_registers(...)
assert(response.isError() == False)
|
@dhoomakethu , all tests using the error API |
| count, | ||
| self.unit_id) | ||
| return result.function_code < 0x80 | ||
| return result.isError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be return not result.isError()
examples/functional/base_runner.py
Outdated
| rq = self.client.write_coil(1, True) | ||
| rr = self.client.read_coils(1,1) | ||
| self.__validate(rq, lambda r: r.function_code < 0x80) | ||
| self.__validate(rq, lambda r: r.isError()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check should be for not isError()
examples/functional/base_runner.py
Outdated
| rq = self.client.write_coils(1, [True]*8) | ||
| rr = self.client.read_coils(1,8) | ||
| self.__validate(rq, lambda r: r.function_code < 0x80) | ||
| self.__validate(rq, lambda r: r.isError()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
examples/functional/base_runner.py
Outdated
| rq = self.client.write_coils(1, [False]*8) | ||
| rr = self.client.read_discrete_inputs(1,8) | ||
| self.__validate(rq, lambda r: r.function_code < 0x80) | ||
| self.__validate(rq, lambda r: r.isError()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
examples/functional/base_runner.py
Outdated
| rq = self.client.write_register(1, 10) | ||
| rr = self.client.read_holding_registers(1,1) | ||
| self.__validate(rq, lambda r: r.function_code < 0x80) | ||
| self.__validate(rq, lambda r: r.isError()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
pymodbus/datastore/remote.py
Outdated
| _logger.debug("validate[%d] %d:%d" % (fx, address, count)) | ||
| result = self.__get_callbacks[self.decode(fx)](address, count) | ||
| return result.function_code < 0x80 | ||
| return True if result.isError() is False else False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simplify return not result.isError()
|
@dhoomakethu , this is ready now. |
e4abb1a to
bbf6fed
Compare
Using the Error Response API in place of manually checking for error codes in examples