[Change]移除乘客端Json数据转发

This commit is contained in:
xinfengkun
2022-04-07 17:58:22 +08:00
parent 2d63e9eb18
commit 18ad75b437
2 changed files with 7 additions and 30 deletions

View File

@@ -273,8 +273,11 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
}
String ip = Constants.getIPCIp(this);
if (!TextUtils.isEmpty(ip))
if (!TextUtils.isEmpty(ip)) {
etIp.setText(ip);
etIp.setSelection(ip.length());
}
// infoTitleList.add("录音测试");
//初始化fragment
manager = getSupportFragmentManager();
@@ -770,14 +773,13 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
options = new AdasOptions.Builder().setClient(true).build();
NSDNettyManager.getInstance().searchAndConnectServer(this, "1234", new NettyClientListener<MogoProtocolMsg>() {
@Override
public void onMessageResponseClient(MogoProtocolMsg msg, String sign) {
public void onMessageResponseClient(MogoProtocolMsg msg, String sign, Channel channel) {
AdasManager.getInstance().parseIPCData(msg.getBody());
}
@Override
public void onClientStatusConnectChanged(int statusCode, String sign) {
public void onClientStatusConnectChanged(int statusCode, String sign, Channel channel) {
if (statusCode == ConnectState.STATUS_CONNECT_SUCCESS) {
connectStatus = IPC_CONNECTION_STATUS.CONNECTED;
} else {

View File

@@ -301,14 +301,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
} catch (Exception e) {
e.printStackTrace();
}
// TODO 临时接续Json数据传递添加的Header 0x00表示PB数据 0x01表示Json数据
if (!adasOptions.isClient() && onMultiDeviceListener != null) {
byte[] bytes = text.getBytes(StandardCharsets.UTF_8);
byte[] temp = new byte[bytes.length + 1];
System.arraycopy(bytes, 0, temp, 1, bytes.length);
temp[0] = 0x01;
onMultiDeviceListener.onForwardingIPCMessage(temp);
}
}
/**
@@ -321,19 +313,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
if (bytes == null || bytes.length == 0) {
return;
}
//TODO 临时将Json数据转发并解析 0x00表示PB数据 0x01表示Json数据
if (adasOptions.isClient()) {
byte header = bytes[0];
byte[] temp = new byte[bytes.length - 1];
System.arraycopy(bytes, 1, temp, 0, temp.length);
bytes = temp;
if (header != 0x00) {
//Json 解析
handlerWSMsg(new String(bytes, StandardCharsets.UTF_8));
return;
}
}
//PB解析
ByteString byteString = ByteString.of(bytes);
try {
if (rawUnpack != null) {
@@ -417,11 +396,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
byte[] bytes1 = bytes.toByteArray();
parseIPCData(bytes1);
if (!adasOptions.isClient() && onMultiDeviceListener != null) {
// TODO 临时接续Json数据传递添加的Header 0x00表示PB数据 0x01表示Json数据
byte[] temp = new byte[bytes1.length + 1];
System.arraycopy(bytes1, 0, temp, 1, bytes1.length);
temp[0] = 0x00;
onMultiDeviceListener.onForwardingIPCMessage(temp);
onMultiDeviceListener.onForwardingIPCMessage(bytes1);
}
}