Skip to content

Improve bluetoothManager class#48

Merged
HaudinFlorence merged 5 commits intoQuantStack:mainfrom
HaudinFlorence:improve_bluetooth_manager_class
Apr 29, 2026
Merged

Improve bluetoothManager class#48
HaudinFlorence merged 5 commits intoQuantStack:mainfrom
HaudinFlorence:improve_bluetooth_manager_class

Conversation

@HaudinFlorence
Copy link
Copy Markdown
Member

@HaudinFlorence HaudinFlorence commented May 6, 2025

Improve the bluetoothManager class

@HaudinFlorence HaudinFlorence force-pushed the improve_bluetooth_manager_class branch from dd2a86c to 3af1e3a Compare May 6, 2025 21:58
Comment thread src/bluetooth/BluetoothManager.ts Outdated
Comment on lines +245 to +248
private _registeredByAPlugin: Signal<
this,
BluetoothManager.DeviceTypeRegistry
>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this emitting a device type registry? I think this is probably not what you want to emit.

Copy link
Copy Markdown
Member Author

@HaudinFlorence HaudinFlorence May 9, 2025

Choose a reason for hiding this comment

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

@afshin Thanks for the review. I guess we'd rather want to emit the device type

Comment thread src/bluetooth/BluetoothManager.ts Outdated
Comment thread src/movehub-extension/index.ts Outdated
Comment on lines +60 to +62
bluetoothManager.deviceTypeRegistry.registeredByAPlugin.emit(
bluetoothManager.deviceTypeRegistry
);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Exposing a full Signal instead of an ISignal is typically discouraged because a signal should almost always be emitted by the class that owns it and not by something outside. In this case, I think .add(...) inside the device type registry should emit an .added signal.

@HaudinFlorence HaudinFlorence self-assigned this Mar 17, 2026
Comment thread src/bluetooth/BluetoothManager.ts Outdated
Comment on lines 110 to 113
public registeredByAPlugin: Signal<
BluetoothManager,
BluetoothManager.DeviceRegistry
BluetoothManager.DeviceTypeRegistry
>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This property is declared but no longer initialized in the constructor (the new Signal(...) assignment was removed). It will be undefined at runtime.

Since IBluetoothManager no longer includes registeredByAPlugin and its role is now served by DeviceTypeRegistry.added, this declaration should be removed.

@afshin
Copy link
Copy Markdown
Member

afshin commented Mar 18, 2026

Please run jlpm lint on this codebase as well. I don't have the ability to push to your branch, but if I run lint locally it catches a few things.

Comment thread src/movehub-extension/index.ts Outdated
Comment on lines 59 to 66
bluetoothManager.deviceTypeRegistry.add(movehubRegistryItem);
bluetoothManager.deviceTypeRegistry.added.connect(
async (sender, movehubRegistryItem) => {
console.warn(
`New item from category ${movehubRegistryItem.deviceType} is added to the deviceType registry.`
);
})
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add() emits the added signal, but the listener is connected on the next line, so it will never fire for this item. The listener and the add() call should be swapped.

Comment thread src/bluetooth/BluetoothManager.ts Outdated
IDeviceTypeRegistryItem
>;

public registryItem: IDeviceTypeRegistryItem;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we expect no client to access this API surface area, we should remove it.

@HaudinFlorence
Copy link
Copy Markdown
Member Author

Thanks for the review @afshin I should normally have addressed your comments

@HaudinFlorence
Copy link
Copy Markdown
Member Author

HaudinFlorence commented Mar 26, 2026

@afshin Do you think I can merge this PR?

@HaudinFlorence HaudinFlorence merged commit 653d4ff into QuantStack:main Apr 29, 2026
7 checks passed
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