import { Observable } from 'rxjs/Observable'; export interface SerialPermissionOptions { vid: string; pid: string; driver: string; } export interface SerialOpenOptions { baudRate: number; } /** * @name Serial * @description * This plugin provides functions for working with Serial connections * * @usage * * ``` * import { Serial } from 'ionic-native'; * * Serial.requestPermission().then(() => { * Serial.open({ * baudRate: 9800 * }).then(() => { * console.log('Serial connection opened'); * }); * }).catch((error: any) => console.log(error)); * * ``` */ export declare class Serial { /** * Request permission to connect to a serial device * * @param options {SerialPermissionOptions} Options used to request serial permissions for an unknown device * @return {Promise} Returns a promise that resolves when permissions are granted */ static requestPermission(options?: SerialPermissionOptions): Promise; /** * Open connection to a serial device * * @param options {SerialOpenOptions} Options used to open serial connection * @return {Promise} Returns a promise that resolves when the serial connection is opened */ static open(options: SerialOpenOptions): Promise; /** * Write to a serial connection * * @param data {any} data to write to the serial connection * @return {Promise} Returns a promise that resolves when the write is complete */ static write(data: any): Promise; /** * Write hex to a serial connection * * @param data {any} data to write to the serial connection * @return {Promise} Returns a promise that resolves when the write is complete */ static writeHex(data: any): Promise; /** * Read from a serial connection * * @return {Promise} Returns a promise that resolves with data read from the serial connection */ static read(): Promise; /** * Watch the incoming data from the serial connection. Clear the watch by unsubscribing from the observable * * @returns {Observable} Observable returns an observable that you can subscribe to */ static registerReadCallback(): Observable; /** * Close the serial connection * * @return {Promise} Returns a promise that resolves when the serial connection is closed */ static close(): Promise; }