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

Make Signal reading["value"] and value be the same #535

Open
coretl opened this issue Aug 20, 2024 · 0 comments
Open

Make Signal reading["value"] and value be the same #535

coretl opened this issue Aug 20, 2024 · 0 comments
Milestone

Comments

@coretl
Copy link
Collaborator

coretl commented Aug 20, 2024

After bluesky/bluesky#1800 we have a Reading[T] where value is of type T.
After #522 we will have SignalBackend.get_value() and SignalBackend.get_reading()["value"] being the same for all types.
This ticket is to remove the possibility for them to be different.

Change

ReadingValueCallback = Callable[[Reading, T], None]

to

ReadingCallback = Callable[[Reading[T]], None]

def set_callback(self, callback: Optional[ReadingValueCallback[T]]) -> None:

to

def set_callback(self, callback: Optional[ReadingCallback[T]]) -> None:

def _callback(self, reading: Reading, value: T):
self._signal.log.debug(
f"Updated subscription: reading of source {self._signal.source} changed"
f"from {self._reading} to {reading}"
)
self._reading = reading
self._value = value

to

def _callback(self, reading: Reading[T]): 
    self._signal.log.debug( 
        f"Updated subscription: reading of source {self._signal.source} changed" 
        f"from {self._reading} to {reading}" 
    ) 
    self._reading = reading 
    self._value = reading["value"]

Then tidy up all the converters so that they produce reading, rather than reading, value, which means the Converter.value can probably disappear

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

No branches or pull requests

1 participant