Skip to content

Missing filter for capacitor connect(), missing deviceId in ConnectionInfo #13

Description

@wanderingstan

Currently the Capacitor implemention doesn't support name and service filtering like RequestDeviceOptions on bluetooth_impl.ts.

If you're open to it, I'd like to work on a PR to add these filters to capacitor_ble_impl.ts.

capacitor_ble_impl.ts:

export interface NiimbotCapacitorBleClientConnectOptions {
  /**
   * Skip device picker dialog and connect to given device ID.
   *
   * On **Android** this is the BLE MAC address.
   *
   * On **iOS** and **web** it is an identifier.
   */
  deviceId?: string;
}

https://github.com/MultiMote/niimbluelib/blob/main/src/client/capacitor_ble_impl.ts#L10C1-L19C2

bluetooth_impl: https://github.com/MultiMote/niimbluelib/blob/main/src/client/bluetooth_impl.ts#L40C25-L45C7

I'd also like to add deviceId to ConnectionInfo, to facilitate automatically connecting to the same device on future runs of the capacitor app.

    const result: ConnectionInfo = {
      deviceName: device.name,
      result: this.info.connectResult ?? ConnectResult.FirmwareErrors,
    };

https://github.com/MultiMote/niimbluelib/blob/main/src/client/capacitor_ble_impl.ts#L81

I'll be doing this work for my project regardless, and would love to pass my work back to your excellent project!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions