@psdk/ohos-bluetooth-classic
v0.7.15
Published
psdk - ohos bluetooth classic device support
Readme
@psdk/ohos-bluetooth-classic
npm i @psdk/ohos-bluetooth-classicHow to use
const bluetooth = new OhosBluetoothClassic({});
bluetooth.discovered(async (devices) => {
//connect bluetooth
const connectDevice = await bluetooth.connect(device[0]);
//init device
PrinterUtil.getInstance().init(connectDevice);
//send data
const report = await PrinterUtil.getInstance().cpcl()
.raw(Raw.binary(Uint8Array.from([0x10, 0xff, 0xbf])))
.write();
});
//discovery
await bluetooth.startDiscovery();