format import { DeviceDescription , DeviceLogEntry } from 'flipper-common' ; import { DeviceListener , NoopListener } from '../utils/DeviceListener' ; import { FlipperServerImpl } from '../FlipperServerImpl' ; export abstract class ServerDevice { readonly info : DeviceDescription ; readonly flipperServer : FlipperServerImpl ; connected = true ; protected stopCrashWatcherCb ? : ( ) => void ; readonly logListener : DeviceListener = new NoopListener ( ( ) => this . connected ) ; readonly crashWatcher : DeviceListener = new NoopListener ( ( ) => this . connected ) ; constructor ( flipperServer , info ) { this . flipperServer = flipperServer ; this . info = info ; } get serial ( ) : string { return this . info . serial ; } addLogEntry ( entry ) { this . flipperServer . emit ( 'device-log' , { serial : this . serial , entry , } ) ; } /**
     * The device might have no active connection
     */ disconnect ( ) { this . connected = false ; this . logListener . stop ( ) ; this . crashWatcher . stop ( ) ; } async screenshotAvailable ( ) { return false ; } screenshot ( ) { return Promise . reject ( new Error ( 'No screenshot support for current device' ) ) ; } async screenCaptureAvailable ( ) { return false ; } async startScreenCapture ( _destination ) { throw new Error ( 'startScreenCapture not implemented on BaseDevice ' ) ; } async stopScreenCapture ( ) { throw new Error ( 'stopScreenCapture not implemented on BaseDevice ' ) ; } async executeShell ( _command ) { throw new Error ( 'executeShell not implemented on BaseDevice' ) ; } async forwardPort ( _local , _remote ) { throw new Error ( 'forwardPort not implemented on BaseDevice' ) ; } async clearLogs ( ) { } async navigateToLocation ( _location ) { throw new Error ( 'navigateLocation not implemented on BaseDevice' ) ; } }