import { IonicNativePlugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; /** * @name Bluetooth Serial * @description This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino (not Android to Android or iOS to iOS). * @usage * ```typescript * import { BluetoothSerial } from '@ionic-native/bluetooth-serial/ngx'; * * constructor(private bluetoothSerial: BluetoothSerial) { } * * * // Write a string * this.bluetoothSerial.write('hello world').then(success, failure); * * // Array of int or bytes * this.bluetoothSerial.write([186, 220, 222]).then(success, failure); * * // Typed Array * var data = new Uint8Array(4); * data[0] = 0x41; * data[1] = 0x42; * data[2] = 0x43; * data[3] = 0x44; * this.bluetoothSerial.write(data).then(success, failure); * * // Array Buffer * this.bluetoothSerial.write(data.buffer).then(success, failure); * ``` */ export declare class BluetoothSerialOriginal extends IonicNativePlugin { /** * Connect to a Bluetooth device * @param {string} macAddress_or_uuid Identifier of the remote device * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. */ connect(macAddress_or_uuid: string): Observable; /** * Connect insecurely to a Bluetooth device * @param {string} macAddress Identifier of the remote device * @returns {Observable} Subscribe to connect, unsubscribe to disconnect. */ connectInsecure(macAddress: string): Observable; /** * Disconnect from the connected device * @returns {Promise} */ disconnect(): Promise; /** * Writes data to the serial port * @param {any} data ArrayBuffer of data * @returns {Promise} returns a promise when data has been written */ write(data: any): Promise; /** * Gets the number of bytes of data available * @returns {Promise} returns a promise that contains the available bytes */ available(): Promise; /** * Reads data from the buffer * @returns {Promise} returns a promise with data from the buffer */ read(): Promise; /** * Reads data from the buffer until it reaches a delimiter * @param {string} delimiter string that you want to search until * @returns {Promise} returns a promise */ readUntil(delimiter: string): Promise; /** * Subscribe to be notified when data is received * @param {string} delimiter the string you want to watch for * @returns {Observable} returns an observable. */ subscribe(delimiter: string): Observable; /** * Subscribe to be notified when data is received * @returns {Observable} returns an observable */ subscribeRawData(): Observable; /** * Clears data in buffer * @returns {Promise} returns a promise when completed */ clear(): Promise; /** * Lists bonded devices * @returns {Promise} returns a promise */ list(): Promise; /** * Reports if bluetooth is enabled * @returns {Promise} returns a promise */ isEnabled(): Promise; /** * Reports the connection status * @returns {Promise} returns a promise */ isConnected(): Promise; /** * Reads the RSSI from the connected peripheral * @returns {Promise} returns a promise */ readRSSI(): Promise; /** * Show the Bluetooth settings on the device * @returns {Promise} returns a promise */ showBluetoothSettings(): Promise; /** * Enable Bluetooth on the device * @returns {Promise} returns a promise */ enable(): Promise; /** * Discover unpaired devices * @returns {Promise} returns a promise */ discoverUnpaired(): Promise; /** * Subscribe to be notified on Bluetooth device discovery. Discovery process must be initiated with the `discoverUnpaired` function. * @returns {Observable} Returns an observable */ setDeviceDiscoveredListener(): Observable; /** * Sets the human readable device name that is broadcasted to other devices * @param {string} newName Desired name of device */ setName(newName: string): void; /** * Makes the device discoverable by other devices * @param {number} discoverableDuration Desired number of seconds device should be discoverable for */ setDiscoverable(discoverableDuration: number): void; } export declare const BluetoothSerial: BluetoothSerialOriginal;