/// <reference types="node" />
import * as net from "net";
import { CmdData, Package } from './Dto';
export declare type Options = net.TcpNetConnectOpts & {
    /**
     * 重连延迟时间(毫秒)，默认：10000
     */
    reconnectDelay?: number;
};
export interface SocketClient {
    on(event: "connect", listener: () => void): this;
    on(event: "data", listener: (data: Buffer) => void): this;
    /**
     * 收到数据后，解码成功时触发
     * @param event
     * @param listener
     */
    on(event: "package", listener: (pack: Package) => void): this;
    /**
     * 收到数据后，解码成功且指令为n指令时触发
     * @param event
     * @param listener
     */
    on(event: "cmd", listener: (data: CmdData) => void): this;
    on(event: "error", listener: (err: Error) => void): this;
    on(event: "decodeError", listener: (err: Error) => void): this;
    on(event: "close", listener: (hadError: boolean) => void): this;
}
/**
 * 编码
 */
export declare function encode(cmd: string, data: Buffer): Buffer[];
/**
 * 视频服务程序SOCKET客户端
 */
export declare class SocketClient {
    private _socket;
    readonly opts: Options;
    private _emitter;
    private _datas;
    private _disposed;
    private _heartbeatTimer?;
    private _maxBufferSize;
    get socketInstance(): net.Socket;
    constructor(opts: Options);
    off(eventName: string | symbol, listener: (...args: any[]) => void): this;
    /**
     * @param cmd 'A' | 'C' | 'D' | 'F' | 'n' | 'Z' | 'P' | 'V' 等
     * @param data
     */
    send(cmd: string, data: Buffer | object): void;
    destroy(): void;
    private _connect;
    private _onConnect;
    private _onData;
    private _onClose;
    private _send;
    private _dispose;
}
