Skip to content

Conversation

@rtollert
Copy link

Fix for #71; untested.

modbus initialize API object.vi:

  • New design assertions:
    1. Refcounts (Clients Count DVRs) are never closed.
    2. All API objects participate in refcounting, not just serial masters.
      This does not affect the behavior of things that aren't serial masters, and dramatically simplifies logic both here and in close.vi.
  • Accordingly, the FGV variant now holds (Modbus API, refcount) tuples instead of (Modbus Master, refcount) tuples. And it is notionally getting indexed by (class, address) tuples, e.g. ("serial master", VISA instrument), or ("TCP master", IP address, port).

close.vi:

  • Unwire "error in" from Decrement Clients Count.vi and the rest of that shutdown chain, to ensure that it always runs. This helps preserve normal close semantics for this VI.
  • Remove Delete DVR call to Clients Count DVR, because modbus initialize API object.vi is now guaranteed to hold it open. Add a brief comment to this effect. Reorder final Merge Errors call accordingly.

Build lookup key for configuration.vi:

  • Builds the strings of (class, address) tupes which are used to index into the FGV variant in modbus initialize API object.vi.

  • "ok?" indicator controls whether or not reusing the modbus instance from the FGV is permitted -- false for everything but serial masters. (Refcount DVRs are always reused.)

Fix for LabVIEW-DCAF#71.

modbus initialize API object.vi:
- New design assertions:
  1. Refcounts (Clients Count DVRs) are never closed.
  2. All API objects participate in refcounting, not just serial
     masters.
  This does not affect the behavior of things that aren't serial masters,
  and dramatically simplifies logic both here and in close.vi.
- Accordingly, the FGV variant now holds (Modbus API, refcount) tuples
  instead of (Modbus Master, refcount) tuples. And it is notionally getting
  indexed by (class, address) tuples, e.g. ("serial master", VISA
  instrument), or ("TCP master", IP address, port).

close.vi:
- Unwire "error in" from Decrement Clients Count.vi and the rest of that
  shutdown chain, to ensure that it always runs. This helps preserve normal
  close semantics for this VI.
- Remove Delete DVR call to Clients Count DVR, because modbus initialize API
  object.vi is now guaranteed to hold it open. Add a brief comment to this
  effect. Reorder final Merge Errors call accordingly.

Build lookup key for configuration.vi:
- Builds the strings of (class, address) tupes which are used to index into
  the FGV variant in modbus initialize API object.vi.

- "ok?" indicator controls whether or not reusing the modbus instance from
  the FGV is permitted -- false for everything but serial masters. (Refcount
  DVRs are always reused.)
Copy link
Contributor

@agomez08 agomez08 left a comment

Choose a reason for hiding this comment

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

Changes look good and work as described

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.

2 participants