import IPostMessage from '../../IPostMessage';
import IBarcodeScannerDataMessage from './IBarcodeScannerDataMessage';
import IBarcodeScanner, { IBarcodeScannerOptions, IBarcodeScannerResponse } from './IBarcodeScanner';
export declare const DEFAULT_SCANNER_ID = 0;
/**
 * The `sos.hardware.barcodeScanner` API provides methods for working with barcode scanners.
 * It allows starting and stopping the scanner, as well as listening for scanned data and errors.
 *
 * :::note
 * This API is experimental and may change in the future.
 * :::
 *
 * <details>
 *     <summary>Device Barcode Scanner Capabilities</summary>
 * 		| Capability | Description |
 * 		|:------------|:-------------|
 * 		| `BARCODE_SCANNER` | If device supports serial communication for Barcode Scanners |
 *
 * 		If you want to check if the device supports this capability, use [`sos.display.supports()`](https://developers.signageos.io/sdk/sos/display#supports).
 * </details>
 */
export default class BarcodeScanner implements IBarcodeScanner {
    private messagePrefix;
    private postMessage;
    static MESSAGE_PREFIX: "barcode_scanner";
    private eventEmitter;
    /** @internal */
    constructor(messagePrefix: string, postMessage: IPostMessage<any>);
    /**
     * The `getVersion()` method returns the version of the barcode scanner.
     *
     * @returns {Promise<string>} Returns a promise that resolves to the version of the barcode scanner.
     * @throws {Error} If the version cannot be retrieved.
     * @since 3.0.0
     */
    getVersion(): Promise<string>;
    /**
     * The `start()` starts the barcode scanner and starts listening for scanned data.
     * @param userOptions User options to configure the scanner.
     * @param userOptions.timeout The maximum time to wait for a scan before timing out.
     * @param userOptions.cancelPrevious If set to `true`, it will cancel any previous scanner instance with the same `scannerId`.
     * @returns Returns a promise that resolves to an object with methods to stop the scanner and listen for scanned data and errors.
     * @throws {Error} If the scanner cannot be started.
     * @throws {Error} If the scanner is already running and `cancelPrevious` option is not set to `true`.
     * @throws {Error} If any other error occurs while starting the scanner.
     * @since 3.0.0
     *
     * @example
     * // Start the barcode scanner with default options
     * const scanner = await sos.hardware.barcodeScanner.start();
     * // Listen for scanned data
     * scanner.onData((data) => {
     * 	console.log(`Scanned data: ${data}`);
     * });
     * // Listen for errors
     * scanner.onError((error) => {
     * 	console.error(`Scanner error: ${error.message}`);
     * });
     */
    start(userOptions?: Omit<IBarcodeScannerOptions, 'scannerId'>): Promise<IBarcodeScannerResponse>;
    /** @internal */
    handleMessageData(msg: IBarcodeScannerDataMessage): void;
    private getMessage;
}
