import { QueueComProtocol } from '@iotize/tap/protocol/core';
import { Observable } from 'rxjs';
export declare namespace UniversalBleProtocolAdapter {
    interface Options {
        /**
         * BLE maximum transfer unit size (in bytes)
         */
        mtu: number;
        /**
         * Maximum buffer length for received frames
         */
        maximumBufferLength: number;
        /**
         * True to wait for write characteristic acknowledge
         * According to firmware implementation, write acknowledge is not
         * always returns, leading to a timeout exception in client
         */
        waitForWriteAcknowledge: boolean;
        /**
         * TapNLinks may have 2 different BLE characteristic to communicate
         * You can define which one should be used in priority
         * If it does not exist, it will use the other one
         */
        preferedComServiceType?: 'legacy' | 'large-frame';
        /**
         * True if you want to remove '-' character from ID
         */
        sanitizeUUID?: boolean;
    }
}
export declare const DEFAULT_BLE_OPTIONS: UniversalBleProtocolAdapter.Options;
/**
 * Abstract class for BLE communication
 *
 * With ble communication, data is split into sub packets.
 * This class handles creation of packet chunks.
 *
 * - You must only implement the function to send one packet chunk writeLwm2mPacketChunk()
 * -
 */
export declare abstract class UniversalBleProtocolAdapter<T extends ServiceAdapterInterface> extends QueueComProtocol {
    peripheral: PeripheralAdapterInterface<T>;
    private _lwm2mCharc?;
    private _useSplitter;
    private _readPromise?;
    bleOptions: UniversalBleProtocolAdapter.Options;
    private get lwm2mCharc();
    constructor(peripheral: PeripheralAdapterInterface<T>, bleOptions?: Partial<UniversalBleProtocolAdapter.Options>);
    private sanitizeUUID;
    _connect(): Observable<any>;
    _disconnect(): Observable<any>;
    private setupLwm2mCharacteristic;
    private _selectLwm2mCharacteristic;
    private _getLargeFrameLwm2mCharacteristic;
    private _getLegacyLwm2mCharacteristic;
    read(): Promise<Uint8Array>;
    readUnit(): Promise<Uint8Array>;
    write(data: Uint8Array): Promise<any>;
    get useSplitter(): boolean;
    get chunkSize(): number;
    writeUnit(data: Uint8Array): Promise<any>;
    private _createReadPromise;
}
export interface PeripheralAdapterInterface<T extends ServiceAdapterInterface> {
    state: string;
    discoverServices(serviceUUIDs: string[]): Promise<Record<string, T>>;
    connect(): Promise<void>;
    disconnect(): Promise<void>;
    getService(uuid: string): Promise<T>;
}
export interface ServiceAdapterInterface {
    uuid: string;
    getCharacteristic(charcUUID: string): Promise<CharacteristicAdapterInterface>;
}
export interface CharacteristicAdapterInterface {
    uuid: string;
    write(data: Uint8Array, writeWithoutResponse: boolean): Promise<Uint8Array>;
    data: Observable<{
        data: Uint8Array;
        isNotification: boolean;
    }>;
    enableNotifications(enabled: boolean): Promise<void>;
}
