don / BluetoothSerial

Cordova (PhoneGap) Plugin for Serial Communication over Bluetooth
Other
1.07k stars 670 forks source link

Thermal printer not response #447

Open Eizaz opened 2 years ago

Eizaz commented 2 years ago
import { BluetoothSerial } from '@awesome-cordova-plugins/bluetooth-serial/ngx';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})

export class HomePage {

    MAC = 'DC:0D:30:12:11:15'; // this is bluetooth printer mac address

    constructor(private bluetoothSerial: BluetoothSerial) {}

  print() {

       var data = new Uint8Array([0x0A, 0x0A, 0x0A]);
               // send byte code into the printer
        this.bluetoothSerial.connect(this.MAC).subscribe(() => {
          this.bluetoothSerial.write(data)
            .then(() => {
              console.log('Print success');
              console.log(this.MAC);
              this.bluetoothSerial.disconnect();
              console.log(data)
            })
            .catch((err) => {
              console.error(err);
            });
        }); 

  }

the console output are success but my thermal printer print nothing printer type : xprinter xp-460b

sadalsuud commented 1 year ago

What happen with this? ... how did you fix this?