[change] 更新数据采集配置 添加参数
This commit is contained in:
@@ -101,6 +101,7 @@ import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
@@ -1345,12 +1346,55 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
AdasManager.getInstance().sendRainModeReq(0);
|
||||
break;
|
||||
case Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP:
|
||||
//关闭雨天模式
|
||||
AdasManager.getInstance().sendRecordDataConfigReq();
|
||||
showRecordDataConfigRespDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showRecordDataConfigRespDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(Constants.TITLE.SEND_RECORD_DATA_CONFIG_RESP);
|
||||
View view = getLayoutInflater().inflate(R.layout.dialog_record_data_config_resp, null);
|
||||
final EditText reqTypeView = view.findViewById(R.id.reqType);
|
||||
final EditText recordTypeView = view.findViewById(R.id.recordType);
|
||||
final EditText topicsNeedToCacheView = view.findViewById(R.id.topicsNeedToCache);
|
||||
builder.setView(view);//
|
||||
builder.setCancelable(false);//
|
||||
builder.setPositiveButton("发送", null);
|
||||
//设置反面按钮,并做事件处理
|
||||
builder.setNegativeButton("取消", null);
|
||||
AlertDialog alertDialog = builder.show();//显示Dialog对话框
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Editable editable = reqTypeView.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
// 条件不成立不能关闭 AlertDialog 窗口
|
||||
Toast.makeText(MainActivity.this, "请输入ReqType", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
int reqType = Integer.parseInt(editable.toString().trim());
|
||||
editable = recordTypeView.getText();
|
||||
if (TextUtils.isEmpty(editable)) {
|
||||
Toast.makeText(MainActivity.this, "请输入RecordType", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
int recordType = Integer.parseInt(editable.toString().trim());
|
||||
List<String> topicsNeedToCache = null;
|
||||
editable = topicsNeedToCacheView.getText();
|
||||
if (!TextUtils.isEmpty(editable)) {
|
||||
String cache = editable.toString().trim();
|
||||
cache = cache.replace(",", " ").replace(",", " ");
|
||||
String[] caches = cache.split(" ");
|
||||
topicsNeedToCache = Arrays.asList(caches);
|
||||
}
|
||||
AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache);
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void handleMessage(Message msg) {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?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:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:text="ReqType:"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/reqType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:hint="0: all,1:获取当前所有topic列表,2:配置需要预加载的topic组合"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:text="RecordType:"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/recordType"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:hint="0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="number"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:gravity="right"
|
||||
android:textSize="8sp"
|
||||
android:text="TopicsNeedToCache:"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/topicsNeedToCache"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:hint="逗号间隔"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="#000"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -500,7 +500,7 @@ class MoGoAutopilotProvider :
|
||||
* 获取数据采集录制模式配置列表
|
||||
*/
|
||||
override fun getBadCaseConfig() {
|
||||
AdasManager.getInstance().sendRecordDataConfigReq()
|
||||
// AdasManager.getInstance().sendRecordDataConfigReq() TODO 需要传参
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1054,14 +1054,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
/**
|
||||
* 数据采集配置查询
|
||||
*
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRecordDataConfigReq() {
|
||||
MessagePad.RecordDataConfigReq req = MessagePad.RecordDataConfigReq
|
||||
public boolean sendRecordDataConfigReq(int reqType, int recordType, List<String> topicsNeedToCache) {
|
||||
MessagePad.RecordDataConfigReq.Builder builder = MessagePad.RecordDataConfigReq
|
||||
.newBuilder()
|
||||
.setReqType(0)
|
||||
.build();
|
||||
.setReqType(reqType)
|
||||
.setRecordType(recordType);
|
||||
if (topicsNeedToCache != null && !topicsNeedToCache.isEmpty())
|
||||
builder.addAllTopicsNeedToCache(topicsNeedToCache);
|
||||
MessagePad.RecordDataConfigReq req = builder.build();
|
||||
return sendPBMessage(MessageType.TYPE_SEND_RECORD_DATA_CONFIG_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
|
||||
@@ -515,11 +515,14 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
/**
|
||||
* 数据采集配置查询
|
||||
*
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRecordDataConfigReq() {
|
||||
return mChannel != null && mChannel.sendRecordDataConfigReq();
|
||||
public boolean sendRecordDataConfigReq(int reqType, int recordType, List<String> topicsNeedToCache) {
|
||||
return mChannel != null && mChannel.sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -256,11 +256,13 @@ public interface IAdasNetCommApi {
|
||||
|
||||
/**
|
||||
* 数据采集配置查询
|
||||
* 0: all, 其他保留
|
||||
*
|
||||
* @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合
|
||||
* @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合
|
||||
* @param topicsNeedToCache
|
||||
* @return 加入WS发送消息队列是否成功
|
||||
*/
|
||||
boolean sendRecordDataConfigReq();
|
||||
boolean sendRecordDataConfigReq(int reqType, int recordType, List<String> topicsNeedToCache);
|
||||
|
||||
/**
|
||||
* 获取已注册接口
|
||||
|
||||
Reference in New Issue
Block a user