Need help on StarPRNT Plugin using Ionic


#1

I’m using the StarPRNT Plugin in my Ionic 3 project but I can’t seem to get the port where the printer is connected using the portDiscovery() function. Can anyone help me on this please? Here’s my code:

declare let starprnt: any;

@Component({
...
})

export class TestPage {
...
    testConnect() {
        this.platform.ready().then(()=>{
            if (typeof starprnt !== 'undefined') {
                this.testLog = 'starprnt is defined: ' + JSON.stringify(starprnt);
                starprnt.portDiscovery('All',
                    (data) => {
                        this.testLog = 'SUCCESS: ' + JSON.stringify(data);
                    },
                    (err) => {
                        this.testLog = 'ERROR: ' + JSON.stringify(err);
                    }
                );
            }else{
                this.testLog = 'starprnt is undefined';
            }
        });
    }
...
}