feat(ppclock): 命令层/传输层/CLI/本地模板渲染,90 测试全绿
This commit is contained in:
1 parent
6f5b0c60be
commit
2b01e5f589
60 files changed
+16869
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user