-
Notifications
You must be signed in to change notification settings - Fork 948
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
#245 unittest coverage #249
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* PYM-2: - The issue listed was due to wrong messages being passed by the user. Upon passing the right messages codes, the parser works as expected on all counts. - There is also changes that make the parser compatible with python2 and python3 - Verifier that the tool works on both python3 and python2 for all MODBUS message codes on TCP, RTU, and BIN * PYM-2: Checking the incoming framer. If te Framer is a Binary Framer, we take the unit address as the second incoming bite as opposed to the first bite. This is was done while fixing the message parsers for binary messages * PYM-2: Changed the modbus binary header size from 2 to 1. According to the docs: Modbus Binary Frame Controller:: [ Start ][Address ][ Function ][ Data ][ CRC ][ End ] 1b 1b 1b Nb 2b 1b * PYM-3: Script is now compatible with both python2 and python3 * WIP * PYM-2: Added a new switch: -t --transaction This switch is meant to be used when we wish to parse messages directly from the logs of Modbus. The format of a message as shown in the logs is like bellow: 0x7b 0x1 0x5 0x0 0x0 0xff 0x0 0x8c 0x3a 0x7d We can pass this as the message to the parser along with the -t witch to convert it into a compatible message to be parsed. EG: (modbus3) [~/pymodbus/examples/contrib]$ ./message-parser.py -b -t -p binary -m "0x7b 0x1 0x5 0x0 0x0 0xff 0x0 0x8c 0x3a 0x7d" ================================================================================ Decoding Message b'7b01050000ff008c3a7d' ================================================================================ ServerDecoder -------------------------------------------------------------------------------- name = WriteSingleCoilRequest transaction_id = 0x0 protocol_id = 0x0 unit_id = . [1] skip_encode = 0x0 check = 0x0 address = 0x0 value = 0x1 documentation = This function code is used to write a single output to either ON or OFF in a remote device. The requested ON/OFF state is specified by a constant in the request data field. A value of FF 00 hex requests the output to be ON. A value of 00 00 requests it to be OFF. All other values are illegal and will not affect the output. The Request PDU specifies the address of the coil to be forced. Coils are addressed starting at zero. Therefore coil numbered 1 is addressed as 0. The requested ON/OFF state is specified by a constant in the Coil Value field. A value of 0XFF00 requests the coil to be ON. A value of 0X0000 requests the coil to be off. All other values are illegal and will not affect the coil. ClientDecoder -------------------------------------------------------------------------------- name = WriteSingleCoilResponse transaction_id = 0x0 protocol_id = 0x0 unit_id = . [1] skip_encode = 0x0 check = 0x0 address = 0x0 value = 0x1 documentation = The normal response is an echo of the request, returned after the coil state has been written. * PYM-2: Removing additional dependancy and making use of existing porting tools * PYM-3: Removing additional dependancy and making use of existing porting tools * Initial Bitbucket Pipelines configuration * bitbucket-pipelines.yml edited online with Bitbucket * bitbucket-pipelines.yml edited online with Bitbucket * PYM-2: Updated the transaction tests for BinaryFramerTransaction. The header for Binary trasaction is of size 1. This was recrtified earlier commits of this branch. The test ensure these changes * PYM-6: Minor Cleanup task Removing the argument handler in TCP Syncronous server. This argument is not used any where. * PYM-6: ModbusUdpServer and ModbusTcpServer will now accept any legal Modbus request handler. The request handler being passed will have to be of instance ModbusBaseRequestHandler. The default request handler is ModbusDisconnectedRequestHandler. I.e., is no handler is passed, or if the handler is not of type ModbusBaseRequestHandler, ModbusDisconnectedRequestHandler will be made use of. * PYM-6: Removing uneccessary check if handler is of type ModbusBaseRequestHandler * PYM-8: Example that read from a database as a datastore * PYM-8: Added two new datastores that can be used. - SQLite3 - Reddis * Small fixes * Small fixes * Small fixes * Cleanup * PYM-8: Updated the example to first write a random value at a random afddress to a database and then read from that address * PYM-8: Added neccessary checks and methods to allow hassle free writes to database. The process first checks if the address and value are already present in the database before performing a write. This ensures that database transaction errors will now occur in cases where repetetive data is being written. * Cleanup: Removing pdb placed during testing and other comments * bitbucket-pipelines.yml deleted online with Bitbucket * #240 Fix PR failures * #240 fix Travis build failures * #190 fix import error in dbstore-update-server example * Small changes and typo fixed in pymodbus utilities and redis datastore helpers * Added tests for redis datastore helpers * Minor fixes to SQL datastore * Unit tests for SQL datastore - 100% coverage * Tests now compatible with python3 and python2
dhoomakethu
reviewed
Dec 4, 2017
#--------------------------------------------------------------------------# | ||
# initialize logging | ||
#--------------------------------------------------------------------------# | ||
import logging | ||
modbus_log = logging.getLogger("pymodbus") | ||
|
||
|
||
exp = ExceptionResponse(0x01, 0x0B) |
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.
Is this being supported ? Generation of exception response?
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.
No, this was supposed to go away in a cleanup.
Merged
dhoomakethu
approved these changes
Dec 22, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All tests at 90% and above.