import { WebRtcConfig } from "@luxonis/remote-connection";
import { Service, Channel, ServiceCallPayload, ServiceCallResponse } from "@foxglove/ws-protocol";
import { PublicChannelData } from "./connection";
import { ProtobufKind } from "../messaging/protobuf";
export type FoxgloveMessage = {
    topic: string;
    schema: string;
    buffer: DataView;
};
export type WorkerInputMessage = {
    type: "open";
    data: {
        wsUrl: string;
    } | {
        config: WebRtcConfig;
    };
} | {
    type: "close";
    data: null;
} | {
    type: "subscribe";
    data: string[];
} | {
    type: "unsubscribe";
    data: string[];
} | {
    type: "call_service";
    data: {
        name: string;
        serviceCallId: number;
        body?: Record<string, any> | string | number;
    };
};
export type WorkerOutputMessage = {
    type: "open";
} | {
    type: "close";
} | {
    type: "reconnect";
} | {
    type: "error";
    error: unknown;
} | {
    type: "channels";
    data: PublicChannelData[];
} | {
    type: "services";
    data: string[];
} | {
    type: "service_response";
    data: {
        name: string;
        serviceCallId: number;
    } & ({
        ok: true;
        error: null;
        buffer: DataView;
    } | {
        ok: false;
        error: string;
        buffer: null;
    });
} | {
    type: "message";
    data: FoxgloveMessage;
} | {
    type: "disconnect";
    error: Error;
};
export type ChannelWithKind = Channel & {
    kind: ProtobufKind;
};
export declare abstract class FoxgloveCommunicator {
    #private;
    protected abstract isReady(): boolean;
    protected abstract send(message: WorkerOutputMessage): void;
    protected abstract sendWithTransfer(message: WorkerOutputMessage, transfer: ArrayBuffer[]): void;
    protected abstract sendServiceCallRequest(request: ServiceCallPayload): void;
    protected getPublicChannels(): ChannelWithKind[];
    protected handleReconnect(): void;
    protected handleChannelsAdvertisement(channels: Channel[]): void;
    protected handleChannelsUnadvertisement(channels: number[]): void;
    protected handleServicesAdvertisement(services: Service[]): void;
    protected handleServicesUnadvertisement(services: number[]): void;
    protected handleServiceResponse(response: Pick<ServiceCallResponse, 'callId' | 'data'>): void;
    protected handleGenericMessage(topic: string, schema: string, buffer: DataView): void;
    protected callService({ name, serviceCallId, body }: (WorkerInputMessage & {
        type: "call_service";
    })["data"]): void;
}
//# sourceMappingURL=communicator.d.ts.map