You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the plugin to connect and print using a thermal printer. but the write() function is not working giving error: Device connection was lost.
my code:
`
import { BluetoothSerial } from '@awesome-cordova-plugins/bluetooth-serial/ngx';
....
async printStuff() {
// this.alertMessage2(this.selectedPrinter);
this.bluetooth.connect(this.selectedPrinter)
.subscribe(async() => {
//2. Connected successfully
// this.alertMessage2('392: ' + success)
await this.bluetooth.write(this.espEncode())
.then(success => {
//3. Print successful
//If you want to tell user print is successful,
//handle it here
//4. IMPORTANT! Disconnect bluetooth after printing
// console.log('sucess')
this.alertMessage2('401: ' + success)
this.bluetooth.disconnect()
}, err => {
//If there is an error printing to bluetooth printer
//handle it here
console.error('43:' + err)
this.alertMessage2('error 43: ' + err)
})
}, err => {
//If there is an error connecting to bluetooth printer
//handle it here
this.alertMessage('error 416: ' + err, '')
this.bluetooth.disconnect();
console.error(err)
})
// await this.print.sendToBluetoothPrinter(this.selectedPrinter, this.espEncode());
}`
The text was updated successfully, but these errors were encountered:
Hello,
I am using the plugin to connect and print using a thermal printer. but the write() function is not working giving error: Device connection was lost.
my code:
`
The text was updated successfully, but these errors were encountered: