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

MIDI BLE peripheral - How to send events #192

Open
sensn opened this issue Apr 11, 2024 · 0 comments
Open

MIDI BLE peripheral - How to send events #192

sensn opened this issue Apr 11, 2024 · 0 comments

Comments

@sensn
Copy link

sensn commented Apr 11, 2024

Hello,
I previously used an android lib, to make my phone act as a BLE MIDI device and send data.

private @NotNull final BluetoothGattCharacteristic measurement = new BluetoothGattCharacteristic(MIDI_MEASUREMENT_CHARACTERISTIC_UUID, PROPERTY_READ | PROPERTY_WRITE_NO_RESPONSE | PROPERTY_NOTIFY, PERMISSION_READ | PERMISSION_WRITE);

While playing around with the flutter example, I found out that I need to set service UUID, and now I can connect to the MIDI-BLE-peripheral.
But I don't know how to send changing data (from a loop etc...) .

In weliems BleSeverExample I can just call " notifyCharacteristicChanged(event, measurement);
after setting up and establishing the connection.

My config with weliems Java example is:

  public void startAdvertising(UUID serviceUUID) {
        AdvertiseSettings advertiseSettings = new AdvertiseSettings.Builder()
                .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY)
                .setConnectable(true)
                .setTimeout(0)
                .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM)
                .build();
    AdvertiseData advertiseData = new AdvertiseData.Builder()
            .setIncludeTxPowerLevel(true)
            .addServiceUuid(new ParcelUuid(serviceUUID))
            .build();

    AdvertiseData scanResponse = new AdvertiseData.Builder()
            .setIncludeDeviceName(true)
            .build();

    peripheralManager.startAdvertising(advertiseSettings, advertiseData, scanResponse);`

My questions are:

  • Is it possible with the flutter plugin to write flags to Gatt Characteristics? (PROPERTY_READ | PROPERTY_WRITE_NO_RESPONSE | PROPERTY_NOTIFY, PERMISSION_READ | PERMISSION_WRITE)

  • Is it possible to setTimeout(0) ? I want the service to keep advertising, and send data when i want to. notifyCharacteristicChanged(event, measurement).

  • can I set Descriptors? In the Java example I need to use measurement.addDescriptor(getCccDescriptor()); for it to work.

  • Is it possible to use this flutter plugin as BLE-Midi- peripheral which can read and write data?

thanks

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