192 lines
4.7 KiB
Java
192 lines
4.7 KiB
Java
package com.ubtrobot.jimu.robotapi;
|
|
|
|
import android.content.Context;
|
|
import com.ubtrobot.jimu.Firmware;
|
|
import com.ubtrobot.jimu.bluetooth.ConnectCallback;
|
|
import com.ubtrobot.jimu.bluetooth.ConnectionState;
|
|
import com.ubtrobot.jimu.bluetooth.ConnectionStateListener;
|
|
import com.ubtrobot.jimu.connection.RequestException;
|
|
import com.ubtrobot.jimu.connection.RobotConnection;
|
|
import com.ubtrobot.jimu.robotapi.UpdateManager;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class JimuManager {
|
|
private ServoManager a;
|
|
private MotorManager b;
|
|
private DeviceManager c;
|
|
private SensorManager d;
|
|
private UpdateManager e;
|
|
private GlobalManager f;
|
|
private RobotConnection g;
|
|
private String h;
|
|
|
|
public JimuManager(Context context) {
|
|
this.g = new RobotConnection(context);
|
|
this.a = new ServoManager(this.g);
|
|
this.b = new MotorManager(this.g);
|
|
new LedManager(this.g);
|
|
this.c = new DeviceManager(this.g);
|
|
this.d = new SensorManager(this.g);
|
|
this.e = new UpdateManager(context, this.g);
|
|
this.f = new GlobalManager(this.g, this.c);
|
|
}
|
|
|
|
public void a(String str, ConnectCallback connectCallback) {
|
|
this.g.a(str, connectCallback);
|
|
}
|
|
|
|
public void b(ConnectionStateListener connectionStateListener) {
|
|
this.g.b(connectionStateListener);
|
|
}
|
|
|
|
public void c() {
|
|
this.g.a();
|
|
}
|
|
|
|
public String d() {
|
|
return this.g.b();
|
|
}
|
|
|
|
public String e() {
|
|
return this.h;
|
|
}
|
|
|
|
public BatteryInfo f() {
|
|
return this.f.a();
|
|
}
|
|
|
|
public boolean g() {
|
|
String d = d();
|
|
return d != null && a(d) == ConnectionState.STATE_CONNECTED;
|
|
}
|
|
|
|
public boolean h() throws JimuException {
|
|
return this.c.a();
|
|
}
|
|
|
|
public void i() throws JimuException {
|
|
this.a.b();
|
|
}
|
|
|
|
public String j() throws JimuException {
|
|
return this.c.b();
|
|
}
|
|
|
|
public BatteryInfo k() throws JimuException {
|
|
return this.c.d();
|
|
}
|
|
|
|
public BoardInfo l() throws JimuException {
|
|
return this.c.e();
|
|
}
|
|
|
|
public String m() throws JimuException {
|
|
return this.c.f();
|
|
}
|
|
|
|
public int n() throws RequestException {
|
|
return this.c.g();
|
|
}
|
|
|
|
public void o() {
|
|
this.f.b();
|
|
}
|
|
|
|
public void p() {
|
|
this.f.c();
|
|
}
|
|
|
|
public void q() throws JimuException {
|
|
this.b.a();
|
|
}
|
|
|
|
public void r() throws JimuException {
|
|
this.a.a();
|
|
}
|
|
|
|
public ConnectionState a(String str) {
|
|
return this.g.a(str);
|
|
}
|
|
|
|
public ConnectionState b(String str) {
|
|
return (!g() || str == null) ? ConnectionState.STATE_DISCONNECTED : !str.equals(e()) ? ConnectionState.STATE_DISCONNECTED : ConnectionState.STATE_CONNECTED;
|
|
}
|
|
|
|
public void c(String str) {
|
|
this.h = str;
|
|
}
|
|
|
|
public void a(ConnectionStateListener connectionStateListener) {
|
|
this.g.a(connectionStateListener);
|
|
}
|
|
|
|
public boolean a(BoardInfo boardInfo, List<Firmware> list, UpdateManager.UpdateProgressListener updateProgressListener) {
|
|
return this.e.a(boardInfo, list, updateProgressListener);
|
|
}
|
|
|
|
public void a() {
|
|
this.e.a();
|
|
}
|
|
|
|
public void a(boolean z) throws JimuException {
|
|
this.c.a(z);
|
|
}
|
|
|
|
public BatteryInfo a(IPowerStateListener iPowerStateListener) {
|
|
return this.f.a(iPowerStateListener);
|
|
}
|
|
|
|
public void a(IGlobalExceptionListener iGlobalExceptionListener) {
|
|
this.f.a(iGlobalExceptionListener);
|
|
}
|
|
|
|
public int b() throws JimuException {
|
|
return this.e.b();
|
|
}
|
|
|
|
public void a(int[] iArr, float[] fArr, int i, int i2) throws MotorException {
|
|
this.a.a(iArr, fArr, i, i2);
|
|
}
|
|
|
|
public void b(IPowerStateListener iPowerStateListener) {
|
|
this.f.b(iPowerStateListener);
|
|
}
|
|
|
|
public void a(int[] iArr, int i) throws MotorException {
|
|
this.a.a(iArr, i);
|
|
}
|
|
|
|
public void b(IGlobalExceptionListener iGlobalExceptionListener) {
|
|
this.f.b(iGlobalExceptionListener);
|
|
}
|
|
|
|
public List<ServoAngleReadInfo> a(int i, boolean z) throws JimuException {
|
|
return this.a.a(i, z);
|
|
}
|
|
|
|
public void b(boolean z) {
|
|
this.f.a(z);
|
|
}
|
|
|
|
public void a(int[] iArr, int[] iArr2, int[] iArr3) throws MotorException {
|
|
this.b.a(iArr, iArr2, iArr3);
|
|
}
|
|
|
|
public ServoAngleReadInfo b(int i, boolean z) throws JimuException {
|
|
return this.a.b(i, z);
|
|
}
|
|
|
|
public int a(int i, int i2) throws JimuException {
|
|
return this.b.a(i, i2);
|
|
}
|
|
|
|
public int a(int i, List<Integer> list, boolean z) throws JimuException {
|
|
return this.d.a(i, list, z);
|
|
}
|
|
|
|
public BluetoothSpeakerInfo a(int i) throws JimuException {
|
|
return this.d.a(i);
|
|
}
|
|
}
|