libmodbus icon indicating copy to clipboard operation
libmodbus copied to clipboard

Add file operations functions

Open mek-x opened this issue 7 years ago • 5 comments

Add support for Read File Record (0x14) and Write File Record (0x15) functions. Supports single file read/write.

mek-x avatar Sep 10 '18 18:09 mek-x

There was already a pull-request #407 trying to add file-support. Not integrated though. Have you seen it?

pboettch avatar Sep 11 '18 16:09 pboettch

@pboettch I have seen it, also looks fine too. I've pushed my changes since those were left after implementing this functionality to one project I was doing, so I though I could share them. Personally I don't know which solution is better/cleaner.

mek-x avatar Sep 12 '18 13:09 mek-x

I'm currently implementing the reply-function in my fork and took a look at the MODBUS-spec and figured out that the FILE-operation allow requesting multiple sub-requests for 0x14 and 0x15. Either I overlooked it or you didn't implement it in your reply-implementation. Could you explain why? Could it be, because libmodbus itself does not allow doing multiple sub-requests?

pboettch avatar Sep 13 '18 11:09 pboettch

To avoid duplicated work, I implemented sub-request handling for file-read/write on a local repo, I will publish when the reply is working as well.

pboettch avatar Sep 13 '18 13:09 pboettch

@pboettch that's correct. This implementation is working only with single sub-request due to simplicity reasons. libmodbus should handle it just fine, only the protocol handling will be more complex. It was enough for my use cases. If you are planning to extend it, that would be great.

mek-x avatar Sep 14 '18 07:09 mek-x