mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-22 01:19:36 +08:00
feat(bluetooth-le): Allow specifying transport mode for Android (#3571)
This commit is contained in:
parent
68d245ef2c
commit
b3d5baa46e
@ -99,6 +99,38 @@ export interface RespondParams {
|
|||||||
offset?: number;
|
offset?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ConnectionParams {
|
||||||
|
/** The address/identifier provided by the scan's return object */
|
||||||
|
address: string;
|
||||||
|
/** Automatically connect as soon as the remote device becomes available (Android) */
|
||||||
|
autoConnect?: boolean;
|
||||||
|
/**
|
||||||
|
* Transport mode. Available from API 23 (Android).
|
||||||
|
* If none is specified the default behavior is TRANSPORT_AUTO
|
||||||
|
*
|
||||||
|
* Note: On Android 10, TRANSPORT_AUTO can lead to connection errors with Status code 133.
|
||||||
|
* In this case TRANSPORT_LE can be used.
|
||||||
|
*/
|
||||||
|
transport?: AndroidGattTransportMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum AndroidGattTransportMode {
|
||||||
|
/**
|
||||||
|
* No preference of physical transport for GATT connections to remote dual-mode devices
|
||||||
|
*/
|
||||||
|
TRANSPORT_AUTO = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefer BR/EDR transport for GATT connections to remote dual-mode devices
|
||||||
|
*/
|
||||||
|
TRANSPORT_BREDR = 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefer LE transport for GATT connections to remote dual-mode devices
|
||||||
|
*/
|
||||||
|
TRANSPORT_LE = 2,
|
||||||
|
}
|
||||||
|
|
||||||
export interface CharacteristicParams extends Params {
|
export interface CharacteristicParams extends Params {
|
||||||
/** An array of characteristic IDs to discover or empty array / null */
|
/** An array of characteristic IDs to discover or empty array / null */
|
||||||
characteristics?: string[];
|
characteristics?: string[];
|
||||||
@ -543,15 +575,15 @@ export class BluetoothLE extends IonicNativePlugin {
|
|||||||
* Connect to a Bluetooth LE device
|
* Connect to a Bluetooth LE device
|
||||||
* @param connectSuccess The success callback that is passed with device object
|
* @param connectSuccess The success callback that is passed with device object
|
||||||
* @param connectError The callback that will be triggered when the connect operation fails
|
* @param connectError The callback that will be triggered when the connect operation fails
|
||||||
* @param params The address/identifier
|
* @param params The connection params
|
||||||
*
|
*
|
||||||
* @param {{address: string, autoConnect: boolean}} params
|
* @param {ConnectionParams} params
|
||||||
* @returns {(Observable<{ status: DeviceInfo }>)}
|
* @returns {(Observable<{ status: DeviceInfo }>)}
|
||||||
* success: device object with status
|
* success: device object with status
|
||||||
* error: The callback that will be triggered when the unbond operation fails
|
* error: The callback that will be triggered when the unbond operation fails
|
||||||
*/
|
*/
|
||||||
@Cordova({ callbackOrder: 'reverse', observable: true })
|
@Cordova({ callbackOrder: 'reverse', observable: true })
|
||||||
connect(params: { address: string; autoConnect?: boolean }): Observable<DeviceInfo> {
|
connect(params: ConnectionParams): Observable<DeviceInfo> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user