diff --git a/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java b/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java index 79e1a4b..1a3e216 100644 --- a/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java +++ b/app/src/main/java/xyz/mtfos/btdemo/PrinterBle.java @@ -248,6 +248,9 @@ public class PrinterBle { } mState = CONNECTING; + if(this.mStateListener != null) { + this.mStateListener.onChange(mState); + } } public void stopScan() { @@ -260,7 +263,12 @@ public class PrinterBle { mAdapter.stopLeScan(mLeScanCB); } - if (mState == CONNECTING) mState = DISCONNECTED; + if (mState == CONNECTING) { + mState = DISCONNECTED; + if(this.mStateListener != null) { + this.mStateListener.onChange(mState); + } + } } /** @@ -390,13 +398,13 @@ public class PrinterBle { default: return this; } - addText("__a" + strAlign + "__"); + addText("__&a" + strAlign + "__"); return this; } public void setSize(int w, int h) { if (w < 1 || h < 1 || w > 3 || h > 3) return; - addText(String.format("__s%d,%d__", w, h)); + addText(String.format("__&s%d,%d__", w, h)); } public void resetSize() {