mirror of
https://github.com/MultiMote/niimbluelib.git
synced 2025-03-16 19:41:01 +03:00
Fix printer serial number conversion for old devices
This commit is contained in:
parent
28d3352a58
commit
a68dd85c6e
@ -306,7 +306,16 @@ export class Abstraction {
|
||||
public async getPrinterSerialNumber(): Promise<string> {
|
||||
const packet = await this.send(PacketGenerator.getPrinterInfo(PrinterInfoType.SerialNumber));
|
||||
Validators.u8ArrayLengthAtLeast(packet.data, 1);
|
||||
return Utils.u8ArrayToString(packet.data);
|
||||
|
||||
if (packet.data.length < 4) {
|
||||
return "-1";
|
||||
}
|
||||
|
||||
if (packet.data.length >= 8) {
|
||||
return Utils.u8ArrayToString(packet.data);
|
||||
}
|
||||
|
||||
return Utils.bufToHex(packet.data.slice(0, 4), "").toUpperCase();
|
||||
}
|
||||
|
||||
public async getPrinterBluetoothMacAddress(): Promise<string> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user