import PQueue from 'p-queue';
import { AdvertismentData, BluetoothCommon, BluetoothOptions, ConnectOptions, ConnectionState, DisconnectOptions, DiscoverCharacteristicsOptions, DiscoverOptions, DiscoverServicesOptions, MtuOptions, ReadOptions, ReadRSSIOptions, ReadResult, Service, StartNotifyingOptions, StartScanningOptions, StopNotifyingOptions, WriteOptions } from './index.common';
export declare function getBluetoothInstance(): Bluetooth;
export { AdvertismentData, BleTraceCategory, BluetoothError, Characteristic, ConnectOptions, DisconnectOptions, DiscoverCharacteristicsOptions, DiscoverOptions, DiscoverServicesOptions, MtuOptions, Peripheral, ReadOptions, ReadResult, Service, StartNotifyingOptions, StartScanningOptions, StopNotifyingOptions, WriteOptions } from './index.common';
export declare enum ScanMode {
    LOW_LATENCY = 0,// = android.bluetooth.le.ScanSettings.SCAN_MODE_LOW_LATENCY,
    BALANCED = 1,// = android.bluetooth.le.ScanSettings.SCAN_MODE_BALANCED,
    LOW_POWER = 2,// = android.bluetooth.le.ScanSettings.SCAN_MODE_LOW_POWER,
    OPPORTUNISTIC = 3
}
export declare enum MatchMode {
    AGGRESSIVE = 0,// = android.bluetooth.le.ScanSettings.MATCH_MODE_AGGRESSIVE,
    STICKY = 1
}
export declare enum MatchNum {
    MAX_ADVERTISEMENT = 0,// = android.bluetooth.le.ScanSettings.MATCH_NUM_MAX_ADVERTISEMENT,
    FEW_ADVERTISEMENT = 1,// = android.bluetooth.le.ScanSettings.MATCH_NUM_FEW_ADVERTISEMENT,
    ONE_ADVERTISEMENT = 2
}
export declare enum CallbackType {
    ALL_MATCHES = 0,// = android.bluetooth.le.ScanSettings.CALLBACK_TYPE_ALL_MATCHES,
    FIRST_MATCH = 1,// = android.bluetooth.le.ScanSettings.CALLBACK_TYPE_FIRST_MATCH,
    MATCH_LOST = 2
}
export declare enum Phy {
    LE_1M = 0,// = android.bluetooth.BluetoothDevice.PHY_LE_1M,
    LE_CODED = 1,// = android.bluetooth.BluetoothDevice.PHY_LE_CODED,
    LE_ALL_SUPPORTED = 2
}
export declare function uuidToString(uuid: android.os.ParcelUuid | string | java.util.UUID): string;
export declare function arrayToNativeByteArray(val: any): any;
export declare function byteArrayToBuffer(value: any): ArrayBufferLike;
export declare function stringToUuid(uuidStr: string): java.util.UUID;
export type BluetoothGattCallback = new (owner: WeakRef<Bluetooth>) => android.bluetooth.BluetoothGattCallback;
export type SubBluetoothGattCallback = Partial<android.bluetooth.BluetoothGattCallback>;
export interface BluetoothGattCallbackWithSubCallback extends android.bluetooth.BluetoothGattCallback {
    addSubDelegate(delegate: SubBluetoothGattCallback): any;
    removeSubDelegate(delegate: SubBluetoothGattCallback): any;
}
export type DisconnectListener = (address: any) => void;
export declare class Bluetooth extends BluetoothCommon {
    private _adapter;
    get adapter(): globalAndroid.bluetooth.BluetoothAdapter;
    private _bluetoothManager;
    get bluetoothManager(): globalAndroid.bluetooth.BluetoothManager;
    _bluetoothGattCallback: BluetoothGattCallbackWithSubCallback;
    get bluetoothGattCallback(): BluetoothGattCallbackWithSubCallback;
    private scanCallback;
    private LeScanCallback;
    gattQueue: PQueue | undefined;
    static readonly android: {
        ScanMode: typeof ScanMode;
        MatchMode: typeof MatchMode;
        MatchNum: typeof MatchNum;
        CallbackType: typeof CallbackType;
    };
    /**
     * Connections are stored as key-val pairs of UUID-Connection.
     * So something like this:
     * [{
     *   34343-2434-5454: {
     *     state: 'connected',
     *     discoveredState: '',
     *     operationConnect: someCallbackFunction
     *   },
     *   1323213-21321323: {
     *     ..
     *   }
     * }, ..]
     */
    connections: {
        [k: string]: {
            state: ConnectionState;
            onConnected?: (e: {
                UUID: string;
                name: string;
                state: string;
                services?: Service[];
                advertismentData: AdvertismentData;
                mtu?: number;
            }) => void;
            onDisconnected?: (e: {
                UUID: string;
                name: string;
            }) => void;
            device?: android.bluetooth.BluetoothGatt;
            onNotifyCallbacks?: {
                [k: string]: (result: ReadResult) => void;
            };
            advertismentData?: AdvertismentData;
        };
    };
    constructor(restoreIdentifierOrOptions?: string | Partial<BluetoothOptions>);
    clear(): void;
    broadcastRegistered: boolean;
    registerBroadcast(): void;
    unregisterBroadcast(): void;
    onListenerAdded(eventName: string, count: number): void;
    onListenerRemoved(eventName: string, count: number): void;
    stop(): void;
    getAndroidLocationManager(): android.location.LocationManager;
    hasLocationPermission(): Promise<boolean>;
    requestLocationPermission(): Promise<boolean>;
    isGPSEnabled(): any;
    enableGPS(): Promise<void>;
    enable(): Promise<unknown>;
    isBluetoothEnabled(): Promise<boolean>;
    isConnected(args: any): Promise<boolean>;
    openBluetoothSettings(): Promise<void>;
    scanningReferTimer: {
        timer?: NodeJS.Timeout;
        resolve?: Function;
    };
    private stopCurrentScan;
    clearAdvertismentCache(): void;
    startScanning(args: StartScanningOptions): Promise<void>;
    stopScanning(): void;
    getDevice(args: DisconnectOptions): Promise<globalAndroid.bluetooth.BluetoothDevice>;
    connect(args: ConnectOptions): Promise<any>;
    disconnect(args: DisconnectOptions): Promise<void>;
    private addToGattQueue;
    private addToQueue;
    read(args: ReadOptions): Promise<any>;
    requestMtu(args: MtuOptions): Promise<any>;
    private getGattDevice;
    readRssi(args: ReadRSSIOptions): Promise<any>;
    private writeValueToChar;
    writeInternal(args: WriteOptions, writeType: number, methodName: string): Promise<any>;
    write(args: WriteOptions): Promise<any>;
    writeWithoutResponse(args: WriteOptions): Promise<any>;
    startNotifying(args: StartNotifyingOptions): Promise<any>;
    stopNotifying(args: StopNotifyingOptions): Promise<any>;
    private refreshDeviceCache;
    discoverServices(args: DiscoverServicesOptions & {
        all?: boolean;
    }): Promise<{
        services: Service[];
    }>;
    discoverCharacteristics(args: DiscoverCharacteristicsOptions): Promise<void>;
    discoverAll(args: DiscoverOptions): Promise<{
        services: Service[];
    }>;
    private disconnectListeners;
    addDisconnectListener(delegate: DisconnectListener): void;
    removeDisconnectListener(delegate: DisconnectListener): void;
    gattDisconnect(gatt: android.bluetooth.BluetoothGatt): void;
    private _findNotifyCharacteristic;
    private select2MegPhy;
    private attachSubDelegate;
    private _findCharacteristicOfType;
    private _getWrapper;
    private _isEnabled;
}
