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

Discourage register polymorphic behavior #26

Open
1 of 4 tasks
bruno-f-cruz opened this issue Dec 21, 2023 · 3 comments · May be fixed by #46
Open
1 of 4 tasks

Discourage register polymorphic behavior #26

bruno-f-cruz opened this issue Dec 21, 2023 · 3 comments · May be fixed by #46
Labels
documentation Improvements or additions to documentation proposal Request for a new feature

Comments

@bruno-f-cruz
Copy link
Member

  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
  • Specification: Not Started

Summary

Most of the app register's functionality that has been implemented to date relies on an assumption that, as far as I can tell, is not described in the protocol. Each register, regardless of the message type (i.e. READ, WRITE, EVENT) always returns the same "data", ideally the latest value kept in said register. This is essential from the host side as returns from the device can simply be interpreted as "READS" (i.e. WRITE messages are reads after setting a value, EVENT and READ are reads of a register without/with a requests, respectively) and piped through the same pipeline and parsed using the interface.

Motivation

A couple of edge cases that violate this assumption have surfaced and I think we should either 1: accept them or 2: make sure the protocol/standard is explicit on this behavior.

Detailed Design

My proposal is to actively discourage this polymorphic behavior by adding the following language to the protocol:

"Every payload returned from a given register must have the same datatype, length and always return the value of that register, regardless of the message type being returned. If a computation is required to be made on top of the register value for a specific message type. that will not be kept in the register's value, this event should be implemented in a second register"

Drawbacks

If we indeed want to allow polymorphic behavior per register this would effectively make that impossible

Alternatives

Not doing this will make users learn more app-specific edge cases and might break the automatically generated interfaces for some devices

Unresolved Questions

N\A

Design Meetings

TBD

@bruno-f-cruz bruno-f-cruz added the proposal Request for a new feature label Dec 21, 2023
@bruno-f-cruz bruno-f-cruz changed the title Discourage register polymorphic behavior contingent on message type Discourage register polymorphic behavior Dec 21, 2023
@bruno-f-cruz
Copy link
Member Author

Additionally, although obvious, we should make it very clear that registers not only share the same "function" or "behavior" but also payload structure (e.g. data type, payload size, etc...).

@bruno-f-cruz
Copy link
Member Author

Add to the protocol:
Examples of what to do (use frequency/period as an example) / what not to do (use camera frequency set and possible)
Concept of "units" or "quantity" the thing they represent
Make sure to add that register have the same data type and length regardless of message type

@bruno-f-cruz bruno-f-cruz added the documentation Improvements or additions to documentation label Apr 9, 2024
@bruno-f-cruz
Copy link
Member Author

Related to #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation proposal Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant