import type { Device as RNBlePlxDevice } from 'react-native-ble-plx' ; import PeripheralRequest from '../device/ble/PeripheralRequest' ; type TransportDevice = BluetoothDevice | RNBlePlxDevice ; example example example example abstract class Transport { [ key ] : any ; peripheral : PeripheralRequest ; device : TransportDevice ; constructor ( device ) { this . device = device ; this . peripheral = new PeripheralRequest ( this ) ; } abstract sendCommandToCard ( command ) ; abstract sendDataToCard ( packets ) ; abstract checkCardStatus ( ) ; abstract readDataFromCard ( ) ; request = async ( command , packets ) : Promise < string > => { return this . peripheral . sendAPDU ( command , packets ) ; } ; } interface BleManager { /**
     * Check whether browser support bluetooth.
     */ isSupported ( ) : Promise < boolean > ; /**
     * Scan device in order to get the BluetoothDevice instance.
     */ listen ( callback ? ) : Promise < TransportDevice > | void ; /**
     * Stop scanning BluetoothDevice.
     *
     * Optional, it is not required to every platform, ex. browser.
     */ stopListen ? ( ) : void ; /**
     * Connect to given TransportDevice and return the Transport.
     */ connect ( device ) : Promise < Transport > ; /**
     * Disconnect from Transport and TransportDevice.
     */ disconnect ( ) : Promise < void > ; } export { BleManager } ; export default Transport ;