[change] 更新设置参数命令 接口 添加绕障类功能开关 变道绕障的目标障碍物速度阈值
This commit is contained in:
@@ -648,6 +648,9 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
titleBtnData.add(Constants.TITLE.SEND_SET_DEMO_MODE_REQ_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_OPEN);
|
||||
titleBtnData.add(Constants.TITLE.SEND_SET_RAIN_MODE_REQ_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_OPEN);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_CLOSE);
|
||||
titleBtnData.add(Constants.TITLE.SEND_DETOURING_SPEED);
|
||||
}
|
||||
|
||||
private void initBtnRecyclerView() {
|
||||
@@ -1187,7 +1190,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
msg = "未连接司机端";
|
||||
}
|
||||
showToastCenter(msg);
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
switch (data) {
|
||||
case Constants.TITLE.SEND_SET_AUTOPILOT_MODE_REQ:
|
||||
@@ -1346,11 +1349,52 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
AdasManager.getInstance().sendRainModeReq(0);
|
||||
break;
|
||||
case Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP:
|
||||
//数据采集配置
|
||||
showRecordDataConfigRespDialog();
|
||||
break;
|
||||
case Constants.TITLE.SEND_DETOURING_OPEN:
|
||||
//绕障类功能开
|
||||
AdasManager.getInstance().sendDetouring(1);
|
||||
break;
|
||||
case Constants.TITLE.SEND_DETOURING_CLOSE:
|
||||
//绕障类功能关
|
||||
AdasManager.getInstance().sendDetouring(0);
|
||||
break;
|
||||
case Constants.TITLE.SEND_DETOURING_SPEED:
|
||||
//绕障速度设置
|
||||
showDetouringSpeedDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showDetouringSpeedDialog() {
|
||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
|
||||
builder1.setTitle("绕障速度");
|
||||
View view1 = getLayoutInflater().inflate(R.layout.dialog_detouring_speed, null);
|
||||
final EditText et1 = (EditText) view1.findViewById(R.id.et);
|
||||
builder1.setView(view1);//
|
||||
builder1.setCancelable(false);//
|
||||
builder1.setPositiveButton("设置", null);
|
||||
//设置反面按钮,并做事件处理
|
||||
builder1.setNegativeButton("取消", null);
|
||||
AlertDialog alertDialog1 = builder1.show();//显示Dialog对话框
|
||||
alertDialog1.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Editable editable = et1.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
// 条件不成立不能关闭 AlertDialog 窗口
|
||||
Toast.makeText(MainActivity.this, "请输入速度", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String temp = et1.getText().toString().trim();
|
||||
double speed = Double.parseDouble(temp);
|
||||
AdasManager.getInstance().sendDetouringSpeed(speed);
|
||||
alertDialog1.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showRecordDataConfigRespDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP);
|
||||
|
||||
@@ -187,6 +187,9 @@ public class Constants {
|
||||
String SEND_SET_RAIN_MODE_REQ_OPEN = "打开雨天模式";
|
||||
String SEND_SET_RAIN_MODE_REQ_CLOSE = "关闭雨天模式";
|
||||
String SEND_RECORD_DATA_CONFIG_RESP = "数据采集配置";
|
||||
String SEND_DETOURING_OPEN = "绕障类功能开";
|
||||
String SEND_DETOURING_CLOSE = "绕障类功能关";
|
||||
String SEND_DETOURING_SPEED = "绕障速度阈值";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:digits="0123456789."
|
||||
android:gravity="center"
|
||||
android:hint="变道绕障的目标障碍物速度阈值"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="10"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:text="m/s"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user