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

WebAssembly Port #43

Open
tthiery opened this issue Jul 4, 2020 · 2 comments
Open

WebAssembly Port #43

tthiery opened this issue Jul 4, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@tthiery
Copy link
Member

tthiery commented Jul 4, 2020

Enable the usage of the SharpBrick.PoweredUp library in Blazor on WebAssembly. For that a bridge between Blazor and WebBluetooth is required. After the bridge, an adapter to the SharpBrick.PoweredUp.Bluetooth interface is required.

@tthiery tthiery added this to the vX.0 - .NET 5 milestone Jul 4, 2020
@tthiery tthiery added the enhancement New feature or request label Jul 4, 2020
@tthiery
Copy link
Member Author

tthiery commented Sep 26, 2020

The WebBluetooth stack is not fast enough to setup a GATT characteristics handler. A member of the WebBluetooth WG was friendly enough and filed an issue as a request of my StackOverflow question.

Simultaneously reported to the LEGO Protocol repository in hope to get a command to explicit query the information which are send automatically in the beginning of the protocol setup (hub attached io).

@tthiery
Copy link
Member Author

tthiery commented Sep 26, 2020

Minimum reproducable issue in the browser

function writeToLog(x) {
    console.log(x.target.value.buffer);
}
async function connectToLwpDevice() {
    const serviceUuid = "00001623-1212-EFDE-1623-785FEABCD123".toLowerCase();
    const characteristicUuid = "00001624-1212-EFDE-1623-785FEABCD123".toLowerCase();
    const device = await navigator.bluetooth.requestDevice({ filters: [{ services: [serviceUuid] }] });
    const connectedDevice = await device.gatt.connect();
    const service = await connectedDevice.getPrimaryService(serviceUuid);
    const characteristic = await service.getCharacteristic(characteristicUuid);
    characteristic.addEventListener('characteristicvaluechanged', writeToLog);
    await characteristic.startNotifications();
}

@tthiery tthiery removed this from the v5.0 (breaking) milestone May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant