import { Serial } from '@ionic-native/serial' ; import { Observable } from 'rxjs/Observable' ; import { Observer } from 'rxjs/Observer' ; export interface SerialPermissionOptions { vid : string ; pid : string ; driver : string ; } export interface SerialOpenOptions { baudRate : number ; } export class SerialMock extends Serial { param options { SerialPermissionOptions } return { Promise < any > } requestPermission ( options ? ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; param options { SerialOpenOptions } return { Promise < any > } open ( options ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; param data { any } return { Promise < any > } write ( data ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; param data { any } return { Promise < any > } writeHex ( data ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; return { Promise < any > } read ( ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; returns { Observable < any > } registerReadCallback ( ) { return Observable . create ( ( observer ) => { observer . next ( '' ) ; observer . complete ( ) ; } ) ; } ; return { Promise < any > } close ( ) { return new Promise ( ( resolve , reject ) => { resolve ( ) ; } ) ; } ; }