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

Release 1.4.0 #253

Merged
merged 24 commits into from Jan 3, 2018
Merged

Release 1.4.0 #253

merged 24 commits into from Jan 3, 2018

Conversation

dhoomakethu
Copy link
Contributor

@dhoomakethu dhoomakethu commented Dec 20, 2017

1.4.0 Pre release
Wait till #252 and #249 is merged in to dev

dhoomakethu and others added 11 commits October 26, 2017 11:15
Currently some of the asynchronous dependencies (pyasn1, pycrypto) are
listed under a 'twisted' extra, but twisted is not. This commit moves
twisted to the 'twisted' extra, so that `pip install pymodbus['twisted']
installs twisted and all async dependencies, and `pip install pymodbus`
installs only pyserial.
Add issue field specific to Modbus server /client used
…#242)

to see weather the thread in which the helpers are executed are the
Main thread or the spawned thread.

This infomation is passed to reactor.run() to the flag
installSignalHandlers. True is passed if the thread is a main
thread, else false.

This is done to prevent errors when running the helpers from a
spawned thread.
* New helper function to help stop Asynchronous server are being added.
Calling this helper function will kill the main thread

* #84: Removing redundant parameters to method _is_main_thread

* #84: Fixed loggers

* #84: Retaining one generic StopServer command that will cater to both TCP and Seriel Server

* #84 Add docuementation to StopServer helper function
@dhoomakethu dhoomakethu changed the title Dev Release 1.4.0 Dec 20, 2017
dhoomakethu and others added 7 commits December 22, 2017 07:57
* 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
* Trying to fix #210
1. Using if __name__ == "__main__" clause in example to avoid running them while generating docs
2. Trying to enforce PEP-8 compliant code + PYTHON2-3 compatibale code with examples as much as possible
3. Renaming examples with "-" to "_" for the ease of documentation generation
4. Minor changes  with setup and setup commands
5. Support documentation creation from make file
6. Remove unnecessary html and pdf files from the doc folder

* Fix makefile

* Remove unwanted files and folders from doc folder

* Add seperated requirements for Docs and add .readthedocs.yml

* Update requirements for docs
@dhoomakethu dhoomakethu merged commit 4ed1f1a into master Jan 3, 2018
self.framer.processIncomingPacket(data, self._execute)
unit_address = byte2int(data[0])
if unit_address in self.factory.store:
self.framer.processIncomingPacket(data, self._execute)
Copy link
Contributor

Choose a reason for hiding this comment

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

This completely breaks using unit ids with modbusTCP. 0 is only the correct offset for RTU framed packets. You've added a fixed RTU offset into the core server code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why on earth isn't this just being handled in the framer, it seems to be already handled there anyway, and even if the address doesn'tmatch on serial, you still need to swallow all the remaining bytes on the wire.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@karlp there is an issue already for that #256 and there is also a branch with the fix https://github.com/riptideio/pymodbus/compare/%23256-Fix-TCP-Server-Transactions

If you think you have a better solution please raise a PR rather than complaining. You could have searched for the issues before commenting here. Also note, it will be part of the upcoming release . I hope this answers you.

Copy link
Contributor

Choose a reason for hiding this comment

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

If your merging and committing work had been cleaner, it would have been feasible to review your changes at the time. There was no way anyone could sanely attempt to review things like PR #253 so it's not surprising that bugs crept in. Please consider what your patches look like, not just commit and move forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, thanks for the feedback. I will keep that in mind. Your are free to fix them and raise a PR or raise an issue so others can take care of it when ever time permits.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants