import { BluetoothCommon, BluetoothOptions, ConnectOptions, DiscoverCharacteristicsOptions, DiscoverServicesOptions, MtuOptions, ReadOptions, ReadRSSIOptions, ReadResult, StartNotifyingOptions, StartScanningOptions, StopNotifyingOptions, WriteOptions } from './index.common';
export { BluetoothError, BleTraceCategory, CallbackType, Characteristic, ConnectOptions, DisconnectOptions, DiscoverCharacteristicsOptions, DiscoverOptions, DiscoverServicesOptions, MatchMode, MatchNum, MtuOptions, Peripheral, ReadOptions, ReadResult, ScanMode, Service, StartNotifyingOptions, StartScanningOptions, StopNotifyingOptions, WriteOptions } from './index.common';
import { DisconnectOptions } from '.';
export type SubPeripheralDelegate = Partial<CBPeripheralDelegate>;
export type SubCentralManagerDelegate = Partial<CBCentralManagerDelegate>;
export interface CBPeripheralWithDelegate extends CBPeripheral {
    delegate: CBPeripheralDelegateImpl;
}
/**
 * @link - https://developer.apple.com/documentation/corebluetooth/cbperipheraldelegate
 * The delegate of a CBPeripheral object must adopt the CBPeripheralDelegate protocol.
 * The delegate uses this protocol’s methods to monitor the discovery, exploration, and interaction of a remote peripheral’s services and properties.
 * There are no required methods in this protocol.
 */
declare class CBPeripheralDelegateImpl extends NSObject implements CBPeripheralDelegate {
    static ObjCProtocols: {
        prototype: CBPeripheralDelegate;
    }[];
    onNotifyCallbacks: {
        [k: string]: (result: ReadResult) => void;
    };
    private _owner;
    private subDelegates;
    addSubDelegate(delegate: SubPeripheralDelegate): void;
    removeSubDelegate(delegate: SubPeripheralDelegate): void;
    static new(): CBPeripheralDelegateImpl;
    initWithOwner(owner: WeakRef<Bluetooth>): CBPeripheralDelegateImpl;
    /**
     * Invoked when you discover the peripheral’s available services.
     * This method is invoked when your app calls the discoverServices(_:) method.
     * If the services of the peripheral are successfully discovered, you can access them through the peripheral’s services property.
     * If successful, the error parameter is nil.
     * If unsuccessful, the error parameter returns the cause of the failure.
     * @param peripheral [CBPeripheral] - The peripheral that the services belong to.
     * @param error [NSError] - If an error occurred, the cause of the failure.
     */
    peripheralDidDiscoverServices(peripheral: CBPeripheral, error?: NSError): void;
    /**
     * Invoked when you discover the included services of a specified service.
     * @param peripheral [CBPeripheral] - The peripheral providing this information.
     * @param service [CBService] - The CBService object containing the included service.
     * @param error [NSError] - If an error occurred, the cause of the failure.
     */
    peripheralDidDiscoverIncludedServicesForServiceError(peripheral: CBPeripheral, service: CBService, error?: NSError): void;
    /**
     * Invoked when you discover the characteristics of a specified service.
     * @param peripheral [CBPeripheral] - The peripheral providing this information.
     * @param service [CBService] - The CBService object containing the included service.
     * @param error [NSError] - If an error occurred, the cause of the failure.
     */
    peripheralDidDiscoverCharacteristicsForServiceError(peripheral: CBPeripheral, service: CBService, error?: NSError): void;
    /**
     * Invoked when you discover the descriptors of a specified characteristic.
     * @param peripheral [CBPeripheral] - The peripheral providing this information.
     * @param characteristic [CBCharacteristic] - The characteristic that the characteristic descriptors belong to.
     * @param error [NSError] - If an error occurred, the cause of the failure.
     */
    peripheralDidDiscoverDescriptorsForCharacteristicError(peripheral: CBPeripheral, characteristic: CBCharacteristic, error?: NSError): void;
    /**
     * Invoked when you retrieve a specified characteristic’s value, or when
     * the peripheral device notifies your app that the characteristic’s
     * value has changed.
     */
    peripheralDidUpdateValueForCharacteristicError(peripheral: CBPeripheral, characteristic: CBCharacteristic, error?: NSError): void;
    /**
     * Invoked when you retrieve a specified characteristic descriptor’s value.
     */
    peripheralDidUpdateValueForDescriptorError(peripheral: CBPeripheral, descriptor: CBDescriptor, error?: NSError): void;
    /**
     * Invoked when you write data to a characteristic’s value.
     */
    peripheralDidWriteValueForCharacteristicError(peripheral: CBPeripheral, characteristic: CBCharacteristic, error?: NSError): void;
    /**
     * Invoked when the peripheral receives a request to start or stop
     * providing notifications for a specified characteristic’s value.
     */
    peripheralDidUpdateNotificationStateForCharacteristicError(peripheral: CBPeripheral, characteristic: CBCharacteristic, error?: NSError): void;
    /**
     * IInvoked when you write data to a characteristic descriptor’s value.
     */
    peripheralDidWriteValueForDescriptorError(peripheral: CBPeripheral, descriptor: CBDescriptor, error?: NSError): void;
}
/**
 * @link - https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate
 * The CBCentralManagerDelegate protocol defines the methods that a delegate of a CBCentralManager object must adopt.
 * The optional methods of the protocol allow the delegate to monitor the discovery, connectivity, and retrieval of peripheral devices.
 * The only required method of the protocol indicates the availability of the central manager, and is called when the central manager’s state is updated.
 */
declare class CBCentralManagerDelegateImpl extends NSObject implements CBCentralManagerDelegate {
    static ObjCProtocols: {
        prototype: CBCentralManagerDelegate;
    }[];
    private _owner;
    private subDelegates;
    addSubDelegate(delegate: SubCentralManagerDelegate): void;
    removeSubDelegate(delegate: SubCentralManagerDelegate): void;
    static new(): CBCentralManagerDelegateImpl;
    initWithOwner(owner: WeakRef<Bluetooth>): CBCentralManagerDelegateImpl;
    /**
     * Invoked when a connection is successfully created with a peripheral.
     * This method is invoked when a call to connect(_:options:) is successful.
     * You typically implement this method to set the peripheral’s delegate and to discover its services.
     * @param central [CBCentralManager] - The central manager providing this information.
     * @param peripheral [CBPeripheral] - The peripheral that has been connected to the system.
     */
    centralManagerDidConnectPeripheral(central: CBCentralManager, peripheral: CBPeripheral): void;
    /**
     * Invoked when an existing connection with a peripheral is torn down.
     * This method is invoked when a peripheral connected via the connect(_:options:) method is disconnected.
     * If the disconnection was not initiated by cancelPeripheralConnection(_:), the cause is detailed in error.
     * After this method is called, no more methods are invoked on the peripheral device’s CBPeripheralDelegate object.
     * Note that when a peripheral is disconnected, all of its services, characteristics, and characteristic descriptors are invalidated.
     * @param central [CBCentralManager] - The central manager providing this information.
     * @param peripheral [CBPeripheral] - The peripheral that has been disconnected.
     * @param error? [NSError] - If an error occurred, the cause of the failure.
     */
    centralManagerDidDisconnectPeripheralError(central: CBCentralManager, peripheral: CBPeripheral, error?: NSError): void;
    /**
     * Invoked when the central manager fails to create a connection with a peripheral.
     * This method is invoked when a connection initiated via the connect(_:options:) method fails to complete.
     * Because connection attempts do not time out, a failed connection usually indicates a transient issue, in which case you may attempt to connect to the peripheral again.
     * @param central [CBCentralManager] - The central manager providing this information.
     * @param peripheral [CBPeripheral] - The peripheral that failed to connect.
     * @param error? [NSError] - The cause of the failure.
     */
    centralManagerDidFailToConnectPeripheralError(central: CBCentralManager, peripheral: CBPeripheral, error?: NSError): void;
    /**
     * Invoked when the central manager discovers a peripheral while scanning.
     * The advertisement data can be accessed through the keys listed in Advertisement Data Retrieval Keys.
     * You must retain a local copy of the peripheral if any command is to be performed on it.
     * In use cases where it makes sense for your app to automatically connect to a peripheral that is located within a certain range, you can use RSSI data to determine the proximity of a discovered peripheral device.
     * @param central [CBCentralManager] - The central manager providing the update.
     * @param peripheral [CBPeripheral] - The discovered peripheral.
     * @param advData [NSDictionary<string, any>] - A dictionary containing any advertisement data.
     * @param RSSI [NSNumber] - The current received signal strength indicator (RSSI) of the peripheral, in decibels.
     */
    centralManagerDidDiscoverPeripheralAdvertisementDataRSSI(central: CBCentralManager, peripheral: CBPeripheral, advData: NSDictionary<string, any>, RSSI: number): void;
    /**
     * Invoked when the central manager’s state is updated.
     * You implement this required method to ensure that Bluetooth low energy is supported and available to use on the central device.
     * You should issue commands to the central manager only when the state of the central manager is powered on, as indicated by the poweredOn constant.
     * A state with a value lower than poweredOn implies that scanning has stopped and that any connected peripherals have been disconnected.
     * If the state moves below poweredOff, all CBPeripheral objects obtained from this central manager become invalid and must be retrieved or discovered again.
     * For a complete list and discussion of the possible values representing the state of the central manager, see the CBCentralManagerState enumeration in CBCentralManager.
     * @param central [CBCentralManager] - The central manager providing this information.
     */
    centralManagerDidUpdateState(central: CBCentralManager): void;
    /**
     * Invoked when the central manager is about to be restored by the system.
     * @param central [CBCentralManager] - The central manager providing this information.
     * @param dict [NSDictionary<string, any>] - A dictionary containing information about the central manager that was preserved by the system at the time the app was terminated.
     * For the available keys to this dictionary, see Central Manager State Restoration Options.
     * @link - https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/central_manager_state_restoration_options
     */
    centralManagerWillRestoreState(central: CBCentralManager, dict: NSDictionary<string, any>): void;
}
export declare class AdvertismentData {
    private advData;
    constructor(advData: NSDictionary<string, any>);
    get manufacturerData(): ArrayBuffer;
    get data(): ArrayBuffer;
    get manufacturerId(): number;
    get txPowerLevel(): any;
    get localName(): any;
    get flags(): number;
    get serviceUUIDs(): any[];
    get overtflow(): any[];
    get solicitedServices(): any[];
    get connectable(): any;
    get serviceData(): {};
}
export declare function getBluetoothInstance(): Bluetooth;
export declare function toArrayBuffer(value: any): ArrayBuffer;
export declare function NSUUIDToString(uuid: NSUUID): string;
export declare function CBUUIDToString(uuid: CBUUID): string;
export declare class Bluetooth extends BluetoothCommon {
    private showPowerAlertPopup;
    private _centralDelegate;
    private _centralManager;
    _discoverPeripherals: {
        [k: string]: CBPeripheral;
    };
    _connectedPeripherals: {
        [k: string]: CBPeripheral;
    };
    _connectCallbacks: {};
    _disconnectCallbacks: {};
    _advData: {};
    _onDiscovered: any;
    clear(): void;
    _state: CBManagerState;
    set state(state: CBManagerState);
    get state(): CBManagerState;
    get centralDelegate(): CBCentralManagerDelegateImpl;
    ensureCentralManager(): void;
    get centralManager(): CBCentralManager;
    private restoreIdentifier;
    constructor(restoreIdentifierOrOptions?: string | Partial<BluetoothOptions> | null, showPowerAlertPopup?: boolean);
    onListenerAdded(eventName: string, count: number): void;
    _getState(state: CBPeripheralState): "connected" | "connecting" | "disconnected";
    private prepareConnectedPeripheralDelegate;
    onPeripheralDisconnected(peripheral: CBPeripheral): void;
    onPeripheralConnected(peripheral: CBPeripheral): void;
    isBluetoothEnabled(): Promise<boolean>;
    scanningReferTimer: {
        timer?: NodeJS.Timeout;
        resolve?: Function;
    };
    startScanning(args: StartScanningOptions): Promise<void>;
    enable(): Promise<boolean>;
    openBluetoothSettings(url?: string): Promise<void>;
    stopScanning(): Promise<void>;
    clearAdvertismentCache(): void;
    getDevice(args: DisconnectOptions): Promise<CBPeripheral>;
    connect(args: ConnectOptions): Promise<{
        UUID: string;
        name: string;
        state: string;
        services: any;
        nativeDevice: CBPeripheral;
        localName: any;
        manufacturerId: any;
        advertismentData: any;
        mtu: number;
    }>;
    disconnect(args: any): Promise<void>;
    isConnected(args: any): Promise<boolean>;
    findPeripheral(UUID: any): CBPeripheralWithDelegate;
    adddDiscoverPeripheral(peripheral: any): void;
    findDiscoverPeripheral(UUID: any): CBPeripheral;
    read(args: ReadOptions): Promise<unknown>;
    requestMtu(args: MtuOptions): Promise<number>;
    readRssi(args: ReadRSSIOptions): Promise<number>;
    write(args: WriteOptions): Promise<void>;
    writeWithoutResponse(args: WriteOptions): Promise<never>;
    startNotifying(args: StartNotifyingOptions): Promise<never>;
    stopNotifying(args: StopNotifyingOptions): Promise<never>;
    discoverServices(args: DiscoverServicesOptions): Promise<any>;
    discoverCharacteristics(args: DiscoverCharacteristicsOptions): Promise<unknown>;
    private _isEnabled;
    private _findService;
    private _findCharacteristic;
    private _getDeviceWrapper;
    private _getWrapper;
}
