153 lines
4.6 KiB
Java
153 lines
4.6 KiB
Java
package com.ubt.jimu.connect.model;
|
|
|
|
import com.ubtech.utils.XLog;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class TopologyPartData {
|
|
public int a;
|
|
public TopologyPartType b;
|
|
public boolean c;
|
|
public int d;
|
|
public int e;
|
|
|
|
public enum TopologyPartType {
|
|
None(0),
|
|
Infrared(1),
|
|
Touch(2),
|
|
Gyro(3),
|
|
Light(4),
|
|
Gravity(5),
|
|
Ultrasonic(6),
|
|
DigitalTube(7),
|
|
Speaker(8),
|
|
EnLight(9),
|
|
Atmosphere(10),
|
|
Compass(11),
|
|
Temperature(12),
|
|
Color(13),
|
|
RgbLight(14),
|
|
Motor(15),
|
|
MainBoard(16),
|
|
MainBoard_new_low(17),
|
|
Servo(18),
|
|
Line(19),
|
|
Line_Angle(20);
|
|
|
|
private int value;
|
|
|
|
TopologyPartType(int i) {
|
|
this.value = i;
|
|
}
|
|
|
|
public static TopologyPartType getEnumType(int i) {
|
|
for (TopologyPartType topologyPartType : values()) {
|
|
if (topologyPartType.getTypeVal() == i) {
|
|
return topologyPartType;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public int getTypeVal() {
|
|
return this.value;
|
|
}
|
|
}
|
|
|
|
public TopologyPartData(TopologyPartType topologyPartType, int i, boolean z) {
|
|
this.a = i;
|
|
this.b = topologyPartType;
|
|
this.c = z;
|
|
this.d = 0;
|
|
this.e = 0;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.a);
|
|
sb.append(' ');
|
|
sb.append(this.b.toString());
|
|
sb.append(' ');
|
|
if (this.c) {
|
|
sb.append("True");
|
|
} else {
|
|
sb.append("False");
|
|
}
|
|
sb.append(' ');
|
|
sb.append("0,0");
|
|
sb.append(' ');
|
|
sb.append("0,0,0");
|
|
sb.append(' ');
|
|
sb.append(this.d);
|
|
sb.append(' ');
|
|
sb.append(this.e);
|
|
return sb.toString();
|
|
}
|
|
|
|
public TopologyPartData() {
|
|
this.a = 0;
|
|
this.b = TopologyPartType.Servo;
|
|
this.c = false;
|
|
this.d = 0;
|
|
this.e = 0;
|
|
}
|
|
|
|
public TopologyPartData(String str) {
|
|
try {
|
|
String[] split = str.split(" ");
|
|
int length = split.length;
|
|
for (int i = 0; i < length; i++) {
|
|
switch (i) {
|
|
case 0:
|
|
try {
|
|
this.a = Integer.valueOf(split[i]).intValue();
|
|
break;
|
|
} catch (NumberFormatException unused) {
|
|
this.a = 0;
|
|
break;
|
|
}
|
|
case 1:
|
|
try {
|
|
try {
|
|
int intValue = Integer.valueOf(split[i]).intValue();
|
|
this.b = TopologyPartType.getEnumType(intValue >= 8 ? intValue + 1 : intValue);
|
|
break;
|
|
} catch (Exception e) {
|
|
XLog.a("TopologyPartData", "get type" + split[i] + " - TopologyPartData error", e);
|
|
break;
|
|
}
|
|
} catch (NumberFormatException unused2) {
|
|
this.b = (TopologyPartType) Enum.valueOf(TopologyPartType.class, split[i]);
|
|
break;
|
|
}
|
|
case 2:
|
|
try {
|
|
this.c = Boolean.valueOf(split[i]).booleanValue();
|
|
break;
|
|
} catch (Exception unused3) {
|
|
XLog.b("TopologyPartData", "get ");
|
|
break;
|
|
}
|
|
case 5:
|
|
try {
|
|
this.d = Integer.valueOf(split[i]).intValue();
|
|
break;
|
|
} catch (Exception e2) {
|
|
XLog.a("TopologyPartData", "Get device width fail", e2);
|
|
break;
|
|
}
|
|
case 6:
|
|
try {
|
|
this.e = Integer.valueOf(split[i]).intValue();
|
|
break;
|
|
} catch (Exception e3) {
|
|
XLog.a("TopologyPartData", "Get device width fail", e3);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e4) {
|
|
XLog.a("TopologyPartData", "", e4);
|
|
}
|
|
}
|
|
}
|