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 binding alignment #1261

Merged
merged 14 commits into from
Apr 10, 2024
Merged

Modbus binding alignment #1261

merged 14 commits into from
Apr 10, 2024

Conversation

egekorkan
Copy link
Member

Fixes #1234 and #1168 (when the PR is ready ofc).

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.81%. Comparing base (ff32218) to head (7302262).
Report is 27 commits behind head on master.

❗ Current head 7302262 differs from pull request most recent head e886d98. Consider uploading reports for the commit e886d98 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1261   +/-   ##
=======================================
  Coverage   77.81%   77.81%           
=======================================
  Files          84       84           
  Lines       17523    17523           
  Branches     1781     1781           
=======================================
  Hits        13635    13635           
  Misses       3853     3853           
  Partials       35       35           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@egekorkan egekorkan marked this pull request as ready for review April 8, 2024 16:04
@egekorkan egekorkan requested a review from relu91 as a code owner April 8, 2024 16:04
@egekorkan
Copy link
Member Author

Below is a code I have used that does full TD parsing. I will edit the code based on the changes: https://gist.github.com/egekorkan/e2489da6ca5528720ea10f601c4a0166

It acts against https://github.com/eclipse-thingweb/test-things/blob/main/things/elevator/modbus/js/main.js with modified TD (in the code) but unmodified thing code

Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

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

Good to go, just some minor point below. Also a question: the modv:type and brothers are not yet implemented right?

packages/binding-modbus/src/modbus-client.ts Outdated Show resolved Hide resolved
private overrideFormFromURLPath(input: ModbusForm) {
// This generates a form with url content based on the uri scheme
// Ideally, more code should be refactored to use uri only
private generateFormFromURLPath(input: ModbusForm) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with finding a better name for this function. However, generate does not really explain the fact that the function actually modifies the form in input with the values taken from the URI. We can clone the form input and make it immutable to better fit the description.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. We are overriding the form but more that we are adding terms into it whereas before the URI values would be prioritized (no code change though). How about addFormElementsFromURLPath

Copy link
Member

Choose a reason for hiding this comment

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

I like the idea of not changing the input form and rather clone and update. Doing so the term generate with reporting back the update is fine I think

Copy link
Member Author

Choose a reason for hiding this comment

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

This is now done. Can we resolve this thread and merge the PR?

@egekorkan
Copy link
Member Author

Also a question: the modv:type and brothers are not yet implemented right?

No not yet. I didn't have time for those but I can do them as a follow-up PR.

Copy link
Member

@danielpeintner danielpeintner left a comment

Choose a reason for hiding this comment

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

Find some comments below

servient.addClientFactory(new ModbusClientFactory());

async function main() {
let td = {}; // see https://github.com/eclipse-thingweb/test-things/blob/main/things/elevator/modbus/js/modbus-elevator.td.json
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you want to include the TD ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is changing at the moment due to the changes in this PR. Once this PR is merged and that TD is updated, I can add it inline. Another alternative would be to add a fetch method but that would imply adding the HTTP binding

packages/binding-modbus/src/modbus.ts Outdated Show resolved Hide resolved
Copy link
Member

@relu91 relu91 left a comment

Choose a reason for hiding this comment

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

Good to go! thank you Ege!!

@relu91 relu91 merged commit fdc678b into master Apr 10, 2024
10 checks passed
@egekorkan egekorkan deleted the ege-modbus branch April 10, 2024 13:01
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.

Modbus readme is outdated
3 participants