The options object passed into the connect function.

interface ConnectOptions {
    auto2MegPhy?: boolean;
    autoDiscoverAll?: boolean;
    autoMaxMTU?: boolean;
    onConnected?: (
        data: {
            advertismentData: AdvertismentData;
            name: string;
            services?: Service[];
            state: ConnectionState;
            UUID: any;
        },
    ) => void;
    onDisconnected?: (data: { name: string; UUID: any }) => void;
    priority?: number;
    serviceUUIDs?: string[];
    transport?: number;
    UUID: string;
}

Properties

auto2MegPhy?: boolean

Selects 2M PHY when available (Android only)

autoDiscoverAll?: boolean

Discover all services on connection. Default is true. however connection will be slower For faster connection disable it and do the discovery with discoverServices (you can filter to discover only some services)

autoMaxMTU?: boolean

Selects maximum BLE MTU (247) (Android only)

onConnected?: (
    data: {
        advertismentData: AdvertismentData;
        name: string;
        services?: Service[];
        state: ConnectionState;
        UUID: any;
    },
) => void

Once the peripheral is connected this callback function is invoked.

onDisconnected?: (data: { name: string; UUID: any }) => void

Once the peripheral is disconnected this callback function is invoked.

priority?: number
serviceUUIDs?: string[]

Discover specified services on connection

transport?: number

transport selection (Android only)

UUID: string

The UUID of the peripheral to connect to.