239 lines
7.9 KiB
Java
239 lines
7.9 KiB
Java
package p000;
|
|
|
|
import java.util.Vector;
|
|
import javax.bluetooth.BluetoothStateException;
|
|
import javax.bluetooth.DeviceClass;
|
|
import javax.bluetooth.DiscoveryAgent;
|
|
import javax.bluetooth.DiscoveryListener;
|
|
import javax.bluetooth.LocalDevice;
|
|
import javax.bluetooth.RemoteDevice;
|
|
import javax.bluetooth.ServiceRecord;
|
|
import javax.bluetooth.UUID;
|
|
import javax.microedition.io.Connector;
|
|
|
|
/* renamed from: p */
|
|
/* loaded from: microcounterstrike.jar:p.class */
|
|
public final class BluetoothDiscoveryClient implements Runnable, DiscoveryListener {
|
|
|
|
/* renamed from: c */
|
|
private static BluetoothDiscoveryClient bluetoothDiscoveryClient224;
|
|
|
|
/* renamed from: d */
|
|
private DiscoveryAgent discoveryAgent225;
|
|
|
|
/* renamed from: e */
|
|
private UUID[] uUIDArr226;
|
|
|
|
/* renamed from: f */
|
|
private static final UUID CONST_UUID227 = new UUID("F0E0D0C0B0A000908070605040302010", false);
|
|
|
|
/* renamed from: g */
|
|
private int[] value228;
|
|
|
|
/* renamed from: h */
|
|
private Vector list229;
|
|
|
|
/* renamed from: a */
|
|
public Vector list230;
|
|
|
|
/* renamed from: i */
|
|
private int value231;
|
|
|
|
/* renamed from: j */
|
|
private int value232;
|
|
|
|
/* renamed from: b */
|
|
public BluetoothControlChannel bluetoothControlChannel233;
|
|
|
|
private BluetoothDiscoveryClient() {
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public static BluetoothDiscoveryClient getInstance() {
|
|
if (bluetoothDiscoveryClient224 == null) {
|
|
bluetoothDiscoveryClient224 = new BluetoothDiscoveryClient();
|
|
}
|
|
return bluetoothDiscoveryClient224;
|
|
}
|
|
|
|
/* renamed from: b */
|
|
public final void execute267() {
|
|
execute268();
|
|
this.value231 = 0;
|
|
new Thread(this).start();
|
|
}
|
|
|
|
/* renamed from: c */
|
|
private void execute268() {
|
|
this.list229 = new Vector();
|
|
this.list230 = new Vector();
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final void execute269(int i) {
|
|
this.value231 = 1;
|
|
this.value232 = i;
|
|
new Thread(this).start();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r0v20, types: [f] */
|
|
/* JADX WARN: Type inference failed for: r0v21 */
|
|
/* JADX WARN: Type inference failed for: r0v22, types: [java.lang.Throwable] */
|
|
/* JADX WARN: Type inference failed for: r0v27, types: [javax.bluetooth.UUID[]] */
|
|
/* JADX WARN: Type inference failed for: r0v28 */
|
|
/* JADX WARN: Type inference failed for: r0v29 */
|
|
/* JADX WARN: Type inference failed for: r0v30, types: [java.lang.Throwable] */
|
|
/* JADX WARN: Type inference failed for: r0v38 */
|
|
/* JADX WARN: Type inference failed for: r0v39, types: [java.lang.Throwable] */
|
|
/* JADX WARN: Type inference failed for: r0v4, types: [int] */
|
|
/* JADX WARN: Type inference failed for: r0v40, types: [java.lang.Object] */
|
|
/* JADX WARN: Type inference failed for: r0v47, types: [java.lang.Object] */
|
|
/* JADX WARN: Type inference failed for: r0v5 */
|
|
/* JADX WARN: Type inference failed for: r0v50, types: [boolean] */
|
|
/* JADX WARN: Type inference failed for: r0v52, types: [p] */
|
|
/* JADX WARN: Type inference failed for: r0v53 */
|
|
/* JADX WARN: Type inference failed for: r0v54 */
|
|
@Override // java.lang.Runnable
|
|
public final synchronized void run() throws InterruptedException {
|
|
?? r0;
|
|
?? r02;
|
|
MainUiCanvasBase abstractC0037fM227a = MainUiCanvasBase.getInstance();
|
|
if (this.value231 != 0) {
|
|
?? r03 = this.value231;
|
|
if (r03 == 1) {
|
|
try {
|
|
BluetoothControlChannel runnableC0022av = new BluetoothControlChannel(Connector.open(((ServiceRecord) this.list230.elementAt(this.value232)).getConnectionURL(0, false)));
|
|
runnableC0022av.execute137();
|
|
this.bluetoothControlChannel233 = runnableC0022av;
|
|
abstractC0037fM227a.value181 = 24;
|
|
r03 = abstractC0037fM227a;
|
|
r03.execute37();
|
|
return;
|
|
} catch (Exception e) {
|
|
if (r03 instanceof SecurityException) {
|
|
execute270();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
?? r04 = 0;
|
|
try {
|
|
r04 = this;
|
|
r04.discoveryAgent225 = LocalDevice.getLocalDevice().getDiscoveryAgent();
|
|
} catch (Exception e2) {
|
|
r04.printStackTrace();
|
|
}
|
|
this.uUIDArr226 = new UUID[2];
|
|
this.uUIDArr226[0] = new UUID(4353L);
|
|
?? StartInquiry = this.uUIDArr226;
|
|
StartInquiry[1] = CONST_UUID227;
|
|
try {
|
|
StartInquiry = this.discoveryAgent225.startInquiry(10390323, this);
|
|
r0 = StartInquiry;
|
|
} catch (BluetoothStateException unused) {
|
|
r0 = StartInquiry;
|
|
}
|
|
try {
|
|
r0 = this;
|
|
r0.wait();
|
|
} catch (InterruptedException e3) {
|
|
r0.printStackTrace();
|
|
}
|
|
if (this.list229.size() > 0) {
|
|
this.value228 = new int[this.list229.size()];
|
|
int i = 0;
|
|
while (true) {
|
|
r02 = i;
|
|
if (r02 >= this.list229.size()) {
|
|
try {
|
|
break;
|
|
} catch (InterruptedException e4) {
|
|
r02.printStackTrace();
|
|
}
|
|
} else {
|
|
try {
|
|
this.value228[i] = this.discoveryAgent225.searchServices((int[]) null, this.uUIDArr226, (RemoteDevice) this.list229.elementAt(i), this);
|
|
} catch (BluetoothStateException unused2) {
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
r02 = this;
|
|
r02.wait();
|
|
}
|
|
abstractC0037fM227a.value181 = 22;
|
|
abstractC0037fM227a.execute37();
|
|
}
|
|
|
|
/* renamed from: d */
|
|
private static void execute270() {
|
|
MainUiCanvasBase.getInstance().value181 = 14;
|
|
MainUiCanvasBase.getInstance().execute37();
|
|
}
|
|
|
|
public final void deviceDiscovered(RemoteDevice remoteDevice, DeviceClass deviceClass) {
|
|
if (this.list229.indexOf(remoteDevice) == -1) {
|
|
this.list229.addElement(remoteDevice);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r0v0 */
|
|
/* JADX WARN: Type inference failed for: r0v1, types: [java.lang.Throwable] */
|
|
/* JADX WARN: Type inference failed for: r0v3 */
|
|
public final void inquiryCompleted(int i) {
|
|
?? r0 = this;
|
|
synchronized (r0) {
|
|
notify();
|
|
r0 = r0;
|
|
}
|
|
}
|
|
|
|
public final void servicesDiscovered(int i, ServiceRecord[] serviceRecordArr) {
|
|
for (ServiceRecord serviceRecord : serviceRecordArr) {
|
|
this.list230.addElement(serviceRecord);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r0v6 */
|
|
/* JADX WARN: Type inference failed for: r0v7, types: [java.lang.Throwable] */
|
|
/* JADX WARN: Type inference failed for: r0v9 */
|
|
public final void serviceSearchCompleted(int i, int i2) {
|
|
int i3 = 0;
|
|
while (true) {
|
|
if (i3 >= this.value228.length) {
|
|
break;
|
|
}
|
|
if (this.value228[i3] == i) {
|
|
this.value228[i3] = -1;
|
|
break;
|
|
}
|
|
i3++;
|
|
}
|
|
boolean z = true;
|
|
int i4 = 0;
|
|
while (true) {
|
|
if (i4 >= this.value228.length) {
|
|
break;
|
|
}
|
|
if (this.value228[i4] != -1) {
|
|
z = false;
|
|
break;
|
|
}
|
|
i4++;
|
|
}
|
|
if (z) {
|
|
?? r0 = this;
|
|
synchronized (r0) {
|
|
notify();
|
|
r0 = r0;
|
|
}
|
|
}
|
|
}
|
|
}
|