import { IDeviceInformation } from 'web-device-mux';
import { IPrinterCommand } from './Commands.js';
import { CommandSet } from './CommandSet.js';
import { PrinterConfig } from './PrinterConfig.js';
import * as Util from '../Util/index.js';
import * as Conf from '../Configs/index.js';
export type PrinterMessage = ISettingUpdateMessage | IStatusMessage | IErrorMessage;
export type MessageType = 'SettingUpdateMessage' | 'StatusMessage' | 'ErrorMessage';
export interface MessageTransformer<TMessage extends Conf.MessageArrayLike> {
    transformerType: Conf.MessageArrayLikeType;
    combineMessages(...messages: TMessage[]): TMessage;
    messageToString(message: TMessage): string;
    messageToUint8Array(message: TMessage): Uint8Array;
}
export declare class RawMessageTransformer implements MessageTransformer<Uint8Array> {
    transformerType: Conf.MessageArrayLikeType;
    combineMessages(...messages: Uint8Array[]): Uint8Array;
    messageToString(message: Uint8Array): string;
    messageToUint8Array(message: Uint8Array): Uint8Array;
}
export declare class StringMessageTransformer implements MessageTransformer<string> {
    transformerType: Conf.MessageArrayLikeType;
    combineMessages(...messages: string[]): string;
    messageToString(message: string): string;
    messageToUint8Array(message: string): Uint8Array;
}
export declare function asUint8Array(commands: Conf.MessageArrayLike): Uint8Array;
export declare function asString(commands: Conf.MessageArrayLike): string;
export declare function asTargetMessageType<TMessage extends Conf.MessageArrayLike>(msg: Conf.MessageArrayLike, targetType: TMessage): TMessage;
export type AwaitedCommand = {
    cmd: IPrinterCommand;
    promise: Promise<boolean>;
    resolve?: (value: boolean) => void;
    reject?: (reason?: unknown) => void;
};
/** A printer settings message, describing printer configuration status. */
export interface ISettingUpdateMessage {
    messageType: 'SettingUpdateMessage';
    printerHardware?: Conf.UpdateFor<Conf.IPrinterHardware>;
    printerMedia?: Conf.UpdateFor<Conf.IPrinterMedia>;
    printerSettings?: Conf.UpdateFor<Conf.IPrinterSettings>;
}
/** A status message sent by the printer. */
export interface IStatusMessage {
    messageType: 'StatusMessage';
    labelWasTaken?: boolean;
    rfid?: IStatusMessageRfid;
}
export declare enum ErrorState {
    NoError = "NoError",
    UnknownError = "UnknownError",
    CommandSyntaxError = "CommandSyntaxError",
    ObjectExceededLabelBorder = "ObjectExceededLabelBorder",
    BarCodeDataLengthError = "BarCodeDataLengthError",
    InsufficientMemoryToStoreData = "InsufficientMemoryToStoreData",
    DuplicateNameFormGraphicOrSoftFont = "DuplicateNameFormGraphicOrSoftFont",
    NameNotFoundFormGraphicOrSoftFont = "NameNotFoundFormGraphicOrSoftFont",
    NotInDataEntryMode = "NotInDataEntryMode",
    PDF417CodedDataTooLargeToFit = "PDF417CodedDataTooLargeToFit",
    ReceiveBufferFull = "ReceiveBufferFull",
    PresenterNotRunning = "PresenterNotRunning",
    MemoryConfigurationError = "MemoryConfigurationError",
    RS232InterfaceError = "RS232InterfaceError",
    CorruptRamConfigLost = "CorruptRamConfigLost",
    InvalidFirmwareConfig = "InvalidFirmwareConfig",
    PrintheadThermistorOpen = "PrintheadThermistorOpen",
    PrintheadDetectionError = "PrintheadDetectionError",
    BadPrintheadElement = "BadPrintheadElement",
    IllegalInterruptOccurred = "IllegalInterruptOccurred",
    PrintheadUp = "PrintheadUp",
    MediaEmptyError = "MediaEmptyError",
    MediaNearEnd = "MediaNearEnd",
    RibbonEmptyError = "RibbonEmptyError",
    PrintheadTooHot = "PrintheadTooHot",
    PrintheadTooCold = "PrintheadTooCold",
    MotorTooHot = "MotorTooHot",
    MotorTooCold = "MotorTooCold",
    BatteryLowWarning40Percent = "BatteryLowWarning40Percent",
    BatteryLowLimit20Percent = "BatteryLowLimit20Percent",
    CutterJammedOrNotInstalled = "CutterJammedOrNotInstalled",
    PressFeedButtonToRecover = "PressFeedButtonToRecover",
    PaperFeedError = "PaperFeedError",
    PaperJamDuringRetract = "PaperJamDuringRetract",
    PrintheadNeedsCleaning = "PrintheadNeedsCleaning",
    PrintheadNeedsReplacing = "PrintheadNeedsReplacing",
    MediaErrorOrBlacklineNotDetectedOrExcessiveMediaFeeding = "MediaErrorOrBlacklineNotDetectedOrExcessiveMediaFeeding",
    BlackMarkNotFound = "BlackMarkNotFound",
    BlackMarkCalirateError = "BlackMarkCalirateError",
    AutoSenseOrSensorFailure = "AutoSenseOrSensorFailure",
    ExcessiveMediaFeeding = "ExcessiveMediaFeeding",
    RetractFunctionTimeout = "RetractFunctionTimeout",
    NeedToCalibrateMedia = "NeedToCalibrateMedia",
    PrinterBusyProcessingPrintJob = "PrinterBusyProcessingPrintJob",
    PrinterPaused = "PrinterPaused",
    PartialFormatInProgress = "PartialFormatInProgress",
    CommDiagnosticModeActive = "CommDiagnosticModeActive",
    LabelWaitingToBeTaken = "LabelWaitingToBeTaken"
}
export type ErrorStates = keyof typeof ErrorState;
export declare class ErrorStateSet extends Set<ErrorState> {
}
/** An error message sent by the printer. */
export interface IErrorMessage {
    messageType: 'ErrorMessage';
    errors: ErrorStateSet;
    unprintedRasterLines?: number;
    unprintedLabels?: number;
}
/** RFID-specific status message results. */
export interface IStatusMessageRfid {
    encodeSuccessful?: boolean;
    voidedCount?: number;
}
/** The output of a function for parsing a message. */
export interface IMessageHandlerResult<TInput> {
    messageIncomplete: boolean;
    messageMatchedExpectedCommand: boolean;
    messages: PrinterMessage[];
    remainder: TInput;
}
export type CommandSetMessageHandlerDelegate<TMsgType extends Conf.MessageArrayLike> = <TReceived extends Conf.MessageArrayLike>(cmdSet: CommandSet<TMsgType>, message: TReceived, config: PrinterConfig, sentCommand?: IPrinterCommand) => IMessageHandlerResult<TReceived>;
/** An error indicating a problem parsing a received message. */
export declare class MessageParsingError extends Util.WebZlpError {
    readonly receivedMessage: Conf.MessageArrayLike;
    constructor(message: string, receivedMessage: Conf.MessageArrayLike);
}
export declare function deviceInfoToOptionsUpdate(deviceInfo: IDeviceInformation): ISettingUpdateMessage;
export declare function parseRaw<TInput extends Conf.MessageArrayLike>(input: TInput, commandSet: CommandSet<Conf.MessageArrayLike>, config: PrinterConfig, awaitedCommands: AwaitedCommand[]): Promise<{
    remainderMsg: TInput;
    remainderCommands: AwaitedCommand[];
    messages: PrinterMessage[];
}>;
//# sourceMappingURL=Messages.d.ts.map