[pb10][金旅M1][电池状态回调]新增金旅M1控制命令和m1状态回调接口,以及电池状态接口
This commit is contained in:
@@ -16,9 +16,10 @@ import java.util.List;
|
||||
import chassis.SpecialVehicleTaskCmdOuterClass;
|
||||
|
||||
public class SpecialVehicleBean {
|
||||
private interface TAG {
|
||||
public interface TAG {
|
||||
String FTQSC = "ftqsc";//福田清扫车
|
||||
String KWXB = "kwxb";//开沃小巴
|
||||
String JLM1 = "jlm1";//金旅M1
|
||||
}
|
||||
|
||||
public interface SEND_TYPE {
|
||||
@@ -30,7 +31,7 @@ public class SpecialVehicleBean {
|
||||
public final String name;
|
||||
public final String simpleName;//简单名字 两个字
|
||||
public final List<SpecialVehicleOption> options;
|
||||
private final String tag;//用于存储
|
||||
public final String tag;//用于存储
|
||||
public int sendType = SEND_TYPE.ONE;//发送类型
|
||||
private SpecialVehicleFloatWindowManager manager;
|
||||
|
||||
@@ -127,20 +128,79 @@ public class SpecialVehicleBean {
|
||||
int checkPos = options.get(index).checkPos;
|
||||
setFuTianCleanValue(builder, index, checkPos);
|
||||
}
|
||||
|
||||
SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd fuTianCleanCmd = builder.build();
|
||||
SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd = SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd.newBuilder()
|
||||
.setRoboSweeperFutianCleanCmd(fuTianCleanCmd).build();
|
||||
AdasManager.getInstance().sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd);
|
||||
str = TextFormat.printer().escapingNonAscii(false).printToString(fuTianTaskCmd).replaceAll("\n", "");
|
||||
str = TextFormat.printer().escapingNonAscii(false).shortDebugString(fuTianTaskCmd);
|
||||
} else if (TextUtils.equals(this.tag, TAG.KWXB)) { //开沃小巴
|
||||
SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd = SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd.newBuilder()
|
||||
.build();
|
||||
AdasManager.getInstance().sendRoboVanSkywellTaskCmd(vanSkywellTaskCmd);
|
||||
} else if (TextUtils.equals(this.tag, TAG.JLM1)) { //金旅M1
|
||||
SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.Builder builder = SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder();
|
||||
if (index < 0) {
|
||||
for (index = 0; index < options.size(); index++) {
|
||||
SpecialVehicleOption option = options.get(index);
|
||||
if (option.moreCheckPos != -1) {
|
||||
option.checkPos = option.moreCheckPos;
|
||||
option.moreCheckPos = -1;
|
||||
}
|
||||
setJinlvM1Value(builder, index, option.checkPos);
|
||||
}
|
||||
} else {
|
||||
int checkPos = options.get(index).checkPos;
|
||||
setJinlvM1Value(builder, index, checkPos);
|
||||
}
|
||||
SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd = builder.build();
|
||||
AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd);
|
||||
str = TextFormat.printer().escapingNonAscii(false).shortDebugString(roboBusJinlvM1Cmd);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private void setJinlvM1Value(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.Builder builder, int index, int checkPos) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
builder.setAirConditionerCmd(checkPos);
|
||||
break;
|
||||
case 1:
|
||||
builder.setAirConditionerModeCmd(checkPos);
|
||||
break;
|
||||
case 2:
|
||||
builder.setAirConditionerWindSpeedCmd(checkPos);
|
||||
break;
|
||||
case 3:
|
||||
if (checkPos == 1) {
|
||||
checkPos = 16;
|
||||
} else if (checkPos == 2) {
|
||||
checkPos = 20;
|
||||
} else if (checkPos == 3) {
|
||||
checkPos = 26;
|
||||
}
|
||||
builder.setAirConditionerTemperatureCmd(checkPos);
|
||||
break;
|
||||
case 4:
|
||||
builder.setHeaderCmd(checkPos);
|
||||
break;
|
||||
case 5:
|
||||
builder.setHeaderWindSpeedCmd(checkPos);
|
||||
break;
|
||||
case 6:
|
||||
builder.setMainLamp1Cmd(checkPos);
|
||||
break;
|
||||
case 7:
|
||||
builder.setMainLamp2Cmd(checkPos);
|
||||
break;
|
||||
case 8:
|
||||
builder.setSmallLampCmd(checkPos);
|
||||
break;
|
||||
case 9:
|
||||
builder.setFrontDoorCmd(checkPos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setFuTianCleanValue(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianCleanCmd.Builder builder, int index, int checkPos) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
@@ -222,8 +282,65 @@ public class SpecialVehicleBean {
|
||||
optionsF.add(new SpecialVehicleOption("扫盘加速", tag, value, 0));
|
||||
SpecialVehicleBean beanF = new SpecialVehicleBean("福田清扫车", "福清", TAG.FTQSC, optionsF);
|
||||
SpecialVehicleBean beanK = new SpecialVehicleBean("开沃小巴", "开巴", TAG.KWXB, null);
|
||||
List<SpecialVehicleOption> optionsM1 = new ArrayList<>();
|
||||
tag = 0;
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启空调";
|
||||
value[2] = "2-关闭空调";
|
||||
optionsM1.add(new SpecialVehicleOption("空调", tag++, value, 0));
|
||||
value = new String[4];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-自动模式";
|
||||
value[2] = "2-制冷模式";
|
||||
value[3] = "3-通风模式";
|
||||
optionsM1.add(new SpecialVehicleOption("空调模式", tag++, value, 0));
|
||||
value = new String[4];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-1档";
|
||||
value[2] = "2-2档";
|
||||
value[3] = "3-3档";
|
||||
optionsM1.add(new SpecialVehicleOption("空调档位", tag++, value, 0));
|
||||
value = new String[4];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "16-16度";
|
||||
value[2] = "20-20度";
|
||||
value[3] = "26-26度";
|
||||
optionsM1.add(new SpecialVehicleOption("空调温度", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启暖风";
|
||||
value[2] = "2-关闭暖风";
|
||||
optionsM1.add(new SpecialVehicleOption("暖风机", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-1档";
|
||||
value[2] = "2-2档";
|
||||
optionsM1.add(new SpecialVehicleOption("暖风机档位", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("顶灯1", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("顶灯2", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-开启";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("氛围灯", tag++, value, 0));
|
||||
value = new String[3];
|
||||
value[0] = "0-DEFAULT";
|
||||
value[1] = "1-打开";
|
||||
value[2] = "2-关闭";
|
||||
optionsM1.add(new SpecialVehicleOption("车门", tag++, value, 0));
|
||||
SpecialVehicleBean beanM1 = new SpecialVehicleBean("金旅M1", "M1", TAG.JLM1, optionsM1);
|
||||
list.add(beanF);
|
||||
list.add(beanK);
|
||||
list.add(beanM1);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -880,7 +880,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatistics(AutopilotStatistics statistics) {
|
||||
Log.i(TAG, "启动自动驾驶状态=" + statistics.status + " 用时=" + statistics.usedTime + " SetAutopilotModeReq=" + TextFormat.printer().escapingNonAscii(false).printToString(statistics.req) + " failedMessage=" + (statistics.failedMessage == null ? null : TextFormat.printer().escapingNonAscii(false).printToString(statistics.failedMessage)));
|
||||
Log.i(TAG, "启动自动驾驶状态=" + statistics.status + " 用时=" + statistics.usedTime + " SetAutopilotModeReq=" + (statistics.req == null ? null : TextFormat.printer().escapingNonAscii(false).printToString(statistics.req)) + " failedMessage=" + (statistics.failedMessage == null ? null : TextFormat.printer().escapingNonAscii(false).printToString(statistics.failedMessage)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1291,6 +1291,13 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
break;
|
||||
case Constants.TITLE.SEND_SPECIAL_VEHICLE_TASK_CMD:
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(1,2,3,4);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(5,6);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1MainLampCmd(7,8);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(9);
|
||||
// AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(10);
|
||||
|
||||
|
||||
if (specialVehicleBeanList == null) {
|
||||
specialVehicleBeanList = SpecialVehicleBean.init();
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public class SpecialVehicleDialog extends Dialog {
|
||||
private void initView() {
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
findViewById(R.id.settings).setVisibility(View.GONE);
|
||||
findViewById(R.id.cancel).setVisibility(View.GONE);
|
||||
TextView textView = findViewById(R.id.title);
|
||||
textView.setText("特种车辆");
|
||||
}
|
||||
|
||||
@@ -330,9 +330,11 @@ public class SpecialVehicleFloatWindow extends LinearLayout {
|
||||
.findViewById(R.id.r_btn);
|
||||
button.setText(value[j]);
|
||||
button.setId(j);
|
||||
if (i == 1 || i == 2 || i == 3 || i == 4) {
|
||||
ViewGroup.LayoutParams layoutParams = button.getLayoutParams();
|
||||
layoutParams.width = 202;
|
||||
if (specialVehicleBean.tag.equals(SpecialVehicleBean.TAG.FTQSC)) {
|
||||
if (i == 1 || i == 2 || i == 3 || i == 4) {
|
||||
ViewGroup.LayoutParams layoutParams = button.getLayoutParams();
|
||||
layoutParams.width = 202;
|
||||
}
|
||||
}
|
||||
radioGroup.addView(button);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user