feat(ppclock): 命令层/传输层/CLI/本地模板渲染,90 测试全绿

This commit is contained in:
agent committed 2026-07-24 10:57:25 +00:00
1 parent 6f5b0c60be
commit 2b01e5f589
60 files changed
+16869

No files matched your search

View File
Whitespace-only changes.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+166
View File
@@ -0,0 +1,166 @@
package a9;
public final class c2 extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public final synthetic int c;
public int d;
public final synthetic String e;
public synthetic c2(String p1, kotlin.coroutines.Continuation p2, int p3)
{
this.c = p3;
this.e = p1;
super(2, p2);
return;
}
public final kotlin.coroutines.Continuation create(Object p3, kotlin.coroutines.Continuation p4)
{
switch (this.c) {
case 0:
return new a9.c2(this.e, p4, 0);
case 1:
return new a9.c2(this.e, p4, 1);
case 2:
return new a9.c2(this.e, p4, 2);
case 3:
return new a9.c2(this.e, p4, 3);
case 4:
return new a9.c2(this.e, p4, 4);
default:
return new a9.c2(this.e, p4, 5);
}
}
public final Object invoke(Object p2, Object p3)
{
switch (this.c) {
case 0:
return ((a9.c2) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 1:
return ((a9.c2) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 2:
return ((a9.c2) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 3:
return ((a9.c2) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 4:
return ((a9.c2) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
default:
return ((a9.c2) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
}
}
public final Object invokeSuspend(Object p7)
{
k8.b v2_0 = n8.j.a;
int v3_0 = this.e;
switch (this.c) {
case 0:
Object v0_6 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
k8.b v2_4 = this.d;
if (v2_4 == null) {
q6.y.Y(p7);
this.d = 1;
p7 = k8.h.c("https://qbsg.top/api/activation/check", v3_0, this);
if (p7 == v0_6) {
p7 = v0_6;
}
} else {
if (v2_4 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p7);
}
}
return p7;
case 1:
Object v0_4 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
k8.b v2_3 = this.d;
if (v2_3 == null) {
q6.y.Y(p7);
this.d = 1;
p7 = k8.h.c("https://qbsg.top/api/activation/check", v3_0, this);
if (p7 == v0_4) {
p7 = v0_4;
}
} else {
if (v2_3 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p7);
}
}
return p7;
case 2:
Object v0_3 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
kotlinx.coroutines.CoroutineDispatcher v1_4 = this.d;
if (v1_4 == null) {
q6.y.Y(p7);
this.d = 1;
p7 = k8.h.c("https://qbsg.top/api/activation/activate", v3_0, this);
if (p7 == v0_3) {
p7 = v0_3;
}
} else {
if (v1_4 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p7);
}
}
return p7;
case 3:
Object v0_2 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
kotlinx.coroutines.CoroutineDispatcher v1_2 = this.d;
if (v1_2 == null) {
q6.y.Y(p7);
this.d = 1;
p7 = kotlinx.coroutines.BuildersKt.withContext(kotlinx.coroutines.Dispatchers.getIO(), new k8.b(q6.y.T(v3_0), 0), this);
if (p7 == v0_2) {
p7 = v0_2;
}
} else {
if (v1_2 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p7);
}
}
return p7;
case 4:
Object v0_5 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
kotlinx.coroutines.CoroutineDispatcher v1_5 = this.d;
if (v1_5 == null) {
q6.y.Y(p7);
this.d = 1;
p7 = v2_0.c(v3_0, this);
if (p7 == v0_5) {
p7 = v0_5;
}
} else {
if (v1_5 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p7);
}
}
return p7;
default:
Object v0_1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
kotlinx.coroutines.CoroutineDispatcher v1_1 = this.d;
if (v1_1 == null) {
q6.y.Y(p7);
this.d = 1;
p7 = v2_0.d(v3_0, this);
if (p7 == v0_1) {
p7 = v0_1;
}
} else {
if (v1_1 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p7);
}
}
return p7;
}
}
}
File diff suppressed because it is too large. Load diff
+314
View File
@@ -0,0 +1,314 @@
package b1;
public final class m extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public final synthetic int c;
public int d;
public final synthetic boolean e;
public Object f;
public final synthetic Object g;
public synthetic m(Object p1, boolean p2, Object p3, kotlin.coroutines.Continuation p4, int p5)
{
this.c = p5;
this.f = p1;
this.e = p2;
this.g = p3;
super(2, p4);
return;
}
public m(w7.n p2, boolean p3, kotlin.coroutines.Continuation p4)
{
this.c = 4;
this.g = p2;
this.e = p3;
super(2, p4);
return;
}
public synthetic m(boolean p1, Object p2, Object p3, kotlin.coroutines.Continuation p4, int p5)
{
this.c = p5;
this.e = p1;
this.f = p2;
this.g = p3;
super(2, p4);
return;
}
public final kotlin.coroutines.Continuation create(Object p8, kotlin.coroutines.Continuation p9)
{
switch (this.c) {
case 0:
return new b1.m(((b1.a) this.f), this.e, ((b1.x) this.g), p9, 0);
case 1:
return new b1.m(this.e, ((String) this.f), ((n8.l) this.g), p9, 1);
case 2:
return new b1.m(this.e, ((y0.sd) this.f), ((e1.j1) this.g), p9, 2);
case 3:
return new b1.m(this.e, ((s8.f1) this.f), ((a7.a) this.g), p9, 3);
case 4:
return new b1.m(((w7.n) this.g), this.e, p9);
default:
return new b1.m(((n.c) this.f), this.e, ((n.v0) this.g), p9, 5);
}
}
public final Object invoke(Object p2, Object p3)
{
switch (this.c) {
case 0:
return ((b1.m) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 1:
return ((b1.m) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 2:
return ((b1.m) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 3:
return ((b1.m) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 4:
return ((b1.m) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
default:
return ((b1.m) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
}
}
public final Object invokeSuspend(Object p20)
{
r6.c v3_15 = 1065353216;
w7.f0 v6_2 = p6.a0.a;
int v5_11 = this.g;
boolean v7 = this.e;
int v9_2 = 1;
switch (this.c) {
case 0:
w7.f0 v17_4 = v6_2;
w7.o v0_27 = ((b1.x) v5_11).b;
w7.f0 v6_11 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
int v1_5 = this.d;
if (v1_5 == 0) {
q6.y.Y(p20);
int v1_8 = ((b1.a) this.f).C;
if (!v7) {
v3_15 = 0;
}
w7.o v0_29;
Boolean v2_3 = kotlin.coroutines.jvm.internal.Boxing.boxFloat(v3_15);
if (!v7) {
v0_29 = ((b1.q) v0_27).n;
} else {
v0_29 = ((b1.q) v0_27).m;
}
this.d = 1;
if (n.c.b(v1_8, v2_3, v0_29, 0, this, 12) != v6_11) {
v6_11 = v17_4;
}
} else {
if (v1_5 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p20);
}
}
return v6_11;
case 1:
w7.f0 v6_9;
w7.f0 v17_3 = v6_2;
int v5_6 = ((n8.l) v5_11);
w7.o v0_22 = ((String) this.f);
Boolean v2_2 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
r6.c v3_13 = this.d;
if (v3_13 == null) {
q6.y.Y(p20);
r6.c v3_14 = n8.j.a;
if (!v7) {
int v5_7 = v5_6.a;
this.d = 2;
if (v3_14.f(v0_22, v5_7, this) != v2_2) {
v6_9 = v17_3;
return v6_9;
}
} else {
int v1_4 = v5_6.a;
this.d = 1;
if (v3_14.j(v0_22, v1_4, this) != v2_2) {
}
}
v6_9 = v2_2;
} else {
if ((v3_13 != 1) && (v3_13 != 2)) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p20);
}
}
return v6_9;
case 2:
w7.f0 v6_7;
w7.f0 v17_2 = v6_2;
w7.o v0_16 = ((y0.sd) this.f);
Boolean v2_1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
r6.c v3_6 = this.d;
if (v3_6 == null) {
q6.y.Y(p20);
if ((!v7) || (!((Boolean) ((e1.j1) v5_11).getValue()).booleanValue())) {
((y0.td) v0_16).b();
v6_7 = v17_2;
} else {
r6.c v3_11 = new okio.internal.b(3);
this.d = 1;
if (e1.c1.a(this.getContext()).e(v3_11, this) != v2_1) {
this.d = 2;
if (y0.sd.a(v0_16, this) != v2_1) {
} else {
v6_7 = v2_1;
}
}
}
} else {
if (v3_6 == 1) {
q6.y.Y(p20);
} else {
if (v3_6 != 2) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p20);
}
}
}
return v6_7;
case 3:
w7.f0 v6_4;
w7.f0 v17_1 = v6_2;
w7.o v0_10 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
int v1_1 = this.d;
if (v1_1 == 0) {
q6.y.Y(p20);
if (v7) {
v6_4 = v17_1;
} else {
this.d = 1;
if (kotlinx.coroutines.DelayKt.delay(320, this) != v0_10) {
((s8.f1) this.f).a = 0;
((a7.a) v5_11).invoke();
} else {
v6_4 = v0_10;
}
}
} else {
if (v1_1 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p20);
}
}
return v6_4;
case 4:
String v8_5;
int v5_0 = ((w7.n) v5_11);
w7.o v0_7 = v5_0.f;
int v1_0 = v5_0.d;
r6.c v3_4 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
r6.c v10_0 = this.d;
try {
if (v10_0 == null) {
q6.y.Y(p20);
String v8_4 = w7.w.e(new p6.g[] {new p6.g("machine", v5_0.c.invoke()), new p6.g("version", kotlin.coroutines.jvm.internal.Boxing.boxInt(4)), new p6.g("platform", "android")}));
this.f = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v8_4);
this.d = 1;
v8_5 = k8.h.c("https://qbsg.top/api/check-update", v8_4, this);
if (v8_5 != v3_4) {
r6.c v3_20 = w7.w.k(((String) v8_5));
if (!v3_20.f("isLatest", 1)) {
Boolean v2_10 = v3_20.i(-1, "latestVersionCode");
String v8_11 = v3_20.m("latestVersionName");
if (v8_11 == null) {
v8_11 = "";
}
String v12_3 = v3_20.m("downloadUrl");
if (v12_3 == null) {
v12_3 = "";
}
w7.f0 v17_0;
r6.c v3_2 = v3_20.j("updates");
r6.c v10_9 = k3.t.p();
if (v3_2 != null) {
int v13_2 = v3_2.E();
int v14 = 0;
while (v14 < v13_2) {
n4.q v15 = v3_2.z(v14);
int v16_0 = v9_2;
r6.c v20_1 = v3_2;
r6.c v3_1 = v15.m("versionName");
if (v3_1 == null) {
v3_1 = "";
}
v17_0 = v6_2;
w7.f0 v6_1 = v15.m("changelog");
if (v6_1 == null) {
v6_1 = "";
}
v10_9.add(new w7.g0(v3_1, v6_1));
v14++;
v3_2 = v20_1;
v9_2 = v16_0;
v6_2 = v17_0;
}
}
v17_0 = v6_2;
int v16_2 = v9_2;
v0_7.setValue(new w7.f0(v2_10, v8_11, v12_3, k3.t.i(v10_9)));
if ((v7) || (v2_10 != ((l8.a) ((kotlinx.coroutines.flow.StateFlow) v5_0.b.f).getValue()).i)) {
v1_0.setValue(w7.o.e);
v5_0.h.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v16_2));
v6_2 = v17_0;
} else {
v1_0.setValue(w7.o.g);
}
} else {
v5_0.l = 0;
a.b.n(j8.c.d, "updates");
v0_7.setValue(0);
v1_0.setValue(w7.o.h);
}
} else {
v6_2 = v3_4;
}
} else {
if (v10_0 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p20);
v8_5 = p20;
}
}
} catch (Exception) {
v17_0 = v6_2;
v1_0.setValue(w7.o.f);
} catch (Exception) {
}
return v6_2;
default:
r6.c v10_5 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
w7.o v0_35 = this.d;
if (v0_35 == null) {
q6.y.Y(p20);
w7.o v0_37 = ((n.c) this.f);
if (!v7) {
v3_15 = 1061997773;
}
int v1_10 = kotlin.coroutines.jvm.internal.Boxing.boxFloat(v3_15);
Boolean v2_8 = ((n.v0) v5_11);
this.d = 1;
if (n.c.b(v0_37, v1_10, v2_8, 0, this, 12) == v10_5) {
v6_2 = v10_5;
}
} else {
if (v0_35 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p20);
}
}
return v6_2;
}
}
}
+292
View File
@@ -0,0 +1,292 @@
package b9;
public final class g0 extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public final synthetic int c;
public int d;
public int e;
public Object f;
public final synthetic Object g;
public g0(b9.l0 p2, kotlin.coroutines.Continuation p3)
{
this.c = 0;
this.g = p2;
super(2, p3);
return;
}
public g0(java.util.List p2, c0.d p3, int p4, kotlin.coroutines.Continuation p5)
{
this.c = 1;
this.f = p2;
this.g = p3;
this.e = p4;
super(2, p5);
return;
}
public synthetic g0(n.c p1, int p2, Object p3, kotlin.coroutines.Continuation p4, int p5)
{
this.c = p5;
this.f = p1;
this.e = p2;
this.g = p3;
super(2, p4);
return;
}
public g0(y.t p2, int p3, kotlin.coroutines.Continuation p4)
{
this.c = 2;
this.g = p2;
this.e = p3;
super(2, p4);
return;
}
public final kotlin.coroutines.Continuation create(Object p9, kotlin.coroutines.Continuation p10)
{
switch (this.c) {
case 0:
return new b9.g0(((b9.l0) this.g), p10);
case 1:
return new b9.g0(((java.util.List) this.f), ((c0.d) this.g), this.e, p10);
case 2:
b9.g0 v10_2 = new b9.g0(((y.t) this.g), this.e, p10);
v10_2.f = p9;
return v10_2;
case 3:
return new b9.g0(((n.c) this.f), this.e, ((kotlin.jvm.internal.f0) this.g), p10, 3);
default:
return new b9.g0(((n.c) this.f), this.e, ((y0.t9) this.g), p10, 4);
}
}
public final Object invoke(Object p2, Object p3)
{
switch (this.c) {
case 0:
return ((b9.g0) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 1:
return ((b9.g0) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 2:
return ((b9.g0) this.create(((s.t2) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
case 3:
return ((b9.g0) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
default:
return ((b9.g0) this.create(((kotlinx.coroutines.CoroutineScope) p2), ((kotlin.coroutines.Continuation) p3))).invokeSuspend(p6.a0.a);
}
}
public final Object invokeSuspend(Object p21)
{
String v6_2 = p6.a0.a;
Boolean v1_9 = this.g;
switch (this.c) {
case 0:
int v2_5;
String v0_3;
String v6_3;
Exception v3_2;
Object v18;
Boolean v1_18 = ((b9.l0) v1_9);
int v5_7 = v1_18.u;
Object v7_2 = v1_18.s;
kotlinx.coroutines.flow.MutableStateFlow v8 = v1_18.o;
kotlinx.coroutines.flow.MutableStateFlow v9 = v1_18.i;
kotlinx.coroutines.flow.MutableStateFlow v10 = v1_18.q;
String v0_31 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
String v11_0 = this.e;
String v12 = "\u56fa\u4ef6\u5217\u8868\u52a0\u8f7d\u5931\u8d25";
q6.u v13 = q6.u.c;
q6.t v14 = q6.t.c;
int v16_0 = 1;
try {
if (v11_0 == null) {
q6.y.Y(p21);
v10.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(1));
v5_7.setValue(0);
v9.setValue(v14);
v1_18.m.setValue(v13);
v8.setValue(v13);
v1_18.f.setValue(q6.v.c);
v2_5 = (v1_18.h + 1);
v1_18.h = v2_5;
String v11_1 = new p6.g[0];
String v11_2 = w7.w.e(v11_1);
this.d = v2_5;
this.e = 1;
v3_2 = k8.h.c("https://qbsg.top/api/firmware/catalog", v11_2, this);
if (v3_2 != v0_31) {
Exception v3_3 = ((String) v3_2);
v18 = v6_2;
String v6_0 = new p6.g[0];
String v6_1 = w7.w.e(v6_0);
this.f = v3_3;
this.d = v2_5;
this.e = 2;
v6_2 = k8.h.c("https://qbsg.top/api/activation/firmware-list", v6_1, this);
if (v6_2 != v0_31) {
v0_3 = v3_3;
String v6_4 = ((String) v6_2);
String v0_9 = w7.w.k(v0_3);
String v11_4 = "";
Exception v3_6 = v0_9.m("type");
if (v3_6 != null) {
v11_4 = v3_6;
} else {
}
if (!v11_4.equals("success")) {
String v0_10 = v0_9.m("message");
if (v0_10 == null) {
v0_10 = "\u56fa\u4ef6\u5217\u8868\u52a0\u8f7d\u5931\u8d25";
}
throw new Exception(v0_10);
} else {
String v0_11 = a.a.i(v0_9, a.a.g(w7.w.k(v6_4)));
Exception v3_13 = a.a.h(v0_11);
if (v2_5 != v1_18.h) {
v1_18.d();
v7_2.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(1));
v10.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
v6_3 = v18;
} else {
v9.setValue(v0_11);
v8.setValue(v3_13);
}
}
} else {
v6_3 = v0_31;
}
} else {
}
} else {
try {
if (v11_0 == 1) {
v2_5 = this.d;
q6.y.Y(p21);
v3_2 = p21;
} else {
if (v11_0 != 2) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
v2_5 = this.d;
v0_3 = ((String) this.f);
q6.y.Y(p21);
v18 = v6_2;
v6_2 = p21;
}
}
} catch (String v0_7) {
int v17_0 = 0;
v1_18.d();
v7_2.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v16_0));
v10.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v17_0));
throw v0_7;
}
}
} catch (String v0_8) {
v18 = v6_2;
if (v2_5 != v1_18.h) {
} else {
String v0_12 = v0_8.getMessage();
if (v0_12 != null) {
v12 = v0_12;
} else {
}
v5_7.setValue(v12);
v9.setValue(v14);
v8.setValue(v13);
}
} catch (String v0_7) {
v16_0 = 1;
v17_0 = 0;
} catch (String v0_8) {
}
return v6_3;
case 1:
Boolean v1_16 = ((c0.d) v1_9);
String v0_27 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
int v5_5 = this.d;
if (v5_5 == 0) {
q6.y.Y(p21);
if (!((java.util.List) this.f).isEmpty()) {
int v5_6 = this.e;
if (v1_16.d.b.h() != v5_6) {
this.d = 1;
if (c0.i0.r(v1_16, v5_6, this) == v0_27) {
v6_2 = v0_27;
}
}
}
} else {
if (v5_5 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p21);
}
}
return v6_2;
case 2:
String v0_24 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
int v5_2 = this.d;
if (v5_2 == 0) {
q6.y.Y(p21);
Boolean v1_10 = ((y.t) v1_9);
int v5_4 = new c0.a0(((s.t2) this.f), v1_10, 1);
int v2_15 = this.e;
Boolean v1_14 = ((y.n) v1_10.f.getValue()).i;
this.d = 1;
if (a0.v1.a(v5_4, v2_15, 100, v1_14, this) == v0_24) {
v6_2 = v0_24;
}
} else {
if (v5_2 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p21);
}
}
return v6_2;
case 3:
Object v7_1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
String v0_30 = this.d;
if (v0_30 == null) {
q6.y.Y(p21);
String v0_2 = ((n.c) this.f);
int v2_7 = kotlin.coroutines.jvm.internal.Boxing.boxInt(this.e);
Boolean v1_2 = ((n.k) ((kotlin.jvm.internal.f0) v1_9).c);
this.d = 1;
if (n.c.b(v0_2, v2_7, v1_2, 0, this, 12) == v7_1) {
v6_2 = v7_1;
}
} else {
if (v0_30 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p21);
}
}
return v6_2;
default:
Object v7_0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
String v0_15 = this.d;
if (v0_15 == null) {
q6.y.Y(p21);
String v0_17 = ((n.c) this.f);
int v2_10 = kotlin.coroutines.jvm.internal.Boxing.boxInt(this.e);
Boolean v1_6 = ((y0.t9) v1_9).b;
this.d = 1;
if (n.c.b(v0_17, v2_10, v1_6, 0, this, 12) == v7_0) {
v6_2 = v7_0;
}
} else {
if (v0_15 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
q6.y.Y(p21);
}
}
return v6_2;
}
}
}
+461
View File
@@ -0,0 +1,461 @@
package c8;
public final class f extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public long c;
public Object d;
public java.util.Iterator e;
public byte[] f;
public byte[] g;
public Object h;
public int i;
public int j;
public int k;
public int l;
public int m;
public int n;
public boolean o;
public int p;
public final synthetic c8.g q;
public final synthetic Object r;
public final synthetic g8.d s;
public final synthetic a7.a t;
public f(c8.g p1, Object p2, g8.d p3, a7.a p4, kotlin.coroutines.Continuation p5)
{
this.q = p1;
this.r = p2;
this.s = p3;
this.t = p4;
super(2, p5);
return;
}
public final kotlin.coroutines.Continuation create(Object p7, kotlin.coroutines.Continuation p8)
{
return new c8.f(this.q, this.r, this.s, this.t, p8);
}
public final Object invoke(Object p1, Object p2)
{
return ((c8.f) this.create(((kotlinx.coroutines.CoroutineScope) p1), ((kotlin.coroutines.Continuation) p2))).invokeSuspend(p6.a0.a);
}
public final Object invokeSuspend(Object p34)
{
try {
java.util.List v7_11;
int v8_4;
int v10;
int v5_0;
byte[] v21_1;
java.util.List v7_13;
byte[] v12_11;
int v9_1;
String v3_9;
int v9_0;
int v15_2;
int v20_5;
byte[] v21_0;
byte[] v11_10;
kotlinx.coroutines.flow.MutableStateFlow v23_0;
p6.g v13_10;
StringBuilder v2_0;
int v6_17;
int v8_3;
byte[] v11_4;
String v22_1;
p6.g v13_11;
int v15_0;
int v20_2;
int v24_4;
byte[] v12_15;
int v14_4;
byte[] v11_8;
int v34_2;
int v15_6;
int v6_19;
int v6_15;
int v14_2;
byte[] v11_6;
int v5_1;
Throwable v0_0 = this.q;
StringBuilder v2_1 = v0_0.j;
v3_9 = v0_0.h;
String v4_5 = v0_0.b;
v5_0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
java.util.List v7_12 = p6.a0.a;
switch (this.p) {
case 0:
int v8_10;
q6.y.Y(p34);
v9_0 = System.currentTimeMillis();
v0_0.l("\u5f00\u59cbEPD\u901a\u9053\u56fe\u7247\u4e0a\u4f20");
int v6_28 = this.s.b;
if (v6_28 == 0) {
v8_10 = 0;
} else {
v8_10 = v6_28.d;
}
int v6_0;
if (v6_28 == 0) {
v6_0 = 0;
} else {
v6_0 = v6_28.e;
}
p6.g v13_0;
byte[] v12_0 = this.r;
kotlin.jvm.internal.s.f(v12_0, "bitmap");
if (v8_10 == 0) {
v13_0 = a.b.h(v12_0, 0);
} else {
v13_0 = a.b.i(v12_0, 0);
}
int v8_0;
if (v6_0 != 0) {
v8_0 = 0;
} else {
if (v8_10 == 0) {
v8_0 = a.b.h(v12_0, 1);
} else {
v8_0 = a.b.i(v12_0, 1);
}
}
int v6_4;
if (v8_0 == 0) {
v6_4 = k3.t.K(new p6.g(v13_0, Boolean.FALSE));
} else {
v6_4 = q6.n.Y(new p6.g[] {new p6.g(v13_0, Boolean.FALSE), new p6.g(v8_0, Boolean.TRUE)}));
}
v11_4 = v6_4;
int v6_8 = v11_4.iterator();
v8_3 = 0;
while (v6_8.hasNext()) {
v8_3 += ((byte[]) ((p6.g) v6_8.next()).c).length;
}
v3_9.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(1));
v2_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
byte[] v12_4 = new byte[2];
v12_4 = {-128, 0};
this.d = v11_4;
this.c = v9_0;
this.i = v8_3;
this.j = 0;
this.p = 1;
if (v4_5.sendEpdBytes(v12_4, this) != v5_0) {
v6_15 = 0;
p6.g v13_1 = new byte[2];
v13_1 = {0, 0};
this.d = v11_4;
this.c = v9_0;
this.i = v8_3;
this.j = v6_15;
this.p = 2;
if (v4_5.sendEpdBytes(v13_1, this) != v5_0) {
p6.g v13_2 = new byte[3];
v13_2 = {2, 0, 0};
this.d = v11_4;
this.c = v9_0;
this.i = v8_3;
this.j = v6_15;
this.p = 3;
if (v4_5.sendEpdBytes(v13_2, this) != v5_0) {
v12_11 = v11_4.iterator();
if (!v12_11.hasNext()) {
v15_0 = v2_1;
v2_0 = v5_0;
v21_0 = v7_12;
int v34_1 = v11_4;
v5_0 = v3_9;
String v3_0 = new byte[2];
v3_0 = {1, 1};
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v34_1);
this.e = 0;
this.f = 0;
this.g = 0;
this.h = 0;
this.c = v9_0;
this.i = v8_3;
this.j = v6_15;
this.p = 5;
if (v4_5.sendEpdBytes(v3_0, this) != v2_0) {
v11_6 = v34_1;
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v11_6);
this.c = v9_0;
this.i = v8_3;
this.j = v6_15;
this.p = 6;
if (v4_5.sendCommand("24494d4728302c3029", this) != v2_0) {
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v11_6);
this.c = v9_0;
this.i = v8_3;
this.j = v6_15;
this.p = 7;
if (v4_5.sendCommand("e2", this) != v2_0) {
v15_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(100));
StringBuilder v2_8 = w7.w.j((((float) (System.currentTimeMillis() - v9_0)) / 1148846080));
String v3_8 = new StringBuilder();
v3_8.append("\u4e0a\u4f20\u5b8c\u6210\uff0c\u8017\u65f6");
v3_8.append(v2_8);
v3_8.append("s");
v0_0.l(v3_8.toString());
this.t.invoke();
v5_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v21_0;
} else {
return v2_0;
}
} else {
return v2_0;
}
} else {
return v2_0;
}
} else {
int v15_1;
p6.g v13_5 = ((p6.g) v12_11.next());
int v14_1 = ((byte[]) v13_5.c);
p6.g v13_8 = ((Boolean) v13_5.d).booleanValue();
if (v13_8 != null) {
v15_1 = 0;
} else {
v15_1 = -1;
}
int v20_0;
if (v13_8 != null) {
v20_0 = "BWR";
} else {
v20_0 = "BW";
}
v21_1 = v7_12;
v34_2 = v11_4;
java.util.List v7_6 = v20_0;
byte[] v11_7 = v14_1.length;
int v20_1 = v12_11;
byte[] v12_14 = new StringBuilder();
String v22_0 = v13_8;
v12_14.append("\u53d1\u9001");
v12_14.append(v7_6);
v12_14.append(" ");
v12_14.append(v11_7);
v12_14.append("B");
v0_0.l(v12_14.toString());
v12_15 = v15_1;
v13_10 = v20_1;
v11_8 = v22_0;
v20_2 = 0;
v22_1 = v3_9;
v15_2 = 240;
v7_11 = v6_15;
v6_17 = v14_1;
v14_2 = 0;
if (v14_2 >= v6_17.length) {
int v16 = 3;
v11_4 = v34_2;
v6_15 = v7_11;
v12_11 = v13_10;
v7_12 = v21_1;
v3_9 = v22_1;
} else {
v23_0 = v2_1;
StringBuilder v2_13 = q6.n.k0(v6_17, v14_2, Math.min((v14_2 + v15_2), v6_17.length));
int v24_0 = v2_13;
String v3_14 = new byte[(v2_13.length + 4)];
v3_14[0] = 3;
v3_14[1] = ((byte) v12_15);
v3_14[2] = ((byte) (v14_2 >> 8));
v3_14[3] = ((byte) (v14_2 & 255));
q6.n.g0(v24_0, v3_14, 4, 0, 0, 12);
StringBuilder v2_20 = v24_0;
int v24_1 = v5_0;
v5_0 = (v20_2 + 1);
byte[] v25_1 = v3_14;
String v3_15 = v2_20.length;
int v20_3 = v4_5;
String v4_3 = new StringBuilder();
int v26_1 = v15_2;
v4_3.append("\u7b2c");
v4_3.append(v5_0);
v4_3.append("\u5757 \u00b7 ");
v4_3.append(v3_15);
v4_3.append("B \u00b7 \u504f\u79fb");
v4_3.append(v14_2);
v0_0.l(v4_3.toString());
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v34_2);
this.e = v13_10;
this.f = v6_17;
this.g = v2_20;
this.h = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v25_1);
this.c = v9_0;
this.i = v8_3;
this.j = v7_11;
this.o = v11_8;
this.k = v12_15;
String v3_20 = v26_1;
this.l = v3_20;
this.m = v14_2;
this.n = v5_0;
this.p = 4;
v4_5 = v20_3;
v15_6 = v4_5.sendEpdBytes(v25_1, this);
v2_0 = v24_1;
if (v15_6 != v2_0) {
v20_5 = v3_20;
v3_9 = v2_20;
v14_4 = v13_10;
v13_11 = v14_2;
v24_4 = v5_0;
v5_1 = v6_17;
v6_19 = v34_2;
v8_4 = v7_11;
v7_13 = v12_15;
v9_1 = v8_3;
v10 = v11_8;
v11_10 = v9_0;
while (!((Boolean) v15_6).booleanValue()) {
try {
v0_0.l("\u53d1\u9001\u5931\u8d25\uff0c\u5df2\u4e2d\u6b62");
v23_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
StringBuilder v2_22 = v22_1;
try {
v2_22.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
v2_22.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v21_1;
} catch (Throwable v0_5) {
v5_0 = v2_22;
}
} catch (Throwable v0_5) {
v2_22 = v22_1;
}
v2_22.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
v2_22.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v21_1;
}
int v34_3 = v5_1;
int v5_2 = v22_1;
int v15_10 = v23_0;
p6.g v13_12 = (v13_11 + v20_5);
String v3_22 = (v3_9.length + v8_4);
v15_10.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(((v3_22 * 100) / v9_1)));
v6_17 = v34_3;
v34_2 = v6_19;
v14_2 = v13_12;
v13_10 = v14_4;
v22_1 = v5_2;
v8_3 = v9_1;
v5_0 = v2_0;
v2_1 = v15_10;
v15_2 = v20_5;
v20_2 = v24_4;
v7_11 = v3_22;
v12_15 = v7_13;
v11_8 = v10;
v9_0 = v11_10;
} else {
return v2_0;
}
}
}
} else {
v2_0 = v5_0;
return v2_0;
}
} else {
}
} else {
}
case 1:
v6_15 = this.j;
v8_3 = this.i;
v9_0 = this.c;
v11_4 = ((java.util.List) this.d);
q6.y.Y(p34);
break;
case 2:
v6_15 = this.j;
v8_3 = this.i;
v9_0 = this.c;
v11_4 = ((java.util.List) this.d);
q6.y.Y(p34);
break;
case 3:
v6_15 = this.j;
v8_3 = this.i;
v9_0 = this.c;
v11_4 = ((java.util.List) this.d);
q6.y.Y(p34);
break;
case 4:
v13_11 = this.m;
int v14_3 = this.l;
int v15_7 = this.k;
v10 = this.o;
v8_4 = this.j;
v9_1 = this.i;
v11_10 = this.c;
int v20_6 = this.n;
byte[] v21_2 = this.g;
String v22_2 = this.f;
kotlinx.coroutines.flow.MutableStateFlow v23_1 = this.e;
v6_19 = ((java.util.List) this.d);
q6.y.Y(p34);
v24_4 = v20_6;
int v19 = 1;
v20_5 = v14_3;
v14_4 = v23_1;
v23_0 = v2_1;
v2_0 = v5_0;
v5_1 = v22_2;
v22_1 = v3_9;
v3_9 = v21_2;
v21_1 = v7_12;
v7_13 = v15_7;
v15_6 = p34;
break;
case 5:
v6_15 = this.j;
v8_3 = this.i;
v9_0 = this.c;
v11_6 = ((java.util.List) this.d);
q6.y.Y(p34);
v15_0 = v2_1;
v2_0 = v5_0;
v21_0 = v7_12;
v5_0 = v3_9;
break;
case 6:
v6_15 = this.j;
v8_3 = this.i;
v9_0 = this.c;
v11_6 = ((java.util.List) this.d);
q6.y.Y(p34);
v15_0 = v2_1;
v2_0 = v5_0;
v21_0 = v7_12;
v5_0 = v3_9;
break;
case 7:
String v4_0 = this.c;
q6.y.Y(p34);
v15_0 = v2_1;
v9_0 = v4_0;
v21_0 = v7_12;
v5_0 = v3_9;
v15_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(100));
v2_8 = w7.w.j((((float) (System.currentTimeMillis() - v9_0)) / 1148846080));
v3_8 = new StringBuilder();
v3_8.append("\u4e0a\u4f20\u5b8c\u6210\uff0c\u8017\u65f6");
v3_8.append(v2_8);
v3_8.append("s");
v0_0.l(v3_8.toString());
this.t.invoke();
v5_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v21_0;
default:
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
}
} catch (Throwable v0_5) {
v5_0 = v3_9;
}
v5_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
throw v0_5;
}
}
+200
View File
@@ -0,0 +1,200 @@
package c8;
public final class g extends e8.o implements b8.c {
public final kotlinx.coroutines.flow.StateFlow A;
public final f8.a q;
public final kotlinx.coroutines.flow.MutableStateFlow r;
public final kotlinx.coroutines.flow.StateFlow s;
public final kotlinx.coroutines.flow.MutableStateFlow t;
public final kotlinx.coroutines.flow.StateFlow u;
public final kotlinx.coroutines.flow.MutableStateFlow v;
public final kotlinx.coroutines.flow.StateFlow w;
public final kotlinx.coroutines.flow.MutableStateFlow x;
public final kotlinx.coroutines.flow.StateFlow y;
public final kotlinx.coroutines.flow.MutableStateFlow z;
public g(String p2, qbsg.top.ble.data.BleSessionFacade p3, kotlinx.coroutines.flow.SharedFlow p4, f8.a p5)
{
kotlin.jvm.internal.s.f(p2, "macAddress");
kotlin.jvm.internal.s.f(p3, "session");
super(p2, p3, p4);
super.q = p5;
kotlinx.coroutines.flow.StateFlow v2_14 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow("");
super.r = v2_14;
super.s = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_14);
kotlinx.coroutines.flow.StateFlow v2_4 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(new e8.a());
super.t = v2_4;
super.u = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_4);
kotlinx.coroutines.flow.StateFlow v2_8 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(new e8.a());
super.v = v2_8;
super.w = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_8);
kotlinx.coroutines.flow.StateFlow v3_1 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
super.x = v3_1;
super.y = kotlinx.coroutines.flow.FlowKt.asStateFlow(v3_1);
kotlinx.coroutines.flow.StateFlow v2_11 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
super.z = v2_11;
super.A = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_11);
return;
}
public static String p(int p2)
{
if (p2 == null) {
return "e102";
} else {
if (p2 == 1) {
return "e101";
} else {
if (p2 != 2) {
throw new IllegalArgumentException(a1.a.j(p2, "Unknown row: "));
} else {
return "e100";
}
}
}
}
public final kotlinx.coroutines.flow.StateFlow a()
{
return this.s;
}
public final void b(int p4)
{
this.i(q6.n.Y(new String[] {c8.g.p(p4), "TIME", "e2"})), new c0.j0(this, p4, 1));
return;
}
public final kotlinx.coroutines.flow.StateFlow c()
{
return this.y;
}
public final void d(String p4)
{
kotlin.jvm.internal.s.f(p4, "number");
java.util.List v0_9 = java.util.regex.Pattern.compile("^[0-9]{11}$");
kotlin.jvm.internal.s.e(v0_9, "compile(...)");
if (!v0_9.matcher(p4).matches()) {
throw new e8.p("\u7535\u8bdd\u53f7\u7801\u5fc5\u987b\u662f11\u4f4d\u7eaf\u6570\u5b57");
} else {
java.util.List v0_4 = new StringBuilder("ef");
a0.f2 v1_1 = 0;
while (v1_1 < p4.length()) {
int v2_2 = p4.charAt(v1_1);
v0_4.append(v2_2);
v0_4.append(v2_2);
v1_1++;
}
this.i(q6.n.Y(new String[] {v0_4.toString(), "e2"})), new a0.f2(9, this, p4));
return;
}
}
public final void e(java.util.List p3)
{
this.i(p3, new a5.a(14));
return;
}
public final void f(int p8, int p9, boolean p10)
{
String v2_0 = 1;
if (p10 == null) {
c8.e v10_14 = ((Integer) this.x.getValue());
Integer v3_1 = ((Integer) this.z.getValue());
java.util.ArrayList v4_1 = new java.util.ArrayList();
int v5 = 0;
if ((v10_14 == null) || ((v10_14.intValue() != p8) || ((v3_1 == null) || (p9 <= v3_1.intValue())))) {
if ((v10_14 == null) || (v10_14.intValue() == p8)) {
if (p8 != 0) {
v2_0 = 0;
}
v4_1.add(c8.g.p(v2_0));
c8.e v10_6 = (p9 + 1);
while (v5 < v10_6) {
v4_1.add(c8.g.p(p8));
v5++;
}
} else {
c8.e v10_7 = (p9 + 1);
while (v5 < v10_7) {
v4_1.add(c8.g.p(p8));
v5++;
}
}
} else {
c8.e v10_2 = (p9 - v3_1.intValue());
while (v5 < v10_2) {
v4_1.add(c8.g.p(p8));
v5++;
}
}
v4_1.add("TIME");
v4_1.add("e2");
this.i(v4_1, new c8.e(p8, p9, 1, this));
return;
} else {
c8.e v10_12;
if (p8 == 0) {
v10_12 = a1.a.j((p9 + 1), "e1020");
} else {
if (p8 == 1) {
v10_12 = a1.a.j((p9 + 3), "e1010");
} else {
v10_12 = "e10000";
}
}
this.i(q6.n.Y(new String[] {v10_12, "TIME", "e2"})), new c8.e(p8, p9, 0, this));
return;
}
}
public final kotlinx.coroutines.flow.StateFlow g()
{
return this.A;
}
public final String j()
{
return "\u5e73\u5e73/\u626b\u5730";
}
public final void n(Object p8, g8.d p9, a7.a p10)
{
kotlin.jvm.internal.s.f(p8, "processedBitmap");
kotlin.jvm.internal.s.f(p9, "config");
this.f = kotlinx.coroutines.BuildersKt.launch$default(this.e, 0, 0, new c8.f(this, p8, p9, p10, 0), 3, 0);
return;
}
public final void o(e8.a p10, int p11)
{
a9.v1 v1_2;
java.util.ArrayList v0_0 = p10.a;
if (p11 != 16) {
v1_2 = 4;
} else {
v1_2 = 8;
}
int v2_0 = p10.f;
int v3 = p10.e;
int v4 = p10.d;
if ((v0_0.length() == 0) || (v0_0.length() > v1_2)) {
throw new e8.q(a1.a.k("\u5b57\u6570\u5fc5\u987b\u57281~", v1_2, " \u4e4b\u95f4"));
} else {
if (a.b.l(v4, v3, v2_0) <= a.b.M()) {
throw new e8.p("\u76ee\u6807\u65e5\u671f\u5fc5\u987b\u665a\u4e8e\u4eca\u5929");
} else {
f8.a v6 = this.q;
java.util.ArrayList v0_3 = q6.o.H0(v6.c(v0_0, p11, p10.b, p10.c));
if (v0_3.isEmpty()) {
throw new e8.r("\u672a\u80fd\u751f\u6210\u5012\u8ba1\u65f6\u6587\u5b57\uff0c\u8bf7\u68c0\u67e5\u5b57\u4f53\u6216\u5185\u5bb9");
} else {
v0_3.add(v6.b(p11, v4, v3, v2_0));
this.i(q6.o.y0(v0_3, "e2"), new a9.v1(p11, this, p10, 1));
return;
}
}
}
}
}
+471
View File
@@ -0,0 +1,471 @@
package d8;
public final class e extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public long c;
public Object d;
public java.util.Iterator e;
public byte[] f;
public kotlin.jvm.internal.d0 g;
public byte[] h;
public Object i;
public int j;
public int k;
public int l;
public int m;
public int n;
public boolean o;
public int p;
public final synthetic d8.f q;
public final synthetic Object r;
public final synthetic g8.d s;
public final synthetic a7.a t;
public e(d8.f p1, Object p2, g8.d p3, a7.a p4, kotlin.coroutines.Continuation p5)
{
this.q = p1;
this.r = p2;
this.s = p3;
this.t = p4;
super(2, p5);
return;
}
public final kotlin.coroutines.Continuation create(Object p7, kotlin.coroutines.Continuation p8)
{
return new d8.e(this.q, this.r, this.s, this.t, p8);
}
public final Object invoke(Object p1, Object p2)
{
return ((d8.e) this.create(((kotlinx.coroutines.CoroutineScope) p1), ((kotlin.coroutines.Continuation) p2))).invokeSuspend(p6.a0.a);
}
public final Object invokeSuspend(Object p31)
{
try {
int v18_5;
byte[] v9_1;
String v21_2;
Integer v7_0;
long v10_0;
byte[] v15_0;
Exception v0_21;
boolean v12_11;
int v22_0;
Integer v3_0;
Exception v0_24;
int v11_1;
byte[] v15_4;
Integer v5_1;
int v20_0;
int v8_10;
boolean v12_15;
Integer v7_7;
boolean v23_1;
Integer v7_8;
Exception v0_1;
int v13_9;
int v18_2;
String v6_0;
int v11_9;
int v24_3;
String v4_0;
String v6_1;
byte[] v14_2;
byte[] v9_0;
Integer v31_3;
Exception v0_0 = this.r;
Boolean v2_0 = this.q;
v3_0 = v2_0.j;
v4_0 = v2_0.h;
v5_1 = v2_0.b;
v6_0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
v8_10 = p6.a0.a;
switch (this.p) {
case 0:
q6.y.Y(p31);
v9_0 = System.currentTimeMillis();
v2_0.l("\u5f00\u59cbEPD\u901a\u9053\u56fe\u7247\u4e0a\u4f20");
v4_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(1));
v3_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
v11_1 = q6.n.Y(new p6.g[] {new p6.g(d8.f.o(v2_0, v0_0, 0), kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0)), new p6.g(d8.f.o(v2_0, v0_0, 1), kotlin.coroutines.jvm.internal.Boxing.boxBoolean(1))}));
Exception v0_6 = v11_1.iterator();
v7_0 = 0;
while (v0_6.hasNext()) {
v7_0 += ((byte[]) ((p6.g) v0_6.next()).c).length;
}
Exception v0_8 = d8.f.p(v2_0, "8001");
this.d = v11_1;
this.c = v9_0;
this.j = v7_0;
this.k = 0;
this.p = 1;
if (v5_1.sendEpdBytes(v0_8, this) != v6_0) {
v0_1 = 0;
boolean v12_6 = d8.f.p(v2_0, "0000");
this.d = v11_1;
this.c = v9_0;
this.j = v7_0;
this.k = v0_1;
this.p = 2;
if (v5_1.sendEpdBytes(v12_6, this) != v6_0) {
boolean v12_9 = d8.f.p(v2_0, "020000");
this.d = v11_1;
this.c = v9_0;
this.j = v7_0;
this.k = v0_1;
this.p = 3;
if (v5_1.sendEpdBytes(v12_9, this) != v6_0) {
v12_11 = v11_1.iterator();
if (!v12_11.hasNext()) {
Integer v31_1 = v5_1;
v5_1 = v3_0;
v3_0 = v6_0;
v6_0 = v4_0;
v4_0 = v31_1;
v22_0 = v8_10;
Integer v31_2 = v11_1;
int v8_1 = d8.f.p(v2_0, "0101");
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v31_2);
this.e = 0;
this.f = 0;
this.g = 0;
this.h = 0;
this.i = 0;
this.c = v9_0;
this.j = v7_0;
this.k = v0_1;
this.p = 5;
if (v4_0.sendEpdBytes(v8_1, this) != v3_0) {
v11_9 = v31_2;
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v11_9);
this.c = v9_0;
this.j = v7_0;
this.k = v0_1;
this.p = 6;
if (kotlinx.coroutines.DelayKt.delay(300, this) != v3_0) {
int v8_8;
int v8_7 = this.s.b;
if (v8_7 == 0) {
v8_8 = 0;
} else {
v8_8 = v8_7.f;
}
int v8_9;
if (v8_8 == 0) {
v8_9 = "e2";
} else {
v8_9 = "aa";
}
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v11_9);
this.c = v9_0;
this.j = v7_0;
this.k = v0_1;
this.p = 7;
if (v4_0.sendCommand(v8_9, this) != v3_0) {
v5_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(100));
Exception v0_16 = w7.w.j((((float) (System.currentTimeMillis() - v9_0)) / 1148846080));
Integer v3_5 = new StringBuilder();
v3_5.append("\u4e0a\u4f20\u5b8c\u6210\uff0c\u8017\u65f6");
v3_5.append(v0_16);
v3_5.append("s");
v2_0.l(v3_5.toString());
this.t.invoke();
v6_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v22_0;
} else {
return v3_0;
}
} else {
return v3_0;
}
} else {
return v3_0;
}
} else {
int v13_4 = ((p6.g) v12_11.next());
byte[] v14_1 = ((byte[]) v13_4.c);
int v13_7 = ((Boolean) v13_4.d).booleanValue();
if (v13_7 != 0) {
v15_0 = 0;
} else {
v15_0 = -1;
}
String v21_0;
int v18_1 = new kotlin.jvm.internal.d0();
if (v13_7 != 0) {
v21_0 = "BWR";
} else {
v21_0 = "BW";
}
v22_0 = v8_10;
v31_3 = v11_1;
v8_10 = v21_0;
int v11_12 = v14_1.length;
String v21_1 = v12_11;
boolean v12_14 = new StringBuilder();
boolean v23_0 = v13_7;
v12_14.append("\u53d1\u9001");
v12_14.append(v8_10);
v12_14.append(" ");
v12_14.append(v11_12);
v12_14.append("B");
v2_0.l(v12_14.toString());
v8_10 = 240;
v10_0 = v9_0;
v13_9 = v18_1;
v12_15 = v23_0;
v18_2 = 0;
v9_1 = v7_0;
v7_7 = v0_1;
v0_21 = v14_1;
v14_2 = v21_1;
v21_2 = v4_0;
String v4_2 = v13_9.c;
v23_1 = v3_0;
if (v4_2 >= v0_21.length) {
int v17 = 2;
v0_1 = v7_7;
v7_0 = v9_1;
v9_0 = v10_0;
v12_11 = v14_2;
v4_0 = v21_2;
v8_10 = v22_0;
v3_0 = v23_1;
v11_1 = v31_3;
} else {
Integer v3_9 = q6.n.k0(v0_21, v13_9.c, Math.min((v4_2 + v8_10), v0_21.length));
int v24_0 = v3_9;
String v4_7 = new byte[(v3_9.length + 4)];
v4_7[0] = 3;
v4_7[1] = ((byte) v15_0);
Integer v3_12 = v13_9.c;
byte[] v25_0 = v4_7;
v25_0[2] = ((byte) (v3_12 >> 8));
v25_0[3] = ((byte) (v3_12 & 255));
q6.n.g0(v24_0, v25_0, 4, 0, 0, 12);
Integer v3_15 = v24_0;
int v24_1 = v6_0;
v6_0 = (v18_2 + 1);
byte[] v25_1 = v25_0;
String v4_11 = v3_15.length;
int v18_3 = v5_1;
Integer v5_2 = v13_9.c;
String v26_1 = v8_10;
int v8_15 = new StringBuilder();
int v27_1 = v15_0;
v8_15.append("\u7b2c");
v8_15.append(v6_0);
v8_15.append("\u5757 \u00b7 ");
v8_15.append(v4_11);
v8_15.append("B \u00b7 \u504f\u79fb");
v8_15.append(v5_2);
v2_0.l(v8_15.toString());
this.d = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v31_3);
this.e = v14_2;
this.f = v0_21;
this.g = v13_9;
this.h = v3_15;
this.i = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v25_1);
this.c = v10_0;
this.j = v9_1;
this.k = v7_7;
this.o = v12_15;
byte[] v15_3 = v27_1;
this.l = v15_3;
v8_10 = v26_1;
this.m = v8_10;
this.n = v6_0;
this.p = 4;
v4_0 = v18_3;
v5_1 = v4_0.sendEpdBytes(v25_1, this);
v3_0 = v24_1;
if (v5_1 != v3_0) {
v15_4 = v7_7;
v7_8 = v3_15;
v18_5 = v15_3;
v24_3 = v6_0;
v6_1 = v0_21;
v0_24 = v31_3;
while (!((Boolean) v5_1).booleanValue()) {
try {
v2_0.l("\u53d1\u9001\u5931\u8d25\uff0c\u5df2\u4e2d\u6b62");
v5_1 = v23_1;
try {
v5_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
v21_2.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v22_0;
} catch (Exception v0_22) {
Integer v3_16 = v21_2;
v6_0 = v3_16;
Exception v0_34 = v0_22.getMessage();
Integer v3_20 = new StringBuilder();
v3_20.append("\u4f20\u8f93\u4e2d\u65ad: ");
v3_20.append(v0_34);
v2_0.l(v3_20.toString());
v5_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
v6_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v22_0;
}
} catch (Exception v0_22) {
v3_16 = v21_2;
v5_1 = v23_1;
} catch (Exception v0_2) {
v6_0 = v21_2;
v20_0 = 0;
}
v5_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
v21_2.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v22_0;
}
Integer v31_4 = v6_1;
String v6_2 = v21_2;
Integer v5_6 = v23_1;
String v21_3 = v0_24;
v13_9.c = (v13_9.c + v8_10);
v7_7 = (v15_4 + v7_8.length);
v5_6.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(((v7_7 * 100) / v9_1)));
v0_21 = v31_4;
v15_0 = v18_5;
v31_3 = v21_3;
v18_2 = v24_3;
v21_2 = v6_2;
v6_0 = v3_0;
v3_0 = v5_6;
v5_1 = v4_0;
} else {
return v3_0;
}
}
}
} else {
v3_0 = v6_0;
return v3_0;
}
} else {
}
} else {
}
case 1:
v20_0 = 0;
v0_1 = this.k;
v7_0 = this.j;
v9_0 = this.c;
v11_1 = ((java.util.List) this.d);
q6.y.Y(p31);
break;
case 2:
v20_0 = 0;
v0_1 = this.k;
v7_0 = this.j;
v9_0 = this.c;
v11_1 = ((java.util.List) this.d);
q6.y.Y(p31);
break;
case 3:
v20_0 = 0;
v0_1 = this.k;
v7_0 = this.j;
v9_0 = this.c;
v11_1 = ((java.util.List) this.d);
q6.y.Y(p31);
break;
case 4:
Integer v7_9 = this.m;
int v13_10 = this.l;
byte[] v14_3 = this.o;
v15_4 = this.k;
int v18_6 = this.j;
byte[] v9_2 = this.c;
int v11_15 = this.h;
v20_0 = 0;
boolean v12_21 = this.g;
String v21_4 = this.n;
int v22_3 = this.f;
boolean v23_2 = this.e;
v0_24 = ((java.util.List) this.d);
q6.y.Y(p31);
v23_1 = v3_0;
v3_0 = v6_0;
v6_1 = v22_3;
v22_0 = v8_10;
v8_10 = v7_9;
v7_8 = v11_15;
v10_0 = v9_2;
v9_1 = v18_6;
v18_5 = v13_10;
v13_9 = v12_21;
v12_15 = v14_3;
v14_2 = v23_2;
v24_3 = v21_4;
v17 = 2;
v21_2 = v4_0;
v4_0 = v5_1;
v5_1 = p31;
break;
case 5:
v0_1 = this.k;
v7_0 = this.j;
v9_0 = this.c;
v11_9 = ((java.util.List) this.d);
q6.y.Y(p31);
int v22_2 = v5_1;
v5_1 = v3_0;
v3_0 = v6_0;
v6_0 = v4_0;
v4_0 = v22_2;
v22_0 = v8_10;
break;
case 6:
v0_1 = this.k;
v7_0 = this.j;
v9_0 = this.c;
v11_9 = ((java.util.List) this.d);
q6.y.Y(p31);
int v22_1 = v5_1;
v5_1 = v3_0;
v3_0 = v6_0;
v6_0 = v4_0;
v4_0 = v22_1;
v22_0 = v8_10;
break;
case 7:
Integer v5_0 = this.c;
q6.y.Y(p31);
v9_0 = v5_0;
v22_0 = v8_10;
v5_1 = v3_0;
v6_0 = v4_0;
v5_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(100));
v0_16 = w7.w.j((((float) (System.currentTimeMillis() - v9_0)) / 1148846080));
v3_5 = new StringBuilder();
v3_5.append("\u4e0a\u4f20\u5b8c\u6210\uff0c\u8017\u65f6");
v3_5.append(v0_16);
v3_5.append("s");
v2_0.l(v3_5.toString());
this.t.invoke();
v6_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v22_0;
default:
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
}
} catch (Exception v0_22) {
v5_1 = v3_0;
v6_0 = v4_0;
v22_0 = v8_10;
v0_34 = v0_22.getMessage();
v3_20 = new StringBuilder();
v3_20.append("\u4f20\u8f93\u4e2d\u65ad: ");
v3_20.append(v0_34);
v2_0.l(v3_20.toString());
v5_1.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
v6_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
return v22_0;
} catch (Exception v0_2) {
v6_0 = v4_0;
} catch (Exception v0_2) {
v6_0 = v4_0;
}
v6_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v20_0));
throw v0_2;
}
}
+298
View File
@@ -0,0 +1,298 @@
package d8;
public final class f extends e8.o implements b8.c {
public final kotlinx.coroutines.flow.StateFlow A;
public final f8.a q;
public final kotlinx.coroutines.flow.MutableStateFlow r;
public final kotlinx.coroutines.flow.StateFlow s;
public final kotlinx.coroutines.flow.MutableStateFlow t;
public final kotlinx.coroutines.flow.StateFlow u;
public final kotlinx.coroutines.flow.MutableStateFlow v;
public final kotlinx.coroutines.flow.StateFlow w;
public final kotlinx.coroutines.flow.MutableStateFlow x;
public final kotlinx.coroutines.flow.StateFlow y;
public final kotlinx.coroutines.flow.MutableStateFlow z;
public f(String p2, qbsg.top.ble.data.BleSessionFacade p3, kotlinx.coroutines.flow.SharedFlow p4, f8.a p5)
{
kotlin.jvm.internal.s.f(p2, "macAddress");
kotlin.jvm.internal.s.f(p3, "session");
super(p2, p3, p4);
super.q = p5;
kotlinx.coroutines.flow.StateFlow v2_14 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow("");
super.r = v2_14;
super.s = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_14);
kotlinx.coroutines.flow.StateFlow v2_4 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(new e8.a());
super.t = v2_4;
super.u = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_4);
kotlinx.coroutines.flow.StateFlow v2_8 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(new e8.a());
super.v = v2_8;
super.w = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_8);
kotlinx.coroutines.flow.StateFlow v3_1 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
super.x = v3_1;
super.y = kotlinx.coroutines.flow.FlowKt.asStateFlow(v3_1);
kotlinx.coroutines.flow.StateFlow v2_11 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
super.z = v2_11;
super.A = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_11);
return;
}
public static final byte[] o(d8.f p9, Object p10, boolean p11)
{
int v6;
int v5_0;
kotlin.jvm.internal.s.f(p10, "bitmap");
int v0 = ((android.graphics.Bitmap) p10).getWidth();
int v9_6 = ((android.graphics.Bitmap) p10).getHeight();
byte[] v10_2 = g8.f.c(p10);
java.util.ArrayList v1_1 = new java.util.ArrayList();
int v4 = 0;
if ((v0 == 212) || ((v0 == 250) || (v0 == 296))) {
int v2_3 = (v0 - 1);
v5_0 = 0;
v6 = 0;
while (-1 < v2_3) {
int v7_1 = 0;
while (v7_1 < v9_6) {
v5_0 = ((v5_0 << 1) | d8.f.r(v10_2, v0, p11, v2_3, v7_1));
v6++;
if (v6 == 8) {
v1_1.add(Integer.valueOf(v5_0));
v5_0 = 0;
v6 = 0;
}
v7_1++;
}
v2_3--;
}
} else {
int v2_4 = 0;
v5_0 = 0;
v6 = 0;
while (v2_4 < v9_6) {
int v7_2 = 0;
while (v7_2 < v0) {
v5_0 = ((v5_0 << 1) | d8.f.r(v10_2, v0, p11, v7_2, v2_4));
v6++;
if (v6 == 8) {
v1_1.add(Integer.valueOf(v5_0));
v5_0 = 0;
v6 = 0;
}
v7_2++;
}
v2_4++;
}
}
if (v6 > 0) {
v1_1.add(Integer.valueOf((v5_0 << (8 - v6))));
}
int v9_5 = v1_1.size();
byte[] v10_1 = new byte[v9_5];
while (v4 < v9_5) {
v10_1[v4] = ((byte) ((Number) v1_1.get(v4)).intValue());
v4++;
}
return v10_1;
}
public static final byte[] p(d8.f p4, String p5)
{
IllegalArgumentException v4_2 = i7.p.j0(p5, " ", "");
if ((v4_2.length() % 2) != 0) {
throw new IllegalArgumentException("Failed requirement.");
} else {
String v5_2 = (v4_2.length() / 2);
byte[] v0_1 = new byte[v5_2];
int v1 = 0;
while (v1 < v5_2) {
byte v2_0 = (v1 * 2);
byte v2_1 = v4_2.substring(v2_0, (v2_0 + 2));
kotlin.jvm.internal.s.e(v2_1, "substring(...)");
c7.a.l(16);
v0_1[v1] = ((byte) Integer.parseInt(v2_1, 16));
v1++;
}
return v0_1;
}
}
public static final int r(int[] p0, int p1, boolean p2, int p3, int p4)
{
int v0_3 = p0[((p4 * p1) + p3)];
int v1_2 = ((v0_3 >> 16) & 255);
if (p2) {
if ((v1_2 > 0) && ((((v0_3 >> 8) & 255) == 0) && ((v0_3 & 255) == 0))) {
return 1;
}
} else {
if (v1_2 > 0) {
return 1;
}
}
return 0;
}
public static String s(int p2)
{
if (p2 == null) {
return "e102";
} else {
if (p2 == 1) {
return "e101";
} else {
if (p2 != 2) {
throw new IllegalArgumentException(a1.a.j(p2, "Unknown row: "));
} else {
return "e100";
}
}
}
}
public final kotlinx.coroutines.flow.StateFlow a()
{
return this.s;
}
public final void b(int p4)
{
this.i(q6.n.Y(new String[] {d8.f.s(p4), "TIME", "e2"})), new c0.j0(this, p4, 2));
return;
}
public final kotlinx.coroutines.flow.StateFlow c()
{
return this.y;
}
public final void d(String p5)
{
kotlin.jvm.internal.s.f(p5, "number");
java.util.List v0_9 = java.util.regex.Pattern.compile("^[0-9]{11}$");
kotlin.jvm.internal.s.e(v0_9, "compile(...)");
if (!v0_9.matcher(p5).matches()) {
throw new e8.p("\u7535\u8bdd\u53f7\u7801\u5fc5\u987b\u662f11\u4f4d\u7eaf\u6570\u5b57");
} else {
java.util.List v0_4 = new StringBuilder("ef");
a0.f2 v1_1 = 0;
while (v1_1 < p5.length()) {
int v2_2 = p5.charAt(v1_1);
c7.a.l(16);
int v2_3 = Integer.toString(v2_2, 16);
kotlin.jvm.internal.s.e(v2_3, "toString(...)");
v0_4.append(v2_3);
v1_1++;
}
this.i(q6.n.Y(new String[] {v0_4.toString(), "e2"})), new a0.f2(11, this, p5));
return;
}
}
public final void e(java.util.List p3)
{
this.i(p3, new a5.a(14));
return;
}
public final void f(int p8, int p9, boolean p10)
{
String v2_0 = 1;
if (p10 == null) {
d8.d v10_14 = ((Integer) this.x.getValue());
Integer v3_1 = ((Integer) this.z.getValue());
java.util.ArrayList v4_1 = new java.util.ArrayList();
int v5 = 0;
if ((v10_14 == null) || ((v10_14.intValue() != p8) || ((v3_1 == null) || (p9 <= v3_1.intValue())))) {
if ((v10_14 == null) || (v10_14.intValue() == p8)) {
if (p8 != 0) {
v2_0 = 0;
}
v4_1.add(d8.f.s(v2_0));
d8.d v10_6 = (p9 + 1);
while (v5 < v10_6) {
v4_1.add(d8.f.s(p8));
v5++;
}
} else {
d8.d v10_7 = (p9 + 1);
while (v5 < v10_7) {
v4_1.add(d8.f.s(p8));
v5++;
}
}
} else {
d8.d v10_2 = (p9 - v3_1.intValue());
while (v5 < v10_2) {
v4_1.add(d8.f.s(p8));
v5++;
}
}
v4_1.add("TIME");
v4_1.add("e2");
this.i(v4_1, new d8.d(this, p8, p9, 1));
return;
} else {
d8.d v10_12;
if (p8 == 0) {
v10_12 = a1.a.j((p9 + 1), "e1020");
} else {
if (p8 == 1) {
v10_12 = a1.a.j((p9 + 3), "e1010");
} else {
v10_12 = "e10000";
}
}
this.i(q6.n.Y(new String[] {v10_12, "TIME", "e2"})), new d8.d(this, p8, p9, 0));
return;
}
}
public final kotlinx.coroutines.flow.StateFlow g()
{
return this.A;
}
public final String j()
{
return "\u8f7b\u821e/\u65f6\u5149";
}
public final void n(Object p8, g8.d p9, a7.a p10)
{
kotlin.jvm.internal.s.f(p8, "processedBitmap");
kotlin.jvm.internal.s.f(p9, "config");
this.f = kotlinx.coroutines.BuildersKt.launch$default(this.e, 0, 0, new d8.e(this, p8, p9, p10, 0), 3, 0);
return;
}
public final void q(e8.a p10, int p11)
{
a9.v1 v1_2;
java.util.ArrayList v0_0 = p10.a;
if (p11 != 16) {
v1_2 = 4;
} else {
v1_2 = 8;
}
int v2_0 = p10.f;
int v3 = p10.e;
int v4 = p10.d;
if ((v0_0.length() == 0) || (v0_0.length() > v1_2)) {
throw new e8.q(a1.a.k("\u5b57\u6570\u5fc5\u987b\u57281~", v1_2, " \u4e4b\u95f4"));
} else {
if (a.b.l(v4, v3, v2_0) <= a.b.M()) {
throw new e8.p("\u76ee\u6807\u65e5\u671f\u5fc5\u987b\u665a\u4e8e\u4eca\u5929");
} else {
f8.a v6 = this.q;
java.util.ArrayList v0_3 = q6.o.H0(v6.c(v0_0, p11, p10.b, p10.c));
if (v0_3.isEmpty()) {
throw new e8.r("\u672a\u80fd\u751f\u6210\u5012\u8ba1\u65f6\u6587\u5b57\uff0c\u8bf7\u68c0\u67e5\u5b57\u4f53\u6216\u5185\u5bb9");
} else {
v0_3.add(v6.b(p11, v4, v3, v2_0));
this.i(q6.o.y0(v0_3, "e2"), new a9.v1(p11, this, p10, 2));
return;
}
}
}
}
}
+84
View File
@@ -0,0 +1,84 @@
package e8;
public final class a {
public final String a;
public final int b;
public final float c;
public final int d;
public final int e;
public final int f;
public a()
{
this("", 128, 1065353216, a.b.s(System.currentTimeMillis())[0], a.b.s(System.currentTimeMillis())[1], a.b.s(System.currentTimeMillis())[2]);
return;
}
public a(String p1, int p2, float p3, int p4, int p5, int p6)
{
this.a = p1;
this.b = p2;
this.c = p3;
this.d = p4;
this.e = p5;
this.f = p6;
return;
}
public static e8.a a(e8.a p7, String p8, int p9, float p10, int p11, int p12, int p13, int p14)
{
if ((p14 & 1) != 0) {
p8 = p7.a;
}
p7.getClass();
if ((p14 & 4) != 0) {
p9 = p7.b;
}
if ((p14 & 8) != 0) {
p10 = p7.c;
}
if ((p14 & 16) != 0) {
p11 = p7.d;
}
if ((p14 & 32) != 0) {
p12 = p7.e;
}
if ((p14 & 64) != 0) {
p13 = p7.f;
}
p7.getClass();
kotlin.jvm.internal.s.f(p8, "text");
return new e8.a(p8, p9, p10, p11, p12, p13);
}
public final boolean equals(Object p3)
{
if ((this == p3) || (((p3 instanceof e8.a)) && ((kotlin.jvm.internal.s.b(this.a, ((e8.a) p3).a)) && ((this.b == ((e8.a) p3).b) && ((Float.compare(this.c, ((e8.a) p3).c) == 0) && ((this.d == ((e8.a) p3).d) && ((this.e == ((e8.a) p3).e) && (this.f == ((e8.a) p3).f)))))))) {
return 1;
} else {
return 0;
}
}
public final int hashCode()
{
return (Integer.hashCode(this.f) + a1.a.c(this.e, a1.a.c(this.d, a1.a.b(this.c, a1.a.c(this.b, (this.a.hashCode() * 961), 31), 31), 31), 31));
}
public final String toString()
{
String v0_1 = new StringBuilder("CountdownConfig(text=");
v0_1.append(this.a);
v0_1.append(", fontPath=null, thickness=");
v0_1.append(this.b);
v0_1.append(", scale=");
v0_1.append(this.c);
v0_1.append(", targetYear=");
v0_1.append(this.d);
v0_1.append(", targetMonth=");
v0_1.append(this.e);
v0_1.append(", targetDay=");
v0_1.append(this.f);
v0_1.append(")");
return v0_1.toString();
}
}
+38
View File
@@ -0,0 +1,38 @@
package e8;
public final class b extends e8.e {
public final String a;
public b(String p2)
{
kotlin.jvm.internal.s.f(p2, "data");
this.a = p2;
return;
}
public final boolean equals(Object p4)
{
if (this != p4) {
if ((p4 instanceof e8.b)) {
if (kotlin.jvm.internal.s.b(this.a, ((e8.b) p4).a)) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
} else {
return 1;
}
}
public final int hashCode()
{
return this.a.hashCode();
}
public final String toString()
{
return p.p1.k("Log(data=", this.a, ")");
}
}
+218
View File
@@ -0,0 +1,218 @@
package e8;
public final class j extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public int c;
public int d;
public int e;
public int f;
public Object g;
public e8.o h;
public java.util.Iterator i;
public Object j;
public Object k;
public Object l;
public String m;
public int n;
public final synthetic e8.o o;
public final synthetic java.util.List p;
public final synthetic a7.a q;
public j(e8.o p1, java.util.List p2, a7.a p3, kotlin.coroutines.Continuation p4)
{
this.o = p1;
this.p = p2;
this.q = p3;
super(2, p4);
return;
}
public final kotlin.coroutines.Continuation create(Object p4, kotlin.coroutines.Continuation p5)
{
return new e8.j(this.o, this.p, this.q, p5);
}
public final Object invoke(Object p1, Object p2)
{
return ((e8.j) this.create(((kotlinx.coroutines.CoroutineScope) p1), ((kotlin.coroutines.Continuation) p2))).invokeSuspend(p6.a0.a);
}
public final Object invokeSuspend(Object p22)
{
int v10_5;
java.util.Iterator v13_2;
boolean v20;
int v11_1;
e8.d v5_11;
Object v6_6;
int v18;
java.util.List v15_2;
e8.d v14_0;
int v12_2;
Exception v0_5;
int v17_0;
Exception v0_0 = this.o;
int v2_0 = v0_0.h;
kotlinx.coroutines.sync.Mutex v3 = v0_0.g;
int v4_6 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
e8.d v5_12 = this.n;
Object v6_0 = p6.a0.a;
int v7_0 = 0;
int v8_0 = 0;
Object v9_0 = 1;
try {
if (v5_12 == null) {
q6.y.Y(p22);
if (kotlinx.coroutines.sync.Mutex$DefaultImpls.tryLock$default(v3, 0, 1, 0)) {
v2_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(1));
v0_0.j.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt(0));
int v11_0 = this.p;
e8.d v5_7 = v11_0.size();
int v10_2 = q6.o.s0(v11_0, "", 0, 0, new e1.v(2), 30);
int v12_5 = new StringBuilder("\u5f00\u59cb\u6267\u884c\uff0c\u5171");
v12_5.append(v5_7);
v12_5.append(" \u6761\u6307\u4ee4\uff1a");
v12_5.append(v10_2);
System.out.println(v12_5.toString());
v13_2 = v11_0.iterator();
v15_2 = v11_0;
v11_1 = v11_0.size();
v10_5 = 0;
v5_11 = v0_0;
v0_5 = 0;
if (!v13_2.hasNext()) {
v20 = v6_0;
v18 = v7_0;
v17_0 = v8_0;
try {
this.q.invoke();
v2_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v18));
v2_0 = v17_0;
kotlinx.coroutines.sync.Mutex$DefaultImpls.unlock$default(v3, v2_0, 1, v2_0);
return v20;
} catch (Exception) {
int v4_0 = 0;
int v7_3 = 1;
}
} else {
int v12_1 = v13_2.next();
v14_0 = (v0_5 + 1);
if (v0_5 < null) {
v20 = v6_0;
v18 = v7_0;
v17_0 = v8_0;
k3.t.W();
throw v17_0;
} else {
String v16_1 = ((String) v12_1);
v18 = v7_0;
int v7_2 = i7.i.S0(v16_1).toString();
v17_0 = v8_0;
try {
int v8_3;
if (!i7.p.f0(v7_2, "TIME")) {
v8_3 = v7_2;
} else {
v8_3 = e8.o.m();
}
} catch (Exception) {
v20 = v6_0;
v7_3 = v9_0;
v4_0 = v17_0;
}
Object v9_2 = new StringBuilder();
v20 = v6_0;
v9_2.append("\u6b63\u5728\u53d1\u9001(");
v9_2.append(v14_0);
v9_2.append("/");
v9_2.append(v11_1);
v9_2.append("): ");
v9_2.append(v8_3);
System.out.println(v9_2.toString());
try {
Object v6_5 = v5_11.b;
this.g = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v15_2);
this.h = v5_11;
this.i = v13_2;
this.j = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v12_1);
this.k = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v16_1);
this.l = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v7_2);
this.m = v8_3;
this.c = v11_1;
this.d = v10_5;
this.e = v14_0;
this.f = v0_5;
this.n = 1;
v6_6 = v6_5.sendCommand(v8_3, this);
} catch (Exception v0_6) {
v14_0 = v5_11;
v12_2 = v8_3;
int v4_1 = v0_6.getMessage();
e8.d v5_4 = new StringBuilder();
v5_4.append("\u6307\u4ee4\u53d1\u9001\u5931\u8d25 ");
v5_4.append(v12_2);
v5_4.append(", \u539f\u56e0: ");
v5_4.append(v4_1);
v14_0.l(v5_4.toString());
v14_0.l.tryEmit(new e8.d(v0_6, v12_2));
throw v0_6;
}
if (v6_6 != v4_6) {
v12_2 = v8_3;
if (!((Boolean) v6_6).booleanValue()) {
throw new IllegalStateException("\u53d1\u9001\u5931\u8d25");
} else {
v5_11.j.setValue(kotlin.coroutines.jvm.internal.Boxing.boxInt((((v0_5 + 1) * 100) / v11_1)));
v0_5 = v14_0;
v8_0 = v17_0;
v7_0 = v18;
v6_0 = v20;
v9_0 = 1;
}
} else {
return v4_6;
}
}
}
} else {
v0_0.l("\u6267\u884c\u8df3\u8fc7\uff1a\u4e92\u65a5\u9501\u5df2\u88ab\u5360\u7528");
return v6_0;
}
} else {
if (v5_12 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
v0_5 = this.f;
e8.d v5_13 = this.e;
v10_5 = this.d;
v11_1 = this.c;
v12_2 = this.m;
java.util.Iterator v13 = ((String) this.k);
v13_2 = this.i;
e8.d v14_2 = this.h;
v15_2 = ((Iterable) this.g);
try {
q6.y.Y(p22);
v14_0 = v5_13;
v5_11 = v14_2;
v20 = v6_0;
v18 = 0;
v17_0 = 0;
v6_6 = p22;
} catch (Exception v0_6) {
v20 = p22;
v18 = 0;
v17_0 = 0;
}
}
}
} catch (Exception v0_9) {
v18 = 0;
v2_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v18));
kotlinx.coroutines.sync.Mutex$DefaultImpls.unlock$default(v3, 0, 1, 0);
throw v0_9;
} catch (Exception v0_9) {
}
v2_0.setValue(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v18));
kotlinx.coroutines.sync.Mutex$DefaultImpls.unlock$default(v3, v4_0, v7_3, v4_0);
return v20;
}
}
+102
View File
@@ -0,0 +1,102 @@
package e8;
public abstract class o {
public final String a;
public final qbsg.top.ble.data.BleSessionFacade b;
public final kotlinx.coroutines.flow.SharedFlow c;
public final String d;
public final kotlinx.coroutines.CoroutineScope e;
public kotlinx.coroutines.Job f;
public final kotlinx.coroutines.sync.Mutex g;
public final kotlinx.coroutines.flow.MutableStateFlow h;
public final kotlinx.coroutines.flow.StateFlow i;
public final kotlinx.coroutines.flow.MutableStateFlow j;
public final kotlinx.coroutines.flow.StateFlow k;
public final kotlinx.coroutines.flow.MutableSharedFlow l;
public final kotlinx.coroutines.flow.SharedFlow m;
public final kotlinx.coroutines.flow.StateFlow n;
public final kotlinx.coroutines.flow.MutableStateFlow o;
public final kotlinx.coroutines.flow.StateFlow p;
public o(String p7, qbsg.top.ble.data.BleSessionFacade p8, kotlinx.coroutines.flow.SharedFlow p9)
{
kotlin.jvm.internal.s.f(p7, "macAddress");
kotlin.jvm.internal.s.f(p8, "session");
this.a = p7;
this.b = p8;
this.c = p9;
this.d = w7.w.i();
kotlinx.coroutines.CoroutineScope v0_2 = kotlinx.coroutines.CoroutineScopeKt.CoroutineScope(kotlinx.coroutines.SupervisorKt.SupervisorJob$default(0, 1, 0).plus(w7.b.a));
this.e = v0_2;
this.g = kotlinx.coroutines.sync.MutexKt.Mutex$default(0, 1, 0);
int v8_4 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(Boolean.FALSE);
this.h = v8_4;
this.i = kotlinx.coroutines.flow.FlowKt.asStateFlow(v8_4);
int v8_7 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(Integer.valueOf(0));
this.j = v8_7;
this.k = kotlinx.coroutines.flow.FlowKt.asStateFlow(v8_7);
int v8_10 = kotlinx.coroutines.flow.SharedFlowKt.MutableSharedFlow$default(0, 64, 0, 5, 0);
this.l = v8_10;
this.m = kotlinx.coroutines.flow.FlowKt.asSharedFlow(v8_10);
this.n = v8_10.getSubscriptionCount();
int v8_12 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
this.o = v8_12;
this.p = kotlinx.coroutines.flow.FlowKt.asStateFlow(v8_12);
kotlinx.coroutines.BuildersKt.launch$default(v0_2, 0, 0, new e8.i(this, 0, 0), 3, 0);
kotlinx.coroutines.BuildersKt.launch$default(v0_2, 0, 0, new e8.i(this, 0, 1), 3, 0);
return;
}
public static String k(int p1, long p2)
{
c7.a.l(16);
String v2_1 = Long.toString(p2, 16);
kotlin.jvm.internal.s.e(v2_1, "toString(...)");
return i7.i.B0((p1 * 2), v2_1);
}
public static String m()
{
String v0_0 = System.currentTimeMillis();
long v6_0 = ((((long) java.util.TimeZone.getDefault().getOffset(v0_0)) / 1000) + (v0_0 / 1000));
String v0_1 = a.b.s(v0_0);
String v1_1 = v0_1[0];
long v3_0 = v0_1[1];
int v5 = v0_1[2];
String v0_2 = v0_1[3];
StringBuilder v8_2 = new StringBuilder();
v8_2.append(e8.o.k(4, v6_0));
v8_2.append(e8.o.k(2, ((long) v1_1)));
v8_2.append(e8.o.k(1, ((long) v3_0)));
v8_2.append(e8.o.k(1, ((long) v5)));
v8_2.append(e8.o.k(1, ((long) v0_2)));
return p.p1.j("dd", v8_2.toString());
}
public final void h()
{
Integer v0_0 = this.f;
if (v0_0 != null) {
kotlinx.coroutines.Job$DefaultImpls.cancel$default(v0_0, 0, 1, 0);
}
this.h.setValue(Boolean.FALSE);
this.j.setValue(Integer.valueOf(0));
return;
}
public final void i(java.util.List p7, a7.a p8)
{
this.f = kotlinx.coroutines.BuildersKt.launch$default(this.e, 0, 0, new e8.j(this, p7, p8, 0), 3, 0);
return;
}
public abstract String j();
public final void l(String p2)
{
kotlin.jvm.internal.s.f(p2, "data");
this.l.tryEmit(new e8.b(p2));
return;
}
public abstract void n(Object p0, g8.d p1, a7.a p2);
}
+173
View File
@@ -0,0 +1,173 @@
package f8;
public final class a {
public a(android.content.Context p2)
{
kotlin.jvm.internal.s.f(p2, "context");
return;
}
public final android.graphics.Bitmap a(String p16, int p17, int p18, float p19)
{
int v2_0;
kotlin.jvm.internal.s.f(p16, "text");
if (p16.length() != 0) {
v2_0 = p16.length();
} else {
v2_0 = 1;
}
int v2_1 = (v2_0 * p17);
android.graphics.Bitmap v4_1 = android.graphics.Bitmap.createBitmap(v2_1, p17, android.graphics.Bitmap$Config.ARGB_8888);
int v5_1 = new android.graphics.Canvas(v4_1);
int v6_1 = new android.graphics.Paint();
v6_1.setTypeface(android.graphics.Typeface.DEFAULT_BOLD);
v6_1.setTextSize((((float) p17) * p19));
v6_1.setFakeBoldText(1);
v6_1.setTextAlign(android.graphics.Paint$Align.CENTER);
v6_1.setAntiAlias(1);
v5_1.drawColor(-1);
v6_1.setColor(-16777216);
int v9_0 = v6_1.getFontMetrics();
int v7_2 = (((float) p17) / 1073741824);
int v9_2 = (v7_2 - ((v9_0.ascent + v9_0.descent) / 1073741824));
int v10_1 = p16.length();
int v12 = 0;
while (v12 < v10_1) {
v5_1.drawText(String.valueOf(p16.charAt(v12)), (((float) (v12 * p17)) + v7_2), v9_2, v6_1);
v12++;
}
android.graphics.Bitmap v0_2 = android.graphics.Bitmap.createBitmap(v2_1, p17, android.graphics.Bitmap$Config.ARGB_8888);
int v5_2 = 0;
while (v5_2 < p17) {
int v6_2 = 0;
while (v6_2 < v2_1) {
int v7_3 = v4_1.getPixel(v6_2, v5_2);
if (((android.graphics.Color.blue(v7_3) + (android.graphics.Color.green(v7_3) + android.graphics.Color.red(v7_3))) / 3) >= p18) {
v0_2.setPixel(v6_2, v5_2, -1);
} else {
v0_2.setPixel(v6_2, v5_2, -16777216);
}
v6_2++;
}
v5_2++;
}
v4_1.recycle();
return v0_2;
}
public final String b(int p1, int p2, int p3, int p4)
{
String v1_1;
String vtmp6 = String.format("%04d%02d%02d", java.util.Arrays.copyOf(new Object[] {Integer.valueOf(p2), Integer.valueOf(p3), Integer.valueOf(p4)}), 3));
if (p1 != 24) {
v1_1 = "ff00";
} else {
v1_1 = "ffff";
}
return v1_1.concat(vtmp6);
}
public final java.util.List c(String p17, int p18, int p19, float p20)
{
kotlin.jvm.internal.s.f(p17, "text");
int v1_6 = this.a(p17, p18, p19, p20);
String v3_13 = v1_6.getWidth();
String v4_12 = v1_6.getHeight();
java.util.ArrayList v5_1 = new java.util.ArrayList();
int v6 = 0;
int v7_0 = 0;
while (v7_0 < v4_12) {
String v10_0 = (v3_13 / 8);
String v11_6 = 0;
while (v11_6 < v10_0) {
int v12_1 = 0;
int v13 = 0;
while (v12_1 < 8) {
int v14_1 = ((v11_6 * 8) + v12_1);
if ((v14_1 < v3_13) && (v1_6.getPixel(v14_1, v7_0) != -16777216)) {
v13 |= (1 << (7 - v12_1));
}
v12_1++;
}
v5_1.add(Integer.valueOf(v13));
v11_6++;
}
v7_0++;
}
int v1_1 = p17.length();
java.util.ArrayList v2_2 = new java.util.ArrayList();
if (p18 == 16) {
if (v1_1 <= 8) {
if (v1_1 <= 4) {
String v3_6 = new StringBuilder(a1.a.j(v1_1, "0"));
String v0_6 = (v5_1.size() - 1);
while (v6 < v0_6) {
v3_6.append(String.format("%02x", java.util.Arrays.copyOf(new Object[] {v5_1.get(v6)}), 1)));
v6++;
}
String v0_7 = v3_6.toString();
kotlin.jvm.internal.s.e(v0_7, "toString(...)");
v2_2.add(v0_7);
return v2_2;
} else {
String v3_9 = ((v5_1.size() - ((v1_1 - 4) * 32)) - 1);
String v4_7 = new StringBuilder("04");
while (v6 < v3_9) {
v4_7.append(String.format("%02x", java.util.Arrays.copyOf(new Object[] {v5_1.get(v6)}), 1)));
v6++;
}
String v3_10 = v4_7.toString();
kotlin.jvm.internal.s.e(v3_10, "toString(...)");
v2_2.add(v3_10);
String v3_12 = new StringBuilder(a1.a.j(v1_1, "0"));
String v0_10 = (v5_1.size() - 1);
int v1_7 = 128;
while (v1_7 < v0_10) {
v3_12.append(String.format("%02x", java.util.Arrays.copyOf(new Object[] {v5_1.get(v1_7)}), 1)));
v1_7++;
}
String v0_11 = v3_12.toString();
kotlin.jvm.internal.s.e(v0_11, "toString(...)");
v2_2.add(v0_11);
return v2_2;
}
}
} else {
if (p18 == 24) {
if (v1_1 <= 4) {
String v0_1 = 0;
while (v0_1 < v1_1) {
String v3_2 = new StringBuilder(a1.a.j(v0_1, "990"));
String v4_2 = (v0_1 * 72);
int v8_0 = 0;
while (v8_0 < 72) {
String v11_1 = (v4_2 + v8_0);
if (v11_1 < v5_1.size()) {
v3_2.append(String.format("%02x", java.util.Arrays.copyOf(new Object[] {v5_1.get(v11_1)}), 1)));
}
v8_0++;
}
String v3_3 = v3_2.toString();
kotlin.jvm.internal.s.e(v3_3, "toString(...)");
v2_2.add(v3_3);
v0_1++;
}
} else {
return q6.t.c;
}
}
return v2_2;
}
return q6.t.c;
}
public final b2.h d(String p2, int p3, int p4, float p5)
{
kotlin.jvm.internal.s.f(p2, "text");
if (!i7.i.x0(p2)) {
return new b2.h(this.a(p2, p3, p4, p5));
} else {
return 0;
}
}
}
+31
View File
@@ -0,0 +1,31 @@
package g8;
public final enum class a extends java.lang.Enum {
public static final enum g8.a c;
public static final enum g8.a d;
public static final synthetic g8.a[] e;
public static final synthetic u6.b f;
static a()
{
u6.b v0_2 = new g8.a("NONE", 0);
g8.a.c = v0_2;
new g8.a("FLOYD_STEINBERG", 1);
g8.a.d = new g8.a("ATKINSON", 2);
new g8.a("BAYER", 3);
new g8.a("STUCKI", 4);
u6.b v0_1 = new g8.a[] {v0_2, new g8.a("JARVIS", 5)});
g8.a.e = v0_1;
g8.a.f = u3.a.a(v0_1);
return;
}
public static g8.a valueOf(String p1)
{
return ((g8.a) Enum.valueOf(g8.a, p1));
}
public static g8.a[] values()
{
return ((g8.a[]) g8.a.e.clone());
}
}
+62
View File
@@ -0,0 +1,62 @@
package g8;
public final class c {
public final g8.b a;
public final int b;
public final int c;
public final boolean d;
public final boolean e;
public final boolean f;
public c(g8.b p4, int p5, int p6, boolean p7, int p8)
{
int v0_1;
int v1 = 1;
if ((p8 & 16) == 0) {
v0_1 = 1;
} else {
v0_1 = 0;
}
if ((p8 & 32) != 0) {
v1 = 0;
}
this.a = p4;
this.b = p5;
this.c = p6;
this.d = p7;
this.e = v0_1;
this.f = v1;
return;
}
public final boolean equals(Object p3)
{
if ((this == p3) || (((p3 instanceof g8.c)) && ((this.a == ((g8.c) p3).a) && ((this.b == ((g8.c) p3).b) && ((this.c == ((g8.c) p3).c) && ((this.d == ((g8.c) p3).d) && ((this.e == ((g8.c) p3).e) && (this.f == ((g8.c) p3).f)))))))) {
return 1;
} else {
return 0;
}
}
public final int hashCode()
{
return (Boolean.hashCode(this.f) + a1.a.e(a1.a.e(a1.a.c(this.c, a1.a.c(this.b, (this.a.hashCode() * 31), 31), 31), 31, this.d), 31, this.e));
}
public final String toString()
{
String v0_1 = new StringBuilder("FirmwareImageUploadPreset(screenSize=");
v0_1.append(this.a);
v0_1.append(", uploadWidthPx=");
v0_1.append(this.b);
v0_1.append(", uploadHeightPx=");
v0_1.append(this.c);
v0_1.append(", useRotatedScan=");
v0_1.append(this.d);
v0_1.append(", singleChannel=");
v0_1.append(this.e);
v0_1.append(", isCalendar=");
v0_1.append(this.f);
v0_1.append(")");
return v0_1.toString();
}
}
+252
View File
@@ -0,0 +1,252 @@
package g8;
public final class d {
public final b2.h a;
public final g8.c b;
public final g8.g c;
public final boolean d;
public final g8.a e;
public final float f;
public final float g;
public final float h;
public final float i;
public final int j;
public final int k;
public synthetic d()
{
this(0, 0, g8.g.c, 0, g8.a.d, 0, 1120403456, 1120403456, 1120403456, 128, 0);
return;
}
public d(b2.h p1, g8.c p2, g8.g p3, boolean p4, g8.a p5, float p6, float p7, float p8, float p9, int p10, int p11)
{
this.a = p1;
this.b = p2;
this.c = p3;
this.d = p4;
this.e = p5;
this.f = p6;
this.g = p7;
this.h = p8;
this.i = p9;
this.j = p10;
this.k = p11;
return;
}
public static g8.d a(g8.d p12, b2.h p13, g8.c p14, g8.g p15, boolean p16, g8.a p17, float p18, float p19, float p20, float p21, int p22, int p23, int p24)
{
if ((p24 & 1) != 0) {
p13 = p12.a;
}
if ((p24 & 2) != 0) {
p14 = p12.b;
}
if ((p24 & 4) != 0) {
p15 = p12.c;
}
boolean v4;
if ((p24 & 8) == 0) {
v4 = p16;
} else {
v4 = p12.d;
}
g8.a v5;
if ((p24 & 16) == 0) {
v5 = p17;
} else {
v5 = p12.e;
}
float v6;
if ((p24 & 32) == 0) {
v6 = p18;
} else {
v6 = p12.f;
}
float v7;
if ((p24 & 64) == 0) {
v7 = p19;
} else {
v7 = p12.g;
}
float v8;
if ((p24 & 128) == 0) {
v8 = p20;
} else {
v8 = p12.h;
}
float v9;
if ((p24 & 256) == 0) {
v9 = p21;
} else {
v9 = p12.i;
}
int v10;
if ((p24 & 512) == 0) {
v10 = p22;
} else {
v10 = p12.j;
}
int v11;
if ((p24 & 1024) == 0) {
v11 = p23;
} else {
v11 = p12.k;
}
p12.getClass();
kotlin.jvm.internal.s.f(p15, "scaleMode");
kotlin.jvm.internal.s.f(v5, "ditherAlgorithm");
return new g8.d(p13, p14, p15, v4, v5, v6, v7, v8, v9, v10, v11);
}
public final int b()
{
int v0_0 = this.b;
if (v0_0 == 0) {
return 300;
} else {
return v0_0.c;
}
}
public final boolean c()
{
if (this.b == null) {
return 0;
} else {
return 1;
}
}
public final int d()
{
int v0_0 = this.b;
if (v0_0 == 0) {
return 400;
} else {
return v0_0.b;
}
}
public final int e()
{
int v0_0 = this.b;
if (v0_0 == 0) {
return 300;
} else {
return v0_0.a.e;
}
}
public final boolean equals(Object p5)
{
if (this != p5) {
if ((p5 instanceof g8.d)) {
if (kotlin.jvm.internal.s.b(this.a, ((g8.d) p5).a)) {
if (kotlin.jvm.internal.s.b(this.b, ((g8.d) p5).b)) {
if (this.c == ((g8.d) p5).c) {
if (this.d == ((g8.d) p5).d) {
if (this.e == ((g8.d) p5).e) {
if (Float.compare(this.f, ((g8.d) p5).f) == 0) {
if (Float.compare(this.g, ((g8.d) p5).g) == 0) {
if (Float.compare(this.h, ((g8.d) p5).h) == 0) {
if (Float.compare(this.i, ((g8.d) p5).i) == 0) {
if (this.j == ((g8.d) p5).j) {
if (this.k == ((g8.d) p5).k) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 1;
}
}
public final int f()
{
int v0_0 = this.b;
if (v0_0 == 0) {
return 400;
} else {
return v0_0.a.d;
}
}
public final int hashCode()
{
int v1_12;
int v0_0 = 0;
int v1_0 = this.a;
if (v1_0 != 0) {
v1_12 = v1_0.hashCode();
} else {
v1_12 = 0;
}
int v2 = 31;
int v1_16 = (v1_12 * 31);
g8.c v3 = this.b;
if (v3 != null) {
v0_0 = v3.hashCode();
}
return (Integer.hashCode(this.k) + a1.a.c(this.j, a1.a.b(this.i, a1.a.b(this.h, a1.a.b(this.g, a1.a.b(this.f, ((this.e.hashCode() + a1.a.e(((this.c.hashCode() + ((v1_16 + v0_0) * 31)) * v2), v2, this.d)) * v2), v2), 31), 31), 31), 31));
}
public final String toString()
{
String v0_1 = new StringBuilder("ImageConfig(sourceBitmap=");
v0_1.append(this.a);
v0_1.append(", selectedPreset=");
v0_1.append(this.b);
v0_1.append(", scaleMode=");
v0_1.append(this.c);
v0_1.append(", isThreeColor=");
v0_1.append(this.d);
v0_1.append(", ditherAlgorithm=");
v0_1.append(this.e);
v0_1.append(", brightness=");
v0_1.append(this.f);
v0_1.append(", contrast=");
v0_1.append(this.g);
v0_1.append(", saturation=");
v0_1.append(this.h);
v0_1.append(", diffusion=");
v0_1.append(this.i);
v0_1.append(", threshold=");
v0_1.append(this.j);
v0_1.append(", rotationDegrees=");
return p.p1.l(v0_1, this.k, ")");
}
}
+602
View File
@@ -0,0 +1,602 @@
package g8;
public abstract class f {
public static final int[][] a;
static f()
{
g8.f.a = new int[][] {new int[] {15, 135, 45, 165}), new int[] {195, 75, 225, 105}), new int[] {60, 180, 30, 150}), new int[] {240, 120, 210, 90})});
return;
}
public static void a(g8.e p2, int p3, float p4, float p5, float p6, float p7)
{
if (p3 >= 0) {
int v0_0 = p2.a;
if (p3 < v0_0.length) {
v0_0[p3] = g8.f.b((c7.a.S((p4 * p7)) + v0_0[p3]));
int v4_2 = p2.b;
v4_2[p3] = g8.f.b((c7.a.S((p5 * p7)) + v4_2[p3]));
int[] v2_1 = p2.c;
v2_1[p3] = g8.f.b((c7.a.S((p6 * p7)) + v2_1[p3]));
}
}
return;
}
public static int b(int p2)
{
return a.a.o(p2, 0, 255);
}
public static final int[] c(Object p9)
{
kotlin.jvm.internal.s.f(p9, "bitmap");
android.graphics.Bitmap v1_1 = ((android.graphics.Bitmap) p9);
int[] v2 = new int[(((android.graphics.Bitmap) p9).getHeight() * ((android.graphics.Bitmap) p9).getWidth())];
v1_1.getPixels(v2, 0, ((android.graphics.Bitmap) p9).getWidth(), 0, 0, v1_1.getWidth(), v1_1.getHeight());
return v2;
}
public static float d(int p1, int p2, int p3)
{
return ((((float) p3) * 1038710997) + ((((float) p2) * 1058424226) + (((float) p1) * 1050220167)));
}
public static boolean e(int p2, int p3, int p4, int p5)
{
if ((((float) p2) <= (((float) p3) * 1069547520)) || ((((float) p2) <= (((float) p4) * 1069547520)) || (p2 <= p5))) {
return 0;
} else {
return 1;
}
}
public static final b2.h f(g8.d p31)
{
int v0_19;
int v16;
kotlin.jvm.internal.s.f(p31, "config");
int v1_10 = p31.k;
int v2_18 = p31.a;
if (v2_18 == 0) {
v16 = 0;
v0_19 = 0;
} else {
float v4_30 = b2.h0.l(v2_18);
if (v4_30 != 0) {
int v11_0 = 1;
int v2_3 = a.a.o(p31.f(), 1, p31.d());
float v12_2 = a.a.o(p31.e(), 1, p31.b());
int[] v9_12 = new android.graphics.Matrix();
v9_12.postRotate(((float) v1_10));
if (v1_10 != 0) {
v4_30 = android.graphics.Bitmap.createBitmap(v4_30, 0, 0, v4_30.getWidth(), v4_30.getHeight(), v9_12, 1);
}
int v1_6;
kotlin.jvm.internal.s.c(v4_30);
int v1_16 = p31.c.ordinal();
int v6_11 = 0;
int v7_9 = 2;
if (v1_16 == 0) {
v1_6 = android.graphics.Bitmap.createBitmap(v2_3, v12_2, android.graphics.Bitmap$Config.ARGB_8888);
int v8_13 = new android.graphics.Canvas(v1_6);
v8_13.drawColor(-1);
int v2_22 = ((float) v2_3);
int[] v10_3 = ((float) v12_2);
int[] v9_18 = Math.min((v2_22 / ((float) v4_30.getWidth())), (v10_3 / ((float) v4_30.getHeight())));
int v2_25 = a1.a.a(((float) v4_30.getWidth()), v9_18, v2_22, 1073741824);
int v5_15 = a1.a.a(((float) v4_30.getHeight()), v9_18, v10_3, 1073741824);
v8_13.drawBitmap(v4_30, 0, new android.graphics.RectF(v2_25, v5_15, ((((float) v4_30.getWidth()) * v9_18) + v2_25), ((((float) v4_30.getHeight()) * v9_18) + v5_15)), new android.graphics.Paint(2));
} else {
if (v1_16 == 1) {
v1_6 = android.graphics.Bitmap.createScaledBitmap(v4_30, v2_3, v12_2, 1);
} else {
if (v1_16 != 2) {
throw new b3.e();
} else {
int v1_2 = Math.max((((float) v2_3) / ((float) v4_30.getWidth())), (((float) v12_2) / ((float) v4_30.getHeight())));
int v8_5 = c7.a.S((((float) v4_30.getWidth()) * v1_2));
if (v8_5 < v2_3) {
v8_5 = v2_3;
}
int v1_3 = c7.a.S((((float) v4_30.getHeight()) * v1_2));
if (v1_3 < v12_2) {
v1_3 = v12_2;
}
int v8_6 = (v8_5 - v2_3);
int v1_4 = (v1_3 - v12_2);
v1_6 = android.graphics.Bitmap.createBitmap(android.graphics.Bitmap.createScaledBitmap(v4_30, v8_5, v1_3, 1), a.a.o(c7.a.S((((float) v8_6) / 1073741824)), 0, v8_6), a.a.o(c7.a.S((((float) v1_4) / 1073741824)), 0, v1_4), v2_3, v12_2);
kotlin.jvm.internal.s.e(v1_6, "createBitmap(...)");
}
}
}
int v2_2 = p31.f;
float v4_1 = p31.g;
int v5_2 = p31.h;
kotlin.jvm.internal.s.f(v1_6, "src");
int v1_7 = g8.f.h(v1_6);
int v8_9 = v1_7.c;
int[] v9_10 = v1_7.b;
int[] v10_0 = v1_7.a;
int v14_0 = 255;
float v15_0 = 1120403456;
if (v2_2 != 0) {
int v2_4 = c7.a.S(((((float) 255) * v2_2) / 1120403456));
int v13_4 = v10_0.length;
v16 = 0;
int v3_0 = 0;
while (v3_0 < v13_4) {
v10_0[v3_0] = g8.f.b((v10_0[v3_0] + v2_4));
v9_10[v3_0] = g8.f.b((v9_10[v3_0] + v2_4));
v8_9[v3_0] = g8.f.b((v8_9[v3_0] + v2_4));
v3_0++;
}
} else {
v16 = 0;
}
int v19_0;
float v17_9;
int v13_5 = 1065353216;
if (v4_1 != 1120403456) {
float v4_4 = (((v4_1 - 1120403456) + 1120403456) / 1120403456);
int v2_8 = c7.a.S(((1065353216 - v4_4) * 1124073472));
v17_9 = 1124073472;
int v3_2 = v10_0.length;
float v12_1 = 0;
while(true) {
v19_0 = v13_5;
if (v12_1 >= v3_2) {
break;
}
int v20_0 = v15_0;
float v15_1 = ((float) v2_8);
v10_0[v12_1] = g8.f.b(c7.a.S(((((float) v10_0[v12_1]) * v4_4) + v15_1)));
v9_10[v12_1] = g8.f.b(c7.a.S(((((float) v9_10[v12_1]) * v4_4) + v15_1)));
v8_9[v12_1] = g8.f.b(c7.a.S(((((float) v8_9[v12_1]) * v4_4) + v15_1)));
v12_1++;
v13_5 = v19_0;
v15_0 = v20_0;
}
} else {
v17_9 = 1124073472;
v19_0 = 1065353216;
}
int v20_1 = v15_0;
if (v5_2 != v20_1) {
int v5_4 = (v5_2 / v20_1);
int v2_10 = v10_0.length;
int v3_3 = 0;
while (v3_3 < v2_10) {
float v4_6 = ((float) v10_0[v3_3]);
float v12_8 = ((((float) v8_9[v3_3]) * 1038710997) + ((((float) v9_10[v3_3]) * 1058424226) + (1050220167 * v4_6)));
v10_0[v3_3] = a.a.o(c7.a.S((((v4_6 - v12_8) * v5_4) + v12_8)), 0, 255);
v9_10[v3_3] = a.a.o(c7.a.S((((((float) v9_10[v3_3]) - v12_8) * v5_4) + v12_8)), 0, 255);
v8_9[v3_3] = a.a.o(c7.a.S((((((float) v8_9[v3_3]) - v12_8) * v5_4) + v12_8)), 0, 255);
v3_3++;
}
}
int v21_0;
int v1_8 = g8.f.g(v1_7);
int v2_11 = p31.e;
int v3_4 = p31.d;
float v4_26 = p31.i;
int v0_1 = p31.j;
kotlin.jvm.internal.s.f(v2_11, "algo");
int v1_9 = g8.f.h(v1_8);
int v5_7 = v1_9.e;
int v8_10 = v1_9.d;
int[] v9_13 = v1_9.a;
int[] v10_1 = v1_9.b;
float v12_9 = v1_9.c;
float v4_27 = (v4_26 / v20_1);
int v2_12 = v2_11.ordinal();
if (v2_12 == 0) {
v21_0 = v1_9;
int v1_11 = v9_13.length;
int v14_1 = 0;
while (v14_1 < v1_11) {
int v2_13 = v9_13[v14_1];
float v4_28 = v10_1[v14_1];
int v5_8 = v12_9[v14_1];
if ((v3_4 == 0) || (!g8.f.e(v2_13, v4_28, v5_8, v0_1))) {
int v13_28;
if (g8.f.d(v2_13, v4_28, v5_8) >= ((float) v0_1)) {
v13_28 = 255;
} else {
v13_28 = 0;
}
v9_13[v14_1] = v13_28;
v10_1[v14_1] = v13_28;
v12_9[v14_1] = v13_28;
} else {
v9_13[v14_1] = 255;
v10_1[v14_1] = 0;
v12_9[v14_1] = 0;
}
v14_1++;
}
} else {
if (v2_12 == 1) {
v21_0 = v1_9;
int v14_2 = 0;
while (v14_2 < v5_7) {
int v1_12 = 0;
while (v1_12 < v8_10) {
int v2_17 = ((v14_2 * v8_10) + v1_12);
int v6_3 = v9_13[v2_17];
int v7_1 = v10_1[v2_17];
int v11_1 = v12_9[v2_17];
if ((v3_4 == 0) || (!g8.f.e(v6_3, v7_1, v11_1, v0_1))) {
int v13_32;
if (g8.f.d(v6_3, v7_1, v11_1) >= ((float) v0_1)) {
v13_32 = 255;
} else {
v13_32 = 0;
}
v9_13[v2_17] = v13_32;
v10_1[v2_17] = v13_32;
v12_9[v2_17] = v13_32;
float v23_0 = (((float) (v6_3 - v13_32)) * v4_27);
float v24_0 = (((float) (v7_1 - v13_32)) * v4_27);
float v25_0 = (((float) (v11_1 - v13_32)) * v4_27);
int v6_8 = (v1_12 + 1);
if (v6_8 < v8_10) {
g8.f.a(v21_0, (v2_17 + 1), v23_0, v24_0, v25_0, 1054867456);
}
if ((v14_2 + 1) < v5_7) {
if ((v1_12 - 1) >= 0) {
g8.f.a(v21_0, ((v2_17 + v8_10) - 1), v23_0, v24_0, v25_0, 1044381696);
}
int v22_2 = (v2_17 + v8_10);
g8.f.a(v21_0, v22_2, v23_0, v24_0, v25_0, 1050673152);
if (v6_8 < v8_10) {
g8.f.a(v21_0, (v22_2 + 1), v23_0, v24_0, v25_0, 1031798784);
}
}
} else {
v9_13[v2_17] = 255;
v10_1[v2_17] = 0;
v12_9[v2_17] = 0;
}
v1_12++;
}
v14_2++;
}
} else {
if (v2_12 == 2) {
v21_0 = v1_9;
float v4_33 = (((v4_27 * ((float) 100)) / v20_1) * 1040187392);
int v0_2 = (v0_1 - 128);
int v1_18 = 0;
while (v1_18 < v5_7) {
int v2_19 = 0;
while (v2_19 < v8_10) {
int v0_11;
int v13_37;
int v14_7;
float v17_12;
int v6_10 = ((v1_18 * v8_10) + v2_19);
int v7_8 = a.a.o((v9_13[v6_10] + v0_2), 0, 255);
int v11_5 = a.a.o((v10_1[v6_10] + v0_2), 0, 255);
float v15_7 = a.a.o((v12_9[v6_10] + v0_2), 0, 255);
int v14_4 = (v11_5 * v11_5);
float v17_11 = (v15_7 * v15_7);
int v13_36 = (((v7_8 * v7_8) + v14_4) + v17_11);
int v31_1 = v0_2;
int v19_1 = ((v7_8 + -255) * (v7_8 + -255));
int v0_10 = (((v15_7 + -255) * (v15_7 + -255)) + (((v11_5 + -255) * (v11_5 + -255)) + v19_1));
if (v3_4 == 0) {
if (v13_36 > v0_10) {
v17_12 = v1_18;
v0_11 = 1132396544;
v13_37 = 1132396544;
v14_7 = 1132396544;
} else {
v17_12 = v1_18;
v0_11 = 0;
v13_37 = 0;
v14_7 = 0;
}
} else {
int v14_6 = ((v19_1 + v14_4) + v17_11);
if ((v13_36 > v0_10) || (v13_36 > v14_6)) {
if ((v0_10 > v13_36) || (v0_10 > v14_6)) {
v17_12 = v1_18;
v0_11 = 1132396544;
}
}
}
v9_13[v6_10] = ((int) v0_11);
v10_1[v6_10] = ((int) v13_37);
v12_9[v6_10] = ((int) v14_7);
float v23_1 = ((((float) v7_8) - v0_11) * v4_33);
float v24_1 = ((((float) v11_5) - v13_37) * v4_33);
float v25_1 = ((((float) v15_7) - v14_7) * v4_33);
int v0_16 = (v2_19 + 1);
if (v0_16 < v8_10) {
g8.f.a(v21_0, (v6_10 + 1), v23_1, v24_1, v25_1, 1065353216);
}
if ((v2_19 + 2) < v8_10) {
g8.f.a(v21_0, (v6_10 + 2), v23_1, v24_1, v25_1, 1065353216);
}
if ((v17_12 + 1) < v5_7) {
if ((v2_19 - 1) >= 0) {
g8.f.a(v21_0, ((v6_10 + v8_10) - 1), v23_1, v24_1, v25_1, 1065353216);
}
int v22_7 = (v6_10 + v8_10);
g8.f.a(v21_0, v22_7, v23_1, v24_1, v25_1, 1065353216);
if (v0_16 < v8_10) {
g8.f.a(v21_0, (v22_7 + 1), v23_1, v24_1, v25_1, 1065353216);
}
}
if ((v17_12 + 2) < v5_7) {
g8.f.a(v21_0, ((v8_10 * 2) + v6_10), v23_1, v24_1, v25_1, 1065353216);
}
v2_19 = v0_16;
v1_18 = v17_12;
v0_2 = v31_1;
}
v1_18++;
}
} else {
if (v2_12 == 3) {
v21_0 = v1_9;
float v29_3 = 0;
int v30_3 = 255;
int v1_30 = v9_13.length;
int v2_21 = 0;
while (v2_21 < v1_30) {
int v5_11 = v9_13[v2_21];
int v6_12 = v10_1[v2_21];
int v7_10 = v12_9[v2_21];
int v14_9 = v29_3;
int v13_42 = v30_3;
int v11_17 = a.a.o(c7.a.S((((((((float) g8.f.a[((v2_21 % v8_10) % 4)][((v2_21 / v8_10) % 4)]) - v17_9) / v17_9) * v4_27) + v19_0) * ((float) v0_1))), v14_9, v13_42);
if ((v3_4 == 0) || (!g8.f.e(v5_11, v6_12, v7_10, v11_17))) {
int v5_14;
if (g8.f.d(v5_11, v6_12, v7_10) >= ((float) v11_17)) {
v5_14 = 255;
} else {
v5_14 = 0;
}
v9_13[v2_21] = v5_14;
v10_1[v2_21] = v5_14;
v12_9[v2_21] = v5_14;
} else {
v9_13[v2_21] = v13_42;
v10_1[v2_21] = v14_9;
v12_9[v2_21] = v14_9;
}
v2_21++;
v29_3 = 0;
v30_3 = 255;
}
} else {
if (v2_12 == 4) {
v21_0 = v1_9;
int v28 = 1;
int v1_31 = 0;
while (v1_31 < v5_7) {
int v2_23 = 0;
while (v2_23 < v8_10) {
int v6_15 = ((v1_31 * v8_10) + v2_23);
int v7_11 = v9_13[v6_15];
int v11_18 = v10_1[v6_15];
int v13_43 = v12_9[v6_15];
if ((v3_4 == 0) || (!g8.f.e(v7_11, v11_18, v13_43, v0_1))) {
int v14_13;
if (g8.f.d(v7_11, v11_18, v13_43) >= ((float) v0_1)) {
v14_13 = 255;
} else {
v14_13 = 0;
}
v9_13[v6_15] = v14_13;
v10_1[v6_15] = v14_13;
v12_9[v6_15] = v14_13;
float v23_2 = (((float) (v7_11 - v14_13)) * v4_27);
float v24_2 = (((float) (v11_18 - v14_13)) * v4_27);
float v25_2 = (((float) (v13_43 - v14_13)) * v4_27);
int v7_16 = (v2_23 + 1);
if (v7_16 < v8_10) {
g8.f.a(v21_0, (v6_15 + 1), v23_2, v24_2, v25_2, 1044581425);
}
int v11_20 = (v2_23 + 2);
if (v11_20 < v8_10) {
g8.f.a(v21_0, (v6_15 + 2), v23_2, v24_2, v25_2, 1036192817);
}
if ((v1_31 + 1) < v5_7) {
if ((v2_23 - 2) >= 0) {
g8.f.a(v21_0, ((v6_15 + v8_10) - 2), v23_2, v24_2, v25_2, 1027804209);
}
if ((v2_23 - 1) >= 0) {
g8.f.a(v21_0, ((v6_15 + v8_10) - 1), v23_2, v24_2, v25_2, 1036192817);
}
int v22_14 = (v6_15 + v8_10);
g8.f.a(v21_0, v22_14, v23_2, v24_2, v25_2, 1044581425);
int v13_50 = v22_14;
if (v7_16 < v8_10) {
g8.f.a(v21_0, (v13_50 + 1), v23_2, v24_2, v25_2, 1036192817);
}
if (v11_20 < v8_10) {
g8.f.a(v21_0, (v13_50 + 2), v23_2, v24_2, v25_2, 1027804209);
}
}
if ((v1_31 + 2) < v5_7) {
if ((v2_23 - 2) >= 0) {
g8.f.a(v21_0, (((v8_10 * 2) + v6_15) - 2), v23_2, v24_2, v25_2, 1019415601);
}
if ((v2_23 - 1) >= 0) {
g8.f.a(v21_0, (((v8_10 * 2) + v6_15) - 1), v23_2, v24_2, v25_2, 1027804209);
}
int v22_19 = ((v8_10 * 2) + v6_15);
g8.f.a(v21_0, v22_19, v23_2, v24_2, v25_2, 1036192817);
int v13_59 = v22_19;
if (v7_16 < v8_10) {
g8.f.a(v21_0, (v13_59 + 1), v23_2, v24_2, v25_2, 1027804209);
}
if (v11_20 < v8_10) {
g8.f.a(v21_0, (v13_59 + 2), v23_2, v24_2, v25_2, 1019415601);
}
}
} else {
v9_13[v6_15] = 255;
v10_1[v6_15] = 0;
v12_9[v6_15] = 0;
}
v2_23++;
}
v1_31++;
}
} else {
if (v2_12 != 5) {
throw new b3.e();
} else {
int v2_24 = 0;
while (v2_24 < v5_7) {
int v13_61 = v6_11;
while (v13_61 < v8_10) {
int v30_5;
int v21_1;
float v15_11 = ((v2_24 * v8_10) + v13_61);
int v27 = v7_9;
int v7_17 = v9_13[v15_11];
v28 = v11_0;
int v11_21 = v10_1[v15_11];
float v29_5 = v6_11;
int v6_16 = v12_9[v15_11];
if ((v3_4 == 0) || (!g8.f.e(v7_17, v11_21, v6_16, v0_1))) {
int v14_16;
v30_5 = v14_0;
if (g8.f.d(v7_17, v11_21, v6_16) >= ((float) v0_1)) {
v14_16 = v30_5;
} else {
v14_16 = v29_5;
}
v9_13[v15_11] = v14_16;
v10_1[v15_11] = v14_16;
v12_9[v15_11] = v14_16;
float v23_3 = (((float) (v7_17 - v14_16)) * v4_27);
float v24_3 = (((float) (v11_21 - v14_16)) * v4_27);
float v25_3 = (((float) (v6_16 - v14_16)) * v4_27);
int v6_19 = (v13_61 + 1);
if (v6_19 >= v8_10) {
v21_1 = v1_9;
} else {
v21_1 = v1_9;
g8.f.a(v21_1, (v15_11 + 1), v23_3, v24_3, v25_3, 1041585493);
}
int v1_32 = (v13_61 + 2);
if (v1_32 < v8_10) {
g8.f.a(v21_1, (v15_11 + 2), v23_3, v24_3, v25_3, 1037391189);
}
if ((v2_24 + 1) < v5_7) {
if ((v13_61 - 2) >= 0) {
g8.f.a(v21_1, ((v15_11 + v8_10) - 2), v23_3, v24_3, v25_3, 1031798784);
}
if ((v13_61 - 1) >= 0) {
g8.f.a(v21_1, ((v15_11 + v8_10) - 1), v23_3, v24_3, v25_3, 1037391189);
}
int v22_26 = (v15_11 + v8_10);
g8.f.a(v21_1, v22_26, v23_3, v24_3, v25_3, 1041585493);
int v7_26 = v22_26;
if (v6_19 < v8_10) {
g8.f.a(v21_1, (v7_26 + 1), v23_3, v24_3, v25_3, 1037391189);
}
if (v1_32 < v8_10) {
g8.f.a(v21_1, (v7_26 + 2), v23_3, v24_3, v25_3, 1031798784);
}
}
if ((v2_24 + 2) < v5_7) {
if ((v13_61 - 2) >= 0) {
g8.f.a(v21_1, (((v8_10 * 2) + v15_11) - 2), v23_3, v24_3, v25_3, 1017817771);
}
if ((v13_61 - 1) >= 0) {
g8.f.a(v21_1, (((v8_10 * 2) + v15_11) - 1), v23_3, v24_3, v25_3, 1031798784);
}
int v22_31 = ((v8_10 * 2) + v15_11);
g8.f.a(v21_1, v22_31, v23_3, v24_3, v25_3, 1037391189);
int v7_35 = v22_31;
if (v6_19 < v8_10) {
g8.f.a(v21_1, (v7_35 + 1), v23_3, v24_3, v25_3, 1031798784);
}
if (v1_32 < v8_10) {
g8.f.a(v21_1, (v7_35 + 2), v23_3, v24_3, v25_3, 1017817771);
}
}
} else {
v9_13[v15_11] = v14_0;
v10_1[v15_11] = v29_5;
v12_9[v15_11] = v29_5;
v21_1 = v1_9;
v30_5 = v14_0;
}
v13_61++;
v1_9 = v21_1;
v7_9 = v27;
v11_0 = v28;
v6_11 = v29_5;
v14_0 = v30_5;
}
float v29 = v6_11;
v28 = v11_0;
v2_24++;
}
v21_0 = v1_9;
}
}
}
}
}
}
v0_19 = g8.f.g(v21_0);
}
}
if (v0_19 == 0) {
return v16;
} else {
return new b2.h(v0_19);
}
}
public static android.graphics.Bitmap g(g8.e p10)
{
int v0_0 = p10.a;
int v1_0 = v0_0.length;
int[] v3 = new int[v1_0];
android.graphics.Bitmap v2_0 = 0;
while (v2_0 < v1_0) {
v3[v2_0] = ((((g8.f.b(v0_0[v2_0]) << 16) | -16777216) | (g8.f.b(p10.b[v2_0]) << 8)) | g8.f.b(p10.c[v2_0]));
v2_0++;
}
android.graphics.Bitmap v2_2 = android.graphics.Bitmap.createBitmap(p10.d, p10.e, android.graphics.Bitmap$Config.ARGB_8888);
int v5_0 = p10.d;
v2_2.setPixels(v3, 0, v5_0, 0, 0, v5_0, p10.e);
return v2_2;
}
public static g8.e h(android.graphics.Bitmap p10)
{
int v1_1 = (p10.getHeight() * p10.getWidth());
int[] v3 = new int[v1_1];
p10.getPixels(v3, 0, p10.getWidth(), 0, 0, p10.getWidth(), p10.getHeight());
int[] v5_0 = new int[v1_1];
int v10_1 = 0;
int v0_1 = 0;
while (v0_1 < v1_1) {
v5_0[v0_1] = ((v3[v0_1] >> 16) & 255);
v0_1++;
}
int[] v6_1 = new int[v1_1];
int v0_2 = 0;
while (v0_2 < v1_1) {
v6_1[v0_2] = ((v3[v0_2] >> 8) & 255);
v0_2++;
}
int[] v7_1 = new int[v1_1];
while (v10_1 < v1_1) {
v7_1[v10_1] = (v3[v10_1] & 255);
v10_1++;
}
return new g8.e(v5_0, v6_1, v7_1, p10.getWidth(), p10.getHeight());
}
}
+31
View File
@@ -0,0 +1,31 @@
package g8;
public final enum class g extends java.lang.Enum {
public static final enum g8.g c;
public static final enum g8.g d;
public static final enum g8.g e;
public static final synthetic g8.g[] f;
static g()
{
g8.g[] v0_2 = new g8.g("FIT", 0);
g8.g.c = v0_2;
g8.g v1_2 = new g8.g("STRETCH", 1);
g8.g.d = v1_2;
g8.g v2_1 = new g8.g("CENTER_CROP", 2);
g8.g.e = v2_1;
g8.g[] v0_1 = new g8.g[] {v0_2, v1_2, v2_1});
g8.g.f = v0_1;
u3.a.a(v0_1);
return;
}
public static g8.g valueOf(String p1)
{
return ((g8.g) Enum.valueOf(g8.g, p1));
}
public static g8.g[] values()
{
return ((g8.g[]) g8.g.f.clone());
}
}
+52
View File
@@ -0,0 +1,52 @@
package k8;
public final class b extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public final synthetic String c;
public b(String p1, kotlin.coroutines.Continuation p2)
{
this.c = p1;
super(2, p2);
return;
}
public final kotlin.coroutines.Continuation create(Object p2, kotlin.coroutines.Continuation p3)
{
return new k8.b(this.c, p3);
}
public final Object invoke(Object p1, Object p2)
{
return ((k8.b) this.create(((kotlinx.coroutines.CoroutineScope) p1), ((kotlin.coroutines.Continuation) p2))).invokeSuspend(p6.a0.a);
}
public final Object invokeSuspend(Object p6)
{
kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
q6.y.Y(p6);
okhttp3.Call v6_1 = k8.h.a().newCall(new okhttp3.Request$Builder().url(this.c).build());
try {
okhttp3.Response v1_1 = v6_1.execute();
} catch (byte[] v0_6) {
v6_1.cancel();
throw v0_6;
}
if (!v1_1.isSuccessful()) {
int v3 = v1_1.code();
StringBuilder v4_1 = new StringBuilder("HTTP ");
v4_1.append(v3);
throw new java.io.IOException(v4_1.toString());
} else {
byte[] v0_3;
byte[] v0_2 = v1_1.body();
if (v0_2 == null) {
v0_3 = new byte[0];
} else {
v0_3 = v0_2.bytes();
if (v0_3 == null) {
}
}
v1_1.close();
return v0_3;
}
}
}
+54
View File
@@ -0,0 +1,54 @@
package k8;
public final class f extends kotlin.coroutines.jvm.internal.SuspendLambda implements a7.e {
public final synthetic String c;
public final synthetic String d;
public f(String p1, String p2, kotlin.coroutines.Continuation p3)
{
this.c = p1;
this.d = p2;
super(2, p3);
return;
}
public final kotlin.coroutines.Continuation create(Object p3, kotlin.coroutines.Continuation p4)
{
return new k8.f(this.c, this.d, p4);
}
public final Object invoke(Object p1, Object p2)
{
return ((k8.f) this.create(((kotlinx.coroutines.CoroutineScope) p1), ((kotlin.coroutines.Continuation) p2))).invokeSuspend(p6.a0.a);
}
public final Object invokeSuspend(Object p6)
{
kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
q6.y.Y(p6);
okhttp3.Call v6_4 = k8.h.a().newCall(new okhttp3.Request$Builder().url(this.d).post(okhttp3.RequestBody.Companion.create(this.c, okhttp3.MediaType.Companion.get("application/json"))).build());
try {
okhttp3.Response v1_1 = v6_4.execute();
} catch (String v0_5) {
v6_4.cancel();
throw v0_5;
}
if (!v1_1.isSuccessful()) {
int v3_1 = v1_1.code();
StringBuilder v4_1 = new StringBuilder("HTTP ");
v4_1.append(v3_1);
throw new java.io.IOException(v4_1.toString());
} else {
String v0_3;
String v0_2 = v1_1.body();
if (v0_2 == null) {
v0_3 = "";
} else {
v0_3 = v0_2.string();
if (v0_3 == null) {
}
}
v1_1.close();
return v0_3;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
package k8;
public final class h {
public static final p6.l a;
static h()
{
k8.h.a = k3.t.H(new h0.i(5));
return;
}
public static final okhttp3.OkHttpClient a()
{
return ((okhttp3.OkHttpClient) k8.h.a.getValue());
}
public static Object b(String p9, long p10, a7.c p12, a7.e p13, a7.e p14, kotlin.coroutines.jvm.internal.ContinuationImpl p15)
{
return kotlinx.coroutines.BuildersKt.withContext(kotlinx.coroutines.Dispatchers.getIO(), new k8.a(p9, p10, p12, p14, p13, 0), p15);
}
public static Object c(String p3, String p4, kotlin.coroutines.jvm.internal.ContinuationImpl p5)
{
return kotlinx.coroutines.BuildersKt.withContext(kotlinx.coroutines.Dispatchers.getIO(), new k8.f(p4, p3, 0), p5);
}
}
@@ -0,0 +1,74 @@
package qbsg.top;
public final class MainActivity extends b.l {
public static final synthetic int w;
public MainActivity()
{
return;
}
public final void onCreate(android.os.Bundle p8)
{
super.onCreate(p8);
w2.h1 v8_1 = w7.a.h;
if (v8_1 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
w2.h1 v8_16 = v8_1.b;
qbsg.top.activation.ActivationManager v3 = qbsg.top.activation.ActivationManager.a;
v3.nativeInit(w7.w.g());
((kotlinx.coroutines.flow.MutableStateFlow) v8_16.e).setValue(v3.nativeGetDeviceId());
String v5 = "";
boolean v2_9 = ((android.content.SharedPreferences) ((a6.a) ((a0.m2) v8_16.b).d).d).getString("activation_code", "");
if (v2_9) {
v5 = v2_9;
}
boolean v2_12;
w2.h1 v8_3 = ((kotlinx.coroutines.flow.MutableStateFlow) v8_16.c);
if ((v5.length() <= 0) || (!v3.nativeChecksumOk(v5))) {
v2_12 = 0;
} else {
v3.nativeActivate(v5);
v2_12 = 1;
}
v8_3.setValue(Boolean.valueOf(v2_12));
w2.h1 v8_4 = w7.a.h;
if (v8_4 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
w2.h1 v8_13;
v8_4.d.f();
int v1_3 = new o1.f(865824856, 1, new m0.r(28, this));
w2.h1 v8_12 = ((android.view.ViewGroup) this.getWindow().getDecorView().findViewById(16908290)).getChildAt(0);
if (!(v8_12 instanceof w2.h1)) {
v8_13 = 0;
} else {
v8_13 = ((w2.h1) v8_12);
}
if (v8_13 == null) {
w2.h1 v8_15 = new w2.h1(this);
v8_15.setParentCompositionContext(0);
v8_15.setContent(v1_3);
android.view.ViewGroup$LayoutParams v0_2 = this.getWindow().getDecorView();
if (androidx.lifecycle.l0.d(v0_2) == null) {
androidx.lifecycle.l0.h(v0_2, this);
}
if (androidx.lifecycle.l0.e(v0_2) == null) {
v0_2.setTag(2131034234, this);
}
if (v0.b.j(v0_2) == null) {
v0_2.setTag(2131034233, this);
}
this.setContentView(v8_15, c.f.a);
return;
} else {
v8_13.setParentCompositionContext(0);
v8_13.setContent(v1_3);
return;
}
}
}
}
}
+50
View File
@@ -0,0 +1,50 @@
package qbsg.top;
public final class MainApp extends android.app.Application {
public static qbsg.top.MainApp c;
public MainApp()
{
return;
}
public final void onCreate()
{
super.onCreate();
qbsg.top.MainApp.c = this;
if (w7.a.h == null) {
a0.m2 v2_0 = new a0.m2(new a6.a(w7.w.g()));
g3.q v3_1 = new g3.q();
v3_1.b = v2_0;
int v0_7 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(Boolean.FALSE);
v3_1.c = v0_7;
v3_1.d = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_7);
int v0_11 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow("--------");
v3_1.e = v0_11;
v3_1.a = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_11);
w7.v v5_0 = w7.m.a;
w7.n v4_1 = new w7.n(v5_0, v2_0, new r4.d(20));
i7.g v6_0 = v5_0;
int v0_22 = new w7.v(v6_0, ((kotlinx.coroutines.flow.StateFlow) v2_0.f), new okio.internal.a(14, v3_1), new s0.u0(10), new r4.d(21), new s0.u0(11), new s0.u0(12), new f8.a(w7.w.g()));
kotlin.jvm.internal.s.f(v6_0, "scope");
w7.a v1_2 = new i7.g();
v1_2.c = v6_0;
v1_2.d = v2_0;
w7.v v5_5 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(x7.d.a);
v1_2.e = v5_5;
v1_2.f = kotlinx.coroutines.flow.FlowKt.asStateFlow(v5_5);
if (v2_0.z().length() != 0) {
kotlinx.coroutines.BuildersKt.launch$default(v6_0, 0, 0, new a0.p1(v1_2, 0, 22), 3, 0);
} else {
v5_5.setValue(x7.f.a);
}
g3.q v7_8 = new g3.q(2);
w7.a.h = new w7.a(v2_0, v3_1, v4_1, v0_22, v1_2, v7_8);
v7_8.t();
v7_8.u();
if (((l8.a) ((kotlinx.coroutines.flow.StateFlow) v2_0.f).getValue()).h) {
v4_1.a(0);
}
}
return;
}
}
@@ -0,0 +1,21 @@
package qbsg.top.activation;
public final class ActivationManager {
public static final qbsg.top.activation.ActivationManager a;
static ActivationManager()
{
qbsg.top.activation.ActivationManager.a = new qbsg.top.activation.ActivationManager();
System.loadLibrary("app");
return;
}
public final native boolean nativeActivate(String p0);
public final native boolean nativeChecksumOk(String p0);
public final native String nativeDecryptSegment(String p0);
public final native String nativeGetDeviceId();
public final native void nativeInit(Object p0);
}
@@ -0,0 +1,255 @@
package qbsg.top.ble;
final class BleManager$AndroidGattOtaChannel implements qbsg.top.ble.GattOtaChannel {
private final kotlinx.coroutines.channels.Channel descResult;
private a7.c disconnectCb;
private final android.bluetooth.BluetoothGatt gatt;
private final kotlinx.coroutines.channels.Channel mtuResult;
private final kotlinx.coroutines.channels.Channel notifyEvents;
private final kotlinx.coroutines.channels.Channel readResult;
final synthetic qbsg.top.ble.BleManager this$0;
private final kotlinx.coroutines.channels.Channel writeResult;
public BleManager$AndroidGattOtaChannel(qbsg.top.ble.BleManager p4, android.bluetooth.BluetoothGatt p5)
{
kotlin.jvm.internal.s.f(p5, "gatt");
this.this$0 = p4;
this.gatt = p5;
this.writeResult = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.readResult = kotlinx.coroutines.channels.ChannelKt.Channel$default(2147483647, 0, 0, 6, 0);
this.mtuResult = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.descResult = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.notifyEvents = kotlinx.coroutines.channels.ChannelKt.Channel$default(2147483647, 0, 0, 6, 0);
return;
}
public void enableNotification(String p2, String p3)
{
kotlin.jvm.internal.s.f(p2, "serviceUuid");
kotlin.jvm.internal.s.f(p3, "charUuid");
android.bluetooth.BluetoothGattCharacteristic v2_3 = this.gatt.getService(java.util.UUID.fromString(p2));
if (v2_3 != null) {
android.bluetooth.BluetoothGattCharacteristic v2_1 = v2_3.getCharacteristic(java.util.UUID.fromString(p3));
if (v2_1 != null) {
this.gatt.setCharacteristicNotification(v2_1, 1);
}
}
return;
}
public final void forwardCharacteristicRead(android.bluetooth.BluetoothGattCharacteristic p2, byte[] p3, int p4)
{
kotlin.jvm.internal.s.f(p2, "c");
kotlin.jvm.internal.s.f(p3, "data");
kotlinx.coroutines.channels.Channel v4_2 = this.getReadResult();
String v2_3 = p2.getUuid().toString();
kotlin.jvm.internal.s.e(v2_3, "toString(...)");
String v2_1 = v2_3.toLowerCase(java.util.Locale.ROOT);
kotlin.jvm.internal.s.e(v2_1, "toLowerCase(...)");
v4_2.trySend-JP2dKIU(new p6.g(v2_1, p3));
return;
}
public final void forwardCharacteristicWrite(android.bluetooth.BluetoothGattCharacteristic p2, int p3)
{
Boolean v3_1;
kotlin.jvm.internal.s.f(p2, "c");
kotlinx.coroutines.channels.Channel v2_1 = this.getWriteResult();
if (p3 != null) {
v3_1 = 0;
} else {
v3_1 = 1;
}
v2_1.trySend-JP2dKIU(Boolean.valueOf(v3_1));
return;
}
public final void forwardDescriptorWrite(int p2)
{
Boolean v2_1;
kotlinx.coroutines.channels.Channel v0 = this.getDescResult();
if (p2 != null) {
v2_1 = 0;
} else {
v2_1 = 1;
}
v0.trySend-JP2dKIU(Boolean.valueOf(v2_1));
return;
}
public final void forwardMtuChanged(int p2, int p3)
{
kotlinx.coroutines.channels.Channel v0 = this.getMtuResult();
if (p3 != 0) {
p2 = 23;
}
v0.trySend-JP2dKIU(Integer.valueOf(p2));
return;
}
public final void forwardNotify(android.bluetooth.BluetoothGattCharacteristic p3, byte[] p4)
{
kotlin.jvm.internal.s.f(p3, "c");
kotlin.jvm.internal.s.f(p4, "value");
kotlinx.coroutines.channels.Channel v0_2 = this.getNotifyEvents();
String v3_3 = p3.getUuid().toString();
kotlin.jvm.internal.s.e(v3_3, "toString(...)");
String v3_1 = v3_3.toLowerCase(java.util.Locale.ROOT);
kotlin.jvm.internal.s.e(v3_1, "toLowerCase(...)");
v0_2.trySend-JP2dKIU(new p6.g(v3_1, p4));
return;
}
public kotlinx.coroutines.channels.Channel getDescResult()
{
return this.descResult;
}
public kotlinx.coroutines.channels.Channel getMtuResult()
{
return this.mtuResult;
}
public kotlinx.coroutines.channels.Channel getNotifyEvents()
{
return this.notifyEvents;
}
public kotlinx.coroutines.channels.Channel getReadResult()
{
return this.readResult;
}
public kotlinx.coroutines.channels.Channel getWriteResult()
{
return this.writeResult;
}
public boolean hasCharacteristic(String p2, String p3)
{
int v2_1;
kotlin.jvm.internal.s.f(p2, "serviceUuid");
kotlin.jvm.internal.s.f(p3, "charUuid");
int v2_5 = this.gatt.getService(java.util.UUID.fromString(p2));
if (v2_5 == 0) {
v2_1 = 0;
} else {
v2_1 = v2_5.getCharacteristic(java.util.UUID.fromString(p3));
}
if (v2_1 == 0) {
return 0;
} else {
return 1;
}
}
public boolean hasService(String p2)
{
kotlin.jvm.internal.s.f(p2, "serviceUuid");
if (this.gatt.getService(java.util.UUID.fromString(p2)) == null) {
return 0;
} else {
return 1;
}
}
public final void notifyDisconnect(int p2)
{
a7.c v0 = this.disconnectCb;
if (v0 != null) {
v0.invoke(Integer.valueOf(p2));
}
return;
}
public void readCharacteristic(String p2, String p3)
{
kotlin.jvm.internal.s.f(p2, "serviceUuid");
kotlin.jvm.internal.s.f(p3, "charUuid");
android.bluetooth.BluetoothGattCharacteristic v2_3 = this.gatt.getService(java.util.UUID.fromString(p2));
if (v2_3 != null) {
android.bluetooth.BluetoothGattCharacteristic v2_1 = v2_3.getCharacteristic(java.util.UUID.fromString(p3));
if (v2_1 != null) {
this.gatt.readCharacteristic(v2_1);
}
}
return;
}
public void requestBalancedPriority()
{
this.gatt.requestConnectionPriority(0);
return;
}
public void requestHighPriority()
{
this.gatt.requestConnectionPriority(1);
return;
}
public void requestMtu(int p2)
{
this.gatt.requestMtu(p2);
return;
}
public void setDisconnectCallback(a7.c p2)
{
kotlin.jvm.internal.s.f(p2, "cb");
this.disconnectCb = p2;
return;
}
public void writeCharacteristic(String p2, String p3, byte[] p4, boolean p5)
{
kotlin.jvm.internal.s.f(p2, "serviceUuid");
kotlin.jvm.internal.s.f(p3, "charUuid");
kotlin.jvm.internal.s.f(p4, "data");
android.bluetooth.BluetoothGattCharacteristic v2_1 = this.gatt.getService(java.util.UUID.fromString(p2));
if (v2_1 != null) {
android.bluetooth.BluetoothGattCharacteristic v2_2 = v2_1.getCharacteristic(java.util.UUID.fromString(p3));
if (v2_2 != null) {
android.bluetooth.BluetoothGatt v3_2;
if (p5 == null) {
v3_2 = 1;
} else {
v3_2 = 2;
}
if (android.os.Build$VERSION.SDK_INT < 33) {
v2_2.setValue(p4);
v2_2.setWriteType(v3_2);
this.gatt.writeCharacteristic(v2_2);
} else {
b.b.q(this.gatt, v2_2, p4, v3_2);
return;
}
}
}
return;
}
public void writeDescriptor(String p2, String p3, String p4, byte[] p5)
{
kotlin.jvm.internal.s.f(p2, "serviceUuid");
kotlin.jvm.internal.s.f(p3, "charUuid");
kotlin.jvm.internal.s.f(p4, "descUuid");
kotlin.jvm.internal.s.f(p5, "data");
android.bluetooth.BluetoothGattDescriptor v2_2 = this.gatt.getService(java.util.UUID.fromString(p2));
if (v2_2 != null) {
android.bluetooth.BluetoothGattDescriptor v2_3 = v2_2.getCharacteristic(java.util.UUID.fromString(p3));
if (v2_3 != null) {
android.bluetooth.BluetoothGattDescriptor v2_4 = v2_3.getDescriptor(java.util.UUID.fromString(p4));
if (v2_4 != null) {
if (android.os.Build$VERSION.SDK_INT < 33) {
v2_4.setValue(p5);
this.gatt.writeDescriptor(v2_4);
} else {
b.b.r(this.gatt, v2_4, p5);
return;
}
}
}
}
return;
}
}
@@ -0,0 +1,887 @@
package qbsg.top.ble;
public final class BleManager implements qbsg.top.ble.BleManagerFacade {
public static final int $stable = 8;
private final kotlinx.coroutines.flow.MutableStateFlow _activeDevice;
private final kotlinx.coroutines.flow.MutableStateFlow _connections;
private final kotlinx.coroutines.flow.MutableSharedFlow _disconnectEvents;
private final kotlinx.coroutines.flow.MutableStateFlow _isBluetoothEnabled;
private final kotlinx.coroutines.flow.MutableSharedFlow _messageEvents;
private final kotlinx.coroutines.flow.MutableSharedFlow _rawScanResults;
private final kotlinx.coroutines.flow.MutableStateFlow _scanState;
private final kotlinx.coroutines.flow.MutableStateFlow _scannedDevices;
private final kotlinx.coroutines.flow.MutableStateFlow _targetSessionMac;
private final kotlinx.coroutines.flow.StateFlow activeDevice;
private final android.bluetooth.BluetoothManager btManager;
private final qbsg.top.ble.BleManager$btStateReceiver$1 btStateReceiver;
private final kotlinx.coroutines.flow.StateFlow connections;
private final android.content.Context context;
private final java.util.LinkedList descriptorWriteQueue;
private final java.util.concurrent.ConcurrentHashMap deviceInfoReadJobs;
private final kotlinx.coroutines.flow.SharedFlow disconnectEvents;
private final qbsg.top.ble.BleManager$gattCallback$1 gattCallback;
private final java.util.concurrent.ConcurrentHashMap gatts;
private final String id;
private final kotlinx.coroutines.flow.StateFlow isBluetoothEnabled;
private boolean isWritingDescriptor;
private final kotlinx.coroutines.flow.SharedFlow messageEvents;
private final java.util.concurrent.ConcurrentHashMap otaChannels;
private a8.h otaManager;
private final java.util.concurrent.ConcurrentHashMap pendingCccdCount;
private final java.util.concurrent.ConcurrentHashMap pendingFirmware;
private final kotlinx.coroutines.flow.SharedFlow rawScanResults;
private final java.util.concurrent.ConcurrentHashMap readChannels;
private final qbsg.top.ble.BleManager$scanCallback$1 scanCallback;
private final kotlinx.coroutines.flow.StateFlow scanState;
private final kotlinx.coroutines.flow.StateFlow scannedDevices;
private final kotlinx.coroutines.CoroutineScope scope;
private final kotlinx.coroutines.flow.StateFlow targetSessionMac;
private final java.util.concurrent.ConcurrentHashMap$KeySetView userInitiatedDisconnections;
public BleManager(android.content.Context p5)
{
String v2_13;
kotlin.jvm.internal.s.f(p5, "context");
this.context = p5;
this.id = w7.w.i();
this.scope = kotlinx.coroutines.CoroutineScopeKt.CoroutineScope(kotlinx.coroutines.SupervisorKt.SupervisorJob$default(0, 1, 0).plus(kotlinx.coroutines.Dispatchers.getIO()));
qbsg.top.ble.BleManager$btStateReceiver$1 v0_9 = p5.getSystemService("bluetooth");
kotlin.jvm.internal.s.d(v0_9, "null cannot be cast to non-null type android.bluetooth.BluetoothManager");
this.btManager = ((android.bluetooth.BluetoothManager) v0_9);
this.gatts = new java.util.concurrent.ConcurrentHashMap();
this.userInitiatedDisconnections = java.util.concurrent.ConcurrentHashMap.newKeySet();
this.otaChannels = new java.util.concurrent.ConcurrentHashMap();
this.descriptorWriteQueue = new java.util.LinkedList();
this.readChannels = new java.util.concurrent.ConcurrentHashMap();
this.pendingFirmware = new java.util.concurrent.ConcurrentHashMap();
this.deviceInfoReadJobs = new java.util.concurrent.ConcurrentHashMap();
this.pendingCccdCount = new java.util.concurrent.ConcurrentHashMap();
qbsg.top.ble.BleManager$btStateReceiver$1 v0_28 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(q6.u.c);
this._connections = v0_28;
this.connections = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_28);
qbsg.top.ble.BleManager$btStateReceiver$1 v0_30 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
this._activeDevice = v0_30;
this.activeDevice = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_30);
qbsg.top.ble.BleManager$btStateReceiver$1 v0_32 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
this._targetSessionMac = v0_32;
this.targetSessionMac = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_32);
qbsg.top.ble.BleManager$btStateReceiver$1 v0_36 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(qbsg.top.ble.data.BleScanState.Idle);
this._scanState = v0_36;
this.scanState = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_36);
qbsg.top.ble.BleManager$btStateReceiver$1 v0_39 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(q6.t.c);
this._scannedDevices = v0_39;
this.scannedDevices = kotlinx.coroutines.flow.FlowKt.asStateFlow(v0_39);
String v2_10 = kotlinx.coroutines.flow.SharedFlowKt.MutableSharedFlow$default(0, 16, 0, 5, 0);
this._rawScanResults = v2_10;
this.rawScanResults = kotlinx.coroutines.flow.FlowKt.asSharedFlow(v2_10);
String v2_12 = this.getBtAdapter();
if (v2_12 == null) {
v2_13 = 0;
} else {
v2_13 = v2_12.isEnabled();
}
String v2_0 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(Boolean.valueOf(v2_13));
this._isBluetoothEnabled = v2_0;
this.isBluetoothEnabled = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_0);
String v2_3 = kotlinx.coroutines.flow.SharedFlowKt.MutableSharedFlow$default(0, 8, 0, 5, 0);
this._disconnectEvents = v2_3;
this.disconnectEvents = kotlinx.coroutines.flow.FlowKt.asSharedFlow(v2_3);
qbsg.top.ble.BleManager$btStateReceiver$1 v0_2 = kotlinx.coroutines.flow.SharedFlowKt.MutableSharedFlow$default(0, 64, 0, 5, 0);
this._messageEvents = v0_2;
this.messageEvents = kotlinx.coroutines.flow.FlowKt.asSharedFlow(v0_2);
qbsg.top.ble.BleManager$btStateReceiver$1 v0_5 = new qbsg.top.ble.BleManager$btStateReceiver$1(this);
this.btStateReceiver = v0_5;
p5.registerReceiver(v0_5, new android.content.IntentFilter("android.bluetooth.adapter.action.STATE_CHANGED"));
this.scanCallback = new qbsg.top.ble.BleManager$scanCallback$1(this);
this.gattCallback = new qbsg.top.ble.BleManager$gattCallback$1(this);
return;
}
public static synthetic boolean a(qbsg.top.ble.a p0, Object p1)
{
return qbsg.top.ble.BleManager.cleanupDevice$lambda$1(p0, p1);
}
public static final synthetic void access$cleanupDevice(qbsg.top.ble.BleManager p0, String p1, boolean p2, qbsg.top.ble.data.DisconnectReason p3)
{
p0.cleanupDevice(p1, p2, p3);
return;
}
public static final synthetic boolean access$enqueueNotify(qbsg.top.ble.BleManager p0, android.bluetooth.BluetoothGatt p1, android.bluetooth.BluetoothGattCharacteristic p2)
{
return p0.enqueueNotify(p1, p2);
}
public static final synthetic java.util.LinkedList access$getDescriptorWriteQueue$p(qbsg.top.ble.BleManager p0)
{
return p0.descriptorWriteQueue;
}
public static final synthetic java.util.concurrent.ConcurrentHashMap access$getGatts$p(qbsg.top.ble.BleManager p0)
{
return p0.gatts;
}
public static final synthetic java.util.concurrent.ConcurrentHashMap access$getOtaChannels$p(qbsg.top.ble.BleManager p0)
{
return p0.otaChannels;
}
public static final synthetic java.util.concurrent.ConcurrentHashMap access$getPendingCccdCount$p(qbsg.top.ble.BleManager p0)
{
return p0.pendingCccdCount;
}
public static final synthetic java.util.concurrent.ConcurrentHashMap access$getPendingFirmware$p(qbsg.top.ble.BleManager p0)
{
return p0.pendingFirmware;
}
public static final synthetic java.util.concurrent.ConcurrentHashMap access$getReadChannels$p(qbsg.top.ble.BleManager p0)
{
return p0.readChannels;
}
public static final synthetic java.util.concurrent.ConcurrentHashMap$KeySetView access$getUserInitiatedDisconnections$p(qbsg.top.ble.BleManager p0)
{
return p0.userInitiatedDisconnections;
}
public static final synthetic kotlinx.coroutines.flow.MutableStateFlow access$get_activeDevice$p(qbsg.top.ble.BleManager p0)
{
return p0._activeDevice;
}
public static final synthetic kotlinx.coroutines.flow.MutableStateFlow access$get_connections$p(qbsg.top.ble.BleManager p0)
{
return p0._connections;
}
public static final synthetic kotlinx.coroutines.flow.MutableSharedFlow access$get_disconnectEvents$p(qbsg.top.ble.BleManager p0)
{
return p0._disconnectEvents;
}
public static final synthetic kotlinx.coroutines.flow.MutableStateFlow access$get_isBluetoothEnabled$p(qbsg.top.ble.BleManager p0)
{
return p0._isBluetoothEnabled;
}
public static final synthetic kotlinx.coroutines.flow.MutableSharedFlow access$get_messageEvents$p(qbsg.top.ble.BleManager p0)
{
return p0._messageEvents;
}
public static final synthetic kotlinx.coroutines.flow.MutableSharedFlow access$get_rawScanResults$p(qbsg.top.ble.BleManager p0)
{
return p0._rawScanResults;
}
public static final synthetic kotlinx.coroutines.flow.MutableStateFlow access$get_scanState$p(qbsg.top.ble.BleManager p0)
{
return p0._scanState;
}
public static final synthetic kotlinx.coroutines.flow.MutableStateFlow access$get_scannedDevices$p(qbsg.top.ble.BleManager p0)
{
return p0._scannedDevices;
}
public static final synthetic kotlinx.coroutines.flow.MutableStateFlow access$get_targetSessionMac$p(qbsg.top.ble.BleManager p0)
{
return p0._targetSessionMac;
}
public static final synthetic void access$processDescriptorQueue(qbsg.top.ble.BleManager p0)
{
p0.processDescriptorQueue();
return;
}
public static final synthetic Object access$readDeviceInfoString(qbsg.top.ble.BleManager p0, android.bluetooth.BluetoothGatt p1, String p2, java.util.UUID p3, kotlin.coroutines.Continuation p4)
{
return p0.readDeviceInfoString(p1, p2, p3, p4);
}
public static final synthetic void access$setWritingDescriptor$p(qbsg.top.ble.BleManager p0, boolean p1)
{
p0.isWritingDescriptor = p1;
return;
}
public static final synthetic void access$startDeviceInfoRead(qbsg.top.ble.BleManager p0, android.bluetooth.BluetoothGatt p1)
{
p0.startDeviceInfoRead(p1);
return;
}
public static final synthetic void access$updateDeviceInfo(qbsg.top.ble.BleManager p0, String p1, String p2)
{
p0.updateDeviceInfo(p1, p2);
return;
}
public static synthetic boolean b(String p0, qbsg.top.ble.BleManager$DescriptorWriteRequest p1)
{
return qbsg.top.ble.BleManager.cleanupDevice$lambda$0(p0, p1);
}
private final void checkPrerequisitesOrThrow()
{
qbsg.top.ble.data.BleException$BluetoothDisabled v0_1;
if (android.os.Build$VERSION.SDK_INT < 31) {
v0_1 = k3.t.K("android.permission.ACCESS_FINE_LOCATION");
} else {
v0_1 = q6.n.Y(new String[] {"android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"}));
}
java.util.ArrayList v1_2 = new java.util.ArrayList();
qbsg.top.ble.data.BleException$BluetoothDisabled v0_2 = v0_1.iterator();
while (v0_2.hasNext()) {
Object v2_1 = v0_2.next();
if (this.context.checkSelfPermission(((String) v2_1)) != 0) {
v1_2.add(v2_1);
}
}
if (!v1_2.isEmpty()) {
throw new qbsg.top.ble.data.BleException$PermissionDenied(v1_2);
} else {
if (!this.getBtAdapter().isEnabled()) {
throw new qbsg.top.ble.data.BleException$BluetoothDisabled();
} else {
return;
}
}
}
private final void cleanupDevice(String p7, boolean p8, qbsg.top.ble.data.DisconnectReason p9)
{
this.userInitiatedDisconnections.remove(p7);
kotlinx.coroutines.flow.MutableStateFlow v0_24 = ((kotlinx.coroutines.Job) this.deviceInfoReadJobs.remove(p7));
String v2 = 0;
if (v0_24 != null) {
kotlinx.coroutines.Job$DefaultImpls.cancel$default(v0_24, 0, 1, 0);
}
this.pendingFirmware.remove(p7);
this.pendingCccdCount.remove(p7);
kotlinx.coroutines.flow.MutableStateFlow v0_12 = ((kotlinx.coroutines.channels.Channel) this.readChannels.remove(p7));
if (v0_12 != null) {
kotlinx.coroutines.channels.SendChannel$DefaultImpls.close$default(v0_12, 0, 1, 0);
}
kotlinx.coroutines.flow.MutableStateFlow v0_16 = ((android.bluetooth.BluetoothGatt) this.gatts.get(p7));
if (v0_16 != null) {
v0_16.close();
}
this.gatts.remove(p7);
this.descriptorWriteQueue.removeIf(new qbsg.top.ble.b(new qbsg.top.ble.a(p7)));
if (this.descriptorWriteQueue.isEmpty()) {
this.isWritingDescriptor = 0;
}
kotlinx.coroutines.flow.MutableStateFlow v0_23 = this._connections;
do {
int v3_3 = v0_23.getValue();
java.util.Map v4_3 = ((java.util.Map) v3_3);
kotlin.jvm.internal.s.f(v4_3, "<this>");
java.util.Map v4_4 = q6.y.c0(v4_3);
v4_4.remove(p7);
int v5_1 = v4_4.size();
if (v5_1 == 0) {
v4_4 = q6.u.c;
} else {
if (v5_1 == 1) {
v4_4 = q6.y.d0(v4_4);
}
}
} while(!v0_23.compareAndSet(v3_3, v4_4));
kotlinx.coroutines.flow.MutableStateFlow v0_28;
kotlinx.coroutines.flow.MutableStateFlow v0_27 = ((qbsg.top.ble.data.BleDeviceInfo) this._activeDevice.getValue());
if (v0_27 == null) {
v0_28 = 0;
} else {
v0_28 = v0_27.getAddress();
}
if (kotlin.jvm.internal.s.b(v0_28, p7)) {
kotlinx.coroutines.flow.MutableStateFlow v0_35 = ((Iterable) ((java.util.Map) this._connections.getValue()).values()).iterator();
while (v0_35.hasNext()) {
kotlinx.coroutines.flow.MutableStateFlow v1_7 = v0_35.next();
if ((((qbsg.top.ble.data.BleConnectionInfo) v1_7).getState() instanceof qbsg.top.ble.data.DeviceConnectionState$Connected)) {
}
kotlinx.coroutines.flow.MutableStateFlow v0_36;
kotlinx.coroutines.flow.MutableStateFlow v1_8 = ((qbsg.top.ble.data.BleConnectionInfo) v1_7);
if (v1_8 == null) {
v0_36 = 0;
} else {
v0_36 = v1_8.getDevice();
}
int v3_0;
kotlinx.coroutines.flow.MutableStateFlow v1_9 = this._targetSessionMac;
if (v0_36 == null) {
v3_0 = 0;
} else {
v3_0 = v0_36.getAddress();
}
v1_9.setValue(v3_0);
this._activeDevice.setValue(v0_36);
}
v1_7 = 0;
}
if (kotlin.jvm.internal.s.b(this._targetSessionMac.getValue(), p7)) {
int v7_7 = ((Iterable) ((java.util.Map) this._connections.getValue()).values()).iterator();
while (v7_7.hasNext()) {
kotlinx.coroutines.flow.MutableStateFlow v0_6 = v7_7.next();
if ((((qbsg.top.ble.data.BleConnectionInfo) v0_6).getState() instanceof qbsg.top.ble.data.DeviceConnectionState$Connected)) {
}
int v7_8;
kotlinx.coroutines.flow.MutableStateFlow v0_7 = ((qbsg.top.ble.data.BleConnectionInfo) v0_6);
if (v0_7 == null) {
v7_8 = 0;
} else {
v7_8 = v0_7.getDevice();
}
kotlinx.coroutines.flow.MutableStateFlow v0_8 = this._targetSessionMac;
if (v7_8 != 0) {
v2 = v7_8.getAddress();
}
v0_8.setValue(v2);
this._activeDevice.setValue(v7_8);
}
v0_6 = 0;
}
if ((p8) && (p9 != null)) {
this._disconnectEvents.tryEmit(p9);
}
return;
}
public static synthetic void cleanupDevice$default(qbsg.top.ble.BleManager p0, String p1, boolean p2, qbsg.top.ble.data.DisconnectReason p3, int p4, Object p5)
{
if ((p4 & 2) != 0) {
p2 = 0;
}
if ((p4 & 4) != 0) {
p3 = 0;
}
p0.cleanupDevice(p1, p2, p3);
return;
}
private static final boolean cleanupDevice$lambda$0(String p0, qbsg.top.ble.BleManager$DescriptorWriteRequest p1)
{
return kotlin.jvm.internal.s.b(p1.getGatt().getDevice().getAddress(), p0);
}
private static final boolean cleanupDevice$lambda$1(a7.c p0, Object p1)
{
return ((Boolean) p0.invoke(p1)).booleanValue();
}
private final boolean enqueueNotify(android.bluetooth.BluetoothGatt p5, android.bluetooth.BluetoothGattCharacteristic p6)
{
p5.setCharacteristicNotification(p6, 1);
android.bluetooth.BluetoothGattDescriptor v1_1 = p6.getDescriptor(qbsg.top.ble.BleManagerKt.access$getCCCD_UUID$p());
if (v1_1 != null) {
byte[] v6_1;
if ((p6.getProperties() & 32) == 0) {
v6_1 = android.bluetooth.BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE;
} else {
v6_1 = android.bluetooth.BluetoothGattDescriptor.ENABLE_INDICATION_VALUE;
}
java.util.LinkedList v2 = this.descriptorWriteQueue;
kotlin.jvm.internal.s.c(v6_1);
v2.add(new qbsg.top.ble.BleManager$DescriptorWriteRequest(p5, v1_1, v6_1));
this.processDescriptorQueue();
return 1;
} else {
return 0;
}
}
private final android.bluetooth.BluetoothAdapter getBtAdapter()
{
return this.btManager.getAdapter();
}
private final void processDescriptorQueue()
{
if ((!this.isWritingDescriptor) && (!this.descriptorWriteQueue.isEmpty())) {
java.util.LinkedList v0_9 = ((qbsg.top.ble.BleManager$DescriptorWriteRequest) this.descriptorWriteQueue.peek());
if (v0_9 != null) {
int v1_0 = 1;
this.isWritingDescriptor = 1;
if (android.os.Build$VERSION.SDK_INT < 33) {
v0_9.getDesc().setValue(v0_9.getValue());
v1_0 = v0_9.getGatt().writeDescriptor(v0_9.getDesc());
} else {
if (b.b.b(v0_9.getGatt(), v0_9.getDesc(), v0_9.getValue()) != 0) {
v1_0 = 0;
}
}
if (v1_0 == 0) {
this.descriptorWriteQueue.poll();
this.isWritingDescriptor = 0;
this.processDescriptorQueue();
}
}
}
return;
}
private final Object readDeviceInfoString(android.bluetooth.BluetoothGatt p12, String p13, java.util.UUID p14, kotlin.coroutines.Continuation p15)
{
qbsg.top.ble.BleManager$readDeviceInfoString$1 v0_2;
if (!(p15 instanceof qbsg.top.ble.BleManager$readDeviceInfoString$1)) {
v0_2 = new qbsg.top.ble.BleManager$readDeviceInfoString$1(this, p15);
} else {
v0_2 = ((qbsg.top.ble.BleManager$readDeviceInfoString$1) p15);
Object v1_2 = ((qbsg.top.ble.BleManager$readDeviceInfoString$1) p15).label;
if ((v1_2 & -2147483648) == 0) {
} else {
((qbsg.top.ble.BleManager$readDeviceInfoString$1) p15).label = (v1_2 - -2147483648);
}
}
Object v12_16;
android.bluetooth.BluetoothGattCharacteristic v8_1;
Object v15_6;
Object v13_10;
int v14_2;
long v6_3;
Object v15_1 = v0_2.result;
Object v1_1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
qbsg.top.ble.BleManager$readDeviceInfoString$result$1 v2_3 = v0_2.label;
int v4 = 1;
if (v2_3 == null) {
q6.y.Y(v15_1);
Object v15_3 = p12.getServices();
kotlin.jvm.internal.s.e(v15_3, "getServices(...)");
qbsg.top.ble.BleManager$readDeviceInfoString$result$1 v2_6 = new java.util.ArrayList();
Object v15_4 = v15_3.iterator();
while (v15_4.hasNext()) {
long v6_6 = ((android.bluetooth.BluetoothGattService) v15_4.next()).getCharacteristics();
kotlin.jvm.internal.s.e(v6_6, "getCharacteristics(...)");
q6.o.f0(v2_6, v6_6);
}
Object v15_5 = v2_6.size();
v6_3 = 0;
j7.d v7_0 = 0;
while (v7_0 < v15_5) {
android.bluetooth.BluetoothGattCharacteristic v8_0 = v2_6.get(v7_0);
v7_0++;
if (kotlin.jvm.internal.s.b(((android.bluetooth.BluetoothGattCharacteristic) v8_0).getUuid(), p14)) {
}
v8_1 = ((android.bluetooth.BluetoothGattCharacteristic) v8_0);
if (v8_1 != null) {
v15_6 = p14;
v14_2 = p13;
v13_10 = p12;
v12_16 = 0;
if (v12_16 >= 3) {
v4 = v6_3;
if (v4 != 0) {
Object v12_3 = ((kotlinx.coroutines.channels.Channel) this.readChannels.get(v14_2));
if (v12_3 != null) {
long v6_1 = j7.h.m(4, j7.d.f);
qbsg.top.ble.BleManager$readDeviceInfoString$result$1 v2_2 = new qbsg.top.ble.BleManager$readDeviceInfoString$result$1(v12_3, v15_6, 0);
v0_2.L$0 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v13_10);
v0_2.L$1 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v14_2);
v0_2.L$2 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v15_6);
v0_2.L$3 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v8_1);
v0_2.L$4 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v12_3);
v0_2.I$0 = v4;
v0_2.label = 2;
v15_1 = kotlinx.coroutines.TimeoutKt.withTimeoutOrNull-KLykuaI(v6_1, v2_2, v0_2);
if (v15_1 != v1_1) {
Object v15_2 = ((p6.g) v15_1);
if (v15_2 != null) {
Object v12_13 = ((byte[]) v15_2.d);
if (v12_13.length != 0) {
Object v12_15 = i7.i.S0(new String(v12_13, i7.a.a)).toString();
if (v12_15.length() != 0) {
return v12_15;
}
}
}
return 0;
}
}
}
} else {
if (!v13_10.readCharacteristic(v8_1)) {
long v9_4 = j7.h.m(120, j7.d.e);
v0_2.L$0 = v13_10;
v0_2.L$1 = v14_2;
v0_2.L$2 = v15_6;
v0_2.L$3 = v8_1;
v0_2.I$0 = v6_3;
v0_2.I$1 = v12_16;
v0_2.label = 1;
if (kotlinx.coroutines.DelayKt.delay-VtjQ1oo(v9_4, v0_2) == v1_1) {
}
}
}
return v1_1;
}
}
v8_0 = 0;
} else {
if (v2_3 == 1) {
v12_16 = v0_2.I$1;
Object v13_11 = v0_2.I$0;
int v14_4 = ((android.bluetooth.BluetoothGattCharacteristic) v0_2.L$3);
qbsg.top.ble.BleManager$readDeviceInfoString$result$1 v2_9 = ((java.util.UUID) v0_2.L$2);
long v6_8 = ((String) v0_2.L$1);
j7.d v7_3 = ((android.bluetooth.BluetoothGatt) v0_2.L$0);
q6.y.Y(v15_1);
v8_1 = v14_4;
v15_6 = v2_9;
v14_2 = v6_8;
v6_3 = v13_11;
v13_10 = v7_3;
do {
v12_16++;
} while(v4 != 0);
} else {
if (v2_3 != 2) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
p12 = ((android.bluetooth.BluetoothGattCharacteristic) v0_2.L$3);
p12 = ((String) v0_2.L$1);
q6.y.Y(v15_1);
}
}
}
return 0;
}
private final void startDeviceInfoRead(android.bluetooth.BluetoothGatt p9)
{
String v0_1 = p9.getDevice().getAddress();
java.util.concurrent.ConcurrentHashMap v1_4 = ((kotlinx.coroutines.Job) this.deviceInfoReadJobs.get(v0_1));
if ((v1_4 == null) || (v1_4.isActive() != 1)) {
this.deviceInfoReadJobs.put(v0_1, kotlinx.coroutines.BuildersKt.launch$default(this.scope, 0, 0, new qbsg.top.ble.BleManager$startDeviceInfoRead$1(this, v0_1, p9, 0), 3, 0));
return;
} else {
return;
}
}
private final void updateDeviceInfo(String p20, String p21)
{
kotlinx.coroutines.flow.MutableStateFlow v2 = this._connections;
do {
boolean v3_0 = v2.getValue();
java.util.Map v4_1 = ((java.util.Map) v3_0);
qbsg.top.ble.data.BleConnectionInfo v5_2 = ((qbsg.top.ble.data.BleConnectionInfo) v4_1.get(p20));
if (v5_2 != null) {
int v7_0;
if (p21 != null) {
v7_0 = p21;
} else {
v7_0 = "\u672a\u77e5";
}
String v13;
if (!v7_0.equals("\u672a\u77e5")) {
v13 = v7_0;
} else {
v13 = 0;
}
int v7_4;
p6.g v6_2 = qbsg.top.ble.data.BleDeviceInfo.copy$default(v5_2.getDevice(), 0, 0, 0, v13, 0, 0, 0, 119, 0);
int v7_3 = ((qbsg.top.ble.data.BleDeviceInfo) this._activeDevice.getValue());
if (v7_3 == 0) {
v7_4 = 0;
} else {
v7_4 = v7_3.getAddress();
}
if (kotlin.jvm.internal.s.b(v7_4, p20)) {
this._activeDevice.setValue(v6_2);
}
v4_1 = q6.y.L(v4_1, new p6.g(p20, qbsg.top.ble.data.BleConnectionInfo.copy$default(v5_2, v6_2, 0, 2, 0)));
}
} while(!v2.compareAndSet(v3_0, v4_1));
return;
}
public void closeOtaChannel(String p2)
{
kotlin.jvm.internal.s.f(p2, "address");
this.otaChannels.remove(p2);
return;
}
public void connect(qbsg.top.ble.data.BleDeviceInfo p7)
{
kotlin.jvm.internal.s.f(p7, "device");
this.checkPrerequisitesOrThrow();
if (!this.gatts.containsKey(p7.getAddress())) {
android.bluetooth.BluetoothGatt v0_6 = this._connections;
do {
java.util.concurrent.ConcurrentHashMap v1_0 = v0_6.getValue();
} while(!v0_6.compareAndSet(v1_0, q6.y.L(((java.util.Map) v1_0), new p6.g(p7.getAddress(), new qbsg.top.ble.data.BleConnectionInfo(p7, qbsg.top.ble.data.DeviceConnectionState$Connecting.INSTANCE)))));
this.gatts.put(p7.getAddress(), this.getBtAdapter().getRemoteDevice(p7.getAddress()).connectGatt(this.context, 0, this.gattCallback, 2));
return;
} else {
return;
}
}
public void destroy()
{
try {
this.context.unregisterReceiver(this.btStateReceiver);
} catch (Exception) {
}
java.util.Iterator v0_4 = this.gatts.keySet();
kotlin.jvm.internal.s.e(v0_4, "<get-keys>(...)");
java.util.Iterator v0_2 = q6.o.G0(((Iterable) v0_4)).iterator();
}
public void disconnect(String p9)
{
kotlin.jvm.internal.s.f(p9, "address");
android.bluetooth.BluetoothGatt v0_3 = ((android.bluetooth.BluetoothGatt) this.gatts.get(p9));
if (v0_3 != null) {
boolean v1_3;
boolean v1_2 = ((qbsg.top.ble.data.BleConnectionInfo) ((java.util.Map) this._connections.getValue()).get(p9));
if (!v1_2) {
v1_3 = 0;
} else {
v1_3 = v1_2.getState();
}
if (!(v1_3 instanceof qbsg.top.ble.data.DeviceConnectionState$Connecting)) {
this.userInitiatedDisconnections.add(p9);
v0_3.disconnect();
return;
} else {
qbsg.top.ble.BleManager.cleanupDevice$default(this, p9, 0, 0, 4, 0);
return;
}
} else {
return;
}
}
public kotlinx.coroutines.flow.StateFlow getActiveDevice()
{
return this.activeDevice;
}
public kotlinx.coroutines.flow.StateFlow getConnections()
{
return this.connections;
}
public kotlinx.coroutines.flow.SharedFlow getDisconnectEvents()
{
return this.disconnectEvents;
}
public String getId()
{
return this.id;
}
public kotlinx.coroutines.flow.SharedFlow getMessageEvents()
{
return this.messageEvents;
}
public a8.h getOtaManager()
{
return this.otaManager;
}
public kotlinx.coroutines.flow.SharedFlow getRawScanResults()
{
return this.rawScanResults;
}
public kotlinx.coroutines.flow.StateFlow getScanState()
{
return this.scanState;
}
public kotlinx.coroutines.flow.StateFlow getScannedDevices()
{
return this.scannedDevices;
}
public kotlinx.coroutines.flow.StateFlow getTargetSessionMac()
{
return this.targetSessionMac;
}
public kotlinx.coroutines.flow.StateFlow isBluetoothEnabled()
{
return this.isBluetoothEnabled;
}
public qbsg.top.ble.GattOtaChannel openOtaChannel(String p3)
{
kotlin.jvm.internal.s.f(p3, "address");
java.util.concurrent.ConcurrentHashMap v0_3 = ((android.bluetooth.BluetoothGatt) this.gatts.get(p3));
if (v0_3 != null) {
qbsg.top.ble.BleManager$AndroidGattOtaChannel v1_1 = new qbsg.top.ble.BleManager$AndroidGattOtaChannel(this, v0_3);
this.otaChannels.put(p3, v1_1);
return v1_1;
} else {
return 0;
}
}
public void setActiveFocus(qbsg.top.ble.data.BleDeviceInfo p3)
{
kotlin.jvm.internal.s.f(p3, "device");
qbsg.top.ble.data.BleDeviceInfo v0_1 = ((qbsg.top.ble.data.BleConnectionInfo) ((java.util.Map) this._connections.getValue()).get(p3.getAddress()));
if ((v0_1 != null) && ((v0_1.getState() instanceof qbsg.top.ble.data.DeviceConnectionState$Connected))) {
this._targetSessionMac.setValue(p3.getAddress());
this._activeDevice.setValue(v0_1.getDevice());
}
return;
}
public boolean setBluetoothEnabled(boolean p2)
{
throw new p6.f("An operation is not implemented: Not yet implemented");
}
public void setOtaManager(a8.h p1)
{
this.otaManager = p1;
return;
}
public void startScan()
{
this.checkPrerequisitesOrThrow();
int v1_1 = qbsg.top.ble.data.BleScanState.Scanning;
if (this._scanState.getValue() != v1_1) {
this._scannedDevices.setValue(q6.t.c);
this._scanState.setValue(v1_1);
android.bluetooth.le.BluetoothLeScanner v0_2 = this.getBtAdapter().getBluetoothLeScanner();
if (v0_2 != null) {
v0_2.startScan(0, new android.bluetooth.le.ScanSettings$Builder().setScanMode(2).build(), this.scanCallback);
}
kotlinx.coroutines.BuildersKt.launch$default(this.scope, 0, 0, new qbsg.top.ble.BleManager$startScan$1(this, 0), 3, 0);
return;
} else {
return;
}
}
public void stopScan()
{
if (this._scanState.getValue() == qbsg.top.ble.data.BleScanState.Scanning) {
try {
android.bluetooth.le.BluetoothLeScanner v0_5 = this.getBtAdapter();
} catch (Exception) {
this._scanState.setValue(qbsg.top.ble.data.BleScanState.Idle);
return;
}
if ((v0_5 == null) || (v0_5.isEnabled() != 1)) {
this._scanState.setValue(qbsg.top.ble.data.BleScanState.Idle);
return;
} else {
android.bluetooth.le.BluetoothLeScanner v0_2 = this.getBtAdapter().getBluetoothLeScanner();
if (v0_2 == null) {
this._scanState.setValue(qbsg.top.ble.data.BleScanState.Idle);
return;
} else {
v0_2.stopScan(this.scanCallback);
this._scanState.setValue(qbsg.top.ble.data.BleScanState.Idle);
return;
}
}
} else {
return;
}
}
public void updateDeviceType(String p17, w7.y p18)
{
kotlin.jvm.internal.s.f(p17, "address");
kotlinx.coroutines.flow.MutableStateFlow v2_1 = this._connections;
do {
boolean v3_1 = v2_1.getValue();
java.util.Map v4_0 = ((java.util.Map) v3_1);
qbsg.top.ble.data.BleConnectionInfo v5_1 = ((qbsg.top.ble.data.BleConnectionInfo) v4_0.get(p17));
if (v5_1 != null) {
int v7_4;
p6.g v6_1 = qbsg.top.ble.data.BleDeviceInfo.copy$default(v5_1.getDevice(), 0, 0, 0, 0, 0, p18, 0, 95, 0);
int v7_3 = ((qbsg.top.ble.data.BleDeviceInfo) this._activeDevice.getValue());
if (v7_3 == 0) {
v7_4 = 0;
} else {
v7_4 = v7_3.getAddress();
}
if (kotlin.jvm.internal.s.b(v7_4, p17)) {
this._activeDevice.setValue(v6_1);
}
v4_0 = q6.y.L(v4_0, new p6.g(p17, qbsg.top.ble.data.BleConnectionInfo.copy$default(v5_1, v6_1, 0, 2, 0)));
}
} while(!v2_1.compareAndSet(v3_1, v4_0));
return;
}
public void updateScreenSize(String p17, String p18)
{
kotlin.jvm.internal.s.f(p17, "address");
String v8 = p18;
kotlin.jvm.internal.s.f(p18, "screenSize");
kotlinx.coroutines.flow.MutableStateFlow v2_2 = this._connections;
while(true) {
Object v13 = v2_2.getValue();
java.util.Map v14_1 = ((java.util.Map) v13);
qbsg.top.ble.data.BleConnectionInfo v15_1 = ((qbsg.top.ble.data.BleConnectionInfo) v14_1.get(p17));
if (v15_1 != null) {
p6.g v4_4;
qbsg.top.ble.data.BleConnectionInfo v3_2 = qbsg.top.ble.data.BleDeviceInfo.copy$default(v15_1.getDevice(), 0, 0, 0, 0, v8, 0, 0, 111, 0);
p6.g v4_3 = ((qbsg.top.ble.data.BleDeviceInfo) this._activeDevice.getValue());
if (v4_3 == null) {
v4_4 = 0;
} else {
v4_4 = v4_3.getAddress();
}
if (kotlin.jvm.internal.s.b(v4_4, p17)) {
this._activeDevice.setValue(v3_2);
}
v14_1 = q6.y.L(v14_1, new p6.g(p17, qbsg.top.ble.data.BleConnectionInfo.copy$default(v15_1, v3_2, 0, 2, 0)));
}
if (v2_2.compareAndSet(v13, v14_1)) {
break;
}
v8 = p18;
}
return;
}
public void updateSelectPhase(String p17, w7.x p18)
{
kotlin.jvm.internal.s.f(p17, "address");
w7.x v10 = p18;
kotlin.jvm.internal.s.f(p18, "phase");
kotlinx.coroutines.flow.MutableStateFlow v2_2 = this._connections;
while(true) {
Object v13 = v2_2.getValue();
java.util.Map v14_1 = ((java.util.Map) v13);
qbsg.top.ble.data.BleConnectionInfo v15_1 = ((qbsg.top.ble.data.BleConnectionInfo) v14_1.get(p17));
if (v15_1 != null) {
p6.g v4_4;
qbsg.top.ble.data.BleConnectionInfo v3_2 = qbsg.top.ble.data.BleDeviceInfo.copy$default(v15_1.getDevice(), 0, 0, 0, 0, 0, 0, v10, 63, 0);
p6.g v4_3 = ((qbsg.top.ble.data.BleDeviceInfo) this._activeDevice.getValue());
if (v4_3 == null) {
v4_4 = 0;
} else {
v4_4 = v4_3.getAddress();
}
if (kotlin.jvm.internal.s.b(v4_4, p17)) {
this._activeDevice.setValue(v3_2);
}
v14_1 = q6.y.L(v14_1, new p6.g(p17, qbsg.top.ble.data.BleConnectionInfo.copy$default(v15_1, v3_2, 0, 2, 0)));
}
if (v2_2.compareAndSet(v13, v14_1)) {
break;
}
v10 = p18;
}
return;
}
}
@@ -0,0 +1,57 @@
package qbsg.top.ble;
public final class BleManagerKt {
private static final java.util.UUID CCCD_UUID;
private static final java.util.UUID EPD_CHAR_UUID;
private static final java.util.UUID EPD_SERVICE_UUID;
private static final java.util.UUID FIRMWARE_REVISION_UUID;
private static final java.util.UUID MODEL_NUMBER_UUID;
private static final java.util.UUID TX_CHAR_UUID;
private static final java.util.UUID TX_SERVICE_UUID;
static BleManagerKt()
{
qbsg.top.ble.BleManagerKt.TX_SERVICE_UUID = java.util.UUID.fromString("00001f10-0000-1000-8000-00805f9b34fb");
qbsg.top.ble.BleManagerKt.TX_CHAR_UUID = java.util.UUID.fromString("00001f1f-0000-1000-8000-00805f9b34fb");
qbsg.top.ble.BleManagerKt.CCCD_UUID = java.util.UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
qbsg.top.ble.BleManagerKt.MODEL_NUMBER_UUID = java.util.UUID.fromString("00002A24-0000-1000-8000-00805f9b34fb");
qbsg.top.ble.BleManagerKt.FIRMWARE_REVISION_UUID = java.util.UUID.fromString("00002A26-0000-1000-8000-00805f9b34fb");
qbsg.top.ble.BleManagerKt.EPD_SERVICE_UUID = java.util.UUID.fromString("13187b10-eba9-a3ba-044e-83d3217d9a38");
qbsg.top.ble.BleManagerKt.EPD_CHAR_UUID = java.util.UUID.fromString("4b646063-6264-f3a7-8941-e65356ea82fe");
return;
}
public static final synthetic java.util.UUID access$getCCCD_UUID$p()
{
return qbsg.top.ble.BleManagerKt.CCCD_UUID;
}
public static final synthetic java.util.UUID access$getEPD_CHAR_UUID$p()
{
return qbsg.top.ble.BleManagerKt.EPD_CHAR_UUID;
}
public static final synthetic java.util.UUID access$getEPD_SERVICE_UUID$p()
{
return qbsg.top.ble.BleManagerKt.EPD_SERVICE_UUID;
}
public static final synthetic java.util.UUID access$getFIRMWARE_REVISION_UUID$p()
{
return qbsg.top.ble.BleManagerKt.FIRMWARE_REVISION_UUID;
}
public static final synthetic java.util.UUID access$getMODEL_NUMBER_UUID$p()
{
return qbsg.top.ble.BleManagerKt.MODEL_NUMBER_UUID;
}
public static final synthetic java.util.UUID access$getTX_CHAR_UUID$p()
{
return qbsg.top.ble.BleManagerKt.TX_CHAR_UUID;
}
public static final synthetic java.util.UUID access$getTX_SERVICE_UUID$p()
{
return qbsg.top.ble.BleManagerKt.TX_SERVICE_UUID;
}
}
@@ -0,0 +1,355 @@
package qbsg.top.ble;
public final class BleSession implements qbsg.top.ble.data.BleSessionFacade {
public static final int $stable = 8;
private final kotlinx.coroutines.flow.MutableStateFlow _epdManager;
private final kotlinx.coroutines.flow.MutableSharedFlow _logEvents;
private final String address;
private final android.bluetooth.BluetoothGattCharacteristic epdChar;
private final kotlinx.coroutines.flow.StateFlow epdManager;
private final android.bluetooth.BluetoothGatt gatt;
private final String id;
private final kotlinx.coroutines.flow.SharedFlow logEvents;
private int negotiatedMtu;
private final android.bluetooth.BluetoothGattCharacteristic rxtxChar;
private final String tag;
private final kotlinx.coroutines.sync.Mutex writeMutex;
private a7.c writeResume;
public BleSession(android.bluetooth.BluetoothGatt p2, android.bluetooth.BluetoothGattCharacteristic p3, android.bluetooth.BluetoothGattCharacteristic p4)
{
kotlin.jvm.internal.s.f(p2, "gatt");
kotlin.jvm.internal.s.f(p3, "rxtxChar");
this.gatt = p2;
this.rxtxChar = p3;
this.epdChar = p4;
this.id = w7.w.i();
int v2_2 = p2.getDevice().getAddress();
kotlin.jvm.internal.s.e(v2_2, "getAddress(...)");
this.address = v2_2;
this.tag = "BleSession";
this.writeMutex = kotlinx.coroutines.sync.MutexKt.Mutex$default(0, 1, 0);
int v2_5 = kotlinx.coroutines.flow.SharedFlowKt.MutableSharedFlow$default(0, 64, 0, 5, 0);
this._logEvents = v2_5;
this.logEvents = kotlinx.coroutines.flow.FlowKt.asSharedFlow(v2_5);
int v2_7 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
this._epdManager = v2_7;
this.epdManager = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_7);
this.negotiatedMtu = 23;
return;
}
public synthetic BleSession(android.bluetooth.BluetoothGatt p1, android.bluetooth.BluetoothGattCharacteristic p2, android.bluetooth.BluetoothGattCharacteristic p3, int p4, kotlin.jvm.internal.j p5)
{
if ((p4 & 4) != 0) {
p3 = 0;
}
this(p1, p2, p3);
return;
}
public static synthetic CharSequence a(byte p0)
{
return qbsg.top.ble.BleSession.sendEpdBytes$lambda$2(p0);
}
public static final synthetic Object access$executeWrite(qbsg.top.ble.BleSession p0, android.bluetooth.BluetoothGattCharacteristic p1, byte[] p2, kotlin.coroutines.Continuation p3)
{
return p0.executeWrite(p1, p2, p3);
}
public static final synthetic android.bluetooth.BluetoothGatt access$getGatt$p(qbsg.top.ble.BleSession p0)
{
return p0.gatt;
}
public static final synthetic android.bluetooth.BluetoothGattCharacteristic access$getRxtxChar$p(qbsg.top.ble.BleSession p0)
{
return p0.rxtxChar;
}
public static final synthetic String access$getTag$p(qbsg.top.ble.BleSession p0)
{
return p0.tag;
}
public static final synthetic kotlinx.coroutines.sync.Mutex access$getWriteMutex$p(qbsg.top.ble.BleSession p0)
{
return p0.writeMutex;
}
public static final synthetic void access$setWriteResume$p(qbsg.top.ble.BleSession p0, a7.c p1)
{
p0.writeResume = p1;
return;
}
private final Object executeWrite(android.bluetooth.BluetoothGattCharacteristic p6, byte[] p7, kotlin.coroutines.Continuation p8)
{
int v2 = 1;
kotlinx.coroutines.CancellableContinuationImpl v0_1 = new kotlinx.coroutines.CancellableContinuationImpl(kotlin.coroutines.intrinsics.IntrinsicsKt.intercepted(p8), 1);
v0_1.initCancellability();
qbsg.top.ble.BleSession.access$setWriteResume$p(this, new qbsg.top.ble.BleSession$executeWrite$2$1(this, v0_1));
if (android.os.Build$VERSION.SDK_INT < 33) {
p6.setValue(p7);
v2 = qbsg.top.ble.BleSession.access$getGatt$p(this).writeCharacteristic(p6);
} else {
if (b.b.a(qbsg.top.ble.BleSession.access$getGatt$p(this), p6, p7) != 0) {
v2 = 0;
}
}
if (v2 == 0) {
qbsg.top.ble.BleSession.access$setWriteResume$p(this, 0);
v0_1.resumeWith(kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0));
}
Object v6_4 = v0_1.getResult();
if (v6_4 == kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
kotlin.coroutines.jvm.internal.DebugProbesKt.probeCoroutineSuspended(p8);
}
return v6_4;
}
private final byte[] hexToBytes(String p6)
{
IllegalArgumentException v6_2 = i7.p.j0(p6, " ", "");
if ((v6_2.length() % 2) != 0) {
throw new IllegalArgumentException("Failed requirement.");
} else {
String v0_2 = (v6_2.length() / 2);
byte[] v1_1 = new byte[v0_2];
int v2 = 0;
while (v2 < v0_2) {
byte v3_0 = (v2 * 2);
byte v3_1 = v6_2.substring(v3_0, (v3_0 + 2));
kotlin.jvm.internal.s.e(v3_1, "substring(...)");
c7.a.l(16);
v1_1[v2] = ((byte) Integer.parseInt(v3_1, 16));
v2++;
}
return v1_1;
}
}
private static final CharSequence sendEpdBytes$lambda$1(byte p1)
{
return String.format("%02x", java.util.Arrays.copyOf(new Object[] {Byte.valueOf(p1)}), 1));
}
private static final CharSequence sendEpdBytes$lambda$2(byte p1)
{
return String.format("%02x", java.util.Arrays.copyOf(new Object[] {Byte.valueOf(p1)}), 1));
}
public String getAddress()
{
return this.address;
}
public kotlinx.coroutines.flow.StateFlow getEpdManager()
{
return this.epdManager;
}
public String getId()
{
return this.id;
}
public kotlinx.coroutines.flow.SharedFlow getLogEvents()
{
return this.logEvents;
}
public final int getMaxPayloadBytes()
{
int v0_1 = (this.negotiatedMtu - 3);
if (v0_1 >= 20) {
return v0_1;
} else {
return 20;
}
}
public final int getNegotiatedMtu$composeApp_release()
{
return this.negotiatedMtu;
}
public final void onWriteComplete$composeApp_release(boolean p3)
{
a7.c v0 = this.writeResume;
this.writeResume = 0;
if (v0 != null) {
v0.invoke(Boolean.valueOf(p3));
}
return;
}
public Object sendCommand(String p12, kotlin.coroutines.Continuation p13)
{
StringBuilder v0_2;
if (!(p13 instanceof qbsg.top.ble.BleSession$sendCommand$1)) {
v0_2 = new qbsg.top.ble.BleSession$sendCommand$1(this, p13);
} else {
v0_2 = ((qbsg.top.ble.BleSession$sendCommand$1) p13);
String v1_2 = ((qbsg.top.ble.BleSession$sendCommand$1) p13).label;
if ((v1_2 & -2147483648) == 0) {
} else {
((qbsg.top.ble.BleSession$sendCommand$1) p13).label = (v1_2 - -2147483648);
}
}
Object v13_3 = v0_2.result;
String v1_1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
int v2_0 = v0_2.label;
boolean v3_0 = 0;
if (v2_0 == 0) {
q6.y.Y(v13_3);
Object v13_4 = this.tag;
int v2_2 = new StringBuilder("\u51c6\u5907\u53d1\u9001\u547d\u4ee4: ");
v2_2.append(p12);
android.util.Log.d(v13_4, v2_2.toString());
try {
Object v13_5 = this.hexToBytes(p12);
this._logEvents.tryEmit("->CMD ".concat(i7.p.j0(p12, " ", "")));
int v2_5 = this.getMaxPayloadBytes();
kotlin.jvm.internal.s.f(v13_5, "<this>");
qbsg.top.ble.BleSession$sendCommand$2 v5_7 = a.a.V(new f7.d(0, (v13_5.length - 1), 1), v2_5);
java.util.ArrayList v6_5 = new java.util.ArrayList(q6.p.c0(v5_7, 10));
qbsg.top.ble.BleSession$sendCommand$2 v5_8 = v5_7.iterator();
} catch (Object v12_7) {
Object v13_6 = this.tag;
Object v12_8 = v12_7.getMessage();
StringBuilder v0_4 = new StringBuilder("Hex \u8f6c\u6362\u5b57\u8282\u5931\u8d25: ");
v0_4.append(v12_8);
android.util.Log.e(v13_6, v0_4.toString());
return kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0);
}
while(true) {
byte[] v8_4 = ((f7.c) v5_8);
if (!v8_4.e) {
break;
}
byte[] v8_5 = v8_4.nextInt();
v6_5.add(q6.n.A0(v13_5, a.a.Y(v8_5, Math.min((v8_5 + v2_5), v13_5.length))));
}
long v7_1 = j7.h.m(10, j7.d.f);
qbsg.top.ble.BleSession$sendCommand$2 v5_11 = new qbsg.top.ble.BleSession$sendCommand$2(this, v6_5, p12, 0);
v0_2.L$0 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(p12);
v0_2.L$1 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v13_5);
v0_2.L$2 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v6_5);
v0_2.I$0 = v2_5;
v0_2.label = 1;
v13_3 = kotlinx.coroutines.TimeoutKt.withTimeoutOrNull-KLykuaI(v7_1, v5_11, v0_2);
if (v13_3 == v1_1) {
return v1_1;
}
} else {
if (v2_0 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
p12 = ((byte[]) v0_2.L$1);
q6.y.Y(v13_3);
}
}
Object v13_2 = ((Boolean) v13_3);
if (v13_2 != null) {
v3_0 = v13_2.booleanValue();
}
return kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v3_0);
}
public Object sendEpdBytes(byte[] p12, kotlin.coroutines.Continuation p13)
{
qbsg.top.ble.BleSession$sendEpdBytes$1 v0_2;
if (!(p13 instanceof qbsg.top.ble.BleSession$sendEpdBytes$1)) {
v0_2 = new qbsg.top.ble.BleSession$sendEpdBytes$1(this, p13);
} else {
v0_2 = ((qbsg.top.ble.BleSession$sendEpdBytes$1) p13);
Object v1_2 = ((qbsg.top.ble.BleSession$sendEpdBytes$1) p13).label;
if ((v1_2 & -2147483648) == 0) {
} else {
((qbsg.top.ble.BleSession$sendEpdBytes$1) p13).label = (v1_2 - -2147483648);
}
}
Object v13_4 = v0_2.result;
Object v1_1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED();
String v2_0 = v0_2.label;
boolean v3_0 = 0;
if (v2_0 == null) {
q6.y.Y(v13_4);
Object v13_5 = this.epdChar;
if (v13_5 != null) {
String v2_7;
if (p12.length > 20) {
String v2_4 = q6.o.s0(q6.n.B0(p12, 12), "", 0, 0, new okio.internal.b(17), 30);
long v5_2 = p12.length;
j7.d v6_2 = new StringBuilder();
v6_2.append(v2_4);
v6_2.append("...(");
v6_2.append(v5_2);
v6_2.append("B)");
v2_7 = v6_2.toString();
} else {
String v2_9 = new StringBuilder();
v2_9.append("");
j7.d v6_3 = p12.length;
int v7_1 = 0;
int v8_1 = 0;
while (v7_1 < v6_3) {
CharSequence v9_2 = p12[v7_1];
v8_1++;
if (v8_1 > 1) {
v2_9.append("");
}
v2_9.append(qbsg.top.ble.BleSession.sendEpdBytes$lambda$1(v9_2));
v7_1++;
}
v2_9.append("");
v2_7 = v2_9.toString();
}
long v5_4 = this._logEvents;
j7.d v6_5 = new StringBuilder("->EPD ");
v6_5.append(v2_7);
v5_4.tryEmit(v6_5.toString());
long v5_6 = j7.h.m(5, j7.d.f);
int v7_4 = new qbsg.top.ble.BleSession$sendEpdBytes$2(this, v13_5, p12, 0);
v0_2.L$0 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(p12);
v0_2.L$1 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v13_5);
v0_2.L$2 = kotlin.coroutines.jvm.internal.SpillingKt.nullOutSpilledVariable(v2_7);
v0_2.label = 1;
v13_4 = kotlinx.coroutines.TimeoutKt.withTimeoutOrNull-KLykuaI(v5_6, v7_4, v0_2);
if (v13_4 == v1_1) {
return v1_1;
}
} else {
android.util.Log.e(this.tag, "EPD \u901a\u9053\u672a\u5c31\u7eea");
return kotlin.coroutines.jvm.internal.Boxing.boxBoolean(0);
}
} else {
if (v2_0 != 1) {
throw new IllegalStateException("call to \'resume\' before \'invoke\' with coroutine");
} else {
p12 = ((android.bluetooth.BluetoothGattCharacteristic) v0_2.L$1);
q6.y.Y(v13_4);
}
}
Object v13_2 = ((Boolean) v13_4);
if (v13_2 == null) {
android.util.Log.w(this.tag, "EPD \u5199\u5165\u8d85\u65f6");
} else {
v3_0 = v13_2.booleanValue();
}
return kotlin.coroutines.jvm.internal.Boxing.boxBoolean(v3_0);
}
public void setEpdManager(e8.o p2)
{
this._epdManager.setValue(p2);
return;
}
public final void setNegotiatedMtu$composeApp_release(int p1)
{
this.negotiatedMtu = p1;
return;
}
}
@@ -0,0 +1,33 @@
package qbsg.top.ble;
public interface GattOtaChannel {
public abstract void enableNotification(String p0, String p1);
public abstract kotlinx.coroutines.channels.Channel getDescResult();
public abstract kotlinx.coroutines.channels.Channel getMtuResult();
public abstract kotlinx.coroutines.channels.Channel getNotifyEvents();
public abstract kotlinx.coroutines.channels.Channel getReadResult();
public abstract kotlinx.coroutines.channels.Channel getWriteResult();
public abstract boolean hasCharacteristic(String p0, String p1);
public abstract boolean hasService(String p0);
public abstract void readCharacteristic(String p0, String p1);
public abstract void requestBalancedPriority();
public abstract void requestHighPriority();
public abstract void requestMtu(int p0);
public abstract void setDisconnectCallback(a7.c p0);
public abstract void writeCharacteristic(String p0, String p1, byte[] p2, boolean p3);
public abstract void writeDescriptor(String p0, String p1, String p2, byte[] p3);
}
+177
View File
@@ -0,0 +1,177 @@
package s0;
public final synthetic class u0 implements a7.c {
public final synthetic int c;
public synthetic u0(int p1)
{
this.c = p1;
return;
}
public synthetic u0(int p1, y.n p2)
{
this.c = 20;
return;
}
public final Object invoke(Object p8)
{
int v5 = 0;
switch (this.c) {
case 0:
return new a2.b(((((long) Float.floatToRawIntBits(((n.n) p8).a)) << 32) | (4294967295 & ((long) Float.floatToRawIntBits(((n.n) p8).b)))));
case 1:
return new s0.g1(((Long) p8).longValue());
case 2:
try {
boolean v1_17 = s1.m.i;
w7.l v2_10 = v1_17.size();
} catch (String v8_40) {
throw v8_40;
}
while (v5 < v2_10) {
((a7.c) v1_17.get(v5)).invoke(p8);
v5++;
}
return p6.a0.a;
case 3:
p8 = s1.m.a;
return p6.a0.a;
case 4:
kotlin.jvm.internal.s.f(((d3.a0) p8), "$this$semantics");
d3.y.k(((d3.a0) p8), -1082130432);
return p6.a0.a;
case 5:
kotlin.jvm.internal.s.f(((b2.i0) p8), "$this$graphicsLayer");
((b2.i0) p8).d(0);
return p6.a0.a;
case 6:
((Integer) p8).getClass();
return p6.a0.a;
case 7:
return ((w.j2) p8).l;
case 8:
return ((w.j2) p8).c;
case 9:
return ((w.j2) p8).e;
case 10:
kotlin.jvm.internal.s.f(((String) p8), "it");
qbsg.top.activation.ActivationManager v0_19 = w7.a.h;
if (v0_19 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
s8.d0.a(((s8.d0) v0_19.g.getValue()), ((String) p8));
return p6.a0.a;
}
case 11:
a7.c v3_11;
String v8_18 = ((Boolean) p8).booleanValue();
qbsg.top.activation.ActivationManager v0_17 = new s0.u0(13);
if (v8_18 == null) {
v3_11 = new z7.b0(w7.m.a, new qbsg.top.ble.BleManager(w7.w.g()), new qbsg.top.ble.AndroidRawGattConnector(w7.w.g()), v0_17);
} else {
String v8_20 = w7.m.a;
kotlin.jvm.internal.s.f(v8_20, "scope");
v3_11 = new z7.b0(v8_20, new qbsg.top.ble.SimulatedBleManager(), new qbsg.top.ble.SimulatedRawGattConnector(), v0_17);
}
return v3_11;
case 12:
kotlin.jvm.internal.s.f(((qbsg.top.ble.BleManagerFacade) p8), "b");
return new a8.g(w7.m.a, ((qbsg.top.ble.BleManagerFacade) p8));
case 13:
kotlin.jvm.internal.s.f(((String) p8), "it");
qbsg.top.activation.ActivationManager v0_8 = w7.a.h;
if (v0_8 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
boolean v1_8 = ((Boolean) ((kotlinx.coroutines.flow.StateFlow) v0_8.b.d).getValue()).booleanValue();
if (v0_8.d.k.getValue() == w7.l.d) {
v5 = 1;
}
if ((!v1_8) || (v5 == 0)) {
String v8_13 = "";
} else {
v8_13 = i7.i.S0(qbsg.top.activation.ActivationManager.a.nativeDecryptSegment(((String) p8))).toString();
}
return v8_13;
}
case 14:
kotlin.jvm.internal.s.f(((String) p8), "url");
u0.a.n();
w7.l v2_1 = w7.w.g();
try {
a7.c v3_5 = new android.content.Intent("android.intent.action.VIEW", android.net.Uri.parse(((String) p8)));
v3_5.addCategory("android.intent.category.BROWSABLE");
v3_5.addFlags(268435456);
v2_1.startActivity(v3_5);
} catch (Exception) {
a7.c v3_8 = new android.content.Intent("android.intent.action.VIEW", android.net.Uri.parse(((String) p8)));
v3_8.addFlags(268435456);
v2_1.startActivity(v3_8);
}
return p6.a0.a;
case 15:
kotlin.jvm.internal.s.f(((t4.b) p8), "$this$viewModel");
qbsg.top.activation.ActivationManager v0_2 = w7.a.h;
if (v0_2 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
return new n8.i0(v0_2.e);
}
case 16:
kotlin.jvm.internal.s.f(((z8.c0) p8), "link");
w7.l v2_14 = w7.w.g();
try {
a7.c v3_0 = new android.content.Intent("android.intent.action.VIEW", android.net.Uri.parse(((z8.c0) p8).d));
v3_0.addCategory("android.intent.category.BROWSABLE");
v3_0.addFlags(268435456);
v2_14.startActivity(v3_0);
} catch (Exception) {
a7.c v3_2 = new android.content.Intent("android.intent.action.VIEW", android.net.Uri.parse(((z8.c0) p8).e));
v3_2.addFlags(268435456);
v2_14.startActivity(v3_2);
}
return p6.a0.a;
case 17:
return p6.a0.a;
case 18:
((Integer) p8).getClass();
return 0;
case 19:
return new y.t(((Number) ((java.util.List) p8).get(0)).intValue(), ((Number) ((java.util.List) p8).get(1)).intValue());
case 20:
return p6.a0.a;
case 21:
p8 = y0.t.a;
return p6.a0.a;
case 22:
((v2.k0) p8).h(y0.w.f, ((float) ((int) (((v2.k0) p8).c().o0() >> 32))));
((v2.k0) p8).h(y0.w.e, 0);
return p6.a0.a;
case 23:
d3.y.g(((d3.a0) p8), 0);
return p6.a0.a;
case 24:
d3.y.g(((d3.a0) p8), 1);
return p6.a0.a;
case 25:
p8 = y0.t1.a;
return p6.a0.a;
case 26:
((d3.a0) p8).a(d3.w.m, Boolean.TRUE);
return p6.a0.a;
case 27:
((Integer) p8).intValue();
return ((Integer) p8);
case 28:
((d3.a0) p8).a(d3.w.v, new d3.l(new w7.h(10), new w7.h(10)));
return p6.a0.a;
default:
p8 = y0.e3.a;
return p6.a0.a;
}
}
}
+712
View File
@@ -0,0 +1,712 @@
package w7;
public abstract class w {
public static final o1.f a;
static w()
{
w7.w.a = new o1.f(443304602, 0, new s8.l(8));
return;
}
public static final void a(int p51, e1.n0 p52)
{
int v2_83;
p52.b0(947805020);
if (p51 == 0) {
v2_83 = 0;
} else {
v2_83 = 1;
}
if (!p52.R((p51 & 1), v2_83)) {
p52.U();
} else {
w7.g v8_0 = e1.t.e(w7.w.f().d.k, p52);
e1.j1 v25 = e1.t.e(((kotlinx.coroutines.flow.StateFlow) w7.w.f().b.d), p52);
e1.j1 v27 = e1.t.e(w7.w.f().d.p, p52);
e1.j1 v28 = e1.t.e(w7.w.f().c.e, p52);
e1.j1 v41 = e1.t.e(w7.w.f().c.i, p52);
e1.j1 v42 = e1.t.e(w7.w.f().c.g, p52);
e1.j1 v29 = e1.t.e(w7.w.f().c.k, p52);
int v2_68 = new Object[0];
w7.a0 v3_67 = p52.O();
e1.j1 v9_0 = e1.n.a;
if (v3_67 == v9_0) {
v3_67 = new r4.d(22);
p52.k0(v3_67);
}
e1.j1 v21_1 = ((e1.j1) r1.k.c(v2_68, ((a7.a) v3_67), p52, 48));
int v2_84 = new Object[0];
w7.a0 v3_99 = p52.O();
if (v3_99 == v9_0) {
v3_99 = new r4.d(28);
p52.k0(v3_99);
}
e1.j1 v19_1 = ((e1.j1) r1.k.c(v2_84, ((a7.a) v3_99), p52, 48));
int v2_89 = new Object[0];
w7.a0 v3_114 = p52.O();
if (v3_114 == v9_0) {
v3_114 = new r4.d(29);
p52.k0(v3_114);
}
e1.j1 v20_1 = ((e1.j1) r1.k.c(v2_89, ((a7.a) v3_114), p52, 48));
int v2_91 = new Object[0];
w7.a0 v3_0 = p52.O();
if (v3_0 == v9_0) {
v3_0 = new w7.h(0);
p52.k0(v3_0);
}
e1.j1 v13_1 = ((e1.j1) r1.k.c(v2_91, ((a7.a) v3_0), p52, 48));
int v2_2 = new Object[0];
w7.a0 v3_3 = p52.O();
if (v3_3 == v9_0) {
v3_3 = new w7.h(1);
p52.k0(v3_3);
}
e1.j1 v17_1 = ((e1.j1) r1.k.c(v2_2, ((a7.a) v3_3), p52, 48));
int v2_4 = new Object[0];
w7.a0 v3_6 = p52.O();
if (v3_6 == v9_0) {
v3_6 = new w7.h(2);
p52.k0(v3_6);
}
int v2_8;
int v10_1 = ((e1.j1) r1.k.c(v2_4, ((a7.a) v3_6), p52, 48));
int v11_0 = w7.w.f().d.i;
if (v11_0 == 0) {
v2_8 = 0;
} else {
v2_8 = v11_0.getConnections();
}
if (v2_8 != 0) {
p52.a0(307590415);
} else {
p52.a0(945408637);
int v2_11 = p52.O();
if (v2_11 == v9_0) {
v2_11 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(q6.u.c);
p52.k0(v2_11);
}
v2_8 = ((kotlinx.coroutines.flow.MutableStateFlow) v2_11);
}
w7.a0 v3_10;
p52.q(0);
int v2_14 = e1.t.e(v2_8, p52);
if (v11_0 == 0) {
v3_10 = 0;
} else {
v3_10 = v11_0.getActiveDevice();
}
if (v3_10 != null) {
p52.a0(307594508);
} else {
p52.a0(945536481);
w7.a0 v3_12 = p52.O();
if (v3_12 == v9_0) {
v3_12 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
p52.k0(v3_12);
}
v3_10 = ((kotlinx.coroutines.flow.MutableStateFlow) v3_12);
}
w7.a0 v3_13;
p52.q(0);
e1.j1 v38 = e1.t.e(v3_10, p52);
if (v11_0 == 0) {
v3_13 = 0;
} else {
v3_13 = v11_0.getTargetSessionMac();
}
if (v3_13 != null) {
p52.a0(307599383);
} else {
p52.a0(945691450);
w7.a0 v3_15 = p52.O();
if (v3_15 == v9_0) {
v3_15 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
p52.k0(v3_15);
}
v3_13 = ((kotlinx.coroutines.flow.MutableStateFlow) v3_15);
}
p52.q(0);
w7.a0 v3_16 = e1.t.e(v3_13, p52);
a7.e v4_2 = w7.a.h;
if (v4_2 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
int v36;
e1.j1 v37 = e1.t.e(v4_2.d.r, p52);
w7.a0 v3_18 = ((String) v3_16.getValue());
if (v3_18 == null) {
v36 = 0;
} else {
v36 = ((qbsg.top.ble.data.BleConnectionInfo) ((java.util.Map) v2_14.getValue()).get(v3_18));
}
java.util.Iterator v35;
w7.a0 v3_24 = ((Iterable) ((java.util.Map) v2_14.getValue()).values());
if ((!(v3_24 instanceof java.util.Collection)) || (!((java.util.Collection) v3_24).isEmpty())) {
w7.a0 v3_25 = v3_24.iterator();
while (v3_25.hasNext()) {
if ((((qbsg.top.ble.data.BleConnectionInfo) v3_25.next()).getState() instanceof qbsg.top.ble.data.DeviceConnectionState$Connecting)) {
v35 = 1;
}
}
v35 = 0;
}
int v24;
o1.f v1_4 = ((Iterable) ((java.util.Map) v2_14.getValue()).values());
if ((!(v1_4 instanceof java.util.Collection)) || (!((java.util.Collection) v1_4).isEmpty())) {
o1.f v1_5 = v1_4.iterator();
int v2_24 = 0;
while (v1_5.hasNext()) {
if ((((qbsg.top.ble.data.BleConnectionInfo) v1_5.next()).getState() instanceof qbsg.top.ble.data.DeviceConnectionState$Connected)) {
v2_24++;
if (v2_24 < 0) {
throw new ArithmeticException("Count overflow has happened.");
}
}
o1.f v1_75 = p52.t();
if (v1_75 != null) {
v1_75.d = new s8.l(p51, 7);
}
return;
}
v24 = v2_24;
} else {
v24 = 0;
}
o1.f v1_7 = p52.O();
if (v1_7 == v9_0) {
v1_7 = new a9.b(17);
p52.k0(v1_7);
}
o1.f v1_9 = ((a7.c) v1_7);
int v2_28 = u4.a.a(p52);
if (v2_28 == 0) {
throw new IllegalStateException("No ViewModelStoreOwner was provided via LocalViewModelStoreOwner");
} else {
w7.a0 v3_34;
a7.e v4_16 = kotlin.jvm.internal.g0.a(b9.m0);
a7.e v5_4 = new l.b(1);
v5_4.a(kotlin.jvm.internal.g0.a(b9.m0), v1_9);
o1.f v1_10 = v5_4.b();
if (!(v2_28 instanceof androidx.lifecycle.k)) {
v3_34 = t4.a.b;
} else {
v3_34 = ((b.l) ((androidx.lifecycle.k) v2_28)).e();
}
b9.w v12_3 = ((b9.m0) u2.b.q(v4_16, v2_28, 0, v1_10, v3_34, p52));
o1.f v1_13 = w7.a.h;
if (v1_13 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
o1.f v1_17 = e1.t.e(((kotlinx.coroutines.flow.StateFlow) v1_13.f.d), p52);
int v2_33 = p52.g(((java.util.List) v1_17.getValue()));
w7.a0 v3_39 = p52.O();
if ((v2_33 != 0) || (v3_39 == v9_0)) {
o1.f v1_19 = ((java.util.List) v1_17.getValue());
kotlin.jvm.internal.s.f(v1_19, "projects");
int v2_37 = new java.util.ArrayList();
o1.f v1_20 = v1_19.iterator();
while (v1_20.hasNext()) {
w7.a0 v3_113;
w7.a0 v3_111 = ((m8.c) v1_20.next()).b;
if (i7.p.l0(v3_111, "\u672a\u547d\u540d\u9879\u76ee", 0)) {
w7.a0 v3_112 = i7.i.D0(v3_111, "\u672a\u547d\u540d\u9879\u76ee");
if (i7.i.x0(v3_112)) {
v3_113 = 0;
} else {
a7.e v4_41 = 0;
while (v4_41 < v3_112.length()) {
if (Character.isDigit(v3_112.charAt(v4_41))) {
v4_41++;
}
}
v3_113 = i7.p.n0(v3_112);
}
}
if (v3_113 != null) {
v2_37.add(v3_113);
}
}
o1.f v1_23;
o1.f v1_22 = ((Long) q6.o.v0(v2_37));
if (v1_22 == null) {
v1_23 = 0;
} else {
v1_23 = v1_22.longValue();
}
o1.f v1_24 = (v1_23 + 1);
w7.a0 v3_42 = new StringBuilder("\u672a\u547d\u540d\u9879\u76ee");
v3_42.append(v1_24);
v3_39 = v3_42.toString();
p52.k0(v3_39);
}
long v18_1 = ((String) v3_39);
o1.f v1_25 = p52.i(v12_3);
int v2_39 = p52.O();
if ((v1_25 != null) || (v2_39 == v9_0)) {
v2_39 = new m0.r(26, v12_3);
p52.k0(v2_39);
}
m8.f v7_2;
e1.j1 v22_1 = q8.k.p(((a7.e) v2_39), p52);
if (v11_0 != 0) {
p52.a0(946592000);
o1.f v1_28 = v11_0.getId();
int v2_42 = v12_3.b;
w7.a0 v3_44 = new StringBuilder();
v3_44.append(v1_28);
v3_44.append(":");
v3_44.append(v2_42);
w7.a0 v3_45 = v3_44.toString();
o1.f v1_32 = (p52.i(v11_0) | p52.i(v12_3));
int v2_45 = p52.O();
if ((v1_32 != null) || (v2_45 == v9_0)) {
v2_45 = new n.n1(29, v11_0, v12_3);
p52.k0(v2_45);
}
int v2_48 = ((a7.c) v2_45);
o1.f v1_34 = u4.a.a(p52);
if (v1_34 == null) {
throw new IllegalStateException("No ViewModelStoreOwner was provided via LocalViewModelStoreOwner");
} else {
int v2_51;
a7.e v5_6 = kotlin.jvm.internal.g0.a(b9.w);
int v26_0 = v3_45;
m8.f v7_1 = new l.b(1);
v7_1.a(kotlin.jvm.internal.g0.a(b9.w), v2_48);
a7.e v4_20 = v7_1.b();
if (!(v1_34 instanceof androidx.lifecycle.k)) {
v2_51 = t4.a.b;
} else {
v2_51 = ((b.l) ((androidx.lifecycle.k) v1_34)).e();
}
o1.f v1_37 = ((b9.w) u2.b.q(v5_6, v1_34, v26_0, v4_20, v2_51, p52));
p52.q(0);
v7_2 = v1_37;
}
} else {
p52.a0(946591999);
p52.q(0);
v7_2 = 0;
}
o1.f v1_44;
m8.f v45_1 = ((m8.f) q6.o.u0(((java.util.List) e1.t.e(v12_3.f, p52).getValue())));
if (v7_2 == null) {
v1_44 = 0;
} else {
v1_44 = v7_2.l;
}
int v2_59;
if (v1_44 != null) {
v2_59 = 0;
p52.a0(307640928);
} else {
p52.a0(946978384);
o1.f v1_46 = p52.O();
if (v1_46 == v9_0) {
v1_46 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
p52.k0(v1_46);
}
v1_44 = ((kotlinx.coroutines.flow.MutableStateFlow) v1_46);
v2_59 = 0;
}
o1.f v1_48;
p52.q(v2_59);
e1.j1 v40 = e1.t.e(v1_44, p52);
int v26_1 = e1.t.e(v12_3.d, p52);
if (v11_0 == 0) {
v1_48 = 0;
} else {
v1_48 = v11_0.getOtaManager();
}
o1.f v1_49;
if (v1_48 == null) {
v1_49 = 0;
} else {
v1_49 = ((a8.g) v1_48).f;
}
int v2_61;
if (v1_49 != null) {
v2_61 = 0;
p52.a0(307649811);
} else {
p52.a0(947245108);
o1.f v1_52 = p52.O();
if (v1_52 == v9_0) {
v1_52 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
p52.k0(v1_52);
}
v1_49 = ((kotlinx.coroutines.flow.MutableStateFlow) v1_52);
v2_61 = 0;
}
p52.q(v2_61);
b9.l v30_0 = e1.t.e(v1_49, p52);
o1.f v1_53 = p52.O();
if (v1_53 == v9_0) {
v1_53 = new b9.n0();
p52.k0(v1_53);
}
b9.n0 v32_1 = ((b9.n0) v1_53);
o1.f v1_55 = p52.O();
if (v1_55 == v9_0) {
v1_55 = new a9.b(16);
p52.k0(v1_55);
}
o1.f v1_57 = ((a7.c) v1_55);
int v2_65 = u4.a.a(p52);
if (v2_65 == 0) {
throw new IllegalStateException("No ViewModelStoreOwner was provided via LocalViewModelStoreOwner");
} else {
w7.a0 v3_56;
a7.e v4_21 = kotlin.jvm.internal.g0.a(b9.m);
a7.e v5_9 = new l.b(1);
v5_9.a(kotlin.jvm.internal.g0.a(b9.m), v1_57);
o1.f v1_58 = v5_9.b();
if (!(v2_65 instanceof androidx.lifecycle.k)) {
v3_56 = t4.a.b;
} else {
v3_56 = ((b.l) ((androidx.lifecycle.k) v2_65)).e();
}
e1.j1 v31_2 = v7_2;
m8.f v7_4 = v45_1;
o1.f v1_61 = ((b9.m) u2.b.q(v4_21, v2_65, 0, v1_58, v3_56, p52));
int v2_69 = (p52.i(v11_0) | p52.i(v12_3));
w7.a0 v3_62 = p52.O();
if ((v2_69 != 0) || (v3_62 == v9_0)) {
v3_62 = new o8.s3(15, v11_0, v12_3);
p52.k0(v3_62);
}
v1_61.c = ((a7.e) v3_62);
int v2_71 = p52.i(v1_61);
w7.a0 v3_65 = p52.O();
if ((v2_71 != 0) || (v3_65 == v9_0)) {
v3_65 = new w7.c(v1_61, 0);
p52.k0(v3_65);
}
a7.a v33 = q8.k.m(((a7.e) v3_65), p52, 0);
int v2_74 = w7.a.h;
if (v2_74 == 0) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
e1.j1 v34_1;
o1.f v1_72;
int v2_76 = v2_74.d.l;
w7.a0 v3_70 = ((w7.l) v8_0.getValue());
kotlin.jvm.internal.s.f(v3_70, "appMode");
p52.a0(495211714);
m8.f v14_1 = w7.l.d;
if ((v3_70 == v14_1) && (v2_76 != 0)) {
w7.a0 v3_73 = ((z7.b0) v2_76).d;
a7.e v4_25 = p52.i(v2_76);
a7.e v5_11 = p52.O();
if ((v4_25 != null) || (v5_11 == v9_0)) {
v5_11 = new b9.o0(v2_76, 0);
p52.k0(v5_11);
}
a7.e v5_13 = ((a7.c) v5_11);
int v2_77 = u4.a.a(p52);
if (v2_77 == 0) {
throw new IllegalStateException("No ViewModelStoreOwner was provided via LocalViewModelStoreOwner");
} else {
o1.f v1_66;
b9.m0 v15_1 = v1_61;
qbsg.top.ble.BleManagerFacade v39_0 = v3_73;
o1.f v1_64 = new l.b(1);
v1_64.a(kotlin.jvm.internal.g0.a(b9.l), v5_13);
a7.e v4_29 = v1_64.b();
if (!(v2_77 instanceof androidx.lifecycle.k)) {
v1_66 = t4.a.b;
} else {
v1_66 = ((b.l) ((androidx.lifecycle.k) v2_77)).e();
}
v34_1 = v15_1;
v1_72 = ((b9.l) u2.b.q(kotlin.jvm.internal.g0.a(b9.l), v2_77, v39_0, v4_29, v1_66, p52));
p52.q(0);
}
} else {
v34_1 = v1_61;
p52.q(0);
v1_72 = 0;
}
int v2_80 = p52.O();
if (v2_80 == v9_0) {
v2_80 = e1.t.n(0);
p52.k0(v2_80);
}
int v2_81 = ((e1.j1) v2_80);
w7.a0 v3_79 = p52.i(v1_72);
a7.e v4_31 = p52.O();
if ((v3_79 != null) || (v4_31 == v9_0)) {
v4_31 = new o8.f0(17, v1_72, v2_81);
p52.k0(v4_31);
}
e1.h0.f(((a7.a) v4_31), p52);
w7.a0 v3_82 = ((w7.l) v8_0.getValue());
a7.e v4_35 = (p52.g(v8_0) | p52.g(v10_1));
a7.e v5_16 = p52.O();
if ((v4_35 != null) || (v5_16 == v9_0)) {
v5_16 = new w7.i(v8_0, v10_1, 0, 0);
p52.k0(v5_16);
}
int v44;
w7.a0 v3_100;
e1.h0.c(((a7.e) v5_16), p52, v3_82);
if (((a8.j) v30_0.getValue()) == null) {
if (v7_4 == null) {
if (!((Boolean) v20_1.getValue()).booleanValue()) {
if (!((Boolean) v19_1.getValue()).booleanValue()) {
if ((!((Boolean) v10_1.getValue()).booleanValue()) && (((w7.l) v8_0.getValue()) != v14_1)) {
if (!((Boolean) v26_1.getValue()).booleanValue()) {
v44 = 0;
} else {
v3_100 = w7.a0.g;
v44 = v3_100;
}
} else {
v3_100 = w7.a0.c;
}
} else {
v3_100 = w7.a0.d;
}
} else {
v3_100 = w7.a0.e;
}
} else {
v3_100 = w7.a0.f;
}
} else {
v3_100 = w7.a0.h;
}
w7.a0 v3_101 = p52.O();
if (v3_101 == v9_0) {
v3_101 = e1.t.n(v44);
p52.k0(v3_101);
}
e1.j1 v46_1 = ((e1.j1) v3_101);
w7.a0 v3_102 = p52.O();
if (v3_102 == v9_0) {
v3_102 = e1.t.n(v7_4);
p52.k0(v3_102);
}
w7.a0 v3_104;
e1.j1 v47_1 = ((e1.j1) v3_102);
if (v44 != 0) {
v3_104 = v44.ordinal();
} else {
v3_104 = -1;
}
m8.f v14_2;
int v26_2;
int v10_2;
w7.a0 v3_106 = (p52.e(v3_104) | p52.g(v7_4));
a7.e v4_38 = p52.O();
if ((v3_106 == null) && (v4_38 != v9_0)) {
v14_2 = v7_4;
v26_2 = v10_1;
v10_2 = v44;
} else {
m8.f v45_2 = v7_4;
v26_2 = v10_1;
v4_38 = new h0.z(v44, v45_2, v46_1, v47_1, 0, 3);
v10_2 = v44;
v14_2 = v45_2;
p52.k0(v4_38);
}
e1.h0.d(v10_2, v14_2, ((a7.e) v4_38), p52);
q8.k.a(o1.l.d(-1446439417, new w7.g(v30_0, v10_2, v34_1, v31_2, v13_1, v14_2, v12_3, v18_1, v17_1, v22_1, v19_1, v20_1, v21_1, v46_1, v2_81, v24, v25, v26_2, v27, v28, v29, v1_72, v8_0, v32_1, v33, v47_1, v35, v36, v37, v38, v11_0, v40, v41, v42), p52), p52, 6);
}
}
}
}
}
}
}
public static final String b(String p2)
{
return i7.p.j0(i7.p.j0(i7.p.j0(i7.p.j0(p2, "\\\"", "\""), "\\\\", "\\"), "\\n", "\n"), "\\r", "\r");
}
public static final int c(String p10, int p11, char p12, char p13)
{
int v0 = p10.length();
int v2_1 = p11;
int v3 = 0;
int v4 = 0;
int v5 = 0;
while (v2_1 < v0) {
char v7 = p10.charAt(v2_1);
if (v3 == 0) {
if ((v7 != 92) || (v4 == 0)) {
if (v7 != 34) {
if (v4 == 0) {
if (v7 != p12) {
if (v7 == p13) {
v5--;
if (v5 == 0) {
String v10_1 = p10.substring(p11, (v2_1 + 1));
kotlin.jvm.internal.s.e(v10_1, "substring(...)");
return (i7.i.s0(v10_1) + p11);
}
}
} else {
v5++;
}
}
} else {
v4 ^= 1;
}
} else {
v3 = 1;
}
} else {
v3 = 0;
}
v2_1++;
}
v10_1 = p10.substring(p11);
kotlin.jvm.internal.s.e(v10_1, "substring(...)");
return (i7.i.s0(v10_1) + p11);
}
public static final int d(int p5, String p6)
{
int v5_1 = (p5 + 1);
int v2 = 0;
while (v5_1 < p6.length()) {
char v3_0 = p6.charAt(v5_1);
if (v2 == 0) {
if (v3_0 != 92) {
if (v3_0 == 34) {
return v5_1;
}
} else {
v2 = 1;
}
} else {
v2 = 0;
}
v5_1++;
}
return i7.i.s0(p6);
}
public static final varargs String e(p6.g[] p7)
{
StringBuilder v0_1 = new StringBuilder("{");
int v1_1 = p7.length;
int v2 = 0;
String v3_10 = 0;
while (v2 < v1_1) {
String v4_0 = p7[v2];
int v5 = (v3_10 + 1);
String v6_1 = ((String) v4_0.c);
String v4_1 = v4_0.d;
if (v3_10 > null) {
v0_1.append(44);
}
String v3_8;
v0_1.append(34);
v0_1.append(w7.w.h(v6_1));
v0_1.append("\":");
if (v4_1 != null) {
if (!(v4_1 instanceof Boolean)) {
if (!(v4_1 instanceof Number)) {
v3_8 = p.p1.k("\"", w7.w.h(v4_1.toString()), "\"");
} else {
v3_8 = ((Number) v4_1).toString();
}
} else {
v3_8 = String.valueOf(((Boolean) v4_1).booleanValue());
}
} else {
v3_8 = "null";
}
v0_1.append(v3_8);
v2++;
v3_10 = v5;
}
v0_1.append(125);
return v0_1.toString();
}
public static w7.a f()
{
int v0_0 = w7.a.h;
if (v0_0 == 0) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
return v0_0;
}
}
public static qbsg.top.MainApp g()
{
int v0_0 = qbsg.top.MainApp.c;
if (v0_0 == 0) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
return v0_0;
}
}
public static final String h(String p2)
{
return i7.p.j0(i7.p.j0(i7.p.j0(i7.p.j0(p2, "\\", "\\\\"), "\"", "\\\""), "\n", "\\n"), "\r", "\\r");
}
public static final String i()
{
String v0_1 = java.util.UUID.randomUUID().toString();
kotlin.jvm.internal.s.e(v0_1, "toString(...)");
return v0_1;
}
public static final String j(float p2)
{
String v2_5 = ((int) ((float) Math.rint(((double) (p2 * 1092616192)))));
String v0_4 = (v2_5 / 10);
String v2_2 = Math.abs((v2_5 % 10));
StringBuilder v1_1 = new StringBuilder();
v1_1.append(v0_4);
v1_1.append(".");
v1_1.append(v2_2);
return v1_1.toString();
}
public static final n4.q k(String p2)
{
kotlin.jvm.internal.s.f(p2, "s");
return new n4.q(p2, 1);
}
public static final String l(String p5)
{
kotlin.jvm.internal.s.f(p5, "s");
StringBuilder v0_2 = new StringBuilder();
String v5_2 = i7.p.d0(p5);
int v1 = v5_2.length;
int v2 = 0;
while (v2 < v1) {
String v3_1 = (v5_2[v2] & 255);
if (((48 > v3_1) || (v3_1 >= 58)) && (((65 > v3_1) || (v3_1 >= 91)) && (((97 > v3_1) || (v3_1 >= 123)) && ((v3_1 != 45) && ((v3_1 != 95) && ((v3_1 != 46) && (v3_1 != 126))))))) {
v0_2.append(37);
c7.a.l(16);
String v3_2 = Integer.toString(v3_1, 16);
kotlin.jvm.internal.s.e(v3_2, "toString(...)");
String v3_3 = v3_2.toUpperCase(java.util.Locale.ROOT);
kotlin.jvm.internal.s.e(v3_3, "toUpperCase(...)");
v0_2.append(i7.i.B0(2, v3_3));
} else {
v0_2.append(((char) v3_1));
}
v2++;
}
return v0_2.toString();
}
}
+111
View File
@@ -0,0 +1,111 @@
package y7;
public final class a {
public final kotlinx.coroutines.flow.MutableStateFlow a;
public final kotlinx.coroutines.flow.StateFlow b;
public final kotlinx.coroutines.flow.MutableStateFlow c;
public final kotlinx.coroutines.flow.StateFlow d;
public a(String p2)
{
kotlin.jvm.internal.s.f(p2, "deviceId");
w7.w.i();
kotlinx.coroutines.flow.StateFlow v2_5 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(0);
this.a = v2_5;
this.b = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_5);
kotlinx.coroutines.flow.StateFlow v2_2 = kotlinx.coroutines.flow.StateFlowKt.MutableStateFlow(Boolean.FALSE);
this.c = v2_2;
this.d = kotlinx.coroutines.flow.FlowKt.asStateFlow(v2_2);
return;
}
public final void a(String p23, boolean p24)
{
kotlin.jvm.internal.s.f(p23, "code");
String v0_1 = w7.a.h;
if (v0_1 == null) {
kotlin.jvm.internal.s.l("instance");
throw 0;
} else {
kotlinx.coroutines.flow.MutableStateFlow v21;
y7.a v1_0 = v0_1.b;
boolean v18 = qbsg.top.activation.ActivationManager.a.nativeActivate(p23);
if (!v18) {
v21 = v0_1;
} else {
kotlinx.coroutines.flow.MutableStateFlow v2_2 = ((a0.m2) v1_0.b);
((a6.a) v2_2.d).D("activation_code", p23);
kotlinx.coroutines.flow.MutableStateFlow v2_4 = ((kotlinx.coroutines.flow.MutableStateFlow) v2_2.e);
y7.a v19 = v1_0;
v21 = v0_1;
v2_4.setValue(l8.a.a(((l8.a) v2_4.getValue()), 0, 0, 0, 0, 0, p23, 0, 0, 0, 0, 0, 0, 0, 0, 32703));
((kotlinx.coroutines.flow.MutableStateFlow) v19.c).setValue(Boolean.TRUE);
}
if (v18) {
v21.d.e();
}
if (v18) {
return;
} else {
String v0_10;
if (!p24) {
String v0_9 = new Object[0];
v0_10 = h8.c.b("\u6fc0\u6d3b\u7801\u65e0\u6548\u6216\u4e0d\u5c5e\u4e8e\u672c\u8bbe\u5907", v0_9);
} else {
String v0_11 = new Object[0];
v0_10 = h8.c.b("\u4e8c\u7ef4\u7801\u4e0d\u5c5e\u4e8e\u672c\u8bbe\u5907", v0_11);
}
this.a.setValue(v0_10);
return;
}
}
}
public final void b(byte[] p11)
{
int v1_0 = this.a;
int v2_0 = 0;
if ((p11 != null) && (p11.length >= 71)) {
if (kotlin.jvm.internal.s.b(q6.o.s0(q6.n.B0(p11, 4), "", 0, 0, new y0.w2(24), 30), "qbsg")) {
IllegalArgumentException v0_2 = (p11.length - 4);
if (v0_2 >= null) {
v2_0 = v0_2;
}
if (v2_0 < 0) {
throw new IllegalArgumentException(a1.a.k("Requested element count ", v2_0, " is less than zero.").toString());
} else {
java.util.ArrayList v11_4;
if (v2_0 != 0) {
int v1_1 = p11.length;
if (v2_0 < v1_1) {
if (v2_0 != 1) {
java.util.ArrayList v3_2 = new java.util.ArrayList(v2_0);
int v2_1 = (v1_1 - v2_0);
while (v2_1 < v1_1) {
v3_2.add(Byte.valueOf(p11[v2_1]));
v2_1++;
}
v11_4 = v3_2;
} else {
v11_4 = k3.t.K(Byte.valueOf(p11[(v1_1 - 1)]));
}
} else {
v11_4 = q6.n.C0(p11);
}
} else {
v11_4 = q6.t.c;
}
this.a(q6.o.s0(q6.o.D0(v11_4, 67), "", 0, 0, new y0.w2(25), 30), 1);
return;
}
} else {
java.util.ArrayList v11_9 = new Object[0];
v1_0.setValue(h8.c.b("\u4e8c\u7ef4\u7801\u4e0d\u662f\u6fc0\u6d3b\u7801", v11_9));
return;
}
} else {
java.util.ArrayList v11_11 = new Object[0];
v1_0.setValue(h8.c.b("\u4e8c\u7ef4\u7801\u4e0d\u662f\u6fc0\u6d3b\u7801", v11_11));
return;
}
}
}
File diff suppressed because it is too large. Load diff
+3
View File
@@ -0,0 +1,3 @@
package z7;
public interface c0 {
}
+174
View File
@@ -0,0 +1,174 @@
package z7;
public final class d0 {
public final boolean a;
public final java.util.List b;
public final boolean c;
public final java.util.Set d;
public final String e;
public final int f;
public final String g;
public final java.util.List h;
public final z7.o0 i;
public final int j;
public d0()
{
q6.t v2 = q6.t.c;
this(0, v2, 1, q6.v.c, "", 0, "", v2, new z7.o0(), 6);
return;
}
public d0(boolean p1, java.util.List p2, boolean p3, java.util.Set p4, String p5, int p6, String p7, java.util.List p8, z7.o0 p9, int p10)
{
this.a = p1;
this.b = p2;
this.c = p3;
this.d = p4;
this.e = p5;
this.f = p6;
this.g = p7;
this.h = p8;
this.i = p9;
this.j = p10;
return;
}
public static z7.d0 a(z7.d0 p11, boolean p12, java.util.List p13, boolean p14, java.util.Set p15, String p16, int p17, String p18, java.util.List p19, int p20, int p21)
{
if ((p21 & 1) != 0) {
p12 = p11.a;
}
if ((p21 & 2) != 0) {
p13 = p11.b;
}
if ((p21 & 4) != 0) {
p14 = p11.c;
}
if ((p21 & 8) != 0) {
p15 = p11.d;
}
String v5;
if ((p21 & 16) == 0) {
v5 = p16;
} else {
v5 = p11.e;
}
int v6;
if ((p21 & 32) == 0) {
v6 = p17;
} else {
v6 = p11.f;
}
String v7;
if ((p21 & 64) == 0) {
v7 = p18;
} else {
v7 = p11.g;
}
java.util.List v8;
if ((p21 & 128) == 0) {
v8 = p19;
} else {
v8 = p11.h;
}
int v10;
z7.o0 v9 = p11.i;
if ((p21 & 512) == 0) {
v10 = p20;
} else {
v10 = p11.j;
}
p11.getClass();
kotlin.jvm.internal.s.f(p13, "scannedDevices");
kotlin.jvm.internal.s.f(p15, "selectedAddresses");
kotlin.jvm.internal.s.f(v5, "firmwareFileName");
kotlin.jvm.internal.s.f(v7, "firmwareCrc");
kotlin.jvm.internal.s.f(v8, "commands");
kotlin.jvm.internal.s.f(v9, "uploadConfig");
return new z7.d0(p12, p13, p14, p15, v5, v6, v7, v8, v9, v10);
}
public final boolean equals(Object p5)
{
if (this != p5) {
if ((p5 instanceof z7.d0)) {
if (this.a == ((z7.d0) p5).a) {
if (kotlin.jvm.internal.s.b(this.b, ((z7.d0) p5).b)) {
if (this.c == ((z7.d0) p5).c) {
if (kotlin.jvm.internal.s.b(this.d, ((z7.d0) p5).d)) {
if (kotlin.jvm.internal.s.b(this.e, ((z7.d0) p5).e)) {
if (this.f == ((z7.d0) p5).f) {
if (kotlin.jvm.internal.s.b(this.g, ((z7.d0) p5).g)) {
if (kotlin.jvm.internal.s.b(this.h, ((z7.d0) p5).h)) {
if (kotlin.jvm.internal.s.b(this.i, ((z7.d0) p5).i)) {
if (this.j == ((z7.d0) p5).j) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 1;
}
}
public final int hashCode()
{
return (Integer.hashCode(this.j) + ((this.i.hashCode() + a1.a.d(p.p1.c(this.g, a1.a.c(this.f, p.p1.c(this.e, ((this.d.hashCode() + a1.a.e(a1.a.d((Boolean.hashCode(this.a) * 31), 31, this.b), 31, this.c)) * int v1), 31), 31), 31), 31, this.h)) * 31));
}
public final String toString()
{
String v0_1 = new StringBuilder("AdvancedSetupState(isScanning=");
v0_1.append(this.a);
v0_1.append(", scannedDevices=");
v0_1.append(this.b);
v0_1.append(", enabledFilter=");
v0_1.append(this.c);
v0_1.append(", selectedAddresses=");
v0_1.append(this.d);
v0_1.append(", firmwareFileName=");
v0_1.append(this.e);
v0_1.append(", firmwareTotalBytes=");
v0_1.append(this.f);
v0_1.append(", firmwareCrc=");
v0_1.append(this.g);
v0_1.append(", commands=");
v0_1.append(this.h);
v0_1.append(", uploadConfig=");
v0_1.append(this.i);
v0_1.append(", maxConcurrent=");
v0_1.append(this.j);
v0_1.append(")");
return v0_1.toString();
}
}
+13
View File
@@ -0,0 +1,13 @@
package z7;
public final class f0 {
public qbsg.top.ble.RawGattHandle a;
public final kotlinx.coroutines.channels.Channel b;
public final kotlinx.coroutines.channels.Channel c;
public f0()
{
this.b = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.c = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
return;
}
}
+21
View File
@@ -0,0 +1,21 @@
package z7;
public final class i0 {
public qbsg.top.ble.RawGattHandle a;
public final kotlinx.coroutines.channels.Channel b;
public final kotlinx.coroutines.channels.Channel c;
public final kotlinx.coroutines.channels.Channel d;
public final kotlinx.coroutines.channels.Channel e;
public final kotlinx.coroutines.channels.Channel f;
public final kotlinx.coroutines.channels.Channel g;
public i0()
{
this.b = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.c = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.d = kotlinx.coroutines.channels.ChannelKt.Channel$default(2147483647, 0, 0, 6, 0);
this.e = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.f = kotlinx.coroutines.channels.ChannelKt.Channel$default(1, 0, 0, 6, 0);
this.g = kotlinx.coroutines.channels.ChannelKt.Channel$default(2147483647, 0, 0, 6, 0);
return;
}
}
+51
View File
@@ -0,0 +1,51 @@
package z7;
public final class j0 {
public final String a;
public final String b;
public final int c;
public j0(String p2, String p3, int p4)
{
kotlin.jvm.internal.s.f(p2, "address");
kotlin.jvm.internal.s.f(p3, "name");
this.a = p2;
this.b = p3;
this.c = p4;
return;
}
public final boolean equals(Object p5)
{
if (this != p5) {
if ((p5 instanceof z7.j0)) {
if (kotlin.jvm.internal.s.b(this.a, ((z7.j0) p5).a)) {
if (kotlin.jvm.internal.s.b(this.b, ((z7.j0) p5).b)) {
if (this.c == ((z7.j0) p5).c) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
} else {
return 1;
}
}
public final int hashCode()
{
return (Integer.hashCode(this.c) + p.p1.c(this.b, (this.a.hashCode() * 31), 31));
}
public final String toString()
{
return p.p1.l(a1.a.t("SuotaScannedDevice(address=", this.a, ", name=", this.b, ", rssi="), this.c, ")");
}
}
+46
View File
@@ -0,0 +1,46 @@
package z7;
public abstract class k0 {
public static final byte[] a;
public static final Object b;
static k0()
{
p6.g v1_0 = new byte[2];
v1_0 = {1, 0};
z7.k0.a = v1_0;
p6.g v1_4 = new p6.g(Integer.valueOf(2), "\u64cd\u4f5c\u6210\u529f");
new p6.g(Integer.valueOf(3), "\u5f3a\u5236\u9000\u51faSPOTA\u670d\u52a1");
new p6.g(Integer.valueOf(4), "Patch Data CRC\u6821\u9a8c\u5931\u8d25");
new p6.g(Integer.valueOf(5), "\u63a5\u6536\u957f\u5ea6\u4e0ePATCH_LEN\u4e0d\u7b26");
new p6.g(Integer.valueOf(6), "\u5916\u90e8\u5b58\u50a8\u5668\u5199\u5165\u5931\u8d25");
new p6.g(Integer.valueOf(7), "\u5185\u90e8\u5b58\u50a8\u7a7a\u95f4\u4e0d\u8db3");
new p6.g(Integer.valueOf(8), "\u65e0\u6548\u7684\u5b58\u50a8\u5668\u8bbe\u5907\u7c7b\u578b");
new p6.g(Integer.valueOf(9), "\u5e94\u7528\u5c42\u9519\u8bef");
new p6.g(Integer.valueOf(17), "\u65e0\u6548\u955c\u50cfBank");
new p6.g(Integer.valueOf(18), "\u65e0\u6548\u955c\u50cf\u5934\u90e8");
new p6.g(Integer.valueOf(19), "\u65e0\u6548\u955c\u50cf\u5927\u5c0f");
new p6.g(Integer.valueOf(20), "\u65e0\u6548\u4ea7\u54c1\u5934\u90e8");
new p6.g(Integer.valueOf(21), "\u76f8\u540c\u955c\u50cf\u9519\u8bef");
new p6.g(Integer.valueOf(22), "\u5916\u90e8\u5b58\u50a8\u5668\u8bfb\u53d6\u5931\u8d25");
p6.g v16_1 = v1_4;
new p6.g(Integer.valueOf(65535), "\u901a\u4fe1\u9519\u8bef");
z7.k0.b = q6.y.F(new p6.g[] {v16_1, new p6.g(Integer.valueOf(65534), "\u8bbe\u5907\u4e0d\u652f\u6301SUOTA")}));
return;
}
public static final String a(int p2)
{
String v0_6 = ((String) z7.k0.b.get(Integer.valueOf(p2)));
if (v0_6 == null) {
c7.a.l(16);
String v2_1 = Integer.toString(p2, 16);
kotlin.jvm.internal.s.e(v2_1, "toString(...)");
String v2_2 = v2_1.toUpperCase(java.util.Locale.ROOT);
kotlin.jvm.internal.s.e(v2_2, "toUpperCase(...)");
return h8.c.b("\u672a\u77e5\u72b6\u6001(0x%s)", new Object[] {v2_2}));
} else {
String v2_6 = new Object[0];
return h8.c.b(v0_6, v2_6);
}
}
}
+28
View File
@@ -0,0 +1,28 @@
package z7;
public final class o0 {
public final boolean equals(Object p2)
{
if (this != p2) {
if ((p2 instanceof z7.o0)) {
return 1;
} else {
return 0;
}
} else {
return 1;
}
}
public final int hashCode()
{
int v0_0 = 3;
int v2 = 31;
return (Integer.hashCode(80) + a1.a.c(2, a1.a.c(v0_0, a1.a.c(0, a1.a.c(v0_0, a1.a.c(6, a1.a.c(5, a1.a.c(0, (Integer.hashCode(3) * 31), 31), 31), 31), v2), v2), v2), 31));
}
public final String toString()
{
return "UploadConfig(memoryType=3, imageBank=0, misoGpio=5, mosiGpio=6, csGpio=3, sckGpio=0, sdaGpio=3, sclGpio=2, i2cAddress=80)";
}
}
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -3,3 +3,5 @@ bleak==3.0.2
capstone==5.0.9 capstone==5.0.9
pillow==12.3.0 pillow==12.3.0
pytest==9.1.1 pytest==9.1.1
pytest-asyncio==1.4.0
qrcode==8.2
+250
View File
@@ -0,0 +1,250 @@
"""ppclock CLI — 离线、agent 友好(--json 机器可读输出)。"""
from __future__ import annotations
import argparse
import asyncio
import datetime
import json
import sys
from . import commands as C
from . import image_pipeline as IP
from . import protocol as P
EXIT_OK = 0
EXIT_USAGE = 1
EXIT_TRANSPORT = 2
EXIT_ERROR = 3
def _emit(args, cmd, data=None, error=None):
if args.json:
out = {"ok": error is None, "cmd": cmd}
if data is not None:
out["data"] = data
if error is not None:
out["error"] = error
print(json.dumps(out, ensure_ascii=False))
else:
if error is not None:
print(f"错误: {error}", file=sys.stderr)
elif data is not None:
if isinstance(data, (dict, list)):
print(json.dumps(data, ensure_ascii=False, indent=2))
else:
print(data)
else:
print("OK")
def _make_transport(args):
"""工厂函数——测试用 monkeypatch 替换为 FakeTransport。"""
from .transport import BLETransport
return BLETransport(address=args.mac, timeout=args.timeout)
async def _run_with_transport(args, fn):
async with _make_transport(args) as t:
return await fn(t)
def _need_image(args):
from PIL import Image
img = Image.open(args.path)
size = tuple(int(v) for v in args.size.split("x")) if args.size else (400, 300)
bw, red = IP.process_image(
img, size=size, algorithm=args.algo, tricolor=not args.mono,
threshold=args.threshold, diffusion=args.diffusion / 100,
brightness=args.brightness, contrast=args.contrast,
saturation=args.saturation, rotate=args.rotate,
)
small = len(bw) in (3500, 9000)
return bw, red, small
async def _cmd_image(args, t):
bw, red, small = _need_image(args)
await C.upload_image(t, bw, red, small=small, slot=args.slot,
block_delay=args.block_delay)
return {"bytes_bw": len(bw), "bytes_red": len(red) if red else 0,
"small": small, "slot": args.slot}
async def _cmd_template(args, t):
from .templates import render_template
payload = json.loads(args.data) if args.data else {}
img = render_template(args.name, payload)
bw, red = IP.process_image(img, size=(400, 300), algorithm=args.algo,
tricolor=not args.mono)
await C.upload_image(t, bw, red, small=False, slot=args.slot,
block_delay=args.block_delay)
return {"template": args.name, "slot": args.slot}
def build_parser() -> argparse.ArgumentParser:
p = argparse.ArgumentParser(prog="ppclock", description="4.2寸墨水屏离线 CLI 上位机")
p.add_argument("--mac", help="设备 MAC(省略则自动扫描 NRF- 前缀设备)")
p.add_argument("--timeout", type=float, default=10.0)
p.add_argument("--json", action="store_true", help="机器可读 JSON 输出")
sub = p.add_subparsers(dest="cmd", required=True)
sub.add_parser("scan", help="扫描设备")
sp = sub.add_parser("time", help="对时(默认当前本地时间)")
sp.add_argument("datetime", nargs="?", help="ISO8601,如 2026-07-24T15:30:00")
sp = sub.add_parser("mode", help="显示模式")
sp.add_argument("name", choices=sorted(P.MODES))
sp = sub.add_parser("toggle", help="切换类命令")
sp.add_argument("name", choices=["invert", "font", "rotate180", "hour_format", "clock_color"])
sub.add_parser("clear", help="刷屏(EPD 通道)")
sp = sub.add_parser("image", help="传图")
sp.add_argument("path")
sp.add_argument("--slot", type=int, choices=[0, 1, 2, 3])
sp.add_argument("--algo", default="atkinson", choices=IP.ALGORITHMS)
sp.add_argument("--mono", action="store_true", help="黑白模式(不发红平面)")
sp.add_argument("--threshold", type=int, default=125)
sp.add_argument("--diffusion", type=int, default=100, help="0–100")
sp.add_argument("--brightness", type=int, default=0)
sp.add_argument("--contrast", type=int, default=0)
sp.add_argument("--saturation", type=int, default=100)
sp.add_argument("--rotate", type=int, default=0, choices=[0, 90, 180, 270])
sp.add_argument("--size", help="WxH,默认 400x300")
sp.add_argument("--block-delay", type=float, default=0.0)
sp = sub.add_parser("template", help="本地模板渲染并上传")
sp.add_argument("name", choices=["schedule", "businesscard", "memo", "course", "qrcode", "custom"])
sp.add_argument("--data", help="模板参数 JSON")
sp.add_argument("--slot", type=int, choices=[0, 1, 2, 3])
sp.add_argument("--algo", default="atkinson", choices=IP.ALGORITHMS)
sp.add_argument("--mono", action="store_true")
sp.add_argument("--block-delay", type=float, default=0.0)
sp = sub.add_parser("countdown", help="倒计时")
sp.add_argument("date", nargs="?", help="YYYY-MM-DD")
sp.add_argument("--mode", default="clock", choices=["clock", "calendar"])
sp.add_argument("--off", action="store_true")
sp = sub.add_parser("sleep", help="休眠时段")
sp.add_argument("--on", action="store_true")
sp.add_argument("--off", action="store_true")
sp.add_argument("--start", type=int, default=0)
sp.add_argument("--end", type=int, default=0)
sp = sub.add_parser("parking", help="停车牌号码")
sp.add_argument("number")
sp = sub.add_parser("rotation", help="轮播设置")
sp.add_argument("--count", type=int, choices=[1, 2, 3, 4])
sp.add_argument("--interval", type=int)
sp.add_argument("--unit", default="min", choices=["min", "hour"])
sp = sub.add_parser("lut", help="LUT 校准(0x01-0f 红,0x10-f0 黑)")
sp.add_argument("value", type=lambda v: int(v, 0))
sp = sub.add_parser("activate", help="激活")
sp.add_argument("code", nargs="?", help="激活码 hex")
sp.add_argument("--show-id", action="store_true", help="仅读取设备 ID")
sp = sub.add_parser("wifi", help="WiFi 配置")
sp.add_argument("ssid")
sp.add_argument("password")
sp.add_argument("--city", default="")
sp = sub.add_parser("raw", help="高级命令:直发 hex")
sp.add_argument("hex")
sp.add_argument("--channel", default="rxtx", choices=["rxtx", "epd"])
sp.add_argument("--no-response", action="store_true")
return p
async def _dispatch(args) -> dict | None:
if args.cmd == "scan":
from .transport import scan
return {"devices": await scan(timeout=args.timeout)}
async def body(t):
c = args.cmd
if c == "time":
dt = (datetime.datetime.fromisoformat(args.datetime)
if args.datetime else None)
await C.set_time(t, dt)
return {"set": (dt or datetime.datetime.now()).isoformat()}
if c == "mode":
await C.set_mode(t, args.name)
return {"mode": args.name}
if c == "toggle":
await C.toggle(t, args.name)
return {"toggle": args.name}
if c == "clear":
await C.clear(t)
return None
if c == "image":
return await _cmd_image(args, t)
if c == "template":
return await _cmd_template(args, t)
if c == "countdown":
if args.off:
await C.countdown_off(t)
return {"countdown": "off"}
if not args.date:
raise ValueError("缺少日期(YYYY-MM-DD)或 --off")
d = datetime.date.fromisoformat(args.date)
await C.countdown_set(t, d, args.mode)
return {"date": d.isoformat(), "mode": args.mode}
if c == "sleep":
on = args.on or not args.off
await C.sleep(t, on, args.start, args.end)
return {"on": on, "start": args.start, "end": args.end}
if c == "parking":
await C.parking(t, args.number)
return {"number": args.number}
if c == "rotation":
await C.rotation(t, count=args.count, interval=args.interval, unit=args.unit)
return {"count": args.count, "interval": args.interval, "unit": args.unit}
if c == "lut":
await C.lut(t, args.value)
return {"lut": hex(args.value)}
if c == "activate":
if args.show_id:
return {"device_id": await C.get_device_id(t)}
if not args.code:
raise ValueError("缺少激活码或 --show-id")
await C.activate(t, args.code)
return None
if c == "wifi":
await C.wifi(t, args.ssid, args.password, args.city)
return None
if c == "raw":
data = bytes.fromhex(args.hex)
if args.channel == "epd":
await t.write_epd(data, response=not args.no_response)
else:
await t.write_rxtx(data, response=not args.no_response)
return {"sent": len(data)}
raise ValueError(f"未知命令 {c}")
return await _run_with_transport(args, body)
def main(argv=None) -> int:
args = build_parser().parse_args(argv)
try:
data = asyncio.run(_dispatch(args))
except ValueError as e:
_emit(args, args.cmd, error=str(e))
return EXIT_USAGE
except Exception as e:
from .transport import TransportError
code = EXIT_TRANSPORT if isinstance(e, TransportError) else EXIT_ERROR
_emit(args, args.cmd, error=f"{type(e).__name__}: {e}")
return code
_emit(args, args.cmd, data=data)
return EXIT_OK
if __name__ == "__main__":
sys.exit(main())
+106
View File
@@ -0,0 +1,106 @@
"""高层命令:帧序列编排。协议规范 docs/protocol.md。"""
from __future__ import annotations
import datetime
from . import protocol as P
async def set_time(t, dt: datetime.datetime | None = None):
dt = dt or datetime.datetime.now()
await t.write_rxtx(P.build_set_time(dt))
await t.delay(0.3)
await t.write_rxtx(P.simple_command("commit"))
async def set_mode(t, mode: str):
"""模式切换:setri 语义——命令后 300ms 补 e2(ble.js:3956-3962)。"""
await t.write_rxtx(P.mode_frame(mode))
await t.delay(0.3)
await t.write_rxtx(P.simple_command("commit"))
async def toggle(t, name: str):
"""单字节切换类命令(invert/font/rotate180/hour_format/clock_color),补 e2。"""
await t.write_rxtx(P.simple_command(name))
await t.delay(0.3)
await t.write_rxtx(P.simple_command("commit"))
async def clear(t, param: int = 0x00):
for frame in P.clear_frames(param):
await t.write_epd(frame)
async def upload_image(t, bw: bytes, red: bytes | None, *, small: bool,
slot: int | None = None, block_delay: float = 0.0):
"""传图:可选槽位选择 → bw 平面块 → 红平面块 → 300ms → 01/AA。"""
if slot is not None:
await t.write_rxtx(P.slot_select_frame(slot))
await t.delay(0.3)
for frame in P.image_blocks(bw, small=small, red=False):
await t.write_epd(frame)
if block_delay:
await t.delay(block_delay)
if red is not None:
for frame in P.image_blocks(red, small=small, red=True):
await t.write_epd(frame)
if block_delay:
await t.delay(block_delay)
await t.delay(0.3)
await t.write_epd(P.end_frame(small=small))
async def countdown_set(t, d: datetime.date, mode: str):
await t.write_rxtx(P.countdown_date_frame(d, mode))
await t.delay(1.0)
await t.write_rxtx(P.simple_command("commit"))
async def countdown_off(t):
for frame in P.countdown_off_frames():
await t.write_rxtx(frame)
await t.delay(1.0)
async def parking(t, number: str):
await t.write_rxtx(P.parking_frame(number))
await t.delay(0.5)
await t.write_rxtx(P.simple_command("commit"))
async def sleep(t, on: bool, start_h: int, end_h: int):
await t.write_rxtx(P.sleep_frame(on, start_h, end_h))
async def rotation(t, count: int | None = None, interval: int | None = None,
unit: str = "min"):
if count is not None:
await t.write_rxtx(P.rotation_count_frame(count))
if interval is not None:
await t.write_rxtx(P.rotation_interval_frame(interval, unit))
async def activate(t, code_hex: str):
await t.write_rxtx(P.activation_frame(code_hex))
await t.delay(0.4)
await t.write_rxtx(P.simple_command("commit"))
async def get_device_id(t) -> str:
return await t.request_device_id()
async def wifi(t, ssid: str, password: str, city: str = ""):
await t.write_rxtx(P.wifi_frame(ssid, password, city))
async def lut(t, value: int):
await t.write_rxtx(P.lut_frame(value))
async def raw(t, data: bytes, channel: str = "rxtx"):
if channel == "epd":
await t.write_epd(data)
else:
await t.write_rxtx(data)
+164
View File
@@ -0,0 +1,164 @@
"""图像管线:调整 → 抖动量化 → 1bpp 平面打包。
算法与参数证据:analysis/web/timedjs.js(见 docs/protocol.md §5)。
所有实现与 Web 端 JS 语义对齐:同样的灰度系数、误差核、BCD 无 —— 像素级等价为目标。
"""
from __future__ import annotations
from PIL import Image
GRAY = (0.299, 0.587, 0.114)
BAYER4 = (
(15, 135, 45, 165),
(195, 75, 225, 105),
(60, 180, 30, 150),
(240, 120, 210, 90),
)
# 误差扩散核:(dx, dy, 权重分子);除数见 _KERNELS 键名
_KERNELS = {
"floydsteinberg": ([(1, 0, 7), (-1, 1, 3), (0, 1, 5), (1, 1, 1)], 16),
"atkinson": (
[(1, 0, 1), (2, 0, 1), (-1, 1, 1), (0, 1, 1), (1, 1, 1), (0, 2, 1)],
8,
),
"stucki": (
[
(1, 0, 8), (2, 0, 4),
(-2, 1, 2), (-1, 1, 4), (0, 1, 8), (1, 1, 4), (2, 1, 2),
(-2, 2, 1), (-1, 2, 2), (0, 2, 4), (1, 2, 2), (2, 2, 1),
],
42,
),
"jarvis": (
[
(1, 0, 7), (2, 0, 5),
(-2, 1, 3), (-1, 1, 5), (0, 1, 7), (1, 1, 5), (2, 1, 3),
(-2, 2, 1), (-1, 2, 3), (0, 2, 5), (1, 2, 3), (2, 2, 1),
],
48,
),
}
ALGORITHMS = ["none", "floydsteinberg", "atkinson", "bayer", "stucki", "jarvis"]
def _clamp(v: float) -> int:
return 0 if v < 0 else (255 if v > 255 else round(v))
def _gray_of(r: float, g: float, b: float) -> float:
return GRAY[0] * r + GRAY[1] * g + GRAY[2] * b
def adjust_pixels(pixels, brightness=0, contrast=0, saturation=100):
"""JS applyImageAdjustments 语义(timedjs.js:1-41)。
brightness: ±100 → v±255*b/100;contrast: ±100 → v*f+(1-f)*128, f=(c+100)/100;
saturation: 0–100+ → gray+(v-gray)*s/100。"""
out = []
bf = 255 * brightness / 100
cf = (contrast + 100) / 100
ca = (1 - cf) * 128
sf = saturation / 100
for r, g, b in pixels:
if brightness:
r, g, b = r + bf, g + bf, b + bf
if contrast:
r, g, b = r * cf + ca, g * cf + ca, b * cf + ca
if saturation != 100:
gray = _gray_of(r, g, b)
r, g, b = (gray + (v - gray) * sf for v in (r, g, b))
out.append((_clamp(r), _clamp(g), _clamp(b)))
return out
def _is_red(r, g, b, threshold):
return r > g * 1.5 and r > b * 1.5 and r > threshold
def dither_pixels(pixels, width, height, algorithm, threshold=125,
diffusion=1.0, tricolor=False):
"""量化到黑/白(+红)。返回与输入等长的 (r,g,b) 列表。
与 JS 一致:红判定优先且红像素不扩散误差;误差按通道扩散;写入即截断取整。"""
if algorithm not in ALGORITHMS:
raise ValueError(f"未知抖动算法 {algorithm!r},可选:{ALGORITHMS}")
buf = [[float(r), float(g), float(b)] for r, g, b in pixels]
out = [(0, 0, 0)] * (width * height)
def quantize(i, x, y):
r, g, b = buf[i]
if tricolor and _is_red(r, g, b, threshold):
out[i] = (255, 0, 0)
return None # 红像素无误差扩散
gray = _gray_of(r, g, b)
if algorithm == "bayer":
limit = BAYER4[y % 4][x % 4]
else:
limit = threshold
new = 0 if gray < limit else 255
out[i] = (new, new, new)
return (r - new) * diffusion, (g - new) * diffusion, (b - new) * diffusion
if algorithm in ("none", "bayer"):
for y in range(height):
for x in range(width):
quantize(y * width + x, x, y)
return out
kernel, div = _KERNELS[algorithm]
for y in range(height):
for x in range(width):
i = y * width + x
errs = quantize(i, x, y)
if errs is None:
continue
er, eg, eb = errs
for dx, dy, w in kernel:
nx, ny = x + dx, y + dy
if 0 <= nx < width and ny < height:
ni = ny * width + nx
# JS:写入 Uint8ClampedArray 即截断取整(round)
buf[ni][0] = _clamp(buf[ni][0] + er * w / div)
buf[ni][1] = _clamp(buf[ni][1] + eg * w / div)
buf[ni][2] = _clamp(buf[ni][2] + eb * w / div)
return out
def pack_plane(pixels, plane):
"""(r,g,b) 列表 → 1bpp MSB-first 字节流。
bw: R,G,B 全>0 → 1;red: R>0 且 G=0 且 B=0 → 1(timedjs.js:564-584)。"""
if len(pixels) % 8:
raise ValueError("像素数必须是 8 的倍数")
out = bytearray()
acc = 0
nbits = 0
for r, g, b in pixels:
if plane == "bw":
bit = 1 if (r > 0 and g > 0 and b > 0) else 0
elif plane == "red":
bit = 1 if (r > 0 and g == 0 and b == 0) else 0
else:
raise ValueError("plane 必须是 bw 或 red")
acc = (acc << 1) | bit
nbits += 1
if nbits == 8:
out.append(acc)
acc = 0
nbits = 0
return bytes(out)
def process_image(img: Image.Image, *, size=(400, 300), algorithm="atkinson",
tricolor=True, threshold=125, diffusion=1.0,
brightness=0, contrast=0, saturation=100, rotate=0):
"""完整管线:缩放/旋转 → 调整 → 抖动 → 打包。返回 (bw_bytes, red_bytes|None)。"""
img = img.convert("RGB").resize(size, Image.LANCZOS)
if rotate:
img = img.rotate(-rotate, expand=False) # 与 JS 顺时针旋转语义一致
w, h = size
px = list(img.getdata())
px = adjust_pixels(px, brightness, contrast, saturation)
px = dither_pixels(px, w, h, algorithm, threshold, diffusion, tricolor)
bw = pack_plane(px, "bw")
red = pack_plane(px, "red") if tricolor else None
return bw, red
+194
View File
@@ -0,0 +1,194 @@
"""本地模板渲染(替代 Web 端 canvas 渲染,离线可用)。
渲染产物为 400x300 RGB 图,红字用纯红 (255,0,0),经 image_pipeline 三色量化上屏。
模板集与 Web 端对齐:schedule/businesscard/memo/course/qrcode/custom(moban.js)。
"""
from __future__ import annotations
import datetime
from PIL import Image, ImageDraw, ImageFont
W, H = 400, 300
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
_FONT_CANDIDATES = [
"/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
"/usr/share/fonts/truetype/noto/NotoSansCJK-Regular.ttc",
]
_cache: dict[int, ImageFont.FreeTypeFont] = {}
def _font(size: int) -> ImageFont.FreeTypeFont:
if size not in _cache:
for path in _FONT_CANDIDATES:
try:
_cache[size] = ImageFont.truetype(path, size)
break
except OSError:
continue
else:
_cache[size] = ImageFont.load_default()
return _cache[size]
def _canvas() -> tuple[Image.Image, ImageDraw.ImageDraw]:
img = Image.new("RGB", (W, H), WHITE)
return img, ImageDraw.Draw(img)
def _wrap_cjk(text: str, max_units: float) -> list[str]:
"""按显示宽度断行:中文=1 单位,其他=0.5(与 moban.js 自定义文本一致)。"""
lines, cur, width = [], "", 0.0
for ch in text:
u = 1.0 if ord(ch) > 0x2E7F else 0.5
if ch == "\n" or width + u > max_units:
lines.append(cur)
cur, width = "", 0.0
if ch == "\n":
continue
cur += ch
width += u
lines.append(cur)
return lines
def _draw_colored(draw: ImageDraw.ImageDraw, xy, text: str, size: int):
"""绘制含 【…】 红字段落的单行文本。返回结束 x。"""
x, y = xy
segs, cur, red = [], "", False
for ch in text:
if ch == "【":
segs.append((cur, red)); cur, red = "", True
elif ch == "】":
segs.append((cur, red)); cur, red = "", False
else:
cur += ch
segs.append((cur, red))
for seg, is_red in segs:
if not seg:
continue
draw.text((x, y), seg, font=_font(size), fill=RED if is_red else BLACK)
x += draw.textlength(seg, font=_font(size))
return x
def render_schedule(p: dict) -> Image.Image:
"""日程:{"date": "2026-07-24"(可省), "items": [["09:00","晨会【重要】"],...]}"""
img, d = _canvas()
date = p.get("date") or datetime.date.today().isoformat()
d.rectangle([0, 0, W, 46], fill=BLACK)
d.text((16, 10), f"日程 {date}", font=_font(24), fill=WHITE)
y = 58
for time_s, event in p.get("items", [])[:8]:
d.text((16, y), time_s, font=_font(20), fill=BLACK)
_draw_colored(d, (110, y), event, 20)
d.line([(16, y + 30), (W - 16, y + 30)], fill=BLACK, width=1)
y += 30
return img
def render_businesscard(p: dict) -> Image.Image:
"""名片:{"name","title","company","phone","email"}"""
img, d = _canvas()
d.rectangle([0, 0, W, H], outline=BLACK, width=3)
d.text((24, 30), p.get("name", ""), font=_font(40), fill=BLACK)
d.text((24, 86), p.get("title", ""), font=_font(20), fill=RED)
d.text((24, 116), p.get("company", ""), font=_font(20), fill=BLACK)
d.line([(24, 150), (W - 24, 150)], fill=BLACK, width=2)
y = 164
for label, key in (("电话", "phone"), ("邮箱", "email"), ("地址", "addr")):
if p.get(key):
d.text((24, y), f"{label}:{p[key]}", font=_font(18), fill=BLACK)
y += 28
return img
def render_memo(p: dict) -> Image.Image:
"""备忘录:{"title": "...", "lines": ["...", ...]}"""
img, d = _canvas()
d.rectangle([0, 0, W, 44], fill=BLACK)
d.text((16, 8), p.get("title", "备忘录"), font=_font(24), fill=WHITE)
y = 56
for line in p.get("lines", [])[:9]:
d.ellipse([16, y + 8, 24, y + 16], fill=BLACK)
_draw_colored(d, (32, y), line, 18)
y += 27
return img
def render_course(p: dict) -> Image.Image:
"""课程表:{"days": ["周一",...](≤7), "periods": 4(2–9),
"grid": [["数学","语文",...], ...] # grid[period][day]"""
days = p.get("days") or ["周一", "周二", "周三", "周四", "周五"]
periods = int(p.get("periods", 4))
grid = p.get("grid", [])
img, d = _canvas()
cols = len(days) + 1
cw, rh = W // cols, H // (periods + 1)
for i in range(cols + 1):
d.line([(i * cw, 0), (i * cw, H)], fill=BLACK)
for j in range(periods + 2):
d.line([(0, j * rh), (W, j * rh)], fill=BLACK)
for c, day in enumerate(days):
d.text((c * cw + cw // 2, rh // 2), day, font=_font(16),
fill=BLACK, anchor="mm")
for r in range(periods):
d.text((cw // 2, (r + 1) * rh + rh // 2), f"{r + 1}", font=_font(16),
fill=BLACK, anchor="mm")
for c in range(len(days)):
name = grid[r][c] if r < len(grid) and c < len(grid[r]) else ""
if name:
d.text(((c + 1) * cw + cw // 2, (r + 1) * rh + rh // 2),
name, font=_font(14), fill=BLACK, anchor="mm")
return img
def render_qrcode(p: dict) -> Image.Image:
"""二维码:{"content": "...", "caption": "..."}(纠错级 M,与 Web 端一致)"""
import qrcode
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_M, box_size=8, border=2)
qr.add_data(p.get("content", ""))
qr.make(fit=True)
qimg = qr.make_image(fill_color="black", back_color="white").convert("RGB")
side = min(qimg.width, 240)
qimg = qimg.resize((side, side), Image.NEAREST)
img, d = _canvas()
img.paste(qimg, ((W - side) // 2, (H - side) // 2 - 14))
caption = p.get("caption", "")
if caption:
d.text((W // 2, H - 34), caption, font=_font(20), fill=BLACK, anchor="mm")
return img
def render_custom(p: dict) -> Image.Image:
"""自定义文本:{"text": "支持【红字】与换行", "size": 24(可选)}"""
text = p.get("text", "")
size = int(p.get("size", 24))
img, d = _canvas()
y = 10
for line in _wrap_cjk(text, max_units=(W - 20) / size):
_draw_colored(d, (10, y), line, size)
y += int(size * 1.35)
if y > H - size:
break
return img
RENDERERS = {
"schedule": render_schedule,
"businesscard": render_businesscard,
"memo": render_memo,
"course": render_course,
"qrcode": render_qrcode,
"custom": render_custom,
}
def render_template(name: str, payload: dict) -> Image.Image:
try:
return RENDERERS[name](payload)
except KeyError:
raise ValueError(f"未知模板 {name!r},可选:{sorted(RENDERERS)}") from None
+91
View File
@@ -0,0 +1,91 @@
"""BLE 传输层(bleak 封装)。硬件相关,单测以 FakeTransport 替代。"""
from __future__ import annotations
import asyncio
from bleak import BleakClient, BleakScanner
from bleak.exc import BleakError
from . import protocol as P
class TransportError(Exception):
pass
async def scan(timeout: float = 5.0, name_prefix: str = P.DEVICE_NAME_PREFIX):
"""扫描设备,返回 [{name, address, rssi}]。"""
found = await BleakScanner.discover(timeout=timeout, return_adv=True)
out = []
for addr, (dev, adv) in found.items():
name = dev.name or adv.local_name or ""
if name.startswith(name_prefix):
out.append({"name": name, "address": dev.address, "rssi": adv.rssi})
return out
class BLETransport:
"""与 FakeTransport 同接口:write_epd/write_rxtx/request_device_id/delay。"""
def __init__(self, address: str | None = None, timeout: float = 10.0,
name_prefix: str = P.DEVICE_NAME_PREFIX):
self.address = address
self.timeout = timeout
self.name_prefix = name_prefix
self._client: BleakClient | None = None
self._id_buf = bytearray()
self._id_event = asyncio.Event()
async def __aenter__(self):
await self.connect()
return self
async def __aexit__(self, *exc):
await self.close()
async def connect(self):
if not self.address:
devices = await scan(timeout=self.timeout, name_prefix=self.name_prefix)
if not devices:
raise TransportError(f"未找到名称前缀 {self.name_prefix!r} 的设备")
self.address = devices[0]["address"]
self._client = BleakClient(self.address, timeout=self.timeout)
try:
await self._client.connect()
except BleakError as e:
raise TransportError(f"连接失败: {e}") from e
await self._client.start_notify(P.RXTX_CHAR_UUID, self._on_notify)
async def close(self):
if self._client and self._client.is_connected:
try:
await self._client.stop_notify(P.RXTX_CHAR_UUID)
finally:
await self._client.disconnect()
def _on_notify(self, _sender, data: bytearray):
self._id_buf.extend(data)
if len(self._id_buf) >= 14:
self._id_event.set()
async def write_epd(self, data: bytes, response: bool = True):
await self._client.write_gatt_char(P.EPD_CHAR_UUID, data, response=response)
async def write_rxtx(self, data: bytes, response: bool = True):
await self._client.write_gatt_char(P.RXTX_CHAR_UUID, data, response=response)
async def read_rxtx(self) -> bytes:
return bytes(await self._client.read_gatt_char(P.RXTX_CHAR_UUID))
async def request_device_id(self, timeout: float = 8.0) -> str:
self._id_buf.clear()
self._id_event.clear()
await self.write_rxtx(P.request_id_frame())
try:
await asyncio.wait_for(self._id_event.wait(), timeout)
except asyncio.TimeoutError as e:
raise TransportError("等待设备 ID 应答超时") from e
return P.parse_device_id(bytes(self._id_buf[:14]))
async def delay(self, seconds: float):
await asyncio.sleep(seconds)
+167
View File
@@ -0,0 +1,167 @@
"""CLI 测试 — monkeypatch 传输工厂,验证 JSON 输出与退出码。"""
import json
import pytest
from PIL import Image
from ppclock import cli
class FakeTransport:
instances = []
def __init__(self, address=None, timeout=10.0):
self.epd_writes = []
self.rxtx_writes = []
self.address = address
FakeTransport.instances.append(self)
async def __aenter__(self):
return self
async def __aexit__(self, *exc):
return False
async def write_epd(self, data, response=True):
self.epd_writes.append(data)
async def write_rxtx(self, data, response=True):
self.rxtx_writes.append(data)
async def request_device_id(self, timeout=8.0):
return "DEVICE12345678"
async def delay(self, seconds):
pass
@pytest.fixture(autouse=True)
def fake_transport(monkeypatch):
FakeTransport.instances.clear()
monkeypatch.setattr(cli, "_make_transport", lambda args: FakeTransport(args.mac, args.timeout))
yield FakeTransport
def run_cli(capsys, argv):
code = cli.main(argv)
out = capsys.readouterr().out.strip()
return code, json.loads(out) if out.startswith("{") else out
class TestJsonContract:
def test_mode_json(self, capsys):
code, out = run_cli(capsys, ["--json", "mode", "clock1"])
assert code == 0
assert out["ok"] is True and out["cmd"] == "mode"
t = FakeTransport.instances[0]
assert t.rxtx_writes == [bytes.fromhex("e10201"), bytes([0xE2])]
def test_time_json(self, capsys):
code, out = run_cli(capsys, ["--json", "time", "2026-07-24T15:30:00"])
assert code == 0 and out["ok"]
t = FakeTransport.instances[0]
assert t.rxtx_writes[0][0] == 0xDD
assert t.rxtx_writes[-1] == bytes([0xE2])
def test_error_json_contract(self, capsys):
"""错误 schema:ok=false + error 字段,退出码 1"""
code, out = run_cli(capsys, ["--json", "countdown"])
assert code == 1
assert out["ok"] is False and "error" in out
def test_mac_passthrough(self, capsys):
run_cli(capsys, ["--json", "--mac", "AA:BB:CC:DD:EE:FF", "clear"])
assert FakeTransport.instances[0].address == "AA:BB:CC:DD:EE:FF"
class TestCommands:
def test_clear(self, capsys):
code, _ = run_cli(capsys, ["--json", "clear"])
assert code == 0
assert FakeTransport.instances[0].epd_writes[-1] == bytes([0x01])
def test_image_upload(self, capsys, tmp_path):
p = tmp_path / "white.png"
Image.new("RGB", (400, 300), (255, 255, 255)).save(p)
code, out = run_cli(capsys, ["--json", "image", str(p), "--mono"])
assert code == 0
t = FakeTransport.instances[0]
assert len(t.epd_writes) == 63 + 1
assert t.epd_writes[-1] == bytes([0x01])
assert out["data"]["bytes_bw"] == 15000
def test_image_slot_and_color(self, capsys, tmp_path):
p = tmp_path / "red.png"
Image.new("RGB", (400, 300), (255, 0, 0)).save(p)
code, out = run_cli(capsys, ["--json", "image", str(p), "--slot", "2"])
assert code == 0
t = FakeTransport.instances[0]
assert t.rxtx_writes[0] == bytes([0xEA, 0x02])
assert out["data"]["bytes_red"] == 15000
def test_countdown(self, capsys):
code, _ = run_cli(capsys, ["--json", "countdown", "2026-12-31"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0] == bytes(
[0xFF, 0x00, 0x20, 0x26, 0x12, 0x31])
def test_countdown_off(self, capsys):
code, _ = run_cli(capsys, ["--json", "countdown", "--off"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0] == bytes([0xFA])
def test_parking(self, capsys):
code, _ = run_cli(capsys, ["--json", "parking", "12"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0] == bytes([0xEF, 0x11, 0x22])
def test_sleep(self, capsys):
code, _ = run_cli(capsys, ["--json", "sleep", "--on", "--start", "23", "--end", "7"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0] == bytes([0xFB, 0x01, 0x23, 0x07])
def test_rotation(self, capsys):
code, _ = run_cli(capsys, ["--json", "rotation", "--count", "4"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0] == bytes.fromhex("EA0003")
def test_lut(self, capsys):
code, _ = run_cli(capsys, ["--json", "lut", "0x05"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0] == bytes([0xE6, 0x05])
def test_activate_show_id(self, capsys):
code, out = run_cli(capsys, ["--json", "activate", "--show-id"])
assert code == 0
assert out["data"]["device_id"] == "DEVICE12345678"
def test_wifi(self, capsys):
code, _ = run_cli(capsys, ["--json", "wifi", "MyAP", "pw", "--city", "101010100"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes[0].startswith(b"WIFI_SSID:MyAP")
def test_raw(self, capsys):
code, _ = run_cli(capsys, ["--json", "raw", "e2"])
assert code == 0
assert FakeTransport.instances[0].rxtx_writes == [bytes([0xE2])]
def test_raw_epd_channel(self, capsys):
code, _ = run_cli(capsys, ["--json", "raw", "01", "--channel", "epd"])
assert code == 0
assert FakeTransport.instances[0].epd_writes == [bytes([0x01])]
def test_scan(self, capsys, monkeypatch):
import ppclock.transport as tr
async def fake_scan(timeout=5.0, name_prefix="NRF-"):
return [{"name": "NRF-TEST", "address": "AA:BB", "rssi": -50}]
monkeypatch.setattr(tr, "scan", fake_scan)
code, out = run_cli(capsys, ["--json", "scan"])
assert code == 0
assert out["data"]["devices"][0]["name"] == "NRF-TEST"
def test_template_custom(self, capsys):
code, out = run_cli(capsys, ["--json", "template", "custom",
"--data", '{"text": "你好"}'])
assert code == 0
t = FakeTransport.instances[0]
assert len(t.epd_writes) == 63 + 63 + 1 # 默认三色双平面
+138
View File
@@ -0,0 +1,138 @@
"""命令层测试 — 用 FakeTransport 验证高层操作的帧序列与顺序(证据 docs/protocol.md)。"""
import datetime
import pytest
from ppclock import commands as C
class FakeTransport:
def __init__(self, id_response="DEVICE12345678"):
self.epd_writes = []
self.rxtx_writes = []
self.id_response = id_response
self.delays = []
async def write_epd(self, data, response=True):
self.epd_writes.append(data)
async def write_rxtx(self, data, response=True):
self.rxtx_writes.append(data)
async def request_device_id(self, timeout=8.0):
self.rxtx_writes.append(bytes([0xEF, 0xEF]))
return self.id_response
async def delay(self, seconds):
self.delays.append(seconds)
@pytest.fixture
def t():
return FakeTransport()
class TestTimeAndMode:
@pytest.mark.asyncio
async def test_set_time_sends_dd_then_commit(self, t):
dt = datetime.datetime(2026, 7, 24, 15, 30, 0)
await C.set_time(t, dt)
assert t.rxtx_writes[0][0] == 0xDD
assert t.rxtx_writes[-1] == bytes([0xE2])
@pytest.mark.asyncio
async def test_set_mode_appends_commit(self, t):
await C.set_mode(t, "clock1")
assert t.rxtx_writes == [bytes.fromhex("e10201"), bytes([0xE2])]
@pytest.mark.asyncio
async def test_clear_uses_epd_channel(self, t):
await C.clear(t)
assert t.epd_writes == [bytes([0x00, 0x00]), bytes([0x01])]
assert t.rxtx_writes == []
class TestUploadImage:
@pytest.mark.asyncio
async def test_full_image_sequence(self, t):
"""整图:bw块×63 → 红块×63 → 延时 → 01"""
bw = bytes(15000)
red = bytes([0xFF]) * 15000
await C.upload_image(t, bw, red, small=False)
assert t.epd_writes[0][:4] == bytes([0x03, 0xFF, 0x00, 0x00])
assert t.epd_writes[63][:2] == bytes([0x03, 0x00]) # 红平面首块
assert t.epd_writes[-1] == bytes([0x01])
assert len(t.epd_writes) == 63 + 63 + 1
@pytest.mark.asyncio
async def test_mono_image_no_red_blocks(self, t):
await C.upload_image(t, bytes(15000), None, small=False)
assert len(t.epd_writes) == 63 + 1
@pytest.mark.asyncio
async def test_slot_select_before_upload(self, t):
await C.upload_image(t, bytes(15000), None, small=False, slot=2)
assert t.rxtx_writes[0] == bytes([0xEA, 0x02])
@pytest.mark.asyncio
async def test_small_image_ends_with_AA(self, t):
await C.upload_image(t, bytes(3500), None, small=True)
assert t.epd_writes[-1] == bytes([0xAA])
assert t.epd_writes[0][0] == 0x04
class TestOtherCommands:
@pytest.mark.asyncio
async def test_countdown_set(self, t):
d = datetime.date(2026, 12, 31)
await C.countdown_set(t, d, "clock")
assert t.rxtx_writes[0] == bytes([0xFF, 0x00, 0x20, 0x26, 0x12, 0x31])
assert t.rxtx_writes[-1] == bytes([0xE2])
@pytest.mark.asyncio
async def test_countdown_off(self, t):
await C.countdown_off(t)
assert t.rxtx_writes == [bytes([0xFA]), bytes([0xE2])]
@pytest.mark.asyncio
async def test_parking(self, t):
await C.parking(t, "13800138000")
assert t.rxtx_writes[0] == bytes([0xEF]) + bytes(
int(f"{d}{d}", 16) for d in "13800138000"
)
@pytest.mark.asyncio
async def test_sleep_on_off(self, t):
await C.sleep(t, True, 23, 7)
assert t.rxtx_writes[0] == bytes([0xFB, 0x01, 0x23, 0x07])
await C.sleep(t, False, 23, 7)
assert t.rxtx_writes[1] == bytes([0xFB, 0x00, 0x23, 0x07])
@pytest.mark.asyncio
async def test_rotation(self, t):
await C.rotation(t, count=4)
assert t.rxtx_writes[0] == bytes.fromhex("EA0003")
await C.rotation(t, interval=5, unit="min")
assert t.rxtx_writes[1] == bytes.fromhex("e9010501")
@pytest.mark.asyncio
async def test_activate(self, t):
await C.activate(t, "A1B2" * 8)
assert t.rxtx_writes[0] == bytes([0xEF]) + bytes.fromhex("A1B2" * 8)
assert t.rxtx_writes[-1] == bytes([0xE2])
@pytest.mark.asyncio
async def test_wifi(self, t):
await C.wifi(t, "MyAP", "pw", "101010100")
assert t.rxtx_writes[0] == b"WIFI_SSID:MyAP;WIFI_PASS:pw;CITY:101010100"
@pytest.mark.asyncio
async def test_lut(self, t):
await C.lut(t, 0x05)
assert t.rxtx_writes[0] == bytes([0xE6, 0x05])
@pytest.mark.asyncio
async def test_get_device_id(self, t):
dev_id = await C.get_device_id(t)
assert t.rxtx_writes[0] == bytes([0xEF, 0xEF])
assert dev_id == "DEVICE12345678"
+159
View File
@@ -0,0 +1,159 @@
"""图像管线测试 — 算法参数证据:analysis/web/timedjs.js(docs/protocol.md §5)。"""
import pytest
from PIL import Image
from ppclock import image_pipeline as IP
def make_img(w, h, pixels):
"""pixels: list[(r,g,b)] 长度 w*h,行主序。"""
img = Image.new("RGB", (w, h))
img.putdata(pixels)
return img
class TestPack:
def test_all_white_bw_plane(self):
px = [(255, 255, 255)] * 16
assert IP.pack_plane(px, "bw") == bytes([0xFF, 0xFF])
def test_all_black_bw_plane(self):
px = [(0, 0, 0)] * 16
assert IP.pack_plane(px, "bw") == bytes(2)
def test_msb_first_order(self):
"""首像素=bit7:仅(0,0)白→0x80;仅第8像素白→0x01;第9像素→第二字节0x80"""
px = [(255, 255, 255)] + [(0, 0, 0)] * 15
assert IP.pack_plane(px, "bw") == bytes([0x80, 0x00])
px = [(0, 0, 0)] * 7 + [(255, 255, 255)] + [(0, 0, 0)] * 8
assert IP.pack_plane(px, "bw") == bytes([0x01, 0x00])
px = [(0, 0, 0)] * 8 + [(255, 255, 255)] + [(0, 0, 0)] * 7
assert IP.pack_plane(px, "bw") == bytes([0x00, 0x80])
def test_red_pixel_planes(self):
"""红(255,0,0):bw 平面=0,红平面=1(timedjs.js:573-576,599-601)"""
px = [(255, 0, 0)] * 8
assert IP.pack_plane(px, "bw") == bytes([0x00])
assert IP.pack_plane(px, "red") == bytes([0xFF])
def test_partial_channels_count_as_white(self):
"""bw 规则:R,G,B 全>0 → 1;(1,1,1) 也是白"""
px = [(1, 1, 1)] * 8
assert IP.pack_plane(px, "bw") == bytes([0xFF])
def test_length_not_multiple_of_8_raises(self):
with pytest.raises(ValueError):
IP.pack_plane([(0, 0, 0)] * 7, "bw")
class TestDither:
def test_none_threshold(self):
"""none:gray<threshold→0 否则 255(timedjs.js:42-51)"""
px = [(100, 100, 100), (200, 200, 200)] * 4
out = IP.dither_pixels(px, 8, 1, "none", threshold=125)
assert out == [(0, 0, 0), (255, 255, 255)] * 4
def test_none_grayscale_coefficients(self):
"""灰度=0.299R+0.587G+0.114B:纯绿128 → gray=75.1 <125 → 黑"""
out = IP.dither_pixels([(0, 128, 0)] * 8, 8, 1, "none", threshold=125)
assert out == [(0, 0, 0)] * 8
def test_red_detected_before_quantize(self):
"""r>g*1.5 且 r>b*1.5 且 r>threshold → 纯红且不扩散误差"""
px = [(200, 50, 50)] * 8
out = IP.dither_pixels(px, 8, 1, "none", threshold=125, tricolor=True)
assert out == [(255, 0, 0)] * 8
def test_not_red_when_threshold_high(self):
px = [(200, 50, 50)] * 8
out = IP.dither_pixels(px, 8, 1, "none", threshold=250, tricolor=True)
# 200>250 假 → 走红判定失败 → 灰度 0.299*200+0.587*50+0.114*50=94.9 <250 → 黑
assert out == [(0, 0, 0)] * 8
def test_floyd_steinberg_error_propagation(self):
"""2x1 灰100:px0→黑 err=100*7/16=43.75 → px1=143.75→白(阈值125,扩散1.0)"""
px = [(100, 100, 100)] * 2
out = IP.dither_pixels(px, 2, 1, "floydsteinberg", threshold=125)
assert out[0] == (0, 0, 0)
assert out[1] == (255, 255, 255)
def test_diffusion_zero_behaves_like_none(self):
px = [(100, 100, 100)] * 2
out = IP.dither_pixels(px, 2, 1, "floydsteinberg", threshold=125, diffusion=0.0)
assert out == [(0, 0, 0)] * 2
def test_atkinson_kernel_smaller_error(self):
"""Atkinson 只扩散 6/8:px0 黑 err=100*1/8=12.5 → px1=112.5<125 仍黑"""
px = [(100, 100, 100)] * 2
out = IP.dither_pixels(px, 2, 1, "atkinson", threshold=125)
assert out == [(0, 0, 0), (0, 0, 0)]
def test_bayer_matrix_origin(self):
"""bayer (0,0) 阈值=15:灰10→黑,灰20→白(矩阵 timedjs.js:116-136)"""
out = IP.dither_pixels([(10, 10, 10)] * 8, 8, 1, "bayer", threshold=125)
assert out[0] == (0, 0, 0)
out = IP.dither_pixels([(20, 20, 20)] * 8, 8, 1, "bayer", threshold=125)
assert out[0] == (255, 255, 255)
def test_stucki_and_jarvis_run(self):
"""大核算法冒烟:全灰输入输出只有黑白"""
px = [(128, 128, 128)] * 64
for algo in ("stucki", "jarvis"):
out = IP.dither_pixels(px, 8, 8, algo, threshold=125)
assert set(out) <= {(0, 0, 0), (255, 255, 255)}
def test_unknown_algo_raises(self):
with pytest.raises(ValueError):
IP.dither_pixels([(0, 0, 0)] * 8, 8, 1, "magic")
class TestAdjust:
def test_brightness(self):
"""亮度+50 → v+=127.5(timedjs.js:9-17)"""
px = [(100, 100, 100)]
out = IP.adjust_pixels(px, brightness=50, contrast=0, saturation=100)
assert out == [(228, 228, 228)] # 100+127.5=227.5 → round=228
def test_contrast(self):
"""对比度+100 → factor=2, v=v*2-128(timedjs.js:18-27)"""
out = IP.adjust_pixels([(200, 50, 128)], brightness=0, contrast=100, saturation=100)
assert out == [(255, 0, 128)]
def test_saturation_desaturate(self):
"""饱和度35 → v=gray+(v-gray)*0.35(timedjs.js:28-38)"""
out = IP.adjust_pixels([(200, 50, 50)], brightness=0, contrast=0, saturation=35)
gray = 0.299 * 200 + 0.587 * 50 + 0.114 * 50
exp = round(gray + (200 - gray) * 0.35)
assert out[0][0] == exp
class TestProcess:
def test_full_size_output_lengths(self):
"""400x300 → bw 15000B;三色另有红平面 15000B"""
img = Image.new("RGB", (400, 300), (255, 255, 255))
bw, red = IP.process_image(img, size=(400, 300), algorithm="none", tricolor=True)
assert len(bw) == 15000
assert len(red) == 15000
assert bw == bytes([0xFF]) * 15000
assert red == bytes(15000)
def test_mono_has_no_red_plane(self):
img = Image.new("RGB", (400, 300), (0, 0, 0))
bw, red = IP.process_image(img, size=(400, 300), algorithm="none", tricolor=False)
assert len(bw) == 15000
assert red is None
def test_resize_to_fit(self):
img = Image.new("RGB", (800, 600), (255, 255, 255))
bw, _ = IP.process_image(img, size=(400, 300), algorithm="none", tricolor=False)
assert len(bw) == 15000
def test_rotate_180(self):
"""rotate=180:左上角白块移到右下"""
img = Image.new("RGB", (8, 8), (0, 0, 0))
for x in range(8):
img.putpixel((x, 0), (255, 255, 255))
bw, _ = IP.process_image(img, size=(8, 8), algorithm="none",
tricolor=False, rotate=180)
assert bw[0] == 0x00
assert bw[-1] == 0xFF
+34
View File
@@ -0,0 +1,34 @@
"""模板渲染测试。"""
import pytest
from ppclock import templates as T
@pytest.mark.parametrize("name", sorted(T.RENDERERS))
def test_all_templates_render_400x300(name):
payloads = {
"schedule": {"items": [["09:00", "晨会【重要】"]]},
"businesscard": {"name": "张三", "title": "工程师", "phone": "138"},
"memo": {"title": "购物", "lines": ["牛奶", "鸡蛋"]},
"course": {"grid": [["数学"]]},
"qrcode": {"content": "https://example.com", "caption": "扫码"},
"custom": {"text": "你好【世界】\n第二行"},
}
img = T.render_template(name, payloads[name])
assert img.size == (400, 300)
assert img.mode == "RGB"
def test_custom_wraps_long_text():
img = T.render_template("custom", {"text": "长" * 100})
assert img.size == (400, 300)
def test_red_segments_rendered_red():
img = T.render_template("custom", {"text": "【红】"})
assert (255, 0, 0) in set(img.getdata())
def test_unknown_template_raises():
with pytest.raises(ValueError):
T.render_template("nope", {})